ghostos 0.1.16 → 0.1.18

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)},S=function(t){return"setTarget"===t.type},T=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&&S(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&&S(u)&&this._automationEvents.push(s(this.getValue(e),e)),void 0!==u&&p(u)&&u.startTime+u.duration>e){var x=e-u.startTime,T=(u.values.length-1)/u.duration,k=Math.max(2,1+Math.ceil(x*T)),A=x/(k-1)*T,E=u.values.slice(0,k);if(A<1)for(var O=1;O<k;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}),I=-1===M?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[M-1];if(void 0!==I&&p(I)&&y(I)+I.duration>e)return!1;var N=c(t)?i(t.value,t.endTime,this._currenTime):l(t)?o(t.value,e,this._currenTime):t;if(-1===M)this._automationEvents.push(N);else{if(p(t)&&e+t.duration>y(this._automationEvents[M]))return!1;this._automationEvents.splice(M,0,N)}}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];S(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&&S(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),T=e(w,2),k=T[0],A=T[1];return b(t,k,A,r)}return this._defaultValue}}])}(),k=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=T,t.createCancelAndHoldAutomationEvent=k,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 k(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(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 S(t,e,n,r){return H(J(e),t,n,r)}function T(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 k(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 S(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(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+=Y[t[r]];return i}function I(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 N(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 R(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 D(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 j(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||j(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||j(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||N(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||N(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||N(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||N(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||N(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||N(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||N(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||N(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||N(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||N(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||N(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||N(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||N(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||N(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||N(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||N(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){R(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){R(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||R(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||R(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||R(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||R(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||R(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 D(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);R(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);R(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||R(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||R(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||R(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||R(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||R(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 D(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 Y=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?Q:t}function Q(){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 S="";if(!c){for(y in w=[],o[m])this.terminals_[y]&&y>2&&w.push("'"+this.terminals_[y]+"'");S=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(S,{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},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 S(t){if(t.length){var e=t.shift();if(t.length){var n=this;this._slip(w,[function(){S.apply(n,[t])}])}try{this._repair(),e.apply(this)}catch(t){this._break(t.toString())}}else this._break()}function T(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return;t.push(e)}function k(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=[],I=[],N=[],R=[],D={},P={};function j(){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=[],I=[],at._allOuts={},at._allIns={},t=0;t<at._outs.length;t++)e=at._outs[t],D[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],D[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}),I.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}),I.push(e));if(C._watcher&&C._watcher._handles.length){var n=rt(R,N,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)})}}R=C._info.inputs,N=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(S,[n]),t._resume()}}function q(t,e){if(this._bad)t._crash(this._err());else{var n=F(e,I);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(S,[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)?T(this._orig._handles,t):T(this._orig._outs,t)}function H(t){void 0===t?(this._orig._handles=[],this._orig._outs=[]):f(t)?k(this._orig._handles,t):k(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 Y(t){m.apply(this),this._sink=t}function Z(t){return t.isMidi&&!t.isMidi2?new Pt(t):Xe.apply(null,arguments)}function Q(){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(),T(this._orig._handles,t))}function et(t){void 0===t?this._orig._handles=[]:k(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 Q);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 Y(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()},Y.prototype=new m,Y.prototype._sxid=V.prototype._sxid,Y.prototype._receive=function(t){this._sink._receive(t)},Y.prototype.send=function(){return this._push(G,[Z.apply(null,arguments)]),this._thenable()},Y.prototype._image=V.prototype._image,Y.prototype.connect=function(t){return this._sink.connect(t),this._push(y,[this._sink]),this._thenable()},Y.prototype.disconnect=function(t){return this._sink.disconnect(t),this._push(y,[this._sink]),this._thenable()},Y.prototype.connected=function(){return this._sink.connected()},Y.prototype.sxId=V.prototype.sxId,Y.prototype.ch=V.prototype.ch,Y.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()},Y.prototype.MIDI1=function(){var t=this._sink._image();return this._push(y,[t]),t._thenable()},Y.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()},Q.prototype=new m,Q.prototype.connect=function(t){return this._push(tt,[t]),this._thenable()},Q.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?St(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){Tt(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){Tt(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]?(kt(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),k(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(S,[_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(){j()},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]});j()},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,T(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,T(r.clients,t._orig),t._info=r.info,t._close=function(){r._close(this)}},at._closeOut=function(t){var e=t._impl;k(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,e.plugin.MidiOutClose())},at._closeIn=function(t){var e=t._impl;k(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 St(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 Tt(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})}),j()},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,T(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,T(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;k(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;k(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 kt(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,T(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,T(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;k(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;k(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(j(),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 It(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 Nt(t){return 25==t.type?32|t.hour:29.97==t.type?64|t.hour:30==t.type?96|t.hour:t.hour}function Rt(t){return t<10?"0"+t:t}function Dt(t){for(var e=[],n=0;n<t.length;n++)e[n]=Rt(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){D[t]=!0},A.prototype.maskMidiOut=At.maskMidiOut,At.unmaskMidiOut=function(t){delete D[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 Dt([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 jt={};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:jt[t.toString().toLowerCase()]},Pt.programValue=function(t){return t},Pt.octaveValue=function(t){var e=jt[t.toString().toLowerCase()];return void 0===e&&(e=jt[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++)jt[t+s]=o,jt[t+"♮"+s]=o,o>0&&(jt[t+"b"+s]=o-1,jt[t+"♭"+s]=o-1,jt[t+"bb"+s]=o-2,jt[t+"♭♭"+s]=o-2,jt[t+"𝄫"+s]=o-2),o<127&&(jt[t+"#"+s]=o+1,jt[t+"♯"+s]=o+1,jt[t+"##"+s]=o+2,jt[t+"♯♯"+s]=o+2,jt[t+"𝄪"+s]=o+2)}),s=0;s<128;s++)jt[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 Yt(t){return(t!=parseInt(t)||t<0||t>4294967295)&&Bt(t),parseInt(t)}function Zt(t){return zt(Pt.noteValue(t),t)}function Qt(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(Qt(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),Qt(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,It(t)]},songPosition:function(t,e){return void 0===e?[242,Qt(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,Nt(t),t.getMinute(),t.getSecond(),t.getFrame(),247]},sxMasterVolume:function(t,e){return void 0===e?[240,127,this._sxid,4,1,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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=De(e[1]):e.length>2&&(r=De(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(""!=De(t))throw RangeError("Unexpected data"+qe(De(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(De(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(De(""+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,De(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 Se(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 Te(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 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,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){Se(t,_e[t])}),E(le,function(t){Te(t,le[t])}),E(he,function(t){ke(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 Ie(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 Ne(t){for(var e=[],n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function Re(t){for(var e="",n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e}function De(t){return t instanceof Array?Re(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 je(t){return(t<16?"0":"")+t.toString(16)}function Le(t){for(var e=[],n=0;n<t.length;n++)e.push(je(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(je(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"+je(t.charCodeAt(n)):e+=t[n];return e}function Be(t){return t.length?": "+Le(Ne(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?"??":je(t),r=void 0===e?"??":je(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?"??":je(t))+" "+(void 0===e?"??":je(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=De(t),this},Pt.prototype.getText=function(){if(void 0!==this.dd)return Me(this.ff,this.dd)?Ie(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"+je(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: "+Dt(Ne(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:"+je(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(Ne(this.dd.substring(7))):1==this.dd.charCodeAt(2)?e+this.getText():e+Le(Ne(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:"+je(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=[]),T(this[e].notes,t.getNote())):t.isNoteOff()&&this[e].notes&&k(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 Ye=[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=Yt(t))>>24&255,t>>16&255,t>>8&255,255&t]}function Qe(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],Ye).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,Qe(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,Qe(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),Qt(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,Qe((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,Qe((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],Ye).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],Ye).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)),Ye).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)),Ye).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)),Ye).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)),Ye).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],Ye).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],Ye).slice(0,4));return r}}function xn(t){E(an,function(e){t.prototype[e]=an[e]})}function Sn(t,e){var n=256*t+e;return n?n>>9||1:0}function Tn(t,e,n,r){return 16777216*t+65536*e+256*n+r>>25&127}function kn(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(kn(new Pt(t.slice(1)),o));else if(3==i)n=t[1]>>4,e=15&t[1],0==n?(this._emit(kn(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(kn(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(kn(new Pt([176+n,2==e?101:99,t[2]]),o)),this._emit(kn(new Pt([176+n,2==e?100:98,t[3]]),o)),this._emit(kn(new Pt([176+n,6,t[4]>>1]),o)),this._emit(kn(new Pt([176+n,38,64*(1&t[4])+(t[4]>>2)]),o))):8!=e&&9!=e||this._emit(kn(new Pt([t[1],t[2],Sn(t[4],t[5])]),o)),10==e&&this._emit(kn(new Pt([t[1],t[2],Tn(t[4],t[5],t[6],t[7])]),o)),11==e){if(rn.includes(t[2]))return;this._emit(kn(new Pt([t[1],t[2],Tn(t[4],t[5],t[6],t[7])]),o))}13==e&&this._emit(kn(new Pt([t[1],Tn(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(kn(new Pt([t[1],127&r,r>>7&127]),o))):12==e&&(t[3]&&(this._emit(kn(new Pt([176+n,0,t[6]]),o)),this._emit(kn(new Pt([176+n,32,t[7]]),o))),this._emit(kn(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(),Ye).slice(0,4)));else if(t[0]>240&&t[0]<=255&&247!=t[0])this._emit(At.MIDI2([16+e].concat(t.slice(),Ye).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(Y),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"}[je(this[2])+""+je(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,In,Nn=[],Rn=0;try{var Dn=URL.createObjectURL(new Blob(["(",function(){function t(){postMessage({}),setTimeout(t,0)}t()}.toString(),")()"],{type:"application/javascript"})),Pn=function(){for(var t=Nn.length,e=0;e<t;e++)Nn.shift()();++Rn>20&&Mn&&(Mn.terminate(),Mn=void 0)},jn=function(t){Nn.push(t),Rn=0,Mn||((Mn=new Worker(Dn)).onmessage=Pn)};jn(function(){At.lib.schedule=jn})}catch(t){}function Ln(){if(!In&&"undefined"!=typeof window){var t=window.AudioContext||window.webkitAudioContext;if(t){(In=new t)&&!In.createGain&&(In.createGain=In.createGainNode);var e=function(){if("running"!=In.state){In.resume();var t=In.createOscillator(),n=In.createGain();try{n.gain.value=0}catch(t){}n.gain.setTargetAtTime(0,In.currentTime,.01),t.connect(n),n.connect(In.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&&(j(),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&&(j(),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&&j(),!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&&j(),!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(),In},At.lib.closeAudioContext=function(){In&&In.close(),In=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 Yn="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(Yn+t[n]+" is not a UInt8 value.");for(r=0,n=0;n<t.length;n++)if(r){if(t[n]>127)throw TypeError(Yn+"Unexpected status byte at index "+n+" ("+t[n]+").");i.push(t[n]),r--}else{if(t[n]<128)throw TypeError(Yn+"Running status is not allowed at index "+n+" ("+t[n]+").");if(247==t[n])throw TypeError(Yn+"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",Yn+"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(Yn+"Message is incomplete");return[o]}function Qn(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 Qn(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]",S="[object Function]",T="[object GeneratorFunction]",k="[object Map]",A="[object Number]",E="[object Object]",O="[object Promise]",C="[object RegExp]",M="[object Set]",I="[object String]",N="[object Symbol]",R="[object WeakMap]",D="[object ArrayBuffer]",P="[object DataView]",j="[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),Y=RegExp(X.source),Z=/<%-([\s\S]+?)%>/g,Q=/<%([\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=/($^)/,St=/['\n\r\u2028\u2029\\]/g,Tt="\\ud800-\\udfff",kt="\\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",It="['’]",Nt="["+Tt+"]",Rt="["+Mt+"]",Dt="["+kt+"]",Pt="\\d+",jt="["+At+"]",Lt="["+Et+"]",Ft="[^"+Tt+Mt+Pt+At+Et+Ot+"]",$t="\\ud83c[\\udffb-\\udfff]",Bt="[^"+Tt+"]",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="(?:"+Dt+"|"+$t+")"+"?",Kt="["+Ct+"]?",Yt=Kt+Xt+("(?:"+Gt+"(?:"+[Bt,qt,Ut].join("|")+")"+Kt+Xt+")*"),Zt="(?:"+[jt,qt,Ut].join("|")+")"+Yt,Qt="(?:"+[Bt+Dt+"?",Dt,qt,Ut,Nt].join("|")+")",te=RegExp(It,"g"),ee=RegExp(Dt,"g"),ne=RegExp($t+"(?="+$t+")|"+Qt+Yt,"g"),re=RegExp([Vt+"?"+Lt+"+"+Jt+"(?="+[Rt,Vt,"$"].join("|")+")",Wt+"+"+Ht+"(?="+[Rt,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+Tt+kt+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[j]=ue[L]=ue[F]=ue[$]=ue[B]=ue[q]=ue[U]=ue[V]=ue[G]=!0,ue[y]=ue[v]=ue[D]=ue[b]=ue[P]=ue[w]=ue[x]=ue[S]=ue[k]=ue[A]=ue[E]=ue[C]=ue[M]=ue[I]=ue[R]=!1;var ce={};ce[y]=ce[v]=ce[D]=ce[P]=ce[b]=ce[w]=ce[j]=ce[L]=ce[F]=ce[$]=ce[B]=ce[k]=ce[A]=ce[E]=ce[C]=ce[M]=ce[I]=ce[N]=ce[q]=ce[U]=ce[V]=ce[G]=!0,ce[x]=ce[S]=ce[R]=!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,Se=be&&be.isMap,Te=be&&be.isRegExp,ke=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 Ie(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 Ne(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 Re(t,e){return!!(null==t?0:t.length)&&Ve(t,e,0)>-1}function De(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 je(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 Ye(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 Qe(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,Tt=e.Error,kt=e.Function,At=e.Math,Et=e.Object,Ot=e.RegExp,Ct=e.String,Mt=e.TypeError,It=r.prototype,Nt=kt.prototype,Rt=Et.prototype,Dt=e["__core-js_shared__"],Pt=Nt.toString,jt=Rt.hasOwnProperty,Lt=0,Ft=(n=/[^.]+$/.exec(Dt&&Dt.keys&&Dt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",$t=Rt.toString,Bt=Pt.call(Et),qt=me._,Ut=Ot("^"+Pt.call(jt).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=Rt.propertyIsEnumerable,Kt=It.splice,Yt=Gt?Gt.isConcatSpreadable:i,Zt=Gt?Gt.iterator:i,Qt=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=It.join,He=ln(Et.keys,Et),vn=At.max,bn=At.min,wn=at.now,xn=e.parseInt,Sn=At.random,Tn=It.reverse,kn=po(e,"DataView"),An=po(e,"Map"),En=po(e,"Promise"),On=po(e,"Set"),Cn=po(e,"WeakMap"),Mn=po(Et,"create"),In=Cn&&new Cn,Nn={},Rn=$o(kn),Dn=$o(An),Pn=$o(En),jn=$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(jt.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 Yn(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?Ye(t.length,Ct):[],u=a.length;for(var c in t)!e&&!jt.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 Qn(t,e){return jo(Mi(t),ur(e,0,t.length))}function tr(t){return jo(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];jt.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&&Ii(e,Na(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]&&jt.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==S||d==T;if(Xs(t))return Ti(t,u);if(d==E||d==y||p&&!o){if(a=c||p?{}:yo(t),!u)return c?function(t,e){return Ii(t,mo(t),e)}(t,function(t,e){return t&&Ii(e,Ra(e),t)}(a,t)):function(t,e){return Ii(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 D:return ki(t);case b:case w:return new r(+t);case P:return function(t,e){var n=e?ki(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case j:case L:case F:case $:case B:case q:case U:case V:case G:return Ai(t,n);case k:return new r;case A:case I: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 N: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?Ra:Na)(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 No(function(){t.apply(i,n)},e)}function dr(t,e,n,r){var i=-1,o=Re,s=!0,a=t.length,u=[],c=e.length;if(!a)return u;n&&(e=Pe(e,Qe(n))),r?(o=De,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:Q,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 jt.call(e,t)?e[t]:i},Wn.prototype.has=function(t){var e=this.__data__;return Mn?e[t]!==i:jt.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=Di(wr),fr=Di(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):je(i,a):r||(i[i.length]=a)}return i}var vr=Pi(),br=Pi(!0);function wr(t,e){return t&&vr(t,e,Na)}function xr(t,e){return t&&br(t,e,Na)}function Sr(t,e){return Ne(e,function(e){return Zs(t[e])})}function Tr(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 kr(t,e,n){var r=e(t);return zs(t)?r:je(r,n(t))}function Ar(t){return null==t?t===i?"[object Undefined]":"[object Null]":Qt&&Qt in Et(t)?function(t){var e=jt.call(t,Qt),n=t[Qt];try{t[Qt]=i;var r=!0}catch(t){}var o=$t.call(t);r&&(e?t[Qt]=n:delete t[Qt]);return o}(t):function(t){return $t.call(t)}(t)}function Er(t,e){return t>e}function Or(t,e){return null!=t&&jt.call(t,e)}function Cr(t,e){return null!=t&&e in Et(t)}function Mr(t,e,n){for(var o=n?De:Re,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,Qe(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 Ir(t,e,n){var r=null==(t=Co(t,e=bi(e,t)))?t:t[Fo(Yo(e))];return null==r?i:Ee(r,t,n)}function Nr(t){return na(t)&&Ar(t)==y}function Rr(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 D: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 I:return t==e+"";case k: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 N:if($n)return $n.call(t)==$n.call(e)}return!1}(t,e,c,n,r,o,s);if(!(1&n)){var f=h&&jt.call(t,"__wrapped__"),m=d&&jt.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:jt.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,Rr,o))}function Dr(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?Rr(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 jr(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(!ko(t))return He(t);var e=[];for(var n in Et(t))jt.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=ko(t),n=[];for(var r in t)("constructor"!=r||!e&&jt.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||Dr(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):Rr(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=Ti(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)}},Ra)}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 Tr(e,1===t.length?t[0]:t)}:t}):[iu];var r=-1;e=Pe(e,Qe(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=Tr(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,Qe(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(Sn()*(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 Yr(t,e){return Ro(Oo(t,e,iu),t+"")}function Zr(t){return Zn(qa(t))}function Qr(t,e){var n=qa(t);return jo(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=In?function(t,e){return In.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 jo(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=Re,o=t.length,s=!0,a=[],u=a;if(n)s=!1,i=De;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&&!jt.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(Yo(e))]}function pi(t,e,n,r){return ti(t,e,n(Tr(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,je([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=Yr;function xi(t,e,n){var r=t.length;return n=n===i?r:n,!e&&n>=r?t:ii(t,e,n)}var Si=ie||function(t){return me.clearTimeout(t)};function Ti(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 ki(t){var e=new t.constructor(t.byteLength);return new zt(e).set(new zt(t)),e}function Ai(t,e){var n=e?ki(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 Ii(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 Ni(t,e){return function(n,r){var i=zs(n)?Oe:ir,o=e?e():{};return i(n,t,co(r,2),o)}}function Ri(t){return Yr(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 Di(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 ji(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=Na(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&&So(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?u[ao(l[0])].apply(u,l[3]):1==a.length&&So(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),S=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-=S,g&&v<d){var T=hn(b,x);return Hi(t,e,qi,h.placeholder,n,b,T,c,l,d-v)}var k=f?n:this,A=m?k[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(k,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,Qe(co())),Yr(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 So(t)&&Io(m,f),m.placeholder=r,Do(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 Yi(t){return function(e){var n=go(e);return n==k?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)S=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 S=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 Do((w?ei:Io)(S,x),t,e)}function Qi(t,e,n,r){return t===i||qs(t,Rt[n])&&!jt.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 Ro(Oo(t,i,Wo),t+"")}function io(t){return kr(t,Na,fo)}function oo(t){return kr(t,Ra,mo)}var so=In?function(t){return In.get(t)}:cu;function ao(t){for(var e=t.name+"",n=Nn[e],r=jt.call(Nn,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(jt.call(qn,"placeholder")?qn:t).placeholder}function co(){var t=qn.iteratee||ou;return t=t===ou?jr: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=Na(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),Ne(_e(t),function(e){return Xt.call(t,e)}))}:gu,mo=_e?function(t){for(var e=[];t;)je(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||ko(t)?{}:Un(Jt(t))}function vo(t){return zs(t)||Gs(t)||!!(Yt&&t&&t[Yt])}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 So(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]}(kn&&go(new kn(new ArrayBuffer(1)))!=P||An&&go(new An)!=k||En&&go(En.resolve())!=O||On&&go(new On)!=M||Cn&&go(new Cn)!=R)&&(go=function(t){var e=Ar(t),n=e==E?t.constructor:i,r=n?$o(n):"";if(r)switch(r){case Rn:return P;case Dn:return k;case Pn:return O;case jn:return M;case Ln:return R}return e});var To=Dt?Zs:_u;function ko(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Rt)}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:Tr(t,ii(e,0,-1))}function Mo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Io=Po(ei),No=pe||function(t,e){return me.setTimeout(t,e)},Ro=Po(ni);function Do(t,e,n){var r=e+"";return Ro(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]&&!Re(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 jo(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=Yr(function(t,e){return Hs(t)?dr(t,yr(e,1,Hs,!0)):[]}),Uo=Yr(function(t,e){var n=Yo(e);return Hs(n)&&(n=i),Hs(t)?dr(t,yr(e,1,Hs,!0),co(n,2)):[]}),Vo=Yr(function(t,e){var n=Yo(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=Yr(function(t){var e=Pe(t,yi);return e.length&&e[0]===t[0]?Mr(e):[]}),Xo=Yr(function(t){var e=Yo(t),n=Pe(t,yi);return e===Yo(n)?e=i:n.pop(),n.length&&n[0]===t[0]?Mr(n,co(e,2)):[]}),Ko=Yr(function(t){var e=Yo(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 Yo(t){var e=null==t?0:t.length;return e?t[e-1]:i}var Zo=Yr(Qo);function Qo(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:Tn.call(t)}var ns=Yr(function(t){return hi(yr(t,1,Hs,!0))}),rs=Yr(function(t){var e=Yo(t);return Hs(e)&&(e=i),hi(yr(t,1,Hs,!0),co(e,2))}),is=Yr(function(t){var e=Yo(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=Ne(t,function(t){if(Hs(t))return e=vn(t.length,e),!0}),Ye(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=Yr(function(t,e){return Hs(t)?dr(t,e):[]}),us=Yr(function(t){return gi(Ne(t,Hs))}),cs=Yr(function(t){var e=Yo(t);return Hs(e)&&(e=i),gi(Ne(t,Hs),co(e,2))}),ls=Yr(function(t){var e=Yo(t);return e="function"==typeof e?e:i,gi(Ne(t,Hs),i,e)}),hs=Yr(os);var ds=Yr(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=Ni(function(t,e,n){jt.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=Ni(function(t,e,n){jt.call(t,n)?t[n].push(e):sr(t,n,[e])});var xs=Yr(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):Ir(t,e,n)}),s}),Ss=Ni(function(t,e,n){sr(t,n,e)});function Ts(t,e){return(zs(t)?Pe:Br)(t,co(e,3))}var ks=Ni(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});var As=Yr(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=Yr(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)}),Is=Yr(function(t,e,n){var r=3;if(n.length){var i=hn(n,uo(Is));r|=c}return Zi(e,r,t,n,i)});function Ns(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=No(_,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=No(_,e),d?m(t):u}(l);if(p)return Si(c),c=No(_,e),m(l)}return c===i&&(c=No(_,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&&Si(c),h=0,r=l=s=c=i},v.flush=function(){return c===i?u:y(Es())},v}var Rs=Yr(function(t,e){return hr(t,1,e)}),Ds=Yr(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 js(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],Qe(co())):Pe(yr(e,1),Qe(co()))).length;return Yr(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=Yr(function(t,e){var n=hn(e,uo(Fs));return Zi(t,c,i,e,n)}),$s=Yr(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=Nr(function(){return arguments}())?Nr:function(t){return na(t)&&jt.call(t,"callee")&&!Xt.call(t,"callee")},zs=r.isArray,Ws=we?Qe(we):function(t){return na(t)&&Ar(t)==D};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?Qe(xe):function(t){return na(t)&&Ar(t)==w};function Ys(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==S||e==T||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Qs(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=Se?Qe(Se):function(t){return na(t)&&go(t)==k};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=jt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Pt.call(n)==Bt}var sa=Te?Qe(Te):function(t){return na(t)&&Ar(t)==C};var aa=ke?Qe(ke):function(t){return na(t)&&go(t)==M};function ua(t){return"string"==typeof t||!zs(t)&&na(t)&&Ar(t)==I}function ca(t){return"symbol"==typeof t||na(t)&&Ar(t)==N}var la=Ae?Qe(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==k?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 Ii(t,Ra(t))}function va(t){return null==t?"":li(t)}var ba=Ri(function(t,e){if(ko(e)||Js(e))Ii(e,Na(e),t);else for(var n in e)jt.call(e,n)&&nr(t,n,e[n])}),wa=Ri(function(t,e){Ii(e,Ra(e),t)}),xa=Ri(function(t,e,n,r){Ii(e,Ra(e),t,r)}),Sa=Ri(function(t,e,n,r){Ii(e,Na(e),t,r)}),Ta=ro(ar);var ka=Yr(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=Ra(s),u=-1,c=a.length;++u<c;){var l=a[u],h=t[l];(h===i||qs(h,Rt[l])&&!jt.call(t,l))&&(t[l]=s[l])}return t}),Aa=Yr(function(t){return t.push(i,to),Ee(Pa,i,t)});function Ea(t,e,n){var r=null==t?i:Tr(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)),jt.call(t,e)?t[e].push(n):t[e]=[n]},co),Ia=Yr(Ir);function Na(t){return Js(t)?Yn(t):Lr(t)}function Ra(t){return Js(t)?Yn(t,!0):Fr(t)}var Da=Ri(function(t,e,n){Vr(t,e,n)}),Pa=Ri(function(t,e,n,r){Vr(t,e,n,r)}),ja=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}),Ii(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=Yi(Na),Ba=Yi(Ra);function qa(t){return null==t?[]:tn(t,Na(t))}var Ua=Li(function(t,e,n){return e=e.toLowerCase(),t+(n?Va(e):e)});function Va(t){return Ya(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=ji("toLowerCase");var Ha=Li(function(t,e,n){return t+(n?"_":"")+e.toLowerCase()});var Xa=Li(function(t,e,n){return t+(n?" ":"")+Ya(e)});var Ka=Li(function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}),Ya=ji("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 Qa=Yr(function(t,e){try{return Ee(t,i,e)}catch(t){return Ys(t)?t:new Tt(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 jr("function"==typeof t?t:cr(t,1))}var su=Yr(function(t,e){return function(n){return Ir(n,t,e)}}),au=Yr(function(t,e){return function(n){return Ir(t,n,e)}});function uu(t,e,n){var r=Na(e),i=Sr(e,r);null!=n||ea(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=Sr(e,Na(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,je([this.value()],arguments))})}),t}function cu(){}var lu=Gi(Pe),hu=Gi(Ie),du=Gi($e);function pu(t){return xo(t)?Je(Fo(t)):function(t){return function(e){return Tr(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,Su=Vi(function(t,e){return t*e},1),Tu=Xi("round"),ku=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=Sa,qn.at=Ta,qn.before=Cs,qn.bind=Ms,qn.bindAll=tu,qn.bindKey=Is,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 je(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]]}):[],Yr(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=Na(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=Ns,qn.defaults=ka,qn.defaultsDeep=Aa,qn.defer=Rs,qn.delay=Ds,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)?Ne:_r)(t,co(e,3))},qn.flatMap=function(t,e){return yr(Ts(t,e),1)},qn.flatMapDeep=function(t,e){return yr(Ts(t,e),p)},qn.flatMapDepth=function(t,e,n){return n=n===i?1:ma(n),yr(Ts(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?[]:Sr(t,Na(t))},qn.functionsIn=function(t){return null==t?[]:Sr(t,Ra(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=Ss,qn.keys=Na,qn.keysIn=Ra,qn.map=Ts,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=Da,qn.mergeWith=Pa,qn.method=su,qn.methodOf=au,qn.mixin=uu,qn.negate=js,qn.nthArg=function(t){return t=ma(t),Yr(function(e){return Gr(e,t)})},qn.omit=ja,qn.omitBy=function(t,e){return Fa(t,js(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=ks,qn.pick=La,qn.pickBy=Fa,qn.property=pu,qn.propertyOf=function(t){return function(e){return null==t?i:Tr(t,e)}},qn.pull=Zo,qn.pullAll=Qo,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)?Ne:_r)(t,js(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 Yr(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)?Qn:Qr)(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),Yr(function(n){var r=n[e],i=xi(n,0,e);return r&&je(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),Ns(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,Ra(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=Qa,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,Na(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))&&Y.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)?Ie: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),Ra)},qn.forInRight=function(t,e){return null==t?t:br(t,co(e,3),Ra)},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=Ia,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==k||e==M)return!t.size;if(ko(t))return!Lr(t).length;for(var n in t)if(jt.call(t,n))return!1;return!0},qn.isEqual=function(t,e){return Rr(t,e)},qn.isEqualWith=function(t,e,n){var r=(n="function"==typeof n?n:i)?n(t,e):i;return r===i?Rr(t,e,i,n):!!r},qn.isError=Ys,qn.isFinite=function(t){return"number"==typeof t&&be(t)},qn.isFunction=Zs,qn.isInteger=Qs,qn.isLength=ta,qn.isMap=ra,qn.isMatch=function(t,e){return t===e||Dr(t,e,ho(e))},qn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:i,Dr(t,e,ho(e),n)},qn.isNaN=function(t){return ia(t)&&t!=+t},qn.isNative=function(t){if(To(t))throw new Tt("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 Qs(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)==R},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=Yo,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=Su,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=Sn();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=Tu,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==k||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=ku,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,Qi);var o,s,a=xa({},e.imports,r.imports,Qi),u=Na(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="+(jt.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(St,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=jt.call(e,"variable")&&e.variable;if(m){if(dt.test(m))throw new Tt("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=Qa(function(){return kt(u,f+"return "+d).apply(i,c)});if(g.source=d,Ys(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=Ye(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=Ya,qn.each=vs,qn.eachRight=bs,qn.first=Jo,uu(qn,(xu={},wr(qn,function(t,e){jt.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=Yr(function(t,e){return"function"==typeof t?new zn(this):this.map(function(n){return Ir(n,t,e)})}),zn.prototype.reject=function(t){return this.filter(js(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,je([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=It[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+"";jt.call(Nn,r)||(Nn[r]=[]),Nn[r].push({name:e,func:n})}}),Nn[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:()=>ga,hasStandardBrowserEnv:()=>ya,hasStandardBrowserWebWorkerEnv:()=>va,navigator:()=>_a,origin:()=>ba});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{S(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)S(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 S(t){m(t)?t():t.unsubscribe()}var T={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},k={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=k.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=k.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function A(t){k.setTimeout(function(){var e=T.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 I(t){if(T.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 N=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 j(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),R=Function.prototype.bind;function D(t,e){return R.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}(),j=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&&T.useDeprecatedNextContext?((o=Object.create(e)).unsubscribe=function(){return s.unsubscribe()},i={next:e.next&&D(e.next,o),error:e.error&&D(e.error,o),complete:e.complete&&D(e.complete,o)}):i=e;return s.destination=new P(i),s}return o(e,t),e}(N);function L(t){var e;T.useDeprecatedSynchronousErrorHandling?(e=t,T.useDeprecatedSynchronousErrorHandling&&M&&(M.errorThrown=!0,M.error=e)):A(t)}function F(t,e){var n=T.onStoppedNotification;n&&k.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}(N),U=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function V(t){return m(null==t?void 0:t.then)}var G="function"==typeof Symbol&&Symbol.observable||"@@observable";function z(t){return t}function W(t){return 0===t.length?z:1===t.length?t[0]:function(e){return t.reduce(function(t,e){return e(t)},e)}}var J=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 N||function(t){return t&&m(t.next)&&m(t.error)&&m(t.complete)}(r)&&x(r)?t:new j(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=H(e))(function(e,r){var i=new j({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[G]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return W(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=H(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 H(t){var e;return null!==(e=null!=t?t:T.Promise)&&void 0!==e?e:Promise}function X(t){return m(t[G])}function K(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 Z="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Q(t){return m(null==t?void 0:t[Z])}function tt(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 et(t){return m(null==t?void 0:t.getReader)}function nt(t){if(t instanceof J)return t;if(null!=t){if(X(t))return i=t,new J(function(t){var e=i[G]();if(m(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(U(t))return r=t,new J(function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()});if(V(t))return n=t,new J(function(t){n.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,A)});if(K(t))return rt(t);if(Q(t))return e=t,new J(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(et(t))return rt(tt(t))}var e,n,r,i;throw Y(t)}function rt(t){return new J(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 it(t){return t[t.length-1]}function ot(t){return m(it(t))?t.pop():void 0}function st(t){return(e=it(t))&&m(e.schedule)?t.pop():void 0;var e}function at(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=ot(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){nt(t[e]).subscribe(B(r,function(t){o[e]=t,a||s[e]||(s[e]=!0,(a=s.every(z))&&(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 ut(t,e){return g(function(n,r){var i=0;n.subscribe(B(r,function(n){r.next(t.call(e,n,i++))}))})}function ct(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++;nt(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 lt(t){return g(function(e,n){nt(t).subscribe(B(n,function(){return n.complete()},E)),!n.closed&&e.subscribe(n)})}var ht=_(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),dt=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 ht},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?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 J;return t.source=this,t},e.create=function(t,e){return new pt(t,e)},e}(J),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}(dt);function ft(t){void 0===t&&(t={});var e=t.connector,n=void 0===e?function(){return new dt}: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=mt(p,u))}),m.subscribe(f),!e&&a>0&&(e=new j({next:function(t){return m.next(t)},error:function(t){l=!0,h(),r=mt(d,i,t),m.error(t)},complete:function(){c=!0,h(),r=mt(d,s),m.complete()}}),nt(t).subscribe(e))})(t)}}function mt(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 j({next:function(){i.unsubscribe(),t()}});return nt(e.apply(void 0,h([],l(n)))).subscribe(i)}}else t()}function gt(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)}))})}var _t=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}(dt);function yt(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 vt(t,e,n){return void 0===n&&(n=1/0),m(e)?vt(function(n,r){return ut(function(t,i){return e(n,t,r,i)})(nt(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;nt(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?yt(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 bt(t){return void 0===t&&(t=1/0),vt(z,t)}var wt=new J(function(t){return t.complete()});function xt(t,e){return void 0===e&&(e=0),g(function(n,r){n.subscribe(B(r,function(n){return yt(r,t,function(){return r.next(n)},e)},function(){return yt(r,t,function(){return r.complete()},e)},function(n){return yt(r,t,function(){return r.error(n)},e)}))})}function St(t,e){return void 0===e&&(e=0),g(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function Tt(t,e){if(!t)throw new Error("Iterable cannot be null");return new J(function(n){yt(n,e,function(){var r=t[Symbol.asyncIterator]();yt(n,e,function(){r.next().then(function(t){t.done?n.complete():n.next(t.value)})},0,!0)})})}function kt(t,e){if(null!=t){if(X(t))return function(t,e){return nt(t).pipe(St(e),xt(e))}(t,e);if(U(t))return function(t,e){return new J(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(V(t))return function(t,e){return nt(t).pipe(St(e),xt(e))}(t,e);if(K(t))return Tt(t,e);if(Q(t))return function(t,e){return new J(function(n){var r;return yt(n,e,function(){r=t[Z](),yt(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(et(t))return function(t,e){return Tt(tt(t),e)}(t,e)}throw Y(t)}function At(t,e){return e?kt(t,e):nt(t)}function Et(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=st(t),r=function(t,e){return"number"==typeof it(t)?t.pop():e}(t,1/0),i=t;return i.length?1===i.length?nt(i[0]):bt(r)(At(i,n)):wt}const Ot="https://gdb.leafgon.com/sgraphql",Ct="wss://gdb.leafgon.com/sgraphql",Mt="https://gdb.leafgon.com/qmgraphql",It={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:It.breezyforest.scaffold.directory[e])}catch{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:Ot,dburi_subs_ws:Ct,dburi_qm:Mt},clientconfig_sub:{keepGQLConnected:!0,dburi_subs:Ot,dburi_subs_ws:Ct},clientconfig_qm:{dburi_qm:Mt},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:ut}}},Nt=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},Rt={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"},Dt={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"]},Pt={leaflambdaedge:{sourceHandle:"out_aux",targetHandle:"in_aux"},leafanchoredge:{sourceHandle:"out_anchor",targetHandle:"in_anchor"},leafdataedge:{sourceHandle:"out_a",targetHandle:"in_a"}},jt={leaflambdaedge:{stroke:"#fff",fillOpacity:0},leafanchoredge:{stroke:"#88f",fillOpacity:0},leafdataedge:{stroke:"#fff",fillOpacity:0}};var Lt=n(7007);let Ft=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 $t(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 Bt(t){return"object"==typeof t&&null!==t}function qt(t){let e;for(e in t)return!1;return!0}function Ut(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function Vt(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 Gt(t){return!!Bt(t)&&!(t.attributes&&!Array.isArray(t.attributes))}function zt(){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 Wt(){return{[Symbol.iterator](){return this},next:()=>({done:!0})}}"function"==typeof Object.assign&&(Ft=Object.assign);class Jt extends Error{constructor(t){super(),this.name="GraphError",this.message=t}}class Ht extends Jt{constructor(t){super(t),this.name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,Ht.prototype.constructor)}}class Xt extends Jt{constructor(t){super(t),this.name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,Xt.prototype.constructor)}}class Kt extends Jt{constructor(t){super(t),this.name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,Kt.prototype.constructor)}}function Yt(t,e){this.key=t,this.attributes=e,this.clear()}function Zt(t,e){this.key=t,this.attributes=e,this.clear()}function Qt(t,e){this.key=t,this.attributes=e,this.clear()}function te(t,e,n,r,i){this.key=e,this.attributes=i,this.undirected=t,this.source=n,this.target=r}Yt.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},Zt.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},Qt.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},te.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)},te.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},te.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]},te.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 ee(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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 ne=[{name:t=>`get${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=ee(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]=ee(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]=ee(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]=ee(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]=ee(this,e,n,t,r,i,o);if("function"!=typeof u)throw new Ht(`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]=ee(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]=ee(this,e,n,t,r,i);if(!Bt(s))throw new Ht(`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]=ee(this,e,n,t,r,i);if(!Bt(s))throw new Ht(`Graph.${e}: provided attributes are not a plain object.`);return Ft(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]=ee(this,e,n,t,r,i);if("function"!=typeof s)throw new Ht(`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 re=[{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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Kt(`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=$t(this,o,s,n),!i)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new Kt(`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=$t(this,i,o,n),!r)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${i}" - "${o}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Kt(`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=$t(this,o,s,n),!i)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Kt(`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=$t(this,s,a,n),!o)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Kt(`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=$t(this,s,a,n),!o)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if("function"!=typeof i)throw new Ht(`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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Kt(`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=$t(this,o,s,n),!i)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Kt(`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=$t(this,o,s,n),!i)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if(!Bt(r))throw new Ht(`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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Kt(`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=$t(this,o,s,n),!i)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if(!Bt(r))throw new Ht(`Graph.${e}: provided attributes are not a plain object.`);return Ft(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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Kt(`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=$t(this,o,s,n),!i)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if("function"!=typeof r)throw new Ht(`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 ie=[{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 oe(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 se(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 ae(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 ue(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 ce(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 le(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 he(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 de(t,e,n,r,i,o){const s=e?se:oe;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 pe(t,e,n,r,i,o,s){const a=n?ce:ue;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 fe(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 Xt(`Graph.${n}: could not find the "${t}" node in the graph.`);return function(t,e,n,r){const i=[];return de(!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 Xt(`Graph.${n}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new Xt(`Graph.${n}: could not find the "${e}" target node in the graph.`);return function(t,e,n,r,i){const o=[];return pe(!1,t,e,n,r,i,function(t){o.push(t)}),o}(r,this.multi,i,o,e)}throw new Ht(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function me(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 Wt();if(!arguments.length)return function(t,e){if(0===t.size)return Wt();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 Xt(`Graph.${o}: could not find the "${t}" node in the graph.`);return function(t,e,n){let r=Wt();return"undirected"!==t&&("out"!==e&&void 0!==n.in&&(r=zt(r,ae(n.in))),"in"!==e&&void 0!==n.out&&(r=zt(r,ae(n.out,e?void 0:n.key)))),"directed"!==t&&void 0!==n.undirected&&(r=zt(r,ae(n.undirected))),r}(r,i,e)}if(2===arguments.length){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new Xt(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new Xt(`Graph.${o}: could not find the "${e}" target node in the graph.`);return function(t,e,n,r){let i=Wt();return"undirected"!==t&&(void 0!==n.in&&"out"!==e&&r in n.in&&(i=zt(i,le(n.in,r))),void 0!==n.out&&"in"!==e&&r in n.out&&(e||n.key!==r)&&(i=zt(i,le(n.out,r)))),"directed"!==t&&void 0!==n.undirected&&r in n.undirected&&(i=zt(i,le(n.undirected,r))),i}(r,i,n,e)}throw new Ht(`Graph.${o}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}const ge=[{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 _e(){this.A=null,this.B=null}function ye(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 ve(t,e,n,r,i){if("mixed"!==e){if("undirected"===e)return ye(t,null,r,r.undirected,i);if("string"==typeof n)return ye(t,null,r,r[n],i)}const o=new _e;let s;if("undirected"!==e){if("out"!==n){if(s=ye(t,null,r,r.in,i),t&&s)return s;o.wrap(r.in)}if("in"!==n){if(s=ye(t,o,r,r.out,i),t&&s)return s;o.wrap(r.out)}}if("directed"!==e&&(s=ye(t,o,r,r.undirected,i),t&&s))return s}function be(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 we(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 Xt(`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 ve(!1,t,e,n,function(t){r.push(t)}),r}("mixed"===r?this.type:r,i,e)}}function xe(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 Wt();t=""+t;const e=this._nodes.get(t);if(void 0===e)throw new Xt(`Graph.${o}: could not find the "${t}" node in the graph.`);return function(t,e,n){if("mixed"!==t){if("undirected"===t)return be(null,n,n.undirected);if("string"==typeof e)return be(null,n,n[e])}let r=Wt();const i=new _e;return"undirected"!==t&&("out"!==e&&(r=zt(r,be(i,n,n.in))),"in"!==e&&(r=zt(r,be(i,n,n.out)))),"directed"!==t&&(r=zt(r,be(i,n,n.undirected))),r}("mixed"===r?this.type:r,i,e)}}function Se(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 Te(t){if(!Bt(t))throw new Ht('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 Ht("Graph.import: serialized node is missing its key.");if("attributes"in t&&(!Bt(t.attributes)||null===t.attributes))throw new Ht("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function ke(t){if(!Bt(t))throw new Ht('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 Ht("Graph.import: serialized edge is missing its source.");if(!("target"in t))throw new Ht("Graph.import: serialized edge is missing its target.");if("attributes"in t&&(!Bt(t.attributes)||null===t.attributes))throw new Ht("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in t&&"boolean"!=typeof t.undirected)throw new Ht("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}_e.prototype.wrap=function(t){null===this.A?this.A=t:null===this.B&&(this.B=t)},_e.prototype.has=function(t){return null!==this.A&&t in this.A||null!==this.B&&t in this.B};const Ae=function(){let t=255&Math.floor(256*Math.random());return()=>t++}(),Ee=new Set(["directed","undirected","mixed"]),Oe=new Set(["domain","_events","_eventsCount","_maxListeners"]),Ce={allowSelfLoops:!0,multi:!1,type:"mixed"};function Me(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 Ie(t,e,n,r,i,o,s,a){if(!r&&"undirected"===t.type)throw new Kt(`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 Kt(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(a&&!Bt(a))throw new Ht(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`);if(o=""+o,s=""+s,a=a||{},!t.allowSelfLoops&&o===s)throw new Kt(`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 Xt(`Graph.${e}: source node "${o}" not found.`);if(!c)throw new Xt(`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 Kt(`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 Kt(`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 te(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 Ne(t,e,n,r,i,o,s,a,u){if(!r&&"undirected"===t.type)throw new Kt(`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 Kt(`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 Ht(`Graph.${e}: invalid updater function. Expecting a function but got "${a}"`)}else if(!Bt(a))throw new Ht(`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 Kt(`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 Kt(`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 Ft(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 Kt(`Graph.${e}: the "${i}" edge already exists in the graph.`);let m=!1,g=!1;d||(d=Me(t,o,{}),m=!0,o===s&&(p=d,g=!0)),p||(p=Me(t,s,{}),g=!0),l=new te(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 Re(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 De extends Lt.EventEmitter{constructor(t){if(super(),"boolean"!=typeof(t=Ft({},Ce,t)).multi)throw new Ht(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${t.multi}".`);if(!Ee.has(t.type))throw new Ht(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${t.type}".`);if("boolean"!=typeof t.allowSelfLoops)throw new Ht(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${t.allowSelfLoops}".`);Ut(this,"NodeDataClass","mixed"===t.type?Yt:"directed"===t.type?Zt:Qt);const e="geid_"+Ae()+"_";let n=0;Ut(this,"_attributes",{}),Ut(this,"_nodes",new Map),Ut(this,"_edges",new Map),Ut(this,"_directedSize",0),Ut(this,"_undirectedSize",0),Ut(this,"_directedSelfLoopCount",0),Ut(this,"_undirectedSelfLoopCount",0),Ut(this,"_edgeKeyGenerator",()=>{let t;do{t=e+n++}while(this._edges.has(t));return t}),Ut(this,"_options",t),Oe.forEach(t=>Ut(this,t,this[t])),Vt(this,"order",()=>this._nodes.size),Vt(this,"size",()=>this._edges.size),Vt(this,"directedSize",()=>this._directedSize),Vt(this,"undirectedSize",()=>this._undirectedSize),Vt(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),Vt(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),Vt(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),Vt(this,"multi",this._options.multi),Vt(this,"type",this._options.type),Vt(this,"allowSelfLoops",this._options.allowSelfLoops),Vt(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 Ht(`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 Ht(`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 Ht(`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 Kt("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 Xt(`Graph.directedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new Xt(`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 Kt("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 Xt(`Graph.undirectedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new Xt(`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 Kt("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 Xt(`Graph.edge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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&&!Bt(n))throw new Ht(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(e=""+e,n=n||{},t._nodes.has(e))throw new Kt(`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&&!Bt(e))throw new Ht(`Graph.mergeNode: invalid attributes. Expecting an object but got "${e}"`);t=""+t,e=e||{};let n=this._nodes.get(t);return n?(e&&(Ft(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 Ht(`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 Xt(`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{Re(this,n),n=n.next}while(n)}for(const t in e.in){n=e.in[t];do{Re(this,n),n=n.next}while(n)}}if("directed"!==this.type)for(const t in e.undirected){n=e.undirected[t];do{Re(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=$t(this,t,n,this.type),!e)throw new Xt(`Graph.dropEdge: could not find the "${t}" -> "${n}" edge in the graph.`)}else if(t=""+t,e=this._edges.get(t),!e)throw new Xt(`Graph.dropEdge: could not find the "${t}" edge in the graph.`);return Re(this,e),this}dropDirectedEdge(t,e){if(arguments.length<2)throw new Kt("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 Kt("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=$t(this,t=""+t,e=""+e,"directed");if(!n)throw new Xt(`Graph.dropDirectedEdge: could not find a "${t}" -> "${e}" edge in the graph.`);return Re(this,n),this}dropUndirectedEdge(t,e){if(arguments.length<2)throw new Kt("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 Kt("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=$t(this,t,e,"undirected");if(!n)throw new Xt(`Graph.dropUndirectedEdge: could not find a "${t}" -> "${e}" edge in the graph.`);return Re(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 Ht("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(!Bt(t))throw new Ht("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(!Bt(t))throw new Ht("Graph.mergeAttributes: provided attributes are not a plain object.");return Ft(this._attributes,t),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:t}),this}updateAttributes(t){if("function"!=typeof t)throw new Ht("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 Ht("Graph.updateEachNodeAttributes: expecting an updater function.");if(e&&!Gt(e))throw new Ht("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 Ht("Graph.updateEachEdgeAttributes: expecting an updater function.");if(e&&!Gt(e))throw new Ht("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 Ht("Graph.forEachAdjacencyEntry: expecting a callback.");Se(!1,!1,!1,this,t)}forEachAdjacencyEntryWithOrphans(t){if("function"!=typeof t)throw new Ht("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");Se(!1,!1,!0,this,t)}forEachAssymetricAdjacencyEntry(t){if("function"!=typeof t)throw new Ht("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");Se(!1,!0,!1,this,t)}forEachAssymetricAdjacencyEntryWithOrphans(t){if("function"!=typeof t)throw new Ht("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");Se(!1,!0,!0,this,t)}nodes(){return Array.from(this._nodes.keys())}forEachNode(t){if("function"!=typeof t)throw new Ht("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 Ht("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 Ht("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 Ht("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 Ht("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 Ht("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 Ht("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new Ht("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 qt(e.attributes)||(n.attributes=Ft({},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 qt(n.attributes)||(r.attributes=Ft({},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 De)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(!Bt(t))throw new Ht("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!Bt(t.attributes))throw new Ht("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 Ht("Graph.import: invalid nodes. Expecting an array.");for(n=0,r=i.length;n<r;n++){o=i[n],Te(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 Ht("Graph.import: invalid edges. Expecting an array.");for(n=0,r=i.length;n<r;n++){s=i[n],ke(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 De(Ft({},this._options,t));return e.replaceAttributes(Ft({},this.getAttributes())),e}emptyCopy(t){const e=this.nullCopy(t);return this._nodes.forEach((t,n)=>{const r=Ft({},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 Kt(`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 Kt("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 Kt("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,Ie(e,"copy",!1,i.undirected,i.key,i.source.key,i.target.key,Ft({},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)&&!Oe.has(t)&&"function"!=typeof this[t]&&"symbol"!=typeof t&&(r[t]=this[t]);return r.attributes=this._attributes,r.nodes=t,r.edges=e,Ut(r,"constructor",this.constructor),r}}"undefined"!=typeof Symbol&&(De.prototype[Symbol.for("nodejs.util.inspect.custom")]=De.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?Ie:Ne;t.generateKey?De.prototype[n]=function(i,o,s){return r(this,n,!0,"undirected"===(t.type||this.type),null,i,o,s,"update"===e)}:De.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){ne.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)})}(De),function(t){re.forEach(function({name:e,attacher:n}){n(t,e("Edge"),"mixed"),n(t,e("DirectedEdge"),"directed"),n(t,e("UndirectedEdge"),"undirected")})}(De),function(t){ie.forEach(e=>{fe(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 he(!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 Xt(`Graph.${o}: could not find the "${t}" node in the graph.`);return de(!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 Xt(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new Xt(`Graph.${o}: could not find the "${e}" target node in the graph.`);return pe(!1,r,this.multi,i,s,e,n)}throw new Ht(`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 Ht(`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 Ht(`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 he(!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 Xt(`Graph.${o}: could not find the "${t}" node in the graph.`);return de(!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 Xt(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new Xt(`Graph.${o}: could not find the "${e}" target node in the graph.`);return pe(!0,r,this.multi,i,s,e,n)}throw new Ht(`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),me(t,e)})}(De),function(t){ge.forEach(e=>{we(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 Xt(`Graph.${o}: could not find the "${t}" node in the graph.`);ve(!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 Ht(`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 Xt(`Graph.${s}: could not find the "${t}" node in the graph.`);return ve(!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),xe(t,e)})}(De);class Pe extends De{constructor(t){const e=Ft({type:"directed"},t);if("multi"in e&&!1!==e.multi)throw new Ht("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==e.type)throw new Ht('DirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class je extends De{constructor(t){const e=Ft({type:"undirected"},t);if("multi"in e&&!1!==e.multi)throw new Ht("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==e.type)throw new Ht('UndirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class Le extends De{constructor(t){const e=Ft({multi:!0},t);if("multi"in e&&!0!==e.multi)throw new Ht("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(e)}}class Fe extends De{constructor(t){const e=Ft({type:"directed",multi:!0},t);if("multi"in e&&!0!==e.multi)throw new Ht("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==e.type)throw new Ht('MultiDirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class $e extends De{constructor(t){const e=Ft({type:"undirected",multi:!0},t);if("multi"in e&&!0!==e.multi)throw new Ht("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==e.type)throw new Ht('MultiUndirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}function Be(t){t.from=function(e,n){const r=Ft({},e.options,n),i=new t(r);return i.import(e),i}}Be(De),Be(Pe),Be(je),Be(Le),Be(Fe),Be($e),De.Graph=De,De.DirectedGraph=Pe,De.UndirectedGraph=je,De.MultiGraph=Le,De.MultiDirectedGraph=Fe,De.MultiUndirectedGraph=$e,De.InvalidArgumentsGraphError=Ht,De.NotFoundGraphError=Xt,De.UsageGraphError=Kt;class qe{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 Ue=t=>"object"==typeof t&&!Array.isArray(t)&&null!==t&&"_bname"in t,Ve=t=>"object"==typeof t&&!Array.isArray(t)&&null!==t&&"_crate"in t,Ge=t=>Ue(t)&&("empty_bottle"===t._bname&&"empty_data"===t._content||void 0===t._content);var ze=n(8287),We=_(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function Je(t,e){var n="object"==typeof e;return new Promise(function(r,i){var o=new j({next:function(t){r(t),o.unsubscribe()},error:i,complete:function(){n?r(e.defaultValue):i(new We)}});t.subscribe(o)})}function He(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return At(t,st(t))}function Xe(t,e){return m(e)?vt(t,e,1):vt(t,1)}var Ke=Array.isArray,Ye=Object.getPrototypeOf,Ze=Object.prototype,Qe=Object.keys;function tn(t){if(1===t.length){var e=t[0];if(Ke(e))return{args:e,keys:null};if((r=e)&&"object"==typeof r&&Ye(r)===Ze){var n=Qe(e);return{args:n.map(function(t){return e[t]}),keys:n}}}var r;return{args:t,keys:null}}var en=Array.isArray;function nn(t){return ut(function(e){return function(t,e){return en(e)?t.apply(void 0,h([],l(e))):t(e)}(t,e)})}function rn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=st(t),r=ot(t),i=tn(t),o=i.args,s=i.keys;if(0===o.length)return At([],n);var a=new J(function(t,e,n){void 0===n&&(n=z);return function(r){on(e,function(){for(var i=t.length,o=new Array(i),s=i,a=i,u=function(i){on(e,function(){var u=At(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)}}(o,n,s?function(t){return function(t,e){return t.reduce(function(t,n,r){return t[n]=e[r],t},{})}(s,t)}:z));return r?a.pipe(nn(r)):a}function on(t,e,n){t?yt(n,t,e):e()}var sn=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),an={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=an.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=an.delegate;return((null==e?void 0:e.clearInterval)||clearInterval)(t)},delegate:void 0},un=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),an.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&&an.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}(sn),cn={now:function(){return(cn.delegate||Date).now()},delegate:void 0},ln=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=cn.now,t}(),hn=function(t){function e(e,n){void 0===n&&(n=ln.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}(ln),dn=new hn(un);function pn(t){for(var e,n,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var o=null!==(e=st(r))&&void 0!==e?e:dn,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),yt(e,o,function(){return u(i)},t)}};null!==s&&s>=0?yt(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)})}const fn=200,mn=t=>Array.isArray(t)?t.flatMap(t=>t):t,gn=(t,e,n=!1,r=!1,i=!1,o={})=>{const s=e.filter(t=>t);if(s.length>1){const o={_stream:He("ctrl_nudge").pipe(Xe(r=>rn(e.map(t=>t._stream)).pipe(ut(e=>{t?.slice(0,4);const r=i?(({_bus:t,_cond:e=t=>!0,_flatten:n=!1}={})=>n?Array.isArray(t)?t.map(t=>Ue(t)&&"_databus"===t._bname&&e(t)?t._content:t).flat().filter(t=>t):Ue(t)&&"_databus"===t._bname&&e(t)?t._content:t:Array.isArray(t)?t.map(t=>Ue(t)&&"_databus"===t._bname&&e(t)?t._content:t).filter(t=>t):Ue(t)&&"_databus"===t._bname&&e(t)?t._content:t)({_bus:e,_flatten:n}):e,o=!i&&n&&Array.isArray(r)?r.filter(t=>t).flat():r;return o}))))};return r&&(o._control={_stream:He("ctrl_nudge").pipe(Xe(t=>rn(e.map(t=>t?._control?._stream).filter(t=>t)).pipe(ut(t=>Array.isArray(t)?t.flat():t))))}),o}return s.length>0?{...s[0],_stream:s[0]._stream.pipe(ut(e=>(t?.slice(0,4),e)))}:void 0},_n=(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(Ue(t))return{...t,_content:i(t._content,e)};if(Ve(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:vn(r)._stream.pipe(pn(fn,100,100),ut(t=>t),ut(t=>mn(t)),at(...n.map(t=>t._stream.pipe(pn(fn,100,100),ut(t=>mn(t))))),ut(t=>t)).pipe(ut(t=>{const e=mn(t[0]),n=mn(t.slice(1)).filter(t=>!Array.isArray(t)&&"object"==typeof t),r=Object.assign({},...n);return i(e,r)}))}},yn=t=>{const e=t.filter(t=>t);if(e.length>1){return{_stream:e.map(t=>t._stream).pipe(bt(1))}}if(e.length>0)return e[0]},vn=t=>{const e=t.filter(t=>t);if(e.length>1){return{_stream:Et(...e.map(t=>t._stream.pipe(ut(t=>t))))}}if(e.length>0)return e[0]};var bn=n(2543);const wn={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)=>k_(e,t,void 0,{...o,metastep:"leaf inflow"},{leaflogic:(t,e)=>{const n=new dt,r=e._stream.pipe(at(...t.map(t=>t._stream)),ut(t=>(n.next(t[1]),t[0])),ft());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{pre:t=>t}})},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(e,n)=>({...gn(t,e),_control:n})},xn={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)=>k_(e,t,void 0,{...o,metastep:"leaf outflow"},{leaflogic:(t,e)=>{const n=new dt,r=e._stream.pipe(ut(t=>t),at(...t.map(t=>t._stream)),ut(t=>(n.next(t[1]),t[0])),ft());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{pre:t=>t}})},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...vn(t),_control:e})},Sn=(t,e,n={})=>({_bname:t,_content:e,_label:n}),Tn=(t,e,n={})=>Ue(e)&&(void 0===t||(t.includes(e._bname)||"*"===t))?e._content:void 0,kn=Sn("empty_bottle","empty_data"),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 Qg({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)=>k_(n,e,void 0,{...s,metastep:"invoking screenio"},{leaflogic:(t,e)=>{const n=new dt,r=e._stream.pipe(at(...t.map(t=>t._stream)),ct(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),He(t[0])}),ft());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{post:e=>{const n=(Array.isArray(e)?e:[e]).map(t=>Tn("screenio",t)).filter(t=>t);void 0!==n&&t.gos.leafio.getMasterSubsDir()[o].main.doWrite({control:{},data:n});return Sn("screenio","written")}}})},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...vn(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 In(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]=In(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=In(i,5)+Mn(n,o,a,u)+c+e[n]+r[t]>>>0;c=u,u=a,a=In(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])},Rn=/^(?:[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 Dn=function(t){return"string"==typeof t&&Rn.test(t)};const Pn=function(t){if(!Dn(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 jn=[];for(let t=0;t<256;++t)jn.push((t+256).toString(16).slice(1));function Ln(t,e=0){return(jn[t[e+0]]+jn[t[e+1]]+jn[t[e+2]]+jn[t[e+3]]+"-"+jn[t[e+4]]+jn[t[e+5]]+"-"+jn[t[e+6]]+jn[t[e+7]]+"-"+jn[t[e+8]]+jn[t[e+9]]+"-"+jn[t[e+10]]+jn[t[e+11]]+jn[t[e+12]]+jn[t[e+13]]+jn[t[e+14]]+jn[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,Nn,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=[];s.length=80;var a,u,c,l,h,d,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=[];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++)s[i]=v[r+i];for(i=16;i<=79;i++)s[i]=e(s[i-3]^s[i-8]^s[i-14]^s[i-16],1);for(a=p,u=f,c=m,l=g,h=_,i=0;i<=19;i++)d=e(a,5)+(u&c|~u&l)+h+s[i]+1518500249&4294967295,h=l,l=c,c=e(u,30),u=a,a=d;for(i=20;i<=39;i++)d=e(a,5)+(u^c^l)+h+s[i]+1859775393&4294967295,h=l,l=c,c=e(u,30),u=a,a=d;for(i=40;i<=59;i++)d=e(a,5)+(u&c|u&l|c&l)+h+s[i]+2400959708&4294967295,h=l,l=c,c=e(u,30),u=a,a=d;for(i=60;i<=79;i++)d=e(a,5)+(u^c^l)+h+s[i]+3395469782&4294967295,h=l,l=c,c=e(u,30),u=a,a=d;p=p+a&4294967295,f=f+u&4294967295,m=m+c&4294967295,g=g+l&4294967295,_=_+h&4294967295}return(n(p)+n(f)+n(m)+n(g)+n(_)).toLowerCase()}const Un="github",Vn=t=>{if("string"!=typeof t)return t;const e=t.indexOf("?");if(-1===e)return t;const n=t.slice(0,e),r=t.slice(e+1);if(0===r.length)return`${n}?`;return`${n}?${r.split("&").map(t=>{if(!t)return t;const[e]=t.split("=");return e?`${e}=REDACTED`:"REDACTED"}).join("&")}`},Gn=(t,e)=>`${t}/${Vn(e)}`,zn=async(t,e)=>{const n=(t=>{const[e,n]=t.split("?"),r=e.split("/");if(r[0]?.toLowerCase()===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: ${Vn(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 ${Gn(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}}},Wn=t=>{const e=t=>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,c=Gn(t,e);if(globalThis?.DEBUG){const t=c;globalThis.trace[t]?globalThis.trace[t].push("parsing"):globalThis.trace[t]=["parsing"]}const l=((t,e)=>{if("string"==typeof t&&t.toLowerCase()===Un)return!0;if("string"!=typeof e)return!1;const n=e.toLowerCase();return n.startsWith(`${Un}/`)&&n.includes("/")})(t,e)?await zn(t,e):await n.leaflakeio.qm_methods.queryGraph({_appmode:r,_hostdomain:i,_hostappid:o,_domain:t,_appid:e}),{nodes:h}=l.graph?l.graph:{nodes:[]},d=m_(h),p=g_(d),f=n,m=t_(r,s,a,t,e,d,p,f.leafio,f.leaflakeio,f.mnemosyne,f),g=f?s+"/"+a:void 0;if(u.setEtaTree(t,e,m,g),globalThis?.DEBUG){const t=c;globalThis.trace[t]?globalThis.trace[t].push("parsed"):globalThis.trace[t]=["parsed"]}return m}};return u},Jn=Nt("leafmemoryio"),Hn={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{args:s}=n.leaf.logic,a=En(Jn.editorconfig.namedatakey,s),{domain:u,appid:c}=t.gos.etaTree,l=`www.leafgon.com/mnemosyne/${u}/${c}/${a}`,h=Bn(l,Bn.URL),d="global"in o,p="on-tap"in o,f="proxy"in o,m=t.gos.etaTree.leafgraph.thespade?.uuid,g=m&&d?await t.gos.etaTree.lookupRuntimeLambdaLUT("breezyforest","main",m,t.gos.etaTree.leafgraph.edges.lambda.sourcelut[m],[]):void 0;var _,y;e.slice(0,4),d&&(_=a,y=g,Object.keys(y).includes(_));const v={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||h;if(void 0===n||(t=>!!Ue(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 p?n.raw:Sn(a,n.raw,{_type:"memoryio",_command:"o",_memoryname:a,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}{const n=p?Sn("nothing",null,{_type:"memoryio",_command:"forget",_memoryname:a,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}}):null;return p?n:Sn(a,n,{_type:"memoryio",_command:"forget",_memoryname:a,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}}if("main"===a&&e.slice(0,4),Ue(o=n)&&void 0!==o._bname&&"memoryio"===o._label._type&&"forget"===o._label._command){const n=p?Sn("nothing",null,{_type:"memoryio",_command:"io",_memoryname:a,_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},p?n:Sn(a,n,{_type:"memoryio",_command:"io",_memoryname:a,_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},p?r:Sn(a,r,{_type:"memoryio",_command:"io",_memoryname:a,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}var o};return k_(r,n,void 0,{...v,metastep:"memory io "+a},{leaflogic:(t,e)=>{const n=new dt,r=e._stream.pipe(at(...t.map(t=>t._stream)),ut(t=>{if(f){const e=t[0].sid.slice(-1).pop(),r=Bn(`www.leafgon.com/mnemosyne/${u}/${c}/${a}/${e}`,Bn.URL),o=i(t[1],r);n.next(o)}else{const e=i(t[1]);n.next(e)}return t[0]}),ft());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{args:s}=n.leaf.logic,a=En(Jn.editorconfig.namedatakey,s);if(r.length>0){const n=await Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});o[a]={...n}}else o[a]={};return o}return o},methods:t=>({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=t=>t.hostEtaTree?o(t.hostEtaTree):t,s=o(t.gos.etaTree);return{etatreeforest:Wn(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]}}}}},Xn={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let Kn;const Yn=new Uint8Array(16);const Zn=function(t,e,n){if(Xn.randomUUID&&!e&&!t)return Xn.randomUUID();const r=(t=t||{}).random??t.rng?.()??function(){if(!Kn){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Kn=crypto.getRandomValues.bind(crypto)}return Kn(Yn)}();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 tr=t=>void 0!==t&&t>="0"&&t<="9",er=t=>t>="a"&&t<="z"||t>="A"&&t<="Z"||"_"==t||"."==t||"-"==t,nr=t=>t>="a"&&t<="z"||t>="A"&&t<="Z"||"_"==t||"."==t||"-"==t||":"==t,rr=t=>"=+-*/\\&%$_!<>?".includes(t);class ir{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 or,sr;ir.unknown=new ir("",-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"}(or||(or={}));class ar{constructor(t,e,n){this.type=t,this.value=e,this.position=n}}ar.INIT=new ar(or.Init,"",new ir("",0,0,0));class ur{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===or.Keyword,s=i.substring(o?e+1:e,r);return new ar(t,s,new ir(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 ar(or.String,i,new ir(r,t,n,e))}errorToken(t){const{start:e,line:n,current:r,source:i}=this;return new ar(or.Error,t,new ir(i,e,r,n))}identifier(){for(;;){const t=this.peek();if(!t||!(er(t)||tr(t)||rr(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(or.True);case"false":return this.makeToken(or.False);case"null":return this.makeToken(or.Nothing);default:return this.makeToken(or.Identifier)}}keyword(){if(!nr(this.peek())&&!tr(this.peek()))return this.makeToken(or.Identifier);for(;nr(this.peek())||tr(this.peek());)this.advance();return this.makeToken(or.Keyword)}number(){for(;tr(this.peek());)this.advance();if("."===this.peek()&&tr(this.peekNext())){for(this.advance();tr(this.peek());)this.advance();return this.makeToken(or.Float)}if("/"===this.peek()){if(!tr(this.peekNext()))return this.errorToken("Unterminated fraction number");for(this.advance();tr(this.peek());)this.advance();return this.makeToken(or.FractionNumber)}return this.makeToken(or.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(or.EOF);const t=this.advance();if(tr(t)||"-"===t&&tr(this.peek()))return this.number();if((er(t)||rr(t))&&!tr(t))return this.identifier();switch(t){case"(":return this.makeToken(or.LeftParen);case")":return this.makeToken(or.RightParen);case"{":return this.makeToken(or.LeftBrace);case"}":return this.makeToken(or.RightBrace);case"[":return this.makeToken(or.LeftSquare);case"]":return this.makeToken(or.RightSquare);case"#":return this.makeToken(or.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"}(sr||(sr={}));class cr{constructor(t,e,n){this.kind=t,this.value=e,this.position=n}}class lr 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}}lr.kind="RuntimeError";const hr=t=>t,dr=(t,e)=>{if(t)throw new lr(e);return!0},pr=(t,e,n)=>dr(t.length!==e,n||`Expected ${e} argument${e>1?"s":""}, but got ${t.length}.`),fr=(t,...e)=>dr(void 0===e.find(e=>e===t.kind),`Invalid function parameter, actual: '${t.kind}', expected: '${e.join(" or ")}'.`);const mr=t=>()=>{throw new lr(`${t} is not implemented.`)},gr=t=>({parser:()=>{throw new lr(`${t} is not implemented.`)},factory:mr(t)}),_r={Bool:{parser:t=>"true"===t,factory:Boolean},Nothing:{parser:t=>"null"==t,factory:mr("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:mr("FractionNumber")},Vector:gr("Vector"),HashMap:gr("HashMap")},yr="Vector",vr="HashMap";class br{constructor(t,e=_r){this.scanner=t,this.literals=e,this.hadError=!1,this.panicMode=!1,this.current=ar.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(or.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===or.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===or.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 or.True:case or.False:return this.makeLiteral(sr.Boolean,e.parser,t);case or.Nothing:return this.makeLiteral(sr.Nothing,s.parser,t);case or.Integer:return this.makeLiteral(sr.Integer,r.parser,t);case or.Float:return this.makeLiteral(sr.Float,i.parser,t);case or.FractionNumber:return this.makeLiteral(sr.FractionNumber,n.parser,t);case or.String:return this.makeLiteral(sr.String,o.parser,t);case or.Identifier:return this.makeLiteral(sr.Identifier,hr,t);case or.Keyword:return this.makeLiteral(sr.Keyword,o.parser,t);case or.LeftParen:return new cr(sr.List,this.advanceUntil(or.RightParen),t.position);case or.LeftSquare:return new cr(sr.List,[new cr(sr.Identifier,yr,t.position),...this.advanceUntil(or.RightSquare)],t.position);case or.LeftBrace:return new cr(sr.List,[new cr(sr.Identifier,vr,t.position),...this.advanceUntil(or.RightBrace)],t.position);case or.Dispatch:return this.formatDispatch();default:return void this.errorAtCurrent(`Unknown token: '${t.value}'.`)}}makeLiteral(t,e,n){const r=new cr(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===sr.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 vr:this.errorAtCurrent("Invalid dispatch: #{...}.");break;case yr: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 sr.Boolean:case sr.Nothing:case sr.Integer:case sr.Float:case sr.FractionNumber:case sr.String:case sr.Keyword:case sr.Identifier:return n=e(n,t);case sr.List:return t.value.map(r),n=e(n,t)}};return r(t),n}(t,(t,e)=>{if(e.kind===sr.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 cr(sr.Identifier,`%${n+1}`,t.position)),r=new cr(sr.List,[new cr(sr.Identifier,yr,t.position),...n],t.position);return new cr(sr.List,[new cr(sr.Identifier,"fn",t.position),r,t],t.position)}closeParentheses(t){switch(t){case or.RightParen:return")";case or.RightBrace:return"}";case or.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 wr="<native function>";class xr{constructor(t,e,n=!0,r=wr){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===sr.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 xr(t,r,this._resolveIds,this.toString())}{const r=this._fn(t,e,i.slice(0,this.arity));return r instanceof xr?r.call(t,e,i.slice(this.arity)):dr(!0,`Expected ${this.arity} argument${this.arity>1?"s":""}, but got ${n.length}.`)}}get arity(){return this._arity}toString(){return this._toString===wr?wr:`<${this._toString} function>`}toJS(){return this.toString()}debugTypeOf(){return xr.kind}}xr.kind="Function";const Sr=t=>{var e;return new xr(t.fn,t.arity,null===(e=t.resolveArgsIdentifiers)||void 0===e||e,t.name||t.fn.name)},Tr=(t,e)=>Sr({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}),kr=Sr({name:"const",arity:1,fn:(t,e,n)=>{dr(1!==n.length,`Const expected 1 argument, but got ${n.length}.`);const[r]=n;return Sr({name:"const",arity:-1,fn:(t,e)=>t.execLiteral(r,e)})}}),Ar=Sr({name:"def",arity:2,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{pr(n,2);const[r,i]=n;fr(r,sr.Identifier);const o=t.execLiteral(i,e);return e.define(r.value,o),o}}),Er=Sr({name:"defn",arity:-1,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{pr(n,3);const[r,i,o]=n;return e.get("def").call(t,e,[r,new cr(sr.List,[new cr(sr.Identifier,"fn",ir.unknown),i,o],ir.unknown)])}}),Or=Sr({name:"if",arity:3,fn:(t,e,n)=>{pr(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 lr(`Expected boolean value in the if condition, but get '${a}'`)}}),Cr=Sr({arity:-1,name:"case",fn:(t,e,n)=>{dr(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){fr(n,sr.List);const r=n.value;pr(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);dr(!("else"===u||a instanceof xr),"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);dr(!("boolean"==typeof n),"Case branch function must return with Bool."),c=n}if(c)return t.execLiteral(s,e)}dr(!0,`At least one of the case branch must match with the condition: ${o}`)}});class Mr{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 lr(`'${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 lr(`Undefined identifier: '${t}'.`)}assign(t,e){if(!this.values[t]){if(null!==this.enclosing)return this.enclosing.assign(t,e);throw new lr(`Undefined identifier: '${t}'.`)}this.values[t]=e}getNames(){return Object.keys(this.values)}get parent(){return this.enclosing}}const Ir=Sr({name:"fn",arity:-1,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{pr(n,2);const[r,i]=n;fr(r,sr.List);const o=r.value.slice(1);return o.map(t=>fr(t,sr.Identifier)),Sr({name:"lambda",arity:o.length,fn:(t,n,r)=>{pr(r,o.length);const s=new Mr(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}})}}),Nr=Sr({name:"do",arity:-1,fn:(t,e,n)=>(dr(n.length<1,`Expected at least 1 argument, but got ${n.length}.`),n.map(n=>t.execLiteral(n,e)).pop())}),Rr=Sr({name:"side-effect",arity:-1,fn:(t,e,n)=>{dr(n.length<1,`Eff expected at least 1 argument, but got ${n.length}.`);const[r,...i]=n,o=t.execLiteral(r,e);return dr(!(o instanceof xr),"Eff first parameter must be a function."),Sr({name:"side-effect",arity:-1,fn:t=>t.evalFn(o,i)})}}),Dr={stdout:void 0,lockedGlobals:!0,globals:{},utils:{unboxing:hr}},Pr=[yr,vr];class jr{constructor(t,e){this.globals=new Mr,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 sr.Boolean:case sr.Integer:case sr.Float:case sr.FractionNumber:case sr.String:case sr.Keyword:case sr.Nothing:return t.value;case sr.Identifier:return e.get(t.value);case sr.List:return this.execList(t,e);default:return t}},this.options=Object.assign(Object.assign({},Dr),t);const{stdout:n,globals:r,lockedGlobals:i}=this.options,o=Object.assign(Object.assign({},_r),e);Object.keys(o).forEach(t=>{const e=o[t].factory,n=Pr.includes(t)?-1:e.length;this.globals.define(t,Tr(e,n))}),this.globals.define("print",Tr(t=>{var e;return(n||console.log)(t,null===(e=this.lastPrint)||void 0===e?void 0:e.position)},-1)),this.globals.define("const",kr),this.globals.define("def",Ar),this.globals.define("defn",Er),this.globals.define("if",Or),this.globals.define("case",Cr),this.globals.define("fn",Ir),this.globals.define("do",Nr),this.globals.define("side-effect",Rr),Object.keys(r).forEach(t=>{const e=r[t];let n=e;"function"==typeof e&&e.toString()!==wr&&(n=Tr(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===lr.kind?t:new lr(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 lr(`'${i}' is not a function`,t.position)}getGlobalNames(){return this.globals.getNames()}clearEnv(){null!==this.currentEnv.parent&&(this.currentEnv=this.currentEnv.parent)}}var Lr;!function(t){t.Parser="Parser",t.Runtime="Runtime"}(Lr||(Lr={}));class Fr{constructor(t,e){this.literals=e,this.interpreter=new jr(t,e)}insituexecute(t){const e=new ur(t),n=new br(e,this.literals).parse();if(n.hasError)throw{type:Lr.Parser,errors:n.errors};try{return this.interpreter.interpret(n.program)}catch(t){throw{type:Lr.Runtime,errors:[{message:t.message,position:t.position}]}}}execute(t){return Qn(this,void 0,void 0,function*(){const e=new ur(t),n=new br(e,this.literals).parse();if(n.hasError)throw{type:Lr.Parser,errors:n.errors};try{this.interpreter.interpret(n.program)}catch(t){throw{type:Lr.Runtime,errors:[{message:t.message,position:t.position}]}}})}evalFn(t,e){return this.interpreter.evalFn(t,e)}}var $r,Br={const:t=>()=>t};class qr 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"}($r||($r={}));class Ur{constructor(t){this._value=t}static fromJS(t){return new Ur(t)}static fromStr(t){switch(t.value){case"true":return new Ur(!0);case"false":return new Ur(!1);default:throw new qr(`Invalid boolean: "${t.value}".`)}}get value(){return this._value}not(){return new Ur(!this._value)}and(t){return new Ur(this._value&&t._value)}or(t){return new Ur(this._value||t._value)}equals(t){return new Ur(this._value===t._value)}partialCmp(t){return this.value===t.value?$r.Equal:this.value?$r.Greater:$r.Less}copy(){return new Ur(this._value)}toString(){return this._value?"true":"false"}toJS(){return this._value}toJSON(){return this.toJS()}debugTypeOf(){return zr(Ur.kind)}}Ur.kind="Bool";const Vr=t=>new Ur(t);class Gr{constructor(t){this._value=t}static fromJS(t){return new Gr(t)}static fromStr(t){return t.copy()}get value(){return this._value}add(t){return new Gr(this._value+t.value)}index(t){var e;return Number.isInteger(t.value)?new Gr(null!==(e=this._value.charAt(t.value))&&void 0!==e?e:""):new Gr("")}slice(t,e){return new Gr(this.value.slice(t.value,e.value))}equals(t){return Vr(this._value===t.value)}partialCmp(t){const e=this._value.localeCompare(t.value);return e<0?$r.Less:0===e?$r.Equal:$r.Greater}copy(){return new Gr(this._value)}toJS(){return this._value}toJSON(){return this.toJS()}toString(){return`${this._value}`}debugTypeOf(){return new Gr(Gr.kind)}contains(t){return Vr(this.value.indexOf(t.value)>-1)}count(){return ri(this.value.length)}}Gr.kind="String";const zr=(t="")=>new Gr(t);class Wr{constructor(){this._value=null}static fromStr(t){switch(t.value){case"undefined":case"nil":case"null":return new Wr;default:throw new qr(`Invalid Nothing literal: "${t.value}".`)}}get value(){return null}equals(t){return Vr(this._value==t._value)}not(){return Vr(!0)}toJS(){return null}toJSON(){return null}toString(){return"null"}debugTypeOf(){return zr(Wr.kind)}}Wr.kind="null";const Jr=new Wr,Hr=t=>~~t,Xr=t=>null==t||null==t||t==Jr,Kr=(t,e)=>{if(t)throw new qr(e);return!0},Yr=(t,e)=>Kr(t.constructor!==e.constructor,`Type Error! Expected '${ni(t)}', but got '${ni(e)}'`),Zr=(t,e)=>{var n;return Kr(t!==e.constructor,`Expected '${null!==(n=t.kind)&&void 0!==n?n:t.name}', but got '${ni(e)}'.`)},Qr=(t,e)=>Kr(!t[e],`"${e.toString()}" is not defined on ${t}`),ti=t=>Kr(!Number.isInteger(t),`Expected integer number', but got '${t}'.`),ei=(t,e)=>(Kr(Xr(t),e),t),ni=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 ri(t,e=0){if("string"==typeof t){ii(t);const e=oi(t)?si(t):ai(t);return ri(e.intValue,e.decimals)}return Number.isInteger(t)||0!==e?(ti(t),ti(e),new di(t,e)):ri(t.toString())}function ii(t){return Kr(""===t||isNaN(Number(t)),`Invalid number: "${t}"`)}function oi(t){return t.startsWith("0")?/^0[eE]0$/.test(t):/^[-+]?[1-9](\.\d+)?[eE][-+]?\d+$/.test(t)}function si(t){Kr(!oi(t),`Input is not in scientific form: "${t}"`);const e=t.split(/[eE]/),n=ai(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 ai(t){var e;ii(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 ui(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 ci={modulo:function(t,e){const n=t.value,r=e.value;return ti(n),ti(r),Kr(r<1,`Modulo (${r}) must be positive.`),Kr(n<0,`Number (${n}) cannot be negative.`),ri(n%r)}};const li=(t,e)=>t!==e&&t?e?li(e,t%e):t:e,hi=t=>Math.abs(t)<=Number.EPSILON;class di{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 Vr((e=this.value,n=t.value,hi(e-n)));var e,n}negate(){return new di(-this.intValue,this.decimals)}add(t){const e=ui(this,t),n=e.intValue1+e.intValue2;return new di(n,e.maxDecimal)}subtract(t){const e=ui(this,t),n=e.intValue1-e.intValue2;return new di(n,e.maxDecimal)}multiply(t){return new di(this.intValue*t.intValue,this.decimals+t.decimals)}divide(t){if(0===t.intValue)throw new qr("Cannot divide by zero!");const e=ui(this,t),n=Math.round(e.intValue1/e.intValue2*Math.pow(10,12));return new di(n,12)}partialCmp(t){const e=ui(this,t);return e.intValue1<e.intValue2?$r.Less:e.intValue1>e.intValue2?$r.Greater:$r.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 di(this.intValue,this.decimals)}debugTypeOf(){return zr(di.kind)}isInteger(){return Vr(0===this.decimals)}toJSON(){return this.toString()}}di.kind="Number";const pi=t=>e=>{Zr(di,e);try{return ri(t(e.value))}catch(n){throw new qr(`Invalid argument for ${t.name}: ${e.value}`)}},fi=t=>(e,n)=>(Zr(di,e),Zr(di,n),ri(t(e.value,n.value))),mi=ri(Math.E),gi=ri(Math.LN2),_i=ri(Math.LN10),yi=ri(Math.LOG2E),vi=ri(Math.LOG10E),bi=ri(Math.PI),wi=ri(Math.SQRT1_2),xi=ri(Math.SQRT2),Si=pi(Math.abs),Ti=pi(Math.sign),ki=fi((t,e)=>Math.min(t,e)),Ai=fi((t,e)=>Math.max(t,e)),Ei=pi(Math.floor),Oi=pi(Math.round),Ci=pi(Math.ceil),Mi=pi(Math.trunc),Ii=pi(Math.cbrt),Ni=pi(Math.sqrt),Ri=pi(Math.exp),Di=fi(Math.pow),Pi=pi(Math.log),ji=pi(Math.log2),Li=pi(Math.log10),Fi=Math.PI/180,$i=pi(t=>{const e=t%Math.PI;return hi(e)||hi(e-Math.PI)?0:Math.sin(t)}),Bi=pi(Math.asin),qi=pi(Math.asinh),Ui=pi(Math.cos),Vi=pi(Math.acos),Gi=pi(Math.acosh),zi=pi(Math.tan),Wi=pi(Math.atan),Ji=fi(Math.atan2),Hi=pi(Math.atanh);var Xi=Object.freeze({__proto__:null,E:mi,LN2:gi,LN10:_i,LOG2E:yi,LOG10E:vi,PI:bi,SQRT1_2:wi,SQRT2:xi,abs:Si,sign:Ti,min:ki,max:Ai,floor:Ei,round:Oi,ceil:Ci,trunc:Mi,cbrt:Ii,sqrt:Ni,exp:Ri,pow:Di,log:Pi,log2:ji,log10:Li,deg2rad:t=>t.multiply(ri(Fi)),rad2deg:t=>t.divide(ri(Fi)),sin:$i,asin:Bi,asinh:qi,cos:Ui,acos:Vi,acosh:Gi,tan:zi,atan:Wi,atan2:Ji,atanh:Hi});const Ki=t=>(Qr(t,"copy"),t.copy());var Yi={typeof:t=>{const e=t.debugTypeOf?t.debugTypeOf():zr("<unknown>");return e instanceof String?zr(e):e},copy:Ki,"deep-copy":t=>{var e;return Qr(t,"copy"),t.deepCopy?null===(e=t.deepCopy)||void 0===e?void 0:e.call(t):Ki(t)},str:t=>zr(t.toString()),"to-json":t=>{let e=null;return"function"==typeof t.toJSON?e=t.toJSON():"function"==typeof t.toJS&&(e=t.toJS()),zr(JSON.stringify(e))}};const Zi=(t,e)=>t.constructor!==e.constructor?Vr(!1):t.equals(e),Qi=(t,e)=>{Yr(t,e);const n=t.lt;return"function"==typeof n?n(e):Vr(t.partialCmp(e)===$r.Less)},to=(t,e)=>{Yr(t,e);const n=t.gt;return"function"==typeof n?n(e):Vr(t.partialCmp(e)===$r.Greater)};var eo={"==":Zi,"!=":(t,e)=>Zi(t,e).not(),"<":Qi,"<=":(t,e)=>Vr(Zi(t,e).value||Qi(t,e).value),">":to,">=":(t,e)=>Vr(Zi(t,e).value||to(t,e).value)};var no={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 ro=(t,e)=>(Yr(t,e),t.add(e)),io=(t,e)=>(Yr(t,e),t.multiply(e));var oo={negate:t=>t.negate(),not:t=>t.not(),and:(t,e)=>t.and(e),or:(t,e)=>t.or(e),"+":ro,"-":(t,e)=>(Yr(t,e),t.subtract(e)),"*":io,"/":(t,e)=>(Yr(t,e),t.divide(e)),get:(t,e)=>t.index(e)};class so{constructor(t){t.map(e=>Yr(t[0],e)),this._value=t}get value(){return this._value}contains(t){return Vr(void 0!==this.value.find(e=>Zi(e,t).value))}add(t){return new so(this._value.concat(t.value))}count(){var t;return new di(null!==(t=this._value.length)&&void 0!==t?t:0)}map(t){return new so(this.value.map(e=>t(e)))}filter(t){return new so(this.value.filter(e=>t(e).toJS()))}reverse(){return new so(this.value.reverse())}reduce(t,e){return this.value.reduce(e,t)}intersperse(t){const e=this.value.length-1;return new so(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){Zr(di,t);return ei(this.value[t.value],`Vector index ${t.toString()} is not defined`)}slice(t,e){return Zr(di,t),Zr(di,e),new so(this.value.slice(t.value,e.value))}copy(){return new so([...this._value])}deepCopy(){return new so(this._value.map(t=>Ki(t)))}debugTypeOf(){return zr(so.kind)}}function ao(...t){return new so(t)}so.kind="Vector";var uo={sum:t=>(Zr(so,t),t.reduce(ri(0),ro)),prod:t=>(Zr(so,t),t.reduce(ri(1),io)),intersperse:(t,e)=>(Zr(so,e),e.intersperse(t)),join:t=>(Zr(so,t),t.reduce(zr(""),ro)),"join-with":(t,e)=>(Zr(so,e),e.intersperse(t).reduce(zr(""),ro)),"num-list":(t,e)=>(Zr(so,e),e.map(t=>zr(t.toString())).intersperse(t).reduce(zr(""),ro)),head:t=>{Zr(so,t);return ei(t.value[0],"Vector is empty")},reverse:t=>(Zr(so,t),ao(...t.value.reverse())),slice:(t,e,n)=>(Zr(so,t),Zr(di,n),Zr(di,e),ei(t.value.length,"Vector is not defined correctly"),ao(...t.value.slice(e.value,n.value))),tail:t=>{Zr(so,t),ei(t.value.length,"Vector is not defined correctly");return ao(...t.value.slice(1))}};const co=Math.random;var lo=Object.freeze({__proto__:null,random:()=>ri(co()),randomInt:(t,e)=>{const n=Hr(t.value),r=Hr(e.value);return ri(Hr(n+co()*(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 ao(...e)},range:(t,e,n)=>{const r=t.value,i=n.value,o=Hr(e.value);let s=r;const a=[];for(let t=0;t<o;t++)a.push(ri(s)),s+=i;return ao(...a)},range0:t=>{const e=Hr(t.value);return ao(...Array.from({length:e},(t,e)=>ri(e)))}});class ho{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 zr(ho.kind)}}ho.kind="Just";class po{constructor(t=[]){if(t.length%2!=0)throw new qr("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(Gr!==t.constructor)throw new qr("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 di?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 zr(po.kind)}index(t){Zr(Gr,t);try{const e=this._value.get(t.value);return Xr(e)?new Wr:e}catch(t){return new Wr}}}po.kind="HashMap";const fo=(...t)=>new po(t);var mo={keys:t=>(Zr(po,t),ao(...Array.from(t.value.keys()).map(t=>zr(t)))),values:t=>(Zr(po,t),ao(...Array.from(t.value.values()))),"hash-map":fo};class go{constructor(t){const e=t.value;e.map(t=>Yr(e[0],t)),this._value=e.reduce((t,e)=>(t.find(t=>Zi(t,e).value)||t.push(e),t),[])}get value(){return this._value}contains(t){return Vr(void 0!==this.value.find(e=>Zi(e,t).value))}union(t){return new go(ao(...this._value.concat(t.value)))}difference(t){return new go(ao(...this.value.filter(e=>!t.contains(e).value)))}intersection(t){return new go(ao(...this.value.concat(t.value).filter(e=>t.contains(e).value&&this.contains(e).value)))}symmetricDifference(t){return new go(ao(...this.value.concat(t.value).filter(e=>!(t.contains(e).value&&this.contains(e).value))))}count(){var t;return new di(null!==(t=this._value.length)&&void 0!==t?t:0)}map(t){return new go(ao(...this.value.map(t)))}filter(t){return new go(ao(...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 go(ao(...this.value))}deepCopy(){return new go(ao(...this.value.map(t=>Ki(t))))}debugTypeOf(){return zr(go.kind)}}go.kind="Set";var _o={Set:t=>new go(t),"set-2-list":function(t){return ao(...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 yo=(t,e)=>Number.isInteger(t)&&Number.isInteger(e)&&0!==e;class vo{constructor(t,e){if(!yo(t,e))throw new qr("Invalid fraction number parameters!");e<0&&(t*=-1,e*=-1);const n=li(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 Vr(this.numerator===t.numerator&&this.denominator===t.denominator)}negate(){return new vo(-this._n,this._d)}add(t){const e=this.numerator*t.denominator+this.denominator*t.numerator,n=this.denominator*t.denominator;return new vo(e,n)}subtract(t){const e=this.numerator*t.denominator-this.denominator*t.numerator,n=this.denominator*t.denominator;return new vo(e,n)}multiply(t){const e=this.numerator*t.numerator,n=this.denominator*t.denominator;return new vo(e,n)}divide(t){const e=this.numerator*t.denominator,n=this.denominator*t.numerator;return new vo(e,n)}partialCmp(t){const e=this._d*t._d/li(this._d,t._d),n=this._n*e/this._d,r=t._n*e/t._d;return n<r?$r.Less:n>r?$r.Greater:$r.Equal}toJS(){return{numerator:this._n,denominator:this._d}}toJSON(){return this.toString()}toString(){return`${this._n}/${this._d}`}copy(){return new vo(this._n,this._d)}debugTypeOf(){return zr(vo.kind)}}vo.kind="Fraction";const bo=(t,e)=>new vo(t,e);var wo={"number-2-fraction":(t,e)=>{const n=t.value;Kr(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 bo(Math.round(r*i),i)},"fraction-2-number":t=>ri(t.numerator).divide(ri(t.denominator)),reciprocal:t=>(Zr(vo,t),bo(t.denominator,t.numerator))};const xo=t=>t,So={Bool:{parser:t=>Ur.fromStr(zr(t)),factory:t=>(Zr(Ur,t),t)},Nothing:{parser:t=>Wr.fromStr(zr(t)),factory:t=>(Zr(Wr,t),t)},Int:{parser:ri,factory:function(t){return Zr(di,t),Kr(!t.isInteger().value,"Expected integer, but got float number."),t}},Float:{parser:ri,factory:function(t){return Zr(di,t),t}},FractionNumber:{parser:t=>{const[e,n]=t.split("/").map(parseFloat);if(yo(e,n))return new vo(e,n);throw new qr(`Invalid fraction number: ${t}.`)},factory:(t,e)=>(Kr(!t.isInteger().value,"Numerator must be integer"),Kr(!e.isInteger().value,"Denominator must be integer"),new vo(t.toJS(),e.toJS()))},String:{parser:zr,factory:t=>(Zr(Gr,t),t)},Vector:{parser:xo,factory:ao},HashMap:{parser:xo,factory:fo}},To=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({},Yi),eo),no),oo),Br),Xi),ci),wo),uo),mo),_o),lo),{maybe:t=>Xr(t)?Jr:new ho(t),Nothing:Jr}),ko={unboxing:t=>t.toJS()},Ao="undefined"!=typeof globalThis&&"function"==typeof globalThis.btoa,Eo="undefined"!=typeof globalThis&&"function"==typeof globalThis.atob,Oo=Ao?globalThis.btoa.bind(globalThis):t=>globalThis.Buffer.from(t,"binary").toString("base64"),Co=Eo?globalThis.atob.bind(globalThis):t=>globalThis.Buffer.from(t,"base64").toString("binary");function Mo(t){return Oo(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(t,e){return String.fromCharCode("0x"+e)}))}function Io(t){return decodeURIComponent(Co(t).split("").map(function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)}).join(""))}const No=t=>t>0?" ".repeat(t):"",Ro=t=>t?.constructor?.kind??t?.constructor?.name??"unknown",Do={trace:[],probe:[]},Po=(t,e=0,n=!1)=>{const r=typeof t,i=No(e),o=No(e+1);return"string"===r?(n?"":i)+`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"\n`:"object"===r?Array.isArray(t)?(n?"":i)+"[\n"+`${t.map(t=>Po(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+" "+Po(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 jo=(t,e=!0)=>{if(null==t)return To.Nothing;const n=typeof t;return"string"===n?zr(t):"object"===n?Array.isArray(t)?ao(...t.filter(t=>t).map(t=>jo(t,!1))):[null,void 0].includes(t)?To.Nothing:fo(...Object.entries(t).map(([t,e])=>[zr(t),jo(e,!1)]).flat()):"boolean"===n?Vr(t):"number"===n?ri(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):To.Nothing},Lo=({_probefunc:t,_tracefunc:e}={})=>({return:t=>t,outport:t=>t,undefined:To.Nothing,nil:To.Nothing,null:To.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 zr(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=>Vr("null"==t||t.constructor==To.Nothing.constructor),isbottle:t=>{const e=t.toJSON();return Vr(Ue(e))},islist:t=>{const e=t.toJSON();return Vr(Array.isArray(e))},flatten:t=>{const e=t.toJSON();return jo(e.flat().filter(t=>t),!1)},join:(t,e)=>{const n=t.toJSON();return zr(n.join(e))},bottle:(t,e)=>{if(t.constructor!==Gr)throw new qr(`Expected '${Gr.kind??Gr.name}', but got '${Ro(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 jo(i)},getbottle:(t,e)=>{if(t.constructor!==so)throw new qr(`Expected '${so.kind??so.name}', but got '${Ro(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!==po)throw new qr(`Expected '${po.kind??po.name}', but got '${Ro(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 jo(o||[])},min:t=>{if(t.constructor!==so)throw new qr(`Expected '${so.kind??so.name}', but got '${Ro(t.value)}'.`);const e=t.value.map(t=>t.value);return ri(Math.min(...e))},max:t=>{if(t.constructor!==so)throw new qr(`Expected '${so.kind??so.name}', but got '${Ro(t.value)}'.`);const e=t.value.map(t=>t.value);return ri(Math.max(...e))},parse:t=>{const e=t.toJSON();let n;return ii(e),n=oi(e)?si(e):ai(e),0===n.decimals?ri(n.intValue):ri(n.intValue,n.decimals)},"merge-dict":(t,e)=>{if(t.constructor!==po)throw new qr(`Expected '${po.kind??po.name}', but got '${Ro(t.value)}'.`);if(e.constructor!==po)throw new qr(`Expected '${po.kind??po.name}', but got '${Ro(e.value)}'.`);const n={...t.toJSON(),...e.toJSON()};return jo(n)},"make-dict":(t,e)=>{if(t.constructor!==so)throw new qr(`Expected '${so.kind??so.name}', but got '${Ro(t.value)}'.`);if(e.constructor!==so)throw new qr(`Expected '${so.kind??so.name}', but got '${Ro(e.value)}'.`);const n=t.toJSON(),r=e.toJSON(),i=[...Array(n.length).keys()].reduce((t,e)=>({...t,[n[e]]:r[e]}),{});return jo(i)},concat:(t,e)=>{if(t.constructor!==so)throw new qr(`Expected '${so.kind??so.name}', but got '${Ro(t.value)}'.`);if(e.constructor!==so)throw new qr(`Expected '${so.kind??so.name}', but got '${Ro(e.value)}'.`);return ao(...t.value.concat(e.value))},uuid4:()=>zr(Zn()),uuid5:t=>{const e=Bn(t.toString(),Bn.URL);return zr(e)},"*":(t,e)=>ri(t*e),"/":(t,e)=>ri(t/e),"+":(t,e)=>isNaN(t.value)||isNaN(e.value)?t.add(e):ri(t.value+e.value),"-":(t,e)=>ri(t-e),tofixed:(t,e)=>zr(Number(t).toFixed(e))}),Fo=(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=p_.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 v_(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}.`}),jo(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}.`}),jo(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}.`}),jo(e))}};return new Fr({globals:{...To,...Lo({}),...r},utils:ko},So)},$o=(t,e,n,r,i=0)=>{try{e?.slice(0,4);const r=n.insituexecute(t);try{return[0,r.toJSON()]}catch{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(Sn("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 Bo={};const qo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{let o,s;const a=bn.memoize(async()=>await A_("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&&Do.trace.length===r&&Do.trace.shift(),Do.trace.push({timestamp:Date.now(),address:u,refnode:e,trace:t}),v_(i.probe._default,Do.trace,{},n).then(t=>{}))})},l=(t,n=e,r=1)=>{a().then(i=>{Object.entries(i).length>0&&(r>0&&Do.probe.length===r&&Do.probe.shift(),Do.probe.push({timestamp:Date.now(),address:u,refnode:e,trace:t}),v_(i.probe._default,Do.probe,{},n).then(t=>{}))})},h=await Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});Bo[e]="interactive"in h;const d=Bo[e],p=n.leaf.logic.args.lispexpression;o="global"in h?t.gos.etaTree.gRuntimeLEAFlisp:new Fr({globals:{...To,...Lo({_probefunc:l,_tracefunc:c})},utils:ko},So);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 dt;if(d){t.gos.etaTree.leafio.elementioLUT[e]=_;const n={graphuuid:"",domain:"breezyforest",appid:"leaflisp",graphaddrstr:"breezyforest/leaflisp"},r=p_.lambda(t)({refnode:"leaflisp_runtime_interactive",refnodedata:{leaf:{logic:{args:n}}},nodelambda:[],contextuallambda:[]}),i=await r;s=()=>{const n=Sn("dataevent",{_refnode:e,_provenance:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid,refnodedata:g.leafnode,codebase:"leaflisp.js"}},{});v_(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 ${Po(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]=$o(r,e,o,g.leafaddress,i);return-1===t&&l(n,e),n}catch(t){throw new qr(`LEAFlisp Error: ${t}`)}};return k_(i,r,void 0,{...g,metastep:"invoking leaflisp"},{leaflogic:d?(t,e)=>{const n=new dt;let r=!1;const i=e._stream.pipe(ut(t=>(s&&s(),t)),at(...t.map(t=>t._stream)),ct(t=>rn(new _t(t[0]),_)),ut(t=>{const e=t[1];return r=!0,n.next(e),t[0]}),ft());return{_stream:n.pipe(gt(t=>r),ut(t=>t),ft()),_control:{...e,_stream:i}}}:(r,i)=>{const o=new dt;let s=!1;const a=f?i._stream.pipe(ut(t=>t),at(...r.map(t=>t._stream)),ut(r=>{let i=r[1];if(Ue(i)&&"rewrite"===i._bname){const r=Tn("*",i),o={...n},s=Po(null==r?[]:r);o.leaf.logic.args.lispexpression=s,n.leaf.logic.args.lispexpression=s,t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:Mo(JSON.stringify(o))}}),i=void 0}if(null!=i){s=!0;const t=c(i);return o.next(t),r[0]}}),gt(t=>void 0!==t),ft()):m?i._stream.pipe(ut(t=>t),at(...r.map(t=>t._stream)),ut(t=>{const e=t[1];if(Ue(e)&&"codebottle"===e._bname){const n=Tn("*",e);s=!0;const r=n.data,i=n.code,a=c(r,i);return o.next(a),t[0]}}),gt(t=>void 0!==t),ft()):i._stream.pipe(ut(t=>t),at(...r.map(t=>t._stream)),ut(t=>{const e=t[1];s=!0;const n=c(e);return o.next(n),t[0]}),ft());return{_stream:o.pipe(gt(t=>s),ut(t=>t),ft()),_control:{...i,_stream:a}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>(n,r)=>({...gn(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=(async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>({version:"breezyforest",nodequery:t=>t,nodemethod:t=>({})}))({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}),a=Bo[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:Mo(JSON.stringify(i))}})},getTextSource:()=>n.leaf.logic.args.lispexpression},general:{getNodeData:()=>n}}}},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 Qg({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 dt,r=t[0]._stream,i=e._stream.pipe(ut(t=>t),at(r),ut(t=>(n.next(t[1]),t[0])),ft());return{_stream:n.pipe(ut(t=>t),ft()),_control:{...e,_stream:i.pipe(ut(t=>t),ft())}}};return(t,n)=>{if(t.length>1){const r=Et(...t.map((t,e)=>t._stream.pipe(ut(t=>t),ft())));if("concat"in o){return{...yn(t),_control:n}}if("merge"in o){return{...vn(t),_control:n}}if("combine"in o){return{...gn(e,t),_control:n}}if("substitute"in o){const e=Object.keys(o.substitute);return{..._n(t,e),_control:n}}{const t=t=>t,e=n._stream.pipe(ut(t=>t));return k_({_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 Qg({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}},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 Qg({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 dt,r=e._stream.pipe(at(...t.map(t=>t._stream)),ct(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?Sn("mix",u):u)):r&&!s?(u=[t[1]].flat().map(t=>Ue(t)?Tn("*",t):void 0).filter(t=>t&&"empty_data"!==t),a||(u=[...new Set(u.flat())]),n.next(e?Sn("mix",u):u)):i&&!s?(u=[t[1]].flat().map(t=>Ue(t)?t:void 0).filter(t=>void 0!==t&&!Ge(t)),a||(u=[...new Set(u.flat())]),1===u.length?n.next(e?Sn("mix",u[0]):u[0]):n.next(e?Sn("mix",u):u)):(u={},[t[1]].flat().filter(t=>Ue(t)&&!Ge(t)).map(t=>{if(Ue(t))return u=((e,n={})=>{const r=e._bname;return{...n,[r]:Tn("*",t)}})(t,u),t}),n.next(e?Sn("mix",u):u)),He(t[0])}),ft());return{_stream:n.pipe(ut(t=>t),ft()),_control:{...e,_stream:r}}};return(t,n)=>{if(t.length>1){if("concat"in o){return{...yn(t),_control:n}}if("merge"in o){return{...vn(t),_control:n}}if("combine"in o){return{...gn(e,t),_control:n}}if("substitute"in o){const e=Object.keys(o.substitute);return{..._n(t,e),_control:n}}{const e=t=>t,r=n._stream;return k_({_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 k_({_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 Qg({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}},Go=Nt("leafgateflow"),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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{args:s}=n.leaf.logic,a=En(Go.editorconfig.namedatakey,s).toLowerCase(),u=En(Go.editorconfig.toggledatakey,s),c=(()=>{const t=Object.keys(o).filter(t=>0===Object.keys(o[t]).length);return t.length>0?t.sort().join(";"):void 0})(),l={codebase:"leafgateflow.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>k_(e,t,void 0,{...l,metastep:"gateflow "+(u?"NOT gate, ":"normal gate, ")+a},{leaflogic:(t,e)=>{const n=new dt,r=e._stream.pipe(at(...t.map(t=>t._stream)),ut(t=>{const e=t[1],r=t=>Ue(t)?!u&&t._bname?.toLowerCase()===a||u&&t._bname?.toLowerCase()!==a?t:void 0:"{crate}"===a?!u&&t._cratelabel?"uncrate"===c?Object.keys(t).filter(t=>"_cratelabel"!==t).map(e=>t[e]).flat():t:u&&!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(a):n.includes(a))return t})(t,u),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]}),gt(t=>void 0!==t),ft());return{_stream:n.pipe(ut(t=>t),ft()),_control:{...e,_stream:r.pipe(ut(t=>t),ft())}}},datalogic:{post:t=>t}})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({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}},Wo=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in leaflabel.js",codebase:"/src/ghostos/api/parser/nodelogic/datautils/leaflabel.js"},{}),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 Qg({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 v_(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 k_(i,r,void 0,{...s,metastep:"leaflabel "+e},{leaflogic:(t,e)=>{const n=new _t({...Wo,_label:{...s}}),r=a(t),i=t.length>0?e._stream.pipe(ct(t=>rn([He(t),...r])),ut(t=>(2==t.length?n.next(t[1]):n.next(t.slice(1)),t[0])),gt(t=>t),ft()):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 Qg({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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree})}}else o={};return o}},Ho={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 Qg({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:He([n.leaf.logic.args.label])};return{_stream:vn(t)._stream.pipe(at(r._stream),ut(t=>t),gt(([t,e])=>t.every(t=>Ue(t)||Ve(t)&&t._crate.every(Ue))),ut(([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]=[])=>(Ue(e)?t.push(s(n,r(e))):Ve(e)&&t.push({...e,_crate:e._crate.map(t=>s(n,r(t)))}),t),[]);if(i.length>0)return i}),gt(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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=n.leaf.logic.args.labelstr;return o&&s in o?{...o[s]}:{}}},Xo={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 Qg({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:He(n.leaf.logic.args.bottlekey),_control:e},c=e._stream.pipe(Xe(t=>(r=t,u._stream)),ut(t=>(i=t,r)));return k_({_stream:c},t,void 0,{...a,metastep:"executing bottle with key "+i},{datalogic:{pre:t=>void 0===s?Sn(i,t):Sn(i,t,{tag:s})}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,n])=>{s[t]=(t,r)=>{const i=gn(e,t);return{...n([i],r),_control:r}}}),s}},Ko={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 Qg({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:He([n.leaf.logic.args.bottlekey]),_control:e};let i;const a=e._stream.pipe(at(r._stream),ut(t=>{const e=t[1];return i=e,t[0]}),ft()),u=(t,e)=>{const n=new dt,r=e._stream.pipe(at(...t.map(t=>t._stream)),ut(t=>{const e=t[1],r=t=>{const e=[t].flat().map(t=>Ue(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]}),gt(t=>void 0!==t),ft());return{_stream:n.pipe(ut(t=>t),ft()),_control:{...e,_stream:r.pipe(ut(t=>t),ft())}}};return k_({_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 Qg({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}},Yo={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 Qg({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})();return(t,e)=>{const n=new dt,r=e._stream.pipe(at(...t.map(t=>t._stream)),ut(t=>{const e={_cratelabel:s?{tag:s}:{}};if((Array.isArray(t[1])?t[1]:[t[1]]).flat().map(t=>Ue(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]}),gt(t=>void 0!==t),ft());return{_stream:n.pipe(ut(t=>t),ft()),_control:{...e,_stream:r}}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({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}},Zo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>(await Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),(t,e)=>{const n=vn(t);if(n&&"_stream"in n){return{_stream:n._stream.pipe(ut(t=>t)),_control:e}}return{_stream:He([]),_control:e}}),lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={};if(r.length>0){const s=await Qg({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 Qg({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 v_(t,[],{}):{}}}}}},Qo=Nt("leafdeckspade"),ts={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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});await Vo.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i});const 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 a=r._config?.loopidx,{args:u}=n.leaf.logic,c="_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)=>({...vn(t),_control:e}),l=r._stream;return k_({_stream:l},t,void 0,{...s,metastep:"creating a leafdeckspade element"},{datalogic:{pre:t=>Array.isArray(t)?t.map(t=>Tn(i,t)).filter(t=>t):Tn(i,t),post:t=>{const e=Array.isArray(t)?t:[t],n={type:"leafdeckspade",uuid:Zn(),name:En(Qo.editorconfig.namedatakey,u),description:"{description}",lambdas:{default:"defaultLambda",defaultLambda:c,bro:t=>t},diamonds:e};return Sn("screenio",n)}}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({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}},es=Nt("leafdeckheart"),ns={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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});await Vo.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i}),await Xo.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckheart"}}}},nodelambda:[],contextuallambda:i});const s={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,{args:u}=n.leaf.logic,c="_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)=>({...vn(t),_control:e}),l=r._stream;return k_({_stream:l},t,void 0,{...s,metastep:"creating a leafdeckheart element"},{datalogic:{pre:t=>Array.isArray(t)?t.map(t=>Tn(i,t)).filter(t=>t):Tn(i,t),post:t=>{const e=Array.isArray(t)?t:[t],n={type:"leafdeckheart",uuid:Zn(),name:En(es.editorconfig.namedatakey,u),description:"{description}",lambdas:{default:"defaultLambda",defaultLambda:c,bro:t=>t},diamonds:e};return Sn("screenio",n)}}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({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}},rs=Nt("leafdeckdiamond"),is={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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});await Vo.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i});const s={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,{args:u}=n.leaf.logic,c="_default"in o?(t,n)=>{const r={_stream:n._stream.pipe(ut(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(ut(t=>t)),_control:{_stream:i._control._stream.pipe(ut(t=>t))}}}:"href"in o&&"_default"in o.href?(t,e)=>{const n=o.href._default(t,e);return{_stream:n._stream.pipe(ut(t=>(window.location.href.slice(-t.length)!==t&&(window.location.href=t),t))),_control:{...e._control,_stream:n._control._stream.pipe(ut(t=>t))}}}:(t,e)=>({...vn(t),_control:e}),l=r._stream,h=k_({_stream:l},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=>{Ue(t)&&(t._bname===i[0]?n.clubs.push(Tn(i,t)):"nodeinput"===t._bname&&n.nodeinput.push(Tn("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:Zn(),nodeuuid:e,name:En(rs.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:r,clubs:n};return Sn("_leafdeckdiamond",i)}}});return{_stream:h._stream.pipe(ut(t=>t)),_control:h._control}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({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}},os=Nt("leafdeckclub"),ss={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 Qg({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,{args:a}=n.leaf.logic,u="_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)=>({...vn(t),_control:e}),c=r._stream.pipe(ut(t=>t)),l=k_({_stream:c},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=>{Ue(t)&&"nodeinput"===t._bname&&n.nodeinput.push(Tn("nodeinput",t))}),n},post:t=>{const n="subscribe"in o,r={type:"leafdeckclub",uuid:Zn(),nodeuuid:e,name:En(os.editorconfig.namedatakey,a),svgicon:"https://www.leafgon.com/icons/hardware/laptop_mac/materialicons/24px.svg",description:"{description}",nodeinput:t.nodeinput,lambdas:{default:"defaultLambda",defaultLambda:u,bro:t=>t},subscription:n};return Sn("_leafdeckclub",r)}}});return{_stream:l._stream.pipe(ut(t=>t)),_control:l._control}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({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}},as={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 Qg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree});const o=Ko.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckspade"}}}},nodelambda:[],contextuallambda:i}),s=Ko.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckheart"}}}},nodelambda:[],contextuallambda:i}),a=void 0;return t=>{const e=o(t),n=s(t);return a([e,n]).pipe(ut(t=>t),ut(t=>t)).pipe(gt(t=>t))}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=t=>e(t)}),s}},us={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 Qg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s="_default"in o?t=>o._default([t]):t=>t,a=Xo.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafpopupview"}}}},nodelambda:[],contextuallambda:i});return t=>{const e=t.pipe(ut(t=>t),ut(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(gt(t=>t)))}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=t=>e(t)}),s}};function cs(t,e){return function(){return t.apply(e,arguments)}}const{toString:ls}=Object.prototype,{getPrototypeOf:hs}=Object,{iterator:ds,toStringTag:ps}=Symbol,fs=(ms=Object.create(null),t=>{const e=ls.call(t);return ms[e]||(ms[e]=e.slice(8,-1).toLowerCase())});var ms;const gs=t=>(t=t.toLowerCase(),e=>fs(e)===t),_s=t=>e=>typeof e===t,{isArray:ys}=Array,vs=_s("undefined");function bs(t){return null!==t&&!vs(t)&&null!==t.constructor&&!vs(t.constructor)&&Ss(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const ws=gs("ArrayBuffer");const xs=_s("string"),Ss=_s("function"),Ts=_s("number"),ks=t=>null!==t&&"object"==typeof t,As=t=>{if("object"!==fs(t))return!1;const e=hs(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||ps in t||ds in t)},Es=gs("Date"),Os=gs("File"),Cs=gs("Blob"),Ms=gs("FileList"),Is=gs("URLSearchParams"),[Ns,Rs,Ds,Ps]=["ReadableStream","Request","Response","Headers"].map(gs);function js(t,e,{allOwnKeys:n=!1}={}){if(null==t)return;let r,i;if("object"!=typeof t&&(t=[t]),ys(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{if(bs(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 Ls(t,e){if(bs(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 Fs="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,$s=t=>!vs(t)&&t!==Fs;const Bs=(qs="undefined"!=typeof Uint8Array&&hs(Uint8Array),t=>qs&&t instanceof qs);var qs;const Us=gs("HTMLFormElement"),Vs=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Gs=gs("RegExp"),zs=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};js(n,(n,i)=>{let o;!1!==(o=e(n,i,t))&&(r[i]=o||n)}),Object.defineProperties(t,r)};const Ws=gs("AsyncFunction"),Js=(Hs="function"==typeof setImmediate,Xs=Ss(Fs.postMessage),Hs?setImmediate:Xs?(Ks=`axios@${Math.random()}`,Ys=[],Fs.addEventListener("message",({source:t,data:e})=>{t===Fs&&e===Ks&&Ys.length&&Ys.shift()()},!1),t=>{Ys.push(t),Fs.postMessage(Ks,"*")}):t=>setTimeout(t));var Hs,Xs,Ks,Ys;const Zs="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Fs):"undefined"!=typeof process&&process.nextTick||Js,Qs={isArray:ys,isArrayBuffer:ws,isBuffer:bs,isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||Ss(t.append)&&("formdata"===(e=fs(t))||"object"===e&&Ss(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&ws(t.buffer),e},isString:xs,isNumber:Ts,isBoolean:t=>!0===t||!1===t,isObject:ks,isPlainObject:As,isEmptyObject:t=>{if(!ks(t)||bs(t))return!1;try{return 0===Object.keys(t).length&&Object.getPrototypeOf(t)===Object.prototype}catch(t){return!1}},isReadableStream:Ns,isRequest:Rs,isResponse:Ds,isHeaders:Ps,isUndefined:vs,isDate:Es,isFile:Os,isBlob:Cs,isRegExp:Gs,isFunction:Ss,isStream:t=>ks(t)&&Ss(t.pipe),isURLSearchParams:Is,isTypedArray:Bs,isFileList:Ms,forEach:js,merge:function t(){const{caseless:e,skipUndefined:n}=$s(this)&&this||{},r={},i=(i,o)=>{const s=e&&Ls(r,o)||o;As(r[s])&&As(i)?r[s]=t(r[s],i):As(i)?r[s]=t({},i):ys(i)?r[s]=i.slice():n&&vs(i)||(r[s]=i)};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&js(arguments[t],i);return r},extend:(t,e,n,{allOwnKeys:r}={})=>(js(e,(e,r)=>{n&&Ss(e)?Object.defineProperty(t,r,{value:cs(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&&hs(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:fs,kindOfTest:gs,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(ys(t))return t;let e=t.length;if(!Ts(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},forEachEntry:(t,e)=>{const n=(t&&t[ds]).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:Us,hasOwnProperty:Vs,hasOwnProp:Vs,reduceDescriptors:zs,freezeMethods:t=>{zs(t,(e,n)=>{if(Ss(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=t[n];Ss(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 ys(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:Ls,global:Fs,isContextDefined:$s,isSpecCompliantForm:function(t){return!!(t&&Ss(t.append)&&"FormData"===t[ps]&&t[ds])},toJSONObject:t=>{const e=new Array(10),n=(t,r)=>{if(ks(t)){if(e.indexOf(t)>=0)return;if(bs(t))return t;if(!("toJSON"in t)){e[r]=t;const i=ys(t)?[]:{};return js(t,(t,e)=>{const o=n(t,r+1);!vs(o)&&(i[e]=o)}),e[r]=void 0,i}}return t};return n(t,0)},isAsyncFn:Ws,isThenable:t=>t&&(ks(t)||Ss(t))&&Ss(t.then)&&Ss(t.catch),setImmediate:Js,asap:Zs,isIterable:t=>null!=t&&Ss(t[ds])};class ta extends Error{static from(t,e,n,r,i,o){const s=new ta(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:Qs.toJSONObject(this.config),code:this.code,status:this.status}}}ta.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",ta.ERR_BAD_OPTION="ERR_BAD_OPTION",ta.ECONNABORTED="ECONNABORTED",ta.ETIMEDOUT="ETIMEDOUT",ta.ERR_NETWORK="ERR_NETWORK",ta.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",ta.ERR_DEPRECATED="ERR_DEPRECATED",ta.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",ta.ERR_BAD_REQUEST="ERR_BAD_REQUEST",ta.ERR_CANCELED="ERR_CANCELED",ta.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",ta.ERR_INVALID_URL="ERR_INVALID_URL";const ea=ta;function na(t){return Qs.isPlainObject(t)||Qs.isArray(t)}function ra(t){return Qs.endsWith(t,"[]")?t.slice(0,-2):t}function ia(t,e,n){return t?t.concat(e).map(function(t,e){return t=ra(t),!n&&e?"["+t+"]":t}).join(n?".":""):e}const oa=Qs.toFlatObject(Qs,{},null,function(t){return/^is[A-Z]/.test(t)});const sa=function(t,e,n){if(!Qs.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const r=(n=Qs.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(t,e){return!Qs.isUndefined(e[t])})).metaTokens,i=n.visitor||c,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Qs.isSpecCompliantForm(e);if(!Qs.isFunction(i))throw new TypeError("visitor must be a function");function u(t){if(null===t)return"";if(Qs.isDate(t))return t.toISOString();if(Qs.isBoolean(t))return t.toString();if(!a&&Qs.isBlob(t))throw new ea("Blob is not supported. Use a Buffer instead.");return Qs.isArrayBuffer(t)||Qs.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(Qs.endsWith(n,"{}"))n=r?n:n.slice(0,-2),t=JSON.stringify(t);else if(Qs.isArray(t)&&function(t){return Qs.isArray(t)&&!t.some(na)}(t)||(Qs.isFileList(t)||Qs.endsWith(n,"[]"))&&(a=Qs.toArray(t)))return n=ra(n),a.forEach(function(t,r){!Qs.isUndefined(t)&&null!==t&&e.append(!0===s?ia([n],r,o):null===s?n:n+"[]",u(t))}),!1;return!!na(t)||(e.append(ia(i,n,o),u(t)),!1)}const l=[],h=Object.assign(oa,{defaultVisitor:c,convertValue:u,isVisitable:na});if(!Qs.isObject(t))throw new TypeError("data must be an object");return function t(n,r){if(!Qs.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),Qs.forEach(n,function(n,o){!0===(!(Qs.isUndefined(n)||null===n)&&i.call(e,n,Qs.isString(o)?o.trim():o,r,h))&&t(n,r?r.concat(o):[o])}),l.pop()}}(t),e};function aa(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}function ua(t,e){this._pairs=[],t&&sa(t,this,e)}const ca=ua.prototype;ca.append=function(t,e){this._pairs.push([t,e])},ca.toString=function(t){const e=t?function(e){return t.call(this,e,aa)}:aa;return this._pairs.map(function(t){return e(t[0])+"="+e(t[1])},"").join("&")};const la=ua;function ha(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function da(t,e,n){if(!e)return t;const r=n&&n.encode||ha,i=Qs.isFunction(n)?{serialize:n}:n,o=i&&i.serialize;let s;if(s=o?o(e,i):Qs.isURLSearchParams(e)?e.toString():new la(e,i).toString(r),s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t}const pa=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){Qs.forEach(this.handlers,function(e){null!==e&&t(e)})}},fa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ma={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:la,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},ga="undefined"!=typeof window&&"undefined"!=typeof document,_a="object"==typeof navigator&&navigator||void 0,ya=ga&&(!_a||["ReactNative","NativeScript","NS"].indexOf(_a.product)<0),va="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ba=ga&&window.location.href||"http://localhost",wa={...r,...ma};const xa=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&&Qs.isArray(r)?r.length:o,a)return Qs.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!s;r[o]&&Qs.isObject(r[o])||(r[o]=[]);return e(t,n,r[o],i)&&Qs.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(Qs.isFormData(t)&&Qs.isFunction(t.entries)){const n={};return Qs.forEachEntry(t,(t,r)=>{e(function(t){return Qs.matchAll(/\w+|\[(\w*)]/g,t).map(t=>"[]"===t[0]?"":t[1]||t[0])}(t),r,n,0)}),n}return null};const Sa={transitional:fa,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",r=n.indexOf("application/json")>-1,i=Qs.isObject(t);i&&Qs.isHTMLForm(t)&&(t=new FormData(t));if(Qs.isFormData(t))return r?JSON.stringify(xa(t)):t;if(Qs.isArrayBuffer(t)||Qs.isBuffer(t)||Qs.isStream(t)||Qs.isFile(t)||Qs.isBlob(t)||Qs.isReadableStream(t))return t;if(Qs.isArrayBufferView(t))return t.buffer;if(Qs.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 sa(t,new wa.classes.URLSearchParams,{visitor:function(t,e,n,r){return wa.isNode&&Qs.isBuffer(t)?(this.append(e,t.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...e})}(t,this.formSerializer).toString();if((o=Qs.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return sa(o?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||r?(e.setContentType("application/json",!1),function(t,e,n){if(Qs.isString(t))try{return(e||JSON.parse)(t),Qs.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||Sa.transitional,n=e&&e.forcedJSONParsing,r="json"===this.responseType;if(Qs.isResponse(t)||Qs.isReadableStream(t))return t;if(t&&Qs.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 ea.from(t,ea.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:wa.classes.FormData,Blob:wa.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Qs.forEach(["delete","get","head","post","put","patch"],t=>{Sa.headers[t]={}});const Ta=Sa,ka=Qs.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"]),Aa=Symbol("internals");function Ea(t){return t&&String(t).trim().toLowerCase()}function Oa(t){return!1===t||null==t?t:Qs.isArray(t)?t.map(Oa):String(t)}function Ca(t,e,n,r,i){return Qs.isFunction(r)?r.call(this,e,n):(i&&(e=n),Qs.isString(e)?Qs.isString(r)?-1!==e.indexOf(r):Qs.isRegExp(r)?r.test(e):void 0:void 0)}class Ma{constructor(t){t&&this.set(t)}set(t,e,n){const r=this;function i(t,e,n){const i=Ea(e);if(!i)throw new Error("header name must be a non-empty string");const o=Qs.findKey(r,i);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||e]=Oa(t))}const o=(t,e)=>Qs.forEach(t,(t,n)=>i(t,n,e));if(Qs.isPlainObject(t)||t instanceof this.constructor)o(t,e);else if(Qs.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]&&ka[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(Qs.isObject(t)&&Qs.isIterable(t)){let n,r,i={};for(const e of t){if(!Qs.isArray(e))throw TypeError("Object iterator must return a key-value pair");i[r=e[0]]=(n=i[r])?Qs.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=Ea(t)){const n=Qs.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(Qs.isFunction(e))return e.call(this,t,n);if(Qs.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=Ea(t)){const n=Qs.findKey(this,t);return!(!n||void 0===this[n]||e&&!Ca(0,this[n],n,e))}return!1}delete(t,e){const n=this;let r=!1;function i(t){if(t=Ea(t)){const i=Qs.findKey(n,t);!i||e&&!Ca(0,n[i],i,e)||(delete n[i],r=!0)}}return Qs.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&&!Ca(0,this[i],i,t,!0)||(delete this[i],r=!0)}return r}normalize(t){const e=this,n={};return Qs.forEach(this,(r,i)=>{const o=Qs.findKey(n,i);if(o)return e[o]=Oa(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]=Oa(r),n[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return Qs.forEach(this,(n,r)=>{null!=n&&!1!==n&&(e[r]=t&&Qs.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[Aa]=this[Aa]={accessors:{}}).accessors,n=this.prototype;function r(t){const r=Ea(t);e[r]||(!function(t,e){const n=Qs.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 Qs.isArray(t)?t.forEach(r):r(t),this}}Ma.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Qs.reduceDescriptors(Ma.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}}),Qs.freezeMethods(Ma);const Ia=Ma;function Na(t,e){const n=this||Ta,r=e||n,i=Ia.from(r.headers);let o=r.data;return Qs.forEach(t,function(t){o=t.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function Ra(t){return!(!t||!t.__CANCEL__)}const Da=class extends ea{constructor(t,e,n){super(null==t?"canceled":t,ea.ERR_CANCELED,e,n),this.name="CanceledError",this.__CANCEL__=!0}};function Pa(t,e,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?e(new ea("Request failed with status code "+n.status,[ea.ERR_BAD_REQUEST,ea.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}const ja=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 La=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)]},Fa=(t,e,n=3)=>{let r=0;const i=ja(50,250);return La(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)},$a=(t,e)=>{const n=null!=t;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Ba=t=>(...e)=>Qs.asap(()=>t(...e)),qa=wa.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,wa.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(wa.origin),wa.navigator&&/(msie|trident)/i.test(wa.navigator.userAgent)):()=>!0,Ua=wa.hasStandardBrowserEnv?{write(t,e,n,r,i,o,s){if("undefined"==typeof document)return;const a=[`${t}=${encodeURIComponent(e)}`];Qs.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),Qs.isString(r)&&a.push(`path=${r}`),Qs.isString(i)&&a.push(`domain=${i}`),!0===o&&a.push("secure"),Qs.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 Va(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 Ga=t=>t instanceof Ia?{...t}:t;function za(t,e){e=e||{};const n={};function r(t,e,n,r){return Qs.isPlainObject(t)&&Qs.isPlainObject(e)?Qs.merge.call({caseless:r},t,e):Qs.isPlainObject(e)?Qs.merge({},e):Qs.isArray(e)?e.slice():e}function i(t,e,n,i){return Qs.isUndefined(e)?Qs.isUndefined(t)?void 0:r(void 0,t,0,i):r(t,e,0,i)}function o(t,e){if(!Qs.isUndefined(e))return r(void 0,e)}function s(t,e){return Qs.isUndefined(e)?Qs.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(Ga(t),Ga(e),0,!0)};return Qs.forEach(Object.keys({...t,...e}),function(r){const o=u[r]||i,s=o(t[r],e[r],r);Qs.isUndefined(s)&&o!==a||(n[r]=s)}),n}const Wa=t=>{const e=za({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=e;if(e.headers=s=Ia.from(s),e.url=da(Va(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Qs.isFormData(n))if(wa.hasStandardBrowserEnv||wa.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(Qs.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(wa.hasStandardBrowserEnv&&(r&&Qs.isFunction(r)&&(r=r(e)),r||!1!==r&&qa(e.url))){const t=i&&o&&Ua.read(o);t&&s.set(i,t)}return e},Ja="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise(function(e,n){const r=Wa(t);let i=r.data;const o=Ia.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=Ia.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Pa(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 ea("Request aborted",ea.ECONNABORTED,t,m)),m=null)},m.onerror=function(e){const r=e&&e.message?e.message:"Network Error",i=new ea(r,ea.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||fa;r.timeoutErrorMessage&&(e=r.timeoutErrorMessage),n(new ea(e,i.clarifyTimeoutError?ea.ETIMEDOUT:ea.ECONNABORTED,t,m)),m=null},void 0===i&&o.setContentType(null),"setRequestHeader"in m&&Qs.forEach(o.toJSON(),function(t,e){m.setRequestHeader(e,t)}),Qs.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),h&&"json"!==h&&(m.responseType=r.responseType),p&&([u,l]=Fa(p,!0),m.addEventListener("progress",u)),d&&m.upload&&([a,c]=Fa(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(r.cancelToken||r.signal)&&(s=e=>{m&&(n(!e||e.type?new Da(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===wa.protocols.indexOf(_)?n(new ea("Unsupported protocol "+_+":",ea.ERR_BAD_REQUEST,t)):m.send(i||null)})},Ha=(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 ea?e:new Da(e instanceof Error?e.message:e))}};let o=e&&setTimeout(()=>{o=null,i(new ea(`timeout of ${e}ms exceeded`,ea.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=()=>Qs.asap(s),a}},Xa=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},Ka=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()}},Ya=(t,e,n,r)=>{const i=async function*(t,e){for await(const n of Ka(t))yield*Xa(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:Za}=Qs,Qa=(({Request:t,Response:e})=>({Request:t,Response:e}))(Qs.global),{ReadableStream:tu,TextEncoder:eu}=Qs.global,nu=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},ru=t=>{t=Qs.merge.call({skipUndefined:!0},Qa,t);const{fetch:e,Request:n,Response:r}=t,i=e?Za(e):"function"==typeof fetch,o=Za(n),s=Za(r);if(!i)return!1;const a=i&&Za(tu),u=i&&("function"==typeof eu?(c=new eu,t=>c.encode(t)):async t=>new Uint8Array(await new n(t).arrayBuffer()));var c;const l=o&&a&&nu(()=>{let t=!1;const e=new n(wa.origin,{body:new tu,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),h=s&&a&&nu(()=>Qs.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 ea(`Response type '${t}' is not supported`,ea.ERR_NOT_SUPPORT,n)})});const p=async(t,e)=>{const r=Qs.toFiniteNumber(t.getContentLength());return null==r?(async t=>{if(null==t)return 0;if(Qs.isBlob(t))return t.size;if(Qs.isSpecCompliantForm(t)){const e=new n(wa.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return Qs.isArrayBufferView(t)||Qs.isArrayBuffer(t)?t.byteLength:(Qs.isURLSearchParams(t)&&(t+=""),Qs.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}=Wa(t),w=e||fetch;_=_?(_+"").toLowerCase():"text";let x=Ha([u,c&&c.toAbortSignal()],f),S=null;const T=x&&x.unsubscribe&&(()=>{x.unsubscribe()});let k;try{if(g&&l&&"get"!==s&&"head"!==s&&0!==(k=await p(y,a))){let t,e=new n(i,{method:"POST",body:a,duplex:"half"});if(Qs.isFormData(a)&&(t=e.headers.get("content-type"))&&y.setContentType(t),e.body){const[t,n]=$a(k,Fa(Ba(g)));a=Ya(e.body,65536,t,n)}}Qs.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};S=o&&new n(i,u);let c=await(o?w(S,b):w(i,u));const f=h&&("stream"===_||"response"===_);if(h&&(m||f&&T)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=c[e]});const e=Qs.toFiniteNumber(c.headers.get("content-length")),[n,i]=m&&$a(e,Fa(Ba(m),!0))||[];c=new r(Ya(c.body,65536,n,()=>{i&&i(),T&&T()}),t)}_=_||"text";let A=await d[Qs.findKey(d,_)||"text"](c,t);return!f&&T&&T(),await new Promise((e,n)=>{Pa(e,n,{data:A,headers:Ia.from(c.headers),status:c.status,statusText:c.statusText,config:t,request:S})})}catch(e){if(T&&T(),e&&"TypeError"===e.name&&/Load failed|fetch/i.test(e.message))throw Object.assign(new ea("Network Error",ea.ERR_NETWORK,t,S),{cause:e.cause||e});throw ea.from(e,e&&e.code,t,S)}}},iu=new Map,ou=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=iu;for(;u--;)s=o[u],a=c.get(s),void 0===a&&c.set(s,a=u?new Map:ru(e)),c=a;return a},su=(ou(),{http:null,xhr:Ja,fetch:{get:ou}});Qs.forEach(su,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}});const au=t=>`- ${t}`,uu=t=>Qs.isFunction(t)||null===t||!1===t;const cu={getAdapter:function(t,e){t=Qs.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,!uu(r)&&(i=su[(n=String(r)).toLowerCase()],void 0===i))throw new ea(`Unknown adapter '${n}'`);if(i&&(Qs.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(au).join("\n"):" "+au(t[0]):"as no adapter specified";throw new ea("There is no suitable adapter to dispatch the request "+e,"ERR_NOT_SUPPORT")}return i},adapters:su};function lu(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Da(null,t)}function hu(t){lu(t),t.headers=Ia.from(t.headers),t.data=Na.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return cu.getAdapter(t.adapter||Ta.adapter,t)(t).then(function(e){return lu(t),e.data=Na.call(t,t.transformResponse,e),e.headers=Ia.from(e.headers),e},function(e){return Ra(e)||(lu(t),e&&e.response&&(e.response.data=Na.call(t,t.transformResponse,e.response),e.response.headers=Ia.from(e.response.headers))),Promise.reject(e)})}const du="1.13.4",pu={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{pu[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const fu={};pu.transitional=function(t,e,n){return(r,i,o)=>{if(!1===t)throw new ea(function(t,e){return"[Axios v"+du+"] Transitional option '"+t+"'"+e+(n?". "+n:"")}(i," has been removed"+(e?" in "+e:"")),ea.ERR_DEPRECATED);return e&&!fu[i]&&(fu[i]=!0),!t||t(r,i,o)}},pu.spelling=function(t){return(t,e)=>!0};const mu={assertOptions:function(t,e,n){if("object"!=typeof t)throw new ea("options must be an object",ea.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 ea("option "+o+" must be "+n,ea.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new ea("Unknown option "+o,ea.ERR_BAD_OPTION)}},validators:pu},gu=mu.validators;class _u{constructor(t){this.defaults=t||{},this.interceptors={request:new pa,response:new pa}}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=za(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:i}=e;void 0!==n&&mu.assertOptions(n,{silentJSONParsing:gu.transitional(gu.boolean),forcedJSONParsing:gu.transitional(gu.boolean),clarifyTimeoutError:gu.transitional(gu.boolean)},!1),null!=r&&(Qs.isFunction(r)?e.paramsSerializer={serialize:r}:mu.assertOptions(r,{encode:gu.function,serialize:gu.function},!0)),void 0!==e.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),mu.assertOptions(e,{baseUrl:gu.spelling("baseURL"),withXsrfToken:gu.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=i&&Qs.merge(i.common,i[e.method]);i&&Qs.forEach(["delete","get","head","post","put","patch","common"],t=>{delete i[t]}),e.headers=Ia.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=[hu.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=hu.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 da(Va((t=za(this.defaults,t)).baseURL,t.url,t.allowAbsoluteUrls),t.params,t.paramsSerializer)}}Qs.forEach(["delete","get","head","options"],function(t){_u.prototype[t]=function(e,n){return this.request(za(n||{},{method:t,url:e,data:(n||{}).data}))}}),Qs.forEach(["post","put","patch"],function(t){function e(e){return function(n,r,i){return this.request(za(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}_u.prototype[t]=e(),_u.prototype[t+"Form"]=e(!0)});const yu=_u;class vu{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 Da(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 vu(function(e){t=e}),cancel:t}}}const bu=vu;const wu={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(wu).forEach(([t,e])=>{wu[e]=t});const xu=wu;const Su=function t(e){const n=new yu(e),r=cs(yu.prototype.request,n);return Qs.extend(r,yu.prototype,n,{allOwnKeys:!0}),Qs.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return t(za(e,n))},r}(Ta);Su.Axios=yu,Su.CanceledError=Da,Su.CancelToken=bu,Su.isCancel=Ra,Su.VERSION=du,Su.toFormData=sa,Su.AxiosError=ea,Su.Cancel=Su.CanceledError,Su.all=function(t){return Promise.all(t)},Su.spread=function(t){return function(e){return t.apply(null,e)}},Su.isAxiosError=function(t){return Qs.isObject(t)&&!0===t.isAxiosError},Su.mergeConfig=za,Su.AxiosHeaders=Ia,Su.formToJSON=t=>xa(Qs.isHTMLForm(t)?new FormData(t):t),Su.getAdapter=cu.getAdapter,Su.HttpStatusCode=xu,Su.default=Su;const Tu=Su,ku=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in mediaplayer.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/mediaplayer.js"},{}),Au=t=>{const e=t[qg.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[qg.REFNODE]};return{leaflogic:(e,i)=>{const o=k_(i,e,void 0,r,{leaflogic:n,datalogic:{post:e=>(t[qg.mediaplayer.URI]=e,e)}})._control,s=new _t(ku),a=o._stream.pipe(at(...e.map(t=>t._stream)),ut(t=>{const e=t[1];return s.next(e),t[0]}));return{_stream:s,_control:{_stream:a}}},datalogic:{pre:t=>t,post:e=>Ug({element:{nodeuuid:t[qg.REFNODE],type:"mediaplayer",componentdata:{uri:t[qg.mediaplayer.URI],...t[qg.RTCONTEXT]}}},"screenio")}}},Eu=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in prompt.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/prompt.js"},{}),Ou=t=>{const e=t[qg.LAMBDA_OBJ],n="uidefs"in e&&"_default"in e.uidefs?e.uidefs._default:void 0,r=new dt,i={codebase:"ghostos/api/parser/nodelogic/elements/library/prompt.js",refnode:t[qg.REFNODE]};return{elementio$:r,leaflogic:(o,s)=>{const a=new dt,u=n?k_(s,o,void 0,i,{leaflogic:n,datalogic:{post:e=>(t[qg.prompt.UIDEFS]=e,e)}}):{_stream:He('[ ; 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}},c=u._control._stream.pipe(at(u._stream),ct(n=>{const i=n[1];t[qg.CTRLIN]=n[0];const o=e.margin?Object.keys(e.margin):void 0,s=e.fieldwidth?Object.keys(e.fieldwidth):void 0,a=Ue(i)&&"error"===i._bname?void 0:Array.isArray(i)?Ug({element:{nodeuuid:t[qg.REFNODE],type:"prompt",componentdata:{nodeuuid:t[qg.REFNODE],uidefs:i,margin:o?o[0]:1,fieldwidth:s?s[0]:"25ch",...t[qg.RTCONTEXT]}}},"screenio"):void 0;return a?Et(He(a),r):r}),ut(e=>(a.next(e),t[qg.CTRLIN])),ft());return{_stream:a.pipe(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Eu)),ut(t=>t),ft()),_control:{_stream:c.pipe(ut(t=>t),ft())}}},datalogic:{pre:t=>t,post:t=>t}}},Cu=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in popup.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/popup.js"},{}),Mu=t=>{const e=t[qg.LAMBDA_OBJ],n=new dt,r=new dt;return{elementio$:r,leaflogic:(i,o)=>{const s=o._stream.pipe(at(...i.map(t=>t._stream)),ct(t=>rn(new _t(t[0]),Et(new _t(t[1]),r))),ct(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(Ue(n)){if("screenio"===n._bname){const i=Tn("screenio",n);return Ug({element:{nodeuuid:t[qg.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 v_(n,[],{...t[qg.RTCONTEXT]._config}):[];return r.next(Sn("elementio",{element:"popup",nodeuuid:t[qg.REFNODE],io:{onclose:i}})),i},children:Array.isArray(i)?i:[i],...t[qg.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]),He(i[0])}));return{_stream:n.pipe(gt(t=>JSON.stringify(t)!==JSON.stringify(Cu)),ut(t=>t)),_control:{_stream:s}}},datalogic:{pre:t=>t,post:t=>t}}},Iu=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in editor.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/editor.js"},{}),Nu=t=>({leaflogic:(e,n)=>{const r=new _t(Iu),i=n._stream.pipe(Xe(n=>{t[qg.CTRLIN]=n;return rn([...e.map(t=>t._stream)])}),ut(e=>(e.length>1?r.next(e):1===e.length&&r.next(e[0]),t[qg.CTRLIN])));return{_stream:r,_control:{_stream:i}}},datalogic:{pre:t=>t,post:e=>Ug({element:{nodeuuid:t[qg.REFNODE],type:"editor",componentdata:{domain:t[qg.DOMAIN],appid:t[qg.APPID],...t[qg.RTCONTEXT]}}},"screenio")}}),Ru=t=>{const e=t[qg.LAMBDA_OBJ];return{leaflogic:(t,e)=>{const n=new dt,r=e._stream.pipe(at(...t.map(t=>t._stream)),ut(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="lambda"in e?"lambda":"dataflow";let i;Ue(n)&&n._content?._provenance?.refnodedata?(t[qg.RTCONTEXT].lambdarefnodedata=n._content?._provenance?.refnodedata,t[qg.RTCONTEXT].lambdasourceuuid=n._content?._refnode,i=n):i=n;return Ug({element:{nodeuuid:t[qg.REFNODE],type:"text",componentdata:{refnode:t[qg.REFNODE],textsource:r,lambdarefnodedata:t[qg.RTCONTEXT].lambdarefnodedata,lambdasourceuuid:t[qg.RTCONTEXT].lambdasourceuuid,dataflowinput:i,domain:t[qg.DOMAIN],appid:t[qg.APPID],...t[qg.RTCONTEXT]}}},"screenio")}}}},Du=t=>({leaflogic:(e,n)=>{const r=new dt,i=n._stream.pipe(at(...e.map(t=>t._stream)),ut(e=>{t[qg.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(Ue(t)&&"image"===t._bname)return Tn("image",t)}).filter(t=>t);return 1===e.length?e[0]:e.length>1?e:void 0},post:e=>Ug({element:{nodeuuid:t[qg.REFNODE],type:"image",componentdata:{imagelist:Array.isArray(e)?e:[e],...t[qg.RTCONTEXT]}}},"screenio")}});function Pu(t){return g(function(e,n){try{e.subscribe(n)}finally{n.add(t)}})}const ju=t=>{const e=t[qg.LAMBDA_OBJ],n=new dt;return{elementio$:n,leaflogic:(r,i)=>{const o=new dt,s=i._stream.pipe(at(...r.map(t=>t._stream)),ct(r=>{t[qg.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=Ug({element:{nodeuuid:t[qg.REFNODE],type:"mediainput",componentdata:{mediatype:a,nodeinput:c,callbacks:{onDropAccepted:async r=>{const i=e.ondrop?._default?await v_(e.ondrop._default,[Sn("elementinput",r),Sn("nodeinput",c)],{},t[qg.REFNODE]):void 0,o=Sn("elementio",i);n.next(o)}}}}},"screenio");return l?Et(new _t(l),n):n}),ct(e=>(o.next(e),new _t(t[qg.CTRLIN]))),ft());return{_stream:o.pipe(ut(t=>t),Pu(()=>{}),ft()),_control:{_stream:s.pipe(ut(t=>t),Pu(()=>{}),ft())}}},datalogic:{pre:t=>t,post:t=>{let e=t;return e=1===e.length?e[0]:e,e}}}};var Lu=n(7799);const{JZZ:Fu}=Lu,$u=t=>{const e=new dt;let n=-1;const r=t=>{n=(n+1)%24;const[r,i,o]=t;e.next(Sn("_midi_in",{cmd:r,noteNumber:i,velocity:o},{timestamp:Date.now()}))},i={};return{leaflogic:(n,o)=>{const s=new dt,a=o._stream.pipe(ct(o=>{t[qg.CTRLIN]=o,"default"in i||(i.default=Fu().openMidiIn().or("Error: Cannot open MIDI In port").and(t=>{}).connect(r));return Et(...n.map(t=>t._stream),e)}),ut(e=>{!Array.isArray(e)&&e._bname;const n=(Array.isArray(e)?e:[e]).map(t=>"_data_in"===t._bname?Ge(t._content)?void 0:Tn("*",t):Ue(t)?t:void 0).filter(t=>t);return n.length>0&&s.next(n),t[qg.CTRLIN]}),ft());return{_stream:s,_control:{_stream:a}}},datalogic:{pre:t=>Sn("_data_in",t),post:t=>{let e=t;e=1===e.length?e[0]:e;return e}}}},Bu="15.1.22";var qu=n(1795);const Uu=new WeakSet,Vu=new WeakMap,Gu=new WeakMap,zu=new WeakMap,Wu=new WeakMap,Ju=new WeakMap,Hu=new WeakMap,Xu=new WeakMap,Ku=new WeakMap,Yu=new WeakMap,Zu={construct:()=>Zu},Qu=/^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]*);?/,tc=(t,e)=>{const n=[];let r=t.replace(/^[\s]+/,""),i=r.match(Qu);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(Qu)}return[n.join(";"),r]},ec=t=>{if(void 0!==t&&!Array.isArray(t))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},nc=t=>{if(!(t=>{try{new new Proxy(t,Zu)}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.")},rc=(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},ic=(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},oc=(t,e,n,r)=>{const i=rc(t,e),o=ic(i,t=>t[0]===n&&t[1]===r);return 0===i.size&&t.delete(e),o},sc=t=>rc(Hu,t),ac=t=>{if(Uu.has(t))throw new Error("The AudioNode is already stored.");Uu.add(t),sc(t).forEach(t=>t(!0))},uc=t=>"port"in t,cc=t=>{if(!Uu.has(t))throw new Error("The AudioNode is not stored.");Uu.delete(t),sc(t).forEach(t=>t(!1))},lc=(t,e)=>{!uc(t)&&e.every(t=>0===t.size)&&cc(t)},hc={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},dc=(t,e)=>t.context===e,pc=t=>{try{t.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},fc=()=>new DOMException("","IndexSizeError"),mc=t=>{var e;t.getChannelData=(e=t.getChannelData,n=>{try{return e.call(t,n)}catch(t){if(12===t.code)throw fc();throw t}})},gc={numberOfChannels:1},_c=-34028234663852886e22,yc=-_c,vc=t=>Uu.has(t),bc={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},wc=t=>rc(Vu,t),xc=t=>rc(zu,t),Sc=(t,e)=>{const{activeInputs:n}=wc(t);n.forEach(n=>n.forEach(([n])=>{e.includes(t)||Sc(n,[...e,t])}));const r=(t=>"playbackRate"in t)(t)?[t.playbackRate]:uc(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=xc(t);void 0!==n&&n.activeInputs.forEach(([t])=>Sc(t,e))}vc(t)&&cc(t)},Tc=t=>{Sc(t.destination,[])},kc=t=>void 0===t||"number"==typeof t||"string"==typeof t&&("balanced"===t||"interactive"===t||"playback"===t),Ac=t=>"context"in t,Ec=t=>Ac(t[0]),Oc=(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},Cc=(t,e,[n,r],i)=>{Oc(t,[e,n,r],t=>t[0]===e&&t[1]===n,i)},Mc=(t,[e,n,r],i)=>{const o=t.get(e);void 0===o?t.set(e,new Set([[n,r]])):Oc(o,[n,r],t=>t[0]===n,i)},Ic=t=>"inputs"in t,Nc=(t,e,n,r)=>{if(Ic(e)){const i=e.inputs[r];return t.connect(i,n,0),[i,n,0]}return t.connect(e,n,r),[e,n,r]},Rc=(t,e,n)=>{for(const r of t)if(r[0]===e&&r[1]===n)return t.delete(r),r;return null},Dc=(t,e)=>{if(!sc(t).delete(e))throw new Error("Missing the expected event listener.")},Pc=(t,e,n)=>{const r=rc(t,e),i=ic(r,t=>t[0]===n);return 0===r.size&&t.delete(e),i},jc=(t,e,n,r)=>{Ic(e)?t.disconnect(e.inputs[r],n,0):t.disconnect(e,n,r)},Lc=t=>rc(Gu,t),Fc=t=>rc(Wu,t),$c=t=>Xu.has(t),Bc=t=>!Uu.has(t),qc=(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()}}),Uc=(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))},Vc=t=>"context"in t,Gc=t=>{const e=new Map;t.connect=(t=>(n,r=0,i=0)=>{const o=Vc(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=>{Vc(n)?t.connect(n,e.output,e.input):t.connect(n,e.output)})})(t.disconnect)},zc=(t,e,n,r)=>{const{activeInputs:i,passiveInputs:o}=xc(e),{outputs:s}=wc(t),a=sc(t),u=s=>{const a=Lc(t),u=Fc(e);if(s){const e=Pc(o,t,n);Cc(i,t,e,!1),r||$c(t)||a.connect(u,n)}else{const e=((t,e,n)=>ic(t,t=>t[0]===e&&t[1]===n))(i,t,n);Mc(o,e,!1),r||$c(t)||a.disconnect(u,n)}};return!!Oc(s,[e,n],t=>t[0]===e&&t[1]===n,!0)&&(a.add(u),vc(t)?Cc(i,t,[n,u],!0):Mc(o,[t,n,u],!0),!0)},Wc=(t,e,n,r,i)=>{const[o,s]=((t,e,n,r)=>{const{activeInputs:i,passiveInputs:o}=wc(e),s=Rc(i[r],t,n);if(null===s)return[oc(o,t,n,r)[2],!1];return[s[2],!0]})(t,n,r,i);if(null!==o&&(Dc(t,o),!s||e||$c(t)||jc(Lc(t),Lc(n),r,i)),vc(n)){const{activeInputs:t}=wc(n);lc(n,t)}},Jc=(t,e,n,r)=>{const[i,o]=((t,e,n)=>{const{activeInputs:r,passiveInputs:i}=xc(e),o=Rc(r,t,n);if(null===o)return[Pc(i,t,n)[1],!1];return[o[2],!0]})(t,n,r);null!==i&&(Dc(t,i),!o||e||$c(t)||Lc(t).disconnect(Fc(n),r))};class Hc{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 Xc={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}};function Kc(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 Yc=(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)},Zc=(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},Qc=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=wc(t),d=await((t,e)=>{const n=rc(Yu,t),r=Lc(e);return rc(n,r)})(n,t),p=Zc(r.numberOfInputs,r.channelCount),f=Zc(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)Kc(e,p[t],n,n,c);void 0!==o.parameterDescriptors&&null!==e&&o.parameterDescriptors.forEach(({name:t},n)=>{Kc(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)Yc(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},tl={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},el={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},nl={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},rl={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},il={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},ol=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()}})},sl={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},al=(t,e,n)=>{const r=e[n];if(void 0===r)throw t();return r},ul={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},cl={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},ll=()=>new DOMException("","InvalidStateError"),hl=()=>new DOMException("","InvalidAccessError"),dl={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},pl=(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},fl={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},ml=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},gl={numberOfChannels:1},_l=(t,e,n)=>{const r=e[n];void 0!==r&&r!==t[n]&&(t[n]=r)},yl=(t,e)=>{_l(t,e,"channelCount"),_l(t,e,"channelCountMode"),_l(t,e,"channelInterpretation")},vl=t=>"function"==typeof t.getFloatTimeDomainData,bl=(t,e,n)=>{const r=e[n];void 0!==r&&r!==t[n].value&&(t[n].value=r)},wl=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)},xl=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)})},Sl=(t,e)=>null===t?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(t*e))))),Tl=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)},kl=(t,e)=>{const n=t.createBiquadFilter();return yl(n,e),bl(n,e,"Q"),bl(n,e,"detune"),bl(n,e,"frequency"),bl(n,e,"gain"),_l(n,e,"type"),n},Al=(t,e)=>{const n=t.createChannelSplitter(e.numberOfOutputs);return yl(n,e),(t=>{const e=t.numberOfOutputs;Object.defineProperty(t,"channelCount",{get:()=>e,set:t=>{if(t!==e)throw ll()}}),Object.defineProperty(t,"channelCountMode",{get:()=>"explicit",set:t=>{if("explicit"!==t)throw ll()}}),Object.defineProperty(t,"channelInterpretation",{get:()=>"discrete",set:t=>{if("discrete"!==t)throw ll()}})})(n),n},El=(t,e)=>(t.connect=e.connect.bind(e),t.disconnect=e.disconnect.bind(e),t),Ol=(t,e)=>{const n=t.createDelay(e.maxDelayTime);return yl(n,e),bl(n,e,"delayTime"),n},Cl=(t,e)=>{const n=t.createGain();return yl(n,e),bl(n,e,"gain"),n};function Ml(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 Il(t,e){return[t[0]*e[0]-t[1]*e[1],t[0]*e[1]+t[1]*e[0]]}function Nl(t,e){let n=[0,0];for(let r=t.length-1;r>=0;r-=1)n=Il(n,e),n[0]+=t[r];return n}const Rl=(t,e,n,r)=>t.createScriptProcessor(e,n,r),Dl=()=>new DOMException("","NotSupportedError"),Pl={numberOfChannels:1},jl={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},Ll={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},Fl={disableNormalization:!1},$l={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},Bl=()=>new DOMException("","UnknownError"),ql={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},Ul=(t,e,n)=>void 0===t.copyFromChannel?t.getChannelData(n)[0]:(t.copyFromChannel(e,n),e[0]),Vl=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},Gl=(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)})},zl=(t,e,n)=>{try{t.setValueAtTime(e,n)}catch(r){if(9!==r.code)throw r;zl(t,e,n+1e-7)}},Wl=t=>{const e=t.createOscillator();try{e.start(-1)}catch(t){return t instanceof RangeError}return!1},Jl=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}},Hl=t=>{const e=t.createOscillator();try{e.stop(-1)}catch(t){return t instanceof RangeError}return!1},Xl=(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),El(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)},Kl=(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 Yl=(t=>(e,n,[r,i,o],s)=>{t(e[i],[n,r,o],t=>t[0]===n&&t[1]===r,s)})(Oc),Zl=(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)})(Oc),Ql=(t=>(e,n,r,i)=>t(e[i],t=>t[0]===n&&t[1]===r))(ic),th=new WeakMap,eh=(t=>e=>{var n;return null!==(n=t.get(e))&&void 0!==n?n:0})(th),nh=(rh=new Map,ih=new WeakMap,(t,e)=>{const n=ih.get(t);if(void 0!==n)return n;const r=rh.get(t);if(void 0!==r)return r;try{const n=e();return n instanceof Promise?(rh.set(t,n),n.catch(()=>!1).then(e=>(rh.delete(t),ih.set(t,e),e))):(ih.set(t,n),n)}catch{return ih.set(t,!1),!1}});var rh,ih;const oh="undefined"==typeof window?null:window,sh=((t,e)=>(n,r)=>{const i=n.createAnalyser();if(yl(i,r),!(r.maxDecibels>r.minDecibels))throw e();return _l(i,r,"fftSize"),_l(i,r,"maxDecibels"),_l(i,r,"minDecibels"),_l(i,r,"smoothingTimeConstant"),t(vl,()=>vl(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})(nh,fc),ah=(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})(wc),uh=((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],[]))})(wc,ah,$c),ch=((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(!dc(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)}}})(sh,Lc,uh),lh=(hh=Ju,t=>{const e=hh.get(t);if(void 0===e)throw ll();return e});var hh;const dh=(t=>null===t?null:t.hasOwnProperty("OfflineAudioContext")?t.OfflineAudioContext:t.hasOwnProperty("webkitOfflineAudioContext")?t.webkitOfflineAudioContext:null)(oh),ph=(t=>e=>null!==t&&e instanceof t)(dh),fh=new WeakMap,mh=(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)}})(Kl),gh=(t=>null===t?null:t.hasOwnProperty("AudioContext")?t.AudioContext:t.hasOwnProperty("webkitAudioContext")?t.webkitAudioContext:null)(oh),_h=(t=>e=>null!==t&&e instanceof t)(gh),yh=(t=>e=>null!==t&&"function"==typeof t.AudioNode&&e instanceof t.AudioNode)(oh),vh=(t=>e=>null!==t&&"function"==typeof t.AudioParam&&e instanceof t.AudioParam)(oh),bh=(t=>null===t?null:t.hasOwnProperty("AudioWorkletNode")?t.AudioWorkletNode:null)(oh),wh=((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(qc,()=>qc(s,m))&&Gc(i),Gu.set(this,i),Hu.set(this,new Set),"closed"!==e.state&&r&&ac(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(Ac(t)){const i=Lc(t);try{const e=Nc(this._nativeAudioNode,i,n,a),r=Bc(this);(h||r)&&this._nativeAudioNode.disconnect(...e),"closed"!==this.context.state&&!r&&Bc(t)&&ac(t)}catch(t){if(12===t.code)throw o();throw t}if(e(this,t,n,a,h)){const e=u([this],t);Uc(e,r(h))}return t}const m=Fc(t);if("playbackRate"===m.name&&1024===m.maxValue)throw s();try{this._nativeAudioNode.connect(m,n),(h||Bc(this))&&this._nativeAudioNode.disconnect(m,n)}catch(t){if(12===t.code)throw o();throw t}if(zc(this,t,n,h)){const e=u([this],t);Uc(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=wc(t),r=[];for(const i of n.outputs)Ec(i)?Wc(t,e,...i):Jc(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=wc(t),i=[];for(const o of r.outputs)o[1]===n&&(Ec(o)?Wc(t,e,...o):Jc(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(Ac(t)&&void 0!==n&&(n<0||n>=t.numberOfInputs))throw i();if(r=((t,e,n,r,i)=>{const o=wc(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=>(Ec(n)?Wc(t,e,...n):Jc(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);Uc(e,a)}}})((xh=Vu,(t,e,n)=>{const r=[];for(let t=0;t<n.numberOfInputs;t+=1)r.push(new Set);xh.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),S=o=>{const a=u(m),c=u(f);if(o){const e=oc(b,f,g,_);t(v,f,e,!1),y||h(f)||n(c,a,g,_),d(m)&&ac(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)&&lc(m,v);else{const t=p.get(m);void 0!==t&&clearTimeout(t),p.set(m,setTimeout(()=>{l(m)&&lc(m,v)},1e3*n))}}};return!!c(w,[m,g,_],t=>t[0]===m&&t[1]===g&&t[2]===_,!0)&&(x.add(S),l(f)?t(v,f,[g,_,S],!0):e(b,_,[f,g,S],!0),!0)}})(Yl,Zl,Nc,Ql,jc,wc,eh,sc,Lc,Oc,vc,$c,Bc),nh,((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(Ec(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)})(Xu,jc,wc,Lc,Fc,vc),fc,hl,Dl,((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(Ec(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)})(Nc,Xu,wc,Lc,Fc,lh,vc,ph),((t,e,n)=>function r(i,o){const s=Ac(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),[])})(fh,wc,rc),mh,lh,_h,yh,vh,ph,bh);var xh;const Sh=((t,e,n,r,i,o)=>class extends t{constructor(t,n){const s=i(t),a={...hc,...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)}})(wh,ch,fc,sh,lh,ph),Th=new WeakSet,kh=(t=>null===t?null:t.hasOwnProperty("AudioBuffer")?t.AudioBuffer:null)(oh),Ah=(Eh=new Uint32Array(1),t=>(Eh[0]=t,Eh[0]));var Eh;const Oh=((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]}})(Ah,fc),Ch=(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)})(Ah),Mh=((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}={...gc,...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),mc(p)):e(pc,()=>pc(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)}}})(Th,nh,Dl,kh,dh,(t=>()=>{if(null===t)return!1;try{new t({length:1,sampleRate:44100})}catch{return!1}return!0})(kh),Oh,Ch),Ih=(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)})(Cl),Nh=((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)}))})(ah,xc,$c),Rh=(t=>(e,n,r)=>t(n,e,r))(Nh),Dh=((t,e,n,r,i,o,s,a,u,c,l)=>(h,d)=>{const p=h.createBufferSource();return yl(p,d),bl(p,d,"playbackRate"),_l(p,d,"buffer"),_l(p,d,"loop"),_l(p,d,"loopEnd"),_l(p,d,"loopStart"),e(n,()=>n(h))||(t=>{t.start=(e=>{let n=!1;return(r=0,i=0,o)=>{if(n)throw ll();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))||wl(p),e(s,()=>s(h))||l(p,h),e(a,()=>a(h))||xl(p),t(h,p),p})(Ih,nh,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},Wl,Jl,Hl,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))})(Gl),Xl),Ph=((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})(xc),Nh),jh=((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=dc(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)}}})(Rh,Dh,Lc,Ph,uh),Lh=((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 qu.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})((Fh=zu,(t,e)=>{Fh.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:e})}),fh,Wu,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)}}}}),qu.createCancelAndHoldAutomationEvent,qu.createCancelScheduledValuesAutomationEvent,qu.createExponentialRampToValueAutomationEvent,qu.createLinearRampToValueAutomationEvent,qu.createSetTargetAutomationEvent,qu.createSetValueAutomationEvent,qu.createSetValueCurveAutomationEvent,gh,zl);var Fh;const $h=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,r){const a=o(t),u={...bc,...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,yc,_c)}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){ac(this);const t=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",t),vc(this)&&cc(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeAudioBufferSourceNode.stop(t),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.stop=t)}})(wh,jh,Lh,ll,Dh,lh,ph,Kl),Bh=((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}})(wh,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)}}},fc,ll,((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})(Cl,Gl),lh,ph,uh),qh=((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=dc(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)}}})(Rh,kl,Lc,Ph,uh),Uh=(t=>(e,n)=>t.set(e,n))(th),Vh=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,r){const u=o(t),c={...tl,...r},l=i(u,c),h=s(u);super(t,!1,l,h?n():null),this._Q=e(this,h,l.Q,yc,_c),this._detune=e(this,h,l.detune,1200*Math.log2(yc),-1200*Math.log2(yc)),this._frequency=e(this,h,l.frequency,t.sampleRate/2,0),this._gain=e(this,h,l.gain,40*Math.log10(yc),_c),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()}})(wh,Lh,qh,hl,kl,lh,ph,Uh),Gh=((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})(Oc,yh),zh=((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))})(ll,Gh),Wh=((t,e)=>(n,r)=>{const i=n.createChannelMerger(r.numberOfInputs);return null!==t&&"webkitAudioContext"===t.name&&e(n,i),yl(i,r),i})(gh,zh),Jh=((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(!dc(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)}}})(Wh,Lc,uh),Hh=((t,e,n,r,i)=>class extends t{constructor(t,o){const s=r(t),a={...el,...o};super(t,!1,n(s,a),i(s)?e():null)}})(wh,Jh,Wh,lh,ph),Xh=((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(!dc(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)}}})(Al,Lc,uh),Kh=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u=o({...nl,...s});super(t,!1,n(a,u),i(a)?e():null)}})(wh,Xh,Al,lh,ph,t=>({...t,channelCount:t.numberOfOutputs})),Yh=((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(El(h,c),()=>u.connect(c),()=>u.disconnect(c))})(Ih,Dh,Cl,Gh),Zh=((t,e,n,r,i)=>(o,s)=>{if(void 0===o.createConstantSource)return n(o,s);const a=o.createConstantSource();return yl(a,s),bl(a,s,"offset"),e(r,()=>r(o))||wl(a),e(i,()=>i(o))||xl(a),t(o,a),a})(Ih,nh,Yh,Wl,Hl),Qh=((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=dc(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)}}})(Rh,Zh,Lc,Ph,uh),td=((t,e,n,r,i,o,s)=>class extends t{constructor(t,s){const a=i(t),u={...rl,...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,yc,_c),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){ac(this);const t=()=>{this._nativeConstantSourceNode.removeEventListener("ended",t),vc(this)&&cc(this)};this._nativeConstantSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeConstantSourceNode.stop(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.stop=t)}})(wh,Lh,Qh,Zh,lh,ph,Kl),ed=((t,e)=>(n,r)=>{const i=n.createConvolver();if(yl(i,r),r.disableNormalization===i.normalize&&(i.normalize=!r.disableNormalization),_l(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})(Dl,Gl),nd=((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(!dc(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),Ic(s)?await n(i,o,s.inputs[0]):await n(i,o,s),s})(i,o)}}})(ed,Lc,uh),rd=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u={...il,...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}})(wh,nd,ed,lh,ph,Uh),id=((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=dc(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)}}})(Rh,Ol,Lc,Ph,uh),od=((t,e,n,r,i,o,s)=>class extends t{constructor(t,a){const u=i(t),c={...sl,...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}})(wh,Lh,id,Ol,lh,ph,Uh),sd=(t=>(e,n)=>{const r=e.createDynamicsCompressor();if(yl(r,n),n.channelCount>2)throw t();if("max"===n.channelCountMode)throw t();return bl(r,n,"attack"),bl(r,n,"knee"),bl(r,n,"ratio"),bl(r,n,"release"),bl(r,n,"threshold"),r})(Dl),ad=((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=dc(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)}}})(Rh,sd,Lc,Ph,uh),ud=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,i){const u=o(t),c={...ul,...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}})(wh,Lh,ad,sd,Dl,lh,ph,Uh),cd=((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=dc(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)}}})(Rh,Cl,Lc,Ph,uh),ld=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=i(t),u={...cl,...s},c=r(a,u),l=o(a);super(t,!1,c,l?n():null),this._gain=e(this,l,c.gain,yc,_c)}get gain(){return this._gain}})(wh,Lh,cd,Cl,lh,ph),hd=((t,e,n,r)=>(i,o,{channelCount:s,channelCountMode:a,channelInterpretation:u,feedback:c,feedforward:l})=>{const h=Sl(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]=pl(d,f,p,m,g,v[t],b[t],y[t],32,r,i)}};const w=i.sampleRate/2;return El({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=Ml(Nl(p,o),Nl(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])},_)})(hl,ll,Rl,Dl),dd=((t,e,n,r)=>i=>t(ml,()=>ml(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()}))(nh,Cl,Rl,((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()})})(Cl,dh)),pd=((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=dc(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),pl(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)}}})(Dh,Lc,dh,uh,dd),fd=(t=>(e,n,r)=>{if(void 0===e.createIIRFilter)return t(e,n,r);const i=e.createIIRFilter(r.feedforward,r.feedback);return yl(i,r),i})(hd),md=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u=i(a),c={...dl,...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 hl();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)}})(wh,fd,pd,lh,ph,Uh),gd=((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,yc,_c);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}}})(Lh,Wh,Zh,Rl,Dl,Ul,ph,Gl),_d=new WeakMap,yd=((t,e,n,r,i,o)=>class extends n{constructor(n,o){super(n),this._nativeContext=n,Ju.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}})(Bh,gd,mh,ph,_d,Kl),vd=((t,e,n,r,i,o)=>(s,a)=>{const u=s.createOscillator();return yl(u,a),bl(u,a,"detune"),bl(u,a,"frequency"),void 0!==a.periodicWave?u.setPeriodicWave(a.periodicWave):_l(u,a,"type"),e(n,()=>n(s))||wl(u),e(r,()=>r(s))||o(u,s),e(i,()=>i(s))||xl(u),t(s,u),u})(Ih,nh,Wl,Jl,Hl,Xl),bd=((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=dc(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)}}})(Rh,vd,Lc,Ph,uh),wd=((t,e,n,r,i,o,s)=>class extends t{constructor(t,s){const a=i(t),u={...jl,...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){ac(this);const t=()=>{this._nativeOscillatorNode.removeEventListener("ended",t),vc(this)&&cc(this)};this._nativeOscillatorNode.addEventListener("ended",t)}}stop(t=0){this._nativeOscillatorNode.stop(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.stop=t)}})(wh,Lh,vd,bd,lh,ph,Kl),xd=(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)}})(Dh),Sd=((t,e,n,r,i)=>(o,{curve:s,oversample:a,...u})=>{const c=o.createWaveShaper(),l=o.createWaveShaper();yl(c,u),yl(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(El(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)})})(xd,ll,Cl,Vl,Gh),Td=((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);yl(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();_l(c,{curve:l},"curve"),_l(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)})})(xd,ll,Sd,Vl,Gh,gh,Gl),kd=((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:S,rolloffFactor:T,...k})=>{const A=l.createPanner();if(k.channelCount>2)throw s();if("max"===k.channelCountMode)throw s();yl(A,k);const E={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},O=n(l,{...E,channelInterpretation:"speakers",numberOfInputs:6}),C=r(l,{...k,gain:1}),M=r(l,{...E,gain:1}),I=r(l,{...E,gain:0}),N=r(l,{...E,gain:0}),R=r(l,{...E,gain:0}),D=r(l,{...E,gain:0}),P=r(l,{...E,gain:0}),j=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);j.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(I.gain,"defaultValue",{get:()=>0}),Object.defineProperty(N.gain,"defaultValue",{get:()=>0}),Object.defineProperty(R.gain,"defaultValue",{get:()=>0}),Object.defineProperty(D.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 I.gain},get orientationZ(){return N.gain},get panningModel(){return A.panningModel},set panningModel(t){A.panningModel=t},get positionX(){return R.gain},get positionY(){return D.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),S!==q.refDistance&&(q.refDistance=S),T!==q.rolloffFactor&&(q.rolloffFactor=T),1===F[0]&&0===F[1]&&0===F[2]||A.setOrientation(...F),0===$[0]&&0===$[1]&&0===$[2]||A.setPosition(...$);return c(El(q,A),()=>{C.connect(A),t(C,L,0,0),L.connect(M).connect(O,0,0),L.connect(I).connect(O,0,1),L.connect(N).connect(O,0,2),L.connect(R).connect(O,0,3),L.connect(D).connect(O,0,4),L.connect(P).connect(O,0,5),O.connect(j).connect(l.destination)},()=>{C.disconnect(A),a(C,L,0,0),L.disconnect(M),M.disconnect(O),L.disconnect(I),I.disconnect(O),L.disconnect(N),N.disconnect(O),L.disconnect(R),R.disconnect(O),L.disconnect(D),D.disconnect(O),L.disconnect(P),P.disconnect(O),O.disconnect(j),j.disconnect(l.destination)})})(Nc,ll,Wh,Cl,Rl,Td,Dl,jc,Ul,Gh),Ad=(t=>(e,n)=>{const r=e.createPanner();return void 0===r.orientationX?t(e,n):(yl(r,n),bl(r,n,"orientationX"),bl(r,n,"orientationY"),bl(r,n,"orientationZ"),bl(r,n,"positionX"),bl(r,n,"positionY"),bl(r,n,"positionZ"),_l(r,n,"coneInnerAngle"),_l(r,n,"coneOuterAngle"),_l(r,n,"coneOuterGain"),_l(r,n,"distanceModel"),_l(r,n,"maxDistance"),_l(r,n,"panningModel"),_l(r,n,"refDistance"),_l(r,n,"rolloffFactor"),r)})(kd),Ed=((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=dc(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)),Ic(m)?await u(d,p,m.inputs[0]):await u(d,p,m),m})(d,p)}}})(Rh,Wh,Zh,Cl,Ad,Lc,dh,Ph,uh,dd),Od=((t,e,n,r,i,o,s)=>class extends t{constructor(t,a){const u=i(t),c={...Ll,...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,yc,_c),this._orientationY=e(this,h,l.orientationY,yc,_c),this._orientationZ=e(this,h,l.orientationZ,yc,_c),this._positionX=e(this,h,l.positionX,yc,_c),this._positionY=e(this,h,l.positionY,yc,_c),this._positionZ=e(this,h,l.positionZ,yc,_c),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}})(wh,Lh,Ad,Ed,lh,ph,Uh),Cd=(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})(fc),Md=((t,e,n,r)=>class i{constructor(i,o){const s=e(i),a=r({...Fl,...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)}})(Cd,lh,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}}),Id=((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}),S=n(t,{...c,gain:0}),T=r(t,{...l,curve:f}),k=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(S,1),_.connect(k,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===T.inputs?T:T.inputs[0]),o.connect(void 0===A.inputs?A:A.inputs[0]),v.connect(y.gain),w.connect(b.gain),T.connect(S.gain),A.connect(k.gain),y.connect(h,0,0),S.connect(h,0,0),b.connect(h,0,1),k.connect(h,0,1)},disconnectGraph(){i.disconnect(_),i.disconnect(void 0===x.inputs?x:x.inputs[0]),_.disconnect(y,0),_.disconnect(b,0),_.disconnect(S,1),_.disconnect(k,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===T.inputs?T:T.inputs[0]),o.disconnect(void 0===A.inputs?A:A.inputs[0]),v.disconnect(y.gain),w.disconnect(b.gain),T.disconnect(S.gain),A.disconnect(k.gain),y.disconnect(h,0,0),S.disconnect(h,0,0),b.disconnect(h,0,1),k.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(El(m,c),()=>{p(),g=!0},()=>{f(),g=!1})}})(Wh,Al,Cl,Td,Dl,Gh),Nd=((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 yl(o,r),bl(o,r,"pan"),Object.defineProperty(o,"channelCountMode",{get:()=>i,set:t=>{if(t!==i)throw e()}}),o})(Id,Dl),Rd=((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=dc(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),Ic(u)?await i(s,a,u.inputs[0]):await i(s,a,u),u})(s,a)}}})(Rh,Nd,Lc,Ph,uh),Dd=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=i(t),u={...$l,...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}})(wh,Lh,Nd,Rd,lh,ph),Pd=((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(!dc(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),Ic(s)?await n(i,o,s.inputs[0]):await n(i,o,s),s})(i,o)}}})(Td,Lc,uh),jd=((t,e,n,r,i,o,s)=>class extends t{constructor(t,e){const a=i(t),u={...ql,...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}})(wh,ll,Td,Pd,lh,ph,Uh),Ld=(t=>null!==t&&t.isSecureContext)(oh),Fd=(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)}})(oh),$d=new WeakMap,Bd=((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})($d,dh),qd=Ld?((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]=tc(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=Ku.get(v);if(void 0!==r){if(r.has(t))throw e();nc(n),ec(n.parameterDescriptors),r.set(t,n)}else nc(n),ec(n.parameterDescriptors),Ku.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]=tc(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}})(nh,Dl,(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)}}))(oh),Fd,(t=>async e=>{try{const t=await fetch(e);if(t.ok)return[await t.text(),t.url]}catch{}throw t()})(()=>new DOMException("","AbortError")),lh,Bd,ph,bh,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})(bh,dh),oh):void 0,Ud=((t,e)=>n=>t(n)||e(n))(_h,ph),Vd=((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=>(ol(d).catch(()=>{}),e(a,()=>a(n))||l(n),t.add(n),n)):new Promise((e,n)=>{const i=async()=>{try{await ol(d)}catch{}},o=t=>{n(t),i()};try{p.decodeAudioData(d,n=>{"function"!=typeof n.copyFromChannel&&(c(n),mc(n)),t.add(n),i().then(()=>e(n))},t=>{o(null===t?r():t)})}catch(t){o(t)}})})(Th,nh,()=>new DOMException("","DataCloneError"),()=>new DOMException("","EncodingError"),new WeakSet,lh,Ud,pc,ml,Oh,Ch),Gd=((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})}})(qd,Sh,Mh,$h,Vh,Hh,Kh,td,rd,Vd,od,ud,ld,md,yd,wd,Od,Md,Dd,jd),zd=((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}})(wh,(t,e)=>t.createMediaElementSource(e.mediaElement),lh,ph),Wd=((t,e,n,r)=>class extends t{constructor(t,i){const o=n(t);if(r(o))throw new TypeError;const s={...fl,...i},a=e(o,s);super(t,!1,a,null),this._nativeMediaStreamAudioDestinationNode=a}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}})(wh,(t,e)=>{const n=t.createMediaStreamDestination();return yl(n,e),1===n.numberOfOutputs&&Object.defineProperty(n,"numberOfOutputs",{get:()=>0}),n},lh,ph),Jd=((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}})(wh,(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},lh,ph),Hd=((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})(ll,ph),Xd=((t,e,n)=>class extends t{constructor(t,r){const i=n(t);super(t,!0,e(i,r),null)}})(wh,Hd,lh),Kd=((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(!kc(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()),Tc(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})}})(Gd,ll,Dl,Bl,zd,Wd,Jd,Xd,gh),Yd=(t=>e=>{const n=t.get(e);if(void 0===n)throw new Error("The context has no set of AudioWorkletNodes.");return n})(_d),Zd=(t=>(e,n)=>{t(e).add(n)})(Yd),Qd=(t=>(e,n,r=0,i=0)=>{const o=e[r];if(void 0===o)throw t();return Vc(n)?o.connect(n,0,i):o.connect(n,0)})(fc),tp=(t=>(e,n)=>{t(e).delete(n)})(Yd),ep=(t=>(e,n=void 0,r=void 0,i=0)=>void 0===n?e.forEach(t=>t.disconnect()):"number"==typeof n?al(t,e,n).disconnect():Vc(n)?void 0===r?e.forEach(t=>t.disconnect(n)):void 0===i?al(t,e,r).disconnect(n,0):al(t,e,r).disconnect(n,0,i):void 0===r?e.forEach(t=>t.disconnect(n)):al(t,e,r).disconnect(n,0))(fc),np=new WeakMap,rp=((t,e)=>n=>e(t,n))(np,rc),ip=((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=[],S=[];for(let t=0;t<g.numberOfInputs;t+=1)x.push(s(p,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1})),S.push(i(p,{channelCount:g.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:g.channelCount}));const T=[];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?yc:e},minValue:{get:()=>void 0===n?_c:n}}),T.push(i)}const k=r(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,y+b)}),A=Sl(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(S[t]);for(let e=0;e<g.channelCount;e+=1)S[t].connect(k,e,t*g.channelCount+e)}const M=new Hc(void 0===m.parameterDescriptors?[]:m.parameterDescriptors.map(({name:t},e)=>{const n=T[e];return n.connect(k,0,y+e),n.start(0),[t,n.offset]}));k.connect(E);let I=g.channelInterpretation,N=null;const R=0===g.numberOfOutputs?[E]:C,D={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 I},set channelInterpretation(t){for(const e of x)e.channelInterpretation=t;I=t},get context(){return E.context},get inputs(){return x},get numberOfInputs(){return g.numberOfInputs},get numberOfOutputs(){return g.numberOfOutputs},get onprocessorerror(){return N},set onprocessorerror(t){"function"==typeof N&&D.removeEventListener("processorerror",N),N="function"==typeof t?t:null,"function"==typeof N&&D.addEventListener("processorerror",N)},get parameters(){return M},get port(){return w.port2},addEventListener:(...t)=>E.addEventListener(t[0],t[1],t[2]),connect:t.bind(null,R),disconnect:c.bind(null,R),dispatchEvent:(...t)=>E.dispatchEvent(t[0]),removeEventListener:(...t)=>E.removeEventListener(t[0],t[1],t[2])},P=new Map;var j,L;w.port1.addEventListener=(j=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 j.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=Yu.get(t);void 0===i&&(i=new WeakMap,Yu.set(t,i));const o=Tl(n,r);return i.set(e,o),o})(p,D,m,g);B.then(t=>$=t);const q=Zc(g.numberOfInputs,g.channelCount),U=Zc(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(D);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)Kc(t,q[e],n,n,r);void 0!==m.parameterDescriptors&&m.parameterDescriptors.forEach(({name:e},n)=>{Kc(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)Yc(e,U[t],i,n+i,r);n+=_[t]}}catch(t){G=!1,D.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(S[t]);for(let e=0;e<g.channelCount;e+=1)S[r].disconnect(k,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=T[e];t.disconnect(k,0,y+e),t.stop()}}k.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(D,()=>{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})})(Qd,fc,ll,Wh,Al,Zh,Cl,Rl,Dl,ep,Fd,rp,Gh),op=((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)})(ll,ip,Cl,Dl,Gh),sp=((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 S=v.get(x);return void 0!==S?Promise.resolve(S):(async(a,w)=>{let x=l(a),S=null;const T=dc(x,w),k=Array.isArray(_.outputChannelCount)?_.outputChannelCount:Array.from(_.outputChannelCount);if(null===h){const t=k.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:k[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),S=[n,o,c]}else T||(x=new h(w,g));if(v.set(w,null===S?x:S[2]),null!==S){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=Qc(a,0===n?null:await u(),w,_,k,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]=S;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<k[t];r+=1)u.connect(n,e+r,r);e+=k[t]}return h}if(T)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)}}})(Rh,Qd,Dh,Wh,Al,Zh,Cl,tp,ep,Fd,Lc,bh,dh,Ph,uh,dd),ap=(t=>e=>t.get(e))($d),up=(t=>(e,n)=>{t.set(e,n)})(np),cp=Ld?((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({...Xc,...f});d(y);const v=Ku.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 S=[];x.parameters.forEach((t,e)=>{const r=n(this,_,t);S.push([e,r])}),this._nativeAudioWorkletNode=x,this._onprocessorerror=null,this._parameters=new Hc(S),_&&t(g,this);const{activeInputs:T}=o(this);h(x,T)}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}})(Zd,wh,Lh,sp,op,wc,ap,lh,ph,bh,t=>({...t,outputChannelCount:void 0!==t.outputChannelCount?t.outputChannelCount:1===t.numberOfInputs&&1===t.numberOfOutputs?[t.channelCount]:Array.from({length:t.numberOfOutputs},()=>1)}),up,t=>{const{port1:e,port2:n}=new MessageChannel;try{e.postMessage(t)}finally{e.close(),n.close()}},Kl):void 0,lp=(((t,e,n,r,i)=>{})(ll,Dl,Bl,yd,gh),((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}})(Dl,dh)),hp=((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),mc(n)):e(o,()=>o(n))||a(n),t.add(n),n)))(Th,nh,ah,Yd,dd,pc,Oh,Ch),dp=(((t,e,n,r,i)=>{})(nh,ll,lp,yd,hp),((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}={...Pl,...o},c=r(a,s,u);e(ml,()=>ml(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,Tc(this)}))}_waitForThePromiseToSettle(t){null===this._state?this._nativeOfflineAudioContext.dispatchEvent(t):setTimeout(()=>this._waitForThePromiseToSettle(t))}})(Gd,nh,ll,lp,hp)),pp=((t,e)=>n=>{const r=t.get(n);return e(r)||e(n)})(Ju,_h),fp=((t,e)=>n=>t.has(n)||e(n))(Gu,yh),mp=((t,e)=>n=>t.has(n)||e(n))(Wu,vh),gp=((t,e)=>n=>{const r=t.get(n);return e(r)||e(n)})(Ju,ph);function _p(t){return void 0===t}function yp(t){return void 0!==t}function vp(t){return"number"==typeof t}function bp(t){return"[object Object]"===Object.prototype.toString.call(t)&&t.constructor===Object}function wp(t){return"boolean"==typeof t}function xp(t){return Array.isArray(t)}function Sp(t){return"string"==typeof t}function Tp(t){return Sp(t)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(t)}function kp(t,e){if(!t)throw new Error(e)}function Ap(t,e,n=1/0){if(!(e<=t&&t<=n))throw new RangeError(`Value must be within [${e}, ${n}], got: ${t}`)}function Ep(t){t.isOffline||"running"===t.state||Np('The AudioContext is "suspended". Invoke Tone.start() from a user action to start the audio.')}let Op=!1,Cp=!1;function Mp(t){Op=t}let Ip=console;function Np(...t){Ip.warn(...t)}const Rp="object"==typeof self?self:null,Dp=Rp&&(Rp.hasOwnProperty("AudioContext")||Rp.hasOwnProperty("webkitAudioContext"));class Pp{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()}}function jp(t){return mp(t)}function Lp(t){return fp(t)}function Fp(t){return gp(t)}function $p(t){return pp(t)}function Bp(t,e){return"value"===t||jp(e)||Lp(e)||function(t){return t instanceof Mh}(e)}function qp(t,...e){if(!e.length)return t;const n=e.shift();if(bp(t)&&bp(n))for(const e in n)Bp(e,n[e])?t[e]=n[e]:bp(n[e])?(t[e]||Object.assign(t,{[e]:{}}),qp(t[e],n[e])):Object.assign(t,{[e]:n[e]});return qp(t,...e)}function Up(t,e,n=[],r){const i={},o=Array.from(e);if(bp(o[0])&&r&&!Reflect.has(o[0],r)){Object.keys(o[0]).some(e=>Reflect.has(t,e))||(qp(i,{[r]:o[0]}),n.splice(n.indexOf(r),1),o.shift())}if(1===o.length&&bp(o[0]))qp(i,o[0]);else for(let t=0;t<n.length;t++)yp(o[t])&&(i[n[t]]=o[t]);return qp(t,i)}function Vp(t,e){return _p(t)?e:t}function Gp(t,e){return e.forEach(e=>{Reflect.has(t,e)&&delete t[e]}),t}class zp{constructor(){this.debug=!1,this._wasDisposed=!1}static getDefaults(){return{}}log(...t){(this.debug||Rp&&this.toString()===Rp.TONE_DEBUG_CLASS)&&function(...t){Ip.log(...t)}(this,...t)}dispose(){return this._wasDisposed=!0,this}get disposed(){return this._wasDisposed}toString(){return this.name}}zp.version=Bu;const Wp=1e-6;function Jp(t,e){return t>e+Wp}function Hp(t,e){return Jp(t,e)||Kp(t,e)}function Xp(t,e){return t+Wp<e}function Kp(t,e){return Math.abs(t-e)<Wp}function Yp(t,e,n){return Math.max(Math.min(t,n),e)}class Zp extends zp{constructor(){super(),this.name="Timeline",this._timeline=[];const t=Up(Zp.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(kp(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];kp(Hp(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(Kp(this._timeline[e].time,t)){for(let n=e;n>=0&&Kp(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&&Hp(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(Kp(o[e],t)){for(let n=r;n<this._timeline.length;n++){if(!Kp(this._timeline[n][e],t))break;r=n}return r}if(Xp(o[e],t)&&Jp(s[e],t))return r;Jp(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&&Kp(this._timeline[n].time,t)){let r=n;for(let e=n;e>=0&&Kp(this._timeline[e].time,t);e--)r=e;this._iterate(t=>{e(t)},r,n)}return this}dispose(){return super.dispose(),this._timeline=[],this}}const Qp=[];function tf(t){Qp.push(t)}const ef=[];function nf(t){ef.push(t)}class rf extends zp{constructor(){super(...arguments),this.name="Emitter"}on(t,e){return t.split(/\W+/).forEach(t=>{_p(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(_p(this._events)&&(this._events={}),this._events.hasOwnProperty(t))if(_p(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(rf.prototype,e);Object.defineProperty(t.prototype,e,n)})}dispose(){return super.dispose(),this._events=void 0,this}}class of extends rf{constructor(){super(...arguments),this.isOffline=!1}toJSON(){return{}}}class sf extends of{constructor(){var t,e;super(),this.name="Context",this._constants=new Map,this._timeouts=new Zp,this._timeoutIds=0,this._initialized=!1,this._closeStarted=!1,this.isOffline=!1,this._workletPromise=null;const n=Up(sf.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 Kd(t)}({latencyHint:n.latencyHint}),this._latencyHint=n.latencyHint),this._ticker=new Pp(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,Qp.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){kp($p(this._context),"Not available if OfflineAudioContext");return this._context.createMediaStreamSource(t)}createMediaElementSource(t){kp($p(this._context),"Not available if OfflineAudioContext");return this._context.createMediaElementSource(t)}createMediaStreamDestination(){kp($p(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){kp(!this._initialized,"The listener cannot be set after initialization."),this._listener=t}get transport(){return this.initialize(),this._transport}set transport(t){kp(!this._initialized,"The transport cannot be set after initialization."),this._transport=t}get draw(){return this.initialize(),this._draw}set draw(t){kp(!this._initialized,"Draw cannot be set after initialization."),this._draw=t}get destination(){return this.initialize(),this._destination}set destination(t){kp(!this._initialized,"The destination cannot be set after initialization."),this._destination=t}createAudioWorkletNode(t,e){return function(t,e,n){return kp(yp(cp),"AudioWorkletNode only works in a secure context (https or localhost)"),new(t instanceof(null==Rp?void 0:Rp.BaseAudioContext)?null==Rp?void 0:Rp.AudioWorkletNode:cp)(t,e,n)}(this.rawContext,t,e)}addAudioWorkletModule(t){return a(this,void 0,void 0,function*(){kp(yp(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 $p(this._context)?this._context.resume():Promise.resolve()}close(){return a(this,void 0,void 0,function*(){var t;$p(this._context)&&"closed"!==this.state&&!this._closeStarted&&(this._closeStarted=!0,yield this._context.close()),this._initialized&&(t=this,ef.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 af(t,e){xp(e)?e.forEach(e=>af(t,e)):Object.defineProperty(t,e,{enumerable:!0,writable:!1})}function uf(t,e){xp(e)?e.forEach(e=>uf(t,e)):Object.defineProperty(t,e,{writable:!0})}const cf=()=>{};class lf extends zp{constructor(){super(),this.name="ToneAudioBuffer",this.onload=cf;const t=Up(lf.getDefaults(),arguments,["url","onload","onerror"]);this.reverse=t.reverse,this.onload=t.onload,Sp(t.url)?this.load(t.url).catch(t.onerror):t.url&&this.set(t.url)}static getDefaults(){return{onerror:cf,onload:cf,reverse:!1}}get sampleRate(){return this._buffer?this._buffer.sampleRate:ff().sampleRate}set(t){return t instanceof lf?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=lf.load(t).then(t=>{this.set(t),this.onload(this)});lf.downloads.push(e);try{yield e}finally{const t=lf.downloads.indexOf(e);lf.downloads.splice(t,1)}return this})}dispose(){return super.dispose(),this._buffer=void 0,this}fromArray(t){const e=xp(t)&&t[0].length>0,n=e?t.length:1,r=e?t[0].length:t.length,i=ff(),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(vp(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(vp(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){kp(this.loaded,"Buffer is not loaded");const n=Math.floor(t*this.sampleRate),r=Math.floor(e*this.sampleRate);kp(n<r,"The start time must be less than the end time");const i=r-n,o=ff().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 lf(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 lf).fromArray(t)}static fromUrl(t){return a(this,void 0,void 0,function*(){const e=new lf;return yield e.load(t)})}static load(t){return a(this,void 0,void 0,function*(){const e=""===lf.baseUrl||lf.baseUrl.endsWith("/")?lf.baseUrl:lf.baseUrl+"/",n=yield fetch(e+t);if(!n.ok)throw new Error(`could not load url: ${t}`);const r=yield n.arrayBuffer();return yield ff().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();lf.downloads.length;)yield lf.downloads[0]})}}lf.baseUrl="",lf.downloads=[];class hf extends sf{constructor(){var t,e,n;super({clockSource:"offline",context:Fp(arguments[0])?arguments[0]:(t=arguments[0],e=arguments[1]*arguments[2],n=arguments[2],new dp(t,e,n)),lookAhead:0,updateInterval:Fp(arguments[0])?128/arguments[0].sampleRate:128/arguments[2]}),this.name="OfflineContext",this._currentTime=0,this.isOffline=!0,this._duration=Fp(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 lf(e)})}close(){return Promise.resolve()}}const df=new class extends of{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 pf=df;function ff(){return pf===df&&Dp&&function(t,e=!1){e&&pf.dispose();pf=$p(t)?new sf(t):Fp(t)?new hf(t):t}(new sf),pf}if(Rp&&!Rp.TONE_SILENCE_LOGGING){0}function mf(t){return Math.pow(10,t/20)}function gf(t){return Math.log(t)/Math.LN10*20}function _f(t){return Math.pow(2,t/12)}let yf=440;function vf(t){return Math.round(bf(t))}function bf(t){return 69+12*Math.log2(t/yf)}function wf(t){return yf*Math.pow(2,(t-69)/12)}class xf extends zp{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 xf&&this.fromType(this._val),_p(this._val))return this._noArg();if(Sp(this._val)&&_p(this._units)){for(const t in this._expressions)if(this._expressions[t].regexp.test(this._val.trim())){this._units=t;break}}else if(bp(this._val)){let t=0;for(const e in this._val)if(yp(this._val[e])){const n=this._val[e];t+=new this.constructor(this.context,e).valueOf()*n}return t}if(yp(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 Sp(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 Sf extends xf{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 Sf(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 Sf(this.context,e[0]).toSeconds();return e.forEach(e=>{const i=new Sf(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 vf(this.toFrequency())}_now(){return this.context.now()}}class Tf extends Sf{constructor(){super(...arguments),this.name="Frequency",this.defaultUnits="hz"}static get A4(){return yf}static set A4(t){!function(t){yf=t}(t)}_getExpressions(){return Object.assign({},super._getExpressions(),{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method(t){return"midi"===this.defaultUnits?t:Tf.mtof(t)}},note:{regexp:/^([a-g]{1}(?:b|#|##|x|bb|###|#x|x#|bbb)?)(-?[0-9]+)/i,method(t,e){const n=kf[t.toLowerCase()]+12*(parseInt(e,10)+1);return"midi"===this.defaultUnits?n:Tf.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 Tf(this.context,this.valueOf()*_f(t))}harmonize(t){return t.map(t=>this.transpose(t))}toMidi(){return vf(this.valueOf())}toNote(){const t=this.toFrequency(),e=Math.log2(t/Tf.A4);let n=Math.round(12*e)+57;const r=Math.floor(n/12);r<0&&(n+=-12*r);return Af[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 wf(t)}static ftom(t){return vf(t)}}const kf={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},Af=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];class Ef extends Sf{constructor(){super(...arguments),this.name="TransportTime"}_now(){return this.context.transport.seconds}}class Of extends zp{constructor(){super();const t=Up(Of.getDefaults(),arguments,["context"]);this.defaultContext?this.context=this.defaultContext:this.context=t.context}static getDefaults(){return{context:ff()}}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){_p(t)&&Op&&!Cp&&(Cp=!0,Np("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 Sf(this.context,t).toSeconds()}toFrequency(t){return new Tf(this.context,t).toFrequency()}toTicks(t){return new Ef(this.context,t).toTicks()}_getPartialProperties(t){const e=this.get();return Object.keys(e).forEach(n=>{_p(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];yp(n)&&yp(n.value)&&yp(n.setValueAtTime)?t[e]=n.value:n instanceof Of?t[e]=n._getPartialProperties(t[e]):xp(n)||vp(n)||Sp(n)||wp(n)?t[e]=n:delete t[e]}}),t}set(t){return Object.keys(t).forEach(e=>{Reflect.has(this,e)&&yp(this[e])&&(this[e]&&yp(this[e].value)&&yp(this[e].setValueAtTime)?this[e].value!==t[e]&&(this[e].value=t[e]):this[e]instanceof Of?this[e].set(t[e]):this[e]=t[e])}),this}}class Cf extends Zp{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 Ap(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 Mf extends Of{constructor(){const t=Up(Mf.getDefaults(),arguments,["param","units","convert"]);for(super(t),this.name="Param",this.overridden=!1,this._minOutput=1e-7,kp(yp(t.param)&&(jp(t.param)||t.param instanceof Mf),"param must be an AudioParam");!jp(t.param);)t.param=t.param._param;this._swappable=!!yp(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 Zp(1e3),this._initialValue=this._param.defaultValue,this.units=t.units,this.convert=t.convert,this._minValue=t.minValue,this._maxValue=t.maxValue,yp(t.value)&&t.value!==this._toType(this._initialValue)&&this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(Of.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 yp(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 yp(this._maxValue)?this._maxValue:"normalRange"===this.units||"audioRange"===this.units?1:this._param.maxValue}_is(t,e){return this.units===e}_assertRange(t){return yp(this.maxValue)&&yp(this.minValue)&&Ap(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")?mf(t):this._is(t,"frequency")?this.toFrequency(t):t:this.overridden?0:t}_toType(t){return this.convert&&"decibels"===this.units?gf(t):t}setValueAtTime(t,e){const n=this.toSeconds(e),r=this._fromType(t);return kp(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 kp(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=Kp(n,0)?this._minOutput:n,this._assertRange(n);const r=this.toSeconds(e);return kp(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);kp(isFinite(n)&&n>0,"timeConstant must be a number greater than 0");const i=this.toSeconds(e);return this._assertRange(r),kp(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 kp(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));kp(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&&Kp(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){kp(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 If extends Of{constructor(){super(...arguments),this._internalChannels=[]}get numberOfInputs(){return yp(this.input)?jp(this.input)||this.input instanceof Mf?1:this.input.numberOfInputs:0}get numberOfOutputs(){return yp(this.output)?this.output.numberOfOutputs:0}_isAudioNode(t){return yp(t)&&(t instanceof If||Lp(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();kp(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 Rf(this,t,e,n),this}toDestination(){return this.connect(this.context.destination),this}toMaster(){return Np("toMaster() has been renamed toDestination()"),this.toDestination()}disconnect(t,e=0,n=0){return Df(this,t,e,n),this}chain(...t){return Nf(this,...t),this}fan(...t){return t.forEach(t=>this.connect(t)),this}dispose(){return super.dispose(),yp(this.input)&&(this.input instanceof If?this.input.dispose():Lp(this.input)&&this.input.disconnect()),yp(this.output)&&(this.output instanceof If?this.output.dispose():Lp(this.output)&&this.output.disconnect()),this._internalChannels=[],this}}function Nf(...t){const e=t.shift();t.reduce((t,e)=>(t instanceof If?t.connect(e):Lp(t)&&Rf(t,e),e),e)}function Rf(t,e,n=0,r=0){for(kp(yp(t),"Cannot connect from undefined node"),kp(yp(e),"Cannot connect to undefined node"),(e instanceof If||Lp(e))&&kp(e.numberOfInputs>0,"Cannot connect to node with no inputs"),kp(t.numberOfOutputs>0,"Cannot connect from node with no outputs");e instanceof If||e instanceof Mf;)yp(e.input)&&(e=e.input);for(;t instanceof If;)yp(t.output)&&(t=t.output);jp(e)?t.connect(e,n):t.connect(e,n,r)}function Df(t,e,n=0,r=0){if(yp(e))for(;e instanceof If;)e=e.input;for(;!Lp(t);)yp(t.output)&&(t=t.output);jp(e)?t.disconnect(e,n):Lp(e)?t.disconnect(e,n,r):t.disconnect()}class Pf extends If{constructor(){const t=Up(Pf.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 Mf({context:this.context,convert:t.convert,param:this._gainNode.gain,units:t.units,value:t.gain,minValue:t.minValue,maxValue:t.maxValue}),af(this,"gain")}static getDefaults(){return Object.assign(If.getDefaults(),{convert:!0,gain:1,units:"gain"})}dispose(){return super.dispose(),this._gainNode.disconnect(),this.gain.dispose(),this}}class jf extends If{constructor(t){super(t),this.onended=cf,this._startTime=-1,this._stopTime=-1,this._timeout=-1,this.output=new Pf({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(If.getDefaults(),{curve:"linear",fadeIn:0,fadeOut:0,onended:cf})}_startGain(t,e=1){kp(-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){kp(-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!==cf&&(this.onended(this),this.onended=cf,!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"),kp(-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=cf,this}}class Lf extends jf{constructor(){const t=Up(Lf.getDefaults(),arguments,["offset"]);super(t),this.name="ToneConstantSource",this._source=this.context.createConstantSource(),Rf(this._source,this._gainNode),this.offset=new Mf({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(jf.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 Ff extends If{constructor(){const t=Up(Ff.getDefaults(),arguments,["value","units"]);super(t),this.name="Signal",this.override=!0,this.output=this._constantSource=new Lf({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(If.getDefaults(),{convert:!0,units:"number",value:0})}connect(t,e=0,n=0){return $f(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 $f(t,e,n,r){(e instanceof Mf||jp(e)||e instanceof Ff&&e.override)&&(e.cancelScheduledValues(0),e.setValueAtTime(0,0),e instanceof Ff&&(e.overridden=!0)),Rf(t,e,n,r)}class Bf extends Mf{constructor(){const t=Up(Bf.getDefaults(),arguments,["value"]);super(t),this.name="TickParam",this._events=new Zp(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(Mf.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(_p(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 qf extends Ff{constructor(){const t=Up(qf.getDefaults(),arguments,["value"]);super(t),this.name="TickSignal",this.input=this._param=new Bf({context:this.context,convert:t.convert,multiplier:t.multiplier,param:this._constantSource.offset,units:t.units,value:t.value})}static getDefaults(){return Object.assign(Ff.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 Uf extends Of{constructor(){const t=Up(Uf.getDefaults(),arguments,["frequency"]);super(t),this.name="TickSource",this._state=new Cf,this._tickOffset=new Zp,this._ticksAtTime=new Zp,this._secondsAtTime=new Zp,this.frequency=new qf({context:this.context,units:t.units,value:t.frequency}),af(this,"frequency"),this._state.setStateAtTime("stopped",0),this.setTicksAtTime(0,0)}static getDefaults(){return Object.assign({frequency:1,units:"hertz"},Of.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),yp(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=Kp(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 Vf extends Of{constructor(){const t=Up(Vf.getDefaults(),arguments,["callback","frequency"]);super(t),this.name="Clock",this.callback=cf,this._lastUpdate=0,this._state=new Cf("stopped"),this._boundLoop=this._loop.bind(this),this.callback=t.callback,this._tickSource=new Uf({context:this.context,frequency:t.frequency,units:t.units}),this._lastUpdate=0,this.frequency=this._tickSource.frequency,af(this,"frequency"),this._state.setStateAtTime("stopped",0),this.context.on("tick",this._boundLoop)}static getDefaults(){return Object.assign(Of.getDefaults(),{callback:cf,frequency:1,units:"hertz"})}get state(){return this._state.getValueAtTime(this.now())}start(t,e){Ep(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}}rf.mixin(Vf);class Gf extends If{constructor(){const t=Up(Gf.getDefaults(),arguments,["delayTime","maxDelay"]);super(t),this.name="Delay";const e=this.toSeconds(t.maxDelay);this._maxDelay=Math.max(e,this.toSeconds(t.delayTime)),this._delayNode=this.input=this.output=this.context.createDelay(e),this.delayTime=new Mf({context:this.context,param:this._delayNode.delayTime,units:"time",value:t.delayTime,minValue:0,maxValue:this.maxDelay}),af(this,"delayTime")}static getDefaults(){return Object.assign(If.getDefaults(),{delayTime:0,maxDelay:1})}get maxDelay(){return this._maxDelay}dispose(){return super.dispose(),this._delayNode.disconnect(),this.delayTime.dispose(),this}}class zf extends If{constructor(){const t=Up(zf.getDefaults(),arguments,["volume"]);super(t),this.name="Volume",this.input=this.output=new Pf({context:this.context,gain:t.volume,units:"decibels"}),this.volume=this.output.gain,af(this,"volume"),this._unmutedVolume=t.volume,this.mute=t.mute}static getDefaults(){return Object.assign(If.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 Wf extends If{constructor(){const t=Up(Wf.getDefaults(),arguments);super(t),this.name="Destination",this.input=new zf({context:this.context}),this.output=new Pf({context:this.context}),this.volume=this.input.volume,Nf(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(If.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),Nf(...t),this}get maxChannelCount(){return this.context.rawContext.destination.maxChannelCount}dispose(){return super.dispose(),this.volume.dispose(),this}}tf(t=>{t.destination=new Wf({context:t})}),nf(t=>{t.destination.dispose()});class Jf extends If{constructor(){super(...arguments),this.name="Listener",this.positionX=new Mf({context:this.context,param:this.context.rawContext.listener.positionX}),this.positionY=new Mf({context:this.context,param:this.context.rawContext.listener.positionY}),this.positionZ=new Mf({context:this.context,param:this.context.rawContext.listener.positionZ}),this.forwardX=new Mf({context:this.context,param:this.context.rawContext.listener.forwardX}),this.forwardY=new Mf({context:this.context,param:this.context.rawContext.listener.forwardY}),this.forwardZ=new Mf({context:this.context,param:this.context.rawContext.listener.forwardZ}),this.upX=new Mf({context:this.context,param:this.context.rawContext.listener.upX}),this.upY=new Mf({context:this.context,param:this.context.rawContext.listener.upY}),this.upZ=new Mf({context:this.context,param:this.context.rawContext.listener.upZ})}static getDefaults(){return Object.assign(If.getDefaults(),{positionX:0,positionY:0,positionZ:0,forwardX:0,forwardY:0,forwardZ:-1,upX:0,upY:1,upZ:0})}dispose(){return super.dispose(),this.positionX.dispose(),this.positionY.dispose(),this.positionZ.dispose(),this.forwardX.dispose(),this.forwardY.dispose(),this.forwardZ.dispose(),this.upX.dispose(),this.upY.dispose(),this.upZ.dispose(),this}}tf(t=>{t.listener=new Jf({context:t})}),nf(t=>{t.listener.dispose()});class Hf extends zp{constructor(){super(),this.name="ToneAudioBuffers",this._buffers=new Map,this._loadingCount=0;const t=Up(Hf.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:cf,onload:cf,urls:{}}}has(t){return this._buffers.has(t.toString())}get(t){return kp(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=cf,r=cf){return Sp(e)?(this.baseUrl&&"data:audio/"===e.trim().substring(0,11).toLowerCase()&&(this.baseUrl=""),this._buffers.set(t.toString(),new lf(this.baseUrl+e,n,r))):this._buffers.set(t.toString(),new lf(e,n,r)),this}dispose(){return super.dispose(),this._buffers.forEach(t=>t.dispose()),this._buffers.clear(),this}}class Xf extends Tf{constructor(){super(...arguments),this.name="MidiClass",this.defaultUnits="midi"}_frequencyToUnits(t){return vf(super._frequencyToUnits(t))}_ticksToUnits(t){return vf(super._ticksToUnits(t))}_beatsToUnits(t){return vf(super._beatsToUnits(t))}_secondsToUnits(t){return vf(super._secondsToUnits(t))}toMidi(){return this.valueOf()}toFrequency(){return wf(this.toMidi())}transpose(t){return new Xf(this.context,this.toMidi()+t)}}class Kf extends Ef{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 Yf extends Of{constructor(){super(...arguments),this.name="Draw",this.expiration=.25,this.anticipation=.008,this._events=new Zp,this._boundDrawLoop=this._drawLoop.bind(this),this._animationFrame=-1}schedule(t,e){return this._events.add({callback:t,time:this.toSeconds(e)}),1===this._events.length&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop)),this}cancel(t){return this._events.cancel(this.toSeconds(t)),this}_drawLoop(){const t=this.context.currentTime;this._events.forEachBefore(t+this.anticipation,e=>{t-e.time<=this.expiration&&e.callback(),this._events.remove(e)}),this._events.length>0&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop))}dispose(){return super.dispose(),this._events.dispose(),cancelAnimationFrame(this._animationFrame),this}}tf(t=>{t.draw=new Yf({context:t})}),nf(t=>{t.draw.dispose()});class Zf extends zp{constructor(){super(...arguments),this.name="IntervalTimeline",this._root=null,this._length=0}add(t){kp(yp(t.time),"Events must have a time property"),kp(yp(t.duration),"Events must have a duration parameter"),t.time=t.time.valueOf();let e=new Qf(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 Qf{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 tm extends zp{constructor(t){super(),this.name="TimelineValue",this._timeline=new Zp({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 em extends If{constructor(){super(Up(em.getDefaults(),arguments,["context"]))}connect(t,e=0,n=0){return $f(this,t,e,n),this}}class nm extends em{constructor(){const t=Up(nm.getDefaults(),arguments,["mapping","length"]);super(t),this.name="WaveShaper",this._shaper=this.context.createWaveShaper(),this.input=this._shaper,this.output=this._shaper,xp(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(Ff.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));kp(e,"oversampling must be either 'none', '2x', or '4x'"),this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.disconnect(),this}}class rm extends em{constructor(){const t=Up(rm.getDefaults(),arguments,["value"]);super(t),this.name="Pow",this._exponentScaler=this.input=this.output=new nm({context:this.context,mapping:this._expFunc(t.value),length:8192}),this._exponent=t.value}static getDefaults(){return Object.assign(em.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 im{constructor(t,e){this.id=im._eventId++,this._remainderTime=0;const n=Object.assign(im.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:cf,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}}im._eventId=0;class om extends im{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(om.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({},im.getDefaults(),{duration:1/0,interval:1,once:!1})}invoke(t){this._createEvents(t),super.invoke(t)}_createEvent(){return Xp(this._nextTick,this.floatTime+this.duration)?this.transport.scheduleOnce(this.invoke.bind(this),new Kf(this.context,this._nextTick).toSeconds()):-1}_createEvents(t){Xp(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 Kf(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);Jp(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 sm extends Of{constructor(){const t=Up(sm.getDefaults(),arguments);super(t),this.name="Transport",this._loop=new tm(!1),this._loopStart=0,this._loopEnd=0,this._scheduledEvents={},this._timeline=new Zp,this._repeatedEvents=new Zf,this._syncedSignals=[],this._swingAmount=0,this._ppq=t.ppq,this._clock=new Vf({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),af(this,"bpm"),this._timeSignature=t.timeSignature,this._swingTicks=t.ppq/2}static getDefaults(){return Object.assign(Of.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 Kf(this.context,2*this._swingTicks/3).toSeconds()*r}Mp(!0),this._timeline.forEachAtTime(e,e=>e.invoke(t)),Mp(!1)}schedule(t,e){const n=new im(this,{callback:t,time:new Ef(this.context,e).toTicks()});return this._addEvent(n,this._timeline)}scheduleRepeat(t,e,n,r=1/0){const i=new om(this,{callback:t,duration:new Sf(this.context,r).toTicks(),interval:new Sf(this.context,e).toTicks(),time:new Ef(this.context,n).toTicks()});return this._addEvent(i,this._repeatedEvents)}scheduleOnce(t,e){const n=new im(this,{callback:t,once:!0,time:new Ef(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 Kf(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(),yp(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){xp(t)&&(t=t[0]/t[1]*4),this._timeSignature=t}get loopStart(){return new Sf(this.context,this._loopStart,"i").toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t)}get loopEnd(){return new Sf(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 Kf(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 Kf(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 Pf(t),n=new rm(-1),s=new Pf(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 Pf(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(),uf(this,"bpm"),this._timeline.dispose(),this._repeatedEvents.dispose(),this}}rf.mixin(sm),tf(t=>{t.transport=new sm({context:t})}),nf(t=>{t.transport.dispose()});class am extends If{constructor(t){super(t),this.input=void 0,this._state=new Cf("stopped"),this._synced=!1,this._scheduled=[],this._syncedStart=cf,this._syncedStop=cf,this._state.memory=100,this._state.increasing=!0,this._volume=this.output=new zf({context:this.context,mute:t.mute,volume:t.volume}),this.volume=this._volume.volume,af(this,"volume"),this.onstop=t.onstop}static getDefaults(){return Object.assign(If.getDefaults(),{mute:!1,onstop:cf,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=_p(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(Vp(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 Ep(this.context),this._start(r,e,n);else kp(Jp(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=_p(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(e=this._clampToCurrentTime(e),"started"===this._state.getValueAtTime(e)||yp(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(Jp(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=cf,this.unsync(),this._volume.dispose(),this._state.dispose(),this}}class um extends jf{constructor(){const t=Up(um.getDefaults(),arguments,["url","onload"]);super(t),this.name="ToneBufferSource",this._source=this.context.createBufferSource(),this._internalChannels=[this._source],this._sourceStarted=!1,this._sourceStopped=!1,Rf(this._source,this._gainNode),this._source.onended=()=>this._stopSource(),this.playbackRate=new Mf({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 lf(t.url,t.onload,t.onerror),this._internalChannels.push(this._source)}static getDefaults(){return Object.assign(jf.getDefaults(),{url:new lf,loop:!1,loopEnd:0,loopStart:0,onload:cf,onerror:cf,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){kp(this.buffer.loaded,"buffer is either not set or not loaded");const i=this.toSeconds(t);this._startGain(i,r),e=this.loop?Vp(e,this.loopStart):Vp(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;Hp(o,t)&&(o=(o-e)%n+e),Kp(o,this.buffer.duration)&&(o=0)}if(this._source.buffer=this.buffer.get(),this._source.loopEnd=this.toSeconds(this.loopEnd)||this.buffer.duration,Xp(o,this.buffer.duration)&&(this._sourceStarted=!0,this._source.start(i,o)),yp(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 cm extends am{constructor(){const t=Up(cm.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(am.getDefaults(),{fadeIn:0,fadeOut:0,playbackRate:1,type:"white"})}get type(){return this._type}set type(t){if(kp(t in dm,"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=dm[this._type];this._source=new um({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 lm=220500,hm={brown:null,pink:null,white:null},dm={get brown(){if(!hm.brown){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(lm);t[e]=n;let r=0;for(let t=0;t<lm;t++){const e=2*Math.random()-1;n[t]=(r+.02*e)/1.02,r=n[t],n[t]*=3.5}}hm.brown=(new lf).fromArray(t)}return hm.brown},get pink(){if(!hm.pink){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(lm);let r,i,o,s,a,u,c;t[e]=n,r=i=o=s=a=u=c=0;for(let t=0;t<lm;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}}hm.pink=(new lf).fromArray(t)}return hm.pink},get white(){if(!hm.white){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(lm);t[e]=n;for(let t=0;t<lm;t++)n[t]=2*Math.random()-1}hm.white=(new lf).fromArray(t)}return hm.white}};function pm(t,e){return a(this,void 0,void 0,function*(){const n=e/t.context.sampleRate,r=new hf(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 fm extends jf{constructor(){const t=Up(fm.getDefaults(),arguments,["frequency","type"]);super(t),this.name="ToneOscillatorNode",this._oscillator=this.context.createOscillator(),this._internalChannels=[this._oscillator],Rf(this._oscillator,this._gainNode),this.type=t.type,this.frequency=new Mf({context:this.context,param:this._oscillator.frequency,units:"frequency",value:t.frequency}),this.detune=new Mf({context:this.context,param:this._oscillator.detune,units:"cents",value:t.detune}),af(this,["frequency","detune"])}static getDefaults(){return Object.assign(jf.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 mm extends am{constructor(){const t=Up(mm.getDefaults(),arguments,["frequency","type"]);super(t),this.name="Oscillator",this._oscillator=null,this.frequency=new Ff({context:this.context,units:"frequency",value:t.frequency}),af(this,"frequency"),this.detune=new Ff({context:this.context,units:"cents",value:t.detune}),af(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(am.getDefaults(),{detune:0,frequency:440,partialCount:0,partials:[],phase:0,type:"sine"})}_start(t){const e=this.toSeconds(t),n=new fm({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 mm._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=mm._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(yp(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),mm._periodicWaveCache.push({imag:n,partialCount:this._partialCount,partials:this._partials,phase:this._phase,real:e,type:this._type,wave:this._wave}),mm._periodicWaveCache.length>100&&mm._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){Ap(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 Yp(-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 pm(this,t)})}dispose(){return super.dispose(),null!==this._oscillator&&this._oscillator.dispose(),this._wave=void 0,this.frequency.dispose(),this.detune.dispose(),this}}mm._periodicWaveCache=[];class gm extends em{constructor(){super(...arguments),this.name="AudioToGain",this._norm=new nm({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 _m extends Ff{constructor(){const t=Up(_m.getDefaults(),arguments,["value"]);super(t),this.name="Multiply",this.override=!1,this._mult=this.input=this.output=new Pf({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(Ff.getDefaults(),{value:0})}dispose(){return super.dispose(),this._mult.dispose(),this}}class ym extends am{constructor(){const t=Up(ym.getDefaults(),arguments,["frequency","type","modulationType"]);super(t),this.name="AMOscillator",this._modulationScale=new gm({context:this.context}),this._modulationNode=new Pf({context:this.context}),this._carrier=new mm({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 mm({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new _m({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),af(this,["frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(mm.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 pm(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 vm extends am{constructor(){const t=Up(vm.getDefaults(),arguments,["frequency","type","modulationType"]);super(t),this.name="FMOscillator",this._modulationNode=new Pf({context:this.context,gain:0}),this._carrier=new mm({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 Ff({context:this.context,units:"frequency",value:t.frequency}),this._modulator=new mm({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new _m({context:this.context,units:"positive",value:t.harmonicity}),this.modulationIndex=new _m({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),af(this,["modulationIndex","frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(mm.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 pm(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 bm extends am{constructor(){const t=Up(bm.getDefaults(),arguments,["frequency","width"]);super(t),this.name="PulseOscillator",this._widthGate=new Pf({context:this.context,gain:0}),this._thresh=new nm({context:this.context,mapping:t=>t<=0?-1:1}),this.width=new Ff({context:this.context,units:"audioRange",value:t.width}),this._triangle=new mm({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),af(this,["width","frequency","detune"])}static getDefaults(){return Object.assign(am.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 pm(this,t)})}dispose(){return super.dispose(),this._triangle.dispose(),this.width.dispose(),this._widthGate.dispose(),this._thresh.dispose(),this}}class wm extends am{constructor(){const t=Up(wm.getDefaults(),arguments,["frequency","type","spread"]);super(t),this.name="FatOscillator",this._oscillators=[],this.frequency=new Ff({context:this.context,units:"frequency",value:t.frequency}),this.detune=new Ff({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,af(this,["frequency","detune"])}static getDefaults(){return Object.assign(mm.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(Ap(t,1),this._oscillators.length!==t){this._forEach(t=>t.dispose()),this._oscillators=[];for(let e=0;e<t;e++){const n=new mm({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):cf});"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 pm(this,t)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this._forEach(t=>t.dispose()),this}}class xm extends am{constructor(){const t=Up(xm.getDefaults(),arguments,["frequency","modulationFrequency"]);super(t),this.name="PWMOscillator",this.sourceType="pwm",this._scale=new _m({context:this.context,value:2}),this._pulse=new bm({context:this.context,frequency:t.modulationFrequency}),this._pulse.carrierType="sine",this.modulationFrequency=this._pulse.frequency,this._modulator=new mm({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),af(this,["modulationFrequency","frequency","detune"])}static getDefaults(){return Object.assign(am.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 pm(this,t)})}dispose(){return super.dispose(),this._pulse.dispose(),this._scale.dispose(),this._modulator.dispose(),this}}const Sm={am:ym,fat:wm,fm:vm,oscillator:mm,pulse:bm,pwm:xm};class Tm extends am{constructor(){const t=Up(Tm.getDefaults(),arguments,["frequency","type"]);super(t),this.name="OmniOscillator",this.frequency=new Ff({context:this.context,units:"frequency",value:t.frequency}),this.detune=new Ff({context:this.context,units:"cents",value:t.detune}),af(this,["frequency","detune"]),this.set(t)}static getDefaults(){return Object.assign(mm.getDefaults(),vm.getDefaults(),ym.getDefaults(),wm.getDefaults(),bm.getDefaults(),xm.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=Sm[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 Sm[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")&&vp(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")&&vp(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"))&&Sp(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 pm(this,t)})}dispose(){return super.dispose(),this.detune.dispose(),this.frequency.dispose(),this._oscillator.dispose(),this}}class km extends Ff{constructor(){super(Up(km.getDefaults(),arguments,["value"])),this.override=!1,this.name="Add",this._sum=new Pf({context:this.context}),this.input=this._sum,this.output=this._sum,this.addend=this._param,Nf(this._constantSource,this._sum)}static getDefaults(){return Object.assign(Ff.getDefaults(),{value:0})}dispose(){return super.dispose(),this._sum.dispose(),this}}class Am extends em{constructor(){const t=Up(Am.getDefaults(),arguments,["min","max"]);super(t),this.name="Scale",this._mult=this.input=new _m({context:this.context,value:t.max-t.min}),this._add=this.output=new km({context:this.context,value:t.min}),this._min=t.min,this._max=t.max,this.input.connect(this.output)}static getDefaults(){return Object.assign(em.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 Em extends em{constructor(){super(Up(Em.getDefaults(),arguments)),this.name="Zero",this._gain=new Pf({context:this.context}),this.output=this._gain,this.input=void 0,Rf(this.context.getConstant(0),this._gain)}dispose(){return super.dispose(),Df(this.context.getConstant(0),this._gain),this}}class Om extends If{constructor(){const t=Up(Om.getDefaults(),arguments,["frequency","min","max"]);super(t),this.name="LFO",this._stoppedValue=0,this._units="number",this.convert=!0,this._fromType=Mf.prototype._fromType,this._toType=Mf.prototype._toType,this._is=Mf.prototype._is,this._clampValue=Mf.prototype._clampValue,this._oscillator=new mm(t),this.frequency=this._oscillator.frequency,this._amplitudeGain=new Pf({context:this.context,gain:t.amplitude,units:"normalRange"}),this.amplitude=this._amplitudeGain.gain,this._stoppedSignal=new Ff({context:this.context,units:"audioRange",value:0}),this._zeros=new Em({context:this.context}),this._a2g=new gm({context:this.context}),this._scaler=this.output=new Am({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),af(this,["amplitude","frequency"]),this.phase=t.phase}static getDefaults(){return Object.assign(mm.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 Mf||t instanceof Ff)&&(this.convert=t.convert,this.units=t.units),$f(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}}function Cm(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){Ap(r,t,e),n.set(this,r)}})}}function Mm(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){Ap(this.toSeconds(r),t,e),n.set(this,r)}})}}class Im extends am{constructor(){const t=Up(Im.getDefaults(),arguments,["url","onload"]);super(t),this.name="Player",this._activeSources=new Set,this._buffer=new lf({onload:this._onload.bind(this,t.onload),onerror:t.onerror,reverse:t.reverse,url:t.url}),this.autostart=t.autostart,this._loop=t.loop,this._loopStart=t.loopStart,this._loopEnd=t.loopEnd,this._playbackRate=t.playbackRate,this.fadeIn=t.fadeIn,this.fadeOut=t.fadeOut}static getDefaults(){return Object.assign(am.getDefaults(),{autostart:!1,fadeIn:0,fadeOut:0,loop:!1,loopEnd:0,loopStart:0,onload:cf,onerror:cf,playbackRate:1,reverse:!1})}load(t){return a(this,void 0,void 0,function*(){return yield this._buffer.load(t),this._onload(),this})}_onload(t=cf){t(),this.autostart&&this.start()}_onSourceEnd(t){this.onstop(this),this._activeSources.delete(t),0!==this._activeSources.size||this._synced||"started"!==this._state.getValueAtTime(this.now())||(this._state.cancel(this.now()),this._state.setStateAtTime("stopped",this.now()))}start(t,e,n){return super.start(t,e,n),this}_start(t,e,n){e=this._loop?Vp(e,this._loopStart):Vp(e,0);const r=this.toSeconds(e),i=n;n=Vp(n,Math.max(this._buffer.duration-r,0));let o=this.toSeconds(n);o/=this._playbackRate,t=this.toSeconds(t);const s=new um({url:this._buffer,context:this.context,fadeIn:this.fadeIn,fadeOut:this.fadeOut,loop:this._loop,loopEnd:this._loopEnd,loopStart:this._loopStart,onended:this._onSourceEnd.bind(this),playbackRate:this._playbackRate}).connect(this.output);this._loop||this._synced||(this._state.cancel(t+o),this._state.setStateAtTime("stopped",t+o,{implicitEnd:!0})),this._activeSources.add(s),this._loop&&_p(i)?s.start(t,r):s.start(t,r,o-this.toSeconds(this.fadeOut))}_stop(t){const e=this.toSeconds(t);this._activeSources.forEach(t=>t.stop(e))}restart(t,e,n){return super.restart(t,e,n),this}_restart(t,e,n){var r;null===(r=[...this._activeSources].pop())||void 0===r||r.stop(t),this._start(t,e,n)}seek(t,e){const n=this.toSeconds(e);if("started"===this._state.getValueAtTime(n)){const e=this.toSeconds(t);this._stop(n),this._start(n,e)}return this}setLoopPoints(t,e){return this.loopStart=t,this.loopEnd=e,this}get loopStart(){return this._loopStart}set loopStart(t){this._loopStart=t,this.buffer.loaded&&Ap(this.toSeconds(t),0,this.buffer.duration),this._activeSources.forEach(e=>{e.loopStart=t})}get loopEnd(){return this._loopEnd}set loopEnd(t){this._loopEnd=t,this.buffer.loaded&&Ap(this.toSeconds(t),0,this.buffer.duration),this._activeSources.forEach(e=>{e.loopEnd=t})}get buffer(){return this._buffer}set buffer(t){this._buffer.set(t)}get loop(){return this._loop}set loop(t){if(this._loop!==t&&(this._loop=t,this._activeSources.forEach(e=>{e.loop=t}),t)){const t=this._state.getNextState("stopped",this.now());t&&this._state.cancel(t.time)}}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t;const e=this.now(),n=this._state.getNextState("stopped",e);n&&n.implicitEnd&&(this._state.cancel(n.time),this._activeSources.forEach(t=>t.cancelStop())),this._activeSources.forEach(n=>{n.playbackRate.setValueAtTime(t,e)})}get reverse(){return this._buffer.reverse}set reverse(t){this._buffer.reverse=t}get loaded(){return this._buffer.loaded}dispose(){return super.dispose(),this._activeSources.forEach(t=>t.dispose()),this._activeSources.clear(),this._buffer.dispose(),this}}s([Mm(0)],Im.prototype,"fadeIn",void 0),s([Mm(0)],Im.prototype,"fadeOut",void 0);class Nm extends em{constructor(){super(...arguments),this.name="GainToAudio",this._norm=new nm({context:this.context,mapping:t=>2*Math.abs(t)-1}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class Rm extends If{constructor(){const t=Up(Rm.getDefaults(),arguments,["attack","decay","sustain","release"]);super(t),this.name="Envelope",this._sig=new Ff({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(If.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(Sp(t))return t;{let n;for(n in Dm)if(Dm[n][e]===t)return n;return t}}_setCurve(t,e,n){if(Sp(n)&&Reflect.has(Dm,n)){const r=Dm[n];bp(r)?"_decayCurve"!==t&&(this[t]=r[e]):this[t]=r}else{if(!xp(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):(kp(xp(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 $f(this,t,e,n),this}asArray(){return a(this,arguments,void 0,function*(t=1024){const e=t/this.context.sampleRate,n=new hf(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([Mm(0)],Rm.prototype,"attack",void 0),s([Mm(0)],Rm.prototype,"decay",void 0),s([Cm(0,1)],Rm.prototype,"sustain",void 0),s([Mm(0)],Rm.prototype,"release",void 0);const Dm=(()=>{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 Pm extends If{constructor(){const t=Up(Pm.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 zf({context:this.context,volume:t.volume}),this.volume=this._volume.volume,af(this,"volume")}static getDefaults(){return Object.assign(If.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 jm extends Pm{constructor(){const t=Up(jm.getDefaults(),arguments);super(t),this.portamento=t.portamento,this.onsilence=t.onsilence}static getDefaults(){return Object.assign(Pm.getDefaults(),{detune:0,onsilence:cf,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 Tf?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([Mm(0)],jm.prototype,"portamento",void 0);class Lm extends Rm{constructor(){super(Up(Lm.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="AmplitudeEnvelope",this._gainNode=new Pf({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 Fm extends jm{constructor(){const t=Up(Fm.getDefaults(),arguments);super(t),this.name="Synth",this.oscillator=new Tm(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 Lm(Object.assign({context:this.context},t.envelope)),this.oscillator.chain(this.envelope,this.output),af(this,["oscillator","frequency","detune","envelope"])}static getDefaults(){return Object.assign(jm.getDefaults(),{envelope:Object.assign(Gp(Rm.getDefaults(),Object.keys(If.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.3}),oscillator:Object.assign(Gp(Tm.getDefaults(),[...Object.keys(am.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 $m extends jm{constructor(){const t=Up($m.getDefaults(),arguments);super(t),this.name="ModulationSynth",this._carrier=new Fm({context:this.context,oscillator:t.oscillator,envelope:t.envelope,onsilence:()=>this.onsilence(this),volume:-10}),this._modulator=new Fm({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 Ff({context:this.context,units:"frequency"}),this.detune=new Ff({context:this.context,value:t.detune,units:"cents"}),this.harmonicity=new _m({context:this.context,value:t.harmonicity,minValue:0}),this._modulationNode=new Pf({context:this.context,gain:0}),af(this,["frequency","harmonicity","oscillator","envelope","modulation","modulationEnvelope","detune"])}static getDefaults(){return Object.assign(jm.getDefaults(),{harmonicity:3,oscillator:Object.assign(Gp(Tm.getDefaults(),[...Object.keys(am.getDefaults()),"frequency","detune"]),{type:"sine"}),envelope:Object.assign(Gp(Rm.getDefaults(),Object.keys(If.getDefaults())),{attack:.01,decay:.01,sustain:1,release:.5}),modulation:Object.assign(Gp(Tm.getDefaults(),[...Object.keys(am.getDefaults()),"frequency","detune"]),{type:"square"}),modulationEnvelope:Object.assign(Gp(Rm.getDefaults(),Object.keys(If.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 Bm extends $m{constructor(){super(Up(Bm.getDefaults(),arguments)),this.name="AMSynth",this._modulationScale=new gm({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 qm extends If{constructor(){const t=Up(qm.getDefaults(),arguments,["frequency","type"]);super(t),this.name="BiquadFilter",this._filter=this.context.createBiquadFilter(),this.input=this.output=this._filter,this.Q=new Mf({context:this.context,units:"number",value:t.Q,param:this._filter.Q}),this.frequency=new Mf({context:this.context,units:"frequency",value:t.frequency,param:this._filter.frequency}),this.detune=new Mf({context:this.context,units:"cents",value:t.detune,param:this._filter.detune}),this.gain=new Mf({context:this.context,units:"decibels",convert:!1,value:t.gain,param:this._filter.gain}),this.type=t.type}static getDefaults(){return Object.assign(If.getDefaults(),{Q:1,type:"lowpass",frequency:350,detune:0,gain:0})}get type(){return this._filter.type}set type(t){kp(-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 Um extends If{constructor(){const t=Up(Um.getDefaults(),arguments,["frequency","type","rolloff"]);super(t),this.name="Filter",this.input=new Pf({context:this.context}),this.output=new Pf({context:this.context}),this._filters=[],this._filters=[],this.Q=new Ff({context:this.context,units:"positive",value:t.Q}),this.frequency=new Ff({context:this.context,units:"frequency",value:t.frequency}),this.detune=new Ff({context:this.context,units:"cents",value:t.detune}),this.gain=new Ff({context:this.context,units:"decibels",convert:!1,value:t.gain}),this._type=t.type,this.rolloff=t.rolloff,af(this,["detune","frequency","gain","Q"])}static getDefaults(){return Object.assign(If.getDefaults(),{Q:1,detune:0,frequency:350,gain:0,rolloff:-12,type:"lowpass"})}get type(){return this._type}set type(t){kp(-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=vp(t)?t:parseInt(t,10),n=[-12,-24,-48,-96];let r=n.indexOf(e);kp(-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 qm({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,Nf(this.input,...this._internalChannels,this.output)}getFrequencyResponse(t=128){const e=new qm({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()}),uf(this,["detune","frequency","gain","Q"]),this.frequency.dispose(),this.Q.dispose(),this.detune.dispose(),this.gain.dispose(),this}}class Vm extends Rm{constructor(){const t=Up(Vm.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 rm({context:this.context,value:t.exponent}),this._scale=this.output=new Am({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(Rm.getDefaults(),{baseFrequency:200,exponent:1,octaves:4})}get baseFrequency(){return this._baseFrequency}set baseFrequency(t){const e=this.toFrequency(t);Ap(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 Gm extends jm{constructor(){const t=Up(Gm.getDefaults(),arguments);super(t),this.name="MonoSynth",this.oscillator=new Tm(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 Um(Object.assign(t.filter,{context:this.context})),this.filterEnvelope=new Vm(Object.assign(t.filterEnvelope,{context:this.context})),this.envelope=new Lm(Object.assign(t.envelope,{context:this.context})),this.oscillator.chain(this.filter,this.envelope,this.output),this.filterEnvelope.connect(this.filter.frequency),af(this,["oscillator","frequency","detune","filter","filterEnvelope","envelope"])}static getDefaults(){return Object.assign(jm.getDefaults(),{envelope:Object.assign(Gp(Rm.getDefaults(),Object.keys(If.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.9}),filter:Object.assign(Gp(Um.getDefaults(),Object.keys(If.getDefaults())),{Q:1,rolloff:-12,type:"lowpass"}),filterEnvelope:Object.assign(Gp(Vm.getDefaults(),Object.keys(If.getDefaults())),{attack:.6,baseFrequency:200,decay:.2,exponent:2,octaves:3,release:2,sustain:.5}),oscillator:Object.assign(Gp(Tm.getDefaults(),Object.keys(am.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 zm extends jm{constructor(){const t=Up(zm.getDefaults(),arguments);super(t),this.name="DuoSynth",this.voice0=new Gm(Object.assign(t.voice0,{context:this.context,onsilence:()=>this.onsilence(this)})),this.voice1=new Gm(Object.assign(t.voice1,{context:this.context})),this.harmonicity=new _m({context:this.context,units:"positive",value:t.harmonicity}),this._vibrato=new Om({frequency:t.vibratoRate,context:this.context,min:-50,max:50}),this._vibrato.start(),this.vibratoRate=this._vibrato.frequency,this._vibratoGain=new Pf({context:this.context,units:"normalRange",gain:t.vibratoAmount}),this.vibratoAmount=this._vibratoGain.gain,this.frequency=new Ff({context:this.context,units:"frequency",value:440}),this.detune=new Ff({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),af(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 qp(jm.getDefaults(),{vibratoAmount:.5,vibratoRate:5,harmonicity:1.5,voice0:qp(Gp(Gm.getDefaults(),Object.keys(jm.getDefaults())),{filterEnvelope:{attack:.01,decay:0,sustain:1,release:.5},envelope:{attack:.01,decay:0,sustain:1,release:.5}}),voice1:qp(Gp(Gm.getDefaults(),Object.keys(jm.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 Wm extends $m{constructor(){const t=Up(Wm.getDefaults(),arguments);super(t),this.name="FMSynth",this.modulationIndex=new _m({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($m.getDefaults(),{modulationIndex:10})}dispose(){return super.dispose(),this.modulationIndex.dispose(),this}}const Jm=[1,1.483,1.932,2.546,2.63,3.897];class Hm extends jm{constructor(){const t=Up(Hm.getDefaults(),arguments);super(t),this.name="MetalSynth",this._oscillators=[],this._freqMultipliers=[],this.detune=new Ff({context:this.context,units:"cents",value:t.detune}),this.frequency=new Ff({context:this.context,units:"frequency"}),this._amplitude=new Pf({context:this.context,gain:0}).connect(this.output),this._highpass=new Um({Q:0,context:this.context,type:"highpass"}).connect(this._amplitude);for(let e=0;e<Jm.length;e++){const n=new vm({context:this.context,harmonicity:t.harmonicity,modulationIndex:t.modulationIndex,modulationType:"square",onstop:0===e?()=>this.onsilence(this):cf,type:"square"});n.connect(this._highpass),this._oscillators[e]=n;const r=new _m({context:this.context,value:Jm[e]});this._freqMultipliers[e]=r,this.frequency.chain(r,n.frequency),this.detune.connect(n.detune)}this._filterFreqScaler=new Am({context:this.context,max:7e3,min:this.toFrequency(t.resonance)}),this.envelope=new Rm({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 qp(jm.getDefaults(),{envelope:Object.assign(Gp(Rm.getDefaults(),Object.keys(If.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 Xm extends Fm{constructor(){const t=Up(Xm.getDefaults(),arguments);super(t),this.name="MembraneSynth",this.portamento=0,this.pitchDecay=t.pitchDecay,this.octaves=t.octaves,af(this,["oscillator","envelope"])}static getDefaults(){return qp(jm.getDefaults(),Fm.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 Tf?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([Cm(0)],Xm.prototype,"octaves",void 0),s([Mm(0)],Xm.prototype,"pitchDecay",void 0);class Km extends Pm{constructor(){const t=Up(Km.getDefaults(),arguments);super(t),this.name="NoiseSynth",this.noise=new cm(Object.assign({context:this.context},t.noise)),this.envelope=new Lm(Object.assign({context:this.context},t.envelope)),this.noise.chain(this.envelope,this.output)}static getDefaults(){return Object.assign(Pm.getDefaults(),{envelope:Object.assign(Gp(Rm.getDefaults(),Object.keys(If.getDefaults())),{decay:.1,sustain:0}),noise:Object.assign(Gp(cm.getDefaults(),Object.keys(am.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 Ym=new Set;function Zm(t){Ym.add(t)}function Qm(t,e){const n=`registerProcessor("${t}", ${e})`;Ym.add(n)}class tg extends If{constructor(t){super(t),this.name="ToneAudioWorklet",this.workletOptions={},this.onprocessorerror=cf;const e=URL.createObjectURL(new Blob([Array.from(Ym).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}}Zm('\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');Zm("\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");Zm("\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 eg="feedback-comb-filter";Qm(eg,'\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 ng extends tg{constructor(){const t=Up(ng.getDefaults(),arguments,["delayTime","resonance"]);super(t),this.name="FeedbackCombFilter",this.input=new Pf({context:this.context}),this.output=new Pf({context:this.context}),this.delayTime=new Mf({context:this.context,value:t.delayTime,units:"time",minValue:0,maxValue:1,param:this._dummyParam,swappable:!0}),this.resonance=new Mf({context:this.context,value:t.resonance,units:"normalRange",param:this._dummyParam,swappable:!0}),af(this,["resonance","delayTime"])}_audioWorkletName(){return eg}static getDefaults(){return Object.assign(If.getDefaults(),{delayTime:.1,resonance:.5})}onReady(t){Nf(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 rg extends If{constructor(){const t=Up(rg.getDefaults(),arguments,["frequency","type"]);super(t),this.name="OnePoleFilter",this._frequency=t.frequency,this._type=t.type,this.input=new Pf({context:this.context}),this.output=new Pf({context:this.context}),this._createFilter()}static getDefaults(){return Object.assign(If.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 ig extends If{constructor(){const t=Up(ig.getDefaults(),arguments,["delayTime","resonance","dampening"]);super(t),this.name="LowpassCombFilter",this._combFilter=this.output=new ng({context:this.context,delayTime:t.delayTime,resonance:t.resonance}),this.delayTime=this._combFilter.delayTime,this.resonance=this._combFilter.resonance,this._lowpass=this.input=new rg({context:this.context,frequency:t.dampening,type:"lowpass"}),this._lowpass.connect(this._combFilter)}static getDefaults(){return Object.assign(If.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 og extends Pm{constructor(){const t=Up(og.getDefaults(),arguments);super(t),this.name="PluckSynth",this._noise=new cm({context:this.context,type:"pink"}),this.attackNoise=t.attackNoise,this._lfcf=new ig({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 qp(Pm.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 sg extends Pm{constructor(){const t=Up(sg.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),kp(!vp(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(Pm.getDefaults(),{maxPolyphony:32,options:{},voice:Fm})}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 kp(t instanceof jm,"Voice must extend Monophonic class"),t.connect(this.output),this._voices.push(t),t}Np("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 Xf(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 Xf(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){kp(!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),xp(e)){kp(xp(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);kp(o>0,"The duration must be greater than 0"),this.triggerRelease(t[n],i+o)}}else{const n=this.toSeconds(e);kp(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=Gp(t,["onsilence","context"]);return this.options=qp(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 ag extends Pm{constructor(){const t=Up(ag.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(kp(Tp(n)||vp(r)&&isFinite(r),`url key is neither a note or midi pitch: ${n}`),Tp(n)){const r=new Tf(this.context,n).toMidi();e[r]=t.urls[n]}else vp(r)&&isFinite(r)&&(e[r]=t.urls[r])}),this._buffers=new Hf({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(Pm.getDefaults(),{attack:0,baseUrl:"",curve:"exponential",onload:cf,onerror:cf,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=bf(new Tf(this.context,t).toFrequency()),i=Math.round(r),o=r-i,s=this._findClosest(i),a=i-s,u=this._buffers.get(a),c=_f(s+o),l=new um({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),xp(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 Tf(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),xp(e)?(kp(xp(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(kp(Tp(t)||isFinite(t),`note must be a pitch or midi: ${t}`),Tp(t)){const r=new Tf(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([Mm(0)],ag.prototype,"attack",void 0),s([Mm(0)],ag.prototype,"release",void 0);class ug extends If{constructor(){const t=Up(ug.getDefaults(),arguments,["fade"]);super(t),this.name="CrossFade",this._panner=this.context.createStereoPanner(),this._split=this.context.createChannelSplitter(2),this._g2a=new Nm({context:this.context}),this.a=new Pf({context:this.context,gain:0}),this.b=new Pf({context:this.context,gain:0}),this.output=new Pf({context:this.context}),this._internalChannels=[this.a,this.b],this.fade=new Ff({context:this.context,units:"normalRange",value:t.fade}),af(this,"fade"),this.context.getConstant(1).connect(this._panner),this._panner.connect(this._split),this._panner.channelCount=1,this._panner.channelCountMode="explicit",Rf(this._split,this.a.gain,0),Rf(this._split,this.b.gain,1),this.fade.chain(this._g2a,this._panner.pan),this.a.connect(this.output),this.b.connect(this.output)}static getDefaults(){return Object.assign(If.getDefaults(),{fade:.5})}dispose(){return super.dispose(),this.a.dispose(),this.b.dispose(),this.output.dispose(),this.fade.dispose(),this._g2a.dispose(),this._panner.disconnect(),this._split.disconnect(),this}}class cg extends If{constructor(t){super(t),this.name="Effect",this._dryWet=new ug({context:this.context}),this.wet=this._dryWet.fade,this.effectSend=new Pf({context:this.context}),this.effectReturn=new Pf({context:this.context}),this.input=new Pf({context:this.context}),this.output=this._dryWet,this.input.fan(this._dryWet.a,this.effectSend),this.effectReturn.connect(this._dryWet.b),this.wet.setValueAtTime(t.wet,0),this._internalChannels=[this.effectReturn,this.effectSend],af(this,"wet")}static getDefaults(){return Object.assign(If.getDefaults(),{wet:1})}connectEffect(t){return this._internalChannels.push(t),this.effectSend.chain(t,this.effectReturn),this}dispose(){return super.dispose(),this._dryWet.dispose(),this.effectSend.dispose(),this.effectReturn.dispose(),this.wet.dispose(),this}}class lg extends cg{constructor(t){super(t),this.name="LFOEffect",this._lfo=new Om({context:this.context,frequency:t.frequency,amplitude:t.depth}),this.depth=this._lfo.amplitude,this.frequency=this._lfo.frequency,this.type=t.type,af(this,["frequency","depth"])}static getDefaults(){return Object.assign(cg.getDefaults(),{frequency:1,type:"sine",depth:1})}start(t){return this._lfo.start(t),this}stop(t){return this._lfo.stop(t),this}sync(){return this._lfo.sync(),this}unsync(){return this._lfo.unsync(),this}get type(){return this._lfo.type}set type(t){this._lfo.type=t}dispose(){return super.dispose(),this._lfo.dispose(),this.frequency.dispose(),this.depth.dispose(),this}}class hg extends lg{constructor(){const t=Up(hg.getDefaults(),arguments,["frequency","baseFrequency","octaves"]);super(t),this.name="AutoFilter",this.filter=new Um(Object.assign(t.filter,{context:this.context})),this.connectEffect(this.filter),this._lfo.connect(this.filter.frequency),this.octaves=t.octaves,this.baseFrequency=t.baseFrequency}static getDefaults(){return Object.assign(lg.getDefaults(),{baseFrequency:200,octaves:2.6,filter:{type:"lowpass",rolloff:-12,Q:1}})}get baseFrequency(){return this._lfo.min}set baseFrequency(t){this._lfo.min=this.toFrequency(t),this.octaves=this._octaves}get octaves(){return this._octaves}set octaves(t){this._octaves=t,this._lfo.max=this._lfo.min*Math.pow(2,t)}dispose(){return super.dispose(),this.filter.dispose(),this}}class dg extends If{constructor(){const t=Up(dg.getDefaults(),arguments,["pan"]);super(t),this.name="Panner",this._panner=this.context.createStereoPanner(),this.input=this._panner,this.output=this._panner,this.pan=new Mf({context:this.context,param:this._panner.pan,value:t.pan,minValue:-1,maxValue:1}),this._panner.channelCount=t.channelCount,this._panner.channelCountMode="explicit",af(this,"pan")}static getDefaults(){return Object.assign(If.getDefaults(),{pan:0,channelCount:1})}dispose(){return super.dispose(),this._panner.disconnect(),this.pan.dispose(),this}}const pg="bit-crusher";Qm(pg,"\n\tclass BitCrusherWorklet extends SingleIOProcessor {\n\n\t\tstatic get parameterDescriptors() {\n\t\t\treturn [{\n\t\t\t\tname: \"bits\",\n\t\t\t\tdefaultValue: 12,\n\t\t\t\tminValue: 1,\n\t\t\t\tmaxValue: 16,\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 step = Math.pow(0.5, parameters.bits - 1);\n\t\t\tconst val = step * Math.floor(input / step + 0.5);\n\t\t\treturn val;\n\t\t}\n\t}\n");class fg extends cg{constructor(){const t=Up(fg.getDefaults(),arguments,["bits"]);super(t),this.name="BitCrusher",this._bitCrusherWorklet=new mg({context:this.context,bits:t.bits}),this.connectEffect(this._bitCrusherWorklet),this.bits=this._bitCrusherWorklet.bits}static getDefaults(){return Object.assign(cg.getDefaults(),{bits:4})}dispose(){return super.dispose(),this._bitCrusherWorklet.dispose(),this}}class mg extends tg{constructor(){const t=Up(mg.getDefaults(),arguments);super(t),this.name="BitCrusherWorklet",this.input=new Pf({context:this.context}),this.output=new Pf({context:this.context}),this.bits=new Mf({context:this.context,value:t.bits,units:"positive",minValue:1,maxValue:16,param:this._dummyParam,swappable:!0})}static getDefaults(){return Object.assign(tg.getDefaults(),{bits:12})}_audioWorkletName(){return pg}onReady(t){Nf(this.input,t,this.output);const e=t.parameters.get("bits");this.bits.setParam(e)}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this.bits.dispose(),this}}class gg extends cg{constructor(){const t=Up(gg.getDefaults(),arguments,["order"]);super(t),this.name="Chebyshev",this._shaper=new nm({context:this.context,length:4096}),this._order=t.order,this.connectEffect(this._shaper),this.order=t.order,this.oversample=t.oversample}static getDefaults(){return Object.assign(cg.getDefaults(),{order:1,oversample:"none"})}_getCoefficient(t,e,n){return n.has(e)||(0===e?n.set(e,0):1===e?n.set(e,t):n.set(e,2*t*this._getCoefficient(t,e-1,n)-this._getCoefficient(t,e-2,n))),n.get(e)}get order(){return this._order}set order(t){kp(Number.isInteger(t),"'order' must be an integer"),this._order=t,this._shaper.setMap(e=>this._getCoefficient(e,t,new Map))}get oversample(){return this._shaper.oversample}set oversample(t){this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.dispose(),this}}class _g extends cg{constructor(t){super(t),this.name="FeedbackEffect",this._feedbackGain=new Pf({context:this.context,gain:t.feedback,units:"normalRange"}),this.feedback=this._feedbackGain.gain,af(this,"feedback"),this.effectReturn.chain(this._feedbackGain,this.effectSend)}static getDefaults(){return Object.assign(cg.getDefaults(),{feedback:.125})}dispose(){return super.dispose(),this._feedbackGain.dispose(),this.feedback.dispose(),this}}class yg extends _g{constructor(){const t=Up(yg.getDefaults(),arguments,["pitch"]);super(t),this.name="PitchShift",this._frequency=new Ff({context:this.context}),this._delayA=new Gf({maxDelay:1,context:this.context}),this._lfoA=new Om({context:this.context,min:0,max:.1,type:"sawtooth"}).connect(this._delayA.delayTime),this._delayB=new Gf({maxDelay:1,context:this.context}),this._lfoB=new Om({context:this.context,min:0,max:.1,type:"sawtooth",phase:180}).connect(this._delayB.delayTime),this._crossFade=new ug({context:this.context}),this._crossFadeLFO=new Om({context:this.context,min:0,max:1,type:"triangle",phase:90}).connect(this._crossFade.fade),this._feedbackDelay=new Gf({delayTime:t.delayTime,context:this.context}),this.delayTime=this._feedbackDelay.delayTime,af(this,"delayTime"),this._pitch=t.pitch,this._windowSize=t.windowSize,this._delayA.connect(this._crossFade.a),this._delayB.connect(this._crossFade.b),this._frequency.fan(this._lfoA.frequency,this._lfoB.frequency,this._crossFadeLFO.frequency),this.effectSend.fan(this._delayA,this._delayB),this._crossFade.chain(this._feedbackDelay,this.effectReturn);const e=this.now();this._lfoA.start(e),this._lfoB.start(e),this._crossFadeLFO.start(e),this.windowSize=this._windowSize}static getDefaults(){return Object.assign(_g.getDefaults(),{pitch:0,windowSize:.1,delayTime:0,feedback:0})}get pitch(){return this._pitch}set pitch(t){this._pitch=t;let e=0;t<0?(this._lfoA.min=0,this._lfoA.max=this._windowSize,this._lfoB.min=0,this._lfoB.max=this._windowSize,e=_f(t-1)+1):(this._lfoA.min=this._windowSize,this._lfoA.max=0,this._lfoB.min=this._windowSize,this._lfoB.max=0,e=_f(t)-1),this._frequency.value=e*(1.2/this._windowSize)}get windowSize(){return this._windowSize}set windowSize(t){this._windowSize=this.toSeconds(t),this.pitch=this._pitch}dispose(){return super.dispose(),this._frequency.dispose(),this._delayA.dispose(),this._delayB.dispose(),this._lfoA.dispose(),this._lfoB.dispose(),this._crossFade.dispose(),this._crossFadeLFO.dispose(),this._feedbackDelay.dispose(),this}}class vg extends If{constructor(){const t=Up(vg.getDefaults(),arguments,["solo"]);super(t),this.name="Solo",this.input=this.output=new Pf({context:this.context}),vg._allSolos.has(this.context)||vg._allSolos.set(this.context,new Set),vg._allSolos.get(this.context).add(this),this.solo=t.solo}static getDefaults(){return Object.assign(If.getDefaults(),{solo:!1})}get solo(){return this._isSoloed()}set solo(t){t?this._addSolo():this._removeSolo(),vg._allSolos.get(this.context).forEach(t=>t._updateSolo())}get muted(){return 0===this.input.gain.value}_addSolo(){vg._soloed.has(this.context)||vg._soloed.set(this.context,new Set),vg._soloed.get(this.context).add(this)}_removeSolo(){vg._soloed.has(this.context)&&vg._soloed.get(this.context).delete(this)}_isSoloed(){return vg._soloed.has(this.context)&&vg._soloed.get(this.context).has(this)}_noSolos(){return!vg._soloed.has(this.context)||vg._soloed.has(this.context)&&0===vg._soloed.get(this.context).size}_updateSolo(){this._isSoloed()||this._noSolos()?this.input.gain.value=1:this.input.gain.value=0}dispose(){return super.dispose(),vg._allSolos.get(this.context).delete(this),this._removeSolo(),this}}vg._allSolos=new Map,vg._soloed=new Map;class bg extends If{constructor(){const t=Up(bg.getDefaults(),arguments,["pan","volume"]);super(t),this.name="PanVol",this._panner=this.input=new dg({context:this.context,pan:t.pan,channelCount:t.channelCount}),this.pan=this._panner.pan,this._volume=this.output=new zf({context:this.context,volume:t.volume}),this.volume=this._volume.volume,this._panner.connect(this._volume),this.mute=t.mute,af(this,["pan","volume"])}static getDefaults(){return Object.assign(If.getDefaults(),{mute:!1,pan:0,volume:0,channelCount:1})}get mute(){return this._volume.mute}set mute(t){this._volume.mute=t}dispose(){return super.dispose(),this._panner.dispose(),this.pan.dispose(),this._volume.dispose(),this.volume.dispose(),this}}class wg extends If{constructor(){const t=Up(wg.getDefaults(),arguments,["volume","pan"]);super(t),this.name="Channel",this._solo=this.input=new vg({solo:t.solo,context:this.context}),this._panVol=this.output=new bg({context:this.context,pan:t.pan,volume:t.volume,mute:t.mute,channelCount:t.channelCount}),this.pan=this._panVol.pan,this.volume=this._panVol.volume,this._solo.connect(this._panVol),af(this,["pan","volume"])}static getDefaults(){return Object.assign(If.getDefaults(),{pan:0,volume:0,mute:!1,solo:!1,channelCount:1})}get solo(){return this._solo.solo}set solo(t){this._solo.solo=t}get muted(){return this._solo.muted||this.mute}get mute(){return this._panVol.mute}set mute(t){this._panVol.mute=t}_getBus(t){return wg.buses.has(t)||wg.buses.set(t,new Pf({context:this.context})),wg.buses.get(t)}send(t,e=0){const n=this._getBus(t),r=new Pf({context:this.context,units:"decibels",gain:e});return this.connect(r),r.connect(n),r}receive(t){return this._getBus(t).connect(this),this}dispose(){return super.dispose(),this._panVol.dispose(),this.pan.dispose(),this.volume.dispose(),this._solo.dispose(),this}}wg.buses=new Map;const xg=ff().transport;ff().destination,ff().destination;ff().listener;ff().draw;ff();const Sg={synth:{new:t=>new Fm(t)},amsynth:{new:t=>new Bm(t)},duosynth:{new:t=>new zm(t)},fmsynth:{new:t=>new Wm(t)},membranesynth:{new:t=>new Xm(t)},metalsynth:{new:t=>new Hm(t)},monosynth:{new:t=>new Gm(t)},noisesynth:{new:t=>new Km(t)},plucksynth:{new:t=>new og(t)},polysynth:{new:(t,e)=>new sg(t,e)},sampler:{new:t=>new ag(t)}},Tg={synth:Fm,monosynth:Gm,fmsynth:Wm,duosyntho:zm,amsynth:Bm},kg={autofilter:{new:t=>new hg(t)},bitcrusher:{new:t=>new fg(t)},chebyshev:{new:t=>new gg(t)},pitchshift:{new:t=>new yg(t)}},Ag=(t,e,n=!1)=>{try{if(e?.effect){return n?(globalThis.sound[t].set(e.effect.options),globalThis.sound[t]):kg[e.effect.type]?.new(e.effect.options)}throw"effect is not defined in the config"}catch(t){return}},Eg=()=>{globalThis.sound={}},Og=()=>{"started"!==xg.state&&(pf.resume(),xg.start())},Cg=t=>{globalThis.sound[t]&&(globalThis.sound[t].dispose(),delete globalThis.sound[t])},Mg={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"]},Ig=(t,e=0)=>{const n=1+Math.floor((t-24)/12);return Mg[t-12*(n-1)][e]+String(n)},Ng=t=>{const e=t[qg.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[qg.REFNODE]},u=Sn("accio","data_accio");(n?v_(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[qg.sound.CONFIG]=e});const c=(e=void 0)=>{if(e){const o=e._content.soundnode_trail.slice(-1)[0],a=t[qg.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[qg.REFNODE])}}},l=(e=void 0)=>{let n,s;e?(n=Tn("soundconfig",e),t[qg.sound.CONFIG]=n):n=t[qg.sound.CONFIG],s=r?((t,e,n=!1)=>{try{if(e?.instrument)return n?(globalThis.sound[t].set(e.instrument.options),globalThis.sound[t]):Sg[e.instrument.type]?.new(e.instrument.voice?Tg[e.instrument.voice]:Fm,e.instrument.options);throw"instrument is not defined in the config"}catch(t){return}})(t[qg.REFNODE],n):i?void 0:o?Ag(t[qg.REFNODE],n,void 0!==t[qg.sound.SOUNDSTAGE]):Ag(t[qg.REFNODE],n),t[qg.sound.SOUNDSTAGE]=s,((t,e)=>{globalThis.sound[t]=e})(t[qg.REFNODE],s)};return{leaflogic:(e,n)=>{const r=new _t(void 0),i=n._stream.pipe(ut(e=>(t[qg.CTRLIN]=e,e)),at(...e.map(t=>t._stream)),ut(e=>{const n=e.slice(1).flat().map(t=>{if("_data_in"===t._bname)return Tn("*",t);if("_midi_in"===t._bname)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[qg.CTRLIN]}),ft());return{_stream:r.pipe(gt(t=>t)),_control:{_stream:i}}},datalogic:{pre:e=>{const n=e;return t[qg.sound.SOUNDSTAGE]||s||l(),s&&Og(),n},post:e=>{Array.isArray(e);let n=e.map(e=>{if("_midi_in"===e._bname){const n=t[qg.sound.SOUNDSTAGE];if(e._content.velocity>0){const t=Ig(e._content.noteNumber),r=e._content.duration;r?n.triggerAttackRelease(t,r):n.triggerAttack(t)}else{const t=Ig(e._content.noteNumber);n.triggerRelease(t)}return kn}return e});n=1===n.length?n[0]:n;return n}}}},Rg=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in gnav.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/gnav.js"},{}),Dg=t=>{const e=t[qg.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[qg.REFNODE]};let s={};return{leaflogic:(e,n)=>{s=n._config;const a=new dt,u=r?k_(n,e,void 0,o,{leaflogic:r,datalogic:{post:e=>(t[qg.gnav.EDGES]=e,e)}}):{_stream:He([]),_control:n._stream},c=(i?k_(u._control,e,void 0,o,{leaflogic:i,datalogic:{post:e=>(t[qg.gnav.BACKDROP]=e,e)}}):{_stream:He("/assets/test/hubbleinfrared_dark2.jpg"),_control:u._control})._control._stream.pipe(at(...e.map(t=>t._stream)),ut(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=>Tn("screenio",t)).filter(t=>t):Tn("screenio",t),post:r=>{const i=r,o=Tn(t[qg.gnav.EDGES]),a=(o||[]).map(t=>({...t,uuid:Zn()})),u=t[qg.gnav.BACKDROP],c=new _t(Rg),l=Ug({element:{nodeuuid:t[qg.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 v_(t,[],{...s}):[]},tagaction:async r=>{const i="tagaction"in e&&"_default"in e.tagaction?e.tagaction._default:void 0,o=i?await v_(i,r,{...s}):r;return n&&c.next(Sn("elementio",{element:"gnav",nodeuuid:t[qg.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 v_(n,t,{...s}):t},graph_options:{layout:"3d"},...t[qg.RTCONTEXT]}}},"screenio");return l}}}},Pg=t=>{const e=t[qg.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[qg.REFNODE]},o=async(n,r={})=>{let i=t[qg.http.URI],o=t[qg.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&&Ue(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=qg.DOMAIN?t[qg.DOMAIN]:void 0,h=qg.APPID?t[qg.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)}):He([{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"}):He([{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 dt,u=n?k_(s,e,void 0,i,{leaflogic:n,datalogic:{post:e=>(t[qg.http.URI]=e,e)}}):(t[qg.http.URI]="{*}",{_stream:new _t("{*}"),_control:{_stream:s._stream}}),c=r?k_(s,e,void 0,i,{leaflogic:r,datalogic:{post:e=>(t[qg.http.HEADER]=e,e)}}):(t[qg.http.HEADER]="",{_stream:new _t(""),_control:{_stream:s._stream}}),l=rn([u._control._stream,c._control._stream]),h=rn([u._stream,c._stream]),d=l.pipe(at(h),ut(t=>t[0]));let p=!1;const f=d.pipe(at(...e.map(t=>t._stream)),ct(t=>o(t.slice(1),t[0])),ut(e=>(p=!0,e?.length>1||!Array.isArray(e)?a.next(e):1===e?.length&&a.next(e[0]),t[qg.CTRLIN])),ft());return{_stream:a.pipe(gt(t=>p),ut(t=>t),ft()),_control:{_stream:f.pipe(ut(t=>t),ft())}}},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 Ug(e?.name&&"AxiosError"===e.name?{error:e.message,data:e.response.data}:n(e),"elementio")}}}},jg=t=>{const e=t[qg.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[qg.REFNODE]},i=async e=>{let n=t[qg.href.URI],r=e;r=1===r.length?r[0]:r,"{*}"===n&&Ue(r)&&"href-request"===r._bname&&(n=r._content.uri?r._content.uri:"https://www.leafgon.com",r=r._content.data?r._content.data:"");const i=n,o=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:i}),1e3);return await o()};return{leaflogic:(e,o)=>{const s=new dt,a=n?k_(o,e,void 0,r,{leaflogic:n,datalogic:{post:e=>(t[qg.href.URI]=e,e)}}):(t[qg.href.URI]="{*}",{_stream:new _t("{*}"),_control:{_stream:o._stream}}),u=a._control._stream,c=a._stream,l=u.pipe(at(c),ut(t=>t[0]));let h=!1;const d=l.pipe(at(...e.map(t=>t._stream)),ct(t=>i(t.slice(1))),ut(e=>(h=!0,e?.length>1||!Array.isArray(e)?s.next(e):1===e?.length&&s.next(e[0]),t[qg.CTRLIN])),ft());return{_stream:s.pipe(gt(t=>h),ut(t=>t),ft()),_control:{_stream:d.pipe(ut(t=>t),ft())}}},datalogic:{pre:t=>t}}};var Lg=n(639);const Fg=t=>{const e=new dt,n=new dt,r=new dt,i=t[qg.LAMBDA_OBJ],o="_default"in i?i._default:void 0,s={codebase:"ghostos/api/parser/nodelogic/elements/library/html.js",...t},a=Sn("accio","ctrl_accio"),u=Sn("accio","data_accio"),c=o?k_({_stream:He(a)},[{_stream:He(u)}],void 0,s,{leaflogic:o,datalogic:{post:t=>t}}):{_stream:He(""),_control:{_stream:He(a)}};t[qg.html.TEMPLATE]=void 0,Je(c._control._stream.pipe(at(c._stream))).then(e=>{const n=typeof e[1];if("string"===n)t[qg.html.TEMPLATE]={_default:Lg.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]=Lg.compile(r))}),Object.keys(n).length>0&&(t[qg.html.TEMPLATE]=n)}Lg.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('${ze.hp.from(t).toString("base64")}')`}),Lg.registerHelper("json",function(t){const e=ze.hp.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}'))`}),Lg.registerHelper("tostring",function(t){return String(t)}),r.next()});return{elementio$:n,leaflogic:(i,o)=>{const s=o._stream.pipe(at(...i.map(t=>t._stream)),ct(e=>{const i=new _t(e[0]),o=new _t(e[1]);return t[qg.html.TEMPLATE]?rn(i,Et(o,n)):r.pipe(at(i,Et(o,n)),ut(t=>t[1]))}),ut(r=>{const i=t[qg.html.TEMPLATE],o=r[1];if(Ue(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=>Tn("*",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(Ue(t)){const n=Tn("*",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=Ug({element:{nodeuuid:t[qg.REFNODE],type:"html",componentdata:{innerhtml:s,callback:t=>{n.next(Sn("elementio",t))},...t[qg.RTCONTEXT]}}},"screenio");return e.next(a),r[0]}}),gt(t=>void 0!==t));return{_stream:e,_control:{_stream:s}}},datalogic:{pre:t=>t,post:t=>t}}},$g=t=>{const e=new dt,n=new dt,r=new dt,i=t[qg.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=Sn("accio","ctrl_accio"),c=Sn("accio","data_accio"),l=o?k_({_stream:He(u)},[{_stream:He(c)}],void 0,a,{leaflogic:o,datalogic:{post:t=>t}}):{_stream:He(""),_control:{_stream:He(u)}};t[qg.html.TEMPLATE]=void 0,Je(l._control._stream.pipe(at(l._stream))).then(e=>{const n=typeof e[1];if("string"===n)t[qg.html.TEMPLATE]={_default:Lg.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]=Lg.compile(r))}),Object.keys(n).length>0&&(t[qg.html.TEMPLATE]=n)}Lg.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(at(...i.map(t=>t._stream)),ct(e=>{const i=new _t(e[0]),o=new _t(e[1]);return t[qg.html.TEMPLATE]?rn(i,Et(o,n)):r.pipe(at(i,Et(o,n)),ut(t=>t[1]))}),ut(n=>{const r=t[qg.html.TEMPLATE],i=n[1];if(Ue(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[qg.REFNODE].slice(0,8)}', _content: formData, _label: {refnode: '${t[qg.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[qg.REFNODE]}')\n );\n <\/script>\n `,n=`\n <div id='${t[qg.REFNODE]}'></div>\n `,r=t=>t.replace(/(\r\n|\n|\r)/gm,"").replace(/(\s+)/gm," "),i=t[qg.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 Sn(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[qg.REFNODE]})})();return e.next(r),n[0]}}),gt(t=>void 0!==t));return{_stream:e,_control:{_stream:a}}},datalogic:{pre:t=>t,post:t=>t}}},Bg=t=>{const e=t[qg.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=>{const r=t[qg.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=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&&(Tu.defaults.headers.post["X-CSRF-Token"]=r.X_CSRF_Token);try{const t=s.includes("put")?Tu.put(e,i):Tu.post(e,i);return await t}catch(t){return t.response||t.request,t.response}}else try{const t=e?Tu.get(e):He([{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[qg.REFNODE]};return{leaflogic:(e,s)=>{const a=new dt,u=n?k_(s,e,void 0,o,{leaflogic:n,datalogic:{post:e=>(t[qg.http.URI]=e,e)}}):{_stream:He("https://httpbin.org"),_control:{_stream:s._stream}},c=r?k_(s,e,void 0,o,{leaflogic:r,datalogic:{post:e=>(t[qg.http.HEADER]=e,e)}}):{_stream:He(""),_control:{_stream:s._stream}},l=rn([u._control._stream,c._control._stream]),h=rn([u._stream,c._stream]),d=l.pipe(at(h),ut(t=>t[0]));let p=!1;const f=d.pipe(at(...e.map(t=>t._stream)),ct(t=>i(t.slice(1))),ut(e=>(p=!0,e?.length>1||!Array.isArray(e)?a.next(e):1===e?.length&&a.next(e[0]),t[qg.CTRLIN])),ft());return{_stream:a.pipe(gt(t=>p),ut(t=>t),ft()),_control:{_stream:f.pipe(ut(t=>t),ft())}}},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 Ug(e(t),"elementio")}}}},qg={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"}},Ug=(t,e="defaultio",n=!0)=>n?Sn(e,t):t,Vg={mediaplayer:Au,http:Pg,gnav:Dg,popup:Mu,image:Du,editor:Nu,text:Ru,prompt:Ou,mediainput:ju,midi:$u,sound:Ng,html:Fg,href:jg,form:$g,directus:Bg},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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=n.leaf.logic.args.elementname,a=t.gos.etaTree.domain,u=t.gos.etaTree.appid,c="domain"in o&&"_default"in o.domain?o.domain._default:void 0,l="appid"in o&&"_default"in o.appid?o.appid._default:void 0,h="uidefs"in o&&"_default"in o.uidefs?o.uidefs._default:void 0,d="edges"in o&&"_default"in o.edges?o.edges._default:void 0,p="elementio"in o;["f30e","7a65"].includes(e.slice(0,4));const f={codebase:"leafelement.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};let m={};m[qg.LAMBDA_OBJ]=o,m[qg.REFNODE]=e,m[qg.RTCONTEXT]={graphdomain:a,graphappid:u,refnodedata:n,nodelambda:r,contextuallambda:i};const g=((t,e)=>Object.keys(Vg).includes(e)&&Vg[e]?{...Vg[e](t)}:void 0)(m,s);return(n,r)=>{e?.slice(0,4);const i=r._stream.pipe(ut(e=>(m[qg.CTRLIN]=e,m[qg.DOMAIN]=t.gos.etaTree.domain,m[qg.APPID]=t.gos.etaTree.appid,e)));(t=>{t.pipe(Xe(t=>{const e=rn(n.map(t=>t._stream)),i=He(t),a=k_({_stream:i},n,void 0,{...f,step:"get the current domain"},{leaflogic:c,datalogic:{pre:t=>{m._input_data=t},post:t=>(m.domain=t,t)}}),u=k_(a._control,n,void 0,{...f,step:"get the current domain"},{leaflogic:l,datalogic:{post:t=>(m.appid=t,t)}});if(["http"].includes(s)){const t="uri"in o&&"_default"in o.uri?o.uri._default:void 0,s="header"in o&&"_default"in o.header?o.header._default:void 0,c=t?x_(t,e,void 0,i,{...r._config}):{_stream:He([]),_control:{_stream:i}},l=s?x_(s,e,void 0,i,{...r._config}):{_stream:He([]),_control:{_stream:i}},h=rn([a._control._stream,u._control._stream,c._control._stream,l._control._stream]).pipe(ut(t=>t[0])),d={};return h.pipe(ut(t=>rn([...n.map(t=>t._stream),a._stream,u._stream,c._stream,l])),Xe(t=>{d._metadata=t;const e=Object.keys(o),n=["uri","post","put","get","header","?graph"].filter(t=>e.includes(t)),r=n.includes("?graph")?t[3]+`?graph=${t[1]}/${t[2]}`:t[3];if(n.includes("post")||n.includes("put")){t[4].X_CSRF_Token&&(Tu.defaults.headers.post["X-CSRF-Token"]=t[4].X_CSRF_Token);try{return n.includes("put")?Tu.put(r,t[0]):Tu.post(r,t[0])}catch(t){t.response||t.request}}else try{return Tu.get(r)}catch(t){t.response||t.request}}),ut(t=>{const e=t=>{const n=typeof t;return"object"===n?Array.isArray(t)?t.map(t=>e(t)):Object.fromEntries(Object.entries(t).map(([t,n])=>[t,e(n)])):"string"===n?(t=>{var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return t.replace(/[&<>"']/g,function(t){return e[t]})})(t):t};return((t,e="defaultio")=>p?Sn(e,t):t)(e(t.data),"elementio")}))}if(["mediaplayer"].includes(s)){const t="uri"in o&&"_default"in o.uri?o.uri._default:void 0,s=t?x_(t,e,void 0,i,{...r._config}):{_stream:He([])};return rn([a._control._stream,u._control._stream,s._control._stream]).pipe(ut(t=>t[0])).pipe(ut(t=>rn([...n.map(t=>t._stream),a._stream,u._stream,s._stream])))}if(["gnav","popup","image","editor","text","prompt"].includes(s)){const t=h?k_(u._control,n,void 0,f,{leaflogic:h,datalogic:{post:t=>(m.uidefs=t,t)}}):void 0,e=k_(h?t._control:u._control,n,void 0,f,{leaflogic:d,datalogic:{post:t=>(m.edges=t,t)}}),r="backdrop"in o&&"_default"in o.backdrop?o.backdrop._default:void 0;return("gnav"==s?r?k_(e._control,n,void 0,f,{leaflogic:r,datalogic:{post:t=>(m.backdrop=t,t)}}):{_stream:He("/assets/test/hubbleinfrared_dark2.jpg"),_control:{_stream:i}}:{_stream:He([]),_control:{_stream:i}})._control._stream.pipe(ut(t=>[m._input_data,m.domain,m.appid,m.uidefs,m.edges,m.backdrop]))}}))})(i),"elementio$"in g&&(t.gos.etaTree.leafio.elementioLUT[e]=g.elementio$);return k_({_stream:i},n,void 0,{...f,metastep:"element "+s},{leaflogic:g?g.leaflogic:void 0,datalogic:{pre:g?g.datalogic.pre:void 0,post:g?g.datalogic.post:void 0}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({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,t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:Mo(JSON.stringify(i))}})},getTextSource:()=>n.leaf.logic.args.elementconfig},general:{getNodeData:()=>n,getLambdaLUT:async()=>{const n=await Qg({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:Mo(JSON.stringify(i))}})}}}}};function zg(t,e,n){const r={leafoutflowport:xn,leafinflowport:wn,leafscreenio:An,leafmemoryio:Hn,leafdeckspade:ts,leafdeckheart:ns,leafdeckdiamond:is,leafdeckclub:ss,leafgnav:as,leafpopupview:us,leafelement:Gg,leafgraph:p_,leaflambdagraph:e_,leafanchor:f_,leafspell:r_,leafspelldef:i_,leafloopyspell:u_,leafchronosflow:Uo,leafasyncflow:Uo,leafmixflow:Vo,leafgateflow:zo,leaflisp:qo,leaflabel:Jo,leafdelabel:Ho,leafbottle:Xo,leafunbottle:Ko,leafcrate:Yo,leafconfig:Zo};return r[t][e]?r[t][e](n):void 0}const{memoize:Wg}=bn,Jg={isdebug:!1},Hg=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in eta.js",codebase:"/src/ghostos/api/parser/eta.js"},{}),Xg=(t,e)=>([...Array(e).keys()].map(e=>{t[e]=!1}),t),Kg=(t,e={time:-1,count:-1},n=void 0,r={})=>{const i=new dt,o=t.map(t=>t._control._stream),s=t.map(t=>t._stream),a={};let u={};const c=t.length;Xg(a,c);return{ctrl:n&&n.synchronized?Et(...t.map((t,e)=>t._control._stream.pipe(at(t._stream),ut(t=>[e,t])))).pipe(ut(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)){Xg(a,c);const t=Object.values(u);return u={},t}}),gt(t=>void 0!==t),ut(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}}),gt(t=>void 0!==t)):o.length>1?Et(...o.map((t,e)=>t.pipe(at(s[e]),ut(t=>{const e=t[0];e.length>1&&e.includes(void 0),r.nodeuuid,Ue(t[1])&&t[1]._bname;let n=t.slice(1);return i.next(n),e})))):o[0].pipe(at(s[0]),ut(t=>{const e=t[0];Ue(t[1])&&t[1]._bname;let n=t[1];return i.next(n),e})),data:i.pipe(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Hg)))}},Yg=(t,e,n,r,i,o,s)=>{const a={refnode:t,codebase:"eta.js weaveDataflowPlane",domain:i.domain,appid:i.appid},u=Sn("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(ut(t=>t)),_control:{_stream:c[t].ctrl_out._stream.pipe(ut(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(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Hg)),ut(t=>(["c10cbbbb-14d5-4270-b17a-1965afcabc98"].includes(o),Ue(t)&&t._bname,["c822ae2e-1be8-46be-b2cb-21a43cef0555","e9e6e44b-792b-46d0-b1d3-58ce2f46c45b"].includes(o)&&Ue(t)&&t._bname,t)))),data_out:void 0,ctrl_in$Arr:e.map((t,e)=>t._stream.pipe(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Hg)),ut(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:Et(...c[t].get_composite_in$objArr().map(t=>t._control._stream)),data:void 0}:Kg(c[t].get_composite_in$objArr(),{time:-1,count:-1},c[t],{...a,...m,at:"eta.js _weaveDataflowPlane",nodeuuid:t}),v={_stream:_.pipe(ut(t=>t))},b=g?c[t].get_composite_in$objArr().map((t,e)=>({_stream:t._stream.pipe(ut(t=>t))})):[{_stream:y.pipe(ut(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(ut(t=>t)),_control:{_stream:e._control._stream.pipe(ut(t=>t))}}}{const e=d._default(b,v);return c[t].data_out={_stream:e._stream.pipe(ut(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(ut(t=>t))},{_stream:c[t].data_out._stream.pipe(ut(t=>t)),_control:{_stream:c[t].ctrl_out._stream.pipe(ut(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(ut(t=>t)),_control:{_stream:e._control._stream.pipe(ut(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(ut(t=>t)),_control:{_stream:e._control._stream.pipe(ut(t=>t))}}}{const e=b.map(t=>({_stream:t._stream.pipe(ut(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(ut(t=>t)),_control:{_stream:n._control._stream.pipe(ut(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 dt;return{ctrl:Et(...t.map(t=>{let e;return t._control._stream.pipe(ut(t=>(e=globalThis.TRACEON?{...t,traces:T_(t?.traces,{...n,desc:"doChronosAsynchronize(), a ctrl signal came through out of inputcount of "+r},!0)}:t,e)),at(t._stream),ut(t=>(i.next(2===t.length?t[1]:t.slice(1)),t[0])),ft())})).pipe(ut(t=>t)),data:i.pipe(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Hg)))}})(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]},Zg=Wg(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=>{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(s=[],u)=>{const c={data_in:new dt,ctrl_in:new dt,data_out:new dt,ctrl_out:new dt},l={_stream:c.data_in},h={_stream:c.ctrl_in,_config:{}};["3980759d-7c59-4b9e-b799-87b5fd4cbcec","62890d97-837a-463e-aac9-d7fca2293427"].includes(t),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t);const[d]=Yg(t,e,n,r,i,h,l);return k_(u,s,void 0,{...a,metastep:"invoking parseDataflowFunc()"},{leaflogic:(t,e)=>{const n=new dt;let r;const i=e._stream.pipe(ut(t=>(r=t,t)),at(...t.map(t=>t._stream)),ct(e=>{o.refnode,t.length;const n=1===t.length?e[1]:e.slice(1);return setTimeout(()=>{c.data_in.next(n),c.ctrl_in.next(r)},1),d._control._stream}),at(d._stream),ut(t=>{if(Ue(t[1])&&"error"===t[1]._bname);else{const e=t[1];void 0!==e&&n.next(e)}return t[0]}),ft());return{_stream:n.pipe(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Hg))),_control:{...e,_stream:i}}},datalogic:{}})}})(t,i,o,s,r);return u},({refnode:t,component_members:e,contextuallambda:n,etaTree:r}={})=>JSON.stringify([...e,...n,r.sessionid])),Qg=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=Zg({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},t_=(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 Wn(h).getEtaTree(t,e);return o?await h.etaReduceLEAFNode({nodeuuid:n,contextuallambda:i}):await Qg({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=zg(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=zg(r.type,"methods",i);if(o&&!(t in h.leafnodemethods))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 Tu.get(t);h.esmcache[t]=e.data}return h.esmcache[t]},initTree:(t,e,n,r,i)=>{h.config=Jg,h.leafgraph=t,h.graphcomponents=e,h.rootgraphstate="initialized",h.leafio=n,h.leaflakeio=r,h.mnemosyne=i,h.esmcache={},void 0===h.hostEtaTree&&Wn(h).initEtaTreeForest();return h.etaReduceLEAFNode=Wg(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=zg(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=Zn(),h},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)}) has a leaflambdagraph node (${e}) referencing an undefined lambda construct.`;const o=await Qg({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{...vn(t),_control:e}}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({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}},n_=t=>Object.keys(t).map(e=>0===Object.keys(t[e]).length?e:void 0).filter(t=>t).sort(),r_={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 Qg({refnode:e,nodelambda:r,contextuallambda:a,etaTree:t.gos.etaTree});const c=n_(u);let l;c.length>0&&(a=a.concat(c),u=await Qg({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 r=e[n];"accio"===n&&t.slice(0,4);const s=await o.etaReduceLEAFNode({nodeuuid:r,contextuallambda:i});return"accio"===n&&t.slice(0,4),s}},d={codebase:"leafspell.js",refnode:e,leafnode:t.gos.etaTree?.leafgraph?.graph.dataflow.getNodeAttributes(e).leafnode.data};let p=s?void 0:S_((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=k_({...r,_stream:n.pipe(ut(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(at(c._stream),ut(t=>(t[0].sid?.pop(),t)),Pu(()=>{}))},c=k_(r,n,void 0,{...d,metastep:"executing spell "+o},{leaflogic:s?(e,n)=>{const r=new dt,i=new dt,o=new dt,s=new dt,a=new dt;let c;const l=e.length>1?Et(...e.map(t=>t._stream)):e[0]._stream,h=n._stream.pipe(at(l),ct(e=>{const n=e[1];if(Ue(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}),at(s),ut(t=>(r.next(t[1][1]),a.next(t[1][0]),t[1])),at(a),ut(t=>t[1]),Pu(()=>{void 0!==c&&(c.unsubscribe(),c=void 0)}),ft());return{_stream:r,_control:{...n,_stream:h}}}:(t,e)=>{const n=new dt,r=new dt,i=new dt,o=new dt,s=new dt;let a;const c=e._stream.pipe(at(...t.map(t=>t._stream)),ct(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)),at(o),ut(t=>(n.next(t[1][1]),s.next(t[1][0]),t[1])),at(s),ut(t=>t[1]),Pu(()=>{void 0!==a&&(a.unsubscribe(),a=void 0)}),ft());return{_stream:n,_control:{...e,_stream:c}}},datalogic:{pre:i,post:a}});return{_stream:c._stream.pipe(ut(t=>t),ft()),_control:{_stream:c._control._stream.pipe(ut(t=>t),ft())}}}},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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});const n=n_(a);n.length>0&&(u=u.concat(n),a=await Qg({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 r=e[n];"accio"===n&&t.slice(0,4);const s=await o.etaReduceLEAFNode({nodeuuid:r,contextuallambda:i});return"accio"===n&&t.slice(0,4),s}};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}},i_={dataflow:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...vn(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 Qg({refnode:e,nodelambda:o,contextuallambda:i,etaTree:t.gos.etaTree,addnodelut:!0,metadata:{codebase:"leafspelldef.js",context:"reduced_lambdalambda_obj"}}),u=await Qg({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 Qg({refnode:e,nodelambda:o,contextuallambda:i,etaTree:t.gos.etaTree,addnodelut:!0,metadata:{codebase:"leafspelldef.js",context:"reduced_lambdalambda_obj"}}),u=await Qg({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)}}};var o_=function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=cn);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}(dt);const s_=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in leafloopyspell.js",codebase:"/src/ghostos/api/parser/nodelogic/abstraction/leafloopyspell.js"},{}),a_=()=>{let t=0;return e=>{const n=Date.now();return n-t>=e&&(t=n,!0)}},u_={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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});["7b1f"].includes(e.slice(0,4));const s="bypass"in o,a={codebase:"leafloopyspell.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data},u=(t=>{if(!t)return 1;if(Object.keys(t).filter(t=>"&"===t).length>0)return;const e=Object.keys(t).filter(t=>/^\d+$/.test(t)).map(t=>parseInt(t)).sort();return e.length>0?e[e.length-1]:1})(o),c="forever"in o,l=a_(),h=a_();return o&&"_default"in o?(t,n)=>{["7b1f"].includes(e?.slice(0,4));const r={_stream:n._stream.pipe(ut(t=>l(200)?t:void 0),gt(t=>void 0!==t),Xe(t=>At([...Array(u).keys()]).pipe(ut(e=>({...t,_label:{...t._label,loopyidx:e}})))))};if(!o||!("_default"in o)){return k_(r,t,void 0,{...a,metastep:"relaying input data as is due to error condition"})}let i=0,h=[];let d,p=new _t(s_),f=new o_(1);const m=r._stream.pipe(ct(t=>(d=t,p.next(t),p)),lt(f));return k_({_stream:m},t,void 0,{...a,metastep:"executing a loopy spell with idx "+i},{leaflogic:o._default,datalogic:{pre:t=>{const e=t;return s||h.push(t),e},post:t=>{if(i+=1,(c||i<u)&&p.next(d),!s)return h[0];if("stream"in o)return t;if(h.push(t),i===u){const t=[...h];return h=[],i=0,t}}}})}:o&&"await"in o?(t,e)=>{const n={_stream:e._stream.pipe(ut(t=>h(10)?t:void 0),gt(t=>void 0!==t),ut(t=>[...Array(u).keys()].map(e=>({...t,_label:{...t._label,loopyidx:e}}))))};if(!o.await||!("_default"in o.await)){return k_(n,t,void 0,{...a,metastep:"relaying input data as is due to error condition"})}let r=0,i=[];const c=t=>{const e=t;return s||i.push(t),e};let l=new dt,d=new dt,p=new dt;const f=new dt,m=new dt;let g,_;const y=new dt,v=new dt,b=o.await._default([{_stream:y}],{_stream:v}),w=n._stream.pipe(at(...t.map(t=>t._stream)),ct(t=>{const e=t[0],n=t[1];if(g=e,void 0!==_&&!_.closed)return d.next(n),l.next(e),m;r=0,i=[],p.next();const h=k_({_stream:l},[{_stream:d}],void 0,{...a,metastep:"executing a loopy spell with idx "+r},{datalogic:{pre:c,post:t=>{if(r+=1,!s)return i[0];if("stream"in o)return t;if(i.push(t),r===u){const t=[...i];return i=[],r=0,1===u?t[0]:t}}}});let w;return _=h._control._stream.pipe(at(h._stream),ct(t=>(w=t,y.next(t[1]),v.next(t[0]),b._control._stream)),at(b._control._stream),at(b._stream),ut(t=>t[1]),ut(t=>(t&&(f.next(w[1]),g=w[0],p.next()),t)),lt(p)).subscribe({next:t=>{},error:t=>{},complete:()=>{}}),d.next(n),l.next(e),m}),ut(t=>t),Pu(()=>{void 0!==_&&(_.unsubscribe(),_=void 0)}),gt(t=>void 0!==t),ft());return{_stream:o.final&&"_default"in o.final?f.pipe(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(s_)),ct(t=>v_(o.final._default,t)),ut(t=>(setTimeout(()=>{m.next(g)},0),t)),ft()):f.pipe(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(s_)),ut(t=>(setTimeout(()=>{m.next(g)},0),t)),ft()),_control:{_stream:w.pipe(ut(t=>t),ft())}}}:(t,e)=>({...vn(t),_control:e})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>{const r=vn(t);return{...e([r],n),_control:n}}}),s}},c_=Nt("leafgraph"),l_=t=>"string"==typeof t&&t.toLowerCase().startsWith("github/"),h_=(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.toLowerCase(),graph_appid:"index"}:0===n||n===t.length-1?null:{graph_domain:t.slice(0,n).toLowerCase(),graph_appid:t.slice(n+1)}},d_=async(t,e,n,r,i,o,s,a,u,c,l=!1)=>{const h=await(Wn(u)?.parseGraphEtaTree(i,o)),d=h.leafgraph,p=h.graphcomponents,f=h.graphcomponents.components.nodegroups.runtime[0];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(c_.editorconfig.namedatakey,o).toLowerCase()===n+"/"+r}return!1}).length){const n=[];if(f&&(["2ee89b44-16af-472f-97d4-47ae65f064c8"].includes(e),t._default=await Zg({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})()},p_={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{args:o}=n.leaf.logic,s=En(c_.editorconfig.namedatakey,o),a=s.toLowerCase(),u=(t=>{const e=t.indexOf("/");return e<=0||e===t.length-1?null:{graph_domain:t.slice(0,e).toLowerCase(),graph_appid:t.slice(e+1)}})(l_(s)?s:a);if(!u)return{};const{graph_domain:c,graph_appid:l}=u,h=t.gos.etaTree.domain,d=t.gos.etaTree.appid;if(c+"/"+l!=h+"/"+d){const n=d_(0,e,h,d,c,l,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=>({...vn(t),_control:void 0})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const{args:o}=n.leaf.logic,s=En(c_.editorconfig.namedatakey,o),a=s.toLowerCase(),u=l_(s)?s:a,c=t.gos.etaTree.domain,l=h_(u,c);if(!l)return{};const h=t.gos.etaTree.appid,{graph_domain:d,graph_appid:p}=l;if("breezyforest"!==d&&d+"/"+p==c+"/"+h)return{};try{["3be30006-5b56-4b27-8eaa-249c6a46a557"].includes(e);const n=d_(0,e,c,h,d,p,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{args:o}=n.leaf.logic,s=En(c_.editorconfig.namedatakey,o),a=s.toLowerCase(),u=l_(s)?s:a,c=t.gos.etaTree.domain,l=h_(u,c);if(!l)return{};const h=t.gos.etaTree.appid,{graph_domain:d,graph_appid:p}=l;if("breezyforest"!==d&&d+"/"+p==c+"/"+h)return{};try{["3be30006-5b56-4b27-8eaa-249c6a46a557"].includes(e);const n=d_(0,e,c,h,d,p,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}={})=>({})},f_={dataflow:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>{},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>{}},m_=(It.breezyforest._version,(t,e)=>{const n=new De,r=new De,i=new De;let o;t.forEach(t=>{const s=JSON.parse(ze.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(ze.hp.from(t.data,"base64").toString("utf-8")).leaf;if("leafdataedge"===o.logic.type)n.edge(t.source.uuid,t.target.uuid)||(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(ze.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}}}}),g_=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 qe(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}}},__=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in leaf.js",codebase:"/src/ghostos/api/parser/leaf.js"},{}),y_=Sn("accio","ctrl_accio",{provenance:"executeLEAFLogic"}),v_=async(t,e,n={},r=void 0,i=void 0)=>{const o=new dt,s=new dt,a=t([{_stream:o}],{_stream:s,_config:n});if(a){const t=Je(a._control._stream.pipe(at(a._stream),ut(t=>t[1])));o.next(e),i?s.next(i):s.next(y_);return await t}},b_=Sn("accio","ctrl_accio",{provenance:"subscribeToLEAFLogic"}),w_=async(t,e,n,r)=>{const i=new _t({...__,_label:{at:"leaf.js subscribeToLEAFLogic data stream"}}),o=new _t({...__,_label:{at:"leaf.js subscribeToLEAFLogic ctrl stream"}});i.next(e),o.next(b_);const s=t([{_stream:i}],{_stream:o,_config:n});let a;s&&s._control._stream.pipe(ct(t=>(a=t,s._stream)),ut(t=>[a,t]),lt(r)).subscribe({next:t=>{},error:t=>{},complete:()=>{}})},x_=(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(ut(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 S_=(t,e,n,r,i)=>{let o;return Promise.race([t,new Promise((t,s)=>o=setTimeout(()=>{const e=Sn("error",{type:"timeout",message:r,codebase:n,metadata:i});t(e)},e,r))]).finally(()=>clearTimeout(o))},T_=(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||[],k_=(t,e,n,r={},i={leaflogic:void 0,datalogic:{pre:void 0,post:void 0}})=>{const o=new dt,s=new dt,a=new dt;let u;["e9e6e44b-792b-46d0-b1d3-58ce2f46c45b","c822ae2e-1be8-46be-b2cb-21a43cef0555","98d167d3-c1ed-4d4a-9ab9-25eaccd20a91"].includes(r.refnode);const c=i.leaflogic,l=void 0!==c?c([{_stream:a}],{_stream:void 0!==n?Et(s,n):s,_config:{...t._config}}):{_stream:a,_control:{_stream:s,_config:{...t._config,traces:T_(t._config?.traces,r)}}},h=e.length>1?Et(...e.map(t=>t._stream)):e[0]._stream,d=t._stream.pipe(at(h),ct(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 c={...u,traces:T_(u?.traces,{...r,at:"leaf.js driveDataflowByCtrlflow, initial switch-mapping of the ctrl signal to drive dataflow through a resolved leaflogic"},!0)};return setTimeout(()=>{a.next(o),s.next(c)},1),l._control._stream}),at(l._control._stream),at(l._stream),ut(t=>[t[0][1],t[1]]),ut(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]}),ut(t=>t),ft());return{_stream:o.pipe(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(__)),ft()),_control:{_stream:d.pipe(ut(t=>(["e9e6e44b-792b-46d0-b1d3-58ce2f46c45b","c822ae2e-1be8-46be-b2cb-21a43cef0555"].includes(r.refnode),t)),ft()),_config:{...t._config,traces:T_(t._config?.traces,r)}}}},A_=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=p_.lambda(r)({refnode:n,refnodedata:{leaf:{logic:{args:s}}},nodelambda:[],contextuallambda:[]});return await t}catch(t){return{}}};const E_=t=>{const e=t.split("://");return(e[0].includes("https")?"wss":"ws")+"://"+e[1]},O_=t=>!t||t&&"Object"!==t.constructor.name?t:JSON.parse(JSON.stringify(t)),C_=t=>{const{endpoint:e,websocket:n,headers:r,hook:i}=t,o={endpoint:e,headers:O_(r||{}),websocket:{...n,endpoint:n&&n.endpoint||E_(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{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,headers:s}=t,a={...o.headers,...s||{}};try{let t;t=await fetch(o.endpoint,{method:"POST",headers:a,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=O_(t),o.websocket.client&&s().then(u).catch(t=>{})},establishWS:c,clientContext:o}},{memoize:M_}=bn,I_=({_domain:t,_appid:e,filter:n={},query:r}={})=>`\n subscription {\n graph: getGraph(domain: "${t}", appid: "${e}", filter: ${n}) ${r}\n }\n`,N_=({_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`,R_={dburi_subs:"https://gdb.leafgon.com/sgraphql",dburi_subs_ws:"wss://gdb.leafgon.com/sgraphql",dburi_qm:"https://gdb.leafgon.com/qmgraphql"},D_=({_clientConfig:t=R_,_metamodel:e=It.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&&C_({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?C_({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:I_({_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=M_(({_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:N_({_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 P_=({_LEAFappList:t=[],stateObjInstanceID:e=Zn(),dirOfSubjects:n={},permissions:r={},metamodel:i=It}={})=>{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:j_(),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=It.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)})}}},j_=()=>{const t={handle$:new _t,doWrite:e=>t.handle$.next(e),doSubscribe:e=>t.handle$.pipe(function(t){return gt(function(e,n){return t<=n})}(1)).subscribe(e),doUnsubscribe:t=>t.unsubscribe(),doAddAddressee:(t,e)=>{}};return t},L_=(t,e=[],n=It)=>{let r={};return Object.entries(n.breezyforest.subsDirectory).forEach(([t,e])=>{r[t]={main:j_(),bridges:{}}}),[t,r]},F_="https://gdb.leafgon.com/qmgraphql",$_=async({variables:t,endpoint:e=F_})=>{const n=C_({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){}},B_=async({node_uuid:t,endpoint:e=F_})=>{const n=C_({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){}},q_=async({variables:t,endpoint:e=F_})=>{const n=C_({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){}},U_=async({variables:t,endpoint:e=F_})=>{const n=C_({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){}},V_=async({edge_uuid:t,endpoint:e=F_})=>{const n=C_({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{It as LEAFIOmetamodel,qn as SHA1,Dt as _breezyforeststdlib_hierarchy,Rt as _breezyforeststdlib_name,Pt as _edge_handle_dict,jt as _edge_style_dict,Gg as _leafelement,p_ as _leafgraph,Nt as _leafstdlib_dataflow_api,g_ as analyzeLEAFGraph,C_ as createGQLClient,Io as decodeUnicode,Cg as destroySoundStageNode,Sn as doBottle,Tn as doUnbottle,k_ as driveDataflowByCtrlflow,Mo as encodeUnicode,Zg as etaReduceDataflowComponent,Wn as etaTreeForest,v_ as executeLEAFLogic,x_ as executeLEAFLogicInSync,En as fetchMultiKeyedData,P_ as initLEAFIOapi,Fo as init_gRuntimeLEAFlisp,D_ as initializeLEAFlakeGQLClient,L_ as initializeMasterSubsDirectory,Eg as initializeSoundStage,j_ as initializeSubsMain,U_ as mutateAddEdge,$_ as mutateAddNode,V_ as mutateDelEdge,B_ as mutateDelNode,q_ as mutateUpdateNode,A_ as parseAddressableGraph,Po as parseJsonToLEAFlisp,m_ as reconstructLEAFGraph,$o as runLEAFlispcode,t_ as runtimeEtaTree,On as setMultiKeyedData,w_ 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)},S=function(t){return"setTarget"===t.type},T=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&&S(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&&S(u)&&this._automationEvents.push(s(this.getValue(e),e)),void 0!==u&&p(u)&&u.startTime+u.duration>e){var x=e-u.startTime,T=(u.values.length-1)/u.duration,k=Math.max(2,1+Math.ceil(x*T)),A=x/(k-1)*T,E=u.values.slice(0,k);if(A<1)for(var O=1;O<k;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}),I=-1===M?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[M-1];if(void 0!==I&&p(I)&&y(I)+I.duration>e)return!1;var N=c(t)?i(t.value,t.endTime,this._currenTime):l(t)?o(t.value,e,this._currenTime):t;if(-1===M)this._automationEvents.push(N);else{if(p(t)&&e+t.duration>y(this._automationEvents[M]))return!1;this._automationEvents.splice(M,0,N)}}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];S(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&&S(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),T=e(w,2),k=T[0],A=T[1];return b(t,k,A,r)}return this._defaultValue}}])}(),k=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=T,t.createCancelAndHoldAutomationEvent=k,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 k(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(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 S(t,e,n,r){return H(J(e),t,n,r)}function T(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 k(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 S(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(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+=Y[t[r]];return i}function I(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 N(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 R(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 D(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 j(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||j(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||j(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||N(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||N(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||N(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||N(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||N(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||N(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||N(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||N(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||N(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||N(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||N(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||N(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||N(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||N(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||N(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||N(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){R(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){R(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||R(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||R(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||R(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||R(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||R(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 D(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);R(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);R(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||R(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||R(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||R(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||R(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||R(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 D(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 Y=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?Q:t}function Q(){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 S="";if(!c){for(y in w=[],o[m])this.terminals_[y]&&y>2&&w.push("'"+this.terminals_[y]+"'");S=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(S,{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},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 S(t){if(t.length){var e=t.shift();if(t.length){var n=this;this._slip(w,[function(){S.apply(n,[t])}])}try{this._repair(),e.apply(this)}catch(t){this._break(t.toString())}}else this._break()}function T(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return;t.push(e)}function k(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=[],I=[],N=[],R=[],D={},P={};function j(){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=[],I=[],at._allOuts={},at._allIns={},t=0;t<at._outs.length;t++)e=at._outs[t],D[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],D[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}),I.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}),I.push(e));if(C._watcher&&C._watcher._handles.length){var n=rt(R,N,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)})}}R=C._info.inputs,N=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(S,[n]),t._resume()}}function q(t,e){if(this._bad)t._crash(this._err());else{var n=F(e,I);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(S,[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)?T(this._orig._handles,t):T(this._orig._outs,t)}function H(t){void 0===t?(this._orig._handles=[],this._orig._outs=[]):f(t)?k(this._orig._handles,t):k(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 Y(t){m.apply(this),this._sink=t}function Z(t){return t.isMidi&&!t.isMidi2?new Pt(t):Xe.apply(null,arguments)}function Q(){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(),T(this._orig._handles,t))}function et(t){void 0===t?this._orig._handles=[]:k(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 Q);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 Y(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()},Y.prototype=new m,Y.prototype._sxid=V.prototype._sxid,Y.prototype._receive=function(t){this._sink._receive(t)},Y.prototype.send=function(){return this._push(G,[Z.apply(null,arguments)]),this._thenable()},Y.prototype._image=V.prototype._image,Y.prototype.connect=function(t){return this._sink.connect(t),this._push(y,[this._sink]),this._thenable()},Y.prototype.disconnect=function(t){return this._sink.disconnect(t),this._push(y,[this._sink]),this._thenable()},Y.prototype.connected=function(){return this._sink.connected()},Y.prototype.sxId=V.prototype.sxId,Y.prototype.ch=V.prototype.ch,Y.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()},Y.prototype.MIDI1=function(){var t=this._sink._image();return this._push(y,[t]),t._thenable()},Y.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()},Q.prototype=new m,Q.prototype.connect=function(t){return this._push(tt,[t]),this._thenable()},Q.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?St(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){Tt(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){Tt(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]?(kt(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),k(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(S,[_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(){j()},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]});j()},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,T(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,T(r.clients,t._orig),t._info=r.info,t._close=function(){r._close(this)}},at._closeOut=function(t){var e=t._impl;k(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,e.plugin.MidiOutClose())},at._closeIn=function(t){var e=t._impl;k(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 St(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 Tt(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})}),j()},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,T(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,T(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;k(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;k(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 kt(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,T(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,T(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;k(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;k(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(j(),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 It(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 Nt(t){return 25==t.type?32|t.hour:29.97==t.type?64|t.hour:30==t.type?96|t.hour:t.hour}function Rt(t){return t<10?"0"+t:t}function Dt(t){for(var e=[],n=0;n<t.length;n++)e[n]=Rt(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){D[t]=!0},A.prototype.maskMidiOut=At.maskMidiOut,At.unmaskMidiOut=function(t){delete D[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 Dt([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 jt={};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:jt[t.toString().toLowerCase()]},Pt.programValue=function(t){return t},Pt.octaveValue=function(t){var e=jt[t.toString().toLowerCase()];return void 0===e&&(e=jt[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++)jt[t+s]=o,jt[t+"♮"+s]=o,o>0&&(jt[t+"b"+s]=o-1,jt[t+"♭"+s]=o-1,jt[t+"bb"+s]=o-2,jt[t+"♭♭"+s]=o-2,jt[t+"𝄫"+s]=o-2),o<127&&(jt[t+"#"+s]=o+1,jt[t+"♯"+s]=o+1,jt[t+"##"+s]=o+2,jt[t+"♯♯"+s]=o+2,jt[t+"𝄪"+s]=o+2)}),s=0;s<128;s++)jt[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 Yt(t){return(t!=parseInt(t)||t<0||t>4294967295)&&Bt(t),parseInt(t)}function Zt(t){return zt(Pt.noteValue(t),t)}function Qt(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(Qt(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),Qt(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,It(t)]},songPosition:function(t,e){return void 0===e?[242,Qt(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,Nt(t),t.getMinute(),t.getSecond(),t.getFrame(),247]},sxMasterVolume:function(t,e){return void 0===e?[240,127,this._sxid,4,1,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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,Qt(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=De(e[1]):e.length>2&&(r=De(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(""!=De(t))throw RangeError("Unexpected data"+qe(De(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(De(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(De(""+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,De(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 Se(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 Te(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 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,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){Se(t,_e[t])}),E(le,function(t){Te(t,le[t])}),E(he,function(t){ke(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 Ie(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 Ne(t){for(var e=[],n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function Re(t){for(var e="",n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e}function De(t){return t instanceof Array?Re(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 je(t){return(t<16?"0":"")+t.toString(16)}function Le(t){for(var e=[],n=0;n<t.length;n++)e.push(je(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(je(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"+je(t.charCodeAt(n)):e+=t[n];return e}function Be(t){return t.length?": "+Le(Ne(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?"??":je(t),r=void 0===e?"??":je(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?"??":je(t))+" "+(void 0===e?"??":je(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=De(t),this},Pt.prototype.getText=function(){if(void 0!==this.dd)return Me(this.ff,this.dd)?Ie(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"+je(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: "+Dt(Ne(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:"+je(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(Ne(this.dd.substring(7))):1==this.dd.charCodeAt(2)?e+this.getText():e+Le(Ne(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:"+je(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=[]),T(this[e].notes,t.getNote())):t.isNoteOff()&&this[e].notes&&k(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 Ye=[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=Yt(t))>>24&255,t>>16&255,t>>8&255,255&t]}function Qe(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],Ye).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,Qe(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,Qe(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),Qt(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,Qe((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,Qe((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],Ye).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],Ye).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)),Ye).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)),Ye).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)),Ye).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)),Ye).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],Ye).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],Ye).slice(0,4));return r}}function xn(t){E(an,function(e){t.prototype[e]=an[e]})}function Sn(t,e){var n=256*t+e;return n?n>>9||1:0}function Tn(t,e,n,r){return 16777216*t+65536*e+256*n+r>>25&127}function kn(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(kn(new Pt(t.slice(1)),o));else if(3==i)n=t[1]>>4,e=15&t[1],0==n?(this._emit(kn(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(kn(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(kn(new Pt([176+n,2==e?101:99,t[2]]),o)),this._emit(kn(new Pt([176+n,2==e?100:98,t[3]]),o)),this._emit(kn(new Pt([176+n,6,t[4]>>1]),o)),this._emit(kn(new Pt([176+n,38,64*(1&t[4])+(t[4]>>2)]),o))):8!=e&&9!=e||this._emit(kn(new Pt([t[1],t[2],Sn(t[4],t[5])]),o)),10==e&&this._emit(kn(new Pt([t[1],t[2],Tn(t[4],t[5],t[6],t[7])]),o)),11==e){if(rn.includes(t[2]))return;this._emit(kn(new Pt([t[1],t[2],Tn(t[4],t[5],t[6],t[7])]),o))}13==e&&this._emit(kn(new Pt([t[1],Tn(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(kn(new Pt([t[1],127&r,r>>7&127]),o))):12==e&&(t[3]&&(this._emit(kn(new Pt([176+n,0,t[6]]),o)),this._emit(kn(new Pt([176+n,32,t[7]]),o))),this._emit(kn(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(),Ye).slice(0,4)));else if(t[0]>240&&t[0]<=255&&247!=t[0])this._emit(At.MIDI2([16+e].concat(t.slice(),Ye).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(Y),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"}[je(this[2])+""+je(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,In,Nn=[],Rn=0;try{var Dn=URL.createObjectURL(new Blob(["(",function(){function t(){postMessage({}),setTimeout(t,0)}t()}.toString(),")()"],{type:"application/javascript"})),Pn=function(){for(var t=Nn.length,e=0;e<t;e++)Nn.shift()();++Rn>20&&Mn&&(Mn.terminate(),Mn=void 0)},jn=function(t){Nn.push(t),Rn=0,Mn||((Mn=new Worker(Dn)).onmessage=Pn)};jn(function(){At.lib.schedule=jn})}catch(t){}function Ln(){if(!In&&"undefined"!=typeof window){var t=window.AudioContext||window.webkitAudioContext;if(t){(In=new t)&&!In.createGain&&(In.createGain=In.createGainNode);var e=function(){if("running"!=In.state){In.resume();var t=In.createOscillator(),n=In.createGain();try{n.gain.value=0}catch(t){}n.gain.setTargetAtTime(0,In.currentTime,.01),t.connect(n),n.connect(In.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&&(j(),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&&(j(),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&&j(),!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&&j(),!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(),In},At.lib.closeAudioContext=function(){In&&In.close(),In=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 Yn="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(Yn+t[n]+" is not a UInt8 value.");for(r=0,n=0;n<t.length;n++)if(r){if(t[n]>127)throw TypeError(Yn+"Unexpected status byte at index "+n+" ("+t[n]+").");i.push(t[n]),r--}else{if(t[n]<128)throw TypeError(Yn+"Running status is not allowed at index "+n+" ("+t[n]+").");if(247==t[n])throw TypeError(Yn+"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",Yn+"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(Yn+"Message is incomplete");return[o]}function Qn(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 Qn(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]",S="[object Function]",T="[object GeneratorFunction]",k="[object Map]",A="[object Number]",E="[object Object]",O="[object Promise]",C="[object RegExp]",M="[object Set]",I="[object String]",N="[object Symbol]",R="[object WeakMap]",D="[object ArrayBuffer]",P="[object DataView]",j="[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),Y=RegExp(X.source),Z=/<%-([\s\S]+?)%>/g,Q=/<%([\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=/($^)/,St=/['\n\r\u2028\u2029\\]/g,Tt="\\ud800-\\udfff",kt="\\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",It="['’]",Nt="["+Tt+"]",Rt="["+Mt+"]",Dt="["+kt+"]",Pt="\\d+",jt="["+At+"]",Lt="["+Et+"]",Ft="[^"+Tt+Mt+Pt+At+Et+Ot+"]",$t="\\ud83c[\\udffb-\\udfff]",Bt="[^"+Tt+"]",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="(?:"+Dt+"|"+$t+")"+"?",Kt="["+Ct+"]?",Yt=Kt+Xt+("(?:"+Gt+"(?:"+[Bt,qt,Ut].join("|")+")"+Kt+Xt+")*"),Zt="(?:"+[jt,qt,Ut].join("|")+")"+Yt,Qt="(?:"+[Bt+Dt+"?",Dt,qt,Ut,Nt].join("|")+")",te=RegExp(It,"g"),ee=RegExp(Dt,"g"),ne=RegExp($t+"(?="+$t+")|"+Qt+Yt,"g"),re=RegExp([Vt+"?"+Lt+"+"+Jt+"(?="+[Rt,Vt,"$"].join("|")+")",Wt+"+"+Ht+"(?="+[Rt,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+Tt+kt+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[j]=ue[L]=ue[F]=ue[$]=ue[B]=ue[q]=ue[U]=ue[V]=ue[G]=!0,ue[y]=ue[v]=ue[D]=ue[b]=ue[P]=ue[w]=ue[x]=ue[S]=ue[k]=ue[A]=ue[E]=ue[C]=ue[M]=ue[I]=ue[R]=!1;var ce={};ce[y]=ce[v]=ce[D]=ce[P]=ce[b]=ce[w]=ce[j]=ce[L]=ce[F]=ce[$]=ce[B]=ce[k]=ce[A]=ce[E]=ce[C]=ce[M]=ce[I]=ce[N]=ce[q]=ce[U]=ce[V]=ce[G]=!0,ce[x]=ce[S]=ce[R]=!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,Se=be&&be.isMap,Te=be&&be.isRegExp,ke=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 Ie(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 Ne(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 Re(t,e){return!!(null==t?0:t.length)&&Ve(t,e,0)>-1}function De(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 je(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 Ye(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 Qe(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,Tt=e.Error,kt=e.Function,At=e.Math,Et=e.Object,Ot=e.RegExp,Ct=e.String,Mt=e.TypeError,It=r.prototype,Nt=kt.prototype,Rt=Et.prototype,Dt=e["__core-js_shared__"],Pt=Nt.toString,jt=Rt.hasOwnProperty,Lt=0,Ft=(n=/[^.]+$/.exec(Dt&&Dt.keys&&Dt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",$t=Rt.toString,Bt=Pt.call(Et),qt=me._,Ut=Ot("^"+Pt.call(jt).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=Rt.propertyIsEnumerable,Kt=It.splice,Yt=Gt?Gt.isConcatSpreadable:i,Zt=Gt?Gt.iterator:i,Qt=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=It.join,He=ln(Et.keys,Et),vn=At.max,bn=At.min,wn=at.now,xn=e.parseInt,Sn=At.random,Tn=It.reverse,kn=po(e,"DataView"),An=po(e,"Map"),En=po(e,"Promise"),On=po(e,"Set"),Cn=po(e,"WeakMap"),Mn=po(Et,"create"),In=Cn&&new Cn,Nn={},Rn=$o(kn),Dn=$o(An),Pn=$o(En),jn=$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(jt.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 Yn(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?Ye(t.length,Ct):[],u=a.length;for(var c in t)!e&&!jt.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 Qn(t,e){return jo(Mi(t),ur(e,0,t.length))}function tr(t){return jo(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];jt.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&&Ii(e,Na(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]&&jt.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==S||d==T;if(Xs(t))return Ti(t,u);if(d==E||d==y||p&&!o){if(a=c||p?{}:yo(t),!u)return c?function(t,e){return Ii(t,mo(t),e)}(t,function(t,e){return t&&Ii(e,Ra(e),t)}(a,t)):function(t,e){return Ii(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 D:return ki(t);case b:case w:return new r(+t);case P:return function(t,e){var n=e?ki(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case j:case L:case F:case $:case B:case q:case U:case V:case G:return Ai(t,n);case k:return new r;case A:case I: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 N: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?Ra:Na)(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 No(function(){t.apply(i,n)},e)}function dr(t,e,n,r){var i=-1,o=Re,s=!0,a=t.length,u=[],c=e.length;if(!a)return u;n&&(e=Pe(e,Qe(n))),r?(o=De,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:Q,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 jt.call(e,t)?e[t]:i},Wn.prototype.has=function(t){var e=this.__data__;return Mn?e[t]!==i:jt.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=Di(wr),fr=Di(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):je(i,a):r||(i[i.length]=a)}return i}var vr=Pi(),br=Pi(!0);function wr(t,e){return t&&vr(t,e,Na)}function xr(t,e){return t&&br(t,e,Na)}function Sr(t,e){return Ne(e,function(e){return Zs(t[e])})}function Tr(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 kr(t,e,n){var r=e(t);return zs(t)?r:je(r,n(t))}function Ar(t){return null==t?t===i?"[object Undefined]":"[object Null]":Qt&&Qt in Et(t)?function(t){var e=jt.call(t,Qt),n=t[Qt];try{t[Qt]=i;var r=!0}catch(t){}var o=$t.call(t);r&&(e?t[Qt]=n:delete t[Qt]);return o}(t):function(t){return $t.call(t)}(t)}function Er(t,e){return t>e}function Or(t,e){return null!=t&&jt.call(t,e)}function Cr(t,e){return null!=t&&e in Et(t)}function Mr(t,e,n){for(var o=n?De:Re,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,Qe(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 Ir(t,e,n){var r=null==(t=Co(t,e=bi(e,t)))?t:t[Fo(Yo(e))];return null==r?i:Ee(r,t,n)}function Nr(t){return na(t)&&Ar(t)==y}function Rr(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 D: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 I:return t==e+"";case k: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 N:if($n)return $n.call(t)==$n.call(e)}return!1}(t,e,c,n,r,o,s);if(!(1&n)){var f=h&&jt.call(t,"__wrapped__"),m=d&&jt.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:jt.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,Rr,o))}function Dr(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?Rr(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 jr(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(!ko(t))return He(t);var e=[];for(var n in Et(t))jt.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=ko(t),n=[];for(var r in t)("constructor"!=r||!e&&jt.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||Dr(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):Rr(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=Ti(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)}},Ra)}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 Tr(e,1===t.length?t[0]:t)}:t}):[iu];var r=-1;e=Pe(e,Qe(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=Tr(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,Qe(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(Sn()*(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 Yr(t,e){return Ro(Oo(t,e,iu),t+"")}function Zr(t){return Zn(qa(t))}function Qr(t,e){var n=qa(t);return jo(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=In?function(t,e){return In.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 jo(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=Re,o=t.length,s=!0,a=[],u=a;if(n)s=!1,i=De;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&&!jt.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(Yo(e))]}function pi(t,e,n,r){return ti(t,e,n(Tr(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,je([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=Yr;function xi(t,e,n){var r=t.length;return n=n===i?r:n,!e&&n>=r?t:ii(t,e,n)}var Si=ie||function(t){return me.clearTimeout(t)};function Ti(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 ki(t){var e=new t.constructor(t.byteLength);return new zt(e).set(new zt(t)),e}function Ai(t,e){var n=e?ki(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 Ii(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 Ni(t,e){return function(n,r){var i=zs(n)?Oe:ir,o=e?e():{};return i(n,t,co(r,2),o)}}function Ri(t){return Yr(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 Di(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 ji(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=Na(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&&So(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?u[ao(l[0])].apply(u,l[3]):1==a.length&&So(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),S=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-=S,g&&v<d){var T=hn(b,x);return Hi(t,e,qi,h.placeholder,n,b,T,c,l,d-v)}var k=f?n:this,A=m?k[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(k,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,Qe(co())),Yr(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 So(t)&&Io(m,f),m.placeholder=r,Do(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 Yi(t){return function(e){var n=go(e);return n==k?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)S=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 S=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 Do((w?ei:Io)(S,x),t,e)}function Qi(t,e,n,r){return t===i||qs(t,Rt[n])&&!jt.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 Ro(Oo(t,i,Wo),t+"")}function io(t){return kr(t,Na,fo)}function oo(t){return kr(t,Ra,mo)}var so=In?function(t){return In.get(t)}:cu;function ao(t){for(var e=t.name+"",n=Nn[e],r=jt.call(Nn,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(jt.call(qn,"placeholder")?qn:t).placeholder}function co(){var t=qn.iteratee||ou;return t=t===ou?jr: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=Na(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),Ne(_e(t),function(e){return Xt.call(t,e)}))}:gu,mo=_e?function(t){for(var e=[];t;)je(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||ko(t)?{}:Un(Jt(t))}function vo(t){return zs(t)||Gs(t)||!!(Yt&&t&&t[Yt])}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 So(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]}(kn&&go(new kn(new ArrayBuffer(1)))!=P||An&&go(new An)!=k||En&&go(En.resolve())!=O||On&&go(new On)!=M||Cn&&go(new Cn)!=R)&&(go=function(t){var e=Ar(t),n=e==E?t.constructor:i,r=n?$o(n):"";if(r)switch(r){case Rn:return P;case Dn:return k;case Pn:return O;case jn:return M;case Ln:return R}return e});var To=Dt?Zs:_u;function ko(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Rt)}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:Tr(t,ii(e,0,-1))}function Mo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Io=Po(ei),No=pe||function(t,e){return me.setTimeout(t,e)},Ro=Po(ni);function Do(t,e,n){var r=e+"";return Ro(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]&&!Re(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 jo(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=Yr(function(t,e){return Hs(t)?dr(t,yr(e,1,Hs,!0)):[]}),Uo=Yr(function(t,e){var n=Yo(e);return Hs(n)&&(n=i),Hs(t)?dr(t,yr(e,1,Hs,!0),co(n,2)):[]}),Vo=Yr(function(t,e){var n=Yo(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=Yr(function(t){var e=Pe(t,yi);return e.length&&e[0]===t[0]?Mr(e):[]}),Xo=Yr(function(t){var e=Yo(t),n=Pe(t,yi);return e===Yo(n)?e=i:n.pop(),n.length&&n[0]===t[0]?Mr(n,co(e,2)):[]}),Ko=Yr(function(t){var e=Yo(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 Yo(t){var e=null==t?0:t.length;return e?t[e-1]:i}var Zo=Yr(Qo);function Qo(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:Tn.call(t)}var ns=Yr(function(t){return hi(yr(t,1,Hs,!0))}),rs=Yr(function(t){var e=Yo(t);return Hs(e)&&(e=i),hi(yr(t,1,Hs,!0),co(e,2))}),is=Yr(function(t){var e=Yo(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=Ne(t,function(t){if(Hs(t))return e=vn(t.length,e),!0}),Ye(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=Yr(function(t,e){return Hs(t)?dr(t,e):[]}),us=Yr(function(t){return gi(Ne(t,Hs))}),cs=Yr(function(t){var e=Yo(t);return Hs(e)&&(e=i),gi(Ne(t,Hs),co(e,2))}),ls=Yr(function(t){var e=Yo(t);return e="function"==typeof e?e:i,gi(Ne(t,Hs),i,e)}),hs=Yr(os);var ds=Yr(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=Ni(function(t,e,n){jt.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=Ni(function(t,e,n){jt.call(t,n)?t[n].push(e):sr(t,n,[e])});var xs=Yr(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):Ir(t,e,n)}),s}),Ss=Ni(function(t,e,n){sr(t,n,e)});function Ts(t,e){return(zs(t)?Pe:Br)(t,co(e,3))}var ks=Ni(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});var As=Yr(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=Yr(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)}),Is=Yr(function(t,e,n){var r=3;if(n.length){var i=hn(n,uo(Is));r|=c}return Zi(e,r,t,n,i)});function Ns(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=No(_,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=No(_,e),d?m(t):u}(l);if(p)return Si(c),c=No(_,e),m(l)}return c===i&&(c=No(_,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&&Si(c),h=0,r=l=s=c=i},v.flush=function(){return c===i?u:y(Es())},v}var Rs=Yr(function(t,e){return hr(t,1,e)}),Ds=Yr(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 js(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],Qe(co())):Pe(yr(e,1),Qe(co()))).length;return Yr(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=Yr(function(t,e){var n=hn(e,uo(Fs));return Zi(t,c,i,e,n)}),$s=Yr(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=Nr(function(){return arguments}())?Nr:function(t){return na(t)&&jt.call(t,"callee")&&!Xt.call(t,"callee")},zs=r.isArray,Ws=we?Qe(we):function(t){return na(t)&&Ar(t)==D};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?Qe(xe):function(t){return na(t)&&Ar(t)==w};function Ys(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==S||e==T||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Qs(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=Se?Qe(Se):function(t){return na(t)&&go(t)==k};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=jt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Pt.call(n)==Bt}var sa=Te?Qe(Te):function(t){return na(t)&&Ar(t)==C};var aa=ke?Qe(ke):function(t){return na(t)&&go(t)==M};function ua(t){return"string"==typeof t||!zs(t)&&na(t)&&Ar(t)==I}function ca(t){return"symbol"==typeof t||na(t)&&Ar(t)==N}var la=Ae?Qe(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==k?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 Ii(t,Ra(t))}function va(t){return null==t?"":li(t)}var ba=Ri(function(t,e){if(ko(e)||Js(e))Ii(e,Na(e),t);else for(var n in e)jt.call(e,n)&&nr(t,n,e[n])}),wa=Ri(function(t,e){Ii(e,Ra(e),t)}),xa=Ri(function(t,e,n,r){Ii(e,Ra(e),t,r)}),Sa=Ri(function(t,e,n,r){Ii(e,Na(e),t,r)}),Ta=ro(ar);var ka=Yr(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=Ra(s),u=-1,c=a.length;++u<c;){var l=a[u],h=t[l];(h===i||qs(h,Rt[l])&&!jt.call(t,l))&&(t[l]=s[l])}return t}),Aa=Yr(function(t){return t.push(i,to),Ee(Pa,i,t)});function Ea(t,e,n){var r=null==t?i:Tr(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)),jt.call(t,e)?t[e].push(n):t[e]=[n]},co),Ia=Yr(Ir);function Na(t){return Js(t)?Yn(t):Lr(t)}function Ra(t){return Js(t)?Yn(t,!0):Fr(t)}var Da=Ri(function(t,e,n){Vr(t,e,n)}),Pa=Ri(function(t,e,n,r){Vr(t,e,n,r)}),ja=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}),Ii(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=Yi(Na),Ba=Yi(Ra);function qa(t){return null==t?[]:tn(t,Na(t))}var Ua=Li(function(t,e,n){return e=e.toLowerCase(),t+(n?Va(e):e)});function Va(t){return Ya(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=ji("toLowerCase");var Ha=Li(function(t,e,n){return t+(n?"_":"")+e.toLowerCase()});var Xa=Li(function(t,e,n){return t+(n?" ":"")+Ya(e)});var Ka=Li(function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}),Ya=ji("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 Qa=Yr(function(t,e){try{return Ee(t,i,e)}catch(t){return Ys(t)?t:new Tt(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 jr("function"==typeof t?t:cr(t,1))}var su=Yr(function(t,e){return function(n){return Ir(n,t,e)}}),au=Yr(function(t,e){return function(n){return Ir(t,n,e)}});function uu(t,e,n){var r=Na(e),i=Sr(e,r);null!=n||ea(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=Sr(e,Na(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,je([this.value()],arguments))})}),t}function cu(){}var lu=Gi(Pe),hu=Gi(Ie),du=Gi($e);function pu(t){return xo(t)?Je(Fo(t)):function(t){return function(e){return Tr(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,Su=Vi(function(t,e){return t*e},1),Tu=Xi("round"),ku=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=Sa,qn.at=Ta,qn.before=Cs,qn.bind=Ms,qn.bindAll=tu,qn.bindKey=Is,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 je(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]]}):[],Yr(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=Na(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=Ns,qn.defaults=ka,qn.defaultsDeep=Aa,qn.defer=Rs,qn.delay=Ds,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)?Ne:_r)(t,co(e,3))},qn.flatMap=function(t,e){return yr(Ts(t,e),1)},qn.flatMapDeep=function(t,e){return yr(Ts(t,e),p)},qn.flatMapDepth=function(t,e,n){return n=n===i?1:ma(n),yr(Ts(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?[]:Sr(t,Na(t))},qn.functionsIn=function(t){return null==t?[]:Sr(t,Ra(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=Ss,qn.keys=Na,qn.keysIn=Ra,qn.map=Ts,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=Da,qn.mergeWith=Pa,qn.method=su,qn.methodOf=au,qn.mixin=uu,qn.negate=js,qn.nthArg=function(t){return t=ma(t),Yr(function(e){return Gr(e,t)})},qn.omit=ja,qn.omitBy=function(t,e){return Fa(t,js(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=ks,qn.pick=La,qn.pickBy=Fa,qn.property=pu,qn.propertyOf=function(t){return function(e){return null==t?i:Tr(t,e)}},qn.pull=Zo,qn.pullAll=Qo,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)?Ne:_r)(t,js(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 Yr(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)?Qn:Qr)(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),Yr(function(n){var r=n[e],i=xi(n,0,e);return r&&je(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),Ns(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,Ra(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=Qa,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,Na(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))&&Y.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)?Ie: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),Ra)},qn.forInRight=function(t,e){return null==t?t:br(t,co(e,3),Ra)},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=Ia,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==k||e==M)return!t.size;if(ko(t))return!Lr(t).length;for(var n in t)if(jt.call(t,n))return!1;return!0},qn.isEqual=function(t,e){return Rr(t,e)},qn.isEqualWith=function(t,e,n){var r=(n="function"==typeof n?n:i)?n(t,e):i;return r===i?Rr(t,e,i,n):!!r},qn.isError=Ys,qn.isFinite=function(t){return"number"==typeof t&&be(t)},qn.isFunction=Zs,qn.isInteger=Qs,qn.isLength=ta,qn.isMap=ra,qn.isMatch=function(t,e){return t===e||Dr(t,e,ho(e))},qn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:i,Dr(t,e,ho(e),n)},qn.isNaN=function(t){return ia(t)&&t!=+t},qn.isNative=function(t){if(To(t))throw new Tt("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 Qs(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)==R},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=Yo,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=Su,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=Sn();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=Tu,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==k||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=ku,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,Qi);var o,s,a=xa({},e.imports,r.imports,Qi),u=Na(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="+(jt.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(St,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=jt.call(e,"variable")&&e.variable;if(m){if(dt.test(m))throw new Tt("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=Qa(function(){return kt(u,f+"return "+d).apply(i,c)});if(g.source=d,Ys(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=Ye(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=Ya,qn.each=vs,qn.eachRight=bs,qn.first=Jo,uu(qn,(xu={},wr(qn,function(t,e){jt.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=Yr(function(t,e){return"function"==typeof t?new zn(this):this.map(function(n){return Ir(n,t,e)})}),zn.prototype.reject=function(t){return this.filter(js(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,je([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=It[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+"";jt.call(Nn,r)||(Nn[r]=[]),Nn[r].push({name:e,func:n})}}),Nn[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:()=>ga,hasStandardBrowserEnv:()=>ya,hasStandardBrowserWebWorkerEnv:()=>va,navigator:()=>_a,origin:()=>ba});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{S(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)S(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 S(t){m(t)?t():t.unsubscribe()}var T={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},k={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=k.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=k.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function A(t){k.setTimeout(function(){var e=T.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 I(t){if(T.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 N=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 j(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),R=Function.prototype.bind;function D(t,e){return R.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}(),j=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&&T.useDeprecatedNextContext?((o=Object.create(e)).unsubscribe=function(){return s.unsubscribe()},i={next:e.next&&D(e.next,o),error:e.error&&D(e.error,o),complete:e.complete&&D(e.complete,o)}):i=e;return s.destination=new P(i),s}return o(e,t),e}(N);function L(t){var e;T.useDeprecatedSynchronousErrorHandling?(e=t,T.useDeprecatedSynchronousErrorHandling&&M&&(M.errorThrown=!0,M.error=e)):A(t)}function F(t,e){var n=T.onStoppedNotification;n&&k.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}(N),U=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function V(t){return m(null==t?void 0:t.then)}var G="function"==typeof Symbol&&Symbol.observable||"@@observable";function z(t){return t}function W(t){return 0===t.length?z:1===t.length?t[0]:function(e){return t.reduce(function(t,e){return e(t)},e)}}var J=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 N||function(t){return t&&m(t.next)&&m(t.error)&&m(t.complete)}(r)&&x(r)?t:new j(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=H(e))(function(e,r){var i=new j({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[G]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return W(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=H(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 H(t){var e;return null!==(e=null!=t?t:T.Promise)&&void 0!==e?e:Promise}function X(t){return m(t[G])}function K(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 Z="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Q(t){return m(null==t?void 0:t[Z])}function tt(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 et(t){return m(null==t?void 0:t.getReader)}function nt(t){if(t instanceof J)return t;if(null!=t){if(X(t))return i=t,new J(function(t){var e=i[G]();if(m(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(U(t))return r=t,new J(function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()});if(V(t))return n=t,new J(function(t){n.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,A)});if(K(t))return rt(t);if(Q(t))return e=t,new J(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(et(t))return rt(tt(t))}var e,n,r,i;throw Y(t)}function rt(t){return new J(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 it(t){return t[t.length-1]}function ot(t){return m(it(t))?t.pop():void 0}function st(t){return(e=it(t))&&m(e.schedule)?t.pop():void 0;var e}function at(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=ot(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){nt(t[e]).subscribe(B(r,function(t){o[e]=t,a||s[e]||(s[e]=!0,(a=s.every(z))&&(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 ut(t,e){return g(function(n,r){var i=0;n.subscribe(B(r,function(n){r.next(t.call(e,n,i++))}))})}function ct(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++;nt(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 lt(t){return g(function(e,n){nt(t).subscribe(B(n,function(){return n.complete()},E)),!n.closed&&e.subscribe(n)})}var ht=_(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),dt=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 ht},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?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 J;return t.source=this,t},e.create=function(t,e){return new pt(t,e)},e}(J),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}(dt);function ft(t){void 0===t&&(t={});var e=t.connector,n=void 0===e?function(){return new dt}: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=mt(p,u))}),m.subscribe(f),!e&&a>0&&(e=new j({next:function(t){return m.next(t)},error:function(t){l=!0,h(),r=mt(d,i,t),m.error(t)},complete:function(){c=!0,h(),r=mt(d,s),m.complete()}}),nt(t).subscribe(e))})(t)}}function mt(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 j({next:function(){i.unsubscribe(),t()}});return nt(e.apply(void 0,h([],l(n)))).subscribe(i)}}else t()}function gt(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)}))})}var _t=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}(dt);function yt(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 vt(t,e,n){return void 0===n&&(n=1/0),m(e)?vt(function(n,r){return ut(function(t,i){return e(n,t,r,i)})(nt(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;nt(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?yt(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 bt(t){return void 0===t&&(t=1/0),vt(z,t)}var wt=new J(function(t){return t.complete()});function xt(t,e){return void 0===e&&(e=0),g(function(n,r){n.subscribe(B(r,function(n){return yt(r,t,function(){return r.next(n)},e)},function(){return yt(r,t,function(){return r.complete()},e)},function(n){return yt(r,t,function(){return r.error(n)},e)}))})}function St(t,e){return void 0===e&&(e=0),g(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function Tt(t,e){if(!t)throw new Error("Iterable cannot be null");return new J(function(n){yt(n,e,function(){var r=t[Symbol.asyncIterator]();yt(n,e,function(){r.next().then(function(t){t.done?n.complete():n.next(t.value)})},0,!0)})})}function kt(t,e){if(null!=t){if(X(t))return function(t,e){return nt(t).pipe(St(e),xt(e))}(t,e);if(U(t))return function(t,e){return new J(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(V(t))return function(t,e){return nt(t).pipe(St(e),xt(e))}(t,e);if(K(t))return Tt(t,e);if(Q(t))return function(t,e){return new J(function(n){var r;return yt(n,e,function(){r=t[Z](),yt(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(et(t))return function(t,e){return Tt(tt(t),e)}(t,e)}throw Y(t)}function At(t,e){return e?kt(t,e):nt(t)}function Et(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=st(t),r=function(t,e){return"number"==typeof it(t)?t.pop():e}(t,1/0),i=t;return i.length?1===i.length?nt(i[0]):bt(r)(At(i,n)):wt}const Ot="https://www.leafgon.com/sgraphql",Ct="wss://www.leafgon.com/sgraphql",Mt="https://www.leafgon.com/qmgraphql",It={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:It.breezyforest.scaffold.directory[e])}catch{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:Ot,dburi_subs_ws:Ct,dburi_qm:Mt},clientconfig_sub:{keepGQLConnected:!0,dburi_subs:Ot,dburi_subs_ws:Ct},clientconfig_qm:{dburi_qm:Mt},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:ut}}},Nt=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","hermes"],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},Rt={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"},Dt={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"]},Pt={leaflambdaedge:{sourceHandle:"out_aux",targetHandle:"in_aux"},leafanchoredge:{sourceHandle:"out_anchor",targetHandle:"in_anchor"},leafdataedge:{sourceHandle:"out_a",targetHandle:"in_a"}},jt={leaflambdaedge:{stroke:"#fff",fillOpacity:0},leafanchoredge:{stroke:"#88f",fillOpacity:0},leafdataedge:{stroke:"#fff",fillOpacity:0}};var Lt=n(7007);let Ft=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 $t(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 Bt(t){return"object"==typeof t&&null!==t}function qt(t){let e;for(e in t)return!1;return!0}function Ut(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function Vt(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 Gt(t){return!!Bt(t)&&!(t.attributes&&!Array.isArray(t.attributes))}function zt(){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 Wt(){return{[Symbol.iterator](){return this},next:()=>({done:!0})}}"function"==typeof Object.assign&&(Ft=Object.assign);class Jt extends Error{constructor(t){super(),this.name="GraphError",this.message=t}}class Ht extends Jt{constructor(t){super(t),this.name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,Ht.prototype.constructor)}}class Xt extends Jt{constructor(t){super(t),this.name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,Xt.prototype.constructor)}}class Kt extends Jt{constructor(t){super(t),this.name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,Kt.prototype.constructor)}}function Yt(t,e){this.key=t,this.attributes=e,this.clear()}function Zt(t,e){this.key=t,this.attributes=e,this.clear()}function Qt(t,e){this.key=t,this.attributes=e,this.clear()}function te(t,e,n,r,i){this.key=e,this.attributes=i,this.undirected=t,this.source=n,this.target=r}Yt.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},Zt.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},Qt.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},te.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)},te.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},te.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]},te.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 ee(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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 ne=[{name:t=>`get${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=ee(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]=ee(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]=ee(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]=ee(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]=ee(this,e,n,t,r,i,o);if("function"!=typeof u)throw new Ht(`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]=ee(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]=ee(this,e,n,t,r,i);if(!Bt(s))throw new Ht(`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]=ee(this,e,n,t,r,i);if(!Bt(s))throw new Ht(`Graph.${e}: provided attributes are not a plain object.`);return Ft(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]=ee(this,e,n,t,r,i);if("function"!=typeof s)throw new Ht(`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 re=[{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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Kt(`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=$t(this,o,s,n),!i)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new Kt(`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=$t(this,i,o,n),!r)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${i}" - "${o}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Kt(`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=$t(this,o,s,n),!i)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Kt(`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=$t(this,s,a,n),!o)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Kt(`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=$t(this,s,a,n),!o)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if("function"!=typeof i)throw new Ht(`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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Kt(`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=$t(this,o,s,n),!i)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Kt(`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=$t(this,o,s,n),!i)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if(!Bt(r))throw new Ht(`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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Kt(`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=$t(this,o,s,n),!i)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if(!Bt(r))throw new Ht(`Graph.${e}: provided attributes are not a plain object.`);return Ft(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 Kt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Kt(`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=$t(this,o,s,n),!i)throw new Xt(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new Kt(`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 Xt(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if("function"!=typeof r)throw new Ht(`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 ie=[{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 oe(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 se(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 ae(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 ue(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 ce(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 le(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 he(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 de(t,e,n,r,i,o){const s=e?se:oe;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 pe(t,e,n,r,i,o,s){const a=n?ce:ue;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 fe(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 Xt(`Graph.${n}: could not find the "${t}" node in the graph.`);return function(t,e,n,r){const i=[];return de(!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 Xt(`Graph.${n}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new Xt(`Graph.${n}: could not find the "${e}" target node in the graph.`);return function(t,e,n,r,i){const o=[];return pe(!1,t,e,n,r,i,function(t){o.push(t)}),o}(r,this.multi,i,o,e)}throw new Ht(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function me(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 Wt();if(!arguments.length)return function(t,e){if(0===t.size)return Wt();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 Xt(`Graph.${o}: could not find the "${t}" node in the graph.`);return function(t,e,n){let r=Wt();return"undirected"!==t&&("out"!==e&&void 0!==n.in&&(r=zt(r,ae(n.in))),"in"!==e&&void 0!==n.out&&(r=zt(r,ae(n.out,e?void 0:n.key)))),"directed"!==t&&void 0!==n.undirected&&(r=zt(r,ae(n.undirected))),r}(r,i,e)}if(2===arguments.length){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new Xt(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new Xt(`Graph.${o}: could not find the "${e}" target node in the graph.`);return function(t,e,n,r){let i=Wt();return"undirected"!==t&&(void 0!==n.in&&"out"!==e&&r in n.in&&(i=zt(i,le(n.in,r))),void 0!==n.out&&"in"!==e&&r in n.out&&(e||n.key!==r)&&(i=zt(i,le(n.out,r)))),"directed"!==t&&void 0!==n.undirected&&r in n.undirected&&(i=zt(i,le(n.undirected,r))),i}(r,i,n,e)}throw new Ht(`Graph.${o}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}const ge=[{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 _e(){this.A=null,this.B=null}function ye(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 ve(t,e,n,r,i){if("mixed"!==e){if("undirected"===e)return ye(t,null,r,r.undirected,i);if("string"==typeof n)return ye(t,null,r,r[n],i)}const o=new _e;let s;if("undirected"!==e){if("out"!==n){if(s=ye(t,null,r,r.in,i),t&&s)return s;o.wrap(r.in)}if("in"!==n){if(s=ye(t,o,r,r.out,i),t&&s)return s;o.wrap(r.out)}}if("directed"!==e&&(s=ye(t,o,r,r.undirected,i),t&&s))return s}function be(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 we(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 Xt(`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 ve(!1,t,e,n,function(t){r.push(t)}),r}("mixed"===r?this.type:r,i,e)}}function xe(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 Wt();t=""+t;const e=this._nodes.get(t);if(void 0===e)throw new Xt(`Graph.${o}: could not find the "${t}" node in the graph.`);return function(t,e,n){if("mixed"!==t){if("undirected"===t)return be(null,n,n.undirected);if("string"==typeof e)return be(null,n,n[e])}let r=Wt();const i=new _e;return"undirected"!==t&&("out"!==e&&(r=zt(r,be(i,n,n.in))),"in"!==e&&(r=zt(r,be(i,n,n.out)))),"directed"!==t&&(r=zt(r,be(i,n,n.undirected))),r}("mixed"===r?this.type:r,i,e)}}function Se(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 Te(t){if(!Bt(t))throw new Ht('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 Ht("Graph.import: serialized node is missing its key.");if("attributes"in t&&(!Bt(t.attributes)||null===t.attributes))throw new Ht("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function ke(t){if(!Bt(t))throw new Ht('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 Ht("Graph.import: serialized edge is missing its source.");if(!("target"in t))throw new Ht("Graph.import: serialized edge is missing its target.");if("attributes"in t&&(!Bt(t.attributes)||null===t.attributes))throw new Ht("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in t&&"boolean"!=typeof t.undirected)throw new Ht("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}_e.prototype.wrap=function(t){null===this.A?this.A=t:null===this.B&&(this.B=t)},_e.prototype.has=function(t){return null!==this.A&&t in this.A||null!==this.B&&t in this.B};const Ae=function(){let t=255&Math.floor(256*Math.random());return()=>t++}(),Ee=new Set(["directed","undirected","mixed"]),Oe=new Set(["domain","_events","_eventsCount","_maxListeners"]),Ce={allowSelfLoops:!0,multi:!1,type:"mixed"};function Me(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 Ie(t,e,n,r,i,o,s,a){if(!r&&"undirected"===t.type)throw new Kt(`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 Kt(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(a&&!Bt(a))throw new Ht(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`);if(o=""+o,s=""+s,a=a||{},!t.allowSelfLoops&&o===s)throw new Kt(`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 Xt(`Graph.${e}: source node "${o}" not found.`);if(!c)throw new Xt(`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 Kt(`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 Kt(`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 te(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 Ne(t,e,n,r,i,o,s,a,u){if(!r&&"undirected"===t.type)throw new Kt(`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 Kt(`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 Ht(`Graph.${e}: invalid updater function. Expecting a function but got "${a}"`)}else if(!Bt(a))throw new Ht(`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 Kt(`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 Kt(`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 Ft(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 Kt(`Graph.${e}: the "${i}" edge already exists in the graph.`);let m=!1,g=!1;d||(d=Me(t,o,{}),m=!0,o===s&&(p=d,g=!0)),p||(p=Me(t,s,{}),g=!0),l=new te(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 Re(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 De extends Lt.EventEmitter{constructor(t){if(super(),"boolean"!=typeof(t=Ft({},Ce,t)).multi)throw new Ht(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${t.multi}".`);if(!Ee.has(t.type))throw new Ht(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${t.type}".`);if("boolean"!=typeof t.allowSelfLoops)throw new Ht(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${t.allowSelfLoops}".`);Ut(this,"NodeDataClass","mixed"===t.type?Yt:"directed"===t.type?Zt:Qt);const e="geid_"+Ae()+"_";let n=0;Ut(this,"_attributes",{}),Ut(this,"_nodes",new Map),Ut(this,"_edges",new Map),Ut(this,"_directedSize",0),Ut(this,"_undirectedSize",0),Ut(this,"_directedSelfLoopCount",0),Ut(this,"_undirectedSelfLoopCount",0),Ut(this,"_edgeKeyGenerator",()=>{let t;do{t=e+n++}while(this._edges.has(t));return t}),Ut(this,"_options",t),Oe.forEach(t=>Ut(this,t,this[t])),Vt(this,"order",()=>this._nodes.size),Vt(this,"size",()=>this._edges.size),Vt(this,"directedSize",()=>this._directedSize),Vt(this,"undirectedSize",()=>this._undirectedSize),Vt(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),Vt(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),Vt(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),Vt(this,"multi",this._options.multi),Vt(this,"type",this._options.type),Vt(this,"allowSelfLoops",this._options.allowSelfLoops),Vt(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 Ht(`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 Ht(`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 Ht(`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 Kt("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 Xt(`Graph.directedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new Xt(`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 Kt("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 Xt(`Graph.undirectedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new Xt(`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 Kt("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 Xt(`Graph.edge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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 Xt(`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&&!Bt(n))throw new Ht(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(e=""+e,n=n||{},t._nodes.has(e))throw new Kt(`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&&!Bt(e))throw new Ht(`Graph.mergeNode: invalid attributes. Expecting an object but got "${e}"`);t=""+t,e=e||{};let n=this._nodes.get(t);return n?(e&&(Ft(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 Ht(`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 Xt(`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{Re(this,n),n=n.next}while(n)}for(const t in e.in){n=e.in[t];do{Re(this,n),n=n.next}while(n)}}if("directed"!==this.type)for(const t in e.undirected){n=e.undirected[t];do{Re(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=$t(this,t,n,this.type),!e)throw new Xt(`Graph.dropEdge: could not find the "${t}" -> "${n}" edge in the graph.`)}else if(t=""+t,e=this._edges.get(t),!e)throw new Xt(`Graph.dropEdge: could not find the "${t}" edge in the graph.`);return Re(this,e),this}dropDirectedEdge(t,e){if(arguments.length<2)throw new Kt("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 Kt("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=$t(this,t=""+t,e=""+e,"directed");if(!n)throw new Xt(`Graph.dropDirectedEdge: could not find a "${t}" -> "${e}" edge in the graph.`);return Re(this,n),this}dropUndirectedEdge(t,e){if(arguments.length<2)throw new Kt("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 Kt("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=$t(this,t,e,"undirected");if(!n)throw new Xt(`Graph.dropUndirectedEdge: could not find a "${t}" -> "${e}" edge in the graph.`);return Re(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 Ht("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(!Bt(t))throw new Ht("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(!Bt(t))throw new Ht("Graph.mergeAttributes: provided attributes are not a plain object.");return Ft(this._attributes,t),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:t}),this}updateAttributes(t){if("function"!=typeof t)throw new Ht("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 Ht("Graph.updateEachNodeAttributes: expecting an updater function.");if(e&&!Gt(e))throw new Ht("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 Ht("Graph.updateEachEdgeAttributes: expecting an updater function.");if(e&&!Gt(e))throw new Ht("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 Ht("Graph.forEachAdjacencyEntry: expecting a callback.");Se(!1,!1,!1,this,t)}forEachAdjacencyEntryWithOrphans(t){if("function"!=typeof t)throw new Ht("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");Se(!1,!1,!0,this,t)}forEachAssymetricAdjacencyEntry(t){if("function"!=typeof t)throw new Ht("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");Se(!1,!0,!1,this,t)}forEachAssymetricAdjacencyEntryWithOrphans(t){if("function"!=typeof t)throw new Ht("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");Se(!1,!0,!0,this,t)}nodes(){return Array.from(this._nodes.keys())}forEachNode(t){if("function"!=typeof t)throw new Ht("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 Ht("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 Ht("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 Ht("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 Ht("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 Ht("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 Ht("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new Ht("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 qt(e.attributes)||(n.attributes=Ft({},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 qt(n.attributes)||(r.attributes=Ft({},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 De)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(!Bt(t))throw new Ht("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!Bt(t.attributes))throw new Ht("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 Ht("Graph.import: invalid nodes. Expecting an array.");for(n=0,r=i.length;n<r;n++){o=i[n],Te(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 Ht("Graph.import: invalid edges. Expecting an array.");for(n=0,r=i.length;n<r;n++){s=i[n],ke(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 De(Ft({},this._options,t));return e.replaceAttributes(Ft({},this.getAttributes())),e}emptyCopy(t){const e=this.nullCopy(t);return this._nodes.forEach((t,n)=>{const r=Ft({},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 Kt(`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 Kt("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 Kt("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,Ie(e,"copy",!1,i.undirected,i.key,i.source.key,i.target.key,Ft({},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)&&!Oe.has(t)&&"function"!=typeof this[t]&&"symbol"!=typeof t&&(r[t]=this[t]);return r.attributes=this._attributes,r.nodes=t,r.edges=e,Ut(r,"constructor",this.constructor),r}}"undefined"!=typeof Symbol&&(De.prototype[Symbol.for("nodejs.util.inspect.custom")]=De.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?Ie:Ne;t.generateKey?De.prototype[n]=function(i,o,s){return r(this,n,!0,"undirected"===(t.type||this.type),null,i,o,s,"update"===e)}:De.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){ne.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)})}(De),function(t){re.forEach(function({name:e,attacher:n}){n(t,e("Edge"),"mixed"),n(t,e("DirectedEdge"),"directed"),n(t,e("UndirectedEdge"),"undirected")})}(De),function(t){ie.forEach(e=>{fe(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 he(!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 Xt(`Graph.${o}: could not find the "${t}" node in the graph.`);return de(!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 Xt(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new Xt(`Graph.${o}: could not find the "${e}" target node in the graph.`);return pe(!1,r,this.multi,i,s,e,n)}throw new Ht(`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 Ht(`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 Ht(`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 he(!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 Xt(`Graph.${o}: could not find the "${t}" node in the graph.`);return de(!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 Xt(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new Xt(`Graph.${o}: could not find the "${e}" target node in the graph.`);return pe(!0,r,this.multi,i,s,e,n)}throw new Ht(`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),me(t,e)})}(De),function(t){ge.forEach(e=>{we(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 Xt(`Graph.${o}: could not find the "${t}" node in the graph.`);ve(!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 Ht(`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 Xt(`Graph.${s}: could not find the "${t}" node in the graph.`);return ve(!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),xe(t,e)})}(De);class Pe extends De{constructor(t){const e=Ft({type:"directed"},t);if("multi"in e&&!1!==e.multi)throw new Ht("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==e.type)throw new Ht('DirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class je extends De{constructor(t){const e=Ft({type:"undirected"},t);if("multi"in e&&!1!==e.multi)throw new Ht("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==e.type)throw new Ht('UndirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class Le extends De{constructor(t){const e=Ft({multi:!0},t);if("multi"in e&&!0!==e.multi)throw new Ht("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(e)}}class Fe extends De{constructor(t){const e=Ft({type:"directed",multi:!0},t);if("multi"in e&&!0!==e.multi)throw new Ht("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==e.type)throw new Ht('MultiDirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class $e extends De{constructor(t){const e=Ft({type:"undirected",multi:!0},t);if("multi"in e&&!0!==e.multi)throw new Ht("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==e.type)throw new Ht('MultiUndirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}function Be(t){t.from=function(e,n){const r=Ft({},e.options,n),i=new t(r);return i.import(e),i}}Be(De),Be(Pe),Be(je),Be(Le),Be(Fe),Be($e),De.Graph=De,De.DirectedGraph=Pe,De.UndirectedGraph=je,De.MultiGraph=Le,De.MultiDirectedGraph=Fe,De.MultiUndirectedGraph=$e,De.InvalidArgumentsGraphError=Ht,De.NotFoundGraphError=Xt,De.UsageGraphError=Kt;class qe{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 Ue=t=>"object"==typeof t&&!Array.isArray(t)&&null!==t&&"_bname"in t,Ve=t=>"object"==typeof t&&!Array.isArray(t)&&null!==t&&"_crate"in t,Ge=t=>Ue(t)&&("empty_bottle"===t._bname&&"empty_data"===t._content||void 0===t._content);var ze=n(8287),We=_(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function Je(t,e){var n="object"==typeof e;return new Promise(function(r,i){var o=new j({next:function(t){r(t),o.unsubscribe()},error:i,complete:function(){n?r(e.defaultValue):i(new We)}});t.subscribe(o)})}function He(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return At(t,st(t))}function Xe(t,e){return m(e)?vt(t,e,1):vt(t,1)}var Ke=Array.isArray,Ye=Object.getPrototypeOf,Ze=Object.prototype,Qe=Object.keys;function tn(t){if(1===t.length){var e=t[0];if(Ke(e))return{args:e,keys:null};if((r=e)&&"object"==typeof r&&Ye(r)===Ze){var n=Qe(e);return{args:n.map(function(t){return e[t]}),keys:n}}}var r;return{args:t,keys:null}}var en=Array.isArray;function nn(t){return ut(function(e){return function(t,e){return en(e)?t.apply(void 0,h([],l(e))):t(e)}(t,e)})}function rn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=st(t),r=ot(t),i=tn(t),o=i.args,s=i.keys;if(0===o.length)return At([],n);var a=new J(function(t,e,n){void 0===n&&(n=z);return function(r){on(e,function(){for(var i=t.length,o=new Array(i),s=i,a=i,u=function(i){on(e,function(){var u=At(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)}}(o,n,s?function(t){return function(t,e){return t.reduce(function(t,n,r){return t[n]=e[r],t},{})}(s,t)}:z));return r?a.pipe(nn(r)):a}function on(t,e,n){t?yt(n,t,e):e()}var sn=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),an={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=an.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=an.delegate;return((null==e?void 0:e.clearInterval)||clearInterval)(t)},delegate:void 0},un=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),an.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&&an.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}(sn),cn={now:function(){return(cn.delegate||Date).now()},delegate:void 0},ln=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=cn.now,t}(),hn=function(t){function e(e,n){void 0===n&&(n=ln.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}(ln),dn=new hn(un);function pn(t){for(var e,n,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var o=null!==(e=st(r))&&void 0!==e?e:dn,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),yt(e,o,function(){return u(i)},t)}};null!==s&&s>=0?yt(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)})}const fn=200,mn=t=>Array.isArray(t)?t.flatMap(t=>t):t,gn=(t,e,n=!1,r=!1,i=!1,o={})=>{const s=e.filter(t=>t);if(s.length>1){const o={_stream:He("ctrl_nudge").pipe(Xe(r=>rn(e.map(t=>t._stream)).pipe(ut(e=>{t?.slice(0,4);const r=i?(({_bus:t,_cond:e=t=>!0,_flatten:n=!1}={})=>n?Array.isArray(t)?t.map(t=>Ue(t)&&"_databus"===t._bname&&e(t)?t._content:t).flat().filter(t=>t):Ue(t)&&"_databus"===t._bname&&e(t)?t._content:t:Array.isArray(t)?t.map(t=>Ue(t)&&"_databus"===t._bname&&e(t)?t._content:t).filter(t=>t):Ue(t)&&"_databus"===t._bname&&e(t)?t._content:t)({_bus:e,_flatten:n}):e,o=!i&&n&&Array.isArray(r)?r.filter(t=>t).flat():r;return o}))))};return r&&(o._control={_stream:He("ctrl_nudge").pipe(Xe(t=>rn(e.map(t=>t?._control?._stream).filter(t=>t)).pipe(ut(t=>Array.isArray(t)?t.flat():t))))}),o}return s.length>0?{...s[0],_stream:s[0]._stream.pipe(ut(e=>(t?.slice(0,4),e)))}:void 0},_n=(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(Ue(t))return{...t,_content:i(t._content,e)};if(Ve(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:vn(r)._stream.pipe(pn(fn,100,100),ut(t=>t),ut(t=>mn(t)),at(...n.map(t=>t._stream.pipe(pn(fn,100,100),ut(t=>mn(t))))),ut(t=>t)).pipe(ut(t=>{const e=mn(t[0]),n=mn(t.slice(1)).filter(t=>!Array.isArray(t)&&"object"==typeof t),r=Object.assign({},...n);return i(e,r)}))}},yn=t=>{const e=t.filter(t=>t);if(e.length>1){return{_stream:e.map(t=>t._stream).pipe(bt(1))}}if(e.length>0)return e[0]},vn=t=>{const e=t.filter(t=>t);if(e.length>1){return{_stream:Et(...e.map(t=>t._stream.pipe(ut(t=>t))))}}if(e.length>0)return e[0]};var bn=n(2543);const wn={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)=>k_(e,t,void 0,{...o,metastep:"leaf inflow"},{leaflogic:(t,e)=>{const n=new dt,r=e._stream.pipe(at(...t.map(t=>t._stream)),ut(t=>(n.next(t[1]),t[0])),ft());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{pre:t=>t}})},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(e,n)=>({...gn(t,e),_control:n})},xn={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)=>k_(e,t,void 0,{...o,metastep:"leaf outflow"},{leaflogic:(t,e)=>{const n=new dt,r=e._stream.pipe(ut(t=>t),at(...t.map(t=>t._stream)),ut(t=>(n.next(t[1]),t[0])),ft());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{pre:t=>t}})},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...vn(t),_control:e})},Sn=(t,e,n={})=>({_bname:t,_content:e,_label:n}),Tn=(t,e,n={})=>Ue(e)&&(void 0===t||(t.includes(e._bname)||"*"===t))?e._content:void 0,kn=Sn("empty_bottle","empty_data"),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 Qg({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)=>k_(n,e,void 0,{...s,metastep:"invoking screenio"},{leaflogic:(t,e)=>{const n=new dt,r=e._stream.pipe(at(...t.map(t=>t._stream)),ct(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),He(t[0])}),ft());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{post:e=>{const n=(Array.isArray(e)?e:[e]).map(t=>Tn("screenio",t)).filter(t=>t);void 0!==n&&t.gos.leafio.getMasterSubsDir()[o].main.doWrite({control:{},data:n});return Sn("screenio","written")}}})},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...vn(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 In(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]=In(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=In(i,5)+Mn(n,o,a,u)+c+e[n]+r[t]>>>0;c=u,u=a,a=In(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])},Rn=/^(?:[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 Dn=function(t){return"string"==typeof t&&Rn.test(t)};const Pn=function(t){if(!Dn(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 jn=[];for(let t=0;t<256;++t)jn.push((t+256).toString(16).slice(1));function Ln(t,e=0){return(jn[t[e+0]]+jn[t[e+1]]+jn[t[e+2]]+jn[t[e+3]]+"-"+jn[t[e+4]]+jn[t[e+5]]+"-"+jn[t[e+6]]+jn[t[e+7]]+"-"+jn[t[e+8]]+jn[t[e+9]]+"-"+jn[t[e+10]]+jn[t[e+11]]+jn[t[e+12]]+jn[t[e+13]]+jn[t[e+14]]+jn[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,Nn,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=[];s.length=80;var a,u,c,l,h,d,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=[];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++)s[i]=v[r+i];for(i=16;i<=79;i++)s[i]=e(s[i-3]^s[i-8]^s[i-14]^s[i-16],1);for(a=p,u=f,c=m,l=g,h=_,i=0;i<=19;i++)d=e(a,5)+(u&c|~u&l)+h+s[i]+1518500249&4294967295,h=l,l=c,c=e(u,30),u=a,a=d;for(i=20;i<=39;i++)d=e(a,5)+(u^c^l)+h+s[i]+1859775393&4294967295,h=l,l=c,c=e(u,30),u=a,a=d;for(i=40;i<=59;i++)d=e(a,5)+(u&c|u&l|c&l)+h+s[i]+2400959708&4294967295,h=l,l=c,c=e(u,30),u=a,a=d;for(i=60;i<=79;i++)d=e(a,5)+(u^c^l)+h+s[i]+3395469782&4294967295,h=l,l=c,c=e(u,30),u=a,a=d;p=p+a&4294967295,f=f+u&4294967295,m=m+c&4294967295,g=g+l&4294967295,_=_+h&4294967295}return(n(p)+n(f)+n(m)+n(g)+n(_)).toLowerCase()}const Un="github",Vn=t=>{if("string"!=typeof t)return t;const e=t.indexOf("?");if(-1===e)return t;const n=t.slice(0,e),r=t.slice(e+1);if(0===r.length)return`${n}?`;return`${n}?${r.split("&").map(t=>{if(!t)return t;const[e]=t.split("=");return e?`${e}=REDACTED`:"REDACTED"}).join("&")}`},Gn=(t,e)=>`${t}/${Vn(e)}`,zn=async(t,e)=>{const n=(t=>{const[e,n]=t.split("?"),r=e.split("/");if(r[0]?.toLowerCase()===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: ${Vn(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 ${Gn(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}}},Wn=t=>{const e=t=>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,c=Gn(t,e);if(globalThis?.DEBUG){const t=c;globalThis.trace[t]?globalThis.trace[t].push("parsing"):globalThis.trace[t]=["parsing"]}const l=((t,e)=>{if("string"==typeof t&&t.toLowerCase()===Un)return!0;if("string"!=typeof e)return!1;const n=e.toLowerCase();return n.startsWith(`${Un}/`)&&n.includes("/")})(t,e)?await zn(t,e):await n.leaflakeio.qm_methods.queryGraph({_appmode:r,_hostdomain:i,_hostappid:o,_domain:t,_appid:e}),{nodes:h}=l.graph?l.graph:{nodes:[]},d=m_(h),p=g_(d),f=n,m=t_(r,s,a,t,e,d,p,f.leafio,f.leaflakeio,f.mnemosyne,f),g=f?s+"/"+a:void 0;if(u.setEtaTree(t,e,m,g),globalThis?.DEBUG){const t=c;globalThis.trace[t]?globalThis.trace[t].push("parsed"):globalThis.trace[t]=["parsed"]}return m}};return u},Jn=Nt("leafmemoryio"),Hn={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{args:s}=n.leaf.logic,a=En(Jn.editorconfig.namedatakey,s),{domain:u,appid:c}=t.gos.etaTree,l=`www.leafgon.com/mnemosyne/${u}/${c}/${a}`,h=Bn(l,Bn.URL),d="global"in o,p="on-tap"in o,f="proxy"in o,m=t.gos.etaTree.leafgraph.thespade?.uuid,g=m&&d?await t.gos.etaTree.lookupRuntimeLambdaLUT("breezyforest","main",m,t.gos.etaTree.leafgraph.edges.lambda.sourcelut[m],[]):void 0;var _,y;e.slice(0,4),d&&(_=a,y=g,Object.keys(y).includes(_));const v={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||h;if(void 0===n||(t=>!!Ue(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 p?n.raw:Sn(a,n.raw,{_type:"memoryio",_command:"o",_memoryname:a,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}{const n=p?Sn("nothing",null,{_type:"memoryio",_command:"forget",_memoryname:a,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}}):null;return p?n:Sn(a,n,{_type:"memoryio",_command:"forget",_memoryname:a,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}}if("main"===a&&e.slice(0,4),Ue(o=n)&&void 0!==o._bname&&"memoryio"===o._label._type&&"forget"===o._label._command){const n=p?Sn("nothing",null,{_type:"memoryio",_command:"io",_memoryname:a,_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},p?n:Sn(a,n,{_type:"memoryio",_command:"io",_memoryname:a,_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},p?r:Sn(a,r,{_type:"memoryio",_command:"io",_memoryname:a,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}var o};return k_(r,n,void 0,{...v,metastep:"memory io "+a},{leaflogic:(t,e)=>{const n=new dt,r=e._stream.pipe(at(...t.map(t=>t._stream)),ut(t=>{if(f){const e=t[0].sid.slice(-1).pop(),r=Bn(`www.leafgon.com/mnemosyne/${u}/${c}/${a}/${e}`,Bn.URL),o=i(t[1],r);n.next(o)}else{const e=i(t[1]);n.next(e)}return t[0]}),ft());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{args:s}=n.leaf.logic,a=En(Jn.editorconfig.namedatakey,s);if(r.length>0){const n=await Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});o[a]={...n}}else o[a]={};return o}return o},methods:t=>({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=t=>t.hostEtaTree?o(t.hostEtaTree):t,s=o(t.gos.etaTree);return{etatreeforest:Wn(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]}}}}},Xn={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let Kn;const Yn=new Uint8Array(16);const Zn=function(t,e,n){if(Xn.randomUUID&&!e&&!t)return Xn.randomUUID();const r=(t=t||{}).random??t.rng?.()??function(){if(!Kn){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Kn=crypto.getRandomValues.bind(crypto)}return Kn(Yn)}();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 tr=t=>void 0!==t&&t>="0"&&t<="9",er=t=>t>="a"&&t<="z"||t>="A"&&t<="Z"||"_"==t||"."==t||"-"==t,nr=t=>t>="a"&&t<="z"||t>="A"&&t<="Z"||"_"==t||"."==t||"-"==t||":"==t,rr=t=>"=+-*/\\&%$_!<>?".includes(t);class ir{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 or,sr;ir.unknown=new ir("",-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"}(or||(or={}));class ar{constructor(t,e,n){this.type=t,this.value=e,this.position=n}}ar.INIT=new ar(or.Init,"",new ir("",0,0,0));class ur{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===or.Keyword,s=i.substring(o?e+1:e,r);return new ar(t,s,new ir(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 ar(or.String,i,new ir(r,t,n,e))}errorToken(t){const{start:e,line:n,current:r,source:i}=this;return new ar(or.Error,t,new ir(i,e,r,n))}identifier(){for(;;){const t=this.peek();if(!t||!(er(t)||tr(t)||rr(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(or.True);case"false":return this.makeToken(or.False);case"null":return this.makeToken(or.Nothing);default:return this.makeToken(or.Identifier)}}keyword(){if(!nr(this.peek())&&!tr(this.peek()))return this.makeToken(or.Identifier);for(;nr(this.peek())||tr(this.peek());)this.advance();return this.makeToken(or.Keyword)}number(){for(;tr(this.peek());)this.advance();if("."===this.peek()&&tr(this.peekNext())){for(this.advance();tr(this.peek());)this.advance();return this.makeToken(or.Float)}if("/"===this.peek()){if(!tr(this.peekNext()))return this.errorToken("Unterminated fraction number");for(this.advance();tr(this.peek());)this.advance();return this.makeToken(or.FractionNumber)}return this.makeToken(or.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(or.EOF);const t=this.advance();if(tr(t)||"-"===t&&tr(this.peek()))return this.number();if((er(t)||rr(t))&&!tr(t))return this.identifier();switch(t){case"(":return this.makeToken(or.LeftParen);case")":return this.makeToken(or.RightParen);case"{":return this.makeToken(or.LeftBrace);case"}":return this.makeToken(or.RightBrace);case"[":return this.makeToken(or.LeftSquare);case"]":return this.makeToken(or.RightSquare);case"#":return this.makeToken(or.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"}(sr||(sr={}));class cr{constructor(t,e,n){this.kind=t,this.value=e,this.position=n}}class lr 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}}lr.kind="RuntimeError";const hr=t=>t,dr=(t,e)=>{if(t)throw new lr(e);return!0},pr=(t,e,n)=>dr(t.length!==e,n||`Expected ${e} argument${e>1?"s":""}, but got ${t.length}.`),fr=(t,...e)=>dr(void 0===e.find(e=>e===t.kind),`Invalid function parameter, actual: '${t.kind}', expected: '${e.join(" or ")}'.`);const mr=t=>()=>{throw new lr(`${t} is not implemented.`)},gr=t=>({parser:()=>{throw new lr(`${t} is not implemented.`)},factory:mr(t)}),_r={Bool:{parser:t=>"true"===t,factory:Boolean},Nothing:{parser:t=>"null"==t,factory:mr("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:mr("FractionNumber")},Vector:gr("Vector"),HashMap:gr("HashMap")},yr="Vector",vr="HashMap";class br{constructor(t,e=_r){this.scanner=t,this.literals=e,this.hadError=!1,this.panicMode=!1,this.current=ar.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(or.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===or.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===or.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 or.True:case or.False:return this.makeLiteral(sr.Boolean,e.parser,t);case or.Nothing:return this.makeLiteral(sr.Nothing,s.parser,t);case or.Integer:return this.makeLiteral(sr.Integer,r.parser,t);case or.Float:return this.makeLiteral(sr.Float,i.parser,t);case or.FractionNumber:return this.makeLiteral(sr.FractionNumber,n.parser,t);case or.String:return this.makeLiteral(sr.String,o.parser,t);case or.Identifier:return this.makeLiteral(sr.Identifier,hr,t);case or.Keyword:return this.makeLiteral(sr.Keyword,o.parser,t);case or.LeftParen:return new cr(sr.List,this.advanceUntil(or.RightParen),t.position);case or.LeftSquare:return new cr(sr.List,[new cr(sr.Identifier,yr,t.position),...this.advanceUntil(or.RightSquare)],t.position);case or.LeftBrace:return new cr(sr.List,[new cr(sr.Identifier,vr,t.position),...this.advanceUntil(or.RightBrace)],t.position);case or.Dispatch:return this.formatDispatch();default:return void this.errorAtCurrent(`Unknown token: '${t.value}'.`)}}makeLiteral(t,e,n){const r=new cr(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===sr.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 vr:this.errorAtCurrent("Invalid dispatch: #{...}.");break;case yr: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 sr.Boolean:case sr.Nothing:case sr.Integer:case sr.Float:case sr.FractionNumber:case sr.String:case sr.Keyword:case sr.Identifier:return n=e(n,t);case sr.List:return t.value.map(r),n=e(n,t)}};return r(t),n}(t,(t,e)=>{if(e.kind===sr.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 cr(sr.Identifier,`%${n+1}`,t.position)),r=new cr(sr.List,[new cr(sr.Identifier,yr,t.position),...n],t.position);return new cr(sr.List,[new cr(sr.Identifier,"fn",t.position),r,t],t.position)}closeParentheses(t){switch(t){case or.RightParen:return")";case or.RightBrace:return"}";case or.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 wr="<native function>";class xr{constructor(t,e,n=!0,r=wr){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===sr.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 xr(t,r,this._resolveIds,this.toString())}{const r=this._fn(t,e,i.slice(0,this.arity));return r instanceof xr?r.call(t,e,i.slice(this.arity)):dr(!0,`Expected ${this.arity} argument${this.arity>1?"s":""}, but got ${n.length}.`)}}get arity(){return this._arity}toString(){return this._toString===wr?wr:`<${this._toString} function>`}toJS(){return this.toString()}debugTypeOf(){return xr.kind}}xr.kind="Function";const Sr=t=>{var e;return new xr(t.fn,t.arity,null===(e=t.resolveArgsIdentifiers)||void 0===e||e,t.name||t.fn.name)},Tr=(t,e)=>Sr({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}),kr=Sr({name:"const",arity:1,fn:(t,e,n)=>{dr(1!==n.length,`Const expected 1 argument, but got ${n.length}.`);const[r]=n;return Sr({name:"const",arity:-1,fn:(t,e)=>t.execLiteral(r,e)})}}),Ar=Sr({name:"def",arity:2,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{pr(n,2);const[r,i]=n;fr(r,sr.Identifier);const o=t.execLiteral(i,e);return e.define(r.value,o),o}}),Er=Sr({name:"defn",arity:-1,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{pr(n,3);const[r,i,o]=n;return e.get("def").call(t,e,[r,new cr(sr.List,[new cr(sr.Identifier,"fn",ir.unknown),i,o],ir.unknown)])}}),Or=Sr({name:"if",arity:3,fn:(t,e,n)=>{pr(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 lr(`Expected boolean value in the if condition, but get '${a}'`)}}),Cr=Sr({arity:-1,name:"case",fn:(t,e,n)=>{dr(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){fr(n,sr.List);const r=n.value;pr(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);dr(!("else"===u||a instanceof xr),"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);dr(!("boolean"==typeof n),"Case branch function must return with Bool."),c=n}if(c)return t.execLiteral(s,e)}dr(!0,`At least one of the case branch must match with the condition: ${o}`)}});class Mr{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 lr(`'${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 lr(`Undefined identifier: '${t}'.`)}assign(t,e){if(!this.values[t]){if(null!==this.enclosing)return this.enclosing.assign(t,e);throw new lr(`Undefined identifier: '${t}'.`)}this.values[t]=e}getNames(){return Object.keys(this.values)}get parent(){return this.enclosing}}const Ir=Sr({name:"fn",arity:-1,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{pr(n,2);const[r,i]=n;fr(r,sr.List);const o=r.value.slice(1);return o.map(t=>fr(t,sr.Identifier)),Sr({name:"lambda",arity:o.length,fn:(t,n,r)=>{pr(r,o.length);const s=new Mr(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}})}}),Nr=Sr({name:"do",arity:-1,fn:(t,e,n)=>(dr(n.length<1,`Expected at least 1 argument, but got ${n.length}.`),n.map(n=>t.execLiteral(n,e)).pop())}),Rr=Sr({name:"side-effect",arity:-1,fn:(t,e,n)=>{dr(n.length<1,`Eff expected at least 1 argument, but got ${n.length}.`);const[r,...i]=n,o=t.execLiteral(r,e);return dr(!(o instanceof xr),"Eff first parameter must be a function."),Sr({name:"side-effect",arity:-1,fn:t=>t.evalFn(o,i)})}}),Dr={stdout:void 0,lockedGlobals:!0,globals:{},utils:{unboxing:hr}},Pr=[yr,vr];class jr{constructor(t,e){this.globals=new Mr,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 sr.Boolean:case sr.Integer:case sr.Float:case sr.FractionNumber:case sr.String:case sr.Keyword:case sr.Nothing:return t.value;case sr.Identifier:return e.get(t.value);case sr.List:return this.execList(t,e);default:return t}},this.options=Object.assign(Object.assign({},Dr),t);const{stdout:n,globals:r,lockedGlobals:i}=this.options,o=Object.assign(Object.assign({},_r),e);Object.keys(o).forEach(t=>{const e=o[t].factory,n=Pr.includes(t)?-1:e.length;this.globals.define(t,Tr(e,n))}),this.globals.define("print",Tr(t=>{var e;return(n||console.log)(t,null===(e=this.lastPrint)||void 0===e?void 0:e.position)},-1)),this.globals.define("const",kr),this.globals.define("def",Ar),this.globals.define("defn",Er),this.globals.define("if",Or),this.globals.define("case",Cr),this.globals.define("fn",Ir),this.globals.define("do",Nr),this.globals.define("side-effect",Rr),Object.keys(r).forEach(t=>{const e=r[t];let n=e;"function"==typeof e&&e.toString()!==wr&&(n=Tr(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===lr.kind?t:new lr(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 lr(`'${i}' is not a function`,t.position)}getGlobalNames(){return this.globals.getNames()}clearEnv(){null!==this.currentEnv.parent&&(this.currentEnv=this.currentEnv.parent)}}var Lr;!function(t){t.Parser="Parser",t.Runtime="Runtime"}(Lr||(Lr={}));class Fr{constructor(t,e){this.literals=e,this.interpreter=new jr(t,e)}insituexecute(t){const e=new ur(t),n=new br(e,this.literals).parse();if(n.hasError)throw{type:Lr.Parser,errors:n.errors};try{return this.interpreter.interpret(n.program)}catch(t){throw{type:Lr.Runtime,errors:[{message:t.message,position:t.position}]}}}execute(t){return Qn(this,void 0,void 0,function*(){const e=new ur(t),n=new br(e,this.literals).parse();if(n.hasError)throw{type:Lr.Parser,errors:n.errors};try{this.interpreter.interpret(n.program)}catch(t){throw{type:Lr.Runtime,errors:[{message:t.message,position:t.position}]}}})}evalFn(t,e){return this.interpreter.evalFn(t,e)}}var $r,Br={const:t=>()=>t};class qr 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"}($r||($r={}));class Ur{constructor(t){this._value=t}static fromJS(t){return new Ur(t)}static fromStr(t){switch(t.value){case"true":return new Ur(!0);case"false":return new Ur(!1);default:throw new qr(`Invalid boolean: "${t.value}".`)}}get value(){return this._value}not(){return new Ur(!this._value)}and(t){return new Ur(this._value&&t._value)}or(t){return new Ur(this._value||t._value)}equals(t){return new Ur(this._value===t._value)}partialCmp(t){return this.value===t.value?$r.Equal:this.value?$r.Greater:$r.Less}copy(){return new Ur(this._value)}toString(){return this._value?"true":"false"}toJS(){return this._value}toJSON(){return this.toJS()}debugTypeOf(){return zr(Ur.kind)}}Ur.kind="Bool";const Vr=t=>new Ur(t);class Gr{constructor(t){this._value=t}static fromJS(t){return new Gr(t)}static fromStr(t){return t.copy()}get value(){return this._value}add(t){return new Gr(this._value+t.value)}index(t){var e;return Number.isInteger(t.value)?new Gr(null!==(e=this._value.charAt(t.value))&&void 0!==e?e:""):new Gr("")}slice(t,e){return new Gr(this.value.slice(t.value,e.value))}equals(t){return Vr(this._value===t.value)}partialCmp(t){const e=this._value.localeCompare(t.value);return e<0?$r.Less:0===e?$r.Equal:$r.Greater}copy(){return new Gr(this._value)}toJS(){return this._value}toJSON(){return this.toJS()}toString(){return`${this._value}`}debugTypeOf(){return new Gr(Gr.kind)}contains(t){return Vr(this.value.indexOf(t.value)>-1)}count(){return ri(this.value.length)}}Gr.kind="String";const zr=(t="")=>new Gr(t);class Wr{constructor(){this._value=null}static fromStr(t){switch(t.value){case"undefined":case"nil":case"null":return new Wr;default:throw new qr(`Invalid Nothing literal: "${t.value}".`)}}get value(){return null}equals(t){return Vr(this._value==t._value)}not(){return Vr(!0)}toJS(){return null}toJSON(){return null}toString(){return"null"}debugTypeOf(){return zr(Wr.kind)}}Wr.kind="null";const Jr=new Wr,Hr=t=>~~t,Xr=t=>null==t||null==t||t==Jr,Kr=(t,e)=>{if(t)throw new qr(e);return!0},Yr=(t,e)=>Kr(t.constructor!==e.constructor,`Type Error! Expected '${ni(t)}', but got '${ni(e)}'`),Zr=(t,e)=>{var n;return Kr(t!==e.constructor,`Expected '${null!==(n=t.kind)&&void 0!==n?n:t.name}', but got '${ni(e)}'.`)},Qr=(t,e)=>Kr(!t[e],`"${e.toString()}" is not defined on ${t}`),ti=t=>Kr(!Number.isInteger(t),`Expected integer number', but got '${t}'.`),ei=(t,e)=>(Kr(Xr(t),e),t),ni=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 ri(t,e=0){if("string"==typeof t){ii(t);const e=oi(t)?si(t):ai(t);return ri(e.intValue,e.decimals)}return Number.isInteger(t)||0!==e?(ti(t),ti(e),new di(t,e)):ri(t.toString())}function ii(t){return Kr(""===t||isNaN(Number(t)),`Invalid number: "${t}"`)}function oi(t){return t.startsWith("0")?/^0[eE]0$/.test(t):/^[-+]?[1-9](\.\d+)?[eE][-+]?\d+$/.test(t)}function si(t){Kr(!oi(t),`Input is not in scientific form: "${t}"`);const e=t.split(/[eE]/),n=ai(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 ai(t){var e;ii(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 ui(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 ci={modulo:function(t,e){const n=t.value,r=e.value;return ti(n),ti(r),Kr(r<1,`Modulo (${r}) must be positive.`),Kr(n<0,`Number (${n}) cannot be negative.`),ri(n%r)}};const li=(t,e)=>t!==e&&t?e?li(e,t%e):t:e,hi=t=>Math.abs(t)<=Number.EPSILON;class di{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 Vr((e=this.value,n=t.value,hi(e-n)));var e,n}negate(){return new di(-this.intValue,this.decimals)}add(t){const e=ui(this,t),n=e.intValue1+e.intValue2;return new di(n,e.maxDecimal)}subtract(t){const e=ui(this,t),n=e.intValue1-e.intValue2;return new di(n,e.maxDecimal)}multiply(t){return new di(this.intValue*t.intValue,this.decimals+t.decimals)}divide(t){if(0===t.intValue)throw new qr("Cannot divide by zero!");const e=ui(this,t),n=Math.round(e.intValue1/e.intValue2*Math.pow(10,12));return new di(n,12)}partialCmp(t){const e=ui(this,t);return e.intValue1<e.intValue2?$r.Less:e.intValue1>e.intValue2?$r.Greater:$r.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 di(this.intValue,this.decimals)}debugTypeOf(){return zr(di.kind)}isInteger(){return Vr(0===this.decimals)}toJSON(){return this.toString()}}di.kind="Number";const pi=t=>e=>{Zr(di,e);try{return ri(t(e.value))}catch(n){throw new qr(`Invalid argument for ${t.name}: ${e.value}`)}},fi=t=>(e,n)=>(Zr(di,e),Zr(di,n),ri(t(e.value,n.value))),mi=ri(Math.E),gi=ri(Math.LN2),_i=ri(Math.LN10),yi=ri(Math.LOG2E),vi=ri(Math.LOG10E),bi=ri(Math.PI),wi=ri(Math.SQRT1_2),xi=ri(Math.SQRT2),Si=pi(Math.abs),Ti=pi(Math.sign),ki=fi((t,e)=>Math.min(t,e)),Ai=fi((t,e)=>Math.max(t,e)),Ei=pi(Math.floor),Oi=pi(Math.round),Ci=pi(Math.ceil),Mi=pi(Math.trunc),Ii=pi(Math.cbrt),Ni=pi(Math.sqrt),Ri=pi(Math.exp),Di=fi(Math.pow),Pi=pi(Math.log),ji=pi(Math.log2),Li=pi(Math.log10),Fi=Math.PI/180,$i=pi(t=>{const e=t%Math.PI;return hi(e)||hi(e-Math.PI)?0:Math.sin(t)}),Bi=pi(Math.asin),qi=pi(Math.asinh),Ui=pi(Math.cos),Vi=pi(Math.acos),Gi=pi(Math.acosh),zi=pi(Math.tan),Wi=pi(Math.atan),Ji=fi(Math.atan2),Hi=pi(Math.atanh);var Xi=Object.freeze({__proto__:null,E:mi,LN2:gi,LN10:_i,LOG2E:yi,LOG10E:vi,PI:bi,SQRT1_2:wi,SQRT2:xi,abs:Si,sign:Ti,min:ki,max:Ai,floor:Ei,round:Oi,ceil:Ci,trunc:Mi,cbrt:Ii,sqrt:Ni,exp:Ri,pow:Di,log:Pi,log2:ji,log10:Li,deg2rad:t=>t.multiply(ri(Fi)),rad2deg:t=>t.divide(ri(Fi)),sin:$i,asin:Bi,asinh:qi,cos:Ui,acos:Vi,acosh:Gi,tan:zi,atan:Wi,atan2:Ji,atanh:Hi});const Ki=t=>(Qr(t,"copy"),t.copy());var Yi={typeof:t=>{const e=t.debugTypeOf?t.debugTypeOf():zr("<unknown>");return e instanceof String?zr(e):e},copy:Ki,"deep-copy":t=>{var e;return Qr(t,"copy"),t.deepCopy?null===(e=t.deepCopy)||void 0===e?void 0:e.call(t):Ki(t)},str:t=>zr(t.toString()),"to-json":t=>{let e=null;return"function"==typeof t.toJSON?e=t.toJSON():"function"==typeof t.toJS&&(e=t.toJS()),zr(JSON.stringify(e))}};const Zi=(t,e)=>t.constructor!==e.constructor?Vr(!1):t.equals(e),Qi=(t,e)=>{Yr(t,e);const n=t.lt;return"function"==typeof n?n(e):Vr(t.partialCmp(e)===$r.Less)},to=(t,e)=>{Yr(t,e);const n=t.gt;return"function"==typeof n?n(e):Vr(t.partialCmp(e)===$r.Greater)};var eo={"==":Zi,"!=":(t,e)=>Zi(t,e).not(),"<":Qi,"<=":(t,e)=>Vr(Zi(t,e).value||Qi(t,e).value),">":to,">=":(t,e)=>Vr(Zi(t,e).value||to(t,e).value)};var no={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 ro=(t,e)=>(Yr(t,e),t.add(e)),io=(t,e)=>(Yr(t,e),t.multiply(e));var oo={negate:t=>t.negate(),not:t=>t.not(),and:(t,e)=>t.and(e),or:(t,e)=>t.or(e),"+":ro,"-":(t,e)=>(Yr(t,e),t.subtract(e)),"*":io,"/":(t,e)=>(Yr(t,e),t.divide(e)),get:(t,e)=>t.index(e)};class so{constructor(t){t.map(e=>Yr(t[0],e)),this._value=t}get value(){return this._value}contains(t){return Vr(void 0!==this.value.find(e=>Zi(e,t).value))}add(t){return new so(this._value.concat(t.value))}count(){var t;return new di(null!==(t=this._value.length)&&void 0!==t?t:0)}map(t){return new so(this.value.map(e=>t(e)))}filter(t){return new so(this.value.filter(e=>t(e).toJS()))}reverse(){return new so(this.value.reverse())}reduce(t,e){return this.value.reduce(e,t)}intersperse(t){const e=this.value.length-1;return new so(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){Zr(di,t);return ei(this.value[t.value],`Vector index ${t.toString()} is not defined`)}slice(t,e){return Zr(di,t),Zr(di,e),new so(this.value.slice(t.value,e.value))}copy(){return new so([...this._value])}deepCopy(){return new so(this._value.map(t=>Ki(t)))}debugTypeOf(){return zr(so.kind)}}function ao(...t){return new so(t)}so.kind="Vector";var uo={sum:t=>(Zr(so,t),t.reduce(ri(0),ro)),prod:t=>(Zr(so,t),t.reduce(ri(1),io)),intersperse:(t,e)=>(Zr(so,e),e.intersperse(t)),join:t=>(Zr(so,t),t.reduce(zr(""),ro)),"join-with":(t,e)=>(Zr(so,e),e.intersperse(t).reduce(zr(""),ro)),"num-list":(t,e)=>(Zr(so,e),e.map(t=>zr(t.toString())).intersperse(t).reduce(zr(""),ro)),head:t=>{Zr(so,t);return ei(t.value[0],"Vector is empty")},reverse:t=>(Zr(so,t),ao(...t.value.reverse())),slice:(t,e,n)=>(Zr(so,t),Zr(di,n),Zr(di,e),ei(t.value.length,"Vector is not defined correctly"),ao(...t.value.slice(e.value,n.value))),tail:t=>{Zr(so,t),ei(t.value.length,"Vector is not defined correctly");return ao(...t.value.slice(1))}};const co=Math.random;var lo=Object.freeze({__proto__:null,random:()=>ri(co()),randomInt:(t,e)=>{const n=Hr(t.value),r=Hr(e.value);return ri(Hr(n+co()*(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 ao(...e)},range:(t,e,n)=>{const r=t.value,i=n.value,o=Hr(e.value);let s=r;const a=[];for(let t=0;t<o;t++)a.push(ri(s)),s+=i;return ao(...a)},range0:t=>{const e=Hr(t.value);return ao(...Array.from({length:e},(t,e)=>ri(e)))}});class ho{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 zr(ho.kind)}}ho.kind="Just";class po{constructor(t=[]){if(t.length%2!=0)throw new qr("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(Gr!==t.constructor)throw new qr("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 di?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 zr(po.kind)}index(t){Zr(Gr,t);try{const e=this._value.get(t.value);return Xr(e)?new Wr:e}catch(t){return new Wr}}}po.kind="HashMap";const fo=(...t)=>new po(t);var mo={keys:t=>(Zr(po,t),ao(...Array.from(t.value.keys()).map(t=>zr(t)))),values:t=>(Zr(po,t),ao(...Array.from(t.value.values()))),"hash-map":fo};class go{constructor(t){const e=t.value;e.map(t=>Yr(e[0],t)),this._value=e.reduce((t,e)=>(t.find(t=>Zi(t,e).value)||t.push(e),t),[])}get value(){return this._value}contains(t){return Vr(void 0!==this.value.find(e=>Zi(e,t).value))}union(t){return new go(ao(...this._value.concat(t.value)))}difference(t){return new go(ao(...this.value.filter(e=>!t.contains(e).value)))}intersection(t){return new go(ao(...this.value.concat(t.value).filter(e=>t.contains(e).value&&this.contains(e).value)))}symmetricDifference(t){return new go(ao(...this.value.concat(t.value).filter(e=>!(t.contains(e).value&&this.contains(e).value))))}count(){var t;return new di(null!==(t=this._value.length)&&void 0!==t?t:0)}map(t){return new go(ao(...this.value.map(t)))}filter(t){return new go(ao(...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 go(ao(...this.value))}deepCopy(){return new go(ao(...this.value.map(t=>Ki(t))))}debugTypeOf(){return zr(go.kind)}}go.kind="Set";var _o={Set:t=>new go(t),"set-2-list":function(t){return ao(...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 yo=(t,e)=>Number.isInteger(t)&&Number.isInteger(e)&&0!==e;class vo{constructor(t,e){if(!yo(t,e))throw new qr("Invalid fraction number parameters!");e<0&&(t*=-1,e*=-1);const n=li(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 Vr(this.numerator===t.numerator&&this.denominator===t.denominator)}negate(){return new vo(-this._n,this._d)}add(t){const e=this.numerator*t.denominator+this.denominator*t.numerator,n=this.denominator*t.denominator;return new vo(e,n)}subtract(t){const e=this.numerator*t.denominator-this.denominator*t.numerator,n=this.denominator*t.denominator;return new vo(e,n)}multiply(t){const e=this.numerator*t.numerator,n=this.denominator*t.denominator;return new vo(e,n)}divide(t){const e=this.numerator*t.denominator,n=this.denominator*t.numerator;return new vo(e,n)}partialCmp(t){const e=this._d*t._d/li(this._d,t._d),n=this._n*e/this._d,r=t._n*e/t._d;return n<r?$r.Less:n>r?$r.Greater:$r.Equal}toJS(){return{numerator:this._n,denominator:this._d}}toJSON(){return this.toString()}toString(){return`${this._n}/${this._d}`}copy(){return new vo(this._n,this._d)}debugTypeOf(){return zr(vo.kind)}}vo.kind="Fraction";const bo=(t,e)=>new vo(t,e);var wo={"number-2-fraction":(t,e)=>{const n=t.value;Kr(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 bo(Math.round(r*i),i)},"fraction-2-number":t=>ri(t.numerator).divide(ri(t.denominator)),reciprocal:t=>(Zr(vo,t),bo(t.denominator,t.numerator))};const xo=t=>t,So={Bool:{parser:t=>Ur.fromStr(zr(t)),factory:t=>(Zr(Ur,t),t)},Nothing:{parser:t=>Wr.fromStr(zr(t)),factory:t=>(Zr(Wr,t),t)},Int:{parser:ri,factory:function(t){return Zr(di,t),Kr(!t.isInteger().value,"Expected integer, but got float number."),t}},Float:{parser:ri,factory:function(t){return Zr(di,t),t}},FractionNumber:{parser:t=>{const[e,n]=t.split("/").map(parseFloat);if(yo(e,n))return new vo(e,n);throw new qr(`Invalid fraction number: ${t}.`)},factory:(t,e)=>(Kr(!t.isInteger().value,"Numerator must be integer"),Kr(!e.isInteger().value,"Denominator must be integer"),new vo(t.toJS(),e.toJS()))},String:{parser:zr,factory:t=>(Zr(Gr,t),t)},Vector:{parser:xo,factory:ao},HashMap:{parser:xo,factory:fo}},To=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({},Yi),eo),no),oo),Br),Xi),ci),wo),uo),mo),_o),lo),{maybe:t=>Xr(t)?Jr:new ho(t),Nothing:Jr}),ko={unboxing:t=>t.toJS()},Ao="undefined"!=typeof globalThis&&"function"==typeof globalThis.btoa,Eo="undefined"!=typeof globalThis&&"function"==typeof globalThis.atob,Oo=Ao?globalThis.btoa.bind(globalThis):t=>globalThis.Buffer.from(t,"binary").toString("base64"),Co=Eo?globalThis.atob.bind(globalThis):t=>globalThis.Buffer.from(t,"base64").toString("binary");function Mo(t){return Oo(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(t,e){return String.fromCharCode("0x"+e)}))}function Io(t){return decodeURIComponent(Co(t).split("").map(function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)}).join(""))}const No=t=>t>0?" ".repeat(t):"",Ro=t=>t?.constructor?.kind??t?.constructor?.name??"unknown",Do={trace:[],probe:[]},Po=(t,e=0,n=!1)=>{const r=typeof t,i=No(e),o=No(e+1);return"string"===r?(n?"":i)+`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"\n`:"object"===r?Array.isArray(t)?(n?"":i)+"[\n"+`${t.map(t=>Po(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+" "+Po(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 jo=(t,e=!0)=>{if(null==t)return To.Nothing;const n=typeof t;return"string"===n?zr(t):"object"===n?Array.isArray(t)?ao(...t.filter(t=>t).map(t=>jo(t,!1))):[null,void 0].includes(t)?To.Nothing:fo(...Object.entries(t).map(([t,e])=>[zr(t),jo(e,!1)]).flat()):"boolean"===n?Vr(t):"number"===n?ri(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):To.Nothing},Lo=({_probefunc:t,_tracefunc:e}={})=>({return:t=>t,outport:t=>t,undefined:To.Nothing,nil:To.Nothing,null:To.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 zr(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=>Vr("null"==t||t.constructor==To.Nothing.constructor),isbottle:t=>{const e=t.toJSON();return Vr(Ue(e))},islist:t=>{const e=t.toJSON();return Vr(Array.isArray(e))},flatten:t=>{const e=t.toJSON();return jo(e.flat().filter(t=>t),!1)},join:(t,e)=>{const n=t.toJSON();return zr(n.join(e))},bottle:(t,e)=>{if(t.constructor!==Gr)throw new qr(`Expected '${Gr.kind??Gr.name}', but got '${Ro(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 jo(i)},getbottle:(t,e)=>{if(t.constructor!==so)throw new qr(`Expected '${so.kind??so.name}', but got '${Ro(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!==po)throw new qr(`Expected '${po.kind??po.name}', but got '${Ro(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 jo(o||[])},min:t=>{if(t.constructor!==so)throw new qr(`Expected '${so.kind??so.name}', but got '${Ro(t.value)}'.`);const e=t.value.map(t=>t.value);return ri(Math.min(...e))},max:t=>{if(t.constructor!==so)throw new qr(`Expected '${so.kind??so.name}', but got '${Ro(t.value)}'.`);const e=t.value.map(t=>t.value);return ri(Math.max(...e))},parse:t=>{const e=t.toJSON();let n;return ii(e),n=oi(e)?si(e):ai(e),0===n.decimals?ri(n.intValue):ri(n.intValue,n.decimals)},"merge-dict":(t,e)=>{if(t.constructor!==po)throw new qr(`Expected '${po.kind??po.name}', but got '${Ro(t.value)}'.`);if(e.constructor!==po)throw new qr(`Expected '${po.kind??po.name}', but got '${Ro(e.value)}'.`);const n={...t.toJSON(),...e.toJSON()};return jo(n)},"make-dict":(t,e)=>{if(t.constructor!==so)throw new qr(`Expected '${so.kind??so.name}', but got '${Ro(t.value)}'.`);if(e.constructor!==so)throw new qr(`Expected '${so.kind??so.name}', but got '${Ro(e.value)}'.`);const n=t.toJSON(),r=e.toJSON(),i=[...Array(n.length).keys()].reduce((t,e)=>({...t,[n[e]]:r[e]}),{});return jo(i)},concat:(t,e)=>{if(t.constructor!==so)throw new qr(`Expected '${so.kind??so.name}', but got '${Ro(t.value)}'.`);if(e.constructor!==so)throw new qr(`Expected '${so.kind??so.name}', but got '${Ro(e.value)}'.`);return ao(...t.value.concat(e.value))},uuid4:()=>zr(Zn()),uuid5:t=>{const e=Bn(t.toString(),Bn.URL);return zr(e)},"*":(t,e)=>ri(t*e),"/":(t,e)=>ri(t/e),"+":(t,e)=>isNaN(t.value)||isNaN(e.value)?t.add(e):ri(t.value+e.value),"-":(t,e)=>ri(t-e),tofixed:(t,e)=>zr(Number(t).toFixed(e))}),Fo=(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=p_.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 v_(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}.`}),jo(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}.`}),jo(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}.`}),jo(e))}};return new Fr({globals:{...To,...Lo({}),...r},utils:ko},So)},$o=(t,e,n,r,i=0)=>{try{e?.slice(0,4);const r=n.insituexecute(t);try{return[0,r.toJSON()]}catch{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(Sn("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 Bo={};const qo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{let o,s;const a=bn.memoize(async()=>await A_("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&&Do.trace.length===r&&Do.trace.shift(),Do.trace.push({timestamp:Date.now(),address:u,refnode:e,trace:t}),v_(i.probe._default,Do.trace,{},n).then(t=>{}))})},l=(t,n=e,r=1)=>{a().then(i=>{Object.entries(i).length>0&&(r>0&&Do.probe.length===r&&Do.probe.shift(),Do.probe.push({timestamp:Date.now(),address:u,refnode:e,trace:t}),v_(i.probe._default,Do.probe,{},n).then(t=>{}))})},h=await Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});Bo[e]="interactive"in h;const d=Bo[e],p=n.leaf.logic.args.lispexpression;o="global"in h?t.gos.etaTree.gRuntimeLEAFlisp:new Fr({globals:{...To,...Lo({_probefunc:l,_tracefunc:c})},utils:ko},So);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 dt;if(d){t.gos.etaTree.leafio.elementioLUT[e]=_;const n={graphuuid:"",domain:"breezyforest",appid:"leaflisp",graphaddrstr:"breezyforest/leaflisp"},r=p_.lambda(t)({refnode:"leaflisp_runtime_interactive",refnodedata:{leaf:{logic:{args:n}}},nodelambda:[],contextuallambda:[]}),i=await r;s=()=>{const n=Sn("dataevent",{_refnode:e,_provenance:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid,refnodedata:g.leafnode,codebase:"leaflisp.js"}},{});v_(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 ${Po(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]=$o(r,e,o,g.leafaddress,i);return-1===t&&l(n,e),n}catch(t){throw new qr(`LEAFlisp Error: ${t}`)}};return k_(i,r,void 0,{...g,metastep:"invoking leaflisp"},{leaflogic:d?(t,e)=>{const n=new dt;let r=!1;const i=e._stream.pipe(ut(t=>(s&&s(),t)),at(...t.map(t=>t._stream)),ct(t=>rn(new _t(t[0]),_)),ut(t=>{const e=t[1];return r=!0,n.next(e),t[0]}),ft());return{_stream:n.pipe(gt(t=>r),ut(t=>t),ft()),_control:{...e,_stream:i}}}:(r,i)=>{const o=new dt;let s=!1;const a=f?i._stream.pipe(ut(t=>t),at(...r.map(t=>t._stream)),ut(r=>{let i=r[1];if(Ue(i)&&"rewrite"===i._bname){const r=Tn("*",i),o={...n},s=Po(null==r?[]:r);o.leaf.logic.args.lispexpression=s,n.leaf.logic.args.lispexpression=s,t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:Mo(JSON.stringify(o))}}),i=void 0}if(null!=i){s=!0;const t=c(i);return o.next(t),r[0]}}),gt(t=>void 0!==t),ft()):m?i._stream.pipe(ut(t=>t),at(...r.map(t=>t._stream)),ut(t=>{const e=t[1];if(Ue(e)&&"codebottle"===e._bname){const n=Tn("*",e);s=!0;const r=n.data,i=n.code,a=c(r,i);return o.next(a),t[0]}}),gt(t=>void 0!==t),ft()):i._stream.pipe(ut(t=>t),at(...r.map(t=>t._stream)),ut(t=>{const e=t[1];s=!0;const n=c(e);return o.next(n),t[0]}),ft());return{_stream:o.pipe(gt(t=>s),ut(t=>t),ft()),_control:{...i,_stream:a}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>(n,r)=>({...gn(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=(async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>({version:"breezyforest",nodequery:t=>t,nodemethod:t=>({})}))({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}),a=Bo[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:Mo(JSON.stringify(i))}})},getTextSource:()=>n.leaf.logic.args.lispexpression},general:{getNodeData:()=>n}}}},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 Qg({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 dt,r=t[0]._stream,i=e._stream.pipe(ut(t=>t),at(r),ut(t=>(n.next(t[1]),t[0])),ft());return{_stream:n.pipe(ut(t=>t),ft()),_control:{...e,_stream:i.pipe(ut(t=>t),ft())}}};return(t,n)=>{if(t.length>1){const r=Et(...t.map((t,e)=>t._stream.pipe(ut(t=>t),ft())));if("concat"in o){return{...yn(t),_control:n}}if("merge"in o){return{...vn(t),_control:n}}if("combine"in o){return{...gn(e,t),_control:n}}if("substitute"in o){const e=Object.keys(o.substitute);return{..._n(t,e),_control:n}}{const t=t=>t,e=n._stream.pipe(ut(t=>t));return k_({_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 Qg({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}},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 Qg({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 dt,r=e._stream.pipe(at(...t.map(t=>t._stream)),ct(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?Sn("mix",u):u)):r&&!s?(u=[t[1]].flat().map(t=>Ue(t)?Tn("*",t):void 0).filter(t=>t&&"empty_data"!==t),a||(u=[...new Set(u.flat())]),n.next(e?Sn("mix",u):u)):i&&!s?(u=[t[1]].flat().map(t=>Ue(t)?t:void 0).filter(t=>void 0!==t&&!Ge(t)),a||(u=[...new Set(u.flat())]),1===u.length?n.next(e?Sn("mix",u[0]):u[0]):n.next(e?Sn("mix",u):u)):(u={},[t[1]].flat().filter(t=>Ue(t)&&!Ge(t)).map(t=>{if(Ue(t))return u=((e,n={})=>{const r=e._bname;return{...n,[r]:Tn("*",t)}})(t,u),t}),n.next(e?Sn("mix",u):u)),He(t[0])}),ft());return{_stream:n.pipe(ut(t=>t),ft()),_control:{...e,_stream:r}}};return(t,n)=>{if(t.length>1){if("concat"in o){return{...yn(t),_control:n}}if("merge"in o){return{...vn(t),_control:n}}if("combine"in o){return{...gn(e,t),_control:n}}if("substitute"in o){const e=Object.keys(o.substitute);return{..._n(t,e),_control:n}}{const e=t=>t,r=n._stream;return k_({_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 k_({_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 Qg({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}},Go=Nt("leafgateflow"),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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{args:s}=n.leaf.logic,a=En(Go.editorconfig.namedatakey,s).toLowerCase(),u=En(Go.editorconfig.toggledatakey,s),c=(()=>{const t=Object.keys(o).filter(t=>0===Object.keys(o[t]).length);return t.length>0?t.sort().join(";"):void 0})(),l={codebase:"leafgateflow.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>k_(e,t,void 0,{...l,metastep:"gateflow "+(u?"NOT gate, ":"normal gate, ")+a},{leaflogic:(t,e)=>{const n=new dt,r=e._stream.pipe(at(...t.map(t=>t._stream)),ut(t=>{const e=t[1],r=t=>Ue(t)?!u&&t._bname?.toLowerCase()===a||u&&t._bname?.toLowerCase()!==a?t:void 0:"{crate}"===a?!u&&t._cratelabel?"uncrate"===c?Object.keys(t).filter(t=>"_cratelabel"!==t).map(e=>t[e]).flat():t:u&&!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(a):n.includes(a))return t})(t,u),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]}),gt(t=>void 0!==t),ft());return{_stream:n.pipe(ut(t=>t),ft()),_control:{...e,_stream:r.pipe(ut(t=>t),ft())}}},datalogic:{post:t=>t}})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({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}},Wo=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in leaflabel.js",codebase:"/src/ghostos/api/parser/nodelogic/datautils/leaflabel.js"},{}),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 Qg({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 v_(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 k_(i,r,void 0,{...s,metastep:"leaflabel "+e},{leaflogic:(t,e)=>{const n=new _t({...Wo,_label:{...s}}),r=a(t),i=t.length>0?e._stream.pipe(ct(t=>rn([He(t),...r])),ut(t=>(2==t.length?n.next(t[1]):n.next(t.slice(1)),t[0])),gt(t=>t),ft()):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 Qg({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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree})}}else o={};return o}},Ho={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 Qg({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:He([n.leaf.logic.args.label])};return{_stream:vn(t)._stream.pipe(at(r._stream),ut(t=>t),gt(([t,e])=>t.every(t=>Ue(t)||Ve(t)&&t._crate.every(Ue))),ut(([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]=[])=>(Ue(e)?t.push(s(n,r(e))):Ve(e)&&t.push({...e,_crate:e._crate.map(t=>s(n,r(t)))}),t),[]);if(i.length>0)return i}),gt(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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=n.leaf.logic.args.labelstr;return o&&s in o?{...o[s]}:{}}},Xo={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 Qg({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:He(n.leaf.logic.args.bottlekey),_control:e},c=e._stream.pipe(Xe(t=>(r=t,u._stream)),ut(t=>(i=t,r)));return k_({_stream:c},t,void 0,{...a,metastep:"executing bottle with key "+i},{datalogic:{pre:t=>void 0===s?Sn(i,t):Sn(i,t,{tag:s})}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,n])=>{s[t]=(t,r)=>{const i=gn(e,t);return{...n([i],r),_control:r}}}),s}},Ko={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 Qg({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:He([n.leaf.logic.args.bottlekey]),_control:e};let i;const a=e._stream.pipe(at(r._stream),ut(t=>{const e=t[1];return i=e,t[0]}),ft()),u=(t,e)=>{const n=new dt,r=e._stream.pipe(at(...t.map(t=>t._stream)),ut(t=>{const e=t[1],r=t=>{const e=[t].flat().map(t=>Ue(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]}),gt(t=>void 0!==t),ft());return{_stream:n.pipe(ut(t=>t),ft()),_control:{...e,_stream:r.pipe(ut(t=>t),ft())}}};return k_({_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 Qg({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}},Yo={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 Qg({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})();return(t,e)=>{const n=new dt,r=e._stream.pipe(at(...t.map(t=>t._stream)),ut(t=>{const e={_cratelabel:s?{tag:s}:{}};if((Array.isArray(t[1])?t[1]:[t[1]]).flat().map(t=>Ue(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]}),gt(t=>void 0!==t),ft());return{_stream:n.pipe(ut(t=>t),ft()),_control:{...e,_stream:r}}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({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}},Zo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>(await Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),(t,e)=>{const n=vn(t);if(n&&"_stream"in n){return{_stream:n._stream.pipe(ut(t=>t)),_control:e}}return{_stream:He([]),_control:e}}),lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={};if(r.length>0){const s=await Qg({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 Qg({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 v_(t,[],{}):{}}}}}},Qo=Nt("leafdeckspade"),ts={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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});await Vo.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i});const 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 a=r._config?.loopidx,{args:u}=n.leaf.logic,c="_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)=>({...vn(t),_control:e}),l=r._stream;return k_({_stream:l},t,void 0,{...s,metastep:"creating a leafdeckspade element"},{datalogic:{pre:t=>Array.isArray(t)?t.map(t=>Tn(i,t)).filter(t=>t):Tn(i,t),post:t=>{const e=Array.isArray(t)?t:[t],n={type:"leafdeckspade",uuid:Zn(),name:En(Qo.editorconfig.namedatakey,u),description:"{description}",lambdas:{default:"defaultLambda",defaultLambda:c,bro:t=>t},diamonds:e};return Sn("screenio",n)}}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({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}},es=Nt("leafdeckheart"),ns={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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});await Vo.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i}),await Xo.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckheart"}}}},nodelambda:[],contextuallambda:i});const s={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,{args:u}=n.leaf.logic,c="_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)=>({...vn(t),_control:e}),l=r._stream;return k_({_stream:l},t,void 0,{...s,metastep:"creating a leafdeckheart element"},{datalogic:{pre:t=>Array.isArray(t)?t.map(t=>Tn(i,t)).filter(t=>t):Tn(i,t),post:t=>{const e=Array.isArray(t)?t:[t],n={type:"leafdeckheart",uuid:Zn(),name:En(es.editorconfig.namedatakey,u),description:"{description}",lambdas:{default:"defaultLambda",defaultLambda:c,bro:t=>t},diamonds:e};return Sn("screenio",n)}}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({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}},rs=Nt("leafdeckdiamond"),is={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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});await Vo.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i});const s={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,{args:u}=n.leaf.logic,c="_default"in o?(t,n)=>{const r={_stream:n._stream.pipe(ut(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(ut(t=>t)),_control:{_stream:i._control._stream.pipe(ut(t=>t))}}}:"href"in o&&"_default"in o.href?(t,e)=>{const n=o.href._default(t,e);return{_stream:n._stream.pipe(ut(t=>(window.location.href.slice(-t.length)!==t&&(window.location.href=t),t))),_control:{...e._control,_stream:n._control._stream.pipe(ut(t=>t))}}}:(t,e)=>({...vn(t),_control:e}),l=r._stream,h=k_({_stream:l},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=>{Ue(t)&&(t._bname===i[0]?n.clubs.push(Tn(i,t)):"nodeinput"===t._bname&&n.nodeinput.push(Tn("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:Zn(),nodeuuid:e,name:En(rs.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:r,clubs:n};return Sn("_leafdeckdiamond",i)}}});return{_stream:h._stream.pipe(ut(t=>t)),_control:h._control}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({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}},os=Nt("leafdeckclub"),ss={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 Qg({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,{args:a}=n.leaf.logic,u="_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)=>({...vn(t),_control:e}),c=r._stream.pipe(ut(t=>t)),l=k_({_stream:c},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=>{Ue(t)&&"nodeinput"===t._bname&&n.nodeinput.push(Tn("nodeinput",t))}),n},post:t=>{const n="subscribe"in o,r={type:"leafdeckclub",uuid:Zn(),nodeuuid:e,name:En(os.editorconfig.namedatakey,a),svgicon:"https://www.leafgon.com/icons/hardware/laptop_mac/materialicons/24px.svg",description:"{description}",nodeinput:t.nodeinput,lambdas:{default:"defaultLambda",defaultLambda:u,bro:t=>t},subscription:n};return Sn("_leafdeckclub",r)}}});return{_stream:l._stream.pipe(ut(t=>t)),_control:l._control}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({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}},as={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 Qg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree});const o=Ko.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckspade"}}}},nodelambda:[],contextuallambda:i}),s=Ko.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckheart"}}}},nodelambda:[],contextuallambda:i}),a=void 0;return t=>{const e=o(t),n=s(t);return a([e,n]).pipe(ut(t=>t),ut(t=>t)).pipe(gt(t=>t))}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=t=>e(t)}),s}},us={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 Qg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s="_default"in o?t=>o._default([t]):t=>t,a=Xo.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafpopupview"}}}},nodelambda:[],contextuallambda:i});return t=>{const e=t.pipe(ut(t=>t),ut(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(gt(t=>t)))}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=t=>e(t)}),s}};function cs(t,e){return function(){return t.apply(e,arguments)}}const{toString:ls}=Object.prototype,{getPrototypeOf:hs}=Object,{iterator:ds,toStringTag:ps}=Symbol,fs=(ms=Object.create(null),t=>{const e=ls.call(t);return ms[e]||(ms[e]=e.slice(8,-1).toLowerCase())});var ms;const gs=t=>(t=t.toLowerCase(),e=>fs(e)===t),_s=t=>e=>typeof e===t,{isArray:ys}=Array,vs=_s("undefined");function bs(t){return null!==t&&!vs(t)&&null!==t.constructor&&!vs(t.constructor)&&Ss(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const ws=gs("ArrayBuffer");const xs=_s("string"),Ss=_s("function"),Ts=_s("number"),ks=t=>null!==t&&"object"==typeof t,As=t=>{if("object"!==fs(t))return!1;const e=hs(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||ps in t||ds in t)},Es=gs("Date"),Os=gs("File"),Cs=gs("Blob"),Ms=gs("FileList"),Is=gs("URLSearchParams"),[Ns,Rs,Ds,Ps]=["ReadableStream","Request","Response","Headers"].map(gs);function js(t,e,{allOwnKeys:n=!1}={}){if(null==t)return;let r,i;if("object"!=typeof t&&(t=[t]),ys(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{if(bs(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 Ls(t,e){if(bs(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 Fs="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,$s=t=>!vs(t)&&t!==Fs;const Bs=(qs="undefined"!=typeof Uint8Array&&hs(Uint8Array),t=>qs&&t instanceof qs);var qs;const Us=gs("HTMLFormElement"),Vs=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Gs=gs("RegExp"),zs=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};js(n,(n,i)=>{let o;!1!==(o=e(n,i,t))&&(r[i]=o||n)}),Object.defineProperties(t,r)};const Ws=gs("AsyncFunction"),Js=(Hs="function"==typeof setImmediate,Xs=Ss(Fs.postMessage),Hs?setImmediate:Xs?(Ks=`axios@${Math.random()}`,Ys=[],Fs.addEventListener("message",({source:t,data:e})=>{t===Fs&&e===Ks&&Ys.length&&Ys.shift()()},!1),t=>{Ys.push(t),Fs.postMessage(Ks,"*")}):t=>setTimeout(t));var Hs,Xs,Ks,Ys;const Zs="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Fs):"undefined"!=typeof process&&process.nextTick||Js,Qs={isArray:ys,isArrayBuffer:ws,isBuffer:bs,isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||Ss(t.append)&&("formdata"===(e=fs(t))||"object"===e&&Ss(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&ws(t.buffer),e},isString:xs,isNumber:Ts,isBoolean:t=>!0===t||!1===t,isObject:ks,isPlainObject:As,isEmptyObject:t=>{if(!ks(t)||bs(t))return!1;try{return 0===Object.keys(t).length&&Object.getPrototypeOf(t)===Object.prototype}catch(t){return!1}},isReadableStream:Ns,isRequest:Rs,isResponse:Ds,isHeaders:Ps,isUndefined:vs,isDate:Es,isFile:Os,isBlob:Cs,isRegExp:Gs,isFunction:Ss,isStream:t=>ks(t)&&Ss(t.pipe),isURLSearchParams:Is,isTypedArray:Bs,isFileList:Ms,forEach:js,merge:function t(){const{caseless:e,skipUndefined:n}=$s(this)&&this||{},r={},i=(i,o)=>{const s=e&&Ls(r,o)||o;As(r[s])&&As(i)?r[s]=t(r[s],i):As(i)?r[s]=t({},i):ys(i)?r[s]=i.slice():n&&vs(i)||(r[s]=i)};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&js(arguments[t],i);return r},extend:(t,e,n,{allOwnKeys:r}={})=>(js(e,(e,r)=>{n&&Ss(e)?Object.defineProperty(t,r,{value:cs(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&&hs(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:fs,kindOfTest:gs,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(ys(t))return t;let e=t.length;if(!Ts(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},forEachEntry:(t,e)=>{const n=(t&&t[ds]).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:Us,hasOwnProperty:Vs,hasOwnProp:Vs,reduceDescriptors:zs,freezeMethods:t=>{zs(t,(e,n)=>{if(Ss(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=t[n];Ss(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 ys(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:Ls,global:Fs,isContextDefined:$s,isSpecCompliantForm:function(t){return!!(t&&Ss(t.append)&&"FormData"===t[ps]&&t[ds])},toJSONObject:t=>{const e=new Array(10),n=(t,r)=>{if(ks(t)){if(e.indexOf(t)>=0)return;if(bs(t))return t;if(!("toJSON"in t)){e[r]=t;const i=ys(t)?[]:{};return js(t,(t,e)=>{const o=n(t,r+1);!vs(o)&&(i[e]=o)}),e[r]=void 0,i}}return t};return n(t,0)},isAsyncFn:Ws,isThenable:t=>t&&(ks(t)||Ss(t))&&Ss(t.then)&&Ss(t.catch),setImmediate:Js,asap:Zs,isIterable:t=>null!=t&&Ss(t[ds])};class ta extends Error{static from(t,e,n,r,i,o){const s=new ta(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:Qs.toJSONObject(this.config),code:this.code,status:this.status}}}ta.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",ta.ERR_BAD_OPTION="ERR_BAD_OPTION",ta.ECONNABORTED="ECONNABORTED",ta.ETIMEDOUT="ETIMEDOUT",ta.ERR_NETWORK="ERR_NETWORK",ta.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",ta.ERR_DEPRECATED="ERR_DEPRECATED",ta.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",ta.ERR_BAD_REQUEST="ERR_BAD_REQUEST",ta.ERR_CANCELED="ERR_CANCELED",ta.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",ta.ERR_INVALID_URL="ERR_INVALID_URL";const ea=ta;function na(t){return Qs.isPlainObject(t)||Qs.isArray(t)}function ra(t){return Qs.endsWith(t,"[]")?t.slice(0,-2):t}function ia(t,e,n){return t?t.concat(e).map(function(t,e){return t=ra(t),!n&&e?"["+t+"]":t}).join(n?".":""):e}const oa=Qs.toFlatObject(Qs,{},null,function(t){return/^is[A-Z]/.test(t)});const sa=function(t,e,n){if(!Qs.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const r=(n=Qs.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(t,e){return!Qs.isUndefined(e[t])})).metaTokens,i=n.visitor||c,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Qs.isSpecCompliantForm(e);if(!Qs.isFunction(i))throw new TypeError("visitor must be a function");function u(t){if(null===t)return"";if(Qs.isDate(t))return t.toISOString();if(Qs.isBoolean(t))return t.toString();if(!a&&Qs.isBlob(t))throw new ea("Blob is not supported. Use a Buffer instead.");return Qs.isArrayBuffer(t)||Qs.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(Qs.endsWith(n,"{}"))n=r?n:n.slice(0,-2),t=JSON.stringify(t);else if(Qs.isArray(t)&&function(t){return Qs.isArray(t)&&!t.some(na)}(t)||(Qs.isFileList(t)||Qs.endsWith(n,"[]"))&&(a=Qs.toArray(t)))return n=ra(n),a.forEach(function(t,r){!Qs.isUndefined(t)&&null!==t&&e.append(!0===s?ia([n],r,o):null===s?n:n+"[]",u(t))}),!1;return!!na(t)||(e.append(ia(i,n,o),u(t)),!1)}const l=[],h=Object.assign(oa,{defaultVisitor:c,convertValue:u,isVisitable:na});if(!Qs.isObject(t))throw new TypeError("data must be an object");return function t(n,r){if(!Qs.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),Qs.forEach(n,function(n,o){!0===(!(Qs.isUndefined(n)||null===n)&&i.call(e,n,Qs.isString(o)?o.trim():o,r,h))&&t(n,r?r.concat(o):[o])}),l.pop()}}(t),e};function aa(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}function ua(t,e){this._pairs=[],t&&sa(t,this,e)}const ca=ua.prototype;ca.append=function(t,e){this._pairs.push([t,e])},ca.toString=function(t){const e=t?function(e){return t.call(this,e,aa)}:aa;return this._pairs.map(function(t){return e(t[0])+"="+e(t[1])},"").join("&")};const la=ua;function ha(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function da(t,e,n){if(!e)return t;const r=n&&n.encode||ha,i=Qs.isFunction(n)?{serialize:n}:n,o=i&&i.serialize;let s;if(s=o?o(e,i):Qs.isURLSearchParams(e)?e.toString():new la(e,i).toString(r),s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t}const pa=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){Qs.forEach(this.handlers,function(e){null!==e&&t(e)})}},fa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ma={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:la,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},ga="undefined"!=typeof window&&"undefined"!=typeof document,_a="object"==typeof navigator&&navigator||void 0,ya=ga&&(!_a||["ReactNative","NativeScript","NS"].indexOf(_a.product)<0),va="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ba=ga&&window.location.href||"http://localhost",wa={...r,...ma};const xa=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&&Qs.isArray(r)?r.length:o,a)return Qs.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!s;r[o]&&Qs.isObject(r[o])||(r[o]=[]);return e(t,n,r[o],i)&&Qs.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(Qs.isFormData(t)&&Qs.isFunction(t.entries)){const n={};return Qs.forEachEntry(t,(t,r)=>{e(function(t){return Qs.matchAll(/\w+|\[(\w*)]/g,t).map(t=>"[]"===t[0]?"":t[1]||t[0])}(t),r,n,0)}),n}return null};const Sa={transitional:fa,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",r=n.indexOf("application/json")>-1,i=Qs.isObject(t);i&&Qs.isHTMLForm(t)&&(t=new FormData(t));if(Qs.isFormData(t))return r?JSON.stringify(xa(t)):t;if(Qs.isArrayBuffer(t)||Qs.isBuffer(t)||Qs.isStream(t)||Qs.isFile(t)||Qs.isBlob(t)||Qs.isReadableStream(t))return t;if(Qs.isArrayBufferView(t))return t.buffer;if(Qs.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 sa(t,new wa.classes.URLSearchParams,{visitor:function(t,e,n,r){return wa.isNode&&Qs.isBuffer(t)?(this.append(e,t.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...e})}(t,this.formSerializer).toString();if((o=Qs.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return sa(o?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||r?(e.setContentType("application/json",!1),function(t,e,n){if(Qs.isString(t))try{return(e||JSON.parse)(t),Qs.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||Sa.transitional,n=e&&e.forcedJSONParsing,r="json"===this.responseType;if(Qs.isResponse(t)||Qs.isReadableStream(t))return t;if(t&&Qs.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 ea.from(t,ea.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:wa.classes.FormData,Blob:wa.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Qs.forEach(["delete","get","head","post","put","patch"],t=>{Sa.headers[t]={}});const Ta=Sa,ka=Qs.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"]),Aa=Symbol("internals");function Ea(t){return t&&String(t).trim().toLowerCase()}function Oa(t){return!1===t||null==t?t:Qs.isArray(t)?t.map(Oa):String(t)}function Ca(t,e,n,r,i){return Qs.isFunction(r)?r.call(this,e,n):(i&&(e=n),Qs.isString(e)?Qs.isString(r)?-1!==e.indexOf(r):Qs.isRegExp(r)?r.test(e):void 0:void 0)}class Ma{constructor(t){t&&this.set(t)}set(t,e,n){const r=this;function i(t,e,n){const i=Ea(e);if(!i)throw new Error("header name must be a non-empty string");const o=Qs.findKey(r,i);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||e]=Oa(t))}const o=(t,e)=>Qs.forEach(t,(t,n)=>i(t,n,e));if(Qs.isPlainObject(t)||t instanceof this.constructor)o(t,e);else if(Qs.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]&&ka[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(Qs.isObject(t)&&Qs.isIterable(t)){let n,r,i={};for(const e of t){if(!Qs.isArray(e))throw TypeError("Object iterator must return a key-value pair");i[r=e[0]]=(n=i[r])?Qs.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=Ea(t)){const n=Qs.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(Qs.isFunction(e))return e.call(this,t,n);if(Qs.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=Ea(t)){const n=Qs.findKey(this,t);return!(!n||void 0===this[n]||e&&!Ca(0,this[n],n,e))}return!1}delete(t,e){const n=this;let r=!1;function i(t){if(t=Ea(t)){const i=Qs.findKey(n,t);!i||e&&!Ca(0,n[i],i,e)||(delete n[i],r=!0)}}return Qs.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&&!Ca(0,this[i],i,t,!0)||(delete this[i],r=!0)}return r}normalize(t){const e=this,n={};return Qs.forEach(this,(r,i)=>{const o=Qs.findKey(n,i);if(o)return e[o]=Oa(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]=Oa(r),n[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return Qs.forEach(this,(n,r)=>{null!=n&&!1!==n&&(e[r]=t&&Qs.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[Aa]=this[Aa]={accessors:{}}).accessors,n=this.prototype;function r(t){const r=Ea(t);e[r]||(!function(t,e){const n=Qs.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 Qs.isArray(t)?t.forEach(r):r(t),this}}Ma.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Qs.reduceDescriptors(Ma.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}}),Qs.freezeMethods(Ma);const Ia=Ma;function Na(t,e){const n=this||Ta,r=e||n,i=Ia.from(r.headers);let o=r.data;return Qs.forEach(t,function(t){o=t.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function Ra(t){return!(!t||!t.__CANCEL__)}const Da=class extends ea{constructor(t,e,n){super(null==t?"canceled":t,ea.ERR_CANCELED,e,n),this.name="CanceledError",this.__CANCEL__=!0}};function Pa(t,e,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?e(new ea("Request failed with status code "+n.status,[ea.ERR_BAD_REQUEST,ea.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}const ja=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 La=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)]},Fa=(t,e,n=3)=>{let r=0;const i=ja(50,250);return La(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)},$a=(t,e)=>{const n=null!=t;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Ba=t=>(...e)=>Qs.asap(()=>t(...e)),qa=wa.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,wa.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(wa.origin),wa.navigator&&/(msie|trident)/i.test(wa.navigator.userAgent)):()=>!0,Ua=wa.hasStandardBrowserEnv?{write(t,e,n,r,i,o,s){if("undefined"==typeof document)return;const a=[`${t}=${encodeURIComponent(e)}`];Qs.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),Qs.isString(r)&&a.push(`path=${r}`),Qs.isString(i)&&a.push(`domain=${i}`),!0===o&&a.push("secure"),Qs.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 Va(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 Ga=t=>t instanceof Ia?{...t}:t;function za(t,e){e=e||{};const n={};function r(t,e,n,r){return Qs.isPlainObject(t)&&Qs.isPlainObject(e)?Qs.merge.call({caseless:r},t,e):Qs.isPlainObject(e)?Qs.merge({},e):Qs.isArray(e)?e.slice():e}function i(t,e,n,i){return Qs.isUndefined(e)?Qs.isUndefined(t)?void 0:r(void 0,t,0,i):r(t,e,0,i)}function o(t,e){if(!Qs.isUndefined(e))return r(void 0,e)}function s(t,e){return Qs.isUndefined(e)?Qs.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(Ga(t),Ga(e),0,!0)};return Qs.forEach(Object.keys({...t,...e}),function(r){const o=u[r]||i,s=o(t[r],e[r],r);Qs.isUndefined(s)&&o!==a||(n[r]=s)}),n}const Wa=t=>{const e=za({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=e;if(e.headers=s=Ia.from(s),e.url=da(Va(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Qs.isFormData(n))if(wa.hasStandardBrowserEnv||wa.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(Qs.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(wa.hasStandardBrowserEnv&&(r&&Qs.isFunction(r)&&(r=r(e)),r||!1!==r&&qa(e.url))){const t=i&&o&&Ua.read(o);t&&s.set(i,t)}return e},Ja="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise(function(e,n){const r=Wa(t);let i=r.data;const o=Ia.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=Ia.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Pa(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 ea("Request aborted",ea.ECONNABORTED,t,m)),m=null)},m.onerror=function(e){const r=e&&e.message?e.message:"Network Error",i=new ea(r,ea.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||fa;r.timeoutErrorMessage&&(e=r.timeoutErrorMessage),n(new ea(e,i.clarifyTimeoutError?ea.ETIMEDOUT:ea.ECONNABORTED,t,m)),m=null},void 0===i&&o.setContentType(null),"setRequestHeader"in m&&Qs.forEach(o.toJSON(),function(t,e){m.setRequestHeader(e,t)}),Qs.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),h&&"json"!==h&&(m.responseType=r.responseType),p&&([u,l]=Fa(p,!0),m.addEventListener("progress",u)),d&&m.upload&&([a,c]=Fa(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(r.cancelToken||r.signal)&&(s=e=>{m&&(n(!e||e.type?new Da(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===wa.protocols.indexOf(_)?n(new ea("Unsupported protocol "+_+":",ea.ERR_BAD_REQUEST,t)):m.send(i||null)})},Ha=(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 ea?e:new Da(e instanceof Error?e.message:e))}};let o=e&&setTimeout(()=>{o=null,i(new ea(`timeout of ${e}ms exceeded`,ea.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=()=>Qs.asap(s),a}},Xa=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},Ka=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()}},Ya=(t,e,n,r)=>{const i=async function*(t,e){for await(const n of Ka(t))yield*Xa(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:Za}=Qs,Qa=(({Request:t,Response:e})=>({Request:t,Response:e}))(Qs.global),{ReadableStream:tu,TextEncoder:eu}=Qs.global,nu=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},ru=t=>{t=Qs.merge.call({skipUndefined:!0},Qa,t);const{fetch:e,Request:n,Response:r}=t,i=e?Za(e):"function"==typeof fetch,o=Za(n),s=Za(r);if(!i)return!1;const a=i&&Za(tu),u=i&&("function"==typeof eu?(c=new eu,t=>c.encode(t)):async t=>new Uint8Array(await new n(t).arrayBuffer()));var c;const l=o&&a&&nu(()=>{let t=!1;const e=new n(wa.origin,{body:new tu,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),h=s&&a&&nu(()=>Qs.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 ea(`Response type '${t}' is not supported`,ea.ERR_NOT_SUPPORT,n)})});const p=async(t,e)=>{const r=Qs.toFiniteNumber(t.getContentLength());return null==r?(async t=>{if(null==t)return 0;if(Qs.isBlob(t))return t.size;if(Qs.isSpecCompliantForm(t)){const e=new n(wa.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return Qs.isArrayBufferView(t)||Qs.isArrayBuffer(t)?t.byteLength:(Qs.isURLSearchParams(t)&&(t+=""),Qs.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}=Wa(t),w=e||fetch;_=_?(_+"").toLowerCase():"text";let x=Ha([u,c&&c.toAbortSignal()],f),S=null;const T=x&&x.unsubscribe&&(()=>{x.unsubscribe()});let k;try{if(g&&l&&"get"!==s&&"head"!==s&&0!==(k=await p(y,a))){let t,e=new n(i,{method:"POST",body:a,duplex:"half"});if(Qs.isFormData(a)&&(t=e.headers.get("content-type"))&&y.setContentType(t),e.body){const[t,n]=$a(k,Fa(Ba(g)));a=Ya(e.body,65536,t,n)}}Qs.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};S=o&&new n(i,u);let c=await(o?w(S,b):w(i,u));const f=h&&("stream"===_||"response"===_);if(h&&(m||f&&T)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=c[e]});const e=Qs.toFiniteNumber(c.headers.get("content-length")),[n,i]=m&&$a(e,Fa(Ba(m),!0))||[];c=new r(Ya(c.body,65536,n,()=>{i&&i(),T&&T()}),t)}_=_||"text";let A=await d[Qs.findKey(d,_)||"text"](c,t);return!f&&T&&T(),await new Promise((e,n)=>{Pa(e,n,{data:A,headers:Ia.from(c.headers),status:c.status,statusText:c.statusText,config:t,request:S})})}catch(e){if(T&&T(),e&&"TypeError"===e.name&&/Load failed|fetch/i.test(e.message))throw Object.assign(new ea("Network Error",ea.ERR_NETWORK,t,S),{cause:e.cause||e});throw ea.from(e,e&&e.code,t,S)}}},iu=new Map,ou=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=iu;for(;u--;)s=o[u],a=c.get(s),void 0===a&&c.set(s,a=u?new Map:ru(e)),c=a;return a},su=(ou(),{http:null,xhr:Ja,fetch:{get:ou}});Qs.forEach(su,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}});const au=t=>`- ${t}`,uu=t=>Qs.isFunction(t)||null===t||!1===t;const cu={getAdapter:function(t,e){t=Qs.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,!uu(r)&&(i=su[(n=String(r)).toLowerCase()],void 0===i))throw new ea(`Unknown adapter '${n}'`);if(i&&(Qs.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(au).join("\n"):" "+au(t[0]):"as no adapter specified";throw new ea("There is no suitable adapter to dispatch the request "+e,"ERR_NOT_SUPPORT")}return i},adapters:su};function lu(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Da(null,t)}function hu(t){lu(t),t.headers=Ia.from(t.headers),t.data=Na.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return cu.getAdapter(t.adapter||Ta.adapter,t)(t).then(function(e){return lu(t),e.data=Na.call(t,t.transformResponse,e),e.headers=Ia.from(e.headers),e},function(e){return Ra(e)||(lu(t),e&&e.response&&(e.response.data=Na.call(t,t.transformResponse,e.response),e.response.headers=Ia.from(e.response.headers))),Promise.reject(e)})}const du="1.13.4",pu={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{pu[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const fu={};pu.transitional=function(t,e,n){return(r,i,o)=>{if(!1===t)throw new ea(function(t,e){return"[Axios v"+du+"] Transitional option '"+t+"'"+e+(n?". "+n:"")}(i," has been removed"+(e?" in "+e:"")),ea.ERR_DEPRECATED);return e&&!fu[i]&&(fu[i]=!0),!t||t(r,i,o)}},pu.spelling=function(t){return(t,e)=>!0};const mu={assertOptions:function(t,e,n){if("object"!=typeof t)throw new ea("options must be an object",ea.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 ea("option "+o+" must be "+n,ea.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new ea("Unknown option "+o,ea.ERR_BAD_OPTION)}},validators:pu},gu=mu.validators;class _u{constructor(t){this.defaults=t||{},this.interceptors={request:new pa,response:new pa}}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=za(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:i}=e;void 0!==n&&mu.assertOptions(n,{silentJSONParsing:gu.transitional(gu.boolean),forcedJSONParsing:gu.transitional(gu.boolean),clarifyTimeoutError:gu.transitional(gu.boolean)},!1),null!=r&&(Qs.isFunction(r)?e.paramsSerializer={serialize:r}:mu.assertOptions(r,{encode:gu.function,serialize:gu.function},!0)),void 0!==e.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),mu.assertOptions(e,{baseUrl:gu.spelling("baseURL"),withXsrfToken:gu.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=i&&Qs.merge(i.common,i[e.method]);i&&Qs.forEach(["delete","get","head","post","put","patch","common"],t=>{delete i[t]}),e.headers=Ia.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=[hu.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=hu.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 da(Va((t=za(this.defaults,t)).baseURL,t.url,t.allowAbsoluteUrls),t.params,t.paramsSerializer)}}Qs.forEach(["delete","get","head","options"],function(t){_u.prototype[t]=function(e,n){return this.request(za(n||{},{method:t,url:e,data:(n||{}).data}))}}),Qs.forEach(["post","put","patch"],function(t){function e(e){return function(n,r,i){return this.request(za(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}_u.prototype[t]=e(),_u.prototype[t+"Form"]=e(!0)});const yu=_u;class vu{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 Da(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 vu(function(e){t=e}),cancel:t}}}const bu=vu;const wu={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(wu).forEach(([t,e])=>{wu[e]=t});const xu=wu;const Su=function t(e){const n=new yu(e),r=cs(yu.prototype.request,n);return Qs.extend(r,yu.prototype,n,{allOwnKeys:!0}),Qs.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return t(za(e,n))},r}(Ta);Su.Axios=yu,Su.CanceledError=Da,Su.CancelToken=bu,Su.isCancel=Ra,Su.VERSION=du,Su.toFormData=sa,Su.AxiosError=ea,Su.Cancel=Su.CanceledError,Su.all=function(t){return Promise.all(t)},Su.spread=function(t){return function(e){return t.apply(null,e)}},Su.isAxiosError=function(t){return Qs.isObject(t)&&!0===t.isAxiosError},Su.mergeConfig=za,Su.AxiosHeaders=Ia,Su.formToJSON=t=>xa(Qs.isHTMLForm(t)?new FormData(t):t),Su.getAdapter=cu.getAdapter,Su.HttpStatusCode=xu,Su.default=Su;const Tu=Su,ku=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in mediaplayer.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/mediaplayer.js"},{}),Au=t=>{const e=t[qg.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[qg.REFNODE]};return{leaflogic:(e,i)=>{const o=k_(i,e,void 0,r,{leaflogic:n,datalogic:{post:e=>(t[qg.mediaplayer.URI]=e,e)}})._control,s=new _t(ku),a=o._stream.pipe(at(...e.map(t=>t._stream)),ut(t=>{const e=t[1];return s.next(e),t[0]}));return{_stream:s,_control:{_stream:a}}},datalogic:{pre:t=>t,post:e=>Ug({element:{nodeuuid:t[qg.REFNODE],type:"mediaplayer",componentdata:{uri:t[qg.mediaplayer.URI],...t[qg.RTCONTEXT]}}},"screenio")}}},Eu=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in prompt.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/prompt.js"},{}),Ou=t=>{const e=t[qg.LAMBDA_OBJ],n="uidefs"in e&&"_default"in e.uidefs?e.uidefs._default:void 0,r=new dt,i={codebase:"ghostos/api/parser/nodelogic/elements/library/prompt.js",refnode:t[qg.REFNODE]};return{elementio$:r,leaflogic:(o,s)=>{const a=new dt,u=n?k_(s,o,void 0,i,{leaflogic:n,datalogic:{post:e=>(t[qg.prompt.UIDEFS]=e,e)}}):{_stream:He('[ ; 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}},c=u._control._stream.pipe(at(u._stream),ct(n=>{const i=n[1];t[qg.CTRLIN]=n[0];const o=e.margin?Object.keys(e.margin):void 0,s=e.fieldwidth?Object.keys(e.fieldwidth):void 0,a=Ue(i)&&"error"===i._bname?void 0:Array.isArray(i)?Ug({element:{nodeuuid:t[qg.REFNODE],type:"prompt",componentdata:{nodeuuid:t[qg.REFNODE],uidefs:i,margin:o?o[0]:1,fieldwidth:s?s[0]:"25ch",...t[qg.RTCONTEXT]}}},"screenio"):void 0;return a?Et(He(a),r):r}),ut(e=>(a.next(e),t[qg.CTRLIN])),ft());return{_stream:a.pipe(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Eu)),ut(t=>t),ft()),_control:{_stream:c.pipe(ut(t=>t),ft())}}},datalogic:{pre:t=>t,post:t=>t}}},Cu=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in popup.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/popup.js"},{}),Mu=t=>{const e=t[qg.LAMBDA_OBJ],n=new dt,r=new dt;return{elementio$:r,leaflogic:(i,o)=>{const s=o._stream.pipe(at(...i.map(t=>t._stream)),ct(t=>rn(new _t(t[0]),Et(new _t(t[1]),r))),ct(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(Ue(n)){if("screenio"===n._bname){const i=Tn("screenio",n);return Ug({element:{nodeuuid:t[qg.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 v_(n,[],{...t[qg.RTCONTEXT]._config}):[];return r.next(Sn("elementio",{element:"popup",nodeuuid:t[qg.REFNODE],io:{onclose:i}})),i},children:Array.isArray(i)?i:[i],...t[qg.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]),He(i[0])}));return{_stream:n.pipe(gt(t=>JSON.stringify(t)!==JSON.stringify(Cu)),ut(t=>t)),_control:{_stream:s}}},datalogic:{pre:t=>t,post:t=>t}}},Iu=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in editor.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/editor.js"},{}),Nu=t=>({leaflogic:(e,n)=>{const r=new _t(Iu),i=n._stream.pipe(Xe(n=>{t[qg.CTRLIN]=n;return rn([...e.map(t=>t._stream)])}),ut(e=>(e.length>1?r.next(e):1===e.length&&r.next(e[0]),t[qg.CTRLIN])));return{_stream:r,_control:{_stream:i}}},datalogic:{pre:t=>t,post:e=>Ug({element:{nodeuuid:t[qg.REFNODE],type:"editor",componentdata:{domain:t[qg.DOMAIN],appid:t[qg.APPID],...t[qg.RTCONTEXT]}}},"screenio")}}),Ru=t=>{const e=t[qg.LAMBDA_OBJ];return{leaflogic:(t,e)=>{const n=new dt,r=e._stream.pipe(at(...t.map(t=>t._stream)),ut(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="lambda"in e?"lambda":"dataflow";let i;Ue(n)&&n._content?._provenance?.refnodedata?(t[qg.RTCONTEXT].lambdarefnodedata=n._content?._provenance?.refnodedata,t[qg.RTCONTEXT].lambdasourceuuid=n._content?._refnode,i=n):i=n;return Ug({element:{nodeuuid:t[qg.REFNODE],type:"text",componentdata:{refnode:t[qg.REFNODE],textsource:r,lambdarefnodedata:t[qg.RTCONTEXT].lambdarefnodedata,lambdasourceuuid:t[qg.RTCONTEXT].lambdasourceuuid,dataflowinput:i,domain:t[qg.DOMAIN],appid:t[qg.APPID],...t[qg.RTCONTEXT]}}},"screenio")}}}},Du=t=>({leaflogic:(e,n)=>{const r=new dt,i=n._stream.pipe(at(...e.map(t=>t._stream)),ut(e=>{t[qg.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(Ue(t)&&"image"===t._bname)return Tn("image",t)}).filter(t=>t);return 1===e.length?e[0]:e.length>1?e:void 0},post:e=>Ug({element:{nodeuuid:t[qg.REFNODE],type:"image",componentdata:{imagelist:Array.isArray(e)?e:[e],...t[qg.RTCONTEXT]}}},"screenio")}});function Pu(t){return g(function(e,n){try{e.subscribe(n)}finally{n.add(t)}})}const ju=t=>{const e=t[qg.LAMBDA_OBJ],n=new dt;return{elementio$:n,leaflogic:(r,i)=>{const o=new dt,s=i._stream.pipe(at(...r.map(t=>t._stream)),ct(r=>{t[qg.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=Ug({element:{nodeuuid:t[qg.REFNODE],type:"mediainput",componentdata:{mediatype:a,nodeinput:c,callbacks:{onDropAccepted:async r=>{const i=e.ondrop?._default?await v_(e.ondrop._default,[Sn("elementinput",r),Sn("nodeinput",c)],{},t[qg.REFNODE]):void 0,o=Sn("elementio",i);n.next(o)}}}}},"screenio");return l?Et(new _t(l),n):n}),ct(e=>(o.next(e),new _t(t[qg.CTRLIN]))),ft());return{_stream:o.pipe(ut(t=>t),Pu(()=>{}),ft()),_control:{_stream:s.pipe(ut(t=>t),Pu(()=>{}),ft())}}},datalogic:{pre:t=>t,post:t=>{let e=t;return e=1===e.length?e[0]:e,e}}}};var Lu=n(7799);const{JZZ:Fu}=Lu,$u=t=>{const e=new dt;let n=-1;const r=t=>{n=(n+1)%24;const[r,i,o]=t;e.next(Sn("_midi_in",{cmd:r,noteNumber:i,velocity:o},{timestamp:Date.now()}))},i={};return{leaflogic:(n,o)=>{const s=new dt,a=o._stream.pipe(ct(o=>{t[qg.CTRLIN]=o,"default"in i||(i.default=Fu().openMidiIn().or("Error: Cannot open MIDI In port").and(t=>{}).connect(r));return Et(...n.map(t=>t._stream),e)}),ut(e=>{!Array.isArray(e)&&e._bname;const n=(Array.isArray(e)?e:[e]).map(t=>"_data_in"===t._bname?Ge(t._content)?void 0:Tn("*",t):Ue(t)?t:void 0).filter(t=>t);return n.length>0&&s.next(n),t[qg.CTRLIN]}),ft());return{_stream:s,_control:{_stream:a}}},datalogic:{pre:t=>Sn("_data_in",t),post:t=>{let e=t;e=1===e.length?e[0]:e;return e}}}},Bu="15.1.22";var qu=n(1795);const Uu=new WeakSet,Vu=new WeakMap,Gu=new WeakMap,zu=new WeakMap,Wu=new WeakMap,Ju=new WeakMap,Hu=new WeakMap,Xu=new WeakMap,Ku=new WeakMap,Yu=new WeakMap,Zu={construct:()=>Zu},Qu=/^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]*);?/,tc=(t,e)=>{const n=[];let r=t.replace(/^[\s]+/,""),i=r.match(Qu);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(Qu)}return[n.join(";"),r]},ec=t=>{if(void 0!==t&&!Array.isArray(t))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},nc=t=>{if(!(t=>{try{new new Proxy(t,Zu)}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.")},rc=(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},ic=(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},oc=(t,e,n,r)=>{const i=rc(t,e),o=ic(i,t=>t[0]===n&&t[1]===r);return 0===i.size&&t.delete(e),o},sc=t=>rc(Hu,t),ac=t=>{if(Uu.has(t))throw new Error("The AudioNode is already stored.");Uu.add(t),sc(t).forEach(t=>t(!0))},uc=t=>"port"in t,cc=t=>{if(!Uu.has(t))throw new Error("The AudioNode is not stored.");Uu.delete(t),sc(t).forEach(t=>t(!1))},lc=(t,e)=>{!uc(t)&&e.every(t=>0===t.size)&&cc(t)},hc={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},dc=(t,e)=>t.context===e,pc=t=>{try{t.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},fc=()=>new DOMException("","IndexSizeError"),mc=t=>{var e;t.getChannelData=(e=t.getChannelData,n=>{try{return e.call(t,n)}catch(t){if(12===t.code)throw fc();throw t}})},gc={numberOfChannels:1},_c=-34028234663852886e22,yc=-_c,vc=t=>Uu.has(t),bc={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},wc=t=>rc(Vu,t),xc=t=>rc(zu,t),Sc=(t,e)=>{const{activeInputs:n}=wc(t);n.forEach(n=>n.forEach(([n])=>{e.includes(t)||Sc(n,[...e,t])}));const r=(t=>"playbackRate"in t)(t)?[t.playbackRate]:uc(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=xc(t);void 0!==n&&n.activeInputs.forEach(([t])=>Sc(t,e))}vc(t)&&cc(t)},Tc=t=>{Sc(t.destination,[])},kc=t=>void 0===t||"number"==typeof t||"string"==typeof t&&("balanced"===t||"interactive"===t||"playback"===t),Ac=t=>"context"in t,Ec=t=>Ac(t[0]),Oc=(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},Cc=(t,e,[n,r],i)=>{Oc(t,[e,n,r],t=>t[0]===e&&t[1]===n,i)},Mc=(t,[e,n,r],i)=>{const o=t.get(e);void 0===o?t.set(e,new Set([[n,r]])):Oc(o,[n,r],t=>t[0]===n,i)},Ic=t=>"inputs"in t,Nc=(t,e,n,r)=>{if(Ic(e)){const i=e.inputs[r];return t.connect(i,n,0),[i,n,0]}return t.connect(e,n,r),[e,n,r]},Rc=(t,e,n)=>{for(const r of t)if(r[0]===e&&r[1]===n)return t.delete(r),r;return null},Dc=(t,e)=>{if(!sc(t).delete(e))throw new Error("Missing the expected event listener.")},Pc=(t,e,n)=>{const r=rc(t,e),i=ic(r,t=>t[0]===n);return 0===r.size&&t.delete(e),i},jc=(t,e,n,r)=>{Ic(e)?t.disconnect(e.inputs[r],n,0):t.disconnect(e,n,r)},Lc=t=>rc(Gu,t),Fc=t=>rc(Wu,t),$c=t=>Xu.has(t),Bc=t=>!Uu.has(t),qc=(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()}}),Uc=(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))},Vc=t=>"context"in t,Gc=t=>{const e=new Map;t.connect=(t=>(n,r=0,i=0)=>{const o=Vc(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=>{Vc(n)?t.connect(n,e.output,e.input):t.connect(n,e.output)})})(t.disconnect)},zc=(t,e,n,r)=>{const{activeInputs:i,passiveInputs:o}=xc(e),{outputs:s}=wc(t),a=sc(t),u=s=>{const a=Lc(t),u=Fc(e);if(s){const e=Pc(o,t,n);Cc(i,t,e,!1),r||$c(t)||a.connect(u,n)}else{const e=((t,e,n)=>ic(t,t=>t[0]===e&&t[1]===n))(i,t,n);Mc(o,e,!1),r||$c(t)||a.disconnect(u,n)}};return!!Oc(s,[e,n],t=>t[0]===e&&t[1]===n,!0)&&(a.add(u),vc(t)?Cc(i,t,[n,u],!0):Mc(o,[t,n,u],!0),!0)},Wc=(t,e,n,r,i)=>{const[o,s]=((t,e,n,r)=>{const{activeInputs:i,passiveInputs:o}=wc(e),s=Rc(i[r],t,n);if(null===s)return[oc(o,t,n,r)[2],!1];return[s[2],!0]})(t,n,r,i);if(null!==o&&(Dc(t,o),!s||e||$c(t)||jc(Lc(t),Lc(n),r,i)),vc(n)){const{activeInputs:t}=wc(n);lc(n,t)}},Jc=(t,e,n,r)=>{const[i,o]=((t,e,n)=>{const{activeInputs:r,passiveInputs:i}=xc(e),o=Rc(r,t,n);if(null===o)return[Pc(i,t,n)[1],!1];return[o[2],!0]})(t,n,r);null!==i&&(Dc(t,i),!o||e||$c(t)||Lc(t).disconnect(Fc(n),r))};class Hc{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 Xc={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}};function Kc(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 Yc=(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)},Zc=(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},Qc=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=wc(t),d=await((t,e)=>{const n=rc(Yu,t),r=Lc(e);return rc(n,r)})(n,t),p=Zc(r.numberOfInputs,r.channelCount),f=Zc(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)Kc(e,p[t],n,n,c);void 0!==o.parameterDescriptors&&null!==e&&o.parameterDescriptors.forEach(({name:t},n)=>{Kc(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)Yc(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},tl={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},el={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},nl={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},rl={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},il={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},ol=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()}})},sl={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},al=(t,e,n)=>{const r=e[n];if(void 0===r)throw t();return r},ul={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},cl={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},ll=()=>new DOMException("","InvalidStateError"),hl=()=>new DOMException("","InvalidAccessError"),dl={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},pl=(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},fl={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},ml=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},gl={numberOfChannels:1},_l=(t,e,n)=>{const r=e[n];void 0!==r&&r!==t[n]&&(t[n]=r)},yl=(t,e)=>{_l(t,e,"channelCount"),_l(t,e,"channelCountMode"),_l(t,e,"channelInterpretation")},vl=t=>"function"==typeof t.getFloatTimeDomainData,bl=(t,e,n)=>{const r=e[n];void 0!==r&&r!==t[n].value&&(t[n].value=r)},wl=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)},xl=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)})},Sl=(t,e)=>null===t?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(t*e))))),Tl=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)},kl=(t,e)=>{const n=t.createBiquadFilter();return yl(n,e),bl(n,e,"Q"),bl(n,e,"detune"),bl(n,e,"frequency"),bl(n,e,"gain"),_l(n,e,"type"),n},Al=(t,e)=>{const n=t.createChannelSplitter(e.numberOfOutputs);return yl(n,e),(t=>{const e=t.numberOfOutputs;Object.defineProperty(t,"channelCount",{get:()=>e,set:t=>{if(t!==e)throw ll()}}),Object.defineProperty(t,"channelCountMode",{get:()=>"explicit",set:t=>{if("explicit"!==t)throw ll()}}),Object.defineProperty(t,"channelInterpretation",{get:()=>"discrete",set:t=>{if("discrete"!==t)throw ll()}})})(n),n},El=(t,e)=>(t.connect=e.connect.bind(e),t.disconnect=e.disconnect.bind(e),t),Ol=(t,e)=>{const n=t.createDelay(e.maxDelayTime);return yl(n,e),bl(n,e,"delayTime"),n},Cl=(t,e)=>{const n=t.createGain();return yl(n,e),bl(n,e,"gain"),n};function Ml(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 Il(t,e){return[t[0]*e[0]-t[1]*e[1],t[0]*e[1]+t[1]*e[0]]}function Nl(t,e){let n=[0,0];for(let r=t.length-1;r>=0;r-=1)n=Il(n,e),n[0]+=t[r];return n}const Rl=(t,e,n,r)=>t.createScriptProcessor(e,n,r),Dl=()=>new DOMException("","NotSupportedError"),Pl={numberOfChannels:1},jl={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},Ll={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},Fl={disableNormalization:!1},$l={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},Bl=()=>new DOMException("","UnknownError"),ql={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},Ul=(t,e,n)=>void 0===t.copyFromChannel?t.getChannelData(n)[0]:(t.copyFromChannel(e,n),e[0]),Vl=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},Gl=(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)})},zl=(t,e,n)=>{try{t.setValueAtTime(e,n)}catch(r){if(9!==r.code)throw r;zl(t,e,n+1e-7)}},Wl=t=>{const e=t.createOscillator();try{e.start(-1)}catch(t){return t instanceof RangeError}return!1},Jl=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}},Hl=t=>{const e=t.createOscillator();try{e.stop(-1)}catch(t){return t instanceof RangeError}return!1},Xl=(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),El(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)},Kl=(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 Yl=(t=>(e,n,[r,i,o],s)=>{t(e[i],[n,r,o],t=>t[0]===n&&t[1]===r,s)})(Oc),Zl=(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)})(Oc),Ql=(t=>(e,n,r,i)=>t(e[i],t=>t[0]===n&&t[1]===r))(ic),th=new WeakMap,eh=(t=>e=>{var n;return null!==(n=t.get(e))&&void 0!==n?n:0})(th),nh=(rh=new Map,ih=new WeakMap,(t,e)=>{const n=ih.get(t);if(void 0!==n)return n;const r=rh.get(t);if(void 0!==r)return r;try{const n=e();return n instanceof Promise?(rh.set(t,n),n.catch(()=>!1).then(e=>(rh.delete(t),ih.set(t,e),e))):(ih.set(t,n),n)}catch{return ih.set(t,!1),!1}});var rh,ih;const oh="undefined"==typeof window?null:window,sh=((t,e)=>(n,r)=>{const i=n.createAnalyser();if(yl(i,r),!(r.maxDecibels>r.minDecibels))throw e();return _l(i,r,"fftSize"),_l(i,r,"maxDecibels"),_l(i,r,"minDecibels"),_l(i,r,"smoothingTimeConstant"),t(vl,()=>vl(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})(nh,fc),ah=(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})(wc),uh=((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],[]))})(wc,ah,$c),ch=((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(!dc(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)}}})(sh,Lc,uh),lh=(hh=Ju,t=>{const e=hh.get(t);if(void 0===e)throw ll();return e});var hh;const dh=(t=>null===t?null:t.hasOwnProperty("OfflineAudioContext")?t.OfflineAudioContext:t.hasOwnProperty("webkitOfflineAudioContext")?t.webkitOfflineAudioContext:null)(oh),ph=(t=>e=>null!==t&&e instanceof t)(dh),fh=new WeakMap,mh=(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)}})(Kl),gh=(t=>null===t?null:t.hasOwnProperty("AudioContext")?t.AudioContext:t.hasOwnProperty("webkitAudioContext")?t.webkitAudioContext:null)(oh),_h=(t=>e=>null!==t&&e instanceof t)(gh),yh=(t=>e=>null!==t&&"function"==typeof t.AudioNode&&e instanceof t.AudioNode)(oh),vh=(t=>e=>null!==t&&"function"==typeof t.AudioParam&&e instanceof t.AudioParam)(oh),bh=(t=>null===t?null:t.hasOwnProperty("AudioWorkletNode")?t.AudioWorkletNode:null)(oh),wh=((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(qc,()=>qc(s,m))&&Gc(i),Gu.set(this,i),Hu.set(this,new Set),"closed"!==e.state&&r&&ac(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(Ac(t)){const i=Lc(t);try{const e=Nc(this._nativeAudioNode,i,n,a),r=Bc(this);(h||r)&&this._nativeAudioNode.disconnect(...e),"closed"!==this.context.state&&!r&&Bc(t)&&ac(t)}catch(t){if(12===t.code)throw o();throw t}if(e(this,t,n,a,h)){const e=u([this],t);Uc(e,r(h))}return t}const m=Fc(t);if("playbackRate"===m.name&&1024===m.maxValue)throw s();try{this._nativeAudioNode.connect(m,n),(h||Bc(this))&&this._nativeAudioNode.disconnect(m,n)}catch(t){if(12===t.code)throw o();throw t}if(zc(this,t,n,h)){const e=u([this],t);Uc(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=wc(t),r=[];for(const i of n.outputs)Ec(i)?Wc(t,e,...i):Jc(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=wc(t),i=[];for(const o of r.outputs)o[1]===n&&(Ec(o)?Wc(t,e,...o):Jc(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(Ac(t)&&void 0!==n&&(n<0||n>=t.numberOfInputs))throw i();if(r=((t,e,n,r,i)=>{const o=wc(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=>(Ec(n)?Wc(t,e,...n):Jc(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);Uc(e,a)}}})((xh=Vu,(t,e,n)=>{const r=[];for(let t=0;t<n.numberOfInputs;t+=1)r.push(new Set);xh.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),S=o=>{const a=u(m),c=u(f);if(o){const e=oc(b,f,g,_);t(v,f,e,!1),y||h(f)||n(c,a,g,_),d(m)&&ac(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)&&lc(m,v);else{const t=p.get(m);void 0!==t&&clearTimeout(t),p.set(m,setTimeout(()=>{l(m)&&lc(m,v)},1e3*n))}}};return!!c(w,[m,g,_],t=>t[0]===m&&t[1]===g&&t[2]===_,!0)&&(x.add(S),l(f)?t(v,f,[g,_,S],!0):e(b,_,[f,g,S],!0),!0)}})(Yl,Zl,Nc,Ql,jc,wc,eh,sc,Lc,Oc,vc,$c,Bc),nh,((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(Ec(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)})(Xu,jc,wc,Lc,Fc,vc),fc,hl,Dl,((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(Ec(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)})(Nc,Xu,wc,Lc,Fc,lh,vc,ph),((t,e,n)=>function r(i,o){const s=Ac(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),[])})(fh,wc,rc),mh,lh,_h,yh,vh,ph,bh);var xh;const Sh=((t,e,n,r,i,o)=>class extends t{constructor(t,n){const s=i(t),a={...hc,...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)}})(wh,ch,fc,sh,lh,ph),Th=new WeakSet,kh=(t=>null===t?null:t.hasOwnProperty("AudioBuffer")?t.AudioBuffer:null)(oh),Ah=(Eh=new Uint32Array(1),t=>(Eh[0]=t,Eh[0]));var Eh;const Oh=((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]}})(Ah,fc),Ch=(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)})(Ah),Mh=((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}={...gc,...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),mc(p)):e(pc,()=>pc(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)}}})(Th,nh,Dl,kh,dh,(t=>()=>{if(null===t)return!1;try{new t({length:1,sampleRate:44100})}catch{return!1}return!0})(kh),Oh,Ch),Ih=(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)})(Cl),Nh=((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)}))})(ah,xc,$c),Rh=(t=>(e,n,r)=>t(n,e,r))(Nh),Dh=((t,e,n,r,i,o,s,a,u,c,l)=>(h,d)=>{const p=h.createBufferSource();return yl(p,d),bl(p,d,"playbackRate"),_l(p,d,"buffer"),_l(p,d,"loop"),_l(p,d,"loopEnd"),_l(p,d,"loopStart"),e(n,()=>n(h))||(t=>{t.start=(e=>{let n=!1;return(r=0,i=0,o)=>{if(n)throw ll();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))||wl(p),e(s,()=>s(h))||l(p,h),e(a,()=>a(h))||xl(p),t(h,p),p})(Ih,nh,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},Wl,Jl,Hl,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))})(Gl),Xl),Ph=((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})(xc),Nh),jh=((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=dc(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)}}})(Rh,Dh,Lc,Ph,uh),Lh=((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 qu.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})((Fh=zu,(t,e)=>{Fh.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:e})}),fh,Wu,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)}}}}),qu.createCancelAndHoldAutomationEvent,qu.createCancelScheduledValuesAutomationEvent,qu.createExponentialRampToValueAutomationEvent,qu.createLinearRampToValueAutomationEvent,qu.createSetTargetAutomationEvent,qu.createSetValueAutomationEvent,qu.createSetValueCurveAutomationEvent,gh,zl);var Fh;const $h=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,r){const a=o(t),u={...bc,...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,yc,_c)}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){ac(this);const t=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",t),vc(this)&&cc(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeAudioBufferSourceNode.stop(t),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.stop=t)}})(wh,jh,Lh,ll,Dh,lh,ph,Kl),Bh=((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}})(wh,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)}}},fc,ll,((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})(Cl,Gl),lh,ph,uh),qh=((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=dc(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)}}})(Rh,kl,Lc,Ph,uh),Uh=(t=>(e,n)=>t.set(e,n))(th),Vh=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,r){const u=o(t),c={...tl,...r},l=i(u,c),h=s(u);super(t,!1,l,h?n():null),this._Q=e(this,h,l.Q,yc,_c),this._detune=e(this,h,l.detune,1200*Math.log2(yc),-1200*Math.log2(yc)),this._frequency=e(this,h,l.frequency,t.sampleRate/2,0),this._gain=e(this,h,l.gain,40*Math.log10(yc),_c),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()}})(wh,Lh,qh,hl,kl,lh,ph,Uh),Gh=((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})(Oc,yh),zh=((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))})(ll,Gh),Wh=((t,e)=>(n,r)=>{const i=n.createChannelMerger(r.numberOfInputs);return null!==t&&"webkitAudioContext"===t.name&&e(n,i),yl(i,r),i})(gh,zh),Jh=((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(!dc(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)}}})(Wh,Lc,uh),Hh=((t,e,n,r,i)=>class extends t{constructor(t,o){const s=r(t),a={...el,...o};super(t,!1,n(s,a),i(s)?e():null)}})(wh,Jh,Wh,lh,ph),Xh=((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(!dc(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)}}})(Al,Lc,uh),Kh=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u=o({...nl,...s});super(t,!1,n(a,u),i(a)?e():null)}})(wh,Xh,Al,lh,ph,t=>({...t,channelCount:t.numberOfOutputs})),Yh=((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(El(h,c),()=>u.connect(c),()=>u.disconnect(c))})(Ih,Dh,Cl,Gh),Zh=((t,e,n,r,i)=>(o,s)=>{if(void 0===o.createConstantSource)return n(o,s);const a=o.createConstantSource();return yl(a,s),bl(a,s,"offset"),e(r,()=>r(o))||wl(a),e(i,()=>i(o))||xl(a),t(o,a),a})(Ih,nh,Yh,Wl,Hl),Qh=((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=dc(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)}}})(Rh,Zh,Lc,Ph,uh),td=((t,e,n,r,i,o,s)=>class extends t{constructor(t,s){const a=i(t),u={...rl,...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,yc,_c),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){ac(this);const t=()=>{this._nativeConstantSourceNode.removeEventListener("ended",t),vc(this)&&cc(this)};this._nativeConstantSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeConstantSourceNode.stop(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.stop=t)}})(wh,Lh,Qh,Zh,lh,ph,Kl),ed=((t,e)=>(n,r)=>{const i=n.createConvolver();if(yl(i,r),r.disableNormalization===i.normalize&&(i.normalize=!r.disableNormalization),_l(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})(Dl,Gl),nd=((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(!dc(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),Ic(s)?await n(i,o,s.inputs[0]):await n(i,o,s),s})(i,o)}}})(ed,Lc,uh),rd=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u={...il,...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}})(wh,nd,ed,lh,ph,Uh),id=((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=dc(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)}}})(Rh,Ol,Lc,Ph,uh),od=((t,e,n,r,i,o,s)=>class extends t{constructor(t,a){const u=i(t),c={...sl,...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}})(wh,Lh,id,Ol,lh,ph,Uh),sd=(t=>(e,n)=>{const r=e.createDynamicsCompressor();if(yl(r,n),n.channelCount>2)throw t();if("max"===n.channelCountMode)throw t();return bl(r,n,"attack"),bl(r,n,"knee"),bl(r,n,"ratio"),bl(r,n,"release"),bl(r,n,"threshold"),r})(Dl),ad=((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=dc(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)}}})(Rh,sd,Lc,Ph,uh),ud=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,i){const u=o(t),c={...ul,...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}})(wh,Lh,ad,sd,Dl,lh,ph,Uh),cd=((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=dc(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)}}})(Rh,Cl,Lc,Ph,uh),ld=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=i(t),u={...cl,...s},c=r(a,u),l=o(a);super(t,!1,c,l?n():null),this._gain=e(this,l,c.gain,yc,_c)}get gain(){return this._gain}})(wh,Lh,cd,Cl,lh,ph),hd=((t,e,n,r)=>(i,o,{channelCount:s,channelCountMode:a,channelInterpretation:u,feedback:c,feedforward:l})=>{const h=Sl(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]=pl(d,f,p,m,g,v[t],b[t],y[t],32,r,i)}};const w=i.sampleRate/2;return El({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=Ml(Nl(p,o),Nl(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])},_)})(hl,ll,Rl,Dl),dd=((t,e,n,r)=>i=>t(ml,()=>ml(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()}))(nh,Cl,Rl,((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()})})(Cl,dh)),pd=((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=dc(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),pl(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)}}})(Dh,Lc,dh,uh,dd),fd=(t=>(e,n,r)=>{if(void 0===e.createIIRFilter)return t(e,n,r);const i=e.createIIRFilter(r.feedforward,r.feedback);return yl(i,r),i})(hd),md=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u=i(a),c={...dl,...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 hl();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)}})(wh,fd,pd,lh,ph,Uh),gd=((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,yc,_c);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}}})(Lh,Wh,Zh,Rl,Dl,Ul,ph,Gl),_d=new WeakMap,yd=((t,e,n,r,i,o)=>class extends n{constructor(n,o){super(n),this._nativeContext=n,Ju.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}})(Bh,gd,mh,ph,_d,Kl),vd=((t,e,n,r,i,o)=>(s,a)=>{const u=s.createOscillator();return yl(u,a),bl(u,a,"detune"),bl(u,a,"frequency"),void 0!==a.periodicWave?u.setPeriodicWave(a.periodicWave):_l(u,a,"type"),e(n,()=>n(s))||wl(u),e(r,()=>r(s))||o(u,s),e(i,()=>i(s))||xl(u),t(s,u),u})(Ih,nh,Wl,Jl,Hl,Xl),bd=((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=dc(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)}}})(Rh,vd,Lc,Ph,uh),wd=((t,e,n,r,i,o,s)=>class extends t{constructor(t,s){const a=i(t),u={...jl,...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){ac(this);const t=()=>{this._nativeOscillatorNode.removeEventListener("ended",t),vc(this)&&cc(this)};this._nativeOscillatorNode.addEventListener("ended",t)}}stop(t=0){this._nativeOscillatorNode.stop(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.stop=t)}})(wh,Lh,vd,bd,lh,ph,Kl),xd=(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)}})(Dh),Sd=((t,e,n,r,i)=>(o,{curve:s,oversample:a,...u})=>{const c=o.createWaveShaper(),l=o.createWaveShaper();yl(c,u),yl(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(El(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)})})(xd,ll,Cl,Vl,Gh),Td=((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);yl(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();_l(c,{curve:l},"curve"),_l(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)})})(xd,ll,Sd,Vl,Gh,gh,Gl),kd=((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:S,rolloffFactor:T,...k})=>{const A=l.createPanner();if(k.channelCount>2)throw s();if("max"===k.channelCountMode)throw s();yl(A,k);const E={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},O=n(l,{...E,channelInterpretation:"speakers",numberOfInputs:6}),C=r(l,{...k,gain:1}),M=r(l,{...E,gain:1}),I=r(l,{...E,gain:0}),N=r(l,{...E,gain:0}),R=r(l,{...E,gain:0}),D=r(l,{...E,gain:0}),P=r(l,{...E,gain:0}),j=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);j.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(I.gain,"defaultValue",{get:()=>0}),Object.defineProperty(N.gain,"defaultValue",{get:()=>0}),Object.defineProperty(R.gain,"defaultValue",{get:()=>0}),Object.defineProperty(D.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 I.gain},get orientationZ(){return N.gain},get panningModel(){return A.panningModel},set panningModel(t){A.panningModel=t},get positionX(){return R.gain},get positionY(){return D.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),S!==q.refDistance&&(q.refDistance=S),T!==q.rolloffFactor&&(q.rolloffFactor=T),1===F[0]&&0===F[1]&&0===F[2]||A.setOrientation(...F),0===$[0]&&0===$[1]&&0===$[2]||A.setPosition(...$);return c(El(q,A),()=>{C.connect(A),t(C,L,0,0),L.connect(M).connect(O,0,0),L.connect(I).connect(O,0,1),L.connect(N).connect(O,0,2),L.connect(R).connect(O,0,3),L.connect(D).connect(O,0,4),L.connect(P).connect(O,0,5),O.connect(j).connect(l.destination)},()=>{C.disconnect(A),a(C,L,0,0),L.disconnect(M),M.disconnect(O),L.disconnect(I),I.disconnect(O),L.disconnect(N),N.disconnect(O),L.disconnect(R),R.disconnect(O),L.disconnect(D),D.disconnect(O),L.disconnect(P),P.disconnect(O),O.disconnect(j),j.disconnect(l.destination)})})(Nc,ll,Wh,Cl,Rl,Td,Dl,jc,Ul,Gh),Ad=(t=>(e,n)=>{const r=e.createPanner();return void 0===r.orientationX?t(e,n):(yl(r,n),bl(r,n,"orientationX"),bl(r,n,"orientationY"),bl(r,n,"orientationZ"),bl(r,n,"positionX"),bl(r,n,"positionY"),bl(r,n,"positionZ"),_l(r,n,"coneInnerAngle"),_l(r,n,"coneOuterAngle"),_l(r,n,"coneOuterGain"),_l(r,n,"distanceModel"),_l(r,n,"maxDistance"),_l(r,n,"panningModel"),_l(r,n,"refDistance"),_l(r,n,"rolloffFactor"),r)})(kd),Ed=((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=dc(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)),Ic(m)?await u(d,p,m.inputs[0]):await u(d,p,m),m})(d,p)}}})(Rh,Wh,Zh,Cl,Ad,Lc,dh,Ph,uh,dd),Od=((t,e,n,r,i,o,s)=>class extends t{constructor(t,a){const u=i(t),c={...Ll,...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,yc,_c),this._orientationY=e(this,h,l.orientationY,yc,_c),this._orientationZ=e(this,h,l.orientationZ,yc,_c),this._positionX=e(this,h,l.positionX,yc,_c),this._positionY=e(this,h,l.positionY,yc,_c),this._positionZ=e(this,h,l.positionZ,yc,_c),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}})(wh,Lh,Ad,Ed,lh,ph,Uh),Cd=(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})(fc),Md=((t,e,n,r)=>class i{constructor(i,o){const s=e(i),a=r({...Fl,...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)}})(Cd,lh,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}}),Id=((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}),S=n(t,{...c,gain:0}),T=r(t,{...l,curve:f}),k=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(S,1),_.connect(k,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===T.inputs?T:T.inputs[0]),o.connect(void 0===A.inputs?A:A.inputs[0]),v.connect(y.gain),w.connect(b.gain),T.connect(S.gain),A.connect(k.gain),y.connect(h,0,0),S.connect(h,0,0),b.connect(h,0,1),k.connect(h,0,1)},disconnectGraph(){i.disconnect(_),i.disconnect(void 0===x.inputs?x:x.inputs[0]),_.disconnect(y,0),_.disconnect(b,0),_.disconnect(S,1),_.disconnect(k,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===T.inputs?T:T.inputs[0]),o.disconnect(void 0===A.inputs?A:A.inputs[0]),v.disconnect(y.gain),w.disconnect(b.gain),T.disconnect(S.gain),A.disconnect(k.gain),y.disconnect(h,0,0),S.disconnect(h,0,0),b.disconnect(h,0,1),k.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(El(m,c),()=>{p(),g=!0},()=>{f(),g=!1})}})(Wh,Al,Cl,Td,Dl,Gh),Nd=((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 yl(o,r),bl(o,r,"pan"),Object.defineProperty(o,"channelCountMode",{get:()=>i,set:t=>{if(t!==i)throw e()}}),o})(Id,Dl),Rd=((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=dc(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),Ic(u)?await i(s,a,u.inputs[0]):await i(s,a,u),u})(s,a)}}})(Rh,Nd,Lc,Ph,uh),Dd=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=i(t),u={...$l,...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}})(wh,Lh,Nd,Rd,lh,ph),Pd=((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(!dc(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),Ic(s)?await n(i,o,s.inputs[0]):await n(i,o,s),s})(i,o)}}})(Td,Lc,uh),jd=((t,e,n,r,i,o,s)=>class extends t{constructor(t,e){const a=i(t),u={...ql,...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}})(wh,ll,Td,Pd,lh,ph,Uh),Ld=(t=>null!==t&&t.isSecureContext)(oh),Fd=(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)}})(oh),$d=new WeakMap,Bd=((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})($d,dh),qd=Ld?((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]=tc(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=Ku.get(v);if(void 0!==r){if(r.has(t))throw e();nc(n),ec(n.parameterDescriptors),r.set(t,n)}else nc(n),ec(n.parameterDescriptors),Ku.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]=tc(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}})(nh,Dl,(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)}}))(oh),Fd,(t=>async e=>{try{const t=await fetch(e);if(t.ok)return[await t.text(),t.url]}catch{}throw t()})(()=>new DOMException("","AbortError")),lh,Bd,ph,bh,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})(bh,dh),oh):void 0,Ud=((t,e)=>n=>t(n)||e(n))(_h,ph),Vd=((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=>(ol(d).catch(()=>{}),e(a,()=>a(n))||l(n),t.add(n),n)):new Promise((e,n)=>{const i=async()=>{try{await ol(d)}catch{}},o=t=>{n(t),i()};try{p.decodeAudioData(d,n=>{"function"!=typeof n.copyFromChannel&&(c(n),mc(n)),t.add(n),i().then(()=>e(n))},t=>{o(null===t?r():t)})}catch(t){o(t)}})})(Th,nh,()=>new DOMException("","DataCloneError"),()=>new DOMException("","EncodingError"),new WeakSet,lh,Ud,pc,ml,Oh,Ch),Gd=((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})}})(qd,Sh,Mh,$h,Vh,Hh,Kh,td,rd,Vd,od,ud,ld,md,yd,wd,Od,Md,Dd,jd),zd=((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}})(wh,(t,e)=>t.createMediaElementSource(e.mediaElement),lh,ph),Wd=((t,e,n,r)=>class extends t{constructor(t,i){const o=n(t);if(r(o))throw new TypeError;const s={...fl,...i},a=e(o,s);super(t,!1,a,null),this._nativeMediaStreamAudioDestinationNode=a}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}})(wh,(t,e)=>{const n=t.createMediaStreamDestination();return yl(n,e),1===n.numberOfOutputs&&Object.defineProperty(n,"numberOfOutputs",{get:()=>0}),n},lh,ph),Jd=((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}})(wh,(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},lh,ph),Hd=((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})(ll,ph),Xd=((t,e,n)=>class extends t{constructor(t,r){const i=n(t);super(t,!0,e(i,r),null)}})(wh,Hd,lh),Kd=((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(!kc(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()),Tc(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})}})(Gd,ll,Dl,Bl,zd,Wd,Jd,Xd,gh),Yd=(t=>e=>{const n=t.get(e);if(void 0===n)throw new Error("The context has no set of AudioWorkletNodes.");return n})(_d),Zd=(t=>(e,n)=>{t(e).add(n)})(Yd),Qd=(t=>(e,n,r=0,i=0)=>{const o=e[r];if(void 0===o)throw t();return Vc(n)?o.connect(n,0,i):o.connect(n,0)})(fc),tp=(t=>(e,n)=>{t(e).delete(n)})(Yd),ep=(t=>(e,n=void 0,r=void 0,i=0)=>void 0===n?e.forEach(t=>t.disconnect()):"number"==typeof n?al(t,e,n).disconnect():Vc(n)?void 0===r?e.forEach(t=>t.disconnect(n)):void 0===i?al(t,e,r).disconnect(n,0):al(t,e,r).disconnect(n,0,i):void 0===r?e.forEach(t=>t.disconnect(n)):al(t,e,r).disconnect(n,0))(fc),np=new WeakMap,rp=((t,e)=>n=>e(t,n))(np,rc),ip=((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=[],S=[];for(let t=0;t<g.numberOfInputs;t+=1)x.push(s(p,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1})),S.push(i(p,{channelCount:g.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:g.channelCount}));const T=[];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?yc:e},minValue:{get:()=>void 0===n?_c:n}}),T.push(i)}const k=r(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,y+b)}),A=Sl(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(S[t]);for(let e=0;e<g.channelCount;e+=1)S[t].connect(k,e,t*g.channelCount+e)}const M=new Hc(void 0===m.parameterDescriptors?[]:m.parameterDescriptors.map(({name:t},e)=>{const n=T[e];return n.connect(k,0,y+e),n.start(0),[t,n.offset]}));k.connect(E);let I=g.channelInterpretation,N=null;const R=0===g.numberOfOutputs?[E]:C,D={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 I},set channelInterpretation(t){for(const e of x)e.channelInterpretation=t;I=t},get context(){return E.context},get inputs(){return x},get numberOfInputs(){return g.numberOfInputs},get numberOfOutputs(){return g.numberOfOutputs},get onprocessorerror(){return N},set onprocessorerror(t){"function"==typeof N&&D.removeEventListener("processorerror",N),N="function"==typeof t?t:null,"function"==typeof N&&D.addEventListener("processorerror",N)},get parameters(){return M},get port(){return w.port2},addEventListener:(...t)=>E.addEventListener(t[0],t[1],t[2]),connect:t.bind(null,R),disconnect:c.bind(null,R),dispatchEvent:(...t)=>E.dispatchEvent(t[0]),removeEventListener:(...t)=>E.removeEventListener(t[0],t[1],t[2])},P=new Map;var j,L;w.port1.addEventListener=(j=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 j.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=Yu.get(t);void 0===i&&(i=new WeakMap,Yu.set(t,i));const o=Tl(n,r);return i.set(e,o),o})(p,D,m,g);B.then(t=>$=t);const q=Zc(g.numberOfInputs,g.channelCount),U=Zc(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(D);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)Kc(t,q[e],n,n,r);void 0!==m.parameterDescriptors&&m.parameterDescriptors.forEach(({name:e},n)=>{Kc(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)Yc(e,U[t],i,n+i,r);n+=_[t]}}catch(t){G=!1,D.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(S[t]);for(let e=0;e<g.channelCount;e+=1)S[r].disconnect(k,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=T[e];t.disconnect(k,0,y+e),t.stop()}}k.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(D,()=>{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})})(Qd,fc,ll,Wh,Al,Zh,Cl,Rl,Dl,ep,Fd,rp,Gh),op=((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)})(ll,ip,Cl,Dl,Gh),sp=((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 S=v.get(x);return void 0!==S?Promise.resolve(S):(async(a,w)=>{let x=l(a),S=null;const T=dc(x,w),k=Array.isArray(_.outputChannelCount)?_.outputChannelCount:Array.from(_.outputChannelCount);if(null===h){const t=k.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:k[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),S=[n,o,c]}else T||(x=new h(w,g));if(v.set(w,null===S?x:S[2]),null!==S){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=Qc(a,0===n?null:await u(),w,_,k,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]=S;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<k[t];r+=1)u.connect(n,e+r,r);e+=k[t]}return h}if(T)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)}}})(Rh,Qd,Dh,Wh,Al,Zh,Cl,tp,ep,Fd,Lc,bh,dh,Ph,uh,dd),ap=(t=>e=>t.get(e))($d),up=(t=>(e,n)=>{t.set(e,n)})(np),cp=Ld?((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({...Xc,...f});d(y);const v=Ku.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 S=[];x.parameters.forEach((t,e)=>{const r=n(this,_,t);S.push([e,r])}),this._nativeAudioWorkletNode=x,this._onprocessorerror=null,this._parameters=new Hc(S),_&&t(g,this);const{activeInputs:T}=o(this);h(x,T)}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}})(Zd,wh,Lh,sp,op,wc,ap,lh,ph,bh,t=>({...t,outputChannelCount:void 0!==t.outputChannelCount?t.outputChannelCount:1===t.numberOfInputs&&1===t.numberOfOutputs?[t.channelCount]:Array.from({length:t.numberOfOutputs},()=>1)}),up,t=>{const{port1:e,port2:n}=new MessageChannel;try{e.postMessage(t)}finally{e.close(),n.close()}},Kl):void 0,lp=(((t,e,n,r,i)=>{})(ll,Dl,Bl,yd,gh),((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}})(Dl,dh)),hp=((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),mc(n)):e(o,()=>o(n))||a(n),t.add(n),n)))(Th,nh,ah,Yd,dd,pc,Oh,Ch),dp=(((t,e,n,r,i)=>{})(nh,ll,lp,yd,hp),((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}={...Pl,...o},c=r(a,s,u);e(ml,()=>ml(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,Tc(this)}))}_waitForThePromiseToSettle(t){null===this._state?this._nativeOfflineAudioContext.dispatchEvent(t):setTimeout(()=>this._waitForThePromiseToSettle(t))}})(Gd,nh,ll,lp,hp)),pp=((t,e)=>n=>{const r=t.get(n);return e(r)||e(n)})(Ju,_h),fp=((t,e)=>n=>t.has(n)||e(n))(Gu,yh),mp=((t,e)=>n=>t.has(n)||e(n))(Wu,vh),gp=((t,e)=>n=>{const r=t.get(n);return e(r)||e(n)})(Ju,ph);function _p(t){return void 0===t}function yp(t){return void 0!==t}function vp(t){return"number"==typeof t}function bp(t){return"[object Object]"===Object.prototype.toString.call(t)&&t.constructor===Object}function wp(t){return"boolean"==typeof t}function xp(t){return Array.isArray(t)}function Sp(t){return"string"==typeof t}function Tp(t){return Sp(t)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(t)}function kp(t,e){if(!t)throw new Error(e)}function Ap(t,e,n=1/0){if(!(e<=t&&t<=n))throw new RangeError(`Value must be within [${e}, ${n}], got: ${t}`)}function Ep(t){t.isOffline||"running"===t.state||Np('The AudioContext is "suspended". Invoke Tone.start() from a user action to start the audio.')}let Op=!1,Cp=!1;function Mp(t){Op=t}let Ip=console;function Np(...t){Ip.warn(...t)}const Rp="object"==typeof self?self:null,Dp=Rp&&(Rp.hasOwnProperty("AudioContext")||Rp.hasOwnProperty("webkitAudioContext"));class Pp{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()}}function jp(t){return mp(t)}function Lp(t){return fp(t)}function Fp(t){return gp(t)}function $p(t){return pp(t)}function Bp(t,e){return"value"===t||jp(e)||Lp(e)||function(t){return t instanceof Mh}(e)}function qp(t,...e){if(!e.length)return t;const n=e.shift();if(bp(t)&&bp(n))for(const e in n)Bp(e,n[e])?t[e]=n[e]:bp(n[e])?(t[e]||Object.assign(t,{[e]:{}}),qp(t[e],n[e])):Object.assign(t,{[e]:n[e]});return qp(t,...e)}function Up(t,e,n=[],r){const i={},o=Array.from(e);if(bp(o[0])&&r&&!Reflect.has(o[0],r)){Object.keys(o[0]).some(e=>Reflect.has(t,e))||(qp(i,{[r]:o[0]}),n.splice(n.indexOf(r),1),o.shift())}if(1===o.length&&bp(o[0]))qp(i,o[0]);else for(let t=0;t<n.length;t++)yp(o[t])&&(i[n[t]]=o[t]);return qp(t,i)}function Vp(t,e){return _p(t)?e:t}function Gp(t,e){return e.forEach(e=>{Reflect.has(t,e)&&delete t[e]}),t}class zp{constructor(){this.debug=!1,this._wasDisposed=!1}static getDefaults(){return{}}log(...t){(this.debug||Rp&&this.toString()===Rp.TONE_DEBUG_CLASS)&&function(...t){Ip.log(...t)}(this,...t)}dispose(){return this._wasDisposed=!0,this}get disposed(){return this._wasDisposed}toString(){return this.name}}zp.version=Bu;const Wp=1e-6;function Jp(t,e){return t>e+Wp}function Hp(t,e){return Jp(t,e)||Kp(t,e)}function Xp(t,e){return t+Wp<e}function Kp(t,e){return Math.abs(t-e)<Wp}function Yp(t,e,n){return Math.max(Math.min(t,n),e)}class Zp extends zp{constructor(){super(),this.name="Timeline",this._timeline=[];const t=Up(Zp.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(kp(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];kp(Hp(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(Kp(this._timeline[e].time,t)){for(let n=e;n>=0&&Kp(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&&Hp(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(Kp(o[e],t)){for(let n=r;n<this._timeline.length;n++){if(!Kp(this._timeline[n][e],t))break;r=n}return r}if(Xp(o[e],t)&&Jp(s[e],t))return r;Jp(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&&Kp(this._timeline[n].time,t)){let r=n;for(let e=n;e>=0&&Kp(this._timeline[e].time,t);e--)r=e;this._iterate(t=>{e(t)},r,n)}return this}dispose(){return super.dispose(),this._timeline=[],this}}const Qp=[];function tf(t){Qp.push(t)}const ef=[];function nf(t){ef.push(t)}class rf extends zp{constructor(){super(...arguments),this.name="Emitter"}on(t,e){return t.split(/\W+/).forEach(t=>{_p(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(_p(this._events)&&(this._events={}),this._events.hasOwnProperty(t))if(_p(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(rf.prototype,e);Object.defineProperty(t.prototype,e,n)})}dispose(){return super.dispose(),this._events=void 0,this}}class of extends rf{constructor(){super(...arguments),this.isOffline=!1}toJSON(){return{}}}class sf extends of{constructor(){var t,e;super(),this.name="Context",this._constants=new Map,this._timeouts=new Zp,this._timeoutIds=0,this._initialized=!1,this._closeStarted=!1,this.isOffline=!1,this._workletPromise=null;const n=Up(sf.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 Kd(t)}({latencyHint:n.latencyHint}),this._latencyHint=n.latencyHint),this._ticker=new Pp(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,Qp.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){kp($p(this._context),"Not available if OfflineAudioContext");return this._context.createMediaStreamSource(t)}createMediaElementSource(t){kp($p(this._context),"Not available if OfflineAudioContext");return this._context.createMediaElementSource(t)}createMediaStreamDestination(){kp($p(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){kp(!this._initialized,"The listener cannot be set after initialization."),this._listener=t}get transport(){return this.initialize(),this._transport}set transport(t){kp(!this._initialized,"The transport cannot be set after initialization."),this._transport=t}get draw(){return this.initialize(),this._draw}set draw(t){kp(!this._initialized,"Draw cannot be set after initialization."),this._draw=t}get destination(){return this.initialize(),this._destination}set destination(t){kp(!this._initialized,"The destination cannot be set after initialization."),this._destination=t}createAudioWorkletNode(t,e){return function(t,e,n){return kp(yp(cp),"AudioWorkletNode only works in a secure context (https or localhost)"),new(t instanceof(null==Rp?void 0:Rp.BaseAudioContext)?null==Rp?void 0:Rp.AudioWorkletNode:cp)(t,e,n)}(this.rawContext,t,e)}addAudioWorkletModule(t){return a(this,void 0,void 0,function*(){kp(yp(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 $p(this._context)?this._context.resume():Promise.resolve()}close(){return a(this,void 0,void 0,function*(){var t;$p(this._context)&&"closed"!==this.state&&!this._closeStarted&&(this._closeStarted=!0,yield this._context.close()),this._initialized&&(t=this,ef.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 af(t,e){xp(e)?e.forEach(e=>af(t,e)):Object.defineProperty(t,e,{enumerable:!0,writable:!1})}function uf(t,e){xp(e)?e.forEach(e=>uf(t,e)):Object.defineProperty(t,e,{writable:!0})}const cf=()=>{};class lf extends zp{constructor(){super(),this.name="ToneAudioBuffer",this.onload=cf;const t=Up(lf.getDefaults(),arguments,["url","onload","onerror"]);this.reverse=t.reverse,this.onload=t.onload,Sp(t.url)?this.load(t.url).catch(t.onerror):t.url&&this.set(t.url)}static getDefaults(){return{onerror:cf,onload:cf,reverse:!1}}get sampleRate(){return this._buffer?this._buffer.sampleRate:ff().sampleRate}set(t){return t instanceof lf?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=lf.load(t).then(t=>{this.set(t),this.onload(this)});lf.downloads.push(e);try{yield e}finally{const t=lf.downloads.indexOf(e);lf.downloads.splice(t,1)}return this})}dispose(){return super.dispose(),this._buffer=void 0,this}fromArray(t){const e=xp(t)&&t[0].length>0,n=e?t.length:1,r=e?t[0].length:t.length,i=ff(),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(vp(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(vp(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){kp(this.loaded,"Buffer is not loaded");const n=Math.floor(t*this.sampleRate),r=Math.floor(e*this.sampleRate);kp(n<r,"The start time must be less than the end time");const i=r-n,o=ff().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 lf(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 lf).fromArray(t)}static fromUrl(t){return a(this,void 0,void 0,function*(){const e=new lf;return yield e.load(t)})}static load(t){return a(this,void 0,void 0,function*(){const e=""===lf.baseUrl||lf.baseUrl.endsWith("/")?lf.baseUrl:lf.baseUrl+"/",n=yield fetch(e+t);if(!n.ok)throw new Error(`could not load url: ${t}`);const r=yield n.arrayBuffer();return yield ff().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();lf.downloads.length;)yield lf.downloads[0]})}}lf.baseUrl="",lf.downloads=[];class hf extends sf{constructor(){var t,e,n;super({clockSource:"offline",context:Fp(arguments[0])?arguments[0]:(t=arguments[0],e=arguments[1]*arguments[2],n=arguments[2],new dp(t,e,n)),lookAhead:0,updateInterval:Fp(arguments[0])?128/arguments[0].sampleRate:128/arguments[2]}),this.name="OfflineContext",this._currentTime=0,this.isOffline=!0,this._duration=Fp(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 lf(e)})}close(){return Promise.resolve()}}const df=new class extends of{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 pf=df;function ff(){return pf===df&&Dp&&function(t,e=!1){e&&pf.dispose();pf=$p(t)?new sf(t):Fp(t)?new hf(t):t}(new sf),pf}if(Rp&&!Rp.TONE_SILENCE_LOGGING){0}function mf(t){return Math.pow(10,t/20)}function gf(t){return Math.log(t)/Math.LN10*20}function _f(t){return Math.pow(2,t/12)}let yf=440;function vf(t){return Math.round(bf(t))}function bf(t){return 69+12*Math.log2(t/yf)}function wf(t){return yf*Math.pow(2,(t-69)/12)}class xf extends zp{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 xf&&this.fromType(this._val),_p(this._val))return this._noArg();if(Sp(this._val)&&_p(this._units)){for(const t in this._expressions)if(this._expressions[t].regexp.test(this._val.trim())){this._units=t;break}}else if(bp(this._val)){let t=0;for(const e in this._val)if(yp(this._val[e])){const n=this._val[e];t+=new this.constructor(this.context,e).valueOf()*n}return t}if(yp(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 Sp(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 Sf extends xf{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 Sf(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 Sf(this.context,e[0]).toSeconds();return e.forEach(e=>{const i=new Sf(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 vf(this.toFrequency())}_now(){return this.context.now()}}class Tf extends Sf{constructor(){super(...arguments),this.name="Frequency",this.defaultUnits="hz"}static get A4(){return yf}static set A4(t){!function(t){yf=t}(t)}_getExpressions(){return Object.assign({},super._getExpressions(),{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method(t){return"midi"===this.defaultUnits?t:Tf.mtof(t)}},note:{regexp:/^([a-g]{1}(?:b|#|##|x|bb|###|#x|x#|bbb)?)(-?[0-9]+)/i,method(t,e){const n=kf[t.toLowerCase()]+12*(parseInt(e,10)+1);return"midi"===this.defaultUnits?n:Tf.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 Tf(this.context,this.valueOf()*_f(t))}harmonize(t){return t.map(t=>this.transpose(t))}toMidi(){return vf(this.valueOf())}toNote(){const t=this.toFrequency(),e=Math.log2(t/Tf.A4);let n=Math.round(12*e)+57;const r=Math.floor(n/12);r<0&&(n+=-12*r);return Af[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 wf(t)}static ftom(t){return vf(t)}}const kf={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},Af=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];class Ef extends Sf{constructor(){super(...arguments),this.name="TransportTime"}_now(){return this.context.transport.seconds}}class Of extends zp{constructor(){super();const t=Up(Of.getDefaults(),arguments,["context"]);this.defaultContext?this.context=this.defaultContext:this.context=t.context}static getDefaults(){return{context:ff()}}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){_p(t)&&Op&&!Cp&&(Cp=!0,Np("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 Sf(this.context,t).toSeconds()}toFrequency(t){return new Tf(this.context,t).toFrequency()}toTicks(t){return new Ef(this.context,t).toTicks()}_getPartialProperties(t){const e=this.get();return Object.keys(e).forEach(n=>{_p(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];yp(n)&&yp(n.value)&&yp(n.setValueAtTime)?t[e]=n.value:n instanceof Of?t[e]=n._getPartialProperties(t[e]):xp(n)||vp(n)||Sp(n)||wp(n)?t[e]=n:delete t[e]}}),t}set(t){return Object.keys(t).forEach(e=>{Reflect.has(this,e)&&yp(this[e])&&(this[e]&&yp(this[e].value)&&yp(this[e].setValueAtTime)?this[e].value!==t[e]&&(this[e].value=t[e]):this[e]instanceof Of?this[e].set(t[e]):this[e]=t[e])}),this}}class Cf extends Zp{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 Ap(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 Mf extends Of{constructor(){const t=Up(Mf.getDefaults(),arguments,["param","units","convert"]);for(super(t),this.name="Param",this.overridden=!1,this._minOutput=1e-7,kp(yp(t.param)&&(jp(t.param)||t.param instanceof Mf),"param must be an AudioParam");!jp(t.param);)t.param=t.param._param;this._swappable=!!yp(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 Zp(1e3),this._initialValue=this._param.defaultValue,this.units=t.units,this.convert=t.convert,this._minValue=t.minValue,this._maxValue=t.maxValue,yp(t.value)&&t.value!==this._toType(this._initialValue)&&this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(Of.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 yp(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 yp(this._maxValue)?this._maxValue:"normalRange"===this.units||"audioRange"===this.units?1:this._param.maxValue}_is(t,e){return this.units===e}_assertRange(t){return yp(this.maxValue)&&yp(this.minValue)&&Ap(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")?mf(t):this._is(t,"frequency")?this.toFrequency(t):t:this.overridden?0:t}_toType(t){return this.convert&&"decibels"===this.units?gf(t):t}setValueAtTime(t,e){const n=this.toSeconds(e),r=this._fromType(t);return kp(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 kp(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=Kp(n,0)?this._minOutput:n,this._assertRange(n);const r=this.toSeconds(e);return kp(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);kp(isFinite(n)&&n>0,"timeConstant must be a number greater than 0");const i=this.toSeconds(e);return this._assertRange(r),kp(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 kp(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));kp(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&&Kp(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){kp(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 If extends Of{constructor(){super(...arguments),this._internalChannels=[]}get numberOfInputs(){return yp(this.input)?jp(this.input)||this.input instanceof Mf?1:this.input.numberOfInputs:0}get numberOfOutputs(){return yp(this.output)?this.output.numberOfOutputs:0}_isAudioNode(t){return yp(t)&&(t instanceof If||Lp(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();kp(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 Rf(this,t,e,n),this}toDestination(){return this.connect(this.context.destination),this}toMaster(){return Np("toMaster() has been renamed toDestination()"),this.toDestination()}disconnect(t,e=0,n=0){return Df(this,t,e,n),this}chain(...t){return Nf(this,...t),this}fan(...t){return t.forEach(t=>this.connect(t)),this}dispose(){return super.dispose(),yp(this.input)&&(this.input instanceof If?this.input.dispose():Lp(this.input)&&this.input.disconnect()),yp(this.output)&&(this.output instanceof If?this.output.dispose():Lp(this.output)&&this.output.disconnect()),this._internalChannels=[],this}}function Nf(...t){const e=t.shift();t.reduce((t,e)=>(t instanceof If?t.connect(e):Lp(t)&&Rf(t,e),e),e)}function Rf(t,e,n=0,r=0){for(kp(yp(t),"Cannot connect from undefined node"),kp(yp(e),"Cannot connect to undefined node"),(e instanceof If||Lp(e))&&kp(e.numberOfInputs>0,"Cannot connect to node with no inputs"),kp(t.numberOfOutputs>0,"Cannot connect from node with no outputs");e instanceof If||e instanceof Mf;)yp(e.input)&&(e=e.input);for(;t instanceof If;)yp(t.output)&&(t=t.output);jp(e)?t.connect(e,n):t.connect(e,n,r)}function Df(t,e,n=0,r=0){if(yp(e))for(;e instanceof If;)e=e.input;for(;!Lp(t);)yp(t.output)&&(t=t.output);jp(e)?t.disconnect(e,n):Lp(e)?t.disconnect(e,n,r):t.disconnect()}class Pf extends If{constructor(){const t=Up(Pf.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 Mf({context:this.context,convert:t.convert,param:this._gainNode.gain,units:t.units,value:t.gain,minValue:t.minValue,maxValue:t.maxValue}),af(this,"gain")}static getDefaults(){return Object.assign(If.getDefaults(),{convert:!0,gain:1,units:"gain"})}dispose(){return super.dispose(),this._gainNode.disconnect(),this.gain.dispose(),this}}class jf extends If{constructor(t){super(t),this.onended=cf,this._startTime=-1,this._stopTime=-1,this._timeout=-1,this.output=new Pf({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(If.getDefaults(),{curve:"linear",fadeIn:0,fadeOut:0,onended:cf})}_startGain(t,e=1){kp(-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){kp(-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!==cf&&(this.onended(this),this.onended=cf,!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"),kp(-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=cf,this}}class Lf extends jf{constructor(){const t=Up(Lf.getDefaults(),arguments,["offset"]);super(t),this.name="ToneConstantSource",this._source=this.context.createConstantSource(),Rf(this._source,this._gainNode),this.offset=new Mf({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(jf.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 Ff extends If{constructor(){const t=Up(Ff.getDefaults(),arguments,["value","units"]);super(t),this.name="Signal",this.override=!0,this.output=this._constantSource=new Lf({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(If.getDefaults(),{convert:!0,units:"number",value:0})}connect(t,e=0,n=0){return $f(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 $f(t,e,n,r){(e instanceof Mf||jp(e)||e instanceof Ff&&e.override)&&(e.cancelScheduledValues(0),e.setValueAtTime(0,0),e instanceof Ff&&(e.overridden=!0)),Rf(t,e,n,r)}class Bf extends Mf{constructor(){const t=Up(Bf.getDefaults(),arguments,["value"]);super(t),this.name="TickParam",this._events=new Zp(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(Mf.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(_p(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 qf extends Ff{constructor(){const t=Up(qf.getDefaults(),arguments,["value"]);super(t),this.name="TickSignal",this.input=this._param=new Bf({context:this.context,convert:t.convert,multiplier:t.multiplier,param:this._constantSource.offset,units:t.units,value:t.value})}static getDefaults(){return Object.assign(Ff.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 Uf extends Of{constructor(){const t=Up(Uf.getDefaults(),arguments,["frequency"]);super(t),this.name="TickSource",this._state=new Cf,this._tickOffset=new Zp,this._ticksAtTime=new Zp,this._secondsAtTime=new Zp,this.frequency=new qf({context:this.context,units:t.units,value:t.frequency}),af(this,"frequency"),this._state.setStateAtTime("stopped",0),this.setTicksAtTime(0,0)}static getDefaults(){return Object.assign({frequency:1,units:"hertz"},Of.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),yp(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=Kp(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 Vf extends Of{constructor(){const t=Up(Vf.getDefaults(),arguments,["callback","frequency"]);super(t),this.name="Clock",this.callback=cf,this._lastUpdate=0,this._state=new Cf("stopped"),this._boundLoop=this._loop.bind(this),this.callback=t.callback,this._tickSource=new Uf({context:this.context,frequency:t.frequency,units:t.units}),this._lastUpdate=0,this.frequency=this._tickSource.frequency,af(this,"frequency"),this._state.setStateAtTime("stopped",0),this.context.on("tick",this._boundLoop)}static getDefaults(){return Object.assign(Of.getDefaults(),{callback:cf,frequency:1,units:"hertz"})}get state(){return this._state.getValueAtTime(this.now())}start(t,e){Ep(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}}rf.mixin(Vf);class Gf extends If{constructor(){const t=Up(Gf.getDefaults(),arguments,["delayTime","maxDelay"]);super(t),this.name="Delay";const e=this.toSeconds(t.maxDelay);this._maxDelay=Math.max(e,this.toSeconds(t.delayTime)),this._delayNode=this.input=this.output=this.context.createDelay(e),this.delayTime=new Mf({context:this.context,param:this._delayNode.delayTime,units:"time",value:t.delayTime,minValue:0,maxValue:this.maxDelay}),af(this,"delayTime")}static getDefaults(){return Object.assign(If.getDefaults(),{delayTime:0,maxDelay:1})}get maxDelay(){return this._maxDelay}dispose(){return super.dispose(),this._delayNode.disconnect(),this.delayTime.dispose(),this}}class zf extends If{constructor(){const t=Up(zf.getDefaults(),arguments,["volume"]);super(t),this.name="Volume",this.input=this.output=new Pf({context:this.context,gain:t.volume,units:"decibels"}),this.volume=this.output.gain,af(this,"volume"),this._unmutedVolume=t.volume,this.mute=t.mute}static getDefaults(){return Object.assign(If.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 Wf extends If{constructor(){const t=Up(Wf.getDefaults(),arguments);super(t),this.name="Destination",this.input=new zf({context:this.context}),this.output=new Pf({context:this.context}),this.volume=this.input.volume,Nf(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(If.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),Nf(...t),this}get maxChannelCount(){return this.context.rawContext.destination.maxChannelCount}dispose(){return super.dispose(),this.volume.dispose(),this}}tf(t=>{t.destination=new Wf({context:t})}),nf(t=>{t.destination.dispose()});class Jf extends If{constructor(){super(...arguments),this.name="Listener",this.positionX=new Mf({context:this.context,param:this.context.rawContext.listener.positionX}),this.positionY=new Mf({context:this.context,param:this.context.rawContext.listener.positionY}),this.positionZ=new Mf({context:this.context,param:this.context.rawContext.listener.positionZ}),this.forwardX=new Mf({context:this.context,param:this.context.rawContext.listener.forwardX}),this.forwardY=new Mf({context:this.context,param:this.context.rawContext.listener.forwardY}),this.forwardZ=new Mf({context:this.context,param:this.context.rawContext.listener.forwardZ}),this.upX=new Mf({context:this.context,param:this.context.rawContext.listener.upX}),this.upY=new Mf({context:this.context,param:this.context.rawContext.listener.upY}),this.upZ=new Mf({context:this.context,param:this.context.rawContext.listener.upZ})}static getDefaults(){return Object.assign(If.getDefaults(),{positionX:0,positionY:0,positionZ:0,forwardX:0,forwardY:0,forwardZ:-1,upX:0,upY:1,upZ:0})}dispose(){return super.dispose(),this.positionX.dispose(),this.positionY.dispose(),this.positionZ.dispose(),this.forwardX.dispose(),this.forwardY.dispose(),this.forwardZ.dispose(),this.upX.dispose(),this.upY.dispose(),this.upZ.dispose(),this}}tf(t=>{t.listener=new Jf({context:t})}),nf(t=>{t.listener.dispose()});class Hf extends zp{constructor(){super(),this.name="ToneAudioBuffers",this._buffers=new Map,this._loadingCount=0;const t=Up(Hf.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:cf,onload:cf,urls:{}}}has(t){return this._buffers.has(t.toString())}get(t){return kp(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=cf,r=cf){return Sp(e)?(this.baseUrl&&"data:audio/"===e.trim().substring(0,11).toLowerCase()&&(this.baseUrl=""),this._buffers.set(t.toString(),new lf(this.baseUrl+e,n,r))):this._buffers.set(t.toString(),new lf(e,n,r)),this}dispose(){return super.dispose(),this._buffers.forEach(t=>t.dispose()),this._buffers.clear(),this}}class Xf extends Tf{constructor(){super(...arguments),this.name="MidiClass",this.defaultUnits="midi"}_frequencyToUnits(t){return vf(super._frequencyToUnits(t))}_ticksToUnits(t){return vf(super._ticksToUnits(t))}_beatsToUnits(t){return vf(super._beatsToUnits(t))}_secondsToUnits(t){return vf(super._secondsToUnits(t))}toMidi(){return this.valueOf()}toFrequency(){return wf(this.toMidi())}transpose(t){return new Xf(this.context,this.toMidi()+t)}}class Kf extends Ef{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 Yf extends Of{constructor(){super(...arguments),this.name="Draw",this.expiration=.25,this.anticipation=.008,this._events=new Zp,this._boundDrawLoop=this._drawLoop.bind(this),this._animationFrame=-1}schedule(t,e){return this._events.add({callback:t,time:this.toSeconds(e)}),1===this._events.length&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop)),this}cancel(t){return this._events.cancel(this.toSeconds(t)),this}_drawLoop(){const t=this.context.currentTime;this._events.forEachBefore(t+this.anticipation,e=>{t-e.time<=this.expiration&&e.callback(),this._events.remove(e)}),this._events.length>0&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop))}dispose(){return super.dispose(),this._events.dispose(),cancelAnimationFrame(this._animationFrame),this}}tf(t=>{t.draw=new Yf({context:t})}),nf(t=>{t.draw.dispose()});class Zf extends zp{constructor(){super(...arguments),this.name="IntervalTimeline",this._root=null,this._length=0}add(t){kp(yp(t.time),"Events must have a time property"),kp(yp(t.duration),"Events must have a duration parameter"),t.time=t.time.valueOf();let e=new Qf(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 Qf{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 tm extends zp{constructor(t){super(),this.name="TimelineValue",this._timeline=new Zp({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 em extends If{constructor(){super(Up(em.getDefaults(),arguments,["context"]))}connect(t,e=0,n=0){return $f(this,t,e,n),this}}class nm extends em{constructor(){const t=Up(nm.getDefaults(),arguments,["mapping","length"]);super(t),this.name="WaveShaper",this._shaper=this.context.createWaveShaper(),this.input=this._shaper,this.output=this._shaper,xp(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(Ff.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));kp(e,"oversampling must be either 'none', '2x', or '4x'"),this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.disconnect(),this}}class rm extends em{constructor(){const t=Up(rm.getDefaults(),arguments,["value"]);super(t),this.name="Pow",this._exponentScaler=this.input=this.output=new nm({context:this.context,mapping:this._expFunc(t.value),length:8192}),this._exponent=t.value}static getDefaults(){return Object.assign(em.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 im{constructor(t,e){this.id=im._eventId++,this._remainderTime=0;const n=Object.assign(im.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:cf,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}}im._eventId=0;class om extends im{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(om.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({},im.getDefaults(),{duration:1/0,interval:1,once:!1})}invoke(t){this._createEvents(t),super.invoke(t)}_createEvent(){return Xp(this._nextTick,this.floatTime+this.duration)?this.transport.scheduleOnce(this.invoke.bind(this),new Kf(this.context,this._nextTick).toSeconds()):-1}_createEvents(t){Xp(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 Kf(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);Jp(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 sm extends Of{constructor(){const t=Up(sm.getDefaults(),arguments);super(t),this.name="Transport",this._loop=new tm(!1),this._loopStart=0,this._loopEnd=0,this._scheduledEvents={},this._timeline=new Zp,this._repeatedEvents=new Zf,this._syncedSignals=[],this._swingAmount=0,this._ppq=t.ppq,this._clock=new Vf({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),af(this,"bpm"),this._timeSignature=t.timeSignature,this._swingTicks=t.ppq/2}static getDefaults(){return Object.assign(Of.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 Kf(this.context,2*this._swingTicks/3).toSeconds()*r}Mp(!0),this._timeline.forEachAtTime(e,e=>e.invoke(t)),Mp(!1)}schedule(t,e){const n=new im(this,{callback:t,time:new Ef(this.context,e).toTicks()});return this._addEvent(n,this._timeline)}scheduleRepeat(t,e,n,r=1/0){const i=new om(this,{callback:t,duration:new Sf(this.context,r).toTicks(),interval:new Sf(this.context,e).toTicks(),time:new Ef(this.context,n).toTicks()});return this._addEvent(i,this._repeatedEvents)}scheduleOnce(t,e){const n=new im(this,{callback:t,once:!0,time:new Ef(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 Kf(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(),yp(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){xp(t)&&(t=t[0]/t[1]*4),this._timeSignature=t}get loopStart(){return new Sf(this.context,this._loopStart,"i").toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t)}get loopEnd(){return new Sf(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 Kf(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 Kf(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 Pf(t),n=new rm(-1),s=new Pf(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 Pf(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(),uf(this,"bpm"),this._timeline.dispose(),this._repeatedEvents.dispose(),this}}rf.mixin(sm),tf(t=>{t.transport=new sm({context:t})}),nf(t=>{t.transport.dispose()});class am extends If{constructor(t){super(t),this.input=void 0,this._state=new Cf("stopped"),this._synced=!1,this._scheduled=[],this._syncedStart=cf,this._syncedStop=cf,this._state.memory=100,this._state.increasing=!0,this._volume=this.output=new zf({context:this.context,mute:t.mute,volume:t.volume}),this.volume=this._volume.volume,af(this,"volume"),this.onstop=t.onstop}static getDefaults(){return Object.assign(If.getDefaults(),{mute:!1,onstop:cf,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=_p(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(Vp(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 Ep(this.context),this._start(r,e,n);else kp(Jp(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=_p(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(e=this._clampToCurrentTime(e),"started"===this._state.getValueAtTime(e)||yp(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(Jp(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=cf,this.unsync(),this._volume.dispose(),this._state.dispose(),this}}class um extends jf{constructor(){const t=Up(um.getDefaults(),arguments,["url","onload"]);super(t),this.name="ToneBufferSource",this._source=this.context.createBufferSource(),this._internalChannels=[this._source],this._sourceStarted=!1,this._sourceStopped=!1,Rf(this._source,this._gainNode),this._source.onended=()=>this._stopSource(),this.playbackRate=new Mf({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 lf(t.url,t.onload,t.onerror),this._internalChannels.push(this._source)}static getDefaults(){return Object.assign(jf.getDefaults(),{url:new lf,loop:!1,loopEnd:0,loopStart:0,onload:cf,onerror:cf,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){kp(this.buffer.loaded,"buffer is either not set or not loaded");const i=this.toSeconds(t);this._startGain(i,r),e=this.loop?Vp(e,this.loopStart):Vp(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;Hp(o,t)&&(o=(o-e)%n+e),Kp(o,this.buffer.duration)&&(o=0)}if(this._source.buffer=this.buffer.get(),this._source.loopEnd=this.toSeconds(this.loopEnd)||this.buffer.duration,Xp(o,this.buffer.duration)&&(this._sourceStarted=!0,this._source.start(i,o)),yp(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 cm extends am{constructor(){const t=Up(cm.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(am.getDefaults(),{fadeIn:0,fadeOut:0,playbackRate:1,type:"white"})}get type(){return this._type}set type(t){if(kp(t in dm,"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=dm[this._type];this._source=new um({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 lm=220500,hm={brown:null,pink:null,white:null},dm={get brown(){if(!hm.brown){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(lm);t[e]=n;let r=0;for(let t=0;t<lm;t++){const e=2*Math.random()-1;n[t]=(r+.02*e)/1.02,r=n[t],n[t]*=3.5}}hm.brown=(new lf).fromArray(t)}return hm.brown},get pink(){if(!hm.pink){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(lm);let r,i,o,s,a,u,c;t[e]=n,r=i=o=s=a=u=c=0;for(let t=0;t<lm;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}}hm.pink=(new lf).fromArray(t)}return hm.pink},get white(){if(!hm.white){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(lm);t[e]=n;for(let t=0;t<lm;t++)n[t]=2*Math.random()-1}hm.white=(new lf).fromArray(t)}return hm.white}};function pm(t,e){return a(this,void 0,void 0,function*(){const n=e/t.context.sampleRate,r=new hf(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 fm extends jf{constructor(){const t=Up(fm.getDefaults(),arguments,["frequency","type"]);super(t),this.name="ToneOscillatorNode",this._oscillator=this.context.createOscillator(),this._internalChannels=[this._oscillator],Rf(this._oscillator,this._gainNode),this.type=t.type,this.frequency=new Mf({context:this.context,param:this._oscillator.frequency,units:"frequency",value:t.frequency}),this.detune=new Mf({context:this.context,param:this._oscillator.detune,units:"cents",value:t.detune}),af(this,["frequency","detune"])}static getDefaults(){return Object.assign(jf.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 mm extends am{constructor(){const t=Up(mm.getDefaults(),arguments,["frequency","type"]);super(t),this.name="Oscillator",this._oscillator=null,this.frequency=new Ff({context:this.context,units:"frequency",value:t.frequency}),af(this,"frequency"),this.detune=new Ff({context:this.context,units:"cents",value:t.detune}),af(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(am.getDefaults(),{detune:0,frequency:440,partialCount:0,partials:[],phase:0,type:"sine"})}_start(t){const e=this.toSeconds(t),n=new fm({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 mm._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=mm._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(yp(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),mm._periodicWaveCache.push({imag:n,partialCount:this._partialCount,partials:this._partials,phase:this._phase,real:e,type:this._type,wave:this._wave}),mm._periodicWaveCache.length>100&&mm._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){Ap(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 Yp(-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 pm(this,t)})}dispose(){return super.dispose(),null!==this._oscillator&&this._oscillator.dispose(),this._wave=void 0,this.frequency.dispose(),this.detune.dispose(),this}}mm._periodicWaveCache=[];class gm extends em{constructor(){super(...arguments),this.name="AudioToGain",this._norm=new nm({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 _m extends Ff{constructor(){const t=Up(_m.getDefaults(),arguments,["value"]);super(t),this.name="Multiply",this.override=!1,this._mult=this.input=this.output=new Pf({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(Ff.getDefaults(),{value:0})}dispose(){return super.dispose(),this._mult.dispose(),this}}class ym extends am{constructor(){const t=Up(ym.getDefaults(),arguments,["frequency","type","modulationType"]);super(t),this.name="AMOscillator",this._modulationScale=new gm({context:this.context}),this._modulationNode=new Pf({context:this.context}),this._carrier=new mm({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 mm({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new _m({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),af(this,["frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(mm.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 pm(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 vm extends am{constructor(){const t=Up(vm.getDefaults(),arguments,["frequency","type","modulationType"]);super(t),this.name="FMOscillator",this._modulationNode=new Pf({context:this.context,gain:0}),this._carrier=new mm({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 Ff({context:this.context,units:"frequency",value:t.frequency}),this._modulator=new mm({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new _m({context:this.context,units:"positive",value:t.harmonicity}),this.modulationIndex=new _m({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),af(this,["modulationIndex","frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(mm.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 pm(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 bm extends am{constructor(){const t=Up(bm.getDefaults(),arguments,["frequency","width"]);super(t),this.name="PulseOscillator",this._widthGate=new Pf({context:this.context,gain:0}),this._thresh=new nm({context:this.context,mapping:t=>t<=0?-1:1}),this.width=new Ff({context:this.context,units:"audioRange",value:t.width}),this._triangle=new mm({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),af(this,["width","frequency","detune"])}static getDefaults(){return Object.assign(am.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 pm(this,t)})}dispose(){return super.dispose(),this._triangle.dispose(),this.width.dispose(),this._widthGate.dispose(),this._thresh.dispose(),this}}class wm extends am{constructor(){const t=Up(wm.getDefaults(),arguments,["frequency","type","spread"]);super(t),this.name="FatOscillator",this._oscillators=[],this.frequency=new Ff({context:this.context,units:"frequency",value:t.frequency}),this.detune=new Ff({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,af(this,["frequency","detune"])}static getDefaults(){return Object.assign(mm.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(Ap(t,1),this._oscillators.length!==t){this._forEach(t=>t.dispose()),this._oscillators=[];for(let e=0;e<t;e++){const n=new mm({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):cf});"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 pm(this,t)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this._forEach(t=>t.dispose()),this}}class xm extends am{constructor(){const t=Up(xm.getDefaults(),arguments,["frequency","modulationFrequency"]);super(t),this.name="PWMOscillator",this.sourceType="pwm",this._scale=new _m({context:this.context,value:2}),this._pulse=new bm({context:this.context,frequency:t.modulationFrequency}),this._pulse.carrierType="sine",this.modulationFrequency=this._pulse.frequency,this._modulator=new mm({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),af(this,["modulationFrequency","frequency","detune"])}static getDefaults(){return Object.assign(am.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 pm(this,t)})}dispose(){return super.dispose(),this._pulse.dispose(),this._scale.dispose(),this._modulator.dispose(),this}}const Sm={am:ym,fat:wm,fm:vm,oscillator:mm,pulse:bm,pwm:xm};class Tm extends am{constructor(){const t=Up(Tm.getDefaults(),arguments,["frequency","type"]);super(t),this.name="OmniOscillator",this.frequency=new Ff({context:this.context,units:"frequency",value:t.frequency}),this.detune=new Ff({context:this.context,units:"cents",value:t.detune}),af(this,["frequency","detune"]),this.set(t)}static getDefaults(){return Object.assign(mm.getDefaults(),vm.getDefaults(),ym.getDefaults(),wm.getDefaults(),bm.getDefaults(),xm.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=Sm[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 Sm[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")&&vp(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")&&vp(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"))&&Sp(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 pm(this,t)})}dispose(){return super.dispose(),this.detune.dispose(),this.frequency.dispose(),this._oscillator.dispose(),this}}class km extends Ff{constructor(){super(Up(km.getDefaults(),arguments,["value"])),this.override=!1,this.name="Add",this._sum=new Pf({context:this.context}),this.input=this._sum,this.output=this._sum,this.addend=this._param,Nf(this._constantSource,this._sum)}static getDefaults(){return Object.assign(Ff.getDefaults(),{value:0})}dispose(){return super.dispose(),this._sum.dispose(),this}}class Am extends em{constructor(){const t=Up(Am.getDefaults(),arguments,["min","max"]);super(t),this.name="Scale",this._mult=this.input=new _m({context:this.context,value:t.max-t.min}),this._add=this.output=new km({context:this.context,value:t.min}),this._min=t.min,this._max=t.max,this.input.connect(this.output)}static getDefaults(){return Object.assign(em.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 Em extends em{constructor(){super(Up(Em.getDefaults(),arguments)),this.name="Zero",this._gain=new Pf({context:this.context}),this.output=this._gain,this.input=void 0,Rf(this.context.getConstant(0),this._gain)}dispose(){return super.dispose(),Df(this.context.getConstant(0),this._gain),this}}class Om extends If{constructor(){const t=Up(Om.getDefaults(),arguments,["frequency","min","max"]);super(t),this.name="LFO",this._stoppedValue=0,this._units="number",this.convert=!0,this._fromType=Mf.prototype._fromType,this._toType=Mf.prototype._toType,this._is=Mf.prototype._is,this._clampValue=Mf.prototype._clampValue,this._oscillator=new mm(t),this.frequency=this._oscillator.frequency,this._amplitudeGain=new Pf({context:this.context,gain:t.amplitude,units:"normalRange"}),this.amplitude=this._amplitudeGain.gain,this._stoppedSignal=new Ff({context:this.context,units:"audioRange",value:0}),this._zeros=new Em({context:this.context}),this._a2g=new gm({context:this.context}),this._scaler=this.output=new Am({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),af(this,["amplitude","frequency"]),this.phase=t.phase}static getDefaults(){return Object.assign(mm.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 Mf||t instanceof Ff)&&(this.convert=t.convert,this.units=t.units),$f(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}}function Cm(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){Ap(r,t,e),n.set(this,r)}})}}function Mm(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){Ap(this.toSeconds(r),t,e),n.set(this,r)}})}}class Im extends am{constructor(){const t=Up(Im.getDefaults(),arguments,["url","onload"]);super(t),this.name="Player",this._activeSources=new Set,this._buffer=new lf({onload:this._onload.bind(this,t.onload),onerror:t.onerror,reverse:t.reverse,url:t.url}),this.autostart=t.autostart,this._loop=t.loop,this._loopStart=t.loopStart,this._loopEnd=t.loopEnd,this._playbackRate=t.playbackRate,this.fadeIn=t.fadeIn,this.fadeOut=t.fadeOut}static getDefaults(){return Object.assign(am.getDefaults(),{autostart:!1,fadeIn:0,fadeOut:0,loop:!1,loopEnd:0,loopStart:0,onload:cf,onerror:cf,playbackRate:1,reverse:!1})}load(t){return a(this,void 0,void 0,function*(){return yield this._buffer.load(t),this._onload(),this})}_onload(t=cf){t(),this.autostart&&this.start()}_onSourceEnd(t){this.onstop(this),this._activeSources.delete(t),0!==this._activeSources.size||this._synced||"started"!==this._state.getValueAtTime(this.now())||(this._state.cancel(this.now()),this._state.setStateAtTime("stopped",this.now()))}start(t,e,n){return super.start(t,e,n),this}_start(t,e,n){e=this._loop?Vp(e,this._loopStart):Vp(e,0);const r=this.toSeconds(e),i=n;n=Vp(n,Math.max(this._buffer.duration-r,0));let o=this.toSeconds(n);o/=this._playbackRate,t=this.toSeconds(t);const s=new um({url:this._buffer,context:this.context,fadeIn:this.fadeIn,fadeOut:this.fadeOut,loop:this._loop,loopEnd:this._loopEnd,loopStart:this._loopStart,onended:this._onSourceEnd.bind(this),playbackRate:this._playbackRate}).connect(this.output);this._loop||this._synced||(this._state.cancel(t+o),this._state.setStateAtTime("stopped",t+o,{implicitEnd:!0})),this._activeSources.add(s),this._loop&&_p(i)?s.start(t,r):s.start(t,r,o-this.toSeconds(this.fadeOut))}_stop(t){const e=this.toSeconds(t);this._activeSources.forEach(t=>t.stop(e))}restart(t,e,n){return super.restart(t,e,n),this}_restart(t,e,n){var r;null===(r=[...this._activeSources].pop())||void 0===r||r.stop(t),this._start(t,e,n)}seek(t,e){const n=this.toSeconds(e);if("started"===this._state.getValueAtTime(n)){const e=this.toSeconds(t);this._stop(n),this._start(n,e)}return this}setLoopPoints(t,e){return this.loopStart=t,this.loopEnd=e,this}get loopStart(){return this._loopStart}set loopStart(t){this._loopStart=t,this.buffer.loaded&&Ap(this.toSeconds(t),0,this.buffer.duration),this._activeSources.forEach(e=>{e.loopStart=t})}get loopEnd(){return this._loopEnd}set loopEnd(t){this._loopEnd=t,this.buffer.loaded&&Ap(this.toSeconds(t),0,this.buffer.duration),this._activeSources.forEach(e=>{e.loopEnd=t})}get buffer(){return this._buffer}set buffer(t){this._buffer.set(t)}get loop(){return this._loop}set loop(t){if(this._loop!==t&&(this._loop=t,this._activeSources.forEach(e=>{e.loop=t}),t)){const t=this._state.getNextState("stopped",this.now());t&&this._state.cancel(t.time)}}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t;const e=this.now(),n=this._state.getNextState("stopped",e);n&&n.implicitEnd&&(this._state.cancel(n.time),this._activeSources.forEach(t=>t.cancelStop())),this._activeSources.forEach(n=>{n.playbackRate.setValueAtTime(t,e)})}get reverse(){return this._buffer.reverse}set reverse(t){this._buffer.reverse=t}get loaded(){return this._buffer.loaded}dispose(){return super.dispose(),this._activeSources.forEach(t=>t.dispose()),this._activeSources.clear(),this._buffer.dispose(),this}}s([Mm(0)],Im.prototype,"fadeIn",void 0),s([Mm(0)],Im.prototype,"fadeOut",void 0);class Nm extends em{constructor(){super(...arguments),this.name="GainToAudio",this._norm=new nm({context:this.context,mapping:t=>2*Math.abs(t)-1}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class Rm extends If{constructor(){const t=Up(Rm.getDefaults(),arguments,["attack","decay","sustain","release"]);super(t),this.name="Envelope",this._sig=new Ff({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(If.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(Sp(t))return t;{let n;for(n in Dm)if(Dm[n][e]===t)return n;return t}}_setCurve(t,e,n){if(Sp(n)&&Reflect.has(Dm,n)){const r=Dm[n];bp(r)?"_decayCurve"!==t&&(this[t]=r[e]):this[t]=r}else{if(!xp(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):(kp(xp(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 $f(this,t,e,n),this}asArray(){return a(this,arguments,void 0,function*(t=1024){const e=t/this.context.sampleRate,n=new hf(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([Mm(0)],Rm.prototype,"attack",void 0),s([Mm(0)],Rm.prototype,"decay",void 0),s([Cm(0,1)],Rm.prototype,"sustain",void 0),s([Mm(0)],Rm.prototype,"release",void 0);const Dm=(()=>{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 Pm extends If{constructor(){const t=Up(Pm.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 zf({context:this.context,volume:t.volume}),this.volume=this._volume.volume,af(this,"volume")}static getDefaults(){return Object.assign(If.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 jm extends Pm{constructor(){const t=Up(jm.getDefaults(),arguments);super(t),this.portamento=t.portamento,this.onsilence=t.onsilence}static getDefaults(){return Object.assign(Pm.getDefaults(),{detune:0,onsilence:cf,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 Tf?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([Mm(0)],jm.prototype,"portamento",void 0);class Lm extends Rm{constructor(){super(Up(Lm.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="AmplitudeEnvelope",this._gainNode=new Pf({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 Fm extends jm{constructor(){const t=Up(Fm.getDefaults(),arguments);super(t),this.name="Synth",this.oscillator=new Tm(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 Lm(Object.assign({context:this.context},t.envelope)),this.oscillator.chain(this.envelope,this.output),af(this,["oscillator","frequency","detune","envelope"])}static getDefaults(){return Object.assign(jm.getDefaults(),{envelope:Object.assign(Gp(Rm.getDefaults(),Object.keys(If.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.3}),oscillator:Object.assign(Gp(Tm.getDefaults(),[...Object.keys(am.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 $m extends jm{constructor(){const t=Up($m.getDefaults(),arguments);super(t),this.name="ModulationSynth",this._carrier=new Fm({context:this.context,oscillator:t.oscillator,envelope:t.envelope,onsilence:()=>this.onsilence(this),volume:-10}),this._modulator=new Fm({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 Ff({context:this.context,units:"frequency"}),this.detune=new Ff({context:this.context,value:t.detune,units:"cents"}),this.harmonicity=new _m({context:this.context,value:t.harmonicity,minValue:0}),this._modulationNode=new Pf({context:this.context,gain:0}),af(this,["frequency","harmonicity","oscillator","envelope","modulation","modulationEnvelope","detune"])}static getDefaults(){return Object.assign(jm.getDefaults(),{harmonicity:3,oscillator:Object.assign(Gp(Tm.getDefaults(),[...Object.keys(am.getDefaults()),"frequency","detune"]),{type:"sine"}),envelope:Object.assign(Gp(Rm.getDefaults(),Object.keys(If.getDefaults())),{attack:.01,decay:.01,sustain:1,release:.5}),modulation:Object.assign(Gp(Tm.getDefaults(),[...Object.keys(am.getDefaults()),"frequency","detune"]),{type:"square"}),modulationEnvelope:Object.assign(Gp(Rm.getDefaults(),Object.keys(If.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 Bm extends $m{constructor(){super(Up(Bm.getDefaults(),arguments)),this.name="AMSynth",this._modulationScale=new gm({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 qm extends If{constructor(){const t=Up(qm.getDefaults(),arguments,["frequency","type"]);super(t),this.name="BiquadFilter",this._filter=this.context.createBiquadFilter(),this.input=this.output=this._filter,this.Q=new Mf({context:this.context,units:"number",value:t.Q,param:this._filter.Q}),this.frequency=new Mf({context:this.context,units:"frequency",value:t.frequency,param:this._filter.frequency}),this.detune=new Mf({context:this.context,units:"cents",value:t.detune,param:this._filter.detune}),this.gain=new Mf({context:this.context,units:"decibels",convert:!1,value:t.gain,param:this._filter.gain}),this.type=t.type}static getDefaults(){return Object.assign(If.getDefaults(),{Q:1,type:"lowpass",frequency:350,detune:0,gain:0})}get type(){return this._filter.type}set type(t){kp(-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 Um extends If{constructor(){const t=Up(Um.getDefaults(),arguments,["frequency","type","rolloff"]);super(t),this.name="Filter",this.input=new Pf({context:this.context}),this.output=new Pf({context:this.context}),this._filters=[],this._filters=[],this.Q=new Ff({context:this.context,units:"positive",value:t.Q}),this.frequency=new Ff({context:this.context,units:"frequency",value:t.frequency}),this.detune=new Ff({context:this.context,units:"cents",value:t.detune}),this.gain=new Ff({context:this.context,units:"decibels",convert:!1,value:t.gain}),this._type=t.type,this.rolloff=t.rolloff,af(this,["detune","frequency","gain","Q"])}static getDefaults(){return Object.assign(If.getDefaults(),{Q:1,detune:0,frequency:350,gain:0,rolloff:-12,type:"lowpass"})}get type(){return this._type}set type(t){kp(-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=vp(t)?t:parseInt(t,10),n=[-12,-24,-48,-96];let r=n.indexOf(e);kp(-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 qm({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,Nf(this.input,...this._internalChannels,this.output)}getFrequencyResponse(t=128){const e=new qm({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()}),uf(this,["detune","frequency","gain","Q"]),this.frequency.dispose(),this.Q.dispose(),this.detune.dispose(),this.gain.dispose(),this}}class Vm extends Rm{constructor(){const t=Up(Vm.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 rm({context:this.context,value:t.exponent}),this._scale=this.output=new Am({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(Rm.getDefaults(),{baseFrequency:200,exponent:1,octaves:4})}get baseFrequency(){return this._baseFrequency}set baseFrequency(t){const e=this.toFrequency(t);Ap(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 Gm extends jm{constructor(){const t=Up(Gm.getDefaults(),arguments);super(t),this.name="MonoSynth",this.oscillator=new Tm(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 Um(Object.assign(t.filter,{context:this.context})),this.filterEnvelope=new Vm(Object.assign(t.filterEnvelope,{context:this.context})),this.envelope=new Lm(Object.assign(t.envelope,{context:this.context})),this.oscillator.chain(this.filter,this.envelope,this.output),this.filterEnvelope.connect(this.filter.frequency),af(this,["oscillator","frequency","detune","filter","filterEnvelope","envelope"])}static getDefaults(){return Object.assign(jm.getDefaults(),{envelope:Object.assign(Gp(Rm.getDefaults(),Object.keys(If.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.9}),filter:Object.assign(Gp(Um.getDefaults(),Object.keys(If.getDefaults())),{Q:1,rolloff:-12,type:"lowpass"}),filterEnvelope:Object.assign(Gp(Vm.getDefaults(),Object.keys(If.getDefaults())),{attack:.6,baseFrequency:200,decay:.2,exponent:2,octaves:3,release:2,sustain:.5}),oscillator:Object.assign(Gp(Tm.getDefaults(),Object.keys(am.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 zm extends jm{constructor(){const t=Up(zm.getDefaults(),arguments);super(t),this.name="DuoSynth",this.voice0=new Gm(Object.assign(t.voice0,{context:this.context,onsilence:()=>this.onsilence(this)})),this.voice1=new Gm(Object.assign(t.voice1,{context:this.context})),this.harmonicity=new _m({context:this.context,units:"positive",value:t.harmonicity}),this._vibrato=new Om({frequency:t.vibratoRate,context:this.context,min:-50,max:50}),this._vibrato.start(),this.vibratoRate=this._vibrato.frequency,this._vibratoGain=new Pf({context:this.context,units:"normalRange",gain:t.vibratoAmount}),this.vibratoAmount=this._vibratoGain.gain,this.frequency=new Ff({context:this.context,units:"frequency",value:440}),this.detune=new Ff({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),af(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 qp(jm.getDefaults(),{vibratoAmount:.5,vibratoRate:5,harmonicity:1.5,voice0:qp(Gp(Gm.getDefaults(),Object.keys(jm.getDefaults())),{filterEnvelope:{attack:.01,decay:0,sustain:1,release:.5},envelope:{attack:.01,decay:0,sustain:1,release:.5}}),voice1:qp(Gp(Gm.getDefaults(),Object.keys(jm.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 Wm extends $m{constructor(){const t=Up(Wm.getDefaults(),arguments);super(t),this.name="FMSynth",this.modulationIndex=new _m({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($m.getDefaults(),{modulationIndex:10})}dispose(){return super.dispose(),this.modulationIndex.dispose(),this}}const Jm=[1,1.483,1.932,2.546,2.63,3.897];class Hm extends jm{constructor(){const t=Up(Hm.getDefaults(),arguments);super(t),this.name="MetalSynth",this._oscillators=[],this._freqMultipliers=[],this.detune=new Ff({context:this.context,units:"cents",value:t.detune}),this.frequency=new Ff({context:this.context,units:"frequency"}),this._amplitude=new Pf({context:this.context,gain:0}).connect(this.output),this._highpass=new Um({Q:0,context:this.context,type:"highpass"}).connect(this._amplitude);for(let e=0;e<Jm.length;e++){const n=new vm({context:this.context,harmonicity:t.harmonicity,modulationIndex:t.modulationIndex,modulationType:"square",onstop:0===e?()=>this.onsilence(this):cf,type:"square"});n.connect(this._highpass),this._oscillators[e]=n;const r=new _m({context:this.context,value:Jm[e]});this._freqMultipliers[e]=r,this.frequency.chain(r,n.frequency),this.detune.connect(n.detune)}this._filterFreqScaler=new Am({context:this.context,max:7e3,min:this.toFrequency(t.resonance)}),this.envelope=new Rm({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 qp(jm.getDefaults(),{envelope:Object.assign(Gp(Rm.getDefaults(),Object.keys(If.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 Xm extends Fm{constructor(){const t=Up(Xm.getDefaults(),arguments);super(t),this.name="MembraneSynth",this.portamento=0,this.pitchDecay=t.pitchDecay,this.octaves=t.octaves,af(this,["oscillator","envelope"])}static getDefaults(){return qp(jm.getDefaults(),Fm.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 Tf?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([Cm(0)],Xm.prototype,"octaves",void 0),s([Mm(0)],Xm.prototype,"pitchDecay",void 0);class Km extends Pm{constructor(){const t=Up(Km.getDefaults(),arguments);super(t),this.name="NoiseSynth",this.noise=new cm(Object.assign({context:this.context},t.noise)),this.envelope=new Lm(Object.assign({context:this.context},t.envelope)),this.noise.chain(this.envelope,this.output)}static getDefaults(){return Object.assign(Pm.getDefaults(),{envelope:Object.assign(Gp(Rm.getDefaults(),Object.keys(If.getDefaults())),{decay:.1,sustain:0}),noise:Object.assign(Gp(cm.getDefaults(),Object.keys(am.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 Ym=new Set;function Zm(t){Ym.add(t)}function Qm(t,e){const n=`registerProcessor("${t}", ${e})`;Ym.add(n)}class tg extends If{constructor(t){super(t),this.name="ToneAudioWorklet",this.workletOptions={},this.onprocessorerror=cf;const e=URL.createObjectURL(new Blob([Array.from(Ym).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}}Zm('\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');Zm("\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");Zm("\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 eg="feedback-comb-filter";Qm(eg,'\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 ng extends tg{constructor(){const t=Up(ng.getDefaults(),arguments,["delayTime","resonance"]);super(t),this.name="FeedbackCombFilter",this.input=new Pf({context:this.context}),this.output=new Pf({context:this.context}),this.delayTime=new Mf({context:this.context,value:t.delayTime,units:"time",minValue:0,maxValue:1,param:this._dummyParam,swappable:!0}),this.resonance=new Mf({context:this.context,value:t.resonance,units:"normalRange",param:this._dummyParam,swappable:!0}),af(this,["resonance","delayTime"])}_audioWorkletName(){return eg}static getDefaults(){return Object.assign(If.getDefaults(),{delayTime:.1,resonance:.5})}onReady(t){Nf(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 rg extends If{constructor(){const t=Up(rg.getDefaults(),arguments,["frequency","type"]);super(t),this.name="OnePoleFilter",this._frequency=t.frequency,this._type=t.type,this.input=new Pf({context:this.context}),this.output=new Pf({context:this.context}),this._createFilter()}static getDefaults(){return Object.assign(If.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 ig extends If{constructor(){const t=Up(ig.getDefaults(),arguments,["delayTime","resonance","dampening"]);super(t),this.name="LowpassCombFilter",this._combFilter=this.output=new ng({context:this.context,delayTime:t.delayTime,resonance:t.resonance}),this.delayTime=this._combFilter.delayTime,this.resonance=this._combFilter.resonance,this._lowpass=this.input=new rg({context:this.context,frequency:t.dampening,type:"lowpass"}),this._lowpass.connect(this._combFilter)}static getDefaults(){return Object.assign(If.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 og extends Pm{constructor(){const t=Up(og.getDefaults(),arguments);super(t),this.name="PluckSynth",this._noise=new cm({context:this.context,type:"pink"}),this.attackNoise=t.attackNoise,this._lfcf=new ig({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 qp(Pm.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 sg extends Pm{constructor(){const t=Up(sg.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),kp(!vp(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(Pm.getDefaults(),{maxPolyphony:32,options:{},voice:Fm})}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 kp(t instanceof jm,"Voice must extend Monophonic class"),t.connect(this.output),this._voices.push(t),t}Np("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 Xf(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 Xf(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){kp(!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),xp(e)){kp(xp(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);kp(o>0,"The duration must be greater than 0"),this.triggerRelease(t[n],i+o)}}else{const n=this.toSeconds(e);kp(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=Gp(t,["onsilence","context"]);return this.options=qp(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 ag extends Pm{constructor(){const t=Up(ag.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(kp(Tp(n)||vp(r)&&isFinite(r),`url key is neither a note or midi pitch: ${n}`),Tp(n)){const r=new Tf(this.context,n).toMidi();e[r]=t.urls[n]}else vp(r)&&isFinite(r)&&(e[r]=t.urls[r])}),this._buffers=new Hf({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(Pm.getDefaults(),{attack:0,baseUrl:"",curve:"exponential",onload:cf,onerror:cf,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=bf(new Tf(this.context,t).toFrequency()),i=Math.round(r),o=r-i,s=this._findClosest(i),a=i-s,u=this._buffers.get(a),c=_f(s+o),l=new um({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),xp(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 Tf(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),xp(e)?(kp(xp(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(kp(Tp(t)||isFinite(t),`note must be a pitch or midi: ${t}`),Tp(t)){const r=new Tf(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([Mm(0)],ag.prototype,"attack",void 0),s([Mm(0)],ag.prototype,"release",void 0);class ug extends If{constructor(){const t=Up(ug.getDefaults(),arguments,["fade"]);super(t),this.name="CrossFade",this._panner=this.context.createStereoPanner(),this._split=this.context.createChannelSplitter(2),this._g2a=new Nm({context:this.context}),this.a=new Pf({context:this.context,gain:0}),this.b=new Pf({context:this.context,gain:0}),this.output=new Pf({context:this.context}),this._internalChannels=[this.a,this.b],this.fade=new Ff({context:this.context,units:"normalRange",value:t.fade}),af(this,"fade"),this.context.getConstant(1).connect(this._panner),this._panner.connect(this._split),this._panner.channelCount=1,this._panner.channelCountMode="explicit",Rf(this._split,this.a.gain,0),Rf(this._split,this.b.gain,1),this.fade.chain(this._g2a,this._panner.pan),this.a.connect(this.output),this.b.connect(this.output)}static getDefaults(){return Object.assign(If.getDefaults(),{fade:.5})}dispose(){return super.dispose(),this.a.dispose(),this.b.dispose(),this.output.dispose(),this.fade.dispose(),this._g2a.dispose(),this._panner.disconnect(),this._split.disconnect(),this}}class cg extends If{constructor(t){super(t),this.name="Effect",this._dryWet=new ug({context:this.context}),this.wet=this._dryWet.fade,this.effectSend=new Pf({context:this.context}),this.effectReturn=new Pf({context:this.context}),this.input=new Pf({context:this.context}),this.output=this._dryWet,this.input.fan(this._dryWet.a,this.effectSend),this.effectReturn.connect(this._dryWet.b),this.wet.setValueAtTime(t.wet,0),this._internalChannels=[this.effectReturn,this.effectSend],af(this,"wet")}static getDefaults(){return Object.assign(If.getDefaults(),{wet:1})}connectEffect(t){return this._internalChannels.push(t),this.effectSend.chain(t,this.effectReturn),this}dispose(){return super.dispose(),this._dryWet.dispose(),this.effectSend.dispose(),this.effectReturn.dispose(),this.wet.dispose(),this}}class lg extends cg{constructor(t){super(t),this.name="LFOEffect",this._lfo=new Om({context:this.context,frequency:t.frequency,amplitude:t.depth}),this.depth=this._lfo.amplitude,this.frequency=this._lfo.frequency,this.type=t.type,af(this,["frequency","depth"])}static getDefaults(){return Object.assign(cg.getDefaults(),{frequency:1,type:"sine",depth:1})}start(t){return this._lfo.start(t),this}stop(t){return this._lfo.stop(t),this}sync(){return this._lfo.sync(),this}unsync(){return this._lfo.unsync(),this}get type(){return this._lfo.type}set type(t){this._lfo.type=t}dispose(){return super.dispose(),this._lfo.dispose(),this.frequency.dispose(),this.depth.dispose(),this}}class hg extends lg{constructor(){const t=Up(hg.getDefaults(),arguments,["frequency","baseFrequency","octaves"]);super(t),this.name="AutoFilter",this.filter=new Um(Object.assign(t.filter,{context:this.context})),this.connectEffect(this.filter),this._lfo.connect(this.filter.frequency),this.octaves=t.octaves,this.baseFrequency=t.baseFrequency}static getDefaults(){return Object.assign(lg.getDefaults(),{baseFrequency:200,octaves:2.6,filter:{type:"lowpass",rolloff:-12,Q:1}})}get baseFrequency(){return this._lfo.min}set baseFrequency(t){this._lfo.min=this.toFrequency(t),this.octaves=this._octaves}get octaves(){return this._octaves}set octaves(t){this._octaves=t,this._lfo.max=this._lfo.min*Math.pow(2,t)}dispose(){return super.dispose(),this.filter.dispose(),this}}class dg extends If{constructor(){const t=Up(dg.getDefaults(),arguments,["pan"]);super(t),this.name="Panner",this._panner=this.context.createStereoPanner(),this.input=this._panner,this.output=this._panner,this.pan=new Mf({context:this.context,param:this._panner.pan,value:t.pan,minValue:-1,maxValue:1}),this._panner.channelCount=t.channelCount,this._panner.channelCountMode="explicit",af(this,"pan")}static getDefaults(){return Object.assign(If.getDefaults(),{pan:0,channelCount:1})}dispose(){return super.dispose(),this._panner.disconnect(),this.pan.dispose(),this}}const pg="bit-crusher";Qm(pg,"\n\tclass BitCrusherWorklet extends SingleIOProcessor {\n\n\t\tstatic get parameterDescriptors() {\n\t\t\treturn [{\n\t\t\t\tname: \"bits\",\n\t\t\t\tdefaultValue: 12,\n\t\t\t\tminValue: 1,\n\t\t\t\tmaxValue: 16,\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 step = Math.pow(0.5, parameters.bits - 1);\n\t\t\tconst val = step * Math.floor(input / step + 0.5);\n\t\t\treturn val;\n\t\t}\n\t}\n");class fg extends cg{constructor(){const t=Up(fg.getDefaults(),arguments,["bits"]);super(t),this.name="BitCrusher",this._bitCrusherWorklet=new mg({context:this.context,bits:t.bits}),this.connectEffect(this._bitCrusherWorklet),this.bits=this._bitCrusherWorklet.bits}static getDefaults(){return Object.assign(cg.getDefaults(),{bits:4})}dispose(){return super.dispose(),this._bitCrusherWorklet.dispose(),this}}class mg extends tg{constructor(){const t=Up(mg.getDefaults(),arguments);super(t),this.name="BitCrusherWorklet",this.input=new Pf({context:this.context}),this.output=new Pf({context:this.context}),this.bits=new Mf({context:this.context,value:t.bits,units:"positive",minValue:1,maxValue:16,param:this._dummyParam,swappable:!0})}static getDefaults(){return Object.assign(tg.getDefaults(),{bits:12})}_audioWorkletName(){return pg}onReady(t){Nf(this.input,t,this.output);const e=t.parameters.get("bits");this.bits.setParam(e)}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this.bits.dispose(),this}}class gg extends cg{constructor(){const t=Up(gg.getDefaults(),arguments,["order"]);super(t),this.name="Chebyshev",this._shaper=new nm({context:this.context,length:4096}),this._order=t.order,this.connectEffect(this._shaper),this.order=t.order,this.oversample=t.oversample}static getDefaults(){return Object.assign(cg.getDefaults(),{order:1,oversample:"none"})}_getCoefficient(t,e,n){return n.has(e)||(0===e?n.set(e,0):1===e?n.set(e,t):n.set(e,2*t*this._getCoefficient(t,e-1,n)-this._getCoefficient(t,e-2,n))),n.get(e)}get order(){return this._order}set order(t){kp(Number.isInteger(t),"'order' must be an integer"),this._order=t,this._shaper.setMap(e=>this._getCoefficient(e,t,new Map))}get oversample(){return this._shaper.oversample}set oversample(t){this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.dispose(),this}}class _g extends cg{constructor(t){super(t),this.name="FeedbackEffect",this._feedbackGain=new Pf({context:this.context,gain:t.feedback,units:"normalRange"}),this.feedback=this._feedbackGain.gain,af(this,"feedback"),this.effectReturn.chain(this._feedbackGain,this.effectSend)}static getDefaults(){return Object.assign(cg.getDefaults(),{feedback:.125})}dispose(){return super.dispose(),this._feedbackGain.dispose(),this.feedback.dispose(),this}}class yg extends _g{constructor(){const t=Up(yg.getDefaults(),arguments,["pitch"]);super(t),this.name="PitchShift",this._frequency=new Ff({context:this.context}),this._delayA=new Gf({maxDelay:1,context:this.context}),this._lfoA=new Om({context:this.context,min:0,max:.1,type:"sawtooth"}).connect(this._delayA.delayTime),this._delayB=new Gf({maxDelay:1,context:this.context}),this._lfoB=new Om({context:this.context,min:0,max:.1,type:"sawtooth",phase:180}).connect(this._delayB.delayTime),this._crossFade=new ug({context:this.context}),this._crossFadeLFO=new Om({context:this.context,min:0,max:1,type:"triangle",phase:90}).connect(this._crossFade.fade),this._feedbackDelay=new Gf({delayTime:t.delayTime,context:this.context}),this.delayTime=this._feedbackDelay.delayTime,af(this,"delayTime"),this._pitch=t.pitch,this._windowSize=t.windowSize,this._delayA.connect(this._crossFade.a),this._delayB.connect(this._crossFade.b),this._frequency.fan(this._lfoA.frequency,this._lfoB.frequency,this._crossFadeLFO.frequency),this.effectSend.fan(this._delayA,this._delayB),this._crossFade.chain(this._feedbackDelay,this.effectReturn);const e=this.now();this._lfoA.start(e),this._lfoB.start(e),this._crossFadeLFO.start(e),this.windowSize=this._windowSize}static getDefaults(){return Object.assign(_g.getDefaults(),{pitch:0,windowSize:.1,delayTime:0,feedback:0})}get pitch(){return this._pitch}set pitch(t){this._pitch=t;let e=0;t<0?(this._lfoA.min=0,this._lfoA.max=this._windowSize,this._lfoB.min=0,this._lfoB.max=this._windowSize,e=_f(t-1)+1):(this._lfoA.min=this._windowSize,this._lfoA.max=0,this._lfoB.min=this._windowSize,this._lfoB.max=0,e=_f(t)-1),this._frequency.value=e*(1.2/this._windowSize)}get windowSize(){return this._windowSize}set windowSize(t){this._windowSize=this.toSeconds(t),this.pitch=this._pitch}dispose(){return super.dispose(),this._frequency.dispose(),this._delayA.dispose(),this._delayB.dispose(),this._lfoA.dispose(),this._lfoB.dispose(),this._crossFade.dispose(),this._crossFadeLFO.dispose(),this._feedbackDelay.dispose(),this}}class vg extends If{constructor(){const t=Up(vg.getDefaults(),arguments,["solo"]);super(t),this.name="Solo",this.input=this.output=new Pf({context:this.context}),vg._allSolos.has(this.context)||vg._allSolos.set(this.context,new Set),vg._allSolos.get(this.context).add(this),this.solo=t.solo}static getDefaults(){return Object.assign(If.getDefaults(),{solo:!1})}get solo(){return this._isSoloed()}set solo(t){t?this._addSolo():this._removeSolo(),vg._allSolos.get(this.context).forEach(t=>t._updateSolo())}get muted(){return 0===this.input.gain.value}_addSolo(){vg._soloed.has(this.context)||vg._soloed.set(this.context,new Set),vg._soloed.get(this.context).add(this)}_removeSolo(){vg._soloed.has(this.context)&&vg._soloed.get(this.context).delete(this)}_isSoloed(){return vg._soloed.has(this.context)&&vg._soloed.get(this.context).has(this)}_noSolos(){return!vg._soloed.has(this.context)||vg._soloed.has(this.context)&&0===vg._soloed.get(this.context).size}_updateSolo(){this._isSoloed()||this._noSolos()?this.input.gain.value=1:this.input.gain.value=0}dispose(){return super.dispose(),vg._allSolos.get(this.context).delete(this),this._removeSolo(),this}}vg._allSolos=new Map,vg._soloed=new Map;class bg extends If{constructor(){const t=Up(bg.getDefaults(),arguments,["pan","volume"]);super(t),this.name="PanVol",this._panner=this.input=new dg({context:this.context,pan:t.pan,channelCount:t.channelCount}),this.pan=this._panner.pan,this._volume=this.output=new zf({context:this.context,volume:t.volume}),this.volume=this._volume.volume,this._panner.connect(this._volume),this.mute=t.mute,af(this,["pan","volume"])}static getDefaults(){return Object.assign(If.getDefaults(),{mute:!1,pan:0,volume:0,channelCount:1})}get mute(){return this._volume.mute}set mute(t){this._volume.mute=t}dispose(){return super.dispose(),this._panner.dispose(),this.pan.dispose(),this._volume.dispose(),this.volume.dispose(),this}}class wg extends If{constructor(){const t=Up(wg.getDefaults(),arguments,["volume","pan"]);super(t),this.name="Channel",this._solo=this.input=new vg({solo:t.solo,context:this.context}),this._panVol=this.output=new bg({context:this.context,pan:t.pan,volume:t.volume,mute:t.mute,channelCount:t.channelCount}),this.pan=this._panVol.pan,this.volume=this._panVol.volume,this._solo.connect(this._panVol),af(this,["pan","volume"])}static getDefaults(){return Object.assign(If.getDefaults(),{pan:0,volume:0,mute:!1,solo:!1,channelCount:1})}get solo(){return this._solo.solo}set solo(t){this._solo.solo=t}get muted(){return this._solo.muted||this.mute}get mute(){return this._panVol.mute}set mute(t){this._panVol.mute=t}_getBus(t){return wg.buses.has(t)||wg.buses.set(t,new Pf({context:this.context})),wg.buses.get(t)}send(t,e=0){const n=this._getBus(t),r=new Pf({context:this.context,units:"decibels",gain:e});return this.connect(r),r.connect(n),r}receive(t){return this._getBus(t).connect(this),this}dispose(){return super.dispose(),this._panVol.dispose(),this.pan.dispose(),this.volume.dispose(),this._solo.dispose(),this}}wg.buses=new Map;const xg=ff().transport;ff().destination,ff().destination;ff().listener;ff().draw;ff();const Sg={synth:{new:t=>new Fm(t)},amsynth:{new:t=>new Bm(t)},duosynth:{new:t=>new zm(t)},fmsynth:{new:t=>new Wm(t)},membranesynth:{new:t=>new Xm(t)},metalsynth:{new:t=>new Hm(t)},monosynth:{new:t=>new Gm(t)},noisesynth:{new:t=>new Km(t)},plucksynth:{new:t=>new og(t)},polysynth:{new:(t,e)=>new sg(t,e)},sampler:{new:t=>new ag(t)}},Tg={synth:Fm,monosynth:Gm,fmsynth:Wm,duosyntho:zm,amsynth:Bm},kg={autofilter:{new:t=>new hg(t)},bitcrusher:{new:t=>new fg(t)},chebyshev:{new:t=>new gg(t)},pitchshift:{new:t=>new yg(t)}},Ag=(t,e,n=!1)=>{try{if(e?.effect){return n?(globalThis.sound[t].set(e.effect.options),globalThis.sound[t]):kg[e.effect.type]?.new(e.effect.options)}throw"effect is not defined in the config"}catch(t){return}},Eg=()=>{globalThis.sound={}},Og=()=>{"started"!==xg.state&&(pf.resume(),xg.start())},Cg=t=>{globalThis.sound[t]&&(globalThis.sound[t].dispose(),delete globalThis.sound[t])},Mg={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"]},Ig=(t,e=0)=>{const n=1+Math.floor((t-24)/12);return Mg[t-12*(n-1)][e]+String(n)},Ng=t=>{const e=t[qg.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[qg.REFNODE]},u=Sn("accio","data_accio");(n?v_(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[qg.sound.CONFIG]=e});const c=(e=void 0)=>{if(e){const o=e._content.soundnode_trail.slice(-1)[0],a=t[qg.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[qg.REFNODE])}}},l=(e=void 0)=>{let n,s;e?(n=Tn("soundconfig",e),t[qg.sound.CONFIG]=n):n=t[qg.sound.CONFIG],s=r?((t,e,n=!1)=>{try{if(e?.instrument)return n?(globalThis.sound[t].set(e.instrument.options),globalThis.sound[t]):Sg[e.instrument.type]?.new(e.instrument.voice?Tg[e.instrument.voice]:Fm,e.instrument.options);throw"instrument is not defined in the config"}catch(t){return}})(t[qg.REFNODE],n):i?void 0:o?Ag(t[qg.REFNODE],n,void 0!==t[qg.sound.SOUNDSTAGE]):Ag(t[qg.REFNODE],n),t[qg.sound.SOUNDSTAGE]=s,((t,e)=>{globalThis.sound[t]=e})(t[qg.REFNODE],s)};return{leaflogic:(e,n)=>{const r=new _t(void 0),i=n._stream.pipe(ut(e=>(t[qg.CTRLIN]=e,e)),at(...e.map(t=>t._stream)),ut(e=>{const n=e.slice(1).flat().map(t=>{if("_data_in"===t._bname)return Tn("*",t);if("_midi_in"===t._bname)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[qg.CTRLIN]}),ft());return{_stream:r.pipe(gt(t=>t)),_control:{_stream:i}}},datalogic:{pre:e=>{const n=e;return t[qg.sound.SOUNDSTAGE]||s||l(),s&&Og(),n},post:e=>{Array.isArray(e);let n=e.map(e=>{if("_midi_in"===e._bname){const n=t[qg.sound.SOUNDSTAGE];if(e._content.velocity>0){const t=Ig(e._content.noteNumber),r=e._content.duration;r?n.triggerAttackRelease(t,r):n.triggerAttack(t)}else{const t=Ig(e._content.noteNumber);n.triggerRelease(t)}return kn}return e});n=1===n.length?n[0]:n;return n}}}},Rg=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in gnav.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/gnav.js"},{}),Dg=t=>{const e=t[qg.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[qg.REFNODE]};let s={};return{leaflogic:(e,n)=>{s=n._config;const a=new dt,u=r?k_(n,e,void 0,o,{leaflogic:r,datalogic:{post:e=>(t[qg.gnav.EDGES]=e,e)}}):{_stream:He([]),_control:n._stream},c=(i?k_(u._control,e,void 0,o,{leaflogic:i,datalogic:{post:e=>(t[qg.gnav.BACKDROP]=e,e)}}):{_stream:He("/assets/test/hubbleinfrared_dark2.jpg"),_control:u._control})._control._stream.pipe(at(...e.map(t=>t._stream)),ut(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=>Tn("screenio",t)).filter(t=>t):Tn("screenio",t),post:r=>{const i=r,o=Tn(t[qg.gnav.EDGES]),a=(o||[]).map(t=>({...t,uuid:Zn()})),u=t[qg.gnav.BACKDROP],c=new _t(Rg),l=Ug({element:{nodeuuid:t[qg.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 v_(t,[],{...s}):[]},tagaction:async r=>{const i="tagaction"in e&&"_default"in e.tagaction?e.tagaction._default:void 0,o=i?await v_(i,r,{...s}):r;return n&&c.next(Sn("elementio",{element:"gnav",nodeuuid:t[qg.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 v_(n,t,{...s}):t},graph_options:{layout:"3d"},...t[qg.RTCONTEXT]}}},"screenio");return l}}}},Pg=t=>{const e=t[qg.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[qg.REFNODE]},o=async(n,r={})=>{let i=t[qg.http.URI],o=t[qg.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&&Ue(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=qg.DOMAIN?t[qg.DOMAIN]:void 0,h=qg.APPID?t[qg.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)}):He([{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"}):He([{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 dt,u=n?k_(s,e,void 0,i,{leaflogic:n,datalogic:{post:e=>(t[qg.http.URI]=e,e)}}):(t[qg.http.URI]="{*}",{_stream:new _t("{*}"),_control:{_stream:s._stream}}),c=r?k_(s,e,void 0,i,{leaflogic:r,datalogic:{post:e=>(t[qg.http.HEADER]=e,e)}}):(t[qg.http.HEADER]="",{_stream:new _t(""),_control:{_stream:s._stream}}),l=rn([u._control._stream,c._control._stream]),h=rn([u._stream,c._stream]),d=l.pipe(at(h),ut(t=>t[0]));let p=!1;const f=d.pipe(at(...e.map(t=>t._stream)),ct(t=>o(t.slice(1),t[0])),ut(e=>(p=!0,e?.length>1||!Array.isArray(e)?a.next(e):1===e?.length&&a.next(e[0]),t[qg.CTRLIN])),ft());return{_stream:a.pipe(gt(t=>p),ut(t=>t),ft()),_control:{_stream:f.pipe(ut(t=>t),ft())}}},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 Ug(e?.name&&"AxiosError"===e.name?{error:e.message,data:e.response.data}:n(e),"elementio")}}}},jg=t=>{const e=t[qg.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[qg.REFNODE]},i=async e=>{let n=t[qg.href.URI],r=e;r=1===r.length?r[0]:r,"{*}"===n&&Ue(r)&&"href-request"===r._bname&&(n=r._content.uri?r._content.uri:"https://www.leafgon.com",r=r._content.data?r._content.data:"");const i=n,o=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:i}),1e3);return await o()};return{leaflogic:(e,o)=>{const s=new dt,a=n?k_(o,e,void 0,r,{leaflogic:n,datalogic:{post:e=>(t[qg.href.URI]=e,e)}}):(t[qg.href.URI]="{*}",{_stream:new _t("{*}"),_control:{_stream:o._stream}}),u=a._control._stream,c=a._stream,l=u.pipe(at(c),ut(t=>t[0]));let h=!1;const d=l.pipe(at(...e.map(t=>t._stream)),ct(t=>i(t.slice(1))),ut(e=>(h=!0,e?.length>1||!Array.isArray(e)?s.next(e):1===e?.length&&s.next(e[0]),t[qg.CTRLIN])),ft());return{_stream:s.pipe(gt(t=>h),ut(t=>t),ft()),_control:{_stream:d.pipe(ut(t=>t),ft())}}},datalogic:{pre:t=>t}}};var Lg=n(639);const Fg=t=>{const e=new dt,n=new dt,r=new dt,i=t[qg.LAMBDA_OBJ],o="_default"in i?i._default:void 0,s={codebase:"ghostos/api/parser/nodelogic/elements/library/html.js",...t},a=Sn("accio","ctrl_accio"),u=Sn("accio","data_accio"),c=o?k_({_stream:He(a)},[{_stream:He(u)}],void 0,s,{leaflogic:o,datalogic:{post:t=>t}}):{_stream:He(""),_control:{_stream:He(a)}};t[qg.html.TEMPLATE]=void 0,Je(c._control._stream.pipe(at(c._stream))).then(e=>{const n=typeof e[1];if("string"===n)t[qg.html.TEMPLATE]={_default:Lg.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]=Lg.compile(r))}),Object.keys(n).length>0&&(t[qg.html.TEMPLATE]=n)}Lg.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('${ze.hp.from(t).toString("base64")}')`}),Lg.registerHelper("json",function(t){const e=ze.hp.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}'))`}),Lg.registerHelper("tostring",function(t){return String(t)}),r.next()});return{elementio$:n,leaflogic:(i,o)=>{const s=o._stream.pipe(at(...i.map(t=>t._stream)),ct(e=>{const i=new _t(e[0]),o=new _t(e[1]);return t[qg.html.TEMPLATE]?rn(i,Et(o,n)):r.pipe(at(i,Et(o,n)),ut(t=>t[1]))}),ut(r=>{const i=t[qg.html.TEMPLATE],o=r[1];if(Ue(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=>Tn("*",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(Ue(t)){const n=Tn("*",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=Ug({element:{nodeuuid:t[qg.REFNODE],type:"html",componentdata:{innerhtml:s,callback:t=>{n.next(Sn("elementio",t))},...t[qg.RTCONTEXT]}}},"screenio");return e.next(a),r[0]}}),gt(t=>void 0!==t));return{_stream:e,_control:{_stream:s}}},datalogic:{pre:t=>t,post:t=>t}}},$g=t=>{const e=new dt,n=new dt,r=new dt,i=t[qg.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=Sn("accio","ctrl_accio"),c=Sn("accio","data_accio"),l=o?k_({_stream:He(u)},[{_stream:He(c)}],void 0,a,{leaflogic:o,datalogic:{post:t=>t}}):{_stream:He(""),_control:{_stream:He(u)}};t[qg.html.TEMPLATE]=void 0,Je(l._control._stream.pipe(at(l._stream))).then(e=>{const n=typeof e[1];if("string"===n)t[qg.html.TEMPLATE]={_default:Lg.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]=Lg.compile(r))}),Object.keys(n).length>0&&(t[qg.html.TEMPLATE]=n)}Lg.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(at(...i.map(t=>t._stream)),ct(e=>{const i=new _t(e[0]),o=new _t(e[1]);return t[qg.html.TEMPLATE]?rn(i,Et(o,n)):r.pipe(at(i,Et(o,n)),ut(t=>t[1]))}),ut(n=>{const r=t[qg.html.TEMPLATE],i=n[1];if(Ue(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[qg.REFNODE].slice(0,8)}', _content: formData, _label: {refnode: '${t[qg.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[qg.REFNODE]}')\n );\n <\/script>\n `,n=`\n <div id='${t[qg.REFNODE]}'></div>\n `,r=t=>t.replace(/(\r\n|\n|\r)/gm,"").replace(/(\s+)/gm," "),i=t[qg.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 Sn(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[qg.REFNODE]})})();return e.next(r),n[0]}}),gt(t=>void 0!==t));return{_stream:e,_control:{_stream:a}}},datalogic:{pre:t=>t,post:t=>t}}},Bg=t=>{const e=t[qg.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=>{const r=t[qg.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=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&&(Tu.defaults.headers.post["X-CSRF-Token"]=r.X_CSRF_Token);try{const t=s.includes("put")?Tu.put(e,i):Tu.post(e,i);return await t}catch(t){return t.response||t.request,t.response}}else try{const t=e?Tu.get(e):He([{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[qg.REFNODE]};return{leaflogic:(e,s)=>{const a=new dt,u=n?k_(s,e,void 0,o,{leaflogic:n,datalogic:{post:e=>(t[qg.http.URI]=e,e)}}):{_stream:He("https://httpbin.org"),_control:{_stream:s._stream}},c=r?k_(s,e,void 0,o,{leaflogic:r,datalogic:{post:e=>(t[qg.http.HEADER]=e,e)}}):{_stream:He(""),_control:{_stream:s._stream}},l=rn([u._control._stream,c._control._stream]),h=rn([u._stream,c._stream]),d=l.pipe(at(h),ut(t=>t[0]));let p=!1;const f=d.pipe(at(...e.map(t=>t._stream)),ct(t=>i(t.slice(1))),ut(e=>(p=!0,e?.length>1||!Array.isArray(e)?a.next(e):1===e?.length&&a.next(e[0]),t[qg.CTRLIN])),ft());return{_stream:a.pipe(gt(t=>p),ut(t=>t),ft()),_control:{_stream:f.pipe(ut(t=>t),ft())}}},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 Ug(e(t),"elementio")}}}},qg={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"}},Ug=(t,e="defaultio",n=!0)=>n?Sn(e,t):t,Vg={mediaplayer:Au,http:Pg,gnav:Dg,popup:Mu,image:Du,editor:Nu,text:Ru,prompt:Ou,mediainput:ju,midi:$u,sound:Ng,html:Fg,href:jg,form:$g,directus:Bg},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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=n.leaf.logic.args.elementname,a=t.gos.etaTree.domain,u=t.gos.etaTree.appid,c="domain"in o&&"_default"in o.domain?o.domain._default:void 0,l="appid"in o&&"_default"in o.appid?o.appid._default:void 0,h="uidefs"in o&&"_default"in o.uidefs?o.uidefs._default:void 0,d="edges"in o&&"_default"in o.edges?o.edges._default:void 0,p="elementio"in o;["f30e","7a65"].includes(e.slice(0,4));const f={codebase:"leafelement.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};let m={};m[qg.LAMBDA_OBJ]=o,m[qg.REFNODE]=e,m[qg.RTCONTEXT]={graphdomain:a,graphappid:u,refnodedata:n,nodelambda:r,contextuallambda:i};const g=((t,e)=>Object.keys(Vg).includes(e)&&Vg[e]?{...Vg[e](t)}:void 0)(m,s);return(n,r)=>{e?.slice(0,4);const i=r._stream.pipe(ut(e=>(m[qg.CTRLIN]=e,m[qg.DOMAIN]=t.gos.etaTree.domain,m[qg.APPID]=t.gos.etaTree.appid,e)));(t=>{t.pipe(Xe(t=>{const e=rn(n.map(t=>t._stream)),i=He(t),a=k_({_stream:i},n,void 0,{...f,step:"get the current domain"},{leaflogic:c,datalogic:{pre:t=>{m._input_data=t},post:t=>(m.domain=t,t)}}),u=k_(a._control,n,void 0,{...f,step:"get the current domain"},{leaflogic:l,datalogic:{post:t=>(m.appid=t,t)}});if(["http"].includes(s)){const t="uri"in o&&"_default"in o.uri?o.uri._default:void 0,s="header"in o&&"_default"in o.header?o.header._default:void 0,c=t?x_(t,e,void 0,i,{...r._config}):{_stream:He([]),_control:{_stream:i}},l=s?x_(s,e,void 0,i,{...r._config}):{_stream:He([]),_control:{_stream:i}},h=rn([a._control._stream,u._control._stream,c._control._stream,l._control._stream]).pipe(ut(t=>t[0])),d={};return h.pipe(ut(t=>rn([...n.map(t=>t._stream),a._stream,u._stream,c._stream,l])),Xe(t=>{d._metadata=t;const e=Object.keys(o),n=["uri","post","put","get","header","?graph"].filter(t=>e.includes(t)),r=n.includes("?graph")?t[3]+`?graph=${t[1]}/${t[2]}`:t[3];if(n.includes("post")||n.includes("put")){t[4].X_CSRF_Token&&(Tu.defaults.headers.post["X-CSRF-Token"]=t[4].X_CSRF_Token);try{return n.includes("put")?Tu.put(r,t[0]):Tu.post(r,t[0])}catch(t){t.response||t.request}}else try{return Tu.get(r)}catch(t){t.response||t.request}}),ut(t=>{const e=t=>{const n=typeof t;return"object"===n?Array.isArray(t)?t.map(t=>e(t)):Object.fromEntries(Object.entries(t).map(([t,n])=>[t,e(n)])):"string"===n?(t=>{var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return t.replace(/[&<>"']/g,function(t){return e[t]})})(t):t};return((t,e="defaultio")=>p?Sn(e,t):t)(e(t.data),"elementio")}))}if(["mediaplayer"].includes(s)){const t="uri"in o&&"_default"in o.uri?o.uri._default:void 0,s=t?x_(t,e,void 0,i,{...r._config}):{_stream:He([])};return rn([a._control._stream,u._control._stream,s._control._stream]).pipe(ut(t=>t[0])).pipe(ut(t=>rn([...n.map(t=>t._stream),a._stream,u._stream,s._stream])))}if(["gnav","popup","image","editor","text","prompt"].includes(s)){const t=h?k_(u._control,n,void 0,f,{leaflogic:h,datalogic:{post:t=>(m.uidefs=t,t)}}):void 0,e=k_(h?t._control:u._control,n,void 0,f,{leaflogic:d,datalogic:{post:t=>(m.edges=t,t)}}),r="backdrop"in o&&"_default"in o.backdrop?o.backdrop._default:void 0;return("gnav"==s?r?k_(e._control,n,void 0,f,{leaflogic:r,datalogic:{post:t=>(m.backdrop=t,t)}}):{_stream:He("/assets/test/hubbleinfrared_dark2.jpg"),_control:{_stream:i}}:{_stream:He([]),_control:{_stream:i}})._control._stream.pipe(ut(t=>[m._input_data,m.domain,m.appid,m.uidefs,m.edges,m.backdrop]))}}))})(i),"elementio$"in g&&(t.gos.etaTree.leafio.elementioLUT[e]=g.elementio$);return k_({_stream:i},n,void 0,{...f,metastep:"element "+s},{leaflogic:g?g.leaflogic:void 0,datalogic:{pre:g?g.datalogic.pre:void 0,post:g?g.datalogic.post:void 0}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({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,t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:Mo(JSON.stringify(i))}})},getTextSource:()=>n.leaf.logic.args.elementconfig},general:{getNodeData:()=>n,getLambdaLUT:async()=>{const n=await Qg({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:Mo(JSON.stringify(i))}})}}}}};function zg(t,e,n){const r={leafoutflowport:xn,leafinflowport:wn,leafscreenio:An,leafmemoryio:Hn,leafdeckspade:ts,leafdeckheart:ns,leafdeckdiamond:is,leafdeckclub:ss,leafgnav:as,leafpopupview:us,leafelement:Gg,leafgraph:p_,leaflambdagraph:e_,leafanchor:f_,leafspell:r_,leafspelldef:i_,leafloopyspell:u_,leafchronosflow:Uo,leafasyncflow:Uo,leafmixflow:Vo,leafgateflow:zo,leaflisp:qo,leaflabel:Jo,leafdelabel:Ho,leafbottle:Xo,leafunbottle:Ko,leafcrate:Yo,leafconfig:Zo};return r[t][e]?r[t][e](n):void 0}const{memoize:Wg}=bn,Jg={isdebug:!1},Hg=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in eta.js",codebase:"/src/ghostos/api/parser/eta.js"},{}),Xg=(t,e)=>([...Array(e).keys()].map(e=>{t[e]=!1}),t),Kg=(t,e={time:-1,count:-1},n=void 0,r={})=>{const i=new dt,o=t.map(t=>t._control._stream),s=t.map(t=>t._stream),a={};let u={};const c=t.length;Xg(a,c);return{ctrl:n&&n.synchronized?Et(...t.map((t,e)=>t._control._stream.pipe(at(t._stream),ut(t=>[e,t])))).pipe(ut(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)){Xg(a,c);const t=Object.values(u);return u={},t}}),gt(t=>void 0!==t),ut(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}}),gt(t=>void 0!==t)):o.length>1?Et(...o.map((t,e)=>t.pipe(at(s[e]),ut(t=>{const e=t[0];e.length>1&&e.includes(void 0),r.nodeuuid,Ue(t[1])&&t[1]._bname;let n=t.slice(1);return i.next(n),e})))):o[0].pipe(at(s[0]),ut(t=>{const e=t[0];Ue(t[1])&&t[1]._bname;let n=t[1];return i.next(n),e})),data:i.pipe(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Hg)))}},Yg=(t,e,n,r,i,o,s)=>{const a={refnode:t,codebase:"eta.js weaveDataflowPlane",domain:i.domain,appid:i.appid},u=Sn("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(ut(t=>t)),_control:{_stream:c[t].ctrl_out._stream.pipe(ut(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(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Hg)),ut(t=>(["c10cbbbb-14d5-4270-b17a-1965afcabc98"].includes(o),Ue(t)&&t._bname,["c822ae2e-1be8-46be-b2cb-21a43cef0555","e9e6e44b-792b-46d0-b1d3-58ce2f46c45b"].includes(o)&&Ue(t)&&t._bname,t)))),data_out:void 0,ctrl_in$Arr:e.map((t,e)=>t._stream.pipe(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Hg)),ut(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:Et(...c[t].get_composite_in$objArr().map(t=>t._control._stream)),data:void 0}:Kg(c[t].get_composite_in$objArr(),{time:-1,count:-1},c[t],{...a,...m,at:"eta.js _weaveDataflowPlane",nodeuuid:t}),v={_stream:_.pipe(ut(t=>t))},b=g?c[t].get_composite_in$objArr().map((t,e)=>({_stream:t._stream.pipe(ut(t=>t))})):[{_stream:y.pipe(ut(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(ut(t=>t)),_control:{_stream:e._control._stream.pipe(ut(t=>t))}}}{const e=d._default(b,v);return c[t].data_out={_stream:e._stream.pipe(ut(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(ut(t=>t))},{_stream:c[t].data_out._stream.pipe(ut(t=>t)),_control:{_stream:c[t].ctrl_out._stream.pipe(ut(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(ut(t=>t)),_control:{_stream:e._control._stream.pipe(ut(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(ut(t=>t)),_control:{_stream:e._control._stream.pipe(ut(t=>t))}}}{const e=b.map(t=>({_stream:t._stream.pipe(ut(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(ut(t=>t)),_control:{_stream:n._control._stream.pipe(ut(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 dt;return{ctrl:Et(...t.map(t=>{let e;return t._control._stream.pipe(ut(t=>(e=globalThis.TRACEON?{...t,traces:T_(t?.traces,{...n,desc:"doChronosAsynchronize(), a ctrl signal came through out of inputcount of "+r},!0)}:t,e)),at(t._stream),ut(t=>(i.next(2===t.length?t[1]:t.slice(1)),t[0])),ft())})).pipe(ut(t=>t)),data:i.pipe(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Hg)))}})(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]},Zg=Wg(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=>{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(s=[],u)=>{const c={data_in:new dt,ctrl_in:new dt,data_out:new dt,ctrl_out:new dt},l={_stream:c.data_in},h={_stream:c.ctrl_in,_config:{}};["3980759d-7c59-4b9e-b799-87b5fd4cbcec","62890d97-837a-463e-aac9-d7fca2293427"].includes(t),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t);const[d]=Yg(t,e,n,r,i,h,l);return k_(u,s,void 0,{...a,metastep:"invoking parseDataflowFunc()"},{leaflogic:(t,e)=>{const n=new dt;let r;const i=e._stream.pipe(ut(t=>(r=t,t)),at(...t.map(t=>t._stream)),ct(e=>{o.refnode,t.length;const n=1===t.length?e[1]:e.slice(1);return setTimeout(()=>{c.data_in.next(n),c.ctrl_in.next(r)},1),d._control._stream}),at(d._stream),ut(t=>{if(Ue(t[1])&&"error"===t[1]._bname);else{const e=t[1];void 0!==e&&n.next(e)}return t[0]}),ft());return{_stream:n.pipe(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Hg))),_control:{...e,_stream:i}}},datalogic:{}})}})(t,i,o,s,r);return u},({refnode:t,component_members:e,contextuallambda:n,etaTree:r}={})=>JSON.stringify([...e,...n,r.sessionid])),Qg=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=Zg({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},t_=(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 Wn(h).getEtaTree(t,e);return o?await h.etaReduceLEAFNode({nodeuuid:n,contextuallambda:i}):await Qg({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=zg(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=zg(r.type,"methods",i);if(o&&!(t in h.leafnodemethods))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 Tu.get(t);h.esmcache[t]=e.data}return h.esmcache[t]},initTree:(t,e,n,r,i)=>{h.config=Jg,h.leafgraph=t,h.graphcomponents=e,h.rootgraphstate="initialized",h.leafio=n,h.leaflakeio=r,h.mnemosyne=i,h.esmcache={},void 0===h.hostEtaTree&&Wn(h).initEtaTreeForest();return h.etaReduceLEAFNode=Wg(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=zg(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=Zn(),h},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)}) has a leaflambdagraph node (${e}) referencing an undefined lambda construct.`;const o=await Qg({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{...vn(t),_control:e}}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({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}},n_=t=>Object.keys(t).map(e=>0===Object.keys(t[e]).length?e:void 0).filter(t=>t).sort(),r_={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 Qg({refnode:e,nodelambda:r,contextuallambda:a,etaTree:t.gos.etaTree});const c=n_(u);let l;c.length>0&&(a=a.concat(c),u=await Qg({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 r=e[n];"accio"===n&&t.slice(0,4);const s=await o.etaReduceLEAFNode({nodeuuid:r,contextuallambda:i});return"accio"===n&&t.slice(0,4),s}},d={codebase:"leafspell.js",refnode:e,leafnode:t.gos.etaTree?.leafgraph?.graph.dataflow.getNodeAttributes(e).leafnode.data};let p=s?void 0:S_((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=k_({...r,_stream:n.pipe(ut(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(at(c._stream),ut(t=>(t[0].sid?.pop(),t)),Pu(()=>{}))},c=k_(r,n,void 0,{...d,metastep:"executing spell "+o},{leaflogic:s?(e,n)=>{const r=new dt,i=new dt,o=new dt,s=new dt,a=new dt;let c;const l=e.length>1?Et(...e.map(t=>t._stream)):e[0]._stream,h=n._stream.pipe(at(l),ct(e=>{const n=e[1];if(Ue(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}),at(s),ut(t=>(r.next(t[1][1]),a.next(t[1][0]),t[1])),at(a),ut(t=>t[1]),Pu(()=>{void 0!==c&&(c.unsubscribe(),c=void 0)}),ft());return{_stream:r,_control:{...n,_stream:h}}}:(t,e)=>{const n=new dt,r=new dt,i=new dt,o=new dt,s=new dt;let a;const c=e._stream.pipe(at(...t.map(t=>t._stream)),ct(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)),at(o),ut(t=>(n.next(t[1][1]),s.next(t[1][0]),t[1])),at(s),ut(t=>t[1]),Pu(()=>{void 0!==a&&(a.unsubscribe(),a=void 0)}),ft());return{_stream:n,_control:{...e,_stream:c}}},datalogic:{pre:i,post:a}});return{_stream:c._stream.pipe(ut(t=>t),ft()),_control:{_stream:c._control._stream.pipe(ut(t=>t),ft())}}}},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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});const n=n_(a);n.length>0&&(u=u.concat(n),a=await Qg({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 r=e[n];"accio"===n&&t.slice(0,4);const s=await o.etaReduceLEAFNode({nodeuuid:r,contextuallambda:i});return"accio"===n&&t.slice(0,4),s}};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}},i_={dataflow:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...vn(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 Qg({refnode:e,nodelambda:o,contextuallambda:i,etaTree:t.gos.etaTree,addnodelut:!0,metadata:{codebase:"leafspelldef.js",context:"reduced_lambdalambda_obj"}}),u=await Qg({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 Qg({refnode:e,nodelambda:o,contextuallambda:i,etaTree:t.gos.etaTree,addnodelut:!0,metadata:{codebase:"leafspelldef.js",context:"reduced_lambdalambda_obj"}}),u=await Qg({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)}}};var o_=function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=cn);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}(dt);const s_=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in leafloopyspell.js",codebase:"/src/ghostos/api/parser/nodelogic/abstraction/leafloopyspell.js"},{}),a_=()=>{let t=0;return e=>{const n=Date.now();return n-t>=e&&(t=n,!0)}},u_={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 Qg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});["7b1f"].includes(e.slice(0,4));const s="bypass"in o,a={codebase:"leafloopyspell.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data},u=(t=>{if(!t)return 1;if(Object.keys(t).filter(t=>"&"===t).length>0)return;const e=Object.keys(t).filter(t=>/^\d+$/.test(t)).map(t=>parseInt(t)).sort();return e.length>0?e[e.length-1]:1})(o),c="forever"in o,l=a_(),h=a_();return o&&"_default"in o?(t,n)=>{["7b1f"].includes(e?.slice(0,4));const r={_stream:n._stream.pipe(ut(t=>l(200)?t:void 0),gt(t=>void 0!==t),Xe(t=>At([...Array(u).keys()]).pipe(ut(e=>({...t,_label:{...t._label,loopyidx:e}})))))};if(!o||!("_default"in o)){return k_(r,t,void 0,{...a,metastep:"relaying input data as is due to error condition"})}let i=0,h=[];let d,p=new _t(s_),f=new o_(1);const m=r._stream.pipe(ct(t=>(d=t,p.next(t),p)),lt(f));return k_({_stream:m},t,void 0,{...a,metastep:"executing a loopy spell with idx "+i},{leaflogic:o._default,datalogic:{pre:t=>{const e=t;return s||h.push(t),e},post:t=>{if(i+=1,(c||i<u)&&p.next(d),!s)return h[0];if("stream"in o)return t;if(h.push(t),i===u){const t=[...h];return h=[],i=0,t}}}})}:o&&"await"in o?(t,e)=>{const n={_stream:e._stream.pipe(ut(t=>h(10)?t:void 0),gt(t=>void 0!==t),ut(t=>[...Array(u).keys()].map(e=>({...t,_label:{...t._label,loopyidx:e}}))))};if(!o.await||!("_default"in o.await)){return k_(n,t,void 0,{...a,metastep:"relaying input data as is due to error condition"})}let r=0,i=[];const c=t=>{const e=t;return s||i.push(t),e};let l=new dt,d=new dt,p=new dt;const f=new dt,m=new dt;let g,_;const y=new dt,v=new dt,b=o.await._default([{_stream:y}],{_stream:v}),w=n._stream.pipe(at(...t.map(t=>t._stream)),ct(t=>{const e=t[0],n=t[1];if(g=e,void 0!==_&&!_.closed)return d.next(n),l.next(e),m;r=0,i=[],p.next();const h=k_({_stream:l},[{_stream:d}],void 0,{...a,metastep:"executing a loopy spell with idx "+r},{datalogic:{pre:c,post:t=>{if(r+=1,!s)return i[0];if("stream"in o)return t;if(i.push(t),r===u){const t=[...i];return i=[],r=0,1===u?t[0]:t}}}});let w;return _=h._control._stream.pipe(at(h._stream),ct(t=>(w=t,y.next(t[1]),v.next(t[0]),b._control._stream)),at(b._control._stream),at(b._stream),ut(t=>t[1]),ut(t=>(t&&(f.next(w[1]),g=w[0],p.next()),t)),lt(p)).subscribe({next:t=>{},error:t=>{},complete:()=>{}}),d.next(n),l.next(e),m}),ut(t=>t),Pu(()=>{void 0!==_&&(_.unsubscribe(),_=void 0)}),gt(t=>void 0!==t),ft());return{_stream:o.final&&"_default"in o.final?f.pipe(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(s_)),ct(t=>v_(o.final._default,t)),ut(t=>(setTimeout(()=>{m.next(g)},0),t)),ft()):f.pipe(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(s_)),ut(t=>(setTimeout(()=>{m.next(g)},0),t)),ft()),_control:{_stream:w.pipe(ut(t=>t),ft())}}}:(t,e)=>({...vn(t),_control:e})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await Qg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>{const r=vn(t);return{...e([r],n),_control:n}}}),s}},c_=Nt("leafgraph"),l_=t=>"string"==typeof t&&t.toLowerCase().startsWith("github/"),h_=(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.toLowerCase(),graph_appid:"index"}:0===n||n===t.length-1?null:{graph_domain:t.slice(0,n).toLowerCase(),graph_appid:t.slice(n+1)}},d_=async(t,e,n,r,i,o,s,a,u,c,l=!1)=>{const h=await(Wn(u)?.parseGraphEtaTree(i,o)),d=h.leafgraph,p=h.graphcomponents,f=h.graphcomponents.components.nodegroups.runtime[0];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(c_.editorconfig.namedatakey,o).toLowerCase()===n+"/"+r}return!1}).length){const n=[];if(f&&(["2ee89b44-16af-472f-97d4-47ae65f064c8"].includes(e),t._default=await Zg({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})()},p_={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{args:o}=n.leaf.logic,s=En(c_.editorconfig.namedatakey,o),a=s.toLowerCase(),u=(t=>{const e=t.indexOf("/");return e<=0||e===t.length-1?null:{graph_domain:t.slice(0,e).toLowerCase(),graph_appid:t.slice(e+1)}})(l_(s)?s:a);if(!u)return{};const{graph_domain:c,graph_appid:l}=u,h=t.gos.etaTree.domain,d=t.gos.etaTree.appid;if(c+"/"+l!=h+"/"+d){const n=d_(0,e,h,d,c,l,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=>({...vn(t),_control:void 0})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const{args:o}=n.leaf.logic,s=En(c_.editorconfig.namedatakey,o),a=s.toLowerCase(),u=l_(s)?s:a,c=t.gos.etaTree.domain,l=h_(u,c);if(!l)return{};const h=t.gos.etaTree.appid,{graph_domain:d,graph_appid:p}=l;if("breezyforest"!==d&&d+"/"+p==c+"/"+h)return{};try{["3be30006-5b56-4b27-8eaa-249c6a46a557"].includes(e);const n=d_(0,e,c,h,d,p,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{args:o}=n.leaf.logic,s=En(c_.editorconfig.namedatakey,o),a=s.toLowerCase(),u=l_(s)?s:a,c=t.gos.etaTree.domain,l=h_(u,c);if(!l)return{};const h=t.gos.etaTree.appid,{graph_domain:d,graph_appid:p}=l;if("breezyforest"!==d&&d+"/"+p==c+"/"+h)return{};try{["3be30006-5b56-4b27-8eaa-249c6a46a557"].includes(e);const n=d_(0,e,c,h,d,p,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}={})=>({})},f_={dataflow:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>{},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>{}},m_=(It.breezyforest._version,(t,e)=>{const n=new De,r=new De,i=new De;let o;t.forEach(t=>{const s=JSON.parse(ze.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(ze.hp.from(t.data,"base64").toString("utf-8")).leaf;if("leafdataedge"===o.logic.type)n.edge(t.source.uuid,t.target.uuid)||(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(ze.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}}}}),g_=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 qe(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}}},__=Sn("error",{type:"critical",message:"LEAF core error: race condition detected in leaf.js",codebase:"/src/ghostos/api/parser/leaf.js"},{}),y_=Sn("accio","ctrl_accio",{provenance:"executeLEAFLogic"}),v_=async(t,e,n={},r=void 0,i=void 0)=>{const o=new dt,s=new dt,a=t([{_stream:o}],{_stream:s,_config:n});if(a){const t=Je(a._control._stream.pipe(at(a._stream),ut(t=>t[1])));o.next(e),i?s.next(i):s.next(y_);return await t}},b_=Sn("accio","ctrl_accio",{provenance:"subscribeToLEAFLogic"}),w_=async(t,e,n,r)=>{const i=new _t({...__,_label:{at:"leaf.js subscribeToLEAFLogic data stream"}}),o=new _t({...__,_label:{at:"leaf.js subscribeToLEAFLogic ctrl stream"}});i.next(e),o.next(b_);const s=t([{_stream:i}],{_stream:o,_config:n});let a;s&&s._control._stream.pipe(ct(t=>(a=t,s._stream)),ut(t=>[a,t]),lt(r)).subscribe({next:t=>{},error:t=>{},complete:()=>{}})},x_=(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(ut(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 S_=(t,e,n,r,i)=>{let o;return Promise.race([t,new Promise((t,s)=>o=setTimeout(()=>{const e=Sn("error",{type:"timeout",message:r,codebase:n,metadata:i});t(e)},e,r))]).finally(()=>clearTimeout(o))},T_=(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||[],k_=(t,e,n,r={},i={leaflogic:void 0,datalogic:{pre:void 0,post:void 0}})=>{const o=new dt,s=new dt,a=new dt;let u;["e9e6e44b-792b-46d0-b1d3-58ce2f46c45b","c822ae2e-1be8-46be-b2cb-21a43cef0555","98d167d3-c1ed-4d4a-9ab9-25eaccd20a91"].includes(r.refnode);const c=i.leaflogic,l=void 0!==c?c([{_stream:a}],{_stream:void 0!==n?Et(s,n):s,_config:{...t._config}}):{_stream:a,_control:{_stream:s,_config:{...t._config,traces:T_(t._config?.traces,r)}}},h=e.length>1?Et(...e.map(t=>t._stream)):e[0]._stream,d=t._stream.pipe(at(h),ct(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 c={...u,traces:T_(u?.traces,{...r,at:"leaf.js driveDataflowByCtrlflow, initial switch-mapping of the ctrl signal to drive dataflow through a resolved leaflogic"},!0)};return setTimeout(()=>{a.next(o),s.next(c)},1),l._control._stream}),at(l._control._stream),at(l._stream),ut(t=>[t[0][1],t[1]]),ut(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]}),ut(t=>t),ft());return{_stream:o.pipe(gt(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(__)),ft()),_control:{_stream:d.pipe(ut(t=>(["e9e6e44b-792b-46d0-b1d3-58ce2f46c45b","c822ae2e-1be8-46be-b2cb-21a43cef0555"].includes(r.refnode),t)),ft()),_config:{...t._config,traces:T_(t._config?.traces,r)}}}},A_=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=p_.lambda(r)({refnode:n,refnodedata:{leaf:{logic:{args:s}}},nodelambda:[],contextuallambda:[]});return await t}catch(t){return{}}};const E_=t=>{const e=t.split("://");return(e[0].includes("https")?"wss":"ws")+"://"+e[1]},O_=t=>!t||t&&"Object"!==t.constructor.name?t:JSON.parse(JSON.stringify(t)),C_=t=>{const{endpoint:e,websocket:n,headers:r,hook:i}=t,o={endpoint:e,headers:O_(r||{}),websocket:{...n,endpoint:n&&n.endpoint||E_(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{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,headers:s}=t,a={...o.headers,...s||{}};try{let t;t=await fetch(o.endpoint,{method:"POST",headers:a,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=O_(t),o.websocket.client&&s().then(u).catch(t=>{})},establishWS:c,clientContext:o}},{memoize:M_}=bn,I_=({_domain:t,_appid:e,filter:n={},query:r}={})=>`\n subscription {\n graph: getGraph(domain: "${t}", appid: "${e}", filter: ${n}) ${r}\n }\n`,N_=({_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`,R_={dburi_subs:"https://www.leafgon.com/sgraphql",dburi_subs_ws:"wss://www.leafgon.com/sgraphql",dburi_qm:"https://www.leafgon.com/qmgraphql"},D_=({_clientConfig:t=R_,_metamodel:e=It.breezyforest,_sessionid:n}={})=>{const r={...R_,...t||{}},i=r.dburi_subs?r.dburi_subs:void 0,o=r.dburi_subs_ws?r.dburi_subs_ws:void 0,s=r.dburi_qm?r.dburi_qm:void 0,a=r.clientAuthKey?r.clientAuthKey:void 0,u=e.GQLParameters.masterquery;let c={subscriptions:{},subs_methods:{},qm_methods:{}};const l=({gql_subs_client:t,force:e=!1}={})=>{(e||[WebSocket.CLOSED,WebSocket.CLOSING].includes(t.clientContext.websocket.client.readyState))&&t.establishWS()};c.gql_qm_client=s&&C_({endpoint:s,headers:a?{Accept:"application/json","X-API-Key":a}:{Accept:"application/json"}});const h=new Promise((t,e)=>{c.gql_subs_client=i&&o?C_({endpoint:i,headers:a?{"Content-Type":"application/json","X-API-Key":a}:{"Content-Type":"application/json"},websocket:{endpoint:o,onConnectionSuccess:()=>{t("gql_subs_client is connected and ready")},onConnectionError:()=>{e("gql_subs_client: Connection Error")}}}):void 0}),d=async({_appmode:e,_domain:n,_appid:r,filter:i="{}",subsCallback:o,errorCallback:s,variables:a}={})=>{h.then(e=>{const a=(()=>{let t="";const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let n=0;n<5;n++)t+=e.charAt(Math.floor(62*Math.random()));return t+(Object.keys(c.subscriptions).length+1)})();try{const e=c.gql_subs_client.subscribe({operationId:a,subscription:I_({_domain:n,_appid:r,filter:i,query:u}),onGraphQLData:t=>{o&&o(t.data)},onGraphQLError:t=>{a in c.subscriptions&&c.subscriptions[a].stop(),s&&s(t)},onGraphQLComplete:e=>{t.keepGQLConnected&&l({gql_subs_client:c.gql_subs_client,force:!0})}});c.subscriptions[a]=e}catch(t){a in c.subscriptions&&c.subscriptions[a].stop()}})},p=M_(({_appmode:t,_hostdomain:e,_hostappid:n,_domain:r,_appid:i,filter:o="{}",variables:a}={})=>new Promise((l,h)=>{const d={endpoint:s,query:JSON.stringify({query:N_({_appmode:t,_hostdomain:e,_hostappid:n,_domain:r,_appid:i,filter:o,query:u}),variables:a||{}})};try{c.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])),f=({variables:t})=>{const e={endpoint:s,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{c.gql_qm_client.query(e,t=>{t.data})}catch(t){}},m=({node_uuid:t})=>{const e={endpoint:s,query:JSON.stringify({query:"mutation DeleteNode($uuid: String!) {\n deleteNode(nfilter: {uuid: {eq: $uuid}}) {node {uuid}}\n}",variables:{uuid:t}}).replace(/\\n/g,"")};try{c.gql_qm_client.query(e,t=>{t.data})}catch(t){}},g=({variables:t})=>{const e={endpoint:s,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{c.gql_qm_client.query(e,t=>{t.data})}catch(t){}},_=({variables:t})=>{const e={endpoint:s,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{c.gql_qm_client.query(e,t=>{t.data})}catch(t){}},y=({edge_uuid:t})=>{const e={endpoint:s,query:JSON.stringify({query:"mutation DeleteEdge($uuid: String!) {\n deleteEdge(efilter: {uuid: {eq: $uuid}}) {edge {uuid}}\n}",variables:{uuid:t}}).replace(/\\n/g,"")};try{c.gql_qm_client.query(e,t=>{t.data})}catch(t){}};return c.gql_subs_client&&(c.subs_methods={queryGraph:d,clientState:()=>c.gql_subs_client.clientContext.websocket.client.readyState,reconnect:()=>{l({gql_subs_client:c.gql_subs_client})}}),c.gql_qm_client&&(c.qm_methods={queryGraph:p,addNode:f,updateNode:g,delNode:m,addEdge:_,delEdge:y}),c};const P_=({_LEAFappList:t=[],stateObjInstanceID:e=Zn(),dirOfSubjects:n={},permissions:r={},metamodel:i=It}={})=>{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:j_(),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=It.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)})}}},j_=()=>{const t={handle$:new _t,doWrite:e=>t.handle$.next(e),doSubscribe:e=>t.handle$.pipe(function(t){return gt(function(e,n){return t<=n})}(1)).subscribe(e),doUnsubscribe:t=>t.unsubscribe(),doAddAddressee:(t,e)=>{}};return t},L_=(t,e=[],n=It)=>{let r={};return Object.entries(n.breezyforest.subsDirectory).forEach(([t,e])=>{r[t]={main:j_(),bridges:{}}}),[t,r]},F_=Object.freeze({endpoint_subs:"https://www.leafgon.com/sgraphql",websocket_subs:"wss://www.leafgon.com/sgraphql",endpoint_qm:"https://www.leafgon.com/qmgraphql"});let $_=F_.endpoint_subs,B_=F_.websocket_subs,q_=F_.endpoint_qm;const U_=()=>({endpoint_subs:$_,websocket_subs:B_,endpoint_qm:q_}),V_=({endpoint_subs:t,websocket_subs:e,endpoint_qm:n}={})=>("string"==typeof t&&($_=t),"string"==typeof e&&(B_=e),"string"==typeof n&&(q_=n),U_()),G_=async({variables:t,endpoint:e=q_})=>{const n=C_({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){}},z_=async({node_uuid:t,endpoint:e=q_})=>{const n=C_({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){}},W_=async({variables:t,endpoint:e=q_})=>{const n=C_({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){}},J_=async({variables:t,endpoint:e=q_})=>{const n=C_({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){}},H_=async({edge_uuid:t,endpoint:e=q_})=>{const n=C_({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{It as LEAFIOmetamodel,qn as SHA1,Dt as _breezyforeststdlib_hierarchy,Rt as _breezyforeststdlib_name,Pt as _edge_handle_dict,jt as _edge_style_dict,Gg as _leafelement,p_ as _leafgraph,Nt as _leafstdlib_dataflow_api,g_ as analyzeLEAFGraph,C_ as createGQLClient,Io as decodeUnicode,Cg as destroySoundStageNode,Sn as doBottle,Tn as doUnbottle,k_ as driveDataflowByCtrlflow,Mo as encodeUnicode,Zg as etaReduceDataflowComponent,Wn as etaTreeForest,v_ as executeLEAFLogic,x_ as executeLEAFLogicInSync,En as fetchMultiKeyedData,U_ as getLEAFgqlEndpoints,P_ as initLEAFIOapi,Fo as init_gRuntimeLEAFlisp,D_ as initializeLEAFlakeGQLClient,L_ as initializeMasterSubsDirectory,Eg as initializeSoundStage,j_ as initializeSubsMain,J_ as mutateAddEdge,G_ as mutateAddNode,H_ as mutateDelEdge,z_ as mutateDelNode,W_ as mutateUpdateNode,A_ as parseAddressableGraph,Po as parseJsonToLEAFlisp,m_ as reconstructLEAFGraph,$o as runLEAFlispcode,t_ as runtimeEtaTree,V_ as setLEAFgqlEndpoints,On as setMultiKeyedData,w_ as subscribeToLEAFLogic};
3
3
  //# sourceMappingURL=index.esm.js.map