ghostos 0.1.13 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.esm.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see index.esm.js.LICENSE.txt */
2
- import"react";var t={1795(t,e,n){!function(t,e,n,r){var i=function(t,e,n){return{endTime:e,insertTime:n,type:"exponentialRampToValue",value:t}},o=function(t,e,n){return{endTime:e,insertTime:n,type:"linearRampToValue",value:t}},s=function(t,e){return{startTime:e,type:"setValue",value:t}},a=function(t,e,n){return{duration:n,startTime:e,type:"setValueCurve",values:t}},u=function(t,e,n){var r=n.startTime,i=n.target,o=n.timeConstant;return i+(e-i)*Math.exp((r-t)/o)},c=function(t){return"exponentialRampToValue"===t.type},l=function(t){return"linearRampToValue"===t.type},h=function(t){return c(t)||l(t)},d=function(t){return"setValue"===t.type},p=function(t){return"setValueCurve"===t.type},f=function(t,e,n,r){var i=t[e];return void 0===i?r:h(i)||d(i)?i.value:p(i)?i.values[i.values.length-1]:u(n,f(t,e-1,i.startTime,r),i)},m=function(t,e,n,r,i){return void 0===n?[r.insertTime,i]:h(n)?[n.endTime,n.value]:d(n)?[n.startTime,n.value]:p(n)?[n.startTime+n.duration,n.values[n.values.length-1]]:[n.startTime,f(t,e-1,n.startTime,i)]},g=function(t){return"cancelAndHold"===t.type},_=function(t){return"cancelScheduledValues"===t.type},y=function(t){return g(t)||_(t)?t.cancelTime:c(t)||l(t)?t.endTime:t.startTime},v=function(t,e,n,r){var i=r.endTime,o=r.value;return n===o?o:0<n&&0<o||n<0&&o<0?n*Math.pow(o/n,(t-e)/(i-e)):0},b=function(t,e,n,r){return n+(t-e)/(r.endTime-e)*(r.value-n)},w=function(t,e){var n=Math.floor(e),r=Math.ceil(e);return n===r?t[n]:(1-(e-n))*t[n]+(1-(r-e))*t[r]},x=function(t,e){var n=e.duration,r=e.startTime,i=e.values,o=(t-r)/n*(i.length-1);return w(i,o)},T=function(t){return"setTarget"===t.type},k=function(){function t(e){n(this,t),this._automationEvents=[],this._currenTime=0,this._defaultValue=e}return r(t,[{key:Symbol.iterator,value:function(){return this._automationEvents[Symbol.iterator]()}},{key:"add",value:function(t){var e=y(t);if(g(t)||_(t)){var n=this._automationEvents.findIndex(function(n){return _(t)&&p(n)?n.startTime+n.duration>=e:y(n)>=e}),r=this._automationEvents[n];if(-1!==n&&(this._automationEvents=this._automationEvents.slice(0,n)),g(t)){var u=this._automationEvents[this._automationEvents.length-1];if(void 0!==r&&h(r)){if(void 0!==u&&T(u))throw new Error("The internal list is malformed.");var d=void 0===u?r.insertTime:p(u)?u.startTime+u.duration:y(u),f=void 0===u?this._defaultValue:p(u)?u.values[u.values.length-1]:u.value,m=c(r)?v(e,d,f,r):b(e,d,f,r),w=c(r)?i(m,e,this._currenTime):o(m,e,this._currenTime);this._automationEvents.push(w)}if(void 0!==u&&T(u)&&this._automationEvents.push(s(this.getValue(e),e)),void 0!==u&&p(u)&&u.startTime+u.duration>e){var x=e-u.startTime,k=(u.values.length-1)/u.duration,S=Math.max(2,1+Math.ceil(x*k)),A=x/(S-1)*k,E=u.values.slice(0,S);if(A<1)for(var O=1;O<S;O+=1){var C=A*O%1;E[O]=u.values[O-1]*(1-C)+u.values[O]*C}this._automationEvents[this._automationEvents.length-1]=a(E,u.startTime,x)}}}else{var M=this._automationEvents.findIndex(function(t){return y(t)>e}),N=-1===M?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[M-1];if(void 0!==N&&p(N)&&y(N)+N.duration>e)return!1;var I=c(t)?i(t.value,t.endTime,this._currenTime):l(t)?o(t.value,e,this._currenTime):t;if(-1===M)this._automationEvents.push(I);else{if(p(t)&&e+t.duration>y(this._automationEvents[M]))return!1;this._automationEvents.splice(M,0,I)}}return!0}},{key:"flush",value:function(t){var e=this._automationEvents.findIndex(function(e){return y(e)>t});if(e>1){var n=this._automationEvents.slice(e-1),r=n[0];T(r)&&n.unshift(s(f(this._automationEvents,e-2,r.startTime,this._defaultValue),r.startTime)),this._automationEvents=n}}},{key:"getValue",value:function(t){if(0===this._automationEvents.length)return this._defaultValue;var n=this._automationEvents.findIndex(function(e){return y(e)>t}),r=this._automationEvents[n],i=(-1===n?this._automationEvents.length:n)-1,o=this._automationEvents[i];if(void 0!==o&&T(o)&&(void 0===r||!h(r)||r.insertTime>t))return u(t,f(this._automationEvents,i-1,o.startTime,this._defaultValue),o);if(void 0!==o&&d(o)&&(void 0===r||!h(r)))return o.value;if(void 0!==o&&p(o)&&(void 0===r||!h(r)||o.startTime+o.duration>t))return t<o.startTime+o.duration?x(t,o):o.values[o.values.length-1];if(void 0!==o&&h(o)&&(void 0===r||!h(r)))return o.value;if(void 0!==r&&c(r)){var s=m(this._automationEvents,i,o,r,this._defaultValue),a=e(s,2),g=a[0],_=a[1];return v(t,g,_,r)}if(void 0!==r&&l(r)){var w=m(this._automationEvents,i,o,r,this._defaultValue),k=e(w,2),S=k[0],A=k[1];return b(t,S,A,r)}return this._defaultValue}}])}(),S=function(t){return{cancelTime:t,type:"cancelAndHold"}},A=function(t){return{cancelTime:t,type:"cancelScheduledValues"}},E=function(t,e){return{endTime:e,type:"exponentialRampToValue",value:t}},O=function(t,e){return{endTime:e,type:"linearRampToValue",value:t}},C=function(t,e,n){return{startTime:e,target:t,timeConstant:n,type:"setTarget"}};t.AutomationEventList=k,t.createCancelAndHoldAutomationEvent=S,t.createCancelScheduledValuesAutomationEvent=A,t.createExponentialRampToValueAutomationEvent=E,t.createLinearRampToValueAutomationEvent=O,t.createSetTargetAutomationEvent=C,t.createSetValueAutomationEvent=s,t.createSetValueCurveAutomationEvent=a}(e,n(5715),n(7383),n(4579))},7526(t,e){e.byteLength=function(t){var e=a(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,o=a(t),s=o[0],u=o[1],c=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,u)),l=0,h=u>0?s-4:s;for(n=0;n<h;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],c[l++]=e>>16&255,c[l++]=e>>8&255,c[l++]=255&e;2===u&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,c[l++]=255&e);1===u&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,c[l++]=e>>8&255,c[l++]=255&e);return c},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,u=r-i;a<u;a+=s)o.push(c(t,a,a+s>u?u:a+s));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=o[s],r[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function u(t){return n[t>>18&63]+n[t>>12&63]+n[t>>6&63]+n[63&t]}function c(t,e,n){for(var r,i=[],o=e;o<n;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(u(r));return i.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},8287(t,e,n){const r=n(7526),i=n(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=u,e.IS=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return c(t,e,n)}function c(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|m(t,e);let r=a(n);const i=r.write(t,e);i!==n&&(r=r.slice(0,i));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(X(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(X(t,ArrayBuffer)||t&&X(t.buffer,ArrayBuffer))return p(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(X(t,SharedArrayBuffer)||t&&X(t.buffer,SharedArrayBuffer)))return p(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return u.from(r,e,n);const i=function(t){if(u.isBuffer(t)){const e=0|f(t.length),n=a(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||K(t.length)?a(0):d(t);if("Buffer"===t.type&&Array.isArray(t.data))return d(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return l(t),a(t<0?0:0|f(t))}function d(t){const e=t.length<0?0:0|f(t.length),n=a(e);for(let r=0;r<e;r+=1)n[r]=255&t[r];return n}function p(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,u.prototype),r}function f(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function m(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||X(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return J(t).length;default:if(i)return r?-1:W(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return M(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return O(this,e,n);case"latin1":case"binary":return C(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function _(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),K(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:v(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,r,i){let o,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;o<a;o++)if(c(t,o)===c(e,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===u)return r*s}else-1!==r&&(o-=o-r),r=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){let n=!0;for(let r=0;r<u;r++)if(c(t,o+r)!==c(e,r)){n=!1;break}if(n)return o}return-1}function b(t,e,n,r){n=Number(n)||0;const i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s<r;++s){const r=parseInt(e.substr(2*s,2),16);if(K(r))return s;t[n+s]=r}return s}function w(t,e,n,r){return H(W(e,t.length-n),t,n,r)}function x(t,e,n,r){return H(function(t){const e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function T(t,e,n,r){return H(J(e),t,n,r)}function k(t,e,n,r){return H(function(t,e){let n,r,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function S(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function A(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i<n;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=E)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=E));return n}(r)}u.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),!u.TYPED_ARRAY_SUPPORT&&"undefined"!=typeof console&&console.error,Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,n){return c(t,e,n)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,n){return function(t,e,n){return l(t),t<=0?a(t):void 0!==e?"string"==typeof n?a(t).fill(e,n):a(t).fill(e):a(t)}(t,e,n)},u.allocUnsafe=function(t){return h(t)},u.allocUnsafeSlow=function(t){return h(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(X(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),X(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;const r=u.allocUnsafe(e);let i=0;for(n=0;n<t.length;++n){let e=t[n];if(X(e,Uint8Array))i+e.length>r.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},u.byteLength=m,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)_(this,e,e+1);return this},u.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)_(this,e,e+3),_(this,e+1,e+2);return this},u.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)_(this,e,e+7),_(this,e+1,e+6),_(this,e+2,e+5),_(this,e+3,e+4);return this},u.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):g.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){let t="";const n=e.IS;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,n,r,i){if(X(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const a=Math.min(o,s),c=this.slice(r,i),l=t.slice(e,n);for(let t=0;t<a;++t)if(c[t]!==l[t]){o=c[t],s=l[t];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},u.prototype.indexOf=function(t,e,n){return y(this,t,e,n,!0)},u.prototype.lastIndexOf=function(t,e,n){return y(this,t,e,n,!1)},u.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return w(this,t,e,n);case"ascii":case"latin1":case"binary":return x(this,t,e,n);case"base64":return T(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const E=4096;function O(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function C(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function M(t,e,n){const r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=e;r<n;++r)i+=Q[t[r]];return i}function N(t,e,n){const r=t.slice(e,n);let i="";for(let t=0;t<r.length-1;t+=2)i+=String.fromCharCode(r[t]+256*r[t+1]);return i}function I(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function j(t,e,n,r,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function R(t,e,n,r,i){U(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function P(t,e,n,r,i){U(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function D(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(t,e,n,r,o){return e=+e,n>>>=0,o||D(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function F(t,e,n,r,o){return e=+e,n>>>=0,o||D(t,0,n,8),i.write(t,e,n,r,52,8),n+8}u.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);const r=this.subarray(t,e);return Object.setPrototypeOf(r,u.prototype),r},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return r},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=Z(function(t){V(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||G(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),u.prototype.readBigUInt64BE=Z(function(t){V(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||G(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),u.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},u.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||I(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(t,e){t>>>=0,e||I(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=Z(function(t){V(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||G(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)}),u.prototype.readBigInt64BE=Z(function(t){V(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||G(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)}),u.prototype.readFloatLE=function(t,e){return t>>>=0,e||I(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||I(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||I(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||I(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){j(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){j(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=Z(function(t,e=0){return R(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Z(function(t,e=0){return P(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);j(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i<n&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o|0)-s&255;return e+n},u.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);j(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o|0)-s&255;return e+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=Z(function(t,e=0){return R(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Z(function(t,e=0){return P(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeFloatLE=function(t,e,n){return L(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return L(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return F(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return F(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,r){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);const i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},u.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){const e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{const o=u.isBuffer(t)?t:u.from(t,r),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=o[i%s]}return this};const $={};function B(t,e,n){$[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function q(t){let e="",n=t.length;const r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function U(t,e,n,r,i,o){if(t>n||t<e){const r="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new $.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){V(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||G(e,t.length-(n+1))}(r,i,o)}function V(t,e){if("number"!=typeof t)throw new $.ERR_INVALID_ARG_TYPE(e,"number",t)}function G(t,e,n){if(Math.floor(t)!==t)throw V(t,n),new $.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new $.ERR_BUFFER_OUT_OF_BOUNDS;throw new $.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}B("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),B("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),B("ERR_OUT_OF_RANGE",function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=q(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=q(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r},RangeError);const z=/[^+/0-9A-Za-z-_]/g;function W(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s<r;++s){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function J(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,n,r){let i;for(i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function X(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function K(t){return t!=t}const Q=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Z(t){return"undefined"==typeof BigInt?Y:t}function Y(){throw new Error("BigInt not supported")}},7007(t){var e,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};e=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise(function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}m(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&m(t,"error",e,n)}(t,i,{once:!0})})},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function c(t,e,n,r){var i,o,s;if(a(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]),void 0===s)s=o[e]=n,++t._eventsCount;else if("function"==typeof s?s=o[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=u(t))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=s.length,console&&console.warn}return t}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=l.bind(r);return i.listener=n,r.wrapFn=i,i}function d(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(i):f(i,i.length)}function p(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function f(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function m(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,function i(o){r.once&&t.removeEventListener(e,i),n(o)})}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");s=t}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var i="error"===t,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)r(u,this,e);else{var c=u.length,l=f(u,c);for(n=0;n<c;++n)r(l[n],this,e)}return!0},o.prototype.addListener=function(t,e){return c(this,t,e,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(t,e){return c(this,t,e,!0)},o.prototype.once=function(t,e){return a(e),this.on(t,h(this,t,e)),this},o.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,h(this,t,e)),this},o.prototype.removeListener=function(t,e){var n,r,i,o,s;if(a(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0===--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,i),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,s||e)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},o.prototype.listeners=function(t){return d(this,t,!0)},o.prototype.rawListeners=function(t){return d(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},8463(t){t.exports=s,s.default=s,s.stable=l,s.stableStringify=l;var e="[...]",n="[Circular]",r=[],i=[];function o(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function s(t,e,n,s){var a;void 0===s&&(s=o()),u(t,"",0,[],void 0,0,s);try{a=0===i.length?JSON.stringify(t,e,n):JSON.stringify(t,d(e),n)}catch(t){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var c=r.pop();4===c.length?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return a}function a(t,e,n,o){var s=Object.getOwnPropertyDescriptor(o,n);void 0!==s.get?s.configurable?(Object.defineProperty(o,n,{value:t}),r.push([o,n,e,s])):i.push([e,n,t]):(o[n]=t,r.push([o,n,e]))}function u(t,r,i,o,s,c,l){var h;if(c+=1,"object"==typeof t&&null!==t){for(h=0;h<o.length;h++)if(o[h]===t)return void a(n,t,r,s);if(void 0!==l.depthLimit&&c>l.depthLimit)return void a(e,t,r,s);if(void 0!==l.edgesLimit&&i+1>l.edgesLimit)return void a(e,t,r,s);if(o.push(t),Array.isArray(t))for(h=0;h<t.length;h++)u(t[h],h,h,o,t,c,l);else{var d=Object.keys(t);for(h=0;h<d.length;h++){var p=d[h];u(t[p],p,h,o,t,c,l)}}o.pop()}}function c(t,e){return t<e?-1:t>e?1:0}function l(t,e,n,s){void 0===s&&(s=o());var a,u=h(t,"",0,[],void 0,0,s)||t;try{a=0===i.length?JSON.stringify(u,e,n):JSON.stringify(u,d(e),n)}catch(t){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var c=r.pop();4===c.length?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return a}function h(t,i,o,s,u,l,d){var p;if(l+=1,"object"==typeof t&&null!==t){for(p=0;p<s.length;p++)if(s[p]===t)return void a(n,t,i,u);try{if("function"==typeof t.toJSON)return}catch(t){return}if(void 0!==d.depthLimit&&l>d.depthLimit)return void a(e,t,i,u);if(void 0!==d.edgesLimit&&o+1>d.edgesLimit)return void a(e,t,i,u);if(s.push(t),Array.isArray(t))for(p=0;p<t.length;p++)h(t[p],p,p,s,t,l,d);else{var f={},m=Object.keys(t).sort(c);for(p=0;p<m.length;p++){var g=m[p];h(t[g],g,p,s,t,l,d),f[g]=t[g]}if(void 0===u)return f;r.push([u,i,t]),u[i]=f}s.pop()}}function d(t){return t=void 0!==t?t:function(t,e){return e},function(e,n){if(i.length>0)for(var r=0;r<i.length;r++){var o=i[r];if(o[1]===e&&o[0]===n){n=o[2],i.splice(r,1);break}}return t.call(this,e,n)}}},639(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var i=r(n(261)),o=r(n(2300)),s=n(9027),a=n(1127),u=r(n(6727)),c=r(n(1350)),l=r(n(1148)),h=i.default.create;function d(){var t=h();return t.compile=function(e,n){return a.compile(e,n,t)},t.precompile=function(e,n){return a.precompile(e,n,t)},t.AST=o.default,t.Compiler=a.Compiler,t.JavaScriptCompiler=u.default,t.Parser=s.parser,t.parse=s.parse,t.parseWithoutProcessing=s.parseWithoutProcessing,t}var p=d();p.create=d,l.default(p),p.Visitor=c.default,p.default=p,e.default=p,t.exports=e.default},261(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}function i(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}e.__esModule=!0;var o=i(n(2871)),s=r(n(9613)),a=r(n(3769)),u=i(n(2849)),c=i(n(7624)),l=r(n(1148));function h(){var t=new o.HandlebarsEnvironment;return u.extend(t,o),t.SafeString=s.default,t.Exception=a.default,t.Utils=u,t.escapeExpression=u.escapeExpression,t.VM=c,t.template=function(e){return c.template(e,t)},t}var d=h();d.create=h,l.default(d),d.default=d,e.default=d,t.exports=e.default},2871(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.HandlebarsEnvironment=h;var i=n(2849),o=r(n(3769)),s=n(2277),a=n(5940),u=r(n(566)),c=n(3865);e.VERSION="4.7.8";e.COMPILER_REVISION=8;e.LAST_COMPATIBLE_COMPILER_REVISION=7;e.REVISION_CHANGES={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};var l="[object Object]";function h(t,e,n){this.helpers=t||{},this.partials=e||{},this.decorators=n||{},s.registerDefaultHelpers(this),a.registerDefaultDecorators(this)}h.prototype={constructor:h,logger:u.default,log:u.default.log,registerHelper:function(t,e){if(i.toString.call(t)===l){if(e)throw new o.default("Arg not supported with multiple helpers");i.extend(this.helpers,t)}else this.helpers[t]=e},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,e){if(i.toString.call(t)===l)i.extend(this.partials,t);else{if(void 0===e)throw new o.default('Attempting to register a partial called "'+t+'" as undefined');this.partials[t]=e}},unregisterPartial:function(t){delete this.partials[t]},registerDecorator:function(t,e){if(i.toString.call(t)===l){if(e)throw new o.default("Arg not supported with multiple decorators");i.extend(this.decorators,t)}else this.decorators[t]=e},unregisterDecorator:function(t){delete this.decorators[t]},resetLoggedPropertyAccesses:function(){c.resetLoggedProperties()}};var d=u.default.log;e.log=d,e.createFrame=i.createFrame,e.logger=u.default},2300(t,e){e.__esModule=!0;var n={helpers:{helperExpression:function(t){return"SubExpression"===t.type||("MustacheStatement"===t.type||"BlockStatement"===t.type)&&!!(t.params&&t.params.length||t.hash)},scopedId:function(t){return/^\.|this\b/.test(t.original)},simpleId:function(t){return 1===t.parts.length&&!n.helpers.scopedId(t)&&!t.depth}}};e.default=n,t.exports=e.default},9027(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.parseWithoutProcessing=c,e.parse=function(t,e){var n=c(t,e);return new o.default(e).accept(n)};var i=r(n(6201)),o=r(n(915)),s=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(8425)),a=n(2849);e.parser=i.default;var u={};function c(t,e){return"Program"===t.type?t:(i.default.yy=u,u.locInfo=function(t){return new u.SourceLocation(e&&e.srcName,t)},i.default.parse(t))}a.extend(u,s)},9632(t,e,n){e.__esModule=!0;var r=n(2849),i=void 0;try{}catch(t){}function o(t,e,n){if(r.isArray(t)){for(var i=[],o=0,s=t.length;o<s;o++)i.push(e.wrap(t[o],n));return i}return"boolean"==typeof t||"number"==typeof t?t+"":t}function s(t){this.srcFile=t,this.source=[]}i||((i=function(t,e,n,r){this.src="",r&&this.add(r)}).prototype={add:function(t){r.isArray(t)&&(t=t.join("")),this.src+=t},prepend:function(t){r.isArray(t)&&(t=t.join("")),this.src=t+this.src},toStringWithSourceMap:function(){return{code:this.toString()}},toString:function(){return this.src}}),s.prototype={isEmpty:function(){return!this.source.length},prepend:function(t,e){this.source.unshift(this.wrap(t,e))},push:function(t,e){this.source.push(this.wrap(t,e))},merge:function(){var t=this.empty();return this.each(function(e){t.add([" ",e,"\n"])}),t},each:function(t){for(var e=0,n=this.source.length;e<n;e++)t(this.source[e])},empty:function(){var t=this.currentLocation||{start:{}};return new i(t.start.line,t.start.column,this.srcFile)},wrap:function(t){var e=arguments.length<=1||void 0===arguments[1]?this.currentLocation||{start:{}}:arguments[1];return t instanceof i?t:(t=o(t,this,e),new i(e.start.line,e.start.column,this.srcFile,t))},functionCall:function(t,e,n){return n=this.generateList(n),this.wrap([t,e?"."+e+"(":"(",n,")"])},quotedString:function(t){return'"'+(t+"").replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(t){var e=this,n=[];Object.keys(t).forEach(function(r){var i=o(t[r],e);"undefined"!==i&&n.push([e.quotedString(r),":",i])});var r=this.generateList(n);return r.prepend("{"),r.add("}"),r},generateList:function(t){for(var e=this.empty(),n=0,r=t.length;n<r;n++)n&&e.add(","),e.add(o(t[n],this));return e},generateArray:function(t){var e=this.generateList(t);return e.prepend("["),e.add("]"),e}},e.default=s,t.exports=e.default},1127(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.Compiler=u,e.precompile=function(t,e,n){if(null==t||"string"!=typeof t&&"Program"!==t.type)throw new i.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+t);"data"in(e=e||{})||(e.data=!0);e.compat&&(e.useDepths=!0);var r=n.parse(t,e),o=(new n.Compiler).compile(r,e);return(new n.JavaScriptCompiler).compile(o,e)},e.compile=function(t,e,n){void 0===e&&(e={});if(null==t||"string"!=typeof t&&"Program"!==t.type)throw new i.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+t);"data"in(e=o.extend({},e))||(e.data=!0);e.compat&&(e.useDepths=!0);var r=void 0;function s(){var r=n.parse(t,e),i=(new n.Compiler).compile(r,e),o=(new n.JavaScriptCompiler).compile(i,e,void 0,!0);return n.template(o)}function a(t,e){return r||(r=s()),r.call(this,t,e)}return a._setup=function(t){return r||(r=s()),r._setup(t)},a._child=function(t,e,n,i){return r||(r=s()),r._child(t,e,n,i)},a};var i=r(n(3769)),o=n(2849),s=r(n(2300)),a=[].slice;function u(){}function c(t,e){if(t===e)return!0;if(o.isArray(t)&&o.isArray(e)&&t.length===e.length){for(var n=0;n<t.length;n++)if(!c(t[n],e[n]))return!1;return!0}}function l(t){if(!t.path.parts){var e=t.path;t.path={type:"PathExpression",data:!1,depth:0,parts:[e.original+""],original:e.original+"",loc:e.loc}}}u.prototype={compiler:u,equals:function(t){var e=this.opcodes.length;if(t.opcodes.length!==e)return!1;for(var n=0;n<e;n++){var r=this.opcodes[n],i=t.opcodes[n];if(r.opcode!==i.opcode||!c(r.args,i.args))return!1}e=this.children.length;for(n=0;n<e;n++)if(!this.children[n].equals(t.children[n]))return!1;return!0},guid:0,compile:function(t,e){return this.sourceNode=[],this.opcodes=[],this.children=[],this.options=e,this.stringParams=e.stringParams,this.trackIds=e.trackIds,e.blockParams=e.blockParams||[],e.knownHelpers=o.extend(Object.create(null),{helperMissing:!0,blockHelperMissing:!0,each:!0,if:!0,unless:!0,with:!0,log:!0,lookup:!0},e.knownHelpers),this.accept(t)},compileProgram:function(t){var e=(new this.compiler).compile(t,this.options),n=this.guid++;return this.usePartial=this.usePartial||e.usePartial,this.children[n]=e,this.useDepths=this.useDepths||e.useDepths,n},accept:function(t){if(!this[t.type])throw new i.default("Unknown type: "+t.type,t);this.sourceNode.unshift(t);var e=this[t.type](t);return this.sourceNode.shift(),e},Program:function(t){this.options.blockParams.unshift(t.blockParams);for(var e=t.body,n=e.length,r=0;r<n;r++)this.accept(e[r]);return this.options.blockParams.shift(),this.isSimple=1===n,this.blockParams=t.blockParams?t.blockParams.length:0,this},BlockStatement:function(t){l(t);var e=t.program,n=t.inverse;e=e&&this.compileProgram(e),n=n&&this.compileProgram(n);var r=this.classifySexpr(t);"helper"===r?this.helperSexpr(t,e,n):"simple"===r?(this.simpleSexpr(t),this.opcode("pushProgram",e),this.opcode("pushProgram",n),this.opcode("emptyHash"),this.opcode("blockValue",t.path.original)):(this.ambiguousSexpr(t,e,n),this.opcode("pushProgram",e),this.opcode("pushProgram",n),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},DecoratorBlock:function(t){var e=t.program&&this.compileProgram(t.program),n=this.setupFullMustacheParams(t,e,void 0),r=t.path;this.useDecorators=!0,this.opcode("registerDecorator",n.length,r.original)},PartialStatement:function(t){this.usePartial=!0;var e=t.program;e&&(e=this.compileProgram(t.program));var n=t.params;if(n.length>1)throw new i.default("Unsupported number of partial arguments: "+n.length,t);n.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):n.push({type:"PathExpression",parts:[],depth:0}));var r=t.name.original,o="SubExpression"===t.name.type;o&&this.accept(t.name),this.setupFullMustacheParams(t,e,void 0,!0);var s=t.indent||"";this.options.preventIndent&&s&&(this.opcode("appendContent",s),s=""),this.opcode("invokePartial",o,r,s),this.opcode("append")},PartialBlockStatement:function(t){this.PartialStatement(t)},MustacheStatement:function(t){this.SubExpression(t),t.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(t){this.DecoratorBlock(t)},ContentStatement:function(t){t.value&&this.opcode("appendContent",t.value)},CommentStatement:function(){},SubExpression:function(t){l(t);var e=this.classifySexpr(t);"simple"===e?this.simpleSexpr(t):"helper"===e?this.helperSexpr(t):this.ambiguousSexpr(t)},ambiguousSexpr:function(t,e,n){var r=t.path,i=r.parts[0],o=null!=e||null!=n;this.opcode("getContext",r.depth),this.opcode("pushProgram",e),this.opcode("pushProgram",n),r.strict=!0,this.accept(r),this.opcode("invokeAmbiguous",i,o)},simpleSexpr:function(t){var e=t.path;e.strict=!0,this.accept(e),this.opcode("resolvePossibleLambda")},helperSexpr:function(t,e,n){var r=this.setupFullMustacheParams(t,e,n),o=t.path,a=o.parts[0];if(this.options.knownHelpers[a])this.opcode("invokeKnownHelper",r.length,a);else{if(this.options.knownHelpersOnly)throw new i.default("You specified knownHelpersOnly, but used the unknown helper "+a,t);o.strict=!0,o.falsy=!0,this.accept(o),this.opcode("invokeHelper",r.length,o.original,s.default.helpers.simpleId(o))}},PathExpression:function(t){this.addDepth(t.depth),this.opcode("getContext",t.depth);var e=t.parts[0],n=s.default.helpers.scopedId(t),r=!t.depth&&!n&&this.blockParamIndex(e);r?this.opcode("lookupBlockParam",r,t.parts):e?t.data?(this.options.data=!0,this.opcode("lookupData",t.depth,t.parts,t.strict)):this.opcode("lookupOnContext",t.parts,t.falsy,t.strict,n):this.opcode("pushContext")},StringLiteral:function(t){this.opcode("pushString",t.value)},NumberLiteral:function(t){this.opcode("pushLiteral",t.value)},BooleanLiteral:function(t){this.opcode("pushLiteral",t.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(t){var e=t.pairs,n=0,r=e.length;for(this.opcode("pushHash");n<r;n++)this.pushParam(e[n].value);for(;n--;)this.opcode("assignToHash",e[n].key);this.opcode("popHash")},opcode:function(t){this.opcodes.push({opcode:t,args:a.call(arguments,1),loc:this.sourceNode[0].loc})},addDepth:function(t){t&&(this.useDepths=!0)},classifySexpr:function(t){var e=s.default.helpers.simpleId(t.path),n=e&&!!this.blockParamIndex(t.path.parts[0]),r=!n&&s.default.helpers.helperExpression(t),i=!n&&(r||e);if(i&&!r){var o=t.path.parts[0],a=this.options;a.knownHelpers[o]?r=!0:a.knownHelpersOnly&&(i=!1)}return r?"helper":i?"ambiguous":"simple"},pushParams:function(t){for(var e=0,n=t.length;e<n;e++)this.pushParam(t[e])},pushParam:function(t){var e=null!=t.value?t.value:t.original||"";if(this.stringParams)e.replace&&(e=e.replace(/^(\.?\.\/)*/g,"").replace(/\//g,".")),t.depth&&this.addDepth(t.depth),this.opcode("getContext",t.depth||0),this.opcode("pushStringParam",e,t.type),"SubExpression"===t.type&&this.accept(t);else{if(this.trackIds){var n=void 0;if(!t.parts||s.default.helpers.scopedId(t)||t.depth||(n=this.blockParamIndex(t.parts[0])),n){var r=t.parts.slice(1).join(".");this.opcode("pushId","BlockParam",n,r)}else(e=t.original||e).replace&&(e=e.replace(/^this(?:\.|$)/,"").replace(/^\.\//,"").replace(/^\.$/,"")),this.opcode("pushId",t.type,e)}this.accept(t)}},setupFullMustacheParams:function(t,e,n,r){var i=t.params;return this.pushParams(i),this.opcode("pushProgram",e),this.opcode("pushProgram",n),t.hash?this.accept(t.hash):this.opcode("emptyHash",r),i},blockParamIndex:function(t){for(var e=0,n=this.options.blockParams.length;e<n;e++){var r=this.options.blockParams[e],i=r&&o.indexOf(r,t);if(r&&i>=0)return[e,i]}}}},8425(t,e,n){e.__esModule=!0,e.SourceLocation=function(t,e){this.source=t,this.start={line:e.first_line,column:e.first_column},this.end={line:e.last_line,column:e.last_column}},e.id=function(t){return/^\[.*\]$/.test(t)?t.substring(1,t.length-1):t},e.stripFlags=function(t,e){return{open:"~"===t.charAt(2),close:"~"===e.charAt(e.length-3)}},e.stripComment=function(t){return t.replace(/^\{\{~?!-?-?/,"").replace(/-?-?~?\}\}$/,"")},e.preparePath=function(t,e,n){n=this.locInfo(n);for(var r=t?"@":"",i=[],s=0,a=0,u=e.length;a<u;a++){var c=e[a].part,l=e[a].original!==c;if(r+=(e[a].separator||"")+c,l||".."!==c&&"."!==c&&"this"!==c)i.push(c);else{if(i.length>0)throw new o.default("Invalid path: "+r,{loc:n});".."===c&&s++}}return{type:"PathExpression",data:t,depth:s,parts:i,original:r,loc:n}},e.prepareMustache=function(t,e,n,r,i,o){var s=r.charAt(3)||r.charAt(2),a="{"!==s&&"&"!==s;return{type:/\*/.test(r)?"Decorator":"MustacheStatement",path:t,params:e,hash:n,escaped:a,strip:i,loc:this.locInfo(o)}},e.prepareRawBlock=function(t,e,n,r){s(t,n),r=this.locInfo(r);var i={type:"Program",body:e,strip:{},loc:r};return{type:"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:i,openStrip:{},inverseStrip:{},closeStrip:{},loc:r}},e.prepareBlock=function(t,e,n,r,i,a){r&&r.path&&s(t,r);var u=/\*/.test(t.open);e.blockParams=t.blockParams;var c=void 0,l=void 0;if(n){if(u)throw new o.default("Unexpected inverse block on decorator",n);n.chain&&(n.program.body[0].closeStrip=r.strip),l=n.strip,c=n.program}i&&(i=c,c=e,e=i);return{type:u?"DecoratorBlock":"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:e,inverse:c,openStrip:t.strip,inverseStrip:l,closeStrip:r&&r.strip,loc:this.locInfo(a)}},e.prepareProgram=function(t,e){if(!e&&t.length){var n=t[0].loc,r=t[t.length-1].loc;n&&r&&(e={source:n.source,start:{line:n.start.line,column:n.start.column},end:{line:r.end.line,column:r.end.column}})}return{type:"Program",body:t,strip:{},loc:e}},e.preparePartialBlock=function(t,e,n,r){return s(t,n),{type:"PartialBlockStatement",name:t.path,params:t.params,hash:t.hash,program:e,openStrip:t.strip,closeStrip:n&&n.strip,loc:this.locInfo(r)}};var r,i=n(3769),o=(r=i)&&r.__esModule?r:{default:r};function s(t,e){if(e=e.path?e.path.original:e,t.path.original!==e){var n={loc:t.path.loc};throw new o.default(t.path.original+" doesn't match "+e,n)}}},6727(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var i=n(2871),o=r(n(3769)),s=n(2849),a=r(n(9632));function u(t){this.value=t}function c(){}c.prototype={nameLookup:function(t,e){return this.internalNameLookup(t,e)},depthedLookup:function(t){return[this.aliasable("container.lookup"),"(depths, ",JSON.stringify(t),")"]},compilerInfo:function(){var t=i.COMPILER_REVISION;return[t,i.REVISION_CHANGES[t]]},appendToBuffer:function(t,e,n){return s.isArray(t)||(t=[t]),t=this.source.wrap(t,e),this.environment.isSimple?["return ",t,";"]:n?["buffer += ",t,";"]:(t.appendToBuffer=!0,t)},initializeBuffer:function(){return this.quotedString("")},internalNameLookup:function(t,e){return this.lookupPropertyFunctionIsUsed=!0,["lookupProperty(",t,",",JSON.stringify(e),")"]},lookupPropertyFunctionIsUsed:!1,compile:function(t,e,n,r){this.environment=t,this.options=e,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!r,this.name=this.environment.name,this.isChild=!!n,this.context=n||{decorators:[],programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.blockParams=[],this.compileChildren(t,e),this.useDepths=this.useDepths||t.useDepths||t.useDecorators||this.options.compat,this.useBlockParams=this.useBlockParams||t.useBlockParams;var i=t.opcodes,s=void 0,a=void 0,u=void 0,c=void 0;for(u=0,c=i.length;u<c;u++)s=i[u],this.source.currentLocation=s.loc,a=a||s.loc,this[s.opcode].apply(this,s.args);if(this.source.currentLocation=a,this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new o.default("Compile completed with content left on stack");this.decorators.isEmpty()?this.decorators=void 0:(this.useDecorators=!0,this.decorators.prepend(["var decorators = container.decorators, ",this.lookupPropertyFunctionVarDeclaration(),";\n"]),this.decorators.push("return fn;"),r?this.decorators=Function.apply(this,["fn","props","container","depth0","data","blockParams","depths",this.decorators.merge()]):(this.decorators.prepend("function(fn, props, container, depth0, data, blockParams, depths) {\n"),this.decorators.push("}\n"),this.decorators=this.decorators.merge()));var l=this.createFunctionContext(r);if(this.isChild)return l;var h={compiler:this.compilerInfo(),main:l};this.decorators&&(h.main_d=this.decorators,h.useDecorators=!0);var d=this.context,p=d.programs,f=d.decorators;for(u=0,c=p.length;u<c;u++)p[u]&&(h[u]=p[u],f[u]&&(h[u+"_d"]=f[u],h.useDecorators=!0));return this.environment.usePartial&&(h.usePartial=!0),this.options.data&&(h.useData=!0),this.useDepths&&(h.useDepths=!0),this.useBlockParams&&(h.useBlockParams=!0),this.options.compat&&(h.compat=!0),r?h.compilerOptions=this.options:(h.compiler=JSON.stringify(h.compiler),this.source.currentLocation={start:{line:1,column:0}},h=this.objectLiteral(h),e.srcName?(h=h.toStringWithSourceMap({file:e.destName})).map=h.map&&h.map.toString():h=h.toString()),h},preamble:function(){this.lastContext=0,this.source=new a.default(this.options.srcName),this.decorators=new a.default(this.options.srcName)},createFunctionContext:function(t){var e=this,n="",r=this.stackVars.concat(this.registers.list);r.length>0&&(n+=", "+r.join(", "));var i=0;Object.keys(this.aliases).forEach(function(t){var r=e.aliases[t];r.children&&r.referenceCount>1&&(n+=", alias"+ ++i+"="+t,r.children[0]="alias"+i)}),this.lookupPropertyFunctionIsUsed&&(n+=", "+this.lookupPropertyFunctionVarDeclaration());var o=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&o.push("blockParams"),this.useDepths&&o.push("depths");var s=this.mergeSource(n);return t?(o.push(s),Function.apply(this,o)):this.source.wrap(["function(",o.join(","),") {\n ",s,"}"])},mergeSource:function(t){var e=this.environment.isSimple,n=!this.forceBuffer,r=void 0,i=void 0,o=void 0,s=void 0;return this.source.each(function(t){t.appendToBuffer?(o?t.prepend(" + "):o=t,s=t):(o&&(i?o.prepend("buffer += "):r=!0,s.add(";"),o=s=void 0),i=!0,e||(n=!1))}),n?o?(o.prepend("return "),s.add(";")):i||this.source.push('return "";'):(t+=", buffer = "+(r?"":this.initializeBuffer()),o?(o.prepend("return buffer + "),s.add(";")):this.source.push("return buffer;")),t&&this.source.prepend("var "+t.substring(2)+(r?"":";\n")),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return"\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n ".trim()},blockValue:function(t){var e=this.aliasable("container.hooks.blockHelperMissing"),n=[this.contextName(0)];this.setupHelperArgs(t,0,n);var r=this.popStack();n.splice(1,0,r),this.push(this.source.functionCall(e,"call",n))},ambiguousBlockValue:function(){var t=this.aliasable("container.hooks.blockHelperMissing"),e=[this.contextName(0)];this.setupHelperArgs("",0,e,!0),this.flushInline();var n=this.topStack();e.splice(1,0,n),this.pushSource(["if (!",this.lastHelper,") { ",n," = ",this.source.functionCall(t,"call",e),"}"])},appendContent:function(t){this.pendingContent?t=this.pendingContent+t:this.pendingLocation=this.source.currentLocation,this.pendingContent=t},append:function(){if(this.isInline())this.replaceStack(function(t){return[" != null ? ",t,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var t=this.popStack();this.pushSource(["if (",t," != null) { ",this.appendToBuffer(t,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(t){this.lastContext=t},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(t,e,n,r){var i=0;r||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(t[i++])),this.resolvePath("context",t,i,e,n)},lookupBlockParam:function(t,e){this.useBlockParams=!0,this.push(["blockParams[",t[0],"][",t[1],"]"]),this.resolvePath("context",e,1)},lookupData:function(t,e,n){t?this.pushStackLiteral("container.data(data, "+t+")"):this.pushStackLiteral("data"),this.resolvePath("data",e,0,!0,n)},resolvePath:function(t,e,n,r,i){var o=this;if(this.options.strict||this.options.assumeObjects)this.push(function(t,e,n,r,i){var o=e.popStack(),s=n.length;t&&s--;for(;r<s;r++)o=e.nameLookup(o,n[r],i);return t?[e.aliasable("container.strict"),"(",o,", ",e.quotedString(n[r]),", ",JSON.stringify(e.source.currentLocation)," )"]:o}(this.options.strict&&i,this,e,n,t));else for(var s=e.length;n<s;n++)this.replaceStack(function(i){var s=o.nameLookup(i,e[n],t);return r?[" && ",s]:[" != null ? ",s," : ",i]})},resolvePossibleLambda:function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},pushStringParam:function(t,e){this.pushContext(),this.pushString(e),"SubExpression"!==e&&("string"==typeof t?this.pushString(t):this.pushStackLiteral(t))},emptyHash:function(t){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(t?"undefined":"{}")},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:{},types:[],contexts:[],ids:[]}},popHash:function(){var t=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(t.ids)),this.stringParams&&(this.push(this.objectLiteral(t.contexts)),this.push(this.objectLiteral(t.types))),this.push(this.objectLiteral(t.values))},pushString:function(t){this.pushStackLiteral(this.quotedString(t))},pushLiteral:function(t){this.pushStackLiteral(t)},pushProgram:function(t){null!=t?this.pushStackLiteral(this.programExpression(t)):this.pushStackLiteral(null)},registerDecorator:function(t,e){var n=this.nameLookup("decorators",e,"decorator"),r=this.setupHelperArgs(e,t);this.decorators.push(["fn = ",this.decorators.functionCall(n,"",["fn","props","container",r])," || fn;"])},invokeHelper:function(t,e,n){var r=this.popStack(),i=this.setupHelper(t,e),o=[];n&&o.push(i.name),o.push(r),this.options.strict||o.push(this.aliasable("container.hooks.helperMissing"));var s=["(",this.itemsSeparatedBy(o,"||"),")"],a=this.source.functionCall(s,"call",i.callParams);this.push(a)},itemsSeparatedBy:function(t,e){var n=[];n.push(t[0]);for(var r=1;r<t.length;r++)n.push(e,t[r]);return n},invokeKnownHelper:function(t,e){var n=this.setupHelper(t,e);this.push(this.source.functionCall(n.name,"call",n.callParams))},invokeAmbiguous:function(t,e){this.useRegister("helper");var n=this.popStack();this.emptyHash();var r=this.setupHelper(0,t,e),i=["(","(helper = ",this.lastHelper=this.nameLookup("helpers",t,"helper")," || ",n,")"];this.options.strict||(i[0]="(helper = ",i.push(" != null ? helper : ",this.aliasable("container.hooks.helperMissing"))),this.push(["(",i,r.paramsInit?["),(",r.paramsInit]:[],"),","(typeof helper === ",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",r.callParams)," : helper))"])},invokePartial:function(t,e,n){var r=[],i=this.setupParams(e,1,r);t&&(e=this.popStack(),delete i.name),n&&(i.indent=JSON.stringify(n)),i.helpers="helpers",i.partials="partials",i.decorators="container.decorators",t?r.unshift(e):r.unshift(this.nameLookup("partials",e,"partial")),this.options.compat&&(i.depths="depths"),i=this.objectLiteral(i),r.push(i),this.push(this.source.functionCall("container.invokePartial","",r))},assignToHash:function(t){var e=this.popStack(),n=void 0,r=void 0,i=void 0;this.trackIds&&(i=this.popStack()),this.stringParams&&(r=this.popStack(),n=this.popStack());var o=this.hash;n&&(o.contexts[t]=n),r&&(o.types[t]=r),i&&(o.ids[t]=i),o.values[t]=e},pushId:function(t,e,n){"BlockParam"===t?this.pushStackLiteral("blockParams["+e[0]+"].path["+e[1]+"]"+(n?" + "+JSON.stringify("."+n):"")):"PathExpression"===t?this.pushString(e):"SubExpression"===t?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:c,compileChildren:function(t,e){for(var n=t.children,r=void 0,i=void 0,o=0,s=n.length;o<s;o++){r=n[o],i=new this.compiler;var a=this.matchExistingProgram(r);if(null==a){this.context.programs.push("");var u=this.context.programs.length;r.index=u,r.name="program"+u,this.context.programs[u]=i.compile(r,e,this.context,!this.precompile),this.context.decorators[u]=i.decorators,this.context.environments[u]=r,this.useDepths=this.useDepths||i.useDepths,this.useBlockParams=this.useBlockParams||i.useBlockParams,r.useDepths=this.useDepths,r.useBlockParams=this.useBlockParams}else r.index=a.index,r.name="program"+a.index,this.useDepths=this.useDepths||a.useDepths,this.useBlockParams=this.useBlockParams||a.useBlockParams}},matchExistingProgram:function(t){for(var e=0,n=this.context.environments.length;e<n;e++){var r=this.context.environments[e];if(r&&r.equals(t))return r}},programExpression:function(t){var e=this.environment.children[t],n=[e.index,"data",e.blockParams];return(this.useBlockParams||this.useDepths)&&n.push("blockParams"),this.useDepths&&n.push("depths"),"container.program("+n.join(", ")+")"},useRegister:function(t){this.registers[t]||(this.registers[t]=!0,this.registers.list.push(t))},push:function(t){return t instanceof u||(t=this.source.wrap(t)),this.inlineStack.push(t),t},pushStackLiteral:function(t){this.push(new u(t))},pushSource:function(t){this.pendingContent&&(this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0),t&&this.source.push(t)},replaceStack:function(t){var e=["("],n=void 0,r=void 0,i=void 0;if(!this.isInline())throw new o.default("replaceStack on non-inline");var s=this.popStack(!0);if(s instanceof u)e=["(",n=[s.value]],i=!0;else{r=!0;var a=this.incrStack();e=["((",this.push(a)," = ",s,")"],n=this.topStack()}var c=t.call(this,n);i||this.popStack(),r&&this.stackSlot--,this.push(e.concat(c,")"))},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var t=this.inlineStack;this.inlineStack=[];for(var e=0,n=t.length;e<n;e++){var r=t[e];if(r instanceof u)this.compileStack.push(r);else{var i=this.incrStack();this.pushSource([i," = ",r,";"]),this.compileStack.push(i)}}},isInline:function(){return this.inlineStack.length},popStack:function(t){var e=this.isInline(),n=(e?this.inlineStack:this.compileStack).pop();if(!t&&n instanceof u)return n.value;if(!e){if(!this.stackSlot)throw new o.default("Invalid stack pop");this.stackSlot--}return n},topStack:function(){var t=this.isInline()?this.inlineStack:this.compileStack,e=t[t.length-1];return e instanceof u?e.value:e},contextName:function(t){return this.useDepths&&t?"depths["+t+"]":"depth"+t},quotedString:function(t){return this.source.quotedString(t)},objectLiteral:function(t){return this.source.objectLiteral(t)},aliasable:function(t){var e=this.aliases[t];return e?(e.referenceCount++,e):((e=this.aliases[t]=this.source.wrap(t)).aliasable=!0,e.referenceCount=1,e)},setupHelper:function(t,e,n){var r=[];return{params:r,paramsInit:this.setupHelperArgs(e,t,r,n),name:this.nameLookup("helpers",e,"helper"),callParams:[this.aliasable(this.contextName(0)+" != null ? "+this.contextName(0)+" : (container.nullContext || {})")].concat(r)}},setupParams:function(t,e,n){var r={},i=[],o=[],s=[],a=!n,u=void 0;a&&(n=[]),r.name=this.quotedString(t),r.hash=this.popStack(),this.trackIds&&(r.hashIds=this.popStack()),this.stringParams&&(r.hashTypes=this.popStack(),r.hashContexts=this.popStack());var c=this.popStack(),l=this.popStack();(l||c)&&(r.fn=l||"container.noop",r.inverse=c||"container.noop");for(var h=e;h--;)u=this.popStack(),n[h]=u,this.trackIds&&(s[h]=this.popStack()),this.stringParams&&(o[h]=this.popStack(),i[h]=this.popStack());return a&&(r.args=this.source.generateArray(n)),this.trackIds&&(r.ids=this.source.generateArray(s)),this.stringParams&&(r.types=this.source.generateArray(o),r.contexts=this.source.generateArray(i)),this.options.data&&(r.data="data"),this.useBlockParams&&(r.blockParams="blockParams"),r},setupHelperArgs:function(t,e,n,r){var i=this.setupParams(t,e,n);return i.loc=JSON.stringify(this.source.currentLocation),i=this.objectLiteral(i),r?(this.useRegister("options"),n.push("options"),["options=",i]):n?(n.push(i),""):i}},function(){for(var t="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield await null true false".split(" "),e=c.RESERVED_WORDS={},n=0,r=t.length;n<r;n++)e[t[n]]=!0}(),c.isValidJavaScriptVariableName=function(t){return!c.RESERVED_WORDS[t]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(t)},e.default=c,t.exports=e.default},6201(t,e){e.__esModule=!0;var n=function(){var t={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,partialBlock:12,content:13,COMMENT:14,CONTENT:15,openRawBlock:16,rawBlock_repetition0:17,END_RAW_BLOCK:18,OPEN_RAW_BLOCK:19,helperName:20,openRawBlock_repetition0:21,openRawBlock_option0:22,CLOSE_RAW_BLOCK:23,openBlock:24,block_option0:25,closeBlock:26,openInverse:27,block_option1:28,OPEN_BLOCK:29,openBlock_repetition0:30,openBlock_option0:31,openBlock_option1:32,CLOSE:33,OPEN_INVERSE:34,openInverse_repetition0:35,openInverse_option0:36,openInverse_option1:37,openInverseChain:38,OPEN_INVERSE_CHAIN:39,openInverseChain_repetition0:40,openInverseChain_option0:41,openInverseChain_option1:42,inverseAndProgram:43,INVERSE:44,inverseChain:45,inverseChain_option0:46,OPEN_ENDBLOCK:47,OPEN:48,mustache_repetition0:49,mustache_option0:50,OPEN_UNESCAPED:51,mustache_repetition1:52,mustache_option1:53,CLOSE_UNESCAPED:54,OPEN_PARTIAL:55,partialName:56,partial_repetition0:57,partial_option0:58,openPartialBlock:59,OPEN_PARTIAL_BLOCK:60,openPartialBlock_repetition0:61,openPartialBlock_option0:62,param:63,sexpr:64,OPEN_SEXPR:65,sexpr_repetition0:66,sexpr_option0:67,CLOSE_SEXPR:68,hash:69,hash_repetition_plus0:70,hashSegment:71,ID:72,EQUALS:73,blockParams:74,OPEN_BLOCK_PARAMS:75,blockParams_repetition_plus0:76,CLOSE_BLOCK_PARAMS:77,path:78,dataName:79,STRING:80,NUMBER:81,BOOLEAN:82,UNDEFINED:83,NULL:84,DATA:85,pathSegments:86,SEP:87,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"COMMENT",15:"CONTENT",18:"END_RAW_BLOCK",19:"OPEN_RAW_BLOCK",23:"CLOSE_RAW_BLOCK",29:"OPEN_BLOCK",33:"CLOSE",34:"OPEN_INVERSE",39:"OPEN_INVERSE_CHAIN",44:"INVERSE",47:"OPEN_ENDBLOCK",48:"OPEN",51:"OPEN_UNESCAPED",54:"CLOSE_UNESCAPED",55:"OPEN_PARTIAL",60:"OPEN_PARTIAL_BLOCK",65:"OPEN_SEXPR",68:"CLOSE_SEXPR",72:"ID",73:"EQUALS",75:"OPEN_BLOCK_PARAMS",77:"CLOSE_BLOCK_PARAMS",80:"STRING",81:"NUMBER",82:"BOOLEAN",83:"UNDEFINED",84:"NULL",85:"DATA",87:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[13,1],[10,3],[16,5],[9,4],[9,4],[24,6],[27,6],[38,6],[43,2],[45,3],[45,1],[26,3],[8,5],[8,5],[11,5],[12,3],[59,5],[63,1],[63,1],[64,5],[69,1],[71,3],[74,3],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[56,1],[56,1],[79,2],[78,1],[86,3],[86,1],[6,0],[6,2],[17,0],[17,2],[21,0],[21,2],[22,0],[22,1],[25,0],[25,1],[28,0],[28,1],[30,0],[30,2],[31,0],[31,1],[32,0],[32,1],[35,0],[35,2],[36,0],[36,1],[37,0],[37,1],[40,0],[40,2],[41,0],[41,1],[42,0],[42,1],[46,0],[46,1],[49,0],[49,2],[50,0],[50,1],[52,0],[52,2],[53,0],[53,1],[57,0],[57,2],[58,0],[58,1],[61,0],[61,2],[62,0],[62,1],[66,0],[66,2],[67,0],[67,1],[70,1],[70,2],[76,1],[76,2]],performAction:function(t,e,n,r,i,o,s){var a=o.length-1;switch(i){case 1:return o[a-1];case 2:this.$=r.prepareProgram(o[a]);break;case 3:case 4:case 5:case 6:case 7:case 8:case 20:case 27:case 28:case 33:case 34:case 40:case 41:this.$=o[a];break;case 9:this.$={type:"CommentStatement",value:r.stripComment(o[a]),strip:r.stripFlags(o[a],o[a]),loc:r.locInfo(this._$)};break;case 10:this.$={type:"ContentStatement",original:o[a],value:o[a],loc:r.locInfo(this._$)};break;case 11:this.$=r.prepareRawBlock(o[a-2],o[a-1],o[a],this._$);break;case 12:this.$={path:o[a-3],params:o[a-2],hash:o[a-1]};break;case 13:this.$=r.prepareBlock(o[a-3],o[a-2],o[a-1],o[a],!1,this._$);break;case 14:this.$=r.prepareBlock(o[a-3],o[a-2],o[a-1],o[a],!0,this._$);break;case 15:this.$={open:o[a-5],path:o[a-4],params:o[a-3],hash:o[a-2],blockParams:o[a-1],strip:r.stripFlags(o[a-5],o[a])};break;case 16:case 17:this.$={path:o[a-4],params:o[a-3],hash:o[a-2],blockParams:o[a-1],strip:r.stripFlags(o[a-5],o[a])};break;case 18:this.$={strip:r.stripFlags(o[a-1],o[a-1]),program:o[a]};break;case 19:var u=r.prepareBlock(o[a-2],o[a-1],o[a],o[a],!1,this._$),c=r.prepareProgram([u],o[a-1].loc);c.chained=!0,this.$={strip:o[a-2].strip,program:c,chain:!0};break;case 21:this.$={path:o[a-1],strip:r.stripFlags(o[a-2],o[a])};break;case 22:case 23:this.$=r.prepareMustache(o[a-3],o[a-2],o[a-1],o[a-4],r.stripFlags(o[a-4],o[a]),this._$);break;case 24:this.$={type:"PartialStatement",name:o[a-3],params:o[a-2],hash:o[a-1],indent:"",strip:r.stripFlags(o[a-4],o[a]),loc:r.locInfo(this._$)};break;case 25:this.$=r.preparePartialBlock(o[a-2],o[a-1],o[a],this._$);break;case 26:this.$={path:o[a-3],params:o[a-2],hash:o[a-1],strip:r.stripFlags(o[a-4],o[a])};break;case 29:this.$={type:"SubExpression",path:o[a-3],params:o[a-2],hash:o[a-1],loc:r.locInfo(this._$)};break;case 30:this.$={type:"Hash",pairs:o[a],loc:r.locInfo(this._$)};break;case 31:this.$={type:"HashPair",key:r.id(o[a-2]),value:o[a],loc:r.locInfo(this._$)};break;case 32:this.$=r.id(o[a-1]);break;case 35:this.$={type:"StringLiteral",value:o[a],original:o[a],loc:r.locInfo(this._$)};break;case 36:this.$={type:"NumberLiteral",value:Number(o[a]),original:Number(o[a]),loc:r.locInfo(this._$)};break;case 37:this.$={type:"BooleanLiteral",value:"true"===o[a],original:"true"===o[a],loc:r.locInfo(this._$)};break;case 38:this.$={type:"UndefinedLiteral",original:void 0,value:void 0,loc:r.locInfo(this._$)};break;case 39:this.$={type:"NullLiteral",original:null,value:null,loc:r.locInfo(this._$)};break;case 42:this.$=r.preparePath(!0,o[a],this._$);break;case 43:this.$=r.preparePath(!1,o[a],this._$);break;case 44:o[a-2].push({part:r.id(o[a]),original:o[a],separator:o[a-1]}),this.$=o[a-2];break;case 45:this.$=[{part:r.id(o[a]),original:o[a]}];break;case 46:case 48:case 50:case 58:case 64:case 70:case 78:case 82:case 86:case 90:case 94:this.$=[];break;case 47:case 49:case 51:case 59:case 65:case 71:case 79:case 83:case 87:case 91:case 95:case 99:case 101:o[a-1].push(o[a]);break;case 98:case 100:this.$=[o[a]]}},table:[{3:1,4:2,5:[2,46],6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:11,14:[1,12],15:[1,20],16:17,19:[1,23],24:15,27:16,29:[1,21],34:[1,22],39:[2,2],44:[2,2],47:[2,2],48:[1,13],51:[1,14],55:[1,18],59:19,60:[1,24]},{1:[2,1]},{5:[2,47],14:[2,47],15:[2,47],19:[2,47],29:[2,47],34:[2,47],39:[2,47],44:[2,47],47:[2,47],48:[2,47],51:[2,47],55:[2,47],60:[2,47]},{5:[2,3],14:[2,3],15:[2,3],19:[2,3],29:[2,3],34:[2,3],39:[2,3],44:[2,3],47:[2,3],48:[2,3],51:[2,3],55:[2,3],60:[2,3]},{5:[2,4],14:[2,4],15:[2,4],19:[2,4],29:[2,4],34:[2,4],39:[2,4],44:[2,4],47:[2,4],48:[2,4],51:[2,4],55:[2,4],60:[2,4]},{5:[2,5],14:[2,5],15:[2,5],19:[2,5],29:[2,5],34:[2,5],39:[2,5],44:[2,5],47:[2,5],48:[2,5],51:[2,5],55:[2,5],60:[2,5]},{5:[2,6],14:[2,6],15:[2,6],19:[2,6],29:[2,6],34:[2,6],39:[2,6],44:[2,6],47:[2,6],48:[2,6],51:[2,6],55:[2,6],60:[2,6]},{5:[2,7],14:[2,7],15:[2,7],19:[2,7],29:[2,7],34:[2,7],39:[2,7],44:[2,7],47:[2,7],48:[2,7],51:[2,7],55:[2,7],60:[2,7]},{5:[2,8],14:[2,8],15:[2,8],19:[2,8],29:[2,8],34:[2,8],39:[2,8],44:[2,8],47:[2,8],48:[2,8],51:[2,8],55:[2,8],60:[2,8]},{5:[2,9],14:[2,9],15:[2,9],19:[2,9],29:[2,9],34:[2,9],39:[2,9],44:[2,9],47:[2,9],48:[2,9],51:[2,9],55:[2,9],60:[2,9]},{20:25,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:36,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:37,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{4:38,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{15:[2,48],17:39,18:[2,48]},{20:41,56:40,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:44,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{5:[2,10],14:[2,10],15:[2,10],18:[2,10],19:[2,10],29:[2,10],34:[2,10],39:[2,10],44:[2,10],47:[2,10],48:[2,10],51:[2,10],55:[2,10],60:[2,10]},{20:45,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:46,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:47,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:41,56:48,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[2,78],49:49,65:[2,78],72:[2,78],80:[2,78],81:[2,78],82:[2,78],83:[2,78],84:[2,78],85:[2,78]},{23:[2,33],33:[2,33],54:[2,33],65:[2,33],68:[2,33],72:[2,33],75:[2,33],80:[2,33],81:[2,33],82:[2,33],83:[2,33],84:[2,33],85:[2,33]},{23:[2,34],33:[2,34],54:[2,34],65:[2,34],68:[2,34],72:[2,34],75:[2,34],80:[2,34],81:[2,34],82:[2,34],83:[2,34],84:[2,34],85:[2,34]},{23:[2,35],33:[2,35],54:[2,35],65:[2,35],68:[2,35],72:[2,35],75:[2,35],80:[2,35],81:[2,35],82:[2,35],83:[2,35],84:[2,35],85:[2,35]},{23:[2,36],33:[2,36],54:[2,36],65:[2,36],68:[2,36],72:[2,36],75:[2,36],80:[2,36],81:[2,36],82:[2,36],83:[2,36],84:[2,36],85:[2,36]},{23:[2,37],33:[2,37],54:[2,37],65:[2,37],68:[2,37],72:[2,37],75:[2,37],80:[2,37],81:[2,37],82:[2,37],83:[2,37],84:[2,37],85:[2,37]},{23:[2,38],33:[2,38],54:[2,38],65:[2,38],68:[2,38],72:[2,38],75:[2,38],80:[2,38],81:[2,38],82:[2,38],83:[2,38],84:[2,38],85:[2,38]},{23:[2,39],33:[2,39],54:[2,39],65:[2,39],68:[2,39],72:[2,39],75:[2,39],80:[2,39],81:[2,39],82:[2,39],83:[2,39],84:[2,39],85:[2,39]},{23:[2,43],33:[2,43],54:[2,43],65:[2,43],68:[2,43],72:[2,43],75:[2,43],80:[2,43],81:[2,43],82:[2,43],83:[2,43],84:[2,43],85:[2,43],87:[1,50]},{72:[1,35],86:51},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{52:52,54:[2,82],65:[2,82],72:[2,82],80:[2,82],81:[2,82],82:[2,82],83:[2,82],84:[2,82],85:[2,82]},{25:53,38:55,39:[1,57],43:56,44:[1,58],45:54,47:[2,54]},{28:59,43:60,44:[1,58],47:[2,56]},{13:62,15:[1,20],18:[1,61]},{33:[2,86],57:63,65:[2,86],72:[2,86],80:[2,86],81:[2,86],82:[2,86],83:[2,86],84:[2,86],85:[2,86]},{33:[2,40],65:[2,40],72:[2,40],80:[2,40],81:[2,40],82:[2,40],83:[2,40],84:[2,40],85:[2,40]},{33:[2,41],65:[2,41],72:[2,41],80:[2,41],81:[2,41],82:[2,41],83:[2,41],84:[2,41],85:[2,41]},{20:64,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:65,47:[1,66]},{30:67,33:[2,58],65:[2,58],72:[2,58],75:[2,58],80:[2,58],81:[2,58],82:[2,58],83:[2,58],84:[2,58],85:[2,58]},{33:[2,64],35:68,65:[2,64],72:[2,64],75:[2,64],80:[2,64],81:[2,64],82:[2,64],83:[2,64],84:[2,64],85:[2,64]},{21:69,23:[2,50],65:[2,50],72:[2,50],80:[2,50],81:[2,50],82:[2,50],83:[2,50],84:[2,50],85:[2,50]},{33:[2,90],61:70,65:[2,90],72:[2,90],80:[2,90],81:[2,90],82:[2,90],83:[2,90],84:[2,90],85:[2,90]},{20:74,33:[2,80],50:71,63:72,64:75,65:[1,43],69:73,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{72:[1,79]},{23:[2,42],33:[2,42],54:[2,42],65:[2,42],68:[2,42],72:[2,42],75:[2,42],80:[2,42],81:[2,42],82:[2,42],83:[2,42],84:[2,42],85:[2,42],87:[1,50]},{20:74,53:80,54:[2,84],63:81,64:75,65:[1,43],69:82,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:83,47:[1,66]},{47:[2,55]},{4:84,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{47:[2,20]},{20:85,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:86,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{26:87,47:[1,66]},{47:[2,57]},{5:[2,11],14:[2,11],15:[2,11],19:[2,11],29:[2,11],34:[2,11],39:[2,11],44:[2,11],47:[2,11],48:[2,11],51:[2,11],55:[2,11],60:[2,11]},{15:[2,49],18:[2,49]},{20:74,33:[2,88],58:88,63:89,64:75,65:[1,43],69:90,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{65:[2,94],66:91,68:[2,94],72:[2,94],80:[2,94],81:[2,94],82:[2,94],83:[2,94],84:[2,94],85:[2,94]},{5:[2,25],14:[2,25],15:[2,25],19:[2,25],29:[2,25],34:[2,25],39:[2,25],44:[2,25],47:[2,25],48:[2,25],51:[2,25],55:[2,25],60:[2,25]},{20:92,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,31:93,33:[2,60],63:94,64:75,65:[1,43],69:95,70:76,71:77,72:[1,78],75:[2,60],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,66],36:96,63:97,64:75,65:[1,43],69:98,70:76,71:77,72:[1,78],75:[2,66],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,22:99,23:[2,52],63:100,64:75,65:[1,43],69:101,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,92],62:102,63:103,64:75,65:[1,43],69:104,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,105]},{33:[2,79],65:[2,79],72:[2,79],80:[2,79],81:[2,79],82:[2,79],83:[2,79],84:[2,79],85:[2,79]},{33:[2,81]},{23:[2,27],33:[2,27],54:[2,27],65:[2,27],68:[2,27],72:[2,27],75:[2,27],80:[2,27],81:[2,27],82:[2,27],83:[2,27],84:[2,27],85:[2,27]},{23:[2,28],33:[2,28],54:[2,28],65:[2,28],68:[2,28],72:[2,28],75:[2,28],80:[2,28],81:[2,28],82:[2,28],83:[2,28],84:[2,28],85:[2,28]},{23:[2,30],33:[2,30],54:[2,30],68:[2,30],71:106,72:[1,107],75:[2,30]},{23:[2,98],33:[2,98],54:[2,98],68:[2,98],72:[2,98],75:[2,98]},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],73:[1,108],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{23:[2,44],33:[2,44],54:[2,44],65:[2,44],68:[2,44],72:[2,44],75:[2,44],80:[2,44],81:[2,44],82:[2,44],83:[2,44],84:[2,44],85:[2,44],87:[2,44]},{54:[1,109]},{54:[2,83],65:[2,83],72:[2,83],80:[2,83],81:[2,83],82:[2,83],83:[2,83],84:[2,83],85:[2,83]},{54:[2,85]},{5:[2,13],14:[2,13],15:[2,13],19:[2,13],29:[2,13],34:[2,13],39:[2,13],44:[2,13],47:[2,13],48:[2,13],51:[2,13],55:[2,13],60:[2,13]},{38:55,39:[1,57],43:56,44:[1,58],45:111,46:110,47:[2,76]},{33:[2,70],40:112,65:[2,70],72:[2,70],75:[2,70],80:[2,70],81:[2,70],82:[2,70],83:[2,70],84:[2,70],85:[2,70]},{47:[2,18]},{5:[2,14],14:[2,14],15:[2,14],19:[2,14],29:[2,14],34:[2,14],39:[2,14],44:[2,14],47:[2,14],48:[2,14],51:[2,14],55:[2,14],60:[2,14]},{33:[1,113]},{33:[2,87],65:[2,87],72:[2,87],80:[2,87],81:[2,87],82:[2,87],83:[2,87],84:[2,87],85:[2,87]},{33:[2,89]},{20:74,63:115,64:75,65:[1,43],67:114,68:[2,96],69:116,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,117]},{32:118,33:[2,62],74:119,75:[1,120]},{33:[2,59],65:[2,59],72:[2,59],75:[2,59],80:[2,59],81:[2,59],82:[2,59],83:[2,59],84:[2,59],85:[2,59]},{33:[2,61],75:[2,61]},{33:[2,68],37:121,74:122,75:[1,120]},{33:[2,65],65:[2,65],72:[2,65],75:[2,65],80:[2,65],81:[2,65],82:[2,65],83:[2,65],84:[2,65],85:[2,65]},{33:[2,67],75:[2,67]},{23:[1,123]},{23:[2,51],65:[2,51],72:[2,51],80:[2,51],81:[2,51],82:[2,51],83:[2,51],84:[2,51],85:[2,51]},{23:[2,53]},{33:[1,124]},{33:[2,91],65:[2,91],72:[2,91],80:[2,91],81:[2,91],82:[2,91],83:[2,91],84:[2,91],85:[2,91]},{33:[2,93]},{5:[2,22],14:[2,22],15:[2,22],19:[2,22],29:[2,22],34:[2,22],39:[2,22],44:[2,22],47:[2,22],48:[2,22],51:[2,22],55:[2,22],60:[2,22]},{23:[2,99],33:[2,99],54:[2,99],68:[2,99],72:[2,99],75:[2,99]},{73:[1,108]},{20:74,63:125,64:75,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,23],14:[2,23],15:[2,23],19:[2,23],29:[2,23],34:[2,23],39:[2,23],44:[2,23],47:[2,23],48:[2,23],51:[2,23],55:[2,23],60:[2,23]},{47:[2,19]},{47:[2,77]},{20:74,33:[2,72],41:126,63:127,64:75,65:[1,43],69:128,70:76,71:77,72:[1,78],75:[2,72],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,24],14:[2,24],15:[2,24],19:[2,24],29:[2,24],34:[2,24],39:[2,24],44:[2,24],47:[2,24],48:[2,24],51:[2,24],55:[2,24],60:[2,24]},{68:[1,129]},{65:[2,95],68:[2,95],72:[2,95],80:[2,95],81:[2,95],82:[2,95],83:[2,95],84:[2,95],85:[2,95]},{68:[2,97]},{5:[2,21],14:[2,21],15:[2,21],19:[2,21],29:[2,21],34:[2,21],39:[2,21],44:[2,21],47:[2,21],48:[2,21],51:[2,21],55:[2,21],60:[2,21]},{33:[1,130]},{33:[2,63]},{72:[1,132],76:131},{33:[1,133]},{33:[2,69]},{15:[2,12],18:[2,12]},{14:[2,26],15:[2,26],19:[2,26],29:[2,26],34:[2,26],47:[2,26],48:[2,26],51:[2,26],55:[2,26],60:[2,26]},{23:[2,31],33:[2,31],54:[2,31],68:[2,31],72:[2,31],75:[2,31]},{33:[2,74],42:134,74:135,75:[1,120]},{33:[2,71],65:[2,71],72:[2,71],75:[2,71],80:[2,71],81:[2,71],82:[2,71],83:[2,71],84:[2,71],85:[2,71]},{33:[2,73],75:[2,73]},{23:[2,29],33:[2,29],54:[2,29],65:[2,29],68:[2,29],72:[2,29],75:[2,29],80:[2,29],81:[2,29],82:[2,29],83:[2,29],84:[2,29],85:[2,29]},{14:[2,15],15:[2,15],19:[2,15],29:[2,15],34:[2,15],39:[2,15],44:[2,15],47:[2,15],48:[2,15],51:[2,15],55:[2,15],60:[2,15]},{72:[1,137],77:[1,136]},{72:[2,100],77:[2,100]},{14:[2,16],15:[2,16],19:[2,16],29:[2,16],34:[2,16],44:[2,16],47:[2,16],48:[2,16],51:[2,16],55:[2,16],60:[2,16]},{33:[1,138]},{33:[2,75]},{33:[2,32]},{72:[2,101],77:[2,101]},{14:[2,17],15:[2,17],19:[2,17],29:[2,17],34:[2,17],39:[2,17],44:[2,17],47:[2,17],48:[2,17],51:[2,17],55:[2,17],60:[2,17]}],defaultActions:{4:[2,1],54:[2,55],56:[2,20],60:[2,57],73:[2,81],82:[2,85],86:[2,18],90:[2,89],101:[2,53],104:[2,93],110:[2,19],111:[2,77],116:[2,97],119:[2,63],122:[2,69],135:[2,75],136:[2,32]},parseError:function(t,e){throw new Error(t)},parse:function(t){var e=this,n=[0],r=[null],i=[],o=this.table,s="",a=0,u=0,c=0;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,void 0===this.lexer.yylloc&&(this.lexer.yylloc={});var l=this.lexer.yylloc;i.push(l);var h=this.lexer.options&&this.lexer.options.ranges;function d(){var t;return"number"!=typeof(t=e.lexer.lex()||1)&&(t=e.symbols_[t]||t),t}"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var p,f,m,g,_,y,v,b,w,x={};;){if(m=n[n.length-1],this.defaultActions[m]?g=this.defaultActions[m]:(null==p&&(p=d()),g=o[m]&&o[m][p]),void 0===g||!g.length||!g[0]){var T="";if(!c){for(y in w=[],o[m])this.terminals_[y]&&y>2&&w.push("'"+this.terminals_[y]+"'");T=this.lexer.showPosition?"Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+w.join(", ")+", got '"+(this.terminals_[p]||p)+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==p?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(T,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:l,expected:w})}}if(g[0]instanceof Array&&g.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+p);switch(g[0]){case 1:n.push(p),r.push(this.lexer.yytext),i.push(this.lexer.yylloc),n.push(g[1]),p=null,f?(p=f,f=null):(u=this.lexer.yyleng,s=this.lexer.yytext,a=this.lexer.yylineno,l=this.lexer.yylloc,c>0&&c--);break;case 2:if(v=this.productions_[g[1]][1],x.$=r[r.length-v],x._$={first_line:i[i.length-(v||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(v||1)].first_column,last_column:i[i.length-1].last_column},h&&(x._$.range=[i[i.length-(v||1)].range[0],i[i.length-1].range[1]]),void 0!==(_=this.performAction.call(x,s,u,a,this.yy,g[1],r,i)))return _;v&&(n=n.slice(0,-1*v*2),r=r.slice(0,-1*v),i=i.slice(0,-1*v)),n.push(this.productions_[g[1]][0]),r.push(x.$),i.push(x._$),b=o[n[n.length-2]][n[n.length-1]],n.push(b);break;case 3:return!0}}return!0}},e=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t){return this._input=t,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e-1),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this},more:function(){return this._more=!0,this},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},next:function(){if(this.done)return this.EOF;var t,e,n,r,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var o=this._currentRules(),s=0;s<o.length&&(!(n=this._input.match(this.rules[o[s]]))||e&&!(n[0].length>e[0].length)||(e=n,r=s,this.options.flex));s++);return e?((i=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],t=this.performAction.call(this,this.yy,this,o[r],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t||void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return void 0!==t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)},options:{},performAction:function(t,e,n,r){function i(t,n){return e.yytext=e.yytext.substring(t,e.yyleng-n+t)}switch(n){case 0:if("\\\\"===e.yytext.slice(-2)?(i(0,1),this.begin("mu")):"\\"===e.yytext.slice(-1)?(i(0,1),this.begin("emu")):this.begin("mu"),e.yytext)return 15;break;case 1:case 5:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),"raw"===this.conditionStack[this.conditionStack.length-1]?15:(i(5,9),"END_RAW_BLOCK");case 6:case 22:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:case 23:return 48;case 21:this.unput(e.yytext),this.popState(),this.begin("com");break;case 24:return 73;case 25:case 26:case 41:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return e.yytext=i(1,2).replace(/\\"/g,'"'),80;case 32:return e.yytext=i(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 42:return e.yytext=e.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},rules:[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],conditions:{mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}}};return t}();function n(){this.yy={}}return t.lexer=e,n.prototype=t,t.Parser=n,new n}();e.default=n,t.exports=e.default},1350(t,e,n){e.__esModule=!0;var r,i=n(3769),o=(r=i)&&r.__esModule?r:{default:r};function s(){this.parents=[]}function a(t){this.acceptRequired(t,"path"),this.acceptArray(t.params),this.acceptKey(t,"hash")}function u(t){a.call(this,t),this.acceptKey(t,"program"),this.acceptKey(t,"inverse")}function c(t){this.acceptRequired(t,"name"),this.acceptArray(t.params),this.acceptKey(t,"hash")}s.prototype={constructor:s,mutating:!1,acceptKey:function(t,e){var n=this.accept(t[e]);if(this.mutating){if(n&&!s.prototype[n.type])throw new o.default('Unexpected node type "'+n.type+'" found when accepting '+e+" on "+t.type);t[e]=n}},acceptRequired:function(t,e){if(this.acceptKey(t,e),!t[e])throw new o.default(t.type+" requires "+e)},acceptArray:function(t){for(var e=0,n=t.length;e<n;e++)this.acceptKey(t,e),t[e]||(t.splice(e,1),e--,n--)},accept:function(t){if(t){if(!this[t.type])throw new o.default("Unknown type: "+t.type,t);this.current&&this.parents.unshift(this.current),this.current=t;var e=this[t.type](t);return this.current=this.parents.shift(),!this.mutating||e?e:!1!==e?t:void 0}},Program:function(t){this.acceptArray(t.body)},MustacheStatement:a,Decorator:a,BlockStatement:u,DecoratorBlock:u,PartialStatement:c,PartialBlockStatement:function(t){c.call(this,t),this.acceptKey(t,"program")},ContentStatement:function(){},CommentStatement:function(){},SubExpression:a,PathExpression:function(){},StringLiteral:function(){},NumberLiteral:function(){},BooleanLiteral:function(){},UndefinedLiteral:function(){},NullLiteral:function(){},Hash:function(t){this.acceptArray(t.pairs)},HashPair:function(t){this.acceptRequired(t,"value")}},e.default=s,t.exports=e.default},915(t,e,n){e.__esModule=!0;var r,i=n(1350),o=(r=i)&&r.__esModule?r:{default:r};function s(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.options=t}function a(t,e,n){void 0===e&&(e=t.length);var r=t[e-1],i=t[e-2];return r?"ContentStatement"===r.type?(i||!n?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(r.original):void 0:n}function u(t,e,n){void 0===e&&(e=-1);var r=t[e+1],i=t[e+2];return r?"ContentStatement"===r.type?(i||!n?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(r.original):void 0:n}function c(t,e,n){var r=t[null==e?0:e+1];if(r&&"ContentStatement"===r.type&&(n||!r.rightStripped)){var i=r.value;r.value=r.value.replace(n?/^\s+/:/^[ \t]*\r?\n?/,""),r.rightStripped=r.value!==i}}function l(t,e,n){var r=t[null==e?t.length-1:e-1];if(r&&"ContentStatement"===r.type&&(n||!r.leftStripped)){var i=r.value;return r.value=r.value.replace(n?/\s+$/:/[ \t]+$/,""),r.leftStripped=r.value!==i,r.leftStripped}}s.prototype=new o.default,s.prototype.Program=function(t){var e=!this.options.ignoreStandalone,n=!this.isRootSeen;this.isRootSeen=!0;for(var r=t.body,i=0,o=r.length;i<o;i++){var s=r[i],h=this.accept(s);if(h){var d=a(r,i,n),p=u(r,i,n),f=h.openStandalone&&d,m=h.closeStandalone&&p,g=h.inlineStandalone&&d&&p;h.close&&c(r,i,!0),h.open&&l(r,i,!0),e&&g&&(c(r,i),l(r,i)&&"PartialStatement"===s.type&&(s.indent=/([ \t]+$)/.exec(r[i-1].original)[1])),e&&f&&(c((s.program||s.inverse).body),l(r,i)),e&&m&&(c(r,i),l((s.inverse||s.program).body))}}return t},s.prototype.BlockStatement=s.prototype.DecoratorBlock=s.prototype.PartialBlockStatement=function(t){this.accept(t.program),this.accept(t.inverse);var e=t.program||t.inverse,n=t.program&&t.inverse,r=n,i=n;if(n&&n.chained)for(r=n.body[0].program;i.chained;)i=i.body[i.body.length-1].program;var o={open:t.openStrip.open,close:t.closeStrip.close,openStandalone:u(e.body),closeStandalone:a((r||e).body)};if(t.openStrip.close&&c(e.body,null,!0),n){var s=t.inverseStrip;s.open&&l(e.body,null,!0),s.close&&c(r.body,null,!0),t.closeStrip.open&&l(i.body,null,!0),!this.options.ignoreStandalone&&a(e.body)&&u(r.body)&&(l(e.body),c(r.body))}else t.closeStrip.open&&l(e.body,null,!0);return o},s.prototype.Decorator=s.prototype.MustacheStatement=function(t){return t.strip},s.prototype.PartialStatement=s.prototype.CommentStatement=function(t){var e=t.strip||{};return{inlineStandalone:!0,open:e.open,close:e.close}},e.default=s,t.exports=e.default},5940(t,e,n){e.__esModule=!0,e.registerDefaultDecorators=function(t){o.default(t)};var r,i=n(7430),o=(r=i)&&r.__esModule?r:{default:r}},7430(t,e,n){e.__esModule=!0;var r=n(2849);e.default=function(t){t.registerDecorator("inline",function(t,e,n,i){var o=t;return e.partials||(e.partials={},o=function(i,o){var s=n.partials;n.partials=r.extend({},s,e.partials);var a=t(i,o);return n.partials=s,a}),e.partials[i.args[0]]=i.fn,o})},t.exports=e.default},3769(t,e){e.__esModule=!0;var n=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function r(t,e){var i=e&&e.loc,o=void 0,s=void 0,a=void 0,u=void 0;i&&(o=i.start.line,s=i.end.line,a=i.start.column,u=i.end.column,t+=" - "+o+":"+a);for(var c=Error.prototype.constructor.call(this,t),l=0;l<n.length;l++)this[n[l]]=c[n[l]];Error.captureStackTrace&&Error.captureStackTrace(this,r);try{i&&(this.lineNumber=o,this.endLineNumber=s,Object.defineProperty?(Object.defineProperty(this,"column",{value:a,enumerable:!0}),Object.defineProperty(this,"endColumn",{value:u,enumerable:!0})):(this.column=a,this.endColumn=u))}catch(t){}}r.prototype=new Error,e.default=r,t.exports=e.default},2277(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.registerDefaultHelpers=function(t){i.default(t),o.default(t),s.default(t),a.default(t),u.default(t),c.default(t),l.default(t)},e.moveHelperToHooks=function(t,e,n){t.helpers[e]&&(t.hooks[e]=t.helpers[e],n||delete t.helpers[e])};var i=r(n(6097)),o=r(n(6785)),s=r(n(4353)),a=r(n(2355)),u=r(n(5300)),c=r(n(7466)),l=r(n(908))},6097(t,e,n){e.__esModule=!0;var r=n(2849);e.default=function(t){t.registerHelper("blockHelperMissing",function(e,n){var i=n.inverse,o=n.fn;if(!0===e)return o(this);if(!1===e||null==e)return i(this);if(r.isArray(e))return e.length>0?(n.ids&&(n.ids=[n.name]),t.helpers.each(e,n)):i(this);if(n.data&&n.ids){var s=r.createFrame(n.data);s.contextPath=r.appendContextPath(n.data.contextPath,n.name),n={data:s}}return o(e,n)})},t.exports=e.default},6785(t,e,n){e.__esModule=!0;var r,i=n(2849),o=n(3769),s=(r=o)&&r.__esModule?r:{default:r};e.default=function(t){t.registerHelper("each",function(t,e){if(!e)throw new s.default("Must pass iterator to #each");var n,r=e.fn,o=e.inverse,a=0,u="",c=void 0,l=void 0;function h(e,n,o){c&&(c.key=e,c.index=n,c.first=0===n,c.last=!!o,l&&(c.contextPath=l+e)),u+=r(t[e],{data:c,blockParams:i.blockParams([t[e],e],[l+e,null])})}if(e.data&&e.ids&&(l=i.appendContextPath(e.data.contextPath,e.ids[0])+"."),i.isFunction(t)&&(t=t.call(this)),e.data&&(c=i.createFrame(e.data)),t&&"object"==typeof t)if(i.isArray(t))for(var d=t.length;a<d;a++)a in t&&h(a,a,a===t.length-1);else if("function"==typeof Symbol&&t[Symbol.iterator]){for(var p=[],f=t[Symbol.iterator](),m=f.next();!m.done;m=f.next())p.push(m.value);for(d=(t=p).length;a<d;a++)h(a,a,a===t.length-1)}else n=void 0,Object.keys(t).forEach(function(t){void 0!==n&&h(n,a-1),n=t,a++}),void 0!==n&&h(n,a-1,!0);return 0===a&&(u=o(this)),u})},t.exports=e.default},4353(t,e,n){e.__esModule=!0;var r,i=n(3769),o=(r=i)&&r.__esModule?r:{default:r};e.default=function(t){t.registerHelper("helperMissing",function(){if(1!==arguments.length)throw new o.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})},t.exports=e.default},2355(t,e,n){e.__esModule=!0;var r,i=n(2849),o=n(3769),s=(r=o)&&r.__esModule?r:{default:r};e.default=function(t){t.registerHelper("if",function(t,e){if(2!=arguments.length)throw new s.default("#if requires exactly one argument");return i.isFunction(t)&&(t=t.call(this)),!e.hash.includeZero&&!t||i.isEmpty(t)?e.inverse(this):e.fn(this)}),t.registerHelper("unless",function(e,n){if(2!=arguments.length)throw new s.default("#unless requires exactly one argument");return t.helpers.if.call(this,e,{fn:n.inverse,inverse:n.fn,hash:n.hash})})},t.exports=e.default},5300(t,e){e.__esModule=!0,e.default=function(t){t.registerHelper("log",function(){for(var e=[void 0],n=arguments[arguments.length-1],r=0;r<arguments.length-1;r++)e.push(arguments[r]);var i=1;null!=n.hash.level?i=n.hash.level:n.data&&null!=n.data.level&&(i=n.data.level),e[0]=i,t.log.apply(t,e)})},t.exports=e.default},7466(t,e){e.__esModule=!0,e.default=function(t){t.registerHelper("lookup",function(t,e,n){return t?n.lookupProperty(t,e):t})},t.exports=e.default},908(t,e,n){e.__esModule=!0;var r,i=n(2849),o=n(3769),s=(r=o)&&r.__esModule?r:{default:r};e.default=function(t){t.registerHelper("with",function(t,e){if(2!=arguments.length)throw new s.default("#with requires exactly one argument");i.isFunction(t)&&(t=t.call(this));var n=e.fn;if(i.isEmpty(t))return e.inverse(this);var r=e.data;return e.data&&e.ids&&((r=i.createFrame(e.data)).contextPath=i.appendContextPath(e.data.contextPath,e.ids[0])),n(t,{data:r,blockParams:i.blockParams([t],[r&&r.contextPath])})})},t.exports=e.default},9726(t,e,n){e.__esModule=!0,e.createNewLookupObject=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return r.extend.apply(void 0,[Object.create(null)].concat(e))};var r=n(2849)},3865(t,e,n){e.__esModule=!0,e.createProtoAccessControl=function(t){var e=Object.create(null);e.constructor=!1,e.__defineGetter__=!1,e.__defineSetter__=!1,e.__lookupGetter__=!1;var n=Object.create(null);return n.__proto__=!1,{properties:{whitelist:i.createNewLookupObject(n,t.allowedProtoProperties),defaultValue:t.allowProtoPropertiesByDefault},methods:{whitelist:i.createNewLookupObject(e,t.allowedProtoMethods),defaultValue:t.allowProtoMethodsByDefault}}},e.resultIsAllowed=function(t,e,n){return u("function"==typeof t?e.methods:e.properties,n)},e.resetLoggedProperties=function(){Object.keys(a).forEach(function(t){delete a[t]})};var r,i=n(9726),o=n(566),s=(r=o)&&r.__esModule?r:{default:r},a=Object.create(null);function u(t,e){return void 0!==t.whitelist[e]?!0===t.whitelist[e]:void 0!==t.defaultValue?t.defaultValue:(function(t){!0!==a[t]&&(a[t]=!0,s.default.log("error",'Handlebars: Access has been denied to resolve the property "'+t+'" because it is not an "own property" of its parent.\nYou can add a runtime option to disable the check or this warning:\nSee https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'))}(e),!1)}},2614(t,e){e.__esModule=!0,e.wrapHelper=function(t,e){if("function"!=typeof t)return t;return function(){return arguments[arguments.length-1]=e(arguments[arguments.length-1]),t.apply(this,arguments)}}},566(t,e,n){e.__esModule=!0;var r=n(2849),i={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(t){if("string"==typeof t){var e=r.indexOf(i.methodMap,t.toLowerCase());t=e>=0?e:parseInt(t,10)}return t},log:function(t){if(t=i.lookupLevel(t),"undefined"!=typeof console&&i.lookupLevel(i.level)<=t){var e=i.methodMap[t];console[e]||(e="log");for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o]}}};e.default=i,t.exports=e.default},1148(t,e){e.__esModule=!0,e.default=function(t){"object"!=typeof globalThis&&(Object.prototype.__defineGetter__("__magic__",function(){return this}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__);var e=globalThis.Handlebars;t.noConflict=function(){return globalThis.Handlebars===t&&(globalThis.Handlebars=e),t}},t.exports=e.default},7624(t,e,n){e.__esModule=!0,e.checkRevision=function(t){var e=t&&t[0]||1,n=a.COMPILER_REVISION;if(e>=a.LAST_COMPATIBLE_COMPILER_REVISION&&e<=a.COMPILER_REVISION)return;if(e<a.LAST_COMPATIBLE_COMPILER_REVISION){var r=a.REVISION_CHANGES[n],i=a.REVISION_CHANGES[e];throw new s.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+r+") or downgrade your runtime to an older version ("+i+").")}throw new s.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+t[1]+").")},e.template=function(t,e){if(!e)throw new s.default("No environment passed to template");if(!t||!t.main)throw new s.default("Unknown template object: "+typeof t);t.main.decorator=t.main_d,e.VM.checkRevision(t.compiler);var n=t.compiler&&7===t.compiler[0];var r={strict:function(t,e,n){if(!t||!(e in t))throw new s.default('"'+e+'" not defined in '+t,{loc:n});return r.lookupProperty(t,e)},lookupProperty:function(t,e){var n=t[e];return null==n||Object.prototype.hasOwnProperty.call(t,e)||l.resultIsAllowed(n,r.protoAccessControl,e)?n:void 0},lookup:function(t,e){for(var n=t.length,i=0;i<n;i++){if(null!=(t[i]&&r.lookupProperty(t[i],e)))return t[i][e]}},lambda:function(t,e){return"function"==typeof t?t.call(e):t},escapeExpression:i.escapeExpression,invokePartial:function(n,r,o){o.hash&&(r=i.extend({},r,o.hash),o.ids&&(o.ids[0]=!0)),n=e.VM.resolvePartial.call(this,n,r,o);var a=i.extend({},o,{hooks:this.hooks,protoAccessControl:this.protoAccessControl}),u=e.VM.invokePartial.call(this,n,r,a);if(null==u&&e.compile&&(o.partials[o.name]=e.compile(n,t.compilerOptions,e),u=o.partials[o.name](r,a)),null!=u){if(o.indent){for(var c=u.split("\n"),l=0,h=c.length;l<h&&(c[l]||l+1!==h);l++)c[l]=o.indent+c[l];u=c.join("\n")}return u}throw new s.default("The partial "+o.name+" could not be compiled when running in runtime-only mode")},fn:function(e){var n=t[e];return n.decorator=t[e+"_d"],n},programs:[],program:function(t,e,n,r,i){var o=this.programs[t],s=this.fn(t);return e||i||r||n?o=h(this,t,s,e,n,r,i):o||(o=this.programs[t]=h(this,t,s)),o},data:function(t,e){for(;t&&e--;)t=t._parent;return t},mergeIfNeeded:function(t,e){var n=t||e;return t&&e&&t!==e&&(n=i.extend({},e,t)),n},nullContext:Object.seal({}),noop:e.VM.noop,compilerInfo:t.compiler};function o(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=n.data;o._setup(n),!n.partial&&t.useData&&(i=function(t,e){e&&"root"in e||((e=e?a.createFrame(e):{}).root=t);return e}(e,i));var s=void 0,u=t.useBlockParams?[]:void 0;function c(e){return""+t.main(r,e,r.helpers,r.partials,i,u,s)}return t.useDepths&&(s=n.depths?e!=n.depths[0]?[e].concat(n.depths):n.depths:[e]),(c=p(t.main,c,r,n.depths||[],i,u))(e,n)}return o.isTop=!0,o._setup=function(o){if(o.partial)r.protoAccessControl=o.protoAccessControl,r.helpers=o.helpers,r.partials=o.partials,r.decorators=o.decorators,r.hooks=o.hooks;else{var s=i.extend({},e.helpers,o.helpers);!function(t,e){Object.keys(t).forEach(function(n){var r=t[n];t[n]=function(t,e){var n=e.lookupProperty;return c.wrapHelper(t,function(t){return i.extend({lookupProperty:n},t)})}(r,e)})}(s,r),r.helpers=s,t.usePartial&&(r.partials=r.mergeIfNeeded(o.partials,e.partials)),(t.usePartial||t.useDecorators)&&(r.decorators=i.extend({},e.decorators,o.decorators)),r.hooks={},r.protoAccessControl=l.createProtoAccessControl(o);var a=o.allowCallsToHelperMissing||n;u.moveHelperToHooks(r,"helperMissing",a),u.moveHelperToHooks(r,"blockHelperMissing",a)}},o._child=function(e,n,i,o){if(t.useBlockParams&&!i)throw new s.default("must pass block params");if(t.useDepths&&!o)throw new s.default("must pass parent depths");return h(r,e,t[e],n,0,i,o)},o},e.wrapProgram=h,e.resolvePartial=function(t,e,n){t?t.call||n.name||(n.name=t,t=n.partials[t]):t="@partial-block"===n.name?n.data["partial-block"]:n.partials[n.name];return t},e.invokePartial=function(t,e,n){var r=n.data&&n.data["partial-block"];n.partial=!0,n.ids&&(n.data.contextPath=n.ids[0]||n.data.contextPath);var o=void 0;n.fn&&n.fn!==d&&function(){n.data=a.createFrame(n.data);var t=n.fn;o=n.data["partial-block"]=function(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return n.data=a.createFrame(n.data),n.data["partial-block"]=r,t(e,n)},t.partials&&(n.partials=i.extend({},n.partials,t.partials))}();void 0===t&&o&&(t=o);if(void 0===t)throw new s.default("The partial "+n.name+" could not be found");if(t instanceof Function)return t(e,n)},e.noop=d;var r,i=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2849)),o=n(3769),s=(r=o)&&r.__esModule?r:{default:r},a=n(2871),u=n(2277),c=n(2614),l=n(3865);function h(t,e,n,r,i,o,s){function a(e){var i=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],a=s;return!s||e==s[0]||e===t.nullContext&&null===s[0]||(a=[e].concat(s)),n(t,e,t.helpers,t.partials,i.data||r,o&&[i.blockParams].concat(o),a)}return(a=p(n,a,t,s,r,o)).program=e,a.depth=s?s.length:0,a.blockParams=i||0,a}function d(){return""}function p(t,e,n,r,o,s){if(t.decorator){var a={};e=t.decorator(e,a,n,r&&r[0],o,s,r),i.extend(e,a)}return e}},9613(t,e){function n(t){this.string=t}e.__esModule=!0,n.prototype.toString=n.prototype.toHTML=function(){return""+this.string},e.default=n,t.exports=e.default},2849(t,e){e.__esModule=!0,e.extend=s,e.indexOf=function(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1},e.escapeExpression=function(t){if("string"!=typeof t){if(t&&t.toHTML)return t.toHTML();if(null==t)return"";if(!t)return t+"";t=""+t}if(!i.test(t))return t;return t.replace(r,o)},e.isEmpty=function(t){return!t&&0!==t||!(!c(t)||0!==t.length)},e.createFrame=function(t){var e=s({},t);return e._parent=t,e},e.blockParams=function(t,e){return t.path=e,t},e.appendContextPath=function(t,e){return(t?t+".":"")+e};var n={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;","=":"&#x3D;"},r=/[&<>"'`=]/g,i=/[&<>"'`=]/;function o(t){return n[t]}function s(t){for(var e=1;e<arguments.length;e++)for(var n in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],n)&&(t[n]=arguments[e][n]);return t}var a=Object.prototype.toString;e.toString=a;var u=function(t){return"function"==typeof t};u(/x/)&&(e.isFunction=u=function(t){return"function"==typeof t&&"[object Function]"===a.call(t)}),e.isFunction=u;var c=Array.isArray||function(t){return!(!t||"object"!=typeof t)&&"[object Array]"===a.call(t)};e.isArray=c},251(t,e){e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,h=n?i-1:0,d=n?-1:1,p=t[e+h];for(h+=d,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+t[e+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+t[e+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=c}return(p?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(e*u-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+p]=255&a,p+=f,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[n+p]=255&s,p+=f,s/=256,c-=8);t[n+p-f]|=128*m}},6655(t){t.exports=void 0},4106(t,e){function n(t,e){var n=[],r=[];return null==e&&(e=function(t,e){return n[0]===e?"[Circular ~]":"[Circular ~."+r.slice(0,n.indexOf(e)).join(".")+"]"}),function(i,o){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?r.splice(s,1/0,i):r.push(i),~n.indexOf(o)&&(o=e.call(this,i,o))}else n.push(o);return null==t?o:t.call(this,i,o)}}(t.exports=function(t,e,r,i){return JSON.stringify(t,n(e,i),r)}).getSerialize=n},7799(t,e,n){t.exports=function(){var e,r,i,o,s,a="undefined"==typeof window?n.g:window,u="1.9.6",c=Date.now||function(){return(new Date).getTime()},l=c(),h="undefined"!=typeof performance&&performance.now?function(){return performance.now()}:function(){return c()-l},d=function(t){setTimeout(t,0)};function p(){}function f(t){return"function"==typeof t}function m(){this._orig=this,this._ready=!1,this._queue=[],this._log=[]}function g(t,e){this._bad?f(e)&&e.apply(this,[new Error(this._err())]):f(t)&&t.apply(this,[this])}function _(t,e){this._bad?t._crash(this._err()):setTimeout(function(){t._resume()},e)}function y(t){this._bad&&t._break(this._err()),t._resume()}function v(t,e,n){t[n]=function(){var t=arguments,r=e._image();return this._push(y,[r]),r[n].apply(r,t)}}function b(t){this._bad||f(t)&&t.apply(this)}function w(t){this._bad&&f(t)&&t.apply(this)}function x(t){this._bad?t._crash(this._err()):(this._break("Closed"),t._resume())}function T(t){if(t.length){var e=t.shift();if(t.length){var n=this;this._slip(w,[function(){T.apply(n,[t])}])}try{this._repair(),e.apply(this)}catch(t){this._break(t.toString())}}else this._break()}function k(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return;t.push(e)}function S(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return void t.splice(n,1)}function A(){m.apply(this)}function E(t,e){for(var n in t)t.hasOwnProperty(n)&&e.call(this,n)}function O(t,e,n){if(void 0===e)return O(t,[],[]);if(t instanceof Object){for(var r=0;r<e.length;r++)if(e[r]===t)return n[r];var i;return i=t instanceof Array?[]:{},e.push(t),n.push(i),E(t,function(r){i[r]=O(t[r],e,n)}),i}return t}m.prototype._exec=function(){for(;this._ready&&this._queue.length;){var t=this._queue.shift();t[0].apply(this,t[1])}},m.prototype._push=function(t,e){this._queue.push([t,e]),m.prototype._exec.apply(this)},m.prototype._slip=function(t,e){this._queue.unshift([t,e])},m.prototype._pause=function(){this._ready=!1},m.prototype._resume=function(){this._ready=!0,m.prototype._exec.apply(this)},m.prototype._break=function(t){this._orig._bad=!0,this._orig._log.push(t||"Unknown JZZ error")},m.prototype._repair=function(){this._orig._bad=!1},m.prototype._crash=function(t){this._break(t),this._resume()},m.prototype._err=function(){return this._log[this._log.length-1]},m.prototype.log=function(){return O(this._log)},m.prototype._dup=function(){var t=function(){};t.prototype=this._orig;var e=new t;return e._ready=!1,e._queue=[],e},m.prototype._image=function(){return this._dup()},m.prototype._thenable=function(){if(this.then)return this;var t=this,e=function(){};e.prototype=t;var n=new e;return n.then=function(e,n){return t._push(g,[e,n]),this},n},m.prototype.wait=function(t){if(!t)return this;var e=this._image();return this._push(_,[e,t]),e._thenable()},m.prototype.and=function(t){return this._push(b,[t]),this._thenable()},m.prototype.or=function(t){return this._push(w,[t]),this._thenable()},m.prototype._info={},m.prototype.info=function(){var t=O(this._orig._info);return void 0===t.engine&&(t.engine="none"),void 0===t.sysex&&(t.sysex=!0),t},m.prototype.name=function(){return this.info().name},m.prototype.close=function(){var t=new m;return this._close&&this._push(this._close,[]),this._push(x,[t]),t._thenable()},A.prototype=new m,A.prototype._info={name:"JZZ.js",ver:u,version:u,inputs:[],outputs:[]};var C,M=[],N=[],I=[],j=[],R={},P={};function D(){var t,e;for(C._info.engine=at._type,C._info.version=at._version,C._info.sysex=at._sysex,C._info.inputs=[],C._info.outputs=[],M=[],N=[],at._allOuts={},at._allIns={},t=0;t<at._outs.length;t++)e=at._outs[t],R[e.name]||(e.engine=at,at._allOuts[e.name]=e,C._info.outputs.push({id:e.name,name:e.name,manufacturer:e.manufacturer,version:e.version,engine:at._type}),M.push(e));for(t=0;t<ut._outs.length;t++)e=ut._outs[t],R[e.name]||(C._info.outputs.push({id:e.name,name:e.name,manufacturer:e.manufacturer,version:e.version,engine:e.type}),M.push(e));for(t=0;t<at._ins.length;t++)e=at._ins[t],P[e.name]||(e.engine=at,at._allIns[e.name]=e,C._info.inputs.push({id:e.name,name:e.name,manufacturer:e.manufacturer,version:e.version,engine:at._type}),N.push(e));for(t=0;t<ut._ins.length;t++)e=ut._ins[t],P[e.name]||(C._info.inputs.push({id:e.name,name:e.name,manufacturer:e.manufacturer,version:e.version,engine:e.type}),N.push(e));if(C._watcher&&C._watcher._handles.length){var n=rt(j,I,C._info.inputs,C._info.outputs);if(n){for(r=0;r<n.inputs.removed.length;r++)(e=at._inMap[n.inputs.removed[r].name])&&e._closeAll();for(r=0;r<n.outputs.removed.length;r++)(e=at._outMap[n.outputs.removed[r].name])&&e._closeAll();d(function(){it(n)})}}j=C._info.inputs,I=C._info.outputs}function L(){this._bad||at._refresh(this)}function F(t,e){var n,r;f(t)&&(t=t(e)),t instanceof Array||(t=[t]);var i=[],o=[],s=e.slice(),a=i;for(n=0;n<t.length;n++)if(void 0===t[n])a=o;else if(t[n]instanceof RegExp)for(r=0;r<s.length;r++)t[n].test(s[r].name)&&(a.push(s[r]),s.splice(r,1),r--);else for(r=0;r<s.length;r++)(t[n]+""==r+""||t[n]===s[r].name||t[n]instanceof Object&&t[n].name===s[r].name)&&(a.push(s[r]),s.splice(r,1),r--);return a==i?i:i.concat(s).concat(o)}function $(t,e){var n;n=e instanceof RegExp?"Port matching "+e+" not found":e instanceof Object||void 0===e?"Port not found":'Port "'+e+'" not found',t._crash(n)}function B(t,e){if(this._bad)t._crash(this._err());else{var n=F(e,M);if(!n.length)return void $(t,e);for(var r=function(t){return function(){t.engine._openOut(this,t.name)}},i=0;i<n.length;i++)n[i]=r(n[i]);t._slip(T,[n]),t._resume()}}function q(t,e){if(this._bad)t._crash(this._err());else{var n=F(e,N);if(!n.length)return void $(t,e);for(var r=function(t){return function(){t.engine._openIn(this,t.name)}},i=0;i<n.length;i++)n[i]=r(n[i]);t._slip(T,[n]),t._resume()}}function U(t,e){this._bad?t._crash():(t._slip(tt,[e]),t._resume())}function V(){m.apply(this),this._handles=[],this._outs=[]}function G(t){this._bad||this._receive(t)}function z(t){return t.isMidi2?new Xe(t):Pt.apply(null,arguments)}function W(t){this._emit(t)}function J(t){f(t)?k(this._orig._handles,t):k(this._orig._outs,t)}function H(t){void 0===t?(this._orig._handles=[],this._orig._outs=[]):f(t)?S(this._orig._handles,t):S(this._orig._outs,t)}function X(t,e){this._orig._mpe||(this._orig._mpe=new He),this._orig._mpe.setup(t,e)}function K(t){if(t!=parseInt(t)||t<0||t>15)throw RangeError("Bad channel value (must not be less than 0 or more than 15): "+t)}function Q(t){m.apply(this),this._sink=t}function Z(t){return t.isMidi&&!t.isMidi2?new Pt(t):Xe.apply(null,arguments)}function Y(){m.apply(this),this._handles=[],v(this,C,"refresh"),v(this,C,"openMidiOut"),v(this,C,"openMidiIn"),v(this,C,"onChange"),v(this,C,"close")}function tt(t){f(t)&&(this._orig._handles.length||at._watch(),k(this._orig._handles,t))}function et(t){void 0===t?this._orig._handles=[]:S(this._orig._handles,t),this._orig._handles.length||at._unwatch()}function nt(t,e,n,r){var i;if(t.length!=n.length||e.length!=r.length)return!0;for(i=0;i<t.length;i++)if(t[i].name!=n[i].name)return!0;for(i=0;i<e.length;i++)if(e[i].name!=r[i].name)return!0;return!1}function rt(t,e,n,r){if(nt(t,e,n,r)){var i,o=[],s=[],a=[],u=[],c={};for(i=0;i<t.length;i++)c[t[i].name]=!0;for(i=0;i<n.length;i++)c[n[i].name]||o.push(n[i]);for(c={},i=0;i<n.length;i++)c[n[i].name]=!0;for(i=0;i<t.length;i++)c[t[i].name]||a.push(t[i]);for(c={},i=0;i<e.length;i++)c[e[i].name]=!0;for(i=0;i<r.length;i++)c[r[i].name]||s.push(r[i]);for(c={},i=0;i<r.length;i++)c[r[i].name]=!0;for(i=0;i<e.length;i++)c[e[i].name]||u.push(e[i]);return{inputs:{added:o,removed:a},outputs:{added:s,removed:u}}}}function it(t){for(e=0;e<C._watcher._handles.length;e++)C._watcher._handles[e].apply(C,[t])}A.prototype.refresh=function(){return this._push(L,[]),this._thenable()},A.prototype.openMidiOut=function(t){var e=new V;return this._push(L,[]),this._push(B,[e,t]),e._thenable()},A.prototype._openMidiOutNR=function(t){var e=new V;return this._push(B,[e,t]),e._thenable()},A.prototype.openMidiIn=function(t){var e=new V;return this._push(L,[]),this._push(q,[e,t]),e._thenable()},A.prototype._openMidiInNR=function(t){var e=new V;return this._push(q,[e,t]),e._thenable()},A.prototype.onChange=function(t){this._orig._watcher||(this._orig._watcher=new Y);var e=this._orig._watcher._image();return this._push(U,[e,t]),e._thenable()},A.prototype._close=function(){at._close();for(var t=ct.slice(),e=0;e<t.length;e++)t[e]&&(t[e]._close?t[e]._close():t[e].close&&t[e].close())},V.prototype=new m,V.prototype._filter=function(t){if(this._orig._mpe){var e,n=0;this._handles&&this._handles.length&&(n=this._handles.length,e=this._handles[0]),this._outs&&this._outs.length&&(n=this._outs.length,e=this._outs[0]),1!=n||e._mpe||(t=this._orig._mpe.filter(t))}return t},V.prototype._receive=function(t){this._emit(this._filter(t))},V.prototype.send=function(){return this._push(G,[z.apply(null,arguments)]),this._thenable()},V.prototype.note=function(t,e,n,r){return this.noteOn(t,e,n),void 0===this._ch&&void 0===this._master?r>0&&this.wait(r).noteOff(t,e):n>0&&this.wait(n).noteOff(t),this._thenable()},V.prototype._emit=function(t){var e,n;for(e=0;e<this._handles.length;e++)n=z(t),this._handles[e].apply(this,[n._stamp(this)]);for(e=0;e<this._outs.length;e++)(n=z(t))._stamped(this._outs[e])||this._outs[e].send(n._stamp(this))},V.prototype.emit=function(t){return this._push(W,[t]),this._thenable()},V.prototype.connect=function(t){return this._push(J,[t]),this._thenable()},V.prototype.disconnect=function(t){return this._push(H,[t]),this._thenable()},V.prototype.connected=function(){return this._orig._handles.length+this._orig._outs.length},V.prototype._image=function(){var t=this._dup();return t._gr=this._gr,t._ch=this._ch,t._sxid=this._sxid,t._master=this._master,t._band=this._band,t},V.prototype._sxid=127,V.prototype.sxId=function(t){if(void 0===t&&(t=V.prototype._sxid),t==this._sxid)return this._thenable();t=zt(t);var e=this._image();return e._sxid=t,this._push(y,[e]),e._thenable()},V.prototype.ch=function(t){if(t==this._ch||void 0===t&&void 0===this._ch)return this._thenable();var e=this._image();return void 0!==t&&(t=Vt(t)),e._ch=t,e._master=void 0,e._band=void 0,this._push(y,[e]),e._thenable()},V.prototype.MIDI1=function(){var t=this._image();return t._ch=void 0,t._sxid=V.prototype._sxid,t._master=void 0,t._band=void 0,this._push(y,[t]),t._thenable()},V.prototype.MIDI2=function(){var t=this._image();t._ch=void 0,t._sxid=V.prototype._sxid,t._master=void 0,t._band=void 0;var e=new Q(t);return this._push(y,[e]),e._thenable()},V.prototype.mpe=function(t,e){if(t==this._master&&e==this._band||void 0===t&&void 0===this._master)return this._thenable();if(void 0!==t&&He.validate(t,e),!e)return this.ch(t);var n=this._image();return n._ch=void 0,n._master=t,n._band=e,this._push(X,[t,e]),this._push(y,[n]),n._thenable()},Q.prototype=new m,Q.prototype._sxid=V.prototype._sxid,Q.prototype._receive=function(t){this._sink._receive(t)},Q.prototype.send=function(){return this._push(G,[Z.apply(null,arguments)]),this._thenable()},Q.prototype._image=V.prototype._image,Q.prototype.connect=function(t){return this._sink.connect(t),this._push(y,[this._sink]),this._thenable()},Q.prototype.disconnect=function(t){return this._sink.disconnect(t),this._push(y,[this._sink]),this._thenable()},Q.prototype.connected=function(){return this._sink.connected()},Q.prototype.sxId=V.prototype.sxId,Q.prototype.ch=V.prototype.ch,Q.prototype.gr=function(t){if(t==this._gr||void 0===t&&void 0===this._gr)return this._thenable();var e=this._image();return void 0!==t&&(t=zt(t)),e._gr=t,this._push(y,[e]),e._thenable()},Q.prototype.MIDI1=function(){var t=this._sink._image();return this._push(y,[t]),t._thenable()},Q.prototype.MIDI2=function(){var t=this._image();return t._gr=void 0,t._ch=void 0,t._sxid=V.prototype._sxid,this._push(y,[t]),t._thenable()},Y.prototype=new m,Y.prototype.connect=function(t){return this._push(tt,[t]),this._thenable()},Y.prototype.disconnect=function(t){return this._push(et,[t]),this._thenable()};var ot,st,at={_outs:[],_ins:[],_close:p},ut={_outs:[],_ins:[]},ct=[];function lt(){if(t.exports){var e=n(6655);if(e)return void xt(e)}this._break()}function ht(){var t=document.createElement("div");t.style.visibility="hidden",document.body.appendChild(t);var e=document.createElement("object");e.style.visibility="hidden",e.style.width="0px",e.style.height="0px",e.classid="CLSID:1ACE1618-1C7D-4561-AEE1-34842AA85E90",e.type="audio/x-jazz",document.body.appendChild(e),e.isJazz?Tt(e):this._break()}function dt(){if("undefined"!=typeof navigator&&navigator.requestMIDIAccess){ot=navigator,st=navigator.requestMIDIAccess;try{-1!=st.toString().indexOf("JZZ(")&&(st=void 0)}catch(t){}}}function pt(){if(dt(),st){var t=this,e=function(e){kt(e),t._resume()},n=function(e){t._crash(e)},r={};return st.call(ot,r).then(e,n),void this._pause()}this._break()}function ft(){if(dt(),st){var t=this,e=function(e){kt(e,!0),t._resume()},n=function(e){t._crash(e)},r={sysex:!0};return st.call(ot,r).then(e,n),void this._pause()}this._break()}function mt(){var t,e,n=this;function r(i){t=!0;var o=i.detail;if(!o){if(e||(e=document.getElementById("jazz-midi-msg")),!e)return;try{o=JSON.parse(e.innerText)}catch(t){}e.innerText=""}document.removeEventListener("jazz-midi-msg",r),o&&"version"===o[0]?(St(e,o[2]),n._resume()):n._crash()}this._pause();try{document.addEventListener("jazz-midi-msg",r),document.dispatchEvent(new Event("jazz-midi"))}catch(t){}setTimeout(function(){t||n._crash()},50)}function gt(){this._pause();var t=this;d(function(){t._crash()})}function _t(t){for(var e=[],n=yt(t),r=0;r<n.length;r++)"webmidi"==n[r]?(t&&!0===t.sysex&&e.push(ft),t&&!0===t.sysex&&!0!==t.degrade||e.push(pt)):"node"==n[r]?(e.push(lt),e.push(gt)):"extension"==n[r]?e.push(mt):"plugin"==n[r]&&e.push(ht);return e.push(bt),e}function yt(t){var e=["node","extension","plugin","webmidi"];if(!t||!t.engine)return e;var n,r,i,o=t.engine instanceof Array?t.engine:[t.engine],s={},a=[],u=[];for(i=0;i<o.length;i++){var c=o[i].toString().toLowerCase();s[c]||(s[c]=!0,"none"===c&&(n=!0),"etc"!==c&&void 0!==c||(r=!0),r?u.push(c):a.push(c),S(e,c))}return(r||a.length||u.length)&&(n=!1),n?[]:a.concat(r?e:u)}function vt(t){(C=new A)._options=t,C._push(T,[_t(t)]),C.refresh(),C._resume()}function bt(){at._type="none",at._version=u,at._sysex=!0,at._outs=[],at._ins=[],at._outMap={},at._inMap={},at._refresh=function(){D()},at._watch=p,at._unwatch=p,at._close=p}function wt(){var t;function e(){for(var t=0;t<this.clients.length;t++)this._close(this.clients[t])}at._inArr=[],at._outArr=[],at._inMap={},at._outMap={},at._outsW=[],at._insW=[],at._version=at._main.version,at._sysex=!0,at._refresh=function(){var t,e;for(at._outs=[],at._ins=[],t=0;(e=at._main.MidiOutInfo(t)).length;t++)at._outs.push({type:at._type,name:e[0],manufacturer:e[1],version:e[2]});for(t=0;(e=at._main.MidiInInfo(t)).length;t++)at._ins.push({type:at._type,name:e[0],manufacturer:e[1],version:e[2]});D()},at._openOut=function(t,n){var r=at._outMap[n];if(!r){at._pool.length<=at._outArr.length&&at._pool.push(at._newPlugin()),r={name:n,clients:[],info:{name:n,manufacturer:at._allOuts[n].manufacturer,version:at._allOuts[n].version,type:"MIDI-out",sysex:at._sysex,engine:at._type},_close:function(t){at._closeOut(t)},_closeAll:e,_receive:function(t){t.length&&this.plugin.MidiOutRaw(t.slice())}};var i=at._pool[at._outArr.length];r.plugin=i,at._outArr.push(r),at._outMap[n]=r}if(!r.open){var o=r.plugin.MidiOutOpen(n);if(o!==n)return o&&r.plugin.MidiOutClose(),void t._break();r.open=!0}t._orig._impl=r,k(r.clients,t._orig),t._info=r.info,t._receive=function(t){r._receive(t)},t._close=function(){r._close(this)}},at._openIn=function(t,n){var r=at._inMap[n];if(!r){at._pool.length<=at._inArr.length&&at._pool.push(at._newPlugin()),r={name:n,clients:[],info:{name:n,manufacturer:at._allIns[n].manufacturer,version:at._allIns[n].version,type:"MIDI-in",sysex:at._sysex,engine:at._type},_close:function(t){at._closeIn(t)},_closeAll:e,handle:function(t,e){for(var n=0;n<this.clients.length;n++){var r=Pt(e);this.clients[n]._emit(r)}}};var i=function(t){return function(e,n){t.handle(e,n)}};r.onmidi=i(r);var o=at._pool[at._inArr.length];r.plugin=o,at._inArr.push(r),at._inMap[n]=r}if(!r.open){var s=r.plugin.MidiInOpen(n,r.onmidi);if(s!==n)return s&&r.plugin.MidiInClose(),void t._break();r.open=!0}t._orig._impl=r,k(r.clients,t._orig),t._info=r.info,t._close=function(){r._close(this)}},at._closeOut=function(t){var e=t._impl;S(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,e.plugin.MidiOutClose())},at._closeIn=function(t){var e=t._impl;S(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,e.plugin.MidiInClose())},at._close=function(){for(var t=0;t<at._inArr.length;t++)at._inArr[t].open&&at._inArr[t].plugin.MidiInClose();at._unwatch()},at._watch=function(){t||(t=setInterval(function(){at._refresh()},250))},at._unwatch=function(){t&&clearInterval(t),t=void 0}}function xt(t){at._type="node",at._main=t,at._pool=[],at._newPlugin=function(){return new t.MIDI},wt()}function Tt(t){at._type="plugin",at._main=t,at._pool=[t],at._newPlugin=function(){var e=document.createElement("object");return e.style.visibility="hidden",e.style.width="0px",t.style.height="0px",e.classid="CLSID:1ACE1618-1C7D-4561-AEE1-34842AA85E90",e.type="audio/x-jazz",document.body.appendChild(e),e.isJazz?e:void 0},wt()}function kt(t,e){var n;function r(){for(var t=0;t<this.clients.length;t++)this._close(this.clients[t])}at._type="webmidi",at._version=43,at._sysex=!!e,at._access=t,at._inMap={},at._outMap={},at._outsW=[],at._insW=[],at._refresh=function(){at._outs=[],at._ins=[],at._access.outputs.forEach(function(t){at._outs.push({type:at._type,name:t.name,manufacturer:t.manufacturer,version:t.version})}),at._access.inputs.forEach(function(t){at._ins.push({type:at._type,name:t.name,manufacturer:t.manufacturer,version:t.version})}),D()},at._openOut=function(t,e){var n,i=at._outMap[e];i||(i={name:e,clients:[],info:{name:e,manufacturer:at._allOuts[e].manufacturer,version:at._allOuts[e].version,type:"MIDI-out",sysex:at._sysex,engine:at._type},_close:function(t){at._closeOut(t)},_closeAll:r,_receive:function(t){i.dev&&t.length&&this.dev.send(t.slice())}}),at._access.outputs.forEach(function(t){t.name===e&&(n=t)}),n?(i.dev=n,at._outMap[e]=i,t._orig._impl=i,k(i.clients,t._orig),t._info=i.info,t._receive=function(t){i._receive(t)},t._close=function(){i._close(this)},i.dev.open&&(t._pause(),i.dev.open().then(function(){t._resume()},function(){t._crash()}))):t._break()},at._openIn=function(t,e){var n,i=at._inMap[e];if(i||(i={name:e,clients:[],info:{name:e,manufacturer:at._allIns[e].manufacturer,version:at._allIns[e].version,type:"MIDI-in",sysex:at._sysex,engine:at._type},_close:function(t){at._closeIn(t)},_closeAll:r,handle:function(t){for(var e=0;e<this.clients.length;e++){var n=Pt([].slice.call(t.data));this.clients[e]._emit(n)}}}),at._access.inputs.forEach(function(t){t.name===e&&(n=t)}),n){i.dev=n;var o=function(t){return function(e){t.handle(e)}};i.dev.onmidimessage=o(i),at._inMap[e]=i,t._orig._impl=i,k(i.clients,t._orig),t._info=i.info,t._close=function(){i._close(this)},i.dev.open&&(t._pause(),i.dev.open().then(function(){t._resume()},function(){t._crash()}))}else t._break()},at._closeOut=function(t){var e=t._impl;S(e.clients,t._orig),e.clients.length||(e.dev&&e.dev.close&&e.dev.close(),e.dev=void 0)},at._closeIn=function(t){var e=t._impl;S(e.clients,t._orig),e.clients.length||(e.dev&&(e.dev.onmidimessage=null,e.dev.close&&e.dev.close()),e.dev=void 0)},at._close=function(){at._unwatch()},at._watch=function(){at._access.onstatechange=function(){n=!0,d(function(){n&&(at._refresh(),n=!1)})}},at._unwatch=function(){at._access.onstatechange=void 0}}function St(t,e){function n(){for(var t=0;t<this.clients.length;t++)this._close(this.clients[t])}var r;at._type="extension",at._version=e,at._sysex=!0,at._pool=[],at._outs=[],at._ins=[],at._inArr=[],at._outArr=[],at._inMap={},at._outMap={},at._outsW=[],at._insW=[],at.refreshClients=[],at._msg=t,at._newPlugin=function(){var t={id:at._pool.length};at._pool.push(t),t.id?document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["new"]})):t.ready=!0},at._newPlugin(),at._refresh=function(t){at.refreshClients.push(t),t._pause(),d(function(){document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["refresh"]}))})},at._openOut=function(t,e){var r=at._outMap[e];if(!r){at._pool.length<=at._outArr.length&&at._newPlugin();var i=at._pool[at._outArr.length];r={name:e,clients:[],info:{name:e,manufacturer:at._allOuts[e].manufacturer,version:at._allOuts[e].version,type:"MIDI-out",sysex:at._sysex,engine:at._type},_start:function(){document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["openout",i.id,e]}))},_close:function(t){at._closeOut(t)},_closeAll:n,_receive:function(t){if(t.length){var e=t.slice();e.splice(0,0,"play",i.id),document.dispatchEvent(new CustomEvent("jazz-midi",{detail:e}))}}},r.plugin=i,i.output=r,at._outArr.push(r),at._outMap[e]=r}t._orig._impl=r,k(r.clients,t._orig),t._info=r.info,t._receive=function(t){r._receive(t)},t._close=function(){r._close(this)},r.open||(t._pause(),r.plugin.ready&&r._start())},at._openIn=function(t,e){var r=at._inMap[e];if(!r){at._pool.length<=at._inArr.length&&at._newPlugin();var i=at._pool[at._inArr.length];r={name:e,clients:[],info:{name:e,manufacturer:at._allIns[e].manufacturer,version:at._allIns[e].version,type:"MIDI-in",sysex:at._sysex,engine:at._type},_start:function(){document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["openin",i.id,e]}))},_close:function(t){at._closeIn(t)},_closeAll:n},r.plugin=i,i.input=r,at._inArr.push(r),at._inMap[e]=r}t._orig._impl=r,k(r.clients,t._orig),t._info=r.info,t._close=function(){r._close(this)},r.open||(t._pause(),r.plugin.ready&&r._start())},at._closeOut=function(t){var e=t._impl;S(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["closeout",e.plugin.id]})))},at._closeIn=function(t){var e=t._impl;S(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["closein",e.plugin.id]})))},at._close=function(){at._unwatch()},at._watch=function(){at._insW=at._ins,at._outsW=at._outs,r=setInterval(function(){document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["refresh"]}))},250)},at._unwatch=function(){clearInterval(r),r=void 0},document.addEventListener("jazz-midi-msg",function(t){var e,n,r,i=t.detail?[t.detail]:void 0;if(!i)for(i=at._msg.innerText.split("\n"),at._msg.innerText="",e=0;e<i.length;e++)try{i[e]=JSON.parse(i[e])}catch(t){i[e]=[]}for(e=0;e<i.length;e++){var o=i[e];if(o.length)if("refresh"===o[0]){if(o[1].ins){for(n=0;n<o[1].ins.length;n++)o[1].ins[n].type=at._type;at._ins=o[1].ins}if(o[1].outs){for(n=0;n<o[1].outs.length;n++)o[1].outs[n].type=at._type;at._outs=o[1].outs}for(D(),n=0;n<at.refreshClients.length;n++)at.refreshClients[n]._resume();at.refreshClients=[]}else if("version"===o[0]){var s=at._pool[o[1]];s&&(s.ready=!0,s.input&&s.input._start(),s.output&&s.output._start())}else if("openout"===o[0]){if(r=at._pool[o[1]].output)if(o[2]==r.name){if(r.open=!0,r.clients)for(n=0;n<r.clients.length;n++)r.clients[n]._resume()}else if(r.clients)for(n=0;n<r.clients.length;n++)r.clients[n]._crash()}else if("openin"===o[0]){if(r=at._pool[o[1]].input)if(o[2]==r.name){if(r.open=!0,r.clients)for(n=0;n<r.clients.length;n++)r.clients[n]._resume()}else if(r.clients)for(n=0;n<r.clients.length;n++)r.clients[n]._crash()}else if("midi"===o[0]&&(r=at._pool[o[1]].input)&&r.clients)for(n=0;n<r.clients.length;n++){var a=Pt(o.slice(3));r.clients[n]._emit(a)}}})}var At=function(t){return C||vt(t),C._thenable()};function Et(t){var e=new V;return t instanceof Object&&E(t,function(n){e[n]=t[n]}),e._resume(),e}function Ot(){var t=this instanceof Ot?this:t=new Ot;return Ot.prototype.reset.apply(t,arguments),t}function Ct(){29.97==this.type&&!this.second&&this.frame<2&&this.minute%10&&(this.frame=2)}function Mt(t){return[[24,25,29.97,30][t[7]>>1&3],(1&t[7])<<4|t[6],t[5]<<4|t[4],t[3]<<4|t[2],t[1]<<4|t[0]]}function Nt(t){var e;switch(!t.backwards&&t.quarter>=4?t.decrFrame():t.backwards&&t.quarter<4&&t.incrFrame(),t.quarter>>1){case 0:e=t.frame;break;case 1:e=t.second;break;case 2:e=t.minute;break;default:e=t.hour}return 1&t.quarter?e>>=4:e&=15,7==t.quarter&&(25==t.type?e|=2:29.97==t.type?e|=4:30==t.type&&(e|=6)),!t.backwards&&t.quarter>=4?t.incrFrame():t.backwards&&t.quarter<4&&t.decrFrame(),e|t.quarter<<4}function It(t){return 25==t.type?32|t.hour:29.97==t.type?64|t.hour:30==t.type?96|t.hour:t.hour}function jt(t){return t<10?"0"+t:t}function Rt(t){for(var e=[],n=0;n<t.length;n++)e[n]=jt(n?t[n]:31&t[n]);return e.join(":")}function Pt(t){var e,n=this instanceof Pt?this:n=new Pt;if(t instanceof Pt)return n._from=t._from.slice(),E(t,function(e){"_from"!=e&&(n[e]=t[e])}),n;if(n._from=[],void 0===t)return n;var r=t instanceof Array?t:arguments;for(e=0;e<r.length;e++)s=r[e],1==e&&(n[0]>=128&&n[0]<=175&&(s=Pt.noteValue(s)),n[0]>=192&&n[0]<=207&&(s=Pt.programValue(s))),(s!=parseInt(s)||s<0||s>255)&&Bt(r[e]),n.push(s);return n}At.JZZ=At,At.version=u,At.info=function(){return A.prototype.info()},At.Widget=Et,A.prototype.Widget=At.Widget,At.addMidiIn=function(t,e){var n=O(e._info||{});n.name=t,n.type=n.type||"javascript",n.manufacturer=n.manufacturer||"virtual",n.version=n.version||"0.0";var r={_info:function(){return n},_openIn:function(t){t._pause(),t._info=O(n),t._close=function(){e.disconnect(t)},e.connect(t),t._resume()}};return At.lib.registerMidiIn(t,r)},A.prototype.addMidiIn=At.addMidiIn,At.addMidiOut=function(t,e){var n=O(e._info||{});n.name=t,n.type=n.type||"javascript",n.manufacturer=n.manufacturer||"virtual",n.version=n.version||"0.0";var r={_info:function(){return n},_openOut:function(t){t._pause(),t._info=O(n),t._close=function(){t.disconnect()},J.apply(t,[e]),t._resume()}};return At.lib.registerMidiOut(t,r)},A.prototype.addMidiOut=At.addMidiOut,At.removeMidiOut=function(t){return At.lib.unregisterMidiOut(t)},A.prototype.removeMidiOut=At.removeMidiOut,At.removeMidiIn=function(t){return At.lib.unregisterMidiIn(t)},A.prototype.removeMidiIn=At.removeMidiIn,At.maskMidiIn=function(t){P[t]=!0},A.prototype.maskMidiIn=At.maskMidiIn,At.unmaskMidiIn=function(t){delete P[t]},A.prototype.unmaskMidiIn=At.unmaskMidiIn,At.maskMidiOut=function(t){R[t]=!0},A.prototype.maskMidiOut=At.maskMidiOut,At.unmaskMidiOut=function(t){delete R[t]},A.prototype.unmaskMidiOut=At.unmaskMidiOut,Ot.prototype.reset=function(t){if(t instanceof Ot)return this.setType(t.getType()),this.setHour(t.getHour()),this.setMinute(t.getMinute()),this.setSecond(t.getSecond()),this.setFrame(t.getFrame()),this.setQuarter(t.getQuarter()),this;var e=t instanceof Array?t:arguments;return this.setType(e[0]),this.setHour(e[1]),this.setMinute(e[2]),this.setSecond(e[3]),this.setFrame(e[4]),this.setQuarter(e[5]),this},Ot.prototype.isFullFrame=function(){return 0==this.quarter||4==this.quarter},Ot.prototype.getType=function(){return this.type},Ot.prototype.getHour=function(){return this.hour},Ot.prototype.getMinute=function(){return this.minute},Ot.prototype.getSecond=function(){return this.second},Ot.prototype.getFrame=function(){return this.frame},Ot.prototype.getQuarter=function(){return this.quarter},Ot.prototype.setType=function(t){if(void 0===t||24==t)this.type=24;else if(25==t)this.type=25;else if(29.97==t)this.type=29.97,Ct.apply(this);else{if(30!=t)throw RangeError("Bad SMPTE frame rate: "+t);this.type=30}return this.frame>=this.type&&(this.frame=this.type-1),this},Ot.prototype.setHour=function(t){if(void 0===t&&(t=0),t!=parseInt(t)||t<0||t>=24)throw RangeError("Bad SMPTE hours value: "+t);return this.hour=t,this},Ot.prototype.setMinute=function(t){if(void 0===t&&(t=0),t!=parseInt(t)||t<0||t>=60)throw RangeError("Bad SMPTE minutes value: "+t);return this.minute=t,Ct.apply(this),this},Ot.prototype.setSecond=function(t){if(void 0===t&&(t=0),t!=parseInt(t)||t<0||t>=60)throw RangeError("Bad SMPTE seconds value: "+t);return this.second=t,Ct.apply(this),this},Ot.prototype.setFrame=function(t){if(void 0===t&&(t=0),t!=parseInt(t)||t<0||t>=this.type)throw RangeError("Bad SMPTE frame number: "+t);return this.frame=t,Ct.apply(this),this},Ot.prototype.setQuarter=function(t){if(void 0===t&&(t=0),t!=parseInt(t)||t<0||t>=8)throw RangeError("Bad SMPTE quarter frame: "+t);return this.quarter=t,this},Ot.prototype.incrFrame=function(){return this.frame++,this.frame>=this.type&&(this.frame=0,this.second++,this.second>=60&&(this.second=0,this.minute++,this.minute>=60&&(this.minute=0,this.hour=this.hour>=23?0:this.hour+1))),Ct.apply(this),this},Ot.prototype.decrFrame=function(){return!this.second&&2==this.frame&&29.97==this.type&&this.minute%10&&(this.frame=0),this.frame--,this.frame<0&&(this.frame=29.97==this.type?29:this.type-1,this.second--,this.second<0&&(this.second=59,this.minute--,this.minute<0&&(this.minute=59,this.hour=this.hour?this.hour-1:23))),this},Ot.prototype.incrQF=function(){return this.backwards=!1,this.quarter=this.quarter+1&7,0!=this.quarter&&4!=this.quarter||this.incrFrame(),this},Ot.prototype.decrQF=function(){return this.backwards=!0,this.quarter=this.quarter+7&7,3!=this.quarter&&7!=this.quarter||this.decrFrame(),this},Ot.prototype.read=function(t){if(t instanceof Pt||(t=Pt.apply(null,arguments)),240==t[0]&&127==t[1]&&1==t[3]&&1==t[4]&&247==t[9])return this.type=[24,25,29.97,30][t[5]>>5&3],this.hour=31&t[5],this.minute=t[6],this.second=t[7],this.frame=t[8],this.quarter=0,this._=void 0,this._b=void 0,this._f=void 0,!0;if(241==t[0]&&void 0!==t[1]){var e=t[1]>>4,n=15&t[1];return 0==e?7==this._&&(7==this._f&&(this.reset(Mt(this._a)),this.incrFrame()),this.incrFrame()):3==e?4==this._&&this.decrFrame():4==e?3==this._&&this.incrFrame():7==e&&0===this._&&(0===this._b&&(this.reset(Mt(this._a)),this.decrFrame()),this.decrFrame()),this._a||(this._a=[]),this._a[e]=n,this._f=this._f===e-1||0==e?e:void 0,this._b=this._b===e+1||7==e?e:void 0,this._=e,this.quarter=e,!0}return!1},Ot.prototype.toString=function(){return Rt([this.hour,this.minute,this.second,this.frame])},At.SMPTE=Ot,A.prototype.SMPTE=Ot,Pt.prototype=[],Pt.prototype.constructor=Pt,Pt.prototype.isMidi=function(){return 1};var Dt={};function Lt(t){if(t!=parseFloat(t))throw TypeError("Not a number: "+t)}function Ft(){}Pt.noteValue=function(t){return void 0===t?void 0:Dt[t.toString().toLowerCase()]},Pt.programValue=function(t){return t},Pt.octaveValue=function(t){var e=Dt[t.toString().toLowerCase()];return void 0===e&&(e=Dt[t.toString().toLowerCase()+"1"]),void 0===e?void 0:e%12},Pt.freq=function(t,e){return void 0===e&&(e=440),Lt(e),t!=parseFloat(t)&&(t=Zt(t)),e*Math.pow(2,(t-69)/12)},Pt.shift=function(t,e){return void 0===e&&(e=440),Lt(t),Lt(e),12*Math.log2(t/e)},Pt.midi=function(t,e){return t!=parseFloat(t)?Zt(t):Pt.shift(t,e)+69},Pt.to7b=function(t){return Lt(t),t<=0?0:t>=1?127:Math.floor(128*t)},Pt.to14b=function(t){return Lt(t),t<=0?0:t>=1?16383:Math.floor(16384*t)},Pt.to21b=function(t){return void 0===t?2097151:(Lt(t),t<=0?0:(t=(Math.floor(t)<<14)+Pt.to14b(t-Math.floor(t)))<2097151?t:2097150)},Pt.to32b=function(t){return Lt(t),t<=0?0:t>=1?4294967295:Math.floor(4294967296*t)},Ft.prototype=Pt,Pt._sxid=127,Pt.sxId=function(t){if(void 0===t&&(t=Pt._sxid),t==this._sxid)return this;t=zt(t);var e=new Ft;return e._ch=this._ch,e._sxid=t,e},Pt.ch=function(t){if(t==this._ch||void 0===t&&void 0===this._ch)return this;var e=new Ft;return void 0!==t&&(t=Vt(t)),e._ch=t,e._sxid=this._sxid,e};var $t={c:0,d:2,e:4,f:5,g:7,a:9,b:11,h:11};for(E($t,function(t){for(s=0;s<12&&!((o=$t[t]+12*s)>127);s++)Dt[t+s]=o,Dt[t+"♮"+s]=o,o>0&&(Dt[t+"b"+s]=o-1,Dt[t+"♭"+s]=o-1,Dt[t+"bb"+s]=o-2,Dt[t+"♭♭"+s]=o-2,Dt[t+"𝄫"+s]=o-2),o<127&&(Dt[t+"#"+s]=o+1,Dt[t+"♯"+s]=o+1,Dt[t+"##"+s]=o+2,Dt[t+"♯♯"+s]=o+2,Dt[t+"𝄪"+s]=o+2)}),s=0;s<128;s++)Dt[s]=s;function Bt(t){throw RangeError("Bad MIDI value: "+t)}function qt(t){throw TypeError("Invalid value: "+t)}function Ut(t){throw RangeError("Out of range: "+t)}function Vt(t){return K(t),parseInt(t)}function Gt(t){if(t!=parseInt(t)||t<0||t>15)throw RangeError("Expected a 4-bit value: "+t);return parseInt(t)}function zt(t,e){return(t!=parseInt(t)||t<0||t>127)&&Bt(void 0===e?t:e),parseInt(t)}function Wt(t){return(t!=parseInt(t)||t<0||t>255)&&Bt(t),parseInt(t)}function Jt(t){return(t!=parseInt(t)||t<0||t>16383)&&Bt(t),parseInt(t)}function Ht(t){if(t!=parseInt(t)||t<0||t>65535)throw RangeError("Expected a 16-bit value: "+t);return parseInt(t)}function Xt(t){if(t!=parseInt(t)||t<0||t>1048575)throw RangeError("Expected a 20-bit value: "+t);return parseInt(t)}function Kt(t){return(t!=parseInt(t)||t<0||t>2097151)&&Bt(t),parseInt(t)}function Qt(t){return(t!=parseInt(t)||t<0||t>4294967295)&&Bt(t),parseInt(t)}function Zt(t){return zt(Pt.noteValue(t),t)}function Yt(t){return 127&Jt(t)}function te(t){return Jt(t)>>7}function ee(t){t=""+t;for(var e=0;e<t.length;e++)t.charCodeAt(e)>255&&Bt(t[e]);return t}function ne(t){return[t>>14,t>>7&127,127&t]}function re(t,e){return t!=parseFloat(t)&&qt(void 0===e?t:e),(t<0||t>1)&&Ut(void 0===e?t:e),parseFloat(t)}function ie(t){return void 0===t||t?127:126}function oe(t){var e,n,r=[],i={};E(t,function(e){if(n=Kt(t[e]),(e=Zt(e))in i)throw RangeError("Duplicate MIDI value: "+e);r.push(e),i[e]=n}),r.sort();var o=[r.length];for(e=0;e<r.length;e++)o=o.concat([r[e]],ne(i[r[e]]));return o}function se(t){var e={};return E(t,function(n){e[n]=Pt.to21b(t[n]==parseFloat(t[n])?t[n]:Zt(t[n]))}),e}function ae(t){var e={};return E(t,function(n){e[n]=Pt.to21b(Pt.midi(t[n]))}),e}function ue(t){var e=[];if(!(t instanceof Array)||12!=t.length)throw TypeError("Expected an array of size 12");for(var n=0;n<12;n++)e.push(zt(t[n]));return e}function ce(t){var e=[];if(!(t instanceof Array)||12!=t.length)throw TypeError("Expected an array of size 12");for(var n=0;n<12;n++)e.push(te(t[n])),e.push(Yt(t[n]));return e}var le={noteOff:function(t,e,n){return void 0===n&&(n=64),[128+Vt(t),Zt(e),zt(n)]},noteOn:function(t,e,n){return void 0===n&&(n=127),[144+Vt(t),Zt(e),zt(n)]},aftertouch:function(t,e,n){return[160+Vt(t),Zt(e),zt(n)]}},he={control:function(t,e,n){return[176+Vt(t),zt(e),zt(n)]},program:function(t,e){return[192+Vt(t),zt(Pt.programValue(e),e)]},pressure:function(t,e){return[208+Vt(t),zt(e)]},pitchBend:function(t,e,n){return void 0===n?[224+Vt(t),Yt(e),te(e)]:[224+Vt(t),zt(n),zt(e)]},pitchBendF:function(t,e){return he.pitchBend(t,Pt.to14b((e+1)/2))},bankMSB:function(t,e){return[176+Vt(t),0,zt(e)]},bankLSB:function(t,e){return[176+Vt(t),32,zt(e)]},modMSB:function(t,e){return[176+Vt(t),1,zt(e)]},modLSB:function(t,e){return[176+Vt(t),33,zt(e)]},breathMSB:function(t,e){return[176+Vt(t),2,zt(e)]},breathLSB:function(t,e){return[176+Vt(t),34,zt(e)]},footMSB:function(t,e){return[176+Vt(t),4,zt(e)]},footLSB:function(t,e){return[176+Vt(t),36,zt(e)]},portamentoMSB:function(t,e){return[176+Vt(t),5,zt(e)]},portamentoLSB:function(t,e){return[176+Vt(t),37,zt(e)]},dataMSB:function(t,e){return[176+Vt(t),6,zt(e)]},dataLSB:function(t,e){return[176+Vt(t),38,zt(e)]},volumeMSB:function(t,e){return[176+Vt(t),7,zt(e)]},volumeLSB:function(t,e){return[176+Vt(t),39,zt(e)]},balanceMSB:function(t,e){return[176+Vt(t),8,zt(e)]},balanceLSB:function(t,e){return[176+Vt(t),40,zt(e)]},panMSB:function(t,e){return[176+Vt(t),10,zt(e)]},panLSB:function(t,e){return[176+Vt(t),42,zt(e)]},expressionMSB:function(t,e){return[176+Vt(t),11,zt(e)]},expressionLSB:function(t,e){return[176+Vt(t),43,zt(e)]},damper:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),64,e?127:0]},portamento:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),65,e?127:0]},sostenuto:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),66,e?127:0]},soft:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),67,e?127:0]},legato:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),68,e?127:0]},hold2:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),69,e?127:0]},soundVariation:function(t,e){return[176+Vt(t),70,Zt(e)]},filterResonance:function(t,e){return[176+Vt(t),71,Zt(e)]},releaseTime:function(t,e){return[176+Vt(t),72,Zt(e)]},attackTime:function(t,e){return[176+Vt(t),73,Zt(e)]},brightness:function(t,e){return[176+Vt(t),74,Zt(e)]},decayTime:function(t,e){return[176+Vt(t),75,Zt(e)]},vibratoRate:function(t,e){return[176+Vt(t),76,Zt(e)]},vibratoDepth:function(t,e){return[176+Vt(t),77,Zt(e)]},vibratoDelay:function(t,e){return[176+Vt(t),78,Zt(e)]},ptc:function(t,e){return[176+Vt(t),84,Zt(e)]},dataIncr:function(t){return[176+Vt(t),96,0]},dataDecr:function(t){return[176+Vt(t),97,0]},nrpnLSB:function(t,e){return[176+Vt(t),98,zt(e)]},nrpnMSB:function(t,e){return[176+Vt(t),99,zt(e)]},rpnLSB:function(t,e){return[176+Vt(t),100,zt(e)]},rpnMSB:function(t,e){return[176+Vt(t),101,zt(e)]},allSoundOff:function(t){return[176+Vt(t),120,0]},resetAllControllers:function(t){return[176+Vt(t),121,0]},localControl:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),122,e?127:0]},allNotesOff:function(t){return[176+Vt(t),123,0]},omni:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),e?125:124,0]},mono:function(t,e){return void 0===e&&(e=1),[176+Vt(t),126,zt(e)]},poly:function(t){return[176+Vt(t),127,0]}};function de(t,e,n,r){return void 0!==e?[zt(t),zt(e),zt(n),zt(r)]:((t!=parseInt(t)||t<0||t>65535)&&qt(t),[(t=parseInt(t))>>12&15,t>>8&15,t>>4&15,15&t])}function pe(t){return Lt(t),(t=Math.round(65536*t+16384))<0?0:t>65535?65535:t}var fe={mtc:function(t){return[241,Nt(t)]},songPosition:function(t,e){return void 0===e?[242,Yt(t),te(t)]:[242,zt(e),zt(t)]},songSelect:function(t){return[243,zt(t)]},tune:function(){return[246]},clock:function(){return[248]},start:function(){return[250]},continue:function(){return[251]},stop:function(){return[252]},active:function(){return[254]},reset:function(){return[255]}},me={sxIdRequest:function(){return[240,126,this._sxid,6,1,247]},sxTuningDumpRequest:function(t,e){return void 0===e?[240,126,this._sxid,8,0,zt(t),247]:[240,126,this._sxid,8,3,zt(t),zt(e),247]},sxFullFrame:function(t){return[240,127,this._sxid,1,1,It(t),t.getMinute(),t.getSecond(),t.getFrame(),247]},sxMasterVolume:function(t,e){return void 0===e?[240,127,this._sxid,4,1,Yt(t),te(t),247]:[240,127,this._sxid,4,1,zt(e),zt(t),247]},sxMasterVolumeF:function(t){return me.sxMasterVolume.call(this,Pt.to14b(re(t)))},sxMasterFineTuning:function(t,e){return void 0===e?[240,127,this._sxid,4,3,Yt(t),te(t),247]:[240,127,this._sxid,4,3,zt(e),zt(t),247]},sxMasterFineTuningF:function(t){return me.sxMasterFineTuning.call(this,Pt.to14b(re((t%1+1)/2,t)))},sxMasterCoarseTuning:function(t){return[240,127,this._sxid,4,4,0,zt(t),247]},sxMasterCoarseTuningF:function(t){return me.sxMasterCoarseTuning.call(this,t-t%1+64)},sxNoteTuning:function(t,e,n,r){return e==parseInt(e)?[240,ie(r),this._sxid,8,7,zt(t),zt(e)].concat(oe(n),[247]):[240,127,this._sxid,8,2,zt(t)].concat(oe(e),[247])},sxNoteTuningF:function(t,e,n,r){return e==parseInt(e)?me.sxNoteTuning.call(this,t,e,se(n),r):me.sxNoteTuning.call(this,t,se(e))},sxNoteTuningHZ:function(t,e,n,r){return e==parseInt(e)?me.sxNoteTuning.call(this,t,e,ae(n),r):me.sxNoteTuning.call(this,t,ae(e))},sxScaleTuning1:function(t,e,n){return t==parseInt(t)?[240,ie(n),this._sxid,8,8].concat(ne(Ht(t)),ue(e),[247]):me.sxScaleTuning1.call(this,65535,t,e)},sxScaleTuning1F:function(t,e,n){if(t!=parseInt(t))return me.sxScaleTuning1F.call(this,65535,t,e);for(var r=[],i=0;i<e.length;i++){if(e[i]<-.64||e[i]>.63)throw RangeError("Out of range: "+e[i]);r.push(Math.floor(100*e[i]+64))}return me.sxScaleTuning1.call(this,t,r,n)},sxScaleTuning2:function(t,e,n){return t==parseInt(t)?[240,ie(n),this._sxid,8,9].concat(ne(Ht(t)),ce(e),[247]):me.sxScaleTuning2.call(this,65535,t,e)},sxScaleTuning2F:function(t,e,n){if(t!=parseInt(t))return me.sxScaleTuning2F.call(this,65535,t,e);for(var r=[],i=0;i<e.length;i++){var o=(e[i]+1)/2;if(o<-1||o>1)throw RangeError("Out of range: "+e[i]);r.push(Pt.to14b((e[i]+1)/2))}return me.sxScaleTuning2.call(this,t,r,n)},sxGM:function(t){return void 0===t&&(t=1),[240,126,this._sxid,9,t?2==t?3:1:2,247]},sxGS:function(t){for(var e=void 0===t?[64,0,127,0]:t instanceof Array?t:arguments,n=0,r=[240,65,this._sxid,66,18],i=0;i<e.length;i++){var o=zt(e[i]);r.push(o),n+=o}return n%=128,r.push(n?128-n:0),r.push(247),r},sxXG:function(t){var e=void 0===t?[0,0,126,0]:t instanceof Array?t:arguments,n=127==this._sxid?0:this._sxid;n>15&&Bt("Bad Yamaha device number: "+n);for(var r=[240,67,16+n,76],i=0;i<e.length;i++)r.push(zt(e[i]));return r.push(247),r},sxMidiSoft:function(t,e){var n=[240,0,32,36,0,zt(t||0)];e=void 0===e?"":""+e;for(var r=0;r<e.length;r++)n.push(zt(e.charCodeAt(r)));return n.push(247),n},gsMasterVolume:function(t){return me.sxGS.call(this,[64,0,4,zt(t)])},gsMasterVolumeF:function(t){return me.gsMasterVolume.call(this,Pt.to7b(re(t)))},gsMasterFineTuning:function(t,e,n,r){return t=de(t,e,n,r),me.sxGS.call(this,[64,0,0,t[0],t[1],t[2],t[3]])},gsMasterFineTuningF:function(t){return me.gsMasterFineTuning.call(this,pe(t%1))},gsMasterCoarseTuning:function(t){return me.sxGS.call(this,[64,0,5,zt(t)])},gsMasterCoarseTuningF:function(t){return me.gsMasterCoarseTuning.call(this,t-t%1+64)},gsOctaveTuning:function(t,e,n){return me.sxGS.call(this,[64,16+[1,2,3,4,5,6,7,8,9,0,11,12,13,14,15][Vt(t)],64+Pt.octaveValue(e),zt(n)])},gsOctaveTuningF:function(t,e,n){if(n<-.64||n>.63)throw RangeError("Out of range: "+n);return me.gsOctaveTuning.call(this,t,e,Math.floor(100*n+64))},xgMasterVolume:function(t){return me.sxXG.call(this,[0,0,4,zt(t)])},xgMasterVolumeF:function(t){return me.xgMasterVolume.call(this,Pt.to7b(re(t)))},xgMasterFineTuning:function(t,e,n,r){return t=de(t,e,n,r),me.sxXG.call(this,[0,0,0,t[0],t[1],t[2],t[3]])},xgMasterFineTuningF:function(t){return me.xgMasterFineTuning.call(this,pe(t%1))},xgMasterCoarseTuning:function(t){return me.sxXG.call(this,[0,0,6,zt(t)])},xgMasterCoarseTuningF:function(t){return me.xgMasterCoarseTuning.call(this,t-t%1+64)},xgOctaveTuning:function(t,e,n){return me.sxXG.call(this,[8,Vt(t),65+Pt.octaveValue(e),zt(n)])},xgOctaveTuningF:function(t,e,n){if(n<-.64||n>.63)throw RangeError("Out of range: "+n);return me.xgOctaveTuning.call(this,t,e,Math.floor(100*n+64))}};me.sxScaleTuning=me.sxScaleTuning2,me.sxScaleTuningF=me.sxScaleTuning2F,me.sxMasterTranspose=me.sxMasterCoarseTuning,me.sxMasterTransposeF=me.sxMasterCoarseTuningF,me.gsMasterTranspose=me.gsMasterCoarseTuning,me.gsMasterTransposeF=me.gsMasterCoarseTuningF,me.xgMasterTranspose=me.xgMasterCoarseTuning,me.xgMasterTransposeF=me.xgMasterCoarseTuningF;var ge={bank:function(t,e,n){return void 0===n?[he.bankMSB(t,te(e)),he.bankLSB(t,Yt(e))]:[he.bankMSB(t,e),he.bankLSB(t,n)]},modF:function(t,e){return ge.mod(t,Pt.to14b(e))},mod:function(t,e,n){return void 0===n?[he.modMSB(t,te(e)),he.modLSB(t,Yt(e))]:[he.modMSB(t,e),he.modLSB(t,n)]},breathF:function(t,e){return ge.breath(t,Pt.to14b(e))},breath:function(t,e,n){return void 0===n?[he.breathMSB(t,te(e)),he.breathLSB(t,Yt(e))]:[he.breathMSB(t,e),he.breathLSB(t,n)]},footF:function(t,e){return ge.foot(t,Pt.to14b(e))},foot:function(t,e,n){return void 0===n?[he.footMSB(t,te(e)),he.footLSB(t,Yt(e))]:[he.footMSB(t,e),he.footLSB(t,n)]},portamentoTimeF:function(t,e){return ge.portamentoTime(t,Pt.to14b(e))},portamentoTime:function(t,e,n){return void 0===n?[he.portamentoMSB(t,te(e)),he.portamentoLSB(t,Yt(e))]:[he.portamentoMSB(t,e),he.portamentoLSB(t,n)]},dataF:function(t,e){return ge.data(t,Pt.to14b(e))},data:function(t,e,n){return void 0===n?[he.dataMSB(t,te(e)),he.dataLSB(t,Yt(e))]:[he.dataMSB(t,e),he.dataLSB(t,n)]},volumeF:function(t,e){return ge.volume(t,Pt.to14b(e))},volume:function(t,e,n){return void 0===n?[he.volumeMSB(t,te(e)),he.volumeLSB(t,Yt(e))]:[he.volumeMSB(t,e),he.volumeLSB(t,n)]},balanceF:function(t,e){return ge.balance(t,Pt.to14b((e+1)/2))},balance:function(t,e,n){return void 0===n?[he.balanceMSB(t,te(e)),he.balanceLSB(t,Yt(e))]:[he.balanceMSB(t,e),he.balanceLSB(t,n)]},panF:function(t,e){return ge.pan(t,Pt.to14b((e+1)/2))},pan:function(t,e,n){return void 0===n?[he.panMSB(t,te(e)),he.panLSB(t,Yt(e))]:[he.panMSB(t,e),he.panLSB(t,n)]},expressionF:function(t,e){return ge.expression(t,Pt.to14b(e))},expression:function(t,e,n){return void 0===n?[he.expressionMSB(t,te(e)),he.expressionLSB(t,Yt(e))]:[he.expressionMSB(t,e),he.expressionLSB(t,n)]},nrpn:function(t,e,n){return void 0===n?[he.nrpnMSB(t,te(e)),he.nrpnLSB(t,Yt(e))]:[he.nrpnMSB(t,e),he.nrpnLSB(t,n)]},rpn:function(t,e,n){return void 0===n?[he.rpnMSB(t,te(e)),he.rpnLSB(t,Yt(e))]:[he.rpnMSB(t,e),he.rpnLSB(t,n)]},rpnPitchBendRange:function(t,e,n){return ge.rpn(t,0,0).concat(ge.data(t,e,n))},rpnPitchBendRangeF:function(t,e){return ge.rpnPitchBendRange(t,zt(e-e%1),Math.floor(e%1*100))},rpnFineTuning:function(t,e,n){return ge.rpn(t,0,1).concat(ge.data(t,e,n))},rpnFineTuningF:function(t,e){return ge.rpn(t,0,1).concat(ge.dataF(t,(e%1+1)/2))},rpnCoarseTuning:function(t,e){return ge.rpn(t,0,2).concat([he.dataMSB(t,e)])},rpnCoarseTuningF:function(t,e){return ge.rpn(t,0,2).concat([he.dataMSB(t,e-e%1+64)])},rpnTuning:function(t,e,n,r){return ge.rpnCoarseTuning(t,e).concat(ge.rpnFineTuning(t,n,r))},rpnTuningF:function(t,e){return ge.rpnCoarseTuningF(t,e).concat(ge.rpnFineTuningF(t,e))},rpnTuningA:function(t,e){return ge.rpnTuningF(t,Pt.shift(e))},rpnSelectTuningProgram:function(t,e){return ge.rpn(t,0,3).concat([he.dataMSB(t,e)])},rpnSelectTuningBank:function(t,e){return ge.rpn(t,0,4).concat([he.dataMSB(t,e)])},rpnSelectTuning:function(t,e,n){return void 0===n?ge.rpnSelectTuningProgram(t,e):ge.rpnSelectTuningBank(t,e).concat(ge.rpnSelectTuningProgram(t,n))},rpnModulationDepthRange:function(t,e,n){return ge.rpn(t,0,5).concat(ge.data(t,e,n))},rpnModulationDepthRangeF:function(t,e){return ge.rpnModulationDepthRange(t,zt(e-e%1),Math.floor(e%1*128))},rpnNull:function(t){return ge.rpn(t,127,127)},mode1:function(t){return[he.omni(t,!0),he.poly(t)]},mode2:function(t){return[he.omni(t,!0),he.mono(t)]},mode3:function(t){return[he.omni(t,!1),he.poly(t)]},mode4:function(t){return[he.omni(t,!1),he.mono(t)]}};ge.rpnTranspose=ge.rpnCoarseTuningF;var _e={sxMasterTuning:function(t,e,n){return[me.sxMasterCoarseTuning.call(this,t),me.sxMasterFineTuning.call(this,e,n)]},sxMasterTuningF:function(t){return[me.sxMasterCoarseTuningF.call(this,t),me.sxMasterFineTuningF.call(this,t)]},gsMasterTuningF:function(t){return[me.gsMasterCoarseTuningF.call(this,t),me.gsMasterFineTuningF.call(this,t)]},xgMasterTuningF:function(t){return[me.xgMasterCoarseTuningF.call(this,t),me.xgMasterFineTuningF.call(this,t)]},sxMasterTuningA:function(t){return _e.sxMasterTuningF.call(this,Pt.shift(t))},gsMasterTuningA:function(t){return _e.gsMasterTuningF.call(this,Pt.shift(t))},xgMasterTuningA:function(t){return _e.xgMasterTuningF.call(this,Pt.shift(t))},gsScaleTuning:function(t,e){var n=[];if(12!=e.length)throw RangeError("Wrong input size: "+e.length);for(var r=0;r<12;r++)n.push(me.gsOctaveTuning.call(this,t,r,e[r]));return n},gsScaleTuningF:function(t,e){var n=[];if(12!=e.length)throw RangeError("Wrong input size: "+e.length);for(var r=0;r<12;r++)n.push(me.gsOctaveTuningF.call(this,t,r,e[r]));return n},xgScaleTuning:function(t,e){var n=[];if(12!=e.length)throw RangeError("Wrong input size: "+e.length);for(var r=0;r<12;r++)n.push(me.xgOctaveTuning.call(this,t,r,e[r]));return n},xgScaleTuningF:function(t,e){var n=[];if(12!=e.length)throw RangeError("Wrong input size: "+e.length);for(var r=0;r<12;r++)n.push(me.xgOctaveTuningF.call(this,t,r,e[r]));return n}};function ye(t,e){var n=new Pt;return n.ff=Wt(t),n.dd=void 0===e?"":ee(e),n}var ve={smf:function(t){if(t instanceof Pt)return new Pt(t);var e=t instanceof Array?t:arguments,n=Wt(e[0]),r="";return 2==e.length?r=Re(e[1]):e.length>2&&(r=Re(Array.prototype.slice.call(e,1))),ye(n,r)},smfSeqNumber:function(t){if(t==parseInt(t)){if(t<0||t>65535)throw RangeError("Sequence number out of range: "+t);t=String.fromCharCode(t>>8)+String.fromCharCode(255&t)}else if(0==(t=""+t).length)t="\0\0";else if(1==t.length)t="\0"+t;else if(t.length>2)throw RangeError("Sequence number out of range"+qe(t));return ye(0,t)},smfText:function(t){return ye(1,At.lib.toUTF8(t))},smfCopyright:function(t){return ye(2,At.lib.toUTF8(t))},smfSeqName:function(t){return ye(3,At.lib.toUTF8(t))},smfInstrName:function(t){return ye(4,At.lib.toUTF8(t))},smfLyric:function(t){return ye(5,At.lib.toUTF8(t))},smfMarker:function(t){return ye(6,At.lib.toUTF8(t))},smfCuePoint:function(t){return ye(7,At.lib.toUTF8(t))},smfProgName:function(t){return ye(8,At.lib.toUTF8(t))},smfDevName:function(t){return ye(9,At.lib.toUTF8(t))},smfChannelPrefix:function(t){if(t==parseInt(t))K(t),t=String.fromCharCode(t);else if(0==(t=""+t).length)t="\0";else if(t.length>1||t.charCodeAt(0)>15)throw RangeError("Channel number out of range"+qe(t));return ye(32,t)},smfMidiPort:function(t){if(t==parseInt(t)){if(t<0||t>127)throw RangeError("Port number out of range: "+t);t=String.fromCharCode(t)}else if(0==(t=""+t).length)t="\0";else if(t.length>1||t.charCodeAt(0)>127)throw RangeError("Port number out of range"+qe(t));return ye(33,t)},smfEndOfTrack:function(t){if(""!=Re(t))throw RangeError("Unexpected data"+qe(Re(t)));return ye(47)},smfTempo:function(t){if(3==(""+t).length)return ye(81,t);if(t==parseInt(t)&&t>0&&t<=16777215)return ye(81,String.fromCharCode(t>>16)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t));throw RangeError("Out of range"+qe(Re(t)))},smfBPM:function(t){return ve.smfTempo(Math.round(6e7/t))},smfSMPTE:function(t){if(t instanceof Ot)return ye(84,String.fromCharCode(t.hour)+String.fromCharCode(t.minute)+String.fromCharCode(t.second)+String.fromCharCode(t.frame)+String.fromCharCode(t.quarter%4*25));if(5==(""+t).length)return ye(84,t);var e=t instanceof Array?t:Array.prototype.slice.call(arguments);return e.splice(0,0,30),ve.smfSMPTE(new Ot(e))},smfTimeSignature:function(t,e,n,r){var i,o,s,a,u=(""+t).match(/^\s*(\d+)\s*\/\s*(\d+)\s*$/);if(u){if(i=parseInt(u[1]),o=parseInt(u[2]),i>0&&i<256&&o>0&&!(o&o-1)){for(s=o,o=0,s>>=1;s;s>>=1)o++;return s=e==parseInt(e)?e:24,a=n==parseInt(n)?n:8,ye(88,String.fromCharCode(i)+String.fromCharCode(o)+String.fromCharCode(s)+String.fromCharCode(a))}if(4==(""+t).length)return ye(88,t)}else if(t==parseInt(t)&&e==parseInt(e)){if(t>0&&t<256&&e>0&&!(e&e-1)){for(i=t,o=0,s=e,s>>=1;s;s>>=1)o++;return s=n==parseInt(n)?n:24,a=r==parseInt(r)?r:8,ye(88,String.fromCharCode(i)+String.fromCharCode(o)+String.fromCharCode(s)+String.fromCharCode(a))}if(4==(""+t).length)return ye(88,t);t=t+"/"+e}else if(4==(""+t).length)return ye(88,t);throw RangeError("Wrong time signature"+qe(Re(""+t)))},smfKeySignature:function(t){var e=(t=""+t).match(/^\s*([A-H][b#]?)\s*(|maj|major|dur|m|min|minor|moll)\s*$/i);if(e){var n={CB:0,GB:1,DB:2,AB:3,EB:4,BB:5,F:6,C:7,G:8,D:9,A:10,E:11,B:12,H:12,"F#":13,"C#":14,"G#":15,"D#":16,"A#":17}[e[1].toUpperCase()],r={"":0,MAJ:0,MAJOR:0,DUR:0,M:1,MIN:1,MINOR:1,MOLL:1}[e[2].toUpperCase()];void 0!==n&&void 0!==r&&(r&&(n-=3),(n-=7)>=-7&&n<0?t=String.fromCharCode(256+n)+String.fromCharCode(r):n>=0&&n<=7&&(t=String.fromCharCode(n)+String.fromCharCode(r)))}if(2==t.length&&t.charCodeAt(1)<=1&&(t.charCodeAt(0)<=7||t.charCodeAt(0)<=255&&t.charCodeAt(0)>=249))return ye(89,t);throw RangeError("Incorrect key signature"+qe(t))},smfSequencer:function(t){return ye(127,Re(t))}},be={};function we(t,e){Pt[t]=function(){return new Pt(e.apply(this,arguments))},be[t]=function(){return this.send(e.apply(this,arguments))}}function xe(t,e){Pt[t]=function(){return e.apply(this,arguments)},be[t]=function(){return this.send(e.apply(this,arguments))}}function Te(t,e){Pt[t]=function(){var t,n=[],r=e.apply(this,arguments);for(t=0;t<r.length;t++)n.push(new Pt(r[t]));return n},be[t]=function(){for(var t=e.apply(this,arguments),n=this,r=0;r<t.length;r++)n=n.send(t[r]);return n}}function ke(t,e){Pt[t]=function(){return new Pt(e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))))},be[t]=function(){if(void 0!==this._master){var t=new Pt(e.apply(this,[this._master].concat(Array.prototype.slice.call(arguments))));return t._mpe=t[1],this.send(t)}return this.send(e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))))}}function Se(t,e){Pt[t]=function(){return new Pt(e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))))},be[t]=function(){if(void 0!==this._master){var t,n=Array.prototype.slice.call(arguments);n.length<e.length?n=[this._master].concat(n):(t=Zt(n[0]),n[0]=this._master);var r=new Pt(e.apply(this,n));return r._mpe=t,this.send(r)}return this.send(e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))))}}function Ae(t,e){Pt[t]=function(){var t,n=[],r=e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments)));for(t=0;t<r.length;t++)n.push(new Pt(r[t]));return n},be[t]=function(){var t,n,r;if(void 0!==this._master){var i,o=Array.prototype.slice.call(arguments);for(o.length<e.length?o=[this._master].concat(o):(i=Zt(o[0]),o[0]=this._master),n=e.apply(this,o),r=this,t=0;t<n.length;t++){var s=Pt(n[t]);s._mpe=i,r=r.send(s)}return r}for(n=e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))),r=this,t=0;t<n.length;t++)r=r.send(n[t]);return r}}function Ee(t){E(be,function(e){t.prototype[e]=be[e]})}E(fe,function(t){we(t,fe[t])}),E(me,function(t){we(t,me[t])}),E(ve,function(t){xe(t,ve[t])}),E(_e,function(t){Te(t,_e[t])}),E(le,function(t){ke(t,le[t])}),E(he,function(t){Se(t,he[t])}),E(ge,function(t){Ae(t,ge[t])}),Ee(V);var Oe={a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};for(i=0;i<16;i++)Oe[i]=i;function Ce(t,e){return 127==t&&void 0!==e&&67==e.charCodeAt(0)&&123==e.charCodeAt(1)}function Me(t,e){return Ce(t,e)&&1==e.charCodeAt(2)}function Ne(t,e){if(t>=0&&t<=127&&e>=0&&e<=127){var n=15&t,r=t>>4;return n>0&&n<8&&r<7?(n=["C","D","E","F","G","A","B"][n-1]+["bbb","bb","b","","#","##","###"][r],e>34?n+"?":n+["","6","Maj7","Maj7(#11)","(9)","Maj7(9)","6(9)","aug","m","m6","m7","m7b5","m(9)","m7(9)","m7(11)","m+7","m+7(9)","dim","dim7","7","7sus4","7b5","7(9)","7(#11)","7(13)","7(b9)","7(b13)","7(#9)","Maj7aug","7aug","1+8","1+5","sus4","1+2+5","cc"][e]):"-"}return"-"}function Ie(t){for(var e=[],n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function je(t){for(var e="",n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e}function Re(t){return t instanceof Array?je(t):void 0===t?"":""+t}function Pe(t){for(var e=0,n=0;n<t.length;n++)e=(e<<8)+t.charCodeAt(n);return e}function De(t){return(t<16?"0":"")+t.toString(16)}function Le(t){for(var e=[],n=0;n<t.length;n++)e.push(De(t[n]));return e.join(" ")}function Fe(t){for(var e=[],n=0;n<t.length;n++)n&&n%4==0&&e.push(" "),e.push(De(t[n]));return e.join("")}function $e(t){for(var e="",n=0;n<t.length;n++)"\n"==t[n]?e+="\\n":"\r"==t[n]?e+="\\r":"\t"==t[n]?e+="\\t":t.charCodeAt(n)<32?e+="\\x"+De(t.charCodeAt(n)):e+=t[n];return e}function Be(t){return t.length?": "+Le(Ie(t)):""}function qe(t){return t.length?": "+$e(At.lib.fromUTF8(t)):""}function Ue(t){void 0===t?this._cc={}:this._cc[t]={}}function Ve(t,e){var n=void 0===t?"??":De(t),r=void 0===e?"??":De(e),i={"0000":"Pitch Bend Sensitivity","0001":"Channel Fine Tuning","0002":"Channel Coarse Tuning","0003":"Select Tuning Program","0004":"Select Tuning Bank","0005":"Vibrato Depth Range","7f7f":"NONE"}[n+""+r];return"RPN "+n+" "+r+(i?": "+i:"")}function Ge(t,e){return"NRPN "+(void 0===t?"??":De(t))+" "+(void 0===e?"??":De(e))}function ze(t){var e,n="";for(e=0;e<t.length&&t[e];e++)n+=String.fromCharCode(t[e]);return At.lib.fromUTF8(n)}function We(t){var e,n,r,i,o,s,a,u="x",c="x";if(t.isMidi2?(r=t[0]>>4,n=u=(15&t[0]).toString(16),this._cc[n]||(this._cc[n]={}),2==r?e=new Pt(t.slice(1)):3==r?(i=t[1]>>4,o=15&t[1],s=t.slice(2,2+o),0==i&&(e=new Pt([240].concat(s,[247])),this._cc[n].sx=void 0),1==i&&(this._cc[n].sx=s),2==i&&this._cc[n].sx&&(this._cc[n].sx=this._cc[n].sx.concat(s)),3==i&&this._cc[n].sx&&(s=this._cc[n].sx.concat(s),e=new Pt([240].concat(s,[247])),this._cc[n].sx=void 0)):4==r?(i=t[1]>>4,n=u+(c=(15&t[1]).toString(16)),this._cc[n]||(this._cc[n]={}),12==i&&(1&t[3]&&(this._cc[n].bm=t[6],this._cc[n].bl=t[7]),t._bm=this._cc[n].bm,t._bl=this._cc[n].bl,At.MIDI.programName&&t.label(At.MIDI.programName(t[4],t._bm,t._bl)))):13==r&&(i=t[1]>>6,48&t[1]||(c=(15&t[1]).toString(16)),n=u+c,this._cc[n]||(this._cc[n]={}),s=t.slice(4),0==i&&(t.label(ze(s)),this._cc[n].tx=void 0),1==i&&(this._cc[n].tx=s),2==i&&this._cc[n].tx&&(this._cc[n].tx=this._cc[n].tx.concat(s)),3==i&&this._cc[n].tx&&(s=this._cc[n].tx.concat(s),t.label(ze(s)),this._cc[n].tx=void 0))):e=t,!e||!e.length||e[0]<128)return t;if(255==e[0])return this._clear(),t;if(i=e[0]>>4,c=(15&e[0]).toString(16),n=15==i?u:u+c,this._cc[n]||(this._cc[n]={}),12==i)e._bm=this._cc[n].bm,e._bl=this._cc[n].bl,At.MIDI.programName&&t.label(At.MIDI.programName(e[1],e._bm,e._bl));else if(11==i)switch(e[1]){case 0:this._cc[n].bm=e[2];break;case 32:this._cc[n].bl=e[2];break;case 98:this._cc[n].nl=e[2],this._cc[n].rn="n";break;case 99:this._cc[n].nm=e[2],this._cc[n].rn="n";break;case 100:this._cc[n].rl=e[2],this._cc[n].rn="r";break;case 101:this._cc[n].rm=e[2],this._cc[n].rn="r";break;case 6:case 38:case 96:case 97:"r"==this._cc[n].rn&&(e._rm=this._cc[n].rm,e._rl=this._cc[n].rl,t.label(Ve(this._cc[n].rm,this._cc[n].rl))),"n"==this._cc[n].rn&&(e._nm=this._cc[n].rm,e._nl=this._cc[n].nl,t.label(Ge(this._cc[n].nm,this._cc[n].nl)))}else e.isFullSysEx()&&(127==e[1]?4==e[3]?(a={1:"Master Volume",2:"Master Balance",3:"Master Fine Tuning",4:"Master Coarse Tuning"}[e[4]])&&t.label(a):8==e[3]&&(a={2:"Note Tuning",7:"Note Tuning, Bank",8:"Scale Tuning, 1 byte format",9:"Scale Tuning, 2 byte format"}[e[4]])&&t.label(a):126==e[1]?6==e[3]?1==e[4]?t.label("Device ID Request"):2==e[4]&&t.label("Device ID Response"):8==e[3]?(a={0:"Bulk Tuning Dump Request",1:"Bulk Tuning Dump",3:"Bulk Tuning Dump Request, Bank",4:"Bulk Tuning Dump, Bank",5:"Scale Tuning Dump, 1 byte format",6:"Scale Tuning Dump, 2 byte format",7:"Note Tuning, Bank",8:"Scale Tuning, 1 byte format",9:"Scale Tuning, 2 byte format"}[e[4]])&&t.label(a):9==e[3]&&(1==e[4]?(t.label("GM1 System On"),this._clear(u),this._cc[u].gm="1"):2==e[4]?(t.label("GM System Off"),this._clear(u),this._cc[u].gm="0"):3==e[4]&&(t.label("GM2 System On"),this._clear(u),this._cc[u].gm="2")):67==e[1]?16==(240&e[2])&&76==e[3]&&(0==e[4]&&0==e[5]&&126==e[6]&&0==e[7]?(t.label("XG System On"),this._clear(u),this._cc[u].gm="Y"):0==e[4]&&0==e[5]&&0==e[6]?t.label("XG Master Tuning"):0==e[4]&&0==e[5]&&4==e[6]?t.label("XG Master Volume"):0==e[4]&&0==e[5]&&6==e[6]?t.label("XG Master Transpose"):8==e[4]&&e[5]<16&&e[6]>=65&&e[6]<=76?t.label("XG Scale Tuning"):t.label("XG Parameter")):65==e[1]&&66==e[3]&&18==e[4]&&(64==e[5]&&(0==e[6]?127==e[7]&&0==e[8]&&65==e[9]?(t.label("GS Reset"),this._clear(u),this._cc[u].gm="R"):0==e[7]?t.label("GS Master Tuning"):4==e[7]?t.label("GS Master Volume"):5==e[7]?t.label("GS Master Transpose"):t.label("GS Parameter"):16==(240&e[6])&&21==e[7]?t.label("GS Drum Part Change"):16==(240&e[6])&&e[7]>=64&&e[7]<=75?t.label("GS Scale Tuning"):t.label("GS Parameter")),65==e[5]&&t.label("GS Parameter")));return t}function Je(){var t=new V;return t._clear=Ue,t._read=We,t._receive=function(t){this._emit(this._read(t))},t.gm=function(t){return void 0===t&&(t="x"),this._cc[t]&&this._cc[t].gm||0},t._clear(),t._resume(),t}function He(){var t=this instanceof He?this:t=new He;return t.reset(),arguments.length&&He.prototype.setup.apply(t,arguments),t}function Xe(t){var e,n=this instanceof Xe?this:n=new Xe;if(t instanceof Xe)return n._from=t._from.slice(),E(t,function(e){"_from"!=e&&(n[e]=t[e])}),n;n._from=[],void 0===t&&(t=[0,0,0,0]);var r=t instanceof Array?t:arguments;for(n.length=0,e=0;e<r.length;e++)((s=r[e])!=parseInt(s)||s<0||s>255)&&Bt(r[e]),n.push(s);if(n.length!=[4,4,4,8,8,16,4,4,8,8,8,12,12,16,16,16][n[0]>>4])throw RangeError("Wrong UMP size");return n}function Ke(){}Pt.prototype.getChannel=function(){if(32==this.ff&&1==this.dd.length&&this.dd.charCodeAt(0)<16)return this.dd.charCodeAt(0);var t=this[0];return void 0===t||t<128||t>239?void 0:15&t},Pt.prototype.setChannel=function(t){if(void 0===(t=Oe[t]))return this;if(32==this.ff)this.dd=String.fromCharCode(t);else{var e=this[0];void 0!==e&&e>=128&&e<=239&&(this[0]=240&e|t)}return this},Pt.prototype.getNote=function(){var t=this[0];if(!(void 0===t||t<128||t>175))return this[1]},Pt.prototype.setNote=function(t){var e=this[0];return void 0===e||e<128||e>175||void 0!==(t=Pt.noteValue(t))&&(this[1]=t),this},Pt.prototype.getVelocity=function(){var t=this[0];if(!(void 0===t||t<128||t>159))return this[2]},Pt.prototype.setVelocity=function(t){var e=this[0];return void 0===e||e<128||e>159||(t=parseInt(t))>=0&&t<128&&(this[2]=t),this},Pt.prototype.getSysExId=function(){if(240==this[0])return this[2]},Pt.prototype.setSysExId=function(t){return 240==this[0]&&this.length>2&&(t=parseInt(t))>=0&&t<128&&(this[2]=t),this},Pt.prototype.getData=function(){if(void 0!==this.dd)return this.dd.toString()},Pt.prototype.setData=function(t){return this.dd=Re(t),this},Pt.prototype.getText=function(){if(void 0!==this.dd)return Me(this.ff,this.dd)?Ne(this.dd.charCodeAt(3),this.dd.charCodeAt(4)):At.lib.fromUTF8(this.dd);if(this.isMidiSoft()){for(var t=[],e=6;e<this.length-1;e++)t.push(String.fromCharCode(this[e]));return t.join("")}},Pt.prototype.setText=function(t){return this.dd=At.lib.toUTF8(t),this},Pt.prototype.getTempo=function(){if(81==this.ff&&void 0!==this.dd)return 65536*this.dd.charCodeAt(0)+256*this.dd.charCodeAt(1)+this.dd.charCodeAt(2)},Pt.prototype.getBPM=function(){var t=this.getTempo();if(t)return 6e7/t},Pt.prototype.getTimeSignature=function(){if(88==this.ff&&void 0!==this.dd)return[this.dd.charCodeAt(0),1<<this.dd.charCodeAt(1)]},Pt.prototype.getTimeSignature4=function(){if(88==this.ff&&void 0!==this.dd){var t=[this.dd.charCodeAt(0),1<<this.dd.charCodeAt(1)];return 4==this.dd.length&&t.push(this.dd.charCodeAt(2),this.dd.charCodeAt(3)),t}},Pt.prototype.getKeySignature=function(){if(89==this.ff&&void 0!==this.dd){var t=this.dd.charCodeAt(0),e=this.dd.charCodeAt(1);if(128&t&&(t-=256),t>=-7&&t<=7&&e>=0&&e<=1)return[t,["Cb","Gb","Db","Ab","Eb","Bb","F","C","G","D","A","E","B","F#","C#","G#","D#","A#"][e?t+10:t+7],!!e]}},Pt.prototype.isNoteOn=function(){var t=this[0];return!(void 0===t||t<144||t>159)&&this[2]>0},Pt.prototype.isNoteOff=function(){var t=this[0];return!(void 0===t||t<128||t>159)&&(t<144||0==this[2])},Pt.prototype.isSysEx=function(){return 240==this[0]},Pt.prototype.isFullSysEx=function(){return 240==this[0]&&247==this[this.length-1]},Pt.prototype.isMidiSoft=function(){return this.isFullSysEx()&&0==this[1]&&32==this[2]&&36==this[3]&&0==this[4]},Pt.prototype.isSMF=function(){return this.ff>=0&&this.ff<=127},Pt.prototype.isEOT=function(){return 47==this.ff},Pt.prototype.isText=function(){return 1==this.ff},Pt.prototype.isCopyright=function(){return 2==this.ff},Pt.prototype.isSeqName=function(){return 3==this.ff},Pt.prototype.isInstrName=function(){return 4==this.ff},Pt.prototype.isLyric=function(){return 5==this.ff},Pt.prototype.isMarker=function(){return 6==this.ff},Pt.prototype.isCuePoint=function(){return 7==this.ff},Pt.prototype.isProgName=function(){return 8==this.ff},Pt.prototype.isDevName=function(){return 9==this.ff},Pt.prototype.isTempo=function(){return 81==this.ff},Pt.prototype.isTimeSignature=function(){return 88==this.ff},Pt.prototype.isKeySignature=function(){return 89==this.ff},Pt.prototype.isGmReset=function(){return this.match([240,126,[0,0],9,[0,0],247])},Pt.prototype.isGsReset=function(){return this.match([240,65,[0,0],66,18,64,0,127,0,65,247])},Pt.prototype.isXgReset=function(){return this.match([240,67,[16,240],76,0,0,126,0,247])},Pt.prototype.match=function(t){var e,n;for(e=0;e<t.length;e++)if(void 0===(n=t[e][1])){if(this[e]!=t[e])return!1}else if((this[e]&n)!=(t[e][0]&n))return!1;return!0},Pt.prototype.label=function(t){return this.lbl=this.lbl?this.lbl+", "+t:t,this},Pt.prototype.toString=function(){return this.lbl?this._str()+" ("+this.lbl+")":this._str()},Pt.prototype._str=function(){var t,e;if(this.length)t=Le(this);else{if(void 0===this.ff)return"empty";t="ff"+De(this.ff)}return(e=this._string())?t+" -- "+e:t},Pt.prototype._string=function(){var t,e="";if(!this.length){if(0==this.ff)e+="Sequence Number: "+Pe(this.dd);else if(this.ff>0&&this.ff<10)e+=["","Text","Copyright","Sequence Name","Instrument Name","Lyric","Marker","Cue Point","Program Name","Device Name"][this.ff]+qe(this.dd);else if(32==this.ff)e+="Channel Prefix"+Be(this.dd);else if(33==this.ff)e+="MIDI Port"+Be(this.dd);else if(47==this.ff)e+="End of Track"+Be(this.dd);else if(81==this.ff)e+="Tempo: "+Math.round(100*this.getBPM())/100+" bpm";else if(84==this.ff)e+="SMPTE Offset: "+Rt(Ie(this.dd));else if(88==this.ff){var n=1<<this.dd.charCodeAt(1);e+="Time Signature: "+this.dd.charCodeAt(0)+"/"+n,e+=" "+this.dd.charCodeAt(2)+" "+this.dd.charCodeAt(3)}else if(89==this.ff){e+="Key Signature: ";var r=this.getKeySignature();r?(e+=r[1],r[2]&&(e+=" min")):e+="invalid"}else if(127==this.ff){if(67==this.dd.charCodeAt(0)&&123==this.dd.charCodeAt(1))return e+="[XF:"+De(this.dd.charCodeAt(2))+"]",e+=(t={0:"Version",1:"Chord",2:"Rehearsal Mark",3:"Phrase Mark",4:"Max Phrase Mark",5:"Fingering Number",12:"Guide Track Flag",16:"Guitar Info",18:"Chord Voicing",127:"XG Song Data Number"}[this.dd.charCodeAt(2)])?" "+t:"",e+=": ",0==this.dd.charCodeAt(2)?e+this.dd.substring(3,7)+" "+Le(Ie(this.dd.substring(7))):1==this.dd.charCodeAt(2)?e+this.getText():e+Le(Ie(this.dd.substring(3)));e+="Sequencer Specific"+Be(this.dd)}else e+="SMF"+Be(this.dd);return e}if(t={241:"MIDI Time Code",242:"Song Position",243:"Song Select",244:"Undefined",245:"Undefined",246:"Tune request",248:"Timing clock",249:"Undefined",250:"Start",251:"Continue",252:"Stop",253:"Undefined",254:"Active Sensing",255:"Reset"}[this[0]])return t;if(this.isMidiSoft())return(t=$e(this.getText()))&&(t=" "+t),"[K:"+De(this[5])+"]"+t;var i=this[0]>>4;return(t={8:"Note Off",10:"Aftertouch",12:"Program Change",13:"Channel Aftertouch",14:"Pitch Wheel"}[i])?t:9==i?this[2]?"Note On":"Note Off":11!=i?e:(t={0:"Bank Select MSB",1:"Modulation Wheel MSB",2:"Breath Controller MSB",4:"Foot Controller MSB",5:"Portamento Time MSB",6:"Data Entry MSB",7:"Channel Volume MSB",8:"Balance MSB",10:"Pan MSB",11:"Expression Controller MSB",12:"Effect Control 1 MSB",13:"Effect Control 2 MSB",16:"General Purpose Controller 1 MSB",17:"General Purpose Controller 2 MSB",18:"General Purpose Controller 3 MSB",19:"General Purpose Controller 4 MSB",31:"Karaoke",32:"Bank Select LSB",33:"Modulation Wheel LSB",34:"Breath Controller LSB",36:"Foot Controller LSB",37:"Portamento Time LSB",38:"Data Entry LSB",39:"Channel Volume LSB",40:"Balance LSB",42:"Pan LSB",43:"Expression Controller LSB",44:"Effect control 1 LSB",45:"Effect control 2 LSB",48:"General Purpose Controller 1 LSB",49:"General Purpose Controller 2 LSB",50:"General Purpose Controller 3 LSB",51:"General Purpose Controller 4 LSB",64:"Damper Pedal",65:"Portamento",66:"Sostenuto",67:"Soft Pedal",68:"Legato",69:"Hold 2",70:"Sound Variation",71:"Filter Resonance",72:"Release Time",73:"Attack Time",74:"Brightness",75:"Decay Time",76:"Vibrato Rate",77:"Vibrato Depth",78:"Vibrato Delay",79:"Sound Controller 10",80:"General Purpose Controller 5",81:"General Purpose Controller 6",82:"General Purpose Controller 7",83:"General Purpose Controller 8",84:"Portamento Control",88:"High Resolution Velocity Prefix",91:"Effects 1 Depth",92:"Effects 2 Depth",93:"Effects 3 Depth",94:"Effects 4 Depth",95:"Effects 5 Depth",96:"Data Increment",97:"Data Decrement",98:"Non-Registered Parameter Number LSB",99:"Non-Registered Parameter Number MSB",100:"Registered Parameter Number LSB",101:"Registered Parameter Number MSB",120:"All Sound Off",121:"Reset All Controllers",122:"Local Control On/Off",123:"All Notes Off",124:"Omni Mode Off",125:"Omni Mode On",126:"Mono Mode On",127:"Poly Mode On"}[this[1]],this[1]>=64&&this[1]<=69&&(t+=this[2]<64?" Off":" On"),t||(t="Undefined"),t)},Pt.prototype._stamp=function(t){return this._from.push(t._orig?t._orig:t),this},Pt.prototype._unstamp=function(t){if(void 0===t)this._from=[];else{t._orig&&(t=t._orig);var e=this._from.indexOf(t);e>-1&&this._from.splice(e,1)}return this},Pt.prototype._stamped=function(t){t._orig&&(t=t._orig);for(var e=0;e<this._from.length;e++)if(this._from[e]==t)return!0;return!1},At.MIDI=Pt,A.prototype.MIDI=Pt,At.Context=Je,A.prototype.Context=Je,He.validate=function(t){var e=t instanceof Array?t:arguments;if(e[0]!=parseInt(e[0])||e[0]<0||e[0]>14)throw RangeError("Bad master channel value: "+e[0]);if(e[1]!=parseInt(e[1])||e[1]<0||e[0]+e[1]>15)throw RangeError("Bad zone size value: "+e[1])},He.prototype.reset=function(){for(var t=0;t<16;t++)this[t]={band:0,master:t}},He.prototype.setup=function(t,e){var n;He.validate(t,e);var r=t+e;if((this[t].master!=t||this[t].band!=e)&&(e||this[t].band)){for(this[t].band?r<(n=t+this[t].band)&&(r=n):this[t].master==t-1?(n=t-1,r<(n+=this[n].band)&&(r=n),this[t-1]={band:0,master:t-1}):this[t].master!=t&&(n=this[t].master,r<(n+=this[n].band)&&(r=n),this[this[t].master].band=t-this[t].master-1),this[t].master=t,this[t].band=e,n=t+1;n<=t+e;n++)this[n].band&&r<n+this[n].band&&(r=n+this[n].band),this[n]={band:0,master:t};for(;n<=r;n++)this[n]={band:0,master:n}}},He.prototype.filter=function(t){var e=t.getChannel();if(!this[e]||!this[this[e].master].band)return t;var n,r,i,o=this[e].master,s=this[o].band;if(void 0!==t._mpe){for(i=256,n=o+1;n<=o+s;n++)if(this[n].notes){for(i>this[n].notes.length&&(e=n,i=this[n].notes.length),r=0;r<this[n].notes.length;r++)if(this[n].notes[r]==t._mpe){e=n,i=-1;break}}else i>0&&(e=n,i=0);t.setChannel(e),t._mpe=void 0}return e==o||(t.isNoteOn()?(this[e].notes||(this[e].notes=[]),k(this[e].notes,t.getNote())):t.isNoteOff()&&this[e].notes&&S(this[e].notes,t.getNote())),t},At.MPE=He,Xe.prototype=[],Xe.prototype.constructor=Xe,Xe.prototype.isMidi=function(){return 2},Xe.prototype.isMidi2=!0,Xe.prototype.dump=function(){var t,e="";for(t=0;t<this.length;t++)e+=String.fromCharCode(this[t]);return e},Ke.prototype=Xe,Xe._sxid=127,Xe.sxId=function(t){if(void 0===t&&(t=Xe._sxid),t==this._sxid)return this;t=zt(t);var e=new Ke;return e._ch=this._ch,e._gr=this._gr,e._sxid=t,e},Xe.ch=function(t){if(t==this._ch||void 0===t&&void 0===this._ch)return this;var e=new Ke;return void 0!==t&&(t=Vt(t)),e._ch=t,e._gr=this._gr,e._sxid=this._sxid,e},Xe.gr=function(t){if(t==this._gr||void 0===t&&void 0===this._gr)return this;var e=new Ke;return void 0!==t&&(t=Gt(t)),e._ch=this._ch,e._gr=t,e._sxid=this._sxid,e},Xe.prototype.getGroup=function(){if(this[0]){var t=this[0]>>4;return 1==t||2==t||3==t||4==t||5==t||13==t?15&this[0]:void 0}};var Qe=[0,0,0,0,0,0,0,0,0,0,0,0,0];function Ze(t,e,n,r){return void 0!==e?[Wt(t),Wt(e),Wt(n),Wt(r)]:[(t=Qt(t))>>24&255,t>>16&255,t>>8&255,255&t]}function Ye(t){return(t=Math.floor(4294967296*t))>4294967295?4294967295:t<0?0:t}var tn={noop:function(){return[0,0,0,0]},umpClock:function(t){return[0,16,(t=Ht(t))>>8,255&t]},umpTimestamp:function(t){return[0,32,(t=Ht(t))>>8,255&t]},umpTicksPQN:function(t){return[0,48,(t=Ht(t))>>8,255&t]},umpDelta:function(t){return[0,64+((t=Xt(t=t||0))>>16),t>>8&255,255&t]},umpStartClip:function(){return[240,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},umpEndClip:function(){return[240,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},en={umpTempo:function(t,e){return[208+Gt(t),16,0,0].concat(Ze(e),[0,0,0,0,0,0,0,0])},umpBPM:function(t,e){return en.umpTempo(t,Math.round(6e9/e))},umpTimeSignature:function(t,e,n){var r,i,o,s=(""+e).match(/^\s*(\d+)\s*\/\s*(\d+)\s*$/);if(s?(r=parseInt(s[1]),i=parseInt(s[2])):e==parseInt(e)&&n==parseInt(n)&&(r=parseInt(e),i=parseInt(n)),r>0&&r<256&&i>0&&!(i&i-1)){for(o=0,i>>=1;i;i>>=1)o++;if((i=Math.round(32*r/(1<<o)))<256)return[208+Gt(t),16,0,1,r,o,i,0,0,0,0,0,0,0,0,0]}throw RangeError("Wrong time signature "+e+(void 0===n?"":"/"+n))}},nn={umpMetadata:function(t,e){return sn.umpCustomText(t,0,1,1,0,e)},umpProjectName:function(t,e){return sn.umpCustomText(t,0,1,1,1,e)},umpCompositionName:function(t,e){return sn.umpCustomText(t,0,1,1,2,e)},umpClipName:function(t,e){return sn.umpCustomText(t,0,1,1,3,e)},umpCopyright:function(t,e){return sn.umpCustomText(t,0,1,1,4,e)},umpComposerName:function(t,e){return sn.umpCustomText(t,0,1,1,5,e)},umpLyricistName:function(t,e){return sn.umpCustomText(t,0,1,1,6,e)},umpArrangerName:function(t,e){return sn.umpCustomText(t,0,1,1,7,e)},umpPublisherName:function(t,e){return sn.umpCustomText(t,0,1,1,8,e)},umpPerformerName:function(t,e){return sn.umpCustomText(t,0,1,1,9,e)},umpAccPerformerName:function(t,e){return sn.umpCustomText(t,0,1,1,10,e)},umpRecordingDate:function(t,e){return sn.umpCustomText(t,0,1,1,11,e)},umpRecordingLocation:function(t,e){return sn.umpCustomText(t,0,1,1,12,e)},umpText:function(t,e){return sn.umpCustomText(t,0,1,2,0,e)},umpLyrics:function(t,e){return sn.umpCustomText(t,0,1,2,1,e)},umpLyricsLanguage:function(t,e){return sn.umpCustomText(t,0,1,2,2,e)},umpRuby:function(t,e){return sn.umpCustomText(t,0,1,2,3,e)},umpRubyLanguage:function(t,e){return sn.umpCustomText(t,0,1,2,4,e)},umpData:function(t,e,n){var r;void 0===n&&(n=e,e=0);var i=fn(gn(n),13);for(r=0;r<i.length;r++)i[r]=[80+Gt(t),16*pn(i.length,r)+i[r].length,Wt(e)].concat(i[r],Qe).slice(0,16);return i}},rn=[0,6,32,38,98,99,100,101],on={umpNoteOn:function(t,e,n,r,i,o){return void 0===r&&(r=65535),i=i||0,o=o||0,r=Ht(r),o=Ht(o),[64+Gt(t),144+Vt(e),Zt(n),Wt(i),r>>8,255&r,o>>8,255&o]},umpNoteOff:function(t,e,n,r,i,o){return i=i||0,o=o||0,r=Ht(r=r||0),o=Ht(o),[64+Gt(t),128+Vt(e),Zt(n),Wt(i),r>>8,255&r,o>>8,255&o]},umpAftertouch:function(t,e,n,r,i,o,s){return[64+Gt(t),160+Vt(e),Zt(n),0].concat(Ze(r,i,o,s))},umpAftertouchF:function(t,e,n,r){return on.umpAftertouch(t,e,n,Ye(r))},umpControl:function(t,e,n,r,i,o,s){return rn.includes(n)&&Bt(n),[64+Gt(t),176+Vt(e),zt(n),0].concat(Ze(r,i,o,s))},umpPortamento:function(t,e,n){return[64+Gt(t),176+Vt(e),84,0,Zt(n),0,0,0]},umpPressure:function(t,e,n,r,i,o){return[64+Gt(t),208+Vt(e),0,0].concat(Ze(n,r,i,o))},umpPressureF:function(t,e,n){return on.umpPressure(t,e,Ye(n))},umpProgram:function(t,e,n,r,i){return void 0===r&&void 0===i?[64+Gt(t),192+Vt(e),0,0,Zt(n),0,0,0]:void 0===i?[64+Gt(t),192+Vt(e),0,1,Zt(n),0,te(r),Yt(r)]:[64+Gt(t),192+Vt(e),0,1,Zt(n),0,zt(r),zt(i)]},umpPitchBend:function(t,e,n,r,i,o){return[64+Gt(t),224+Vt(e),0,0].concat(Ze(n,r,i,o))},umpPitchBendF:function(t,e,n){return on.umpPitchBend(t,e,Ye((n+1)/2))},umpPnPitchBend:function(t,e,n,r,i,o,s){return[64+Gt(t),96+Vt(e),Zt(n),0].concat(Ze(r,i,o,s))},umpPnPitchBendF:function(t,e,n,r){return on.umpPnPitchBend(t,e,n,Ye((r+1)/2))},umpRPN:function(t,e,n,r,i,o,s,a){return[64+Gt(t),32+Vt(e),zt(n),zt(r)].concat(Ze(i,o,s,a))},umpNRPN:function(t,e,n,r,i,o,s,a){return[64+Gt(t),48+Vt(e),zt(n),zt(r)].concat(Ze(i,o,s,a))},umpPnRPN:function(t,e,n,r,i,o,s,a){return[64+Gt(t),0+Vt(e),Zt(n),Wt(r)].concat(Ze(i,o,s,a))},umpPnNRPN:function(t,e,n,r,i,o,s,a){return[64+Gt(t),16+Vt(e),Zt(n),Wt(r)].concat(Ze(i,o,s,a))},umpFineTuning:function(t,e,n,r,i,o){return on.umpRPN(t,e,0,1,n,r,i,o)},umpFineTuningF:function(t,e,n){return on.umpFineTuning(t,e,Pt.to32b(re((n%1+1)/2,n)))},umpCoarseTuning:function(t,e,n){return[64+Gt(t),32+Vt(e),0,2,2*zt(n),0,0,0]},umpCoarseTuningF:function(t,e,n){return on.umpCoarseTuning(t,e,n-n%1+64)},umpTuningProgram:function(t,e,n){return[64+Gt(t),32+Vt(e),0,3,2*zt(n),0,0,0]},umpTuningBank:function(t,e,n){return[64+Gt(t),32+Vt(e),0,4,2*zt(n),0,0,0]},umpPnManagement:function(t,e,n,r){for(var i=r.toString().split(""),o=0,s=0;s<i.length;s++)if("S"!=i[s]||1&o){if("D"!=i[s]||2&o){o=r;break}o|=2}else o|=1;return[64+Gt(t),240+Vt(e),Zt(n),Wt(o),0,0,0,0]}};on.umpPnPressure=on.umpAftertouch,on.umpPnPressureF=on.umpAftertouchF,on.umpTranspose=on.umpCoarseTuningF;var sn={umpTuningF:function(t,e,n){return[on.umpCoarseTuningF(t,e,n),on.umpFineTuningF(t,e,n)]},umpTuningA:function(t,e,n){return sn.umpTuningF(t,e,Pt.shift(n))},umpCustomText:function(t,e,n,r,i,o){var s,a=[];for(o=At.lib.toUTF8(""+o),s=0;s<o.length;s++)a.push(o.charCodeAt(s));for(a=fn(a,12),s=0;s<a.length;s++)a[s]=[208+Gt(t),64*pn(a.length,s)+(n?16:0)+Vt(e),r,i].concat(a[s],Qe).slice(0,16);return a},umpCMetadata:function(t,e,n){return sn.umpCustomText(t,e,0,1,0,n)},umpCProjectName:function(t,e,n){return sn.umpCustomText(t,e,0,1,1,n)},umpCCompositionName:function(t,e,n){return sn.umpCustomText(t,e,0,1,2,n)},umpCClipName:function(t,e,n){return sn.umpCustomText(t,e,0,1,3,n)},umpCCopyright:function(t,e,n){return sn.umpCustomText(t,e,0,1,4,n)},umpCComposerName:function(t,e,n){return sn.umpCustomText(t,e,0,1,5,n)},umpCLyricistName:function(t,e,n){return sn.umpCustomText(t,e,0,1,6,n)},umpCArrangerName:function(t,e,n){return sn.umpCustomText(t,e,0,1,7,n)},umpCPublisherName:function(t,e,n){return sn.umpCustomText(t,e,0,1,8,n)},umpCPerformerName:function(t,e,n){return sn.umpCustomText(t,e,0,1,9,n)},umpCAccPerformerName:function(t,e,n){return sn.umpCustomText(t,e,0,1,10,n)},umpCRecordingDate:function(t,e,n){return sn.umpCustomText(t,e,0,1,11,n)},umpCRecordingLocation:function(t,e,n){return sn.umpCustomText(t,e,0,1,12,n)},umpCText:function(t,e,n){return sn.umpCustomText(t,e,0,2,0,n)},umpCLyrics:function(t,e,n){return sn.umpCustomText(t,e,0,2,1,n)},umpCLyricsLanguage:function(t,e,n){return sn.umpCustomText(t,e,0,2,2,n)},umpCRuby:function(t,e,n){return sn.umpCustomText(t,e,0,2,3,n)},umpCRubyLanguage:function(t,e,n){return sn.umpCustomText(t,e,0,2,4,n)}},an={};function un(t,e){Xe[t]=function(){return new Xe(e.apply(this,arguments))},an[t]=function(){return this.send(e.apply(this,arguments))}}function cn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),new Xe(e.apply(this,t))},an[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),this.send(e.apply(this,t))}}function ln(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=e.apply(this,t),r=0;r<n.length;r++)n[r]=new Xe(n[r]);return n},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=e.apply(this,t),r=0;r<n.length;r++)this.send(n[r]);return this}}function hn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1))),new Xe(e.apply(this,t))},an[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1))),this.send(e.apply(this,t))}}function dn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1)));for(var n=e.apply(this,t),r=0;r<n.length;r++)n[r]=new Xe(n[r]);return n},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1)));for(var n=e.apply(this,t),r=0;r<n.length;r++)this.send(n[r]);return this}}function pn(t,e){return 1==t?0:0==e?1:e==t-1?3:2}function fn(t,e){for(var n=[],r=t;r.length;r=r.slice(e))n.push(r.slice(0,e));return n.length?n:[[]]}function mn(t,e){for(var n=fn(e.slice(1,e.length-1),6),r=0;r<n.length;r++)n[r]=new Xe([48+t,16*pn(n.length,r)+n[r].length].concat(n[r],Qe).slice(0,8));return n}function gn(t){var e,n=[];if("string"==typeof t)for(e=0;e<t.length;e++)n.push(t.charCodeAt(e));else for(e=0;e<t.length;e++)n.push(t[e]);for(e=0;e<n.length;e++)if(n[e]!=parseInt(n[e])||n[e]<0||n[e]>255)throw RangeError("Bad data");return n}function _n(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),mn(Gt(t[0]),e.apply(this,t.slice(1)))},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=mn(Gt(t[0]),e.apply(this,t.slice(1))),r=this,i=0;i<n.length;i++)r=r.send(n[i]);return r}}function yn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=e.apply(this,t.slice(1)),r=[],i=0;i<n.length;i++)r=r.concat(mn(Gt(t[0]),n[i]));return r},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=e.apply(this,t.slice(1)),r=this,i=0;i<n.length;i++)for(var o=mn(Gt(t[0]),n[i]),s=0;s<o.length;s++)r=r.send(o[s]);return r}}function vn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),new Xe([16+Gt(t[0])].concat(e.apply(this,t.slice(1)),Qe).slice(0,4))},an[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),this.send([16+Gt(t[0])].concat(e.apply(this,t.slice(1)),Qe).slice(0,4))}}function bn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1))),new Xe([32+Gt(t[0])].concat(e.apply(this,t.slice(1)),Qe).slice(0,4))},an[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1))),this.send([32+Gt(t[0])].concat(e.apply(this,t.slice(1)),Qe).slice(0,4))}}function wn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1)));for(var n=e.apply(this,t.slice(1)),r=0;r<n.length;r++)n[r]=new Xe([32+Gt(t[0])].concat(n[r],Qe).slice(0,4));return n},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1)));for(var n=e.apply(this,t.slice(1)),r=this,i=0;i<n.length;i++)r=r.send([32+Gt(t[0])].concat(n[i],Qe).slice(0,4));return r}}function xn(t){E(an,function(e){t.prototype[e]=an[e]})}function Tn(t,e){var n=256*t+e;return n?n>>9||1:0}function kn(t,e,n,r){return 16777216*t+65536*e+256*n+r>>25&127}function Sn(t,e){return t.gr=e,t}function An(t){if(t.isMidi2){var e,n,r,i=t[0]>>4,o=15&t[0];if(1==i||2==i)this._emit(Sn(new Pt(t.slice(1)),o));else if(3==i)n=t[1]>>4,e=15&t[1],0==n?(this._emit(Sn(new Pt([240].concat(t.slice(2,2+e),[247])),o)),this._sx[o]=void 0):1==n?this._sx[o]=t.slice(2,2+e):2==n?this._sx[o]&&(this._sx[o]=this._sx[o].concat(t.slice(2,2+e))):3==n&&(this._sx[o]&&this._emit(Sn(new Pt([240].concat(this._sx[o],t.slice(2,2+e),[247])),o)),this._sx[o]=void 0);else if(4==i){if(e=t[1]>>4,n=15&t[1],2==e||3==e?(this._emit(Sn(new Pt([176+n,2==e?101:99,t[2]]),o)),this._emit(Sn(new Pt([176+n,2==e?100:98,t[3]]),o)),this._emit(Sn(new Pt([176+n,6,t[4]>>1]),o)),this._emit(Sn(new Pt([176+n,38,64*(1&t[4])+(t[4]>>2)]),o))):8!=e&&9!=e||this._emit(Sn(new Pt([t[1],t[2],Tn(t[4],t[5])]),o)),10==e&&this._emit(Sn(new Pt([t[1],t[2],kn(t[4],t[5],t[6],t[7])]),o)),11==e){if(rn.includes(t[2]))return;this._emit(Sn(new Pt([t[1],t[2],kn(t[4],t[5],t[6],t[7])]),o))}13==e&&this._emit(Sn(new Pt([t[1],kn(t[4],t[5],t[6],t[7])]),o)),14==e?(r=16777216*t[4]+65536*t[5]+256*t[6]+t[4]>>18,this._emit(Sn(new Pt([t[1],127&r,r>>7&127]),o))):12==e&&(t[3]&&(this._emit(Sn(new Pt([176+n,0,t[6]]),o)),this._emit(Sn(new Pt([176+n,32,t[7]]),o))),this._emit(Sn(new Pt([t[1],t[4]]),o)))}}else this._emit(t)}function En(){var t=new V;return t._sx=[],t._receive=An,t._resume(),t.MIDI2()}function On(t){if(t.isMidi2)this._emit(t);else{var e=t.gr>=0&&t.gr<=15?t.gr:0;if(t[0]>=128&&t[0]<240)this._emit(At.MIDI2([32+e].concat(t.slice(),Qe).slice(0,4)));else if(t[0]>240&&t[0]<=255&&247!=t[0])this._emit(At.MIDI2([16+e].concat(t.slice(),Qe).slice(0,4)));else if(t.isFullSysEx())for(var n=mn(e,t.slice()),r=0;r<n.length;r++)this._emit(At.MIDI2(n[r]))}}function Cn(){var t=new V;return t._receive=On,t._resume(),t}E(tn,function(t){un(t,tn[t])}),E(en,function(t){cn(t,en[t])}),E(nn,function(t){ln(t,nn[t])}),E(on,function(t){hn(t,on[t])}),E(sn,function(t){dn(t,sn[t])}),E(fe,function(t){vn(t,fe[t])}),E(le,function(t){bn(t,le[t])}),E(he,function(t){bn(t,he[t])}),E(ge,function(t){wn(t,ge[t])}),E(me,function(t){_n(t,me[t])}),E(_e,function(t){yn(t,_e[t])}),xn(Q),Xe.prototype.getTempo=function(){if(this.isTempo())return(this[4]<<24)+(this[5]<<16)+(this[6]<<8)+this[7]},Xe.prototype.getBPM=function(){var t=this.getTempo();if(t)return Math.round(6e9/t)},Xe.prototype.getTimeSignature=function(){if(this.isTimeSignature())return[this[4],1<<this[5]]},Xe.prototype.getTicksPQN=function(){if(this.isTicksPQN())return(this[2]<<8)+this[3]},Xe.prototype.getDelta=function(){if(this.isDelta())return((15&this[1])<<16)+(this[2]<<8)+this[3]},Xe.prototype.getStatus=function(){return this.isFlex()?this[1]>>6:this.isData()||this.isSX()?this[1]>>4:void 0},Xe.prototype.isTempo=function(){return this[0]>>4==13&&this[1]>>4==1&&0==this[2]&&0==this[3]},Xe.prototype.isTimeSignature=function(){return this[0]>>4==13&&this[1]>>4==1&&0==this[2]&&1==this[3]},Xe.prototype.isTicksPQN=function(){return 0==this[0]&&this[1]>>4==3},Xe.prototype.isDelta=function(){return 0==this[0]&&this[1]>>4==4},Xe.prototype.isStartClip=function(){return this.match([240,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0])},Xe.prototype.isEndClip=function(){return this.match([240,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0])},Xe.prototype.isData=function(){return 80==(240&this[0])},Xe.prototype.isFlex=function(){return 208==(240&this[0])},Xe.prototype.isText=function(){return 208==(240&this[0])&&(1==this[2]||2==this[2])},Xe.prototype.isSX=function(){return 48==(240&this[0])},Xe.prototype.isNoteOn=function(){var t=(this[0]||0)>>4,e=(this[1]||0)>>4;return 4==t?9==e:2==t&&9==e&&!!this[3]},Xe.prototype.isNoteOff=function(){var t=(this[0]||0)>>4,e=(this[1]||0)>>4;return 4==t?8==e:2==t&&(8==e||9==e&&!this[3])},Xe.prototype.label=Pt.prototype.label,Xe.prototype.toString=Pt.prototype.toString,Xe.prototype._str=function(){var t=this._string();return t?Fe(this)+" -- "+t:Fe(this)},Xe.prototype._string=function(){var t,e,n,r=this[0]>>4;return 1==r||2==r?new Pt(this.slice(1))._string():(0==r?e=["NOOP","JR Clock","JR Timestamp","Ticks Per Quarter Note","Delta Ticks"][t=this[1]>>4]:3==r?e="SysEx":4==r?(e={0:"Registered Per-Note Controller",1:"Assignable Per-Note Controller",2:"Registered Controller",3:"Assignable Controller",4:"Relative Registered Controller",5:"Relative Assignable Controller",6:"Per-Note Pitch Bend",8:"Note Off",9:"Note On",10:"Poly Pressure",11:"Control Change",12:"Program Change",13:"Channel Pressure",14:"Pitch Bend",15:"Per-Note Management"}[t=this[1]>>4],11==t&&(e={84:"Portamento"}[this[2]]||e),2==t&&(n={"0000":"Pitch Bend Sensitivity","0001":"Fine Tuning","0002":"Coarse Tuning","0003":"Select Tuning Program","0004":"Select Tuning Bank","0005":"Vibrato Depth Range","7f7f":"NONE"}[De(this[2])+""+De(this[3])])&&(e+=": "+n)):5==r?e="Data":13==r&&(0==(t=this[2])?(e={0:"Tempo ",1:"Time Signature ",2:"Metronome",5:"Key Signature",6:"Chord Name"}[t=this[3]],0==t?e+=this.getBPM()+" BPM":1==t&&(e+=this.getTimeSignature().join("/"))):1==t?e={0:"Metadata",1:"Project Name",2:"Composition Name",3:"Clip Name",4:"Copyright",5:"Composer Name",6:"Lyricist Name",7:"Arranger Name",8:"Publisher Name",9:"Primary Performer Name",10:"Accompanying Performer Name",11:"Recording Date",12:"Recording Location"}[t=this[3]]||"Unknown Text":2==t&&(e={0:"Text",1:"Lyrics",2:"Lyrics Language",3:"Ruby",4:"Ruby Language"}[t=this[3]]||"Unknown Text")),15==r&&(e={32:"Start of Clip",33:"End of Clip"}[this[1]]),e)},Xe.prototype._stamp=Pt.prototype._stamp,Xe.prototype._unstamp=Pt.prototype._unstamp,Xe.prototype._stamped=Pt.prototype._stamped,Xe.prototype.match=Pt.prototype.match,At.UMP=Xe,A.prototype.UMP=Xe,At.MIDI2=Xe,A.prototype.MIDI2=Xe,At.M2M1=En,A.prototype.M2M1=At.M2M1,At.M1M2=Cn,A.prototype.M1M2=At.M1M2,At.lib={},At.lib.now=h,At.lib.schedule=d,At.lib.R=m;var Mn,Nn,In=[],jn=0;try{var Rn=URL.createObjectURL(new Blob(["(",function(){function t(){postMessage({}),setTimeout(t,0)}t()}.toString(),")()"],{type:"application/javascript"})),Pn=function(){for(var t=In.length,e=0;e<t;e++)In.shift()();++jn>20&&Mn&&(Mn.terminate(),Mn=void 0)},Dn=function(t){In.push(t),jn=0,Mn||((Mn=new Worker(Rn)).onmessage=Pn)};Dn(function(){At.lib.schedule=Dn})}catch(t){}function Ln(){if(!Nn&&"undefined"!=typeof window){var t=window.AudioContext||window.webkitAudioContext;if(t){(Nn=new t)&&!Nn.createGain&&(Nn.createGain=Nn.createGainNode);var e=function(){if("running"!=Nn.state){Nn.resume();var t=Nn.createOscillator(),n=Nn.createGain();try{n.gain.value=0}catch(t){}n.gain.setTargetAtTime(0,Nn.currentTime,.01),t.connect(n),n.connect(Nn.destination),t.start||(t.start=t.noteOn),t.stop||(t.stop=t.noteOff),t.start(.1),t.stop(.11)}else"undefined"!=typeof document&&(document.removeEventListener("touchstart",e),document.removeEventListener("touchend",e),document.removeEventListener("mousedown",e),document.removeEventListener("keydown",e))};"undefined"!=typeof document&&(document.addEventListener("touchstart",e),document.addEventListener("touchend",e),document.addEventListener("mousedown",e),document.addEventListener("keydown",e)),e()}}}At.lib.openMidiOut=function(t,e){var n=new V;return e._openOut(n),n._info=e._info(t),n},At.lib.openMidiIn=function(t,e){var n=new V;return e._openIn(n),n._info=e._info(t),n},At.lib.registerMidiOut=function(t,e){for(var n=e._info(t),r=0;r<ut._outs.length;r++)if(ut._outs[r].name==n.name)return!1;return n.engine=e,ut._outs.push(n),C&&(D(),C._bad&&(C._repair(),C._resume())),!0},At.lib.registerMidiIn=function(t,e){for(var n=e._info(t),r=0;r<ut._ins.length;r++)if(ut._ins[r].name==n.name)return!1;return n.engine=e,ut._ins.push(n),C&&(D(),C._bad&&(C._repair(),C._resume())),!0},At.lib.unregisterMidiOut=function(t){for(var e=0;e<ut._outs.length;e++)if(ut._outs[e].name==t)return ut._outs.splice(e,e+1),C&&D(),!0;return!1},At.lib.unregisterMidiIn=function(t){for(var e=0;e<ut._ins.length;e++)if(ut._ins[e].name==t)return ut._ins.splice(e,e+1),C&&D(),!0;return!1},At.lib.plug=function(t){for(var e=0;e<ct.length;e++)if(ct[e]==t)return;ct.push(t)},At.lib.unplug=function(t){for(var e=0;e<ct.length;e++)if(ct[e]==t)return void ct.splice(e,1)},At.lib.copyMidiHelpers=Ee,At.lib.copyMidi2Helpers=xn,At.lib.copyUmpHelpers=xn,At.lib.getAudioContext=function(){return Ln(),Nn},At.lib.closeAudioContext=function(){Nn&&Nn.close(),Nn=void 0};var Fn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";At.lib.fromBase64=function(t){var e,n,r,i,o,s,a="",u=0;for(t=t.replace(/[^A-Za-z0-9+/=]/g,"");u<t.length;)e=Fn.indexOf(t.charAt(u++))<<2|(i=Fn.indexOf(t.charAt(u++)))>>4,n=(15&i)<<4|(o=Fn.indexOf(t.charAt(u++)))>>2,r=(3&o)<<6|(s=Fn.indexOf(t.charAt(u++))),a+=String.fromCharCode(e),64!=o&&(a+=String.fromCharCode(n)),64!=s&&(a+=String.fromCharCode(r));return a},At.lib.toBase64=function(t){var e,n,r,i,o,s=0,a=0,u="",c=[];if(!t)return t;do{e=(o=t.charCodeAt(s++)<<16|t.charCodeAt(s++)<<8|t.charCodeAt(s++))>>18&63,n=o>>12&63,r=o>>6&63,i=63&o,c[a++]=Fn.charAt(e)+Fn.charAt(n)+Fn.charAt(r)+Fn.charAt(i)}while(s<t.length);u=c.join("");var l=t.length%3;return l?u.slice(0,l-3)+"===".slice(l):u},At.lib.fromUTF8=function(t){t=void 0===t?"":""+t;var e,n,r,i="";for(e=0;e<t.length;e++){if((n=t.charCodeAt(e))>255)return t;if(n<128)i+=t[e];else if(192==(224&n)){if(n=(31&n)<<6,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;n+=63&r,i+=String.fromCharCode(n)}else if(224==(240&n)){if(n=(15&n)<<12,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;if(n+=(63&r)<<6,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;n+=63&r,i+=String.fromCharCode(n)}else if(240==(248&n)){if(n=(7&n)<<18,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;if(n+=(63&r)<<12,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;if(n+=(63&r)<<6,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;if((n+=63&r)>1114111)return t;n-=65536,i+=String.fromCharCode(55296+(n>>10)),i+=String.fromCharCode(56320+(1023&n))}}return i},At.lib.toUTF8=function(t){t=void 0===t?"":""+t;var e,n,r="";for(e=0;e<t.length;e++)(n=t.charCodeAt(e))<128?r+=t[e]:n<2048?(r+=String.fromCharCode(192+(n>>6)),r+=String.fromCharCode(128+(63&n))):n<65536?(r+=String.fromCharCode(224+(n>>12)),r+=String.fromCharCode(128+(n>>6&63)),r+=String.fromCharCode(128+(63&n))):(r+=String.fromCharCode(240+(n>>18)),r+=String.fromCharCode(128+(n>>12&63)),r+=String.fromCharCode(128+(n>>6&63)),r+=String.fromCharCode(128+(63&n)));return r};var $n=[],Bn={},qn={},Un=a.Promise;function Vn(t,e,n){this.name=t,this.message=e,this.code=n}function Gn(t,e){this.bubbles=!1,this.cancelBubble=!1,this.cancelable=!1,this.currentTarget=e,this.defaultPrevented=!1,this.eventPhase=0,this.path=[],this.port=t,this.returnValue=!0,this.srcElement=e,this.target=e,this.timeStamp=h(),this.type="statechange"}function zn(t,e){this.bubbles=!1,this.cancelBubble=!1,this.cancelable=!1,this.currentTarget=t,this.data=e,this.defaultPrevented=!1,this.eventPhase=0,this.path=[],this.receivedTime=h(),this.returnValue=!0,this.srcElement=t,this.target=t,this.timeStamp=this.receivedTime,this.type="midimessage"}function Wn(t,e){t&&(t.onstatechange&&t.onstatechange(new Gn(t,t)),e.onstatechange&&e.onstatechange(new Gn(t,e)))}function Jn(t,e){var n=this,r=!1,i=null,o=null;this.type="input",this.id=e.id,this.name=e.name,this.manufacturer=e.man,this.version=e.ver,Object.defineProperty(this,"state",{get:function(){return e.connected?"connected":"disconnected"},enumerable:!0}),Object.defineProperty(this,"connection",{get:function(){return r?e.proxy?"open":"pending":"closed"},enumerable:!0}),Object.defineProperty(this,"onmidimessage",{get:function(){return o},set:function(t){f(t)?(o=t,r||n.open().then(p,p)):o=null},enumerable:!0}),Object.defineProperty(this,"onstatechange",{get:function(){return i},set:function(t){i=f(t)?t:null},enumerable:!0}),this.open=function(){return new Un(function(i,o){r?i(n):e.open().then(function(){r||(r=!0,Wn(n,t)),i(n)},function(){o(new Vn("InvalidAccessError","Port is not available",15))})})},this.close=function(){return new Un(function(i){r&&(r=!1,e.close(),Wn(n,t)),i(n)})},Object.freeze(this)}function Hn(t){for(var e,n;t.length;){for(e=0;e<t.length&&!(t[e]==parseInt(t[e])&&t[e]>=128&&t[e]<=255&&247!=t[e]);e++);if(t.splice(0,e),!t.length)return;if(240==t[0]){for(e=1;e<t.length&&247!=t[e];e++);if(e==t.length)return;return t.splice(0,e+1)}if((n=Kn(t[0])+1)>t.length)return;for(e=1;e<n&&!(t[e]!=parseInt(t[e])||t[e]<0||t[e]>=128);e++);if(e==n)return t.splice(0,e);t.splice(0,e)}}function Xn(t,n,r,i){var o=this;this.id=t,this.name=n,this.man=r,this.ver=i,this.connected=!0,this.ports=[],this.pending=[],this.proxy=void 0,this.queue=[],this.onmidi=function(t){var n;for(o.queue=o.queue.concat(t.slice()),n=Hn(o.queue);n;n=Hn(o.queue))for(e=0;e<o.ports.length;e++)o.ports[e][0].onmidimessage&&(240!=n[0]||o.ports[e][1])&&o.ports[e][0].onmidimessage(new zn(o,new Uint8Array(n)))}}function Kn(t){return t>=128&&t<=191||t>=224&&t<=239||242==t?2:t>=192&&t<=223||241==t||243==t?1:0}"function"!=typeof Un&&((Un=function(t){this.executor=t}).prototype.then=function(t,e){"function"!=typeof t&&(t=p),"function"!=typeof e&&(e=p),this.executor(t,e)}),Xn.prototype.open=function(){var t=this;return new Un(function(e,n){var r;t.proxy||!t.connected?e():(t.pending.push([e,n]),1==t.pending.length&&At().openMidiIn(t.name).or(function(){for(r=0;r<t.pending.length;r++)t.pending[r][1]();t.pending=[]}).and(function(){for(t.proxy=this,t.proxy.connect(t.onmidi),r=0;r<t.pending.length;r++)t.pending[r][0]();t.pending=[]}))})},Xn.prototype.close=function(){var t;if(this.proxy){for(t=0;t<this.ports.length;t++)if("open"==this.ports[t].connection)return;this.proxy.close(),this.proxy=void 0}},Xn.prototype.disconnect=function(){this.connected=!1,this.proxy&&(this.proxy.close(),this.proxy=void 0)},Xn.prototype.reconnect=function(){var t,e,n=this,r=[];for(this.connected=!0,t=0;t<$n.length;t++)"closed"==(e=$n[t].inputs.get(this.id)).connection?Wn(e,$n[t]):r.push([e,$n[t]]);r.length&&At()._openMidiInNR(n.name).or(function(){for(t=0;t<r.length;t++)r[t][0].close()}).and(function(){for(n.proxy=this,n.proxy.connect(n.onmidi),t=0;t<r.length;t++)Wn(r[t][0],r[t][1])})};var Qn="Failed to execute 'send' on 'MIDIOutput': ";function Zn(t,e){var n,r,i,o=[];for(n=0;n<t.length;n++)if(t[n]!=parseInt(t[n])||t[n]<0||t[n]>255)throw TypeError(Qn+t[n]+" is not a UInt8 value.");for(r=0,n=0;n<t.length;n++)if(r){if(t[n]>127)throw TypeError(Qn+"Unexpected status byte at index "+n+" ("+t[n]+").");i.push(t[n]),r--}else{if(t[n]<128)throw TypeError(Qn+"Running status is not allowed at index "+n+" ("+t[n]+").");if(247==t[n])throw TypeError(Qn+"Unexpected end of system exclusive message at index "+n+" ("+t[n]+").");if(i=[t[n]],o.push(i),240==t[n]){if(!e)throw new Vn("InvalidAccessError",Qn+"System exclusive messag is not allowed at index "+n+" ("+t[n]+").",15);for(r=-1;n<t.length;n++)if(i.push(t[n]),247==t[n]){r=0;break}}else r=Kn(t[n])}if(r)throw TypeError(Qn+"Message is incomplete");return[o]}function Yn(t,e){var n=this,r=!1,i=null;this.type="output",this.id=e.id,this.name=e.name,this.manufacturer=e.man,this.version=e.ver,Object.defineProperty(this,"state",{get:function(){return e.connected?"connected":"disconnected"},enumerable:!0}),Object.defineProperty(this,"connection",{get:function(){return r?e.proxy?"open":"pending":"closed"},enumerable:!0}),Object.defineProperty(this,"onstatechange",{get:function(){return i},set:function(t){i=f(t)?t:null},enumerable:!0}),this.open=function(){return new Un(function(i,o){r?i(n):e.open().then(function(){r||(r=!0,Wn(n,t)),i(n)},function(){o(new Vn("InvalidAccessError","Port is not available",15))})})},this.close=function(){return new Un(function(i){r&&(r=!1,n.clear(),e.close(),Wn(n,t)),i(n)})},this.clear=function(){},this.send=function(i,o){if(Zn(i,t.sysexEnabled),!e.connected)throw new Vn("InvalidStateError","Port is not connected",11);if(r){var s=h();o>s?setTimeout(function(){e.proxy.send(i)},o-s):e.proxy.send(i)}else this.open().then(function(){n.send(i,o)},p)},Object.freeze(this)}function tr(t,e,n,r){this.id=t,this.name=e,this.man=n,this.ver=r,this.connected=!0,this.ports=[],this.pending=[],this.proxy=void 0}function er(t){this.has=function(e){return t.hasOwnProperty(e)&&t[e].connected},this.keys=function(){try{var e=new Map;for(var n in t)this.has(n)&&e.set(n,this.get(n));return e.keys()}catch(t){}},this.values=function(){try{var e=new Map;for(var n in t)this.has(n)&&e.set(n,this.get(n));return e.values()}catch(t){}},this.entries=function(){try{var e=new Map;for(var n in t)this.has(n)&&e.set(n,this.get(n));return e.entries()}catch(t){}},this.forEach=function(e,n){for(var r in void 0===n&&(n=this),t)this.has(r)&&e.call(n,this.get(r),r,this)},Object.defineProperty(this,"size",{get:function(){var e=0;for(var n in t)this.has(n)&&e++;return e},enumerable:!0})}function nr(t,e){this.get=function(n){if(qn.hasOwnProperty(n)&&qn[n].connected)return e[n]||(e[n]=new Jn(t,qn[n]),qn[n].ports.push([e[n],t.sysexEnabled])),e[n]},Object.freeze(this)}function rr(t,e){this.get=function(n){if(Bn.hasOwnProperty(n)&&Bn[n].connected)return e[n]||(e[n]=new Yn(t,Bn[n]),Bn[n].ports.push([e[n],t.sysexEnabled])),e[n]},Object.freeze(this)}function ir(t){var e,n,r,i;for(e=0;e<t.inputs.added.length;e++)r=t.inputs.added[e],qn.hasOwnProperty(r.id)||(qn[r.id]=new Xn(r.id,r.name,r.manufacturer,r.version)),qn[r.id].reconnect();for(e=0;e<t.outputs.added.length;e++)r=t.outputs.added[e],Bn.hasOwnProperty(r.id)||(Bn[r.id]=new tr(r.id,r.name,r.manufacturer,r.version)),Bn[r.id].reconnect();for(e=0;e<t.inputs.removed.length;e++)if(r=t.inputs.removed[e],qn.hasOwnProperty(r.id)){for(i=[],n=0;n<$n.length;n++)i.push([$n[n].inputs.get(r.id),$n[n]]);for(qn[r.id].disconnect(),n=0;n<i.length;n++)Wn(i[n][0],i[n][1])}for(e=0;e<t.outputs.removed.length;e++)if(r=t.outputs.removed[e],Bn.hasOwnProperty(r.id)){for(i=[],n=0;n<$n.length;n++)i.push([$n[n].outputs.get(r.id),$n[n]]);for(Bn[r.id].disconnect(),n=0;n<i.length;n++)Wn(i[n][0],i[n][1])}}function or(t){var e,n,r={},i={},o=null,s=this;this.sysexEnabled=t,this.inputs=new nr(s,r),this.outputs=new rr(s,i),Object.defineProperty(this,"onstatechange",{get:function(){return o},set:function(t){o=f(t)?t:null},enumerable:!0}),Object.freeze(this);var a=C._info;for(e=0;e<a.inputs.length;e++)n=a.inputs[e],qn.hasOwnProperty(n.id)||(qn[n.id]=new Xn(n.id,n.name,n.manufacturer,n.version));for(e=0;e<a.outputs.length;e++)n=a.outputs[e],Bn.hasOwnProperty(n.id)||(Bn[n.id]=new tr(n.id,n.name,n.manufacturer,n.version));$n.length||At().onChange(ir),$n.push(this)}return tr.prototype.open=function(){var t=this;return new Un(function(e,n){var r;t.proxy||!t.connected?e():(t.pending.push([e,n]),1==t.pending.length&&At().openMidiOut(t.name).or(function(){for(r=0;r<t.pending.length;r++)t.pending[r][1]();t.pending=[]}).and(function(){for(t.proxy=this,r=0;r<t.pending.length;r++)t.pending[r][0]();t.pending=[]}))})},tr.prototype.close=function(){var t;if(this.proxy){for(t=0;t<this.ports.length;t++)if("open"==this.ports[t].connection)return;this.proxy.close(),this.proxy=void 0}},tr.prototype.disconnect=function(){this.connected=!1,this.proxy&&(this.proxy.close(),this.proxy=void 0)},tr.prototype.reconnect=function(){var t,e,n=this,r=[];for(this.connected=!0,t=0;t<$n.length;t++)"closed"==(e=$n[t].outputs.get(this.id)).connection?Wn(e,$n[t]):r.push([e,$n[t]]);r.length&&At()._openMidiOutNR(n.name).or(function(){for(t=0;t<r.length;t++)r[t][0].close()}).and(function(){for(n.proxy=this,t=0;t<r.length;t++)Wn(r[t][0],r[t][1])})},nr.prototype=new er(qn),nr.prototype.constructor=nr,rr.prototype=new er(Bn),rr.prototype.constructor=rr,At.requestMIDIAccess=function(t){return new Un(function(e,n){At.JZZ(t).or(function(){}).and(function(){var r=!(!t||!t.sysex);if(r&&!this.info().sysex)n(new Vn("SecurityError","Sysex is not allowed",18));else{var i=new or(r);e(i)}})})},"undefined"==typeof navigator||navigator.requestMIDIAccess||(navigator.requestMIDIAccess=At.requestMIDIAccess),At.close=function(){at._close&&at._close()},At}()},2543(t,e,n){var r;t=n.nmd(t),function(){var i,o="Expected a function",s="__lodash_hash_undefined__",a="__lodash_placeholder__",u=16,c=32,l=64,h=128,d=256,p=1/0,f=9007199254740991,m=NaN,g=4294967295,_=[["ary",h],["bind",1],["bindKey",2],["curry",8],["curryRight",u],["flip",512],["partial",c],["partialRight",l],["rearg",d]],y="[object Arguments]",v="[object Array]",b="[object Boolean]",w="[object Date]",x="[object Error]",T="[object Function]",k="[object GeneratorFunction]",S="[object Map]",A="[object Number]",E="[object Object]",O="[object Promise]",C="[object RegExp]",M="[object Set]",N="[object String]",I="[object Symbol]",j="[object WeakMap]",R="[object ArrayBuffer]",P="[object DataView]",D="[object Float32Array]",L="[object Float64Array]",F="[object Int8Array]",$="[object Int16Array]",B="[object Int32Array]",q="[object Uint8Array]",U="[object Uint8ClampedArray]",V="[object Uint16Array]",G="[object Uint32Array]",z=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,J=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,X=/[&<>"']/g,K=RegExp(H.source),Q=RegExp(X.source),Z=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,tt=/<%=([\s\S]+?)%>/g,et=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nt=/^\w*$/,rt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/[\\^$.*+?()[\]{}|]/g,ot=RegExp(it.source),st=/^\s+/,at=/\s/,ut=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ct=/\{\n\/\* \[wrapped with (.+)\] \*/,lt=/,? & /,ht=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,dt=/[()=,{}\[\]\/\s]/,pt=/\\(\\)?/g,ft=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,mt=/\w*$/,gt=/^[-+]0x[0-9a-f]+$/i,_t=/^0b[01]+$/i,yt=/^\[object .+?Constructor\]$/,vt=/^0o[0-7]+$/i,bt=/^(?:0|[1-9]\d*)$/,wt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,xt=/($^)/,Tt=/['\n\r\u2028\u2029\\]/g,kt="\\ud800-\\udfff",St="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",At="\\u2700-\\u27bf",Et="a-z\\xdf-\\xf6\\xf8-\\xff",Ot="A-Z\\xc0-\\xd6\\xd8-\\xde",Ct="\\ufe0e\\ufe0f",Mt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Nt="['’]",It="["+kt+"]",jt="["+Mt+"]",Rt="["+St+"]",Pt="\\d+",Dt="["+At+"]",Lt="["+Et+"]",Ft="[^"+kt+Mt+Pt+At+Et+Ot+"]",$t="\\ud83c[\\udffb-\\udfff]",Bt="[^"+kt+"]",qt="(?:\\ud83c[\\udde6-\\uddff]){2}",Ut="[\\ud800-\\udbff][\\udc00-\\udfff]",Vt="["+Ot+"]",Gt="\\u200d",zt="(?:"+Lt+"|"+Ft+")",Wt="(?:"+Vt+"|"+Ft+")",Jt="(?:['’](?:d|ll|m|re|s|t|ve))?",Ht="(?:['’](?:D|LL|M|RE|S|T|VE))?",Xt="(?:"+Rt+"|"+$t+")"+"?",Kt="["+Ct+"]?",Qt=Kt+Xt+("(?:"+Gt+"(?:"+[Bt,qt,Ut].join("|")+")"+Kt+Xt+")*"),Zt="(?:"+[Dt,qt,Ut].join("|")+")"+Qt,Yt="(?:"+[Bt+Rt+"?",Rt,qt,Ut,It].join("|")+")",te=RegExp(Nt,"g"),ee=RegExp(Rt,"g"),ne=RegExp($t+"(?="+$t+")|"+Yt+Qt,"g"),re=RegExp([Vt+"?"+Lt+"+"+Jt+"(?="+[jt,Vt,"$"].join("|")+")",Wt+"+"+Ht+"(?="+[jt,Vt+zt,"$"].join("|")+")",Vt+"?"+zt+"+"+Jt,Vt+"+"+Ht,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Pt,Zt].join("|"),"g"),ie=RegExp("["+Gt+kt+St+Ct+"]"),oe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,se=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ae=-1,ue={};ue[D]=ue[L]=ue[F]=ue[$]=ue[B]=ue[q]=ue[U]=ue[V]=ue[G]=!0,ue[y]=ue[v]=ue[R]=ue[b]=ue[P]=ue[w]=ue[x]=ue[T]=ue[S]=ue[A]=ue[E]=ue[C]=ue[M]=ue[N]=ue[j]=!1;var ce={};ce[y]=ce[v]=ce[R]=ce[P]=ce[b]=ce[w]=ce[D]=ce[L]=ce[F]=ce[$]=ce[B]=ce[S]=ce[A]=ce[E]=ce[C]=ce[M]=ce[N]=ce[I]=ce[q]=ce[U]=ce[V]=ce[G]=!0,ce[x]=ce[T]=ce[j]=!1;var le={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},he=parseFloat,de=parseInt,pe="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,fe="object"==typeof self&&self&&self.Object===Object&&self,me=pe||fe||Function("return this")(),ge=e&&!e.nodeType&&e,_e=ge&&t&&!t.nodeType&&t,ye=_e&&_e.exports===ge,ve=ye&&pe.process,be=function(){try{var t=_e&&_e.require&&_e.require("util").types;return t||ve&&ve.binding&&ve.binding("util")}catch(t){}}(),we=be&&be.isArrayBuffer,xe=be&&be.isDate,Te=be&&be.isMap,ke=be&&be.isRegExp,Se=be&&be.isSet,Ae=be&&be.isTypedArray;function Ee(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Oe(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var s=t[i];e(r,s,n(s),t)}return r}function Ce(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Me(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Ne(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Ie(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var s=t[n];e(s,n,t)&&(o[i++]=s)}return o}function je(t,e){return!!(null==t?0:t.length)&&Ve(t,e,0)>-1}function Re(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function Pe(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function De(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function Le(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function Fe(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function $e(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Be=Je("length");function qe(t,e,n){var r;return n(t,function(t,n,i){if(e(t,n,i))return r=n,!1}),r}function Ue(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function Ve(t,e,n){return e==e?function(t,e,n){var r=n-1,i=t.length;for(;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):Ue(t,ze,n)}function Ge(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function ze(t){return t!=t}function We(t,e){var n=null==t?0:t.length;return n?Ke(t,e)/n:m}function Je(t){return function(e){return null==e?i:e[t]}}function He(t){return function(e){return null==t?i:t[e]}}function Xe(t,e,n,r,i){return i(t,function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)}),n}function Ke(t,e){for(var n,r=-1,o=t.length;++r<o;){var s=e(t[r]);s!==i&&(n=n===i?s:n+s)}return n}function Qe(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ze(t){return t?t.slice(0,gn(t)+1).replace(st,""):t}function Ye(t){return function(e){return t(e)}}function tn(t,e){return Pe(e,function(e){return t[e]})}function en(t,e){return t.has(e)}function nn(t,e){for(var n=-1,r=t.length;++n<r&&Ve(e,t[n],0)>-1;);return n}function rn(t,e){for(var n=t.length;n--&&Ve(e,t[n],0)>-1;);return n}var on=He({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),sn=He({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function an(t){return"\\"+le[t]}function un(t){return ie.test(t)}function cn(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function ln(t,e){return function(n){return t(e(n))}}function hn(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n];s!==e&&s!==a||(t[n]=a,o[i++]=n)}return o}function dn(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function pn(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=[t,t]}),n}function fn(t){return un(t)?function(t){var e=ne.lastIndex=0;for(;ne.test(t);)++e;return e}(t):Be(t)}function mn(t){return un(t)?function(t){return t.match(ne)||[]}(t):function(t){return t.split("")}(t)}function gn(t){for(var e=t.length;e--&&at.test(t.charAt(e)););return e}var _n=He({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var yn=function t(e){var n,r=(e=null==e?me:yn.defaults(me.Object(),e,yn.pick(me,se))).Array,at=e.Date,kt=e.Error,St=e.Function,At=e.Math,Et=e.Object,Ot=e.RegExp,Ct=e.String,Mt=e.TypeError,Nt=r.prototype,It=St.prototype,jt=Et.prototype,Rt=e["__core-js_shared__"],Pt=It.toString,Dt=jt.hasOwnProperty,Lt=0,Ft=(n=/[^.]+$/.exec(Rt&&Rt.keys&&Rt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",$t=jt.toString,Bt=Pt.call(Et),qt=me._,Ut=Ot("^"+Pt.call(Dt).replace(it,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Vt=ye?e.Buffer:i,Gt=e.Symbol,zt=e.Uint8Array,Wt=Vt?Vt.allocUnsafe:i,Jt=ln(Et.getPrototypeOf,Et),Ht=Et.create,Xt=jt.propertyIsEnumerable,Kt=Nt.splice,Qt=Gt?Gt.isConcatSpreadable:i,Zt=Gt?Gt.iterator:i,Yt=Gt?Gt.toStringTag:i,ne=function(){try{var t=po(Et,"defineProperty");return t({},"",{}),t}catch(t){}}(),ie=e.clearTimeout!==me.clearTimeout&&e.clearTimeout,le=at&&at.now!==me.Date.now&&at.now,pe=e.setTimeout!==me.setTimeout&&e.setTimeout,fe=At.ceil,ge=At.floor,_e=Et.getOwnPropertySymbols,ve=Vt?Vt.isBuffer:i,be=e.isFinite,Be=Nt.join,He=ln(Et.keys,Et),vn=At.max,bn=At.min,wn=at.now,xn=e.parseInt,Tn=At.random,kn=Nt.reverse,Sn=po(e,"DataView"),An=po(e,"Map"),En=po(e,"Promise"),On=po(e,"Set"),Cn=po(e,"WeakMap"),Mn=po(Et,"create"),Nn=Cn&&new Cn,In={},jn=$o(Sn),Rn=$o(An),Pn=$o(En),Dn=$o(On),Ln=$o(Cn),Fn=Gt?Gt.prototype:i,$n=Fn?Fn.valueOf:i,Bn=Fn?Fn.toString:i;function qn(t){if(na(t)&&!zs(t)&&!(t instanceof zn)){if(t instanceof Gn)return t;if(Dt.call(t,"__wrapped__"))return Bo(t)}return new Gn(t)}var Un=function(){function t(){}return function(e){if(!ea(e))return{};if(Ht)return Ht(e);t.prototype=e;var n=new t;return t.prototype=i,n}}();function Vn(){}function Gn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=i}function zn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=g,this.__views__=[]}function Wn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Jn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Hn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Xn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Hn;++e<n;)this.add(t[e])}function Kn(t){var e=this.__data__=new Jn(t);this.size=e.size}function Qn(t,e){var n=zs(t),r=!n&&Gs(t),i=!n&&!r&&Xs(t),o=!n&&!r&&!i&&la(t),s=n||r||i||o,a=s?Qe(t.length,Ct):[],u=a.length;for(var c in t)!e&&!Dt.call(t,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||bo(c,u))||a.push(c);return a}function Zn(t){var e=t.length;return e?t[Xr(0,e-1)]:i}function Yn(t,e){return Do(Mi(t),ur(e,0,t.length))}function tr(t){return Do(Mi(t))}function er(t,e,n){(n!==i&&!qs(t[e],n)||n===i&&!(e in t))&&sr(t,e,n)}function nr(t,e,n){var r=t[e];Dt.call(t,e)&&qs(r,n)&&(n!==i||e in t)||sr(t,e,n)}function rr(t,e){for(var n=t.length;n--;)if(qs(t[n][0],e))return n;return-1}function ir(t,e,n,r){return pr(t,function(t,i,o){e(r,t,n(t),o)}),r}function or(t,e){return t&&Ni(e,Ia(e),t)}function sr(t,e,n){"__proto__"==e&&ne?ne(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function ar(t,e){for(var n=-1,o=e.length,s=r(o),a=null==t;++n<o;)s[n]=a?i:Ea(t,e[n]);return s}function ur(t,e,n){return t==t&&(n!==i&&(t=t<=n?t:n),e!==i&&(t=t>=e?t:e)),t}function cr(t,e,n,r,o,s){var a,u=1&e,c=2&e,l=4&e;if(n&&(a=o?n(t,r,o,s):n(t)),a!==i)return a;if(!ea(t))return t;var h=zs(t);if(h){if(a=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&Dt.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!u)return Mi(t,a)}else{var d=go(t),p=d==T||d==k;if(Xs(t))return ki(t,u);if(d==E||d==y||p&&!o){if(a=c||p?{}:yo(t),!u)return c?function(t,e){return Ni(t,mo(t),e)}(t,function(t,e){return t&&Ni(e,ja(e),t)}(a,t)):function(t,e){return Ni(t,fo(t),e)}(t,or(a,t))}else{if(!ce[d])return o?t:{};a=function(t,e,n){var r=t.constructor;switch(e){case R:return Si(t);case b:case w:return new r(+t);case P:return function(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case D:case L:case F:case $:case B:case q:case U:case V:case G:return Ai(t,n);case S:return new r;case A:case N:return new r(t);case C:return function(t){var e=new t.constructor(t.source,mt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case M:return new r;case I:return i=t,$n?Et($n.call(i)):{}}var i}(t,d,u)}}s||(s=new Kn);var f=s.get(t);if(f)return f;s.set(t,a),aa(t)?t.forEach(function(r){a.add(cr(r,e,n,r,t,s))}):ra(t)&&t.forEach(function(r,i){a.set(i,cr(r,e,n,i,t,s))});var m=h?i:(l?c?oo:io:c?ja:Ia)(t);return Ce(m||t,function(r,i){m&&(r=t[i=r]),nr(a,i,cr(r,e,n,i,t,s))}),a}function lr(t,e,n){var r=n.length;if(null==t)return!r;for(t=Et(t);r--;){var o=n[r],s=e[o],a=t[o];if(a===i&&!(o in t)||!s(a))return!1}return!0}function hr(t,e,n){if("function"!=typeof t)throw new Mt(o);return Io(function(){t.apply(i,n)},e)}function dr(t,e,n,r){var i=-1,o=je,s=!0,a=t.length,u=[],c=e.length;if(!a)return u;n&&(e=Pe(e,Ye(n))),r?(o=Re,s=!1):e.length>=200&&(o=en,s=!1,e=new Xn(e));t:for(;++i<a;){var l=t[i],h=null==n?l:n(l);if(l=r||0!==l?l:0,s&&h==h){for(var d=c;d--;)if(e[d]===h)continue t;u.push(l)}else o(e,h,r)||u.push(l)}return u}qn.templateSettings={escape:Z,evaluate:Y,interpolate:tt,variable:"",imports:{_:qn}},qn.prototype=Vn.prototype,qn.prototype.constructor=qn,Gn.prototype=Un(Vn.prototype),Gn.prototype.constructor=Gn,zn.prototype=Un(Vn.prototype),zn.prototype.constructor=zn,Wn.prototype.clear=function(){this.__data__=Mn?Mn(null):{},this.size=0},Wn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Wn.prototype.get=function(t){var e=this.__data__;if(Mn){var n=e[t];return n===s?i:n}return Dt.call(e,t)?e[t]:i},Wn.prototype.has=function(t){var e=this.__data__;return Mn?e[t]!==i:Dt.call(e,t)},Wn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Mn&&e===i?s:e,this},Jn.prototype.clear=function(){this.__data__=[],this.size=0},Jn.prototype.delete=function(t){var e=this.__data__,n=rr(e,t);return!(n<0)&&(n==e.length-1?e.pop():Kt.call(e,n,1),--this.size,!0)},Jn.prototype.get=function(t){var e=this.__data__,n=rr(e,t);return n<0?i:e[n][1]},Jn.prototype.has=function(t){return rr(this.__data__,t)>-1},Jn.prototype.set=function(t,e){var n=this.__data__,r=rr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(An||Jn),string:new Wn}},Hn.prototype.delete=function(t){var e=lo(this,t).delete(t);return this.size-=e?1:0,e},Hn.prototype.get=function(t){return lo(this,t).get(t)},Hn.prototype.has=function(t){return lo(this,t).has(t)},Hn.prototype.set=function(t,e){var n=lo(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Xn.prototype.add=Xn.prototype.push=function(t){return this.__data__.set(t,s),this},Xn.prototype.has=function(t){return this.__data__.has(t)},Kn.prototype.clear=function(){this.__data__=new Jn,this.size=0},Kn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Kn.prototype.get=function(t){return this.__data__.get(t)},Kn.prototype.has=function(t){return this.__data__.has(t)},Kn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Jn){var r=n.__data__;if(!An||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(t,e),this.size=n.size,this};var pr=Ri(wr),fr=Ri(xr,!0);function mr(t,e){var n=!0;return pr(t,function(t,r,i){return n=!!e(t,r,i)}),n}function gr(t,e,n){for(var r=-1,o=t.length;++r<o;){var s=t[r],a=e(s);if(null!=a&&(u===i?a==a&&!ca(a):n(a,u)))var u=a,c=s}return c}function _r(t,e){var n=[];return pr(t,function(t,r,i){e(t,r,i)&&n.push(t)}),n}function yr(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=vo),i||(i=[]);++o<s;){var a=t[o];e>0&&n(a)?e>1?yr(a,e-1,n,r,i):De(i,a):r||(i[i.length]=a)}return i}var vr=Pi(),br=Pi(!0);function wr(t,e){return t&&vr(t,e,Ia)}function xr(t,e){return t&&br(t,e,Ia)}function Tr(t,e){return Ie(e,function(e){return Zs(t[e])})}function kr(t,e){for(var n=0,r=(e=bi(e,t)).length;null!=t&&n<r;)t=t[Fo(e[n++])];return n&&n==r?t:i}function Sr(t,e,n){var r=e(t);return zs(t)?r:De(r,n(t))}function Ar(t){return null==t?t===i?"[object Undefined]":"[object Null]":Yt&&Yt in Et(t)?function(t){var e=Dt.call(t,Yt),n=t[Yt];try{t[Yt]=i;var r=!0}catch(t){}var o=$t.call(t);r&&(e?t[Yt]=n:delete t[Yt]);return o}(t):function(t){return $t.call(t)}(t)}function Er(t,e){return t>e}function Or(t,e){return null!=t&&Dt.call(t,e)}function Cr(t,e){return null!=t&&e in Et(t)}function Mr(t,e,n){for(var o=n?Re:je,s=t[0].length,a=t.length,u=a,c=r(a),l=1/0,h=[];u--;){var d=t[u];u&&e&&(d=Pe(d,Ye(e))),l=bn(d.length,l),c[u]=!n&&(e||s>=120&&d.length>=120)?new Xn(u&&d):i}d=t[0];var p=-1,f=c[0];t:for(;++p<s&&h.length<l;){var m=d[p],g=e?e(m):m;if(m=n||0!==m?m:0,!(f?en(f,g):o(h,g,n))){for(u=a;--u;){var _=c[u];if(!(_?en(_,g):o(t[u],g,n)))continue t}f&&f.push(g),h.push(m)}}return h}function Nr(t,e,n){var r=null==(t=Co(t,e=bi(e,t)))?t:t[Fo(Qo(e))];return null==r?i:Ee(r,t,n)}function Ir(t){return na(t)&&Ar(t)==y}function jr(t,e,n,r,o){return t===e||(null==t||null==e||!na(t)&&!na(e)?t!=t&&e!=e:function(t,e,n,r,o,s){var a=zs(t),u=zs(e),c=a?v:go(t),l=u?v:go(e),h=(c=c==y?E:c)==E,d=(l=l==y?E:l)==E,p=c==l;if(p&&Xs(t)){if(!Xs(e))return!1;a=!0,h=!1}if(p&&!h)return s||(s=new Kn),a||la(t)?no(t,e,n,r,o,s):function(t,e,n,r,i,o,s){switch(n){case P:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case R:return!(t.byteLength!=e.byteLength||!o(new zt(t),new zt(e)));case b:case w:case A:return qs(+t,+e);case x:return t.name==e.name&&t.message==e.message;case C:case N:return t==e+"";case S:var a=cn;case M:var u=1&r;if(a||(a=dn),t.size!=e.size&&!u)return!1;var c=s.get(t);if(c)return c==e;r|=2,s.set(t,e);var l=no(a(t),a(e),r,i,o,s);return s.delete(t),l;case I:if($n)return $n.call(t)==$n.call(e)}return!1}(t,e,c,n,r,o,s);if(!(1&n)){var f=h&&Dt.call(t,"__wrapped__"),m=d&&Dt.call(e,"__wrapped__");if(f||m){var g=f?t.value():t,_=m?e.value():e;return s||(s=new Kn),o(g,_,n,r,s)}}if(!p)return!1;return s||(s=new Kn),function(t,e,n,r,o,s){var a=1&n,u=io(t),c=u.length,l=io(e),h=l.length;if(c!=h&&!a)return!1;var d=c;for(;d--;){var p=u[d];if(!(a?p in e:Dt.call(e,p)))return!1}var f=s.get(t),m=s.get(e);if(f&&m)return f==e&&m==t;var g=!0;s.set(t,e),s.set(e,t);var _=a;for(;++d<c;){var y=t[p=u[d]],v=e[p];if(r)var b=a?r(v,y,p,e,t,s):r(y,v,p,t,e,s);if(!(b===i?y===v||o(y,v,n,r,s):b)){g=!1;break}_||(_="constructor"==p)}if(g&&!_){var w=t.constructor,x=e.constructor;w==x||!("constructor"in t)||!("constructor"in e)||"function"==typeof w&&w instanceof w&&"function"==typeof x&&x instanceof x||(g=!1)}return s.delete(t),s.delete(e),g}(t,e,n,r,o,s)}(t,e,n,r,jr,o))}function Rr(t,e,n,r){var o=n.length,s=o,a=!r;if(null==t)return!s;for(t=Et(t);o--;){var u=n[o];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<s;){var c=(u=n[o])[0],l=t[c],h=u[1];if(a&&u[2]){if(l===i&&!(c in t))return!1}else{var d=new Kn;if(r)var p=r(l,h,c,t,e,d);if(!(p===i?jr(h,l,3,r,d):p))return!1}}return!0}function Pr(t){return!(!ea(t)||(e=t,Ft&&Ft in e))&&(Zs(t)?Ut:yt).test($o(t));var e}function Dr(t){return"function"==typeof t?t:null==t?iu:"object"==typeof t?zs(t)?Ur(t[0],t[1]):qr(t):pu(t)}function Lr(t){if(!So(t))return He(t);var e=[];for(var n in Et(t))Dt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Fr(t){if(!ea(t))return function(t){var e=[];if(null!=t)for(var n in Et(t))e.push(n);return e}(t);var e=So(t),n=[];for(var r in t)("constructor"!=r||!e&&Dt.call(t,r))&&n.push(r);return n}function $r(t,e){return t<e}function Br(t,e){var n=-1,i=Js(t)?r(t.length):[];return pr(t,function(t,r,o){i[++n]=e(t,r,o)}),i}function qr(t){var e=ho(t);return 1==e.length&&e[0][2]?Eo(e[0][0],e[0][1]):function(n){return n===t||Rr(n,t,e)}}function Ur(t,e){return xo(t)&&Ao(e)?Eo(Fo(t),e):function(n){var r=Ea(n,t);return r===i&&r===e?Oa(n,t):jr(e,r,3)}}function Vr(t,e,n,r,o){t!==e&&vr(e,function(s,a){if(o||(o=new Kn),ea(s))!function(t,e,n,r,o,s,a){var u=Mo(t,n),c=Mo(e,n),l=a.get(c);if(l)return void er(t,n,l);var h=s?s(u,c,n+"",t,e,a):i,d=h===i;if(d){var p=zs(c),f=!p&&Xs(c),m=!p&&!f&&la(c);h=c,p||f||m?zs(u)?h=u:Hs(u)?h=Mi(u):f?(d=!1,h=ki(c,!0)):m?(d=!1,h=Ai(c,!0)):h=[]:oa(c)||Gs(c)?(h=u,Gs(u)?h=ya(u):ea(u)&&!Zs(u)||(h=yo(c))):d=!1}d&&(a.set(c,h),o(h,c,r,s,a),a.delete(c));er(t,n,h)}(t,e,a,n,Vr,r,o);else{var u=r?r(Mo(t,a),s,a+"",t,e,o):i;u===i&&(u=s),er(t,a,u)}},ja)}function Gr(t,e){var n=t.length;if(n)return bo(e+=e<0?n:0,n)?t[e]:i}function zr(t,e,n){e=e.length?Pe(e,function(t){return zs(t)?function(e){return kr(e,1===t.length?t[0]:t)}:t}):[iu];var r=-1;e=Pe(e,Ye(co()));var i=Br(t,function(t,n,i){var o=Pe(e,function(e){return e(t)});return{criteria:o,index:++r,value:t}});return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(i,function(t,e){return function(t,e,n){var r=-1,i=t.criteria,o=e.criteria,s=i.length,a=n.length;for(;++r<s;){var u=Ei(i[r],o[r]);if(u)return r>=a?u:u*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)})}function Wr(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var s=e[r],a=kr(t,s);n(a,s)&&ti(o,bi(s,t),a)}return o}function Jr(t,e,n,r){var i=r?Ge:Ve,o=-1,s=e.length,a=t;for(t===e&&(e=Mi(e)),n&&(a=Pe(t,Ye(n)));++o<s;)for(var u=0,c=e[o],l=n?n(c):c;(u=i(a,l,u,r))>-1;)a!==t&&Kt.call(a,u,1),Kt.call(t,u,1);return t}function Hr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;bo(i)?Kt.call(t,i,1):di(t,i)}}return t}function Xr(t,e){return t+ge(Tn()*(e-t+1))}function Kr(t,e){var n="";if(!t||e<1||e>f)return n;do{e%2&&(n+=t),(e=ge(e/2))&&(t+=t)}while(e);return n}function Qr(t,e){return jo(Oo(t,e,iu),t+"")}function Zr(t){return Zn(qa(t))}function Yr(t,e){var n=qa(t);return Do(n,ur(e,0,n.length))}function ti(t,e,n,r){if(!ea(t))return t;for(var o=-1,s=(e=bi(e,t)).length,a=s-1,u=t;null!=u&&++o<s;){var c=Fo(e[o]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(o!=a){var h=u[c];(l=r?r(h,c,u):i)===i&&(l=ea(h)?h:bo(e[o+1])?[]:{})}nr(u,c,l),u=u[c]}return t}var ei=Nn?function(t,e){return Nn.set(t,e),t}:iu,ni=ne?function(t,e){return ne(t,"toString",{configurable:!0,enumerable:!1,value:eu(e),writable:!0})}:iu;function ri(t){return Do(qa(t))}function ii(t,e,n){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var s=r(o);++i<o;)s[i]=t[i+e];return s}function oi(t,e){var n;return pr(t,function(t,r,i){return!(n=e(t,r,i))}),!!n}function si(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,s=t[o];null!==s&&!ca(s)&&(n?s<=e:s<e)?r=o+1:i=o}return i}return ai(t,e,iu,n)}function ai(t,e,n,r){var o=0,s=null==t?0:t.length;if(0===s)return 0;for(var a=(e=n(e))!=e,u=null===e,c=ca(e),l=e===i;o<s;){var h=ge((o+s)/2),d=n(t[h]),p=d!==i,f=null===d,m=d==d,g=ca(d);if(a)var _=r||m;else _=l?m&&(r||p):u?m&&p&&(r||!f):c?m&&p&&!f&&(r||!g):!f&&!g&&(r?d<=e:d<e);_?o=h+1:s=h}return bn(s,4294967294)}function ui(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n],a=e?e(s):s;if(!n||!qs(a,u)){var u=a;o[i++]=0===s?0:s}}return o}function ci(t){return"number"==typeof t?t:ca(t)?m:+t}function li(t){if("string"==typeof t)return t;if(zs(t))return Pe(t,li)+"";if(ca(t))return Bn?Bn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function hi(t,e,n){var r=-1,i=je,o=t.length,s=!0,a=[],u=a;if(n)s=!1,i=Re;else if(o>=200){var c=e?null:Ki(t);if(c)return dn(c);s=!1,i=en,u=new Xn}else u=e?[]:a;t:for(;++r<o;){var l=t[r],h=e?e(l):l;if(l=n||0!==l?l:0,s&&h==h){for(var d=u.length;d--;)if(u[d]===h)continue t;e&&u.push(h),a.push(l)}else i(u,h,n)||(u!==a&&u.push(h),a.push(l))}return a}function di(t,e){var n=-1,r=(e=bi(e,t)).length;if(!r)return!0;for(var i=null==t||"object"!=typeof t&&"function"!=typeof t;++n<r;){var o=e[n];if("string"==typeof o){if("__proto__"===o&&!Dt.call(t,"__proto__"))return!1;if("constructor"===o&&n+1<r&&"string"==typeof e[n+1]&&"prototype"===e[n+1]){if(i&&0===n)continue;return!1}}}var s=Co(t,e);return null==s||delete s[Fo(Qo(e))]}function pi(t,e,n,r){return ti(t,e,n(kr(t,e)),r)}function fi(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?ii(t,r?0:o,r?o+1:i):ii(t,r?o+1:0,r?i:o)}function mi(t,e){var n=t;return n instanceof zn&&(n=n.value()),Le(e,function(t,e){return e.func.apply(e.thisArg,De([t],e.args))},n)}function gi(t,e,n){var i=t.length;if(i<2)return i?hi(t[0]):[];for(var o=-1,s=r(i);++o<i;)for(var a=t[o],u=-1;++u<i;)u!=o&&(s[o]=dr(s[o]||a,t[u],e,n));return hi(yr(s,1),e,n)}function _i(t,e,n){for(var r=-1,o=t.length,s=e.length,a={};++r<o;){var u=r<s?e[r]:i;n(a,t[r],u)}return a}function yi(t){return Hs(t)?t:[]}function vi(t){return"function"==typeof t?t:iu}function bi(t,e){return zs(t)?t:xo(t,e)?[t]:Lo(va(t))}var wi=Qr;function xi(t,e,n){var r=t.length;return n=n===i?r:n,!e&&n>=r?t:ii(t,e,n)}var Ti=ie||function(t){return me.clearTimeout(t)};function ki(t,e){if(e)return t.slice();var n=t.length,r=Wt?Wt(n):new t.constructor(n);return t.copy(r),r}function Si(t){var e=new t.constructor(t.byteLength);return new zt(e).set(new zt(t)),e}function Ai(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ei(t,e){if(t!==e){var n=t!==i,r=null===t,o=t==t,s=ca(t),a=e!==i,u=null===e,c=e==e,l=ca(e);if(!u&&!l&&!s&&t>e||s&&a&&c&&!u&&!l||r&&a&&c||!n&&c||!o)return 1;if(!r&&!s&&!l&&t<e||l&&n&&o&&!r&&!s||u&&n&&o||!a&&o||!c)return-1}return 0}function Oi(t,e,n,i){for(var o=-1,s=t.length,a=n.length,u=-1,c=e.length,l=vn(s-a,0),h=r(c+l),d=!i;++u<c;)h[u]=e[u];for(;++o<a;)(d||o<s)&&(h[n[o]]=t[o]);for(;l--;)h[u++]=t[o++];return h}function Ci(t,e,n,i){for(var o=-1,s=t.length,a=-1,u=n.length,c=-1,l=e.length,h=vn(s-u,0),d=r(h+l),p=!i;++o<h;)d[o]=t[o];for(var f=o;++c<l;)d[f+c]=e[c];for(;++a<u;)(p||o<s)&&(d[f+n[a]]=t[o++]);return d}function Mi(t,e){var n=-1,i=t.length;for(e||(e=r(i));++n<i;)e[n]=t[n];return e}function Ni(t,e,n,r){var o=!n;n||(n={});for(var s=-1,a=e.length;++s<a;){var u=e[s],c=r?r(n[u],t[u],u,n,t):i;c===i&&(c=t[u]),o?sr(n,u,c):nr(n,u,c)}return n}function Ii(t,e){return function(n,r){var i=zs(n)?Oe:ir,o=e?e():{};return i(n,t,co(r,2),o)}}function ji(t){return Qr(function(e,n){var r=-1,o=n.length,s=o>1?n[o-1]:i,a=o>2?n[2]:i;for(s=t.length>3&&"function"==typeof s?(o--,s):i,a&&wo(n[0],n[1],a)&&(s=o<3?i:s,o=1),e=Et(e);++r<o;){var u=n[r];u&&t(e,u,r,s)}return e})}function Ri(t,e){return function(n,r){if(null==n)return n;if(!Js(n))return t(n,r);for(var i=n.length,o=e?i:-1,s=Et(n);(e?o--:++o<i)&&!1!==r(s[o],o,s););return n}}function Pi(t){return function(e,n,r){for(var i=-1,o=Et(e),s=r(e),a=s.length;a--;){var u=s[t?a:++i];if(!1===n(o[u],u,o))break}return e}}function Di(t){return function(e){var n=un(e=va(e))?mn(e):i,r=n?n[0]:e.charAt(0),o=n?xi(n,1).join(""):e.slice(1);return r[t]()+o}}function Li(t){return function(e){return Le(Za(Ga(e).replace(te,"")),t,"")}}function Fi(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Un(t.prototype),r=t.apply(n,e);return ea(r)?r:n}}function $i(t){return function(e,n,r){var o=Et(e);if(!Js(e)){var s=co(n,3);e=Ia(e),n=function(t){return s(o[t],t,o)}}var a=t(e,n,r);return a>-1?o[s?e[a]:a]:i}}function Bi(t){return ro(function(e){var n=e.length,r=n,s=Gn.prototype.thru;for(t&&e.reverse();r--;){var a=e[r];if("function"!=typeof a)throw new Mt(o);if(s&&!u&&"wrapper"==ao(a))var u=new Gn([],!0)}for(r=u?r:n;++r<n;){var c=ao(a=e[r]),l="wrapper"==c?so(a):i;u=l&&To(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?u[ao(l[0])].apply(u,l[3]):1==a.length&&To(a)?u[c]():u.thru(a)}return function(){var t=arguments,r=t[0];if(u&&1==t.length&&zs(r))return u.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}})}function qi(t,e,n,o,s,a,u,c,l,d){var p=e&h,f=1&e,m=2&e,g=24&e,_=512&e,y=m?i:Fi(t);return function h(){for(var v=arguments.length,b=r(v),w=v;w--;)b[w]=arguments[w];if(g)var x=uo(h),T=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(b,x);if(o&&(b=Oi(b,o,s,g)),a&&(b=Ci(b,a,u,g)),v-=T,g&&v<d){var k=hn(b,x);return Hi(t,e,qi,h.placeholder,n,b,k,c,l,d-v)}var S=f?n:this,A=m?S[t]:t;return v=b.length,c?b=function(t,e){var n=t.length,r=bn(e.length,n),o=Mi(t);for(;r--;){var s=e[r];t[r]=bo(s,n)?o[s]:i}return t}(b,c):_&&v>1&&b.reverse(),p&&l<v&&(b.length=l),this&&this!==me&&this instanceof h&&(A=y||Fi(A)),A.apply(S,b)}}function Ui(t,e){return function(n,r){return function(t,e,n,r){return wr(t,function(t,i,o){e(r,n(t),i,o)}),r}(n,t,e(r),{})}}function Vi(t,e){return function(n,r){var o;if(n===i&&r===i)return e;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=li(n),r=li(r)):(n=ci(n),r=ci(r)),o=t(n,r)}return o}}function Gi(t){return ro(function(e){return e=Pe(e,Ye(co())),Qr(function(n){var r=this;return t(e,function(t){return Ee(t,r,n)})})})}function zi(t,e){var n=(e=e===i?" ":li(e)).length;if(n<2)return n?Kr(e,t):e;var r=Kr(e,fe(t/fn(e)));return un(e)?xi(mn(r),0,t).join(""):r.slice(0,t)}function Wi(t){return function(e,n,o){return o&&"number"!=typeof o&&wo(e,n,o)&&(n=o=i),e=fa(e),n===i?(n=e,e=0):n=fa(n),function(t,e,n,i){for(var o=-1,s=vn(fe((e-t)/(n||1)),0),a=r(s);s--;)a[i?s:++o]=t,t+=n;return a}(e,n,o=o===i?e<n?1:-1:fa(o),t)}}function Ji(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=_a(e),n=_a(n)),t(e,n)}}function Hi(t,e,n,r,o,s,a,u,h,d){var p=8&e;e|=p?c:l,4&(e&=~(p?l:c))||(e&=-4);var f=[t,e,o,p?s:i,p?a:i,p?i:s,p?i:a,u,h,d],m=n.apply(i,f);return To(t)&&No(m,f),m.placeholder=r,Ro(m,t,e)}function Xi(t){var e=At[t];return function(t,n){if(t=_a(t),(n=null==n?0:bn(ma(n),292))&&be(t)){var r=(va(t)+"e").split("e");return+((r=(va(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Ki=On&&1/dn(new On([,-0]))[1]==p?function(t){return new On(t)}:cu;function Qi(t){return function(e){var n=go(e);return n==S?cn(e):n==M?pn(e):function(t,e){return Pe(e,function(e){return[e,t[e]]})}(e,t(e))}}function Zi(t,e,n,s,p,f,m,g){var _=2&e;if(!_&&"function"!=typeof t)throw new Mt(o);var y=s?s.length:0;if(y||(e&=-97,s=p=i),m=m===i?m:vn(ma(m),0),g=g===i?g:ma(g),y-=p?p.length:0,e&l){var v=s,b=p;s=p=i}var w=_?i:so(t),x=[t,e,n,s,p,v,b,f,m,g];if(w&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,s=r==h&&8==n||r==h&&n==d&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!s)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var u=e[3];if(u){var c=t[3];t[3]=c?Oi(c,u,e[4]):u,t[4]=c?hn(t[3],a):e[4]}(u=e[5])&&(c=t[5],t[5]=c?Ci(c,u,e[6]):u,t[6]=c?hn(t[5],a):e[6]);(u=e[7])&&(t[7]=u);r&h&&(t[8]=null==t[8]?e[8]:bn(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(x,w),t=x[0],e=x[1],n=x[2],s=x[3],p=x[4],!(g=x[9]=x[9]===i?_?0:t.length:vn(x[9]-y,0))&&24&e&&(e&=-25),e&&1!=e)T=8==e||e==u?function(t,e,n){var o=Fi(t);return function s(){for(var a=arguments.length,u=r(a),c=a,l=uo(s);c--;)u[c]=arguments[c];var h=a<3&&u[0]!==l&&u[a-1]!==l?[]:hn(u,l);return(a-=h.length)<n?Hi(t,e,qi,s.placeholder,i,u,h,i,i,n-a):Ee(this&&this!==me&&this instanceof s?o:t,this,u)}}(t,e,g):e!=c&&33!=e||p.length?qi.apply(i,x):function(t,e,n,i){var o=1&e,s=Fi(t);return function e(){for(var a=-1,u=arguments.length,c=-1,l=i.length,h=r(l+u),d=this&&this!==me&&this instanceof e?s:t;++c<l;)h[c]=i[c];for(;u--;)h[c++]=arguments[++a];return Ee(d,o?n:this,h)}}(t,e,n,s);else var T=function(t,e,n){var r=1&e,i=Fi(t);return function e(){return(this&&this!==me&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return Ro((w?ei:No)(T,x),t,e)}function Yi(t,e,n,r){return t===i||qs(t,jt[n])&&!Dt.call(r,n)?e:t}function to(t,e,n,r,o,s){return ea(t)&&ea(e)&&(s.set(e,t),Vr(t,e,i,to,s),s.delete(e)),t}function eo(t){return oa(t)?i:t}function no(t,e,n,r,o,s){var a=1&n,u=t.length,c=e.length;if(u!=c&&!(a&&c>u))return!1;var l=s.get(t),h=s.get(e);if(l&&h)return l==e&&h==t;var d=-1,p=!0,f=2&n?new Xn:i;for(s.set(t,e),s.set(e,t);++d<u;){var m=t[d],g=e[d];if(r)var _=a?r(g,m,d,e,t,s):r(m,g,d,t,e,s);if(_!==i){if(_)continue;p=!1;break}if(f){if(!$e(e,function(t,e){if(!en(f,e)&&(m===t||o(m,t,n,r,s)))return f.push(e)})){p=!1;break}}else if(m!==g&&!o(m,g,n,r,s)){p=!1;break}}return s.delete(t),s.delete(e),p}function ro(t){return jo(Oo(t,i,Wo),t+"")}function io(t){return Sr(t,Ia,fo)}function oo(t){return Sr(t,ja,mo)}var so=Nn?function(t){return Nn.get(t)}:cu;function ao(t){for(var e=t.name+"",n=In[e],r=Dt.call(In,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function uo(t){return(Dt.call(qn,"placeholder")?qn:t).placeholder}function co(){var t=qn.iteratee||ou;return t=t===ou?Dr:t,arguments.length?t(arguments[0],arguments[1]):t}function lo(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function ho(t){for(var e=Ia(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,Ao(i)]}return e}function po(t,e){var n=function(t,e){return null==t?i:t[e]}(t,e);return Pr(n)?n:i}var fo=_e?function(t){return null==t?[]:(t=Et(t),Ie(_e(t),function(e){return Xt.call(t,e)}))}:gu,mo=_e?function(t){for(var e=[];t;)De(e,fo(t)),t=Jt(t);return e}:gu,go=Ar;function _o(t,e,n){for(var r=-1,i=(e=bi(e,t)).length,o=!1;++r<i;){var s=Fo(e[r]);if(!(o=null!=t&&n(t,s)))break;t=t[s]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&ta(i)&&bo(s,i)&&(zs(t)||Gs(t))}function yo(t){return"function"!=typeof t.constructor||So(t)?{}:Un(Jt(t))}function vo(t){return zs(t)||Gs(t)||!!(Qt&&t&&t[Qt])}function bo(t,e){var n=typeof t;return!!(e=null==e?f:e)&&("number"==n||"symbol"!=n&&bt.test(t))&&t>-1&&t%1==0&&t<e}function wo(t,e,n){if(!ea(n))return!1;var r=typeof e;return!!("number"==r?Js(n)&&bo(e,n.length):"string"==r&&e in n)&&qs(n[e],t)}function xo(t,e){if(zs(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ca(t))||(nt.test(t)||!et.test(t)||null!=e&&t in Et(e))}function To(t){var e=ao(t),n=qn[e];if("function"!=typeof n||!(e in zn.prototype))return!1;if(t===n)return!0;var r=so(n);return!!r&&t===r[0]}(Sn&&go(new Sn(new ArrayBuffer(1)))!=P||An&&go(new An)!=S||En&&go(En.resolve())!=O||On&&go(new On)!=M||Cn&&go(new Cn)!=j)&&(go=function(t){var e=Ar(t),n=e==E?t.constructor:i,r=n?$o(n):"";if(r)switch(r){case jn:return P;case Rn:return S;case Pn:return O;case Dn:return M;case Ln:return j}return e});var ko=Rt?Zs:_u;function So(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||jt)}function Ao(t){return t==t&&!ea(t)}function Eo(t,e){return function(n){return null!=n&&(n[t]===e&&(e!==i||t in Et(n)))}}function Oo(t,e,n){return e=vn(e===i?t.length-1:e,0),function(){for(var i=arguments,o=-1,s=vn(i.length-e,0),a=r(s);++o<s;)a[o]=i[e+o];o=-1;for(var u=r(e+1);++o<e;)u[o]=i[o];return u[e]=n(a),Ee(t,this,u)}}function Co(t,e){return e.length<2?t:kr(t,ii(e,0,-1))}function Mo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var No=Po(ei),Io=pe||function(t,e){return me.setTimeout(t,e)},jo=Po(ni);function Ro(t,e,n){var r=e+"";return jo(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(ut,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Ce(_,function(n){var r="_."+n[0];e&n[1]&&!je(t,r)&&t.push(r)}),t.sort()}(function(t){var e=t.match(ct);return e?e[1].split(lt):[]}(r),n)))}function Po(t){var e=0,n=0;return function(){var r=wn(),o=16-(r-n);if(n=r,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(i,arguments)}}function Do(t,e){var n=-1,r=t.length,o=r-1;for(e=e===i?r:e;++n<e;){var s=Xr(n,o),a=t[s];t[s]=t[n],t[n]=a}return t.length=e,t}var Lo=function(t){var e=Ps(t,function(t){return 500===n.size&&n.clear(),t}),n=e.cache;return e}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(rt,function(t,n,r,i){e.push(r?i.replace(pt,"$1"):n||t)}),e});function Fo(t){if("string"==typeof t||ca(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function $o(t){if(null!=t){try{return Pt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Bo(t){if(t instanceof zn)return t.clone();var e=new Gn(t.__wrapped__,t.__chain__);return e.__actions__=Mi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var qo=Qr(function(t,e){return Hs(t)?dr(t,yr(e,1,Hs,!0)):[]}),Uo=Qr(function(t,e){var n=Qo(e);return Hs(n)&&(n=i),Hs(t)?dr(t,yr(e,1,Hs,!0),co(n,2)):[]}),Vo=Qr(function(t,e){var n=Qo(e);return Hs(n)&&(n=i),Hs(t)?dr(t,yr(e,1,Hs,!0),i,n):[]});function Go(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ma(n);return i<0&&(i=vn(r+i,0)),Ue(t,co(e,3),i)}function zo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r-1;return n!==i&&(o=ma(n),o=n<0?vn(r+o,0):bn(o,r-1)),Ue(t,co(e,3),o,!0)}function Wo(t){return(null==t?0:t.length)?yr(t,1):[]}function Jo(t){return t&&t.length?t[0]:i}var Ho=Qr(function(t){var e=Pe(t,yi);return e.length&&e[0]===t[0]?Mr(e):[]}),Xo=Qr(function(t){var e=Qo(t),n=Pe(t,yi);return e===Qo(n)?e=i:n.pop(),n.length&&n[0]===t[0]?Mr(n,co(e,2)):[]}),Ko=Qr(function(t){var e=Qo(t),n=Pe(t,yi);return(e="function"==typeof e?e:i)&&n.pop(),n.length&&n[0]===t[0]?Mr(n,i,e):[]});function Qo(t){var e=null==t?0:t.length;return e?t[e-1]:i}var Zo=Qr(Yo);function Yo(t,e){return t&&t.length&&e&&e.length?Jr(t,e):t}var ts=ro(function(t,e){var n=null==t?0:t.length,r=ar(t,e);return Hr(t,Pe(e,function(t){return bo(t,n)?+t:t}).sort(Ei)),r});function es(t){return null==t?t:kn.call(t)}var ns=Qr(function(t){return hi(yr(t,1,Hs,!0))}),rs=Qr(function(t){var e=Qo(t);return Hs(e)&&(e=i),hi(yr(t,1,Hs,!0),co(e,2))}),is=Qr(function(t){var e=Qo(t);return e="function"==typeof e?e:i,hi(yr(t,1,Hs,!0),i,e)});function os(t){if(!t||!t.length)return[];var e=0;return t=Ie(t,function(t){if(Hs(t))return e=vn(t.length,e),!0}),Qe(e,function(e){return Pe(t,Je(e))})}function ss(t,e){if(!t||!t.length)return[];var n=os(t);return null==e?n:Pe(n,function(t){return Ee(e,i,t)})}var as=Qr(function(t,e){return Hs(t)?dr(t,e):[]}),us=Qr(function(t){return gi(Ie(t,Hs))}),cs=Qr(function(t){var e=Qo(t);return Hs(e)&&(e=i),gi(Ie(t,Hs),co(e,2))}),ls=Qr(function(t){var e=Qo(t);return e="function"==typeof e?e:i,gi(Ie(t,Hs),i,e)}),hs=Qr(os);var ds=Qr(function(t){var e=t.length,n=e>1?t[e-1]:i;return n="function"==typeof n?(t.pop(),n):i,ss(t,n)});function ps(t){var e=qn(t);return e.__chain__=!0,e}function fs(t,e){return e(t)}var ms=ro(function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,o=function(e){return ar(e,t)};return!(e>1||this.__actions__.length)&&r instanceof zn&&bo(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:fs,args:[o],thisArg:i}),new Gn(r,this.__chain__).thru(function(t){return e&&!t.length&&t.push(i),t})):this.thru(o)});var gs=Ii(function(t,e,n){Dt.call(t,n)?++t[n]:sr(t,n,1)});var _s=$i(Go),ys=$i(zo);function vs(t,e){return(zs(t)?Ce:pr)(t,co(e,3))}function bs(t,e){return(zs(t)?Me:fr)(t,co(e,3))}var ws=Ii(function(t,e,n){Dt.call(t,n)?t[n].push(e):sr(t,n,[e])});var xs=Qr(function(t,e,n){var i=-1,o="function"==typeof e,s=Js(t)?r(t.length):[];return pr(t,function(t){s[++i]=o?Ee(e,t,n):Nr(t,e,n)}),s}),Ts=Ii(function(t,e,n){sr(t,n,e)});function ks(t,e){return(zs(t)?Pe:Br)(t,co(e,3))}var Ss=Ii(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});var As=Qr(function(t,e){if(null==t)return[];var n=e.length;return n>1&&wo(t,e[0],e[1])?e=[]:n>2&&wo(e[0],e[1],e[2])&&(e=[e[0]]),zr(t,yr(e,1),[])}),Es=le||function(){return me.Date.now()};function Os(t,e,n){return e=n?i:e,e=t&&null==e?t.length:e,Zi(t,h,i,i,i,i,e)}function Cs(t,e){var n;if("function"!=typeof e)throw new Mt(o);return t=ma(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=i),n}}var Ms=Qr(function(t,e,n){var r=1;if(n.length){var i=hn(n,uo(Ms));r|=c}return Zi(t,r,e,n,i)}),Ns=Qr(function(t,e,n){var r=3;if(n.length){var i=hn(n,uo(Ns));r|=c}return Zi(e,r,t,n,i)});function Is(t,e,n){var r,s,a,u,c,l,h=0,d=!1,p=!1,f=!0;if("function"!=typeof t)throw new Mt(o);function m(e){var n=r,o=s;return r=s=i,h=e,u=t.apply(o,n)}function g(t){var n=t-l;return l===i||n>=e||n<0||p&&t-h>=a}function _(){var t=Es();if(g(t))return y(t);c=Io(_,function(t){var n=e-(t-l);return p?bn(n,a-(t-h)):n}(t))}function y(t){return c=i,f&&r?m(t):(r=s=i,u)}function v(){var t=Es(),n=g(t);if(r=arguments,s=this,l=t,n){if(c===i)return function(t){return h=t,c=Io(_,e),d?m(t):u}(l);if(p)return Ti(c),c=Io(_,e),m(l)}return c===i&&(c=Io(_,e)),u}return e=_a(e)||0,ea(n)&&(d=!!n.leading,a=(p="maxWait"in n)?vn(_a(n.maxWait)||0,e):a,f="trailing"in n?!!n.trailing:f),v.cancel=function(){c!==i&&Ti(c),h=0,r=l=s=c=i},v.flush=function(){return c===i?u:y(Es())},v}var js=Qr(function(t,e){return hr(t,1,e)}),Rs=Qr(function(t,e,n){return hr(t,_a(e)||0,n)});function Ps(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Mt(o);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Ps.Cache||Hn),n}function Ds(t){if("function"!=typeof t)throw new Mt(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Ps.Cache=Hn;var Ls=wi(function(t,e){var n=(e=1==e.length&&zs(e[0])?Pe(e[0],Ye(co())):Pe(yr(e,1),Ye(co()))).length;return Qr(function(r){for(var i=-1,o=bn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return Ee(t,this,r)})}),Fs=Qr(function(t,e){var n=hn(e,uo(Fs));return Zi(t,c,i,e,n)}),$s=Qr(function(t,e){var n=hn(e,uo($s));return Zi(t,l,i,e,n)}),Bs=ro(function(t,e){return Zi(t,d,i,i,i,e)});function qs(t,e){return t===e||t!=t&&e!=e}var Us=Ji(Er),Vs=Ji(function(t,e){return t>=e}),Gs=Ir(function(){return arguments}())?Ir:function(t){return na(t)&&Dt.call(t,"callee")&&!Xt.call(t,"callee")},zs=r.isArray,Ws=we?Ye(we):function(t){return na(t)&&Ar(t)==R};function Js(t){return null!=t&&ta(t.length)&&!Zs(t)}function Hs(t){return na(t)&&Js(t)}var Xs=ve||_u,Ks=xe?Ye(xe):function(t){return na(t)&&Ar(t)==w};function Qs(t){if(!na(t))return!1;var e=Ar(t);return e==x||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!oa(t)}function Zs(t){if(!ea(t))return!1;var e=Ar(t);return e==T||e==k||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Ys(t){return"number"==typeof t&&t==ma(t)}function ta(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=f}function ea(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function na(t){return null!=t&&"object"==typeof t}var ra=Te?Ye(Te):function(t){return na(t)&&go(t)==S};function ia(t){return"number"==typeof t||na(t)&&Ar(t)==A}function oa(t){if(!na(t)||Ar(t)!=E)return!1;var e=Jt(t);if(null===e)return!0;var n=Dt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Pt.call(n)==Bt}var sa=ke?Ye(ke):function(t){return na(t)&&Ar(t)==C};var aa=Se?Ye(Se):function(t){return na(t)&&go(t)==M};function ua(t){return"string"==typeof t||!zs(t)&&na(t)&&Ar(t)==N}function ca(t){return"symbol"==typeof t||na(t)&&Ar(t)==I}var la=Ae?Ye(Ae):function(t){return na(t)&&ta(t.length)&&!!ue[Ar(t)]};var ha=Ji($r),da=Ji(function(t,e){return t<=e});function pa(t){if(!t)return[];if(Js(t))return ua(t)?mn(t):Mi(t);if(Zt&&t[Zt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Zt]());var e=go(t);return(e==S?cn:e==M?dn:qa)(t)}function fa(t){return t?(t=_a(t))===p||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ma(t){var e=fa(t),n=e%1;return e==e?n?e-n:e:0}function ga(t){return t?ur(ma(t),0,g):0}function _a(t){if("number"==typeof t)return t;if(ca(t))return m;if(ea(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ze(t);var n=_t.test(t);return n||vt.test(t)?de(t.slice(2),n?2:8):gt.test(t)?m:+t}function ya(t){return Ni(t,ja(t))}function va(t){return null==t?"":li(t)}var ba=ji(function(t,e){if(So(e)||Js(e))Ni(e,Ia(e),t);else for(var n in e)Dt.call(e,n)&&nr(t,n,e[n])}),wa=ji(function(t,e){Ni(e,ja(e),t)}),xa=ji(function(t,e,n,r){Ni(e,ja(e),t,r)}),Ta=ji(function(t,e,n,r){Ni(e,Ia(e),t,r)}),ka=ro(ar);var Sa=Qr(function(t,e){t=Et(t);var n=-1,r=e.length,o=r>2?e[2]:i;for(o&&wo(e[0],e[1],o)&&(r=1);++n<r;)for(var s=e[n],a=ja(s),u=-1,c=a.length;++u<c;){var l=a[u],h=t[l];(h===i||qs(h,jt[l])&&!Dt.call(t,l))&&(t[l]=s[l])}return t}),Aa=Qr(function(t){return t.push(i,to),Ee(Pa,i,t)});function Ea(t,e,n){var r=null==t?i:kr(t,e);return r===i?n:r}function Oa(t,e){return null!=t&&_o(t,e,Cr)}var Ca=Ui(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=$t.call(e)),t[e]=n},eu(iu)),Ma=Ui(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=$t.call(e)),Dt.call(t,e)?t[e].push(n):t[e]=[n]},co),Na=Qr(Nr);function Ia(t){return Js(t)?Qn(t):Lr(t)}function ja(t){return Js(t)?Qn(t,!0):Fr(t)}var Ra=ji(function(t,e,n){Vr(t,e,n)}),Pa=ji(function(t,e,n,r){Vr(t,e,n,r)}),Da=ro(function(t,e){var n={};if(null==t)return n;var r=!1;e=Pe(e,function(e){return e=bi(e,t),r||(r=e.length>1),e}),Ni(t,oo(t),n),r&&(n=cr(n,7,eo));for(var i=e.length;i--;)di(n,e[i]);return n});var La=ro(function(t,e){return null==t?{}:function(t,e){return Wr(t,e,function(e,n){return Oa(t,n)})}(t,e)});function Fa(t,e){if(null==t)return{};var n=Pe(oo(t),function(t){return[t]});return e=co(e),Wr(t,n,function(t,n){return e(t,n[0])})}var $a=Qi(Ia),Ba=Qi(ja);function qa(t){return null==t?[]:tn(t,Ia(t))}var Ua=Li(function(t,e,n){return e=e.toLowerCase(),t+(n?Va(e):e)});function Va(t){return Qa(va(t).toLowerCase())}function Ga(t){return(t=va(t))&&t.replace(wt,on).replace(ee,"")}var za=Li(function(t,e,n){return t+(n?"-":"")+e.toLowerCase()}),Wa=Li(function(t,e,n){return t+(n?" ":"")+e.toLowerCase()}),Ja=Di("toLowerCase");var Ha=Li(function(t,e,n){return t+(n?"_":"")+e.toLowerCase()});var Xa=Li(function(t,e,n){return t+(n?" ":"")+Qa(e)});var Ka=Li(function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}),Qa=Di("toUpperCase");function Za(t,e,n){return t=va(t),(e=n?i:e)===i?function(t){return oe.test(t)}(t)?function(t){return t.match(re)||[]}(t):function(t){return t.match(ht)||[]}(t):t.match(e)||[]}var Ya=Qr(function(t,e){try{return Ee(t,i,e)}catch(t){return Qs(t)?t:new kt(t)}}),tu=ro(function(t,e){return Ce(e,function(e){e=Fo(e),sr(t,e,Ms(t[e],t))}),t});function eu(t){return function(){return t}}var nu=Bi(),ru=Bi(!0);function iu(t){return t}function ou(t){return Dr("function"==typeof t?t:cr(t,1))}var su=Qr(function(t,e){return function(n){return Nr(n,t,e)}}),au=Qr(function(t,e){return function(n){return Nr(t,n,e)}});function uu(t,e,n){var r=Ia(e),i=Tr(e,r);null!=n||ea(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=Tr(e,Ia(e)));var o=!(ea(n)&&"chain"in n&&!n.chain),s=Zs(t);return Ce(i,function(n){var r=e[n];t[n]=r,s&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__);return(n.__actions__=Mi(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,De([this.value()],arguments))})}),t}function cu(){}var lu=Gi(Pe),hu=Gi(Ne),du=Gi($e);function pu(t){return xo(t)?Je(Fo(t)):function(t){return function(e){return kr(e,t)}}(t)}var fu=Wi(),mu=Wi(!0);function gu(){return[]}function _u(){return!1}var yu=Vi(function(t,e){return t+e},0),vu=Xi("ceil"),bu=Vi(function(t,e){return t/e},1),wu=Xi("floor");var xu,Tu=Vi(function(t,e){return t*e},1),ku=Xi("round"),Su=Vi(function(t,e){return t-e},0);return qn.after=function(t,e){if("function"!=typeof e)throw new Mt(o);return t=ma(t),function(){if(--t<1)return e.apply(this,arguments)}},qn.ary=Os,qn.assign=ba,qn.assignIn=wa,qn.assignInWith=xa,qn.assignWith=Ta,qn.at=ka,qn.before=Cs,qn.bind=Ms,qn.bindAll=tu,qn.bindKey=Ns,qn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return zs(t)?t:[t]},qn.chain=ps,qn.chunk=function(t,e,n){e=(n?wo(t,e,n):e===i)?1:vn(ma(e),0);var o=null==t?0:t.length;if(!o||e<1)return[];for(var s=0,a=0,u=r(fe(o/e));s<o;)u[a++]=ii(t,s,s+=e);return u},qn.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},qn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=r(t-1),n=arguments[0],i=t;i--;)e[i-1]=arguments[i];return De(zs(n)?Mi(n):[n],yr(e,1))},qn.cond=function(t){var e=null==t?0:t.length,n=co();return t=e?Pe(t,function(t){if("function"!=typeof t[1])throw new Mt(o);return[n(t[0]),t[1]]}):[],Qr(function(n){for(var r=-1;++r<e;){var i=t[r];if(Ee(i[0],this,n))return Ee(i[1],this,n)}})},qn.conforms=function(t){return function(t){var e=Ia(t);return function(n){return lr(n,t,e)}}(cr(t,1))},qn.constant=eu,qn.countBy=gs,qn.create=function(t,e){var n=Un(t);return null==e?n:or(n,e)},qn.curry=function t(e,n,r){var o=Zi(e,8,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},qn.curryRight=function t(e,n,r){var o=Zi(e,u,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},qn.debounce=Is,qn.defaults=Sa,qn.defaultsDeep=Aa,qn.defer=js,qn.delay=Rs,qn.difference=qo,qn.differenceBy=Uo,qn.differenceWith=Vo,qn.drop=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,(e=n||e===i?1:ma(e))<0?0:e,r):[]},qn.dropRight=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,0,(e=r-(e=n||e===i?1:ma(e)))<0?0:e):[]},qn.dropRightWhile=function(t,e){return t&&t.length?fi(t,co(e,3),!0,!0):[]},qn.dropWhile=function(t,e){return t&&t.length?fi(t,co(e,3),!0):[]},qn.fill=function(t,e,n,r){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&wo(t,e,n)&&(n=0,r=o),function(t,e,n,r){var o=t.length;for((n=ma(n))<0&&(n=-n>o?0:o+n),(r=r===i||r>o?o:ma(r))<0&&(r+=o),r=n>r?0:ga(r);n<r;)t[n++]=e;return t}(t,e,n,r)):[]},qn.filter=function(t,e){return(zs(t)?Ie:_r)(t,co(e,3))},qn.flatMap=function(t,e){return yr(ks(t,e),1)},qn.flatMapDeep=function(t,e){return yr(ks(t,e),p)},qn.flatMapDepth=function(t,e,n){return n=n===i?1:ma(n),yr(ks(t,e),n)},qn.flatten=Wo,qn.flattenDeep=function(t){return(null==t?0:t.length)?yr(t,p):[]},qn.flattenDepth=function(t,e){return(null==t?0:t.length)?yr(t,e=e===i?1:ma(e)):[]},qn.flip=function(t){return Zi(t,512)},qn.flow=nu,qn.flowRight=ru,qn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},qn.functions=function(t){return null==t?[]:Tr(t,Ia(t))},qn.functionsIn=function(t){return null==t?[]:Tr(t,ja(t))},qn.groupBy=ws,qn.initial=function(t){return(null==t?0:t.length)?ii(t,0,-1):[]},qn.intersection=Ho,qn.intersectionBy=Xo,qn.intersectionWith=Ko,qn.invert=Ca,qn.invertBy=Ma,qn.invokeMap=xs,qn.iteratee=ou,qn.keyBy=Ts,qn.keys=Ia,qn.keysIn=ja,qn.map=ks,qn.mapKeys=function(t,e){var n={};return e=co(e,3),wr(t,function(t,r,i){sr(n,e(t,r,i),t)}),n},qn.mapValues=function(t,e){var n={};return e=co(e,3),wr(t,function(t,r,i){sr(n,r,e(t,r,i))}),n},qn.matches=function(t){return qr(cr(t,1))},qn.matchesProperty=function(t,e){return Ur(t,cr(e,1))},qn.memoize=Ps,qn.merge=Ra,qn.mergeWith=Pa,qn.method=su,qn.methodOf=au,qn.mixin=uu,qn.negate=Ds,qn.nthArg=function(t){return t=ma(t),Qr(function(e){return Gr(e,t)})},qn.omit=Da,qn.omitBy=function(t,e){return Fa(t,Ds(co(e)))},qn.once=function(t){return Cs(2,t)},qn.orderBy=function(t,e,n,r){return null==t?[]:(zs(e)||(e=null==e?[]:[e]),zs(n=r?i:n)||(n=null==n?[]:[n]),zr(t,e,n))},qn.over=lu,qn.overArgs=Ls,qn.overEvery=hu,qn.overSome=du,qn.partial=Fs,qn.partialRight=$s,qn.partition=Ss,qn.pick=La,qn.pickBy=Fa,qn.property=pu,qn.propertyOf=function(t){return function(e){return null==t?i:kr(t,e)}},qn.pull=Zo,qn.pullAll=Yo,qn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Jr(t,e,co(n,2)):t},qn.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?Jr(t,e,i,n):t},qn.pullAt=ts,qn.range=fu,qn.rangeRight=mu,qn.rearg=Bs,qn.reject=function(t,e){return(zs(t)?Ie:_r)(t,Ds(co(e,3)))},qn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=co(e,3);++r<o;){var s=t[r];e(s,r,t)&&(n.push(s),i.push(r))}return Hr(t,i),n},qn.rest=function(t,e){if("function"!=typeof t)throw new Mt(o);return Qr(t,e=e===i?e:ma(e))},qn.reverse=es,qn.sampleSize=function(t,e,n){return e=(n?wo(t,e,n):e===i)?1:ma(e),(zs(t)?Yn:Yr)(t,e)},qn.set=function(t,e,n){return null==t?t:ti(t,e,n)},qn.setWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:ti(t,e,n,r)},qn.shuffle=function(t){return(zs(t)?tr:ri)(t)},qn.slice=function(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&wo(t,e,n)?(e=0,n=r):(e=null==e?0:ma(e),n=n===i?r:ma(n)),ii(t,e,n)):[]},qn.sortBy=As,qn.sortedUniq=function(t){return t&&t.length?ui(t):[]},qn.sortedUniqBy=function(t,e){return t&&t.length?ui(t,co(e,2)):[]},qn.split=function(t,e,n){return n&&"number"!=typeof n&&wo(t,e,n)&&(e=n=i),(n=n===i?g:n>>>0)?(t=va(t))&&("string"==typeof e||null!=e&&!sa(e))&&!(e=li(e))&&un(t)?xi(mn(t),0,n):t.split(e,n):[]},qn.spread=function(t,e){if("function"!=typeof t)throw new Mt(o);return e=null==e?0:vn(ma(e),0),Qr(function(n){var r=n[e],i=xi(n,0,e);return r&&De(i,r),Ee(t,this,i)})},qn.tail=function(t){var e=null==t?0:t.length;return e?ii(t,1,e):[]},qn.take=function(t,e,n){return t&&t.length?ii(t,0,(e=n||e===i?1:ma(e))<0?0:e):[]},qn.takeRight=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,(e=r-(e=n||e===i?1:ma(e)))<0?0:e,r):[]},qn.takeRightWhile=function(t,e){return t&&t.length?fi(t,co(e,3),!1,!0):[]},qn.takeWhile=function(t,e){return t&&t.length?fi(t,co(e,3)):[]},qn.tap=function(t,e){return e(t),t},qn.throttle=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new Mt(o);return ea(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Is(t,e,{leading:r,maxWait:e,trailing:i})},qn.thru=fs,qn.toArray=pa,qn.toPairs=$a,qn.toPairsIn=Ba,qn.toPath=function(t){return zs(t)?Pe(t,Fo):ca(t)?[t]:Mi(Lo(va(t)))},qn.toPlainObject=ya,qn.transform=function(t,e,n){var r=zs(t),i=r||Xs(t)||la(t);if(e=co(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:ea(t)&&Zs(o)?Un(Jt(t)):{}}return(i?Ce:wr)(t,function(t,r,i){return e(n,t,r,i)}),n},qn.unary=function(t){return Os(t,1)},qn.union=ns,qn.unionBy=rs,qn.unionWith=is,qn.uniq=function(t){return t&&t.length?hi(t):[]},qn.uniqBy=function(t,e){return t&&t.length?hi(t,co(e,2)):[]},qn.uniqWith=function(t,e){return e="function"==typeof e?e:i,t&&t.length?hi(t,i,e):[]},qn.unset=function(t,e){return null==t||di(t,e)},qn.unzip=os,qn.unzipWith=ss,qn.update=function(t,e,n){return null==t?t:pi(t,e,vi(n))},qn.updateWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:pi(t,e,vi(n),r)},qn.values=qa,qn.valuesIn=function(t){return null==t?[]:tn(t,ja(t))},qn.without=as,qn.words=Za,qn.wrap=function(t,e){return Fs(vi(e),t)},qn.xor=us,qn.xorBy=cs,qn.xorWith=ls,qn.zip=hs,qn.zipObject=function(t,e){return _i(t||[],e||[],nr)},qn.zipObjectDeep=function(t,e){return _i(t||[],e||[],ti)},qn.zipWith=ds,qn.entries=$a,qn.entriesIn=Ba,qn.extend=wa,qn.extendWith=xa,uu(qn,qn),qn.add=yu,qn.attempt=Ya,qn.camelCase=Ua,qn.capitalize=Va,qn.ceil=vu,qn.clamp=function(t,e,n){return n===i&&(n=e,e=i),n!==i&&(n=(n=_a(n))==n?n:0),e!==i&&(e=(e=_a(e))==e?e:0),ur(_a(t),e,n)},qn.clone=function(t){return cr(t,4)},qn.cloneDeep=function(t){return cr(t,5)},qn.cloneDeepWith=function(t,e){return cr(t,5,e="function"==typeof e?e:i)},qn.cloneWith=function(t,e){return cr(t,4,e="function"==typeof e?e:i)},qn.conformsTo=function(t,e){return null==e||lr(t,e,Ia(e))},qn.deburr=Ga,qn.defaultTo=function(t,e){return null==t||t!=t?e:t},qn.divide=bu,qn.endsWith=function(t,e,n){t=va(t),e=li(e);var r=t.length,o=n=n===i?r:ur(ma(n),0,r);return(n-=e.length)>=0&&t.slice(n,o)==e},qn.eq=qs,qn.escape=function(t){return(t=va(t))&&Q.test(t)?t.replace(X,sn):t},qn.escapeRegExp=function(t){return(t=va(t))&&ot.test(t)?t.replace(it,"\\$&"):t},qn.every=function(t,e,n){var r=zs(t)?Ne:mr;return n&&wo(t,e,n)&&(e=i),r(t,co(e,3))},qn.find=_s,qn.findIndex=Go,qn.findKey=function(t,e){return qe(t,co(e,3),wr)},qn.findLast=ys,qn.findLastIndex=zo,qn.findLastKey=function(t,e){return qe(t,co(e,3),xr)},qn.floor=wu,qn.forEach=vs,qn.forEachRight=bs,qn.forIn=function(t,e){return null==t?t:vr(t,co(e,3),ja)},qn.forInRight=function(t,e){return null==t?t:br(t,co(e,3),ja)},qn.forOwn=function(t,e){return t&&wr(t,co(e,3))},qn.forOwnRight=function(t,e){return t&&xr(t,co(e,3))},qn.get=Ea,qn.gt=Us,qn.gte=Vs,qn.has=function(t,e){return null!=t&&_o(t,e,Or)},qn.hasIn=Oa,qn.head=Jo,qn.identity=iu,qn.includes=function(t,e,n,r){t=Js(t)?t:qa(t),n=n&&!r?ma(n):0;var i=t.length;return n<0&&(n=vn(i+n,0)),ua(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Ve(t,e,n)>-1},qn.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ma(n);return i<0&&(i=vn(r+i,0)),Ve(t,e,i)},qn.inRange=function(t,e,n){return e=fa(e),n===i?(n=e,e=0):n=fa(n),function(t,e,n){return t>=bn(e,n)&&t<vn(e,n)}(t=_a(t),e,n)},qn.invoke=Na,qn.isArguments=Gs,qn.isArray=zs,qn.isArrayBuffer=Ws,qn.isArrayLike=Js,qn.isArrayLikeObject=Hs,qn.isBoolean=function(t){return!0===t||!1===t||na(t)&&Ar(t)==b},qn.isBuffer=Xs,qn.isDate=Ks,qn.isElement=function(t){return na(t)&&1===t.nodeType&&!oa(t)},qn.isEmpty=function(t){if(null==t)return!0;if(Js(t)&&(zs(t)||"string"==typeof t||"function"==typeof t.splice||Xs(t)||la(t)||Gs(t)))return!t.length;var e=go(t);if(e==S||e==M)return!t.size;if(So(t))return!Lr(t).length;for(var n in t)if(Dt.call(t,n))return!1;return!0},qn.isEqual=function(t,e){return jr(t,e)},qn.isEqualWith=function(t,e,n){var r=(n="function"==typeof n?n:i)?n(t,e):i;return r===i?jr(t,e,i,n):!!r},qn.isError=Qs,qn.isFinite=function(t){return"number"==typeof t&&be(t)},qn.isFunction=Zs,qn.isInteger=Ys,qn.isLength=ta,qn.isMap=ra,qn.isMatch=function(t,e){return t===e||Rr(t,e,ho(e))},qn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:i,Rr(t,e,ho(e),n)},qn.isNaN=function(t){return ia(t)&&t!=+t},qn.isNative=function(t){if(ko(t))throw new kt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Pr(t)},qn.isNil=function(t){return null==t},qn.isNull=function(t){return null===t},qn.isNumber=ia,qn.isObject=ea,qn.isObjectLike=na,qn.isPlainObject=oa,qn.isRegExp=sa,qn.isSafeInteger=function(t){return Ys(t)&&t>=-9007199254740991&&t<=f},qn.isSet=aa,qn.isString=ua,qn.isSymbol=ca,qn.isTypedArray=la,qn.isUndefined=function(t){return t===i},qn.isWeakMap=function(t){return na(t)&&go(t)==j},qn.isWeakSet=function(t){return na(t)&&"[object WeakSet]"==Ar(t)},qn.join=function(t,e){return null==t?"":Be.call(t,e)},qn.kebabCase=za,qn.last=Qo,qn.lastIndexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=ma(n))<0?vn(r+o,0):bn(o,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,o):Ue(t,ze,o,!0)},qn.lowerCase=Wa,qn.lowerFirst=Ja,qn.lt=ha,qn.lte=da,qn.max=function(t){return t&&t.length?gr(t,iu,Er):i},qn.maxBy=function(t,e){return t&&t.length?gr(t,co(e,2),Er):i},qn.mean=function(t){return We(t,iu)},qn.meanBy=function(t,e){return We(t,co(e,2))},qn.min=function(t){return t&&t.length?gr(t,iu,$r):i},qn.minBy=function(t,e){return t&&t.length?gr(t,co(e,2),$r):i},qn.stubArray=gu,qn.stubFalse=_u,qn.stubObject=function(){return{}},qn.stubString=function(){return""},qn.stubTrue=function(){return!0},qn.multiply=Tu,qn.nth=function(t,e){return t&&t.length?Gr(t,ma(e)):i},qn.noConflict=function(){return me._===this&&(me._=qt),this},qn.noop=cu,qn.now=Es,qn.pad=function(t,e,n){t=va(t);var r=(e=ma(e))?fn(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return zi(ge(i),n)+t+zi(fe(i),n)},qn.padEnd=function(t,e,n){t=va(t);var r=(e=ma(e))?fn(t):0;return e&&r<e?t+zi(e-r,n):t},qn.padStart=function(t,e,n){t=va(t);var r=(e=ma(e))?fn(t):0;return e&&r<e?zi(e-r,n)+t:t},qn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),xn(va(t).replace(st,""),e||0)},qn.random=function(t,e,n){if(n&&"boolean"!=typeof n&&wo(t,e,n)&&(e=n=i),n===i&&("boolean"==typeof e?(n=e,e=i):"boolean"==typeof t&&(n=t,t=i)),t===i&&e===i?(t=0,e=1):(t=fa(t),e===i?(e=t,t=0):e=fa(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var o=Tn();return bn(t+o*(e-t+he("1e-"+((o+"").length-1))),e)}return Xr(t,e)},qn.reduce=function(t,e,n){var r=zs(t)?Le:Xe,i=arguments.length<3;return r(t,co(e,4),n,i,pr)},qn.reduceRight=function(t,e,n){var r=zs(t)?Fe:Xe,i=arguments.length<3;return r(t,co(e,4),n,i,fr)},qn.repeat=function(t,e,n){return e=(n?wo(t,e,n):e===i)?1:ma(e),Kr(va(t),e)},qn.replace=function(){var t=arguments,e=va(t[0]);return t.length<3?e:e.replace(t[1],t[2])},qn.result=function(t,e,n){var r=-1,o=(e=bi(e,t)).length;for(o||(o=1,t=i);++r<o;){var s=null==t?i:t[Fo(e[r])];s===i&&(r=o,s=n),t=Zs(s)?s.call(t):s}return t},qn.round=ku,qn.runInContext=t,qn.sample=function(t){return(zs(t)?Zn:Zr)(t)},qn.size=function(t){if(null==t)return 0;if(Js(t))return ua(t)?fn(t):t.length;var e=go(t);return e==S||e==M?t.size:Lr(t).length},qn.snakeCase=Ha,qn.some=function(t,e,n){var r=zs(t)?$e:oi;return n&&wo(t,e,n)&&(e=i),r(t,co(e,3))},qn.sortedIndex=function(t,e){return si(t,e)},qn.sortedIndexBy=function(t,e,n){return ai(t,e,co(n,2))},qn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=si(t,e);if(r<n&&qs(t[r],e))return r}return-1},qn.sortedLastIndex=function(t,e){return si(t,e,!0)},qn.sortedLastIndexBy=function(t,e,n){return ai(t,e,co(n,2),!0)},qn.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var n=si(t,e,!0)-1;if(qs(t[n],e))return n}return-1},qn.startCase=Xa,qn.startsWith=function(t,e,n){return t=va(t),n=null==n?0:ur(ma(n),0,t.length),e=li(e),t.slice(n,n+e.length)==e},qn.subtract=Su,qn.sum=function(t){return t&&t.length?Ke(t,iu):0},qn.sumBy=function(t,e){return t&&t.length?Ke(t,co(e,2)):0},qn.template=function(t,e,n){var r=qn.templateSettings;n&&wo(t,e,n)&&(e=i),t=va(t),e=xa({},e,r,Yi);var o,s,a=xa({},e.imports,r.imports,Yi),u=Ia(a),c=tn(a,u),l=0,h=e.interpolate||xt,d="__p += '",p=Ot((e.escape||xt).source+"|"+h.source+"|"+(h===tt?ft:xt).source+"|"+(e.evaluate||xt).source+"|$","g"),f="//# sourceURL="+(Dt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ae+"]")+"\n";t.replace(p,function(e,n,r,i,a,u){return r||(r=i),d+=t.slice(l,u).replace(Tt,an),n&&(o=!0,d+="' +\n__e("+n+") +\n'"),a&&(s=!0,d+="';\n"+a+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+e.length,e}),d+="';\n";var m=Dt.call(e,"variable")&&e.variable;if(m){if(dt.test(m))throw new kt("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(s?d.replace(z,""):d).replace(W,"$1").replace(J,"$1;"),d="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=Ya(function(){return St(u,f+"return "+d).apply(i,c)});if(g.source=d,Qs(g))throw g;return g},qn.times=function(t,e){if((t=ma(t))<1||t>f)return[];var n=g,r=bn(t,g);e=co(e),t-=g;for(var i=Qe(r,e);++n<t;)e(n);return i},qn.toFinite=fa,qn.toInteger=ma,qn.toLength=ga,qn.toLower=function(t){return va(t).toLowerCase()},qn.toNumber=_a,qn.toSafeInteger=function(t){return t?ur(ma(t),-9007199254740991,f):0===t?t:0},qn.toString=va,qn.toUpper=function(t){return va(t).toUpperCase()},qn.trim=function(t,e,n){if((t=va(t))&&(n||e===i))return Ze(t);if(!t||!(e=li(e)))return t;var r=mn(t),o=mn(e);return xi(r,nn(r,o),rn(r,o)+1).join("")},qn.trimEnd=function(t,e,n){if((t=va(t))&&(n||e===i))return t.slice(0,gn(t)+1);if(!t||!(e=li(e)))return t;var r=mn(t);return xi(r,0,rn(r,mn(e))+1).join("")},qn.trimStart=function(t,e,n){if((t=va(t))&&(n||e===i))return t.replace(st,"");if(!t||!(e=li(e)))return t;var r=mn(t);return xi(r,nn(r,mn(e))).join("")},qn.truncate=function(t,e){var n=30,r="...";if(ea(e)){var o="separator"in e?e.separator:o;n="length"in e?ma(e.length):n,r="omission"in e?li(e.omission):r}var s=(t=va(t)).length;if(un(t)){var a=mn(t);s=a.length}if(n>=s)return t;var u=n-fn(r);if(u<1)return r;var c=a?xi(a,0,u).join(""):t.slice(0,u);if(o===i)return c+r;if(a&&(u+=c.length-u),sa(o)){if(t.slice(u).search(o)){var l,h=c;for(o.global||(o=Ot(o.source,va(mt.exec(o))+"g")),o.lastIndex=0;l=o.exec(h);)var d=l.index;c=c.slice(0,d===i?u:d)}}else if(t.indexOf(li(o),u)!=u){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+r},qn.unescape=function(t){return(t=va(t))&&K.test(t)?t.replace(H,_n):t},qn.uniqueId=function(t){var e=++Lt;return va(t)+e},qn.upperCase=Ka,qn.upperFirst=Qa,qn.each=vs,qn.eachRight=bs,qn.first=Jo,uu(qn,(xu={},wr(qn,function(t,e){Dt.call(qn.prototype,e)||(xu[e]=t)}),xu),{chain:!1}),qn.VERSION="4.17.23",Ce(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){qn[t].placeholder=qn}),Ce(["drop","take"],function(t,e){zn.prototype[t]=function(n){n=n===i?1:vn(ma(n),0);var r=this.__filtered__&&!e?new zn(this):this.clone();return r.__filtered__?r.__takeCount__=bn(n,r.__takeCount__):r.__views__.push({size:bn(n,g),type:t+(r.__dir__<0?"Right":"")}),r},zn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),Ce(["filter","map","takeWhile"],function(t,e){var n=e+1,r=1==n||3==n;zn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:co(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}}),Ce(["head","last"],function(t,e){var n="take"+(e?"Right":"");zn.prototype[t]=function(){return this[n](1).value()[0]}}),Ce(["initial","tail"],function(t,e){var n="drop"+(e?"":"Right");zn.prototype[t]=function(){return this.__filtered__?new zn(this):this[n](1)}}),zn.prototype.compact=function(){return this.filter(iu)},zn.prototype.find=function(t){return this.filter(t).head()},zn.prototype.findLast=function(t){return this.reverse().find(t)},zn.prototype.invokeMap=Qr(function(t,e){return"function"==typeof t?new zn(this):this.map(function(n){return Nr(n,t,e)})}),zn.prototype.reject=function(t){return this.filter(Ds(co(t)))},zn.prototype.slice=function(t,e){t=ma(t);var n=this;return n.__filtered__&&(t>0||e<0)?new zn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==i&&(n=(e=ma(e))<0?n.dropRight(-e):n.take(e-t)),n)},zn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},zn.prototype.toArray=function(){return this.take(g)},wr(zn.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),o=qn[r?"take"+("last"==e?"Right":""):e],s=r||/^find/.test(e);o&&(qn.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,u=e instanceof zn,c=a[0],l=u||zs(e),h=function(t){var e=o.apply(qn,De([t],a));return r&&d?e[0]:e};l&&n&&"function"==typeof c&&1!=c.length&&(u=l=!1);var d=this.__chain__,p=!!this.__actions__.length,f=s&&!d,m=u&&!p;if(!s&&l){e=m?e:new zn(this);var g=t.apply(e,a);return g.__actions__.push({func:fs,args:[h],thisArg:i}),new Gn(g,d)}return f&&m?t.apply(this,a):(g=this.thru(h),f?r?g.value()[0]:g.value():g)})}),Ce(["pop","push","shift","sort","splice","unshift"],function(t){var e=Nt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);qn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(zs(i)?i:[],t)}return this[n](function(n){return e.apply(zs(n)?n:[],t)})}}),wr(zn.prototype,function(t,e){var n=qn[e];if(n){var r=n.name+"";Dt.call(In,r)||(In[r]=[]),In[r].push({name:e,func:n})}}),In[qi(i,2).name]=[{name:"wrapper",func:i}],zn.prototype.clone=function(){var t=new zn(this.__wrapped__);return t.__actions__=Mi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Mi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Mi(this.__views__),t},zn.prototype.reverse=function(){if(this.__filtered__){var t=new zn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},zn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=zs(t),r=e<0,i=n?t.length:0,o=function(t,e,n){var r=-1,i=n.length;for(;++r<i;){var o=n[r],s=o.size;switch(o.type){case"drop":t+=s;break;case"dropRight":e-=s;break;case"take":e=bn(e,t+s);break;case"takeRight":t=vn(t,e-s)}}return{start:t,end:e}}(0,i,this.__views__),s=o.start,a=o.end,u=a-s,c=r?a:s-1,l=this.__iteratees__,h=l.length,d=0,p=bn(u,this.__takeCount__);if(!n||!r&&i==u&&p==u)return mi(t,this.__actions__);var f=[];t:for(;u--&&d<p;){for(var m=-1,g=t[c+=e];++m<h;){var _=l[m],y=_.iteratee,v=_.type,b=y(g);if(2==v)g=b;else if(!b){if(1==v)continue t;break t}}f[d++]=g}return f},qn.prototype.at=ms,qn.prototype.chain=function(){return ps(this)},qn.prototype.commit=function(){return new Gn(this.value(),this.__chain__)},qn.prototype.next=function(){this.__values__===i&&(this.__values__=pa(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?i:this.__values__[this.__index__++]}},qn.prototype.plant=function(t){for(var e,n=this;n instanceof Vn;){var r=Bo(n);r.__index__=0,r.__values__=i,e?o.__wrapped__=r:e=r;var o=r;n=n.__wrapped__}return o.__wrapped__=t,e},qn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof zn){var e=t;return this.__actions__.length&&(e=new zn(this)),(e=e.reverse()).__actions__.push({func:fs,args:[es],thisArg:i}),new Gn(e,this.__chain__)}return this.thru(es)},qn.prototype.toJSON=qn.prototype.valueOf=qn.prototype.value=function(){return mi(this.__wrapped__,this.__actions__)},qn.prototype.first=qn.prototype.head,Zt&&(qn.prototype[Zt]=function(){return this}),qn}();me._=yn,(r=function(){return yn}.call(e,n,e,t))===i||(t.exports=r)}.call(this)},79(t){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r},t.exports.__esModule=!0,t.exports.default=t.exports},2987(t){t.exports=function(t){if(Array.isArray(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},7383(t){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},4579(t,e,n){var r=n(7736);function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,r(i.key),i)}}t.exports=function(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},1156(t){t.exports=function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,s,a=[],u=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);u=!0);}catch(t){c=!0,i=t}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}},t.exports.__esModule=!0,t.exports.default=t.exports},7752(t){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},5715(t,e,n){var r=n(2987),i=n(1156),o=n(7122),s=n(7752);t.exports=function(t,e){return r(t)||i(t,e)||o(t,e)||s()},t.exports.__esModule=!0,t.exports.default=t.exports},9045(t,e,n){var r=n(3738).default;t.exports=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},7736(t,e,n){var r=n(3738).default,i=n(9045);t.exports=function(t){var e=i(t,"string");return"symbol"==r(e)?e:e+""},t.exports.__esModule=!0,t.exports.default=t.exports},3738(t){function e(n){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},7122(t,e,n){var r=n(79);t.exports=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var r={};n.r(r),n.d(r,{hasBrowserEnv:()=>Yf,hasStandardBrowserEnv:()=>em,hasStandardBrowserWebWorkerEnv:()=>nm,navigator:()=>tm,origin:()=>rm});var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},i(t,e)};function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function s(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s}function a(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}u((r=r.apply(t,e||[])).next())})}function u(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}Object.create;function c(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function h(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function d(t){return this instanceof d?(this.v=t,this):new d(t)}function p(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(t,e||[]),o=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",function(t){return function(e){return Promise.resolve(e).then(t,c)}}),r[Symbol.asyncIterator]=function(){return this},r;function s(t,e){i[t]&&(r[t]=function(e){return new Promise(function(n,r){o.push([t,e,n,r])>1||a(t,e)})},e&&(r[t]=e(r[t])))}function a(t,e){try{(n=i[t](e)).value instanceof d?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(t){l(o[0][3],t)}var n}function u(t){a("next",t)}function c(t){a("throw",t)}function l(t,e){t(e),o.shift(),o.length&&a(o[0][0],o[0][1])}}function f(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=c(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise(function(r,i){(function(t,e,n,r){Promise.resolve(r).then(function(e){t({value:e,done:n})},e)})(r,i,(e=t[n](e)).done,e.value)})}}}Object.create;"function"==typeof SuppressedError&&SuppressedError;function m(t){return"function"==typeof t}function g(t){return function(e){if(function(t){return m(null==t?void 0:t.lift)}(e))return e.lift(function(e){try{return t(e,this)}catch(t){this.error(t)}});throw new TypeError("Unable to lift unknown Observable type")}}function y(t){var e=t(function(t){Error.call(t),t.stack=(new Error).stack});return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var v=y(function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map(function(t,e){return e+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}});function b(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var w=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var t,e,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=c(o),a=s.next();!a.done;a=s.next()){a.value.remove(this)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}else o.remove(this);var u=this.initialTeardown;if(m(u))try{u()}catch(t){i=t instanceof v?t.errors:[t]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var p=c(d),f=p.next();!f.done;f=p.next()){var g=f.value;try{k(g)}catch(t){i=null!=i?i:[],t instanceof v?i=h(h([],l(i)),l(t.errors)):i.push(t)}}}catch(t){n={error:t}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}}if(i)throw new v(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)k(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&b(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&b(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),x=w.EMPTY;function T(t){return t instanceof w||t&&"closed"in t&&m(t.remove)&&m(t.add)&&m(t.unsubscribe)}function k(t){m(t)?t():t.unsubscribe()}var S={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},A={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=A.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,h([t,e],l(n))):setTimeout.apply(void 0,h([t,e],l(n)))},clearTimeout:function(t){var e=A.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function E(t){A.setTimeout(function(){var e=S.onUnhandledError;if(!e)throw t;e(t)})}function O(){}var C=M("C",void 0,void 0);function M(t,e,n){return{kind:t,value:e,error:n}}var N=null;function I(t){if(S.useDeprecatedSynchronousErrorHandling){var e=!N;if(e&&(N={errorThrown:!1,error:null}),t(),e){var n=N,r=n.errorThrown,i=n.error;if(N=null,r)throw i}}else t()}var j=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,T(e)&&e.add(n)):n.destination=B,n}return o(e,t),e.create=function(t,e,n){return new L(t,e,n)},e.prototype.next=function(t){this.isStopped?$(function(t){return M("N",t,void 0)}(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?$(M("E",void 0,t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?$(C,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(w),R=Function.prototype.bind;function P(t,e){return R.call(t,e)}var D=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){F(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){F(t)}else F(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){F(t)}},t}(),L=function(t){function e(e,n,r){var i,o,s=t.call(this)||this;m(e)||!e?i={next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&S.useDeprecatedNextContext?((o=Object.create(e)).unsubscribe=function(){return s.unsubscribe()},i={next:e.next&&P(e.next,o),error:e.error&&P(e.error,o),complete:e.complete&&P(e.complete,o)}):i=e;return s.destination=new D(i),s}return o(e,t),e}(j);function F(t){var e;S.useDeprecatedSynchronousErrorHandling?(e=t,S.useDeprecatedSynchronousErrorHandling&&N&&(N.errorThrown=!0,N.error=e)):E(t)}function $(t,e){var n=S.onStoppedNotification;n&&A.setTimeout(function(){return n(t,e)})}var B={closed:!0,next:O,error:function(t){throw t},complete:O};function q(t,e,n,r,i){return new U(t,e,n,r,i)}var U=function(t){function e(e,n,r,i,o,s){var a=t.call(this,e)||this;return a.onFinalize=o,a.shouldUnsubscribe=s,a._next=n?function(t){try{n(t)}catch(t){e.error(t)}}:t.prototype._next,a._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,a._complete=r?function(){try{r()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,a}return o(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(j);function V(t,e){return g(function(n,r){var i=0;n.subscribe(q(r,function(n){r.next(t.call(e,n,i++))}))})}var G=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function z(t){return m(null==t?void 0:t.then)}var W="function"==typeof Symbol&&Symbol.observable||"@@observable";function J(t){return t}function H(t){return 0===t.length?J:1===t.length?t[0]:function(e){return t.reduce(function(t,e){return e(t)},e)}}var X=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r,i=this,o=(r=t)&&r instanceof j||function(t){return t&&m(t.next)&&m(t.error)&&m(t.complete)}(r)&&T(r)?t:new L(t,e,n);return I(function(){var t=i,e=t.operator,n=t.source;o.add(e?e.call(o,n):n?i._subscribe(o):i._trySubscribe(o))}),o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=K(e))(function(e,r){var i=new L({next:function(e){try{t(e)}catch(t){r(t),i.unsubscribe()}},error:r,complete:e});n.subscribe(i)})},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[W]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return H(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=K(t))(function(t,n){var r;e.subscribe(function(t){return r=t},function(t){return n(t)},function(){return t(r)})})},t.create=function(e){return new t(e)},t}();function K(t){var e;return null!==(e=null!=t?t:S.Promise)&&void 0!==e?e:Promise}function Q(t){return m(t[W])}function Z(t){return Symbol.asyncIterator&&m(null==t?void 0:t[Symbol.asyncIterator])}function Y(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var tt="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function et(t){return m(null==t?void 0:t[tt])}function nt(t){return p(this,arguments,function(){var e,n,r;return u(this,function(i){switch(i.label){case 0:e=t.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,d(e.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,d(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,d(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function rt(t){return m(null==t?void 0:t.getReader)}function it(t){if(t instanceof X)return t;if(null!=t){if(Q(t))return i=t,new X(function(t){var e=i[W]();if(m(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(G(t))return r=t,new X(function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()});if(z(t))return n=t,new X(function(t){n.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,E)});if(Z(t))return ot(t);if(et(t))return e=t,new X(function(t){var n,r;try{for(var i=c(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()});if(rt(t))return ot(nt(t))}var e,n,r,i;throw Y(t)}function ot(t){return new X(function(e){(function(t,e){var n,r,i,o;return a(this,void 0,void 0,function(){var s,a;return u(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),n=f(t),u.label=1;case 1:return[4,n.next()];case 2:if((r=u.sent()).done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=u.sent(),i={error:a},[3,11];case 6:return u.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})})(t,e).catch(function(t){return e.error(t)})})}function st(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=e.schedule(function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(o),!i)return o}function at(t,e,n){return void 0===n&&(n=1/0),m(e)?at(function(n,r){return V(function(t,i){return e(n,t,r,i)})(it(t(n,r)))},n):("number"==typeof e&&(n=e),g(function(e,r){return function(t,e,n,r,i,o,s,a){var u=[],c=0,l=0,h=!1,d=function(){!h||u.length||c||e.complete()},p=function(t){return c<r?f(t):u.push(t)},f=function(t){o&&e.next(t),c++;var a=!1;it(n(t,l++)).subscribe(q(e,function(t){null==i||i(t),o?p(t):e.next(t)},function(){a=!0},void 0,function(){if(a)try{c--;for(var t=function(){var t=u.shift();s?st(e,s,function(){return f(t)}):f(t)};u.length&&c<r;)t();d()}catch(t){e.error(t)}}))};return t.subscribe(q(e,p,function(){h=!0,d()})),function(){null==a||a()}}(e,r,t,n)}))}function ut(t){return void 0===t&&(t=1/0),at(J,t)}function ct(t){return t&&m(t.schedule)}function lt(t){return t[t.length-1]}function ht(t){return m(lt(t))?t.pop():void 0}function dt(t){return ct(lt(t))?t.pop():void 0}function pt(t,e){return"number"==typeof lt(t)?t.pop():e}function ft(t,e){return void 0===e&&(e=0),g(function(n,r){n.subscribe(q(r,function(n){return st(r,t,function(){return r.next(n)},e)},function(){return st(r,t,function(){return r.complete()},e)},function(n){return st(r,t,function(){return r.error(n)},e)}))})}function mt(t,e){return void 0===e&&(e=0),g(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function gt(t,e){if(!t)throw new Error("Iterable cannot be null");return new X(function(n){st(n,e,function(){var r=t[Symbol.asyncIterator]();st(n,e,function(){r.next().then(function(t){t.done?n.complete():n.next(t.value)})},0,!0)})})}function _t(t,e){if(null!=t){if(Q(t))return function(t,e){return it(t).pipe(mt(e),ft(e))}(t,e);if(G(t))return function(t,e){return new X(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}(t,e);if(z(t))return function(t,e){return it(t).pipe(mt(e),ft(e))}(t,e);if(Z(t))return gt(t,e);if(et(t))return function(t,e){return new X(function(n){var r;return st(n,e,function(){r=t[tt](),st(n,e,function(){var t,e,i;try{e=(t=r.next()).value,i=t.done}catch(t){return void n.error(t)}i?n.complete():n.next(e)},0,!0)}),function(){return m(null==r?void 0:r.return)&&r.return()}})}(t,e);if(rt(t))return function(t,e){return gt(nt(t),e)}(t,e)}throw Y(t)}function yt(t,e){return e?_t(t,e):it(t)}Array.isArray;var vt=new X(function(t){return t.complete()});var bt=Array.isArray,wt=Object.getPrototypeOf,xt=Object.prototype,Tt=Object.keys;function kt(t){if(1===t.length){var e=t[0];if(bt(e))return{args:e,keys:null};if((r=e)&&"object"==typeof r&&wt(r)===xt){var n=Tt(e);return{args:n.map(function(t){return e[t]}),keys:n}}}var r;return{args:t,keys:null}}var St=Array.isArray;function At(t){return V(function(e){return function(t,e){return St(e)?t.apply(void 0,h([],l(e))):t(e)}(t,e)})}function Et(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=dt(t),r=ht(t),i=kt(t),o=i.args,s=i.keys;if(0===o.length)return yt([],n);var a=new X(Ot(o,n,s?function(t){return function(t,e){return t.reduce(function(t,n,r){return t[n]=e[r],t},{})}(s,t)}:J));return r?a.pipe(At(r)):a}function Ot(t,e,n){return void 0===n&&(n=J),function(r){Ct(e,function(){for(var i=t.length,o=new Array(i),s=i,a=i,u=function(i){Ct(e,function(){var u=yt(t[i],e),c=!1;u.subscribe(q(r,function(t){o[i]=t,c||(c=!0,a--),a||r.next(n(o.slice()))},function(){--s||r.complete()}))},r)},c=0;c<i;c++)u(c)},r)}}function Ct(t,e,n){t?st(n,t,e):e()}function Mt(){return ut(1)}function Nt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=ht(t);return g(function(e,r){for(var i=t.length,o=new Array(i),s=t.map(function(){return!1}),a=!1,u=function(e){it(t[e]).subscribe(q(r,function(t){o[e]=t,a||s[e]||(s[e]=!0,(a=s.every(J))&&(s=null))},O))},c=0;c<i;c++)u(c);e.subscribe(q(r,function(t){if(a){var e=h([t],l(o));r.next(n?n.apply(void 0,h([],l(e))):e)}}))})}function It(t,e){return g(function(n,r){var i=null,o=0,s=!1,a=function(){return s&&!i&&r.complete()};n.subscribe(q(r,function(n){null==i||i.unsubscribe();var s=0,u=o++;it(t(n,u)).subscribe(i=q(r,function(t){return r.next(e?e(n,t,u,s++):t)},function(){i=null,a()}))},function(){s=!0,a()}))})}function jt(t){return g(function(e,n){it(t).subscribe(q(n,function(){return n.complete()},O)),!n.closed&&e.subscribe(n)})}var Rt=y(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Pt=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return o(e,t),e.prototype.lift=function(t){var e=new Dt(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new Rt},e.prototype.next=function(t){var e=this;I(function(){var n,r;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=c(e.currentObservers),o=i.next();!o.done;o=i.next()){o.value.next(t)}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},e.prototype.error=function(t){var e=this;I(function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var n=e.observers;n.length;)n.shift().error(t)}})},e.prototype.complete=function(){var t=this;I(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?x:(this.currentObservers=null,o.push(t),new w(function(){e.currentObservers=null,b(o,t)}))},e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e.thrownError,i=e.isStopped;n?t.error(r):i&&t.complete()},e.prototype.asObservable=function(){var t=new X;return t.source=this,t},e.create=function(t,e){return new Dt(t,e)},e}(X),Dt=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return o(e,t),e.prototype.next=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===n||n.call(e,t)},e.prototype.error=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===n||n.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,n;return null!==(n=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==n?n:x},e}(Pt);function Lt(t){void 0===t&&(t={});var e=t.connector,n=void 0===e?function(){return new Pt}:e,r=t.resetOnError,i=void 0===r||r,o=t.resetOnComplete,s=void 0===o||o,a=t.resetOnRefCountZero,u=void 0===a||a;return function(t){var e,r,o,a=0,c=!1,l=!1,h=function(){null==r||r.unsubscribe(),r=void 0},d=function(){h(),e=o=void 0,c=l=!1},p=function(){var t=e;d(),null==t||t.unsubscribe()};return g(function(t,f){a++,l||c||h();var m=o=null!=o?o:n();f.add(function(){0!==--a||l||c||(r=Ft(p,u))}),m.subscribe(f),!e&&a>0&&(e=new L({next:function(t){return m.next(t)},error:function(t){l=!0,h(),r=Ft(d,i,t),m.error(t)},complete:function(){c=!0,h(),r=Ft(d,s),m.complete()}}),it(t).subscribe(e))})(t)}}function Ft(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!0!==e){if(!1!==e){var i=new L({next:function(){i.unsubscribe(),t()}});return it(e.apply(void 0,h([],l(n)))).subscribe(i)}}else t()}function $t(t,e){return g(function(n,r){var i=0;n.subscribe(q(r,function(n){return t.call(e,n,i++)&&r.next(n)}))})}function Bt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=dt(t),r=pt(t,1/0),i=t;return i.length?1===i.length?it(i[0]):ut(r)(yt(i,n)):vt}var qt=function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}return o(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return!n.closed&&e.next(this._value),n},e.prototype.getValue=function(){var t=this,e=t.hasError,n=t.thrownError,r=t._value;if(e)throw n;return this._throwIfClosed(),r},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(Pt);const Ut="https://gdb.leafgon.com/sgraphql",Vt="wss://gdb.leafgon.com/sgraphql",Gt="https://gdb.leafgon.com/qmgraphql",zt={breezyforest:{_version:"1.0",_nickname:"breezyforest",scaffold:{map:{leaf:{logic:{type:"",args:{}},provenance:{api:"breezyforest",uuid:"",graph:{appuuid:"",name:"",version:""}},appdata:{}}},directory:{api:["leaf","api"],logic:["leaf","logic"],type:["leaf","logic","type"],args:["leaf","logic","args"],provenance:["leaf","provenance"],uuid:["leaf","provenance","uuid"],leafapp:["leaf","provenance","leafapp"],appdata:["leaf","appdata"]},fetch:(t,e)=>{const n=(t,e)=>{const r=e[0],i=e.slice(1);return 0===i.length?t[r]:n(t[r],i)};try{return n(t,Array.isArray(e)?e:zt.breezyforest.scaffold.directory[e])}catch(t){return null}}},originType:{FRONTEND:1,BACKEND:2,SCREEN:4},subsDirectory:{readmefirst:{},leaflake:{bridges:{gql:"clientconfig_full"}},appintent:{},appmodel:{},appview:{},osview:{},osview2:{},dataflowplane:{},appcache:{}},IOAccessPermission:{Owner:1,Observer:2,Contributor:4,All:7},IOStateGroundZero:{dirOfSubjects:{},subsCache:{},subscriptions:{},callbacks:{},permissions:{}},GQLParameters:{clientconfig_full:{keepGQLConnected:!0,dburi_subs:Ut,dburi_subs_ws:Vt,dburi_qm:Gt},clientconfig_sub:{keepGQLConnected:!0,dburi_subs:Ut,dburi_subs_ws:Vt},clientconfig_qm:{dburi_qm:Gt},masterquery:"\n {\n domain\n appid\n nodes {\n uuid\n out_edges {uuid source {uuid} target {uuid} data}\n data\n }\n update {\n added {uuid out_edges {uuid source {uuid} target {uuid} data} data} \n removed {uuid}\n }\n }\n ".replace(/\s+/g," ")},LEAFdictionary:{map:V}}},Wt=t=>{const e={leafradioRX:{leaf:{logic:{type:"leafradioRX",args:{keyname:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["keyname"],bannednames:["Lambda"],banduplicatename:!0,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafradioRX.svg",width:40,height:30,bgColor:"rgba(235,255,35,0.2)",jsx:void 0}},lambdaports:{input:void 0,output:void 0},dataflow:{input:void 0,output:{_leafradiokey:{keyname:"",subsDirectory:Object},_leafradiorx:{txkey:"",payload:Object}}}},leafradioTX:{leaf:{logic:{type:"leafradioTX",args:{keyname:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["keyname"],bannednames:["Lambda"],banduplicatename:!1,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafradioTX.svg",width:40,height:30,bgColor:"rgba(135,255,135,0.2)",jsx:void 0}},lambdaports:{input:void 0,output:void 0},dataflow:{input:{_leafradiokey:{keyname:"",subsDirectory:Object},_leafradiotx:{txkey:"",payload:Object}},output:void 0}},leafoutflowport:{leaf:{logic:{type:"leafoutflowport",args:{}}},editorconfig:{nodetype:"tinynode",svgicon:{unicode:"⊖",url:void 0,jsx:void 0,fgColor:"rgba(255,255,255,1)",bgColor:"rgba(22,22,55,1)"}},lambdaports:{input:void 0,output:void 0},dataflow:{input:Object,output:void 0}},leafinflowport:{leaf:{logic:{type:"leafinflowport",args:{}}},editorconfig:{nodetype:"tinynode",svgicon:{unicode:"⊕",url:void 0,jsx:void 0,fgColor:"rgba(255,255,255,1)",bgColor:"rgba(55,22,22,1)"}},lambdaports:{input:void 0,output:void 0},dataflow:{input:void 0,output:Object}},leafmemoryio:{leaf:{logic:{type:"leafmemoryio",args:{elementconfig:{leafnodename:""},persistencyref:{updateref:"",dbref:""}}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["elementconfig","leafnodename"],banduplicatename:!1,banmultiplenode:!1,svgicon:{iconname:"memory io",unicode:void 0,url:"leafmemoryio.svg",jsx:void 0,width:40,height:40,bgColor:"rgba(255,255,255,0.6)"}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leafdeckdiamond:Object,_leafdeckclub:Object},output:{_leafdeckheart:Object}}},leafscreenio:{leaf:{logic:{type:"leafscreenio",args:{lispexpression:""}}},editorconfig:{nodetype:"circularnode",banduplicatename:!1,banmultiplenode:!1,svgicon:{iconname:"screen io",unicode:void 0,url:"leafscreenio.svg",jsx:void 0,width:40,height:40,bgColor:"rgba(205,155,215,0.6)"}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leaflisp_in:Object},output:{_leaflisp_out:Object}}},leafdeckspade:{leaf:{logic:{type:"leafdeckspade",args:{elementconfig:{leafnodename:""}}}},editorconfig:{nodetype:"circularnode",namedatakey:["elementconfig","leafnodename"],banmultiplenode:!0,svgicon:{unicode:void 0,url:"leafspade.svg",jsx:void 0}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leafdeckdiamond:Object,_leafdeckclub:Object},output:{_leafdeckspade:Object}}},leafdeckheart:{leaf:{logic:{type:"leafdeckheart",args:{elementconfig:{leafnodename:""}}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["elementconfig","leafnodename"],banduplicatename:!0,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafheart.svg",jsx:void 0}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leafdeckdiamond:Object,_leafdeckclub:Object},output:{_leafdeckheart:Object}}},leafdeckdiamond:{leaf:{logic:{type:"leafdeckdiamond",args:{elementconfig:{leafnodename:""}}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["elementconfig","leafnodename"],svgicon:{unicode:void 0,url:"diamond2.svg",jsx:void 0}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leafdeckclub:Object},output:{_leafdeckdiamond:Object}}},leafdeckclub:{leaf:{logic:{type:"leafdeckclub",args:{elementconfig:{leafnodename:""}}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["elementconfig","leafnodename"],svgicon:{unicode:void 0,url:"club3.svg",jsx:void 0}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leafdeckclubinit:Object},output:{_leafdeckclub:Object}}},leafelement:{leaf:{logic:{type:"leafelement",args:{elementname:"",svgicon:{unicode:void 0,url:"",jsx:Object},elementconfig:""}}},editorconfig:{nodetype:"circularnamednode",is_committable:!0,namedatakey:["elementname"],allowednames:["gnav","popup","editor","text","prompt","http","href","mediaplayer","image","mediainput","midi","sound","html","form","directus","openai","rancher"],banduplicatename:!1,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafelement.svg",width:40,height:40,bgColor:"rgba(35,5,15,0.7)",fgColor:"rgba(255,255,255,1)",jsx:void 0}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafgraph:{leaf:{logic:{type:"leafgraph",args:{graphuuid:"",domain:"",appid:"",graphaddrstr:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["graphaddrstr"],svgicon:{unicode:"✵",url:void 0,jsx:void 0,fgColor:"rgba(255,255,255,1.0)",bgColor:"rgba(220,02,100, 0.5)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leaflambdagraph:{leaf:{logic:{type:"leaflambdagraph",args:{}}},editorconfig:{nodetype:"circularnode",svgicon:{iconname:"contextual lambda",unicode:"λ",url:void 0,jsx:void 0,fgColor:"rgba(255,255,255,1.0)",bgColor:"rgba(0,0,0,0.5)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafanchor:{leaf:{logic:{type:"leafanchor",args:{}}},editorconfig:{nodetype:"tinynode",svgicon:{unicode:void 0,url:"trident_white.svg",width:15,height:15,jsx:void 0,fgColor:"rgba(255,255,255,1)",bgColor:"rgba(102, 102, 255, 1)"}},lambdaports:{input:void 0,output:void 0},dataflow:{input:void 0,output:void 0}},leafspelldef:{leaf:{logic:{type:"leafspelldef",args:{spellname:"",svgicon:{unicode:void 0,url:"",jsx:Object}}}},editorconfig:{nodetype:"rectangularnamednode",namedatakey:["spellname"],banduplicatename:!0,svgicon:{iconname:"spelldef",unicode:void 0,url:"leafspell.svg",jsx:void 0,bgColor:"rgba(80,80,135,0.8)",fgColor:"rgba(250,250,250,1.0)",width:40,height:30}},lambdaports:{input:Object,output:void 0},dataflow:{input:void 0,output:void 0}},leafspell:{leaf:{logic:{type:"leafspell",args:{spellname:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["spellname"],svgicon:{unicode:void 0,url:"leafloopyspell.svg",jsx:void 0,bgColor:"rgba(80,180,135,0.8)",fgColor:"rgba(250,250,250,1.0)",width:40,height:30}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafloopyspell:{leaf:{logic:{type:"leafloopyspell",args:{}}},editorconfig:{nodetype:"rectangularnode",banduplicatename:!0,svgicon:{iconname:"loopy spell",unicode:void 0,url:"leafloopyspell.svg",jsx:void 0,bgColor:"rgba(80,180,135,0.8)",fgColor:"rgba(250,250,250,1.0)",width:40,height:30}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafsyncflow:{leaf:{logic:{type:"leafsyncflow",args:{}}},fconfig:{inputsync:{combineOperator:"combine"}},editorconfig:{nodetype:"circularnode",svgicon:{unicode:void 0,iconname:"sync",url:"leafsyncflow.svg",jsx:void 0,bgColor:"rgba(80,200,255,1.0)",width:40,height:40}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafchronosflow:{leaf:{logic:{type:"leafchronosflow",args:{}}},fconfig:{inputsync:{combineOperator:"combine"}},editorconfig:{nodetype:"circularnode",svgicon:{unicode:void 0,iconname:"Chronos",url:"leafsyncflow.svg",jsx:void 0,bgColor:"rgba(80,200,255,1.0)",width:40,height:40}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafasyncflow:{leaf:{logic:{type:"leafasyncflow",args:{}}},fconfig:{inputsync:{combineOperator:"combine"}},editorconfig:{nodetype:"circularnode",svgicon:{unicode:void 0,iconname:"async",url:"leafsyncflow.svg",jsx:void 0,bgColor:"rgba(80,200,255,1.0)",width:40,height:40}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafmixflow:{leaf:{logic:{type:"leafmixflow",args:{mixOperator:"merge"}}},fconfig:{inputsync:void 0},editorconfig:{nodetype:"circularnode",svgicon:{iconname:"mix",unicode:void 0,url:"leafmixflow.svg",jsx:void 0,bgColor:"rgba(80,150,255,0.8)",width:40,height:40}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafgateflow:{leaf:{logic:{type:"leafgateflow",args:{keyname:"",notgatetoggle:!1}}},fconfig:{inputsync:{combineOperator:"merge"}},editorconfig:{nodetype:"circularnamedboolnode",namedatakey:["keyname"],toggledatakey:["notgatetoggle"],svgicon:{unicode:void 0,url:"leafgate.svg",jsx:void 0,width:40,height:30,bgColor0:"rgba(135,55,135,0.2)",bgColor1:"rgba(35,255,135,0.2)",toggleSymbol0:"⊜",toggleSymbol1:"≠"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leaflabel:{leaf:{logic:{type:"leaflabel",args:{labelstr:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["labelstr"],svgicon:{unicode:void 0,url:"leaflabel.svg",jsx:void 0,width:40,height:30,bgColor:"rgba(165,55,185,0.7)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafdelabel:{leaf:{logic:{type:"leafdelabel",args:{labelstr:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["labelstr"],svgicon:{unicode:void 0,url:"leafdelabel.svg",jsx:void 0,width:40,height:30,bgColor:"rgba(235,55,135,0.7)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafbottle:{leaf:{logic:{type:"leafbottle",args:{bottlekey:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["bottlekey"],banduplicatename:!1,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafbottle.svg",jsx:void 0,width:40,height:30,bgColor:"rgba(135,255,135,0.2)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafunbottle:{leaf:{logic:{type:"leafunbottle",args:{bottlekey:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["bottlekey"],banduplicatename:!1,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafunbottle.svg",jsx:void 0,width:40,height:30,bgColor:"rgba(255,155,215,0.4)"}},lambdaports:{input:void 0,output:Object},dataflow:{input:Object,output:Object}},leafcrate:{leaf:{logic:{type:"leafcrate",args:{}}},editorconfig:{nodetype:"circularnode",svgicon:{iconname:"{crate}",unicode:void 0,url:"leafcrate.svg",jsx:void 0,width:40,height:40,bgColor:"rgba(155,205,85,0.7)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafconfig:{leaf:{logic:{type:"leafconfig",args:{}}},editorconfig:{nodetype:"rectangularnode",banmultiplenode:!0,svgicon:{iconname:"config",unicode:void 0,url:"leafconfig.svg",jsx:void 0,width:40,height:40,bgColor:"rgba(255,205,85,1.0)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leaflisp:{leaf:{logic:{type:"leaflisp",args:{lispexpression:""}}},editorconfig:{nodetype:"circularnode",svgicon:{iconname:"leaflisp",unicode:void 0,url:"leaflisp.svg",jsx:void 0,width:40,height:40,bgColor:"rgba(205,255,215,0.7)"}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leaflisp_in:Object},output:{_leaflisp_out:Object}}}};return void 0===t?e:t in e?e[t]:void 0},Jt={outport:"leafoutflowport",inport:"leafinflowport",screenio:"leafscreenio",memoryio:"leafmemoryio",spade:"leafdeckspade",heart:"leafdeckheart",diamond:"leafdeckdiamond",club:"leafdeckclub",element:"leafelement",anchor:"leafanchor",leafgraph:"leafgraph",lambda:"leaflambdagraph",spelldef:"leafspelldef",spell:"leafspell",loopyspell:"leafloopyspell",label:"leaflabel",delabel:"leafdelabel",bottle:"leafbottle",unbottle:"leafunbottle",crate:"leafcrate",config:"leafconfig",chronos:"leafchronosflow",async:"leafasyncflow",sync:"leafsyncflow",mix:"leafmixflow",gate:"leafgateflow",leaflisp:"leaflisp"},Ht={io:["leafradioRX","leafradioTX","leafoutflowport","leafinflowport","leafscreenio","leafmemoryio"],elements:["leafdeckspade","leafdeckheart","leafdeckdiamond","leafdeckclub","leafelement"],abstraction:["leafgraph","leaflambdagraph","leafspelldef","leafspell","leafloopyspell"],dataflow:["leaflabel","leafdelabel","leafbottle","leafunbottle","leafcrate"],arcane:["leaflisp"]},Xt={leaflambdaedge:{sourceHandle:"out_aux",targetHandle:"in_aux"},leafanchoredge:{sourceHandle:"out_anchor",targetHandle:"in_anchor"},leafdataedge:{sourceHandle:"out_a",targetHandle:"in_a"}},Kt={leaflambdaedge:{stroke:"#fff",fillOpacity:0},leafanchoredge:{stroke:"#88f",fillOpacity:0},leafdataedge:{stroke:"#fff",fillOpacity:0}};var Qt=n(7007);let Zt=function(){const t=arguments[0];for(let e=1,n=arguments.length;e<n;e++)if(arguments[e])for(const n in arguments[e])t[n]=arguments[e][n];return t};function Yt(t,e,n,r){const i=t._nodes.get(e);let o=null;return i?(o="mixed"===r?i.out&&i.out[n]||i.undirected&&i.undirected[n]:"directed"===r?i.out&&i.out[n]:i.undirected&&i.undirected[n],o):o}function te(t){return"object"==typeof t&&null!==t}function ee(t){let e;for(e in t)return!1;return!0}function ne(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function re(t,e,n){const r={enumerable:!0,configurable:!0};"function"==typeof n?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(t,e,r)}function ie(t){return!!te(t)&&!(t.attributes&&!Array.isArray(t.attributes))}function oe(){const t=arguments;let e=null,n=-1;return{[Symbol.iterator](){return this},next(){let r=null;for(;;){if(null===e){if(n++,n>=t.length)return{done:!0};e=t[n][Symbol.iterator]()}if(r=e.next(),!r.done)break;e=null}return r}}}function se(){return{[Symbol.iterator](){return this},next:()=>({done:!0})}}"function"==typeof Object.assign&&(Zt=Object.assign);class ae extends Error{constructor(t){super(),this.name="GraphError",this.message=t}}class ue extends ae{constructor(t){super(t),this.name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,ue.prototype.constructor)}}class ce extends ae{constructor(t){super(t),this.name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,ce.prototype.constructor)}}class le extends ae{constructor(t){super(t),this.name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,le.prototype.constructor)}}function he(t,e){this.key=t,this.attributes=e,this.clear()}function de(t,e){this.key=t,this.attributes=e,this.clear()}function pe(t,e){this.key=t,this.attributes=e,this.clear()}function fe(t,e,n,r,i){this.key=e,this.attributes=i,this.undirected=t,this.source=n,this.target=r}he.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},de.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},pe.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},fe.prototype.attach=function(){let t="out",e="in";this.undirected&&(t=e="undirected");const n=this.source.key,r=this.target.key;this.source[t][r]=this,this.undirected&&n===r||(this.target[e][n]=this)},fe.prototype.attachMulti=function(){let t="out",e="in";const n=this.source.key,r=this.target.key;this.undirected&&(t=e="undirected");const i=this.source[t],o=i[r];if(void 0===o)return i[r]=this,void(this.undirected&&n===r||(this.target[e][n]=this));o.previous=this,this.next=o,i[r]=this,this.target[e][n]=this},fe.prototype.detach=function(){const t=this.source.key,e=this.target.key;let n="out",r="in";this.undirected&&(n=r="undirected"),delete this.source[n][e],delete this.target[r][t]},fe.prototype.detachMulti=function(){const t=this.source.key,e=this.target.key;let n="out",r="in";this.undirected&&(n=r="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][e],delete this.target[r][t]):(this.next.previous=void 0,this.source[n][e]=this.next,this.target[r][t]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};function me(t,e,n,r,i,o,s){let a,u,c,l;if(r=""+r,0===n){if(a=t._nodes.get(r),!a)throw new ce(`Graph.${e}: could not find the "${r}" node in the graph.`);c=i,l=o}else if(3===n){if(i=""+i,u=t._edges.get(i),!u)throw new ce(`Graph.${e}: could not find the "${i}" edge in the graph.`);const n=u.source.key,h=u.target.key;if(r===n)a=u.target;else{if(r!==h)throw new ce(`Graph.${e}: the "${r}" node is not attached to the "${i}" edge (${n}, ${h}).`);a=u.source}c=o,l=s}else{if(u=t._edges.get(r),!u)throw new ce(`Graph.${e}: could not find the "${r}" edge in the graph.`);a=1===n?u.source:u.target,c=i,l=o}return[a,c,l]}const ge=[{name:t=>`get${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=me(this,e,n,t,r,i);return o.attributes[s]}}},{name:t=>`get${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r){const[i]=me(this,e,n,t,r);return i.attributes}}},{name:t=>`has${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=me(this,e,n,t,r,i);return o.attributes.hasOwnProperty(s)}}},{name:t=>`set${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i,o){const[s,a,u]=me(this,e,n,t,r,i,o);return s.attributes[a]=u,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:a}),this}}},{name:t=>`update${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i,o){const[s,a,u]=me(this,e,n,t,r,i,o);if("function"!=typeof u)throw new ue(`Graph.${e}: updater should be a function.`);const c=s.attributes,l=u(c[a]);return c[a]=l,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:a}),this}}},{name:t=>`remove${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=me(this,e,n,t,r,i);return delete o.attributes[s],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:s}),this}}},{name:t=>`replace${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=me(this,e,n,t,r,i);if(!te(s))throw new ue(`Graph.${e}: provided attributes are not a plain object.`);return o.attributes=s,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}},{name:t=>`merge${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=me(this,e,n,t,r,i);if(!te(s))throw new ue(`Graph.${e}: provided attributes are not a plain object.`);return Zt(o.attributes,s),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:s}),this}}},{name:t=>`update${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=me(this,e,n,t,r,i);if("function"!=typeof s)throw new ue(`Graph.${e}: provided updater is not a function.`);return o.attributes=s(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}}];const _e=[{name:t=>`get${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Yt(this,o,s,n),!i)throw new ce(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return i.attributes[r]}}},{name:t=>`get${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t){let r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const i=""+t,o=""+arguments[1];if(r=Yt(this,i,o,n),!r)throw new ce(`Graph.${e}: could not find an edge for the given path ("${i}" - "${o}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,r=this._edges.get(t),!r)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return r.attributes}}},{name:t=>`has${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Yt(this,o,s,n),!i)throw new ce(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return i.attributes.hasOwnProperty(r)}}},{name:t=>`set${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){let o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+t,a=""+r;if(r=arguments[2],i=arguments[3],o=Yt(this,s,a,n),!o)throw new ce(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,o=this._edges.get(t),!o)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return o.attributes[r]=i,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}},{name:t=>`update${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){let o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+t,a=""+r;if(r=arguments[2],i=arguments[3],o=Yt(this,s,a,n),!o)throw new ce(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,o=this._edges.get(t),!o)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if("function"!=typeof i)throw new ue(`Graph.${e}: updater should be a function.`);return o.attributes[r]=i(o.attributes[r]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}},{name:t=>`remove${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Yt(this,o,s,n),!i)throw new ce(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return delete i.attributes[r],this.emit("edgeAttributesUpdated",{key:i.key,type:"remove",attributes:i.attributes,name:r}),this}}},{name:t=>`replace${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Yt(this,o,s,n),!i)throw new ce(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if(!te(r))throw new ue(`Graph.${e}: provided attributes are not a plain object.`);return i.attributes=r,this.emit("edgeAttributesUpdated",{key:i.key,type:"replace",attributes:i.attributes}),this}}},{name:t=>`merge${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Yt(this,o,s,n),!i)throw new ce(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if(!te(r))throw new ue(`Graph.${e}: provided attributes are not a plain object.`);return Zt(i.attributes,r),this.emit("edgeAttributesUpdated",{key:i.key,type:"merge",attributes:i.attributes,data:r}),this}}},{name:t=>`update${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Yt(this,o,s,n),!i)throw new ce(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if("function"!=typeof r)throw new ue(`Graph.${e}: provided updater is not a function.`);return i.attributes=r(i.attributes),this.emit("edgeAttributesUpdated",{key:i.key,type:"update",attributes:i.attributes}),this}}}];const ye=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function ve(t,e,n,r){let i=!1;for(const o in e){if(o===r)continue;const s=e[o];if(i=n(s.key,s.attributes,s.source.key,s.target.key,s.source.attributes,s.target.attributes,s.undirected),t&&i)return s.key}}function be(t,e,n,r){let i,o,s,a=!1;for(const u in e)if(u!==r){i=e[u];do{if(o=i.source,s=i.target,a=n(i.key,i.attributes,o.key,s.key,o.attributes,s.attributes,i.undirected),t&&a)return i.key;i=i.next}while(void 0!==i)}}function we(t,e){const n=Object.keys(t),r=n.length;let i,o=0;return{[Symbol.iterator](){return this},next(){do{if(i)i=i.next;else{if(o>=r)return{done:!0};const s=n[o++];if(s===e){i=void 0;continue}i=t[s]}}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function xe(t,e,n,r){const i=e[n];if(!i)return;const o=i.source,s=i.target;return r(i.key,i.attributes,o.key,s.key,o.attributes,s.attributes,i.undirected)&&t?i.key:void 0}function Te(t,e,n,r){let i=e[n];if(!i)return;let o=!1;do{if(o=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),t&&o)return i.key;i=i.next}while(void 0!==i)}function ke(t,e){let n=t[e];if(void 0!==n.next)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};const t={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:t}}};let r=!1;return{[Symbol.iterator](){return this},next:()=>!0===r?{done:!0}:(r=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}})}}function Se(t,e,n,r){if(0===e.size)return;const i="mixed"!==n&&n!==e.type,o="undirected"===n;let s,a,u=!1;const c=e._edges.values();for(;s=c.next(),!0!==s.done;){if(a=s.value,i&&a.undirected!==o)continue;const{key:e,attributes:n,source:c,target:l}=a;if(u=r(e,n,c.key,l.key,c.attributes,l.attributes,a.undirected),t&&u)return e}}function Ae(t,e,n,r,i,o){const s=e?be:ve;let a;if("undirected"!==n){if("out"!==r&&(a=s(t,i.in,o),t&&a))return a;if("in"!==r&&(a=s(t,i.out,o,r?void 0:i.key),t&&a))return a}if("directed"!==n&&(a=s(t,i.undirected,o),t&&a))return a}function Ee(t,e,n,r,i,o,s){const a=n?Te:xe;let u;if("undirected"!==e){if(void 0!==i.in&&"out"!==r&&(u=a(t,i.in,o,s),t&&u))return u;if(void 0!==i.out&&"in"!==r&&(r||i.key!==o)&&(u=a(t,i.out,o,s),t&&u))return u}if("directed"!==e&&void 0!==i.undirected&&(u=a(t,i.undirected,o,s),t&&u))return u}function Oe(t,e){const{name:n,type:r,direction:i}=e;t.prototype[n]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];if(!arguments.length)return function(t,e){if(0===t.size)return[];if("mixed"===e||e===t.type)return Array.from(t._edges.keys());const n="undirected"===e?t.undirectedSize:t.directedSize,r=new Array(n),i="undirected"===e,o=t._edges.values();let s,a,u=0;for(;s=o.next(),!0!==s.done;)a=s.value,a.undirected===i&&(r[u++]=a.key);return r}(this,r);if(1===arguments.length){t=""+t;const e=this._nodes.get(t);if(void 0===e)throw new ce(`Graph.${n}: could not find the "${t}" node in the graph.`);return function(t,e,n,r){const i=[];return Ae(!1,t,e,n,r,function(t){i.push(t)}),i}(this.multi,"mixed"===r?this.type:r,i,e)}if(2===arguments.length){t=""+t,e=""+e;const o=this._nodes.get(t);if(!o)throw new ce(`Graph.${n}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ce(`Graph.${n}: could not find the "${e}" target node in the graph.`);return function(t,e,n,r,i){const o=[];return Ee(!1,t,e,n,r,i,function(t){o.push(t)}),o}(r,this.multi,i,o,e)}throw new ue(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Ce(t,e){const{name:n,type:r,direction:i}=e,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return se();if(!arguments.length)return function(t,e){if(0===t.size)return se();const n="mixed"!==e&&e!==t.type,r="undirected"===e,i=t._edges.values();return{[Symbol.iterator](){return this},next(){let t,e;for(;;){if(t=i.next(),t.done)return t;if(e=t.value,!n||e.undirected===r)break}return{value:{edge:e.key,attributes:e.attributes,source:e.source.key,target:e.target.key,sourceAttributes:e.source.attributes,targetAttributes:e.target.attributes,undirected:e.undirected},done:!1}}}}(this,r);if(1===arguments.length){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.${o}: could not find the "${t}" node in the graph.`);return function(t,e,n){let r=se();return"undirected"!==t&&("out"!==e&&void 0!==n.in&&(r=oe(r,we(n.in))),"in"!==e&&void 0!==n.out&&(r=oe(r,we(n.out,e?void 0:n.key)))),"directed"!==t&&void 0!==n.undirected&&(r=oe(r,we(n.undirected))),r}(r,i,e)}if(2===arguments.length){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ce(`Graph.${o}: could not find the "${e}" target node in the graph.`);return function(t,e,n,r){let i=se();return"undirected"!==t&&(void 0!==n.in&&"out"!==e&&r in n.in&&(i=oe(i,ke(n.in,r))),void 0!==n.out&&"in"!==e&&r in n.out&&(e||n.key!==r)&&(i=oe(i,ke(n.out,r)))),"directed"!==t&&void 0!==n.undirected&&r in n.undirected&&(i=oe(i,ke(n.undirected,r))),i}(r,i,n,e)}throw new ue(`Graph.${o}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}const Me=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function Ne(){this.A=null,this.B=null}function Ie(t,e,n,r,i){for(const o in r){const s=r[o],a=s.source,u=s.target,c=a===n?u:a;if(e&&e.has(c.key))continue;const l=i(c.key,c.attributes);if(t&&l)return c.key}}function je(t,e,n,r,i){if("mixed"!==e){if("undirected"===e)return Ie(t,null,r,r.undirected,i);if("string"==typeof n)return Ie(t,null,r,r[n],i)}const o=new Ne;let s;if("undirected"!==e){if("out"!==n){if(s=Ie(t,null,r,r.in,i),t&&s)return s;o.wrap(r.in)}if("in"!==n){if(s=Ie(t,o,r,r.out,i),t&&s)return s;o.wrap(r.out)}}if("directed"!==e&&(s=Ie(t,o,r,r.undirected,i),t&&s))return s}function Re(t,e,n){const r=Object.keys(n),i=r.length;let o=0;return{[Symbol.iterator](){return this},next(){let s=null;do{if(o>=i)return t&&t.wrap(n),{done:!0};const a=n[r[o++]],u=a.source,c=a.target;s=u===e?c:u,t&&t.has(s.key)&&(s=null)}while(null===s);return{done:!1,value:{neighbor:s.key,attributes:s.attributes}}}}}function Pe(t,e){const{name:n,type:r,direction:i}=e;t.prototype[n]=function(t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];t=""+t;const e=this._nodes.get(t);if(void 0===e)throw new ce(`Graph.${n}: could not find the "${t}" node in the graph.`);return function(t,e,n){if("mixed"!==t){if("undirected"===t)return Object.keys(n.undirected);if("string"==typeof e)return Object.keys(n[e])}const r=[];return je(!1,t,e,n,function(t){r.push(t)}),r}("mixed"===r?this.type:r,i,e)}}function De(t,e){const{name:n,type:r,direction:i}=e,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return se();t=""+t;const e=this._nodes.get(t);if(void 0===e)throw new ce(`Graph.${o}: could not find the "${t}" node in the graph.`);return function(t,e,n){if("mixed"!==t){if("undirected"===t)return Re(null,n,n.undirected);if("string"==typeof e)return Re(null,n,n[e])}let r=se();const i=new Ne;return"undirected"!==t&&("out"!==e&&(r=oe(r,Re(i,n,n.in))),"in"!==e&&(r=oe(r,Re(i,n,n.out)))),"directed"!==t&&(r=oe(r,Re(i,n,n.undirected))),r}("mixed"===r?this.type:r,i,e)}}function Le(t,e,n,r,i){const o=r._nodes.values(),s=r.type;let a,u,c,l,h,d,p;for(;a=o.next(),!0!==a.done;){let r=!1;if(u=a.value,"undirected"!==s)for(c in l=u.out,l){h=l[c];do{if(d=h.target,r=!0,p=i(u.key,d.key,u.attributes,d.attributes,h.key,h.attributes,h.undirected),t&&p)return h;h=h.next}while(h)}if("directed"!==s)for(c in l=u.undirected,l)if(!(e&&u.key>c)){h=l[c];do{if(d=h.target,d.key!==c&&(d=h.source),r=!0,p=i(u.key,d.key,u.attributes,d.attributes,h.key,h.attributes,h.undirected),t&&p)return h;h=h.next}while(h)}if(n&&!r&&(p=i(u.key,null,u.attributes,null,null,null,null),t&&p))return null}}function Fe(t){if(!te(t))throw new ue('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in t))throw new ue("Graph.import: serialized node is missing its key.");if("attributes"in t&&(!te(t.attributes)||null===t.attributes))throw new ue("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function $e(t){if(!te(t))throw new ue('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in t))throw new ue("Graph.import: serialized edge is missing its source.");if(!("target"in t))throw new ue("Graph.import: serialized edge is missing its target.");if("attributes"in t&&(!te(t.attributes)||null===t.attributes))throw new ue("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in t&&"boolean"!=typeof t.undirected)throw new ue("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}Ne.prototype.wrap=function(t){null===this.A?this.A=t:null===this.B&&(this.B=t)},Ne.prototype.has=function(t){return null!==this.A&&t in this.A||null!==this.B&&t in this.B};const Be=function(){let t=255&Math.floor(256*Math.random());return()=>t++}(),qe=new Set(["directed","undirected","mixed"]),Ue=new Set(["domain","_events","_eventsCount","_maxListeners"]),Ve={allowSelfLoops:!0,multi:!1,type:"mixed"};function Ge(t,e,n){const r=new t.NodeDataClass(e,n);return t._nodes.set(e,r),t.emit("nodeAdded",{key:e,attributes:n}),r}function ze(t,e,n,r,i,o,s,a){if(!r&&"undirected"===t.type)throw new le(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&"directed"===t.type)throw new le(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(a&&!te(a))throw new ue(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`);if(o=""+o,s=""+s,a=a||{},!t.allowSelfLoops&&o===s)throw new le(`Graph.${e}: source & target are the same ("${o}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const u=t._nodes.get(o),c=t._nodes.get(s);if(!u)throw new ce(`Graph.${e}: source node "${o}" not found.`);if(!c)throw new ce(`Graph.${e}: target node "${s}" not found.`);const l={key:null,undirected:r,source:o,target:s,attributes:a};if(n)i=t._edgeKeyGenerator();else if(i=""+i,t._edges.has(i))throw new le(`Graph.${e}: the "${i}" edge already exists in the graph.`);if(!t.multi&&(r?void 0!==u.undirected[s]:void 0!==u.out[s]))throw new le(`Graph.${e}: an edge linking "${o}" to "${s}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const h=new fe(r,i,u,c,a);t._edges.set(i,h);const d=o===s;return r?(u.undirectedDegree++,c.undirectedDegree++,d&&(u.undirectedLoops++,t._undirectedSelfLoopCount++)):(u.outDegree++,c.inDegree++,d&&(u.directedLoops++,t._directedSelfLoopCount++)),t.multi?h.attachMulti():h.attach(),r?t._undirectedSize++:t._directedSize++,l.key=i,t.emit("edgeAdded",l),i}function We(t,e,n,r,i,o,s,a,u){if(!r&&"undirected"===t.type)throw new le(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&"directed"===t.type)throw new le(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(a)if(u){if("function"!=typeof a)throw new ue(`Graph.${e}: invalid updater function. Expecting a function but got "${a}"`)}else if(!te(a))throw new ue(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`);let c;if(o=""+o,s=""+s,u&&(c=a,a=void 0),!t.allowSelfLoops&&o===s)throw new le(`Graph.${e}: source & target are the same ("${o}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let l,h,d=t._nodes.get(o),p=t._nodes.get(s);if(!n&&(l=t._edges.get(i),l)){if(!(l.source.key===o&&l.target.key===s||r&&l.source.key===s&&l.target.key===o))throw new le(`Graph.${e}: inconsistency detected when attempting to merge the "${i}" edge with "${o}" source & "${s}" target vs. ("${l.source.key}", "${l.target.key}").`);h=l}if(h||t.multi||!d||(h=r?d.undirected[s]:d.out[s]),h){const e=[h.key,!1,!1,!1];if(u?!c:!a)return e;if(u){const e=h.attributes;h.attributes=c(e),t.emit("edgeAttributesUpdated",{type:"replace",key:h.key,attributes:h.attributes})}else Zt(h.attributes,a),t.emit("edgeAttributesUpdated",{type:"merge",key:h.key,attributes:h.attributes,data:a});return e}a=a||{},u&&c&&(a=c(a));const f={key:null,undirected:r,source:o,target:s,attributes:a};if(n)i=t._edgeKeyGenerator();else if(i=""+i,t._edges.has(i))throw new le(`Graph.${e}: the "${i}" edge already exists in the graph.`);let m=!1,g=!1;d||(d=Ge(t,o,{}),m=!0,o===s&&(p=d,g=!0)),p||(p=Ge(t,s,{}),g=!0),l=new fe(r,i,d,p,a),t._edges.set(i,l);const _=o===s;return r?(d.undirectedDegree++,p.undirectedDegree++,_&&(d.undirectedLoops++,t._undirectedSelfLoopCount++)):(d.outDegree++,p.inDegree++,_&&(d.directedLoops++,t._directedSelfLoopCount++)),t.multi?l.attachMulti():l.attach(),r?t._undirectedSize++:t._directedSize++,f.key=i,t.emit("edgeAdded",f),[i,!0,m,g]}function Je(t,e){t._edges.delete(e.key);const{source:n,target:r,attributes:i}=e,o=e.undirected,s=n===r;o?(n.undirectedDegree--,r.undirectedDegree--,s&&(n.undirectedLoops--,t._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,s&&(n.directedLoops--,t._directedSelfLoopCount--)),t.multi?e.detachMulti():e.detach(),o?t._undirectedSize--:t._directedSize--,t.emit("edgeDropped",{key:e.key,attributes:i,source:n.key,target:r.key,undirected:o})}class He extends Qt.EventEmitter{constructor(t){if(super(),"boolean"!=typeof(t=Zt({},Ve,t)).multi)throw new ue(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${t.multi}".`);if(!qe.has(t.type))throw new ue(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${t.type}".`);if("boolean"!=typeof t.allowSelfLoops)throw new ue(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${t.allowSelfLoops}".`);ne(this,"NodeDataClass","mixed"===t.type?he:"directed"===t.type?de:pe);const e="geid_"+Be()+"_";let n=0;ne(this,"_attributes",{}),ne(this,"_nodes",new Map),ne(this,"_edges",new Map),ne(this,"_directedSize",0),ne(this,"_undirectedSize",0),ne(this,"_directedSelfLoopCount",0),ne(this,"_undirectedSelfLoopCount",0),ne(this,"_edgeKeyGenerator",()=>{let t;do{t=e+n++}while(this._edges.has(t));return t}),ne(this,"_options",t),Ue.forEach(t=>ne(this,t,this[t])),re(this,"order",()=>this._nodes.size),re(this,"size",()=>this._edges.size),re(this,"directedSize",()=>this._directedSize),re(this,"undirectedSize",()=>this._undirectedSize),re(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),re(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),re(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),re(this,"multi",this._options.multi),re(this,"type",this._options.type),re(this,"allowSelfLoops",this._options.allowSelfLoops),re(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(t){return this._nodes.has(""+t)}hasDirectedEdge(t,e){if("undirected"===this.type)return!1;if(1===arguments.length){const e=""+t,n=this._edges.get(e);return!!n&&!n.undirected}if(2===arguments.length){t=""+t,e=""+e;const n=this._nodes.get(t);return!!n&&n.out.hasOwnProperty(e)}throw new ue(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(t,e){if("directed"===this.type)return!1;if(1===arguments.length){const e=""+t,n=this._edges.get(e);return!!n&&n.undirected}if(2===arguments.length){t=""+t,e=""+e;const n=this._nodes.get(t);return!!n&&n.undirected.hasOwnProperty(e)}throw new ue(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(t,e){if(1===arguments.length){const e=""+t;return this._edges.has(e)}if(2===arguments.length){t=""+t,e=""+e;const n=this._nodes.get(t);return!!n&&(void 0!==n.out&&n.out.hasOwnProperty(e)||void 0!==n.undirected&&n.undirected.hasOwnProperty(e))}throw new ue(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(t,e){if("undirected"===this.type)return;if(t=""+t,e=""+e,this.multi)throw new le("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const n=this._nodes.get(t);if(!n)throw new ce(`Graph.directedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ce(`Graph.directedEdge: could not find the "${e}" target node in the graph.`);const r=n.out&&n.out[e]||void 0;return r?r.key:void 0}undirectedEdge(t,e){if("directed"===this.type)return;if(t=""+t,e=""+e,this.multi)throw new le("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const n=this._nodes.get(t);if(!n)throw new ce(`Graph.undirectedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ce(`Graph.undirectedEdge: could not find the "${e}" target node in the graph.`);const r=n.undirected&&n.undirected[e]||void 0;return r?r.key:void 0}edge(t,e){if(this.multi)throw new le("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.edge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ce(`Graph.edge: could not find the "${e}" target node in the graph.`);const r=n.out&&n.out[e]||n.undirected&&n.undirected[e]||void 0;if(r)return r.key}areDirectedNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.areDirectedNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&(e in n.in||e in n.out)}areOutNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.areOutNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&e in n.out}areInNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.areInNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&e in n.in}areUndirectedNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.areUndirectedNeighbors: could not find the "${t}" node in the graph.`);return"directed"!==this.type&&e in n.undirected}areNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.areNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&(e in n.in||e in n.out)||"directed"!==this.type&&e in n.undirected}areInboundNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.areInboundNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&e in n.in||"directed"!==this.type&&e in n.undirected}areOutboundNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.areOutboundNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&e in n.out||"directed"!==this.type&&e in n.undirected}inDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.inDegree: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.inDegree}outDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.outDegree: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.outDegree}directedDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.directedDegree: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.inDegree+e.outDegree}undirectedDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.undirectedDegree: could not find the "${t}" node in the graph.`);return"directed"===this.type?0:e.undirectedDegree}inboundDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.inboundDegree: could not find the "${t}" node in the graph.`);let n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree),n}outboundDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.outboundDegree: could not find the "${t}" node in the graph.`);let n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.outDegree),n}degree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.degree: could not find the "${t}" node in the graph.`);let n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree),n}inDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.inDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.inDegree-e.directedLoops}outDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.outDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.outDegree-e.directedLoops}directedDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.directedDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.inDegree+e.outDegree-2*e.directedLoops}undirectedDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return"directed"===this.type?0:e.undirectedDegree-2*e.undirectedLoops}inboundDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree,r+=e.directedLoops),n-r}outboundDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.outDegree,r+=e.directedLoops),n-r}degreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.degreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree,r+=2*e.directedLoops),n-r}source(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ce(`Graph.source: could not find the "${t}" edge in the graph.`);return e.source.key}target(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ce(`Graph.target: could not find the "${t}" edge in the graph.`);return e.target.key}extremities(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ce(`Graph.extremities: could not find the "${t}" edge in the graph.`);return[e.source.key,e.target.key]}opposite(t,e){t=""+t,e=""+e;const n=this._edges.get(e);if(!n)throw new ce(`Graph.opposite: could not find the "${e}" edge in the graph.`);const r=n.source.key,i=n.target.key;if(t===r)return i;if(t===i)return r;throw new ce(`Graph.opposite: the "${t}" node is not attached to the "${e}" edge (${r}, ${i}).`)}hasExtremity(t,e){t=""+t,e=""+e;const n=this._edges.get(t);if(!n)throw new ce(`Graph.hasExtremity: could not find the "${t}" edge in the graph.`);return n.source.key===e||n.target.key===e}isUndirected(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ce(`Graph.isUndirected: could not find the "${t}" edge in the graph.`);return e.undirected}isDirected(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ce(`Graph.isDirected: could not find the "${t}" edge in the graph.`);return!e.undirected}isSelfLoop(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ce(`Graph.isSelfLoop: could not find the "${t}" edge in the graph.`);return e.source===e.target}addNode(t,e){const n=function(t,e,n){if(n&&!te(n))throw new ue(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(e=""+e,n=n||{},t._nodes.has(e))throw new le(`Graph.addNode: the "${e}" node already exist in the graph.`);const r=new t.NodeDataClass(e,n);return t._nodes.set(e,r),t.emit("nodeAdded",{key:e,attributes:n}),r}(this,t,e);return n.key}mergeNode(t,e){if(e&&!te(e))throw new ue(`Graph.mergeNode: invalid attributes. Expecting an object but got "${e}"`);t=""+t,e=e||{};let n=this._nodes.get(t);return n?(e&&(Zt(n.attributes,e),this.emit("nodeAttributesUpdated",{type:"merge",key:t,attributes:n.attributes,data:e})),[t,!1]):(n=new this.NodeDataClass(t,e),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:e}),[t,!0])}updateNode(t,e){if(e&&"function"!=typeof e)throw new ue(`Graph.updateNode: invalid updater function. Expecting a function but got "${e}"`);t=""+t;let n=this._nodes.get(t);if(n){if(e){const r=n.attributes;n.attributes=e(r),this.emit("nodeAttributesUpdated",{type:"replace",key:t,attributes:n.attributes})}return[t,!1]}const r=e?e({}):{};return n=new this.NodeDataClass(t,r),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:r}),[t,!0]}dropNode(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.dropNode: could not find the "${t}" node in the graph.`);let n;if("undirected"!==this.type){for(const t in e.out){n=e.out[t];do{Je(this,n),n=n.next}while(n)}for(const t in e.in){n=e.in[t];do{Je(this,n),n=n.next}while(n)}}if("directed"!==this.type)for(const t in e.undirected){n=e.undirected[t];do{Je(this,n),n=n.next}while(n)}this._nodes.delete(t),this.emit("nodeDropped",{key:t,attributes:e.attributes})}dropEdge(t){let e;if(arguments.length>1){const t=""+arguments[0],n=""+arguments[1];if(e=Yt(this,t,n,this.type),!e)throw new ce(`Graph.dropEdge: could not find the "${t}" -> "${n}" edge in the graph.`)}else if(t=""+t,e=this._edges.get(t),!e)throw new ce(`Graph.dropEdge: could not find the "${t}" edge in the graph.`);return Je(this,e),this}dropDirectedEdge(t,e){if(arguments.length<2)throw new le("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new le("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const n=Yt(this,t=""+t,e=""+e,"directed");if(!n)throw new ce(`Graph.dropDirectedEdge: could not find a "${t}" -> "${e}" edge in the graph.`);return Je(this,n),this}dropUndirectedEdge(t,e){if(arguments.length<2)throw new le("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new le("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const n=Yt(this,t,e,"undirected");if(!n)throw new ce(`Graph.dropUndirectedEdge: could not find a "${t}" -> "${e}" edge in the graph.`);return Je(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const t=this._nodes.values();let e;for(;e=t.next(),!0!==e.done;)e.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(t){return this._attributes[t]}getAttributes(){return this._attributes}hasAttribute(t){return this._attributes.hasOwnProperty(t)}setAttribute(t,e){return this._attributes[t]=e,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this}updateAttribute(t,e){if("function"!=typeof e)throw new ue("Graph.updateAttribute: updater should be a function.");const n=this._attributes[t];return this._attributes[t]=e(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this}removeAttribute(t){return delete this._attributes[t],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:t}),this}replaceAttributes(t){if(!te(t))throw new ue("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=t,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(t){if(!te(t))throw new ue("Graph.mergeAttributes: provided attributes are not a plain object.");return Zt(this._attributes,t),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:t}),this}updateAttributes(t){if("function"!=typeof t)throw new ue("Graph.updateAttributes: provided updater is not a function.");return this._attributes=t(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(t,e){if("function"!=typeof t)throw new ue("Graph.updateEachNodeAttributes: expecting an updater function.");if(e&&!ie(e))throw new ue("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._nodes.values();let r,i;for(;r=n.next(),!0!==r.done;)i=r.value,i.attributes=t(i.key,i.attributes);this.emit("eachNodeAttributesUpdated",{hints:e||null})}updateEachEdgeAttributes(t,e){if("function"!=typeof t)throw new ue("Graph.updateEachEdgeAttributes: expecting an updater function.");if(e&&!ie(e))throw new ue("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._edges.values();let r,i,o,s;for(;r=n.next(),!0!==r.done;)i=r.value,o=i.source,s=i.target,i.attributes=t(i.key,i.attributes,o.key,s.key,o.attributes,s.attributes,i.undirected);this.emit("eachEdgeAttributesUpdated",{hints:e||null})}forEachAdjacencyEntry(t){if("function"!=typeof t)throw new ue("Graph.forEachAdjacencyEntry: expecting a callback.");Le(!1,!1,!1,this,t)}forEachAdjacencyEntryWithOrphans(t){if("function"!=typeof t)throw new ue("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");Le(!1,!1,!0,this,t)}forEachAssymetricAdjacencyEntry(t){if("function"!=typeof t)throw new ue("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");Le(!1,!0,!1,this,t)}forEachAssymetricAdjacencyEntryWithOrphans(t){if("function"!=typeof t)throw new ue("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");Le(!1,!0,!0,this,t)}nodes(){return Array.from(this._nodes.keys())}forEachNode(t){if("function"!=typeof t)throw new ue("Graph.forEachNode: expecting a callback.");const e=this._nodes.values();let n,r;for(;n=e.next(),!0!==n.done;)r=n.value,t(r.key,r.attributes)}findNode(t){if("function"!=typeof t)throw new ue("Graph.findNode: expecting a callback.");const e=this._nodes.values();let n,r;for(;n=e.next(),!0!==n.done;)if(r=n.value,t(r.key,r.attributes))return r.key}mapNodes(t){if("function"!=typeof t)throw new ue("Graph.mapNode: expecting a callback.");const e=this._nodes.values();let n,r;const i=new Array(this.order);let o=0;for(;n=e.next(),!0!==n.done;)r=n.value,i[o++]=t(r.key,r.attributes);return i}someNode(t){if("function"!=typeof t)throw new ue("Graph.someNode: expecting a callback.");const e=this._nodes.values();let n,r;for(;n=e.next(),!0!==n.done;)if(r=n.value,t(r.key,r.attributes))return!0;return!1}everyNode(t){if("function"!=typeof t)throw new ue("Graph.everyNode: expecting a callback.");const e=this._nodes.values();let n,r;for(;n=e.next(),!0!==n.done;)if(r=n.value,!t(r.key,r.attributes))return!1;return!0}filterNodes(t){if("function"!=typeof t)throw new ue("Graph.filterNodes: expecting a callback.");const e=this._nodes.values();let n,r;const i=[];for(;n=e.next(),!0!==n.done;)r=n.value,t(r.key,r.attributes)&&i.push(r.key);return i}reduceNodes(t,e){if("function"!=typeof t)throw new ue("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new ue("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let n=e;const r=this._nodes.values();let i,o;for(;i=r.next(),!0!==i.done;)o=i.value,n=t(n,o.key,o.attributes);return n}nodeEntries(){const t=this._nodes.values();return{[Symbol.iterator](){return this},next(){const e=t.next();if(e.done)return e;const n=e.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){const t=new Array(this._nodes.size);let e=0;this._nodes.forEach((n,r)=>{t[e++]=function(t,e){const n={key:t};return ee(e.attributes)||(n.attributes=Zt({},e.attributes)),n}(r,n)});const n=new Array(this._edges.size);return e=0,this._edges.forEach((t,r)=>{n[e++]=function(t,e,n){const r={key:e,source:n.source.key,target:n.target.key};return ee(n.attributes)||(r.attributes=Zt({},n.attributes)),"mixed"===t&&n.undirected&&(r.undirected=!0),r}(this.type,r,t)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:t,edges:n}}import(t,e=!1){if(t instanceof He)return t.forEachNode((t,n)=>{e?this.mergeNode(t,n):this.addNode(t,n)}),t.forEachEdge((t,n,r,i,o,s,a)=>{e?a?this.mergeUndirectedEdgeWithKey(t,r,i,n):this.mergeDirectedEdgeWithKey(t,r,i,n):a?this.addUndirectedEdgeWithKey(t,r,i,n):this.addDirectedEdgeWithKey(t,r,i,n)}),this;if(!te(t))throw new ue("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!te(t.attributes))throw new ue("Graph.import: invalid attributes. Expecting a plain object.");e?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}let n,r,i,o,s;if(t.nodes){if(i=t.nodes,!Array.isArray(i))throw new ue("Graph.import: invalid nodes. Expecting an array.");for(n=0,r=i.length;n<r;n++){o=i[n],Fe(o);const{key:t,attributes:r}=o;e?this.mergeNode(t,r):this.addNode(t,r)}}if(t.edges){let o=!1;if("undirected"===this.type&&(o=!0),i=t.edges,!Array.isArray(i))throw new ue("Graph.import: invalid edges. Expecting an array.");for(n=0,r=i.length;n<r;n++){s=i[n],$e(s);const{source:t,target:r,attributes:a,undirected:u=o}=s;let c;"key"in s?(c=e?u?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:u?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,c.call(this,s.key,t,r,a)):(c=e?u?this.mergeUndirectedEdge:this.mergeDirectedEdge:u?this.addUndirectedEdge:this.addDirectedEdge,c.call(this,t,r,a))}}return this}nullCopy(t){const e=new He(Zt({},this._options,t));return e.replaceAttributes(Zt({},this.getAttributes())),e}emptyCopy(t){const e=this.nullCopy(t);return this._nodes.forEach((t,n)=>{const r=Zt({},t.attributes);t=new e.NodeDataClass(n,r),e._nodes.set(n,t)}),e}copy(t){if("string"==typeof(t=t||{}).type&&t.type!==this.type&&"mixed"!==t.type)throw new le(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${t.type}" because this would mean losing information about the current graph.`);if("boolean"==typeof t.multi&&t.multi!==this.multi&&!0!==t.multi)throw new le("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if("boolean"==typeof t.allowSelfLoops&&t.allowSelfLoops!==this.allowSelfLoops&&!0!==t.allowSelfLoops)throw new le("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const e=this.emptyCopy(t),n=this._edges.values();let r,i;for(;r=n.next(),!0!==r.done;)i=r.value,ze(e,"copy",!1,i.undirected,i.key,i.source.key,i.target.key,Zt({},i.attributes));return e}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const t={};this._nodes.forEach((e,n)=>{t[n]=e.attributes});const e={},n={};this._edges.forEach((t,r)=>{const i=t.undirected?"--":"->";let o,s="",a=t.source.key,u=t.target.key;t.undirected&&a>u&&(o=a,a=u,u=o);const c=`(${a})${i}(${u})`;r.startsWith("geid_")?this.multi&&(void 0===n[c]?n[c]=0:n[c]++,s+=`${n[c]}. `):s+=`[${r}]: `,s+=c,e[s]=t.attributes});const r={};for(const t in this)this.hasOwnProperty(t)&&!Ue.has(t)&&"function"!=typeof this[t]&&"symbol"!=typeof t&&(r[t]=this[t]);return r.attributes=this._attributes,r.nodes=t,r.edges=e,ne(r,"constructor",this.constructor),r}}"undefined"!=typeof Symbol&&(He.prototype[Symbol.for("nodejs.util.inspect.custom")]=He.prototype.inspect),[{name:t=>`${t}Edge`,generateKey:!0},{name:t=>`${t}DirectedEdge`,generateKey:!0,type:"directed"},{name:t=>`${t}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:t=>`${t}EdgeWithKey`},{name:t=>`${t}DirectedEdgeWithKey`,type:"directed"},{name:t=>`${t}UndirectedEdgeWithKey`,type:"undirected"}].forEach(t=>{["add","merge","update"].forEach(e=>{const n=t.name(e),r="add"===e?ze:We;t.generateKey?He.prototype[n]=function(i,o,s){return r(this,n,!0,"undirected"===(t.type||this.type),null,i,o,s,"update"===e)}:He.prototype[n]=function(i,o,s,a){return r(this,n,!1,"undirected"===(t.type||this.type),i,o,s,a,"update"===e)}})}),function(t){ge.forEach(function({name:e,attacher:n}){n(t,e("Node"),0),n(t,e("Source"),1),n(t,e("Target"),2),n(t,e("Opposite"),3)})}(He),function(t){_e.forEach(function({name:e,attacher:n}){n(t,e("Edge"),"mixed"),n(t,e("DirectedEdge"),"directed"),n(t,e("UndirectedEdge"),"undirected")})}(He),function(t){ye.forEach(e=>{Oe(t,e),function(t,e){const{name:n,type:r,direction:i}=e,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"===r||"mixed"===this.type||r===this.type){if(1===arguments.length)return Se(!1,this,r,n=t);if(2===arguments.length){t=""+t,n=e;const s=this._nodes.get(t);if(void 0===s)throw new ce(`Graph.${o}: could not find the "${t}" node in the graph.`);return Ae(!1,this.multi,"mixed"===r?this.type:r,i,s,n)}if(3===arguments.length){t=""+t,e=""+e;const s=this._nodes.get(t);if(!s)throw new ce(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ce(`Graph.${o}: could not find the "${e}" target node in the graph.`);return Ee(!1,r,this.multi,i,s,e,n)}throw new ue(`Graph.${o}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const s="map"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(){const t=Array.prototype.slice.call(arguments),e=t.pop();let n;if(0===t.length){let i=0;"directed"!==r&&(i+=this.undirectedSize),"undirected"!==r&&(i+=this.directedSize),n=new Array(i);let o=0;t.push((t,r,i,s,a,u,c)=>{n[o++]=e(t,r,i,s,a,u,c)})}else n=[],t.push((t,r,i,o,s,a,u)=>{n.push(e(t,r,i,o,s,a,u))});return this[o].apply(this,t),n};const a="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(){const t=Array.prototype.slice.call(arguments),e=t.pop(),n=[];return t.push((t,r,i,o,s,a,u)=>{e(t,r,i,o,s,a,u)&&n.push(t)}),this[o].apply(this,t),n};const u="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[u]=function(){let t,e,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new ue(`Graph.${u}: invalid number of arguments (expecting 2, 3 or 4 and got ${n.length}).`);if("function"==typeof n[n.length-1]&&"function"!=typeof n[n.length-2])throw new ue(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);2===n.length?(t=n[0],e=n[1],n=[]):3===n.length?(t=n[1],e=n[2],n=[n[0]]):4===n.length&&(t=n[2],e=n[3],n=[n[0],n[1]]);let r=e;return n.push((e,n,i,o,s,a,u)=>{r=t(r,e,n,i,o,s,a,u)}),this[o].apply(this,n),r}}(t,e),function(t,e){const{name:n,type:r,direction:i}=e,o="find"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return!1;if(1===arguments.length)return Se(!0,this,r,n=t);if(2===arguments.length){t=""+t,n=e;const s=this._nodes.get(t);if(void 0===s)throw new ce(`Graph.${o}: could not find the "${t}" node in the graph.`);return Ae(!0,this.multi,"mixed"===r?this.type:r,i,s,n)}if(3===arguments.length){t=""+t,e=""+e;const s=this._nodes.get(t);if(!s)throw new ce(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ce(`Graph.${o}: could not find the "${e}" target node in the graph.`);return Ee(!0,r,this.multi,i,s,e,n)}throw new ue(`Graph.${o}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const s="some"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[s]=function(){const t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((t,n,r,i,o,s,a)=>e(t,n,r,i,o,s,a)),!!this[o].apply(this,t)};const a="every"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[a]=function(){const t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((t,n,r,i,o,s,a)=>!e(t,n,r,i,o,s,a)),!this[o].apply(this,t)}}(t,e),Ce(t,e)})}(He),function(t){Me.forEach(e=>{Pe(t,e),function(t,e){const{name:n,type:r,direction:i}=e,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return;t=""+t;const n=this._nodes.get(t);if(void 0===n)throw new ce(`Graph.${o}: could not find the "${t}" node in the graph.`);je(!1,"mixed"===r?this.type:r,i,n,e)};const s="map"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(t,e){const n=[];return this[o](t,(t,r)=>{n.push(e(t,r))}),n};const a="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(t,e){const n=[];return this[o](t,(t,r)=>{e(t,r)&&n.push(t)}),n};const u="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[u]=function(t,e,n){if(arguments.length<3)throw new ue(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let r=n;return this[o](t,(t,n)=>{r=e(r,t,n)}),r}}(t,e),function(t,e){const{name:n,type:r,direction:i}=e,o=n[0].toUpperCase()+n.slice(1,-1),s="find"+o;t.prototype[s]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return;t=""+t;const n=this._nodes.get(t);if(void 0===n)throw new ce(`Graph.${s}: could not find the "${t}" node in the graph.`);return je(!0,"mixed"===r?this.type:r,i,n,e)};const a="some"+o;t.prototype[a]=function(t,e){return!!this[s](t,e)};const u="every"+o;t.prototype[u]=function(t,e){return!this[s](t,(t,n)=>!e(t,n))}}(t,e),De(t,e)})}(He);class Xe extends He{constructor(t){const e=Zt({type:"directed"},t);if("multi"in e&&!1!==e.multi)throw new ue("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==e.type)throw new ue('DirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class Ke extends He{constructor(t){const e=Zt({type:"undirected"},t);if("multi"in e&&!1!==e.multi)throw new ue("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==e.type)throw new ue('UndirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class Qe extends He{constructor(t){const e=Zt({multi:!0},t);if("multi"in e&&!0!==e.multi)throw new ue("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(e)}}class Ze extends He{constructor(t){const e=Zt({type:"directed",multi:!0},t);if("multi"in e&&!0!==e.multi)throw new ue("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==e.type)throw new ue('MultiDirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class Ye extends He{constructor(t){const e=Zt({type:"undirected",multi:!0},t);if("multi"in e&&!0!==e.multi)throw new ue("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==e.type)throw new ue('MultiUndirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}function tn(t){t.from=function(e,n){const r=Zt({},e.options,n),i=new t(r);return i.import(e),i}}tn(He),tn(Xe),tn(Ke),tn(Qe),tn(Ze),tn(Ye),He.Graph=He,He.DirectedGraph=Xe,He.UndirectedGraph=Ke,He.MultiGraph=Qe,He.MultiDirectedGraph=Ze,He.MultiUndirectedGraph=Ye,He.InvalidArgumentsGraphError=ue,He.NotFoundGraphError=ce,He.UsageGraphError=le;class en{constructor(t){this.graph=t,this.stack=new Array(t.order),this.seen=new Set,this.size=0}hasAlreadySeenEverything(){return this.seen.size===this.graph.order}countUnseenNodes(){return this.graph.order-this.seen.size}forEachNodeYetUnseen(t){const e=this.seen,n=this.graph;n.someNode(function(r,i){if(e.size===n.order)return!0;if(e.has(r))return!1;return!!t(r,i)})}has(t){return this.seen.has(t)}push(t){const e=this.seen.size;return this.seen.add(t),e!==this.seen.size&&(this.stack[this.size++]=t,!0)}pop(){if(0!==this.size)return this.stack[--this.size]}}const nn=t=>"object"==typeof t&&!Array.isArray(t)&&null!==t&&"_bname"in t,rn=t=>"object"==typeof t&&!Array.isArray(t)&&null!==t&&"_crate"in t,on=t=>nn(t)&&("empty_bottle"===t._bname&&"empty_data"===t._content||void 0===t._content),sn=t=>/^\d+$/.test(t);var an=n(8287),un=y(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function cn(t,e){var n="object"==typeof e;return new Promise(function(r,i){var o=new L({next:function(t){r(t),o.unsubscribe()},error:i,complete:function(){n?r(e.defaultValue):i(new un)}});t.subscribe(o)})}function ln(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return yt(t,dt(t))}function hn(t,e){return m(e)?at(t,e,1):at(t,1)}var dn=function(t){function e(e,n){return t.call(this)||this}return o(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(w),pn={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=pn.delegate;return(null==i?void 0:i.setInterval)?i.setInterval.apply(i,h([t,e],l(n))):setInterval.apply(void 0,h([t,e],l(n)))},clearInterval:function(t){var e=pn.delegate;return((null==e?void 0:e.clearInterval)||clearInterval)(t)},delegate:void 0},fn=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return o(e,t),e.prototype.schedule=function(t,e){var n;if(void 0===e&&(e=0),this.closed)return this;this.state=t;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,e)),this.pending=!0,this.delay=e,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),pn.setInterval(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return e;null!=e&&pn.clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n,r=!1;try{this.work(t)}catch(t){r=!0,n=t||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},e.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,b(r,this),null!=e&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(dn),mn={now:function(){return(mn.delegate||Date).now()},delegate:void 0},gn=function(){function t(e,n){void 0===n&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.schedulerActionCtor(this,t).schedule(n,e)},t.now=mn.now,t}(),_n=new(function(t){function e(e,n){void 0===n&&(n=gn.now);var r=t.call(this,e,n)||this;return r.actions=[],r._active=!1,r}return o(e,t),e.prototype.flush=function(t){var e=this.actions;if(this._active)e.push(t);else{var n;this._active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this._active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(gn))(fn),yn=_n;function vn(t){for(var e,n,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var o=null!==(e=dt(r))&&void 0!==e?e:_n,s=null!==(n=r[0])&&void 0!==n?n:null,a=r[1]||1/0;return g(function(e,n){var r=[],i=!1,u=function(t){var e=t.buffer;t.subs.unsubscribe(),b(r,t),n.next(e),i&&l()},l=function(){if(r){var e=new w;n.add(e);var i={buffer:[],subs:e};r.push(i),st(e,o,function(){return u(i)},t)}};null!==s&&s>=0?st(n,o,l,s,!0):i=!0,l();var h=q(n,function(t){var e,n,i=r.slice();try{for(var o=c(i),s=o.next();!s.done;s=o.next()){var l=s.value,h=l.buffer;h.push(t),a<=h.length&&u(l)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}},function(){for(;null==r?void 0:r.length;)n.next(r.shift().buffer);null==h||h.unsubscribe(),n.complete(),n.unsubscribe()},void 0,function(){return r=null});e.subscribe(h)})}var bn=n(2543);const wn=(t,e,n={})=>({_bname:t,_content:e,_label:n}),xn=(t,e,n={})=>nn(e)&&(void 0===t||(t.includes(e._bname)||"*"===t))?e._content:void 0,Tn=wn("empty_bottle","empty_data"),kn={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={codebase:"leafinflowport.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>{wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafinflowport.js",codebase:"/src/ghostos/api/parser/nodelogic/io/leafinflowport.js"},{});return p_(e,t,void 0,{...o,metastep:"leaf inflow"},{leaflogic:(t,e)=>{const n=new Pt,r=e._stream.pipe(Nt(...t.map(t=>t._stream)),V(t=>(n.next(t[1]),t[0])),Lt());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(e,n)=>({...Lg(t,e),_control:n})},Sn={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={codebase:"leafoutflowport.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>{wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafoutflowport.js",codebase:"/src/ghostos/api/parser/nodelogic/io/leafoutflowport.js"},{});return p_(e,t,void 0,{...o,metastep:"leaf outflow"},{leaflogic:(t,e)=>{const n=new Pt,r=e._stream.pipe(V(t=>t),Nt(...t.map(t=>t._stream)),V(t=>(n.next(t[1]),t[0])),Lt());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...Lg(t),_control:e})};const An={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=(t=>{if(!t)return"appview";const e=Object.keys(t).filter(t=>"osview"===t||"osview2"===t);return e.length>0?e[0]:"appview"})(await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree})),s={codebase:"leafscreenio.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(e,n)=>p_(n,e,void 0,{...s,metastep:"invoking screenio"},{leaflogic:(t,e)=>{const n=new Pt,r=e._stream.pipe(Nt(...t.map(t=>t._stream)),It(t=>{const e=t.slice(1).filter(t=>void 0!==t);return 1===e.length?n.next(e[0]):e.length>1&&n.next(e),ln(t[0])}),Lt());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{post:e=>{const n=(Array.isArray(e)?e:[e]).map(t=>xn("screenio",t)).filter(t=>t);void 0!==n&&t.gos.leafio.getMasterSubsDir()[o].main.doWrite({control:{},data:n});return wn("screenio","written")}}})},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...Bg(t),_control:e})},En=(t,e)=>{if(t.length>0&&t[0]in e)return 1===t.length?e[t[0]]:En(t.slice(1),e[t[0]])},On=(t,e,n)=>{t.length>0&&t[0]in e&&(1===t.length?e[t[0]]=n:On(t.slice(1),e[t[0]],n))};var Cn=n(8463);function Mn(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:case 3:return e^n^r;case 2:return e&n^e&r^n&r}}function Nn(t,e){return t<<e|t>>>32-e}const In=function(t){const e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(t.length+1);r.set(t),r[t.length]=128;const i=(t=r).length/4+2,o=Math.ceil(i/16),s=new Array(o);for(let e=0;e<o;++e){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=t[64*e+4*r]<<24|t[64*e+4*r+1]<<16|t[64*e+4*r+2]<<8|t[64*e+4*r+3];s[e]=n}s[o-1][14]=8*(t.length-1)/Math.pow(2,32),s[o-1][14]=Math.floor(s[o-1][14]),s[o-1][15]=8*(t.length-1)&4294967295;for(let t=0;t<o;++t){const r=new Uint32Array(80);for(let e=0;e<16;++e)r[e]=s[t][e];for(let t=16;t<80;++t)r[t]=Nn(r[t-3]^r[t-8]^r[t-14]^r[t-16],1);let i=n[0],o=n[1],a=n[2],u=n[3],c=n[4];for(let t=0;t<80;++t){const n=Math.floor(t/20),s=Nn(i,5)+Mn(n,o,a,u)+c+e[n]+r[t]>>>0;c=u,u=a,a=Nn(o,30)>>>0,o=i,i=s}n[0]=n[0]+i>>>0,n[1]=n[1]+o>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+u>>>0,n[4]=n[4]+c>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])},jn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;const Rn=function(t){return"string"==typeof t&&jn.test(t)};const Pn=function(t){if(!Rn(t))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(t.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,255&e,(e=parseInt(t.slice(9,13),16))>>>8,255&e,(e=parseInt(t.slice(14,18),16))>>>8,255&e,(e=parseInt(t.slice(19,23),16))>>>8,255&e,(e=parseInt(t.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,255&e)};const Dn=[];for(let t=0;t<256;++t)Dn.push((t+256).toString(16).slice(1));function Ln(t,e=0){return(Dn[t[e+0]]+Dn[t[e+1]]+Dn[t[e+2]]+Dn[t[e+3]]+"-"+Dn[t[e+4]]+Dn[t[e+5]]+"-"+Dn[t[e+6]]+Dn[t[e+7]]+"-"+Dn[t[e+8]]+Dn[t[e+9]]+"-"+Dn[t[e+10]]+Dn[t[e+11]]+Dn[t[e+12]]+Dn[t[e+13]]+Dn[t[e+14]]+Dn[t[e+15]]).toLowerCase()}function Fn(t,e,n,r,i,o){const s="string"==typeof n?function(t){t=unescape(encodeURIComponent(t));const e=new Uint8Array(t.length);for(let n=0;n<t.length;++n)e[n]=t.charCodeAt(n);return e}(n):n,a="string"==typeof r?Pn(r):r;if("string"==typeof r&&(r=Pn(r)),16!==r?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+s.length);if(u.set(a),u.set(s,a.length),u=e(u),u[6]=15&u[6]|t,u[8]=63&u[8]|128,i){o=o||0;for(let t=0;t<16;++t)i[o+t]=u[t];return i}return Ln(u)}function $n(t,e,n,r){return Fn(80,In,t,e,n,r)}$n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",$n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";const Bn=$n;function qn(t){function e(t,e){return t<<e|t>>>32-e}function n(t){var e,n="";for(e=7;e>=0;e--)n+=(t>>>4*e&15).toString(16);return n}var r,i,o,s,a,u,c,l,h,d=new Array(80),p=1732584193,f=4023233417,m=2562383102,g=271733878,_=3285377520,y=(t=function(t){t=t.replace(/\r\n/g,"\n");for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?e+=String.fromCharCode(r):r>127&&r<2048?(e+=String.fromCharCode(r>>6|192),e+=String.fromCharCode(63&r|128)):(e+=String.fromCharCode(r>>12|224),e+=String.fromCharCode(r>>6&63|128),e+=String.fromCharCode(63&r|128))}return e}(t)).length,v=new Array;for(i=0;i<y-3;i+=4)o=t.charCodeAt(i)<<24|t.charCodeAt(i+1)<<16|t.charCodeAt(i+2)<<8|t.charCodeAt(i+3),v.push(o);switch(y%4){case 0:i=2147483648;break;case 1:i=t.charCodeAt(y-1)<<24|8388608;break;case 2:i=t.charCodeAt(y-2)<<24|t.charCodeAt(y-1)<<16|32768;break;case 3:i=t.charCodeAt(y-3)<<24|t.charCodeAt(y-2)<<16|t.charCodeAt(y-1)<<8|128}for(v.push(i);v.length%16!=14;)v.push(0);for(v.push(y>>>29),v.push(y<<3&4294967295),r=0;r<v.length;r+=16){for(i=0;i<16;i++)d[i]=v[r+i];for(i=16;i<=79;i++)d[i]=e(d[i-3]^d[i-8]^d[i-14]^d[i-16],1);for(s=p,a=f,u=m,c=g,l=_,i=0;i<=19;i++)h=e(s,5)+(a&u|~a&c)+l+d[i]+1518500249&4294967295,l=c,c=u,u=e(a,30),a=s,s=h;for(i=20;i<=39;i++)h=e(s,5)+(a^u^c)+l+d[i]+1859775393&4294967295,l=c,c=u,u=e(a,30),a=s,s=h;for(i=40;i<=59;i++)h=e(s,5)+(a&u|a&c|u&c)+l+d[i]+2400959708&4294967295,l=c,c=u,u=e(a,30),a=s,s=h;for(i=60;i<=79;i++)h=e(s,5)+(a^u^c)+l+d[i]+3395469782&4294967295,l=c,c=u,u=e(a,30),a=s,s=h;p=p+s&4294967295,f=f+a&4294967295,m=m+u&4294967295,g=g+c&4294967295,_=_+l&4294967295}return(h=n(p)+n(f)+n(m)+n(g)+n(_)).toLowerCase()}const Un="github",Vn=async(t,e)=>{const n=(t=>{const[e,n]=t.split("?"),r=e.split("/");if(r[0]===Un&&r.shift(),r.length<3)return null;const i=r.shift(),o=r.shift();if(!i||!o)return null;const s=o.split("@"),a=s[0],u=s[1]||"main";let c=r.join("/");return a&&c?(c.endsWith(".json")||(c=`${c}.json`),{user:i,repo:a,ref:u,path:c,query:n}):null})(e);if(!n)throw new Error(`Invalid GitHub graph reference: ${e}`);if(!globalThis.fetch)throw new Error("GitHub graph fetch requires global fetch.");const{user:r,repo:i,ref:o,path:s,query:a}=n,u=`https://raw.githubusercontent.com/${r}/${i}/refs/heads/${o}/${s}${a?`?${a}`:""}`,c=await globalThis.fetch(u);if(!c.ok)throw new Error(`Failed to fetch GitHub graph ${t}/${e}: ${c.status}`);const l=(t=>t?t.graph?.nodes?t.graph.nodes:t.data?.graph?.nodes?t.data.graph.nodes:t.nodes?t.nodes:[]:[])(await c.json());return{graph:{nodes:l}}},Gn=t=>{const e=t=>t.hostEtaTree?(t.hostEtaTree,e(t.hostEtaTree)):t,n=e(t),{appmode:r,domain:i,appid:o}=n,s=Bn(`https://www.leafgon.com/${i}/${o}/_etaTreeForest`,Bn.URL),a=n.mnemosyne.current[s],u={initEtaTreeForest:()=>{s in n.mnemosyne.current||(n.mnemosyne.current[s]={})},getEtaTree:async(t,e)=>{const r=t+"/"+e;if(r in a)return n.mnemosyne.current[s][r].tree;return await u.parseGraphEtaTree(t,e)},setEtaTree:(t,e,r,i)=>{const o=t+"/"+e;n.mnemosyne.current[s][o]={tree:r,parent:i}},removeEtaBush:(t,e)=>{const r=t+"/"+e,i=Object.entries(a).filter(([t,e])=>t!==r&&e.parent!==r).reduce((t,e)=>(t[e[0]]=e[1],t),{});n.mnemosyne.current[s]=i},parseGraphEtaTree:async(t,e)=>{const s=i,a=o;if(globalThis?.DEBUG){const n=t+"/"+e;globalThis.trace[n]?globalThis.trace[n].push("parsing"):globalThis.trace[n]=["parsing"]}const c=((t,e)=>t===Un||"string"==typeof e&&e.startsWith(`${Un}/`)&&e.includes("/"))(t,e)?await Vn(t,e):await n.leaflakeio.qm_methods.queryGraph({_appmode:r,_hostdomain:i,_hostappid:o,_domain:t,_appid:e}),{nodes:l}=c.graph?c.graph:{nodes:[]},h=r_(l),d=i_(h),p=n,f=Rg(r,s,a,t,e,h,d,p.leafio,p.leaflakeio,p.mnemosyne,p),m=(d.components.nodegroups.runtime[0],d.components.nodegroups.lambda,p?s+"/"+a:void 0);if(u.setEtaTree(t,e,f,m),globalThis?.DEBUG){const n=t+"/"+e;globalThis.trace[n]?globalThis.trace[n].push("parsed"):globalThis.trace[n]=["parsed"]}return f}};return u},zn=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafmemoryio.js",codebase:"/src/ghostos/api/parser/nodelogic/io/leafmemoryio.js"},{}),Wt("leafmemoryio")),Wn={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{type:s,args:a}=n.leaf.logic,u=En(zn.editorconfig.namedatakey,a),{domain:c,appid:l}=t.gos.etaTree,h=`www.leafgon.com/mnemosyne/${c}/${l}/${u}`,d=Bn(h,Bn.URL),p="global"in o,f="on-tap"in o,m="proxy"in o,g=t.gos.etaTree.leafgraph.thespade?.uuid,_=g&&p?await t.gos.etaTree.lookupRuntimeLambdaLUT("breezyforest","main",g,t.gos.etaTree.leafgraph.edges.lambda.sourcelut[g],[]):void 0;e.slice(0,4);!!p&&(y=u,v=_,Object.keys(v).includes(y));var y,v;const b={codebase:"leafmemoryio.js",refnode:e,leafnode:"jest"!==e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e)?.leafnode.data};return(n,r)=>{const i=(n,r=void 0)=>{const i=r||d;if(void 0===n||(t=>!!nn(t)&&("empty_bottle"===t._bname||"nothing"===t._bname))(n)){if(i in t.gos.etaTree.mnemosyne.current){const n=t.gos.etaTree.mnemosyne.current[i];return f?n.raw:wn(u,n.raw,{_type:"memoryio",_command:"o",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}{const n=f?wn("nothing",null,{_type:"memoryio",_command:"forget",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}}):null;return f?n:wn(u,n,{_type:"memoryio",_command:"forget",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}}if("main"===u&&e.slice(0,4),nn(o=n)&&void 0!==o._bname&&"memoryio"===o._label._type&&"forget"===o._label._command){const n=f?wn("nothing",null,{_type:"memoryio",_command:"io",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}}):null,r=Cn(n),o={signature:qn(r),payload:r,raw:n};return t.gos.etaTree.mnemosyne.current={...t.gos.etaTree.mnemosyne.current,[i]:o},f?n:wn(u,n,{_type:"memoryio",_command:"io",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}{const r=n,o=Cn(r),s={signature:qn(o),payload:o,raw:r};return t.gos.etaTree.mnemosyne.current={...t.gos.etaTree.mnemosyne.current,[i]:s},f?r:wn(u,r,{_type:"memoryio",_command:"io",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}var o};return p_(r,n,void 0,{...b,metastep:"memory io "+u},{leaflogic:(t,e)=>{const n=new Pt,r=e._stream.pipe(Nt(...t.map(t=>t._stream)),V(t=>{if(m){const e=t[0].sid.slice(-1).pop(),r=Bn(`www.leafgon.com/mnemosyne/${c}/${l}/${u}/${e}`,Bn.URL),o=i(t[1],r);n.next(o)}else{const e=i(t[1]);n.next(e)}return t[0]}),Lt());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={},s=t.gos.etaTree.leafgraph.thespade?.uuid;if(!!s&&t.gos.etaTree.leafgraph.edges.lambda.sourcelut[s].includes(e)){const{type:s,args:a}=n.leaf.logic,u=En(zn.editorconfig.namedatakey,a);if(r.length>0){const n=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});o[u]={...n}}else o[u]={};return o}return o},methods:t=>({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=t=>t.hostEtaTree?(t.hostEtaTree,o(t.hostEtaTree)):t,s=o(t.gos.etaTree);return{etatreeforest:Gn(s),general:{setMasterMemory:(e,n)=>{const{domain:r,appid:i}=t.gos.etaTree,o=Bn(`www.leafgon.com/mnemosyne/${r}/${i}/${e}`,Bn.URL);return s.mnemosyne.current[o]=n,n},getMasterMemory:e=>{const{domain:n,appid:r}=t.gos.etaTree,i=Bn(`www.leafgon.com/mnemosyne/${n}/${r}/${e}`,Bn.URL);return s.mnemosyne.current[i]}}}}},Jn={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let Hn;const Xn=new Uint8Array(16);const Kn=function(t,e,n){if(Jn.randomUUID&&!e&&!t)return Jn.randomUUID();const r=(t=t||{}).random??t.rng?.()??function(){if(!Hn){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Hn=crypto.getRandomValues.bind(crypto)}return Hn(Xn)}();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){if((n=n||0)<0||n+16>e.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let t=0;t<16;++t)e[n+t]=r[t];return e}return Ln(r)};function Qn(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}u((r=r.apply(t,e||[])).next())})}const Zn=t=>void 0!==t&&t>="0"&&t<="9",Yn=t=>t>="a"&&t<="z"||t>="A"&&t<="Z"||"_"==t||"."==t||"-"==t,tr=t=>t>="a"&&t<="z"||t>="A"&&t<="Z"||"_"==t||"."==t||"-"==t||":"==t,er=t=>"=+-*/\\&%$_!<>?".includes(t);class nr{constructor(t,e,n,r){this.source=t,this.startIndex=e,this.endIndex=n,this.line=r,this.offset=void 0}get start(){return this.startIndex-(this.line<=1?0:this.getLineOffset())}get end(){return this.endIndex-(this.line<=1?0:this.getLineOffset())}get length(){return this.endIndex-this.startIndex}getLineOffset(){var t;if(void 0===this.offset){const e=new RegExp("(\n)","mg");let n=null;for(let t=1;t<this.line;t++)n=e.exec(this.source);this.offset=null!==(t=null==n?void 0:n.index)&&void 0!==t?t:0}return this.offset}}var rr,ir;nr.unknown=new nr("",-1,-1,-1),function(t){t[t.Init=0]="Init",t[t.LeftParen=1]="LeftParen",t[t.RightParen=2]="RightParen",t[t.LeftBrace=3]="LeftBrace",t[t.RightBrace=4]="RightBrace",t[t.LeftSquare=5]="LeftSquare",t[t.RightSquare=6]="RightSquare",t[t.Dispatch=7]="Dispatch",t[t.True=8]="True",t[t.False=9]="False",t[t.Identifier=10]="Identifier",t[t.Keyword=11]="Keyword",t[t.String=12]="String",t[t.Integer=13]="Integer",t[t.Float=14]="Float",t[t.FractionNumber=15]="FractionNumber",t[t.Error=16]="Error",t[t.EOF=17]="EOF",t[t.Nothing=18]="Nothing"}(rr||(rr={}));class or{constructor(t,e,n){this.type=t,this.value=e,this.position=n}}or.INIT=new or(rr.Init,"",new nr("",0,0,0));class sr{constructor(t){this.source=t,this.start=0,this.current=0,this.line=1}isEnd(){return this.source.length===this.current}advance(){return this.current+=1,this.source[this.current-1]}peek(){return this.source[this.current]}peekNext(){return this.source[this.current+1]}makeToken(t){const{start:e,line:n,current:r,source:i}=this,o=t===rr.Keyword,s=i.substring(o?e+1:e,r);return new or(t,s,new nr(i,e,r,n))}makeStringToken(){const{start:t,line:e,current:n,source:r}=this,i=r.substring(t+1,n-1).replace(/\\n/g,"\n").replace(/\\\\/g,"\\").replace(/\\"/g,'"');return new or(rr.String,i,new nr(r,t,n,e))}errorToken(t){const{start:e,line:n,current:r,source:i}=this;return new or(rr.Error,t,new nr(i,e,r,n))}identifier(){for(;;){const t=this.peek();if(!t||!(Yn(t)||Zn(t)||er(t)))break;this.advance()}return this.makeIdentifierToken()}makeIdentifierToken(){const{start:t,current:e,source:n}=this;switch(n.substring(t,e)){case"true":return this.makeToken(rr.True);case"false":return this.makeToken(rr.False);case"null":return this.makeToken(rr.Nothing);default:return this.makeToken(rr.Identifier)}}keyword(){if(!tr(this.peek())&&!Zn(this.peek()))return this.makeToken(rr.Identifier);for(;tr(this.peek())||Zn(this.peek());)this.advance();return this.makeToken(rr.Keyword)}number(){for(;Zn(this.peek());)this.advance();if("."===this.peek()&&Zn(this.peekNext())){for(this.advance();Zn(this.peek());)this.advance();return this.makeToken(rr.Float)}if("/"===this.peek()){if(!Zn(this.peekNext()))return this.errorToken("Unterminated fraction number");for(this.advance();Zn(this.peek());)this.advance();return this.makeToken(rr.FractionNumber)}return this.makeToken(rr.Integer)}string(){for(;'"'!==this.peek()&&!this.isEnd();)"\n"===this.peek()&&(this.line+=1),"\\"===this.peek()&&this.advance(),this.advance();return this.isEnd()?this.errorToken("Unterminated string"):(this.advance(),this.makeStringToken())}skipWhitespace(){let t=0;for(;;){switch(this.peek()){case" ":case"\r":case"\t":case",":this.advance();break;case"\n":this.line+=1,this.advance();break;case";":if("#"===this.peekNext()){for(this.advance(),this.advance();"#"!==this.peek()&&";"!==this.peekNext()&&!this.isEnd();)"\n"===this.peek()&&(this.line+=1),this.advance();this.advance(),this.advance()}else for(;"\n"!==this.peek()&&!this.isEnd();)this.advance();break;default:return}t+=1}return t}scanToken(){this.skipWhitespace();if(this.start=this.current,this.isEnd())return this.makeToken(rr.EOF);const t=this.advance();if(Zn(t)||"-"===t&&Zn(this.peek()))return this.number();if((Yn(t)||er(t))&&!Zn(t))return this.identifier();switch(t){case"(":return this.makeToken(rr.LeftParen);case")":return this.makeToken(rr.RightParen);case"{":return this.makeToken(rr.LeftBrace);case"}":return this.makeToken(rr.RightBrace);case"[":return this.makeToken(rr.LeftSquare);case"]":return this.makeToken(rr.RightSquare);case"#":return this.makeToken(rr.Dispatch);case":":return this.keyword();case'"':return this.string()}return this.errorToken(`Unexpected character '${t}'.`)}scanAllToken(){const t=[];for(;!this.isEnd();)t.push(this.scanToken());return t}}!function(t){t.Boolean="bool",t.Integer="int",t.Float="float",t.FractionNumber="fractionNumber",t.String="string",t.Keyword="keyword",t.Identifier="identifier",t.List="list",t.Nothing="null"}(ir||(ir={}));class ar{constructor(t,e,n){this.kind=t,this.value=e,this.position=n}}class ur extends Error{constructor(t,e){"string"==typeof t?super(t):(super(t.message),this.stack=t.stack),this._position=e}get position(){return this._position}}ur.kind="RuntimeError";const cr=t=>t,lr=(t,e)=>{if(t)throw new ur(e);return!0},hr=(t,e,n)=>lr(t.length!==e,n||`Expected ${e} argument${e>1?"s":""}, but got ${t.length}.`),dr=(t,...e)=>lr(void 0===e.find(e=>e===t.kind),`Invalid function parameter, actual: '${t.kind}', expected: '${e.join(" or ")}'.`);const pr=t=>()=>{throw new ur(`${t} is not implemented.`)},fr=t=>({parser:()=>{throw new ur(`${t} is not implemented.`)},factory:pr(t)}),mr={Bool:{parser:t=>"true"===t,factory:Boolean},Nothing:{parser:t=>"null"==t,factory:pr("NULL")},Int:{parser:t=>parseInt(t,10),factory:Number},Float:{parser:parseFloat,factory:Number},String:{parser:t=>t,factory:String},FractionNumber:{parser:t=>t,factory:pr("FractionNumber")},Vector:fr("Vector"),HashMap:fr("HashMap")},gr="Vector",_r="HashMap";class yr{constructor(t,e=mr){this.scanner=t,this.literals=e,this.hadError=!1,this.panicMode=!1,this.current=or.INIT,this._program=[],this._errors=[],this.dispatchMode=!1,this.missingParser=t=>{this.errorAtCurrent(`Missing parser '${t}'.`)}}parse(){try{for(this.checkLiteralParsers(),this.advance();!this.isEnd();){const t=this.expression();t&&this._program.push(t)}this.consume(rr.EOF,"Expect end of program.")}finally{return{hasError:this.hadError,program:this.program,errors:this.errors}}}get program(){return this._program}get errors(){return this._errors}advance(){for(;this.current=this.scanner.scanToken(),this.current.type===rr.Error;)this.errorAtCurrent(this.current.value)}consume(t,e){this.current.type!=t?this.errorAtCurrent(e):this.advance()}errorAtCurrent(t){this.errorAt(this.current,t)}errorAt(t,e){if(!this.panicMode)throw this._errors.push({position:t.position,message:e}),this.hadError=!0,new Error(e)}isEnd(){return this.peek().type===rr.EOF}peek(){return this.current}expression(){const t=this.current,{Bool:e,FractionNumber:n,Int:r,Float:i,String:o,Nothing:s}=this.literals;switch(t.type){case rr.True:case rr.False:return this.makeLiteral(ir.Boolean,e.parser,t);case rr.Nothing:return this.makeLiteral(ir.Nothing,s.parser,t);case rr.Integer:return this.makeLiteral(ir.Integer,r.parser,t);case rr.Float:return this.makeLiteral(ir.Float,i.parser,t);case rr.FractionNumber:return this.makeLiteral(ir.FractionNumber,n.parser,t);case rr.String:return this.makeLiteral(ir.String,o.parser,t);case rr.Identifier:return this.makeLiteral(ir.Identifier,cr,t);case rr.Keyword:return this.makeLiteral(ir.Keyword,o.parser,t);case rr.LeftParen:return new ar(ir.List,this.advanceUntil(rr.RightParen),t.position);case rr.LeftSquare:return new ar(ir.List,[new ar(ir.Identifier,gr,t.position),...this.advanceUntil(rr.RightSquare)],t.position);case rr.LeftBrace:return new ar(ir.List,[new ar(ir.Identifier,_r,t.position),...this.advanceUntil(rr.RightBrace)],t.position);case rr.Dispatch:return this.formatDispatch();default:return void this.errorAtCurrent(`Unknown token: '${t.value}'.`)}}makeLiteral(t,e,n){const r=new ar(t,e(this.current.value),n.position);return this.advance(),r}advanceUntil(t){const e=[];for(this.advance();this.current.type!==t&&!this.isEnd();){const t=this.expression();e.push(t)}return this.consume(t,`Expected '${this.closeParentheses(t)}'.`),e}formatDispatch(){this.advance(),this.dispatchMode&&this.errorAtCurrent("Nested dispatch expression not allowed."),this.dispatchMode=!0;const t=this.expression();t&&t.kind===ir.List||this.errorAtCurrent(`List expression expected after dispatch, but get '${t&&t.kind}'.`);const e=t;let n=e;switch(e.value[0].value){case _r:this.errorAtCurrent("Invalid dispatch: #{...}.");break;case gr:this.errorAtCurrent("Invalid dispatch: #[...].");break;default:n=this.anonymousFunction(e)}return this.dispatchMode=!1,n}anonymousFunction(t){const e=function(t,e){let n=[];const r=t=>{switch(t.kind){case ir.Boolean:case ir.Nothing:case ir.Integer:case ir.Float:case ir.FractionNumber:case ir.String:case ir.Keyword:case ir.Identifier:return n=e(n,t);case ir.List:return t.value.map(r),n=e(n,t)}};return r(t),n}(t,(t,e)=>{if(e.kind===ir.Identifier){const n=e;/^%\d+$/.test(n.value)&&t.push(parseInt(n.value.substr(1)))}return t}).sort((t,e)=>t-e).reverse()[0],n=Array.from({length:e},(e,n)=>new ar(ir.Identifier,`%${n+1}`,t.position)),r=new ar(ir.List,[new ar(ir.Identifier,gr,t.position),...n],t.position);return new ar(ir.List,[new ar(ir.Identifier,"fn",t.position),r,t],t.position)}closeParentheses(t){switch(t){case rr.RightParen:return")";case rr.RightBrace:return"}";case rr.RightSquare:return"]"}}checkLiteralParsers(){const{Bool:t,FractionNumber:e,Int:n,Float:r,String:i,Nothing:o}=this.literals;t.parser||this.missingParser("Bool"),n.parser||this.missingParser("Int"),r.parser||this.missingParser("Float"),e.parser||this.missingParser("FractionNumber"),i.parser||this.missingParser("String"),o.parser||this.missingParser("Nothing")}}const vr="<native function>";class br{constructor(t,e,n=!0,r=vr){this._fn=t,this._arity=e,this._resolveIds=n,this._toString=r}call(t,e,n){const r=this.arity-n.length,i=this._resolveIds?n.map(n=>n.kind===ir.Identifier?t.execLiteral(n,e):n):n;if(-1===this.arity||0===r)return this._fn(t,e,i);if(r>0){const t=(t,e,n)=>this._fn(t,e,[...i,...n]);return new br(t,r,this._resolveIds,this.toString())}{const r=this._fn(t,e,i.slice(0,this.arity));return r instanceof br?r.call(t,e,i.slice(this.arity)):lr(!0,`Expected ${this.arity} argument${this.arity>1?"s":""}, but got ${n.length}.`)}}get arity(){return this._arity}toString(){return this._toString===vr?vr:`<${this._toString} function>`}toJS(){return this.toString()}debugTypeOf(){return br.kind}}br.kind="Function";const wr=t=>{var e;return new br(t.fn,t.arity,null===(e=t.resolveArgsIdentifiers)||void 0===e||e,t.name||t.fn.name)},xr=(t,e)=>wr({name:t.name,arity:null!=e?e:t.length,fn:(e,n,r)=>{const i=r.map(t=>e.execLiteral(t,n),e);return t.apply(e,i)},resolveArgsIdentifiers:!0}),Tr=wr({name:"const",arity:1,fn:(t,e,n)=>{lr(1!==n.length,`Const expected 1 argument, but got ${n.length}.`);const[r]=n;return wr({name:"const",arity:-1,fn:(t,e)=>t.execLiteral(r,e)})}}),kr=wr({name:"def",arity:2,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{hr(n,2);const[r,i]=n;dr(r,ir.Identifier);const o=t.execLiteral(i,e);return e.define(r.value,o),o}}),Sr=wr({name:"defn",arity:-1,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{hr(n,3);const[r,i,o]=n;return e.get("def").call(t,e,[r,new ar(ir.List,[new ar(ir.Identifier,"fn",nr.unknown),i,o],nr.unknown)])}}),Ar=wr({name:"if",arity:3,fn:(t,e,n)=>{hr(n,3);const[r,i,o]=n,s=t.execLiteral(r,e),a=t.options.utils.unboxing(s);if(!0===a)return t.execLiteral(i,e);if(!1===a)return t.execLiteral(o,e);throw new ur(`Expected boolean value in the if condition, but get '${a}'`)}}),Er=wr({arity:-1,name:"case",fn:(t,e,n)=>{lr(n.length<2,`Case expected at least 2 argument, but got ${n.length}.`);const[r,...i]=n,o=t.execLiteral(r,e);for(const n of i){dr(n,ir.List);const r=n.value;hr(r,2,`Case branch expected list with 2 items, but got ${r.length}`);const[i,s]=r,a=t.execLiteral(i,e),u=t.options.utils.unboxing(a);lr(!("else"===u||a instanceof br),"Case branch must start with a function or :else.");let c=!1;if("else"===u)c=!0;else{const e=t.evalFn(a,[o]),n=t.options.utils.unboxing(e);lr(!("boolean"==typeof n),"Case branch function must return with Bool."),c=n}if(c)return t.execLiteral(s,e)}lr(!0,`At least one of the case branch must match with the condition: ${o}`)}});class Or{constructor(t=null){this.enclosing=t,this.values=Object.create(null),this.locked=Object.create(null)}define(t,e,n=!1){if(this.locked[t])throw new ur(`'${t}' is locked and it is not re-definable.`);this.values[t]=e,n&&(this.locked[t]=!0)}get(t){if(this.values[t])return this.values[t];if(null!==this.enclosing)return this.enclosing.get(t);throw new ur(`Undefined identifier: '${t}'.`)}assign(t,e){if(!this.values[t]){if(null!==this.enclosing)return this.enclosing.assign(t,e);throw new ur(`Undefined identifier: '${t}'.`)}this.values[t]=e}getNames(){return Object.keys(this.values)}get parent(){return this.enclosing}}const Cr=wr({name:"fn",arity:-1,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{hr(n,2);const[r,i]=n;dr(r,ir.List);const o=r.value.slice(1);return o.map(t=>dr(t,ir.Identifier)),wr({name:"lambda",arity:o.length,fn:(t,n,r)=>{hr(r,o.length);const s=new Or(e);o.forEach((e,i)=>{const o=t.execLiteral(r[i],n);s.define(e.value,o)});const a=t.execLiteral(i,s);return t.clearEnv(),a}})}}),Mr=wr({name:"do",arity:-1,fn:(t,e,n)=>(lr(n.length<1,`Expected at least 1 argument, but got ${n.length}.`),n.map(n=>t.execLiteral(n,e)).pop())}),Nr=wr({name:"side-effect",arity:-1,fn:(t,e,n)=>{lr(n.length<1,`Eff expected at least 1 argument, but got ${n.length}.`);const[r,...i]=n,o=t.execLiteral(r,e);return lr(!(o instanceof br),"Eff first parameter must be a function."),wr({name:"side-effect",arity:-1,fn:t=>t.evalFn(o,i)})}}),Ir={stdout:void 0,lockedGlobals:!0,globals:{},utils:{unboxing:cr}},jr=[gr,_r];class Rr{constructor(t,e){this.globals=new Or,this.currentEnv=this.globals,this.lastLiteral=void 0,this.lastPrint=void 0,this.execLiteral=(t,e)=>{switch(this.currentEnv=e,this.lastLiteral=t,t.kind){case ir.Boolean:case ir.Integer:case ir.Float:case ir.FractionNumber:case ir.String:case ir.Keyword:case ir.Nothing:return t.value;case ir.Identifier:return e.get(t.value);case ir.List:return this.execList(t,e);default:return t}},this.options=Object.assign(Object.assign({},Ir),t);const{stdout:n,globals:r,lockedGlobals:i}=this.options,o=Object.assign(Object.assign({},mr),e);Object.keys(o).forEach(t=>{const e=o[t].factory,n=jr.includes(t)?-1:e.length;this.globals.define(t,xr(e,n))}),this.globals.define("print",xr(t=>{var e;return(n||console.log)(t,null===(e=this.lastPrint)||void 0===e?void 0:e.position)},-1)),this.globals.define("const",Tr),this.globals.define("def",kr),this.globals.define("defn",Sr),this.globals.define("if",Ar),this.globals.define("case",Er),this.globals.define("fn",Cr),this.globals.define("do",Mr),this.globals.define("side-effect",Nr),Object.keys(r).forEach(t=>{const e=r[t];let n=e;"function"==typeof e&&e.toString()!==vr&&(n=xr(e)),this.globals.define(t,n,i)})}interpret(t){let e;this.lastLiteral=t[0];try{for(const n of t)this.lastLiteral=n,e=this.execLiteral(n,this.globals)}catch(t){throw t.king===ur.kind?t:new ur(t,this.lastLiteral.position)}return e}evalFn(t,e){return t.call(this,this.currentEnv,e)}execList(t,e){const[n,...r]=t.value;"print"===n.value&&(this.lastPrint=n);const i=this.execLiteral(n,e);if("function"==typeof i.call)return i.call(this,e,r);throw new ur(`'${i}' is not a function`,t.position)}getGlobalNames(){return this.globals.getNames()}clearEnv(){null!==this.currentEnv.parent&&(this.currentEnv=this.currentEnv.parent)}}var Pr;!function(t){t.Parser="Parser",t.Runtime="Runtime"}(Pr||(Pr={}));class Dr{constructor(t,e){this.literals=e,this.interpreter=new Rr(t,e)}insituexecute(t){const e=new sr(t),n=new yr(e,this.literals).parse();if(n.hasError)throw{type:Pr.Parser,errors:n.errors};try{return this.interpreter.interpret(n.program)}catch(t){throw{type:Pr.Runtime,errors:[{message:t.message,position:t.position}]}}}execute(t){return Qn(this,void 0,void 0,function*(){const e=new sr(t),n=new yr(e,this.literals).parse();if(n.hasError)throw{type:Pr.Parser,errors:n.errors};try{this.interpreter.interpret(n.program)}catch(t){throw{type:Pr.Runtime,errors:[{message:t.message,position:t.position}]}}})}evalFn(t,e){return this.interpreter.evalFn(t,e)}}var Lr,Fr={const:t=>()=>t};class $r extends Error{constructor(t){"string"==typeof t?super(t):(super(t.message),this.stack=t.stack)}}!function(t){t[t.Less=0]="Less",t[t.Equal=1]="Equal",t[t.Greater=2]="Greater"}(Lr||(Lr={}));class Br{constructor(t){this._value=t}static fromJS(t){return new Br(t)}static fromStr(t){switch(t.value){case"true":return new Br(!0);case"false":return new Br(!1);default:throw new $r(`Invalid boolean: "${t.value}".`)}}get value(){return this._value}not(){return new Br(!this._value)}and(t){return new Br(this._value&&t._value)}or(t){return new Br(this._value||t._value)}equals(t){return new Br(this._value===t._value)}partialCmp(t){return this.value===t.value?Lr.Equal:this.value?Lr.Greater:Lr.Less}copy(){return new Br(this._value)}toString(){return this._value?"true":"false"}toJS(){return this._value}toJSON(){return this.toJS()}debugTypeOf(){return Vr(Br.kind)}}Br.kind="Bool";const qr=t=>new Br(t);class Ur{constructor(t){this._value=t}static fromJS(t){return new Ur(t)}static fromStr(t){return t.copy()}get value(){return this._value}add(t){return new Ur(this._value+t.value)}index(t){var e;return Number.isInteger(t.value)?new Ur(null!==(e=this._value.charAt(t.value))&&void 0!==e?e:""):new Ur("")}slice(t,e){return new Ur(this.value.slice(t.value,e.value))}equals(t){return qr(this._value===t.value)}partialCmp(t){const e=this._value.localeCompare(t.value);return e<0?Lr.Less:0===e?Lr.Equal:Lr.Greater}copy(){return new Ur(this._value)}toJS(){return this._value}toJSON(){return this.toJS()}toString(){return`${this._value}`}debugTypeOf(){return new Ur(Ur.kind)}contains(t){return qr(this.value.indexOf(t.value)>-1)}count(){return ei(this.value.length)}}Ur.kind="String";const Vr=(t="")=>new Ur(t);class Gr{constructor(){this._value=null}static fromStr(t){switch(t.value){case"undefined":case"nil":case"null":return new Gr;default:throw new $r(`Invalid Nothing literal: "${t.value}".`)}}get value(){return null}equals(t){return qr(this._value==t._value)}not(){return qr(!0)}toJS(){return null}toJSON(){return null}toString(){return"null"}debugTypeOf(){return Vr(Gr.kind)}}Gr.kind="null";const zr=new Gr,Wr=t=>~~t,Jr=t=>null==t||null==t||t==zr,Hr=(t,e)=>{if(t)throw new $r(e);return!0},Xr=(t,e)=>Hr(t.constructor!==e.constructor,`Type Error! Expected '${ti(t)}', but got '${ti(e)}'`),Kr=(t,e)=>{var n;return Hr(t!==e.constructor,`Expected '${null!==(n=t.kind)&&void 0!==n?n:t.name}', but got '${ti(e)}'.`)},Qr=(t,e)=>Hr(!t[e],`"${e.toString()}" is not defined on ${t}`),Zr=t=>Hr(!Number.isInteger(t),`Expected integer number', but got '${t}'.`),Yr=(t,e)=>(Hr(Jr(t),e),t),ti=t=>{var e,n,r,i;return null!==(i=null!==(n=null===(e=null==t?void 0:t.constructor)||void 0===e?void 0:e.kind)&&void 0!==n?n:null===(r=null==t?void 0:t.constructor)||void 0===r?void 0:r.name)&&void 0!==i?i:"unknown"};function ei(t,e=0){if("string"==typeof t){ni(t);const e=ri(t)?ii(t):oi(t);return ei(e.intValue,e.decimals)}return Number.isInteger(t)||0!==e?(Zr(t),Zr(e),new li(t,e)):ei(t.toString())}function ni(t){return Hr(""===t||isNaN(Number(t)),`Invalid number: "${t}"`)}function ri(t){return t.startsWith("0")?/^0[eE]0$/.test(t):/^[-+]?[1-9](\.\d+)?[eE][-+]?\d+$/.test(t)}function ii(t){Hr(!ri(t),`Input is not in scientific form: "${t}"`);const e=t.split(/[eE]/),n=oi(e[0]),r=parseInt(e[1]);return n.decimals>r?n.decimals-=r:(n.intValue*=Math.pow(10,r-n.decimals),n.decimals=0),n}function oi(t){var e;ni(t);const[,n]=t.split("."),r=null!==(e=null==n?void 0:n.length)&&void 0!==e?e:0;return{intValue:parseInt(t.replace(".","")),decimals:r}}function si(t,e){const n=Math.max(t.decimals,e.decimals);return{maxDecimal:n,intValue1:t.intValue*Math.pow(10,n-t.decimals),intValue2:e.intValue*Math.pow(10,n-e.decimals)}}var ai={modulo:function(t,e){const n=t.value,r=e.value;return Zr(n),Zr(r),Hr(r<1,`Modulo (${r}) must be positive.`),Hr(n<0,`Number (${n}) cannot be negative.`),ei(n%r)}};const ui=(t,e)=>t!==e&&t?e?ui(e,t%e):t:e,ci=t=>Math.abs(t)<=Number.EPSILON;class li{constructor(t,e=0){const n=function(t,e){if(0===t)return{intValue:0,decimals:0};for(;t>Number.MAX_SAFE_INTEGER||t%10==0&&e>0;){const n=t.toString();t=parseInt(n.substring(0,n.length-1)),e-=1}return{intValue:t,decimals:e}}(t,e);this._decimals=n.decimals,this._intValue=n.intValue}get intValue(){return this._intValue}get decimals(){return this._decimals}get value(){return this._intValue*Math.pow(10,-this._decimals)}equals(t){return qr((e=this.value,n=t.value,ci(e-n)));var e,n}negate(){return new li(-this.intValue,this.decimals)}add(t){const e=si(this,t),n=e.intValue1+e.intValue2;return new li(n,e.maxDecimal)}subtract(t){const e=si(this,t),n=e.intValue1-e.intValue2;return new li(n,e.maxDecimal)}multiply(t){return new li(this.intValue*t.intValue,this.decimals+t.decimals)}divide(t){if(0===t.intValue)throw new $r("Cannot divide by zero!");const e=si(this,t),n=Math.round(e.intValue1/e.intValue2*Math.pow(10,12));return new li(n,12)}partialCmp(t){const e=si(this,t);return e.intValue1<e.intValue2?Lr.Less:e.intValue1>e.intValue2?Lr.Greater:Lr.Equal}toJS(){return this.intValue/Math.pow(10,this.decimals)}toString(){return`${t=this.intValue,e=this.decimals,(t/Math.pow(10,e)).toFixed(e)}`;var t,e}copy(){return new li(this.intValue,this.decimals)}debugTypeOf(){return Vr(li.kind)}isInteger(){return qr(0===this.decimals)}toJSON(){return this.toString()}}li.kind="Number";const hi=t=>e=>{Kr(li,e);try{return ei(t(e.value))}catch(n){throw new $r(`Invalid argument for ${t.name}: ${e.value}`)}},di=t=>(e,n)=>(Kr(li,e),Kr(li,n),ei(t(e.value,n.value))),pi=ei(Math.E),fi=ei(Math.LN2),mi=ei(Math.LN10),gi=ei(Math.LOG2E),_i=ei(Math.LOG10E),yi=ei(Math.PI),vi=ei(Math.SQRT1_2),bi=ei(Math.SQRT2),wi=hi(Math.abs),xi=hi(Math.sign),Ti=di((t,e)=>Math.min(t,e)),ki=di((t,e)=>Math.max(t,e)),Si=hi(Math.floor),Ai=hi(Math.round),Ei=hi(Math.ceil),Oi=hi(Math.trunc),Ci=hi(Math.cbrt),Mi=hi(Math.sqrt),Ni=hi(Math.exp),Ii=di(Math.pow),ji=hi(Math.log),Ri=hi(Math.log2),Pi=hi(Math.log10),Di=Math.PI/180,Li=hi(t=>{const e=t%Math.PI;return ci(e)||ci(e-Math.PI)?0:Math.sin(t)}),Fi=hi(Math.asin),$i=hi(Math.asinh),Bi=hi(Math.cos),qi=hi(Math.acos),Ui=hi(Math.acosh),Vi=hi(Math.tan),Gi=hi(Math.atan),zi=di(Math.atan2),Wi=hi(Math.atanh);var Ji=Object.freeze({__proto__:null,E:pi,LN2:fi,LN10:mi,LOG2E:gi,LOG10E:_i,PI:yi,SQRT1_2:vi,SQRT2:bi,abs:wi,sign:xi,min:Ti,max:ki,floor:Si,round:Ai,ceil:Ei,trunc:Oi,cbrt:Ci,sqrt:Mi,exp:Ni,pow:Ii,log:ji,log2:Ri,log10:Pi,deg2rad:t=>t.multiply(ei(Di)),rad2deg:t=>t.divide(ei(Di)),sin:Li,asin:Fi,asinh:$i,cos:Bi,acos:qi,acosh:Ui,tan:Vi,atan:Gi,atan2:zi,atanh:Wi});const Hi=t=>(Qr(t,"copy"),t.copy());var Xi={typeof:t=>{const e=t.debugTypeOf?t.debugTypeOf():Vr("<unknown>");return e instanceof String?Vr(e):e},copy:Hi,"deep-copy":t=>{var e;return Qr(t,"copy"),t.deepCopy?null===(e=t.deepCopy)||void 0===e?void 0:e.call(t):Hi(t)},str:t=>Vr(t.toString()),"to-json":t=>{let e=null;return"function"==typeof t.toJSON?e=t.toJSON():"function"==typeof t.toJS&&(e=t.toJS()),Vr(JSON.stringify(e))}};const Ki=(t,e)=>t.constructor!==e.constructor?qr(!1):t.equals(e),Qi=(t,e)=>{Xr(t,e);const n=t.lt;return"function"==typeof n?n(e):qr(t.partialCmp(e)===Lr.Less)},Zi=(t,e)=>{Xr(t,e);const n=t.gt;return"function"==typeof n?n(e):qr(t.partialCmp(e)===Lr.Greater)};var Yi={"==":Ki,"!=":(t,e)=>Ki(t,e).not(),"<":Qi,"<=":(t,e)=>qr(Ki(t,e).value||Qi(t,e).value),">":Zi,">=":(t,e)=>qr(Ki(t,e).value||Zi(t,e).value)};var to={count:t=>t.count(),contains:function(t,e){return e.contains(t)},map:function(t,e){return e.map(e=>this.evalFn(t,[e]))},filter:function(t,e){return e.filter(e=>this.evalFn(t,[e]))},reduce:function(t,e,n){return n.reduce(t,(t,n)=>this.evalFn(e,[t,n]))},slice:function(t,e,n){return n.slice(t,e)}};const eo=(t,e)=>(Xr(t,e),t.add(e)),no=(t,e)=>(Xr(t,e),t.multiply(e));var ro={negate:t=>t.negate(),not:t=>t.not(),and:(t,e)=>t.and(e),or:(t,e)=>t.or(e),"+":eo,"-":(t,e)=>(Xr(t,e),t.subtract(e)),"*":no,"/":(t,e)=>(Xr(t,e),t.divide(e)),get:(t,e)=>t.index(e)};class io{constructor(t){t.map(e=>Xr(t[0],e)),this._value=t}get value(){return this._value}contains(t){return qr(void 0!==this.value.find(e=>Ki(e,t).value))}add(t){return new io(this._value.concat(t.value))}count(){var t;return new li(null!==(t=this._value.length)&&void 0!==t?t:0)}map(t){return new io(this.value.map(e=>t(e)))}filter(t){return new io(this.value.filter(e=>t(e).toJS()))}reverse(){return new io(this.value.reverse())}reduce(t,e){return this.value.reduce(e,t)}intersperse(t){const e=this.value.length-1;return new io(this.value.reduce((n,r,i)=>(n.push(r),i<e&&n.push(t),n),[]))}toJS(){return this.value.map(t=>t.toJS())}toJSON(){return this.value.map(t=>t.toJSON())}toString(){return`[${this._value.map(t=>t.toString()).join(",")}]`}index(t){Kr(li,t);return Yr(this.value[t.value],`Vector index ${t.toString()} is not defined`)}slice(t,e){return Kr(li,t),Kr(li,e),new io(this.value.slice(t.value,e.value))}copy(){return new io([...this._value])}deepCopy(){return new io(this._value.map(t=>Hi(t)))}debugTypeOf(){return Vr(io.kind)}}function oo(...t){return new io(t)}io.kind="Vector";var so={sum:t=>(Kr(io,t),t.reduce(ei(0),eo)),prod:t=>(Kr(io,t),t.reduce(ei(1),no)),intersperse:(t,e)=>(Kr(io,e),e.intersperse(t)),join:t=>(Kr(io,t),t.reduce(Vr(""),eo)),"join-with":(t,e)=>(Kr(io,e),e.intersperse(t).reduce(Vr(""),eo)),"num-list":(t,e)=>(Kr(io,e),e.map(t=>Vr(t.toString())).intersperse(t).reduce(Vr(""),eo)),head:t=>{Kr(io,t);return Yr(t.value[0],"Vector is empty")},reverse:t=>(Kr(io,t),oo(...t.value.reverse())),slice:(t,e,n)=>(Kr(io,t),Kr(li,n),Kr(li,e),Yr(t.value.length,"Vector is not defined correctly"),oo(...t.value.slice(e.value,n.value))),tail:t=>{Kr(io,t),Yr(t.value.length,"Vector is not defined correctly");return oo(...t.value.slice(1))}};const ao=Math.random;var uo=Object.freeze({__proto__:null,random:()=>ei(ao()),randomInt:(t,e)=>{const n=Wr(t.value),r=Wr(e.value);return ei(Wr(n+ao()*(r-n)))},shuffle:t=>{const e=[...t.value];let n,r,i;for(i=e.length-1;i>0;i--)n=Math.floor(Math.random()*(i+1)),r=e[i],e[i]=e[n],e[n]=r;return oo(...e)},range:(t,e,n)=>{const r=t.value,i=n.value,o=Wr(e.value);let s=r;const a=[];for(let t=0;t<o;t++)a.push(ei(s)),s+=i;return oo(...a)},range0:t=>{const e=Wr(t.value);return oo(...Array.from({length:e},(t,e)=>ei(e)))}});class co{constructor(t){this._value=t}get value(){return this._value}toJS(){var t,e;return null===(e=null===(t=this._value)||void 0===t?void 0:t.toJS)||void 0===e?void 0:e.call(t)}toJSON(){return this.toJS()}toString(){return`Just(${this._value.toString()})`}debugTypeOf(){return Vr(co.kind)}}co.kind="Just";class lo{constructor(t=[]){if(t.length%2!=0)throw new $r("Invalid hash map definition.\nDefinition must contains key value pairs");const e=((t,e=2)=>{const n=[],r=t.length;for(let i=0;i<r;i+=e)n.push(t.slice(i,i+e));return n})(t).map(([t,e])=>{if(Ur!==t.constructor)throw new $r("Invalid hash map definition.\n Keys are must be string or keyword");return[t.value,e]});this._value=new Map(e)}get value(){return this._value}toJS(){return new Map(Array.from(this._value.entries()).map(([t,e])=>[t,e instanceof li?e.toString():e.toJS()]))}toJSON(){return Array.from(this._value.entries()).reduce((t,[e,n])=>(t[e]=n.toJSON(),t),{})}toString(){return`{${Array.from(this._value.entries()).map(([t,e])=>`${t.toString()} -> ${e.toString()}`).join(", ")}}`}debugTypeOf(){return Vr(lo.kind)}index(t){Kr(Ur,t);try{const e=this._value.get(t.value);return Jr(e)?new Gr:e}catch(t){return new Gr}}}lo.kind="HashMap";const ho=(...t)=>new lo(t);var po={keys:t=>(Kr(lo,t),oo(...Array.from(t.value.keys()).map(t=>Vr(t)))),values:t=>(Kr(lo,t),oo(...Array.from(t.value.values()))),"hash-map":ho};class fo{constructor(t){const e=t.value;e.map(t=>Xr(e[0],t)),this._value=e.reduce((t,e)=>(t.find(t=>Ki(t,e).value)||t.push(e),t),[])}get value(){return this._value}contains(t){return qr(void 0!==this.value.find(e=>Ki(e,t).value))}union(t){return new fo(oo(...this._value.concat(t.value)))}difference(t){return new fo(oo(...this.value.filter(e=>!t.contains(e).value)))}intersection(t){return new fo(oo(...this.value.concat(t.value).filter(e=>t.contains(e).value&&this.contains(e).value)))}symmetricDifference(t){return new fo(oo(...this.value.concat(t.value).filter(e=>!(t.contains(e).value&&this.contains(e).value))))}count(){var t;return new li(null!==(t=this._value.length)&&void 0!==t?t:0)}map(t){return new fo(oo(...this.value.map(t)))}filter(t){return new fo(oo(...this.value.filter(e=>t(e).toJS())))}reduce(t,e){return this.value.reduce(e,t)}toJS(){return this.value.map(t=>t.toJS())}toJSON(){return this.value.map(t=>t.toJSON())}toString(){return`[${this.value.map(t=>t.toString()).join(",")}]`}copy(){return new fo(oo(...this.value))}deepCopy(){return new fo(oo(...this.value.map(t=>Hi(t))))}debugTypeOf(){return Vr(fo.kind)}}fo.kind="Set";var mo={Set:t=>new fo(t),"set-2-list":function(t){return oo(...t.value)},"set-union":function(t,e){return t.union(e)},"set-diff":function(t,e){return t.difference(e)},"set-intersection":function(t,e){return t.intersection(e)},"set-symmetric-difference":function(t,e){return t.symmetricDifference(e)}};const go=(t,e)=>Number.isInteger(t)&&Number.isInteger(e)&&0!==e;class _o{constructor(t,e){if(!go(t,e))throw new $r("Invalid fraction number parameters!");e<0&&(t*=-1,e*=-1);const n=ui(Math.abs(t),Math.abs(e));this._n=t/n,this._d=e/n}get numerator(){return this._n}get denominator(){return this._d}equals(t){return qr(this.numerator===t.numerator&&this.denominator===t.denominator)}negate(){return new _o(-this._n,this._d)}add(t){const e=this.numerator*t.denominator+this.denominator*t.numerator,n=this.denominator*t.denominator;return new _o(e,n)}subtract(t){const e=this.numerator*t.denominator-this.denominator*t.numerator,n=this.denominator*t.denominator;return new _o(e,n)}multiply(t){const e=this.numerator*t.numerator,n=this.denominator*t.denominator;return new _o(e,n)}divide(t){const e=this.numerator*t.denominator,n=this.denominator*t.numerator;return new _o(e,n)}partialCmp(t){const e=this._d*t._d/ui(this._d,t._d),n=this._n*e/this._d,r=t._n*e/t._d;return n<r?Lr.Less:n>r?Lr.Greater:Lr.Equal}toJS(){return{numerator:this._n,denominator:this._d}}toJSON(){return this.toString()}toString(){return`${this._n}/${this._d}`}copy(){return new _o(this._n,this._d)}debugTypeOf(){return Vr(_o.kind)}}_o.kind="Fraction";const yo=(t,e)=>new _o(t,e);var vo={"number-2-fraction":(t,e)=>{const n=t.value;Hr(n<1||!Number.isInteger(n),`Accuracy must be a positive integer number instead of ${n}`);const r=e.value,i=Math.pow(10,n);return yo(Math.round(r*i),i)},"fraction-2-number":t=>ei(t.numerator).divide(ei(t.denominator)),reciprocal:t=>(Kr(_o,t),yo(t.denominator,t.numerator))};const bo=t=>t,wo={Bool:{parser:t=>Br.fromStr(Vr(t)),factory:t=>(Kr(Br,t),t)},Nothing:{parser:t=>Gr.fromStr(Vr(t)),factory:t=>(Kr(Gr,t),t)},Int:{parser:ei,factory:function(t){return Kr(li,t),Hr(!t.isInteger().value,"Expected integer, but got float number."),t}},Float:{parser:ei,factory:function(t){return Kr(li,t),t}},FractionNumber:{parser:t=>{const[e,n]=t.split("/").map(parseFloat);if(go(e,n))return new _o(e,n);throw new $r(`Invalid fraction number: ${t}.`)},factory:(t,e)=>(Hr(!t.isInteger().value,"Numerator must be integer"),Hr(!e.isInteger().value,"Denominator must be integer"),new _o(t.toJS(),e.toJS()))},String:{parser:Vr,factory:t=>(Kr(Ur,t),t)},Vector:{parser:bo,factory:oo},HashMap:{parser:bo,factory:ho}},xo=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Xi),Yi),to),ro),Fr),Ji),ai),vo),so),po),mo),uo),{maybe:t=>Jr(t)?zr:new co(t),Nothing:zr}),To={unboxing:t=>t.toJS()};function ko(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(t,e){return String.fromCharCode("0x"+e)}))}function So(t){return decodeURIComponent(atob(t).split("").map(function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)}).join(""))}wn("error",{type:"critical",message:"LEAF core error: race condition detected in leaflisp.js",codebase:"/src/ghostos/api/parser/nodelogic/wizardry/leaflisp.js"},{});const Ao=t=>t>0?" ".repeat(t):"",Eo={trace:[],probe:[]},Oo=(t,e=0,n=!1)=>{const r=typeof t,i=Ao(e),o=Ao(e+1);return"string"===r?(n?"":i)+`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"\n`:"object"===r?Array.isArray(t)?(n?"":i)+"[\n"+`${t.map(t=>Oo(t,e+1)).join("")}`+i+"]\n":[null,void 0].includes(t)?(n?"":i)+"null\n":(n?"":i)+"{\n"+`${Object.entries(t).map(([t,n])=>o+":"+t+" "+Oo(n,e+1,!0)).join("")}`+i+"}\n":"boolean"===r?(n?"":i)+(t?"true\n":"false\n"):"number"===r?(n?"":i)+String(t)+"\n":(n?"":i)+"null\n"};const Co=(t,e=!0)=>{if(null==t)return xo.Nothing;const n=typeof t;return"string"===n?Vr(t):"object"===n?Array.isArray(t)?oo(...t.filter(t=>t).map(t=>Co(t,!1))):[null,void 0].includes(t)?xo.Nothing:ho(...Object.entries(t).map(([t,e])=>[Vr(t),Co(e,!1)]).flat()):"boolean"===n?qr(t):"number"===n?ei(t.toString().includes("e")?function(t){let e="";"-"==(t+="").charAt(0)&&(t=t.substring(1),e="-");let n=t.split(/[e]/gi);if(n.length<2)return e+t;let r=.1.toLocaleString().substr(1,1),i=n[0],o=+n[1],s=(i=i.replace(/^0+/,"")).replace(r,""),a=i.split(r)[1]?i.indexOf(r)+o:s.length+o,u=a-s.length,c=""+BigInt(s);return s=o>=0?u>=0?c+"0".repeat(u):l():a<=0?"0"+r+"0".repeat(Math.abs(a))+c:l(),u=s.split(r),(0==u[0]&&0==u[1]||0==+s&&0==+c)&&(s=0),e+s;function l(){return s.replace(new RegExp(`^(.{${a}})(.)`),`$1${r}$2`)}}(t):t):xo.Nothing},Mo=({_probefunc:t,_tracefunc:e}=args)=>({return:t=>t,outport:t=>t,undefined:xo.Nothing,nil:xo.Nothing,null:xo.Nothing,trace:t=>{const n=t.toJSON();try{e&&e(n)}catch(e){return t}return t},probe:e=>{const n=e.toJSON();try{t&&t(n)}catch(t){return e}return e},format:(t,e)=>{const n=e.toJSON(),r=t.toJS().replace(/\$\{([^{}]*)\}/gm,(t,e)=>`\${this.${e.replace(/\s*/g,"")}}`);return Vr(function(t,e){const n=new Proxy(e,{get:(t,e)=>{const n=t[e];return"object"==typeof n&&null!==n?JSON.stringify(n).replace(/"/g,'"'):n}});return new Function("return `"+t+"`;").call(n)}(r.replace(/"/g,'"'),n))},isnil:t=>qr("null"==t||t.constructor==xo.Nothing.constructor),isbottle:t=>{const e=t.toJSON();return qr(nn(e))},islist:t=>{const e=t.toJSON();return qr(Array.isArray(e))},flatten:t=>{const e=t.toJSON();return Co(e.flat().filter(t=>t),!1)},join:(t,e)=>{const n=t.toJSON();return Vr(n.join(e))},bottle:(t,e)=>{if(t.constructor!==Ur)throw new $r(`Expected '${Ur.kind??Ur.name}', but got '${getObjectName(t.value)}'.`);const n=t.toJSON(),r=e.toJSON(),i="object"==typeof r&&!Array.isArray(r)&&"_content"in r&&"_label"in r?{_bname:n,_content:r._content,_label:r._label}:{_bname:n,_content:r,_label:{}};return Co(i)},getbottle:(t,e)=>{if(t.constructor!==io)throw new $r(`Expected '${io.kind??io.name}', but got '${getObjectName(t.value)}'.`);const n=t.value.filter(t=>t.value.get("_bname").value===e.value);return 1===n.length?n[0]:n.length>1?n:void 0},unbottle:t=>{if(t.constructor!==lo)throw new $r(`Expected '${lo.kind??lo.name}', but got '${getObjectName(t.value)}'.`);return t.value.get("_content")},regexp:(t,e)=>{const n=e.toJSON().match(/\/(.*)\/(.*)/),r=new RegExp(n[1],n[2]),i=t.toJSON(),o="string"===typeof i?i.match(r):[];return Co(o||[])},min:t=>{if(t.constructor!==io)throw new $r(`Expected '${io.kind??io.name}', but got '${getObjectName(t.value)}'.`);const e=t.value.map(t=>t.value);return ei(Math.min(...e))},max:t=>{if(t.constructor!==io)throw new $r(`Expected '${io.kind??io.name}', but got '${getObjectName(t.value)}'.`);const e=t.value.map(t=>t.value);return ei(Math.max(...e))},parse:t=>{const e=t.toJSON();let n;return ni(e),n=ri(e)?ii(e):oi(e),0===n.decimals?ei(n.intValue):ei(n.intValue,n.decimals)},"merge-dict":(t,e)=>{if(t.constructor!==lo)throw new $r(`Expected '${lo.kind??lo.name}', but got '${getObjectName(t.value)}'.`);if(e.constructor!==lo)throw new $r(`Expected '${lo.kind??lo.name}', but got '${getObjectName(e.value)}'.`);const n={...t.toJSON(),...e.toJSON()};return Co(n)},"make-dict":(t,e)=>{if(t.constructor!==io)throw new $r(`Expected '${io.kind??io.name}', but got '${getObjectName(t.value)}'.`);if(e.constructor!==io)throw new $r(`Expected '${io.kind??io.name}', but got '${getObjectName(e.value)}'.`);const n=t.toJSON(),r=e.toJSON(),i=[...Array(n.length).keys()].reduce((t,e)=>({...t,[n[e]]:r[e]}),{});return Co(i)},concat:(t,e)=>{if(t.constructor!==io)throw new $r(`Expected '${io.kind??io.name}', but got '${getObjectName(t.value)}'.`);if(e.constructor!==io)throw new $r(`Expected '${io.kind??io.name}', but got '${getObjectName(e.value)}'.`);return oo(...t.value.concat(e.value))},gload:t=>{Ro(t.toJSON(),plisp_instance)},uuid4:()=>Vr(Kn()),uuid5:t=>{const e=Bn(t.toString(),Bn.URL);return Vr(e)},"*":(t,e)=>ei(t*e),"/":(t,e)=>ei(t/e),"+":(t,e)=>isNaN(t.value)||isNaN(e.value)?t.add(e):ei(t.value+e.value),"-":(t,e)=>ei(t-e),tofixed:(t,e)=>Vr(Number(t).toFixed(e))}),No=(t,e)=>{const n={};(async()=>{const n={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:t.leafio,etaTree:t},user:{spellbook:t.graphcomponents.spelldefs,lambdalut:t.leafgraph.edges.lambda.sourcelut}},r=e_.lambda(n)({refnode:"leaflisp_runtime",refnodedata:{leaf:{logic:{args:{graphuuid:"",domain:"breezyforest",appid:"leaflisp-help",graphaddrstr:"breezyforest/leaflisp-help"}}}},nodelambda:[],contextuallambda:[]}),i=await r;return i?.cheatsheet?await a_(i.cheatsheet._default,e.data,{}):[]})().then(t=>{n.cheatsheet=t});const r={cheat:()=>{const t={help:"-LEAFlisp help text----------------------------------------------\n--------------------------------------------------------------------------\n"};return Object.keys(n.cheatsheet).map(e=>{t[e]=e in n.cheatsheet?n.cheatsheet[e]:`LEAFlisp error: no help is available for an unknown command ${e}.`}),Co(t)},help:t=>{const e={},r=t.toJSON();return r.length>0?(e.help="-LEAFlisp help text----------------------------------------------\n--------------------------------------------------------------------------\n",r.map(t=>{e[t]=t in n.cheatsheet?n.cheatsheet[t]:`LEAFlisp error: no help is available for an unknown command ${t}.`}),Co(e)):(e.help="-LEAFlisp help text----------------------------------------------\n--------------------------------------------------------------------------\n",Object.keys(n.cheatsheet).map(t=>{e[t]=t in n.cheatsheet?n.cheatsheet[t]:`LEAFlisp error: no help is available for an unknown command ${t}.`}),Co(e))}};return new Dr({globals:{...xo,...Mo({}),...r},utils:To},wo)},Io=["linear-algebra"],jo={"linear-algebra":{lp:(t,e)=>ho(Vr("a"),t,Vr("b"),e)}},Ro=(t,e)=>{Io.includes(t)&&Object.entries(jo[t]).map(([t,n])=>{e.interpreter.globals.define(t,xr(n))})},Po=(t,e,n,r,i=0)=>{try{e?.slice(0,4);const r=n.insituexecute(t);try{return[0,r.toJSON()]}catch(t){return[0,null]}}catch(t){let n=[];if("errors"in t)for(let o of t.errors){const s=`LEAFlisp error: {refnode: ${e}}: ${"Parser"===t.type?`line: ${o.line-i} - ${o.message}`:`line: ${o.position?.line-i} - ${o.message}`}`;n.push(wn("error",{address:r,refnode:e,message:s}))}else n.push(`LEAFlisp error: ${e}: unidentified execution failure. please check your leaflisp code for anomalies. exception: ${t.message}`);return[-1,n]}};let Do={};const Lo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{let o,s;const a=bn.memoize(async()=>await f_("breezyforest/probe",t.gos.etaTree,"leaflisp")),u=t.gos.etaTree.domain+"/"+t.gos.etaTree.appid,c=(t,n=e,r=0)=>{a().then(i=>{Object.entries(i).length>0&&(r>0&&Eo.trace.length===r&&Eo.trace.shift(),Eo.trace.push({timestamp:Date.now(),address:u,refnode:e,trace:t}),a_(i.probe._default,Eo.trace,{},n).then(t=>{}))})},l=(t,n=e,r=1)=>{a().then(i=>{Object.entries(i).length>0&&(r>0&&Eo.probe.length===r&&Eo.probe.shift(),Eo.probe.push({timestamp:Date.now(),address:u,refnode:e,trace:t}),a_(i.probe._default,Eo.probe,{},n).then(t=>{}))})},h=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});Do[e]="interactive"in h;const d=Do[e],p=n.leaf.logic.args.lispexpression;o="global"in h?t.gos.etaTree.gRuntimeLEAFlisp:new Dr({globals:{...xo,...Mo({_probefunc:l,_tracefunc:c})},utils:To},wo);const f="rewrite"in h,m="bottle"in h;e.slice(0,4);const g={codebase:"leaflisp.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data,leafaddress:t.gos.etaTree.domain+"/"+t.gos.etaTree.appid},_=new Pt;if(d){t.gos.etaTree.leafio.elementioLUT[e]=_;const n={graphuuid:"",domain:"breezyforest",appid:"leaflisp",graphaddrstr:"breezyforest/leaflisp"},r=e_.lambda(t)({refnode:"leaflisp_runtime_interactive",refnodedata:{leaf:{logic:{args:n}}},nodelambda:[],contextuallambda:[]}),i=await r;s=()=>{const n=wn("dataevent",{_refnode:e,_provenance:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid,refnodedata:g.leafnode,codebase:"leaflisp.js"}},{});a_(i.vim._default,n,{})}}return(r,i)=>{e.slice(0,4);const a=i?._config?.loopidx,u=i?._config?.clubrefnode,c=(t,n=p)=>{e.slice(0,4);let r=`(def inport ${Oo(null==t?[]:t)})`;a>=0&&(r+=`(def loopyindex ${a})`),u&&(r+=`(def clubref "${u}")`);const i=r.split(/\r\n|\r|\n/).length;r+=`${n}`;try{const[t,n]=Po(r,e,o,g.leafaddress,i);return-1===t&&l(n,e),n}catch(t){throw new $r(`LEAFlisp Error: ${t}`)}};return p_(i,r,void 0,{...g,metastep:"invoking leaflisp"},{leaflogic:d?(t,e)=>{const n=new Pt;let r=!1;const i=e._stream.pipe(V(t=>(s&&s(),t)),Nt(...t.map(t=>t._stream)),It(t=>Et(new qt(t[0]),_)),V(t=>{globalThis.DEBUG;const e=t[1];return r=!0,n.next(e),t[0]}),Lt());return{_stream:n.pipe($t(t=>r),V(t=>t),Lt()),_control:{...e,_stream:i}}}:(r,i)=>{const o=new Pt;let s=!1,a=p;const u=f?i._stream.pipe(V(t=>t),Nt(...r.map(t=>t._stream)),V(r=>{globalThis.DEBUG;let i=r[1];if(nn(i)&&"rewrite"===i._bname){const r=xn("*",i),o={...n},s=Oo(null==r?[]:r);o.leaf.logic.args.lispexpression=s,n.leaf.logic.args.lispexpression=s,a=s,t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:ko(JSON.stringify(o))}}),i=void 0}if(null!=i){s=!0;const t=c(i);return o.next(t),r[0]}}),$t(t=>void 0!==t),Lt()):m?i._stream.pipe(V(t=>t),Nt(...r.map(t=>t._stream)),V(t=>{globalThis.DEBUG;const e=t[1];if(nn(e)&&"codebottle"===e._bname){const n=xn("*",e);s=!0;const r=n.data,i=n.code,a=c(r,i);return o.next(a),t[0]}}),$t(t=>void 0!==t),Lt()):i._stream.pipe(V(t=>t),Nt(...r.map(t=>t._stream)),V(t=>{globalThis.DEBUG;const e=t[1];s=!0;const n=c(e);return o.next(n),t[0]}),Lt());return{_stream:o.pipe($t(t=>s),V(t=>t),Lt()),_control:{...i,_stream:u}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>(n,r)=>({...Lg(e,n,!1,!1,!1,{provenance:"leaflisp.js lambda",refnode:e,etaTree:t.gos.etaTree}),_control:r}),methods:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={lispcode:""},s=(t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>(await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{version:"breezyforest",nodequery:t=>({_stream:t._stream.pipe(map(t=>(node_output=n,node_output))),_control:controlflow$obj}),nodemethod:t=>({})}))(t)({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}),a=Do[e];return{...s,isinteractive:a,texteditor:{setTextSource:r=>{o.lispcode=r;const i={...n};i.leaf.logic.args.lispexpression=r,a||t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:ko(JSON.stringify(i))}})},getTextSource:()=>n.leaf.logic.args.lispexpression},general:{getNodeData:()=>n,executeLEAFlisp:t=>run(t)}}}},Fo=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafchronosflow.js",codebase:"/src/ghostos/api/parser/nodelogic/dataflow/leafchronosflow.js"},{}),{dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s={codebase:"leafchronosflow.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data},a="_default"in o?(t,e)=>o._default(t,e):(t,e)=>{const n=new Pt,r=t[0]._stream,i=e._stream.pipe(V(t=>t),Nt(r),V(t=>(n.next(t[1]),t[0])),Lt());return{_stream:n.pipe(V(t=>t),Lt()),_control:{...e,_stream:i.pipe(V(t=>t),Lt())}}};return(t,n)=>{if(t.length>1){const r=Bt(...t.map((t,e)=>t._stream.pipe(V(t=>t),Lt())));if("concat"in o){return{...$g(t),_control:n}}if("merge"in o){return{...Bg(t),_control:n}}if("combine"in o){return{...Lg(e,t),_control:n}}if("substitute"in o){const e=Object.keys(o.substitute);return{...Fg(t,e),_control:n}}{const t=t=>t,e=n._stream.pipe(V(t=>t));return p_({_stream:e},[{_stream:r}],void 0,{...s,metastep:"executing leafchronosflow "},{leaflogic:a,datalogic:{pre:t}})}}if(1===t.length)return{...t[0],_control:n}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t),_control:n})}),s}}),$o=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafmixflow.js",codebase:"/src/ghostos/api/parser/nodelogic/dataflow/leafmixflow.js"},{}),{dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s={codebase:"leafmixflow.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data},a="_default"in o?(t,e)=>o._default(t,e):(t,e)=>{const n=new Pt,r=e._stream.pipe(Nt(...t.map(t=>t._stream)),It(t=>{const e="bottle"in o,r="parfait"in o,i="crate"in o,s="dictionary"in o,a="raw"in o;let u;return"flatten"in o?(u=Array.isArray(t[1])?t[1].flat():t[1],n.next(e?wn("mix",u):u)):r&&!s?(u=[t[1]].flat().map(t=>nn(t)?xn("*",t):void 0).filter(t=>t&&"empty_data"!==t),a||(u=[...new Set(u.flat())]),n.next(e?wn("mix",u):u)):i&&!s?(u=[t[1]].flat().map(t=>nn(t)?t:void 0).filter(t=>void 0!==t&&!on(t)),a||(u=[...new Set(u.flat())]),1===u.length?n.next(e?wn("mix",u[0]):u[0]):n.next(e?wn("mix",u):u)):(u={},[t[1]].flat().filter(t=>nn(t)&&!on(t)).map(t=>{if(nn(t))return u=((e,n={})=>{const r=e._bname;return{...n,[r]:xn("*",t)}})(t,u),t}),n.next(e?wn("mix",u):u)),ln(t[0])}),Lt());return{_stream:n.pipe(V(t=>t),Lt()),_control:{...e,_stream:r}}};return(t,n)=>{if(t.length>1){if("concat"in o){return{...$g(t),_control:n}}if("merge"in o){return{...Bg(t),_control:n}}if("combine"in o){return{...Lg(e,t),_control:n}}if("substitute"in o){const e=Object.keys(o.substitute);return{...Fg(t,e),_control:n}}{const e=t=>t,r=n._stream;return p_({_stream:r},t,void 0,{...s,metastep:"executing leafmixflow "},{leaflogic:a,datalogic:{pre:e}})}}if(1===t.length){const e=t=>t,r=n._stream;return p_({_stream:r},t,void 0,{...s,metastep:"executing leafmixflow "},{leaflogic:a,datalogic:{pre:e}})}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t),_control:n})}),s}}),Bo=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafgateflow.js",codebase:"/src/ghostos/api/parser/nodelogic/dataflow/leafgateflow.js"},{}),Wt("leafgateflow")),qo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{type:s,args:a}=n.leaf.logic,u=En(Bo.editorconfig.namedatakey,a).toLowerCase(),c=En(Bo.editorconfig.toggledatakey,a),l=(()=>{const t=Object.keys(o).filter(t=>0===Object.keys(o[t]).length);return t.length>0?t.sort().join(";"):void 0})(),h={codebase:"leafgateflow.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>p_(e,t,void 0,{...h,metastep:"gateflow "+(c?"NOT gate, ":"normal gate, ")+u},{leaflogic:(t,e)=>{const n=new Pt,r=e._stream.pipe(Nt(...t.map(t=>t._stream)),V(t=>{const e=t[1],r=t=>nn(t)?!c&&t._bname?.toLowerCase()===u||c&&t._bname?.toLowerCase()!==u?t:void 0:"{crate}"===u?!c&&t._cratelabel?"uncrate"===l?Object.keys(t).filter(t=>"_cratelabel"!==t).map(e=>t[e]).flat():t:c&&!t._cratelabel?t:void 0:((t,e)=>{const n=t?Object.entries(t).map(t=>t[0]+"="+("object"==typeof t[1]?JSON.stringify(t[1]):t[1])):[];if(e?!n.includes(u):n.includes(u))return t})(t,c),i=Array.isArray(e),o=i?e.map(t=>r(t)).filter(t=>void 0!==t):r(e);if(o?.length>0||!i&&void 0!==o)return n.next(o),t[0]}),$t(t=>void 0!==t),Lt());return{_stream:n.pipe(V(t=>t),Lt()),_control:{...e,_stream:r.pipe(V(t=>t),Lt())}}},datalogic:{post:t=>t}})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t),_control:n})}),s}},Uo=wn("error",{type:"critical",message:"LEAF core error: race condition detected in leaflabel.js",codebase:"/src/ghostos/api/parser/nodelogic/datautils/leaflabel.js"},{}),Vo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={codebase:"leaflabel.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(r,i)=>{const a=r=>{if(t.gos.etaTree.leafgraph.edges.data.targets.has(e))return n.leaf.logic.args.labelstr,r.map(t=>t._stream);if(n.leaf.logic.args.labelstr){const t=(async(t,n="")=>{let r=n.match(/^\\(.*)$/);if(r){const n=r[1];return n in t?await a_(t(n)._default,e):""}if(r=n.match(/^\?([A-Za-z0-9-]*)$/),r){const t=r[1],e=window.location.search,n=new Proxy(new URLSearchParams(e),{get:(t,e)=>t.get(e)}),i={};return n[t]&&(i[t]=n[t]),t in i?i:void 0}return n})(o,n.leaf.logic.args.labelstr);return[Promise.resolve(t)]}return r.map(t=>t._stream)};return p_(i,r,void 0,{...s,metastep:"leaflabel "+e},{leaflogic:(t,e)=>{const n=new qt({...Uo,_label:{...s}}),r=a(t),i=t.length>0?e._stream.pipe(It(t=>Et([ln(t),...r])),V(t=>(2==t.length?n.next(t[1]):n.next(t.slice(1)),t[0])),$t(t=>t),Lt()):e._stream;return{_stream:n,_control:{...e,_stream:i}}},datalogic:{}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={};if(r.length>0){const s=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});o[n.leaf.logic.args.labelstr]={...s}}else o[n.leaf.logic.args.labelstr]={};return o},methods:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{let o;if(r.length>0){o={...await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree})}}else o={};return o}},Go={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s=(t,e)=>(t in e._label&&(e._label[t]-=1),0===e._label[t]&&delete e._label[t],e);return(t,e)=>{if(n.leaf.logic.args.label||"label"in o){const r=o.label?o.label(t):{_stream:ln([n.leaf.logic.args.label])};return{_stream:Bg(t)._stream.pipe(Nt(r._stream),V(t=>t),$t(([t,e])=>t.every(t=>nn(t)||rn(t)&&t._crate.every(nn))),V(([t,e]=[])=>{const n=1===e.length?t.map(t=>[t,e[0]]):t.length===e.length?t.map((t,n)=>[t,e[n]]):[],r=t=>({...t,_label:{...t._label}}),i=n.reduce((t,[e,n]=[])=>(nn(e)?t.push(s(n,r(e))):rn(e)&&t.push({...e,_crate:e._crate.map(t=>s(n,r(t)))}),t),[]);if(i.length>0)return i}),$t(t=>t)),_control:e}}throw"LEAF Error: flow data cannot be labelled without a label, at _leafdataDelabel()"}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=n.leaf.logic.args.labelstr;return o&&s in o?{...o[s]}:{}}},zo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(()=>{const t=Object.keys(o).filter(t=>0===Object.keys(o[t]).length);return t.length>0?t.sort().join(";"):void 0})(),a={codebase:"leafbottle.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>{let r,i;const u=o.name?o.name._default(t,e):{_stream:ln(n.leaf.logic.args.bottlekey),_control:e},c=e._stream.pipe(hn(t=>(r=t,u._stream)),V(t=>(i=t,r)));return p_({_stream:c},t,void 0,{...a,metastep:"executing bottle with key "+i},{datalogic:{pre:t=>void 0===s?wn(i,t):wn(i,t,{tag:s})}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,n])=>{s[t]=(t,r)=>{const i=Lg(e,t);return{...n([i],r),_control:r}}}),s}},Wo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s={codebase:"leafunbottle.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>{if(n.leaf.logic.args.bottlekey||"bottlekey"in o){const r=o.label?o.label._default(t,e):{_stream:ln([n.leaf.logic.args.bottlekey]),_control:e};let i;const a=e._stream.pipe(Nt(r._stream),V(t=>{const e=t[1];return i=e,t[0]}),Lt()),u=(t,e)=>{const n=new Pt,r=e._stream.pipe(Nt(...t.map(t=>t._stream)),V(t=>{const e=t[1],r=t=>{const e=[t].flat().map(t=>nn(t)&&i.includes(t._bname)?t._content:void 0).filter(t=>t);if(e.length>0)return 1===e.length?e[0]:e},o=Array.isArray(e),s=o?e.map(t=>r(t)).filter(t=>void 0!==t):r(e);if(s?.length>0||!o&&void 0!==s)return n.next(s),t[0]}),$t(t=>void 0!==t),Lt());return{_stream:n.pipe(V(t=>t),Lt()),_control:{...e,_stream:r.pipe(V(t=>t),Lt())}}};return p_({_stream:a},t,void 0,{...s,metastep:"executing unbottle with key "+i},{leaflogic:u,datalogic:{post:t=>t}})}throw"LEAF Error: flow data cannot be unbottled without a bottlekey, at _leafdataUnbottle()"}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s}},Jo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data,(()=>{const t=Object.keys(o).filter(t=>0===Object.keys(o[t]).length);return t.length>0?t.sort().join(";"):void 0})());a="in the leafdataunbottle lambda";var a;return(t,e)=>{const n=new Pt,r=e._stream.pipe(Nt(...t.map(t=>t._stream)),V(t=>{const e={_cratelabel:s?{tag:s}:{}};if((Array.isArray(t[1])?t[1]:[t[1]]).flat().map(t=>nn(t)&&t._label.tag&&"string"==typeof t._label.tag?t:void 0).filter(t=>void 0!==t).map(t=>{e[t._bname]=t._bname in e?[...e[t._bname],t]:[t]}),Object.keys(e).length>1)return n.next(e),t[0]}),$t(t=>void 0!==t),Lt());return{_stream:n.pipe(V(t=>t),Lt()),_control:{...e,_stream:r}}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s}};function Ho(t,e,n){if(this.outer=n,this.dict=Object.create(null),this.get=function(t){return this.dict["$"+t]},this.set=function(t,e){this.dict["$"+t]=e},this.find=function(t){return"$"+t in this.dict?this:this.outer?this.outer.find(t):null},t&&e)for(let n=0;n<t.length;++n)this.set(t[n],e[n])}let Xo=new Ho;const Ko=(t,e=!0)=>"object"===typeof t?e?JSON.stringify(Object.entries(t).map(t=>[t[0],Ko(t[1],!1)]).sort()):Object.entries(t).map(t=>[t[0],Ko(t[1],!1)]).sort():JSON.stringify(t);let Qo={"+":function(){return[].reduce.call(arguments,function(t,e){return t+e})},"-":function(t,e){return t-e},"*":function(){return[].reduce.call(arguments,function(t,e){return t*e})},"/":function(t,e){return t/e},"%":function(t,e){return t%e},and:function(t,e){return t&&e},or:function(t,e){return t||e},not:function(t){return!t},">":function(t,e){return t>e},"<":function(t,e){return t<e},">=":function(t,e){return t>=e},"<=":function(t,e){return t<=e},"=":function(t,e){return t==e},":":function(t,e){return e[t]},"...":function(t,e){const n={...t};return Object.entries(e).forEach(([t,e])=>{n[t]=e}),n},"in?":function(t,e){const n=Array.isArray(t);return Object.entries(t).some(([t,r])=>{let i={};return i[t]=r,n?Ko(r)===Ko(e):Ko(i)===Ko(e)})},"equal?":function(t,e){return t===e},"eq?":function(t,e){return t===e},length:function(t){return t.length},cons:function(t,e){return[t].concat(e)},car:function(t){return t[0]},cdr:function(t){return t.slice(1)},append:function(t,e){return t.concat(e)},list:function(){return[].slice.call(arguments)},"list?":function(t){return Array.isArray(t)},"null?":function(t){return Array.isArray(t)&&!t.length},"symbol?":function(t){return"string"==typeof t},MathPI:Math.PI,MathE:Math.E,MathLN10:Math.LN10,MathLN2:Math.LN2,MathLOG10E:Math.LOG10E,MathLOG2E:Math.LOG2E,MathSQRT2:Math.SQRT2,False:!1,True:!0,Null:null};Object.keys(Qo).forEach(function(t){Xo.set(t,Qo[t])}),["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","log10","log2","max","min","pow","random","round","sin","sqrt","tan"].forEach(function(t){Xo.set(t,Math[t])});(t=>{function e(n,r){r=r||t;const i=typeof n;if("string"===i)return r.find(n).get(n);if(!Array.isArray(n)){if("object"===i){let t={};return Object.entries(n).map(([n,i])=>{t[n]=e(i,r)}),t}return n}if("quote"===n[0])return n.slice(1).join(" ");if("if"===n[0])return e((o=e(n[1],r),(Array.isArray(o)?o.length:o)?n[2]:n[3]),r);var o;if("set!"===n[0])return r.find(n[1]).set(n[1],e(n[1],r));if("define"===n[0])return r.set(n[1],e(n[2],r));if("lambda"===n[0])return function(){return e(n[2],new Ho(n[1],arguments,r))};if("begin"===n[0]){let t;for(let i=1;i<n.length;++i)t=e(n[i],r);return t}let s=n.map(function(t){return e(t,r)}),a=s.shift();return"function"==typeof a?a.apply(null,s):a}function n(t){return r(function(t){return t.replace(/\(/g," ( ").replace(/\)/g," ) ").replace(/\{/g," { ").replace(/\}/g," } ").replace(/^\s+|\s+$/g,"").split(/\s+/g)}(t))}function r(t){if(!t.length)throw new SyntaxError("unexpected EOF while reading");let e=t.shift();if("("===e){let e=[];for(;")"!==t[0];)e.push(r(t));return t.shift(),e}if("{"===e){let e={};for(;"}"!==t[0];){let n=t.shift(),i=":"===n[0]?n.slice(1):null;if(!i)throw new SyntaxError("unexpected key: "+n);e[i]=r(t)}return t.shift(),e}if("}"===e)throw new SyntaxError("unexpected )");if(")"===e)throw new SyntaxError("unexpected )");return function(t){let e=Number(t);return isNaN(e)&&"NaN"!==t?String(t):e}(e)}})(Xo);const Zo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});return(t,e)=>{const n=Bg(t);if(n&&"_stream"in n){return{_stream:n._stream.pipe(V(t=>t)),_control:e}}return{_stream:ln([]),_control:e}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={};if(r.length>0){const s=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});o[n.leaf.logic.type]={...s}}else o[n.leaf.logic.type]={};return o},methods:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});return{config:{getConfigData:async()=>{const t="_default"in o?o._default:void 0;return t?await a_(t,[],{}):{}}}}}};var Yo=function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=mn);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,n),i}return o(e,t),e.prototype.next=function(e){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,s=n._timestampProvider,a=n._windowTime;r||(i.push(e),!o&&i.push(s.now()+a)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!t.closed;i+=n?1:2)t.next(r[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,n=t._timestampProvider,r=t._buffer,i=t._infiniteTimeWindow,o=(i?1:2)*e;if(e<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var s=n.now(),a=0,u=1;u<r.length&&r[u]<=s;u+=2)a=u;a&&r.splice(0,a+1)}},e}(Pt);const ts=wn("error",{type:"critical",message:"LEAF core error: race condition detected in mediaplayer.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/mediaplayer.js"},{}),es=t=>{const e=t[lg.LAMBDA_OBJ],n="uri"in e&&"_default"in e.uri?e.uri._default:void 0,r={codebase:"ghostos/api/parser/nodelogic/elements/library/mediaplayer.js",refnode:t[lg.REFNODE]};return{leaflogic:(e,i)=>{const o=p_(i,e,void 0,r,{leaflogic:n,datalogic:{post:e=>(t[lg.mediaplayer.URI]=e,e)}})._control,s=new qt(ts),a=o._stream.pipe(Nt(...e.map(t=>t._stream)),V(t=>{const e=t[1];return s.next(e),t[0]}));return{_stream:s,_control:{_stream:a}}},datalogic:{pre:t=>t,post:n=>{const r=Object.keys(e);["uri"].filter(t=>r.includes(t)),e.margin&&Object.keys(e.margin),e.fieldwidth&&Object.keys(e.fieldwidth);return hg({element:{nodeuuid:t[lg.REFNODE],type:"mediaplayer",componentdata:{uri:t[lg.mediaplayer.URI],...t[lg.RTCONTEXT]}}},"screenio")}}}},ns=wn("error",{type:"critical",message:"LEAF core error: race condition detected in prompt.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/prompt.js"},{}),rs=t=>{const e=t[lg.LAMBDA_OBJ],n="uidefs"in e&&"_default"in e.uidefs?e.uidefs._default:void 0,r=("margin"in e&&"_default"in e.margin&&e.margin._default,"fieldwidth"in e&&"_default"in e.fieldwidth&&e.fieldwidth._default,new Pt),i={codebase:"ghostos/api/parser/nodelogic/elements/library/prompt.js",refnode:t[lg.REFNODE]};return{elementio$:r,leaflogic:(o,s)=>{const a=new Pt,u=n?p_(s,o,void 0,i,{leaflogic:n,datalogic:{post:e=>(t[lg.prompt.UIDEFS]=e,e)}}):{_stream:ln('[ ; an open square bracket [ denotes the beginning of a list, followed by a matching \n ; close square bracket ] appearing at the end of this page. you can bring your blinking cursor\n ; to one of the brackets and type Shift-5 (or %) to jump the cursor in between a pair of matching brackets. \n ; please give it a go, it is a fun way to read any text written in LEAFlisp. \n ; other helpful command keys to help you navigate LEAFlisp include h j k l with which the blinking cursor\n ; can be moved to the left, down, up and right respectively. Also useful are w b respectively used to command\n ; the cursor to move forward and backward by one word along the line. Shift-v can be used to select one line,\n ; v to select from where the cursor currently is and navigating away from the initial cursor point by using\n ; any mix of the navigation command keys, namely h j k l w and b would allow you to select any range of text of interest.\n ; at which point you could either copy, delete and/or paste the selected text by respectively pressing y, d and p\n ; pressing u would undo the changes you have made going back in time one change by one change as you repeat u in a series. \n ; Ctrl-r would redo what had been undone. \n ; using the command keys would require the editor to be in the "command" mode. pressing the escape key would put the editor \n ; in the "command" mode, while pressing i would put the editor in the "edit" mode in which none of the navigation keys\n ; would work as navigation commands but as entering respective alphabets instead. \n ; \n {\n :prompt "setting"\n :backgroundColor "primary.light" \n ; "primary.dark" | "secondary.light" "secondary.dark"\n :margin "1" \n ; please note that any positive number in between quotes is accepted here. \n ; the recommended value however would range from 0 to 20 in almost all general \n ; usage scenarios where 0 to 5 whould perhaps comprise about 90% of the cases. \n :fieldWidth "45ch" \n ; ch is a unit length represented in terms of the width of the letter 0 (zero).\n ; so "15ch" would result in the width as wide as 15 zeros for all the text inputs below. \n ; please refer to the following site for units in html/css lingo, if you have all the time in the world.\n ; https://www.w3schools.com/cssref/css_units.asp for units\n :buttonWidth "20ch"\n ; likewise, buttonWidth specifies the width of all the buttons declared below. \n }\n {\n :prompt "text"\n :key "maintext1" ; :key is a user-defined string value, that should be unique within the context of the UI definition.\n :label "LEAF newsletter mailing list" ; a user-defined string label to be displayed on the text input.\n :variant "outlined" ; a text :variant with a choice of "standard", "outlined", or "filled" as its style.\n :multiline true\n :rows "2"\n :InputProps {:readOnly true}\n :defaultValue "Please fill out the info and subscribe to the mailing list."\n }\n {\n :prompt "text"\n ;:key (get (get (get (get uinodes 1) :meta) :label) :id) ; :key is a user-defined string value, that should be unique within the context of the UI definition.\n :key "name" ; :key is a user-defined string value, that should be unique within the context of the UI definition.\n ;:id (get (get (get (get uinodes 1) :meta) :label) :id)\n :fieldWidth "25ch" \n :required true ;true\n :group 1\n :label "Your name" ;(get (get (get (get uinodes 1) :meta) :label) :text); a user-defined string label to be displayed on the text input.\n :variant "standard" ; a text :variant with a choice of "standard", "outlined", or "filled" as its style.\n }\n {\n :prompt "text"\n :key "email"\n :fieldWidth "25ch" \n :required true\n :label "Your email"\n :type "email"\n :variant "standard"\n }\n { \n :prompt "button"\n :color "secondary" \n ; the value can be of "primary", "secondary", "error", "warning", "info", "success"\n :variant "outlined"\n ; the value can be of "text", "contained", "outlined"\n :key "subscribebtn"\n ; :href "/editor/breezyforest/main"\n ; :href can support a relative path\n :label "Subscribe"\n }\n ]'),_control:{_stream:s._stream}};const c=u._control._stream.pipe(Nt(u._stream),It(n=>{const i=n[1];t[lg.CTRLIN]=n[0];const o=Object.keys(e),s=(["uidefs","margin","fieldwidth"].filter(t=>o.includes(t)),e.margin?Object.keys(e.margin):void 0),a=e.fieldwidth?Object.keys(e.fieldwidth):void 0,u=nn(i)&&"error"===i._bname?void 0:Array.isArray(i)?hg({element:{nodeuuid:t[lg.REFNODE],type:"prompt",componentdata:{nodeuuid:t[lg.REFNODE],uidefs:i,margin:s?s[0]:1,fieldwidth:a?a[0]:"25ch",...t[lg.RTCONTEXT]}}},"screenio"):void 0;return u?Bt(ln(u),r):r}),V(e=>(a.next(e),t[lg.CTRLIN])),Lt());return{_stream:a.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(ns)),V(t=>t),Lt()),_control:{_stream:c.pipe(V(t=>t),Lt())}}},datalogic:{pre:t=>t,post:t=>t}}},is=wn("error",{type:"critical",message:"LEAF core error: race condition detected in popup.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/popup.js"},{}),os=t=>{const e=t[lg.LAMBDA_OBJ],n=new Pt,r=new Pt;return{elementio$:r,leaflogic:(i,o)=>{const s=o._stream.pipe(Nt(...i.map(t=>t._stream)),It(t=>Et(new qt(t[0]),Bt(new qt(t[1]),r))),It(i=>{const o=i[1],s=Object.keys(e),a=["headless","jester","top","tt","bottom","bb","left","ll","right","rr","topleft","ttll","topright","ttrr","bottomleft","bbll","bottomright","bbrr","center","centre"].filter(t=>s.includes(t)),u=a.length>0?a[0]:void 0,c=[o].flat().map(n=>{if(nn(n)){if("screenio"===n._bname){const i=xn("screenio",n);return hg({element:{nodeuuid:t[lg.REFNODE],type:"popup",componentdata:{poprect:u,headless:"headless"in e,ismenu:"jester"in e,unmountCallback:async()=>{const n="onclose"in e&&"_default"in e.onclose?e.onclose._default:void 0,i=n?await a_(n,[],{...t[lg.RTCONTEXT]._config}):[];return r.next(wn("elementio",{element:"popup",nodeuuid:t[lg.REFNODE],io:{onclose:i}})),i},children:Array.isArray(i)?i:[i],...t[lg.RTCONTEXT]}}},"screenio")}return"elementio"===n._bname?n:void 0}}).filter(t=>t);return c.length>1?n.next(c):1===c.length&&n.next(c[0]),ln(i[0])}));return{_stream:n.pipe($t(t=>JSON.stringify(t)!==JSON.stringify(is)),V(t=>t)),_control:{_stream:s}}},datalogic:{pre:t=>t,post:t=>t}}},ss=wn("error",{type:"critical",message:"LEAF core error: race condition detected in editor.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/editor.js"},{}),as=t=>{const e=t[lg.LAMBDA_OBJ];"uidefs"in e&&"_default"in e.uidefs&&e.uidefs._default,"margin"in e&&"_default"in e.margin&&e.margin._default,"fieldwidth"in e&&"_default"in e.fieldwidth&&e.fieldwidth._default;return{leaflogic:(e,n)=>{const r=new qt(ss),i=n._stream.pipe(hn(n=>{t[lg.CTRLIN]=n;return Et([...e.map(t=>t._stream)])}),V(e=>(e.length>1?r.next(e):1===e.length&&r.next(e[0]),t[lg.CTRLIN])));return{_stream:r,_control:{_stream:i}}},datalogic:{pre:t=>t,post:n=>{const r=Object.keys(e),i=["top","bottom","left","right","topleft","topright","bottomleft","bottomright","center","centre"].filter(t=>r.includes(t));i.length>0&&i[0];let o=n;o=1===o.length?o[0]:o;return hg({element:{nodeuuid:t[lg.REFNODE],type:"editor",componentdata:{domain:t[lg.DOMAIN],appid:t[lg.APPID],...t[lg.RTCONTEXT]}}},"screenio")}}}},us=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in text.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/text.js"},{}),t=>{const e=t[lg.LAMBDA_OBJ];return{leaflogic:(t,e)=>{const n=new Pt,r=e._stream.pipe(Nt(...t.map(t=>t._stream)),V(t=>{const e=t[1];return n.next(e),t[0]}));return{_stream:n,_control:{_stream:r}}},datalogic:{pre:t=>t,post:n=>{const r=Object.keys(e),i=(["lambda","onsave","gspot"].filter(t=>r.includes(t)),"lambda"in e?"lambda":"dataflow");let o;nn(n)&&n._content?._provenance?.refnodedata?(t[lg.RTCONTEXT].lambdarefnodedata=n._content?._provenance?.refnodedata,t[lg.RTCONTEXT].lambdasourceuuid=n._content?._refnode,o=n):o=n;return hg({element:{nodeuuid:t[lg.REFNODE],type:"text",componentdata:{refnode:t[lg.REFNODE],textsource:i,lambdarefnodedata:t[lg.RTCONTEXT].lambdarefnodedata,lambdasourceuuid:t[lg.RTCONTEXT].lambdasourceuuid,dataflowinput:o,domain:t[lg.DOMAIN],appid:t[lg.APPID],...t[lg.RTCONTEXT]}}},"screenio")}}}}),cs=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in image.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/image.js"},{}),t=>{const e=t[lg.LAMBDA_OBJ];return{leaflogic:(e,n)=>{const r=new Pt,i=n._stream.pipe(Nt(...e.map(t=>t._stream)),V(e=>{t[lg.CTRLIN]=e[0];const n=e[1];return r.next(n),e[0]}));return{_stream:r,_control:{_stream:i}}},datalogic:{pre:t=>{const e=[t].flat().map(t=>{if(nn(t)&&"image"===t._bname)return xn("image",t)}).filter(t=>t);return 1===e.length?e[0]:e.length>1?e:void 0},post:n=>{const r=Object.keys(e);["onclose"].filter(t=>r.includes(t)),"onclose"in e&&e.onclose;return hg({element:{nodeuuid:t[lg.REFNODE],type:"image",componentdata:{imagelist:Array.isArray(n)?n:[n],...t[lg.RTCONTEXT]}}},"screenio")}}}});function ls(t){return g(function(e,n){try{e.subscribe(n)}finally{n.add(t)}})}wn("error",{type:"critical",message:"LEAF core error: race condition detected in mediainput.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/mediainput.js"},{});const hs=t=>{const e=t[lg.LAMBDA_OBJ],n=("uidefs"in e&&"_default"in e.uidefs&&e.uidefs._default,"margin"in e&&"_default"in e.margin&&e.margin._default,"fieldwidth"in e&&"_default"in e.fieldwidth&&e.fieldwidth._default,new Pt);return{elementio$:n,leaflogic:(r,i)=>{const o=new Pt,s=i._stream.pipe(Nt(...r.map(t=>t._stream)),It(r=>{t[lg.CTRLIN]=r[0];const i=r[1],o=Object.keys(e),s=["image","audio","video"].filter(t=>o.includes(t)),a=s.length>0?s[0]:"image";let u=i;u=1===u.length?u[0]:u;const c=Array.isArray(u)?u:[u],l=hg({element:{nodeuuid:t[lg.REFNODE],type:"mediainput",componentdata:{mediatype:a,nodeinput:c,callbacks:{onDropAccepted:async r=>{const i=e.ondrop?._default?await a_(e.ondrop._default,[wn("elementinput",r),wn("nodeinput",c)],{},t[lg.REFNODE]):void 0,o=wn("elementio",i);n.next(o)}}}}},"screenio");return l?Bt(new qt(l),n):n}),It(e=>(o.next(e),new qt(t[lg.CTRLIN]))),Lt());return{_stream:o.pipe(V(t=>t),ls(()=>{}),Lt()),_control:{_stream:s.pipe(V(t=>t),ls(()=>{}),Lt())}}},datalogic:{pre:t=>t,post:t=>{let e=t;return e=1===e.length?e[0]:e,e}}}};var ds=n(7799);const{JZZ:ps}=ds,fs=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in midi.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/midi.js"},{}),t=>{const e=t[lg.LAMBDA_OBJ],n=new Pt;let r=-1;const i=t=>{if(r=(r+1)%24,0===r){}const[e,i,o,s]=t;n.next(wn("_midi_in",{cmd:e,noteNumber:i,velocity:o},{timestamp:Date.now()}))},o={};return{leaflogic:(e,r)=>{const s=new Pt,a=r._stream.pipe(It(r=>{t[lg.CTRLIN]=r,"default"in o||(o.default=ps().openMidiIn().or("Error: Cannot open MIDI In port").and(t=>{}).connect(i));return Bt(...e.map(t=>t._stream),n)}),V(e=>{!Array.isArray(e)&&e._bname;const n=(Array.isArray(e)?e:[e]).map(t=>"_data_in"===t._bname?on(t._content)?void 0:xn("*",t):nn(t)?t:void 0).filter(t=>t);return n.length>0&&s.next(n),t[lg.CTRLIN]}),Lt());return{_stream:s,_control:{_stream:a}}},datalogic:{pre:t=>wn("_data_in",t),post:t=>{const n=Object.keys(e),r=["image","audio","video"].filter(t=>n.includes(t));r.length>0&&r[0];let i=t;i=1===i.length?i[0]:i;return i}}}});function ms(t){return Math.pow(2,t/12)}let gs=440;function _s(t){return Math.round(ys(t))}function ys(t){return 69+12*Math.log2(t/gs)}function vs(t){return gs*Math.pow(2,(t-69)/12)}var bs=n(1795);const ws=new WeakSet,xs=new WeakMap,Ts=new WeakMap,ks=new WeakMap,Ss=new WeakMap,As=new WeakMap,Es=new WeakMap,Os=new WeakMap,Cs=new WeakMap,Ms=new WeakMap,Ns={construct:()=>Ns},Is=/^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/,js=(t,e)=>{const n=[];let r=t.replace(/^[\s]+/,""),i=r.match(Is);for(;null!==i;){const t=i[1].slice(1,-1),o=i[0].replace(/([\s]+)?;?$/,"").replace(t,new URL(t,e).toString());n.push(o),r=r.slice(i[0].length).replace(/^[\s]+/,""),i=r.match(Is)}return[n.join(";"),r]},Rs=t=>{if(void 0!==t&&!Array.isArray(t))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},Ps=t=>{if(!(t=>{try{new new Proxy(t,Ns)}catch{return!1}return!0})(t))throw new TypeError("The given value for processorCtor should be a constructor.");if(null===t.prototype||"object"!=typeof t.prototype)throw new TypeError("The given value for processorCtor should have a prototype.")},Ds=(t,e)=>{const n=t.get(e);if(void 0===n)throw new Error("A value with the given key could not be found.");return n},Ls=(t,e)=>{const n=Array.from(t).filter(e);if(n.length>1)throw Error("More than one element was found.");if(0===n.length)throw Error("No element was found.");const[r]=n;return t.delete(r),r},Fs=(t,e,n,r)=>{const i=Ds(t,e),o=Ls(i,t=>t[0]===n&&t[1]===r);return 0===i.size&&t.delete(e),o},$s=t=>Ds(Es,t),Bs=t=>{if(ws.has(t))throw new Error("The AudioNode is already stored.");ws.add(t),$s(t).forEach(t=>t(!0))},qs=t=>"port"in t,Us=t=>{if(!ws.has(t))throw new Error("The AudioNode is not stored.");ws.delete(t),$s(t).forEach(t=>t(!1))},Vs=(t,e)=>{!qs(t)&&e.every(t=>0===t.size)&&Us(t)},Gs={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},zs=(t,e)=>t.context===e,Ws=t=>{try{t.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},Js=()=>new DOMException("","IndexSizeError"),Hs=t=>{var e;t.getChannelData=(e=t.getChannelData,n=>{try{return e.call(t,n)}catch(t){if(12===t.code)throw Js();throw t}})},Xs={numberOfChannels:1},Ks=-34028234663852886e22,Qs=-Ks,Zs=t=>ws.has(t),Ys={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},ta=t=>Ds(xs,t),ea=t=>Ds(ks,t),na=(t,e)=>{const{activeInputs:n}=ta(t);n.forEach(n=>n.forEach(([n])=>{e.includes(t)||na(n,[...e,t])}));const r=(t=>"playbackRate"in t)(t)?[t.playbackRate]:qs(t)?Array.from(t.parameters.values()):(t=>"frequency"in t&&"gain"in t)(t)?[t.Q,t.detune,t.frequency,t.gain]:(t=>"offset"in t)(t)?[t.offset]:(t=>!("frequency"in t)&&"gain"in t)(t)?[t.gain]:(t=>"detune"in t&&"frequency"in t&&!("gain"in t))(t)?[t.detune,t.frequency]:(t=>"pan"in t)(t)?[t.pan]:[];for(const t of r){const n=ea(t);void 0!==n&&n.activeInputs.forEach(([t])=>na(t,e))}Zs(t)&&Us(t)},ra=t=>{na(t.destination,[])},ia=t=>void 0===t||"number"==typeof t||"string"==typeof t&&("balanced"===t||"interactive"===t||"playback"===t),oa=t=>"context"in t,sa=t=>oa(t[0]),aa=(t,e,n,r)=>{for(const e of t)if(n(e)){if(r)return!1;throw Error("The set contains at least one similar element.")}return t.add(e),!0},ua=(t,e,[n,r],i)=>{aa(t,[e,n,r],t=>t[0]===e&&t[1]===n,i)},ca=(t,[e,n,r],i)=>{const o=t.get(e);void 0===o?t.set(e,new Set([[n,r]])):aa(o,[n,r],t=>t[0]===n,i)},la=t=>"inputs"in t,ha=(t,e,n,r)=>{if(la(e)){const i=e.inputs[r];return t.connect(i,n,0),[i,n,0]}return t.connect(e,n,r),[e,n,r]},da=(t,e,n)=>{for(const r of t)if(r[0]===e&&r[1]===n)return t.delete(r),r;return null},pa=(t,e)=>{if(!$s(t).delete(e))throw new Error("Missing the expected event listener.")},fa=(t,e,n)=>{const r=Ds(t,e),i=Ls(r,t=>t[0]===n);return 0===r.size&&t.delete(e),i},ma=(t,e,n,r)=>{la(e)?t.disconnect(e.inputs[r],n,0):t.disconnect(e,n,r)},ga=t=>Ds(Ts,t),_a=t=>Ds(Ss,t),ya=t=>Os.has(t),va=t=>!ws.has(t),ba=(t,e)=>new Promise(n=>{if(null!==e)n(!0);else{const e=t.createScriptProcessor(256,1,1),r=t.createGain(),i=t.createBuffer(1,2,44100),o=i.getChannelData(0);o[0]=1,o[1]=1;const s=t.createBufferSource();s.buffer=i,s.loop=!0,s.connect(e).connect(t.destination),s.connect(r),s.disconnect(r),e.onaudioprocess=r=>{const i=r.inputBuffer.getChannelData(0);Array.prototype.some.call(i,t=>1===t)?n(!0):n(!1),s.stop(),e.onaudioprocess=null,s.disconnect(e),e.disconnect(t.destination)},s.start()}}),wa=(t,e)=>{const n=new Map;for(const e of t)for(const t of e){const e=n.get(t);n.set(t,void 0===e?1:e+1)}n.forEach((t,n)=>e(n,t))},xa=t=>"context"in t,Ta=t=>{const e=new Map;t.connect=(t=>(n,r=0,i=0)=>{const o=xa(n)?t(n,r,i):t(n,r),s=e.get(n);return void 0===s?e.set(n,[{input:i,output:r}]):s.every(t=>t.input!==i||t.output!==r)&&s.push({input:i,output:r}),o})(t.connect.bind(t)),t.disconnect=(n=>(r,i,o)=>{if(n.apply(t),void 0===r)e.clear();else if("number"==typeof r)for(const[t,n]of e){const i=n.filter(t=>t.output!==r);0===i.length?e.delete(t):e.set(t,i)}else if(e.has(r))if(void 0===i)e.delete(r);else{const t=e.get(r);if(void 0!==t){const n=t.filter(t=>t.output!==i&&(t.input!==o||void 0===o));0===n.length?e.delete(r):e.set(r,n)}}for(const[n,r]of e)r.forEach(e=>{xa(n)?t.connect(n,e.output,e.input):t.connect(n,e.output)})})(t.disconnect)},ka=(t,e,n,r)=>{const{activeInputs:i,passiveInputs:o}=ea(e),{outputs:s}=ta(t),a=$s(t),u=s=>{const a=ga(t),u=_a(e);if(s){const e=fa(o,t,n);ua(i,t,e,!1),r||ya(t)||a.connect(u,n)}else{const e=((t,e,n)=>Ls(t,t=>t[0]===e&&t[1]===n))(i,t,n);ca(o,e,!1),r||ya(t)||a.disconnect(u,n)}};return!!aa(s,[e,n],t=>t[0]===e&&t[1]===n,!0)&&(a.add(u),Zs(t)?ua(i,t,[n,u],!0):ca(o,[t,n,u],!0),!0)},Sa=(t,e,n,r,i)=>{const[o,s]=((t,e,n,r)=>{const{activeInputs:i,passiveInputs:o}=ta(e),s=da(i[r],t,n);if(null===s)return[Fs(o,t,n,r)[2],!1];return[s[2],!0]})(t,n,r,i);if(null!==o&&(pa(t,o),!s||e||ya(t)||ma(ga(t),ga(n),r,i)),Zs(n)){const{activeInputs:t}=ta(n);Vs(n,t)}},Aa=(t,e,n,r)=>{const[i,o]=((t,e,n)=>{const{activeInputs:r,passiveInputs:i}=ea(e),o=da(r,t,n);if(null===o)return[fa(i,t,n)[1],!1];return[o[2],!0]})(t,n,r);null!==i&&(pa(t,i),!o||e||ya(t)||ga(t).disconnect(_a(n),r))};class Ea{constructor(t){this._map=new Map(t)}get size(){return this._map.size}entries(){return this._map.entries()}forEach(t,e=null){return this._map.forEach((n,r)=>t.call(e,n,r,this))}get(t){return this._map.get(t)}has(t){return this._map.has(t)}keys(){return this._map.keys()}values(){return this._map.values()}}const Oa={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}};function Ca(t,e,n,r,i){if("function"==typeof t.copyFromChannel)0===e[n].byteLength&&(e[n]=new Float32Array(128)),t.copyFromChannel(e[n],r,i);else{const o=t.getChannelData(r);if(0===e[n].byteLength)e[n]=o.slice(i,i+128);else{const t=new Float32Array(o.buffer,i*Float32Array.BYTES_PER_ELEMENT,128);e[n].set(t)}}}const Ma=(t,e,n,r,i)=>{"function"==typeof t.copyToChannel?0!==e[n].byteLength&&t.copyToChannel(e[n],r,i):0!==e[n].byteLength&&t.getChannelData(r).set(e[n],i)},Na=(t,e)=>{const n=[];for(let r=0;r<t;r+=1){const t=[],i="number"==typeof e?e:e[r];for(let e=0;e<i;e+=1)t.push(new Float32Array(128));n.push(t)}return n},Ia=async(t,e,n,r,i,o,s)=>{const a=null===e?128*Math.ceil(t.context.length/128):e.length,u=r.channelCount*r.numberOfInputs,c=i.reduce((t,e)=>t+e,0),l=0===c?null:n.createBuffer(c,a,n.sampleRate);if(void 0===o)throw new Error("Missing the processor constructor.");const h=ta(t),d=await((t,e)=>{const n=Ds(Ms,t),r=ga(e);return Ds(n,r)})(n,t),p=Na(r.numberOfInputs,r.channelCount),f=Na(r.numberOfOutputs,i),m=Array.from(t.parameters.keys()).reduce((t,e)=>({...t,[e]:new Float32Array(128)}),{});for(let c=0;c<a;c+=128){if(r.numberOfInputs>0&&null!==e)for(let t=0;t<r.numberOfInputs;t+=1)for(let n=0;n<r.channelCount;n+=1)Ca(e,p[t],n,n,c);void 0!==o.parameterDescriptors&&null!==e&&o.parameterDescriptors.forEach(({name:t},n)=>{Ca(e,m,t,u+n,c)});for(let t=0;t<r.numberOfInputs;t+=1)for(let e=0;e<i[t];e+=1)0===f[t][e].byteLength&&(f[t][e]=new Float32Array(128));try{const t=p.map((t,e)=>0===h.activeInputs[e].size?[]:t),e=s(c/n.sampleRate,n.sampleRate,()=>d.process(t,f,m));if(null!==l)for(let t=0,e=0;t<r.numberOfOutputs;t+=1){for(let n=0;n<i[t];n+=1)Ma(l,f[t],n,e+n,c);e+=i[t]}if(!e)break}catch(e){t.dispatchEvent(new ErrorEvent("processorerror",{colno:e.colno,filename:e.filename,lineno:e.lineno,message:e.message}));break}}return l},ja={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},Ra={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},Pa={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},Da={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},La={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},Fa=t=>{const{port1:e,port2:n}=new MessageChannel;return new Promise(r=>{const i=()=>{n.onmessage=null,e.close(),n.close(),r()};n.onmessage=()=>i();try{e.postMessage(t,[t])}catch{}finally{i()}})},$a={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},Ba=(t,e,n)=>{const r=e[n];if(void 0===r)throw t();return r},qa={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},Ua={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},Va=()=>new DOMException("","InvalidStateError"),Ga=()=>new DOMException("","InvalidAccessError"),za={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},Wa=(t,e,n,r,i,o,s,a,u,c,l)=>{const h=c.length;let d=a;for(let a=0;a<h;a+=1){let h=n[0]*c[a];for(let e=1;e<i;e+=1){const r=d-e&u-1;h+=n[e]*o[r],h-=t[e]*s[r]}for(let t=i;t<r;t+=1)h+=n[t]*o[d-t&u-1];for(let n=i;n<e;n+=1)h-=t[n]*s[d-n&u-1];o[d]=c[a],s[d]=h,d=d+1&u-1,l[a]=h}return d},Ja={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},Ha=t=>{const e=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{const n=t.decodeAudioData(e.buffer,()=>{});return void 0!==n&&(n.catch(()=>{}),!0)}catch{}return!1},Xa={numberOfChannels:1},Ka=(t,e,n)=>{const r=e[n];void 0!==r&&r!==t[n]&&(t[n]=r)},Qa=(t,e)=>{Ka(t,e,"channelCount"),Ka(t,e,"channelCountMode"),Ka(t,e,"channelInterpretation")},Za=t=>"function"==typeof t.getFloatTimeDomainData,Ya=(t,e,n)=>{const r=e[n];void 0!==r&&r!==t[n].value&&(t[n].value=r)},tu=t=>{t.start=(e=>(n=0,r=0,i)=>{if("number"==typeof i&&i<0||r<0||n<0)throw new RangeError("The parameters can't be negative.");e.call(t,n,r,i)})(t.start)},eu=t=>{var e;t.stop=(e=t.stop,(n=0)=>{if(n<0)throw new RangeError("The parameter can't be negative.");e.call(t,n)})},nu=(t,e)=>null===t?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(t*e))))),ru=async(t,e)=>{const n=await(t=>new Promise((e,n)=>{const{port1:r,port2:i}=new MessageChannel;r.onmessage=({data:t})=>{r.close(),i.close(),e(t)},r.onmessageerror=({data:t})=>{r.close(),i.close(),n(t)},i.postMessage(t)}))(e);return new t(n)},iu=(t,e)=>{const n=t.createBiquadFilter();return Qa(n,e),Ya(n,e,"Q"),Ya(n,e,"detune"),Ya(n,e,"frequency"),Ya(n,e,"gain"),Ka(n,e,"type"),n},ou=(t,e)=>{const n=t.createChannelSplitter(e.numberOfOutputs);return Qa(n,e),(t=>{const e=t.numberOfOutputs;Object.defineProperty(t,"channelCount",{get:()=>e,set:t=>{if(t!==e)throw Va()}}),Object.defineProperty(t,"channelCountMode",{get:()=>"explicit",set:t=>{if("explicit"!==t)throw Va()}}),Object.defineProperty(t,"channelInterpretation",{get:()=>"discrete",set:t=>{if("discrete"!==t)throw Va()}})})(n),n},su=(t,e)=>(t.connect=e.connect.bind(e),t.disconnect=e.disconnect.bind(e),t),au=(t,e)=>{const n=t.createDelay(e.maxDelayTime);return Qa(n,e),Ya(n,e,"delayTime"),n},uu=(t,e)=>{const n=t.createGain();return Qa(n,e),Ya(n,e,"gain"),n};function cu(t,e){const n=e[0]*e[0]+e[1]*e[1];return[(t[0]*e[0]+t[1]*e[1])/n,(t[1]*e[0]-t[0]*e[1])/n]}function lu(t,e){return[t[0]*e[0]-t[1]*e[1],t[0]*e[1]+t[1]*e[0]]}function hu(t,e){let n=[0,0];for(let r=t.length-1;r>=0;r-=1)n=lu(n,e),n[0]+=t[r];return n}const du=(t,e,n,r)=>t.createScriptProcessor(e,n,r),pu=()=>new DOMException("","NotSupportedError"),fu={numberOfChannels:1},mu={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},gu={channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0,distanceModel:"inverse",maxDistance:1e4,orientationX:1,orientationY:0,orientationZ:0,panningModel:"equalpower",positionX:0,positionY:0,positionZ:0,refDistance:1,rolloffFactor:1},_u={disableNormalization:!1},yu={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},vu=()=>new DOMException("","UnknownError"),bu={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},wu=(t,e,n)=>void 0===t.copyFromChannel?t.getChannelData(n)[0]:(t.copyFromChannel(e,n),e[0]),xu=t=>{if(null===t)return!1;const e=t.length;return e%2!=0?0!==t[Math.floor(e/2)]:t[e/2-1]+t[e/2]!==0},Tu=(t,e,n,r)=>{let i=t;for(;!i.hasOwnProperty(e);)i=Object.getPrototypeOf(i);const{get:o,set:s}=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(t,e,{get:n(o),set:r(s)})},ku=(t,e,n)=>{try{t.setValueAtTime(e,n)}catch(r){if(9!==r.code)throw r;ku(t,e,n+1e-7)}},Su=t=>{const e=t.createOscillator();try{e.start(-1)}catch(t){return t instanceof RangeError}return!1},Au=t=>{const e=t.createBuffer(1,1,44100),n=t.createBufferSource();n.buffer=e,n.start(),n.stop();try{return n.stop(),!0}catch{return!1}},Eu=t=>{const e=t.createOscillator();try{e.stop(-1)}catch(t){return t instanceof RangeError}return!1},Ou=(t,e)=>{const n=e.createGain();t.connect(n);const r=(e=>()=>{e.call(t,n),t.removeEventListener("ended",r)})(t.disconnect);t.addEventListener("ended",r),su(t,n),t.stop=(e=>{let r=!1;return(i=0)=>{if(r)try{e.call(t,i)}catch{n.gain.setValueAtTime(0,i)}else e.call(t,i),r=!0}})(t.stop)},Cu=(t,e)=>n=>{const r={value:t};return Object.defineProperties(n,{currentTarget:r,target:r}),"function"==typeof e?e.call(t,n):e.handleEvent.call(t,n)};const Mu=(t=>(e,n,[r,i,o],s)=>{t(e[i],[n,r,o],t=>t[0]===n&&t[1]===r,s)})(aa),Nu=(t=>(e,n,[r,i,o],s)=>{const a=e.get(r);void 0===a?e.set(r,new Set([[i,n,o]])):t(a,[i,n,o],t=>t[0]===i&&t[1]===n,s)})(aa),Iu=(t=>(e,n,r,i)=>t(e[i],t=>t[0]===n&&t[1]===r))(Ls),ju=new WeakMap,Ru=(t=>e=>{var n;return null!==(n=t.get(e))&&void 0!==n?n:0})(ju),Pu=(Du=new Map,Lu=new WeakMap,(t,e)=>{const n=Lu.get(t);if(void 0!==n)return n;const r=Du.get(t);if(void 0!==r)return r;try{const n=e();return n instanceof Promise?(Du.set(t,n),n.catch(()=>!1).then(e=>(Du.delete(t),Lu.set(t,e),e))):(Lu.set(t,n),n)}catch{return Lu.set(t,!1),!1}});var Du,Lu;const Fu="undefined"==typeof window?null:window,$u=((t,e)=>(n,r)=>{const i=n.createAnalyser();if(Qa(i,r),!(r.maxDecibels>r.minDecibels))throw e();return Ka(i,r,"fftSize"),Ka(i,r,"maxDecibels"),Ka(i,r,"minDecibels"),Ka(i,r,"smoothingTimeConstant"),t(Za,()=>Za(i))||(t=>{t.getFloatTimeDomainData=e=>{const n=new Uint8Array(e.length);t.getByteTimeDomainData(n);const r=Math.max(n.length,t.fftSize);for(let t=0;t<r;t+=1)e[t]=.0078125*(n[t]-128);return e}})(i),i})(Pu,Js),Bu=(t=>e=>{const n=t(e);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioNode in the audio graph.");return n.renderer})(ta),qu=((t,e,n)=>async(r,i,o)=>{const s=t(r);await Promise.all(s.activeInputs.map((t,s)=>Array.from(t).map(async([t,a])=>{const u=e(t),c=await u.render(t,i),l=r.context.destination;n(t)||r===l&&n(r)||c.connect(o,a,s)})).reduce((t,e)=>[...t,...e],[]))})(ta,Bu,ya),Uu=((t,e,n)=>()=>{const r=new WeakMap;return{render(i,o){const s=r.get(o);return void 0!==s?Promise.resolve(s):(async(i,o)=>{let s=e(i);if(!zs(s,o)){const e={channelCount:s.channelCount,channelCountMode:s.channelCountMode,channelInterpretation:s.channelInterpretation,fftSize:s.fftSize,maxDecibels:s.maxDecibels,minDecibels:s.minDecibels,smoothingTimeConstant:s.smoothingTimeConstant};s=t(o,e)}return r.set(o,s),await n(i,o,s),s})(i,o)}}})($u,ga,qu),Vu=(Gu=As,t=>{const e=Gu.get(t);if(void 0===e)throw Va();return e});var Gu;const zu=(t=>null===t?null:t.hasOwnProperty("OfflineAudioContext")?t.OfflineAudioContext:t.hasOwnProperty("webkitOfflineAudioContext")?t.webkitOfflineAudioContext:null)(Fu),Wu=(t=>e=>null!==t&&e instanceof t)(zu),Ju=new WeakMap,Hu=(t=>class{constructor(t){this._nativeEventTarget=t,this._listeners=new WeakMap}addEventListener(e,n,r){if(null!==n){let i=this._listeners.get(n);void 0===i&&(i=t(this,n),"function"==typeof n&&this._listeners.set(n,i)),this._nativeEventTarget.addEventListener(e,i,r)}}dispatchEvent(t){return this._nativeEventTarget.dispatchEvent(t)}removeEventListener(t,e,n){const r=null===e?void 0:this._listeners.get(e);this._nativeEventTarget.removeEventListener(t,void 0===r?null:r,n)}})(Cu),Xu=(t=>null===t?null:t.hasOwnProperty("AudioContext")?t.AudioContext:t.hasOwnProperty("webkitAudioContext")?t.webkitAudioContext:null)(Fu),Ku=(t=>e=>null!==t&&e instanceof t)(Xu),Qu=(t=>e=>null!==t&&"function"==typeof t.AudioNode&&e instanceof t.AudioNode)(Fu),Zu=(t=>e=>null!==t&&"function"==typeof t.AudioParam&&e instanceof t.AudioParam)(Fu),Yu=(t=>null===t?null:t.hasOwnProperty("AudioWorkletNode")?t.AudioWorkletNode:null)(Fu),tc=((t,e,n,r,i,o,s,a,u,c,l,h,d,p,f,m)=>class extends c{constructor(e,r,i,o){super(i),this._context=e,this._nativeAudioNode=i;const s=l(e);h(s)&&!0!==n(ba,()=>ba(s,m))&&Ta(i),Ts.set(this,i),Es.set(this,new Set),"closed"!==e.state&&r&&Bs(this),t(this,o,i)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(t){this._nativeAudioNode.channelCount=t}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(t){this._nativeAudioNode.channelCountMode=t}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(t){this._nativeAudioNode.channelInterpretation=t}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(t,n=0,a=0){if(n<0||n>=this._nativeAudioNode.numberOfOutputs)throw i();const c=l(this._context),h=f(c);if(d(t)||p(t))throw o();if(oa(t)){const i=ga(t);try{const e=ha(this._nativeAudioNode,i,n,a),r=va(this);(h||r)&&this._nativeAudioNode.disconnect(...e),"closed"!==this.context.state&&!r&&va(t)&&Bs(t)}catch(t){if(12===t.code)throw o();throw t}if(e(this,t,n,a,h)){const e=u([this],t);wa(e,r(h))}return t}const m=_a(t);if("playbackRate"===m.name&&1024===m.maxValue)throw s();try{this._nativeAudioNode.connect(m,n),(h||va(this))&&this._nativeAudioNode.disconnect(m,n)}catch(t){if(12===t.code)throw o();throw t}if(ka(this,t,n,h)){const e=u([this],t);wa(e,r(h))}}disconnect(t,e,n){let r;const s=l(this._context),c=f(s);if(void 0===t)r=((t,e)=>{const n=ta(t),r=[];for(const i of n.outputs)sa(i)?Sa(t,e,...i):Aa(t,e,...i),r.push(i[0]);return n.outputs.clear(),r})(this,c);else if("number"==typeof t){if(t<0||t>=this.numberOfOutputs)throw i();r=((t,e,n)=>{const r=ta(t),i=[];for(const o of r.outputs)o[1]===n&&(sa(o)?Sa(t,e,...o):Aa(t,e,...o),i.push(o[0]),r.outputs.delete(o));return i})(this,c,t)}else{if(void 0!==e&&(e<0||e>=this.numberOfOutputs))throw i();if(oa(t)&&void 0!==n&&(n<0||n>=t.numberOfInputs))throw i();if(r=((t,e,n,r,i)=>{const o=ta(t);return Array.from(o.outputs).filter(t=>!(t[0]!==n||void 0!==r&&t[1]!==r||void 0!==i&&t[2]!==i)).map(n=>(sa(n)?Sa(t,e,...n):Aa(t,e,...n),o.outputs.delete(n),n[0]))})(this,c,t,e,n),0===r.length)throw o()}for(const t of r){const e=u([this],t);wa(e,a)}}})((ec=xs,(t,e,n)=>{const r=[];for(let t=0;t<n.numberOfInputs;t+=1)r.push(new Set);ec.set(t,{activeInputs:r,outputs:new Set,passiveInputs:new WeakMap,renderer:e})}),((t,e,n,r,i,o,s,a,u,c,l,h,d)=>{const p=new WeakMap;return(f,m,g,_,y)=>{const{activeInputs:v,passiveInputs:b}=o(m),{outputs:w}=o(f),x=a(f),T=o=>{const a=u(m),c=u(f);if(o){const e=Fs(b,f,g,_);t(v,f,e,!1),y||h(f)||n(c,a,g,_),d(m)&&Bs(m)}else{const t=r(v,f,g,_);e(b,_,t,!1),y||h(f)||i(c,a,g,_);const n=s(m);if(0===n)l(m)&&Vs(m,v);else{const t=p.get(m);void 0!==t&&clearTimeout(t),p.set(m,setTimeout(()=>{l(m)&&Vs(m,v)},1e3*n))}}};return!!c(w,[m,g,_],t=>t[0]===m&&t[1]===g&&t[2]===_,!0)&&(x.add(T),l(f)?t(v,f,[g,_,T],!0):e(b,_,[f,g,T],!0),!0)}})(Mu,Nu,ha,Iu,ma,ta,Ru,$s,ga,aa,Zs,ya,va),Pu,((t,e,n,r,i,o)=>s=>(a,u)=>{const c=t.get(a);if(void 0===c){if(!s&&o(a)){const t=r(a),{outputs:o}=n(a);for(const n of o)if(sa(n)){const i=r(n[0]);e(t,i,n[1],n[2])}else{const e=i(n[0]);t.disconnect(e,n[1])}}t.set(a,u)}else t.set(a,c+u)})(Os,ma,ta,ga,_a,Zs),Js,Ga,pu,((t,e,n,r,i,o,s,a)=>(u,c)=>{const l=e.get(u);if(void 0===l)throw new Error("Missing the expected cycle count.");const h=o(u.context),d=a(h);if(l===c){if(e.delete(u),!d&&s(u)){const e=r(u),{outputs:o}=n(u);for(const n of o)if(sa(n)){const i=r(n[0]);t(e,i,n[1],n[2])}else{const t=i(n[0]);e.connect(t,n[1])}}}else e.set(u,l-c)})(ha,Os,ta,ga,_a,Vu,Zs,Wu),((t,e,n)=>function r(i,o){const s=oa(o)?o:n(t,o);if((t=>"delayTime"in t)(s))return[];if(i[0]===s)return[i];if(i.includes(s))return[];const{outputs:a}=e(s);return Array.from(a).map(t=>r([...i,s],t[0])).reduce((t,e)=>t.concat(e),[])})(Ju,ta,Ds),Hu,Vu,Ku,Qu,Zu,Wu,Yu);var ec;const nc=((t,e,n,r,i,o)=>class extends t{constructor(t,n){const s=i(t),a={...Gs,...n},u=r(s,a);super(t,!1,u,o(s)?e():null),this._nativeAnalyserNode=u}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(t){this._nativeAnalyserNode.fftSize=t}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(t){const e=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=t,!(t>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=e,n()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(t){const e=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=t,!(this._nativeAnalyserNode.maxDecibels>t))throw this._nativeAnalyserNode.minDecibels=e,n()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(t){this._nativeAnalyserNode.smoothingTimeConstant=t}getByteFrequencyData(t){this._nativeAnalyserNode.getByteFrequencyData(t)}getByteTimeDomainData(t){this._nativeAnalyserNode.getByteTimeDomainData(t)}getFloatFrequencyData(t){this._nativeAnalyserNode.getFloatFrequencyData(t)}getFloatTimeDomainData(t){this._nativeAnalyserNode.getFloatTimeDomainData(t)}})(tc,Uu,Js,$u,Vu,Wu),rc=new WeakSet,ic=(t=>null===t?null:t.hasOwnProperty("AudioBuffer")?t.AudioBuffer:null)(Fu),oc=(sc=new Uint32Array(1),t=>(sc[0]=t,sc[0]));var sc;const ac=((t,e)=>n=>{n.copyFromChannel=(r,i,o=0)=>{const s=t(o),a=t(i);if(a>=n.numberOfChannels)throw e();const u=n.length,c=n.getChannelData(a),l=r.length;for(let t=s<0?-s:0;t+s<u&&t<l;t+=1)r[t]=c[t+s]},n.copyToChannel=(r,i,o=0)=>{const s=t(o),a=t(i);if(a>=n.numberOfChannels)throw e();const u=n.length,c=n.getChannelData(a),l=r.length;for(let t=s<0?-s:0;t+s<u&&t<l;t+=1)c[t+s]=r[t]}})(oc,Js),uc=(t=>e=>{e.copyFromChannel=(n=>(r,i,o=0)=>{const s=t(o),a=t(i);if(s<e.length)return n.call(e,r,a,s)})(e.copyFromChannel),e.copyToChannel=(n=>(r,i,o=0)=>{const s=t(o),a=t(i);if(s<e.length)return n.call(e,r,a,s)})(e.copyToChannel)})(oc),cc=((t,e,n,r,i,o,s,a)=>{let u=null;return class c{constructor(c){if(null===i)throw new Error("Missing the native OfflineAudioContext constructor.");const{length:l,numberOfChannels:h,sampleRate:d}={...Xs,...c};null===u&&(u=new i(1,1,44100));const p=null!==r&&e(o,o)?new r({length:l,numberOfChannels:h,sampleRate:d}):u.createBuffer(h,l,d);if(0===p.numberOfChannels)throw n();return"function"!=typeof p.copyFromChannel?(s(p),Hs(p)):e(Ws,()=>Ws(p))||a(p),t.add(p),p}static[Symbol.hasInstance](e){return null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===c.prototype||t.has(e)}}})(rc,Pu,pu,ic,zu,(t=>()=>{if(null===t)return!1;try{new t({length:1,sampleRate:44100})}catch{return!1}return!0})(ic),ac,uc),lc=(t=>(e,n)=>{const r=t(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});n.connect(r).connect(e.destination);const i=()=>{n.removeEventListener("ended",i),n.disconnect(r),r.disconnect()};n.addEventListener("ended",i)})(uu),hc=((t,e,n)=>async(r,i,o)=>{const s=e(r);await Promise.all(Array.from(s.activeInputs).map(async([e,r])=>{const s=t(e),a=await s.render(e,i);n(e)||a.connect(o,r)}))})(Bu,ea,ya),dc=(t=>(e,n,r)=>t(n,e,r))(hc),pc=((t,e,n,r,i,o,s,a,u,c,l)=>(h,d)=>{const p=h.createBufferSource();return Qa(p,d),Ya(p,d,"playbackRate"),Ka(p,d,"buffer"),Ka(p,d,"loop"),Ka(p,d,"loopEnd"),Ka(p,d,"loopStart"),e(n,()=>n(h))||(t=>{t.start=(e=>{let n=!1;return(r=0,i=0,o)=>{if(n)throw Va();e.call(t,r,i,o),n=!0}})(t.start)})(p),e(r,()=>r(h))||u(p),e(i,()=>i(h))||c(p,h),e(o,()=>o(h))||tu(p),e(s,()=>s(h))||l(p,h),e(a,()=>a(h))||eu(p),t(h,p),p})(lc,Pu,t=>{const e=t.createBufferSource();e.start();try{e.start()}catch{return!0}return!1},t=>{const e=t.createBufferSource(),n=t.createBuffer(1,1,44100);e.buffer=n;try{e.start(0,1)}catch{return!1}return!0},t=>{const e=t.createBufferSource();e.start();try{e.stop()}catch{return!1}return!0},Su,Au,Eu,t=>{t.start=(e=>(n=0,r=0,i)=>{const o=t.buffer,s=null===o?r:Math.min(o.duration,r);null!==o&&s>o.duration-.5/t.context.sampleRate?e.call(t,n,0,0):e.call(t,n,s,i)})(t.start)},(t=>(e,n)=>{const r=n.createBuffer(1,1,44100);null===e.buffer&&(e.buffer=r),t(e,"buffer",t=>()=>{const n=t.call(e);return n===r?null:n},t=>n=>t.call(e,null===n?r:n))})(Tu),Ou),fc=((t,e)=>(n,r,i)=>(t(r).replay(i),e(r,n,i)))((t=>e=>{const n=t(e);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioParam in the audio graph.");return n.renderer})(ea),hc),mc=((t,e,n,r,i)=>()=>{const o=new WeakMap;let s=null,a=null;return{set start(t){s=t},set stop(t){a=t},render(u,c){const l=o.get(c);return void 0!==l?Promise.resolve(l):(async(u,c)=>{let l=n(u);const h=zs(l,c);if(!h){const t={buffer:l.buffer,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,loop:l.loop,loopEnd:l.loopEnd,loopStart:l.loopStart,playbackRate:l.playbackRate.value};l=e(c,t),null!==s&&l.start(...s),null!==a&&l.stop(a)}return o.set(c,l),h?await t(c,u.playbackRate,l.playbackRate):await r(c,u.playbackRate,l.playbackRate),await i(u,c,l),l})(u,c)}}})(dc,pc,ga,fc,qu),gc=((t,e,n,r,i,o,s,a,u,c,l,h,d)=>(p,f,m,g=null,_=null)=>{const y=m.value,v=new bs.AutomationEventList(y),b=f?r(v):null,w={get defaultValue(){return y},get maxValue(){return null===g?m.maxValue:g},get minValue(){return null===_?m.minValue:_},get value(){return m.value},set value(t){m.value=t,w.setValueAtTime(t,p.context.currentTime)},cancelAndHoldAtTime(t){if("function"==typeof m.cancelAndHoldAtTime)null===b&&v.flush(p.context.currentTime),v.add(i(t)),m.cancelAndHoldAtTime(t);else{const e=Array.from(v).pop();null===b&&v.flush(p.context.currentTime),v.add(i(t));const n=Array.from(v).pop();m.cancelScheduledValues(t),e!==n&&void 0!==n&&("exponentialRampToValue"===n.type?m.exponentialRampToValueAtTime(n.value,n.endTime):"linearRampToValue"===n.type?m.linearRampToValueAtTime(n.value,n.endTime):"setValue"===n.type?m.setValueAtTime(n.value,n.startTime):"setValueCurve"===n.type&&m.setValueCurveAtTime(n.values,n.startTime,n.duration))}return w},cancelScheduledValues:t=>(null===b&&v.flush(p.context.currentTime),v.add(o(t)),m.cancelScheduledValues(t),w),exponentialRampToValueAtTime(t,e){if(0===t)throw new RangeError;if(!Number.isFinite(e)||e<0)throw new RangeError;const n=p.context.currentTime;return null===b&&v.flush(n),0===Array.from(v).length&&(v.add(c(y,n)),m.setValueAtTime(y,n)),v.add(s(t,e)),m.exponentialRampToValueAtTime(t,e),w},linearRampToValueAtTime(t,e){const n=p.context.currentTime;return null===b&&v.flush(n),0===Array.from(v).length&&(v.add(c(y,n)),m.setValueAtTime(y,n)),v.add(a(t,e)),m.linearRampToValueAtTime(t,e),w},setTargetAtTime:(t,e,n)=>(null===b&&v.flush(p.context.currentTime),v.add(u(t,e,n)),m.setTargetAtTime(t,e,n),w),setValueAtTime:(t,e)=>(null===b&&v.flush(p.context.currentTime),v.add(c(t,e)),m.setValueAtTime(t,e),w),setValueCurveAtTime(t,e,n){const r=t instanceof Float32Array?t:new Float32Array(t);if(null!==h&&"webkitAudioContext"===h.name){const t=e+n,i=p.context.sampleRate,o=Math.ceil(e*i),s=Math.floor(t*i),a=s-o,u=new Float32Array(a);for(let t=0;t<a;t+=1){const s=(r.length-1)/n*((o+t)/i-e),a=Math.floor(s),c=Math.ceil(s);u[t]=a===c?r[a]:(1-(s-a))*r[a]+(1-(c-s))*r[c]}null===b&&v.flush(p.context.currentTime),v.add(l(u,e,n)),m.setValueCurveAtTime(u,e,n);const c=s/i;c<t&&d(w,u[u.length-1],c),d(w,r[r.length-1],t)}else null===b&&v.flush(p.context.currentTime),v.add(l(r,e,n)),m.setValueCurveAtTime(r,e,n);return w}};return n.set(w,m),e.set(w,p),t(w,b),w})((_c=ks,(t,e)=>{_c.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:e})}),Ju,Ss,t=>({replay(e){for(const n of t)if("exponentialRampToValue"===n.type){const{endTime:t,value:r}=n;e.exponentialRampToValueAtTime(r,t)}else if("linearRampToValue"===n.type){const{endTime:t,value:r}=n;e.linearRampToValueAtTime(r,t)}else if("setTarget"===n.type){const{startTime:t,target:r,timeConstant:i}=n;e.setTargetAtTime(r,t,i)}else if("setValue"===n.type){const{startTime:t,value:r}=n;e.setValueAtTime(r,t)}else{if("setValueCurve"!==n.type)throw new Error("Can't apply an unknown automation.");{const{duration:t,startTime:r,values:i}=n;e.setValueCurveAtTime(i,r,t)}}}}),bs.createCancelAndHoldAutomationEvent,bs.createCancelScheduledValuesAutomationEvent,bs.createExponentialRampToValueAutomationEvent,bs.createLinearRampToValueAutomationEvent,bs.createSetTargetAutomationEvent,bs.createSetValueAutomationEvent,bs.createSetValueCurveAutomationEvent,Xu,ku);var _c;const yc=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,r){const a=o(t),u={...Ys,...r},c=i(a,u),l=s(a),h=l?e():null;super(t,!1,c,h),this._audioBufferSourceNodeRenderer=h,this._isBufferNullified=!1,this._isBufferSet=null!==u.buffer,this._nativeAudioBufferSourceNode=c,this._onended=null,this._playbackRate=n(this,l,c.playbackRate,Qs,Ks)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(t){if(this._nativeAudioBufferSourceNode.buffer=t,null!==t){if(this._isBufferSet)throw r();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(t){this._nativeAudioBufferSourceNode.loop=t}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(t){this._nativeAudioBufferSourceNode.loopEnd=t}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(t){this._nativeAudioBufferSourceNode.loopStart=t}get onended(){return this._onended}set onended(t){const e="function"==typeof t?a(this,t):null;this._nativeAudioBufferSourceNode.onended=e;const n=this._nativeAudioBufferSourceNode.onended;this._onended=null!==n&&n===e?t:n}get playbackRate(){return this._playbackRate}start(t=0,e=0,n){if(this._nativeAudioBufferSourceNode.start(t,e,n),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.start=void 0===n?[t,e]:[t,e,n]),"closed"!==this.context.state){Bs(this);const t=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",t),Zs(this)&&Us(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeAudioBufferSourceNode.stop(t),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.stop=t)}})(tc,mc,gc,Va,pc,Vu,Wu,Cu),vc=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,n){const r=o(t),u=s(r),c=i(r,n,u);super(t,!1,c,u?e(a):null),this._isNodeOfNativeOfflineAudioContext=u,this._nativeAudioDestinationNode=c}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(t){if(this._isNodeOfNativeOfflineAudioContext)throw r();if(t>this._nativeAudioDestinationNode.maxChannelCount)throw n();this._nativeAudioDestinationNode.channelCount=t}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(t){if(this._isNodeOfNativeOfflineAudioContext)throw r();this._nativeAudioDestinationNode.channelCountMode=t}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}})(tc,t=>{const e=new WeakMap;return{render(n,r){const i=e.get(r);return void 0!==i?Promise.resolve(i):(async(n,r)=>{const i=r.destination;return e.set(r,i),await t(n,r,i),i})(n,r)}}},Js,Va,((t,e)=>(n,r,i)=>{const o=n.destination;if(o.channelCount!==r)try{o.channelCount=r}catch{}i&&"explicit"!==o.channelCountMode&&(o.channelCountMode="explicit"),0===o.maxChannelCount&&Object.defineProperty(o,"maxChannelCount",{value:r});const s=t(n,{channelCount:r,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,gain:1});return e(s,"channelCount",t=>()=>t.call(s),t=>e=>{t.call(s,e);try{o.channelCount=e}catch(t){if(e>o.maxChannelCount)throw t}}),e(s,"channelCountMode",t=>()=>t.call(s),t=>e=>{t.call(s,e),o.channelCountMode=e}),e(s,"channelInterpretation",t=>()=>t.call(s),t=>e=>{t.call(s,e),o.channelInterpretation=e}),Object.defineProperty(s,"maxChannelCount",{get:()=>o.maxChannelCount}),s.connect(o),s})(uu,Tu),Vu,Wu,qu),bc=((t,e,n,r,i)=>()=>{const o=new WeakMap;return{render(s,a){const u=o.get(a);return void 0!==u?Promise.resolve(u):(async(s,a)=>{let u=n(s);const c=zs(u,a);if(!c){const t={Q:u.Q.value,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,detune:u.detune.value,frequency:u.frequency.value,gain:u.gain.value,type:u.type};u=e(a,t)}return o.set(a,u),c?(await t(a,s.Q,u.Q),await t(a,s.detune,u.detune),await t(a,s.frequency,u.frequency),await t(a,s.gain,u.gain)):(await r(a,s.Q,u.Q),await r(a,s.detune,u.detune),await r(a,s.frequency,u.frequency),await r(a,s.gain,u.gain)),await i(s,a,u),u})(s,a)}}})(dc,iu,ga,fc,qu),wc=(t=>(e,n)=>t.set(e,n))(ju),xc=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,r){const u=o(t),c={...ja,...r},l=i(u,c),h=s(u);super(t,!1,l,h?n():null),this._Q=e(this,h,l.Q,Qs,Ks),this._detune=e(this,h,l.detune,1200*Math.log2(Qs),-1200*Math.log2(Qs)),this._frequency=e(this,h,l.frequency,t.sampleRate/2,0),this._gain=e(this,h,l.gain,40*Math.log10(Qs),Ks),this._nativeBiquadFilterNode=l,a(this,1)}get detune(){return this._detune}get frequency(){return this._frequency}get gain(){return this._gain}get Q(){return this._Q}get type(){return this._nativeBiquadFilterNode.type}set type(t){this._nativeBiquadFilterNode.type=t}getFrequencyResponse(t,e,n){try{this._nativeBiquadFilterNode.getFrequencyResponse(t,e,n)}catch(t){if(11===t.code)throw r();throw t}if(t.length!==e.length||e.length!==n.length)throw r()}})(tc,gc,bc,Ga,iu,Vu,Wu,wc),Tc=((t,e)=>(n,r,i)=>{const o=new Set;return n.connect=(i=>(s,a=0,u=0)=>{const c=0===o.size;if(e(s))return i.call(n,s,a,u),t(o,[s,a,u],t=>t[0]===s&&t[1]===a&&t[2]===u,!0),c&&r(),s;i.call(n,s,a),t(o,[s,a],t=>t[0]===s&&t[1]===a,!0),c&&r()})(n.connect),n.disconnect=(t=>(r,s,a)=>{const u=o.size>0;if(void 0===r)t.apply(n),o.clear();else if("number"==typeof r){t.call(n,r);for(const t of o)t[1]===r&&o.delete(t)}else{e(r)?t.call(n,r,s,a):t.call(n,r,s);for(const t of o)t[0]!==r||void 0!==s&&t[1]!==s||void 0!==a&&t[2]!==a||o.delete(t)}const c=0===o.size;u&&c&&i()})(n.disconnect),n})(aa,Qu),kc=((t,e)=>(n,r)=>{r.channelCount=1,r.channelCountMode="explicit",Object.defineProperty(r,"channelCount",{get:()=>1,set:()=>{throw t()}}),Object.defineProperty(r,"channelCountMode",{get:()=>"explicit",set:()=>{throw t()}});const i=n.createBufferSource();e(r,()=>{const t=r.numberOfInputs;for(let e=0;e<t;e+=1)i.connect(r,0,e)},()=>i.disconnect(r))})(Va,Tc),Sc=((t,e)=>(n,r)=>{const i=n.createChannelMerger(r.numberOfInputs);return null!==t&&"webkitAudioContext"===t.name&&e(n,i),Qa(i,r),i})(Xu,kc),Ac=((t,e,n)=>()=>{const r=new WeakMap;return{render(i,o){const s=r.get(o);return void 0!==s?Promise.resolve(s):(async(i,o)=>{let s=e(i);if(!zs(s,o)){const e={channelCount:s.channelCount,channelCountMode:s.channelCountMode,channelInterpretation:s.channelInterpretation,numberOfInputs:s.numberOfInputs};s=t(o,e)}return r.set(o,s),await n(i,o,s),s})(i,o)}}})(Sc,ga,qu),Ec=((t,e,n,r,i)=>class extends t{constructor(t,o){const s=r(t),a={...Ra,...o};super(t,!1,n(s,a),i(s)?e():null)}})(tc,Ac,Sc,Vu,Wu),Oc=((t,e,n)=>()=>{const r=new WeakMap;return{render(i,o){const s=r.get(o);return void 0!==s?Promise.resolve(s):(async(i,o)=>{let s=e(i);if(!zs(s,o)){const e={channelCount:s.channelCount,channelCountMode:s.channelCountMode,channelInterpretation:s.channelInterpretation,numberOfOutputs:s.numberOfOutputs};s=t(o,e)}return r.set(o,s),await n(i,o,s),s})(i,o)}}})(ou,ga,qu),Cc=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u=o({...Pa,...s});super(t,!1,n(a,u),i(a)?e():null)}})(tc,Oc,ou,Vu,Wu,t=>({...t,channelCount:t.numberOfOutputs})),Mc=((t,e,n,r)=>(i,{offset:o,...s})=>{const a=i.createBuffer(1,2,44100),u=e(i,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),c=n(i,{...s,gain:o}),l=a.getChannelData(0);l[0]=1,l[1]=1,u.buffer=a,u.loop=!0;const h={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(t){c.channelCount=t},get channelCountMode(){return c.channelCountMode},set channelCountMode(t){c.channelCountMode=t},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(t){c.channelInterpretation=t},get context(){return c.context},get inputs(){return[]},get numberOfInputs(){return u.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get offset(){return c.gain},get onended(){return u.onended},set onended(t){u.onended=t},addEventListener:(...t)=>u.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>u.dispatchEvent(t[0]),removeEventListener:(...t)=>u.removeEventListener(t[0],t[1],t[2]),start(t=0){u.start.call(u,t)},stop(t=0){u.stop.call(u,t)}};return t(i,u),r(su(h,c),()=>u.connect(c),()=>u.disconnect(c))})(lc,pc,uu,Tc),Nc=((t,e,n,r,i)=>(o,s)=>{if(void 0===o.createConstantSource)return n(o,s);const a=o.createConstantSource();return Qa(a,s),Ya(a,s,"offset"),e(r,()=>r(o))||tu(a),e(i,()=>i(o))||eu(a),t(o,a),a})(lc,Pu,Mc,Su,Eu),Ic=((t,e,n,r,i)=>()=>{const o=new WeakMap;let s=null,a=null;return{set start(t){s=t},set stop(t){a=t},render(u,c){const l=o.get(c);return void 0!==l?Promise.resolve(l):(async(u,c)=>{let l=n(u);const h=zs(l,c);if(!h){const t={channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,offset:l.offset.value};l=e(c,t),null!==s&&l.start(s),null!==a&&l.stop(a)}return o.set(c,l),h?await t(c,u.offset,l.offset):await r(c,u.offset,l.offset),await i(u,c,l),l})(u,c)}}})(dc,Nc,ga,fc,qu),jc=((t,e,n,r,i,o,s)=>class extends t{constructor(t,s){const a=i(t),u={...Da,...s},c=r(a,u),l=o(a),h=l?n():null;super(t,!1,c,h),this._constantSourceNodeRenderer=h,this._nativeConstantSourceNode=c,this._offset=e(this,l,c.offset,Qs,Ks),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(t){const e="function"==typeof t?s(this,t):null;this._nativeConstantSourceNode.onended=e;const n=this._nativeConstantSourceNode.onended;this._onended=null!==n&&n===e?t:n}start(t=0){if(this._nativeConstantSourceNode.start(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.start=t),"closed"!==this.context.state){Bs(this);const t=()=>{this._nativeConstantSourceNode.removeEventListener("ended",t),Zs(this)&&Us(this)};this._nativeConstantSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeConstantSourceNode.stop(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.stop=t)}})(tc,gc,Ic,Nc,Vu,Wu,Cu),Rc=((t,e)=>(n,r)=>{const i=n.createConvolver();if(Qa(i,r),r.disableNormalization===i.normalize&&(i.normalize=!r.disableNormalization),Ka(i,r,"buffer"),r.channelCount>2)throw t();if(e(i,"channelCount",t=>()=>t.call(i),e=>n=>{if(n>2)throw t();return e.call(i,n)}),"max"===r.channelCountMode)throw t();return e(i,"channelCountMode",t=>()=>t.call(i),e=>n=>{if("max"===n)throw t();return e.call(i,n)}),i})(pu,Tu),Pc=((t,e,n)=>()=>{const r=new WeakMap;return{render(i,o){const s=r.get(o);return void 0!==s?Promise.resolve(s):(async(i,o)=>{let s=e(i);if(!zs(s,o)){const e={buffer:s.buffer,channelCount:s.channelCount,channelCountMode:s.channelCountMode,channelInterpretation:s.channelInterpretation,disableNormalization:!s.normalize};s=t(o,e)}return r.set(o,s),la(s)?await n(i,o,s.inputs[0]):await n(i,o,s),s})(i,o)}}})(Rc,ga,qu),Dc=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u={...La,...s},c=n(a,u);super(t,!1,c,i(a)?e():null),this._isBufferNullified=!1,this._nativeConvolverNode=c,null!==u.buffer&&o(this,u.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(t){if(this._nativeConvolverNode.buffer=t,null===t&&null!==this._nativeConvolverNode.buffer){const t=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=t.createBuffer(1,1,t.sampleRate),this._isBufferNullified=!0,o(this,0)}else this._isBufferNullified=!1,o(this,null===this._nativeConvolverNode.buffer?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(t){this._nativeConvolverNode.normalize=t}})(tc,Pc,Rc,Vu,Wu,wc),Lc=((t,e,n,r,i)=>o=>{const s=new WeakMap;return{render(a,u){const c=s.get(u);return void 0!==c?Promise.resolve(c):(async(a,u)=>{let c=n(a);const l=zs(c,u);if(!l){const t={channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,delayTime:c.delayTime.value,maxDelayTime:o};c=e(u,t)}return s.set(u,c),l?await t(u,a.delayTime,c.delayTime):await r(u,a.delayTime,c.delayTime),await i(a,u,c),c})(a,u)}}})(dc,au,ga,fc,qu),Fc=((t,e,n,r,i,o,s)=>class extends t{constructor(t,a){const u=i(t),c={...$a,...a},l=r(u,c),h=o(u);super(t,!1,l,h?n(c.maxDelayTime):null),this._delayTime=e(this,h,l.delayTime),s(this,c.maxDelayTime)}get delayTime(){return this._delayTime}})(tc,gc,Lc,au,Vu,Wu,wc),$c=(t=>(e,n)=>{const r=e.createDynamicsCompressor();if(Qa(r,n),n.channelCount>2)throw t();if("max"===n.channelCountMode)throw t();return Ya(r,n,"attack"),Ya(r,n,"knee"),Ya(r,n,"ratio"),Ya(r,n,"release"),Ya(r,n,"threshold"),r})(pu),Bc=((t,e,n,r,i)=>()=>{const o=new WeakMap;return{render(s,a){const u=o.get(a);return void 0!==u?Promise.resolve(u):(async(s,a)=>{let u=n(s);const c=zs(u,a);if(!c){const t={attack:u.attack.value,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,knee:u.knee.value,ratio:u.ratio.value,release:u.release.value,threshold:u.threshold.value};u=e(a,t)}return o.set(a,u),c?(await t(a,s.attack,u.attack),await t(a,s.knee,u.knee),await t(a,s.ratio,u.ratio),await t(a,s.release,u.release),await t(a,s.threshold,u.threshold)):(await r(a,s.attack,u.attack),await r(a,s.knee,u.knee),await r(a,s.ratio,u.ratio),await r(a,s.release,u.release),await r(a,s.threshold,u.threshold)),await i(s,a,u),u})(s,a)}}})(dc,$c,ga,fc,qu),qc=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,i){const u=o(t),c={...qa,...i},l=r(u,c),h=s(u);super(t,!1,l,h?n():null),this._attack=e(this,h,l.attack),this._knee=e(this,h,l.knee),this._nativeDynamicsCompressorNode=l,this._ratio=e(this,h,l.ratio),this._release=e(this,h,l.release),this._threshold=e(this,h,l.threshold),a(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(t){const e=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=t,t>2)throw this._nativeDynamicsCompressorNode.channelCount=e,i()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(t){const e=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=t,"max"===t)throw this._nativeDynamicsCompressorNode.channelCountMode=e,i()}get knee(){return this._knee}get ratio(){return this._ratio}get reduction(){return"number"==typeof this._nativeDynamicsCompressorNode.reduction.value?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}get release(){return this._release}get threshold(){return this._threshold}})(tc,gc,Bc,$c,pu,Vu,Wu,wc),Uc=((t,e,n,r,i)=>()=>{const o=new WeakMap;return{render(s,a){const u=o.get(a);return void 0!==u?Promise.resolve(u):(async(s,a)=>{let u=n(s);const c=zs(u,a);if(!c){const t={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,gain:u.gain.value};u=e(a,t)}return o.set(a,u),c?await t(a,s.gain,u.gain):await r(a,s.gain,u.gain),await i(s,a,u),u})(s,a)}}})(dc,uu,ga,fc,qu),Vc=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=i(t),u={...Ua,...s},c=r(a,u),l=o(a);super(t,!1,c,l?n():null),this._gain=e(this,l,c.gain,Qs,Ks)}get gain(){return this._gain}})(tc,gc,Uc,uu,Vu,Wu),Gc=((t,e,n,r)=>(i,o,{channelCount:s,channelCountMode:a,channelInterpretation:u,feedback:c,feedforward:l})=>{const h=nu(o,i.sampleRate),d=c instanceof Float64Array?c:new Float64Array(c),p=l instanceof Float64Array?l:new Float64Array(l),f=d.length,m=p.length,g=Math.min(f,m);if(0===f||f>20)throw r();if(0===d[0])throw e();if(0===m||m>20)throw r();if(0===p[0])throw e();if(1!==d[0]){for(let t=0;t<m;t+=1)p[t]/=d[0];for(let t=1;t<f;t+=1)d[t]/=d[0]}const _=n(i,h,s,s);_.channelCount=s,_.channelCountMode=a,_.channelInterpretation=u;const y=[],v=[],b=[];for(let t=0;t<s;t+=1){y.push(0);const t=new Float32Array(32),e=new Float32Array(32);t.fill(0),e.fill(0),v.push(t),b.push(e)}_.onaudioprocess=t=>{const e=t.inputBuffer,n=t.outputBuffer,r=e.numberOfChannels;for(let t=0;t<r;t+=1){const r=e.getChannelData(t),i=n.getChannelData(t);y[t]=Wa(d,f,p,m,g,v[t],b[t],y[t],32,r,i)}};const w=i.sampleRate/2;return su({get bufferSize(){return h},get channelCount(){return _.channelCount},set channelCount(t){_.channelCount=t},get channelCountMode(){return _.channelCountMode},set channelCountMode(t){_.channelCountMode=t},get channelInterpretation(){return _.channelInterpretation},set channelInterpretation(t){_.channelInterpretation=t},get context(){return _.context},get inputs(){return[_]},get numberOfInputs(){return _.numberOfInputs},get numberOfOutputs(){return _.numberOfOutputs},addEventListener:(...t)=>_.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>_.dispatchEvent(t[0]),getFrequencyResponse(e,n,r){if(e.length!==n.length||n.length!==r.length)throw t();const i=e.length;for(let t=0;t<i;t+=1){const i=-Math.PI*(e[t]/w),o=[Math.cos(i),Math.sin(i)],s=cu(hu(p,o),hu(d,o));n[t]=Math.sqrt(s[0]*s[0]+s[1]*s[1]),r[t]=Math.atan2(s[1],s[0])}},removeEventListener:(...t)=>_.removeEventListener(t[0],t[1],t[2])},_)})(Ga,Va,du,pu),zc=((t,e,n,r)=>i=>t(Ha,()=>Ha(i))?Promise.resolve(t(r,r)).then(t=>{if(!t){const t=n(i,512,0,1);i.oncomplete=()=>{t.onaudioprocess=null,t.disconnect()},t.onaudioprocess=()=>i.currentTime,t.connect(i.destination)}return i.startRendering()}):new Promise(t=>{const n=e(i,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});i.oncomplete=e=>{n.disconnect(),t(e.renderedBuffer)},n.connect(i.destination),i.startRendering()}))(Pu,uu,du,((t,e)=>()=>{if(null===e)return Promise.resolve(!1);const n=new e(1,1,44100),r=t(n,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return new Promise(t=>{n.oncomplete=()=>{r.disconnect(),t(0!==n.currentTime)},n.startRendering()})})(uu,zu)),Wc=((t,e,n,r,i)=>(o,s)=>{const a=new WeakMap;let u=null;const c=async(c,l)=>{let h=null,d=e(c);const p=zs(d,l);if(void 0===l.createIIRFilter?h=t(l,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):p||(d=l.createIIRFilter(s,o)),a.set(l,null===h?d:h),null!==h){if(null===u){if(null===n)throw new Error("Missing the native OfflineAudioContext constructor.");const t=new n(c.context.destination.channelCount,c.context.length,l.sampleRate);u=(async()=>{await r(c,t,t.destination);return((t,e,n,r)=>{const i=n instanceof Float64Array?n:new Float64Array(n),o=r instanceof Float64Array?r:new Float64Array(r),s=i.length,a=o.length,u=Math.min(s,a);if(1!==i[0]){for(let t=0;t<s;t+=1)o[t]/=i[0];for(let t=1;t<a;t+=1)i[t]/=i[0]}const c=new Float32Array(32),l=new Float32Array(32),h=e.createBuffer(t.numberOfChannels,t.length,t.sampleRate),d=t.numberOfChannels;for(let e=0;e<d;e+=1){const n=t.getChannelData(e),r=h.getChannelData(e);c.fill(0),l.fill(0),Wa(i,s,o,a,u,c,l,0,32,n,r)}return h})(await i(t),l,o,s)})()}const t=await u;return h.buffer=t,h.start(0),h}return await r(c,l,d),d};return{render(t,e){const n=a.get(e);return void 0!==n?Promise.resolve(n):c(t,e)}}})(pc,ga,zu,qu,zc),Jc=(t=>(e,n,r)=>{if(void 0===e.createIIRFilter)return t(e,n,r);const i=e.createIIRFilter(r.feedforward,r.feedback);return Qa(i,r),i})(Gc),Hc=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u=i(a),c={...za,...s},l=e(a,u?null:t.baseLatency,c);super(t,!1,l,u?n(c.feedback,c.feedforward):null),(t=>{var e;t.getFrequencyResponse=(e=t.getFrequencyResponse,(n,r,i)=>{if(n.length!==r.length||r.length!==i.length)throw Ga();return e.call(t,n,r,i)})})(l),this._nativeIIRFilterNode=l,o(this,1)}getFrequencyResponse(t,e,n){return this._nativeIIRFilterNode.getFrequencyResponse(t,e,n)}})(tc,Jc,Wc,Vu,Wu,wc),Xc=((t,e,n,r,i,o,s,a)=>(u,c)=>{const l=c.listener,{forwardX:h,forwardY:d,forwardZ:p,positionX:f,positionY:m,positionZ:g,upX:_,upY:y,upZ:v}=void 0===l.forwardX?(()=>{const h=new Float32Array(1),d=e(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:9}),p=s(c);let f=!1,m=[0,0,-1,0,1,0],g=[0,0,0];const _=()=>{if(f)return;f=!0;const t=r(c,256,9,0);t.onaudioprocess=({inputBuffer:t})=>{const e=[o(t,h,0),o(t,h,1),o(t,h,2),o(t,h,3),o(t,h,4),o(t,h,5)];e.some((t,e)=>t!==m[e])&&(l.setOrientation(...e),m=e);const n=[o(t,h,6),o(t,h,7),o(t,h,8)];n.some((t,e)=>t!==g[e])&&(l.setPosition(...n),g=n)},d.connect(t)},y=t=>e=>{e!==m[t]&&(m[t]=e,l.setOrientation(...m))},v=t=>e=>{e!==g[t]&&(g[t]=e,l.setPosition(...g))},b=(e,r,o)=>{const s=n(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:r});s.connect(d,0,e),s.start(),Object.defineProperty(s.offset,"defaultValue",{get:()=>r});const l=t({context:u},p,s.offset,Qs,Ks);var h,f,m,g,y,v,b;return a(l,"value",t=>()=>t.call(l),t=>e=>{try{t.call(l,e)}catch(t){if(9!==t.code)throw t}_(),p&&o(e)}),l.cancelAndHoldAtTime=(h=l.cancelAndHoldAtTime,p?()=>{throw i()}:(...t)=>{const e=h.apply(l,t);return _(),e}),l.cancelScheduledValues=(f=l.cancelScheduledValues,p?()=>{throw i()}:(...t)=>{const e=f.apply(l,t);return _(),e}),l.exponentialRampToValueAtTime=(m=l.exponentialRampToValueAtTime,p?()=>{throw i()}:(...t)=>{const e=m.apply(l,t);return _(),e}),l.linearRampToValueAtTime=(g=l.linearRampToValueAtTime,p?()=>{throw i()}:(...t)=>{const e=g.apply(l,t);return _(),e}),l.setTargetAtTime=(y=l.setTargetAtTime,p?()=>{throw i()}:(...t)=>{const e=y.apply(l,t);return _(),e}),l.setValueAtTime=(v=l.setValueAtTime,p?()=>{throw i()}:(...t)=>{const e=v.apply(l,t);return _(),e}),l.setValueCurveAtTime=(b=l.setValueCurveAtTime,p?()=>{throw i()}:(...t)=>{const e=b.apply(l,t);return _(),e}),l};return{forwardX:b(0,0,y(0)),forwardY:b(1,0,y(1)),forwardZ:b(2,-1,y(2)),positionX:b(6,0,v(0)),positionY:b(7,0,v(1)),positionZ:b(8,0,v(2)),upX:b(3,0,y(3)),upY:b(4,1,y(4)),upZ:b(5,0,y(5))}})():l;return{get forwardX(){return h},get forwardY(){return d},get forwardZ(){return p},get positionX(){return f},get positionY(){return m},get positionZ(){return g},get upX(){return _},get upY(){return y},get upZ(){return v}}})(gc,Sc,Nc,du,pu,wu,Wu,Tu),Kc=new WeakMap,Qc=((t,e,n,r,i,o)=>class extends n{constructor(n,o){super(n),this._nativeContext=n,As.set(this,n),r(n)&&i.set(n,new Set),this._destination=new t(this,o),this._listener=e(this,n),this._onstatechange=null}get currentTime(){return this._nativeContext.currentTime}get destination(){return this._destination}get listener(){return this._listener}get onstatechange(){return this._onstatechange}set onstatechange(t){const e="function"==typeof t?o(this,t):null;this._nativeContext.onstatechange=e;const n=this._nativeContext.onstatechange;this._onstatechange=null!==n&&n===e?t:n}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}})(vc,Xc,Hu,Wu,Kc,Cu),Zc=((t,e,n,r,i,o)=>(s,a)=>{const u=s.createOscillator();return Qa(u,a),Ya(u,a,"detune"),Ya(u,a,"frequency"),void 0!==a.periodicWave?u.setPeriodicWave(a.periodicWave):Ka(u,a,"type"),e(n,()=>n(s))||tu(u),e(r,()=>r(s))||o(u,s),e(i,()=>i(s))||eu(u),t(s,u),u})(lc,Pu,Su,Au,Eu,Ou),Yc=((t,e,n,r,i)=>()=>{const o=new WeakMap;let s=null,a=null,u=null;return{set periodicWave(t){s=t},set start(t){a=t},set stop(t){u=t},render(c,l){const h=o.get(l);return void 0!==h?Promise.resolve(h):(async(c,l)=>{let h=n(c);const d=zs(h,l);if(!d){const t={channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,detune:h.detune.value,frequency:h.frequency.value,periodicWave:null===s?void 0:s,type:h.type};h=e(l,t),null!==a&&h.start(a),null!==u&&h.stop(u)}return o.set(l,h),d?(await t(l,c.detune,h.detune),await t(l,c.frequency,h.frequency)):(await r(l,c.detune,h.detune),await r(l,c.frequency,h.frequency)),await i(c,l,h),h})(c,l)}}})(dc,Zc,ga,fc,qu),tl=((t,e,n,r,i,o,s)=>class extends t{constructor(t,s){const a=i(t),u={...mu,...s},c=n(a,u),l=o(a),h=l?r():null,d=t.sampleRate/2;super(t,!1,c,h),this._detune=e(this,l,c.detune,153600,-153600),this._frequency=e(this,l,c.frequency,d,-d),this._nativeOscillatorNode=c,this._onended=null,this._oscillatorNodeRenderer=h,null!==this._oscillatorNodeRenderer&&void 0!==u.periodicWave&&(this._oscillatorNodeRenderer.periodicWave=u.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(t){const e="function"==typeof t?s(this,t):null;this._nativeOscillatorNode.onended=e;const n=this._nativeOscillatorNode.onended;this._onended=null!==n&&n===e?t:n}get type(){return this._nativeOscillatorNode.type}set type(t){this._nativeOscillatorNode.type=t,null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(t){this._nativeOscillatorNode.setPeriodicWave(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=t)}start(t=0){if(this._nativeOscillatorNode.start(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.start=t),"closed"!==this.context.state){Bs(this);const t=()=>{this._nativeOscillatorNode.removeEventListener("ended",t),Zs(this)&&Us(this)};this._nativeOscillatorNode.addEventListener("ended",t)}}stop(t=0){this._nativeOscillatorNode.stop(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.stop=t)}})(tc,gc,Zc,Yc,Vu,Wu,Cu),el=(t=>(e,n)=>{const r=t(e,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),i=e.createBuffer(1,2,44100);return r.buffer=i,r.loop=!0,r.connect(n),r.start(),()=>{r.stop(),r.disconnect(n)}})(pc),nl=((t,e,n,r,i)=>(o,{curve:s,oversample:a,...u})=>{const c=o.createWaveShaper(),l=o.createWaveShaper();Qa(c,u),Qa(l,u);const h=n(o,{...u,gain:1}),d=n(o,{...u,gain:-1}),p=n(o,{...u,gain:1}),f=n(o,{...u,gain:-1});let m=null,g=!1,_=null;const y={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(t){h.channelCount=t,d.channelCount=t,c.channelCount=t,p.channelCount=t,l.channelCount=t,f.channelCount=t},get channelCountMode(){return c.channelCountMode},set channelCountMode(t){h.channelCountMode=t,d.channelCountMode=t,c.channelCountMode=t,p.channelCountMode=t,l.channelCountMode=t,f.channelCountMode=t},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(t){h.channelInterpretation=t,d.channelInterpretation=t,c.channelInterpretation=t,p.channelInterpretation=t,l.channelInterpretation=t,f.channelInterpretation=t},get context(){return c.context},get curve(){return _},set curve(n){if(null!==n&&n.length<2)throw e();if(null===n)c.curve=n,l.curve=n;else{const t=n.length,e=new Float32Array(t+2-t%2),r=new Float32Array(t+2-t%2);e[0]=n[0],r[0]=-n[t-1];const i=Math.ceil((t+1)/2),o=(t+1)/2-1;for(let s=1;s<i;s+=1){const a=s/i*o,u=Math.floor(a),c=Math.ceil(a);e[s]=u===c?n[u]:(1-(a-u))*n[u]+(1-(c-a))*n[c],r[s]=u===c?-n[t-1-u]:-(1-(a-u))*n[t-1-u]-(1-(c-a))*n[t-1-c]}e[i]=t%2==1?n[i-1]:(n[i-2]+n[i-1])/2,c.curve=e,l.curve=r}_=n,g&&(r(_)&&null===m?m=t(o,h):null!==m&&(m(),m=null))},get inputs(){return[h]},get numberOfInputs(){return c.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get oversample(){return c.oversample},set oversample(t){c.oversample=t,l.oversample=t},addEventListener:(...t)=>h.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>h.dispatchEvent(t[0]),removeEventListener:(...t)=>h.removeEventListener(t[0],t[1],t[2])};null!==s&&(y.curve=s instanceof Float32Array?s:new Float32Array(s)),a!==y.oversample&&(y.oversample=a);return i(su(y,p),()=>{h.connect(c).connect(p),h.connect(d).connect(l).connect(f).connect(p),g=!0,r(_)&&(m=t(o,h))},()=>{h.disconnect(c),c.disconnect(p),h.disconnect(d),d.disconnect(l),l.disconnect(f),f.disconnect(p),g=!1,null!==m&&(m(),m=null)})})(el,Va,uu,xu,Tc),rl=((t,e,n,r,i,o,s)=>(a,u)=>{const c=a.createWaveShaper();if(null!==o&&"webkitAudioContext"===o.name&&void 0===a.createGain().gain.automationRate)return n(a,u);Qa(c,u);const l=null===u.curve||u.curve instanceof Float32Array?u.curve:new Float32Array(u.curve);if(null!==l&&l.length<2)throw e();Ka(c,{curve:l},"curve"),Ka(c,u,"oversample");let h=null,d=!1;s(c,"curve",t=>()=>t.call(c),e=>n=>(e.call(c,n),d&&(r(n)&&null===h?h=t(a,c):r(n)||null===h||(h(),h=null)),n));return i(c,()=>{d=!0,r(c.curve)&&(h=t(a,c))},()=>{d=!1,null!==h&&(h(),h=null)})})(el,Va,nl,xu,Tc,Xu,Tu),il=((t,e,n,r,i,o,s,a,u,c)=>(l,{coneInnerAngle:h,coneOuterAngle:d,coneOuterGain:p,distanceModel:f,maxDistance:m,orientationX:g,orientationY:_,orientationZ:y,panningModel:v,positionX:b,positionY:w,positionZ:x,refDistance:T,rolloffFactor:k,...S})=>{const A=l.createPanner();if(S.channelCount>2)throw s();if("max"===S.channelCountMode)throw s();Qa(A,S);const E={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},O=n(l,{...E,channelInterpretation:"speakers",numberOfInputs:6}),C=r(l,{...S,gain:1}),M=r(l,{...E,gain:1}),N=r(l,{...E,gain:0}),I=r(l,{...E,gain:0}),j=r(l,{...E,gain:0}),R=r(l,{...E,gain:0}),P=r(l,{...E,gain:0}),D=i(l,256,6,1),L=o(l,{...E,curve:new Float32Array([1,1]),oversample:"none"});let F=[g,_,y],$=[b,w,x];const B=new Float32Array(1);D.onaudioprocess=({inputBuffer:t})=>{const e=[u(t,B,0),u(t,B,1),u(t,B,2)];e.some((t,e)=>t!==F[e])&&(A.setOrientation(...e),F=e);const n=[u(t,B,3),u(t,B,4),u(t,B,5)];n.some((t,e)=>t!==$[e])&&(A.setPosition(...n),$=n)},Object.defineProperty(N.gain,"defaultValue",{get:()=>0}),Object.defineProperty(I.gain,"defaultValue",{get:()=>0}),Object.defineProperty(j.gain,"defaultValue",{get:()=>0}),Object.defineProperty(R.gain,"defaultValue",{get:()=>0}),Object.defineProperty(P.gain,"defaultValue",{get:()=>0});const q={get bufferSize(){},get channelCount(){return A.channelCount},set channelCount(t){if(t>2)throw s();C.channelCount=t,A.channelCount=t},get channelCountMode(){return A.channelCountMode},set channelCountMode(t){if("max"===t)throw s();C.channelCountMode=t,A.channelCountMode=t},get channelInterpretation(){return A.channelInterpretation},set channelInterpretation(t){C.channelInterpretation=t,A.channelInterpretation=t},get coneInnerAngle(){return A.coneInnerAngle},set coneInnerAngle(t){A.coneInnerAngle=t},get coneOuterAngle(){return A.coneOuterAngle},set coneOuterAngle(t){A.coneOuterAngle=t},get coneOuterGain(){return A.coneOuterGain},set coneOuterGain(t){if(t<0||t>1)throw e();A.coneOuterGain=t},get context(){return A.context},get distanceModel(){return A.distanceModel},set distanceModel(t){A.distanceModel=t},get inputs(){return[C]},get maxDistance(){return A.maxDistance},set maxDistance(t){if(t<0)throw new RangeError;A.maxDistance=t},get numberOfInputs(){return A.numberOfInputs},get numberOfOutputs(){return A.numberOfOutputs},get orientationX(){return M.gain},get orientationY(){return N.gain},get orientationZ(){return I.gain},get panningModel(){return A.panningModel},set panningModel(t){A.panningModel=t},get positionX(){return j.gain},get positionY(){return R.gain},get positionZ(){return P.gain},get refDistance(){return A.refDistance},set refDistance(t){if(t<0)throw new RangeError;A.refDistance=t},get rolloffFactor(){return A.rolloffFactor},set rolloffFactor(t){if(t<0)throw new RangeError;A.rolloffFactor=t},addEventListener:(...t)=>C.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>C.dispatchEvent(t[0]),removeEventListener:(...t)=>C.removeEventListener(t[0],t[1],t[2])};h!==q.coneInnerAngle&&(q.coneInnerAngle=h),d!==q.coneOuterAngle&&(q.coneOuterAngle=d),p!==q.coneOuterGain&&(q.coneOuterGain=p),f!==q.distanceModel&&(q.distanceModel=f),m!==q.maxDistance&&(q.maxDistance=m),g!==q.orientationX.value&&(q.orientationX.value=g),_!==q.orientationY.value&&(q.orientationY.value=_),y!==q.orientationZ.value&&(q.orientationZ.value=y),v!==q.panningModel&&(q.panningModel=v),b!==q.positionX.value&&(q.positionX.value=b),w!==q.positionY.value&&(q.positionY.value=w),x!==q.positionZ.value&&(q.positionZ.value=x),T!==q.refDistance&&(q.refDistance=T),k!==q.rolloffFactor&&(q.rolloffFactor=k),1===F[0]&&0===F[1]&&0===F[2]||A.setOrientation(...F),0===$[0]&&0===$[1]&&0===$[2]||A.setPosition(...$);return c(su(q,A),()=>{C.connect(A),t(C,L,0,0),L.connect(M).connect(O,0,0),L.connect(N).connect(O,0,1),L.connect(I).connect(O,0,2),L.connect(j).connect(O,0,3),L.connect(R).connect(O,0,4),L.connect(P).connect(O,0,5),O.connect(D).connect(l.destination)},()=>{C.disconnect(A),a(C,L,0,0),L.disconnect(M),M.disconnect(O),L.disconnect(N),N.disconnect(O),L.disconnect(I),I.disconnect(O),L.disconnect(j),j.disconnect(O),L.disconnect(R),R.disconnect(O),L.disconnect(P),P.disconnect(O),O.disconnect(D),D.disconnect(l.destination)})})(ha,Va,Sc,uu,du,rl,pu,ma,wu,Tc),ol=(t=>(e,n)=>{const r=e.createPanner();return void 0===r.orientationX?t(e,n):(Qa(r,n),Ya(r,n,"orientationX"),Ya(r,n,"orientationY"),Ya(r,n,"orientationZ"),Ya(r,n,"positionX"),Ya(r,n,"positionY"),Ya(r,n,"positionZ"),Ka(r,n,"coneInnerAngle"),Ka(r,n,"coneOuterAngle"),Ka(r,n,"coneOuterGain"),Ka(r,n,"distanceModel"),Ka(r,n,"maxDistance"),Ka(r,n,"panningModel"),Ka(r,n,"refDistance"),Ka(r,n,"rolloffFactor"),r)})(il),sl=((t,e,n,r,i,o,s,a,u,c)=>()=>{const l=new WeakMap;let h=null;return{render(d,p){const f=l.get(p);return void 0!==f?Promise.resolve(f):(async(d,p)=>{let f=null,m=o(d);const g={channelCount:m.channelCount,channelCountMode:m.channelCountMode,channelInterpretation:m.channelInterpretation},_={...g,coneInnerAngle:m.coneInnerAngle,coneOuterAngle:m.coneOuterAngle,coneOuterGain:m.coneOuterGain,distanceModel:m.distanceModel,maxDistance:m.maxDistance,panningModel:m.panningModel,refDistance:m.refDistance,rolloffFactor:m.rolloffFactor},y=zs(m,p);if("bufferSize"in m)f=r(p,{...g,gain:1});else if(!y){const t={..._,orientationX:m.orientationX.value,orientationY:m.orientationY.value,orientationZ:m.orientationZ.value,positionX:m.positionX.value,positionY:m.positionY.value,positionZ:m.positionZ.value};m=i(p,t)}if(l.set(p,null===f?m:f),null!==f){if(null===h){if(null===s)throw new Error("Missing the native OfflineAudioContext constructor.");const t=new s(6,d.context.length,p.sampleRate),r=e(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6});r.connect(t.destination),h=(async()=>{const e=await Promise.all([d.orientationX,d.orientationY,d.orientationZ,d.positionX,d.positionY,d.positionZ].map(async(e,r)=>{const i=n(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:0===r?1:0});return await a(t,e,i.offset),i}));for(let t=0;t<6;t+=1)e[t].connect(r,0,t),e[t].start(0);return c(t)})()}const t=await h,o=r(p,{...g,gain:1});await u(d,p,o);const l=[];for(let e=0;e<t.numberOfChannels;e+=1)l.push(t.getChannelData(e));let m=[l[0][0],l[1][0],l[2][0]],y=[l[3][0],l[4][0],l[5][0]],v=r(p,{...g,gain:1}),b=i(p,{..._,orientationX:m[0],orientationY:m[1],orientationZ:m[2],positionX:y[0],positionY:y[1],positionZ:y[2]});o.connect(v).connect(b.inputs[0]),b.connect(f);for(let e=128;e<t.length;e+=128){const t=[l[0][e],l[1][e],l[2][e]],n=[l[3][e],l[4][e],l[5][e]];if(t.some((t,e)=>t!==m[e])||n.some((t,e)=>t!==y[e])){m=t,y=n;const s=e/p.sampleRate;v.gain.setValueAtTime(0,s),v=r(p,{...g,gain:0}),b=i(p,{..._,orientationX:m[0],orientationY:m[1],orientationZ:m[2],positionX:y[0],positionY:y[1],positionZ:y[2]}),v.gain.setValueAtTime(1,s),o.connect(v).connect(b.inputs[0]),b.connect(f)}}return f}return y?(await t(p,d.orientationX,m.orientationX),await t(p,d.orientationY,m.orientationY),await t(p,d.orientationZ,m.orientationZ),await t(p,d.positionX,m.positionX),await t(p,d.positionY,m.positionY),await t(p,d.positionZ,m.positionZ)):(await a(p,d.orientationX,m.orientationX),await a(p,d.orientationY,m.orientationY),await a(p,d.orientationZ,m.orientationZ),await a(p,d.positionX,m.positionX),await a(p,d.positionY,m.positionY),await a(p,d.positionZ,m.positionZ)),la(m)?await u(d,p,m.inputs[0]):await u(d,p,m),m})(d,p)}}})(dc,Sc,Nc,uu,ol,ga,zu,fc,qu,zc),al=((t,e,n,r,i,o,s)=>class extends t{constructor(t,a){const u=i(t),c={...gu,...a},l=n(u,c),h=o(u);super(t,!1,l,h?r():null),this._nativePannerNode=l,this._orientationX=e(this,h,l.orientationX,Qs,Ks),this._orientationY=e(this,h,l.orientationY,Qs,Ks),this._orientationZ=e(this,h,l.orientationZ,Qs,Ks),this._positionX=e(this,h,l.positionX,Qs,Ks),this._positionY=e(this,h,l.positionY,Qs,Ks),this._positionZ=e(this,h,l.positionZ,Qs,Ks),s(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(t){this._nativePannerNode.coneInnerAngle=t}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(t){this._nativePannerNode.coneOuterAngle=t}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(t){this._nativePannerNode.coneOuterGain=t}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(t){this._nativePannerNode.distanceModel=t}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(t){this._nativePannerNode.maxDistance=t}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(t){this._nativePannerNode.panningModel=t}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(t){this._nativePannerNode.refDistance=t}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(t){this._nativePannerNode.rolloffFactor=t}})(tc,gc,ol,sl,Vu,Wu,wc),ul=(t=>(e,{disableNormalization:n,imag:r,real:i})=>{const o=r instanceof Float32Array?r:new Float32Array(r),s=i instanceof Float32Array?i:new Float32Array(i),a=e.createPeriodicWave(s,o,{disableNormalization:n});if(Array.from(r).length<2)throw t();return a})(Js),cl=((t,e,n,r)=>class i{constructor(i,o){const s=e(i),a=r({..._u,...o}),u=t(s,a);return n.add(u),u}static[Symbol.hasInstance](t){return null!==t&&"object"==typeof t&&Object.getPrototypeOf(t)===i.prototype||n.has(t)}})(ul,Vu,new WeakSet,t=>{const{imag:e,real:n}=t;return void 0===e?void 0===n?{...t,imag:[0,0],real:[0,0]}:{...t,imag:Array.from(n,()=>0),real:n}:void 0===n?{...t,imag:e,real:Array.from(e,()=>0)}:{...t,imag:e,real:n}}),ll=((t,e,n,r,i,o)=>{const s=16385,a=new Float32Array([1,1]),u=Math.PI/2,c={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},l={...c,oversample:"none"},h=(t,o,h,d,p)=>{if(1===o)return((t,e,i,o)=>{const h=new Float32Array(s),d=new Float32Array(s);for(let t=0;t<s;t+=1){const e=t/16384*u;h[t]=Math.cos(e),d[t]=Math.sin(e)}const p=n(t,{...c,gain:0}),f=r(t,{...l,curve:h}),m=r(t,{...l,curve:a}),g=n(t,{...c,gain:0}),_=r(t,{...l,curve:d});return{connectGraph(){e.connect(p),e.connect(void 0===m.inputs?m:m.inputs[0]),e.connect(g),m.connect(i),i.connect(void 0===f.inputs?f:f.inputs[0]),i.connect(void 0===_.inputs?_:_.inputs[0]),f.connect(p.gain),_.connect(g.gain),p.connect(o,0,0),g.connect(o,0,1)},disconnectGraph(){e.disconnect(p),e.disconnect(void 0===m.inputs?m:m.inputs[0]),e.disconnect(g),m.disconnect(i),i.disconnect(void 0===f.inputs?f:f.inputs[0]),i.disconnect(void 0===_.inputs?_:_.inputs[0]),f.disconnect(p.gain),_.disconnect(g.gain),p.disconnect(o,0,0),g.disconnect(o,0,1)}}})(t,h,d,p);if(2===o)return((t,i,o,h)=>{const d=new Float32Array(s),p=new Float32Array(s),f=new Float32Array(s),m=new Float32Array(s),g=Math.floor(8192.5);for(let t=0;t<s;t+=1)if(t>g){const e=(t-g)/(16384-g)*u;d[t]=Math.cos(e),p[t]=Math.sin(e),f[t]=0,m[t]=1}else{const e=t/(16384-g)*u;d[t]=1,p[t]=0,f[t]=Math.cos(e),m[t]=Math.sin(e)}const _=e(t,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),y=n(t,{...c,gain:0}),v=r(t,{...l,curve:d}),b=n(t,{...c,gain:0}),w=r(t,{...l,curve:p}),x=r(t,{...l,curve:a}),T=n(t,{...c,gain:0}),k=r(t,{...l,curve:f}),S=n(t,{...c,gain:0}),A=r(t,{...l,curve:m});return{connectGraph(){i.connect(_),i.connect(void 0===x.inputs?x:x.inputs[0]),_.connect(y,0),_.connect(b,0),_.connect(T,1),_.connect(S,1),x.connect(o),o.connect(void 0===v.inputs?v:v.inputs[0]),o.connect(void 0===w.inputs?w:w.inputs[0]),o.connect(void 0===k.inputs?k:k.inputs[0]),o.connect(void 0===A.inputs?A:A.inputs[0]),v.connect(y.gain),w.connect(b.gain),k.connect(T.gain),A.connect(S.gain),y.connect(h,0,0),T.connect(h,0,0),b.connect(h,0,1),S.connect(h,0,1)},disconnectGraph(){i.disconnect(_),i.disconnect(void 0===x.inputs?x:x.inputs[0]),_.disconnect(y,0),_.disconnect(b,0),_.disconnect(T,1),_.disconnect(S,1),x.disconnect(o),o.disconnect(void 0===v.inputs?v:v.inputs[0]),o.disconnect(void 0===w.inputs?w:w.inputs[0]),o.disconnect(void 0===k.inputs?k:k.inputs[0]),o.disconnect(void 0===A.inputs?A:A.inputs[0]),v.disconnect(y.gain),w.disconnect(b.gain),k.disconnect(T.gain),A.disconnect(S.gain),y.disconnect(h,0,0),T.disconnect(h,0,0),b.disconnect(h,0,1),S.disconnect(h,0,1)}}})(t,h,d,p);throw i()};return(e,{channelCount:r,channelCountMode:s,pan:a,...u})=>{if("max"===s)throw i();const c=t(e,{...u,channelCount:1,channelCountMode:s,numberOfInputs:2}),l=n(e,{...u,channelCount:r,channelCountMode:s,gain:1}),d=n(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:a});let{connectGraph:p,disconnectGraph:f}=h(e,r,l,d,c);Object.defineProperty(d.gain,"defaultValue",{get:()=>0}),Object.defineProperty(d.gain,"maxValue",{get:()=>1}),Object.defineProperty(d.gain,"minValue",{get:()=>-1});const m={get bufferSize(){},get channelCount(){return l.channelCount},set channelCount(t){l.channelCount!==t&&(g&&f(),({connectGraph:p,disconnectGraph:f}=h(e,t,l,d,c)),g&&p()),l.channelCount=t},get channelCountMode(){return l.channelCountMode},set channelCountMode(t){if("clamped-max"===t||"max"===t)throw i();l.channelCountMode=t},get channelInterpretation(){return l.channelInterpretation},set channelInterpretation(t){l.channelInterpretation=t},get context(){return l.context},get inputs(){return[l]},get numberOfInputs(){return l.numberOfInputs},get numberOfOutputs(){return l.numberOfOutputs},get pan(){return d.gain},addEventListener:(...t)=>l.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>l.dispatchEvent(t[0]),removeEventListener:(...t)=>l.removeEventListener(t[0],t[1],t[2])};let g=!1;return o(su(m,c),()=>{p(),g=!0},()=>{f(),g=!1})}})(Sc,ou,uu,rl,pu,Tc),hl=((t,e)=>(n,r)=>{const i=r.channelCountMode;if("clamped-max"===i)throw e();if(void 0===n.createStereoPanner)return t(n,r);const o=n.createStereoPanner();return Qa(o,r),Ya(o,r,"pan"),Object.defineProperty(o,"channelCountMode",{get:()=>i,set:t=>{if(t!==i)throw e()}}),o})(ll,pu),dl=((t,e,n,r,i)=>()=>{const o=new WeakMap;return{render(s,a){const u=o.get(a);return void 0!==u?Promise.resolve(u):(async(s,a)=>{let u=n(s);const c=zs(u,a);if(!c){const t={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,pan:u.pan.value};u=e(a,t)}return o.set(a,u),c?await t(a,s.pan,u.pan):await r(a,s.pan,u.pan),la(u)?await i(s,a,u.inputs[0]):await i(s,a,u),u})(s,a)}}})(dc,hl,ga,fc,qu),pl=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=i(t),u={...yu,...s},c=n(a,u),l=o(a);super(t,!1,c,l?r():null),this._pan=e(this,l,c.pan)}get pan(){return this._pan}})(tc,gc,hl,dl,Vu,Wu),fl=((t,e,n)=>()=>{const r=new WeakMap;return{render(i,o){const s=r.get(o);return void 0!==s?Promise.resolve(s):(async(i,o)=>{let s=e(i);if(!zs(s,o)){const e={channelCount:s.channelCount,channelCountMode:s.channelCountMode,channelInterpretation:s.channelInterpretation,curve:s.curve,oversample:s.oversample};s=t(o,e)}return r.set(o,s),la(s)?await n(i,o,s.inputs[0]):await n(i,o,s),s})(i,o)}}})(rl,ga,qu),ml=((t,e,n,r,i,o,s)=>class extends t{constructor(t,e){const a=i(t),u={...bu,...e},c=n(a,u);super(t,!0,c,o(a)?r():null),this._isCurveNullified=!1,this._nativeWaveShaperNode=c,s(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(t){if(null===t)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(t.length<2)throw e();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=t}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(t){this._nativeWaveShaperNode.oversample=t}})(tc,Va,rl,fl,Vu,Wu,wc),gl=(t=>null!==t&&t.isSecureContext)(Fu),_l=(t=>(e,n,r)=>{Object.defineProperties(t,{currentFrame:{configurable:!0,get:()=>Math.round(e*n)},currentTime:{configurable:!0,get:()=>e}});try{return r()}finally{null!==t&&(delete t.currentFrame,delete t.currentTime)}})(Fu),yl=new WeakMap,vl=((t,e)=>n=>{let r=t.get(n);if(void 0!==r)return r;if(null===e)throw new Error("Missing the native OfflineAudioContext constructor.");return r=new e(1,1,44100),t.set(n,r),r})(yl,zu),bl=gl?((t,e,n,r,i,o,s,a,u,c,l,h,d)=>{let p=0;return(f,m,g={credentials:"omit"})=>{const _=l.get(f);if(void 0!==_&&_.has(m))return Promise.resolve();const y=c.get(f);if(void 0!==y){const t=y.get(m);if(void 0!==t)return t}const v=o(f),b=void 0===v.audioWorklet?i(m).then(([t,e])=>{const[r,i]=js(t,e);return n(`${r};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${i}\n})})(window,'_AWGS')`)}).then(()=>{const t=d._AWGS.pop();if(void 0===t)throw new SyntaxError;r(v.currentTime,v.sampleRate,()=>t(class{},void 0,(t,n)=>{if(""===t.trim())throw e();const r=Cs.get(v);if(void 0!==r){if(r.has(t))throw e();Ps(n),Rs(n.parameterDescriptors),r.set(t,n)}else Ps(n),Rs(n.parameterDescriptors),Cs.set(v,new Map([[t,n]]))},v.sampleRate,void 0,void 0))}):Promise.all([i(m),Promise.resolve(t(h,h))]).then(([[t,e],n])=>{const r=p+1;p=r;const[i,o]=js(t,e),c=new Blob([`${i};((AudioWorkletProcessor,registerProcessor)=>{${o}\n})(${n?"AudioWorkletProcessor":"class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}"},(n,p)=>registerProcessor(n,class extends p{${n?"":"__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${n?"":"i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));"}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${r}',class extends AudioWorkletProcessor{process(){return !1}})`],{type:"application/javascript; charset=utf-8"}),l=URL.createObjectURL(c);return v.audioWorklet.addModule(l,g).then(()=>{if(a(v))return v;const t=s(v);return t.audioWorklet.addModule(l,g).then(()=>t)}).then(t=>{if(null===u)throw new SyntaxError;try{new u(t,`__sac${r}`)}catch{throw new SyntaxError}}).finally(()=>URL.revokeObjectURL(l))});return void 0===y?c.set(f,new Map([[m,b]])):y.set(m,b),b.then(()=>{const t=l.get(f);void 0===t?l.set(f,new Set([m])):t.add(m)}).finally(()=>{const t=c.get(f);void 0!==t&&t.delete(m)}),b}})(Pu,pu,(t=>e=>new Promise((n,r)=>{if(null===t)return void r(new SyntaxError);const i=t.document.head;if(null===i)r(new SyntaxError);else{const o=t.document.createElement("script"),s=new Blob([e],{type:"application/javascript"}),a=URL.createObjectURL(s),u=t.onerror,c=()=>{t.onerror=u,URL.revokeObjectURL(a)};t.onerror=(e,n,i,o,s)=>n===a||n===t.location.href&&1===i&&1===o?(c(),r(s),!1):null!==u?u(e,n,i,o,s):void 0,o.onerror=()=>{c(),r(new SyntaxError)},o.onload=()=>{c(),n()},o.src=a,o.type="module",i.appendChild(o)}}))(Fu),_l,(t=>async e=>{try{const t=await fetch(e);if(t.ok)return[await t.text(),t.url]}catch{}throw t()})(()=>new DOMException("","AbortError")),Vu,vl,Wu,Yu,new WeakMap,new WeakMap,((t,e)=>async()=>{if(null===t)return!0;if(null===e)return!1;const n=new Blob(['class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor("a",A)'],{type:"application/javascript; charset=utf-8"}),r=new e(1,128,44100),i=URL.createObjectURL(n);let o=!1,s=!1;try{await r.audioWorklet.addModule(i);const e=new t(r,"a",{numberOfOutputs:0}),n=r.createOscillator();e.port.onmessage=()=>o=!0,e.onprocessorerror=()=>s=!0,n.connect(e),n.start(0),await r.startRendering(),await new Promise(t=>setTimeout(t))}catch{}finally{URL.revokeObjectURL(i)}return o&&!s})(Yu,zu),Fu):void 0,wl=((t,e)=>n=>t(n)||e(n))(Ku,Wu),xl=((t,e,n,r,i,o,s,a,u,c,l)=>(h,d)=>{const p=s(h)?h:o(h);if(i.has(d)){const t=n();return Promise.reject(t)}try{i.add(d)}catch{}return e(u,()=>u(p))?p.decodeAudioData(d).then(n=>(Fa(d).catch(()=>{}),e(a,()=>a(n))||l(n),t.add(n),n)):new Promise((e,n)=>{const i=async()=>{try{await Fa(d)}catch{}},o=t=>{n(t),i()};try{p.decodeAudioData(d,n=>{"function"!=typeof n.copyFromChannel&&(c(n),Hs(n)),t.add(n),i().then(()=>e(n))},t=>{o(null===t?r():t)})}catch(t){o(t)}})})(rc,Pu,()=>new DOMException("","DataCloneError"),()=>new DOMException("","EncodingError"),new WeakSet,Vu,wl,Ws,Ha,ac,uc),Tl=((t,e,n,r,i,o,s,a,u,c,l,h,d,p,f,m,g,_,y,v)=>class extends f{constructor(e,n){super(e,n),this._nativeContext=e,this._audioWorklet=void 0===t?void 0:{addModule:(e,n)=>t(this,e,n)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new e(this)}createBiquadFilter(){return new i(this)}createBuffer(t,e,r){return new n({length:e,numberOfChannels:t,sampleRate:r})}createBufferSource(){return new r(this)}createChannelMerger(t=6){return new o(this,{numberOfInputs:t})}createChannelSplitter(t=6){return new s(this,{numberOfOutputs:t})}createConstantSource(){return new a(this)}createConvolver(){return new u(this)}createDelay(t=1){return new l(this,{maxDelayTime:t})}createDynamicsCompressor(){return new h(this)}createGain(){return new d(this)}createIIRFilter(t,e){return new p(this,{feedback:e,feedforward:t})}createOscillator(){return new m(this)}createPanner(){return new g(this)}createPeriodicWave(t,e,n={disableNormalization:!1}){return new _(this,{...n,imag:e,real:t})}createStereoPanner(){return new y(this)}createWaveShaper(){return new v(this)}decodeAudioData(t,e,n){return c(this._nativeContext,t).then(t=>("function"==typeof e&&e(t),t),t=>{throw"function"==typeof n&&n(t),t})}})(bl,nc,cc,yc,xc,Ec,Cc,jc,Dc,xl,Fc,qc,Vc,Hc,Qc,tl,al,cl,pl,ml),kl=((t,e,n,r)=>class extends t{constructor(t,i){const o=n(t),s=e(o,i);if(r(o))throw TypeError();super(t,!0,s,null),this._nativeMediaElementAudioSourceNode=s}get mediaElement(){return this._nativeMediaElementAudioSourceNode.mediaElement}})(tc,(t,e)=>t.createMediaElementSource(e.mediaElement),Vu,Wu),Sl=((t,e,n,r)=>class extends t{constructor(t,i){const o=n(t);if(r(o))throw new TypeError;const s={...Ja,...i},a=e(o,s);super(t,!1,a,null),this._nativeMediaStreamAudioDestinationNode=a}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}})(tc,(t,e)=>{const n=t.createMediaStreamDestination();return Qa(n,e),1===n.numberOfOutputs&&Object.defineProperty(n,"numberOfOutputs",{get:()=>0}),n},Vu,Wu),Al=((t,e,n,r)=>class extends t{constructor(t,i){const o=n(t),s=e(o,i);if(r(o))throw new TypeError;super(t,!0,s,null),this._nativeMediaStreamAudioSourceNode=s}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}})(tc,(t,{mediaStream:e})=>{const n=e.getAudioTracks();n.sort((t,e)=>t.id<e.id?-1:t.id>e.id?1:0);const r=n.slice(0,1),i=t.createMediaStreamSource(new MediaStream(r));return Object.defineProperty(i,"mediaStream",{value:e}),i},Vu,Wu),El=((t,e)=>(n,{mediaStreamTrack:r})=>{if("function"==typeof n.createMediaStreamTrackSource)return n.createMediaStreamTrackSource(r);const i=new MediaStream([r]),o=n.createMediaStreamSource(i);if("audio"!==r.kind)throw t();if(e(n))throw new TypeError;return o})(Va,Wu),Ol=((t,e,n)=>class extends t{constructor(t,r){const i=n(t);super(t,!0,e(i,r),null)}})(tc,El,Vu),Cl=((t,e,n,r,i,o,s,a,u)=>class extends t{constructor(t={}){if(null===u)throw new Error("Missing the native AudioContext constructor.");let e;try{e=new u(t)}catch(t){if(12===t.code&&"sampleRate is not in range"===t.message)throw n();throw t}if(null===e)throw r();if(!ia(t.latencyHint))throw new TypeError(`The provided value '${t.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(void 0!==t.sampleRate&&e.sampleRate!==t.sampleRate)throw n();super(e,2);const{latencyHint:i}=t,{sampleRate:o}=e;if(this._baseLatency="number"==typeof e.baseLatency?e.baseLatency:"balanced"===i?512/o:"interactive"===i||void 0===i?256/o:"playback"===i?1024/o:128*Math.max(2,Math.min(128,Math.round(i*o/128)))/o,this._nativeAudioContext=e,"webkitAudioContext"===u.name?(this._nativeGainNode=e.createGain(),this._nativeOscillatorNode=e.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(e.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,"running"===e.state){this._state="suspended";const t=()=>{"suspended"===this._state&&(this._state=null),e.removeEventListener("statechange",t)};e.addEventListener("statechange",t)}}get baseLatency(){return this._baseLatency}get state(){return null!==this._state?this._state:this._nativeAudioContext.state}close(){return"closed"===this.state?this._nativeAudioContext.close().then(()=>{throw e()}):("suspended"===this._state&&(this._state=null),this._nativeAudioContext.close().then(()=>{null!==this._nativeGainNode&&null!==this._nativeOscillatorNode&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),ra(this)}))}createMediaElementSource(t){return new i(this,{mediaElement:t})}createMediaStreamDestination(){return new o(this)}createMediaStreamSource(t){return new s(this,{mediaStream:t})}createMediaStreamTrackSource(t){return new a(this,{mediaStreamTrack:t})}resume(){return"suspended"===this._state?new Promise((t,e)=>{const n=()=>{this._nativeAudioContext.removeEventListener("statechange",n),"running"===this._nativeAudioContext.state?t():this.resume().then(t,e)};this._nativeAudioContext.addEventListener("statechange",n)}):this._nativeAudioContext.resume().catch(t=>{if(void 0===t||15===t.code)throw e();throw t})}suspend(){return this._nativeAudioContext.suspend().catch(t=>{if(void 0===t)throw e();throw t})}})(Tl,Va,pu,vu,kl,Sl,Al,Ol,Xu),Ml=(t=>e=>{const n=t.get(e);if(void 0===n)throw new Error("The context has no set of AudioWorkletNodes.");return n})(Kc),Nl=(t=>(e,n)=>{t(e).add(n)})(Ml),Il=(t=>(e,n,r=0,i=0)=>{const o=e[r];if(void 0===o)throw t();return xa(n)?o.connect(n,0,i):o.connect(n,0)})(Js),jl=(t=>(e,n)=>{t(e).delete(n)})(Ml),Rl=(t=>(e,n=void 0,r=void 0,i=0)=>void 0===n?e.forEach(t=>t.disconnect()):"number"==typeof n?Ba(t,e,n).disconnect():xa(n)?void 0===r?e.forEach(t=>t.disconnect(n)):void 0===i?Ba(t,e,r).disconnect(n,0):Ba(t,e,r).disconnect(n,0,i):void 0===r?e.forEach(t=>t.disconnect(n)):Ba(t,e,r).disconnect(n,0))(Js),Pl=new WeakMap,Dl=((t,e)=>n=>e(t,n))(Pl,Ds),Ll=((t,e,n,r,i,o,s,a,u,c,l,h,d)=>(p,f,m,g)=>{if(0===g.numberOfInputs&&0===g.numberOfOutputs)throw u();const _=Array.isArray(g.outputChannelCount)?g.outputChannelCount:Array.from(g.outputChannelCount);if(_.some(t=>t<1))throw u();if(_.length!==g.numberOfOutputs)throw e();if("explicit"!==g.channelCountMode)throw u();const y=g.channelCount*g.numberOfInputs,v=_.reduce((t,e)=>t+e,0),b=void 0===m.parameterDescriptors?0:m.parameterDescriptors.length;if(y+b>6||v>6)throw u();const w=new MessageChannel,x=[],T=[];for(let t=0;t<g.numberOfInputs;t+=1)x.push(s(p,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1})),T.push(i(p,{channelCount:g.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:g.channelCount}));const k=[];if(void 0!==m.parameterDescriptors)for(const{defaultValue:t,maxValue:e,minValue:n,name:r}of m.parameterDescriptors){const i=o(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:void 0!==g.parameterData[r]?g.parameterData[r]:void 0===t?0:t});Object.defineProperties(i.offset,{defaultValue:{get:()=>void 0===t?0:t},maxValue:{get:()=>void 0===e?Qs:e},minValue:{get:()=>void 0===n?Ks:n}}),k.push(i)}const S=r(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,y+b)}),A=nu(f,p.sampleRate),E=a(p,A,y+b,Math.max(1,v)),O=i(p,{channelCount:Math.max(1,v),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,v)}),C=[];for(let t=0;t<g.numberOfOutputs;t+=1)C.push(r(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:_[t]}));for(let t=0;t<g.numberOfInputs;t+=1){x[t].connect(T[t]);for(let e=0;e<g.channelCount;e+=1)T[t].connect(S,e,t*g.channelCount+e)}const M=new Ea(void 0===m.parameterDescriptors?[]:m.parameterDescriptors.map(({name:t},e)=>{const n=k[e];return n.connect(S,0,y+e),n.start(0),[t,n.offset]}));S.connect(E);let N=g.channelInterpretation,I=null;const j=0===g.numberOfOutputs?[E]:C,R={get bufferSize(){return A},get channelCount(){return g.channelCount},set channelCount(t){throw n()},get channelCountMode(){return g.channelCountMode},set channelCountMode(t){throw n()},get channelInterpretation(){return N},set channelInterpretation(t){for(const e of x)e.channelInterpretation=t;N=t},get context(){return E.context},get inputs(){return x},get numberOfInputs(){return g.numberOfInputs},get numberOfOutputs(){return g.numberOfOutputs},get onprocessorerror(){return I},set onprocessorerror(t){"function"==typeof I&&R.removeEventListener("processorerror",I),I="function"==typeof t?t:null,"function"==typeof I&&R.addEventListener("processorerror",I)},get parameters(){return M},get port(){return w.port2},addEventListener:(...t)=>E.addEventListener(t[0],t[1],t[2]),connect:t.bind(null,j),disconnect:c.bind(null,j),dispatchEvent:(...t)=>E.dispatchEvent(t[0]),removeEventListener:(...t)=>E.removeEventListener(t[0],t[1],t[2])},P=new Map;var D,L;w.port1.addEventListener=(D=w.port1.addEventListener,(...t)=>{if("message"===t[0]){const e="function"==typeof t[1]?t[1]:"object"==typeof t[1]&&null!==t[1]&&"function"==typeof t[1].handleEvent?t[1].handleEvent:null;if(null!==e){const n=P.get(t[1]);void 0!==n?t[1]=n:(t[1]=t=>{l(p.currentTime,p.sampleRate,()=>e(t))},P.set(e,t[1]))}}return D.call(w.port1,t[0],t[1],t[2])}),w.port1.removeEventListener=(L=w.port1.removeEventListener,(...t)=>{if("message"===t[0]){const e=P.get(t[1]);void 0!==e&&(P.delete(t[1]),t[1]=e)}return L.call(w.port1,t[0],t[1],t[2])});let F=null;Object.defineProperty(w.port1,"onmessage",{get:()=>F,set:t=>{"function"==typeof F&&w.port1.removeEventListener("message",F),F="function"==typeof t?t:null,"function"==typeof F&&(w.port1.addEventListener("message",F),w.port1.start())}}),m.prototype.port=w.port1;let $=null;const B=((t,e,n,r)=>{let i=Ms.get(t);void 0===i&&(i=new WeakMap,Ms.set(t,i));const o=ru(n,r);return i.set(e,o),o})(p,R,m,g);B.then(t=>$=t);const q=Na(g.numberOfInputs,g.channelCount),U=Na(g.numberOfOutputs,_),V=void 0===m.parameterDescriptors?[]:m.parameterDescriptors.reduce((t,{name:e})=>({...t,[e]:new Float32Array(128)}),{});let G=!0;const z=()=>{g.numberOfOutputs>0&&E.disconnect(O);for(let t=0,e=0;t<g.numberOfOutputs;t+=1){const n=C[t];for(let r=0;r<_[t];r+=1)O.disconnect(n,e+r,r);e+=_[t]}},W=new Map;E.onaudioprocess=({inputBuffer:t,outputBuffer:e})=>{if(null!==$){const n=h(R);for(let r=0;r<A;r+=128){for(let e=0;e<g.numberOfInputs;e+=1)for(let n=0;n<g.channelCount;n+=1)Ca(t,q[e],n,n,r);void 0!==m.parameterDescriptors&&m.parameterDescriptors.forEach(({name:e},n)=>{Ca(t,V,e,y+n,r)});for(let t=0;t<g.numberOfInputs;t+=1)for(let e=0;e<_[t];e+=1)0===U[t][e].byteLength&&(U[t][e]=new Float32Array(128));try{const t=q.map((t,e)=>{if(n[e].size>0)return W.set(e,A/128),t;const r=W.get(e);return void 0===r?[]:(t.every(t=>t.every(t=>0===t))&&(1===r?W.delete(e):W.set(e,r-1)),t)}),i=l(p.currentTime+r/p.sampleRate,p.sampleRate,()=>$.process(t,U,V));G=i;for(let t=0,n=0;t<g.numberOfOutputs;t+=1){for(let i=0;i<_[t];i+=1)Ma(e,U[t],i,n+i,r);n+=_[t]}}catch(t){G=!1,R.dispatchEvent(new ErrorEvent("processorerror",{colno:t.colno,filename:t.filename,lineno:t.lineno,message:t.message}))}if(!G){for(let t=0;t<g.numberOfInputs;t+=1){x[t].disconnect(T[t]);for(let e=0;e<g.channelCount;e+=1)T[r].disconnect(S,e,t*g.channelCount+e)}if(void 0!==m.parameterDescriptors){const t=m.parameterDescriptors.length;for(let e=0;e<t;e+=1){const t=k[e];t.disconnect(S,0,y+e),t.stop()}}S.disconnect(E),E.onaudioprocess=null,J?z():K();break}}}};let J=!1;const H=s(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0}),X=()=>E.connect(H).connect(p.destination),K=()=>{E.disconnect(H),H.disconnect()};return X(),d(R,()=>{if(G){K(),g.numberOfOutputs>0&&E.connect(O);for(let t=0,e=0;t<g.numberOfOutputs;t+=1){const n=C[t];for(let r=0;r<_[t];r+=1)O.connect(n,e+r,r);e+=_[t]}}J=!0},()=>{G&&(X(),z()),J=!1})})(Il,Js,Va,Sc,ou,Nc,uu,du,pu,Rl,_l,Dl,Tc),Fl=((t,e,n,r,i)=>(o,s,a,u,c,l)=>{if(null!==a)try{const e=new a(o,u,l),r=new Map;let s=null;if(Object.defineProperties(e,{channelCount:{get:()=>l.channelCount,set:()=>{throw t()}},channelCountMode:{get:()=>"explicit",set:()=>{throw t()}},onprocessorerror:{get:()=>s,set:t=>{"function"==typeof s&&e.removeEventListener("processorerror",s),s="function"==typeof t?t:null,"function"==typeof s&&e.addEventListener("processorerror",s)}}}),e.addEventListener=(d=e.addEventListener,(...t)=>{if("processorerror"===t[0]){const e="function"==typeof t[1]?t[1]:"object"==typeof t[1]&&null!==t[1]&&"function"==typeof t[1].handleEvent?t[1].handleEvent:null;if(null!==e){const n=r.get(t[1]);void 0!==n?t[1]=n:(t[1]=n=>{"error"===n.type?(Object.defineProperties(n,{type:{value:"processorerror"}}),e(n)):e(new ErrorEvent(t[0],{...n}))},r.set(e,t[1]))}}return d.call(e,"error",t[1],t[2]),d.call(e,...t)}),e.removeEventListener=(h=e.removeEventListener,(...t)=>{if("processorerror"===t[0]){const e=r.get(t[1]);void 0!==e&&(r.delete(t[1]),t[1]=e)}return h.call(e,"error",t[1],t[2]),h.call(e,t[0],t[1],t[2])}),0!==l.numberOfOutputs){const t=n(o,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});e.connect(t).connect(o.destination);return i(e,()=>t.disconnect(),()=>t.connect(o.destination))}return e}catch(t){if(11===t.code)throw r();throw t}var h,d;if(void 0===c)throw r();return(t=>{const{port1:e}=new MessageChannel;try{e.postMessage(t)}finally{e.close()}})(l),e(o,s,c,l)})(Va,Ll,uu,pu,Tc),$l=((t,e,n,r,i,o,s,a,u,c,l,h,d,p,f,m)=>(g,_,y)=>{const v=new WeakMap;let b=null;return{render(w,x){a(x,w);const T=v.get(x);return void 0!==T?Promise.resolve(T):(async(a,w)=>{let x=l(a),T=null;const k=zs(x,w),S=Array.isArray(_.outputChannelCount)?_.outputChannelCount:Array.from(_.outputChannelCount);if(null===h){const t=S.reduce((t,e)=>t+e,0),n=i(w,{channelCount:Math.max(1,t),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,t)}),o=[];for(let t=0;t<a.numberOfOutputs;t+=1)o.push(r(w,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:S[t]}));const c=s(w,{channelCount:_.channelCount,channelCountMode:_.channelCountMode,channelInterpretation:_.channelInterpretation,gain:1});c.connect=e.bind(null,o),c.disconnect=u.bind(null,o),T=[n,o,c]}else k||(x=new h(w,g));if(v.set(w,null===T?x:T[2]),null!==T){if(null===b){if(void 0===y)throw new Error("Missing the processor constructor.");if(null===d)throw new Error("Missing the native OfflineAudioContext constructor.");const t=a.channelCount*a.numberOfInputs,e=void 0===y.parameterDescriptors?0:y.parameterDescriptors.length,n=t+e,u=async()=>{const u=new d(n,128*Math.ceil(a.context.length/128),w.sampleRate),c=[],l=[];for(let t=0;t<_.numberOfInputs;t+=1)c.push(s(u,{channelCount:_.channelCount,channelCountMode:_.channelCountMode,channelInterpretation:_.channelInterpretation,gain:1})),l.push(i(u,{channelCount:_.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:_.channelCount}));const h=await Promise.all(Array.from(a.parameters.values()).map(async t=>{const e=o(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:t.value});return await p(u,t,e.offset),e})),g=r(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,t+e)});for(let t=0;t<_.numberOfInputs;t+=1){c[t].connect(l[t]);for(let e=0;e<_.channelCount;e+=1)l[t].connect(g,e,t*_.channelCount+e)}for(const[e,n]of h.entries())n.connect(g,0,t+e),n.start(0);return g.connect(u.destination),await Promise.all(c.map(t=>f(a,u,t))),m(u)};b=Ia(a,0===n?null:await u(),w,_,S,y,c)}const t=await b,e=n(w,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[u,l,h]=T;null!==t&&(e.buffer=t,e.start(0)),e.connect(u);for(let t=0,e=0;t<a.numberOfOutputs;t+=1){const n=l[t];for(let r=0;r<S[t];r+=1)u.connect(n,e+r,r);e+=S[t]}return h}if(k)for(const[e,n]of a.parameters.entries())await t(w,n,x.parameters.get(e));else for(const[t,e]of a.parameters.entries())await p(w,e,x.parameters.get(t));return await f(a,w,x),x})(w,x)}}})(dc,Il,pc,Sc,ou,Nc,uu,jl,Rl,_l,ga,Yu,zu,fc,qu,zc),Bl=(t=>e=>t.get(e))(yl),ql=(t=>(e,n)=>{t.set(e,n)})(Pl),Ul=gl?((t,e,n,r,i,o,s,a,u,c,l,h,d,p)=>class extends e{constructor(e,p,f){var m;const g=a(e),_=u(g),y=l({...Oa,...f});d(y);const v=Cs.get(g),b=null==v?void 0:v.get(p),w=_||"closed"!==g.state?g:null!==(m=s(g))&&void 0!==m?m:g,x=i(w,_?null:e.baseLatency,c,p,b,y);super(e,!0,x,_?r(p,y,b):null);const T=[];x.parameters.forEach((t,e)=>{const r=n(this,_,t);T.push([e,r])}),this._nativeAudioWorkletNode=x,this._onprocessorerror=null,this._parameters=new Ea(T),_&&t(g,this);const{activeInputs:k}=o(this);h(x,k)}get onprocessorerror(){return this._onprocessorerror}set onprocessorerror(t){const e="function"==typeof t?p(this,t):null;this._nativeAudioWorkletNode.onprocessorerror=e;const n=this._nativeAudioWorkletNode.onprocessorerror;this._onprocessorerror=null!==n&&n===e?t:n}get parameters(){return null===this._parameters?this._nativeAudioWorkletNode.parameters:this._parameters}get port(){return this._nativeAudioWorkletNode.port}})(Nl,tc,gc,$l,Fl,ta,Bl,Vu,Wu,Yu,t=>({...t,outputChannelCount:void 0!==t.outputChannelCount?t.outputChannelCount:1===t.numberOfInputs&&1===t.numberOfOutputs?[t.channelCount]:Array.from({length:t.numberOfOutputs},()=>1)}),ql,t=>{const{port1:e,port2:n}=new MessageChannel;try{e.postMessage(t)}finally{e.close(),n.close()}},Cu):void 0,Vl=(((t,e,n,r,i)=>{})(Va,pu,vu,Qc,Xu),((t,e)=>(n,r,i)=>{if(null===e)throw new Error("Missing the native OfflineAudioContext constructor.");try{return new e(n,r,i)}catch(e){if("SyntaxError"===e.name)throw t();throw e}})(pu,zu)),Gl=((t,e,n,r,i,o,s,a)=>(u,c)=>n(u).render(u,c).then(()=>Promise.all(Array.from(r(c)).map(t=>n(t).render(t,c)))).then(()=>i(c)).then(n=>("function"!=typeof n.copyFromChannel?(s(n),Hs(n)):e(o,()=>o(n))||a(n),t.add(n),n)))(rc,Pu,Bu,Ml,zc,Ws,ac,uc),zl=(((t,e,n,r,i)=>{})(Pu,Va,Vl,Qc,Gl),((t,e,n,r,i)=>class extends t{constructor(t,n,i){let o;if("number"==typeof t&&void 0!==n&&void 0!==i)o={length:n,numberOfChannels:t,sampleRate:i};else{if("object"!=typeof t)throw new Error("The given parameters are not valid.");o=t}const{length:s,numberOfChannels:a,sampleRate:u}={...fu,...o},c=r(a,s,u);e(Ha,()=>Ha(c))||c.addEventListener("statechange",(()=>{let t=0;const e=n=>{"running"===this._state&&(t>0?(c.removeEventListener("statechange",e),n.stopImmediatePropagation(),this._waitForThePromiseToSettle(n)):t+=1)};return e})()),super(c,a),this._length=s,this._nativeOfflineAudioContext=c,this._state=null}get length(){return void 0===this._nativeOfflineAudioContext.length?this._length:this._nativeOfflineAudioContext.length}get state(){return null===this._state?this._nativeOfflineAudioContext.state:this._state}startRendering(){return"running"===this._state?Promise.reject(n()):(this._state="running",i(this.destination,this._nativeOfflineAudioContext).finally(()=>{this._state=null,ra(this)}))}_waitForThePromiseToSettle(t){null===this._state?this._nativeOfflineAudioContext.dispatchEvent(t):setTimeout(()=>this._waitForThePromiseToSettle(t))}})(Tl,Pu,Va,Vl,Gl)),Wl=((t,e)=>n=>{const r=t.get(n);return e(r)||e(n)})(As,Ku),Jl=((t,e)=>n=>t.has(n)||e(n))(Ts,Qu),Hl=((t,e)=>n=>t.has(n)||e(n))(Ss,Zu),Xl=((t,e)=>n=>{const r=t.get(n);return e(r)||e(n)})(As,Wu);function Kl(t){return Hl(t)}function Ql(t){return Jl(t)}function Zl(t){return Xl(t)}function Yl(t){return Wl(t)}function th(t){return void 0===t}function eh(t){return void 0!==t}function nh(t){return"number"==typeof t}function rh(t){return"[object Object]"===Object.prototype.toString.call(t)&&t.constructor===Object}function ih(t){return Array.isArray(t)}function oh(t){return"string"==typeof t}function sh(t){return oh(t)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(t)}function ah(t,e){return"value"===t||Kl(e)||Ql(e)||function(t){return t instanceof cc}(e)}function uh(t,...e){if(!e.length)return t;const n=e.shift();if(rh(t)&&rh(n))for(const e in n)ah(e,n[e])?t[e]=n[e]:rh(n[e])?(t[e]||Object.assign(t,{[e]:{}}),uh(t[e],n[e])):Object.assign(t,{[e]:n[e]});return uh(t,...e)}function ch(t,e,n=[],r){const i={},o=Array.from(e);if(rh(o[0])&&r&&!Reflect.has(o[0],r)){Object.keys(o[0]).some(e=>Reflect.has(t,e))||(uh(i,{[r]:o[0]}),n.splice(n.indexOf(r),1),o.shift())}if(1===o.length&&rh(o[0]))uh(i,o[0]);else for(let t=0;t<n.length;t++)eh(o[t])&&(i[n[t]]=o[t]);return uh(t,i)}function lh(t,e){return th(t)?e:t}function hh(t,e){return e.forEach(e=>{Reflect.has(t,e)&&delete t[e]}),t}const dh="15.1.22";function ph(t,e){if(!t)throw new Error(e)}function fh(t,e,n=1/0){if(!(e<=t&&t<=n))throw new RangeError(`Value must be within [${e}, ${n}], got: ${t}`)}function mh(t){t.isOffline||"running"===t.state||bh('The AudioContext is "suspended". Invoke Tone.start() from a user action to start the audio.')}let gh=!1,_h=!1;function yh(t){gh=t}let vh=console;function bh(...t){vh.warn(...t)}const wh="object"==typeof self?self:null,xh=wh&&(wh.hasOwnProperty("AudioContext")||wh.hasOwnProperty("webkitAudioContext"));class Th{constructor(){this.debug=!1,this._wasDisposed=!1}static getDefaults(){return{}}log(...t){(this.debug||wh&&this.toString()===wh.TONE_DEBUG_CLASS)&&function(...t){vh.log(...t)}(this,...t)}dispose(){return this._wasDisposed=!0,this}get disposed(){return this._wasDisposed}toString(){return this.name}}Th.version=dh;const kh=1e-6;function Sh(t,e){return t>e+kh}function Ah(t,e){return Sh(t,e)||Oh(t,e)}function Eh(t,e){return t+kh<e}function Oh(t,e){return Math.abs(t-e)<kh}class Ch extends Th{constructor(){super(),this.name="Timeline",this._timeline=[];const t=ch(Ch.getDefaults(),arguments,["memory"]);this.memory=t.memory,this.increasing=t.increasing}static getDefaults(){return{memory:1/0,increasing:!1}}get length(){return this._timeline.length}add(t){if(ph(Reflect.has(t,"time"),"Timeline: events must have a time attribute"),t.time=t.time.valueOf(),this.increasing&&this.length){const e=this._timeline[this.length-1];ph(Ah(t.time,e.time),"The time must be greater than or equal to the last scheduled time"),this._timeline.push(t)}else{const e=this._search(t.time);this._timeline.splice(e+1,0,t)}if(this.length>this.memory){const t=this.length-this.memory;this._timeline.splice(0,t)}return this}remove(t){const e=this._timeline.indexOf(t);return-1!==e&&this._timeline.splice(e,1),this}get(t,e="time"){const n=this._search(t,e);return-1!==n?this._timeline[n]:null}peek(){return this._timeline[0]}shift(){return this._timeline.shift()}getAfter(t,e="time"){const n=this._search(t,e);return n+1<this._timeline.length?this._timeline[n+1]:null}getBefore(t){const e=this._timeline.length;if(e>0&&this._timeline[e-1].time<t)return this._timeline[e-1];const n=this._search(t);return n-1>=0?this._timeline[n-1]:null}cancel(t){if(this._timeline.length>1){let e=this._search(t);if(e>=0)if(Oh(this._timeline[e].time,t)){for(let n=e;n>=0&&Oh(this._timeline[n].time,t);n--)e=n;this._timeline=this._timeline.slice(0,e)}else this._timeline=this._timeline.slice(0,e+1);else this._timeline=[]}else 1===this._timeline.length&&Ah(this._timeline[0].time,t)&&(this._timeline=[]);return this}cancelBefore(t){const e=this._search(t);return e>=0&&(this._timeline=this._timeline.slice(e+1)),this}previousEvent(t){const e=this._timeline.indexOf(t);return e>0?this._timeline[e-1]:null}_search(t,e="time"){if(0===this._timeline.length)return-1;let n=0;const r=this._timeline.length;let i=r;if(r>0&&this._timeline[r-1][e]<=t)return r-1;for(;n<i;){let r=Math.floor(n+(i-n)/2);const o=this._timeline[r],s=this._timeline[r+1];if(Oh(o[e],t)){for(let n=r;n<this._timeline.length;n++){if(!Oh(this._timeline[n][e],t))break;r=n}return r}if(Eh(o[e],t)&&Sh(s[e],t))return r;Sh(o[e],t)?i=r:n=r+1}return-1}_iterate(t,e=0,n=this._timeline.length-1){this._timeline.slice(e,n+1).forEach(t)}forEach(t){return this._iterate(t),this}forEachBefore(t,e){const n=this._search(t);return-1!==n&&this._iterate(e,0,n),this}forEachAfter(t,e){const n=this._search(t);return this._iterate(e,n+1),this}forEachBetween(t,e,n){let r=this._search(t),i=this._search(e);return-1!==r&&-1!==i?(this._timeline[r].time!==t&&(r+=1),this._timeline[i].time===e&&(i-=1),this._iterate(n,r,i)):-1===r&&this._iterate(n,0,i),this}forEachFrom(t,e){let n=this._search(t);for(;n>=0&&this._timeline[n].time>=t;)n--;return this._iterate(e,n+1),this}forEachAtTime(t,e){const n=this._search(t);if(-1!==n&&Oh(this._timeline[n].time,t)){let r=n;for(let e=n;e>=0&&Oh(this._timeline[e].time,t);e--)r=e;this._iterate(t=>{e(t)},r,n)}return this}dispose(){return super.dispose(),this._timeline=[],this}}class Mh{constructor(t,e,n,r){this._callback=t,this._type=e,this._minimumUpdateInterval=Math.max(128/(r||44100),.001),this.updateInterval=n,this._createClock()}_createWorker(){const t=new Blob([`\n\t\t\t// the initial timeout time\n\t\t\tlet timeoutTime = ${(1e3*this._updateInterval).toFixed(1)};\n\t\t\t// onmessage callback\n\t\t\tself.onmessage = function(msg){\n\t\t\t\ttimeoutTime = parseInt(msg.data);\n\t\t\t};\n\t\t\t// the tick function which posts a message\n\t\t\t// and schedules a new tick\n\t\t\tfunction tick(){\n\t\t\t\tsetTimeout(tick, timeoutTime);\n\t\t\t\tself.postMessage('tick');\n\t\t\t}\n\t\t\t// call tick initially\n\t\t\ttick();\n\t\t\t`],{type:"text/javascript"}),e=URL.createObjectURL(t),n=new Worker(e);n.onmessage=this._callback.bind(this),this._worker=n}_createTimeout(){this._timeout=setTimeout(()=>{this._createTimeout(),this._callback()},1e3*this._updateInterval)}_createClock(){if("worker"===this._type)try{this._createWorker()}catch(t){this._type="timeout",this._createClock()}else"timeout"===this._type&&this._createTimeout()}_disposeClock(){this._timeout&&clearTimeout(this._timeout),this._worker&&(this._worker.terminate(),this._worker.onmessage=null)}get updateInterval(){return this._updateInterval}set updateInterval(t){var e;this._updateInterval=Math.max(t,this._minimumUpdateInterval),"worker"===this._type&&(null===(e=this._worker)||void 0===e||e.postMessage(1e3*this._updateInterval))}get type(){return this._type}set type(t){this._disposeClock(),this._type=t,this._createClock()}dispose(){this._disposeClock()}}const Nh=[];function Ih(t){Nh.push(t)}const jh=[];function Rh(t){jh.push(t)}class Ph extends Th{constructor(){super(...arguments),this.name="Emitter"}on(t,e){return t.split(/\W+/).forEach(t=>{th(this._events)&&(this._events={}),this._events.hasOwnProperty(t)||(this._events[t]=[]),this._events[t].push(e)}),this}once(t,e){const n=(...r)=>{e(...r),this.off(t,n)};return this.on(t,n),this}off(t,e){return t.split(/\W+/).forEach(t=>{if(th(this._events)&&(this._events={}),this._events.hasOwnProperty(t))if(th(e))this._events[t]=[];else{const n=this._events[t];for(let t=n.length-1;t>=0;t--)n[t]===e&&n.splice(t,1)}}),this}emit(t,...e){if(this._events&&this._events.hasOwnProperty(t)){const n=this._events[t].slice(0);for(let t=0,r=n.length;t<r;t++)n[t].apply(this,e)}return this}static mixin(t){["on","once","off","emit"].forEach(e=>{const n=Object.getOwnPropertyDescriptor(Ph.prototype,e);Object.defineProperty(t.prototype,e,n)})}dispose(){return super.dispose(),this._events=void 0,this}}class Dh extends Ph{constructor(){super(...arguments),this.isOffline=!1}toJSON(){return{}}}class Lh extends Dh{constructor(){var t,e;super(),this.name="Context",this._constants=new Map,this._timeouts=new Ch,this._timeoutIds=0,this._initialized=!1,this._closeStarted=!1,this.isOffline=!1,this._workletPromise=null;const n=ch(Lh.getDefaults(),arguments,["context"]);n.context?(this._context=n.context,this._latencyHint=(null===(t=arguments[0])||void 0===t?void 0:t.latencyHint)||""):(this._context=function(t){return new Cl(t)}({latencyHint:n.latencyHint}),this._latencyHint=n.latencyHint),this._ticker=new Mh(this.emit.bind(this,"tick"),n.clockSource,n.updateInterval,this._context.sampleRate),this.on("tick",this._timeoutLoop.bind(this)),this._context.onstatechange=()=>{this.emit("statechange",this.state)},this[(null===(e=arguments[0])||void 0===e?void 0:e.hasOwnProperty("updateInterval"))?"_lookAhead":"lookAhead"]=n.lookAhead}static getDefaults(){return{clockSource:"worker",latencyHint:"interactive",lookAhead:.1,updateInterval:.05}}initialize(){var t;return this._initialized||(t=this,Nh.forEach(e=>e(t)),this._initialized=!0),this}createAnalyser(){return this._context.createAnalyser()}createOscillator(){return this._context.createOscillator()}createBufferSource(){return this._context.createBufferSource()}createBiquadFilter(){return this._context.createBiquadFilter()}createBuffer(t,e,n){return this._context.createBuffer(t,e,n)}createChannelMerger(t){return this._context.createChannelMerger(t)}createChannelSplitter(t){return this._context.createChannelSplitter(t)}createConstantSource(){return this._context.createConstantSource()}createConvolver(){return this._context.createConvolver()}createDelay(t){return this._context.createDelay(t)}createDynamicsCompressor(){return this._context.createDynamicsCompressor()}createGain(){return this._context.createGain()}createIIRFilter(t,e){return this._context.createIIRFilter(t,e)}createPanner(){return this._context.createPanner()}createPeriodicWave(t,e,n){return this._context.createPeriodicWave(t,e,n)}createStereoPanner(){return this._context.createStereoPanner()}createWaveShaper(){return this._context.createWaveShaper()}createMediaStreamSource(t){ph(Yl(this._context),"Not available if OfflineAudioContext");return this._context.createMediaStreamSource(t)}createMediaElementSource(t){ph(Yl(this._context),"Not available if OfflineAudioContext");return this._context.createMediaElementSource(t)}createMediaStreamDestination(){ph(Yl(this._context),"Not available if OfflineAudioContext");return this._context.createMediaStreamDestination()}decodeAudioData(t){return this._context.decodeAudioData(t)}get currentTime(){return this._context.currentTime}get state(){return this._context.state}get sampleRate(){return this._context.sampleRate}get listener(){return this.initialize(),this._listener}set listener(t){ph(!this._initialized,"The listener cannot be set after initialization."),this._listener=t}get transport(){return this.initialize(),this._transport}set transport(t){ph(!this._initialized,"The transport cannot be set after initialization."),this._transport=t}get draw(){return this.initialize(),this._draw}set draw(t){ph(!this._initialized,"Draw cannot be set after initialization."),this._draw=t}get destination(){return this.initialize(),this._destination}set destination(t){ph(!this._initialized,"The destination cannot be set after initialization."),this._destination=t}createAudioWorkletNode(t,e){return function(t,e,n){return ph(eh(Ul),"AudioWorkletNode only works in a secure context (https or localhost)"),new(t instanceof(null==wh?void 0:wh.BaseAudioContext)?null==wh?void 0:wh.AudioWorkletNode:Ul)(t,e,n)}(this.rawContext,t,e)}addAudioWorkletModule(t){return a(this,void 0,void 0,function*(){ph(eh(this.rawContext.audioWorklet),"AudioWorkletNode is only available in a secure context (https or localhost)"),this._workletPromise||(this._workletPromise=this.rawContext.audioWorklet.addModule(t)),yield this._workletPromise})}workletsAreReady(){return a(this,void 0,void 0,function*(){(yield this._workletPromise)?this._workletPromise:Promise.resolve()})}get updateInterval(){return this._ticker.updateInterval}set updateInterval(t){this._ticker.updateInterval=t}get clockSource(){return this._ticker.type}set clockSource(t){this._ticker.type=t}get lookAhead(){return this._lookAhead}set lookAhead(t){this._lookAhead=t,this.updateInterval=t?t/2:.01}get latencyHint(){return this._latencyHint}get rawContext(){return this._context}now(){return this._context.currentTime+this._lookAhead}immediate(){return this._context.currentTime}resume(){return Yl(this._context)?this._context.resume():Promise.resolve()}close(){return a(this,void 0,void 0,function*(){var t;Yl(this._context)&&"closed"!==this.state&&!this._closeStarted&&(this._closeStarted=!0,yield this._context.close()),this._initialized&&(t=this,jh.forEach(e=>e(t)))})}getConstant(t){if(this._constants.has(t))return this._constants.get(t);{const e=this._context.createBuffer(1,128,this._context.sampleRate),n=e.getChannelData(0);for(let e=0;e<n.length;e++)n[e]=t;const r=this._context.createBufferSource();return r.channelCount=1,r.channelCountMode="explicit",r.buffer=e,r.loop=!0,r.start(0),this._constants.set(t,r),r}}dispose(){return super.dispose(),this._ticker.dispose(),this._timeouts.dispose(),Object.keys(this._constants).map(t=>this._constants[t].disconnect()),this.close(),this}_timeoutLoop(){const t=this.now();this._timeouts.forEachBefore(t,t=>{t.callback(),this._timeouts.remove(t)})}setTimeout(t,e){this._timeoutIds++;const n=this.now();return this._timeouts.add({callback:t,id:this._timeoutIds,time:n+e}),this._timeoutIds}clearTimeout(t){return this._timeouts.forEach(e=>{e.id===t&&this._timeouts.remove(e)}),this}clearInterval(t){return this.clearTimeout(t)}setInterval(t,e){const n=++this._timeoutIds,r=()=>{const i=this.now();this._timeouts.add({callback:()=>{t(),r()},id:n,time:i+e})};return r(),n}}function Fh(t,e){ih(e)?e.forEach(e=>Fh(t,e)):Object.defineProperty(t,e,{enumerable:!0,writable:!1})}function $h(t,e){ih(e)?e.forEach(e=>$h(t,e)):Object.defineProperty(t,e,{writable:!0})}const Bh=()=>{};class qh extends Th{constructor(){super(),this.name="ToneAudioBuffer",this.onload=Bh;const t=ch(qh.getDefaults(),arguments,["url","onload","onerror"]);this.reverse=t.reverse,this.onload=t.onload,oh(t.url)?this.load(t.url).catch(t.onerror):t.url&&this.set(t.url)}static getDefaults(){return{onerror:Bh,onload:Bh,reverse:!1}}get sampleRate(){return this._buffer?this._buffer.sampleRate:zh().sampleRate}set(t){return t instanceof qh?t.loaded?this._buffer=t.get():t.onload=()=>{this.set(t),this.onload(this)}:this._buffer=t,this._reversed&&this._reverse(),this}get(){return this._buffer}load(t){return a(this,void 0,void 0,function*(){const e=qh.load(t).then(t=>{this.set(t),this.onload(this)});qh.downloads.push(e);try{yield e}finally{const t=qh.downloads.indexOf(e);qh.downloads.splice(t,1)}return this})}dispose(){return super.dispose(),this._buffer=void 0,this}fromArray(t){const e=ih(t)&&t[0].length>0,n=e?t.length:1,r=e?t[0].length:t.length,i=zh(),o=i.createBuffer(n,r,i.sampleRate),s=e||1!==n?t:[t];for(let t=0;t<n;t++)o.copyToChannel(s[t],t);return this._buffer=o,this}toMono(t){if(nh(t))this.fromArray(this.toArray(t));else{let t=new Float32Array(this.length);const e=this.numberOfChannels;for(let n=0;n<e;n++){const e=this.toArray(n);for(let n=0;n<e.length;n++)t[n]+=e[n]}t=t.map(t=>t/e),this.fromArray(t)}return this}toArray(t){if(nh(t))return this.getChannelData(t);if(1===this.numberOfChannels)return this.toArray(0);{const t=[];for(let e=0;e<this.numberOfChannels;e++)t[e]=this.getChannelData(e);return t}}getChannelData(t){return this._buffer?this._buffer.getChannelData(t):new Float32Array(0)}slice(t,e=this.duration){ph(this.loaded,"Buffer is not loaded");const n=Math.floor(t*this.sampleRate),r=Math.floor(e*this.sampleRate);ph(n<r,"The start time must be less than the end time");const i=r-n,o=zh().createBuffer(this.numberOfChannels,i,this.sampleRate);for(let t=0;t<this.numberOfChannels;t++)o.copyToChannel(this.getChannelData(t).subarray(n,r),t);return new qh(o)}_reverse(){if(this.loaded)for(let t=0;t<this.numberOfChannels;t++)this.getChannelData(t).reverse();return this}get loaded(){return this.length>0}get duration(){return this._buffer?this._buffer.duration:0}get length(){return this._buffer?this._buffer.length:0}get numberOfChannels(){return this._buffer?this._buffer.numberOfChannels:0}get reverse(){return this._reversed}set reverse(t){this._reversed!==t&&(this._reversed=t,this._reverse())}static fromArray(t){return(new qh).fromArray(t)}static fromUrl(t){return a(this,void 0,void 0,function*(){const e=new qh;return yield e.load(t)})}static load(t){return a(this,void 0,void 0,function*(){const e=""===qh.baseUrl||qh.baseUrl.endsWith("/")?qh.baseUrl:qh.baseUrl+"/",n=yield fetch(e+t);if(!n.ok)throw new Error(`could not load url: ${t}`);const r=yield n.arrayBuffer();return yield zh().decodeAudioData(r)})}static supportsType(t){const e=t.split("."),n=e[e.length-1];return""!==document.createElement("audio").canPlayType("audio/"+n)}static loaded(){return a(this,void 0,void 0,function*(){for(yield Promise.resolve();qh.downloads.length;)yield qh.downloads[0]})}}qh.baseUrl="",qh.downloads=[];class Uh extends Lh{constructor(){var t,e,n;super({clockSource:"offline",context:Zl(arguments[0])?arguments[0]:(t=arguments[0],e=arguments[1]*arguments[2],n=arguments[2],new zl(t,e,n)),lookAhead:0,updateInterval:Zl(arguments[0])?128/arguments[0].sampleRate:128/arguments[2]}),this.name="OfflineContext",this._currentTime=0,this.isOffline=!0,this._duration=Zl(arguments[0])?arguments[0].length/arguments[0].sampleRate:arguments[1]}now(){return this._currentTime}get currentTime(){return this._currentTime}_renderClock(t){return a(this,void 0,void 0,function*(){let e=0;for(;this._duration-this._currentTime>=0;){this.emit("tick"),this._currentTime+=128/this.sampleRate,e++;const n=Math.floor(this.sampleRate/128);t&&e%n===0&&(yield new Promise(t=>setTimeout(t,1)))}})}render(){return a(this,arguments,void 0,function*(t=!0){yield this.workletsAreReady(),yield this._renderClock(t);const e=yield this._context.startRendering();return new qh(e)})}close(){return Promise.resolve()}}const Vh=new class extends Dh{constructor(){super(...arguments),this.lookAhead=0,this.latencyHint=0,this.isOffline=!1}createAnalyser(){return{}}createOscillator(){return{}}createBufferSource(){return{}}createBiquadFilter(){return{}}createBuffer(t,e,n){return{}}createChannelMerger(t){return{}}createChannelSplitter(t){return{}}createConstantSource(){return{}}createConvolver(){return{}}createDelay(t){return{}}createDynamicsCompressor(){return{}}createGain(){return{}}createIIRFilter(t,e){return{}}createPanner(){return{}}createPeriodicWave(t,e,n){return{}}createStereoPanner(){return{}}createWaveShaper(){return{}}createMediaStreamSource(t){return{}}createMediaElementSource(t){return{}}createMediaStreamDestination(){return{}}decodeAudioData(t){return Promise.resolve({})}createAudioWorkletNode(t,e){return{}}get rawContext(){return{}}addAudioWorkletModule(t){return a(this,void 0,void 0,function*(){return Promise.resolve()})}resume(){return Promise.resolve()}setTimeout(t,e){return 0}clearTimeout(t){return this}setInterval(t,e){return 0}clearInterval(t){return this}getConstant(t){return{}}get currentTime(){return 0}get state(){return{}}get sampleRate(){return 0}get listener(){return{}}get transport(){return{}}get draw(){return{}}set draw(t){}get destination(){return{}}set destination(t){}now(){return 0}immediate(){return 0}};let Gh=Vh;function zh(){return Gh===Vh&&xh&&function(t,e=!1){e&&Gh.dispose();Gh=Yl(t)?new Lh(t):Zl(t)?new Uh(t):t}(new Lh),Gh}if(wh&&!wh.TONE_SILENCE_LOGGING){0}class Wh extends Th{constructor(t,e,n){super(),this.defaultUnits="s",this._val=e,this._units=n,this.context=t,this._expressions=this._getExpressions()}_getExpressions(){return{hz:{method:t=>this._frequencyToUnits(parseFloat(t)),regexp:/^(\d+(?:\.\d+)?)hz$/i},i:{method:t=>this._ticksToUnits(parseInt(t,10)),regexp:/^(\d+)i$/i},m:{method:t=>this._beatsToUnits(parseInt(t,10)*this._getTimeSignature()),regexp:/^(\d+)m$/i},n:{method:(t,e)=>{const n=parseInt(t,10),r="."===e?1.5:1;return 1===n?this._beatsToUnits(this._getTimeSignature())*r:this._beatsToUnits(4/n)*r},regexp:/^(\d+)n(\.?)$/i},number:{method:t=>this._expressions[this.defaultUnits].method.call(this,t),regexp:/^(\d+(?:\.\d+)?)$/},s:{method:t=>this._secondsToUnits(parseFloat(t)),regexp:/^(\d+(?:\.\d+)?)s$/},samples:{method:t=>parseInt(t,10)/this.context.sampleRate,regexp:/^(\d+)samples$/},t:{method:t=>{const e=parseInt(t,10);return this._beatsToUnits(8/(3*Math.floor(e)))},regexp:/^(\d+)t$/i},tr:{method:(t,e,n)=>{let r=0;return t&&"0"!==t&&(r+=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(r+=this._beatsToUnits(parseFloat(e))),n&&"0"!==n&&(r+=this._beatsToUnits(parseFloat(n)/4)),r},regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/}}}valueOf(){if(this._val instanceof Wh&&this.fromType(this._val),th(this._val))return this._noArg();if(oh(this._val)&&th(this._units)){for(const t in this._expressions)if(this._expressions[t].regexp.test(this._val.trim())){this._units=t;break}}else if(rh(this._val)){let t=0;for(const e in this._val)if(eh(this._val[e])){const n=this._val[e];t+=new this.constructor(this.context,e).valueOf()*n}return t}if(eh(this._units)){const t=this._expressions[this._units],e=this._val.toString().trim().match(t.regexp);return e?t.method.apply(this,e.slice(1)):t.method.call(this,this._val)}return oh(this._val)?parseFloat(this._val):this._val}_frequencyToUnits(t){return 1/t}_beatsToUnits(t){return 60/this._getBpm()*t}_secondsToUnits(t){return t}_ticksToUnits(t){return t*this._beatsToUnits(1)/this._getPPQ()}_noArg(){return this._now()}_getBpm(){return this.context.transport.bpm.value}_getTimeSignature(){return this.context.transport.timeSignature}_getPPQ(){return this.context.transport.PPQ}fromType(t){switch(this._units=void 0,this.defaultUnits){case"s":this._val=t.toSeconds();break;case"i":this._val=t.toTicks();break;case"hz":this._val=t.toFrequency();break;case"midi":this._val=t.toMidi()}return this}toFrequency(){return 1/this.toSeconds()}toSamples(){return this.toSeconds()*this.context.sampleRate}toMilliseconds(){return 1e3*this.toSeconds()}}class Jh extends Wh{constructor(){super(...arguments),this.name="TimeClass"}_getExpressions(){return Object.assign(super._getExpressions(),{now:{method:t=>this._now()+new this.constructor(this.context,t).valueOf(),regexp:/^\+(.+)/},quantize:{method:t=>{const e=new Jh(this.context,t).valueOf();return this._secondsToUnits(this.context.transport.nextSubdivision(e))},regexp:/^@(.+)/}})}quantize(t,e=1){const n=new this.constructor(this.context,t).valueOf(),r=this.valueOf();return r+(Math.round(r/n)*n-r)*e}toNotation(){const t=this.toSeconds(),e=["1m"];for(let t=1;t<9;t++){const n=Math.pow(2,t);e.push(n+"n."),e.push(n+"n"),e.push(n+"t")}e.push("0");let n=e[0],r=new Jh(this.context,e[0]).toSeconds();return e.forEach(e=>{const i=new Jh(this.context,e).toSeconds();Math.abs(i-t)<Math.abs(r-t)&&(n=e,r=i)}),n}toBarsBeatsSixteenths(){const t=this._beatsToUnits(1);let e=this.valueOf()/t;e=parseFloat(e.toFixed(4));const n=Math.floor(e/this._getTimeSignature());let r=e%1*4;e=Math.floor(e)%this._getTimeSignature();const i=r.toString();i.length>3&&(r=parseFloat(parseFloat(i).toFixed(3)));return[n,e,r].join(":")}toTicks(){const t=this._beatsToUnits(1);return this.valueOf()/t*this._getPPQ()}toSeconds(){return this.valueOf()}toMidi(){return _s(this.toFrequency())}_now(){return this.context.now()}}class Hh extends Jh{constructor(){super(...arguments),this.name="Frequency",this.defaultUnits="hz"}static get A4(){return gs}static set A4(t){!function(t){gs=t}(t)}_getExpressions(){return Object.assign({},super._getExpressions(),{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method(t){return"midi"===this.defaultUnits?t:Hh.mtof(t)}},note:{regexp:/^([a-g]{1}(?:b|#|##|x|bb|###|#x|x#|bbb)?)(-?[0-9]+)/i,method(t,e){const n=Xh[t.toLowerCase()]+12*(parseInt(e,10)+1);return"midi"===this.defaultUnits?n:Hh.mtof(n)}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method(t,e,n){let r=1;return t&&"0"!==t&&(r*=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(r*=this._beatsToUnits(parseFloat(e))),n&&"0"!==n&&(r*=this._beatsToUnits(parseFloat(n)/4)),r}}})}transpose(t){return new Hh(this.context,this.valueOf()*ms(t))}harmonize(t){return t.map(t=>this.transpose(t))}toMidi(){return _s(this.valueOf())}toNote(){const t=this.toFrequency(),e=Math.log2(t/Hh.A4);let n=Math.round(12*e)+57;const r=Math.floor(n/12);r<0&&(n+=-12*r);return Kh[n%12]+r.toString()}toSeconds(){return 1/super.toSeconds()}toTicks(){const t=this._beatsToUnits(1),e=this.valueOf()/t;return Math.floor(e*this._getPPQ())}_noArg(){return 0}_frequencyToUnits(t){return t}_ticksToUnits(t){return 1/(60*t/(this._getBpm()*this._getPPQ()))}_beatsToUnits(t){return 1/super._beatsToUnits(t)}_secondsToUnits(t){return 1/t}static mtof(t){return vs(t)}static ftom(t){return _s(t)}}const Xh={cbbb:-3,cbb:-2,cb:-1,c:0,"c#":1,cx:2,"c##":2,"c###":3,"cx#":3,"c#x":3,dbbb:-1,dbb:0,db:1,d:2,"d#":3,dx:4,"d##":4,"d###":5,"dx#":5,"d#x":5,ebbb:1,ebb:2,eb:3,e:4,"e#":5,ex:6,"e##":6,"e###":7,"ex#":7,"e#x":7,fbbb:2,fbb:3,fb:4,f:5,"f#":6,fx:7,"f##":7,"f###":8,"fx#":8,"f#x":8,gbbb:4,gbb:5,gb:6,g:7,"g#":8,gx:9,"g##":9,"g###":10,"gx#":10,"g#x":10,abbb:6,abb:7,ab:8,a:9,"a#":10,ax:11,"a##":11,"a###":12,"ax#":12,"a#x":12,bbbb:8,bbb:9,bb:10,b:11,"b#":12,bx:13,"b##":13,"b###":14,"bx#":14,"b#x":14},Kh=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];class Qh extends Jh{constructor(){super(...arguments),this.name="TransportTime"}_now(){return this.context.transport.seconds}}class Zh extends Th{constructor(){super();const t=ch(Zh.getDefaults(),arguments,["context"]);this.defaultContext?this.context=this.defaultContext:this.context=t.context}static getDefaults(){return{context:zh()}}now(){return this.context.currentTime+this.context.lookAhead}immediate(){return this.context.currentTime}get sampleTime(){return 1/this.context.sampleRate}get blockTime(){return 128/this.context.sampleRate}toSeconds(t){return function(t){th(t)&&gh&&!_h&&(_h=!0,bh("Events scheduled inside of scheduled callbacks should use the passed in scheduling time. See https://github.com/Tonejs/Tone.js/wiki/Accurate-Timing"))}(t),new Jh(this.context,t).toSeconds()}toFrequency(t){return new Hh(this.context,t).toFrequency()}toTicks(t){return new Qh(this.context,t).toTicks()}_getPartialProperties(t){const e=this.get();return Object.keys(e).forEach(n=>{th(t[n])&&delete e[n]}),e}get(){const t=this.constructor.getDefaults();return Object.keys(t).forEach(e=>{if(Reflect.has(this,e)){const n=this[e];eh(n)&&eh(n.value)&&eh(n.setValueAtTime)?t[e]=n.value:n instanceof Zh?t[e]=n._getPartialProperties(t[e]):ih(n)||nh(n)||oh(n)||"boolean"==typeof n?t[e]=n:delete t[e]}}),t}set(t){return Object.keys(t).forEach(e=>{Reflect.has(this,e)&&eh(this[e])&&(this[e]&&eh(this[e].value)&&eh(this[e].setValueAtTime)?this[e].value!==t[e]&&(this[e].value=t[e]):this[e]instanceof Zh?this[e].set(t[e]):this[e]=t[e])}),this}}class Yh extends Zh{constructor(){const t=ch(Yh.getDefaults(),arguments,["param","units","convert"]);for(super(t),this.name="Param",this.overridden=!1,this._minOutput=1e-7,ph(eh(t.param)&&(Kl(t.param)||t.param instanceof Yh),"param must be an AudioParam");!Kl(t.param);)t.param=t.param._param;this._swappable=!!eh(t.swappable)&&t.swappable,this._swappable?(this.input=this.context.createGain(),this._param=t.param,this.input.connect(this._param)):this._param=this.input=t.param,this._events=new Ch(1e3),this._initialValue=this._param.defaultValue,this.units=t.units,this.convert=t.convert,this._minValue=t.minValue,this._maxValue=t.maxValue,eh(t.value)&&t.value!==this._toType(this._initialValue)&&this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(Zh.getDefaults(),{convert:!0,units:"number"})}get value(){const t=this.now();return this.getValueAtTime(t)}set value(t){this.cancelScheduledValues(this.now()),this.setValueAtTime(t,this.now())}get minValue(){return eh(this._minValue)?this._minValue:"time"===this.units||"frequency"===this.units||"normalRange"===this.units||"positive"===this.units||"transportTime"===this.units||"ticks"===this.units||"bpm"===this.units||"hertz"===this.units||"samples"===this.units?0:"audioRange"===this.units?-1:"decibels"===this.units?-1/0:this._param.minValue}get maxValue(){return eh(this._maxValue)?this._maxValue:"normalRange"===this.units||"audioRange"===this.units?1:this._param.maxValue}_is(t,e){return this.units===e}_assertRange(t){return eh(this.maxValue)&&eh(this.minValue)&&fh(t,this._fromType(this.minValue),this._fromType(this.maxValue)),t}_fromType(t){return this.convert&&!this.overridden?this._is(t,"time")?this.toSeconds(t):this._is(t,"decibels")?(e=t,Math.pow(10,e/20)):this._is(t,"frequency")?this.toFrequency(t):t:this.overridden?0:t;var e}_toType(t){return this.convert&&"decibels"===this.units?(e=t,Math.log(e)/Math.LN10*20):t;var e}setValueAtTime(t,e){const n=this.toSeconds(e),r=this._fromType(t);return ph(isFinite(r)&&isFinite(n),`Invalid argument(s) to setValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(r),this.log(this.units,"setValueAtTime",t,n),this._events.add({time:n,type:"setValueAtTime",value:r}),this._param.setValueAtTime(r,n),this}getValueAtTime(t){const e=Math.max(this.toSeconds(t),0),n=this._events.getAfter(e),r=this._events.get(e);let i=this._initialValue;if(null===r)i=this._initialValue;else if("setTargetAtTime"!==r.type||null!==n&&"setValueAtTime"!==n.type)if(null===n)i=r.value;else if("linearRampToValueAtTime"===n.type||"exponentialRampToValueAtTime"===n.type){let t=r.value;if("setTargetAtTime"===r.type){const e=this._events.getBefore(r.time);t=null===e?this._initialValue:e.value}i="linearRampToValueAtTime"===n.type?this._linearInterpolate(r.time,t,n.time,n.value,e):this._exponentialInterpolate(r.time,t,n.time,n.value,e)}else i=r.value;else{const t=this._events.getBefore(r.time);let n;n=null===t?this._initialValue:t.value,"setTargetAtTime"===r.type&&(i=this._exponentialApproach(r.time,n,r.value,r.constant,e))}return this._toType(i)}setRampPoint(t){t=this.toSeconds(t);let e=this.getValueAtTime(t);return this.cancelAndHoldAtTime(t),0===this._fromType(e)&&(e=this._toType(this._minOutput)),this.setValueAtTime(e,t),this}linearRampToValueAtTime(t,e){const n=this._fromType(t),r=this.toSeconds(e);return ph(isFinite(n)&&isFinite(r),`Invalid argument(s) to linearRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(n),this._events.add({time:r,type:"linearRampToValueAtTime",value:n}),this.log(this.units,"linearRampToValueAtTime",t,r),this._param.linearRampToValueAtTime(n,r),this}exponentialRampToValueAtTime(t,e){let n=this._fromType(t);n=Oh(n,0)?this._minOutput:n,this._assertRange(n);const r=this.toSeconds(e);return ph(isFinite(n)&&isFinite(r),`Invalid argument(s) to exponentialRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({time:r,type:"exponentialRampToValueAtTime",value:n}),this.log(this.units,"exponentialRampToValueAtTime",t,r),this._param.exponentialRampToValueAtTime(n,r),this}exponentialRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialRampToValueAtTime(t,n+this.toSeconds(e)),this}linearRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.linearRampToValueAtTime(t,n+this.toSeconds(e)),this}targetRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialApproachValueAtTime(t,n,e),this}exponentialApproachValueAtTime(t,e,n){e=this.toSeconds(e),n=this.toSeconds(n);const r=Math.log(n+1)/Math.log(200);return this.setTargetAtTime(t,e,r),this.cancelAndHoldAtTime(e+.9*n),this.linearRampToValueAtTime(t,e+n),this}setTargetAtTime(t,e,n){const r=this._fromType(t);ph(isFinite(n)&&n>0,"timeConstant must be a number greater than 0");const i=this.toSeconds(e);return this._assertRange(r),ph(isFinite(r)&&isFinite(i),`Invalid argument(s) to setTargetAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({constant:n,time:i,type:"setTargetAtTime",value:r}),this.log(this.units,"setTargetAtTime",t,i,n),this._param.setTargetAtTime(r,i,n),this}setValueCurveAtTime(t,e,n,r=1){n=this.toSeconds(n),e=this.toSeconds(e);const i=this._fromType(t[0])*r;this.setValueAtTime(this._toType(i),e);const o=n/(t.length-1);for(let n=1;n<t.length;n++){const i=this._fromType(t[n])*r;this.linearRampToValueAtTime(this._toType(i),e+n*o)}return this}cancelScheduledValues(t){const e=this.toSeconds(t);return ph(isFinite(e),`Invalid argument to cancelScheduledValues: ${JSON.stringify(t)}`),this._events.cancel(e),this._param.cancelScheduledValues(e),this.log(this.units,"cancelScheduledValues",e),this}cancelAndHoldAtTime(t){const e=this.toSeconds(t),n=this._fromType(this.getValueAtTime(e));ph(isFinite(e),`Invalid argument to cancelAndHoldAtTime: ${JSON.stringify(t)}`),this.log(this.units,"cancelAndHoldAtTime",e,"value="+n);const r=this._events.get(e),i=this._events.getAfter(e);return r&&Oh(r.time,e)?i?(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time)):(this._param.cancelAndHoldAtTime(e),this._events.cancel(e+this.sampleTime)):i&&(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time),"linearRampToValueAtTime"===i.type?this.linearRampToValueAtTime(this._toType(n),e):"exponentialRampToValueAtTime"===i.type&&this.exponentialRampToValueAtTime(this._toType(n),e)),this._events.add({time:e,type:"setValueAtTime",value:n}),this._param.setValueAtTime(n,e),this}rampTo(t,e=.1,n){return"frequency"===this.units||"bpm"===this.units||"decibels"===this.units?this.exponentialRampTo(t,e,n):this.linearRampTo(t,e,n),this}apply(t){const e=this.context.currentTime;t.setValueAtTime(this.getValueAtTime(e),e);const n=this._events.get(e);if(n&&"setTargetAtTime"===n.type){const r=this._events.getAfter(n.time),i=r?r.time:e+2,o=(i-e)/10;for(let n=e;n<i;n+=o)t.linearRampToValueAtTime(this.getValueAtTime(n),n)}return this._events.forEachAfter(this.context.currentTime,e=>{"cancelScheduledValues"===e.type?t.cancelScheduledValues(e.time):"setTargetAtTime"===e.type?t.setTargetAtTime(e.value,e.time,e.constant):t[e.type](e.value,e.time)}),this}setParam(t){ph(this._swappable,"The Param must be assigned as 'swappable' in the constructor");const e=this.input;return e.disconnect(this._param),this.apply(t),this._param=t,e.connect(this._param),this}dispose(){return super.dispose(),this._events.dispose(),this}get defaultValue(){return this._toType(this._param.defaultValue)}_exponentialApproach(t,e,n,r,i){return n+(e-n)*Math.exp(-(i-t)/r)}_linearInterpolate(t,e,n,r,i){return e+(i-t)/(n-t)*(r-e)}_exponentialInterpolate(t,e,n,r,i){return e*Math.pow(r/e,(i-t)/(n-t))}}class td extends Zh{constructor(){super(...arguments),this._internalChannels=[]}get numberOfInputs(){return eh(this.input)?Kl(this.input)||this.input instanceof Yh?1:this.input.numberOfInputs:0}get numberOfOutputs(){return eh(this.output)?this.output.numberOfOutputs:0}_isAudioNode(t){return eh(t)&&(t instanceof td||Ql(t))}_getInternalNodes(){const t=this._internalChannels.slice(0);return this._isAudioNode(this.input)&&t.push(this.input),this._isAudioNode(this.output)&&this.input!==this.output&&t.push(this.output),t}_setChannelProperties(t){this._getInternalNodes().forEach(e=>{e.channelCount=t.channelCount,e.channelCountMode=t.channelCountMode,e.channelInterpretation=t.channelInterpretation})}_getChannelProperties(){const t=this._getInternalNodes();ph(t.length>0,"ToneAudioNode does not have any internal nodes");const e=t[0];return{channelCount:e.channelCount,channelCountMode:e.channelCountMode,channelInterpretation:e.channelInterpretation}}get channelCount(){return this._getChannelProperties().channelCount}set channelCount(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelCount:t}))}get channelCountMode(){return this._getChannelProperties().channelCountMode}set channelCountMode(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelCountMode:t}))}get channelInterpretation(){return this._getChannelProperties().channelInterpretation}set channelInterpretation(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelInterpretation:t}))}connect(t,e=0,n=0){return nd(this,t,e,n),this}toDestination(){return this.connect(this.context.destination),this}toMaster(){return bh("toMaster() has been renamed toDestination()"),this.toDestination()}disconnect(t,e=0,n=0){return rd(this,t,e,n),this}chain(...t){return ed(this,...t),this}fan(...t){return t.forEach(t=>this.connect(t)),this}dispose(){return super.dispose(),eh(this.input)&&(this.input instanceof td?this.input.dispose():Ql(this.input)&&this.input.disconnect()),eh(this.output)&&(this.output instanceof td?this.output.dispose():Ql(this.output)&&this.output.disconnect()),this._internalChannels=[],this}}function ed(...t){const e=t.shift();t.reduce((t,e)=>(t instanceof td?t.connect(e):Ql(t)&&nd(t,e),e),e)}function nd(t,e,n=0,r=0){for(ph(eh(t),"Cannot connect from undefined node"),ph(eh(e),"Cannot connect to undefined node"),(e instanceof td||Ql(e))&&ph(e.numberOfInputs>0,"Cannot connect to node with no inputs"),ph(t.numberOfOutputs>0,"Cannot connect from node with no outputs");e instanceof td||e instanceof Yh;)eh(e.input)&&(e=e.input);for(;t instanceof td;)eh(t.output)&&(t=t.output);Kl(e)?t.connect(e,n):t.connect(e,n,r)}function rd(t,e,n=0,r=0){if(eh(e))for(;e instanceof td;)e=e.input;for(;!Ql(t);)eh(t.output)&&(t=t.output);Kl(e)?t.disconnect(e,n):Ql(e)?t.disconnect(e,n,r):t.disconnect()}class id extends td{constructor(){const t=ch(id.getDefaults(),arguments,["gain","units"]);super(t),this.name="Gain",this._gainNode=this.context.createGain(),this.input=this._gainNode,this.output=this._gainNode,this.gain=new Yh({context:this.context,convert:t.convert,param:this._gainNode.gain,units:t.units,value:t.gain,minValue:t.minValue,maxValue:t.maxValue}),Fh(this,"gain")}static getDefaults(){return Object.assign(td.getDefaults(),{convert:!0,gain:1,units:"gain"})}dispose(){return super.dispose(),this._gainNode.disconnect(),this.gain.dispose(),this}}class od extends td{constructor(t){super(t),this.onended=Bh,this._startTime=-1,this._stopTime=-1,this._timeout=-1,this.output=new id({context:this.context,gain:0}),this._gainNode=this.output,this.getStateAtTime=function(t){const e=this.toSeconds(t);return-1!==this._startTime&&e>=this._startTime&&(-1===this._stopTime||e<=this._stopTime)?"started":"stopped"},this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut,this._curve=t.curve,this.onended=t.onended}static getDefaults(){return Object.assign(td.getDefaults(),{curve:"linear",fadeIn:0,fadeOut:0,onended:Bh})}_startGain(t,e=1){ph(-1===this._startTime,"Source cannot be started more than once");const n=this.toSeconds(this._fadeIn);return this._startTime=t+n,this._startTime=Math.max(this._startTime,this.context.currentTime),n>0?(this._gainNode.gain.setValueAtTime(0,t),"linear"===this._curve?this._gainNode.gain.linearRampToValueAtTime(e,t+n):this._gainNode.gain.exponentialApproachValueAtTime(e,t,n)):this._gainNode.gain.setValueAtTime(e,t),this}stop(t){return this.log("stop",t),this._stopGain(this.toSeconds(t)),this}_stopGain(t){ph(-1!==this._startTime,"'start' must be called before 'stop'"),this.cancelStop();const e=this.toSeconds(this._fadeOut);return this._stopTime=this.toSeconds(t)+e,this._stopTime=Math.max(this._stopTime,this.now()),e>0?"linear"===this._curve?this._gainNode.gain.linearRampTo(0,e,t):this._gainNode.gain.targetRampTo(0,e,t):(this._gainNode.gain.cancelAndHoldAtTime(t),this._gainNode.gain.setValueAtTime(0,t)),this.context.clearTimeout(this._timeout),this._timeout=this.context.setTimeout(()=>{const t="exponential"===this._curve?2*e:0;this._stopSource(this.now()+t),this._onended()},this._stopTime-this.context.currentTime),this}_onended(){if(this.onended!==Bh&&(this.onended(this),this.onended=Bh,!this.context.isOffline)){const t=()=>this.dispose();"undefined"!=typeof requestIdleCallback?requestIdleCallback(t):setTimeout(t,10)}}get state(){return this.getStateAtTime(this.now())}cancelStop(){return this.log("cancelStop"),ph(-1!==this._startTime,"Source is not started"),this._gainNode.gain.cancelScheduledValues(this._startTime+this.sampleTime),this.context.clearTimeout(this._timeout),this._stopTime=-1,this}dispose(){return super.dispose(),this._gainNode.dispose(),this.onended=Bh,this}}class sd extends od{constructor(){const t=ch(sd.getDefaults(),arguments,["offset"]);super(t),this.name="ToneConstantSource",this._source=this.context.createConstantSource(),nd(this._source,this._gainNode),this.offset=new Yh({context:this.context,convert:t.convert,param:this._source.offset,units:t.units,value:t.offset,minValue:t.minValue,maxValue:t.maxValue})}static getDefaults(){return Object.assign(od.getDefaults(),{convert:!0,offset:1,units:"number"})}start(t){const e=this.toSeconds(t);return this.log("start",e),this._startGain(e),this._source.start(e),this}_stopSource(t){this._source.stop(t)}dispose(){return super.dispose(),"started"===this.state&&this.stop(),this._source.disconnect(),this.offset.dispose(),this}}class ad extends td{constructor(){const t=ch(ad.getDefaults(),arguments,["value","units"]);super(t),this.name="Signal",this.override=!0,this.output=this._constantSource=new sd({context:this.context,convert:t.convert,offset:t.value,units:t.units,minValue:t.minValue,maxValue:t.maxValue}),this._constantSource.start(0),this.input=this._param=this._constantSource.offset}static getDefaults(){return Object.assign(td.getDefaults(),{convert:!0,units:"number",value:0})}connect(t,e=0,n=0){return ud(this,t,e,n),this}dispose(){return super.dispose(),this._param.dispose(),this._constantSource.dispose(),this}setValueAtTime(t,e){return this._param.setValueAtTime(t,e),this}getValueAtTime(t){return this._param.getValueAtTime(t)}setRampPoint(t){return this._param.setRampPoint(t),this}linearRampToValueAtTime(t,e){return this._param.linearRampToValueAtTime(t,e),this}exponentialRampToValueAtTime(t,e){return this._param.exponentialRampToValueAtTime(t,e),this}exponentialRampTo(t,e,n){return this._param.exponentialRampTo(t,e,n),this}linearRampTo(t,e,n){return this._param.linearRampTo(t,e,n),this}targetRampTo(t,e,n){return this._param.targetRampTo(t,e,n),this}exponentialApproachValueAtTime(t,e,n){return this._param.exponentialApproachValueAtTime(t,e,n),this}setTargetAtTime(t,e,n){return this._param.setTargetAtTime(t,e,n),this}setValueCurveAtTime(t,e,n,r){return this._param.setValueCurveAtTime(t,e,n,r),this}cancelScheduledValues(t){return this._param.cancelScheduledValues(t),this}cancelAndHoldAtTime(t){return this._param.cancelAndHoldAtTime(t),this}rampTo(t,e,n){return this._param.rampTo(t,e,n),this}get value(){return this._param.value}set value(t){this._param.value=t}get convert(){return this._param.convert}set convert(t){this._param.convert=t}get units(){return this._param.units}get overridden(){return this._param.overridden}set overridden(t){this._param.overridden=t}get maxValue(){return this._param.maxValue}get minValue(){return this._param.minValue}apply(t){return this._param.apply(t),this}}function ud(t,e,n,r){(e instanceof Yh||Kl(e)||e instanceof ad&&e.override)&&(e.cancelScheduledValues(0),e.setValueAtTime(0,0),e instanceof ad&&(e.overridden=!0)),nd(t,e,n,r)}function cd(t,e=1/0){const n=new WeakMap;return function(r,i){Reflect.defineProperty(r,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(r){fh(r,t,e),n.set(this,r)}})}}function ld(t,e=1/0){const n=new WeakMap;return function(r,i){Reflect.defineProperty(r,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(r){fh(this.toSeconds(r),t,e),n.set(this,r)}})}}class hd extends td{constructor(){const t=ch(hd.getDefaults(),arguments,["attack","decay","sustain","release"]);super(t),this.name="Envelope",this._sig=new ad({context:this.context,value:0}),this.output=this._sig,this.input=void 0,this.attack=t.attack,this.decay=t.decay,this.sustain=t.sustain,this.release=t.release,this.attackCurve=t.attackCurve,this.releaseCurve=t.releaseCurve,this.decayCurve=t.decayCurve}static getDefaults(){return Object.assign(td.getDefaults(),{attack:.01,attackCurve:"linear",decay:.1,decayCurve:"exponential",release:1,releaseCurve:"exponential",sustain:.5})}get value(){return this.getValueAtTime(this.now())}_getCurve(t,e){if(oh(t))return t;{let n;for(n in dd)if(dd[n][e]===t)return n;return t}}_setCurve(t,e,n){if(oh(n)&&Reflect.has(dd,n)){const r=dd[n];rh(r)?"_decayCurve"!==t&&(this[t]=r[e]):this[t]=r}else{if(!ih(n)||"_decayCurve"===t)throw new Error("Envelope: invalid curve: "+n);this[t]=n}}get attackCurve(){return this._getCurve(this._attackCurve,"In")}set attackCurve(t){this._setCurve("_attackCurve","In",t)}get releaseCurve(){return this._getCurve(this._releaseCurve,"Out")}set releaseCurve(t){this._setCurve("_releaseCurve","Out",t)}get decayCurve(){return this._getCurve(this._decayCurve,"Out")}set decayCurve(t){this._setCurve("_decayCurve","Out",t)}triggerAttack(t,e=1){this.log("triggerAttack",t,e),t=this.toSeconds(t);let n=this.toSeconds(this.attack);const r=this.toSeconds(this.decay),i=this.getValueAtTime(t);if(i>0){n=(1-i)/(1/n)}if(n<this.sampleTime)this._sig.cancelScheduledValues(t),this._sig.setValueAtTime(e,t);else if("linear"===this._attackCurve)this._sig.linearRampTo(e,n,t);else if("exponential"===this._attackCurve)this._sig.targetRampTo(e,n,t);else{this._sig.cancelAndHoldAtTime(t);let r=this._attackCurve;for(let t=1;t<r.length;t++)if(r[t-1]<=i&&i<=r[t]){r=this._attackCurve.slice(t),r[0]=i;break}this._sig.setValueCurveAtTime(r,t,n,e)}if(r&&this.sustain<1){const i=e*this.sustain,o=t+n;this.log("decay",o),"linear"===this._decayCurve?this._sig.linearRampToValueAtTime(i,r+o):this._sig.exponentialApproachValueAtTime(i,o,r)}return this}triggerRelease(t){this.log("triggerRelease",t),t=this.toSeconds(t);const e=this.getValueAtTime(t);if(e>0){const n=this.toSeconds(this.release);n<this.sampleTime?this._sig.setValueAtTime(0,t):"linear"===this._releaseCurve?this._sig.linearRampTo(0,n,t):"exponential"===this._releaseCurve?this._sig.targetRampTo(0,n,t):(ph(ih(this._releaseCurve),"releaseCurve must be either 'linear', 'exponential' or an array"),this._sig.cancelAndHoldAtTime(t),this._sig.setValueCurveAtTime(this._releaseCurve,t,n,e))}return this}getValueAtTime(t){return this._sig.getValueAtTime(t)}triggerAttackRelease(t,e,n=1){return e=this.toSeconds(e),this.triggerAttack(e,n),this.triggerRelease(e+this.toSeconds(t)),this}cancel(t){return this._sig.cancelScheduledValues(this.toSeconds(t)),this}connect(t,e=0,n=0){return ud(this,t,e,n),this}asArray(){return a(this,arguments,void 0,function*(t=1024){const e=t/this.context.sampleRate,n=new Uh(1,e,this.context.sampleRate),r=this.toSeconds(this.attack)+this.toSeconds(this.decay),i=r+this.toSeconds(this.release),o=.1*i,s=i+o,a=new this.constructor(Object.assign(this.get(),{attack:e*this.toSeconds(this.attack)/s,decay:e*this.toSeconds(this.decay)/s,release:e*this.toSeconds(this.release)/s,context:n}));a._sig.toDestination(),a.triggerAttackRelease(e*(r+o)/s,0);return(yield n.render()).getChannelData(0)})}dispose(){return super.dispose(),this._sig.dispose(),this}}s([ld(0)],hd.prototype,"attack",void 0),s([ld(0)],hd.prototype,"decay",void 0),s([cd(0,1)],hd.prototype,"sustain",void 0),s([ld(0)],hd.prototype,"release",void 0);const dd=(()=>{const t=128;let e,n;const r=[];for(e=0;e<t;e++)r[e]=Math.sin(e/127*(Math.PI/2));const i=[];for(e=0;e<127;e++){n=e/127;const t=Math.sin(n*(2*Math.PI)*6.4-Math.PI/2)+1;i[e]=t/10+.83*n}i[127]=1;const o=[];for(e=0;e<t;e++)o[e]=Math.ceil(e/127*5)/5;const s=[];for(e=0;e<t;e++)n=e/127,s[e]=.5*(1-Math.cos(Math.PI*n));const a=[];for(e=0;e<t;e++){n=e/127;const t=4*Math.pow(n,3)+.2,r=Math.cos(t*Math.PI*2*n);a[e]=Math.abs(r*(1-n))}function u(t){const e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=1-t[n];return e}return{bounce:{In:u(a),Out:a},cosine:{In:r,Out:(c=r,c.slice(0).reverse())},exponential:"exponential",linear:"linear",ripple:{In:i,Out:u(i)},sine:{In:s,Out:u(s)},step:{In:o,Out:u(o)}};var c})();class pd extends hd{constructor(){super(ch(pd.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="AmplitudeEnvelope",this._gainNode=new id({context:this.context,gain:0}),this.output=this._gainNode,this.input=this._gainNode,this._sig.connect(this._gainNode.gain),this.output=this._gainNode,this.input=this._gainNode}dispose(){return super.dispose(),this._gainNode.dispose(),this}}class fd extends td{constructor(){const t=ch(fd.getDefaults(),arguments,["volume"]);super(t),this.name="Volume",this.input=this.output=new id({context:this.context,gain:t.volume,units:"decibels"}),this.volume=this.output.gain,Fh(this,"volume"),this._unmutedVolume=t.volume,this.mute=t.mute}static getDefaults(){return Object.assign(td.getDefaults(),{mute:!1,volume:0})}get mute(){return this.volume.value===-1/0}set mute(t){!this.mute&&t?(this._unmutedVolume=this.volume.value,this.volume.value=-1/0):this.mute&&!t&&(this.volume.value=this._unmutedVolume)}dispose(){return super.dispose(),this.input.dispose(),this.volume.dispose(),this}}class md extends td{constructor(){const t=ch(md.getDefaults(),arguments);super(t),this.name="Destination",this.input=new fd({context:this.context}),this.output=new id({context:this.context}),this.volume=this.input.volume,ed(this.input,this.output,this.context.rawContext.destination),this.mute=t.mute,this._internalChannels=[this.input,this.context.rawContext.destination,this.output]}static getDefaults(){return Object.assign(td.getDefaults(),{mute:!1,volume:0})}get mute(){return this.input.mute}set mute(t){this.input.mute=t}chain(...t){return this.input.disconnect(),t.unshift(this.input),t.push(this.output),ed(...t),this}get maxChannelCount(){return this.context.rawContext.destination.maxChannelCount}dispose(){return super.dispose(),this.volume.dispose(),this}}Ih(t=>{t.destination=new md({context:t})}),Rh(t=>{t.destination.dispose()});class gd extends Th{constructor(t){super(),this.name="TimelineValue",this._timeline=new Ch({memory:10}),this._initialValue=t}set(t,e){return this._timeline.add({value:t,time:e}),this}get(t){const e=this._timeline.get(t);return e?e.value:this._initialValue}}class _d extends td{constructor(){super(ch(_d.getDefaults(),arguments,["context"]))}connect(t,e=0,n=0){return ud(this,t,e,n),this}}class yd extends _d{constructor(){const t=ch(yd.getDefaults(),arguments,["mapping","length"]);super(t),this.name="WaveShaper",this._shaper=this.context.createWaveShaper(),this.input=this._shaper,this.output=this._shaper,ih(t.mapping)||t.mapping instanceof Float32Array?this.curve=Float32Array.from(t.mapping):"function"==typeof t.mapping&&this.setMap(t.mapping,t.length)}static getDefaults(){return Object.assign(ad.getDefaults(),{length:1024})}setMap(t,e=1024){const n=new Float32Array(e);for(let r=0,i=e;r<i;r++){const e=r/(i-1)*2-1;n[r]=t(e,r)}return this.curve=n,this}get curve(){return this._shaper.curve}set curve(t){this._shaper.curve=t}get oversample(){return this._shaper.oversample}set oversample(t){const e=["none","2x","4x"].some(e=>e.includes(t));ph(e,"oversampling must be either 'none', '2x', or '4x'"),this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.disconnect(),this}}class vd extends _d{constructor(){const t=ch(vd.getDefaults(),arguments,["value"]);super(t),this.name="Pow",this._exponentScaler=this.input=this.output=new yd({context:this.context,mapping:this._expFunc(t.value),length:8192}),this._exponent=t.value}static getDefaults(){return Object.assign(_d.getDefaults(),{value:1})}_expFunc(t){return e=>Math.pow(Math.abs(e),t)}get value(){return this._exponent}set value(t){this._exponent=t,this._exponentScaler.setMap(this._expFunc(this._exponent))}dispose(){return super.dispose(),this._exponentScaler.dispose(),this}}class bd extends Qh{constructor(){super(...arguments),this.name="Ticks",this.defaultUnits="i"}_now(){return this.context.transport.ticks}_beatsToUnits(t){return this._getPPQ()*t}_secondsToUnits(t){return Math.floor(t/(60/this._getBpm())*this._getPPQ())}_ticksToUnits(t){return t}toTicks(){return this.valueOf()}toSeconds(){return this.valueOf()/this._getPPQ()*(60/this._getBpm())}}class wd extends Th{constructor(){super(...arguments),this.name="IntervalTimeline",this._root=null,this._length=0}add(t){ph(eh(t.time),"Events must have a time property"),ph(eh(t.duration),"Events must have a duration parameter"),t.time=t.time.valueOf();let e=new xd(t.time,t.time+t.duration,t);for(null===this._root?this._root=e:this._root.insert(e),this._length++;null!==e;)e.updateHeight(),e.updateMax(),this._rebalance(e),e=e.parent;return this}remove(t){if(null!==this._root){const e=[];this._root.search(t.time,e);for(const n of e)if(n.event===t){this._removeNode(n),this._length--;break}}return this}get length(){return this._length}cancel(t){return this.forEachFrom(t,t=>this.remove(t)),this}_setRoot(t){this._root=t,null!==this._root&&(this._root.parent=null)}_replaceNodeInParent(t,e){null!==t.parent?(t.isLeftChild()?t.parent.left=e:t.parent.right=e,this._rebalance(t.parent)):this._setRoot(e)}_removeNode(t){if(null===t.left&&null===t.right)this._replaceNodeInParent(t,null);else if(null===t.right)this._replaceNodeInParent(t,t.left);else if(null===t.left)this._replaceNodeInParent(t,t.right);else{let e,n=null;if(t.getBalance()>0)if(null===t.left.right)e=t.left,e.right=t.right,n=e;else{for(e=t.left.right;null!==e.right;)e=e.right;e.parent&&(e.parent.right=e.left,n=e.parent,e.left=t.left,e.right=t.right)}else if(null===t.right.left)e=t.right,e.left=t.left,n=e;else{for(e=t.right.left;null!==e.left;)e=e.left;e.parent&&(e.parent.left=e.right,n=e.parent,e.left=t.left,e.right=t.right)}null!==t.parent?t.isLeftChild()?t.parent.left=e:t.parent.right=e:this._setRoot(e),n&&this._rebalance(n)}t.dispose()}_rotateLeft(t){const e=t.parent,n=t.isLeftChild(),r=t.right;r&&(t.right=r.left,r.left=t),null!==e?n?e.left=r:e.right=r:this._setRoot(r)}_rotateRight(t){const e=t.parent,n=t.isLeftChild(),r=t.left;r&&(t.left=r.right,r.right=t),null!==e?n?e.left=r:e.right=r:this._setRoot(r)}_rebalance(t){const e=t.getBalance();e>1&&t.left?t.left.getBalance()<0?this._rotateLeft(t.left):this._rotateRight(t):e<-1&&t.right&&(t.right.getBalance()>0?this._rotateRight(t.right):this._rotateLeft(t))}get(t){if(null!==this._root){const e=[];if(this._root.search(t,e),e.length>0){let t=e[0];for(let n=1;n<e.length;n++)e[n].low>t.low&&(t=e[n]);return t.event}}return null}forEach(t){if(null!==this._root){const e=[];this._root.traverse(t=>e.push(t)),e.forEach(e=>{e.event&&t(e.event)})}return this}forEachAtTime(t,e){if(null!==this._root){const n=[];this._root.search(t,n),n.forEach(t=>{t.event&&e(t.event)})}return this}forEachFrom(t,e){if(null!==this._root){const n=[];this._root.searchAfter(t,n),n.forEach(t=>{t.event&&e(t.event)})}return this}dispose(){return super.dispose(),null!==this._root&&this._root.traverse(t=>t.dispose()),this._root=null,this}}class xd{constructor(t,e,n){this._left=null,this._right=null,this.parent=null,this.height=0,this.event=n,this.low=t,this.high=e,this.max=this.high}insert(t){t.low<=this.low?null===this.left?this.left=t:this.left.insert(t):null===this.right?this.right=t:this.right.insert(t)}search(t,e){t>this.max||(null!==this.left&&this.left.search(t,e),this.low<=t&&this.high>t&&e.push(this),this.low>t||null!==this.right&&this.right.search(t,e))}searchAfter(t,e){this.low>=t&&(e.push(this),null!==this.left&&this.left.searchAfter(t,e)),null!==this.right&&this.right.searchAfter(t,e)}traverse(t){t(this),null!==this.left&&this.left.traverse(t),null!==this.right&&this.right.traverse(t)}updateHeight(){null!==this.left&&null!==this.right?this.height=Math.max(this.left.height,this.right.height)+1:null!==this.right?this.height=this.right.height+1:null!==this.left?this.height=this.left.height+1:this.height=0}updateMax(){this.max=this.high,null!==this.left&&(this.max=Math.max(this.max,this.left.max)),null!==this.right&&(this.max=Math.max(this.max,this.right.max))}getBalance(){let t=0;return null!==this.left&&null!==this.right?t=this.left.height-this.right.height:null!==this.left?t=this.left.height+1:null!==this.right&&(t=-(this.right.height+1)),t}isLeftChild(){return null!==this.parent&&this.parent.left===this}get left(){return this._left}set left(t){this._left=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}get right(){return this._right}set right(t){this._right=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}dispose(){this.parent=null,this._left=null,this._right=null,this.event=null}}class Td extends Ch{constructor(t="stopped"){super(),this.name="StateTimeline",this._initial=t,this.setStateAtTime(this._initial,0)}getValueAtTime(t){const e=this.get(t);return null!==e?e.state:this._initial}setStateAtTime(t,e,n){return fh(e,0),this.add(Object.assign({},n,{state:t,time:e})),this}getLastState(t,e){for(let n=this._search(e);n>=0;n--){const e=this._timeline[n];if(e.state===t)return e}}getNextState(t,e){const n=this._search(e);if(-1!==n)for(let e=n;e<this._timeline.length;e++){const n=this._timeline[e];if(n.state===t)return n}}}class kd extends Yh{constructor(){const t=ch(kd.getDefaults(),arguments,["value"]);super(t),this.name="TickParam",this._events=new Ch(1/0),this._multiplier=1,this._multiplier=t.multiplier,this._events.cancel(0),this._events.add({ticks:0,time:0,type:"setValueAtTime",value:this._fromType(t.value)}),this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(Yh.getDefaults(),{multiplier:1,units:"hertz",value:1})}setTargetAtTime(t,e,n){e=this.toSeconds(e),this.setRampPoint(e);const r=this._fromType(t),i=this._events.get(e),o=Math.round(Math.max(1/n,1));for(let t=0;t<=o;t++){const o=n*t+e,s=this._exponentialApproach(i.time,i.value,r,n,o);this.linearRampToValueAtTime(this._toType(s),o)}return this}setValueAtTime(t,e){const n=this.toSeconds(e);super.setValueAtTime(t,e);const r=this._events.get(n),i=this._events.previousEvent(r),o=this._getTicksUntilEvent(i,n);return r.ticks=Math.max(o,0),this}linearRampToValueAtTime(t,e){const n=this.toSeconds(e);super.linearRampToValueAtTime(t,e);const r=this._events.get(n),i=this._events.previousEvent(r),o=this._getTicksUntilEvent(i,n);return r.ticks=Math.max(o,0),this}exponentialRampToValueAtTime(t,e){e=this.toSeconds(e);const n=this._fromType(t),r=this._events.get(e),i=Math.round(Math.max(10*(e-r.time),1)),o=(e-r.time)/i;for(let t=0;t<=i;t++){const i=o*t+r.time,s=this._exponentialInterpolate(r.time,r.value,e,n,i);this.linearRampToValueAtTime(this._toType(s),i)}return this}_getTicksUntilEvent(t,e){if(null===t)t={ticks:0,time:0,type:"setValueAtTime",value:0};else if(th(t.ticks)){const e=this._events.previousEvent(t);t.ticks=this._getTicksUntilEvent(e,t.time)}const n=this._fromType(this.getValueAtTime(t.time));let r=this._fromType(this.getValueAtTime(e));const i=this._events.get(e);return i&&i.time===e&&"setValueAtTime"===i.type&&(r=this._fromType(this.getValueAtTime(e-this.sampleTime))),.5*(e-t.time)*(n+r)+t.ticks}getTicksAtTime(t){const e=this.toSeconds(t),n=this._events.get(e);return Math.max(this._getTicksUntilEvent(n,e),0)}getDurationOfTicks(t,e){const n=this.toSeconds(e),r=this.getTicksAtTime(e);return this.getTimeOfTick(r+t)-n}getTimeOfTick(t){const e=this._events.get(t,"ticks"),n=this._events.getAfter(t,"ticks");if(e&&e.ticks===t)return e.time;if(e&&n&&"linearRampToValueAtTime"===n.type&&e.value!==n.value){const r=this._fromType(this.getValueAtTime(e.time)),i=(this._fromType(this.getValueAtTime(n.time))-r)/(n.time-e.time),o=Math.sqrt(Math.pow(r,2)-2*i*(e.ticks-t)),s=(-r+o)/i;return(s>0?s:(-r-o)/i)+e.time}return e?0===e.value?1/0:e.time+(t-e.ticks)/e.value:t/this._initialValue}ticksToTime(t,e){return this.getDurationOfTicks(t,e)}timeToTicks(t,e){const n=this.toSeconds(e),r=this.toSeconds(t),i=this.getTicksAtTime(n);return this.getTicksAtTime(n+r)-i}_fromType(t){return"bpm"===this.units&&this.multiplier?1/(60/t/this.multiplier):super._fromType(t)}_toType(t){return"bpm"===this.units&&this.multiplier?t/this.multiplier*60:super._toType(t)}get multiplier(){return this._multiplier}set multiplier(t){const e=this.value;this._multiplier=t,this.cancelScheduledValues(0),this.setValueAtTime(e,0)}}class Sd extends ad{constructor(){const t=ch(Sd.getDefaults(),arguments,["value"]);super(t),this.name="TickSignal",this.input=this._param=new kd({context:this.context,convert:t.convert,multiplier:t.multiplier,param:this._constantSource.offset,units:t.units,value:t.value})}static getDefaults(){return Object.assign(ad.getDefaults(),{multiplier:1,units:"hertz",value:1})}ticksToTime(t,e){return this._param.ticksToTime(t,e)}timeToTicks(t,e){return this._param.timeToTicks(t,e)}getTimeOfTick(t){return this._param.getTimeOfTick(t)}getDurationOfTicks(t,e){return this._param.getDurationOfTicks(t,e)}getTicksAtTime(t){return this._param.getTicksAtTime(t)}get multiplier(){return this._param.multiplier}set multiplier(t){this._param.multiplier=t}dispose(){return super.dispose(),this._param.dispose(),this}}class Ad extends Zh{constructor(){const t=ch(Ad.getDefaults(),arguments,["frequency"]);super(t),this.name="TickSource",this._state=new Td,this._tickOffset=new Ch,this._ticksAtTime=new Ch,this._secondsAtTime=new Ch,this.frequency=new Sd({context:this.context,units:t.units,value:t.frequency}),Fh(this,"frequency"),this._state.setStateAtTime("stopped",0),this.setTicksAtTime(0,0)}static getDefaults(){return Object.assign({frequency:1,units:"hertz"},Zh.getDefaults())}get state(){return this.getStateAtTime(this.now())}start(t,e){const n=this.toSeconds(t);return"started"!==this._state.getValueAtTime(n)&&(this._state.setStateAtTime("started",n),eh(e)&&this.setTicksAtTime(e,n),this._ticksAtTime.cancel(n),this._secondsAtTime.cancel(n)),this}stop(t){const e=this.toSeconds(t);if("stopped"===this._state.getValueAtTime(e)){const t=this._state.get(e);t&&t.time>0&&(this._tickOffset.cancel(t.time),this._state.cancel(t.time))}return this._state.cancel(e),this._state.setStateAtTime("stopped",e),this.setTicksAtTime(0,e),this._ticksAtTime.cancel(e),this._secondsAtTime.cancel(e),this}pause(t){const e=this.toSeconds(t);return"started"===this._state.getValueAtTime(e)&&(this._state.setStateAtTime("paused",e),this._ticksAtTime.cancel(e),this._secondsAtTime.cancel(e)),this}cancel(t){return t=this.toSeconds(t),this._state.cancel(t),this._tickOffset.cancel(t),this._ticksAtTime.cancel(t),this._secondsAtTime.cancel(t),this}getTicksAtTime(t){const e=this.toSeconds(t),n=this._state.getLastState("stopped",e),r=this._ticksAtTime.get(e),i={state:"paused",time:e};this._state.add(i);let o=r||n,s=r?r.ticks:0,a=null;return this._state.forEachBetween(o.time,e+this.sampleTime,t=>{let e=o.time;const n=this._tickOffset.get(t.time);n&&n.time>=o.time&&(s=n.ticks,e=n.time),"started"===o.state&&"started"!==t.state&&(s+=this.frequency.getTicksAtTime(t.time)-this.frequency.getTicksAtTime(e),t.time!==i.time&&(a={state:t.state,time:t.time,ticks:s})),o=t}),this._state.remove(i),a&&this._ticksAtTime.add(a),s}get ticks(){return this.getTicksAtTime(this.now())}set ticks(t){this.setTicksAtTime(t,this.now())}get seconds(){return this.getSecondsAtTime(this.now())}set seconds(t){const e=this.now(),n=this.frequency.timeToTicks(t,e);this.setTicksAtTime(n,e)}getSecondsAtTime(t){t=this.toSeconds(t);const e=this._state.getLastState("stopped",t),n={state:"paused",time:t};this._state.add(n);const r=this._secondsAtTime.get(t);let i=r||e,o=r?r.seconds:0,s=null;return this._state.forEachBetween(i.time,t+this.sampleTime,t=>{let e=i.time;const r=this._tickOffset.get(t.time);r&&r.time>=i.time&&(o=r.seconds,e=r.time),"started"===i.state&&"started"!==t.state&&(o+=t.time-e,t.time!==n.time&&(s={state:t.state,time:t.time,seconds:o})),i=t}),this._state.remove(n),s&&this._secondsAtTime.add(s),o}setTicksAtTime(t,e){return e=this.toSeconds(e),this._tickOffset.cancel(e),this._tickOffset.add({seconds:this.frequency.getDurationOfTicks(t,e),ticks:t,time:e}),this._ticksAtTime.cancel(e),this._secondsAtTime.cancel(e),this}getStateAtTime(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)}getTimeOfTick(t,e=this.now()){const n=this._tickOffset.get(e),r=this._state.get(e),i=Math.max(n.time,r.time),o=this.frequency.getTicksAtTime(i)+t-n.ticks;return this.frequency.getTimeOfTick(o)}forEachTickBetween(t,e,n){let r=this._state.get(t);this._state.forEachBetween(t,e,e=>{r&&"started"===r.state&&"started"!==e.state&&this.forEachTickBetween(Math.max(r.time,t),e.time-this.sampleTime,n),r=e});let i=null;if(r&&"started"===r.state){const o=Math.max(r.time,t),s=this.frequency.getTicksAtTime(o),a=s-this.frequency.getTicksAtTime(r.time);let u=Math.ceil(a)-a;u=Oh(u,1)?0:u;let c=this.frequency.getTimeOfTick(s+u);for(;c<e;){try{n(c,Math.round(this.getTicksAtTime(c)))}catch(t){i=t;break}c+=this.frequency.getDurationOfTicks(1,c)}}if(i)throw i;return this}dispose(){return super.dispose(),this._state.dispose(),this._tickOffset.dispose(),this._ticksAtTime.dispose(),this._secondsAtTime.dispose(),this.frequency.dispose(),this}}class Ed extends Zh{constructor(){const t=ch(Ed.getDefaults(),arguments,["callback","frequency"]);super(t),this.name="Clock",this.callback=Bh,this._lastUpdate=0,this._state=new Td("stopped"),this._boundLoop=this._loop.bind(this),this.callback=t.callback,this._tickSource=new Ad({context:this.context,frequency:t.frequency,units:t.units}),this._lastUpdate=0,this.frequency=this._tickSource.frequency,Fh(this,"frequency"),this._state.setStateAtTime("stopped",0),this.context.on("tick",this._boundLoop)}static getDefaults(){return Object.assign(Zh.getDefaults(),{callback:Bh,frequency:1,units:"hertz"})}get state(){return this._state.getValueAtTime(this.now())}start(t,e){mh(this.context);const n=this.toSeconds(t);return this.log("start",n),"started"!==this._state.getValueAtTime(n)&&(this._state.setStateAtTime("started",n),this._tickSource.start(n,e),n<this._lastUpdate&&this.emit("start",n,e)),this}stop(t){const e=this.toSeconds(t);return this.log("stop",e),this._state.cancel(e),this._state.setStateAtTime("stopped",e),this._tickSource.stop(e),e<this._lastUpdate&&this.emit("stop",e),this}pause(t){const e=this.toSeconds(t);return"started"===this._state.getValueAtTime(e)&&(this._state.setStateAtTime("paused",e),this._tickSource.pause(e),e<this._lastUpdate&&this.emit("pause",e)),this}get ticks(){return Math.ceil(this.getTicksAtTime(this.now()))}set ticks(t){this._tickSource.ticks=t}get seconds(){return this._tickSource.seconds}set seconds(t){this._tickSource.seconds=t}getSecondsAtTime(t){return this._tickSource.getSecondsAtTime(t)}setTicksAtTime(t,e){return this._tickSource.setTicksAtTime(t,e),this}getTimeOfTick(t,e=this.now()){return this._tickSource.getTimeOfTick(t,e)}getTicksAtTime(t){return this._tickSource.getTicksAtTime(t)}nextTickTime(t,e){const n=this.toSeconds(e),r=this.getTicksAtTime(n);return this._tickSource.getTimeOfTick(r+t,n)}_loop(){const t=this._lastUpdate,e=this.now();this._lastUpdate=e,this.log("loop",t,e),t!==e&&(this._state.forEachBetween(t,e,t=>{switch(t.state){case"started":const e=this._tickSource.getTicksAtTime(t.time);this.emit("start",t.time,e);break;case"stopped":0!==t.time&&this.emit("stop",t.time);break;case"paused":this.emit("pause",t.time)}}),this._tickSource.forEachTickBetween(t,e,(t,e)=>{this.callback(t,e)}))}getStateAtTime(t){const e=this.toSeconds(t);return this._state.getValueAtTime(e)}dispose(){return super.dispose(),this.context.off("tick",this._boundLoop),this._tickSource.dispose(),this._state.dispose(),this}}Ph.mixin(Ed);class Od{constructor(t,e){this.id=Od._eventId++,this._remainderTime=0;const n=Object.assign(Od.getDefaults(),e);this.transport=t,this.callback=n.callback,this._once=n.once,this.time=Math.floor(n.time),this._remainderTime=n.time-this.time}static getDefaults(){return{callback:Bh,once:!1,time:0}}get floatTime(){return this.time+this._remainderTime}invoke(t){if(this.callback){const e=this.transport.bpm.getDurationOfTicks(1,t);this.callback(t+this._remainderTime*e),this._once&&this.transport.clear(this.id)}}dispose(){return this.callback=void 0,this}}Od._eventId=0;class Cd extends Od{constructor(t,e){super(t,e),this._currentId=-1,this._nextId=-1,this._nextTick=this.time,this._boundRestart=this._restart.bind(this);const n=Object.assign(Cd.getDefaults(),e);this.duration=n.duration,this._interval=n.interval,this._nextTick=n.time,this.transport.on("start",this._boundRestart),this.transport.on("loopStart",this._boundRestart),this.transport.on("ticks",this._boundRestart),this.context=this.transport.context,this._restart()}static getDefaults(){return Object.assign({},Od.getDefaults(),{duration:1/0,interval:1,once:!1})}invoke(t){this._createEvents(t),super.invoke(t)}_createEvent(){return Eh(this._nextTick,this.floatTime+this.duration)?this.transport.scheduleOnce(this.invoke.bind(this),new bd(this.context,this._nextTick).toSeconds()):-1}_createEvents(t){Eh(this._nextTick+this._interval,this.floatTime+this.duration)&&(this._nextTick+=this._interval,this._currentId=this._nextId,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new bd(this.context,this._nextTick).toSeconds()))}_restart(t){this.transport.clear(this._currentId),this.transport.clear(this._nextId),this._nextTick=this.floatTime;const e=this.transport.getTicksAtTime(t);Sh(e,this.time)&&(this._nextTick=this.floatTime+Math.ceil((e-this.floatTime)/this._interval)*this._interval),this._currentId=this._createEvent(),this._nextTick+=this._interval,this._nextId=this._createEvent()}dispose(){return super.dispose(),this.transport.clear(this._currentId),this.transport.clear(this._nextId),this.transport.off("start",this._boundRestart),this.transport.off("loopStart",this._boundRestart),this.transport.off("ticks",this._boundRestart),this}}class Md extends Zh{constructor(){const t=ch(Md.getDefaults(),arguments);super(t),this.name="Transport",this._loop=new gd(!1),this._loopStart=0,this._loopEnd=0,this._scheduledEvents={},this._timeline=new Ch,this._repeatedEvents=new wd,this._syncedSignals=[],this._swingAmount=0,this._ppq=t.ppq,this._clock=new Ed({callback:this._processTick.bind(this),context:this.context,frequency:0,units:"bpm"}),this._bindClockEvents(),this.bpm=this._clock.frequency,this._clock.frequency.multiplier=t.ppq,this.bpm.setValueAtTime(t.bpm,0),Fh(this,"bpm"),this._timeSignature=t.timeSignature,this._swingTicks=t.ppq/2}static getDefaults(){return Object.assign(Zh.getDefaults(),{bpm:120,loopEnd:"4m",loopStart:0,ppq:192,swing:0,swingSubdivision:"8n",timeSignature:4})}_processTick(t,e){if(this._loop.get(t)&&e>=this._loopEnd&&(this.emit("loopEnd",t),this._clock.setTicksAtTime(this._loopStart,t),e=this._loopStart,this.emit("loopStart",t,this._clock.getSecondsAtTime(t)),this.emit("loop",t)),this._swingAmount>0&&e%this._ppq!==0&&e%(2*this._swingTicks)!=0){const n=e%(2*this._swingTicks)/(2*this._swingTicks),r=Math.sin(n*Math.PI)*this._swingAmount;t+=new bd(this.context,2*this._swingTicks/3).toSeconds()*r}yh(!0),this._timeline.forEachAtTime(e,e=>e.invoke(t)),yh(!1)}schedule(t,e){const n=new Od(this,{callback:t,time:new Qh(this.context,e).toTicks()});return this._addEvent(n,this._timeline)}scheduleRepeat(t,e,n,r=1/0){const i=new Cd(this,{callback:t,duration:new Jh(this.context,r).toTicks(),interval:new Jh(this.context,e).toTicks(),time:new Qh(this.context,n).toTicks()});return this._addEvent(i,this._repeatedEvents)}scheduleOnce(t,e){const n=new Od(this,{callback:t,once:!0,time:new Qh(this.context,e).toTicks()});return this._addEvent(n,this._timeline)}clear(t){if(this._scheduledEvents.hasOwnProperty(t)){const e=this._scheduledEvents[t.toString()];e.timeline.remove(e.event),e.event.dispose(),delete this._scheduledEvents[t.toString()]}return this}_addEvent(t,e){return this._scheduledEvents[t.id.toString()]={event:t,timeline:e},e.add(t),t.id}cancel(t=0){const e=this.toTicks(t);return this._timeline.forEachFrom(e,t=>this.clear(t.id)),this._repeatedEvents.forEachFrom(e,t=>this.clear(t.id)),this}_bindClockEvents(){this._clock.on("start",(t,e)=>{e=new bd(this.context,e).toSeconds(),this.emit("start",t,e)}),this._clock.on("stop",t=>{this.emit("stop",t)}),this._clock.on("pause",t=>{this.emit("pause",t)})}get state(){return this._clock.getStateAtTime(this.now())}start(t,e){let n;return this.context.resume(),eh(e)&&(n=this.toTicks(e)),this._clock.start(t,n),this}stop(t){return this._clock.stop(t),this}pause(t){return this._clock.pause(t),this}toggle(t){return t=this.toSeconds(t),"started"!==this._clock.getStateAtTime(t)?this.start(t):this.stop(t),this}get timeSignature(){return this._timeSignature}set timeSignature(t){ih(t)&&(t=t[0]/t[1]*4),this._timeSignature=t}get loopStart(){return new Jh(this.context,this._loopStart,"i").toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t)}get loopEnd(){return new Jh(this.context,this._loopEnd,"i").toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t)}get loop(){return this._loop.get(this.now())}set loop(t){this._loop.set(t,this.now())}setLoopPoints(t,e){return this.loopStart=t,this.loopEnd=e,this}get swing(){return this._swingAmount}set swing(t){this._swingAmount=t}get swingSubdivision(){return new bd(this.context,this._swingTicks).toNotation()}set swingSubdivision(t){this._swingTicks=this.toTicks(t)}get position(){const t=this.now(),e=this._clock.getTicksAtTime(t);return new bd(this.context,e).toBarsBeatsSixteenths()}set position(t){const e=this.toTicks(t);this.ticks=e}get seconds(){return this._clock.seconds}set seconds(t){const e=this.now(),n=this._clock.frequency.timeToTicks(t,e);this.ticks=n}get progress(){if(this.loop){const t=this.now();return(this._clock.getTicksAtTime(t)-this._loopStart)/(this._loopEnd-this._loopStart)}return 0}get ticks(){return this._clock.ticks}set ticks(t){if(this._clock.ticks!==t){const e=this.now();if("started"===this.state){const n=this._clock.getTicksAtTime(e),r=e+this._clock.frequency.getDurationOfTicks(Math.ceil(n)-n,e);this.emit("stop",r),this._clock.setTicksAtTime(t,r),this.emit("start",r,this._clock.getSecondsAtTime(r))}else this.emit("ticks",e),this._clock.setTicksAtTime(t,e)}}getTicksAtTime(t){return this._clock.getTicksAtTime(t)}getSecondsAtTime(t){return this._clock.getSecondsAtTime(t)}get PPQ(){return this._clock.frequency.multiplier}set PPQ(t){this._clock.frequency.multiplier=t}nextSubdivision(t){if(t=this.toTicks(t),"started"!==this.state)return 0;{const e=this.now(),n=t-this.getTicksAtTime(e)%t;return this._clock.nextTickTime(n,e)}}syncSignal(t,e){const n=this.now();let r=this.bpm,i=1/(60/r.getValueAtTime(n)/this.PPQ),o=[];if("time"===t.units){const t=1/64/i,e=new id(t),n=new vd(-1),s=new id(t);r.chain(e,n,s),r=s,i=1/i,o=[e,n,s]}e||(e=0!==t.getValueAtTime(n)?t.getValueAtTime(n)/i:0);const s=new id(e);return r.connect(s),s.connect(t._param),o.push(s),this._syncedSignals.push({initial:t.value,nodes:o,signal:t}),t.value=0,this}unsyncSignal(t){for(let e=this._syncedSignals.length-1;e>=0;e--){const n=this._syncedSignals[e];n.signal===t&&(n.nodes.forEach(t=>t.dispose()),n.signal.value=n.initial,this._syncedSignals.splice(e,1))}return this}dispose(){return super.dispose(),this._clock.dispose(),$h(this,"bpm"),this._timeline.dispose(),this._repeatedEvents.dispose(),this}}Ph.mixin(Md),Ih(t=>{t.transport=new Md({context:t})}),Rh(t=>{t.transport.dispose()});class Nd extends td{constructor(t){super(t),this.input=void 0,this._state=new Td("stopped"),this._synced=!1,this._scheduled=[],this._syncedStart=Bh,this._syncedStop=Bh,this._state.memory=100,this._state.increasing=!0,this._volume=this.output=new fd({context:this.context,mute:t.mute,volume:t.volume}),this.volume=this._volume.volume,Fh(this,"volume"),this.onstop=t.onstop}static getDefaults(){return Object.assign(td.getDefaults(),{mute:!1,onstop:Bh,volume:0})}get state(){return this._synced?"started"===this.context.transport.state?this._state.getValueAtTime(this.context.transport.seconds):"stopped":this._state.getValueAtTime(this.now())}get mute(){return this._volume.mute}set mute(t){this._volume.mute=t}_clampToCurrentTime(t){return this._synced?t:Math.max(t,this.context.currentTime)}start(t,e,n){let r=th(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(r=this._clampToCurrentTime(r),this._synced||"started"!==this._state.getValueAtTime(r))if(this.log("start",r),this._state.setStateAtTime("started",r),this._synced){const t=this._state.get(r);t&&(t.offset=this.toSeconds(lh(e,0)),t.duration=n?this.toSeconds(n):void 0);const i=this.context.transport.schedule(t=>{this._start(t,e,n)},r);this._scheduled.push(i),"started"===this.context.transport.state&&this.context.transport.getSecondsAtTime(this.immediate())>r&&this._syncedStart(this.now(),this.context.transport.seconds)}else mh(this.context),this._start(r,e,n);else ph(Sh(r,this._state.get(r).time),"Start time must be strictly greater than previous start time"),this._state.cancel(r),this._state.setStateAtTime("started",r),this.log("restart",r),this.restart(r,e,n);return this}stop(t){let e=th(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(e=this._clampToCurrentTime(e),"started"===this._state.getValueAtTime(e)||eh(this._state.getNextState("started",e))){if(this.log("stop",e),this._synced){const t=this.context.transport.schedule(this._stop.bind(this),e);this._scheduled.push(t)}else this._stop(e);this._state.cancel(e),this._state.setStateAtTime("stopped",e)}return this}restart(t,e,n){return t=this.toSeconds(t),"started"===this._state.getValueAtTime(t)&&(this._state.cancel(t),this._restart(t,e,n)),this}sync(){return this._synced||(this._synced=!0,this._syncedStart=(t,e)=>{if(Sh(e,0)){const n=this._state.get(e);if(n&&"started"===n.state&&n.time!==e){const r=e-this.toSeconds(n.time);let i;n.duration&&(i=this.toSeconds(n.duration)-r),this._start(t,this.toSeconds(n.offset)+r,i)}}},this._syncedStop=t=>{const e=this.context.transport.getSecondsAtTime(Math.max(t-this.sampleTime,0));"started"===this._state.getValueAtTime(e)&&this._stop(t)},this.context.transport.on("start",this._syncedStart),this.context.transport.on("loopStart",this._syncedStart),this.context.transport.on("stop",this._syncedStop),this.context.transport.on("pause",this._syncedStop),this.context.transport.on("loopEnd",this._syncedStop)),this}unsync(){return this._synced&&(this.context.transport.off("stop",this._syncedStop),this.context.transport.off("pause",this._syncedStop),this.context.transport.off("loopEnd",this._syncedStop),this.context.transport.off("start",this._syncedStart),this.context.transport.off("loopStart",this._syncedStart)),this._synced=!1,this._scheduled.forEach(t=>this.context.transport.clear(t)),this._scheduled=[],this._state.cancel(0),this._stop(0),this}dispose(){return super.dispose(),this.onstop=Bh,this.unsync(),this._volume.dispose(),this._state.dispose(),this}}class Id extends _d{constructor(){super(...arguments),this.name="AudioToGain",this._norm=new yd({context:this.context,mapping:t=>(t+1)/2}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class jd extends ad{constructor(){const t=ch(jd.getDefaults(),arguments,["value"]);super(t),this.name="Multiply",this.override=!1,this._mult=this.input=this.output=new id({context:this.context,minValue:t.minValue,maxValue:t.maxValue}),this.factor=this._param=this._mult.gain,this.factor.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(ad.getDefaults(),{value:0})}dispose(){return super.dispose(),this._mult.dispose(),this}}function Rd(t,e){return a(this,void 0,void 0,function*(){const n=e/t.context.sampleRate,r=new Uh(1,n,t.context.sampleRate);new t.constructor(Object.assign(t.get(),{frequency:2/n,detune:0,context:r})).toDestination().start(0);return(yield r.render()).getChannelData(0)})}class Pd extends od{constructor(){const t=ch(Pd.getDefaults(),arguments,["frequency","type"]);super(t),this.name="ToneOscillatorNode",this._oscillator=this.context.createOscillator(),this._internalChannels=[this._oscillator],nd(this._oscillator,this._gainNode),this.type=t.type,this.frequency=new Yh({context:this.context,param:this._oscillator.frequency,units:"frequency",value:t.frequency}),this.detune=new Yh({context:this.context,param:this._oscillator.detune,units:"cents",value:t.detune}),Fh(this,["frequency","detune"])}static getDefaults(){return Object.assign(od.getDefaults(),{detune:0,frequency:440,type:"sine"})}start(t){const e=this.toSeconds(t);return this.log("start",e),this._startGain(e),this._oscillator.start(e),this}_stopSource(t){this._oscillator.stop(t)}setPeriodicWave(t){return this._oscillator.setPeriodicWave(t),this}get type(){return this._oscillator.type}set type(t){this._oscillator.type=t}dispose(){return super.dispose(),"started"===this.state&&this.stop(),this._oscillator.disconnect(),this.frequency.dispose(),this.detune.dispose(),this}}class Dd extends Nd{constructor(){const t=ch(Dd.getDefaults(),arguments,["frequency","type"]);super(t),this.name="Oscillator",this._oscillator=null,this.frequency=new ad({context:this.context,units:"frequency",value:t.frequency}),Fh(this,"frequency"),this.detune=new ad({context:this.context,units:"cents",value:t.detune}),Fh(this,"detune"),this._partials=t.partials,this._partialCount=t.partialCount,this._type=t.type,t.partialCount&&"custom"!==t.type&&(this._type=this.baseType+t.partialCount.toString()),this.phase=t.phase}static getDefaults(){return Object.assign(Nd.getDefaults(),{detune:0,frequency:440,partialCount:0,partials:[],phase:0,type:"sine"})}_start(t){const e=this.toSeconds(t),n=new Pd({context:this.context,onended:()=>this.onstop(this)});this._oscillator=n,this._wave?this._oscillator.setPeriodicWave(this._wave):this._oscillator.type=this._type,this._oscillator.connect(this.output),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.start(e)}_stop(t){const e=this.toSeconds(t);this._oscillator&&this._oscillator.stop(e)}_restart(t){const e=this.toSeconds(t);return this.log("restart",e),this._oscillator&&this._oscillator.cancelStop(),this._state.cancel(e),this}syncFrequency(){return this.context.transport.syncSignal(this.frequency),this}unsyncFrequency(){return this.context.transport.unsyncSignal(this.frequency),this}_getCachedPeriodicWave(){if("custom"===this._type){return Dd._periodicWaveCache.find(t=>{return t.phase===this._phase&&(e=t.partials,n=this._partials,e.length===n.length&&e.every((t,e)=>n[e]===t));var e,n})}{const t=Dd._periodicWaveCache.find(t=>t.type===this._type&&t.phase===this._phase);return this._partialCount=t?t.partialCount:this._partialCount,t}}get type(){return this._type}set type(t){this._type=t;const e=-1!==["sine","square","sawtooth","triangle"].indexOf(t);if(0===this._phase&&e)this._wave=void 0,this._partialCount=0,null!==this._oscillator&&(this._oscillator.type=t);else{const e=this._getCachedPeriodicWave();if(eh(e)){const{partials:t,wave:n}=e;this._wave=n,this._partials=t,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave)}else{const[e,n]=this._getRealImaginary(t,this._phase),r=this.context.createPeriodicWave(e,n);this._wave=r,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave),Dd._periodicWaveCache.push({imag:n,partialCount:this._partialCount,partials:this._partials,phase:this._phase,real:e,type:this._type,wave:this._wave}),Dd._periodicWaveCache.length>100&&Dd._periodicWaveCache.shift()}}}get baseType(){return this._type.replace(this.partialCount.toString(),"")}set baseType(t){this.partialCount&&"custom"!==this._type&&"custom"!==t?this.type=t+this.partialCount:this.type=t}get partialCount(){return this._partialCount}set partialCount(t){fh(t,0);let e=this._type;const n=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(this._type);if(n&&(e=n[1]),"custom"!==this._type)this.type=0===t?e:e+t.toString();else{const e=new Float32Array(t);this._partials.forEach((t,n)=>e[n]=t),this._partials=Array.from(e),this.type=this._type}}_getRealImaginary(t,e){let n=2048;const r=new Float32Array(n),i=new Float32Array(n);let o=1;if("custom"===t){if(o=this._partials.length+1,this._partialCount=this._partials.length,n=o,0===this._partials.length)return[r,i]}else{const e=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(t);e?(o=parseInt(e[2],10)+1,this._partialCount=parseInt(e[2],10),t=e[1],o=Math.max(o,2),n=o):this._partialCount=0,this._partials=[]}for(let s=1;s<n;++s){const n=2/(s*Math.PI);let a;switch(t){case"sine":a=s<=o?1:0,this._partials[s-1]=a;break;case"square":a=1&s?2*n:0,this._partials[s-1]=a;break;case"sawtooth":a=n*(1&s?1:-1),this._partials[s-1]=a;break;case"triangle":a=1&s?n*n*2*(s-1>>1&1?-1:1):0,this._partials[s-1]=a;break;case"custom":a=this._partials[s-1];break;default:throw new TypeError("Oscillator: invalid type: "+t)}0!==a?(r[s]=-a*Math.sin(e*s),i[s]=a*Math.cos(e*s)):(r[s]=0,i[s]=0)}return[r,i]}_inverseFFT(t,e,n){let r=0;const i=t.length;for(let o=0;o<i;o++)r+=t[o]*Math.cos(o*n)+e[o]*Math.sin(o*n);return r}getInitialValue(){const[t,e]=this._getRealImaginary(this._type,0);let n=0;const r=2*Math.PI;for(let i=0;i<32;i++)n=Math.max(this._inverseFFT(t,e,i/32*r),n);return function(t,e,n){return Math.max(Math.min(t,n),e)}(-this._inverseFFT(t,e,this._phase)/n,-1,1)}get partials(){return this._partials.slice(0,this.partialCount)}set partials(t){this._partials=t,this._partialCount=this._partials.length,t.length&&(this.type="custom")}get phase(){return this._phase*(180/Math.PI)}set phase(t){this._phase=t*Math.PI/180,this.type=this._type}asArray(){return a(this,arguments,void 0,function*(t=1024){return Rd(this,t)})}dispose(){return super.dispose(),null!==this._oscillator&&this._oscillator.dispose(),this._wave=void 0,this.frequency.dispose(),this.detune.dispose(),this}}Dd._periodicWaveCache=[];class Ld extends Nd{constructor(){const t=ch(Ld.getDefaults(),arguments,["frequency","type","modulationType"]);super(t),this.name="AMOscillator",this._modulationScale=new Id({context:this.context}),this._modulationNode=new id({context:this.context}),this._carrier=new Dd({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase,type:t.type}),this.frequency=this._carrier.frequency,this.detune=this._carrier.detune,this._modulator=new Dd({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new jd({context:this.context,units:"positive",value:t.harmonicity}),this.frequency.chain(this.harmonicity,this._modulator.frequency),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output),Fh(this,["frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Dd.getDefaults(),{harmonicity:1,modulationType:"square"})}_start(t){this._modulator.start(t),this._carrier.start(t)}_stop(t){this._modulator.stop(t),this._carrier.stop(t)}_restart(t){this._modulator.restart(t),this._carrier.restart(t)}get type(){return this._carrier.type}set type(t){this._carrier.type=t}get baseType(){return this._carrier.baseType}set baseType(t){this._carrier.baseType=t}get partialCount(){return this._carrier.partialCount}set partialCount(t){this._carrier.partialCount=t}get modulationType(){return this._modulator.type}set modulationType(t){this._modulator.type=t}get phase(){return this._carrier.phase}set phase(t){this._carrier.phase=t,this._modulator.phase=t}get partials(){return this._carrier.partials}set partials(t){this._carrier.partials=t}asArray(){return a(this,arguments,void 0,function*(t=1024){return Rd(this,t)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this._modulationScale.dispose(),this}}class Fd extends Nd{constructor(){const t=ch(Fd.getDefaults(),arguments,["frequency","type","spread"]);super(t),this.name="FatOscillator",this._oscillators=[],this.frequency=new ad({context:this.context,units:"frequency",value:t.frequency}),this.detune=new ad({context:this.context,units:"cents",value:t.detune}),this._spread=t.spread,this._type=t.type,this._phase=t.phase,this._partials=t.partials,this._partialCount=t.partialCount,this.count=t.count,Fh(this,["frequency","detune"])}static getDefaults(){return Object.assign(Dd.getDefaults(),{count:3,spread:20,type:"sawtooth"})}_start(t){t=this.toSeconds(t),this._forEach(e=>e.start(t))}_stop(t){t=this.toSeconds(t),this._forEach(e=>e.stop(t))}_restart(t){this._forEach(e=>e.restart(t))}_forEach(t){for(let e=0;e<this._oscillators.length;e++)t(this._oscillators[e],e)}get type(){return this._type}set type(t){this._type=t,this._forEach(e=>e.type=t)}get spread(){return this._spread}set spread(t){if(this._spread=t,this._oscillators.length>1){const e=-t/2,n=t/(this._oscillators.length-1);this._forEach((t,r)=>t.detune.value=e+n*r)}}get count(){return this._oscillators.length}set count(t){if(fh(t,1),this._oscillators.length!==t){this._forEach(t=>t.dispose()),this._oscillators=[];for(let e=0;e<t;e++){const n=new Dd({context:this.context,volume:-6-1.1*t,type:this._type,phase:this._phase+e/t*360,partialCount:this._partialCount,onstop:0===e?()=>this.onstop(this):Bh});"custom"===this.type&&(n.partials=this._partials),this.frequency.connect(n.frequency),this.detune.connect(n.detune),n.detune.overridden=!1,n.connect(this.output),this._oscillators[e]=n}this.spread=this._spread,"started"===this.state&&this._forEach(t=>t.start())}}get phase(){return this._phase}set phase(t){this._phase=t,this._forEach((t,e)=>t.phase=this._phase+e/this.count*360)}get baseType(){return this._oscillators[0].baseType}set baseType(t){this._forEach(e=>e.baseType=t),this._type=this._oscillators[0].type}get partials(){return this._oscillators[0].partials}set partials(t){this._partials=t,this._partialCount=this._partials.length,t.length&&(this._type="custom",this._forEach(e=>e.partials=t))}get partialCount(){return this._oscillators[0].partialCount}set partialCount(t){this._partialCount=t,this._forEach(e=>e.partialCount=t),this._type=this._oscillators[0].type}asArray(){return a(this,arguments,void 0,function*(t=1024){return Rd(this,t)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this._forEach(t=>t.dispose()),this}}class $d extends Nd{constructor(){const t=ch($d.getDefaults(),arguments,["frequency","type","modulationType"]);super(t),this.name="FMOscillator",this._modulationNode=new id({context:this.context,gain:0}),this._carrier=new Dd({context:this.context,detune:t.detune,frequency:0,onstop:()=>this.onstop(this),phase:t.phase,type:t.type}),this.detune=this._carrier.detune,this.frequency=new ad({context:this.context,units:"frequency",value:t.frequency}),this._modulator=new Dd({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new jd({context:this.context,units:"positive",value:t.harmonicity}),this.modulationIndex=new jd({context:this.context,units:"positive",value:t.modulationIndex}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output),this.detune.connect(this._modulator.detune),Fh(this,["modulationIndex","frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Dd.getDefaults(),{harmonicity:1,modulationIndex:2,modulationType:"square"})}_start(t){this._modulator.start(t),this._carrier.start(t)}_stop(t){this._modulator.stop(t),this._carrier.stop(t)}_restart(t){return this._modulator.restart(t),this._carrier.restart(t),this}get type(){return this._carrier.type}set type(t){this._carrier.type=t}get baseType(){return this._carrier.baseType}set baseType(t){this._carrier.baseType=t}get partialCount(){return this._carrier.partialCount}set partialCount(t){this._carrier.partialCount=t}get modulationType(){return this._modulator.type}set modulationType(t){this._modulator.type=t}get phase(){return this._carrier.phase}set phase(t){this._carrier.phase=t,this._modulator.phase=t}get partials(){return this._carrier.partials}set partials(t){this._carrier.partials=t}asArray(){return a(this,arguments,void 0,function*(t=1024){return Rd(this,t)})}dispose(){return super.dispose(),this.frequency.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this.modulationIndex.dispose(),this}}class Bd extends Nd{constructor(){const t=ch(Bd.getDefaults(),arguments,["frequency","width"]);super(t),this.name="PulseOscillator",this._widthGate=new id({context:this.context,gain:0}),this._thresh=new yd({context:this.context,mapping:t=>t<=0?-1:1}),this.width=new ad({context:this.context,units:"audioRange",value:t.width}),this._triangle=new Dd({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase,type:"triangle"}),this.frequency=this._triangle.frequency,this.detune=this._triangle.detune,this._triangle.chain(this._thresh,this.output),this.width.chain(this._widthGate,this._thresh),Fh(this,["width","frequency","detune"])}static getDefaults(){return Object.assign(Nd.getDefaults(),{detune:0,frequency:440,phase:0,type:"pulse",width:.2})}_start(t){t=this.toSeconds(t),this._triangle.start(t),this._widthGate.gain.setValueAtTime(1,t)}_stop(t){t=this.toSeconds(t),this._triangle.stop(t),this._widthGate.gain.cancelScheduledValues(t),this._widthGate.gain.setValueAtTime(0,t)}_restart(t){this._triangle.restart(t),this._widthGate.gain.cancelScheduledValues(t),this._widthGate.gain.setValueAtTime(1,t)}get phase(){return this._triangle.phase}set phase(t){this._triangle.phase=t}get type(){return"pulse"}get baseType(){return"pulse"}get partials(){return[]}get partialCount(){return 0}set carrierType(t){this._triangle.type=t}asArray(){return a(this,arguments,void 0,function*(t=1024){return Rd(this,t)})}dispose(){return super.dispose(),this._triangle.dispose(),this.width.dispose(),this._widthGate.dispose(),this._thresh.dispose(),this}}class qd extends Nd{constructor(){const t=ch(qd.getDefaults(),arguments,["frequency","modulationFrequency"]);super(t),this.name="PWMOscillator",this.sourceType="pwm",this._scale=new jd({context:this.context,value:2}),this._pulse=new Bd({context:this.context,frequency:t.modulationFrequency}),this._pulse.carrierType="sine",this.modulationFrequency=this._pulse.frequency,this._modulator=new Dd({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase}),this.frequency=this._modulator.frequency,this.detune=this._modulator.detune,this._modulator.chain(this._scale,this._pulse.width),this._pulse.connect(this.output),Fh(this,["modulationFrequency","frequency","detune"])}static getDefaults(){return Object.assign(Nd.getDefaults(),{detune:0,frequency:440,modulationFrequency:.4,phase:0,type:"pwm"})}_start(t){t=this.toSeconds(t),this._modulator.start(t),this._pulse.start(t)}_stop(t){t=this.toSeconds(t),this._modulator.stop(t),this._pulse.stop(t)}_restart(t){this._modulator.restart(t),this._pulse.restart(t)}get type(){return"pwm"}get baseType(){return"pwm"}get partials(){return[]}get partialCount(){return 0}get phase(){return this._modulator.phase}set phase(t){this._modulator.phase=t}asArray(){return a(this,arguments,void 0,function*(t=1024){return Rd(this,t)})}dispose(){return super.dispose(),this._pulse.dispose(),this._scale.dispose(),this._modulator.dispose(),this}}const Ud={am:Ld,fat:Fd,fm:$d,oscillator:Dd,pulse:Bd,pwm:qd};class Vd extends Nd{constructor(){const t=ch(Vd.getDefaults(),arguments,["frequency","type"]);super(t),this.name="OmniOscillator",this.frequency=new ad({context:this.context,units:"frequency",value:t.frequency}),this.detune=new ad({context:this.context,units:"cents",value:t.detune}),Fh(this,["frequency","detune"]),this.set(t)}static getDefaults(){return Object.assign(Dd.getDefaults(),$d.getDefaults(),Ld.getDefaults(),Fd.getDefaults(),Bd.getDefaults(),qd.getDefaults())}_start(t){this._oscillator.start(t)}_stop(t){this._oscillator.stop(t)}_restart(t){return this._oscillator.restart(t),this}get type(){let t="";return["am","fm","fat"].some(t=>this._sourceType===t)&&(t=this._sourceType),t+this._oscillator.type}set type(t){"fm"===t.substr(0,2)?(this._createNewOscillator("fm"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(2)):"am"===t.substr(0,2)?(this._createNewOscillator("am"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(2)):"fat"===t.substr(0,3)?(this._createNewOscillator("fat"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(3)):"pwm"===t?(this._createNewOscillator("pwm"),this._oscillator=this._oscillator):"pulse"===t?this._createNewOscillator("pulse"):(this._createNewOscillator("oscillator"),this._oscillator=this._oscillator,this._oscillator.type=t)}get partials(){return this._oscillator.partials}set partials(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||(this._oscillator.partials=t)}get partialCount(){return this._oscillator.partialCount}set partialCount(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||(this._oscillator.partialCount=t)}set(t){return Reflect.has(t,"type")&&t.type&&(this.type=t.type),super.set(t),this}_createNewOscillator(t){if(t!==this._sourceType){this._sourceType=t;const e=Ud[t],n=this.now();if(this._oscillator){const t=this._oscillator;t.stop(n),this.context.setTimeout(()=>t.dispose(),this.blockTime)}this._oscillator=new e({context:this.context}),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.connect(this.output),this._oscillator.onstop=()=>this.onstop(this),"started"===this.state&&this._oscillator.start(n)}}get phase(){return this._oscillator.phase}set phase(t){this._oscillator.phase=t}get sourceType(){return this._sourceType}set sourceType(t){let e="sine";"pwm"!==this._oscillator.type&&"pulse"!==this._oscillator.type&&(e=this._oscillator.type),"fm"===t?this.type="fm"+e:"am"===t?this.type="am"+e:"fat"===t?this.type="fat"+e:"oscillator"===t?this.type=e:"pulse"===t?this.type="pulse":"pwm"===t&&(this.type="pwm")}_getOscType(t,e){return t instanceof Ud[e]}get baseType(){return this._oscillator.baseType}set baseType(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||"pulse"===t||"pwm"===t||(this._oscillator.baseType=t)}get width(){return this._getOscType(this._oscillator,"pulse")?this._oscillator.width:void 0}get count(){return this._getOscType(this._oscillator,"fat")?this._oscillator.count:void 0}set count(t){this._getOscType(this._oscillator,"fat")&&nh(t)&&(this._oscillator.count=t)}get spread(){return this._getOscType(this._oscillator,"fat")?this._oscillator.spread:void 0}set spread(t){this._getOscType(this._oscillator,"fat")&&nh(t)&&(this._oscillator.spread=t)}get modulationType(){return this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am")?this._oscillator.modulationType:void 0}set modulationType(t){(this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am"))&&oh(t)&&(this._oscillator.modulationType=t)}get modulationIndex(){return this._getOscType(this._oscillator,"fm")?this._oscillator.modulationIndex:void 0}get harmonicity(){return this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am")?this._oscillator.harmonicity:void 0}get modulationFrequency(){return this._getOscType(this._oscillator,"pwm")?this._oscillator.modulationFrequency:void 0}asArray(){return a(this,arguments,void 0,function*(t=1024){return Rd(this,t)})}dispose(){return super.dispose(),this.detune.dispose(),this.frequency.dispose(),this._oscillator.dispose(),this}}class Gd extends td{constructor(){const t=ch(Gd.getDefaults(),arguments);super(t),this._scheduledEvents=[],this._synced=!1,this._original_triggerAttack=this.triggerAttack,this._original_triggerRelease=this.triggerRelease,this._syncedRelease=t=>this._original_triggerRelease(t),this._volume=this.output=new fd({context:this.context,volume:t.volume}),this.volume=this._volume.volume,Fh(this,"volume")}static getDefaults(){return Object.assign(td.getDefaults(),{volume:0})}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",0),this.context.transport.on("stop",this._syncedRelease),this.context.transport.on("pause",this._syncedRelease),this.context.transport.on("loopEnd",this._syncedRelease)),this}_syncState(){let t=!1;return this._synced||(this._synced=!0,t=!0),t}_syncMethod(t,e){const n=this["_original_"+t]=this[t];this[t]=(...t)=>{const r=t[e],i=this.context.transport.schedule(r=>{t[e]=r,n.apply(this,t)},r);this._scheduledEvents.push(i)}}unsync(){return this._scheduledEvents.forEach(t=>this.context.transport.clear(t)),this._scheduledEvents=[],this._synced&&(this._synced=!1,this.triggerAttack=this._original_triggerAttack,this.triggerRelease=this._original_triggerRelease,this.context.transport.off("stop",this._syncedRelease),this.context.transport.off("pause",this._syncedRelease),this.context.transport.off("loopEnd",this._syncedRelease)),this}triggerAttackRelease(t,e,n,r){const i=this.toSeconds(n),o=this.toSeconds(e);return this.triggerAttack(t,i,r),this.triggerRelease(i+o),this}dispose(){return super.dispose(),this._volume.dispose(),this.unsync(),this._scheduledEvents=[],this}}class zd extends Gd{constructor(){const t=ch(zd.getDefaults(),arguments);super(t),this.portamento=t.portamento,this.onsilence=t.onsilence}static getDefaults(){return Object.assign(Gd.getDefaults(),{detune:0,onsilence:Bh,portamento:0})}triggerAttack(t,e,n=1){this.log("triggerAttack",t,e,n);const r=this.toSeconds(e);return this._triggerEnvelopeAttack(r,n),this.setNote(t,r),this}triggerRelease(t){this.log("triggerRelease",t);const e=this.toSeconds(t);return this._triggerEnvelopeRelease(e),this}setNote(t,e){const n=this.toSeconds(e),r=t instanceof Hh?t.toFrequency():t;if(this.portamento>0&&this.getLevelAtTime(n)>.05){const t=this.toSeconds(this.portamento);this.frequency.exponentialRampTo(r,t,n)}else this.frequency.setValueAtTime(r,n);return this}}s([ld(0)],zd.prototype,"portamento",void 0);class Wd extends zd{constructor(){const t=ch(Wd.getDefaults(),arguments);super(t),this.name="Synth",this.oscillator=new Vd(Object.assign({context:this.context,detune:t.detune,onstop:()=>this.onsilence(this)},t.oscillator)),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.envelope=new pd(Object.assign({context:this.context},t.envelope)),this.oscillator.chain(this.envelope,this.output),Fh(this,["oscillator","frequency","detune","envelope"])}static getDefaults(){return Object.assign(zd.getDefaults(),{envelope:Object.assign(hh(hd.getDefaults(),Object.keys(td.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.3}),oscillator:Object.assign(hh(Vd.getDefaults(),[...Object.keys(Nd.getDefaults()),"frequency","detune"]),{type:"triangle"})})}_triggerEnvelopeAttack(t,e){if(this.envelope.triggerAttack(t,e),this.oscillator.start(t),0===this.envelope.sustain){const e=this.toSeconds(this.envelope.attack),n=this.toSeconds(this.envelope.decay);this.oscillator.stop(t+e+n)}}_triggerEnvelopeRelease(t){this.envelope.triggerRelease(t),this.oscillator.stop(t+this.toSeconds(this.envelope.release))}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}dispose(){return super.dispose(),this.oscillator.dispose(),this.envelope.dispose(),this}}class Jd extends zd{constructor(){const t=ch(Jd.getDefaults(),arguments);super(t),this.name="ModulationSynth",this._carrier=new Wd({context:this.context,oscillator:t.oscillator,envelope:t.envelope,onsilence:()=>this.onsilence(this),volume:-10}),this._modulator=new Wd({context:this.context,oscillator:t.modulation,envelope:t.modulationEnvelope,volume:-10}),this.oscillator=this._carrier.oscillator,this.envelope=this._carrier.envelope,this.modulation=this._modulator.oscillator,this.modulationEnvelope=this._modulator.envelope,this.frequency=new ad({context:this.context,units:"frequency"}),this.detune=new ad({context:this.context,value:t.detune,units:"cents"}),this.harmonicity=new jd({context:this.context,value:t.harmonicity,minValue:0}),this._modulationNode=new id({context:this.context,gain:0}),Fh(this,["frequency","harmonicity","oscillator","envelope","modulation","modulationEnvelope","detune"])}static getDefaults(){return Object.assign(zd.getDefaults(),{harmonicity:3,oscillator:Object.assign(hh(Vd.getDefaults(),[...Object.keys(Nd.getDefaults()),"frequency","detune"]),{type:"sine"}),envelope:Object.assign(hh(hd.getDefaults(),Object.keys(td.getDefaults())),{attack:.01,decay:.01,sustain:1,release:.5}),modulation:Object.assign(hh(Vd.getDefaults(),[...Object.keys(Nd.getDefaults()),"frequency","detune"]),{type:"square"}),modulationEnvelope:Object.assign(hh(hd.getDefaults(),Object.keys(td.getDefaults())),{attack:.5,decay:0,sustain:1,release:.5})})}_triggerEnvelopeAttack(t,e){this._carrier._triggerEnvelopeAttack(t,e),this._modulator._triggerEnvelopeAttack(t,e)}_triggerEnvelopeRelease(t){return this._carrier._triggerEnvelopeRelease(t),this._modulator._triggerEnvelopeRelease(t),this}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}dispose(){return super.dispose(),this._carrier.dispose(),this._modulator.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._modulationNode.dispose(),this}}class Hd extends Jd{constructor(){super(ch(Hd.getDefaults(),arguments)),this.name="AMSynth",this._modulationScale=new Id({context:this.context}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.detune.fan(this._carrier.detune,this._modulator.detune),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output)}dispose(){return super.dispose(),this._modulationScale.dispose(),this}}class Xd extends td{constructor(){const t=ch(Xd.getDefaults(),arguments,["frequency","type"]);super(t),this.name="BiquadFilter",this._filter=this.context.createBiquadFilter(),this.input=this.output=this._filter,this.Q=new Yh({context:this.context,units:"number",value:t.Q,param:this._filter.Q}),this.frequency=new Yh({context:this.context,units:"frequency",value:t.frequency,param:this._filter.frequency}),this.detune=new Yh({context:this.context,units:"cents",value:t.detune,param:this._filter.detune}),this.gain=new Yh({context:this.context,units:"decibels",convert:!1,value:t.gain,param:this._filter.gain}),this.type=t.type}static getDefaults(){return Object.assign(td.getDefaults(),{Q:1,type:"lowpass",frequency:350,detune:0,gain:0})}get type(){return this._filter.type}set type(t){ph(-1!==["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t),`Invalid filter type: ${t}`),this._filter.type=t}getFrequencyResponse(t=128){const e=new Float32Array(t);for(let n=0;n<t;n++){const r=19980*Math.pow(n/t,2)+20;e[n]=r}const n=new Float32Array(t),r=new Float32Array(t),i=this.context.createBiquadFilter();return i.type=this.type,i.Q.value=this.Q.value,i.frequency.value=this.frequency.value,i.gain.value=this.gain.value,i.getFrequencyResponse(e,n,r),n}dispose(){return super.dispose(),this._filter.disconnect(),this.Q.dispose(),this.frequency.dispose(),this.gain.dispose(),this.detune.dispose(),this}}class Kd extends td{constructor(){const t=ch(Kd.getDefaults(),arguments,["frequency","type","rolloff"]);super(t),this.name="Filter",this.input=new id({context:this.context}),this.output=new id({context:this.context}),this._filters=[],this._filters=[],this.Q=new ad({context:this.context,units:"positive",value:t.Q}),this.frequency=new ad({context:this.context,units:"frequency",value:t.frequency}),this.detune=new ad({context:this.context,units:"cents",value:t.detune}),this.gain=new ad({context:this.context,units:"decibels",convert:!1,value:t.gain}),this._type=t.type,this.rolloff=t.rolloff,Fh(this,["detune","frequency","gain","Q"])}static getDefaults(){return Object.assign(td.getDefaults(),{Q:1,detune:0,frequency:350,gain:0,rolloff:-12,type:"lowpass"})}get type(){return this._type}set type(t){ph(-1!==["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t),`Invalid filter type: ${t}`),this._type=t,this._filters.forEach(e=>e.type=t)}get rolloff(){return this._rolloff}set rolloff(t){const e=nh(t)?t:parseInt(t,10),n=[-12,-24,-48,-96];let r=n.indexOf(e);ph(-1!==r,`rolloff can only be ${n.join(", ")}`),r+=1,this._rolloff=e,this.input.disconnect(),this._filters.forEach(t=>t.disconnect()),this._filters=new Array(r);for(let t=0;t<r;t++){const e=new Xd({context:this.context});e.type=this._type,this.frequency.connect(e.frequency),this.detune.connect(e.detune),this.Q.connect(e.Q),this.gain.connect(e.gain),this._filters[t]=e}this._internalChannels=this._filters,ed(this.input,...this._internalChannels,this.output)}getFrequencyResponse(t=128){const e=new Xd({context:this.context,frequency:this.frequency.value,gain:this.gain.value,Q:this.Q.value,type:this._type,detune:this.detune.value}),n=new Float32Array(t).map(()=>1);return this._filters.forEach(()=>{e.getFrequencyResponse(t).forEach((t,e)=>n[e]*=t)}),e.dispose(),n}dispose(){return super.dispose(),this._filters.forEach(t=>{t.dispose()}),$h(this,["detune","frequency","gain","Q"]),this.frequency.dispose(),this.Q.dispose(),this.detune.dispose(),this.gain.dispose(),this}}class Qd extends ad{constructor(){super(ch(Qd.getDefaults(),arguments,["value"])),this.override=!1,this.name="Add",this._sum=new id({context:this.context}),this.input=this._sum,this.output=this._sum,this.addend=this._param,ed(this._constantSource,this._sum)}static getDefaults(){return Object.assign(ad.getDefaults(),{value:0})}dispose(){return super.dispose(),this._sum.dispose(),this}}class Zd extends _d{constructor(){const t=ch(Zd.getDefaults(),arguments,["min","max"]);super(t),this.name="Scale",this._mult=this.input=new jd({context:this.context,value:t.max-t.min}),this._add=this.output=new Qd({context:this.context,value:t.min}),this._min=t.min,this._max=t.max,this.input.connect(this.output)}static getDefaults(){return Object.assign(_d.getDefaults(),{max:1,min:0})}get min(){return this._min}set min(t){this._min=t,this._setRange()}get max(){return this._max}set max(t){this._max=t,this._setRange()}_setRange(){this._add.value=this._min,this._mult.value=this._max-this._min}dispose(){return super.dispose(),this._add.dispose(),this._mult.dispose(),this}}class Yd extends hd{constructor(){const t=ch(Yd.getDefaults(),arguments,["attack","decay","sustain","release"]);super(t),this.name="FrequencyEnvelope",this._octaves=t.octaves,this._baseFrequency=this.toFrequency(t.baseFrequency),this._exponent=this.input=new vd({context:this.context,value:t.exponent}),this._scale=this.output=new Zd({context:this.context,min:this._baseFrequency,max:this._baseFrequency*Math.pow(2,this._octaves)}),this._sig.chain(this._exponent,this._scale)}static getDefaults(){return Object.assign(hd.getDefaults(),{baseFrequency:200,exponent:1,octaves:4})}get baseFrequency(){return this._baseFrequency}set baseFrequency(t){const e=this.toFrequency(t);fh(e,0),this._baseFrequency=e,this._scale.min=this._baseFrequency,this.octaves=this._octaves}get octaves(){return this._octaves}set octaves(t){this._octaves=t,this._scale.max=this._baseFrequency*Math.pow(2,t)}get exponent(){return this._exponent.value}set exponent(t){this._exponent.value=t}dispose(){return super.dispose(),this._exponent.dispose(),this._scale.dispose(),this}}class tp extends zd{constructor(){const t=ch(tp.getDefaults(),arguments);super(t),this.name="MonoSynth",this.oscillator=new Vd(Object.assign(t.oscillator,{context:this.context,detune:t.detune,onstop:()=>this.onsilence(this)})),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.filter=new Kd(Object.assign(t.filter,{context:this.context})),this.filterEnvelope=new Yd(Object.assign(t.filterEnvelope,{context:this.context})),this.envelope=new pd(Object.assign(t.envelope,{context:this.context})),this.oscillator.chain(this.filter,this.envelope,this.output),this.filterEnvelope.connect(this.filter.frequency),Fh(this,["oscillator","frequency","detune","filter","filterEnvelope","envelope"])}static getDefaults(){return Object.assign(zd.getDefaults(),{envelope:Object.assign(hh(hd.getDefaults(),Object.keys(td.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.9}),filter:Object.assign(hh(Kd.getDefaults(),Object.keys(td.getDefaults())),{Q:1,rolloff:-12,type:"lowpass"}),filterEnvelope:Object.assign(hh(Yd.getDefaults(),Object.keys(td.getDefaults())),{attack:.6,baseFrequency:200,decay:.2,exponent:2,octaves:3,release:2,sustain:.5}),oscillator:Object.assign(hh(Vd.getDefaults(),Object.keys(Nd.getDefaults())),{type:"sawtooth"})})}_triggerEnvelopeAttack(t,e=1){if(this.envelope.triggerAttack(t,e),this.filterEnvelope.triggerAttack(t),this.oscillator.start(t),0===this.envelope.sustain){const e=this.toSeconds(this.envelope.attack),n=this.toSeconds(this.envelope.decay);this.oscillator.stop(t+e+n)}}_triggerEnvelopeRelease(t){this.envelope.triggerRelease(t),this.filterEnvelope.triggerRelease(t),this.oscillator.stop(t+this.toSeconds(this.envelope.release))}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}dispose(){return super.dispose(),this.oscillator.dispose(),this.envelope.dispose(),this.filterEnvelope.dispose(),this.filter.dispose(),this}}class ep extends _d{constructor(){super(ch(ep.getDefaults(),arguments)),this.name="Zero",this._gain=new id({context:this.context}),this.output=this._gain,this.input=void 0,nd(this.context.getConstant(0),this._gain)}dispose(){return super.dispose(),rd(this.context.getConstant(0),this._gain),this}}class np extends td{constructor(){const t=ch(np.getDefaults(),arguments,["frequency","min","max"]);super(t),this.name="LFO",this._stoppedValue=0,this._units="number",this.convert=!0,this._fromType=Yh.prototype._fromType,this._toType=Yh.prototype._toType,this._is=Yh.prototype._is,this._clampValue=Yh.prototype._clampValue,this._oscillator=new Dd(t),this.frequency=this._oscillator.frequency,this._amplitudeGain=new id({context:this.context,gain:t.amplitude,units:"normalRange"}),this.amplitude=this._amplitudeGain.gain,this._stoppedSignal=new ad({context:this.context,units:"audioRange",value:0}),this._zeros=new ep({context:this.context}),this._a2g=new Id({context:this.context}),this._scaler=this.output=new Zd({context:this.context,max:t.max,min:t.min}),this.units=t.units,this.min=t.min,this.max=t.max,this._oscillator.chain(this._amplitudeGain,this._a2g,this._scaler),this._zeros.connect(this._a2g),this._stoppedSignal.connect(this._a2g),Fh(this,["amplitude","frequency"]),this.phase=t.phase}static getDefaults(){return Object.assign(Dd.getDefaults(),{amplitude:1,frequency:"4n",max:1,min:0,type:"sine",units:"number"})}start(t){return t=this.toSeconds(t),this._stoppedSignal.setValueAtTime(0,t),this._oscillator.start(t),this}stop(t){return t=this.toSeconds(t),this._stoppedSignal.setValueAtTime(this._stoppedValue,t),this._oscillator.stop(t),this}sync(){return this._oscillator.sync(),this._oscillator.syncFrequency(),this}unsync(){return this._oscillator.unsync(),this._oscillator.unsyncFrequency(),this}_setStoppedValue(){this._stoppedValue=this._oscillator.getInitialValue(),this._stoppedSignal.value=this._stoppedValue}get min(){return this._toType(this._scaler.min)}set min(t){t=this._fromType(t),this._scaler.min=t}get max(){return this._toType(this._scaler.max)}set max(t){t=this._fromType(t),this._scaler.max=t}get type(){return this._oscillator.type}set type(t){this._oscillator.type=t,this._setStoppedValue()}get partials(){return this._oscillator.partials}set partials(t){this._oscillator.partials=t,this._setStoppedValue()}get phase(){return this._oscillator.phase}set phase(t){this._oscillator.phase=t,this._setStoppedValue()}get units(){return this._units}set units(t){const e=this.min,n=this.max;this._units=t,this.min=e,this.max=n}get state(){return this._oscillator.state}connect(t,e,n){return(t instanceof Yh||t instanceof ad)&&(this.convert=t.convert,this.units=t.units),ud(this,t,e,n),this}dispose(){return super.dispose(),this._oscillator.dispose(),this._stoppedSignal.dispose(),this._zeros.dispose(),this._scaler.dispose(),this._a2g.dispose(),this._amplitudeGain.dispose(),this.amplitude.dispose(),this}}class rp extends zd{constructor(){const t=ch(rp.getDefaults(),arguments);super(t),this.name="DuoSynth",this.voice0=new tp(Object.assign(t.voice0,{context:this.context,onsilence:()=>this.onsilence(this)})),this.voice1=new tp(Object.assign(t.voice1,{context:this.context})),this.harmonicity=new jd({context:this.context,units:"positive",value:t.harmonicity}),this._vibrato=new np({frequency:t.vibratoRate,context:this.context,min:-50,max:50}),this._vibrato.start(),this.vibratoRate=this._vibrato.frequency,this._vibratoGain=new id({context:this.context,units:"normalRange",gain:t.vibratoAmount}),this.vibratoAmount=this._vibratoGain.gain,this.frequency=new ad({context:this.context,units:"frequency",value:440}),this.detune=new ad({context:this.context,units:"cents",value:t.detune}),this.frequency.connect(this.voice0.frequency),this.frequency.chain(this.harmonicity,this.voice1.frequency),this._vibrato.connect(this._vibratoGain),this._vibratoGain.fan(this.voice0.detune,this.voice1.detune),this.detune.fan(this.voice0.detune,this.voice1.detune),this.voice0.connect(this.output),this.voice1.connect(this.output),Fh(this,["voice0","voice1","frequency","vibratoAmount","vibratoRate"])}getLevelAtTime(t){return t=this.toSeconds(t),this.voice0.envelope.getValueAtTime(t)+this.voice1.envelope.getValueAtTime(t)}static getDefaults(){return uh(zd.getDefaults(),{vibratoAmount:.5,vibratoRate:5,harmonicity:1.5,voice0:uh(hh(tp.getDefaults(),Object.keys(zd.getDefaults())),{filterEnvelope:{attack:.01,decay:0,sustain:1,release:.5},envelope:{attack:.01,decay:0,sustain:1,release:.5}}),voice1:uh(hh(tp.getDefaults(),Object.keys(zd.getDefaults())),{filterEnvelope:{attack:.01,decay:0,sustain:1,release:.5},envelope:{attack:.01,decay:0,sustain:1,release:.5}})})}_triggerEnvelopeAttack(t,e){this.voice0._triggerEnvelopeAttack(t,e),this.voice1._triggerEnvelopeAttack(t,e)}_triggerEnvelopeRelease(t){return this.voice0._triggerEnvelopeRelease(t),this.voice1._triggerEnvelopeRelease(t),this}dispose(){return super.dispose(),this.voice0.dispose(),this.voice1.dispose(),this.frequency.dispose(),this.detune.dispose(),this._vibrato.dispose(),this.vibratoRate.dispose(),this._vibratoGain.dispose(),this.harmonicity.dispose(),this}}class ip extends Jd{constructor(){const t=ch(ip.getDefaults(),arguments);super(t),this.name="FMSynth",this.modulationIndex=new jd({context:this.context,value:t.modulationIndex}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this.detune.fan(this._carrier.detune,this._modulator.detune),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output)}static getDefaults(){return Object.assign(Jd.getDefaults(),{modulationIndex:10})}dispose(){return super.dispose(),this.modulationIndex.dispose(),this}}class op extends Wd{constructor(){const t=ch(op.getDefaults(),arguments);super(t),this.name="MembraneSynth",this.portamento=0,this.pitchDecay=t.pitchDecay,this.octaves=t.octaves,Fh(this,["oscillator","envelope"])}static getDefaults(){return uh(zd.getDefaults(),Wd.getDefaults(),{envelope:{attack:.001,attackCurve:"exponential",decay:.4,release:1.4,sustain:.01},octaves:10,oscillator:{type:"sine"},pitchDecay:.05})}setNote(t,e){const n=this.toSeconds(e),r=this.toFrequency(t instanceof Hh?t.toFrequency():t),i=r*this.octaves;return this.oscillator.frequency.setValueAtTime(i,n),this.oscillator.frequency.exponentialRampToValueAtTime(r,n+this.toSeconds(this.pitchDecay)),this}dispose(){return super.dispose(),this}}s([cd(0)],op.prototype,"octaves",void 0),s([ld(0)],op.prototype,"pitchDecay",void 0);const sp=[1,1.483,1.932,2.546,2.63,3.897];class ap extends zd{constructor(){const t=ch(ap.getDefaults(),arguments);super(t),this.name="MetalSynth",this._oscillators=[],this._freqMultipliers=[],this.detune=new ad({context:this.context,units:"cents",value:t.detune}),this.frequency=new ad({context:this.context,units:"frequency"}),this._amplitude=new id({context:this.context,gain:0}).connect(this.output),this._highpass=new Kd({Q:0,context:this.context,type:"highpass"}).connect(this._amplitude);for(let e=0;e<sp.length;e++){const n=new $d({context:this.context,harmonicity:t.harmonicity,modulationIndex:t.modulationIndex,modulationType:"square",onstop:0===e?()=>this.onsilence(this):Bh,type:"square"});n.connect(this._highpass),this._oscillators[e]=n;const r=new jd({context:this.context,value:sp[e]});this._freqMultipliers[e]=r,this.frequency.chain(r,n.frequency),this.detune.connect(n.detune)}this._filterFreqScaler=new Zd({context:this.context,max:7e3,min:this.toFrequency(t.resonance)}),this.envelope=new hd({attack:t.envelope.attack,attackCurve:"linear",context:this.context,decay:t.envelope.decay,release:t.envelope.release,sustain:0}),this.envelope.chain(this._filterFreqScaler,this._highpass.frequency),this.envelope.connect(this._amplitude.gain),this._octaves=t.octaves,this.octaves=t.octaves}static getDefaults(){return uh(zd.getDefaults(),{envelope:Object.assign(hh(hd.getDefaults(),Object.keys(td.getDefaults())),{attack:.001,decay:1.4,release:.2}),harmonicity:5.1,modulationIndex:32,octaves:1.5,resonance:4e3})}_triggerEnvelopeAttack(t,e=1){return this.envelope.triggerAttack(t,e),this._oscillators.forEach(e=>e.start(t)),0===this.envelope.sustain&&this._oscillators.forEach(e=>{e.stop(t+this.toSeconds(this.envelope.attack)+this.toSeconds(this.envelope.decay))}),this}_triggerEnvelopeRelease(t){return this.envelope.triggerRelease(t),this._oscillators.forEach(e=>e.stop(t+this.toSeconds(this.envelope.release))),this}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}get modulationIndex(){return this._oscillators[0].modulationIndex.value}set modulationIndex(t){this._oscillators.forEach(e=>e.modulationIndex.value=t)}get harmonicity(){return this._oscillators[0].harmonicity.value}set harmonicity(t){this._oscillators.forEach(e=>e.harmonicity.value=t)}get resonance(){return this._filterFreqScaler.min}set resonance(t){this._filterFreqScaler.min=this.toFrequency(t),this.octaves=this._octaves}get octaves(){return this._octaves}set octaves(t){this._octaves=t,this._filterFreqScaler.max=this._filterFreqScaler.min*Math.pow(2,t)}dispose(){return super.dispose(),this._oscillators.forEach(t=>t.dispose()),this._freqMultipliers.forEach(t=>t.dispose()),this.frequency.dispose(),this.detune.dispose(),this._filterFreqScaler.dispose(),this._amplitude.dispose(),this.envelope.dispose(),this._highpass.dispose(),this}}class up extends od{constructor(){const t=ch(up.getDefaults(),arguments,["url","onload"]);super(t),this.name="ToneBufferSource",this._source=this.context.createBufferSource(),this._internalChannels=[this._source],this._sourceStarted=!1,this._sourceStopped=!1,nd(this._source,this._gainNode),this._source.onended=()=>this._stopSource(),this.playbackRate=new Yh({context:this.context,param:this._source.playbackRate,units:"positive",value:t.playbackRate}),this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this._buffer=new qh(t.url,t.onload,t.onerror),this._internalChannels.push(this._source)}static getDefaults(){return Object.assign(od.getDefaults(),{url:new qh,loop:!1,loopEnd:0,loopStart:0,onload:Bh,onerror:Bh,playbackRate:1})}get fadeIn(){return this._fadeIn}set fadeIn(t){this._fadeIn=t}get fadeOut(){return this._fadeOut}set fadeOut(t){this._fadeOut=t}get curve(){return this._curve}set curve(t){this._curve=t}start(t,e,n,r=1){ph(this.buffer.loaded,"buffer is either not set or not loaded");const i=this.toSeconds(t);this._startGain(i,r),e=this.loop?lh(e,this.loopStart):lh(e,0);let o=Math.max(this.toSeconds(e),0);if(this.loop){const t=this.toSeconds(this.loopEnd)||this.buffer.duration,e=this.toSeconds(this.loopStart),n=t-e;Ah(o,t)&&(o=(o-e)%n+e),Oh(o,this.buffer.duration)&&(o=0)}if(this._source.buffer=this.buffer.get(),this._source.loopEnd=this.toSeconds(this.loopEnd)||this.buffer.duration,Eh(o,this.buffer.duration)&&(this._sourceStarted=!0,this._source.start(i,o)),eh(n)){let t=this.toSeconds(n);t=Math.max(t,0),this.stop(i+t)}return this}_stopSource(t){!this._sourceStopped&&this._sourceStarted&&(this._sourceStopped=!0,this._source.stop(this.toSeconds(t)),this._onended())}get loopStart(){return this._source.loopStart}set loopStart(t){this._source.loopStart=this.toSeconds(t)}get loopEnd(){return this._source.loopEnd}set loopEnd(t){this._source.loopEnd=this.toSeconds(t)}get buffer(){return this._buffer}set buffer(t){this._buffer.set(t)}get loop(){return this._source.loop}set loop(t){this._source.loop=t,this._sourceStarted&&this.cancelStop()}dispose(){return super.dispose(),this._source.onended=null,this._source.disconnect(),this._buffer.dispose(),this.playbackRate.dispose(),this}}class cp extends Nd{constructor(){const t=ch(cp.getDefaults(),arguments,["type"]);super(t),this.name="Noise",this._source=null,this._playbackRate=t.playbackRate,this.type=t.type,this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut}static getDefaults(){return Object.assign(Nd.getDefaults(),{fadeIn:0,fadeOut:0,playbackRate:1,type:"white"})}get type(){return this._type}set type(t){if(ph(t in dp,"Noise: invalid type: "+t),this._type!==t&&(this._type=t,"started"===this.state)){const t=this.now();this._stop(t),this._start(t)}}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._source&&(this._source.playbackRate.value=t)}_start(t){const e=dp[this._type];this._source=new up({url:e,context:this.context,fadeIn:this._fadeIn,fadeOut:this._fadeOut,loop:!0,onended:()=>this.onstop(this),playbackRate:this._playbackRate}).connect(this.output),this._source.start(this.toSeconds(t),Math.random()*(e.duration-.001))}_stop(t){this._source&&(this._source.stop(this.toSeconds(t)),this._source=null)}get fadeIn(){return this._fadeIn}set fadeIn(t){this._fadeIn=t,this._source&&(this._source.fadeIn=this._fadeIn)}get fadeOut(){return this._fadeOut}set fadeOut(t){this._fadeOut=t,this._source&&(this._source.fadeOut=this._fadeOut)}_restart(t){this._stop(t),this._start(t)}dispose(){return super.dispose(),this._source&&this._source.disconnect(),this}}const lp=220500,hp={brown:null,pink:null,white:null},dp={get brown(){if(!hp.brown){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(lp);t[e]=n;let r=0;for(let t=0;t<lp;t++){const e=2*Math.random()-1;n[t]=(r+.02*e)/1.02,r=n[t],n[t]*=3.5}}hp.brown=(new qh).fromArray(t)}return hp.brown},get pink(){if(!hp.pink){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(lp);let r,i,o,s,a,u,c;t[e]=n,r=i=o=s=a=u=c=0;for(let t=0;t<lp;t++){const e=2*Math.random()-1;r=.99886*r+.0555179*e,i=.99332*i+.0750759*e,o=.969*o+.153852*e,s=.8665*s+.3104856*e,a=.55*a+.5329522*e,u=-.7616*u-.016898*e,n[t]=r+i+o+s+a+u+c+.5362*e,n[t]*=.11,c=.115926*e}}hp.pink=(new qh).fromArray(t)}return hp.pink},get white(){if(!hp.white){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(lp);t[e]=n;for(let t=0;t<lp;t++)n[t]=2*Math.random()-1}hp.white=(new qh).fromArray(t)}return hp.white}};class pp extends Gd{constructor(){const t=ch(pp.getDefaults(),arguments);super(t),this.name="NoiseSynth",this.noise=new cp(Object.assign({context:this.context},t.noise)),this.envelope=new pd(Object.assign({context:this.context},t.envelope)),this.noise.chain(this.envelope,this.output)}static getDefaults(){return Object.assign(Gd.getDefaults(),{envelope:Object.assign(hh(hd.getDefaults(),Object.keys(td.getDefaults())),{decay:.1,sustain:0}),noise:Object.assign(hh(cp.getDefaults(),Object.keys(Nd.getDefaults())),{type:"white"})})}triggerAttack(t,e=1){return t=this.toSeconds(t),this.envelope.triggerAttack(t,e),this.noise.start(t),0===this.envelope.sustain&&this.noise.stop(t+this.toSeconds(this.envelope.attack)+this.toSeconds(this.envelope.decay)),this}triggerRelease(t){return t=this.toSeconds(t),this.envelope.triggerRelease(t),this.noise.stop(t+this.toSeconds(this.envelope.release)),this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",0),this._syncMethod("triggerRelease",0)),this}triggerAttackRelease(t,e,n=1){return e=this.toSeconds(e),t=this.toSeconds(t),this.triggerAttack(e,n),this.triggerRelease(e+t),this}dispose(){return super.dispose(),this.noise.dispose(),this.envelope.dispose(),this}}const fp=new Set;function mp(t){fp.add(t)}class gp extends td{constructor(t){super(t),this.name="ToneAudioWorklet",this.workletOptions={},this.onprocessorerror=Bh;const e=URL.createObjectURL(new Blob([Array.from(fp).join("\n")],{type:"text/javascript"})),n=this._audioWorkletName();this._dummyGain=this.context.createGain(),this._dummyParam=this._dummyGain.gain,this.context.addAudioWorkletModule(e).then(()=>{this.disposed||(this._worklet=this.context.createAudioWorkletNode(n,this.workletOptions),this._worklet.onprocessorerror=this.onprocessorerror.bind(this),this.onReady(this._worklet))})}dispose(){return super.dispose(),this._dummyGain.disconnect(),this._worklet&&(this._worklet.port.postMessage("dispose"),this._worklet.disconnect()),this}}mp('\n\t/**\n\t * The base AudioWorkletProcessor for use in Tone.js. Works with the {@link ToneAudioWorklet}. \n\t */\n\tclass ToneAudioWorkletProcessor extends AudioWorkletProcessor {\n\n\t\tconstructor(options) {\n\t\t\t\n\t\t\tsuper(options);\n\t\t\t/**\n\t\t\t * If the processor was disposed or not. Keep alive until it\'s disposed.\n\t\t\t */\n\t\t\tthis.disposed = false;\n\t\t \t/** \n\t\t\t * The number of samples in the processing block\n\t\t\t */\n\t\t\tthis.blockSize = 128;\n\t\t\t/**\n\t\t\t * the sample rate\n\t\t\t */\n\t\t\tthis.sampleRate = sampleRate;\n\n\t\t\tthis.port.onmessage = (event) => {\n\t\t\t\t// when it receives a dispose \n\t\t\t\tif (event.data === "dispose") {\n\t\t\t\t\tthis.disposed = true;\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n');mp("\n\t/**\n\t * Abstract class for a single input/output processor. \n\t * has a 'generate' function which processes one sample at a time\n\t */\n\tclass SingleIOProcessor extends ToneAudioWorkletProcessor {\n\n\t\tconstructor(options) {\n\t\t\tsuper(Object.assign(options, {\n\t\t\t\tnumberOfInputs: 1,\n\t\t\t\tnumberOfOutputs: 1\n\t\t\t}));\n\t\t\t/**\n\t\t\t * Holds the name of the parameter and a single value of that\n\t\t\t * parameter at the current sample\n\t\t\t * @type { [name: string]: number }\n\t\t\t */\n\t\t\tthis.params = {}\n\t\t}\n\n\t\t/**\n\t\t * Generate an output sample from the input sample and parameters\n\t\t * @abstract\n\t\t * @param input number\n\t\t * @param channel number\n\t\t * @param parameters { [name: string]: number }\n\t\t * @returns number\n\t\t */\n\t\tgenerate(){}\n\n\t\t/**\n\t\t * Update the private params object with the \n\t\t * values of the parameters at the given index\n\t\t * @param parameters { [name: string]: Float32Array },\n\t\t * @param index number\n\t\t */\n\t\tupdateParams(parameters, index) {\n\t\t\tfor (const paramName in parameters) {\n\t\t\t\tconst param = parameters[paramName];\n\t\t\t\tif (param.length > 1) {\n\t\t\t\t\tthis.params[paramName] = parameters[paramName][index];\n\t\t\t\t} else {\n\t\t\t\t\tthis.params[paramName] = parameters[paramName][0];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Process a single frame of the audio\n\t\t * @param inputs Float32Array[][]\n\t\t * @param outputs Float32Array[][]\n\t\t */\n\t\tprocess(inputs, outputs, parameters) {\n\t\t\tconst input = inputs[0];\n\t\t\tconst output = outputs[0];\n\t\t\t// get the parameter values\n\t\t\tconst channelCount = Math.max(input && input.length || 0, output.length);\n\t\t\tfor (let sample = 0; sample < this.blockSize; sample++) {\n\t\t\t\tthis.updateParams(parameters, sample);\n\t\t\t\tfor (let channel = 0; channel < channelCount; channel++) {\n\t\t\t\t\tconst inputSample = input && input.length ? input[channel][sample] : 0;\n\t\t\t\t\toutput[channel][sample] = this.generate(inputSample, channel, this.params);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn !this.disposed;\n\t\t}\n\t};\n");mp("\n\t/**\n\t * A multichannel buffer for use within an AudioWorkletProcessor as a delay line\n\t */\n\tclass DelayLine {\n\t\t\n\t\tconstructor(size, channels) {\n\t\t\tthis.buffer = [];\n\t\t\tthis.writeHead = []\n\t\t\tthis.size = size;\n\n\t\t\t// create the empty channels\n\t\t\tfor (let i = 0; i < channels; i++) {\n\t\t\t\tthis.buffer[i] = new Float32Array(this.size);\n\t\t\t\tthis.writeHead[i] = 0;\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Push a value onto the end\n\t\t * @param channel number\n\t\t * @param value number\n\t\t */\n\t\tpush(channel, value) {\n\t\t\tthis.writeHead[channel] += 1;\n\t\t\tif (this.writeHead[channel] > this.size) {\n\t\t\t\tthis.writeHead[channel] = 0;\n\t\t\t}\n\t\t\tthis.buffer[channel][this.writeHead[channel]] = value;\n\t\t}\n\n\t\t/**\n\t\t * Get the recorded value of the channel given the delay\n\t\t * @param channel number\n\t\t * @param delay number delay samples\n\t\t */\n\t\tget(channel, delay) {\n\t\t\tlet readHead = this.writeHead[channel] - Math.floor(delay);\n\t\t\tif (readHead < 0) {\n\t\t\t\treadHead += this.size;\n\t\t\t}\n\t\t\treturn this.buffer[channel][readHead];\n\t\t}\n\t}\n");const _p="feedback-comb-filter";!function(t,e){const n=`registerProcessor("${t}", ${e})`;fp.add(n)}(_p,'\n\tclass FeedbackCombFilterWorklet extends SingleIOProcessor {\n\n\t\tconstructor(options) {\n\t\t\tsuper(options);\n\t\t\tthis.delayLine = new DelayLine(this.sampleRate, options.channelCount || 2);\n\t\t}\n\n\t\tstatic get parameterDescriptors() {\n\t\t\treturn [{\n\t\t\t\tname: "delayTime",\n\t\t\t\tdefaultValue: 0.1,\n\t\t\t\tminValue: 0,\n\t\t\t\tmaxValue: 1,\n\t\t\t\tautomationRate: "k-rate"\n\t\t\t}, {\n\t\t\t\tname: "feedback",\n\t\t\t\tdefaultValue: 0.5,\n\t\t\t\tminValue: 0,\n\t\t\t\tmaxValue: 0.9999,\n\t\t\t\tautomationRate: "k-rate"\n\t\t\t}];\n\t\t}\n\n\t\tgenerate(input, channel, parameters) {\n\t\t\tconst delayedSample = this.delayLine.get(channel, parameters.delayTime * this.sampleRate);\n\t\t\tthis.delayLine.push(channel, input + delayedSample * parameters.feedback);\n\t\t\treturn delayedSample;\n\t\t}\n\t}\n');class yp extends gp{constructor(){const t=ch(yp.getDefaults(),arguments,["delayTime","resonance"]);super(t),this.name="FeedbackCombFilter",this.input=new id({context:this.context}),this.output=new id({context:this.context}),this.delayTime=new Yh({context:this.context,value:t.delayTime,units:"time",minValue:0,maxValue:1,param:this._dummyParam,swappable:!0}),this.resonance=new Yh({context:this.context,value:t.resonance,units:"normalRange",param:this._dummyParam,swappable:!0}),Fh(this,["resonance","delayTime"])}_audioWorkletName(){return _p}static getDefaults(){return Object.assign(td.getDefaults(),{delayTime:.1,resonance:.5})}onReady(t){ed(this.input,t,this.output);const e=t.parameters.get("delayTime");this.delayTime.setParam(e);const n=t.parameters.get("feedback");this.resonance.setParam(n)}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this.delayTime.dispose(),this.resonance.dispose(),this}}class vp extends td{constructor(){const t=ch(vp.getDefaults(),arguments,["frequency","type"]);super(t),this.name="OnePoleFilter",this._frequency=t.frequency,this._type=t.type,this.input=new id({context:this.context}),this.output=new id({context:this.context}),this._createFilter()}static getDefaults(){return Object.assign(td.getDefaults(),{frequency:880,type:"lowpass"})}_createFilter(){const t=this._filter,e=this.toFrequency(this._frequency),n=1/(2*Math.PI*e);if("lowpass"===this._type){const t=1/(n*this.context.sampleRate),e=t-1;this._filter=this.context.createIIRFilter([t,0],[1,e])}else{const t=1/(n*this.context.sampleRate)-1;this._filter=this.context.createIIRFilter([1,-1],[1,t])}this.input.chain(this._filter,this.output),t&&this.context.setTimeout(()=>{this.disposed||(this.input.disconnect(t),t.disconnect())},this.blockTime)}get frequency(){return this._frequency}set frequency(t){this._frequency=t,this._createFilter()}get type(){return this._type}set type(t){this._type=t,this._createFilter()}getFrequencyResponse(t=128){const e=new Float32Array(t);for(let n=0;n<t;n++){const r=19980*Math.pow(n/t,2)+20;e[n]=r}const n=new Float32Array(t),r=new Float32Array(t);return this._filter.getFrequencyResponse(e,n,r),n}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this._filter.disconnect(),this}}class bp extends td{constructor(){const t=ch(bp.getDefaults(),arguments,["delayTime","resonance","dampening"]);super(t),this.name="LowpassCombFilter",this._combFilter=this.output=new yp({context:this.context,delayTime:t.delayTime,resonance:t.resonance}),this.delayTime=this._combFilter.delayTime,this.resonance=this._combFilter.resonance,this._lowpass=this.input=new vp({context:this.context,frequency:t.dampening,type:"lowpass"}),this._lowpass.connect(this._combFilter)}static getDefaults(){return Object.assign(td.getDefaults(),{dampening:3e3,delayTime:.1,resonance:.5})}get dampening(){return this._lowpass.frequency}set dampening(t){this._lowpass.frequency=t}dispose(){return super.dispose(),this._combFilter.dispose(),this._lowpass.dispose(),this}}class wp extends Gd{constructor(){const t=ch(wp.getDefaults(),arguments);super(t),this.name="PluckSynth",this._noise=new cp({context:this.context,type:"pink"}),this.attackNoise=t.attackNoise,this._lfcf=new bp({context:this.context,dampening:t.dampening,resonance:t.resonance}),this.resonance=t.resonance,this.release=t.release,this._noise.connect(this._lfcf),this._lfcf.connect(this.output)}static getDefaults(){return uh(Gd.getDefaults(),{attackNoise:1,dampening:4e3,resonance:.7,release:1})}get dampening(){return this._lfcf.dampening}set dampening(t){this._lfcf.dampening=t}triggerAttack(t,e){const n=this.toFrequency(t);e=this.toSeconds(e);const r=1/n;return this._lfcf.delayTime.setValueAtTime(r,e),this._noise.start(e),this._noise.stop(e+r*this.attackNoise),this._lfcf.resonance.cancelScheduledValues(e),this._lfcf.resonance.setValueAtTime(this.resonance,e),this}triggerRelease(t){return this._lfcf.resonance.linearRampTo(0,this.release,t),this}dispose(){return super.dispose(),this._noise.dispose(),this._lfcf.dispose(),this}}class xp extends Hh{constructor(){super(...arguments),this.name="MidiClass",this.defaultUnits="midi"}_frequencyToUnits(t){return _s(super._frequencyToUnits(t))}_ticksToUnits(t){return _s(super._ticksToUnits(t))}_beatsToUnits(t){return _s(super._beatsToUnits(t))}_secondsToUnits(t){return _s(super._secondsToUnits(t))}toMidi(){return this.valueOf()}toFrequency(){return vs(this.toMidi())}transpose(t){return new xp(this.context,this.toMidi()+t)}}class Tp extends Gd{constructor(){const t=ch(Tp.getDefaults(),arguments,["voice","options"]);super(t),this.name="PolySynth",this._availableVoices=[],this._activeVoices=[],this._voices=[],this._gcTimeout=-1,this._averageActiveVoices=0,this._syncedRelease=t=>this.releaseAll(t),ph(!nh(t.voice),"DEPRECATED: The polyphony count is no longer the first argument.");const e=t.voice.getDefaults();this.options=Object.assign(e,t.options),this.voice=t.voice,this.maxPolyphony=t.maxPolyphony,this._dummyVoice=this._getNextAvailableVoice();const n=this._voices.indexOf(this._dummyVoice);this._voices.splice(n,1),this._gcTimeout=this.context.setInterval(this._collectGarbage.bind(this),1)}static getDefaults(){return Object.assign(Gd.getDefaults(),{maxPolyphony:32,options:{},voice:Wd})}get activeVoices(){return this._activeVoices.length}_makeVoiceAvailable(t){this._availableVoices.push(t);const e=this._activeVoices.findIndex(e=>e.voice===t);this._activeVoices.splice(e,1)}_getNextAvailableVoice(){if(this._availableVoices.length)return this._availableVoices.shift();if(this._voices.length<this.maxPolyphony){const t=new this.voice(Object.assign(this.options,{context:this.context,onsilence:this._makeVoiceAvailable.bind(this)}));return ph(t instanceof zd,"Voice must extend Monophonic class"),t.connect(this.output),this._voices.push(t),t}bh("Max polyphony exceeded. Note dropped.")}_collectGarbage(){if(this._averageActiveVoices=Math.max(.95*this._averageActiveVoices,this.activeVoices),this._availableVoices.length&&this._voices.length>Math.ceil(this._averageActiveVoices+1)){const t=this._availableVoices.shift(),e=this._voices.indexOf(t);this._voices.splice(e,1),this.context.isOffline||t.dispose()}}_triggerAttack(t,e,n){t.forEach(t=>{const r=new xp(this.context,t).toMidi(),i=this._getNextAvailableVoice();i&&(i.triggerAttack(t,e,n),this._activeVoices.push({midi:r,voice:i,released:!1}),this.log("triggerAttack",t,e))})}_triggerRelease(t,e){t.forEach(t=>{const n=new xp(this.context,t).toMidi(),r=this._activeVoices.find(({midi:t,released:e})=>t===n&&!e);r&&(r.voice.triggerRelease(e),r.released=!0,this.log("triggerRelease",t,e))})}_scheduleEvent(t,e,n,r){ph(!this.disposed,"Synth was already disposed"),n<=this.now()?"attack"===t?this._triggerAttack(e,n,r):this._triggerRelease(e,n):this.context.setTimeout(()=>{this.disposed||this._scheduleEvent(t,e,n,r)},n-this.now())}triggerAttack(t,e,n){Array.isArray(t)||(t=[t]);const r=this.toSeconds(e);return this._scheduleEvent("attack",t,r,n),this}triggerRelease(t,e){Array.isArray(t)||(t=[t]);const n=this.toSeconds(e);return this._scheduleEvent("release",t,n),this}triggerAttackRelease(t,e,n,r){const i=this.toSeconds(n);if(this.triggerAttack(t,i,r),ih(e)){ph(ih(t),"If the duration is an array, the notes must also be an array");for(let n=0;n<t.length;n++){const r=e[Math.min(n,e.length-1)],o=this.toSeconds(r);ph(o>0,"The duration must be greater than 0"),this.triggerRelease(t[n],i+o)}}else{const n=this.toSeconds(e);ph(n>0,"The duration must be greater than 0"),this.triggerRelease(t,i+n)}return this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1),this.context.transport.on("stop",this._syncedRelease),this.context.transport.on("pause",this._syncedRelease),this.context.transport.on("loopEnd",this._syncedRelease)),this}set(t){const e=hh(t,["onsilence","context"]);return this.options=uh(this.options,e),this._voices.forEach(t=>t.set(e)),this._dummyVoice.set(e),this}get(){return this._dummyVoice.get()}releaseAll(t){const e=this.toSeconds(t);return this._activeVoices.forEach(({voice:t})=>{t.triggerRelease(e)}),this}dispose(){return super.dispose(),this._dummyVoice.dispose(),this._voices.forEach(t=>t.dispose()),this._activeVoices=[],this._availableVoices=[],this.context.clearInterval(this._gcTimeout),this}}class kp extends Th{constructor(){super(),this.name="ToneAudioBuffers",this._buffers=new Map,this._loadingCount=0;const t=ch(kp.getDefaults(),arguments,["urls","onload","baseUrl"],"urls");this.baseUrl=t.baseUrl,Object.keys(t.urls).forEach(e=>{this._loadingCount++;const n=t.urls[e];this.add(e,n,this._bufferLoaded.bind(this,t.onload),t.onerror)})}static getDefaults(){return{baseUrl:"",onerror:Bh,onload:Bh,urls:{}}}has(t){return this._buffers.has(t.toString())}get(t){return ph(this.has(t),`ToneAudioBuffers has no buffer named: ${t}`),this._buffers.get(t.toString())}_bufferLoaded(t){this._loadingCount--,0===this._loadingCount&&t&&t()}get loaded(){return Array.from(this._buffers).every(([t,e])=>e.loaded)}add(t,e,n=Bh,r=Bh){return oh(e)?(this.baseUrl&&"data:audio/"===e.trim().substring(0,11).toLowerCase()&&(this.baseUrl=""),this._buffers.set(t.toString(),new qh(this.baseUrl+e,n,r))):this._buffers.set(t.toString(),new qh(e,n,r)),this}dispose(){return super.dispose(),this._buffers.forEach(t=>t.dispose()),this._buffers.clear(),this}}class Sp extends Gd{constructor(){const t=ch(Sp.getDefaults(),arguments,["urls","onload","baseUrl"],"urls");super(t),this.name="Sampler",this._activeSources=new Map;const e={};Object.keys(t.urls).forEach(n=>{const r=parseInt(n,10);if(ph(sh(n)||nh(r)&&isFinite(r),`url key is neither a note or midi pitch: ${n}`),sh(n)){const r=new Hh(this.context,n).toMidi();e[r]=t.urls[n]}else nh(r)&&isFinite(r)&&(e[r]=t.urls[r])}),this._buffers=new kp({urls:e,onload:t.onload,baseUrl:t.baseUrl,onerror:t.onerror}),this.attack=t.attack,this.release=t.release,this.curve=t.curve,this._buffers.loaded&&Promise.resolve().then(t.onload)}static getDefaults(){return Object.assign(Gd.getDefaults(),{attack:0,baseUrl:"",curve:"exponential",onload:Bh,onerror:Bh,release:.1,urls:{}})}_findClosest(t){let e=0;for(;e<96;){if(this._buffers.has(t+e))return-e;if(this._buffers.has(t-e))return e;e++}throw new Error(`No available buffers for note: ${t}`)}triggerAttack(t,e,n=1){return this.log("triggerAttack",t,e,n),Array.isArray(t)||(t=[t]),t.forEach(t=>{const r=ys(new Hh(this.context,t).toFrequency()),i=Math.round(r),o=r-i,s=this._findClosest(i),a=i-s,u=this._buffers.get(a),c=ms(s+o),l=new up({url:u,context:this.context,curve:this.curve,fadeIn:this.attack,fadeOut:this.release,playbackRate:c}).connect(this.output);l.start(e,0,u.duration/c,n),ih(this._activeSources.get(i))||this._activeSources.set(i,[]),this._activeSources.get(i).push(l),l.onended=()=>{if(this._activeSources&&this._activeSources.has(i)){const t=this._activeSources.get(i),e=t.indexOf(l);-1!==e&&t.splice(e,1)}}}),this}triggerRelease(t,e){return this.log("triggerRelease",t,e),Array.isArray(t)||(t=[t]),t.forEach(t=>{const n=new Hh(this.context,t).toMidi();if(this._activeSources.has(n)&&this._activeSources.get(n).length){const t=this._activeSources.get(n);e=this.toSeconds(e),t.forEach(t=>{t.stop(e)}),this._activeSources.set(n,[])}}),this}releaseAll(t){const e=this.toSeconds(t);return this._activeSources.forEach(t=>{for(;t.length;){t.shift().stop(e)}}),this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1)),this}triggerAttackRelease(t,e,n,r=1){const i=this.toSeconds(n);return this.triggerAttack(t,i,r),ih(e)?(ph(ih(t),"notes must be an array when duration is array"),t.forEach((t,n)=>{const r=e[Math.min(n,e.length-1)];this.triggerRelease(t,i+this.toSeconds(r))})):this.triggerRelease(t,i+this.toSeconds(e)),this}add(t,e,n){if(ph(sh(t)||isFinite(t),`note must be a pitch or midi: ${t}`),sh(t)){const r=new Hh(this.context,t).toMidi();this._buffers.add(r,e,n)}else this._buffers.add(t,e,n);return this}get loaded(){return this._buffers.loaded}dispose(){return super.dispose(),this._buffers.dispose(),this._activeSources.forEach(t=>{t.forEach(t=>t.dispose())}),this._activeSources.clear(),this}}s([ld(0)],Sp.prototype,"attack",void 0),s([ld(0)],Sp.prototype,"release",void 0);const Ap={synth:{new:t=>new Wd(t)},amsynth:{new:t=>new Hd(t)},duosynth:{new:t=>new rp(t)},fmsynth:{new:t=>new ip(t)},membranesynth:{new:t=>new op(t)},metalsynth:{new:t=>new ap(t)},monosynth:{new:t=>new tp(t)},noisesynth:{new:t=>new pp(t)},plucksynth:{new:t=>new wp(t)},polysynth:{new:(t,e)=>new Tp(t,e)},sampler:{new:t=>new Sp(t)}},Ep={synth:Wd,monosynth:tp,fmsynth:ip,duosyntho:rp,amsynth:Hd},Op={autofilter:{new:t=>new tonepkg.AutoFilter(t)},bitcrusher:{new:t=>new tonepkg.BitCrusher(t)},chebyshev:{new:t=>new tonepkg.Chebyshev(t)},pitchshift:{new:t=>new tonepkg.PitchShift(t)}},Cp=(t,e,n=!1)=>{try{if(e?.effect){return n?(globalThis.sound[t].set(e.effect.options),globalThis.sound[t]):Op[e.effect.type]?.new(e.effect.options)}throw"effect is not defined in the config"}catch(t){return}},Mp=()=>{globalThis.sound={}},Np=t=>{globalThis.sound[t]&&(globalThis.sound[t].dispose(),delete globalThis.sound[t])},{JZZ:Ip}=ds,jp=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in sound.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/sound.js"},{}),{24:["C"],25:["C#","Db"],26:["D"],27:["D#","Eb"],28:["E"],29:["F"],30:["F#","Gb"],31:["G"],32:["G#","Ab"],33:["A"],34:["A#","Bb"],35:["B"]}),Rp=(t,e=0)=>{const n=1+Math.floor((t-24)/12);return jp[t-12*(n-1)][e]+String(n)},Pp=t=>{const e=t[lg.LAMBDA_OBJ],n="_default"in e?e._default:void 0,r="instrument"in e||"inst"in e,i="source"in e||"src"in e,o="effect"in e||"fx"in e,s="target"in e||"trg"in e,a={codebase:"ghostos/api/parser/nodelogic/elements/library/sound.js",refnode:t[lg.REFNODE]},u=(wn("accio","ctrl_accio"),wn("accio","data_accio"));(n?a_(n,u,{},a.refnode):Promise.resolve({audionode:{type:"gain",value:.5},source:{type:"oscillator",options:{type:"sine"}},timing:{bpm:150},instrument:{type:"polysynth",voice:"synth",options:{}}})).then(e=>{t[lg.sound.CONFIG]=e});const c=(e=void 0)=>{if(e){const o=e._content.soundnode_trail.slice(-1)[0],a=t[lg.REFNODE];s?(i=o,globalThis.sound[i].toDestination()):o&&a&&(n=o,r=a,globalThis.sound[n].connect(globalThis.sound[r]))}var n,r,i;return{...e,_content:{soundnode_trail:e._content.soundnode_trail.concat(t[lg.REFNODE])}}},l=(e=void 0)=>{let n,s;e?(n=xn("soundconfig",e),t[lg.sound.CONFIG]=n):n=t[lg.sound.CONFIG],s=r?((t,e,n=!1)=>{try{if(e?.instrument)return n?(globalThis.sound[t].set(e.instrument.options),globalThis.sound[t]):Ap[e.instrument.type]?.new(e.instrument.voice?Ep[e.instrument.voice]:Wd,e.instrument.options);throw"instrument is not defined in the config"}catch(t){return}})(t[lg.REFNODE],n):i?void 0:o?Cp(t[lg.REFNODE],n,void 0!==t[lg.sound.SOUNDSTAGE]):Cp(t[lg.REFNODE],n),t[lg.sound.SOUNDSTAGE]=s,((t,e)=>{globalThis.sound[t]=e})(t[lg.REFNODE],s)};return{leaflogic:(e,n)=>{const r=new qt(void 0),i=n._stream.pipe(V(e=>(t[lg.CTRLIN]=e,e)),Nt(...e.map(t=>t._stream)),V(e=>{const n=e.slice(1).flat().map(t=>{if("_data_in"===t._bname)return xn("*",t);if("_midi_in"===t._bname){const{cmd:e,noteNumber:n,velocity:r}=t._content;return t}if("soundconfig"===t._bname)l(t);else if("soundinit"===t._bname)return c(t)}).filter(t=>t);return n.length>0&&r.next(n),t[lg.CTRLIN]}),Lt());return{_stream:r.pipe($t(t=>t)),_control:{_stream:i}}},datalogic:{pre:e=>{const n=e;return t[lg.sound.SOUNDSTAGE]||s||l(),s&&"started"!==tonepkg.Transport.state&&(tonepkg.start(),tonepkg.Transport.start()),n},post:n=>{const r=Object.keys(e),i=["image","audio","video"].filter(t=>r.includes(t));i.length>0&&i[0];Array.isArray(n);let o=n.map(e=>{if("_midi_in"===e._bname){const n=t[lg.sound.SOUNDSTAGE];if(e._content.velocity>0){const t=Rp(e._content.noteNumber),r=e._content.duration;r?n.triggerAttackRelease(t,r):n.triggerAttack(t)}else{const t=Rp(e._content.noteNumber);n.triggerRelease(t)}return Tn}return e});o=1===o.length?o[0]:o;return o}}}},Dp=wn("error",{type:"critical",message:"LEAF core error: race condition detected in gnav.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/gnav.js"},{}),Lp=t=>{const e=t[lg.LAMBDA_OBJ],n="elementio"in e,r="edges"in e&&"_default"in e.edges?e.edges._default:void 0,i="backdrop"in e&&"_default"in e.backdrop?e.backdrop._default:void 0,o={codebase:"ghostos/api/parser/nodelogic/elements/library/gnav.js",refnode:t[lg.REFNODE]};let s={};return{leaflogic:(e,n)=>{s=n._config;const a=new Pt,u=r?p_(n,e,void 0,o,{leaflogic:r,datalogic:{post:e=>(t[lg.gnav.EDGES]=e,e)}}):{_stream:ln([]),_control:n._stream},c=(i?p_(u._control,e,void 0,o,{leaflogic:i,datalogic:{post:e=>(t[lg.gnav.BACKDROP]=e,e)}}):{_stream:ln("/assets/test/hubbleinfrared_dark2.jpg"),_control:u._control})._control._stream.pipe(Nt(...e.map(t=>t._stream)),V(t=>{const e=t[1];return void 0!==e&&a.next(e),t[0]}));return{_stream:a,_control:{_stream:c}}},datalogic:{pre:t=>Array.isArray(t)?t.map(t=>xn("screenio",t)).filter(t=>t):xn("screenio",t),post:r=>{const i=r,o=xn(t[lg.gnav.EDGES]),a=(o||[]).map(t=>({...t,uuid:uuid4()})),u=t[lg.gnav.BACKDROP],c=Object.keys(e),l=(["edges","backdrop","tagvectors","tagaction","blankaction"].filter(t=>c.includes(t)),new qt(Dp)),h=hg({element:{nodeuuid:t[lg.REFNODE],type:"gnav",componentdata:{graph_data:{nodes:Array.isArray(i)?i:[i],edges:a},backdrop_url:u,bgtagvectors:async()=>{const t="tagvectors"in e&&"_default"in e.tagvectors?e.tagvectors._default:void 0;return t?await a_(t,[],{...s}):[]},tagaction:async r=>{const i="tagaction"in e&&"_default"in e.tagaction?e.tagaction._default:void 0,o=i?await a_(i,r,{...s}):r;return n&&l.next(wn("elementio",{element:"gnav",nodeuuid:t[lg.REFNODE],io:{tagaction:o}})),o},blankaction:async t=>{const n="blankaction"in e&&"_default"in e.blankaction?e.blankaction._default:void 0;return n?await a_(n,t,{...s}):t},graph_options:{layout:"3d"},...t[lg.RTCONTEXT]}}},"screenio");return h}}}},{memoize:Fp}=bn,$p=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in http.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library.js"},{}),t=>{const e=t[lg.LAMBDA_OBJ],n="uri"in e&&"_default"in e.uri?e.uri._default:void 0,r="header"in e&&"_default"in e.header?e.header._default:void 0,i={codebase:"ghostos/api/parser/nodelogic/elements/library/http.js",refnode:t[lg.REFNODE]},o=async(n,r={})=>{let i=t[lg.http.URI],o=t[lg.http.HEADER],s=n;s=1===s.length?s[0]:s;const a=Object.keys(e),u=["uri","post","put","get","header","?graph"].filter(t=>a.includes(t));let c=u.includes("post")?"post":u.includes("put")?"put":"get";"{*}"===i&&nn(s)&&"http-request"===s._bname&&(i=s._content.uri?s._content.uri:"https://www.leafgon.com",o=s._content.header?s._content.header:o,c=s._content.mode?s._content.mode:c,s=s._content.data?s._content.data:"");const l=lg.DOMAIN?t[lg.DOMAIN]:void 0,h=lg.APPID?t[lg.APPID]:void 0,d=u.includes("?graph")?i+`?graph=${l}/${h}`:i;let p;r.some(t=>Object.values(t).some(t=>"object"==typeof t&&"leaf-nodejs"===t._label?.provenance&&(p=t._content,!0)));const f=bn.throttle(async()=>await(async({http_mode:t,uri:e}={})=>{if(["post","put"].includes(t))try{const n=e?fetch(e,{method:t.toUpperCase(),mode:"cors",headers:p?{...o,Cookie:p}:{...o},credentials:"include",body:JSON.stringify(s)}):ln([{data:"LEAF element error: http get request submitted with undefined URI"}]),r=await n;return await r.json()}catch(t){return t.response||t.request,t.response}else try{const t=e?fetch(e,{method:"GET",headers:p?{...o,Accept:"application/json",Cookie:p}:{...o,Accept:"application/json"},credentials:"include"}):ln([{data:"LEAF element error: http get request submitted with undefined URI"}]),n=await t;return await n.json()}catch(t){return t.response||t.request,t}})({http_mode:c,uri:d}),1e3);return await f()};return{leaflogic:(e,s)=>{const a=new Pt,u=n?p_(s,e,void 0,i,{leaflogic:n,datalogic:{post:e=>(t[lg.http.URI]=e,e)}}):(t[lg.http.URI]="{*}",{_stream:new qt("{*}"),_control:{_stream:s._stream}}),c=r?p_(s,e,void 0,i,{leaflogic:r,datalogic:{post:e=>(t[lg.http.HEADER]=e,e)}}):(t[lg.http.HEADER]="",{_stream:new qt(""),_control:{_stream:s._stream}}),l=Et([u._control._stream,c._control._stream]),h=Et([u._stream,c._stream]),d=l.pipe(Nt(h),V(t=>t[0]));let p=!1;const f=d.pipe(Nt(...e.map(t=>t._stream)),It(t=>o(t.slice(1),t[0])),V(e=>(p=!0,e?.length>1||!Array.isArray(e)?a.next(e):1===e?.length&&a.next(e[0]),t[lg.CTRLIN])),Lt());return{_stream:a.pipe($t(t=>p),V(t=>t),Lt()),_control:{_stream:f.pipe(V(t=>t),Lt())}}},datalogic:{pre:t=>t,post:t=>{const e=t,n=t=>{const e=typeof t;return"object"===e?Array.isArray(t)?t.map(t=>n(t)):t?Object.fromEntries(Object.entries(t).map(([t,e])=>[t,n(e)])):t:"string"===e?(t=>{var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return t.replace(/[&<>"']/g,function(t){return e[t]})})(t):t};return hg(e?.name&&"AxiosError"===e.name?{error:e.message,data:e.response.data}:n(e),"elementio")}}}}),{memoize:Bp}=bn,qp=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in href.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library.js"},{}),t=>{const e=t[lg.LAMBDA_OBJ],n="uri"in e&&"_default"in e.uri?e.uri._default:void 0,r={codebase:"ghostos/api/parser/nodelogic/elements/library/href.js",refnode:t[lg.REFNODE]},i=async n=>{let r=t[lg.href.URI],i=n;i=1===i.length?i[0]:i;const o=Object.keys(e),s=["uri","post","put","get","header","?graph"].filter(t=>o.includes(t));"{*}"===r&&nn(i)&&"href-request"===i._bname&&(r=i._content.uri?i._content.uri:"https://www.leafgon.com",i=i._content.data?i._content.data:"");const a=lg.DOMAIN?t[lg.DOMAIN]:void 0,u=lg.APPID?t[lg.APPID]:void 0,c=s.includes("?graph")?r+`?graph=${a}/${u}`:r,l=bn.throttle(async()=>await(async({uri:t}={})=>{try{return"undefined"!=typeof window&&window.location.href.slice(-t.length)!==t&&(window.location.href=t),t}catch(t){return t}})({uri:c}),1e3);return await l()};return{leaflogic:(e,o)=>{const s=new Pt,a=n?p_(o,e,void 0,r,{leaflogic:n,datalogic:{post:e=>(t[lg.href.URI]=e,e)}}):(t[lg.href.URI]="{*}",{_stream:new qt("{*}"),_control:{_stream:o._stream}}),u=a._control._stream,c=a._stream,l=u.pipe(Nt(c),V(t=>t[0]));let h=!1;const d=l.pipe(Nt(...e.map(t=>t._stream)),It(t=>i(t.slice(1))),V(e=>(h=!0,e?.length>1||!Array.isArray(e)?s.next(e):1===e?.length&&s.next(e[0]),t[lg.CTRLIN])),Lt());return{_stream:s.pipe($t(t=>h),V(t=>t),Lt()),_control:{_stream:d.pipe(V(t=>t),Lt())}}},datalogic:{pre:t=>t}}});var Up=n(639);wn("error",{type:"critical",message:"LEAF core error: race condition detected in text.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/text.js"},{});const Vp=t=>{const e=new Pt,n=new Pt,r=new Pt,i=t[lg.LAMBDA_OBJ],o="_default"in i?i._default:void 0,s={codebase:"ghostos/api/parser/nodelogic/elements/library/html.js",...t},a=wn("accio","ctrl_accio"),u=wn("accio","data_accio"),c=o?p_({_stream:ln(a)},[{_stream:ln(u)}],void 0,s,{leaflogic:o,datalogic:{post:t=>t}}):{_stream:ln(""),_control:{_stream:ln(a)}};t[lg.html.TEMPLATE]=void 0,cn(c._control._stream.pipe(Nt(c._stream))).then(e=>{const n=typeof e[1];if("string"===n)t[lg.html.TEMPLATE]={_default:Up.compile(e[1])};else if("object"===n){const n={};Object.entries(e[1]).map(([t,e])=>{const r=[e].flat().map(t=>{if("string"==typeof t)return t}).filter(t=>void 0!==t).join("\n");""!==r&&(n[t]=Up.compile(r))}),Object.keys(n).length>0&&(t[lg.html.TEMPLATE]=n)}Up.registerHelper("markdown",function(t){t=(t=(t=(t=(t=(t=t.replace(/&gt;/gm,">")).replace(/&lt;/gm,"<")).replace(/&amp;/gm,"&")).replace(/(\r\n|\n|\r)/gm,"\n")).replace(/\\&quot;/gm,'\\"')).replace(/&quot;/gm,'"');return`atob('${Buffer.from(t).toString("base64")}')`}),Up.registerHelper("json",function(t){const e=Buffer.from(JSON.stringify(t,function t(e,n){const r=typeof n;if("string"===r){const t=/^\{((?:-(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))|(?:0|(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))))(?:.\d+|))\}$/,e=n.match(t);if(null!==e){return Number(e[1])}return n}if("object"===r){if(Array.isArray(n))return n.map((e,n)=>t(n,e));return Object.assign({},...Object.entries(n).map(([e,n])=>({[e]:t(e,n)})))}return n})).toString("base64");return`JSON.parse(atob('${e}'))`}),Up.registerHelper("tostring",function(t){return String(t)}),r.next()});return{elementio$:n,leaflogic:(i,o)=>{const s=o._stream.pipe(Nt(...i.map(t=>t._stream)),It(e=>{const i=new qt(e[0]),o=new qt(e[1]);return t[lg.html.TEMPLATE]?Et(i,Bt(o,n)):r.pipe(Nt(i,Bt(o,n)),V(t=>t[1]))}),V(r=>{const i=t[lg.html.TEMPLATE],o=r[1];if(nn(o)&&"elementio"===o._bname)return e.next(o),r[0];if(void 0!==i){const s=((t,e)=>{if(void 0!==e){const n=Object.keys(e);return(1===n.length&&n.includes("_default")?[e._default(Object.assign({},...[t].flat().map(t=>xn("*",t))))]:[t].flat().sort((t,e)=>{const n=t._label?.tag?.toLowerCase(),r=e._label?.tag?.toLowerCase();return n>r?1:n<r?-1:0}).map(t=>{if(nn(t)){const n=xn("*",t),r=t._bname;return[n].flat().map(t=>t&&r in e?e[r](t):t&&"_default"in e?e._default(t):"string"==typeof t?t:void 0).filter(t=>void 0!==t).join("\n")}}).filter(t=>void 0!==t)).join("\n").replace(/(\r\n|\n|\r)/gm,"")}return t})(o,i),a=hg({element:{nodeuuid:t[lg.REFNODE],type:"html",componentdata:{innerhtml:s,callback:t=>{n.next(wn("elementio",t))},...t[lg.RTCONTEXT]}}},"screenio");return e.next(a),r[0]}}),$t(t=>void 0!==t));return{_stream:e,_control:{_stream:s}}},datalogic:{pre:t=>t,post:t=>t}}},Gp=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in text.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/text.js"},{}),t=>{const e=new Pt,n=new Pt,r=new Pt,i=t[lg.LAMBDA_OBJ],o="_default"in i?i._default:void 0,s="single"in i,a={codebase:"ghostos/api/parser/nodelogic/elements/library/form.js",...t},u=wn("accio","ctrl_accio"),c=wn("accio","data_accio"),l=o?p_({_stream:ln(u)},[{_stream:ln(c)}],void 0,a,{leaflogic:o,datalogic:{post:t=>t}}):{_stream:ln(""),_control:{_stream:ln(u)}};t[lg.html.TEMPLATE]=void 0,cn(l._control._stream.pipe(Nt(l._stream))).then(e=>{const n=typeof e[1];if("string"===n)t[lg.html.TEMPLATE]={_default:Up.compile(e[1])};else if("object"===n){const n={};Object.entries(e[1]).map(([t,e])=>{const r=[e].flat().map(t=>{if("string"==typeof t)return t}).filter(t=>void 0!==t).join("\n");""!==r&&(n[t]=Up.compile(r))}),Object.keys(n).length>0&&(t[lg.html.TEMPLATE]=n)}Up.registerHelper("json",function(t){return JSON.stringify(t,function t(e,n){const r=typeof n;if("string"===r){const t=/^\{((?:-(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))|(?:0|(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))))(?:.\d+|))\}$/,e=n.match(t);if(null!==e){return Number(e[1])}return n}if("object"===r){if(Array.isArray(n))return n.map((e,n)=>t(n,e));return Object.assign({},...Object.entries(n).map(([e,n])=>({[e]:t(e,n)})))}return n})}),r.next()});return{elementio$:n,leaflogic:(i,o)=>{const a=o._stream.pipe(Nt(...i.map(t=>t._stream)),It(e=>{const i=new qt(e[0]),o=new qt(e[1]);return t[lg.html.TEMPLATE]?Et(i,Bt(o,n)):r.pipe(Nt(i,Bt(o,n)),V(t=>t[1]))}),V(n=>{const r=t[lg.html.TEMPLATE],i=n[1];if(nn(i)&&"elementio"===i._bname)return e.next(i),n[0];if(void 0!==r){const r=(()=>{const e=`\n <script type='text/babel'>\n const Form = JSONSchemaForm.default;\n const schema = {\n title: 'react-jsonschema-form demo',\n type: 'object',\n required: ['name', 'email'],\n properties: {\n name: {type: 'string', minLength: 3},\n email: {type: 'string'},\n dob: {type: 'string'},\n age: {type: 'number'},\n thing: {type: 'string'},\n other: {type: 'string'},\n }\n };\n const uiSchema = {\n email: {\n 'ui:options': {\n inputType: 'email'\n }\n },\n dob: {\n 'ui:widget': 'alt-date',\n 'ui:options': {\n yearsRange: [1980, 2030],\n hideNowButton: true,\n hideClearButton: true,\n },\n },\n };\n \n function Tpl(props) {\n const {id, label, required, children} = props;\n return (\n <div className='myfield'>\n <label htmlFor={id}>{label}{required ? '*' : null}</label>\n {children}\n </div>\n );\n };\n\n function dosubmit({ formData }, e) {\n doelementio({_bname: '${t[lg.REFNODE].slice(0,8)}', _content: formData, _label: {refnode: '${t[lg.REFNODE]}'}});\n };\n\n function SubmitButton(props) {\n const { uiSchema } = props;\n return (\n <button type='submit'>\n Yadda\n </button>\n );\n }\n \n ReactDOM.render(\n (<Form onSubmit={dosubmit} className='row' schema={schema} uiSchema={uiSchema} FieldTemplate={Tpl} liveValidate >\n <div style={{marginBottom: '70px'}}>\n <button className='unicornbutton' type='submit'>\n Yadda\n </button>\n </div>\n </Form>\n ),\n document.getElementById('${t[lg.REFNODE]}')\n );\n <\/script>\n `,n=`\n <div id='${t[lg.REFNODE]}'></div>\n `,r=t=>t.replace(/(\r\n|\n|\r)/gm,"").replace(/(\s+)/gm," "),i=t[lg.REFNODE].slice(0,8),o=s?"form-style":"form-style-"+i,a=s?"form-script":"form-script-"+i,u=s?"form-body":"form-body-"+i;return wn(i,{"form-common":r("\n \x3c!-- Bootstrap core CSS --\x3e\n <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css' rel='stylesheet' integrity='sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH' crossorigin='anonymous'>\n <script crossorigin src='https://unpkg.com/react@17.0.2/umd/react.development.js'><\/script>\n <script crossorigin src='https://unpkg.com/react-dom@17.0.2/umd/react-dom.development.js'><\/script>\n <script src='https://unpkg.com/@babel/standalone@7.23.10/babel.min.js'><\/script>\n <script src='https://unpkg.com/@rjsf/core@4.2.3/dist/react-jsonschema-form.js'><\/script>\n "),[o]:r("\n <style>\n .unicornbutton {\n background-image: url('https://leas3.ams3.cdn.digitaloceanspaces.com/static/lax/assets/button-bg.jpg');\n width: 250px;\n height: 70px;\n background-size: 160px;\n color: white;\n font-weight: 800;\n text-align: center;\n line-height: 70px;\n font-size: 30px;\n text-decoration: none;\n border-radius: 20px;\n z-index: 100;\n pointer-events: all;\n cursor: pointer;\n }\n </style>\n "),[a]:r(e),[u]:r(n)},{uuid:t[lg.REFNODE]})})();return e.next(r),n[0]}}),$t(t=>void 0!==t));return{_stream:e,_control:{_stream:a}}},datalogic:{pre:t=>t,post:t=>t}}});function zp(t,e){return function(){return t.apply(e,arguments)}}const{toString:Wp}=Object.prototype,{getPrototypeOf:Jp}=Object,{iterator:Hp,toStringTag:Xp}=Symbol,Kp=(Qp=Object.create(null),t=>{const e=Wp.call(t);return Qp[e]||(Qp[e]=e.slice(8,-1).toLowerCase())});var Qp;const Zp=t=>(t=t.toLowerCase(),e=>Kp(e)===t),Yp=t=>e=>typeof e===t,{isArray:tf}=Array,ef=Yp("undefined");function nf(t){return null!==t&&!ef(t)&&null!==t.constructor&&!ef(t.constructor)&&sf(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const rf=Zp("ArrayBuffer");const of=Yp("string"),sf=Yp("function"),af=Yp("number"),uf=t=>null!==t&&"object"==typeof t,cf=t=>{if("object"!==Kp(t))return!1;const e=Jp(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Xp in t||Hp in t)},lf=Zp("Date"),hf=Zp("File"),df=Zp("Blob"),pf=Zp("FileList"),ff=Zp("URLSearchParams"),[mf,gf,_f,yf]=["ReadableStream","Request","Response","Headers"].map(Zp);function vf(t,e,{allOwnKeys:n=!1}={}){if(null==t)return;let r,i;if("object"!=typeof t&&(t=[t]),tf(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{if(nf(t))return;const i=n?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let s;for(r=0;r<o;r++)s=i[r],e.call(null,t[s],s,t)}}function bf(t,e){if(nf(t))return null;e=e.toLowerCase();const n=Object.keys(t);let r,i=n.length;for(;i-- >0;)if(r=n[i],e===r.toLowerCase())return r;return null}const wf="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,xf=t=>!ef(t)&&t!==wf;const Tf=(kf="undefined"!=typeof Uint8Array&&Jp(Uint8Array),t=>kf&&t instanceof kf);var kf;const Sf=Zp("HTMLFormElement"),Af=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Ef=Zp("RegExp"),Of=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};vf(n,(n,i)=>{let o;!1!==(o=e(n,i,t))&&(r[i]=o||n)}),Object.defineProperties(t,r)};const Cf=Zp("AsyncFunction"),Mf=(Nf="function"==typeof setImmediate,If=sf(wf.postMessage),Nf?setImmediate:If?(jf=`axios@${Math.random()}`,Rf=[],wf.addEventListener("message",({source:t,data:e})=>{t===wf&&e===jf&&Rf.length&&Rf.shift()()},!1),t=>{Rf.push(t),wf.postMessage(jf,"*")}):t=>setTimeout(t));var Nf,If,jf,Rf;const Pf="undefined"!=typeof queueMicrotask?queueMicrotask.bind(wf):"undefined"!=typeof process&&process.nextTick||Mf,Df={isArray:tf,isArrayBuffer:rf,isBuffer:nf,isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||sf(t.append)&&("formdata"===(e=Kp(t))||"object"===e&&sf(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&rf(t.buffer),e},isString:of,isNumber:af,isBoolean:t=>!0===t||!1===t,isObject:uf,isPlainObject:cf,isEmptyObject:t=>{if(!uf(t)||nf(t))return!1;try{return 0===Object.keys(t).length&&Object.getPrototypeOf(t)===Object.prototype}catch(t){return!1}},isReadableStream:mf,isRequest:gf,isResponse:_f,isHeaders:yf,isUndefined:ef,isDate:lf,isFile:hf,isBlob:df,isRegExp:Ef,isFunction:sf,isStream:t=>uf(t)&&sf(t.pipe),isURLSearchParams:ff,isTypedArray:Tf,isFileList:pf,forEach:vf,merge:function t(){const{caseless:e,skipUndefined:n}=xf(this)&&this||{},r={},i=(i,o)=>{const s=e&&bf(r,o)||o;cf(r[s])&&cf(i)?r[s]=t(r[s],i):cf(i)?r[s]=t({},i):tf(i)?r[s]=i.slice():n&&ef(i)||(r[s]=i)};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&vf(arguments[t],i);return r},extend:(t,e,n,{allOwnKeys:r}={})=>(vf(e,(e,r)=>{n&&sf(e)?Object.defineProperty(t,r,{value:zp(e,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,r,{value:e,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},toFlatObject:(t,e,n,r)=>{let i,o,s;const a={};if(e=e||{},null==t)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],r&&!r(s,t,e)||a[s]||(e[s]=t[s],a[s]=!0);t=!1!==n&&Jp(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:Kp,kindOfTest:Zp,endsWith:(t,e,n)=>{t=String(t),(void 0===n||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return-1!==r&&r===n},toArray:t=>{if(!t)return null;if(tf(t))return t;let e=t.length;if(!af(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},forEachEntry:(t,e)=>{const n=(t&&t[Hp]).call(t);let r;for(;(r=n.next())&&!r.done;){const n=r.value;e.call(t,n[0],n[1])}},matchAll:(t,e)=>{let n;const r=[];for(;null!==(n=t.exec(e));)r.push(n);return r},isHTMLForm:Sf,hasOwnProperty:Af,hasOwnProp:Af,reduceDescriptors:Of,freezeMethods:t=>{Of(t,(e,n)=>{if(sf(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=t[n];sf(r)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(t,e)=>{const n={},r=t=>{t.forEach(t=>{n[t]=!0})};return tf(t)?r(t):r(String(t).split(e)),n},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,e,n){return e.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(t,e)=>null!=t&&Number.isFinite(t=+t)?t:e,findKey:bf,global:wf,isContextDefined:xf,isSpecCompliantForm:function(t){return!!(t&&sf(t.append)&&"FormData"===t[Xp]&&t[Hp])},toJSONObject:t=>{const e=new Array(10),n=(t,r)=>{if(uf(t)){if(e.indexOf(t)>=0)return;if(nf(t))return t;if(!("toJSON"in t)){e[r]=t;const i=tf(t)?[]:{};return vf(t,(t,e)=>{const o=n(t,r+1);!ef(o)&&(i[e]=o)}),e[r]=void 0,i}}return t};return n(t,0)},isAsyncFn:Cf,isThenable:t=>t&&(uf(t)||sf(t))&&sf(t.then)&&sf(t.catch),setImmediate:Mf,asap:Pf,isIterable:t=>null!=t&&sf(t[Hp])};class Lf extends Error{static from(t,e,n,r,i,o){const s=new Lf(t.message,e||t.code,n,r,i);return s.cause=t,s.name=t.name,o&&Object.assign(s,o),s}constructor(t,e,n,r,i){super(t),this.name="AxiosError",this.isAxiosError=!0,e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Df.toJSONObject(this.config),code:this.code,status:this.status}}}Lf.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Lf.ERR_BAD_OPTION="ERR_BAD_OPTION",Lf.ECONNABORTED="ECONNABORTED",Lf.ETIMEDOUT="ETIMEDOUT",Lf.ERR_NETWORK="ERR_NETWORK",Lf.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Lf.ERR_DEPRECATED="ERR_DEPRECATED",Lf.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Lf.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Lf.ERR_CANCELED="ERR_CANCELED",Lf.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Lf.ERR_INVALID_URL="ERR_INVALID_URL";const Ff=Lf;function $f(t){return Df.isPlainObject(t)||Df.isArray(t)}function Bf(t){return Df.endsWith(t,"[]")?t.slice(0,-2):t}function qf(t,e,n){return t?t.concat(e).map(function(t,e){return t=Bf(t),!n&&e?"["+t+"]":t}).join(n?".":""):e}const Uf=Df.toFlatObject(Df,{},null,function(t){return/^is[A-Z]/.test(t)});const Vf=function(t,e,n){if(!Df.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const r=(n=Df.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(t,e){return!Df.isUndefined(e[t])})).metaTokens,i=n.visitor||c,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Df.isSpecCompliantForm(e);if(!Df.isFunction(i))throw new TypeError("visitor must be a function");function u(t){if(null===t)return"";if(Df.isDate(t))return t.toISOString();if(Df.isBoolean(t))return t.toString();if(!a&&Df.isBlob(t))throw new Ff("Blob is not supported. Use a Buffer instead.");return Df.isArrayBuffer(t)||Df.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function c(t,n,i){let a=t;if(t&&!i&&"object"==typeof t)if(Df.endsWith(n,"{}"))n=r?n:n.slice(0,-2),t=JSON.stringify(t);else if(Df.isArray(t)&&function(t){return Df.isArray(t)&&!t.some($f)}(t)||(Df.isFileList(t)||Df.endsWith(n,"[]"))&&(a=Df.toArray(t)))return n=Bf(n),a.forEach(function(t,r){!Df.isUndefined(t)&&null!==t&&e.append(!0===s?qf([n],r,o):null===s?n:n+"[]",u(t))}),!1;return!!$f(t)||(e.append(qf(i,n,o),u(t)),!1)}const l=[],h=Object.assign(Uf,{defaultVisitor:c,convertValue:u,isVisitable:$f});if(!Df.isObject(t))throw new TypeError("data must be an object");return function t(n,r){if(!Df.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),Df.forEach(n,function(n,o){!0===(!(Df.isUndefined(n)||null===n)&&i.call(e,n,Df.isString(o)?o.trim():o,r,h))&&t(n,r?r.concat(o):[o])}),l.pop()}}(t),e};function Gf(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}function zf(t,e){this._pairs=[],t&&Vf(t,this,e)}const Wf=zf.prototype;Wf.append=function(t,e){this._pairs.push([t,e])},Wf.toString=function(t){const e=t?function(e){return t.call(this,e,Gf)}:Gf;return this._pairs.map(function(t){return e(t[0])+"="+e(t[1])},"").join("&")};const Jf=zf;function Hf(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Xf(t,e,n){if(!e)return t;const r=n&&n.encode||Hf,i=Df.isFunction(n)?{serialize:n}:n,o=i&&i.serialize;let s;if(s=o?o(e,i):Df.isURLSearchParams(e)?e.toString():new Jf(e,i).toString(r),s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t}const Kf=class{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Df.forEach(this.handlers,function(e){null!==e&&t(e)})}},Qf={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Zf={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Jf,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Yf="undefined"!=typeof window&&"undefined"!=typeof document,tm="object"==typeof navigator&&navigator||void 0,em=Yf&&(!tm||["ReactNative","NativeScript","NS"].indexOf(tm.product)<0),nm="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,rm=Yf&&window.location.href||"http://localhost",im={...r,...Zf};const om=function(t){function e(t,n,r,i){let o=t[i++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=i>=t.length;if(o=!o&&Df.isArray(r)?r.length:o,a)return Df.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!s;r[o]&&Df.isObject(r[o])||(r[o]=[]);return e(t,n,r[o],i)&&Df.isArray(r[o])&&(r[o]=function(t){const e={},n=Object.keys(t);let r;const i=n.length;let o;for(r=0;r<i;r++)o=n[r],e[o]=t[o];return e}(r[o])),!s}if(Df.isFormData(t)&&Df.isFunction(t.entries)){const n={};return Df.forEachEntry(t,(t,r)=>{e(function(t){return Df.matchAll(/\w+|\[(\w*)]/g,t).map(t=>"[]"===t[0]?"":t[1]||t[0])}(t),r,n,0)}),n}return null};const sm={transitional:Qf,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",r=n.indexOf("application/json")>-1,i=Df.isObject(t);i&&Df.isHTMLForm(t)&&(t=new FormData(t));if(Df.isFormData(t))return r?JSON.stringify(om(t)):t;if(Df.isArrayBuffer(t)||Df.isBuffer(t)||Df.isStream(t)||Df.isFile(t)||Df.isBlob(t)||Df.isReadableStream(t))return t;if(Df.isArrayBufferView(t))return t.buffer;if(Df.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return Vf(t,new im.classes.URLSearchParams,{visitor:function(t,e,n,r){return im.isNode&&Df.isBuffer(t)?(this.append(e,t.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...e})}(t,this.formSerializer).toString();if((o=Df.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return Vf(o?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||r?(e.setContentType("application/json",!1),function(t,e,n){if(Df.isString(t))try{return(e||JSON.parse)(t),Df.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||sm.transitional,n=e&&e.forcedJSONParsing,r="json"===this.responseType;if(Df.isResponse(t)||Df.isReadableStream(t))return t;if(t&&Df.isString(t)&&(n&&!this.responseType||r)){const n=!(e&&e.silentJSONParsing)&&r;try{return JSON.parse(t,this.parseReviver)}catch(t){if(n){if("SyntaxError"===t.name)throw Ff.from(t,Ff.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:im.classes.FormData,Blob:im.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Df.forEach(["delete","get","head","post","put","patch"],t=>{sm.headers[t]={}});const am=sm,um=Df.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),cm=Symbol("internals");function lm(t){return t&&String(t).trim().toLowerCase()}function hm(t){return!1===t||null==t?t:Df.isArray(t)?t.map(hm):String(t)}function dm(t,e,n,r,i){return Df.isFunction(r)?r.call(this,e,n):(i&&(e=n),Df.isString(e)?Df.isString(r)?-1!==e.indexOf(r):Df.isRegExp(r)?r.test(e):void 0:void 0)}class pm{constructor(t){t&&this.set(t)}set(t,e,n){const r=this;function i(t,e,n){const i=lm(e);if(!i)throw new Error("header name must be a non-empty string");const o=Df.findKey(r,i);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||e]=hm(t))}const o=(t,e)=>Df.forEach(t,(t,n)=>i(t,n,e));if(Df.isPlainObject(t)||t instanceof this.constructor)o(t,e);else if(Df.isString(t)&&(t=t.trim())&&!(t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()))(t))o((t=>{const e={};let n,r,i;return t&&t.split("\n").forEach(function(t){i=t.indexOf(":"),n=t.substring(0,i).trim().toLowerCase(),r=t.substring(i+1).trim(),!n||e[n]&&um[n]||("set-cookie"===n?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e})(t),e);else if(Df.isObject(t)&&Df.isIterable(t)){let n,r,i={};for(const e of t){if(!Df.isArray(e))throw TypeError("Object iterator must return a key-value pair");i[r=e[0]]=(n=i[r])?Df.isArray(n)?[...n,e[1]]:[n,e[1]]:e[1]}o(i,e)}else null!=t&&i(e,t,n);return this}get(t,e){if(t=lm(t)){const n=Df.findKey(this,t);if(n){const t=this[n];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}(t);if(Df.isFunction(e))return e.call(this,t,n);if(Df.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=lm(t)){const n=Df.findKey(this,t);return!(!n||void 0===this[n]||e&&!dm(0,this[n],n,e))}return!1}delete(t,e){const n=this;let r=!1;function i(t){if(t=lm(t)){const i=Df.findKey(n,t);!i||e&&!dm(0,n[i],i,e)||(delete n[i],r=!0)}}return Df.isArray(t)?t.forEach(i):i(t),r}clear(t){const e=Object.keys(this);let n=e.length,r=!1;for(;n--;){const i=e[n];t&&!dm(0,this[i],i,t,!0)||(delete this[i],r=!0)}return r}normalize(t){const e=this,n={};return Df.forEach(this,(r,i)=>{const o=Df.findKey(n,i);if(o)return e[o]=hm(r),void delete e[i];const s=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,n)=>e.toUpperCase()+n)}(i):String(i).trim();s!==i&&delete e[i],e[s]=hm(r),n[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return Df.forEach(this,(n,r)=>{null!=n&&!1!==n&&(e[r]=t&&Df.isArray(n)?n.join(", "):n)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach(t=>n.set(t)),n}static accessor(t){const e=(this[cm]=this[cm]={accessors:{}}).accessors,n=this.prototype;function r(t){const r=lm(t);e[r]||(!function(t,e){const n=Df.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(t,n,i){return this[r].call(this,e,t,n,i)},configurable:!0})})}(n,t),e[r]=!0)}return Df.isArray(t)?t.forEach(r):r(t),this}}pm.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Df.reduceDescriptors(pm.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}}),Df.freezeMethods(pm);const fm=pm;function mm(t,e){const n=this||am,r=e||n,i=fm.from(r.headers);let o=r.data;return Df.forEach(t,function(t){o=t.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function gm(t){return!(!t||!t.__CANCEL__)}const _m=class extends Ff{constructor(t,e,n){super(null==t?"canceled":t,Ff.ERR_CANCELED,e,n),this.name="CanceledError",this.__CANCEL__=!0}};function ym(t,e,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?e(new Ff("Request failed with status code "+n.status,[Ff.ERR_BAD_REQUEST,Ff.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}const vm=function(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i,o=0,s=0;return e=void 0!==e?e:1e3,function(a){const u=Date.now(),c=r[s];i||(i=u),n[o]=a,r[o]=u;let l=s,h=0;for(;l!==o;)h+=n[l++],l%=t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),u-i<e)return;const d=c&&u-c;return d?Math.round(1e3*h/d):void 0}};const bm=function(t,e){let n,r,i=0,o=1e3/e;const s=(e,o=Date.now())=>{i=o,n=null,r&&(clearTimeout(r),r=null),t(...e)};return[(...t)=>{const e=Date.now(),a=e-i;a>=o?s(t,e):(n=t,r||(r=setTimeout(()=>{r=null,s(n)},o-a)))},()=>n&&s(n)]},wm=(t,e,n=3)=>{let r=0;const i=vm(50,250);return bm(n=>{const o=n.loaded,s=n.lengthComputable?n.total:void 0,a=o-r,u=i(a);r=o;t({loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:u||void 0,estimated:u&&s&&o<=s?(s-o)/u:void 0,event:n,lengthComputable:null!=s,[e?"download":"upload"]:!0})},n)},xm=(t,e)=>{const n=null!=t;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Tm=t=>(...e)=>Df.asap(()=>t(...e)),km=im.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,im.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(im.origin),im.navigator&&/(msie|trident)/i.test(im.navigator.userAgent)):()=>!0,Sm=im.hasStandardBrowserEnv?{write(t,e,n,r,i,o,s){if("undefined"==typeof document)return;const a=[`${t}=${encodeURIComponent(e)}`];Df.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),Df.isString(r)&&a.push(`path=${r}`),Df.isString(i)&&a.push(`domain=${i}`),!0===o&&a.push("secure"),Df.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(t){if("undefined"==typeof document)return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function Am(t,e,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);return t&&(r||0==n)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const Em=t=>t instanceof fm?{...t}:t;function Om(t,e){e=e||{};const n={};function r(t,e,n,r){return Df.isPlainObject(t)&&Df.isPlainObject(e)?Df.merge.call({caseless:r},t,e):Df.isPlainObject(e)?Df.merge({},e):Df.isArray(e)?e.slice():e}function i(t,e,n,i){return Df.isUndefined(e)?Df.isUndefined(t)?void 0:r(void 0,t,0,i):r(t,e,0,i)}function o(t,e){if(!Df.isUndefined(e))return r(void 0,e)}function s(t,e){return Df.isUndefined(e)?Df.isUndefined(t)?void 0:r(void 0,t):r(void 0,e)}function a(n,i,o){return o in e?r(n,i):o in t?r(void 0,n):void 0}const u={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(t,e,n)=>i(Em(t),Em(e),0,!0)};return Df.forEach(Object.keys({...t,...e}),function(r){const o=u[r]||i,s=o(t[r],e[r],r);Df.isUndefined(s)&&o!==a||(n[r]=s)}),n}const Cm=t=>{const e=Om({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=e;if(e.headers=s=fm.from(s),e.url=Xf(Am(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Df.isFormData(n))if(im.hasStandardBrowserEnv||im.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(Df.isFunction(n.getHeaders)){const t=n.getHeaders(),e=["content-type","content-length"];Object.entries(t).forEach(([t,n])=>{e.includes(t.toLowerCase())&&s.set(t,n)})}if(im.hasStandardBrowserEnv&&(r&&Df.isFunction(r)&&(r=r(e)),r||!1!==r&&km(e.url))){const t=i&&o&&Sm.read(o);t&&s.set(i,t)}return e},Mm="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise(function(e,n){const r=Cm(t);let i=r.data;const o=fm.from(r.headers).normalize();let s,a,u,c,l,{responseType:h,onUploadProgress:d,onDownloadProgress:p}=r;function f(){c&&c(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=fm.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());ym(function(t){e(t),f()},function(t){n(t),f()},{data:h&&"text"!==h&&"json"!==h?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:t,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new Ff("Request aborted",Ff.ECONNABORTED,t,m)),m=null)},m.onerror=function(e){const r=e&&e.message?e.message:"Network Error",i=new Ff(r,Ff.ERR_NETWORK,t,m);i.event=e||null,n(i),m=null},m.ontimeout=function(){let e=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const i=r.transitional||Qf;r.timeoutErrorMessage&&(e=r.timeoutErrorMessage),n(new Ff(e,i.clarifyTimeoutError?Ff.ETIMEDOUT:Ff.ECONNABORTED,t,m)),m=null},void 0===i&&o.setContentType(null),"setRequestHeader"in m&&Df.forEach(o.toJSON(),function(t,e){m.setRequestHeader(e,t)}),Df.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),h&&"json"!==h&&(m.responseType=r.responseType),p&&([u,l]=wm(p,!0),m.addEventListener("progress",u)),d&&m.upload&&([a,c]=wm(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(r.cancelToken||r.signal)&&(s=e=>{m&&(n(!e||e.type?new _m(null,t,m):e),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const _=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(r.url);_&&-1===im.protocols.indexOf(_)?n(new Ff("Unsupported protocol "+_+":",Ff.ERR_BAD_REQUEST,t)):m.send(i||null)})},Nm=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let n,r=new AbortController;const i=function(t){if(!n){n=!0,s();const e=t instanceof Error?t:this.reason;r.abort(e instanceof Ff?e:new _m(e instanceof Error?e.message:e))}};let o=e&&setTimeout(()=>{o=null,i(new Ff(`timeout of ${e}ms exceeded`,Ff.ETIMEDOUT))},e);const s=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(t=>{t.unsubscribe?t.unsubscribe(i):t.removeEventListener("abort",i)}),t=null)};t.forEach(t=>t.addEventListener("abort",i));const{signal:a}=r;return a.unsubscribe=()=>Df.asap(s),a}},Im=function*(t,e){let n=t.byteLength;if(!e||n<e)return void(yield t);let r,i=0;for(;i<n;)r=i+e,yield t.slice(i,r),i=r},jm=async function*(t){if(t[Symbol.asyncIterator])return void(yield*t);const e=t.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},Rm=(t,e,n,r)=>{const i=async function*(t,e){for await(const n of jm(t))yield*Im(n,e)}(t,e);let o,s=0,a=t=>{o||(o=!0,r&&r(t))};return new ReadableStream({async pull(t){try{const{done:e,value:r}=await i.next();if(e)return a(),void t.close();let o=r.byteLength;if(n){let t=s+=o;n(t)}t.enqueue(new Uint8Array(r))}catch(t){throw a(t),t}},cancel:t=>(a(t),i.return())},{highWaterMark:2})},{isFunction:Pm}=Df,Dm=(({Request:t,Response:e})=>({Request:t,Response:e}))(Df.global),{ReadableStream:Lm,TextEncoder:Fm}=Df.global,$m=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},Bm=t=>{t=Df.merge.call({skipUndefined:!0},Dm,t);const{fetch:e,Request:n,Response:r}=t,i=e?Pm(e):"function"==typeof fetch,o=Pm(n),s=Pm(r);if(!i)return!1;const a=i&&Pm(Lm),u=i&&("function"==typeof Fm?(c=new Fm,t=>c.encode(t)):async t=>new Uint8Array(await new n(t).arrayBuffer()));var c;const l=o&&a&&$m(()=>{let t=!1;const e=new n(im.origin,{body:new Lm,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),h=s&&a&&$m(()=>Df.isReadableStream(new r("").body)),d={stream:h&&(t=>t.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!d[t]&&(d[t]=(e,n)=>{let r=e&&e[t];if(r)return r.call(e);throw new Ff(`Response type '${t}' is not supported`,Ff.ERR_NOT_SUPPORT,n)})});const p=async(t,e)=>{const r=Df.toFiniteNumber(t.getContentLength());return null==r?(async t=>{if(null==t)return 0;if(Df.isBlob(t))return t.size;if(Df.isSpecCompliantForm(t)){const e=new n(im.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return Df.isArrayBufferView(t)||Df.isArrayBuffer(t)?t.byteLength:(Df.isURLSearchParams(t)&&(t+=""),Df.isString(t)?(await u(t)).byteLength:void 0)})(e):r};return async t=>{let{url:i,method:s,data:a,signal:u,cancelToken:c,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:_,headers:y,withCredentials:v="same-origin",fetchOptions:b}=Cm(t),w=e||fetch;_=_?(_+"").toLowerCase():"text";let x=Nm([u,c&&c.toAbortSignal()],f),T=null;const k=x&&x.unsubscribe&&(()=>{x.unsubscribe()});let S;try{if(g&&l&&"get"!==s&&"head"!==s&&0!==(S=await p(y,a))){let t,e=new n(i,{method:"POST",body:a,duplex:"half"});if(Df.isFormData(a)&&(t=e.headers.get("content-type"))&&y.setContentType(t),e.body){const[t,n]=xm(S,wm(Tm(g)));a=Rm(e.body,65536,t,n)}}Df.isString(v)||(v=v?"include":"omit");const e=o&&"credentials"in n.prototype,u={...b,signal:x,method:s.toUpperCase(),headers:y.normalize().toJSON(),body:a,duplex:"half",credentials:e?v:void 0};T=o&&new n(i,u);let c=await(o?w(T,b):w(i,u));const f=h&&("stream"===_||"response"===_);if(h&&(m||f&&k)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=c[e]});const e=Df.toFiniteNumber(c.headers.get("content-length")),[n,i]=m&&xm(e,wm(Tm(m),!0))||[];c=new r(Rm(c.body,65536,n,()=>{i&&i(),k&&k()}),t)}_=_||"text";let A=await d[Df.findKey(d,_)||"text"](c,t);return!f&&k&&k(),await new Promise((e,n)=>{ym(e,n,{data:A,headers:fm.from(c.headers),status:c.status,statusText:c.statusText,config:t,request:T})})}catch(e){if(k&&k(),e&&"TypeError"===e.name&&/Load failed|fetch/i.test(e.message))throw Object.assign(new Ff("Network Error",Ff.ERR_NETWORK,t,T),{cause:e.cause||e});throw Ff.from(e,e&&e.code,t,T)}}},qm=new Map,Um=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:i}=e,o=[r,i,n];let s,a,u=o.length,c=qm;for(;u--;)s=o[u],a=c.get(s),void 0===a&&c.set(s,a=u?new Map:Bm(e)),c=a;return a},Vm=(Um(),{http:null,xhr:Mm,fetch:{get:Um}});Df.forEach(Vm,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}});const Gm=t=>`- ${t}`,zm=t=>Df.isFunction(t)||null===t||!1===t;const Wm={getAdapter:function(t,e){t=Df.isArray(t)?t:[t];const{length:n}=t;let r,i;const o={};for(let s=0;s<n;s++){let n;if(r=t[s],i=r,!zm(r)&&(i=Vm[(n=String(r)).toLowerCase()],void 0===i))throw new Ff(`Unknown adapter '${n}'`);if(i&&(Df.isFunction(i)||(i=i.get(e))))break;o[n||"#"+s]=i}if(!i){const t=Object.entries(o).map(([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build"));let e=n?t.length>1?"since :\n"+t.map(Gm).join("\n"):" "+Gm(t[0]):"as no adapter specified";throw new Ff("There is no suitable adapter to dispatch the request "+e,"ERR_NOT_SUPPORT")}return i},adapters:Vm};function Jm(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new _m(null,t)}function Hm(t){Jm(t),t.headers=fm.from(t.headers),t.data=mm.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Wm.getAdapter(t.adapter||am.adapter,t)(t).then(function(e){return Jm(t),e.data=mm.call(t,t.transformResponse,e),e.headers=fm.from(e.headers),e},function(e){return gm(e)||(Jm(t),e&&e.response&&(e.response.data=mm.call(t,t.transformResponse,e.response),e.response.headers=fm.from(e.response.headers))),Promise.reject(e)})}const Xm="1.13.4",Km={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Km[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const Qm={};Km.transitional=function(t,e,n){return(r,i,o)=>{if(!1===t)throw new Ff(function(t,e){return"[Axios v"+Xm+"] Transitional option '"+t+"'"+e+(n?". "+n:"")}(i," has been removed"+(e?" in "+e:"")),Ff.ERR_DEPRECATED);return e&&!Qm[i]&&(Qm[i]=!0),!t||t(r,i,o)}},Km.spelling=function(t){return(t,e)=>!0};const Zm={assertOptions:function(t,e,n){if("object"!=typeof t)throw new Ff("options must be an object",Ff.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const o=r[i],s=e[o];if(s){const e=t[o],n=void 0===e||s(e,o,t);if(!0!==n)throw new Ff("option "+o+" must be "+n,Ff.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Ff("Unknown option "+o,Ff.ERR_BAD_OPTION)}},validators:Km},Ym=Zm.validators;class tg{constructor(t){this.defaults=t||{},this.interceptors={request:new Kf,response:new Kf}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const n=e.stack?e.stack.replace(/^.+\n/,""):"";try{t.stack?n&&!String(t.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(t.stack+="\n"+n):t.stack=n}catch(t){}}throw t}}_request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Om(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:i}=e;void 0!==n&&Zm.assertOptions(n,{silentJSONParsing:Ym.transitional(Ym.boolean),forcedJSONParsing:Ym.transitional(Ym.boolean),clarifyTimeoutError:Ym.transitional(Ym.boolean)},!1),null!=r&&(Df.isFunction(r)?e.paramsSerializer={serialize:r}:Zm.assertOptions(r,{encode:Ym.function,serialize:Ym.function},!0)),void 0!==e.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Zm.assertOptions(e,{baseUrl:Ym.spelling("baseURL"),withXsrfToken:Ym.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=i&&Df.merge(i.common,i[e.method]);i&&Df.forEach(["delete","get","head","post","put","patch","common"],t=>{delete i[t]}),e.headers=fm.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach(function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(a=a&&t.synchronous,s.unshift(t.fulfilled,t.rejected))});const u=[];let c;this.interceptors.response.forEach(function(t){u.push(t.fulfilled,t.rejected)});let l,h=0;if(!a){const t=[Hm.bind(this),void 0];for(t.unshift(...s),t.push(...u),l=t.length,c=Promise.resolve(e);h<l;)c=c.then(t[h++],t[h++]);return c}l=s.length;let d=e;for(;h<l;){const t=s[h++],e=s[h++];try{d=t(d)}catch(t){e.call(this,t);break}}try{c=Hm.call(this,d)}catch(t){return Promise.reject(t)}for(h=0,l=u.length;h<l;)c=c.then(u[h++],u[h++]);return c}getUri(t){return Xf(Am((t=Om(this.defaults,t)).baseURL,t.url,t.allowAbsoluteUrls),t.params,t.paramsSerializer)}}Df.forEach(["delete","get","head","options"],function(t){tg.prototype[t]=function(e,n){return this.request(Om(n||{},{method:t,url:e,data:(n||{}).data}))}}),Df.forEach(["post","put","patch"],function(t){function e(e){return function(n,r,i){return this.request(Om(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}tg.prototype[t]=e(),tg.prototype[t+"Form"]=e(!0)});const eg=tg;class ng{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(t){e=t});const n=this;this.promise.then(t=>{if(!n._listeners)return;let e=n._listeners.length;for(;e-- >0;)n._listeners[e](t);n._listeners=null}),this.promise.then=t=>{let e;const r=new Promise(t=>{n.subscribe(t),e=t}).then(t);return r.cancel=function(){n.unsubscribe(e)},r},t(function(t,r,i){n.reason||(n.reason=new _m(t,r,i),e(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}toAbortSignal(){const t=new AbortController,e=e=>{t.abort(e)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let t;return{token:new ng(function(e){t=e}),cancel:t}}}const rg=ng;const ig={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ig).forEach(([t,e])=>{ig[e]=t});const og=ig;const sg=function t(e){const n=new eg(e),r=zp(eg.prototype.request,n);return Df.extend(r,eg.prototype,n,{allOwnKeys:!0}),Df.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return t(Om(e,n))},r}(am);sg.Axios=eg,sg.CanceledError=_m,sg.CancelToken=rg,sg.isCancel=gm,sg.VERSION=Xm,sg.toFormData=Vf,sg.AxiosError=Ff,sg.Cancel=sg.CanceledError,sg.all=function(t){return Promise.all(t)},sg.spread=function(t){return function(e){return t.apply(null,e)}},sg.isAxiosError=function(t){return Df.isObject(t)&&!0===t.isAxiosError},sg.mergeConfig=Om,sg.AxiosHeaders=fm,sg.formToJSON=t=>om(Df.isHTMLForm(t)?new FormData(t):t),sg.getAdapter=Wm.getAdapter,sg.HttpStatusCode=og,sg.default=sg;const ag=sg,{memoize:ug}=bn,cg=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in http.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library.js"},{}),t=>{const e=t[lg.LAMBDA_OBJ],n="uri"in e&&"_default"in e.uri?e.uri._default:void 0,r="header"in e&&"_default"in e.header?e.header._default:void 0,i=async n=>{t[lg.http.URI];const r=t[lg.http.HEADER];let i=n;i=1===i.length?i[0]:i;const o=Object.keys(e),s=["uri","post","put","get","header","?graph"].filter(t=>o.includes(t)),a=(lg.DOMAIN&&t[lg.DOMAIN],lg.APPID&&t[lg.APPID],s.includes("post")?"post":s.includes("put")?"put":"get"),u=bn.throttle(async()=>await(async({http_mode:t,uri:e}={})=>{if(["post","put"].includes(t)){r?.X_CSRF_Token&&(ag.defaults.headers.post["X-CSRF-Token"]=r.X_CSRF_Token);try{const t=s.includes("put")?ag.put(e,i):ag.post(e,i);return await t}catch(t){return t.response||t.request,t.response}}else try{const t=e?ag.get(e):ln([{data:"LEAF element error: http get request submitted with undefined URI"}]);return(await t).data}catch(t){return t.response||t.request,t}})({http_mode:a,uri:"localhost:51054"}),1e3);return await u()},o={codebase:"ghostos/api/parser/nodelogic/elements/library/http.js",refnode:t[lg.REFNODE]};return{leaflogic:(e,s)=>{const a=new Pt,u=n?p_(s,e,void 0,o,{leaflogic:n,datalogic:{post:e=>(t[lg.http.URI]=e,e)}}):{_stream:ln("https://httpbin.org"),_control:{_stream:s._stream}},c=r?p_(s,e,void 0,o,{leaflogic:r,datalogic:{post:e=>(t[lg.http.HEADER]=e,e)}}):{_stream:ln(""),_control:{_stream:s._stream}},l=Et([u._control._stream,c._control._stream]),h=Et([u._stream,c._stream]),d=l.pipe(Nt(h),V(t=>t[0]));let p=!1;const f=d.pipe(Nt(...e.map(t=>t._stream)),It(t=>i(t.slice(1))),V(e=>(p=!0,e?.length>1||!Array.isArray(e)?a.next(e):1===e?.length&&a.next(e[0]),t[lg.CTRLIN])),Lt());return{_stream:a.pipe($t(t=>p),V(t=>t),Lt()),_control:{_stream:f.pipe(V(t=>t),Lt())}}},datalogic:{pre:t=>t,post:t=>{const e=t=>{const n=typeof t;return"object"===n?Array.isArray(t)?t.map(t=>e(t)):t?Object.fromEntries(Object.entries(t).map(([t,n])=>[t,e(n)])):t:"string"===n?(t=>{var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return t.replace(/[&<>"']/g,function(t){return e[t]})})(t):t};return hg(e(t),"elementio")}}}}),lg={LAMBDA_OBJ:"_lambda_obj",REFNODE:"_refnode",RTCONTEXT:"_rtcontext",CTRLIN:"_ctrl_in",DATAIN:"_data_in",DOMAIN:"_domain",APPID:"_appid",http:{URI:"_http_uri",HEADER:"_http_header",REQUEST_TTL_CACHE:"_http_request_ttl_cache"},href:{URI:"_href_uri"},gnav:{EDGES:"_edges",BACKDROP:"_backdrop"},prompt:{UIDEFS:"_uidefs"},mediaplayer:{URI:"_uri"},sound:{CONFIG:"_sound_config",SOUNDSTAGE:"_daw_object"},html:{TEMPLATE:"_html_template"}},hg=(t,e="defaultio",n=!0)=>n?wn(e,t):t,dg={mediaplayer:es,http:$p,gnav:Lp,popup:os,image:cs,editor:as,text:us,prompt:rs,mediainput:hs,midi:fs,sound:Pp,html:Vp,href:qp,form:Gp,directus:cg},pg=Wt("leafdeckspade"),fg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(await $o.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i}),e_.lambda(t)({refnodedata:{leaf:{logic:{args:{graphuuid:"",domain:"breezyforest",appid:"leafdeckspade",graphaddrstr:"breezyforest/spade"}}}},nodelambda:[],contextuallambda:[]})),a=(await s,{codebase:"leafdeckspade.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data});return(t,r)=>{let i=["_leafdeckdiamond"];const s=r._config?.loopidx,{type:u,args:c}=n.leaf.logic,l="_default"in o?(t,n)=>{const r={...n};s>=0&&(r._config.loopidx=s),r._config.clubrefnode=e;return o._default(t,r)}:(t,e)=>({...Bg(t),_control:e}),h=r._stream;return p_({_stream:h},t,void 0,{...a,metastep:"creating a leafdeckspade element"},{datalogic:{pre:t=>Array.isArray(t)?t.map(t=>xn(i,t)).filter(t=>t):xn(i,t),post:t=>{const e=Array.isArray(t)?t:[t],n={type:"leafdeckspade",uuid:Kn(),name:En(pg.editorconfig.namedatakey,c),description:"{description}",lambdas:{default:"defaultLambda",defaultLambda:l,bro:t=>t},diamonds:e};return wn("screenio",n)}}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s}},mg=Wt("leafdeckheart"),gg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(await $o.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i}),await zo.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckheart"}}}},nodelambda:[],contextuallambda:i}),{codebase:"leafdeckheart.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data});return(t,r)=>{let i=["_leafdeckdiamond"];const a=r._config?.loopidx,{type:u,args:c}=n.leaf.logic,l="_default"in o?(t,n)=>{const r={...n};a>=0&&(r._config.loopidx=a),r._config.clubrefnode=e;return o._default(t,r)}:(t,e)=>({...Bg(t),_control:e}),h=r._stream;return p_({_stream:h},t,void 0,{...s,metastep:"creating a leafdeckheart element"},{datalogic:{pre:t=>Array.isArray(t)?t.map(t=>xn(i,t)).filter(t=>t):xn(i,t),post:t=>{const e=Array.isArray(t)?t:[t],n={type:"leafdeckheart",uuid:Kn(),name:En(mg.editorconfig.namedatakey,c),description:"{description}",lambdas:{default:"defaultLambda",defaultLambda:l,bro:t=>t},diamonds:e};return wn("screenio",n)}}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s}},_g=Wt("leafdeckdiamond"),yg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(await $o.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i}),{codebase:"leafdeckdiamond.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data});return(t,r)=>{let i=["_leafdeckclub"];const a=r._config?.loopidx,{type:u,args:c}=n.leaf.logic,l="_default"in o?(t,n)=>{const r={_stream:n._stream.pipe(V(t=>t)),_config:{...n._config}};a>=0&&(r._config.loopidx=a),r._config.clubrefnode=e;const i=o._default(t,n);return{_stream:i._stream.pipe(V(t=>t)),_control:{_stream:i._control._stream.pipe(V(t=>t))}}}:"href"in o&&"_default"in o.href?(t,e)=>{const n=o.href._default(t,e);return{_stream:n._stream.pipe(V(t=>(window.location.href.slice(-t.length)!==t&&(window.location.href=t),t))),_control:{...e._control,_stream:n._control._stream.pipe(V(t=>t))}}}:(t,e)=>({...Bg(t),_control:e}),h=r._stream,d=p_({_stream:h},t,void 0,{...s,metastep:"creating a leafdeckdiamond element"},{datalogic:{pre:t=>{const e=Array.isArray(t)?t:[t],n={clubs:[],nodeinput:[]};return e.map(t=>{nn(t)&&(t._bname===i[0]?n.clubs.push(xn(i,t)):"nodeinput"===t._bname&&n.nodeinput.push(xn("nodeinput",t)))}),n},post:t=>{t.clubs;const n=t.clubs.filter(t=>t),r="subscribe"in o&&0===n.length,i={type:"leafdeckdiamond",uuid:Kn(),nodeuuid:e,name:En(_g.editorconfig.namedatakey,c),svgicon:"https://www.leafgon.com/icons/hardware/laptop_mac/materialicons/24px.svg",description:"{description}",nodeinput:t.nodeinput,lambdas:{default:"defaultLambda",defaultLambda:l,bro:t=>t},subscription:r,clubs:n};return wn("_leafdeckdiamond",i)}}});return{_stream:d._stream.pipe(V(t=>t)),_control:d._control}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({_stream:e(t,n),_control:n})}),s}},vg=Wt("leafdeckclub"),bg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s={codebase:"leafdeckclub.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,r)=>{const i=r._config?.loopidx,{type:a,args:u}=n.leaf.logic,c="_default"in o?(t,n)=>{const r={...n};i>=0&&(r._config.loopidx=i),r._config.clubrefnode=e;return o._default(t,r)}:(t,e)=>({...Bg(t),_control:e}),l=r._stream.pipe(V(t=>t)),h=p_({_stream:l},t,void 0,{...s,metastep:"creating a leafdeckclub element"},{datalogic:{pre:t=>{const e=Array.isArray(t)?t:[t],n={nodeinput:[]};return e.map(t=>{nn(t)&&"nodeinput"===t._bname&&n.nodeinput.push(xn("nodeinput",t))}),n},post:t=>{const n="subscribe"in o,r={type:"leafdeckclub",uuid:Kn(),nodeuuid:e,name:En(vg.editorconfig.namedatakey,u),svgicon:"https://www.leafgon.com/icons/hardware/laptop_mac/materialicons/24px.svg",description:"{description}",nodeinput:t.nodeinput,lambdas:{default:"defaultLambda",defaultLambda:c,bro:t=>t},subscription:n};return wn("_leafdeckclub",r)}}});return{_stream:h._stream.pipe(V(t=>t)),_control:h._control}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=t=>({...e(t,controlflow$obj),_control:controlflow$obj})}),s}},wg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree});const o=Wo.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckspade"}}}},nodelambda:[],contextuallambda:i}),s=Wo.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckheart"}}}},nodelambda:[],contextuallambda:i}),a=Wo.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafpopupview"}}}},nodelambda:[],contextuallambda:i}),u=void 0;return t=>{const e=o(t),n=s(t),r=a(t),i=u([e,n]).pipe(V(t=>t),V(t=>t));r.pipe(V(t=>t),V(t=>{}));return i.pipe($t(t=>t))}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=t=>e(t)}),s}},xg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s="_default"in o?t=>o._default([t]):t=>t,a=zo.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafpopupview"}}}},nodelambda:[],contextuallambda:i});return t=>{const e=t.pipe(V(t=>t),V(t=>{let e=null;return e={type:"leafpopupview",uuid:"308bd84f-3af2-478e-ae35-b2842a9bd3a1",svgicon:"https://www.leafgon.com/icons/hardware/laptop_mac/materialicons/24px.svg",description:"coolest popupview in LEAF",lambdas:{default:"defaultLambda",defaultLambda:s,bro:t=>t}},e||t}));return a(e.pipe($t(t=>t)))}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=t=>e(t)}),s}};const Tg=wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafelement.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/leafelement.js"},{}),kg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{type:s,args:a}=n.leaf.logic,u=n.leaf.logic.args.elementname,c=(t.gos.etaTree.hostdomain,t.gos.etaTree.hostappid,t.gos.etaTree.domain),l=t.gos.etaTree.appid;"domain"in o&&"_default"in o.domain&&o.domain._default,"appid"in o&&"_default"in o.appid&&o.appid._default,"uidefs"in o&&"_default"in o.uidefs&&o.uidefs._default,"edges"in o&&"_default"in o.edges&&o.edges._default,new qt(Tg);["f30e","7a65"].includes(e.slice(0,4));const h={codebase:"leafelement.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};let d={};d[lg.LAMBDA_OBJ]=o,d[lg.REFNODE]=e,d[lg.RTCONTEXT]={graphdomain:c,graphappid:l,refnodedata:n,nodelambda:r,contextuallambda:i};const p=((t,e)=>Object.keys(dg).includes(e)&&dg[e]?{...dg[e](t)}:void 0)(d,u);return(n,r)=>{e?.slice(0,4);const i=r._stream.pipe(V(e=>(d[lg.CTRLIN]=e,d[lg.DOMAIN]=t.gos.etaTree.domain,d[lg.APPID]=t.gos.etaTree.appid,e)));"elementio$"in p&&(t.gos.etaTree.leafio.elementioLUT[e]=p.elementio$);return p_({_stream:i},n,void 0,{...h,metastep:"element "+u},{leaflogic:p?p.leaflogic:void 0,datalogic:{pre:p?p.datalogic.pre:void 0,post:p?p.datalogic.post:void 0}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s},methods:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={configtext:""};return{texteditor:{setTextSource:r=>{o.configtext=r;const i={...n};i.leaf.logic.args.elementconfig=r,is_interactive||t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:encodeUnicode(JSON.stringify(i))}})},getTextSource:()=>n.leaf.logic.args.elementconfig},general:{getNodeData:()=>n,getLambdaLUT:async()=>{const n=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),o={};return Object.entries(n).map(([t,e])=>{o[t]=(t,n)=>({...e(t,n),_control:n})}),o},setElementName:r=>{const i={...n};i.leaf.logic.args.elementname=r,t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:encodeUnicode(JSON.stringify(i))}})}}}}};n(4106);function Sg(t,e,n){const r={leafoutflowport:Sn,leafinflowport:kn,leafscreenio:An,leafmemoryio:Wn,leafdeckspade:fg,leafdeckheart:gg,leafdeckdiamond:yg,leafdeckclub:bg,leafgnav:wg,leafpopupview:xg,leafelement:kg,leafgraph:e_,leaflambdagraph:Vg,leafanchor:n_,leafspell:Jg,leafspelldef:Hg,leafloopyspell:Qg,leafchronosflow:Fo,leafasyncflow:Fo,leafmixflow:$o,leafgateflow:qo,leaflisp:Lo,leaflabel:Vo,leafdelabel:Go,leafbottle:zo,leafunbottle:Wo,leafcrate:Jo,leafconfig:Zo};return r[t][e]?r[t][e](n):void 0}const{memoize:Ag}=bn,Eg={isdebug:!1},Og=wn("error",{type:"critical",message:"LEAF core error: race condition detected in eta.js",codebase:"/src/ghostos/api/parser/eta.js"},{}),Cg=(t,e)=>([...Array(e).keys()].map(e=>{t[e]=!1}),t),Mg=(t,e={time:-1,count:-1},n=void 0,r={})=>{wn("empty_bottle","empty_data",{_provenance:{rt_context:r,codebase:"eta.js doChronosSynchronize"}});const i=new Pt,o=(t[0]._control._stream,t.length,t.map(t=>t._control._stream)),s=t.map(t=>t._stream),a={};let u={};const c=t.length;Cg(a,c);return{ctrl:n&&n.synchronized?Bt(...t.map((t,e)=>t._control._stream.pipe(Nt(t._stream),V(t=>[e,t])))).pipe(V(t=>{if(a[t[0]]=!0,u[t[0]]=t[1],((t,e)=>{let n=!0;return[...Array(e).keys()].map(e=>{n&&=t[e]}),n})(a,c)){Cg(a,c);const t=Object.values(u);return u={},t}}),$t(t=>void 0!==t),V(t=>{if(r.nodeuuid,n.checksync()){n.initflowcache(),r.nodeuuid;let e=t.map(t=>{const e=t.slice(1).flat();return 1===e.length?e[0]:e});i.next(e);const o={...t[0][0]};let s=t.map(t=>t[0].traces);return 1===s.length&&(s=s[0]),o.traces=[s],o}}),$t(t=>void 0!==t)):o.length>1?Bt(...o.map((t,e)=>t.pipe(Nt(s[e]),V(t=>{const e=t[0];e.length>1&&e.includes(void 0),r.nodeuuid,nn(t[1])&&t[1]._bname;let n=t.slice(1);return i.next(n),e})))):o[0].pipe(Nt(s[0]),V(t=>{const e=t[0];nn(t[1])&&t[1]._bname;let n=t[1];return i.next(n),e})),data:i.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Og)))}},Ng=(t,e,n,r,i,o,s)=>{const a={refnode:t,codebase:"eta.js weaveDataflowPlane",domain:i.domain,appid:i.appid},u=wn("empty_bottle","empty_data",{_provenance:{refnode:t,codebase:"eta.js weaveDataflowPlane"}}),c={},l=(t,h=void 0)=>t.map(t=>{if(c[t]?.data_out&&c[t]?.ctrl_out)return{_stream:c[t].data_out._stream.pipe(V(t=>t)),_control:{_stream:c[t].ctrl_out._stream.pipe(V(t=>t))}};{const d=r[t];if(!d||!("_default"in d))throw`LEAF error: weaveDataflowPlane(): the ${d?"":"undefined"} eta reduced function with the refnode ${t} has no _default defined.`;const p=h||i.leafgraph.graph.dataflow.mapInEdges(t,t=>i.leafgraph.graph.dataflow.source(t)),f=0===p.length?[{_stream:s._stream,_control:{_stream:o._stream}}]:l(p).filter(t=>t);p.length,((t,e,n,r=!0)=>{const o=t,s=i.leafgraph.graph.dataflow.mapInEdges(o,t=>i.leafgraph.graph.dataflow.source(t));o in c||(c[o]={inputnodes:s,synchronized:!1,flowcache:{},initflowcache:()=>{const t=c[o].inputnodes.length;c[o].flowcache=t>1?Object.keys(c[o].inputnodes)?.reduce((t,e)=>(t[e]=!1,t),{}):{0:!1}},recordflow:t=>{c[o].flowcache[t]=!0},checksync:()=>Object.values(c[o].flowcache).reduce((t,e)=>t&&e,!0),data_in$Arr:n.map((t,e)=>t._stream.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Og)),V(t=>(["c10cbbbb-14d5-4270-b17a-1965afcabc98"].includes(o),nn(t)&&t._bname,["c822ae2e-1be8-46be-b2cb-21a43cef0555","e9e6e44b-792b-46d0-b1d3-58ce2f46c45b"].includes(o)&&nn(t)&&t._bname,t)))),data_out:void 0,ctrl_in$Arr:e.map((t,e)=>t._stream.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Og)),V(t=>(c[o][e],["c822ae2e-1be8-46be-b2cb-21a43cef0555","e9e6e44b-792b-46d0-b1d3-58ce2f46c45b"].includes(o),c[o].recordflow(e),t)))),ctrl_out:void 0,get_composite_in$objArr:()=>c[o].data_in$Arr.map((t,e)=>({_stream:t,_control:{_stream:c[o].ctrl_in$Arr[e]}}))},c[o].initflowcache(),s.length>1&&r&&(c[o].synchronized=!0))})(t,f.map(t=>({_stream:t._control._stream})),f.map(t=>({_stream:t._stream})));const m=i.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data,g="leafchronosflow"===m.leaf.logic.type,{ctrl:_,data:y}=g?{ctrl:Bt(...c[t].get_composite_in$objArr().map(t=>t._control._stream)),data:void 0}:Mg(c[t].get_composite_in$objArr(),{time:-1,count:-1},c[t],{...a,...m,at:"eta.js _weaveDataflowPlane",nodeuuid:t}),v={_stream:_.pipe(V(t=>t))},b=g?c[t].get_composite_in$objArr().map((t,e)=>({_stream:t._stream.pipe(V(t=>t))})):[{_stream:y.pipe(V(t=>t))}];if(p.length>0){if(n.includes(t)){if("leafoutflowport"===m.leaf.logic.type){const e=d._default(b,v);return c[t].data_out={_stream:e._stream},c[t].ctrl_out={_stream:e._control._stream},{_stream:e._stream.pipe(V(t=>t)),_control:{_stream:e._control._stream.pipe(V(t=>t))}}}{const e=d._default(b,v);return c[t].data_out={_stream:e._stream.pipe(V(e=>({...u,_label:{...u._label,context:"a nudge data bottle returned by an exitless end node, "+t}})))},c[t].ctrl_out={_stream:e._control._stream.pipe(V(t=>t))},{_stream:c[t].data_out._stream.pipe(V(t=>t)),_control:{_stream:c[t].ctrl_out._stream.pipe(V(t=>t))}}}}{const e=d._default(b,v);return c[t].data_out={_stream:e._stream},c[t].ctrl_out={_stream:e._control._stream},{_stream:e._stream.pipe(V(t=>t)),_control:{_stream:e._control._stream.pipe(V(t=>t))}}}}if(!e.includes(t))throw`LEAF error: weaveDataflowPlane(): the eta reduced function with the refnode ${t} has matched against incomplete startnodes reference.`;if("leafinflowport"===i.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data.leaf.logic.type){const e=d._default(b,v);return c[t].data_out={_stream:e._stream},c[t].ctrl_out={_stream:e._control._stream},{_stream:e._stream.pipe(V(t=>t)),_control:{_stream:e._control._stream.pipe(V(t=>t))}}}{const e=b.map(t=>({_stream:t._stream.pipe(V(t=>({...u,_label:{...u._label,context:"input-less node dataflow nudging message as per ctrl signal"}})))})),n=d._default(e,v);return c[t].data_out={_stream:n._stream},c[t].ctrl_out={_stream:n._control._stream},{_stream:n._stream.pipe(V(t=>t)),_control:{_stream:n._control._stream.pipe(V(t=>t))}}}}}),h=l(n);h.length;const{ctrl:d,data:p}=h.length>1?((t,e={time:-1,count:-1},n={})=>{const r=t.length,i=new Pt;return{ctrl:Bt(...t.map(t=>{let e;return t._control._stream.pipe(V(t=>(e=globalThis.TRACEON?{...t,traces:d_(t?.traces,{...n,desc:"doChronosAsynchronize(), a ctrl signal came through out of inputcount of "+r},!0)}:t,e)),Nt(t._stream),V(t=>(i.next(2===t.length?t[1]:t.slice(1)),t[0])),Lt())})).pipe(V(t=>t)),data:i.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Og)))}})(h,{time:-1,count:-1},{...a,at:"eta.js _weaveDataflowPlane",endnodes:n}):{ctrl:h[0]._control._stream,data:h[0]._stream};return[{...{_stream:p},_control:{_stream:d}},c]},Ig=Ag(async({refnode:t,component_members:e,contextuallambda:n,etaTree:r}={})=>{const i=[],o=[],s={};["7b1f"].includes(t?.slice(0,4)),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t);const a=e.map(t=>{r.leafgraph.edges.lambda.sourcelut[t];const e=r.etaReduceLEAFNode({nodeuuid:t,contextuallambda:n});return e.then(e=>{s[t]=e;const n=r.leafgraph.edges.data.sources.has(t);r.leafgraph.edges.data.targets.has(t)||i.push(t),n||o.push(t)}),e});["7b1f","main"].includes(t?.slice(0,4)),await Promise.all(a),["7b1f","main"].includes(t?.slice(0,4)),["2ee89b44-16af-472f-97d4-47ae65f064c8"].includes(t);const u=((t,e,n,r,i,o={})=>{const s={main:"nav main dataflow",leafgraph:"leafgraph main dataflow",editor:"editor main dataflow"},a={codebase:"eta.js",refnode:t,leafnode:Object.keys(s).includes(t)?s[t]:i.leafgraph.graph.dataflow.getNodeAttributes(t)?.leafnode.data,metadata:o,domain:i.domain,appid:i.appid};return(u=[],c)=>{const l={data_in:new Pt,ctrl_in:new Pt,data_out:new Pt,ctrl_out:new Pt},h={_stream:l.data_in},d={_stream:l.ctrl_in,_config:{}};["3980759d-7c59-4b9e-b799-87b5fd4cbcec","62890d97-837a-463e-aac9-d7fca2293427"].includes(t),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t);const[p,f]=Ng(t,e,n,r,i,d,h);return p_(c,u,void 0,{...a,metastep:"invoking parseDataflowFunc()"},{leaflogic:(e,n)=>{const r=new Pt;let a;const u=n._stream.pipe(V(t=>(a=t,t)),Nt(...e.map(t=>t._stream)),It(n=>{o.refnode,e.length;const r=1===e.length?n[1]:n.slice(1);return t in s||i.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data.leaf.logic,i.domain,i.appid,a.traces,setTimeout(()=>{l.data_in.next(r),l.ctrl_in.next(a)},1),p._control._stream}),Nt(p._stream),V(t=>{if(nn(t[1])&&"error"===t[1]._bname);else{const e=t[1];void 0!==e&&r.next(e)}return t[0]}),Lt());return{_stream:r.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Og))),_control:{...n,_stream:u}}},datalogic:{}})}})(t,i,o,s,r);return u},({refnode:t,component_members:e,contextuallambda:n,etaTree:r}={})=>JSON.stringify([...e,...n,r.sessionid])),jg=async({refnode:t,nodelambda:e,contextuallambda:n,etaTree:r,addnodelut:i=!1,metadata:o={}}={})=>{["7b1f"].includes(t?.slice(0,4)),["530acdcf-067d-4868-ba0c-b7a83e6edfdf"].includes(t),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t);const s=i?{_nodelut:{}}:{},a=e.map(e=>{r.graphcomponents.components.lut;const{idx:o,scope:a}=r.graphcomponents.components.lut[e],u=r.graphcomponents.components.nodegroups.lambda[o];if("dataflow"===a){const o=Ig({refnode:t,component_members:u,contextuallambda:n,etaTree:r});return["7b1f"].includes(t?.slice(0,4)),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t),o.then(n=>{["7b1f"].includes(t?.slice(0,4)),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t),s._default=n,i&&(s._nodelut._default=e)}),o}if("lambda"===a){if(!(u.length>1)){const o=r.etaReduceLEAFNode({nodeuuid:e,contextuallambda:n});return o.then(n=>{Object.entries(n).map(([n,o])=>{if(n in s){r.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data.leaf.logic}else s[n]=o,i&&(s._nodelut[n]=e)})}).catch(t=>{}),o}r.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data.leaf.logic}else{r.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data.leaf.logic,r.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data.leaf.logic}});return await Promise.all(a),["e36a8dd4-c8df-4dfa-b60c-765eeb5b99fd"].includes(t),s},Rg=(t,e,n,r,i,o,s,a,u,c,l=void 0)=>{const h={sessionid:l?l.sessionid:void 0,appmode:t,hostdomain:e,hostappid:n,domain:r,appid:i,leafgraph:void 0,graphcomponents:void 0,rootgraphstate:void 0,leafio:void 0,leaflakeio:void 0,mnemosyne:void 0,hostEtaTree:l,leafnodemethods:{},lookupRuntimeLambdaLUT:async(t,e,n,r,i,o=!1)=>{if(0===r.length)return{};const s=await Gn(h).getEtaTree(t,e);return o?await h.etaReduceLEAFNode({nodeuuid:n,contextuallambda:i}):await jg({refnode:n,nodelambda:r,contextuallambda:i,etaTree:s})},lookupLEAFNodeMethods:async(t,e=void 0)=>{if(t in h.leafnodemethods)return h.leafnodemethods[t];if(h.leafgraph.graph.dataflow.nodes().includes(t)){const e=h.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data,n=e.leaf.logic,r={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:h.leafio,etaTree:h},user:{spellbook:h.graphcomponents.spelldefs,lambdalut:h.leafgraph.edges.lambda.sourcelut}},i=Sg(n.type,"methods",r);if(i&&!(t in h.leafnodemethods)){const n=h.leafgraph.edges.lambda.sourcelut[t]?h.leafgraph.edges.lambda.sourcelut[t]:[];return h.leafnodemethods[t]=await i({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:[]}),h.leafnodemethods[t]}return}if(h.hostEtaTree)return h.hostEtaTree.lookupLEAFNodeMethods(t,e);if(void 0!==e){const n=e,r=n.leaf.logic,i={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:h.leafio,etaTree:h},user:{spellbook:h.graphcomponents.spelldefs,lambdalut:h.leafgraph.edges.lambda.sourcelut}},o=Sg(r.type,"methods",i);if(o&&!(t in h.leafnodemethods)){h.leafgraph.edges.lambda.sourcelut[t]&&h.leafgraph.edges.lambda.sourcelut[t];return h.leafnodemethods[t]=await o({refnode:t,refnodedata:n,nodelambda:[],contextuallambda:[]}),h.leafnodemethods[t]}}return},etaReduceLEAFNode:async({nodeuuid:t,contextuallambda:e}={})=>({_default:t=>{}}),loadElementJsEsmModule:async t=>{if(!(t in h.esmcache)){const e=await ag.get(t);h.esmcache[t]=e.data}return h.esmcache[t]},initTree:(t,e,n,r,i)=>{h.config=Eg,h.leafgraph=t,h.graphcomponents=e,h.rootgraphstate="initialized",h.leafio=n,h.leaflakeio=r,h.mnemosyne=i,h.esmcache={},void 0===h.hostEtaTree&&Gn(h).initEtaTreeForest();return h.etaReduceLEAFNode=Ag(async({nodeuuid:t,contextuallambda:e}={})=>{const n=t;["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(n),["0f35d8bc-36a6-4fe8-b185-f8ed5188b28f"].includes(n),["5f7d8750-8ebd-46ee-9a21-029d4000f452"].includes(n);const r=n?h.leafgraph.graph.dataflow.getNodeAttributes(n).leafnode.data.leaf.logic:void 0,i=t in h.leafgraph.edges.lambda.sourcelut?h.leafgraph.edges.lambda.sourcelut[t]:[];let o;if(t in h.graphcomponents.components.lut){const{scope:e}=h.graphcomponents.components.lut[t];o=e}const s={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:h.leafio,etaTree:h},user:{spellbook:h.graphcomponents.spelldefs,lambdalut:h.leafgraph.edges.lambda.sourcelut}};try{["b490aada-daab-4322-9001-14aea8bcb3d3","97fa68cf-bcc5-44cf-8311-ffa6a1422ac3","abb18b4d-b8af-4349-949d-fae21bc142ef","e9536f42-df6d-4086-a643-5f3c0b02aac9","b5a20ce3-3e67-42cd-9f60-3f70c6acd269","59fe3646-b338-4ab0-a8a6-d6ad401be4fa"].includes(t),r.type;const a=Sg(r.type,o,s),u=h.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data,c=await a({refnode:t,refnodedata:u,nodelambda:i,contextuallambda:e});return["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(n),["e36a8dd4-c8df-4dfa-b60c-765eeb5b99fd"].includes(n),"dataflow"===o?{_default:c}:"lambda"===o?c:void 0}catch(t){}},({nodeuuid:t,contextuallambda:e}={})=>JSON.stringify([t,...e])),h.etaReduceLEAFNode}};return h.initTree(o,s,a,u,c),h.sessionid=Kn(),h};const Pg=200,Dg=t=>Array.isArray(t)?t.flatMap(t=>t):t,Lg=(t,e,n=!1,r=!1,i=!1,o={})=>{const s=e.filter(t=>t);if(s.length>1){const o={_stream:ln("ctrl_nudge").pipe(hn(r=>Et(e.map(t=>t._stream)).pipe(V(e=>{t?.slice(0,4);const r=i?Ug({_bus:e,_flatten:n}):e,o=!i&&n&&Array.isArray(r)?r.filter(t=>t).flat():r;return o}))))};return r&&(o._control={_stream:ln("ctrl_nudge").pipe(hn(t=>Et(e.map(t=>t?._control?._stream).filter(t=>t)).pipe(V(t=>Array.isArray(t)?t.flat():t))))}),o}return s.length>0?{...s[0],_stream:s[0]._stream.pipe(V(e=>(t?.slice(0,4),e)))}:void 0},Fg=(t,e)=>{const n=t.filter(t=>e.some(e=>e in t)),r=t.filter(t=>e.every(e=>!(e in t))),i=(t,e)=>{if(nn(t))return{...t,_content:i(t._content,e)};if(rn(t))return{...t,_crate:t._crate.map(t=>i(t,e))};if(Array.isArray(t))return t.map(t=>i(t,e));if("object"==typeof t){return Object.assign({},...Object.entries(t).map(([t,n])=>({[t]:i(n,e)})))}if("string"==typeof t){return n=e,t.replace(/\{([\w\s]+)\}/g,function(t,e){return n[e]})}return t;var n};return{_stream:Bg(r)._stream.pipe(vn(Pg,100,100),V(t=>t),V(t=>Dg(t)),Nt(...n.map(t=>t._stream.pipe(vn(Pg,100,100),V(t=>Dg(t))))),V(t=>t)).pipe(V(t=>{const e=Dg(t[0]),n=Dg(t.slice(1)).filter(t=>!Array.isArray(t)&&"object"==typeof t),r=Object.assign({},...n);return i(e,r)}))}},$g=t=>{const e=t.filter(t=>t);if(e.length>1){return{_stream:e.map(t=>t._stream).pipe(Mt())}}if(e.length>0)return e[0]},Bg=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafdataflow.js",codebase:"/src/ghostos/api/utils/leafdataflow.js"},{}),t=>{const e=t.filter(t=>t);if(e.length>1){return{_stream:Bt(...e.map(t=>t._stream.pipe(V(t=>t))))}}if(e.length>0)return e[0]});const qg=(t,e=t=>!0)=>nn(t)&&"_databus"===t._bname&&e(t)?t._content:t,Ug=({_bus:t,_cond:e=t=>!0,_flatten:n=!1}={})=>n?Array.isArray(t)?t.map(t=>qg(t,e)).flat().filter(t=>t):qg(t,e):Array.isArray(t)?t.map(t=>qg(t,e)).filter(t=>t):qg(t,e),Vg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}) has a leaflambdagraph node (${e}) referencing an undefined lambda construct.`;const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree});return(t,e)=>{if("_default"in o){return{...o._default(t,e),_control:e}}if(t.length>0){return{...Bg(t),_control:e}}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s}};function Gg(t,e,n){void 0===t&&(t=0),void 0===n&&(n=yn);var r=-1;return null!=e&&(ct(e)?n=e:r=e),new X(function(e){var i,o=(i=t)instanceof Date&&!isNaN(i)?+t-n.now():t;o<0&&(o=0);var s=0;return n.schedule(function(){e.closed||(e.next(s++),0<=r?this.schedule(void 0,r):e.complete())},o)})}function zg(t){return t<=0?function(){return vt}:g(function(e,n){var r=0;e.subscribe(q(n,function(e){++r<=t&&(n.next(e),t<=r&&n.complete())}))})}const Wg=t=>Object.keys(t).map(e=>0===Object.keys(t[e]).length?e:void 0).filter(t=>t).sort(),Jg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{["0b62c9db-f889-4bf8-9773-c7b93ba9bd3f"].includes(e);const o=n.leaf.logic.args.spellname,s="{*}"===o;let a=i,u=await jg({refnode:e,nodelambda:r,contextuallambda:a,etaTree:t.gos.etaTree});const c=Wg(u);let l;c.length>0&&(a=a.concat(c),u=await jg({refnode:e,nodelambda:r,contextuallambda:a,etaTree:t.gos.etaTree})),["b490aada-daab-4322-9001-14aea8bcb3d3","97fa68cf-bcc5-44cf-8311-ffa6a1422ac3","abb18b4d-b8af-4349-949d-fae21bc142ef","e9536f42-df6d-4086-a643-5f3c0b02aac9","b5a20ce3-3e67-42cd-9f60-3f70c6acd269","59fe3646-b338-4ab0-a8a6-d6ad401be4fa"].includes(e);const h=async({refnode:t,spellbook:e,spellname:n,lambdalut:r,contextuallambda:i,etaTree:o}={})=>{if(n in e){const s=e[n];s in r&&r[s],"accio"===n&&t.slice(0,4);const a=await o.etaReduceLEAFNode({nodeuuid:s,contextuallambda:i});return"accio"===n&&t.slice(0,4),a}};const d={codebase:"leafspell.js",refnode:e,leafnode:t.gos.etaTree?.leafgraph?.graph.dataflow.getNodeAttributes(e).leafnode.data};let p=s?void 0:h_((async()=>{if(!o)return;if(globalThis?.DEBUG){const n=t.gos.etaTree.domain+"/"+t.gos.etaTree.appid+"/"+o+"/"+e;globalThis.trace[n]?globalThis.trace[n].push("parsing"):globalThis.trace[n]=["parsing"]}let n;if(["2293da4a-b517-4b0b-b396-cb030dc05900"].includes(e),["e9536f42-df6d-4086-a643-5f3c0b02aac9"].includes(e),e.slice(0,4),e.slice(0,4),n||u&&o in u&&(n=u[o]),!n){const r=t.user.spellbook,i=t.user.lambdalut;n=await h({refnode:e,spellbook:r,spellname:o,lambdalut:i,contextuallambda:a,etaTree:t.gos.etaTree})}if(!n){const r=t.gos.stdlambdalut,i=t.gos.standardSpellbook;n=await h({refnode:e,spellbook:i,spellname:o,lambdalut:r,contextuallambda:a,etaTree:t.gos.etaTree})}if(!n){const r=t.gos.curatedlambdalut,i=t.gos.curatedSpellbook;n=await h({refnode:e,spellbook:i,spellname:o,lambdalut:r,contextuallambda:a,etaTree:t.gos.etaTree})}if(["e9536f42-df6d-4086-a643-5f3c0b02aac9"].includes(e),globalThis?.DEBUG){const n=t.gos.etaTree.domain+"/"+t.gos.etaTree.appid+"/"+o+"/"+e;globalThis.trace[n]?globalThis.trace[n].push("parsed"):globalThis.trace[n]=["parsed"]}return l=n,l&&"_default"in l?n:void 0})(),3e4,"leafspell.js","LEAF Error: resolving transformation.leaflogic timed out",d);return(n,r)=>{const i=t=>t,a=t=>t,u=async(t,n,s)=>{const u=await t;if(void 0===u)return;if(void 0!==u&&"function"!=typeof u?._default)return;const c=p_({...r,_stream:n.pipe(V(t=>(void 0===t.sid?t.sid=[e]:t.sid.includes(e)||t.sid.push(e),t)))},[{_stream:s}],void 0,{...d,metastep:"executing parsed spell in the flow: "+o},{leaflogic:u._default,datalogic:{pre:i,post:a}});return c._control._stream.pipe(Nt(c._stream),V(t=>(t[0].sid?.pop(),t)),ls(()=>{}))},c=p_(r,n,void 0,{...d,metastep:"executing spell "+o},{leaflogic:s?(e,n)=>{const r=new Pt,i=new Pt,o=new Pt,s=new Pt,a=new Pt;let c;const l=e.length>1?merge(...e.map(t=>t._stream)):e[0]._stream,h=n._stream.pipe(Nt(l),It(e=>{e[0];const n=e[1];if(nn(n)&&"cast-spell"===n._bname){const r=n._content.nodeuuid,a=n._content.input,l=t.gos.etaTree.leafgraph.graph.dataflow.nodes().includes(r)?t.gos.etaTree:t.gos.etaTree.hostEtaTree,h=l?.leafgraph.graph.dataflow.getNodeAttributes(r).leafnode.data;if(["leafspelldef","leaflabel"].includes(h?.leaf?.logic?.type)){h.leaf.logic.args.spellname;p=t.gos.etaTree.lookupLEAFNodeMethods(r),u(p,i,o).then(t=>{void 0===t?(o.next(e[1]),i.next(e[0])):(c=t.subscribe({next:t=>{s.next(t)},error:t=>{},complete:()=>{}}),setTimeout(()=>{o.next(a),i.next(e[0])},1))})}else o.next(e[1]),i.next(e[0])}else o.next(e[1]),i.next(e[0]);return s}),Nt(s),V(t=>(r.next(t[1][1]),a.next(t[1][0]),t[1])),Nt(a),V(t=>t[1]),ls(()=>{void 0!==c&&(c.unsubscribe(),c=void 0)}),Lt());return{_stream:r,_control:{...n,_stream:h}}}:(t,e)=>{const n=new Pt,r=new Pt,i=new Pt,o=new Pt,s=new Pt;let a;const c=e._stream.pipe(Nt(...t.map(t=>t._stream)),It(t=>(void 0===a&&p?u(p,r,i).then(e=>{void 0===e?(i.next(t[1]),r.next(t[0])):(a=e.subscribe({next:t=>{o.next(t)},error:t=>{},complete:()=>{}}),setTimeout(()=>{i.next(t[1]),r.next(t[0])},1))}):(i.next(t[1]),r.next(t[0])),o)),Nt(o),V(t=>(n.next(t[1][1]),s.next(t[1][0]),t[1])),Nt(s),V(t=>t[1]),ls(()=>{void 0!==a&&(a.unsubscribe(),a=void 0)}),Lt());return{_stream:n,_control:{...e,_stream:c}}},datalogic:{pre:i,post:a}});return{_stream:c._stream.pipe(V(t=>t),Lt()),_control:{_stream:c._control._stream.pipe(V(t=>t),Lt())}}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=n.leaf.logic.args.spellname;let s,a={},u=i;if(!s){a=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});const n=Wg(a);n.length>0&&(u=u.concat(n),a=await jg({refnode:e,nodelambda:r,contextuallambda:u,etaTree:t.gos.etaTree})),a&&o in a&&(s=a[o])}const c=async({refnode:t,spellbook:e,spellname:n,lambdalut:r,contextuallambda:i,etaTree:o}={})=>{if(n in e){const s=e[n];s in r&&r[s],"accio"===n&&t.slice(0,4);const a=await o.etaReduceLEAFNode({nodeuuid:s,contextuallambda:i});return"accio"===n&&t.slice(0,4),a}};if(!s){const n=t.user.spellbook,r=t.user.lambdalut;s=await c({refnode:e,spellbook:n,spellname:o,lambdalut:r,contextuallambda:u,etaTree:t.gos.etaTree})}if(!s){const n=t.gos.stdlambdalut,r=t.gos.standardSpellbook;s=await c({refnode:e,spellbook:r,spellname:o,lambdalut:n,contextuallambda:u,etaTree:t.gos.etaTree})}if(!s){const n=t.gos.curatedlambdalut,r=t.gos.curatedSpellbook;s=await c({refnode:e,spellbook:r,spellname:o,lambdalut:n,contextuallambda:u,etaTree:t.gos.etaTree})}return s}},Hg={dataflow:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...Bg(t),_control:e}),lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=r.filter(e=>"lambda"===t.gos.etaTree.graphcomponents.components.lut[e].scope),s=r.filter(e=>"dataflow"===t.gos.etaTree.graphcomponents.components.lut[e].scope),a=await jg({refnode:e,nodelambda:o,contextuallambda:i,etaTree:t.gos.etaTree,addnodelut:!0,metadata:{codebase:"leafspelldef.js",context:"reduced_lambdalambda_obj"}}),u=await jg({refnode:e,nodelambda:s,contextuallambda:i,etaTree:t.gos.etaTree,metadata:{codebase:"leafspelldef.js",context:"reduced_defaultlambda_obj",spellname:n.leaf.logic.args.spellname}}),c=t=>t?Object.keys(t).reduce((e,n)=>("_nodelut"!==n&&("object"==typeof t[n]?e[n]=c(t[n]):e[n]=t[n]),e),{}):{};return{...c(a),...c(u)}},methods:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=r.filter(e=>"lambda"===t.gos.etaTree.graphcomponents.components.lut[e].scope),s=r.filter(e=>"dataflow"===t.gos.etaTree.graphcomponents.components.lut[e].scope),a=await jg({refnode:e,nodelambda:o,contextuallambda:i,etaTree:t.gos.etaTree,addnodelut:!0,metadata:{codebase:"leafspelldef.js",context:"reduced_lambdalambda_obj"}}),u=await jg({refnode:e,nodelambda:s,contextuallambda:i,etaTree:t.gos.etaTree,metadata:{codebase:"leafspelldef.js",context:"reduced_defaultlambda_obj",spellname:n.leaf.logic.args.spellname}}),c=t=>t?Object.keys(t).reduce((e,n)=>("_nodelut"!==n&&("object"==typeof t[n]?e[n]=c(t[n]):e[n]=t[n]),e),{}):{};return{...c(a),...c(u)}}};const Xg=wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafloopyspell.js",codebase:"/src/ghostos/api/parser/nodelogic/abstraction/leafloopyspell.js"},{}),Kg=t=>{if(!t)return 1;if(Object.keys(t).filter(t=>"&"===t).length>0)return;const e=Object.keys(t).filter(t=>sn(t)).map(t=>parseInt(t)).sort();return e.length>0?e[e.length-1]:1},Qg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;["7b1f"].includes(e.slice(0,4));const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});["7b1f"].includes(e.slice(0,4));const s="bypass"in o,{type:a,args:u}=n.leaf.logic,c={codebase:"leafloopyspell.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data},l=Kg(o),h=(t=>{const e="stream"in t;if(!t)return e?1e3:10;if("interval"in t){const e=Kg(t.interval);return sn(e)?parseInt(e):void 0}return e?1e3:10})(o),d="forever"in o;if(o&&"_default"in o){l>0?Gg(0,h).pipe(zg(l)):Gg(0,h);["7b1f"].includes(e.slice(0,4));return(t,n)=>{["7b1f"].includes(e?.slice(0,4));const r={_stream:n._stream.pipe(V(t=>_.throttle(()=>{},200)?t:void 0),$t(t=>void 0!==t),hn(t=>yt([...Array(l).keys()]).pipe(V(e=>({...t,_label:{...t._label,loopyidx:e}})))))};if(!o||!("_default"in o)){return p_(r,t,void 0,{...c,metastep:"relaying input data as is due to error condition"})}let i=0,a=[];let u,h=new qt(Xg),p=new Yo(1);const f=r._stream.pipe(It(t=>(u=t,h.next(t),h)),jt(p));return p_({_stream:f},t,void 0,{...c,metastep:"executing a loopy spell with idx "+i},{leaflogic:o._default,datalogic:{pre:t=>{const e=t;return s||a.push(t),e},post:t=>{if(i+=1,(d||i<l)&&h.next(u),!s)return a[0];if("stream"in o)return t;if(a.push(t),i===l){const t=[...a];return a=[],i=0,t}}}})}}return o&&"await"in o?(t,e)=>{const n={_stream:e._stream.pipe(V(t=>_.throttle(()=>{},10)?t:void 0),$t(t=>void 0!==t),V(t=>[...Array(l).keys()].map(e=>({...t,_label:{...t._label,loopyidx:e}}))))};if(!o.await||!("_default"in o.await)){return p_(n,t,void 0,{...c,metastep:"relaying input data as is due to error condition"})}let r=0,i=[];const a=t=>{const e=t;return s||i.push(t),e};let u=new Pt,h=new Pt,d=new Pt;const p=new Pt,f=new Pt;let m,g;const y=new Pt,v=new Pt,b=o.await._default([{_stream:y}],{_stream:v}),w=n._stream.pipe(Nt(...t.map(t=>t._stream)),It(t=>{const e=t[0],n=t[1];if(m=e,void 0!==g&&!g.closed)return h.next(n),u.next(e),f;r=0,i=[],d.next();const _=p_({_stream:u},[{_stream:h}],void 0,{...c,metastep:"executing a loopy spell with idx "+r},{datalogic:{pre:a,post:t=>{if(r+=1,!s)return i[0];if("stream"in o)return t;if(i.push(t),r===l){const t=[...i];return i=[],r=0,1===l?t[0]:t}}}});let w;return g=_._control._stream.pipe(Nt(_._stream),It(t=>(w=t,y.next(t[1]),v.next(t[0]),b._control._stream)),Nt(b._control._stream),Nt(b._stream),V(t=>t[1]),V(t=>(t&&(p.next(w[1]),m=w[0],d.next()),t)),jt(d)).subscribe({next:t=>{},error:t=>{},complete:()=>{}}),h.next(n),u.next(e),f}),V(t=>t),ls(()=>{void 0!==g&&(g.unsubscribe(),g=void 0)}),$t(t=>void 0!==t),Lt());return{_stream:o.final&&"_default"in o.final?p.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Xg)),It(t=>a_(o.final._default,t)),V(t=>(setTimeout(()=>{f.next(m)},0),t)),Lt()):p.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Xg)),V(t=>(setTimeout(()=>{f.next(m)},0),t)),Lt()),_control:{_stream:w.pipe(V(t=>t),Lt())}}}:(t,e)=>({...Bg(t),_control:e})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>{const r=Bg(t);return{...e([r],n),_control:n}}}),s}},Zg=Wt("leafgraph"),Yg=(t,e)=>{if(!t)return null;if(t.startsWith("/")){const n=t.slice(1);return n?{graph_domain:e,graph_appid:n}:null}const n=t.indexOf("/");return-1===n?{graph_domain:t,graph_appid:"index"}:0===n||n===t.length-1?null:{graph_domain:t.slice(0,n),graph_appid:t.slice(n+1)}},t_=async(t,e,n,r,i,o,s,a,u,c,l=!1)=>{const h=await(Gn(u)?.parseGraphEtaTree(i,o)),d=h.leafgraph,p=h.graphcomponents,f=h.graphcomponents.components.nodegroups.runtime[0];h.graphcomponents.components.nodegroups.lambda;return(async()=>{const t={};if(0===d.graph.lambda.nodes().filter(t=>{const e=d.graph.lambda.getNodeAttributes(t),{type:i,args:o}=e.leafnode.data.leaf.logic;if("leafgraph"===i){return En(Zg.editorconfig.namedatakey,o).toLowerCase()===n+"/"+r}return!1}).length){const n=[];if(f&&(["2ee89b44-16af-472f-97d4-47ae65f064c8"].includes(e),t._default=await Ig({refnode:"leafgraph",component_members:f,contextuallambda:c,etaTree:h})),l&&void 0!==p.leafconfig){const e=h.etaReduceLEAFNode({nodeuuid:p.leafconfig,contextuallambda:c}),n=await e;t._leafconfig=n.leafconfig}Object.entries(p.spelldefs).map(([e,r])=>{const i=h.etaReduceLEAFNode({nodeuuid:r,contextuallambda:c});i.then(n=>{t[e]=n}),n.push(i)}),await Promise.all(n)}return t})()},e_={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),zo({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafgraph"}}}},contextuallambda:i});const{type:o,args:s}=n.leaf.logic,a=En(Zg.editorconfig.namedatakey,s),u=a.toLowerCase(),c=(t=>{const e=t.indexOf("/");return e<=0||e===t.length-1?null:{graph_domain:t.slice(0,e),graph_appid:t.slice(e+1)}})(u.startsWith("github/")?a:u);if(!c)return{};const{graph_domain:l,graph_appid:h}=c,d=t.gos.etaTree.domain,p=t.gos.etaTree.appid;if(l+"/"+h!=d+"/"+p){const n=t_(0,e,d,p,l,h,t.gos.leafio,t.gos.etaTree.mnemosyne,t.gos.etaTree,i),r=await n;return(t,e)=>{if(r){return{...r._default(t,e),_control:e}}}}return t=>({...Bg(t),_control:controlflow$obj})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const{type:o,args:s}=n.leaf.logic,a=En(Zg.editorconfig.namedatakey,s),u=a.toLowerCase(),c=u.startsWith("github/")?a:u,l=t.gos.etaTree.domain,h=Yg(c,l);if(!h)return{};const d=t.gos.etaTree.appid,{graph_domain:p,graph_appid:f}=h;if("breezyforest"!==p&&p+"/"+f==l+"/"+d)return{};try{["3be30006-5b56-4b27-8eaa-249c6a46a557"].includes(e);const n=t_(0,e,l,d,p,f,t.gos.leafio,t.gos.etaTree.mnemosyne,t.gos.etaTree,i);return await n}catch(t){return}},_lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const{type:o,args:s}=n.leaf.logic,a=En(Zg.editorconfig.namedatakey,s),u=a.toLowerCase(),c=u.startsWith("github/")?a:u,l=t.gos.etaTree.domain,h=Yg(c,l);if(!h)return{};const d=t.gos.etaTree.appid,{graph_domain:p,graph_appid:f}=h;if("breezyforest"!==p&&p+"/"+f==l+"/"+d)return{};try{["3be30006-5b56-4b27-8eaa-249c6a46a557"].includes(e);const n=t_(0,e,l,d,p,f,t.gos.leafio,t.gos.etaTree.mnemosyne,t.gos.etaTree,i,!0);return await n}catch(t){return}},methods:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>({})},n_={dataflow:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>{},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>{}};zt.breezyforest._version;const r_=(t,e)=>{const n=new He,r=new He,i=new He;new He;let o;t.forEach(t=>{const s=JSON.parse(an.hp.from(t.data,"base64").toString("utf-8"));"leafdeckspade"===s.leaf.logic.type&&(o=t.uuid),n.addNode(t.uuid,{leafnode:{...t,data:s},lambdactrl:{gos:{standardSpellBook:{},curatedSpellBook:{},masterSubsDirectory:e},user:{spellbook:{},config:s}}}),r.addNode(t.uuid,{leafnode:{...t,data:s},lambdactrl:{gos:e,user:s}}),i.addNode(t.uuid,{leafnode:{...t,data:s},lambdactrl:{gos:e,user:s}})});const s=new Set,a=new Set,u=new Set,c=new Set,l={},h=new Set;return t.forEach(t=>{t.out_edges.forEach((t,e)=>{const o=JSON.parse(an.hp.from(t.data,"base64").toString("utf-8")).leaf;if("leafdataedge"===o.logic.type)if(n.edge(t.source.uuid,t.target.uuid)){}else n.addEdgeWithKey(t.uuid,t.source.uuid,t.target.uuid,o),i.addEdgeWithKey(t.uuid,t.source.uuid,t.target.uuid,o),s.add(t.source.uuid),a.add(t.target.uuid);else if("leaflambdaedge"===o.logic.type){if("9935"===t.source.uuid.slice(0,4)){JSON.parse(an.hp.from(t.data,"base64").toString("utf-8"));return}r.addEdgeWithKey(t.uuid,t.source.uuid,t.target.uuid,o),i.addEdgeWithKey(t.uuid,t.source.uuid,t.target.uuid,o),u.add(t.source.uuid),c.add(t.target.uuid),l[t.target.uuid]=t.target.uuid in l?[t.source.uuid].concat(l[t.target.uuid]):[t.source.uuid]}else"leafanchoredge"===o.logic.type&&h.add(t.target.uuid)})}),{graph:{lambda:r,dataflow:n},thespade:{uuid:o},edges:{data:{sources:s,targets:a},lambda:{sources:u,targets:c,sourcelut:l},anchor:{targets:h}}}},i_=t=>{const e=[],n=[],r=[],i=function(t){if(null===(e=t)||"object"!=typeof e||"function"!=typeof e.addUndirectedEdgeWithKey||"function"!=typeof e.dropNode||"boolean"!=typeof e.multi)throw new Error("connectedComponents: the given graph is not a valid graphology instance.");var e;if(!t.order)return[];const n=new en(t),r=n.push.bind(n),i=[];return n.forEachNodeYetUnseen(function(e){const o=[];let s;for(n.push(e);0!==n.size;)s=n.pop(),o.push(s),t.forEachNeighbor(s,r);i.push(o)}),i}(t.graph.dataflow),o=(e,n,r,i,o)=>{const s={...o};return e.forEach(e=>{s[e]={idx:n,scope:r,category:i,metadata:t.graph.dataflow._nodes.get(e).attributes.leafnode.data.leaf.logic}}),s};let s={};const a={};let u;return i.forEach(i=>{if(((t,e)=>t.some(t=>{const n=e.edges.anchor.targets.has(t);return n||"leafanchor"===e.graph.lambda.getNodeAttributes(t).leafnode.data.leaf.logic.type}))(i,t))r.push(i);else{const r=((t,e)=>t.some(t=>(t.slice(0,4),e.edges.lambda.sources.has(t))))(i,t),c=((t,e)=>t.filter(t=>"leafspelldef"===e.graph.lambda.getNodeAttributes(t).leafnode.data.leaf.logic.type).length>0)(i,t),l=((t,e)=>t.filter(t=>"leafconfig"===e.graph.lambda.getNodeAttributes(t).leafnode.data.leaf.logic.type).length>0)(i,t);if(r||c||l){const e=n.push(i)-1;let r;(t=>t.length>1)(i)?r="dataflow":((t,e)=>1===t.length&&t.every(t=>{const n=e.graph.lambda.getNodeAttributes(t).leafnode;return!["leafinflowport","leafoutflowport"].includes(n.data.leaf.logic.type)}))(i,t)&&(r="lambda");if(s=o(i,e,r,"lambda",s),c){const e=t.graph.dataflow.getNodeAttributes(i[0]).leafnode.data;a[e.leaf.logic.args.spellname]=i[0]}else l&&(u=i[0])}else if(((t,e)=>t.every(t=>!e.edges.lambda.sources.has(t))&&t.every(t=>e.edges.data.sources.has(t)||e.edges.data.targets.has(t)))(i,t)){const t=e.push(i);s=o(i,t-1,"dataflow","main",s)}}}),{spelldefs:a,leafconfig:u,components:{nodegroups:{runtime:e,lambda:n,anchored:r},lut:s}}},o_=wn("error",{type:"critical",message:"LEAF core error: race condition detected in leaf.js",codebase:"/src/ghostos/api/parser/leaf.js"},{}),s_=wn("accio","ctrl_accio",{provenance:"executeLEAFLogic"}),a_=async(t,e,n={},r=void 0,i=void 0)=>{const o=new Pt,s=new Pt,a=t([{_stream:o}],{_stream:s,_config:n});if(a){const t=cn(a._control._stream.pipe(Nt(a._stream),V(t=>t[1])));o.next(e),i?s.next(i):s.next(s_);return await t}},u_=wn("accio","ctrl_accio",{provenance:"subscribeToLEAFLogic"}),c_=async(t,e,n,r)=>{const i=new qt({...o_,_label:{at:"leaf.js subscribeToLEAFLogic data stream"}}),o=new qt({...o_,_label:{at:"leaf.js subscribeToLEAFLogic ctrl stream"}});i.next(e),o.next(u_);const s=t([{_stream:i}],{_stream:o,_config:n});let a;s&&s._control._stream.pipe(It(t=>(a=t,s._stream)),V(t=>[a,t]),jt(r)).subscribe({next:t=>{},error:t=>{},complete:()=>{}})},l_=(t,e,n,r,i,o=void 0)=>{const s={_stream:r,_config:i};if(n){if(!n.runtime){const r=async()=>{t([{_stream:e}],s)._stream.pipe(V(t=>{const e=o?(()=>{const e=new Object;return e[o]=t,e})():t;return n&&n.subject$.next(e),e})).subscribe({next:t=>{},complete:()=>{}})};n.runtime=r()}return{_stream:n.subject$}}return t([{_stream:e}],s)};globalThis.TRACEON=!0,globalThis.TRACESIZE=30;const h_=(t,e,n,r,i)=>{let o;return Promise.race([t,new Promise((t,s)=>o=setTimeout(()=>{const e=wn("error",{type:"timeout",message:r,codebase:n,metadata:i});t(e)},e,r))]).finally(()=>clearTimeout(o))},d_=(t,e,n=!1)=>globalThis.TRACEON?Array.isArray(t)?[...t,{timestamp:Date.now(),trace:e}]:void 0===t?[{timestamp:Date.now(),trace:e}]:void 0:t||[],p_=(t,e,n,r={},i={leaflogic:void 0,datalogic:{pre:void 0,post:void 0}})=>{const o=new Pt,s=new Pt,a=new Pt;new Pt;let u,c;["e9e6e44b-792b-46d0-b1d3-58ce2f46c45b","c822ae2e-1be8-46be-b2cb-21a43cef0555","98d167d3-c1ed-4d4a-9ab9-25eaccd20a91"].includes(r.refnode);const l=i.leaflogic,h=void 0!==l?l([{_stream:a}],{_stream:void 0!==n?Bt(s,n):s,_config:{...t._config}}):{_stream:a,_control:{_stream:s,_config:{...t._config,traces:d_(t._config?.traces,r)}}},d=e.length>1?Bt(...e.map(t=>t._stream)):e[0]._stream,p=t._stream.pipe(Nt(d),It(t=>{["806e0a4b-badf-42a0-85af-5ad306385c58"].includes(r.refnode),e.length;const n=t[0],o=void 0!==i.datalogic?.pre?i.datalogic.pre(t[1]):t[1];u=1===n?.length?n[0]:n;const l={...u,traces:d_(u?.traces,{...r,at:"leaf.js driveDataflowByCtrlflow, initial switch-mapping of the ctrl signal to drive dataflow through a resolved leaflogic"},!0)};return c=o,setTimeout(()=>{a.next(o),s.next(l)},1),h._control._stream}),Nt(h._control._stream),Nt(h._stream),V(t=>[t[0][1],t[1]]),V(t=>{r.refnode,["38567c62-7513-4ec3-9011-2fcf6c51ec7b"].includes(r.refnode);const e=void 0!==i.datalogic?.post?i.datalogic.post(t[1]):t[1],n=Array.isArray(e)?e.filter(t=>void 0!==t):void 0!==e?e:void 0;return void 0!==n&&o.next(n),t[0]}),V(t=>t),Lt());return{_stream:o.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(o_)),Lt()),_control:{_stream:p.pipe(V(t=>(["e9e6e44b-792b-46d0-b1d3-58ce2f46c45b","c822ae2e-1be8-46be-b2cb-21a43cef0555"].includes(r.refnode),t)),Lt()),_config:{...t._config,traces:d_(t._config?.traces,r)}}}},f_=async(t,e,n)=>{const r={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:e.leafio,etaTree:e},user:{spellbook:{},lambdalut:{}}},{domain:i,appid:o}=r.gos.etaTree,s={graphuuid:"",domain:i,appid:o,graphaddrstr:t};try{const t=e_.lambda(r)({refnode:n,refnodedata:{leaf:{logic:{args:s}}},nodelambda:[],contextuallambda:[]});return await t}catch(t){return{}}};const m_=t=>{const e=t.split("://");return(e[0].includes("https")?"wss":"ws")+"://"+e[1]},g_=t=>!t||t&&"Object"!==t.constructor.name?t:JSON.parse(JSON.stringify(t)),__=t=>{const{endpoint:e,websocket:n,headers:r,hook:i}=t,o={endpoint:e,headers:g_(r||{}),websocket:{...n,endpoint:n&&n.endpoint||m_(e),parameters:n&&n.parameters||{},client:null,open:!1,subscriptions:{}}},s=async()=>{try{const t=new WebSocket(o.websocket.endpoint,"graphql-ws");return t.onerror=t=>{},t.onclose=t=>{},t}catch(t){throw new Error("Failed to establish the WebSocket connection: ",t)}},a=t=>{o.websocket.client.send(JSON.stringify(t))},u=t=>{o.websocket.client=t,o.websocket.shouldRetry&&(t.onclose=()=>{s().then(u)}),t.addEventListener("open",()=>{const t={...o.websocket.parameters,headers:{...o.headers,...o.websocket.parameters.headers}};a({type:"connection_init",payload:t})}),t.addEventListener("message",t=>{((t,e)=>{let n,{data:r}=e;try{r=JSON.parse(r)}catch(t){return}switch(r.type){case"connection_ack":return t.onConnectionSuccess&&t.onConnectionSuccess(),void(t.open=!0);case"connection_error":return void(t.onConnectionError&&t.onConnectionError(r));case"ka":return void(t.onConnectionKeepAlive&&t.onConnectionKeepAlive());case"data":return n=t.subscriptions[r.id],void(n&&n.onGraphQLData&&n.onGraphQLData(r.payload));case"error":return n=t.subscriptions[r.id],void(n&&n.onGraphQLError&&n.onGraphQLError(r.payload));case"connection_terminate":return;case"complete":n=t.subscriptions[r.id],n&&n.onGraphQLComplete&&n.onGraphQLComplete(r.payload),delete t.subscriptions[r.id]}})(o.websocket,t)})},c=()=>{s().then(t=>{u(t)}).catch(t=>{})};n&&c();return{query:async(t,e,n)=>{const{query:r,variables:s,headers:a}=t,u={...o.headers,...a||{}};Object.keys(u).some(t=>/content-type/gi.test(t));try{let t;t=await fetch(o.endpoint,{method:"POST",headers:u,credentials:"include",body:r});const s=await t.json();if(i&&i(s),s.errors)throw n&&n(s),s;return e&&e(s),s}catch(t){throw t}},subscribe:(t,e,n)=>{if(!o.websocket.client)return;const{operationId:r,subscription:i,variables:s,onGraphQLData:u,onGraphQLError:c,onGraphQLComplete:l}=t;return o.websocket.subscriptions[r]={onGraphQLData:t=>{u&&u(t),e&&e(t)},onGraphQLComplete:t=>{l&&l(t)},onGraphQLError:t=>{c&&c(t),n&&n(t)}},a({type:"start",id:r,payload:{query:i,variables:s||{}}}),{stop:()=>{a({type:"stop",id:r})}}},updateHeaders:t=>{o.headers=g_(t),o.websocket.client&&s().then(u).catch(t=>{})},establishWS:c,clientContext:o}};const{memoize:y_}=bn,v_=({_domain:t,_appid:e,filter:n={},query:r}={})=>`\n subscription {\n graph: getGraph(domain: "${t}", appid: "${e}", filter: ${n}) ${r}\n }\n`,b_=({_appmode:t,_hostdomain:e,_hostappid:n,_domain:r,_appid:i,filter:o={},query:s}={})=>`\n query {\n graph: getGraph(domain: "${r}", appid: "${i}", filter: ${o}) ${s}\n }\n`,w_={dburi_subs:"https://gdb.leafgon.com/sgraphql",dburi_subs_ws:"wss://gdb.leafgon.com/sgraphql",dburi_qm:"https://gdb.leafgon.com/qmgraphql"},x_=({_clientConfig:t=w_,_metamodel:e=zt.breezyforest,_sessionid:n}={})=>{const r=t.dburi_subs?t.dburi_subs:void 0,i=t.dburi_subs_ws?t.dburi_subs_ws:void 0,o=t.dburi_qm?t.dburi_qm:void 0,s=t.clientAuthKey?t.clientAuthKey:void 0,a=e.GQLParameters.masterquery;let u={subscriptions:{},subs_methods:{},qm_methods:{}};const c=({gql_subs_client:t,force:e=!1}={})=>{(e||[WebSocket.CLOSED,WebSocket.CLOSING].includes(t.clientContext.websocket.client.readyState))&&t.establishWS()};u.gql_qm_client=o&&__({endpoint:o,headers:s?{Accept:"application/json","X-API-Key":s}:{Accept:"application/json"}});const l=new Promise((t,e)=>{u.gql_subs_client=r&&i?__({endpoint:r,headers:s?{"Content-Type":"application/json","X-API-Key":s}:{"Content-Type":"application/json"},websocket:{endpoint:i,onConnectionSuccess:()=>{t("gql_subs_client is connected and ready")},onConnectionError:()=>{e("gql_subs_client: Connection Error")}}}):void 0}),h=async({_appmode:e,_domain:n,_appid:r,filter:i="{}",subsCallback:o,errorCallback:s,variables:h}={})=>{l.then(e=>{const l=(()=>{let t="";const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let n=0;n<5;n++)t+=e.charAt(Math.floor(62*Math.random()));return t+(Object.keys(u.subscriptions).length+1)})();try{const e=u.gql_subs_client.subscribe({operationId:l,subscription:v_({_domain:n,_appid:r,filter:i,query:a}),onGraphQLData:t=>{o&&o(t.data)},onGraphQLError:t=>{l in u.subscriptions&&u.subscriptions[l].stop(),s&&s(t)},onGraphQLComplete:e=>{t.keepGQLConnected&&c({gql_subs_client:u.gql_subs_client,force:!0})}});u.subscriptions[l]=e}catch(t){l in u.subscriptions&&u.subscriptions[l].stop()}})},d=y_(({_appmode:t,_hostdomain:e,_hostappid:n,_domain:r,_appid:i,filter:s="{}",variables:c}={})=>new Promise((l,h)=>{const d={endpoint:o,query:JSON.stringify({query:b_({_appmode:t,_hostdomain:e,_hostappid:n,_domain:r,_appid:i,filter:s,query:a}),variables:c||{}})};try{u.gql_qm_client.query(d,t=>{t.data&&l({graph:t.data.graph})})}catch(t){h({})}}),({_appmode:t,_hostdomain:e,_hostappid:r,_domain:i,_appid:o,filter:s="{}",variables:a}={})=>JSON.stringify([i,o,s,n])),p=({variables:t})=>{const e={endpoint:o,query:JSON.stringify({query:"mutation AddNode($uuid: String!, $data: String!, $graphdomain: String!, $graphappid: String!, $provdomain: String!, $provappid: String!) {\n addNode(input: [{uuid: $uuid, graph: {domain: $graphdomain, appid: $graphappid}, provenance: {domain: $provdomain, appid: $provappid}, data: $data}]) {node {uuid}}\n}",variables:t||{}})};try{u.gql_qm_client.query(e,t=>{t.data})}catch(t){}},f=({node_uuid:t})=>{const e={endpoint:o,query:JSON.stringify({query:"mutation DeleteNode($uuid: String!) {\n deleteNode(nfilter: {uuid: {eq: $uuid}}) {node {uuid}}\n}",variables:{uuid:t}||{}}).replace(/\\n/g,"")};try{u.gql_qm_client.query(e,t=>{t.data})}catch(t){}},m=({variables:t})=>{const e={endpoint:o,query:JSON.stringify({query:"mutation UpdateNode($uuid: String!, $data: String!) {\n updateNode(input: {filter: {uuid: {eq: $uuid}}, set: {data: $data}}) {node {uuid}}\n}",variables:t||{}})};try{u.gql_qm_client.query(e,t=>{t.data})}catch(t){}},g=({variables:t})=>{const e={endpoint:o,query:JSON.stringify({query:"mutation AddEdge($uuid: String!, $sourceuuid: String!, $targetuuid: String!, $data: String!, $graphdomain: String!, $graphappid: String!, $provdomain: String!, $provappid: String!) {\n addEdge(input: [{uuid: $uuid, source: {uuid: $sourceuuid}, target: {uuid: $targetuuid}, graph: {domain: $graphdomain, appid: $graphappid}, provenance: {domain: $provdomain, appid: $provappid}, data: $data}]) {edge {uuid}}\n}",variables:t||{}})};try{u.gql_qm_client.query(e,t=>{t.data})}catch(t){}},_=({edge_uuid:t})=>{const e={endpoint:o,query:JSON.stringify({query:"mutation DeleteEdge($uuid: String!) {\n deleteEdge(efilter: {uuid: {eq: $uuid}}) {edge {uuid}}\n}",variables:{uuid:t}||{}}).replace(/\\n/g,"")};try{u.gql_qm_client.query(e,t=>{t.data})}catch(t){}};return u.gql_subs_client&&(u.subs_methods={queryGraph:h,clientState:()=>u.gql_subs_client.clientContext.websocket.client.readyState,reconnect:()=>{c({gql_subs_client:u.gql_subs_client})}}),u.gql_qm_client&&(u.qm_methods={queryGraph:d,addNode:p,updateNode:m,delNode:f,addEdge:g,delEdge:_}),u};const T_=({_LEAFappList:t=[],stateObjInstanceID:e=Kn(),dirOfSubjects:n={},permissions:r={},metamodel:i=zt}={})=>{const o={current:JSON.parse(JSON.stringify(i.breezyforest.IOStateGroundZero))};o.current.dirOfSubjects=(()=>{let t={};return Object.entries(i.breezyforest.subsDirectory).forEach(([e,s])=>{e in n?(t[e]=n[e],o.current.permissions[e]=e in r?r[e]:i.breezyforest.IOAccessPermission.Observer):(t[e]={main:k_(),bridges:{}},o.current.permissions[e]=e in r?r[e]:i.breezyforest.IOAccessPermission.All),o.current.subscriptions[e]=t[e].main.doSubscribe(({control:t,data:n})=>{o.current.subsCache[e]={control:t,data:n},((t,e,n)=>{t in o.current.callbacks&&Object.entries(o.current.callbacks[t]).map(([t,r])=>{r({control:e,data:n})})})(e,t,n)})}),t})();return{getCurLEAFIOState:()=>o.current.subsCache,getMasterSubsDir:()=>o.current.dirOfSubjects,setNewLEAFIOState:(t,n,r=zt.breezyforest.originType.FRONTEND)=>{try{if(o.current.permissions[t]&i.breezyforest.IOAccessPermission.Contributor)return o.current.dirOfSubjects[t].main.doWrite({control:{provenance:{stateObjInstanceID:e,dataOrigin:r}},data:n}),!0;return o.current.permissions[t]&i.breezyforest.IOAccessPermission.Contributor}catch(t){return-1}},setLEAFIOCallback:(t,e,n=null)=>{t in o.current.subscriptions&&(null===n&&e in delete o.current.callbacks[t]?(o.current.callbacks={...o.current.callbacks,[t]:{...o.current.callbacks[t]}},delete o.current.callbacks[t][e]):n&&(o.current.callbacks={...o.current.callbacks,[t]:{...o.current.callbacks[t],[e]:n}}))},destructLEAFIOobj:()=>{Object.entries(o.current.subscriptions).forEach(([t,e])=>{o.current.dirOfSubjects[t].main.doUnsubscribe(e)})}}},k_=()=>{const t={handle$:new qt,doWrite:e=>t.handle$.next(e),doSubscribe:e=>t.handle$.pipe(function(t){return $t(function(e,n){return t<=n})}(1)).subscribe(e),doUnsubscribe:t=>t.unsubscribe(),doAddAddressee:(t,e)=>{}};return t},S_=(t,e=[],n=zt)=>{let r={};return Object.entries(n.breezyforest.subsDirectory).forEach(([t,e])=>{r[t]={main:k_(),bridges:{}}}),[t,r]},A_="https://gdb.leafgon.com/qmgraphql",E_=async({variables:t,endpoint:e=A_})=>{const n=__({endpoint:e,headers:{Accept:"application/json"}}),r={endpoint:e,query:JSON.stringify({query:"mutation AddNode($uuid: String!, $leafnodetype: String, $data: String!, $graphdomain: String!, $graphappid: String!, $provdomain: String!, $provappid: String!) {\n addNode(input: [{uuid: $uuid, leafnodetype: $leafnodetype, graph: {domain: $graphdomain, appid: $graphappid}, provenance: {domain: $provdomain, appid: $provappid}, data: $data}]) {node {uuid}}\n}",variables:t||{}})};let i;try{i=await n.query(r),i.data}catch(t){}},O_=async({node_uuid:t,endpoint:e=A_})=>{const n=__({endpoint:e,headers:{Accept:"application/json"}}),r={endpoint:e,query:JSON.stringify({query:"mutation DeleteNode($uuid: String!) {\n deleteNode(nfilter: {uuid: {eq: $uuid}}) {node {uuid}}\n}",variables:{uuid:t}||{}}).replace(/\\n/g,"")};let i;try{i=await n.query(r),i.data}catch(t){}},C_=async({variables:t,endpoint:e=A_})=>{const n=__({endpoint:e,headers:{Accept:"application/json"}}),r={endpoint:e,query:JSON.stringify({query:"mutation UpdateNode($uuid: String!, $data: String!) {\n updateNode(input: {filter: {uuid: {eq: $uuid}}, set: {data: $data}}) {node {uuid}}\n}",variables:t||{}})};let i;try{i=await n.query(r),i.data}catch(t){}},M_=async({variables:t,endpoint:e=A_})=>{const n=__({endpoint:e,headers:{Accept:"application/json"}}),r={endpoint:e,query:JSON.stringify({query:"mutation AddEdge($uuid: String!, $sourceuuid: String!, $targetuuid: String!, $data: String!, $graphdomain: String!, $graphappid: String!, $provdomain: String!, $provappid: String!) {\n addEdge(input: [{uuid: $uuid, source: {uuid: $sourceuuid}, target: {uuid: $targetuuid}, graph: {domain: $graphdomain, appid: $graphappid}, provenance: {domain: $provdomain, appid: $provappid}, data: $data}]) {edge {uuid}}\n}",variables:t||{}})};let i;try{i=await n.query(r),i.data}catch(t){}},N_=async({edge_uuid:t,endpoint:e=A_})=>{const n=__({endpoint:e,headers:{Accept:"application/json"}}),r={endpoint:e,query:JSON.stringify({query:"mutation DeleteEdge($uuid: String!) {\n deleteEdge(efilter: {uuid: {eq: $uuid}}) {edge {uuid}}\n}",variables:{uuid:t}||{}}).replace(/\\n/g,"")};let i;try{i=await n.query(r),i.data}catch(t){}};export{zt as LEAFIOmetamodel,qn as SHA1,Ht as _breezyforeststdlib_hierarchy,Jt as _breezyforeststdlib_name,Xt as _edge_handle_dict,Kt as _edge_style_dict,kg as _leafelement,e_ as _leafgraph,Wt as _leafstdlib_dataflow_api,i_ as analyzeLEAFGraph,__ as createGQLClient,So as decodeUnicode,Np as destroySoundStageNode,wn as doBottle,xn as doUnbottle,p_ as driveDataflowByCtrlflow,ko as encodeUnicode,Ig as etaReduceDataflowComponent,Gn as etaTreeForest,a_ as executeLEAFLogic,l_ as executeLEAFLogicInSync,En as fetchMultiKeyedData,T_ as initLEAFIOapi,No as init_gRuntimeLEAFlisp,x_ as initializeLEAFlakeGQLClient,S_ as initializeMasterSubsDirectory,Mp as initializeSoundStage,k_ as initializeSubsMain,M_ as mutateAddEdge,E_ as mutateAddNode,N_ as mutateDelEdge,O_ as mutateDelNode,C_ as mutateUpdateNode,f_ as parseAddressableGraph,Oo as parseJsonToLEAFlisp,r_ as reconstructLEAFGraph,Po as runLEAFlispcode,Rg as runtimeEtaTree,On as setMultiKeyedData,c_ as subscribeToLEAFLogic};
2
+ import"react";var t={1795(t,e,n){!function(t,e,n,r){var i=function(t,e,n){return{endTime:e,insertTime:n,type:"exponentialRampToValue",value:t}},o=function(t,e,n){return{endTime:e,insertTime:n,type:"linearRampToValue",value:t}},s=function(t,e){return{startTime:e,type:"setValue",value:t}},a=function(t,e,n){return{duration:n,startTime:e,type:"setValueCurve",values:t}},u=function(t,e,n){var r=n.startTime,i=n.target,o=n.timeConstant;return i+(e-i)*Math.exp((r-t)/o)},c=function(t){return"exponentialRampToValue"===t.type},l=function(t){return"linearRampToValue"===t.type},h=function(t){return c(t)||l(t)},d=function(t){return"setValue"===t.type},p=function(t){return"setValueCurve"===t.type},f=function(t,e,n,r){var i=t[e];return void 0===i?r:h(i)||d(i)?i.value:p(i)?i.values[i.values.length-1]:u(n,f(t,e-1,i.startTime,r),i)},m=function(t,e,n,r,i){return void 0===n?[r.insertTime,i]:h(n)?[n.endTime,n.value]:d(n)?[n.startTime,n.value]:p(n)?[n.startTime+n.duration,n.values[n.values.length-1]]:[n.startTime,f(t,e-1,n.startTime,i)]},g=function(t){return"cancelAndHold"===t.type},_=function(t){return"cancelScheduledValues"===t.type},y=function(t){return g(t)||_(t)?t.cancelTime:c(t)||l(t)?t.endTime:t.startTime},v=function(t,e,n,r){var i=r.endTime,o=r.value;return n===o?o:0<n&&0<o||n<0&&o<0?n*Math.pow(o/n,(t-e)/(i-e)):0},b=function(t,e,n,r){return n+(t-e)/(r.endTime-e)*(r.value-n)},w=function(t,e){var n=Math.floor(e),r=Math.ceil(e);return n===r?t[n]:(1-(e-n))*t[n]+(1-(r-e))*t[r]},x=function(t,e){var n=e.duration,r=e.startTime,i=e.values,o=(t-r)/n*(i.length-1);return w(i,o)},T=function(t){return"setTarget"===t.type},k=function(){function t(e){n(this,t),this._automationEvents=[],this._currenTime=0,this._defaultValue=e}return r(t,[{key:Symbol.iterator,value:function(){return this._automationEvents[Symbol.iterator]()}},{key:"add",value:function(t){var e=y(t);if(g(t)||_(t)){var n=this._automationEvents.findIndex(function(n){return _(t)&&p(n)?n.startTime+n.duration>=e:y(n)>=e}),r=this._automationEvents[n];if(-1!==n&&(this._automationEvents=this._automationEvents.slice(0,n)),g(t)){var u=this._automationEvents[this._automationEvents.length-1];if(void 0!==r&&h(r)){if(void 0!==u&&T(u))throw new Error("The internal list is malformed.");var d=void 0===u?r.insertTime:p(u)?u.startTime+u.duration:y(u),f=void 0===u?this._defaultValue:p(u)?u.values[u.values.length-1]:u.value,m=c(r)?v(e,d,f,r):b(e,d,f,r),w=c(r)?i(m,e,this._currenTime):o(m,e,this._currenTime);this._automationEvents.push(w)}if(void 0!==u&&T(u)&&this._automationEvents.push(s(this.getValue(e),e)),void 0!==u&&p(u)&&u.startTime+u.duration>e){var x=e-u.startTime,k=(u.values.length-1)/u.duration,S=Math.max(2,1+Math.ceil(x*k)),A=x/(S-1)*k,E=u.values.slice(0,S);if(A<1)for(var O=1;O<S;O+=1){var C=A*O%1;E[O]=u.values[O-1]*(1-C)+u.values[O]*C}this._automationEvents[this._automationEvents.length-1]=a(E,u.startTime,x)}}}else{var M=this._automationEvents.findIndex(function(t){return y(t)>e}),N=-1===M?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[M-1];if(void 0!==N&&p(N)&&y(N)+N.duration>e)return!1;var I=c(t)?i(t.value,t.endTime,this._currenTime):l(t)?o(t.value,e,this._currenTime):t;if(-1===M)this._automationEvents.push(I);else{if(p(t)&&e+t.duration>y(this._automationEvents[M]))return!1;this._automationEvents.splice(M,0,I)}}return!0}},{key:"flush",value:function(t){var e=this._automationEvents.findIndex(function(e){return y(e)>t});if(e>1){var n=this._automationEvents.slice(e-1),r=n[0];T(r)&&n.unshift(s(f(this._automationEvents,e-2,r.startTime,this._defaultValue),r.startTime)),this._automationEvents=n}}},{key:"getValue",value:function(t){if(0===this._automationEvents.length)return this._defaultValue;var n=this._automationEvents.findIndex(function(e){return y(e)>t}),r=this._automationEvents[n],i=(-1===n?this._automationEvents.length:n)-1,o=this._automationEvents[i];if(void 0!==o&&T(o)&&(void 0===r||!h(r)||r.insertTime>t))return u(t,f(this._automationEvents,i-1,o.startTime,this._defaultValue),o);if(void 0!==o&&d(o)&&(void 0===r||!h(r)))return o.value;if(void 0!==o&&p(o)&&(void 0===r||!h(r)||o.startTime+o.duration>t))return t<o.startTime+o.duration?x(t,o):o.values[o.values.length-1];if(void 0!==o&&h(o)&&(void 0===r||!h(r)))return o.value;if(void 0!==r&&c(r)){var s=m(this._automationEvents,i,o,r,this._defaultValue),a=e(s,2),g=a[0],_=a[1];return v(t,g,_,r)}if(void 0!==r&&l(r)){var w=m(this._automationEvents,i,o,r,this._defaultValue),k=e(w,2),S=k[0],A=k[1];return b(t,S,A,r)}return this._defaultValue}}])}(),S=function(t){return{cancelTime:t,type:"cancelAndHold"}},A=function(t){return{cancelTime:t,type:"cancelScheduledValues"}},E=function(t,e){return{endTime:e,type:"exponentialRampToValue",value:t}},O=function(t,e){return{endTime:e,type:"linearRampToValue",value:t}},C=function(t,e,n){return{startTime:e,target:t,timeConstant:n,type:"setTarget"}};t.AutomationEventList=k,t.createCancelAndHoldAutomationEvent=S,t.createCancelScheduledValuesAutomationEvent=A,t.createExponentialRampToValueAutomationEvent=E,t.createLinearRampToValueAutomationEvent=O,t.createSetTargetAutomationEvent=C,t.createSetValueAutomationEvent=s,t.createSetValueCurveAutomationEvent=a}(e,n(5715),n(7383),n(4579))},7526(t,e){e.byteLength=function(t){var e=a(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,o=a(t),s=o[0],u=o[1],c=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,u)),l=0,h=u>0?s-4:s;for(n=0;n<h;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],c[l++]=e>>16&255,c[l++]=e>>8&255,c[l++]=255&e;2===u&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,c[l++]=255&e);1===u&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,c[l++]=e>>8&255,c[l++]=255&e);return c},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,u=r-i;a<u;a+=s)o.push(c(t,a,a+s>u?u:a+s));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=o[s],r[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function u(t){return n[t>>18&63]+n[t>>12&63]+n[t>>6&63]+n[63&t]}function c(t,e,n){for(var r,i=[],o=e;o<n;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(u(r));return i.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},8287(t,e,n){const r=n(7526),i=n(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=u,e.IS=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return c(t,e,n)}function c(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|m(t,e);let r=a(n);const i=r.write(t,e);i!==n&&(r=r.slice(0,i));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(X(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(X(t,ArrayBuffer)||t&&X(t.buffer,ArrayBuffer))return p(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(X(t,SharedArrayBuffer)||t&&X(t.buffer,SharedArrayBuffer)))return p(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return u.from(r,e,n);const i=function(t){if(u.isBuffer(t)){const e=0|f(t.length),n=a(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||K(t.length)?a(0):d(t);if("Buffer"===t.type&&Array.isArray(t.data))return d(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return l(t),a(t<0?0:0|f(t))}function d(t){const e=t.length<0?0:0|f(t.length),n=a(e);for(let r=0;r<e;r+=1)n[r]=255&t[r];return n}function p(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,u.prototype),r}function f(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function m(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||X(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return J(t).length;default:if(i)return r?-1:W(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return M(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return O(this,e,n);case"latin1":case"binary":return C(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function _(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),K(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:v(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,r,i){let o,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;o<a;o++)if(c(t,o)===c(e,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===u)return r*s}else-1!==r&&(o-=o-r),r=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){let n=!0;for(let r=0;r<u;r++)if(c(t,o+r)!==c(e,r)){n=!1;break}if(n)return o}return-1}function b(t,e,n,r){n=Number(n)||0;const i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s<r;++s){const r=parseInt(e.substr(2*s,2),16);if(K(r))return s;t[n+s]=r}return s}function w(t,e,n,r){return H(W(e,t.length-n),t,n,r)}function x(t,e,n,r){return H(function(t){const e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function T(t,e,n,r){return H(J(e),t,n,r)}function k(t,e,n,r){return H(function(t,e){let n,r,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function S(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function A(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i<n;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=E)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=E));return n}(r)}u.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),!u.TYPED_ARRAY_SUPPORT&&"undefined"!=typeof console&&console.error,Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,n){return c(t,e,n)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,n){return function(t,e,n){return l(t),t<=0?a(t):void 0!==e?"string"==typeof n?a(t).fill(e,n):a(t).fill(e):a(t)}(t,e,n)},u.allocUnsafe=function(t){return h(t)},u.allocUnsafeSlow=function(t){return h(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(X(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),X(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;const r=u.allocUnsafe(e);let i=0;for(n=0;n<t.length;++n){let e=t[n];if(X(e,Uint8Array))i+e.length>r.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},u.byteLength=m,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)_(this,e,e+1);return this},u.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)_(this,e,e+3),_(this,e+1,e+2);return this},u.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)_(this,e,e+7),_(this,e+1,e+6),_(this,e+2,e+5),_(this,e+3,e+4);return this},u.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):g.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){let t="";const n=e.IS;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,n,r,i){if(X(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const a=Math.min(o,s),c=this.slice(r,i),l=t.slice(e,n);for(let t=0;t<a;++t)if(c[t]!==l[t]){o=c[t],s=l[t];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},u.prototype.indexOf=function(t,e,n){return y(this,t,e,n,!0)},u.prototype.lastIndexOf=function(t,e,n){return y(this,t,e,n,!1)},u.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return w(this,t,e,n);case"ascii":case"latin1":case"binary":return x(this,t,e,n);case"base64":return T(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const E=4096;function O(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function C(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function M(t,e,n){const r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=e;r<n;++r)i+=Q[t[r]];return i}function N(t,e,n){const r=t.slice(e,n);let i="";for(let t=0;t<r.length-1;t+=2)i+=String.fromCharCode(r[t]+256*r[t+1]);return i}function I(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function j(t,e,n,r,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function R(t,e,n,r,i){U(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function P(t,e,n,r,i){U(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function D(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(t,e,n,r,o){return e=+e,n>>>=0,o||D(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function F(t,e,n,r,o){return e=+e,n>>>=0,o||D(t,0,n,8),i.write(t,e,n,r,52,8),n+8}u.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);const r=this.subarray(t,e);return Object.setPrototypeOf(r,u.prototype),r},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return r},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=Z(function(t){V(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||G(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),u.prototype.readBigUInt64BE=Z(function(t){V(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||G(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),u.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},u.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||I(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(t,e){t>>>=0,e||I(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=Z(function(t){V(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||G(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)}),u.prototype.readBigInt64BE=Z(function(t){V(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||G(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)}),u.prototype.readFloatLE=function(t,e){return t>>>=0,e||I(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||I(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||I(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||I(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){j(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){j(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=Z(function(t,e=0){return R(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Z(function(t,e=0){return P(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);j(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i<n&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o|0)-s&255;return e+n},u.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);j(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o|0)-s&255;return e+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=Z(function(t,e=0){return R(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Z(function(t,e=0){return P(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeFloatLE=function(t,e,n){return L(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return L(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return F(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return F(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,r){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);const i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},u.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){const e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{const o=u.isBuffer(t)?t:u.from(t,r),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=o[i%s]}return this};const $={};function B(t,e,n){$[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function q(t){let e="",n=t.length;const r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function U(t,e,n,r,i,o){if(t>n||t<e){const r="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new $.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){V(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||G(e,t.length-(n+1))}(r,i,o)}function V(t,e){if("number"!=typeof t)throw new $.ERR_INVALID_ARG_TYPE(e,"number",t)}function G(t,e,n){if(Math.floor(t)!==t)throw V(t,n),new $.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new $.ERR_BUFFER_OUT_OF_BOUNDS;throw new $.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}B("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),B("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),B("ERR_OUT_OF_RANGE",function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=q(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=q(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r},RangeError);const z=/[^+/0-9A-Za-z-_]/g;function W(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s<r;++s){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function J(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,n,r){let i;for(i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function X(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function K(t){return t!=t}const Q=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Z(t){return"undefined"==typeof BigInt?Y:t}function Y(){throw new Error("BigInt not supported")}},7007(t){var e,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};e=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise(function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}m(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&m(t,"error",e,n)}(t,i,{once:!0})})},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function c(t,e,n,r){var i,o,s;if(a(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]),void 0===s)s=o[e]=n,++t._eventsCount;else if("function"==typeof s?s=o[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=u(t))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=s.length,console&&console.warn}return t}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=l.bind(r);return i.listener=n,r.wrapFn=i,i}function d(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(i):f(i,i.length)}function p(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function f(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function m(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,function i(o){r.once&&t.removeEventListener(e,i),n(o)})}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");s=t}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var i="error"===t,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)r(u,this,e);else{var c=u.length,l=f(u,c);for(n=0;n<c;++n)r(l[n],this,e)}return!0},o.prototype.addListener=function(t,e){return c(this,t,e,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(t,e){return c(this,t,e,!0)},o.prototype.once=function(t,e){return a(e),this.on(t,h(this,t,e)),this},o.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,h(this,t,e)),this},o.prototype.removeListener=function(t,e){var n,r,i,o,s;if(a(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0===--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,i),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,s||e)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},o.prototype.listeners=function(t){return d(this,t,!0)},o.prototype.rawListeners=function(t){return d(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},8463(t){t.exports=s,s.default=s,s.stable=l,s.stableStringify=l;var e="[...]",n="[Circular]",r=[],i=[];function o(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function s(t,e,n,s){var a;void 0===s&&(s=o()),u(t,"",0,[],void 0,0,s);try{a=0===i.length?JSON.stringify(t,e,n):JSON.stringify(t,d(e),n)}catch(t){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var c=r.pop();4===c.length?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return a}function a(t,e,n,o){var s=Object.getOwnPropertyDescriptor(o,n);void 0!==s.get?s.configurable?(Object.defineProperty(o,n,{value:t}),r.push([o,n,e,s])):i.push([e,n,t]):(o[n]=t,r.push([o,n,e]))}function u(t,r,i,o,s,c,l){var h;if(c+=1,"object"==typeof t&&null!==t){for(h=0;h<o.length;h++)if(o[h]===t)return void a(n,t,r,s);if(void 0!==l.depthLimit&&c>l.depthLimit)return void a(e,t,r,s);if(void 0!==l.edgesLimit&&i+1>l.edgesLimit)return void a(e,t,r,s);if(o.push(t),Array.isArray(t))for(h=0;h<t.length;h++)u(t[h],h,h,o,t,c,l);else{var d=Object.keys(t);for(h=0;h<d.length;h++){var p=d[h];u(t[p],p,h,o,t,c,l)}}o.pop()}}function c(t,e){return t<e?-1:t>e?1:0}function l(t,e,n,s){void 0===s&&(s=o());var a,u=h(t,"",0,[],void 0,0,s)||t;try{a=0===i.length?JSON.stringify(u,e,n):JSON.stringify(u,d(e),n)}catch(t){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var c=r.pop();4===c.length?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return a}function h(t,i,o,s,u,l,d){var p;if(l+=1,"object"==typeof t&&null!==t){for(p=0;p<s.length;p++)if(s[p]===t)return void a(n,t,i,u);try{if("function"==typeof t.toJSON)return}catch(t){return}if(void 0!==d.depthLimit&&l>d.depthLimit)return void a(e,t,i,u);if(void 0!==d.edgesLimit&&o+1>d.edgesLimit)return void a(e,t,i,u);if(s.push(t),Array.isArray(t))for(p=0;p<t.length;p++)h(t[p],p,p,s,t,l,d);else{var f={},m=Object.keys(t).sort(c);for(p=0;p<m.length;p++){var g=m[p];h(t[g],g,p,s,t,l,d),f[g]=t[g]}if(void 0===u)return f;r.push([u,i,t]),u[i]=f}s.pop()}}function d(t){return t=void 0!==t?t:function(t,e){return e},function(e,n){if(i.length>0)for(var r=0;r<i.length;r++){var o=i[r];if(o[1]===e&&o[0]===n){n=o[2],i.splice(r,1);break}}return t.call(this,e,n)}}},639(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var i=r(n(261)),o=r(n(2300)),s=n(9027),a=n(1127),u=r(n(6727)),c=r(n(1350)),l=r(n(1148)),h=i.default.create;function d(){var t=h();return t.compile=function(e,n){return a.compile(e,n,t)},t.precompile=function(e,n){return a.precompile(e,n,t)},t.AST=o.default,t.Compiler=a.Compiler,t.JavaScriptCompiler=u.default,t.Parser=s.parser,t.parse=s.parse,t.parseWithoutProcessing=s.parseWithoutProcessing,t}var p=d();p.create=d,l.default(p),p.Visitor=c.default,p.default=p,e.default=p,t.exports=e.default},261(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}function i(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}e.__esModule=!0;var o=i(n(2871)),s=r(n(9613)),a=r(n(3769)),u=i(n(2849)),c=i(n(7624)),l=r(n(1148));function h(){var t=new o.HandlebarsEnvironment;return u.extend(t,o),t.SafeString=s.default,t.Exception=a.default,t.Utils=u,t.escapeExpression=u.escapeExpression,t.VM=c,t.template=function(e){return c.template(e,t)},t}var d=h();d.create=h,l.default(d),d.default=d,e.default=d,t.exports=e.default},2871(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.HandlebarsEnvironment=h;var i=n(2849),o=r(n(3769)),s=n(2277),a=n(5940),u=r(n(566)),c=n(3865);e.VERSION="4.7.8";e.COMPILER_REVISION=8;e.LAST_COMPATIBLE_COMPILER_REVISION=7;e.REVISION_CHANGES={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};var l="[object Object]";function h(t,e,n){this.helpers=t||{},this.partials=e||{},this.decorators=n||{},s.registerDefaultHelpers(this),a.registerDefaultDecorators(this)}h.prototype={constructor:h,logger:u.default,log:u.default.log,registerHelper:function(t,e){if(i.toString.call(t)===l){if(e)throw new o.default("Arg not supported with multiple helpers");i.extend(this.helpers,t)}else this.helpers[t]=e},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,e){if(i.toString.call(t)===l)i.extend(this.partials,t);else{if(void 0===e)throw new o.default('Attempting to register a partial called "'+t+'" as undefined');this.partials[t]=e}},unregisterPartial:function(t){delete this.partials[t]},registerDecorator:function(t,e){if(i.toString.call(t)===l){if(e)throw new o.default("Arg not supported with multiple decorators");i.extend(this.decorators,t)}else this.decorators[t]=e},unregisterDecorator:function(t){delete this.decorators[t]},resetLoggedPropertyAccesses:function(){c.resetLoggedProperties()}};var d=u.default.log;e.log=d,e.createFrame=i.createFrame,e.logger=u.default},2300(t,e){e.__esModule=!0;var n={helpers:{helperExpression:function(t){return"SubExpression"===t.type||("MustacheStatement"===t.type||"BlockStatement"===t.type)&&!!(t.params&&t.params.length||t.hash)},scopedId:function(t){return/^\.|this\b/.test(t.original)},simpleId:function(t){return 1===t.parts.length&&!n.helpers.scopedId(t)&&!t.depth}}};e.default=n,t.exports=e.default},9027(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.parseWithoutProcessing=c,e.parse=function(t,e){var n=c(t,e);return new o.default(e).accept(n)};var i=r(n(6201)),o=r(n(915)),s=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(8425)),a=n(2849);e.parser=i.default;var u={};function c(t,e){return"Program"===t.type?t:(i.default.yy=u,u.locInfo=function(t){return new u.SourceLocation(e&&e.srcName,t)},i.default.parse(t))}a.extend(u,s)},9632(t,e,n){e.__esModule=!0;var r=n(2849),i=void 0;try{}catch(t){}function o(t,e,n){if(r.isArray(t)){for(var i=[],o=0,s=t.length;o<s;o++)i.push(e.wrap(t[o],n));return i}return"boolean"==typeof t||"number"==typeof t?t+"":t}function s(t){this.srcFile=t,this.source=[]}i||((i=function(t,e,n,r){this.src="",r&&this.add(r)}).prototype={add:function(t){r.isArray(t)&&(t=t.join("")),this.src+=t},prepend:function(t){r.isArray(t)&&(t=t.join("")),this.src=t+this.src},toStringWithSourceMap:function(){return{code:this.toString()}},toString:function(){return this.src}}),s.prototype={isEmpty:function(){return!this.source.length},prepend:function(t,e){this.source.unshift(this.wrap(t,e))},push:function(t,e){this.source.push(this.wrap(t,e))},merge:function(){var t=this.empty();return this.each(function(e){t.add([" ",e,"\n"])}),t},each:function(t){for(var e=0,n=this.source.length;e<n;e++)t(this.source[e])},empty:function(){var t=this.currentLocation||{start:{}};return new i(t.start.line,t.start.column,this.srcFile)},wrap:function(t){var e=arguments.length<=1||void 0===arguments[1]?this.currentLocation||{start:{}}:arguments[1];return t instanceof i?t:(t=o(t,this,e),new i(e.start.line,e.start.column,this.srcFile,t))},functionCall:function(t,e,n){return n=this.generateList(n),this.wrap([t,e?"."+e+"(":"(",n,")"])},quotedString:function(t){return'"'+(t+"").replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(t){var e=this,n=[];Object.keys(t).forEach(function(r){var i=o(t[r],e);"undefined"!==i&&n.push([e.quotedString(r),":",i])});var r=this.generateList(n);return r.prepend("{"),r.add("}"),r},generateList:function(t){for(var e=this.empty(),n=0,r=t.length;n<r;n++)n&&e.add(","),e.add(o(t[n],this));return e},generateArray:function(t){var e=this.generateList(t);return e.prepend("["),e.add("]"),e}},e.default=s,t.exports=e.default},1127(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.Compiler=u,e.precompile=function(t,e,n){if(null==t||"string"!=typeof t&&"Program"!==t.type)throw new i.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+t);"data"in(e=e||{})||(e.data=!0);e.compat&&(e.useDepths=!0);var r=n.parse(t,e),o=(new n.Compiler).compile(r,e);return(new n.JavaScriptCompiler).compile(o,e)},e.compile=function(t,e,n){void 0===e&&(e={});if(null==t||"string"!=typeof t&&"Program"!==t.type)throw new i.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+t);"data"in(e=o.extend({},e))||(e.data=!0);e.compat&&(e.useDepths=!0);var r=void 0;function s(){var r=n.parse(t,e),i=(new n.Compiler).compile(r,e),o=(new n.JavaScriptCompiler).compile(i,e,void 0,!0);return n.template(o)}function a(t,e){return r||(r=s()),r.call(this,t,e)}return a._setup=function(t){return r||(r=s()),r._setup(t)},a._child=function(t,e,n,i){return r||(r=s()),r._child(t,e,n,i)},a};var i=r(n(3769)),o=n(2849),s=r(n(2300)),a=[].slice;function u(){}function c(t,e){if(t===e)return!0;if(o.isArray(t)&&o.isArray(e)&&t.length===e.length){for(var n=0;n<t.length;n++)if(!c(t[n],e[n]))return!1;return!0}}function l(t){if(!t.path.parts){var e=t.path;t.path={type:"PathExpression",data:!1,depth:0,parts:[e.original+""],original:e.original+"",loc:e.loc}}}u.prototype={compiler:u,equals:function(t){var e=this.opcodes.length;if(t.opcodes.length!==e)return!1;for(var n=0;n<e;n++){var r=this.opcodes[n],i=t.opcodes[n];if(r.opcode!==i.opcode||!c(r.args,i.args))return!1}e=this.children.length;for(n=0;n<e;n++)if(!this.children[n].equals(t.children[n]))return!1;return!0},guid:0,compile:function(t,e){return this.sourceNode=[],this.opcodes=[],this.children=[],this.options=e,this.stringParams=e.stringParams,this.trackIds=e.trackIds,e.blockParams=e.blockParams||[],e.knownHelpers=o.extend(Object.create(null),{helperMissing:!0,blockHelperMissing:!0,each:!0,if:!0,unless:!0,with:!0,log:!0,lookup:!0},e.knownHelpers),this.accept(t)},compileProgram:function(t){var e=(new this.compiler).compile(t,this.options),n=this.guid++;return this.usePartial=this.usePartial||e.usePartial,this.children[n]=e,this.useDepths=this.useDepths||e.useDepths,n},accept:function(t){if(!this[t.type])throw new i.default("Unknown type: "+t.type,t);this.sourceNode.unshift(t);var e=this[t.type](t);return this.sourceNode.shift(),e},Program:function(t){this.options.blockParams.unshift(t.blockParams);for(var e=t.body,n=e.length,r=0;r<n;r++)this.accept(e[r]);return this.options.blockParams.shift(),this.isSimple=1===n,this.blockParams=t.blockParams?t.blockParams.length:0,this},BlockStatement:function(t){l(t);var e=t.program,n=t.inverse;e=e&&this.compileProgram(e),n=n&&this.compileProgram(n);var r=this.classifySexpr(t);"helper"===r?this.helperSexpr(t,e,n):"simple"===r?(this.simpleSexpr(t),this.opcode("pushProgram",e),this.opcode("pushProgram",n),this.opcode("emptyHash"),this.opcode("blockValue",t.path.original)):(this.ambiguousSexpr(t,e,n),this.opcode("pushProgram",e),this.opcode("pushProgram",n),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},DecoratorBlock:function(t){var e=t.program&&this.compileProgram(t.program),n=this.setupFullMustacheParams(t,e,void 0),r=t.path;this.useDecorators=!0,this.opcode("registerDecorator",n.length,r.original)},PartialStatement:function(t){this.usePartial=!0;var e=t.program;e&&(e=this.compileProgram(t.program));var n=t.params;if(n.length>1)throw new i.default("Unsupported number of partial arguments: "+n.length,t);n.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):n.push({type:"PathExpression",parts:[],depth:0}));var r=t.name.original,o="SubExpression"===t.name.type;o&&this.accept(t.name),this.setupFullMustacheParams(t,e,void 0,!0);var s=t.indent||"";this.options.preventIndent&&s&&(this.opcode("appendContent",s),s=""),this.opcode("invokePartial",o,r,s),this.opcode("append")},PartialBlockStatement:function(t){this.PartialStatement(t)},MustacheStatement:function(t){this.SubExpression(t),t.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(t){this.DecoratorBlock(t)},ContentStatement:function(t){t.value&&this.opcode("appendContent",t.value)},CommentStatement:function(){},SubExpression:function(t){l(t);var e=this.classifySexpr(t);"simple"===e?this.simpleSexpr(t):"helper"===e?this.helperSexpr(t):this.ambiguousSexpr(t)},ambiguousSexpr:function(t,e,n){var r=t.path,i=r.parts[0],o=null!=e||null!=n;this.opcode("getContext",r.depth),this.opcode("pushProgram",e),this.opcode("pushProgram",n),r.strict=!0,this.accept(r),this.opcode("invokeAmbiguous",i,o)},simpleSexpr:function(t){var e=t.path;e.strict=!0,this.accept(e),this.opcode("resolvePossibleLambda")},helperSexpr:function(t,e,n){var r=this.setupFullMustacheParams(t,e,n),o=t.path,a=o.parts[0];if(this.options.knownHelpers[a])this.opcode("invokeKnownHelper",r.length,a);else{if(this.options.knownHelpersOnly)throw new i.default("You specified knownHelpersOnly, but used the unknown helper "+a,t);o.strict=!0,o.falsy=!0,this.accept(o),this.opcode("invokeHelper",r.length,o.original,s.default.helpers.simpleId(o))}},PathExpression:function(t){this.addDepth(t.depth),this.opcode("getContext",t.depth);var e=t.parts[0],n=s.default.helpers.scopedId(t),r=!t.depth&&!n&&this.blockParamIndex(e);r?this.opcode("lookupBlockParam",r,t.parts):e?t.data?(this.options.data=!0,this.opcode("lookupData",t.depth,t.parts,t.strict)):this.opcode("lookupOnContext",t.parts,t.falsy,t.strict,n):this.opcode("pushContext")},StringLiteral:function(t){this.opcode("pushString",t.value)},NumberLiteral:function(t){this.opcode("pushLiteral",t.value)},BooleanLiteral:function(t){this.opcode("pushLiteral",t.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(t){var e=t.pairs,n=0,r=e.length;for(this.opcode("pushHash");n<r;n++)this.pushParam(e[n].value);for(;n--;)this.opcode("assignToHash",e[n].key);this.opcode("popHash")},opcode:function(t){this.opcodes.push({opcode:t,args:a.call(arguments,1),loc:this.sourceNode[0].loc})},addDepth:function(t){t&&(this.useDepths=!0)},classifySexpr:function(t){var e=s.default.helpers.simpleId(t.path),n=e&&!!this.blockParamIndex(t.path.parts[0]),r=!n&&s.default.helpers.helperExpression(t),i=!n&&(r||e);if(i&&!r){var o=t.path.parts[0],a=this.options;a.knownHelpers[o]?r=!0:a.knownHelpersOnly&&(i=!1)}return r?"helper":i?"ambiguous":"simple"},pushParams:function(t){for(var e=0,n=t.length;e<n;e++)this.pushParam(t[e])},pushParam:function(t){var e=null!=t.value?t.value:t.original||"";if(this.stringParams)e.replace&&(e=e.replace(/^(\.?\.\/)*/g,"").replace(/\//g,".")),t.depth&&this.addDepth(t.depth),this.opcode("getContext",t.depth||0),this.opcode("pushStringParam",e,t.type),"SubExpression"===t.type&&this.accept(t);else{if(this.trackIds){var n=void 0;if(!t.parts||s.default.helpers.scopedId(t)||t.depth||(n=this.blockParamIndex(t.parts[0])),n){var r=t.parts.slice(1).join(".");this.opcode("pushId","BlockParam",n,r)}else(e=t.original||e).replace&&(e=e.replace(/^this(?:\.|$)/,"").replace(/^\.\//,"").replace(/^\.$/,"")),this.opcode("pushId",t.type,e)}this.accept(t)}},setupFullMustacheParams:function(t,e,n,r){var i=t.params;return this.pushParams(i),this.opcode("pushProgram",e),this.opcode("pushProgram",n),t.hash?this.accept(t.hash):this.opcode("emptyHash",r),i},blockParamIndex:function(t){for(var e=0,n=this.options.blockParams.length;e<n;e++){var r=this.options.blockParams[e],i=r&&o.indexOf(r,t);if(r&&i>=0)return[e,i]}}}},8425(t,e,n){e.__esModule=!0,e.SourceLocation=function(t,e){this.source=t,this.start={line:e.first_line,column:e.first_column},this.end={line:e.last_line,column:e.last_column}},e.id=function(t){return/^\[.*\]$/.test(t)?t.substring(1,t.length-1):t},e.stripFlags=function(t,e){return{open:"~"===t.charAt(2),close:"~"===e.charAt(e.length-3)}},e.stripComment=function(t){return t.replace(/^\{\{~?!-?-?/,"").replace(/-?-?~?\}\}$/,"")},e.preparePath=function(t,e,n){n=this.locInfo(n);for(var r=t?"@":"",i=[],s=0,a=0,u=e.length;a<u;a++){var c=e[a].part,l=e[a].original!==c;if(r+=(e[a].separator||"")+c,l||".."!==c&&"."!==c&&"this"!==c)i.push(c);else{if(i.length>0)throw new o.default("Invalid path: "+r,{loc:n});".."===c&&s++}}return{type:"PathExpression",data:t,depth:s,parts:i,original:r,loc:n}},e.prepareMustache=function(t,e,n,r,i,o){var s=r.charAt(3)||r.charAt(2),a="{"!==s&&"&"!==s;return{type:/\*/.test(r)?"Decorator":"MustacheStatement",path:t,params:e,hash:n,escaped:a,strip:i,loc:this.locInfo(o)}},e.prepareRawBlock=function(t,e,n,r){s(t,n),r=this.locInfo(r);var i={type:"Program",body:e,strip:{},loc:r};return{type:"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:i,openStrip:{},inverseStrip:{},closeStrip:{},loc:r}},e.prepareBlock=function(t,e,n,r,i,a){r&&r.path&&s(t,r);var u=/\*/.test(t.open);e.blockParams=t.blockParams;var c=void 0,l=void 0;if(n){if(u)throw new o.default("Unexpected inverse block on decorator",n);n.chain&&(n.program.body[0].closeStrip=r.strip),l=n.strip,c=n.program}i&&(i=c,c=e,e=i);return{type:u?"DecoratorBlock":"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:e,inverse:c,openStrip:t.strip,inverseStrip:l,closeStrip:r&&r.strip,loc:this.locInfo(a)}},e.prepareProgram=function(t,e){if(!e&&t.length){var n=t[0].loc,r=t[t.length-1].loc;n&&r&&(e={source:n.source,start:{line:n.start.line,column:n.start.column},end:{line:r.end.line,column:r.end.column}})}return{type:"Program",body:t,strip:{},loc:e}},e.preparePartialBlock=function(t,e,n,r){return s(t,n),{type:"PartialBlockStatement",name:t.path,params:t.params,hash:t.hash,program:e,openStrip:t.strip,closeStrip:n&&n.strip,loc:this.locInfo(r)}};var r,i=n(3769),o=(r=i)&&r.__esModule?r:{default:r};function s(t,e){if(e=e.path?e.path.original:e,t.path.original!==e){var n={loc:t.path.loc};throw new o.default(t.path.original+" doesn't match "+e,n)}}},6727(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var i=n(2871),o=r(n(3769)),s=n(2849),a=r(n(9632));function u(t){this.value=t}function c(){}c.prototype={nameLookup:function(t,e){return this.internalNameLookup(t,e)},depthedLookup:function(t){return[this.aliasable("container.lookup"),"(depths, ",JSON.stringify(t),")"]},compilerInfo:function(){var t=i.COMPILER_REVISION;return[t,i.REVISION_CHANGES[t]]},appendToBuffer:function(t,e,n){return s.isArray(t)||(t=[t]),t=this.source.wrap(t,e),this.environment.isSimple?["return ",t,";"]:n?["buffer += ",t,";"]:(t.appendToBuffer=!0,t)},initializeBuffer:function(){return this.quotedString("")},internalNameLookup:function(t,e){return this.lookupPropertyFunctionIsUsed=!0,["lookupProperty(",t,",",JSON.stringify(e),")"]},lookupPropertyFunctionIsUsed:!1,compile:function(t,e,n,r){this.environment=t,this.options=e,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!r,this.name=this.environment.name,this.isChild=!!n,this.context=n||{decorators:[],programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.blockParams=[],this.compileChildren(t,e),this.useDepths=this.useDepths||t.useDepths||t.useDecorators||this.options.compat,this.useBlockParams=this.useBlockParams||t.useBlockParams;var i=t.opcodes,s=void 0,a=void 0,u=void 0,c=void 0;for(u=0,c=i.length;u<c;u++)s=i[u],this.source.currentLocation=s.loc,a=a||s.loc,this[s.opcode].apply(this,s.args);if(this.source.currentLocation=a,this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new o.default("Compile completed with content left on stack");this.decorators.isEmpty()?this.decorators=void 0:(this.useDecorators=!0,this.decorators.prepend(["var decorators = container.decorators, ",this.lookupPropertyFunctionVarDeclaration(),";\n"]),this.decorators.push("return fn;"),r?this.decorators=Function.apply(this,["fn","props","container","depth0","data","blockParams","depths",this.decorators.merge()]):(this.decorators.prepend("function(fn, props, container, depth0, data, blockParams, depths) {\n"),this.decorators.push("}\n"),this.decorators=this.decorators.merge()));var l=this.createFunctionContext(r);if(this.isChild)return l;var h={compiler:this.compilerInfo(),main:l};this.decorators&&(h.main_d=this.decorators,h.useDecorators=!0);var d=this.context,p=d.programs,f=d.decorators;for(u=0,c=p.length;u<c;u++)p[u]&&(h[u]=p[u],f[u]&&(h[u+"_d"]=f[u],h.useDecorators=!0));return this.environment.usePartial&&(h.usePartial=!0),this.options.data&&(h.useData=!0),this.useDepths&&(h.useDepths=!0),this.useBlockParams&&(h.useBlockParams=!0),this.options.compat&&(h.compat=!0),r?h.compilerOptions=this.options:(h.compiler=JSON.stringify(h.compiler),this.source.currentLocation={start:{line:1,column:0}},h=this.objectLiteral(h),e.srcName?(h=h.toStringWithSourceMap({file:e.destName})).map=h.map&&h.map.toString():h=h.toString()),h},preamble:function(){this.lastContext=0,this.source=new a.default(this.options.srcName),this.decorators=new a.default(this.options.srcName)},createFunctionContext:function(t){var e=this,n="",r=this.stackVars.concat(this.registers.list);r.length>0&&(n+=", "+r.join(", "));var i=0;Object.keys(this.aliases).forEach(function(t){var r=e.aliases[t];r.children&&r.referenceCount>1&&(n+=", alias"+ ++i+"="+t,r.children[0]="alias"+i)}),this.lookupPropertyFunctionIsUsed&&(n+=", "+this.lookupPropertyFunctionVarDeclaration());var o=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&o.push("blockParams"),this.useDepths&&o.push("depths");var s=this.mergeSource(n);return t?(o.push(s),Function.apply(this,o)):this.source.wrap(["function(",o.join(","),") {\n ",s,"}"])},mergeSource:function(t){var e=this.environment.isSimple,n=!this.forceBuffer,r=void 0,i=void 0,o=void 0,s=void 0;return this.source.each(function(t){t.appendToBuffer?(o?t.prepend(" + "):o=t,s=t):(o&&(i?o.prepend("buffer += "):r=!0,s.add(";"),o=s=void 0),i=!0,e||(n=!1))}),n?o?(o.prepend("return "),s.add(";")):i||this.source.push('return "";'):(t+=", buffer = "+(r?"":this.initializeBuffer()),o?(o.prepend("return buffer + "),s.add(";")):this.source.push("return buffer;")),t&&this.source.prepend("var "+t.substring(2)+(r?"":";\n")),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return"\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n ".trim()},blockValue:function(t){var e=this.aliasable("container.hooks.blockHelperMissing"),n=[this.contextName(0)];this.setupHelperArgs(t,0,n);var r=this.popStack();n.splice(1,0,r),this.push(this.source.functionCall(e,"call",n))},ambiguousBlockValue:function(){var t=this.aliasable("container.hooks.blockHelperMissing"),e=[this.contextName(0)];this.setupHelperArgs("",0,e,!0),this.flushInline();var n=this.topStack();e.splice(1,0,n),this.pushSource(["if (!",this.lastHelper,") { ",n," = ",this.source.functionCall(t,"call",e),"}"])},appendContent:function(t){this.pendingContent?t=this.pendingContent+t:this.pendingLocation=this.source.currentLocation,this.pendingContent=t},append:function(){if(this.isInline())this.replaceStack(function(t){return[" != null ? ",t,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var t=this.popStack();this.pushSource(["if (",t," != null) { ",this.appendToBuffer(t,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(t){this.lastContext=t},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(t,e,n,r){var i=0;r||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(t[i++])),this.resolvePath("context",t,i,e,n)},lookupBlockParam:function(t,e){this.useBlockParams=!0,this.push(["blockParams[",t[0],"][",t[1],"]"]),this.resolvePath("context",e,1)},lookupData:function(t,e,n){t?this.pushStackLiteral("container.data(data, "+t+")"):this.pushStackLiteral("data"),this.resolvePath("data",e,0,!0,n)},resolvePath:function(t,e,n,r,i){var o=this;if(this.options.strict||this.options.assumeObjects)this.push(function(t,e,n,r,i){var o=e.popStack(),s=n.length;t&&s--;for(;r<s;r++)o=e.nameLookup(o,n[r],i);return t?[e.aliasable("container.strict"),"(",o,", ",e.quotedString(n[r]),", ",JSON.stringify(e.source.currentLocation)," )"]:o}(this.options.strict&&i,this,e,n,t));else for(var s=e.length;n<s;n++)this.replaceStack(function(i){var s=o.nameLookup(i,e[n],t);return r?[" && ",s]:[" != null ? ",s," : ",i]})},resolvePossibleLambda:function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},pushStringParam:function(t,e){this.pushContext(),this.pushString(e),"SubExpression"!==e&&("string"==typeof t?this.pushString(t):this.pushStackLiteral(t))},emptyHash:function(t){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(t?"undefined":"{}")},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:{},types:[],contexts:[],ids:[]}},popHash:function(){var t=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(t.ids)),this.stringParams&&(this.push(this.objectLiteral(t.contexts)),this.push(this.objectLiteral(t.types))),this.push(this.objectLiteral(t.values))},pushString:function(t){this.pushStackLiteral(this.quotedString(t))},pushLiteral:function(t){this.pushStackLiteral(t)},pushProgram:function(t){null!=t?this.pushStackLiteral(this.programExpression(t)):this.pushStackLiteral(null)},registerDecorator:function(t,e){var n=this.nameLookup("decorators",e,"decorator"),r=this.setupHelperArgs(e,t);this.decorators.push(["fn = ",this.decorators.functionCall(n,"",["fn","props","container",r])," || fn;"])},invokeHelper:function(t,e,n){var r=this.popStack(),i=this.setupHelper(t,e),o=[];n&&o.push(i.name),o.push(r),this.options.strict||o.push(this.aliasable("container.hooks.helperMissing"));var s=["(",this.itemsSeparatedBy(o,"||"),")"],a=this.source.functionCall(s,"call",i.callParams);this.push(a)},itemsSeparatedBy:function(t,e){var n=[];n.push(t[0]);for(var r=1;r<t.length;r++)n.push(e,t[r]);return n},invokeKnownHelper:function(t,e){var n=this.setupHelper(t,e);this.push(this.source.functionCall(n.name,"call",n.callParams))},invokeAmbiguous:function(t,e){this.useRegister("helper");var n=this.popStack();this.emptyHash();var r=this.setupHelper(0,t,e),i=["(","(helper = ",this.lastHelper=this.nameLookup("helpers",t,"helper")," || ",n,")"];this.options.strict||(i[0]="(helper = ",i.push(" != null ? helper : ",this.aliasable("container.hooks.helperMissing"))),this.push(["(",i,r.paramsInit?["),(",r.paramsInit]:[],"),","(typeof helper === ",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",r.callParams)," : helper))"])},invokePartial:function(t,e,n){var r=[],i=this.setupParams(e,1,r);t&&(e=this.popStack(),delete i.name),n&&(i.indent=JSON.stringify(n)),i.helpers="helpers",i.partials="partials",i.decorators="container.decorators",t?r.unshift(e):r.unshift(this.nameLookup("partials",e,"partial")),this.options.compat&&(i.depths="depths"),i=this.objectLiteral(i),r.push(i),this.push(this.source.functionCall("container.invokePartial","",r))},assignToHash:function(t){var e=this.popStack(),n=void 0,r=void 0,i=void 0;this.trackIds&&(i=this.popStack()),this.stringParams&&(r=this.popStack(),n=this.popStack());var o=this.hash;n&&(o.contexts[t]=n),r&&(o.types[t]=r),i&&(o.ids[t]=i),o.values[t]=e},pushId:function(t,e,n){"BlockParam"===t?this.pushStackLiteral("blockParams["+e[0]+"].path["+e[1]+"]"+(n?" + "+JSON.stringify("."+n):"")):"PathExpression"===t?this.pushString(e):"SubExpression"===t?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:c,compileChildren:function(t,e){for(var n=t.children,r=void 0,i=void 0,o=0,s=n.length;o<s;o++){r=n[o],i=new this.compiler;var a=this.matchExistingProgram(r);if(null==a){this.context.programs.push("");var u=this.context.programs.length;r.index=u,r.name="program"+u,this.context.programs[u]=i.compile(r,e,this.context,!this.precompile),this.context.decorators[u]=i.decorators,this.context.environments[u]=r,this.useDepths=this.useDepths||i.useDepths,this.useBlockParams=this.useBlockParams||i.useBlockParams,r.useDepths=this.useDepths,r.useBlockParams=this.useBlockParams}else r.index=a.index,r.name="program"+a.index,this.useDepths=this.useDepths||a.useDepths,this.useBlockParams=this.useBlockParams||a.useBlockParams}},matchExistingProgram:function(t){for(var e=0,n=this.context.environments.length;e<n;e++){var r=this.context.environments[e];if(r&&r.equals(t))return r}},programExpression:function(t){var e=this.environment.children[t],n=[e.index,"data",e.blockParams];return(this.useBlockParams||this.useDepths)&&n.push("blockParams"),this.useDepths&&n.push("depths"),"container.program("+n.join(", ")+")"},useRegister:function(t){this.registers[t]||(this.registers[t]=!0,this.registers.list.push(t))},push:function(t){return t instanceof u||(t=this.source.wrap(t)),this.inlineStack.push(t),t},pushStackLiteral:function(t){this.push(new u(t))},pushSource:function(t){this.pendingContent&&(this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0),t&&this.source.push(t)},replaceStack:function(t){var e=["("],n=void 0,r=void 0,i=void 0;if(!this.isInline())throw new o.default("replaceStack on non-inline");var s=this.popStack(!0);if(s instanceof u)e=["(",n=[s.value]],i=!0;else{r=!0;var a=this.incrStack();e=["((",this.push(a)," = ",s,")"],n=this.topStack()}var c=t.call(this,n);i||this.popStack(),r&&this.stackSlot--,this.push(e.concat(c,")"))},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var t=this.inlineStack;this.inlineStack=[];for(var e=0,n=t.length;e<n;e++){var r=t[e];if(r instanceof u)this.compileStack.push(r);else{var i=this.incrStack();this.pushSource([i," = ",r,";"]),this.compileStack.push(i)}}},isInline:function(){return this.inlineStack.length},popStack:function(t){var e=this.isInline(),n=(e?this.inlineStack:this.compileStack).pop();if(!t&&n instanceof u)return n.value;if(!e){if(!this.stackSlot)throw new o.default("Invalid stack pop");this.stackSlot--}return n},topStack:function(){var t=this.isInline()?this.inlineStack:this.compileStack,e=t[t.length-1];return e instanceof u?e.value:e},contextName:function(t){return this.useDepths&&t?"depths["+t+"]":"depth"+t},quotedString:function(t){return this.source.quotedString(t)},objectLiteral:function(t){return this.source.objectLiteral(t)},aliasable:function(t){var e=this.aliases[t];return e?(e.referenceCount++,e):((e=this.aliases[t]=this.source.wrap(t)).aliasable=!0,e.referenceCount=1,e)},setupHelper:function(t,e,n){var r=[];return{params:r,paramsInit:this.setupHelperArgs(e,t,r,n),name:this.nameLookup("helpers",e,"helper"),callParams:[this.aliasable(this.contextName(0)+" != null ? "+this.contextName(0)+" : (container.nullContext || {})")].concat(r)}},setupParams:function(t,e,n){var r={},i=[],o=[],s=[],a=!n,u=void 0;a&&(n=[]),r.name=this.quotedString(t),r.hash=this.popStack(),this.trackIds&&(r.hashIds=this.popStack()),this.stringParams&&(r.hashTypes=this.popStack(),r.hashContexts=this.popStack());var c=this.popStack(),l=this.popStack();(l||c)&&(r.fn=l||"container.noop",r.inverse=c||"container.noop");for(var h=e;h--;)u=this.popStack(),n[h]=u,this.trackIds&&(s[h]=this.popStack()),this.stringParams&&(o[h]=this.popStack(),i[h]=this.popStack());return a&&(r.args=this.source.generateArray(n)),this.trackIds&&(r.ids=this.source.generateArray(s)),this.stringParams&&(r.types=this.source.generateArray(o),r.contexts=this.source.generateArray(i)),this.options.data&&(r.data="data"),this.useBlockParams&&(r.blockParams="blockParams"),r},setupHelperArgs:function(t,e,n,r){var i=this.setupParams(t,e,n);return i.loc=JSON.stringify(this.source.currentLocation),i=this.objectLiteral(i),r?(this.useRegister("options"),n.push("options"),["options=",i]):n?(n.push(i),""):i}},function(){for(var t="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield await null true false".split(" "),e=c.RESERVED_WORDS={},n=0,r=t.length;n<r;n++)e[t[n]]=!0}(),c.isValidJavaScriptVariableName=function(t){return!c.RESERVED_WORDS[t]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(t)},e.default=c,t.exports=e.default},6201(t,e){e.__esModule=!0;var n=function(){var t={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,partialBlock:12,content:13,COMMENT:14,CONTENT:15,openRawBlock:16,rawBlock_repetition0:17,END_RAW_BLOCK:18,OPEN_RAW_BLOCK:19,helperName:20,openRawBlock_repetition0:21,openRawBlock_option0:22,CLOSE_RAW_BLOCK:23,openBlock:24,block_option0:25,closeBlock:26,openInverse:27,block_option1:28,OPEN_BLOCK:29,openBlock_repetition0:30,openBlock_option0:31,openBlock_option1:32,CLOSE:33,OPEN_INVERSE:34,openInverse_repetition0:35,openInverse_option0:36,openInverse_option1:37,openInverseChain:38,OPEN_INVERSE_CHAIN:39,openInverseChain_repetition0:40,openInverseChain_option0:41,openInverseChain_option1:42,inverseAndProgram:43,INVERSE:44,inverseChain:45,inverseChain_option0:46,OPEN_ENDBLOCK:47,OPEN:48,mustache_repetition0:49,mustache_option0:50,OPEN_UNESCAPED:51,mustache_repetition1:52,mustache_option1:53,CLOSE_UNESCAPED:54,OPEN_PARTIAL:55,partialName:56,partial_repetition0:57,partial_option0:58,openPartialBlock:59,OPEN_PARTIAL_BLOCK:60,openPartialBlock_repetition0:61,openPartialBlock_option0:62,param:63,sexpr:64,OPEN_SEXPR:65,sexpr_repetition0:66,sexpr_option0:67,CLOSE_SEXPR:68,hash:69,hash_repetition_plus0:70,hashSegment:71,ID:72,EQUALS:73,blockParams:74,OPEN_BLOCK_PARAMS:75,blockParams_repetition_plus0:76,CLOSE_BLOCK_PARAMS:77,path:78,dataName:79,STRING:80,NUMBER:81,BOOLEAN:82,UNDEFINED:83,NULL:84,DATA:85,pathSegments:86,SEP:87,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"COMMENT",15:"CONTENT",18:"END_RAW_BLOCK",19:"OPEN_RAW_BLOCK",23:"CLOSE_RAW_BLOCK",29:"OPEN_BLOCK",33:"CLOSE",34:"OPEN_INVERSE",39:"OPEN_INVERSE_CHAIN",44:"INVERSE",47:"OPEN_ENDBLOCK",48:"OPEN",51:"OPEN_UNESCAPED",54:"CLOSE_UNESCAPED",55:"OPEN_PARTIAL",60:"OPEN_PARTIAL_BLOCK",65:"OPEN_SEXPR",68:"CLOSE_SEXPR",72:"ID",73:"EQUALS",75:"OPEN_BLOCK_PARAMS",77:"CLOSE_BLOCK_PARAMS",80:"STRING",81:"NUMBER",82:"BOOLEAN",83:"UNDEFINED",84:"NULL",85:"DATA",87:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[13,1],[10,3],[16,5],[9,4],[9,4],[24,6],[27,6],[38,6],[43,2],[45,3],[45,1],[26,3],[8,5],[8,5],[11,5],[12,3],[59,5],[63,1],[63,1],[64,5],[69,1],[71,3],[74,3],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[56,1],[56,1],[79,2],[78,1],[86,3],[86,1],[6,0],[6,2],[17,0],[17,2],[21,0],[21,2],[22,0],[22,1],[25,0],[25,1],[28,0],[28,1],[30,0],[30,2],[31,0],[31,1],[32,0],[32,1],[35,0],[35,2],[36,0],[36,1],[37,0],[37,1],[40,0],[40,2],[41,0],[41,1],[42,0],[42,1],[46,0],[46,1],[49,0],[49,2],[50,0],[50,1],[52,0],[52,2],[53,0],[53,1],[57,0],[57,2],[58,0],[58,1],[61,0],[61,2],[62,0],[62,1],[66,0],[66,2],[67,0],[67,1],[70,1],[70,2],[76,1],[76,2]],performAction:function(t,e,n,r,i,o,s){var a=o.length-1;switch(i){case 1:return o[a-1];case 2:this.$=r.prepareProgram(o[a]);break;case 3:case 4:case 5:case 6:case 7:case 8:case 20:case 27:case 28:case 33:case 34:case 40:case 41:this.$=o[a];break;case 9:this.$={type:"CommentStatement",value:r.stripComment(o[a]),strip:r.stripFlags(o[a],o[a]),loc:r.locInfo(this._$)};break;case 10:this.$={type:"ContentStatement",original:o[a],value:o[a],loc:r.locInfo(this._$)};break;case 11:this.$=r.prepareRawBlock(o[a-2],o[a-1],o[a],this._$);break;case 12:this.$={path:o[a-3],params:o[a-2],hash:o[a-1]};break;case 13:this.$=r.prepareBlock(o[a-3],o[a-2],o[a-1],o[a],!1,this._$);break;case 14:this.$=r.prepareBlock(o[a-3],o[a-2],o[a-1],o[a],!0,this._$);break;case 15:this.$={open:o[a-5],path:o[a-4],params:o[a-3],hash:o[a-2],blockParams:o[a-1],strip:r.stripFlags(o[a-5],o[a])};break;case 16:case 17:this.$={path:o[a-4],params:o[a-3],hash:o[a-2],blockParams:o[a-1],strip:r.stripFlags(o[a-5],o[a])};break;case 18:this.$={strip:r.stripFlags(o[a-1],o[a-1]),program:o[a]};break;case 19:var u=r.prepareBlock(o[a-2],o[a-1],o[a],o[a],!1,this._$),c=r.prepareProgram([u],o[a-1].loc);c.chained=!0,this.$={strip:o[a-2].strip,program:c,chain:!0};break;case 21:this.$={path:o[a-1],strip:r.stripFlags(o[a-2],o[a])};break;case 22:case 23:this.$=r.prepareMustache(o[a-3],o[a-2],o[a-1],o[a-4],r.stripFlags(o[a-4],o[a]),this._$);break;case 24:this.$={type:"PartialStatement",name:o[a-3],params:o[a-2],hash:o[a-1],indent:"",strip:r.stripFlags(o[a-4],o[a]),loc:r.locInfo(this._$)};break;case 25:this.$=r.preparePartialBlock(o[a-2],o[a-1],o[a],this._$);break;case 26:this.$={path:o[a-3],params:o[a-2],hash:o[a-1],strip:r.stripFlags(o[a-4],o[a])};break;case 29:this.$={type:"SubExpression",path:o[a-3],params:o[a-2],hash:o[a-1],loc:r.locInfo(this._$)};break;case 30:this.$={type:"Hash",pairs:o[a],loc:r.locInfo(this._$)};break;case 31:this.$={type:"HashPair",key:r.id(o[a-2]),value:o[a],loc:r.locInfo(this._$)};break;case 32:this.$=r.id(o[a-1]);break;case 35:this.$={type:"StringLiteral",value:o[a],original:o[a],loc:r.locInfo(this._$)};break;case 36:this.$={type:"NumberLiteral",value:Number(o[a]),original:Number(o[a]),loc:r.locInfo(this._$)};break;case 37:this.$={type:"BooleanLiteral",value:"true"===o[a],original:"true"===o[a],loc:r.locInfo(this._$)};break;case 38:this.$={type:"UndefinedLiteral",original:void 0,value:void 0,loc:r.locInfo(this._$)};break;case 39:this.$={type:"NullLiteral",original:null,value:null,loc:r.locInfo(this._$)};break;case 42:this.$=r.preparePath(!0,o[a],this._$);break;case 43:this.$=r.preparePath(!1,o[a],this._$);break;case 44:o[a-2].push({part:r.id(o[a]),original:o[a],separator:o[a-1]}),this.$=o[a-2];break;case 45:this.$=[{part:r.id(o[a]),original:o[a]}];break;case 46:case 48:case 50:case 58:case 64:case 70:case 78:case 82:case 86:case 90:case 94:this.$=[];break;case 47:case 49:case 51:case 59:case 65:case 71:case 79:case 83:case 87:case 91:case 95:case 99:case 101:o[a-1].push(o[a]);break;case 98:case 100:this.$=[o[a]]}},table:[{3:1,4:2,5:[2,46],6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:11,14:[1,12],15:[1,20],16:17,19:[1,23],24:15,27:16,29:[1,21],34:[1,22],39:[2,2],44:[2,2],47:[2,2],48:[1,13],51:[1,14],55:[1,18],59:19,60:[1,24]},{1:[2,1]},{5:[2,47],14:[2,47],15:[2,47],19:[2,47],29:[2,47],34:[2,47],39:[2,47],44:[2,47],47:[2,47],48:[2,47],51:[2,47],55:[2,47],60:[2,47]},{5:[2,3],14:[2,3],15:[2,3],19:[2,3],29:[2,3],34:[2,3],39:[2,3],44:[2,3],47:[2,3],48:[2,3],51:[2,3],55:[2,3],60:[2,3]},{5:[2,4],14:[2,4],15:[2,4],19:[2,4],29:[2,4],34:[2,4],39:[2,4],44:[2,4],47:[2,4],48:[2,4],51:[2,4],55:[2,4],60:[2,4]},{5:[2,5],14:[2,5],15:[2,5],19:[2,5],29:[2,5],34:[2,5],39:[2,5],44:[2,5],47:[2,5],48:[2,5],51:[2,5],55:[2,5],60:[2,5]},{5:[2,6],14:[2,6],15:[2,6],19:[2,6],29:[2,6],34:[2,6],39:[2,6],44:[2,6],47:[2,6],48:[2,6],51:[2,6],55:[2,6],60:[2,6]},{5:[2,7],14:[2,7],15:[2,7],19:[2,7],29:[2,7],34:[2,7],39:[2,7],44:[2,7],47:[2,7],48:[2,7],51:[2,7],55:[2,7],60:[2,7]},{5:[2,8],14:[2,8],15:[2,8],19:[2,8],29:[2,8],34:[2,8],39:[2,8],44:[2,8],47:[2,8],48:[2,8],51:[2,8],55:[2,8],60:[2,8]},{5:[2,9],14:[2,9],15:[2,9],19:[2,9],29:[2,9],34:[2,9],39:[2,9],44:[2,9],47:[2,9],48:[2,9],51:[2,9],55:[2,9],60:[2,9]},{20:25,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:36,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:37,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{4:38,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{15:[2,48],17:39,18:[2,48]},{20:41,56:40,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:44,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{5:[2,10],14:[2,10],15:[2,10],18:[2,10],19:[2,10],29:[2,10],34:[2,10],39:[2,10],44:[2,10],47:[2,10],48:[2,10],51:[2,10],55:[2,10],60:[2,10]},{20:45,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:46,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:47,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:41,56:48,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[2,78],49:49,65:[2,78],72:[2,78],80:[2,78],81:[2,78],82:[2,78],83:[2,78],84:[2,78],85:[2,78]},{23:[2,33],33:[2,33],54:[2,33],65:[2,33],68:[2,33],72:[2,33],75:[2,33],80:[2,33],81:[2,33],82:[2,33],83:[2,33],84:[2,33],85:[2,33]},{23:[2,34],33:[2,34],54:[2,34],65:[2,34],68:[2,34],72:[2,34],75:[2,34],80:[2,34],81:[2,34],82:[2,34],83:[2,34],84:[2,34],85:[2,34]},{23:[2,35],33:[2,35],54:[2,35],65:[2,35],68:[2,35],72:[2,35],75:[2,35],80:[2,35],81:[2,35],82:[2,35],83:[2,35],84:[2,35],85:[2,35]},{23:[2,36],33:[2,36],54:[2,36],65:[2,36],68:[2,36],72:[2,36],75:[2,36],80:[2,36],81:[2,36],82:[2,36],83:[2,36],84:[2,36],85:[2,36]},{23:[2,37],33:[2,37],54:[2,37],65:[2,37],68:[2,37],72:[2,37],75:[2,37],80:[2,37],81:[2,37],82:[2,37],83:[2,37],84:[2,37],85:[2,37]},{23:[2,38],33:[2,38],54:[2,38],65:[2,38],68:[2,38],72:[2,38],75:[2,38],80:[2,38],81:[2,38],82:[2,38],83:[2,38],84:[2,38],85:[2,38]},{23:[2,39],33:[2,39],54:[2,39],65:[2,39],68:[2,39],72:[2,39],75:[2,39],80:[2,39],81:[2,39],82:[2,39],83:[2,39],84:[2,39],85:[2,39]},{23:[2,43],33:[2,43],54:[2,43],65:[2,43],68:[2,43],72:[2,43],75:[2,43],80:[2,43],81:[2,43],82:[2,43],83:[2,43],84:[2,43],85:[2,43],87:[1,50]},{72:[1,35],86:51},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{52:52,54:[2,82],65:[2,82],72:[2,82],80:[2,82],81:[2,82],82:[2,82],83:[2,82],84:[2,82],85:[2,82]},{25:53,38:55,39:[1,57],43:56,44:[1,58],45:54,47:[2,54]},{28:59,43:60,44:[1,58],47:[2,56]},{13:62,15:[1,20],18:[1,61]},{33:[2,86],57:63,65:[2,86],72:[2,86],80:[2,86],81:[2,86],82:[2,86],83:[2,86],84:[2,86],85:[2,86]},{33:[2,40],65:[2,40],72:[2,40],80:[2,40],81:[2,40],82:[2,40],83:[2,40],84:[2,40],85:[2,40]},{33:[2,41],65:[2,41],72:[2,41],80:[2,41],81:[2,41],82:[2,41],83:[2,41],84:[2,41],85:[2,41]},{20:64,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:65,47:[1,66]},{30:67,33:[2,58],65:[2,58],72:[2,58],75:[2,58],80:[2,58],81:[2,58],82:[2,58],83:[2,58],84:[2,58],85:[2,58]},{33:[2,64],35:68,65:[2,64],72:[2,64],75:[2,64],80:[2,64],81:[2,64],82:[2,64],83:[2,64],84:[2,64],85:[2,64]},{21:69,23:[2,50],65:[2,50],72:[2,50],80:[2,50],81:[2,50],82:[2,50],83:[2,50],84:[2,50],85:[2,50]},{33:[2,90],61:70,65:[2,90],72:[2,90],80:[2,90],81:[2,90],82:[2,90],83:[2,90],84:[2,90],85:[2,90]},{20:74,33:[2,80],50:71,63:72,64:75,65:[1,43],69:73,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{72:[1,79]},{23:[2,42],33:[2,42],54:[2,42],65:[2,42],68:[2,42],72:[2,42],75:[2,42],80:[2,42],81:[2,42],82:[2,42],83:[2,42],84:[2,42],85:[2,42],87:[1,50]},{20:74,53:80,54:[2,84],63:81,64:75,65:[1,43],69:82,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:83,47:[1,66]},{47:[2,55]},{4:84,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{47:[2,20]},{20:85,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:86,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{26:87,47:[1,66]},{47:[2,57]},{5:[2,11],14:[2,11],15:[2,11],19:[2,11],29:[2,11],34:[2,11],39:[2,11],44:[2,11],47:[2,11],48:[2,11],51:[2,11],55:[2,11],60:[2,11]},{15:[2,49],18:[2,49]},{20:74,33:[2,88],58:88,63:89,64:75,65:[1,43],69:90,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{65:[2,94],66:91,68:[2,94],72:[2,94],80:[2,94],81:[2,94],82:[2,94],83:[2,94],84:[2,94],85:[2,94]},{5:[2,25],14:[2,25],15:[2,25],19:[2,25],29:[2,25],34:[2,25],39:[2,25],44:[2,25],47:[2,25],48:[2,25],51:[2,25],55:[2,25],60:[2,25]},{20:92,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,31:93,33:[2,60],63:94,64:75,65:[1,43],69:95,70:76,71:77,72:[1,78],75:[2,60],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,66],36:96,63:97,64:75,65:[1,43],69:98,70:76,71:77,72:[1,78],75:[2,66],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,22:99,23:[2,52],63:100,64:75,65:[1,43],69:101,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,92],62:102,63:103,64:75,65:[1,43],69:104,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,105]},{33:[2,79],65:[2,79],72:[2,79],80:[2,79],81:[2,79],82:[2,79],83:[2,79],84:[2,79],85:[2,79]},{33:[2,81]},{23:[2,27],33:[2,27],54:[2,27],65:[2,27],68:[2,27],72:[2,27],75:[2,27],80:[2,27],81:[2,27],82:[2,27],83:[2,27],84:[2,27],85:[2,27]},{23:[2,28],33:[2,28],54:[2,28],65:[2,28],68:[2,28],72:[2,28],75:[2,28],80:[2,28],81:[2,28],82:[2,28],83:[2,28],84:[2,28],85:[2,28]},{23:[2,30],33:[2,30],54:[2,30],68:[2,30],71:106,72:[1,107],75:[2,30]},{23:[2,98],33:[2,98],54:[2,98],68:[2,98],72:[2,98],75:[2,98]},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],73:[1,108],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{23:[2,44],33:[2,44],54:[2,44],65:[2,44],68:[2,44],72:[2,44],75:[2,44],80:[2,44],81:[2,44],82:[2,44],83:[2,44],84:[2,44],85:[2,44],87:[2,44]},{54:[1,109]},{54:[2,83],65:[2,83],72:[2,83],80:[2,83],81:[2,83],82:[2,83],83:[2,83],84:[2,83],85:[2,83]},{54:[2,85]},{5:[2,13],14:[2,13],15:[2,13],19:[2,13],29:[2,13],34:[2,13],39:[2,13],44:[2,13],47:[2,13],48:[2,13],51:[2,13],55:[2,13],60:[2,13]},{38:55,39:[1,57],43:56,44:[1,58],45:111,46:110,47:[2,76]},{33:[2,70],40:112,65:[2,70],72:[2,70],75:[2,70],80:[2,70],81:[2,70],82:[2,70],83:[2,70],84:[2,70],85:[2,70]},{47:[2,18]},{5:[2,14],14:[2,14],15:[2,14],19:[2,14],29:[2,14],34:[2,14],39:[2,14],44:[2,14],47:[2,14],48:[2,14],51:[2,14],55:[2,14],60:[2,14]},{33:[1,113]},{33:[2,87],65:[2,87],72:[2,87],80:[2,87],81:[2,87],82:[2,87],83:[2,87],84:[2,87],85:[2,87]},{33:[2,89]},{20:74,63:115,64:75,65:[1,43],67:114,68:[2,96],69:116,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,117]},{32:118,33:[2,62],74:119,75:[1,120]},{33:[2,59],65:[2,59],72:[2,59],75:[2,59],80:[2,59],81:[2,59],82:[2,59],83:[2,59],84:[2,59],85:[2,59]},{33:[2,61],75:[2,61]},{33:[2,68],37:121,74:122,75:[1,120]},{33:[2,65],65:[2,65],72:[2,65],75:[2,65],80:[2,65],81:[2,65],82:[2,65],83:[2,65],84:[2,65],85:[2,65]},{33:[2,67],75:[2,67]},{23:[1,123]},{23:[2,51],65:[2,51],72:[2,51],80:[2,51],81:[2,51],82:[2,51],83:[2,51],84:[2,51],85:[2,51]},{23:[2,53]},{33:[1,124]},{33:[2,91],65:[2,91],72:[2,91],80:[2,91],81:[2,91],82:[2,91],83:[2,91],84:[2,91],85:[2,91]},{33:[2,93]},{5:[2,22],14:[2,22],15:[2,22],19:[2,22],29:[2,22],34:[2,22],39:[2,22],44:[2,22],47:[2,22],48:[2,22],51:[2,22],55:[2,22],60:[2,22]},{23:[2,99],33:[2,99],54:[2,99],68:[2,99],72:[2,99],75:[2,99]},{73:[1,108]},{20:74,63:125,64:75,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,23],14:[2,23],15:[2,23],19:[2,23],29:[2,23],34:[2,23],39:[2,23],44:[2,23],47:[2,23],48:[2,23],51:[2,23],55:[2,23],60:[2,23]},{47:[2,19]},{47:[2,77]},{20:74,33:[2,72],41:126,63:127,64:75,65:[1,43],69:128,70:76,71:77,72:[1,78],75:[2,72],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,24],14:[2,24],15:[2,24],19:[2,24],29:[2,24],34:[2,24],39:[2,24],44:[2,24],47:[2,24],48:[2,24],51:[2,24],55:[2,24],60:[2,24]},{68:[1,129]},{65:[2,95],68:[2,95],72:[2,95],80:[2,95],81:[2,95],82:[2,95],83:[2,95],84:[2,95],85:[2,95]},{68:[2,97]},{5:[2,21],14:[2,21],15:[2,21],19:[2,21],29:[2,21],34:[2,21],39:[2,21],44:[2,21],47:[2,21],48:[2,21],51:[2,21],55:[2,21],60:[2,21]},{33:[1,130]},{33:[2,63]},{72:[1,132],76:131},{33:[1,133]},{33:[2,69]},{15:[2,12],18:[2,12]},{14:[2,26],15:[2,26],19:[2,26],29:[2,26],34:[2,26],47:[2,26],48:[2,26],51:[2,26],55:[2,26],60:[2,26]},{23:[2,31],33:[2,31],54:[2,31],68:[2,31],72:[2,31],75:[2,31]},{33:[2,74],42:134,74:135,75:[1,120]},{33:[2,71],65:[2,71],72:[2,71],75:[2,71],80:[2,71],81:[2,71],82:[2,71],83:[2,71],84:[2,71],85:[2,71]},{33:[2,73],75:[2,73]},{23:[2,29],33:[2,29],54:[2,29],65:[2,29],68:[2,29],72:[2,29],75:[2,29],80:[2,29],81:[2,29],82:[2,29],83:[2,29],84:[2,29],85:[2,29]},{14:[2,15],15:[2,15],19:[2,15],29:[2,15],34:[2,15],39:[2,15],44:[2,15],47:[2,15],48:[2,15],51:[2,15],55:[2,15],60:[2,15]},{72:[1,137],77:[1,136]},{72:[2,100],77:[2,100]},{14:[2,16],15:[2,16],19:[2,16],29:[2,16],34:[2,16],44:[2,16],47:[2,16],48:[2,16],51:[2,16],55:[2,16],60:[2,16]},{33:[1,138]},{33:[2,75]},{33:[2,32]},{72:[2,101],77:[2,101]},{14:[2,17],15:[2,17],19:[2,17],29:[2,17],34:[2,17],39:[2,17],44:[2,17],47:[2,17],48:[2,17],51:[2,17],55:[2,17],60:[2,17]}],defaultActions:{4:[2,1],54:[2,55],56:[2,20],60:[2,57],73:[2,81],82:[2,85],86:[2,18],90:[2,89],101:[2,53],104:[2,93],110:[2,19],111:[2,77],116:[2,97],119:[2,63],122:[2,69],135:[2,75],136:[2,32]},parseError:function(t,e){throw new Error(t)},parse:function(t){var e=this,n=[0],r=[null],i=[],o=this.table,s="",a=0,u=0,c=0;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,void 0===this.lexer.yylloc&&(this.lexer.yylloc={});var l=this.lexer.yylloc;i.push(l);var h=this.lexer.options&&this.lexer.options.ranges;function d(){var t;return"number"!=typeof(t=e.lexer.lex()||1)&&(t=e.symbols_[t]||t),t}"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var p,f,m,g,_,y,v,b,w,x={};;){if(m=n[n.length-1],this.defaultActions[m]?g=this.defaultActions[m]:(null==p&&(p=d()),g=o[m]&&o[m][p]),void 0===g||!g.length||!g[0]){var T="";if(!c){for(y in w=[],o[m])this.terminals_[y]&&y>2&&w.push("'"+this.terminals_[y]+"'");T=this.lexer.showPosition?"Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+w.join(", ")+", got '"+(this.terminals_[p]||p)+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==p?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(T,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:l,expected:w})}}if(g[0]instanceof Array&&g.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+p);switch(g[0]){case 1:n.push(p),r.push(this.lexer.yytext),i.push(this.lexer.yylloc),n.push(g[1]),p=null,f?(p=f,f=null):(u=this.lexer.yyleng,s=this.lexer.yytext,a=this.lexer.yylineno,l=this.lexer.yylloc,c>0&&c--);break;case 2:if(v=this.productions_[g[1]][1],x.$=r[r.length-v],x._$={first_line:i[i.length-(v||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(v||1)].first_column,last_column:i[i.length-1].last_column},h&&(x._$.range=[i[i.length-(v||1)].range[0],i[i.length-1].range[1]]),void 0!==(_=this.performAction.call(x,s,u,a,this.yy,g[1],r,i)))return _;v&&(n=n.slice(0,-1*v*2),r=r.slice(0,-1*v),i=i.slice(0,-1*v)),n.push(this.productions_[g[1]][0]),r.push(x.$),i.push(x._$),b=o[n[n.length-2]][n[n.length-1]],n.push(b);break;case 3:return!0}}return!0}},e=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t){return this._input=t,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e-1),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this},more:function(){return this._more=!0,this},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},next:function(){if(this.done)return this.EOF;var t,e,n,r,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var o=this._currentRules(),s=0;s<o.length&&(!(n=this._input.match(this.rules[o[s]]))||e&&!(n[0].length>e[0].length)||(e=n,r=s,this.options.flex));s++);return e?((i=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],t=this.performAction.call(this,this.yy,this,o[r],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t||void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return void 0!==t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)},options:{},performAction:function(t,e,n,r){function i(t,n){return e.yytext=e.yytext.substring(t,e.yyleng-n+t)}switch(n){case 0:if("\\\\"===e.yytext.slice(-2)?(i(0,1),this.begin("mu")):"\\"===e.yytext.slice(-1)?(i(0,1),this.begin("emu")):this.begin("mu"),e.yytext)return 15;break;case 1:case 5:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),"raw"===this.conditionStack[this.conditionStack.length-1]?15:(i(5,9),"END_RAW_BLOCK");case 6:case 22:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:case 23:return 48;case 21:this.unput(e.yytext),this.popState(),this.begin("com");break;case 24:return 73;case 25:case 26:case 41:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return e.yytext=i(1,2).replace(/\\"/g,'"'),80;case 32:return e.yytext=i(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 42:return e.yytext=e.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},rules:[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],conditions:{mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}}};return t}();function n(){this.yy={}}return t.lexer=e,n.prototype=t,t.Parser=n,new n}();e.default=n,t.exports=e.default},1350(t,e,n){e.__esModule=!0;var r,i=n(3769),o=(r=i)&&r.__esModule?r:{default:r};function s(){this.parents=[]}function a(t){this.acceptRequired(t,"path"),this.acceptArray(t.params),this.acceptKey(t,"hash")}function u(t){a.call(this,t),this.acceptKey(t,"program"),this.acceptKey(t,"inverse")}function c(t){this.acceptRequired(t,"name"),this.acceptArray(t.params),this.acceptKey(t,"hash")}s.prototype={constructor:s,mutating:!1,acceptKey:function(t,e){var n=this.accept(t[e]);if(this.mutating){if(n&&!s.prototype[n.type])throw new o.default('Unexpected node type "'+n.type+'" found when accepting '+e+" on "+t.type);t[e]=n}},acceptRequired:function(t,e){if(this.acceptKey(t,e),!t[e])throw new o.default(t.type+" requires "+e)},acceptArray:function(t){for(var e=0,n=t.length;e<n;e++)this.acceptKey(t,e),t[e]||(t.splice(e,1),e--,n--)},accept:function(t){if(t){if(!this[t.type])throw new o.default("Unknown type: "+t.type,t);this.current&&this.parents.unshift(this.current),this.current=t;var e=this[t.type](t);return this.current=this.parents.shift(),!this.mutating||e?e:!1!==e?t:void 0}},Program:function(t){this.acceptArray(t.body)},MustacheStatement:a,Decorator:a,BlockStatement:u,DecoratorBlock:u,PartialStatement:c,PartialBlockStatement:function(t){c.call(this,t),this.acceptKey(t,"program")},ContentStatement:function(){},CommentStatement:function(){},SubExpression:a,PathExpression:function(){},StringLiteral:function(){},NumberLiteral:function(){},BooleanLiteral:function(){},UndefinedLiteral:function(){},NullLiteral:function(){},Hash:function(t){this.acceptArray(t.pairs)},HashPair:function(t){this.acceptRequired(t,"value")}},e.default=s,t.exports=e.default},915(t,e,n){e.__esModule=!0;var r,i=n(1350),o=(r=i)&&r.__esModule?r:{default:r};function s(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.options=t}function a(t,e,n){void 0===e&&(e=t.length);var r=t[e-1],i=t[e-2];return r?"ContentStatement"===r.type?(i||!n?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(r.original):void 0:n}function u(t,e,n){void 0===e&&(e=-1);var r=t[e+1],i=t[e+2];return r?"ContentStatement"===r.type?(i||!n?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(r.original):void 0:n}function c(t,e,n){var r=t[null==e?0:e+1];if(r&&"ContentStatement"===r.type&&(n||!r.rightStripped)){var i=r.value;r.value=r.value.replace(n?/^\s+/:/^[ \t]*\r?\n?/,""),r.rightStripped=r.value!==i}}function l(t,e,n){var r=t[null==e?t.length-1:e-1];if(r&&"ContentStatement"===r.type&&(n||!r.leftStripped)){var i=r.value;return r.value=r.value.replace(n?/\s+$/:/[ \t]+$/,""),r.leftStripped=r.value!==i,r.leftStripped}}s.prototype=new o.default,s.prototype.Program=function(t){var e=!this.options.ignoreStandalone,n=!this.isRootSeen;this.isRootSeen=!0;for(var r=t.body,i=0,o=r.length;i<o;i++){var s=r[i],h=this.accept(s);if(h){var d=a(r,i,n),p=u(r,i,n),f=h.openStandalone&&d,m=h.closeStandalone&&p,g=h.inlineStandalone&&d&&p;h.close&&c(r,i,!0),h.open&&l(r,i,!0),e&&g&&(c(r,i),l(r,i)&&"PartialStatement"===s.type&&(s.indent=/([ \t]+$)/.exec(r[i-1].original)[1])),e&&f&&(c((s.program||s.inverse).body),l(r,i)),e&&m&&(c(r,i),l((s.inverse||s.program).body))}}return t},s.prototype.BlockStatement=s.prototype.DecoratorBlock=s.prototype.PartialBlockStatement=function(t){this.accept(t.program),this.accept(t.inverse);var e=t.program||t.inverse,n=t.program&&t.inverse,r=n,i=n;if(n&&n.chained)for(r=n.body[0].program;i.chained;)i=i.body[i.body.length-1].program;var o={open:t.openStrip.open,close:t.closeStrip.close,openStandalone:u(e.body),closeStandalone:a((r||e).body)};if(t.openStrip.close&&c(e.body,null,!0),n){var s=t.inverseStrip;s.open&&l(e.body,null,!0),s.close&&c(r.body,null,!0),t.closeStrip.open&&l(i.body,null,!0),!this.options.ignoreStandalone&&a(e.body)&&u(r.body)&&(l(e.body),c(r.body))}else t.closeStrip.open&&l(e.body,null,!0);return o},s.prototype.Decorator=s.prototype.MustacheStatement=function(t){return t.strip},s.prototype.PartialStatement=s.prototype.CommentStatement=function(t){var e=t.strip||{};return{inlineStandalone:!0,open:e.open,close:e.close}},e.default=s,t.exports=e.default},5940(t,e,n){e.__esModule=!0,e.registerDefaultDecorators=function(t){o.default(t)};var r,i=n(7430),o=(r=i)&&r.__esModule?r:{default:r}},7430(t,e,n){e.__esModule=!0;var r=n(2849);e.default=function(t){t.registerDecorator("inline",function(t,e,n,i){var o=t;return e.partials||(e.partials={},o=function(i,o){var s=n.partials;n.partials=r.extend({},s,e.partials);var a=t(i,o);return n.partials=s,a}),e.partials[i.args[0]]=i.fn,o})},t.exports=e.default},3769(t,e){e.__esModule=!0;var n=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function r(t,e){var i=e&&e.loc,o=void 0,s=void 0,a=void 0,u=void 0;i&&(o=i.start.line,s=i.end.line,a=i.start.column,u=i.end.column,t+=" - "+o+":"+a);for(var c=Error.prototype.constructor.call(this,t),l=0;l<n.length;l++)this[n[l]]=c[n[l]];Error.captureStackTrace&&Error.captureStackTrace(this,r);try{i&&(this.lineNumber=o,this.endLineNumber=s,Object.defineProperty?(Object.defineProperty(this,"column",{value:a,enumerable:!0}),Object.defineProperty(this,"endColumn",{value:u,enumerable:!0})):(this.column=a,this.endColumn=u))}catch(t){}}r.prototype=new Error,e.default=r,t.exports=e.default},2277(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.registerDefaultHelpers=function(t){i.default(t),o.default(t),s.default(t),a.default(t),u.default(t),c.default(t),l.default(t)},e.moveHelperToHooks=function(t,e,n){t.helpers[e]&&(t.hooks[e]=t.helpers[e],n||delete t.helpers[e])};var i=r(n(6097)),o=r(n(6785)),s=r(n(4353)),a=r(n(2355)),u=r(n(5300)),c=r(n(7466)),l=r(n(908))},6097(t,e,n){e.__esModule=!0;var r=n(2849);e.default=function(t){t.registerHelper("blockHelperMissing",function(e,n){var i=n.inverse,o=n.fn;if(!0===e)return o(this);if(!1===e||null==e)return i(this);if(r.isArray(e))return e.length>0?(n.ids&&(n.ids=[n.name]),t.helpers.each(e,n)):i(this);if(n.data&&n.ids){var s=r.createFrame(n.data);s.contextPath=r.appendContextPath(n.data.contextPath,n.name),n={data:s}}return o(e,n)})},t.exports=e.default},6785(t,e,n){e.__esModule=!0;var r,i=n(2849),o=n(3769),s=(r=o)&&r.__esModule?r:{default:r};e.default=function(t){t.registerHelper("each",function(t,e){if(!e)throw new s.default("Must pass iterator to #each");var n,r=e.fn,o=e.inverse,a=0,u="",c=void 0,l=void 0;function h(e,n,o){c&&(c.key=e,c.index=n,c.first=0===n,c.last=!!o,l&&(c.contextPath=l+e)),u+=r(t[e],{data:c,blockParams:i.blockParams([t[e],e],[l+e,null])})}if(e.data&&e.ids&&(l=i.appendContextPath(e.data.contextPath,e.ids[0])+"."),i.isFunction(t)&&(t=t.call(this)),e.data&&(c=i.createFrame(e.data)),t&&"object"==typeof t)if(i.isArray(t))for(var d=t.length;a<d;a++)a in t&&h(a,a,a===t.length-1);else if("function"==typeof Symbol&&t[Symbol.iterator]){for(var p=[],f=t[Symbol.iterator](),m=f.next();!m.done;m=f.next())p.push(m.value);for(d=(t=p).length;a<d;a++)h(a,a,a===t.length-1)}else n=void 0,Object.keys(t).forEach(function(t){void 0!==n&&h(n,a-1),n=t,a++}),void 0!==n&&h(n,a-1,!0);return 0===a&&(u=o(this)),u})},t.exports=e.default},4353(t,e,n){e.__esModule=!0;var r,i=n(3769),o=(r=i)&&r.__esModule?r:{default:r};e.default=function(t){t.registerHelper("helperMissing",function(){if(1!==arguments.length)throw new o.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})},t.exports=e.default},2355(t,e,n){e.__esModule=!0;var r,i=n(2849),o=n(3769),s=(r=o)&&r.__esModule?r:{default:r};e.default=function(t){t.registerHelper("if",function(t,e){if(2!=arguments.length)throw new s.default("#if requires exactly one argument");return i.isFunction(t)&&(t=t.call(this)),!e.hash.includeZero&&!t||i.isEmpty(t)?e.inverse(this):e.fn(this)}),t.registerHelper("unless",function(e,n){if(2!=arguments.length)throw new s.default("#unless requires exactly one argument");return t.helpers.if.call(this,e,{fn:n.inverse,inverse:n.fn,hash:n.hash})})},t.exports=e.default},5300(t,e){e.__esModule=!0,e.default=function(t){t.registerHelper("log",function(){for(var e=[void 0],n=arguments[arguments.length-1],r=0;r<arguments.length-1;r++)e.push(arguments[r]);var i=1;null!=n.hash.level?i=n.hash.level:n.data&&null!=n.data.level&&(i=n.data.level),e[0]=i,t.log.apply(t,e)})},t.exports=e.default},7466(t,e){e.__esModule=!0,e.default=function(t){t.registerHelper("lookup",function(t,e,n){return t?n.lookupProperty(t,e):t})},t.exports=e.default},908(t,e,n){e.__esModule=!0;var r,i=n(2849),o=n(3769),s=(r=o)&&r.__esModule?r:{default:r};e.default=function(t){t.registerHelper("with",function(t,e){if(2!=arguments.length)throw new s.default("#with requires exactly one argument");i.isFunction(t)&&(t=t.call(this));var n=e.fn;if(i.isEmpty(t))return e.inverse(this);var r=e.data;return e.data&&e.ids&&((r=i.createFrame(e.data)).contextPath=i.appendContextPath(e.data.contextPath,e.ids[0])),n(t,{data:r,blockParams:i.blockParams([t],[r&&r.contextPath])})})},t.exports=e.default},9726(t,e,n){e.__esModule=!0,e.createNewLookupObject=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return r.extend.apply(void 0,[Object.create(null)].concat(e))};var r=n(2849)},3865(t,e,n){e.__esModule=!0,e.createProtoAccessControl=function(t){var e=Object.create(null);e.constructor=!1,e.__defineGetter__=!1,e.__defineSetter__=!1,e.__lookupGetter__=!1;var n=Object.create(null);return n.__proto__=!1,{properties:{whitelist:i.createNewLookupObject(n,t.allowedProtoProperties),defaultValue:t.allowProtoPropertiesByDefault},methods:{whitelist:i.createNewLookupObject(e,t.allowedProtoMethods),defaultValue:t.allowProtoMethodsByDefault}}},e.resultIsAllowed=function(t,e,n){return u("function"==typeof t?e.methods:e.properties,n)},e.resetLoggedProperties=function(){Object.keys(a).forEach(function(t){delete a[t]})};var r,i=n(9726),o=n(566),s=(r=o)&&r.__esModule?r:{default:r},a=Object.create(null);function u(t,e){return void 0!==t.whitelist[e]?!0===t.whitelist[e]:void 0!==t.defaultValue?t.defaultValue:(function(t){!0!==a[t]&&(a[t]=!0,s.default.log("error",'Handlebars: Access has been denied to resolve the property "'+t+'" because it is not an "own property" of its parent.\nYou can add a runtime option to disable the check or this warning:\nSee https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'))}(e),!1)}},2614(t,e){e.__esModule=!0,e.wrapHelper=function(t,e){if("function"!=typeof t)return t;return function(){return arguments[arguments.length-1]=e(arguments[arguments.length-1]),t.apply(this,arguments)}}},566(t,e,n){e.__esModule=!0;var r=n(2849),i={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(t){if("string"==typeof t){var e=r.indexOf(i.methodMap,t.toLowerCase());t=e>=0?e:parseInt(t,10)}return t},log:function(t){if(t=i.lookupLevel(t),"undefined"!=typeof console&&i.lookupLevel(i.level)<=t){var e=i.methodMap[t];console[e]||(e="log");for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o]}}};e.default=i,t.exports=e.default},1148(t,e){e.__esModule=!0,e.default=function(t){"object"!=typeof globalThis&&(Object.prototype.__defineGetter__("__magic__",function(){return this}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__);var e=globalThis.Handlebars;t.noConflict=function(){return globalThis.Handlebars===t&&(globalThis.Handlebars=e),t}},t.exports=e.default},7624(t,e,n){e.__esModule=!0,e.checkRevision=function(t){var e=t&&t[0]||1,n=a.COMPILER_REVISION;if(e>=a.LAST_COMPATIBLE_COMPILER_REVISION&&e<=a.COMPILER_REVISION)return;if(e<a.LAST_COMPATIBLE_COMPILER_REVISION){var r=a.REVISION_CHANGES[n],i=a.REVISION_CHANGES[e];throw new s.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+r+") or downgrade your runtime to an older version ("+i+").")}throw new s.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+t[1]+").")},e.template=function(t,e){if(!e)throw new s.default("No environment passed to template");if(!t||!t.main)throw new s.default("Unknown template object: "+typeof t);t.main.decorator=t.main_d,e.VM.checkRevision(t.compiler);var n=t.compiler&&7===t.compiler[0];var r={strict:function(t,e,n){if(!t||!(e in t))throw new s.default('"'+e+'" not defined in '+t,{loc:n});return r.lookupProperty(t,e)},lookupProperty:function(t,e){var n=t[e];return null==n||Object.prototype.hasOwnProperty.call(t,e)||l.resultIsAllowed(n,r.protoAccessControl,e)?n:void 0},lookup:function(t,e){for(var n=t.length,i=0;i<n;i++){if(null!=(t[i]&&r.lookupProperty(t[i],e)))return t[i][e]}},lambda:function(t,e){return"function"==typeof t?t.call(e):t},escapeExpression:i.escapeExpression,invokePartial:function(n,r,o){o.hash&&(r=i.extend({},r,o.hash),o.ids&&(o.ids[0]=!0)),n=e.VM.resolvePartial.call(this,n,r,o);var a=i.extend({},o,{hooks:this.hooks,protoAccessControl:this.protoAccessControl}),u=e.VM.invokePartial.call(this,n,r,a);if(null==u&&e.compile&&(o.partials[o.name]=e.compile(n,t.compilerOptions,e),u=o.partials[o.name](r,a)),null!=u){if(o.indent){for(var c=u.split("\n"),l=0,h=c.length;l<h&&(c[l]||l+1!==h);l++)c[l]=o.indent+c[l];u=c.join("\n")}return u}throw new s.default("The partial "+o.name+" could not be compiled when running in runtime-only mode")},fn:function(e){var n=t[e];return n.decorator=t[e+"_d"],n},programs:[],program:function(t,e,n,r,i){var o=this.programs[t],s=this.fn(t);return e||i||r||n?o=h(this,t,s,e,n,r,i):o||(o=this.programs[t]=h(this,t,s)),o},data:function(t,e){for(;t&&e--;)t=t._parent;return t},mergeIfNeeded:function(t,e){var n=t||e;return t&&e&&t!==e&&(n=i.extend({},e,t)),n},nullContext:Object.seal({}),noop:e.VM.noop,compilerInfo:t.compiler};function o(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=n.data;o._setup(n),!n.partial&&t.useData&&(i=function(t,e){e&&"root"in e||((e=e?a.createFrame(e):{}).root=t);return e}(e,i));var s=void 0,u=t.useBlockParams?[]:void 0;function c(e){return""+t.main(r,e,r.helpers,r.partials,i,u,s)}return t.useDepths&&(s=n.depths?e!=n.depths[0]?[e].concat(n.depths):n.depths:[e]),(c=p(t.main,c,r,n.depths||[],i,u))(e,n)}return o.isTop=!0,o._setup=function(o){if(o.partial)r.protoAccessControl=o.protoAccessControl,r.helpers=o.helpers,r.partials=o.partials,r.decorators=o.decorators,r.hooks=o.hooks;else{var s=i.extend({},e.helpers,o.helpers);!function(t,e){Object.keys(t).forEach(function(n){var r=t[n];t[n]=function(t,e){var n=e.lookupProperty;return c.wrapHelper(t,function(t){return i.extend({lookupProperty:n},t)})}(r,e)})}(s,r),r.helpers=s,t.usePartial&&(r.partials=r.mergeIfNeeded(o.partials,e.partials)),(t.usePartial||t.useDecorators)&&(r.decorators=i.extend({},e.decorators,o.decorators)),r.hooks={},r.protoAccessControl=l.createProtoAccessControl(o);var a=o.allowCallsToHelperMissing||n;u.moveHelperToHooks(r,"helperMissing",a),u.moveHelperToHooks(r,"blockHelperMissing",a)}},o._child=function(e,n,i,o){if(t.useBlockParams&&!i)throw new s.default("must pass block params");if(t.useDepths&&!o)throw new s.default("must pass parent depths");return h(r,e,t[e],n,0,i,o)},o},e.wrapProgram=h,e.resolvePartial=function(t,e,n){t?t.call||n.name||(n.name=t,t=n.partials[t]):t="@partial-block"===n.name?n.data["partial-block"]:n.partials[n.name];return t},e.invokePartial=function(t,e,n){var r=n.data&&n.data["partial-block"];n.partial=!0,n.ids&&(n.data.contextPath=n.ids[0]||n.data.contextPath);var o=void 0;n.fn&&n.fn!==d&&function(){n.data=a.createFrame(n.data);var t=n.fn;o=n.data["partial-block"]=function(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return n.data=a.createFrame(n.data),n.data["partial-block"]=r,t(e,n)},t.partials&&(n.partials=i.extend({},n.partials,t.partials))}();void 0===t&&o&&(t=o);if(void 0===t)throw new s.default("The partial "+n.name+" could not be found");if(t instanceof Function)return t(e,n)},e.noop=d;var r,i=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2849)),o=n(3769),s=(r=o)&&r.__esModule?r:{default:r},a=n(2871),u=n(2277),c=n(2614),l=n(3865);function h(t,e,n,r,i,o,s){function a(e){var i=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],a=s;return!s||e==s[0]||e===t.nullContext&&null===s[0]||(a=[e].concat(s)),n(t,e,t.helpers,t.partials,i.data||r,o&&[i.blockParams].concat(o),a)}return(a=p(n,a,t,s,r,o)).program=e,a.depth=s?s.length:0,a.blockParams=i||0,a}function d(){return""}function p(t,e,n,r,o,s){if(t.decorator){var a={};e=t.decorator(e,a,n,r&&r[0],o,s,r),i.extend(e,a)}return e}},9613(t,e){function n(t){this.string=t}e.__esModule=!0,n.prototype.toString=n.prototype.toHTML=function(){return""+this.string},e.default=n,t.exports=e.default},2849(t,e){e.__esModule=!0,e.extend=s,e.indexOf=function(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1},e.escapeExpression=function(t){if("string"!=typeof t){if(t&&t.toHTML)return t.toHTML();if(null==t)return"";if(!t)return t+"";t=""+t}if(!i.test(t))return t;return t.replace(r,o)},e.isEmpty=function(t){return!t&&0!==t||!(!c(t)||0!==t.length)},e.createFrame=function(t){var e=s({},t);return e._parent=t,e},e.blockParams=function(t,e){return t.path=e,t},e.appendContextPath=function(t,e){return(t?t+".":"")+e};var n={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;","=":"&#x3D;"},r=/[&<>"'`=]/g,i=/[&<>"'`=]/;function o(t){return n[t]}function s(t){for(var e=1;e<arguments.length;e++)for(var n in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],n)&&(t[n]=arguments[e][n]);return t}var a=Object.prototype.toString;e.toString=a;var u=function(t){return"function"==typeof t};u(/x/)&&(e.isFunction=u=function(t){return"function"==typeof t&&"[object Function]"===a.call(t)}),e.isFunction=u;var c=Array.isArray||function(t){return!(!t||"object"!=typeof t)&&"[object Array]"===a.call(t)};e.isArray=c},251(t,e){e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,h=n?i-1:0,d=n?-1:1,p=t[e+h];for(h+=d,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+t[e+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+t[e+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=c}return(p?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(e*u-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+p]=255&a,p+=f,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[n+p]=255&s,p+=f,s/=256,c-=8);t[n+p-f]|=128*m}},6655(t){t.exports=void 0},4106(t,e){function n(t,e){var n=[],r=[];return null==e&&(e=function(t,e){return n[0]===e?"[Circular ~]":"[Circular ~."+r.slice(0,n.indexOf(e)).join(".")+"]"}),function(i,o){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?r.splice(s,1/0,i):r.push(i),~n.indexOf(o)&&(o=e.call(this,i,o))}else n.push(o);return null==t?o:t.call(this,i,o)}}(t.exports=function(t,e,r,i){return JSON.stringify(t,n(e,i),r)}).getSerialize=n},7799(t,e,n){t.exports=function(){var e,r,i,o,s,a="undefined"==typeof window?n.g:window,u="1.9.6",c=Date.now||function(){return(new Date).getTime()},l=c(),h="undefined"!=typeof performance&&performance.now?function(){return performance.now()}:function(){return c()-l},d=function(t){setTimeout(t,0)};function p(){}function f(t){return"function"==typeof t}function m(){this._orig=this,this._ready=!1,this._queue=[],this._log=[]}function g(t,e){this._bad?f(e)&&e.apply(this,[new Error(this._err())]):f(t)&&t.apply(this,[this])}function _(t,e){this._bad?t._crash(this._err()):setTimeout(function(){t._resume()},e)}function y(t){this._bad&&t._break(this._err()),t._resume()}function v(t,e,n){t[n]=function(){var t=arguments,r=e._image();return this._push(y,[r]),r[n].apply(r,t)}}function b(t){this._bad||f(t)&&t.apply(this)}function w(t){this._bad&&f(t)&&t.apply(this)}function x(t){this._bad?t._crash(this._err()):(this._break("Closed"),t._resume())}function T(t){if(t.length){var e=t.shift();if(t.length){var n=this;this._slip(w,[function(){T.apply(n,[t])}])}try{this._repair(),e.apply(this)}catch(t){this._break(t.toString())}}else this._break()}function k(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return;t.push(e)}function S(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return void t.splice(n,1)}function A(){m.apply(this)}function E(t,e){for(var n in t)t.hasOwnProperty(n)&&e.call(this,n)}function O(t,e,n){if(void 0===e)return O(t,[],[]);if(t instanceof Object){for(var r=0;r<e.length;r++)if(e[r]===t)return n[r];var i;return i=t instanceof Array?[]:{},e.push(t),n.push(i),E(t,function(r){i[r]=O(t[r],e,n)}),i}return t}m.prototype._exec=function(){for(;this._ready&&this._queue.length;){var t=this._queue.shift();t[0].apply(this,t[1])}},m.prototype._push=function(t,e){this._queue.push([t,e]),m.prototype._exec.apply(this)},m.prototype._slip=function(t,e){this._queue.unshift([t,e])},m.prototype._pause=function(){this._ready=!1},m.prototype._resume=function(){this._ready=!0,m.prototype._exec.apply(this)},m.prototype._break=function(t){this._orig._bad=!0,this._orig._log.push(t||"Unknown JZZ error")},m.prototype._repair=function(){this._orig._bad=!1},m.prototype._crash=function(t){this._break(t),this._resume()},m.prototype._err=function(){return this._log[this._log.length-1]},m.prototype.log=function(){return O(this._log)},m.prototype._dup=function(){var t=function(){};t.prototype=this._orig;var e=new t;return e._ready=!1,e._queue=[],e},m.prototype._image=function(){return this._dup()},m.prototype._thenable=function(){if(this.then)return this;var t=this,e=function(){};e.prototype=t;var n=new e;return n.then=function(e,n){return t._push(g,[e,n]),this},n},m.prototype.wait=function(t){if(!t)return this;var e=this._image();return this._push(_,[e,t]),e._thenable()},m.prototype.and=function(t){return this._push(b,[t]),this._thenable()},m.prototype.or=function(t){return this._push(w,[t]),this._thenable()},m.prototype._info={},m.prototype.info=function(){var t=O(this._orig._info);return void 0===t.engine&&(t.engine="none"),void 0===t.sysex&&(t.sysex=!0),t},m.prototype.name=function(){return this.info().name},m.prototype.close=function(){var t=new m;return this._close&&this._push(this._close,[]),this._push(x,[t]),t._thenable()},A.prototype=new m,A.prototype._info={name:"JZZ.js",ver:u,version:u,inputs:[],outputs:[]};var C,M=[],N=[],I=[],j=[],R={},P={};function D(){var t,e;for(C._info.engine=at._type,C._info.version=at._version,C._info.sysex=at._sysex,C._info.inputs=[],C._info.outputs=[],M=[],N=[],at._allOuts={},at._allIns={},t=0;t<at._outs.length;t++)e=at._outs[t],R[e.name]||(e.engine=at,at._allOuts[e.name]=e,C._info.outputs.push({id:e.name,name:e.name,manufacturer:e.manufacturer,version:e.version,engine:at._type}),M.push(e));for(t=0;t<ut._outs.length;t++)e=ut._outs[t],R[e.name]||(C._info.outputs.push({id:e.name,name:e.name,manufacturer:e.manufacturer,version:e.version,engine:e.type}),M.push(e));for(t=0;t<at._ins.length;t++)e=at._ins[t],P[e.name]||(e.engine=at,at._allIns[e.name]=e,C._info.inputs.push({id:e.name,name:e.name,manufacturer:e.manufacturer,version:e.version,engine:at._type}),N.push(e));for(t=0;t<ut._ins.length;t++)e=ut._ins[t],P[e.name]||(C._info.inputs.push({id:e.name,name:e.name,manufacturer:e.manufacturer,version:e.version,engine:e.type}),N.push(e));if(C._watcher&&C._watcher._handles.length){var n=rt(j,I,C._info.inputs,C._info.outputs);if(n){for(r=0;r<n.inputs.removed.length;r++)(e=at._inMap[n.inputs.removed[r].name])&&e._closeAll();for(r=0;r<n.outputs.removed.length;r++)(e=at._outMap[n.outputs.removed[r].name])&&e._closeAll();d(function(){it(n)})}}j=C._info.inputs,I=C._info.outputs}function L(){this._bad||at._refresh(this)}function F(t,e){var n,r;f(t)&&(t=t(e)),t instanceof Array||(t=[t]);var i=[],o=[],s=e.slice(),a=i;for(n=0;n<t.length;n++)if(void 0===t[n])a=o;else if(t[n]instanceof RegExp)for(r=0;r<s.length;r++)t[n].test(s[r].name)&&(a.push(s[r]),s.splice(r,1),r--);else for(r=0;r<s.length;r++)(t[n]+""==r+""||t[n]===s[r].name||t[n]instanceof Object&&t[n].name===s[r].name)&&(a.push(s[r]),s.splice(r,1),r--);return a==i?i:i.concat(s).concat(o)}function $(t,e){var n;n=e instanceof RegExp?"Port matching "+e+" not found":e instanceof Object||void 0===e?"Port not found":'Port "'+e+'" not found',t._crash(n)}function B(t,e){if(this._bad)t._crash(this._err());else{var n=F(e,M);if(!n.length)return void $(t,e);for(var r=function(t){return function(){t.engine._openOut(this,t.name)}},i=0;i<n.length;i++)n[i]=r(n[i]);t._slip(T,[n]),t._resume()}}function q(t,e){if(this._bad)t._crash(this._err());else{var n=F(e,N);if(!n.length)return void $(t,e);for(var r=function(t){return function(){t.engine._openIn(this,t.name)}},i=0;i<n.length;i++)n[i]=r(n[i]);t._slip(T,[n]),t._resume()}}function U(t,e){this._bad?t._crash():(t._slip(tt,[e]),t._resume())}function V(){m.apply(this),this._handles=[],this._outs=[]}function G(t){this._bad||this._receive(t)}function z(t){return t.isMidi2?new Xe(t):Pt.apply(null,arguments)}function W(t){this._emit(t)}function J(t){f(t)?k(this._orig._handles,t):k(this._orig._outs,t)}function H(t){void 0===t?(this._orig._handles=[],this._orig._outs=[]):f(t)?S(this._orig._handles,t):S(this._orig._outs,t)}function X(t,e){this._orig._mpe||(this._orig._mpe=new He),this._orig._mpe.setup(t,e)}function K(t){if(t!=parseInt(t)||t<0||t>15)throw RangeError("Bad channel value (must not be less than 0 or more than 15): "+t)}function Q(t){m.apply(this),this._sink=t}function Z(t){return t.isMidi&&!t.isMidi2?new Pt(t):Xe.apply(null,arguments)}function Y(){m.apply(this),this._handles=[],v(this,C,"refresh"),v(this,C,"openMidiOut"),v(this,C,"openMidiIn"),v(this,C,"onChange"),v(this,C,"close")}function tt(t){f(t)&&(this._orig._handles.length||at._watch(),k(this._orig._handles,t))}function et(t){void 0===t?this._orig._handles=[]:S(this._orig._handles,t),this._orig._handles.length||at._unwatch()}function nt(t,e,n,r){var i;if(t.length!=n.length||e.length!=r.length)return!0;for(i=0;i<t.length;i++)if(t[i].name!=n[i].name)return!0;for(i=0;i<e.length;i++)if(e[i].name!=r[i].name)return!0;return!1}function rt(t,e,n,r){if(nt(t,e,n,r)){var i,o=[],s=[],a=[],u=[],c={};for(i=0;i<t.length;i++)c[t[i].name]=!0;for(i=0;i<n.length;i++)c[n[i].name]||o.push(n[i]);for(c={},i=0;i<n.length;i++)c[n[i].name]=!0;for(i=0;i<t.length;i++)c[t[i].name]||a.push(t[i]);for(c={},i=0;i<e.length;i++)c[e[i].name]=!0;for(i=0;i<r.length;i++)c[r[i].name]||s.push(r[i]);for(c={},i=0;i<r.length;i++)c[r[i].name]=!0;for(i=0;i<e.length;i++)c[e[i].name]||u.push(e[i]);return{inputs:{added:o,removed:a},outputs:{added:s,removed:u}}}}function it(t){for(e=0;e<C._watcher._handles.length;e++)C._watcher._handles[e].apply(C,[t])}A.prototype.refresh=function(){return this._push(L,[]),this._thenable()},A.prototype.openMidiOut=function(t){var e=new V;return this._push(L,[]),this._push(B,[e,t]),e._thenable()},A.prototype._openMidiOutNR=function(t){var e=new V;return this._push(B,[e,t]),e._thenable()},A.prototype.openMidiIn=function(t){var e=new V;return this._push(L,[]),this._push(q,[e,t]),e._thenable()},A.prototype._openMidiInNR=function(t){var e=new V;return this._push(q,[e,t]),e._thenable()},A.prototype.onChange=function(t){this._orig._watcher||(this._orig._watcher=new Y);var e=this._orig._watcher._image();return this._push(U,[e,t]),e._thenable()},A.prototype._close=function(){at._close();for(var t=ct.slice(),e=0;e<t.length;e++)t[e]&&(t[e]._close?t[e]._close():t[e].close&&t[e].close())},V.prototype=new m,V.prototype._filter=function(t){if(this._orig._mpe){var e,n=0;this._handles&&this._handles.length&&(n=this._handles.length,e=this._handles[0]),this._outs&&this._outs.length&&(n=this._outs.length,e=this._outs[0]),1!=n||e._mpe||(t=this._orig._mpe.filter(t))}return t},V.prototype._receive=function(t){this._emit(this._filter(t))},V.prototype.send=function(){return this._push(G,[z.apply(null,arguments)]),this._thenable()},V.prototype.note=function(t,e,n,r){return this.noteOn(t,e,n),void 0===this._ch&&void 0===this._master?r>0&&this.wait(r).noteOff(t,e):n>0&&this.wait(n).noteOff(t),this._thenable()},V.prototype._emit=function(t){var e,n;for(e=0;e<this._handles.length;e++)n=z(t),this._handles[e].apply(this,[n._stamp(this)]);for(e=0;e<this._outs.length;e++)(n=z(t))._stamped(this._outs[e])||this._outs[e].send(n._stamp(this))},V.prototype.emit=function(t){return this._push(W,[t]),this._thenable()},V.prototype.connect=function(t){return this._push(J,[t]),this._thenable()},V.prototype.disconnect=function(t){return this._push(H,[t]),this._thenable()},V.prototype.connected=function(){return this._orig._handles.length+this._orig._outs.length},V.prototype._image=function(){var t=this._dup();return t._gr=this._gr,t._ch=this._ch,t._sxid=this._sxid,t._master=this._master,t._band=this._band,t},V.prototype._sxid=127,V.prototype.sxId=function(t){if(void 0===t&&(t=V.prototype._sxid),t==this._sxid)return this._thenable();t=zt(t);var e=this._image();return e._sxid=t,this._push(y,[e]),e._thenable()},V.prototype.ch=function(t){if(t==this._ch||void 0===t&&void 0===this._ch)return this._thenable();var e=this._image();return void 0!==t&&(t=Vt(t)),e._ch=t,e._master=void 0,e._band=void 0,this._push(y,[e]),e._thenable()},V.prototype.MIDI1=function(){var t=this._image();return t._ch=void 0,t._sxid=V.prototype._sxid,t._master=void 0,t._band=void 0,this._push(y,[t]),t._thenable()},V.prototype.MIDI2=function(){var t=this._image();t._ch=void 0,t._sxid=V.prototype._sxid,t._master=void 0,t._band=void 0;var e=new Q(t);return this._push(y,[e]),e._thenable()},V.prototype.mpe=function(t,e){if(t==this._master&&e==this._band||void 0===t&&void 0===this._master)return this._thenable();if(void 0!==t&&He.validate(t,e),!e)return this.ch(t);var n=this._image();return n._ch=void 0,n._master=t,n._band=e,this._push(X,[t,e]),this._push(y,[n]),n._thenable()},Q.prototype=new m,Q.prototype._sxid=V.prototype._sxid,Q.prototype._receive=function(t){this._sink._receive(t)},Q.prototype.send=function(){return this._push(G,[Z.apply(null,arguments)]),this._thenable()},Q.prototype._image=V.prototype._image,Q.prototype.connect=function(t){return this._sink.connect(t),this._push(y,[this._sink]),this._thenable()},Q.prototype.disconnect=function(t){return this._sink.disconnect(t),this._push(y,[this._sink]),this._thenable()},Q.prototype.connected=function(){return this._sink.connected()},Q.prototype.sxId=V.prototype.sxId,Q.prototype.ch=V.prototype.ch,Q.prototype.gr=function(t){if(t==this._gr||void 0===t&&void 0===this._gr)return this._thenable();var e=this._image();return void 0!==t&&(t=zt(t)),e._gr=t,this._push(y,[e]),e._thenable()},Q.prototype.MIDI1=function(){var t=this._sink._image();return this._push(y,[t]),t._thenable()},Q.prototype.MIDI2=function(){var t=this._image();return t._gr=void 0,t._ch=void 0,t._sxid=V.prototype._sxid,this._push(y,[t]),t._thenable()},Y.prototype=new m,Y.prototype.connect=function(t){return this._push(tt,[t]),this._thenable()},Y.prototype.disconnect=function(t){return this._push(et,[t]),this._thenable()};var ot,st,at={_outs:[],_ins:[],_close:p},ut={_outs:[],_ins:[]},ct=[];function lt(){if(t.exports){var e=n(6655);if(e)return void xt(e)}this._break()}function ht(){var t=document.createElement("div");t.style.visibility="hidden",document.body.appendChild(t);var e=document.createElement("object");e.style.visibility="hidden",e.style.width="0px",e.style.height="0px",e.classid="CLSID:1ACE1618-1C7D-4561-AEE1-34842AA85E90",e.type="audio/x-jazz",document.body.appendChild(e),e.isJazz?Tt(e):this._break()}function dt(){if("undefined"!=typeof navigator&&navigator.requestMIDIAccess){ot=navigator,st=navigator.requestMIDIAccess;try{-1!=st.toString().indexOf("JZZ(")&&(st=void 0)}catch(t){}}}function pt(){if(dt(),st){var t=this,e=function(e){kt(e),t._resume()},n=function(e){t._crash(e)},r={};return st.call(ot,r).then(e,n),void this._pause()}this._break()}function ft(){if(dt(),st){var t=this,e=function(e){kt(e,!0),t._resume()},n=function(e){t._crash(e)},r={sysex:!0};return st.call(ot,r).then(e,n),void this._pause()}this._break()}function mt(){var t,e,n=this;function r(i){t=!0;var o=i.detail;if(!o){if(e||(e=document.getElementById("jazz-midi-msg")),!e)return;try{o=JSON.parse(e.innerText)}catch(t){}e.innerText=""}document.removeEventListener("jazz-midi-msg",r),o&&"version"===o[0]?(St(e,o[2]),n._resume()):n._crash()}this._pause();try{document.addEventListener("jazz-midi-msg",r),document.dispatchEvent(new Event("jazz-midi"))}catch(t){}setTimeout(function(){t||n._crash()},50)}function gt(){this._pause();var t=this;d(function(){t._crash()})}function _t(t){for(var e=[],n=yt(t),r=0;r<n.length;r++)"webmidi"==n[r]?(t&&!0===t.sysex&&e.push(ft),t&&!0===t.sysex&&!0!==t.degrade||e.push(pt)):"node"==n[r]?(e.push(lt),e.push(gt)):"extension"==n[r]?e.push(mt):"plugin"==n[r]&&e.push(ht);return e.push(bt),e}function yt(t){var e=["node","extension","plugin","webmidi"];if(!t||!t.engine)return e;var n,r,i,o=t.engine instanceof Array?t.engine:[t.engine],s={},a=[],u=[];for(i=0;i<o.length;i++){var c=o[i].toString().toLowerCase();s[c]||(s[c]=!0,"none"===c&&(n=!0),"etc"!==c&&void 0!==c||(r=!0),r?u.push(c):a.push(c),S(e,c))}return(r||a.length||u.length)&&(n=!1),n?[]:a.concat(r?e:u)}function vt(t){(C=new A)._options=t,C._push(T,[_t(t)]),C.refresh(),C._resume()}function bt(){at._type="none",at._version=u,at._sysex=!0,at._outs=[],at._ins=[],at._outMap={},at._inMap={},at._refresh=function(){D()},at._watch=p,at._unwatch=p,at._close=p}function wt(){var t;function e(){for(var t=0;t<this.clients.length;t++)this._close(this.clients[t])}at._inArr=[],at._outArr=[],at._inMap={},at._outMap={},at._outsW=[],at._insW=[],at._version=at._main.version,at._sysex=!0,at._refresh=function(){var t,e;for(at._outs=[],at._ins=[],t=0;(e=at._main.MidiOutInfo(t)).length;t++)at._outs.push({type:at._type,name:e[0],manufacturer:e[1],version:e[2]});for(t=0;(e=at._main.MidiInInfo(t)).length;t++)at._ins.push({type:at._type,name:e[0],manufacturer:e[1],version:e[2]});D()},at._openOut=function(t,n){var r=at._outMap[n];if(!r){at._pool.length<=at._outArr.length&&at._pool.push(at._newPlugin()),r={name:n,clients:[],info:{name:n,manufacturer:at._allOuts[n].manufacturer,version:at._allOuts[n].version,type:"MIDI-out",sysex:at._sysex,engine:at._type},_close:function(t){at._closeOut(t)},_closeAll:e,_receive:function(t){t.length&&this.plugin.MidiOutRaw(t.slice())}};var i=at._pool[at._outArr.length];r.plugin=i,at._outArr.push(r),at._outMap[n]=r}if(!r.open){var o=r.plugin.MidiOutOpen(n);if(o!==n)return o&&r.plugin.MidiOutClose(),void t._break();r.open=!0}t._orig._impl=r,k(r.clients,t._orig),t._info=r.info,t._receive=function(t){r._receive(t)},t._close=function(){r._close(this)}},at._openIn=function(t,n){var r=at._inMap[n];if(!r){at._pool.length<=at._inArr.length&&at._pool.push(at._newPlugin()),r={name:n,clients:[],info:{name:n,manufacturer:at._allIns[n].manufacturer,version:at._allIns[n].version,type:"MIDI-in",sysex:at._sysex,engine:at._type},_close:function(t){at._closeIn(t)},_closeAll:e,handle:function(t,e){for(var n=0;n<this.clients.length;n++){var r=Pt(e);this.clients[n]._emit(r)}}};var i=function(t){return function(e,n){t.handle(e,n)}};r.onmidi=i(r);var o=at._pool[at._inArr.length];r.plugin=o,at._inArr.push(r),at._inMap[n]=r}if(!r.open){var s=r.plugin.MidiInOpen(n,r.onmidi);if(s!==n)return s&&r.plugin.MidiInClose(),void t._break();r.open=!0}t._orig._impl=r,k(r.clients,t._orig),t._info=r.info,t._close=function(){r._close(this)}},at._closeOut=function(t){var e=t._impl;S(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,e.plugin.MidiOutClose())},at._closeIn=function(t){var e=t._impl;S(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,e.plugin.MidiInClose())},at._close=function(){for(var t=0;t<at._inArr.length;t++)at._inArr[t].open&&at._inArr[t].plugin.MidiInClose();at._unwatch()},at._watch=function(){t||(t=setInterval(function(){at._refresh()},250))},at._unwatch=function(){t&&clearInterval(t),t=void 0}}function xt(t){at._type="node",at._main=t,at._pool=[],at._newPlugin=function(){return new t.MIDI},wt()}function Tt(t){at._type="plugin",at._main=t,at._pool=[t],at._newPlugin=function(){var e=document.createElement("object");return e.style.visibility="hidden",e.style.width="0px",t.style.height="0px",e.classid="CLSID:1ACE1618-1C7D-4561-AEE1-34842AA85E90",e.type="audio/x-jazz",document.body.appendChild(e),e.isJazz?e:void 0},wt()}function kt(t,e){var n;function r(){for(var t=0;t<this.clients.length;t++)this._close(this.clients[t])}at._type="webmidi",at._version=43,at._sysex=!!e,at._access=t,at._inMap={},at._outMap={},at._outsW=[],at._insW=[],at._refresh=function(){at._outs=[],at._ins=[],at._access.outputs.forEach(function(t){at._outs.push({type:at._type,name:t.name,manufacturer:t.manufacturer,version:t.version})}),at._access.inputs.forEach(function(t){at._ins.push({type:at._type,name:t.name,manufacturer:t.manufacturer,version:t.version})}),D()},at._openOut=function(t,e){var n,i=at._outMap[e];i||(i={name:e,clients:[],info:{name:e,manufacturer:at._allOuts[e].manufacturer,version:at._allOuts[e].version,type:"MIDI-out",sysex:at._sysex,engine:at._type},_close:function(t){at._closeOut(t)},_closeAll:r,_receive:function(t){i.dev&&t.length&&this.dev.send(t.slice())}}),at._access.outputs.forEach(function(t){t.name===e&&(n=t)}),n?(i.dev=n,at._outMap[e]=i,t._orig._impl=i,k(i.clients,t._orig),t._info=i.info,t._receive=function(t){i._receive(t)},t._close=function(){i._close(this)},i.dev.open&&(t._pause(),i.dev.open().then(function(){t._resume()},function(){t._crash()}))):t._break()},at._openIn=function(t,e){var n,i=at._inMap[e];if(i||(i={name:e,clients:[],info:{name:e,manufacturer:at._allIns[e].manufacturer,version:at._allIns[e].version,type:"MIDI-in",sysex:at._sysex,engine:at._type},_close:function(t){at._closeIn(t)},_closeAll:r,handle:function(t){for(var e=0;e<this.clients.length;e++){var n=Pt([].slice.call(t.data));this.clients[e]._emit(n)}}}),at._access.inputs.forEach(function(t){t.name===e&&(n=t)}),n){i.dev=n;var o=function(t){return function(e){t.handle(e)}};i.dev.onmidimessage=o(i),at._inMap[e]=i,t._orig._impl=i,k(i.clients,t._orig),t._info=i.info,t._close=function(){i._close(this)},i.dev.open&&(t._pause(),i.dev.open().then(function(){t._resume()},function(){t._crash()}))}else t._break()},at._closeOut=function(t){var e=t._impl;S(e.clients,t._orig),e.clients.length||(e.dev&&e.dev.close&&e.dev.close(),e.dev=void 0)},at._closeIn=function(t){var e=t._impl;S(e.clients,t._orig),e.clients.length||(e.dev&&(e.dev.onmidimessage=null,e.dev.close&&e.dev.close()),e.dev=void 0)},at._close=function(){at._unwatch()},at._watch=function(){at._access.onstatechange=function(){n=!0,d(function(){n&&(at._refresh(),n=!1)})}},at._unwatch=function(){at._access.onstatechange=void 0}}function St(t,e){function n(){for(var t=0;t<this.clients.length;t++)this._close(this.clients[t])}var r;at._type="extension",at._version=e,at._sysex=!0,at._pool=[],at._outs=[],at._ins=[],at._inArr=[],at._outArr=[],at._inMap={},at._outMap={},at._outsW=[],at._insW=[],at.refreshClients=[],at._msg=t,at._newPlugin=function(){var t={id:at._pool.length};at._pool.push(t),t.id?document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["new"]})):t.ready=!0},at._newPlugin(),at._refresh=function(t){at.refreshClients.push(t),t._pause(),d(function(){document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["refresh"]}))})},at._openOut=function(t,e){var r=at._outMap[e];if(!r){at._pool.length<=at._outArr.length&&at._newPlugin();var i=at._pool[at._outArr.length];r={name:e,clients:[],info:{name:e,manufacturer:at._allOuts[e].manufacturer,version:at._allOuts[e].version,type:"MIDI-out",sysex:at._sysex,engine:at._type},_start:function(){document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["openout",i.id,e]}))},_close:function(t){at._closeOut(t)},_closeAll:n,_receive:function(t){if(t.length){var e=t.slice();e.splice(0,0,"play",i.id),document.dispatchEvent(new CustomEvent("jazz-midi",{detail:e}))}}},r.plugin=i,i.output=r,at._outArr.push(r),at._outMap[e]=r}t._orig._impl=r,k(r.clients,t._orig),t._info=r.info,t._receive=function(t){r._receive(t)},t._close=function(){r._close(this)},r.open||(t._pause(),r.plugin.ready&&r._start())},at._openIn=function(t,e){var r=at._inMap[e];if(!r){at._pool.length<=at._inArr.length&&at._newPlugin();var i=at._pool[at._inArr.length];r={name:e,clients:[],info:{name:e,manufacturer:at._allIns[e].manufacturer,version:at._allIns[e].version,type:"MIDI-in",sysex:at._sysex,engine:at._type},_start:function(){document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["openin",i.id,e]}))},_close:function(t){at._closeIn(t)},_closeAll:n},r.plugin=i,i.input=r,at._inArr.push(r),at._inMap[e]=r}t._orig._impl=r,k(r.clients,t._orig),t._info=r.info,t._close=function(){r._close(this)},r.open||(t._pause(),r.plugin.ready&&r._start())},at._closeOut=function(t){var e=t._impl;S(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["closeout",e.plugin.id]})))},at._closeIn=function(t){var e=t._impl;S(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["closein",e.plugin.id]})))},at._close=function(){at._unwatch()},at._watch=function(){at._insW=at._ins,at._outsW=at._outs,r=setInterval(function(){document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["refresh"]}))},250)},at._unwatch=function(){clearInterval(r),r=void 0},document.addEventListener("jazz-midi-msg",function(t){var e,n,r,i=t.detail?[t.detail]:void 0;if(!i)for(i=at._msg.innerText.split("\n"),at._msg.innerText="",e=0;e<i.length;e++)try{i[e]=JSON.parse(i[e])}catch(t){i[e]=[]}for(e=0;e<i.length;e++){var o=i[e];if(o.length)if("refresh"===o[0]){if(o[1].ins){for(n=0;n<o[1].ins.length;n++)o[1].ins[n].type=at._type;at._ins=o[1].ins}if(o[1].outs){for(n=0;n<o[1].outs.length;n++)o[1].outs[n].type=at._type;at._outs=o[1].outs}for(D(),n=0;n<at.refreshClients.length;n++)at.refreshClients[n]._resume();at.refreshClients=[]}else if("version"===o[0]){var s=at._pool[o[1]];s&&(s.ready=!0,s.input&&s.input._start(),s.output&&s.output._start())}else if("openout"===o[0]){if(r=at._pool[o[1]].output)if(o[2]==r.name){if(r.open=!0,r.clients)for(n=0;n<r.clients.length;n++)r.clients[n]._resume()}else if(r.clients)for(n=0;n<r.clients.length;n++)r.clients[n]._crash()}else if("openin"===o[0]){if(r=at._pool[o[1]].input)if(o[2]==r.name){if(r.open=!0,r.clients)for(n=0;n<r.clients.length;n++)r.clients[n]._resume()}else if(r.clients)for(n=0;n<r.clients.length;n++)r.clients[n]._crash()}else if("midi"===o[0]&&(r=at._pool[o[1]].input)&&r.clients)for(n=0;n<r.clients.length;n++){var a=Pt(o.slice(3));r.clients[n]._emit(a)}}})}var At=function(t){return C||vt(t),C._thenable()};function Et(t){var e=new V;return t instanceof Object&&E(t,function(n){e[n]=t[n]}),e._resume(),e}function Ot(){var t=this instanceof Ot?this:t=new Ot;return Ot.prototype.reset.apply(t,arguments),t}function Ct(){29.97==this.type&&!this.second&&this.frame<2&&this.minute%10&&(this.frame=2)}function Mt(t){return[[24,25,29.97,30][t[7]>>1&3],(1&t[7])<<4|t[6],t[5]<<4|t[4],t[3]<<4|t[2],t[1]<<4|t[0]]}function Nt(t){var e;switch(!t.backwards&&t.quarter>=4?t.decrFrame():t.backwards&&t.quarter<4&&t.incrFrame(),t.quarter>>1){case 0:e=t.frame;break;case 1:e=t.second;break;case 2:e=t.minute;break;default:e=t.hour}return 1&t.quarter?e>>=4:e&=15,7==t.quarter&&(25==t.type?e|=2:29.97==t.type?e|=4:30==t.type&&(e|=6)),!t.backwards&&t.quarter>=4?t.incrFrame():t.backwards&&t.quarter<4&&t.decrFrame(),e|t.quarter<<4}function It(t){return 25==t.type?32|t.hour:29.97==t.type?64|t.hour:30==t.type?96|t.hour:t.hour}function jt(t){return t<10?"0"+t:t}function Rt(t){for(var e=[],n=0;n<t.length;n++)e[n]=jt(n?t[n]:31&t[n]);return e.join(":")}function Pt(t){var e,n=this instanceof Pt?this:n=new Pt;if(t instanceof Pt)return n._from=t._from.slice(),E(t,function(e){"_from"!=e&&(n[e]=t[e])}),n;if(n._from=[],void 0===t)return n;var r=t instanceof Array?t:arguments;for(e=0;e<r.length;e++)s=r[e],1==e&&(n[0]>=128&&n[0]<=175&&(s=Pt.noteValue(s)),n[0]>=192&&n[0]<=207&&(s=Pt.programValue(s))),(s!=parseInt(s)||s<0||s>255)&&Bt(r[e]),n.push(s);return n}At.JZZ=At,At.version=u,At.info=function(){return A.prototype.info()},At.Widget=Et,A.prototype.Widget=At.Widget,At.addMidiIn=function(t,e){var n=O(e._info||{});n.name=t,n.type=n.type||"javascript",n.manufacturer=n.manufacturer||"virtual",n.version=n.version||"0.0";var r={_info:function(){return n},_openIn:function(t){t._pause(),t._info=O(n),t._close=function(){e.disconnect(t)},e.connect(t),t._resume()}};return At.lib.registerMidiIn(t,r)},A.prototype.addMidiIn=At.addMidiIn,At.addMidiOut=function(t,e){var n=O(e._info||{});n.name=t,n.type=n.type||"javascript",n.manufacturer=n.manufacturer||"virtual",n.version=n.version||"0.0";var r={_info:function(){return n},_openOut:function(t){t._pause(),t._info=O(n),t._close=function(){t.disconnect()},J.apply(t,[e]),t._resume()}};return At.lib.registerMidiOut(t,r)},A.prototype.addMidiOut=At.addMidiOut,At.removeMidiOut=function(t){return At.lib.unregisterMidiOut(t)},A.prototype.removeMidiOut=At.removeMidiOut,At.removeMidiIn=function(t){return At.lib.unregisterMidiIn(t)},A.prototype.removeMidiIn=At.removeMidiIn,At.maskMidiIn=function(t){P[t]=!0},A.prototype.maskMidiIn=At.maskMidiIn,At.unmaskMidiIn=function(t){delete P[t]},A.prototype.unmaskMidiIn=At.unmaskMidiIn,At.maskMidiOut=function(t){R[t]=!0},A.prototype.maskMidiOut=At.maskMidiOut,At.unmaskMidiOut=function(t){delete R[t]},A.prototype.unmaskMidiOut=At.unmaskMidiOut,Ot.prototype.reset=function(t){if(t instanceof Ot)return this.setType(t.getType()),this.setHour(t.getHour()),this.setMinute(t.getMinute()),this.setSecond(t.getSecond()),this.setFrame(t.getFrame()),this.setQuarter(t.getQuarter()),this;var e=t instanceof Array?t:arguments;return this.setType(e[0]),this.setHour(e[1]),this.setMinute(e[2]),this.setSecond(e[3]),this.setFrame(e[4]),this.setQuarter(e[5]),this},Ot.prototype.isFullFrame=function(){return 0==this.quarter||4==this.quarter},Ot.prototype.getType=function(){return this.type},Ot.prototype.getHour=function(){return this.hour},Ot.prototype.getMinute=function(){return this.minute},Ot.prototype.getSecond=function(){return this.second},Ot.prototype.getFrame=function(){return this.frame},Ot.prototype.getQuarter=function(){return this.quarter},Ot.prototype.setType=function(t){if(void 0===t||24==t)this.type=24;else if(25==t)this.type=25;else if(29.97==t)this.type=29.97,Ct.apply(this);else{if(30!=t)throw RangeError("Bad SMPTE frame rate: "+t);this.type=30}return this.frame>=this.type&&(this.frame=this.type-1),this},Ot.prototype.setHour=function(t){if(void 0===t&&(t=0),t!=parseInt(t)||t<0||t>=24)throw RangeError("Bad SMPTE hours value: "+t);return this.hour=t,this},Ot.prototype.setMinute=function(t){if(void 0===t&&(t=0),t!=parseInt(t)||t<0||t>=60)throw RangeError("Bad SMPTE minutes value: "+t);return this.minute=t,Ct.apply(this),this},Ot.prototype.setSecond=function(t){if(void 0===t&&(t=0),t!=parseInt(t)||t<0||t>=60)throw RangeError("Bad SMPTE seconds value: "+t);return this.second=t,Ct.apply(this),this},Ot.prototype.setFrame=function(t){if(void 0===t&&(t=0),t!=parseInt(t)||t<0||t>=this.type)throw RangeError("Bad SMPTE frame number: "+t);return this.frame=t,Ct.apply(this),this},Ot.prototype.setQuarter=function(t){if(void 0===t&&(t=0),t!=parseInt(t)||t<0||t>=8)throw RangeError("Bad SMPTE quarter frame: "+t);return this.quarter=t,this},Ot.prototype.incrFrame=function(){return this.frame++,this.frame>=this.type&&(this.frame=0,this.second++,this.second>=60&&(this.second=0,this.minute++,this.minute>=60&&(this.minute=0,this.hour=this.hour>=23?0:this.hour+1))),Ct.apply(this),this},Ot.prototype.decrFrame=function(){return!this.second&&2==this.frame&&29.97==this.type&&this.minute%10&&(this.frame=0),this.frame--,this.frame<0&&(this.frame=29.97==this.type?29:this.type-1,this.second--,this.second<0&&(this.second=59,this.minute--,this.minute<0&&(this.minute=59,this.hour=this.hour?this.hour-1:23))),this},Ot.prototype.incrQF=function(){return this.backwards=!1,this.quarter=this.quarter+1&7,0!=this.quarter&&4!=this.quarter||this.incrFrame(),this},Ot.prototype.decrQF=function(){return this.backwards=!0,this.quarter=this.quarter+7&7,3!=this.quarter&&7!=this.quarter||this.decrFrame(),this},Ot.prototype.read=function(t){if(t instanceof Pt||(t=Pt.apply(null,arguments)),240==t[0]&&127==t[1]&&1==t[3]&&1==t[4]&&247==t[9])return this.type=[24,25,29.97,30][t[5]>>5&3],this.hour=31&t[5],this.minute=t[6],this.second=t[7],this.frame=t[8],this.quarter=0,this._=void 0,this._b=void 0,this._f=void 0,!0;if(241==t[0]&&void 0!==t[1]){var e=t[1]>>4,n=15&t[1];return 0==e?7==this._&&(7==this._f&&(this.reset(Mt(this._a)),this.incrFrame()),this.incrFrame()):3==e?4==this._&&this.decrFrame():4==e?3==this._&&this.incrFrame():7==e&&0===this._&&(0===this._b&&(this.reset(Mt(this._a)),this.decrFrame()),this.decrFrame()),this._a||(this._a=[]),this._a[e]=n,this._f=this._f===e-1||0==e?e:void 0,this._b=this._b===e+1||7==e?e:void 0,this._=e,this.quarter=e,!0}return!1},Ot.prototype.toString=function(){return Rt([this.hour,this.minute,this.second,this.frame])},At.SMPTE=Ot,A.prototype.SMPTE=Ot,Pt.prototype=[],Pt.prototype.constructor=Pt,Pt.prototype.isMidi=function(){return 1};var Dt={};function Lt(t){if(t!=parseFloat(t))throw TypeError("Not a number: "+t)}function Ft(){}Pt.noteValue=function(t){return void 0===t?void 0:Dt[t.toString().toLowerCase()]},Pt.programValue=function(t){return t},Pt.octaveValue=function(t){var e=Dt[t.toString().toLowerCase()];return void 0===e&&(e=Dt[t.toString().toLowerCase()+"1"]),void 0===e?void 0:e%12},Pt.freq=function(t,e){return void 0===e&&(e=440),Lt(e),t!=parseFloat(t)&&(t=Zt(t)),e*Math.pow(2,(t-69)/12)},Pt.shift=function(t,e){return void 0===e&&(e=440),Lt(t),Lt(e),12*Math.log2(t/e)},Pt.midi=function(t,e){return t!=parseFloat(t)?Zt(t):Pt.shift(t,e)+69},Pt.to7b=function(t){return Lt(t),t<=0?0:t>=1?127:Math.floor(128*t)},Pt.to14b=function(t){return Lt(t),t<=0?0:t>=1?16383:Math.floor(16384*t)},Pt.to21b=function(t){return void 0===t?2097151:(Lt(t),t<=0?0:(t=(Math.floor(t)<<14)+Pt.to14b(t-Math.floor(t)))<2097151?t:2097150)},Pt.to32b=function(t){return Lt(t),t<=0?0:t>=1?4294967295:Math.floor(4294967296*t)},Ft.prototype=Pt,Pt._sxid=127,Pt.sxId=function(t){if(void 0===t&&(t=Pt._sxid),t==this._sxid)return this;t=zt(t);var e=new Ft;return e._ch=this._ch,e._sxid=t,e},Pt.ch=function(t){if(t==this._ch||void 0===t&&void 0===this._ch)return this;var e=new Ft;return void 0!==t&&(t=Vt(t)),e._ch=t,e._sxid=this._sxid,e};var $t={c:0,d:2,e:4,f:5,g:7,a:9,b:11,h:11};for(E($t,function(t){for(s=0;s<12&&!((o=$t[t]+12*s)>127);s++)Dt[t+s]=o,Dt[t+"♮"+s]=o,o>0&&(Dt[t+"b"+s]=o-1,Dt[t+"♭"+s]=o-1,Dt[t+"bb"+s]=o-2,Dt[t+"♭♭"+s]=o-2,Dt[t+"𝄫"+s]=o-2),o<127&&(Dt[t+"#"+s]=o+1,Dt[t+"♯"+s]=o+1,Dt[t+"##"+s]=o+2,Dt[t+"♯♯"+s]=o+2,Dt[t+"𝄪"+s]=o+2)}),s=0;s<128;s++)Dt[s]=s;function Bt(t){throw RangeError("Bad MIDI value: "+t)}function qt(t){throw TypeError("Invalid value: "+t)}function Ut(t){throw RangeError("Out of range: "+t)}function Vt(t){return K(t),parseInt(t)}function Gt(t){if(t!=parseInt(t)||t<0||t>15)throw RangeError("Expected a 4-bit value: "+t);return parseInt(t)}function zt(t,e){return(t!=parseInt(t)||t<0||t>127)&&Bt(void 0===e?t:e),parseInt(t)}function Wt(t){return(t!=parseInt(t)||t<0||t>255)&&Bt(t),parseInt(t)}function Jt(t){return(t!=parseInt(t)||t<0||t>16383)&&Bt(t),parseInt(t)}function Ht(t){if(t!=parseInt(t)||t<0||t>65535)throw RangeError("Expected a 16-bit value: "+t);return parseInt(t)}function Xt(t){if(t!=parseInt(t)||t<0||t>1048575)throw RangeError("Expected a 20-bit value: "+t);return parseInt(t)}function Kt(t){return(t!=parseInt(t)||t<0||t>2097151)&&Bt(t),parseInt(t)}function Qt(t){return(t!=parseInt(t)||t<0||t>4294967295)&&Bt(t),parseInt(t)}function Zt(t){return zt(Pt.noteValue(t),t)}function Yt(t){return 127&Jt(t)}function te(t){return Jt(t)>>7}function ee(t){t=""+t;for(var e=0;e<t.length;e++)t.charCodeAt(e)>255&&Bt(t[e]);return t}function ne(t){return[t>>14,t>>7&127,127&t]}function re(t,e){return t!=parseFloat(t)&&qt(void 0===e?t:e),(t<0||t>1)&&Ut(void 0===e?t:e),parseFloat(t)}function ie(t){return void 0===t||t?127:126}function oe(t){var e,n,r=[],i={};E(t,function(e){if(n=Kt(t[e]),(e=Zt(e))in i)throw RangeError("Duplicate MIDI value: "+e);r.push(e),i[e]=n}),r.sort();var o=[r.length];for(e=0;e<r.length;e++)o=o.concat([r[e]],ne(i[r[e]]));return o}function se(t){var e={};return E(t,function(n){e[n]=Pt.to21b(t[n]==parseFloat(t[n])?t[n]:Zt(t[n]))}),e}function ae(t){var e={};return E(t,function(n){e[n]=Pt.to21b(Pt.midi(t[n]))}),e}function ue(t){var e=[];if(!(t instanceof Array)||12!=t.length)throw TypeError("Expected an array of size 12");for(var n=0;n<12;n++)e.push(zt(t[n]));return e}function ce(t){var e=[];if(!(t instanceof Array)||12!=t.length)throw TypeError("Expected an array of size 12");for(var n=0;n<12;n++)e.push(te(t[n])),e.push(Yt(t[n]));return e}var le={noteOff:function(t,e,n){return void 0===n&&(n=64),[128+Vt(t),Zt(e),zt(n)]},noteOn:function(t,e,n){return void 0===n&&(n=127),[144+Vt(t),Zt(e),zt(n)]},aftertouch:function(t,e,n){return[160+Vt(t),Zt(e),zt(n)]}},he={control:function(t,e,n){return[176+Vt(t),zt(e),zt(n)]},program:function(t,e){return[192+Vt(t),zt(Pt.programValue(e),e)]},pressure:function(t,e){return[208+Vt(t),zt(e)]},pitchBend:function(t,e,n){return void 0===n?[224+Vt(t),Yt(e),te(e)]:[224+Vt(t),zt(n),zt(e)]},pitchBendF:function(t,e){return he.pitchBend(t,Pt.to14b((e+1)/2))},bankMSB:function(t,e){return[176+Vt(t),0,zt(e)]},bankLSB:function(t,e){return[176+Vt(t),32,zt(e)]},modMSB:function(t,e){return[176+Vt(t),1,zt(e)]},modLSB:function(t,e){return[176+Vt(t),33,zt(e)]},breathMSB:function(t,e){return[176+Vt(t),2,zt(e)]},breathLSB:function(t,e){return[176+Vt(t),34,zt(e)]},footMSB:function(t,e){return[176+Vt(t),4,zt(e)]},footLSB:function(t,e){return[176+Vt(t),36,zt(e)]},portamentoMSB:function(t,e){return[176+Vt(t),5,zt(e)]},portamentoLSB:function(t,e){return[176+Vt(t),37,zt(e)]},dataMSB:function(t,e){return[176+Vt(t),6,zt(e)]},dataLSB:function(t,e){return[176+Vt(t),38,zt(e)]},volumeMSB:function(t,e){return[176+Vt(t),7,zt(e)]},volumeLSB:function(t,e){return[176+Vt(t),39,zt(e)]},balanceMSB:function(t,e){return[176+Vt(t),8,zt(e)]},balanceLSB:function(t,e){return[176+Vt(t),40,zt(e)]},panMSB:function(t,e){return[176+Vt(t),10,zt(e)]},panLSB:function(t,e){return[176+Vt(t),42,zt(e)]},expressionMSB:function(t,e){return[176+Vt(t),11,zt(e)]},expressionLSB:function(t,e){return[176+Vt(t),43,zt(e)]},damper:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),64,e?127:0]},portamento:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),65,e?127:0]},sostenuto:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),66,e?127:0]},soft:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),67,e?127:0]},legato:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),68,e?127:0]},hold2:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),69,e?127:0]},soundVariation:function(t,e){return[176+Vt(t),70,Zt(e)]},filterResonance:function(t,e){return[176+Vt(t),71,Zt(e)]},releaseTime:function(t,e){return[176+Vt(t),72,Zt(e)]},attackTime:function(t,e){return[176+Vt(t),73,Zt(e)]},brightness:function(t,e){return[176+Vt(t),74,Zt(e)]},decayTime:function(t,e){return[176+Vt(t),75,Zt(e)]},vibratoRate:function(t,e){return[176+Vt(t),76,Zt(e)]},vibratoDepth:function(t,e){return[176+Vt(t),77,Zt(e)]},vibratoDelay:function(t,e){return[176+Vt(t),78,Zt(e)]},ptc:function(t,e){return[176+Vt(t),84,Zt(e)]},dataIncr:function(t){return[176+Vt(t),96,0]},dataDecr:function(t){return[176+Vt(t),97,0]},nrpnLSB:function(t,e){return[176+Vt(t),98,zt(e)]},nrpnMSB:function(t,e){return[176+Vt(t),99,zt(e)]},rpnLSB:function(t,e){return[176+Vt(t),100,zt(e)]},rpnMSB:function(t,e){return[176+Vt(t),101,zt(e)]},allSoundOff:function(t){return[176+Vt(t),120,0]},resetAllControllers:function(t){return[176+Vt(t),121,0]},localControl:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),122,e?127:0]},allNotesOff:function(t){return[176+Vt(t),123,0]},omni:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),e?125:124,0]},mono:function(t,e){return void 0===e&&(e=1),[176+Vt(t),126,zt(e)]},poly:function(t){return[176+Vt(t),127,0]}};function de(t,e,n,r){return void 0!==e?[zt(t),zt(e),zt(n),zt(r)]:((t!=parseInt(t)||t<0||t>65535)&&qt(t),[(t=parseInt(t))>>12&15,t>>8&15,t>>4&15,15&t])}function pe(t){return Lt(t),(t=Math.round(65536*t+16384))<0?0:t>65535?65535:t}var fe={mtc:function(t){return[241,Nt(t)]},songPosition:function(t,e){return void 0===e?[242,Yt(t),te(t)]:[242,zt(e),zt(t)]},songSelect:function(t){return[243,zt(t)]},tune:function(){return[246]},clock:function(){return[248]},start:function(){return[250]},continue:function(){return[251]},stop:function(){return[252]},active:function(){return[254]},reset:function(){return[255]}},me={sxIdRequest:function(){return[240,126,this._sxid,6,1,247]},sxTuningDumpRequest:function(t,e){return void 0===e?[240,126,this._sxid,8,0,zt(t),247]:[240,126,this._sxid,8,3,zt(t),zt(e),247]},sxFullFrame:function(t){return[240,127,this._sxid,1,1,It(t),t.getMinute(),t.getSecond(),t.getFrame(),247]},sxMasterVolume:function(t,e){return void 0===e?[240,127,this._sxid,4,1,Yt(t),te(t),247]:[240,127,this._sxid,4,1,zt(e),zt(t),247]},sxMasterVolumeF:function(t){return me.sxMasterVolume.call(this,Pt.to14b(re(t)))},sxMasterFineTuning:function(t,e){return void 0===e?[240,127,this._sxid,4,3,Yt(t),te(t),247]:[240,127,this._sxid,4,3,zt(e),zt(t),247]},sxMasterFineTuningF:function(t){return me.sxMasterFineTuning.call(this,Pt.to14b(re((t%1+1)/2,t)))},sxMasterCoarseTuning:function(t){return[240,127,this._sxid,4,4,0,zt(t),247]},sxMasterCoarseTuningF:function(t){return me.sxMasterCoarseTuning.call(this,t-t%1+64)},sxNoteTuning:function(t,e,n,r){return e==parseInt(e)?[240,ie(r),this._sxid,8,7,zt(t),zt(e)].concat(oe(n),[247]):[240,127,this._sxid,8,2,zt(t)].concat(oe(e),[247])},sxNoteTuningF:function(t,e,n,r){return e==parseInt(e)?me.sxNoteTuning.call(this,t,e,se(n),r):me.sxNoteTuning.call(this,t,se(e))},sxNoteTuningHZ:function(t,e,n,r){return e==parseInt(e)?me.sxNoteTuning.call(this,t,e,ae(n),r):me.sxNoteTuning.call(this,t,ae(e))},sxScaleTuning1:function(t,e,n){return t==parseInt(t)?[240,ie(n),this._sxid,8,8].concat(ne(Ht(t)),ue(e),[247]):me.sxScaleTuning1.call(this,65535,t,e)},sxScaleTuning1F:function(t,e,n){if(t!=parseInt(t))return me.sxScaleTuning1F.call(this,65535,t,e);for(var r=[],i=0;i<e.length;i++){if(e[i]<-.64||e[i]>.63)throw RangeError("Out of range: "+e[i]);r.push(Math.floor(100*e[i]+64))}return me.sxScaleTuning1.call(this,t,r,n)},sxScaleTuning2:function(t,e,n){return t==parseInt(t)?[240,ie(n),this._sxid,8,9].concat(ne(Ht(t)),ce(e),[247]):me.sxScaleTuning2.call(this,65535,t,e)},sxScaleTuning2F:function(t,e,n){if(t!=parseInt(t))return me.sxScaleTuning2F.call(this,65535,t,e);for(var r=[],i=0;i<e.length;i++){var o=(e[i]+1)/2;if(o<-1||o>1)throw RangeError("Out of range: "+e[i]);r.push(Pt.to14b((e[i]+1)/2))}return me.sxScaleTuning2.call(this,t,r,n)},sxGM:function(t){return void 0===t&&(t=1),[240,126,this._sxid,9,t?2==t?3:1:2,247]},sxGS:function(t){for(var e=void 0===t?[64,0,127,0]:t instanceof Array?t:arguments,n=0,r=[240,65,this._sxid,66,18],i=0;i<e.length;i++){var o=zt(e[i]);r.push(o),n+=o}return n%=128,r.push(n?128-n:0),r.push(247),r},sxXG:function(t){var e=void 0===t?[0,0,126,0]:t instanceof Array?t:arguments,n=127==this._sxid?0:this._sxid;n>15&&Bt("Bad Yamaha device number: "+n);for(var r=[240,67,16+n,76],i=0;i<e.length;i++)r.push(zt(e[i]));return r.push(247),r},sxMidiSoft:function(t,e){var n=[240,0,32,36,0,zt(t||0)];e=void 0===e?"":""+e;for(var r=0;r<e.length;r++)n.push(zt(e.charCodeAt(r)));return n.push(247),n},gsMasterVolume:function(t){return me.sxGS.call(this,[64,0,4,zt(t)])},gsMasterVolumeF:function(t){return me.gsMasterVolume.call(this,Pt.to7b(re(t)))},gsMasterFineTuning:function(t,e,n,r){return t=de(t,e,n,r),me.sxGS.call(this,[64,0,0,t[0],t[1],t[2],t[3]])},gsMasterFineTuningF:function(t){return me.gsMasterFineTuning.call(this,pe(t%1))},gsMasterCoarseTuning:function(t){return me.sxGS.call(this,[64,0,5,zt(t)])},gsMasterCoarseTuningF:function(t){return me.gsMasterCoarseTuning.call(this,t-t%1+64)},gsOctaveTuning:function(t,e,n){return me.sxGS.call(this,[64,16+[1,2,3,4,5,6,7,8,9,0,11,12,13,14,15][Vt(t)],64+Pt.octaveValue(e),zt(n)])},gsOctaveTuningF:function(t,e,n){if(n<-.64||n>.63)throw RangeError("Out of range: "+n);return me.gsOctaveTuning.call(this,t,e,Math.floor(100*n+64))},xgMasterVolume:function(t){return me.sxXG.call(this,[0,0,4,zt(t)])},xgMasterVolumeF:function(t){return me.xgMasterVolume.call(this,Pt.to7b(re(t)))},xgMasterFineTuning:function(t,e,n,r){return t=de(t,e,n,r),me.sxXG.call(this,[0,0,0,t[0],t[1],t[2],t[3]])},xgMasterFineTuningF:function(t){return me.xgMasterFineTuning.call(this,pe(t%1))},xgMasterCoarseTuning:function(t){return me.sxXG.call(this,[0,0,6,zt(t)])},xgMasterCoarseTuningF:function(t){return me.xgMasterCoarseTuning.call(this,t-t%1+64)},xgOctaveTuning:function(t,e,n){return me.sxXG.call(this,[8,Vt(t),65+Pt.octaveValue(e),zt(n)])},xgOctaveTuningF:function(t,e,n){if(n<-.64||n>.63)throw RangeError("Out of range: "+n);return me.xgOctaveTuning.call(this,t,e,Math.floor(100*n+64))}};me.sxScaleTuning=me.sxScaleTuning2,me.sxScaleTuningF=me.sxScaleTuning2F,me.sxMasterTranspose=me.sxMasterCoarseTuning,me.sxMasterTransposeF=me.sxMasterCoarseTuningF,me.gsMasterTranspose=me.gsMasterCoarseTuning,me.gsMasterTransposeF=me.gsMasterCoarseTuningF,me.xgMasterTranspose=me.xgMasterCoarseTuning,me.xgMasterTransposeF=me.xgMasterCoarseTuningF;var ge={bank:function(t,e,n){return void 0===n?[he.bankMSB(t,te(e)),he.bankLSB(t,Yt(e))]:[he.bankMSB(t,e),he.bankLSB(t,n)]},modF:function(t,e){return ge.mod(t,Pt.to14b(e))},mod:function(t,e,n){return void 0===n?[he.modMSB(t,te(e)),he.modLSB(t,Yt(e))]:[he.modMSB(t,e),he.modLSB(t,n)]},breathF:function(t,e){return ge.breath(t,Pt.to14b(e))},breath:function(t,e,n){return void 0===n?[he.breathMSB(t,te(e)),he.breathLSB(t,Yt(e))]:[he.breathMSB(t,e),he.breathLSB(t,n)]},footF:function(t,e){return ge.foot(t,Pt.to14b(e))},foot:function(t,e,n){return void 0===n?[he.footMSB(t,te(e)),he.footLSB(t,Yt(e))]:[he.footMSB(t,e),he.footLSB(t,n)]},portamentoTimeF:function(t,e){return ge.portamentoTime(t,Pt.to14b(e))},portamentoTime:function(t,e,n){return void 0===n?[he.portamentoMSB(t,te(e)),he.portamentoLSB(t,Yt(e))]:[he.portamentoMSB(t,e),he.portamentoLSB(t,n)]},dataF:function(t,e){return ge.data(t,Pt.to14b(e))},data:function(t,e,n){return void 0===n?[he.dataMSB(t,te(e)),he.dataLSB(t,Yt(e))]:[he.dataMSB(t,e),he.dataLSB(t,n)]},volumeF:function(t,e){return ge.volume(t,Pt.to14b(e))},volume:function(t,e,n){return void 0===n?[he.volumeMSB(t,te(e)),he.volumeLSB(t,Yt(e))]:[he.volumeMSB(t,e),he.volumeLSB(t,n)]},balanceF:function(t,e){return ge.balance(t,Pt.to14b((e+1)/2))},balance:function(t,e,n){return void 0===n?[he.balanceMSB(t,te(e)),he.balanceLSB(t,Yt(e))]:[he.balanceMSB(t,e),he.balanceLSB(t,n)]},panF:function(t,e){return ge.pan(t,Pt.to14b((e+1)/2))},pan:function(t,e,n){return void 0===n?[he.panMSB(t,te(e)),he.panLSB(t,Yt(e))]:[he.panMSB(t,e),he.panLSB(t,n)]},expressionF:function(t,e){return ge.expression(t,Pt.to14b(e))},expression:function(t,e,n){return void 0===n?[he.expressionMSB(t,te(e)),he.expressionLSB(t,Yt(e))]:[he.expressionMSB(t,e),he.expressionLSB(t,n)]},nrpn:function(t,e,n){return void 0===n?[he.nrpnMSB(t,te(e)),he.nrpnLSB(t,Yt(e))]:[he.nrpnMSB(t,e),he.nrpnLSB(t,n)]},rpn:function(t,e,n){return void 0===n?[he.rpnMSB(t,te(e)),he.rpnLSB(t,Yt(e))]:[he.rpnMSB(t,e),he.rpnLSB(t,n)]},rpnPitchBendRange:function(t,e,n){return ge.rpn(t,0,0).concat(ge.data(t,e,n))},rpnPitchBendRangeF:function(t,e){return ge.rpnPitchBendRange(t,zt(e-e%1),Math.floor(e%1*100))},rpnFineTuning:function(t,e,n){return ge.rpn(t,0,1).concat(ge.data(t,e,n))},rpnFineTuningF:function(t,e){return ge.rpn(t,0,1).concat(ge.dataF(t,(e%1+1)/2))},rpnCoarseTuning:function(t,e){return ge.rpn(t,0,2).concat([he.dataMSB(t,e)])},rpnCoarseTuningF:function(t,e){return ge.rpn(t,0,2).concat([he.dataMSB(t,e-e%1+64)])},rpnTuning:function(t,e,n,r){return ge.rpnCoarseTuning(t,e).concat(ge.rpnFineTuning(t,n,r))},rpnTuningF:function(t,e){return ge.rpnCoarseTuningF(t,e).concat(ge.rpnFineTuningF(t,e))},rpnTuningA:function(t,e){return ge.rpnTuningF(t,Pt.shift(e))},rpnSelectTuningProgram:function(t,e){return ge.rpn(t,0,3).concat([he.dataMSB(t,e)])},rpnSelectTuningBank:function(t,e){return ge.rpn(t,0,4).concat([he.dataMSB(t,e)])},rpnSelectTuning:function(t,e,n){return void 0===n?ge.rpnSelectTuningProgram(t,e):ge.rpnSelectTuningBank(t,e).concat(ge.rpnSelectTuningProgram(t,n))},rpnModulationDepthRange:function(t,e,n){return ge.rpn(t,0,5).concat(ge.data(t,e,n))},rpnModulationDepthRangeF:function(t,e){return ge.rpnModulationDepthRange(t,zt(e-e%1),Math.floor(e%1*128))},rpnNull:function(t){return ge.rpn(t,127,127)},mode1:function(t){return[he.omni(t,!0),he.poly(t)]},mode2:function(t){return[he.omni(t,!0),he.mono(t)]},mode3:function(t){return[he.omni(t,!1),he.poly(t)]},mode4:function(t){return[he.omni(t,!1),he.mono(t)]}};ge.rpnTranspose=ge.rpnCoarseTuningF;var _e={sxMasterTuning:function(t,e,n){return[me.sxMasterCoarseTuning.call(this,t),me.sxMasterFineTuning.call(this,e,n)]},sxMasterTuningF:function(t){return[me.sxMasterCoarseTuningF.call(this,t),me.sxMasterFineTuningF.call(this,t)]},gsMasterTuningF:function(t){return[me.gsMasterCoarseTuningF.call(this,t),me.gsMasterFineTuningF.call(this,t)]},xgMasterTuningF:function(t){return[me.xgMasterCoarseTuningF.call(this,t),me.xgMasterFineTuningF.call(this,t)]},sxMasterTuningA:function(t){return _e.sxMasterTuningF.call(this,Pt.shift(t))},gsMasterTuningA:function(t){return _e.gsMasterTuningF.call(this,Pt.shift(t))},xgMasterTuningA:function(t){return _e.xgMasterTuningF.call(this,Pt.shift(t))},gsScaleTuning:function(t,e){var n=[];if(12!=e.length)throw RangeError("Wrong input size: "+e.length);for(var r=0;r<12;r++)n.push(me.gsOctaveTuning.call(this,t,r,e[r]));return n},gsScaleTuningF:function(t,e){var n=[];if(12!=e.length)throw RangeError("Wrong input size: "+e.length);for(var r=0;r<12;r++)n.push(me.gsOctaveTuningF.call(this,t,r,e[r]));return n},xgScaleTuning:function(t,e){var n=[];if(12!=e.length)throw RangeError("Wrong input size: "+e.length);for(var r=0;r<12;r++)n.push(me.xgOctaveTuning.call(this,t,r,e[r]));return n},xgScaleTuningF:function(t,e){var n=[];if(12!=e.length)throw RangeError("Wrong input size: "+e.length);for(var r=0;r<12;r++)n.push(me.xgOctaveTuningF.call(this,t,r,e[r]));return n}};function ye(t,e){var n=new Pt;return n.ff=Wt(t),n.dd=void 0===e?"":ee(e),n}var ve={smf:function(t){if(t instanceof Pt)return new Pt(t);var e=t instanceof Array?t:arguments,n=Wt(e[0]),r="";return 2==e.length?r=Re(e[1]):e.length>2&&(r=Re(Array.prototype.slice.call(e,1))),ye(n,r)},smfSeqNumber:function(t){if(t==parseInt(t)){if(t<0||t>65535)throw RangeError("Sequence number out of range: "+t);t=String.fromCharCode(t>>8)+String.fromCharCode(255&t)}else if(0==(t=""+t).length)t="\0\0";else if(1==t.length)t="\0"+t;else if(t.length>2)throw RangeError("Sequence number out of range"+qe(t));return ye(0,t)},smfText:function(t){return ye(1,At.lib.toUTF8(t))},smfCopyright:function(t){return ye(2,At.lib.toUTF8(t))},smfSeqName:function(t){return ye(3,At.lib.toUTF8(t))},smfInstrName:function(t){return ye(4,At.lib.toUTF8(t))},smfLyric:function(t){return ye(5,At.lib.toUTF8(t))},smfMarker:function(t){return ye(6,At.lib.toUTF8(t))},smfCuePoint:function(t){return ye(7,At.lib.toUTF8(t))},smfProgName:function(t){return ye(8,At.lib.toUTF8(t))},smfDevName:function(t){return ye(9,At.lib.toUTF8(t))},smfChannelPrefix:function(t){if(t==parseInt(t))K(t),t=String.fromCharCode(t);else if(0==(t=""+t).length)t="\0";else if(t.length>1||t.charCodeAt(0)>15)throw RangeError("Channel number out of range"+qe(t));return ye(32,t)},smfMidiPort:function(t){if(t==parseInt(t)){if(t<0||t>127)throw RangeError("Port number out of range: "+t);t=String.fromCharCode(t)}else if(0==(t=""+t).length)t="\0";else if(t.length>1||t.charCodeAt(0)>127)throw RangeError("Port number out of range"+qe(t));return ye(33,t)},smfEndOfTrack:function(t){if(""!=Re(t))throw RangeError("Unexpected data"+qe(Re(t)));return ye(47)},smfTempo:function(t){if(3==(""+t).length)return ye(81,t);if(t==parseInt(t)&&t>0&&t<=16777215)return ye(81,String.fromCharCode(t>>16)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t));throw RangeError("Out of range"+qe(Re(t)))},smfBPM:function(t){return ve.smfTempo(Math.round(6e7/t))},smfSMPTE:function(t){if(t instanceof Ot)return ye(84,String.fromCharCode(t.hour)+String.fromCharCode(t.minute)+String.fromCharCode(t.second)+String.fromCharCode(t.frame)+String.fromCharCode(t.quarter%4*25));if(5==(""+t).length)return ye(84,t);var e=t instanceof Array?t:Array.prototype.slice.call(arguments);return e.splice(0,0,30),ve.smfSMPTE(new Ot(e))},smfTimeSignature:function(t,e,n,r){var i,o,s,a,u=(""+t).match(/^\s*(\d+)\s*\/\s*(\d+)\s*$/);if(u){if(i=parseInt(u[1]),o=parseInt(u[2]),i>0&&i<256&&o>0&&!(o&o-1)){for(s=o,o=0,s>>=1;s;s>>=1)o++;return s=e==parseInt(e)?e:24,a=n==parseInt(n)?n:8,ye(88,String.fromCharCode(i)+String.fromCharCode(o)+String.fromCharCode(s)+String.fromCharCode(a))}if(4==(""+t).length)return ye(88,t)}else if(t==parseInt(t)&&e==parseInt(e)){if(t>0&&t<256&&e>0&&!(e&e-1)){for(i=t,o=0,s=e,s>>=1;s;s>>=1)o++;return s=n==parseInt(n)?n:24,a=r==parseInt(r)?r:8,ye(88,String.fromCharCode(i)+String.fromCharCode(o)+String.fromCharCode(s)+String.fromCharCode(a))}if(4==(""+t).length)return ye(88,t);t=t+"/"+e}else if(4==(""+t).length)return ye(88,t);throw RangeError("Wrong time signature"+qe(Re(""+t)))},smfKeySignature:function(t){var e=(t=""+t).match(/^\s*([A-H][b#]?)\s*(|maj|major|dur|m|min|minor|moll)\s*$/i);if(e){var n={CB:0,GB:1,DB:2,AB:3,EB:4,BB:5,F:6,C:7,G:8,D:9,A:10,E:11,B:12,H:12,"F#":13,"C#":14,"G#":15,"D#":16,"A#":17}[e[1].toUpperCase()],r={"":0,MAJ:0,MAJOR:0,DUR:0,M:1,MIN:1,MINOR:1,MOLL:1}[e[2].toUpperCase()];void 0!==n&&void 0!==r&&(r&&(n-=3),(n-=7)>=-7&&n<0?t=String.fromCharCode(256+n)+String.fromCharCode(r):n>=0&&n<=7&&(t=String.fromCharCode(n)+String.fromCharCode(r)))}if(2==t.length&&t.charCodeAt(1)<=1&&(t.charCodeAt(0)<=7||t.charCodeAt(0)<=255&&t.charCodeAt(0)>=249))return ye(89,t);throw RangeError("Incorrect key signature"+qe(t))},smfSequencer:function(t){return ye(127,Re(t))}},be={};function we(t,e){Pt[t]=function(){return new Pt(e.apply(this,arguments))},be[t]=function(){return this.send(e.apply(this,arguments))}}function xe(t,e){Pt[t]=function(){return e.apply(this,arguments)},be[t]=function(){return this.send(e.apply(this,arguments))}}function Te(t,e){Pt[t]=function(){var t,n=[],r=e.apply(this,arguments);for(t=0;t<r.length;t++)n.push(new Pt(r[t]));return n},be[t]=function(){for(var t=e.apply(this,arguments),n=this,r=0;r<t.length;r++)n=n.send(t[r]);return n}}function ke(t,e){Pt[t]=function(){return new Pt(e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))))},be[t]=function(){if(void 0!==this._master){var t=new Pt(e.apply(this,[this._master].concat(Array.prototype.slice.call(arguments))));return t._mpe=t[1],this.send(t)}return this.send(e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))))}}function Se(t,e){Pt[t]=function(){return new Pt(e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))))},be[t]=function(){if(void 0!==this._master){var t,n=Array.prototype.slice.call(arguments);n.length<e.length?n=[this._master].concat(n):(t=Zt(n[0]),n[0]=this._master);var r=new Pt(e.apply(this,n));return r._mpe=t,this.send(r)}return this.send(e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))))}}function Ae(t,e){Pt[t]=function(){var t,n=[],r=e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments)));for(t=0;t<r.length;t++)n.push(new Pt(r[t]));return n},be[t]=function(){var t,n,r;if(void 0!==this._master){var i,o=Array.prototype.slice.call(arguments);for(o.length<e.length?o=[this._master].concat(o):(i=Zt(o[0]),o[0]=this._master),n=e.apply(this,o),r=this,t=0;t<n.length;t++){var s=Pt(n[t]);s._mpe=i,r=r.send(s)}return r}for(n=e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))),r=this,t=0;t<n.length;t++)r=r.send(n[t]);return r}}function Ee(t){E(be,function(e){t.prototype[e]=be[e]})}E(fe,function(t){we(t,fe[t])}),E(me,function(t){we(t,me[t])}),E(ve,function(t){xe(t,ve[t])}),E(_e,function(t){Te(t,_e[t])}),E(le,function(t){ke(t,le[t])}),E(he,function(t){Se(t,he[t])}),E(ge,function(t){Ae(t,ge[t])}),Ee(V);var Oe={a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};for(i=0;i<16;i++)Oe[i]=i;function Ce(t,e){return 127==t&&void 0!==e&&67==e.charCodeAt(0)&&123==e.charCodeAt(1)}function Me(t,e){return Ce(t,e)&&1==e.charCodeAt(2)}function Ne(t,e){if(t>=0&&t<=127&&e>=0&&e<=127){var n=15&t,r=t>>4;return n>0&&n<8&&r<7?(n=["C","D","E","F","G","A","B"][n-1]+["bbb","bb","b","","#","##","###"][r],e>34?n+"?":n+["","6","Maj7","Maj7(#11)","(9)","Maj7(9)","6(9)","aug","m","m6","m7","m7b5","m(9)","m7(9)","m7(11)","m+7","m+7(9)","dim","dim7","7","7sus4","7b5","7(9)","7(#11)","7(13)","7(b9)","7(b13)","7(#9)","Maj7aug","7aug","1+8","1+5","sus4","1+2+5","cc"][e]):"-"}return"-"}function Ie(t){for(var e=[],n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function je(t){for(var e="",n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e}function Re(t){return t instanceof Array?je(t):void 0===t?"":""+t}function Pe(t){for(var e=0,n=0;n<t.length;n++)e=(e<<8)+t.charCodeAt(n);return e}function De(t){return(t<16?"0":"")+t.toString(16)}function Le(t){for(var e=[],n=0;n<t.length;n++)e.push(De(t[n]));return e.join(" ")}function Fe(t){for(var e=[],n=0;n<t.length;n++)n&&n%4==0&&e.push(" "),e.push(De(t[n]));return e.join("")}function $e(t){for(var e="",n=0;n<t.length;n++)"\n"==t[n]?e+="\\n":"\r"==t[n]?e+="\\r":"\t"==t[n]?e+="\\t":t.charCodeAt(n)<32?e+="\\x"+De(t.charCodeAt(n)):e+=t[n];return e}function Be(t){return t.length?": "+Le(Ie(t)):""}function qe(t){return t.length?": "+$e(At.lib.fromUTF8(t)):""}function Ue(t){void 0===t?this._cc={}:this._cc[t]={}}function Ve(t,e){var n=void 0===t?"??":De(t),r=void 0===e?"??":De(e),i={"0000":"Pitch Bend Sensitivity","0001":"Channel Fine Tuning","0002":"Channel Coarse Tuning","0003":"Select Tuning Program","0004":"Select Tuning Bank","0005":"Vibrato Depth Range","7f7f":"NONE"}[n+""+r];return"RPN "+n+" "+r+(i?": "+i:"")}function Ge(t,e){return"NRPN "+(void 0===t?"??":De(t))+" "+(void 0===e?"??":De(e))}function ze(t){var e,n="";for(e=0;e<t.length&&t[e];e++)n+=String.fromCharCode(t[e]);return At.lib.fromUTF8(n)}function We(t){var e,n,r,i,o,s,a,u="x",c="x";if(t.isMidi2?(r=t[0]>>4,n=u=(15&t[0]).toString(16),this._cc[n]||(this._cc[n]={}),2==r?e=new Pt(t.slice(1)):3==r?(i=t[1]>>4,o=15&t[1],s=t.slice(2,2+o),0==i&&(e=new Pt([240].concat(s,[247])),this._cc[n].sx=void 0),1==i&&(this._cc[n].sx=s),2==i&&this._cc[n].sx&&(this._cc[n].sx=this._cc[n].sx.concat(s)),3==i&&this._cc[n].sx&&(s=this._cc[n].sx.concat(s),e=new Pt([240].concat(s,[247])),this._cc[n].sx=void 0)):4==r?(i=t[1]>>4,n=u+(c=(15&t[1]).toString(16)),this._cc[n]||(this._cc[n]={}),12==i&&(1&t[3]&&(this._cc[n].bm=t[6],this._cc[n].bl=t[7]),t._bm=this._cc[n].bm,t._bl=this._cc[n].bl,At.MIDI.programName&&t.label(At.MIDI.programName(t[4],t._bm,t._bl)))):13==r&&(i=t[1]>>6,48&t[1]||(c=(15&t[1]).toString(16)),n=u+c,this._cc[n]||(this._cc[n]={}),s=t.slice(4),0==i&&(t.label(ze(s)),this._cc[n].tx=void 0),1==i&&(this._cc[n].tx=s),2==i&&this._cc[n].tx&&(this._cc[n].tx=this._cc[n].tx.concat(s)),3==i&&this._cc[n].tx&&(s=this._cc[n].tx.concat(s),t.label(ze(s)),this._cc[n].tx=void 0))):e=t,!e||!e.length||e[0]<128)return t;if(255==e[0])return this._clear(),t;if(i=e[0]>>4,c=(15&e[0]).toString(16),n=15==i?u:u+c,this._cc[n]||(this._cc[n]={}),12==i)e._bm=this._cc[n].bm,e._bl=this._cc[n].bl,At.MIDI.programName&&t.label(At.MIDI.programName(e[1],e._bm,e._bl));else if(11==i)switch(e[1]){case 0:this._cc[n].bm=e[2];break;case 32:this._cc[n].bl=e[2];break;case 98:this._cc[n].nl=e[2],this._cc[n].rn="n";break;case 99:this._cc[n].nm=e[2],this._cc[n].rn="n";break;case 100:this._cc[n].rl=e[2],this._cc[n].rn="r";break;case 101:this._cc[n].rm=e[2],this._cc[n].rn="r";break;case 6:case 38:case 96:case 97:"r"==this._cc[n].rn&&(e._rm=this._cc[n].rm,e._rl=this._cc[n].rl,t.label(Ve(this._cc[n].rm,this._cc[n].rl))),"n"==this._cc[n].rn&&(e._nm=this._cc[n].rm,e._nl=this._cc[n].nl,t.label(Ge(this._cc[n].nm,this._cc[n].nl)))}else e.isFullSysEx()&&(127==e[1]?4==e[3]?(a={1:"Master Volume",2:"Master Balance",3:"Master Fine Tuning",4:"Master Coarse Tuning"}[e[4]])&&t.label(a):8==e[3]&&(a={2:"Note Tuning",7:"Note Tuning, Bank",8:"Scale Tuning, 1 byte format",9:"Scale Tuning, 2 byte format"}[e[4]])&&t.label(a):126==e[1]?6==e[3]?1==e[4]?t.label("Device ID Request"):2==e[4]&&t.label("Device ID Response"):8==e[3]?(a={0:"Bulk Tuning Dump Request",1:"Bulk Tuning Dump",3:"Bulk Tuning Dump Request, Bank",4:"Bulk Tuning Dump, Bank",5:"Scale Tuning Dump, 1 byte format",6:"Scale Tuning Dump, 2 byte format",7:"Note Tuning, Bank",8:"Scale Tuning, 1 byte format",9:"Scale Tuning, 2 byte format"}[e[4]])&&t.label(a):9==e[3]&&(1==e[4]?(t.label("GM1 System On"),this._clear(u),this._cc[u].gm="1"):2==e[4]?(t.label("GM System Off"),this._clear(u),this._cc[u].gm="0"):3==e[4]&&(t.label("GM2 System On"),this._clear(u),this._cc[u].gm="2")):67==e[1]?16==(240&e[2])&&76==e[3]&&(0==e[4]&&0==e[5]&&126==e[6]&&0==e[7]?(t.label("XG System On"),this._clear(u),this._cc[u].gm="Y"):0==e[4]&&0==e[5]&&0==e[6]?t.label("XG Master Tuning"):0==e[4]&&0==e[5]&&4==e[6]?t.label("XG Master Volume"):0==e[4]&&0==e[5]&&6==e[6]?t.label("XG Master Transpose"):8==e[4]&&e[5]<16&&e[6]>=65&&e[6]<=76?t.label("XG Scale Tuning"):t.label("XG Parameter")):65==e[1]&&66==e[3]&&18==e[4]&&(64==e[5]&&(0==e[6]?127==e[7]&&0==e[8]&&65==e[9]?(t.label("GS Reset"),this._clear(u),this._cc[u].gm="R"):0==e[7]?t.label("GS Master Tuning"):4==e[7]?t.label("GS Master Volume"):5==e[7]?t.label("GS Master Transpose"):t.label("GS Parameter"):16==(240&e[6])&&21==e[7]?t.label("GS Drum Part Change"):16==(240&e[6])&&e[7]>=64&&e[7]<=75?t.label("GS Scale Tuning"):t.label("GS Parameter")),65==e[5]&&t.label("GS Parameter")));return t}function Je(){var t=new V;return t._clear=Ue,t._read=We,t._receive=function(t){this._emit(this._read(t))},t.gm=function(t){return void 0===t&&(t="x"),this._cc[t]&&this._cc[t].gm||0},t._clear(),t._resume(),t}function He(){var t=this instanceof He?this:t=new He;return t.reset(),arguments.length&&He.prototype.setup.apply(t,arguments),t}function Xe(t){var e,n=this instanceof Xe?this:n=new Xe;if(t instanceof Xe)return n._from=t._from.slice(),E(t,function(e){"_from"!=e&&(n[e]=t[e])}),n;n._from=[],void 0===t&&(t=[0,0,0,0]);var r=t instanceof Array?t:arguments;for(n.length=0,e=0;e<r.length;e++)((s=r[e])!=parseInt(s)||s<0||s>255)&&Bt(r[e]),n.push(s);if(n.length!=[4,4,4,8,8,16,4,4,8,8,8,12,12,16,16,16][n[0]>>4])throw RangeError("Wrong UMP size");return n}function Ke(){}Pt.prototype.getChannel=function(){if(32==this.ff&&1==this.dd.length&&this.dd.charCodeAt(0)<16)return this.dd.charCodeAt(0);var t=this[0];return void 0===t||t<128||t>239?void 0:15&t},Pt.prototype.setChannel=function(t){if(void 0===(t=Oe[t]))return this;if(32==this.ff)this.dd=String.fromCharCode(t);else{var e=this[0];void 0!==e&&e>=128&&e<=239&&(this[0]=240&e|t)}return this},Pt.prototype.getNote=function(){var t=this[0];if(!(void 0===t||t<128||t>175))return this[1]},Pt.prototype.setNote=function(t){var e=this[0];return void 0===e||e<128||e>175||void 0!==(t=Pt.noteValue(t))&&(this[1]=t),this},Pt.prototype.getVelocity=function(){var t=this[0];if(!(void 0===t||t<128||t>159))return this[2]},Pt.prototype.setVelocity=function(t){var e=this[0];return void 0===e||e<128||e>159||(t=parseInt(t))>=0&&t<128&&(this[2]=t),this},Pt.prototype.getSysExId=function(){if(240==this[0])return this[2]},Pt.prototype.setSysExId=function(t){return 240==this[0]&&this.length>2&&(t=parseInt(t))>=0&&t<128&&(this[2]=t),this},Pt.prototype.getData=function(){if(void 0!==this.dd)return this.dd.toString()},Pt.prototype.setData=function(t){return this.dd=Re(t),this},Pt.prototype.getText=function(){if(void 0!==this.dd)return Me(this.ff,this.dd)?Ne(this.dd.charCodeAt(3),this.dd.charCodeAt(4)):At.lib.fromUTF8(this.dd);if(this.isMidiSoft()){for(var t=[],e=6;e<this.length-1;e++)t.push(String.fromCharCode(this[e]));return t.join("")}},Pt.prototype.setText=function(t){return this.dd=At.lib.toUTF8(t),this},Pt.prototype.getTempo=function(){if(81==this.ff&&void 0!==this.dd)return 65536*this.dd.charCodeAt(0)+256*this.dd.charCodeAt(1)+this.dd.charCodeAt(2)},Pt.prototype.getBPM=function(){var t=this.getTempo();if(t)return 6e7/t},Pt.prototype.getTimeSignature=function(){if(88==this.ff&&void 0!==this.dd)return[this.dd.charCodeAt(0),1<<this.dd.charCodeAt(1)]},Pt.prototype.getTimeSignature4=function(){if(88==this.ff&&void 0!==this.dd){var t=[this.dd.charCodeAt(0),1<<this.dd.charCodeAt(1)];return 4==this.dd.length&&t.push(this.dd.charCodeAt(2),this.dd.charCodeAt(3)),t}},Pt.prototype.getKeySignature=function(){if(89==this.ff&&void 0!==this.dd){var t=this.dd.charCodeAt(0),e=this.dd.charCodeAt(1);if(128&t&&(t-=256),t>=-7&&t<=7&&e>=0&&e<=1)return[t,["Cb","Gb","Db","Ab","Eb","Bb","F","C","G","D","A","E","B","F#","C#","G#","D#","A#"][e?t+10:t+7],!!e]}},Pt.prototype.isNoteOn=function(){var t=this[0];return!(void 0===t||t<144||t>159)&&this[2]>0},Pt.prototype.isNoteOff=function(){var t=this[0];return!(void 0===t||t<128||t>159)&&(t<144||0==this[2])},Pt.prototype.isSysEx=function(){return 240==this[0]},Pt.prototype.isFullSysEx=function(){return 240==this[0]&&247==this[this.length-1]},Pt.prototype.isMidiSoft=function(){return this.isFullSysEx()&&0==this[1]&&32==this[2]&&36==this[3]&&0==this[4]},Pt.prototype.isSMF=function(){return this.ff>=0&&this.ff<=127},Pt.prototype.isEOT=function(){return 47==this.ff},Pt.prototype.isText=function(){return 1==this.ff},Pt.prototype.isCopyright=function(){return 2==this.ff},Pt.prototype.isSeqName=function(){return 3==this.ff},Pt.prototype.isInstrName=function(){return 4==this.ff},Pt.prototype.isLyric=function(){return 5==this.ff},Pt.prototype.isMarker=function(){return 6==this.ff},Pt.prototype.isCuePoint=function(){return 7==this.ff},Pt.prototype.isProgName=function(){return 8==this.ff},Pt.prototype.isDevName=function(){return 9==this.ff},Pt.prototype.isTempo=function(){return 81==this.ff},Pt.prototype.isTimeSignature=function(){return 88==this.ff},Pt.prototype.isKeySignature=function(){return 89==this.ff},Pt.prototype.isGmReset=function(){return this.match([240,126,[0,0],9,[0,0],247])},Pt.prototype.isGsReset=function(){return this.match([240,65,[0,0],66,18,64,0,127,0,65,247])},Pt.prototype.isXgReset=function(){return this.match([240,67,[16,240],76,0,0,126,0,247])},Pt.prototype.match=function(t){var e,n;for(e=0;e<t.length;e++)if(void 0===(n=t[e][1])){if(this[e]!=t[e])return!1}else if((this[e]&n)!=(t[e][0]&n))return!1;return!0},Pt.prototype.label=function(t){return this.lbl=this.lbl?this.lbl+", "+t:t,this},Pt.prototype.toString=function(){return this.lbl?this._str()+" ("+this.lbl+")":this._str()},Pt.prototype._str=function(){var t,e;if(this.length)t=Le(this);else{if(void 0===this.ff)return"empty";t="ff"+De(this.ff)}return(e=this._string())?t+" -- "+e:t},Pt.prototype._string=function(){var t,e="";if(!this.length){if(0==this.ff)e+="Sequence Number: "+Pe(this.dd);else if(this.ff>0&&this.ff<10)e+=["","Text","Copyright","Sequence Name","Instrument Name","Lyric","Marker","Cue Point","Program Name","Device Name"][this.ff]+qe(this.dd);else if(32==this.ff)e+="Channel Prefix"+Be(this.dd);else if(33==this.ff)e+="MIDI Port"+Be(this.dd);else if(47==this.ff)e+="End of Track"+Be(this.dd);else if(81==this.ff)e+="Tempo: "+Math.round(100*this.getBPM())/100+" bpm";else if(84==this.ff)e+="SMPTE Offset: "+Rt(Ie(this.dd));else if(88==this.ff){var n=1<<this.dd.charCodeAt(1);e+="Time Signature: "+this.dd.charCodeAt(0)+"/"+n,e+=" "+this.dd.charCodeAt(2)+" "+this.dd.charCodeAt(3)}else if(89==this.ff){e+="Key Signature: ";var r=this.getKeySignature();r?(e+=r[1],r[2]&&(e+=" min")):e+="invalid"}else if(127==this.ff){if(67==this.dd.charCodeAt(0)&&123==this.dd.charCodeAt(1))return e+="[XF:"+De(this.dd.charCodeAt(2))+"]",e+=(t={0:"Version",1:"Chord",2:"Rehearsal Mark",3:"Phrase Mark",4:"Max Phrase Mark",5:"Fingering Number",12:"Guide Track Flag",16:"Guitar Info",18:"Chord Voicing",127:"XG Song Data Number"}[this.dd.charCodeAt(2)])?" "+t:"",e+=": ",0==this.dd.charCodeAt(2)?e+this.dd.substring(3,7)+" "+Le(Ie(this.dd.substring(7))):1==this.dd.charCodeAt(2)?e+this.getText():e+Le(Ie(this.dd.substring(3)));e+="Sequencer Specific"+Be(this.dd)}else e+="SMF"+Be(this.dd);return e}if(t={241:"MIDI Time Code",242:"Song Position",243:"Song Select",244:"Undefined",245:"Undefined",246:"Tune request",248:"Timing clock",249:"Undefined",250:"Start",251:"Continue",252:"Stop",253:"Undefined",254:"Active Sensing",255:"Reset"}[this[0]])return t;if(this.isMidiSoft())return(t=$e(this.getText()))&&(t=" "+t),"[K:"+De(this[5])+"]"+t;var i=this[0]>>4;return(t={8:"Note Off",10:"Aftertouch",12:"Program Change",13:"Channel Aftertouch",14:"Pitch Wheel"}[i])?t:9==i?this[2]?"Note On":"Note Off":11!=i?e:(t={0:"Bank Select MSB",1:"Modulation Wheel MSB",2:"Breath Controller MSB",4:"Foot Controller MSB",5:"Portamento Time MSB",6:"Data Entry MSB",7:"Channel Volume MSB",8:"Balance MSB",10:"Pan MSB",11:"Expression Controller MSB",12:"Effect Control 1 MSB",13:"Effect Control 2 MSB",16:"General Purpose Controller 1 MSB",17:"General Purpose Controller 2 MSB",18:"General Purpose Controller 3 MSB",19:"General Purpose Controller 4 MSB",31:"Karaoke",32:"Bank Select LSB",33:"Modulation Wheel LSB",34:"Breath Controller LSB",36:"Foot Controller LSB",37:"Portamento Time LSB",38:"Data Entry LSB",39:"Channel Volume LSB",40:"Balance LSB",42:"Pan LSB",43:"Expression Controller LSB",44:"Effect control 1 LSB",45:"Effect control 2 LSB",48:"General Purpose Controller 1 LSB",49:"General Purpose Controller 2 LSB",50:"General Purpose Controller 3 LSB",51:"General Purpose Controller 4 LSB",64:"Damper Pedal",65:"Portamento",66:"Sostenuto",67:"Soft Pedal",68:"Legato",69:"Hold 2",70:"Sound Variation",71:"Filter Resonance",72:"Release Time",73:"Attack Time",74:"Brightness",75:"Decay Time",76:"Vibrato Rate",77:"Vibrato Depth",78:"Vibrato Delay",79:"Sound Controller 10",80:"General Purpose Controller 5",81:"General Purpose Controller 6",82:"General Purpose Controller 7",83:"General Purpose Controller 8",84:"Portamento Control",88:"High Resolution Velocity Prefix",91:"Effects 1 Depth",92:"Effects 2 Depth",93:"Effects 3 Depth",94:"Effects 4 Depth",95:"Effects 5 Depth",96:"Data Increment",97:"Data Decrement",98:"Non-Registered Parameter Number LSB",99:"Non-Registered Parameter Number MSB",100:"Registered Parameter Number LSB",101:"Registered Parameter Number MSB",120:"All Sound Off",121:"Reset All Controllers",122:"Local Control On/Off",123:"All Notes Off",124:"Omni Mode Off",125:"Omni Mode On",126:"Mono Mode On",127:"Poly Mode On"}[this[1]],this[1]>=64&&this[1]<=69&&(t+=this[2]<64?" Off":" On"),t||(t="Undefined"),t)},Pt.prototype._stamp=function(t){return this._from.push(t._orig?t._orig:t),this},Pt.prototype._unstamp=function(t){if(void 0===t)this._from=[];else{t._orig&&(t=t._orig);var e=this._from.indexOf(t);e>-1&&this._from.splice(e,1)}return this},Pt.prototype._stamped=function(t){t._orig&&(t=t._orig);for(var e=0;e<this._from.length;e++)if(this._from[e]==t)return!0;return!1},At.MIDI=Pt,A.prototype.MIDI=Pt,At.Context=Je,A.prototype.Context=Je,He.validate=function(t){var e=t instanceof Array?t:arguments;if(e[0]!=parseInt(e[0])||e[0]<0||e[0]>14)throw RangeError("Bad master channel value: "+e[0]);if(e[1]!=parseInt(e[1])||e[1]<0||e[0]+e[1]>15)throw RangeError("Bad zone size value: "+e[1])},He.prototype.reset=function(){for(var t=0;t<16;t++)this[t]={band:0,master:t}},He.prototype.setup=function(t,e){var n;He.validate(t,e);var r=t+e;if((this[t].master!=t||this[t].band!=e)&&(e||this[t].band)){for(this[t].band?r<(n=t+this[t].band)&&(r=n):this[t].master==t-1?(n=t-1,r<(n+=this[n].band)&&(r=n),this[t-1]={band:0,master:t-1}):this[t].master!=t&&(n=this[t].master,r<(n+=this[n].band)&&(r=n),this[this[t].master].band=t-this[t].master-1),this[t].master=t,this[t].band=e,n=t+1;n<=t+e;n++)this[n].band&&r<n+this[n].band&&(r=n+this[n].band),this[n]={band:0,master:t};for(;n<=r;n++)this[n]={band:0,master:n}}},He.prototype.filter=function(t){var e=t.getChannel();if(!this[e]||!this[this[e].master].band)return t;var n,r,i,o=this[e].master,s=this[o].band;if(void 0!==t._mpe){for(i=256,n=o+1;n<=o+s;n++)if(this[n].notes){for(i>this[n].notes.length&&(e=n,i=this[n].notes.length),r=0;r<this[n].notes.length;r++)if(this[n].notes[r]==t._mpe){e=n,i=-1;break}}else i>0&&(e=n,i=0);t.setChannel(e),t._mpe=void 0}return e==o||(t.isNoteOn()?(this[e].notes||(this[e].notes=[]),k(this[e].notes,t.getNote())):t.isNoteOff()&&this[e].notes&&S(this[e].notes,t.getNote())),t},At.MPE=He,Xe.prototype=[],Xe.prototype.constructor=Xe,Xe.prototype.isMidi=function(){return 2},Xe.prototype.isMidi2=!0,Xe.prototype.dump=function(){var t,e="";for(t=0;t<this.length;t++)e+=String.fromCharCode(this[t]);return e},Ke.prototype=Xe,Xe._sxid=127,Xe.sxId=function(t){if(void 0===t&&(t=Xe._sxid),t==this._sxid)return this;t=zt(t);var e=new Ke;return e._ch=this._ch,e._gr=this._gr,e._sxid=t,e},Xe.ch=function(t){if(t==this._ch||void 0===t&&void 0===this._ch)return this;var e=new Ke;return void 0!==t&&(t=Vt(t)),e._ch=t,e._gr=this._gr,e._sxid=this._sxid,e},Xe.gr=function(t){if(t==this._gr||void 0===t&&void 0===this._gr)return this;var e=new Ke;return void 0!==t&&(t=Gt(t)),e._ch=this._ch,e._gr=t,e._sxid=this._sxid,e},Xe.prototype.getGroup=function(){if(this[0]){var t=this[0]>>4;return 1==t||2==t||3==t||4==t||5==t||13==t?15&this[0]:void 0}};var Qe=[0,0,0,0,0,0,0,0,0,0,0,0,0];function Ze(t,e,n,r){return void 0!==e?[Wt(t),Wt(e),Wt(n),Wt(r)]:[(t=Qt(t))>>24&255,t>>16&255,t>>8&255,255&t]}function Ye(t){return(t=Math.floor(4294967296*t))>4294967295?4294967295:t<0?0:t}var tn={noop:function(){return[0,0,0,0]},umpClock:function(t){return[0,16,(t=Ht(t))>>8,255&t]},umpTimestamp:function(t){return[0,32,(t=Ht(t))>>8,255&t]},umpTicksPQN:function(t){return[0,48,(t=Ht(t))>>8,255&t]},umpDelta:function(t){return[0,64+((t=Xt(t=t||0))>>16),t>>8&255,255&t]},umpStartClip:function(){return[240,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},umpEndClip:function(){return[240,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},en={umpTempo:function(t,e){return[208+Gt(t),16,0,0].concat(Ze(e),[0,0,0,0,0,0,0,0])},umpBPM:function(t,e){return en.umpTempo(t,Math.round(6e9/e))},umpTimeSignature:function(t,e,n){var r,i,o,s=(""+e).match(/^\s*(\d+)\s*\/\s*(\d+)\s*$/);if(s?(r=parseInt(s[1]),i=parseInt(s[2])):e==parseInt(e)&&n==parseInt(n)&&(r=parseInt(e),i=parseInt(n)),r>0&&r<256&&i>0&&!(i&i-1)){for(o=0,i>>=1;i;i>>=1)o++;if((i=Math.round(32*r/(1<<o)))<256)return[208+Gt(t),16,0,1,r,o,i,0,0,0,0,0,0,0,0,0]}throw RangeError("Wrong time signature "+e+(void 0===n?"":"/"+n))}},nn={umpMetadata:function(t,e){return sn.umpCustomText(t,0,1,1,0,e)},umpProjectName:function(t,e){return sn.umpCustomText(t,0,1,1,1,e)},umpCompositionName:function(t,e){return sn.umpCustomText(t,0,1,1,2,e)},umpClipName:function(t,e){return sn.umpCustomText(t,0,1,1,3,e)},umpCopyright:function(t,e){return sn.umpCustomText(t,0,1,1,4,e)},umpComposerName:function(t,e){return sn.umpCustomText(t,0,1,1,5,e)},umpLyricistName:function(t,e){return sn.umpCustomText(t,0,1,1,6,e)},umpArrangerName:function(t,e){return sn.umpCustomText(t,0,1,1,7,e)},umpPublisherName:function(t,e){return sn.umpCustomText(t,0,1,1,8,e)},umpPerformerName:function(t,e){return sn.umpCustomText(t,0,1,1,9,e)},umpAccPerformerName:function(t,e){return sn.umpCustomText(t,0,1,1,10,e)},umpRecordingDate:function(t,e){return sn.umpCustomText(t,0,1,1,11,e)},umpRecordingLocation:function(t,e){return sn.umpCustomText(t,0,1,1,12,e)},umpText:function(t,e){return sn.umpCustomText(t,0,1,2,0,e)},umpLyrics:function(t,e){return sn.umpCustomText(t,0,1,2,1,e)},umpLyricsLanguage:function(t,e){return sn.umpCustomText(t,0,1,2,2,e)},umpRuby:function(t,e){return sn.umpCustomText(t,0,1,2,3,e)},umpRubyLanguage:function(t,e){return sn.umpCustomText(t,0,1,2,4,e)},umpData:function(t,e,n){var r;void 0===n&&(n=e,e=0);var i=fn(gn(n),13);for(r=0;r<i.length;r++)i[r]=[80+Gt(t),16*pn(i.length,r)+i[r].length,Wt(e)].concat(i[r],Qe).slice(0,16);return i}},rn=[0,6,32,38,98,99,100,101],on={umpNoteOn:function(t,e,n,r,i,o){return void 0===r&&(r=65535),i=i||0,o=o||0,r=Ht(r),o=Ht(o),[64+Gt(t),144+Vt(e),Zt(n),Wt(i),r>>8,255&r,o>>8,255&o]},umpNoteOff:function(t,e,n,r,i,o){return i=i||0,o=o||0,r=Ht(r=r||0),o=Ht(o),[64+Gt(t),128+Vt(e),Zt(n),Wt(i),r>>8,255&r,o>>8,255&o]},umpAftertouch:function(t,e,n,r,i,o,s){return[64+Gt(t),160+Vt(e),Zt(n),0].concat(Ze(r,i,o,s))},umpAftertouchF:function(t,e,n,r){return on.umpAftertouch(t,e,n,Ye(r))},umpControl:function(t,e,n,r,i,o,s){return rn.includes(n)&&Bt(n),[64+Gt(t),176+Vt(e),zt(n),0].concat(Ze(r,i,o,s))},umpPortamento:function(t,e,n){return[64+Gt(t),176+Vt(e),84,0,Zt(n),0,0,0]},umpPressure:function(t,e,n,r,i,o){return[64+Gt(t),208+Vt(e),0,0].concat(Ze(n,r,i,o))},umpPressureF:function(t,e,n){return on.umpPressure(t,e,Ye(n))},umpProgram:function(t,e,n,r,i){return void 0===r&&void 0===i?[64+Gt(t),192+Vt(e),0,0,Zt(n),0,0,0]:void 0===i?[64+Gt(t),192+Vt(e),0,1,Zt(n),0,te(r),Yt(r)]:[64+Gt(t),192+Vt(e),0,1,Zt(n),0,zt(r),zt(i)]},umpPitchBend:function(t,e,n,r,i,o){return[64+Gt(t),224+Vt(e),0,0].concat(Ze(n,r,i,o))},umpPitchBendF:function(t,e,n){return on.umpPitchBend(t,e,Ye((n+1)/2))},umpPnPitchBend:function(t,e,n,r,i,o,s){return[64+Gt(t),96+Vt(e),Zt(n),0].concat(Ze(r,i,o,s))},umpPnPitchBendF:function(t,e,n,r){return on.umpPnPitchBend(t,e,n,Ye((r+1)/2))},umpRPN:function(t,e,n,r,i,o,s,a){return[64+Gt(t),32+Vt(e),zt(n),zt(r)].concat(Ze(i,o,s,a))},umpNRPN:function(t,e,n,r,i,o,s,a){return[64+Gt(t),48+Vt(e),zt(n),zt(r)].concat(Ze(i,o,s,a))},umpPnRPN:function(t,e,n,r,i,o,s,a){return[64+Gt(t),0+Vt(e),Zt(n),Wt(r)].concat(Ze(i,o,s,a))},umpPnNRPN:function(t,e,n,r,i,o,s,a){return[64+Gt(t),16+Vt(e),Zt(n),Wt(r)].concat(Ze(i,o,s,a))},umpFineTuning:function(t,e,n,r,i,o){return on.umpRPN(t,e,0,1,n,r,i,o)},umpFineTuningF:function(t,e,n){return on.umpFineTuning(t,e,Pt.to32b(re((n%1+1)/2,n)))},umpCoarseTuning:function(t,e,n){return[64+Gt(t),32+Vt(e),0,2,2*zt(n),0,0,0]},umpCoarseTuningF:function(t,e,n){return on.umpCoarseTuning(t,e,n-n%1+64)},umpTuningProgram:function(t,e,n){return[64+Gt(t),32+Vt(e),0,3,2*zt(n),0,0,0]},umpTuningBank:function(t,e,n){return[64+Gt(t),32+Vt(e),0,4,2*zt(n),0,0,0]},umpPnManagement:function(t,e,n,r){for(var i=r.toString().split(""),o=0,s=0;s<i.length;s++)if("S"!=i[s]||1&o){if("D"!=i[s]||2&o){o=r;break}o|=2}else o|=1;return[64+Gt(t),240+Vt(e),Zt(n),Wt(o),0,0,0,0]}};on.umpPnPressure=on.umpAftertouch,on.umpPnPressureF=on.umpAftertouchF,on.umpTranspose=on.umpCoarseTuningF;var sn={umpTuningF:function(t,e,n){return[on.umpCoarseTuningF(t,e,n),on.umpFineTuningF(t,e,n)]},umpTuningA:function(t,e,n){return sn.umpTuningF(t,e,Pt.shift(n))},umpCustomText:function(t,e,n,r,i,o){var s,a=[];for(o=At.lib.toUTF8(""+o),s=0;s<o.length;s++)a.push(o.charCodeAt(s));for(a=fn(a,12),s=0;s<a.length;s++)a[s]=[208+Gt(t),64*pn(a.length,s)+(n?16:0)+Vt(e),r,i].concat(a[s],Qe).slice(0,16);return a},umpCMetadata:function(t,e,n){return sn.umpCustomText(t,e,0,1,0,n)},umpCProjectName:function(t,e,n){return sn.umpCustomText(t,e,0,1,1,n)},umpCCompositionName:function(t,e,n){return sn.umpCustomText(t,e,0,1,2,n)},umpCClipName:function(t,e,n){return sn.umpCustomText(t,e,0,1,3,n)},umpCCopyright:function(t,e,n){return sn.umpCustomText(t,e,0,1,4,n)},umpCComposerName:function(t,e,n){return sn.umpCustomText(t,e,0,1,5,n)},umpCLyricistName:function(t,e,n){return sn.umpCustomText(t,e,0,1,6,n)},umpCArrangerName:function(t,e,n){return sn.umpCustomText(t,e,0,1,7,n)},umpCPublisherName:function(t,e,n){return sn.umpCustomText(t,e,0,1,8,n)},umpCPerformerName:function(t,e,n){return sn.umpCustomText(t,e,0,1,9,n)},umpCAccPerformerName:function(t,e,n){return sn.umpCustomText(t,e,0,1,10,n)},umpCRecordingDate:function(t,e,n){return sn.umpCustomText(t,e,0,1,11,n)},umpCRecordingLocation:function(t,e,n){return sn.umpCustomText(t,e,0,1,12,n)},umpCText:function(t,e,n){return sn.umpCustomText(t,e,0,2,0,n)},umpCLyrics:function(t,e,n){return sn.umpCustomText(t,e,0,2,1,n)},umpCLyricsLanguage:function(t,e,n){return sn.umpCustomText(t,e,0,2,2,n)},umpCRuby:function(t,e,n){return sn.umpCustomText(t,e,0,2,3,n)},umpCRubyLanguage:function(t,e,n){return sn.umpCustomText(t,e,0,2,4,n)}},an={};function un(t,e){Xe[t]=function(){return new Xe(e.apply(this,arguments))},an[t]=function(){return this.send(e.apply(this,arguments))}}function cn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),new Xe(e.apply(this,t))},an[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),this.send(e.apply(this,t))}}function ln(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=e.apply(this,t),r=0;r<n.length;r++)n[r]=new Xe(n[r]);return n},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=e.apply(this,t),r=0;r<n.length;r++)this.send(n[r]);return this}}function hn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1))),new Xe(e.apply(this,t))},an[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1))),this.send(e.apply(this,t))}}function dn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1)));for(var n=e.apply(this,t),r=0;r<n.length;r++)n[r]=new Xe(n[r]);return n},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1)));for(var n=e.apply(this,t),r=0;r<n.length;r++)this.send(n[r]);return this}}function pn(t,e){return 1==t?0:0==e?1:e==t-1?3:2}function fn(t,e){for(var n=[],r=t;r.length;r=r.slice(e))n.push(r.slice(0,e));return n.length?n:[[]]}function mn(t,e){for(var n=fn(e.slice(1,e.length-1),6),r=0;r<n.length;r++)n[r]=new Xe([48+t,16*pn(n.length,r)+n[r].length].concat(n[r],Qe).slice(0,8));return n}function gn(t){var e,n=[];if("string"==typeof t)for(e=0;e<t.length;e++)n.push(t.charCodeAt(e));else for(e=0;e<t.length;e++)n.push(t[e]);for(e=0;e<n.length;e++)if(n[e]!=parseInt(n[e])||n[e]<0||n[e]>255)throw RangeError("Bad data");return n}function _n(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),mn(Gt(t[0]),e.apply(this,t.slice(1)))},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=mn(Gt(t[0]),e.apply(this,t.slice(1))),r=this,i=0;i<n.length;i++)r=r.send(n[i]);return r}}function yn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=e.apply(this,t.slice(1)),r=[],i=0;i<n.length;i++)r=r.concat(mn(Gt(t[0]),n[i]));return r},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=e.apply(this,t.slice(1)),r=this,i=0;i<n.length;i++)for(var o=mn(Gt(t[0]),n[i]),s=0;s<o.length;s++)r=r.send(o[s]);return r}}function vn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),new Xe([16+Gt(t[0])].concat(e.apply(this,t.slice(1)),Qe).slice(0,4))},an[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),this.send([16+Gt(t[0])].concat(e.apply(this,t.slice(1)),Qe).slice(0,4))}}function bn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1))),new Xe([32+Gt(t[0])].concat(e.apply(this,t.slice(1)),Qe).slice(0,4))},an[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1))),this.send([32+Gt(t[0])].concat(e.apply(this,t.slice(1)),Qe).slice(0,4))}}function wn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1)));for(var n=e.apply(this,t.slice(1)),r=0;r<n.length;r++)n[r]=new Xe([32+Gt(t[0])].concat(n[r],Qe).slice(0,4));return n},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1)));for(var n=e.apply(this,t.slice(1)),r=this,i=0;i<n.length;i++)r=r.send([32+Gt(t[0])].concat(n[i],Qe).slice(0,4));return r}}function xn(t){E(an,function(e){t.prototype[e]=an[e]})}function Tn(t,e){var n=256*t+e;return n?n>>9||1:0}function kn(t,e,n,r){return 16777216*t+65536*e+256*n+r>>25&127}function Sn(t,e){return t.gr=e,t}function An(t){if(t.isMidi2){var e,n,r,i=t[0]>>4,o=15&t[0];if(1==i||2==i)this._emit(Sn(new Pt(t.slice(1)),o));else if(3==i)n=t[1]>>4,e=15&t[1],0==n?(this._emit(Sn(new Pt([240].concat(t.slice(2,2+e),[247])),o)),this._sx[o]=void 0):1==n?this._sx[o]=t.slice(2,2+e):2==n?this._sx[o]&&(this._sx[o]=this._sx[o].concat(t.slice(2,2+e))):3==n&&(this._sx[o]&&this._emit(Sn(new Pt([240].concat(this._sx[o],t.slice(2,2+e),[247])),o)),this._sx[o]=void 0);else if(4==i){if(e=t[1]>>4,n=15&t[1],2==e||3==e?(this._emit(Sn(new Pt([176+n,2==e?101:99,t[2]]),o)),this._emit(Sn(new Pt([176+n,2==e?100:98,t[3]]),o)),this._emit(Sn(new Pt([176+n,6,t[4]>>1]),o)),this._emit(Sn(new Pt([176+n,38,64*(1&t[4])+(t[4]>>2)]),o))):8!=e&&9!=e||this._emit(Sn(new Pt([t[1],t[2],Tn(t[4],t[5])]),o)),10==e&&this._emit(Sn(new Pt([t[1],t[2],kn(t[4],t[5],t[6],t[7])]),o)),11==e){if(rn.includes(t[2]))return;this._emit(Sn(new Pt([t[1],t[2],kn(t[4],t[5],t[6],t[7])]),o))}13==e&&this._emit(Sn(new Pt([t[1],kn(t[4],t[5],t[6],t[7])]),o)),14==e?(r=16777216*t[4]+65536*t[5]+256*t[6]+t[4]>>18,this._emit(Sn(new Pt([t[1],127&r,r>>7&127]),o))):12==e&&(t[3]&&(this._emit(Sn(new Pt([176+n,0,t[6]]),o)),this._emit(Sn(new Pt([176+n,32,t[7]]),o))),this._emit(Sn(new Pt([t[1],t[4]]),o)))}}else this._emit(t)}function En(){var t=new V;return t._sx=[],t._receive=An,t._resume(),t.MIDI2()}function On(t){if(t.isMidi2)this._emit(t);else{var e=t.gr>=0&&t.gr<=15?t.gr:0;if(t[0]>=128&&t[0]<240)this._emit(At.MIDI2([32+e].concat(t.slice(),Qe).slice(0,4)));else if(t[0]>240&&t[0]<=255&&247!=t[0])this._emit(At.MIDI2([16+e].concat(t.slice(),Qe).slice(0,4)));else if(t.isFullSysEx())for(var n=mn(e,t.slice()),r=0;r<n.length;r++)this._emit(At.MIDI2(n[r]))}}function Cn(){var t=new V;return t._receive=On,t._resume(),t}E(tn,function(t){un(t,tn[t])}),E(en,function(t){cn(t,en[t])}),E(nn,function(t){ln(t,nn[t])}),E(on,function(t){hn(t,on[t])}),E(sn,function(t){dn(t,sn[t])}),E(fe,function(t){vn(t,fe[t])}),E(le,function(t){bn(t,le[t])}),E(he,function(t){bn(t,he[t])}),E(ge,function(t){wn(t,ge[t])}),E(me,function(t){_n(t,me[t])}),E(_e,function(t){yn(t,_e[t])}),xn(Q),Xe.prototype.getTempo=function(){if(this.isTempo())return(this[4]<<24)+(this[5]<<16)+(this[6]<<8)+this[7]},Xe.prototype.getBPM=function(){var t=this.getTempo();if(t)return Math.round(6e9/t)},Xe.prototype.getTimeSignature=function(){if(this.isTimeSignature())return[this[4],1<<this[5]]},Xe.prototype.getTicksPQN=function(){if(this.isTicksPQN())return(this[2]<<8)+this[3]},Xe.prototype.getDelta=function(){if(this.isDelta())return((15&this[1])<<16)+(this[2]<<8)+this[3]},Xe.prototype.getStatus=function(){return this.isFlex()?this[1]>>6:this.isData()||this.isSX()?this[1]>>4:void 0},Xe.prototype.isTempo=function(){return this[0]>>4==13&&this[1]>>4==1&&0==this[2]&&0==this[3]},Xe.prototype.isTimeSignature=function(){return this[0]>>4==13&&this[1]>>4==1&&0==this[2]&&1==this[3]},Xe.prototype.isTicksPQN=function(){return 0==this[0]&&this[1]>>4==3},Xe.prototype.isDelta=function(){return 0==this[0]&&this[1]>>4==4},Xe.prototype.isStartClip=function(){return this.match([240,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0])},Xe.prototype.isEndClip=function(){return this.match([240,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0])},Xe.prototype.isData=function(){return 80==(240&this[0])},Xe.prototype.isFlex=function(){return 208==(240&this[0])},Xe.prototype.isText=function(){return 208==(240&this[0])&&(1==this[2]||2==this[2])},Xe.prototype.isSX=function(){return 48==(240&this[0])},Xe.prototype.isNoteOn=function(){var t=(this[0]||0)>>4,e=(this[1]||0)>>4;return 4==t?9==e:2==t&&9==e&&!!this[3]},Xe.prototype.isNoteOff=function(){var t=(this[0]||0)>>4,e=(this[1]||0)>>4;return 4==t?8==e:2==t&&(8==e||9==e&&!this[3])},Xe.prototype.label=Pt.prototype.label,Xe.prototype.toString=Pt.prototype.toString,Xe.prototype._str=function(){var t=this._string();return t?Fe(this)+" -- "+t:Fe(this)},Xe.prototype._string=function(){var t,e,n,r=this[0]>>4;return 1==r||2==r?new Pt(this.slice(1))._string():(0==r?e=["NOOP","JR Clock","JR Timestamp","Ticks Per Quarter Note","Delta Ticks"][t=this[1]>>4]:3==r?e="SysEx":4==r?(e={0:"Registered Per-Note Controller",1:"Assignable Per-Note Controller",2:"Registered Controller",3:"Assignable Controller",4:"Relative Registered Controller",5:"Relative Assignable Controller",6:"Per-Note Pitch Bend",8:"Note Off",9:"Note On",10:"Poly Pressure",11:"Control Change",12:"Program Change",13:"Channel Pressure",14:"Pitch Bend",15:"Per-Note Management"}[t=this[1]>>4],11==t&&(e={84:"Portamento"}[this[2]]||e),2==t&&(n={"0000":"Pitch Bend Sensitivity","0001":"Fine Tuning","0002":"Coarse Tuning","0003":"Select Tuning Program","0004":"Select Tuning Bank","0005":"Vibrato Depth Range","7f7f":"NONE"}[De(this[2])+""+De(this[3])])&&(e+=": "+n)):5==r?e="Data":13==r&&(0==(t=this[2])?(e={0:"Tempo ",1:"Time Signature ",2:"Metronome",5:"Key Signature",6:"Chord Name"}[t=this[3]],0==t?e+=this.getBPM()+" BPM":1==t&&(e+=this.getTimeSignature().join("/"))):1==t?e={0:"Metadata",1:"Project Name",2:"Composition Name",3:"Clip Name",4:"Copyright",5:"Composer Name",6:"Lyricist Name",7:"Arranger Name",8:"Publisher Name",9:"Primary Performer Name",10:"Accompanying Performer Name",11:"Recording Date",12:"Recording Location"}[t=this[3]]||"Unknown Text":2==t&&(e={0:"Text",1:"Lyrics",2:"Lyrics Language",3:"Ruby",4:"Ruby Language"}[t=this[3]]||"Unknown Text")),15==r&&(e={32:"Start of Clip",33:"End of Clip"}[this[1]]),e)},Xe.prototype._stamp=Pt.prototype._stamp,Xe.prototype._unstamp=Pt.prototype._unstamp,Xe.prototype._stamped=Pt.prototype._stamped,Xe.prototype.match=Pt.prototype.match,At.UMP=Xe,A.prototype.UMP=Xe,At.MIDI2=Xe,A.prototype.MIDI2=Xe,At.M2M1=En,A.prototype.M2M1=At.M2M1,At.M1M2=Cn,A.prototype.M1M2=At.M1M2,At.lib={},At.lib.now=h,At.lib.schedule=d,At.lib.R=m;var Mn,Nn,In=[],jn=0;try{var Rn=URL.createObjectURL(new Blob(["(",function(){function t(){postMessage({}),setTimeout(t,0)}t()}.toString(),")()"],{type:"application/javascript"})),Pn=function(){for(var t=In.length,e=0;e<t;e++)In.shift()();++jn>20&&Mn&&(Mn.terminate(),Mn=void 0)},Dn=function(t){In.push(t),jn=0,Mn||((Mn=new Worker(Rn)).onmessage=Pn)};Dn(function(){At.lib.schedule=Dn})}catch(t){}function Ln(){if(!Nn&&"undefined"!=typeof window){var t=window.AudioContext||window.webkitAudioContext;if(t){(Nn=new t)&&!Nn.createGain&&(Nn.createGain=Nn.createGainNode);var e=function(){if("running"!=Nn.state){Nn.resume();var t=Nn.createOscillator(),n=Nn.createGain();try{n.gain.value=0}catch(t){}n.gain.setTargetAtTime(0,Nn.currentTime,.01),t.connect(n),n.connect(Nn.destination),t.start||(t.start=t.noteOn),t.stop||(t.stop=t.noteOff),t.start(.1),t.stop(.11)}else"undefined"!=typeof document&&(document.removeEventListener("touchstart",e),document.removeEventListener("touchend",e),document.removeEventListener("mousedown",e),document.removeEventListener("keydown",e))};"undefined"!=typeof document&&(document.addEventListener("touchstart",e),document.addEventListener("touchend",e),document.addEventListener("mousedown",e),document.addEventListener("keydown",e)),e()}}}At.lib.openMidiOut=function(t,e){var n=new V;return e._openOut(n),n._info=e._info(t),n},At.lib.openMidiIn=function(t,e){var n=new V;return e._openIn(n),n._info=e._info(t),n},At.lib.registerMidiOut=function(t,e){for(var n=e._info(t),r=0;r<ut._outs.length;r++)if(ut._outs[r].name==n.name)return!1;return n.engine=e,ut._outs.push(n),C&&(D(),C._bad&&(C._repair(),C._resume())),!0},At.lib.registerMidiIn=function(t,e){for(var n=e._info(t),r=0;r<ut._ins.length;r++)if(ut._ins[r].name==n.name)return!1;return n.engine=e,ut._ins.push(n),C&&(D(),C._bad&&(C._repair(),C._resume())),!0},At.lib.unregisterMidiOut=function(t){for(var e=0;e<ut._outs.length;e++)if(ut._outs[e].name==t)return ut._outs.splice(e,e+1),C&&D(),!0;return!1},At.lib.unregisterMidiIn=function(t){for(var e=0;e<ut._ins.length;e++)if(ut._ins[e].name==t)return ut._ins.splice(e,e+1),C&&D(),!0;return!1},At.lib.plug=function(t){for(var e=0;e<ct.length;e++)if(ct[e]==t)return;ct.push(t)},At.lib.unplug=function(t){for(var e=0;e<ct.length;e++)if(ct[e]==t)return void ct.splice(e,1)},At.lib.copyMidiHelpers=Ee,At.lib.copyMidi2Helpers=xn,At.lib.copyUmpHelpers=xn,At.lib.getAudioContext=function(){return Ln(),Nn},At.lib.closeAudioContext=function(){Nn&&Nn.close(),Nn=void 0};var Fn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";At.lib.fromBase64=function(t){var e,n,r,i,o,s,a="",u=0;for(t=t.replace(/[^A-Za-z0-9+/=]/g,"");u<t.length;)e=Fn.indexOf(t.charAt(u++))<<2|(i=Fn.indexOf(t.charAt(u++)))>>4,n=(15&i)<<4|(o=Fn.indexOf(t.charAt(u++)))>>2,r=(3&o)<<6|(s=Fn.indexOf(t.charAt(u++))),a+=String.fromCharCode(e),64!=o&&(a+=String.fromCharCode(n)),64!=s&&(a+=String.fromCharCode(r));return a},At.lib.toBase64=function(t){var e,n,r,i,o,s=0,a=0,u="",c=[];if(!t)return t;do{e=(o=t.charCodeAt(s++)<<16|t.charCodeAt(s++)<<8|t.charCodeAt(s++))>>18&63,n=o>>12&63,r=o>>6&63,i=63&o,c[a++]=Fn.charAt(e)+Fn.charAt(n)+Fn.charAt(r)+Fn.charAt(i)}while(s<t.length);u=c.join("");var l=t.length%3;return l?u.slice(0,l-3)+"===".slice(l):u},At.lib.fromUTF8=function(t){t=void 0===t?"":""+t;var e,n,r,i="";for(e=0;e<t.length;e++){if((n=t.charCodeAt(e))>255)return t;if(n<128)i+=t[e];else if(192==(224&n)){if(n=(31&n)<<6,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;n+=63&r,i+=String.fromCharCode(n)}else if(224==(240&n)){if(n=(15&n)<<12,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;if(n+=(63&r)<<6,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;n+=63&r,i+=String.fromCharCode(n)}else if(240==(248&n)){if(n=(7&n)<<18,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;if(n+=(63&r)<<12,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;if(n+=(63&r)<<6,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;if((n+=63&r)>1114111)return t;n-=65536,i+=String.fromCharCode(55296+(n>>10)),i+=String.fromCharCode(56320+(1023&n))}}return i},At.lib.toUTF8=function(t){t=void 0===t?"":""+t;var e,n,r="";for(e=0;e<t.length;e++)(n=t.charCodeAt(e))<128?r+=t[e]:n<2048?(r+=String.fromCharCode(192+(n>>6)),r+=String.fromCharCode(128+(63&n))):n<65536?(r+=String.fromCharCode(224+(n>>12)),r+=String.fromCharCode(128+(n>>6&63)),r+=String.fromCharCode(128+(63&n))):(r+=String.fromCharCode(240+(n>>18)),r+=String.fromCharCode(128+(n>>12&63)),r+=String.fromCharCode(128+(n>>6&63)),r+=String.fromCharCode(128+(63&n)));return r};var $n=[],Bn={},qn={},Un=a.Promise;function Vn(t,e,n){this.name=t,this.message=e,this.code=n}function Gn(t,e){this.bubbles=!1,this.cancelBubble=!1,this.cancelable=!1,this.currentTarget=e,this.defaultPrevented=!1,this.eventPhase=0,this.path=[],this.port=t,this.returnValue=!0,this.srcElement=e,this.target=e,this.timeStamp=h(),this.type="statechange"}function zn(t,e){this.bubbles=!1,this.cancelBubble=!1,this.cancelable=!1,this.currentTarget=t,this.data=e,this.defaultPrevented=!1,this.eventPhase=0,this.path=[],this.receivedTime=h(),this.returnValue=!0,this.srcElement=t,this.target=t,this.timeStamp=this.receivedTime,this.type="midimessage"}function Wn(t,e){t&&(t.onstatechange&&t.onstatechange(new Gn(t,t)),e.onstatechange&&e.onstatechange(new Gn(t,e)))}function Jn(t,e){var n=this,r=!1,i=null,o=null;this.type="input",this.id=e.id,this.name=e.name,this.manufacturer=e.man,this.version=e.ver,Object.defineProperty(this,"state",{get:function(){return e.connected?"connected":"disconnected"},enumerable:!0}),Object.defineProperty(this,"connection",{get:function(){return r?e.proxy?"open":"pending":"closed"},enumerable:!0}),Object.defineProperty(this,"onmidimessage",{get:function(){return o},set:function(t){f(t)?(o=t,r||n.open().then(p,p)):o=null},enumerable:!0}),Object.defineProperty(this,"onstatechange",{get:function(){return i},set:function(t){i=f(t)?t:null},enumerable:!0}),this.open=function(){return new Un(function(i,o){r?i(n):e.open().then(function(){r||(r=!0,Wn(n,t)),i(n)},function(){o(new Vn("InvalidAccessError","Port is not available",15))})})},this.close=function(){return new Un(function(i){r&&(r=!1,e.close(),Wn(n,t)),i(n)})},Object.freeze(this)}function Hn(t){for(var e,n;t.length;){for(e=0;e<t.length&&!(t[e]==parseInt(t[e])&&t[e]>=128&&t[e]<=255&&247!=t[e]);e++);if(t.splice(0,e),!t.length)return;if(240==t[0]){for(e=1;e<t.length&&247!=t[e];e++);if(e==t.length)return;return t.splice(0,e+1)}if((n=Kn(t[0])+1)>t.length)return;for(e=1;e<n&&!(t[e]!=parseInt(t[e])||t[e]<0||t[e]>=128);e++);if(e==n)return t.splice(0,e);t.splice(0,e)}}function Xn(t,n,r,i){var o=this;this.id=t,this.name=n,this.man=r,this.ver=i,this.connected=!0,this.ports=[],this.pending=[],this.proxy=void 0,this.queue=[],this.onmidi=function(t){var n;for(o.queue=o.queue.concat(t.slice()),n=Hn(o.queue);n;n=Hn(o.queue))for(e=0;e<o.ports.length;e++)o.ports[e][0].onmidimessage&&(240!=n[0]||o.ports[e][1])&&o.ports[e][0].onmidimessage(new zn(o,new Uint8Array(n)))}}function Kn(t){return t>=128&&t<=191||t>=224&&t<=239||242==t?2:t>=192&&t<=223||241==t||243==t?1:0}"function"!=typeof Un&&((Un=function(t){this.executor=t}).prototype.then=function(t,e){"function"!=typeof t&&(t=p),"function"!=typeof e&&(e=p),this.executor(t,e)}),Xn.prototype.open=function(){var t=this;return new Un(function(e,n){var r;t.proxy||!t.connected?e():(t.pending.push([e,n]),1==t.pending.length&&At().openMidiIn(t.name).or(function(){for(r=0;r<t.pending.length;r++)t.pending[r][1]();t.pending=[]}).and(function(){for(t.proxy=this,t.proxy.connect(t.onmidi),r=0;r<t.pending.length;r++)t.pending[r][0]();t.pending=[]}))})},Xn.prototype.close=function(){var t;if(this.proxy){for(t=0;t<this.ports.length;t++)if("open"==this.ports[t].connection)return;this.proxy.close(),this.proxy=void 0}},Xn.prototype.disconnect=function(){this.connected=!1,this.proxy&&(this.proxy.close(),this.proxy=void 0)},Xn.prototype.reconnect=function(){var t,e,n=this,r=[];for(this.connected=!0,t=0;t<$n.length;t++)"closed"==(e=$n[t].inputs.get(this.id)).connection?Wn(e,$n[t]):r.push([e,$n[t]]);r.length&&At()._openMidiInNR(n.name).or(function(){for(t=0;t<r.length;t++)r[t][0].close()}).and(function(){for(n.proxy=this,n.proxy.connect(n.onmidi),t=0;t<r.length;t++)Wn(r[t][0],r[t][1])})};var Qn="Failed to execute 'send' on 'MIDIOutput': ";function Zn(t,e){var n,r,i,o=[];for(n=0;n<t.length;n++)if(t[n]!=parseInt(t[n])||t[n]<0||t[n]>255)throw TypeError(Qn+t[n]+" is not a UInt8 value.");for(r=0,n=0;n<t.length;n++)if(r){if(t[n]>127)throw TypeError(Qn+"Unexpected status byte at index "+n+" ("+t[n]+").");i.push(t[n]),r--}else{if(t[n]<128)throw TypeError(Qn+"Running status is not allowed at index "+n+" ("+t[n]+").");if(247==t[n])throw TypeError(Qn+"Unexpected end of system exclusive message at index "+n+" ("+t[n]+").");if(i=[t[n]],o.push(i),240==t[n]){if(!e)throw new Vn("InvalidAccessError",Qn+"System exclusive messag is not allowed at index "+n+" ("+t[n]+").",15);for(r=-1;n<t.length;n++)if(i.push(t[n]),247==t[n]){r=0;break}}else r=Kn(t[n])}if(r)throw TypeError(Qn+"Message is incomplete");return[o]}function Yn(t,e){var n=this,r=!1,i=null;this.type="output",this.id=e.id,this.name=e.name,this.manufacturer=e.man,this.version=e.ver,Object.defineProperty(this,"state",{get:function(){return e.connected?"connected":"disconnected"},enumerable:!0}),Object.defineProperty(this,"connection",{get:function(){return r?e.proxy?"open":"pending":"closed"},enumerable:!0}),Object.defineProperty(this,"onstatechange",{get:function(){return i},set:function(t){i=f(t)?t:null},enumerable:!0}),this.open=function(){return new Un(function(i,o){r?i(n):e.open().then(function(){r||(r=!0,Wn(n,t)),i(n)},function(){o(new Vn("InvalidAccessError","Port is not available",15))})})},this.close=function(){return new Un(function(i){r&&(r=!1,n.clear(),e.close(),Wn(n,t)),i(n)})},this.clear=function(){},this.send=function(i,o){if(Zn(i,t.sysexEnabled),!e.connected)throw new Vn("InvalidStateError","Port is not connected",11);if(r){var s=h();o>s?setTimeout(function(){e.proxy.send(i)},o-s):e.proxy.send(i)}else this.open().then(function(){n.send(i,o)},p)},Object.freeze(this)}function tr(t,e,n,r){this.id=t,this.name=e,this.man=n,this.ver=r,this.connected=!0,this.ports=[],this.pending=[],this.proxy=void 0}function er(t){this.has=function(e){return t.hasOwnProperty(e)&&t[e].connected},this.keys=function(){try{var e=new Map;for(var n in t)this.has(n)&&e.set(n,this.get(n));return e.keys()}catch(t){}},this.values=function(){try{var e=new Map;for(var n in t)this.has(n)&&e.set(n,this.get(n));return e.values()}catch(t){}},this.entries=function(){try{var e=new Map;for(var n in t)this.has(n)&&e.set(n,this.get(n));return e.entries()}catch(t){}},this.forEach=function(e,n){for(var r in void 0===n&&(n=this),t)this.has(r)&&e.call(n,this.get(r),r,this)},Object.defineProperty(this,"size",{get:function(){var e=0;for(var n in t)this.has(n)&&e++;return e},enumerable:!0})}function nr(t,e){this.get=function(n){if(qn.hasOwnProperty(n)&&qn[n].connected)return e[n]||(e[n]=new Jn(t,qn[n]),qn[n].ports.push([e[n],t.sysexEnabled])),e[n]},Object.freeze(this)}function rr(t,e){this.get=function(n){if(Bn.hasOwnProperty(n)&&Bn[n].connected)return e[n]||(e[n]=new Yn(t,Bn[n]),Bn[n].ports.push([e[n],t.sysexEnabled])),e[n]},Object.freeze(this)}function ir(t){var e,n,r,i;for(e=0;e<t.inputs.added.length;e++)r=t.inputs.added[e],qn.hasOwnProperty(r.id)||(qn[r.id]=new Xn(r.id,r.name,r.manufacturer,r.version)),qn[r.id].reconnect();for(e=0;e<t.outputs.added.length;e++)r=t.outputs.added[e],Bn.hasOwnProperty(r.id)||(Bn[r.id]=new tr(r.id,r.name,r.manufacturer,r.version)),Bn[r.id].reconnect();for(e=0;e<t.inputs.removed.length;e++)if(r=t.inputs.removed[e],qn.hasOwnProperty(r.id)){for(i=[],n=0;n<$n.length;n++)i.push([$n[n].inputs.get(r.id),$n[n]]);for(qn[r.id].disconnect(),n=0;n<i.length;n++)Wn(i[n][0],i[n][1])}for(e=0;e<t.outputs.removed.length;e++)if(r=t.outputs.removed[e],Bn.hasOwnProperty(r.id)){for(i=[],n=0;n<$n.length;n++)i.push([$n[n].outputs.get(r.id),$n[n]]);for(Bn[r.id].disconnect(),n=0;n<i.length;n++)Wn(i[n][0],i[n][1])}}function or(t){var e,n,r={},i={},o=null,s=this;this.sysexEnabled=t,this.inputs=new nr(s,r),this.outputs=new rr(s,i),Object.defineProperty(this,"onstatechange",{get:function(){return o},set:function(t){o=f(t)?t:null},enumerable:!0}),Object.freeze(this);var a=C._info;for(e=0;e<a.inputs.length;e++)n=a.inputs[e],qn.hasOwnProperty(n.id)||(qn[n.id]=new Xn(n.id,n.name,n.manufacturer,n.version));for(e=0;e<a.outputs.length;e++)n=a.outputs[e],Bn.hasOwnProperty(n.id)||(Bn[n.id]=new tr(n.id,n.name,n.manufacturer,n.version));$n.length||At().onChange(ir),$n.push(this)}return tr.prototype.open=function(){var t=this;return new Un(function(e,n){var r;t.proxy||!t.connected?e():(t.pending.push([e,n]),1==t.pending.length&&At().openMidiOut(t.name).or(function(){for(r=0;r<t.pending.length;r++)t.pending[r][1]();t.pending=[]}).and(function(){for(t.proxy=this,r=0;r<t.pending.length;r++)t.pending[r][0]();t.pending=[]}))})},tr.prototype.close=function(){var t;if(this.proxy){for(t=0;t<this.ports.length;t++)if("open"==this.ports[t].connection)return;this.proxy.close(),this.proxy=void 0}},tr.prototype.disconnect=function(){this.connected=!1,this.proxy&&(this.proxy.close(),this.proxy=void 0)},tr.prototype.reconnect=function(){var t,e,n=this,r=[];for(this.connected=!0,t=0;t<$n.length;t++)"closed"==(e=$n[t].outputs.get(this.id)).connection?Wn(e,$n[t]):r.push([e,$n[t]]);r.length&&At()._openMidiOutNR(n.name).or(function(){for(t=0;t<r.length;t++)r[t][0].close()}).and(function(){for(n.proxy=this,t=0;t<r.length;t++)Wn(r[t][0],r[t][1])})},nr.prototype=new er(qn),nr.prototype.constructor=nr,rr.prototype=new er(Bn),rr.prototype.constructor=rr,At.requestMIDIAccess=function(t){return new Un(function(e,n){At.JZZ(t).or(function(){}).and(function(){var r=!(!t||!t.sysex);if(r&&!this.info().sysex)n(new Vn("SecurityError","Sysex is not allowed",18));else{var i=new or(r);e(i)}})})},"undefined"==typeof navigator||navigator.requestMIDIAccess||(navigator.requestMIDIAccess=At.requestMIDIAccess),At.close=function(){at._close&&at._close()},At}()},2543(t,e,n){var r;t=n.nmd(t),function(){var i,o="Expected a function",s="__lodash_hash_undefined__",a="__lodash_placeholder__",u=16,c=32,l=64,h=128,d=256,p=1/0,f=9007199254740991,m=NaN,g=4294967295,_=[["ary",h],["bind",1],["bindKey",2],["curry",8],["curryRight",u],["flip",512],["partial",c],["partialRight",l],["rearg",d]],y="[object Arguments]",v="[object Array]",b="[object Boolean]",w="[object Date]",x="[object Error]",T="[object Function]",k="[object GeneratorFunction]",S="[object Map]",A="[object Number]",E="[object Object]",O="[object Promise]",C="[object RegExp]",M="[object Set]",N="[object String]",I="[object Symbol]",j="[object WeakMap]",R="[object ArrayBuffer]",P="[object DataView]",D="[object Float32Array]",L="[object Float64Array]",F="[object Int8Array]",$="[object Int16Array]",B="[object Int32Array]",q="[object Uint8Array]",U="[object Uint8ClampedArray]",V="[object Uint16Array]",G="[object Uint32Array]",z=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,J=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,X=/[&<>"']/g,K=RegExp(H.source),Q=RegExp(X.source),Z=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,tt=/<%=([\s\S]+?)%>/g,et=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nt=/^\w*$/,rt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/[\\^$.*+?()[\]{}|]/g,ot=RegExp(it.source),st=/^\s+/,at=/\s/,ut=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ct=/\{\n\/\* \[wrapped with (.+)\] \*/,lt=/,? & /,ht=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,dt=/[()=,{}\[\]\/\s]/,pt=/\\(\\)?/g,ft=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,mt=/\w*$/,gt=/^[-+]0x[0-9a-f]+$/i,_t=/^0b[01]+$/i,yt=/^\[object .+?Constructor\]$/,vt=/^0o[0-7]+$/i,bt=/^(?:0|[1-9]\d*)$/,wt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,xt=/($^)/,Tt=/['\n\r\u2028\u2029\\]/g,kt="\\ud800-\\udfff",St="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",At="\\u2700-\\u27bf",Et="a-z\\xdf-\\xf6\\xf8-\\xff",Ot="A-Z\\xc0-\\xd6\\xd8-\\xde",Ct="\\ufe0e\\ufe0f",Mt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Nt="['’]",It="["+kt+"]",jt="["+Mt+"]",Rt="["+St+"]",Pt="\\d+",Dt="["+At+"]",Lt="["+Et+"]",Ft="[^"+kt+Mt+Pt+At+Et+Ot+"]",$t="\\ud83c[\\udffb-\\udfff]",Bt="[^"+kt+"]",qt="(?:\\ud83c[\\udde6-\\uddff]){2}",Ut="[\\ud800-\\udbff][\\udc00-\\udfff]",Vt="["+Ot+"]",Gt="\\u200d",zt="(?:"+Lt+"|"+Ft+")",Wt="(?:"+Vt+"|"+Ft+")",Jt="(?:['’](?:d|ll|m|re|s|t|ve))?",Ht="(?:['’](?:D|LL|M|RE|S|T|VE))?",Xt="(?:"+Rt+"|"+$t+")"+"?",Kt="["+Ct+"]?",Qt=Kt+Xt+("(?:"+Gt+"(?:"+[Bt,qt,Ut].join("|")+")"+Kt+Xt+")*"),Zt="(?:"+[Dt,qt,Ut].join("|")+")"+Qt,Yt="(?:"+[Bt+Rt+"?",Rt,qt,Ut,It].join("|")+")",te=RegExp(Nt,"g"),ee=RegExp(Rt,"g"),ne=RegExp($t+"(?="+$t+")|"+Yt+Qt,"g"),re=RegExp([Vt+"?"+Lt+"+"+Jt+"(?="+[jt,Vt,"$"].join("|")+")",Wt+"+"+Ht+"(?="+[jt,Vt+zt,"$"].join("|")+")",Vt+"?"+zt+"+"+Jt,Vt+"+"+Ht,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Pt,Zt].join("|"),"g"),ie=RegExp("["+Gt+kt+St+Ct+"]"),oe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,se=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ae=-1,ue={};ue[D]=ue[L]=ue[F]=ue[$]=ue[B]=ue[q]=ue[U]=ue[V]=ue[G]=!0,ue[y]=ue[v]=ue[R]=ue[b]=ue[P]=ue[w]=ue[x]=ue[T]=ue[S]=ue[A]=ue[E]=ue[C]=ue[M]=ue[N]=ue[j]=!1;var ce={};ce[y]=ce[v]=ce[R]=ce[P]=ce[b]=ce[w]=ce[D]=ce[L]=ce[F]=ce[$]=ce[B]=ce[S]=ce[A]=ce[E]=ce[C]=ce[M]=ce[N]=ce[I]=ce[q]=ce[U]=ce[V]=ce[G]=!0,ce[x]=ce[T]=ce[j]=!1;var le={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},he=parseFloat,de=parseInt,pe="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,fe="object"==typeof self&&self&&self.Object===Object&&self,me=pe||fe||Function("return this")(),ge=e&&!e.nodeType&&e,_e=ge&&t&&!t.nodeType&&t,ye=_e&&_e.exports===ge,ve=ye&&pe.process,be=function(){try{var t=_e&&_e.require&&_e.require("util").types;return t||ve&&ve.binding&&ve.binding("util")}catch(t){}}(),we=be&&be.isArrayBuffer,xe=be&&be.isDate,Te=be&&be.isMap,ke=be&&be.isRegExp,Se=be&&be.isSet,Ae=be&&be.isTypedArray;function Ee(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Oe(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var s=t[i];e(r,s,n(s),t)}return r}function Ce(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Me(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Ne(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Ie(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var s=t[n];e(s,n,t)&&(o[i++]=s)}return o}function je(t,e){return!!(null==t?0:t.length)&&Ve(t,e,0)>-1}function Re(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function Pe(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function De(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function Le(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function Fe(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function $e(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Be=Je("length");function qe(t,e,n){var r;return n(t,function(t,n,i){if(e(t,n,i))return r=n,!1}),r}function Ue(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function Ve(t,e,n){return e==e?function(t,e,n){var r=n-1,i=t.length;for(;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):Ue(t,ze,n)}function Ge(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function ze(t){return t!=t}function We(t,e){var n=null==t?0:t.length;return n?Ke(t,e)/n:m}function Je(t){return function(e){return null==e?i:e[t]}}function He(t){return function(e){return null==t?i:t[e]}}function Xe(t,e,n,r,i){return i(t,function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)}),n}function Ke(t,e){for(var n,r=-1,o=t.length;++r<o;){var s=e(t[r]);s!==i&&(n=n===i?s:n+s)}return n}function Qe(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ze(t){return t?t.slice(0,gn(t)+1).replace(st,""):t}function Ye(t){return function(e){return t(e)}}function tn(t,e){return Pe(e,function(e){return t[e]})}function en(t,e){return t.has(e)}function nn(t,e){for(var n=-1,r=t.length;++n<r&&Ve(e,t[n],0)>-1;);return n}function rn(t,e){for(var n=t.length;n--&&Ve(e,t[n],0)>-1;);return n}var on=He({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),sn=He({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function an(t){return"\\"+le[t]}function un(t){return ie.test(t)}function cn(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function ln(t,e){return function(n){return t(e(n))}}function hn(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n];s!==e&&s!==a||(t[n]=a,o[i++]=n)}return o}function dn(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function pn(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=[t,t]}),n}function fn(t){return un(t)?function(t){var e=ne.lastIndex=0;for(;ne.test(t);)++e;return e}(t):Be(t)}function mn(t){return un(t)?function(t){return t.match(ne)||[]}(t):function(t){return t.split("")}(t)}function gn(t){for(var e=t.length;e--&&at.test(t.charAt(e)););return e}var _n=He({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var yn=function t(e){var n,r=(e=null==e?me:yn.defaults(me.Object(),e,yn.pick(me,se))).Array,at=e.Date,kt=e.Error,St=e.Function,At=e.Math,Et=e.Object,Ot=e.RegExp,Ct=e.String,Mt=e.TypeError,Nt=r.prototype,It=St.prototype,jt=Et.prototype,Rt=e["__core-js_shared__"],Pt=It.toString,Dt=jt.hasOwnProperty,Lt=0,Ft=(n=/[^.]+$/.exec(Rt&&Rt.keys&&Rt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",$t=jt.toString,Bt=Pt.call(Et),qt=me._,Ut=Ot("^"+Pt.call(Dt).replace(it,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Vt=ye?e.Buffer:i,Gt=e.Symbol,zt=e.Uint8Array,Wt=Vt?Vt.allocUnsafe:i,Jt=ln(Et.getPrototypeOf,Et),Ht=Et.create,Xt=jt.propertyIsEnumerable,Kt=Nt.splice,Qt=Gt?Gt.isConcatSpreadable:i,Zt=Gt?Gt.iterator:i,Yt=Gt?Gt.toStringTag:i,ne=function(){try{var t=po(Et,"defineProperty");return t({},"",{}),t}catch(t){}}(),ie=e.clearTimeout!==me.clearTimeout&&e.clearTimeout,le=at&&at.now!==me.Date.now&&at.now,pe=e.setTimeout!==me.setTimeout&&e.setTimeout,fe=At.ceil,ge=At.floor,_e=Et.getOwnPropertySymbols,ve=Vt?Vt.isBuffer:i,be=e.isFinite,Be=Nt.join,He=ln(Et.keys,Et),vn=At.max,bn=At.min,wn=at.now,xn=e.parseInt,Tn=At.random,kn=Nt.reverse,Sn=po(e,"DataView"),An=po(e,"Map"),En=po(e,"Promise"),On=po(e,"Set"),Cn=po(e,"WeakMap"),Mn=po(Et,"create"),Nn=Cn&&new Cn,In={},jn=$o(Sn),Rn=$o(An),Pn=$o(En),Dn=$o(On),Ln=$o(Cn),Fn=Gt?Gt.prototype:i,$n=Fn?Fn.valueOf:i,Bn=Fn?Fn.toString:i;function qn(t){if(na(t)&&!zs(t)&&!(t instanceof zn)){if(t instanceof Gn)return t;if(Dt.call(t,"__wrapped__"))return Bo(t)}return new Gn(t)}var Un=function(){function t(){}return function(e){if(!ea(e))return{};if(Ht)return Ht(e);t.prototype=e;var n=new t;return t.prototype=i,n}}();function Vn(){}function Gn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=i}function zn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=g,this.__views__=[]}function Wn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Jn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Hn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Xn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Hn;++e<n;)this.add(t[e])}function Kn(t){var e=this.__data__=new Jn(t);this.size=e.size}function Qn(t,e){var n=zs(t),r=!n&&Gs(t),i=!n&&!r&&Xs(t),o=!n&&!r&&!i&&la(t),s=n||r||i||o,a=s?Qe(t.length,Ct):[],u=a.length;for(var c in t)!e&&!Dt.call(t,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||bo(c,u))||a.push(c);return a}function Zn(t){var e=t.length;return e?t[Xr(0,e-1)]:i}function Yn(t,e){return Do(Mi(t),ur(e,0,t.length))}function tr(t){return Do(Mi(t))}function er(t,e,n){(n!==i&&!qs(t[e],n)||n===i&&!(e in t))&&sr(t,e,n)}function nr(t,e,n){var r=t[e];Dt.call(t,e)&&qs(r,n)&&(n!==i||e in t)||sr(t,e,n)}function rr(t,e){for(var n=t.length;n--;)if(qs(t[n][0],e))return n;return-1}function ir(t,e,n,r){return pr(t,function(t,i,o){e(r,t,n(t),o)}),r}function or(t,e){return t&&Ni(e,Ia(e),t)}function sr(t,e,n){"__proto__"==e&&ne?ne(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function ar(t,e){for(var n=-1,o=e.length,s=r(o),a=null==t;++n<o;)s[n]=a?i:Ea(t,e[n]);return s}function ur(t,e,n){return t==t&&(n!==i&&(t=t<=n?t:n),e!==i&&(t=t>=e?t:e)),t}function cr(t,e,n,r,o,s){var a,u=1&e,c=2&e,l=4&e;if(n&&(a=o?n(t,r,o,s):n(t)),a!==i)return a;if(!ea(t))return t;var h=zs(t);if(h){if(a=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&Dt.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!u)return Mi(t,a)}else{var d=go(t),p=d==T||d==k;if(Xs(t))return ki(t,u);if(d==E||d==y||p&&!o){if(a=c||p?{}:yo(t),!u)return c?function(t,e){return Ni(t,mo(t),e)}(t,function(t,e){return t&&Ni(e,ja(e),t)}(a,t)):function(t,e){return Ni(t,fo(t),e)}(t,or(a,t))}else{if(!ce[d])return o?t:{};a=function(t,e,n){var r=t.constructor;switch(e){case R:return Si(t);case b:case w:return new r(+t);case P:return function(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case D:case L:case F:case $:case B:case q:case U:case V:case G:return Ai(t,n);case S:return new r;case A:case N:return new r(t);case C:return function(t){var e=new t.constructor(t.source,mt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case M:return new r;case I:return i=t,$n?Et($n.call(i)):{}}var i}(t,d,u)}}s||(s=new Kn);var f=s.get(t);if(f)return f;s.set(t,a),aa(t)?t.forEach(function(r){a.add(cr(r,e,n,r,t,s))}):ra(t)&&t.forEach(function(r,i){a.set(i,cr(r,e,n,i,t,s))});var m=h?i:(l?c?oo:io:c?ja:Ia)(t);return Ce(m||t,function(r,i){m&&(r=t[i=r]),nr(a,i,cr(r,e,n,i,t,s))}),a}function lr(t,e,n){var r=n.length;if(null==t)return!r;for(t=Et(t);r--;){var o=n[r],s=e[o],a=t[o];if(a===i&&!(o in t)||!s(a))return!1}return!0}function hr(t,e,n){if("function"!=typeof t)throw new Mt(o);return Io(function(){t.apply(i,n)},e)}function dr(t,e,n,r){var i=-1,o=je,s=!0,a=t.length,u=[],c=e.length;if(!a)return u;n&&(e=Pe(e,Ye(n))),r?(o=Re,s=!1):e.length>=200&&(o=en,s=!1,e=new Xn(e));t:for(;++i<a;){var l=t[i],h=null==n?l:n(l);if(l=r||0!==l?l:0,s&&h==h){for(var d=c;d--;)if(e[d]===h)continue t;u.push(l)}else o(e,h,r)||u.push(l)}return u}qn.templateSettings={escape:Z,evaluate:Y,interpolate:tt,variable:"",imports:{_:qn}},qn.prototype=Vn.prototype,qn.prototype.constructor=qn,Gn.prototype=Un(Vn.prototype),Gn.prototype.constructor=Gn,zn.prototype=Un(Vn.prototype),zn.prototype.constructor=zn,Wn.prototype.clear=function(){this.__data__=Mn?Mn(null):{},this.size=0},Wn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Wn.prototype.get=function(t){var e=this.__data__;if(Mn){var n=e[t];return n===s?i:n}return Dt.call(e,t)?e[t]:i},Wn.prototype.has=function(t){var e=this.__data__;return Mn?e[t]!==i:Dt.call(e,t)},Wn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Mn&&e===i?s:e,this},Jn.prototype.clear=function(){this.__data__=[],this.size=0},Jn.prototype.delete=function(t){var e=this.__data__,n=rr(e,t);return!(n<0)&&(n==e.length-1?e.pop():Kt.call(e,n,1),--this.size,!0)},Jn.prototype.get=function(t){var e=this.__data__,n=rr(e,t);return n<0?i:e[n][1]},Jn.prototype.has=function(t){return rr(this.__data__,t)>-1},Jn.prototype.set=function(t,e){var n=this.__data__,r=rr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(An||Jn),string:new Wn}},Hn.prototype.delete=function(t){var e=lo(this,t).delete(t);return this.size-=e?1:0,e},Hn.prototype.get=function(t){return lo(this,t).get(t)},Hn.prototype.has=function(t){return lo(this,t).has(t)},Hn.prototype.set=function(t,e){var n=lo(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Xn.prototype.add=Xn.prototype.push=function(t){return this.__data__.set(t,s),this},Xn.prototype.has=function(t){return this.__data__.has(t)},Kn.prototype.clear=function(){this.__data__=new Jn,this.size=0},Kn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Kn.prototype.get=function(t){return this.__data__.get(t)},Kn.prototype.has=function(t){return this.__data__.has(t)},Kn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Jn){var r=n.__data__;if(!An||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(t,e),this.size=n.size,this};var pr=Ri(wr),fr=Ri(xr,!0);function mr(t,e){var n=!0;return pr(t,function(t,r,i){return n=!!e(t,r,i)}),n}function gr(t,e,n){for(var r=-1,o=t.length;++r<o;){var s=t[r],a=e(s);if(null!=a&&(u===i?a==a&&!ca(a):n(a,u)))var u=a,c=s}return c}function _r(t,e){var n=[];return pr(t,function(t,r,i){e(t,r,i)&&n.push(t)}),n}function yr(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=vo),i||(i=[]);++o<s;){var a=t[o];e>0&&n(a)?e>1?yr(a,e-1,n,r,i):De(i,a):r||(i[i.length]=a)}return i}var vr=Pi(),br=Pi(!0);function wr(t,e){return t&&vr(t,e,Ia)}function xr(t,e){return t&&br(t,e,Ia)}function Tr(t,e){return Ie(e,function(e){return Zs(t[e])})}function kr(t,e){for(var n=0,r=(e=bi(e,t)).length;null!=t&&n<r;)t=t[Fo(e[n++])];return n&&n==r?t:i}function Sr(t,e,n){var r=e(t);return zs(t)?r:De(r,n(t))}function Ar(t){return null==t?t===i?"[object Undefined]":"[object Null]":Yt&&Yt in Et(t)?function(t){var e=Dt.call(t,Yt),n=t[Yt];try{t[Yt]=i;var r=!0}catch(t){}var o=$t.call(t);r&&(e?t[Yt]=n:delete t[Yt]);return o}(t):function(t){return $t.call(t)}(t)}function Er(t,e){return t>e}function Or(t,e){return null!=t&&Dt.call(t,e)}function Cr(t,e){return null!=t&&e in Et(t)}function Mr(t,e,n){for(var o=n?Re:je,s=t[0].length,a=t.length,u=a,c=r(a),l=1/0,h=[];u--;){var d=t[u];u&&e&&(d=Pe(d,Ye(e))),l=bn(d.length,l),c[u]=!n&&(e||s>=120&&d.length>=120)?new Xn(u&&d):i}d=t[0];var p=-1,f=c[0];t:for(;++p<s&&h.length<l;){var m=d[p],g=e?e(m):m;if(m=n||0!==m?m:0,!(f?en(f,g):o(h,g,n))){for(u=a;--u;){var _=c[u];if(!(_?en(_,g):o(t[u],g,n)))continue t}f&&f.push(g),h.push(m)}}return h}function Nr(t,e,n){var r=null==(t=Co(t,e=bi(e,t)))?t:t[Fo(Qo(e))];return null==r?i:Ee(r,t,n)}function Ir(t){return na(t)&&Ar(t)==y}function jr(t,e,n,r,o){return t===e||(null==t||null==e||!na(t)&&!na(e)?t!=t&&e!=e:function(t,e,n,r,o,s){var a=zs(t),u=zs(e),c=a?v:go(t),l=u?v:go(e),h=(c=c==y?E:c)==E,d=(l=l==y?E:l)==E,p=c==l;if(p&&Xs(t)){if(!Xs(e))return!1;a=!0,h=!1}if(p&&!h)return s||(s=new Kn),a||la(t)?no(t,e,n,r,o,s):function(t,e,n,r,i,o,s){switch(n){case P:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case R:return!(t.byteLength!=e.byteLength||!o(new zt(t),new zt(e)));case b:case w:case A:return qs(+t,+e);case x:return t.name==e.name&&t.message==e.message;case C:case N:return t==e+"";case S:var a=cn;case M:var u=1&r;if(a||(a=dn),t.size!=e.size&&!u)return!1;var c=s.get(t);if(c)return c==e;r|=2,s.set(t,e);var l=no(a(t),a(e),r,i,o,s);return s.delete(t),l;case I:if($n)return $n.call(t)==$n.call(e)}return!1}(t,e,c,n,r,o,s);if(!(1&n)){var f=h&&Dt.call(t,"__wrapped__"),m=d&&Dt.call(e,"__wrapped__");if(f||m){var g=f?t.value():t,_=m?e.value():e;return s||(s=new Kn),o(g,_,n,r,s)}}if(!p)return!1;return s||(s=new Kn),function(t,e,n,r,o,s){var a=1&n,u=io(t),c=u.length,l=io(e),h=l.length;if(c!=h&&!a)return!1;var d=c;for(;d--;){var p=u[d];if(!(a?p in e:Dt.call(e,p)))return!1}var f=s.get(t),m=s.get(e);if(f&&m)return f==e&&m==t;var g=!0;s.set(t,e),s.set(e,t);var _=a;for(;++d<c;){var y=t[p=u[d]],v=e[p];if(r)var b=a?r(v,y,p,e,t,s):r(y,v,p,t,e,s);if(!(b===i?y===v||o(y,v,n,r,s):b)){g=!1;break}_||(_="constructor"==p)}if(g&&!_){var w=t.constructor,x=e.constructor;w==x||!("constructor"in t)||!("constructor"in e)||"function"==typeof w&&w instanceof w&&"function"==typeof x&&x instanceof x||(g=!1)}return s.delete(t),s.delete(e),g}(t,e,n,r,o,s)}(t,e,n,r,jr,o))}function Rr(t,e,n,r){var o=n.length,s=o,a=!r;if(null==t)return!s;for(t=Et(t);o--;){var u=n[o];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<s;){var c=(u=n[o])[0],l=t[c],h=u[1];if(a&&u[2]){if(l===i&&!(c in t))return!1}else{var d=new Kn;if(r)var p=r(l,h,c,t,e,d);if(!(p===i?jr(h,l,3,r,d):p))return!1}}return!0}function Pr(t){return!(!ea(t)||(e=t,Ft&&Ft in e))&&(Zs(t)?Ut:yt).test($o(t));var e}function Dr(t){return"function"==typeof t?t:null==t?iu:"object"==typeof t?zs(t)?Ur(t[0],t[1]):qr(t):pu(t)}function Lr(t){if(!So(t))return He(t);var e=[];for(var n in Et(t))Dt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Fr(t){if(!ea(t))return function(t){var e=[];if(null!=t)for(var n in Et(t))e.push(n);return e}(t);var e=So(t),n=[];for(var r in t)("constructor"!=r||!e&&Dt.call(t,r))&&n.push(r);return n}function $r(t,e){return t<e}function Br(t,e){var n=-1,i=Js(t)?r(t.length):[];return pr(t,function(t,r,o){i[++n]=e(t,r,o)}),i}function qr(t){var e=ho(t);return 1==e.length&&e[0][2]?Eo(e[0][0],e[0][1]):function(n){return n===t||Rr(n,t,e)}}function Ur(t,e){return xo(t)&&Ao(e)?Eo(Fo(t),e):function(n){var r=Ea(n,t);return r===i&&r===e?Oa(n,t):jr(e,r,3)}}function Vr(t,e,n,r,o){t!==e&&vr(e,function(s,a){if(o||(o=new Kn),ea(s))!function(t,e,n,r,o,s,a){var u=Mo(t,n),c=Mo(e,n),l=a.get(c);if(l)return void er(t,n,l);var h=s?s(u,c,n+"",t,e,a):i,d=h===i;if(d){var p=zs(c),f=!p&&Xs(c),m=!p&&!f&&la(c);h=c,p||f||m?zs(u)?h=u:Hs(u)?h=Mi(u):f?(d=!1,h=ki(c,!0)):m?(d=!1,h=Ai(c,!0)):h=[]:oa(c)||Gs(c)?(h=u,Gs(u)?h=ya(u):ea(u)&&!Zs(u)||(h=yo(c))):d=!1}d&&(a.set(c,h),o(h,c,r,s,a),a.delete(c));er(t,n,h)}(t,e,a,n,Vr,r,o);else{var u=r?r(Mo(t,a),s,a+"",t,e,o):i;u===i&&(u=s),er(t,a,u)}},ja)}function Gr(t,e){var n=t.length;if(n)return bo(e+=e<0?n:0,n)?t[e]:i}function zr(t,e,n){e=e.length?Pe(e,function(t){return zs(t)?function(e){return kr(e,1===t.length?t[0]:t)}:t}):[iu];var r=-1;e=Pe(e,Ye(co()));var i=Br(t,function(t,n,i){var o=Pe(e,function(e){return e(t)});return{criteria:o,index:++r,value:t}});return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(i,function(t,e){return function(t,e,n){var r=-1,i=t.criteria,o=e.criteria,s=i.length,a=n.length;for(;++r<s;){var u=Ei(i[r],o[r]);if(u)return r>=a?u:u*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)})}function Wr(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var s=e[r],a=kr(t,s);n(a,s)&&ti(o,bi(s,t),a)}return o}function Jr(t,e,n,r){var i=r?Ge:Ve,o=-1,s=e.length,a=t;for(t===e&&(e=Mi(e)),n&&(a=Pe(t,Ye(n)));++o<s;)for(var u=0,c=e[o],l=n?n(c):c;(u=i(a,l,u,r))>-1;)a!==t&&Kt.call(a,u,1),Kt.call(t,u,1);return t}function Hr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;bo(i)?Kt.call(t,i,1):di(t,i)}}return t}function Xr(t,e){return t+ge(Tn()*(e-t+1))}function Kr(t,e){var n="";if(!t||e<1||e>f)return n;do{e%2&&(n+=t),(e=ge(e/2))&&(t+=t)}while(e);return n}function Qr(t,e){return jo(Oo(t,e,iu),t+"")}function Zr(t){return Zn(qa(t))}function Yr(t,e){var n=qa(t);return Do(n,ur(e,0,n.length))}function ti(t,e,n,r){if(!ea(t))return t;for(var o=-1,s=(e=bi(e,t)).length,a=s-1,u=t;null!=u&&++o<s;){var c=Fo(e[o]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(o!=a){var h=u[c];(l=r?r(h,c,u):i)===i&&(l=ea(h)?h:bo(e[o+1])?[]:{})}nr(u,c,l),u=u[c]}return t}var ei=Nn?function(t,e){return Nn.set(t,e),t}:iu,ni=ne?function(t,e){return ne(t,"toString",{configurable:!0,enumerable:!1,value:eu(e),writable:!0})}:iu;function ri(t){return Do(qa(t))}function ii(t,e,n){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var s=r(o);++i<o;)s[i]=t[i+e];return s}function oi(t,e){var n;return pr(t,function(t,r,i){return!(n=e(t,r,i))}),!!n}function si(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,s=t[o];null!==s&&!ca(s)&&(n?s<=e:s<e)?r=o+1:i=o}return i}return ai(t,e,iu,n)}function ai(t,e,n,r){var o=0,s=null==t?0:t.length;if(0===s)return 0;for(var a=(e=n(e))!=e,u=null===e,c=ca(e),l=e===i;o<s;){var h=ge((o+s)/2),d=n(t[h]),p=d!==i,f=null===d,m=d==d,g=ca(d);if(a)var _=r||m;else _=l?m&&(r||p):u?m&&p&&(r||!f):c?m&&p&&!f&&(r||!g):!f&&!g&&(r?d<=e:d<e);_?o=h+1:s=h}return bn(s,4294967294)}function ui(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n],a=e?e(s):s;if(!n||!qs(a,u)){var u=a;o[i++]=0===s?0:s}}return o}function ci(t){return"number"==typeof t?t:ca(t)?m:+t}function li(t){if("string"==typeof t)return t;if(zs(t))return Pe(t,li)+"";if(ca(t))return Bn?Bn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function hi(t,e,n){var r=-1,i=je,o=t.length,s=!0,a=[],u=a;if(n)s=!1,i=Re;else if(o>=200){var c=e?null:Ki(t);if(c)return dn(c);s=!1,i=en,u=new Xn}else u=e?[]:a;t:for(;++r<o;){var l=t[r],h=e?e(l):l;if(l=n||0!==l?l:0,s&&h==h){for(var d=u.length;d--;)if(u[d]===h)continue t;e&&u.push(h),a.push(l)}else i(u,h,n)||(u!==a&&u.push(h),a.push(l))}return a}function di(t,e){var n=-1,r=(e=bi(e,t)).length;if(!r)return!0;for(var i=null==t||"object"!=typeof t&&"function"!=typeof t;++n<r;){var o=e[n];if("string"==typeof o){if("__proto__"===o&&!Dt.call(t,"__proto__"))return!1;if("constructor"===o&&n+1<r&&"string"==typeof e[n+1]&&"prototype"===e[n+1]){if(i&&0===n)continue;return!1}}}var s=Co(t,e);return null==s||delete s[Fo(Qo(e))]}function pi(t,e,n,r){return ti(t,e,n(kr(t,e)),r)}function fi(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?ii(t,r?0:o,r?o+1:i):ii(t,r?o+1:0,r?i:o)}function mi(t,e){var n=t;return n instanceof zn&&(n=n.value()),Le(e,function(t,e){return e.func.apply(e.thisArg,De([t],e.args))},n)}function gi(t,e,n){var i=t.length;if(i<2)return i?hi(t[0]):[];for(var o=-1,s=r(i);++o<i;)for(var a=t[o],u=-1;++u<i;)u!=o&&(s[o]=dr(s[o]||a,t[u],e,n));return hi(yr(s,1),e,n)}function _i(t,e,n){for(var r=-1,o=t.length,s=e.length,a={};++r<o;){var u=r<s?e[r]:i;n(a,t[r],u)}return a}function yi(t){return Hs(t)?t:[]}function vi(t){return"function"==typeof t?t:iu}function bi(t,e){return zs(t)?t:xo(t,e)?[t]:Lo(va(t))}var wi=Qr;function xi(t,e,n){var r=t.length;return n=n===i?r:n,!e&&n>=r?t:ii(t,e,n)}var Ti=ie||function(t){return me.clearTimeout(t)};function ki(t,e){if(e)return t.slice();var n=t.length,r=Wt?Wt(n):new t.constructor(n);return t.copy(r),r}function Si(t){var e=new t.constructor(t.byteLength);return new zt(e).set(new zt(t)),e}function Ai(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ei(t,e){if(t!==e){var n=t!==i,r=null===t,o=t==t,s=ca(t),a=e!==i,u=null===e,c=e==e,l=ca(e);if(!u&&!l&&!s&&t>e||s&&a&&c&&!u&&!l||r&&a&&c||!n&&c||!o)return 1;if(!r&&!s&&!l&&t<e||l&&n&&o&&!r&&!s||u&&n&&o||!a&&o||!c)return-1}return 0}function Oi(t,e,n,i){for(var o=-1,s=t.length,a=n.length,u=-1,c=e.length,l=vn(s-a,0),h=r(c+l),d=!i;++u<c;)h[u]=e[u];for(;++o<a;)(d||o<s)&&(h[n[o]]=t[o]);for(;l--;)h[u++]=t[o++];return h}function Ci(t,e,n,i){for(var o=-1,s=t.length,a=-1,u=n.length,c=-1,l=e.length,h=vn(s-u,0),d=r(h+l),p=!i;++o<h;)d[o]=t[o];for(var f=o;++c<l;)d[f+c]=e[c];for(;++a<u;)(p||o<s)&&(d[f+n[a]]=t[o++]);return d}function Mi(t,e){var n=-1,i=t.length;for(e||(e=r(i));++n<i;)e[n]=t[n];return e}function Ni(t,e,n,r){var o=!n;n||(n={});for(var s=-1,a=e.length;++s<a;){var u=e[s],c=r?r(n[u],t[u],u,n,t):i;c===i&&(c=t[u]),o?sr(n,u,c):nr(n,u,c)}return n}function Ii(t,e){return function(n,r){var i=zs(n)?Oe:ir,o=e?e():{};return i(n,t,co(r,2),o)}}function ji(t){return Qr(function(e,n){var r=-1,o=n.length,s=o>1?n[o-1]:i,a=o>2?n[2]:i;for(s=t.length>3&&"function"==typeof s?(o--,s):i,a&&wo(n[0],n[1],a)&&(s=o<3?i:s,o=1),e=Et(e);++r<o;){var u=n[r];u&&t(e,u,r,s)}return e})}function Ri(t,e){return function(n,r){if(null==n)return n;if(!Js(n))return t(n,r);for(var i=n.length,o=e?i:-1,s=Et(n);(e?o--:++o<i)&&!1!==r(s[o],o,s););return n}}function Pi(t){return function(e,n,r){for(var i=-1,o=Et(e),s=r(e),a=s.length;a--;){var u=s[t?a:++i];if(!1===n(o[u],u,o))break}return e}}function Di(t){return function(e){var n=un(e=va(e))?mn(e):i,r=n?n[0]:e.charAt(0),o=n?xi(n,1).join(""):e.slice(1);return r[t]()+o}}function Li(t){return function(e){return Le(Za(Ga(e).replace(te,"")),t,"")}}function Fi(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Un(t.prototype),r=t.apply(n,e);return ea(r)?r:n}}function $i(t){return function(e,n,r){var o=Et(e);if(!Js(e)){var s=co(n,3);e=Ia(e),n=function(t){return s(o[t],t,o)}}var a=t(e,n,r);return a>-1?o[s?e[a]:a]:i}}function Bi(t){return ro(function(e){var n=e.length,r=n,s=Gn.prototype.thru;for(t&&e.reverse();r--;){var a=e[r];if("function"!=typeof a)throw new Mt(o);if(s&&!u&&"wrapper"==ao(a))var u=new Gn([],!0)}for(r=u?r:n;++r<n;){var c=ao(a=e[r]),l="wrapper"==c?so(a):i;u=l&&To(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?u[ao(l[0])].apply(u,l[3]):1==a.length&&To(a)?u[c]():u.thru(a)}return function(){var t=arguments,r=t[0];if(u&&1==t.length&&zs(r))return u.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}})}function qi(t,e,n,o,s,a,u,c,l,d){var p=e&h,f=1&e,m=2&e,g=24&e,_=512&e,y=m?i:Fi(t);return function h(){for(var v=arguments.length,b=r(v),w=v;w--;)b[w]=arguments[w];if(g)var x=uo(h),T=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(b,x);if(o&&(b=Oi(b,o,s,g)),a&&(b=Ci(b,a,u,g)),v-=T,g&&v<d){var k=hn(b,x);return Hi(t,e,qi,h.placeholder,n,b,k,c,l,d-v)}var S=f?n:this,A=m?S[t]:t;return v=b.length,c?b=function(t,e){var n=t.length,r=bn(e.length,n),o=Mi(t);for(;r--;){var s=e[r];t[r]=bo(s,n)?o[s]:i}return t}(b,c):_&&v>1&&b.reverse(),p&&l<v&&(b.length=l),this&&this!==me&&this instanceof h&&(A=y||Fi(A)),A.apply(S,b)}}function Ui(t,e){return function(n,r){return function(t,e,n,r){return wr(t,function(t,i,o){e(r,n(t),i,o)}),r}(n,t,e(r),{})}}function Vi(t,e){return function(n,r){var o;if(n===i&&r===i)return e;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=li(n),r=li(r)):(n=ci(n),r=ci(r)),o=t(n,r)}return o}}function Gi(t){return ro(function(e){return e=Pe(e,Ye(co())),Qr(function(n){var r=this;return t(e,function(t){return Ee(t,r,n)})})})}function zi(t,e){var n=(e=e===i?" ":li(e)).length;if(n<2)return n?Kr(e,t):e;var r=Kr(e,fe(t/fn(e)));return un(e)?xi(mn(r),0,t).join(""):r.slice(0,t)}function Wi(t){return function(e,n,o){return o&&"number"!=typeof o&&wo(e,n,o)&&(n=o=i),e=fa(e),n===i?(n=e,e=0):n=fa(n),function(t,e,n,i){for(var o=-1,s=vn(fe((e-t)/(n||1)),0),a=r(s);s--;)a[i?s:++o]=t,t+=n;return a}(e,n,o=o===i?e<n?1:-1:fa(o),t)}}function Ji(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=_a(e),n=_a(n)),t(e,n)}}function Hi(t,e,n,r,o,s,a,u,h,d){var p=8&e;e|=p?c:l,4&(e&=~(p?l:c))||(e&=-4);var f=[t,e,o,p?s:i,p?a:i,p?i:s,p?i:a,u,h,d],m=n.apply(i,f);return To(t)&&No(m,f),m.placeholder=r,Ro(m,t,e)}function Xi(t){var e=At[t];return function(t,n){if(t=_a(t),(n=null==n?0:bn(ma(n),292))&&be(t)){var r=(va(t)+"e").split("e");return+((r=(va(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Ki=On&&1/dn(new On([,-0]))[1]==p?function(t){return new On(t)}:cu;function Qi(t){return function(e){var n=go(e);return n==S?cn(e):n==M?pn(e):function(t,e){return Pe(e,function(e){return[e,t[e]]})}(e,t(e))}}function Zi(t,e,n,s,p,f,m,g){var _=2&e;if(!_&&"function"!=typeof t)throw new Mt(o);var y=s?s.length:0;if(y||(e&=-97,s=p=i),m=m===i?m:vn(ma(m),0),g=g===i?g:ma(g),y-=p?p.length:0,e&l){var v=s,b=p;s=p=i}var w=_?i:so(t),x=[t,e,n,s,p,v,b,f,m,g];if(w&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,s=r==h&&8==n||r==h&&n==d&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!s)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var u=e[3];if(u){var c=t[3];t[3]=c?Oi(c,u,e[4]):u,t[4]=c?hn(t[3],a):e[4]}(u=e[5])&&(c=t[5],t[5]=c?Ci(c,u,e[6]):u,t[6]=c?hn(t[5],a):e[6]);(u=e[7])&&(t[7]=u);r&h&&(t[8]=null==t[8]?e[8]:bn(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(x,w),t=x[0],e=x[1],n=x[2],s=x[3],p=x[4],!(g=x[9]=x[9]===i?_?0:t.length:vn(x[9]-y,0))&&24&e&&(e&=-25),e&&1!=e)T=8==e||e==u?function(t,e,n){var o=Fi(t);return function s(){for(var a=arguments.length,u=r(a),c=a,l=uo(s);c--;)u[c]=arguments[c];var h=a<3&&u[0]!==l&&u[a-1]!==l?[]:hn(u,l);return(a-=h.length)<n?Hi(t,e,qi,s.placeholder,i,u,h,i,i,n-a):Ee(this&&this!==me&&this instanceof s?o:t,this,u)}}(t,e,g):e!=c&&33!=e||p.length?qi.apply(i,x):function(t,e,n,i){var o=1&e,s=Fi(t);return function e(){for(var a=-1,u=arguments.length,c=-1,l=i.length,h=r(l+u),d=this&&this!==me&&this instanceof e?s:t;++c<l;)h[c]=i[c];for(;u--;)h[c++]=arguments[++a];return Ee(d,o?n:this,h)}}(t,e,n,s);else var T=function(t,e,n){var r=1&e,i=Fi(t);return function e(){return(this&&this!==me&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return Ro((w?ei:No)(T,x),t,e)}function Yi(t,e,n,r){return t===i||qs(t,jt[n])&&!Dt.call(r,n)?e:t}function to(t,e,n,r,o,s){return ea(t)&&ea(e)&&(s.set(e,t),Vr(t,e,i,to,s),s.delete(e)),t}function eo(t){return oa(t)?i:t}function no(t,e,n,r,o,s){var a=1&n,u=t.length,c=e.length;if(u!=c&&!(a&&c>u))return!1;var l=s.get(t),h=s.get(e);if(l&&h)return l==e&&h==t;var d=-1,p=!0,f=2&n?new Xn:i;for(s.set(t,e),s.set(e,t);++d<u;){var m=t[d],g=e[d];if(r)var _=a?r(g,m,d,e,t,s):r(m,g,d,t,e,s);if(_!==i){if(_)continue;p=!1;break}if(f){if(!$e(e,function(t,e){if(!en(f,e)&&(m===t||o(m,t,n,r,s)))return f.push(e)})){p=!1;break}}else if(m!==g&&!o(m,g,n,r,s)){p=!1;break}}return s.delete(t),s.delete(e),p}function ro(t){return jo(Oo(t,i,Wo),t+"")}function io(t){return Sr(t,Ia,fo)}function oo(t){return Sr(t,ja,mo)}var so=Nn?function(t){return Nn.get(t)}:cu;function ao(t){for(var e=t.name+"",n=In[e],r=Dt.call(In,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function uo(t){return(Dt.call(qn,"placeholder")?qn:t).placeholder}function co(){var t=qn.iteratee||ou;return t=t===ou?Dr:t,arguments.length?t(arguments[0],arguments[1]):t}function lo(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function ho(t){for(var e=Ia(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,Ao(i)]}return e}function po(t,e){var n=function(t,e){return null==t?i:t[e]}(t,e);return Pr(n)?n:i}var fo=_e?function(t){return null==t?[]:(t=Et(t),Ie(_e(t),function(e){return Xt.call(t,e)}))}:gu,mo=_e?function(t){for(var e=[];t;)De(e,fo(t)),t=Jt(t);return e}:gu,go=Ar;function _o(t,e,n){for(var r=-1,i=(e=bi(e,t)).length,o=!1;++r<i;){var s=Fo(e[r]);if(!(o=null!=t&&n(t,s)))break;t=t[s]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&ta(i)&&bo(s,i)&&(zs(t)||Gs(t))}function yo(t){return"function"!=typeof t.constructor||So(t)?{}:Un(Jt(t))}function vo(t){return zs(t)||Gs(t)||!!(Qt&&t&&t[Qt])}function bo(t,e){var n=typeof t;return!!(e=null==e?f:e)&&("number"==n||"symbol"!=n&&bt.test(t))&&t>-1&&t%1==0&&t<e}function wo(t,e,n){if(!ea(n))return!1;var r=typeof e;return!!("number"==r?Js(n)&&bo(e,n.length):"string"==r&&e in n)&&qs(n[e],t)}function xo(t,e){if(zs(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ca(t))||(nt.test(t)||!et.test(t)||null!=e&&t in Et(e))}function To(t){var e=ao(t),n=qn[e];if("function"!=typeof n||!(e in zn.prototype))return!1;if(t===n)return!0;var r=so(n);return!!r&&t===r[0]}(Sn&&go(new Sn(new ArrayBuffer(1)))!=P||An&&go(new An)!=S||En&&go(En.resolve())!=O||On&&go(new On)!=M||Cn&&go(new Cn)!=j)&&(go=function(t){var e=Ar(t),n=e==E?t.constructor:i,r=n?$o(n):"";if(r)switch(r){case jn:return P;case Rn:return S;case Pn:return O;case Dn:return M;case Ln:return j}return e});var ko=Rt?Zs:_u;function So(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||jt)}function Ao(t){return t==t&&!ea(t)}function Eo(t,e){return function(n){return null!=n&&(n[t]===e&&(e!==i||t in Et(n)))}}function Oo(t,e,n){return e=vn(e===i?t.length-1:e,0),function(){for(var i=arguments,o=-1,s=vn(i.length-e,0),a=r(s);++o<s;)a[o]=i[e+o];o=-1;for(var u=r(e+1);++o<e;)u[o]=i[o];return u[e]=n(a),Ee(t,this,u)}}function Co(t,e){return e.length<2?t:kr(t,ii(e,0,-1))}function Mo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var No=Po(ei),Io=pe||function(t,e){return me.setTimeout(t,e)},jo=Po(ni);function Ro(t,e,n){var r=e+"";return jo(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(ut,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Ce(_,function(n){var r="_."+n[0];e&n[1]&&!je(t,r)&&t.push(r)}),t.sort()}(function(t){var e=t.match(ct);return e?e[1].split(lt):[]}(r),n)))}function Po(t){var e=0,n=0;return function(){var r=wn(),o=16-(r-n);if(n=r,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(i,arguments)}}function Do(t,e){var n=-1,r=t.length,o=r-1;for(e=e===i?r:e;++n<e;){var s=Xr(n,o),a=t[s];t[s]=t[n],t[n]=a}return t.length=e,t}var Lo=function(t){var e=Ps(t,function(t){return 500===n.size&&n.clear(),t}),n=e.cache;return e}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(rt,function(t,n,r,i){e.push(r?i.replace(pt,"$1"):n||t)}),e});function Fo(t){if("string"==typeof t||ca(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function $o(t){if(null!=t){try{return Pt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Bo(t){if(t instanceof zn)return t.clone();var e=new Gn(t.__wrapped__,t.__chain__);return e.__actions__=Mi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var qo=Qr(function(t,e){return Hs(t)?dr(t,yr(e,1,Hs,!0)):[]}),Uo=Qr(function(t,e){var n=Qo(e);return Hs(n)&&(n=i),Hs(t)?dr(t,yr(e,1,Hs,!0),co(n,2)):[]}),Vo=Qr(function(t,e){var n=Qo(e);return Hs(n)&&(n=i),Hs(t)?dr(t,yr(e,1,Hs,!0),i,n):[]});function Go(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ma(n);return i<0&&(i=vn(r+i,0)),Ue(t,co(e,3),i)}function zo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r-1;return n!==i&&(o=ma(n),o=n<0?vn(r+o,0):bn(o,r-1)),Ue(t,co(e,3),o,!0)}function Wo(t){return(null==t?0:t.length)?yr(t,1):[]}function Jo(t){return t&&t.length?t[0]:i}var Ho=Qr(function(t){var e=Pe(t,yi);return e.length&&e[0]===t[0]?Mr(e):[]}),Xo=Qr(function(t){var e=Qo(t),n=Pe(t,yi);return e===Qo(n)?e=i:n.pop(),n.length&&n[0]===t[0]?Mr(n,co(e,2)):[]}),Ko=Qr(function(t){var e=Qo(t),n=Pe(t,yi);return(e="function"==typeof e?e:i)&&n.pop(),n.length&&n[0]===t[0]?Mr(n,i,e):[]});function Qo(t){var e=null==t?0:t.length;return e?t[e-1]:i}var Zo=Qr(Yo);function Yo(t,e){return t&&t.length&&e&&e.length?Jr(t,e):t}var ts=ro(function(t,e){var n=null==t?0:t.length,r=ar(t,e);return Hr(t,Pe(e,function(t){return bo(t,n)?+t:t}).sort(Ei)),r});function es(t){return null==t?t:kn.call(t)}var ns=Qr(function(t){return hi(yr(t,1,Hs,!0))}),rs=Qr(function(t){var e=Qo(t);return Hs(e)&&(e=i),hi(yr(t,1,Hs,!0),co(e,2))}),is=Qr(function(t){var e=Qo(t);return e="function"==typeof e?e:i,hi(yr(t,1,Hs,!0),i,e)});function os(t){if(!t||!t.length)return[];var e=0;return t=Ie(t,function(t){if(Hs(t))return e=vn(t.length,e),!0}),Qe(e,function(e){return Pe(t,Je(e))})}function ss(t,e){if(!t||!t.length)return[];var n=os(t);return null==e?n:Pe(n,function(t){return Ee(e,i,t)})}var as=Qr(function(t,e){return Hs(t)?dr(t,e):[]}),us=Qr(function(t){return gi(Ie(t,Hs))}),cs=Qr(function(t){var e=Qo(t);return Hs(e)&&(e=i),gi(Ie(t,Hs),co(e,2))}),ls=Qr(function(t){var e=Qo(t);return e="function"==typeof e?e:i,gi(Ie(t,Hs),i,e)}),hs=Qr(os);var ds=Qr(function(t){var e=t.length,n=e>1?t[e-1]:i;return n="function"==typeof n?(t.pop(),n):i,ss(t,n)});function ps(t){var e=qn(t);return e.__chain__=!0,e}function fs(t,e){return e(t)}var ms=ro(function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,o=function(e){return ar(e,t)};return!(e>1||this.__actions__.length)&&r instanceof zn&&bo(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:fs,args:[o],thisArg:i}),new Gn(r,this.__chain__).thru(function(t){return e&&!t.length&&t.push(i),t})):this.thru(o)});var gs=Ii(function(t,e,n){Dt.call(t,n)?++t[n]:sr(t,n,1)});var _s=$i(Go),ys=$i(zo);function vs(t,e){return(zs(t)?Ce:pr)(t,co(e,3))}function bs(t,e){return(zs(t)?Me:fr)(t,co(e,3))}var ws=Ii(function(t,e,n){Dt.call(t,n)?t[n].push(e):sr(t,n,[e])});var xs=Qr(function(t,e,n){var i=-1,o="function"==typeof e,s=Js(t)?r(t.length):[];return pr(t,function(t){s[++i]=o?Ee(e,t,n):Nr(t,e,n)}),s}),Ts=Ii(function(t,e,n){sr(t,n,e)});function ks(t,e){return(zs(t)?Pe:Br)(t,co(e,3))}var Ss=Ii(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});var As=Qr(function(t,e){if(null==t)return[];var n=e.length;return n>1&&wo(t,e[0],e[1])?e=[]:n>2&&wo(e[0],e[1],e[2])&&(e=[e[0]]),zr(t,yr(e,1),[])}),Es=le||function(){return me.Date.now()};function Os(t,e,n){return e=n?i:e,e=t&&null==e?t.length:e,Zi(t,h,i,i,i,i,e)}function Cs(t,e){var n;if("function"!=typeof e)throw new Mt(o);return t=ma(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=i),n}}var Ms=Qr(function(t,e,n){var r=1;if(n.length){var i=hn(n,uo(Ms));r|=c}return Zi(t,r,e,n,i)}),Ns=Qr(function(t,e,n){var r=3;if(n.length){var i=hn(n,uo(Ns));r|=c}return Zi(e,r,t,n,i)});function Is(t,e,n){var r,s,a,u,c,l,h=0,d=!1,p=!1,f=!0;if("function"!=typeof t)throw new Mt(o);function m(e){var n=r,o=s;return r=s=i,h=e,u=t.apply(o,n)}function g(t){var n=t-l;return l===i||n>=e||n<0||p&&t-h>=a}function _(){var t=Es();if(g(t))return y(t);c=Io(_,function(t){var n=e-(t-l);return p?bn(n,a-(t-h)):n}(t))}function y(t){return c=i,f&&r?m(t):(r=s=i,u)}function v(){var t=Es(),n=g(t);if(r=arguments,s=this,l=t,n){if(c===i)return function(t){return h=t,c=Io(_,e),d?m(t):u}(l);if(p)return Ti(c),c=Io(_,e),m(l)}return c===i&&(c=Io(_,e)),u}return e=_a(e)||0,ea(n)&&(d=!!n.leading,a=(p="maxWait"in n)?vn(_a(n.maxWait)||0,e):a,f="trailing"in n?!!n.trailing:f),v.cancel=function(){c!==i&&Ti(c),h=0,r=l=s=c=i},v.flush=function(){return c===i?u:y(Es())},v}var js=Qr(function(t,e){return hr(t,1,e)}),Rs=Qr(function(t,e,n){return hr(t,_a(e)||0,n)});function Ps(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Mt(o);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Ps.Cache||Hn),n}function Ds(t){if("function"!=typeof t)throw new Mt(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Ps.Cache=Hn;var Ls=wi(function(t,e){var n=(e=1==e.length&&zs(e[0])?Pe(e[0],Ye(co())):Pe(yr(e,1),Ye(co()))).length;return Qr(function(r){for(var i=-1,o=bn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return Ee(t,this,r)})}),Fs=Qr(function(t,e){var n=hn(e,uo(Fs));return Zi(t,c,i,e,n)}),$s=Qr(function(t,e){var n=hn(e,uo($s));return Zi(t,l,i,e,n)}),Bs=ro(function(t,e){return Zi(t,d,i,i,i,e)});function qs(t,e){return t===e||t!=t&&e!=e}var Us=Ji(Er),Vs=Ji(function(t,e){return t>=e}),Gs=Ir(function(){return arguments}())?Ir:function(t){return na(t)&&Dt.call(t,"callee")&&!Xt.call(t,"callee")},zs=r.isArray,Ws=we?Ye(we):function(t){return na(t)&&Ar(t)==R};function Js(t){return null!=t&&ta(t.length)&&!Zs(t)}function Hs(t){return na(t)&&Js(t)}var Xs=ve||_u,Ks=xe?Ye(xe):function(t){return na(t)&&Ar(t)==w};function Qs(t){if(!na(t))return!1;var e=Ar(t);return e==x||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!oa(t)}function Zs(t){if(!ea(t))return!1;var e=Ar(t);return e==T||e==k||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Ys(t){return"number"==typeof t&&t==ma(t)}function ta(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=f}function ea(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function na(t){return null!=t&&"object"==typeof t}var ra=Te?Ye(Te):function(t){return na(t)&&go(t)==S};function ia(t){return"number"==typeof t||na(t)&&Ar(t)==A}function oa(t){if(!na(t)||Ar(t)!=E)return!1;var e=Jt(t);if(null===e)return!0;var n=Dt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Pt.call(n)==Bt}var sa=ke?Ye(ke):function(t){return na(t)&&Ar(t)==C};var aa=Se?Ye(Se):function(t){return na(t)&&go(t)==M};function ua(t){return"string"==typeof t||!zs(t)&&na(t)&&Ar(t)==N}function ca(t){return"symbol"==typeof t||na(t)&&Ar(t)==I}var la=Ae?Ye(Ae):function(t){return na(t)&&ta(t.length)&&!!ue[Ar(t)]};var ha=Ji($r),da=Ji(function(t,e){return t<=e});function pa(t){if(!t)return[];if(Js(t))return ua(t)?mn(t):Mi(t);if(Zt&&t[Zt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Zt]());var e=go(t);return(e==S?cn:e==M?dn:qa)(t)}function fa(t){return t?(t=_a(t))===p||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ma(t){var e=fa(t),n=e%1;return e==e?n?e-n:e:0}function ga(t){return t?ur(ma(t),0,g):0}function _a(t){if("number"==typeof t)return t;if(ca(t))return m;if(ea(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ze(t);var n=_t.test(t);return n||vt.test(t)?de(t.slice(2),n?2:8):gt.test(t)?m:+t}function ya(t){return Ni(t,ja(t))}function va(t){return null==t?"":li(t)}var ba=ji(function(t,e){if(So(e)||Js(e))Ni(e,Ia(e),t);else for(var n in e)Dt.call(e,n)&&nr(t,n,e[n])}),wa=ji(function(t,e){Ni(e,ja(e),t)}),xa=ji(function(t,e,n,r){Ni(e,ja(e),t,r)}),Ta=ji(function(t,e,n,r){Ni(e,Ia(e),t,r)}),ka=ro(ar);var Sa=Qr(function(t,e){t=Et(t);var n=-1,r=e.length,o=r>2?e[2]:i;for(o&&wo(e[0],e[1],o)&&(r=1);++n<r;)for(var s=e[n],a=ja(s),u=-1,c=a.length;++u<c;){var l=a[u],h=t[l];(h===i||qs(h,jt[l])&&!Dt.call(t,l))&&(t[l]=s[l])}return t}),Aa=Qr(function(t){return t.push(i,to),Ee(Pa,i,t)});function Ea(t,e,n){var r=null==t?i:kr(t,e);return r===i?n:r}function Oa(t,e){return null!=t&&_o(t,e,Cr)}var Ca=Ui(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=$t.call(e)),t[e]=n},eu(iu)),Ma=Ui(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=$t.call(e)),Dt.call(t,e)?t[e].push(n):t[e]=[n]},co),Na=Qr(Nr);function Ia(t){return Js(t)?Qn(t):Lr(t)}function ja(t){return Js(t)?Qn(t,!0):Fr(t)}var Ra=ji(function(t,e,n){Vr(t,e,n)}),Pa=ji(function(t,e,n,r){Vr(t,e,n,r)}),Da=ro(function(t,e){var n={};if(null==t)return n;var r=!1;e=Pe(e,function(e){return e=bi(e,t),r||(r=e.length>1),e}),Ni(t,oo(t),n),r&&(n=cr(n,7,eo));for(var i=e.length;i--;)di(n,e[i]);return n});var La=ro(function(t,e){return null==t?{}:function(t,e){return Wr(t,e,function(e,n){return Oa(t,n)})}(t,e)});function Fa(t,e){if(null==t)return{};var n=Pe(oo(t),function(t){return[t]});return e=co(e),Wr(t,n,function(t,n){return e(t,n[0])})}var $a=Qi(Ia),Ba=Qi(ja);function qa(t){return null==t?[]:tn(t,Ia(t))}var Ua=Li(function(t,e,n){return e=e.toLowerCase(),t+(n?Va(e):e)});function Va(t){return Qa(va(t).toLowerCase())}function Ga(t){return(t=va(t))&&t.replace(wt,on).replace(ee,"")}var za=Li(function(t,e,n){return t+(n?"-":"")+e.toLowerCase()}),Wa=Li(function(t,e,n){return t+(n?" ":"")+e.toLowerCase()}),Ja=Di("toLowerCase");var Ha=Li(function(t,e,n){return t+(n?"_":"")+e.toLowerCase()});var Xa=Li(function(t,e,n){return t+(n?" ":"")+Qa(e)});var Ka=Li(function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}),Qa=Di("toUpperCase");function Za(t,e,n){return t=va(t),(e=n?i:e)===i?function(t){return oe.test(t)}(t)?function(t){return t.match(re)||[]}(t):function(t){return t.match(ht)||[]}(t):t.match(e)||[]}var Ya=Qr(function(t,e){try{return Ee(t,i,e)}catch(t){return Qs(t)?t:new kt(t)}}),tu=ro(function(t,e){return Ce(e,function(e){e=Fo(e),sr(t,e,Ms(t[e],t))}),t});function eu(t){return function(){return t}}var nu=Bi(),ru=Bi(!0);function iu(t){return t}function ou(t){return Dr("function"==typeof t?t:cr(t,1))}var su=Qr(function(t,e){return function(n){return Nr(n,t,e)}}),au=Qr(function(t,e){return function(n){return Nr(t,n,e)}});function uu(t,e,n){var r=Ia(e),i=Tr(e,r);null!=n||ea(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=Tr(e,Ia(e)));var o=!(ea(n)&&"chain"in n&&!n.chain),s=Zs(t);return Ce(i,function(n){var r=e[n];t[n]=r,s&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__);return(n.__actions__=Mi(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,De([this.value()],arguments))})}),t}function cu(){}var lu=Gi(Pe),hu=Gi(Ne),du=Gi($e);function pu(t){return xo(t)?Je(Fo(t)):function(t){return function(e){return kr(e,t)}}(t)}var fu=Wi(),mu=Wi(!0);function gu(){return[]}function _u(){return!1}var yu=Vi(function(t,e){return t+e},0),vu=Xi("ceil"),bu=Vi(function(t,e){return t/e},1),wu=Xi("floor");var xu,Tu=Vi(function(t,e){return t*e},1),ku=Xi("round"),Su=Vi(function(t,e){return t-e},0);return qn.after=function(t,e){if("function"!=typeof e)throw new Mt(o);return t=ma(t),function(){if(--t<1)return e.apply(this,arguments)}},qn.ary=Os,qn.assign=ba,qn.assignIn=wa,qn.assignInWith=xa,qn.assignWith=Ta,qn.at=ka,qn.before=Cs,qn.bind=Ms,qn.bindAll=tu,qn.bindKey=Ns,qn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return zs(t)?t:[t]},qn.chain=ps,qn.chunk=function(t,e,n){e=(n?wo(t,e,n):e===i)?1:vn(ma(e),0);var o=null==t?0:t.length;if(!o||e<1)return[];for(var s=0,a=0,u=r(fe(o/e));s<o;)u[a++]=ii(t,s,s+=e);return u},qn.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},qn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=r(t-1),n=arguments[0],i=t;i--;)e[i-1]=arguments[i];return De(zs(n)?Mi(n):[n],yr(e,1))},qn.cond=function(t){var e=null==t?0:t.length,n=co();return t=e?Pe(t,function(t){if("function"!=typeof t[1])throw new Mt(o);return[n(t[0]),t[1]]}):[],Qr(function(n){for(var r=-1;++r<e;){var i=t[r];if(Ee(i[0],this,n))return Ee(i[1],this,n)}})},qn.conforms=function(t){return function(t){var e=Ia(t);return function(n){return lr(n,t,e)}}(cr(t,1))},qn.constant=eu,qn.countBy=gs,qn.create=function(t,e){var n=Un(t);return null==e?n:or(n,e)},qn.curry=function t(e,n,r){var o=Zi(e,8,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},qn.curryRight=function t(e,n,r){var o=Zi(e,u,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},qn.debounce=Is,qn.defaults=Sa,qn.defaultsDeep=Aa,qn.defer=js,qn.delay=Rs,qn.difference=qo,qn.differenceBy=Uo,qn.differenceWith=Vo,qn.drop=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,(e=n||e===i?1:ma(e))<0?0:e,r):[]},qn.dropRight=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,0,(e=r-(e=n||e===i?1:ma(e)))<0?0:e):[]},qn.dropRightWhile=function(t,e){return t&&t.length?fi(t,co(e,3),!0,!0):[]},qn.dropWhile=function(t,e){return t&&t.length?fi(t,co(e,3),!0):[]},qn.fill=function(t,e,n,r){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&wo(t,e,n)&&(n=0,r=o),function(t,e,n,r){var o=t.length;for((n=ma(n))<0&&(n=-n>o?0:o+n),(r=r===i||r>o?o:ma(r))<0&&(r+=o),r=n>r?0:ga(r);n<r;)t[n++]=e;return t}(t,e,n,r)):[]},qn.filter=function(t,e){return(zs(t)?Ie:_r)(t,co(e,3))},qn.flatMap=function(t,e){return yr(ks(t,e),1)},qn.flatMapDeep=function(t,e){return yr(ks(t,e),p)},qn.flatMapDepth=function(t,e,n){return n=n===i?1:ma(n),yr(ks(t,e),n)},qn.flatten=Wo,qn.flattenDeep=function(t){return(null==t?0:t.length)?yr(t,p):[]},qn.flattenDepth=function(t,e){return(null==t?0:t.length)?yr(t,e=e===i?1:ma(e)):[]},qn.flip=function(t){return Zi(t,512)},qn.flow=nu,qn.flowRight=ru,qn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},qn.functions=function(t){return null==t?[]:Tr(t,Ia(t))},qn.functionsIn=function(t){return null==t?[]:Tr(t,ja(t))},qn.groupBy=ws,qn.initial=function(t){return(null==t?0:t.length)?ii(t,0,-1):[]},qn.intersection=Ho,qn.intersectionBy=Xo,qn.intersectionWith=Ko,qn.invert=Ca,qn.invertBy=Ma,qn.invokeMap=xs,qn.iteratee=ou,qn.keyBy=Ts,qn.keys=Ia,qn.keysIn=ja,qn.map=ks,qn.mapKeys=function(t,e){var n={};return e=co(e,3),wr(t,function(t,r,i){sr(n,e(t,r,i),t)}),n},qn.mapValues=function(t,e){var n={};return e=co(e,3),wr(t,function(t,r,i){sr(n,r,e(t,r,i))}),n},qn.matches=function(t){return qr(cr(t,1))},qn.matchesProperty=function(t,e){return Ur(t,cr(e,1))},qn.memoize=Ps,qn.merge=Ra,qn.mergeWith=Pa,qn.method=su,qn.methodOf=au,qn.mixin=uu,qn.negate=Ds,qn.nthArg=function(t){return t=ma(t),Qr(function(e){return Gr(e,t)})},qn.omit=Da,qn.omitBy=function(t,e){return Fa(t,Ds(co(e)))},qn.once=function(t){return Cs(2,t)},qn.orderBy=function(t,e,n,r){return null==t?[]:(zs(e)||(e=null==e?[]:[e]),zs(n=r?i:n)||(n=null==n?[]:[n]),zr(t,e,n))},qn.over=lu,qn.overArgs=Ls,qn.overEvery=hu,qn.overSome=du,qn.partial=Fs,qn.partialRight=$s,qn.partition=Ss,qn.pick=La,qn.pickBy=Fa,qn.property=pu,qn.propertyOf=function(t){return function(e){return null==t?i:kr(t,e)}},qn.pull=Zo,qn.pullAll=Yo,qn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Jr(t,e,co(n,2)):t},qn.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?Jr(t,e,i,n):t},qn.pullAt=ts,qn.range=fu,qn.rangeRight=mu,qn.rearg=Bs,qn.reject=function(t,e){return(zs(t)?Ie:_r)(t,Ds(co(e,3)))},qn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=co(e,3);++r<o;){var s=t[r];e(s,r,t)&&(n.push(s),i.push(r))}return Hr(t,i),n},qn.rest=function(t,e){if("function"!=typeof t)throw new Mt(o);return Qr(t,e=e===i?e:ma(e))},qn.reverse=es,qn.sampleSize=function(t,e,n){return e=(n?wo(t,e,n):e===i)?1:ma(e),(zs(t)?Yn:Yr)(t,e)},qn.set=function(t,e,n){return null==t?t:ti(t,e,n)},qn.setWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:ti(t,e,n,r)},qn.shuffle=function(t){return(zs(t)?tr:ri)(t)},qn.slice=function(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&wo(t,e,n)?(e=0,n=r):(e=null==e?0:ma(e),n=n===i?r:ma(n)),ii(t,e,n)):[]},qn.sortBy=As,qn.sortedUniq=function(t){return t&&t.length?ui(t):[]},qn.sortedUniqBy=function(t,e){return t&&t.length?ui(t,co(e,2)):[]},qn.split=function(t,e,n){return n&&"number"!=typeof n&&wo(t,e,n)&&(e=n=i),(n=n===i?g:n>>>0)?(t=va(t))&&("string"==typeof e||null!=e&&!sa(e))&&!(e=li(e))&&un(t)?xi(mn(t),0,n):t.split(e,n):[]},qn.spread=function(t,e){if("function"!=typeof t)throw new Mt(o);return e=null==e?0:vn(ma(e),0),Qr(function(n){var r=n[e],i=xi(n,0,e);return r&&De(i,r),Ee(t,this,i)})},qn.tail=function(t){var e=null==t?0:t.length;return e?ii(t,1,e):[]},qn.take=function(t,e,n){return t&&t.length?ii(t,0,(e=n||e===i?1:ma(e))<0?0:e):[]},qn.takeRight=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,(e=r-(e=n||e===i?1:ma(e)))<0?0:e,r):[]},qn.takeRightWhile=function(t,e){return t&&t.length?fi(t,co(e,3),!1,!0):[]},qn.takeWhile=function(t,e){return t&&t.length?fi(t,co(e,3)):[]},qn.tap=function(t,e){return e(t),t},qn.throttle=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new Mt(o);return ea(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Is(t,e,{leading:r,maxWait:e,trailing:i})},qn.thru=fs,qn.toArray=pa,qn.toPairs=$a,qn.toPairsIn=Ba,qn.toPath=function(t){return zs(t)?Pe(t,Fo):ca(t)?[t]:Mi(Lo(va(t)))},qn.toPlainObject=ya,qn.transform=function(t,e,n){var r=zs(t),i=r||Xs(t)||la(t);if(e=co(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:ea(t)&&Zs(o)?Un(Jt(t)):{}}return(i?Ce:wr)(t,function(t,r,i){return e(n,t,r,i)}),n},qn.unary=function(t){return Os(t,1)},qn.union=ns,qn.unionBy=rs,qn.unionWith=is,qn.uniq=function(t){return t&&t.length?hi(t):[]},qn.uniqBy=function(t,e){return t&&t.length?hi(t,co(e,2)):[]},qn.uniqWith=function(t,e){return e="function"==typeof e?e:i,t&&t.length?hi(t,i,e):[]},qn.unset=function(t,e){return null==t||di(t,e)},qn.unzip=os,qn.unzipWith=ss,qn.update=function(t,e,n){return null==t?t:pi(t,e,vi(n))},qn.updateWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:pi(t,e,vi(n),r)},qn.values=qa,qn.valuesIn=function(t){return null==t?[]:tn(t,ja(t))},qn.without=as,qn.words=Za,qn.wrap=function(t,e){return Fs(vi(e),t)},qn.xor=us,qn.xorBy=cs,qn.xorWith=ls,qn.zip=hs,qn.zipObject=function(t,e){return _i(t||[],e||[],nr)},qn.zipObjectDeep=function(t,e){return _i(t||[],e||[],ti)},qn.zipWith=ds,qn.entries=$a,qn.entriesIn=Ba,qn.extend=wa,qn.extendWith=xa,uu(qn,qn),qn.add=yu,qn.attempt=Ya,qn.camelCase=Ua,qn.capitalize=Va,qn.ceil=vu,qn.clamp=function(t,e,n){return n===i&&(n=e,e=i),n!==i&&(n=(n=_a(n))==n?n:0),e!==i&&(e=(e=_a(e))==e?e:0),ur(_a(t),e,n)},qn.clone=function(t){return cr(t,4)},qn.cloneDeep=function(t){return cr(t,5)},qn.cloneDeepWith=function(t,e){return cr(t,5,e="function"==typeof e?e:i)},qn.cloneWith=function(t,e){return cr(t,4,e="function"==typeof e?e:i)},qn.conformsTo=function(t,e){return null==e||lr(t,e,Ia(e))},qn.deburr=Ga,qn.defaultTo=function(t,e){return null==t||t!=t?e:t},qn.divide=bu,qn.endsWith=function(t,e,n){t=va(t),e=li(e);var r=t.length,o=n=n===i?r:ur(ma(n),0,r);return(n-=e.length)>=0&&t.slice(n,o)==e},qn.eq=qs,qn.escape=function(t){return(t=va(t))&&Q.test(t)?t.replace(X,sn):t},qn.escapeRegExp=function(t){return(t=va(t))&&ot.test(t)?t.replace(it,"\\$&"):t},qn.every=function(t,e,n){var r=zs(t)?Ne:mr;return n&&wo(t,e,n)&&(e=i),r(t,co(e,3))},qn.find=_s,qn.findIndex=Go,qn.findKey=function(t,e){return qe(t,co(e,3),wr)},qn.findLast=ys,qn.findLastIndex=zo,qn.findLastKey=function(t,e){return qe(t,co(e,3),xr)},qn.floor=wu,qn.forEach=vs,qn.forEachRight=bs,qn.forIn=function(t,e){return null==t?t:vr(t,co(e,3),ja)},qn.forInRight=function(t,e){return null==t?t:br(t,co(e,3),ja)},qn.forOwn=function(t,e){return t&&wr(t,co(e,3))},qn.forOwnRight=function(t,e){return t&&xr(t,co(e,3))},qn.get=Ea,qn.gt=Us,qn.gte=Vs,qn.has=function(t,e){return null!=t&&_o(t,e,Or)},qn.hasIn=Oa,qn.head=Jo,qn.identity=iu,qn.includes=function(t,e,n,r){t=Js(t)?t:qa(t),n=n&&!r?ma(n):0;var i=t.length;return n<0&&(n=vn(i+n,0)),ua(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Ve(t,e,n)>-1},qn.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ma(n);return i<0&&(i=vn(r+i,0)),Ve(t,e,i)},qn.inRange=function(t,e,n){return e=fa(e),n===i?(n=e,e=0):n=fa(n),function(t,e,n){return t>=bn(e,n)&&t<vn(e,n)}(t=_a(t),e,n)},qn.invoke=Na,qn.isArguments=Gs,qn.isArray=zs,qn.isArrayBuffer=Ws,qn.isArrayLike=Js,qn.isArrayLikeObject=Hs,qn.isBoolean=function(t){return!0===t||!1===t||na(t)&&Ar(t)==b},qn.isBuffer=Xs,qn.isDate=Ks,qn.isElement=function(t){return na(t)&&1===t.nodeType&&!oa(t)},qn.isEmpty=function(t){if(null==t)return!0;if(Js(t)&&(zs(t)||"string"==typeof t||"function"==typeof t.splice||Xs(t)||la(t)||Gs(t)))return!t.length;var e=go(t);if(e==S||e==M)return!t.size;if(So(t))return!Lr(t).length;for(var n in t)if(Dt.call(t,n))return!1;return!0},qn.isEqual=function(t,e){return jr(t,e)},qn.isEqualWith=function(t,e,n){var r=(n="function"==typeof n?n:i)?n(t,e):i;return r===i?jr(t,e,i,n):!!r},qn.isError=Qs,qn.isFinite=function(t){return"number"==typeof t&&be(t)},qn.isFunction=Zs,qn.isInteger=Ys,qn.isLength=ta,qn.isMap=ra,qn.isMatch=function(t,e){return t===e||Rr(t,e,ho(e))},qn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:i,Rr(t,e,ho(e),n)},qn.isNaN=function(t){return ia(t)&&t!=+t},qn.isNative=function(t){if(ko(t))throw new kt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Pr(t)},qn.isNil=function(t){return null==t},qn.isNull=function(t){return null===t},qn.isNumber=ia,qn.isObject=ea,qn.isObjectLike=na,qn.isPlainObject=oa,qn.isRegExp=sa,qn.isSafeInteger=function(t){return Ys(t)&&t>=-9007199254740991&&t<=f},qn.isSet=aa,qn.isString=ua,qn.isSymbol=ca,qn.isTypedArray=la,qn.isUndefined=function(t){return t===i},qn.isWeakMap=function(t){return na(t)&&go(t)==j},qn.isWeakSet=function(t){return na(t)&&"[object WeakSet]"==Ar(t)},qn.join=function(t,e){return null==t?"":Be.call(t,e)},qn.kebabCase=za,qn.last=Qo,qn.lastIndexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=ma(n))<0?vn(r+o,0):bn(o,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,o):Ue(t,ze,o,!0)},qn.lowerCase=Wa,qn.lowerFirst=Ja,qn.lt=ha,qn.lte=da,qn.max=function(t){return t&&t.length?gr(t,iu,Er):i},qn.maxBy=function(t,e){return t&&t.length?gr(t,co(e,2),Er):i},qn.mean=function(t){return We(t,iu)},qn.meanBy=function(t,e){return We(t,co(e,2))},qn.min=function(t){return t&&t.length?gr(t,iu,$r):i},qn.minBy=function(t,e){return t&&t.length?gr(t,co(e,2),$r):i},qn.stubArray=gu,qn.stubFalse=_u,qn.stubObject=function(){return{}},qn.stubString=function(){return""},qn.stubTrue=function(){return!0},qn.multiply=Tu,qn.nth=function(t,e){return t&&t.length?Gr(t,ma(e)):i},qn.noConflict=function(){return me._===this&&(me._=qt),this},qn.noop=cu,qn.now=Es,qn.pad=function(t,e,n){t=va(t);var r=(e=ma(e))?fn(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return zi(ge(i),n)+t+zi(fe(i),n)},qn.padEnd=function(t,e,n){t=va(t);var r=(e=ma(e))?fn(t):0;return e&&r<e?t+zi(e-r,n):t},qn.padStart=function(t,e,n){t=va(t);var r=(e=ma(e))?fn(t):0;return e&&r<e?zi(e-r,n)+t:t},qn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),xn(va(t).replace(st,""),e||0)},qn.random=function(t,e,n){if(n&&"boolean"!=typeof n&&wo(t,e,n)&&(e=n=i),n===i&&("boolean"==typeof e?(n=e,e=i):"boolean"==typeof t&&(n=t,t=i)),t===i&&e===i?(t=0,e=1):(t=fa(t),e===i?(e=t,t=0):e=fa(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var o=Tn();return bn(t+o*(e-t+he("1e-"+((o+"").length-1))),e)}return Xr(t,e)},qn.reduce=function(t,e,n){var r=zs(t)?Le:Xe,i=arguments.length<3;return r(t,co(e,4),n,i,pr)},qn.reduceRight=function(t,e,n){var r=zs(t)?Fe:Xe,i=arguments.length<3;return r(t,co(e,4),n,i,fr)},qn.repeat=function(t,e,n){return e=(n?wo(t,e,n):e===i)?1:ma(e),Kr(va(t),e)},qn.replace=function(){var t=arguments,e=va(t[0]);return t.length<3?e:e.replace(t[1],t[2])},qn.result=function(t,e,n){var r=-1,o=(e=bi(e,t)).length;for(o||(o=1,t=i);++r<o;){var s=null==t?i:t[Fo(e[r])];s===i&&(r=o,s=n),t=Zs(s)?s.call(t):s}return t},qn.round=ku,qn.runInContext=t,qn.sample=function(t){return(zs(t)?Zn:Zr)(t)},qn.size=function(t){if(null==t)return 0;if(Js(t))return ua(t)?fn(t):t.length;var e=go(t);return e==S||e==M?t.size:Lr(t).length},qn.snakeCase=Ha,qn.some=function(t,e,n){var r=zs(t)?$e:oi;return n&&wo(t,e,n)&&(e=i),r(t,co(e,3))},qn.sortedIndex=function(t,e){return si(t,e)},qn.sortedIndexBy=function(t,e,n){return ai(t,e,co(n,2))},qn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=si(t,e);if(r<n&&qs(t[r],e))return r}return-1},qn.sortedLastIndex=function(t,e){return si(t,e,!0)},qn.sortedLastIndexBy=function(t,e,n){return ai(t,e,co(n,2),!0)},qn.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var n=si(t,e,!0)-1;if(qs(t[n],e))return n}return-1},qn.startCase=Xa,qn.startsWith=function(t,e,n){return t=va(t),n=null==n?0:ur(ma(n),0,t.length),e=li(e),t.slice(n,n+e.length)==e},qn.subtract=Su,qn.sum=function(t){return t&&t.length?Ke(t,iu):0},qn.sumBy=function(t,e){return t&&t.length?Ke(t,co(e,2)):0},qn.template=function(t,e,n){var r=qn.templateSettings;n&&wo(t,e,n)&&(e=i),t=va(t),e=xa({},e,r,Yi);var o,s,a=xa({},e.imports,r.imports,Yi),u=Ia(a),c=tn(a,u),l=0,h=e.interpolate||xt,d="__p += '",p=Ot((e.escape||xt).source+"|"+h.source+"|"+(h===tt?ft:xt).source+"|"+(e.evaluate||xt).source+"|$","g"),f="//# sourceURL="+(Dt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ae+"]")+"\n";t.replace(p,function(e,n,r,i,a,u){return r||(r=i),d+=t.slice(l,u).replace(Tt,an),n&&(o=!0,d+="' +\n__e("+n+") +\n'"),a&&(s=!0,d+="';\n"+a+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+e.length,e}),d+="';\n";var m=Dt.call(e,"variable")&&e.variable;if(m){if(dt.test(m))throw new kt("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(s?d.replace(z,""):d).replace(W,"$1").replace(J,"$1;"),d="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=Ya(function(){return St(u,f+"return "+d).apply(i,c)});if(g.source=d,Qs(g))throw g;return g},qn.times=function(t,e){if((t=ma(t))<1||t>f)return[];var n=g,r=bn(t,g);e=co(e),t-=g;for(var i=Qe(r,e);++n<t;)e(n);return i},qn.toFinite=fa,qn.toInteger=ma,qn.toLength=ga,qn.toLower=function(t){return va(t).toLowerCase()},qn.toNumber=_a,qn.toSafeInteger=function(t){return t?ur(ma(t),-9007199254740991,f):0===t?t:0},qn.toString=va,qn.toUpper=function(t){return va(t).toUpperCase()},qn.trim=function(t,e,n){if((t=va(t))&&(n||e===i))return Ze(t);if(!t||!(e=li(e)))return t;var r=mn(t),o=mn(e);return xi(r,nn(r,o),rn(r,o)+1).join("")},qn.trimEnd=function(t,e,n){if((t=va(t))&&(n||e===i))return t.slice(0,gn(t)+1);if(!t||!(e=li(e)))return t;var r=mn(t);return xi(r,0,rn(r,mn(e))+1).join("")},qn.trimStart=function(t,e,n){if((t=va(t))&&(n||e===i))return t.replace(st,"");if(!t||!(e=li(e)))return t;var r=mn(t);return xi(r,nn(r,mn(e))).join("")},qn.truncate=function(t,e){var n=30,r="...";if(ea(e)){var o="separator"in e?e.separator:o;n="length"in e?ma(e.length):n,r="omission"in e?li(e.omission):r}var s=(t=va(t)).length;if(un(t)){var a=mn(t);s=a.length}if(n>=s)return t;var u=n-fn(r);if(u<1)return r;var c=a?xi(a,0,u).join(""):t.slice(0,u);if(o===i)return c+r;if(a&&(u+=c.length-u),sa(o)){if(t.slice(u).search(o)){var l,h=c;for(o.global||(o=Ot(o.source,va(mt.exec(o))+"g")),o.lastIndex=0;l=o.exec(h);)var d=l.index;c=c.slice(0,d===i?u:d)}}else if(t.indexOf(li(o),u)!=u){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+r},qn.unescape=function(t){return(t=va(t))&&K.test(t)?t.replace(H,_n):t},qn.uniqueId=function(t){var e=++Lt;return va(t)+e},qn.upperCase=Ka,qn.upperFirst=Qa,qn.each=vs,qn.eachRight=bs,qn.first=Jo,uu(qn,(xu={},wr(qn,function(t,e){Dt.call(qn.prototype,e)||(xu[e]=t)}),xu),{chain:!1}),qn.VERSION="4.17.23",Ce(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){qn[t].placeholder=qn}),Ce(["drop","take"],function(t,e){zn.prototype[t]=function(n){n=n===i?1:vn(ma(n),0);var r=this.__filtered__&&!e?new zn(this):this.clone();return r.__filtered__?r.__takeCount__=bn(n,r.__takeCount__):r.__views__.push({size:bn(n,g),type:t+(r.__dir__<0?"Right":"")}),r},zn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),Ce(["filter","map","takeWhile"],function(t,e){var n=e+1,r=1==n||3==n;zn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:co(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}}),Ce(["head","last"],function(t,e){var n="take"+(e?"Right":"");zn.prototype[t]=function(){return this[n](1).value()[0]}}),Ce(["initial","tail"],function(t,e){var n="drop"+(e?"":"Right");zn.prototype[t]=function(){return this.__filtered__?new zn(this):this[n](1)}}),zn.prototype.compact=function(){return this.filter(iu)},zn.prototype.find=function(t){return this.filter(t).head()},zn.prototype.findLast=function(t){return this.reverse().find(t)},zn.prototype.invokeMap=Qr(function(t,e){return"function"==typeof t?new zn(this):this.map(function(n){return Nr(n,t,e)})}),zn.prototype.reject=function(t){return this.filter(Ds(co(t)))},zn.prototype.slice=function(t,e){t=ma(t);var n=this;return n.__filtered__&&(t>0||e<0)?new zn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==i&&(n=(e=ma(e))<0?n.dropRight(-e):n.take(e-t)),n)},zn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},zn.prototype.toArray=function(){return this.take(g)},wr(zn.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),o=qn[r?"take"+("last"==e?"Right":""):e],s=r||/^find/.test(e);o&&(qn.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,u=e instanceof zn,c=a[0],l=u||zs(e),h=function(t){var e=o.apply(qn,De([t],a));return r&&d?e[0]:e};l&&n&&"function"==typeof c&&1!=c.length&&(u=l=!1);var d=this.__chain__,p=!!this.__actions__.length,f=s&&!d,m=u&&!p;if(!s&&l){e=m?e:new zn(this);var g=t.apply(e,a);return g.__actions__.push({func:fs,args:[h],thisArg:i}),new Gn(g,d)}return f&&m?t.apply(this,a):(g=this.thru(h),f?r?g.value()[0]:g.value():g)})}),Ce(["pop","push","shift","sort","splice","unshift"],function(t){var e=Nt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);qn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(zs(i)?i:[],t)}return this[n](function(n){return e.apply(zs(n)?n:[],t)})}}),wr(zn.prototype,function(t,e){var n=qn[e];if(n){var r=n.name+"";Dt.call(In,r)||(In[r]=[]),In[r].push({name:e,func:n})}}),In[qi(i,2).name]=[{name:"wrapper",func:i}],zn.prototype.clone=function(){var t=new zn(this.__wrapped__);return t.__actions__=Mi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Mi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Mi(this.__views__),t},zn.prototype.reverse=function(){if(this.__filtered__){var t=new zn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},zn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=zs(t),r=e<0,i=n?t.length:0,o=function(t,e,n){var r=-1,i=n.length;for(;++r<i;){var o=n[r],s=o.size;switch(o.type){case"drop":t+=s;break;case"dropRight":e-=s;break;case"take":e=bn(e,t+s);break;case"takeRight":t=vn(t,e-s)}}return{start:t,end:e}}(0,i,this.__views__),s=o.start,a=o.end,u=a-s,c=r?a:s-1,l=this.__iteratees__,h=l.length,d=0,p=bn(u,this.__takeCount__);if(!n||!r&&i==u&&p==u)return mi(t,this.__actions__);var f=[];t:for(;u--&&d<p;){for(var m=-1,g=t[c+=e];++m<h;){var _=l[m],y=_.iteratee,v=_.type,b=y(g);if(2==v)g=b;else if(!b){if(1==v)continue t;break t}}f[d++]=g}return f},qn.prototype.at=ms,qn.prototype.chain=function(){return ps(this)},qn.prototype.commit=function(){return new Gn(this.value(),this.__chain__)},qn.prototype.next=function(){this.__values__===i&&(this.__values__=pa(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?i:this.__values__[this.__index__++]}},qn.prototype.plant=function(t){for(var e,n=this;n instanceof Vn;){var r=Bo(n);r.__index__=0,r.__values__=i,e?o.__wrapped__=r:e=r;var o=r;n=n.__wrapped__}return o.__wrapped__=t,e},qn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof zn){var e=t;return this.__actions__.length&&(e=new zn(this)),(e=e.reverse()).__actions__.push({func:fs,args:[es],thisArg:i}),new Gn(e,this.__chain__)}return this.thru(es)},qn.prototype.toJSON=qn.prototype.valueOf=qn.prototype.value=function(){return mi(this.__wrapped__,this.__actions__)},qn.prototype.first=qn.prototype.head,Zt&&(qn.prototype[Zt]=function(){return this}),qn}();me._=yn,(r=function(){return yn}.call(e,n,e,t))===i||(t.exports=r)}.call(this)},79(t){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r},t.exports.__esModule=!0,t.exports.default=t.exports},2987(t){t.exports=function(t){if(Array.isArray(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},7383(t){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},4579(t,e,n){var r=n(7736);function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,r(i.key),i)}}t.exports=function(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},1156(t){t.exports=function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,s,a=[],u=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);u=!0);}catch(t){c=!0,i=t}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}},t.exports.__esModule=!0,t.exports.default=t.exports},7752(t){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},5715(t,e,n){var r=n(2987),i=n(1156),o=n(7122),s=n(7752);t.exports=function(t,e){return r(t)||i(t,e)||o(t,e)||s()},t.exports.__esModule=!0,t.exports.default=t.exports},9045(t,e,n){var r=n(3738).default;t.exports=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},7736(t,e,n){var r=n(3738).default,i=n(9045);t.exports=function(t){var e=i(t,"string");return"symbol"==r(e)?e:e+""},t.exports.__esModule=!0,t.exports.default=t.exports},3738(t){function e(n){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},7122(t,e,n){var r=n(79);t.exports=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var r={};n.r(r),n.d(r,{hasBrowserEnv:()=>Zf,hasStandardBrowserEnv:()=>tm,hasStandardBrowserWebWorkerEnv:()=>em,navigator:()=>Yf,origin:()=>nm});var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},i(t,e)};function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function s(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s}function a(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}u((r=r.apply(t,e||[])).next())})}function u(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}Object.create;function c(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function h(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function d(t){return this instanceof d?(this.v=t,this):new d(t)}function p(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(t,e||[]),o=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",function(t){return function(e){return Promise.resolve(e).then(t,c)}}),r[Symbol.asyncIterator]=function(){return this},r;function s(t,e){i[t]&&(r[t]=function(e){return new Promise(function(n,r){o.push([t,e,n,r])>1||a(t,e)})},e&&(r[t]=e(r[t])))}function a(t,e){try{(n=i[t](e)).value instanceof d?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(t){l(o[0][3],t)}var n}function u(t){a("next",t)}function c(t){a("throw",t)}function l(t,e){t(e),o.shift(),o.length&&a(o[0][0],o[0][1])}}function f(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=c(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise(function(r,i){(function(t,e,n,r){Promise.resolve(r).then(function(e){t({value:e,done:n})},e)})(r,i,(e=t[n](e)).done,e.value)})}}}Object.create;"function"==typeof SuppressedError&&SuppressedError;function m(t){return"function"==typeof t}function g(t){return function(e){if(function(t){return m(null==t?void 0:t.lift)}(e))return e.lift(function(e){try{return t(e,this)}catch(t){this.error(t)}});throw new TypeError("Unable to lift unknown Observable type")}}function _(t){var e=t(function(t){Error.call(t),t.stack=(new Error).stack});return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var y=_(function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map(function(t,e){return e+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}});function v(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var b=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var t,e,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=c(o),a=s.next();!a.done;a=s.next()){a.value.remove(this)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}else o.remove(this);var u=this.initialTeardown;if(m(u))try{u()}catch(t){i=t instanceof y?t.errors:[t]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var p=c(d),f=p.next();!f.done;f=p.next()){var g=f.value;try{T(g)}catch(t){i=null!=i?i:[],t instanceof y?i=h(h([],l(i)),l(t.errors)):i.push(t)}}}catch(t){n={error:t}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}}if(i)throw new y(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)T(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&v(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&v(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),w=b.EMPTY;function x(t){return t instanceof b||t&&"closed"in t&&m(t.remove)&&m(t.add)&&m(t.unsubscribe)}function T(t){m(t)?t():t.unsubscribe()}var k={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},S={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=S.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,h([t,e],l(n))):setTimeout.apply(void 0,h([t,e],l(n)))},clearTimeout:function(t){var e=S.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function A(t){S.setTimeout(function(){var e=k.onUnhandledError;if(!e)throw t;e(t)})}function E(){}var O=C("C",void 0,void 0);function C(t,e,n){return{kind:t,value:e,error:n}}var M=null;function N(t){if(k.useDeprecatedSynchronousErrorHandling){var e=!M;if(e&&(M={errorThrown:!1,error:null}),t(),e){var n=M,r=n.errorThrown,i=n.error;if(M=null,r)throw i}}else t()}var I=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,x(e)&&e.add(n)):n.destination=$,n}return o(e,t),e.create=function(t,e,n){return new D(t,e,n)},e.prototype.next=function(t){this.isStopped?F(function(t){return C("N",t,void 0)}(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?F(C("E",void 0,t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?F(O,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(b),j=Function.prototype.bind;function R(t,e){return j.call(t,e)}var P=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){L(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){L(t)}else L(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){L(t)}},t}(),D=function(t){function e(e,n,r){var i,o,s=t.call(this)||this;m(e)||!e?i={next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&k.useDeprecatedNextContext?((o=Object.create(e)).unsubscribe=function(){return s.unsubscribe()},i={next:e.next&&R(e.next,o),error:e.error&&R(e.error,o),complete:e.complete&&R(e.complete,o)}):i=e;return s.destination=new P(i),s}return o(e,t),e}(I);function L(t){var e;k.useDeprecatedSynchronousErrorHandling?(e=t,k.useDeprecatedSynchronousErrorHandling&&M&&(M.errorThrown=!0,M.error=e)):A(t)}function F(t,e){var n=k.onStoppedNotification;n&&S.setTimeout(function(){return n(t,e)})}var $={closed:!0,next:E,error:function(t){throw t},complete:E};function B(t,e,n,r,i){return new q(t,e,n,r,i)}var q=function(t){function e(e,n,r,i,o,s){var a=t.call(this,e)||this;return a.onFinalize=o,a.shouldUnsubscribe=s,a._next=n?function(t){try{n(t)}catch(t){e.error(t)}}:t.prototype._next,a._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,a._complete=r?function(){try{r()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,a}return o(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(I);function U(t,e){return g(function(n,r){var i=0;n.subscribe(B(r,function(n){r.next(t.call(e,n,i++))}))})}var V=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function G(t){return m(null==t?void 0:t.then)}var z="function"==typeof Symbol&&Symbol.observable||"@@observable";function W(t){return t}function J(t){return 0===t.length?W:1===t.length?t[0]:function(e){return t.reduce(function(t,e){return e(t)},e)}}var H=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r,i=this,o=(r=t)&&r instanceof I||function(t){return t&&m(t.next)&&m(t.error)&&m(t.complete)}(r)&&x(r)?t:new D(t,e,n);return N(function(){var t=i,e=t.operator,n=t.source;o.add(e?e.call(o,n):n?i._subscribe(o):i._trySubscribe(o))}),o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=X(e))(function(e,r){var i=new D({next:function(e){try{t(e)}catch(t){r(t),i.unsubscribe()}},error:r,complete:e});n.subscribe(i)})},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[z]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return J(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=X(t))(function(t,n){var r;e.subscribe(function(t){return r=t},function(t){return n(t)},function(){return t(r)})})},t.create=function(e){return new t(e)},t}();function X(t){var e;return null!==(e=null!=t?t:k.Promise)&&void 0!==e?e:Promise}function K(t){return m(t[z])}function Q(t){return Symbol.asyncIterator&&m(null==t?void 0:t[Symbol.asyncIterator])}function Z(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Y="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function tt(t){return m(null==t?void 0:t[Y])}function et(t){return p(this,arguments,function(){var e,n,r;return u(this,function(i){switch(i.label){case 0:e=t.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,d(e.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,d(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,d(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function nt(t){return m(null==t?void 0:t.getReader)}function rt(t){if(t instanceof H)return t;if(null!=t){if(K(t))return i=t,new H(function(t){var e=i[z]();if(m(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(V(t))return r=t,new H(function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()});if(G(t))return n=t,new H(function(t){n.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,A)});if(Q(t))return it(t);if(tt(t))return e=t,new H(function(t){var n,r;try{for(var i=c(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()});if(nt(t))return it(et(t))}var e,n,r,i;throw Z(t)}function it(t){return new H(function(e){(function(t,e){var n,r,i,o;return a(this,void 0,void 0,function(){var s,a;return u(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),n=f(t),u.label=1;case 1:return[4,n.next()];case 2:if((r=u.sent()).done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=u.sent(),i={error:a},[3,11];case 6:return u.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})})(t,e).catch(function(t){return e.error(t)})})}function ot(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=e.schedule(function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(o),!i)return o}function st(t,e,n){return void 0===n&&(n=1/0),m(e)?st(function(n,r){return U(function(t,i){return e(n,t,r,i)})(rt(t(n,r)))},n):("number"==typeof e&&(n=e),g(function(e,r){return function(t,e,n,r,i,o,s,a){var u=[],c=0,l=0,h=!1,d=function(){!h||u.length||c||e.complete()},p=function(t){return c<r?f(t):u.push(t)},f=function(t){o&&e.next(t),c++;var a=!1;rt(n(t,l++)).subscribe(B(e,function(t){null==i||i(t),o?p(t):e.next(t)},function(){a=!0},void 0,function(){if(a)try{c--;for(var t=function(){var t=u.shift();s?ot(e,s,function(){return f(t)}):f(t)};u.length&&c<r;)t();d()}catch(t){e.error(t)}}))};return t.subscribe(B(e,p,function(){h=!0,d()})),function(){null==a||a()}}(e,r,t,n)}))}function at(t){return void 0===t&&(t=1/0),st(W,t)}function ut(t){return t&&m(t.schedule)}function ct(t){return t[t.length-1]}function lt(t){return m(ct(t))?t.pop():void 0}function ht(t){return ut(ct(t))?t.pop():void 0}function dt(t,e){return"number"==typeof ct(t)?t.pop():e}function pt(t,e){return void 0===e&&(e=0),g(function(n,r){n.subscribe(B(r,function(n){return ot(r,t,function(){return r.next(n)},e)},function(){return ot(r,t,function(){return r.complete()},e)},function(n){return ot(r,t,function(){return r.error(n)},e)}))})}function ft(t,e){return void 0===e&&(e=0),g(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function mt(t,e){if(!t)throw new Error("Iterable cannot be null");return new H(function(n){ot(n,e,function(){var r=t[Symbol.asyncIterator]();ot(n,e,function(){r.next().then(function(t){t.done?n.complete():n.next(t.value)})},0,!0)})})}function gt(t,e){if(null!=t){if(K(t))return function(t,e){return rt(t).pipe(ft(e),pt(e))}(t,e);if(V(t))return function(t,e){return new H(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}(t,e);if(G(t))return function(t,e){return rt(t).pipe(ft(e),pt(e))}(t,e);if(Q(t))return mt(t,e);if(tt(t))return function(t,e){return new H(function(n){var r;return ot(n,e,function(){r=t[Y](),ot(n,e,function(){var t,e,i;try{e=(t=r.next()).value,i=t.done}catch(t){return void n.error(t)}i?n.complete():n.next(e)},0,!0)}),function(){return m(null==r?void 0:r.return)&&r.return()}})}(t,e);if(nt(t))return function(t,e){return mt(et(t),e)}(t,e)}throw Z(t)}function _t(t,e){return e?gt(t,e):rt(t)}Array.isArray;var yt=new H(function(t){return t.complete()});var vt=Array.isArray,bt=Object.getPrototypeOf,wt=Object.prototype,xt=Object.keys;function Tt(t){if(1===t.length){var e=t[0];if(vt(e))return{args:e,keys:null};if((r=e)&&"object"==typeof r&&bt(r)===wt){var n=xt(e);return{args:n.map(function(t){return e[t]}),keys:n}}}var r;return{args:t,keys:null}}var kt=Array.isArray;function St(t){return U(function(e){return function(t,e){return kt(e)?t.apply(void 0,h([],l(e))):t(e)}(t,e)})}function At(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=ht(t),r=lt(t),i=Tt(t),o=i.args,s=i.keys;if(0===o.length)return _t([],n);var a=new H(Et(o,n,s?function(t){return function(t,e){return t.reduce(function(t,n,r){return t[n]=e[r],t},{})}(s,t)}:W));return r?a.pipe(St(r)):a}function Et(t,e,n){return void 0===n&&(n=W),function(r){Ot(e,function(){for(var i=t.length,o=new Array(i),s=i,a=i,u=function(i){Ot(e,function(){var u=_t(t[i],e),c=!1;u.subscribe(B(r,function(t){o[i]=t,c||(c=!0,a--),a||r.next(n(o.slice()))},function(){--s||r.complete()}))},r)},c=0;c<i;c++)u(c)},r)}}function Ot(t,e,n){t?ot(n,t,e):e()}function Ct(){return at(1)}function Mt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=lt(t);return g(function(e,r){for(var i=t.length,o=new Array(i),s=t.map(function(){return!1}),a=!1,u=function(e){rt(t[e]).subscribe(B(r,function(t){o[e]=t,a||s[e]||(s[e]=!0,(a=s.every(W))&&(s=null))},E))},c=0;c<i;c++)u(c);e.subscribe(B(r,function(t){if(a){var e=h([t],l(o));r.next(n?n.apply(void 0,h([],l(e))):e)}}))})}function Nt(t,e){return g(function(n,r){var i=null,o=0,s=!1,a=function(){return s&&!i&&r.complete()};n.subscribe(B(r,function(n){null==i||i.unsubscribe();var s=0,u=o++;rt(t(n,u)).subscribe(i=B(r,function(t){return r.next(e?e(n,t,u,s++):t)},function(){i=null,a()}))},function(){s=!0,a()}))})}function It(t){return g(function(e,n){rt(t).subscribe(B(n,function(){return n.complete()},E)),!n.closed&&e.subscribe(n)})}var jt=_(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Rt=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return o(e,t),e.prototype.lift=function(t){var e=new Pt(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new jt},e.prototype.next=function(t){var e=this;N(function(){var n,r;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=c(e.currentObservers),o=i.next();!o.done;o=i.next()){o.value.next(t)}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},e.prototype.error=function(t){var e=this;N(function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var n=e.observers;n.length;)n.shift().error(t)}})},e.prototype.complete=function(){var t=this;N(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?w:(this.currentObservers=null,o.push(t),new b(function(){e.currentObservers=null,v(o,t)}))},e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e.thrownError,i=e.isStopped;n?t.error(r):i&&t.complete()},e.prototype.asObservable=function(){var t=new H;return t.source=this,t},e.create=function(t,e){return new Pt(t,e)},e}(H),Pt=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return o(e,t),e.prototype.next=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===n||n.call(e,t)},e.prototype.error=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===n||n.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,n;return null!==(n=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==n?n:w},e}(Rt);function Dt(t){void 0===t&&(t={});var e=t.connector,n=void 0===e?function(){return new Rt}:e,r=t.resetOnError,i=void 0===r||r,o=t.resetOnComplete,s=void 0===o||o,a=t.resetOnRefCountZero,u=void 0===a||a;return function(t){var e,r,o,a=0,c=!1,l=!1,h=function(){null==r||r.unsubscribe(),r=void 0},d=function(){h(),e=o=void 0,c=l=!1},p=function(){var t=e;d(),null==t||t.unsubscribe()};return g(function(t,f){a++,l||c||h();var m=o=null!=o?o:n();f.add(function(){0!==--a||l||c||(r=Lt(p,u))}),m.subscribe(f),!e&&a>0&&(e=new D({next:function(t){return m.next(t)},error:function(t){l=!0,h(),r=Lt(d,i,t),m.error(t)},complete:function(){c=!0,h(),r=Lt(d,s),m.complete()}}),rt(t).subscribe(e))})(t)}}function Lt(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!0!==e){if(!1!==e){var i=new D({next:function(){i.unsubscribe(),t()}});return rt(e.apply(void 0,h([],l(n)))).subscribe(i)}}else t()}function Ft(t,e){return g(function(n,r){var i=0;n.subscribe(B(r,function(n){return t.call(e,n,i++)&&r.next(n)}))})}function $t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=ht(t),r=dt(t,1/0),i=t;return i.length?1===i.length?rt(i[0]):at(r)(_t(i,n)):yt}var Bt=function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}return o(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return!n.closed&&e.next(this._value),n},e.prototype.getValue=function(){var t=this,e=t.hasError,n=t.thrownError,r=t._value;if(e)throw n;return this._throwIfClosed(),r},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(Rt);const qt="https://gdb.leafgon.com/sgraphql",Ut="wss://gdb.leafgon.com/sgraphql",Vt="https://gdb.leafgon.com/qmgraphql",Gt={breezyforest:{_version:"1.0",_nickname:"breezyforest",scaffold:{map:{leaf:{logic:{type:"",args:{}},provenance:{api:"breezyforest",uuid:"",graph:{appuuid:"",name:"",version:""}},appdata:{}}},directory:{api:["leaf","api"],logic:["leaf","logic"],type:["leaf","logic","type"],args:["leaf","logic","args"],provenance:["leaf","provenance"],uuid:["leaf","provenance","uuid"],leafapp:["leaf","provenance","leafapp"],appdata:["leaf","appdata"]},fetch:(t,e)=>{const n=(t,e)=>{const r=e[0],i=e.slice(1);return 0===i.length?t[r]:n(t[r],i)};try{return n(t,Array.isArray(e)?e:Gt.breezyforest.scaffold.directory[e])}catch(t){return null}}},originType:{FRONTEND:1,BACKEND:2,SCREEN:4},subsDirectory:{readmefirst:{},leaflake:{bridges:{gql:"clientconfig_full"}},appintent:{},appmodel:{},appview:{},osview:{},osview2:{},dataflowplane:{},appcache:{}},IOAccessPermission:{Owner:1,Observer:2,Contributor:4,All:7},IOStateGroundZero:{dirOfSubjects:{},subsCache:{},subscriptions:{},callbacks:{},permissions:{}},GQLParameters:{clientconfig_full:{keepGQLConnected:!0,dburi_subs:qt,dburi_subs_ws:Ut,dburi_qm:Vt},clientconfig_sub:{keepGQLConnected:!0,dburi_subs:qt,dburi_subs_ws:Ut},clientconfig_qm:{dburi_qm:Vt},masterquery:"\n {\n domain\n appid\n nodes {\n uuid\n out_edges {uuid source {uuid} target {uuid} data}\n data\n }\n update {\n added {uuid out_edges {uuid source {uuid} target {uuid} data} data} \n removed {uuid}\n }\n }\n ".replace(/\s+/g," ")},LEAFdictionary:{map:U}}},zt=t=>{const e={leafradioRX:{leaf:{logic:{type:"leafradioRX",args:{keyname:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["keyname"],bannednames:["Lambda"],banduplicatename:!0,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafradioRX.svg",width:40,height:30,bgColor:"rgba(235,255,35,0.2)",jsx:void 0}},lambdaports:{input:void 0,output:void 0},dataflow:{input:void 0,output:{_leafradiokey:{keyname:"",subsDirectory:Object},_leafradiorx:{txkey:"",payload:Object}}}},leafradioTX:{leaf:{logic:{type:"leafradioTX",args:{keyname:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["keyname"],bannednames:["Lambda"],banduplicatename:!1,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafradioTX.svg",width:40,height:30,bgColor:"rgba(135,255,135,0.2)",jsx:void 0}},lambdaports:{input:void 0,output:void 0},dataflow:{input:{_leafradiokey:{keyname:"",subsDirectory:Object},_leafradiotx:{txkey:"",payload:Object}},output:void 0}},leafoutflowport:{leaf:{logic:{type:"leafoutflowport",args:{}}},editorconfig:{nodetype:"tinynode",svgicon:{unicode:"⊖",url:void 0,jsx:void 0,fgColor:"rgba(255,255,255,1)",bgColor:"rgba(22,22,55,1)"}},lambdaports:{input:void 0,output:void 0},dataflow:{input:Object,output:void 0}},leafinflowport:{leaf:{logic:{type:"leafinflowport",args:{}}},editorconfig:{nodetype:"tinynode",svgicon:{unicode:"⊕",url:void 0,jsx:void 0,fgColor:"rgba(255,255,255,1)",bgColor:"rgba(55,22,22,1)"}},lambdaports:{input:void 0,output:void 0},dataflow:{input:void 0,output:Object}},leafmemoryio:{leaf:{logic:{type:"leafmemoryio",args:{elementconfig:{leafnodename:""},persistencyref:{updateref:"",dbref:""}}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["elementconfig","leafnodename"],banduplicatename:!1,banmultiplenode:!1,svgicon:{iconname:"memory io",unicode:void 0,url:"leafmemoryio.svg",jsx:void 0,width:40,height:40,bgColor:"rgba(255,255,255,0.6)"}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leafdeckdiamond:Object,_leafdeckclub:Object},output:{_leafdeckheart:Object}}},leafscreenio:{leaf:{logic:{type:"leafscreenio",args:{lispexpression:""}}},editorconfig:{nodetype:"circularnode",banduplicatename:!1,banmultiplenode:!1,svgicon:{iconname:"screen io",unicode:void 0,url:"leafscreenio.svg",jsx:void 0,width:40,height:40,bgColor:"rgba(205,155,215,0.6)"}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leaflisp_in:Object},output:{_leaflisp_out:Object}}},leafdeckspade:{leaf:{logic:{type:"leafdeckspade",args:{elementconfig:{leafnodename:""}}}},editorconfig:{nodetype:"circularnode",namedatakey:["elementconfig","leafnodename"],banmultiplenode:!0,svgicon:{unicode:void 0,url:"leafspade.svg",jsx:void 0}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leafdeckdiamond:Object,_leafdeckclub:Object},output:{_leafdeckspade:Object}}},leafdeckheart:{leaf:{logic:{type:"leafdeckheart",args:{elementconfig:{leafnodename:""}}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["elementconfig","leafnodename"],banduplicatename:!0,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafheart.svg",jsx:void 0}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leafdeckdiamond:Object,_leafdeckclub:Object},output:{_leafdeckheart:Object}}},leafdeckdiamond:{leaf:{logic:{type:"leafdeckdiamond",args:{elementconfig:{leafnodename:""}}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["elementconfig","leafnodename"],svgicon:{unicode:void 0,url:"diamond2.svg",jsx:void 0}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leafdeckclub:Object},output:{_leafdeckdiamond:Object}}},leafdeckclub:{leaf:{logic:{type:"leafdeckclub",args:{elementconfig:{leafnodename:""}}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["elementconfig","leafnodename"],svgicon:{unicode:void 0,url:"club3.svg",jsx:void 0}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leafdeckclubinit:Object},output:{_leafdeckclub:Object}}},leafelement:{leaf:{logic:{type:"leafelement",args:{elementname:"",svgicon:{unicode:void 0,url:"",jsx:Object},elementconfig:""}}},editorconfig:{nodetype:"circularnamednode",is_committable:!0,namedatakey:["elementname"],allowednames:["gnav","popup","editor","text","prompt","http","href","mediaplayer","image","mediainput","midi","sound","html","form","directus","openai","rancher"],banduplicatename:!1,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafelement.svg",width:40,height:40,bgColor:"rgba(35,5,15,0.7)",fgColor:"rgba(255,255,255,1)",jsx:void 0}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafgraph:{leaf:{logic:{type:"leafgraph",args:{graphuuid:"",domain:"",appid:"",graphaddrstr:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["graphaddrstr"],svgicon:{unicode:"✵",url:void 0,jsx:void 0,fgColor:"rgba(255,255,255,1.0)",bgColor:"rgba(220,02,100, 0.5)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leaflambdagraph:{leaf:{logic:{type:"leaflambdagraph",args:{}}},editorconfig:{nodetype:"circularnode",svgicon:{iconname:"contextual lambda",unicode:"λ",url:void 0,jsx:void 0,fgColor:"rgba(255,255,255,1.0)",bgColor:"rgba(0,0,0,0.5)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafanchor:{leaf:{logic:{type:"leafanchor",args:{}}},editorconfig:{nodetype:"tinynode",svgicon:{unicode:void 0,url:"trident_white.svg",width:15,height:15,jsx:void 0,fgColor:"rgba(255,255,255,1)",bgColor:"rgba(102, 102, 255, 1)"}},lambdaports:{input:void 0,output:void 0},dataflow:{input:void 0,output:void 0}},leafspelldef:{leaf:{logic:{type:"leafspelldef",args:{spellname:"",svgicon:{unicode:void 0,url:"",jsx:Object}}}},editorconfig:{nodetype:"rectangularnamednode",namedatakey:["spellname"],banduplicatename:!0,svgicon:{iconname:"spelldef",unicode:void 0,url:"leafspell.svg",jsx:void 0,bgColor:"rgba(80,80,135,0.8)",fgColor:"rgba(250,250,250,1.0)",width:40,height:30}},lambdaports:{input:Object,output:void 0},dataflow:{input:void 0,output:void 0}},leafspell:{leaf:{logic:{type:"leafspell",args:{spellname:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["spellname"],svgicon:{unicode:void 0,url:"leafloopyspell.svg",jsx:void 0,bgColor:"rgba(80,180,135,0.8)",fgColor:"rgba(250,250,250,1.0)",width:40,height:30}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafloopyspell:{leaf:{logic:{type:"leafloopyspell",args:{}}},editorconfig:{nodetype:"rectangularnode",banduplicatename:!0,svgicon:{iconname:"loopy spell",unicode:void 0,url:"leafloopyspell.svg",jsx:void 0,bgColor:"rgba(80,180,135,0.8)",fgColor:"rgba(250,250,250,1.0)",width:40,height:30}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafsyncflow:{leaf:{logic:{type:"leafsyncflow",args:{}}},fconfig:{inputsync:{combineOperator:"combine"}},editorconfig:{nodetype:"circularnode",svgicon:{unicode:void 0,iconname:"sync",url:"leafsyncflow.svg",jsx:void 0,bgColor:"rgba(80,200,255,1.0)",width:40,height:40}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafchronosflow:{leaf:{logic:{type:"leafchronosflow",args:{}}},fconfig:{inputsync:{combineOperator:"combine"}},editorconfig:{nodetype:"circularnode",svgicon:{unicode:void 0,iconname:"Chronos",url:"leafsyncflow.svg",jsx:void 0,bgColor:"rgba(80,200,255,1.0)",width:40,height:40}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafasyncflow:{leaf:{logic:{type:"leafasyncflow",args:{}}},fconfig:{inputsync:{combineOperator:"combine"}},editorconfig:{nodetype:"circularnode",svgicon:{unicode:void 0,iconname:"async",url:"leafsyncflow.svg",jsx:void 0,bgColor:"rgba(80,200,255,1.0)",width:40,height:40}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafmixflow:{leaf:{logic:{type:"leafmixflow",args:{mixOperator:"merge"}}},fconfig:{inputsync:void 0},editorconfig:{nodetype:"circularnode",svgicon:{iconname:"mix",unicode:void 0,url:"leafmixflow.svg",jsx:void 0,bgColor:"rgba(80,150,255,0.8)",width:40,height:40}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafgateflow:{leaf:{logic:{type:"leafgateflow",args:{keyname:"",notgatetoggle:!1}}},fconfig:{inputsync:{combineOperator:"merge"}},editorconfig:{nodetype:"circularnamedboolnode",namedatakey:["keyname"],toggledatakey:["notgatetoggle"],svgicon:{unicode:void 0,url:"leafgate.svg",jsx:void 0,width:40,height:30,bgColor0:"rgba(135,55,135,0.2)",bgColor1:"rgba(35,255,135,0.2)",toggleSymbol0:"⊜",toggleSymbol1:"≠"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leaflabel:{leaf:{logic:{type:"leaflabel",args:{labelstr:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["labelstr"],svgicon:{unicode:void 0,url:"leaflabel.svg",jsx:void 0,width:40,height:30,bgColor:"rgba(165,55,185,0.7)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafdelabel:{leaf:{logic:{type:"leafdelabel",args:{labelstr:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["labelstr"],svgicon:{unicode:void 0,url:"leafdelabel.svg",jsx:void 0,width:40,height:30,bgColor:"rgba(235,55,135,0.7)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafbottle:{leaf:{logic:{type:"leafbottle",args:{bottlekey:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["bottlekey"],banduplicatename:!1,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafbottle.svg",jsx:void 0,width:40,height:30,bgColor:"rgba(135,255,135,0.2)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafunbottle:{leaf:{logic:{type:"leafunbottle",args:{bottlekey:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["bottlekey"],banduplicatename:!1,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafunbottle.svg",jsx:void 0,width:40,height:30,bgColor:"rgba(255,155,215,0.4)"}},lambdaports:{input:void 0,output:Object},dataflow:{input:Object,output:Object}},leafcrate:{leaf:{logic:{type:"leafcrate",args:{}}},editorconfig:{nodetype:"circularnode",svgicon:{iconname:"{crate}",unicode:void 0,url:"leafcrate.svg",jsx:void 0,width:40,height:40,bgColor:"rgba(155,205,85,0.7)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafconfig:{leaf:{logic:{type:"leafconfig",args:{}}},editorconfig:{nodetype:"rectangularnode",banmultiplenode:!0,svgicon:{iconname:"config",unicode:void 0,url:"leafconfig.svg",jsx:void 0,width:40,height:40,bgColor:"rgba(255,205,85,1.0)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leaflisp:{leaf:{logic:{type:"leaflisp",args:{lispexpression:""}}},editorconfig:{nodetype:"circularnode",svgicon:{iconname:"leaflisp",unicode:void 0,url:"leaflisp.svg",jsx:void 0,width:40,height:40,bgColor:"rgba(205,255,215,0.7)"}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leaflisp_in:Object},output:{_leaflisp_out:Object}}}};return void 0===t?e:t in e?e[t]:void 0},Wt={outport:"leafoutflowport",inport:"leafinflowport",screenio:"leafscreenio",memoryio:"leafmemoryio",spade:"leafdeckspade",heart:"leafdeckheart",diamond:"leafdeckdiamond",club:"leafdeckclub",element:"leafelement",anchor:"leafanchor",leafgraph:"leafgraph",lambda:"leaflambdagraph",spelldef:"leafspelldef",spell:"leafspell",loopyspell:"leafloopyspell",label:"leaflabel",delabel:"leafdelabel",bottle:"leafbottle",unbottle:"leafunbottle",crate:"leafcrate",config:"leafconfig",chronos:"leafchronosflow",async:"leafasyncflow",sync:"leafsyncflow",mix:"leafmixflow",gate:"leafgateflow",leaflisp:"leaflisp"},Jt={io:["leafradioRX","leafradioTX","leafoutflowport","leafinflowport","leafscreenio","leafmemoryio"],elements:["leafdeckspade","leafdeckheart","leafdeckdiamond","leafdeckclub","leafelement"],abstraction:["leafgraph","leaflambdagraph","leafspelldef","leafspell","leafloopyspell"],dataflow:["leaflabel","leafdelabel","leafbottle","leafunbottle","leafcrate"],arcane:["leaflisp"]},Ht={leaflambdaedge:{sourceHandle:"out_aux",targetHandle:"in_aux"},leafanchoredge:{sourceHandle:"out_anchor",targetHandle:"in_anchor"},leafdataedge:{sourceHandle:"out_a",targetHandle:"in_a"}},Xt={leaflambdaedge:{stroke:"#fff",fillOpacity:0},leafanchoredge:{stroke:"#88f",fillOpacity:0},leafdataedge:{stroke:"#fff",fillOpacity:0}};var Kt=n(7007);let Qt=function(){const t=arguments[0];for(let e=1,n=arguments.length;e<n;e++)if(arguments[e])for(const n in arguments[e])t[n]=arguments[e][n];return t};function Zt(t,e,n,r){const i=t._nodes.get(e);let o=null;return i?(o="mixed"===r?i.out&&i.out[n]||i.undirected&&i.undirected[n]:"directed"===r?i.out&&i.out[n]:i.undirected&&i.undirected[n],o):o}function Yt(t){return"object"==typeof t&&null!==t}function te(t){let e;for(e in t)return!1;return!0}function ee(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function ne(t,e,n){const r={enumerable:!0,configurable:!0};"function"==typeof n?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(t,e,r)}function re(t){return!!Yt(t)&&!(t.attributes&&!Array.isArray(t.attributes))}function ie(){const t=arguments;let e=null,n=-1;return{[Symbol.iterator](){return this},next(){let r=null;for(;;){if(null===e){if(n++,n>=t.length)return{done:!0};e=t[n][Symbol.iterator]()}if(r=e.next(),!r.done)break;e=null}return r}}}function oe(){return{[Symbol.iterator](){return this},next:()=>({done:!0})}}"function"==typeof Object.assign&&(Qt=Object.assign);class se extends Error{constructor(t){super(),this.name="GraphError",this.message=t}}class ae extends se{constructor(t){super(t),this.name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,ae.prototype.constructor)}}class ue extends se{constructor(t){super(t),this.name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,ue.prototype.constructor)}}class ce extends se{constructor(t){super(t),this.name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,ce.prototype.constructor)}}function le(t,e){this.key=t,this.attributes=e,this.clear()}function he(t,e){this.key=t,this.attributes=e,this.clear()}function de(t,e){this.key=t,this.attributes=e,this.clear()}function pe(t,e,n,r,i){this.key=e,this.attributes=i,this.undirected=t,this.source=n,this.target=r}le.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},he.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},de.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},pe.prototype.attach=function(){let t="out",e="in";this.undirected&&(t=e="undirected");const n=this.source.key,r=this.target.key;this.source[t][r]=this,this.undirected&&n===r||(this.target[e][n]=this)},pe.prototype.attachMulti=function(){let t="out",e="in";const n=this.source.key,r=this.target.key;this.undirected&&(t=e="undirected");const i=this.source[t],o=i[r];if(void 0===o)return i[r]=this,void(this.undirected&&n===r||(this.target[e][n]=this));o.previous=this,this.next=o,i[r]=this,this.target[e][n]=this},pe.prototype.detach=function(){const t=this.source.key,e=this.target.key;let n="out",r="in";this.undirected&&(n=r="undirected"),delete this.source[n][e],delete this.target[r][t]},pe.prototype.detachMulti=function(){const t=this.source.key,e=this.target.key;let n="out",r="in";this.undirected&&(n=r="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][e],delete this.target[r][t]):(this.next.previous=void 0,this.source[n][e]=this.next,this.target[r][t]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};function fe(t,e,n,r,i,o,s){let a,u,c,l;if(r=""+r,0===n){if(a=t._nodes.get(r),!a)throw new ue(`Graph.${e}: could not find the "${r}" node in the graph.`);c=i,l=o}else if(3===n){if(i=""+i,u=t._edges.get(i),!u)throw new ue(`Graph.${e}: could not find the "${i}" edge in the graph.`);const n=u.source.key,h=u.target.key;if(r===n)a=u.target;else{if(r!==h)throw new ue(`Graph.${e}: the "${r}" node is not attached to the "${i}" edge (${n}, ${h}).`);a=u.source}c=o,l=s}else{if(u=t._edges.get(r),!u)throw new ue(`Graph.${e}: could not find the "${r}" edge in the graph.`);a=1===n?u.source:u.target,c=i,l=o}return[a,c,l]}const me=[{name:t=>`get${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=fe(this,e,n,t,r,i);return o.attributes[s]}}},{name:t=>`get${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r){const[i]=fe(this,e,n,t,r);return i.attributes}}},{name:t=>`has${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=fe(this,e,n,t,r,i);return o.attributes.hasOwnProperty(s)}}},{name:t=>`set${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i,o){const[s,a,u]=fe(this,e,n,t,r,i,o);return s.attributes[a]=u,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:a}),this}}},{name:t=>`update${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i,o){const[s,a,u]=fe(this,e,n,t,r,i,o);if("function"!=typeof u)throw new ae(`Graph.${e}: updater should be a function.`);const c=s.attributes,l=u(c[a]);return c[a]=l,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:a}),this}}},{name:t=>`remove${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=fe(this,e,n,t,r,i);return delete o.attributes[s],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:s}),this}}},{name:t=>`replace${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=fe(this,e,n,t,r,i);if(!Yt(s))throw new ae(`Graph.${e}: provided attributes are not a plain object.`);return o.attributes=s,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}},{name:t=>`merge${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=fe(this,e,n,t,r,i);if(!Yt(s))throw new ae(`Graph.${e}: provided attributes are not a plain object.`);return Qt(o.attributes,s),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:s}),this}}},{name:t=>`update${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=fe(this,e,n,t,r,i);if("function"!=typeof s)throw new ae(`Graph.${e}: provided updater is not a function.`);return o.attributes=s(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}}];const ge=[{name:t=>`get${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ce(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ce(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Zt(this,o,s,n),!i)throw new ue(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new ce(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ue(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return i.attributes[r]}}},{name:t=>`get${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t){let r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ce(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new ce(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const i=""+t,o=""+arguments[1];if(r=Zt(this,i,o,n),!r)throw new ue(`Graph.${e}: could not find an edge for the given path ("${i}" - "${o}").`)}else{if("mixed"!==n)throw new ce(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,r=this._edges.get(t),!r)throw new ue(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return r.attributes}}},{name:t=>`has${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ce(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ce(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Zt(this,o,s,n),!i)throw new ue(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new ce(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ue(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return i.attributes.hasOwnProperty(r)}}},{name:t=>`set${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){let o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ce(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new ce(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+t,a=""+r;if(r=arguments[2],i=arguments[3],o=Zt(this,s,a,n),!o)throw new ue(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if("mixed"!==n)throw new ce(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,o=this._edges.get(t),!o)throw new ue(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return o.attributes[r]=i,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}},{name:t=>`update${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){let o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ce(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new ce(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+t,a=""+r;if(r=arguments[2],i=arguments[3],o=Zt(this,s,a,n),!o)throw new ue(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if("mixed"!==n)throw new ce(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,o=this._edges.get(t),!o)throw new ue(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if("function"!=typeof i)throw new ae(`Graph.${e}: updater should be a function.`);return o.attributes[r]=i(o.attributes[r]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}},{name:t=>`remove${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ce(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ce(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Zt(this,o,s,n),!i)throw new ue(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new ce(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ue(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return delete i.attributes[r],this.emit("edgeAttributesUpdated",{key:i.key,type:"remove",attributes:i.attributes,name:r}),this}}},{name:t=>`replace${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ce(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ce(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Zt(this,o,s,n),!i)throw new ue(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new ce(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ue(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if(!Yt(r))throw new ae(`Graph.${e}: provided attributes are not a plain object.`);return i.attributes=r,this.emit("edgeAttributesUpdated",{key:i.key,type:"replace",attributes:i.attributes}),this}}},{name:t=>`merge${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ce(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ce(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Zt(this,o,s,n),!i)throw new ue(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new ce(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ue(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if(!Yt(r))throw new ae(`Graph.${e}: provided attributes are not a plain object.`);return Qt(i.attributes,r),this.emit("edgeAttributesUpdated",{key:i.key,type:"merge",attributes:i.attributes,data:r}),this}}},{name:t=>`update${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ce(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ce(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Zt(this,o,s,n),!i)throw new ue(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new ce(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ue(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if("function"!=typeof r)throw new ae(`Graph.${e}: provided updater is not a function.`);return i.attributes=r(i.attributes),this.emit("edgeAttributesUpdated",{key:i.key,type:"update",attributes:i.attributes}),this}}}];const _e=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function ye(t,e,n,r){let i=!1;for(const o in e){if(o===r)continue;const s=e[o];if(i=n(s.key,s.attributes,s.source.key,s.target.key,s.source.attributes,s.target.attributes,s.undirected),t&&i)return s.key}}function ve(t,e,n,r){let i,o,s,a=!1;for(const u in e)if(u!==r){i=e[u];do{if(o=i.source,s=i.target,a=n(i.key,i.attributes,o.key,s.key,o.attributes,s.attributes,i.undirected),t&&a)return i.key;i=i.next}while(void 0!==i)}}function be(t,e){const n=Object.keys(t),r=n.length;let i,o=0;return{[Symbol.iterator](){return this},next(){do{if(i)i=i.next;else{if(o>=r)return{done:!0};const s=n[o++];if(s===e){i=void 0;continue}i=t[s]}}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function we(t,e,n,r){const i=e[n];if(!i)return;const o=i.source,s=i.target;return r(i.key,i.attributes,o.key,s.key,o.attributes,s.attributes,i.undirected)&&t?i.key:void 0}function xe(t,e,n,r){let i=e[n];if(!i)return;let o=!1;do{if(o=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),t&&o)return i.key;i=i.next}while(void 0!==i)}function Te(t,e){let n=t[e];if(void 0!==n.next)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};const t={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:t}}};let r=!1;return{[Symbol.iterator](){return this},next:()=>!0===r?{done:!0}:(r=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}})}}function ke(t,e,n,r){if(0===e.size)return;const i="mixed"!==n&&n!==e.type,o="undirected"===n;let s,a,u=!1;const c=e._edges.values();for(;s=c.next(),!0!==s.done;){if(a=s.value,i&&a.undirected!==o)continue;const{key:e,attributes:n,source:c,target:l}=a;if(u=r(e,n,c.key,l.key,c.attributes,l.attributes,a.undirected),t&&u)return e}}function Se(t,e,n,r,i,o){const s=e?ve:ye;let a;if("undirected"!==n){if("out"!==r&&(a=s(t,i.in,o),t&&a))return a;if("in"!==r&&(a=s(t,i.out,o,r?void 0:i.key),t&&a))return a}if("directed"!==n&&(a=s(t,i.undirected,o),t&&a))return a}function Ae(t,e,n,r,i,o,s){const a=n?xe:we;let u;if("undirected"!==e){if(void 0!==i.in&&"out"!==r&&(u=a(t,i.in,o,s),t&&u))return u;if(void 0!==i.out&&"in"!==r&&(r||i.key!==o)&&(u=a(t,i.out,o,s),t&&u))return u}if("directed"!==e&&void 0!==i.undirected&&(u=a(t,i.undirected,o,s),t&&u))return u}function Ee(t,e){const{name:n,type:r,direction:i}=e;t.prototype[n]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];if(!arguments.length)return function(t,e){if(0===t.size)return[];if("mixed"===e||e===t.type)return Array.from(t._edges.keys());const n="undirected"===e?t.undirectedSize:t.directedSize,r=new Array(n),i="undirected"===e,o=t._edges.values();let s,a,u=0;for(;s=o.next(),!0!==s.done;)a=s.value,a.undirected===i&&(r[u++]=a.key);return r}(this,r);if(1===arguments.length){t=""+t;const e=this._nodes.get(t);if(void 0===e)throw new ue(`Graph.${n}: could not find the "${t}" node in the graph.`);return function(t,e,n,r){const i=[];return Se(!1,t,e,n,r,function(t){i.push(t)}),i}(this.multi,"mixed"===r?this.type:r,i,e)}if(2===arguments.length){t=""+t,e=""+e;const o=this._nodes.get(t);if(!o)throw new ue(`Graph.${n}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ue(`Graph.${n}: could not find the "${e}" target node in the graph.`);return function(t,e,n,r,i){const o=[];return Ae(!1,t,e,n,r,i,function(t){o.push(t)}),o}(r,this.multi,i,o,e)}throw new ae(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Oe(t,e){const{name:n,type:r,direction:i}=e,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return oe();if(!arguments.length)return function(t,e){if(0===t.size)return oe();const n="mixed"!==e&&e!==t.type,r="undirected"===e,i=t._edges.values();return{[Symbol.iterator](){return this},next(){let t,e;for(;;){if(t=i.next(),t.done)return t;if(e=t.value,!n||e.undirected===r)break}return{value:{edge:e.key,attributes:e.attributes,source:e.source.key,target:e.target.key,sourceAttributes:e.source.attributes,targetAttributes:e.target.attributes,undirected:e.undirected},done:!1}}}}(this,r);if(1===arguments.length){t=""+t;const e=this._nodes.get(t);if(!e)throw new ue(`Graph.${o}: could not find the "${t}" node in the graph.`);return function(t,e,n){let r=oe();return"undirected"!==t&&("out"!==e&&void 0!==n.in&&(r=ie(r,be(n.in))),"in"!==e&&void 0!==n.out&&(r=ie(r,be(n.out,e?void 0:n.key)))),"directed"!==t&&void 0!==n.undirected&&(r=ie(r,be(n.undirected))),r}(r,i,e)}if(2===arguments.length){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ue(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ue(`Graph.${o}: could not find the "${e}" target node in the graph.`);return function(t,e,n,r){let i=oe();return"undirected"!==t&&(void 0!==n.in&&"out"!==e&&r in n.in&&(i=ie(i,Te(n.in,r))),void 0!==n.out&&"in"!==e&&r in n.out&&(e||n.key!==r)&&(i=ie(i,Te(n.out,r)))),"directed"!==t&&void 0!==n.undirected&&r in n.undirected&&(i=ie(i,Te(n.undirected,r))),i}(r,i,n,e)}throw new ae(`Graph.${o}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}const Ce=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function Me(){this.A=null,this.B=null}function Ne(t,e,n,r,i){for(const o in r){const s=r[o],a=s.source,u=s.target,c=a===n?u:a;if(e&&e.has(c.key))continue;const l=i(c.key,c.attributes);if(t&&l)return c.key}}function Ie(t,e,n,r,i){if("mixed"!==e){if("undirected"===e)return Ne(t,null,r,r.undirected,i);if("string"==typeof n)return Ne(t,null,r,r[n],i)}const o=new Me;let s;if("undirected"!==e){if("out"!==n){if(s=Ne(t,null,r,r.in,i),t&&s)return s;o.wrap(r.in)}if("in"!==n){if(s=Ne(t,o,r,r.out,i),t&&s)return s;o.wrap(r.out)}}if("directed"!==e&&(s=Ne(t,o,r,r.undirected,i),t&&s))return s}function je(t,e,n){const r=Object.keys(n),i=r.length;let o=0;return{[Symbol.iterator](){return this},next(){let s=null;do{if(o>=i)return t&&t.wrap(n),{done:!0};const a=n[r[o++]],u=a.source,c=a.target;s=u===e?c:u,t&&t.has(s.key)&&(s=null)}while(null===s);return{done:!1,value:{neighbor:s.key,attributes:s.attributes}}}}}function Re(t,e){const{name:n,type:r,direction:i}=e;t.prototype[n]=function(t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];t=""+t;const e=this._nodes.get(t);if(void 0===e)throw new ue(`Graph.${n}: could not find the "${t}" node in the graph.`);return function(t,e,n){if("mixed"!==t){if("undirected"===t)return Object.keys(n.undirected);if("string"==typeof e)return Object.keys(n[e])}const r=[];return Ie(!1,t,e,n,function(t){r.push(t)}),r}("mixed"===r?this.type:r,i,e)}}function Pe(t,e){const{name:n,type:r,direction:i}=e,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return oe();t=""+t;const e=this._nodes.get(t);if(void 0===e)throw new ue(`Graph.${o}: could not find the "${t}" node in the graph.`);return function(t,e,n){if("mixed"!==t){if("undirected"===t)return je(null,n,n.undirected);if("string"==typeof e)return je(null,n,n[e])}let r=oe();const i=new Me;return"undirected"!==t&&("out"!==e&&(r=ie(r,je(i,n,n.in))),"in"!==e&&(r=ie(r,je(i,n,n.out)))),"directed"!==t&&(r=ie(r,je(i,n,n.undirected))),r}("mixed"===r?this.type:r,i,e)}}function De(t,e,n,r,i){const o=r._nodes.values(),s=r.type;let a,u,c,l,h,d,p;for(;a=o.next(),!0!==a.done;){let r=!1;if(u=a.value,"undirected"!==s)for(c in l=u.out,l){h=l[c];do{if(d=h.target,r=!0,p=i(u.key,d.key,u.attributes,d.attributes,h.key,h.attributes,h.undirected),t&&p)return h;h=h.next}while(h)}if("directed"!==s)for(c in l=u.undirected,l)if(!(e&&u.key>c)){h=l[c];do{if(d=h.target,d.key!==c&&(d=h.source),r=!0,p=i(u.key,d.key,u.attributes,d.attributes,h.key,h.attributes,h.undirected),t&&p)return h;h=h.next}while(h)}if(n&&!r&&(p=i(u.key,null,u.attributes,null,null,null,null),t&&p))return null}}function Le(t){if(!Yt(t))throw new ae('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in t))throw new ae("Graph.import: serialized node is missing its key.");if("attributes"in t&&(!Yt(t.attributes)||null===t.attributes))throw new ae("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function Fe(t){if(!Yt(t))throw new ae('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in t))throw new ae("Graph.import: serialized edge is missing its source.");if(!("target"in t))throw new ae("Graph.import: serialized edge is missing its target.");if("attributes"in t&&(!Yt(t.attributes)||null===t.attributes))throw new ae("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in t&&"boolean"!=typeof t.undirected)throw new ae("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}Me.prototype.wrap=function(t){null===this.A?this.A=t:null===this.B&&(this.B=t)},Me.prototype.has=function(t){return null!==this.A&&t in this.A||null!==this.B&&t in this.B};const $e=function(){let t=255&Math.floor(256*Math.random());return()=>t++}(),Be=new Set(["directed","undirected","mixed"]),qe=new Set(["domain","_events","_eventsCount","_maxListeners"]),Ue={allowSelfLoops:!0,multi:!1,type:"mixed"};function Ve(t,e,n){const r=new t.NodeDataClass(e,n);return t._nodes.set(e,r),t.emit("nodeAdded",{key:e,attributes:n}),r}function Ge(t,e,n,r,i,o,s,a){if(!r&&"undirected"===t.type)throw new ce(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&"directed"===t.type)throw new ce(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(a&&!Yt(a))throw new ae(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`);if(o=""+o,s=""+s,a=a||{},!t.allowSelfLoops&&o===s)throw new ce(`Graph.${e}: source & target are the same ("${o}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const u=t._nodes.get(o),c=t._nodes.get(s);if(!u)throw new ue(`Graph.${e}: source node "${o}" not found.`);if(!c)throw new ue(`Graph.${e}: target node "${s}" not found.`);const l={key:null,undirected:r,source:o,target:s,attributes:a};if(n)i=t._edgeKeyGenerator();else if(i=""+i,t._edges.has(i))throw new ce(`Graph.${e}: the "${i}" edge already exists in the graph.`);if(!t.multi&&(r?void 0!==u.undirected[s]:void 0!==u.out[s]))throw new ce(`Graph.${e}: an edge linking "${o}" to "${s}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const h=new pe(r,i,u,c,a);t._edges.set(i,h);const d=o===s;return r?(u.undirectedDegree++,c.undirectedDegree++,d&&(u.undirectedLoops++,t._undirectedSelfLoopCount++)):(u.outDegree++,c.inDegree++,d&&(u.directedLoops++,t._directedSelfLoopCount++)),t.multi?h.attachMulti():h.attach(),r?t._undirectedSize++:t._directedSize++,l.key=i,t.emit("edgeAdded",l),i}function ze(t,e,n,r,i,o,s,a,u){if(!r&&"undirected"===t.type)throw new ce(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&"directed"===t.type)throw new ce(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(a)if(u){if("function"!=typeof a)throw new ae(`Graph.${e}: invalid updater function. Expecting a function but got "${a}"`)}else if(!Yt(a))throw new ae(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`);let c;if(o=""+o,s=""+s,u&&(c=a,a=void 0),!t.allowSelfLoops&&o===s)throw new ce(`Graph.${e}: source & target are the same ("${o}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let l,h,d=t._nodes.get(o),p=t._nodes.get(s);if(!n&&(l=t._edges.get(i),l)){if(!(l.source.key===o&&l.target.key===s||r&&l.source.key===s&&l.target.key===o))throw new ce(`Graph.${e}: inconsistency detected when attempting to merge the "${i}" edge with "${o}" source & "${s}" target vs. ("${l.source.key}", "${l.target.key}").`);h=l}if(h||t.multi||!d||(h=r?d.undirected[s]:d.out[s]),h){const e=[h.key,!1,!1,!1];if(u?!c:!a)return e;if(u){const e=h.attributes;h.attributes=c(e),t.emit("edgeAttributesUpdated",{type:"replace",key:h.key,attributes:h.attributes})}else Qt(h.attributes,a),t.emit("edgeAttributesUpdated",{type:"merge",key:h.key,attributes:h.attributes,data:a});return e}a=a||{},u&&c&&(a=c(a));const f={key:null,undirected:r,source:o,target:s,attributes:a};if(n)i=t._edgeKeyGenerator();else if(i=""+i,t._edges.has(i))throw new ce(`Graph.${e}: the "${i}" edge already exists in the graph.`);let m=!1,g=!1;d||(d=Ve(t,o,{}),m=!0,o===s&&(p=d,g=!0)),p||(p=Ve(t,s,{}),g=!0),l=new pe(r,i,d,p,a),t._edges.set(i,l);const _=o===s;return r?(d.undirectedDegree++,p.undirectedDegree++,_&&(d.undirectedLoops++,t._undirectedSelfLoopCount++)):(d.outDegree++,p.inDegree++,_&&(d.directedLoops++,t._directedSelfLoopCount++)),t.multi?l.attachMulti():l.attach(),r?t._undirectedSize++:t._directedSize++,f.key=i,t.emit("edgeAdded",f),[i,!0,m,g]}function We(t,e){t._edges.delete(e.key);const{source:n,target:r,attributes:i}=e,o=e.undirected,s=n===r;o?(n.undirectedDegree--,r.undirectedDegree--,s&&(n.undirectedLoops--,t._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,s&&(n.directedLoops--,t._directedSelfLoopCount--)),t.multi?e.detachMulti():e.detach(),o?t._undirectedSize--:t._directedSize--,t.emit("edgeDropped",{key:e.key,attributes:i,source:n.key,target:r.key,undirected:o})}class Je extends Kt.EventEmitter{constructor(t){if(super(),"boolean"!=typeof(t=Qt({},Ue,t)).multi)throw new ae(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${t.multi}".`);if(!Be.has(t.type))throw new ae(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${t.type}".`);if("boolean"!=typeof t.allowSelfLoops)throw new ae(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${t.allowSelfLoops}".`);ee(this,"NodeDataClass","mixed"===t.type?le:"directed"===t.type?he:de);const e="geid_"+$e()+"_";let n=0;ee(this,"_attributes",{}),ee(this,"_nodes",new Map),ee(this,"_edges",new Map),ee(this,"_directedSize",0),ee(this,"_undirectedSize",0),ee(this,"_directedSelfLoopCount",0),ee(this,"_undirectedSelfLoopCount",0),ee(this,"_edgeKeyGenerator",()=>{let t;do{t=e+n++}while(this._edges.has(t));return t}),ee(this,"_options",t),qe.forEach(t=>ee(this,t,this[t])),ne(this,"order",()=>this._nodes.size),ne(this,"size",()=>this._edges.size),ne(this,"directedSize",()=>this._directedSize),ne(this,"undirectedSize",()=>this._undirectedSize),ne(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),ne(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),ne(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),ne(this,"multi",this._options.multi),ne(this,"type",this._options.type),ne(this,"allowSelfLoops",this._options.allowSelfLoops),ne(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(t){return this._nodes.has(""+t)}hasDirectedEdge(t,e){if("undirected"===this.type)return!1;if(1===arguments.length){const e=""+t,n=this._edges.get(e);return!!n&&!n.undirected}if(2===arguments.length){t=""+t,e=""+e;const n=this._nodes.get(t);return!!n&&n.out.hasOwnProperty(e)}throw new ae(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(t,e){if("directed"===this.type)return!1;if(1===arguments.length){const e=""+t,n=this._edges.get(e);return!!n&&n.undirected}if(2===arguments.length){t=""+t,e=""+e;const n=this._nodes.get(t);return!!n&&n.undirected.hasOwnProperty(e)}throw new ae(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(t,e){if(1===arguments.length){const e=""+t;return this._edges.has(e)}if(2===arguments.length){t=""+t,e=""+e;const n=this._nodes.get(t);return!!n&&(void 0!==n.out&&n.out.hasOwnProperty(e)||void 0!==n.undirected&&n.undirected.hasOwnProperty(e))}throw new ae(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(t,e){if("undirected"===this.type)return;if(t=""+t,e=""+e,this.multi)throw new ce("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const n=this._nodes.get(t);if(!n)throw new ue(`Graph.directedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ue(`Graph.directedEdge: could not find the "${e}" target node in the graph.`);const r=n.out&&n.out[e]||void 0;return r?r.key:void 0}undirectedEdge(t,e){if("directed"===this.type)return;if(t=""+t,e=""+e,this.multi)throw new ce("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const n=this._nodes.get(t);if(!n)throw new ue(`Graph.undirectedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ue(`Graph.undirectedEdge: could not find the "${e}" target node in the graph.`);const r=n.undirected&&n.undirected[e]||void 0;return r?r.key:void 0}edge(t,e){if(this.multi)throw new ce("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ue(`Graph.edge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ue(`Graph.edge: could not find the "${e}" target node in the graph.`);const r=n.out&&n.out[e]||n.undirected&&n.undirected[e]||void 0;if(r)return r.key}areDirectedNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ue(`Graph.areDirectedNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&(e in n.in||e in n.out)}areOutNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ue(`Graph.areOutNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&e in n.out}areInNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ue(`Graph.areInNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&e in n.in}areUndirectedNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ue(`Graph.areUndirectedNeighbors: could not find the "${t}" node in the graph.`);return"directed"!==this.type&&e in n.undirected}areNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ue(`Graph.areNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&(e in n.in||e in n.out)||"directed"!==this.type&&e in n.undirected}areInboundNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ue(`Graph.areInboundNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&e in n.in||"directed"!==this.type&&e in n.undirected}areOutboundNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ue(`Graph.areOutboundNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&e in n.out||"directed"!==this.type&&e in n.undirected}inDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ue(`Graph.inDegree: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.inDegree}outDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ue(`Graph.outDegree: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.outDegree}directedDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ue(`Graph.directedDegree: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.inDegree+e.outDegree}undirectedDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ue(`Graph.undirectedDegree: could not find the "${t}" node in the graph.`);return"directed"===this.type?0:e.undirectedDegree}inboundDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ue(`Graph.inboundDegree: could not find the "${t}" node in the graph.`);let n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree),n}outboundDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ue(`Graph.outboundDegree: could not find the "${t}" node in the graph.`);let n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.outDegree),n}degree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ue(`Graph.degree: could not find the "${t}" node in the graph.`);let n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree),n}inDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ue(`Graph.inDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.inDegree-e.directedLoops}outDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ue(`Graph.outDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.outDegree-e.directedLoops}directedDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ue(`Graph.directedDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.inDegree+e.outDegree-2*e.directedLoops}undirectedDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ue(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return"directed"===this.type?0:e.undirectedDegree-2*e.undirectedLoops}inboundDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ue(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree,r+=e.directedLoops),n-r}outboundDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ue(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.outDegree,r+=e.directedLoops),n-r}degreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ue(`Graph.degreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree,r+=2*e.directedLoops),n-r}source(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ue(`Graph.source: could not find the "${t}" edge in the graph.`);return e.source.key}target(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ue(`Graph.target: could not find the "${t}" edge in the graph.`);return e.target.key}extremities(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ue(`Graph.extremities: could not find the "${t}" edge in the graph.`);return[e.source.key,e.target.key]}opposite(t,e){t=""+t,e=""+e;const n=this._edges.get(e);if(!n)throw new ue(`Graph.opposite: could not find the "${e}" edge in the graph.`);const r=n.source.key,i=n.target.key;if(t===r)return i;if(t===i)return r;throw new ue(`Graph.opposite: the "${t}" node is not attached to the "${e}" edge (${r}, ${i}).`)}hasExtremity(t,e){t=""+t,e=""+e;const n=this._edges.get(t);if(!n)throw new ue(`Graph.hasExtremity: could not find the "${t}" edge in the graph.`);return n.source.key===e||n.target.key===e}isUndirected(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ue(`Graph.isUndirected: could not find the "${t}" edge in the graph.`);return e.undirected}isDirected(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ue(`Graph.isDirected: could not find the "${t}" edge in the graph.`);return!e.undirected}isSelfLoop(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ue(`Graph.isSelfLoop: could not find the "${t}" edge in the graph.`);return e.source===e.target}addNode(t,e){const n=function(t,e,n){if(n&&!Yt(n))throw new ae(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(e=""+e,n=n||{},t._nodes.has(e))throw new ce(`Graph.addNode: the "${e}" node already exist in the graph.`);const r=new t.NodeDataClass(e,n);return t._nodes.set(e,r),t.emit("nodeAdded",{key:e,attributes:n}),r}(this,t,e);return n.key}mergeNode(t,e){if(e&&!Yt(e))throw new ae(`Graph.mergeNode: invalid attributes. Expecting an object but got "${e}"`);t=""+t,e=e||{};let n=this._nodes.get(t);return n?(e&&(Qt(n.attributes,e),this.emit("nodeAttributesUpdated",{type:"merge",key:t,attributes:n.attributes,data:e})),[t,!1]):(n=new this.NodeDataClass(t,e),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:e}),[t,!0])}updateNode(t,e){if(e&&"function"!=typeof e)throw new ae(`Graph.updateNode: invalid updater function. Expecting a function but got "${e}"`);t=""+t;let n=this._nodes.get(t);if(n){if(e){const r=n.attributes;n.attributes=e(r),this.emit("nodeAttributesUpdated",{type:"replace",key:t,attributes:n.attributes})}return[t,!1]}const r=e?e({}):{};return n=new this.NodeDataClass(t,r),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:r}),[t,!0]}dropNode(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ue(`Graph.dropNode: could not find the "${t}" node in the graph.`);let n;if("undirected"!==this.type){for(const t in e.out){n=e.out[t];do{We(this,n),n=n.next}while(n)}for(const t in e.in){n=e.in[t];do{We(this,n),n=n.next}while(n)}}if("directed"!==this.type)for(const t in e.undirected){n=e.undirected[t];do{We(this,n),n=n.next}while(n)}this._nodes.delete(t),this.emit("nodeDropped",{key:t,attributes:e.attributes})}dropEdge(t){let e;if(arguments.length>1){const t=""+arguments[0],n=""+arguments[1];if(e=Zt(this,t,n,this.type),!e)throw new ue(`Graph.dropEdge: could not find the "${t}" -> "${n}" edge in the graph.`)}else if(t=""+t,e=this._edges.get(t),!e)throw new ue(`Graph.dropEdge: could not find the "${t}" edge in the graph.`);return We(this,e),this}dropDirectedEdge(t,e){if(arguments.length<2)throw new ce("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new ce("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const n=Zt(this,t=""+t,e=""+e,"directed");if(!n)throw new ue(`Graph.dropDirectedEdge: could not find a "${t}" -> "${e}" edge in the graph.`);return We(this,n),this}dropUndirectedEdge(t,e){if(arguments.length<2)throw new ce("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new ce("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const n=Zt(this,t,e,"undirected");if(!n)throw new ue(`Graph.dropUndirectedEdge: could not find a "${t}" -> "${e}" edge in the graph.`);return We(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const t=this._nodes.values();let e;for(;e=t.next(),!0!==e.done;)e.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(t){return this._attributes[t]}getAttributes(){return this._attributes}hasAttribute(t){return this._attributes.hasOwnProperty(t)}setAttribute(t,e){return this._attributes[t]=e,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this}updateAttribute(t,e){if("function"!=typeof e)throw new ae("Graph.updateAttribute: updater should be a function.");const n=this._attributes[t];return this._attributes[t]=e(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this}removeAttribute(t){return delete this._attributes[t],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:t}),this}replaceAttributes(t){if(!Yt(t))throw new ae("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=t,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(t){if(!Yt(t))throw new ae("Graph.mergeAttributes: provided attributes are not a plain object.");return Qt(this._attributes,t),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:t}),this}updateAttributes(t){if("function"!=typeof t)throw new ae("Graph.updateAttributes: provided updater is not a function.");return this._attributes=t(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(t,e){if("function"!=typeof t)throw new ae("Graph.updateEachNodeAttributes: expecting an updater function.");if(e&&!re(e))throw new ae("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._nodes.values();let r,i;for(;r=n.next(),!0!==r.done;)i=r.value,i.attributes=t(i.key,i.attributes);this.emit("eachNodeAttributesUpdated",{hints:e||null})}updateEachEdgeAttributes(t,e){if("function"!=typeof t)throw new ae("Graph.updateEachEdgeAttributes: expecting an updater function.");if(e&&!re(e))throw new ae("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._edges.values();let r,i,o,s;for(;r=n.next(),!0!==r.done;)i=r.value,o=i.source,s=i.target,i.attributes=t(i.key,i.attributes,o.key,s.key,o.attributes,s.attributes,i.undirected);this.emit("eachEdgeAttributesUpdated",{hints:e||null})}forEachAdjacencyEntry(t){if("function"!=typeof t)throw new ae("Graph.forEachAdjacencyEntry: expecting a callback.");De(!1,!1,!1,this,t)}forEachAdjacencyEntryWithOrphans(t){if("function"!=typeof t)throw new ae("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");De(!1,!1,!0,this,t)}forEachAssymetricAdjacencyEntry(t){if("function"!=typeof t)throw new ae("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");De(!1,!0,!1,this,t)}forEachAssymetricAdjacencyEntryWithOrphans(t){if("function"!=typeof t)throw new ae("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");De(!1,!0,!0,this,t)}nodes(){return Array.from(this._nodes.keys())}forEachNode(t){if("function"!=typeof t)throw new ae("Graph.forEachNode: expecting a callback.");const e=this._nodes.values();let n,r;for(;n=e.next(),!0!==n.done;)r=n.value,t(r.key,r.attributes)}findNode(t){if("function"!=typeof t)throw new ae("Graph.findNode: expecting a callback.");const e=this._nodes.values();let n,r;for(;n=e.next(),!0!==n.done;)if(r=n.value,t(r.key,r.attributes))return r.key}mapNodes(t){if("function"!=typeof t)throw new ae("Graph.mapNode: expecting a callback.");const e=this._nodes.values();let n,r;const i=new Array(this.order);let o=0;for(;n=e.next(),!0!==n.done;)r=n.value,i[o++]=t(r.key,r.attributes);return i}someNode(t){if("function"!=typeof t)throw new ae("Graph.someNode: expecting a callback.");const e=this._nodes.values();let n,r;for(;n=e.next(),!0!==n.done;)if(r=n.value,t(r.key,r.attributes))return!0;return!1}everyNode(t){if("function"!=typeof t)throw new ae("Graph.everyNode: expecting a callback.");const e=this._nodes.values();let n,r;for(;n=e.next(),!0!==n.done;)if(r=n.value,!t(r.key,r.attributes))return!1;return!0}filterNodes(t){if("function"!=typeof t)throw new ae("Graph.filterNodes: expecting a callback.");const e=this._nodes.values();let n,r;const i=[];for(;n=e.next(),!0!==n.done;)r=n.value,t(r.key,r.attributes)&&i.push(r.key);return i}reduceNodes(t,e){if("function"!=typeof t)throw new ae("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new ae("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let n=e;const r=this._nodes.values();let i,o;for(;i=r.next(),!0!==i.done;)o=i.value,n=t(n,o.key,o.attributes);return n}nodeEntries(){const t=this._nodes.values();return{[Symbol.iterator](){return this},next(){const e=t.next();if(e.done)return e;const n=e.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){const t=new Array(this._nodes.size);let e=0;this._nodes.forEach((n,r)=>{t[e++]=function(t,e){const n={key:t};return te(e.attributes)||(n.attributes=Qt({},e.attributes)),n}(r,n)});const n=new Array(this._edges.size);return e=0,this._edges.forEach((t,r)=>{n[e++]=function(t,e,n){const r={key:e,source:n.source.key,target:n.target.key};return te(n.attributes)||(r.attributes=Qt({},n.attributes)),"mixed"===t&&n.undirected&&(r.undirected=!0),r}(this.type,r,t)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:t,edges:n}}import(t,e=!1){if(t instanceof Je)return t.forEachNode((t,n)=>{e?this.mergeNode(t,n):this.addNode(t,n)}),t.forEachEdge((t,n,r,i,o,s,a)=>{e?a?this.mergeUndirectedEdgeWithKey(t,r,i,n):this.mergeDirectedEdgeWithKey(t,r,i,n):a?this.addUndirectedEdgeWithKey(t,r,i,n):this.addDirectedEdgeWithKey(t,r,i,n)}),this;if(!Yt(t))throw new ae("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!Yt(t.attributes))throw new ae("Graph.import: invalid attributes. Expecting a plain object.");e?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}let n,r,i,o,s;if(t.nodes){if(i=t.nodes,!Array.isArray(i))throw new ae("Graph.import: invalid nodes. Expecting an array.");for(n=0,r=i.length;n<r;n++){o=i[n],Le(o);const{key:t,attributes:r}=o;e?this.mergeNode(t,r):this.addNode(t,r)}}if(t.edges){let o=!1;if("undirected"===this.type&&(o=!0),i=t.edges,!Array.isArray(i))throw new ae("Graph.import: invalid edges. Expecting an array.");for(n=0,r=i.length;n<r;n++){s=i[n],Fe(s);const{source:t,target:r,attributes:a,undirected:u=o}=s;let c;"key"in s?(c=e?u?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:u?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,c.call(this,s.key,t,r,a)):(c=e?u?this.mergeUndirectedEdge:this.mergeDirectedEdge:u?this.addUndirectedEdge:this.addDirectedEdge,c.call(this,t,r,a))}}return this}nullCopy(t){const e=new Je(Qt({},this._options,t));return e.replaceAttributes(Qt({},this.getAttributes())),e}emptyCopy(t){const e=this.nullCopy(t);return this._nodes.forEach((t,n)=>{const r=Qt({},t.attributes);t=new e.NodeDataClass(n,r),e._nodes.set(n,t)}),e}copy(t){if("string"==typeof(t=t||{}).type&&t.type!==this.type&&"mixed"!==t.type)throw new ce(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${t.type}" because this would mean losing information about the current graph.`);if("boolean"==typeof t.multi&&t.multi!==this.multi&&!0!==t.multi)throw new ce("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if("boolean"==typeof t.allowSelfLoops&&t.allowSelfLoops!==this.allowSelfLoops&&!0!==t.allowSelfLoops)throw new ce("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const e=this.emptyCopy(t),n=this._edges.values();let r,i;for(;r=n.next(),!0!==r.done;)i=r.value,Ge(e,"copy",!1,i.undirected,i.key,i.source.key,i.target.key,Qt({},i.attributes));return e}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const t={};this._nodes.forEach((e,n)=>{t[n]=e.attributes});const e={},n={};this._edges.forEach((t,r)=>{const i=t.undirected?"--":"->";let o,s="",a=t.source.key,u=t.target.key;t.undirected&&a>u&&(o=a,a=u,u=o);const c=`(${a})${i}(${u})`;r.startsWith("geid_")?this.multi&&(void 0===n[c]?n[c]=0:n[c]++,s+=`${n[c]}. `):s+=`[${r}]: `,s+=c,e[s]=t.attributes});const r={};for(const t in this)this.hasOwnProperty(t)&&!qe.has(t)&&"function"!=typeof this[t]&&"symbol"!=typeof t&&(r[t]=this[t]);return r.attributes=this._attributes,r.nodes=t,r.edges=e,ee(r,"constructor",this.constructor),r}}"undefined"!=typeof Symbol&&(Je.prototype[Symbol.for("nodejs.util.inspect.custom")]=Je.prototype.inspect),[{name:t=>`${t}Edge`,generateKey:!0},{name:t=>`${t}DirectedEdge`,generateKey:!0,type:"directed"},{name:t=>`${t}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:t=>`${t}EdgeWithKey`},{name:t=>`${t}DirectedEdgeWithKey`,type:"directed"},{name:t=>`${t}UndirectedEdgeWithKey`,type:"undirected"}].forEach(t=>{["add","merge","update"].forEach(e=>{const n=t.name(e),r="add"===e?Ge:ze;t.generateKey?Je.prototype[n]=function(i,o,s){return r(this,n,!0,"undirected"===(t.type||this.type),null,i,o,s,"update"===e)}:Je.prototype[n]=function(i,o,s,a){return r(this,n,!1,"undirected"===(t.type||this.type),i,o,s,a,"update"===e)}})}),function(t){me.forEach(function({name:e,attacher:n}){n(t,e("Node"),0),n(t,e("Source"),1),n(t,e("Target"),2),n(t,e("Opposite"),3)})}(Je),function(t){ge.forEach(function({name:e,attacher:n}){n(t,e("Edge"),"mixed"),n(t,e("DirectedEdge"),"directed"),n(t,e("UndirectedEdge"),"undirected")})}(Je),function(t){_e.forEach(e=>{Ee(t,e),function(t,e){const{name:n,type:r,direction:i}=e,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"===r||"mixed"===this.type||r===this.type){if(1===arguments.length)return ke(!1,this,r,n=t);if(2===arguments.length){t=""+t,n=e;const s=this._nodes.get(t);if(void 0===s)throw new ue(`Graph.${o}: could not find the "${t}" node in the graph.`);return Se(!1,this.multi,"mixed"===r?this.type:r,i,s,n)}if(3===arguments.length){t=""+t,e=""+e;const s=this._nodes.get(t);if(!s)throw new ue(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ue(`Graph.${o}: could not find the "${e}" target node in the graph.`);return Ae(!1,r,this.multi,i,s,e,n)}throw new ae(`Graph.${o}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const s="map"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(){const t=Array.prototype.slice.call(arguments),e=t.pop();let n;if(0===t.length){let i=0;"directed"!==r&&(i+=this.undirectedSize),"undirected"!==r&&(i+=this.directedSize),n=new Array(i);let o=0;t.push((t,r,i,s,a,u,c)=>{n[o++]=e(t,r,i,s,a,u,c)})}else n=[],t.push((t,r,i,o,s,a,u)=>{n.push(e(t,r,i,o,s,a,u))});return this[o].apply(this,t),n};const a="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(){const t=Array.prototype.slice.call(arguments),e=t.pop(),n=[];return t.push((t,r,i,o,s,a,u)=>{e(t,r,i,o,s,a,u)&&n.push(t)}),this[o].apply(this,t),n};const u="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[u]=function(){let t,e,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new ae(`Graph.${u}: invalid number of arguments (expecting 2, 3 or 4 and got ${n.length}).`);if("function"==typeof n[n.length-1]&&"function"!=typeof n[n.length-2])throw new ae(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);2===n.length?(t=n[0],e=n[1],n=[]):3===n.length?(t=n[1],e=n[2],n=[n[0]]):4===n.length&&(t=n[2],e=n[3],n=[n[0],n[1]]);let r=e;return n.push((e,n,i,o,s,a,u)=>{r=t(r,e,n,i,o,s,a,u)}),this[o].apply(this,n),r}}(t,e),function(t,e){const{name:n,type:r,direction:i}=e,o="find"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return!1;if(1===arguments.length)return ke(!0,this,r,n=t);if(2===arguments.length){t=""+t,n=e;const s=this._nodes.get(t);if(void 0===s)throw new ue(`Graph.${o}: could not find the "${t}" node in the graph.`);return Se(!0,this.multi,"mixed"===r?this.type:r,i,s,n)}if(3===arguments.length){t=""+t,e=""+e;const s=this._nodes.get(t);if(!s)throw new ue(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ue(`Graph.${o}: could not find the "${e}" target node in the graph.`);return Ae(!0,r,this.multi,i,s,e,n)}throw new ae(`Graph.${o}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const s="some"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[s]=function(){const t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((t,n,r,i,o,s,a)=>e(t,n,r,i,o,s,a)),!!this[o].apply(this,t)};const a="every"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[a]=function(){const t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((t,n,r,i,o,s,a)=>!e(t,n,r,i,o,s,a)),!this[o].apply(this,t)}}(t,e),Oe(t,e)})}(Je),function(t){Ce.forEach(e=>{Re(t,e),function(t,e){const{name:n,type:r,direction:i}=e,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return;t=""+t;const n=this._nodes.get(t);if(void 0===n)throw new ue(`Graph.${o}: could not find the "${t}" node in the graph.`);Ie(!1,"mixed"===r?this.type:r,i,n,e)};const s="map"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(t,e){const n=[];return this[o](t,(t,r)=>{n.push(e(t,r))}),n};const a="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(t,e){const n=[];return this[o](t,(t,r)=>{e(t,r)&&n.push(t)}),n};const u="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[u]=function(t,e,n){if(arguments.length<3)throw new ae(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let r=n;return this[o](t,(t,n)=>{r=e(r,t,n)}),r}}(t,e),function(t,e){const{name:n,type:r,direction:i}=e,o=n[0].toUpperCase()+n.slice(1,-1),s="find"+o;t.prototype[s]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return;t=""+t;const n=this._nodes.get(t);if(void 0===n)throw new ue(`Graph.${s}: could not find the "${t}" node in the graph.`);return Ie(!0,"mixed"===r?this.type:r,i,n,e)};const a="some"+o;t.prototype[a]=function(t,e){return!!this[s](t,e)};const u="every"+o;t.prototype[u]=function(t,e){return!this[s](t,(t,n)=>!e(t,n))}}(t,e),Pe(t,e)})}(Je);class He extends Je{constructor(t){const e=Qt({type:"directed"},t);if("multi"in e&&!1!==e.multi)throw new ae("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==e.type)throw new ae('DirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class Xe extends Je{constructor(t){const e=Qt({type:"undirected"},t);if("multi"in e&&!1!==e.multi)throw new ae("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==e.type)throw new ae('UndirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class Ke extends Je{constructor(t){const e=Qt({multi:!0},t);if("multi"in e&&!0!==e.multi)throw new ae("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(e)}}class Qe extends Je{constructor(t){const e=Qt({type:"directed",multi:!0},t);if("multi"in e&&!0!==e.multi)throw new ae("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==e.type)throw new ae('MultiDirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class Ze extends Je{constructor(t){const e=Qt({type:"undirected",multi:!0},t);if("multi"in e&&!0!==e.multi)throw new ae("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==e.type)throw new ae('MultiUndirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}function Ye(t){t.from=function(e,n){const r=Qt({},e.options,n),i=new t(r);return i.import(e),i}}Ye(Je),Ye(He),Ye(Xe),Ye(Ke),Ye(Qe),Ye(Ze),Je.Graph=Je,Je.DirectedGraph=He,Je.UndirectedGraph=Xe,Je.MultiGraph=Ke,Je.MultiDirectedGraph=Qe,Je.MultiUndirectedGraph=Ze,Je.InvalidArgumentsGraphError=ae,Je.NotFoundGraphError=ue,Je.UsageGraphError=ce;class tn{constructor(t){this.graph=t,this.stack=new Array(t.order),this.seen=new Set,this.size=0}hasAlreadySeenEverything(){return this.seen.size===this.graph.order}countUnseenNodes(){return this.graph.order-this.seen.size}forEachNodeYetUnseen(t){const e=this.seen,n=this.graph;n.someNode(function(r,i){if(e.size===n.order)return!0;if(e.has(r))return!1;return!!t(r,i)})}has(t){return this.seen.has(t)}push(t){const e=this.seen.size;return this.seen.add(t),e!==this.seen.size&&(this.stack[this.size++]=t,!0)}pop(){if(0!==this.size)return this.stack[--this.size]}}const en=t=>"object"==typeof t&&!Array.isArray(t)&&null!==t&&"_bname"in t,nn=t=>"object"==typeof t&&!Array.isArray(t)&&null!==t&&"_crate"in t,rn=t=>en(t)&&("empty_bottle"===t._bname&&"empty_data"===t._content||void 0===t._content),on=t=>/^\d+$/.test(t);var sn=n(8287),an=_(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function un(t,e){var n="object"==typeof e;return new Promise(function(r,i){var o=new D({next:function(t){r(t),o.unsubscribe()},error:i,complete:function(){n?r(e.defaultValue):i(new an)}});t.subscribe(o)})}function cn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return _t(t,ht(t))}function ln(t,e){return m(e)?st(t,e,1):st(t,1)}var hn=function(t){function e(e,n){return t.call(this)||this}return o(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(b),dn={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=dn.delegate;return(null==i?void 0:i.setInterval)?i.setInterval.apply(i,h([t,e],l(n))):setInterval.apply(void 0,h([t,e],l(n)))},clearInterval:function(t){var e=dn.delegate;return((null==e?void 0:e.clearInterval)||clearInterval)(t)},delegate:void 0},pn=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return o(e,t),e.prototype.schedule=function(t,e){var n;if(void 0===e&&(e=0),this.closed)return this;this.state=t;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,e)),this.pending=!0,this.delay=e,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),dn.setInterval(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return e;null!=e&&dn.clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n,r=!1;try{this.work(t)}catch(t){r=!0,n=t||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},e.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,v(r,this),null!=e&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(hn),fn={now:function(){return(fn.delegate||Date).now()},delegate:void 0},mn=function(){function t(e,n){void 0===n&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.schedulerActionCtor(this,t).schedule(n,e)},t.now=fn.now,t}(),gn=new(function(t){function e(e,n){void 0===n&&(n=mn.now);var r=t.call(this,e,n)||this;return r.actions=[],r._active=!1,r}return o(e,t),e.prototype.flush=function(t){var e=this.actions;if(this._active)e.push(t);else{var n;this._active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this._active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(mn))(pn),_n=gn;function yn(t){for(var e,n,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var o=null!==(e=ht(r))&&void 0!==e?e:gn,s=null!==(n=r[0])&&void 0!==n?n:null,a=r[1]||1/0;return g(function(e,n){var r=[],i=!1,u=function(t){var e=t.buffer;t.subs.unsubscribe(),v(r,t),n.next(e),i&&l()},l=function(){if(r){var e=new b;n.add(e);var i={buffer:[],subs:e};r.push(i),ot(e,o,function(){return u(i)},t)}};null!==s&&s>=0?ot(n,o,l,s,!0):i=!0,l();var h=B(n,function(t){var e,n,i=r.slice();try{for(var o=c(i),s=o.next();!s.done;s=o.next()){var l=s.value,h=l.buffer;h.push(t),a<=h.length&&u(l)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}},function(){for(;null==r?void 0:r.length;)n.next(r.shift().buffer);null==h||h.unsubscribe(),n.complete(),n.unsubscribe()},void 0,function(){return r=null});e.subscribe(h)})}var vn=n(2543);const bn=(t,e,n={})=>({_bname:t,_content:e,_label:n}),wn=(t,e,n={})=>en(e)&&(void 0===t||(t.includes(e._bname)||"*"===t))?e._content:void 0,xn=bn("empty_bottle","empty_data"),Tn={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={codebase:"leafinflowport.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>{bn("error",{type:"critical",message:"LEAF core error: race condition detected in leafinflowport.js",codebase:"/src/ghostos/api/parser/nodelogic/io/leafinflowport.js"},{});return p_(e,t,void 0,{...o,metastep:"leaf inflow"},{leaflogic:(t,e)=>{const n=new Rt,r=e._stream.pipe(Mt(...t.map(t=>t._stream)),U(t=>(n.next(t[1]),t[0])),Dt());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(e,n)=>({...Dg(t,e),_control:n})},kn={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={codebase:"leafoutflowport.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>{bn("error",{type:"critical",message:"LEAF core error: race condition detected in leafoutflowport.js",codebase:"/src/ghostos/api/parser/nodelogic/io/leafoutflowport.js"},{});return p_(e,t,void 0,{...o,metastep:"leaf outflow"},{leaflogic:(t,e)=>{const n=new Rt,r=e._stream.pipe(U(t=>t),Mt(...t.map(t=>t._stream)),U(t=>(n.next(t[1]),t[0])),Dt());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...Dg(t),_control:e})};const Sn={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=(t=>{if(!t)return"appview";const e=Object.keys(t).filter(t=>"osview"===t||"osview2"===t);return e.length>0?e[0]:"appview"})(await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree})),s={codebase:"leafscreenio.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(e,n)=>p_(n,e,void 0,{...s,metastep:"invoking screenio"},{leaflogic:(t,e)=>{const n=new Rt,r=e._stream.pipe(Mt(...t.map(t=>t._stream)),Nt(t=>{const e=t.slice(1).filter(t=>void 0!==t);return 1===e.length?n.next(e[0]):e.length>1&&n.next(e),cn(t[0])}),Dt());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{post:e=>{const n=(Array.isArray(e)?e:[e]).map(t=>wn("screenio",t)).filter(t=>t);void 0!==n&&t.gos.leafio.getMasterSubsDir()[o].main.doWrite({control:{},data:n});return bn("screenio","written")}}})},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...$g(t),_control:e})},An=(t,e)=>{if(t.length>0&&t[0]in e)return 1===t.length?e[t[0]]:An(t.slice(1),e[t[0]])},En=(t,e,n)=>{t.length>0&&t[0]in e&&(1===t.length?e[t[0]]=n:En(t.slice(1),e[t[0]],n))};var On=n(8463);function Cn(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:case 3:return e^n^r;case 2:return e&n^e&r^n&r}}function Mn(t,e){return t<<e|t>>>32-e}const Nn=function(t){const e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(t.length+1);r.set(t),r[t.length]=128;const i=(t=r).length/4+2,o=Math.ceil(i/16),s=new Array(o);for(let e=0;e<o;++e){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=t[64*e+4*r]<<24|t[64*e+4*r+1]<<16|t[64*e+4*r+2]<<8|t[64*e+4*r+3];s[e]=n}s[o-1][14]=8*(t.length-1)/Math.pow(2,32),s[o-1][14]=Math.floor(s[o-1][14]),s[o-1][15]=8*(t.length-1)&4294967295;for(let t=0;t<o;++t){const r=new Uint32Array(80);for(let e=0;e<16;++e)r[e]=s[t][e];for(let t=16;t<80;++t)r[t]=Mn(r[t-3]^r[t-8]^r[t-14]^r[t-16],1);let i=n[0],o=n[1],a=n[2],u=n[3],c=n[4];for(let t=0;t<80;++t){const n=Math.floor(t/20),s=Mn(i,5)+Cn(n,o,a,u)+c+e[n]+r[t]>>>0;c=u,u=a,a=Mn(o,30)>>>0,o=i,i=s}n[0]=n[0]+i>>>0,n[1]=n[1]+o>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+u>>>0,n[4]=n[4]+c>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])},In=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;const jn=function(t){return"string"==typeof t&&In.test(t)};const Rn=function(t){if(!jn(t))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(t.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,255&e,(e=parseInt(t.slice(9,13),16))>>>8,255&e,(e=parseInt(t.slice(14,18),16))>>>8,255&e,(e=parseInt(t.slice(19,23),16))>>>8,255&e,(e=parseInt(t.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,255&e)};const Pn=[];for(let t=0;t<256;++t)Pn.push((t+256).toString(16).slice(1));function Dn(t,e=0){return(Pn[t[e+0]]+Pn[t[e+1]]+Pn[t[e+2]]+Pn[t[e+3]]+"-"+Pn[t[e+4]]+Pn[t[e+5]]+"-"+Pn[t[e+6]]+Pn[t[e+7]]+"-"+Pn[t[e+8]]+Pn[t[e+9]]+"-"+Pn[t[e+10]]+Pn[t[e+11]]+Pn[t[e+12]]+Pn[t[e+13]]+Pn[t[e+14]]+Pn[t[e+15]]).toLowerCase()}function Ln(t,e,n,r,i,o){const s="string"==typeof n?function(t){t=unescape(encodeURIComponent(t));const e=new Uint8Array(t.length);for(let n=0;n<t.length;++n)e[n]=t.charCodeAt(n);return e}(n):n,a="string"==typeof r?Rn(r):r;if("string"==typeof r&&(r=Rn(r)),16!==r?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+s.length);if(u.set(a),u.set(s,a.length),u=e(u),u[6]=15&u[6]|t,u[8]=63&u[8]|128,i){o=o||0;for(let t=0;t<16;++t)i[o+t]=u[t];return i}return Dn(u)}function Fn(t,e,n,r){return Ln(80,Nn,t,e,n,r)}Fn.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Fn.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";const $n=Fn;function Bn(t){function e(t,e){return t<<e|t>>>32-e}function n(t){var e,n="";for(e=7;e>=0;e--)n+=(t>>>4*e&15).toString(16);return n}var r,i,o,s,a,u,c,l,h,d=new Array(80),p=1732584193,f=4023233417,m=2562383102,g=271733878,_=3285377520,y=(t=function(t){t=t.replace(/\r\n/g,"\n");for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?e+=String.fromCharCode(r):r>127&&r<2048?(e+=String.fromCharCode(r>>6|192),e+=String.fromCharCode(63&r|128)):(e+=String.fromCharCode(r>>12|224),e+=String.fromCharCode(r>>6&63|128),e+=String.fromCharCode(63&r|128))}return e}(t)).length,v=new Array;for(i=0;i<y-3;i+=4)o=t.charCodeAt(i)<<24|t.charCodeAt(i+1)<<16|t.charCodeAt(i+2)<<8|t.charCodeAt(i+3),v.push(o);switch(y%4){case 0:i=2147483648;break;case 1:i=t.charCodeAt(y-1)<<24|8388608;break;case 2:i=t.charCodeAt(y-2)<<24|t.charCodeAt(y-1)<<16|32768;break;case 3:i=t.charCodeAt(y-3)<<24|t.charCodeAt(y-2)<<16|t.charCodeAt(y-1)<<8|128}for(v.push(i);v.length%16!=14;)v.push(0);for(v.push(y>>>29),v.push(y<<3&4294967295),r=0;r<v.length;r+=16){for(i=0;i<16;i++)d[i]=v[r+i];for(i=16;i<=79;i++)d[i]=e(d[i-3]^d[i-8]^d[i-14]^d[i-16],1);for(s=p,a=f,u=m,c=g,l=_,i=0;i<=19;i++)h=e(s,5)+(a&u|~a&c)+l+d[i]+1518500249&4294967295,l=c,c=u,u=e(a,30),a=s,s=h;for(i=20;i<=39;i++)h=e(s,5)+(a^u^c)+l+d[i]+1859775393&4294967295,l=c,c=u,u=e(a,30),a=s,s=h;for(i=40;i<=59;i++)h=e(s,5)+(a&u|a&c|u&c)+l+d[i]+2400959708&4294967295,l=c,c=u,u=e(a,30),a=s,s=h;for(i=60;i<=79;i++)h=e(s,5)+(a^u^c)+l+d[i]+3395469782&4294967295,l=c,c=u,u=e(a,30),a=s,s=h;p=p+s&4294967295,f=f+a&4294967295,m=m+u&4294967295,g=g+c&4294967295,_=_+l&4294967295}return(h=n(p)+n(f)+n(m)+n(g)+n(_)).toLowerCase()}const qn="github",Un=async(t,e)=>{const n=(t=>{const[e,n]=t.split("?"),r=e.split("/");if(r[0]===qn&&r.shift(),r.length<3)return null;const i=r.shift(),o=r.shift();if(!i||!o)return null;const s=o.split("@"),a=s[0],u=s[1]||"main";let c=r.join("/");return a&&c?(c.endsWith(".json")||(c=`${c}.json`),{user:i,repo:a,ref:u,path:c,query:n}):null})(e);if(!n)throw new Error(`Invalid GitHub graph reference: ${e}`);if(!globalThis.fetch)throw new Error("GitHub graph fetch requires global fetch.");const{user:r,repo:i,ref:o,path:s,query:a}=n,u=`https://raw.githubusercontent.com/${r}/${i}/refs/heads/${o}/${s}${a?`?${a}`:""}`,c=await globalThis.fetch(u);if(!c.ok)throw new Error(`Failed to fetch GitHub graph ${t}/${e}: ${c.status}`);const l=(t=>t?t.graph?.nodes?t.graph.nodes:t.data?.graph?.nodes?t.data.graph.nodes:t.nodes?t.nodes:[]:[])(await c.json());return{graph:{nodes:l}}},Vn=t=>{const e=t=>t.hostEtaTree?(t.hostEtaTree,e(t.hostEtaTree)):t,n=e(t),{appmode:r,domain:i,appid:o}=n,s=$n(`https://www.leafgon.com/${i}/${o}/_etaTreeForest`,$n.URL),a=n.mnemosyne.current[s],u={initEtaTreeForest:()=>{s in n.mnemosyne.current||(n.mnemosyne.current[s]={})},getEtaTree:async(t,e)=>{const r=t+"/"+e;if(r in a)return n.mnemosyne.current[s][r].tree;return await u.parseGraphEtaTree(t,e)},setEtaTree:(t,e,r,i)=>{const o=t+"/"+e;n.mnemosyne.current[s][o]={tree:r,parent:i}},removeEtaBush:(t,e)=>{const r=t+"/"+e,i=Object.entries(a).filter(([t,e])=>t!==r&&e.parent!==r).reduce((t,e)=>(t[e[0]]=e[1],t),{});n.mnemosyne.current[s]=i},parseGraphEtaTree:async(t,e)=>{const s=i,a=o;if(globalThis?.DEBUG){const n=t+"/"+e;globalThis.trace[n]?globalThis.trace[n].push("parsing"):globalThis.trace[n]=["parsing"]}const c=((t,e)=>t===qn||"string"==typeof e&&e.startsWith(`${qn}/`)&&e.includes("/"))(t,e)?await Un(t,e):await n.leaflakeio.qm_methods.queryGraph({_appmode:r,_hostdomain:i,_hostappid:o,_domain:t,_appid:e}),{nodes:l}=c.graph?c.graph:{nodes:[]},h=r_(l),d=i_(h),p=n,f=jg(r,s,a,t,e,h,d,p.leafio,p.leaflakeio,p.mnemosyne,p),m=(d.components.nodegroups.runtime[0],d.components.nodegroups.lambda,p?s+"/"+a:void 0);if(u.setEtaTree(t,e,f,m),globalThis?.DEBUG){const n=t+"/"+e;globalThis.trace[n]?globalThis.trace[n].push("parsed"):globalThis.trace[n]=["parsed"]}return f}};return u},Gn=(bn("error",{type:"critical",message:"LEAF core error: race condition detected in leafmemoryio.js",codebase:"/src/ghostos/api/parser/nodelogic/io/leafmemoryio.js"},{}),zt("leafmemoryio")),zn={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{type:s,args:a}=n.leaf.logic,u=An(Gn.editorconfig.namedatakey,a),{domain:c,appid:l}=t.gos.etaTree,h=`www.leafgon.com/mnemosyne/${c}/${l}/${u}`,d=$n(h,$n.URL),p="global"in o,f="on-tap"in o,m="proxy"in o,g=t.gos.etaTree.leafgraph.thespade?.uuid,_=g&&p?await t.gos.etaTree.lookupRuntimeLambdaLUT("breezyforest","main",g,t.gos.etaTree.leafgraph.edges.lambda.sourcelut[g],[]):void 0;e.slice(0,4);!!p&&(y=u,v=_,Object.keys(v).includes(y));var y,v;const b={codebase:"leafmemoryio.js",refnode:e,leafnode:"jest"!==e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e)?.leafnode.data};return(n,r)=>{const i=(n,r=void 0)=>{const i=r||d;if(void 0===n||(t=>!!en(t)&&("empty_bottle"===t._bname||"nothing"===t._bname))(n)){if(i in t.gos.etaTree.mnemosyne.current){const n=t.gos.etaTree.mnemosyne.current[i];return f?n.raw:bn(u,n.raw,{_type:"memoryio",_command:"o",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}{const n=f?bn("nothing",null,{_type:"memoryio",_command:"forget",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}}):null;return f?n:bn(u,n,{_type:"memoryio",_command:"forget",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}}if("main"===u&&e.slice(0,4),en(o=n)&&void 0!==o._bname&&"memoryio"===o._label._type&&"forget"===o._label._command){const n=f?bn("nothing",null,{_type:"memoryio",_command:"io",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}}):null,r=On(n),o={signature:Bn(r),payload:r,raw:n};return t.gos.etaTree.mnemosyne.current={...t.gos.etaTree.mnemosyne.current,[i]:o},f?n:bn(u,n,{_type:"memoryio",_command:"io",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}{const r=n,o=On(r),s={signature:Bn(o),payload:o,raw:r};return t.gos.etaTree.mnemosyne.current={...t.gos.etaTree.mnemosyne.current,[i]:s},f?r:bn(u,r,{_type:"memoryio",_command:"io",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}var o};return p_(r,n,void 0,{...b,metastep:"memory io "+u},{leaflogic:(t,e)=>{const n=new Rt,r=e._stream.pipe(Mt(...t.map(t=>t._stream)),U(t=>{if(m){const e=t[0].sid.slice(-1).pop(),r=$n(`www.leafgon.com/mnemosyne/${c}/${l}/${u}/${e}`,$n.URL),o=i(t[1],r);n.next(o)}else{const e=i(t[1]);n.next(e)}return t[0]}),Dt());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={},s=t.gos.etaTree.leafgraph.thespade?.uuid;if(!!s&&t.gos.etaTree.leafgraph.edges.lambda.sourcelut[s].includes(e)){const{type:s,args:a}=n.leaf.logic,u=An(Gn.editorconfig.namedatakey,a);if(r.length>0){const n=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});o[u]={...n}}else o[u]={};return o}return o},methods:t=>({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=t=>t.hostEtaTree?(t.hostEtaTree,o(t.hostEtaTree)):t,s=o(t.gos.etaTree);return{etatreeforest:Vn(s),general:{setMasterMemory:(e,n)=>{const{domain:r,appid:i}=t.gos.etaTree,o=$n(`www.leafgon.com/mnemosyne/${r}/${i}/${e}`,$n.URL);return s.mnemosyne.current[o]=n,n},getMasterMemory:e=>{const{domain:n,appid:r}=t.gos.etaTree,i=$n(`www.leafgon.com/mnemosyne/${n}/${r}/${e}`,$n.URL);return s.mnemosyne.current[i]}}}}},Wn={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let Jn;const Hn=new Uint8Array(16);const Xn=function(t,e,n){if(Wn.randomUUID&&!e&&!t)return Wn.randomUUID();const r=(t=t||{}).random??t.rng?.()??function(){if(!Jn){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Jn=crypto.getRandomValues.bind(crypto)}return Jn(Hn)}();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){if((n=n||0)<0||n+16>e.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let t=0;t<16;++t)e[n+t]=r[t];return e}return Dn(r)};function Kn(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}u((r=r.apply(t,e||[])).next())})}const Qn=t=>void 0!==t&&t>="0"&&t<="9",Zn=t=>t>="a"&&t<="z"||t>="A"&&t<="Z"||"_"==t||"."==t||"-"==t,Yn=t=>t>="a"&&t<="z"||t>="A"&&t<="Z"||"_"==t||"."==t||"-"==t||":"==t,tr=t=>"=+-*/\\&%$_!<>?".includes(t);class er{constructor(t,e,n,r){this.source=t,this.startIndex=e,this.endIndex=n,this.line=r,this.offset=void 0}get start(){return this.startIndex-(this.line<=1?0:this.getLineOffset())}get end(){return this.endIndex-(this.line<=1?0:this.getLineOffset())}get length(){return this.endIndex-this.startIndex}getLineOffset(){var t;if(void 0===this.offset){const e=new RegExp("(\n)","mg");let n=null;for(let t=1;t<this.line;t++)n=e.exec(this.source);this.offset=null!==(t=null==n?void 0:n.index)&&void 0!==t?t:0}return this.offset}}var nr,rr;er.unknown=new er("",-1,-1,-1),function(t){t[t.Init=0]="Init",t[t.LeftParen=1]="LeftParen",t[t.RightParen=2]="RightParen",t[t.LeftBrace=3]="LeftBrace",t[t.RightBrace=4]="RightBrace",t[t.LeftSquare=5]="LeftSquare",t[t.RightSquare=6]="RightSquare",t[t.Dispatch=7]="Dispatch",t[t.True=8]="True",t[t.False=9]="False",t[t.Identifier=10]="Identifier",t[t.Keyword=11]="Keyword",t[t.String=12]="String",t[t.Integer=13]="Integer",t[t.Float=14]="Float",t[t.FractionNumber=15]="FractionNumber",t[t.Error=16]="Error",t[t.EOF=17]="EOF",t[t.Nothing=18]="Nothing"}(nr||(nr={}));class ir{constructor(t,e,n){this.type=t,this.value=e,this.position=n}}ir.INIT=new ir(nr.Init,"",new er("",0,0,0));class or{constructor(t){this.source=t,this.start=0,this.current=0,this.line=1}isEnd(){return this.source.length===this.current}advance(){return this.current+=1,this.source[this.current-1]}peek(){return this.source[this.current]}peekNext(){return this.source[this.current+1]}makeToken(t){const{start:e,line:n,current:r,source:i}=this,o=t===nr.Keyword,s=i.substring(o?e+1:e,r);return new ir(t,s,new er(i,e,r,n))}makeStringToken(){const{start:t,line:e,current:n,source:r}=this,i=r.substring(t+1,n-1).replace(/\\n/g,"\n").replace(/\\\\/g,"\\").replace(/\\"/g,'"');return new ir(nr.String,i,new er(r,t,n,e))}errorToken(t){const{start:e,line:n,current:r,source:i}=this;return new ir(nr.Error,t,new er(i,e,r,n))}identifier(){for(;;){const t=this.peek();if(!t||!(Zn(t)||Qn(t)||tr(t)))break;this.advance()}return this.makeIdentifierToken()}makeIdentifierToken(){const{start:t,current:e,source:n}=this;switch(n.substring(t,e)){case"true":return this.makeToken(nr.True);case"false":return this.makeToken(nr.False);case"null":return this.makeToken(nr.Nothing);default:return this.makeToken(nr.Identifier)}}keyword(){if(!Yn(this.peek())&&!Qn(this.peek()))return this.makeToken(nr.Identifier);for(;Yn(this.peek())||Qn(this.peek());)this.advance();return this.makeToken(nr.Keyword)}number(){for(;Qn(this.peek());)this.advance();if("."===this.peek()&&Qn(this.peekNext())){for(this.advance();Qn(this.peek());)this.advance();return this.makeToken(nr.Float)}if("/"===this.peek()){if(!Qn(this.peekNext()))return this.errorToken("Unterminated fraction number");for(this.advance();Qn(this.peek());)this.advance();return this.makeToken(nr.FractionNumber)}return this.makeToken(nr.Integer)}string(){for(;'"'!==this.peek()&&!this.isEnd();)"\n"===this.peek()&&(this.line+=1),"\\"===this.peek()&&this.advance(),this.advance();return this.isEnd()?this.errorToken("Unterminated string"):(this.advance(),this.makeStringToken())}skipWhitespace(){let t=0;for(;;){switch(this.peek()){case" ":case"\r":case"\t":case",":this.advance();break;case"\n":this.line+=1,this.advance();break;case";":if("#"===this.peekNext()){for(this.advance(),this.advance();"#"!==this.peek()&&";"!==this.peekNext()&&!this.isEnd();)"\n"===this.peek()&&(this.line+=1),this.advance();this.advance(),this.advance()}else for(;"\n"!==this.peek()&&!this.isEnd();)this.advance();break;default:return}t+=1}return t}scanToken(){this.skipWhitespace();if(this.start=this.current,this.isEnd())return this.makeToken(nr.EOF);const t=this.advance();if(Qn(t)||"-"===t&&Qn(this.peek()))return this.number();if((Zn(t)||tr(t))&&!Qn(t))return this.identifier();switch(t){case"(":return this.makeToken(nr.LeftParen);case")":return this.makeToken(nr.RightParen);case"{":return this.makeToken(nr.LeftBrace);case"}":return this.makeToken(nr.RightBrace);case"[":return this.makeToken(nr.LeftSquare);case"]":return this.makeToken(nr.RightSquare);case"#":return this.makeToken(nr.Dispatch);case":":return this.keyword();case'"':return this.string()}return this.errorToken(`Unexpected character '${t}'.`)}scanAllToken(){const t=[];for(;!this.isEnd();)t.push(this.scanToken());return t}}!function(t){t.Boolean="bool",t.Integer="int",t.Float="float",t.FractionNumber="fractionNumber",t.String="string",t.Keyword="keyword",t.Identifier="identifier",t.List="list",t.Nothing="null"}(rr||(rr={}));class sr{constructor(t,e,n){this.kind=t,this.value=e,this.position=n}}class ar extends Error{constructor(t,e){"string"==typeof t?super(t):(super(t.message),this.stack=t.stack),this._position=e}get position(){return this._position}}ar.kind="RuntimeError";const ur=t=>t,cr=(t,e)=>{if(t)throw new ar(e);return!0},lr=(t,e,n)=>cr(t.length!==e,n||`Expected ${e} argument${e>1?"s":""}, but got ${t.length}.`),hr=(t,...e)=>cr(void 0===e.find(e=>e===t.kind),`Invalid function parameter, actual: '${t.kind}', expected: '${e.join(" or ")}'.`);const dr=t=>()=>{throw new ar(`${t} is not implemented.`)},pr=t=>({parser:()=>{throw new ar(`${t} is not implemented.`)},factory:dr(t)}),fr={Bool:{parser:t=>"true"===t,factory:Boolean},Nothing:{parser:t=>"null"==t,factory:dr("NULL")},Int:{parser:t=>parseInt(t,10),factory:Number},Float:{parser:parseFloat,factory:Number},String:{parser:t=>t,factory:String},FractionNumber:{parser:t=>t,factory:dr("FractionNumber")},Vector:pr("Vector"),HashMap:pr("HashMap")},mr="Vector",gr="HashMap";class _r{constructor(t,e=fr){this.scanner=t,this.literals=e,this.hadError=!1,this.panicMode=!1,this.current=ir.INIT,this._program=[],this._errors=[],this.dispatchMode=!1,this.missingParser=t=>{this.errorAtCurrent(`Missing parser '${t}'.`)}}parse(){try{for(this.checkLiteralParsers(),this.advance();!this.isEnd();){const t=this.expression();t&&this._program.push(t)}this.consume(nr.EOF,"Expect end of program.")}finally{return{hasError:this.hadError,program:this.program,errors:this.errors}}}get program(){return this._program}get errors(){return this._errors}advance(){for(;this.current=this.scanner.scanToken(),this.current.type===nr.Error;)this.errorAtCurrent(this.current.value)}consume(t,e){this.current.type!=t?this.errorAtCurrent(e):this.advance()}errorAtCurrent(t){this.errorAt(this.current,t)}errorAt(t,e){if(!this.panicMode)throw this._errors.push({position:t.position,message:e}),this.hadError=!0,new Error(e)}isEnd(){return this.peek().type===nr.EOF}peek(){return this.current}expression(){const t=this.current,{Bool:e,FractionNumber:n,Int:r,Float:i,String:o,Nothing:s}=this.literals;switch(t.type){case nr.True:case nr.False:return this.makeLiteral(rr.Boolean,e.parser,t);case nr.Nothing:return this.makeLiteral(rr.Nothing,s.parser,t);case nr.Integer:return this.makeLiteral(rr.Integer,r.parser,t);case nr.Float:return this.makeLiteral(rr.Float,i.parser,t);case nr.FractionNumber:return this.makeLiteral(rr.FractionNumber,n.parser,t);case nr.String:return this.makeLiteral(rr.String,o.parser,t);case nr.Identifier:return this.makeLiteral(rr.Identifier,ur,t);case nr.Keyword:return this.makeLiteral(rr.Keyword,o.parser,t);case nr.LeftParen:return new sr(rr.List,this.advanceUntil(nr.RightParen),t.position);case nr.LeftSquare:return new sr(rr.List,[new sr(rr.Identifier,mr,t.position),...this.advanceUntil(nr.RightSquare)],t.position);case nr.LeftBrace:return new sr(rr.List,[new sr(rr.Identifier,gr,t.position),...this.advanceUntil(nr.RightBrace)],t.position);case nr.Dispatch:return this.formatDispatch();default:return void this.errorAtCurrent(`Unknown token: '${t.value}'.`)}}makeLiteral(t,e,n){const r=new sr(t,e(this.current.value),n.position);return this.advance(),r}advanceUntil(t){const e=[];for(this.advance();this.current.type!==t&&!this.isEnd();){const t=this.expression();e.push(t)}return this.consume(t,`Expected '${this.closeParentheses(t)}'.`),e}formatDispatch(){this.advance(),this.dispatchMode&&this.errorAtCurrent("Nested dispatch expression not allowed."),this.dispatchMode=!0;const t=this.expression();t&&t.kind===rr.List||this.errorAtCurrent(`List expression expected after dispatch, but get '${t&&t.kind}'.`);const e=t;let n=e;switch(e.value[0].value){case gr:this.errorAtCurrent("Invalid dispatch: #{...}.");break;case mr:this.errorAtCurrent("Invalid dispatch: #[...].");break;default:n=this.anonymousFunction(e)}return this.dispatchMode=!1,n}anonymousFunction(t){const e=function(t,e){let n=[];const r=t=>{switch(t.kind){case rr.Boolean:case rr.Nothing:case rr.Integer:case rr.Float:case rr.FractionNumber:case rr.String:case rr.Keyword:case rr.Identifier:return n=e(n,t);case rr.List:return t.value.map(r),n=e(n,t)}};return r(t),n}(t,(t,e)=>{if(e.kind===rr.Identifier){const n=e;/^%\d+$/.test(n.value)&&t.push(parseInt(n.value.substr(1)))}return t}).sort((t,e)=>t-e).reverse()[0],n=Array.from({length:e},(e,n)=>new sr(rr.Identifier,`%${n+1}`,t.position)),r=new sr(rr.List,[new sr(rr.Identifier,mr,t.position),...n],t.position);return new sr(rr.List,[new sr(rr.Identifier,"fn",t.position),r,t],t.position)}closeParentheses(t){switch(t){case nr.RightParen:return")";case nr.RightBrace:return"}";case nr.RightSquare:return"]"}}checkLiteralParsers(){const{Bool:t,FractionNumber:e,Int:n,Float:r,String:i,Nothing:o}=this.literals;t.parser||this.missingParser("Bool"),n.parser||this.missingParser("Int"),r.parser||this.missingParser("Float"),e.parser||this.missingParser("FractionNumber"),i.parser||this.missingParser("String"),o.parser||this.missingParser("Nothing")}}const yr="<native function>";class vr{constructor(t,e,n=!0,r=yr){this._fn=t,this._arity=e,this._resolveIds=n,this._toString=r}call(t,e,n){const r=this.arity-n.length,i=this._resolveIds?n.map(n=>n.kind===rr.Identifier?t.execLiteral(n,e):n):n;if(-1===this.arity||0===r)return this._fn(t,e,i);if(r>0){const t=(t,e,n)=>this._fn(t,e,[...i,...n]);return new vr(t,r,this._resolveIds,this.toString())}{const r=this._fn(t,e,i.slice(0,this.arity));return r instanceof vr?r.call(t,e,i.slice(this.arity)):cr(!0,`Expected ${this.arity} argument${this.arity>1?"s":""}, but got ${n.length}.`)}}get arity(){return this._arity}toString(){return this._toString===yr?yr:`<${this._toString} function>`}toJS(){return this.toString()}debugTypeOf(){return vr.kind}}vr.kind="Function";const br=t=>{var e;return new vr(t.fn,t.arity,null===(e=t.resolveArgsIdentifiers)||void 0===e||e,t.name||t.fn.name)},wr=(t,e)=>br({name:t.name,arity:null!=e?e:t.length,fn:(e,n,r)=>{const i=r.map(t=>e.execLiteral(t,n),e);return t.apply(e,i)},resolveArgsIdentifiers:!0}),xr=br({name:"const",arity:1,fn:(t,e,n)=>{cr(1!==n.length,`Const expected 1 argument, but got ${n.length}.`);const[r]=n;return br({name:"const",arity:-1,fn:(t,e)=>t.execLiteral(r,e)})}}),Tr=br({name:"def",arity:2,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{lr(n,2);const[r,i]=n;hr(r,rr.Identifier);const o=t.execLiteral(i,e);return e.define(r.value,o),o}}),kr=br({name:"defn",arity:-1,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{lr(n,3);const[r,i,o]=n;return e.get("def").call(t,e,[r,new sr(rr.List,[new sr(rr.Identifier,"fn",er.unknown),i,o],er.unknown)])}}),Sr=br({name:"if",arity:3,fn:(t,e,n)=>{lr(n,3);const[r,i,o]=n,s=t.execLiteral(r,e),a=t.options.utils.unboxing(s);if(!0===a)return t.execLiteral(i,e);if(!1===a)return t.execLiteral(o,e);throw new ar(`Expected boolean value in the if condition, but get '${a}'`)}}),Ar=br({arity:-1,name:"case",fn:(t,e,n)=>{cr(n.length<2,`Case expected at least 2 argument, but got ${n.length}.`);const[r,...i]=n,o=t.execLiteral(r,e);for(const n of i){hr(n,rr.List);const r=n.value;lr(r,2,`Case branch expected list with 2 items, but got ${r.length}`);const[i,s]=r,a=t.execLiteral(i,e),u=t.options.utils.unboxing(a);cr(!("else"===u||a instanceof vr),"Case branch must start with a function or :else.");let c=!1;if("else"===u)c=!0;else{const e=t.evalFn(a,[o]),n=t.options.utils.unboxing(e);cr(!("boolean"==typeof n),"Case branch function must return with Bool."),c=n}if(c)return t.execLiteral(s,e)}cr(!0,`At least one of the case branch must match with the condition: ${o}`)}});class Er{constructor(t=null){this.enclosing=t,this.values=Object.create(null),this.locked=Object.create(null)}define(t,e,n=!1){if(this.locked[t])throw new ar(`'${t}' is locked and it is not re-definable.`);this.values[t]=e,n&&(this.locked[t]=!0)}get(t){if(this.values[t])return this.values[t];if(null!==this.enclosing)return this.enclosing.get(t);throw new ar(`Undefined identifier: '${t}'.`)}assign(t,e){if(!this.values[t]){if(null!==this.enclosing)return this.enclosing.assign(t,e);throw new ar(`Undefined identifier: '${t}'.`)}this.values[t]=e}getNames(){return Object.keys(this.values)}get parent(){return this.enclosing}}const Or=br({name:"fn",arity:-1,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{lr(n,2);const[r,i]=n;hr(r,rr.List);const o=r.value.slice(1);return o.map(t=>hr(t,rr.Identifier)),br({name:"lambda",arity:o.length,fn:(t,n,r)=>{lr(r,o.length);const s=new Er(e);o.forEach((e,i)=>{const o=t.execLiteral(r[i],n);s.define(e.value,o)});const a=t.execLiteral(i,s);return t.clearEnv(),a}})}}),Cr=br({name:"do",arity:-1,fn:(t,e,n)=>(cr(n.length<1,`Expected at least 1 argument, but got ${n.length}.`),n.map(n=>t.execLiteral(n,e)).pop())}),Mr=br({name:"side-effect",arity:-1,fn:(t,e,n)=>{cr(n.length<1,`Eff expected at least 1 argument, but got ${n.length}.`);const[r,...i]=n,o=t.execLiteral(r,e);return cr(!(o instanceof vr),"Eff first parameter must be a function."),br({name:"side-effect",arity:-1,fn:t=>t.evalFn(o,i)})}}),Nr={stdout:void 0,lockedGlobals:!0,globals:{},utils:{unboxing:ur}},Ir=[mr,gr];class jr{constructor(t,e){this.globals=new Er,this.currentEnv=this.globals,this.lastLiteral=void 0,this.lastPrint=void 0,this.execLiteral=(t,e)=>{switch(this.currentEnv=e,this.lastLiteral=t,t.kind){case rr.Boolean:case rr.Integer:case rr.Float:case rr.FractionNumber:case rr.String:case rr.Keyword:case rr.Nothing:return t.value;case rr.Identifier:return e.get(t.value);case rr.List:return this.execList(t,e);default:return t}},this.options=Object.assign(Object.assign({},Nr),t);const{stdout:n,globals:r,lockedGlobals:i}=this.options,o=Object.assign(Object.assign({},fr),e);Object.keys(o).forEach(t=>{const e=o[t].factory,n=Ir.includes(t)?-1:e.length;this.globals.define(t,wr(e,n))}),this.globals.define("print",wr(t=>{var e;return(n||console.log)(t,null===(e=this.lastPrint)||void 0===e?void 0:e.position)},-1)),this.globals.define("const",xr),this.globals.define("def",Tr),this.globals.define("defn",kr),this.globals.define("if",Sr),this.globals.define("case",Ar),this.globals.define("fn",Or),this.globals.define("do",Cr),this.globals.define("side-effect",Mr),Object.keys(r).forEach(t=>{const e=r[t];let n=e;"function"==typeof e&&e.toString()!==yr&&(n=wr(e)),this.globals.define(t,n,i)})}interpret(t){let e;this.lastLiteral=t[0];try{for(const n of t)this.lastLiteral=n,e=this.execLiteral(n,this.globals)}catch(t){throw t.king===ar.kind?t:new ar(t,this.lastLiteral.position)}return e}evalFn(t,e){return t.call(this,this.currentEnv,e)}execList(t,e){const[n,...r]=t.value;"print"===n.value&&(this.lastPrint=n);const i=this.execLiteral(n,e);if("function"==typeof i.call)return i.call(this,e,r);throw new ar(`'${i}' is not a function`,t.position)}getGlobalNames(){return this.globals.getNames()}clearEnv(){null!==this.currentEnv.parent&&(this.currentEnv=this.currentEnv.parent)}}var Rr;!function(t){t.Parser="Parser",t.Runtime="Runtime"}(Rr||(Rr={}));class Pr{constructor(t,e){this.literals=e,this.interpreter=new jr(t,e)}insituexecute(t){const e=new or(t),n=new _r(e,this.literals).parse();if(n.hasError)throw{type:Rr.Parser,errors:n.errors};try{return this.interpreter.interpret(n.program)}catch(t){throw{type:Rr.Runtime,errors:[{message:t.message,position:t.position}]}}}execute(t){return Kn(this,void 0,void 0,function*(){const e=new or(t),n=new _r(e,this.literals).parse();if(n.hasError)throw{type:Rr.Parser,errors:n.errors};try{this.interpreter.interpret(n.program)}catch(t){throw{type:Rr.Runtime,errors:[{message:t.message,position:t.position}]}}})}evalFn(t,e){return this.interpreter.evalFn(t,e)}}var Dr,Lr={const:t=>()=>t};class Fr extends Error{constructor(t){"string"==typeof t?super(t):(super(t.message),this.stack=t.stack)}}!function(t){t[t.Less=0]="Less",t[t.Equal=1]="Equal",t[t.Greater=2]="Greater"}(Dr||(Dr={}));class $r{constructor(t){this._value=t}static fromJS(t){return new $r(t)}static fromStr(t){switch(t.value){case"true":return new $r(!0);case"false":return new $r(!1);default:throw new Fr(`Invalid boolean: "${t.value}".`)}}get value(){return this._value}not(){return new $r(!this._value)}and(t){return new $r(this._value&&t._value)}or(t){return new $r(this._value||t._value)}equals(t){return new $r(this._value===t._value)}partialCmp(t){return this.value===t.value?Dr.Equal:this.value?Dr.Greater:Dr.Less}copy(){return new $r(this._value)}toString(){return this._value?"true":"false"}toJS(){return this._value}toJSON(){return this.toJS()}debugTypeOf(){return Ur($r.kind)}}$r.kind="Bool";const Br=t=>new $r(t);class qr{constructor(t){this._value=t}static fromJS(t){return new qr(t)}static fromStr(t){return t.copy()}get value(){return this._value}add(t){return new qr(this._value+t.value)}index(t){var e;return Number.isInteger(t.value)?new qr(null!==(e=this._value.charAt(t.value))&&void 0!==e?e:""):new qr("")}slice(t,e){return new qr(this.value.slice(t.value,e.value))}equals(t){return Br(this._value===t.value)}partialCmp(t){const e=this._value.localeCompare(t.value);return e<0?Dr.Less:0===e?Dr.Equal:Dr.Greater}copy(){return new qr(this._value)}toJS(){return this._value}toJSON(){return this.toJS()}toString(){return`${this._value}`}debugTypeOf(){return new qr(qr.kind)}contains(t){return Br(this.value.indexOf(t.value)>-1)}count(){return ti(this.value.length)}}qr.kind="String";const Ur=(t="")=>new qr(t);class Vr{constructor(){this._value=null}static fromStr(t){switch(t.value){case"undefined":case"nil":case"null":return new Vr;default:throw new Fr(`Invalid Nothing literal: "${t.value}".`)}}get value(){return null}equals(t){return Br(this._value==t._value)}not(){return Br(!0)}toJS(){return null}toJSON(){return null}toString(){return"null"}debugTypeOf(){return Ur(Vr.kind)}}Vr.kind="null";const Gr=new Vr,zr=t=>~~t,Wr=t=>null==t||null==t||t==Gr,Jr=(t,e)=>{if(t)throw new Fr(e);return!0},Hr=(t,e)=>Jr(t.constructor!==e.constructor,`Type Error! Expected '${Yr(t)}', but got '${Yr(e)}'`),Xr=(t,e)=>{var n;return Jr(t!==e.constructor,`Expected '${null!==(n=t.kind)&&void 0!==n?n:t.name}', but got '${Yr(e)}'.`)},Kr=(t,e)=>Jr(!t[e],`"${e.toString()}" is not defined on ${t}`),Qr=t=>Jr(!Number.isInteger(t),`Expected integer number', but got '${t}'.`),Zr=(t,e)=>(Jr(Wr(t),e),t),Yr=t=>{var e,n,r,i;return null!==(i=null!==(n=null===(e=null==t?void 0:t.constructor)||void 0===e?void 0:e.kind)&&void 0!==n?n:null===(r=null==t?void 0:t.constructor)||void 0===r?void 0:r.name)&&void 0!==i?i:"unknown"};function ti(t,e=0){if("string"==typeof t){ei(t);const e=ni(t)?ri(t):ii(t);return ti(e.intValue,e.decimals)}return Number.isInteger(t)||0!==e?(Qr(t),Qr(e),new ci(t,e)):ti(t.toString())}function ei(t){return Jr(""===t||isNaN(Number(t)),`Invalid number: "${t}"`)}function ni(t){return t.startsWith("0")?/^0[eE]0$/.test(t):/^[-+]?[1-9](\.\d+)?[eE][-+]?\d+$/.test(t)}function ri(t){Jr(!ni(t),`Input is not in scientific form: "${t}"`);const e=t.split(/[eE]/),n=ii(e[0]),r=parseInt(e[1]);return n.decimals>r?n.decimals-=r:(n.intValue*=Math.pow(10,r-n.decimals),n.decimals=0),n}function ii(t){var e;ei(t);const[,n]=t.split("."),r=null!==(e=null==n?void 0:n.length)&&void 0!==e?e:0;return{intValue:parseInt(t.replace(".","")),decimals:r}}function oi(t,e){const n=Math.max(t.decimals,e.decimals);return{maxDecimal:n,intValue1:t.intValue*Math.pow(10,n-t.decimals),intValue2:e.intValue*Math.pow(10,n-e.decimals)}}var si={modulo:function(t,e){const n=t.value,r=e.value;return Qr(n),Qr(r),Jr(r<1,`Modulo (${r}) must be positive.`),Jr(n<0,`Number (${n}) cannot be negative.`),ti(n%r)}};const ai=(t,e)=>t!==e&&t?e?ai(e,t%e):t:e,ui=t=>Math.abs(t)<=Number.EPSILON;class ci{constructor(t,e=0){const n=function(t,e){if(0===t)return{intValue:0,decimals:0};for(;t>Number.MAX_SAFE_INTEGER||t%10==0&&e>0;){const n=t.toString();t=parseInt(n.substring(0,n.length-1)),e-=1}return{intValue:t,decimals:e}}(t,e);this._decimals=n.decimals,this._intValue=n.intValue}get intValue(){return this._intValue}get decimals(){return this._decimals}get value(){return this._intValue*Math.pow(10,-this._decimals)}equals(t){return Br((e=this.value,n=t.value,ui(e-n)));var e,n}negate(){return new ci(-this.intValue,this.decimals)}add(t){const e=oi(this,t),n=e.intValue1+e.intValue2;return new ci(n,e.maxDecimal)}subtract(t){const e=oi(this,t),n=e.intValue1-e.intValue2;return new ci(n,e.maxDecimal)}multiply(t){return new ci(this.intValue*t.intValue,this.decimals+t.decimals)}divide(t){if(0===t.intValue)throw new Fr("Cannot divide by zero!");const e=oi(this,t),n=Math.round(e.intValue1/e.intValue2*Math.pow(10,12));return new ci(n,12)}partialCmp(t){const e=oi(this,t);return e.intValue1<e.intValue2?Dr.Less:e.intValue1>e.intValue2?Dr.Greater:Dr.Equal}toJS(){return this.intValue/Math.pow(10,this.decimals)}toString(){return`${t=this.intValue,e=this.decimals,(t/Math.pow(10,e)).toFixed(e)}`;var t,e}copy(){return new ci(this.intValue,this.decimals)}debugTypeOf(){return Ur(ci.kind)}isInteger(){return Br(0===this.decimals)}toJSON(){return this.toString()}}ci.kind="Number";const li=t=>e=>{Xr(ci,e);try{return ti(t(e.value))}catch(n){throw new Fr(`Invalid argument for ${t.name}: ${e.value}`)}},hi=t=>(e,n)=>(Xr(ci,e),Xr(ci,n),ti(t(e.value,n.value))),di=ti(Math.E),pi=ti(Math.LN2),fi=ti(Math.LN10),mi=ti(Math.LOG2E),gi=ti(Math.LOG10E),_i=ti(Math.PI),yi=ti(Math.SQRT1_2),vi=ti(Math.SQRT2),bi=li(Math.abs),wi=li(Math.sign),xi=hi((t,e)=>Math.min(t,e)),Ti=hi((t,e)=>Math.max(t,e)),ki=li(Math.floor),Si=li(Math.round),Ai=li(Math.ceil),Ei=li(Math.trunc),Oi=li(Math.cbrt),Ci=li(Math.sqrt),Mi=li(Math.exp),Ni=hi(Math.pow),Ii=li(Math.log),ji=li(Math.log2),Ri=li(Math.log10),Pi=Math.PI/180,Di=li(t=>{const e=t%Math.PI;return ui(e)||ui(e-Math.PI)?0:Math.sin(t)}),Li=li(Math.asin),Fi=li(Math.asinh),$i=li(Math.cos),Bi=li(Math.acos),qi=li(Math.acosh),Ui=li(Math.tan),Vi=li(Math.atan),Gi=hi(Math.atan2),zi=li(Math.atanh);var Wi=Object.freeze({__proto__:null,E:di,LN2:pi,LN10:fi,LOG2E:mi,LOG10E:gi,PI:_i,SQRT1_2:yi,SQRT2:vi,abs:bi,sign:wi,min:xi,max:Ti,floor:ki,round:Si,ceil:Ai,trunc:Ei,cbrt:Oi,sqrt:Ci,exp:Mi,pow:Ni,log:Ii,log2:ji,log10:Ri,deg2rad:t=>t.multiply(ti(Pi)),rad2deg:t=>t.divide(ti(Pi)),sin:Di,asin:Li,asinh:Fi,cos:$i,acos:Bi,acosh:qi,tan:Ui,atan:Vi,atan2:Gi,atanh:zi});const Ji=t=>(Kr(t,"copy"),t.copy());var Hi={typeof:t=>{const e=t.debugTypeOf?t.debugTypeOf():Ur("<unknown>");return e instanceof String?Ur(e):e},copy:Ji,"deep-copy":t=>{var e;return Kr(t,"copy"),t.deepCopy?null===(e=t.deepCopy)||void 0===e?void 0:e.call(t):Ji(t)},str:t=>Ur(t.toString()),"to-json":t=>{let e=null;return"function"==typeof t.toJSON?e=t.toJSON():"function"==typeof t.toJS&&(e=t.toJS()),Ur(JSON.stringify(e))}};const Xi=(t,e)=>t.constructor!==e.constructor?Br(!1):t.equals(e),Ki=(t,e)=>{Hr(t,e);const n=t.lt;return"function"==typeof n?n(e):Br(t.partialCmp(e)===Dr.Less)},Qi=(t,e)=>{Hr(t,e);const n=t.gt;return"function"==typeof n?n(e):Br(t.partialCmp(e)===Dr.Greater)};var Zi={"==":Xi,"!=":(t,e)=>Xi(t,e).not(),"<":Ki,"<=":(t,e)=>Br(Xi(t,e).value||Ki(t,e).value),">":Qi,">=":(t,e)=>Br(Xi(t,e).value||Qi(t,e).value)};var Yi={count:t=>t.count(),contains:function(t,e){return e.contains(t)},map:function(t,e){return e.map(e=>this.evalFn(t,[e]))},filter:function(t,e){return e.filter(e=>this.evalFn(t,[e]))},reduce:function(t,e,n){return n.reduce(t,(t,n)=>this.evalFn(e,[t,n]))},slice:function(t,e,n){return n.slice(t,e)}};const to=(t,e)=>(Hr(t,e),t.add(e)),eo=(t,e)=>(Hr(t,e),t.multiply(e));var no={negate:t=>t.negate(),not:t=>t.not(),and:(t,e)=>t.and(e),or:(t,e)=>t.or(e),"+":to,"-":(t,e)=>(Hr(t,e),t.subtract(e)),"*":eo,"/":(t,e)=>(Hr(t,e),t.divide(e)),get:(t,e)=>t.index(e)};class ro{constructor(t){t.map(e=>Hr(t[0],e)),this._value=t}get value(){return this._value}contains(t){return Br(void 0!==this.value.find(e=>Xi(e,t).value))}add(t){return new ro(this._value.concat(t.value))}count(){var t;return new ci(null!==(t=this._value.length)&&void 0!==t?t:0)}map(t){return new ro(this.value.map(e=>t(e)))}filter(t){return new ro(this.value.filter(e=>t(e).toJS()))}reverse(){return new ro(this.value.reverse())}reduce(t,e){return this.value.reduce(e,t)}intersperse(t){const e=this.value.length-1;return new ro(this.value.reduce((n,r,i)=>(n.push(r),i<e&&n.push(t),n),[]))}toJS(){return this.value.map(t=>t.toJS())}toJSON(){return this.value.map(t=>t.toJSON())}toString(){return`[${this._value.map(t=>t.toString()).join(",")}]`}index(t){Xr(ci,t);return Zr(this.value[t.value],`Vector index ${t.toString()} is not defined`)}slice(t,e){return Xr(ci,t),Xr(ci,e),new ro(this.value.slice(t.value,e.value))}copy(){return new ro([...this._value])}deepCopy(){return new ro(this._value.map(t=>Ji(t)))}debugTypeOf(){return Ur(ro.kind)}}function io(...t){return new ro(t)}ro.kind="Vector";var oo={sum:t=>(Xr(ro,t),t.reduce(ti(0),to)),prod:t=>(Xr(ro,t),t.reduce(ti(1),eo)),intersperse:(t,e)=>(Xr(ro,e),e.intersperse(t)),join:t=>(Xr(ro,t),t.reduce(Ur(""),to)),"join-with":(t,e)=>(Xr(ro,e),e.intersperse(t).reduce(Ur(""),to)),"num-list":(t,e)=>(Xr(ro,e),e.map(t=>Ur(t.toString())).intersperse(t).reduce(Ur(""),to)),head:t=>{Xr(ro,t);return Zr(t.value[0],"Vector is empty")},reverse:t=>(Xr(ro,t),io(...t.value.reverse())),slice:(t,e,n)=>(Xr(ro,t),Xr(ci,n),Xr(ci,e),Zr(t.value.length,"Vector is not defined correctly"),io(...t.value.slice(e.value,n.value))),tail:t=>{Xr(ro,t),Zr(t.value.length,"Vector is not defined correctly");return io(...t.value.slice(1))}};const so=Math.random;var ao=Object.freeze({__proto__:null,random:()=>ti(so()),randomInt:(t,e)=>{const n=zr(t.value),r=zr(e.value);return ti(zr(n+so()*(r-n)))},shuffle:t=>{const e=[...t.value];let n,r,i;for(i=e.length-1;i>0;i--)n=Math.floor(Math.random()*(i+1)),r=e[i],e[i]=e[n],e[n]=r;return io(...e)},range:(t,e,n)=>{const r=t.value,i=n.value,o=zr(e.value);let s=r;const a=[];for(let t=0;t<o;t++)a.push(ti(s)),s+=i;return io(...a)},range0:t=>{const e=zr(t.value);return io(...Array.from({length:e},(t,e)=>ti(e)))}});class uo{constructor(t){this._value=t}get value(){return this._value}toJS(){var t,e;return null===(e=null===(t=this._value)||void 0===t?void 0:t.toJS)||void 0===e?void 0:e.call(t)}toJSON(){return this.toJS()}toString(){return`Just(${this._value.toString()})`}debugTypeOf(){return Ur(uo.kind)}}uo.kind="Just";class co{constructor(t=[]){if(t.length%2!=0)throw new Fr("Invalid hash map definition.\nDefinition must contains key value pairs");const e=((t,e=2)=>{const n=[],r=t.length;for(let i=0;i<r;i+=e)n.push(t.slice(i,i+e));return n})(t).map(([t,e])=>{if(qr!==t.constructor)throw new Fr("Invalid hash map definition.\n Keys are must be string or keyword");return[t.value,e]});this._value=new Map(e)}get value(){return this._value}toJS(){return new Map(Array.from(this._value.entries()).map(([t,e])=>[t,e instanceof ci?e.toString():e.toJS()]))}toJSON(){return Array.from(this._value.entries()).reduce((t,[e,n])=>(t[e]=n.toJSON(),t),{})}toString(){return`{${Array.from(this._value.entries()).map(([t,e])=>`${t.toString()} -> ${e.toString()}`).join(", ")}}`}debugTypeOf(){return Ur(co.kind)}index(t){Xr(qr,t);try{const e=this._value.get(t.value);return Wr(e)?new Vr:e}catch(t){return new Vr}}}co.kind="HashMap";const lo=(...t)=>new co(t);var ho={keys:t=>(Xr(co,t),io(...Array.from(t.value.keys()).map(t=>Ur(t)))),values:t=>(Xr(co,t),io(...Array.from(t.value.values()))),"hash-map":lo};class po{constructor(t){const e=t.value;e.map(t=>Hr(e[0],t)),this._value=e.reduce((t,e)=>(t.find(t=>Xi(t,e).value)||t.push(e),t),[])}get value(){return this._value}contains(t){return Br(void 0!==this.value.find(e=>Xi(e,t).value))}union(t){return new po(io(...this._value.concat(t.value)))}difference(t){return new po(io(...this.value.filter(e=>!t.contains(e).value)))}intersection(t){return new po(io(...this.value.concat(t.value).filter(e=>t.contains(e).value&&this.contains(e).value)))}symmetricDifference(t){return new po(io(...this.value.concat(t.value).filter(e=>!(t.contains(e).value&&this.contains(e).value))))}count(){var t;return new ci(null!==(t=this._value.length)&&void 0!==t?t:0)}map(t){return new po(io(...this.value.map(t)))}filter(t){return new po(io(...this.value.filter(e=>t(e).toJS())))}reduce(t,e){return this.value.reduce(e,t)}toJS(){return this.value.map(t=>t.toJS())}toJSON(){return this.value.map(t=>t.toJSON())}toString(){return`[${this.value.map(t=>t.toString()).join(",")}]`}copy(){return new po(io(...this.value))}deepCopy(){return new po(io(...this.value.map(t=>Ji(t))))}debugTypeOf(){return Ur(po.kind)}}po.kind="Set";var fo={Set:t=>new po(t),"set-2-list":function(t){return io(...t.value)},"set-union":function(t,e){return t.union(e)},"set-diff":function(t,e){return t.difference(e)},"set-intersection":function(t,e){return t.intersection(e)},"set-symmetric-difference":function(t,e){return t.symmetricDifference(e)}};const mo=(t,e)=>Number.isInteger(t)&&Number.isInteger(e)&&0!==e;class go{constructor(t,e){if(!mo(t,e))throw new Fr("Invalid fraction number parameters!");e<0&&(t*=-1,e*=-1);const n=ai(Math.abs(t),Math.abs(e));this._n=t/n,this._d=e/n}get numerator(){return this._n}get denominator(){return this._d}equals(t){return Br(this.numerator===t.numerator&&this.denominator===t.denominator)}negate(){return new go(-this._n,this._d)}add(t){const e=this.numerator*t.denominator+this.denominator*t.numerator,n=this.denominator*t.denominator;return new go(e,n)}subtract(t){const e=this.numerator*t.denominator-this.denominator*t.numerator,n=this.denominator*t.denominator;return new go(e,n)}multiply(t){const e=this.numerator*t.numerator,n=this.denominator*t.denominator;return new go(e,n)}divide(t){const e=this.numerator*t.denominator,n=this.denominator*t.numerator;return new go(e,n)}partialCmp(t){const e=this._d*t._d/ai(this._d,t._d),n=this._n*e/this._d,r=t._n*e/t._d;return n<r?Dr.Less:n>r?Dr.Greater:Dr.Equal}toJS(){return{numerator:this._n,denominator:this._d}}toJSON(){return this.toString()}toString(){return`${this._n}/${this._d}`}copy(){return new go(this._n,this._d)}debugTypeOf(){return Ur(go.kind)}}go.kind="Fraction";const _o=(t,e)=>new go(t,e);var yo={"number-2-fraction":(t,e)=>{const n=t.value;Jr(n<1||!Number.isInteger(n),`Accuracy must be a positive integer number instead of ${n}`);const r=e.value,i=Math.pow(10,n);return _o(Math.round(r*i),i)},"fraction-2-number":t=>ti(t.numerator).divide(ti(t.denominator)),reciprocal:t=>(Xr(go,t),_o(t.denominator,t.numerator))};const vo=t=>t,bo={Bool:{parser:t=>$r.fromStr(Ur(t)),factory:t=>(Xr($r,t),t)},Nothing:{parser:t=>Vr.fromStr(Ur(t)),factory:t=>(Xr(Vr,t),t)},Int:{parser:ti,factory:function(t){return Xr(ci,t),Jr(!t.isInteger().value,"Expected integer, but got float number."),t}},Float:{parser:ti,factory:function(t){return Xr(ci,t),t}},FractionNumber:{parser:t=>{const[e,n]=t.split("/").map(parseFloat);if(mo(e,n))return new go(e,n);throw new Fr(`Invalid fraction number: ${t}.`)},factory:(t,e)=>(Jr(!t.isInteger().value,"Numerator must be integer"),Jr(!e.isInteger().value,"Denominator must be integer"),new go(t.toJS(),e.toJS()))},String:{parser:Ur,factory:t=>(Xr(qr,t),t)},Vector:{parser:vo,factory:io},HashMap:{parser:vo,factory:lo}},wo=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Hi),Zi),Yi),no),Lr),Wi),si),yo),oo),ho),fo),ao),{maybe:t=>Wr(t)?Gr:new uo(t),Nothing:Gr}),xo={unboxing:t=>t.toJS()};function To(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(t,e){return String.fromCharCode("0x"+e)}))}function ko(t){return decodeURIComponent(atob(t).split("").map(function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)}).join(""))}bn("error",{type:"critical",message:"LEAF core error: race condition detected in leaflisp.js",codebase:"/src/ghostos/api/parser/nodelogic/wizardry/leaflisp.js"},{});const So=t=>t>0?" ".repeat(t):"",Ao={trace:[],probe:[]},Eo=(t,e=0,n=!1)=>{const r=typeof t,i=So(e),o=So(e+1);return"string"===r?(n?"":i)+`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"\n`:"object"===r?Array.isArray(t)?(n?"":i)+"[\n"+`${t.map(t=>Eo(t,e+1)).join("")}`+i+"]\n":[null,void 0].includes(t)?(n?"":i)+"null\n":(n?"":i)+"{\n"+`${Object.entries(t).map(([t,n])=>o+":"+t+" "+Eo(n,e+1,!0)).join("")}`+i+"}\n":"boolean"===r?(n?"":i)+(t?"true\n":"false\n"):"number"===r?(n?"":i)+String(t)+"\n":(n?"":i)+"null\n"};const Oo=(t,e=!0)=>{if(null==t)return wo.Nothing;const n=typeof t;return"string"===n?Ur(t):"object"===n?Array.isArray(t)?io(...t.filter(t=>t).map(t=>Oo(t,!1))):[null,void 0].includes(t)?wo.Nothing:lo(...Object.entries(t).map(([t,e])=>[Ur(t),Oo(e,!1)]).flat()):"boolean"===n?Br(t):"number"===n?ti(t.toString().includes("e")?function(t){let e="";"-"==(t+="").charAt(0)&&(t=t.substring(1),e="-");let n=t.split(/[e]/gi);if(n.length<2)return e+t;let r=.1.toLocaleString().substr(1,1),i=n[0],o=+n[1],s=(i=i.replace(/^0+/,"")).replace(r,""),a=i.split(r)[1]?i.indexOf(r)+o:s.length+o,u=a-s.length,c=""+BigInt(s);return s=o>=0?u>=0?c+"0".repeat(u):l():a<=0?"0"+r+"0".repeat(Math.abs(a))+c:l(),u=s.split(r),(0==u[0]&&0==u[1]||0==+s&&0==+c)&&(s=0),e+s;function l(){return s.replace(new RegExp(`^(.{${a}})(.)`),`$1${r}$2`)}}(t):t):wo.Nothing},Co=({_probefunc:t,_tracefunc:e}=args)=>({return:t=>t,outport:t=>t,undefined:wo.Nothing,nil:wo.Nothing,null:wo.Nothing,trace:t=>{const n=t.toJSON();try{e&&e(n)}catch(e){return t}return t},probe:e=>{const n=e.toJSON();try{t&&t(n)}catch(t){return e}return e},format:(t,e)=>{const n=e.toJSON(),r=t.toJS().replace(/\$\{([^{}]*)\}/gm,(t,e)=>`\${this.${e.replace(/\s*/g,"")}}`);return Ur(function(t,e){const n=new Proxy(e,{get:(t,e)=>{const n=t[e];return"object"==typeof n&&null!==n?JSON.stringify(n).replace(/"/g,'"'):n}});return new Function("return `"+t+"`;").call(n)}(r.replace(/"/g,'"'),n))},isnil:t=>Br("null"==t||t.constructor==wo.Nothing.constructor),isbottle:t=>{const e=t.toJSON();return Br(en(e))},islist:t=>{const e=t.toJSON();return Br(Array.isArray(e))},flatten:t=>{const e=t.toJSON();return Oo(e.flat().filter(t=>t),!1)},join:(t,e)=>{const n=t.toJSON();return Ur(n.join(e))},bottle:(t,e)=>{if(t.constructor!==qr)throw new Fr(`Expected '${qr.kind??qr.name}', but got '${getObjectName(t.value)}'.`);const n=t.toJSON(),r=e.toJSON(),i="object"==typeof r&&!Array.isArray(r)&&"_content"in r&&"_label"in r?{_bname:n,_content:r._content,_label:r._label}:{_bname:n,_content:r,_label:{}};return Oo(i)},getbottle:(t,e)=>{if(t.constructor!==ro)throw new Fr(`Expected '${ro.kind??ro.name}', but got '${getObjectName(t.value)}'.`);const n=t.value.filter(t=>t.value.get("_bname").value===e.value);return 1===n.length?n[0]:n.length>1?n:void 0},unbottle:t=>{if(t.constructor!==co)throw new Fr(`Expected '${co.kind??co.name}', but got '${getObjectName(t.value)}'.`);return t.value.get("_content")},regexp:(t,e)=>{const n=e.toJSON().match(/\/(.*)\/(.*)/),r=new RegExp(n[1],n[2]),i=t.toJSON(),o="string"===typeof i?i.match(r):[];return Oo(o||[])},min:t=>{if(t.constructor!==ro)throw new Fr(`Expected '${ro.kind??ro.name}', but got '${getObjectName(t.value)}'.`);const e=t.value.map(t=>t.value);return ti(Math.min(...e))},max:t=>{if(t.constructor!==ro)throw new Fr(`Expected '${ro.kind??ro.name}', but got '${getObjectName(t.value)}'.`);const e=t.value.map(t=>t.value);return ti(Math.max(...e))},parse:t=>{const e=t.toJSON();let n;return ei(e),n=ni(e)?ri(e):ii(e),0===n.decimals?ti(n.intValue):ti(n.intValue,n.decimals)},"merge-dict":(t,e)=>{if(t.constructor!==co)throw new Fr(`Expected '${co.kind??co.name}', but got '${getObjectName(t.value)}'.`);if(e.constructor!==co)throw new Fr(`Expected '${co.kind??co.name}', but got '${getObjectName(e.value)}'.`);const n={...t.toJSON(),...e.toJSON()};return Oo(n)},"make-dict":(t,e)=>{if(t.constructor!==ro)throw new Fr(`Expected '${ro.kind??ro.name}', but got '${getObjectName(t.value)}'.`);if(e.constructor!==ro)throw new Fr(`Expected '${ro.kind??ro.name}', but got '${getObjectName(e.value)}'.`);const n=t.toJSON(),r=e.toJSON(),i=[...Array(n.length).keys()].reduce((t,e)=>({...t,[n[e]]:r[e]}),{});return Oo(i)},concat:(t,e)=>{if(t.constructor!==ro)throw new Fr(`Expected '${ro.kind??ro.name}', but got '${getObjectName(t.value)}'.`);if(e.constructor!==ro)throw new Fr(`Expected '${ro.kind??ro.name}', but got '${getObjectName(e.value)}'.`);return io(...t.value.concat(e.value))},gload:t=>{jo(t.toJSON(),plisp_instance)},uuid4:()=>Ur(Xn()),uuid5:t=>{const e=$n(t.toString(),$n.URL);return Ur(e)},"*":(t,e)=>ti(t*e),"/":(t,e)=>ti(t/e),"+":(t,e)=>isNaN(t.value)||isNaN(e.value)?t.add(e):ti(t.value+e.value),"-":(t,e)=>ti(t-e),tofixed:(t,e)=>Ur(Number(t).toFixed(e))}),Mo=(t,e)=>{const n={};(async()=>{const n={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:t.leafio,etaTree:t},user:{spellbook:t.graphcomponents.spelldefs,lambdalut:t.leafgraph.edges.lambda.sourcelut}},r=e_.lambda(n)({refnode:"leaflisp_runtime",refnodedata:{leaf:{logic:{args:{graphuuid:"",domain:"breezyforest",appid:"leaflisp-help",graphaddrstr:"breezyforest/leaflisp-help"}}}},nodelambda:[],contextuallambda:[]}),i=await r;return i?.cheatsheet?await a_(i.cheatsheet._default,e.data,{}):[]})().then(t=>{n.cheatsheet=t});const r={cheat:()=>{const t={help:"-LEAFlisp help text----------------------------------------------\n--------------------------------------------------------------------------\n"};return Object.keys(n.cheatsheet).map(e=>{t[e]=e in n.cheatsheet?n.cheatsheet[e]:`LEAFlisp error: no help is available for an unknown command ${e}.`}),Oo(t)},help:t=>{const e={},r=t.toJSON();return r.length>0?(e.help="-LEAFlisp help text----------------------------------------------\n--------------------------------------------------------------------------\n",r.map(t=>{e[t]=t in n.cheatsheet?n.cheatsheet[t]:`LEAFlisp error: no help is available for an unknown command ${t}.`}),Oo(e)):(e.help="-LEAFlisp help text----------------------------------------------\n--------------------------------------------------------------------------\n",Object.keys(n.cheatsheet).map(t=>{e[t]=t in n.cheatsheet?n.cheatsheet[t]:`LEAFlisp error: no help is available for an unknown command ${t}.`}),Oo(e))}};return new Pr({globals:{...wo,...Co({}),...r},utils:xo},bo)},No=["linear-algebra"],Io={"linear-algebra":{lp:(t,e)=>lo(Ur("a"),t,Ur("b"),e)}},jo=(t,e)=>{No.includes(t)&&Object.entries(Io[t]).map(([t,n])=>{e.interpreter.globals.define(t,wr(n))})},Ro=(t,e,n,r,i=0)=>{try{e?.slice(0,4);const r=n.insituexecute(t);try{return[0,r.toJSON()]}catch(t){return[0,null]}}catch(t){let n=[];if("errors"in t)for(let o of t.errors){const s=`LEAFlisp error: {refnode: ${e}}: ${"Parser"===t.type?`line: ${o.line-i} - ${o.message}`:`line: ${o.position?.line-i} - ${o.message}`}`;n.push(bn("error",{address:r,refnode:e,message:s}))}else n.push(`LEAFlisp error: ${e}: unidentified execution failure. please check your leaflisp code for anomalies. exception: ${t.message}`);return[-1,n]}};let Po={};const Do={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{let o,s;const a=vn.memoize(async()=>await f_("breezyforest/probe",t.gos.etaTree,"leaflisp")),u=t.gos.etaTree.domain+"/"+t.gos.etaTree.appid,c=(t,n=e,r=0)=>{a().then(i=>{Object.entries(i).length>0&&(r>0&&Ao.trace.length===r&&Ao.trace.shift(),Ao.trace.push({timestamp:Date.now(),address:u,refnode:e,trace:t}),a_(i.probe._default,Ao.trace,{},n).then(t=>{}))})},l=(t,n=e,r=1)=>{a().then(i=>{Object.entries(i).length>0&&(r>0&&Ao.probe.length===r&&Ao.probe.shift(),Ao.probe.push({timestamp:Date.now(),address:u,refnode:e,trace:t}),a_(i.probe._default,Ao.probe,{},n).then(t=>{}))})},h=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});Po[e]="interactive"in h;const d=Po[e],p=n.leaf.logic.args.lispexpression;o="global"in h?t.gos.etaTree.gRuntimeLEAFlisp:new Pr({globals:{...wo,...Co({_probefunc:l,_tracefunc:c})},utils:xo},bo);const f="rewrite"in h,m="bottle"in h;e.slice(0,4);const g={codebase:"leaflisp.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data,leafaddress:t.gos.etaTree.domain+"/"+t.gos.etaTree.appid},_=new Rt;if(d){t.gos.etaTree.leafio.elementioLUT[e]=_;const n={graphuuid:"",domain:"breezyforest",appid:"leaflisp",graphaddrstr:"breezyforest/leaflisp"},r=e_.lambda(t)({refnode:"leaflisp_runtime_interactive",refnodedata:{leaf:{logic:{args:n}}},nodelambda:[],contextuallambda:[]}),i=await r;s=()=>{const n=bn("dataevent",{_refnode:e,_provenance:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid,refnodedata:g.leafnode,codebase:"leaflisp.js"}},{});a_(i.vim._default,n,{})}}return(r,i)=>{e.slice(0,4);const a=i?._config?.loopidx,u=i?._config?.clubrefnode,c=(t,n=p)=>{e.slice(0,4);let r=`(def inport ${Eo(null==t?[]:t)})`;a>=0&&(r+=`(def loopyindex ${a})`),u&&(r+=`(def clubref "${u}")`);const i=r.split(/\r\n|\r|\n/).length;r+=`${n}`;try{const[t,n]=Ro(r,e,o,g.leafaddress,i);return-1===t&&l(n,e),n}catch(t){throw new Fr(`LEAFlisp Error: ${t}`)}};return p_(i,r,void 0,{...g,metastep:"invoking leaflisp"},{leaflogic:d?(t,e)=>{const n=new Rt;let r=!1;const i=e._stream.pipe(U(t=>(s&&s(),t)),Mt(...t.map(t=>t._stream)),Nt(t=>At(new Bt(t[0]),_)),U(t=>{globalThis.DEBUG;const e=t[1];return r=!0,n.next(e),t[0]}),Dt());return{_stream:n.pipe(Ft(t=>r),U(t=>t),Dt()),_control:{...e,_stream:i}}}:(r,i)=>{const o=new Rt;let s=!1,a=p;const u=f?i._stream.pipe(U(t=>t),Mt(...r.map(t=>t._stream)),U(r=>{globalThis.DEBUG;let i=r[1];if(en(i)&&"rewrite"===i._bname){const r=wn("*",i),o={...n},s=Eo(null==r?[]:r);o.leaf.logic.args.lispexpression=s,n.leaf.logic.args.lispexpression=s,a=s,t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:To(JSON.stringify(o))}}),i=void 0}if(null!=i){s=!0;const t=c(i);return o.next(t),r[0]}}),Ft(t=>void 0!==t),Dt()):m?i._stream.pipe(U(t=>t),Mt(...r.map(t=>t._stream)),U(t=>{globalThis.DEBUG;const e=t[1];if(en(e)&&"codebottle"===e._bname){const n=wn("*",e);s=!0;const r=n.data,i=n.code,a=c(r,i);return o.next(a),t[0]}}),Ft(t=>void 0!==t),Dt()):i._stream.pipe(U(t=>t),Mt(...r.map(t=>t._stream)),U(t=>{globalThis.DEBUG;const e=t[1];s=!0;const n=c(e);return o.next(n),t[0]}),Dt());return{_stream:o.pipe(Ft(t=>s),U(t=>t),Dt()),_control:{...i,_stream:u}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>(n,r)=>({...Dg(e,n,!1,!1,!1,{provenance:"leaflisp.js lambda",refnode:e,etaTree:t.gos.etaTree}),_control:r}),methods:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={lispcode:""},s=(t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>(await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{version:"breezyforest",nodequery:t=>({_stream:t._stream.pipe(map(t=>(node_output=n,node_output))),_control:controlflow$obj}),nodemethod:t=>({})}))(t)({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}),a=Po[e];return{...s,isinteractive:a,texteditor:{setTextSource:r=>{o.lispcode=r;const i={...n};i.leaf.logic.args.lispexpression=r,a||t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:To(JSON.stringify(i))}})},getTextSource:()=>n.leaf.logic.args.lispexpression},general:{getNodeData:()=>n,executeLEAFlisp:t=>run(t)}}}},Lo=(bn("error",{type:"critical",message:"LEAF core error: race condition detected in leafchronosflow.js",codebase:"/src/ghostos/api/parser/nodelogic/dataflow/leafchronosflow.js"},{}),{dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s={codebase:"leafchronosflow.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data},a="_default"in o?(t,e)=>o._default(t,e):(t,e)=>{const n=new Rt,r=t[0]._stream,i=e._stream.pipe(U(t=>t),Mt(r),U(t=>(n.next(t[1]),t[0])),Dt());return{_stream:n.pipe(U(t=>t),Dt()),_control:{...e,_stream:i.pipe(U(t=>t),Dt())}}};return(t,n)=>{if(t.length>1){const r=$t(...t.map((t,e)=>t._stream.pipe(U(t=>t),Dt())));if("concat"in o){return{...Fg(t),_control:n}}if("merge"in o){return{...$g(t),_control:n}}if("combine"in o){return{...Dg(e,t),_control:n}}if("substitute"in o){const e=Object.keys(o.substitute);return{...Lg(t,e),_control:n}}{const t=t=>t,e=n._stream.pipe(U(t=>t));return p_({_stream:e},[{_stream:r}],void 0,{...s,metastep:"executing leafchronosflow "},{leaflogic:a,datalogic:{pre:t}})}}if(1===t.length)return{...t[0],_control:n}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t),_control:n})}),s}}),Fo=(bn("error",{type:"critical",message:"LEAF core error: race condition detected in leafmixflow.js",codebase:"/src/ghostos/api/parser/nodelogic/dataflow/leafmixflow.js"},{}),{dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s={codebase:"leafmixflow.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data},a="_default"in o?(t,e)=>o._default(t,e):(t,e)=>{const n=new Rt,r=e._stream.pipe(Mt(...t.map(t=>t._stream)),Nt(t=>{const e="bottle"in o,r="parfait"in o,i="crate"in o,s="dictionary"in o,a="raw"in o;let u;return"flatten"in o?(u=Array.isArray(t[1])?t[1].flat():t[1],n.next(e?bn("mix",u):u)):r&&!s?(u=[t[1]].flat().map(t=>en(t)?wn("*",t):void 0).filter(t=>t&&"empty_data"!==t),a||(u=[...new Set(u.flat())]),n.next(e?bn("mix",u):u)):i&&!s?(u=[t[1]].flat().map(t=>en(t)?t:void 0).filter(t=>void 0!==t&&!rn(t)),a||(u=[...new Set(u.flat())]),1===u.length?n.next(e?bn("mix",u[0]):u[0]):n.next(e?bn("mix",u):u)):(u={},[t[1]].flat().filter(t=>en(t)&&!rn(t)).map(t=>{if(en(t))return u=((e,n={})=>{const r=e._bname;return{...n,[r]:wn("*",t)}})(t,u),t}),n.next(e?bn("mix",u):u)),cn(t[0])}),Dt());return{_stream:n.pipe(U(t=>t),Dt()),_control:{...e,_stream:r}}};return(t,n)=>{if(t.length>1){if("concat"in o){return{...Fg(t),_control:n}}if("merge"in o){return{...$g(t),_control:n}}if("combine"in o){return{...Dg(e,t),_control:n}}if("substitute"in o){const e=Object.keys(o.substitute);return{...Lg(t,e),_control:n}}{const e=t=>t,r=n._stream;return p_({_stream:r},t,void 0,{...s,metastep:"executing leafmixflow "},{leaflogic:a,datalogic:{pre:e}})}}if(1===t.length){const e=t=>t,r=n._stream;return p_({_stream:r},t,void 0,{...s,metastep:"executing leafmixflow "},{leaflogic:a,datalogic:{pre:e}})}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t),_control:n})}),s}}),$o=(bn("error",{type:"critical",message:"LEAF core error: race condition detected in leafgateflow.js",codebase:"/src/ghostos/api/parser/nodelogic/dataflow/leafgateflow.js"},{}),zt("leafgateflow")),Bo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{type:s,args:a}=n.leaf.logic,u=An($o.editorconfig.namedatakey,a).toLowerCase(),c=An($o.editorconfig.toggledatakey,a),l=(()=>{const t=Object.keys(o).filter(t=>0===Object.keys(o[t]).length);return t.length>0?t.sort().join(";"):void 0})(),h={codebase:"leafgateflow.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>p_(e,t,void 0,{...h,metastep:"gateflow "+(c?"NOT gate, ":"normal gate, ")+u},{leaflogic:(t,e)=>{const n=new Rt,r=e._stream.pipe(Mt(...t.map(t=>t._stream)),U(t=>{const e=t[1],r=t=>en(t)?!c&&t._bname?.toLowerCase()===u||c&&t._bname?.toLowerCase()!==u?t:void 0:"{crate}"===u?!c&&t._cratelabel?"uncrate"===l?Object.keys(t).filter(t=>"_cratelabel"!==t).map(e=>t[e]).flat():t:c&&!t._cratelabel?t:void 0:((t,e)=>{const n=t?Object.entries(t).map(t=>t[0]+"="+("object"==typeof t[1]?JSON.stringify(t[1]):t[1])):[];if(e?!n.includes(u):n.includes(u))return t})(t,c),i=Array.isArray(e),o=i?e.map(t=>r(t)).filter(t=>void 0!==t):r(e);if(o?.length>0||!i&&void 0!==o)return n.next(o),t[0]}),Ft(t=>void 0!==t),Dt());return{_stream:n.pipe(U(t=>t),Dt()),_control:{...e,_stream:r.pipe(U(t=>t),Dt())}}},datalogic:{post:t=>t}})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t),_control:n})}),s}},qo=bn("error",{type:"critical",message:"LEAF core error: race condition detected in leaflabel.js",codebase:"/src/ghostos/api/parser/nodelogic/datautils/leaflabel.js"},{}),Uo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={codebase:"leaflabel.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(r,i)=>{const a=r=>{if(t.gos.etaTree.leafgraph.edges.data.targets.has(e))return n.leaf.logic.args.labelstr,r.map(t=>t._stream);if(n.leaf.logic.args.labelstr){const t=(async(t,n="")=>{let r=n.match(/^\\(.*)$/);if(r){const n=r[1];return n in t?await a_(t(n)._default,e):""}if(r=n.match(/^\?([A-Za-z0-9-]*)$/),r){const t=r[1],e=window.location.search,n=new Proxy(new URLSearchParams(e),{get:(t,e)=>t.get(e)}),i={};return n[t]&&(i[t]=n[t]),t in i?i:void 0}return n})(o,n.leaf.logic.args.labelstr);return[Promise.resolve(t)]}return r.map(t=>t._stream)};return p_(i,r,void 0,{...s,metastep:"leaflabel "+e},{leaflogic:(t,e)=>{const n=new Bt({...qo,_label:{...s}}),r=a(t),i=t.length>0?e._stream.pipe(Nt(t=>At([cn(t),...r])),U(t=>(2==t.length?n.next(t[1]):n.next(t.slice(1)),t[0])),Ft(t=>t),Dt()):e._stream;return{_stream:n,_control:{...e,_stream:i}}},datalogic:{}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={};if(r.length>0){const s=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});o[n.leaf.logic.args.labelstr]={...s}}else o[n.leaf.logic.args.labelstr]={};return o},methods:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{let o;if(r.length>0){o={...await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree})}}else o={};return o}},Vo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s=(t,e)=>(t in e._label&&(e._label[t]-=1),0===e._label[t]&&delete e._label[t],e);return(t,e)=>{if(n.leaf.logic.args.label||"label"in o){const r=o.label?o.label(t):{_stream:cn([n.leaf.logic.args.label])};return{_stream:$g(t)._stream.pipe(Mt(r._stream),U(t=>t),Ft(([t,e])=>t.every(t=>en(t)||nn(t)&&t._crate.every(en))),U(([t,e]=[])=>{const n=1===e.length?t.map(t=>[t,e[0]]):t.length===e.length?t.map((t,n)=>[t,e[n]]):[],r=t=>({...t,_label:{...t._label}}),i=n.reduce((t,[e,n]=[])=>(en(e)?t.push(s(n,r(e))):nn(e)&&t.push({...e,_crate:e._crate.map(t=>s(n,r(t)))}),t),[]);if(i.length>0)return i}),Ft(t=>t)),_control:e}}throw"LEAF Error: flow data cannot be labelled without a label, at _leafdataDelabel()"}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=n.leaf.logic.args.labelstr;return o&&s in o?{...o[s]}:{}}},Go={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(()=>{const t=Object.keys(o).filter(t=>0===Object.keys(o[t]).length);return t.length>0?t.sort().join(";"):void 0})(),a={codebase:"leafbottle.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>{let r,i;const u=o.name?o.name._default(t,e):{_stream:cn(n.leaf.logic.args.bottlekey),_control:e},c=e._stream.pipe(ln(t=>(r=t,u._stream)),U(t=>(i=t,r)));return p_({_stream:c},t,void 0,{...a,metastep:"executing bottle with key "+i},{datalogic:{pre:t=>void 0===s?bn(i,t):bn(i,t,{tag:s})}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,n])=>{s[t]=(t,r)=>{const i=Dg(e,t);return{...n([i],r),_control:r}}}),s}},zo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s={codebase:"leafunbottle.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>{if(n.leaf.logic.args.bottlekey||"bottlekey"in o){const r=o.label?o.label._default(t,e):{_stream:cn([n.leaf.logic.args.bottlekey]),_control:e};let i;const a=e._stream.pipe(Mt(r._stream),U(t=>{const e=t[1];return i=e,t[0]}),Dt()),u=(t,e)=>{const n=new Rt,r=e._stream.pipe(Mt(...t.map(t=>t._stream)),U(t=>{const e=t[1],r=t=>{const e=[t].flat().map(t=>en(t)&&i.includes(t._bname)?t._content:void 0).filter(t=>t);if(e.length>0)return 1===e.length?e[0]:e},o=Array.isArray(e),s=o?e.map(t=>r(t)).filter(t=>void 0!==t):r(e);if(s?.length>0||!o&&void 0!==s)return n.next(s),t[0]}),Ft(t=>void 0!==t),Dt());return{_stream:n.pipe(U(t=>t),Dt()),_control:{...e,_stream:r.pipe(U(t=>t),Dt())}}};return p_({_stream:a},t,void 0,{...s,metastep:"executing unbottle with key "+i},{leaflogic:u,datalogic:{post:t=>t}})}throw"LEAF Error: flow data cannot be unbottled without a bottlekey, at _leafdataUnbottle()"}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s}},Wo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data,(()=>{const t=Object.keys(o).filter(t=>0===Object.keys(o[t]).length);return t.length>0?t.sort().join(";"):void 0})());a="in the leafdataunbottle lambda";var a;return(t,e)=>{const n=new Rt,r=e._stream.pipe(Mt(...t.map(t=>t._stream)),U(t=>{const e={_cratelabel:s?{tag:s}:{}};if((Array.isArray(t[1])?t[1]:[t[1]]).flat().map(t=>en(t)&&t._label.tag&&"string"==typeof t._label.tag?t:void 0).filter(t=>void 0!==t).map(t=>{e[t._bname]=t._bname in e?[...e[t._bname],t]:[t]}),Object.keys(e).length>1)return n.next(e),t[0]}),Ft(t=>void 0!==t),Dt());return{_stream:n.pipe(U(t=>t),Dt()),_control:{...e,_stream:r}}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s}};function Jo(t,e,n){if(this.outer=n,this.dict=Object.create(null),this.get=function(t){return this.dict["$"+t]},this.set=function(t,e){this.dict["$"+t]=e},this.find=function(t){return"$"+t in this.dict?this:this.outer?this.outer.find(t):null},t&&e)for(let n=0;n<t.length;++n)this.set(t[n],e[n])}let Ho=new Jo;const Xo=(t,e=!0)=>"object"===typeof t?e?JSON.stringify(Object.entries(t).map(t=>[t[0],Xo(t[1],!1)]).sort()):Object.entries(t).map(t=>[t[0],Xo(t[1],!1)]).sort():JSON.stringify(t);let Ko={"+":function(){return[].reduce.call(arguments,function(t,e){return t+e})},"-":function(t,e){return t-e},"*":function(){return[].reduce.call(arguments,function(t,e){return t*e})},"/":function(t,e){return t/e},"%":function(t,e){return t%e},and:function(t,e){return t&&e},or:function(t,e){return t||e},not:function(t){return!t},">":function(t,e){return t>e},"<":function(t,e){return t<e},">=":function(t,e){return t>=e},"<=":function(t,e){return t<=e},"=":function(t,e){return t==e},":":function(t,e){return e[t]},"...":function(t,e){const n={...t};return Object.entries(e).forEach(([t,e])=>{n[t]=e}),n},"in?":function(t,e){const n=Array.isArray(t);return Object.entries(t).some(([t,r])=>{let i={};return i[t]=r,n?Xo(r)===Xo(e):Xo(i)===Xo(e)})},"equal?":function(t,e){return t===e},"eq?":function(t,e){return t===e},length:function(t){return t.length},cons:function(t,e){return[t].concat(e)},car:function(t){return t[0]},cdr:function(t){return t.slice(1)},append:function(t,e){return t.concat(e)},list:function(){return[].slice.call(arguments)},"list?":function(t){return Array.isArray(t)},"null?":function(t){return Array.isArray(t)&&!t.length},"symbol?":function(t){return"string"==typeof t},MathPI:Math.PI,MathE:Math.E,MathLN10:Math.LN10,MathLN2:Math.LN2,MathLOG10E:Math.LOG10E,MathLOG2E:Math.LOG2E,MathSQRT2:Math.SQRT2,False:!1,True:!0,Null:null};Object.keys(Ko).forEach(function(t){Ho.set(t,Ko[t])}),["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","log10","log2","max","min","pow","random","round","sin","sqrt","tan"].forEach(function(t){Ho.set(t,Math[t])});(t=>{function e(n,r){r=r||t;const i=typeof n;if("string"===i)return r.find(n).get(n);if(!Array.isArray(n)){if("object"===i){let t={};return Object.entries(n).map(([n,i])=>{t[n]=e(i,r)}),t}return n}if("quote"===n[0])return n.slice(1).join(" ");if("if"===n[0])return e((o=e(n[1],r),(Array.isArray(o)?o.length:o)?n[2]:n[3]),r);var o;if("set!"===n[0])return r.find(n[1]).set(n[1],e(n[1],r));if("define"===n[0])return r.set(n[1],e(n[2],r));if("lambda"===n[0])return function(){return e(n[2],new Jo(n[1],arguments,r))};if("begin"===n[0]){let t;for(let i=1;i<n.length;++i)t=e(n[i],r);return t}let s=n.map(function(t){return e(t,r)}),a=s.shift();return"function"==typeof a?a.apply(null,s):a}function n(t){return r(function(t){return t.replace(/\(/g," ( ").replace(/\)/g," ) ").replace(/\{/g," { ").replace(/\}/g," } ").replace(/^\s+|\s+$/g,"").split(/\s+/g)}(t))}function r(t){if(!t.length)throw new SyntaxError("unexpected EOF while reading");let e=t.shift();if("("===e){let e=[];for(;")"!==t[0];)e.push(r(t));return t.shift(),e}if("{"===e){let e={};for(;"}"!==t[0];){let n=t.shift(),i=":"===n[0]?n.slice(1):null;if(!i)throw new SyntaxError("unexpected key: "+n);e[i]=r(t)}return t.shift(),e}if("}"===e)throw new SyntaxError("unexpected )");if(")"===e)throw new SyntaxError("unexpected )");return function(t){let e=Number(t);return isNaN(e)&&"NaN"!==t?String(t):e}(e)}})(Ho);const Qo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});return(t,e)=>{const n=$g(t);if(n&&"_stream"in n){return{_stream:n._stream.pipe(U(t=>t)),_control:e}}return{_stream:cn([]),_control:e}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={};if(r.length>0){const s=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});o[n.leaf.logic.type]={...s}}else o[n.leaf.logic.type]={};return o},methods:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});return{config:{getConfigData:async()=>{const t="_default"in o?o._default:void 0;return t?await a_(t,[],{}):{}}}}}};var Zo=function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=fn);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,n),i}return o(e,t),e.prototype.next=function(e){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,s=n._timestampProvider,a=n._windowTime;r||(i.push(e),!o&&i.push(s.now()+a)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!t.closed;i+=n?1:2)t.next(r[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,n=t._timestampProvider,r=t._buffer,i=t._infiniteTimeWindow,o=(i?1:2)*e;if(e<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var s=n.now(),a=0,u=1;u<r.length&&r[u]<=s;u+=2)a=u;a&&r.splice(0,a+1)}},e}(Rt);const Yo=bn("error",{type:"critical",message:"LEAF core error: race condition detected in mediaplayer.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/mediaplayer.js"},{}),ts=t=>{const e=t[cg.LAMBDA_OBJ],n="uri"in e&&"_default"in e.uri?e.uri._default:void 0,r={codebase:"ghostos/api/parser/nodelogic/elements/library/mediaplayer.js",refnode:t[cg.REFNODE]};return{leaflogic:(e,i)=>{const o=p_(i,e,void 0,r,{leaflogic:n,datalogic:{post:e=>(t[cg.mediaplayer.URI]=e,e)}})._control,s=new Bt(Yo),a=o._stream.pipe(Mt(...e.map(t=>t._stream)),U(t=>{const e=t[1];return s.next(e),t[0]}));return{_stream:s,_control:{_stream:a}}},datalogic:{pre:t=>t,post:n=>{const r=Object.keys(e);["uri"].filter(t=>r.includes(t)),e.margin&&Object.keys(e.margin),e.fieldwidth&&Object.keys(e.fieldwidth);return lg({element:{nodeuuid:t[cg.REFNODE],type:"mediaplayer",componentdata:{uri:t[cg.mediaplayer.URI],...t[cg.RTCONTEXT]}}},"screenio")}}}},es=bn("error",{type:"critical",message:"LEAF core error: race condition detected in prompt.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/prompt.js"},{}),ns=t=>{const e=t[cg.LAMBDA_OBJ],n="uidefs"in e&&"_default"in e.uidefs?e.uidefs._default:void 0,r=("margin"in e&&"_default"in e.margin&&e.margin._default,"fieldwidth"in e&&"_default"in e.fieldwidth&&e.fieldwidth._default,new Rt),i={codebase:"ghostos/api/parser/nodelogic/elements/library/prompt.js",refnode:t[cg.REFNODE]};return{elementio$:r,leaflogic:(o,s)=>{const a=new Rt,u=n?p_(s,o,void 0,i,{leaflogic:n,datalogic:{post:e=>(t[cg.prompt.UIDEFS]=e,e)}}):{_stream:cn('[ ; an open square bracket [ denotes the beginning of a list, followed by a matching \n ; close square bracket ] appearing at the end of this page. you can bring your blinking cursor\n ; to one of the brackets and type Shift-5 (or %) to jump the cursor in between a pair of matching brackets. \n ; please give it a go, it is a fun way to read any text written in LEAFlisp. \n ; other helpful command keys to help you navigate LEAFlisp include h j k l with which the blinking cursor\n ; can be moved to the left, down, up and right respectively. Also useful are w b respectively used to command\n ; the cursor to move forward and backward by one word along the line. Shift-v can be used to select one line,\n ; v to select from where the cursor currently is and navigating away from the initial cursor point by using\n ; any mix of the navigation command keys, namely h j k l w and b would allow you to select any range of text of interest.\n ; at which point you could either copy, delete and/or paste the selected text by respectively pressing y, d and p\n ; pressing u would undo the changes you have made going back in time one change by one change as you repeat u in a series. \n ; Ctrl-r would redo what had been undone. \n ; using the command keys would require the editor to be in the "command" mode. pressing the escape key would put the editor \n ; in the "command" mode, while pressing i would put the editor in the "edit" mode in which none of the navigation keys\n ; would work as navigation commands but as entering respective alphabets instead. \n ; \n {\n :prompt "setting"\n :backgroundColor "primary.light" \n ; "primary.dark" | "secondary.light" "secondary.dark"\n :margin "1" \n ; please note that any positive number in between quotes is accepted here. \n ; the recommended value however would range from 0 to 20 in almost all general \n ; usage scenarios where 0 to 5 whould perhaps comprise about 90% of the cases. \n :fieldWidth "45ch" \n ; ch is a unit length represented in terms of the width of the letter 0 (zero).\n ; so "15ch" would result in the width as wide as 15 zeros for all the text inputs below. \n ; please refer to the following site for units in html/css lingo, if you have all the time in the world.\n ; https://www.w3schools.com/cssref/css_units.asp for units\n :buttonWidth "20ch"\n ; likewise, buttonWidth specifies the width of all the buttons declared below. \n }\n {\n :prompt "text"\n :key "maintext1" ; :key is a user-defined string value, that should be unique within the context of the UI definition.\n :label "LEAF newsletter mailing list" ; a user-defined string label to be displayed on the text input.\n :variant "outlined" ; a text :variant with a choice of "standard", "outlined", or "filled" as its style.\n :multiline true\n :rows "2"\n :InputProps {:readOnly true}\n :defaultValue "Please fill out the info and subscribe to the mailing list."\n }\n {\n :prompt "text"\n ;:key (get (get (get (get uinodes 1) :meta) :label) :id) ; :key is a user-defined string value, that should be unique within the context of the UI definition.\n :key "name" ; :key is a user-defined string value, that should be unique within the context of the UI definition.\n ;:id (get (get (get (get uinodes 1) :meta) :label) :id)\n :fieldWidth "25ch" \n :required true ;true\n :group 1\n :label "Your name" ;(get (get (get (get uinodes 1) :meta) :label) :text); a user-defined string label to be displayed on the text input.\n :variant "standard" ; a text :variant with a choice of "standard", "outlined", or "filled" as its style.\n }\n {\n :prompt "text"\n :key "email"\n :fieldWidth "25ch" \n :required true\n :label "Your email"\n :type "email"\n :variant "standard"\n }\n { \n :prompt "button"\n :color "secondary" \n ; the value can be of "primary", "secondary", "error", "warning", "info", "success"\n :variant "outlined"\n ; the value can be of "text", "contained", "outlined"\n :key "subscribebtn"\n ; :href "/editor/breezyforest/main"\n ; :href can support a relative path\n :label "Subscribe"\n }\n ]'),_control:{_stream:s._stream}};const c=u._control._stream.pipe(Mt(u._stream),Nt(n=>{const i=n[1];t[cg.CTRLIN]=n[0];const o=Object.keys(e),s=(["uidefs","margin","fieldwidth"].filter(t=>o.includes(t)),e.margin?Object.keys(e.margin):void 0),a=e.fieldwidth?Object.keys(e.fieldwidth):void 0,u=en(i)&&"error"===i._bname?void 0:Array.isArray(i)?lg({element:{nodeuuid:t[cg.REFNODE],type:"prompt",componentdata:{nodeuuid:t[cg.REFNODE],uidefs:i,margin:s?s[0]:1,fieldwidth:a?a[0]:"25ch",...t[cg.RTCONTEXT]}}},"screenio"):void 0;return u?$t(cn(u),r):r}),U(e=>(a.next(e),t[cg.CTRLIN])),Dt());return{_stream:a.pipe(Ft(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(es)),U(t=>t),Dt()),_control:{_stream:c.pipe(U(t=>t),Dt())}}},datalogic:{pre:t=>t,post:t=>t}}},rs=bn("error",{type:"critical",message:"LEAF core error: race condition detected in popup.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/popup.js"},{}),is=t=>{const e=t[cg.LAMBDA_OBJ],n=new Rt,r=new Rt;return{elementio$:r,leaflogic:(i,o)=>{const s=o._stream.pipe(Mt(...i.map(t=>t._stream)),Nt(t=>At(new Bt(t[0]),$t(new Bt(t[1]),r))),Nt(i=>{const o=i[1],s=Object.keys(e),a=["headless","jester","top","tt","bottom","bb","left","ll","right","rr","topleft","ttll","topright","ttrr","bottomleft","bbll","bottomright","bbrr","center","centre"].filter(t=>s.includes(t)),u=a.length>0?a[0]:void 0,c=[o].flat().map(n=>{if(en(n)){if("screenio"===n._bname){const i=wn("screenio",n);return lg({element:{nodeuuid:t[cg.REFNODE],type:"popup",componentdata:{poprect:u,headless:"headless"in e,ismenu:"jester"in e,unmountCallback:async()=>{const n="onclose"in e&&"_default"in e.onclose?e.onclose._default:void 0,i=n?await a_(n,[],{...t[cg.RTCONTEXT]._config}):[];return r.next(bn("elementio",{element:"popup",nodeuuid:t[cg.REFNODE],io:{onclose:i}})),i},children:Array.isArray(i)?i:[i],...t[cg.RTCONTEXT]}}},"screenio")}return"elementio"===n._bname?n:void 0}}).filter(t=>t);return c.length>1?n.next(c):1===c.length&&n.next(c[0]),cn(i[0])}));return{_stream:n.pipe(Ft(t=>JSON.stringify(t)!==JSON.stringify(rs)),U(t=>t)),_control:{_stream:s}}},datalogic:{pre:t=>t,post:t=>t}}},os=bn("error",{type:"critical",message:"LEAF core error: race condition detected in editor.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/editor.js"},{}),ss=t=>{const e=t[cg.LAMBDA_OBJ];"uidefs"in e&&"_default"in e.uidefs&&e.uidefs._default,"margin"in e&&"_default"in e.margin&&e.margin._default,"fieldwidth"in e&&"_default"in e.fieldwidth&&e.fieldwidth._default;return{leaflogic:(e,n)=>{const r=new Bt(os),i=n._stream.pipe(ln(n=>{t[cg.CTRLIN]=n;return At([...e.map(t=>t._stream)])}),U(e=>(e.length>1?r.next(e):1===e.length&&r.next(e[0]),t[cg.CTRLIN])));return{_stream:r,_control:{_stream:i}}},datalogic:{pre:t=>t,post:n=>{const r=Object.keys(e),i=["top","bottom","left","right","topleft","topright","bottomleft","bottomright","center","centre"].filter(t=>r.includes(t));i.length>0&&i[0];let o=n;o=1===o.length?o[0]:o;return lg({element:{nodeuuid:t[cg.REFNODE],type:"editor",componentdata:{domain:t[cg.DOMAIN],appid:t[cg.APPID],...t[cg.RTCONTEXT]}}},"screenio")}}}},as=(bn("error",{type:"critical",message:"LEAF core error: race condition detected in text.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/text.js"},{}),t=>{const e=t[cg.LAMBDA_OBJ];return{leaflogic:(t,e)=>{const n=new Rt,r=e._stream.pipe(Mt(...t.map(t=>t._stream)),U(t=>{const e=t[1];return n.next(e),t[0]}));return{_stream:n,_control:{_stream:r}}},datalogic:{pre:t=>t,post:n=>{const r=Object.keys(e),i=(["lambda","onsave","gspot"].filter(t=>r.includes(t)),"lambda"in e?"lambda":"dataflow");let o;en(n)&&n._content?._provenance?.refnodedata?(t[cg.RTCONTEXT].lambdarefnodedata=n._content?._provenance?.refnodedata,t[cg.RTCONTEXT].lambdasourceuuid=n._content?._refnode,o=n):o=n;return lg({element:{nodeuuid:t[cg.REFNODE],type:"text",componentdata:{refnode:t[cg.REFNODE],textsource:i,lambdarefnodedata:t[cg.RTCONTEXT].lambdarefnodedata,lambdasourceuuid:t[cg.RTCONTEXT].lambdasourceuuid,dataflowinput:o,domain:t[cg.DOMAIN],appid:t[cg.APPID],...t[cg.RTCONTEXT]}}},"screenio")}}}}),us=(bn("error",{type:"critical",message:"LEAF core error: race condition detected in image.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/image.js"},{}),t=>{const e=t[cg.LAMBDA_OBJ];return{leaflogic:(e,n)=>{const r=new Rt,i=n._stream.pipe(Mt(...e.map(t=>t._stream)),U(e=>{t[cg.CTRLIN]=e[0];const n=e[1];return r.next(n),e[0]}));return{_stream:r,_control:{_stream:i}}},datalogic:{pre:t=>{const e=[t].flat().map(t=>{if(en(t)&&"image"===t._bname)return wn("image",t)}).filter(t=>t);return 1===e.length?e[0]:e.length>1?e:void 0},post:n=>{const r=Object.keys(e);["onclose"].filter(t=>r.includes(t)),"onclose"in e&&e.onclose;return lg({element:{nodeuuid:t[cg.REFNODE],type:"image",componentdata:{imagelist:Array.isArray(n)?n:[n],...t[cg.RTCONTEXT]}}},"screenio")}}}});function cs(t){return g(function(e,n){try{e.subscribe(n)}finally{n.add(t)}})}bn("error",{type:"critical",message:"LEAF core error: race condition detected in mediainput.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/mediainput.js"},{});const ls=t=>{const e=t[cg.LAMBDA_OBJ],n=("uidefs"in e&&"_default"in e.uidefs&&e.uidefs._default,"margin"in e&&"_default"in e.margin&&e.margin._default,"fieldwidth"in e&&"_default"in e.fieldwidth&&e.fieldwidth._default,new Rt);return{elementio$:n,leaflogic:(r,i)=>{const o=new Rt,s=i._stream.pipe(Mt(...r.map(t=>t._stream)),Nt(r=>{t[cg.CTRLIN]=r[0];const i=r[1],o=Object.keys(e),s=["image","audio","video"].filter(t=>o.includes(t)),a=s.length>0?s[0]:"image";let u=i;u=1===u.length?u[0]:u;const c=Array.isArray(u)?u:[u],l=lg({element:{nodeuuid:t[cg.REFNODE],type:"mediainput",componentdata:{mediatype:a,nodeinput:c,callbacks:{onDropAccepted:async r=>{const i=e.ondrop?._default?await a_(e.ondrop._default,[bn("elementinput",r),bn("nodeinput",c)],{},t[cg.REFNODE]):void 0,o=bn("elementio",i);n.next(o)}}}}},"screenio");return l?$t(new Bt(l),n):n}),Nt(e=>(o.next(e),new Bt(t[cg.CTRLIN]))),Dt());return{_stream:o.pipe(U(t=>t),cs(()=>{}),Dt()),_control:{_stream:s.pipe(U(t=>t),cs(()=>{}),Dt())}}},datalogic:{pre:t=>t,post:t=>{let e=t;return e=1===e.length?e[0]:e,e}}}};var hs=n(7799);const{JZZ:ds}=hs,ps=(bn("error",{type:"critical",message:"LEAF core error: race condition detected in midi.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/midi.js"},{}),t=>{const e=t[cg.LAMBDA_OBJ],n=new Rt;let r=-1;const i=t=>{if(r=(r+1)%24,0===r){}const[e,i,o,s]=t;n.next(bn("_midi_in",{cmd:e,noteNumber:i,velocity:o},{timestamp:Date.now()}))},o={};return{leaflogic:(e,r)=>{const s=new Rt,a=r._stream.pipe(Nt(r=>{t[cg.CTRLIN]=r,"default"in o||(o.default=ds().openMidiIn().or("Error: Cannot open MIDI In port").and(t=>{}).connect(i));return $t(...e.map(t=>t._stream),n)}),U(e=>{!Array.isArray(e)&&e._bname;const n=(Array.isArray(e)?e:[e]).map(t=>"_data_in"===t._bname?rn(t._content)?void 0:wn("*",t):en(t)?t:void 0).filter(t=>t);return n.length>0&&s.next(n),t[cg.CTRLIN]}),Dt());return{_stream:s,_control:{_stream:a}}},datalogic:{pre:t=>bn("_data_in",t),post:t=>{const n=Object.keys(e),r=["image","audio","video"].filter(t=>n.includes(t));r.length>0&&r[0];let i=t;i=1===i.length?i[0]:i;return i}}}});function fs(t){return Math.pow(2,t/12)}let ms=440;function gs(t){return Math.round(_s(t))}function _s(t){return 69+12*Math.log2(t/ms)}function ys(t){return ms*Math.pow(2,(t-69)/12)}var vs=n(1795);const bs=new WeakSet,ws=new WeakMap,xs=new WeakMap,Ts=new WeakMap,ks=new WeakMap,Ss=new WeakMap,As=new WeakMap,Es=new WeakMap,Os=new WeakMap,Cs=new WeakMap,Ms={construct:()=>Ms},Ns=/^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/,Is=(t,e)=>{const n=[];let r=t.replace(/^[\s]+/,""),i=r.match(Ns);for(;null!==i;){const t=i[1].slice(1,-1),o=i[0].replace(/([\s]+)?;?$/,"").replace(t,new URL(t,e).toString());n.push(o),r=r.slice(i[0].length).replace(/^[\s]+/,""),i=r.match(Ns)}return[n.join(";"),r]},js=t=>{if(void 0!==t&&!Array.isArray(t))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},Rs=t=>{if(!(t=>{try{new new Proxy(t,Ms)}catch{return!1}return!0})(t))throw new TypeError("The given value for processorCtor should be a constructor.");if(null===t.prototype||"object"!=typeof t.prototype)throw new TypeError("The given value for processorCtor should have a prototype.")},Ps=(t,e)=>{const n=t.get(e);if(void 0===n)throw new Error("A value with the given key could not be found.");return n},Ds=(t,e)=>{const n=Array.from(t).filter(e);if(n.length>1)throw Error("More than one element was found.");if(0===n.length)throw Error("No element was found.");const[r]=n;return t.delete(r),r},Ls=(t,e,n,r)=>{const i=Ps(t,e),o=Ds(i,t=>t[0]===n&&t[1]===r);return 0===i.size&&t.delete(e),o},Fs=t=>Ps(As,t),$s=t=>{if(bs.has(t))throw new Error("The AudioNode is already stored.");bs.add(t),Fs(t).forEach(t=>t(!0))},Bs=t=>"port"in t,qs=t=>{if(!bs.has(t))throw new Error("The AudioNode is not stored.");bs.delete(t),Fs(t).forEach(t=>t(!1))},Us=(t,e)=>{!Bs(t)&&e.every(t=>0===t.size)&&qs(t)},Vs={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},Gs=(t,e)=>t.context===e,zs=t=>{try{t.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},Ws=()=>new DOMException("","IndexSizeError"),Js=t=>{var e;t.getChannelData=(e=t.getChannelData,n=>{try{return e.call(t,n)}catch(t){if(12===t.code)throw Ws();throw t}})},Hs={numberOfChannels:1},Xs=-34028234663852886e22,Ks=-Xs,Qs=t=>bs.has(t),Zs={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},Ys=t=>Ps(ws,t),ta=t=>Ps(Ts,t),ea=(t,e)=>{const{activeInputs:n}=Ys(t);n.forEach(n=>n.forEach(([n])=>{e.includes(t)||ea(n,[...e,t])}));const r=(t=>"playbackRate"in t)(t)?[t.playbackRate]:Bs(t)?Array.from(t.parameters.values()):(t=>"frequency"in t&&"gain"in t)(t)?[t.Q,t.detune,t.frequency,t.gain]:(t=>"offset"in t)(t)?[t.offset]:(t=>!("frequency"in t)&&"gain"in t)(t)?[t.gain]:(t=>"detune"in t&&"frequency"in t&&!("gain"in t))(t)?[t.detune,t.frequency]:(t=>"pan"in t)(t)?[t.pan]:[];for(const t of r){const n=ta(t);void 0!==n&&n.activeInputs.forEach(([t])=>ea(t,e))}Qs(t)&&qs(t)},na=t=>{ea(t.destination,[])},ra=t=>void 0===t||"number"==typeof t||"string"==typeof t&&("balanced"===t||"interactive"===t||"playback"===t),ia=t=>"context"in t,oa=t=>ia(t[0]),sa=(t,e,n,r)=>{for(const e of t)if(n(e)){if(r)return!1;throw Error("The set contains at least one similar element.")}return t.add(e),!0},aa=(t,e,[n,r],i)=>{sa(t,[e,n,r],t=>t[0]===e&&t[1]===n,i)},ua=(t,[e,n,r],i)=>{const o=t.get(e);void 0===o?t.set(e,new Set([[n,r]])):sa(o,[n,r],t=>t[0]===n,i)},ca=t=>"inputs"in t,la=(t,e,n,r)=>{if(ca(e)){const i=e.inputs[r];return t.connect(i,n,0),[i,n,0]}return t.connect(e,n,r),[e,n,r]},ha=(t,e,n)=>{for(const r of t)if(r[0]===e&&r[1]===n)return t.delete(r),r;return null},da=(t,e)=>{if(!Fs(t).delete(e))throw new Error("Missing the expected event listener.")},pa=(t,e,n)=>{const r=Ps(t,e),i=Ds(r,t=>t[0]===n);return 0===r.size&&t.delete(e),i},fa=(t,e,n,r)=>{ca(e)?t.disconnect(e.inputs[r],n,0):t.disconnect(e,n,r)},ma=t=>Ps(xs,t),ga=t=>Ps(ks,t),_a=t=>Es.has(t),ya=t=>!bs.has(t),va=(t,e)=>new Promise(n=>{if(null!==e)n(!0);else{const e=t.createScriptProcessor(256,1,1),r=t.createGain(),i=t.createBuffer(1,2,44100),o=i.getChannelData(0);o[0]=1,o[1]=1;const s=t.createBufferSource();s.buffer=i,s.loop=!0,s.connect(e).connect(t.destination),s.connect(r),s.disconnect(r),e.onaudioprocess=r=>{const i=r.inputBuffer.getChannelData(0);Array.prototype.some.call(i,t=>1===t)?n(!0):n(!1),s.stop(),e.onaudioprocess=null,s.disconnect(e),e.disconnect(t.destination)},s.start()}}),ba=(t,e)=>{const n=new Map;for(const e of t)for(const t of e){const e=n.get(t);n.set(t,void 0===e?1:e+1)}n.forEach((t,n)=>e(n,t))},wa=t=>"context"in t,xa=t=>{const e=new Map;t.connect=(t=>(n,r=0,i=0)=>{const o=wa(n)?t(n,r,i):t(n,r),s=e.get(n);return void 0===s?e.set(n,[{input:i,output:r}]):s.every(t=>t.input!==i||t.output!==r)&&s.push({input:i,output:r}),o})(t.connect.bind(t)),t.disconnect=(n=>(r,i,o)=>{if(n.apply(t),void 0===r)e.clear();else if("number"==typeof r)for(const[t,n]of e){const i=n.filter(t=>t.output!==r);0===i.length?e.delete(t):e.set(t,i)}else if(e.has(r))if(void 0===i)e.delete(r);else{const t=e.get(r);if(void 0!==t){const n=t.filter(t=>t.output!==i&&(t.input!==o||void 0===o));0===n.length?e.delete(r):e.set(r,n)}}for(const[n,r]of e)r.forEach(e=>{wa(n)?t.connect(n,e.output,e.input):t.connect(n,e.output)})})(t.disconnect)},Ta=(t,e,n,r)=>{const{activeInputs:i,passiveInputs:o}=ta(e),{outputs:s}=Ys(t),a=Fs(t),u=s=>{const a=ma(t),u=ga(e);if(s){const e=pa(o,t,n);aa(i,t,e,!1),r||_a(t)||a.connect(u,n)}else{const e=((t,e,n)=>Ds(t,t=>t[0]===e&&t[1]===n))(i,t,n);ua(o,e,!1),r||_a(t)||a.disconnect(u,n)}};return!!sa(s,[e,n],t=>t[0]===e&&t[1]===n,!0)&&(a.add(u),Qs(t)?aa(i,t,[n,u],!0):ua(o,[t,n,u],!0),!0)},ka=(t,e,n,r,i)=>{const[o,s]=((t,e,n,r)=>{const{activeInputs:i,passiveInputs:o}=Ys(e),s=ha(i[r],t,n);if(null===s)return[Ls(o,t,n,r)[2],!1];return[s[2],!0]})(t,n,r,i);if(null!==o&&(da(t,o),!s||e||_a(t)||fa(ma(t),ma(n),r,i)),Qs(n)){const{activeInputs:t}=Ys(n);Us(n,t)}},Sa=(t,e,n,r)=>{const[i,o]=((t,e,n)=>{const{activeInputs:r,passiveInputs:i}=ta(e),o=ha(r,t,n);if(null===o)return[pa(i,t,n)[1],!1];return[o[2],!0]})(t,n,r);null!==i&&(da(t,i),!o||e||_a(t)||ma(t).disconnect(ga(n),r))};class Aa{constructor(t){this._map=new Map(t)}get size(){return this._map.size}entries(){return this._map.entries()}forEach(t,e=null){return this._map.forEach((n,r)=>t.call(e,n,r,this))}get(t){return this._map.get(t)}has(t){return this._map.has(t)}keys(){return this._map.keys()}values(){return this._map.values()}}const Ea={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}};function Oa(t,e,n,r,i){if("function"==typeof t.copyFromChannel)0===e[n].byteLength&&(e[n]=new Float32Array(128)),t.copyFromChannel(e[n],r,i);else{const o=t.getChannelData(r);if(0===e[n].byteLength)e[n]=o.slice(i,i+128);else{const t=new Float32Array(o.buffer,i*Float32Array.BYTES_PER_ELEMENT,128);e[n].set(t)}}}const Ca=(t,e,n,r,i)=>{"function"==typeof t.copyToChannel?0!==e[n].byteLength&&t.copyToChannel(e[n],r,i):0!==e[n].byteLength&&t.getChannelData(r).set(e[n],i)},Ma=(t,e)=>{const n=[];for(let r=0;r<t;r+=1){const t=[],i="number"==typeof e?e:e[r];for(let e=0;e<i;e+=1)t.push(new Float32Array(128));n.push(t)}return n},Na=async(t,e,n,r,i,o,s)=>{const a=null===e?128*Math.ceil(t.context.length/128):e.length,u=r.channelCount*r.numberOfInputs,c=i.reduce((t,e)=>t+e,0),l=0===c?null:n.createBuffer(c,a,n.sampleRate);if(void 0===o)throw new Error("Missing the processor constructor.");const h=Ys(t),d=await((t,e)=>{const n=Ps(Cs,t),r=ma(e);return Ps(n,r)})(n,t),p=Ma(r.numberOfInputs,r.channelCount),f=Ma(r.numberOfOutputs,i),m=Array.from(t.parameters.keys()).reduce((t,e)=>({...t,[e]:new Float32Array(128)}),{});for(let c=0;c<a;c+=128){if(r.numberOfInputs>0&&null!==e)for(let t=0;t<r.numberOfInputs;t+=1)for(let n=0;n<r.channelCount;n+=1)Oa(e,p[t],n,n,c);void 0!==o.parameterDescriptors&&null!==e&&o.parameterDescriptors.forEach(({name:t},n)=>{Oa(e,m,t,u+n,c)});for(let t=0;t<r.numberOfInputs;t+=1)for(let e=0;e<i[t];e+=1)0===f[t][e].byteLength&&(f[t][e]=new Float32Array(128));try{const t=p.map((t,e)=>0===h.activeInputs[e].size?[]:t),e=s(c/n.sampleRate,n.sampleRate,()=>d.process(t,f,m));if(null!==l)for(let t=0,e=0;t<r.numberOfOutputs;t+=1){for(let n=0;n<i[t];n+=1)Ca(l,f[t],n,e+n,c);e+=i[t]}if(!e)break}catch(e){t.dispatchEvent(new ErrorEvent("processorerror",{colno:e.colno,filename:e.filename,lineno:e.lineno,message:e.message}));break}}return l},Ia={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},ja={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},Ra={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},Pa={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},Da={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},La=t=>{const{port1:e,port2:n}=new MessageChannel;return new Promise(r=>{const i=()=>{n.onmessage=null,e.close(),n.close(),r()};n.onmessage=()=>i();try{e.postMessage(t,[t])}catch{}finally{i()}})},Fa={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},$a=(t,e,n)=>{const r=e[n];if(void 0===r)throw t();return r},Ba={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},qa={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},Ua=()=>new DOMException("","InvalidStateError"),Va=()=>new DOMException("","InvalidAccessError"),Ga={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},za=(t,e,n,r,i,o,s,a,u,c,l)=>{const h=c.length;let d=a;for(let a=0;a<h;a+=1){let h=n[0]*c[a];for(let e=1;e<i;e+=1){const r=d-e&u-1;h+=n[e]*o[r],h-=t[e]*s[r]}for(let t=i;t<r;t+=1)h+=n[t]*o[d-t&u-1];for(let n=i;n<e;n+=1)h-=t[n]*s[d-n&u-1];o[d]=c[a],s[d]=h,d=d+1&u-1,l[a]=h}return d},Wa={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},Ja=t=>{const e=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{const n=t.decodeAudioData(e.buffer,()=>{});return void 0!==n&&(n.catch(()=>{}),!0)}catch{}return!1},Ha={numberOfChannels:1},Xa=(t,e,n)=>{const r=e[n];void 0!==r&&r!==t[n]&&(t[n]=r)},Ka=(t,e)=>{Xa(t,e,"channelCount"),Xa(t,e,"channelCountMode"),Xa(t,e,"channelInterpretation")},Qa=t=>"function"==typeof t.getFloatTimeDomainData,Za=(t,e,n)=>{const r=e[n];void 0!==r&&r!==t[n].value&&(t[n].value=r)},Ya=t=>{t.start=(e=>(n=0,r=0,i)=>{if("number"==typeof i&&i<0||r<0||n<0)throw new RangeError("The parameters can't be negative.");e.call(t,n,r,i)})(t.start)},tu=t=>{var e;t.stop=(e=t.stop,(n=0)=>{if(n<0)throw new RangeError("The parameter can't be negative.");e.call(t,n)})},eu=(t,e)=>null===t?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(t*e))))),nu=async(t,e)=>{const n=await(t=>new Promise((e,n)=>{const{port1:r,port2:i}=new MessageChannel;r.onmessage=({data:t})=>{r.close(),i.close(),e(t)},r.onmessageerror=({data:t})=>{r.close(),i.close(),n(t)},i.postMessage(t)}))(e);return new t(n)},ru=(t,e)=>{const n=t.createBiquadFilter();return Ka(n,e),Za(n,e,"Q"),Za(n,e,"detune"),Za(n,e,"frequency"),Za(n,e,"gain"),Xa(n,e,"type"),n},iu=(t,e)=>{const n=t.createChannelSplitter(e.numberOfOutputs);return Ka(n,e),(t=>{const e=t.numberOfOutputs;Object.defineProperty(t,"channelCount",{get:()=>e,set:t=>{if(t!==e)throw Ua()}}),Object.defineProperty(t,"channelCountMode",{get:()=>"explicit",set:t=>{if("explicit"!==t)throw Ua()}}),Object.defineProperty(t,"channelInterpretation",{get:()=>"discrete",set:t=>{if("discrete"!==t)throw Ua()}})})(n),n},ou=(t,e)=>(t.connect=e.connect.bind(e),t.disconnect=e.disconnect.bind(e),t),su=(t,e)=>{const n=t.createDelay(e.maxDelayTime);return Ka(n,e),Za(n,e,"delayTime"),n},au=(t,e)=>{const n=t.createGain();return Ka(n,e),Za(n,e,"gain"),n};function uu(t,e){const n=e[0]*e[0]+e[1]*e[1];return[(t[0]*e[0]+t[1]*e[1])/n,(t[1]*e[0]-t[0]*e[1])/n]}function cu(t,e){return[t[0]*e[0]-t[1]*e[1],t[0]*e[1]+t[1]*e[0]]}function lu(t,e){let n=[0,0];for(let r=t.length-1;r>=0;r-=1)n=cu(n,e),n[0]+=t[r];return n}const hu=(t,e,n,r)=>t.createScriptProcessor(e,n,r),du=()=>new DOMException("","NotSupportedError"),pu={numberOfChannels:1},fu={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},mu={channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0,distanceModel:"inverse",maxDistance:1e4,orientationX:1,orientationY:0,orientationZ:0,panningModel:"equalpower",positionX:0,positionY:0,positionZ:0,refDistance:1,rolloffFactor:1},gu={disableNormalization:!1},_u={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},yu=()=>new DOMException("","UnknownError"),vu={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},bu=(t,e,n)=>void 0===t.copyFromChannel?t.getChannelData(n)[0]:(t.copyFromChannel(e,n),e[0]),wu=t=>{if(null===t)return!1;const e=t.length;return e%2!=0?0!==t[Math.floor(e/2)]:t[e/2-1]+t[e/2]!==0},xu=(t,e,n,r)=>{let i=t;for(;!i.hasOwnProperty(e);)i=Object.getPrototypeOf(i);const{get:o,set:s}=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(t,e,{get:n(o),set:r(s)})},Tu=(t,e,n)=>{try{t.setValueAtTime(e,n)}catch(r){if(9!==r.code)throw r;Tu(t,e,n+1e-7)}},ku=t=>{const e=t.createOscillator();try{e.start(-1)}catch(t){return t instanceof RangeError}return!1},Su=t=>{const e=t.createBuffer(1,1,44100),n=t.createBufferSource();n.buffer=e,n.start(),n.stop();try{return n.stop(),!0}catch{return!1}},Au=t=>{const e=t.createOscillator();try{e.stop(-1)}catch(t){return t instanceof RangeError}return!1},Eu=(t,e)=>{const n=e.createGain();t.connect(n);const r=(e=>()=>{e.call(t,n),t.removeEventListener("ended",r)})(t.disconnect);t.addEventListener("ended",r),ou(t,n),t.stop=(e=>{let r=!1;return(i=0)=>{if(r)try{e.call(t,i)}catch{n.gain.setValueAtTime(0,i)}else e.call(t,i),r=!0}})(t.stop)},Ou=(t,e)=>n=>{const r={value:t};return Object.defineProperties(n,{currentTarget:r,target:r}),"function"==typeof e?e.call(t,n):e.handleEvent.call(t,n)};const Cu=(t=>(e,n,[r,i,o],s)=>{t(e[i],[n,r,o],t=>t[0]===n&&t[1]===r,s)})(sa),Mu=(t=>(e,n,[r,i,o],s)=>{const a=e.get(r);void 0===a?e.set(r,new Set([[i,n,o]])):t(a,[i,n,o],t=>t[0]===i&&t[1]===n,s)})(sa),Nu=(t=>(e,n,r,i)=>t(e[i],t=>t[0]===n&&t[1]===r))(Ds),Iu=new WeakMap,ju=(t=>e=>{var n;return null!==(n=t.get(e))&&void 0!==n?n:0})(Iu),Ru=(Pu=new Map,Du=new WeakMap,(t,e)=>{const n=Du.get(t);if(void 0!==n)return n;const r=Pu.get(t);if(void 0!==r)return r;try{const n=e();return n instanceof Promise?(Pu.set(t,n),n.catch(()=>!1).then(e=>(Pu.delete(t),Du.set(t,e),e))):(Du.set(t,n),n)}catch{return Du.set(t,!1),!1}});var Pu,Du;const Lu="undefined"==typeof window?null:window,Fu=((t,e)=>(n,r)=>{const i=n.createAnalyser();if(Ka(i,r),!(r.maxDecibels>r.minDecibels))throw e();return Xa(i,r,"fftSize"),Xa(i,r,"maxDecibels"),Xa(i,r,"minDecibels"),Xa(i,r,"smoothingTimeConstant"),t(Qa,()=>Qa(i))||(t=>{t.getFloatTimeDomainData=e=>{const n=new Uint8Array(e.length);t.getByteTimeDomainData(n);const r=Math.max(n.length,t.fftSize);for(let t=0;t<r;t+=1)e[t]=.0078125*(n[t]-128);return e}})(i),i})(Ru,Ws),$u=(t=>e=>{const n=t(e);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioNode in the audio graph.");return n.renderer})(Ys),Bu=((t,e,n)=>async(r,i,o)=>{const s=t(r);await Promise.all(s.activeInputs.map((t,s)=>Array.from(t).map(async([t,a])=>{const u=e(t),c=await u.render(t,i),l=r.context.destination;n(t)||r===l&&n(r)||c.connect(o,a,s)})).reduce((t,e)=>[...t,...e],[]))})(Ys,$u,_a),qu=((t,e,n)=>()=>{const r=new WeakMap;return{render(i,o){const s=r.get(o);return void 0!==s?Promise.resolve(s):(async(i,o)=>{let s=e(i);if(!Gs(s,o)){const e={channelCount:s.channelCount,channelCountMode:s.channelCountMode,channelInterpretation:s.channelInterpretation,fftSize:s.fftSize,maxDecibels:s.maxDecibels,minDecibels:s.minDecibels,smoothingTimeConstant:s.smoothingTimeConstant};s=t(o,e)}return r.set(o,s),await n(i,o,s),s})(i,o)}}})(Fu,ma,Bu),Uu=(Vu=Ss,t=>{const e=Vu.get(t);if(void 0===e)throw Ua();return e});var Vu;const Gu=(t=>null===t?null:t.hasOwnProperty("OfflineAudioContext")?t.OfflineAudioContext:t.hasOwnProperty("webkitOfflineAudioContext")?t.webkitOfflineAudioContext:null)(Lu),zu=(t=>e=>null!==t&&e instanceof t)(Gu),Wu=new WeakMap,Ju=(t=>class{constructor(t){this._nativeEventTarget=t,this._listeners=new WeakMap}addEventListener(e,n,r){if(null!==n){let i=this._listeners.get(n);void 0===i&&(i=t(this,n),"function"==typeof n&&this._listeners.set(n,i)),this._nativeEventTarget.addEventListener(e,i,r)}}dispatchEvent(t){return this._nativeEventTarget.dispatchEvent(t)}removeEventListener(t,e,n){const r=null===e?void 0:this._listeners.get(e);this._nativeEventTarget.removeEventListener(t,void 0===r?null:r,n)}})(Ou),Hu=(t=>null===t?null:t.hasOwnProperty("AudioContext")?t.AudioContext:t.hasOwnProperty("webkitAudioContext")?t.webkitAudioContext:null)(Lu),Xu=(t=>e=>null!==t&&e instanceof t)(Hu),Ku=(t=>e=>null!==t&&"function"==typeof t.AudioNode&&e instanceof t.AudioNode)(Lu),Qu=(t=>e=>null!==t&&"function"==typeof t.AudioParam&&e instanceof t.AudioParam)(Lu),Zu=(t=>null===t?null:t.hasOwnProperty("AudioWorkletNode")?t.AudioWorkletNode:null)(Lu),Yu=((t,e,n,r,i,o,s,a,u,c,l,h,d,p,f,m)=>class extends c{constructor(e,r,i,o){super(i),this._context=e,this._nativeAudioNode=i;const s=l(e);h(s)&&!0!==n(va,()=>va(s,m))&&xa(i),xs.set(this,i),As.set(this,new Set),"closed"!==e.state&&r&&$s(this),t(this,o,i)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(t){this._nativeAudioNode.channelCount=t}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(t){this._nativeAudioNode.channelCountMode=t}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(t){this._nativeAudioNode.channelInterpretation=t}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(t,n=0,a=0){if(n<0||n>=this._nativeAudioNode.numberOfOutputs)throw i();const c=l(this._context),h=f(c);if(d(t)||p(t))throw o();if(ia(t)){const i=ma(t);try{const e=la(this._nativeAudioNode,i,n,a),r=ya(this);(h||r)&&this._nativeAudioNode.disconnect(...e),"closed"!==this.context.state&&!r&&ya(t)&&$s(t)}catch(t){if(12===t.code)throw o();throw t}if(e(this,t,n,a,h)){const e=u([this],t);ba(e,r(h))}return t}const m=ga(t);if("playbackRate"===m.name&&1024===m.maxValue)throw s();try{this._nativeAudioNode.connect(m,n),(h||ya(this))&&this._nativeAudioNode.disconnect(m,n)}catch(t){if(12===t.code)throw o();throw t}if(Ta(this,t,n,h)){const e=u([this],t);ba(e,r(h))}}disconnect(t,e,n){let r;const s=l(this._context),c=f(s);if(void 0===t)r=((t,e)=>{const n=Ys(t),r=[];for(const i of n.outputs)oa(i)?ka(t,e,...i):Sa(t,e,...i),r.push(i[0]);return n.outputs.clear(),r})(this,c);else if("number"==typeof t){if(t<0||t>=this.numberOfOutputs)throw i();r=((t,e,n)=>{const r=Ys(t),i=[];for(const o of r.outputs)o[1]===n&&(oa(o)?ka(t,e,...o):Sa(t,e,...o),i.push(o[0]),r.outputs.delete(o));return i})(this,c,t)}else{if(void 0!==e&&(e<0||e>=this.numberOfOutputs))throw i();if(ia(t)&&void 0!==n&&(n<0||n>=t.numberOfInputs))throw i();if(r=((t,e,n,r,i)=>{const o=Ys(t);return Array.from(o.outputs).filter(t=>!(t[0]!==n||void 0!==r&&t[1]!==r||void 0!==i&&t[2]!==i)).map(n=>(oa(n)?ka(t,e,...n):Sa(t,e,...n),o.outputs.delete(n),n[0]))})(this,c,t,e,n),0===r.length)throw o()}for(const t of r){const e=u([this],t);ba(e,a)}}})((tc=ws,(t,e,n)=>{const r=[];for(let t=0;t<n.numberOfInputs;t+=1)r.push(new Set);tc.set(t,{activeInputs:r,outputs:new Set,passiveInputs:new WeakMap,renderer:e})}),((t,e,n,r,i,o,s,a,u,c,l,h,d)=>{const p=new WeakMap;return(f,m,g,_,y)=>{const{activeInputs:v,passiveInputs:b}=o(m),{outputs:w}=o(f),x=a(f),T=o=>{const a=u(m),c=u(f);if(o){const e=Ls(b,f,g,_);t(v,f,e,!1),y||h(f)||n(c,a,g,_),d(m)&&$s(m)}else{const t=r(v,f,g,_);e(b,_,t,!1),y||h(f)||i(c,a,g,_);const n=s(m);if(0===n)l(m)&&Us(m,v);else{const t=p.get(m);void 0!==t&&clearTimeout(t),p.set(m,setTimeout(()=>{l(m)&&Us(m,v)},1e3*n))}}};return!!c(w,[m,g,_],t=>t[0]===m&&t[1]===g&&t[2]===_,!0)&&(x.add(T),l(f)?t(v,f,[g,_,T],!0):e(b,_,[f,g,T],!0),!0)}})(Cu,Mu,la,Nu,fa,Ys,ju,Fs,ma,sa,Qs,_a,ya),Ru,((t,e,n,r,i,o)=>s=>(a,u)=>{const c=t.get(a);if(void 0===c){if(!s&&o(a)){const t=r(a),{outputs:o}=n(a);for(const n of o)if(oa(n)){const i=r(n[0]);e(t,i,n[1],n[2])}else{const e=i(n[0]);t.disconnect(e,n[1])}}t.set(a,u)}else t.set(a,c+u)})(Es,fa,Ys,ma,ga,Qs),Ws,Va,du,((t,e,n,r,i,o,s,a)=>(u,c)=>{const l=e.get(u);if(void 0===l)throw new Error("Missing the expected cycle count.");const h=o(u.context),d=a(h);if(l===c){if(e.delete(u),!d&&s(u)){const e=r(u),{outputs:o}=n(u);for(const n of o)if(oa(n)){const i=r(n[0]);t(e,i,n[1],n[2])}else{const t=i(n[0]);e.connect(t,n[1])}}}else e.set(u,l-c)})(la,Es,Ys,ma,ga,Uu,Qs,zu),((t,e,n)=>function r(i,o){const s=ia(o)?o:n(t,o);if((t=>"delayTime"in t)(s))return[];if(i[0]===s)return[i];if(i.includes(s))return[];const{outputs:a}=e(s);return Array.from(a).map(t=>r([...i,s],t[0])).reduce((t,e)=>t.concat(e),[])})(Wu,Ys,Ps),Ju,Uu,Xu,Ku,Qu,zu,Zu);var tc;const ec=((t,e,n,r,i,o)=>class extends t{constructor(t,n){const s=i(t),a={...Vs,...n},u=r(s,a);super(t,!1,u,o(s)?e():null),this._nativeAnalyserNode=u}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(t){this._nativeAnalyserNode.fftSize=t}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(t){const e=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=t,!(t>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=e,n()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(t){const e=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=t,!(this._nativeAnalyserNode.maxDecibels>t))throw this._nativeAnalyserNode.minDecibels=e,n()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(t){this._nativeAnalyserNode.smoothingTimeConstant=t}getByteFrequencyData(t){this._nativeAnalyserNode.getByteFrequencyData(t)}getByteTimeDomainData(t){this._nativeAnalyserNode.getByteTimeDomainData(t)}getFloatFrequencyData(t){this._nativeAnalyserNode.getFloatFrequencyData(t)}getFloatTimeDomainData(t){this._nativeAnalyserNode.getFloatTimeDomainData(t)}})(Yu,qu,Ws,Fu,Uu,zu),nc=new WeakSet,rc=(t=>null===t?null:t.hasOwnProperty("AudioBuffer")?t.AudioBuffer:null)(Lu),ic=(oc=new Uint32Array(1),t=>(oc[0]=t,oc[0]));var oc;const sc=((t,e)=>n=>{n.copyFromChannel=(r,i,o=0)=>{const s=t(o),a=t(i);if(a>=n.numberOfChannels)throw e();const u=n.length,c=n.getChannelData(a),l=r.length;for(let t=s<0?-s:0;t+s<u&&t<l;t+=1)r[t]=c[t+s]},n.copyToChannel=(r,i,o=0)=>{const s=t(o),a=t(i);if(a>=n.numberOfChannels)throw e();const u=n.length,c=n.getChannelData(a),l=r.length;for(let t=s<0?-s:0;t+s<u&&t<l;t+=1)c[t+s]=r[t]}})(ic,Ws),ac=(t=>e=>{e.copyFromChannel=(n=>(r,i,o=0)=>{const s=t(o),a=t(i);if(s<e.length)return n.call(e,r,a,s)})(e.copyFromChannel),e.copyToChannel=(n=>(r,i,o=0)=>{const s=t(o),a=t(i);if(s<e.length)return n.call(e,r,a,s)})(e.copyToChannel)})(ic),uc=((t,e,n,r,i,o,s,a)=>{let u=null;return class c{constructor(c){if(null===i)throw new Error("Missing the native OfflineAudioContext constructor.");const{length:l,numberOfChannels:h,sampleRate:d}={...Hs,...c};null===u&&(u=new i(1,1,44100));const p=null!==r&&e(o,o)?new r({length:l,numberOfChannels:h,sampleRate:d}):u.createBuffer(h,l,d);if(0===p.numberOfChannels)throw n();return"function"!=typeof p.copyFromChannel?(s(p),Js(p)):e(zs,()=>zs(p))||a(p),t.add(p),p}static[Symbol.hasInstance](e){return null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===c.prototype||t.has(e)}}})(nc,Ru,du,rc,Gu,(t=>()=>{if(null===t)return!1;try{new t({length:1,sampleRate:44100})}catch{return!1}return!0})(rc),sc,ac),cc=(t=>(e,n)=>{const r=t(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});n.connect(r).connect(e.destination);const i=()=>{n.removeEventListener("ended",i),n.disconnect(r),r.disconnect()};n.addEventListener("ended",i)})(au),lc=((t,e,n)=>async(r,i,o)=>{const s=e(r);await Promise.all(Array.from(s.activeInputs).map(async([e,r])=>{const s=t(e),a=await s.render(e,i);n(e)||a.connect(o,r)}))})($u,ta,_a),hc=(t=>(e,n,r)=>t(n,e,r))(lc),dc=((t,e,n,r,i,o,s,a,u,c,l)=>(h,d)=>{const p=h.createBufferSource();return Ka(p,d),Za(p,d,"playbackRate"),Xa(p,d,"buffer"),Xa(p,d,"loop"),Xa(p,d,"loopEnd"),Xa(p,d,"loopStart"),e(n,()=>n(h))||(t=>{t.start=(e=>{let n=!1;return(r=0,i=0,o)=>{if(n)throw Ua();e.call(t,r,i,o),n=!0}})(t.start)})(p),e(r,()=>r(h))||u(p),e(i,()=>i(h))||c(p,h),e(o,()=>o(h))||Ya(p),e(s,()=>s(h))||l(p,h),e(a,()=>a(h))||tu(p),t(h,p),p})(cc,Ru,t=>{const e=t.createBufferSource();e.start();try{e.start()}catch{return!0}return!1},t=>{const e=t.createBufferSource(),n=t.createBuffer(1,1,44100);e.buffer=n;try{e.start(0,1)}catch{return!1}return!0},t=>{const e=t.createBufferSource();e.start();try{e.stop()}catch{return!1}return!0},ku,Su,Au,t=>{t.start=(e=>(n=0,r=0,i)=>{const o=t.buffer,s=null===o?r:Math.min(o.duration,r);null!==o&&s>o.duration-.5/t.context.sampleRate?e.call(t,n,0,0):e.call(t,n,s,i)})(t.start)},(t=>(e,n)=>{const r=n.createBuffer(1,1,44100);null===e.buffer&&(e.buffer=r),t(e,"buffer",t=>()=>{const n=t.call(e);return n===r?null:n},t=>n=>t.call(e,null===n?r:n))})(xu),Eu),pc=((t,e)=>(n,r,i)=>(t(r).replay(i),e(r,n,i)))((t=>e=>{const n=t(e);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioParam in the audio graph.");return n.renderer})(ta),lc),fc=((t,e,n,r,i)=>()=>{const o=new WeakMap;let s=null,a=null;return{set start(t){s=t},set stop(t){a=t},render(u,c){const l=o.get(c);return void 0!==l?Promise.resolve(l):(async(u,c)=>{let l=n(u);const h=Gs(l,c);if(!h){const t={buffer:l.buffer,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,loop:l.loop,loopEnd:l.loopEnd,loopStart:l.loopStart,playbackRate:l.playbackRate.value};l=e(c,t),null!==s&&l.start(...s),null!==a&&l.stop(a)}return o.set(c,l),h?await t(c,u.playbackRate,l.playbackRate):await r(c,u.playbackRate,l.playbackRate),await i(u,c,l),l})(u,c)}}})(hc,dc,ma,pc,Bu),mc=((t,e,n,r,i,o,s,a,u,c,l,h,d)=>(p,f,m,g=null,_=null)=>{const y=m.value,v=new vs.AutomationEventList(y),b=f?r(v):null,w={get defaultValue(){return y},get maxValue(){return null===g?m.maxValue:g},get minValue(){return null===_?m.minValue:_},get value(){return m.value},set value(t){m.value=t,w.setValueAtTime(t,p.context.currentTime)},cancelAndHoldAtTime(t){if("function"==typeof m.cancelAndHoldAtTime)null===b&&v.flush(p.context.currentTime),v.add(i(t)),m.cancelAndHoldAtTime(t);else{const e=Array.from(v).pop();null===b&&v.flush(p.context.currentTime),v.add(i(t));const n=Array.from(v).pop();m.cancelScheduledValues(t),e!==n&&void 0!==n&&("exponentialRampToValue"===n.type?m.exponentialRampToValueAtTime(n.value,n.endTime):"linearRampToValue"===n.type?m.linearRampToValueAtTime(n.value,n.endTime):"setValue"===n.type?m.setValueAtTime(n.value,n.startTime):"setValueCurve"===n.type&&m.setValueCurveAtTime(n.values,n.startTime,n.duration))}return w},cancelScheduledValues:t=>(null===b&&v.flush(p.context.currentTime),v.add(o(t)),m.cancelScheduledValues(t),w),exponentialRampToValueAtTime(t,e){if(0===t)throw new RangeError;if(!Number.isFinite(e)||e<0)throw new RangeError;const n=p.context.currentTime;return null===b&&v.flush(n),0===Array.from(v).length&&(v.add(c(y,n)),m.setValueAtTime(y,n)),v.add(s(t,e)),m.exponentialRampToValueAtTime(t,e),w},linearRampToValueAtTime(t,e){const n=p.context.currentTime;return null===b&&v.flush(n),0===Array.from(v).length&&(v.add(c(y,n)),m.setValueAtTime(y,n)),v.add(a(t,e)),m.linearRampToValueAtTime(t,e),w},setTargetAtTime:(t,e,n)=>(null===b&&v.flush(p.context.currentTime),v.add(u(t,e,n)),m.setTargetAtTime(t,e,n),w),setValueAtTime:(t,e)=>(null===b&&v.flush(p.context.currentTime),v.add(c(t,e)),m.setValueAtTime(t,e),w),setValueCurveAtTime(t,e,n){const r=t instanceof Float32Array?t:new Float32Array(t);if(null!==h&&"webkitAudioContext"===h.name){const t=e+n,i=p.context.sampleRate,o=Math.ceil(e*i),s=Math.floor(t*i),a=s-o,u=new Float32Array(a);for(let t=0;t<a;t+=1){const s=(r.length-1)/n*((o+t)/i-e),a=Math.floor(s),c=Math.ceil(s);u[t]=a===c?r[a]:(1-(s-a))*r[a]+(1-(c-s))*r[c]}null===b&&v.flush(p.context.currentTime),v.add(l(u,e,n)),m.setValueCurveAtTime(u,e,n);const c=s/i;c<t&&d(w,u[u.length-1],c),d(w,r[r.length-1],t)}else null===b&&v.flush(p.context.currentTime),v.add(l(r,e,n)),m.setValueCurveAtTime(r,e,n);return w}};return n.set(w,m),e.set(w,p),t(w,b),w})((gc=Ts,(t,e)=>{gc.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:e})}),Wu,ks,t=>({replay(e){for(const n of t)if("exponentialRampToValue"===n.type){const{endTime:t,value:r}=n;e.exponentialRampToValueAtTime(r,t)}else if("linearRampToValue"===n.type){const{endTime:t,value:r}=n;e.linearRampToValueAtTime(r,t)}else if("setTarget"===n.type){const{startTime:t,target:r,timeConstant:i}=n;e.setTargetAtTime(r,t,i)}else if("setValue"===n.type){const{startTime:t,value:r}=n;e.setValueAtTime(r,t)}else{if("setValueCurve"!==n.type)throw new Error("Can't apply an unknown automation.");{const{duration:t,startTime:r,values:i}=n;e.setValueCurveAtTime(i,r,t)}}}}),vs.createCancelAndHoldAutomationEvent,vs.createCancelScheduledValuesAutomationEvent,vs.createExponentialRampToValueAutomationEvent,vs.createLinearRampToValueAutomationEvent,vs.createSetTargetAutomationEvent,vs.createSetValueAutomationEvent,vs.createSetValueCurveAutomationEvent,Hu,Tu);var gc;const _c=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,r){const a=o(t),u={...Zs,...r},c=i(a,u),l=s(a),h=l?e():null;super(t,!1,c,h),this._audioBufferSourceNodeRenderer=h,this._isBufferNullified=!1,this._isBufferSet=null!==u.buffer,this._nativeAudioBufferSourceNode=c,this._onended=null,this._playbackRate=n(this,l,c.playbackRate,Ks,Xs)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(t){if(this._nativeAudioBufferSourceNode.buffer=t,null!==t){if(this._isBufferSet)throw r();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(t){this._nativeAudioBufferSourceNode.loop=t}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(t){this._nativeAudioBufferSourceNode.loopEnd=t}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(t){this._nativeAudioBufferSourceNode.loopStart=t}get onended(){return this._onended}set onended(t){const e="function"==typeof t?a(this,t):null;this._nativeAudioBufferSourceNode.onended=e;const n=this._nativeAudioBufferSourceNode.onended;this._onended=null!==n&&n===e?t:n}get playbackRate(){return this._playbackRate}start(t=0,e=0,n){if(this._nativeAudioBufferSourceNode.start(t,e,n),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.start=void 0===n?[t,e]:[t,e,n]),"closed"!==this.context.state){$s(this);const t=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",t),Qs(this)&&qs(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeAudioBufferSourceNode.stop(t),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.stop=t)}})(Yu,fc,mc,Ua,dc,Uu,zu,Ou),yc=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,n){const r=o(t),u=s(r),c=i(r,n,u);super(t,!1,c,u?e(a):null),this._isNodeOfNativeOfflineAudioContext=u,this._nativeAudioDestinationNode=c}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(t){if(this._isNodeOfNativeOfflineAudioContext)throw r();if(t>this._nativeAudioDestinationNode.maxChannelCount)throw n();this._nativeAudioDestinationNode.channelCount=t}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(t){if(this._isNodeOfNativeOfflineAudioContext)throw r();this._nativeAudioDestinationNode.channelCountMode=t}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}})(Yu,t=>{const e=new WeakMap;return{render(n,r){const i=e.get(r);return void 0!==i?Promise.resolve(i):(async(n,r)=>{const i=r.destination;return e.set(r,i),await t(n,r,i),i})(n,r)}}},Ws,Ua,((t,e)=>(n,r,i)=>{const o=n.destination;if(o.channelCount!==r)try{o.channelCount=r}catch{}i&&"explicit"!==o.channelCountMode&&(o.channelCountMode="explicit"),0===o.maxChannelCount&&Object.defineProperty(o,"maxChannelCount",{value:r});const s=t(n,{channelCount:r,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,gain:1});return e(s,"channelCount",t=>()=>t.call(s),t=>e=>{t.call(s,e);try{o.channelCount=e}catch(t){if(e>o.maxChannelCount)throw t}}),e(s,"channelCountMode",t=>()=>t.call(s),t=>e=>{t.call(s,e),o.channelCountMode=e}),e(s,"channelInterpretation",t=>()=>t.call(s),t=>e=>{t.call(s,e),o.channelInterpretation=e}),Object.defineProperty(s,"maxChannelCount",{get:()=>o.maxChannelCount}),s.connect(o),s})(au,xu),Uu,zu,Bu),vc=((t,e,n,r,i)=>()=>{const o=new WeakMap;return{render(s,a){const u=o.get(a);return void 0!==u?Promise.resolve(u):(async(s,a)=>{let u=n(s);const c=Gs(u,a);if(!c){const t={Q:u.Q.value,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,detune:u.detune.value,frequency:u.frequency.value,gain:u.gain.value,type:u.type};u=e(a,t)}return o.set(a,u),c?(await t(a,s.Q,u.Q),await t(a,s.detune,u.detune),await t(a,s.frequency,u.frequency),await t(a,s.gain,u.gain)):(await r(a,s.Q,u.Q),await r(a,s.detune,u.detune),await r(a,s.frequency,u.frequency),await r(a,s.gain,u.gain)),await i(s,a,u),u})(s,a)}}})(hc,ru,ma,pc,Bu),bc=(t=>(e,n)=>t.set(e,n))(Iu),wc=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,r){const u=o(t),c={...Ia,...r},l=i(u,c),h=s(u);super(t,!1,l,h?n():null),this._Q=e(this,h,l.Q,Ks,Xs),this._detune=e(this,h,l.detune,1200*Math.log2(Ks),-1200*Math.log2(Ks)),this._frequency=e(this,h,l.frequency,t.sampleRate/2,0),this._gain=e(this,h,l.gain,40*Math.log10(Ks),Xs),this._nativeBiquadFilterNode=l,a(this,1)}get detune(){return this._detune}get frequency(){return this._frequency}get gain(){return this._gain}get Q(){return this._Q}get type(){return this._nativeBiquadFilterNode.type}set type(t){this._nativeBiquadFilterNode.type=t}getFrequencyResponse(t,e,n){try{this._nativeBiquadFilterNode.getFrequencyResponse(t,e,n)}catch(t){if(11===t.code)throw r();throw t}if(t.length!==e.length||e.length!==n.length)throw r()}})(Yu,mc,vc,Va,ru,Uu,zu,bc),xc=((t,e)=>(n,r,i)=>{const o=new Set;return n.connect=(i=>(s,a=0,u=0)=>{const c=0===o.size;if(e(s))return i.call(n,s,a,u),t(o,[s,a,u],t=>t[0]===s&&t[1]===a&&t[2]===u,!0),c&&r(),s;i.call(n,s,a),t(o,[s,a],t=>t[0]===s&&t[1]===a,!0),c&&r()})(n.connect),n.disconnect=(t=>(r,s,a)=>{const u=o.size>0;if(void 0===r)t.apply(n),o.clear();else if("number"==typeof r){t.call(n,r);for(const t of o)t[1]===r&&o.delete(t)}else{e(r)?t.call(n,r,s,a):t.call(n,r,s);for(const t of o)t[0]!==r||void 0!==s&&t[1]!==s||void 0!==a&&t[2]!==a||o.delete(t)}const c=0===o.size;u&&c&&i()})(n.disconnect),n})(sa,Ku),Tc=((t,e)=>(n,r)=>{r.channelCount=1,r.channelCountMode="explicit",Object.defineProperty(r,"channelCount",{get:()=>1,set:()=>{throw t()}}),Object.defineProperty(r,"channelCountMode",{get:()=>"explicit",set:()=>{throw t()}});const i=n.createBufferSource();e(r,()=>{const t=r.numberOfInputs;for(let e=0;e<t;e+=1)i.connect(r,0,e)},()=>i.disconnect(r))})(Ua,xc),kc=((t,e)=>(n,r)=>{const i=n.createChannelMerger(r.numberOfInputs);return null!==t&&"webkitAudioContext"===t.name&&e(n,i),Ka(i,r),i})(Hu,Tc),Sc=((t,e,n)=>()=>{const r=new WeakMap;return{render(i,o){const s=r.get(o);return void 0!==s?Promise.resolve(s):(async(i,o)=>{let s=e(i);if(!Gs(s,o)){const e={channelCount:s.channelCount,channelCountMode:s.channelCountMode,channelInterpretation:s.channelInterpretation,numberOfInputs:s.numberOfInputs};s=t(o,e)}return r.set(o,s),await n(i,o,s),s})(i,o)}}})(kc,ma,Bu),Ac=((t,e,n,r,i)=>class extends t{constructor(t,o){const s=r(t),a={...ja,...o};super(t,!1,n(s,a),i(s)?e():null)}})(Yu,Sc,kc,Uu,zu),Ec=((t,e,n)=>()=>{const r=new WeakMap;return{render(i,o){const s=r.get(o);return void 0!==s?Promise.resolve(s):(async(i,o)=>{let s=e(i);if(!Gs(s,o)){const e={channelCount:s.channelCount,channelCountMode:s.channelCountMode,channelInterpretation:s.channelInterpretation,numberOfOutputs:s.numberOfOutputs};s=t(o,e)}return r.set(o,s),await n(i,o,s),s})(i,o)}}})(iu,ma,Bu),Oc=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u=o({...Ra,...s});super(t,!1,n(a,u),i(a)?e():null)}})(Yu,Ec,iu,Uu,zu,t=>({...t,channelCount:t.numberOfOutputs})),Cc=((t,e,n,r)=>(i,{offset:o,...s})=>{const a=i.createBuffer(1,2,44100),u=e(i,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),c=n(i,{...s,gain:o}),l=a.getChannelData(0);l[0]=1,l[1]=1,u.buffer=a,u.loop=!0;const h={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(t){c.channelCount=t},get channelCountMode(){return c.channelCountMode},set channelCountMode(t){c.channelCountMode=t},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(t){c.channelInterpretation=t},get context(){return c.context},get inputs(){return[]},get numberOfInputs(){return u.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get offset(){return c.gain},get onended(){return u.onended},set onended(t){u.onended=t},addEventListener:(...t)=>u.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>u.dispatchEvent(t[0]),removeEventListener:(...t)=>u.removeEventListener(t[0],t[1],t[2]),start(t=0){u.start.call(u,t)},stop(t=0){u.stop.call(u,t)}};return t(i,u),r(ou(h,c),()=>u.connect(c),()=>u.disconnect(c))})(cc,dc,au,xc),Mc=((t,e,n,r,i)=>(o,s)=>{if(void 0===o.createConstantSource)return n(o,s);const a=o.createConstantSource();return Ka(a,s),Za(a,s,"offset"),e(r,()=>r(o))||Ya(a),e(i,()=>i(o))||tu(a),t(o,a),a})(cc,Ru,Cc,ku,Au),Nc=((t,e,n,r,i)=>()=>{const o=new WeakMap;let s=null,a=null;return{set start(t){s=t},set stop(t){a=t},render(u,c){const l=o.get(c);return void 0!==l?Promise.resolve(l):(async(u,c)=>{let l=n(u);const h=Gs(l,c);if(!h){const t={channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,offset:l.offset.value};l=e(c,t),null!==s&&l.start(s),null!==a&&l.stop(a)}return o.set(c,l),h?await t(c,u.offset,l.offset):await r(c,u.offset,l.offset),await i(u,c,l),l})(u,c)}}})(hc,Mc,ma,pc,Bu),Ic=((t,e,n,r,i,o,s)=>class extends t{constructor(t,s){const a=i(t),u={...Pa,...s},c=r(a,u),l=o(a),h=l?n():null;super(t,!1,c,h),this._constantSourceNodeRenderer=h,this._nativeConstantSourceNode=c,this._offset=e(this,l,c.offset,Ks,Xs),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(t){const e="function"==typeof t?s(this,t):null;this._nativeConstantSourceNode.onended=e;const n=this._nativeConstantSourceNode.onended;this._onended=null!==n&&n===e?t:n}start(t=0){if(this._nativeConstantSourceNode.start(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.start=t),"closed"!==this.context.state){$s(this);const t=()=>{this._nativeConstantSourceNode.removeEventListener("ended",t),Qs(this)&&qs(this)};this._nativeConstantSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeConstantSourceNode.stop(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.stop=t)}})(Yu,mc,Nc,Mc,Uu,zu,Ou),jc=((t,e)=>(n,r)=>{const i=n.createConvolver();if(Ka(i,r),r.disableNormalization===i.normalize&&(i.normalize=!r.disableNormalization),Xa(i,r,"buffer"),r.channelCount>2)throw t();if(e(i,"channelCount",t=>()=>t.call(i),e=>n=>{if(n>2)throw t();return e.call(i,n)}),"max"===r.channelCountMode)throw t();return e(i,"channelCountMode",t=>()=>t.call(i),e=>n=>{if("max"===n)throw t();return e.call(i,n)}),i})(du,xu),Rc=((t,e,n)=>()=>{const r=new WeakMap;return{render(i,o){const s=r.get(o);return void 0!==s?Promise.resolve(s):(async(i,o)=>{let s=e(i);if(!Gs(s,o)){const e={buffer:s.buffer,channelCount:s.channelCount,channelCountMode:s.channelCountMode,channelInterpretation:s.channelInterpretation,disableNormalization:!s.normalize};s=t(o,e)}return r.set(o,s),ca(s)?await n(i,o,s.inputs[0]):await n(i,o,s),s})(i,o)}}})(jc,ma,Bu),Pc=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u={...Da,...s},c=n(a,u);super(t,!1,c,i(a)?e():null),this._isBufferNullified=!1,this._nativeConvolverNode=c,null!==u.buffer&&o(this,u.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(t){if(this._nativeConvolverNode.buffer=t,null===t&&null!==this._nativeConvolverNode.buffer){const t=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=t.createBuffer(1,1,t.sampleRate),this._isBufferNullified=!0,o(this,0)}else this._isBufferNullified=!1,o(this,null===this._nativeConvolverNode.buffer?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(t){this._nativeConvolverNode.normalize=t}})(Yu,Rc,jc,Uu,zu,bc),Dc=((t,e,n,r,i)=>o=>{const s=new WeakMap;return{render(a,u){const c=s.get(u);return void 0!==c?Promise.resolve(c):(async(a,u)=>{let c=n(a);const l=Gs(c,u);if(!l){const t={channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,delayTime:c.delayTime.value,maxDelayTime:o};c=e(u,t)}return s.set(u,c),l?await t(u,a.delayTime,c.delayTime):await r(u,a.delayTime,c.delayTime),await i(a,u,c),c})(a,u)}}})(hc,su,ma,pc,Bu),Lc=((t,e,n,r,i,o,s)=>class extends t{constructor(t,a){const u=i(t),c={...Fa,...a},l=r(u,c),h=o(u);super(t,!1,l,h?n(c.maxDelayTime):null),this._delayTime=e(this,h,l.delayTime),s(this,c.maxDelayTime)}get delayTime(){return this._delayTime}})(Yu,mc,Dc,su,Uu,zu,bc),Fc=(t=>(e,n)=>{const r=e.createDynamicsCompressor();if(Ka(r,n),n.channelCount>2)throw t();if("max"===n.channelCountMode)throw t();return Za(r,n,"attack"),Za(r,n,"knee"),Za(r,n,"ratio"),Za(r,n,"release"),Za(r,n,"threshold"),r})(du),$c=((t,e,n,r,i)=>()=>{const o=new WeakMap;return{render(s,a){const u=o.get(a);return void 0!==u?Promise.resolve(u):(async(s,a)=>{let u=n(s);const c=Gs(u,a);if(!c){const t={attack:u.attack.value,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,knee:u.knee.value,ratio:u.ratio.value,release:u.release.value,threshold:u.threshold.value};u=e(a,t)}return o.set(a,u),c?(await t(a,s.attack,u.attack),await t(a,s.knee,u.knee),await t(a,s.ratio,u.ratio),await t(a,s.release,u.release),await t(a,s.threshold,u.threshold)):(await r(a,s.attack,u.attack),await r(a,s.knee,u.knee),await r(a,s.ratio,u.ratio),await r(a,s.release,u.release),await r(a,s.threshold,u.threshold)),await i(s,a,u),u})(s,a)}}})(hc,Fc,ma,pc,Bu),Bc=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,i){const u=o(t),c={...Ba,...i},l=r(u,c),h=s(u);super(t,!1,l,h?n():null),this._attack=e(this,h,l.attack),this._knee=e(this,h,l.knee),this._nativeDynamicsCompressorNode=l,this._ratio=e(this,h,l.ratio),this._release=e(this,h,l.release),this._threshold=e(this,h,l.threshold),a(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(t){const e=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=t,t>2)throw this._nativeDynamicsCompressorNode.channelCount=e,i()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(t){const e=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=t,"max"===t)throw this._nativeDynamicsCompressorNode.channelCountMode=e,i()}get knee(){return this._knee}get ratio(){return this._ratio}get reduction(){return"number"==typeof this._nativeDynamicsCompressorNode.reduction.value?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}get release(){return this._release}get threshold(){return this._threshold}})(Yu,mc,$c,Fc,du,Uu,zu,bc),qc=((t,e,n,r,i)=>()=>{const o=new WeakMap;return{render(s,a){const u=o.get(a);return void 0!==u?Promise.resolve(u):(async(s,a)=>{let u=n(s);const c=Gs(u,a);if(!c){const t={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,gain:u.gain.value};u=e(a,t)}return o.set(a,u),c?await t(a,s.gain,u.gain):await r(a,s.gain,u.gain),await i(s,a,u),u})(s,a)}}})(hc,au,ma,pc,Bu),Uc=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=i(t),u={...qa,...s},c=r(a,u),l=o(a);super(t,!1,c,l?n():null),this._gain=e(this,l,c.gain,Ks,Xs)}get gain(){return this._gain}})(Yu,mc,qc,au,Uu,zu),Vc=((t,e,n,r)=>(i,o,{channelCount:s,channelCountMode:a,channelInterpretation:u,feedback:c,feedforward:l})=>{const h=eu(o,i.sampleRate),d=c instanceof Float64Array?c:new Float64Array(c),p=l instanceof Float64Array?l:new Float64Array(l),f=d.length,m=p.length,g=Math.min(f,m);if(0===f||f>20)throw r();if(0===d[0])throw e();if(0===m||m>20)throw r();if(0===p[0])throw e();if(1!==d[0]){for(let t=0;t<m;t+=1)p[t]/=d[0];for(let t=1;t<f;t+=1)d[t]/=d[0]}const _=n(i,h,s,s);_.channelCount=s,_.channelCountMode=a,_.channelInterpretation=u;const y=[],v=[],b=[];for(let t=0;t<s;t+=1){y.push(0);const t=new Float32Array(32),e=new Float32Array(32);t.fill(0),e.fill(0),v.push(t),b.push(e)}_.onaudioprocess=t=>{const e=t.inputBuffer,n=t.outputBuffer,r=e.numberOfChannels;for(let t=0;t<r;t+=1){const r=e.getChannelData(t),i=n.getChannelData(t);y[t]=za(d,f,p,m,g,v[t],b[t],y[t],32,r,i)}};const w=i.sampleRate/2;return ou({get bufferSize(){return h},get channelCount(){return _.channelCount},set channelCount(t){_.channelCount=t},get channelCountMode(){return _.channelCountMode},set channelCountMode(t){_.channelCountMode=t},get channelInterpretation(){return _.channelInterpretation},set channelInterpretation(t){_.channelInterpretation=t},get context(){return _.context},get inputs(){return[_]},get numberOfInputs(){return _.numberOfInputs},get numberOfOutputs(){return _.numberOfOutputs},addEventListener:(...t)=>_.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>_.dispatchEvent(t[0]),getFrequencyResponse(e,n,r){if(e.length!==n.length||n.length!==r.length)throw t();const i=e.length;for(let t=0;t<i;t+=1){const i=-Math.PI*(e[t]/w),o=[Math.cos(i),Math.sin(i)],s=uu(lu(p,o),lu(d,o));n[t]=Math.sqrt(s[0]*s[0]+s[1]*s[1]),r[t]=Math.atan2(s[1],s[0])}},removeEventListener:(...t)=>_.removeEventListener(t[0],t[1],t[2])},_)})(Va,Ua,hu,du),Gc=((t,e,n,r)=>i=>t(Ja,()=>Ja(i))?Promise.resolve(t(r,r)).then(t=>{if(!t){const t=n(i,512,0,1);i.oncomplete=()=>{t.onaudioprocess=null,t.disconnect()},t.onaudioprocess=()=>i.currentTime,t.connect(i.destination)}return i.startRendering()}):new Promise(t=>{const n=e(i,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});i.oncomplete=e=>{n.disconnect(),t(e.renderedBuffer)},n.connect(i.destination),i.startRendering()}))(Ru,au,hu,((t,e)=>()=>{if(null===e)return Promise.resolve(!1);const n=new e(1,1,44100),r=t(n,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return new Promise(t=>{n.oncomplete=()=>{r.disconnect(),t(0!==n.currentTime)},n.startRendering()})})(au,Gu)),zc=((t,e,n,r,i)=>(o,s)=>{const a=new WeakMap;let u=null;const c=async(c,l)=>{let h=null,d=e(c);const p=Gs(d,l);if(void 0===l.createIIRFilter?h=t(l,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):p||(d=l.createIIRFilter(s,o)),a.set(l,null===h?d:h),null!==h){if(null===u){if(null===n)throw new Error("Missing the native OfflineAudioContext constructor.");const t=new n(c.context.destination.channelCount,c.context.length,l.sampleRate);u=(async()=>{await r(c,t,t.destination);return((t,e,n,r)=>{const i=n instanceof Float64Array?n:new Float64Array(n),o=r instanceof Float64Array?r:new Float64Array(r),s=i.length,a=o.length,u=Math.min(s,a);if(1!==i[0]){for(let t=0;t<s;t+=1)o[t]/=i[0];for(let t=1;t<a;t+=1)i[t]/=i[0]}const c=new Float32Array(32),l=new Float32Array(32),h=e.createBuffer(t.numberOfChannels,t.length,t.sampleRate),d=t.numberOfChannels;for(let e=0;e<d;e+=1){const n=t.getChannelData(e),r=h.getChannelData(e);c.fill(0),l.fill(0),za(i,s,o,a,u,c,l,0,32,n,r)}return h})(await i(t),l,o,s)})()}const t=await u;return h.buffer=t,h.start(0),h}return await r(c,l,d),d};return{render(t,e){const n=a.get(e);return void 0!==n?Promise.resolve(n):c(t,e)}}})(dc,ma,Gu,Bu,Gc),Wc=(t=>(e,n,r)=>{if(void 0===e.createIIRFilter)return t(e,n,r);const i=e.createIIRFilter(r.feedforward,r.feedback);return Ka(i,r),i})(Vc),Jc=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u=i(a),c={...Ga,...s},l=e(a,u?null:t.baseLatency,c);super(t,!1,l,u?n(c.feedback,c.feedforward):null),(t=>{var e;t.getFrequencyResponse=(e=t.getFrequencyResponse,(n,r,i)=>{if(n.length!==r.length||r.length!==i.length)throw Va();return e.call(t,n,r,i)})})(l),this._nativeIIRFilterNode=l,o(this,1)}getFrequencyResponse(t,e,n){return this._nativeIIRFilterNode.getFrequencyResponse(t,e,n)}})(Yu,Wc,zc,Uu,zu,bc),Hc=((t,e,n,r,i,o,s,a)=>(u,c)=>{const l=c.listener,{forwardX:h,forwardY:d,forwardZ:p,positionX:f,positionY:m,positionZ:g,upX:_,upY:y,upZ:v}=void 0===l.forwardX?(()=>{const h=new Float32Array(1),d=e(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:9}),p=s(c);let f=!1,m=[0,0,-1,0,1,0],g=[0,0,0];const _=()=>{if(f)return;f=!0;const t=r(c,256,9,0);t.onaudioprocess=({inputBuffer:t})=>{const e=[o(t,h,0),o(t,h,1),o(t,h,2),o(t,h,3),o(t,h,4),o(t,h,5)];e.some((t,e)=>t!==m[e])&&(l.setOrientation(...e),m=e);const n=[o(t,h,6),o(t,h,7),o(t,h,8)];n.some((t,e)=>t!==g[e])&&(l.setPosition(...n),g=n)},d.connect(t)},y=t=>e=>{e!==m[t]&&(m[t]=e,l.setOrientation(...m))},v=t=>e=>{e!==g[t]&&(g[t]=e,l.setPosition(...g))},b=(e,r,o)=>{const s=n(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:r});s.connect(d,0,e),s.start(),Object.defineProperty(s.offset,"defaultValue",{get:()=>r});const l=t({context:u},p,s.offset,Ks,Xs);var h,f,m,g,y,v,b;return a(l,"value",t=>()=>t.call(l),t=>e=>{try{t.call(l,e)}catch(t){if(9!==t.code)throw t}_(),p&&o(e)}),l.cancelAndHoldAtTime=(h=l.cancelAndHoldAtTime,p?()=>{throw i()}:(...t)=>{const e=h.apply(l,t);return _(),e}),l.cancelScheduledValues=(f=l.cancelScheduledValues,p?()=>{throw i()}:(...t)=>{const e=f.apply(l,t);return _(),e}),l.exponentialRampToValueAtTime=(m=l.exponentialRampToValueAtTime,p?()=>{throw i()}:(...t)=>{const e=m.apply(l,t);return _(),e}),l.linearRampToValueAtTime=(g=l.linearRampToValueAtTime,p?()=>{throw i()}:(...t)=>{const e=g.apply(l,t);return _(),e}),l.setTargetAtTime=(y=l.setTargetAtTime,p?()=>{throw i()}:(...t)=>{const e=y.apply(l,t);return _(),e}),l.setValueAtTime=(v=l.setValueAtTime,p?()=>{throw i()}:(...t)=>{const e=v.apply(l,t);return _(),e}),l.setValueCurveAtTime=(b=l.setValueCurveAtTime,p?()=>{throw i()}:(...t)=>{const e=b.apply(l,t);return _(),e}),l};return{forwardX:b(0,0,y(0)),forwardY:b(1,0,y(1)),forwardZ:b(2,-1,y(2)),positionX:b(6,0,v(0)),positionY:b(7,0,v(1)),positionZ:b(8,0,v(2)),upX:b(3,0,y(3)),upY:b(4,1,y(4)),upZ:b(5,0,y(5))}})():l;return{get forwardX(){return h},get forwardY(){return d},get forwardZ(){return p},get positionX(){return f},get positionY(){return m},get positionZ(){return g},get upX(){return _},get upY(){return y},get upZ(){return v}}})(mc,kc,Mc,hu,du,bu,zu,xu),Xc=new WeakMap,Kc=((t,e,n,r,i,o)=>class extends n{constructor(n,o){super(n),this._nativeContext=n,Ss.set(this,n),r(n)&&i.set(n,new Set),this._destination=new t(this,o),this._listener=e(this,n),this._onstatechange=null}get currentTime(){return this._nativeContext.currentTime}get destination(){return this._destination}get listener(){return this._listener}get onstatechange(){return this._onstatechange}set onstatechange(t){const e="function"==typeof t?o(this,t):null;this._nativeContext.onstatechange=e;const n=this._nativeContext.onstatechange;this._onstatechange=null!==n&&n===e?t:n}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}})(yc,Hc,Ju,zu,Xc,Ou),Qc=((t,e,n,r,i,o)=>(s,a)=>{const u=s.createOscillator();return Ka(u,a),Za(u,a,"detune"),Za(u,a,"frequency"),void 0!==a.periodicWave?u.setPeriodicWave(a.periodicWave):Xa(u,a,"type"),e(n,()=>n(s))||Ya(u),e(r,()=>r(s))||o(u,s),e(i,()=>i(s))||tu(u),t(s,u),u})(cc,Ru,ku,Su,Au,Eu),Zc=((t,e,n,r,i)=>()=>{const o=new WeakMap;let s=null,a=null,u=null;return{set periodicWave(t){s=t},set start(t){a=t},set stop(t){u=t},render(c,l){const h=o.get(l);return void 0!==h?Promise.resolve(h):(async(c,l)=>{let h=n(c);const d=Gs(h,l);if(!d){const t={channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,detune:h.detune.value,frequency:h.frequency.value,periodicWave:null===s?void 0:s,type:h.type};h=e(l,t),null!==a&&h.start(a),null!==u&&h.stop(u)}return o.set(l,h),d?(await t(l,c.detune,h.detune),await t(l,c.frequency,h.frequency)):(await r(l,c.detune,h.detune),await r(l,c.frequency,h.frequency)),await i(c,l,h),h})(c,l)}}})(hc,Qc,ma,pc,Bu),Yc=((t,e,n,r,i,o,s)=>class extends t{constructor(t,s){const a=i(t),u={...fu,...s},c=n(a,u),l=o(a),h=l?r():null,d=t.sampleRate/2;super(t,!1,c,h),this._detune=e(this,l,c.detune,153600,-153600),this._frequency=e(this,l,c.frequency,d,-d),this._nativeOscillatorNode=c,this._onended=null,this._oscillatorNodeRenderer=h,null!==this._oscillatorNodeRenderer&&void 0!==u.periodicWave&&(this._oscillatorNodeRenderer.periodicWave=u.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(t){const e="function"==typeof t?s(this,t):null;this._nativeOscillatorNode.onended=e;const n=this._nativeOscillatorNode.onended;this._onended=null!==n&&n===e?t:n}get type(){return this._nativeOscillatorNode.type}set type(t){this._nativeOscillatorNode.type=t,null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(t){this._nativeOscillatorNode.setPeriodicWave(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=t)}start(t=0){if(this._nativeOscillatorNode.start(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.start=t),"closed"!==this.context.state){$s(this);const t=()=>{this._nativeOscillatorNode.removeEventListener("ended",t),Qs(this)&&qs(this)};this._nativeOscillatorNode.addEventListener("ended",t)}}stop(t=0){this._nativeOscillatorNode.stop(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.stop=t)}})(Yu,mc,Qc,Zc,Uu,zu,Ou),tl=(t=>(e,n)=>{const r=t(e,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),i=e.createBuffer(1,2,44100);return r.buffer=i,r.loop=!0,r.connect(n),r.start(),()=>{r.stop(),r.disconnect(n)}})(dc),el=((t,e,n,r,i)=>(o,{curve:s,oversample:a,...u})=>{const c=o.createWaveShaper(),l=o.createWaveShaper();Ka(c,u),Ka(l,u);const h=n(o,{...u,gain:1}),d=n(o,{...u,gain:-1}),p=n(o,{...u,gain:1}),f=n(o,{...u,gain:-1});let m=null,g=!1,_=null;const y={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(t){h.channelCount=t,d.channelCount=t,c.channelCount=t,p.channelCount=t,l.channelCount=t,f.channelCount=t},get channelCountMode(){return c.channelCountMode},set channelCountMode(t){h.channelCountMode=t,d.channelCountMode=t,c.channelCountMode=t,p.channelCountMode=t,l.channelCountMode=t,f.channelCountMode=t},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(t){h.channelInterpretation=t,d.channelInterpretation=t,c.channelInterpretation=t,p.channelInterpretation=t,l.channelInterpretation=t,f.channelInterpretation=t},get context(){return c.context},get curve(){return _},set curve(n){if(null!==n&&n.length<2)throw e();if(null===n)c.curve=n,l.curve=n;else{const t=n.length,e=new Float32Array(t+2-t%2),r=new Float32Array(t+2-t%2);e[0]=n[0],r[0]=-n[t-1];const i=Math.ceil((t+1)/2),o=(t+1)/2-1;for(let s=1;s<i;s+=1){const a=s/i*o,u=Math.floor(a),c=Math.ceil(a);e[s]=u===c?n[u]:(1-(a-u))*n[u]+(1-(c-a))*n[c],r[s]=u===c?-n[t-1-u]:-(1-(a-u))*n[t-1-u]-(1-(c-a))*n[t-1-c]}e[i]=t%2==1?n[i-1]:(n[i-2]+n[i-1])/2,c.curve=e,l.curve=r}_=n,g&&(r(_)&&null===m?m=t(o,h):null!==m&&(m(),m=null))},get inputs(){return[h]},get numberOfInputs(){return c.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get oversample(){return c.oversample},set oversample(t){c.oversample=t,l.oversample=t},addEventListener:(...t)=>h.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>h.dispatchEvent(t[0]),removeEventListener:(...t)=>h.removeEventListener(t[0],t[1],t[2])};null!==s&&(y.curve=s instanceof Float32Array?s:new Float32Array(s)),a!==y.oversample&&(y.oversample=a);return i(ou(y,p),()=>{h.connect(c).connect(p),h.connect(d).connect(l).connect(f).connect(p),g=!0,r(_)&&(m=t(o,h))},()=>{h.disconnect(c),c.disconnect(p),h.disconnect(d),d.disconnect(l),l.disconnect(f),f.disconnect(p),g=!1,null!==m&&(m(),m=null)})})(tl,Ua,au,wu,xc),nl=((t,e,n,r,i,o,s)=>(a,u)=>{const c=a.createWaveShaper();if(null!==o&&"webkitAudioContext"===o.name&&void 0===a.createGain().gain.automationRate)return n(a,u);Ka(c,u);const l=null===u.curve||u.curve instanceof Float32Array?u.curve:new Float32Array(u.curve);if(null!==l&&l.length<2)throw e();Xa(c,{curve:l},"curve"),Xa(c,u,"oversample");let h=null,d=!1;s(c,"curve",t=>()=>t.call(c),e=>n=>(e.call(c,n),d&&(r(n)&&null===h?h=t(a,c):r(n)||null===h||(h(),h=null)),n));return i(c,()=>{d=!0,r(c.curve)&&(h=t(a,c))},()=>{d=!1,null!==h&&(h(),h=null)})})(tl,Ua,el,wu,xc,Hu,xu),rl=((t,e,n,r,i,o,s,a,u,c)=>(l,{coneInnerAngle:h,coneOuterAngle:d,coneOuterGain:p,distanceModel:f,maxDistance:m,orientationX:g,orientationY:_,orientationZ:y,panningModel:v,positionX:b,positionY:w,positionZ:x,refDistance:T,rolloffFactor:k,...S})=>{const A=l.createPanner();if(S.channelCount>2)throw s();if("max"===S.channelCountMode)throw s();Ka(A,S);const E={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},O=n(l,{...E,channelInterpretation:"speakers",numberOfInputs:6}),C=r(l,{...S,gain:1}),M=r(l,{...E,gain:1}),N=r(l,{...E,gain:0}),I=r(l,{...E,gain:0}),j=r(l,{...E,gain:0}),R=r(l,{...E,gain:0}),P=r(l,{...E,gain:0}),D=i(l,256,6,1),L=o(l,{...E,curve:new Float32Array([1,1]),oversample:"none"});let F=[g,_,y],$=[b,w,x];const B=new Float32Array(1);D.onaudioprocess=({inputBuffer:t})=>{const e=[u(t,B,0),u(t,B,1),u(t,B,2)];e.some((t,e)=>t!==F[e])&&(A.setOrientation(...e),F=e);const n=[u(t,B,3),u(t,B,4),u(t,B,5)];n.some((t,e)=>t!==$[e])&&(A.setPosition(...n),$=n)},Object.defineProperty(N.gain,"defaultValue",{get:()=>0}),Object.defineProperty(I.gain,"defaultValue",{get:()=>0}),Object.defineProperty(j.gain,"defaultValue",{get:()=>0}),Object.defineProperty(R.gain,"defaultValue",{get:()=>0}),Object.defineProperty(P.gain,"defaultValue",{get:()=>0});const q={get bufferSize(){},get channelCount(){return A.channelCount},set channelCount(t){if(t>2)throw s();C.channelCount=t,A.channelCount=t},get channelCountMode(){return A.channelCountMode},set channelCountMode(t){if("max"===t)throw s();C.channelCountMode=t,A.channelCountMode=t},get channelInterpretation(){return A.channelInterpretation},set channelInterpretation(t){C.channelInterpretation=t,A.channelInterpretation=t},get coneInnerAngle(){return A.coneInnerAngle},set coneInnerAngle(t){A.coneInnerAngle=t},get coneOuterAngle(){return A.coneOuterAngle},set coneOuterAngle(t){A.coneOuterAngle=t},get coneOuterGain(){return A.coneOuterGain},set coneOuterGain(t){if(t<0||t>1)throw e();A.coneOuterGain=t},get context(){return A.context},get distanceModel(){return A.distanceModel},set distanceModel(t){A.distanceModel=t},get inputs(){return[C]},get maxDistance(){return A.maxDistance},set maxDistance(t){if(t<0)throw new RangeError;A.maxDistance=t},get numberOfInputs(){return A.numberOfInputs},get numberOfOutputs(){return A.numberOfOutputs},get orientationX(){return M.gain},get orientationY(){return N.gain},get orientationZ(){return I.gain},get panningModel(){return A.panningModel},set panningModel(t){A.panningModel=t},get positionX(){return j.gain},get positionY(){return R.gain},get positionZ(){return P.gain},get refDistance(){return A.refDistance},set refDistance(t){if(t<0)throw new RangeError;A.refDistance=t},get rolloffFactor(){return A.rolloffFactor},set rolloffFactor(t){if(t<0)throw new RangeError;A.rolloffFactor=t},addEventListener:(...t)=>C.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>C.dispatchEvent(t[0]),removeEventListener:(...t)=>C.removeEventListener(t[0],t[1],t[2])};h!==q.coneInnerAngle&&(q.coneInnerAngle=h),d!==q.coneOuterAngle&&(q.coneOuterAngle=d),p!==q.coneOuterGain&&(q.coneOuterGain=p),f!==q.distanceModel&&(q.distanceModel=f),m!==q.maxDistance&&(q.maxDistance=m),g!==q.orientationX.value&&(q.orientationX.value=g),_!==q.orientationY.value&&(q.orientationY.value=_),y!==q.orientationZ.value&&(q.orientationZ.value=y),v!==q.panningModel&&(q.panningModel=v),b!==q.positionX.value&&(q.positionX.value=b),w!==q.positionY.value&&(q.positionY.value=w),x!==q.positionZ.value&&(q.positionZ.value=x),T!==q.refDistance&&(q.refDistance=T),k!==q.rolloffFactor&&(q.rolloffFactor=k),1===F[0]&&0===F[1]&&0===F[2]||A.setOrientation(...F),0===$[0]&&0===$[1]&&0===$[2]||A.setPosition(...$);return c(ou(q,A),()=>{C.connect(A),t(C,L,0,0),L.connect(M).connect(O,0,0),L.connect(N).connect(O,0,1),L.connect(I).connect(O,0,2),L.connect(j).connect(O,0,3),L.connect(R).connect(O,0,4),L.connect(P).connect(O,0,5),O.connect(D).connect(l.destination)},()=>{C.disconnect(A),a(C,L,0,0),L.disconnect(M),M.disconnect(O),L.disconnect(N),N.disconnect(O),L.disconnect(I),I.disconnect(O),L.disconnect(j),j.disconnect(O),L.disconnect(R),R.disconnect(O),L.disconnect(P),P.disconnect(O),O.disconnect(D),D.disconnect(l.destination)})})(la,Ua,kc,au,hu,nl,du,fa,bu,xc),il=(t=>(e,n)=>{const r=e.createPanner();return void 0===r.orientationX?t(e,n):(Ka(r,n),Za(r,n,"orientationX"),Za(r,n,"orientationY"),Za(r,n,"orientationZ"),Za(r,n,"positionX"),Za(r,n,"positionY"),Za(r,n,"positionZ"),Xa(r,n,"coneInnerAngle"),Xa(r,n,"coneOuterAngle"),Xa(r,n,"coneOuterGain"),Xa(r,n,"distanceModel"),Xa(r,n,"maxDistance"),Xa(r,n,"panningModel"),Xa(r,n,"refDistance"),Xa(r,n,"rolloffFactor"),r)})(rl),ol=((t,e,n,r,i,o,s,a,u,c)=>()=>{const l=new WeakMap;let h=null;return{render(d,p){const f=l.get(p);return void 0!==f?Promise.resolve(f):(async(d,p)=>{let f=null,m=o(d);const g={channelCount:m.channelCount,channelCountMode:m.channelCountMode,channelInterpretation:m.channelInterpretation},_={...g,coneInnerAngle:m.coneInnerAngle,coneOuterAngle:m.coneOuterAngle,coneOuterGain:m.coneOuterGain,distanceModel:m.distanceModel,maxDistance:m.maxDistance,panningModel:m.panningModel,refDistance:m.refDistance,rolloffFactor:m.rolloffFactor},y=Gs(m,p);if("bufferSize"in m)f=r(p,{...g,gain:1});else if(!y){const t={..._,orientationX:m.orientationX.value,orientationY:m.orientationY.value,orientationZ:m.orientationZ.value,positionX:m.positionX.value,positionY:m.positionY.value,positionZ:m.positionZ.value};m=i(p,t)}if(l.set(p,null===f?m:f),null!==f){if(null===h){if(null===s)throw new Error("Missing the native OfflineAudioContext constructor.");const t=new s(6,d.context.length,p.sampleRate),r=e(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6});r.connect(t.destination),h=(async()=>{const e=await Promise.all([d.orientationX,d.orientationY,d.orientationZ,d.positionX,d.positionY,d.positionZ].map(async(e,r)=>{const i=n(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:0===r?1:0});return await a(t,e,i.offset),i}));for(let t=0;t<6;t+=1)e[t].connect(r,0,t),e[t].start(0);return c(t)})()}const t=await h,o=r(p,{...g,gain:1});await u(d,p,o);const l=[];for(let e=0;e<t.numberOfChannels;e+=1)l.push(t.getChannelData(e));let m=[l[0][0],l[1][0],l[2][0]],y=[l[3][0],l[4][0],l[5][0]],v=r(p,{...g,gain:1}),b=i(p,{..._,orientationX:m[0],orientationY:m[1],orientationZ:m[2],positionX:y[0],positionY:y[1],positionZ:y[2]});o.connect(v).connect(b.inputs[0]),b.connect(f);for(let e=128;e<t.length;e+=128){const t=[l[0][e],l[1][e],l[2][e]],n=[l[3][e],l[4][e],l[5][e]];if(t.some((t,e)=>t!==m[e])||n.some((t,e)=>t!==y[e])){m=t,y=n;const s=e/p.sampleRate;v.gain.setValueAtTime(0,s),v=r(p,{...g,gain:0}),b=i(p,{..._,orientationX:m[0],orientationY:m[1],orientationZ:m[2],positionX:y[0],positionY:y[1],positionZ:y[2]}),v.gain.setValueAtTime(1,s),o.connect(v).connect(b.inputs[0]),b.connect(f)}}return f}return y?(await t(p,d.orientationX,m.orientationX),await t(p,d.orientationY,m.orientationY),await t(p,d.orientationZ,m.orientationZ),await t(p,d.positionX,m.positionX),await t(p,d.positionY,m.positionY),await t(p,d.positionZ,m.positionZ)):(await a(p,d.orientationX,m.orientationX),await a(p,d.orientationY,m.orientationY),await a(p,d.orientationZ,m.orientationZ),await a(p,d.positionX,m.positionX),await a(p,d.positionY,m.positionY),await a(p,d.positionZ,m.positionZ)),ca(m)?await u(d,p,m.inputs[0]):await u(d,p,m),m})(d,p)}}})(hc,kc,Mc,au,il,ma,Gu,pc,Bu,Gc),sl=((t,e,n,r,i,o,s)=>class extends t{constructor(t,a){const u=i(t),c={...mu,...a},l=n(u,c),h=o(u);super(t,!1,l,h?r():null),this._nativePannerNode=l,this._orientationX=e(this,h,l.orientationX,Ks,Xs),this._orientationY=e(this,h,l.orientationY,Ks,Xs),this._orientationZ=e(this,h,l.orientationZ,Ks,Xs),this._positionX=e(this,h,l.positionX,Ks,Xs),this._positionY=e(this,h,l.positionY,Ks,Xs),this._positionZ=e(this,h,l.positionZ,Ks,Xs),s(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(t){this._nativePannerNode.coneInnerAngle=t}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(t){this._nativePannerNode.coneOuterAngle=t}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(t){this._nativePannerNode.coneOuterGain=t}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(t){this._nativePannerNode.distanceModel=t}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(t){this._nativePannerNode.maxDistance=t}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(t){this._nativePannerNode.panningModel=t}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(t){this._nativePannerNode.refDistance=t}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(t){this._nativePannerNode.rolloffFactor=t}})(Yu,mc,il,ol,Uu,zu,bc),al=(t=>(e,{disableNormalization:n,imag:r,real:i})=>{const o=r instanceof Float32Array?r:new Float32Array(r),s=i instanceof Float32Array?i:new Float32Array(i),a=e.createPeriodicWave(s,o,{disableNormalization:n});if(Array.from(r).length<2)throw t();return a})(Ws),ul=((t,e,n,r)=>class i{constructor(i,o){const s=e(i),a=r({...gu,...o}),u=t(s,a);return n.add(u),u}static[Symbol.hasInstance](t){return null!==t&&"object"==typeof t&&Object.getPrototypeOf(t)===i.prototype||n.has(t)}})(al,Uu,new WeakSet,t=>{const{imag:e,real:n}=t;return void 0===e?void 0===n?{...t,imag:[0,0],real:[0,0]}:{...t,imag:Array.from(n,()=>0),real:n}:void 0===n?{...t,imag:e,real:Array.from(e,()=>0)}:{...t,imag:e,real:n}}),cl=((t,e,n,r,i,o)=>{const s=16385,a=new Float32Array([1,1]),u=Math.PI/2,c={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},l={...c,oversample:"none"},h=(t,o,h,d,p)=>{if(1===o)return((t,e,i,o)=>{const h=new Float32Array(s),d=new Float32Array(s);for(let t=0;t<s;t+=1){const e=t/16384*u;h[t]=Math.cos(e),d[t]=Math.sin(e)}const p=n(t,{...c,gain:0}),f=r(t,{...l,curve:h}),m=r(t,{...l,curve:a}),g=n(t,{...c,gain:0}),_=r(t,{...l,curve:d});return{connectGraph(){e.connect(p),e.connect(void 0===m.inputs?m:m.inputs[0]),e.connect(g),m.connect(i),i.connect(void 0===f.inputs?f:f.inputs[0]),i.connect(void 0===_.inputs?_:_.inputs[0]),f.connect(p.gain),_.connect(g.gain),p.connect(o,0,0),g.connect(o,0,1)},disconnectGraph(){e.disconnect(p),e.disconnect(void 0===m.inputs?m:m.inputs[0]),e.disconnect(g),m.disconnect(i),i.disconnect(void 0===f.inputs?f:f.inputs[0]),i.disconnect(void 0===_.inputs?_:_.inputs[0]),f.disconnect(p.gain),_.disconnect(g.gain),p.disconnect(o,0,0),g.disconnect(o,0,1)}}})(t,h,d,p);if(2===o)return((t,i,o,h)=>{const d=new Float32Array(s),p=new Float32Array(s),f=new Float32Array(s),m=new Float32Array(s),g=Math.floor(8192.5);for(let t=0;t<s;t+=1)if(t>g){const e=(t-g)/(16384-g)*u;d[t]=Math.cos(e),p[t]=Math.sin(e),f[t]=0,m[t]=1}else{const e=t/(16384-g)*u;d[t]=1,p[t]=0,f[t]=Math.cos(e),m[t]=Math.sin(e)}const _=e(t,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),y=n(t,{...c,gain:0}),v=r(t,{...l,curve:d}),b=n(t,{...c,gain:0}),w=r(t,{...l,curve:p}),x=r(t,{...l,curve:a}),T=n(t,{...c,gain:0}),k=r(t,{...l,curve:f}),S=n(t,{...c,gain:0}),A=r(t,{...l,curve:m});return{connectGraph(){i.connect(_),i.connect(void 0===x.inputs?x:x.inputs[0]),_.connect(y,0),_.connect(b,0),_.connect(T,1),_.connect(S,1),x.connect(o),o.connect(void 0===v.inputs?v:v.inputs[0]),o.connect(void 0===w.inputs?w:w.inputs[0]),o.connect(void 0===k.inputs?k:k.inputs[0]),o.connect(void 0===A.inputs?A:A.inputs[0]),v.connect(y.gain),w.connect(b.gain),k.connect(T.gain),A.connect(S.gain),y.connect(h,0,0),T.connect(h,0,0),b.connect(h,0,1),S.connect(h,0,1)},disconnectGraph(){i.disconnect(_),i.disconnect(void 0===x.inputs?x:x.inputs[0]),_.disconnect(y,0),_.disconnect(b,0),_.disconnect(T,1),_.disconnect(S,1),x.disconnect(o),o.disconnect(void 0===v.inputs?v:v.inputs[0]),o.disconnect(void 0===w.inputs?w:w.inputs[0]),o.disconnect(void 0===k.inputs?k:k.inputs[0]),o.disconnect(void 0===A.inputs?A:A.inputs[0]),v.disconnect(y.gain),w.disconnect(b.gain),k.disconnect(T.gain),A.disconnect(S.gain),y.disconnect(h,0,0),T.disconnect(h,0,0),b.disconnect(h,0,1),S.disconnect(h,0,1)}}})(t,h,d,p);throw i()};return(e,{channelCount:r,channelCountMode:s,pan:a,...u})=>{if("max"===s)throw i();const c=t(e,{...u,channelCount:1,channelCountMode:s,numberOfInputs:2}),l=n(e,{...u,channelCount:r,channelCountMode:s,gain:1}),d=n(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:a});let{connectGraph:p,disconnectGraph:f}=h(e,r,l,d,c);Object.defineProperty(d.gain,"defaultValue",{get:()=>0}),Object.defineProperty(d.gain,"maxValue",{get:()=>1}),Object.defineProperty(d.gain,"minValue",{get:()=>-1});const m={get bufferSize(){},get channelCount(){return l.channelCount},set channelCount(t){l.channelCount!==t&&(g&&f(),({connectGraph:p,disconnectGraph:f}=h(e,t,l,d,c)),g&&p()),l.channelCount=t},get channelCountMode(){return l.channelCountMode},set channelCountMode(t){if("clamped-max"===t||"max"===t)throw i();l.channelCountMode=t},get channelInterpretation(){return l.channelInterpretation},set channelInterpretation(t){l.channelInterpretation=t},get context(){return l.context},get inputs(){return[l]},get numberOfInputs(){return l.numberOfInputs},get numberOfOutputs(){return l.numberOfOutputs},get pan(){return d.gain},addEventListener:(...t)=>l.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>l.dispatchEvent(t[0]),removeEventListener:(...t)=>l.removeEventListener(t[0],t[1],t[2])};let g=!1;return o(ou(m,c),()=>{p(),g=!0},()=>{f(),g=!1})}})(kc,iu,au,nl,du,xc),ll=((t,e)=>(n,r)=>{const i=r.channelCountMode;if("clamped-max"===i)throw e();if(void 0===n.createStereoPanner)return t(n,r);const o=n.createStereoPanner();return Ka(o,r),Za(o,r,"pan"),Object.defineProperty(o,"channelCountMode",{get:()=>i,set:t=>{if(t!==i)throw e()}}),o})(cl,du),hl=((t,e,n,r,i)=>()=>{const o=new WeakMap;return{render(s,a){const u=o.get(a);return void 0!==u?Promise.resolve(u):(async(s,a)=>{let u=n(s);const c=Gs(u,a);if(!c){const t={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,pan:u.pan.value};u=e(a,t)}return o.set(a,u),c?await t(a,s.pan,u.pan):await r(a,s.pan,u.pan),ca(u)?await i(s,a,u.inputs[0]):await i(s,a,u),u})(s,a)}}})(hc,ll,ma,pc,Bu),dl=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=i(t),u={..._u,...s},c=n(a,u),l=o(a);super(t,!1,c,l?r():null),this._pan=e(this,l,c.pan)}get pan(){return this._pan}})(Yu,mc,ll,hl,Uu,zu),pl=((t,e,n)=>()=>{const r=new WeakMap;return{render(i,o){const s=r.get(o);return void 0!==s?Promise.resolve(s):(async(i,o)=>{let s=e(i);if(!Gs(s,o)){const e={channelCount:s.channelCount,channelCountMode:s.channelCountMode,channelInterpretation:s.channelInterpretation,curve:s.curve,oversample:s.oversample};s=t(o,e)}return r.set(o,s),ca(s)?await n(i,o,s.inputs[0]):await n(i,o,s),s})(i,o)}}})(nl,ma,Bu),fl=((t,e,n,r,i,o,s)=>class extends t{constructor(t,e){const a=i(t),u={...vu,...e},c=n(a,u);super(t,!0,c,o(a)?r():null),this._isCurveNullified=!1,this._nativeWaveShaperNode=c,s(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(t){if(null===t)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(t.length<2)throw e();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=t}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(t){this._nativeWaveShaperNode.oversample=t}})(Yu,Ua,nl,pl,Uu,zu,bc),ml=(t=>null!==t&&t.isSecureContext)(Lu),gl=(t=>(e,n,r)=>{Object.defineProperties(t,{currentFrame:{configurable:!0,get:()=>Math.round(e*n)},currentTime:{configurable:!0,get:()=>e}});try{return r()}finally{null!==t&&(delete t.currentFrame,delete t.currentTime)}})(Lu),_l=new WeakMap,yl=((t,e)=>n=>{let r=t.get(n);if(void 0!==r)return r;if(null===e)throw new Error("Missing the native OfflineAudioContext constructor.");return r=new e(1,1,44100),t.set(n,r),r})(_l,Gu),vl=ml?((t,e,n,r,i,o,s,a,u,c,l,h,d)=>{let p=0;return(f,m,g={credentials:"omit"})=>{const _=l.get(f);if(void 0!==_&&_.has(m))return Promise.resolve();const y=c.get(f);if(void 0!==y){const t=y.get(m);if(void 0!==t)return t}const v=o(f),b=void 0===v.audioWorklet?i(m).then(([t,e])=>{const[r,i]=Is(t,e);return n(`${r};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${i}\n})})(window,'_AWGS')`)}).then(()=>{const t=d._AWGS.pop();if(void 0===t)throw new SyntaxError;r(v.currentTime,v.sampleRate,()=>t(class{},void 0,(t,n)=>{if(""===t.trim())throw e();const r=Os.get(v);if(void 0!==r){if(r.has(t))throw e();Rs(n),js(n.parameterDescriptors),r.set(t,n)}else Rs(n),js(n.parameterDescriptors),Os.set(v,new Map([[t,n]]))},v.sampleRate,void 0,void 0))}):Promise.all([i(m),Promise.resolve(t(h,h))]).then(([[t,e],n])=>{const r=p+1;p=r;const[i,o]=Is(t,e),c=new Blob([`${i};((AudioWorkletProcessor,registerProcessor)=>{${o}\n})(${n?"AudioWorkletProcessor":"class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}"},(n,p)=>registerProcessor(n,class extends p{${n?"":"__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${n?"":"i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));"}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${r}',class extends AudioWorkletProcessor{process(){return !1}})`],{type:"application/javascript; charset=utf-8"}),l=URL.createObjectURL(c);return v.audioWorklet.addModule(l,g).then(()=>{if(a(v))return v;const t=s(v);return t.audioWorklet.addModule(l,g).then(()=>t)}).then(t=>{if(null===u)throw new SyntaxError;try{new u(t,`__sac${r}`)}catch{throw new SyntaxError}}).finally(()=>URL.revokeObjectURL(l))});return void 0===y?c.set(f,new Map([[m,b]])):y.set(m,b),b.then(()=>{const t=l.get(f);void 0===t?l.set(f,new Set([m])):t.add(m)}).finally(()=>{const t=c.get(f);void 0!==t&&t.delete(m)}),b}})(Ru,du,(t=>e=>new Promise((n,r)=>{if(null===t)return void r(new SyntaxError);const i=t.document.head;if(null===i)r(new SyntaxError);else{const o=t.document.createElement("script"),s=new Blob([e],{type:"application/javascript"}),a=URL.createObjectURL(s),u=t.onerror,c=()=>{t.onerror=u,URL.revokeObjectURL(a)};t.onerror=(e,n,i,o,s)=>n===a||n===t.location.href&&1===i&&1===o?(c(),r(s),!1):null!==u?u(e,n,i,o,s):void 0,o.onerror=()=>{c(),r(new SyntaxError)},o.onload=()=>{c(),n()},o.src=a,o.type="module",i.appendChild(o)}}))(Lu),gl,(t=>async e=>{try{const t=await fetch(e);if(t.ok)return[await t.text(),t.url]}catch{}throw t()})(()=>new DOMException("","AbortError")),Uu,yl,zu,Zu,new WeakMap,new WeakMap,((t,e)=>async()=>{if(null===t)return!0;if(null===e)return!1;const n=new Blob(['class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor("a",A)'],{type:"application/javascript; charset=utf-8"}),r=new e(1,128,44100),i=URL.createObjectURL(n);let o=!1,s=!1;try{await r.audioWorklet.addModule(i);const e=new t(r,"a",{numberOfOutputs:0}),n=r.createOscillator();e.port.onmessage=()=>o=!0,e.onprocessorerror=()=>s=!0,n.connect(e),n.start(0),await r.startRendering(),await new Promise(t=>setTimeout(t))}catch{}finally{URL.revokeObjectURL(i)}return o&&!s})(Zu,Gu),Lu):void 0,bl=((t,e)=>n=>t(n)||e(n))(Xu,zu),wl=((t,e,n,r,i,o,s,a,u,c,l)=>(h,d)=>{const p=s(h)?h:o(h);if(i.has(d)){const t=n();return Promise.reject(t)}try{i.add(d)}catch{}return e(u,()=>u(p))?p.decodeAudioData(d).then(n=>(La(d).catch(()=>{}),e(a,()=>a(n))||l(n),t.add(n),n)):new Promise((e,n)=>{const i=async()=>{try{await La(d)}catch{}},o=t=>{n(t),i()};try{p.decodeAudioData(d,n=>{"function"!=typeof n.copyFromChannel&&(c(n),Js(n)),t.add(n),i().then(()=>e(n))},t=>{o(null===t?r():t)})}catch(t){o(t)}})})(nc,Ru,()=>new DOMException("","DataCloneError"),()=>new DOMException("","EncodingError"),new WeakSet,Uu,bl,zs,Ja,sc,ac),xl=((t,e,n,r,i,o,s,a,u,c,l,h,d,p,f,m,g,_,y,v)=>class extends f{constructor(e,n){super(e,n),this._nativeContext=e,this._audioWorklet=void 0===t?void 0:{addModule:(e,n)=>t(this,e,n)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new e(this)}createBiquadFilter(){return new i(this)}createBuffer(t,e,r){return new n({length:e,numberOfChannels:t,sampleRate:r})}createBufferSource(){return new r(this)}createChannelMerger(t=6){return new o(this,{numberOfInputs:t})}createChannelSplitter(t=6){return new s(this,{numberOfOutputs:t})}createConstantSource(){return new a(this)}createConvolver(){return new u(this)}createDelay(t=1){return new l(this,{maxDelayTime:t})}createDynamicsCompressor(){return new h(this)}createGain(){return new d(this)}createIIRFilter(t,e){return new p(this,{feedback:e,feedforward:t})}createOscillator(){return new m(this)}createPanner(){return new g(this)}createPeriodicWave(t,e,n={disableNormalization:!1}){return new _(this,{...n,imag:e,real:t})}createStereoPanner(){return new y(this)}createWaveShaper(){return new v(this)}decodeAudioData(t,e,n){return c(this._nativeContext,t).then(t=>("function"==typeof e&&e(t),t),t=>{throw"function"==typeof n&&n(t),t})}})(vl,ec,uc,_c,wc,Ac,Oc,Ic,Pc,wl,Lc,Bc,Uc,Jc,Kc,Yc,sl,ul,dl,fl),Tl=((t,e,n,r)=>class extends t{constructor(t,i){const o=n(t),s=e(o,i);if(r(o))throw TypeError();super(t,!0,s,null),this._nativeMediaElementAudioSourceNode=s}get mediaElement(){return this._nativeMediaElementAudioSourceNode.mediaElement}})(Yu,(t,e)=>t.createMediaElementSource(e.mediaElement),Uu,zu),kl=((t,e,n,r)=>class extends t{constructor(t,i){const o=n(t);if(r(o))throw new TypeError;const s={...Wa,...i},a=e(o,s);super(t,!1,a,null),this._nativeMediaStreamAudioDestinationNode=a}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}})(Yu,(t,e)=>{const n=t.createMediaStreamDestination();return Ka(n,e),1===n.numberOfOutputs&&Object.defineProperty(n,"numberOfOutputs",{get:()=>0}),n},Uu,zu),Sl=((t,e,n,r)=>class extends t{constructor(t,i){const o=n(t),s=e(o,i);if(r(o))throw new TypeError;super(t,!0,s,null),this._nativeMediaStreamAudioSourceNode=s}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}})(Yu,(t,{mediaStream:e})=>{const n=e.getAudioTracks();n.sort((t,e)=>t.id<e.id?-1:t.id>e.id?1:0);const r=n.slice(0,1),i=t.createMediaStreamSource(new MediaStream(r));return Object.defineProperty(i,"mediaStream",{value:e}),i},Uu,zu),Al=((t,e)=>(n,{mediaStreamTrack:r})=>{if("function"==typeof n.createMediaStreamTrackSource)return n.createMediaStreamTrackSource(r);const i=new MediaStream([r]),o=n.createMediaStreamSource(i);if("audio"!==r.kind)throw t();if(e(n))throw new TypeError;return o})(Ua,zu),El=((t,e,n)=>class extends t{constructor(t,r){const i=n(t);super(t,!0,e(i,r),null)}})(Yu,Al,Uu),Ol=((t,e,n,r,i,o,s,a,u)=>class extends t{constructor(t={}){if(null===u)throw new Error("Missing the native AudioContext constructor.");let e;try{e=new u(t)}catch(t){if(12===t.code&&"sampleRate is not in range"===t.message)throw n();throw t}if(null===e)throw r();if(!ra(t.latencyHint))throw new TypeError(`The provided value '${t.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(void 0!==t.sampleRate&&e.sampleRate!==t.sampleRate)throw n();super(e,2);const{latencyHint:i}=t,{sampleRate:o}=e;if(this._baseLatency="number"==typeof e.baseLatency?e.baseLatency:"balanced"===i?512/o:"interactive"===i||void 0===i?256/o:"playback"===i?1024/o:128*Math.max(2,Math.min(128,Math.round(i*o/128)))/o,this._nativeAudioContext=e,"webkitAudioContext"===u.name?(this._nativeGainNode=e.createGain(),this._nativeOscillatorNode=e.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(e.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,"running"===e.state){this._state="suspended";const t=()=>{"suspended"===this._state&&(this._state=null),e.removeEventListener("statechange",t)};e.addEventListener("statechange",t)}}get baseLatency(){return this._baseLatency}get state(){return null!==this._state?this._state:this._nativeAudioContext.state}close(){return"closed"===this.state?this._nativeAudioContext.close().then(()=>{throw e()}):("suspended"===this._state&&(this._state=null),this._nativeAudioContext.close().then(()=>{null!==this._nativeGainNode&&null!==this._nativeOscillatorNode&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),na(this)}))}createMediaElementSource(t){return new i(this,{mediaElement:t})}createMediaStreamDestination(){return new o(this)}createMediaStreamSource(t){return new s(this,{mediaStream:t})}createMediaStreamTrackSource(t){return new a(this,{mediaStreamTrack:t})}resume(){return"suspended"===this._state?new Promise((t,e)=>{const n=()=>{this._nativeAudioContext.removeEventListener("statechange",n),"running"===this._nativeAudioContext.state?t():this.resume().then(t,e)};this._nativeAudioContext.addEventListener("statechange",n)}):this._nativeAudioContext.resume().catch(t=>{if(void 0===t||15===t.code)throw e();throw t})}suspend(){return this._nativeAudioContext.suspend().catch(t=>{if(void 0===t)throw e();throw t})}})(xl,Ua,du,yu,Tl,kl,Sl,El,Hu),Cl=(t=>e=>{const n=t.get(e);if(void 0===n)throw new Error("The context has no set of AudioWorkletNodes.");return n})(Xc),Ml=(t=>(e,n)=>{t(e).add(n)})(Cl),Nl=(t=>(e,n,r=0,i=0)=>{const o=e[r];if(void 0===o)throw t();return wa(n)?o.connect(n,0,i):o.connect(n,0)})(Ws),Il=(t=>(e,n)=>{t(e).delete(n)})(Cl),jl=(t=>(e,n=void 0,r=void 0,i=0)=>void 0===n?e.forEach(t=>t.disconnect()):"number"==typeof n?$a(t,e,n).disconnect():wa(n)?void 0===r?e.forEach(t=>t.disconnect(n)):void 0===i?$a(t,e,r).disconnect(n,0):$a(t,e,r).disconnect(n,0,i):void 0===r?e.forEach(t=>t.disconnect(n)):$a(t,e,r).disconnect(n,0))(Ws),Rl=new WeakMap,Pl=((t,e)=>n=>e(t,n))(Rl,Ps),Dl=((t,e,n,r,i,o,s,a,u,c,l,h,d)=>(p,f,m,g)=>{if(0===g.numberOfInputs&&0===g.numberOfOutputs)throw u();const _=Array.isArray(g.outputChannelCount)?g.outputChannelCount:Array.from(g.outputChannelCount);if(_.some(t=>t<1))throw u();if(_.length!==g.numberOfOutputs)throw e();if("explicit"!==g.channelCountMode)throw u();const y=g.channelCount*g.numberOfInputs,v=_.reduce((t,e)=>t+e,0),b=void 0===m.parameterDescriptors?0:m.parameterDescriptors.length;if(y+b>6||v>6)throw u();const w=new MessageChannel,x=[],T=[];for(let t=0;t<g.numberOfInputs;t+=1)x.push(s(p,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1})),T.push(i(p,{channelCount:g.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:g.channelCount}));const k=[];if(void 0!==m.parameterDescriptors)for(const{defaultValue:t,maxValue:e,minValue:n,name:r}of m.parameterDescriptors){const i=o(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:void 0!==g.parameterData[r]?g.parameterData[r]:void 0===t?0:t});Object.defineProperties(i.offset,{defaultValue:{get:()=>void 0===t?0:t},maxValue:{get:()=>void 0===e?Ks:e},minValue:{get:()=>void 0===n?Xs:n}}),k.push(i)}const S=r(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,y+b)}),A=eu(f,p.sampleRate),E=a(p,A,y+b,Math.max(1,v)),O=i(p,{channelCount:Math.max(1,v),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,v)}),C=[];for(let t=0;t<g.numberOfOutputs;t+=1)C.push(r(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:_[t]}));for(let t=0;t<g.numberOfInputs;t+=1){x[t].connect(T[t]);for(let e=0;e<g.channelCount;e+=1)T[t].connect(S,e,t*g.channelCount+e)}const M=new Aa(void 0===m.parameterDescriptors?[]:m.parameterDescriptors.map(({name:t},e)=>{const n=k[e];return n.connect(S,0,y+e),n.start(0),[t,n.offset]}));S.connect(E);let N=g.channelInterpretation,I=null;const j=0===g.numberOfOutputs?[E]:C,R={get bufferSize(){return A},get channelCount(){return g.channelCount},set channelCount(t){throw n()},get channelCountMode(){return g.channelCountMode},set channelCountMode(t){throw n()},get channelInterpretation(){return N},set channelInterpretation(t){for(const e of x)e.channelInterpretation=t;N=t},get context(){return E.context},get inputs(){return x},get numberOfInputs(){return g.numberOfInputs},get numberOfOutputs(){return g.numberOfOutputs},get onprocessorerror(){return I},set onprocessorerror(t){"function"==typeof I&&R.removeEventListener("processorerror",I),I="function"==typeof t?t:null,"function"==typeof I&&R.addEventListener("processorerror",I)},get parameters(){return M},get port(){return w.port2},addEventListener:(...t)=>E.addEventListener(t[0],t[1],t[2]),connect:t.bind(null,j),disconnect:c.bind(null,j),dispatchEvent:(...t)=>E.dispatchEvent(t[0]),removeEventListener:(...t)=>E.removeEventListener(t[0],t[1],t[2])},P=new Map;var D,L;w.port1.addEventListener=(D=w.port1.addEventListener,(...t)=>{if("message"===t[0]){const e="function"==typeof t[1]?t[1]:"object"==typeof t[1]&&null!==t[1]&&"function"==typeof t[1].handleEvent?t[1].handleEvent:null;if(null!==e){const n=P.get(t[1]);void 0!==n?t[1]=n:(t[1]=t=>{l(p.currentTime,p.sampleRate,()=>e(t))},P.set(e,t[1]))}}return D.call(w.port1,t[0],t[1],t[2])}),w.port1.removeEventListener=(L=w.port1.removeEventListener,(...t)=>{if("message"===t[0]){const e=P.get(t[1]);void 0!==e&&(P.delete(t[1]),t[1]=e)}return L.call(w.port1,t[0],t[1],t[2])});let F=null;Object.defineProperty(w.port1,"onmessage",{get:()=>F,set:t=>{"function"==typeof F&&w.port1.removeEventListener("message",F),F="function"==typeof t?t:null,"function"==typeof F&&(w.port1.addEventListener("message",F),w.port1.start())}}),m.prototype.port=w.port1;let $=null;const B=((t,e,n,r)=>{let i=Cs.get(t);void 0===i&&(i=new WeakMap,Cs.set(t,i));const o=nu(n,r);return i.set(e,o),o})(p,R,m,g);B.then(t=>$=t);const q=Ma(g.numberOfInputs,g.channelCount),U=Ma(g.numberOfOutputs,_),V=void 0===m.parameterDescriptors?[]:m.parameterDescriptors.reduce((t,{name:e})=>({...t,[e]:new Float32Array(128)}),{});let G=!0;const z=()=>{g.numberOfOutputs>0&&E.disconnect(O);for(let t=0,e=0;t<g.numberOfOutputs;t+=1){const n=C[t];for(let r=0;r<_[t];r+=1)O.disconnect(n,e+r,r);e+=_[t]}},W=new Map;E.onaudioprocess=({inputBuffer:t,outputBuffer:e})=>{if(null!==$){const n=h(R);for(let r=0;r<A;r+=128){for(let e=0;e<g.numberOfInputs;e+=1)for(let n=0;n<g.channelCount;n+=1)Oa(t,q[e],n,n,r);void 0!==m.parameterDescriptors&&m.parameterDescriptors.forEach(({name:e},n)=>{Oa(t,V,e,y+n,r)});for(let t=0;t<g.numberOfInputs;t+=1)for(let e=0;e<_[t];e+=1)0===U[t][e].byteLength&&(U[t][e]=new Float32Array(128));try{const t=q.map((t,e)=>{if(n[e].size>0)return W.set(e,A/128),t;const r=W.get(e);return void 0===r?[]:(t.every(t=>t.every(t=>0===t))&&(1===r?W.delete(e):W.set(e,r-1)),t)}),i=l(p.currentTime+r/p.sampleRate,p.sampleRate,()=>$.process(t,U,V));G=i;for(let t=0,n=0;t<g.numberOfOutputs;t+=1){for(let i=0;i<_[t];i+=1)Ca(e,U[t],i,n+i,r);n+=_[t]}}catch(t){G=!1,R.dispatchEvent(new ErrorEvent("processorerror",{colno:t.colno,filename:t.filename,lineno:t.lineno,message:t.message}))}if(!G){for(let t=0;t<g.numberOfInputs;t+=1){x[t].disconnect(T[t]);for(let e=0;e<g.channelCount;e+=1)T[r].disconnect(S,e,t*g.channelCount+e)}if(void 0!==m.parameterDescriptors){const t=m.parameterDescriptors.length;for(let e=0;e<t;e+=1){const t=k[e];t.disconnect(S,0,y+e),t.stop()}}S.disconnect(E),E.onaudioprocess=null,J?z():K();break}}}};let J=!1;const H=s(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0}),X=()=>E.connect(H).connect(p.destination),K=()=>{E.disconnect(H),H.disconnect()};return X(),d(R,()=>{if(G){K(),g.numberOfOutputs>0&&E.connect(O);for(let t=0,e=0;t<g.numberOfOutputs;t+=1){const n=C[t];for(let r=0;r<_[t];r+=1)O.connect(n,e+r,r);e+=_[t]}}J=!0},()=>{G&&(X(),z()),J=!1})})(Nl,Ws,Ua,kc,iu,Mc,au,hu,du,jl,gl,Pl,xc),Ll=((t,e,n,r,i)=>(o,s,a,u,c,l)=>{if(null!==a)try{const e=new a(o,u,l),r=new Map;let s=null;if(Object.defineProperties(e,{channelCount:{get:()=>l.channelCount,set:()=>{throw t()}},channelCountMode:{get:()=>"explicit",set:()=>{throw t()}},onprocessorerror:{get:()=>s,set:t=>{"function"==typeof s&&e.removeEventListener("processorerror",s),s="function"==typeof t?t:null,"function"==typeof s&&e.addEventListener("processorerror",s)}}}),e.addEventListener=(d=e.addEventListener,(...t)=>{if("processorerror"===t[0]){const e="function"==typeof t[1]?t[1]:"object"==typeof t[1]&&null!==t[1]&&"function"==typeof t[1].handleEvent?t[1].handleEvent:null;if(null!==e){const n=r.get(t[1]);void 0!==n?t[1]=n:(t[1]=n=>{"error"===n.type?(Object.defineProperties(n,{type:{value:"processorerror"}}),e(n)):e(new ErrorEvent(t[0],{...n}))},r.set(e,t[1]))}}return d.call(e,"error",t[1],t[2]),d.call(e,...t)}),e.removeEventListener=(h=e.removeEventListener,(...t)=>{if("processorerror"===t[0]){const e=r.get(t[1]);void 0!==e&&(r.delete(t[1]),t[1]=e)}return h.call(e,"error",t[1],t[2]),h.call(e,t[0],t[1],t[2])}),0!==l.numberOfOutputs){const t=n(o,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});e.connect(t).connect(o.destination);return i(e,()=>t.disconnect(),()=>t.connect(o.destination))}return e}catch(t){if(11===t.code)throw r();throw t}var h,d;if(void 0===c)throw r();return(t=>{const{port1:e}=new MessageChannel;try{e.postMessage(t)}finally{e.close()}})(l),e(o,s,c,l)})(Ua,Dl,au,du,xc),Fl=((t,e,n,r,i,o,s,a,u,c,l,h,d,p,f,m)=>(g,_,y)=>{const v=new WeakMap;let b=null;return{render(w,x){a(x,w);const T=v.get(x);return void 0!==T?Promise.resolve(T):(async(a,w)=>{let x=l(a),T=null;const k=Gs(x,w),S=Array.isArray(_.outputChannelCount)?_.outputChannelCount:Array.from(_.outputChannelCount);if(null===h){const t=S.reduce((t,e)=>t+e,0),n=i(w,{channelCount:Math.max(1,t),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,t)}),o=[];for(let t=0;t<a.numberOfOutputs;t+=1)o.push(r(w,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:S[t]}));const c=s(w,{channelCount:_.channelCount,channelCountMode:_.channelCountMode,channelInterpretation:_.channelInterpretation,gain:1});c.connect=e.bind(null,o),c.disconnect=u.bind(null,o),T=[n,o,c]}else k||(x=new h(w,g));if(v.set(w,null===T?x:T[2]),null!==T){if(null===b){if(void 0===y)throw new Error("Missing the processor constructor.");if(null===d)throw new Error("Missing the native OfflineAudioContext constructor.");const t=a.channelCount*a.numberOfInputs,e=void 0===y.parameterDescriptors?0:y.parameterDescriptors.length,n=t+e,u=async()=>{const u=new d(n,128*Math.ceil(a.context.length/128),w.sampleRate),c=[],l=[];for(let t=0;t<_.numberOfInputs;t+=1)c.push(s(u,{channelCount:_.channelCount,channelCountMode:_.channelCountMode,channelInterpretation:_.channelInterpretation,gain:1})),l.push(i(u,{channelCount:_.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:_.channelCount}));const h=await Promise.all(Array.from(a.parameters.values()).map(async t=>{const e=o(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:t.value});return await p(u,t,e.offset),e})),g=r(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,t+e)});for(let t=0;t<_.numberOfInputs;t+=1){c[t].connect(l[t]);for(let e=0;e<_.channelCount;e+=1)l[t].connect(g,e,t*_.channelCount+e)}for(const[e,n]of h.entries())n.connect(g,0,t+e),n.start(0);return g.connect(u.destination),await Promise.all(c.map(t=>f(a,u,t))),m(u)};b=Na(a,0===n?null:await u(),w,_,S,y,c)}const t=await b,e=n(w,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[u,l,h]=T;null!==t&&(e.buffer=t,e.start(0)),e.connect(u);for(let t=0,e=0;t<a.numberOfOutputs;t+=1){const n=l[t];for(let r=0;r<S[t];r+=1)u.connect(n,e+r,r);e+=S[t]}return h}if(k)for(const[e,n]of a.parameters.entries())await t(w,n,x.parameters.get(e));else for(const[t,e]of a.parameters.entries())await p(w,e,x.parameters.get(t));return await f(a,w,x),x})(w,x)}}})(hc,Nl,dc,kc,iu,Mc,au,Il,jl,gl,ma,Zu,Gu,pc,Bu,Gc),$l=(t=>e=>t.get(e))(_l),Bl=(t=>(e,n)=>{t.set(e,n)})(Rl),ql=ml?((t,e,n,r,i,o,s,a,u,c,l,h,d,p)=>class extends e{constructor(e,p,f){var m;const g=a(e),_=u(g),y=l({...Ea,...f});d(y);const v=Os.get(g),b=null==v?void 0:v.get(p),w=_||"closed"!==g.state?g:null!==(m=s(g))&&void 0!==m?m:g,x=i(w,_?null:e.baseLatency,c,p,b,y);super(e,!0,x,_?r(p,y,b):null);const T=[];x.parameters.forEach((t,e)=>{const r=n(this,_,t);T.push([e,r])}),this._nativeAudioWorkletNode=x,this._onprocessorerror=null,this._parameters=new Aa(T),_&&t(g,this);const{activeInputs:k}=o(this);h(x,k)}get onprocessorerror(){return this._onprocessorerror}set onprocessorerror(t){const e="function"==typeof t?p(this,t):null;this._nativeAudioWorkletNode.onprocessorerror=e;const n=this._nativeAudioWorkletNode.onprocessorerror;this._onprocessorerror=null!==n&&n===e?t:n}get parameters(){return null===this._parameters?this._nativeAudioWorkletNode.parameters:this._parameters}get port(){return this._nativeAudioWorkletNode.port}})(Ml,Yu,mc,Fl,Ll,Ys,$l,Uu,zu,Zu,t=>({...t,outputChannelCount:void 0!==t.outputChannelCount?t.outputChannelCount:1===t.numberOfInputs&&1===t.numberOfOutputs?[t.channelCount]:Array.from({length:t.numberOfOutputs},()=>1)}),Bl,t=>{const{port1:e,port2:n}=new MessageChannel;try{e.postMessage(t)}finally{e.close(),n.close()}},Ou):void 0,Ul=(((t,e,n,r,i)=>{})(Ua,du,yu,Kc,Hu),((t,e)=>(n,r,i)=>{if(null===e)throw new Error("Missing the native OfflineAudioContext constructor.");try{return new e(n,r,i)}catch(e){if("SyntaxError"===e.name)throw t();throw e}})(du,Gu)),Vl=((t,e,n,r,i,o,s,a)=>(u,c)=>n(u).render(u,c).then(()=>Promise.all(Array.from(r(c)).map(t=>n(t).render(t,c)))).then(()=>i(c)).then(n=>("function"!=typeof n.copyFromChannel?(s(n),Js(n)):e(o,()=>o(n))||a(n),t.add(n),n)))(nc,Ru,$u,Cl,Gc,zs,sc,ac),Gl=(((t,e,n,r,i)=>{})(Ru,Ua,Ul,Kc,Vl),((t,e,n,r,i)=>class extends t{constructor(t,n,i){let o;if("number"==typeof t&&void 0!==n&&void 0!==i)o={length:n,numberOfChannels:t,sampleRate:i};else{if("object"!=typeof t)throw new Error("The given parameters are not valid.");o=t}const{length:s,numberOfChannels:a,sampleRate:u}={...pu,...o},c=r(a,s,u);e(Ja,()=>Ja(c))||c.addEventListener("statechange",(()=>{let t=0;const e=n=>{"running"===this._state&&(t>0?(c.removeEventListener("statechange",e),n.stopImmediatePropagation(),this._waitForThePromiseToSettle(n)):t+=1)};return e})()),super(c,a),this._length=s,this._nativeOfflineAudioContext=c,this._state=null}get length(){return void 0===this._nativeOfflineAudioContext.length?this._length:this._nativeOfflineAudioContext.length}get state(){return null===this._state?this._nativeOfflineAudioContext.state:this._state}startRendering(){return"running"===this._state?Promise.reject(n()):(this._state="running",i(this.destination,this._nativeOfflineAudioContext).finally(()=>{this._state=null,na(this)}))}_waitForThePromiseToSettle(t){null===this._state?this._nativeOfflineAudioContext.dispatchEvent(t):setTimeout(()=>this._waitForThePromiseToSettle(t))}})(xl,Ru,Ua,Ul,Vl)),zl=((t,e)=>n=>{const r=t.get(n);return e(r)||e(n)})(Ss,Xu),Wl=((t,e)=>n=>t.has(n)||e(n))(xs,Ku),Jl=((t,e)=>n=>t.has(n)||e(n))(ks,Qu),Hl=((t,e)=>n=>{const r=t.get(n);return e(r)||e(n)})(Ss,zu);function Xl(t){return Jl(t)}function Kl(t){return Wl(t)}function Ql(t){return Hl(t)}function Zl(t){return zl(t)}function Yl(t){return void 0===t}function th(t){return void 0!==t}function eh(t){return"number"==typeof t}function nh(t){return"[object Object]"===Object.prototype.toString.call(t)&&t.constructor===Object}function rh(t){return Array.isArray(t)}function ih(t){return"string"==typeof t}function oh(t){return ih(t)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(t)}function sh(t,e){return"value"===t||Xl(e)||Kl(e)||function(t){return t instanceof uc}(e)}function ah(t,...e){if(!e.length)return t;const n=e.shift();if(nh(t)&&nh(n))for(const e in n)sh(e,n[e])?t[e]=n[e]:nh(n[e])?(t[e]||Object.assign(t,{[e]:{}}),ah(t[e],n[e])):Object.assign(t,{[e]:n[e]});return ah(t,...e)}function uh(t,e,n=[],r){const i={},o=Array.from(e);if(nh(o[0])&&r&&!Reflect.has(o[0],r)){Object.keys(o[0]).some(e=>Reflect.has(t,e))||(ah(i,{[r]:o[0]}),n.splice(n.indexOf(r),1),o.shift())}if(1===o.length&&nh(o[0]))ah(i,o[0]);else for(let t=0;t<n.length;t++)th(o[t])&&(i[n[t]]=o[t]);return ah(t,i)}function ch(t,e){return Yl(t)?e:t}function lh(t,e){return e.forEach(e=>{Reflect.has(t,e)&&delete t[e]}),t}const hh="15.1.22";function dh(t,e){if(!t)throw new Error(e)}function ph(t,e,n=1/0){if(!(e<=t&&t<=n))throw new RangeError(`Value must be within [${e}, ${n}], got: ${t}`)}function fh(t){t.isOffline||"running"===t.state||vh('The AudioContext is "suspended". Invoke Tone.start() from a user action to start the audio.')}let mh=!1,gh=!1;function _h(t){mh=t}let yh=console;function vh(...t){yh.warn(...t)}const bh="object"==typeof self?self:null,wh=bh&&(bh.hasOwnProperty("AudioContext")||bh.hasOwnProperty("webkitAudioContext"));class xh{constructor(){this.debug=!1,this._wasDisposed=!1}static getDefaults(){return{}}log(...t){(this.debug||bh&&this.toString()===bh.TONE_DEBUG_CLASS)&&function(...t){yh.log(...t)}(this,...t)}dispose(){return this._wasDisposed=!0,this}get disposed(){return this._wasDisposed}toString(){return this.name}}xh.version=hh;const Th=1e-6;function kh(t,e){return t>e+Th}function Sh(t,e){return kh(t,e)||Eh(t,e)}function Ah(t,e){return t+Th<e}function Eh(t,e){return Math.abs(t-e)<Th}class Oh extends xh{constructor(){super(),this.name="Timeline",this._timeline=[];const t=uh(Oh.getDefaults(),arguments,["memory"]);this.memory=t.memory,this.increasing=t.increasing}static getDefaults(){return{memory:1/0,increasing:!1}}get length(){return this._timeline.length}add(t){if(dh(Reflect.has(t,"time"),"Timeline: events must have a time attribute"),t.time=t.time.valueOf(),this.increasing&&this.length){const e=this._timeline[this.length-1];dh(Sh(t.time,e.time),"The time must be greater than or equal to the last scheduled time"),this._timeline.push(t)}else{const e=this._search(t.time);this._timeline.splice(e+1,0,t)}if(this.length>this.memory){const t=this.length-this.memory;this._timeline.splice(0,t)}return this}remove(t){const e=this._timeline.indexOf(t);return-1!==e&&this._timeline.splice(e,1),this}get(t,e="time"){const n=this._search(t,e);return-1!==n?this._timeline[n]:null}peek(){return this._timeline[0]}shift(){return this._timeline.shift()}getAfter(t,e="time"){const n=this._search(t,e);return n+1<this._timeline.length?this._timeline[n+1]:null}getBefore(t){const e=this._timeline.length;if(e>0&&this._timeline[e-1].time<t)return this._timeline[e-1];const n=this._search(t);return n-1>=0?this._timeline[n-1]:null}cancel(t){if(this._timeline.length>1){let e=this._search(t);if(e>=0)if(Eh(this._timeline[e].time,t)){for(let n=e;n>=0&&Eh(this._timeline[n].time,t);n--)e=n;this._timeline=this._timeline.slice(0,e)}else this._timeline=this._timeline.slice(0,e+1);else this._timeline=[]}else 1===this._timeline.length&&Sh(this._timeline[0].time,t)&&(this._timeline=[]);return this}cancelBefore(t){const e=this._search(t);return e>=0&&(this._timeline=this._timeline.slice(e+1)),this}previousEvent(t){const e=this._timeline.indexOf(t);return e>0?this._timeline[e-1]:null}_search(t,e="time"){if(0===this._timeline.length)return-1;let n=0;const r=this._timeline.length;let i=r;if(r>0&&this._timeline[r-1][e]<=t)return r-1;for(;n<i;){let r=Math.floor(n+(i-n)/2);const o=this._timeline[r],s=this._timeline[r+1];if(Eh(o[e],t)){for(let n=r;n<this._timeline.length;n++){if(!Eh(this._timeline[n][e],t))break;r=n}return r}if(Ah(o[e],t)&&kh(s[e],t))return r;kh(o[e],t)?i=r:n=r+1}return-1}_iterate(t,e=0,n=this._timeline.length-1){this._timeline.slice(e,n+1).forEach(t)}forEach(t){return this._iterate(t),this}forEachBefore(t,e){const n=this._search(t);return-1!==n&&this._iterate(e,0,n),this}forEachAfter(t,e){const n=this._search(t);return this._iterate(e,n+1),this}forEachBetween(t,e,n){let r=this._search(t),i=this._search(e);return-1!==r&&-1!==i?(this._timeline[r].time!==t&&(r+=1),this._timeline[i].time===e&&(i-=1),this._iterate(n,r,i)):-1===r&&this._iterate(n,0,i),this}forEachFrom(t,e){let n=this._search(t);for(;n>=0&&this._timeline[n].time>=t;)n--;return this._iterate(e,n+1),this}forEachAtTime(t,e){const n=this._search(t);if(-1!==n&&Eh(this._timeline[n].time,t)){let r=n;for(let e=n;e>=0&&Eh(this._timeline[e].time,t);e--)r=e;this._iterate(t=>{e(t)},r,n)}return this}dispose(){return super.dispose(),this._timeline=[],this}}class Ch{constructor(t,e,n,r){this._callback=t,this._type=e,this._minimumUpdateInterval=Math.max(128/(r||44100),.001),this.updateInterval=n,this._createClock()}_createWorker(){const t=new Blob([`\n\t\t\t// the initial timeout time\n\t\t\tlet timeoutTime = ${(1e3*this._updateInterval).toFixed(1)};\n\t\t\t// onmessage callback\n\t\t\tself.onmessage = function(msg){\n\t\t\t\ttimeoutTime = parseInt(msg.data);\n\t\t\t};\n\t\t\t// the tick function which posts a message\n\t\t\t// and schedules a new tick\n\t\t\tfunction tick(){\n\t\t\t\tsetTimeout(tick, timeoutTime);\n\t\t\t\tself.postMessage('tick');\n\t\t\t}\n\t\t\t// call tick initially\n\t\t\ttick();\n\t\t\t`],{type:"text/javascript"}),e=URL.createObjectURL(t),n=new Worker(e);n.onmessage=this._callback.bind(this),this._worker=n}_createTimeout(){this._timeout=setTimeout(()=>{this._createTimeout(),this._callback()},1e3*this._updateInterval)}_createClock(){if("worker"===this._type)try{this._createWorker()}catch(t){this._type="timeout",this._createClock()}else"timeout"===this._type&&this._createTimeout()}_disposeClock(){this._timeout&&clearTimeout(this._timeout),this._worker&&(this._worker.terminate(),this._worker.onmessage=null)}get updateInterval(){return this._updateInterval}set updateInterval(t){var e;this._updateInterval=Math.max(t,this._minimumUpdateInterval),"worker"===this._type&&(null===(e=this._worker)||void 0===e||e.postMessage(1e3*this._updateInterval))}get type(){return this._type}set type(t){this._disposeClock(),this._type=t,this._createClock()}dispose(){this._disposeClock()}}const Mh=[];function Nh(t){Mh.push(t)}const Ih=[];function jh(t){Ih.push(t)}class Rh extends xh{constructor(){super(...arguments),this.name="Emitter"}on(t,e){return t.split(/\W+/).forEach(t=>{Yl(this._events)&&(this._events={}),this._events.hasOwnProperty(t)||(this._events[t]=[]),this._events[t].push(e)}),this}once(t,e){const n=(...r)=>{e(...r),this.off(t,n)};return this.on(t,n),this}off(t,e){return t.split(/\W+/).forEach(t=>{if(Yl(this._events)&&(this._events={}),this._events.hasOwnProperty(t))if(Yl(e))this._events[t]=[];else{const n=this._events[t];for(let t=n.length-1;t>=0;t--)n[t]===e&&n.splice(t,1)}}),this}emit(t,...e){if(this._events&&this._events.hasOwnProperty(t)){const n=this._events[t].slice(0);for(let t=0,r=n.length;t<r;t++)n[t].apply(this,e)}return this}static mixin(t){["on","once","off","emit"].forEach(e=>{const n=Object.getOwnPropertyDescriptor(Rh.prototype,e);Object.defineProperty(t.prototype,e,n)})}dispose(){return super.dispose(),this._events=void 0,this}}class Ph extends Rh{constructor(){super(...arguments),this.isOffline=!1}toJSON(){return{}}}class Dh extends Ph{constructor(){var t,e;super(),this.name="Context",this._constants=new Map,this._timeouts=new Oh,this._timeoutIds=0,this._initialized=!1,this._closeStarted=!1,this.isOffline=!1,this._workletPromise=null;const n=uh(Dh.getDefaults(),arguments,["context"]);n.context?(this._context=n.context,this._latencyHint=(null===(t=arguments[0])||void 0===t?void 0:t.latencyHint)||""):(this._context=function(t){return new Ol(t)}({latencyHint:n.latencyHint}),this._latencyHint=n.latencyHint),this._ticker=new Ch(this.emit.bind(this,"tick"),n.clockSource,n.updateInterval,this._context.sampleRate),this.on("tick",this._timeoutLoop.bind(this)),this._context.onstatechange=()=>{this.emit("statechange",this.state)},this[(null===(e=arguments[0])||void 0===e?void 0:e.hasOwnProperty("updateInterval"))?"_lookAhead":"lookAhead"]=n.lookAhead}static getDefaults(){return{clockSource:"worker",latencyHint:"interactive",lookAhead:.1,updateInterval:.05}}initialize(){var t;return this._initialized||(t=this,Mh.forEach(e=>e(t)),this._initialized=!0),this}createAnalyser(){return this._context.createAnalyser()}createOscillator(){return this._context.createOscillator()}createBufferSource(){return this._context.createBufferSource()}createBiquadFilter(){return this._context.createBiquadFilter()}createBuffer(t,e,n){return this._context.createBuffer(t,e,n)}createChannelMerger(t){return this._context.createChannelMerger(t)}createChannelSplitter(t){return this._context.createChannelSplitter(t)}createConstantSource(){return this._context.createConstantSource()}createConvolver(){return this._context.createConvolver()}createDelay(t){return this._context.createDelay(t)}createDynamicsCompressor(){return this._context.createDynamicsCompressor()}createGain(){return this._context.createGain()}createIIRFilter(t,e){return this._context.createIIRFilter(t,e)}createPanner(){return this._context.createPanner()}createPeriodicWave(t,e,n){return this._context.createPeriodicWave(t,e,n)}createStereoPanner(){return this._context.createStereoPanner()}createWaveShaper(){return this._context.createWaveShaper()}createMediaStreamSource(t){dh(Zl(this._context),"Not available if OfflineAudioContext");return this._context.createMediaStreamSource(t)}createMediaElementSource(t){dh(Zl(this._context),"Not available if OfflineAudioContext");return this._context.createMediaElementSource(t)}createMediaStreamDestination(){dh(Zl(this._context),"Not available if OfflineAudioContext");return this._context.createMediaStreamDestination()}decodeAudioData(t){return this._context.decodeAudioData(t)}get currentTime(){return this._context.currentTime}get state(){return this._context.state}get sampleRate(){return this._context.sampleRate}get listener(){return this.initialize(),this._listener}set listener(t){dh(!this._initialized,"The listener cannot be set after initialization."),this._listener=t}get transport(){return this.initialize(),this._transport}set transport(t){dh(!this._initialized,"The transport cannot be set after initialization."),this._transport=t}get draw(){return this.initialize(),this._draw}set draw(t){dh(!this._initialized,"Draw cannot be set after initialization."),this._draw=t}get destination(){return this.initialize(),this._destination}set destination(t){dh(!this._initialized,"The destination cannot be set after initialization."),this._destination=t}createAudioWorkletNode(t,e){return function(t,e,n){return dh(th(ql),"AudioWorkletNode only works in a secure context (https or localhost)"),new(t instanceof(null==bh?void 0:bh.BaseAudioContext)?null==bh?void 0:bh.AudioWorkletNode:ql)(t,e,n)}(this.rawContext,t,e)}addAudioWorkletModule(t){return a(this,void 0,void 0,function*(){dh(th(this.rawContext.audioWorklet),"AudioWorkletNode is only available in a secure context (https or localhost)"),this._workletPromise||(this._workletPromise=this.rawContext.audioWorklet.addModule(t)),yield this._workletPromise})}workletsAreReady(){return a(this,void 0,void 0,function*(){(yield this._workletPromise)?this._workletPromise:Promise.resolve()})}get updateInterval(){return this._ticker.updateInterval}set updateInterval(t){this._ticker.updateInterval=t}get clockSource(){return this._ticker.type}set clockSource(t){this._ticker.type=t}get lookAhead(){return this._lookAhead}set lookAhead(t){this._lookAhead=t,this.updateInterval=t?t/2:.01}get latencyHint(){return this._latencyHint}get rawContext(){return this._context}now(){return this._context.currentTime+this._lookAhead}immediate(){return this._context.currentTime}resume(){return Zl(this._context)?this._context.resume():Promise.resolve()}close(){return a(this,void 0,void 0,function*(){var t;Zl(this._context)&&"closed"!==this.state&&!this._closeStarted&&(this._closeStarted=!0,yield this._context.close()),this._initialized&&(t=this,Ih.forEach(e=>e(t)))})}getConstant(t){if(this._constants.has(t))return this._constants.get(t);{const e=this._context.createBuffer(1,128,this._context.sampleRate),n=e.getChannelData(0);for(let e=0;e<n.length;e++)n[e]=t;const r=this._context.createBufferSource();return r.channelCount=1,r.channelCountMode="explicit",r.buffer=e,r.loop=!0,r.start(0),this._constants.set(t,r),r}}dispose(){return super.dispose(),this._ticker.dispose(),this._timeouts.dispose(),Object.keys(this._constants).map(t=>this._constants[t].disconnect()),this.close(),this}_timeoutLoop(){const t=this.now();this._timeouts.forEachBefore(t,t=>{t.callback(),this._timeouts.remove(t)})}setTimeout(t,e){this._timeoutIds++;const n=this.now();return this._timeouts.add({callback:t,id:this._timeoutIds,time:n+e}),this._timeoutIds}clearTimeout(t){return this._timeouts.forEach(e=>{e.id===t&&this._timeouts.remove(e)}),this}clearInterval(t){return this.clearTimeout(t)}setInterval(t,e){const n=++this._timeoutIds,r=()=>{const i=this.now();this._timeouts.add({callback:()=>{t(),r()},id:n,time:i+e})};return r(),n}}function Lh(t,e){rh(e)?e.forEach(e=>Lh(t,e)):Object.defineProperty(t,e,{enumerable:!0,writable:!1})}function Fh(t,e){rh(e)?e.forEach(e=>Fh(t,e)):Object.defineProperty(t,e,{writable:!0})}const $h=()=>{};class Bh extends xh{constructor(){super(),this.name="ToneAudioBuffer",this.onload=$h;const t=uh(Bh.getDefaults(),arguments,["url","onload","onerror"]);this.reverse=t.reverse,this.onload=t.onload,ih(t.url)?this.load(t.url).catch(t.onerror):t.url&&this.set(t.url)}static getDefaults(){return{onerror:$h,onload:$h,reverse:!1}}get sampleRate(){return this._buffer?this._buffer.sampleRate:Gh().sampleRate}set(t){return t instanceof Bh?t.loaded?this._buffer=t.get():t.onload=()=>{this.set(t),this.onload(this)}:this._buffer=t,this._reversed&&this._reverse(),this}get(){return this._buffer}load(t){return a(this,void 0,void 0,function*(){const e=Bh.load(t).then(t=>{this.set(t),this.onload(this)});Bh.downloads.push(e);try{yield e}finally{const t=Bh.downloads.indexOf(e);Bh.downloads.splice(t,1)}return this})}dispose(){return super.dispose(),this._buffer=void 0,this}fromArray(t){const e=rh(t)&&t[0].length>0,n=e?t.length:1,r=e?t[0].length:t.length,i=Gh(),o=i.createBuffer(n,r,i.sampleRate),s=e||1!==n?t:[t];for(let t=0;t<n;t++)o.copyToChannel(s[t],t);return this._buffer=o,this}toMono(t){if(eh(t))this.fromArray(this.toArray(t));else{let t=new Float32Array(this.length);const e=this.numberOfChannels;for(let n=0;n<e;n++){const e=this.toArray(n);for(let n=0;n<e.length;n++)t[n]+=e[n]}t=t.map(t=>t/e),this.fromArray(t)}return this}toArray(t){if(eh(t))return this.getChannelData(t);if(1===this.numberOfChannels)return this.toArray(0);{const t=[];for(let e=0;e<this.numberOfChannels;e++)t[e]=this.getChannelData(e);return t}}getChannelData(t){return this._buffer?this._buffer.getChannelData(t):new Float32Array(0)}slice(t,e=this.duration){dh(this.loaded,"Buffer is not loaded");const n=Math.floor(t*this.sampleRate),r=Math.floor(e*this.sampleRate);dh(n<r,"The start time must be less than the end time");const i=r-n,o=Gh().createBuffer(this.numberOfChannels,i,this.sampleRate);for(let t=0;t<this.numberOfChannels;t++)o.copyToChannel(this.getChannelData(t).subarray(n,r),t);return new Bh(o)}_reverse(){if(this.loaded)for(let t=0;t<this.numberOfChannels;t++)this.getChannelData(t).reverse();return this}get loaded(){return this.length>0}get duration(){return this._buffer?this._buffer.duration:0}get length(){return this._buffer?this._buffer.length:0}get numberOfChannels(){return this._buffer?this._buffer.numberOfChannels:0}get reverse(){return this._reversed}set reverse(t){this._reversed!==t&&(this._reversed=t,this._reverse())}static fromArray(t){return(new Bh).fromArray(t)}static fromUrl(t){return a(this,void 0,void 0,function*(){const e=new Bh;return yield e.load(t)})}static load(t){return a(this,void 0,void 0,function*(){const e=""===Bh.baseUrl||Bh.baseUrl.endsWith("/")?Bh.baseUrl:Bh.baseUrl+"/",n=yield fetch(e+t);if(!n.ok)throw new Error(`could not load url: ${t}`);const r=yield n.arrayBuffer();return yield Gh().decodeAudioData(r)})}static supportsType(t){const e=t.split("."),n=e[e.length-1];return""!==document.createElement("audio").canPlayType("audio/"+n)}static loaded(){return a(this,void 0,void 0,function*(){for(yield Promise.resolve();Bh.downloads.length;)yield Bh.downloads[0]})}}Bh.baseUrl="",Bh.downloads=[];class qh extends Dh{constructor(){var t,e,n;super({clockSource:"offline",context:Ql(arguments[0])?arguments[0]:(t=arguments[0],e=arguments[1]*arguments[2],n=arguments[2],new Gl(t,e,n)),lookAhead:0,updateInterval:Ql(arguments[0])?128/arguments[0].sampleRate:128/arguments[2]}),this.name="OfflineContext",this._currentTime=0,this.isOffline=!0,this._duration=Ql(arguments[0])?arguments[0].length/arguments[0].sampleRate:arguments[1]}now(){return this._currentTime}get currentTime(){return this._currentTime}_renderClock(t){return a(this,void 0,void 0,function*(){let e=0;for(;this._duration-this._currentTime>=0;){this.emit("tick"),this._currentTime+=128/this.sampleRate,e++;const n=Math.floor(this.sampleRate/128);t&&e%n===0&&(yield new Promise(t=>setTimeout(t,1)))}})}render(){return a(this,arguments,void 0,function*(t=!0){yield this.workletsAreReady(),yield this._renderClock(t);const e=yield this._context.startRendering();return new Bh(e)})}close(){return Promise.resolve()}}const Uh=new class extends Ph{constructor(){super(...arguments),this.lookAhead=0,this.latencyHint=0,this.isOffline=!1}createAnalyser(){return{}}createOscillator(){return{}}createBufferSource(){return{}}createBiquadFilter(){return{}}createBuffer(t,e,n){return{}}createChannelMerger(t){return{}}createChannelSplitter(t){return{}}createConstantSource(){return{}}createConvolver(){return{}}createDelay(t){return{}}createDynamicsCompressor(){return{}}createGain(){return{}}createIIRFilter(t,e){return{}}createPanner(){return{}}createPeriodicWave(t,e,n){return{}}createStereoPanner(){return{}}createWaveShaper(){return{}}createMediaStreamSource(t){return{}}createMediaElementSource(t){return{}}createMediaStreamDestination(){return{}}decodeAudioData(t){return Promise.resolve({})}createAudioWorkletNode(t,e){return{}}get rawContext(){return{}}addAudioWorkletModule(t){return a(this,void 0,void 0,function*(){return Promise.resolve()})}resume(){return Promise.resolve()}setTimeout(t,e){return 0}clearTimeout(t){return this}setInterval(t,e){return 0}clearInterval(t){return this}getConstant(t){return{}}get currentTime(){return 0}get state(){return{}}get sampleRate(){return 0}get listener(){return{}}get transport(){return{}}get draw(){return{}}set draw(t){}get destination(){return{}}set destination(t){}now(){return 0}immediate(){return 0}};let Vh=Uh;function Gh(){return Vh===Uh&&wh&&function(t,e=!1){e&&Vh.dispose();Vh=Zl(t)?new Dh(t):Ql(t)?new qh(t):t}(new Dh),Vh}if(bh&&!bh.TONE_SILENCE_LOGGING){0}class zh extends xh{constructor(t,e,n){super(),this.defaultUnits="s",this._val=e,this._units=n,this.context=t,this._expressions=this._getExpressions()}_getExpressions(){return{hz:{method:t=>this._frequencyToUnits(parseFloat(t)),regexp:/^(\d+(?:\.\d+)?)hz$/i},i:{method:t=>this._ticksToUnits(parseInt(t,10)),regexp:/^(\d+)i$/i},m:{method:t=>this._beatsToUnits(parseInt(t,10)*this._getTimeSignature()),regexp:/^(\d+)m$/i},n:{method:(t,e)=>{const n=parseInt(t,10),r="."===e?1.5:1;return 1===n?this._beatsToUnits(this._getTimeSignature())*r:this._beatsToUnits(4/n)*r},regexp:/^(\d+)n(\.?)$/i},number:{method:t=>this._expressions[this.defaultUnits].method.call(this,t),regexp:/^(\d+(?:\.\d+)?)$/},s:{method:t=>this._secondsToUnits(parseFloat(t)),regexp:/^(\d+(?:\.\d+)?)s$/},samples:{method:t=>parseInt(t,10)/this.context.sampleRate,regexp:/^(\d+)samples$/},t:{method:t=>{const e=parseInt(t,10);return this._beatsToUnits(8/(3*Math.floor(e)))},regexp:/^(\d+)t$/i},tr:{method:(t,e,n)=>{let r=0;return t&&"0"!==t&&(r+=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(r+=this._beatsToUnits(parseFloat(e))),n&&"0"!==n&&(r+=this._beatsToUnits(parseFloat(n)/4)),r},regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/}}}valueOf(){if(this._val instanceof zh&&this.fromType(this._val),Yl(this._val))return this._noArg();if(ih(this._val)&&Yl(this._units)){for(const t in this._expressions)if(this._expressions[t].regexp.test(this._val.trim())){this._units=t;break}}else if(nh(this._val)){let t=0;for(const e in this._val)if(th(this._val[e])){const n=this._val[e];t+=new this.constructor(this.context,e).valueOf()*n}return t}if(th(this._units)){const t=this._expressions[this._units],e=this._val.toString().trim().match(t.regexp);return e?t.method.apply(this,e.slice(1)):t.method.call(this,this._val)}return ih(this._val)?parseFloat(this._val):this._val}_frequencyToUnits(t){return 1/t}_beatsToUnits(t){return 60/this._getBpm()*t}_secondsToUnits(t){return t}_ticksToUnits(t){return t*this._beatsToUnits(1)/this._getPPQ()}_noArg(){return this._now()}_getBpm(){return this.context.transport.bpm.value}_getTimeSignature(){return this.context.transport.timeSignature}_getPPQ(){return this.context.transport.PPQ}fromType(t){switch(this._units=void 0,this.defaultUnits){case"s":this._val=t.toSeconds();break;case"i":this._val=t.toTicks();break;case"hz":this._val=t.toFrequency();break;case"midi":this._val=t.toMidi()}return this}toFrequency(){return 1/this.toSeconds()}toSamples(){return this.toSeconds()*this.context.sampleRate}toMilliseconds(){return 1e3*this.toSeconds()}}class Wh extends zh{constructor(){super(...arguments),this.name="TimeClass"}_getExpressions(){return Object.assign(super._getExpressions(),{now:{method:t=>this._now()+new this.constructor(this.context,t).valueOf(),regexp:/^\+(.+)/},quantize:{method:t=>{const e=new Wh(this.context,t).valueOf();return this._secondsToUnits(this.context.transport.nextSubdivision(e))},regexp:/^@(.+)/}})}quantize(t,e=1){const n=new this.constructor(this.context,t).valueOf(),r=this.valueOf();return r+(Math.round(r/n)*n-r)*e}toNotation(){const t=this.toSeconds(),e=["1m"];for(let t=1;t<9;t++){const n=Math.pow(2,t);e.push(n+"n."),e.push(n+"n"),e.push(n+"t")}e.push("0");let n=e[0],r=new Wh(this.context,e[0]).toSeconds();return e.forEach(e=>{const i=new Wh(this.context,e).toSeconds();Math.abs(i-t)<Math.abs(r-t)&&(n=e,r=i)}),n}toBarsBeatsSixteenths(){const t=this._beatsToUnits(1);let e=this.valueOf()/t;e=parseFloat(e.toFixed(4));const n=Math.floor(e/this._getTimeSignature());let r=e%1*4;e=Math.floor(e)%this._getTimeSignature();const i=r.toString();i.length>3&&(r=parseFloat(parseFloat(i).toFixed(3)));return[n,e,r].join(":")}toTicks(){const t=this._beatsToUnits(1);return this.valueOf()/t*this._getPPQ()}toSeconds(){return this.valueOf()}toMidi(){return gs(this.toFrequency())}_now(){return this.context.now()}}class Jh extends Wh{constructor(){super(...arguments),this.name="Frequency",this.defaultUnits="hz"}static get A4(){return ms}static set A4(t){!function(t){ms=t}(t)}_getExpressions(){return Object.assign({},super._getExpressions(),{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method(t){return"midi"===this.defaultUnits?t:Jh.mtof(t)}},note:{regexp:/^([a-g]{1}(?:b|#|##|x|bb|###|#x|x#|bbb)?)(-?[0-9]+)/i,method(t,e){const n=Hh[t.toLowerCase()]+12*(parseInt(e,10)+1);return"midi"===this.defaultUnits?n:Jh.mtof(n)}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method(t,e,n){let r=1;return t&&"0"!==t&&(r*=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(r*=this._beatsToUnits(parseFloat(e))),n&&"0"!==n&&(r*=this._beatsToUnits(parseFloat(n)/4)),r}}})}transpose(t){return new Jh(this.context,this.valueOf()*fs(t))}harmonize(t){return t.map(t=>this.transpose(t))}toMidi(){return gs(this.valueOf())}toNote(){const t=this.toFrequency(),e=Math.log2(t/Jh.A4);let n=Math.round(12*e)+57;const r=Math.floor(n/12);r<0&&(n+=-12*r);return Xh[n%12]+r.toString()}toSeconds(){return 1/super.toSeconds()}toTicks(){const t=this._beatsToUnits(1),e=this.valueOf()/t;return Math.floor(e*this._getPPQ())}_noArg(){return 0}_frequencyToUnits(t){return t}_ticksToUnits(t){return 1/(60*t/(this._getBpm()*this._getPPQ()))}_beatsToUnits(t){return 1/super._beatsToUnits(t)}_secondsToUnits(t){return 1/t}static mtof(t){return ys(t)}static ftom(t){return gs(t)}}const Hh={cbbb:-3,cbb:-2,cb:-1,c:0,"c#":1,cx:2,"c##":2,"c###":3,"cx#":3,"c#x":3,dbbb:-1,dbb:0,db:1,d:2,"d#":3,dx:4,"d##":4,"d###":5,"dx#":5,"d#x":5,ebbb:1,ebb:2,eb:3,e:4,"e#":5,ex:6,"e##":6,"e###":7,"ex#":7,"e#x":7,fbbb:2,fbb:3,fb:4,f:5,"f#":6,fx:7,"f##":7,"f###":8,"fx#":8,"f#x":8,gbbb:4,gbb:5,gb:6,g:7,"g#":8,gx:9,"g##":9,"g###":10,"gx#":10,"g#x":10,abbb:6,abb:7,ab:8,a:9,"a#":10,ax:11,"a##":11,"a###":12,"ax#":12,"a#x":12,bbbb:8,bbb:9,bb:10,b:11,"b#":12,bx:13,"b##":13,"b###":14,"bx#":14,"b#x":14},Xh=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];class Kh extends Wh{constructor(){super(...arguments),this.name="TransportTime"}_now(){return this.context.transport.seconds}}class Qh extends xh{constructor(){super();const t=uh(Qh.getDefaults(),arguments,["context"]);this.defaultContext?this.context=this.defaultContext:this.context=t.context}static getDefaults(){return{context:Gh()}}now(){return this.context.currentTime+this.context.lookAhead}immediate(){return this.context.currentTime}get sampleTime(){return 1/this.context.sampleRate}get blockTime(){return 128/this.context.sampleRate}toSeconds(t){return function(t){Yl(t)&&mh&&!gh&&(gh=!0,vh("Events scheduled inside of scheduled callbacks should use the passed in scheduling time. See https://github.com/Tonejs/Tone.js/wiki/Accurate-Timing"))}(t),new Wh(this.context,t).toSeconds()}toFrequency(t){return new Jh(this.context,t).toFrequency()}toTicks(t){return new Kh(this.context,t).toTicks()}_getPartialProperties(t){const e=this.get();return Object.keys(e).forEach(n=>{Yl(t[n])&&delete e[n]}),e}get(){const t=this.constructor.getDefaults();return Object.keys(t).forEach(e=>{if(Reflect.has(this,e)){const n=this[e];th(n)&&th(n.value)&&th(n.setValueAtTime)?t[e]=n.value:n instanceof Qh?t[e]=n._getPartialProperties(t[e]):rh(n)||eh(n)||ih(n)||"boolean"==typeof n?t[e]=n:delete t[e]}}),t}set(t){return Object.keys(t).forEach(e=>{Reflect.has(this,e)&&th(this[e])&&(this[e]&&th(this[e].value)&&th(this[e].setValueAtTime)?this[e].value!==t[e]&&(this[e].value=t[e]):this[e]instanceof Qh?this[e].set(t[e]):this[e]=t[e])}),this}}class Zh extends Qh{constructor(){const t=uh(Zh.getDefaults(),arguments,["param","units","convert"]);for(super(t),this.name="Param",this.overridden=!1,this._minOutput=1e-7,dh(th(t.param)&&(Xl(t.param)||t.param instanceof Zh),"param must be an AudioParam");!Xl(t.param);)t.param=t.param._param;this._swappable=!!th(t.swappable)&&t.swappable,this._swappable?(this.input=this.context.createGain(),this._param=t.param,this.input.connect(this._param)):this._param=this.input=t.param,this._events=new Oh(1e3),this._initialValue=this._param.defaultValue,this.units=t.units,this.convert=t.convert,this._minValue=t.minValue,this._maxValue=t.maxValue,th(t.value)&&t.value!==this._toType(this._initialValue)&&this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(Qh.getDefaults(),{convert:!0,units:"number"})}get value(){const t=this.now();return this.getValueAtTime(t)}set value(t){this.cancelScheduledValues(this.now()),this.setValueAtTime(t,this.now())}get minValue(){return th(this._minValue)?this._minValue:"time"===this.units||"frequency"===this.units||"normalRange"===this.units||"positive"===this.units||"transportTime"===this.units||"ticks"===this.units||"bpm"===this.units||"hertz"===this.units||"samples"===this.units?0:"audioRange"===this.units?-1:"decibels"===this.units?-1/0:this._param.minValue}get maxValue(){return th(this._maxValue)?this._maxValue:"normalRange"===this.units||"audioRange"===this.units?1:this._param.maxValue}_is(t,e){return this.units===e}_assertRange(t){return th(this.maxValue)&&th(this.minValue)&&ph(t,this._fromType(this.minValue),this._fromType(this.maxValue)),t}_fromType(t){return this.convert&&!this.overridden?this._is(t,"time")?this.toSeconds(t):this._is(t,"decibels")?(e=t,Math.pow(10,e/20)):this._is(t,"frequency")?this.toFrequency(t):t:this.overridden?0:t;var e}_toType(t){return this.convert&&"decibels"===this.units?(e=t,Math.log(e)/Math.LN10*20):t;var e}setValueAtTime(t,e){const n=this.toSeconds(e),r=this._fromType(t);return dh(isFinite(r)&&isFinite(n),`Invalid argument(s) to setValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(r),this.log(this.units,"setValueAtTime",t,n),this._events.add({time:n,type:"setValueAtTime",value:r}),this._param.setValueAtTime(r,n),this}getValueAtTime(t){const e=Math.max(this.toSeconds(t),0),n=this._events.getAfter(e),r=this._events.get(e);let i=this._initialValue;if(null===r)i=this._initialValue;else if("setTargetAtTime"!==r.type||null!==n&&"setValueAtTime"!==n.type)if(null===n)i=r.value;else if("linearRampToValueAtTime"===n.type||"exponentialRampToValueAtTime"===n.type){let t=r.value;if("setTargetAtTime"===r.type){const e=this._events.getBefore(r.time);t=null===e?this._initialValue:e.value}i="linearRampToValueAtTime"===n.type?this._linearInterpolate(r.time,t,n.time,n.value,e):this._exponentialInterpolate(r.time,t,n.time,n.value,e)}else i=r.value;else{const t=this._events.getBefore(r.time);let n;n=null===t?this._initialValue:t.value,"setTargetAtTime"===r.type&&(i=this._exponentialApproach(r.time,n,r.value,r.constant,e))}return this._toType(i)}setRampPoint(t){t=this.toSeconds(t);let e=this.getValueAtTime(t);return this.cancelAndHoldAtTime(t),0===this._fromType(e)&&(e=this._toType(this._minOutput)),this.setValueAtTime(e,t),this}linearRampToValueAtTime(t,e){const n=this._fromType(t),r=this.toSeconds(e);return dh(isFinite(n)&&isFinite(r),`Invalid argument(s) to linearRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(n),this._events.add({time:r,type:"linearRampToValueAtTime",value:n}),this.log(this.units,"linearRampToValueAtTime",t,r),this._param.linearRampToValueAtTime(n,r),this}exponentialRampToValueAtTime(t,e){let n=this._fromType(t);n=Eh(n,0)?this._minOutput:n,this._assertRange(n);const r=this.toSeconds(e);return dh(isFinite(n)&&isFinite(r),`Invalid argument(s) to exponentialRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({time:r,type:"exponentialRampToValueAtTime",value:n}),this.log(this.units,"exponentialRampToValueAtTime",t,r),this._param.exponentialRampToValueAtTime(n,r),this}exponentialRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialRampToValueAtTime(t,n+this.toSeconds(e)),this}linearRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.linearRampToValueAtTime(t,n+this.toSeconds(e)),this}targetRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialApproachValueAtTime(t,n,e),this}exponentialApproachValueAtTime(t,e,n){e=this.toSeconds(e),n=this.toSeconds(n);const r=Math.log(n+1)/Math.log(200);return this.setTargetAtTime(t,e,r),this.cancelAndHoldAtTime(e+.9*n),this.linearRampToValueAtTime(t,e+n),this}setTargetAtTime(t,e,n){const r=this._fromType(t);dh(isFinite(n)&&n>0,"timeConstant must be a number greater than 0");const i=this.toSeconds(e);return this._assertRange(r),dh(isFinite(r)&&isFinite(i),`Invalid argument(s) to setTargetAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({constant:n,time:i,type:"setTargetAtTime",value:r}),this.log(this.units,"setTargetAtTime",t,i,n),this._param.setTargetAtTime(r,i,n),this}setValueCurveAtTime(t,e,n,r=1){n=this.toSeconds(n),e=this.toSeconds(e);const i=this._fromType(t[0])*r;this.setValueAtTime(this._toType(i),e);const o=n/(t.length-1);for(let n=1;n<t.length;n++){const i=this._fromType(t[n])*r;this.linearRampToValueAtTime(this._toType(i),e+n*o)}return this}cancelScheduledValues(t){const e=this.toSeconds(t);return dh(isFinite(e),`Invalid argument to cancelScheduledValues: ${JSON.stringify(t)}`),this._events.cancel(e),this._param.cancelScheduledValues(e),this.log(this.units,"cancelScheduledValues",e),this}cancelAndHoldAtTime(t){const e=this.toSeconds(t),n=this._fromType(this.getValueAtTime(e));dh(isFinite(e),`Invalid argument to cancelAndHoldAtTime: ${JSON.stringify(t)}`),this.log(this.units,"cancelAndHoldAtTime",e,"value="+n);const r=this._events.get(e),i=this._events.getAfter(e);return r&&Eh(r.time,e)?i?(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time)):(this._param.cancelAndHoldAtTime(e),this._events.cancel(e+this.sampleTime)):i&&(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time),"linearRampToValueAtTime"===i.type?this.linearRampToValueAtTime(this._toType(n),e):"exponentialRampToValueAtTime"===i.type&&this.exponentialRampToValueAtTime(this._toType(n),e)),this._events.add({time:e,type:"setValueAtTime",value:n}),this._param.setValueAtTime(n,e),this}rampTo(t,e=.1,n){return"frequency"===this.units||"bpm"===this.units||"decibels"===this.units?this.exponentialRampTo(t,e,n):this.linearRampTo(t,e,n),this}apply(t){const e=this.context.currentTime;t.setValueAtTime(this.getValueAtTime(e),e);const n=this._events.get(e);if(n&&"setTargetAtTime"===n.type){const r=this._events.getAfter(n.time),i=r?r.time:e+2,o=(i-e)/10;for(let n=e;n<i;n+=o)t.linearRampToValueAtTime(this.getValueAtTime(n),n)}return this._events.forEachAfter(this.context.currentTime,e=>{"cancelScheduledValues"===e.type?t.cancelScheduledValues(e.time):"setTargetAtTime"===e.type?t.setTargetAtTime(e.value,e.time,e.constant):t[e.type](e.value,e.time)}),this}setParam(t){dh(this._swappable,"The Param must be assigned as 'swappable' in the constructor");const e=this.input;return e.disconnect(this._param),this.apply(t),this._param=t,e.connect(this._param),this}dispose(){return super.dispose(),this._events.dispose(),this}get defaultValue(){return this._toType(this._param.defaultValue)}_exponentialApproach(t,e,n,r,i){return n+(e-n)*Math.exp(-(i-t)/r)}_linearInterpolate(t,e,n,r,i){return e+(i-t)/(n-t)*(r-e)}_exponentialInterpolate(t,e,n,r,i){return e*Math.pow(r/e,(i-t)/(n-t))}}class Yh extends Qh{constructor(){super(...arguments),this._internalChannels=[]}get numberOfInputs(){return th(this.input)?Xl(this.input)||this.input instanceof Zh?1:this.input.numberOfInputs:0}get numberOfOutputs(){return th(this.output)?this.output.numberOfOutputs:0}_isAudioNode(t){return th(t)&&(t instanceof Yh||Kl(t))}_getInternalNodes(){const t=this._internalChannels.slice(0);return this._isAudioNode(this.input)&&t.push(this.input),this._isAudioNode(this.output)&&this.input!==this.output&&t.push(this.output),t}_setChannelProperties(t){this._getInternalNodes().forEach(e=>{e.channelCount=t.channelCount,e.channelCountMode=t.channelCountMode,e.channelInterpretation=t.channelInterpretation})}_getChannelProperties(){const t=this._getInternalNodes();dh(t.length>0,"ToneAudioNode does not have any internal nodes");const e=t[0];return{channelCount:e.channelCount,channelCountMode:e.channelCountMode,channelInterpretation:e.channelInterpretation}}get channelCount(){return this._getChannelProperties().channelCount}set channelCount(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelCount:t}))}get channelCountMode(){return this._getChannelProperties().channelCountMode}set channelCountMode(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelCountMode:t}))}get channelInterpretation(){return this._getChannelProperties().channelInterpretation}set channelInterpretation(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelInterpretation:t}))}connect(t,e=0,n=0){return ed(this,t,e,n),this}toDestination(){return this.connect(this.context.destination),this}toMaster(){return vh("toMaster() has been renamed toDestination()"),this.toDestination()}disconnect(t,e=0,n=0){return nd(this,t,e,n),this}chain(...t){return td(this,...t),this}fan(...t){return t.forEach(t=>this.connect(t)),this}dispose(){return super.dispose(),th(this.input)&&(this.input instanceof Yh?this.input.dispose():Kl(this.input)&&this.input.disconnect()),th(this.output)&&(this.output instanceof Yh?this.output.dispose():Kl(this.output)&&this.output.disconnect()),this._internalChannels=[],this}}function td(...t){const e=t.shift();t.reduce((t,e)=>(t instanceof Yh?t.connect(e):Kl(t)&&ed(t,e),e),e)}function ed(t,e,n=0,r=0){for(dh(th(t),"Cannot connect from undefined node"),dh(th(e),"Cannot connect to undefined node"),(e instanceof Yh||Kl(e))&&dh(e.numberOfInputs>0,"Cannot connect to node with no inputs"),dh(t.numberOfOutputs>0,"Cannot connect from node with no outputs");e instanceof Yh||e instanceof Zh;)th(e.input)&&(e=e.input);for(;t instanceof Yh;)th(t.output)&&(t=t.output);Xl(e)?t.connect(e,n):t.connect(e,n,r)}function nd(t,e,n=0,r=0){if(th(e))for(;e instanceof Yh;)e=e.input;for(;!Kl(t);)th(t.output)&&(t=t.output);Xl(e)?t.disconnect(e,n):Kl(e)?t.disconnect(e,n,r):t.disconnect()}class rd extends Yh{constructor(){const t=uh(rd.getDefaults(),arguments,["gain","units"]);super(t),this.name="Gain",this._gainNode=this.context.createGain(),this.input=this._gainNode,this.output=this._gainNode,this.gain=new Zh({context:this.context,convert:t.convert,param:this._gainNode.gain,units:t.units,value:t.gain,minValue:t.minValue,maxValue:t.maxValue}),Lh(this,"gain")}static getDefaults(){return Object.assign(Yh.getDefaults(),{convert:!0,gain:1,units:"gain"})}dispose(){return super.dispose(),this._gainNode.disconnect(),this.gain.dispose(),this}}class id extends Yh{constructor(t){super(t),this.onended=$h,this._startTime=-1,this._stopTime=-1,this._timeout=-1,this.output=new rd({context:this.context,gain:0}),this._gainNode=this.output,this.getStateAtTime=function(t){const e=this.toSeconds(t);return-1!==this._startTime&&e>=this._startTime&&(-1===this._stopTime||e<=this._stopTime)?"started":"stopped"},this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut,this._curve=t.curve,this.onended=t.onended}static getDefaults(){return Object.assign(Yh.getDefaults(),{curve:"linear",fadeIn:0,fadeOut:0,onended:$h})}_startGain(t,e=1){dh(-1===this._startTime,"Source cannot be started more than once");const n=this.toSeconds(this._fadeIn);return this._startTime=t+n,this._startTime=Math.max(this._startTime,this.context.currentTime),n>0?(this._gainNode.gain.setValueAtTime(0,t),"linear"===this._curve?this._gainNode.gain.linearRampToValueAtTime(e,t+n):this._gainNode.gain.exponentialApproachValueAtTime(e,t,n)):this._gainNode.gain.setValueAtTime(e,t),this}stop(t){return this.log("stop",t),this._stopGain(this.toSeconds(t)),this}_stopGain(t){dh(-1!==this._startTime,"'start' must be called before 'stop'"),this.cancelStop();const e=this.toSeconds(this._fadeOut);return this._stopTime=this.toSeconds(t)+e,this._stopTime=Math.max(this._stopTime,this.now()),e>0?"linear"===this._curve?this._gainNode.gain.linearRampTo(0,e,t):this._gainNode.gain.targetRampTo(0,e,t):(this._gainNode.gain.cancelAndHoldAtTime(t),this._gainNode.gain.setValueAtTime(0,t)),this.context.clearTimeout(this._timeout),this._timeout=this.context.setTimeout(()=>{const t="exponential"===this._curve?2*e:0;this._stopSource(this.now()+t),this._onended()},this._stopTime-this.context.currentTime),this}_onended(){if(this.onended!==$h&&(this.onended(this),this.onended=$h,!this.context.isOffline)){const t=()=>this.dispose();"undefined"!=typeof requestIdleCallback?requestIdleCallback(t):setTimeout(t,10)}}get state(){return this.getStateAtTime(this.now())}cancelStop(){return this.log("cancelStop"),dh(-1!==this._startTime,"Source is not started"),this._gainNode.gain.cancelScheduledValues(this._startTime+this.sampleTime),this.context.clearTimeout(this._timeout),this._stopTime=-1,this}dispose(){return super.dispose(),this._gainNode.dispose(),this.onended=$h,this}}class od extends id{constructor(){const t=uh(od.getDefaults(),arguments,["offset"]);super(t),this.name="ToneConstantSource",this._source=this.context.createConstantSource(),ed(this._source,this._gainNode),this.offset=new Zh({context:this.context,convert:t.convert,param:this._source.offset,units:t.units,value:t.offset,minValue:t.minValue,maxValue:t.maxValue})}static getDefaults(){return Object.assign(id.getDefaults(),{convert:!0,offset:1,units:"number"})}start(t){const e=this.toSeconds(t);return this.log("start",e),this._startGain(e),this._source.start(e),this}_stopSource(t){this._source.stop(t)}dispose(){return super.dispose(),"started"===this.state&&this.stop(),this._source.disconnect(),this.offset.dispose(),this}}class sd extends Yh{constructor(){const t=uh(sd.getDefaults(),arguments,["value","units"]);super(t),this.name="Signal",this.override=!0,this.output=this._constantSource=new od({context:this.context,convert:t.convert,offset:t.value,units:t.units,minValue:t.minValue,maxValue:t.maxValue}),this._constantSource.start(0),this.input=this._param=this._constantSource.offset}static getDefaults(){return Object.assign(Yh.getDefaults(),{convert:!0,units:"number",value:0})}connect(t,e=0,n=0){return ad(this,t,e,n),this}dispose(){return super.dispose(),this._param.dispose(),this._constantSource.dispose(),this}setValueAtTime(t,e){return this._param.setValueAtTime(t,e),this}getValueAtTime(t){return this._param.getValueAtTime(t)}setRampPoint(t){return this._param.setRampPoint(t),this}linearRampToValueAtTime(t,e){return this._param.linearRampToValueAtTime(t,e),this}exponentialRampToValueAtTime(t,e){return this._param.exponentialRampToValueAtTime(t,e),this}exponentialRampTo(t,e,n){return this._param.exponentialRampTo(t,e,n),this}linearRampTo(t,e,n){return this._param.linearRampTo(t,e,n),this}targetRampTo(t,e,n){return this._param.targetRampTo(t,e,n),this}exponentialApproachValueAtTime(t,e,n){return this._param.exponentialApproachValueAtTime(t,e,n),this}setTargetAtTime(t,e,n){return this._param.setTargetAtTime(t,e,n),this}setValueCurveAtTime(t,e,n,r){return this._param.setValueCurveAtTime(t,e,n,r),this}cancelScheduledValues(t){return this._param.cancelScheduledValues(t),this}cancelAndHoldAtTime(t){return this._param.cancelAndHoldAtTime(t),this}rampTo(t,e,n){return this._param.rampTo(t,e,n),this}get value(){return this._param.value}set value(t){this._param.value=t}get convert(){return this._param.convert}set convert(t){this._param.convert=t}get units(){return this._param.units}get overridden(){return this._param.overridden}set overridden(t){this._param.overridden=t}get maxValue(){return this._param.maxValue}get minValue(){return this._param.minValue}apply(t){return this._param.apply(t),this}}function ad(t,e,n,r){(e instanceof Zh||Xl(e)||e instanceof sd&&e.override)&&(e.cancelScheduledValues(0),e.setValueAtTime(0,0),e instanceof sd&&(e.overridden=!0)),ed(t,e,n,r)}function ud(t,e=1/0){const n=new WeakMap;return function(r,i){Reflect.defineProperty(r,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(r){ph(r,t,e),n.set(this,r)}})}}function cd(t,e=1/0){const n=new WeakMap;return function(r,i){Reflect.defineProperty(r,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(r){ph(this.toSeconds(r),t,e),n.set(this,r)}})}}class ld extends Yh{constructor(){const t=uh(ld.getDefaults(),arguments,["attack","decay","sustain","release"]);super(t),this.name="Envelope",this._sig=new sd({context:this.context,value:0}),this.output=this._sig,this.input=void 0,this.attack=t.attack,this.decay=t.decay,this.sustain=t.sustain,this.release=t.release,this.attackCurve=t.attackCurve,this.releaseCurve=t.releaseCurve,this.decayCurve=t.decayCurve}static getDefaults(){return Object.assign(Yh.getDefaults(),{attack:.01,attackCurve:"linear",decay:.1,decayCurve:"exponential",release:1,releaseCurve:"exponential",sustain:.5})}get value(){return this.getValueAtTime(this.now())}_getCurve(t,e){if(ih(t))return t;{let n;for(n in hd)if(hd[n][e]===t)return n;return t}}_setCurve(t,e,n){if(ih(n)&&Reflect.has(hd,n)){const r=hd[n];nh(r)?"_decayCurve"!==t&&(this[t]=r[e]):this[t]=r}else{if(!rh(n)||"_decayCurve"===t)throw new Error("Envelope: invalid curve: "+n);this[t]=n}}get attackCurve(){return this._getCurve(this._attackCurve,"In")}set attackCurve(t){this._setCurve("_attackCurve","In",t)}get releaseCurve(){return this._getCurve(this._releaseCurve,"Out")}set releaseCurve(t){this._setCurve("_releaseCurve","Out",t)}get decayCurve(){return this._getCurve(this._decayCurve,"Out")}set decayCurve(t){this._setCurve("_decayCurve","Out",t)}triggerAttack(t,e=1){this.log("triggerAttack",t,e),t=this.toSeconds(t);let n=this.toSeconds(this.attack);const r=this.toSeconds(this.decay),i=this.getValueAtTime(t);if(i>0){n=(1-i)/(1/n)}if(n<this.sampleTime)this._sig.cancelScheduledValues(t),this._sig.setValueAtTime(e,t);else if("linear"===this._attackCurve)this._sig.linearRampTo(e,n,t);else if("exponential"===this._attackCurve)this._sig.targetRampTo(e,n,t);else{this._sig.cancelAndHoldAtTime(t);let r=this._attackCurve;for(let t=1;t<r.length;t++)if(r[t-1]<=i&&i<=r[t]){r=this._attackCurve.slice(t),r[0]=i;break}this._sig.setValueCurveAtTime(r,t,n,e)}if(r&&this.sustain<1){const i=e*this.sustain,o=t+n;this.log("decay",o),"linear"===this._decayCurve?this._sig.linearRampToValueAtTime(i,r+o):this._sig.exponentialApproachValueAtTime(i,o,r)}return this}triggerRelease(t){this.log("triggerRelease",t),t=this.toSeconds(t);const e=this.getValueAtTime(t);if(e>0){const n=this.toSeconds(this.release);n<this.sampleTime?this._sig.setValueAtTime(0,t):"linear"===this._releaseCurve?this._sig.linearRampTo(0,n,t):"exponential"===this._releaseCurve?this._sig.targetRampTo(0,n,t):(dh(rh(this._releaseCurve),"releaseCurve must be either 'linear', 'exponential' or an array"),this._sig.cancelAndHoldAtTime(t),this._sig.setValueCurveAtTime(this._releaseCurve,t,n,e))}return this}getValueAtTime(t){return this._sig.getValueAtTime(t)}triggerAttackRelease(t,e,n=1){return e=this.toSeconds(e),this.triggerAttack(e,n),this.triggerRelease(e+this.toSeconds(t)),this}cancel(t){return this._sig.cancelScheduledValues(this.toSeconds(t)),this}connect(t,e=0,n=0){return ad(this,t,e,n),this}asArray(){return a(this,arguments,void 0,function*(t=1024){const e=t/this.context.sampleRate,n=new qh(1,e,this.context.sampleRate),r=this.toSeconds(this.attack)+this.toSeconds(this.decay),i=r+this.toSeconds(this.release),o=.1*i,s=i+o,a=new this.constructor(Object.assign(this.get(),{attack:e*this.toSeconds(this.attack)/s,decay:e*this.toSeconds(this.decay)/s,release:e*this.toSeconds(this.release)/s,context:n}));a._sig.toDestination(),a.triggerAttackRelease(e*(r+o)/s,0);return(yield n.render()).getChannelData(0)})}dispose(){return super.dispose(),this._sig.dispose(),this}}s([cd(0)],ld.prototype,"attack",void 0),s([cd(0)],ld.prototype,"decay",void 0),s([ud(0,1)],ld.prototype,"sustain",void 0),s([cd(0)],ld.prototype,"release",void 0);const hd=(()=>{const t=128;let e,n;const r=[];for(e=0;e<t;e++)r[e]=Math.sin(e/127*(Math.PI/2));const i=[];for(e=0;e<127;e++){n=e/127;const t=Math.sin(n*(2*Math.PI)*6.4-Math.PI/2)+1;i[e]=t/10+.83*n}i[127]=1;const o=[];for(e=0;e<t;e++)o[e]=Math.ceil(e/127*5)/5;const s=[];for(e=0;e<t;e++)n=e/127,s[e]=.5*(1-Math.cos(Math.PI*n));const a=[];for(e=0;e<t;e++){n=e/127;const t=4*Math.pow(n,3)+.2,r=Math.cos(t*Math.PI*2*n);a[e]=Math.abs(r*(1-n))}function u(t){const e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=1-t[n];return e}return{bounce:{In:u(a),Out:a},cosine:{In:r,Out:(c=r,c.slice(0).reverse())},exponential:"exponential",linear:"linear",ripple:{In:i,Out:u(i)},sine:{In:s,Out:u(s)},step:{In:o,Out:u(o)}};var c})();class dd extends ld{constructor(){super(uh(dd.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="AmplitudeEnvelope",this._gainNode=new rd({context:this.context,gain:0}),this.output=this._gainNode,this.input=this._gainNode,this._sig.connect(this._gainNode.gain),this.output=this._gainNode,this.input=this._gainNode}dispose(){return super.dispose(),this._gainNode.dispose(),this}}class pd extends Yh{constructor(){const t=uh(pd.getDefaults(),arguments,["volume"]);super(t),this.name="Volume",this.input=this.output=new rd({context:this.context,gain:t.volume,units:"decibels"}),this.volume=this.output.gain,Lh(this,"volume"),this._unmutedVolume=t.volume,this.mute=t.mute}static getDefaults(){return Object.assign(Yh.getDefaults(),{mute:!1,volume:0})}get mute(){return this.volume.value===-1/0}set mute(t){!this.mute&&t?(this._unmutedVolume=this.volume.value,this.volume.value=-1/0):this.mute&&!t&&(this.volume.value=this._unmutedVolume)}dispose(){return super.dispose(),this.input.dispose(),this.volume.dispose(),this}}class fd extends Yh{constructor(){const t=uh(fd.getDefaults(),arguments);super(t),this.name="Destination",this.input=new pd({context:this.context}),this.output=new rd({context:this.context}),this.volume=this.input.volume,td(this.input,this.output,this.context.rawContext.destination),this.mute=t.mute,this._internalChannels=[this.input,this.context.rawContext.destination,this.output]}static getDefaults(){return Object.assign(Yh.getDefaults(),{mute:!1,volume:0})}get mute(){return this.input.mute}set mute(t){this.input.mute=t}chain(...t){return this.input.disconnect(),t.unshift(this.input),t.push(this.output),td(...t),this}get maxChannelCount(){return this.context.rawContext.destination.maxChannelCount}dispose(){return super.dispose(),this.volume.dispose(),this}}Nh(t=>{t.destination=new fd({context:t})}),jh(t=>{t.destination.dispose()});class md extends xh{constructor(t){super(),this.name="TimelineValue",this._timeline=new Oh({memory:10}),this._initialValue=t}set(t,e){return this._timeline.add({value:t,time:e}),this}get(t){const e=this._timeline.get(t);return e?e.value:this._initialValue}}class gd extends Yh{constructor(){super(uh(gd.getDefaults(),arguments,["context"]))}connect(t,e=0,n=0){return ad(this,t,e,n),this}}class _d extends gd{constructor(){const t=uh(_d.getDefaults(),arguments,["mapping","length"]);super(t),this.name="WaveShaper",this._shaper=this.context.createWaveShaper(),this.input=this._shaper,this.output=this._shaper,rh(t.mapping)||t.mapping instanceof Float32Array?this.curve=Float32Array.from(t.mapping):"function"==typeof t.mapping&&this.setMap(t.mapping,t.length)}static getDefaults(){return Object.assign(sd.getDefaults(),{length:1024})}setMap(t,e=1024){const n=new Float32Array(e);for(let r=0,i=e;r<i;r++){const e=r/(i-1)*2-1;n[r]=t(e,r)}return this.curve=n,this}get curve(){return this._shaper.curve}set curve(t){this._shaper.curve=t}get oversample(){return this._shaper.oversample}set oversample(t){const e=["none","2x","4x"].some(e=>e.includes(t));dh(e,"oversampling must be either 'none', '2x', or '4x'"),this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.disconnect(),this}}class yd extends gd{constructor(){const t=uh(yd.getDefaults(),arguments,["value"]);super(t),this.name="Pow",this._exponentScaler=this.input=this.output=new _d({context:this.context,mapping:this._expFunc(t.value),length:8192}),this._exponent=t.value}static getDefaults(){return Object.assign(gd.getDefaults(),{value:1})}_expFunc(t){return e=>Math.pow(Math.abs(e),t)}get value(){return this._exponent}set value(t){this._exponent=t,this._exponentScaler.setMap(this._expFunc(this._exponent))}dispose(){return super.dispose(),this._exponentScaler.dispose(),this}}class vd extends Kh{constructor(){super(...arguments),this.name="Ticks",this.defaultUnits="i"}_now(){return this.context.transport.ticks}_beatsToUnits(t){return this._getPPQ()*t}_secondsToUnits(t){return Math.floor(t/(60/this._getBpm())*this._getPPQ())}_ticksToUnits(t){return t}toTicks(){return this.valueOf()}toSeconds(){return this.valueOf()/this._getPPQ()*(60/this._getBpm())}}class bd extends xh{constructor(){super(...arguments),this.name="IntervalTimeline",this._root=null,this._length=0}add(t){dh(th(t.time),"Events must have a time property"),dh(th(t.duration),"Events must have a duration parameter"),t.time=t.time.valueOf();let e=new wd(t.time,t.time+t.duration,t);for(null===this._root?this._root=e:this._root.insert(e),this._length++;null!==e;)e.updateHeight(),e.updateMax(),this._rebalance(e),e=e.parent;return this}remove(t){if(null!==this._root){const e=[];this._root.search(t.time,e);for(const n of e)if(n.event===t){this._removeNode(n),this._length--;break}}return this}get length(){return this._length}cancel(t){return this.forEachFrom(t,t=>this.remove(t)),this}_setRoot(t){this._root=t,null!==this._root&&(this._root.parent=null)}_replaceNodeInParent(t,e){null!==t.parent?(t.isLeftChild()?t.parent.left=e:t.parent.right=e,this._rebalance(t.parent)):this._setRoot(e)}_removeNode(t){if(null===t.left&&null===t.right)this._replaceNodeInParent(t,null);else if(null===t.right)this._replaceNodeInParent(t,t.left);else if(null===t.left)this._replaceNodeInParent(t,t.right);else{let e,n=null;if(t.getBalance()>0)if(null===t.left.right)e=t.left,e.right=t.right,n=e;else{for(e=t.left.right;null!==e.right;)e=e.right;e.parent&&(e.parent.right=e.left,n=e.parent,e.left=t.left,e.right=t.right)}else if(null===t.right.left)e=t.right,e.left=t.left,n=e;else{for(e=t.right.left;null!==e.left;)e=e.left;e.parent&&(e.parent.left=e.right,n=e.parent,e.left=t.left,e.right=t.right)}null!==t.parent?t.isLeftChild()?t.parent.left=e:t.parent.right=e:this._setRoot(e),n&&this._rebalance(n)}t.dispose()}_rotateLeft(t){const e=t.parent,n=t.isLeftChild(),r=t.right;r&&(t.right=r.left,r.left=t),null!==e?n?e.left=r:e.right=r:this._setRoot(r)}_rotateRight(t){const e=t.parent,n=t.isLeftChild(),r=t.left;r&&(t.left=r.right,r.right=t),null!==e?n?e.left=r:e.right=r:this._setRoot(r)}_rebalance(t){const e=t.getBalance();e>1&&t.left?t.left.getBalance()<0?this._rotateLeft(t.left):this._rotateRight(t):e<-1&&t.right&&(t.right.getBalance()>0?this._rotateRight(t.right):this._rotateLeft(t))}get(t){if(null!==this._root){const e=[];if(this._root.search(t,e),e.length>0){let t=e[0];for(let n=1;n<e.length;n++)e[n].low>t.low&&(t=e[n]);return t.event}}return null}forEach(t){if(null!==this._root){const e=[];this._root.traverse(t=>e.push(t)),e.forEach(e=>{e.event&&t(e.event)})}return this}forEachAtTime(t,e){if(null!==this._root){const n=[];this._root.search(t,n),n.forEach(t=>{t.event&&e(t.event)})}return this}forEachFrom(t,e){if(null!==this._root){const n=[];this._root.searchAfter(t,n),n.forEach(t=>{t.event&&e(t.event)})}return this}dispose(){return super.dispose(),null!==this._root&&this._root.traverse(t=>t.dispose()),this._root=null,this}}class wd{constructor(t,e,n){this._left=null,this._right=null,this.parent=null,this.height=0,this.event=n,this.low=t,this.high=e,this.max=this.high}insert(t){t.low<=this.low?null===this.left?this.left=t:this.left.insert(t):null===this.right?this.right=t:this.right.insert(t)}search(t,e){t>this.max||(null!==this.left&&this.left.search(t,e),this.low<=t&&this.high>t&&e.push(this),this.low>t||null!==this.right&&this.right.search(t,e))}searchAfter(t,e){this.low>=t&&(e.push(this),null!==this.left&&this.left.searchAfter(t,e)),null!==this.right&&this.right.searchAfter(t,e)}traverse(t){t(this),null!==this.left&&this.left.traverse(t),null!==this.right&&this.right.traverse(t)}updateHeight(){null!==this.left&&null!==this.right?this.height=Math.max(this.left.height,this.right.height)+1:null!==this.right?this.height=this.right.height+1:null!==this.left?this.height=this.left.height+1:this.height=0}updateMax(){this.max=this.high,null!==this.left&&(this.max=Math.max(this.max,this.left.max)),null!==this.right&&(this.max=Math.max(this.max,this.right.max))}getBalance(){let t=0;return null!==this.left&&null!==this.right?t=this.left.height-this.right.height:null!==this.left?t=this.left.height+1:null!==this.right&&(t=-(this.right.height+1)),t}isLeftChild(){return null!==this.parent&&this.parent.left===this}get left(){return this._left}set left(t){this._left=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}get right(){return this._right}set right(t){this._right=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}dispose(){this.parent=null,this._left=null,this._right=null,this.event=null}}class xd extends Oh{constructor(t="stopped"){super(),this.name="StateTimeline",this._initial=t,this.setStateAtTime(this._initial,0)}getValueAtTime(t){const e=this.get(t);return null!==e?e.state:this._initial}setStateAtTime(t,e,n){return ph(e,0),this.add(Object.assign({},n,{state:t,time:e})),this}getLastState(t,e){for(let n=this._search(e);n>=0;n--){const e=this._timeline[n];if(e.state===t)return e}}getNextState(t,e){const n=this._search(e);if(-1!==n)for(let e=n;e<this._timeline.length;e++){const n=this._timeline[e];if(n.state===t)return n}}}class Td extends Zh{constructor(){const t=uh(Td.getDefaults(),arguments,["value"]);super(t),this.name="TickParam",this._events=new Oh(1/0),this._multiplier=1,this._multiplier=t.multiplier,this._events.cancel(0),this._events.add({ticks:0,time:0,type:"setValueAtTime",value:this._fromType(t.value)}),this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(Zh.getDefaults(),{multiplier:1,units:"hertz",value:1})}setTargetAtTime(t,e,n){e=this.toSeconds(e),this.setRampPoint(e);const r=this._fromType(t),i=this._events.get(e),o=Math.round(Math.max(1/n,1));for(let t=0;t<=o;t++){const o=n*t+e,s=this._exponentialApproach(i.time,i.value,r,n,o);this.linearRampToValueAtTime(this._toType(s),o)}return this}setValueAtTime(t,e){const n=this.toSeconds(e);super.setValueAtTime(t,e);const r=this._events.get(n),i=this._events.previousEvent(r),o=this._getTicksUntilEvent(i,n);return r.ticks=Math.max(o,0),this}linearRampToValueAtTime(t,e){const n=this.toSeconds(e);super.linearRampToValueAtTime(t,e);const r=this._events.get(n),i=this._events.previousEvent(r),o=this._getTicksUntilEvent(i,n);return r.ticks=Math.max(o,0),this}exponentialRampToValueAtTime(t,e){e=this.toSeconds(e);const n=this._fromType(t),r=this._events.get(e),i=Math.round(Math.max(10*(e-r.time),1)),o=(e-r.time)/i;for(let t=0;t<=i;t++){const i=o*t+r.time,s=this._exponentialInterpolate(r.time,r.value,e,n,i);this.linearRampToValueAtTime(this._toType(s),i)}return this}_getTicksUntilEvent(t,e){if(null===t)t={ticks:0,time:0,type:"setValueAtTime",value:0};else if(Yl(t.ticks)){const e=this._events.previousEvent(t);t.ticks=this._getTicksUntilEvent(e,t.time)}const n=this._fromType(this.getValueAtTime(t.time));let r=this._fromType(this.getValueAtTime(e));const i=this._events.get(e);return i&&i.time===e&&"setValueAtTime"===i.type&&(r=this._fromType(this.getValueAtTime(e-this.sampleTime))),.5*(e-t.time)*(n+r)+t.ticks}getTicksAtTime(t){const e=this.toSeconds(t),n=this._events.get(e);return Math.max(this._getTicksUntilEvent(n,e),0)}getDurationOfTicks(t,e){const n=this.toSeconds(e),r=this.getTicksAtTime(e);return this.getTimeOfTick(r+t)-n}getTimeOfTick(t){const e=this._events.get(t,"ticks"),n=this._events.getAfter(t,"ticks");if(e&&e.ticks===t)return e.time;if(e&&n&&"linearRampToValueAtTime"===n.type&&e.value!==n.value){const r=this._fromType(this.getValueAtTime(e.time)),i=(this._fromType(this.getValueAtTime(n.time))-r)/(n.time-e.time),o=Math.sqrt(Math.pow(r,2)-2*i*(e.ticks-t)),s=(-r+o)/i;return(s>0?s:(-r-o)/i)+e.time}return e?0===e.value?1/0:e.time+(t-e.ticks)/e.value:t/this._initialValue}ticksToTime(t,e){return this.getDurationOfTicks(t,e)}timeToTicks(t,e){const n=this.toSeconds(e),r=this.toSeconds(t),i=this.getTicksAtTime(n);return this.getTicksAtTime(n+r)-i}_fromType(t){return"bpm"===this.units&&this.multiplier?1/(60/t/this.multiplier):super._fromType(t)}_toType(t){return"bpm"===this.units&&this.multiplier?t/this.multiplier*60:super._toType(t)}get multiplier(){return this._multiplier}set multiplier(t){const e=this.value;this._multiplier=t,this.cancelScheduledValues(0),this.setValueAtTime(e,0)}}class kd extends sd{constructor(){const t=uh(kd.getDefaults(),arguments,["value"]);super(t),this.name="TickSignal",this.input=this._param=new Td({context:this.context,convert:t.convert,multiplier:t.multiplier,param:this._constantSource.offset,units:t.units,value:t.value})}static getDefaults(){return Object.assign(sd.getDefaults(),{multiplier:1,units:"hertz",value:1})}ticksToTime(t,e){return this._param.ticksToTime(t,e)}timeToTicks(t,e){return this._param.timeToTicks(t,e)}getTimeOfTick(t){return this._param.getTimeOfTick(t)}getDurationOfTicks(t,e){return this._param.getDurationOfTicks(t,e)}getTicksAtTime(t){return this._param.getTicksAtTime(t)}get multiplier(){return this._param.multiplier}set multiplier(t){this._param.multiplier=t}dispose(){return super.dispose(),this._param.dispose(),this}}class Sd extends Qh{constructor(){const t=uh(Sd.getDefaults(),arguments,["frequency"]);super(t),this.name="TickSource",this._state=new xd,this._tickOffset=new Oh,this._ticksAtTime=new Oh,this._secondsAtTime=new Oh,this.frequency=new kd({context:this.context,units:t.units,value:t.frequency}),Lh(this,"frequency"),this._state.setStateAtTime("stopped",0),this.setTicksAtTime(0,0)}static getDefaults(){return Object.assign({frequency:1,units:"hertz"},Qh.getDefaults())}get state(){return this.getStateAtTime(this.now())}start(t,e){const n=this.toSeconds(t);return"started"!==this._state.getValueAtTime(n)&&(this._state.setStateAtTime("started",n),th(e)&&this.setTicksAtTime(e,n),this._ticksAtTime.cancel(n),this._secondsAtTime.cancel(n)),this}stop(t){const e=this.toSeconds(t);if("stopped"===this._state.getValueAtTime(e)){const t=this._state.get(e);t&&t.time>0&&(this._tickOffset.cancel(t.time),this._state.cancel(t.time))}return this._state.cancel(e),this._state.setStateAtTime("stopped",e),this.setTicksAtTime(0,e),this._ticksAtTime.cancel(e),this._secondsAtTime.cancel(e),this}pause(t){const e=this.toSeconds(t);return"started"===this._state.getValueAtTime(e)&&(this._state.setStateAtTime("paused",e),this._ticksAtTime.cancel(e),this._secondsAtTime.cancel(e)),this}cancel(t){return t=this.toSeconds(t),this._state.cancel(t),this._tickOffset.cancel(t),this._ticksAtTime.cancel(t),this._secondsAtTime.cancel(t),this}getTicksAtTime(t){const e=this.toSeconds(t),n=this._state.getLastState("stopped",e),r=this._ticksAtTime.get(e),i={state:"paused",time:e};this._state.add(i);let o=r||n,s=r?r.ticks:0,a=null;return this._state.forEachBetween(o.time,e+this.sampleTime,t=>{let e=o.time;const n=this._tickOffset.get(t.time);n&&n.time>=o.time&&(s=n.ticks,e=n.time),"started"===o.state&&"started"!==t.state&&(s+=this.frequency.getTicksAtTime(t.time)-this.frequency.getTicksAtTime(e),t.time!==i.time&&(a={state:t.state,time:t.time,ticks:s})),o=t}),this._state.remove(i),a&&this._ticksAtTime.add(a),s}get ticks(){return this.getTicksAtTime(this.now())}set ticks(t){this.setTicksAtTime(t,this.now())}get seconds(){return this.getSecondsAtTime(this.now())}set seconds(t){const e=this.now(),n=this.frequency.timeToTicks(t,e);this.setTicksAtTime(n,e)}getSecondsAtTime(t){t=this.toSeconds(t);const e=this._state.getLastState("stopped",t),n={state:"paused",time:t};this._state.add(n);const r=this._secondsAtTime.get(t);let i=r||e,o=r?r.seconds:0,s=null;return this._state.forEachBetween(i.time,t+this.sampleTime,t=>{let e=i.time;const r=this._tickOffset.get(t.time);r&&r.time>=i.time&&(o=r.seconds,e=r.time),"started"===i.state&&"started"!==t.state&&(o+=t.time-e,t.time!==n.time&&(s={state:t.state,time:t.time,seconds:o})),i=t}),this._state.remove(n),s&&this._secondsAtTime.add(s),o}setTicksAtTime(t,e){return e=this.toSeconds(e),this._tickOffset.cancel(e),this._tickOffset.add({seconds:this.frequency.getDurationOfTicks(t,e),ticks:t,time:e}),this._ticksAtTime.cancel(e),this._secondsAtTime.cancel(e),this}getStateAtTime(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)}getTimeOfTick(t,e=this.now()){const n=this._tickOffset.get(e),r=this._state.get(e),i=Math.max(n.time,r.time),o=this.frequency.getTicksAtTime(i)+t-n.ticks;return this.frequency.getTimeOfTick(o)}forEachTickBetween(t,e,n){let r=this._state.get(t);this._state.forEachBetween(t,e,e=>{r&&"started"===r.state&&"started"!==e.state&&this.forEachTickBetween(Math.max(r.time,t),e.time-this.sampleTime,n),r=e});let i=null;if(r&&"started"===r.state){const o=Math.max(r.time,t),s=this.frequency.getTicksAtTime(o),a=s-this.frequency.getTicksAtTime(r.time);let u=Math.ceil(a)-a;u=Eh(u,1)?0:u;let c=this.frequency.getTimeOfTick(s+u);for(;c<e;){try{n(c,Math.round(this.getTicksAtTime(c)))}catch(t){i=t;break}c+=this.frequency.getDurationOfTicks(1,c)}}if(i)throw i;return this}dispose(){return super.dispose(),this._state.dispose(),this._tickOffset.dispose(),this._ticksAtTime.dispose(),this._secondsAtTime.dispose(),this.frequency.dispose(),this}}class Ad extends Qh{constructor(){const t=uh(Ad.getDefaults(),arguments,["callback","frequency"]);super(t),this.name="Clock",this.callback=$h,this._lastUpdate=0,this._state=new xd("stopped"),this._boundLoop=this._loop.bind(this),this.callback=t.callback,this._tickSource=new Sd({context:this.context,frequency:t.frequency,units:t.units}),this._lastUpdate=0,this.frequency=this._tickSource.frequency,Lh(this,"frequency"),this._state.setStateAtTime("stopped",0),this.context.on("tick",this._boundLoop)}static getDefaults(){return Object.assign(Qh.getDefaults(),{callback:$h,frequency:1,units:"hertz"})}get state(){return this._state.getValueAtTime(this.now())}start(t,e){fh(this.context);const n=this.toSeconds(t);return this.log("start",n),"started"!==this._state.getValueAtTime(n)&&(this._state.setStateAtTime("started",n),this._tickSource.start(n,e),n<this._lastUpdate&&this.emit("start",n,e)),this}stop(t){const e=this.toSeconds(t);return this.log("stop",e),this._state.cancel(e),this._state.setStateAtTime("stopped",e),this._tickSource.stop(e),e<this._lastUpdate&&this.emit("stop",e),this}pause(t){const e=this.toSeconds(t);return"started"===this._state.getValueAtTime(e)&&(this._state.setStateAtTime("paused",e),this._tickSource.pause(e),e<this._lastUpdate&&this.emit("pause",e)),this}get ticks(){return Math.ceil(this.getTicksAtTime(this.now()))}set ticks(t){this._tickSource.ticks=t}get seconds(){return this._tickSource.seconds}set seconds(t){this._tickSource.seconds=t}getSecondsAtTime(t){return this._tickSource.getSecondsAtTime(t)}setTicksAtTime(t,e){return this._tickSource.setTicksAtTime(t,e),this}getTimeOfTick(t,e=this.now()){return this._tickSource.getTimeOfTick(t,e)}getTicksAtTime(t){return this._tickSource.getTicksAtTime(t)}nextTickTime(t,e){const n=this.toSeconds(e),r=this.getTicksAtTime(n);return this._tickSource.getTimeOfTick(r+t,n)}_loop(){const t=this._lastUpdate,e=this.now();this._lastUpdate=e,this.log("loop",t,e),t!==e&&(this._state.forEachBetween(t,e,t=>{switch(t.state){case"started":const e=this._tickSource.getTicksAtTime(t.time);this.emit("start",t.time,e);break;case"stopped":0!==t.time&&this.emit("stop",t.time);break;case"paused":this.emit("pause",t.time)}}),this._tickSource.forEachTickBetween(t,e,(t,e)=>{this.callback(t,e)}))}getStateAtTime(t){const e=this.toSeconds(t);return this._state.getValueAtTime(e)}dispose(){return super.dispose(),this.context.off("tick",this._boundLoop),this._tickSource.dispose(),this._state.dispose(),this}}Rh.mixin(Ad);class Ed{constructor(t,e){this.id=Ed._eventId++,this._remainderTime=0;const n=Object.assign(Ed.getDefaults(),e);this.transport=t,this.callback=n.callback,this._once=n.once,this.time=Math.floor(n.time),this._remainderTime=n.time-this.time}static getDefaults(){return{callback:$h,once:!1,time:0}}get floatTime(){return this.time+this._remainderTime}invoke(t){if(this.callback){const e=this.transport.bpm.getDurationOfTicks(1,t);this.callback(t+this._remainderTime*e),this._once&&this.transport.clear(this.id)}}dispose(){return this.callback=void 0,this}}Ed._eventId=0;class Od extends Ed{constructor(t,e){super(t,e),this._currentId=-1,this._nextId=-1,this._nextTick=this.time,this._boundRestart=this._restart.bind(this);const n=Object.assign(Od.getDefaults(),e);this.duration=n.duration,this._interval=n.interval,this._nextTick=n.time,this.transport.on("start",this._boundRestart),this.transport.on("loopStart",this._boundRestart),this.transport.on("ticks",this._boundRestart),this.context=this.transport.context,this._restart()}static getDefaults(){return Object.assign({},Ed.getDefaults(),{duration:1/0,interval:1,once:!1})}invoke(t){this._createEvents(t),super.invoke(t)}_createEvent(){return Ah(this._nextTick,this.floatTime+this.duration)?this.transport.scheduleOnce(this.invoke.bind(this),new vd(this.context,this._nextTick).toSeconds()):-1}_createEvents(t){Ah(this._nextTick+this._interval,this.floatTime+this.duration)&&(this._nextTick+=this._interval,this._currentId=this._nextId,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new vd(this.context,this._nextTick).toSeconds()))}_restart(t){this.transport.clear(this._currentId),this.transport.clear(this._nextId),this._nextTick=this.floatTime;const e=this.transport.getTicksAtTime(t);kh(e,this.time)&&(this._nextTick=this.floatTime+Math.ceil((e-this.floatTime)/this._interval)*this._interval),this._currentId=this._createEvent(),this._nextTick+=this._interval,this._nextId=this._createEvent()}dispose(){return super.dispose(),this.transport.clear(this._currentId),this.transport.clear(this._nextId),this.transport.off("start",this._boundRestart),this.transport.off("loopStart",this._boundRestart),this.transport.off("ticks",this._boundRestart),this}}class Cd extends Qh{constructor(){const t=uh(Cd.getDefaults(),arguments);super(t),this.name="Transport",this._loop=new md(!1),this._loopStart=0,this._loopEnd=0,this._scheduledEvents={},this._timeline=new Oh,this._repeatedEvents=new bd,this._syncedSignals=[],this._swingAmount=0,this._ppq=t.ppq,this._clock=new Ad({callback:this._processTick.bind(this),context:this.context,frequency:0,units:"bpm"}),this._bindClockEvents(),this.bpm=this._clock.frequency,this._clock.frequency.multiplier=t.ppq,this.bpm.setValueAtTime(t.bpm,0),Lh(this,"bpm"),this._timeSignature=t.timeSignature,this._swingTicks=t.ppq/2}static getDefaults(){return Object.assign(Qh.getDefaults(),{bpm:120,loopEnd:"4m",loopStart:0,ppq:192,swing:0,swingSubdivision:"8n",timeSignature:4})}_processTick(t,e){if(this._loop.get(t)&&e>=this._loopEnd&&(this.emit("loopEnd",t),this._clock.setTicksAtTime(this._loopStart,t),e=this._loopStart,this.emit("loopStart",t,this._clock.getSecondsAtTime(t)),this.emit("loop",t)),this._swingAmount>0&&e%this._ppq!==0&&e%(2*this._swingTicks)!=0){const n=e%(2*this._swingTicks)/(2*this._swingTicks),r=Math.sin(n*Math.PI)*this._swingAmount;t+=new vd(this.context,2*this._swingTicks/3).toSeconds()*r}_h(!0),this._timeline.forEachAtTime(e,e=>e.invoke(t)),_h(!1)}schedule(t,e){const n=new Ed(this,{callback:t,time:new Kh(this.context,e).toTicks()});return this._addEvent(n,this._timeline)}scheduleRepeat(t,e,n,r=1/0){const i=new Od(this,{callback:t,duration:new Wh(this.context,r).toTicks(),interval:new Wh(this.context,e).toTicks(),time:new Kh(this.context,n).toTicks()});return this._addEvent(i,this._repeatedEvents)}scheduleOnce(t,e){const n=new Ed(this,{callback:t,once:!0,time:new Kh(this.context,e).toTicks()});return this._addEvent(n,this._timeline)}clear(t){if(this._scheduledEvents.hasOwnProperty(t)){const e=this._scheduledEvents[t.toString()];e.timeline.remove(e.event),e.event.dispose(),delete this._scheduledEvents[t.toString()]}return this}_addEvent(t,e){return this._scheduledEvents[t.id.toString()]={event:t,timeline:e},e.add(t),t.id}cancel(t=0){const e=this.toTicks(t);return this._timeline.forEachFrom(e,t=>this.clear(t.id)),this._repeatedEvents.forEachFrom(e,t=>this.clear(t.id)),this}_bindClockEvents(){this._clock.on("start",(t,e)=>{e=new vd(this.context,e).toSeconds(),this.emit("start",t,e)}),this._clock.on("stop",t=>{this.emit("stop",t)}),this._clock.on("pause",t=>{this.emit("pause",t)})}get state(){return this._clock.getStateAtTime(this.now())}start(t,e){let n;return this.context.resume(),th(e)&&(n=this.toTicks(e)),this._clock.start(t,n),this}stop(t){return this._clock.stop(t),this}pause(t){return this._clock.pause(t),this}toggle(t){return t=this.toSeconds(t),"started"!==this._clock.getStateAtTime(t)?this.start(t):this.stop(t),this}get timeSignature(){return this._timeSignature}set timeSignature(t){rh(t)&&(t=t[0]/t[1]*4),this._timeSignature=t}get loopStart(){return new Wh(this.context,this._loopStart,"i").toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t)}get loopEnd(){return new Wh(this.context,this._loopEnd,"i").toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t)}get loop(){return this._loop.get(this.now())}set loop(t){this._loop.set(t,this.now())}setLoopPoints(t,e){return this.loopStart=t,this.loopEnd=e,this}get swing(){return this._swingAmount}set swing(t){this._swingAmount=t}get swingSubdivision(){return new vd(this.context,this._swingTicks).toNotation()}set swingSubdivision(t){this._swingTicks=this.toTicks(t)}get position(){const t=this.now(),e=this._clock.getTicksAtTime(t);return new vd(this.context,e).toBarsBeatsSixteenths()}set position(t){const e=this.toTicks(t);this.ticks=e}get seconds(){return this._clock.seconds}set seconds(t){const e=this.now(),n=this._clock.frequency.timeToTicks(t,e);this.ticks=n}get progress(){if(this.loop){const t=this.now();return(this._clock.getTicksAtTime(t)-this._loopStart)/(this._loopEnd-this._loopStart)}return 0}get ticks(){return this._clock.ticks}set ticks(t){if(this._clock.ticks!==t){const e=this.now();if("started"===this.state){const n=this._clock.getTicksAtTime(e),r=e+this._clock.frequency.getDurationOfTicks(Math.ceil(n)-n,e);this.emit("stop",r),this._clock.setTicksAtTime(t,r),this.emit("start",r,this._clock.getSecondsAtTime(r))}else this.emit("ticks",e),this._clock.setTicksAtTime(t,e)}}getTicksAtTime(t){return this._clock.getTicksAtTime(t)}getSecondsAtTime(t){return this._clock.getSecondsAtTime(t)}get PPQ(){return this._clock.frequency.multiplier}set PPQ(t){this._clock.frequency.multiplier=t}nextSubdivision(t){if(t=this.toTicks(t),"started"!==this.state)return 0;{const e=this.now(),n=t-this.getTicksAtTime(e)%t;return this._clock.nextTickTime(n,e)}}syncSignal(t,e){const n=this.now();let r=this.bpm,i=1/(60/r.getValueAtTime(n)/this.PPQ),o=[];if("time"===t.units){const t=1/64/i,e=new rd(t),n=new yd(-1),s=new rd(t);r.chain(e,n,s),r=s,i=1/i,o=[e,n,s]}e||(e=0!==t.getValueAtTime(n)?t.getValueAtTime(n)/i:0);const s=new rd(e);return r.connect(s),s.connect(t._param),o.push(s),this._syncedSignals.push({initial:t.value,nodes:o,signal:t}),t.value=0,this}unsyncSignal(t){for(let e=this._syncedSignals.length-1;e>=0;e--){const n=this._syncedSignals[e];n.signal===t&&(n.nodes.forEach(t=>t.dispose()),n.signal.value=n.initial,this._syncedSignals.splice(e,1))}return this}dispose(){return super.dispose(),this._clock.dispose(),Fh(this,"bpm"),this._timeline.dispose(),this._repeatedEvents.dispose(),this}}Rh.mixin(Cd),Nh(t=>{t.transport=new Cd({context:t})}),jh(t=>{t.transport.dispose()});class Md extends Yh{constructor(t){super(t),this.input=void 0,this._state=new xd("stopped"),this._synced=!1,this._scheduled=[],this._syncedStart=$h,this._syncedStop=$h,this._state.memory=100,this._state.increasing=!0,this._volume=this.output=new pd({context:this.context,mute:t.mute,volume:t.volume}),this.volume=this._volume.volume,Lh(this,"volume"),this.onstop=t.onstop}static getDefaults(){return Object.assign(Yh.getDefaults(),{mute:!1,onstop:$h,volume:0})}get state(){return this._synced?"started"===this.context.transport.state?this._state.getValueAtTime(this.context.transport.seconds):"stopped":this._state.getValueAtTime(this.now())}get mute(){return this._volume.mute}set mute(t){this._volume.mute=t}_clampToCurrentTime(t){return this._synced?t:Math.max(t,this.context.currentTime)}start(t,e,n){let r=Yl(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(r=this._clampToCurrentTime(r),this._synced||"started"!==this._state.getValueAtTime(r))if(this.log("start",r),this._state.setStateAtTime("started",r),this._synced){const t=this._state.get(r);t&&(t.offset=this.toSeconds(ch(e,0)),t.duration=n?this.toSeconds(n):void 0);const i=this.context.transport.schedule(t=>{this._start(t,e,n)},r);this._scheduled.push(i),"started"===this.context.transport.state&&this.context.transport.getSecondsAtTime(this.immediate())>r&&this._syncedStart(this.now(),this.context.transport.seconds)}else fh(this.context),this._start(r,e,n);else dh(kh(r,this._state.get(r).time),"Start time must be strictly greater than previous start time"),this._state.cancel(r),this._state.setStateAtTime("started",r),this.log("restart",r),this.restart(r,e,n);return this}stop(t){let e=Yl(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(e=this._clampToCurrentTime(e),"started"===this._state.getValueAtTime(e)||th(this._state.getNextState("started",e))){if(this.log("stop",e),this._synced){const t=this.context.transport.schedule(this._stop.bind(this),e);this._scheduled.push(t)}else this._stop(e);this._state.cancel(e),this._state.setStateAtTime("stopped",e)}return this}restart(t,e,n){return t=this.toSeconds(t),"started"===this._state.getValueAtTime(t)&&(this._state.cancel(t),this._restart(t,e,n)),this}sync(){return this._synced||(this._synced=!0,this._syncedStart=(t,e)=>{if(kh(e,0)){const n=this._state.get(e);if(n&&"started"===n.state&&n.time!==e){const r=e-this.toSeconds(n.time);let i;n.duration&&(i=this.toSeconds(n.duration)-r),this._start(t,this.toSeconds(n.offset)+r,i)}}},this._syncedStop=t=>{const e=this.context.transport.getSecondsAtTime(Math.max(t-this.sampleTime,0));"started"===this._state.getValueAtTime(e)&&this._stop(t)},this.context.transport.on("start",this._syncedStart),this.context.transport.on("loopStart",this._syncedStart),this.context.transport.on("stop",this._syncedStop),this.context.transport.on("pause",this._syncedStop),this.context.transport.on("loopEnd",this._syncedStop)),this}unsync(){return this._synced&&(this.context.transport.off("stop",this._syncedStop),this.context.transport.off("pause",this._syncedStop),this.context.transport.off("loopEnd",this._syncedStop),this.context.transport.off("start",this._syncedStart),this.context.transport.off("loopStart",this._syncedStart)),this._synced=!1,this._scheduled.forEach(t=>this.context.transport.clear(t)),this._scheduled=[],this._state.cancel(0),this._stop(0),this}dispose(){return super.dispose(),this.onstop=$h,this.unsync(),this._volume.dispose(),this._state.dispose(),this}}class Nd extends gd{constructor(){super(...arguments),this.name="AudioToGain",this._norm=new _d({context:this.context,mapping:t=>(t+1)/2}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class Id extends sd{constructor(){const t=uh(Id.getDefaults(),arguments,["value"]);super(t),this.name="Multiply",this.override=!1,this._mult=this.input=this.output=new rd({context:this.context,minValue:t.minValue,maxValue:t.maxValue}),this.factor=this._param=this._mult.gain,this.factor.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(sd.getDefaults(),{value:0})}dispose(){return super.dispose(),this._mult.dispose(),this}}function jd(t,e){return a(this,void 0,void 0,function*(){const n=e/t.context.sampleRate,r=new qh(1,n,t.context.sampleRate);new t.constructor(Object.assign(t.get(),{frequency:2/n,detune:0,context:r})).toDestination().start(0);return(yield r.render()).getChannelData(0)})}class Rd extends id{constructor(){const t=uh(Rd.getDefaults(),arguments,["frequency","type"]);super(t),this.name="ToneOscillatorNode",this._oscillator=this.context.createOscillator(),this._internalChannels=[this._oscillator],ed(this._oscillator,this._gainNode),this.type=t.type,this.frequency=new Zh({context:this.context,param:this._oscillator.frequency,units:"frequency",value:t.frequency}),this.detune=new Zh({context:this.context,param:this._oscillator.detune,units:"cents",value:t.detune}),Lh(this,["frequency","detune"])}static getDefaults(){return Object.assign(id.getDefaults(),{detune:0,frequency:440,type:"sine"})}start(t){const e=this.toSeconds(t);return this.log("start",e),this._startGain(e),this._oscillator.start(e),this}_stopSource(t){this._oscillator.stop(t)}setPeriodicWave(t){return this._oscillator.setPeriodicWave(t),this}get type(){return this._oscillator.type}set type(t){this._oscillator.type=t}dispose(){return super.dispose(),"started"===this.state&&this.stop(),this._oscillator.disconnect(),this.frequency.dispose(),this.detune.dispose(),this}}class Pd extends Md{constructor(){const t=uh(Pd.getDefaults(),arguments,["frequency","type"]);super(t),this.name="Oscillator",this._oscillator=null,this.frequency=new sd({context:this.context,units:"frequency",value:t.frequency}),Lh(this,"frequency"),this.detune=new sd({context:this.context,units:"cents",value:t.detune}),Lh(this,"detune"),this._partials=t.partials,this._partialCount=t.partialCount,this._type=t.type,t.partialCount&&"custom"!==t.type&&(this._type=this.baseType+t.partialCount.toString()),this.phase=t.phase}static getDefaults(){return Object.assign(Md.getDefaults(),{detune:0,frequency:440,partialCount:0,partials:[],phase:0,type:"sine"})}_start(t){const e=this.toSeconds(t),n=new Rd({context:this.context,onended:()=>this.onstop(this)});this._oscillator=n,this._wave?this._oscillator.setPeriodicWave(this._wave):this._oscillator.type=this._type,this._oscillator.connect(this.output),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.start(e)}_stop(t){const e=this.toSeconds(t);this._oscillator&&this._oscillator.stop(e)}_restart(t){const e=this.toSeconds(t);return this.log("restart",e),this._oscillator&&this._oscillator.cancelStop(),this._state.cancel(e),this}syncFrequency(){return this.context.transport.syncSignal(this.frequency),this}unsyncFrequency(){return this.context.transport.unsyncSignal(this.frequency),this}_getCachedPeriodicWave(){if("custom"===this._type){return Pd._periodicWaveCache.find(t=>{return t.phase===this._phase&&(e=t.partials,n=this._partials,e.length===n.length&&e.every((t,e)=>n[e]===t));var e,n})}{const t=Pd._periodicWaveCache.find(t=>t.type===this._type&&t.phase===this._phase);return this._partialCount=t?t.partialCount:this._partialCount,t}}get type(){return this._type}set type(t){this._type=t;const e=-1!==["sine","square","sawtooth","triangle"].indexOf(t);if(0===this._phase&&e)this._wave=void 0,this._partialCount=0,null!==this._oscillator&&(this._oscillator.type=t);else{const e=this._getCachedPeriodicWave();if(th(e)){const{partials:t,wave:n}=e;this._wave=n,this._partials=t,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave)}else{const[e,n]=this._getRealImaginary(t,this._phase),r=this.context.createPeriodicWave(e,n);this._wave=r,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave),Pd._periodicWaveCache.push({imag:n,partialCount:this._partialCount,partials:this._partials,phase:this._phase,real:e,type:this._type,wave:this._wave}),Pd._periodicWaveCache.length>100&&Pd._periodicWaveCache.shift()}}}get baseType(){return this._type.replace(this.partialCount.toString(),"")}set baseType(t){this.partialCount&&"custom"!==this._type&&"custom"!==t?this.type=t+this.partialCount:this.type=t}get partialCount(){return this._partialCount}set partialCount(t){ph(t,0);let e=this._type;const n=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(this._type);if(n&&(e=n[1]),"custom"!==this._type)this.type=0===t?e:e+t.toString();else{const e=new Float32Array(t);this._partials.forEach((t,n)=>e[n]=t),this._partials=Array.from(e),this.type=this._type}}_getRealImaginary(t,e){let n=2048;const r=new Float32Array(n),i=new Float32Array(n);let o=1;if("custom"===t){if(o=this._partials.length+1,this._partialCount=this._partials.length,n=o,0===this._partials.length)return[r,i]}else{const e=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(t);e?(o=parseInt(e[2],10)+1,this._partialCount=parseInt(e[2],10),t=e[1],o=Math.max(o,2),n=o):this._partialCount=0,this._partials=[]}for(let s=1;s<n;++s){const n=2/(s*Math.PI);let a;switch(t){case"sine":a=s<=o?1:0,this._partials[s-1]=a;break;case"square":a=1&s?2*n:0,this._partials[s-1]=a;break;case"sawtooth":a=n*(1&s?1:-1),this._partials[s-1]=a;break;case"triangle":a=1&s?n*n*2*(s-1>>1&1?-1:1):0,this._partials[s-1]=a;break;case"custom":a=this._partials[s-1];break;default:throw new TypeError("Oscillator: invalid type: "+t)}0!==a?(r[s]=-a*Math.sin(e*s),i[s]=a*Math.cos(e*s)):(r[s]=0,i[s]=0)}return[r,i]}_inverseFFT(t,e,n){let r=0;const i=t.length;for(let o=0;o<i;o++)r+=t[o]*Math.cos(o*n)+e[o]*Math.sin(o*n);return r}getInitialValue(){const[t,e]=this._getRealImaginary(this._type,0);let n=0;const r=2*Math.PI;for(let i=0;i<32;i++)n=Math.max(this._inverseFFT(t,e,i/32*r),n);return function(t,e,n){return Math.max(Math.min(t,n),e)}(-this._inverseFFT(t,e,this._phase)/n,-1,1)}get partials(){return this._partials.slice(0,this.partialCount)}set partials(t){this._partials=t,this._partialCount=this._partials.length,t.length&&(this.type="custom")}get phase(){return this._phase*(180/Math.PI)}set phase(t){this._phase=t*Math.PI/180,this.type=this._type}asArray(){return a(this,arguments,void 0,function*(t=1024){return jd(this,t)})}dispose(){return super.dispose(),null!==this._oscillator&&this._oscillator.dispose(),this._wave=void 0,this.frequency.dispose(),this.detune.dispose(),this}}Pd._periodicWaveCache=[];class Dd extends Md{constructor(){const t=uh(Dd.getDefaults(),arguments,["frequency","type","modulationType"]);super(t),this.name="AMOscillator",this._modulationScale=new Nd({context:this.context}),this._modulationNode=new rd({context:this.context}),this._carrier=new Pd({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase,type:t.type}),this.frequency=this._carrier.frequency,this.detune=this._carrier.detune,this._modulator=new Pd({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new Id({context:this.context,units:"positive",value:t.harmonicity}),this.frequency.chain(this.harmonicity,this._modulator.frequency),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output),Lh(this,["frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Pd.getDefaults(),{harmonicity:1,modulationType:"square"})}_start(t){this._modulator.start(t),this._carrier.start(t)}_stop(t){this._modulator.stop(t),this._carrier.stop(t)}_restart(t){this._modulator.restart(t),this._carrier.restart(t)}get type(){return this._carrier.type}set type(t){this._carrier.type=t}get baseType(){return this._carrier.baseType}set baseType(t){this._carrier.baseType=t}get partialCount(){return this._carrier.partialCount}set partialCount(t){this._carrier.partialCount=t}get modulationType(){return this._modulator.type}set modulationType(t){this._modulator.type=t}get phase(){return this._carrier.phase}set phase(t){this._carrier.phase=t,this._modulator.phase=t}get partials(){return this._carrier.partials}set partials(t){this._carrier.partials=t}asArray(){return a(this,arguments,void 0,function*(t=1024){return jd(this,t)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this._modulationScale.dispose(),this}}class Ld extends Md{constructor(){const t=uh(Ld.getDefaults(),arguments,["frequency","type","spread"]);super(t),this.name="FatOscillator",this._oscillators=[],this.frequency=new sd({context:this.context,units:"frequency",value:t.frequency}),this.detune=new sd({context:this.context,units:"cents",value:t.detune}),this._spread=t.spread,this._type=t.type,this._phase=t.phase,this._partials=t.partials,this._partialCount=t.partialCount,this.count=t.count,Lh(this,["frequency","detune"])}static getDefaults(){return Object.assign(Pd.getDefaults(),{count:3,spread:20,type:"sawtooth"})}_start(t){t=this.toSeconds(t),this._forEach(e=>e.start(t))}_stop(t){t=this.toSeconds(t),this._forEach(e=>e.stop(t))}_restart(t){this._forEach(e=>e.restart(t))}_forEach(t){for(let e=0;e<this._oscillators.length;e++)t(this._oscillators[e],e)}get type(){return this._type}set type(t){this._type=t,this._forEach(e=>e.type=t)}get spread(){return this._spread}set spread(t){if(this._spread=t,this._oscillators.length>1){const e=-t/2,n=t/(this._oscillators.length-1);this._forEach((t,r)=>t.detune.value=e+n*r)}}get count(){return this._oscillators.length}set count(t){if(ph(t,1),this._oscillators.length!==t){this._forEach(t=>t.dispose()),this._oscillators=[];for(let e=0;e<t;e++){const n=new Pd({context:this.context,volume:-6-1.1*t,type:this._type,phase:this._phase+e/t*360,partialCount:this._partialCount,onstop:0===e?()=>this.onstop(this):$h});"custom"===this.type&&(n.partials=this._partials),this.frequency.connect(n.frequency),this.detune.connect(n.detune),n.detune.overridden=!1,n.connect(this.output),this._oscillators[e]=n}this.spread=this._spread,"started"===this.state&&this._forEach(t=>t.start())}}get phase(){return this._phase}set phase(t){this._phase=t,this._forEach((t,e)=>t.phase=this._phase+e/this.count*360)}get baseType(){return this._oscillators[0].baseType}set baseType(t){this._forEach(e=>e.baseType=t),this._type=this._oscillators[0].type}get partials(){return this._oscillators[0].partials}set partials(t){this._partials=t,this._partialCount=this._partials.length,t.length&&(this._type="custom",this._forEach(e=>e.partials=t))}get partialCount(){return this._oscillators[0].partialCount}set partialCount(t){this._partialCount=t,this._forEach(e=>e.partialCount=t),this._type=this._oscillators[0].type}asArray(){return a(this,arguments,void 0,function*(t=1024){return jd(this,t)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this._forEach(t=>t.dispose()),this}}class Fd extends Md{constructor(){const t=uh(Fd.getDefaults(),arguments,["frequency","type","modulationType"]);super(t),this.name="FMOscillator",this._modulationNode=new rd({context:this.context,gain:0}),this._carrier=new Pd({context:this.context,detune:t.detune,frequency:0,onstop:()=>this.onstop(this),phase:t.phase,type:t.type}),this.detune=this._carrier.detune,this.frequency=new sd({context:this.context,units:"frequency",value:t.frequency}),this._modulator=new Pd({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new Id({context:this.context,units:"positive",value:t.harmonicity}),this.modulationIndex=new Id({context:this.context,units:"positive",value:t.modulationIndex}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output),this.detune.connect(this._modulator.detune),Lh(this,["modulationIndex","frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Pd.getDefaults(),{harmonicity:1,modulationIndex:2,modulationType:"square"})}_start(t){this._modulator.start(t),this._carrier.start(t)}_stop(t){this._modulator.stop(t),this._carrier.stop(t)}_restart(t){return this._modulator.restart(t),this._carrier.restart(t),this}get type(){return this._carrier.type}set type(t){this._carrier.type=t}get baseType(){return this._carrier.baseType}set baseType(t){this._carrier.baseType=t}get partialCount(){return this._carrier.partialCount}set partialCount(t){this._carrier.partialCount=t}get modulationType(){return this._modulator.type}set modulationType(t){this._modulator.type=t}get phase(){return this._carrier.phase}set phase(t){this._carrier.phase=t,this._modulator.phase=t}get partials(){return this._carrier.partials}set partials(t){this._carrier.partials=t}asArray(){return a(this,arguments,void 0,function*(t=1024){return jd(this,t)})}dispose(){return super.dispose(),this.frequency.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this.modulationIndex.dispose(),this}}class $d extends Md{constructor(){const t=uh($d.getDefaults(),arguments,["frequency","width"]);super(t),this.name="PulseOscillator",this._widthGate=new rd({context:this.context,gain:0}),this._thresh=new _d({context:this.context,mapping:t=>t<=0?-1:1}),this.width=new sd({context:this.context,units:"audioRange",value:t.width}),this._triangle=new Pd({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase,type:"triangle"}),this.frequency=this._triangle.frequency,this.detune=this._triangle.detune,this._triangle.chain(this._thresh,this.output),this.width.chain(this._widthGate,this._thresh),Lh(this,["width","frequency","detune"])}static getDefaults(){return Object.assign(Md.getDefaults(),{detune:0,frequency:440,phase:0,type:"pulse",width:.2})}_start(t){t=this.toSeconds(t),this._triangle.start(t),this._widthGate.gain.setValueAtTime(1,t)}_stop(t){t=this.toSeconds(t),this._triangle.stop(t),this._widthGate.gain.cancelScheduledValues(t),this._widthGate.gain.setValueAtTime(0,t)}_restart(t){this._triangle.restart(t),this._widthGate.gain.cancelScheduledValues(t),this._widthGate.gain.setValueAtTime(1,t)}get phase(){return this._triangle.phase}set phase(t){this._triangle.phase=t}get type(){return"pulse"}get baseType(){return"pulse"}get partials(){return[]}get partialCount(){return 0}set carrierType(t){this._triangle.type=t}asArray(){return a(this,arguments,void 0,function*(t=1024){return jd(this,t)})}dispose(){return super.dispose(),this._triangle.dispose(),this.width.dispose(),this._widthGate.dispose(),this._thresh.dispose(),this}}class Bd extends Md{constructor(){const t=uh(Bd.getDefaults(),arguments,["frequency","modulationFrequency"]);super(t),this.name="PWMOscillator",this.sourceType="pwm",this._scale=new Id({context:this.context,value:2}),this._pulse=new $d({context:this.context,frequency:t.modulationFrequency}),this._pulse.carrierType="sine",this.modulationFrequency=this._pulse.frequency,this._modulator=new Pd({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase}),this.frequency=this._modulator.frequency,this.detune=this._modulator.detune,this._modulator.chain(this._scale,this._pulse.width),this._pulse.connect(this.output),Lh(this,["modulationFrequency","frequency","detune"])}static getDefaults(){return Object.assign(Md.getDefaults(),{detune:0,frequency:440,modulationFrequency:.4,phase:0,type:"pwm"})}_start(t){t=this.toSeconds(t),this._modulator.start(t),this._pulse.start(t)}_stop(t){t=this.toSeconds(t),this._modulator.stop(t),this._pulse.stop(t)}_restart(t){this._modulator.restart(t),this._pulse.restart(t)}get type(){return"pwm"}get baseType(){return"pwm"}get partials(){return[]}get partialCount(){return 0}get phase(){return this._modulator.phase}set phase(t){this._modulator.phase=t}asArray(){return a(this,arguments,void 0,function*(t=1024){return jd(this,t)})}dispose(){return super.dispose(),this._pulse.dispose(),this._scale.dispose(),this._modulator.dispose(),this}}const qd={am:Dd,fat:Ld,fm:Fd,oscillator:Pd,pulse:$d,pwm:Bd};class Ud extends Md{constructor(){const t=uh(Ud.getDefaults(),arguments,["frequency","type"]);super(t),this.name="OmniOscillator",this.frequency=new sd({context:this.context,units:"frequency",value:t.frequency}),this.detune=new sd({context:this.context,units:"cents",value:t.detune}),Lh(this,["frequency","detune"]),this.set(t)}static getDefaults(){return Object.assign(Pd.getDefaults(),Fd.getDefaults(),Dd.getDefaults(),Ld.getDefaults(),$d.getDefaults(),Bd.getDefaults())}_start(t){this._oscillator.start(t)}_stop(t){this._oscillator.stop(t)}_restart(t){return this._oscillator.restart(t),this}get type(){let t="";return["am","fm","fat"].some(t=>this._sourceType===t)&&(t=this._sourceType),t+this._oscillator.type}set type(t){"fm"===t.substr(0,2)?(this._createNewOscillator("fm"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(2)):"am"===t.substr(0,2)?(this._createNewOscillator("am"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(2)):"fat"===t.substr(0,3)?(this._createNewOscillator("fat"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(3)):"pwm"===t?(this._createNewOscillator("pwm"),this._oscillator=this._oscillator):"pulse"===t?this._createNewOscillator("pulse"):(this._createNewOscillator("oscillator"),this._oscillator=this._oscillator,this._oscillator.type=t)}get partials(){return this._oscillator.partials}set partials(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||(this._oscillator.partials=t)}get partialCount(){return this._oscillator.partialCount}set partialCount(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||(this._oscillator.partialCount=t)}set(t){return Reflect.has(t,"type")&&t.type&&(this.type=t.type),super.set(t),this}_createNewOscillator(t){if(t!==this._sourceType){this._sourceType=t;const e=qd[t],n=this.now();if(this._oscillator){const t=this._oscillator;t.stop(n),this.context.setTimeout(()=>t.dispose(),this.blockTime)}this._oscillator=new e({context:this.context}),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.connect(this.output),this._oscillator.onstop=()=>this.onstop(this),"started"===this.state&&this._oscillator.start(n)}}get phase(){return this._oscillator.phase}set phase(t){this._oscillator.phase=t}get sourceType(){return this._sourceType}set sourceType(t){let e="sine";"pwm"!==this._oscillator.type&&"pulse"!==this._oscillator.type&&(e=this._oscillator.type),"fm"===t?this.type="fm"+e:"am"===t?this.type="am"+e:"fat"===t?this.type="fat"+e:"oscillator"===t?this.type=e:"pulse"===t?this.type="pulse":"pwm"===t&&(this.type="pwm")}_getOscType(t,e){return t instanceof qd[e]}get baseType(){return this._oscillator.baseType}set baseType(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||"pulse"===t||"pwm"===t||(this._oscillator.baseType=t)}get width(){return this._getOscType(this._oscillator,"pulse")?this._oscillator.width:void 0}get count(){return this._getOscType(this._oscillator,"fat")?this._oscillator.count:void 0}set count(t){this._getOscType(this._oscillator,"fat")&&eh(t)&&(this._oscillator.count=t)}get spread(){return this._getOscType(this._oscillator,"fat")?this._oscillator.spread:void 0}set spread(t){this._getOscType(this._oscillator,"fat")&&eh(t)&&(this._oscillator.spread=t)}get modulationType(){return this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am")?this._oscillator.modulationType:void 0}set modulationType(t){(this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am"))&&ih(t)&&(this._oscillator.modulationType=t)}get modulationIndex(){return this._getOscType(this._oscillator,"fm")?this._oscillator.modulationIndex:void 0}get harmonicity(){return this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am")?this._oscillator.harmonicity:void 0}get modulationFrequency(){return this._getOscType(this._oscillator,"pwm")?this._oscillator.modulationFrequency:void 0}asArray(){return a(this,arguments,void 0,function*(t=1024){return jd(this,t)})}dispose(){return super.dispose(),this.detune.dispose(),this.frequency.dispose(),this._oscillator.dispose(),this}}class Vd extends Yh{constructor(){const t=uh(Vd.getDefaults(),arguments);super(t),this._scheduledEvents=[],this._synced=!1,this._original_triggerAttack=this.triggerAttack,this._original_triggerRelease=this.triggerRelease,this._syncedRelease=t=>this._original_triggerRelease(t),this._volume=this.output=new pd({context:this.context,volume:t.volume}),this.volume=this._volume.volume,Lh(this,"volume")}static getDefaults(){return Object.assign(Yh.getDefaults(),{volume:0})}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",0),this.context.transport.on("stop",this._syncedRelease),this.context.transport.on("pause",this._syncedRelease),this.context.transport.on("loopEnd",this._syncedRelease)),this}_syncState(){let t=!1;return this._synced||(this._synced=!0,t=!0),t}_syncMethod(t,e){const n=this["_original_"+t]=this[t];this[t]=(...t)=>{const r=t[e],i=this.context.transport.schedule(r=>{t[e]=r,n.apply(this,t)},r);this._scheduledEvents.push(i)}}unsync(){return this._scheduledEvents.forEach(t=>this.context.transport.clear(t)),this._scheduledEvents=[],this._synced&&(this._synced=!1,this.triggerAttack=this._original_triggerAttack,this.triggerRelease=this._original_triggerRelease,this.context.transport.off("stop",this._syncedRelease),this.context.transport.off("pause",this._syncedRelease),this.context.transport.off("loopEnd",this._syncedRelease)),this}triggerAttackRelease(t,e,n,r){const i=this.toSeconds(n),o=this.toSeconds(e);return this.triggerAttack(t,i,r),this.triggerRelease(i+o),this}dispose(){return super.dispose(),this._volume.dispose(),this.unsync(),this._scheduledEvents=[],this}}class Gd extends Vd{constructor(){const t=uh(Gd.getDefaults(),arguments);super(t),this.portamento=t.portamento,this.onsilence=t.onsilence}static getDefaults(){return Object.assign(Vd.getDefaults(),{detune:0,onsilence:$h,portamento:0})}triggerAttack(t,e,n=1){this.log("triggerAttack",t,e,n);const r=this.toSeconds(e);return this._triggerEnvelopeAttack(r,n),this.setNote(t,r),this}triggerRelease(t){this.log("triggerRelease",t);const e=this.toSeconds(t);return this._triggerEnvelopeRelease(e),this}setNote(t,e){const n=this.toSeconds(e),r=t instanceof Jh?t.toFrequency():t;if(this.portamento>0&&this.getLevelAtTime(n)>.05){const t=this.toSeconds(this.portamento);this.frequency.exponentialRampTo(r,t,n)}else this.frequency.setValueAtTime(r,n);return this}}s([cd(0)],Gd.prototype,"portamento",void 0);class zd extends Gd{constructor(){const t=uh(zd.getDefaults(),arguments);super(t),this.name="Synth",this.oscillator=new Ud(Object.assign({context:this.context,detune:t.detune,onstop:()=>this.onsilence(this)},t.oscillator)),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.envelope=new dd(Object.assign({context:this.context},t.envelope)),this.oscillator.chain(this.envelope,this.output),Lh(this,["oscillator","frequency","detune","envelope"])}static getDefaults(){return Object.assign(Gd.getDefaults(),{envelope:Object.assign(lh(ld.getDefaults(),Object.keys(Yh.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.3}),oscillator:Object.assign(lh(Ud.getDefaults(),[...Object.keys(Md.getDefaults()),"frequency","detune"]),{type:"triangle"})})}_triggerEnvelopeAttack(t,e){if(this.envelope.triggerAttack(t,e),this.oscillator.start(t),0===this.envelope.sustain){const e=this.toSeconds(this.envelope.attack),n=this.toSeconds(this.envelope.decay);this.oscillator.stop(t+e+n)}}_triggerEnvelopeRelease(t){this.envelope.triggerRelease(t),this.oscillator.stop(t+this.toSeconds(this.envelope.release))}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}dispose(){return super.dispose(),this.oscillator.dispose(),this.envelope.dispose(),this}}class Wd extends Gd{constructor(){const t=uh(Wd.getDefaults(),arguments);super(t),this.name="ModulationSynth",this._carrier=new zd({context:this.context,oscillator:t.oscillator,envelope:t.envelope,onsilence:()=>this.onsilence(this),volume:-10}),this._modulator=new zd({context:this.context,oscillator:t.modulation,envelope:t.modulationEnvelope,volume:-10}),this.oscillator=this._carrier.oscillator,this.envelope=this._carrier.envelope,this.modulation=this._modulator.oscillator,this.modulationEnvelope=this._modulator.envelope,this.frequency=new sd({context:this.context,units:"frequency"}),this.detune=new sd({context:this.context,value:t.detune,units:"cents"}),this.harmonicity=new Id({context:this.context,value:t.harmonicity,minValue:0}),this._modulationNode=new rd({context:this.context,gain:0}),Lh(this,["frequency","harmonicity","oscillator","envelope","modulation","modulationEnvelope","detune"])}static getDefaults(){return Object.assign(Gd.getDefaults(),{harmonicity:3,oscillator:Object.assign(lh(Ud.getDefaults(),[...Object.keys(Md.getDefaults()),"frequency","detune"]),{type:"sine"}),envelope:Object.assign(lh(ld.getDefaults(),Object.keys(Yh.getDefaults())),{attack:.01,decay:.01,sustain:1,release:.5}),modulation:Object.assign(lh(Ud.getDefaults(),[...Object.keys(Md.getDefaults()),"frequency","detune"]),{type:"square"}),modulationEnvelope:Object.assign(lh(ld.getDefaults(),Object.keys(Yh.getDefaults())),{attack:.5,decay:0,sustain:1,release:.5})})}_triggerEnvelopeAttack(t,e){this._carrier._triggerEnvelopeAttack(t,e),this._modulator._triggerEnvelopeAttack(t,e)}_triggerEnvelopeRelease(t){return this._carrier._triggerEnvelopeRelease(t),this._modulator._triggerEnvelopeRelease(t),this}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}dispose(){return super.dispose(),this._carrier.dispose(),this._modulator.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._modulationNode.dispose(),this}}class Jd extends Wd{constructor(){super(uh(Jd.getDefaults(),arguments)),this.name="AMSynth",this._modulationScale=new Nd({context:this.context}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.detune.fan(this._carrier.detune,this._modulator.detune),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output)}dispose(){return super.dispose(),this._modulationScale.dispose(),this}}class Hd extends Yh{constructor(){const t=uh(Hd.getDefaults(),arguments,["frequency","type"]);super(t),this.name="BiquadFilter",this._filter=this.context.createBiquadFilter(),this.input=this.output=this._filter,this.Q=new Zh({context:this.context,units:"number",value:t.Q,param:this._filter.Q}),this.frequency=new Zh({context:this.context,units:"frequency",value:t.frequency,param:this._filter.frequency}),this.detune=new Zh({context:this.context,units:"cents",value:t.detune,param:this._filter.detune}),this.gain=new Zh({context:this.context,units:"decibels",convert:!1,value:t.gain,param:this._filter.gain}),this.type=t.type}static getDefaults(){return Object.assign(Yh.getDefaults(),{Q:1,type:"lowpass",frequency:350,detune:0,gain:0})}get type(){return this._filter.type}set type(t){dh(-1!==["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t),`Invalid filter type: ${t}`),this._filter.type=t}getFrequencyResponse(t=128){const e=new Float32Array(t);for(let n=0;n<t;n++){const r=19980*Math.pow(n/t,2)+20;e[n]=r}const n=new Float32Array(t),r=new Float32Array(t),i=this.context.createBiquadFilter();return i.type=this.type,i.Q.value=this.Q.value,i.frequency.value=this.frequency.value,i.gain.value=this.gain.value,i.getFrequencyResponse(e,n,r),n}dispose(){return super.dispose(),this._filter.disconnect(),this.Q.dispose(),this.frequency.dispose(),this.gain.dispose(),this.detune.dispose(),this}}class Xd extends Yh{constructor(){const t=uh(Xd.getDefaults(),arguments,["frequency","type","rolloff"]);super(t),this.name="Filter",this.input=new rd({context:this.context}),this.output=new rd({context:this.context}),this._filters=[],this._filters=[],this.Q=new sd({context:this.context,units:"positive",value:t.Q}),this.frequency=new sd({context:this.context,units:"frequency",value:t.frequency}),this.detune=new sd({context:this.context,units:"cents",value:t.detune}),this.gain=new sd({context:this.context,units:"decibels",convert:!1,value:t.gain}),this._type=t.type,this.rolloff=t.rolloff,Lh(this,["detune","frequency","gain","Q"])}static getDefaults(){return Object.assign(Yh.getDefaults(),{Q:1,detune:0,frequency:350,gain:0,rolloff:-12,type:"lowpass"})}get type(){return this._type}set type(t){dh(-1!==["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t),`Invalid filter type: ${t}`),this._type=t,this._filters.forEach(e=>e.type=t)}get rolloff(){return this._rolloff}set rolloff(t){const e=eh(t)?t:parseInt(t,10),n=[-12,-24,-48,-96];let r=n.indexOf(e);dh(-1!==r,`rolloff can only be ${n.join(", ")}`),r+=1,this._rolloff=e,this.input.disconnect(),this._filters.forEach(t=>t.disconnect()),this._filters=new Array(r);for(let t=0;t<r;t++){const e=new Hd({context:this.context});e.type=this._type,this.frequency.connect(e.frequency),this.detune.connect(e.detune),this.Q.connect(e.Q),this.gain.connect(e.gain),this._filters[t]=e}this._internalChannels=this._filters,td(this.input,...this._internalChannels,this.output)}getFrequencyResponse(t=128){const e=new Hd({context:this.context,frequency:this.frequency.value,gain:this.gain.value,Q:this.Q.value,type:this._type,detune:this.detune.value}),n=new Float32Array(t).map(()=>1);return this._filters.forEach(()=>{e.getFrequencyResponse(t).forEach((t,e)=>n[e]*=t)}),e.dispose(),n}dispose(){return super.dispose(),this._filters.forEach(t=>{t.dispose()}),Fh(this,["detune","frequency","gain","Q"]),this.frequency.dispose(),this.Q.dispose(),this.detune.dispose(),this.gain.dispose(),this}}class Kd extends sd{constructor(){super(uh(Kd.getDefaults(),arguments,["value"])),this.override=!1,this.name="Add",this._sum=new rd({context:this.context}),this.input=this._sum,this.output=this._sum,this.addend=this._param,td(this._constantSource,this._sum)}static getDefaults(){return Object.assign(sd.getDefaults(),{value:0})}dispose(){return super.dispose(),this._sum.dispose(),this}}class Qd extends gd{constructor(){const t=uh(Qd.getDefaults(),arguments,["min","max"]);super(t),this.name="Scale",this._mult=this.input=new Id({context:this.context,value:t.max-t.min}),this._add=this.output=new Kd({context:this.context,value:t.min}),this._min=t.min,this._max=t.max,this.input.connect(this.output)}static getDefaults(){return Object.assign(gd.getDefaults(),{max:1,min:0})}get min(){return this._min}set min(t){this._min=t,this._setRange()}get max(){return this._max}set max(t){this._max=t,this._setRange()}_setRange(){this._add.value=this._min,this._mult.value=this._max-this._min}dispose(){return super.dispose(),this._add.dispose(),this._mult.dispose(),this}}class Zd extends ld{constructor(){const t=uh(Zd.getDefaults(),arguments,["attack","decay","sustain","release"]);super(t),this.name="FrequencyEnvelope",this._octaves=t.octaves,this._baseFrequency=this.toFrequency(t.baseFrequency),this._exponent=this.input=new yd({context:this.context,value:t.exponent}),this._scale=this.output=new Qd({context:this.context,min:this._baseFrequency,max:this._baseFrequency*Math.pow(2,this._octaves)}),this._sig.chain(this._exponent,this._scale)}static getDefaults(){return Object.assign(ld.getDefaults(),{baseFrequency:200,exponent:1,octaves:4})}get baseFrequency(){return this._baseFrequency}set baseFrequency(t){const e=this.toFrequency(t);ph(e,0),this._baseFrequency=e,this._scale.min=this._baseFrequency,this.octaves=this._octaves}get octaves(){return this._octaves}set octaves(t){this._octaves=t,this._scale.max=this._baseFrequency*Math.pow(2,t)}get exponent(){return this._exponent.value}set exponent(t){this._exponent.value=t}dispose(){return super.dispose(),this._exponent.dispose(),this._scale.dispose(),this}}class Yd extends Gd{constructor(){const t=uh(Yd.getDefaults(),arguments);super(t),this.name="MonoSynth",this.oscillator=new Ud(Object.assign(t.oscillator,{context:this.context,detune:t.detune,onstop:()=>this.onsilence(this)})),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.filter=new Xd(Object.assign(t.filter,{context:this.context})),this.filterEnvelope=new Zd(Object.assign(t.filterEnvelope,{context:this.context})),this.envelope=new dd(Object.assign(t.envelope,{context:this.context})),this.oscillator.chain(this.filter,this.envelope,this.output),this.filterEnvelope.connect(this.filter.frequency),Lh(this,["oscillator","frequency","detune","filter","filterEnvelope","envelope"])}static getDefaults(){return Object.assign(Gd.getDefaults(),{envelope:Object.assign(lh(ld.getDefaults(),Object.keys(Yh.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.9}),filter:Object.assign(lh(Xd.getDefaults(),Object.keys(Yh.getDefaults())),{Q:1,rolloff:-12,type:"lowpass"}),filterEnvelope:Object.assign(lh(Zd.getDefaults(),Object.keys(Yh.getDefaults())),{attack:.6,baseFrequency:200,decay:.2,exponent:2,octaves:3,release:2,sustain:.5}),oscillator:Object.assign(lh(Ud.getDefaults(),Object.keys(Md.getDefaults())),{type:"sawtooth"})})}_triggerEnvelopeAttack(t,e=1){if(this.envelope.triggerAttack(t,e),this.filterEnvelope.triggerAttack(t),this.oscillator.start(t),0===this.envelope.sustain){const e=this.toSeconds(this.envelope.attack),n=this.toSeconds(this.envelope.decay);this.oscillator.stop(t+e+n)}}_triggerEnvelopeRelease(t){this.envelope.triggerRelease(t),this.filterEnvelope.triggerRelease(t),this.oscillator.stop(t+this.toSeconds(this.envelope.release))}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}dispose(){return super.dispose(),this.oscillator.dispose(),this.envelope.dispose(),this.filterEnvelope.dispose(),this.filter.dispose(),this}}class tp extends gd{constructor(){super(uh(tp.getDefaults(),arguments)),this.name="Zero",this._gain=new rd({context:this.context}),this.output=this._gain,this.input=void 0,ed(this.context.getConstant(0),this._gain)}dispose(){return super.dispose(),nd(this.context.getConstant(0),this._gain),this}}class ep extends Yh{constructor(){const t=uh(ep.getDefaults(),arguments,["frequency","min","max"]);super(t),this.name="LFO",this._stoppedValue=0,this._units="number",this.convert=!0,this._fromType=Zh.prototype._fromType,this._toType=Zh.prototype._toType,this._is=Zh.prototype._is,this._clampValue=Zh.prototype._clampValue,this._oscillator=new Pd(t),this.frequency=this._oscillator.frequency,this._amplitudeGain=new rd({context:this.context,gain:t.amplitude,units:"normalRange"}),this.amplitude=this._amplitudeGain.gain,this._stoppedSignal=new sd({context:this.context,units:"audioRange",value:0}),this._zeros=new tp({context:this.context}),this._a2g=new Nd({context:this.context}),this._scaler=this.output=new Qd({context:this.context,max:t.max,min:t.min}),this.units=t.units,this.min=t.min,this.max=t.max,this._oscillator.chain(this._amplitudeGain,this._a2g,this._scaler),this._zeros.connect(this._a2g),this._stoppedSignal.connect(this._a2g),Lh(this,["amplitude","frequency"]),this.phase=t.phase}static getDefaults(){return Object.assign(Pd.getDefaults(),{amplitude:1,frequency:"4n",max:1,min:0,type:"sine",units:"number"})}start(t){return t=this.toSeconds(t),this._stoppedSignal.setValueAtTime(0,t),this._oscillator.start(t),this}stop(t){return t=this.toSeconds(t),this._stoppedSignal.setValueAtTime(this._stoppedValue,t),this._oscillator.stop(t),this}sync(){return this._oscillator.sync(),this._oscillator.syncFrequency(),this}unsync(){return this._oscillator.unsync(),this._oscillator.unsyncFrequency(),this}_setStoppedValue(){this._stoppedValue=this._oscillator.getInitialValue(),this._stoppedSignal.value=this._stoppedValue}get min(){return this._toType(this._scaler.min)}set min(t){t=this._fromType(t),this._scaler.min=t}get max(){return this._toType(this._scaler.max)}set max(t){t=this._fromType(t),this._scaler.max=t}get type(){return this._oscillator.type}set type(t){this._oscillator.type=t,this._setStoppedValue()}get partials(){return this._oscillator.partials}set partials(t){this._oscillator.partials=t,this._setStoppedValue()}get phase(){return this._oscillator.phase}set phase(t){this._oscillator.phase=t,this._setStoppedValue()}get units(){return this._units}set units(t){const e=this.min,n=this.max;this._units=t,this.min=e,this.max=n}get state(){return this._oscillator.state}connect(t,e,n){return(t instanceof Zh||t instanceof sd)&&(this.convert=t.convert,this.units=t.units),ad(this,t,e,n),this}dispose(){return super.dispose(),this._oscillator.dispose(),this._stoppedSignal.dispose(),this._zeros.dispose(),this._scaler.dispose(),this._a2g.dispose(),this._amplitudeGain.dispose(),this.amplitude.dispose(),this}}class np extends Gd{constructor(){const t=uh(np.getDefaults(),arguments);super(t),this.name="DuoSynth",this.voice0=new Yd(Object.assign(t.voice0,{context:this.context,onsilence:()=>this.onsilence(this)})),this.voice1=new Yd(Object.assign(t.voice1,{context:this.context})),this.harmonicity=new Id({context:this.context,units:"positive",value:t.harmonicity}),this._vibrato=new ep({frequency:t.vibratoRate,context:this.context,min:-50,max:50}),this._vibrato.start(),this.vibratoRate=this._vibrato.frequency,this._vibratoGain=new rd({context:this.context,units:"normalRange",gain:t.vibratoAmount}),this.vibratoAmount=this._vibratoGain.gain,this.frequency=new sd({context:this.context,units:"frequency",value:440}),this.detune=new sd({context:this.context,units:"cents",value:t.detune}),this.frequency.connect(this.voice0.frequency),this.frequency.chain(this.harmonicity,this.voice1.frequency),this._vibrato.connect(this._vibratoGain),this._vibratoGain.fan(this.voice0.detune,this.voice1.detune),this.detune.fan(this.voice0.detune,this.voice1.detune),this.voice0.connect(this.output),this.voice1.connect(this.output),Lh(this,["voice0","voice1","frequency","vibratoAmount","vibratoRate"])}getLevelAtTime(t){return t=this.toSeconds(t),this.voice0.envelope.getValueAtTime(t)+this.voice1.envelope.getValueAtTime(t)}static getDefaults(){return ah(Gd.getDefaults(),{vibratoAmount:.5,vibratoRate:5,harmonicity:1.5,voice0:ah(lh(Yd.getDefaults(),Object.keys(Gd.getDefaults())),{filterEnvelope:{attack:.01,decay:0,sustain:1,release:.5},envelope:{attack:.01,decay:0,sustain:1,release:.5}}),voice1:ah(lh(Yd.getDefaults(),Object.keys(Gd.getDefaults())),{filterEnvelope:{attack:.01,decay:0,sustain:1,release:.5},envelope:{attack:.01,decay:0,sustain:1,release:.5}})})}_triggerEnvelopeAttack(t,e){this.voice0._triggerEnvelopeAttack(t,e),this.voice1._triggerEnvelopeAttack(t,e)}_triggerEnvelopeRelease(t){return this.voice0._triggerEnvelopeRelease(t),this.voice1._triggerEnvelopeRelease(t),this}dispose(){return super.dispose(),this.voice0.dispose(),this.voice1.dispose(),this.frequency.dispose(),this.detune.dispose(),this._vibrato.dispose(),this.vibratoRate.dispose(),this._vibratoGain.dispose(),this.harmonicity.dispose(),this}}class rp extends Wd{constructor(){const t=uh(rp.getDefaults(),arguments);super(t),this.name="FMSynth",this.modulationIndex=new Id({context:this.context,value:t.modulationIndex}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this.detune.fan(this._carrier.detune,this._modulator.detune),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output)}static getDefaults(){return Object.assign(Wd.getDefaults(),{modulationIndex:10})}dispose(){return super.dispose(),this.modulationIndex.dispose(),this}}class ip extends zd{constructor(){const t=uh(ip.getDefaults(),arguments);super(t),this.name="MembraneSynth",this.portamento=0,this.pitchDecay=t.pitchDecay,this.octaves=t.octaves,Lh(this,["oscillator","envelope"])}static getDefaults(){return ah(Gd.getDefaults(),zd.getDefaults(),{envelope:{attack:.001,attackCurve:"exponential",decay:.4,release:1.4,sustain:.01},octaves:10,oscillator:{type:"sine"},pitchDecay:.05})}setNote(t,e){const n=this.toSeconds(e),r=this.toFrequency(t instanceof Jh?t.toFrequency():t),i=r*this.octaves;return this.oscillator.frequency.setValueAtTime(i,n),this.oscillator.frequency.exponentialRampToValueAtTime(r,n+this.toSeconds(this.pitchDecay)),this}dispose(){return super.dispose(),this}}s([ud(0)],ip.prototype,"octaves",void 0),s([cd(0)],ip.prototype,"pitchDecay",void 0);const op=[1,1.483,1.932,2.546,2.63,3.897];class sp extends Gd{constructor(){const t=uh(sp.getDefaults(),arguments);super(t),this.name="MetalSynth",this._oscillators=[],this._freqMultipliers=[],this.detune=new sd({context:this.context,units:"cents",value:t.detune}),this.frequency=new sd({context:this.context,units:"frequency"}),this._amplitude=new rd({context:this.context,gain:0}).connect(this.output),this._highpass=new Xd({Q:0,context:this.context,type:"highpass"}).connect(this._amplitude);for(let e=0;e<op.length;e++){const n=new Fd({context:this.context,harmonicity:t.harmonicity,modulationIndex:t.modulationIndex,modulationType:"square",onstop:0===e?()=>this.onsilence(this):$h,type:"square"});n.connect(this._highpass),this._oscillators[e]=n;const r=new Id({context:this.context,value:op[e]});this._freqMultipliers[e]=r,this.frequency.chain(r,n.frequency),this.detune.connect(n.detune)}this._filterFreqScaler=new Qd({context:this.context,max:7e3,min:this.toFrequency(t.resonance)}),this.envelope=new ld({attack:t.envelope.attack,attackCurve:"linear",context:this.context,decay:t.envelope.decay,release:t.envelope.release,sustain:0}),this.envelope.chain(this._filterFreqScaler,this._highpass.frequency),this.envelope.connect(this._amplitude.gain),this._octaves=t.octaves,this.octaves=t.octaves}static getDefaults(){return ah(Gd.getDefaults(),{envelope:Object.assign(lh(ld.getDefaults(),Object.keys(Yh.getDefaults())),{attack:.001,decay:1.4,release:.2}),harmonicity:5.1,modulationIndex:32,octaves:1.5,resonance:4e3})}_triggerEnvelopeAttack(t,e=1){return this.envelope.triggerAttack(t,e),this._oscillators.forEach(e=>e.start(t)),0===this.envelope.sustain&&this._oscillators.forEach(e=>{e.stop(t+this.toSeconds(this.envelope.attack)+this.toSeconds(this.envelope.decay))}),this}_triggerEnvelopeRelease(t){return this.envelope.triggerRelease(t),this._oscillators.forEach(e=>e.stop(t+this.toSeconds(this.envelope.release))),this}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}get modulationIndex(){return this._oscillators[0].modulationIndex.value}set modulationIndex(t){this._oscillators.forEach(e=>e.modulationIndex.value=t)}get harmonicity(){return this._oscillators[0].harmonicity.value}set harmonicity(t){this._oscillators.forEach(e=>e.harmonicity.value=t)}get resonance(){return this._filterFreqScaler.min}set resonance(t){this._filterFreqScaler.min=this.toFrequency(t),this.octaves=this._octaves}get octaves(){return this._octaves}set octaves(t){this._octaves=t,this._filterFreqScaler.max=this._filterFreqScaler.min*Math.pow(2,t)}dispose(){return super.dispose(),this._oscillators.forEach(t=>t.dispose()),this._freqMultipliers.forEach(t=>t.dispose()),this.frequency.dispose(),this.detune.dispose(),this._filterFreqScaler.dispose(),this._amplitude.dispose(),this.envelope.dispose(),this._highpass.dispose(),this}}class ap extends id{constructor(){const t=uh(ap.getDefaults(),arguments,["url","onload"]);super(t),this.name="ToneBufferSource",this._source=this.context.createBufferSource(),this._internalChannels=[this._source],this._sourceStarted=!1,this._sourceStopped=!1,ed(this._source,this._gainNode),this._source.onended=()=>this._stopSource(),this.playbackRate=new Zh({context:this.context,param:this._source.playbackRate,units:"positive",value:t.playbackRate}),this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this._buffer=new Bh(t.url,t.onload,t.onerror),this._internalChannels.push(this._source)}static getDefaults(){return Object.assign(id.getDefaults(),{url:new Bh,loop:!1,loopEnd:0,loopStart:0,onload:$h,onerror:$h,playbackRate:1})}get fadeIn(){return this._fadeIn}set fadeIn(t){this._fadeIn=t}get fadeOut(){return this._fadeOut}set fadeOut(t){this._fadeOut=t}get curve(){return this._curve}set curve(t){this._curve=t}start(t,e,n,r=1){dh(this.buffer.loaded,"buffer is either not set or not loaded");const i=this.toSeconds(t);this._startGain(i,r),e=this.loop?ch(e,this.loopStart):ch(e,0);let o=Math.max(this.toSeconds(e),0);if(this.loop){const t=this.toSeconds(this.loopEnd)||this.buffer.duration,e=this.toSeconds(this.loopStart),n=t-e;Sh(o,t)&&(o=(o-e)%n+e),Eh(o,this.buffer.duration)&&(o=0)}if(this._source.buffer=this.buffer.get(),this._source.loopEnd=this.toSeconds(this.loopEnd)||this.buffer.duration,Ah(o,this.buffer.duration)&&(this._sourceStarted=!0,this._source.start(i,o)),th(n)){let t=this.toSeconds(n);t=Math.max(t,0),this.stop(i+t)}return this}_stopSource(t){!this._sourceStopped&&this._sourceStarted&&(this._sourceStopped=!0,this._source.stop(this.toSeconds(t)),this._onended())}get loopStart(){return this._source.loopStart}set loopStart(t){this._source.loopStart=this.toSeconds(t)}get loopEnd(){return this._source.loopEnd}set loopEnd(t){this._source.loopEnd=this.toSeconds(t)}get buffer(){return this._buffer}set buffer(t){this._buffer.set(t)}get loop(){return this._source.loop}set loop(t){this._source.loop=t,this._sourceStarted&&this.cancelStop()}dispose(){return super.dispose(),this._source.onended=null,this._source.disconnect(),this._buffer.dispose(),this.playbackRate.dispose(),this}}class up extends Md{constructor(){const t=uh(up.getDefaults(),arguments,["type"]);super(t),this.name="Noise",this._source=null,this._playbackRate=t.playbackRate,this.type=t.type,this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut}static getDefaults(){return Object.assign(Md.getDefaults(),{fadeIn:0,fadeOut:0,playbackRate:1,type:"white"})}get type(){return this._type}set type(t){if(dh(t in hp,"Noise: invalid type: "+t),this._type!==t&&(this._type=t,"started"===this.state)){const t=this.now();this._stop(t),this._start(t)}}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._source&&(this._source.playbackRate.value=t)}_start(t){const e=hp[this._type];this._source=new ap({url:e,context:this.context,fadeIn:this._fadeIn,fadeOut:this._fadeOut,loop:!0,onended:()=>this.onstop(this),playbackRate:this._playbackRate}).connect(this.output),this._source.start(this.toSeconds(t),Math.random()*(e.duration-.001))}_stop(t){this._source&&(this._source.stop(this.toSeconds(t)),this._source=null)}get fadeIn(){return this._fadeIn}set fadeIn(t){this._fadeIn=t,this._source&&(this._source.fadeIn=this._fadeIn)}get fadeOut(){return this._fadeOut}set fadeOut(t){this._fadeOut=t,this._source&&(this._source.fadeOut=this._fadeOut)}_restart(t){this._stop(t),this._start(t)}dispose(){return super.dispose(),this._source&&this._source.disconnect(),this}}const cp=220500,lp={brown:null,pink:null,white:null},hp={get brown(){if(!lp.brown){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(cp);t[e]=n;let r=0;for(let t=0;t<cp;t++){const e=2*Math.random()-1;n[t]=(r+.02*e)/1.02,r=n[t],n[t]*=3.5}}lp.brown=(new Bh).fromArray(t)}return lp.brown},get pink(){if(!lp.pink){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(cp);let r,i,o,s,a,u,c;t[e]=n,r=i=o=s=a=u=c=0;for(let t=0;t<cp;t++){const e=2*Math.random()-1;r=.99886*r+.0555179*e,i=.99332*i+.0750759*e,o=.969*o+.153852*e,s=.8665*s+.3104856*e,a=.55*a+.5329522*e,u=-.7616*u-.016898*e,n[t]=r+i+o+s+a+u+c+.5362*e,n[t]*=.11,c=.115926*e}}lp.pink=(new Bh).fromArray(t)}return lp.pink},get white(){if(!lp.white){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(cp);t[e]=n;for(let t=0;t<cp;t++)n[t]=2*Math.random()-1}lp.white=(new Bh).fromArray(t)}return lp.white}};class dp extends Vd{constructor(){const t=uh(dp.getDefaults(),arguments);super(t),this.name="NoiseSynth",this.noise=new up(Object.assign({context:this.context},t.noise)),this.envelope=new dd(Object.assign({context:this.context},t.envelope)),this.noise.chain(this.envelope,this.output)}static getDefaults(){return Object.assign(Vd.getDefaults(),{envelope:Object.assign(lh(ld.getDefaults(),Object.keys(Yh.getDefaults())),{decay:.1,sustain:0}),noise:Object.assign(lh(up.getDefaults(),Object.keys(Md.getDefaults())),{type:"white"})})}triggerAttack(t,e=1){return t=this.toSeconds(t),this.envelope.triggerAttack(t,e),this.noise.start(t),0===this.envelope.sustain&&this.noise.stop(t+this.toSeconds(this.envelope.attack)+this.toSeconds(this.envelope.decay)),this}triggerRelease(t){return t=this.toSeconds(t),this.envelope.triggerRelease(t),this.noise.stop(t+this.toSeconds(this.envelope.release)),this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",0),this._syncMethod("triggerRelease",0)),this}triggerAttackRelease(t,e,n=1){return e=this.toSeconds(e),t=this.toSeconds(t),this.triggerAttack(e,n),this.triggerRelease(e+t),this}dispose(){return super.dispose(),this.noise.dispose(),this.envelope.dispose(),this}}const pp=new Set;function fp(t){pp.add(t)}class mp extends Yh{constructor(t){super(t),this.name="ToneAudioWorklet",this.workletOptions={},this.onprocessorerror=$h;const e=URL.createObjectURL(new Blob([Array.from(pp).join("\n")],{type:"text/javascript"})),n=this._audioWorkletName();this._dummyGain=this.context.createGain(),this._dummyParam=this._dummyGain.gain,this.context.addAudioWorkletModule(e).then(()=>{this.disposed||(this._worklet=this.context.createAudioWorkletNode(n,this.workletOptions),this._worklet.onprocessorerror=this.onprocessorerror.bind(this),this.onReady(this._worklet))})}dispose(){return super.dispose(),this._dummyGain.disconnect(),this._worklet&&(this._worklet.port.postMessage("dispose"),this._worklet.disconnect()),this}}fp('\n\t/**\n\t * The base AudioWorkletProcessor for use in Tone.js. Works with the {@link ToneAudioWorklet}. \n\t */\n\tclass ToneAudioWorkletProcessor extends AudioWorkletProcessor {\n\n\t\tconstructor(options) {\n\t\t\t\n\t\t\tsuper(options);\n\t\t\t/**\n\t\t\t * If the processor was disposed or not. Keep alive until it\'s disposed.\n\t\t\t */\n\t\t\tthis.disposed = false;\n\t\t \t/** \n\t\t\t * The number of samples in the processing block\n\t\t\t */\n\t\t\tthis.blockSize = 128;\n\t\t\t/**\n\t\t\t * the sample rate\n\t\t\t */\n\t\t\tthis.sampleRate = sampleRate;\n\n\t\t\tthis.port.onmessage = (event) => {\n\t\t\t\t// when it receives a dispose \n\t\t\t\tif (event.data === "dispose") {\n\t\t\t\t\tthis.disposed = true;\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n');fp("\n\t/**\n\t * Abstract class for a single input/output processor. \n\t * has a 'generate' function which processes one sample at a time\n\t */\n\tclass SingleIOProcessor extends ToneAudioWorkletProcessor {\n\n\t\tconstructor(options) {\n\t\t\tsuper(Object.assign(options, {\n\t\t\t\tnumberOfInputs: 1,\n\t\t\t\tnumberOfOutputs: 1\n\t\t\t}));\n\t\t\t/**\n\t\t\t * Holds the name of the parameter and a single value of that\n\t\t\t * parameter at the current sample\n\t\t\t * @type { [name: string]: number }\n\t\t\t */\n\t\t\tthis.params = {}\n\t\t}\n\n\t\t/**\n\t\t * Generate an output sample from the input sample and parameters\n\t\t * @abstract\n\t\t * @param input number\n\t\t * @param channel number\n\t\t * @param parameters { [name: string]: number }\n\t\t * @returns number\n\t\t */\n\t\tgenerate(){}\n\n\t\t/**\n\t\t * Update the private params object with the \n\t\t * values of the parameters at the given index\n\t\t * @param parameters { [name: string]: Float32Array },\n\t\t * @param index number\n\t\t */\n\t\tupdateParams(parameters, index) {\n\t\t\tfor (const paramName in parameters) {\n\t\t\t\tconst param = parameters[paramName];\n\t\t\t\tif (param.length > 1) {\n\t\t\t\t\tthis.params[paramName] = parameters[paramName][index];\n\t\t\t\t} else {\n\t\t\t\t\tthis.params[paramName] = parameters[paramName][0];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Process a single frame of the audio\n\t\t * @param inputs Float32Array[][]\n\t\t * @param outputs Float32Array[][]\n\t\t */\n\t\tprocess(inputs, outputs, parameters) {\n\t\t\tconst input = inputs[0];\n\t\t\tconst output = outputs[0];\n\t\t\t// get the parameter values\n\t\t\tconst channelCount = Math.max(input && input.length || 0, output.length);\n\t\t\tfor (let sample = 0; sample < this.blockSize; sample++) {\n\t\t\t\tthis.updateParams(parameters, sample);\n\t\t\t\tfor (let channel = 0; channel < channelCount; channel++) {\n\t\t\t\t\tconst inputSample = input && input.length ? input[channel][sample] : 0;\n\t\t\t\t\toutput[channel][sample] = this.generate(inputSample, channel, this.params);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn !this.disposed;\n\t\t}\n\t};\n");fp("\n\t/**\n\t * A multichannel buffer for use within an AudioWorkletProcessor as a delay line\n\t */\n\tclass DelayLine {\n\t\t\n\t\tconstructor(size, channels) {\n\t\t\tthis.buffer = [];\n\t\t\tthis.writeHead = []\n\t\t\tthis.size = size;\n\n\t\t\t// create the empty channels\n\t\t\tfor (let i = 0; i < channels; i++) {\n\t\t\t\tthis.buffer[i] = new Float32Array(this.size);\n\t\t\t\tthis.writeHead[i] = 0;\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Push a value onto the end\n\t\t * @param channel number\n\t\t * @param value number\n\t\t */\n\t\tpush(channel, value) {\n\t\t\tthis.writeHead[channel] += 1;\n\t\t\tif (this.writeHead[channel] > this.size) {\n\t\t\t\tthis.writeHead[channel] = 0;\n\t\t\t}\n\t\t\tthis.buffer[channel][this.writeHead[channel]] = value;\n\t\t}\n\n\t\t/**\n\t\t * Get the recorded value of the channel given the delay\n\t\t * @param channel number\n\t\t * @param delay number delay samples\n\t\t */\n\t\tget(channel, delay) {\n\t\t\tlet readHead = this.writeHead[channel] - Math.floor(delay);\n\t\t\tif (readHead < 0) {\n\t\t\t\treadHead += this.size;\n\t\t\t}\n\t\t\treturn this.buffer[channel][readHead];\n\t\t}\n\t}\n");const gp="feedback-comb-filter";!function(t,e){const n=`registerProcessor("${t}", ${e})`;pp.add(n)}(gp,'\n\tclass FeedbackCombFilterWorklet extends SingleIOProcessor {\n\n\t\tconstructor(options) {\n\t\t\tsuper(options);\n\t\t\tthis.delayLine = new DelayLine(this.sampleRate, options.channelCount || 2);\n\t\t}\n\n\t\tstatic get parameterDescriptors() {\n\t\t\treturn [{\n\t\t\t\tname: "delayTime",\n\t\t\t\tdefaultValue: 0.1,\n\t\t\t\tminValue: 0,\n\t\t\t\tmaxValue: 1,\n\t\t\t\tautomationRate: "k-rate"\n\t\t\t}, {\n\t\t\t\tname: "feedback",\n\t\t\t\tdefaultValue: 0.5,\n\t\t\t\tminValue: 0,\n\t\t\t\tmaxValue: 0.9999,\n\t\t\t\tautomationRate: "k-rate"\n\t\t\t}];\n\t\t}\n\n\t\tgenerate(input, channel, parameters) {\n\t\t\tconst delayedSample = this.delayLine.get(channel, parameters.delayTime * this.sampleRate);\n\t\t\tthis.delayLine.push(channel, input + delayedSample * parameters.feedback);\n\t\t\treturn delayedSample;\n\t\t}\n\t}\n');class _p extends mp{constructor(){const t=uh(_p.getDefaults(),arguments,["delayTime","resonance"]);super(t),this.name="FeedbackCombFilter",this.input=new rd({context:this.context}),this.output=new rd({context:this.context}),this.delayTime=new Zh({context:this.context,value:t.delayTime,units:"time",minValue:0,maxValue:1,param:this._dummyParam,swappable:!0}),this.resonance=new Zh({context:this.context,value:t.resonance,units:"normalRange",param:this._dummyParam,swappable:!0}),Lh(this,["resonance","delayTime"])}_audioWorkletName(){return gp}static getDefaults(){return Object.assign(Yh.getDefaults(),{delayTime:.1,resonance:.5})}onReady(t){td(this.input,t,this.output);const e=t.parameters.get("delayTime");this.delayTime.setParam(e);const n=t.parameters.get("feedback");this.resonance.setParam(n)}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this.delayTime.dispose(),this.resonance.dispose(),this}}class yp extends Yh{constructor(){const t=uh(yp.getDefaults(),arguments,["frequency","type"]);super(t),this.name="OnePoleFilter",this._frequency=t.frequency,this._type=t.type,this.input=new rd({context:this.context}),this.output=new rd({context:this.context}),this._createFilter()}static getDefaults(){return Object.assign(Yh.getDefaults(),{frequency:880,type:"lowpass"})}_createFilter(){const t=this._filter,e=this.toFrequency(this._frequency),n=1/(2*Math.PI*e);if("lowpass"===this._type){const t=1/(n*this.context.sampleRate),e=t-1;this._filter=this.context.createIIRFilter([t,0],[1,e])}else{const t=1/(n*this.context.sampleRate)-1;this._filter=this.context.createIIRFilter([1,-1],[1,t])}this.input.chain(this._filter,this.output),t&&this.context.setTimeout(()=>{this.disposed||(this.input.disconnect(t),t.disconnect())},this.blockTime)}get frequency(){return this._frequency}set frequency(t){this._frequency=t,this._createFilter()}get type(){return this._type}set type(t){this._type=t,this._createFilter()}getFrequencyResponse(t=128){const e=new Float32Array(t);for(let n=0;n<t;n++){const r=19980*Math.pow(n/t,2)+20;e[n]=r}const n=new Float32Array(t),r=new Float32Array(t);return this._filter.getFrequencyResponse(e,n,r),n}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this._filter.disconnect(),this}}class vp extends Yh{constructor(){const t=uh(vp.getDefaults(),arguments,["delayTime","resonance","dampening"]);super(t),this.name="LowpassCombFilter",this._combFilter=this.output=new _p({context:this.context,delayTime:t.delayTime,resonance:t.resonance}),this.delayTime=this._combFilter.delayTime,this.resonance=this._combFilter.resonance,this._lowpass=this.input=new yp({context:this.context,frequency:t.dampening,type:"lowpass"}),this._lowpass.connect(this._combFilter)}static getDefaults(){return Object.assign(Yh.getDefaults(),{dampening:3e3,delayTime:.1,resonance:.5})}get dampening(){return this._lowpass.frequency}set dampening(t){this._lowpass.frequency=t}dispose(){return super.dispose(),this._combFilter.dispose(),this._lowpass.dispose(),this}}class bp extends Vd{constructor(){const t=uh(bp.getDefaults(),arguments);super(t),this.name="PluckSynth",this._noise=new up({context:this.context,type:"pink"}),this.attackNoise=t.attackNoise,this._lfcf=new vp({context:this.context,dampening:t.dampening,resonance:t.resonance}),this.resonance=t.resonance,this.release=t.release,this._noise.connect(this._lfcf),this._lfcf.connect(this.output)}static getDefaults(){return ah(Vd.getDefaults(),{attackNoise:1,dampening:4e3,resonance:.7,release:1})}get dampening(){return this._lfcf.dampening}set dampening(t){this._lfcf.dampening=t}triggerAttack(t,e){const n=this.toFrequency(t);e=this.toSeconds(e);const r=1/n;return this._lfcf.delayTime.setValueAtTime(r,e),this._noise.start(e),this._noise.stop(e+r*this.attackNoise),this._lfcf.resonance.cancelScheduledValues(e),this._lfcf.resonance.setValueAtTime(this.resonance,e),this}triggerRelease(t){return this._lfcf.resonance.linearRampTo(0,this.release,t),this}dispose(){return super.dispose(),this._noise.dispose(),this._lfcf.dispose(),this}}class wp extends Jh{constructor(){super(...arguments),this.name="MidiClass",this.defaultUnits="midi"}_frequencyToUnits(t){return gs(super._frequencyToUnits(t))}_ticksToUnits(t){return gs(super._ticksToUnits(t))}_beatsToUnits(t){return gs(super._beatsToUnits(t))}_secondsToUnits(t){return gs(super._secondsToUnits(t))}toMidi(){return this.valueOf()}toFrequency(){return ys(this.toMidi())}transpose(t){return new wp(this.context,this.toMidi()+t)}}class xp extends Vd{constructor(){const t=uh(xp.getDefaults(),arguments,["voice","options"]);super(t),this.name="PolySynth",this._availableVoices=[],this._activeVoices=[],this._voices=[],this._gcTimeout=-1,this._averageActiveVoices=0,this._syncedRelease=t=>this.releaseAll(t),dh(!eh(t.voice),"DEPRECATED: The polyphony count is no longer the first argument.");const e=t.voice.getDefaults();this.options=Object.assign(e,t.options),this.voice=t.voice,this.maxPolyphony=t.maxPolyphony,this._dummyVoice=this._getNextAvailableVoice();const n=this._voices.indexOf(this._dummyVoice);this._voices.splice(n,1),this._gcTimeout=this.context.setInterval(this._collectGarbage.bind(this),1)}static getDefaults(){return Object.assign(Vd.getDefaults(),{maxPolyphony:32,options:{},voice:zd})}get activeVoices(){return this._activeVoices.length}_makeVoiceAvailable(t){this._availableVoices.push(t);const e=this._activeVoices.findIndex(e=>e.voice===t);this._activeVoices.splice(e,1)}_getNextAvailableVoice(){if(this._availableVoices.length)return this._availableVoices.shift();if(this._voices.length<this.maxPolyphony){const t=new this.voice(Object.assign(this.options,{context:this.context,onsilence:this._makeVoiceAvailable.bind(this)}));return dh(t instanceof Gd,"Voice must extend Monophonic class"),t.connect(this.output),this._voices.push(t),t}vh("Max polyphony exceeded. Note dropped.")}_collectGarbage(){if(this._averageActiveVoices=Math.max(.95*this._averageActiveVoices,this.activeVoices),this._availableVoices.length&&this._voices.length>Math.ceil(this._averageActiveVoices+1)){const t=this._availableVoices.shift(),e=this._voices.indexOf(t);this._voices.splice(e,1),this.context.isOffline||t.dispose()}}_triggerAttack(t,e,n){t.forEach(t=>{const r=new wp(this.context,t).toMidi(),i=this._getNextAvailableVoice();i&&(i.triggerAttack(t,e,n),this._activeVoices.push({midi:r,voice:i,released:!1}),this.log("triggerAttack",t,e))})}_triggerRelease(t,e){t.forEach(t=>{const n=new wp(this.context,t).toMidi(),r=this._activeVoices.find(({midi:t,released:e})=>t===n&&!e);r&&(r.voice.triggerRelease(e),r.released=!0,this.log("triggerRelease",t,e))})}_scheduleEvent(t,e,n,r){dh(!this.disposed,"Synth was already disposed"),n<=this.now()?"attack"===t?this._triggerAttack(e,n,r):this._triggerRelease(e,n):this.context.setTimeout(()=>{this.disposed||this._scheduleEvent(t,e,n,r)},n-this.now())}triggerAttack(t,e,n){Array.isArray(t)||(t=[t]);const r=this.toSeconds(e);return this._scheduleEvent("attack",t,r,n),this}triggerRelease(t,e){Array.isArray(t)||(t=[t]);const n=this.toSeconds(e);return this._scheduleEvent("release",t,n),this}triggerAttackRelease(t,e,n,r){const i=this.toSeconds(n);if(this.triggerAttack(t,i,r),rh(e)){dh(rh(t),"If the duration is an array, the notes must also be an array");for(let n=0;n<t.length;n++){const r=e[Math.min(n,e.length-1)],o=this.toSeconds(r);dh(o>0,"The duration must be greater than 0"),this.triggerRelease(t[n],i+o)}}else{const n=this.toSeconds(e);dh(n>0,"The duration must be greater than 0"),this.triggerRelease(t,i+n)}return this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1),this.context.transport.on("stop",this._syncedRelease),this.context.transport.on("pause",this._syncedRelease),this.context.transport.on("loopEnd",this._syncedRelease)),this}set(t){const e=lh(t,["onsilence","context"]);return this.options=ah(this.options,e),this._voices.forEach(t=>t.set(e)),this._dummyVoice.set(e),this}get(){return this._dummyVoice.get()}releaseAll(t){const e=this.toSeconds(t);return this._activeVoices.forEach(({voice:t})=>{t.triggerRelease(e)}),this}dispose(){return super.dispose(),this._dummyVoice.dispose(),this._voices.forEach(t=>t.dispose()),this._activeVoices=[],this._availableVoices=[],this.context.clearInterval(this._gcTimeout),this}}class Tp extends xh{constructor(){super(),this.name="ToneAudioBuffers",this._buffers=new Map,this._loadingCount=0;const t=uh(Tp.getDefaults(),arguments,["urls","onload","baseUrl"],"urls");this.baseUrl=t.baseUrl,Object.keys(t.urls).forEach(e=>{this._loadingCount++;const n=t.urls[e];this.add(e,n,this._bufferLoaded.bind(this,t.onload),t.onerror)})}static getDefaults(){return{baseUrl:"",onerror:$h,onload:$h,urls:{}}}has(t){return this._buffers.has(t.toString())}get(t){return dh(this.has(t),`ToneAudioBuffers has no buffer named: ${t}`),this._buffers.get(t.toString())}_bufferLoaded(t){this._loadingCount--,0===this._loadingCount&&t&&t()}get loaded(){return Array.from(this._buffers).every(([t,e])=>e.loaded)}add(t,e,n=$h,r=$h){return ih(e)?(this.baseUrl&&"data:audio/"===e.trim().substring(0,11).toLowerCase()&&(this.baseUrl=""),this._buffers.set(t.toString(),new Bh(this.baseUrl+e,n,r))):this._buffers.set(t.toString(),new Bh(e,n,r)),this}dispose(){return super.dispose(),this._buffers.forEach(t=>t.dispose()),this._buffers.clear(),this}}class kp extends Vd{constructor(){const t=uh(kp.getDefaults(),arguments,["urls","onload","baseUrl"],"urls");super(t),this.name="Sampler",this._activeSources=new Map;const e={};Object.keys(t.urls).forEach(n=>{const r=parseInt(n,10);if(dh(oh(n)||eh(r)&&isFinite(r),`url key is neither a note or midi pitch: ${n}`),oh(n)){const r=new Jh(this.context,n).toMidi();e[r]=t.urls[n]}else eh(r)&&isFinite(r)&&(e[r]=t.urls[r])}),this._buffers=new Tp({urls:e,onload:t.onload,baseUrl:t.baseUrl,onerror:t.onerror}),this.attack=t.attack,this.release=t.release,this.curve=t.curve,this._buffers.loaded&&Promise.resolve().then(t.onload)}static getDefaults(){return Object.assign(Vd.getDefaults(),{attack:0,baseUrl:"",curve:"exponential",onload:$h,onerror:$h,release:.1,urls:{}})}_findClosest(t){let e=0;for(;e<96;){if(this._buffers.has(t+e))return-e;if(this._buffers.has(t-e))return e;e++}throw new Error(`No available buffers for note: ${t}`)}triggerAttack(t,e,n=1){return this.log("triggerAttack",t,e,n),Array.isArray(t)||(t=[t]),t.forEach(t=>{const r=_s(new Jh(this.context,t).toFrequency()),i=Math.round(r),o=r-i,s=this._findClosest(i),a=i-s,u=this._buffers.get(a),c=fs(s+o),l=new ap({url:u,context:this.context,curve:this.curve,fadeIn:this.attack,fadeOut:this.release,playbackRate:c}).connect(this.output);l.start(e,0,u.duration/c,n),rh(this._activeSources.get(i))||this._activeSources.set(i,[]),this._activeSources.get(i).push(l),l.onended=()=>{if(this._activeSources&&this._activeSources.has(i)){const t=this._activeSources.get(i),e=t.indexOf(l);-1!==e&&t.splice(e,1)}}}),this}triggerRelease(t,e){return this.log("triggerRelease",t,e),Array.isArray(t)||(t=[t]),t.forEach(t=>{const n=new Jh(this.context,t).toMidi();if(this._activeSources.has(n)&&this._activeSources.get(n).length){const t=this._activeSources.get(n);e=this.toSeconds(e),t.forEach(t=>{t.stop(e)}),this._activeSources.set(n,[])}}),this}releaseAll(t){const e=this.toSeconds(t);return this._activeSources.forEach(t=>{for(;t.length;){t.shift().stop(e)}}),this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1)),this}triggerAttackRelease(t,e,n,r=1){const i=this.toSeconds(n);return this.triggerAttack(t,i,r),rh(e)?(dh(rh(t),"notes must be an array when duration is array"),t.forEach((t,n)=>{const r=e[Math.min(n,e.length-1)];this.triggerRelease(t,i+this.toSeconds(r))})):this.triggerRelease(t,i+this.toSeconds(e)),this}add(t,e,n){if(dh(oh(t)||isFinite(t),`note must be a pitch or midi: ${t}`),oh(t)){const r=new Jh(this.context,t).toMidi();this._buffers.add(r,e,n)}else this._buffers.add(t,e,n);return this}get loaded(){return this._buffers.loaded}dispose(){return super.dispose(),this._buffers.dispose(),this._activeSources.forEach(t=>{t.forEach(t=>t.dispose())}),this._activeSources.clear(),this}}s([cd(0)],kp.prototype,"attack",void 0),s([cd(0)],kp.prototype,"release",void 0);const Sp={synth:{new:t=>new zd(t)},amsynth:{new:t=>new Jd(t)},duosynth:{new:t=>new np(t)},fmsynth:{new:t=>new rp(t)},membranesynth:{new:t=>new ip(t)},metalsynth:{new:t=>new sp(t)},monosynth:{new:t=>new Yd(t)},noisesynth:{new:t=>new dp(t)},plucksynth:{new:t=>new bp(t)},polysynth:{new:(t,e)=>new xp(t,e)},sampler:{new:t=>new kp(t)}},Ap={synth:zd,monosynth:Yd,fmsynth:rp,duosyntho:np,amsynth:Jd},Ep={autofilter:{new:t=>new tonepkg.AutoFilter(t)},bitcrusher:{new:t=>new tonepkg.BitCrusher(t)},chebyshev:{new:t=>new tonepkg.Chebyshev(t)},pitchshift:{new:t=>new tonepkg.PitchShift(t)}},Op=(t,e,n=!1)=>{try{if(e?.effect){return n?(globalThis.sound[t].set(e.effect.options),globalThis.sound[t]):Ep[e.effect.type]?.new(e.effect.options)}throw"effect is not defined in the config"}catch(t){return}},Cp=()=>{globalThis.sound={}},Mp=t=>{globalThis.sound[t]&&(globalThis.sound[t].dispose(),delete globalThis.sound[t])},{JZZ:Np}=hs,Ip=(bn("error",{type:"critical",message:"LEAF core error: race condition detected in sound.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/sound.js"},{}),{24:["C"],25:["C#","Db"],26:["D"],27:["D#","Eb"],28:["E"],29:["F"],30:["F#","Gb"],31:["G"],32:["G#","Ab"],33:["A"],34:["A#","Bb"],35:["B"]}),jp=(t,e=0)=>{const n=1+Math.floor((t-24)/12);return Ip[t-12*(n-1)][e]+String(n)},Rp=t=>{const e=t[cg.LAMBDA_OBJ],n="_default"in e?e._default:void 0,r="instrument"in e||"inst"in e,i="source"in e||"src"in e,o="effect"in e||"fx"in e,s="target"in e||"trg"in e,a={codebase:"ghostos/api/parser/nodelogic/elements/library/sound.js",refnode:t[cg.REFNODE]},u=(bn("accio","ctrl_accio"),bn("accio","data_accio"));(n?a_(n,u,{},a.refnode):Promise.resolve({audionode:{type:"gain",value:.5},source:{type:"oscillator",options:{type:"sine"}},timing:{bpm:150},instrument:{type:"polysynth",voice:"synth",options:{}}})).then(e=>{t[cg.sound.CONFIG]=e});const c=(e=void 0)=>{if(e){const o=e._content.soundnode_trail.slice(-1)[0],a=t[cg.REFNODE];s?(i=o,globalThis.sound[i].toDestination()):o&&a&&(n=o,r=a,globalThis.sound[n].connect(globalThis.sound[r]))}var n,r,i;return{...e,_content:{soundnode_trail:e._content.soundnode_trail.concat(t[cg.REFNODE])}}},l=(e=void 0)=>{let n,s;e?(n=wn("soundconfig",e),t[cg.sound.CONFIG]=n):n=t[cg.sound.CONFIG],s=r?((t,e,n=!1)=>{try{if(e?.instrument)return n?(globalThis.sound[t].set(e.instrument.options),globalThis.sound[t]):Sp[e.instrument.type]?.new(e.instrument.voice?Ap[e.instrument.voice]:zd,e.instrument.options);throw"instrument is not defined in the config"}catch(t){return}})(t[cg.REFNODE],n):i?void 0:o?Op(t[cg.REFNODE],n,void 0!==t[cg.sound.SOUNDSTAGE]):Op(t[cg.REFNODE],n),t[cg.sound.SOUNDSTAGE]=s,((t,e)=>{globalThis.sound[t]=e})(t[cg.REFNODE],s)};return{leaflogic:(e,n)=>{const r=new Bt(void 0),i=n._stream.pipe(U(e=>(t[cg.CTRLIN]=e,e)),Mt(...e.map(t=>t._stream)),U(e=>{const n=e.slice(1).flat().map(t=>{if("_data_in"===t._bname)return wn("*",t);if("_midi_in"===t._bname){const{cmd:e,noteNumber:n,velocity:r}=t._content;return t}if("soundconfig"===t._bname)l(t);else if("soundinit"===t._bname)return c(t)}).filter(t=>t);return n.length>0&&r.next(n),t[cg.CTRLIN]}),Dt());return{_stream:r.pipe(Ft(t=>t)),_control:{_stream:i}}},datalogic:{pre:e=>{const n=e;return t[cg.sound.SOUNDSTAGE]||s||l(),s&&"started"!==tonepkg.Transport.state&&(tonepkg.start(),tonepkg.Transport.start()),n},post:n=>{const r=Object.keys(e),i=["image","audio","video"].filter(t=>r.includes(t));i.length>0&&i[0];Array.isArray(n);let o=n.map(e=>{if("_midi_in"===e._bname){const n=t[cg.sound.SOUNDSTAGE];if(e._content.velocity>0){const t=jp(e._content.noteNumber),r=e._content.duration;r?n.triggerAttackRelease(t,r):n.triggerAttack(t)}else{const t=jp(e._content.noteNumber);n.triggerRelease(t)}return xn}return e});o=1===o.length?o[0]:o;return o}}}},Pp=bn("error",{type:"critical",message:"LEAF core error: race condition detected in gnav.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/gnav.js"},{}),Dp=t=>{const e=t[cg.LAMBDA_OBJ],n="elementio"in e,r="edges"in e&&"_default"in e.edges?e.edges._default:void 0,i="backdrop"in e&&"_default"in e.backdrop?e.backdrop._default:void 0,o={codebase:"ghostos/api/parser/nodelogic/elements/library/gnav.js",refnode:t[cg.REFNODE]};let s={};return{leaflogic:(e,n)=>{s=n._config;const a=new Rt,u=r?p_(n,e,void 0,o,{leaflogic:r,datalogic:{post:e=>(t[cg.gnav.EDGES]=e,e)}}):{_stream:cn([]),_control:n._stream},c=(i?p_(u._control,e,void 0,o,{leaflogic:i,datalogic:{post:e=>(t[cg.gnav.BACKDROP]=e,e)}}):{_stream:cn("/assets/test/hubbleinfrared_dark2.jpg"),_control:u._control})._control._stream.pipe(Mt(...e.map(t=>t._stream)),U(t=>{const e=t[1];return void 0!==e&&a.next(e),t[0]}));return{_stream:a,_control:{_stream:c}}},datalogic:{pre:t=>Array.isArray(t)?t.map(t=>wn("screenio",t)).filter(t=>t):wn("screenio",t),post:r=>{const i=r,o=wn(t[cg.gnav.EDGES]),a=(o||[]).map(t=>({...t,uuid:uuid4()})),u=t[cg.gnav.BACKDROP],c=Object.keys(e),l=(["edges","backdrop","tagvectors","tagaction","blankaction"].filter(t=>c.includes(t)),new Bt(Pp)),h=lg({element:{nodeuuid:t[cg.REFNODE],type:"gnav",componentdata:{graph_data:{nodes:Array.isArray(i)?i:[i],edges:a},backdrop_url:u,bgtagvectors:async()=>{const t="tagvectors"in e&&"_default"in e.tagvectors?e.tagvectors._default:void 0;return t?await a_(t,[],{...s}):[]},tagaction:async r=>{const i="tagaction"in e&&"_default"in e.tagaction?e.tagaction._default:void 0,o=i?await a_(i,r,{...s}):r;return n&&l.next(bn("elementio",{element:"gnav",nodeuuid:t[cg.REFNODE],io:{tagaction:o}})),o},blankaction:async t=>{const n="blankaction"in e&&"_default"in e.blankaction?e.blankaction._default:void 0;return n?await a_(n,t,{...s}):t},graph_options:{layout:"3d"},...t[cg.RTCONTEXT]}}},"screenio");return h}}}},{memoize:Lp}=vn,Fp=(bn("error",{type:"critical",message:"LEAF core error: race condition detected in http.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library.js"},{}),t=>{const e=t[cg.LAMBDA_OBJ],n="uri"in e&&"_default"in e.uri?e.uri._default:void 0,r="header"in e&&"_default"in e.header?e.header._default:void 0,i={codebase:"ghostos/api/parser/nodelogic/elements/library/http.js",refnode:t[cg.REFNODE]},o=async(n,r={})=>{let i=t[cg.http.URI],o=t[cg.http.HEADER],s=n;s=1===s.length?s[0]:s;const a=Object.keys(e),u=["uri","post","put","get","header","?graph"].filter(t=>a.includes(t));let c=u.includes("post")?"post":u.includes("put")?"put":"get";"{*}"===i&&en(s)&&"http-request"===s._bname&&(i=s._content.uri?s._content.uri:"https://www.leafgon.com",o=s._content.header?s._content.header:o,c=s._content.mode?s._content.mode:c,s=s._content.data?s._content.data:"");const l=cg.DOMAIN?t[cg.DOMAIN]:void 0,h=cg.APPID?t[cg.APPID]:void 0,d=u.includes("?graph")?i+`?graph=${l}/${h}`:i;let p;r.some(t=>Object.values(t).some(t=>"object"==typeof t&&"leaf-nodejs"===t._label?.provenance&&(p=t._content,!0)));const f=vn.throttle(async()=>await(async({http_mode:t,uri:e}={})=>{if(["post","put"].includes(t))try{const n=e?fetch(e,{method:t.toUpperCase(),mode:"cors",headers:p?{...o,Cookie:p}:{...o},credentials:"include",body:JSON.stringify(s)}):cn([{data:"LEAF element error: http get request submitted with undefined URI"}]),r=await n;return await r.json()}catch(t){return t.response||t.request,t.response}else try{const t=e?fetch(e,{method:"GET",headers:p?{...o,Accept:"application/json",Cookie:p}:{...o,Accept:"application/json"},credentials:"include"}):cn([{data:"LEAF element error: http get request submitted with undefined URI"}]),n=await t;return await n.json()}catch(t){return t.response||t.request,t}})({http_mode:c,uri:d}),1e3);return await f()};return{leaflogic:(e,s)=>{const a=new Rt,u=n?p_(s,e,void 0,i,{leaflogic:n,datalogic:{post:e=>(t[cg.http.URI]=e,e)}}):(t[cg.http.URI]="{*}",{_stream:new Bt("{*}"),_control:{_stream:s._stream}}),c=r?p_(s,e,void 0,i,{leaflogic:r,datalogic:{post:e=>(t[cg.http.HEADER]=e,e)}}):(t[cg.http.HEADER]="",{_stream:new Bt(""),_control:{_stream:s._stream}}),l=At([u._control._stream,c._control._stream]),h=At([u._stream,c._stream]),d=l.pipe(Mt(h),U(t=>t[0]));let p=!1;const f=d.pipe(Mt(...e.map(t=>t._stream)),Nt(t=>o(t.slice(1),t[0])),U(e=>(p=!0,e?.length>1||!Array.isArray(e)?a.next(e):1===e?.length&&a.next(e[0]),t[cg.CTRLIN])),Dt());return{_stream:a.pipe(Ft(t=>p),U(t=>t),Dt()),_control:{_stream:f.pipe(U(t=>t),Dt())}}},datalogic:{pre:t=>t,post:t=>{const e=t,n=t=>{const e=typeof t;return"object"===e?Array.isArray(t)?t.map(t=>n(t)):t?Object.fromEntries(Object.entries(t).map(([t,e])=>[t,n(e)])):t:"string"===e?(t=>{var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return t.replace(/[&<>"']/g,function(t){return e[t]})})(t):t};return lg(e?.name&&"AxiosError"===e.name?{error:e.message,data:e.response.data}:n(e),"elementio")}}}}),{memoize:$p}=vn,Bp=(bn("error",{type:"critical",message:"LEAF core error: race condition detected in href.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library.js"},{}),t=>{const e=t[cg.LAMBDA_OBJ],n="uri"in e&&"_default"in e.uri?e.uri._default:void 0,r={codebase:"ghostos/api/parser/nodelogic/elements/library/href.js",refnode:t[cg.REFNODE]},i=async n=>{let r=t[cg.href.URI],i=n;i=1===i.length?i[0]:i;const o=Object.keys(e),s=["uri","post","put","get","header","?graph"].filter(t=>o.includes(t));"{*}"===r&&en(i)&&"href-request"===i._bname&&(r=i._content.uri?i._content.uri:"https://www.leafgon.com",i=i._content.data?i._content.data:"");const a=cg.DOMAIN?t[cg.DOMAIN]:void 0,u=cg.APPID?t[cg.APPID]:void 0,c=s.includes("?graph")?r+`?graph=${a}/${u}`:r,l=vn.throttle(async()=>await(async({uri:t}={})=>{try{return"undefined"!=typeof window&&window.location.href.slice(-t.length)!==t&&(window.location.href=t),t}catch(t){return t}})({uri:c}),1e3);return await l()};return{leaflogic:(e,o)=>{const s=new Rt,a=n?p_(o,e,void 0,r,{leaflogic:n,datalogic:{post:e=>(t[cg.href.URI]=e,e)}}):(t[cg.href.URI]="{*}",{_stream:new Bt("{*}"),_control:{_stream:o._stream}}),u=a._control._stream,c=a._stream,l=u.pipe(Mt(c),U(t=>t[0]));let h=!1;const d=l.pipe(Mt(...e.map(t=>t._stream)),Nt(t=>i(t.slice(1))),U(e=>(h=!0,e?.length>1||!Array.isArray(e)?s.next(e):1===e?.length&&s.next(e[0]),t[cg.CTRLIN])),Dt());return{_stream:s.pipe(Ft(t=>h),U(t=>t),Dt()),_control:{_stream:d.pipe(U(t=>t),Dt())}}},datalogic:{pre:t=>t}}});var qp=n(639);bn("error",{type:"critical",message:"LEAF core error: race condition detected in text.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/text.js"},{});const Up=t=>{const e=new Rt,n=new Rt,r=new Rt,i=t[cg.LAMBDA_OBJ],o="_default"in i?i._default:void 0,s={codebase:"ghostos/api/parser/nodelogic/elements/library/html.js",...t},a=bn("accio","ctrl_accio"),u=bn("accio","data_accio"),c=o?p_({_stream:cn(a)},[{_stream:cn(u)}],void 0,s,{leaflogic:o,datalogic:{post:t=>t}}):{_stream:cn(""),_control:{_stream:cn(a)}};t[cg.html.TEMPLATE]=void 0,un(c._control._stream.pipe(Mt(c._stream))).then(e=>{const n=typeof e[1];if("string"===n)t[cg.html.TEMPLATE]={_default:qp.compile(e[1])};else if("object"===n){const n={};Object.entries(e[1]).map(([t,e])=>{const r=[e].flat().map(t=>{if("string"==typeof t)return t}).filter(t=>void 0!==t).join("\n");""!==r&&(n[t]=qp.compile(r))}),Object.keys(n).length>0&&(t[cg.html.TEMPLATE]=n)}qp.registerHelper("markdown",function(t){t=(t=(t=(t=(t=(t=t.replace(/&gt;/gm,">")).replace(/&lt;/gm,"<")).replace(/&amp;/gm,"&")).replace(/(\r\n|\n|\r)/gm,"\n")).replace(/\\&quot;/gm,'\\"')).replace(/&quot;/gm,'"');return`atob('${Buffer.from(t).toString("base64")}')`}),qp.registerHelper("json",function(t){const e=Buffer.from(JSON.stringify(t,function t(e,n){const r=typeof n;if("string"===r){const t=/^\{((?:-(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))|(?:0|(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))))(?:.\d+|))\}$/,e=n.match(t);if(null!==e){return Number(e[1])}return n}if("object"===r){if(Array.isArray(n))return n.map((e,n)=>t(n,e));return Object.assign({},...Object.entries(n).map(([e,n])=>({[e]:t(e,n)})))}return n})).toString("base64");return`JSON.parse(atob('${e}'))`}),qp.registerHelper("tostring",function(t){return String(t)}),r.next()});return{elementio$:n,leaflogic:(i,o)=>{const s=o._stream.pipe(Mt(...i.map(t=>t._stream)),Nt(e=>{const i=new Bt(e[0]),o=new Bt(e[1]);return t[cg.html.TEMPLATE]?At(i,$t(o,n)):r.pipe(Mt(i,$t(o,n)),U(t=>t[1]))}),U(r=>{const i=t[cg.html.TEMPLATE],o=r[1];if(en(o)&&"elementio"===o._bname)return e.next(o),r[0];if(void 0!==i){const s=((t,e)=>{if(void 0!==e){const n=Object.keys(e);return(1===n.length&&n.includes("_default")?[e._default(Object.assign({},...[t].flat().map(t=>wn("*",t))))]:[t].flat().sort((t,e)=>{const n=t._label?.tag?.toLowerCase(),r=e._label?.tag?.toLowerCase();return n>r?1:n<r?-1:0}).map(t=>{if(en(t)){const n=wn("*",t),r=t._bname;return[n].flat().map(t=>t&&r in e?e[r](t):t&&"_default"in e?e._default(t):"string"==typeof t?t:void 0).filter(t=>void 0!==t).join("\n")}}).filter(t=>void 0!==t)).join("\n").replace(/(\r\n|\n|\r)/gm,"")}return t})(o,i),a=lg({element:{nodeuuid:t[cg.REFNODE],type:"html",componentdata:{innerhtml:s,callback:t=>{n.next(bn("elementio",t))},...t[cg.RTCONTEXT]}}},"screenio");return e.next(a),r[0]}}),Ft(t=>void 0!==t));return{_stream:e,_control:{_stream:s}}},datalogic:{pre:t=>t,post:t=>t}}},Vp=(bn("error",{type:"critical",message:"LEAF core error: race condition detected in text.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/text.js"},{}),t=>{const e=new Rt,n=new Rt,r=new Rt,i=t[cg.LAMBDA_OBJ],o="_default"in i?i._default:void 0,s="single"in i,a={codebase:"ghostos/api/parser/nodelogic/elements/library/form.js",...t},u=bn("accio","ctrl_accio"),c=bn("accio","data_accio"),l=o?p_({_stream:cn(u)},[{_stream:cn(c)}],void 0,a,{leaflogic:o,datalogic:{post:t=>t}}):{_stream:cn(""),_control:{_stream:cn(u)}};t[cg.html.TEMPLATE]=void 0,un(l._control._stream.pipe(Mt(l._stream))).then(e=>{const n=typeof e[1];if("string"===n)t[cg.html.TEMPLATE]={_default:qp.compile(e[1])};else if("object"===n){const n={};Object.entries(e[1]).map(([t,e])=>{const r=[e].flat().map(t=>{if("string"==typeof t)return t}).filter(t=>void 0!==t).join("\n");""!==r&&(n[t]=qp.compile(r))}),Object.keys(n).length>0&&(t[cg.html.TEMPLATE]=n)}qp.registerHelper("json",function(t){return JSON.stringify(t,function t(e,n){const r=typeof n;if("string"===r){const t=/^\{((?:-(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))|(?:0|(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))))(?:.\d+|))\}$/,e=n.match(t);if(null!==e){return Number(e[1])}return n}if("object"===r){if(Array.isArray(n))return n.map((e,n)=>t(n,e));return Object.assign({},...Object.entries(n).map(([e,n])=>({[e]:t(e,n)})))}return n})}),r.next()});return{elementio$:n,leaflogic:(i,o)=>{const a=o._stream.pipe(Mt(...i.map(t=>t._stream)),Nt(e=>{const i=new Bt(e[0]),o=new Bt(e[1]);return t[cg.html.TEMPLATE]?At(i,$t(o,n)):r.pipe(Mt(i,$t(o,n)),U(t=>t[1]))}),U(n=>{const r=t[cg.html.TEMPLATE],i=n[1];if(en(i)&&"elementio"===i._bname)return e.next(i),n[0];if(void 0!==r){const r=(()=>{const e=`\n <script type='text/babel'>\n const Form = JSONSchemaForm.default;\n const schema = {\n title: 'react-jsonschema-form demo',\n type: 'object',\n required: ['name', 'email'],\n properties: {\n name: {type: 'string', minLength: 3},\n email: {type: 'string'},\n dob: {type: 'string'},\n age: {type: 'number'},\n thing: {type: 'string'},\n other: {type: 'string'},\n }\n };\n const uiSchema = {\n email: {\n 'ui:options': {\n inputType: 'email'\n }\n },\n dob: {\n 'ui:widget': 'alt-date',\n 'ui:options': {\n yearsRange: [1980, 2030],\n hideNowButton: true,\n hideClearButton: true,\n },\n },\n };\n \n function Tpl(props) {\n const {id, label, required, children} = props;\n return (\n <div className='myfield'>\n <label htmlFor={id}>{label}{required ? '*' : null}</label>\n {children}\n </div>\n );\n };\n\n function dosubmit({ formData }, e) {\n doelementio({_bname: '${t[cg.REFNODE].slice(0,8)}', _content: formData, _label: {refnode: '${t[cg.REFNODE]}'}});\n };\n\n function SubmitButton(props) {\n const { uiSchema } = props;\n return (\n <button type='submit'>\n Yadda\n </button>\n );\n }\n \n ReactDOM.render(\n (<Form onSubmit={dosubmit} className='row' schema={schema} uiSchema={uiSchema} FieldTemplate={Tpl} liveValidate >\n <div style={{marginBottom: '70px'}}>\n <button className='unicornbutton' type='submit'>\n Yadda\n </button>\n </div>\n </Form>\n ),\n document.getElementById('${t[cg.REFNODE]}')\n );\n <\/script>\n `,n=`\n <div id='${t[cg.REFNODE]}'></div>\n `,r=t=>t.replace(/(\r\n|\n|\r)/gm,"").replace(/(\s+)/gm," "),i=t[cg.REFNODE].slice(0,8),o=s?"form-style":"form-style-"+i,a=s?"form-script":"form-script-"+i,u=s?"form-body":"form-body-"+i;return bn(i,{"form-common":r("\n \x3c!-- Bootstrap core CSS --\x3e\n <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css' rel='stylesheet' integrity='sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH' crossorigin='anonymous'>\n <script crossorigin src='https://unpkg.com/react@17.0.2/umd/react.development.js'><\/script>\n <script crossorigin src='https://unpkg.com/react-dom@17.0.2/umd/react-dom.development.js'><\/script>\n <script src='https://unpkg.com/@babel/standalone@7.23.10/babel.min.js'><\/script>\n <script src='https://unpkg.com/@rjsf/core@4.2.3/dist/react-jsonschema-form.js'><\/script>\n "),[o]:r("\n <style>\n .unicornbutton {\n background-image: url('https://leas3.ams3.cdn.digitaloceanspaces.com/static/lax/assets/button-bg.jpg');\n width: 250px;\n height: 70px;\n background-size: 160px;\n color: white;\n font-weight: 800;\n text-align: center;\n line-height: 70px;\n font-size: 30px;\n text-decoration: none;\n border-radius: 20px;\n z-index: 100;\n pointer-events: all;\n cursor: pointer;\n }\n </style>\n "),[a]:r(e),[u]:r(n)},{uuid:t[cg.REFNODE]})})();return e.next(r),n[0]}}),Ft(t=>void 0!==t));return{_stream:e,_control:{_stream:a}}},datalogic:{pre:t=>t,post:t=>t}}});function Gp(t,e){return function(){return t.apply(e,arguments)}}const{toString:zp}=Object.prototype,{getPrototypeOf:Wp}=Object,{iterator:Jp,toStringTag:Hp}=Symbol,Xp=(Kp=Object.create(null),t=>{const e=zp.call(t);return Kp[e]||(Kp[e]=e.slice(8,-1).toLowerCase())});var Kp;const Qp=t=>(t=t.toLowerCase(),e=>Xp(e)===t),Zp=t=>e=>typeof e===t,{isArray:Yp}=Array,tf=Zp("undefined");function ef(t){return null!==t&&!tf(t)&&null!==t.constructor&&!tf(t.constructor)&&of(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const nf=Qp("ArrayBuffer");const rf=Zp("string"),of=Zp("function"),sf=Zp("number"),af=t=>null!==t&&"object"==typeof t,uf=t=>{if("object"!==Xp(t))return!1;const e=Wp(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Hp in t||Jp in t)},cf=Qp("Date"),lf=Qp("File"),hf=Qp("Blob"),df=Qp("FileList"),pf=Qp("URLSearchParams"),[ff,mf,gf,_f]=["ReadableStream","Request","Response","Headers"].map(Qp);function yf(t,e,{allOwnKeys:n=!1}={}){if(null==t)return;let r,i;if("object"!=typeof t&&(t=[t]),Yp(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{if(ef(t))return;const i=n?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let s;for(r=0;r<o;r++)s=i[r],e.call(null,t[s],s,t)}}function vf(t,e){if(ef(t))return null;e=e.toLowerCase();const n=Object.keys(t);let r,i=n.length;for(;i-- >0;)if(r=n[i],e===r.toLowerCase())return r;return null}const bf="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,wf=t=>!tf(t)&&t!==bf;const xf=(Tf="undefined"!=typeof Uint8Array&&Wp(Uint8Array),t=>Tf&&t instanceof Tf);var Tf;const kf=Qp("HTMLFormElement"),Sf=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Af=Qp("RegExp"),Ef=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};yf(n,(n,i)=>{let o;!1!==(o=e(n,i,t))&&(r[i]=o||n)}),Object.defineProperties(t,r)};const Of=Qp("AsyncFunction"),Cf=(Mf="function"==typeof setImmediate,Nf=of(bf.postMessage),Mf?setImmediate:Nf?(If=`axios@${Math.random()}`,jf=[],bf.addEventListener("message",({source:t,data:e})=>{t===bf&&e===If&&jf.length&&jf.shift()()},!1),t=>{jf.push(t),bf.postMessage(If,"*")}):t=>setTimeout(t));var Mf,Nf,If,jf;const Rf="undefined"!=typeof queueMicrotask?queueMicrotask.bind(bf):"undefined"!=typeof process&&process.nextTick||Cf,Pf={isArray:Yp,isArrayBuffer:nf,isBuffer:ef,isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||of(t.append)&&("formdata"===(e=Xp(t))||"object"===e&&of(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&nf(t.buffer),e},isString:rf,isNumber:sf,isBoolean:t=>!0===t||!1===t,isObject:af,isPlainObject:uf,isEmptyObject:t=>{if(!af(t)||ef(t))return!1;try{return 0===Object.keys(t).length&&Object.getPrototypeOf(t)===Object.prototype}catch(t){return!1}},isReadableStream:ff,isRequest:mf,isResponse:gf,isHeaders:_f,isUndefined:tf,isDate:cf,isFile:lf,isBlob:hf,isRegExp:Af,isFunction:of,isStream:t=>af(t)&&of(t.pipe),isURLSearchParams:pf,isTypedArray:xf,isFileList:df,forEach:yf,merge:function t(){const{caseless:e,skipUndefined:n}=wf(this)&&this||{},r={},i=(i,o)=>{const s=e&&vf(r,o)||o;uf(r[s])&&uf(i)?r[s]=t(r[s],i):uf(i)?r[s]=t({},i):Yp(i)?r[s]=i.slice():n&&tf(i)||(r[s]=i)};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&yf(arguments[t],i);return r},extend:(t,e,n,{allOwnKeys:r}={})=>(yf(e,(e,r)=>{n&&of(e)?Object.defineProperty(t,r,{value:Gp(e,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,r,{value:e,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},toFlatObject:(t,e,n,r)=>{let i,o,s;const a={};if(e=e||{},null==t)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],r&&!r(s,t,e)||a[s]||(e[s]=t[s],a[s]=!0);t=!1!==n&&Wp(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:Xp,kindOfTest:Qp,endsWith:(t,e,n)=>{t=String(t),(void 0===n||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return-1!==r&&r===n},toArray:t=>{if(!t)return null;if(Yp(t))return t;let e=t.length;if(!sf(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},forEachEntry:(t,e)=>{const n=(t&&t[Jp]).call(t);let r;for(;(r=n.next())&&!r.done;){const n=r.value;e.call(t,n[0],n[1])}},matchAll:(t,e)=>{let n;const r=[];for(;null!==(n=t.exec(e));)r.push(n);return r},isHTMLForm:kf,hasOwnProperty:Sf,hasOwnProp:Sf,reduceDescriptors:Ef,freezeMethods:t=>{Ef(t,(e,n)=>{if(of(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=t[n];of(r)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(t,e)=>{const n={},r=t=>{t.forEach(t=>{n[t]=!0})};return Yp(t)?r(t):r(String(t).split(e)),n},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,e,n){return e.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(t,e)=>null!=t&&Number.isFinite(t=+t)?t:e,findKey:vf,global:bf,isContextDefined:wf,isSpecCompliantForm:function(t){return!!(t&&of(t.append)&&"FormData"===t[Hp]&&t[Jp])},toJSONObject:t=>{const e=new Array(10),n=(t,r)=>{if(af(t)){if(e.indexOf(t)>=0)return;if(ef(t))return t;if(!("toJSON"in t)){e[r]=t;const i=Yp(t)?[]:{};return yf(t,(t,e)=>{const o=n(t,r+1);!tf(o)&&(i[e]=o)}),e[r]=void 0,i}}return t};return n(t,0)},isAsyncFn:Of,isThenable:t=>t&&(af(t)||of(t))&&of(t.then)&&of(t.catch),setImmediate:Cf,asap:Rf,isIterable:t=>null!=t&&of(t[Jp])};class Df extends Error{static from(t,e,n,r,i,o){const s=new Df(t.message,e||t.code,n,r,i);return s.cause=t,s.name=t.name,o&&Object.assign(s,o),s}constructor(t,e,n,r,i){super(t),this.name="AxiosError",this.isAxiosError=!0,e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Pf.toJSONObject(this.config),code:this.code,status:this.status}}}Df.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Df.ERR_BAD_OPTION="ERR_BAD_OPTION",Df.ECONNABORTED="ECONNABORTED",Df.ETIMEDOUT="ETIMEDOUT",Df.ERR_NETWORK="ERR_NETWORK",Df.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Df.ERR_DEPRECATED="ERR_DEPRECATED",Df.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Df.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Df.ERR_CANCELED="ERR_CANCELED",Df.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Df.ERR_INVALID_URL="ERR_INVALID_URL";const Lf=Df;function Ff(t){return Pf.isPlainObject(t)||Pf.isArray(t)}function $f(t){return Pf.endsWith(t,"[]")?t.slice(0,-2):t}function Bf(t,e,n){return t?t.concat(e).map(function(t,e){return t=$f(t),!n&&e?"["+t+"]":t}).join(n?".":""):e}const qf=Pf.toFlatObject(Pf,{},null,function(t){return/^is[A-Z]/.test(t)});const Uf=function(t,e,n){if(!Pf.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const r=(n=Pf.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(t,e){return!Pf.isUndefined(e[t])})).metaTokens,i=n.visitor||c,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Pf.isSpecCompliantForm(e);if(!Pf.isFunction(i))throw new TypeError("visitor must be a function");function u(t){if(null===t)return"";if(Pf.isDate(t))return t.toISOString();if(Pf.isBoolean(t))return t.toString();if(!a&&Pf.isBlob(t))throw new Lf("Blob is not supported. Use a Buffer instead.");return Pf.isArrayBuffer(t)||Pf.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function c(t,n,i){let a=t;if(t&&!i&&"object"==typeof t)if(Pf.endsWith(n,"{}"))n=r?n:n.slice(0,-2),t=JSON.stringify(t);else if(Pf.isArray(t)&&function(t){return Pf.isArray(t)&&!t.some(Ff)}(t)||(Pf.isFileList(t)||Pf.endsWith(n,"[]"))&&(a=Pf.toArray(t)))return n=$f(n),a.forEach(function(t,r){!Pf.isUndefined(t)&&null!==t&&e.append(!0===s?Bf([n],r,o):null===s?n:n+"[]",u(t))}),!1;return!!Ff(t)||(e.append(Bf(i,n,o),u(t)),!1)}const l=[],h=Object.assign(qf,{defaultVisitor:c,convertValue:u,isVisitable:Ff});if(!Pf.isObject(t))throw new TypeError("data must be an object");return function t(n,r){if(!Pf.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),Pf.forEach(n,function(n,o){!0===(!(Pf.isUndefined(n)||null===n)&&i.call(e,n,Pf.isString(o)?o.trim():o,r,h))&&t(n,r?r.concat(o):[o])}),l.pop()}}(t),e};function Vf(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}function Gf(t,e){this._pairs=[],t&&Uf(t,this,e)}const zf=Gf.prototype;zf.append=function(t,e){this._pairs.push([t,e])},zf.toString=function(t){const e=t?function(e){return t.call(this,e,Vf)}:Vf;return this._pairs.map(function(t){return e(t[0])+"="+e(t[1])},"").join("&")};const Wf=Gf;function Jf(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Hf(t,e,n){if(!e)return t;const r=n&&n.encode||Jf,i=Pf.isFunction(n)?{serialize:n}:n,o=i&&i.serialize;let s;if(s=o?o(e,i):Pf.isURLSearchParams(e)?e.toString():new Wf(e,i).toString(r),s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t}const Xf=class{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Pf.forEach(this.handlers,function(e){null!==e&&t(e)})}},Kf={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Qf={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Wf,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Zf="undefined"!=typeof window&&"undefined"!=typeof document,Yf="object"==typeof navigator&&navigator||void 0,tm=Zf&&(!Yf||["ReactNative","NativeScript","NS"].indexOf(Yf.product)<0),em="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,nm=Zf&&window.location.href||"http://localhost",rm={...r,...Qf};const im=function(t){function e(t,n,r,i){let o=t[i++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=i>=t.length;if(o=!o&&Pf.isArray(r)?r.length:o,a)return Pf.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!s;r[o]&&Pf.isObject(r[o])||(r[o]=[]);return e(t,n,r[o],i)&&Pf.isArray(r[o])&&(r[o]=function(t){const e={},n=Object.keys(t);let r;const i=n.length;let o;for(r=0;r<i;r++)o=n[r],e[o]=t[o];return e}(r[o])),!s}if(Pf.isFormData(t)&&Pf.isFunction(t.entries)){const n={};return Pf.forEachEntry(t,(t,r)=>{e(function(t){return Pf.matchAll(/\w+|\[(\w*)]/g,t).map(t=>"[]"===t[0]?"":t[1]||t[0])}(t),r,n,0)}),n}return null};const om={transitional:Kf,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",r=n.indexOf("application/json")>-1,i=Pf.isObject(t);i&&Pf.isHTMLForm(t)&&(t=new FormData(t));if(Pf.isFormData(t))return r?JSON.stringify(im(t)):t;if(Pf.isArrayBuffer(t)||Pf.isBuffer(t)||Pf.isStream(t)||Pf.isFile(t)||Pf.isBlob(t)||Pf.isReadableStream(t))return t;if(Pf.isArrayBufferView(t))return t.buffer;if(Pf.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return Uf(t,new rm.classes.URLSearchParams,{visitor:function(t,e,n,r){return rm.isNode&&Pf.isBuffer(t)?(this.append(e,t.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...e})}(t,this.formSerializer).toString();if((o=Pf.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return Uf(o?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||r?(e.setContentType("application/json",!1),function(t,e,n){if(Pf.isString(t))try{return(e||JSON.parse)(t),Pf.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||om.transitional,n=e&&e.forcedJSONParsing,r="json"===this.responseType;if(Pf.isResponse(t)||Pf.isReadableStream(t))return t;if(t&&Pf.isString(t)&&(n&&!this.responseType||r)){const n=!(e&&e.silentJSONParsing)&&r;try{return JSON.parse(t,this.parseReviver)}catch(t){if(n){if("SyntaxError"===t.name)throw Lf.from(t,Lf.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:rm.classes.FormData,Blob:rm.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Pf.forEach(["delete","get","head","post","put","patch"],t=>{om.headers[t]={}});const sm=om,am=Pf.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),um=Symbol("internals");function cm(t){return t&&String(t).trim().toLowerCase()}function lm(t){return!1===t||null==t?t:Pf.isArray(t)?t.map(lm):String(t)}function hm(t,e,n,r,i){return Pf.isFunction(r)?r.call(this,e,n):(i&&(e=n),Pf.isString(e)?Pf.isString(r)?-1!==e.indexOf(r):Pf.isRegExp(r)?r.test(e):void 0:void 0)}class dm{constructor(t){t&&this.set(t)}set(t,e,n){const r=this;function i(t,e,n){const i=cm(e);if(!i)throw new Error("header name must be a non-empty string");const o=Pf.findKey(r,i);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||e]=lm(t))}const o=(t,e)=>Pf.forEach(t,(t,n)=>i(t,n,e));if(Pf.isPlainObject(t)||t instanceof this.constructor)o(t,e);else if(Pf.isString(t)&&(t=t.trim())&&!(t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()))(t))o((t=>{const e={};let n,r,i;return t&&t.split("\n").forEach(function(t){i=t.indexOf(":"),n=t.substring(0,i).trim().toLowerCase(),r=t.substring(i+1).trim(),!n||e[n]&&am[n]||("set-cookie"===n?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e})(t),e);else if(Pf.isObject(t)&&Pf.isIterable(t)){let n,r,i={};for(const e of t){if(!Pf.isArray(e))throw TypeError("Object iterator must return a key-value pair");i[r=e[0]]=(n=i[r])?Pf.isArray(n)?[...n,e[1]]:[n,e[1]]:e[1]}o(i,e)}else null!=t&&i(e,t,n);return this}get(t,e){if(t=cm(t)){const n=Pf.findKey(this,t);if(n){const t=this[n];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}(t);if(Pf.isFunction(e))return e.call(this,t,n);if(Pf.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=cm(t)){const n=Pf.findKey(this,t);return!(!n||void 0===this[n]||e&&!hm(0,this[n],n,e))}return!1}delete(t,e){const n=this;let r=!1;function i(t){if(t=cm(t)){const i=Pf.findKey(n,t);!i||e&&!hm(0,n[i],i,e)||(delete n[i],r=!0)}}return Pf.isArray(t)?t.forEach(i):i(t),r}clear(t){const e=Object.keys(this);let n=e.length,r=!1;for(;n--;){const i=e[n];t&&!hm(0,this[i],i,t,!0)||(delete this[i],r=!0)}return r}normalize(t){const e=this,n={};return Pf.forEach(this,(r,i)=>{const o=Pf.findKey(n,i);if(o)return e[o]=lm(r),void delete e[i];const s=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,n)=>e.toUpperCase()+n)}(i):String(i).trim();s!==i&&delete e[i],e[s]=lm(r),n[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return Pf.forEach(this,(n,r)=>{null!=n&&!1!==n&&(e[r]=t&&Pf.isArray(n)?n.join(", "):n)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach(t=>n.set(t)),n}static accessor(t){const e=(this[um]=this[um]={accessors:{}}).accessors,n=this.prototype;function r(t){const r=cm(t);e[r]||(!function(t,e){const n=Pf.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(t,n,i){return this[r].call(this,e,t,n,i)},configurable:!0})})}(n,t),e[r]=!0)}return Pf.isArray(t)?t.forEach(r):r(t),this}}dm.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Pf.reduceDescriptors(dm.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}}),Pf.freezeMethods(dm);const pm=dm;function fm(t,e){const n=this||sm,r=e||n,i=pm.from(r.headers);let o=r.data;return Pf.forEach(t,function(t){o=t.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function mm(t){return!(!t||!t.__CANCEL__)}const gm=class extends Lf{constructor(t,e,n){super(null==t?"canceled":t,Lf.ERR_CANCELED,e,n),this.name="CanceledError",this.__CANCEL__=!0}};function _m(t,e,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?e(new Lf("Request failed with status code "+n.status,[Lf.ERR_BAD_REQUEST,Lf.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}const ym=function(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i,o=0,s=0;return e=void 0!==e?e:1e3,function(a){const u=Date.now(),c=r[s];i||(i=u),n[o]=a,r[o]=u;let l=s,h=0;for(;l!==o;)h+=n[l++],l%=t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),u-i<e)return;const d=c&&u-c;return d?Math.round(1e3*h/d):void 0}};const vm=function(t,e){let n,r,i=0,o=1e3/e;const s=(e,o=Date.now())=>{i=o,n=null,r&&(clearTimeout(r),r=null),t(...e)};return[(...t)=>{const e=Date.now(),a=e-i;a>=o?s(t,e):(n=t,r||(r=setTimeout(()=>{r=null,s(n)},o-a)))},()=>n&&s(n)]},bm=(t,e,n=3)=>{let r=0;const i=ym(50,250);return vm(n=>{const o=n.loaded,s=n.lengthComputable?n.total:void 0,a=o-r,u=i(a);r=o;t({loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:u||void 0,estimated:u&&s&&o<=s?(s-o)/u:void 0,event:n,lengthComputable:null!=s,[e?"download":"upload"]:!0})},n)},wm=(t,e)=>{const n=null!=t;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},xm=t=>(...e)=>Pf.asap(()=>t(...e)),Tm=rm.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,rm.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(rm.origin),rm.navigator&&/(msie|trident)/i.test(rm.navigator.userAgent)):()=>!0,km=rm.hasStandardBrowserEnv?{write(t,e,n,r,i,o,s){if("undefined"==typeof document)return;const a=[`${t}=${encodeURIComponent(e)}`];Pf.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),Pf.isString(r)&&a.push(`path=${r}`),Pf.isString(i)&&a.push(`domain=${i}`),!0===o&&a.push("secure"),Pf.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(t){if("undefined"==typeof document)return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function Sm(t,e,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);return t&&(r||0==n)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const Am=t=>t instanceof pm?{...t}:t;function Em(t,e){e=e||{};const n={};function r(t,e,n,r){return Pf.isPlainObject(t)&&Pf.isPlainObject(e)?Pf.merge.call({caseless:r},t,e):Pf.isPlainObject(e)?Pf.merge({},e):Pf.isArray(e)?e.slice():e}function i(t,e,n,i){return Pf.isUndefined(e)?Pf.isUndefined(t)?void 0:r(void 0,t,0,i):r(t,e,0,i)}function o(t,e){if(!Pf.isUndefined(e))return r(void 0,e)}function s(t,e){return Pf.isUndefined(e)?Pf.isUndefined(t)?void 0:r(void 0,t):r(void 0,e)}function a(n,i,o){return o in e?r(n,i):o in t?r(void 0,n):void 0}const u={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(t,e,n)=>i(Am(t),Am(e),0,!0)};return Pf.forEach(Object.keys({...t,...e}),function(r){const o=u[r]||i,s=o(t[r],e[r],r);Pf.isUndefined(s)&&o!==a||(n[r]=s)}),n}const Om=t=>{const e=Em({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=e;if(e.headers=s=pm.from(s),e.url=Hf(Sm(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Pf.isFormData(n))if(rm.hasStandardBrowserEnv||rm.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(Pf.isFunction(n.getHeaders)){const t=n.getHeaders(),e=["content-type","content-length"];Object.entries(t).forEach(([t,n])=>{e.includes(t.toLowerCase())&&s.set(t,n)})}if(rm.hasStandardBrowserEnv&&(r&&Pf.isFunction(r)&&(r=r(e)),r||!1!==r&&Tm(e.url))){const t=i&&o&&km.read(o);t&&s.set(i,t)}return e},Cm="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise(function(e,n){const r=Om(t);let i=r.data;const o=pm.from(r.headers).normalize();let s,a,u,c,l,{responseType:h,onUploadProgress:d,onDownloadProgress:p}=r;function f(){c&&c(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=pm.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());_m(function(t){e(t),f()},function(t){n(t),f()},{data:h&&"text"!==h&&"json"!==h?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:t,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new Lf("Request aborted",Lf.ECONNABORTED,t,m)),m=null)},m.onerror=function(e){const r=e&&e.message?e.message:"Network Error",i=new Lf(r,Lf.ERR_NETWORK,t,m);i.event=e||null,n(i),m=null},m.ontimeout=function(){let e=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const i=r.transitional||Kf;r.timeoutErrorMessage&&(e=r.timeoutErrorMessage),n(new Lf(e,i.clarifyTimeoutError?Lf.ETIMEDOUT:Lf.ECONNABORTED,t,m)),m=null},void 0===i&&o.setContentType(null),"setRequestHeader"in m&&Pf.forEach(o.toJSON(),function(t,e){m.setRequestHeader(e,t)}),Pf.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),h&&"json"!==h&&(m.responseType=r.responseType),p&&([u,l]=bm(p,!0),m.addEventListener("progress",u)),d&&m.upload&&([a,c]=bm(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(r.cancelToken||r.signal)&&(s=e=>{m&&(n(!e||e.type?new gm(null,t,m):e),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const _=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(r.url);_&&-1===rm.protocols.indexOf(_)?n(new Lf("Unsupported protocol "+_+":",Lf.ERR_BAD_REQUEST,t)):m.send(i||null)})},Mm=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let n,r=new AbortController;const i=function(t){if(!n){n=!0,s();const e=t instanceof Error?t:this.reason;r.abort(e instanceof Lf?e:new gm(e instanceof Error?e.message:e))}};let o=e&&setTimeout(()=>{o=null,i(new Lf(`timeout of ${e}ms exceeded`,Lf.ETIMEDOUT))},e);const s=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(t=>{t.unsubscribe?t.unsubscribe(i):t.removeEventListener("abort",i)}),t=null)};t.forEach(t=>t.addEventListener("abort",i));const{signal:a}=r;return a.unsubscribe=()=>Pf.asap(s),a}},Nm=function*(t,e){let n=t.byteLength;if(!e||n<e)return void(yield t);let r,i=0;for(;i<n;)r=i+e,yield t.slice(i,r),i=r},Im=async function*(t){if(t[Symbol.asyncIterator])return void(yield*t);const e=t.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},jm=(t,e,n,r)=>{const i=async function*(t,e){for await(const n of Im(t))yield*Nm(n,e)}(t,e);let o,s=0,a=t=>{o||(o=!0,r&&r(t))};return new ReadableStream({async pull(t){try{const{done:e,value:r}=await i.next();if(e)return a(),void t.close();let o=r.byteLength;if(n){let t=s+=o;n(t)}t.enqueue(new Uint8Array(r))}catch(t){throw a(t),t}},cancel:t=>(a(t),i.return())},{highWaterMark:2})},{isFunction:Rm}=Pf,Pm=(({Request:t,Response:e})=>({Request:t,Response:e}))(Pf.global),{ReadableStream:Dm,TextEncoder:Lm}=Pf.global,Fm=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},$m=t=>{t=Pf.merge.call({skipUndefined:!0},Pm,t);const{fetch:e,Request:n,Response:r}=t,i=e?Rm(e):"function"==typeof fetch,o=Rm(n),s=Rm(r);if(!i)return!1;const a=i&&Rm(Dm),u=i&&("function"==typeof Lm?(c=new Lm,t=>c.encode(t)):async t=>new Uint8Array(await new n(t).arrayBuffer()));var c;const l=o&&a&&Fm(()=>{let t=!1;const e=new n(rm.origin,{body:new Dm,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),h=s&&a&&Fm(()=>Pf.isReadableStream(new r("").body)),d={stream:h&&(t=>t.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!d[t]&&(d[t]=(e,n)=>{let r=e&&e[t];if(r)return r.call(e);throw new Lf(`Response type '${t}' is not supported`,Lf.ERR_NOT_SUPPORT,n)})});const p=async(t,e)=>{const r=Pf.toFiniteNumber(t.getContentLength());return null==r?(async t=>{if(null==t)return 0;if(Pf.isBlob(t))return t.size;if(Pf.isSpecCompliantForm(t)){const e=new n(rm.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return Pf.isArrayBufferView(t)||Pf.isArrayBuffer(t)?t.byteLength:(Pf.isURLSearchParams(t)&&(t+=""),Pf.isString(t)?(await u(t)).byteLength:void 0)})(e):r};return async t=>{let{url:i,method:s,data:a,signal:u,cancelToken:c,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:_,headers:y,withCredentials:v="same-origin",fetchOptions:b}=Om(t),w=e||fetch;_=_?(_+"").toLowerCase():"text";let x=Mm([u,c&&c.toAbortSignal()],f),T=null;const k=x&&x.unsubscribe&&(()=>{x.unsubscribe()});let S;try{if(g&&l&&"get"!==s&&"head"!==s&&0!==(S=await p(y,a))){let t,e=new n(i,{method:"POST",body:a,duplex:"half"});if(Pf.isFormData(a)&&(t=e.headers.get("content-type"))&&y.setContentType(t),e.body){const[t,n]=wm(S,bm(xm(g)));a=jm(e.body,65536,t,n)}}Pf.isString(v)||(v=v?"include":"omit");const e=o&&"credentials"in n.prototype,u={...b,signal:x,method:s.toUpperCase(),headers:y.normalize().toJSON(),body:a,duplex:"half",credentials:e?v:void 0};T=o&&new n(i,u);let c=await(o?w(T,b):w(i,u));const f=h&&("stream"===_||"response"===_);if(h&&(m||f&&k)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=c[e]});const e=Pf.toFiniteNumber(c.headers.get("content-length")),[n,i]=m&&wm(e,bm(xm(m),!0))||[];c=new r(jm(c.body,65536,n,()=>{i&&i(),k&&k()}),t)}_=_||"text";let A=await d[Pf.findKey(d,_)||"text"](c,t);return!f&&k&&k(),await new Promise((e,n)=>{_m(e,n,{data:A,headers:pm.from(c.headers),status:c.status,statusText:c.statusText,config:t,request:T})})}catch(e){if(k&&k(),e&&"TypeError"===e.name&&/Load failed|fetch/i.test(e.message))throw Object.assign(new Lf("Network Error",Lf.ERR_NETWORK,t,T),{cause:e.cause||e});throw Lf.from(e,e&&e.code,t,T)}}},Bm=new Map,qm=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:i}=e,o=[r,i,n];let s,a,u=o.length,c=Bm;for(;u--;)s=o[u],a=c.get(s),void 0===a&&c.set(s,a=u?new Map:$m(e)),c=a;return a},Um=(qm(),{http:null,xhr:Cm,fetch:{get:qm}});Pf.forEach(Um,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}});const Vm=t=>`- ${t}`,Gm=t=>Pf.isFunction(t)||null===t||!1===t;const zm={getAdapter:function(t,e){t=Pf.isArray(t)?t:[t];const{length:n}=t;let r,i;const o={};for(let s=0;s<n;s++){let n;if(r=t[s],i=r,!Gm(r)&&(i=Um[(n=String(r)).toLowerCase()],void 0===i))throw new Lf(`Unknown adapter '${n}'`);if(i&&(Pf.isFunction(i)||(i=i.get(e))))break;o[n||"#"+s]=i}if(!i){const t=Object.entries(o).map(([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build"));let e=n?t.length>1?"since :\n"+t.map(Vm).join("\n"):" "+Vm(t[0]):"as no adapter specified";throw new Lf("There is no suitable adapter to dispatch the request "+e,"ERR_NOT_SUPPORT")}return i},adapters:Um};function Wm(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new gm(null,t)}function Jm(t){Wm(t),t.headers=pm.from(t.headers),t.data=fm.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return zm.getAdapter(t.adapter||sm.adapter,t)(t).then(function(e){return Wm(t),e.data=fm.call(t,t.transformResponse,e),e.headers=pm.from(e.headers),e},function(e){return mm(e)||(Wm(t),e&&e.response&&(e.response.data=fm.call(t,t.transformResponse,e.response),e.response.headers=pm.from(e.response.headers))),Promise.reject(e)})}const Hm="1.13.4",Xm={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Xm[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const Km={};Xm.transitional=function(t,e,n){return(r,i,o)=>{if(!1===t)throw new Lf(function(t,e){return"[Axios v"+Hm+"] Transitional option '"+t+"'"+e+(n?". "+n:"")}(i," has been removed"+(e?" in "+e:"")),Lf.ERR_DEPRECATED);return e&&!Km[i]&&(Km[i]=!0),!t||t(r,i,o)}},Xm.spelling=function(t){return(t,e)=>!0};const Qm={assertOptions:function(t,e,n){if("object"!=typeof t)throw new Lf("options must be an object",Lf.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const o=r[i],s=e[o];if(s){const e=t[o],n=void 0===e||s(e,o,t);if(!0!==n)throw new Lf("option "+o+" must be "+n,Lf.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Lf("Unknown option "+o,Lf.ERR_BAD_OPTION)}},validators:Xm},Zm=Qm.validators;class Ym{constructor(t){this.defaults=t||{},this.interceptors={request:new Xf,response:new Xf}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const n=e.stack?e.stack.replace(/^.+\n/,""):"";try{t.stack?n&&!String(t.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(t.stack+="\n"+n):t.stack=n}catch(t){}}throw t}}_request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Em(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:i}=e;void 0!==n&&Qm.assertOptions(n,{silentJSONParsing:Zm.transitional(Zm.boolean),forcedJSONParsing:Zm.transitional(Zm.boolean),clarifyTimeoutError:Zm.transitional(Zm.boolean)},!1),null!=r&&(Pf.isFunction(r)?e.paramsSerializer={serialize:r}:Qm.assertOptions(r,{encode:Zm.function,serialize:Zm.function},!0)),void 0!==e.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Qm.assertOptions(e,{baseUrl:Zm.spelling("baseURL"),withXsrfToken:Zm.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=i&&Pf.merge(i.common,i[e.method]);i&&Pf.forEach(["delete","get","head","post","put","patch","common"],t=>{delete i[t]}),e.headers=pm.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach(function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(a=a&&t.synchronous,s.unshift(t.fulfilled,t.rejected))});const u=[];let c;this.interceptors.response.forEach(function(t){u.push(t.fulfilled,t.rejected)});let l,h=0;if(!a){const t=[Jm.bind(this),void 0];for(t.unshift(...s),t.push(...u),l=t.length,c=Promise.resolve(e);h<l;)c=c.then(t[h++],t[h++]);return c}l=s.length;let d=e;for(;h<l;){const t=s[h++],e=s[h++];try{d=t(d)}catch(t){e.call(this,t);break}}try{c=Jm.call(this,d)}catch(t){return Promise.reject(t)}for(h=0,l=u.length;h<l;)c=c.then(u[h++],u[h++]);return c}getUri(t){return Hf(Sm((t=Em(this.defaults,t)).baseURL,t.url,t.allowAbsoluteUrls),t.params,t.paramsSerializer)}}Pf.forEach(["delete","get","head","options"],function(t){Ym.prototype[t]=function(e,n){return this.request(Em(n||{},{method:t,url:e,data:(n||{}).data}))}}),Pf.forEach(["post","put","patch"],function(t){function e(e){return function(n,r,i){return this.request(Em(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Ym.prototype[t]=e(),Ym.prototype[t+"Form"]=e(!0)});const tg=Ym;class eg{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(t){e=t});const n=this;this.promise.then(t=>{if(!n._listeners)return;let e=n._listeners.length;for(;e-- >0;)n._listeners[e](t);n._listeners=null}),this.promise.then=t=>{let e;const r=new Promise(t=>{n.subscribe(t),e=t}).then(t);return r.cancel=function(){n.unsubscribe(e)},r},t(function(t,r,i){n.reason||(n.reason=new gm(t,r,i),e(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}toAbortSignal(){const t=new AbortController,e=e=>{t.abort(e)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let t;return{token:new eg(function(e){t=e}),cancel:t}}}const ng=eg;const rg={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(rg).forEach(([t,e])=>{rg[e]=t});const ig=rg;const og=function t(e){const n=new tg(e),r=Gp(tg.prototype.request,n);return Pf.extend(r,tg.prototype,n,{allOwnKeys:!0}),Pf.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return t(Em(e,n))},r}(sm);og.Axios=tg,og.CanceledError=gm,og.CancelToken=ng,og.isCancel=mm,og.VERSION=Hm,og.toFormData=Uf,og.AxiosError=Lf,og.Cancel=og.CanceledError,og.all=function(t){return Promise.all(t)},og.spread=function(t){return function(e){return t.apply(null,e)}},og.isAxiosError=function(t){return Pf.isObject(t)&&!0===t.isAxiosError},og.mergeConfig=Em,og.AxiosHeaders=pm,og.formToJSON=t=>im(Pf.isHTMLForm(t)?new FormData(t):t),og.getAdapter=zm.getAdapter,og.HttpStatusCode=ig,og.default=og;const sg=og,{memoize:ag}=vn,ug=(bn("error",{type:"critical",message:"LEAF core error: race condition detected in http.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library.js"},{}),t=>{const e=t[cg.LAMBDA_OBJ],n="uri"in e&&"_default"in e.uri?e.uri._default:void 0,r="header"in e&&"_default"in e.header?e.header._default:void 0,i=async n=>{t[cg.http.URI];const r=t[cg.http.HEADER];let i=n;i=1===i.length?i[0]:i;const o=Object.keys(e),s=["uri","post","put","get","header","?graph"].filter(t=>o.includes(t)),a=(cg.DOMAIN&&t[cg.DOMAIN],cg.APPID&&t[cg.APPID],s.includes("post")?"post":s.includes("put")?"put":"get"),u=vn.throttle(async()=>await(async({http_mode:t,uri:e}={})=>{if(["post","put"].includes(t)){r?.X_CSRF_Token&&(sg.defaults.headers.post["X-CSRF-Token"]=r.X_CSRF_Token);try{const t=s.includes("put")?sg.put(e,i):sg.post(e,i);return await t}catch(t){return t.response||t.request,t.response}}else try{const t=e?sg.get(e):cn([{data:"LEAF element error: http get request submitted with undefined URI"}]);return(await t).data}catch(t){return t.response||t.request,t}})({http_mode:a,uri:"localhost:51054"}),1e3);return await u()},o={codebase:"ghostos/api/parser/nodelogic/elements/library/http.js",refnode:t[cg.REFNODE]};return{leaflogic:(e,s)=>{const a=new Rt,u=n?p_(s,e,void 0,o,{leaflogic:n,datalogic:{post:e=>(t[cg.http.URI]=e,e)}}):{_stream:cn("https://httpbin.org"),_control:{_stream:s._stream}},c=r?p_(s,e,void 0,o,{leaflogic:r,datalogic:{post:e=>(t[cg.http.HEADER]=e,e)}}):{_stream:cn(""),_control:{_stream:s._stream}},l=At([u._control._stream,c._control._stream]),h=At([u._stream,c._stream]),d=l.pipe(Mt(h),U(t=>t[0]));let p=!1;const f=d.pipe(Mt(...e.map(t=>t._stream)),Nt(t=>i(t.slice(1))),U(e=>(p=!0,e?.length>1||!Array.isArray(e)?a.next(e):1===e?.length&&a.next(e[0]),t[cg.CTRLIN])),Dt());return{_stream:a.pipe(Ft(t=>p),U(t=>t),Dt()),_control:{_stream:f.pipe(U(t=>t),Dt())}}},datalogic:{pre:t=>t,post:t=>{const e=t=>{const n=typeof t;return"object"===n?Array.isArray(t)?t.map(t=>e(t)):t?Object.fromEntries(Object.entries(t).map(([t,n])=>[t,e(n)])):t:"string"===n?(t=>{var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return t.replace(/[&<>"']/g,function(t){return e[t]})})(t):t};return lg(e(t),"elementio")}}}}),cg={LAMBDA_OBJ:"_lambda_obj",REFNODE:"_refnode",RTCONTEXT:"_rtcontext",CTRLIN:"_ctrl_in",DATAIN:"_data_in",DOMAIN:"_domain",APPID:"_appid",http:{URI:"_http_uri",HEADER:"_http_header",REQUEST_TTL_CACHE:"_http_request_ttl_cache"},href:{URI:"_href_uri"},gnav:{EDGES:"_edges",BACKDROP:"_backdrop"},prompt:{UIDEFS:"_uidefs"},mediaplayer:{URI:"_uri"},sound:{CONFIG:"_sound_config",SOUNDSTAGE:"_daw_object"},html:{TEMPLATE:"_html_template"}},lg=(t,e="defaultio",n=!0)=>n?bn(e,t):t,hg={mediaplayer:ts,http:Fp,gnav:Dp,popup:is,image:us,editor:ss,text:as,prompt:ns,mediainput:ls,midi:ps,sound:Rp,html:Up,href:Bp,form:Vp,directus:ug},dg=zt("leafdeckspade"),pg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(await Fo.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i}),e_.lambda(t)({refnodedata:{leaf:{logic:{args:{graphuuid:"",domain:"breezyforest",appid:"leafdeckspade",graphaddrstr:"breezyforest/spade"}}}},nodelambda:[],contextuallambda:[]})),a=(await s,{codebase:"leafdeckspade.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data});return(t,r)=>{let i=["_leafdeckdiamond"];const s=r._config?.loopidx,{type:u,args:c}=n.leaf.logic,l="_default"in o?(t,n)=>{const r={...n};s>=0&&(r._config.loopidx=s),r._config.clubrefnode=e;return o._default(t,r)}:(t,e)=>({...$g(t),_control:e}),h=r._stream;return p_({_stream:h},t,void 0,{...a,metastep:"creating a leafdeckspade element"},{datalogic:{pre:t=>Array.isArray(t)?t.map(t=>wn(i,t)).filter(t=>t):wn(i,t),post:t=>{const e=Array.isArray(t)?t:[t],n={type:"leafdeckspade",uuid:Xn(),name:An(dg.editorconfig.namedatakey,c),description:"{description}",lambdas:{default:"defaultLambda",defaultLambda:l,bro:t=>t},diamonds:e};return bn("screenio",n)}}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s}},fg=zt("leafdeckheart"),mg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(await Fo.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i}),await Go.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckheart"}}}},nodelambda:[],contextuallambda:i}),{codebase:"leafdeckheart.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data});return(t,r)=>{let i=["_leafdeckdiamond"];const a=r._config?.loopidx,{type:u,args:c}=n.leaf.logic,l="_default"in o?(t,n)=>{const r={...n};a>=0&&(r._config.loopidx=a),r._config.clubrefnode=e;return o._default(t,r)}:(t,e)=>({...$g(t),_control:e}),h=r._stream;return p_({_stream:h},t,void 0,{...s,metastep:"creating a leafdeckheart element"},{datalogic:{pre:t=>Array.isArray(t)?t.map(t=>wn(i,t)).filter(t=>t):wn(i,t),post:t=>{const e=Array.isArray(t)?t:[t],n={type:"leafdeckheart",uuid:Xn(),name:An(fg.editorconfig.namedatakey,c),description:"{description}",lambdas:{default:"defaultLambda",defaultLambda:l,bro:t=>t},diamonds:e};return bn("screenio",n)}}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s}},gg=zt("leafdeckdiamond"),_g={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(await Fo.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i}),{codebase:"leafdeckdiamond.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data});return(t,r)=>{let i=["_leafdeckclub"];const a=r._config?.loopidx,{type:u,args:c}=n.leaf.logic,l="_default"in o?(t,n)=>{const r={_stream:n._stream.pipe(U(t=>t)),_config:{...n._config}};a>=0&&(r._config.loopidx=a),r._config.clubrefnode=e;const i=o._default(t,n);return{_stream:i._stream.pipe(U(t=>t)),_control:{_stream:i._control._stream.pipe(U(t=>t))}}}:"href"in o&&"_default"in o.href?(t,e)=>{const n=o.href._default(t,e);return{_stream:n._stream.pipe(U(t=>(window.location.href.slice(-t.length)!==t&&(window.location.href=t),t))),_control:{...e._control,_stream:n._control._stream.pipe(U(t=>t))}}}:(t,e)=>({...$g(t),_control:e}),h=r._stream,d=p_({_stream:h},t,void 0,{...s,metastep:"creating a leafdeckdiamond element"},{datalogic:{pre:t=>{const e=Array.isArray(t)?t:[t],n={clubs:[],nodeinput:[]};return e.map(t=>{en(t)&&(t._bname===i[0]?n.clubs.push(wn(i,t)):"nodeinput"===t._bname&&n.nodeinput.push(wn("nodeinput",t)))}),n},post:t=>{t.clubs;const n=t.clubs.filter(t=>t),r="subscribe"in o&&0===n.length,i={type:"leafdeckdiamond",uuid:Xn(),nodeuuid:e,name:An(gg.editorconfig.namedatakey,c),svgicon:"https://www.leafgon.com/icons/hardware/laptop_mac/materialicons/24px.svg",description:"{description}",nodeinput:t.nodeinput,lambdas:{default:"defaultLambda",defaultLambda:l,bro:t=>t},subscription:r,clubs:n};return bn("_leafdeckdiamond",i)}}});return{_stream:d._stream.pipe(U(t=>t)),_control:d._control}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({_stream:e(t,n),_control:n})}),s}},yg=zt("leafdeckclub"),vg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s={codebase:"leafdeckclub.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,r)=>{const i=r._config?.loopidx,{type:a,args:u}=n.leaf.logic,c="_default"in o?(t,n)=>{const r={...n};i>=0&&(r._config.loopidx=i),r._config.clubrefnode=e;return o._default(t,r)}:(t,e)=>({...$g(t),_control:e}),l=r._stream.pipe(U(t=>t)),h=p_({_stream:l},t,void 0,{...s,metastep:"creating a leafdeckclub element"},{datalogic:{pre:t=>{const e=Array.isArray(t)?t:[t],n={nodeinput:[]};return e.map(t=>{en(t)&&"nodeinput"===t._bname&&n.nodeinput.push(wn("nodeinput",t))}),n},post:t=>{const n="subscribe"in o,r={type:"leafdeckclub",uuid:Xn(),nodeuuid:e,name:An(yg.editorconfig.namedatakey,u),svgicon:"https://www.leafgon.com/icons/hardware/laptop_mac/materialicons/24px.svg",description:"{description}",nodeinput:t.nodeinput,lambdas:{default:"defaultLambda",defaultLambda:c,bro:t=>t},subscription:n};return bn("_leafdeckclub",r)}}});return{_stream:h._stream.pipe(U(t=>t)),_control:h._control}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=t=>({...e(t,controlflow$obj),_control:controlflow$obj})}),s}},bg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree});const o=zo.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckspade"}}}},nodelambda:[],contextuallambda:i}),s=zo.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckheart"}}}},nodelambda:[],contextuallambda:i}),a=zo.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafpopupview"}}}},nodelambda:[],contextuallambda:i}),u=void 0;return t=>{const e=o(t),n=s(t),r=a(t),i=u([e,n]).pipe(U(t=>t),U(t=>t));r.pipe(U(t=>t),U(t=>{}));return i.pipe(Ft(t=>t))}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=t=>e(t)}),s}},wg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s="_default"in o?t=>o._default([t]):t=>t,a=Go.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafpopupview"}}}},nodelambda:[],contextuallambda:i});return t=>{const e=t.pipe(U(t=>t),U(t=>{let e=null;return e={type:"leafpopupview",uuid:"308bd84f-3af2-478e-ae35-b2842a9bd3a1",svgicon:"https://www.leafgon.com/icons/hardware/laptop_mac/materialicons/24px.svg",description:"coolest popupview in LEAF",lambdas:{default:"defaultLambda",defaultLambda:s,bro:t=>t}},e||t}));return a(e.pipe(Ft(t=>t)))}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=t=>e(t)}),s}};const xg=bn("error",{type:"critical",message:"LEAF core error: race condition detected in leafelement.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/leafelement.js"},{}),Tg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{type:s,args:a}=n.leaf.logic,u=n.leaf.logic.args.elementname,c=(t.gos.etaTree.hostdomain,t.gos.etaTree.hostappid,t.gos.etaTree.domain),l=t.gos.etaTree.appid;"domain"in o&&"_default"in o.domain&&o.domain._default,"appid"in o&&"_default"in o.appid&&o.appid._default,"uidefs"in o&&"_default"in o.uidefs&&o.uidefs._default,"edges"in o&&"_default"in o.edges&&o.edges._default,new Bt(xg);["f30e","7a65"].includes(e.slice(0,4));const h={codebase:"leafelement.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};let d={};d[cg.LAMBDA_OBJ]=o,d[cg.REFNODE]=e,d[cg.RTCONTEXT]={graphdomain:c,graphappid:l,refnodedata:n,nodelambda:r,contextuallambda:i};const p=((t,e)=>Object.keys(hg).includes(e)&&hg[e]?{...hg[e](t)}:void 0)(d,u);return(n,r)=>{e?.slice(0,4);const i=r._stream.pipe(U(e=>(d[cg.CTRLIN]=e,d[cg.DOMAIN]=t.gos.etaTree.domain,d[cg.APPID]=t.gos.etaTree.appid,e)));"elementio$"in p&&(t.gos.etaTree.leafio.elementioLUT[e]=p.elementio$);return p_({_stream:i},n,void 0,{...h,metastep:"element "+u},{leaflogic:p?p.leaflogic:void 0,datalogic:{pre:p?p.datalogic.pre:void 0,post:p?p.datalogic.post:void 0}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s},methods:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={configtext:""};return{texteditor:{setTextSource:r=>{o.configtext=r;const i={...n};i.leaf.logic.args.elementconfig=r,is_interactive||t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:encodeUnicode(JSON.stringify(i))}})},getTextSource:()=>n.leaf.logic.args.elementconfig},general:{getNodeData:()=>n,getLambdaLUT:async()=>{const n=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),o={};return Object.entries(n).map(([t,e])=>{o[t]=(t,n)=>({...e(t,n),_control:n})}),o},setElementName:r=>{const i={...n};i.leaf.logic.args.elementname=r,t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:encodeUnicode(JSON.stringify(i))}})}}}}};n(4106);function kg(t,e,n){const r={leafoutflowport:kn,leafinflowport:Tn,leafscreenio:Sn,leafmemoryio:zn,leafdeckspade:pg,leafdeckheart:mg,leafdeckdiamond:_g,leafdeckclub:vg,leafgnav:bg,leafpopupview:wg,leafelement:Tg,leafgraph:e_,leaflambdagraph:Ug,leafanchor:n_,leafspell:Wg,leafspelldef:Jg,leafloopyspell:Qg,leafchronosflow:Lo,leafasyncflow:Lo,leafmixflow:Fo,leafgateflow:Bo,leaflisp:Do,leaflabel:Uo,leafdelabel:Vo,leafbottle:Go,leafunbottle:zo,leafcrate:Wo,leafconfig:Qo};return r[t][e]?r[t][e](n):void 0}const{memoize:Sg}=vn,Ag={isdebug:!1},Eg=bn("error",{type:"critical",message:"LEAF core error: race condition detected in eta.js",codebase:"/src/ghostos/api/parser/eta.js"},{}),Og=(t,e)=>([...Array(e).keys()].map(e=>{t[e]=!1}),t),Cg=(t,e={time:-1,count:-1},n=void 0,r={})=>{bn("empty_bottle","empty_data",{_provenance:{rt_context:r,codebase:"eta.js doChronosSynchronize"}});const i=new Rt,o=(t[0]._control._stream,t.length,t.map(t=>t._control._stream)),s=t.map(t=>t._stream),a={};let u={};const c=t.length;Og(a,c);return{ctrl:n&&n.synchronized?$t(...t.map((t,e)=>t._control._stream.pipe(Mt(t._stream),U(t=>[e,t])))).pipe(U(t=>{if(a[t[0]]=!0,u[t[0]]=t[1],((t,e)=>{let n=!0;return[...Array(e).keys()].map(e=>{n&&=t[e]}),n})(a,c)){Og(a,c);const t=Object.values(u);return u={},t}}),Ft(t=>void 0!==t),U(t=>{if(r.nodeuuid,n.checksync()){n.initflowcache(),r.nodeuuid;let e=t.map(t=>{const e=t.slice(1).flat();return 1===e.length?e[0]:e});i.next(e);const o={...t[0][0]};let s=t.map(t=>t[0].traces);return 1===s.length&&(s=s[0]),o.traces=[s],o}}),Ft(t=>void 0!==t)):o.length>1?$t(...o.map((t,e)=>t.pipe(Mt(s[e]),U(t=>{const e=t[0];e.length>1&&e.includes(void 0),r.nodeuuid,en(t[1])&&t[1]._bname;let n=t.slice(1);return i.next(n),e})))):o[0].pipe(Mt(s[0]),U(t=>{const e=t[0];en(t[1])&&t[1]._bname;let n=t[1];return i.next(n),e})),data:i.pipe(Ft(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Eg)))}},Mg=(t,e,n,r,i,o,s)=>{const a={refnode:t,codebase:"eta.js weaveDataflowPlane",domain:i.domain,appid:i.appid},u=bn("empty_bottle","empty_data",{_provenance:{refnode:t,codebase:"eta.js weaveDataflowPlane"}}),c={},l=(t,h=void 0)=>t.map(t=>{if(c[t]?.data_out&&c[t]?.ctrl_out)return{_stream:c[t].data_out._stream.pipe(U(t=>t)),_control:{_stream:c[t].ctrl_out._stream.pipe(U(t=>t))}};{const d=r[t];if(!d||!("_default"in d))throw`LEAF error: weaveDataflowPlane(): the ${d?"":"undefined"} eta reduced function with the refnode ${t} has no _default defined.`;const p=h||i.leafgraph.graph.dataflow.mapInEdges(t,t=>i.leafgraph.graph.dataflow.source(t)),f=0===p.length?[{_stream:s._stream,_control:{_stream:o._stream}}]:l(p).filter(t=>t);p.length,((t,e,n,r=!0)=>{const o=t,s=i.leafgraph.graph.dataflow.mapInEdges(o,t=>i.leafgraph.graph.dataflow.source(t));o in c||(c[o]={inputnodes:s,synchronized:!1,flowcache:{},initflowcache:()=>{const t=c[o].inputnodes.length;c[o].flowcache=t>1?Object.keys(c[o].inputnodes)?.reduce((t,e)=>(t[e]=!1,t),{}):{0:!1}},recordflow:t=>{c[o].flowcache[t]=!0},checksync:()=>Object.values(c[o].flowcache).reduce((t,e)=>t&&e,!0),data_in$Arr:n.map((t,e)=>t._stream.pipe(Ft(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Eg)),U(t=>(["c10cbbbb-14d5-4270-b17a-1965afcabc98"].includes(o),en(t)&&t._bname,["c822ae2e-1be8-46be-b2cb-21a43cef0555","e9e6e44b-792b-46d0-b1d3-58ce2f46c45b"].includes(o)&&en(t)&&t._bname,t)))),data_out:void 0,ctrl_in$Arr:e.map((t,e)=>t._stream.pipe(Ft(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Eg)),U(t=>(c[o][e],["c822ae2e-1be8-46be-b2cb-21a43cef0555","e9e6e44b-792b-46d0-b1d3-58ce2f46c45b"].includes(o),c[o].recordflow(e),t)))),ctrl_out:void 0,get_composite_in$objArr:()=>c[o].data_in$Arr.map((t,e)=>({_stream:t,_control:{_stream:c[o].ctrl_in$Arr[e]}}))},c[o].initflowcache(),s.length>1&&r&&(c[o].synchronized=!0))})(t,f.map(t=>({_stream:t._control._stream})),f.map(t=>({_stream:t._stream})));const m=i.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data,g="leafchronosflow"===m.leaf.logic.type,{ctrl:_,data:y}=g?{ctrl:$t(...c[t].get_composite_in$objArr().map(t=>t._control._stream)),data:void 0}:Cg(c[t].get_composite_in$objArr(),{time:-1,count:-1},c[t],{...a,...m,at:"eta.js _weaveDataflowPlane",nodeuuid:t}),v={_stream:_.pipe(U(t=>t))},b=g?c[t].get_composite_in$objArr().map((t,e)=>({_stream:t._stream.pipe(U(t=>t))})):[{_stream:y.pipe(U(t=>t))}];if(p.length>0){if(n.includes(t)){if("leafoutflowport"===m.leaf.logic.type){const e=d._default(b,v);return c[t].data_out={_stream:e._stream},c[t].ctrl_out={_stream:e._control._stream},{_stream:e._stream.pipe(U(t=>t)),_control:{_stream:e._control._stream.pipe(U(t=>t))}}}{const e=d._default(b,v);return c[t].data_out={_stream:e._stream.pipe(U(e=>({...u,_label:{...u._label,context:"a nudge data bottle returned by an exitless end node, "+t}})))},c[t].ctrl_out={_stream:e._control._stream.pipe(U(t=>t))},{_stream:c[t].data_out._stream.pipe(U(t=>t)),_control:{_stream:c[t].ctrl_out._stream.pipe(U(t=>t))}}}}{const e=d._default(b,v);return c[t].data_out={_stream:e._stream},c[t].ctrl_out={_stream:e._control._stream},{_stream:e._stream.pipe(U(t=>t)),_control:{_stream:e._control._stream.pipe(U(t=>t))}}}}if(!e.includes(t))throw`LEAF error: weaveDataflowPlane(): the eta reduced function with the refnode ${t} has matched against incomplete startnodes reference.`;if("leafinflowport"===i.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data.leaf.logic.type){const e=d._default(b,v);return c[t].data_out={_stream:e._stream},c[t].ctrl_out={_stream:e._control._stream},{_stream:e._stream.pipe(U(t=>t)),_control:{_stream:e._control._stream.pipe(U(t=>t))}}}{const e=b.map(t=>({_stream:t._stream.pipe(U(t=>({...u,_label:{...u._label,context:"input-less node dataflow nudging message as per ctrl signal"}})))})),n=d._default(e,v);return c[t].data_out={_stream:n._stream},c[t].ctrl_out={_stream:n._control._stream},{_stream:n._stream.pipe(U(t=>t)),_control:{_stream:n._control._stream.pipe(U(t=>t))}}}}}),h=l(n);h.length;const{ctrl:d,data:p}=h.length>1?((t,e={time:-1,count:-1},n={})=>{const r=t.length,i=new Rt;return{ctrl:$t(...t.map(t=>{let e;return t._control._stream.pipe(U(t=>(e=globalThis.TRACEON?{...t,traces:d_(t?.traces,{...n,desc:"doChronosAsynchronize(), a ctrl signal came through out of inputcount of "+r},!0)}:t,e)),Mt(t._stream),U(t=>(i.next(2===t.length?t[1]:t.slice(1)),t[0])),Dt())})).pipe(U(t=>t)),data:i.pipe(Ft(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Eg)))}})(h,{time:-1,count:-1},{...a,at:"eta.js _weaveDataflowPlane",endnodes:n}):{ctrl:h[0]._control._stream,data:h[0]._stream};return[{...{_stream:p},_control:{_stream:d}},c]},Ng=Sg(async({refnode:t,component_members:e,contextuallambda:n,etaTree:r}={})=>{const i=[],o=[],s={};["7b1f"].includes(t?.slice(0,4)),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t);const a=e.map(t=>{r.leafgraph.edges.lambda.sourcelut[t];const e=r.etaReduceLEAFNode({nodeuuid:t,contextuallambda:n});return e.then(e=>{s[t]=e;const n=r.leafgraph.edges.data.sources.has(t);r.leafgraph.edges.data.targets.has(t)||i.push(t),n||o.push(t)}),e});["7b1f","main"].includes(t?.slice(0,4)),await Promise.all(a),["7b1f","main"].includes(t?.slice(0,4)),["2ee89b44-16af-472f-97d4-47ae65f064c8"].includes(t);const u=((t,e,n,r,i,o={})=>{const s={main:"nav main dataflow",leafgraph:"leafgraph main dataflow",editor:"editor main dataflow"},a={codebase:"eta.js",refnode:t,leafnode:Object.keys(s).includes(t)?s[t]:i.leafgraph.graph.dataflow.getNodeAttributes(t)?.leafnode.data,metadata:o,domain:i.domain,appid:i.appid};return(u=[],c)=>{const l={data_in:new Rt,ctrl_in:new Rt,data_out:new Rt,ctrl_out:new Rt},h={_stream:l.data_in},d={_stream:l.ctrl_in,_config:{}};["3980759d-7c59-4b9e-b799-87b5fd4cbcec","62890d97-837a-463e-aac9-d7fca2293427"].includes(t),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t);const[p,f]=Mg(t,e,n,r,i,d,h);return p_(c,u,void 0,{...a,metastep:"invoking parseDataflowFunc()"},{leaflogic:(e,n)=>{const r=new Rt;let a;const u=n._stream.pipe(U(t=>(a=t,t)),Mt(...e.map(t=>t._stream)),Nt(n=>{o.refnode,e.length;const r=1===e.length?n[1]:n.slice(1);return t in s||i.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data.leaf.logic,i.domain,i.appid,a.traces,setTimeout(()=>{l.data_in.next(r),l.ctrl_in.next(a)},1),p._control._stream}),Mt(p._stream),U(t=>{if(en(t[1])&&"error"===t[1]._bname);else{const e=t[1];void 0!==e&&r.next(e)}return t[0]}),Dt());return{_stream:r.pipe(Ft(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Eg))),_control:{...n,_stream:u}}},datalogic:{}})}})(t,i,o,s,r);return u},({refnode:t,component_members:e,contextuallambda:n,etaTree:r}={})=>JSON.stringify([...e,...n,r.sessionid])),Ig=async({refnode:t,nodelambda:e,contextuallambda:n,etaTree:r,addnodelut:i=!1,metadata:o={}}={})=>{["7b1f"].includes(t?.slice(0,4)),["530acdcf-067d-4868-ba0c-b7a83e6edfdf"].includes(t),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t);const s=i?{_nodelut:{}}:{};e.filter(t=>!(t in r.graphcomponents.components.lut)).length;const a=e.filter(t=>t in r.graphcomponents.components.lut).map(e=>{const{idx:o,scope:a}=r.graphcomponents.components.lut[e],u=r.graphcomponents.components.nodegroups.lambda[o];if("dataflow"===a){const o=Ng({refnode:t,component_members:u,contextuallambda:n,etaTree:r});return["7b1f"].includes(t?.slice(0,4)),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t),o.then(n=>{["7b1f"].includes(t?.slice(0,4)),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t),s._default=n,i&&(s._nodelut._default=e)}),o}if("lambda"===a){if(!(u.length>1)){const o=r.etaReduceLEAFNode({nodeuuid:e,contextuallambda:n});return o.then(n=>{Object.entries(n).map(([n,o])=>{if(n in s){r.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data.leaf.logic}else s[n]=o,i&&(s._nodelut[n]=e)})}).catch(t=>{}),o}r.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data.leaf.logic}else{r.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data.leaf.logic,r.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data.leaf.logic}});return await Promise.all(a),["e36a8dd4-c8df-4dfa-b60c-765eeb5b99fd"].includes(t),s},jg=(t,e,n,r,i,o,s,a,u,c,l=void 0)=>{const h={sessionid:l?l.sessionid:void 0,appmode:t,hostdomain:e,hostappid:n,domain:r,appid:i,leafgraph:void 0,graphcomponents:void 0,rootgraphstate:void 0,leafio:void 0,leaflakeio:void 0,mnemosyne:void 0,hostEtaTree:l,leafnodemethods:{},lookupRuntimeLambdaLUT:async(t,e,n,r,i,o=!1)=>{if(0===r.length)return{};const s=await Vn(h).getEtaTree(t,e);return o?await h.etaReduceLEAFNode({nodeuuid:n,contextuallambda:i}):await Ig({refnode:n,nodelambda:r,contextuallambda:i,etaTree:s})},lookupLEAFNodeMethods:async(t,e=void 0)=>{if(t in h.leafnodemethods)return h.leafnodemethods[t];if(h.leafgraph.graph.dataflow.nodes().includes(t)){const e=h.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data,n=e.leaf.logic,r={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:h.leafio,etaTree:h},user:{spellbook:h.graphcomponents.spelldefs,lambdalut:h.leafgraph.edges.lambda.sourcelut}},i=kg(n.type,"methods",r);if(i&&!(t in h.leafnodemethods)){const n=h.leafgraph.edges.lambda.sourcelut[t]?h.leafgraph.edges.lambda.sourcelut[t]:[];return h.leafnodemethods[t]=await i({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:[]}),h.leafnodemethods[t]}return}if(h.hostEtaTree)return h.hostEtaTree.lookupLEAFNodeMethods(t,e);if(void 0!==e){const n=e,r=n.leaf.logic,i={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:h.leafio,etaTree:h},user:{spellbook:h.graphcomponents.spelldefs,lambdalut:h.leafgraph.edges.lambda.sourcelut}},o=kg(r.type,"methods",i);if(o&&!(t in h.leafnodemethods)){h.leafgraph.edges.lambda.sourcelut[t]&&h.leafgraph.edges.lambda.sourcelut[t];return h.leafnodemethods[t]=await o({refnode:t,refnodedata:n,nodelambda:[],contextuallambda:[]}),h.leafnodemethods[t]}}return},etaReduceLEAFNode:async({nodeuuid:t,contextuallambda:e}={})=>({_default:t=>{}}),loadElementJsEsmModule:async t=>{if(!(t in h.esmcache)){const e=await sg.get(t);h.esmcache[t]=e.data}return h.esmcache[t]},initTree:(t,e,n,r,i)=>{h.config=Ag,h.leafgraph=t,h.graphcomponents=e,h.rootgraphstate="initialized",h.leafio=n,h.leaflakeio=r,h.mnemosyne=i,h.esmcache={},void 0===h.hostEtaTree&&Vn(h).initEtaTreeForest();return h.etaReduceLEAFNode=Sg(async({nodeuuid:t,contextuallambda:e}={})=>{const n=t;["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(n),["0f35d8bc-36a6-4fe8-b185-f8ed5188b28f"].includes(n),["5f7d8750-8ebd-46ee-9a21-029d4000f452"].includes(n);const r=n?h.leafgraph.graph.dataflow.getNodeAttributes(n).leafnode.data.leaf.logic:void 0,i=t in h.leafgraph.edges.lambda.sourcelut?h.leafgraph.edges.lambda.sourcelut[t]:[];let o;if(t in h.graphcomponents.components.lut){const{scope:e}=h.graphcomponents.components.lut[t];o=e}const s={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:h.leafio,etaTree:h},user:{spellbook:h.graphcomponents.spelldefs,lambdalut:h.leafgraph.edges.lambda.sourcelut}};try{["b490aada-daab-4322-9001-14aea8bcb3d3","97fa68cf-bcc5-44cf-8311-ffa6a1422ac3","abb18b4d-b8af-4349-949d-fae21bc142ef","e9536f42-df6d-4086-a643-5f3c0b02aac9","b5a20ce3-3e67-42cd-9f60-3f70c6acd269","59fe3646-b338-4ab0-a8a6-d6ad401be4fa"].includes(t),r.type;const a=kg(r.type,o,s),u=h.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data,c=await a({refnode:t,refnodedata:u,nodelambda:i,contextuallambda:e});return["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(n),["e36a8dd4-c8df-4dfa-b60c-765eeb5b99fd"].includes(n),"dataflow"===o?{_default:c}:"lambda"===o?c:void 0}catch(t){}},({nodeuuid:t,contextuallambda:e}={})=>JSON.stringify([t,...e])),h.etaReduceLEAFNode}};return h.initTree(o,s,a,u,c),h.sessionid=Xn(),h};const Rg=200,Pg=t=>Array.isArray(t)?t.flatMap(t=>t):t,Dg=(t,e,n=!1,r=!1,i=!1,o={})=>{const s=e.filter(t=>t);if(s.length>1){const o={_stream:cn("ctrl_nudge").pipe(ln(r=>At(e.map(t=>t._stream)).pipe(U(e=>{t?.slice(0,4);const r=i?qg({_bus:e,_flatten:n}):e,o=!i&&n&&Array.isArray(r)?r.filter(t=>t).flat():r;return o}))))};return r&&(o._control={_stream:cn("ctrl_nudge").pipe(ln(t=>At(e.map(t=>t?._control?._stream).filter(t=>t)).pipe(U(t=>Array.isArray(t)?t.flat():t))))}),o}return s.length>0?{...s[0],_stream:s[0]._stream.pipe(U(e=>(t?.slice(0,4),e)))}:void 0},Lg=(t,e)=>{const n=t.filter(t=>e.some(e=>e in t)),r=t.filter(t=>e.every(e=>!(e in t))),i=(t,e)=>{if(en(t))return{...t,_content:i(t._content,e)};if(nn(t))return{...t,_crate:t._crate.map(t=>i(t,e))};if(Array.isArray(t))return t.map(t=>i(t,e));if("object"==typeof t){return Object.assign({},...Object.entries(t).map(([t,n])=>({[t]:i(n,e)})))}if("string"==typeof t){return n=e,t.replace(/\{([\w\s]+)\}/g,function(t,e){return n[e]})}return t;var n};return{_stream:$g(r)._stream.pipe(yn(Rg,100,100),U(t=>t),U(t=>Pg(t)),Mt(...n.map(t=>t._stream.pipe(yn(Rg,100,100),U(t=>Pg(t))))),U(t=>t)).pipe(U(t=>{const e=Pg(t[0]),n=Pg(t.slice(1)).filter(t=>!Array.isArray(t)&&"object"==typeof t),r=Object.assign({},...n);return i(e,r)}))}},Fg=t=>{const e=t.filter(t=>t);if(e.length>1){return{_stream:e.map(t=>t._stream).pipe(Ct())}}if(e.length>0)return e[0]},$g=(bn("error",{type:"critical",message:"LEAF core error: race condition detected in leafdataflow.js",codebase:"/src/ghostos/api/utils/leafdataflow.js"},{}),t=>{const e=t.filter(t=>t);if(e.length>1){return{_stream:$t(...e.map(t=>t._stream.pipe(U(t=>t))))}}if(e.length>0)return e[0]});const Bg=(t,e=t=>!0)=>en(t)&&"_databus"===t._bname&&e(t)?t._content:t,qg=({_bus:t,_cond:e=t=>!0,_flatten:n=!1}={})=>n?Array.isArray(t)?t.map(t=>Bg(t,e)).flat().filter(t=>t):Bg(t,e):Array.isArray(t)?t.map(t=>Bg(t,e)).filter(t=>t):Bg(t,e),Ug={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}) has a leaflambdagraph node (${e}) referencing an undefined lambda construct.`;const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree});return(t,e)=>{if("_default"in o){return{...o._default(t,e),_control:e}}if(t.length>0){return{...$g(t),_control:e}}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s}};function Vg(t,e,n){void 0===t&&(t=0),void 0===n&&(n=_n);var r=-1;return null!=e&&(ut(e)?n=e:r=e),new H(function(e){var i,o=(i=t)instanceof Date&&!isNaN(i)?+t-n.now():t;o<0&&(o=0);var s=0;return n.schedule(function(){e.closed||(e.next(s++),0<=r?this.schedule(void 0,r):e.complete())},o)})}function Gg(t){return t<=0?function(){return yt}:g(function(e,n){var r=0;e.subscribe(B(n,function(e){++r<=t&&(n.next(e),t<=r&&n.complete())}))})}const zg=t=>Object.keys(t).map(e=>0===Object.keys(t[e]).length?e:void 0).filter(t=>t).sort(),Wg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{["0b62c9db-f889-4bf8-9773-c7b93ba9bd3f"].includes(e);const o=n.leaf.logic.args.spellname,s="{*}"===o;let a=i,u=await Ig({refnode:e,nodelambda:r,contextuallambda:a,etaTree:t.gos.etaTree});const c=zg(u);let l;c.length>0&&(a=a.concat(c),u=await Ig({refnode:e,nodelambda:r,contextuallambda:a,etaTree:t.gos.etaTree})),["b490aada-daab-4322-9001-14aea8bcb3d3","97fa68cf-bcc5-44cf-8311-ffa6a1422ac3","abb18b4d-b8af-4349-949d-fae21bc142ef","e9536f42-df6d-4086-a643-5f3c0b02aac9","b5a20ce3-3e67-42cd-9f60-3f70c6acd269","59fe3646-b338-4ab0-a8a6-d6ad401be4fa"].includes(e);const h=async({refnode:t,spellbook:e,spellname:n,lambdalut:r,contextuallambda:i,etaTree:o}={})=>{if(n in e){const s=e[n];s in r&&r[s],"accio"===n&&t.slice(0,4);const a=await o.etaReduceLEAFNode({nodeuuid:s,contextuallambda:i});return"accio"===n&&t.slice(0,4),a}};const d={codebase:"leafspell.js",refnode:e,leafnode:t.gos.etaTree?.leafgraph?.graph.dataflow.getNodeAttributes(e).leafnode.data};let p=s?void 0:h_((async()=>{if(!o)return;if(globalThis?.DEBUG){const n=t.gos.etaTree.domain+"/"+t.gos.etaTree.appid+"/"+o+"/"+e;globalThis.trace[n]?globalThis.trace[n].push("parsing"):globalThis.trace[n]=["parsing"]}let n;if(["2293da4a-b517-4b0b-b396-cb030dc05900"].includes(e),["e9536f42-df6d-4086-a643-5f3c0b02aac9"].includes(e),e.slice(0,4),e.slice(0,4),n||u&&o in u&&(n=u[o]),!n){const r=t.user.spellbook,i=t.user.lambdalut;n=await h({refnode:e,spellbook:r,spellname:o,lambdalut:i,contextuallambda:a,etaTree:t.gos.etaTree})}if(!n){const r=t.gos.stdlambdalut,i=t.gos.standardSpellbook;n=await h({refnode:e,spellbook:i,spellname:o,lambdalut:r,contextuallambda:a,etaTree:t.gos.etaTree})}if(!n){const r=t.gos.curatedlambdalut,i=t.gos.curatedSpellbook;n=await h({refnode:e,spellbook:i,spellname:o,lambdalut:r,contextuallambda:a,etaTree:t.gos.etaTree})}if(["e9536f42-df6d-4086-a643-5f3c0b02aac9"].includes(e),globalThis?.DEBUG){const n=t.gos.etaTree.domain+"/"+t.gos.etaTree.appid+"/"+o+"/"+e;globalThis.trace[n]?globalThis.trace[n].push("parsed"):globalThis.trace[n]=["parsed"]}return l=n,l&&"_default"in l?n:void 0})(),3e4,"leafspell.js","LEAF Error: resolving transformation.leaflogic timed out",d);return(n,r)=>{const i=t=>t,a=t=>t,u=async(t,n,s)=>{const u=await t;if(void 0===u)return;if(void 0!==u&&"function"!=typeof u?._default)return;const c=p_({...r,_stream:n.pipe(U(t=>(void 0===t.sid?t.sid=[e]:t.sid.includes(e)||t.sid.push(e),t)))},[{_stream:s}],void 0,{...d,metastep:"executing parsed spell in the flow: "+o},{leaflogic:u._default,datalogic:{pre:i,post:a}});return c._control._stream.pipe(Mt(c._stream),U(t=>(t[0].sid?.pop(),t)),cs(()=>{}))},c=p_(r,n,void 0,{...d,metastep:"executing spell "+o},{leaflogic:s?(e,n)=>{const r=new Rt,i=new Rt,o=new Rt,s=new Rt,a=new Rt;let c;const l=e.length>1?merge(...e.map(t=>t._stream)):e[0]._stream,h=n._stream.pipe(Mt(l),Nt(e=>{e[0];const n=e[1];if(en(n)&&"cast-spell"===n._bname){const r=n._content.nodeuuid,a=n._content.input,l=t.gos.etaTree.leafgraph.graph.dataflow.nodes().includes(r)?t.gos.etaTree:t.gos.etaTree.hostEtaTree,h=l?.leafgraph.graph.dataflow.getNodeAttributes(r).leafnode.data;if(["leafspelldef","leaflabel"].includes(h?.leaf?.logic?.type)){h.leaf.logic.args.spellname;p=t.gos.etaTree.lookupLEAFNodeMethods(r),u(p,i,o).then(t=>{void 0===t?(o.next(e[1]),i.next(e[0])):(c=t.subscribe({next:t=>{s.next(t)},error:t=>{},complete:()=>{}}),setTimeout(()=>{o.next(a),i.next(e[0])},1))})}else o.next(e[1]),i.next(e[0])}else o.next(e[1]),i.next(e[0]);return s}),Mt(s),U(t=>(r.next(t[1][1]),a.next(t[1][0]),t[1])),Mt(a),U(t=>t[1]),cs(()=>{void 0!==c&&(c.unsubscribe(),c=void 0)}),Dt());return{_stream:r,_control:{...n,_stream:h}}}:(t,e)=>{const n=new Rt,r=new Rt,i=new Rt,o=new Rt,s=new Rt;let a;const c=e._stream.pipe(Mt(...t.map(t=>t._stream)),Nt(t=>(void 0===a&&p?u(p,r,i).then(e=>{void 0===e?(i.next(t[1]),r.next(t[0])):(a=e.subscribe({next:t=>{o.next(t)},error:t=>{},complete:()=>{}}),setTimeout(()=>{i.next(t[1]),r.next(t[0])},1))}):(i.next(t[1]),r.next(t[0])),o)),Mt(o),U(t=>(n.next(t[1][1]),s.next(t[1][0]),t[1])),Mt(s),U(t=>t[1]),cs(()=>{void 0!==a&&(a.unsubscribe(),a=void 0)}),Dt());return{_stream:n,_control:{...e,_stream:c}}},datalogic:{pre:i,post:a}});return{_stream:c._stream.pipe(U(t=>t),Dt()),_control:{_stream:c._control._stream.pipe(U(t=>t),Dt())}}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=n.leaf.logic.args.spellname;let s,a={},u=i;if(!s){a=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});const n=zg(a);n.length>0&&(u=u.concat(n),a=await Ig({refnode:e,nodelambda:r,contextuallambda:u,etaTree:t.gos.etaTree})),a&&o in a&&(s=a[o])}const c=async({refnode:t,spellbook:e,spellname:n,lambdalut:r,contextuallambda:i,etaTree:o}={})=>{if(n in e){const s=e[n];s in r&&r[s],"accio"===n&&t.slice(0,4);const a=await o.etaReduceLEAFNode({nodeuuid:s,contextuallambda:i});return"accio"===n&&t.slice(0,4),a}};if(!s){const n=t.user.spellbook,r=t.user.lambdalut;s=await c({refnode:e,spellbook:n,spellname:o,lambdalut:r,contextuallambda:u,etaTree:t.gos.etaTree})}if(!s){const n=t.gos.stdlambdalut,r=t.gos.standardSpellbook;s=await c({refnode:e,spellbook:r,spellname:o,lambdalut:n,contextuallambda:u,etaTree:t.gos.etaTree})}if(!s){const n=t.gos.curatedlambdalut,r=t.gos.curatedSpellbook;s=await c({refnode:e,spellbook:r,spellname:o,lambdalut:n,contextuallambda:u,etaTree:t.gos.etaTree})}return s}},Jg={dataflow:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...$g(t),_control:e}),lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=r.filter(e=>"lambda"===t.gos.etaTree.graphcomponents.components.lut[e].scope),s=r.filter(e=>"dataflow"===t.gos.etaTree.graphcomponents.components.lut[e].scope),a=await Ig({refnode:e,nodelambda:o,contextuallambda:i,etaTree:t.gos.etaTree,addnodelut:!0,metadata:{codebase:"leafspelldef.js",context:"reduced_lambdalambda_obj"}}),u=await Ig({refnode:e,nodelambda:s,contextuallambda:i,etaTree:t.gos.etaTree,metadata:{codebase:"leafspelldef.js",context:"reduced_defaultlambda_obj",spellname:n.leaf.logic.args.spellname}}),c=t=>t?Object.keys(t).reduce((e,n)=>("_nodelut"!==n&&("object"==typeof t[n]?e[n]=c(t[n]):e[n]=t[n]),e),{}):{};return{...c(a),...c(u)}},methods:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=r.filter(e=>"lambda"===t.gos.etaTree.graphcomponents.components.lut[e].scope),s=r.filter(e=>"dataflow"===t.gos.etaTree.graphcomponents.components.lut[e].scope),a=await Ig({refnode:e,nodelambda:o,contextuallambda:i,etaTree:t.gos.etaTree,addnodelut:!0,metadata:{codebase:"leafspelldef.js",context:"reduced_lambdalambda_obj"}}),u=await Ig({refnode:e,nodelambda:s,contextuallambda:i,etaTree:t.gos.etaTree,metadata:{codebase:"leafspelldef.js",context:"reduced_defaultlambda_obj",spellname:n.leaf.logic.args.spellname}}),c=t=>t?Object.keys(t).reduce((e,n)=>("_nodelut"!==n&&("object"==typeof t[n]?e[n]=c(t[n]):e[n]=t[n]),e),{}):{};return{...c(a),...c(u)}}};const Hg=bn("error",{type:"critical",message:"LEAF core error: race condition detected in leafloopyspell.js",codebase:"/src/ghostos/api/parser/nodelogic/abstraction/leafloopyspell.js"},{}),Xg=()=>{let t=0;return e=>{const n=Date.now();return n-t>=e&&(t=n,!0)}},Kg=t=>{if(!t)return 1;if(Object.keys(t).filter(t=>"&"===t).length>0)return;const e=Object.keys(t).filter(t=>on(t)).map(t=>parseInt(t)).sort();return e.length>0?e[e.length-1]:1},Qg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;["7b1f"].includes(e.slice(0,4));const o=await Ig({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});["7b1f"].includes(e.slice(0,4));const s="bypass"in o,{type:a,args:u}=n.leaf.logic,c={codebase:"leafloopyspell.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data},l=Kg(o),h=(t=>{const e="stream"in t;if(!t)return e?1e3:10;if("interval"in t){const e=Kg(t.interval);return on(e)?parseInt(e):void 0}return e?1e3:10})(o),d="forever"in o,p=Xg(),f=Xg();if(o&&"_default"in o){l>0?Vg(0,h).pipe(Gg(l)):Vg(0,h);["7b1f"].includes(e.slice(0,4));return(t,n)=>{["7b1f"].includes(e?.slice(0,4));const r={_stream:n._stream.pipe(U(t=>p(200)?t:void 0),Ft(t=>void 0!==t),ln(t=>_t([...Array(l).keys()]).pipe(U(e=>({...t,_label:{...t._label,loopyidx:e}})))))};if(!o||!("_default"in o)){return p_(r,t,void 0,{...c,metastep:"relaying input data as is due to error condition"})}let i=0,a=[];let u,h=new Bt(Hg),f=new Zo(1);const m=r._stream.pipe(Nt(t=>(u=t,h.next(t),h)),It(f));return p_({_stream:m},t,void 0,{...c,metastep:"executing a loopy spell with idx "+i},{leaflogic:o._default,datalogic:{pre:t=>{const e=t;return s||a.push(t),e},post:t=>{if(i+=1,(d||i<l)&&h.next(u),!s)return a[0];if("stream"in o)return t;if(a.push(t),i===l){const t=[...a];return a=[],i=0,t}}}})}}return o&&"await"in o?(t,e)=>{const n={_stream:e._stream.pipe(U(t=>f(10)?t:void 0),Ft(t=>void 0!==t),U(t=>[...Array(l).keys()].map(e=>({...t,_label:{...t._label,loopyidx:e}}))))};if(!o.await||!("_default"in o.await)){return p_(n,t,void 0,{...c,metastep:"relaying input data as is due to error condition"})}let r=0,i=[];const a=t=>{const e=t;return s||i.push(t),e};let u=new Rt,h=new Rt,d=new Rt;const p=new Rt,m=new Rt;let g,_;const y=new Rt,v=new Rt,b=o.await._default([{_stream:y}],{_stream:v}),w=n._stream.pipe(Mt(...t.map(t=>t._stream)),Nt(t=>{const e=t[0],n=t[1];if(g=e,void 0!==_&&!_.closed)return h.next(n),u.next(e),m;r=0,i=[],d.next();const f=p_({_stream:u},[{_stream:h}],void 0,{...c,metastep:"executing a loopy spell with idx "+r},{datalogic:{pre:a,post:t=>{if(r+=1,!s)return i[0];if("stream"in o)return t;if(i.push(t),r===l){const t=[...i];return i=[],r=0,1===l?t[0]:t}}}});let w;return _=f._control._stream.pipe(Mt(f._stream),Nt(t=>(w=t,y.next(t[1]),v.next(t[0]),b._control._stream)),Mt(b._control._stream),Mt(b._stream),U(t=>t[1]),U(t=>(t&&(p.next(w[1]),g=w[0],d.next()),t)),It(d)).subscribe({next:t=>{},error:t=>{},complete:()=>{}}),h.next(n),u.next(e),m}),U(t=>t),cs(()=>{void 0!==_&&(_.unsubscribe(),_=void 0)}),Ft(t=>void 0!==t),Dt());return{_stream:o.final&&"_default"in o.final?p.pipe(Ft(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Hg)),Nt(t=>a_(o.final._default,t)),U(t=>(setTimeout(()=>{m.next(g)},0),t)),Dt()):p.pipe(Ft(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Hg)),U(t=>(setTimeout(()=>{m.next(g)},0),t)),Dt()),_control:{_stream:w.pipe(U(t=>t),Dt())}}}:(t,e)=>({...$g(t),_control:e})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>{const r=$g(t);return{...e([r],n),_control:n}}}),s}},Zg=zt("leafgraph"),Yg=(t,e)=>{if(!t)return null;if(t.startsWith("/")){const n=t.slice(1);return n?{graph_domain:e,graph_appid:n}:null}const n=t.indexOf("/");return-1===n?{graph_domain:t,graph_appid:"index"}:0===n||n===t.length-1?null:{graph_domain:t.slice(0,n),graph_appid:t.slice(n+1)}},t_=async(t,e,n,r,i,o,s,a,u,c,l=!1)=>{const h=await(Vn(u)?.parseGraphEtaTree(i,o)),d=h.leafgraph,p=h.graphcomponents,f=h.graphcomponents.components.nodegroups.runtime[0];h.graphcomponents.components.nodegroups.lambda;return(async()=>{const t={};if(0===d.graph.lambda.nodes().filter(t=>{const e=d.graph.lambda.getNodeAttributes(t),{type:i,args:o}=e.leafnode.data.leaf.logic;if("leafgraph"===i){return An(Zg.editorconfig.namedatakey,o).toLowerCase()===n+"/"+r}return!1}).length){const n=[];if(f&&(["2ee89b44-16af-472f-97d4-47ae65f064c8"].includes(e),t._default=await Ng({refnode:"leafgraph",component_members:f,contextuallambda:c,etaTree:h})),l&&void 0!==p.leafconfig){const e=h.etaReduceLEAFNode({nodeuuid:p.leafconfig,contextuallambda:c}),n=await e;t._leafconfig=n.leafconfig}Object.entries(p.spelldefs).map(([e,r])=>{const i=h.etaReduceLEAFNode({nodeuuid:r,contextuallambda:c});i.then(n=>{t[e]=n}),n.push(i)}),await Promise.all(n)}return t})()},e_={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;await Ig({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),Go({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafgraph"}}}},contextuallambda:i});const{type:o,args:s}=n.leaf.logic,a=An(Zg.editorconfig.namedatakey,s),u=a.toLowerCase(),c=(t=>{const e=t.indexOf("/");return e<=0||e===t.length-1?null:{graph_domain:t.slice(0,e),graph_appid:t.slice(e+1)}})(u.startsWith("github/")?a:u);if(!c)return{};const{graph_domain:l,graph_appid:h}=c,d=t.gos.etaTree.domain,p=t.gos.etaTree.appid;if(l+"/"+h!=d+"/"+p){const n=t_(0,e,d,p,l,h,t.gos.leafio,t.gos.etaTree.mnemosyne,t.gos.etaTree,i),r=await n;return(t,e)=>{if(r){return{...r._default(t,e),_control:e}}}}return t=>({...$g(t),_control:controlflow$obj})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const{type:o,args:s}=n.leaf.logic,a=An(Zg.editorconfig.namedatakey,s),u=a.toLowerCase(),c=u.startsWith("github/")?a:u,l=t.gos.etaTree.domain,h=Yg(c,l);if(!h)return{};const d=t.gos.etaTree.appid,{graph_domain:p,graph_appid:f}=h;if("breezyforest"!==p&&p+"/"+f==l+"/"+d)return{};try{["3be30006-5b56-4b27-8eaa-249c6a46a557"].includes(e);const n=t_(0,e,l,d,p,f,t.gos.leafio,t.gos.etaTree.mnemosyne,t.gos.etaTree,i);return await n}catch(t){return}},_lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const{type:o,args:s}=n.leaf.logic,a=An(Zg.editorconfig.namedatakey,s),u=a.toLowerCase(),c=u.startsWith("github/")?a:u,l=t.gos.etaTree.domain,h=Yg(c,l);if(!h)return{};const d=t.gos.etaTree.appid,{graph_domain:p,graph_appid:f}=h;if("breezyforest"!==p&&p+"/"+f==l+"/"+d)return{};try{["3be30006-5b56-4b27-8eaa-249c6a46a557"].includes(e);const n=t_(0,e,l,d,p,f,t.gos.leafio,t.gos.etaTree.mnemosyne,t.gos.etaTree,i,!0);return await n}catch(t){return}},methods:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>({})},n_={dataflow:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>{},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>{}};Gt.breezyforest._version;const r_=(t,e)=>{const n=new Je,r=new Je,i=new Je;new Je;let o;t.forEach(t=>{const s=JSON.parse(sn.hp.from(t.data,"base64").toString("utf-8"));"leafdeckspade"===s.leaf.logic.type&&(o=t.uuid),n.addNode(t.uuid,{leafnode:{...t,data:s},lambdactrl:{gos:{standardSpellBook:{},curatedSpellBook:{},masterSubsDirectory:e},user:{spellbook:{},config:s}}}),r.addNode(t.uuid,{leafnode:{...t,data:s},lambdactrl:{gos:e,user:s}}),i.addNode(t.uuid,{leafnode:{...t,data:s},lambdactrl:{gos:e,user:s}})});const s=new Set,a=new Set,u=new Set,c=new Set,l={},h=new Set;return t.forEach(t=>{t.out_edges.forEach((t,e)=>{const o=JSON.parse(sn.hp.from(t.data,"base64").toString("utf-8")).leaf;if("leafdataedge"===o.logic.type)if(n.edge(t.source.uuid,t.target.uuid)){}else n.addEdgeWithKey(t.uuid,t.source.uuid,t.target.uuid,o),i.addEdgeWithKey(t.uuid,t.source.uuid,t.target.uuid,o),s.add(t.source.uuid),a.add(t.target.uuid);else if("leaflambdaedge"===o.logic.type){if("9935"===t.source.uuid.slice(0,4)){JSON.parse(sn.hp.from(t.data,"base64").toString("utf-8"));return}r.addEdgeWithKey(t.uuid,t.source.uuid,t.target.uuid,o),i.addEdgeWithKey(t.uuid,t.source.uuid,t.target.uuid,o),u.add(t.source.uuid),c.add(t.target.uuid),l[t.target.uuid]=t.target.uuid in l?[t.source.uuid].concat(l[t.target.uuid]):[t.source.uuid]}else"leafanchoredge"===o.logic.type&&h.add(t.target.uuid)})}),{graph:{lambda:r,dataflow:n},thespade:{uuid:o},edges:{data:{sources:s,targets:a},lambda:{sources:u,targets:c,sourcelut:l},anchor:{targets:h}}}},i_=t=>{const e=[],n=[],r=[],i=function(t){if(null===(e=t)||"object"!=typeof e||"function"!=typeof e.addUndirectedEdgeWithKey||"function"!=typeof e.dropNode||"boolean"!=typeof e.multi)throw new Error("connectedComponents: the given graph is not a valid graphology instance.");var e;if(!t.order)return[];const n=new tn(t),r=n.push.bind(n),i=[];return n.forEachNodeYetUnseen(function(e){const o=[];let s;for(n.push(e);0!==n.size;)s=n.pop(),o.push(s),t.forEachNeighbor(s,r);i.push(o)}),i}(t.graph.dataflow),o=(e,n,r,i,o)=>{const s={...o};return e.forEach(e=>{s[e]={idx:n,scope:r,category:i,metadata:t.graph.dataflow._nodes.get(e).attributes.leafnode.data.leaf.logic}}),s};let s={};const a={};let u;return i.forEach(i=>{if(((t,e)=>t.some(t=>{const n=e.edges.anchor.targets.has(t);return n||"leafanchor"===e.graph.lambda.getNodeAttributes(t).leafnode.data.leaf.logic.type}))(i,t))r.push(i);else{const r=((t,e)=>t.some(t=>(t.slice(0,4),e.edges.lambda.sources.has(t))))(i,t),c=((t,e)=>t.filter(t=>"leafspelldef"===e.graph.lambda.getNodeAttributes(t).leafnode.data.leaf.logic.type).length>0)(i,t),l=((t,e)=>t.filter(t=>"leafconfig"===e.graph.lambda.getNodeAttributes(t).leafnode.data.leaf.logic.type).length>0)(i,t);if(r||c||l){const e=n.push(i)-1;let r;(t=>t.length>1)(i)?r="dataflow":((t,e)=>1===t.length&&t.every(t=>{const n=e.graph.lambda.getNodeAttributes(t).leafnode;return!["leafinflowport","leafoutflowport"].includes(n.data.leaf.logic.type)}))(i,t)&&(r="lambda");if(s=o(i,e,r,"lambda",s),c){const e=t.graph.dataflow.getNodeAttributes(i[0]).leafnode.data;a[e.leaf.logic.args.spellname]=i[0]}else l&&(u=i[0])}else if(((t,e)=>t.every(t=>!e.edges.lambda.sources.has(t))&&t.every(t=>e.edges.data.sources.has(t)||e.edges.data.targets.has(t)))(i,t)){const t=e.push(i);s=o(i,t-1,"dataflow","main",s)}}}),{spelldefs:a,leafconfig:u,components:{nodegroups:{runtime:e,lambda:n,anchored:r},lut:s}}},o_=bn("error",{type:"critical",message:"LEAF core error: race condition detected in leaf.js",codebase:"/src/ghostos/api/parser/leaf.js"},{}),s_=bn("accio","ctrl_accio",{provenance:"executeLEAFLogic"}),a_=async(t,e,n={},r=void 0,i=void 0)=>{const o=new Rt,s=new Rt,a=t([{_stream:o}],{_stream:s,_config:n});if(a){const t=un(a._control._stream.pipe(Mt(a._stream),U(t=>t[1])));o.next(e),i?s.next(i):s.next(s_);return await t}},u_=bn("accio","ctrl_accio",{provenance:"subscribeToLEAFLogic"}),c_=async(t,e,n,r)=>{const i=new Bt({...o_,_label:{at:"leaf.js subscribeToLEAFLogic data stream"}}),o=new Bt({...o_,_label:{at:"leaf.js subscribeToLEAFLogic ctrl stream"}});i.next(e),o.next(u_);const s=t([{_stream:i}],{_stream:o,_config:n});let a;s&&s._control._stream.pipe(Nt(t=>(a=t,s._stream)),U(t=>[a,t]),It(r)).subscribe({next:t=>{},error:t=>{},complete:()=>{}})},l_=(t,e,n,r,i,o=void 0)=>{const s={_stream:r,_config:i};if(n){if(!n.runtime){const r=async()=>{t([{_stream:e}],s)._stream.pipe(U(t=>{const e=o?(()=>{const e=new Object;return e[o]=t,e})():t;return n&&n.subject$.next(e),e})).subscribe({next:t=>{},complete:()=>{}})};n.runtime=r()}return{_stream:n.subject$}}return t([{_stream:e}],s)};globalThis.TRACEON=!0,globalThis.TRACESIZE=30;const h_=(t,e,n,r,i)=>{let o;return Promise.race([t,new Promise((t,s)=>o=setTimeout(()=>{const e=bn("error",{type:"timeout",message:r,codebase:n,metadata:i});t(e)},e,r))]).finally(()=>clearTimeout(o))},d_=(t,e,n=!1)=>globalThis.TRACEON?Array.isArray(t)?[...t,{timestamp:Date.now(),trace:e}]:void 0===t?[{timestamp:Date.now(),trace:e}]:void 0:t||[],p_=(t,e,n,r={},i={leaflogic:void 0,datalogic:{pre:void 0,post:void 0}})=>{const o=new Rt,s=new Rt,a=new Rt;new Rt;let u,c;["e9e6e44b-792b-46d0-b1d3-58ce2f46c45b","c822ae2e-1be8-46be-b2cb-21a43cef0555","98d167d3-c1ed-4d4a-9ab9-25eaccd20a91"].includes(r.refnode);const l=i.leaflogic,h=void 0!==l?l([{_stream:a}],{_stream:void 0!==n?$t(s,n):s,_config:{...t._config}}):{_stream:a,_control:{_stream:s,_config:{...t._config,traces:d_(t._config?.traces,r)}}},d=e.length>1?$t(...e.map(t=>t._stream)):e[0]._stream,p=t._stream.pipe(Mt(d),Nt(t=>{["806e0a4b-badf-42a0-85af-5ad306385c58"].includes(r.refnode),e.length;const n=t[0],o=void 0!==i.datalogic?.pre?i.datalogic.pre(t[1]):t[1];u=1===n?.length?n[0]:n;const l={...u,traces:d_(u?.traces,{...r,at:"leaf.js driveDataflowByCtrlflow, initial switch-mapping of the ctrl signal to drive dataflow through a resolved leaflogic"},!0)};return c=o,setTimeout(()=>{a.next(o),s.next(l)},1),h._control._stream}),Mt(h._control._stream),Mt(h._stream),U(t=>[t[0][1],t[1]]),U(t=>{r.refnode,["38567c62-7513-4ec3-9011-2fcf6c51ec7b"].includes(r.refnode);const e=void 0!==i.datalogic?.post?i.datalogic.post(t[1]):t[1],n=Array.isArray(e)?e.filter(t=>void 0!==t):void 0!==e?e:void 0;return void 0!==n&&o.next(n),t[0]}),U(t=>t),Dt());return{_stream:o.pipe(Ft(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(o_)),Dt()),_control:{_stream:p.pipe(U(t=>(["e9e6e44b-792b-46d0-b1d3-58ce2f46c45b","c822ae2e-1be8-46be-b2cb-21a43cef0555"].includes(r.refnode),t)),Dt()),_config:{...t._config,traces:d_(t._config?.traces,r)}}}},f_=async(t,e,n)=>{const r={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:e.leafio,etaTree:e},user:{spellbook:{},lambdalut:{}}},{domain:i,appid:o}=r.gos.etaTree,s={graphuuid:"",domain:i,appid:o,graphaddrstr:t};try{const t=e_.lambda(r)({refnode:n,refnodedata:{leaf:{logic:{args:s}}},nodelambda:[],contextuallambda:[]});return await t}catch(t){return{}}};const m_=t=>{const e=t.split("://");return(e[0].includes("https")?"wss":"ws")+"://"+e[1]},g_=t=>!t||t&&"Object"!==t.constructor.name?t:JSON.parse(JSON.stringify(t)),__=t=>{const{endpoint:e,websocket:n,headers:r,hook:i}=t,o={endpoint:e,headers:g_(r||{}),websocket:{...n,endpoint:n&&n.endpoint||m_(e),parameters:n&&n.parameters||{},client:null,open:!1,subscriptions:{}}},s=async()=>{try{const t=new WebSocket(o.websocket.endpoint,"graphql-ws");return t.onerror=t=>{},t.onclose=t=>{},t}catch(t){throw new Error("Failed to establish the WebSocket connection: ",t)}},a=t=>{o.websocket.client.send(JSON.stringify(t))},u=t=>{o.websocket.client=t,o.websocket.shouldRetry&&(t.onclose=()=>{s().then(u)}),t.addEventListener("open",()=>{const t={...o.websocket.parameters,headers:{...o.headers,...o.websocket.parameters.headers}};a({type:"connection_init",payload:t})}),t.addEventListener("message",t=>{((t,e)=>{let n,{data:r}=e;try{r=JSON.parse(r)}catch(t){return}switch(r.type){case"connection_ack":return t.onConnectionSuccess&&t.onConnectionSuccess(),void(t.open=!0);case"connection_error":return void(t.onConnectionError&&t.onConnectionError(r));case"ka":return void(t.onConnectionKeepAlive&&t.onConnectionKeepAlive());case"data":return n=t.subscriptions[r.id],void(n&&n.onGraphQLData&&n.onGraphQLData(r.payload));case"error":return n=t.subscriptions[r.id],void(n&&n.onGraphQLError&&n.onGraphQLError(r.payload));case"connection_terminate":return;case"complete":n=t.subscriptions[r.id],n&&n.onGraphQLComplete&&n.onGraphQLComplete(r.payload),delete t.subscriptions[r.id]}})(o.websocket,t)})},c=()=>{s().then(t=>{u(t)}).catch(t=>{})};n&&c();return{query:async(t,e,n)=>{const{query:r,variables:s,headers:a}=t,u={...o.headers,...a||{}};Object.keys(u).some(t=>/content-type/gi.test(t));try{let t;t=await fetch(o.endpoint,{method:"POST",headers:u,credentials:"include",body:r});const s=await t.json();if(i&&i(s),s.errors)throw n&&n(s),s;return e&&e(s),s}catch(t){throw t}},subscribe:(t,e,n)=>{if(!o.websocket.client)return;const{operationId:r,subscription:i,variables:s,onGraphQLData:u,onGraphQLError:c,onGraphQLComplete:l}=t;return o.websocket.subscriptions[r]={onGraphQLData:t=>{u&&u(t),e&&e(t)},onGraphQLComplete:t=>{l&&l(t)},onGraphQLError:t=>{c&&c(t),n&&n(t)}},a({type:"start",id:r,payload:{query:i,variables:s||{}}}),{stop:()=>{a({type:"stop",id:r})}}},updateHeaders:t=>{o.headers=g_(t),o.websocket.client&&s().then(u).catch(t=>{})},establishWS:c,clientContext:o}};const{memoize:y_}=vn,v_=({_domain:t,_appid:e,filter:n={},query:r}={})=>`\n subscription {\n graph: getGraph(domain: "${t}", appid: "${e}", filter: ${n}) ${r}\n }\n`,b_=({_appmode:t,_hostdomain:e,_hostappid:n,_domain:r,_appid:i,filter:o={},query:s}={})=>`\n query {\n graph: getGraph(domain: "${r}", appid: "${i}", filter: ${o}) ${s}\n }\n`,w_={dburi_subs:"https://gdb.leafgon.com/sgraphql",dburi_subs_ws:"wss://gdb.leafgon.com/sgraphql",dburi_qm:"https://gdb.leafgon.com/qmgraphql"},x_=({_clientConfig:t=w_,_metamodel:e=Gt.breezyforest,_sessionid:n}={})=>{const r=t.dburi_subs?t.dburi_subs:void 0,i=t.dburi_subs_ws?t.dburi_subs_ws:void 0,o=t.dburi_qm?t.dburi_qm:void 0,s=t.clientAuthKey?t.clientAuthKey:void 0,a=e.GQLParameters.masterquery;let u={subscriptions:{},subs_methods:{},qm_methods:{}};const c=({gql_subs_client:t,force:e=!1}={})=>{(e||[WebSocket.CLOSED,WebSocket.CLOSING].includes(t.clientContext.websocket.client.readyState))&&t.establishWS()};u.gql_qm_client=o&&__({endpoint:o,headers:s?{Accept:"application/json","X-API-Key":s}:{Accept:"application/json"}});const l=new Promise((t,e)=>{u.gql_subs_client=r&&i?__({endpoint:r,headers:s?{"Content-Type":"application/json","X-API-Key":s}:{"Content-Type":"application/json"},websocket:{endpoint:i,onConnectionSuccess:()=>{t("gql_subs_client is connected and ready")},onConnectionError:()=>{e("gql_subs_client: Connection Error")}}}):void 0}),h=async({_appmode:e,_domain:n,_appid:r,filter:i="{}",subsCallback:o,errorCallback:s,variables:h}={})=>{l.then(e=>{const l=(()=>{let t="";const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let n=0;n<5;n++)t+=e.charAt(Math.floor(62*Math.random()));return t+(Object.keys(u.subscriptions).length+1)})();try{const e=u.gql_subs_client.subscribe({operationId:l,subscription:v_({_domain:n,_appid:r,filter:i,query:a}),onGraphQLData:t=>{o&&o(t.data)},onGraphQLError:t=>{l in u.subscriptions&&u.subscriptions[l].stop(),s&&s(t)},onGraphQLComplete:e=>{t.keepGQLConnected&&c({gql_subs_client:u.gql_subs_client,force:!0})}});u.subscriptions[l]=e}catch(t){l in u.subscriptions&&u.subscriptions[l].stop()}})},d=y_(({_appmode:t,_hostdomain:e,_hostappid:n,_domain:r,_appid:i,filter:s="{}",variables:c}={})=>new Promise((l,h)=>{const d={endpoint:o,query:JSON.stringify({query:b_({_appmode:t,_hostdomain:e,_hostappid:n,_domain:r,_appid:i,filter:s,query:a}),variables:c||{}})};try{u.gql_qm_client.query(d,t=>{t.data&&l({graph:t.data.graph})})}catch(t){h({})}}),({_appmode:t,_hostdomain:e,_hostappid:r,_domain:i,_appid:o,filter:s="{}",variables:a}={})=>JSON.stringify([i,o,s,n])),p=({variables:t})=>{const e={endpoint:o,query:JSON.stringify({query:"mutation AddNode($uuid: String!, $data: String!, $graphdomain: String!, $graphappid: String!, $provdomain: String!, $provappid: String!) {\n addNode(input: [{uuid: $uuid, graph: {domain: $graphdomain, appid: $graphappid}, provenance: {domain: $provdomain, appid: $provappid}, data: $data}]) {node {uuid}}\n}",variables:t||{}})};try{u.gql_qm_client.query(e,t=>{t.data})}catch(t){}},f=({node_uuid:t})=>{const e={endpoint:o,query:JSON.stringify({query:"mutation DeleteNode($uuid: String!) {\n deleteNode(nfilter: {uuid: {eq: $uuid}}) {node {uuid}}\n}",variables:{uuid:t}||{}}).replace(/\\n/g,"")};try{u.gql_qm_client.query(e,t=>{t.data})}catch(t){}},m=({variables:t})=>{const e={endpoint:o,query:JSON.stringify({query:"mutation UpdateNode($uuid: String!, $data: String!) {\n updateNode(input: {filter: {uuid: {eq: $uuid}}, set: {data: $data}}) {node {uuid}}\n}",variables:t||{}})};try{u.gql_qm_client.query(e,t=>{t.data})}catch(t){}},g=({variables:t})=>{const e={endpoint:o,query:JSON.stringify({query:"mutation AddEdge($uuid: String!, $sourceuuid: String!, $targetuuid: String!, $data: String!, $graphdomain: String!, $graphappid: String!, $provdomain: String!, $provappid: String!) {\n addEdge(input: [{uuid: $uuid, source: {uuid: $sourceuuid}, target: {uuid: $targetuuid}, graph: {domain: $graphdomain, appid: $graphappid}, provenance: {domain: $provdomain, appid: $provappid}, data: $data}]) {edge {uuid}}\n}",variables:t||{}})};try{u.gql_qm_client.query(e,t=>{t.data})}catch(t){}},_=({edge_uuid:t})=>{const e={endpoint:o,query:JSON.stringify({query:"mutation DeleteEdge($uuid: String!) {\n deleteEdge(efilter: {uuid: {eq: $uuid}}) {edge {uuid}}\n}",variables:{uuid:t}||{}}).replace(/\\n/g,"")};try{u.gql_qm_client.query(e,t=>{t.data})}catch(t){}};return u.gql_subs_client&&(u.subs_methods={queryGraph:h,clientState:()=>u.gql_subs_client.clientContext.websocket.client.readyState,reconnect:()=>{c({gql_subs_client:u.gql_subs_client})}}),u.gql_qm_client&&(u.qm_methods={queryGraph:d,addNode:p,updateNode:m,delNode:f,addEdge:g,delEdge:_}),u};const T_=({_LEAFappList:t=[],stateObjInstanceID:e=Xn(),dirOfSubjects:n={},permissions:r={},metamodel:i=Gt}={})=>{const o={current:JSON.parse(JSON.stringify(i.breezyforest.IOStateGroundZero))};o.current.dirOfSubjects=(()=>{let t={};return Object.entries(i.breezyforest.subsDirectory).forEach(([e,s])=>{e in n?(t[e]=n[e],o.current.permissions[e]=e in r?r[e]:i.breezyforest.IOAccessPermission.Observer):(t[e]={main:k_(),bridges:{}},o.current.permissions[e]=e in r?r[e]:i.breezyforest.IOAccessPermission.All),o.current.subscriptions[e]=t[e].main.doSubscribe(({control:t,data:n})=>{o.current.subsCache[e]={control:t,data:n},((t,e,n)=>{t in o.current.callbacks&&Object.entries(o.current.callbacks[t]).map(([t,r])=>{r({control:e,data:n})})})(e,t,n)})}),t})();return{getCurLEAFIOState:()=>o.current.subsCache,getMasterSubsDir:()=>o.current.dirOfSubjects,setNewLEAFIOState:(t,n,r=Gt.breezyforest.originType.FRONTEND)=>{try{if(o.current.permissions[t]&i.breezyforest.IOAccessPermission.Contributor)return o.current.dirOfSubjects[t].main.doWrite({control:{provenance:{stateObjInstanceID:e,dataOrigin:r}},data:n}),!0;return o.current.permissions[t]&i.breezyforest.IOAccessPermission.Contributor}catch(t){return-1}},setLEAFIOCallback:(t,e,n=null)=>{t in o.current.subscriptions&&(null===n&&e in delete o.current.callbacks[t]?(o.current.callbacks={...o.current.callbacks,[t]:{...o.current.callbacks[t]}},delete o.current.callbacks[t][e]):n&&(o.current.callbacks={...o.current.callbacks,[t]:{...o.current.callbacks[t],[e]:n}}))},destructLEAFIOobj:()=>{Object.entries(o.current.subscriptions).forEach(([t,e])=>{o.current.dirOfSubjects[t].main.doUnsubscribe(e)})}}},k_=()=>{const t={handle$:new Bt,doWrite:e=>t.handle$.next(e),doSubscribe:e=>t.handle$.pipe(function(t){return Ft(function(e,n){return t<=n})}(1)).subscribe(e),doUnsubscribe:t=>t.unsubscribe(),doAddAddressee:(t,e)=>{}};return t},S_=(t,e=[],n=Gt)=>{let r={};return Object.entries(n.breezyforest.subsDirectory).forEach(([t,e])=>{r[t]={main:k_(),bridges:{}}}),[t,r]},A_="https://gdb.leafgon.com/qmgraphql",E_=async({variables:t,endpoint:e=A_})=>{const n=__({endpoint:e,headers:{Accept:"application/json"}}),r={endpoint:e,query:JSON.stringify({query:"mutation AddNode($uuid: String!, $leafnodetype: String, $data: String!, $graphdomain: String!, $graphappid: String!, $provdomain: String!, $provappid: String!) {\n addNode(input: [{uuid: $uuid, leafnodetype: $leafnodetype, graph: {domain: $graphdomain, appid: $graphappid}, provenance: {domain: $provdomain, appid: $provappid}, data: $data}]) {node {uuid}}\n}",variables:t||{}})};let i;try{i=await n.query(r),i.data}catch(t){}},O_=async({node_uuid:t,endpoint:e=A_})=>{const n=__({endpoint:e,headers:{Accept:"application/json"}}),r={endpoint:e,query:JSON.stringify({query:"mutation DeleteNode($uuid: String!) {\n deleteNode(nfilter: {uuid: {eq: $uuid}}) {node {uuid}}\n}",variables:{uuid:t}||{}}).replace(/\\n/g,"")};let i;try{i=await n.query(r),i.data}catch(t){}},C_=async({variables:t,endpoint:e=A_})=>{const n=__({endpoint:e,headers:{Accept:"application/json"}}),r={endpoint:e,query:JSON.stringify({query:"mutation UpdateNode($uuid: String!, $data: String!) {\n updateNode(input: {filter: {uuid: {eq: $uuid}}, set: {data: $data}}) {node {uuid}}\n}",variables:t||{}})};let i;try{i=await n.query(r),i.data}catch(t){}},M_=async({variables:t,endpoint:e=A_})=>{const n=__({endpoint:e,headers:{Accept:"application/json"}}),r={endpoint:e,query:JSON.stringify({query:"mutation AddEdge($uuid: String!, $sourceuuid: String!, $targetuuid: String!, $data: String!, $graphdomain: String!, $graphappid: String!, $provdomain: String!, $provappid: String!) {\n addEdge(input: [{uuid: $uuid, source: {uuid: $sourceuuid}, target: {uuid: $targetuuid}, graph: {domain: $graphdomain, appid: $graphappid}, provenance: {domain: $provdomain, appid: $provappid}, data: $data}]) {edge {uuid}}\n}",variables:t||{}})};let i;try{i=await n.query(r),i.data}catch(t){}},N_=async({edge_uuid:t,endpoint:e=A_})=>{const n=__({endpoint:e,headers:{Accept:"application/json"}}),r={endpoint:e,query:JSON.stringify({query:"mutation DeleteEdge($uuid: String!) {\n deleteEdge(efilter: {uuid: {eq: $uuid}}) {edge {uuid}}\n}",variables:{uuid:t}||{}}).replace(/\\n/g,"")};let i;try{i=await n.query(r),i.data}catch(t){}};export{Gt as LEAFIOmetamodel,Bn as SHA1,Jt as _breezyforeststdlib_hierarchy,Wt as _breezyforeststdlib_name,Ht as _edge_handle_dict,Xt as _edge_style_dict,Tg as _leafelement,e_ as _leafgraph,zt as _leafstdlib_dataflow_api,i_ as analyzeLEAFGraph,__ as createGQLClient,ko as decodeUnicode,Mp as destroySoundStageNode,bn as doBottle,wn as doUnbottle,p_ as driveDataflowByCtrlflow,To as encodeUnicode,Ng as etaReduceDataflowComponent,Vn as etaTreeForest,a_ as executeLEAFLogic,l_ as executeLEAFLogicInSync,An as fetchMultiKeyedData,T_ as initLEAFIOapi,Mo as init_gRuntimeLEAFlisp,x_ as initializeLEAFlakeGQLClient,S_ as initializeMasterSubsDirectory,Cp as initializeSoundStage,k_ as initializeSubsMain,M_ as mutateAddEdge,E_ as mutateAddNode,N_ as mutateDelEdge,O_ as mutateDelNode,C_ as mutateUpdateNode,f_ as parseAddressableGraph,Eo as parseJsonToLEAFlisp,r_ as reconstructLEAFGraph,Ro as runLEAFlispcode,jg as runtimeEtaTree,En as setMultiKeyedData,c_ as subscribeToLEAFLogic};
3
3
  //# sourceMappingURL=index.esm.js.map