ghostos 0.1.11 → 0.1.13
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/README.md +56 -0
- package/lib/index.esm.js +1 -1
- package/lib/index.esm.js.map +1 -1
- package/package.json +81 -44
- package/lib/api/leafio/core.d.ts +0 -293
- package/lib/api/leafio/leafgql.d.ts +0 -25
- package/lib/api/leafio/leaflake.d.ts +0 -100
- package/lib/api/leafio/leaflake.unit.test.d.ts +0 -1
- package/lib/api/metamodel.d.ts +0 -179
- package/lib/api/parser/breezyforest.d.ts +0 -1
- package/lib/api/parser/elements/schema/directus.d.ts +0 -72
- package/lib/api/parser/elements/schema/index.d.ts +0 -2
- package/lib/api/parser/eta.d.ts +0 -55
- package/lib/api/parser/eta.spec.d.ts +0 -1
- package/lib/api/parser/etatreeforest.d.ts +0 -37
- package/lib/api/parser/leaf.d.ts +0 -56
- package/lib/api/parser/leaflisp/plispdist/index.d.ts +0 -210
- package/lib/api/parser/leaflisp/plispstdlib/index.d.ts +0 -396
- package/lib/api/parser/leaflisp/test.d.mts +0 -1
- package/lib/api/parser/leaflisp/test.d.ts +0 -1
- package/lib/api/parser/leaflisp.d.ts +0 -2
- package/lib/api/parser/nodelogic/abstraction/index.d.ts +0 -7
- package/lib/api/parser/nodelogic/abstraction/leafanchor.d.ts +0 -4
- package/lib/api/parser/nodelogic/abstraction/leafgraph.d.ts +0 -6
- package/lib/api/parser/nodelogic/abstraction/leaflambdagraph.d.ts +0 -4
- package/lib/api/parser/nodelogic/abstraction/leafloopyspell.d.ts +0 -4
- package/lib/api/parser/nodelogic/abstraction/leafloopyspell.spec.d.ts +0 -1
- package/lib/api/parser/nodelogic/abstraction/leafspell.d.ts +0 -9
- package/lib/api/parser/nodelogic/abstraction/leafspell.spec.d.ts +0 -1
- package/lib/api/parser/nodelogic/abstraction/leafspelldef.d.ts +0 -5
- package/lib/api/parser/nodelogic/common.d.ts +0 -8
- package/lib/api/parser/nodelogic/dataflow/index.d.ts +0 -4
- package/lib/api/parser/nodelogic/dataflow/leafchronosflow.d.ts +0 -4
- package/lib/api/parser/nodelogic/dataflow/leafgateflow.d.ts +0 -10
- package/lib/api/parser/nodelogic/dataflow/leafmixflow.d.ts +0 -4
- package/lib/api/parser/nodelogic/dataflow/leafmixflow.spec.d.ts +0 -1
- package/lib/api/parser/nodelogic/datautils/bottling.d.ts +0 -11
- package/lib/api/parser/nodelogic/datautils/index.d.ts +0 -7
- package/lib/api/parser/nodelogic/datautils/leafbottle.d.ts +0 -12
- package/lib/api/parser/nodelogic/datautils/leafconfig.d.ts +0 -12
- package/lib/api/parser/nodelogic/datautils/leafcrate.d.ts +0 -7
- package/lib/api/parser/nodelogic/datautils/leafdelabel.d.ts +0 -7
- package/lib/api/parser/nodelogic/datautils/leaflabel.d.ts +0 -15
- package/lib/api/parser/nodelogic/datautils/leafunbottle.d.ts +0 -12
- package/lib/api/parser/nodelogic/elements/index.d.ts +0 -8
- package/lib/api/parser/nodelogic/elements/leafdeckclub.d.ts +0 -10
- package/lib/api/parser/nodelogic/elements/leafdeckdiamond.d.ts +0 -10
- package/lib/api/parser/nodelogic/elements/leafdeckheart.d.ts +0 -10
- package/lib/api/parser/nodelogic/elements/leafdeckspade.d.ts +0 -10
- package/lib/api/parser/nodelogic/elements/leafelement.d.ts +0 -21
- package/lib/api/parser/nodelogic/elements/leafelement.spec.d.ts +0 -1
- package/lib/api/parser/nodelogic/elements/leafgnav.d.ts +0 -4
- package/lib/api/parser/nodelogic/elements/leafpopupview.d.ts +0 -4
- package/lib/api/parser/nodelogic/elements/library/directus.d.ts +0 -13
- package/lib/api/parser/nodelogic/elements/library/editor.d.ts +0 -17
- package/lib/api/parser/nodelogic/elements/library/form.d.ts +0 -17
- package/lib/api/parser/nodelogic/elements/library/gnav.d.ts +0 -17
- package/lib/api/parser/nodelogic/elements/library/href.d.ts +0 -14
- package/lib/api/parser/nodelogic/elements/library/html.d.ts +0 -17
- package/lib/api/parser/nodelogic/elements/library/http.d.ts +0 -17
- package/lib/api/parser/nodelogic/elements/library/image.d.ts +0 -13
- package/lib/api/parser/nodelogic/elements/library/index.d.ts +0 -25
- package/lib/api/parser/nodelogic/elements/library/mediainput.d.ts +0 -14
- package/lib/api/parser/nodelogic/elements/library/mediaplayer.d.ts +0 -20
- package/lib/api/parser/nodelogic/elements/library/midi.d.ts +0 -17
- package/lib/api/parser/nodelogic/elements/library/openai.d.ts +0 -17
- package/lib/api/parser/nodelogic/elements/library/popup.d.ts +0 -14
- package/lib/api/parser/nodelogic/elements/library/prompt.d.ts +0 -17
- package/lib/api/parser/nodelogic/elements/library/rancher.d.ts +0 -13
- package/lib/api/parser/nodelogic/elements/library/sound.d.ts +0 -17
- package/lib/api/parser/nodelogic/elements/library/sound_lib.d.ts +0 -10
- package/lib/api/parser/nodelogic/elements/library/text.d.ts +0 -13
- package/lib/api/parser/nodelogic/elements/library/wizardryelements.d.ts +0 -1
- package/lib/api/parser/nodelogic/io/index.d.ts +0 -5
- package/lib/api/parser/nodelogic/io/leafinflowport.d.ts +0 -10
- package/lib/api/parser/nodelogic/io/leafinflowport.spec.d.ts +0 -1
- package/lib/api/parser/nodelogic/io/leafmemoryio.d.ts +0 -53
- package/lib/api/parser/nodelogic/io/leafmemoryio.spec.d.ts +0 -1
- package/lib/api/parser/nodelogic/io/leafoutflowport.d.ts +0 -10
- package/lib/api/parser/nodelogic/io/leafoutflowport.spec.d.ts +0 -1
- package/lib/api/parser/nodelogic/io/leafradioRX.d.ts +0 -4
- package/lib/api/parser/nodelogic/io/leafradioTX.d.ts +0 -4
- package/lib/api/parser/nodelogic/io/leafscreenio.d.ts +0 -10
- package/lib/api/parser/nodelogic/wizardry/index.d.ts +0 -2
- package/lib/api/parser/nodelogic/wizardry/leaflisp.d.ts +0 -22
- package/lib/api/parser/nodelogic/wizardry/leaflisp.unit.test.d.ts +0 -1
- package/lib/api/parser/nodelogic/wizardry/leaflisp2.unit.test.d.ts +0 -1
- package/lib/api/parser/nodelogic/wizardry/leaflisphelp.d.ts +0 -1
- package/lib/api/parser/predicates.d.ts +0 -15
- package/lib/api/utils/crypto.d.ts +0 -6
- package/lib/api/utils/fetchnodedata.d.ts +0 -2
- package/lib/api/utils/leafbase64.d.ts +0 -2
- package/lib/api/utils/leafdataflow.d.ts +0 -23
- package/lib/api/utils/leafdataflow.spec.d.ts +0 -1
- package/lib/graphql/client.d.ts +0 -13
- package/lib/graphql/events.d.ts +0 -5
- package/lib/graphql/utils.d.ts +0 -3
- package/lib/index.browser.d.ts +0 -44
- package/lib/index.cjs +0 -22406
- package/lib/index.core.d.ts +0 -44
- package/lib/index.core.js +0 -3
- package/lib/index.core.js.LICENSE.txt +0 -16
- package/lib/index.core.js.map +0 -1
- package/lib/microservices/persistentio.d.ts +0 -1
- package/lib/microservices/screenio.d.ts +0 -1
- package/lib/microservices/volatileio.d.ts +0 -1
- package/lib/models/dataflow.d.ts +0 -1
- package/lib/utils/connectedComponents.d.ts +0 -1
package/lib/index.esm.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see index.esm.js.LICENSE.txt */
|
|
2
|
-
import*as t from"react";var e={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},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}},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},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},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},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},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},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]}}}},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},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},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},1795:function(t,e,n){!function(t,e,n,r){var i=function(t,e,n){return{endTime:e,insertTime:n,type:"exponentialRampToValue",value:t}},o=function(t,e,n){return{endTime:e,insertTime:n,type:"linearRampToValue",value:t}},s=function(t,e){return{startTime:e,type:"setValue",value:t}},a=function(t,e,n){return{duration:n,startTime:e,type:"setValueCurve",values:t}},u=function(t,e,n){var r=n.startTime,i=n.target,o=n.timeConstant;return i+(e-i)*Math.exp((r-t)/o)},c=function(t){return"exponentialRampToValue"===t.type},l=function(t){return"linearRampToValue"===t.type},h=function(t){return c(t)||l(t)},d=function(t){return"setValue"===t.type},p=function(t){return"setValueCurve"===t.type},f=function(t,e,n,r){var i=t[e];return void 0===i?r:h(i)||d(i)?i.value:p(i)?i.values[i.values.length-1]:u(n,f(t,e-1,i.startTime,r),i)},m=function(t,e,n,r,i){return void 0===n?[r.insertTime,i]:h(n)?[n.endTime,n.value]:d(n)?[n.startTime,n.value]:p(n)?[n.startTime+n.duration,n.values[n.values.length-1]]:[n.startTime,f(t,e-1,n.startTime,i)]},g=function(t){return"cancelAndHold"===t.type},_=function(t){return"cancelScheduledValues"===t.type},y=function(t){return g(t)||_(t)?t.cancelTime:c(t)||l(t)?t.endTime:t.startTime},v=function(t,e,n,r){var i=r.endTime,o=r.value;return n===o?o:0<n&&0<o||n<0&&o<0?n*Math.pow(o/n,(t-e)/(i-e)):0},b=function(t,e,n,r){return n+(t-e)/(r.endTime-e)*(r.value-n)},w=function(t,e){var n=Math.floor(e),r=Math.ceil(e);return n===r?t[n]:(1-(e-n))*t[n]+(1-(r-e))*t[r]},x=function(t,e){var n=e.duration,r=e.startTime,i=e.values,o=(t-r)/n*(i.length-1);return w(i,o)},T=function(t){return"setTarget"===t.type},k=function(){function t(e){n(this,t),this._automationEvents=[],this._currenTime=0,this._defaultValue=e}return r(t,[{key:Symbol.iterator,value:function(){return this._automationEvents[Symbol.iterator]()}},{key:"add",value:function(t){var e=y(t);if(g(t)||_(t)){var n=this._automationEvents.findIndex(function(n){return _(t)&&p(n)?n.startTime+n.duration>=e:y(n)>=e}),r=this._automationEvents[n];if(-1!==n&&(this._automationEvents=this._automationEvents.slice(0,n)),g(t)){var u=this._automationEvents[this._automationEvents.length-1];if(void 0!==r&&h(r)){if(void 0!==u&&T(u))throw new Error("The internal list is malformed.");var d=void 0===u?r.insertTime:p(u)?u.startTime+u.duration:y(u),f=void 0===u?this._defaultValue:p(u)?u.values[u.values.length-1]:u.value,m=c(r)?v(e,d,f,r):b(e,d,f,r),w=c(r)?i(m,e,this._currenTime):o(m,e,this._currenTime);this._automationEvents.push(w)}if(void 0!==u&&T(u)&&this._automationEvents.push(s(this.getValue(e),e)),void 0!==u&&p(u)&&u.startTime+u.duration>e){var x=e-u.startTime,k=(u.values.length-1)/u.duration,S=Math.max(2,1+Math.ceil(x*k)),A=x/(S-1)*k,O=u.values.slice(0,S);if(A<1)for(var E=1;E<S;E+=1){var C=A*E%1;O[E]=u.values[E-1]*(1-C)+u.values[E]*C}this._automationEvents[this._automationEvents.length-1]=a(O,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];T(r)&&n.unshift(s(f(this._automationEvents,e-2,r.startTime,this._defaultValue),r.startTime)),this._automationEvents=n}}},{key:"getValue",value:function(t){if(0===this._automationEvents.length)return this._defaultValue;var n=this._automationEvents.findIndex(function(e){return y(e)>t}),r=this._automationEvents[n],i=(-1===n?this._automationEvents.length:n)-1,o=this._automationEvents[i];if(void 0!==o&&T(o)&&(void 0===r||!h(r)||r.insertTime>t))return u(t,f(this._automationEvents,i-1,o.startTime,this._defaultValue),o);if(void 0!==o&&d(o)&&(void 0===r||!h(r)))return o.value;if(void 0!==o&&p(o)&&(void 0===r||!h(r)||o.startTime+o.duration>t))return t<o.startTime+o.duration?x(t,o):o.values[o.values.length-1];if(void 0!==o&&h(o)&&(void 0===r||!h(r)))return o.value;if(void 0!==r&&c(r)){var s=m(this._automationEvents,i,o,r,this._defaultValue),a=e(s,2),g=a[0],_=a[1];return v(t,g,_,r)}if(void 0!==r&&l(r)){var w=m(this._automationEvents,i,o,r,this._defaultValue),k=e(w,2),S=k[0],A=k[1];return b(t,S,A,r)}return this._defaultValue}}])}(),S=function(t){return{cancelTime:t,type:"cancelAndHold"}},A=function(t){return{cancelTime:t,type:"cancelScheduledValues"}},O=function(t,e){return{endTime:e,type:"exponentialRampToValue",value:t}},E=function(t,e){return{endTime:e,type:"linearRampToValue",value:t}},C=function(t,e,n){return{startTime:e,target:t,timeConstant:n,type:"setTarget"}};t.AutomationEventList=k,t.createCancelAndHoldAutomationEvent=S,t.createCancelScheduledValuesAutomationEvent=A,t.createExponentialRampToValueAutomationEvent=O,t.createLinearRampToValueAutomationEvent=E,t.createSetTargetAutomationEvent=C,t.createSetValueAutomationEvent=s,t.createSetValueCurveAutomationEvent=a}(e,n(5715),n(7383),n(4579))},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))},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},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},2543:function(t,e,n){var r;t=n.nmd(t),function(){var i,o="Expected a function",s="__lodash_hash_undefined__",a="__lodash_placeholder__",u=16,c=32,l=64,h=128,d=256,p=1/0,f=9007199254740991,m=NaN,g=4294967295,_=[["ary",h],["bind",1],["bindKey",2],["curry",8],["curryRight",u],["flip",512],["partial",c],["partialRight",l],["rearg",d]],y="[object Arguments]",v="[object Array]",b="[object Boolean]",w="[object Date]",x="[object Error]",T="[object Function]",k="[object GeneratorFunction]",S="[object Map]",A="[object Number]",O="[object Object]",E="[object Promise]",C="[object RegExp]",M="[object Set]",I="[object String]",N="[object Symbol]",j="[object WeakMap]",R="[object ArrayBuffer]",P="[object DataView]",D="[object Float32Array]",L="[object Float64Array]",F="[object Int8Array]",$="[object Int16Array]",B="[object Int32Array]",q="[object Uint8Array]",U="[object Uint8ClampedArray]",V="[object Uint16Array]",G="[object Uint32Array]",z=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,J=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,X=/[&<>"']/g,K=RegExp(H.source),Q=RegExp(X.source),Z=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,tt=/<%=([\s\S]+?)%>/g,et=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nt=/^\w*$/,rt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/[\\^$.*+?()[\]{}|]/g,ot=RegExp(it.source),st=/^\s+/,at=/\s/,ut=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ct=/\{\n\/\* \[wrapped with (.+)\] \*/,lt=/,? & /,ht=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,dt=/[()=,{}\[\]\/\s]/,pt=/\\(\\)?/g,ft=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,mt=/\w*$/,gt=/^[-+]0x[0-9a-f]+$/i,_t=/^0b[01]+$/i,yt=/^\[object .+?Constructor\]$/,vt=/^0o[0-7]+$/i,bt=/^(?:0|[1-9]\d*)$/,wt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,xt=/($^)/,Tt=/['\n\r\u2028\u2029\\]/g,kt="\\ud800-\\udfff",St="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",At="\\u2700-\\u27bf",Ot="a-z\\xdf-\\xf6\\xf8-\\xff",Et="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="["+kt+"]",jt="["+Mt+"]",Rt="["+St+"]",Pt="\\d+",Dt="["+At+"]",Lt="["+Ot+"]",Ft="[^"+kt+Mt+Pt+At+Ot+Et+"]",$t="\\ud83c[\\udffb-\\udfff]",Bt="[^"+kt+"]",qt="(?:\\ud83c[\\udde6-\\uddff]){2}",Ut="[\\ud800-\\udbff][\\udc00-\\udfff]",Vt="["+Et+"]",Gt="\\u200d",zt="(?:"+Lt+"|"+Ft+")",Wt="(?:"+Vt+"|"+Ft+")",Jt="(?:['’](?:d|ll|m|re|s|t|ve))?",Ht="(?:['’](?:D|LL|M|RE|S|T|VE))?",Xt="(?:"+Rt+"|"+$t+")"+"?",Kt="["+Ct+"]?",Qt=Kt+Xt+("(?:"+Gt+"(?:"+[Bt,qt,Ut].join("|")+")"+Kt+Xt+")*"),Zt="(?:"+[Dt,qt,Ut].join("|")+")"+Qt,Yt="(?:"+[Bt+Rt+"?",Rt,qt,Ut,Nt].join("|")+")",te=RegExp(It,"g"),ee=RegExp(Rt,"g"),ne=RegExp($t+"(?="+$t+")|"+Yt+Qt,"g"),re=RegExp([Vt+"?"+Lt+"+"+Jt+"(?="+[jt,Vt,"$"].join("|")+")",Wt+"+"+Ht+"(?="+[jt,Vt+zt,"$"].join("|")+")",Vt+"?"+zt+"+"+Jt,Vt+"+"+Ht,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Pt,Zt].join("|"),"g"),ie=RegExp("["+Gt+kt+St+Ct+"]"),oe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,se=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ae=-1,ue={};ue[D]=ue[L]=ue[F]=ue[$]=ue[B]=ue[q]=ue[U]=ue[V]=ue[G]=!0,ue[y]=ue[v]=ue[R]=ue[b]=ue[P]=ue[w]=ue[x]=ue[T]=ue[S]=ue[A]=ue[O]=ue[C]=ue[M]=ue[I]=ue[j]=!1;var ce={};ce[y]=ce[v]=ce[R]=ce[P]=ce[b]=ce[w]=ce[D]=ce[L]=ce[F]=ce[$]=ce[B]=ce[S]=ce[A]=ce[O]=ce[C]=ce[M]=ce[I]=ce[N]=ce[q]=ce[U]=ce[V]=ce[G]=!0,ce[x]=ce[T]=ce[j]=!1;var le={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},he=parseFloat,de=parseInt,pe="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,fe="object"==typeof self&&self&&self.Object===Object&&self,me=pe||fe||Function("return this")(),ge=e&&!e.nodeType&&e,_e=ge&&t&&!t.nodeType&&t,ye=_e&&_e.exports===ge,ve=ye&&pe.process,be=function(){try{var t=_e&&_e.require&&_e.require("util").types;return t||ve&&ve.binding&&ve.binding("util")}catch(t){}}(),we=be&&be.isArrayBuffer,xe=be&&be.isDate,Te=be&&be.isMap,ke=be&&be.isRegExp,Se=be&&be.isSet,Ae=be&&be.isTypedArray;function Oe(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 Ee(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 je(t,e){return!!(null==t?0:t.length)&&Ve(t,e,0)>-1}function Re(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function Pe(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function De(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function Le(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function Fe(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function $e(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Be=Je("length");function qe(t,e,n){var r;return n(t,function(t,n,i){if(e(t,n,i))return r=n,!1}),r}function Ue(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function Ve(t,e,n){return e==e?function(t,e,n){var r=n-1,i=t.length;for(;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):Ue(t,ze,n)}function Ge(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function ze(t){return t!=t}function We(t,e){var n=null==t?0:t.length;return n?Ke(t,e)/n:m}function Je(t){return function(e){return null==e?i:e[t]}}function He(t){return function(e){return null==t?i:t[e]}}function Xe(t,e,n,r,i){return i(t,function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)}),n}function Ke(t,e){for(var n,r=-1,o=t.length;++r<o;){var s=e(t[r]);s!==i&&(n=n===i?s:n+s)}return n}function Qe(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ze(t){return t?t.slice(0,gn(t)+1).replace(st,""):t}function Ye(t){return function(e){return t(e)}}function tn(t,e){return Pe(e,function(e){return t[e]})}function en(t,e){return t.has(e)}function nn(t,e){for(var n=-1,r=t.length;++n<r&&Ve(e,t[n],0)>-1;);return n}function rn(t,e){for(var n=t.length;n--&&Ve(e,t[n],0)>-1;);return n}var on=He({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),sn=He({"&":"&","<":"<",">":">",'"':""","'":"'"});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({"&":"&","<":"<",">":">",""":'"',"'":"'"});var yn=function t(e){var n,r=(e=null==e?me:yn.defaults(me.Object(),e,yn.pick(me,se))).Array,at=e.Date,kt=e.Error,St=e.Function,At=e.Math,Ot=e.Object,Et=e.RegExp,Ct=e.String,Mt=e.TypeError,It=r.prototype,Nt=St.prototype,jt=Ot.prototype,Rt=e["__core-js_shared__"],Pt=Nt.toString,Dt=jt.hasOwnProperty,Lt=0,Ft=(n=/[^.]+$/.exec(Rt&&Rt.keys&&Rt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",$t=jt.toString,Bt=Pt.call(Ot),qt=me._,Ut=Et("^"+Pt.call(Dt).replace(it,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Vt=ye?e.Buffer:i,Gt=e.Symbol,zt=e.Uint8Array,Wt=Vt?Vt.allocUnsafe:i,Jt=ln(Ot.getPrototypeOf,Ot),Ht=Ot.create,Xt=jt.propertyIsEnumerable,Kt=It.splice,Qt=Gt?Gt.isConcatSpreadable:i,Zt=Gt?Gt.iterator:i,Yt=Gt?Gt.toStringTag:i,ne=function(){try{var t=po(Ot,"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=Ot.getOwnPropertySymbols,ve=Vt?Vt.isBuffer:i,be=e.isFinite,Be=It.join,He=ln(Ot.keys,Ot),vn=At.max,bn=At.min,wn=at.now,xn=e.parseInt,Tn=At.random,kn=It.reverse,Sn=po(e,"DataView"),An=po(e,"Map"),On=po(e,"Promise"),En=po(e,"Set"),Cn=po(e,"WeakMap"),Mn=po(Ot,"create"),In=Cn&&new Cn,Nn={},jn=$o(Sn),Rn=$o(An),Pn=$o(On),Dn=$o(En),Ln=$o(Cn),Fn=Gt?Gt.prototype:i,$n=Fn?Fn.valueOf:i,Bn=Fn?Fn.toString:i;function qn(t){if(na(t)&&!zs(t)&&!(t instanceof zn)){if(t instanceof Gn)return t;if(Dt.call(t,"__wrapped__"))return Bo(t)}return new Gn(t)}var Un=function(){function t(){}return function(e){if(!ea(e))return{};if(Ht)return Ht(e);t.prototype=e;var n=new t;return t.prototype=i,n}}();function Vn(){}function Gn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=i}function zn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=g,this.__views__=[]}function Wn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Jn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Hn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Xn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Hn;++e<n;)this.add(t[e])}function Kn(t){var e=this.__data__=new Jn(t);this.size=e.size}function Qn(t,e){var n=zs(t),r=!n&&Gs(t),i=!n&&!r&&Xs(t),o=!n&&!r&&!i&&la(t),s=n||r||i||o,a=s?Qe(t.length,Ct):[],u=a.length;for(var c in t)!e&&!Dt.call(t,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||bo(c,u))||a.push(c);return a}function Zn(t){var e=t.length;return e?t[Xr(0,e-1)]:i}function Yn(t,e){return Do(Mi(t),ur(e,0,t.length))}function tr(t){return Do(Mi(t))}function er(t,e,n){(n!==i&&!qs(t[e],n)||n===i&&!(e in t))&&sr(t,e,n)}function nr(t,e,n){var r=t[e];Dt.call(t,e)&&qs(r,n)&&(n!==i||e in t)||sr(t,e,n)}function rr(t,e){for(var n=t.length;n--;)if(qs(t[n][0],e))return n;return-1}function ir(t,e,n,r){return pr(t,function(t,i,o){e(r,t,n(t),o)}),r}function or(t,e){return t&&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:Oa(t,e[n]);return s}function ur(t,e,n){return t==t&&(n!==i&&(t=t<=n?t:n),e!==i&&(t=t>=e?t:e)),t}function cr(t,e,n,r,o,s){var a,u=1&e,c=2&e,l=4&e;if(n&&(a=o?n(t,r,o,s):n(t)),a!==i)return a;if(!ea(t))return t;var h=zs(t);if(h){if(a=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&Dt.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!u)return Mi(t,a)}else{var d=go(t),p=d==T||d==k;if(Xs(t))return ki(t,u);if(d==O||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,ja(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 R:return Si(t);case b:case w:return new r(+t);case P:return function(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case D:case L:case F:case $:case B:case q:case U:case V:case G:return Ai(t,n);case S:return new r;case A:case 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?Ot($n.call(i)):{}}var i}(t,d,u)}}s||(s=new Kn);var f=s.get(t);if(f)return f;s.set(t,a),aa(t)?t.forEach(function(r){a.add(cr(r,e,n,r,t,s))}):ra(t)&&t.forEach(function(r,i){a.set(i,cr(r,e,n,i,t,s))});var m=h?i:(l?c?oo:io:c?ja: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=Ot(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=je,s=!0,a=t.length,u=[],c=e.length;if(!a)return u;n&&(e=Pe(e,Ye(n))),r?(o=Re,s=!1):e.length>=200&&(o=en,s=!1,e=new Xn(e));t:for(;++i<a;){var l=t[i],h=null==n?l:n(l);if(l=r||0!==l?l:0,s&&h==h){for(var d=c;d--;)if(e[d]===h)continue t;u.push(l)}else o(e,h,r)||u.push(l)}return u}qn.templateSettings={escape:Z,evaluate:Y,interpolate:tt,variable:"",imports:{_:qn}},qn.prototype=Vn.prototype,qn.prototype.constructor=qn,Gn.prototype=Un(Vn.prototype),Gn.prototype.constructor=Gn,zn.prototype=Un(Vn.prototype),zn.prototype.constructor=zn,Wn.prototype.clear=function(){this.__data__=Mn?Mn(null):{},this.size=0},Wn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Wn.prototype.get=function(t){var e=this.__data__;if(Mn){var n=e[t];return n===s?i:n}return Dt.call(e,t)?e[t]:i},Wn.prototype.has=function(t){var e=this.__data__;return Mn?e[t]!==i:Dt.call(e,t)},Wn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Mn&&e===i?s:e,this},Jn.prototype.clear=function(){this.__data__=[],this.size=0},Jn.prototype.delete=function(t){var e=this.__data__,n=rr(e,t);return!(n<0)&&(n==e.length-1?e.pop():Kt.call(e,n,1),--this.size,!0)},Jn.prototype.get=function(t){var e=this.__data__,n=rr(e,t);return n<0?i:e[n][1]},Jn.prototype.has=function(t){return rr(this.__data__,t)>-1},Jn.prototype.set=function(t,e){var n=this.__data__,r=rr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(An||Jn),string:new Wn}},Hn.prototype.delete=function(t){var e=lo(this,t).delete(t);return this.size-=e?1:0,e},Hn.prototype.get=function(t){return lo(this,t).get(t)},Hn.prototype.has=function(t){return lo(this,t).has(t)},Hn.prototype.set=function(t,e){var n=lo(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Xn.prototype.add=Xn.prototype.push=function(t){return this.__data__.set(t,s),this},Xn.prototype.has=function(t){return this.__data__.has(t)},Kn.prototype.clear=function(){this.__data__=new Jn,this.size=0},Kn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Kn.prototype.get=function(t){return this.__data__.get(t)},Kn.prototype.has=function(t){return this.__data__.has(t)},Kn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Jn){var r=n.__data__;if(!An||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(t,e),this.size=n.size,this};var pr=Ri(wr),fr=Ri(xr,!0);function mr(t,e){var n=!0;return pr(t,function(t,r,i){return n=!!e(t,r,i)}),n}function gr(t,e,n){for(var r=-1,o=t.length;++r<o;){var s=t[r],a=e(s);if(null!=a&&(u===i?a==a&&!ca(a):n(a,u)))var u=a,c=s}return c}function _r(t,e){var n=[];return pr(t,function(t,r,i){e(t,r,i)&&n.push(t)}),n}function yr(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=vo),i||(i=[]);++o<s;){var a=t[o];e>0&&n(a)?e>1?yr(a,e-1,n,r,i):De(i,a):r||(i[i.length]=a)}return i}var vr=Pi(),br=Pi(!0);function wr(t,e){return t&&vr(t,e,Na)}function xr(t,e){return t&&br(t,e,Na)}function Tr(t,e){return Ne(e,function(e){return Zs(t[e])})}function kr(t,e){for(var n=0,r=(e=bi(e,t)).length;null!=t&&n<r;)t=t[Fo(e[n++])];return n&&n==r?t:i}function Sr(t,e,n){var r=e(t);return zs(t)?r:De(r,n(t))}function Ar(t){return null==t?t===i?"[object Undefined]":"[object Null]":Yt&&Yt in Ot(t)?function(t){var e=Dt.call(t,Yt),n=t[Yt];try{t[Yt]=i;var r=!0}catch(t){}var o=$t.call(t);r&&(e?t[Yt]=n:delete t[Yt]);return o}(t):function(t){return $t.call(t)}(t)}function Or(t,e){return t>e}function Er(t,e){return null!=t&&Dt.call(t,e)}function Cr(t,e){return null!=t&&e in Ot(t)}function Mr(t,e,n){for(var o=n?Re:je,s=t[0].length,a=t.length,u=a,c=r(a),l=1/0,h=[];u--;){var d=t[u];u&&e&&(d=Pe(d,Ye(e))),l=bn(d.length,l),c[u]=!n&&(e||s>=120&&d.length>=120)?new Xn(u&&d):i}d=t[0];var p=-1,f=c[0];t:for(;++p<s&&h.length<l;){var m=d[p],g=e?e(m):m;if(m=n||0!==m?m:0,!(f?en(f,g):o(h,g,n))){for(u=a;--u;){var _=c[u];if(!(_?en(_,g):o(t[u],g,n)))continue t}f&&f.push(g),h.push(m)}}return h}function Ir(t,e,n){var r=null==(t=Co(t,e=bi(e,t)))?t:t[Fo(Qo(e))];return null==r?i:Oe(r,t,n)}function Nr(t){return na(t)&&Ar(t)==y}function jr(t,e,n,r,o){return t===e||(null==t||null==e||!na(t)&&!na(e)?t!=t&&e!=e:function(t,e,n,r,o,s){var a=zs(t),u=zs(e),c=a?v:go(t),l=u?v:go(e),h=(c=c==y?O:c)==O,d=(l=l==y?O:l)==O,p=c==l;if(p&&Xs(t)){if(!Xs(e))return!1;a=!0,h=!1}if(p&&!h)return s||(s=new Kn),a||la(t)?no(t,e,n,r,o,s):function(t,e,n,r,i,o,s){switch(n){case P:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case R:return!(t.byteLength!=e.byteLength||!o(new zt(t),new zt(e)));case b:case w:case A:return qs(+t,+e);case x:return t.name==e.name&&t.message==e.message;case C:case I:return t==e+"";case S:var a=cn;case M:var u=1&r;if(a||(a=dn),t.size!=e.size&&!u)return!1;var c=s.get(t);if(c)return c==e;r|=2,s.set(t,e);var l=no(a(t),a(e),r,i,o,s);return s.delete(t),l;case 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&&Dt.call(t,"__wrapped__"),m=d&&Dt.call(e,"__wrapped__");if(f||m){var g=f?t.value():t,_=m?e.value():e;return s||(s=new Kn),o(g,_,n,r,s)}}if(!p)return!1;return s||(s=new Kn),function(t,e,n,r,o,s){var a=1&n,u=io(t),c=u.length,l=io(e),h=l.length;if(c!=h&&!a)return!1;var d=c;for(;d--;){var p=u[d];if(!(a?p in e:Dt.call(e,p)))return!1}var f=s.get(t),m=s.get(e);if(f&&m)return f==e&&m==t;var g=!0;s.set(t,e),s.set(e,t);var _=a;for(;++d<c;){var y=t[p=u[d]],v=e[p];if(r)var b=a?r(v,y,p,e,t,s):r(y,v,p,t,e,s);if(!(b===i?y===v||o(y,v,n,r,s):b)){g=!1;break}_||(_="constructor"==p)}if(g&&!_){var w=t.constructor,x=e.constructor;w==x||!("constructor"in t)||!("constructor"in e)||"function"==typeof w&&w instanceof w&&"function"==typeof x&&x instanceof x||(g=!1)}return s.delete(t),s.delete(e),g}(t,e,n,r,o,s)}(t,e,n,r,jr,o))}function Rr(t,e,n,r){var o=n.length,s=o,a=!r;if(null==t)return!s;for(t=Ot(t);o--;){var u=n[o];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<s;){var c=(u=n[o])[0],l=t[c],h=u[1];if(a&&u[2]){if(l===i&&!(c in t))return!1}else{var d=new Kn;if(r)var p=r(l,h,c,t,e,d);if(!(p===i?jr(h,l,3,r,d):p))return!1}}return!0}function Pr(t){return!(!ea(t)||(e=t,Ft&&Ft in e))&&(Zs(t)?Ut:yt).test($o(t));var e}function Dr(t){return"function"==typeof t?t:null==t?iu:"object"==typeof t?zs(t)?Ur(t[0],t[1]):qr(t):pu(t)}function Lr(t){if(!So(t))return He(t);var e=[];for(var n in Ot(t))Dt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Fr(t){if(!ea(t))return function(t){var e=[];if(null!=t)for(var n in Ot(t))e.push(n);return e}(t);var e=So(t),n=[];for(var r in t)("constructor"!=r||!e&&Dt.call(t,r))&&n.push(r);return n}function $r(t,e){return t<e}function Br(t,e){var n=-1,i=Js(t)?r(t.length):[];return pr(t,function(t,r,o){i[++n]=e(t,r,o)}),i}function qr(t){var e=ho(t);return 1==e.length&&e[0][2]?Oo(e[0][0],e[0][1]):function(n){return n===t||Rr(n,t,e)}}function Ur(t,e){return xo(t)&&Ao(e)?Oo(Fo(t),e):function(n){var r=Oa(n,t);return r===i&&r===e?Ea(n,t):jr(e,r,3)}}function Vr(t,e,n,r,o){t!==e&&vr(e,function(s,a){if(o||(o=new Kn),ea(s))!function(t,e,n,r,o,s,a){var u=Mo(t,n),c=Mo(e,n),l=a.get(c);if(l)return void er(t,n,l);var h=s?s(u,c,n+"",t,e,a):i,d=h===i;if(d){var p=zs(c),f=!p&&Xs(c),m=!p&&!f&&la(c);h=c,p||f||m?zs(u)?h=u:Hs(u)?h=Mi(u):f?(d=!1,h=ki(c,!0)):m?(d=!1,h=Ai(c,!0)):h=[]:oa(c)||Gs(c)?(h=u,Gs(u)?h=ya(u):ea(u)&&!Zs(u)||(h=yo(c))):d=!1}d&&(a.set(c,h),o(h,c,r,s,a),a.delete(c));er(t,n,h)}(t,e,a,n,Vr,r,o);else{var u=r?r(Mo(t,a),s,a+"",t,e,o):i;u===i&&(u=s),er(t,a,u)}},ja)}function Gr(t,e){var n=t.length;if(n)return bo(e+=e<0?n:0,n)?t[e]:i}function zr(t,e,n){e=e.length?Pe(e,function(t){return zs(t)?function(e){return kr(e,1===t.length?t[0]:t)}:t}):[iu];var r=-1;e=Pe(e,Ye(co()));var i=Br(t,function(t,n,i){var o=Pe(e,function(e){return e(t)});return{criteria:o,index:++r,value:t}});return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(i,function(t,e){return function(t,e,n){var r=-1,i=t.criteria,o=e.criteria,s=i.length,a=n.length;for(;++r<s;){var u=Oi(i[r],o[r]);if(u)return r>=a?u:u*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)})}function Wr(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var s=e[r],a=kr(t,s);n(a,s)&&ti(o,bi(s,t),a)}return o}function Jr(t,e,n,r){var i=r?Ge:Ve,o=-1,s=e.length,a=t;for(t===e&&(e=Mi(e)),n&&(a=Pe(t,Ye(n)));++o<s;)for(var u=0,c=e[o],l=n?n(c):c;(u=i(a,l,u,r))>-1;)a!==t&&Kt.call(a,u,1),Kt.call(t,u,1);return t}function Hr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;bo(i)?Kt.call(t,i,1):di(t,i)}}return t}function Xr(t,e){return t+ge(Tn()*(e-t+1))}function Kr(t,e){var n="";if(!t||e<1||e>f)return n;do{e%2&&(n+=t),(e=ge(e/2))&&(t+=t)}while(e);return n}function Qr(t,e){return jo(Eo(t,e,iu),t+"")}function Zr(t){return Zn(qa(t))}function Yr(t,e){var n=qa(t);return Do(n,ur(e,0,n.length))}function ti(t,e,n,r){if(!ea(t))return t;for(var o=-1,s=(e=bi(e,t)).length,a=s-1,u=t;null!=u&&++o<s;){var c=Fo(e[o]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(o!=a){var h=u[c];(l=r?r(h,c,u):i)===i&&(l=ea(h)?h:bo(e[o+1])?[]:{})}nr(u,c,l),u=u[c]}return t}var ei=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 Do(qa(t))}function ii(t,e,n){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var s=r(o);++i<o;)s[i]=t[i+e];return s}function oi(t,e){var n;return pr(t,function(t,r,i){return!(n=e(t,r,i))}),!!n}function si(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,s=t[o];null!==s&&!ca(s)&&(n?s<=e:s<e)?r=o+1:i=o}return i}return ai(t,e,iu,n)}function ai(t,e,n,r){var o=0,s=null==t?0:t.length;if(0===s)return 0;for(var a=(e=n(e))!=e,u=null===e,c=ca(e),l=e===i;o<s;){var h=ge((o+s)/2),d=n(t[h]),p=d!==i,f=null===d,m=d==d,g=ca(d);if(a)var _=r||m;else _=l?m&&(r||p):u?m&&p&&(r||!f):c?m&&p&&!f&&(r||!g):!f&&!g&&(r?d<=e:d<e);_?o=h+1:s=h}return bn(s,4294967294)}function ui(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n],a=e?e(s):s;if(!n||!qs(a,u)){var u=a;o[i++]=0===s?0:s}}return o}function ci(t){return"number"==typeof t?t:ca(t)?m:+t}function li(t){if("string"==typeof t)return t;if(zs(t))return Pe(t,li)+"";if(ca(t))return Bn?Bn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function hi(t,e,n){var r=-1,i=je,o=t.length,s=!0,a=[],u=a;if(n)s=!1,i=Re;else if(o>=200){var c=e?null:Ki(t);if(c)return dn(c);s=!1,i=en,u=new Xn}else u=e?[]:a;t:for(;++r<o;){var l=t[r],h=e?e(l):l;if(l=n||0!==l?l:0,s&&h==h){for(var d=u.length;d--;)if(u[d]===h)continue t;e&&u.push(h),a.push(l)}else i(u,h,n)||(u!==a&&u.push(h),a.push(l))}return a}function di(t,e){return null==(t=Co(t,e=bi(e,t)))||delete t[Fo(Qo(e))]}function pi(t,e,n,r){return ti(t,e,n(kr(t,e)),r)}function fi(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?ii(t,r?0:o,r?o+1:i):ii(t,r?o+1:0,r?i:o)}function mi(t,e){var n=t;return n instanceof zn&&(n=n.value()),Le(e,function(t,e){return e.func.apply(e.thisArg,De([t],e.args))},n)}function gi(t,e,n){var i=t.length;if(i<2)return i?hi(t[0]):[];for(var o=-1,s=r(i);++o<i;)for(var a=t[o],u=-1;++u<i;)u!=o&&(s[o]=dr(s[o]||a,t[u],e,n));return hi(yr(s,1),e,n)}function _i(t,e,n){for(var r=-1,o=t.length,s=e.length,a={};++r<o;){var u=r<s?e[r]:i;n(a,t[r],u)}return a}function yi(t){return Hs(t)?t:[]}function vi(t){return"function"==typeof t?t:iu}function bi(t,e){return zs(t)?t:xo(t,e)?[t]:Lo(va(t))}var wi=Qr;function xi(t,e,n){var r=t.length;return n=n===i?r:n,!e&&n>=r?t:ii(t,e,n)}var Ti=ie||function(t){return me.clearTimeout(t)};function ki(t,e){if(e)return t.slice();var n=t.length,r=Wt?Wt(n):new t.constructor(n);return t.copy(r),r}function Si(t){var e=new t.constructor(t.byteLength);return new zt(e).set(new zt(t)),e}function Ai(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Oi(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 Ei(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)?Ee:ir,o=e?e():{};return i(n,t,co(r,2),o)}}function ji(t){return Qr(function(e,n){var r=-1,o=n.length,s=o>1?n[o-1]:i,a=o>2?n[2]:i;for(s=t.length>3&&"function"==typeof s?(o--,s):i,a&&wo(n[0],n[1],a)&&(s=o<3?i:s,o=1),e=Ot(e);++r<o;){var u=n[r];u&&t(e,u,r,s)}return e})}function Ri(t,e){return function(n,r){if(null==n)return n;if(!Js(n))return t(n,r);for(var i=n.length,o=e?i:-1,s=Ot(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=Ot(e),s=r(e),a=s.length;a--;){var u=s[t?a:++i];if(!1===n(o[u],u,o))break}return e}}function Di(t){return function(e){var n=un(e=va(e))?mn(e):i,r=n?n[0]:e.charAt(0),o=n?xi(n,1).join(""):e.slice(1);return r[t]()+o}}function Li(t){return function(e){return Le(Za(Ga(e).replace(te,"")),t,"")}}function Fi(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Un(t.prototype),r=t.apply(n,e);return ea(r)?r:n}}function $i(t){return function(e,n,r){var o=Ot(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&&To(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?u[ao(l[0])].apply(u,l[3]):1==a.length&&To(a)?u[c]():u.thru(a)}return function(){var t=arguments,r=t[0];if(u&&1==t.length&&zs(r))return u.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}})}function qi(t,e,n,o,s,a,u,c,l,d){var p=e&h,f=1&e,m=2&e,g=24&e,_=512&e,y=m?i:Fi(t);return function h(){for(var v=arguments.length,b=r(v),w=v;w--;)b[w]=arguments[w];if(g)var x=uo(h),T=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(b,x);if(o&&(b=Ei(b,o,s,g)),a&&(b=Ci(b,a,u,g)),v-=T,g&&v<d){var k=hn(b,x);return Hi(t,e,qi,h.placeholder,n,b,k,c,l,d-v)}var S=f?n:this,A=m?S[t]:t;return v=b.length,c?b=function(t,e){var n=t.length,r=bn(e.length,n),o=Mi(t);for(;r--;){var s=e[r];t[r]=bo(s,n)?o[s]:i}return t}(b,c):_&&v>1&&b.reverse(),p&&l<v&&(b.length=l),this&&this!==me&&this instanceof h&&(A=y||Fi(A)),A.apply(S,b)}}function Ui(t,e){return function(n,r){return function(t,e,n,r){return wr(t,function(t,i,o){e(r,n(t),i,o)}),r}(n,t,e(r),{})}}function Vi(t,e){return function(n,r){var o;if(n===i&&r===i)return e;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=li(n),r=li(r)):(n=ci(n),r=ci(r)),o=t(n,r)}return o}}function Gi(t){return ro(function(e){return e=Pe(e,Ye(co())),Qr(function(n){var r=this;return t(e,function(t){return Oe(t,r,n)})})})}function zi(t,e){var n=(e=e===i?" ":li(e)).length;if(n<2)return n?Kr(e,t):e;var r=Kr(e,fe(t/fn(e)));return un(e)?xi(mn(r),0,t).join(""):r.slice(0,t)}function Wi(t){return function(e,n,o){return o&&"number"!=typeof o&&wo(e,n,o)&&(n=o=i),e=fa(e),n===i?(n=e,e=0):n=fa(n),function(t,e,n,i){for(var o=-1,s=vn(fe((e-t)/(n||1)),0),a=r(s);s--;)a[i?s:++o]=t,t+=n;return a}(e,n,o=o===i?e<n?1:-1:fa(o),t)}}function Ji(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=_a(e),n=_a(n)),t(e,n)}}function Hi(t,e,n,r,o,s,a,u,h,d){var p=8&e;e|=p?c:l,4&(e&=~(p?l:c))||(e&=-4);var f=[t,e,o,p?s:i,p?a:i,p?i:s,p?i:a,u,h,d],m=n.apply(i,f);return To(t)&&Io(m,f),m.placeholder=r,Ro(m,t,e)}function Xi(t){var e=At[t];return function(t,n){if(t=_a(t),(n=null==n?0:bn(ma(n),292))&&be(t)){var r=(va(t)+"e").split("e");return+((r=(va(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Ki=En&&1/dn(new En([,-0]))[1]==p?function(t){return new En(t)}:cu;function Qi(t){return function(e){var n=go(e);return n==S?cn(e):n==M?pn(e):function(t,e){return Pe(e,function(e){return[e,t[e]]})}(e,t(e))}}function Zi(t,e,n,s,p,f,m,g){var _=2&e;if(!_&&"function"!=typeof t)throw new Mt(o);var y=s?s.length:0;if(y||(e&=-97,s=p=i),m=m===i?m:vn(ma(m),0),g=g===i?g:ma(g),y-=p?p.length:0,e&l){var v=s,b=p;s=p=i}var w=_?i:so(t),x=[t,e,n,s,p,v,b,f,m,g];if(w&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,s=r==h&&8==n||r==h&&n==d&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!s)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var u=e[3];if(u){var c=t[3];t[3]=c?Ei(c,u,e[4]):u,t[4]=c?hn(t[3],a):e[4]}(u=e[5])&&(c=t[5],t[5]=c?Ci(c,u,e[6]):u,t[6]=c?hn(t[5],a):e[6]);(u=e[7])&&(t[7]=u);r&h&&(t[8]=null==t[8]?e[8]:bn(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(x,w),t=x[0],e=x[1],n=x[2],s=x[3],p=x[4],!(g=x[9]=x[9]===i?_?0:t.length:vn(x[9]-y,0))&&24&e&&(e&=-25),e&&1!=e)T=8==e||e==u?function(t,e,n){var o=Fi(t);return function s(){for(var a=arguments.length,u=r(a),c=a,l=uo(s);c--;)u[c]=arguments[c];var h=a<3&&u[0]!==l&&u[a-1]!==l?[]:hn(u,l);return(a-=h.length)<n?Hi(t,e,qi,s.placeholder,i,u,h,i,i,n-a):Oe(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 Oe(d,o?n:this,h)}}(t,e,n,s);else var T=function(t,e,n){var r=1&e,i=Fi(t);return function e(){return(this&&this!==me&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return Ro((w?ei:Io)(T,x),t,e)}function Yi(t,e,n,r){return t===i||qs(t,jt[n])&&!Dt.call(r,n)?e:t}function to(t,e,n,r,o,s){return ea(t)&&ea(e)&&(s.set(e,t),Vr(t,e,i,to,s),s.delete(e)),t}function eo(t){return oa(t)?i:t}function no(t,e,n,r,o,s){var a=1&n,u=t.length,c=e.length;if(u!=c&&!(a&&c>u))return!1;var l=s.get(t),h=s.get(e);if(l&&h)return l==e&&h==t;var d=-1,p=!0,f=2&n?new Xn:i;for(s.set(t,e),s.set(e,t);++d<u;){var m=t[d],g=e[d];if(r)var _=a?r(g,m,d,e,t,s):r(m,g,d,t,e,s);if(_!==i){if(_)continue;p=!1;break}if(f){if(!$e(e,function(t,e){if(!en(f,e)&&(m===t||o(m,t,n,r,s)))return f.push(e)})){p=!1;break}}else if(m!==g&&!o(m,g,n,r,s)){p=!1;break}}return s.delete(t),s.delete(e),p}function ro(t){return jo(Eo(t,i,Wo),t+"")}function io(t){return Sr(t,Na,fo)}function oo(t){return Sr(t,ja,mo)}var so=In?function(t){return In.get(t)}:cu;function ao(t){for(var e=t.name+"",n=Nn[e],r=Dt.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(Dt.call(qn,"placeholder")?qn:t).placeholder}function co(){var t=qn.iteratee||ou;return t=t===ou?Dr:t,arguments.length?t(arguments[0],arguments[1]):t}function lo(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function ho(t){for(var e=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=Ot(t),Ne(_e(t),function(e){return Xt.call(t,e)}))}:gu,mo=_e?function(t){for(var e=[];t;)De(e,fo(t)),t=Jt(t);return e}:gu,go=Ar;function _o(t,e,n){for(var r=-1,i=(e=bi(e,t)).length,o=!1;++r<i;){var s=Fo(e[r]);if(!(o=null!=t&&n(t,s)))break;t=t[s]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&ta(i)&&bo(s,i)&&(zs(t)||Gs(t))}function yo(t){return"function"!=typeof t.constructor||So(t)?{}:Un(Jt(t))}function vo(t){return zs(t)||Gs(t)||!!(Qt&&t&&t[Qt])}function bo(t,e){var n=typeof t;return!!(e=null==e?f:e)&&("number"==n||"symbol"!=n&&bt.test(t))&&t>-1&&t%1==0&&t<e}function wo(t,e,n){if(!ea(n))return!1;var r=typeof e;return!!("number"==r?Js(n)&&bo(e,n.length):"string"==r&&e in n)&&qs(n[e],t)}function xo(t,e){if(zs(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ca(t))||(nt.test(t)||!et.test(t)||null!=e&&t in Ot(e))}function To(t){var e=ao(t),n=qn[e];if("function"!=typeof n||!(e in zn.prototype))return!1;if(t===n)return!0;var r=so(n);return!!r&&t===r[0]}(Sn&&go(new Sn(new ArrayBuffer(1)))!=P||An&&go(new An)!=S||On&&go(On.resolve())!=E||En&&go(new En)!=M||Cn&&go(new Cn)!=j)&&(go=function(t){var e=Ar(t),n=e==O?t.constructor:i,r=n?$o(n):"";if(r)switch(r){case jn:return P;case Rn:return S;case Pn:return E;case Dn:return M;case Ln:return j}return e});var ko=Rt?Zs:_u;function So(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||jt)}function Ao(t){return t==t&&!ea(t)}function Oo(t,e){return function(n){return null!=n&&(n[t]===e&&(e!==i||t in Ot(n)))}}function Eo(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),Oe(t,this,u)}}function Co(t,e){return e.length<2?t:kr(t,ii(e,0,-1))}function Mo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Io=Po(ei),No=pe||function(t,e){return me.setTimeout(t,e)},jo=Po(ni);function Ro(t,e,n){var r=e+"";return jo(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(ut,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Ce(_,function(n){var r="_."+n[0];e&n[1]&&!je(t,r)&&t.push(r)}),t.sort()}(function(t){var e=t.match(ct);return e?e[1].split(lt):[]}(r),n)))}function Po(t){var e=0,n=0;return function(){var r=wn(),o=16-(r-n);if(n=r,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(i,arguments)}}function Do(t,e){var n=-1,r=t.length,o=r-1;for(e=e===i?r:e;++n<e;){var s=Xr(n,o),a=t[s];t[s]=t[n],t[n]=a}return t.length=e,t}var Lo=function(t){var e=Ps(t,function(t){return 500===n.size&&n.clear(),t}),n=e.cache;return e}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(rt,function(t,n,r,i){e.push(r?i.replace(pt,"$1"):n||t)}),e});function Fo(t){if("string"==typeof t||ca(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function $o(t){if(null!=t){try{return Pt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Bo(t){if(t instanceof zn)return t.clone();var e=new Gn(t.__wrapped__,t.__chain__);return e.__actions__=Mi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var qo=Qr(function(t,e){return Hs(t)?dr(t,yr(e,1,Hs,!0)):[]}),Uo=Qr(function(t,e){var n=Qo(e);return Hs(n)&&(n=i),Hs(t)?dr(t,yr(e,1,Hs,!0),co(n,2)):[]}),Vo=Qr(function(t,e){var n=Qo(e);return Hs(n)&&(n=i),Hs(t)?dr(t,yr(e,1,Hs,!0),i,n):[]});function Go(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ma(n);return i<0&&(i=vn(r+i,0)),Ue(t,co(e,3),i)}function zo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r-1;return n!==i&&(o=ma(n),o=n<0?vn(r+o,0):bn(o,r-1)),Ue(t,co(e,3),o,!0)}function Wo(t){return(null==t?0:t.length)?yr(t,1):[]}function Jo(t){return t&&t.length?t[0]:i}var Ho=Qr(function(t){var e=Pe(t,yi);return e.length&&e[0]===t[0]?Mr(e):[]}),Xo=Qr(function(t){var e=Qo(t),n=Pe(t,yi);return e===Qo(n)?e=i:n.pop(),n.length&&n[0]===t[0]?Mr(n,co(e,2)):[]}),Ko=Qr(function(t){var e=Qo(t),n=Pe(t,yi);return(e="function"==typeof e?e:i)&&n.pop(),n.length&&n[0]===t[0]?Mr(n,i,e):[]});function Qo(t){var e=null==t?0:t.length;return e?t[e-1]:i}var Zo=Qr(Yo);function Yo(t,e){return t&&t.length&&e&&e.length?Jr(t,e):t}var ts=ro(function(t,e){var n=null==t?0:t.length,r=ar(t,e);return Hr(t,Pe(e,function(t){return bo(t,n)?+t:t}).sort(Oi)),r});function es(t){return null==t?t:kn.call(t)}var ns=Qr(function(t){return hi(yr(t,1,Hs,!0))}),rs=Qr(function(t){var e=Qo(t);return Hs(e)&&(e=i),hi(yr(t,1,Hs,!0),co(e,2))}),is=Qr(function(t){var e=Qo(t);return e="function"==typeof e?e:i,hi(yr(t,1,Hs,!0),i,e)});function os(t){if(!t||!t.length)return[];var e=0;return t=Ne(t,function(t){if(Hs(t))return e=vn(t.length,e),!0}),Qe(e,function(e){return Pe(t,Je(e))})}function ss(t,e){if(!t||!t.length)return[];var n=os(t);return null==e?n:Pe(n,function(t){return Oe(e,i,t)})}var as=Qr(function(t,e){return Hs(t)?dr(t,e):[]}),us=Qr(function(t){return gi(Ne(t,Hs))}),cs=Qr(function(t){var e=Qo(t);return Hs(e)&&(e=i),gi(Ne(t,Hs),co(e,2))}),ls=Qr(function(t){var e=Qo(t);return e="function"==typeof e?e:i,gi(Ne(t,Hs),i,e)}),hs=Qr(os);var ds=Qr(function(t){var e=t.length,n=e>1?t[e-1]:i;return n="function"==typeof n?(t.pop(),n):i,ss(t,n)});function ps(t){var e=qn(t);return e.__chain__=!0,e}function fs(t,e){return e(t)}var ms=ro(function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,o=function(e){return ar(e,t)};return!(e>1||this.__actions__.length)&&r instanceof zn&&bo(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:fs,args:[o],thisArg:i}),new Gn(r,this.__chain__).thru(function(t){return e&&!t.length&&t.push(i),t})):this.thru(o)});var gs=Ni(function(t,e,n){Dt.call(t,n)?++t[n]:sr(t,n,1)});var _s=$i(Go),ys=$i(zo);function vs(t,e){return(zs(t)?Ce:pr)(t,co(e,3))}function bs(t,e){return(zs(t)?Me:fr)(t,co(e,3))}var ws=Ni(function(t,e,n){Dt.call(t,n)?t[n].push(e):sr(t,n,[e])});var xs=Qr(function(t,e,n){var i=-1,o="function"==typeof e,s=Js(t)?r(t.length):[];return pr(t,function(t){s[++i]=o?Oe(e,t,n):Ir(t,e,n)}),s}),Ts=Ni(function(t,e,n){sr(t,n,e)});function ks(t,e){return(zs(t)?Pe:Br)(t,co(e,3))}var Ss=Ni(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});var As=Qr(function(t,e){if(null==t)return[];var n=e.length;return n>1&&wo(t,e[0],e[1])?e=[]:n>2&&wo(e[0],e[1],e[2])&&(e=[e[0]]),zr(t,yr(e,1),[])}),Os=le||function(){return me.Date.now()};function Es(t,e,n){return e=n?i:e,e=t&&null==e?t.length:e,Zi(t,h,i,i,i,i,e)}function Cs(t,e){var n;if("function"!=typeof e)throw new Mt(o);return t=ma(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=i),n}}var Ms=Qr(function(t,e,n){var r=1;if(n.length){var i=hn(n,uo(Ms));r|=c}return Zi(t,r,e,n,i)}),Is=Qr(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=Os();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=Os(),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 Ti(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&&Ti(c),h=0,r=l=s=c=i},v.flush=function(){return c===i?u:y(Os())},v}var js=Qr(function(t,e){return hr(t,1,e)}),Rs=Qr(function(t,e,n){return hr(t,_a(e)||0,n)});function Ps(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Mt(o);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Ps.Cache||Hn),n}function Ds(t){if("function"!=typeof t)throw new Mt(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Ps.Cache=Hn;var Ls=wi(function(t,e){var n=(e=1==e.length&&zs(e[0])?Pe(e[0],Ye(co())):Pe(yr(e,1),Ye(co()))).length;return Qr(function(r){for(var i=-1,o=bn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return Oe(t,this,r)})}),Fs=Qr(function(t,e){var n=hn(e,uo(Fs));return Zi(t,c,i,e,n)}),$s=Qr(function(t,e){var n=hn(e,uo($s));return Zi(t,l,i,e,n)}),Bs=ro(function(t,e){return Zi(t,d,i,i,i,e)});function qs(t,e){return t===e||t!=t&&e!=e}var Us=Ji(Or),Vs=Ji(function(t,e){return t>=e}),Gs=Nr(function(){return arguments}())?Nr:function(t){return na(t)&&Dt.call(t,"callee")&&!Xt.call(t,"callee")},zs=r.isArray,Ws=we?Ye(we):function(t){return na(t)&&Ar(t)==R};function Js(t){return null!=t&&ta(t.length)&&!Zs(t)}function Hs(t){return na(t)&&Js(t)}var Xs=ve||_u,Ks=xe?Ye(xe):function(t){return na(t)&&Ar(t)==w};function Qs(t){if(!na(t))return!1;var e=Ar(t);return e==x||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!oa(t)}function Zs(t){if(!ea(t))return!1;var e=Ar(t);return e==T||e==k||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Ys(t){return"number"==typeof t&&t==ma(t)}function ta(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=f}function ea(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function na(t){return null!=t&&"object"==typeof t}var ra=Te?Ye(Te):function(t){return na(t)&&go(t)==S};function ia(t){return"number"==typeof t||na(t)&&Ar(t)==A}function oa(t){if(!na(t)||Ar(t)!=O)return!1;var e=Jt(t);if(null===e)return!0;var n=Dt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Pt.call(n)==Bt}var sa=ke?Ye(ke):function(t){return na(t)&&Ar(t)==C};var aa=Se?Ye(Se):function(t){return na(t)&&go(t)==M};function ua(t){return"string"==typeof t||!zs(t)&&na(t)&&Ar(t)==I}function ca(t){return"symbol"==typeof t||na(t)&&Ar(t)==N}var la=Ae?Ye(Ae):function(t){return na(t)&&ta(t.length)&&!!ue[Ar(t)]};var ha=Ji($r),da=Ji(function(t,e){return t<=e});function pa(t){if(!t)return[];if(Js(t))return ua(t)?mn(t):Mi(t);if(Zt&&t[Zt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Zt]());var e=go(t);return(e==S?cn:e==M?dn:qa)(t)}function fa(t){return t?(t=_a(t))===p||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ma(t){var e=fa(t),n=e%1;return e==e?n?e-n:e:0}function ga(t){return t?ur(ma(t),0,g):0}function _a(t){if("number"==typeof t)return t;if(ca(t))return m;if(ea(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ze(t);var n=_t.test(t);return n||vt.test(t)?de(t.slice(2),n?2:8):gt.test(t)?m:+t}function ya(t){return Ii(t,ja(t))}function va(t){return null==t?"":li(t)}var ba=ji(function(t,e){if(So(e)||Js(e))Ii(e,Na(e),t);else for(var n in e)Dt.call(e,n)&&nr(t,n,e[n])}),wa=ji(function(t,e){Ii(e,ja(e),t)}),xa=ji(function(t,e,n,r){Ii(e,ja(e),t,r)}),Ta=ji(function(t,e,n,r){Ii(e,Na(e),t,r)}),ka=ro(ar);var Sa=Qr(function(t,e){t=Ot(t);var n=-1,r=e.length,o=r>2?e[2]:i;for(o&&wo(e[0],e[1],o)&&(r=1);++n<r;)for(var s=e[n],a=ja(s),u=-1,c=a.length;++u<c;){var l=a[u],h=t[l];(h===i||qs(h,jt[l])&&!Dt.call(t,l))&&(t[l]=s[l])}return t}),Aa=Qr(function(t){return t.push(i,to),Oe(Pa,i,t)});function Oa(t,e,n){var r=null==t?i:kr(t,e);return r===i?n:r}function Ea(t,e){return null!=t&&_o(t,e,Cr)}var Ca=Ui(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=$t.call(e)),t[e]=n},eu(iu)),Ma=Ui(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=$t.call(e)),Dt.call(t,e)?t[e].push(n):t[e]=[n]},co),Ia=Qr(Ir);function Na(t){return Js(t)?Qn(t):Lr(t)}function ja(t){return Js(t)?Qn(t,!0):Fr(t)}var Ra=ji(function(t,e,n){Vr(t,e,n)}),Pa=ji(function(t,e,n,r){Vr(t,e,n,r)}),Da=ro(function(t,e){var n={};if(null==t)return n;var r=!1;e=Pe(e,function(e){return e=bi(e,t),r||(r=e.length>1),e}),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 Ea(t,n)})}(t,e)});function Fa(t,e){if(null==t)return{};var n=Pe(oo(t),function(t){return[t]});return e=co(e),Wr(t,n,function(t,n){return e(t,n[0])})}var $a=Qi(Na),Ba=Qi(ja);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 Qa(va(t).toLowerCase())}function Ga(t){return(t=va(t))&&t.replace(wt,on).replace(ee,"")}var za=Li(function(t,e,n){return t+(n?"-":"")+e.toLowerCase()}),Wa=Li(function(t,e,n){return t+(n?" ":"")+e.toLowerCase()}),Ja=Di("toLowerCase");var Ha=Li(function(t,e,n){return t+(n?"_":"")+e.toLowerCase()});var Xa=Li(function(t,e,n){return t+(n?" ":"")+Qa(e)});var Ka=Li(function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}),Qa=Di("toUpperCase");function Za(t,e,n){return t=va(t),(e=n?i:e)===i?function(t){return oe.test(t)}(t)?function(t){return t.match(re)||[]}(t):function(t){return t.match(ht)||[]}(t):t.match(e)||[]}var Ya=Qr(function(t,e){try{return Oe(t,i,e)}catch(t){return Qs(t)?t:new kt(t)}}),tu=ro(function(t,e){return Ce(e,function(e){e=Fo(e),sr(t,e,Ms(t[e],t))}),t});function eu(t){return function(){return t}}var nu=Bi(),ru=Bi(!0);function iu(t){return t}function ou(t){return Dr("function"==typeof t?t:cr(t,1))}var su=Qr(function(t,e){return function(n){return Ir(n,t,e)}}),au=Qr(function(t,e){return function(n){return Ir(t,n,e)}});function uu(t,e,n){var r=Na(e),i=Tr(e,r);null!=n||ea(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=Tr(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,De([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 kr(e,t)}}(t)}var fu=Wi(),mu=Wi(!0);function gu(){return[]}function _u(){return!1}var yu=Vi(function(t,e){return t+e},0),vu=Xi("ceil"),bu=Vi(function(t,e){return t/e},1),wu=Xi("floor");var xu,Tu=Vi(function(t,e){return t*e},1),ku=Xi("round"),Su=Vi(function(t,e){return t-e},0);return qn.after=function(t,e){if("function"!=typeof e)throw new Mt(o);return t=ma(t),function(){if(--t<1)return e.apply(this,arguments)}},qn.ary=Es,qn.assign=ba,qn.assignIn=wa,qn.assignInWith=xa,qn.assignWith=Ta,qn.at=ka,qn.before=Cs,qn.bind=Ms,qn.bindAll=tu,qn.bindKey=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 De(zs(n)?Mi(n):[n],yr(e,1))},qn.cond=function(t){var e=null==t?0:t.length,n=co();return t=e?Pe(t,function(t){if("function"!=typeof t[1])throw new Mt(o);return[n(t[0]),t[1]]}):[],Qr(function(n){for(var r=-1;++r<e;){var i=t[r];if(Oe(i[0],this,n))return Oe(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=Sa,qn.defaultsDeep=Aa,qn.defer=js,qn.delay=Rs,qn.difference=qo,qn.differenceBy=Uo,qn.differenceWith=Vo,qn.drop=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,(e=n||e===i?1:ma(e))<0?0:e,r):[]},qn.dropRight=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,0,(e=r-(e=n||e===i?1:ma(e)))<0?0:e):[]},qn.dropRightWhile=function(t,e){return t&&t.length?fi(t,co(e,3),!0,!0):[]},qn.dropWhile=function(t,e){return t&&t.length?fi(t,co(e,3),!0):[]},qn.fill=function(t,e,n,r){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&wo(t,e,n)&&(n=0,r=o),function(t,e,n,r){var o=t.length;for((n=ma(n))<0&&(n=-n>o?0:o+n),(r=r===i||r>o?o:ma(r))<0&&(r+=o),r=n>r?0:ga(r);n<r;)t[n++]=e;return t}(t,e,n,r)):[]},qn.filter=function(t,e){return(zs(t)?Ne:_r)(t,co(e,3))},qn.flatMap=function(t,e){return yr(ks(t,e),1)},qn.flatMapDeep=function(t,e){return yr(ks(t,e),p)},qn.flatMapDepth=function(t,e,n){return n=n===i?1:ma(n),yr(ks(t,e),n)},qn.flatten=Wo,qn.flattenDeep=function(t){return(null==t?0:t.length)?yr(t,p):[]},qn.flattenDepth=function(t,e){return(null==t?0:t.length)?yr(t,e=e===i?1:ma(e)):[]},qn.flip=function(t){return Zi(t,512)},qn.flow=nu,qn.flowRight=ru,qn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},qn.functions=function(t){return null==t?[]:Tr(t,Na(t))},qn.functionsIn=function(t){return null==t?[]:Tr(t,ja(t))},qn.groupBy=ws,qn.initial=function(t){return(null==t?0:t.length)?ii(t,0,-1):[]},qn.intersection=Ho,qn.intersectionBy=Xo,qn.intersectionWith=Ko,qn.invert=Ca,qn.invertBy=Ma,qn.invokeMap=xs,qn.iteratee=ou,qn.keyBy=Ts,qn.keys=Na,qn.keysIn=ja,qn.map=ks,qn.mapKeys=function(t,e){var n={};return e=co(e,3),wr(t,function(t,r,i){sr(n,e(t,r,i),t)}),n},qn.mapValues=function(t,e){var n={};return e=co(e,3),wr(t,function(t,r,i){sr(n,r,e(t,r,i))}),n},qn.matches=function(t){return qr(cr(t,1))},qn.matchesProperty=function(t,e){return Ur(t,cr(e,1))},qn.memoize=Ps,qn.merge=Ra,qn.mergeWith=Pa,qn.method=su,qn.methodOf=au,qn.mixin=uu,qn.negate=Ds,qn.nthArg=function(t){return t=ma(t),Qr(function(e){return Gr(e,t)})},qn.omit=Da,qn.omitBy=function(t,e){return Fa(t,Ds(co(e)))},qn.once=function(t){return Cs(2,t)},qn.orderBy=function(t,e,n,r){return null==t?[]:(zs(e)||(e=null==e?[]:[e]),zs(n=r?i:n)||(n=null==n?[]:[n]),zr(t,e,n))},qn.over=lu,qn.overArgs=Ls,qn.overEvery=hu,qn.overSome=du,qn.partial=Fs,qn.partialRight=$s,qn.partition=Ss,qn.pick=La,qn.pickBy=Fa,qn.property=pu,qn.propertyOf=function(t){return function(e){return null==t?i:kr(t,e)}},qn.pull=Zo,qn.pullAll=Yo,qn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Jr(t,e,co(n,2)):t},qn.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?Jr(t,e,i,n):t},qn.pullAt=ts,qn.range=fu,qn.rangeRight=mu,qn.rearg=Bs,qn.reject=function(t,e){return(zs(t)?Ne:_r)(t,Ds(co(e,3)))},qn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=co(e,3);++r<o;){var s=t[r];e(s,r,t)&&(n.push(s),i.push(r))}return Hr(t,i),n},qn.rest=function(t,e){if("function"!=typeof t)throw new Mt(o);return Qr(t,e=e===i?e:ma(e))},qn.reverse=es,qn.sampleSize=function(t,e,n){return e=(n?wo(t,e,n):e===i)?1:ma(e),(zs(t)?Yn:Yr)(t,e)},qn.set=function(t,e,n){return null==t?t:ti(t,e,n)},qn.setWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:ti(t,e,n,r)},qn.shuffle=function(t){return(zs(t)?tr:ri)(t)},qn.slice=function(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&wo(t,e,n)?(e=0,n=r):(e=null==e?0:ma(e),n=n===i?r:ma(n)),ii(t,e,n)):[]},qn.sortBy=As,qn.sortedUniq=function(t){return t&&t.length?ui(t):[]},qn.sortedUniqBy=function(t,e){return t&&t.length?ui(t,co(e,2)):[]},qn.split=function(t,e,n){return n&&"number"!=typeof n&&wo(t,e,n)&&(e=n=i),(n=n===i?g:n>>>0)?(t=va(t))&&("string"==typeof e||null!=e&&!sa(e))&&!(e=li(e))&&un(t)?xi(mn(t),0,n):t.split(e,n):[]},qn.spread=function(t,e){if("function"!=typeof t)throw new Mt(o);return e=null==e?0:vn(ma(e),0),Qr(function(n){var r=n[e],i=xi(n,0,e);return r&&De(i,r),Oe(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 Es(t,1)},qn.union=ns,qn.unionBy=rs,qn.unionWith=is,qn.uniq=function(t){return t&&t.length?hi(t):[]},qn.uniqBy=function(t,e){return t&&t.length?hi(t,co(e,2)):[]},qn.uniqWith=function(t,e){return e="function"==typeof e?e:i,t&&t.length?hi(t,i,e):[]},qn.unset=function(t,e){return null==t||di(t,e)},qn.unzip=os,qn.unzipWith=ss,qn.update=function(t,e,n){return null==t?t:pi(t,e,vi(n))},qn.updateWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:pi(t,e,vi(n),r)},qn.values=qa,qn.valuesIn=function(t){return null==t?[]:tn(t,ja(t))},qn.without=as,qn.words=Za,qn.wrap=function(t,e){return Fs(vi(e),t)},qn.xor=us,qn.xorBy=cs,qn.xorWith=ls,qn.zip=hs,qn.zipObject=function(t,e){return _i(t||[],e||[],nr)},qn.zipObjectDeep=function(t,e){return _i(t||[],e||[],ti)},qn.zipWith=ds,qn.entries=$a,qn.entriesIn=Ba,qn.extend=wa,qn.extendWith=xa,uu(qn,qn),qn.add=yu,qn.attempt=Ya,qn.camelCase=Ua,qn.capitalize=Va,qn.ceil=vu,qn.clamp=function(t,e,n){return n===i&&(n=e,e=i),n!==i&&(n=(n=_a(n))==n?n:0),e!==i&&(e=(e=_a(e))==e?e:0),ur(_a(t),e,n)},qn.clone=function(t){return cr(t,4)},qn.cloneDeep=function(t){return cr(t,5)},qn.cloneDeepWith=function(t,e){return cr(t,5,e="function"==typeof e?e:i)},qn.cloneWith=function(t,e){return cr(t,4,e="function"==typeof e?e:i)},qn.conformsTo=function(t,e){return null==e||lr(t,e,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))&&Q.test(t)?t.replace(X,sn):t},qn.escapeRegExp=function(t){return(t=va(t))&&ot.test(t)?t.replace(it,"\\$&"):t},qn.every=function(t,e,n){var r=zs(t)?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),ja)},qn.forInRight=function(t,e){return null==t?t:br(t,co(e,3),ja)},qn.forOwn=function(t,e){return t&&wr(t,co(e,3))},qn.forOwnRight=function(t,e){return t&&xr(t,co(e,3))},qn.get=Oa,qn.gt=Us,qn.gte=Vs,qn.has=function(t,e){return null!=t&&_o(t,e,Er)},qn.hasIn=Ea,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==S||e==M)return!t.size;if(So(t))return!Lr(t).length;for(var n in t)if(Dt.call(t,n))return!1;return!0},qn.isEqual=function(t,e){return jr(t,e)},qn.isEqualWith=function(t,e,n){var r=(n="function"==typeof n?n:i)?n(t,e):i;return r===i?jr(t,e,i,n):!!r},qn.isError=Qs,qn.isFinite=function(t){return"number"==typeof t&&be(t)},qn.isFunction=Zs,qn.isInteger=Ys,qn.isLength=ta,qn.isMap=ra,qn.isMatch=function(t,e){return t===e||Rr(t,e,ho(e))},qn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:i,Rr(t,e,ho(e),n)},qn.isNaN=function(t){return ia(t)&&t!=+t},qn.isNative=function(t){if(ko(t))throw new kt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Pr(t)},qn.isNil=function(t){return null==t},qn.isNull=function(t){return null===t},qn.isNumber=ia,qn.isObject=ea,qn.isObjectLike=na,qn.isPlainObject=oa,qn.isRegExp=sa,qn.isSafeInteger=function(t){return Ys(t)&&t>=-9007199254740991&&t<=f},qn.isSet=aa,qn.isString=ua,qn.isSymbol=ca,qn.isTypedArray=la,qn.isUndefined=function(t){return t===i},qn.isWeakMap=function(t){return na(t)&&go(t)==j},qn.isWeakSet=function(t){return na(t)&&"[object WeakSet]"==Ar(t)},qn.join=function(t,e){return null==t?"":Be.call(t,e)},qn.kebabCase=za,qn.last=Qo,qn.lastIndexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=ma(n))<0?vn(r+o,0):bn(o,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,o):Ue(t,ze,o,!0)},qn.lowerCase=Wa,qn.lowerFirst=Ja,qn.lt=ha,qn.lte=da,qn.max=function(t){return t&&t.length?gr(t,iu,Or):i},qn.maxBy=function(t,e){return t&&t.length?gr(t,co(e,2),Or):i},qn.mean=function(t){return We(t,iu)},qn.meanBy=function(t,e){return We(t,co(e,2))},qn.min=function(t){return t&&t.length?gr(t,iu,$r):i},qn.minBy=function(t,e){return t&&t.length?gr(t,co(e,2),$r):i},qn.stubArray=gu,qn.stubFalse=_u,qn.stubObject=function(){return{}},qn.stubString=function(){return""},qn.stubTrue=function(){return!0},qn.multiply=Tu,qn.nth=function(t,e){return t&&t.length?Gr(t,ma(e)):i},qn.noConflict=function(){return me._===this&&(me._=qt),this},qn.noop=cu,qn.now=Os,qn.pad=function(t,e,n){t=va(t);var r=(e=ma(e))?fn(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return zi(ge(i),n)+t+zi(fe(i),n)},qn.padEnd=function(t,e,n){t=va(t);var r=(e=ma(e))?fn(t):0;return e&&r<e?t+zi(e-r,n):t},qn.padStart=function(t,e,n){t=va(t);var r=(e=ma(e))?fn(t):0;return e&&r<e?zi(e-r,n)+t:t},qn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),xn(va(t).replace(st,""),e||0)},qn.random=function(t,e,n){if(n&&"boolean"!=typeof n&&wo(t,e,n)&&(e=n=i),n===i&&("boolean"==typeof e?(n=e,e=i):"boolean"==typeof t&&(n=t,t=i)),t===i&&e===i?(t=0,e=1):(t=fa(t),e===i?(e=t,t=0):e=fa(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var o=Tn();return bn(t+o*(e-t+he("1e-"+((o+"").length-1))),e)}return Xr(t,e)},qn.reduce=function(t,e,n){var r=zs(t)?Le:Xe,i=arguments.length<3;return r(t,co(e,4),n,i,pr)},qn.reduceRight=function(t,e,n){var r=zs(t)?Fe:Xe,i=arguments.length<3;return r(t,co(e,4),n,i,fr)},qn.repeat=function(t,e,n){return e=(n?wo(t,e,n):e===i)?1:ma(e),Kr(va(t),e)},qn.replace=function(){var t=arguments,e=va(t[0]);return t.length<3?e:e.replace(t[1],t[2])},qn.result=function(t,e,n){var r=-1,o=(e=bi(e,t)).length;for(o||(o=1,t=i);++r<o;){var s=null==t?i:t[Fo(e[r])];s===i&&(r=o,s=n),t=Zs(s)?s.call(t):s}return t},qn.round=ku,qn.runInContext=t,qn.sample=function(t){return(zs(t)?Zn:Zr)(t)},qn.size=function(t){if(null==t)return 0;if(Js(t))return ua(t)?fn(t):t.length;var e=go(t);return e==S||e==M?t.size:Lr(t).length},qn.snakeCase=Ha,qn.some=function(t,e,n){var r=zs(t)?$e:oi;return n&&wo(t,e,n)&&(e=i),r(t,co(e,3))},qn.sortedIndex=function(t,e){return si(t,e)},qn.sortedIndexBy=function(t,e,n){return ai(t,e,co(n,2))},qn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=si(t,e);if(r<n&&qs(t[r],e))return r}return-1},qn.sortedLastIndex=function(t,e){return si(t,e,!0)},qn.sortedLastIndexBy=function(t,e,n){return ai(t,e,co(n,2),!0)},qn.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var n=si(t,e,!0)-1;if(qs(t[n],e))return n}return-1},qn.startCase=Xa,qn.startsWith=function(t,e,n){return t=va(t),n=null==n?0:ur(ma(n),0,t.length),e=li(e),t.slice(n,n+e.length)==e},qn.subtract=Su,qn.sum=function(t){return t&&t.length?Ke(t,iu):0},qn.sumBy=function(t,e){return t&&t.length?Ke(t,co(e,2)):0},qn.template=function(t,e,n){var r=qn.templateSettings;n&&wo(t,e,n)&&(e=i),t=va(t),e=xa({},e,r,Yi);var o,s,a=xa({},e.imports,r.imports,Yi),u=Na(a),c=tn(a,u),l=0,h=e.interpolate||xt,d="__p += '",p=Et((e.escape||xt).source+"|"+h.source+"|"+(h===tt?ft:xt).source+"|"+(e.evaluate||xt).source+"|$","g"),f="//# sourceURL="+(Dt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ae+"]")+"\n";t.replace(p,function(e,n,r,i,a,u){return r||(r=i),d+=t.slice(l,u).replace(Tt,an),n&&(o=!0,d+="' +\n__e("+n+") +\n'"),a&&(s=!0,d+="';\n"+a+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+e.length,e}),d+="';\n";var m=Dt.call(e,"variable")&&e.variable;if(m){if(dt.test(m))throw new kt("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(s?d.replace(z,""):d).replace(W,"$1").replace(J,"$1;"),d="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=Ya(function(){return St(u,f+"return "+d).apply(i,c)});if(g.source=d,Qs(g))throw g;return g},qn.times=function(t,e){if((t=ma(t))<1||t>f)return[];var n=g,r=bn(t,g);e=co(e),t-=g;for(var i=Qe(r,e);++n<t;)e(n);return i},qn.toFinite=fa,qn.toInteger=ma,qn.toLength=ga,qn.toLower=function(t){return va(t).toLowerCase()},qn.toNumber=_a,qn.toSafeInteger=function(t){return t?ur(ma(t),-9007199254740991,f):0===t?t:0},qn.toString=va,qn.toUpper=function(t){return va(t).toUpperCase()},qn.trim=function(t,e,n){if((t=va(t))&&(n||e===i))return Ze(t);if(!t||!(e=li(e)))return t;var r=mn(t),o=mn(e);return xi(r,nn(r,o),rn(r,o)+1).join("")},qn.trimEnd=function(t,e,n){if((t=va(t))&&(n||e===i))return t.slice(0,gn(t)+1);if(!t||!(e=li(e)))return t;var r=mn(t);return xi(r,0,rn(r,mn(e))+1).join("")},qn.trimStart=function(t,e,n){if((t=va(t))&&(n||e===i))return t.replace(st,"");if(!t||!(e=li(e)))return t;var r=mn(t);return xi(r,nn(r,mn(e))).join("")},qn.truncate=function(t,e){var n=30,r="...";if(ea(e)){var o="separator"in e?e.separator:o;n="length"in e?ma(e.length):n,r="omission"in e?li(e.omission):r}var s=(t=va(t)).length;if(un(t)){var a=mn(t);s=a.length}if(n>=s)return t;var u=n-fn(r);if(u<1)return r;var c=a?xi(a,0,u).join(""):t.slice(0,u);if(o===i)return c+r;if(a&&(u+=c.length-u),sa(o)){if(t.slice(u).search(o)){var l,h=c;for(o.global||(o=Et(o.source,va(mt.exec(o))+"g")),o.lastIndex=0;l=o.exec(h);)var d=l.index;c=c.slice(0,d===i?u:d)}}else if(t.indexOf(li(o),u)!=u){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+r},qn.unescape=function(t){return(t=va(t))&&K.test(t)?t.replace(H,_n):t},qn.uniqueId=function(t){var e=++Lt;return va(t)+e},qn.upperCase=Ka,qn.upperFirst=Qa,qn.each=vs,qn.eachRight=bs,qn.first=Jo,uu(qn,(xu={},wr(qn,function(t,e){Dt.call(qn.prototype,e)||(xu[e]=t)}),xu),{chain:!1}),qn.VERSION="4.17.21",Ce(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){qn[t].placeholder=qn}),Ce(["drop","take"],function(t,e){zn.prototype[t]=function(n){n=n===i?1:vn(ma(n),0);var r=this.__filtered__&&!e?new zn(this):this.clone();return r.__filtered__?r.__takeCount__=bn(n,r.__takeCount__):r.__views__.push({size:bn(n,g),type:t+(r.__dir__<0?"Right":"")}),r},zn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),Ce(["filter","map","takeWhile"],function(t,e){var n=e+1,r=1==n||3==n;zn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:co(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}}),Ce(["head","last"],function(t,e){var n="take"+(e?"Right":"");zn.prototype[t]=function(){return this[n](1).value()[0]}}),Ce(["initial","tail"],function(t,e){var n="drop"+(e?"":"Right");zn.prototype[t]=function(){return this.__filtered__?new zn(this):this[n](1)}}),zn.prototype.compact=function(){return this.filter(iu)},zn.prototype.find=function(t){return this.filter(t).head()},zn.prototype.findLast=function(t){return this.reverse().find(t)},zn.prototype.invokeMap=Qr(function(t,e){return"function"==typeof t?new zn(this):this.map(function(n){return Ir(n,t,e)})}),zn.prototype.reject=function(t){return this.filter(Ds(co(t)))},zn.prototype.slice=function(t,e){t=ma(t);var n=this;return n.__filtered__&&(t>0||e<0)?new zn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==i&&(n=(e=ma(e))<0?n.dropRight(-e):n.take(e-t)),n)},zn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},zn.prototype.toArray=function(){return this.take(g)},wr(zn.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),o=qn[r?"take"+("last"==e?"Right":""):e],s=r||/^find/.test(e);o&&(qn.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,u=e instanceof zn,c=a[0],l=u||zs(e),h=function(t){var e=o.apply(qn,De([t],a));return r&&d?e[0]:e};l&&n&&"function"==typeof c&&1!=c.length&&(u=l=!1);var d=this.__chain__,p=!!this.__actions__.length,f=s&&!d,m=u&&!p;if(!s&&l){e=m?e:new zn(this);var g=t.apply(e,a);return g.__actions__.push({func:fs,args:[h],thisArg:i}),new Gn(g,d)}return f&&m?t.apply(this,a):(g=this.thru(h),f?r?g.value()[0]:g.value():g)})}),Ce(["pop","push","shift","sort","splice","unshift"],function(t){var e=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+"";Dt.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)},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)}}},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={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},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},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},2987:t=>{t.exports=function(t){if(Array.isArray(t))return t},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},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},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)}},4106:(t,e)=>{function n(t,e){var n=[],r=[];return null==e&&(e=function(t,e){return n[0]===e?"[Circular ~]":"[Circular ~."+r.slice(0,n.indexOf(e)).join(".")+"]"}),function(i,o){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?r.splice(s,1/0,i):r.push(i),~n.indexOf(o)&&(o=e.call(this,i,o))}else n.push(o);return null==t?o:t.call(this,i,o)}}(t.exports=function(t,e,r,i){return JSON.stringify(t,n(e,i),r)}).getSerialize=n},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},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},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},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},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}},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},6201:(t,e)=>{e.__esModule=!0;var n=function(){var t={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,partialBlock:12,content:13,COMMENT:14,CONTENT:15,openRawBlock:16,rawBlock_repetition0:17,END_RAW_BLOCK:18,OPEN_RAW_BLOCK:19,helperName:20,openRawBlock_repetition0:21,openRawBlock_option0:22,CLOSE_RAW_BLOCK:23,openBlock:24,block_option0:25,closeBlock:26,openInverse:27,block_option1:28,OPEN_BLOCK:29,openBlock_repetition0:30,openBlock_option0:31,openBlock_option1:32,CLOSE:33,OPEN_INVERSE:34,openInverse_repetition0:35,openInverse_option0:36,openInverse_option1:37,openInverseChain:38,OPEN_INVERSE_CHAIN:39,openInverseChain_repetition0:40,openInverseChain_option0:41,openInverseChain_option1:42,inverseAndProgram:43,INVERSE:44,inverseChain:45,inverseChain_option0:46,OPEN_ENDBLOCK:47,OPEN:48,mustache_repetition0:49,mustache_option0:50,OPEN_UNESCAPED:51,mustache_repetition1:52,mustache_option1:53,CLOSE_UNESCAPED:54,OPEN_PARTIAL:55,partialName:56,partial_repetition0:57,partial_option0:58,openPartialBlock:59,OPEN_PARTIAL_BLOCK:60,openPartialBlock_repetition0:61,openPartialBlock_option0:62,param:63,sexpr:64,OPEN_SEXPR:65,sexpr_repetition0:66,sexpr_option0:67,CLOSE_SEXPR:68,hash:69,hash_repetition_plus0:70,hashSegment:71,ID:72,EQUALS:73,blockParams:74,OPEN_BLOCK_PARAMS:75,blockParams_repetition_plus0:76,CLOSE_BLOCK_PARAMS:77,path:78,dataName:79,STRING:80,NUMBER:81,BOOLEAN:82,UNDEFINED:83,NULL:84,DATA:85,pathSegments:86,SEP:87,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"COMMENT",15:"CONTENT",18:"END_RAW_BLOCK",19:"OPEN_RAW_BLOCK",23:"CLOSE_RAW_BLOCK",29:"OPEN_BLOCK",33:"CLOSE",34:"OPEN_INVERSE",39:"OPEN_INVERSE_CHAIN",44:"INVERSE",47:"OPEN_ENDBLOCK",48:"OPEN",51:"OPEN_UNESCAPED",54:"CLOSE_UNESCAPED",55:"OPEN_PARTIAL",60:"OPEN_PARTIAL_BLOCK",65:"OPEN_SEXPR",68:"CLOSE_SEXPR",72:"ID",73:"EQUALS",75:"OPEN_BLOCK_PARAMS",77:"CLOSE_BLOCK_PARAMS",80:"STRING",81:"NUMBER",82:"BOOLEAN",83:"UNDEFINED",84:"NULL",85:"DATA",87:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[13,1],[10,3],[16,5],[9,4],[9,4],[24,6],[27,6],[38,6],[43,2],[45,3],[45,1],[26,3],[8,5],[8,5],[11,5],[12,3],[59,5],[63,1],[63,1],[64,5],[69,1],[71,3],[74,3],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[56,1],[56,1],[79,2],[78,1],[86,3],[86,1],[6,0],[6,2],[17,0],[17,2],[21,0],[21,2],[22,0],[22,1],[25,0],[25,1],[28,0],[28,1],[30,0],[30,2],[31,0],[31,1],[32,0],[32,1],[35,0],[35,2],[36,0],[36,1],[37,0],[37,1],[40,0],[40,2],[41,0],[41,1],[42,0],[42,1],[46,0],[46,1],[49,0],[49,2],[50,0],[50,1],[52,0],[52,2],[53,0],[53,1],[57,0],[57,2],[58,0],[58,1],[61,0],[61,2],[62,0],[62,1],[66,0],[66,2],[67,0],[67,1],[70,1],[70,2],[76,1],[76,2]],performAction:function(t,e,n,r,i,o,s){var a=o.length-1;switch(i){case 1:return o[a-1];case 2:this.$=r.prepareProgram(o[a]);break;case 3:case 4:case 5:case 6:case 7:case 8:case 20:case 27:case 28:case 33:case 34:case 40:case 41:this.$=o[a];break;case 9:this.$={type:"CommentStatement",value:r.stripComment(o[a]),strip:r.stripFlags(o[a],o[a]),loc:r.locInfo(this._$)};break;case 10:this.$={type:"ContentStatement",original:o[a],value:o[a],loc:r.locInfo(this._$)};break;case 11:this.$=r.prepareRawBlock(o[a-2],o[a-1],o[a],this._$);break;case 12:this.$={path:o[a-3],params:o[a-2],hash:o[a-1]};break;case 13:this.$=r.prepareBlock(o[a-3],o[a-2],o[a-1],o[a],!1,this._$);break;case 14:this.$=r.prepareBlock(o[a-3],o[a-2],o[a-1],o[a],!0,this._$);break;case 15:this.$={open:o[a-5],path:o[a-4],params:o[a-3],hash:o[a-2],blockParams:o[a-1],strip:r.stripFlags(o[a-5],o[a])};break;case 16:case 17:this.$={path:o[a-4],params:o[a-3],hash:o[a-2],blockParams:o[a-1],strip:r.stripFlags(o[a-5],o[a])};break;case 18:this.$={strip:r.stripFlags(o[a-1],o[a-1]),program:o[a]};break;case 19:var u=r.prepareBlock(o[a-2],o[a-1],o[a],o[a],!1,this._$),c=r.prepareProgram([u],o[a-1].loc);c.chained=!0,this.$={strip:o[a-2].strip,program:c,chain:!0};break;case 21:this.$={path:o[a-1],strip:r.stripFlags(o[a-2],o[a])};break;case 22:case 23:this.$=r.prepareMustache(o[a-3],o[a-2],o[a-1],o[a-4],r.stripFlags(o[a-4],o[a]),this._$);break;case 24:this.$={type:"PartialStatement",name:o[a-3],params:o[a-2],hash:o[a-1],indent:"",strip:r.stripFlags(o[a-4],o[a]),loc:r.locInfo(this._$)};break;case 25:this.$=r.preparePartialBlock(o[a-2],o[a-1],o[a],this._$);break;case 26:this.$={path:o[a-3],params:o[a-2],hash:o[a-1],strip:r.stripFlags(o[a-4],o[a])};break;case 29:this.$={type:"SubExpression",path:o[a-3],params:o[a-2],hash:o[a-1],loc:r.locInfo(this._$)};break;case 30:this.$={type:"Hash",pairs:o[a],loc:r.locInfo(this._$)};break;case 31:this.$={type:"HashPair",key:r.id(o[a-2]),value:o[a],loc:r.locInfo(this._$)};break;case 32:this.$=r.id(o[a-1]);break;case 35:this.$={type:"StringLiteral",value:o[a],original:o[a],loc:r.locInfo(this._$)};break;case 36:this.$={type:"NumberLiteral",value:Number(o[a]),original:Number(o[a]),loc:r.locInfo(this._$)};break;case 37:this.$={type:"BooleanLiteral",value:"true"===o[a],original:"true"===o[a],loc:r.locInfo(this._$)};break;case 38:this.$={type:"UndefinedLiteral",original:void 0,value:void 0,loc:r.locInfo(this._$)};break;case 39:this.$={type:"NullLiteral",original:null,value:null,loc:r.locInfo(this._$)};break;case 42:this.$=r.preparePath(!0,o[a],this._$);break;case 43:this.$=r.preparePath(!1,o[a],this._$);break;case 44:o[a-2].push({part:r.id(o[a]),original:o[a],separator:o[a-1]}),this.$=o[a-2];break;case 45:this.$=[{part:r.id(o[a]),original:o[a]}];break;case 46:case 48:case 50:case 58:case 64:case 70:case 78:case 82:case 86:case 90:case 94:this.$=[];break;case 47:case 49:case 51:case 59:case 65:case 71:case 79:case 83:case 87:case 91:case 95:case 99:case 101:o[a-1].push(o[a]);break;case 98:case 100:this.$=[o[a]]}},table:[{3:1,4:2,5:[2,46],6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:11,14:[1,12],15:[1,20],16:17,19:[1,23],24:15,27:16,29:[1,21],34:[1,22],39:[2,2],44:[2,2],47:[2,2],48:[1,13],51:[1,14],55:[1,18],59:19,60:[1,24]},{1:[2,1]},{5:[2,47],14:[2,47],15:[2,47],19:[2,47],29:[2,47],34:[2,47],39:[2,47],44:[2,47],47:[2,47],48:[2,47],51:[2,47],55:[2,47],60:[2,47]},{5:[2,3],14:[2,3],15:[2,3],19:[2,3],29:[2,3],34:[2,3],39:[2,3],44:[2,3],47:[2,3],48:[2,3],51:[2,3],55:[2,3],60:[2,3]},{5:[2,4],14:[2,4],15:[2,4],19:[2,4],29:[2,4],34:[2,4],39:[2,4],44:[2,4],47:[2,4],48:[2,4],51:[2,4],55:[2,4],60:[2,4]},{5:[2,5],14:[2,5],15:[2,5],19:[2,5],29:[2,5],34:[2,5],39:[2,5],44:[2,5],47:[2,5],48:[2,5],51:[2,5],55:[2,5],60:[2,5]},{5:[2,6],14:[2,6],15:[2,6],19:[2,6],29:[2,6],34:[2,6],39:[2,6],44:[2,6],47:[2,6],48:[2,6],51:[2,6],55:[2,6],60:[2,6]},{5:[2,7],14:[2,7],15:[2,7],19:[2,7],29:[2,7],34:[2,7],39:[2,7],44:[2,7],47:[2,7],48:[2,7],51:[2,7],55:[2,7],60:[2,7]},{5:[2,8],14:[2,8],15:[2,8],19:[2,8],29:[2,8],34:[2,8],39:[2,8],44:[2,8],47:[2,8],48:[2,8],51:[2,8],55:[2,8],60:[2,8]},{5:[2,9],14:[2,9],15:[2,9],19:[2,9],29:[2,9],34:[2,9],39:[2,9],44:[2,9],47:[2,9],48:[2,9],51:[2,9],55:[2,9],60:[2,9]},{20:25,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:36,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:37,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{4:38,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{15:[2,48],17:39,18:[2,48]},{20:41,56:40,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:44,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{5:[2,10],14:[2,10],15:[2,10],18:[2,10],19:[2,10],29:[2,10],34:[2,10],39:[2,10],44:[2,10],47:[2,10],48:[2,10],51:[2,10],55:[2,10],60:[2,10]},{20:45,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:46,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:47,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:41,56:48,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[2,78],49:49,65:[2,78],72:[2,78],80:[2,78],81:[2,78],82:[2,78],83:[2,78],84:[2,78],85:[2,78]},{23:[2,33],33:[2,33],54:[2,33],65:[2,33],68:[2,33],72:[2,33],75:[2,33],80:[2,33],81:[2,33],82:[2,33],83:[2,33],84:[2,33],85:[2,33]},{23:[2,34],33:[2,34],54:[2,34],65:[2,34],68:[2,34],72:[2,34],75:[2,34],80:[2,34],81:[2,34],82:[2,34],83:[2,34],84:[2,34],85:[2,34]},{23:[2,35],33:[2,35],54:[2,35],65:[2,35],68:[2,35],72:[2,35],75:[2,35],80:[2,35],81:[2,35],82:[2,35],83:[2,35],84:[2,35],85:[2,35]},{23:[2,36],33:[2,36],54:[2,36],65:[2,36],68:[2,36],72:[2,36],75:[2,36],80:[2,36],81:[2,36],82:[2,36],83:[2,36],84:[2,36],85:[2,36]},{23:[2,37],33:[2,37],54:[2,37],65:[2,37],68:[2,37],72:[2,37],75:[2,37],80:[2,37],81:[2,37],82:[2,37],83:[2,37],84:[2,37],85:[2,37]},{23:[2,38],33:[2,38],54:[2,38],65:[2,38],68:[2,38],72:[2,38],75:[2,38],80:[2,38],81:[2,38],82:[2,38],83:[2,38],84:[2,38],85:[2,38]},{23:[2,39],33:[2,39],54:[2,39],65:[2,39],68:[2,39],72:[2,39],75:[2,39],80:[2,39],81:[2,39],82:[2,39],83:[2,39],84:[2,39],85:[2,39]},{23:[2,43],33:[2,43],54:[2,43],65:[2,43],68:[2,43],72:[2,43],75:[2,43],80:[2,43],81:[2,43],82:[2,43],83:[2,43],84:[2,43],85:[2,43],87:[1,50]},{72:[1,35],86:51},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{52:52,54:[2,82],65:[2,82],72:[2,82],80:[2,82],81:[2,82],82:[2,82],83:[2,82],84:[2,82],85:[2,82]},{25:53,38:55,39:[1,57],43:56,44:[1,58],45:54,47:[2,54]},{28:59,43:60,44:[1,58],47:[2,56]},{13:62,15:[1,20],18:[1,61]},{33:[2,86],57:63,65:[2,86],72:[2,86],80:[2,86],81:[2,86],82:[2,86],83:[2,86],84:[2,86],85:[2,86]},{33:[2,40],65:[2,40],72:[2,40],80:[2,40],81:[2,40],82:[2,40],83:[2,40],84:[2,40],85:[2,40]},{33:[2,41],65:[2,41],72:[2,41],80:[2,41],81:[2,41],82:[2,41],83:[2,41],84:[2,41],85:[2,41]},{20:64,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:65,47:[1,66]},{30:67,33:[2,58],65:[2,58],72:[2,58],75:[2,58],80:[2,58],81:[2,58],82:[2,58],83:[2,58],84:[2,58],85:[2,58]},{33:[2,64],35:68,65:[2,64],72:[2,64],75:[2,64],80:[2,64],81:[2,64],82:[2,64],83:[2,64],84:[2,64],85:[2,64]},{21:69,23:[2,50],65:[2,50],72:[2,50],80:[2,50],81:[2,50],82:[2,50],83:[2,50],84:[2,50],85:[2,50]},{33:[2,90],61:70,65:[2,90],72:[2,90],80:[2,90],81:[2,90],82:[2,90],83:[2,90],84:[2,90],85:[2,90]},{20:74,33:[2,80],50:71,63:72,64:75,65:[1,43],69:73,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{72:[1,79]},{23:[2,42],33:[2,42],54:[2,42],65:[2,42],68:[2,42],72:[2,42],75:[2,42],80:[2,42],81:[2,42],82:[2,42],83:[2,42],84:[2,42],85:[2,42],87:[1,50]},{20:74,53:80,54:[2,84],63:81,64:75,65:[1,43],69:82,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:83,47:[1,66]},{47:[2,55]},{4:84,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{47:[2,20]},{20:85,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:86,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{26:87,47:[1,66]},{47:[2,57]},{5:[2,11],14:[2,11],15:[2,11],19:[2,11],29:[2,11],34:[2,11],39:[2,11],44:[2,11],47:[2,11],48:[2,11],51:[2,11],55:[2,11],60:[2,11]},{15:[2,49],18:[2,49]},{20:74,33:[2,88],58:88,63:89,64:75,65:[1,43],69:90,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{65:[2,94],66:91,68:[2,94],72:[2,94],80:[2,94],81:[2,94],82:[2,94],83:[2,94],84:[2,94],85:[2,94]},{5:[2,25],14:[2,25],15:[2,25],19:[2,25],29:[2,25],34:[2,25],39:[2,25],44:[2,25],47:[2,25],48:[2,25],51:[2,25],55:[2,25],60:[2,25]},{20:92,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,31:93,33:[2,60],63:94,64:75,65:[1,43],69:95,70:76,71:77,72:[1,78],75:[2,60],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,66],36:96,63:97,64:75,65:[1,43],69:98,70:76,71:77,72:[1,78],75:[2,66],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,22:99,23:[2,52],63:100,64:75,65:[1,43],69:101,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,92],62:102,63:103,64:75,65:[1,43],69:104,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,105]},{33:[2,79],65:[2,79],72:[2,79],80:[2,79],81:[2,79],82:[2,79],83:[2,79],84:[2,79],85:[2,79]},{33:[2,81]},{23:[2,27],33:[2,27],54:[2,27],65:[2,27],68:[2,27],72:[2,27],75:[2,27],80:[2,27],81:[2,27],82:[2,27],83:[2,27],84:[2,27],85:[2,27]},{23:[2,28],33:[2,28],54:[2,28],65:[2,28],68:[2,28],72:[2,28],75:[2,28],80:[2,28],81:[2,28],82:[2,28],83:[2,28],84:[2,28],85:[2,28]},{23:[2,30],33:[2,30],54:[2,30],68:[2,30],71:106,72:[1,107],75:[2,30]},{23:[2,98],33:[2,98],54:[2,98],68:[2,98],72:[2,98],75:[2,98]},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],73:[1,108],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{23:[2,44],33:[2,44],54:[2,44],65:[2,44],68:[2,44],72:[2,44],75:[2,44],80:[2,44],81:[2,44],82:[2,44],83:[2,44],84:[2,44],85:[2,44],87:[2,44]},{54:[1,109]},{54:[2,83],65:[2,83],72:[2,83],80:[2,83],81:[2,83],82:[2,83],83:[2,83],84:[2,83],85:[2,83]},{54:[2,85]},{5:[2,13],14:[2,13],15:[2,13],19:[2,13],29:[2,13],34:[2,13],39:[2,13],44:[2,13],47:[2,13],48:[2,13],51:[2,13],55:[2,13],60:[2,13]},{38:55,39:[1,57],43:56,44:[1,58],45:111,46:110,47:[2,76]},{33:[2,70],40:112,65:[2,70],72:[2,70],75:[2,70],80:[2,70],81:[2,70],82:[2,70],83:[2,70],84:[2,70],85:[2,70]},{47:[2,18]},{5:[2,14],14:[2,14],15:[2,14],19:[2,14],29:[2,14],34:[2,14],39:[2,14],44:[2,14],47:[2,14],48:[2,14],51:[2,14],55:[2,14],60:[2,14]},{33:[1,113]},{33:[2,87],65:[2,87],72:[2,87],80:[2,87],81:[2,87],82:[2,87],83:[2,87],84:[2,87],85:[2,87]},{33:[2,89]},{20:74,63:115,64:75,65:[1,43],67:114,68:[2,96],69:116,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,117]},{32:118,33:[2,62],74:119,75:[1,120]},{33:[2,59],65:[2,59],72:[2,59],75:[2,59],80:[2,59],81:[2,59],82:[2,59],83:[2,59],84:[2,59],85:[2,59]},{33:[2,61],75:[2,61]},{33:[2,68],37:121,74:122,75:[1,120]},{33:[2,65],65:[2,65],72:[2,65],75:[2,65],80:[2,65],81:[2,65],82:[2,65],83:[2,65],84:[2,65],85:[2,65]},{33:[2,67],75:[2,67]},{23:[1,123]},{23:[2,51],65:[2,51],72:[2,51],80:[2,51],81:[2,51],82:[2,51],83:[2,51],84:[2,51],85:[2,51]},{23:[2,53]},{33:[1,124]},{33:[2,91],65:[2,91],72:[2,91],80:[2,91],81:[2,91],82:[2,91],83:[2,91],84:[2,91],85:[2,91]},{33:[2,93]},{5:[2,22],14:[2,22],15:[2,22],19:[2,22],29:[2,22],34:[2,22],39:[2,22],44:[2,22],47:[2,22],48:[2,22],51:[2,22],55:[2,22],60:[2,22]},{23:[2,99],33:[2,99],54:[2,99],68:[2,99],72:[2,99],75:[2,99]},{73:[1,108]},{20:74,63:125,64:75,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,23],14:[2,23],15:[2,23],19:[2,23],29:[2,23],34:[2,23],39:[2,23],44:[2,23],47:[2,23],48:[2,23],51:[2,23],55:[2,23],60:[2,23]},{47:[2,19]},{47:[2,77]},{20:74,33:[2,72],41:126,63:127,64:75,65:[1,43],69:128,70:76,71:77,72:[1,78],75:[2,72],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,24],14:[2,24],15:[2,24],19:[2,24],29:[2,24],34:[2,24],39:[2,24],44:[2,24],47:[2,24],48:[2,24],51:[2,24],55:[2,24],60:[2,24]},{68:[1,129]},{65:[2,95],68:[2,95],72:[2,95],80:[2,95],81:[2,95],82:[2,95],83:[2,95],84:[2,95],85:[2,95]},{68:[2,97]},{5:[2,21],14:[2,21],15:[2,21],19:[2,21],29:[2,21],34:[2,21],39:[2,21],44:[2,21],47:[2,21],48:[2,21],51:[2,21],55:[2,21],60:[2,21]},{33:[1,130]},{33:[2,63]},{72:[1,132],76:131},{33:[1,133]},{33:[2,69]},{15:[2,12],18:[2,12]},{14:[2,26],15:[2,26],19:[2,26],29:[2,26],34:[2,26],47:[2,26],48:[2,26],51:[2,26],55:[2,26],60:[2,26]},{23:[2,31],33:[2,31],54:[2,31],68:[2,31],72:[2,31],75:[2,31]},{33:[2,74],42:134,74:135,75:[1,120]},{33:[2,71],65:[2,71],72:[2,71],75:[2,71],80:[2,71],81:[2,71],82:[2,71],83:[2,71],84:[2,71],85:[2,71]},{33:[2,73],75:[2,73]},{23:[2,29],33:[2,29],54:[2,29],65:[2,29],68:[2,29],72:[2,29],75:[2,29],80:[2,29],81:[2,29],82:[2,29],83:[2,29],84:[2,29],85:[2,29]},{14:[2,15],15:[2,15],19:[2,15],29:[2,15],34:[2,15],39:[2,15],44:[2,15],47:[2,15],48:[2,15],51:[2,15],55:[2,15],60:[2,15]},{72:[1,137],77:[1,136]},{72:[2,100],77:[2,100]},{14:[2,16],15:[2,16],19:[2,16],29:[2,16],34:[2,16],44:[2,16],47:[2,16],48:[2,16],51:[2,16],55:[2,16],60:[2,16]},{33:[1,138]},{33:[2,75]},{33:[2,32]},{72:[2,101],77:[2,101]},{14:[2,17],15:[2,17],19:[2,17],29:[2,17],34:[2,17],39:[2,17],44:[2,17],47:[2,17],48:[2,17],51:[2,17],55:[2,17],60:[2,17]}],defaultActions:{4:[2,1],54:[2,55],56:[2,20],60:[2,57],73:[2,81],82:[2,85],86:[2,18],90:[2,89],101:[2,53],104:[2,93],110:[2,19],111:[2,77],116:[2,97],119:[2,63],122:[2,69],135:[2,75],136:[2,32]},parseError:function(t,e){throw new Error(t)},parse:function(t){var e=this,n=[0],r=[null],i=[],o=this.table,s="",a=0,u=0,c=0;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,void 0===this.lexer.yylloc&&(this.lexer.yylloc={});var l=this.lexer.yylloc;i.push(l);var h=this.lexer.options&&this.lexer.options.ranges;function d(){var t;return"number"!=typeof(t=e.lexer.lex()||1)&&(t=e.symbols_[t]||t),t}"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var p,f,m,g,_,y,v,b,w,x={};;){if(m=n[n.length-1],this.defaultActions[m]?g=this.defaultActions[m]:(null==p&&(p=d()),g=o[m]&&o[m][p]),void 0===g||!g.length||!g[0]){var T="";if(!c){for(y in w=[],o[m])this.terminals_[y]&&y>2&&w.push("'"+this.terminals_[y]+"'");T=this.lexer.showPosition?"Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+w.join(", ")+", got '"+(this.terminals_[p]||p)+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==p?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(T,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:l,expected:w})}}if(g[0]instanceof Array&&g.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+p);switch(g[0]){case 1:n.push(p),r.push(this.lexer.yytext),i.push(this.lexer.yylloc),n.push(g[1]),p=null,f?(p=f,f=null):(u=this.lexer.yyleng,s=this.lexer.yytext,a=this.lexer.yylineno,l=this.lexer.yylloc,c>0&&c--);break;case 2:if(v=this.productions_[g[1]][1],x.$=r[r.length-v],x._$={first_line:i[i.length-(v||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(v||1)].first_column,last_column:i[i.length-1].last_column},h&&(x._$.range=[i[i.length-(v||1)].range[0],i[i.length-1].range[1]]),void 0!==(_=this.performAction.call(x,s,u,a,this.yy,g[1],r,i)))return _;v&&(n=n.slice(0,-1*v*2),r=r.slice(0,-1*v),i=i.slice(0,-1*v)),n.push(this.productions_[g[1]][0]),r.push(x.$),i.push(x._$),b=o[n[n.length-2]][n[n.length-1]],n.push(b);break;case 3:return!0}}return!0}},e=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t){return this._input=t,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e-1),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this},more:function(){return this._more=!0,this},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},next:function(){if(this.done)return this.EOF;var t,e,n,r,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var o=this._currentRules(),s=0;s<o.length&&(!(n=this._input.match(this.rules[o[s]]))||e&&!(n[0].length>e[0].length)||(e=n,r=s,this.options.flex));s++);return e?((i=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],t=this.performAction.call(this,this.yy,this,o[r],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t||void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return void 0!==t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)},options:{},performAction:function(t,e,n,r){function i(t,n){return e.yytext=e.yytext.substring(t,e.yyleng-n+t)}switch(n){case 0:if("\\\\"===e.yytext.slice(-2)?(i(0,1),this.begin("mu")):"\\"===e.yytext.slice(-1)?(i(0,1),this.begin("emu")):this.begin("mu"),e.yytext)return 15;break;case 1:case 5:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),"raw"===this.conditionStack[this.conditionStack.length-1]?15:(i(5,9),"END_RAW_BLOCK");case 6:case 22:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:case 23:return 48;case 21:this.unput(e.yytext),this.popState(),this.begin("com");break;case 24:return 73;case 25:case 26:case 41:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return e.yytext=i(1,2).replace(/\\"/g,'"'),80;case 32:return e.yytext=i(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 42:return e.yytext=e.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},rules:[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],conditions:{mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}}};return t}();function n(){this.yy={}}return t.lexer=e,n.prototype=t,t.Parser=n,new n}();e.default=n,t.exports=e.default},6655:t=>{t.exports=void 0},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},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},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):[]}},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},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},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},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},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},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}},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},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},7799:function(t,e,n){t.exports=function(){var e,r,i,o,s,a="undefined"==typeof window?n.g:window,u="1.9.3",c=Date.now||function(){return(new Date).getTime()},l=c(),h="undefined"!=typeof performance&&performance.now?function(){return performance.now()}:function(){return c()-l},d=function(t){setTimeout(t,0)};function p(){}function f(t){return"function"==typeof t}function m(){this._orig=this,this._ready=!1,this._queue=[],this._log=[]}function g(t,e){this._bad?f(e)&&e.apply(this,[new Error(this._err())]):f(t)&&t.apply(this,[this])}function _(t,e){this._bad?t._crash(this._err()):setTimeout(function(){t._resume()},e)}function y(t){this._bad&&t._break(this._err()),t._resume()}function v(t,e,n){t[n]=function(){var t=arguments,r=e._image();return this._push(y,[r]),r[n].apply(r,t)}}function b(t){this._bad||f(t)&&t.apply(this)}function w(t){this._bad&&f(t)&&t.apply(this)}function x(t){this._bad?t._crash(this._err()):(this._break("Closed"),t._resume())}function T(t){if(t.length){var e=t.shift();if(t.length){var n=this;this._slip(w,[function(){T.apply(n,[t])}])}try{this._repair(),e.apply(this)}catch(t){this._break(t.toString())}}else this._break()}function k(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return;t.push(e)}function S(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return void t.splice(n,1)}function A(){m.apply(this)}function O(t,e){for(var n in t)t.hasOwnProperty(n)&&e.call(this,n)}function E(t,e,n){if(void 0===e)return E(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),O(t,function(r){i[r]=E(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 E(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=E(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=[],j=[],R={},P={};function D(){var t,e;for(C._info.engine=at._type,C._info.version=at._version,C._info.sysex=at._sysex,C._info.inputs=[],C._info.outputs=[],M=[],I=[],at._allOuts={},at._allIns={},t=0;t<at._outs.length;t++)e=at._outs[t],R[e.name]||(e.engine=at,at._allOuts[e.name]=e,C._info.outputs.push({id:e.name,name:e.name,manufacturer:e.manufacturer,version:e.version,engine:at._type}),M.push(e));for(t=0;t<ut._outs.length;t++)e=ut._outs[t],R[e.name]||(C._info.outputs.push({id:e.name,name:e.name,manufacturer:e.manufacturer,version:e.version,engine:e.type}),M.push(e));for(t=0;t<at._ins.length;t++)e=at._ins[t],P[e.name]||(e.engine=at,at._allIns[e.name]=e,C._info.inputs.push({id:e.name,name:e.name,manufacturer:e.manufacturer,version:e.version,engine:at._type}),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(j,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)})}}j=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(T,[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(T,[n]),t._resume()}}function U(t,e){this._bad?t._crash():(t._slip(tt,[e]),t._resume())}function V(){m.apply(this),this._handles=[],this._outs=[]}function G(t){this._bad||this._receive(t)}function z(t){return t.isMidi2?new Xe(t):Pt.apply(null,arguments)}function W(t){this._emit(t)}function J(t){f(t)?k(this._orig._handles,t):k(this._orig._outs,t)}function H(t){void 0===t?(this._orig._handles=[],this._orig._outs=[]):f(t)?S(this._orig._handles,t):S(this._orig._outs,t)}function X(t,e){this._orig._mpe||(this._orig._mpe=new He),this._orig._mpe.setup(t,e)}function K(t){if(t!=parseInt(t)||t<0||t>15)throw RangeError("Bad channel value (must not be less than 0 or more than 15): "+t)}function Q(t){m.apply(this),this._sink=t}function Z(t){return t.isMidi&&!t.isMidi2?new Pt(t):Xe.apply(null,arguments)}function Y(){m.apply(this),this._handles=[],v(this,C,"refresh"),v(this,C,"openMidiOut"),v(this,C,"openMidiIn"),v(this,C,"onChange"),v(this,C,"close")}function tt(t){f(t)&&(this._orig._handles.length||at._watch(),k(this._orig._handles,t))}function et(t){void 0===t?this._orig._handles=[]:S(this._orig._handles,t),this._orig._handles.length||at._unwatch()}function nt(t,e,n,r){var i;if(t.length!=n.length||e.length!=r.length)return!0;for(i=0;i<t.length;i++)if(t[i].name!=n[i].name)return!0;for(i=0;i<e.length;i++)if(e[i].name!=r[i].name)return!0;return!1}function rt(t,e,n,r){if(nt(t,e,n,r)){var i,o=[],s=[],a=[],u=[],c={};for(i=0;i<t.length;i++)c[t[i].name]=!0;for(i=0;i<n.length;i++)c[n[i].name]||o.push(n[i]);for(c={},i=0;i<n.length;i++)c[n[i].name]=!0;for(i=0;i<t.length;i++)c[t[i].name]||a.push(t[i]);for(c={},i=0;i<e.length;i++)c[e[i].name]=!0;for(i=0;i<r.length;i++)c[r[i].name]||s.push(r[i]);for(c={},i=0;i<r.length;i++)c[r[i].name]=!0;for(i=0;i<e.length;i++)c[e[i].name]||u.push(e[i]);return{inputs:{added:o,removed:a},outputs:{added:s,removed:u}}}}function it(t){for(e=0;e<C._watcher._handles.length;e++)C._watcher._handles[e].apply(C,[t])}A.prototype.refresh=function(){return this._push(L,[]),this._thenable()},A.prototype.openMidiOut=function(t){var e=new V;return this._push(L,[]),this._push(B,[e,t]),e._thenable()},A.prototype._openMidiOutNR=function(t){var e=new V;return this._push(B,[e,t]),e._thenable()},A.prototype.openMidiIn=function(t){var e=new V;return this._push(L,[]),this._push(q,[e,t]),e._thenable()},A.prototype._openMidiInNR=function(t){var e=new V;return this._push(q,[e,t]),e._thenable()},A.prototype.onChange=function(t){this._orig._watcher||(this._orig._watcher=new Y);var e=this._orig._watcher._image();return this._push(U,[e,t]),e._thenable()},A.prototype._close=function(){at._close();for(var t=ct.slice(),e=0;e<t.length;e++)t[e]&&(t[e]._close?t[e]._close():t[e].close&&t[e].close())},V.prototype=new m,V.prototype._filter=function(t){if(this._orig._mpe){var e,n=0;this._handles&&this._handles.length&&(n=this._handles.length,e=this._handles[0]),this._outs&&this._outs.length&&(n=this._outs.length,e=this._outs[0]),1!=n||e._mpe||(t=this._orig._mpe.filter(t))}return t},V.prototype._receive=function(t){this._emit(this._filter(t))},V.prototype.send=function(){return this._push(G,[z.apply(null,arguments)]),this._thenable()},V.prototype.note=function(t,e,n,r){return this.noteOn(t,e,n),void 0===this._ch&&void 0===this._master?r>0&&this.wait(r).noteOff(t,e):n>0&&this.wait(n).noteOff(t),this._thenable()},V.prototype._emit=function(t){var e,n;for(e=0;e<this._handles.length;e++)n=z(t),this._handles[e].apply(this,[n._stamp(this)]);for(e=0;e<this._outs.length;e++)(n=z(t))._stamped(this._outs[e])||this._outs[e].send(n._stamp(this))},V.prototype.emit=function(t){return this._push(W,[t]),this._thenable()},V.prototype.connect=function(t){return this._push(J,[t]),this._thenable()},V.prototype.disconnect=function(t){return this._push(H,[t]),this._thenable()},V.prototype.connected=function(){return this._orig._handles.length+this._orig._outs.length},V.prototype._image=function(){var t=this._dup();return t._gr=this._gr,t._ch=this._ch,t._sxid=this._sxid,t._master=this._master,t._band=this._band,t},V.prototype._sxid=127,V.prototype.sxId=function(t){if(void 0===t&&(t=V.prototype._sxid),t==this._sxid)return this._thenable();t=zt(t);var e=this._image();return e._sxid=t,this._push(y,[e]),e._thenable()},V.prototype.ch=function(t){if(t==this._ch||void 0===t&&void 0===this._ch)return this._thenable();var e=this._image();return void 0!==t&&(t=Vt(t)),e._ch=t,e._master=void 0,e._band=void 0,this._push(y,[e]),e._thenable()},V.prototype.MIDI1=function(){var t=this._image();return t._ch=void 0,t._sxid=V.prototype._sxid,t._master=void 0,t._band=void 0,this._push(y,[t]),t._thenable()},V.prototype.MIDI2=function(){var t=this._image();t._ch=void 0,t._sxid=V.prototype._sxid,t._master=void 0,t._band=void 0;var e=new Q(t);return this._push(y,[e]),e._thenable()},V.prototype.mpe=function(t,e){if(t==this._master&&e==this._band||void 0===t&&void 0===this._master)return this._thenable();if(void 0!==t&&He.validate(t,e),!e)return this.ch(t);var n=this._image();return n._ch=void 0,n._master=t,n._band=e,this._push(X,[t,e]),this._push(y,[n]),n._thenable()},Q.prototype=new m,Q.prototype._sxid=V.prototype._sxid,Q.prototype._receive=function(t){this._sink._receive(t)},Q.prototype.send=function(){return this._push(G,[Z.apply(null,arguments)]),this._thenable()},Q.prototype._image=V.prototype._image,Q.prototype.connect=function(t){return this._sink.connect(t),this._push(y,[this._sink]),this._thenable()},Q.prototype.disconnect=function(t){return this._sink.disconnect(t),this._push(y,[this._sink]),this._thenable()},Q.prototype.connected=function(){return this._sink.connected()},Q.prototype.sxId=V.prototype.sxId,Q.prototype.ch=V.prototype.ch,Q.prototype.gr=function(t){if(t==this._gr||void 0===t&&void 0===this._gr)return this._thenable();var e=this._image();return void 0!==t&&(t=zt(t)),e._gr=t,this._push(y,[e]),e._thenable()},Q.prototype.MIDI1=function(){var t=this._sink._image();return this._push(y,[t]),t._thenable()},Q.prototype.MIDI2=function(){var t=this._image();return t._gr=void 0,t._ch=void 0,t._sxid=V.prototype._sxid,this._push(y,[t]),t._thenable()},Y.prototype=new m,Y.prototype.connect=function(t){return this._push(tt,[t]),this._thenable()},Y.prototype.disconnect=function(t){return this._push(et,[t]),this._thenable()};var ot,st,at={_outs:[],_ins:[],_close:p},ut={_outs:[],_ins:[]},ct=[];function lt(){if(t.exports){var e=n(6655);if(e)return void xt(e)}this._break()}function ht(){var t=document.createElement("div");t.style.visibility="hidden",document.body.appendChild(t);var e=document.createElement("object");e.style.visibility="hidden",e.style.width="0px",e.style.height="0px",e.classid="CLSID:1ACE1618-1C7D-4561-AEE1-34842AA85E90",e.type="audio/x-jazz",document.body.appendChild(e),e.isJazz?Tt(e):this._break()}function dt(){if("undefined"!=typeof navigator&&navigator.requestMIDIAccess){ot=navigator,st=navigator.requestMIDIAccess;try{-1!=st.toString().indexOf("JZZ(")&&(st=void 0)}catch(t){}}}function pt(){if(dt(),st){var t=this,e=function(e){kt(e),t._resume()},n=function(e){t._crash(e)},r={};return st.call(ot,r).then(e,n),void this._pause()}this._break()}function ft(){if(dt(),st){var t=this,e=function(e){kt(e,!0),t._resume()},n=function(e){t._crash(e)},r={sysex:!0};return st.call(ot,r).then(e,n),void this._pause()}this._break()}function mt(){var t,e,n=this;function r(i){t=!0;var o=i.detail;if(!o){if(e||(e=document.getElementById("jazz-midi-msg")),!e)return;try{o=JSON.parse(e.innerText)}catch(t){}e.innerText=""}document.removeEventListener("jazz-midi-msg",r),"version"===o[0]?(St(e,o[2]),n._resume()):n._crash()}this._pause();try{document.addEventListener("jazz-midi-msg",r),document.dispatchEvent(new Event("jazz-midi"))}catch(t){}setTimeout(function(){t||n._crash()},50)}function gt(){this._pause();var t=this;d(function(){t._crash()})}function _t(t){for(var e=[],n=yt(t),r=0;r<n.length;r++)"webmidi"==n[r]?(t&&!0===t.sysex&&e.push(ft),t&&!0===t.sysex&&!0!==t.degrade||e.push(pt)):"node"==n[r]?(e.push(lt),e.push(gt)):"extension"==n[r]?e.push(mt):"plugin"==n[r]&&e.push(ht);return e.push(bt),e}function yt(t){var e=["node","extension","plugin","webmidi"];if(!t||!t.engine)return e;var n,r,i,o=t.engine instanceof Array?t.engine:[t.engine],s={},a=[],u=[];for(i=0;i<o.length;i++){var c=o[i].toString().toLowerCase();s[c]||(s[c]=!0,"none"===c&&(n=!0),"etc"!==c&&void 0!==c||(r=!0),r?u.push(c):a.push(c),S(e,c))}return(r||a.length||u.length)&&(n=!1),n?[]:a.concat(r?e:u)}function vt(t){(C=new A)._options=t,C._push(T,[_t(t)]),C.refresh(),C._resume()}function bt(){at._type="none",at._version=u,at._sysex=!0,at._outs=[],at._ins=[],at._outMap={},at._inMap={},at._refresh=function(){D()},at._watch=p,at._unwatch=p,at._close=p}function wt(){var t;function e(){for(var t=0;t<this.clients.length;t++)this._close(this.clients[t])}at._inArr=[],at._outArr=[],at._inMap={},at._outMap={},at._outsW=[],at._insW=[],at._version=at._main.version,at._sysex=!0,at._refresh=function(){var t,e;for(at._outs=[],at._ins=[],t=0;(e=at._main.MidiOutInfo(t)).length;t++)at._outs.push({type:at._type,name:e[0],manufacturer:e[1],version:e[2]});for(t=0;(e=at._main.MidiInInfo(t)).length;t++)at._ins.push({type:at._type,name:e[0],manufacturer:e[1],version:e[2]});D()},at._openOut=function(t,n){var r=at._outMap[n];if(!r){at._pool.length<=at._outArr.length&&at._pool.push(at._newPlugin()),r={name:n,clients:[],info:{name:n,manufacturer:at._allOuts[n].manufacturer,version:at._allOuts[n].version,type:"MIDI-out",sysex:at._sysex,engine:at._type},_close:function(t){at._closeOut(t)},_closeAll:e,_receive:function(t){t.length&&this.plugin.MidiOutRaw(t.slice())}};var i=at._pool[at._outArr.length];r.plugin=i,at._outArr.push(r),at._outMap[n]=r}if(!r.open){var o=r.plugin.MidiOutOpen(n);if(o!==n)return o&&r.plugin.MidiOutClose(),void t._break();r.open=!0}t._orig._impl=r,k(r.clients,t._orig),t._info=r.info,t._receive=function(t){r._receive(t)},t._close=function(){r._close(this)}},at._openIn=function(t,n){var r=at._inMap[n];if(!r){at._pool.length<=at._inArr.length&&at._pool.push(at._newPlugin()),r={name:n,clients:[],info:{name:n,manufacturer:at._allIns[n].manufacturer,version:at._allIns[n].version,type:"MIDI-in",sysex:at._sysex,engine:at._type},_close:function(t){at._closeIn(t)},_closeAll:e,handle:function(t,e){for(var n=0;n<this.clients.length;n++){var r=Pt(e);this.clients[n]._emit(r)}}};var i=function(t){return function(e,n){t.handle(e,n)}};r.onmidi=i(r);var o=at._pool[at._inArr.length];r.plugin=o,at._inArr.push(r),at._inMap[n]=r}if(!r.open){var s=r.plugin.MidiInOpen(n,r.onmidi);if(s!==n)return s&&r.plugin.MidiInClose(),void t._break();r.open=!0}t._orig._impl=r,k(r.clients,t._orig),t._info=r.info,t._close=function(){r._close(this)}},at._closeOut=function(t){var e=t._impl;S(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,e.plugin.MidiOutClose())},at._closeIn=function(t){var e=t._impl;S(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,e.plugin.MidiInClose())},at._close=function(){for(var t=0;t<at._inArr.length;t++)at._inArr[t].open&&at._inArr[t].plugin.MidiInClose();at._unwatch()},at._watch=function(){t||(t=setInterval(function(){at._refresh()},250))},at._unwatch=function(){t&&clearInterval(t),t=void 0}}function xt(t){at._type="node",at._main=t,at._pool=[],at._newPlugin=function(){return new t.MIDI},wt()}function Tt(t){at._type="plugin",at._main=t,at._pool=[t],at._newPlugin=function(){var e=document.createElement("object");return e.style.visibility="hidden",e.style.width="0px",t.style.height="0px",e.classid="CLSID:1ACE1618-1C7D-4561-AEE1-34842AA85E90",e.type="audio/x-jazz",document.body.appendChild(e),e.isJazz?e:void 0},wt()}function kt(t,e){var n;function r(){for(var t=0;t<this.clients.length;t++)this._close(this.clients[t])}at._type="webmidi",at._version=43,at._sysex=!!e,at._access=t,at._inMap={},at._outMap={},at._outsW=[],at._insW=[],at._refresh=function(){at._outs=[],at._ins=[],at._access.outputs.forEach(function(t){at._outs.push({type:at._type,name:t.name,manufacturer:t.manufacturer,version:t.version})}),at._access.inputs.forEach(function(t){at._ins.push({type:at._type,name:t.name,manufacturer:t.manufacturer,version:t.version})}),D()},at._openOut=function(t,e){var n,i=at._outMap[e];i||(i={name:e,clients:[],info:{name:e,manufacturer:at._allOuts[e].manufacturer,version:at._allOuts[e].version,type:"MIDI-out",sysex:at._sysex,engine:at._type},_close:function(t){at._closeOut(t)},_closeAll:r,_receive:function(t){i.dev&&t.length&&this.dev.send(t.slice())}}),at._access.outputs.forEach(function(t){t.name===e&&(n=t)}),n?(i.dev=n,at._outMap[e]=i,t._orig._impl=i,k(i.clients,t._orig),t._info=i.info,t._receive=function(t){i._receive(t)},t._close=function(){i._close(this)},i.dev.open&&(t._pause(),i.dev.open().then(function(){t._resume()},function(){t._crash()}))):t._break()},at._openIn=function(t,e){var n,i=at._inMap[e];if(i||(i={name:e,clients:[],info:{name:e,manufacturer:at._allIns[e].manufacturer,version:at._allIns[e].version,type:"MIDI-in",sysex:at._sysex,engine:at._type},_close:function(t){at._closeIn(t)},_closeAll:r,handle:function(t){for(var e=0;e<this.clients.length;e++){var n=Pt([].slice.call(t.data));this.clients[e]._emit(n)}}}),at._access.inputs.forEach(function(t){t.name===e&&(n=t)}),n){i.dev=n;var o=function(t){return function(e){t.handle(e)}};i.dev.onmidimessage=o(i),at._inMap[e]=i,t._orig._impl=i,k(i.clients,t._orig),t._info=i.info,t._close=function(){i._close(this)},i.dev.open&&(t._pause(),i.dev.open().then(function(){t._resume()},function(){t._crash()}))}else t._break()},at._closeOut=function(t){var e=t._impl;S(e.clients,t._orig),e.clients.length||(e.dev&&e.dev.close&&e.dev.close(),e.dev=void 0)},at._closeIn=function(t){var e=t._impl;S(e.clients,t._orig),e.clients.length||(e.dev&&(e.dev.onmidimessage=null,e.dev.close&&e.dev.close()),e.dev=void 0)},at._close=function(){at._unwatch()},at._watch=function(){at._access.onstatechange=function(){n=!0,d(function(){n&&(at._refresh(),n=!1)})}},at._unwatch=function(){at._access.onstatechange=void 0}}function St(t,e){function n(){for(var t=0;t<this.clients.length;t++)this._close(this.clients[t])}var r;at._type="extension",at._version=e,at._sysex=!0,at._pool=[],at._outs=[],at._ins=[],at._inArr=[],at._outArr=[],at._inMap={},at._outMap={},at._outsW=[],at._insW=[],at.refreshClients=[],at._msg=t,at._newPlugin=function(){var t={id:at._pool.length};at._pool.push(t),t.id?document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["new"]})):t.ready=!0},at._newPlugin(),at._refresh=function(t){at.refreshClients.push(t),t._pause(),d(function(){document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["refresh"]}))})},at._openOut=function(t,e){var r=at._outMap[e];if(!r){at._pool.length<=at._outArr.length&&at._newPlugin();var i=at._pool[at._outArr.length];r={name:e,clients:[],info:{name:e,manufacturer:at._allOuts[e].manufacturer,version:at._allOuts[e].version,type:"MIDI-out",sysex:at._sysex,engine:at._type},_start:function(){document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["openout",i.id,e]}))},_close:function(t){at._closeOut(t)},_closeAll:n,_receive:function(t){if(t.length){var e=t.slice();e.splice(0,0,"play",i.id),document.dispatchEvent(new CustomEvent("jazz-midi",{detail:e}))}}},r.plugin=i,i.output=r,at._outArr.push(r),at._outMap[e]=r}t._orig._impl=r,k(r.clients,t._orig),t._info=r.info,t._receive=function(t){r._receive(t)},t._close=function(){r._close(this)},r.open||(t._pause(),r.plugin.ready&&r._start())},at._openIn=function(t,e){var r=at._inMap[e];if(!r){at._pool.length<=at._inArr.length&&at._newPlugin();var i=at._pool[at._inArr.length];r={name:e,clients:[],info:{name:e,manufacturer:at._allIns[e].manufacturer,version:at._allIns[e].version,type:"MIDI-in",sysex:at._sysex,engine:at._type},_start:function(){document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["openin",i.id,e]}))},_close:function(t){at._closeIn(t)},_closeAll:n},r.plugin=i,i.input=r,at._inArr.push(r),at._inMap[e]=r}t._orig._impl=r,k(r.clients,t._orig),t._info=r.info,t._close=function(){r._close(this)},r.open||(t._pause(),r.plugin.ready&&r._start())},at._closeOut=function(t){var e=t._impl;S(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["closeout",e.plugin.id]})))},at._closeIn=function(t){var e=t._impl;S(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["closein",e.plugin.id]})))},at._close=function(){at._unwatch()},at._watch=function(){at._insW=at._ins,at._outsW=at._outs,r=setInterval(function(){document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["refresh"]}))},250)},at._unwatch=function(){clearInterval(r),r=void 0},document.addEventListener("jazz-midi-msg",function(t){var e,n,r,i=t.detail?[t.detail]:void 0;if(!i)for(i=at._msg.innerText.split("\n"),at._msg.innerText="",e=0;e<i.length;e++)try{i[e]=JSON.parse(i[e])}catch(t){i[e]=[]}for(e=0;e<i.length;e++){var o=i[e];if(o.length)if("refresh"===o[0]){if(o[1].ins){for(n=0;n<o[1].ins.length;n++)o[1].ins[n].type=at._type;at._ins=o[1].ins}if(o[1].outs){for(n=0;n<o[1].outs.length;n++)o[1].outs[n].type=at._type;at._outs=o[1].outs}for(D(),n=0;n<at.refreshClients.length;n++)at.refreshClients[n]._resume();at.refreshClients=[]}else if("version"===o[0]){var s=at._pool[o[1]];s&&(s.ready=!0,s.input&&s.input._start(),s.output&&s.output._start())}else if("openout"===o[0]){if(r=at._pool[o[1]].output)if(o[2]==r.name){if(r.open=!0,r.clients)for(n=0;n<r.clients.length;n++)r.clients[n]._resume()}else if(r.clients)for(n=0;n<r.clients.length;n++)r.clients[n]._crash()}else if("openin"===o[0]){if(r=at._pool[o[1]].input)if(o[2]==r.name){if(r.open=!0,r.clients)for(n=0;n<r.clients.length;n++)r.clients[n]._resume()}else if(r.clients)for(n=0;n<r.clients.length;n++)r.clients[n]._crash()}else if("midi"===o[0]&&(r=at._pool[o[1]].input)&&r.clients)for(n=0;n<r.clients.length;n++){var a=Pt(o.slice(3));r.clients[n]._emit(a)}}})}var At=function(t){return C||vt(t),C._thenable()};function Ot(t){var e=new V;return t instanceof Object&&O(t,function(n){e[n]=t[n]}),e._resume(),e}function Et(){var t=this instanceof Et?this:t=new Et;return Et.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 jt(t){return t<10?"0"+t:t}function Rt(t){for(var e=[],n=0;n<t.length;n++)e[n]=jt(n?t[n]:31&t[n]);return e.join(":")}function Pt(t){var e,n=this instanceof Pt?this:n=new Pt;if(t instanceof Pt)return n._from=t._from.slice(),O(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=Ot,A.prototype.Widget=At.Widget,At.addMidiIn=function(t,e){var n=E(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=E(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=E(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=E(n),t._close=function(){t.disconnect()},J.apply(t,[e]),t._resume()}};return At.lib.registerMidiOut(t,r)},A.prototype.addMidiOut=At.addMidiOut,At.removeMidiOut=function(t){return At.lib.unregisterMidiOut(t)},A.prototype.removeMidiOut=At.removeMidiOut,At.removeMidiIn=function(t){return At.lib.unregisterMidiIn(t)},A.prototype.removeMidiIn=At.removeMidiIn,At.maskMidiIn=function(t){P[t]=!0},A.prototype.maskMidiIn=At.maskMidiIn,At.unmaskMidiIn=function(t){delete P[t]},A.prototype.unmaskMidiIn=At.unmaskMidiIn,At.maskMidiOut=function(t){R[t]=!0},A.prototype.maskMidiOut=At.maskMidiOut,At.unmaskMidiOut=function(t){delete R[t]},A.prototype.unmaskMidiOut=At.unmaskMidiOut,Et.prototype.reset=function(t){if(t instanceof Et)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},Et.prototype.isFullFrame=function(){return 0==this.quarter||4==this.quarter},Et.prototype.getType=function(){return this.type},Et.prototype.getHour=function(){return this.hour},Et.prototype.getMinute=function(){return this.minute},Et.prototype.getSecond=function(){return this.second},Et.prototype.getFrame=function(){return this.frame},Et.prototype.getQuarter=function(){return this.quarter},Et.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},Et.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},Et.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},Et.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},Et.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},Et.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},Et.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},Et.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},Et.prototype.incrQF=function(){return this.backwards=!1,this.quarter=this.quarter+1&7,0!=this.quarter&&4!=this.quarter||this.incrFrame(),this},Et.prototype.decrQF=function(){return this.backwards=!0,this.quarter=this.quarter+7&7,3!=this.quarter&&7!=this.quarter||this.decrFrame(),this},Et.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},Et.prototype.toString=function(){return Rt([this.hour,this.minute,this.second,this.frame])},At.SMPTE=Et,A.prototype.SMPTE=Et,Pt.prototype=[],Pt.prototype.constructor=Pt,Pt.prototype.isMidi=function(){return 1};var Dt={};function Lt(t){if(t!=parseFloat(t))throw TypeError("Not a number: "+t)}function Ft(){}Pt.noteValue=function(t){return void 0===t?void 0:Dt[t.toString().toLowerCase()]},Pt.programValue=function(t){return t},Pt.octaveValue=function(t){var e=Dt[t.toString().toLowerCase()];return void 0===e&&(e=Dt[t.toString().toLowerCase()+"1"]),void 0===e?void 0:e%12},Pt.freq=function(t,e){return void 0===e&&(e=440),Lt(e),t!=parseFloat(t)&&(t=Zt(t)),e*Math.pow(2,(t-69)/12)},Pt.shift=function(t,e){return void 0===e&&(e=440),Lt(t),Lt(e),12*Math.log2(t/e)},Pt.midi=function(t,e){return t!=parseFloat(t)?Zt(t):Pt.shift(t,e)+69},Pt.to7b=function(t){return Lt(t),t<=0?0:t>=1?127:Math.floor(128*t)},Pt.to14b=function(t){return Lt(t),t<=0?0:t>=1?16383:Math.floor(16384*t)},Pt.to21b=function(t){return void 0===t?2097151:(Lt(t),t<=0?0:(t=(Math.floor(t)<<14)+Pt.to14b(t-Math.floor(t)))<2097151?t:2097150)},Pt.to32b=function(t){return Lt(t),t<=0?0:t>=1?4294967295:Math.floor(4294967296*t)},Ft.prototype=Pt,Pt._sxid=127,Pt.sxId=function(t){if(void 0===t&&(t=Pt._sxid),t==this._sxid)return this;t=zt(t);var e=new Ft;return e._ch=this._ch,e._sxid=t,e},Pt.ch=function(t){if(t==this._ch||void 0===t&&void 0===this._ch)return this;var e=new Ft;return void 0!==t&&(t=Vt(t)),e._ch=t,e._sxid=this._sxid,e};var $t={c:0,d:2,e:4,f:5,g:7,a:9,b:11,h:11};for(O($t,function(t){for(s=0;s<12&&!((o=$t[t]+12*s)>127);s++)Dt[t+s]=o,Dt[t+"♮"+s]=o,o>0&&(Dt[t+"b"+s]=o-1,Dt[t+"♭"+s]=o-1,Dt[t+"bb"+s]=o-2,Dt[t+"♭♭"+s]=o-2,Dt[t+"𝄫"+s]=o-2),o<127&&(Dt[t+"#"+s]=o+1,Dt[t+"♯"+s]=o+1,Dt[t+"##"+s]=o+2,Dt[t+"♯♯"+s]=o+2,Dt[t+"𝄪"+s]=o+2)}),s=0;s<128;s++)Dt[s]=s;function Bt(t){throw RangeError("Bad MIDI value: "+t)}function qt(t){throw TypeError("Invalid value: "+t)}function Ut(t){throw RangeError("Out of range: "+t)}function Vt(t){return K(t),parseInt(t)}function Gt(t){if(t!=parseInt(t)||t<0||t>15)throw RangeError("Expected a 4-bit value: "+t);return parseInt(t)}function zt(t,e){return(t!=parseInt(t)||t<0||t>127)&&Bt(void 0===e?t:e),parseInt(t)}function Wt(t){return(t!=parseInt(t)||t<0||t>255)&&Bt(t),parseInt(t)}function Jt(t){return(t!=parseInt(t)||t<0||t>16383)&&Bt(t),parseInt(t)}function Ht(t){if(t!=parseInt(t)||t<0||t>65535)throw RangeError("Expected a 16-bit value: "+t);return parseInt(t)}function Xt(t){if(t!=parseInt(t)||t<0||t>1048575)throw RangeError("Expected a 20-bit value: "+t);return parseInt(t)}function Kt(t){return(t!=parseInt(t)||t<0||t>2097151)&&Bt(t),parseInt(t)}function Qt(t){return(t!=parseInt(t)||t<0||t>4294967295)&&Bt(t),parseInt(t)}function Zt(t){return zt(Pt.noteValue(t),t)}function Yt(t){return 127&Jt(t)}function te(t){return Jt(t)>>7}function ee(t){t=""+t;for(var e=0;e<t.length;e++)t.charCodeAt(e)>255&&Bt(t[e]);return t}function ne(t){return[t>>14,t>>7&127,127&t]}function re(t,e){return t!=parseFloat(t)&&qt(void 0===e?t:e),(t<0||t>1)&&Ut(void 0===e?t:e),parseFloat(t)}function ie(t){return void 0===t||t?127:126}function oe(t){var e,n,r=[],i={};O(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 O(t,function(n){e[n]=Pt.to21b(t[n]==parseFloat(t[n])?t[n]:Zt(t[n]))}),e}function ae(t){var e={};return O(t,function(n){e[n]=Pt.to21b(Pt.midi(t[n]))}),e}function ue(t){var e=[];if(!(t instanceof Array)||12!=t.length)throw TypeError("Expected an array of size 12");for(var n=0;n<12;n++)e.push(zt(t[n]));return e}function ce(t){var e=[];if(!(t instanceof Array)||12!=t.length)throw TypeError("Expected an array of size 12");for(var n=0;n<12;n++)e.push(te(t[n])),e.push(Yt(t[n]));return e}var le={noteOff:function(t,e,n){return void 0===n&&(n=64),[128+Vt(t),Zt(e),zt(n)]},noteOn:function(t,e,n){return void 0===n&&(n=127),[144+Vt(t),Zt(e),zt(n)]},aftertouch:function(t,e,n){return[160+Vt(t),Zt(e),zt(n)]}},he={control:function(t,e,n){return[176+Vt(t),zt(e),zt(n)]},program:function(t,e){return[192+Vt(t),zt(Pt.programValue(e),e)]},pressure:function(t,e){return[208+Vt(t),zt(e)]},pitchBend:function(t,e,n){return void 0===n?[224+Vt(t),Yt(e),te(e)]:[224+Vt(t),zt(n),zt(e)]},pitchBendF:function(t,e){return he.pitchBend(t,Pt.to14b((e+1)/2))},bankMSB:function(t,e){return[176+Vt(t),0,zt(e)]},bankLSB:function(t,e){return[176+Vt(t),32,zt(e)]},modMSB:function(t,e){return[176+Vt(t),1,zt(e)]},modLSB:function(t,e){return[176+Vt(t),33,zt(e)]},breathMSB:function(t,e){return[176+Vt(t),2,zt(e)]},breathLSB:function(t,e){return[176+Vt(t),34,zt(e)]},footMSB:function(t,e){return[176+Vt(t),4,zt(e)]},footLSB:function(t,e){return[176+Vt(t),36,zt(e)]},portamentoMSB:function(t,e){return[176+Vt(t),5,zt(e)]},portamentoLSB:function(t,e){return[176+Vt(t),37,zt(e)]},dataMSB:function(t,e){return[176+Vt(t),6,zt(e)]},dataLSB:function(t,e){return[176+Vt(t),38,zt(e)]},volumeMSB:function(t,e){return[176+Vt(t),7,zt(e)]},volumeLSB:function(t,e){return[176+Vt(t),39,zt(e)]},balanceMSB:function(t,e){return[176+Vt(t),8,zt(e)]},balanceLSB:function(t,e){return[176+Vt(t),40,zt(e)]},panMSB:function(t,e){return[176+Vt(t),10,zt(e)]},panLSB:function(t,e){return[176+Vt(t),42,zt(e)]},expressionMSB:function(t,e){return[176+Vt(t),11,zt(e)]},expressionLSB:function(t,e){return[176+Vt(t),43,zt(e)]},damper:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),64,e?127:0]},portamento:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),65,e?127:0]},sostenuto:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),66,e?127:0]},soft:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),67,e?127:0]},legato:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),68,e?127:0]},hold2:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),69,e?127:0]},soundVariation:function(t,e){return[176+Vt(t),70,Zt(e)]},filterResonance:function(t,e){return[176+Vt(t),71,Zt(e)]},releaseTime:function(t,e){return[176+Vt(t),72,Zt(e)]},attackTime:function(t,e){return[176+Vt(t),73,Zt(e)]},brightness:function(t,e){return[176+Vt(t),74,Zt(e)]},decayTime:function(t,e){return[176+Vt(t),75,Zt(e)]},vibratoRate:function(t,e){return[176+Vt(t),76,Zt(e)]},vibratoDepth:function(t,e){return[176+Vt(t),77,Zt(e)]},vibratoDelay:function(t,e){return[176+Vt(t),78,Zt(e)]},ptc:function(t,e){return[176+Vt(t),84,Zt(e)]},dataIncr:function(t){return[176+Vt(t),96,0]},dataDecr:function(t){return[176+Vt(t),97,0]},nrpnLSB:function(t,e){return[176+Vt(t),98,zt(e)]},nrpnMSB:function(t,e){return[176+Vt(t),99,zt(e)]},rpnLSB:function(t,e){return[176+Vt(t),100,zt(e)]},rpnMSB:function(t,e){return[176+Vt(t),101,zt(e)]},allSoundOff:function(t){return[176+Vt(t),120,0]},resetAllControllers:function(t){return[176+Vt(t),121,0]},localControl:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),122,e?127:0]},allNotesOff:function(t){return[176+Vt(t),123,0]},omni:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),e?125:124,0]},mono:function(t,e){return void 0===e&&(e=1),[176+Vt(t),126,zt(e)]},poly:function(t){return[176+Vt(t),127,0]}};function de(t,e,n,r){return void 0!==e?[zt(t),zt(e),zt(n),zt(r)]:((t!=parseInt(t)||t<0||t>65535)&&qt(t),[(t=parseInt(t))>>12&15,t>>8&15,t>>4&15,15&t])}function pe(t){return Lt(t),(t=Math.round(65536*t+16384))<0?0:t>65535?65535:t}var fe={mtc:function(t){return[241,It(t)]},songPosition:function(t,e){return void 0===e?[242,Yt(t),te(t)]:[242,zt(e),zt(t)]},songSelect:function(t){return[243,zt(t)]},tune:function(){return[246]},clock:function(){return[248]},start:function(){return[250]},continue:function(){return[251]},stop:function(){return[252]},active:function(){return[254]},reset:function(){return[255]}},me={sxIdRequest:function(){return[240,126,this._sxid,6,1,247]},sxTuningDumpRequest:function(t,e){return void 0===e?[240,126,this._sxid,8,0,zt(t),247]:[240,126,this._sxid,8,3,zt(t),zt(e),247]},sxFullFrame:function(t){return[240,127,this._sxid,1,1,Nt(t),t.getMinute(),t.getSecond(),t.getFrame(),247]},sxMasterVolume:function(t,e){return void 0===e?[240,127,this._sxid,4,1,Yt(t),te(t),247]:[240,127,this._sxid,4,1,zt(e),zt(t),247]},sxMasterVolumeF:function(t){return me.sxMasterVolume.call(this,Pt.to14b(re(t)))},sxMasterFineTuning:function(t,e){return void 0===e?[240,127,this._sxid,4,3,Yt(t),te(t),247]:[240,127,this._sxid,4,3,zt(e),zt(t),247]},sxMasterFineTuningF:function(t){return me.sxMasterFineTuning.call(this,Pt.to14b(re((t%1+1)/2,t)))},sxMasterCoarseTuning:function(t){return[240,127,this._sxid,4,4,0,zt(t),247]},sxMasterCoarseTuningF:function(t){return me.sxMasterCoarseTuning.call(this,t-t%1+64)},sxNoteTuning:function(t,e,n,r){return e==parseInt(e)?[240,ie(r),this._sxid,8,7,zt(t),zt(e)].concat(oe(n),[247]):[240,127,this._sxid,8,2,zt(t)].concat(oe(e),[247])},sxNoteTuningF:function(t,e,n,r){return e==parseInt(e)?me.sxNoteTuning.call(this,t,e,se(n),r):me.sxNoteTuning.call(this,t,se(e))},sxNoteTuningHZ:function(t,e,n,r){return e==parseInt(e)?me.sxNoteTuning.call(this,t,e,ae(n),r):me.sxNoteTuning.call(this,t,ae(e))},sxScaleTuning1:function(t,e,n){return t==parseInt(t)?[240,ie(n),this._sxid,8,8].concat(ne(Ht(t)),ue(e),[247]):me.sxScaleTuning1.call(this,65535,t,e)},sxScaleTuning1F:function(t,e,n){if(t!=parseInt(t))return me.sxScaleTuning1F.call(this,65535,t,e);for(var r=[],i=0;i<e.length;i++){if(e[i]<-.64||e[i]>.63)throw RangeError("Out of range: "+e[i]);r.push(Math.floor(100*e[i]+64))}return me.sxScaleTuning1.call(this,t,r,n)},sxScaleTuning2:function(t,e,n){return t==parseInt(t)?[240,ie(n),this._sxid,8,9].concat(ne(Ht(t)),ce(e),[247]):me.sxScaleTuning2.call(this,65535,t,e)},sxScaleTuning2F:function(t,e,n){if(t!=parseInt(t))return me.sxScaleTuning2F.call(this,65535,t,e);for(var r=[],i=0;i<e.length;i++){var o=(e[i]+1)/2;if(o<-1||o>1)throw RangeError("Out of range: "+e[i]);r.push(Pt.to14b((e[i]+1)/2))}return me.sxScaleTuning2.call(this,t,r,n)},sxGM:function(t){return void 0===t&&(t=1),[240,126,this._sxid,9,t?2==t?3:1:2,247]},sxGS:function(t){for(var e=void 0===t?[64,0,127,0]:t instanceof Array?t:arguments,n=0,r=[240,65,this._sxid,66,18],i=0;i<e.length;i++){var o=zt(e[i]);r.push(o),n+=o}return n%=128,r.push(n?128-n:0),r.push(247),r},sxXG:function(t){var e=void 0===t?[0,0,126,0]:t instanceof Array?t:arguments,n=127==this._sxid?0:this._sxid;n>15&&Bt("Bad Yamaha device number: "+n);for(var r=[240,67,16+n,76],i=0;i<e.length;i++)r.push(zt(e[i]));return r.push(247),r},sxMidiSoft:function(t,e){var n=[240,0,32,36,0,zt(t||0)];e=void 0===e?"":""+e;for(var r=0;r<e.length;r++)n.push(zt(e.charCodeAt(r)));return n.push(247),n},gsMasterVolume:function(t){return me.sxGS.call(this,[64,0,4,zt(t)])},gsMasterVolumeF:function(t){return me.gsMasterVolume.call(this,Pt.to7b(re(t)))},gsMasterFineTuning:function(t,e,n,r){return t=de(t,e,n,r),me.sxGS.call(this,[64,0,0,t[0],t[1],t[2],t[3]])},gsMasterFineTuningF:function(t){return me.gsMasterFineTuning.call(this,pe(t%1))},gsMasterCoarseTuning:function(t){return me.sxGS.call(this,[64,0,5,zt(t)])},gsMasterCoarseTuningF:function(t){return me.gsMasterCoarseTuning.call(this,t-t%1+64)},gsOctaveTuning:function(t,e,n){return me.sxGS.call(this,[64,16+[1,2,3,4,5,6,7,8,9,0,11,12,13,14,15][Vt(t)],64+Pt.octaveValue(e),zt(n)])},gsOctaveTuningF:function(t,e,n){if(n<-.64||n>.63)throw RangeError("Out of range: "+n);return me.gsOctaveTuning.call(this,t,e,Math.floor(100*n+64))},xgMasterVolume:function(t){return me.sxXG.call(this,[0,0,4,zt(t)])},xgMasterVolumeF:function(t){return me.xgMasterVolume.call(this,Pt.to7b(re(t)))},xgMasterFineTuning:function(t,e,n,r){return t=de(t,e,n,r),me.sxXG.call(this,[0,0,0,t[0],t[1],t[2],t[3]])},xgMasterFineTuningF:function(t){return me.xgMasterFineTuning.call(this,pe(t%1))},xgMasterCoarseTuning:function(t){return me.sxXG.call(this,[0,0,6,zt(t)])},xgMasterCoarseTuningF:function(t){return me.xgMasterCoarseTuning.call(this,t-t%1+64)},xgOctaveTuning:function(t,e,n){return me.sxXG.call(this,[8,Vt(t),65+Pt.octaveValue(e),zt(n)])},xgOctaveTuningF:function(t,e,n){if(n<-.64||n>.63)throw RangeError("Out of range: "+n);return me.xgOctaveTuning.call(this,t,e,Math.floor(100*n+64))}};me.sxScaleTuning=me.sxScaleTuning2,me.sxScaleTuningF=me.sxScaleTuning2F,me.sxMasterTranspose=me.sxMasterCoarseTuning,me.sxMasterTransposeF=me.sxMasterCoarseTuningF,me.gsMasterTranspose=me.gsMasterCoarseTuning,me.gsMasterTransposeF=me.gsMasterCoarseTuningF,me.xgMasterTranspose=me.xgMasterCoarseTuning,me.xgMasterTransposeF=me.xgMasterCoarseTuningF;var ge={bank:function(t,e,n){return void 0===n?[he.bankMSB(t,te(e)),he.bankLSB(t,Yt(e))]:[he.bankMSB(t,e),he.bankLSB(t,n)]},modF:function(t,e){return ge.mod(t,Pt.to14b(e))},mod:function(t,e,n){return void 0===n?[he.modMSB(t,te(e)),he.modLSB(t,Yt(e))]:[he.modMSB(t,e),he.modLSB(t,n)]},breathF:function(t,e){return ge.breath(t,Pt.to14b(e))},breath:function(t,e,n){return void 0===n?[he.breathMSB(t,te(e)),he.breathLSB(t,Yt(e))]:[he.breathMSB(t,e),he.breathLSB(t,n)]},footF:function(t,e){return ge.foot(t,Pt.to14b(e))},foot:function(t,e,n){return void 0===n?[he.footMSB(t,te(e)),he.footLSB(t,Yt(e))]:[he.footMSB(t,e),he.footLSB(t,n)]},portamentoTimeF:function(t,e){return ge.portamentoTime(t,Pt.to14b(e))},portamentoTime:function(t,e,n){return void 0===n?[he.portamentoMSB(t,te(e)),he.portamentoLSB(t,Yt(e))]:[he.portamentoMSB(t,e),he.portamentoLSB(t,n)]},dataF:function(t,e){return ge.data(t,Pt.to14b(e))},data:function(t,e,n){return void 0===n?[he.dataMSB(t,te(e)),he.dataLSB(t,Yt(e))]:[he.dataMSB(t,e),he.dataLSB(t,n)]},volumeF:function(t,e){return ge.volume(t,Pt.to14b(e))},volume:function(t,e,n){return void 0===n?[he.volumeMSB(t,te(e)),he.volumeLSB(t,Yt(e))]:[he.volumeMSB(t,e),he.volumeLSB(t,n)]},balanceF:function(t,e){return ge.balance(t,Pt.to14b((e+1)/2))},balance:function(t,e,n){return void 0===n?[he.balanceMSB(t,te(e)),he.balanceLSB(t,Yt(e))]:[he.balanceMSB(t,e),he.balanceLSB(t,n)]},panF:function(t,e){return ge.pan(t,Pt.to14b((e+1)/2))},pan:function(t,e,n){return void 0===n?[he.panMSB(t,te(e)),he.panLSB(t,Yt(e))]:[he.panMSB(t,e),he.panLSB(t,n)]},expressionF:function(t,e){return ge.expression(t,Pt.to14b(e))},expression:function(t,e,n){return void 0===n?[he.expressionMSB(t,te(e)),he.expressionLSB(t,Yt(e))]:[he.expressionMSB(t,e),he.expressionLSB(t,n)]},nrpn:function(t,e,n){return void 0===n?[he.nrpnMSB(t,te(e)),he.nrpnLSB(t,Yt(e))]:[he.nrpnMSB(t,e),he.nrpnLSB(t,n)]},rpn:function(t,e,n){return void 0===n?[he.rpnMSB(t,te(e)),he.rpnLSB(t,Yt(e))]:[he.rpnMSB(t,e),he.rpnLSB(t,n)]},rpnPitchBendRange:function(t,e,n){return ge.rpn(t,0,0).concat(ge.data(t,e,n))},rpnPitchBendRangeF:function(t,e){return ge.rpnPitchBendRange(t,zt(e-e%1),Math.floor(e%1*100))},rpnFineTuning:function(t,e,n){return ge.rpn(t,0,1).concat(ge.data(t,e,n))},rpnFineTuningF:function(t,e){return ge.rpn(t,0,1).concat(ge.dataF(t,(e%1+1)/2))},rpnCoarseTuning:function(t,e){return ge.rpn(t,0,2).concat([he.dataMSB(t,e)])},rpnCoarseTuningF:function(t,e){return ge.rpn(t,0,2).concat([he.dataMSB(t,e-e%1+64)])},rpnTuning:function(t,e,n,r){return ge.rpnCoarseTuning(t,e).concat(ge.rpnFineTuning(t,n,r))},rpnTuningF:function(t,e){return ge.rpnCoarseTuningF(t,e).concat(ge.rpnFineTuningF(t,e))},rpnTuningA:function(t,e){return ge.rpnTuningF(t,Pt.shift(e))},rpnSelectTuningProgram:function(t,e){return ge.rpn(t,0,3).concat([he.dataMSB(t,e)])},rpnSelectTuningBank:function(t,e){return ge.rpn(t,0,4).concat([he.dataMSB(t,e)])},rpnSelectTuning:function(t,e,n){return void 0===n?ge.rpnSelectTuningProgram(t,e):ge.rpnSelectTuningBank(t,e).concat(ge.rpnSelectTuningProgram(t,n))},rpnModulationDepthRange:function(t,e,n){return ge.rpn(t,0,5).concat(ge.data(t,e,n))},rpnModulationDepthRangeF:function(t,e){return ge.rpnModulationDepthRange(t,zt(e-e%1),Math.floor(e%1*128))},rpnNull:function(t){return ge.rpn(t,127,127)},mode1:function(t){return[he.omni(t,!0),he.poly(t)]},mode2:function(t){return[he.omni(t,!0),he.mono(t)]},mode3:function(t){return[he.omni(t,!1),he.poly(t)]},mode4:function(t){return[he.omni(t,!1),he.mono(t)]}};ge.rpnTranspose=ge.rpnCoarseTuningF;var _e={sxMasterTuning:function(t,e,n){return[me.sxMasterCoarseTuning.call(this,t),me.sxMasterFineTuning.call(this,e,n)]},sxMasterTuningF:function(t){return[me.sxMasterCoarseTuningF.call(this,t),me.sxMasterFineTuningF.call(this,t)]},gsMasterTuningF:function(t){return[me.gsMasterCoarseTuningF.call(this,t),me.gsMasterFineTuningF.call(this,t)]},xgMasterTuningF:function(t){return[me.xgMasterCoarseTuningF.call(this,t),me.xgMasterFineTuningF.call(this,t)]},sxMasterTuningA:function(t){return _e.sxMasterTuningF.call(this,Pt.shift(t))},gsMasterTuningA:function(t){return _e.gsMasterTuningF.call(this,Pt.shift(t))},xgMasterTuningA:function(t){return _e.xgMasterTuningF.call(this,Pt.shift(t))},gsScaleTuning:function(t,e){var n=[];if(12!=e.length)throw RangeError("Wrong input size: "+e.length);for(var r=0;r<12;r++)n.push(me.gsOctaveTuning.call(this,t,r,e[r]));return n},gsScaleTuningF:function(t,e){var n=[];if(12!=e.length)throw RangeError("Wrong input size: "+e.length);for(var r=0;r<12;r++)n.push(me.gsOctaveTuningF.call(this,t,r,e[r]));return n},xgScaleTuning:function(t,e){var n=[];if(12!=e.length)throw RangeError("Wrong input size: "+e.length);for(var r=0;r<12;r++)n.push(me.xgOctaveTuning.call(this,t,r,e[r]));return n},xgScaleTuningF:function(t,e){var n=[];if(12!=e.length)throw RangeError("Wrong input size: "+e.length);for(var r=0;r<12;r++)n.push(me.xgOctaveTuningF.call(this,t,r,e[r]));return n}};function ye(t,e){var n=new Pt;return n.ff=Wt(t),n.dd=void 0===e?"":ee(e),n}var ve={smf:function(t){if(t instanceof Pt)return new Pt(t);var e=t instanceof Array?t:arguments,n=Wt(e[0]),r="";return 2==e.length?r=Re(e[1]):e.length>2&&(r=Re(Array.prototype.slice.call(e,1))),ye(n,r)},smfSeqNumber:function(t){if(t==parseInt(t)){if(t<0||t>65535)throw RangeError("Sequence number out of range: "+t);t=String.fromCharCode(t>>8)+String.fromCharCode(255&t)}else if(0==(t=""+t).length)t="\0\0";else if(1==t.length)t="\0"+t;else if(t.length>2)throw RangeError("Sequence number out of range"+qe(t));return ye(0,t)},smfText:function(t){return ye(1,At.lib.toUTF8(t))},smfCopyright:function(t){return ye(2,At.lib.toUTF8(t))},smfSeqName:function(t){return ye(3,At.lib.toUTF8(t))},smfInstrName:function(t){return ye(4,At.lib.toUTF8(t))},smfLyric:function(t){return ye(5,At.lib.toUTF8(t))},smfMarker:function(t){return ye(6,At.lib.toUTF8(t))},smfCuePoint:function(t){return ye(7,At.lib.toUTF8(t))},smfProgName:function(t){return ye(8,At.lib.toUTF8(t))},smfDevName:function(t){return ye(9,At.lib.toUTF8(t))},smfChannelPrefix:function(t){if(t==parseInt(t))K(t),t=String.fromCharCode(t);else if(0==(t=""+t).length)t="\0";else if(t.length>1||t.charCodeAt(0)>15)throw RangeError("Channel number out of range"+qe(t));return ye(32,t)},smfMidiPort:function(t){if(t==parseInt(t)){if(t<0||t>127)throw RangeError("Port number out of range: "+t);t=String.fromCharCode(t)}else if(0==(t=""+t).length)t="\0";else if(t.length>1||t.charCodeAt(0)>127)throw RangeError("Port number out of range"+qe(t));return ye(33,t)},smfEndOfTrack:function(t){if(""!=Re(t))throw RangeError("Unexpected data"+qe(Re(t)));return ye(47)},smfTempo:function(t){if(3==(""+t).length)return ye(81,t);if(t==parseInt(t)&&t>0&&t<=16777215)return ye(81,String.fromCharCode(t>>16)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t));throw RangeError("Out of range"+qe(Re(t)))},smfBPM:function(t){return ve.smfTempo(Math.round(6e7/t))},smfSMPTE:function(t){if(t instanceof Et)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 Et(e))},smfTimeSignature:function(t,e,n,r){var i,o,s,a,u=(""+t).match(/^\s*(\d+)\s*\/\s*(\d+)\s*$/);if(u){if(i=parseInt(u[1]),o=parseInt(u[2]),i>0&&i<256&&o>0&&!(o&o-1)){for(s=o,o=0,s>>=1;s;s>>=1)o++;return s=e==parseInt(e)?e:24,a=n==parseInt(n)?n:8,ye(88,String.fromCharCode(i)+String.fromCharCode(o)+String.fromCharCode(s)+String.fromCharCode(a))}if(4==(""+t).length)return ye(88,t)}else if(t==parseInt(t)&&e==parseInt(e)){if(t>0&&t<256&&e>0&&!(e&e-1)){for(i=t,o=0,s=e,s>>=1;s;s>>=1)o++;return s=n==parseInt(n)?n:24,a=r==parseInt(r)?r:8,ye(88,String.fromCharCode(i)+String.fromCharCode(o)+String.fromCharCode(s)+String.fromCharCode(a))}if(4==(""+t).length)return ye(88,t);t=t+"/"+e}else if(4==(""+t).length)return ye(88,t);throw RangeError("Wrong time signature"+qe(Re(""+t)))},smfKeySignature:function(t){var e=(t=""+t).match(/^\s*([A-H][b#]?)\s*(|maj|major|dur|m|min|minor|moll)\s*$/i);if(e){var n={CB:0,GB:1,DB:2,AB:3,EB:4,BB:5,F:6,C:7,G:8,D:9,A:10,E:11,B:12,H:12,"F#":13,"C#":14,"G#":15,"D#":16,"A#":17}[e[1].toUpperCase()],r={"":0,MAJ:0,MAJOR:0,DUR:0,M:1,MIN:1,MINOR:1,MOLL:1}[e[2].toUpperCase()];void 0!==n&&void 0!==r&&(r&&(n-=3),(n-=7)>=-7&&n<0?t=String.fromCharCode(256+n)+String.fromCharCode(r):n>=0&&n<=7&&(t=String.fromCharCode(n)+String.fromCharCode(r)))}if(2==t.length&&t.charCodeAt(1)<=1&&(t.charCodeAt(0)<=7||t.charCodeAt(0)<=255&&t.charCodeAt(0)>=249))return ye(89,t);throw RangeError("Incorrect key signature"+qe(t))},smfSequencer:function(t){return ye(127,Re(t))}},be={};function we(t,e){Pt[t]=function(){return new Pt(e.apply(this,arguments))},be[t]=function(){return this.send(e.apply(this,arguments))}}function xe(t,e){Pt[t]=function(){return e.apply(this,arguments)},be[t]=function(){return this.send(e.apply(this,arguments))}}function Te(t,e){Pt[t]=function(){var t,n=[],r=e.apply(this,arguments);for(t=0;t<r.length;t++)n.push(new Pt(r[t]));return n},be[t]=function(){for(var t=e.apply(this,arguments),n=this,r=0;r<t.length;r++)n=n.send(t[r]);return n}}function ke(t,e){Pt[t]=function(){return new Pt(e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))))},be[t]=function(){if(void 0!==this._master){var t=new Pt(e.apply(this,[this._master].concat(Array.prototype.slice.call(arguments))));return t._mpe=t[1],this.send(t)}return this.send(e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))))}}function Se(t,e){Pt[t]=function(){return new Pt(e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))))},be[t]=function(){if(void 0!==this._master){var t,n=Array.prototype.slice.call(arguments);n.length<e.length?n=[this._master].concat(n):(t=Zt(n[0]),n[0]=this._master);var r=new Pt(e.apply(this,n));return r._mpe=t,this.send(r)}return this.send(e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))))}}function Ae(t,e){Pt[t]=function(){var t,n=[],r=e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments)));for(t=0;t<r.length;t++)n.push(new Pt(r[t]));return n},be[t]=function(){var t,n,r;if(void 0!==this._master){var i,o=Array.prototype.slice.call(arguments);for(o.length<e.length?o=[this._master].concat(o):(i=Zt(o[0]),o[0]=this._master),n=e.apply(this,o),r=this,t=0;t<n.length;t++){var s=Pt(n[t]);s._mpe=i,r=r.send(s)}return r}for(n=e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))),r=this,t=0;t<n.length;t++)r=r.send(n[t]);return r}}function Oe(t){O(be,function(e){t.prototype[e]=be[e]})}O(fe,function(t){we(t,fe[t])}),O(me,function(t){we(t,me[t])}),O(ve,function(t){xe(t,ve[t])}),O(_e,function(t){Te(t,_e[t])}),O(le,function(t){ke(t,le[t])}),O(he,function(t){Se(t,he[t])}),O(ge,function(t){Ae(t,ge[t])}),Oe(V);var Ee={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++)Ee[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 je(t){for(var e="",n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e}function Re(t){return t instanceof Array?je(t):void 0===t?"":""+t}function Pe(t){for(var e=0,n=0;n<t.length;n++)e=(e<<8)+t.charCodeAt(n);return e}function De(t){return(t<16?"0":"")+t.toString(16)}function Le(t){for(var e=[],n=0;n<t.length;n++)e.push(De(t[n]));return e.join(" ")}function Fe(t){for(var e=[],n=0;n<t.length;n++)n&&n%4==0&&e.push(" "),e.push(De(t[n]));return e.join("")}function $e(t){for(var e="",n=0;n<t.length;n++)"\n"==t[n]?e+="\\n":"\r"==t[n]?e+="\\r":"\t"==t[n]?e+="\\t":t.charCodeAt(n)<32?e+="\\x"+De(t.charCodeAt(n)):e+=t[n];return e}function Be(t){return t.length?": "+Le(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?"??":De(t),r=void 0===e?"??":De(e),i={"0000":"Pitch Bend Sensitivity","0001":"Channel Fine Tuning","0002":"Channel Coarse Tuning","0003":"Select Tuning Program","0004":"Select Tuning Bank","0005":"Vibrato Depth Range","7f7f":"NONE"}[n+""+r];return"RPN "+n+" "+r+(i?": "+i:"")}function Ge(t,e){return"NRPN "+(void 0===t?"??":De(t))+" "+(void 0===e?"??":De(e))}function ze(t){var e,n="";for(e=0;e<t.length&&t[e];e++)n+=String.fromCharCode(t[e]);return At.lib.fromUTF8(n)}function We(t){var e,n,r,i,o,s,a,u="x",c="x";if(t.isMidi2?(r=t[0]>>4,n=u=(15&t[0]).toString(16),this._cc[n]||(this._cc[n]={}),2==r?e=new Pt(t.slice(1)):3==r?(i=t[1]>>4,o=15&t[1],s=t.slice(2,2+o),0==i&&(e=new Pt([240].concat(s,[247])),this._cc[n].sx=void 0),1==i&&(this._cc[n].sx=s),2==i&&this._cc[n].sx&&(this._cc[n].sx=this._cc[n].sx.concat(s)),3==i&&this._cc[n].sx&&(s=this._cc[n].sx.concat(s),e=new Pt([240].concat(s,[247])),this._cc[n].sx=void 0)):4==r?(i=t[1]>>4,n=u+(c=(15&t[1]).toString(16)),this._cc[n]||(this._cc[n]={}),12==i&&(1&t[3]&&(this._cc[n].bm=t[6],this._cc[n].bl=t[7]),t._bm=this._cc[n].bm,t._bl=this._cc[n].bl,At.MIDI.programName&&t.label(At.MIDI.programName(t[4],t._bm,t._bl)))):13==r&&(i=t[1]>>6,48&t[1]||(c=(15&t[1]).toString(16)),n=u+c,this._cc[n]||(this._cc[n]={}),s=t.slice(4),0==i&&(t.label(ze(s)),this._cc[n].tx=void 0),1==i&&(this._cc[n].tx=s),2==i&&this._cc[n].tx&&(this._cc[n].tx=this._cc[n].tx.concat(s)),3==i&&this._cc[n].tx&&(s=this._cc[n].tx.concat(s),t.label(ze(s)),this._cc[n].tx=void 0))):e=t,!e||!e.length||e[0]<128)return t;if(255==e[0])return this._clear(),t;if(i=e[0]>>4,c=(15&e[0]).toString(16),n=15==i?u:u+c,this._cc[n]||(this._cc[n]={}),12==i)e._bm=this._cc[n].bm,e._bl=this._cc[n].bl,At.MIDI.programName&&t.label(At.MIDI.programName(e[1],e._bm,e._bl));else if(11==i)switch(e[1]){case 0:this._cc[n].bm=e[2];break;case 32:this._cc[n].bl=e[2];break;case 98:this._cc[n].nl=e[2],this._cc[n].rn="n";break;case 99:this._cc[n].nm=e[2],this._cc[n].rn="n";break;case 100:this._cc[n].rl=e[2],this._cc[n].rn="r";break;case 101:this._cc[n].rm=e[2],this._cc[n].rn="r";break;case 6:case 38:case 96:case 97:"r"==this._cc[n].rn&&(e._rm=this._cc[n].rm,e._rl=this._cc[n].rl,t.label(Ve(this._cc[n].rm,this._cc[n].rl))),"n"==this._cc[n].rn&&(e._nm=this._cc[n].rm,e._nl=this._cc[n].nl,t.label(Ge(this._cc[n].nm,this._cc[n].nl)))}else e.isFullSysEx()&&(127==e[1]?4==e[3]?(a={1:"Master Volume",2:"Master Balance",3:"Master Fine Tuning",4:"Master Coarse Tuning"}[e[4]])&&t.label(a):8==e[3]&&(a={2:"Note Tuning",7:"Note Tuning, Bank",8:"Scale Tuning, 1 byte format",9:"Scale Tuning, 2 byte format"}[e[4]])&&t.label(a):126==e[1]?6==e[3]?1==e[4]?t.label("Device ID Request"):2==e[4]&&t.label("Device ID Response"):8==e[3]?(a={0:"Bulk Tuning Dump Request",1:"Bulk Tuning Dump",3:"Bulk Tuning Dump Request, Bank",4:"Bulk Tuning Dump, Bank",5:"Scale Tuning Dump, 1 byte format",6:"Scale Tuning Dump, 2 byte format",7:"Note Tuning, Bank",8:"Scale Tuning, 1 byte format",9:"Scale Tuning, 2 byte format"}[e[4]])&&t.label(a):9==e[3]&&(1==e[4]?(t.label("GM1 System On"),this._clear(u),this._cc[u].gm="1"):2==e[4]?(t.label("GM System Off"),this._clear(u),this._cc[u].gm="0"):3==e[4]&&(t.label("GM2 System On"),this._clear(u),this._cc[u].gm="2")):67==e[1]?16==(240&e[2])&&76==e[3]&&(0==e[4]&&0==e[5]&&126==e[6]&&0==e[7]?(t.label("XG System On"),this._clear(u),this._cc[u].gm="Y"):0==e[4]&&0==e[5]&&0==e[6]?t.label("XG Master Tuning"):0==e[4]&&0==e[5]&&4==e[6]?t.label("XG Master Volume"):0==e[4]&&0==e[5]&&6==e[6]?t.label("XG Master Transpose"):8==e[4]&&e[5]<16&&e[6]>=65&&e[6]<=76?t.label("XG Scale Tuning"):t.label("XG Parameter")):65==e[1]&&66==e[3]&&18==e[4]&&(64==e[5]&&(0==e[6]?127==e[7]&&0==e[8]&&65==e[9]?(t.label("GS Reset"),this._clear(u),this._cc[u].gm="R"):0==e[7]?t.label("GS Master Tuning"):4==e[7]?t.label("GS Master Volume"):5==e[7]?t.label("GS Master Transpose"):t.label("GS Parameter"):16==(240&e[6])&&21==e[7]?t.label("GS Drum Part Change"):16==(240&e[6])&&e[7]>=64&&e[7]<=75?t.label("GS Scale Tuning"):t.label("GS Parameter")),65==e[5]&&t.label("GS Parameter")));return t}function Je(){var t=new V;return t._clear=Ue,t._read=We,t._receive=function(t){this._emit(this._read(t))},t.gm=function(t){return void 0===t&&(t="x"),this._cc[t]&&this._cc[t].gm||0},t._clear(),t._resume(),t}function He(){var t=this instanceof He?this:t=new He;return t.reset(),arguments.length&&He.prototype.setup.apply(t,arguments),t}function Xe(t){var e,n=this instanceof Xe?this:n=new Xe;if(t instanceof Xe)return n._from=t._from.slice(),O(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=Ee[t]))return this;if(32==this.ff)this.dd=String.fromCharCode(t);else{var e=this[0];void 0!==e&&e>=128&&e<=239&&(this[0]=240&e|t)}return this},Pt.prototype.getNote=function(){var t=this[0];if(!(void 0===t||t<128||t>175))return this[1]},Pt.prototype.setNote=function(t){var e=this[0];return void 0===e||e<128||e>175||void 0!==(t=Pt.noteValue(t))&&(this[1]=t),this},Pt.prototype.getVelocity=function(){var t=this[0];if(!(void 0===t||t<128||t>159))return this[2]},Pt.prototype.setVelocity=function(t){var e=this[0];return void 0===e||e<128||e>159||(t=parseInt(t))>=0&&t<128&&(this[2]=t),this},Pt.prototype.getSysExId=function(){if(240==this[0])return this[2]},Pt.prototype.setSysExId=function(t){return 240==this[0]&&this.length>2&&(t=parseInt(t))>=0&&t<128&&(this[2]=t),this},Pt.prototype.getData=function(){if(void 0!==this.dd)return this.dd.toString()},Pt.prototype.setData=function(t){return this.dd=Re(t),this},Pt.prototype.getText=function(){if(void 0!==this.dd)return Me(this.ff,this.dd)?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"+De(this.ff)}return(e=this._string())?t+" -- "+e:t},Pt.prototype._string=function(){var t,e="";if(!this.length){if(0==this.ff)e+="Sequence Number: "+Pe(this.dd);else if(this.ff>0&&this.ff<10)e+=["","Text","Copyright","Sequence Name","Instrument Name","Lyric","Marker","Cue Point","Program Name","Device Name"][this.ff]+qe(this.dd);else if(32==this.ff)e+="Channel Prefix"+Be(this.dd);else if(33==this.ff)e+="MIDI Port"+Be(this.dd);else if(47==this.ff)e+="End of Track"+Be(this.dd);else if(81==this.ff)e+="Tempo: "+Math.round(100*this.getBPM())/100+" bpm";else if(84==this.ff)e+="SMPTE Offset: "+Rt(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:"+De(this.dd.charCodeAt(2))+"]",e+=(t={0:"Version",1:"Chord",2:"Rehearsal Mark",3:"Phrase Mark",4:"Max Phrase Mark",5:"Fingering Number",12:"Guide Track Flag",16:"Guitar Info",18:"Chord Voicing",127:"XG Song Data Number"}[this.dd.charCodeAt(2)])?" "+t:"",e+=": ",0==this.dd.charCodeAt(2)?e+this.dd.substring(3,7)+" "+Le(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:"+De(this[5])+"]"+t;var i=this[0]>>4;return(t={8:"Note Off",10:"Aftertouch",12:"Program Change",13:"Channel Aftertouch",14:"Pitch Wheel"}[i])?t:9==i?this[2]?"Note On":"Note Off":11!=i?e:(t={0:"Bank Select MSB",1:"Modulation Wheel MSB",2:"Breath Controller MSB",4:"Foot Controller MSB",5:"Portamento Time MSB",6:"Data Entry MSB",7:"Channel Volume MSB",8:"Balance MSB",10:"Pan MSB",11:"Expression Controller MSB",12:"Effect Control 1 MSB",13:"Effect Control 2 MSB",16:"General Purpose Controller 1 MSB",17:"General Purpose Controller 2 MSB",18:"General Purpose Controller 3 MSB",19:"General Purpose Controller 4 MSB",31:"Karaoke",32:"Bank Select LSB",33:"Modulation Wheel LSB",34:"Breath Controller LSB",36:"Foot Controller LSB",37:"Portamento Time LSB",38:"Data Entry LSB",39:"Channel Volume LSB",40:"Balance LSB",42:"Pan LSB",43:"Expression Controller LSB",44:"Effect control 1 LSB",45:"Effect control 2 LSB",48:"General Purpose Controller 1 LSB",49:"General Purpose Controller 2 LSB",50:"General Purpose Controller 3 LSB",51:"General Purpose Controller 4 LSB",64:"Damper Pedal",65:"Portamento",66:"Sostenuto",67:"Soft Pedal",68:"Legato",69:"Hold 2",70:"Sound Variation",71:"Filter Resonance",72:"Release Time",73:"Attack Time",74:"Brightness",75:"Decay Time",76:"Vibrato Rate",77:"Vibrato Depth",78:"Vibrato Delay",79:"Sound Controller 10",80:"General Purpose Controller 5",81:"General Purpose Controller 6",82:"General Purpose Controller 7",83:"General Purpose Controller 8",84:"Portamento Control",88:"High Resolution Velocity Prefix",91:"Effects 1 Depth",92:"Effects 2 Depth",93:"Effects 3 Depth",94:"Effects 4 Depth",95:"Effects 5 Depth",96:"Data Increment",97:"Data Decrement",98:"Non-Registered Parameter Number LSB",99:"Non-Registered Parameter Number MSB",100:"Registered Parameter Number LSB",101:"Registered Parameter Number MSB",120:"All Sound Off",121:"Reset All Controllers",122:"Local Control On/Off",123:"All Notes Off",124:"Omni Mode Off",125:"Omni Mode On",126:"Mono Mode On",127:"Poly Mode On"}[this[1]],this[1]>=64&&this[1]<=69&&(t+=this[2]<64?" Off":" On"),t||(t="Undefined"),t)},Pt.prototype._stamp=function(t){return this._from.push(t._orig?t._orig:t),this},Pt.prototype._unstamp=function(t){if(void 0===t)this._from=[];else{t._orig&&(t=t._orig);var e=this._from.indexOf(t);e>-1&&this._from.splice(e,1)}return this},Pt.prototype._stamped=function(t){t._orig&&(t=t._orig);for(var e=0;e<this._from.length;e++)if(this._from[e]==t)return!0;return!1},At.MIDI=Pt,A.prototype.MIDI=Pt,At.Context=Je,A.prototype.Context=Je,He.validate=function(t){var e=t instanceof Array?t:arguments;if(e[0]!=parseInt(e[0])||e[0]<0||e[0]>14)throw RangeError("Bad master channel value: "+e[0]);if(e[1]!=parseInt(e[1])||e[1]<0||e[0]+e[1]>15)throw RangeError("Bad zone size value: "+e[1])},He.prototype.reset=function(){for(var t=0;t<16;t++)this[t]={band:0,master:t}},He.prototype.setup=function(t,e){var n;He.validate(t,e);var r=t+e;if((this[t].master!=t||this[t].band!=e)&&(e||this[t].band)){for(this[t].band?r<(n=t+this[t].band)&&(r=n):this[t].master==t-1?(n=t-1,r<(n+=this[n].band)&&(r=n),this[t-1]={band:0,master:t-1}):this[t].master!=t&&(n=this[t].master,r<(n+=this[n].band)&&(r=n),this[this[t].master].band=t-this[t].master-1),this[t].master=t,this[t].band=e,n=t+1;n<=t+e;n++)this[n].band&&r<n+this[n].band&&(r=n+this[n].band),this[n]={band:0,master:t};for(;n<=r;n++)this[n]={band:0,master:n}}},He.prototype.filter=function(t){var e=t.getChannel();if(!this[e]||!this[this[e].master].band)return t;var n,r,i,o=this[e].master,s=this[o].band;if(void 0!==t._mpe){for(i=256,n=o+1;n<=o+s;n++)if(this[n].notes){for(i>this[n].notes.length&&(e=n,i=this[n].notes.length),r=0;r<this[n].notes.length;r++)if(this[n].notes[r]==t._mpe){e=n,i=-1;break}}else i>0&&(e=n,i=0);t.setChannel(e),t._mpe=void 0}return e==o||(t.isNoteOn()?(this[e].notes||(this[e].notes=[]),k(this[e].notes,t.getNote())):t.isNoteOff()&&this[e].notes&&S(this[e].notes,t.getNote())),t},At.MPE=He,Xe.prototype=[],Xe.prototype.constructor=Xe,Xe.prototype.isMidi=function(){return 2},Xe.prototype.isMidi2=!0,Xe.prototype.dump=function(){var t,e="";for(t=0;t<this.length;t++)e+=String.fromCharCode(this[t]);return e},Ke.prototype=Xe,Xe._sxid=127,Xe.sxId=function(t){if(void 0===t&&(t=Xe._sxid),t==this._sxid)return this;t=zt(t);var e=new Ke;return e._ch=this._ch,e._gr=this._gr,e._sxid=t,e},Xe.ch=function(t){if(t==this._ch||void 0===t&&void 0===this._ch)return this;var e=new Ke;return void 0!==t&&(t=Vt(t)),e._ch=t,e._gr=this._gr,e._sxid=this._sxid,e},Xe.gr=function(t){if(t==this._gr||void 0===t&&void 0===this._gr)return this;var e=new Ke;return void 0!==t&&(t=Gt(t)),e._ch=this._ch,e._gr=t,e._sxid=this._sxid,e},Xe.prototype.getGroup=function(){if(this[0]){var t=this[0]>>4;return 1==t||2==t||3==t||4==t||5==t||13==t?15&this[0]:void 0}};var Qe=[0,0,0,0,0,0,0,0,0,0,0,0,0];function Ze(t,e,n,r){return void 0!==e?[Wt(t),Wt(e),Wt(n),Wt(r)]:[(t=Qt(t))>>24&255,t>>16&255,t>>8&255,255&t]}function Ye(t){return(t=Math.floor(4294967296*t))>4294967295?4294967295:t<0?0:t}var tn={noop:function(){return[0,0,0,0]},umpClock:function(t){return[0,16,(t=Ht(t))>>8,255&t]},umpTimestamp:function(t){return[0,32,(t=Ht(t))>>8,255&t]},umpTicksPQN:function(t){return[0,48,(t=Ht(t))>>8,255&t]},umpDelta:function(t){return[0,64+((t=Xt(t=t||0))>>16),t>>8&255,255&t]},umpStartClip:function(){return[240,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},umpEndClip:function(){return[240,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},en={umpTempo:function(t,e){return[208+Gt(t),16,0,0].concat(Ze(e),[0,0,0,0,0,0,0,0])},umpBPM:function(t,e){return en.umpTempo(t,Math.round(6e9/e))},umpTimeSignature:function(t,e,n){var r,i,o,s=(""+e).match(/^\s*(\d+)\s*\/\s*(\d+)\s*$/);if(s?(r=parseInt(s[1]),i=parseInt(s[2])):e==parseInt(e)&&n==parseInt(n)&&(r=parseInt(e),i=parseInt(n)),r>0&&r<256&&i>0&&!(i&i-1)){for(o=0,i>>=1;i;i>>=1)o++;if((i=Math.round(32*r/(1<<o)))<256)return[208+Gt(t),16,0,1,r,o,i,0,0,0,0,0,0,0,0,0]}throw RangeError("Wrong time signature "+e+(void 0===n?"":"/"+n))}},nn={umpMetadata:function(t,e){return sn.umpCustomText(t,0,1,1,0,e)},umpProjectName:function(t,e){return sn.umpCustomText(t,0,1,1,1,e)},umpCompositionName:function(t,e){return sn.umpCustomText(t,0,1,1,2,e)},umpClipName:function(t,e){return sn.umpCustomText(t,0,1,1,3,e)},umpCopyright:function(t,e){return sn.umpCustomText(t,0,1,1,4,e)},umpComposerName:function(t,e){return sn.umpCustomText(t,0,1,1,5,e)},umpLyricistName:function(t,e){return sn.umpCustomText(t,0,1,1,6,e)},umpArrangerName:function(t,e){return sn.umpCustomText(t,0,1,1,7,e)},umpPublisherName:function(t,e){return sn.umpCustomText(t,0,1,1,8,e)},umpPerformerName:function(t,e){return sn.umpCustomText(t,0,1,1,9,e)},umpAccPerformerName:function(t,e){return sn.umpCustomText(t,0,1,1,10,e)},umpRecordingDate:function(t,e){return sn.umpCustomText(t,0,1,1,11,e)},umpRecordingLocation:function(t,e){return sn.umpCustomText(t,0,1,1,12,e)},umpText:function(t,e){return sn.umpCustomText(t,0,1,2,0,e)},umpLyrics:function(t,e){return sn.umpCustomText(t,0,1,2,1,e)},umpLyricsLanguage:function(t,e){return sn.umpCustomText(t,0,1,2,2,e)},umpRuby:function(t,e){return sn.umpCustomText(t,0,1,2,3,e)},umpRubyLanguage:function(t,e){return sn.umpCustomText(t,0,1,2,4,e)},umpData:function(t,e,n){var r;void 0===n&&(n=e,e=0);var i=fn(gn(n),13);for(r=0;r<i.length;r++)i[r]=[80+Gt(t),16*pn(i.length,r)+i[r].length,Wt(e)].concat(i[r],Qe).slice(0,16);return i}},rn=[0,6,32,38,98,99,100,101],on={umpNoteOn:function(t,e,n,r,i,o){return void 0===r&&(r=65535),i=i||0,o=o||0,r=Ht(r),o=Ht(o),[64+Gt(t),144+Vt(e),Zt(n),Wt(i),r>>8,255&r,o>>8,255&o]},umpNoteOff:function(t,e,n,r,i,o){return i=i||0,o=o||0,r=Ht(r=r||0),o=Ht(o),[64+Gt(t),128+Vt(e),Zt(n),Wt(i),r>>8,255&r,o>>8,255&o]},umpAftertouch:function(t,e,n,r,i,o,s){return[64+Gt(t),160+Vt(e),Zt(n),0].concat(Ze(r,i,o,s))},umpAftertouchF:function(t,e,n,r){return on.umpAftertouch(t,e,n,Ye(r))},umpControl:function(t,e,n,r,i,o,s){return rn.includes(n)&&Bt(n),[64+Gt(t),176+Vt(e),zt(n),0].concat(Ze(r,i,o,s))},umpPortamento:function(t,e,n){return[64+Gt(t),176+Vt(e),84,0,Zt(n),0,0,0]},umpPressure:function(t,e,n,r,i,o){return[64+Gt(t),208+Vt(e),0,0].concat(Ze(n,r,i,o))},umpPressureF:function(t,e,n){return on.umpPressure(t,e,Ye(n))},umpProgram:function(t,e,n,r,i){return void 0===r&&void 0===i?[64+Gt(t),192+Vt(e),0,0,Zt(n),0,0,0]:void 0===i?[64+Gt(t),192+Vt(e),0,1,Zt(n),0,te(r),Yt(r)]:[64+Gt(t),192+Vt(e),0,1,Zt(n),0,zt(r),zt(i)]},umpPitchBend:function(t,e,n,r,i,o){return[64+Gt(t),224+Vt(e),0,0].concat(Ze(n,r,i,o))},umpPitchBendF:function(t,e,n){return on.umpPitchBend(t,e,Ye((n+1)/2))},umpPnPitchBend:function(t,e,n,r,i,o,s){return[64+Gt(t),96+Vt(e),Zt(n),0].concat(Ze(r,i,o,s))},umpPnPitchBendF:function(t,e,n,r){return on.umpPnPitchBend(t,e,n,Ye((r+1)/2))},umpRPN:function(t,e,n,r,i,o,s,a){return[64+Gt(t),32+Vt(e),zt(n),zt(r)].concat(Ze(i,o,s,a))},umpNRPN:function(t,e,n,r,i,o,s,a){return[64+Gt(t),48+Vt(e),zt(n),zt(r)].concat(Ze(i,o,s,a))},umpPnRPN:function(t,e,n,r,i,o,s,a){return[64+Gt(t),0+Vt(e),Zt(n),Wt(r)].concat(Ze(i,o,s,a))},umpPnNRPN:function(t,e,n,r,i,o,s,a){return[64+Gt(t),16+Vt(e),Zt(n),Wt(r)].concat(Ze(i,o,s,a))},umpFineTuning:function(t,e,n,r,i,o){return on.umpRPN(t,e,0,1,n,r,i,o)},umpFineTuningF:function(t,e,n){return on.umpFineTuning(t,e,Pt.to32b(re((n%1+1)/2,n)))},umpCoarseTuning:function(t,e,n){return[64+Gt(t),32+Vt(e),0,2,2*zt(n),0,0,0]},umpCoarseTuningF:function(t,e,n){return on.umpCoarseTuning(t,e,n-n%1+64)},umpTuningProgram:function(t,e,n){return[64+Gt(t),32+Vt(e),0,3,2*zt(n),0,0,0]},umpTuningBank:function(t,e,n){return[64+Gt(t),32+Vt(e),0,4,2*zt(n),0,0,0]},umpPnManagement:function(t,e,n,r){for(var i=r.toString().split(""),o=0,s=0;s<i.length;s++)if("S"!=i[s]||1&o){if("D"!=i[s]||2&o){o=r;break}o|=2}else o|=1;return[64+Gt(t),240+Vt(e),Zt(n),Wt(o),0,0,0,0]}};on.umpPnPressure=on.umpAftertouch,on.umpPnPressureF=on.umpAftertouchF,on.umpTranspose=on.umpCoarseTuningF;var sn={umpTuningF:function(t,e,n){return[on.umpCoarseTuningF(t,e,n),on.umpFineTuningF(t,e,n)]},umpTuningA:function(t,e,n){return sn.umpTuningF(t,e,Pt.shift(n))},umpCustomText:function(t,e,n,r,i,o){var s,a=[];for(o=At.lib.toUTF8(""+o),s=0;s<o.length;s++)a.push(o.charCodeAt(s));for(a=fn(a,12),s=0;s<a.length;s++)a[s]=[208+Gt(t),64*pn(a.length,s)+(n?16:0)+Vt(e),r,i].concat(a[s],Qe).slice(0,16);return a},umpCMetadata:function(t,e,n){return sn.umpCustomText(t,e,0,1,0,n)},umpCProjectName:function(t,e,n){return sn.umpCustomText(t,e,0,1,1,n)},umpCCompositionName:function(t,e,n){return sn.umpCustomText(t,e,0,1,2,n)},umpCClipName:function(t,e,n){return sn.umpCustomText(t,e,0,1,3,n)},umpCCopyright:function(t,e,n){return sn.umpCustomText(t,e,0,1,4,n)},umpCComposerName:function(t,e,n){return sn.umpCustomText(t,e,0,1,5,n)},umpCLyricistName:function(t,e,n){return sn.umpCustomText(t,e,0,1,6,n)},umpCArrangerName:function(t,e,n){return sn.umpCustomText(t,e,0,1,7,n)},umpCPublisherName:function(t,e,n){return sn.umpCustomText(t,e,0,1,8,n)},umpCPerformerName:function(t,e,n){return sn.umpCustomText(t,e,0,1,9,n)},umpCAccPerformerName:function(t,e,n){return sn.umpCustomText(t,e,0,1,10,n)},umpCRecordingDate:function(t,e,n){return sn.umpCustomText(t,e,0,1,11,n)},umpCRecordingLocation:function(t,e,n){return sn.umpCustomText(t,e,0,1,12,n)},umpCText:function(t,e,n){return sn.umpCustomText(t,e,0,2,0,n)},umpCLyrics:function(t,e,n){return sn.umpCustomText(t,e,0,2,1,n)},umpCLyricsLanguage:function(t,e,n){return sn.umpCustomText(t,e,0,2,2,n)},umpCRuby:function(t,e,n){return sn.umpCustomText(t,e,0,2,3,n)},umpCRubyLanguage:function(t,e,n){return sn.umpCustomText(t,e,0,2,4,n)}},an={};function un(t,e){Xe[t]=function(){return new Xe(e.apply(this,arguments))},an[t]=function(){return this.send(e.apply(this,arguments))}}function cn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),new Xe(e.apply(this,t))},an[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),this.send(e.apply(this,t))}}function ln(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=e.apply(this,t),r=0;r<n.length;r++)n[r]=new Xe(n[r]);return n},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=e.apply(this,t),r=0;r<n.length;r++)this.send(n[r]);return this}}function hn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1))),new Xe(e.apply(this,t))},an[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1))),this.send(e.apply(this,t))}}function dn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1)));for(var n=e.apply(this,t),r=0;r<n.length;r++)n[r]=new Xe(n[r]);return n},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1)));for(var n=e.apply(this,t),r=0;r<n.length;r++)this.send(n[r]);return this}}function pn(t,e){return 1==t?0:0==e?1:e==t-1?3:2}function fn(t,e){for(var n=[],r=t;r.length;r=r.slice(e))n.push(r.slice(0,e));return n.length?n:[[]]}function mn(t,e){for(var n=fn(e.slice(1,e.length-1),6),r=0;r<n.length;r++)n[r]=new Xe([48+t,16*pn(n.length,r)+n[r].length].concat(n[r],Qe).slice(0,8));return n}function gn(t){var e,n=[];if("string"==typeof t)for(e=0;e<t.length;e++)n.push(t.charCodeAt(e));else for(e=0;e<t.length;e++)n.push(t[e]);for(e=0;e<n.length;e++)if(n[e]!=parseInt(n[e])||n[e]<0||n[e]>255)throw RangeError("Bad data");return n}function _n(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),mn(Gt(t[0]),e.apply(this,t.slice(1)))},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=mn(Gt(t[0]),e.apply(this,t.slice(1))),r=this,i=0;i<n.length;i++)r=r.send(n[i]);return r}}function yn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=e.apply(this,t.slice(1)),r=[],i=0;i<n.length;i++)r=r.concat(mn(Gt(t[0]),n[i]));return r},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=e.apply(this,t.slice(1)),r=this,i=0;i<n.length;i++)for(var o=mn(Gt(t[0]),n[i]),s=0;s<o.length;s++)r=r.send(o[s]);return r}}function vn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),new Xe([16+Gt(t[0])].concat(e.apply(this,t.slice(1)),Qe).slice(0,4))},an[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),this.send([16+Gt(t[0])].concat(e.apply(this,t.slice(1)),Qe).slice(0,4))}}function bn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1))),new Xe([32+Gt(t[0])].concat(e.apply(this,t.slice(1)),Qe).slice(0,4))},an[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1))),this.send([32+Gt(t[0])].concat(e.apply(this,t.slice(1)),Qe).slice(0,4))}}function wn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1)));for(var n=e.apply(this,t.slice(1)),r=0;r<n.length;r++)n[r]=new Xe([32+Gt(t[0])].concat(n[r],Qe).slice(0,4));return n},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1)));for(var n=e.apply(this,t.slice(1)),r=this,i=0;i<n.length;i++)r=r.send([32+Gt(t[0])].concat(n[i],Qe).slice(0,4));return r}}function xn(t){O(an,function(e){t.prototype[e]=an[e]})}function Tn(t,e){var n=256*t+e;return n?n>>9||1:0}function kn(t,e,n,r){return 16777216*t+65536*e+256*n+r>>25&127}function Sn(t,e){return t.gr=e,t}function An(t){if(t.isMidi2){var e,n,r,i=t[0]>>4,o=15&t[0];if(1==i||2==i)this._emit(Sn(new Pt(t.slice(1)),o));else if(3==i)n=t[1]>>4,e=15&t[1],0==n?(this._emit(Sn(new Pt([240].concat(t.slice(2,2+e),[247])),o)),this._sx[o]=void 0):1==n?this._sx[o]=t.slice(2,2+e):2==n?this._sx[o]&&(this._sx[o]=this._sx[o].concat(t.slice(2,2+e))):3==n&&(this._sx[o]&&this._emit(Sn(new Pt([240].concat(this._sx[o],t.slice(2,2+e),[247])),o)),this._sx[o]=void 0);else if(4==i){if(e=t[1]>>4,n=15&t[1],2==e||3==e?(this._emit(Sn(new Pt([176+n,2==e?101:99,t[2]]),o)),this._emit(Sn(new Pt([176+n,2==e?100:98,t[3]]),o)),this._emit(Sn(new Pt([176+n,6,t[4]>>1]),o)),this._emit(Sn(new Pt([176+n,38,64*(1&t[4])+(t[4]>>2)]),o))):8!=e&&9!=e||this._emit(Sn(new Pt([t[1],t[2],Tn(t[4],t[5])]),o)),10==e&&this._emit(Sn(new Pt([t[1],t[2],kn(t[4],t[5],t[6],t[7])]),o)),11==e){if(rn.includes(t[2]))return;this._emit(Sn(new Pt([t[1],t[2],kn(t[4],t[5],t[6],t[7])]),o))}13==e&&this._emit(Sn(new Pt([t[1],kn(t[4],t[5],t[6],t[7])]),o)),14==e?(r=16777216*t[4]+65536*t[5]+256*t[6]+t[4]>>18,this._emit(Sn(new Pt([t[1],127&r,r>>7&127]),o))):12==e&&(t[3]&&(this._emit(Sn(new Pt([176+n,0,t[6]]),o)),this._emit(Sn(new Pt([176+n,32,t[7]]),o))),this._emit(Sn(new Pt([t[1],t[4]]),o)))}}else this._emit(t)}function On(){var t=new V;return t._sx=[],t._receive=An,t._resume(),t.MIDI2()}function En(t){if(t.isMidi2)this._emit(t);else{var e=t.gr>=0&&t.gr<=15?t.gr:0;if(t[0]>=128&&t[0]<240)this._emit(At.MIDI2([32+e].concat(t.slice(),Qe).slice(0,4)));else if(t[0]>240&&t[0]<=255&&247!=t[0])this._emit(At.MIDI2([16+e].concat(t.slice(),Qe).slice(0,4)));else if(t.isFullSysEx())for(var n=mn(e,t.slice()),r=0;r<n.length;r++)this._emit(At.MIDI2(n[r]))}}function Cn(){var t=new V;return t._receive=En,t._resume(),t}O(tn,function(t){un(t,tn[t])}),O(en,function(t){cn(t,en[t])}),O(nn,function(t){ln(t,nn[t])}),O(on,function(t){hn(t,on[t])}),O(sn,function(t){dn(t,sn[t])}),O(fe,function(t){vn(t,fe[t])}),O(le,function(t){bn(t,le[t])}),O(he,function(t){bn(t,he[t])}),O(ge,function(t){wn(t,ge[t])}),O(me,function(t){_n(t,me[t])}),O(_e,function(t){yn(t,_e[t])}),xn(Q),Xe.prototype.getTempo=function(){if(this.isTempo())return(this[4]<<24)+(this[5]<<16)+(this[6]<<8)+this[7]},Xe.prototype.getBPM=function(){var t=this.getTempo();if(t)return Math.round(6e9/t)},Xe.prototype.getTimeSignature=function(){if(this.isTimeSignature())return[this[4],1<<this[5]]},Xe.prototype.getTicksPQN=function(){if(this.isTicksPQN())return(this[2]<<8)+this[3]},Xe.prototype.getDelta=function(){if(this.isDelta())return((15&this[1])<<16)+(this[2]<<8)+this[3]},Xe.prototype.getStatus=function(){return this.isFlex()?this[1]>>6:this.isData()||this.isSX()?this[1]>>4:void 0},Xe.prototype.isTempo=function(){return this[0]>>4==13&&this[1]>>4==1&&0==this[2]&&0==this[3]},Xe.prototype.isTimeSignature=function(){return this[0]>>4==13&&this[1]>>4==1&&0==this[2]&&1==this[3]},Xe.prototype.isTicksPQN=function(){return 0==this[0]&&this[1]>>4==3},Xe.prototype.isDelta=function(){return 0==this[0]&&this[1]>>4==4},Xe.prototype.isStartClip=function(){return this.match([240,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0])},Xe.prototype.isEndClip=function(){return this.match([240,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0])},Xe.prototype.isData=function(){return 80==(240&this[0])},Xe.prototype.isFlex=function(){return 208==(240&this[0])},Xe.prototype.isText=function(){return 208==(240&this[0])&&(1==this[2]||2==this[2])},Xe.prototype.isSX=function(){return 48==(240&this[0])},Xe.prototype.isNoteOn=function(){var t=(this[0]||0)>>4,e=(this[1]||0)>>4;return 4==t?9==e:2==t&&9==e&&!!this[3]},Xe.prototype.isNoteOff=function(){var t=(this[0]||0)>>4,e=(this[1]||0)>>4;return 4==t?8==e:2==t&&(8==e||9==e&&!this[3])},Xe.prototype.label=Pt.prototype.label,Xe.prototype.toString=Pt.prototype.toString,Xe.prototype._str=function(){var t=this._string();return t?Fe(this)+" -- "+t:Fe(this)},Xe.prototype._string=function(){var t,e,n,r=this[0]>>4;return 1==r||2==r?new Pt(this.slice(1))._string():(0==r?e=["NOOP","JR Clock","JR Timestamp","Ticks Per Quarter Note","Delta Ticks"][t=this[1]>>4]:3==r?e="SysEx":4==r?(e={0:"Registered Per-Note Controller",1:"Assignable Per-Note Controller",2:"Registered Controller",3:"Assignable Controller",4:"Relative Registered Controller",5:"Relative Assignable Controller",6:"Per-Note Pitch Bend",8:"Note Off",9:"Note On",10:"Poly Pressure",11:"Control Change",12:"Program Change",13:"Channel Pressure",14:"Pitch Bend",15:"Per-Note Management"}[t=this[1]>>4],11==t&&(e={84:"Portamento"}[this[2]]||e),2==t&&(n={"0000":"Pitch Bend Sensitivity","0001":"Fine Tuning","0002":"Coarse Tuning","0003":"Select Tuning Program","0004":"Select Tuning Bank","0005":"Vibrato Depth Range","7f7f":"NONE"}[De(this[2])+""+De(this[3])])&&(e+=": "+n)):5==r?e="Data":13==r&&(0==(t=this[2])?(e={0:"Tempo ",1:"Time Signature ",2:"Metronome",5:"Key Signature",6:"Chord Name"}[t=this[3]],0==t?e+=this.getBPM()+" BPM":1==t&&(e+=this.getTimeSignature().join("/"))):1==t?e={0:"Metadata",1:"Project Name",2:"Composition Name",3:"Clip Name",4:"Copyright",5:"Composer Name",6:"Lyricist Name",7:"Arranger Name",8:"Publisher Name",9:"Primary Performer Name",10:"Accompanying Performer Name",11:"Recording Date",12:"Recording Location"}[t=this[3]]||"Unknown Text":2==t&&(e={0:"Text",1:"Lyrics",2:"Lyrics Language",3:"Ruby",4:"Ruby Language"}[t=this[3]]||"Unknown Text")),15==r&&(e={32:"Start of Clip",33:"End of Clip"}[this[1]]),e)},Xe.prototype._stamp=Pt.prototype._stamp,Xe.prototype._unstamp=Pt.prototype._unstamp,Xe.prototype._stamped=Pt.prototype._stamped,Xe.prototype.match=Pt.prototype.match,At.UMP=Xe,A.prototype.UMP=Xe,At.MIDI2=Xe,A.prototype.MIDI2=Xe,At.M2M1=On,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=[],jn=0;try{var Rn=URL.createObjectURL(new Blob(["(",function(){function t(){postMessage({}),setTimeout(t,0)}t()}.toString(),")()"],{type:"application/javascript"})),Pn=function(){for(var t=Nn.length,e=0;e<t;e++)Nn.shift()();++jn>20&&Mn&&(Mn.terminate(),Mn=void 0)},Dn=function(t){Nn.push(t),jn=0,Mn||((Mn=new Worker(Rn)).onmessage=Pn)};Dn(function(){At.lib.schedule=Dn})}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&&(D(),C._bad&&(C._repair(),C._resume())),!0},At.lib.registerMidiIn=function(t,e){for(var n=e._info(t),r=0;r<ut._ins.length;r++)if(ut._ins[r].name==n.name)return!1;return n.engine=e,ut._ins.push(n),C&&(D(),C._bad&&(C._repair(),C._resume())),!0},At.lib.unregisterMidiOut=function(t){for(var e=0;e<ut._outs.length;e++)if(ut._outs[e].name==t)return ut._outs.splice(e,e+1),C&&D(),!0;return!1},At.lib.unregisterMidiIn=function(t){for(var e=0;e<ut._ins.length;e++)if(ut._ins[e].name==t)return ut._ins.splice(e,e+1),C&&D(),!0;return!1},At.lib.plug=function(t){for(var e=0;e<ct.length;e++)if(ct[e]==t)return;ct.push(t)},At.lib.unplug=function(t){for(var e=0;e<ct.length;e++)if(ct[e]==t)return void ct.splice(e,1)},At.lib.copyMidiHelpers=Oe,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 Qn="Failed to execute 'send' on 'MIDIOutput': ";function Zn(t,e){var n,r,i,o=[];for(n=0;n<t.length;n++)if(t[n]!=parseInt(t[n])||t[n]<0||t[n]>255)throw TypeError(Qn+t[n]+" is not a UInt8 value.");for(r=0,n=0;n<t.length;n++)if(r){if(t[n]>127)throw TypeError(Qn+"Unexpected status byte at index "+n+" ("+t[n]+").");i.push(t[n]),r--}else{if(t[n]<128)throw TypeError(Qn+"Running status is not allowed at index "+n+" ("+t[n]+").");if(247==t[n])throw TypeError(Qn+"Unexpected end of system exclusive message at index "+n+" ("+t[n]+").");if(i=[t[n]],o.push(i),240==t[n]){if(!e)throw new Vn("InvalidAccessError",Qn+"System exclusive messag is not allowed at index "+n+" ("+t[n]+").",15);for(r=-1;n<t.length;n++)if(i.push(t[n]),247==t[n]){r=0;break}}else r=Kn(t[n])}if(r)throw TypeError(Qn+"Message is incomplete");return[o]}function Yn(t,e){var n=this,r=!1,i=null;this.type="output",this.id=e.id,this.name=e.name,this.manufacturer=e.man,this.version=e.ver,Object.defineProperty(this,"state",{get:function(){return e.connected?"connected":"disconnected"},enumerable:!0}),Object.defineProperty(this,"connection",{get:function(){return r?e.proxy?"open":"pending":"closed"},enumerable:!0}),Object.defineProperty(this,"onstatechange",{get:function(){return i},set:function(t){i=f(t)?t:null},enumerable:!0}),this.open=function(){return new Un(function(i,o){r?i(n):e.open().then(function(){r||(r=!0,Wn(n,t)),i(n)},function(){o(new Vn("InvalidAccessError","Port is not available",15))})})},this.close=function(){return new Un(function(i){r&&(r=!1,n.clear(),e.close(),Wn(n,t)),i(n)})},this.clear=function(){},this.send=function(i,o){if(Zn(i,t.sysexEnabled),!e.connected)throw new Vn("InvalidStateError","Port is not connected",11);if(r){var s=h();o>s?setTimeout(function(){e.proxy.send(i)},o-s):e.proxy.send(i)}else this.open().then(function(){n.send(i,o)},p)},Object.freeze(this)}function tr(t,e,n,r){this.id=t,this.name=e,this.man=n,this.ver=r,this.connected=!0,this.ports=[],this.pending=[],this.proxy=void 0}function er(t){this.has=function(e){return t.hasOwnProperty(e)&&t[e].connected},this.keys=function(){try{var e=new Map;for(var n in t)this.has(n)&&e.set(n,this.get(n));return e.keys()}catch(t){}},this.values=function(){try{var e=new Map;for(var n in t)this.has(n)&&e.set(n,this.get(n));return e.values()}catch(t){}},this.entries=function(){try{var e=new Map;for(var n in t)this.has(n)&&e.set(n,this.get(n));return e.entries()}catch(t){}},this.forEach=function(e,n){for(var r in void 0===n&&(n=this),t)this.has(r)&&e.call(n,this.get(r),r,this)},Object.defineProperty(this,"size",{get:function(){var e=0;for(var n in t)this.has(n)&&e++;return e},enumerable:!0})}function nr(t,e){this.get=function(n){if(qn.hasOwnProperty(n)&&qn[n].connected)return e[n]||(e[n]=new Jn(t,qn[n]),qn[n].ports.push([e[n],t.sysexEnabled])),e[n]},Object.freeze(this)}function rr(t,e){this.get=function(n){if(Bn.hasOwnProperty(n)&&Bn[n].connected)return e[n]||(e[n]=new Yn(t,Bn[n]),Bn[n].ports.push([e[n],t.sysexEnabled])),e[n]},Object.freeze(this)}function ir(t){var e,n,r,i;for(e=0;e<t.inputs.added.length;e++)r=t.inputs.added[e],qn.hasOwnProperty(r.id)||(qn[r.id]=new Xn(r.id,r.name,r.manufacturer,r.version)),qn[r.id].reconnect();for(e=0;e<t.outputs.added.length;e++)r=t.outputs.added[e],Bn.hasOwnProperty(r.id)||(Bn[r.id]=new tr(r.id,r.name,r.manufacturer,r.version)),Bn[r.id].reconnect();for(e=0;e<t.inputs.removed.length;e++)if(r=t.inputs.removed[e],qn.hasOwnProperty(r.id)){for(i=[],n=0;n<$n.length;n++)i.push([$n[n].inputs.get(r.id),$n[n]]);for(qn[r.id].disconnect(),n=0;n<i.length;n++)Wn(i[n][0],i[n][1])}for(e=0;e<t.outputs.removed.length;e++)if(r=t.outputs.removed[e],Bn.hasOwnProperty(r.id)){for(i=[],n=0;n<$n.length;n++)i.push([$n[n].outputs.get(r.id),$n[n]]);for(Bn[r.id].disconnect(),n=0;n<i.length;n++)Wn(i[n][0],i[n][1])}}function or(t){var e,n,r={},i={},o=null,s=this;this.sysexEnabled=t,this.inputs=new nr(s,r),this.outputs=new rr(s,i),Object.defineProperty(this,"onstatechange",{get:function(){return o},set:function(t){o=f(t)?t:null},enumerable:!0}),Object.freeze(this);var a=C._info;for(e=0;e<a.inputs.length;e++)n=a.inputs[e],qn.hasOwnProperty(n.id)||(qn[n.id]=new Xn(n.id,n.name,n.manufacturer,n.version));for(e=0;e<a.outputs.length;e++)n=a.outputs[e],Bn.hasOwnProperty(n.id)||(Bn[n.id]=new tr(n.id,n.name,n.manufacturer,n.version));$n.length||At().onChange(ir),$n.push(this)}return tr.prototype.open=function(){var t=this;return new Un(function(e,n){var r;t.proxy||!t.connected?e():(t.pending.push([e,n]),1==t.pending.length&&At().openMidiOut(t.name).or(function(){for(r=0;r<t.pending.length;r++)t.pending[r][1]();t.pending=[]}).and(function(){for(t.proxy=this,r=0;r<t.pending.length;r++)t.pending[r][0]();t.pending=[]}))})},tr.prototype.close=function(){var t;if(this.proxy){for(t=0;t<this.ports.length;t++)if("open"==this.ports[t].connection)return;this.proxy.close(),this.proxy=void 0}},tr.prototype.disconnect=function(){this.connected=!1,this.proxy&&(this.proxy.close(),this.proxy=void 0)},tr.prototype.reconnect=function(){var t,e,n=this,r=[];for(this.connected=!0,t=0;t<$n.length;t++)"closed"==(e=$n[t].outputs.get(this.id)).connection?Wn(e,$n[t]):r.push([e,$n[t]]);r.length&&At()._openMidiOutNR(n.name).or(function(){for(t=0;t<r.length;t++)r[t][0].close()}).and(function(){for(n.proxy=this,t=0;t<r.length;t++)Wn(r[t][0],r[t][1])})},nr.prototype=new er(qn),nr.prototype.constructor=nr,rr.prototype=new er(Bn),rr.prototype.constructor=rr,At.requestMIDIAccess=function(t){return new Un(function(e,n){At.JZZ(t).or(function(){}).and(function(){var r=!(!t||!t.sysex);if(r&&!this.info().sysex)n(new Vn("SecurityError","Sysex is not allowed",18));else{var i=new or(r);e(i)}})})},"undefined"==typeof navigator||navigator.requestMIDIAccess||(navigator.requestMIDIAccess=At.requestMIDIAccess),At.close=function(){at._close&&at._close()},At}()},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 E(this,e,n);case"latin1":case"binary":return C(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 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 T(t,e,n,r){return H(J(e),t,n,r)}function k(t,e,n,r){return H(function(t,e){let n,r,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function S(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function A(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i<n;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=O));return n}(r)}u.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),!u.TYPED_ARRAY_SUPPORT&&"undefined"!=typeof console&&console.error,Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,n){return c(t,e,n)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,n){return function(t,e,n){return l(t),t<=0?a(t):void 0!==e?"string"==typeof n?a(t).fill(e,n):a(t).fill(e):a(t)}(t,e,n)},u.allocUnsafe=function(t){return h(t)},u.allocUnsafeSlow=function(t){return h(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(X(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),X(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;const r=u.allocUnsafe(e);let i=0;for(n=0;n<t.length;++n){let e=t[n];if(X(e,Uint8Array))i+e.length>r.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},u.byteLength=m,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)_(this,e,e+1);return this},u.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)_(this,e,e+3),_(this,e+1,e+2);return this},u.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)_(this,e,e+7),_(this,e+1,e+6),_(this,e+2,e+5),_(this,e+3,e+4);return this},u.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):g.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){let t="";const n=e.IS;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,n,r,i){if(X(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const a=Math.min(o,s),c=this.slice(r,i),l=t.slice(e,n);for(let t=0;t<a;++t)if(c[t]!==l[t]){o=c[t],s=l[t];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},u.prototype.indexOf=function(t,e,n){return y(this,t,e,n,!0)},u.prototype.lastIndexOf=function(t,e,n){return y(this,t,e,n,!1)},u.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return w(this,t,e,n);case"ascii":case"latin1":case"binary":return x(this,t,e,n);case"base64":return T(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const O=4096;function E(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function C(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function M(t,e,n){const r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=e;r<n;++r)i+=Q[t[r]];return i}function 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 j(t,e,n,r,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function R(t,e,n,r,i){U(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function P(t,e,n,r,i){U(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function D(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(t,e,n,r,o){return e=+e,n>>>=0,o||D(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function F(t,e,n,r,o){return e=+e,n>>>=0,o||D(t,0,n,8),i.write(t,e,n,r,52,8),n+8}u.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);const r=this.subarray(t,e);return Object.setPrototypeOf(r,u.prototype),r},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||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){j(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){j(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=Z(function(t,e=0){return R(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Z(function(t,e=0){return P(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);j(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i<n&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o|0)-s&255;return e+n},u.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);j(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o|0)-s&255;return e+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=Z(function(t,e=0){return R(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Z(function(t,e=0){return P(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeFloatLE=function(t,e,n){return L(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return L(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return F(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return F(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,r){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);const i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},u.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){const e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{const o=u.isBuffer(t)?t:u.from(t,r),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=o[i%s]}return this};const $={};function B(t,e,n){$[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function q(t){let e="",n=t.length;const r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function U(t,e,n,r,i,o){if(t>n||t<e){const r="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new $.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){V(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||G(e,t.length-(n+1))}(r,i,o)}function V(t,e){if("number"!=typeof t)throw new $.ERR_INVALID_ARG_TYPE(e,"number",t)}function G(t,e,n){if(Math.floor(t)!==t)throw V(t,n),new $.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new $.ERR_BUFFER_OUT_OF_BOUNDS;throw new $.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}B("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),B("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),B("ERR_OUT_OF_RANGE",function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=q(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=q(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r},RangeError);const z=/[^+/0-9A-Za-z-_]/g;function W(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s<r;++s){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function J(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,n,r){let i;for(i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function X(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function K(t){return t!=t}const Q=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Z(t){return"undefined"==typeof BigInt?Y:t}function Y(){throw new Error("BigInt not supported")}},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)}}},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)}}},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)},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},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},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},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)}},n={};function r(t){var i=n[t];if(void 0!==i)return i.exports;var o=n[t]={id:t,loaded:!1,exports:{}};return e[t].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var i={};r.r(i),r.d(i,{hasBrowserEnv:()=>tg,hasStandardBrowserEnv:()=>ng,hasStandardBrowserWebWorkerEnv:()=>rg,navigator:()=>eg,origin:()=>ig});const o=(t=>{var e={};return r.d(e,t),e})({useEffect:()=>t.useEffect,useRef:()=>t.useRef,useState:()=>t.useState}),s={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let a;const u=new Uint8Array(16);const c=[];for(let t=0;t<256;++t)c.push((t+256).toString(16).slice(1));function l(t,e=0){return(c[t[e+0]]+c[t[e+1]]+c[t[e+2]]+c[t[e+3]]+"-"+c[t[e+4]]+c[t[e+5]]+"-"+c[t[e+6]]+c[t[e+7]]+"-"+c[t[e+8]]+c[t[e+9]]+"-"+c[t[e+10]]+c[t[e+11]]+c[t[e+12]]+c[t[e+13]]+c[t[e+14]]+c[t[e+15]]).toLowerCase()}const h=function(t,e,n){if(s.randomUUID&&!e&&!t)return s.randomUUID();const r=(t=t||{}).random??t.rng?.()??function(){if(!a){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");a=crypto.getRandomValues.bind(crypto)}return a(u)}();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 l(r)};function d(t){return"function"==typeof t}function p(t){return function(e){if(function(t){return d(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")}}var f=function(t,e){return f=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])},f(t,e)};function m(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}f(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function g(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 y(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 v(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 b(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 w(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 x(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 T(t){return this instanceof T?(this.v=t,this):new T(t)}function k(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 T?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 S(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=b(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 A(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 O=A(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 E(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var C=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=b(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(d(u))try{u()}catch(t){i=t instanceof O?t.errors:[t]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var l=b(c),h=l.next();!h.done;h=l.next()){var p=h.value;try{N(p)}catch(t){i=null!=i?i:[],t instanceof O?i=x(x([],w(i)),w(t.errors)):i.push(t)}}}catch(t){n={error:t}}finally{try{h&&!h.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(i)throw new O(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)N(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)&&E(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&E(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),M=C.EMPTY;function I(t){return t instanceof C||t&&"closed"in t&&d(t.remove)&&d(t.add)&&d(t.unsubscribe)}function N(t){d(t)?t():t.unsubscribe()}var j={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},R={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=R.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,x([t,e],w(n))):setTimeout.apply(void 0,x([t,e],w(n)))},clearTimeout:function(t){var e=R.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function P(t){R.setTimeout(function(){var e=j.onUnhandledError;if(!e)throw t;e(t)})}function D(){}var L=F("C",void 0,void 0);function F(t,e,n){return{kind:t,value:e,error:n}}var $=null;function B(t){if(j.useDeprecatedSynchronousErrorHandling){var e=!$;if(e&&($={errorThrown:!1,error:null}),t(),e){var n=$,r=n.errorThrown,i=n.error;if($=null,r)throw i}}else t()}var q=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,I(e)&&e.add(n)):n.destination=H,n}return m(e,t),e.create=function(t,e,n){return new z(t,e,n)},e.prototype.next=function(t){this.isStopped?J(function(t){return F("N",t,void 0)}(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?J(F("E",void 0,t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?J(L,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}(C),U=Function.prototype.bind;function V(t,e){return U.call(t,e)}var G=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){W(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){W(t)}else W(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){W(t)}},t}(),z=function(t){function e(e,n,r){var i,o,s=t.call(this)||this;d(e)||!e?i={next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&j.useDeprecatedNextContext?((o=Object.create(e)).unsubscribe=function(){return s.unsubscribe()},i={next:e.next&&V(e.next,o),error:e.error&&V(e.error,o),complete:e.complete&&V(e.complete,o)}):i=e;return s.destination=new G(i),s}return m(e,t),e}(q);function W(t){var e;j.useDeprecatedSynchronousErrorHandling?(e=t,j.useDeprecatedSynchronousErrorHandling&&$&&($.errorThrown=!0,$.error=e)):P(t)}function J(t,e){var n=j.onStoppedNotification;n&&R.setTimeout(function(){return n(t,e)})}var H={closed:!0,next:D,error:function(t){throw t},complete:D};function X(t,e,n,r,i){return new K(t,e,n,r,i)}var K=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 m(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}(q);function Q(t,e){return p(function(n,r){var i=0;n.subscribe(X(r,function(n){return t.call(e,n,i++)&&r.next(n)}))})}function Z(t){return Q(function(e,n){return t<=n})}function Y(t,e){return p(function(n,r){var i=0;n.subscribe(X(r,function(n){r.next(t.call(e,n,i++))}))})}const tt="https://gdb.leafgon.com/sgraphql",et="wss://gdb.leafgon.com/sgraphql",nt="https://gdb.leafgon.com/qmgraphql",rt={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:rt.breezyforest.scaffold.directory[e])}catch(t){return null}}},originType:{FRONTEND:1,BACKEND:2,SCREEN:4},subsDirectory:{readmefirst:{},leaflake:{bridges:{gql:"clientconfig_full"}},appintent:{},appmodel:{},appview:{},osview:{},osview2:{},dataflowplane:{},appcache:{}},IOAccessPermission:{Owner:1,Observer:2,Contributor:4,All:7},IOStateGroundZero:{dirOfSubjects:{},subsCache:{},subscriptions:{},callbacks:{},permissions:{}},GQLParameters:{clientconfig_full:{keepGQLConnected:!0,dburi_subs:tt,dburi_subs_ws:et,dburi_qm:nt},clientconfig_sub:{keepGQLConnected:!0,dburi_subs:tt,dburi_subs_ws:et},clientconfig_qm:{dburi_qm:nt},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:Y}}},it=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},ot={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"},st={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"]},at={leaflambdaedge:{sourceHandle:"out_aux",targetHandle:"in_aux"},leafanchoredge:{sourceHandle:"out_anchor",targetHandle:"in_anchor"},leafdataedge:{sourceHandle:"out_a",targetHandle:"in_a"}},ut={leaflambdaedge:{stroke:"#fff",fillOpacity:0},leafanchoredge:{stroke:"#88f",fillOpacity:0},leafdataedge:{stroke:"#fff",fillOpacity:0}},ct=t=>{const e=(0,o.useRef)(h()),n=(0,o.useRef)(t.getValue());(0,o.useEffect)(()=>{const e=t.pipe(Z(1)).subscribe(({control:t,data:e})=>{n.current=e});return()=>e.unsubscribe()});return[()=>n.current,(n,r=rt.OriginType.FRONTEND)=>t.next({control:{provenance:{stateObjInstanceID:e,dataOrigin:r}},data:n})]},lt=t=>{const e=t.split("://");return(e[0].includes("https")?"wss":"ws")+"://"+e[1]},ht=t=>!t||t&&"Object"!==t.constructor.name?t:JSON.parse(JSON.stringify(t)),dt=t=>{const{endpoint:e,websocket:n,headers:r,hook:i}=t,o={endpoint:e,headers:ht(r||{}),websocket:{...n,endpoint:n&&n.endpoint||lt(e),parameters:n&&n.parameters||{},client:null,open:!1,subscriptions:{}}},s=async()=>{try{const t=new WebSocket(o.websocket.endpoint,"graphql-ws");return t.onerror=t=>{},t.onclose=t=>{},t}catch(t){throw new Error("Failed to establish the WebSocket connection: ",t)}},a=t=>{o.websocket.client.send(JSON.stringify(t))},u=t=>{o.websocket.client=t,o.websocket.shouldRetry&&(t.onclose=()=>{s().then(u)}),t.addEventListener("open",()=>{const t={...o.websocket.parameters,headers:{...o.headers,...o.websocket.parameters.headers}};a({type:"connection_init",payload:t})}),t.addEventListener("message",t=>{((t,e)=>{let n,{data:r}=e;try{r=JSON.parse(r)}catch(t){return}switch(r.type){case"connection_ack":return t.onConnectionSuccess&&t.onConnectionSuccess(),void(t.open=!0);case"connection_error":return void(t.onConnectionError&&t.onConnectionError(r));case"ka":return void(t.onConnectionKeepAlive&&t.onConnectionKeepAlive());case"data":return n=t.subscriptions[r.id],void(n&&n.onGraphQLData&&n.onGraphQLData(r.payload));case"error":return n=t.subscriptions[r.id],void(n&&n.onGraphQLError&&n.onGraphQLError(r.payload));case"connection_terminate":return;case"complete":n=t.subscriptions[r.id],n&&n.onGraphQLComplete&&n.onGraphQLComplete(r.payload),delete t.subscriptions[r.id]}})(o.websocket,t)})},c=()=>{s().then(t=>{u(t)}).catch(t=>{})};n&&c();return{query:async(t,e,n)=>{const{query:r,variables:s,headers:a}=t,u={...o.headers,...a||{}};Object.keys(u).some(t=>/content-type/gi.test(t));try{let t;t=await fetch(o.endpoint,{method:"POST",headers:u,credentials:"include",body:r});const s=await t.json();if(i&&i(s),s.errors)throw n&&n(s),s;return e&&e(s),s}catch(t){throw t}},subscribe:(t,e,n)=>{if(!o.websocket.client)return;const{operationId:r,subscription:i,variables:s,onGraphQLData:u,onGraphQLError:c,onGraphQLComplete:l}=t;return o.websocket.subscriptions[r]={onGraphQLData:t=>{u&&u(t),e&&e(t)},onGraphQLComplete:t=>{l&&l(t)},onGraphQLError:t=>{c&&c(t),n&&n(t)}},a({type:"start",id:r,payload:{query:i,variables:s||{}}}),{stop:()=>{a({type:"stop",id:r})}}},updateHeaders:t=>{o.headers=ht(t),o.websocket.client&&s().then(u).catch(t=>{})},establishWS:c,clientContext:o}};var pt=r(2543),ft=r.n(pt);const{memoize:mt}=ft(),gt=({_domain:t,_appid:e,filter:n={},query:r}={})=>`\n subscription {\n graph: getGraph(domain: "${t}", appid: "${e}", filter: ${n}) ${r}\n }\n`,_t=({_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`,yt={dburi_subs:"https://gdb.leafgon.com/sgraphql",dburi_subs_ws:"wss://gdb.leafgon.com/sgraphql",dburi_qm:"https://gdb.leafgon.com/qmgraphql"},vt=({_clientConfig:t=yt,_metamodel:e=rt.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&&dt({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?dt({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:gt({_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=mt(({_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:_t({_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},bt=t=>{const e=(0,o.useRef)(h()),n=(0,o.useRef)(t.getValue());(0,o.useEffect)(()=>{const r=t.pipe(Z(1)).subscribe(({control:t,data:r})=>{n.current=r,t.provenance.stateObjInstanceID!==e&&(t.provenance.dataOrigin,rt.OriginType.BACKEND)});vt("make this assignable via api");return()=>r.unsubscribe()});const r=(n,r=rt.OriginType.FRONTEND)=>t.next({control:{provenance:{stateObjInstanceID:e,dataOrigin:r}},data:n});return[()=>n.current,r]},wt=(t,e)=>(t&&e(t),t),xt=t=>{const[e,n]=ct(t.getValue().model),[r,i]=ct(t.getValue().view),[s,a]=ct(t.getValue().intent);(0,o.useEffect)(()=>{const e=t.pipe(Z(1)).subscribe(t=>{wt(t.intent,a),wt(t.model,n),wt(t.view,i)});return()=>e.unsubscribe()});return[e,r,s,e=>t.next(e)]};var Tt="function"==typeof Symbol&&Symbol.observable||"@@observable";function kt(t){return t}function St(t){return 0===t.length?kt:1===t.length?t[0]:function(e){return t.reduce(function(t,e){return e(t)},e)}}var At=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 q||function(t){return t&&d(t.next)&&d(t.error)&&d(t.complete)}(r)&&I(r)?t:new z(t,e,n);return B(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=Ot(e))(function(e,r){var i=new z({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[Tt]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return St(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=Ot(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 Ot(t){var e;return null!==(e=null!=t?t:j.Promise)&&void 0!==e?e:Promise}var Et=A(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Ct=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 m(e,t),e.prototype.lift=function(t){var e=new Mt(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new Et},e.prototype.next=function(t){var e=this;B(function(){var n,r;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=b(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;B(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;B(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?M:(this.currentObservers=null,o.push(t),new C(function(){e.currentObservers=null,E(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 At;return t.source=this,t},e.create=function(t,e){return new Mt(t,e)},e}(At),Mt=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return m(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:M},e}(Ct),It=function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}return m(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}(Ct);const Nt=({_LEAFappList:t=[],stateObjInstanceID:e=h(),dirOfSubjects:n={},permissions:r={},metamodel:i=rt}={})=>{const[s,a]=(0,o.useState)(h()),u=(0,o.useRef)(JSON.parse(JSON.stringify(i.breezyforest.IOStateGroundZero)));(0,o.useEffect)(()=>(u.current.dirOfSubjects=(()=>{let t={};return Object.entries(i.breezyforest.subsDirectory).forEach(([e,o])=>{e in n?(t[e]=n[e],u.current.permissions[e]=e in r?r[e]:i.breezyforest.IOAccessPermission.Observer):(t[e]={main:Rt(),bridges:{}},u.current.permissions[e]=e in r?r[e]:i.breezyforest.IOAccessPermission.All),u.current.subscriptions[e]=t[e].main.doSubscribe(({control:t,data:n})=>{u.current.subsCache[e]={control:t,data:n},((t,e,n)=>{t in u.current.callbacks&&Object.entries(u.current.callbacks[t]).map(([t,r])=>{r({control:e,data:n})})})(e,t,n)})}),t})(),()=>Object.entries(u.current.subscriptions).forEach(([t,e])=>{u.current.dirOfSubjects[t].main.doUnsubscribe(e)})),[n,i]);return{getCurLEAFIOState:()=>u.current.subsCache,getMasterSubsDir:()=>u.current.dirOfSubjects,setNewLEAFIOState:(t,n,r=rt.breezyforest.originType.FRONTEND)=>{try{if(u.current.permissions[t]&i.breezyforest.IOAccessPermission.Contributor)return u.current.dirOfSubjects[t].main.doWrite({control:{provenance:{stateObjInstanceID:e,dataOrigin:r}},data:n}),!0;return u.current.permissions[t]&i.breezyforest.IOAccessPermission.Contributor}catch(t){return-1}},setLEAFIOCallback:(t,e,n=null)=>{t in u.current.subscriptions&&(null===n&&e in delete u.current.callbacks[t]?(u.current.callbacks={...u.current.callbacks,[t]:{...u.current.callbacks[t]}},delete u.current.callbacks[t][e]):n&&(u.current.callbacks={...u.current.callbacks,[t]:{...u.current.callbacks[t],[e]:n}}))}}},jt=({_LEAFappList:t=[],stateObjInstanceID:e=h(),dirOfSubjects:n={},permissions:r={},metamodel:i=rt}={})=>{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:Rt(),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=rt.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)})}}},Rt=()=>{const t={handle$:new It,doWrite:e=>t.handle$.next(e),doSubscribe:e=>t.handle$.pipe(Z(1)).subscribe(e),doUnsubscribe:t=>t.unsubscribe(),doAddAddressee:(t,e)=>{}};return t},Pt=(t,e=[],n=rt)=>{let r={};return Object.entries(n.breezyforest.subsDirectory).forEach(([t,e])=>{r[t]={main:Rt(),bridges:{}}}),[t,r]},Dt=t=>"object"==typeof t&&!Array.isArray(t)&&null!==t&&"_bname"in t,Lt=t=>"object"==typeof t&&!Array.isArray(t)&&null!==t&&"_crate"in t,Ft=t=>Dt(t)&&("empty_bottle"===t._bname&&"empty_data"===t._content||void 0===t._content),$t=t=>/^\d+$/.test(t),Bt=(t,e,n={})=>({_bname:t,_content:e,_label:n}),qt=(t,e,n={})=>Dt(e)&&(void 0===t||(t.includes(e._bname)||"*"===t))?e._content:void 0,Ut=Bt("empty_bottle","empty_data");var Vt=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function Gt(t){return d(null==t?void 0:t.then)}function zt(t){return d(t[Tt])}function Wt(t){return Symbol.asyncIterator&&d(null==t?void 0:t[Symbol.asyncIterator])}function Jt(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 Ht="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Xt(t){return d(null==t?void 0:t[Ht])}function Kt(t){return k(this,arguments,function(){var e,n,r;return v(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,T(e.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,T(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,T(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 Qt(t){return d(null==t?void 0:t.getReader)}function Zt(t){if(t instanceof At)return t;if(null!=t){if(zt(t))return i=t,new At(function(t){var e=i[Tt]();if(d(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(Vt(t))return r=t,new At(function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()});if(Gt(t))return n=t,new At(function(t){n.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,P)});if(Wt(t))return Yt(t);if(Xt(t))return e=t,new At(function(t){var n,r;try{for(var i=b(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(Qt(t))return Yt(Kt(t))}var e,n,r,i;throw Jt(t)}function Yt(t){return new At(function(e){(function(t,e){var n,r,i,o;return y(this,void 0,void 0,function(){var s,a;return v(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),n=S(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 te(t){return t&&d(t.schedule)}function ee(t){return t[t.length-1]}function ne(t){return d(ee(t))?t.pop():void 0}function re(t){return te(ee(t))?t.pop():void 0}function ie(t,e){return"number"==typeof ee(t)?t.pop():e}function oe(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=ne(t);return p(function(e,r){for(var i=t.length,o=new Array(i),s=t.map(function(){return!1}),a=!1,u=function(e){Zt(t[e]).subscribe(X(r,function(t){o[e]=t,a||s[e]||(s[e]=!0,(a=s.every(kt))&&(s=null))},D))},c=0;c<i;c++)u(c);e.subscribe(X(r,function(t){if(a){var e=x([t],w(o));r.next(n?n.apply(void 0,x([],w(e))):e)}}))})}function se(t){void 0===t&&(t={});var e=t.connector,n=void 0===e?function(){return new Ct}: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},f=function(){var t=e;d(),null==t||t.unsubscribe()};return p(function(t,p){a++,l||c||h();var m=o=null!=o?o:n();p.add(function(){0!==--a||l||c||(r=ae(f,u))}),m.subscribe(p),!e&&a>0&&(e=new z({next:function(t){return m.next(t)},error:function(t){l=!0,h(),r=ae(d,i,t),m.error(t)},complete:function(){c=!0,h(),r=ae(d,s),m.complete()}}),Zt(t).subscribe(e))})(t)}}function ae(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 z({next:function(){i.unsubscribe(),t()}});return Zt(e.apply(void 0,x([],w(n)))).subscribe(i)}}else t()}function ue(t,e){return p(function(n,r){var i=null,o=0,s=!1,a=function(){return s&&!i&&r.complete()};n.subscribe(X(r,function(n){null==i||i.unsubscribe();var s=0,u=o++;Zt(t(n,u)).subscribe(i=X(r,function(t){return r.next(e?e(n,t,u,s++):t)},function(){i=null,a()}))},function(){s=!0,a()}))})}function ce(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 le(t,e,n){return void 0===n&&(n=1/0),d(e)?le(function(n,r){return Y(function(t,i){return e(n,t,r,i)})(Zt(t(n,r)))},n):("number"==typeof e&&(n=e),p(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;Zt(n(t,l++)).subscribe(X(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?ce(e,s,function(){return f(t)}):f(t)};u.length&&c<r;)t();d()}catch(t){e.error(t)}}))};return t.subscribe(X(e,p,function(){h=!0,d()})),function(){null==a||a()}}(e,r,t,n)}))}function he(t){return void 0===t&&(t=1/0),le(kt,t)}var de=new At(function(t){return t.complete()});function pe(t,e){return void 0===e&&(e=0),p(function(n,r){n.subscribe(X(r,function(n){return ce(r,t,function(){return r.next(n)},e)},function(){return ce(r,t,function(){return r.complete()},e)},function(n){return ce(r,t,function(){return r.error(n)},e)}))})}function fe(t,e){return void 0===e&&(e=0),p(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function me(t,e){if(!t)throw new Error("Iterable cannot be null");return new At(function(n){ce(n,e,function(){var r=t[Symbol.asyncIterator]();ce(n,e,function(){r.next().then(function(t){t.done?n.complete():n.next(t.value)})},0,!0)})})}function ge(t,e){if(null!=t){if(zt(t))return function(t,e){return Zt(t).pipe(fe(e),pe(e))}(t,e);if(Vt(t))return function(t,e){return new At(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(Gt(t))return function(t,e){return Zt(t).pipe(fe(e),pe(e))}(t,e);if(Wt(t))return me(t,e);if(Xt(t))return function(t,e){return new At(function(n){var r;return ce(n,e,function(){r=t[Ht](),ce(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 d(null==r?void 0:r.return)&&r.return()}})}(t,e);if(Qt(t))return function(t,e){return me(Kt(t),e)}(t,e)}throw Jt(t)}function _e(t,e){return e?ge(t,e):Zt(t)}function ye(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=re(t),r=ie(t,1/0),i=t;return i.length?1===i.length?Zt(i[0]):he(r)(_e(i,n)):de}function ve(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return _e(t,re(t))}function be(t,e){return d(e)?le(t,e,1):le(t,1)}var we=Array.isArray,xe=Object.getPrototypeOf,Te=Object.prototype,ke=Object.keys;function Se(t){if(1===t.length){var e=t[0];if(we(e))return{args:e,keys:null};if((r=e)&&"object"==typeof r&&xe(r)===Te){var n=ke(e);return{args:n.map(function(t){return e[t]}),keys:n}}}var r;return{args:t,keys:null}}var Ae=Array.isArray;function Oe(t){return Y(function(e){return function(t,e){return Ae(e)?t.apply(void 0,x([],w(e))):t(e)}(t,e)})}function Ee(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=re(t),r=ne(t),i=Se(t),o=i.args,s=i.keys;if(0===o.length)return _e([],n);var a=new At(Ce(o,n,s?function(t){return function(t,e){return t.reduce(function(t,n,r){return t[n]=e[r],t},{})}(s,t)}:kt));return r?a.pipe(Oe(r)):a}function Ce(t,e,n){return void 0===n&&(n=kt),function(r){Me(e,function(){for(var i=t.length,o=new Array(i),s=i,a=i,u=function(i){Me(e,function(){var u=_e(t[i],e),c=!1;u.subscribe(X(r,function(t){o[i]=t,c||(c=!0,a--),a||r.next(n(o.slice()))},function(){--s||r.complete()}))},r)},c=0;c<i;c++)u(c)},r)}}function Me(t,e,n){t?ce(n,t,e):e()}var Ie=function(t){function e(e,n){return t.call(this)||this}return m(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(C),Ne={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=Ne.delegate;return(null==i?void 0:i.setInterval)?i.setInterval.apply(i,x([t,e],w(n))):setInterval.apply(void 0,x([t,e],w(n)))},clearInterval:function(t){var e=Ne.delegate;return((null==e?void 0:e.clearInterval)||clearInterval)(t)},delegate:void 0},je=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 m(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),Ne.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&&Ne.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,E(r,this),null!=e&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(Ie),Re={now:function(){return(Re.delegate||Date).now()},delegate:void 0},Pe=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=Re.now,t}(),De=new(function(t){function e(e,n){void 0===n&&(n=Pe.now);var r=t.call(this,e,n)||this;return r.actions=[],r._active=!1,r}return m(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}(Pe))(je),Le=De;function Fe(t){for(var e,n,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var o=null!==(e=re(r))&&void 0!==e?e:De,s=null!==(n=r[0])&&void 0!==n?n:null,a=r[1]||1/0;return p(function(e,n){var r=[],i=!1,u=function(t){var e=t.buffer;t.subs.unsubscribe(),E(r,t),n.next(e),i&&c()},c=function(){if(r){var e=new C;n.add(e);var i={buffer:[],subs:e};r.push(i),ce(e,o,function(){return u(i)},t)}};null!==s&&s>=0?ce(n,o,c,s,!0):i=!0,c();var l=X(n,function(t){var e,n,i=r.slice();try{for(var o=b(i),s=o.next();!s.done;s=o.next()){var c=s.value,l=c.buffer;l.push(t),a<=l.length&&u(c)}}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==l||l.unsubscribe(),n.complete(),n.unsubscribe()},void 0,function(){return r=null});e.subscribe(l)})}function $e(){return he(1)}const Be=200,qe=t=>Array.isArray(t)?t.flatMap(t=>t):t,Ue=(t,e,n=!1,r=!1,i=!1,o={})=>{const s=e.filter(t=>t);if(s.length>1){const o={_stream:ve("ctrl_nudge").pipe(be(r=>Ee(e.map(t=>t._stream)).pipe(Y(e=>{t?.slice(0,4);const r=i?Je({_bus:e,_flatten:n}):e,o=!i&&n&&Array.isArray(r)?r.filter(t=>t).flat():r;return o}))))};return r&&(o._control={_stream:ve("ctrl_nudge").pipe(be(t=>Ee(e.map(t=>t?._control?._stream).filter(t=>t)).pipe(Y(t=>Array.isArray(t)?t.flat():t))))}),o}return s.length>0?{...s[0],_stream:s[0]._stream.pipe(Y(e=>(t?.slice(0,4),e)))}:void 0},Ve=(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(Dt(t))return{...t,_content:i(t._content,e)};if(Lt(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},o=ze(r)._stream.pipe(Fe(Be,100,100),Y(t=>t),Y(t=>qe(t)),oe(...n.map(t=>t._stream.pipe(Fe(Be,100,100),Y(t=>qe(t))))),Y(t=>t)),s={_stream:o.pipe(Y(t=>{const e=qe(t[0]),n=qe(t.slice(1)).filter(t=>!Array.isArray(t)&&"object"==typeof t),r=Object.assign({},...n);return i(e,r)}))};return s},Ge=t=>{const e=t.filter(t=>t);if(e.length>1){const t=e.map(t=>t._stream).pipe($e());return{_stream:t}}if(e.length>0)return e[0]},ze=(Bt("error",{type:"critical",message:"LEAF core error: race condition detected in leafdataflow.js",codebase:"/src/ghostos/api/utils/leafdataflow.js"},{}),t=>{const e=t.filter(t=>t);if(e.length>1){const t=ye(...e.map(t=>t._stream.pipe(Y(t=>t))));return{_stream:t}}if(e.length>0)return e[0]});const We=(t,e=t=>!0)=>Dt(t)&&"_databus"===t._bname&&e(t)?t._content:t,Je=({_bus:t,_cond:e=t=>!0,_flatten:n=!1}={})=>n?Array.isArray(t)?t.map(t=>We(t,e)).flat().filter(t=>t):We(t,e):Array.isArray(t)?t.map(t=>We(t,e)).filter(t=>t):We(t,e);Array.isArray;function He(t){return p(function(e,n){Zt(t).subscribe(X(n,function(){return n.complete()},D)),!n.closed&&e.subscribe(n)})}var Xe=r(7007);let Ke=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 Qe(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 Ze(t){return"object"==typeof t&&null!==t}function Ye(t){let e;for(e in t)return!1;return!0}function tn(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function en(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 nn(t){return!!Ze(t)&&!(t.attributes&&!Array.isArray(t.attributes))}function rn(){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 on(){return{[Symbol.iterator](){return this},next:()=>({done:!0})}}"function"==typeof Object.assign&&(Ke=Object.assign);class sn extends Error{constructor(t){super(),this.name="GraphError",this.message=t}}class an extends sn{constructor(t){super(t),this.name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,an.prototype.constructor)}}class un extends sn{constructor(t){super(t),this.name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,un.prototype.constructor)}}class cn extends sn{constructor(t){super(t),this.name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,cn.prototype.constructor)}}function ln(t,e){this.key=t,this.attributes=e,this.clear()}function hn(t,e){this.key=t,this.attributes=e,this.clear()}function dn(t,e){this.key=t,this.attributes=e,this.clear()}function pn(t,e,n,r,i){this.key=e,this.attributes=i,this.undirected=t,this.source=n,this.target=r}ln.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},hn.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},dn.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},pn.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)},pn.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},pn.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]},pn.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 fn(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 un(`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 un(`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 un(`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 un(`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 mn=[{name:t=>`get${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=fn(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]=fn(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]=fn(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]=fn(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]=fn(this,e,n,t,r,i,o);if("function"!=typeof u)throw new an(`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]=fn(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]=fn(this,e,n,t,r,i);if(!Ze(s))throw new an(`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]=fn(this,e,n,t,r,i);if(!Ze(s))throw new an(`Graph.${e}: provided attributes are not a plain object.`);return Ke(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]=fn(this,e,n,t,r,i);if("function"!=typeof s)throw new an(`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 gn=[{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 cn(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new cn(`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=Qe(this,o,s,n),!i)throw new un(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new cn(`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 un(`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 cn(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new cn(`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=Qe(this,i,o,n),!r)throw new un(`Graph.${e}: could not find an edge for the given path ("${i}" - "${o}").`)}else{if("mixed"!==n)throw new cn(`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 un(`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 cn(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new cn(`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=Qe(this,o,s,n),!i)throw new un(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new cn(`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 un(`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 cn(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new cn(`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=Qe(this,s,a,n),!o)throw new un(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if("mixed"!==n)throw new cn(`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 un(`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 cn(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new cn(`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=Qe(this,s,a,n),!o)throw new un(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if("mixed"!==n)throw new cn(`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 un(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if("function"!=typeof i)throw new an(`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 cn(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new cn(`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=Qe(this,o,s,n),!i)throw new un(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new cn(`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 un(`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 cn(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new cn(`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=Qe(this,o,s,n),!i)throw new un(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new cn(`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 un(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if(!Ze(r))throw new an(`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 cn(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new cn(`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=Qe(this,o,s,n),!i)throw new un(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new cn(`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 un(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if(!Ze(r))throw new an(`Graph.${e}: provided attributes are not a plain object.`);return Ke(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 cn(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new cn(`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=Qe(this,o,s,n),!i)throw new un(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new cn(`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 un(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if("function"!=typeof r)throw new an(`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 _n=[{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 yn(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 vn(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 bn(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 wn(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 xn(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 Tn(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 kn(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 Sn(t,e,n,r,i,o){const s=e?vn:yn;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 An(t,e,n,r,i,o,s){const a=n?xn:wn;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 On(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 un(`Graph.${n}: could not find the "${t}" node in the graph.`);return function(t,e,n,r){const i=[];return Sn(!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 un(`Graph.${n}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new un(`Graph.${n}: could not find the "${e}" target node in the graph.`);return function(t,e,n,r,i){const o=[];return An(!1,t,e,n,r,i,function(t){o.push(t)}),o}(r,this.multi,i,o,e)}throw new an(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function En(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 on();if(!arguments.length)return function(t,e){if(0===t.size)return on();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 un(`Graph.${o}: could not find the "${t}" node in the graph.`);return function(t,e,n){let r=on();return"undirected"!==t&&("out"!==e&&void 0!==n.in&&(r=rn(r,bn(n.in))),"in"!==e&&void 0!==n.out&&(r=rn(r,bn(n.out,e?void 0:n.key)))),"directed"!==t&&void 0!==n.undirected&&(r=rn(r,bn(n.undirected))),r}(r,i,e)}if(2===arguments.length){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new un(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new un(`Graph.${o}: could not find the "${e}" target node in the graph.`);return function(t,e,n,r){let i=on();return"undirected"!==t&&(void 0!==n.in&&"out"!==e&&r in n.in&&(i=rn(i,Tn(n.in,r))),void 0!==n.out&&"in"!==e&&r in n.out&&(e||n.key!==r)&&(i=rn(i,Tn(n.out,r)))),"directed"!==t&&void 0!==n.undirected&&r in n.undirected&&(i=rn(i,Tn(n.undirected,r))),i}(r,i,n,e)}throw new an(`Graph.${o}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}const Cn=[{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 Mn(){this.A=null,this.B=null}function In(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 Nn(t,e,n,r,i){if("mixed"!==e){if("undirected"===e)return In(t,null,r,r.undirected,i);if("string"==typeof n)return In(t,null,r,r[n],i)}const o=new Mn;let s;if("undirected"!==e){if("out"!==n){if(s=In(t,null,r,r.in,i),t&&s)return s;o.wrap(r.in)}if("in"!==n){if(s=In(t,o,r,r.out,i),t&&s)return s;o.wrap(r.out)}}if("directed"!==e&&(s=In(t,o,r,r.undirected,i),t&&s))return s}function jn(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 Rn(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 un(`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 Nn(!1,t,e,n,function(t){r.push(t)}),r}("mixed"===r?this.type:r,i,e)}}function Pn(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 on();t=""+t;const e=this._nodes.get(t);if(void 0===e)throw new un(`Graph.${o}: could not find the "${t}" node in the graph.`);return function(t,e,n){if("mixed"!==t){if("undirected"===t)return jn(null,n,n.undirected);if("string"==typeof e)return jn(null,n,n[e])}let r=on();const i=new Mn;return"undirected"!==t&&("out"!==e&&(r=rn(r,jn(i,n,n.in))),"in"!==e&&(r=rn(r,jn(i,n,n.out)))),"directed"!==t&&(r=rn(r,jn(i,n,n.undirected))),r}("mixed"===r?this.type:r,i,e)}}function Dn(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 Ln(t){if(!Ze(t))throw new an('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 an("Graph.import: serialized node is missing its key.");if("attributes"in t&&(!Ze(t.attributes)||null===t.attributes))throw new an("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function Fn(t){if(!Ze(t))throw new an('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 an("Graph.import: serialized edge is missing its source.");if(!("target"in t))throw new an("Graph.import: serialized edge is missing its target.");if("attributes"in t&&(!Ze(t.attributes)||null===t.attributes))throw new an("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in t&&"boolean"!=typeof t.undirected)throw new an("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}Mn.prototype.wrap=function(t){null===this.A?this.A=t:null===this.B&&(this.B=t)},Mn.prototype.has=function(t){return null!==this.A&&t in this.A||null!==this.B&&t in this.B};const $n=function(){let t=255&Math.floor(256*Math.random());return()=>t++}(),Bn=new Set(["directed","undirected","mixed"]),qn=new Set(["domain","_events","_eventsCount","_maxListeners"]),Un={allowSelfLoops:!0,multi:!1,type:"mixed"};function Vn(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 Gn(t,e,n,r,i,o,s,a){if(!r&&"undirected"===t.type)throw new cn(`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 cn(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(a&&!Ze(a))throw new an(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`);if(o=""+o,s=""+s,a=a||{},!t.allowSelfLoops&&o===s)throw new cn(`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 un(`Graph.${e}: source node "${o}" not found.`);if(!c)throw new un(`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 cn(`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 cn(`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 pn(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 zn(t,e,n,r,i,o,s,a,u){if(!r&&"undirected"===t.type)throw new cn(`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 cn(`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 an(`Graph.${e}: invalid updater function. Expecting a function but got "${a}"`)}else if(!Ze(a))throw new an(`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 cn(`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 cn(`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 Ke(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 cn(`Graph.${e}: the "${i}" edge already exists in the graph.`);let m=!1,g=!1;d||(d=Vn(t,o,{}),m=!0,o===s&&(p=d,g=!0)),p||(p=Vn(t,s,{}),g=!0),l=new pn(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 Wn(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 Jn extends Xe.EventEmitter{constructor(t){if(super(),"boolean"!=typeof(t=Ke({},Un,t)).multi)throw new an(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${t.multi}".`);if(!Bn.has(t.type))throw new an(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${t.type}".`);if("boolean"!=typeof t.allowSelfLoops)throw new an(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${t.allowSelfLoops}".`);tn(this,"NodeDataClass","mixed"===t.type?ln:"directed"===t.type?hn:dn);const e="geid_"+$n()+"_";let n=0;tn(this,"_attributes",{}),tn(this,"_nodes",new Map),tn(this,"_edges",new Map),tn(this,"_directedSize",0),tn(this,"_undirectedSize",0),tn(this,"_directedSelfLoopCount",0),tn(this,"_undirectedSelfLoopCount",0),tn(this,"_edgeKeyGenerator",()=>{let t;do{t=e+n++}while(this._edges.has(t));return t}),tn(this,"_options",t),qn.forEach(t=>tn(this,t,this[t])),en(this,"order",()=>this._nodes.size),en(this,"size",()=>this._edges.size),en(this,"directedSize",()=>this._directedSize),en(this,"undirectedSize",()=>this._undirectedSize),en(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),en(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),en(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),en(this,"multi",this._options.multi),en(this,"type",this._options.type),en(this,"allowSelfLoops",this._options.allowSelfLoops),en(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 an(`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 an(`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 an(`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 cn("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 un(`Graph.directedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new un(`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 cn("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 un(`Graph.undirectedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new un(`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 cn("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 un(`Graph.edge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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 un(`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&&!Ze(n))throw new an(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(e=""+e,n=n||{},t._nodes.has(e))throw new cn(`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&&!Ze(e))throw new an(`Graph.mergeNode: invalid attributes. Expecting an object but got "${e}"`);t=""+t,e=e||{};let n=this._nodes.get(t);return n?(e&&(Ke(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 an(`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 un(`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{Wn(this,n),n=n.next}while(n)}for(const t in e.in){n=e.in[t];do{Wn(this,n),n=n.next}while(n)}}if("directed"!==this.type)for(const t in e.undirected){n=e.undirected[t];do{Wn(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=Qe(this,t,n,this.type),!e)throw new un(`Graph.dropEdge: could not find the "${t}" -> "${n}" edge in the graph.`)}else if(t=""+t,e=this._edges.get(t),!e)throw new un(`Graph.dropEdge: could not find the "${t}" edge in the graph.`);return Wn(this,e),this}dropDirectedEdge(t,e){if(arguments.length<2)throw new cn("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 cn("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=Qe(this,t=""+t,e=""+e,"directed");if(!n)throw new un(`Graph.dropDirectedEdge: could not find a "${t}" -> "${e}" edge in the graph.`);return Wn(this,n),this}dropUndirectedEdge(t,e){if(arguments.length<2)throw new cn("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 cn("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=Qe(this,t,e,"undirected");if(!n)throw new un(`Graph.dropUndirectedEdge: could not find a "${t}" -> "${e}" edge in the graph.`);return Wn(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 an("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(!Ze(t))throw new an("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(!Ze(t))throw new an("Graph.mergeAttributes: provided attributes are not a plain object.");return Ke(this._attributes,t),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:t}),this}updateAttributes(t){if("function"!=typeof t)throw new an("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 an("Graph.updateEachNodeAttributes: expecting an updater function.");if(e&&!nn(e))throw new an("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 an("Graph.updateEachEdgeAttributes: expecting an updater function.");if(e&&!nn(e))throw new an("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 an("Graph.forEachAdjacencyEntry: expecting a callback.");Dn(!1,!1,!1,this,t)}forEachAdjacencyEntryWithOrphans(t){if("function"!=typeof t)throw new an("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");Dn(!1,!1,!0,this,t)}forEachAssymetricAdjacencyEntry(t){if("function"!=typeof t)throw new an("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");Dn(!1,!0,!1,this,t)}forEachAssymetricAdjacencyEntryWithOrphans(t){if("function"!=typeof t)throw new an("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");Dn(!1,!0,!0,this,t)}nodes(){return Array.from(this._nodes.keys())}forEachNode(t){if("function"!=typeof t)throw new an("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 an("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 an("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 an("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 an("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 an("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 an("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new an("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 Ye(e.attributes)||(n.attributes=Ke({},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 Ye(n.attributes)||(r.attributes=Ke({},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 Jn)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(!Ze(t))throw new an("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!Ze(t.attributes))throw new an("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 an("Graph.import: invalid nodes. Expecting an array.");for(n=0,r=i.length;n<r;n++){o=i[n],Ln(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 an("Graph.import: invalid edges. Expecting an array.");for(n=0,r=i.length;n<r;n++){s=i[n],Fn(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 Jn(Ke({},this._options,t));return e.replaceAttributes(Ke({},this.getAttributes())),e}emptyCopy(t){const e=this.nullCopy(t);return this._nodes.forEach((t,n)=>{const r=Ke({},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 cn(`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 cn("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 cn("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,Gn(e,"copy",!1,i.undirected,i.key,i.source.key,i.target.key,Ke({},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)&&!qn.has(t)&&"function"!=typeof this[t]&&"symbol"!=typeof t&&(r[t]=this[t]);return r.attributes=this._attributes,r.nodes=t,r.edges=e,tn(r,"constructor",this.constructor),r}}"undefined"!=typeof Symbol&&(Jn.prototype[Symbol.for("nodejs.util.inspect.custom")]=Jn.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?Gn:zn;t.generateKey?Jn.prototype[n]=function(i,o,s){return r(this,n,!0,"undirected"===(t.type||this.type),null,i,o,s,"update"===e)}:Jn.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){mn.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)})}(Jn),function(t){gn.forEach(function({name:e,attacher:n}){n(t,e("Edge"),"mixed"),n(t,e("DirectedEdge"),"directed"),n(t,e("UndirectedEdge"),"undirected")})}(Jn),function(t){_n.forEach(e=>{On(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 kn(!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 un(`Graph.${o}: could not find the "${t}" node in the graph.`);return Sn(!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 un(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new un(`Graph.${o}: could not find the "${e}" target node in the graph.`);return An(!1,r,this.multi,i,s,e,n)}throw new an(`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 an(`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 an(`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 kn(!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 un(`Graph.${o}: could not find the "${t}" node in the graph.`);return Sn(!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 un(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new un(`Graph.${o}: could not find the "${e}" target node in the graph.`);return An(!0,r,this.multi,i,s,e,n)}throw new an(`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),En(t,e)})}(Jn),function(t){Cn.forEach(e=>{Rn(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 un(`Graph.${o}: could not find the "${t}" node in the graph.`);Nn(!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 an(`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 un(`Graph.${s}: could not find the "${t}" node in the graph.`);return Nn(!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),Pn(t,e)})}(Jn);class Hn extends Jn{constructor(t){const e=Ke({type:"directed"},t);if("multi"in e&&!1!==e.multi)throw new an("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==e.type)throw new an('DirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class Xn extends Jn{constructor(t){const e=Ke({type:"undirected"},t);if("multi"in e&&!1!==e.multi)throw new an("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==e.type)throw new an('UndirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class Kn extends Jn{constructor(t){const e=Ke({multi:!0},t);if("multi"in e&&!0!==e.multi)throw new an("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(e)}}class Qn extends Jn{constructor(t){const e=Ke({type:"directed",multi:!0},t);if("multi"in e&&!0!==e.multi)throw new an("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==e.type)throw new an('MultiDirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class Zn extends Jn{constructor(t){const e=Ke({type:"undirected",multi:!0},t);if("multi"in e&&!0!==e.multi)throw new an("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==e.type)throw new an('MultiUndirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}function Yn(t){t.from=function(e,n){const r=Ke({},e.options,n),i=new t(r);return i.import(e),i}}Yn(Jn),Yn(Hn),Yn(Xn),Yn(Kn),Yn(Qn),Yn(Zn),Jn.Graph=Jn,Jn.DirectedGraph=Hn,Jn.UndirectedGraph=Xn,Jn.MultiGraph=Kn,Jn.MultiDirectedGraph=Qn,Jn.MultiUndirectedGraph=Zn,Jn.InvalidArgumentsGraphError=an,Jn.NotFoundGraphError=un,Jn.UsageGraphError=cn;class tr{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]}}var er=r(8287),nr=A(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function rr(t,e){var n="object"==typeof e;return new Promise(function(r,i){var o=new z({next:function(t){r(t),o.unsubscribe()},error:i,complete:function(){n?r(e.defaultValue):i(new nr)}});t.subscribe(o)})}const ir={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 F_({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{...ze(t),_control:e}}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await F_({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s}};function or(t){return p(function(e,n){try{e.subscribe(n)}finally{n.add(t)}})}function sr(t,e,n){void 0===t&&(t=0),void 0===n&&(n=Le);var r=-1;return null!=e&&(te(e)?n=e:r=e),new At(function(e){var i,o=(i=t)instanceof Date&&!isNaN(i)?+t-n.now():t;o<0&&(o=0);var s=0;return n.schedule(function(){e.closed||(e.next(s++),0<=r?this.schedule(void 0,r):e.complete())},o)})}function ar(t){return t<=0?function(){return de}:p(function(e,n){var r=0;e.subscribe(X(n,function(e){++r<=t&&(n.next(e),t<=r&&n.complete())}))})}const ur=t=>Object.keys(t).map(e=>0===Object.keys(t[e]).length?e:void 0).filter(t=>t).sort(),cr={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 F_({refnode:e,nodelambda:r,contextuallambda:a,etaTree:t.gos.etaTree});const c=ur(u);let l;c.length>0&&(a=a.concat(c),u=await F_({refnode:e,nodelambda:r,contextuallambda:a,etaTree:t.gos.etaTree})),["b490aada-daab-4322-9001-14aea8bcb3d3","97fa68cf-bcc5-44cf-8311-ffa6a1422ac3","abb18b4d-b8af-4349-949d-fae21bc142ef","e9536f42-df6d-4086-a643-5f3c0b02aac9","b5a20ce3-3e67-42cd-9f60-3f70c6acd269","59fe3646-b338-4ab0-a8a6-d6ad401be4fa"].includes(e);const h=async({refnode:t,spellbook:e,spellname:n,lambdalut:r,contextuallambda:i,etaTree:o}={})=>{if(n in e){const s=e[n];s in r&&r[s],"accio"===n&&t.slice(0,4);const a=await o.etaReduceLEAFNode({nodeuuid:s,contextuallambda:i});return"accio"===n&&t.slice(0,4),a}};const d={codebase:"leafspell.js",refnode:e,leafnode:t.gos.etaTree?.leafgraph?.graph.dataflow.getNodeAttributes(e).leafnode.data};let p=s?void 0:Ts((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=Ss({...r,_stream:n.pipe(Y(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(oe(c._stream),Y(t=>(t[0].sid?.pop(),t)),or(()=>{}))},c=Ss(r,n,void 0,{...d,metastep:"executing spell "+o},{leaflogic:s?(e,n)=>{const r=new Ct,i=new Ct,o=new Ct,s=new Ct,a=new Ct;let c;const l=e.length>1?merge(...e.map(t=>t._stream)):e[0]._stream,h=n._stream.pipe(oe(l),ue(e=>{e[0];const n=e[1];if(Dt(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}),oe(s),Y(t=>(r.next(t[1][1]),a.next(t[1][0]),t[1])),oe(a),Y(t=>t[1]),or(()=>{void 0!==c&&(c.unsubscribe(),c=void 0)}),se());return{_stream:r,_control:{...n,_stream:h}}}:(t,e)=>{const n=new Ct,r=new Ct,i=new Ct,o=new Ct,s=new Ct;let a;const c=e._stream.pipe(oe(...t.map(t=>t._stream)),ue(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)),oe(o),Y(t=>(n.next(t[1][1]),s.next(t[1][0]),t[1])),oe(s),Y(t=>t[1]),or(()=>{void 0!==a&&(a.unsubscribe(),a=void 0)}),se());return{_stream:n,_control:{...e,_stream:c}}},datalogic:{pre:i,post:a}});return{_stream:c._stream.pipe(Y(t=>t),se()),_control:{_stream:c._control._stream.pipe(Y(t=>t),se())}}}},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 F_({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});const n=ur(a);n.length>0&&(u=u.concat(n),a=await F_({refnode:e,nodelambda:r,contextuallambda:u,etaTree:t.gos.etaTree})),a&&o in a&&(s=a[o])}const c=async({refnode:t,spellbook:e,spellname:n,lambdalut:r,contextuallambda:i,etaTree:o}={})=>{if(n in e){const s=e[n];s in r&&r[s],"accio"===n&&t.slice(0,4);const a=await o.etaReduceLEAFNode({nodeuuid:s,contextuallambda:i});return"accio"===n&&t.slice(0,4),a}};if(!s){const n=t.user.spellbook,r=t.user.lambdalut;s=await c({refnode:e,spellbook:n,spellname:o,lambdalut:r,contextuallambda:u,etaTree:t.gos.etaTree})}if(!s){const n=t.gos.stdlambdalut,r=t.gos.standardSpellbook;s=await c({refnode:e,spellbook:r,spellname:o,lambdalut:n,contextuallambda:u,etaTree:t.gos.etaTree})}if(!s){const n=t.gos.curatedlambdalut,r=t.gos.curatedSpellbook;s=await c({refnode:e,spellbook:r,spellname:o,lambdalut:n,contextuallambda:u,etaTree:t.gos.etaTree})}return s}},lr=Bt("error",{type:"critical",message:"LEAF core error: race condition detected in leaflabel.js",codebase:"/src/ghostos/api/parser/nodelogic/datautils/leaflabel.js"},{}),hr={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 F_({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 vs(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 Ss(i,r,void 0,{...s,metastep:"leaflabel "+e},{leaflogic:(t,e)=>{const n=new It({...lr,_label:{...s}}),r=a(t),i=t.length>0?e._stream.pipe(ue(t=>Ee([ve(t),...r])),Y(t=>(2==t.length?n.next(t[1]):n.next(t.slice(1)),t[0])),Q(t=>t),se()):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 F_({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 F_({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree})}}else o={};return o}},dr={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 F_({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:ve([n.leaf.logic.args.label])},i=ze(t)._stream.pipe(oe(r._stream),Y(t=>t),Q(([t,e])=>t.every(t=>Dt(t)||Lt(t)&&t._crate.every(Dt))),Y(([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]=[])=>(Dt(e)?t.push(s(n,r(e))):Lt(e)&&t.push({...e,_crate:e._crate.map(t=>s(n,r(t)))}),t),[]);if(i.length>0)return i}),Q(t=>t));return{_stream:i,_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 F_({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=n.leaf.logic.args.labelstr;return o&&s in o?{...o[s]}:{}}},pr={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 F_({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:ve(n.leaf.logic.args.bottlekey),_control:e},c=e._stream.pipe(be(t=>(r=t,u._stream)),Y(t=>(i=t,r)));return Ss({_stream:c},t,void 0,{...a,metastep:"executing bottle with key "+i},{datalogic:{pre:t=>void 0===s?Bt(i,t):Bt(i,t,{tag:s})}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await F_({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,n])=>{s[t]=(t,r)=>{const i=Ue(e,t);return{...n([i],r),_control:r}}}),s}},fr={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 F_({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:ve([n.leaf.logic.args.bottlekey]),_control:e};let i;const a=e._stream.pipe(oe(r._stream),Y(t=>{const e=t[1];return i=e,t[0]}),se()),u=(t,e)=>{const n=new Ct,r=e._stream.pipe(oe(...t.map(t=>t._stream)),Y(t=>{const e=t[1],r=t=>{const e=[t].flat().map(t=>Dt(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]}),Q(t=>void 0!==t),se());return{_stream:n.pipe(Y(t=>t),se()),_control:{...e,_stream:r.pipe(Y(t=>t),se())}}};return Ss({_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 F_({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}},mr={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 F_({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data,(()=>{const t=Object.keys(o).filter(t=>0===Object.keys(o[t]).length);return t.length>0?t.sort().join(";"):void 0})());a="in the leafdataunbottle lambda";var a;return(t,e)=>{const n=new Ct,r=e._stream.pipe(oe(...t.map(t=>t._stream)),Y(t=>{const e={_cratelabel:s?{tag:s}:{}};if((Array.isArray(t[1])?t[1]:[t[1]]).flat().map(t=>Dt(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]}),Q(t=>void 0!==t),se());return{_stream:n.pipe(Y(t=>t),se()),_control:{...e,_stream:r}}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await F_({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s}};function gr(t,e,n){if(this.outer=n,this.dict=Object.create(null),this.get=function(t){return this.dict["$"+t]},this.set=function(t,e){this.dict["$"+t]=e},this.find=function(t){return"$"+t in this.dict?this:this.outer?this.outer.find(t):null},t&&e)for(let n=0;n<t.length;++n)this.set(t[n],e[n])}let _r=new gr;const yr=(t,e=!0)=>"object"===typeof t?e?JSON.stringify(Object.entries(t).map(t=>[t[0],yr(t[1],!1)]).sort()):Object.entries(t).map(t=>[t[0],yr(t[1],!1)]).sort():JSON.stringify(t);let vr={"+":function(){return[].reduce.call(arguments,function(t,e){return t+e})},"-":function(t,e){return t-e},"*":function(){return[].reduce.call(arguments,function(t,e){return t*e})},"/":function(t,e){return t/e},"%":function(t,e){return t%e},and:function(t,e){return t&&e},or:function(t,e){return t||e},not:function(t){return!t},">":function(t,e){return t>e},"<":function(t,e){return t<e},">=":function(t,e){return t>=e},"<=":function(t,e){return t<=e},"=":function(t,e){return t==e},":":function(t,e){return e[t]},"...":function(t,e){const n={...t};return Object.entries(e).forEach(([t,e])=>{n[t]=e}),n},"in?":function(t,e){const n=Array.isArray(t);return Object.entries(t).some(([t,r])=>{let i={};return i[t]=r,n?yr(r)===yr(e):yr(i)===yr(e)})},"equal?":function(t,e){return t===e},"eq?":function(t,e){return t===e},length:function(t){return t.length},cons:function(t,e){return[t].concat(e)},car:function(t){return t[0]},cdr:function(t){return t.slice(1)},append:function(t,e){return t.concat(e)},list:function(){return[].slice.call(arguments)},"list?":function(t){return Array.isArray(t)},"null?":function(t){return Array.isArray(t)&&!t.length},"symbol?":function(t){return"string"==typeof t},MathPI:Math.PI,MathE:Math.E,MathLN10:Math.LN10,MathLN2:Math.LN2,MathLOG10E:Math.LOG10E,MathLOG2E:Math.LOG2E,MathSQRT2:Math.SQRT2,False:!1,True:!0,Null:null};Object.keys(vr).forEach(function(t){_r.set(t,vr[t])}),["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","log10","log2","max","min","pow","random","round","sin","sqrt","tan"].forEach(function(t){_r.set(t,Math[t])});(t=>{function e(n,r){r=r||t;const i=typeof n;if("string"===i)return r.find(n).get(n);if(!Array.isArray(n)){if("object"===i){let t={};return Object.entries(n).map(([n,i])=>{t[n]=e(i,r)}),t}return n}if("quote"===n[0])return n.slice(1).join(" ");if("if"===n[0])return e((o=e(n[1],r),(Array.isArray(o)?o.length:o)?n[2]:n[3]),r);var o;if("set!"===n[0])return r.find(n[1]).set(n[1],e(n[1],r));if("define"===n[0])return r.set(n[1],e(n[2],r));if("lambda"===n[0])return function(){return e(n[2],new gr(n[1],arguments,r))};if("begin"===n[0]){let t;for(let i=1;i<n.length;++i)t=e(n[i],r);return t}let s=n.map(function(t){return e(t,r)}),a=s.shift();return"function"==typeof a?a.apply(null,s):a}function n(t){return r(function(t){return t.replace(/\(/g," ( ").replace(/\)/g," ) ").replace(/\{/g," { ").replace(/\}/g," } ").replace(/^\s+|\s+$/g,"").split(/\s+/g)}(t))}function r(t){if(!t.length)throw new SyntaxError("unexpected EOF while reading");let e=t.shift();if("("===e){let e=[];for(;")"!==t[0];)e.push(r(t));return t.shift(),e}if("{"===e){let e={};for(;"}"!==t[0];){let n=t.shift(),i=":"===n[0]?n.slice(1):null;if(!i)throw new SyntaxError("unexpected key: "+n);e[i]=r(t)}return t.shift(),e}if("}"===e)throw new SyntaxError("unexpected )");if(")"===e)throw new SyntaxError("unexpected )");return function(t){let e=Number(t);return isNaN(e)&&"NaN"!==t?String(t):e}(e)}})(_r);function br(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 wr=t=>void 0!==t&&t>="0"&&t<="9",xr=t=>t>="a"&&t<="z"||t>="A"&&t<="Z"||"_"==t||"."==t||"-"==t,Tr=t=>t>="a"&&t<="z"||t>="A"&&t<="Z"||"_"==t||"."==t||"-"==t||":"==t,kr=t=>"=+-*/\\&%$_!<>?".includes(t);class Sr{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 Ar,Or;Sr.unknown=new Sr("",-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"}(Ar||(Ar={}));class Er{constructor(t,e,n){this.type=t,this.value=e,this.position=n}}Er.INIT=new Er(Ar.Init,"",new Sr("",0,0,0));class Cr{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===Ar.Keyword,s=i.substring(o?e+1:e,r);return new Er(t,s,new Sr(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 Er(Ar.String,i,new Sr(r,t,n,e))}errorToken(t){const{start:e,line:n,current:r,source:i}=this;return new Er(Ar.Error,t,new Sr(i,e,r,n))}identifier(){for(;;){const t=this.peek();if(!t||!(xr(t)||wr(t)||kr(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(Ar.True);case"false":return this.makeToken(Ar.False);case"null":return this.makeToken(Ar.Nothing);default:return this.makeToken(Ar.Identifier)}}keyword(){if(!Tr(this.peek())&&!wr(this.peek()))return this.makeToken(Ar.Identifier);for(;Tr(this.peek())||wr(this.peek());)this.advance();return this.makeToken(Ar.Keyword)}number(){for(;wr(this.peek());)this.advance();if("."===this.peek()&&wr(this.peekNext())){for(this.advance();wr(this.peek());)this.advance();return this.makeToken(Ar.Float)}if("/"===this.peek()){if(!wr(this.peekNext()))return this.errorToken("Unterminated fraction number");for(this.advance();wr(this.peek());)this.advance();return this.makeToken(Ar.FractionNumber)}return this.makeToken(Ar.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(Ar.EOF);const t=this.advance();if(wr(t)||"-"===t&&wr(this.peek()))return this.number();if((xr(t)||kr(t))&&!wr(t))return this.identifier();switch(t){case"(":return this.makeToken(Ar.LeftParen);case")":return this.makeToken(Ar.RightParen);case"{":return this.makeToken(Ar.LeftBrace);case"}":return this.makeToken(Ar.RightBrace);case"[":return this.makeToken(Ar.LeftSquare);case"]":return this.makeToken(Ar.RightSquare);case"#":return this.makeToken(Ar.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"}(Or||(Or={}));class Mr{constructor(t,e,n){this.kind=t,this.value=e,this.position=n}}class Ir 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}}Ir.kind="RuntimeError";const Nr=t=>t,jr=(t,e)=>{if(t)throw new Ir(e);return!0},Rr=(t,e,n)=>jr(t.length!==e,n||`Expected ${e} argument${e>1?"s":""}, but got ${t.length}.`),Pr=(t,...e)=>jr(void 0===e.find(e=>e===t.kind),`Invalid function parameter, actual: '${t.kind}', expected: '${e.join(" or ")}'.`);const Dr=t=>()=>{throw new Ir(`${t} is not implemented.`)},Lr=t=>({parser:()=>{throw new Ir(`${t} is not implemented.`)},factory:Dr(t)}),Fr={Bool:{parser:t=>"true"===t,factory:Boolean},Nothing:{parser:t=>"null"==t,factory:Dr("NULL")},Int:{parser:t=>parseInt(t,10),factory:Number},Float:{parser:parseFloat,factory:Number},String:{parser:t=>t,factory:String},FractionNumber:{parser:t=>t,factory:Dr("FractionNumber")},Vector:Lr("Vector"),HashMap:Lr("HashMap")},$r="Vector",Br="HashMap";class qr{constructor(t,e=Fr){this.scanner=t,this.literals=e,this.hadError=!1,this.panicMode=!1,this.current=Er.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(Ar.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===Ar.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===Ar.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 Ar.True:case Ar.False:return this.makeLiteral(Or.Boolean,e.parser,t);case Ar.Nothing:return this.makeLiteral(Or.Nothing,s.parser,t);case Ar.Integer:return this.makeLiteral(Or.Integer,r.parser,t);case Ar.Float:return this.makeLiteral(Or.Float,i.parser,t);case Ar.FractionNumber:return this.makeLiteral(Or.FractionNumber,n.parser,t);case Ar.String:return this.makeLiteral(Or.String,o.parser,t);case Ar.Identifier:return this.makeLiteral(Or.Identifier,Nr,t);case Ar.Keyword:return this.makeLiteral(Or.Keyword,o.parser,t);case Ar.LeftParen:return new Mr(Or.List,this.advanceUntil(Ar.RightParen),t.position);case Ar.LeftSquare:return new Mr(Or.List,[new Mr(Or.Identifier,$r,t.position),...this.advanceUntil(Ar.RightSquare)],t.position);case Ar.LeftBrace:return new Mr(Or.List,[new Mr(Or.Identifier,Br,t.position),...this.advanceUntil(Ar.RightBrace)],t.position);case Ar.Dispatch:return this.formatDispatch();default:return void this.errorAtCurrent(`Unknown token: '${t.value}'.`)}}makeLiteral(t,e,n){const r=new Mr(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===Or.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 Br:this.errorAtCurrent("Invalid dispatch: #{...}.");break;case $r: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 Or.Boolean:case Or.Nothing:case Or.Integer:case Or.Float:case Or.FractionNumber:case Or.String:case Or.Keyword:case Or.Identifier:return n=e(n,t);case Or.List:return t.value.map(r),n=e(n,t)}};return r(t),n}(t,(t,e)=>{if(e.kind===Or.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 Mr(Or.Identifier,`%${n+1}`,t.position)),r=new Mr(Or.List,[new Mr(Or.Identifier,$r,t.position),...n],t.position);return new Mr(Or.List,[new Mr(Or.Identifier,"fn",t.position),r,t],t.position)}closeParentheses(t){switch(t){case Ar.RightParen:return")";case Ar.RightBrace:return"}";case Ar.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 Ur="<native function>";class Vr{constructor(t,e,n=!0,r=Ur){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===Or.Identifier?t.execLiteral(n,e):n):n;if(-1===this.arity||0===r)return this._fn(t,e,i);if(r>0){const t=(t,e,n)=>this._fn(t,e,[...i,...n]);return new Vr(t,r,this._resolveIds,this.toString())}{const r=this._fn(t,e,i.slice(0,this.arity));return r instanceof Vr?r.call(t,e,i.slice(this.arity)):jr(!0,`Expected ${this.arity} argument${this.arity>1?"s":""}, but got ${n.length}.`)}}get arity(){return this._arity}toString(){return this._toString===Ur?Ur:`<${this._toString} function>`}toJS(){return this.toString()}debugTypeOf(){return Vr.kind}}Vr.kind="Function";const Gr=t=>{var e;return new Vr(t.fn,t.arity,null===(e=t.resolveArgsIdentifiers)||void 0===e||e,t.name||t.fn.name)},zr=(t,e)=>Gr({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}),Wr=Gr({name:"const",arity:1,fn:(t,e,n)=>{jr(1!==n.length,`Const expected 1 argument, but got ${n.length}.`);const[r]=n;return Gr({name:"const",arity:-1,fn:(t,e)=>t.execLiteral(r,e)})}}),Jr=Gr({name:"def",arity:2,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{Rr(n,2);const[r,i]=n;Pr(r,Or.Identifier);const o=t.execLiteral(i,e);return e.define(r.value,o),o}}),Hr=Gr({name:"defn",arity:-1,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{Rr(n,3);const[r,i,o]=n;return e.get("def").call(t,e,[r,new Mr(Or.List,[new Mr(Or.Identifier,"fn",Sr.unknown),i,o],Sr.unknown)])}}),Xr=Gr({name:"if",arity:3,fn:(t,e,n)=>{Rr(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 Ir(`Expected boolean value in the if condition, but get '${a}'`)}}),Kr=Gr({arity:-1,name:"case",fn:(t,e,n)=>{jr(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){Pr(n,Or.List);const r=n.value;Rr(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);jr(!("else"===u||a instanceof Vr),"Case branch must start with a function or :else.");let c=!1;if("else"===u)c=!0;else{const e=t.evalFn(a,[o]),n=t.options.utils.unboxing(e);jr(!("boolean"==typeof n),"Case branch function must return with Bool."),c=n}if(c)return t.execLiteral(s,e)}jr(!0,`At least one of the case branch must match with the condition: ${o}`)}});class Qr{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 Ir(`'${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 Ir(`Undefined identifier: '${t}'.`)}assign(t,e){if(!this.values[t]){if(null!==this.enclosing)return this.enclosing.assign(t,e);throw new Ir(`Undefined identifier: '${t}'.`)}this.values[t]=e}getNames(){return Object.keys(this.values)}get parent(){return this.enclosing}}const Zr=Gr({name:"fn",arity:-1,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{Rr(n,2);const[r,i]=n;Pr(r,Or.List);const o=r.value.slice(1);return o.map(t=>Pr(t,Or.Identifier)),Gr({name:"lambda",arity:o.length,fn:(t,n,r)=>{Rr(r,o.length);const s=new Qr(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}})}}),Yr=Gr({name:"do",arity:-1,fn:(t,e,n)=>(jr(n.length<1,`Expected at least 1 argument, but got ${n.length}.`),n.map(n=>t.execLiteral(n,e)).pop())}),ti=Gr({name:"side-effect",arity:-1,fn:(t,e,n)=>{jr(n.length<1,`Eff expected at least 1 argument, but got ${n.length}.`);const[r,...i]=n,o=t.execLiteral(r,e);return jr(!(o instanceof Vr),"Eff first parameter must be a function."),Gr({name:"side-effect",arity:-1,fn:t=>t.evalFn(o,i)})}}),ei={stdout:void 0,lockedGlobals:!0,globals:{},utils:{unboxing:Nr}},ni=[$r,Br];class ri{constructor(t,e){this.globals=new Qr,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 Or.Boolean:case Or.Integer:case Or.Float:case Or.FractionNumber:case Or.String:case Or.Keyword:case Or.Nothing:return t.value;case Or.Identifier:return e.get(t.value);case Or.List:return this.execList(t,e);default:return t}},this.options=Object.assign(Object.assign({},ei),t);const{stdout:n,globals:r,lockedGlobals:i}=this.options,o=Object.assign(Object.assign({},Fr),e);Object.keys(o).forEach(t=>{const e=o[t].factory,n=ni.includes(t)?-1:e.length;this.globals.define(t,zr(e,n))}),this.globals.define("print",zr(t=>{var e;return(n||console.log)(t,null===(e=this.lastPrint)||void 0===e?void 0:e.position)},-1)),this.globals.define("const",Wr),this.globals.define("def",Jr),this.globals.define("defn",Hr),this.globals.define("if",Xr),this.globals.define("case",Kr),this.globals.define("fn",Zr),this.globals.define("do",Yr),this.globals.define("side-effect",ti),Object.keys(r).forEach(t=>{const e=r[t];let n=e;"function"==typeof e&&e.toString()!==Ur&&(n=zr(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===Ir.kind?t:new Ir(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 Ir(`'${i}' is not a function`,t.position)}getGlobalNames(){return this.globals.getNames()}clearEnv(){null!==this.currentEnv.parent&&(this.currentEnv=this.currentEnv.parent)}}var ii;!function(t){t.Parser="Parser",t.Runtime="Runtime"}(ii||(ii={}));class oi{constructor(t,e){this.literals=e,this.interpreter=new ri(t,e)}insituexecute(t){const e=new Cr(t),n=new qr(e,this.literals).parse();if(n.hasError)throw{type:ii.Parser,errors:n.errors};try{return this.interpreter.interpret(n.program)}catch(t){throw{type:ii.Runtime,errors:[{message:t.message,position:t.position}]}}}execute(t){return br(this,void 0,void 0,function*(){const e=new Cr(t),n=new qr(e,this.literals).parse();if(n.hasError)throw{type:ii.Parser,errors:n.errors};try{this.interpreter.interpret(n.program)}catch(t){throw{type:ii.Runtime,errors:[{message:t.message,position:t.position}]}}})}evalFn(t,e){return this.interpreter.evalFn(t,e)}}var si,ai={const:t=>()=>t};class ui 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"}(si||(si={}));class ci{constructor(t){this._value=t}static fromJS(t){return new ci(t)}static fromStr(t){switch(t.value){case"true":return new ci(!0);case"false":return new ci(!1);default:throw new ui(`Invalid boolean: "${t.value}".`)}}get value(){return this._value}not(){return new ci(!this._value)}and(t){return new ci(this._value&&t._value)}or(t){return new ci(this._value||t._value)}equals(t){return new ci(this._value===t._value)}partialCmp(t){return this.value===t.value?si.Equal:this.value?si.Greater:si.Less}copy(){return new ci(this._value)}toString(){return this._value?"true":"false"}toJS(){return this._value}toJSON(){return this.toJS()}debugTypeOf(){return di(ci.kind)}}ci.kind="Bool";const li=t=>new ci(t);class hi{constructor(t){this._value=t}static fromJS(t){return new hi(t)}static fromStr(t){return t.copy()}get value(){return this._value}add(t){return new hi(this._value+t.value)}index(t){var e;return Number.isInteger(t.value)?new hi(null!==(e=this._value.charAt(t.value))&&void 0!==e?e:""):new hi("")}slice(t,e){return new hi(this.value.slice(t.value,e.value))}equals(t){return li(this._value===t.value)}partialCmp(t){const e=this._value.localeCompare(t.value);return e<0?si.Less:0===e?si.Equal:si.Greater}copy(){return new hi(this._value)}toJS(){return this._value}toJSON(){return this.toJS()}toString(){return`${this._value}`}debugTypeOf(){return new hi(hi.kind)}contains(t){return li(this.value.indexOf(t.value)>-1)}count(){return ki(this.value.length)}}hi.kind="String";const di=(t="")=>new hi(t);class pi{constructor(){this._value=null}static fromStr(t){switch(t.value){case"undefined":case"nil":case"null":return new pi;default:throw new ui(`Invalid Nothing literal: "${t.value}".`)}}get value(){return null}equals(t){return li(this._value==t._value)}not(){return li(!0)}toJS(){return null}toJSON(){return null}toString(){return"null"}debugTypeOf(){return di(pi.kind)}}pi.kind="null";const fi=new pi,mi=t=>~~t,gi=t=>null==t||null==t||t==fi,_i=(t,e)=>{if(t)throw new ui(e);return!0},yi=(t,e)=>_i(t.constructor!==e.constructor,`Type Error! Expected '${Ti(t)}', but got '${Ti(e)}'`),vi=(t,e)=>{var n;return _i(t!==e.constructor,`Expected '${null!==(n=t.kind)&&void 0!==n?n:t.name}', but got '${Ti(e)}'.`)},bi=(t,e)=>_i(!t[e],`"${e.toString()}" is not defined on ${t}`),wi=t=>_i(!Number.isInteger(t),`Expected integer number', but got '${t}'.`),xi=(t,e)=>(_i(gi(t),e),t),Ti=t=>{var e,n,r,i;return null!==(i=null!==(n=null===(e=null==t?void 0:t.constructor)||void 0===e?void 0:e.kind)&&void 0!==n?n:null===(r=null==t?void 0:t.constructor)||void 0===r?void 0:r.name)&&void 0!==i?i:"unknown"};function ki(t,e=0){if("string"==typeof t){Si(t);const e=Ai(t)?Oi(t):Ei(t);return ki(e.intValue,e.decimals)}return Number.isInteger(t)||0!==e?(wi(t),wi(e),new ji(t,e)):ki(t.toString())}function Si(t){return _i(""===t||isNaN(Number(t)),`Invalid number: "${t}"`)}function Ai(t){return t.startsWith("0")?/^0[eE]0$/.test(t):/^[-+]?[1-9](\.\d+)?[eE][-+]?\d+$/.test(t)}function Oi(t){_i(!Ai(t),`Input is not in scientific form: "${t}"`);const e=t.split(/[eE]/),n=Ei(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 Ei(t){var e;Si(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 Ci(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 Mi={modulo:function(t,e){const n=t.value,r=e.value;return wi(n),wi(r),_i(r<1,`Modulo (${r}) must be positive.`),_i(n<0,`Number (${n}) cannot be negative.`),ki(n%r)}};const Ii=(t,e)=>t!==e&&t?e?Ii(e,t%e):t:e,Ni=t=>Math.abs(t)<=Number.EPSILON;class ji{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 li((e=this.value,n=t.value,Ni(e-n)));var e,n}negate(){return new ji(-this.intValue,this.decimals)}add(t){const e=Ci(this,t),n=e.intValue1+e.intValue2;return new ji(n,e.maxDecimal)}subtract(t){const e=Ci(this,t),n=e.intValue1-e.intValue2;return new ji(n,e.maxDecimal)}multiply(t){return new ji(this.intValue*t.intValue,this.decimals+t.decimals)}divide(t){if(0===t.intValue)throw new ui("Cannot divide by zero!");const e=Ci(this,t),n=Math.round(e.intValue1/e.intValue2*Math.pow(10,12));return new ji(n,12)}partialCmp(t){const e=Ci(this,t);return e.intValue1<e.intValue2?si.Less:e.intValue1>e.intValue2?si.Greater:si.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 ji(this.intValue,this.decimals)}debugTypeOf(){return di(ji.kind)}isInteger(){return li(0===this.decimals)}toJSON(){return this.toString()}}ji.kind="Number";const Ri=t=>e=>{vi(ji,e);try{return ki(t(e.value))}catch(n){throw new ui(`Invalid argument for ${t.name}: ${e.value}`)}},Pi=t=>(e,n)=>(vi(ji,e),vi(ji,n),ki(t(e.value,n.value))),Di=ki(Math.E),Li=ki(Math.LN2),Fi=ki(Math.LN10),$i=ki(Math.LOG2E),Bi=ki(Math.LOG10E),qi=ki(Math.PI),Ui=ki(Math.SQRT1_2),Vi=ki(Math.SQRT2),Gi=Ri(Math.abs),zi=Ri(Math.sign),Wi=Pi((t,e)=>Math.min(t,e)),Ji=Pi((t,e)=>Math.max(t,e)),Hi=Ri(Math.floor),Xi=Ri(Math.round),Ki=Ri(Math.ceil),Qi=Ri(Math.trunc),Zi=Ri(Math.cbrt),Yi=Ri(Math.sqrt),to=Ri(Math.exp),eo=Pi(Math.pow),no=Ri(Math.log),ro=Ri(Math.log2),io=Ri(Math.log10),oo=Math.PI/180,so=Ri(t=>{const e=t%Math.PI;return Ni(e)||Ni(e-Math.PI)?0:Math.sin(t)}),ao=Ri(Math.asin),uo=Ri(Math.asinh),co=Ri(Math.cos),lo=Ri(Math.acos),ho=Ri(Math.acosh),po=Ri(Math.tan),fo=Ri(Math.atan),mo=Pi(Math.atan2),go=Ri(Math.atanh);var _o=Object.freeze({__proto__:null,E:Di,LN2:Li,LN10:Fi,LOG2E:$i,LOG10E:Bi,PI:qi,SQRT1_2:Ui,SQRT2:Vi,abs:Gi,sign:zi,min:Wi,max:Ji,floor:Hi,round:Xi,ceil:Ki,trunc:Qi,cbrt:Zi,sqrt:Yi,exp:to,pow:eo,log:no,log2:ro,log10:io,deg2rad:t=>t.multiply(ki(oo)),rad2deg:t=>t.divide(ki(oo)),sin:so,asin:ao,asinh:uo,cos:co,acos:lo,acosh:ho,tan:po,atan:fo,atan2:mo,atanh:go});const yo=t=>(bi(t,"copy"),t.copy());var vo={typeof:t=>{const e=t.debugTypeOf?t.debugTypeOf():di("<unknown>");return e instanceof String?di(e):e},copy:yo,"deep-copy":t=>{var e;return bi(t,"copy"),t.deepCopy?null===(e=t.deepCopy)||void 0===e?void 0:e.call(t):yo(t)},str:t=>di(t.toString()),"to-json":t=>{let e=null;return"function"==typeof t.toJSON?e=t.toJSON():"function"==typeof t.toJS&&(e=t.toJS()),di(JSON.stringify(e))}};const bo=(t,e)=>t.constructor!==e.constructor?li(!1):t.equals(e),wo=(t,e)=>{yi(t,e);const n=t.lt;return"function"==typeof n?n(e):li(t.partialCmp(e)===si.Less)},xo=(t,e)=>{yi(t,e);const n=t.gt;return"function"==typeof n?n(e):li(t.partialCmp(e)===si.Greater)};var To={"==":bo,"!=":(t,e)=>bo(t,e).not(),"<":wo,"<=":(t,e)=>li(bo(t,e).value||wo(t,e).value),">":xo,">=":(t,e)=>li(bo(t,e).value||xo(t,e).value)};var ko={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 So=(t,e)=>(yi(t,e),t.add(e)),Ao=(t,e)=>(yi(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),"+":So,"-":(t,e)=>(yi(t,e),t.subtract(e)),"*":Ao,"/":(t,e)=>(yi(t,e),t.divide(e)),get:(t,e)=>t.index(e)};class Eo{constructor(t){t.map(e=>yi(t[0],e)),this._value=t}get value(){return this._value}contains(t){return li(void 0!==this.value.find(e=>bo(e,t).value))}add(t){return new Eo(this._value.concat(t.value))}count(){var t;return new ji(null!==(t=this._value.length)&&void 0!==t?t:0)}map(t){return new Eo(this.value.map(e=>t(e)))}filter(t){return new Eo(this.value.filter(e=>t(e).toJS()))}reverse(){return new Eo(this.value.reverse())}reduce(t,e){return this.value.reduce(e,t)}intersperse(t){const e=this.value.length-1;return new Eo(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){vi(ji,t);return xi(this.value[t.value],`Vector index ${t.toString()} is not defined`)}slice(t,e){return vi(ji,t),vi(ji,e),new Eo(this.value.slice(t.value,e.value))}copy(){return new Eo([...this._value])}deepCopy(){return new Eo(this._value.map(t=>yo(t)))}debugTypeOf(){return di(Eo.kind)}}function Co(...t){return new Eo(t)}Eo.kind="Vector";var Mo={sum:t=>(vi(Eo,t),t.reduce(ki(0),So)),prod:t=>(vi(Eo,t),t.reduce(ki(1),Ao)),intersperse:(t,e)=>(vi(Eo,e),e.intersperse(t)),join:t=>(vi(Eo,t),t.reduce(di(""),So)),"join-with":(t,e)=>(vi(Eo,e),e.intersperse(t).reduce(di(""),So)),"num-list":(t,e)=>(vi(Eo,e),e.map(t=>di(t.toString())).intersperse(t).reduce(di(""),So)),head:t=>{vi(Eo,t);return xi(t.value[0],"Vector is empty")},reverse:t=>(vi(Eo,t),Co(...t.value.reverse())),slice:(t,e,n)=>(vi(Eo,t),vi(ji,n),vi(ji,e),xi(t.value.length,"Vector is not defined correctly"),Co(...t.value.slice(e.value,n.value))),tail:t=>{vi(Eo,t),xi(t.value.length,"Vector is not defined correctly");return Co(...t.value.slice(1))}};const Io=Math.random;var No=Object.freeze({__proto__:null,random:()=>ki(Io()),randomInt:(t,e)=>{const n=mi(t.value),r=mi(e.value);return ki(mi(n+Io()*(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 Co(...e)},range:(t,e,n)=>{const r=t.value,i=n.value,o=mi(e.value);let s=r;const a=[];for(let t=0;t<o;t++)a.push(ki(s)),s+=i;return Co(...a)},range0:t=>{const e=mi(t.value);return Co(...Array.from({length:e},(t,e)=>ki(e)))}});class jo{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 di(jo.kind)}}jo.kind="Just";class Ro{constructor(t=[]){if(t.length%2!=0)throw new ui("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(hi!==t.constructor)throw new ui("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 ji?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 di(Ro.kind)}index(t){vi(hi,t);try{const e=this._value.get(t.value);return gi(e)?new pi:e}catch(t){return new pi}}}Ro.kind="HashMap";const Po=(...t)=>new Ro(t);var Do={keys:t=>(vi(Ro,t),Co(...Array.from(t.value.keys()).map(t=>di(t)))),values:t=>(vi(Ro,t),Co(...Array.from(t.value.values()))),"hash-map":Po};class Lo{constructor(t){const e=t.value;e.map(t=>yi(e[0],t)),this._value=e.reduce((t,e)=>(t.find(t=>bo(t,e).value)||t.push(e),t),[])}get value(){return this._value}contains(t){return li(void 0!==this.value.find(e=>bo(e,t).value))}union(t){return new Lo(Co(...this._value.concat(t.value)))}difference(t){return new Lo(Co(...this.value.filter(e=>!t.contains(e).value)))}intersection(t){return new Lo(Co(...this.value.concat(t.value).filter(e=>t.contains(e).value&&this.contains(e).value)))}symmetricDifference(t){return new Lo(Co(...this.value.concat(t.value).filter(e=>!(t.contains(e).value&&this.contains(e).value))))}count(){var t;return new ji(null!==(t=this._value.length)&&void 0!==t?t:0)}map(t){return new Lo(Co(...this.value.map(t)))}filter(t){return new Lo(Co(...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 Lo(Co(...this.value))}deepCopy(){return new Lo(Co(...this.value.map(t=>yo(t))))}debugTypeOf(){return di(Lo.kind)}}Lo.kind="Set";var Fo={Set:t=>new Lo(t),"set-2-list":function(t){return Co(...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 $o=(t,e)=>Number.isInteger(t)&&Number.isInteger(e)&&0!==e;class Bo{constructor(t,e){if(!$o(t,e))throw new ui("Invalid fraction number parameters!");e<0&&(t*=-1,e*=-1);const n=Ii(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 li(this.numerator===t.numerator&&this.denominator===t.denominator)}negate(){return new Bo(-this._n,this._d)}add(t){const e=this.numerator*t.denominator+this.denominator*t.numerator,n=this.denominator*t.denominator;return new Bo(e,n)}subtract(t){const e=this.numerator*t.denominator-this.denominator*t.numerator,n=this.denominator*t.denominator;return new Bo(e,n)}multiply(t){const e=this.numerator*t.numerator,n=this.denominator*t.denominator;return new Bo(e,n)}divide(t){const e=this.numerator*t.denominator,n=this.denominator*t.numerator;return new Bo(e,n)}partialCmp(t){const e=this._d*t._d/Ii(this._d,t._d),n=this._n*e/this._d,r=t._n*e/t._d;return n<r?si.Less:n>r?si.Greater:si.Equal}toJS(){return{numerator:this._n,denominator:this._d}}toJSON(){return this.toString()}toString(){return`${this._n}/${this._d}`}copy(){return new Bo(this._n,this._d)}debugTypeOf(){return di(Bo.kind)}}Bo.kind="Fraction";const qo=(t,e)=>new Bo(t,e);var Uo={"number-2-fraction":(t,e)=>{const n=t.value;_i(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 qo(Math.round(r*i),i)},"fraction-2-number":t=>ki(t.numerator).divide(ki(t.denominator)),reciprocal:t=>(vi(Bo,t),qo(t.denominator,t.numerator))};const Vo=t=>t,Go={Bool:{parser:t=>ci.fromStr(di(t)),factory:t=>(vi(ci,t),t)},Nothing:{parser:t=>pi.fromStr(di(t)),factory:t=>(vi(pi,t),t)},Int:{parser:ki,factory:function(t){return vi(ji,t),_i(!t.isInteger().value,"Expected integer, but got float number."),t}},Float:{parser:ki,factory:function(t){return vi(ji,t),t}},FractionNumber:{parser:t=>{const[e,n]=t.split("/").map(parseFloat);if($o(e,n))return new Bo(e,n);throw new ui(`Invalid fraction number: ${t}.`)},factory:(t,e)=>(_i(!t.isInteger().value,"Numerator must be integer"),_i(!e.isInteger().value,"Denominator must be integer"),new Bo(t.toJS(),e.toJS()))},String:{parser:di,factory:t=>(vi(hi,t),t)},Vector:{parser:Vo,factory:Co},HashMap:{parser:Vo,factory:Po}},zo=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({},vo),To),ko),Oo),ai),_o),Mi),Uo),Mo),Do),Fo),No),{maybe:t=>gi(t)?fi:new jo(t),Nothing:fi}),Wo={unboxing:t=>t.toJS()},Jo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{await F_({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});return(t,e)=>{const n=ze(t);if(n&&"_stream"in n){return{_stream:n._stream.pipe(Y(t=>t)),_control:e}}return{_stream:ve([]),_control:e}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={};if(r.length>0){const s=await F_({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 F_({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 vs(t,[],{}):{}}}}}},Ho={dataflow:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...ze(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 F_({refnode:e,nodelambda:o,contextuallambda:i,etaTree:t.gos.etaTree,addnodelut:!0,metadata:{codebase:"leafspelldef.js",context:"reduced_lambdalambda_obj"}}),u=await F_({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 F_({refnode:e,nodelambda:o,contextuallambda:i,etaTree:t.gos.etaTree,addnodelut:!0,metadata:{codebase:"leafspelldef.js",context:"reduced_lambdalambda_obj"}}),u=await F_({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 Xo=function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=Re);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 m(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}(Ct);const Ko=Bt("error",{type:"critical",message:"LEAF core error: race condition detected in leafloopyspell.js",codebase:"/src/ghostos/api/parser/nodelogic/abstraction/leafloopyspell.js"},{}),Qo=t=>{if(!t)return 1;const e=Object.keys(t).filter(t=>"&"===t);if(e.length>0)return;const n=Object.keys(t).filter(t=>$t(t)).map(t=>parseInt(t)).sort();return n.length>0?n[n.length-1]:1},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)}).`;["7b1f"].includes(e.slice(0,4));const o=await F_({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});["7b1f"].includes(e.slice(0,4));const s="bypass"in o,{type:a,args:u}=n.leaf.logic,c={codebase:"leafloopyspell.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data},l=Qo(o),h=(t=>{const e="stream"in t;if(!t)return e?1e3:10;if("interval"in t){const e=Qo(t.interval);return $t(e)?parseInt(e):void 0}return e?1e3:10})(o),d="forever"in o;if(o&&"_default"in o){l>0?sr(0,h).pipe(ar(l)):sr(0,h);["7b1f"].includes(e.slice(0,4));return(t,n)=>{["7b1f"].includes(e?.slice(0,4));const r={_stream:n._stream.pipe(Y(t=>_.throttle(()=>{},200)?t:void 0),Q(t=>void 0!==t),be(t=>_e([...Array(l).keys()]).pipe(Y(e=>({...t,_label:{...t._label,loopyidx:e}})))))};if(!o||!("_default"in o)){return Ss(r,t,void 0,{...c,metastep:"relaying input data as is due to error condition"})}let i=0,a=[];let u,h=new It(Ko),p=new Xo(1);const f=r._stream.pipe(ue(t=>(u=t,h.next(t),h)),He(p));return Ss({_stream:f},t,void 0,{...c,metastep:"executing a loopy spell with idx "+i},{leaflogic:o._default,datalogic:{pre:t=>{const e=t;return s||a.push(t),e},post:t=>{if(i+=1,(d||i<l)&&h.next(u),!s)return a[0];if("stream"in o)return t;if(a.push(t),i===l){const t=[...a];return a=[],i=0,t}}}})}}return o&&"await"in o?(t,e)=>{const n={_stream:e._stream.pipe(Y(t=>_.throttle(()=>{},10)?t:void 0),Q(t=>void 0!==t),Y(t=>[...Array(l).keys()].map(e=>({...t,_label:{...t._label,loopyidx:e}}))))};if(!o.await||!("_default"in o.await)){return Ss(n,t,void 0,{...c,metastep:"relaying input data as is due to error condition"})}let r=0,i=[];const a=t=>{const e=t;return s||i.push(t),e};let u=new Ct,h=new Ct,d=new Ct;const p=new Ct,f=new Ct;let m,g;const y=new Ct,v=new Ct,b=o.await._default([{_stream:y}],{_stream:v}),w=n._stream.pipe(oe(...t.map(t=>t._stream)),ue(t=>{const e=t[0],n=t[1];if(m=e,void 0!==g&&!g.closed)return h.next(n),u.next(e),f;r=0,i=[],d.next();const _=Ss({_stream:u},[{_stream:h}],void 0,{...c,metastep:"executing a loopy spell with idx "+r},{datalogic:{pre:a,post:t=>{if(r+=1,!s)return i[0];if("stream"in o)return t;if(i.push(t),r===l){const t=[...i];return i=[],r=0,1===l?t[0]:t}}}});let w;return g=_._control._stream.pipe(oe(_._stream),ue(t=>(w=t,y.next(t[1]),v.next(t[0]),b._control._stream)),oe(b._control._stream),oe(b._stream),Y(t=>t[1]),Y(t=>(t&&(p.next(w[1]),m=w[0],d.next()),t)),He(d)).subscribe({next:t=>{},error:t=>{},complete:()=>{}}),h.next(n),u.next(e),f}),Y(t=>t),or(()=>{void 0!==g&&(g.unsubscribe(),g=void 0)}),Q(t=>void 0!==t),se());return{_stream:o.final&&"_default"in o.final?p.pipe(Q(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Ko)),ue(t=>vs(o.final._default,t)),Y(t=>(setTimeout(()=>{f.next(m)},0),t)),se()):p.pipe(Q(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Ko)),Y(t=>(setTimeout(()=>{f.next(m)},0),t)),se()),_control:{_stream:w.pipe(Y(t=>t),se())}}}:(t,e)=>({...ze(t),_control:e})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await F_({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>{const r=ze(t);return{...e([r],n),_control:n}}}),s}},Yo=(t,e)=>{if(t.length>0&&t[0]in e)return 1===t.length?e[t[0]]:Yo(t.slice(1),e[t[0]])},ts=(t,e,n)=>{t.length>0&&t[0]in e&&(1===t.length?e[t[0]]=n:ts(t.slice(1),e[t[0]],n))};function es(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 ns(t,e){return t<<e|t>>>32-e}const rs=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]=ns(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=ns(i,5)+es(n,o,a,u)+c+e[n]+r[t]>>>0;c=u,u=a,a=ns(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])},is=/^(?:[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 os=function(t){return"string"==typeof t&&is.test(t)};const ss=function(t){if(!os(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)};function as(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?ss(r):r;if("string"==typeof r&&(r=ss(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 l(u)}function us(t,e,n,r){return as(80,rs,t,e,n,r)}us.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",us.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";const cs=us,ls=t=>{const e=t=>t.hostEtaTree?(t.hostEtaTree,e(t.hostEtaTree)):t,n=e(t),{appmode:r,domain:i,appid:o}=n,s=cs(`https://www.leafgon.com/${i}/${o}/_etaTreeForest`,cs.URL),a=n.mnemosyne.current[s],u={initEtaTreeForest:()=>{s in n.mnemosyne.current||(n.mnemosyne.current[s]={})},getEtaTree:async(t,e)=>{const r=t+"/"+e;if(r in a)return n.mnemosyne.current[s][r].tree;return await u.parseGraphEtaTree(t,e)},setEtaTree:(t,e,r,i)=>{const o=t+"/"+e;n.mnemosyne.current[s][o]={tree:r,parent:i}},removeEtaBush:(t,e)=>{const r=t+"/"+e,i=Object.entries(a).filter(([t,e])=>t!==r&&e.parent!==r).reduce((t,e)=>(t[e[0]]=e[1],t),{});n.mnemosyne.current[s]=i},parseGraphEtaTree:async(t,e)=>{const s=i,a=o;if(globalThis?.DEBUG){const n=t+"/"+e;globalThis.trace[n]?globalThis.trace[n].push("parsing"):globalThis.trace[n]=["parsing"]}const c=await n.leaflakeio.qm_methods.queryGraph({_appmode:r,_hostdomain:i,_hostappid:o,_domain:t,_appid:e}),{nodes:l}=c.graph?c.graph:{nodes:[]},h=ms(l),d=gs(h),p=n,f=$_(r,s,a,t,e,h,d,p.leafio,p.leaflakeio,p.mnemosyne,p),m=(d.components.nodegroups.runtime[0],d.components.nodegroups.lambda,p?s+"/"+a:void 0);if(u.setEtaTree(t,e,f,m),globalThis?.DEBUG){const n=t+"/"+e;globalThis.trace[n]?globalThis.trace[n].push("parsed"):globalThis.trace[n]=["parsed"]}return f}};return u},hs=it("leafgraph"),ds=async(t,e,n,r,i,o,s,a,u,c,l=!1)=>{const h=await(ls(u)?.parseGraphEtaTree(i,o)),d=h.leafgraph,p=h.graphcomponents,f=h.graphcomponents.components.nodegroups.runtime[0];h.graphcomponents.components.nodegroups.lambda;return(async()=>{const t={};if(0===d.graph.lambda.nodes().filter(t=>{const e=d.graph.lambda.getNodeAttributes(t),{type:i,args:o}=e.leafnode.data.leaf.logic;if("leafgraph"===i){return Yo(hs.editorconfig.namedatakey,o).toLowerCase()===n+"/"+r}return!1}).length){const n=[];if(f&&(["2ee89b44-16af-472f-97d4-47ae65f064c8"].includes(e),t._default=await L_({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})()},ps={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 F_({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),pr({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafgraph"}}}},contextuallambda:i});const{type:o,args:s}=n.leaf.logic,a=Yo(hs.editorconfig.namedatakey,s).toLowerCase(),u=a.match(/([\w]+)\/([\w]+)/);if(!!(!u||u[0]!==a))return{};const c=u[1],l=u[2],h=t.gos.etaTree.domain,d=t.gos.etaTree.appid;if(c+"/"+l!=h+"/"+d){const n=ds(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=>({...ze(t),_control:controlflow$obj})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const{type:o,args:s}=n.leaf.logic,a=Yo(hs.editorconfig.namedatakey,s).toLowerCase(),u=a.match(/([\w-]+){0,1}(\/([\w-]+)){0,1}/);if(!!(!u||u[0]!==a))return{};const c=t.gos.etaTree.domain,l=t.gos.etaTree.appid,h=u[1]?u[1]:c,d=u[3]?u[3]:"index";if("breezyforest"!==h&&h+"/"+d==c+"/"+l)return{};try{["3be30006-5b56-4b27-8eaa-249c6a46a557"].includes(e);const n=ds(0,e,c,l,h,d,t.gos.leafio,t.gos.etaTree.mnemosyne,t.gos.etaTree,i);return await n}catch(t){return}},_lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const{type:o,args:s}=n.leaf.logic,a=Yo(hs.editorconfig.namedatakey,s).toLowerCase(),u=a.match(/([\w-]+){0,1}(\/([\w-]+)){0,1}/);if(!!(!u||u[0]!==a))return{};const c=t.gos.etaTree.domain,l=t.gos.etaTree.appid,h=u[1]?u[1]:c,d=u[3]?u[3]:"index";if("breezyforest"!==h&&h+"/"+d==c+"/"+l)return{};try{["3be30006-5b56-4b27-8eaa-249c6a46a557"].includes(e);const n=ds(0,e,c,l,h,d,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}={})=>({})},fs={dataflow:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>{},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>{}},ms=(rt.breezyforest._version,(t,e)=>{const n=new Jn,r=new Jn,i=new Jn;new Jn;let o;t.forEach(t=>{const s=JSON.parse(er.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(er.hp.from(t.data,"base64").toString("utf-8")).leaf;if("leafdataedge"===o.logic.type)if(n.edge(t.source.uuid,t.target.uuid)){}else n.addEdgeWithKey(t.uuid,t.source.uuid,t.target.uuid,o),i.addEdgeWithKey(t.uuid,t.source.uuid,t.target.uuid,o),s.add(t.source.uuid),a.add(t.target.uuid);else if("leaflambdaedge"===o.logic.type){if("9935"===t.source.uuid.slice(0,4)){JSON.parse(er.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}}}}),gs=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 tr(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}}},_s=Bt("error",{type:"critical",message:"LEAF core error: race condition detected in leaf.js",codebase:"/src/ghostos/api/parser/leaf.js"},{}),ys=Bt("accio","ctrl_accio",{provenance:"executeLEAFLogic"}),vs=async(t,e,n={},r=void 0,i=void 0)=>{const o=new Ct,s=new Ct,a=t([{_stream:o}],{_stream:s,_config:n});if(a){const t=rr(a._control._stream.pipe(oe(a._stream),Y(t=>t[1])));o.next(e),i?s.next(i):s.next(ys);return await t}},bs=Bt("accio","ctrl_accio",{provenance:"subscribeToLEAFLogic"}),ws=async(t,e,n,r)=>{const i=new It({..._s,_label:{at:"leaf.js subscribeToLEAFLogic data stream"}}),o=new It({..._s,_label:{at:"leaf.js subscribeToLEAFLogic ctrl stream"}});i.next(e),o.next(bs);const s=t([{_stream:i}],{_stream:o,_config:n});let a;s&&s._control._stream.pipe(ue(t=>(a=t,s._stream)),Y(t=>[a,t]),He(r)).subscribe({next:t=>{},error:t=>{},complete:()=>{}})},xs=(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(Y(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 Ts=(t,e,n,r,i)=>{let o;return Promise.race([t,new Promise((t,s)=>o=setTimeout(()=>{const e=Bt("error",{type:"timeout",message:r,codebase:n,metadata:i});t(e)},e,r))]).finally(()=>clearTimeout(o))},ks=(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||[],Ss=(t,e,n,r={},i={leaflogic:void 0,datalogic:{pre:void 0,post:void 0}})=>{const o=new Ct,s=new Ct,a=new Ct;new Ct;let u,c;["e9e6e44b-792b-46d0-b1d3-58ce2f46c45b","c822ae2e-1be8-46be-b2cb-21a43cef0555","98d167d3-c1ed-4d4a-9ab9-25eaccd20a91"].includes(r.refnode);const l=i.leaflogic,h=void 0!==l?l([{_stream:a}],{_stream:void 0!==n?ye(s,n):s,_config:{...t._config}}):{_stream:a,_control:{_stream:s,_config:{...t._config,traces:ks(t._config?.traces,r)}}},d=e.length>1?ye(...e.map(t=>t._stream)):e[0]._stream,p=t._stream.pipe(oe(d),ue(t=>{["806e0a4b-badf-42a0-85af-5ad306385c58"].includes(r.refnode),e.length;const n=t[0],o=void 0!==i.datalogic?.pre?i.datalogic.pre(t[1]):t[1];u=1===n?.length?n[0]:n;const l={...u,traces:ks(u?.traces,{...r,at:"leaf.js driveDataflowByCtrlflow, initial switch-mapping of the ctrl signal to drive dataflow through a resolved leaflogic"},!0)};return c=o,setTimeout(()=>{a.next(o),s.next(l)},1),h._control._stream}),oe(h._control._stream),oe(h._stream),Y(t=>[t[0][1],t[1]]),Y(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]}),Y(t=>t),se());return{_stream:o.pipe(Q(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(_s)),se()),_control:{_stream:p.pipe(Y(t=>(["e9e6e44b-792b-46d0-b1d3-58ce2f46c45b","c822ae2e-1be8-46be-b2cb-21a43cef0555"].includes(r.refnode),t)),se()),_config:{...t._config,traces:ks(t._config?.traces,r)}}}},As=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=ps.lambda(r)({refnode:n,refnodedata:{leaf:{logic:{args:s}}},nodelambda:[],contextuallambda:[]});return await t}catch(t){return{}}},Os={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)=>{Bt("error",{type:"critical",message:"LEAF core error: race condition detected in leafinflowport.js",codebase:"/src/ghostos/api/parser/nodelogic/io/leafinflowport.js"},{});return Ss(e,t,void 0,{...o,metastep:"leaf inflow"},{leaflogic:(t,e)=>{const n=new Ct,r=e._stream.pipe(oe(...t.map(t=>t._stream)),Y(t=>(n.next(t[1]),t[0])),se());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(e,n)=>({...Ue(t,e),_control:n})},Es={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)=>{Bt("error",{type:"critical",message:"LEAF core error: race condition detected in leafoutflowport.js",codebase:"/src/ghostos/api/parser/nodelogic/io/leafoutflowport.js"},{});return Ss(e,t,void 0,{...o,metastep:"leaf outflow"},{leaflogic:(t,e)=>{const n=new Ct,r=e._stream.pipe(Y(t=>t),oe(...t.map(t=>t._stream)),Y(t=>(n.next(t[1]),t[0])),se());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...Ue(t),_control:e})};const Cs={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 F_({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)=>Ss(n,e,void 0,{...s,metastep:"invoking screenio"},{leaflogic:(t,e)=>{const n=new Ct,r=e._stream.pipe(oe(...t.map(t=>t._stream)),ue(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),ve(t[0])}),se());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{post:e=>{const n=(Array.isArray(e)?e:[e]).map(t=>qt("screenio",t)).filter(t=>t);void 0!==n&&t.gos.leafio.getMasterSubsDir()[o].main.doWrite({control:{},data:n});return Bt("screenio","written")}}})},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...ze(t),_control:e})};var Ms=r(8463),Is=r.n(Ms);function Ns(t){function e(t,e){return t<<e|t>>>32-e}function n(t){var e,n="";for(e=7;e>=0;e--)n+=(t>>>4*e&15).toString(16);return n}var r,i,o,s,a,u,c,l,h,d=new Array(80),p=1732584193,f=4023233417,m=2562383102,g=271733878,_=3285377520,y=(t=function(t){t=t.replace(/\r\n/g,"\n");for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?e+=String.fromCharCode(r):r>127&&r<2048?(e+=String.fromCharCode(r>>6|192),e+=String.fromCharCode(63&r|128)):(e+=String.fromCharCode(r>>12|224),e+=String.fromCharCode(r>>6&63|128),e+=String.fromCharCode(63&r|128))}return e}(t)).length,v=new Array;for(i=0;i<y-3;i+=4)o=t.charCodeAt(i)<<24|t.charCodeAt(i+1)<<16|t.charCodeAt(i+2)<<8|t.charCodeAt(i+3),v.push(o);switch(y%4){case 0:i=2147483648;break;case 1:i=t.charCodeAt(y-1)<<24|8388608;break;case 2:i=t.charCodeAt(y-2)<<24|t.charCodeAt(y-1)<<16|32768;break;case 3:i=t.charCodeAt(y-3)<<24|t.charCodeAt(y-2)<<16|t.charCodeAt(y-1)<<8|128}for(v.push(i);v.length%16!=14;)v.push(0);for(v.push(y>>>29),v.push(y<<3&4294967295),r=0;r<v.length;r+=16){for(i=0;i<16;i++)d[i]=v[r+i];for(i=16;i<=79;i++)d[i]=e(d[i-3]^d[i-8]^d[i-14]^d[i-16],1);for(s=p,a=f,u=m,c=g,l=_,i=0;i<=19;i++)h=e(s,5)+(a&u|~a&c)+l+d[i]+1518500249&4294967295,l=c,c=u,u=e(a,30),a=s,s=h;for(i=20;i<=39;i++)h=e(s,5)+(a^u^c)+l+d[i]+1859775393&4294967295,l=c,c=u,u=e(a,30),a=s,s=h;for(i=40;i<=59;i++)h=e(s,5)+(a&u|a&c|u&c)+l+d[i]+2400959708&4294967295,l=c,c=u,u=e(a,30),a=s,s=h;for(i=60;i<=79;i++)h=e(s,5)+(a^u^c)+l+d[i]+3395469782&4294967295,l=c,c=u,u=e(a,30),a=s,s=h;p=p+s&4294967295,f=f+a&4294967295,m=m+u&4294967295,g=g+c&4294967295,_=_+l&4294967295}return(h=n(p)+n(f)+n(m)+n(g)+n(_)).toLowerCase()}Bt("error",{type:"critical",message:"LEAF core error: race condition detected in leafmemoryio.js",codebase:"/src/ghostos/api/parser/nodelogic/io/leafmemoryio.js"},{});const js=it("leafmemoryio"),Rs={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await F_({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{type:s,args:a}=n.leaf.logic,u=Yo(js.editorconfig.namedatakey,a),{domain:c,appid:l}=t.gos.etaTree,h=`www.leafgon.com/mnemosyne/${c}/${l}/${u}`,d=cs(h,cs.URL),p="global"in o,f="on-tap"in o,m="proxy"in o,g=t.gos.etaTree.leafgraph.thespade?.uuid,_=g&&p?await t.gos.etaTree.lookupRuntimeLambdaLUT("breezyforest","main",g,t.gos.etaTree.leafgraph.edges.lambda.sourcelut[g],[]):void 0;e.slice(0,4);!!p&&(y=u,v=_,Object.keys(v).includes(y));var y,v;const b={codebase:"leafmemoryio.js",refnode:e,leafnode:"jest"!==e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e)?.leafnode.data};return(n,r)=>{const i=(n,r=void 0)=>{const i=r||d;if(void 0===n||(t=>!!Dt(t)&&("empty_bottle"===t._bname||"nothing"===t._bname))(n)){if(i in t.gos.etaTree.mnemosyne.current){const n=t.gos.etaTree.mnemosyne.current[i];return f?n.raw:Bt(u,n.raw,{_type:"memoryio",_command:"o",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}{const n=f?Bt("nothing",null,{_type:"memoryio",_command:"forget",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}}):null;return f?n:Bt(u,n,{_type:"memoryio",_command:"forget",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}}if("main"===u&&e.slice(0,4),Dt(o=n)&&void 0!==o._bname&&"memoryio"===o._label._type&&"forget"===o._label._command){const n=f?Bt("nothing",null,{_type:"memoryio",_command:"io",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}}):null,r=Is()(n),o={signature:Ns(r),payload:r,raw:n};return t.gos.etaTree.mnemosyne.current={...t.gos.etaTree.mnemosyne.current,[i]:o},f?n:Bt(u,n,{_type:"memoryio",_command:"io",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}{const r=n,o=Is()(r),s={signature:Ns(o),payload:o,raw:r};return t.gos.etaTree.mnemosyne.current={...t.gos.etaTree.mnemosyne.current,[i]:s},f?r:Bt(u,r,{_type:"memoryio",_command:"io",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}var o};return Ss(r,n,void 0,{...b,metastep:"memory io "+u},{leaflogic:(t,e)=>{const n=new Ct,r=e._stream.pipe(oe(...t.map(t=>t._stream)),Y(t=>{if(m){const e=t[0].sid.slice(-1).pop(),r=cs(`www.leafgon.com/mnemosyne/${c}/${l}/${u}/${e}`,cs.URL),o=i(t[1],r);n.next(o)}else{const e=i(t[1]);n.next(e)}return t[0]}),se());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={},s=t.gos.etaTree.leafgraph.thespade?.uuid;if(!!s&&t.gos.etaTree.leafgraph.edges.lambda.sourcelut[s].includes(e)){const{type:s,args:a}=n.leaf.logic,u=Yo(js.editorconfig.namedatakey,a);if(r.length>0){const n=await F_({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});o[u]={...n}}else o[u]={};return o}return o},methods:t=>({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=t=>t.hostEtaTree?(t.hostEtaTree,o(t.hostEtaTree)):t,s=o(t.gos.etaTree);return{etatreeforest:ls(s),general:{setMasterMemory:(e,n)=>{const{domain:r,appid:i}=t.gos.etaTree,o=cs(`www.leafgon.com/mnemosyne/${r}/${i}/${e}`,cs.URL);return s.mnemosyne.current[o]=n,n},getMasterMemory:e=>{const{domain:n,appid:r}=t.gos.etaTree,i=cs(`www.leafgon.com/mnemosyne/${n}/${r}/${e}`,cs.URL);return s.mnemosyne.current[i]}}}}};function Ps(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(t,e){return String.fromCharCode("0x"+e)}))}function Ds(t){return decodeURIComponent(atob(t).split("").map(function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)}).join(""))}Bt("error",{type:"critical",message:"LEAF core error: race condition detected in leaflisp.js",codebase:"/src/ghostos/api/parser/nodelogic/wizardry/leaflisp.js"},{});const Ls=t=>t>0?" ".repeat(t):"",Fs={trace:[],probe:[]},$s=(t,e=0,n=!1)=>{const r=typeof t,i=Ls(e),o=Ls(e+1);return"string"===r?(n?"":i)+`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"\n`:"object"===r?Array.isArray(t)?(n?"":i)+"[\n"+`${t.map(t=>$s(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+" "+$s(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 Bs=(t,e=!0)=>{if(null==t)return zo.Nothing;const n=typeof t;return"string"===n?di(t):"object"===n?Array.isArray(t)?Co(...t.filter(t=>t).map(t=>Bs(t,!1))):[null,void 0].includes(t)?zo.Nothing:Po(...Object.entries(t).map(([t,e])=>[di(t),Bs(e,!1)]).flat()):"boolean"===n?li(t):"number"===n?ki(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):zo.Nothing},qs=({_probefunc:t,_tracefunc:e}=args)=>({return:t=>t,outport:t=>t,undefined:zo.Nothing,nil:zo.Nothing,null:zo.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 di(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=>li("null"==t||t.constructor==zo.Nothing.constructor),isbottle:t=>{const e=t.toJSON();return li(Dt(e))},islist:t=>{const e=t.toJSON();return li(Array.isArray(e))},flatten:t=>{const e=t.toJSON();return Bs(e.flat().filter(t=>t),!1)},join:(t,e)=>{const n=t.toJSON();return di(n.join(e))},bottle:(t,e)=>{if(t.constructor!==hi)throw new ui(`Expected '${hi.kind??hi.name}', but got '${getObjectName(t.value)}'.`);const n=t.toJSON(),r=e.toJSON(),i="object"==typeof r&&!Array.isArray(r)&&"_content"in r&&"_label"in r?{_bname:n,_content:r._content,_label:r._label}:{_bname:n,_content:r,_label:{}};return Bs(i)},getbottle:(t,e)=>{if(t.constructor!==Eo)throw new ui(`Expected '${Eo.kind??Eo.name}', but got '${getObjectName(t.value)}'.`);const n=t.value.filter(t=>t.value.get("_bname").value===e.value);return 1===n.length?n[0]:n.length>1?n:void 0},unbottle:t=>{if(t.constructor!==Ro)throw new ui(`Expected '${Ro.kind??Ro.name}', but got '${getObjectName(t.value)}'.`);return t.value.get("_content")},regexp:(t,e)=>{const n=e.toJSON().match(/\/(.*)\/(.*)/),r=new RegExp(n[1],n[2]),i=t.toJSON(),o="string"===typeof i?i.match(r):[];return Bs(o||[])},min:t=>{if(t.constructor!==Eo)throw new ui(`Expected '${Eo.kind??Eo.name}', but got '${getObjectName(t.value)}'.`);const e=t.value.map(t=>t.value);return ki(Math.min(...e))},max:t=>{if(t.constructor!==Eo)throw new ui(`Expected '${Eo.kind??Eo.name}', but got '${getObjectName(t.value)}'.`);const e=t.value.map(t=>t.value);return ki(Math.max(...e))},parse:t=>{const e=t.toJSON();let n;return Si(e),n=Ai(e)?Oi(e):Ei(e),0===n.decimals?ki(n.intValue):ki(n.intValue,n.decimals)},"merge-dict":(t,e)=>{if(t.constructor!==Ro)throw new ui(`Expected '${Ro.kind??Ro.name}', but got '${getObjectName(t.value)}'.`);if(e.constructor!==Ro)throw new ui(`Expected '${Ro.kind??Ro.name}', but got '${getObjectName(e.value)}'.`);const n={...t.toJSON(),...e.toJSON()};return Bs(n)},"make-dict":(t,e)=>{if(t.constructor!==Eo)throw new ui(`Expected '${Eo.kind??Eo.name}', but got '${getObjectName(t.value)}'.`);if(e.constructor!==Eo)throw new ui(`Expected '${Eo.kind??Eo.name}', but got '${getObjectName(e.value)}'.`);const n=t.toJSON(),r=e.toJSON(),i=[...Array(n.length).keys()].reduce((t,e)=>({...t,[n[e]]:r[e]}),{});return Bs(i)},concat:(t,e)=>{if(t.constructor!==Eo)throw new ui(`Expected '${Eo.kind??Eo.name}', but got '${getObjectName(t.value)}'.`);if(e.constructor!==Eo)throw new ui(`Expected '${Eo.kind??Eo.name}', but got '${getObjectName(e.value)}'.`);return Co(...t.value.concat(e.value))},gload:t=>{zs(t.toJSON(),plisp_instance)},uuid4:()=>di(h()),uuid5:t=>{const e=cs(t.toString(),cs.URL);return di(e)},"*":(t,e)=>ki(t*e),"/":(t,e)=>ki(t/e),"+":(t,e)=>isNaN(t.value)||isNaN(e.value)?t.add(e):ki(t.value+e.value),"-":(t,e)=>ki(t-e),tofixed:(t,e)=>di(Number(t).toFixed(e))}),Us=(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=ps.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 vs(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}.`}),Bs(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}.`}),Bs(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}.`}),Bs(e))}};return new oi({globals:{...zo,...qs({}),...r},utils:Wo},Go)},Vs=["linear-algebra"],Gs={"linear-algebra":{lp:(t,e)=>Po(di("a"),t,di("b"),e)}},zs=(t,e)=>{Vs.includes(t)&&Object.entries(Gs[t]).map(([t,n])=>{e.interpreter.globals.define(t,zr(n))})},Ws=(t,e,n,r,i=0)=>{try{e?.slice(0,4);const r=n.insituexecute(t);try{return[0,r.toJSON()]}catch(t){return[0,null]}}catch(t){let n=[];if("errors"in t)for(let o of t.errors){const s=`LEAFlisp error: {refnode: ${e}}: ${"Parser"===t.type?`line: ${o.line-i} - ${o.message}`:`line: ${o.position?.line-i} - ${o.message}`}`;n.push(Bt("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 Js={};const Hs={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{let o,s;const a=ft().memoize(async()=>await As("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&&Fs.trace.length===r&&Fs.trace.shift(),Fs.trace.push({timestamp:Date.now(),address:u,refnode:e,trace:t}),vs(i.probe._default,Fs.trace,{},n).then(t=>{}))})},l=(t,n=e,r=1)=>{a().then(i=>{Object.entries(i).length>0&&(r>0&&Fs.probe.length===r&&Fs.probe.shift(),Fs.probe.push({timestamp:Date.now(),address:u,refnode:e,trace:t}),vs(i.probe._default,Fs.probe,{},n).then(t=>{}))})},h=await F_({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});Js[e]="interactive"in h;const d=Js[e],p=n.leaf.logic.args.lispexpression;o="global"in h?t.gos.etaTree.gRuntimeLEAFlisp:new oi({globals:{...zo,...qs({_probefunc:l,_tracefunc:c})},utils:Wo},Go);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 Ct;if(d){t.gos.etaTree.leafio.elementioLUT[e]=_;const n={graphuuid:"",domain:"breezyforest",appid:"leaflisp",graphaddrstr:"breezyforest/leaflisp"},r=ps.lambda(t)({refnode:"leaflisp_runtime_interactive",refnodedata:{leaf:{logic:{args:n}}},nodelambda:[],contextuallambda:[]}),i=await r;s=()=>{const n=Bt("dataevent",{_refnode:e,_provenance:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid,refnodedata:g.leafnode,codebase:"leaflisp.js"}},{});vs(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 ${$s(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]=Ws(r,e,o,g.leafaddress,i);return-1===t&&l(n,e),n}catch(t){throw new ui(`LEAFlisp Error: ${t}`)}};return Ss(i,r,void 0,{...g,metastep:"invoking leaflisp"},{leaflogic:d?(t,e)=>{const n=new Ct;let r=!1;const i=e._stream.pipe(Y(t=>(s&&s(),t)),oe(...t.map(t=>t._stream)),ue(t=>Ee(new It(t[0]),_)),Y(t=>{globalThis.DEBUG;const e=t[1];return r=!0,n.next(e),t[0]}),se());return{_stream:n.pipe(Q(t=>r),Y(t=>t),se()),_control:{...e,_stream:i}}}:(r,i)=>{const o=new Ct;let s=!1,a=p;const u=f?i._stream.pipe(Y(t=>t),oe(...r.map(t=>t._stream)),Y(r=>{globalThis.DEBUG;let i=r[1];if(Dt(i)&&"rewrite"===i._bname){const r=qt("*",i),o={...n},s=$s(null==r?[]:r);o.leaf.logic.args.lispexpression=s,n.leaf.logic.args.lispexpression=s,a=s,t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:Ps(JSON.stringify(o))}}),i=void 0}if(null!=i){s=!0;const t=c(i);return o.next(t),r[0]}}),Q(t=>void 0!==t),se()):m?i._stream.pipe(Y(t=>t),oe(...r.map(t=>t._stream)),Y(t=>{globalThis.DEBUG;const e=t[1];if(Dt(e)&&"codebottle"===e._bname){const n=qt("*",e);s=!0;const r=n.data,i=n.code,a=c(r,i);return o.next(a),t[0]}}),Q(t=>void 0!==t),se()):i._stream.pipe(Y(t=>t),oe(...r.map(t=>t._stream)),Y(t=>{globalThis.DEBUG;const e=t[1];s=!0;const n=c(e);return o.next(n),t[0]}),se());return{_stream:o.pipe(Q(t=>s),Y(t=>t),se()),_control:{...i,_stream:u}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>(n,r)=>({...Ue(e,n,!1,!1,!1,{provenance:"leaflisp.js lambda",refnode:e,etaTree:t.gos.etaTree}),_control:r}),methods:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={lispcode:""},s=(t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>(await F_({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{version:"breezyforest",nodequery:t=>({_stream:t._stream.pipe(map(t=>(node_output=n,node_output))),_control:controlflow$obj}),nodemethod:t=>({})}))(t)({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}),a=Js[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:Ps(JSON.stringify(i))}})},getTextSource:()=>n.leaf.logic.args.lispexpression},general:{getNodeData:()=>n,executeLEAFlisp:t=>run(t)}}}},Xs=(Bt("error",{type:"critical",message:"LEAF core error: race condition detected in leafchronosflow.js",codebase:"/src/ghostos/api/parser/nodelogic/dataflow/leafchronosflow.js"},{}),{dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await F_({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 Ct,r=t[0]._stream,i=e._stream.pipe(Y(t=>t),oe(r),Y(t=>(n.next(t[1]),t[0])),se());return{_stream:n.pipe(Y(t=>t),se()),_control:{...e,_stream:i.pipe(Y(t=>t),se())}}};return(t,n)=>{if(t.length>1){const r=ye(...t.map((t,e)=>t._stream.pipe(Y(t=>t),se())));if("concat"in o){return{...Ge(t),_control:n}}if("merge"in o){return{...ze(t),_control:n}}if("combine"in o){return{...Ue(e,t),_control:n}}if("substitute"in o){const e=Object.keys(o.substitute);return{...Ve(t,e),_control:n}}{const t=t=>t,e=n._stream.pipe(Y(t=>t));return Ss({_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 F_({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}}),Ks=(Bt("error",{type:"critical",message:"LEAF core error: race condition detected in leafmixflow.js",codebase:"/src/ghostos/api/parser/nodelogic/dataflow/leafmixflow.js"},{}),{dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await F_({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 Ct,r=e._stream.pipe(oe(...t.map(t=>t._stream)),ue(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?Bt("mix",u):u)):r&&!s?(u=[t[1]].flat().map(t=>Dt(t)?qt("*",t):void 0).filter(t=>t&&"empty_data"!==t),a||(u=[...new Set(u.flat())]),n.next(e?Bt("mix",u):u)):i&&!s?(u=[t[1]].flat().map(t=>Dt(t)?t:void 0).filter(t=>void 0!==t&&!Ft(t)),a||(u=[...new Set(u.flat())]),1===u.length?n.next(e?Bt("mix",u[0]):u[0]):n.next(e?Bt("mix",u):u)):(u={},[t[1]].flat().filter(t=>Dt(t)&&!Ft(t)).map(t=>{if(Dt(t))return u=((e,n={})=>{const r=e._bname;return{...n,[r]:qt("*",t)}})(t,u),t}),n.next(e?Bt("mix",u):u)),ve(t[0])}),se());return{_stream:n.pipe(Y(t=>t),se()),_control:{...e,_stream:r}}};return(t,n)=>{if(t.length>1){if("concat"in o){return{...Ge(t),_control:n}}if("merge"in o){return{...ze(t),_control:n}}if("combine"in o){return{...Ue(e,t),_control:n}}if("substitute"in o){const e=Object.keys(o.substitute);return{...Ve(t,e),_control:n}}{const e=t=>t,r=n._stream;return Ss({_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 Ss({_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 F_({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}}),Qs=(Bt("error",{type:"critical",message:"LEAF core error: race condition detected in leafgateflow.js",codebase:"/src/ghostos/api/parser/nodelogic/dataflow/leafgateflow.js"},{}),it("leafgateflow")),Zs={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 F_({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{type:s,args:a}=n.leaf.logic,u=Yo(Qs.editorconfig.namedatakey,a).toLowerCase(),c=Yo(Qs.editorconfig.toggledatakey,a),l=(()=>{const t=Object.keys(o).filter(t=>0===Object.keys(o[t]).length);return t.length>0?t.sort().join(";"):void 0})(),h={codebase:"leafgateflow.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>Ss(e,t,void 0,{...h,metastep:"gateflow "+(c?"NOT gate, ":"normal gate, ")+u},{leaflogic:(t,e)=>{const n=new Ct,r=e._stream.pipe(oe(...t.map(t=>t._stream)),Y(t=>{const e=t[1],r=t=>Dt(t)?!c&&t._bname?.toLowerCase()===u||c&&t._bname?.toLowerCase()!==u?t:void 0:"{crate}"===u?!c&&t._cratelabel?"uncrate"===l?Object.keys(t).filter(t=>"_cratelabel"!==t).map(e=>t[e]).flat():t:c&&!t._cratelabel?t:void 0:((t,e)=>{const n=t?Object.entries(t).map(t=>t[0]+"="+("object"==typeof t[1]?JSON.stringify(t[1]):t[1])):[];if(e?!n.includes(u):n.includes(u))return t})(t,c),i=Array.isArray(e),o=i?e.map(t=>r(t)).filter(t=>void 0!==t):r(e);if(o?.length>0||!i&&void 0!==o)return n.next(o),t[0]}),Q(t=>void 0!==t),se());return{_stream:n.pipe(Y(t=>t),se()),_control:{...e,_stream:r.pipe(Y(t=>t),se())}}},datalogic:{post:t=>t}})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await F_({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}},Ys=Bt("error",{type:"critical",message:"LEAF core error: race condition detected in mediaplayer.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/mediaplayer.js"},{}),ta=t=>{const e=t[m_.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[m_.REFNODE]};return{leaflogic:(e,i)=>{const o=Ss(i,e,void 0,r,{leaflogic:n,datalogic:{post:e=>(t[m_.mediaplayer.URI]=e,e)}})._control,s=new It(Ys),a=o._stream.pipe(oe(...e.map(t=>t._stream)),Y(t=>{const e=t[1];return s.next(e),t[0]}));return{_stream:s,_control:{_stream:a}}},datalogic:{pre:t=>t,post:n=>{const r=Object.keys(e);["uri"].filter(t=>r.includes(t)),e.margin&&Object.keys(e.margin),e.fieldwidth&&Object.keys(e.fieldwidth);return g_({element:{nodeuuid:t[m_.REFNODE],type:"mediaplayer",componentdata:{uri:t[m_.mediaplayer.URI],...t[m_.RTCONTEXT]}}},"screenio")}}}},ea=Bt("error",{type:"critical",message:"LEAF core error: race condition detected in prompt.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/prompt.js"},{}),na=t=>{const e=t[m_.LAMBDA_OBJ],n="uidefs"in e&&"_default"in e.uidefs?e.uidefs._default:void 0,r=("margin"in e&&"_default"in e.margin&&e.margin._default,"fieldwidth"in e&&"_default"in e.fieldwidth&&e.fieldwidth._default,new Ct),i={codebase:"ghostos/api/parser/nodelogic/elements/library/prompt.js",refnode:t[m_.REFNODE]};return{elementio$:r,leaflogic:(o,s)=>{const a=new Ct,u=n?Ss(s,o,void 0,i,{leaflogic:n,datalogic:{post:e=>(t[m_.prompt.UIDEFS]=e,e)}}):{_stream:ve('[ ; an open square bracket [ denotes the beginning of a list, followed by a matching \n ; close square bracket ] appearing at the end of this page. you can bring your blinking cursor\n ; to one of the brackets and type Shift-5 (or %) to jump the cursor in between a pair of matching brackets. \n ; please give it a go, it is a fun way to read any text written in LEAFlisp. \n ; other helpful command keys to help you navigate LEAFlisp include h j k l with which the blinking cursor\n ; can be moved to the left, down, up and right respectively. Also useful are w b respectively used to command\n ; the cursor to move forward and backward by one word along the line. Shift-v can be used to select one line,\n ; v to select from where the cursor currently is and navigating away from the initial cursor point by using\n ; any mix of the navigation command keys, namely h j k l w and b would allow you to select any range of text of interest.\n ; at which point you could either copy, delete and/or paste the selected text by respectively pressing y, d and p\n ; pressing u would undo the changes you have made going back in time one change by one change as you repeat u in a series. \n ; Ctrl-r would redo what had been undone. \n ; using the command keys would require the editor to be in the "command" mode. pressing the escape key would put the editor \n ; in the "command" mode, while pressing i would put the editor in the "edit" mode in which none of the navigation keys\n ; would work as navigation commands but as entering respective alphabets instead. \n ; \n {\n :prompt "setting"\n :backgroundColor "primary.light" \n ; "primary.dark" | "secondary.light" "secondary.dark"\n :margin "1" \n ; please note that any positive number in between quotes is accepted here. \n ; the recommended value however would range from 0 to 20 in almost all general \n ; usage scenarios where 0 to 5 whould perhaps comprise about 90% of the cases. \n :fieldWidth "45ch" \n ; ch is a unit length represented in terms of the width of the letter 0 (zero).\n ; so "15ch" would result in the width as wide as 15 zeros for all the text inputs below. \n ; please refer to the following site for units in html/css lingo, if you have all the time in the world.\n ; https://www.w3schools.com/cssref/css_units.asp for units\n :buttonWidth "20ch"\n ; likewise, buttonWidth specifies the width of all the buttons declared below. \n }\n {\n :prompt "text"\n :key "maintext1" ; :key is a user-defined string value, that should be unique within the context of the UI definition.\n :label "LEAF newsletter mailing list" ; a user-defined string label to be displayed on the text input.\n :variant "outlined" ; a text :variant with a choice of "standard", "outlined", or "filled" as its style.\n :multiline true\n :rows "2"\n :InputProps {:readOnly true}\n :defaultValue "Please fill out the info and subscribe to the mailing list."\n }\n {\n :prompt "text"\n ;:key (get (get (get (get uinodes 1) :meta) :label) :id) ; :key is a user-defined string value, that should be unique within the context of the UI definition.\n :key "name" ; :key is a user-defined string value, that should be unique within the context of the UI definition.\n ;:id (get (get (get (get uinodes 1) :meta) :label) :id)\n :fieldWidth "25ch" \n :required true ;true\n :group 1\n :label "Your name" ;(get (get (get (get uinodes 1) :meta) :label) :text); a user-defined string label to be displayed on the text input.\n :variant "standard" ; a text :variant with a choice of "standard", "outlined", or "filled" as its style.\n }\n {\n :prompt "text"\n :key "email"\n :fieldWidth "25ch" \n :required true\n :label "Your email"\n :type "email"\n :variant "standard"\n }\n { \n :prompt "button"\n :color "secondary" \n ; the value can be of "primary", "secondary", "error", "warning", "info", "success"\n :variant "outlined"\n ; the value can be of "text", "contained", "outlined"\n :key "subscribebtn"\n ; :href "/editor/breezyforest/main"\n ; :href can support a relative path\n :label "Subscribe"\n }\n ]'),_control:{_stream:s._stream}};const c=u._control._stream.pipe(oe(u._stream),ue(n=>{const i=n[1];t[m_.CTRLIN]=n[0];const o=Object.keys(e),s=(["uidefs","margin","fieldwidth"].filter(t=>o.includes(t)),e.margin?Object.keys(e.margin):void 0),a=e.fieldwidth?Object.keys(e.fieldwidth):void 0,u=Dt(i)&&"error"===i._bname?void 0:Array.isArray(i)?g_({element:{nodeuuid:t[m_.REFNODE],type:"prompt",componentdata:{nodeuuid:t[m_.REFNODE],uidefs:i,margin:s?s[0]:1,fieldwidth:a?a[0]:"25ch",...t[m_.RTCONTEXT]}}},"screenio"):void 0;return u?ye(ve(u),r):r}),Y(e=>(a.next(e),t[m_.CTRLIN])),se());return{_stream:a.pipe(Q(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(ea)),Y(t=>t),se()),_control:{_stream:c.pipe(Y(t=>t),se())}}},datalogic:{pre:t=>t,post:t=>t}}},ra=Bt("error",{type:"critical",message:"LEAF core error: race condition detected in popup.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/popup.js"},{}),ia=t=>{const e=t[m_.LAMBDA_OBJ],n=new Ct,r=new Ct;return{elementio$:r,leaflogic:(i,o)=>{const s=o._stream.pipe(oe(...i.map(t=>t._stream)),ue(t=>Ee(new It(t[0]),ye(new It(t[1]),r))),ue(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(Dt(n)){if("screenio"===n._bname){const i=qt("screenio",n);return g_({element:{nodeuuid:t[m_.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 vs(n,[],{...t[m_.RTCONTEXT]._config}):[];return r.next(Bt("elementio",{element:"popup",nodeuuid:t[m_.REFNODE],io:{onclose:i}})),i},children:Array.isArray(i)?i:[i],...t[m_.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]),ve(i[0])}));return{_stream:n.pipe(Q(t=>JSON.stringify(t)!==JSON.stringify(ra)),Y(t=>t)),_control:{_stream:s}}},datalogic:{pre:t=>t,post:t=>t}}},oa=Bt("error",{type:"critical",message:"LEAF core error: race condition detected in editor.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/editor.js"},{}),sa=t=>{const e=t[m_.LAMBDA_OBJ];"uidefs"in e&&"_default"in e.uidefs&&e.uidefs._default,"margin"in e&&"_default"in e.margin&&e.margin._default,"fieldwidth"in e&&"_default"in e.fieldwidth&&e.fieldwidth._default;return{leaflogic:(e,n)=>{const r=new It(oa),i=n._stream.pipe(be(n=>{t[m_.CTRLIN]=n;return Ee([...e.map(t=>t._stream)])}),Y(e=>(e.length>1?r.next(e):1===e.length&&r.next(e[0]),t[m_.CTRLIN])));return{_stream:r,_control:{_stream:i}}},datalogic:{pre:t=>t,post:n=>{const r=Object.keys(e),i=["top","bottom","left","right","topleft","topright","bottomleft","bottomright","center","centre"].filter(t=>r.includes(t));i.length>0&&i[0];let o=n;o=1===o.length?o[0]:o;return g_({element:{nodeuuid:t[m_.REFNODE],type:"editor",componentdata:{domain:t[m_.DOMAIN],appid:t[m_.APPID],...t[m_.RTCONTEXT]}}},"screenio")}}}},aa=(Bt("error",{type:"critical",message:"LEAF core error: race condition detected in text.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/text.js"},{}),t=>{const e=t[m_.LAMBDA_OBJ];return{leaflogic:(t,e)=>{const n=new Ct,r=e._stream.pipe(oe(...t.map(t=>t._stream)),Y(t=>{const e=t[1];return n.next(e),t[0]}));return{_stream:n,_control:{_stream:r}}},datalogic:{pre:t=>t,post:n=>{const r=Object.keys(e),i=(["lambda","onsave","gspot"].filter(t=>r.includes(t)),"lambda"in e?"lambda":"dataflow");let o;Dt(n)&&n._content?._provenance?.refnodedata?(t[m_.RTCONTEXT].lambdarefnodedata=n._content?._provenance?.refnodedata,t[m_.RTCONTEXT].lambdasourceuuid=n._content?._refnode,o=n):o=n;return g_({element:{nodeuuid:t[m_.REFNODE],type:"text",componentdata:{refnode:t[m_.REFNODE],textsource:i,lambdarefnodedata:t[m_.RTCONTEXT].lambdarefnodedata,lambdasourceuuid:t[m_.RTCONTEXT].lambdasourceuuid,dataflowinput:o,domain:t[m_.DOMAIN],appid:t[m_.APPID],...t[m_.RTCONTEXT]}}},"screenio")}}}}),ua=(Bt("error",{type:"critical",message:"LEAF core error: race condition detected in image.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/image.js"},{}),t=>{const e=t[m_.LAMBDA_OBJ];return{leaflogic:(e,n)=>{const r=new Ct,i=n._stream.pipe(oe(...e.map(t=>t._stream)),Y(e=>{t[m_.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(Dt(t)&&"image"===t._bname)return qt("image",t)}).filter(t=>t);return 1===e.length?e[0]:e.length>1?e:void 0},post:n=>{const r=Object.keys(e);["onclose"].filter(t=>r.includes(t)),"onclose"in e&&e.onclose;return g_({element:{nodeuuid:t[m_.REFNODE],type:"image",componentdata:{imagelist:Array.isArray(n)?n:[n],...t[m_.RTCONTEXT]}}},"screenio")}}}}),ca=(Bt("error",{type:"critical",message:"LEAF core error: race condition detected in mediainput.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/mediainput.js"},{}),t=>{const e=t[m_.LAMBDA_OBJ],n=("uidefs"in e&&"_default"in e.uidefs&&e.uidefs._default,"margin"in e&&"_default"in e.margin&&e.margin._default,"fieldwidth"in e&&"_default"in e.fieldwidth&&e.fieldwidth._default,new Ct);return{elementio$:n,leaflogic:(r,i)=>{const o=new Ct,s=i._stream.pipe(oe(...r.map(t=>t._stream)),ue(r=>{t[m_.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=g_({element:{nodeuuid:t[m_.REFNODE],type:"mediainput",componentdata:{mediatype:a,nodeinput:c,callbacks:{onDropAccepted:async r=>{const i=e.ondrop?._default?await vs(e.ondrop._default,[Bt("elementinput",r),Bt("nodeinput",c)],{},t[m_.REFNODE]):void 0,o=Bt("elementio",i);n.next(o)}}}}},"screenio");return l?ye(new It(l),n):n}),ue(e=>(o.next(e),new It(t[m_.CTRLIN]))),se());return{_stream:o.pipe(Y(t=>t),or(()=>{}),se()),_control:{_stream:s.pipe(Y(t=>t),or(()=>{}),se())}}},datalogic:{pre:t=>t,post:t=>{let e=t;return e=1===e.length?e[0]:e,e}}}});var la=r(7799),ha=r.n(la);const{JZZ:da}=ha(),pa=(Bt("error",{type:"critical",message:"LEAF core error: race condition detected in midi.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/midi.js"},{}),t=>{const e=t[m_.LAMBDA_OBJ],n=new Ct;let r=-1;const i=t=>{if(r=(r+1)%24,0===r){}const[e,i,o,s]=t;n.next(Bt("_midi_in",{cmd:e,noteNumber:i,velocity:o},{timestamp:Date.now()}))},o={};return{leaflogic:(e,r)=>{const s=new Ct,a=r._stream.pipe(ue(r=>{t[m_.CTRLIN]=r,"default"in o||(o.default=da().openMidiIn().or("Error: Cannot open MIDI In port").and(t=>{}).connect(i));return ye(...e.map(t=>t._stream),n)}),Y(e=>{!Array.isArray(e)&&e._bname;const n=(Array.isArray(e)?e:[e]).map(t=>"_data_in"===t._bname?Ft(t._content)?void 0:qt("*",t):Dt(t)?t:void 0).filter(t=>t);return n.length>0&&s.next(n),t[m_.CTRLIN]}),se());return{_stream:s,_control:{_stream:a}}},datalogic:{pre:t=>Bt("_data_in",t),post:t=>{const n=Object.keys(e),r=["image","audio","video"].filter(t=>n.includes(t));r.length>0&&r[0];let i=t;i=1===i.length?i[0]:i;return i}}}});function fa(t){return Math.pow(2,t/12)}let ma=440;function ga(t){return Math.round(_a(t))}function _a(t){return 69+12*Math.log2(t/ma)}function ya(t){return ma*Math.pow(2,(t-69)/12)}var va=r(1795);const ba=new WeakSet,wa=new WeakMap,xa=new WeakMap,Ta=new WeakMap,ka=new WeakMap,Sa=new WeakMap,Aa=new WeakMap,Oa=new WeakMap,Ea=new WeakMap,Ca=new WeakMap,Ma={construct:()=>Ma},Ia=/^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]*);?/,Na=(t,e)=>{const n=[];let r=t.replace(/^[\s]+/,""),i=r.match(Ia);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(Ia)}return[n.join(";"),r]},ja=t=>{if(void 0!==t&&!Array.isArray(t))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},Ra=t=>{if(!(t=>{try{new new Proxy(t,Ma)}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.")},Pa=(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},Da=(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},La=(t,e,n,r)=>{const i=Pa(t,e),o=Da(i,t=>t[0]===n&&t[1]===r);return 0===i.size&&t.delete(e),o},Fa=t=>Pa(Aa,t),$a=t=>{if(ba.has(t))throw new Error("The AudioNode is already stored.");ba.add(t),Fa(t).forEach(t=>t(!0))},Ba=t=>"port"in t,qa=t=>{if(!ba.has(t))throw new Error("The AudioNode is not stored.");ba.delete(t),Fa(t).forEach(t=>t(!1))},Ua=(t,e)=>{!Ba(t)&&e.every(t=>0===t.size)&&qa(t)},Va={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},Ga=(t,e)=>t.context===e,za=t=>{try{t.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},Wa=()=>new DOMException("","IndexSizeError"),Ja=t=>{var e;t.getChannelData=(e=t.getChannelData,n=>{try{return e.call(t,n)}catch(t){if(12===t.code)throw Wa();throw t}})},Ha={numberOfChannels:1},Xa=-34028234663852886e22,Ka=-Xa,Qa=t=>ba.has(t),Za={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},Ya=t=>Pa(wa,t),tu=t=>Pa(Ta,t),eu=(t,e)=>{const{activeInputs:n}=Ya(t);n.forEach(n=>n.forEach(([n])=>{e.includes(t)||eu(n,[...e,t])}));const r=(t=>"playbackRate"in t)(t)?[t.playbackRate]:Ba(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=tu(t);void 0!==n&&n.activeInputs.forEach(([t])=>eu(t,e))}Qa(t)&&qa(t)},nu=t=>{eu(t.destination,[])},ru=t=>void 0===t||"number"==typeof t||"string"==typeof t&&("balanced"===t||"interactive"===t||"playback"===t),iu=t=>"context"in t,ou=t=>iu(t[0]),su=(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},au=(t,e,[n,r],i)=>{su(t,[e,n,r],t=>t[0]===e&&t[1]===n,i)},uu=(t,[e,n,r],i)=>{const o=t.get(e);void 0===o?t.set(e,new Set([[n,r]])):su(o,[n,r],t=>t[0]===n,i)},cu=t=>"inputs"in t,lu=(t,e,n,r)=>{if(cu(e)){const i=e.inputs[r];return t.connect(i,n,0),[i,n,0]}return t.connect(e,n,r),[e,n,r]},hu=(t,e,n)=>{for(const r of t)if(r[0]===e&&r[1]===n)return t.delete(r),r;return null},du=(t,e)=>{if(!Fa(t).delete(e))throw new Error("Missing the expected event listener.")},pu=(t,e,n)=>{const r=Pa(t,e),i=Da(r,t=>t[0]===n);return 0===r.size&&t.delete(e),i},fu=(t,e,n,r)=>{cu(e)?t.disconnect(e.inputs[r],n,0):t.disconnect(e,n,r)},mu=t=>Pa(xa,t),gu=t=>Pa(ka,t),_u=t=>Oa.has(t),yu=t=>!ba.has(t),vu=(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()}}),bu=(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))},wu=t=>"context"in t,xu=t=>{const e=new Map;t.connect=(t=>(n,r=0,i=0)=>{const o=wu(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=>{wu(n)?t.connect(n,e.output,e.input):t.connect(n,e.output)})})(t.disconnect)},Tu=(t,e,n,r)=>{const{activeInputs:i,passiveInputs:o}=tu(e),{outputs:s}=Ya(t),a=Fa(t),u=s=>{const a=mu(t),u=gu(e);if(s){const e=pu(o,t,n);au(i,t,e,!1),r||_u(t)||a.connect(u,n)}else{const e=((t,e,n)=>Da(t,t=>t[0]===e&&t[1]===n))(i,t,n);uu(o,e,!1),r||_u(t)||a.disconnect(u,n)}};return!!su(s,[e,n],t=>t[0]===e&&t[1]===n,!0)&&(a.add(u),Qa(t)?au(i,t,[n,u],!0):uu(o,[t,n,u],!0),!0)},ku=(t,e,n,r,i)=>{const[o,s]=((t,e,n,r)=>{const{activeInputs:i,passiveInputs:o}=Ya(e),s=hu(i[r],t,n);if(null===s)return[La(o,t,n,r)[2],!1];return[s[2],!0]})(t,n,r,i);if(null!==o&&(du(t,o),!s||e||_u(t)||fu(mu(t),mu(n),r,i)),Qa(n)){const{activeInputs:t}=Ya(n);Ua(n,t)}},Su=(t,e,n,r)=>{const[i,o]=((t,e,n)=>{const{activeInputs:r,passiveInputs:i}=tu(e),o=hu(r,t,n);if(null===o)return[pu(i,t,n)[1],!1];return[o[2],!0]})(t,n,r);null!==i&&(du(t,i),!o||e||_u(t)||mu(t).disconnect(gu(n),r))};class Au{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 Ou={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}};function Eu(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 Cu=(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)},Mu=(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},Iu=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=Ya(t),d=await((t,e)=>{const n=Pa(Ca,t),r=mu(e);return Pa(n,r)})(n,t),p=Mu(r.numberOfInputs,r.channelCount),f=Mu(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)Eu(e,p[t],n,n,c);void 0!==o.parameterDescriptors&&null!==e&&o.parameterDescriptors.forEach(({name:t},n)=>{Eu(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)Cu(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},Nu={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},ju={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},Ru={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},Pu={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},Du={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},Lu=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()}})},Fu={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},$u=(t,e,n)=>{const r=e[n];if(void 0===r)throw t();return r},Bu={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},qu={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},Uu=()=>new DOMException("","InvalidStateError"),Vu=()=>new DOMException("","InvalidAccessError"),Gu={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},zu=(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},Wu={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},Ju=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},Hu={numberOfChannels:1},Xu=(t,e,n)=>{const r=e[n];void 0!==r&&r!==t[n]&&(t[n]=r)},Ku=(t,e)=>{Xu(t,e,"channelCount"),Xu(t,e,"channelCountMode"),Xu(t,e,"channelInterpretation")},Qu=t=>"function"==typeof t.getFloatTimeDomainData,Zu=(t,e,n)=>{const r=e[n];void 0!==r&&r!==t[n].value&&(t[n].value=r)},Yu=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)},tc=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)})},ec=(t,e)=>null===t?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(t*e))))),nc=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)},rc=(t,e)=>{const n=t.createBiquadFilter();return Ku(n,e),Zu(n,e,"Q"),Zu(n,e,"detune"),Zu(n,e,"frequency"),Zu(n,e,"gain"),Xu(n,e,"type"),n},ic=(t,e)=>{const n=t.createChannelSplitter(e.numberOfOutputs);return Ku(n,e),(t=>{const e=t.numberOfOutputs;Object.defineProperty(t,"channelCount",{get:()=>e,set:t=>{if(t!==e)throw Uu()}}),Object.defineProperty(t,"channelCountMode",{get:()=>"explicit",set:t=>{if("explicit"!==t)throw Uu()}}),Object.defineProperty(t,"channelInterpretation",{get:()=>"discrete",set:t=>{if("discrete"!==t)throw Uu()}})})(n),n},oc=(t,e)=>(t.connect=e.connect.bind(e),t.disconnect=e.disconnect.bind(e),t),sc=(t,e)=>{const n=t.createDelay(e.maxDelayTime);return Ku(n,e),Zu(n,e,"delayTime"),n},ac=(t,e)=>{const n=t.createGain();return Ku(n,e),Zu(n,e,"gain"),n};function uc(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 cc(t,e){return[t[0]*e[0]-t[1]*e[1],t[0]*e[1]+t[1]*e[0]]}function lc(t,e){let n=[0,0];for(let r=t.length-1;r>=0;r-=1)n=cc(n,e),n[0]+=t[r];return n}const hc=(t,e,n,r)=>t.createScriptProcessor(e,n,r),dc=()=>new DOMException("","NotSupportedError"),pc={numberOfChannels:1},fc={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},mc={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},gc={disableNormalization:!1},_c={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},yc=()=>new DOMException("","UnknownError"),vc={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},bc=(t,e,n)=>void 0===t.copyFromChannel?t.getChannelData(n)[0]:(t.copyFromChannel(e,n),e[0]),wc=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},xc=(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)})},Tc=(t,e,n)=>{try{t.setValueAtTime(e,n)}catch(r){if(9!==r.code)throw r;Tc(t,e,n+1e-7)}},kc=t=>{const e=t.createOscillator();try{e.start(-1)}catch(t){return t instanceof RangeError}return!1},Sc=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}},Ac=t=>{const e=t.createOscillator();try{e.stop(-1)}catch(t){return t instanceof RangeError}return!1},Oc=(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),oc(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)},Ec=(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)},Cc=(t=>(e,n,[r,i,o],s)=>{t(e[i],[n,r,o],t=>t[0]===n&&t[1]===r,s)})(su),Mc=(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)})(su),Ic=(t=>(e,n,r,i)=>t(e[i],t=>t[0]===n&&t[1]===r))(Da),Nc=new WeakMap,jc=(t=>e=>{var n;return null!==(n=t.get(e))&&void 0!==n?n:0})(Nc),Rc=(Pc=new Map,Dc=new WeakMap,(t,e)=>{const n=Dc.get(t);if(void 0!==n)return n;const r=Pc.get(t);if(void 0!==r)return r;try{const n=e();return n instanceof Promise?(Pc.set(t,n),n.catch(()=>!1).then(e=>(Pc.delete(t),Dc.set(t,e),e))):(Dc.set(t,n),n)}catch{return Dc.set(t,!1),!1}});var Pc,Dc;const Lc="undefined"==typeof window?null:window,Fc=((t,e)=>(n,r)=>{const i=n.createAnalyser();if(Ku(i,r),!(r.maxDecibels>r.minDecibels))throw e();return Xu(i,r,"fftSize"),Xu(i,r,"maxDecibels"),Xu(i,r,"minDecibels"),Xu(i,r,"smoothingTimeConstant"),t(Qu,()=>Qu(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})(Rc,Wa),$c=(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})(Ya),Bc=((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],[]))})(Ya,$c,_u),qc=((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(!Ga(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)}}})(Fc,mu,Bc),Uc=(Vc=Sa,t=>{const e=Vc.get(t);if(void 0===e)throw Uu();return e});var Vc;const Gc=(t=>null===t?null:t.hasOwnProperty("OfflineAudioContext")?t.OfflineAudioContext:t.hasOwnProperty("webkitOfflineAudioContext")?t.webkitOfflineAudioContext:null)(Lc),zc=(t=>e=>null!==t&&e instanceof t)(Gc),Wc=new WeakMap,Jc=(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)}})(Ec),Hc=(t=>null===t?null:t.hasOwnProperty("AudioContext")?t.AudioContext:t.hasOwnProperty("webkitAudioContext")?t.webkitAudioContext:null)(Lc),Xc=(t=>e=>null!==t&&e instanceof t)(Hc),Kc=(t=>e=>null!==t&&"function"==typeof t.AudioNode&&e instanceof t.AudioNode)(Lc),Qc=(t=>e=>null!==t&&"function"==typeof t.AudioParam&&e instanceof t.AudioParam)(Lc),Zc=(t=>null===t?null:t.hasOwnProperty("AudioWorkletNode")?t.AudioWorkletNode:null)(Lc),Yc=((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(vu,()=>vu(s,m))&&xu(i),xa.set(this,i),Aa.set(this,new Set),"closed"!==e.state&&r&&$a(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(iu(t)){const i=mu(t);try{const e=lu(this._nativeAudioNode,i,n,a),r=yu(this);(h||r)&&this._nativeAudioNode.disconnect(...e),"closed"!==this.context.state&&!r&&yu(t)&&$a(t)}catch(t){if(12===t.code)throw o();throw t}if(e(this,t,n,a,h)){const e=u([this],t);bu(e,r(h))}return t}const m=gu(t);if("playbackRate"===m.name&&1024===m.maxValue)throw s();try{this._nativeAudioNode.connect(m,n),(h||yu(this))&&this._nativeAudioNode.disconnect(m,n)}catch(t){if(12===t.code)throw o();throw t}if(Tu(this,t,n,h)){const e=u([this],t);bu(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=Ya(t),r=[];for(const i of n.outputs)ou(i)?ku(t,e,...i):Su(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=Ya(t),i=[];for(const o of r.outputs)o[1]===n&&(ou(o)?ku(t,e,...o):Su(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(iu(t)&&void 0!==n&&(n<0||n>=t.numberOfInputs))throw i();if(r=((t,e,n,r,i)=>{const o=Ya(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=>(ou(n)?ku(t,e,...n):Su(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);bu(e,a)}}})((tl=wa,(t,e,n)=>{const r=[];for(let t=0;t<n.numberOfInputs;t+=1)r.push(new Set);tl.set(t,{activeInputs:r,outputs:new Set,passiveInputs:new WeakMap,renderer:e})}),((t,e,n,r,i,o,s,a,u,c,l,h,d)=>{const p=new WeakMap;return(f,m,g,_,y)=>{const{activeInputs:v,passiveInputs:b}=o(m),{outputs:w}=o(f),x=a(f),T=o=>{const a=u(m),c=u(f);if(o){const e=La(b,f,g,_);t(v,f,e,!1),y||h(f)||n(c,a,g,_),d(m)&&$a(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)&&Ua(m,v);else{const t=p.get(m);void 0!==t&&clearTimeout(t),p.set(m,setTimeout(()=>{l(m)&&Ua(m,v)},1e3*n))}}};return!!c(w,[m,g,_],t=>t[0]===m&&t[1]===g&&t[2]===_,!0)&&(x.add(T),l(f)?t(v,f,[g,_,T],!0):e(b,_,[f,g,T],!0),!0)}})(Cc,Mc,lu,Ic,fu,Ya,jc,Fa,mu,su,Qa,_u,yu),Rc,((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(ou(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)})(Oa,fu,Ya,mu,gu,Qa),Wa,Vu,dc,((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(ou(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)})(lu,Oa,Ya,mu,gu,Uc,Qa,zc),((t,e,n)=>function r(i,o){const s=iu(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),[])})(Wc,Ya,Pa),Jc,Uc,Xc,Kc,Qc,zc,Zc);var tl;const el=((t,e,n,r,i,o)=>class extends t{constructor(t,n){const s=i(t),a={...Va,...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)}})(Yc,qc,Wa,Fc,Uc,zc),nl=new WeakSet,rl=(t=>null===t?null:t.hasOwnProperty("AudioBuffer")?t.AudioBuffer:null)(Lc),il=(ol=new Uint32Array(1),t=>(ol[0]=t,ol[0]));var ol;const sl=((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]}})(il,Wa),al=(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)})(il),ul=((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}={...Ha,...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),Ja(p)):e(za,()=>za(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)}}})(nl,Rc,dc,rl,Gc,(t=>()=>{if(null===t)return!1;try{new t({length:1,sampleRate:44100})}catch{return!1}return!0})(rl),sl,al),cl=(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)})(ac),ll=((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)}))})($c,tu,_u),hl=(t=>(e,n,r)=>t(n,e,r))(ll),dl=((t,e,n,r,i,o,s,a,u,c,l)=>(h,d)=>{const p=h.createBufferSource();return Ku(p,d),Zu(p,d,"playbackRate"),Xu(p,d,"buffer"),Xu(p,d,"loop"),Xu(p,d,"loopEnd"),Xu(p,d,"loopStart"),e(n,()=>n(h))||(t=>{t.start=(e=>{let n=!1;return(r=0,i=0,o)=>{if(n)throw Uu();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))||Yu(p),e(s,()=>s(h))||l(p,h),e(a,()=>a(h))||tc(p),t(h,p),p})(cl,Rc,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},kc,Sc,Ac,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))})(xc),Oc),pl=((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})(tu),ll),fl=((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=Ga(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)}}})(hl,dl,mu,pl,Bc),ml=((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 va.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})((gl=Ta,(t,e)=>{gl.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:e})}),Wc,ka,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)}}}}),va.createCancelAndHoldAutomationEvent,va.createCancelScheduledValuesAutomationEvent,va.createExponentialRampToValueAutomationEvent,va.createLinearRampToValueAutomationEvent,va.createSetTargetAutomationEvent,va.createSetValueAutomationEvent,va.createSetValueCurveAutomationEvent,Hc,Tc);var gl;const _l=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,r){const a=o(t),u={...Za,...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,Ka,Xa)}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){$a(this);const t=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",t),Qa(this)&&qa(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeAudioBufferSourceNode.stop(t),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.stop=t)}})(Yc,fl,ml,Uu,dl,Uc,zc,Ec),yl=((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}})(Yc,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)}}},Wa,Uu,((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})(ac,xc),Uc,zc,Bc),vl=((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=Ga(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)}}})(hl,rc,mu,pl,Bc),bl=(t=>(e,n)=>t.set(e,n))(Nc),wl=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,r){const u=o(t),c={...Nu,...r},l=i(u,c),h=s(u);super(t,!1,l,h?n():null),this._Q=e(this,h,l.Q,Ka,Xa),this._detune=e(this,h,l.detune,1200*Math.log2(Ka),-1200*Math.log2(Ka)),this._frequency=e(this,h,l.frequency,t.sampleRate/2,0),this._gain=e(this,h,l.gain,40*Math.log10(Ka),Xa),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()}})(Yc,ml,vl,Vu,rc,Uc,zc,bl),xl=((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})(su,Kc),Tl=((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))})(Uu,xl),kl=((t,e)=>(n,r)=>{const i=n.createChannelMerger(r.numberOfInputs);return null!==t&&"webkitAudioContext"===t.name&&e(n,i),Ku(i,r),i})(Hc,Tl),Sl=((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(!Ga(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)}}})(kl,mu,Bc),Al=((t,e,n,r,i)=>class extends t{constructor(t,o){const s=r(t),a={...ju,...o};super(t,!1,n(s,a),i(s)?e():null)}})(Yc,Sl,kl,Uc,zc),Ol=((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(!Ga(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)}}})(ic,mu,Bc),El=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u=o({...Ru,...s});super(t,!1,n(a,u),i(a)?e():null)}})(Yc,Ol,ic,Uc,zc,t=>({...t,channelCount:t.numberOfOutputs})),Cl=((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(oc(h,c),()=>u.connect(c),()=>u.disconnect(c))})(cl,dl,ac,xl),Ml=((t,e,n,r,i)=>(o,s)=>{if(void 0===o.createConstantSource)return n(o,s);const a=o.createConstantSource();return Ku(a,s),Zu(a,s,"offset"),e(r,()=>r(o))||Yu(a),e(i,()=>i(o))||tc(a),t(o,a),a})(cl,Rc,Cl,kc,Ac),Il=((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=Ga(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)}}})(hl,Ml,mu,pl,Bc),Nl=((t,e,n,r,i,o,s)=>class extends t{constructor(t,s){const a=i(t),u={...Pu,...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,Ka,Xa),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){$a(this);const t=()=>{this._nativeConstantSourceNode.removeEventListener("ended",t),Qa(this)&&qa(this)};this._nativeConstantSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeConstantSourceNode.stop(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.stop=t)}})(Yc,ml,Il,Ml,Uc,zc,Ec),jl=((t,e)=>(n,r)=>{const i=n.createConvolver();if(Ku(i,r),r.disableNormalization===i.normalize&&(i.normalize=!r.disableNormalization),Xu(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})(dc,xc),Rl=((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(!Ga(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),cu(s)?await n(i,o,s.inputs[0]):await n(i,o,s),s})(i,o)}}})(jl,mu,Bc),Pl=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u={...Du,...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}})(Yc,Rl,jl,Uc,zc,bl),Dl=((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=Ga(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)}}})(hl,sc,mu,pl,Bc),Ll=((t,e,n,r,i,o,s)=>class extends t{constructor(t,a){const u=i(t),c={...Fu,...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}})(Yc,ml,Dl,sc,Uc,zc,bl),Fl=(t=>(e,n)=>{const r=e.createDynamicsCompressor();if(Ku(r,n),n.channelCount>2)throw t();if("max"===n.channelCountMode)throw t();return Zu(r,n,"attack"),Zu(r,n,"knee"),Zu(r,n,"ratio"),Zu(r,n,"release"),Zu(r,n,"threshold"),r})(dc),$l=((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=Ga(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)}}})(hl,Fl,mu,pl,Bc),Bl=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,i){const u=o(t),c={...Bu,...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}})(Yc,ml,$l,Fl,dc,Uc,zc,bl),ql=((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=Ga(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)}}})(hl,ac,mu,pl,Bc),Ul=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=i(t),u={...qu,...s},c=r(a,u),l=o(a);super(t,!1,c,l?n():null),this._gain=e(this,l,c.gain,Ka,Xa)}get gain(){return this._gain}})(Yc,ml,ql,ac,Uc,zc),Vl=((t,e,n,r)=>(i,o,{channelCount:s,channelCountMode:a,channelInterpretation:u,feedback:c,feedforward:l})=>{const h=ec(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]=zu(d,f,p,m,g,v[t],b[t],y[t],32,r,i)}};const w=i.sampleRate/2;return oc({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=uc(lc(p,o),lc(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])},_)})(Vu,Uu,hc,dc),Gl=((t,e,n,r)=>i=>t(Ju,()=>Ju(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()}))(Rc,ac,hc,((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()})})(ac,Gc)),zl=((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=Ga(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),zu(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)}}})(dl,mu,Gc,Bc,Gl),Wl=(t=>(e,n,r)=>{if(void 0===e.createIIRFilter)return t(e,n,r);const i=e.createIIRFilter(r.feedforward,r.feedback);return Ku(i,r),i})(Vl),Jl=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u=i(a),c={...Gu,...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 Vu();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)}})(Yc,Wl,zl,Uc,zc,bl),Hl=((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,Ka,Xa);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}}})(ml,kl,Ml,hc,dc,bc,zc,xc),Xl=new WeakMap,Kl=((t,e,n,r,i,o)=>class extends n{constructor(n,o){super(n),this._nativeContext=n,Sa.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}})(yl,Hl,Jc,zc,Xl,Ec),Ql=((t,e,n,r,i,o)=>(s,a)=>{const u=s.createOscillator();return Ku(u,a),Zu(u,a,"detune"),Zu(u,a,"frequency"),void 0!==a.periodicWave?u.setPeriodicWave(a.periodicWave):Xu(u,a,"type"),e(n,()=>n(s))||Yu(u),e(r,()=>r(s))||o(u,s),e(i,()=>i(s))||tc(u),t(s,u),u})(cl,Rc,kc,Sc,Ac,Oc),Zl=((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=Ga(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)}}})(hl,Ql,mu,pl,Bc),Yl=((t,e,n,r,i,o,s)=>class extends t{constructor(t,s){const a=i(t),u={...fc,...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){$a(this);const t=()=>{this._nativeOscillatorNode.removeEventListener("ended",t),Qa(this)&&qa(this)};this._nativeOscillatorNode.addEventListener("ended",t)}}stop(t=0){this._nativeOscillatorNode.stop(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.stop=t)}})(Yc,ml,Ql,Zl,Uc,zc,Ec),th=(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)}})(dl),eh=((t,e,n,r,i)=>(o,{curve:s,oversample:a,...u})=>{const c=o.createWaveShaper(),l=o.createWaveShaper();Ku(c,u),Ku(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(oc(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)})})(th,Uu,ac,wc,xl),nh=((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);Ku(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();Xu(c,{curve:l},"curve"),Xu(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)})})(th,Uu,eh,wc,xl,Hc,xc),rh=((t,e,n,r,i,o,s,a,u,c)=>(l,{coneInnerAngle:h,coneOuterAngle:d,coneOuterGain:p,distanceModel:f,maxDistance:m,orientationX:g,orientationY:_,orientationZ:y,panningModel:v,positionX:b,positionY:w,positionZ:x,refDistance:T,rolloffFactor:k,...S})=>{const A=l.createPanner();if(S.channelCount>2)throw s();if("max"===S.channelCountMode)throw s();Ku(A,S);const O={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},E=n(l,{...O,channelInterpretation:"speakers",numberOfInputs:6}),C=r(l,{...S,gain:1}),M=r(l,{...O,gain:1}),I=r(l,{...O,gain:0}),N=r(l,{...O,gain:0}),j=r(l,{...O,gain:0}),R=r(l,{...O,gain:0}),P=r(l,{...O,gain:0}),D=i(l,256,6,1),L=o(l,{...O,curve:new Float32Array([1,1]),oversample:"none"});let F=[g,_,y],$=[b,w,x];const B=new Float32Array(1);D.onaudioprocess=({inputBuffer:t})=>{const e=[u(t,B,0),u(t,B,1),u(t,B,2)];e.some((t,e)=>t!==F[e])&&(A.setOrientation(...e),F=e);const n=[u(t,B,3),u(t,B,4),u(t,B,5)];n.some((t,e)=>t!==$[e])&&(A.setPosition(...n),$=n)},Object.defineProperty(I.gain,"defaultValue",{get:()=>0}),Object.defineProperty(N.gain,"defaultValue",{get:()=>0}),Object.defineProperty(j.gain,"defaultValue",{get:()=>0}),Object.defineProperty(R.gain,"defaultValue",{get:()=>0}),Object.defineProperty(P.gain,"defaultValue",{get:()=>0});const q={get bufferSize(){},get channelCount(){return A.channelCount},set channelCount(t){if(t>2)throw s();C.channelCount=t,A.channelCount=t},get channelCountMode(){return A.channelCountMode},set channelCountMode(t){if("max"===t)throw s();C.channelCountMode=t,A.channelCountMode=t},get channelInterpretation(){return A.channelInterpretation},set channelInterpretation(t){C.channelInterpretation=t,A.channelInterpretation=t},get coneInnerAngle(){return A.coneInnerAngle},set coneInnerAngle(t){A.coneInnerAngle=t},get coneOuterAngle(){return A.coneOuterAngle},set coneOuterAngle(t){A.coneOuterAngle=t},get coneOuterGain(){return A.coneOuterGain},set coneOuterGain(t){if(t<0||t>1)throw e();A.coneOuterGain=t},get context(){return A.context},get distanceModel(){return A.distanceModel},set distanceModel(t){A.distanceModel=t},get inputs(){return[C]},get maxDistance(){return A.maxDistance},set maxDistance(t){if(t<0)throw new RangeError;A.maxDistance=t},get numberOfInputs(){return A.numberOfInputs},get numberOfOutputs(){return A.numberOfOutputs},get orientationX(){return M.gain},get orientationY(){return I.gain},get orientationZ(){return N.gain},get panningModel(){return A.panningModel},set panningModel(t){A.panningModel=t},get positionX(){return j.gain},get positionY(){return R.gain},get positionZ(){return P.gain},get refDistance(){return A.refDistance},set refDistance(t){if(t<0)throw new RangeError;A.refDistance=t},get rolloffFactor(){return A.rolloffFactor},set rolloffFactor(t){if(t<0)throw new RangeError;A.rolloffFactor=t},addEventListener:(...t)=>C.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>C.dispatchEvent(t[0]),removeEventListener:(...t)=>C.removeEventListener(t[0],t[1],t[2])};h!==q.coneInnerAngle&&(q.coneInnerAngle=h),d!==q.coneOuterAngle&&(q.coneOuterAngle=d),p!==q.coneOuterGain&&(q.coneOuterGain=p),f!==q.distanceModel&&(q.distanceModel=f),m!==q.maxDistance&&(q.maxDistance=m),g!==q.orientationX.value&&(q.orientationX.value=g),_!==q.orientationY.value&&(q.orientationY.value=_),y!==q.orientationZ.value&&(q.orientationZ.value=y),v!==q.panningModel&&(q.panningModel=v),b!==q.positionX.value&&(q.positionX.value=b),w!==q.positionY.value&&(q.positionY.value=w),x!==q.positionZ.value&&(q.positionZ.value=x),T!==q.refDistance&&(q.refDistance=T),k!==q.rolloffFactor&&(q.rolloffFactor=k),1===F[0]&&0===F[1]&&0===F[2]||A.setOrientation(...F),0===$[0]&&0===$[1]&&0===$[2]||A.setPosition(...$);return c(oc(q,A),()=>{C.connect(A),t(C,L,0,0),L.connect(M).connect(E,0,0),L.connect(I).connect(E,0,1),L.connect(N).connect(E,0,2),L.connect(j).connect(E,0,3),L.connect(R).connect(E,0,4),L.connect(P).connect(E,0,5),E.connect(D).connect(l.destination)},()=>{C.disconnect(A),a(C,L,0,0),L.disconnect(M),M.disconnect(E),L.disconnect(I),I.disconnect(E),L.disconnect(N),N.disconnect(E),L.disconnect(j),j.disconnect(E),L.disconnect(R),R.disconnect(E),L.disconnect(P),P.disconnect(E),E.disconnect(D),D.disconnect(l.destination)})})(lu,Uu,kl,ac,hc,nh,dc,fu,bc,xl),ih=(t=>(e,n)=>{const r=e.createPanner();return void 0===r.orientationX?t(e,n):(Ku(r,n),Zu(r,n,"orientationX"),Zu(r,n,"orientationY"),Zu(r,n,"orientationZ"),Zu(r,n,"positionX"),Zu(r,n,"positionY"),Zu(r,n,"positionZ"),Xu(r,n,"coneInnerAngle"),Xu(r,n,"coneOuterAngle"),Xu(r,n,"coneOuterGain"),Xu(r,n,"distanceModel"),Xu(r,n,"maxDistance"),Xu(r,n,"panningModel"),Xu(r,n,"refDistance"),Xu(r,n,"rolloffFactor"),r)})(rh),oh=((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=Ga(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)),cu(m)?await u(d,p,m.inputs[0]):await u(d,p,m),m})(d,p)}}})(hl,kl,Ml,ac,ih,mu,Gc,pl,Bc,Gl),sh=((t,e,n,r,i,o,s)=>class extends t{constructor(t,a){const u=i(t),c={...mc,...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,Ka,Xa),this._orientationY=e(this,h,l.orientationY,Ka,Xa),this._orientationZ=e(this,h,l.orientationZ,Ka,Xa),this._positionX=e(this,h,l.positionX,Ka,Xa),this._positionY=e(this,h,l.positionY,Ka,Xa),this._positionZ=e(this,h,l.positionZ,Ka,Xa),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}})(Yc,ml,ih,oh,Uc,zc,bl),ah=(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})(Wa),uh=((t,e,n,r)=>class i{constructor(i,o){const s=e(i),a=r({...gc,...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)}})(ah,Uc,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}}),ch=((t,e,n,r,i,o)=>{const s=16385,a=new Float32Array([1,1]),u=Math.PI/2,c={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},l={...c,oversample:"none"},h=(t,o,h,d,p)=>{if(1===o)return((t,e,i,o)=>{const h=new Float32Array(s),d=new Float32Array(s);for(let t=0;t<s;t+=1){const e=t/16384*u;h[t]=Math.cos(e),d[t]=Math.sin(e)}const p=n(t,{...c,gain:0}),f=r(t,{...l,curve:h}),m=r(t,{...l,curve:a}),g=n(t,{...c,gain:0}),_=r(t,{...l,curve:d});return{connectGraph(){e.connect(p),e.connect(void 0===m.inputs?m:m.inputs[0]),e.connect(g),m.connect(i),i.connect(void 0===f.inputs?f:f.inputs[0]),i.connect(void 0===_.inputs?_:_.inputs[0]),f.connect(p.gain),_.connect(g.gain),p.connect(o,0,0),g.connect(o,0,1)},disconnectGraph(){e.disconnect(p),e.disconnect(void 0===m.inputs?m:m.inputs[0]),e.disconnect(g),m.disconnect(i),i.disconnect(void 0===f.inputs?f:f.inputs[0]),i.disconnect(void 0===_.inputs?_:_.inputs[0]),f.disconnect(p.gain),_.disconnect(g.gain),p.disconnect(o,0,0),g.disconnect(o,0,1)}}})(t,h,d,p);if(2===o)return((t,i,o,h)=>{const d=new Float32Array(s),p=new Float32Array(s),f=new Float32Array(s),m=new Float32Array(s),g=Math.floor(8192.5);for(let t=0;t<s;t+=1)if(t>g){const e=(t-g)/(16384-g)*u;d[t]=Math.cos(e),p[t]=Math.sin(e),f[t]=0,m[t]=1}else{const e=t/(16384-g)*u;d[t]=1,p[t]=0,f[t]=Math.cos(e),m[t]=Math.sin(e)}const _=e(t,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),y=n(t,{...c,gain:0}),v=r(t,{...l,curve:d}),b=n(t,{...c,gain:0}),w=r(t,{...l,curve:p}),x=r(t,{...l,curve:a}),T=n(t,{...c,gain:0}),k=r(t,{...l,curve:f}),S=n(t,{...c,gain:0}),A=r(t,{...l,curve:m});return{connectGraph(){i.connect(_),i.connect(void 0===x.inputs?x:x.inputs[0]),_.connect(y,0),_.connect(b,0),_.connect(T,1),_.connect(S,1),x.connect(o),o.connect(void 0===v.inputs?v:v.inputs[0]),o.connect(void 0===w.inputs?w:w.inputs[0]),o.connect(void 0===k.inputs?k:k.inputs[0]),o.connect(void 0===A.inputs?A:A.inputs[0]),v.connect(y.gain),w.connect(b.gain),k.connect(T.gain),A.connect(S.gain),y.connect(h,0,0),T.connect(h,0,0),b.connect(h,0,1),S.connect(h,0,1)},disconnectGraph(){i.disconnect(_),i.disconnect(void 0===x.inputs?x:x.inputs[0]),_.disconnect(y,0),_.disconnect(b,0),_.disconnect(T,1),_.disconnect(S,1),x.disconnect(o),o.disconnect(void 0===v.inputs?v:v.inputs[0]),o.disconnect(void 0===w.inputs?w:w.inputs[0]),o.disconnect(void 0===k.inputs?k:k.inputs[0]),o.disconnect(void 0===A.inputs?A:A.inputs[0]),v.disconnect(y.gain),w.disconnect(b.gain),k.disconnect(T.gain),A.disconnect(S.gain),y.disconnect(h,0,0),T.disconnect(h,0,0),b.disconnect(h,0,1),S.disconnect(h,0,1)}}})(t,h,d,p);throw i()};return(e,{channelCount:r,channelCountMode:s,pan:a,...u})=>{if("max"===s)throw i();const c=t(e,{...u,channelCount:1,channelCountMode:s,numberOfInputs:2}),l=n(e,{...u,channelCount:r,channelCountMode:s,gain:1}),d=n(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:a});let{connectGraph:p,disconnectGraph:f}=h(e,r,l,d,c);Object.defineProperty(d.gain,"defaultValue",{get:()=>0}),Object.defineProperty(d.gain,"maxValue",{get:()=>1}),Object.defineProperty(d.gain,"minValue",{get:()=>-1});const m={get bufferSize(){},get channelCount(){return l.channelCount},set channelCount(t){l.channelCount!==t&&(g&&f(),({connectGraph:p,disconnectGraph:f}=h(e,t,l,d,c)),g&&p()),l.channelCount=t},get channelCountMode(){return l.channelCountMode},set channelCountMode(t){if("clamped-max"===t||"max"===t)throw i();l.channelCountMode=t},get channelInterpretation(){return l.channelInterpretation},set channelInterpretation(t){l.channelInterpretation=t},get context(){return l.context},get inputs(){return[l]},get numberOfInputs(){return l.numberOfInputs},get numberOfOutputs(){return l.numberOfOutputs},get pan(){return d.gain},addEventListener:(...t)=>l.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>l.dispatchEvent(t[0]),removeEventListener:(...t)=>l.removeEventListener(t[0],t[1],t[2])};let g=!1;return o(oc(m,c),()=>{p(),g=!0},()=>{f(),g=!1})}})(kl,ic,ac,nh,dc,xl),lh=((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 Ku(o,r),Zu(o,r,"pan"),Object.defineProperty(o,"channelCountMode",{get:()=>i,set:t=>{if(t!==i)throw e()}}),o})(ch,dc),hh=((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=Ga(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),cu(u)?await i(s,a,u.inputs[0]):await i(s,a,u),u})(s,a)}}})(hl,lh,mu,pl,Bc),dh=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=i(t),u={..._c,...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}})(Yc,ml,lh,hh,Uc,zc),ph=((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(!Ga(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),cu(s)?await n(i,o,s.inputs[0]):await n(i,o,s),s})(i,o)}}})(nh,mu,Bc),fh=((t,e,n,r,i,o,s)=>class extends t{constructor(t,e){const a=i(t),u={...vc,...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}})(Yc,Uu,nh,ph,Uc,zc,bl),mh=(t=>null!==t&&t.isSecureContext)(Lc),gh=(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)}})(Lc),_h=new WeakMap,yh=((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})(_h,Gc),vh=mh?((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]=Na(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=Ea.get(v);if(void 0!==r){if(r.has(t))throw e();Ra(n),ja(n.parameterDescriptors),r.set(t,n)}else Ra(n),ja(n.parameterDescriptors),Ea.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]=Na(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}})(Rc,dc,(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)}}))(Lc),gh,(t=>async e=>{try{const t=await fetch(e);if(t.ok)return[await t.text(),t.url]}catch{}throw t()})(()=>new DOMException("","AbortError")),Uc,yh,zc,Zc,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})(Zc,Gc),Lc):void 0,bh=((t,e)=>n=>t(n)||e(n))(Xc,zc),wh=((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=>(Lu(d).catch(()=>{}),e(a,()=>a(n))||l(n),t.add(n),n)):new Promise((e,n)=>{const i=async()=>{try{await Lu(d)}catch{}},o=t=>{n(t),i()};try{p.decodeAudioData(d,n=>{"function"!=typeof n.copyFromChannel&&(c(n),Ja(n)),t.add(n),i().then(()=>e(n))},t=>{o(null===t?r():t)})}catch(t){o(t)}})})(nl,Rc,()=>new DOMException("","DataCloneError"),()=>new DOMException("","EncodingError"),new WeakSet,Uc,bh,za,Ju,sl,al),xh=((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})}})(vh,el,ul,_l,wl,Al,El,Nl,Pl,wh,Ll,Bl,Ul,Jl,Kl,Yl,sh,uh,dh,fh),Th=((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}})(Yc,(t,e)=>t.createMediaElementSource(e.mediaElement),Uc,zc),kh=((t,e,n,r)=>class extends t{constructor(t,i){const o=n(t);if(r(o))throw new TypeError;const s={...Wu,...i},a=e(o,s);super(t,!1,a,null),this._nativeMediaStreamAudioDestinationNode=a}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}})(Yc,(t,e)=>{const n=t.createMediaStreamDestination();return Ku(n,e),1===n.numberOfOutputs&&Object.defineProperty(n,"numberOfOutputs",{get:()=>0}),n},Uc,zc),Sh=((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}})(Yc,(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},Uc,zc),Ah=((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})(Uu,zc),Oh=((t,e,n)=>class extends t{constructor(t,r){const i=n(t);super(t,!0,e(i,r),null)}})(Yc,Ah,Uc),Eh=((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(!ru(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()),nu(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})}})(xh,Uu,dc,yc,Th,kh,Sh,Oh,Hc),Ch=(t=>e=>{const n=t.get(e);if(void 0===n)throw new Error("The context has no set of AudioWorkletNodes.");return n})(Xl),Mh=(t=>(e,n)=>{t(e).add(n)})(Ch),Ih=(t=>(e,n,r=0,i=0)=>{const o=e[r];if(void 0===o)throw t();return wu(n)?o.connect(n,0,i):o.connect(n,0)})(Wa),Nh=(t=>(e,n)=>{t(e).delete(n)})(Ch),jh=(t=>(e,n=void 0,r=void 0,i=0)=>void 0===n?e.forEach(t=>t.disconnect()):"number"==typeof n?$u(t,e,n).disconnect():wu(n)?void 0===r?e.forEach(t=>t.disconnect(n)):void 0===i?$u(t,e,r).disconnect(n,0):$u(t,e,r).disconnect(n,0,i):void 0===r?e.forEach(t=>t.disconnect(n)):$u(t,e,r).disconnect(n,0))(Wa),Rh=new WeakMap,Ph=((t,e)=>n=>e(t,n))(Rh,Pa),Dh=((t,e,n,r,i,o,s,a,u,c,l,h,d)=>(p,f,m,g)=>{if(0===g.numberOfInputs&&0===g.numberOfOutputs)throw u();const _=Array.isArray(g.outputChannelCount)?g.outputChannelCount:Array.from(g.outputChannelCount);if(_.some(t=>t<1))throw u();if(_.length!==g.numberOfOutputs)throw e();if("explicit"!==g.channelCountMode)throw u();const y=g.channelCount*g.numberOfInputs,v=_.reduce((t,e)=>t+e,0),b=void 0===m.parameterDescriptors?0:m.parameterDescriptors.length;if(y+b>6||v>6)throw u();const w=new MessageChannel,x=[],T=[];for(let t=0;t<g.numberOfInputs;t+=1)x.push(s(p,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1})),T.push(i(p,{channelCount:g.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:g.channelCount}));const k=[];if(void 0!==m.parameterDescriptors)for(const{defaultValue:t,maxValue:e,minValue:n,name:r}of m.parameterDescriptors){const i=o(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:void 0!==g.parameterData[r]?g.parameterData[r]:void 0===t?0:t});Object.defineProperties(i.offset,{defaultValue:{get:()=>void 0===t?0:t},maxValue:{get:()=>void 0===e?Ka:e},minValue:{get:()=>void 0===n?Xa:n}}),k.push(i)}const S=r(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,y+b)}),A=ec(f,p.sampleRate),O=a(p,A,y+b,Math.max(1,v)),E=i(p,{channelCount:Math.max(1,v),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,v)}),C=[];for(let t=0;t<g.numberOfOutputs;t+=1)C.push(r(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:_[t]}));for(let t=0;t<g.numberOfInputs;t+=1){x[t].connect(T[t]);for(let e=0;e<g.channelCount;e+=1)T[t].connect(S,e,t*g.channelCount+e)}const M=new Au(void 0===m.parameterDescriptors?[]:m.parameterDescriptors.map(({name:t},e)=>{const n=k[e];return n.connect(S,0,y+e),n.start(0),[t,n.offset]}));S.connect(O);let I=g.channelInterpretation,N=null;const j=0===g.numberOfOutputs?[O]:C,R={get bufferSize(){return A},get channelCount(){return g.channelCount},set channelCount(t){throw n()},get channelCountMode(){return g.channelCountMode},set channelCountMode(t){throw n()},get channelInterpretation(){return I},set channelInterpretation(t){for(const e of x)e.channelInterpretation=t;I=t},get context(){return O.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&&R.removeEventListener("processorerror",N),N="function"==typeof t?t:null,"function"==typeof N&&R.addEventListener("processorerror",N)},get parameters(){return M},get port(){return w.port2},addEventListener:(...t)=>O.addEventListener(t[0],t[1],t[2]),connect:t.bind(null,j),disconnect:c.bind(null,j),dispatchEvent:(...t)=>O.dispatchEvent(t[0]),removeEventListener:(...t)=>O.removeEventListener(t[0],t[1],t[2])},P=new Map;var D,L;w.port1.addEventListener=(D=w.port1.addEventListener,(...t)=>{if("message"===t[0]){const e="function"==typeof t[1]?t[1]:"object"==typeof t[1]&&null!==t[1]&&"function"==typeof t[1].handleEvent?t[1].handleEvent:null;if(null!==e){const n=P.get(t[1]);void 0!==n?t[1]=n:(t[1]=t=>{l(p.currentTime,p.sampleRate,()=>e(t))},P.set(e,t[1]))}}return D.call(w.port1,t[0],t[1],t[2])}),w.port1.removeEventListener=(L=w.port1.removeEventListener,(...t)=>{if("message"===t[0]){const e=P.get(t[1]);void 0!==e&&(P.delete(t[1]),t[1]=e)}return L.call(w.port1,t[0],t[1],t[2])});let F=null;Object.defineProperty(w.port1,"onmessage",{get:()=>F,set:t=>{"function"==typeof F&&w.port1.removeEventListener("message",F),F="function"==typeof t?t:null,"function"==typeof F&&(w.port1.addEventListener("message",F),w.port1.start())}}),m.prototype.port=w.port1;let $=null;const B=((t,e,n,r)=>{let i=Ca.get(t);void 0===i&&(i=new WeakMap,Ca.set(t,i));const o=nc(n,r);return i.set(e,o),o})(p,R,m,g);B.then(t=>$=t);const q=Mu(g.numberOfInputs,g.channelCount),U=Mu(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&&O.disconnect(E);for(let t=0,e=0;t<g.numberOfOutputs;t+=1){const n=C[t];for(let r=0;r<_[t];r+=1)E.disconnect(n,e+r,r);e+=_[t]}},W=new Map;O.onaudioprocess=({inputBuffer:t,outputBuffer:e})=>{if(null!==$){const n=h(R);for(let r=0;r<A;r+=128){for(let e=0;e<g.numberOfInputs;e+=1)for(let n=0;n<g.channelCount;n+=1)Eu(t,q[e],n,n,r);void 0!==m.parameterDescriptors&&m.parameterDescriptors.forEach(({name:e},n)=>{Eu(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)Cu(e,U[t],i,n+i,r);n+=_[t]}}catch(t){G=!1,R.dispatchEvent(new ErrorEvent("processorerror",{colno:t.colno,filename:t.filename,lineno:t.lineno,message:t.message}))}if(!G){for(let t=0;t<g.numberOfInputs;t+=1){x[t].disconnect(T[t]);for(let e=0;e<g.channelCount;e+=1)T[r].disconnect(S,e,t*g.channelCount+e)}if(void 0!==m.parameterDescriptors){const t=m.parameterDescriptors.length;for(let e=0;e<t;e+=1){const t=k[e];t.disconnect(S,0,y+e),t.stop()}}S.disconnect(O),O.onaudioprocess=null,J?z():K();break}}}};let J=!1;const H=s(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0}),X=()=>O.connect(H).connect(p.destination),K=()=>{O.disconnect(H),H.disconnect()};return X(),d(R,()=>{if(G){K(),g.numberOfOutputs>0&&O.connect(E);for(let t=0,e=0;t<g.numberOfOutputs;t+=1){const n=C[t];for(let r=0;r<_[t];r+=1)E.connect(n,e+r,r);e+=_[t]}}J=!0},()=>{G&&(X(),z()),J=!1})})(Ih,Wa,Uu,kl,ic,Ml,ac,hc,dc,jh,gh,Ph,xl),Lh=((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)})(Uu,Dh,ac,dc,xl),Fh=((t,e,n,r,i,o,s,a,u,c,l,h,d,p,f,m)=>(g,_,y)=>{const v=new WeakMap;let b=null;return{render(w,x){a(x,w);const T=v.get(x);return void 0!==T?Promise.resolve(T):(async(a,w)=>{let x=l(a),T=null;const k=Ga(x,w),S=Array.isArray(_.outputChannelCount)?_.outputChannelCount:Array.from(_.outputChannelCount);if(null===h){const t=S.reduce((t,e)=>t+e,0),n=i(w,{channelCount:Math.max(1,t),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,t)}),o=[];for(let t=0;t<a.numberOfOutputs;t+=1)o.push(r(w,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:S[t]}));const c=s(w,{channelCount:_.channelCount,channelCountMode:_.channelCountMode,channelInterpretation:_.channelInterpretation,gain:1});c.connect=e.bind(null,o),c.disconnect=u.bind(null,o),T=[n,o,c]}else k||(x=new h(w,g));if(v.set(w,null===T?x:T[2]),null!==T){if(null===b){if(void 0===y)throw new Error("Missing the processor constructor.");if(null===d)throw new Error("Missing the native OfflineAudioContext constructor.");const t=a.channelCount*a.numberOfInputs,e=void 0===y.parameterDescriptors?0:y.parameterDescriptors.length,n=t+e,u=async()=>{const u=new d(n,128*Math.ceil(a.context.length/128),w.sampleRate),c=[],l=[];for(let t=0;t<_.numberOfInputs;t+=1)c.push(s(u,{channelCount:_.channelCount,channelCountMode:_.channelCountMode,channelInterpretation:_.channelInterpretation,gain:1})),l.push(i(u,{channelCount:_.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:_.channelCount}));const h=await Promise.all(Array.from(a.parameters.values()).map(async t=>{const e=o(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:t.value});return await p(u,t,e.offset),e})),g=r(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,t+e)});for(let t=0;t<_.numberOfInputs;t+=1){c[t].connect(l[t]);for(let e=0;e<_.channelCount;e+=1)l[t].connect(g,e,t*_.channelCount+e)}for(const[e,n]of h.entries())n.connect(g,0,t+e),n.start(0);return g.connect(u.destination),await Promise.all(c.map(t=>f(a,u,t))),m(u)};b=Iu(a,0===n?null:await u(),w,_,S,y,c)}const t=await b,e=n(w,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[u,l,h]=T;null!==t&&(e.buffer=t,e.start(0)),e.connect(u);for(let t=0,e=0;t<a.numberOfOutputs;t+=1){const n=l[t];for(let r=0;r<S[t];r+=1)u.connect(n,e+r,r);e+=S[t]}return h}if(k)for(const[e,n]of a.parameters.entries())await t(w,n,x.parameters.get(e));else for(const[t,e]of a.parameters.entries())await p(w,e,x.parameters.get(t));return await f(a,w,x),x})(w,x)}}})(hl,Ih,dl,kl,ic,Ml,ac,Nh,jh,gh,mu,Zc,Gc,pl,Bc,Gl),$h=(t=>e=>t.get(e))(_h),Bh=(t=>(e,n)=>{t.set(e,n)})(Rh),qh=mh?((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({...Ou,...f});d(y);const v=Ea.get(g),b=null==v?void 0:v.get(p),w=_||"closed"!==g.state?g:null!==(m=s(g))&&void 0!==m?m:g,x=i(w,_?null:e.baseLatency,c,p,b,y);super(e,!0,x,_?r(p,y,b):null);const T=[];x.parameters.forEach((t,e)=>{const r=n(this,_,t);T.push([e,r])}),this._nativeAudioWorkletNode=x,this._onprocessorerror=null,this._parameters=new Au(T),_&&t(g,this);const{activeInputs:k}=o(this);h(x,k)}get onprocessorerror(){return this._onprocessorerror}set onprocessorerror(t){const e="function"==typeof t?p(this,t):null;this._nativeAudioWorkletNode.onprocessorerror=e;const n=this._nativeAudioWorkletNode.onprocessorerror;this._onprocessorerror=null!==n&&n===e?t:n}get parameters(){return null===this._parameters?this._nativeAudioWorkletNode.parameters:this._parameters}get port(){return this._nativeAudioWorkletNode.port}})(Mh,Yc,ml,Fh,Lh,Ya,$h,Uc,zc,Zc,t=>({...t,outputChannelCount:void 0!==t.outputChannelCount?t.outputChannelCount:1===t.numberOfInputs&&1===t.numberOfOutputs?[t.channelCount]:Array.from({length:t.numberOfOutputs},()=>1)}),Bh,t=>{const{port1:e,port2:n}=new MessageChannel;try{e.postMessage(t)}finally{e.close(),n.close()}},Ec):void 0,Uh=(((t,e,n,r,i)=>{})(Uu,dc,yc,Kl,Hc),((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}})(dc,Gc)),Vh=((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),Ja(n)):e(o,()=>o(n))||a(n),t.add(n),n)))(nl,Rc,$c,Ch,Gl,za,sl,al),Gh=(((t,e,n,r,i)=>{})(Rc,Uu,Uh,Kl,Vh),((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}={...pc,...o},c=r(a,s,u);e(Ju,()=>Ju(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,nu(this)}))}_waitForThePromiseToSettle(t){null===this._state?this._nativeOfflineAudioContext.dispatchEvent(t):setTimeout(()=>this._waitForThePromiseToSettle(t))}})(xh,Rc,Uu,Uh,Vh)),zh=((t,e)=>n=>{const r=t.get(n);return e(r)||e(n)})(Sa,Xc),Wh=((t,e)=>n=>t.has(n)||e(n))(xa,Kc),Jh=((t,e)=>n=>t.has(n)||e(n))(ka,Qc),Hh=((t,e)=>n=>{const r=t.get(n);return e(r)||e(n)})(Sa,zc);function Xh(t){return Jh(t)}function Kh(t){return Wh(t)}function Qh(t){return Hh(t)}function Zh(t){return zh(t)}function Yh(t){return void 0===t}function td(t){return void 0!==t}function ed(t){return"number"==typeof t}function nd(t){return"[object Object]"===Object.prototype.toString.call(t)&&t.constructor===Object}function rd(t){return Array.isArray(t)}function id(t){return"string"==typeof t}function od(t){return id(t)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(t)}function sd(t,e){return"value"===t||Xh(e)||Kh(e)||function(t){return t instanceof ul}(e)}function ad(t,...e){if(!e.length)return t;const n=e.shift();if(nd(t)&&nd(n))for(const e in n)sd(e,n[e])?t[e]=n[e]:nd(n[e])?(t[e]||Object.assign(t,{[e]:{}}),ad(t[e],n[e])):Object.assign(t,{[e]:n[e]});return ad(t,...e)}function ud(t,e,n=[],r){const i={},o=Array.from(e);if(nd(o[0])&&r&&!Reflect.has(o[0],r)){Object.keys(o[0]).some(e=>Reflect.has(t,e))||(ad(i,{[r]:o[0]}),n.splice(n.indexOf(r),1),o.shift())}if(1===o.length&&nd(o[0]))ad(i,o[0]);else for(let t=0;t<n.length;t++)td(o[t])&&(i[n[t]]=o[t]);return ad(t,i)}function cd(t,e){return Yh(t)?e:t}function ld(t,e){return e.forEach(e=>{Reflect.has(t,e)&&delete t[e]}),t}const hd="15.1.22";function dd(t,e){if(!t)throw new Error(e)}function pd(t,e,n=1/0){if(!(e<=t&&t<=n))throw new RangeError(`Value must be within [${e}, ${n}], got: ${t}`)}function fd(t){t.isOffline||"running"===t.state||vd('The AudioContext is "suspended". Invoke Tone.start() from a user action to start the audio.')}let md=!1,gd=!1;function _d(t){md=t}let yd=console;function vd(...t){yd.warn(...t)}const bd="object"==typeof self?self:null,wd=bd&&(bd.hasOwnProperty("AudioContext")||bd.hasOwnProperty("webkitAudioContext"));class xd{constructor(){this.debug=!1,this._wasDisposed=!1}static getDefaults(){return{}}log(...t){(this.debug||bd&&this.toString()===bd.TONE_DEBUG_CLASS)&&function(...t){yd.log(...t)}(this,...t)}dispose(){return this._wasDisposed=!0,this}get disposed(){return this._wasDisposed}toString(){return this.name}}xd.version=hd;const Td=1e-6;function kd(t,e){return t>e+Td}function Sd(t,e){return kd(t,e)||Od(t,e)}function Ad(t,e){return t+Td<e}function Od(t,e){return Math.abs(t-e)<Td}class Ed extends xd{constructor(){super(),this.name="Timeline",this._timeline=[];const t=ud(Ed.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(dd(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];dd(Sd(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(Od(this._timeline[e].time,t)){for(let n=e;n>=0&&Od(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&&Sd(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(Od(o[e],t)){for(let n=r;n<this._timeline.length;n++){if(!Od(this._timeline[n][e],t))break;r=n}return r}if(Ad(o[e],t)&&kd(s[e],t))return r;kd(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&&Od(this._timeline[n].time,t)){let r=n;for(let e=n;e>=0&&Od(this._timeline[e].time,t);e--)r=e;this._iterate(t=>{e(t)},r,n)}return this}dispose(){return super.dispose(),this._timeline=[],this}}class Cd{constructor(t,e,n,r){this._callback=t,this._type=e,this._minimumUpdateInterval=Math.max(128/(r||44100),.001),this.updateInterval=n,this._createClock()}_createWorker(){const t=new Blob([`\n\t\t\t// the initial timeout time\n\t\t\tlet timeoutTime = ${(1e3*this._updateInterval).toFixed(1)};\n\t\t\t// onmessage callback\n\t\t\tself.onmessage = function(msg){\n\t\t\t\ttimeoutTime = parseInt(msg.data);\n\t\t\t};\n\t\t\t// the tick function which posts a message\n\t\t\t// and schedules a new tick\n\t\t\tfunction tick(){\n\t\t\t\tsetTimeout(tick, timeoutTime);\n\t\t\t\tself.postMessage('tick');\n\t\t\t}\n\t\t\t// call tick initially\n\t\t\ttick();\n\t\t\t`],{type:"text/javascript"}),e=URL.createObjectURL(t),n=new Worker(e);n.onmessage=this._callback.bind(this),this._worker=n}_createTimeout(){this._timeout=setTimeout(()=>{this._createTimeout(),this._callback()},1e3*this._updateInterval)}_createClock(){if("worker"===this._type)try{this._createWorker()}catch(t){this._type="timeout",this._createClock()}else"timeout"===this._type&&this._createTimeout()}_disposeClock(){this._timeout&&clearTimeout(this._timeout),this._worker&&(this._worker.terminate(),this._worker.onmessage=null)}get updateInterval(){return this._updateInterval}set updateInterval(t){var e;this._updateInterval=Math.max(t,this._minimumUpdateInterval),"worker"===this._type&&(null===(e=this._worker)||void 0===e||e.postMessage(1e3*this._updateInterval))}get type(){return this._type}set type(t){this._disposeClock(),this._type=t,this._createClock()}dispose(){this._disposeClock()}}const Md=[];function Id(t){Md.push(t)}const Nd=[];function jd(t){Nd.push(t)}class Rd extends xd{constructor(){super(...arguments),this.name="Emitter"}on(t,e){return t.split(/\W+/).forEach(t=>{Yh(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(Yh(this._events)&&(this._events={}),this._events.hasOwnProperty(t))if(Yh(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(Rd.prototype,e);Object.defineProperty(t.prototype,e,n)})}dispose(){return super.dispose(),this._events=void 0,this}}class Pd extends Rd{constructor(){super(...arguments),this.isOffline=!1}toJSON(){return{}}}class Dd extends Pd{constructor(){var t,e;super(),this.name="Context",this._constants=new Map,this._timeouts=new Ed,this._timeoutIds=0,this._initialized=!1,this._closeStarted=!1,this.isOffline=!1,this._workletPromise=null;const n=ud(Dd.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 Eh(t)}({latencyHint:n.latencyHint}),this._latencyHint=n.latencyHint),this._ticker=new Cd(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,Md.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){dd(Zh(this._context),"Not available if OfflineAudioContext");return this._context.createMediaStreamSource(t)}createMediaElementSource(t){dd(Zh(this._context),"Not available if OfflineAudioContext");return this._context.createMediaElementSource(t)}createMediaStreamDestination(){dd(Zh(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){dd(!this._initialized,"The listener cannot be set after initialization."),this._listener=t}get transport(){return this.initialize(),this._transport}set transport(t){dd(!this._initialized,"The transport cannot be set after initialization."),this._transport=t}get draw(){return this.initialize(),this._draw}set draw(t){dd(!this._initialized,"Draw cannot be set after initialization."),this._draw=t}get destination(){return this.initialize(),this._destination}set destination(t){dd(!this._initialized,"The destination cannot be set after initialization."),this._destination=t}createAudioWorkletNode(t,e){return function(t,e,n){return dd(td(qh),"AudioWorkletNode only works in a secure context (https or localhost)"),new(t instanceof(null==bd?void 0:bd.BaseAudioContext)?null==bd?void 0:bd.AudioWorkletNode:qh)(t,e,n)}(this.rawContext,t,e)}addAudioWorkletModule(t){return y(this,void 0,void 0,function*(){dd(td(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 y(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 Zh(this._context)?this._context.resume():Promise.resolve()}close(){return y(this,void 0,void 0,function*(){var t;Zh(this._context)&&"closed"!==this.state&&!this._closeStarted&&(this._closeStarted=!0,yield this._context.close()),this._initialized&&(t=this,Nd.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 Ld(t,e){rd(e)?e.forEach(e=>Ld(t,e)):Object.defineProperty(t,e,{enumerable:!0,writable:!1})}function Fd(t,e){rd(e)?e.forEach(e=>Fd(t,e)):Object.defineProperty(t,e,{writable:!0})}const $d=()=>{};class Bd extends xd{constructor(){super(),this.name="ToneAudioBuffer",this.onload=$d;const t=ud(Bd.getDefaults(),arguments,["url","onload","onerror"]);this.reverse=t.reverse,this.onload=t.onload,id(t.url)?this.load(t.url).catch(t.onerror):t.url&&this.set(t.url)}static getDefaults(){return{onerror:$d,onload:$d,reverse:!1}}get sampleRate(){return this._buffer?this._buffer.sampleRate:Gd().sampleRate}set(t){return t instanceof Bd?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 y(this,void 0,void 0,function*(){const e=Bd.load(t).then(t=>{this.set(t),this.onload(this)});Bd.downloads.push(e);try{yield e}finally{const t=Bd.downloads.indexOf(e);Bd.downloads.splice(t,1)}return this})}dispose(){return super.dispose(),this._buffer=void 0,this}fromArray(t){const e=rd(t)&&t[0].length>0,n=e?t.length:1,r=e?t[0].length:t.length,i=Gd(),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(ed(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(ed(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){dd(this.loaded,"Buffer is not loaded");const n=Math.floor(t*this.sampleRate),r=Math.floor(e*this.sampleRate);dd(n<r,"The start time must be less than the end time");const i=r-n,o=Gd().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 Bd(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 Bd).fromArray(t)}static fromUrl(t){return y(this,void 0,void 0,function*(){const e=new Bd;return yield e.load(t)})}static load(t){return y(this,void 0,void 0,function*(){const e=""===Bd.baseUrl||Bd.baseUrl.endsWith("/")?Bd.baseUrl:Bd.baseUrl+"/",n=yield fetch(e+t);if(!n.ok)throw new Error(`could not load url: ${t}`);const r=yield n.arrayBuffer();return yield Gd().decodeAudioData(r)})}static supportsType(t){const e=t.split("."),n=e[e.length-1];return""!==document.createElement("audio").canPlayType("audio/"+n)}static loaded(){return y(this,void 0,void 0,function*(){for(yield Promise.resolve();Bd.downloads.length;)yield Bd.downloads[0]})}}Bd.baseUrl="",Bd.downloads=[];class qd extends Dd{constructor(){var t,e,n;super({clockSource:"offline",context:Qh(arguments[0])?arguments[0]:(t=arguments[0],e=arguments[1]*arguments[2],n=arguments[2],new Gh(t,e,n)),lookAhead:0,updateInterval:Qh(arguments[0])?128/arguments[0].sampleRate:128/arguments[2]}),this.name="OfflineContext",this._currentTime=0,this.isOffline=!0,this._duration=Qh(arguments[0])?arguments[0].length/arguments[0].sampleRate:arguments[1]}now(){return this._currentTime}get currentTime(){return this._currentTime}_renderClock(t){return y(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 y(this,arguments,void 0,function*(t=!0){yield this.workletsAreReady(),yield this._renderClock(t);const e=yield this._context.startRendering();return new Bd(e)})}close(){return Promise.resolve()}}const Ud=new class extends Pd{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 y(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 Vd=Ud;function Gd(){return Vd===Ud&&wd&&function(t,e=!1){e&&Vd.dispose();Vd=Zh(t)?new Dd(t):Qh(t)?new qd(t):t}(new Dd),Vd}if(bd&&!bd.TONE_SILENCE_LOGGING){0}class zd extends xd{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 zd&&this.fromType(this._val),Yh(this._val))return this._noArg();if(id(this._val)&&Yh(this._units)){for(const t in this._expressions)if(this._expressions[t].regexp.test(this._val.trim())){this._units=t;break}}else if(nd(this._val)){let t=0;for(const e in this._val)if(td(this._val[e])){const n=this._val[e];t+=new this.constructor(this.context,e).valueOf()*n}return t}if(td(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 id(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 Wd extends zd{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 Wd(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 Wd(this.context,e[0]).toSeconds();return e.forEach(e=>{const i=new Wd(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 ga(this.toFrequency())}_now(){return this.context.now()}}class Jd extends Wd{constructor(){super(...arguments),this.name="Frequency",this.defaultUnits="hz"}static get A4(){return ma}static set A4(t){!function(t){ma=t}(t)}_getExpressions(){return Object.assign({},super._getExpressions(),{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method(t){return"midi"===this.defaultUnits?t:Jd.mtof(t)}},note:{regexp:/^([a-g]{1}(?:b|#|##|x|bb|###|#x|x#|bbb)?)(-?[0-9]+)/i,method(t,e){const n=Hd[t.toLowerCase()]+12*(parseInt(e,10)+1);return"midi"===this.defaultUnits?n:Jd.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 Jd(this.context,this.valueOf()*fa(t))}harmonize(t){return t.map(t=>this.transpose(t))}toMidi(){return ga(this.valueOf())}toNote(){const t=this.toFrequency(),e=Math.log2(t/Jd.A4);let n=Math.round(12*e)+57;const r=Math.floor(n/12);r<0&&(n+=-12*r);return Xd[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 ya(t)}static ftom(t){return ga(t)}}const Hd={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},Xd=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];class Kd extends Wd{constructor(){super(...arguments),this.name="TransportTime"}_now(){return this.context.transport.seconds}}class Qd extends xd{constructor(){super();const t=ud(Qd.getDefaults(),arguments,["context"]);this.defaultContext?this.context=this.defaultContext:this.context=t.context}static getDefaults(){return{context:Gd()}}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){Yh(t)&&md&&!gd&&(gd=!0,vd("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 Wd(this.context,t).toSeconds()}toFrequency(t){return new Jd(this.context,t).toFrequency()}toTicks(t){return new Kd(this.context,t).toTicks()}_getPartialProperties(t){const e=this.get();return Object.keys(e).forEach(n=>{Yh(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];td(n)&&td(n.value)&&td(n.setValueAtTime)?t[e]=n.value:n instanceof Qd?t[e]=n._getPartialProperties(t[e]):rd(n)||ed(n)||id(n)||"boolean"==typeof n?t[e]=n:delete t[e]}}),t}set(t){return Object.keys(t).forEach(e=>{Reflect.has(this,e)&&td(this[e])&&(this[e]&&td(this[e].value)&&td(this[e].setValueAtTime)?this[e].value!==t[e]&&(this[e].value=t[e]):this[e]instanceof Qd?this[e].set(t[e]):this[e]=t[e])}),this}}class Zd extends Qd{constructor(){const t=ud(Zd.getDefaults(),arguments,["param","units","convert"]);for(super(t),this.name="Param",this.overridden=!1,this._minOutput=1e-7,dd(td(t.param)&&(Xh(t.param)||t.param instanceof Zd),"param must be an AudioParam");!Xh(t.param);)t.param=t.param._param;this._swappable=!!td(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 Ed(1e3),this._initialValue=this._param.defaultValue,this.units=t.units,this.convert=t.convert,this._minValue=t.minValue,this._maxValue=t.maxValue,td(t.value)&&t.value!==this._toType(this._initialValue)&&this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(Qd.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 td(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 td(this._maxValue)?this._maxValue:"normalRange"===this.units||"audioRange"===this.units?1:this._param.maxValue}_is(t,e){return this.units===e}_assertRange(t){return td(this.maxValue)&&td(this.minValue)&&pd(t,this._fromType(this.minValue),this._fromType(this.maxValue)),t}_fromType(t){return this.convert&&!this.overridden?this._is(t,"time")?this.toSeconds(t):this._is(t,"decibels")?(e=t,Math.pow(10,e/20)):this._is(t,"frequency")?this.toFrequency(t):t:this.overridden?0:t;var e}_toType(t){return this.convert&&"decibels"===this.units?(e=t,Math.log(e)/Math.LN10*20):t;var e}setValueAtTime(t,e){const n=this.toSeconds(e),r=this._fromType(t);return dd(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 dd(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=Od(n,0)?this._minOutput:n,this._assertRange(n);const r=this.toSeconds(e);return dd(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);dd(isFinite(n)&&n>0,"timeConstant must be a number greater than 0");const i=this.toSeconds(e);return this._assertRange(r),dd(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 dd(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));dd(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&&Od(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){dd(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 Yd extends Qd{constructor(){super(...arguments),this._internalChannels=[]}get numberOfInputs(){return td(this.input)?Xh(this.input)||this.input instanceof Zd?1:this.input.numberOfInputs:0}get numberOfOutputs(){return td(this.output)?this.output.numberOfOutputs:0}_isAudioNode(t){return td(t)&&(t instanceof Yd||Kh(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();dd(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 ep(this,t,e,n),this}toDestination(){return this.connect(this.context.destination),this}toMaster(){return vd("toMaster() has been renamed toDestination()"),this.toDestination()}disconnect(t,e=0,n=0){return np(this,t,e,n),this}chain(...t){return tp(this,...t),this}fan(...t){return t.forEach(t=>this.connect(t)),this}dispose(){return super.dispose(),td(this.input)&&(this.input instanceof Yd?this.input.dispose():Kh(this.input)&&this.input.disconnect()),td(this.output)&&(this.output instanceof Yd?this.output.dispose():Kh(this.output)&&this.output.disconnect()),this._internalChannels=[],this}}function tp(...t){const e=t.shift();t.reduce((t,e)=>(t instanceof Yd?t.connect(e):Kh(t)&&ep(t,e),e),e)}function ep(t,e,n=0,r=0){for(dd(td(t),"Cannot connect from undefined node"),dd(td(e),"Cannot connect to undefined node"),(e instanceof Yd||Kh(e))&&dd(e.numberOfInputs>0,"Cannot connect to node with no inputs"),dd(t.numberOfOutputs>0,"Cannot connect from node with no outputs");e instanceof Yd||e instanceof Zd;)td(e.input)&&(e=e.input);for(;t instanceof Yd;)td(t.output)&&(t=t.output);Xh(e)?t.connect(e,n):t.connect(e,n,r)}function np(t,e,n=0,r=0){if(td(e))for(;e instanceof Yd;)e=e.input;for(;!Kh(t);)td(t.output)&&(t=t.output);Xh(e)?t.disconnect(e,n):Kh(e)?t.disconnect(e,n,r):t.disconnect()}class rp extends Yd{constructor(){const t=ud(rp.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 Zd({context:this.context,convert:t.convert,param:this._gainNode.gain,units:t.units,value:t.gain,minValue:t.minValue,maxValue:t.maxValue}),Ld(this,"gain")}static getDefaults(){return Object.assign(Yd.getDefaults(),{convert:!0,gain:1,units:"gain"})}dispose(){return super.dispose(),this._gainNode.disconnect(),this.gain.dispose(),this}}class ip extends Yd{constructor(t){super(t),this.onended=$d,this._startTime=-1,this._stopTime=-1,this._timeout=-1,this.output=new rp({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(Yd.getDefaults(),{curve:"linear",fadeIn:0,fadeOut:0,onended:$d})}_startGain(t,e=1){dd(-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){dd(-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!==$d&&(this.onended(this),this.onended=$d,!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"),dd(-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=$d,this}}class op extends ip{constructor(){const t=ud(op.getDefaults(),arguments,["offset"]);super(t),this.name="ToneConstantSource",this._source=this.context.createConstantSource(),ep(this._source,this._gainNode),this.offset=new Zd({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(ip.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 sp extends Yd{constructor(){const t=ud(sp.getDefaults(),arguments,["value","units"]);super(t),this.name="Signal",this.override=!0,this.output=this._constantSource=new op({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(Yd.getDefaults(),{convert:!0,units:"number",value:0})}connect(t,e=0,n=0){return ap(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 ap(t,e,n,r){(e instanceof Zd||Xh(e)||e instanceof sp&&e.override)&&(e.cancelScheduledValues(0),e.setValueAtTime(0,0),e instanceof sp&&(e.overridden=!0)),ep(t,e,n,r)}function up(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){pd(r,t,e),n.set(this,r)}})}}function cp(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){pd(this.toSeconds(r),t,e),n.set(this,r)}})}}class lp extends Yd{constructor(){const t=ud(lp.getDefaults(),arguments,["attack","decay","sustain","release"]);super(t),this.name="Envelope",this._sig=new sp({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(Yd.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(id(t))return t;{let n;for(n in hp)if(hp[n][e]===t)return n;return t}}_setCurve(t,e,n){if(id(n)&&Reflect.has(hp,n)){const r=hp[n];nd(r)?"_decayCurve"!==t&&(this[t]=r[e]):this[t]=r}else{if(!rd(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):(dd(rd(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 ap(this,t,e,n),this}asArray(){return y(this,arguments,void 0,function*(t=1024){const e=t/this.context.sampleRate,n=new qd(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}}g([cp(0)],lp.prototype,"attack",void 0),g([cp(0)],lp.prototype,"decay",void 0),g([up(0,1)],lp.prototype,"sustain",void 0),g([cp(0)],lp.prototype,"release",void 0);const hp=(()=>{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 dp extends lp{constructor(){super(ud(dp.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="AmplitudeEnvelope",this._gainNode=new rp({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 pp extends Yd{constructor(){const t=ud(pp.getDefaults(),arguments,["volume"]);super(t),this.name="Volume",this.input=this.output=new rp({context:this.context,gain:t.volume,units:"decibels"}),this.volume=this.output.gain,Ld(this,"volume"),this._unmutedVolume=t.volume,this.mute=t.mute}static getDefaults(){return Object.assign(Yd.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 fp extends Yd{constructor(){const t=ud(fp.getDefaults(),arguments);super(t),this.name="Destination",this.input=new pp({context:this.context}),this.output=new rp({context:this.context}),this.volume=this.input.volume,tp(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(Yd.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),tp(...t),this}get maxChannelCount(){return this.context.rawContext.destination.maxChannelCount}dispose(){return super.dispose(),this.volume.dispose(),this}}Id(t=>{t.destination=new fp({context:t})}),jd(t=>{t.destination.dispose()});class mp extends xd{constructor(t){super(),this.name="TimelineValue",this._timeline=new Ed({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 gp extends Yd{constructor(){super(ud(gp.getDefaults(),arguments,["context"]))}connect(t,e=0,n=0){return ap(this,t,e,n),this}}class _p extends gp{constructor(){const t=ud(_p.getDefaults(),arguments,["mapping","length"]);super(t),this.name="WaveShaper",this._shaper=this.context.createWaveShaper(),this.input=this._shaper,this.output=this._shaper,rd(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(sp.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));dd(e,"oversampling must be either 'none', '2x', or '4x'"),this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.disconnect(),this}}class yp extends gp{constructor(){const t=ud(yp.getDefaults(),arguments,["value"]);super(t),this.name="Pow",this._exponentScaler=this.input=this.output=new _p({context:this.context,mapping:this._expFunc(t.value),length:8192}),this._exponent=t.value}static getDefaults(){return Object.assign(gp.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 vp extends Kd{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 bp extends xd{constructor(){super(...arguments),this.name="IntervalTimeline",this._root=null,this._length=0}add(t){dd(td(t.time),"Events must have a time property"),dd(td(t.duration),"Events must have a duration parameter"),t.time=t.time.valueOf();let e=new wp(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 wp{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 xp extends Ed{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 pd(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 Tp extends Zd{constructor(){const t=ud(Tp.getDefaults(),arguments,["value"]);super(t),this.name="TickParam",this._events=new Ed(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(Zd.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(Yh(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 kp extends sp{constructor(){const t=ud(kp.getDefaults(),arguments,["value"]);super(t),this.name="TickSignal",this.input=this._param=new Tp({context:this.context,convert:t.convert,multiplier:t.multiplier,param:this._constantSource.offset,units:t.units,value:t.value})}static getDefaults(){return Object.assign(sp.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 Sp extends Qd{constructor(){const t=ud(Sp.getDefaults(),arguments,["frequency"]);super(t),this.name="TickSource",this._state=new xp,this._tickOffset=new Ed,this._ticksAtTime=new Ed,this._secondsAtTime=new Ed,this.frequency=new kp({context:this.context,units:t.units,value:t.frequency}),Ld(this,"frequency"),this._state.setStateAtTime("stopped",0),this.setTicksAtTime(0,0)}static getDefaults(){return Object.assign({frequency:1,units:"hertz"},Qd.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),td(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=Od(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 Ap extends Qd{constructor(){const t=ud(Ap.getDefaults(),arguments,["callback","frequency"]);super(t),this.name="Clock",this.callback=$d,this._lastUpdate=0,this._state=new xp("stopped"),this._boundLoop=this._loop.bind(this),this.callback=t.callback,this._tickSource=new Sp({context:this.context,frequency:t.frequency,units:t.units}),this._lastUpdate=0,this.frequency=this._tickSource.frequency,Ld(this,"frequency"),this._state.setStateAtTime("stopped",0),this.context.on("tick",this._boundLoop)}static getDefaults(){return Object.assign(Qd.getDefaults(),{callback:$d,frequency:1,units:"hertz"})}get state(){return this._state.getValueAtTime(this.now())}start(t,e){fd(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}}Rd.mixin(Ap);class Op{constructor(t,e){this.id=Op._eventId++,this._remainderTime=0;const n=Object.assign(Op.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:$d,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}}Op._eventId=0;class Ep extends Op{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(Ep.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({},Op.getDefaults(),{duration:1/0,interval:1,once:!1})}invoke(t){this._createEvents(t),super.invoke(t)}_createEvent(){return Ad(this._nextTick,this.floatTime+this.duration)?this.transport.scheduleOnce(this.invoke.bind(this),new vp(this.context,this._nextTick).toSeconds()):-1}_createEvents(t){Ad(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 vp(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);kd(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 Cp extends Qd{constructor(){const t=ud(Cp.getDefaults(),arguments);super(t),this.name="Transport",this._loop=new mp(!1),this._loopStart=0,this._loopEnd=0,this._scheduledEvents={},this._timeline=new Ed,this._repeatedEvents=new bp,this._syncedSignals=[],this._swingAmount=0,this._ppq=t.ppq,this._clock=new Ap({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),Ld(this,"bpm"),this._timeSignature=t.timeSignature,this._swingTicks=t.ppq/2}static getDefaults(){return Object.assign(Qd.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 vp(this.context,2*this._swingTicks/3).toSeconds()*r}_d(!0),this._timeline.forEachAtTime(e,e=>e.invoke(t)),_d(!1)}schedule(t,e){const n=new Op(this,{callback:t,time:new Kd(this.context,e).toTicks()});return this._addEvent(n,this._timeline)}scheduleRepeat(t,e,n,r=1/0){const i=new Ep(this,{callback:t,duration:new Wd(this.context,r).toTicks(),interval:new Wd(this.context,e).toTicks(),time:new Kd(this.context,n).toTicks()});return this._addEvent(i,this._repeatedEvents)}scheduleOnce(t,e){const n=new Op(this,{callback:t,once:!0,time:new Kd(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 vp(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(),td(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){rd(t)&&(t=t[0]/t[1]*4),this._timeSignature=t}get loopStart(){return new Wd(this.context,this._loopStart,"i").toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t)}get loopEnd(){return new Wd(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 vp(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 vp(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 rp(t),n=new yp(-1),s=new rp(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 rp(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(),Fd(this,"bpm"),this._timeline.dispose(),this._repeatedEvents.dispose(),this}}Rd.mixin(Cp),Id(t=>{t.transport=new Cp({context:t})}),jd(t=>{t.transport.dispose()});class Mp extends Yd{constructor(t){super(t),this.input=void 0,this._state=new xp("stopped"),this._synced=!1,this._scheduled=[],this._syncedStart=$d,this._syncedStop=$d,this._state.memory=100,this._state.increasing=!0,this._volume=this.output=new pp({context:this.context,mute:t.mute,volume:t.volume}),this.volume=this._volume.volume,Ld(this,"volume"),this.onstop=t.onstop}static getDefaults(){return Object.assign(Yd.getDefaults(),{mute:!1,onstop:$d,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=Yh(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(cd(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 fd(this.context),this._start(r,e,n);else dd(kd(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=Yh(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(e=this._clampToCurrentTime(e),"started"===this._state.getValueAtTime(e)||td(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(kd(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=$d,this.unsync(),this._volume.dispose(),this._state.dispose(),this}}class Ip extends gp{constructor(){super(...arguments),this.name="AudioToGain",this._norm=new _p({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 Np extends sp{constructor(){const t=ud(Np.getDefaults(),arguments,["value"]);super(t),this.name="Multiply",this.override=!1,this._mult=this.input=this.output=new rp({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(sp.getDefaults(),{value:0})}dispose(){return super.dispose(),this._mult.dispose(),this}}function jp(t,e){return y(this,void 0,void 0,function*(){const n=e/t.context.sampleRate,r=new qd(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 Rp extends ip{constructor(){const t=ud(Rp.getDefaults(),arguments,["frequency","type"]);super(t),this.name="ToneOscillatorNode",this._oscillator=this.context.createOscillator(),this._internalChannels=[this._oscillator],ep(this._oscillator,this._gainNode),this.type=t.type,this.frequency=new Zd({context:this.context,param:this._oscillator.frequency,units:"frequency",value:t.frequency}),this.detune=new Zd({context:this.context,param:this._oscillator.detune,units:"cents",value:t.detune}),Ld(this,["frequency","detune"])}static getDefaults(){return Object.assign(ip.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 Pp extends Mp{constructor(){const t=ud(Pp.getDefaults(),arguments,["frequency","type"]);super(t),this.name="Oscillator",this._oscillator=null,this.frequency=new sp({context:this.context,units:"frequency",value:t.frequency}),Ld(this,"frequency"),this.detune=new sp({context:this.context,units:"cents",value:t.detune}),Ld(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(Mp.getDefaults(),{detune:0,frequency:440,partialCount:0,partials:[],phase:0,type:"sine"})}_start(t){const e=this.toSeconds(t),n=new Rp({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 Pp._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=Pp._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(td(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),Pp._periodicWaveCache.push({imag:n,partialCount:this._partialCount,partials:this._partials,phase:this._phase,real:e,type:this._type,wave:this._wave}),Pp._periodicWaveCache.length>100&&Pp._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){pd(t,0);let e=this._type;const n=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(this._type);if(n&&(e=n[1]),"custom"!==this._type)this.type=0===t?e:e+t.toString();else{const e=new Float32Array(t);this._partials.forEach((t,n)=>e[n]=t),this._partials=Array.from(e),this.type=this._type}}_getRealImaginary(t,e){let n=2048;const r=new Float32Array(n),i=new Float32Array(n);let o=1;if("custom"===t){if(o=this._partials.length+1,this._partialCount=this._partials.length,n=o,0===this._partials.length)return[r,i]}else{const e=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(t);e?(o=parseInt(e[2],10)+1,this._partialCount=parseInt(e[2],10),t=e[1],o=Math.max(o,2),n=o):this._partialCount=0,this._partials=[]}for(let s=1;s<n;++s){const n=2/(s*Math.PI);let a;switch(t){case"sine":a=s<=o?1:0,this._partials[s-1]=a;break;case"square":a=1&s?2*n:0,this._partials[s-1]=a;break;case"sawtooth":a=n*(1&s?1:-1),this._partials[s-1]=a;break;case"triangle":a=1&s?n*n*2*(s-1>>1&1?-1:1):0,this._partials[s-1]=a;break;case"custom":a=this._partials[s-1];break;default:throw new TypeError("Oscillator: invalid type: "+t)}0!==a?(r[s]=-a*Math.sin(e*s),i[s]=a*Math.cos(e*s)):(r[s]=0,i[s]=0)}return[r,i]}_inverseFFT(t,e,n){let r=0;const i=t.length;for(let o=0;o<i;o++)r+=t[o]*Math.cos(o*n)+e[o]*Math.sin(o*n);return r}getInitialValue(){const[t,e]=this._getRealImaginary(this._type,0);let n=0;const r=2*Math.PI;for(let i=0;i<32;i++)n=Math.max(this._inverseFFT(t,e,i/32*r),n);return function(t,e,n){return Math.max(Math.min(t,n),e)}(-this._inverseFFT(t,e,this._phase)/n,-1,1)}get partials(){return this._partials.slice(0,this.partialCount)}set partials(t){this._partials=t,this._partialCount=this._partials.length,t.length&&(this.type="custom")}get phase(){return this._phase*(180/Math.PI)}set phase(t){this._phase=t*Math.PI/180,this.type=this._type}asArray(){return y(this,arguments,void 0,function*(t=1024){return jp(this,t)})}dispose(){return super.dispose(),null!==this._oscillator&&this._oscillator.dispose(),this._wave=void 0,this.frequency.dispose(),this.detune.dispose(),this}}Pp._periodicWaveCache=[];class Dp extends Mp{constructor(){const t=ud(Dp.getDefaults(),arguments,["frequency","type","modulationType"]);super(t),this.name="AMOscillator",this._modulationScale=new Ip({context:this.context}),this._modulationNode=new rp({context:this.context}),this._carrier=new Pp({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 Pp({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new Np({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),Ld(this,["frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Pp.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 y(this,arguments,void 0,function*(t=1024){return jp(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 Lp extends Mp{constructor(){const t=ud(Lp.getDefaults(),arguments,["frequency","type","spread"]);super(t),this.name="FatOscillator",this._oscillators=[],this.frequency=new sp({context:this.context,units:"frequency",value:t.frequency}),this.detune=new sp({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,Ld(this,["frequency","detune"])}static getDefaults(){return Object.assign(Pp.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(pd(t,1),this._oscillators.length!==t){this._forEach(t=>t.dispose()),this._oscillators=[];for(let e=0;e<t;e++){const n=new Pp({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):$d});"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 y(this,arguments,void 0,function*(t=1024){return jp(this,t)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this._forEach(t=>t.dispose()),this}}class Fp extends Mp{constructor(){const t=ud(Fp.getDefaults(),arguments,["frequency","type","modulationType"]);super(t),this.name="FMOscillator",this._modulationNode=new rp({context:this.context,gain:0}),this._carrier=new Pp({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 sp({context:this.context,units:"frequency",value:t.frequency}),this._modulator=new Pp({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new Np({context:this.context,units:"positive",value:t.harmonicity}),this.modulationIndex=new Np({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),Ld(this,["modulationIndex","frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Pp.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 y(this,arguments,void 0,function*(t=1024){return jp(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 $p extends Mp{constructor(){const t=ud($p.getDefaults(),arguments,["frequency","width"]);super(t),this.name="PulseOscillator",this._widthGate=new rp({context:this.context,gain:0}),this._thresh=new _p({context:this.context,mapping:t=>t<=0?-1:1}),this.width=new sp({context:this.context,units:"audioRange",value:t.width}),this._triangle=new Pp({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),Ld(this,["width","frequency","detune"])}static getDefaults(){return Object.assign(Mp.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 y(this,arguments,void 0,function*(t=1024){return jp(this,t)})}dispose(){return super.dispose(),this._triangle.dispose(),this.width.dispose(),this._widthGate.dispose(),this._thresh.dispose(),this}}class Bp extends Mp{constructor(){const t=ud(Bp.getDefaults(),arguments,["frequency","modulationFrequency"]);super(t),this.name="PWMOscillator",this.sourceType="pwm",this._scale=new Np({context:this.context,value:2}),this._pulse=new $p({context:this.context,frequency:t.modulationFrequency}),this._pulse.carrierType="sine",this.modulationFrequency=this._pulse.frequency,this._modulator=new Pp({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),Ld(this,["modulationFrequency","frequency","detune"])}static getDefaults(){return Object.assign(Mp.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 y(this,arguments,void 0,function*(t=1024){return jp(this,t)})}dispose(){return super.dispose(),this._pulse.dispose(),this._scale.dispose(),this._modulator.dispose(),this}}const qp={am:Dp,fat:Lp,fm:Fp,oscillator:Pp,pulse:$p,pwm:Bp};class Up extends Mp{constructor(){const t=ud(Up.getDefaults(),arguments,["frequency","type"]);super(t),this.name="OmniOscillator",this.frequency=new sp({context:this.context,units:"frequency",value:t.frequency}),this.detune=new sp({context:this.context,units:"cents",value:t.detune}),Ld(this,["frequency","detune"]),this.set(t)}static getDefaults(){return Object.assign(Pp.getDefaults(),Fp.getDefaults(),Dp.getDefaults(),Lp.getDefaults(),$p.getDefaults(),Bp.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=qp[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 qp[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")&&ed(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")&&ed(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"))&&id(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 y(this,arguments,void 0,function*(t=1024){return jp(this,t)})}dispose(){return super.dispose(),this.detune.dispose(),this.frequency.dispose(),this._oscillator.dispose(),this}}class Vp extends Yd{constructor(){const t=ud(Vp.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 pp({context:this.context,volume:t.volume}),this.volume=this._volume.volume,Ld(this,"volume")}static getDefaults(){return Object.assign(Yd.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 Gp extends Vp{constructor(){const t=ud(Gp.getDefaults(),arguments);super(t),this.portamento=t.portamento,this.onsilence=t.onsilence}static getDefaults(){return Object.assign(Vp.getDefaults(),{detune:0,onsilence:$d,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 Jd?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}}g([cp(0)],Gp.prototype,"portamento",void 0);class zp extends Gp{constructor(){const t=ud(zp.getDefaults(),arguments);super(t),this.name="Synth",this.oscillator=new Up(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 dp(Object.assign({context:this.context},t.envelope)),this.oscillator.chain(this.envelope,this.output),Ld(this,["oscillator","frequency","detune","envelope"])}static getDefaults(){return Object.assign(Gp.getDefaults(),{envelope:Object.assign(ld(lp.getDefaults(),Object.keys(Yd.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.3}),oscillator:Object.assign(ld(Up.getDefaults(),[...Object.keys(Mp.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 Wp extends Gp{constructor(){const t=ud(Wp.getDefaults(),arguments);super(t),this.name="ModulationSynth",this._carrier=new zp({context:this.context,oscillator:t.oscillator,envelope:t.envelope,onsilence:()=>this.onsilence(this),volume:-10}),this._modulator=new zp({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 sp({context:this.context,units:"frequency"}),this.detune=new sp({context:this.context,value:t.detune,units:"cents"}),this.harmonicity=new Np({context:this.context,value:t.harmonicity,minValue:0}),this._modulationNode=new rp({context:this.context,gain:0}),Ld(this,["frequency","harmonicity","oscillator","envelope","modulation","modulationEnvelope","detune"])}static getDefaults(){return Object.assign(Gp.getDefaults(),{harmonicity:3,oscillator:Object.assign(ld(Up.getDefaults(),[...Object.keys(Mp.getDefaults()),"frequency","detune"]),{type:"sine"}),envelope:Object.assign(ld(lp.getDefaults(),Object.keys(Yd.getDefaults())),{attack:.01,decay:.01,sustain:1,release:.5}),modulation:Object.assign(ld(Up.getDefaults(),[...Object.keys(Mp.getDefaults()),"frequency","detune"]),{type:"square"}),modulationEnvelope:Object.assign(ld(lp.getDefaults(),Object.keys(Yd.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 Jp extends Wp{constructor(){super(ud(Jp.getDefaults(),arguments)),this.name="AMSynth",this._modulationScale=new Ip({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 Hp extends Yd{constructor(){const t=ud(Hp.getDefaults(),arguments,["frequency","type"]);super(t),this.name="BiquadFilter",this._filter=this.context.createBiquadFilter(),this.input=this.output=this._filter,this.Q=new Zd({context:this.context,units:"number",value:t.Q,param:this._filter.Q}),this.frequency=new Zd({context:this.context,units:"frequency",value:t.frequency,param:this._filter.frequency}),this.detune=new Zd({context:this.context,units:"cents",value:t.detune,param:this._filter.detune}),this.gain=new Zd({context:this.context,units:"decibels",convert:!1,value:t.gain,param:this._filter.gain}),this.type=t.type}static getDefaults(){return Object.assign(Yd.getDefaults(),{Q:1,type:"lowpass",frequency:350,detune:0,gain:0})}get type(){return this._filter.type}set type(t){dd(-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 Xp extends Yd{constructor(){const t=ud(Xp.getDefaults(),arguments,["frequency","type","rolloff"]);super(t),this.name="Filter",this.input=new rp({context:this.context}),this.output=new rp({context:this.context}),this._filters=[],this._filters=[],this.Q=new sp({context:this.context,units:"positive",value:t.Q}),this.frequency=new sp({context:this.context,units:"frequency",value:t.frequency}),this.detune=new sp({context:this.context,units:"cents",value:t.detune}),this.gain=new sp({context:this.context,units:"decibels",convert:!1,value:t.gain}),this._type=t.type,this.rolloff=t.rolloff,Ld(this,["detune","frequency","gain","Q"])}static getDefaults(){return Object.assign(Yd.getDefaults(),{Q:1,detune:0,frequency:350,gain:0,rolloff:-12,type:"lowpass"})}get type(){return this._type}set type(t){dd(-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=ed(t)?t:parseInt(t,10),n=[-12,-24,-48,-96];let r=n.indexOf(e);dd(-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 Hp({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,tp(this.input,...this._internalChannels,this.output)}getFrequencyResponse(t=128){const e=new Hp({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()}),Fd(this,["detune","frequency","gain","Q"]),this.frequency.dispose(),this.Q.dispose(),this.detune.dispose(),this.gain.dispose(),this}}class Kp extends sp{constructor(){super(ud(Kp.getDefaults(),arguments,["value"])),this.override=!1,this.name="Add",this._sum=new rp({context:this.context}),this.input=this._sum,this.output=this._sum,this.addend=this._param,tp(this._constantSource,this._sum)}static getDefaults(){return Object.assign(sp.getDefaults(),{value:0})}dispose(){return super.dispose(),this._sum.dispose(),this}}class Qp extends gp{constructor(){const t=ud(Qp.getDefaults(),arguments,["min","max"]);super(t),this.name="Scale",this._mult=this.input=new Np({context:this.context,value:t.max-t.min}),this._add=this.output=new Kp({context:this.context,value:t.min}),this._min=t.min,this._max=t.max,this.input.connect(this.output)}static getDefaults(){return Object.assign(gp.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 Zp extends lp{constructor(){const t=ud(Zp.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 yp({context:this.context,value:t.exponent}),this._scale=this.output=new Qp({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(lp.getDefaults(),{baseFrequency:200,exponent:1,octaves:4})}get baseFrequency(){return this._baseFrequency}set baseFrequency(t){const e=this.toFrequency(t);pd(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 Yp extends Gp{constructor(){const t=ud(Yp.getDefaults(),arguments);super(t),this.name="MonoSynth",this.oscillator=new Up(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 Xp(Object.assign(t.filter,{context:this.context})),this.filterEnvelope=new Zp(Object.assign(t.filterEnvelope,{context:this.context})),this.envelope=new dp(Object.assign(t.envelope,{context:this.context})),this.oscillator.chain(this.filter,this.envelope,this.output),this.filterEnvelope.connect(this.filter.frequency),Ld(this,["oscillator","frequency","detune","filter","filterEnvelope","envelope"])}static getDefaults(){return Object.assign(Gp.getDefaults(),{envelope:Object.assign(ld(lp.getDefaults(),Object.keys(Yd.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.9}),filter:Object.assign(ld(Xp.getDefaults(),Object.keys(Yd.getDefaults())),{Q:1,rolloff:-12,type:"lowpass"}),filterEnvelope:Object.assign(ld(Zp.getDefaults(),Object.keys(Yd.getDefaults())),{attack:.6,baseFrequency:200,decay:.2,exponent:2,octaves:3,release:2,sustain:.5}),oscillator:Object.assign(ld(Up.getDefaults(),Object.keys(Mp.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 tf extends gp{constructor(){super(ud(tf.getDefaults(),arguments)),this.name="Zero",this._gain=new rp({context:this.context}),this.output=this._gain,this.input=void 0,ep(this.context.getConstant(0),this._gain)}dispose(){return super.dispose(),np(this.context.getConstant(0),this._gain),this}}class ef extends Yd{constructor(){const t=ud(ef.getDefaults(),arguments,["frequency","min","max"]);super(t),this.name="LFO",this._stoppedValue=0,this._units="number",this.convert=!0,this._fromType=Zd.prototype._fromType,this._toType=Zd.prototype._toType,this._is=Zd.prototype._is,this._clampValue=Zd.prototype._clampValue,this._oscillator=new Pp(t),this.frequency=this._oscillator.frequency,this._amplitudeGain=new rp({context:this.context,gain:t.amplitude,units:"normalRange"}),this.amplitude=this._amplitudeGain.gain,this._stoppedSignal=new sp({context:this.context,units:"audioRange",value:0}),this._zeros=new tf({context:this.context}),this._a2g=new Ip({context:this.context}),this._scaler=this.output=new Qp({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),Ld(this,["amplitude","frequency"]),this.phase=t.phase}static getDefaults(){return Object.assign(Pp.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 Zd||t instanceof sp)&&(this.convert=t.convert,this.units=t.units),ap(this,t,e,n),this}dispose(){return super.dispose(),this._oscillator.dispose(),this._stoppedSignal.dispose(),this._zeros.dispose(),this._scaler.dispose(),this._a2g.dispose(),this._amplitudeGain.dispose(),this.amplitude.dispose(),this}}class nf extends Gp{constructor(){const t=ud(nf.getDefaults(),arguments);super(t),this.name="DuoSynth",this.voice0=new Yp(Object.assign(t.voice0,{context:this.context,onsilence:()=>this.onsilence(this)})),this.voice1=new Yp(Object.assign(t.voice1,{context:this.context})),this.harmonicity=new Np({context:this.context,units:"positive",value:t.harmonicity}),this._vibrato=new ef({frequency:t.vibratoRate,context:this.context,min:-50,max:50}),this._vibrato.start(),this.vibratoRate=this._vibrato.frequency,this._vibratoGain=new rp({context:this.context,units:"normalRange",gain:t.vibratoAmount}),this.vibratoAmount=this._vibratoGain.gain,this.frequency=new sp({context:this.context,units:"frequency",value:440}),this.detune=new sp({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),Ld(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 ad(Gp.getDefaults(),{vibratoAmount:.5,vibratoRate:5,harmonicity:1.5,voice0:ad(ld(Yp.getDefaults(),Object.keys(Gp.getDefaults())),{filterEnvelope:{attack:.01,decay:0,sustain:1,release:.5},envelope:{attack:.01,decay:0,sustain:1,release:.5}}),voice1:ad(ld(Yp.getDefaults(),Object.keys(Gp.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 rf extends Wp{constructor(){const t=ud(rf.getDefaults(),arguments);super(t),this.name="FMSynth",this.modulationIndex=new Np({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(Wp.getDefaults(),{modulationIndex:10})}dispose(){return super.dispose(),this.modulationIndex.dispose(),this}}class of extends zp{constructor(){const t=ud(of.getDefaults(),arguments);super(t),this.name="MembraneSynth",this.portamento=0,this.pitchDecay=t.pitchDecay,this.octaves=t.octaves,Ld(this,["oscillator","envelope"])}static getDefaults(){return ad(Gp.getDefaults(),zp.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 Jd?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}}g([up(0)],of.prototype,"octaves",void 0),g([cp(0)],of.prototype,"pitchDecay",void 0);const sf=[1,1.483,1.932,2.546,2.63,3.897];class af extends Gp{constructor(){const t=ud(af.getDefaults(),arguments);super(t),this.name="MetalSynth",this._oscillators=[],this._freqMultipliers=[],this.detune=new sp({context:this.context,units:"cents",value:t.detune}),this.frequency=new sp({context:this.context,units:"frequency"}),this._amplitude=new rp({context:this.context,gain:0}).connect(this.output),this._highpass=new Xp({Q:0,context:this.context,type:"highpass"}).connect(this._amplitude);for(let e=0;e<sf.length;e++){const n=new Fp({context:this.context,harmonicity:t.harmonicity,modulationIndex:t.modulationIndex,modulationType:"square",onstop:0===e?()=>this.onsilence(this):$d,type:"square"});n.connect(this._highpass),this._oscillators[e]=n;const r=new Np({context:this.context,value:sf[e]});this._freqMultipliers[e]=r,this.frequency.chain(r,n.frequency),this.detune.connect(n.detune)}this._filterFreqScaler=new Qp({context:this.context,max:7e3,min:this.toFrequency(t.resonance)}),this.envelope=new lp({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 ad(Gp.getDefaults(),{envelope:Object.assign(ld(lp.getDefaults(),Object.keys(Yd.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 uf extends ip{constructor(){const t=ud(uf.getDefaults(),arguments,["url","onload"]);super(t),this.name="ToneBufferSource",this._source=this.context.createBufferSource(),this._internalChannels=[this._source],this._sourceStarted=!1,this._sourceStopped=!1,ep(this._source,this._gainNode),this._source.onended=()=>this._stopSource(),this.playbackRate=new Zd({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 Bd(t.url,t.onload,t.onerror),this._internalChannels.push(this._source)}static getDefaults(){return Object.assign(ip.getDefaults(),{url:new Bd,loop:!1,loopEnd:0,loopStart:0,onload:$d,onerror:$d,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){dd(this.buffer.loaded,"buffer is either not set or not loaded");const i=this.toSeconds(t);this._startGain(i,r),e=this.loop?cd(e,this.loopStart):cd(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;Sd(o,t)&&(o=(o-e)%n+e),Od(o,this.buffer.duration)&&(o=0)}if(this._source.buffer=this.buffer.get(),this._source.loopEnd=this.toSeconds(this.loopEnd)||this.buffer.duration,Ad(o,this.buffer.duration)&&(this._sourceStarted=!0,this._source.start(i,o)),td(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 cf extends Mp{constructor(){const t=ud(cf.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(Mp.getDefaults(),{fadeIn:0,fadeOut:0,playbackRate:1,type:"white"})}get type(){return this._type}set type(t){if(dd(t in df,"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=df[this._type];this._source=new uf({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 lf=220500,hf={brown:null,pink:null,white:null},df={get brown(){if(!hf.brown){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(lf);t[e]=n;let r=0;for(let t=0;t<lf;t++){const e=2*Math.random()-1;n[t]=(r+.02*e)/1.02,r=n[t],n[t]*=3.5}}hf.brown=(new Bd).fromArray(t)}return hf.brown},get pink(){if(!hf.pink){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(lf);let r,i,o,s,a,u,c;t[e]=n,r=i=o=s=a=u=c=0;for(let t=0;t<lf;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}}hf.pink=(new Bd).fromArray(t)}return hf.pink},get white(){if(!hf.white){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(lf);t[e]=n;for(let t=0;t<lf;t++)n[t]=2*Math.random()-1}hf.white=(new Bd).fromArray(t)}return hf.white}};class pf extends Vp{constructor(){const t=ud(pf.getDefaults(),arguments);super(t),this.name="NoiseSynth",this.noise=new cf(Object.assign({context:this.context},t.noise)),this.envelope=new dp(Object.assign({context:this.context},t.envelope)),this.noise.chain(this.envelope,this.output)}static getDefaults(){return Object.assign(Vp.getDefaults(),{envelope:Object.assign(ld(lp.getDefaults(),Object.keys(Yd.getDefaults())),{decay:.1,sustain:0}),noise:Object.assign(ld(cf.getDefaults(),Object.keys(Mp.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 ff=new Set;function mf(t){ff.add(t)}class gf extends Yd{constructor(t){super(t),this.name="ToneAudioWorklet",this.workletOptions={},this.onprocessorerror=$d;const e=URL.createObjectURL(new Blob([Array.from(ff).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}}mf('\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');mf("\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");mf("\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 _f="feedback-comb-filter";!function(t,e){const n=`registerProcessor("${t}", ${e})`;ff.add(n)}(_f,'\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 yf extends gf{constructor(){const t=ud(yf.getDefaults(),arguments,["delayTime","resonance"]);super(t),this.name="FeedbackCombFilter",this.input=new rp({context:this.context}),this.output=new rp({context:this.context}),this.delayTime=new Zd({context:this.context,value:t.delayTime,units:"time",minValue:0,maxValue:1,param:this._dummyParam,swappable:!0}),this.resonance=new Zd({context:this.context,value:t.resonance,units:"normalRange",param:this._dummyParam,swappable:!0}),Ld(this,["resonance","delayTime"])}_audioWorkletName(){return _f}static getDefaults(){return Object.assign(Yd.getDefaults(),{delayTime:.1,resonance:.5})}onReady(t){tp(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 vf extends Yd{constructor(){const t=ud(vf.getDefaults(),arguments,["frequency","type"]);super(t),this.name="OnePoleFilter",this._frequency=t.frequency,this._type=t.type,this.input=new rp({context:this.context}),this.output=new rp({context:this.context}),this._createFilter()}static getDefaults(){return Object.assign(Yd.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 bf extends Yd{constructor(){const t=ud(bf.getDefaults(),arguments,["delayTime","resonance","dampening"]);super(t),this.name="LowpassCombFilter",this._combFilter=this.output=new yf({context:this.context,delayTime:t.delayTime,resonance:t.resonance}),this.delayTime=this._combFilter.delayTime,this.resonance=this._combFilter.resonance,this._lowpass=this.input=new vf({context:this.context,frequency:t.dampening,type:"lowpass"}),this._lowpass.connect(this._combFilter)}static getDefaults(){return Object.assign(Yd.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 wf extends Vp{constructor(){const t=ud(wf.getDefaults(),arguments);super(t),this.name="PluckSynth",this._noise=new cf({context:this.context,type:"pink"}),this.attackNoise=t.attackNoise,this._lfcf=new bf({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 ad(Vp.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 xf extends Jd{constructor(){super(...arguments),this.name="MidiClass",this.defaultUnits="midi"}_frequencyToUnits(t){return ga(super._frequencyToUnits(t))}_ticksToUnits(t){return ga(super._ticksToUnits(t))}_beatsToUnits(t){return ga(super._beatsToUnits(t))}_secondsToUnits(t){return ga(super._secondsToUnits(t))}toMidi(){return this.valueOf()}toFrequency(){return ya(this.toMidi())}transpose(t){return new xf(this.context,this.toMidi()+t)}}class Tf extends Vp{constructor(){const t=ud(Tf.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),dd(!ed(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(Vp.getDefaults(),{maxPolyphony:32,options:{},voice:zp})}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 dd(t instanceof Gp,"Voice must extend Monophonic class"),t.connect(this.output),this._voices.push(t),t}vd("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){dd(!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),rd(e)){dd(rd(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);dd(o>0,"The duration must be greater than 0"),this.triggerRelease(t[n],i+o)}}else{const n=this.toSeconds(e);dd(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=ld(t,["onsilence","context"]);return this.options=ad(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 kf extends xd{constructor(){super(),this.name="ToneAudioBuffers",this._buffers=new Map,this._loadingCount=0;const t=ud(kf.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:$d,onload:$d,urls:{}}}has(t){return this._buffers.has(t.toString())}get(t){return dd(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=$d,r=$d){return id(e)?(this.baseUrl&&"data:audio/"===e.trim().substring(0,11).toLowerCase()&&(this.baseUrl=""),this._buffers.set(t.toString(),new Bd(this.baseUrl+e,n,r))):this._buffers.set(t.toString(),new Bd(e,n,r)),this}dispose(){return super.dispose(),this._buffers.forEach(t=>t.dispose()),this._buffers.clear(),this}}class Sf extends Vp{constructor(){const t=ud(Sf.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(dd(od(n)||ed(r)&&isFinite(r),`url key is neither a note or midi pitch: ${n}`),od(n)){const r=new Jd(this.context,n).toMidi();e[r]=t.urls[n]}else ed(r)&&isFinite(r)&&(e[r]=t.urls[r])}),this._buffers=new kf({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(Vp.getDefaults(),{attack:0,baseUrl:"",curve:"exponential",onload:$d,onerror:$d,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=_a(new Jd(this.context,t).toFrequency()),i=Math.round(r),o=r-i,s=this._findClosest(i),a=i-s,u=this._buffers.get(a),c=fa(s+o),l=new uf({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),rd(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 Jd(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),rd(e)?(dd(rd(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(dd(od(t)||isFinite(t),`note must be a pitch or midi: ${t}`),od(t)){const r=new Jd(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}}g([cp(0)],Sf.prototype,"attack",void 0),g([cp(0)],Sf.prototype,"release",void 0);const Af={synth:{new:t=>new zp(t)},amsynth:{new:t=>new Jp(t)},duosynth:{new:t=>new nf(t)},fmsynth:{new:t=>new rf(t)},membranesynth:{new:t=>new of(t)},metalsynth:{new:t=>new af(t)},monosynth:{new:t=>new Yp(t)},noisesynth:{new:t=>new pf(t)},plucksynth:{new:t=>new wf(t)},polysynth:{new:(t,e)=>new Tf(t,e)},sampler:{new:t=>new Sf(t)}},Of={synth:zp,monosynth:Yp,fmsynth:rf,duosyntho:nf,amsynth:Jp},Ef={autofilter:{new:t=>new tonepkg.AutoFilter(t)},bitcrusher:{new:t=>new tonepkg.BitCrusher(t)},chebyshev:{new:t=>new tonepkg.Chebyshev(t)},pitchshift:{new:t=>new tonepkg.PitchShift(t)}},Cf=(t,e,n=!1)=>{try{if(e?.effect){return n?(globalThis.sound[t].set(e.effect.options),globalThis.sound[t]):Ef[e.effect.type]?.new(e.effect.options)}throw"effect is not defined in the config"}catch(t){return}},Mf=()=>{globalThis.sound={}},If=t=>{globalThis.sound[t]&&(globalThis.sound[t].dispose(),delete globalThis.sound[t])},{JZZ:Nf}=ha(),jf=(Bt("error",{type:"critical",message:"LEAF core error: race condition detected in sound.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/sound.js"},{}),{24:["C"],25:["C#","Db"],26:["D"],27:["D#","Eb"],28:["E"],29:["F"],30:["F#","Gb"],31:["G"],32:["G#","Ab"],33:["A"],34:["A#","Bb"],35:["B"]}),Rf=(t,e=0)=>{const n=1+Math.floor((t-24)/12);return jf[t-12*(n-1)][e]+String(n)},Pf=t=>{const e=t[m_.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[m_.REFNODE]},u=(Bt("accio","ctrl_accio"),Bt("accio","data_accio"));(n?vs(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[m_.sound.CONFIG]=e});const c=(e=void 0)=>{if(e){const o=e._content.soundnode_trail.slice(-1)[0],a=t[m_.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[m_.REFNODE])}}},l=(e=void 0)=>{let n,s;e?(n=qt("soundconfig",e),t[m_.sound.CONFIG]=n):n=t[m_.sound.CONFIG],s=r?((t,e,n=!1)=>{try{if(e?.instrument)return n?(globalThis.sound[t].set(e.instrument.options),globalThis.sound[t]):Af[e.instrument.type]?.new(e.instrument.voice?Of[e.instrument.voice]:zp,e.instrument.options);throw"instrument is not defined in the config"}catch(t){return}})(t[m_.REFNODE],n):i?void 0:o?Cf(t[m_.REFNODE],n,void 0!==t[m_.sound.SOUNDSTAGE]):Cf(t[m_.REFNODE],n),t[m_.sound.SOUNDSTAGE]=s,((t,e)=>{globalThis.sound[t]=e})(t[m_.REFNODE],s)};return{leaflogic:(e,n)=>{const r=new It(void 0),i=n._stream.pipe(Y(e=>(t[m_.CTRLIN]=e,e)),oe(...e.map(t=>t._stream)),Y(e=>{const n=e.slice(1).flat().map(t=>{if("_data_in"===t._bname)return qt("*",t);if("_midi_in"===t._bname){const{cmd:e,noteNumber:n,velocity:r}=t._content;return t}if("soundconfig"===t._bname)l(t);else if("soundinit"===t._bname)return c(t)}).filter(t=>t);return n.length>0&&r.next(n),t[m_.CTRLIN]}),se());return{_stream:r.pipe(Q(t=>t)),_control:{_stream:i}}},datalogic:{pre:e=>{const n=e;return t[m_.sound.SOUNDSTAGE]||s||l(),s&&"started"!==tonepkg.Transport.state&&(tonepkg.start(),tonepkg.Transport.start()),n},post:n=>{const r=Object.keys(e),i=["image","audio","video"].filter(t=>r.includes(t));i.length>0&&i[0];Array.isArray(n);let o=n.map(e=>{if("_midi_in"===e._bname){const n=t[m_.sound.SOUNDSTAGE];if(e._content.velocity>0){const t=Rf(e._content.noteNumber),r=e._content.duration;r?n.triggerAttackRelease(t,r):n.triggerAttack(t)}else{const t=Rf(e._content.noteNumber);n.triggerRelease(t)}return Ut}return e});o=1===o.length?o[0]:o;return o}}}},Df=Bt("error",{type:"critical",message:"LEAF core error: race condition detected in gnav.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/gnav.js"},{}),Lf=t=>{const e=t[m_.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[m_.REFNODE]};let s={};return{leaflogic:(e,n)=>{s=n._config;const a=new Ct,u=r?Ss(n,e,void 0,o,{leaflogic:r,datalogic:{post:e=>(t[m_.gnav.EDGES]=e,e)}}):{_stream:ve([]),_control:n._stream},c=(i?Ss(u._control,e,void 0,o,{leaflogic:i,datalogic:{post:e=>(t[m_.gnav.BACKDROP]=e,e)}}):{_stream:ve("/assets/test/hubbleinfrared_dark2.jpg"),_control:u._control})._control._stream.pipe(oe(...e.map(t=>t._stream)),Y(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=>qt("screenio",t)).filter(t=>t):qt("screenio",t),post:r=>{const i=r,o=qt(t[m_.gnav.EDGES]),a=(o||[]).map(t=>({...t,uuid:uuid4()})),u=t[m_.gnav.BACKDROP],c=Object.keys(e),l=(["edges","backdrop","tagvectors","tagaction","blankaction"].filter(t=>c.includes(t)),new It(Df)),h=g_({element:{nodeuuid:t[m_.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 vs(t,[],{...s}):[]},tagaction:async r=>{const i="tagaction"in e&&"_default"in e.tagaction?e.tagaction._default:void 0,o=i?await vs(i,r,{...s}):r;return n&&l.next(Bt("elementio",{element:"gnav",nodeuuid:t[m_.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 vs(n,t,{...s}):t},graph_options:{layout:"3d"},...t[m_.RTCONTEXT]}}},"screenio");return h}}}},{memoize:Ff}=ft(),$f=(Bt("error",{type:"critical",message:"LEAF core error: race condition detected in http.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library.js"},{}),t=>{const e=t[m_.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[m_.REFNODE]},o=async(n,r={})=>{let i=t[m_.http.URI],o=t[m_.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&&Dt(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=m_.DOMAIN?t[m_.DOMAIN]:void 0,h=m_.APPID?t[m_.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=ft().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)}):ve([{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"}):ve([{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 Ct,u=n?Ss(s,e,void 0,i,{leaflogic:n,datalogic:{post:e=>(t[m_.http.URI]=e,e)}}):(t[m_.http.URI]="{*}",{_stream:new It("{*}"),_control:{_stream:s._stream}}),c=r?Ss(s,e,void 0,i,{leaflogic:r,datalogic:{post:e=>(t[m_.http.HEADER]=e,e)}}):(t[m_.http.HEADER]="",{_stream:new It(""),_control:{_stream:s._stream}}),l=Ee([u._control._stream,c._control._stream]),h=Ee([u._stream,c._stream]),d=l.pipe(oe(h),Y(t=>t[0]));let p=!1;const f=d.pipe(oe(...e.map(t=>t._stream)),ue(t=>o(t.slice(1),t[0])),Y(e=>(p=!0,e?.length>1||!Array.isArray(e)?a.next(e):1===e?.length&&a.next(e[0]),t[m_.CTRLIN])),se());return{_stream:a.pipe(Q(t=>p),Y(t=>t),se()),_control:{_stream:f.pipe(Y(t=>t),se())}}},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={"&":"&","<":"<",">":">",'"':""","'":"'"};return t.replace(/[&<>"']/g,function(t){return e[t]})})(t):t};return g_(e?.name&&"AxiosError"===e.name?{error:e.message,data:e.response.data}:n(e),"elementio")}}}}),{memoize:Bf}=ft(),qf=(Bt("error",{type:"critical",message:"LEAF core error: race condition detected in href.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library.js"},{}),t=>{const e=t[m_.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[m_.REFNODE]},i=async n=>{let r=t[m_.href.URI],i=n;i=1===i.length?i[0]:i;const o=Object.keys(e),s=["uri","post","put","get","header","?graph"].filter(t=>o.includes(t));"{*}"===r&&Dt(i)&&"href-request"===i._bname&&(r=i._content.uri?i._content.uri:"https://www.leafgon.com",i=i._content.data?i._content.data:"");const a=m_.DOMAIN?t[m_.DOMAIN]:void 0,u=m_.APPID?t[m_.APPID]:void 0,c=s.includes("?graph")?r+`?graph=${a}/${u}`:r,l=ft().throttle(async()=>await(async({uri:t}={})=>{try{return"undefined"!=typeof window&&window.location.href.slice(-t.length)!==t&&(window.location.href=t),t}catch(t){return t}})({uri:c}),1e3);return await l()};return{leaflogic:(e,o)=>{const s=new Ct,a=n?Ss(o,e,void 0,r,{leaflogic:n,datalogic:{post:e=>(t[m_.href.URI]=e,e)}}):(t[m_.href.URI]="{*}",{_stream:new It("{*}"),_control:{_stream:o._stream}}),u=a._control._stream,c=a._stream,l=u.pipe(oe(c),Y(t=>t[0]));let h=!1;const d=l.pipe(oe(...e.map(t=>t._stream)),ue(t=>i(t.slice(1))),Y(e=>(h=!0,e?.length>1||!Array.isArray(e)?s.next(e):1===e?.length&&s.next(e[0]),t[m_.CTRLIN])),se());return{_stream:s.pipe(Q(t=>h),Y(t=>t),se()),_control:{_stream:d.pipe(Y(t=>t),se())}}},datalogic:{pre:t=>t}}});var Uf=r(639),Vf=r.n(Uf);Bt("error",{type:"critical",message:"LEAF core error: race condition detected in text.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/text.js"},{});const Gf=t=>{const e=new Ct,n=new Ct,r=new Ct,i=t[m_.LAMBDA_OBJ],o="_default"in i?i._default:void 0,s={codebase:"ghostos/api/parser/nodelogic/elements/library/html.js",...t},a=Bt("accio","ctrl_accio"),u=Bt("accio","data_accio"),c=o?Ss({_stream:ve(a)},[{_stream:ve(u)}],void 0,s,{leaflogic:o,datalogic:{post:t=>t}}):{_stream:ve(""),_control:{_stream:ve(a)}};t[m_.html.TEMPLATE]=void 0,rr(c._control._stream.pipe(oe(c._stream))).then(e=>{const n=typeof e[1];if("string"===n)t[m_.html.TEMPLATE]={_default:Vf().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]=Vf().compile(r))}),Object.keys(n).length>0&&(t[m_.html.TEMPLATE]=n)}Vf().registerHelper("markdown",function(t){t=(t=(t=(t=(t=(t=t.replace(/>/gm,">")).replace(/</gm,"<")).replace(/&/gm,"&")).replace(/(\r\n|\n|\r)/gm,"\n")).replace(/\\"/gm,'\\"')).replace(/"/gm,'"');return`atob('${Buffer.from(t).toString("base64")}')`}),Vf().registerHelper("json",function(t){const e=Buffer.from(JSON.stringify(t,function t(e,n){const r=typeof n;if("string"===r){const t=/^\{((?:-(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))|(?:0|(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))))(?:.\d+|))\}$/,e=n.match(t);if(null!==e){return Number(e[1])}return n}if("object"===r){if(Array.isArray(n))return n.map((e,n)=>t(n,e));return Object.assign({},...Object.entries(n).map(([e,n])=>({[e]:t(e,n)})))}return n})).toString("base64");return`JSON.parse(atob('${e}'))`}),Vf().registerHelper("tostring",function(t){return String(t)}),r.next()});return{elementio$:n,leaflogic:(i,o)=>{const s=o._stream.pipe(oe(...i.map(t=>t._stream)),ue(e=>{const i=new It(e[0]),o=new It(e[1]);return t[m_.html.TEMPLATE]?Ee(i,ye(o,n)):r.pipe(oe(i,ye(o,n)),Y(t=>t[1]))}),Y(r=>{const i=t[m_.html.TEMPLATE],o=r[1];if(Dt(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=>qt("*",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(Dt(t)){const n=qt("*",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=g_({element:{nodeuuid:t[m_.REFNODE],type:"html",componentdata:{innerhtml:s,callback:t=>{n.next(Bt("elementio",t))},...t[m_.RTCONTEXT]}}},"screenio");return e.next(a),r[0]}}),Q(t=>void 0!==t));return{_stream:e,_control:{_stream:s}}},datalogic:{pre:t=>t,post:t=>t}}},zf=(Bt("error",{type:"critical",message:"LEAF core error: race condition detected in text.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/text.js"},{}),t=>{const e=new Ct,n=new Ct,r=new Ct,i=t[m_.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=Bt("accio","ctrl_accio"),c=Bt("accio","data_accio"),l=o?Ss({_stream:ve(u)},[{_stream:ve(c)}],void 0,a,{leaflogic:o,datalogic:{post:t=>t}}):{_stream:ve(""),_control:{_stream:ve(u)}};t[m_.html.TEMPLATE]=void 0,rr(l._control._stream.pipe(oe(l._stream))).then(e=>{const n=typeof e[1];if("string"===n)t[m_.html.TEMPLATE]={_default:Vf().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]=Vf().compile(r))}),Object.keys(n).length>0&&(t[m_.html.TEMPLATE]=n)}Vf().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(oe(...i.map(t=>t._stream)),ue(e=>{const i=new It(e[0]),o=new It(e[1]);return t[m_.html.TEMPLATE]?Ee(i,ye(o,n)):r.pipe(oe(i,ye(o,n)),Y(t=>t[1]))}),Y(n=>{const r=t[m_.html.TEMPLATE],i=n[1];if(Dt(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[m_.REFNODE].slice(0,8)}', _content: formData, _label: {refnode: '${t[m_.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[m_.REFNODE]}')\n );\n <\/script>\n `,n=`\n <div id='${t[m_.REFNODE]}'></div>\n `,r=t=>t.replace(/(\r\n|\n|\r)/gm,"").replace(/(\s+)/gm," "),i=t[m_.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 Bt(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[m_.REFNODE]})})();return e.next(r),n[0]}}),Q(t=>void 0!==t));return{_stream:e,_control:{_stream:a}}},datalogic:{pre:t=>t,post:t=>t}}});function Wf(t,e){return function(){return t.apply(e,arguments)}}const{toString:Jf}=Object.prototype,{getPrototypeOf:Hf}=Object,{iterator:Xf,toStringTag:Kf}=Symbol,Qf=(Zf=Object.create(null),t=>{const e=Jf.call(t);return Zf[e]||(Zf[e]=e.slice(8,-1).toLowerCase())});var Zf;const Yf=t=>(t=t.toLowerCase(),e=>Qf(e)===t),tm=t=>e=>typeof e===t,{isArray:em}=Array,nm=tm("undefined");const rm=Yf("ArrayBuffer");const im=tm("string"),om=tm("function"),sm=tm("number"),am=t=>null!==t&&"object"==typeof t,um=t=>{if("object"!==Qf(t))return!1;const e=Hf(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Kf in t||Xf in t)},cm=Yf("Date"),lm=Yf("File"),hm=Yf("Blob"),dm=Yf("FileList"),pm=Yf("URLSearchParams"),[fm,mm,gm,_m]=["ReadableStream","Request","Response","Headers"].map(Yf);function ym(t,e,{allOwnKeys:n=!1}={}){if(null==t)return;let r,i;if("object"!=typeof t&&(t=[t]),em(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{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 vm(t,e){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 bm="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,wm=t=>!nm(t)&&t!==bm;const xm=(Tm="undefined"!=typeof Uint8Array&&Hf(Uint8Array),t=>Tm&&t instanceof Tm);var Tm;const km=Yf("HTMLFormElement"),Sm=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Am=Yf("RegExp"),Om=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};ym(n,(n,i)=>{let o;!1!==(o=e(n,i,t))&&(r[i]=o||n)}),Object.defineProperties(t,r)};const Em=Yf("AsyncFunction"),Cm=(Mm="function"==typeof setImmediate,Im=om(bm.postMessage),Mm?setImmediate:Im?(Nm=`axios@${Math.random()}`,jm=[],bm.addEventListener("message",({source:t,data:e})=>{t===bm&&e===Nm&&jm.length&&jm.shift()()},!1),t=>{jm.push(t),bm.postMessage(Nm,"*")}):t=>setTimeout(t));var Mm,Im,Nm,jm;const Rm="undefined"!=typeof queueMicrotask?queueMicrotask.bind(bm):"undefined"!=typeof process&&process.nextTick||Cm,Pm={isArray:em,isArrayBuffer:rm,isBuffer:function(t){return null!==t&&!nm(t)&&null!==t.constructor&&!nm(t.constructor)&&om(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||om(t.append)&&("formdata"===(e=Qf(t))||"object"===e&&om(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&rm(t.buffer),e},isString:im,isNumber:sm,isBoolean:t=>!0===t||!1===t,isObject:am,isPlainObject:um,isReadableStream:fm,isRequest:mm,isResponse:gm,isHeaders:_m,isUndefined:nm,isDate:cm,isFile:lm,isBlob:hm,isRegExp:Am,isFunction:om,isStream:t=>am(t)&&om(t.pipe),isURLSearchParams:pm,isTypedArray:xm,isFileList:dm,forEach:ym,merge:function t(){const{caseless:e}=wm(this)&&this||{},n={},r=(r,i)=>{const o=e&&vm(n,i)||i;um(n[o])&&um(r)?n[o]=t(n[o],r):um(r)?n[o]=t({},r):em(r)?n[o]=r.slice():n[o]=r};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&ym(arguments[t],r);return n},extend:(t,e,n,{allOwnKeys:r}={})=>(ym(e,(e,r)=>{n&&om(e)?t[r]=Wf(e,n):t[r]=e},{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),t.prototype.constructor=t,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&&Hf(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:Qf,kindOfTest:Yf,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(em(t))return t;let e=t.length;if(!sm(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},forEachEntry:(t,e)=>{const n=(t&&t[Xf]).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:km,hasOwnProperty:Sm,hasOwnProp:Sm,reduceDescriptors:Om,freezeMethods:t=>{Om(t,(e,n)=>{if(om(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=t[n];om(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 em(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:vm,global:bm,isContextDefined:wm,isSpecCompliantForm:function(t){return!!(t&&om(t.append)&&"FormData"===t[Kf]&&t[Xf])},toJSONObject:t=>{const e=new Array(10),n=(t,r)=>{if(am(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[r]=t;const i=em(t)?[]:{};return ym(t,(t,e)=>{const o=n(t,r+1);!nm(o)&&(i[e]=o)}),e[r]=void 0,i}}return t};return n(t,0)},isAsyncFn:Em,isThenable:t=>t&&(am(t)||om(t))&&om(t.then)&&om(t.catch),setImmediate:Cm,asap:Rm,isIterable:t=>null!=t&&om(t[Xf])};function Dm(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}Pm.inherits(Dm,Error,{toJSON:function(){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:Pm.toJSONObject(this.config),code:this.code,status:this.status}}});const Lm=Dm.prototype,Fm={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{Fm[t]={value:t}}),Object.defineProperties(Dm,Fm),Object.defineProperty(Lm,"isAxiosError",{value:!0}),Dm.from=(t,e,n,r,i,o)=>{const s=Object.create(Lm);return Pm.toFlatObject(t,s,function(t){return t!==Error.prototype},t=>"isAxiosError"!==t),Dm.call(s,t.message,e,n,r,i),s.cause=t,s.name=t.name,o&&Object.assign(s,o),s};const $m=Dm;function Bm(t){return Pm.isPlainObject(t)||Pm.isArray(t)}function qm(t){return Pm.endsWith(t,"[]")?t.slice(0,-2):t}function Um(t,e,n){return t?t.concat(e).map(function(t,e){return t=qm(t),!n&&e?"["+t+"]":t}).join(n?".":""):e}const Vm=Pm.toFlatObject(Pm,{},null,function(t){return/^is[A-Z]/.test(t)});const Gm=function(t,e,n){if(!Pm.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const r=(n=Pm.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(t,e){return!Pm.isUndefined(e[t])})).metaTokens,i=n.visitor||c,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Pm.isSpecCompliantForm(e);if(!Pm.isFunction(i))throw new TypeError("visitor must be a function");function u(t){if(null===t)return"";if(Pm.isDate(t))return t.toISOString();if(Pm.isBoolean(t))return t.toString();if(!a&&Pm.isBlob(t))throw new $m("Blob is not supported. Use a Buffer instead.");return Pm.isArrayBuffer(t)||Pm.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(Pm.endsWith(n,"{}"))n=r?n:n.slice(0,-2),t=JSON.stringify(t);else if(Pm.isArray(t)&&function(t){return Pm.isArray(t)&&!t.some(Bm)}(t)||(Pm.isFileList(t)||Pm.endsWith(n,"[]"))&&(a=Pm.toArray(t)))return n=qm(n),a.forEach(function(t,r){!Pm.isUndefined(t)&&null!==t&&e.append(!0===s?Um([n],r,o):null===s?n:n+"[]",u(t))}),!1;return!!Bm(t)||(e.append(Um(i,n,o),u(t)),!1)}const l=[],h=Object.assign(Vm,{defaultVisitor:c,convertValue:u,isVisitable:Bm});if(!Pm.isObject(t))throw new TypeError("data must be an object");return function t(n,r){if(!Pm.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),Pm.forEach(n,function(n,o){!0===(!(Pm.isUndefined(n)||null===n)&&i.call(e,n,Pm.isString(o)?o.trim():o,r,h))&&t(n,r?r.concat(o):[o])}),l.pop()}}(t),e};function zm(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}function Wm(t,e){this._pairs=[],t&&Gm(t,this,e)}const Jm=Wm.prototype;Jm.append=function(t,e){this._pairs.push([t,e])},Jm.toString=function(t){const e=t?function(e){return t.call(this,e,zm)}:zm;return this._pairs.map(function(t){return e(t[0])+"="+e(t[1])},"").join("&")};const Hm=Wm;function Xm(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Km(t,e,n){if(!e)return t;const r=n&&n.encode||Xm;Pm.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(o=i?i(e,n):Pm.isURLSearchParams(e)?e.toString():new Hm(e,n).toString(r),o){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}const Qm=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){Pm.forEach(this.handlers,function(e){null!==e&&t(e)})}},Zm={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ym={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Hm,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},tg="undefined"!=typeof window&&"undefined"!=typeof document,eg="object"==typeof navigator&&navigator||void 0,ng=tg&&(!eg||["ReactNative","NativeScript","NS"].indexOf(eg.product)<0),rg="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ig=tg&&window.location.href||"http://localhost",og={...i,...Ym};const sg=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&&Pm.isArray(r)?r.length:o,a)return Pm.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!s;r[o]&&Pm.isObject(r[o])||(r[o]=[]);return e(t,n,r[o],i)&&Pm.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(Pm.isFormData(t)&&Pm.isFunction(t.entries)){const n={};return Pm.forEachEntry(t,(t,r)=>{e(function(t){return Pm.matchAll(/\w+|\[(\w*)]/g,t).map(t=>"[]"===t[0]?"":t[1]||t[0])}(t),r,n,0)}),n}return null};const ag={transitional:Zm,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",r=n.indexOf("application/json")>-1,i=Pm.isObject(t);i&&Pm.isHTMLForm(t)&&(t=new FormData(t));if(Pm.isFormData(t))return r?JSON.stringify(sg(t)):t;if(Pm.isArrayBuffer(t)||Pm.isBuffer(t)||Pm.isStream(t)||Pm.isFile(t)||Pm.isBlob(t)||Pm.isReadableStream(t))return t;if(Pm.isArrayBufferView(t))return t.buffer;if(Pm.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 Gm(t,new og.classes.URLSearchParams,Object.assign({visitor:function(t,e,n,r){return og.isNode&&Pm.isBuffer(t)?(this.append(e,t.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((o=Pm.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return Gm(o?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||r?(e.setContentType("application/json",!1),function(t,e,n){if(Pm.isString(t))try{return(e||JSON.parse)(t),Pm.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||ag.transitional,n=e&&e.forcedJSONParsing,r="json"===this.responseType;if(Pm.isResponse(t)||Pm.isReadableStream(t))return t;if(t&&Pm.isString(t)&&(n&&!this.responseType||r)){const n=!(e&&e.silentJSONParsing)&&r;try{return JSON.parse(t)}catch(t){if(n){if("SyntaxError"===t.name)throw $m.from(t,$m.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:og.classes.FormData,Blob:og.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Pm.forEach(["delete","get","head","post","put","patch"],t=>{ag.headers[t]={}});const ug=ag,cg=Pm.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"]),lg=Symbol("internals");function hg(t){return t&&String(t).trim().toLowerCase()}function dg(t){return!1===t||null==t?t:Pm.isArray(t)?t.map(dg):String(t)}function pg(t,e,n,r,i){return Pm.isFunction(r)?r.call(this,e,n):(i&&(e=n),Pm.isString(e)?Pm.isString(r)?-1!==e.indexOf(r):Pm.isRegExp(r)?r.test(e):void 0:void 0)}class fg{constructor(t){t&&this.set(t)}set(t,e,n){const r=this;function i(t,e,n){const i=hg(e);if(!i)throw new Error("header name must be a non-empty string");const o=Pm.findKey(r,i);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||e]=dg(t))}const o=(t,e)=>Pm.forEach(t,(t,n)=>i(t,n,e));if(Pm.isPlainObject(t)||t instanceof this.constructor)o(t,e);else if(Pm.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]&&cg[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(Pm.isObject(t)&&Pm.isIterable(t)){let n,r,i={};for(const e of t){if(!Pm.isArray(e))throw TypeError("Object iterator must return a key-value pair");i[r=e[0]]=(n=i[r])?Pm.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=hg(t)){const n=Pm.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(Pm.isFunction(e))return e.call(this,t,n);if(Pm.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=hg(t)){const n=Pm.findKey(this,t);return!(!n||void 0===this[n]||e&&!pg(0,this[n],n,e))}return!1}delete(t,e){const n=this;let r=!1;function i(t){if(t=hg(t)){const i=Pm.findKey(n,t);!i||e&&!pg(0,n[i],i,e)||(delete n[i],r=!0)}}return Pm.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&&!pg(0,this[i],i,t,!0)||(delete this[i],r=!0)}return r}normalize(t){const e=this,n={};return Pm.forEach(this,(r,i)=>{const o=Pm.findKey(n,i);if(o)return e[o]=dg(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]=dg(r),n[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return Pm.forEach(this,(n,r)=>{null!=n&&!1!==n&&(e[r]=t&&Pm.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[lg]=this[lg]={accessors:{}}).accessors,n=this.prototype;function r(t){const r=hg(t);e[r]||(!function(t,e){const n=Pm.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 Pm.isArray(t)?t.forEach(r):r(t),this}}fg.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Pm.reduceDescriptors(fg.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}}),Pm.freezeMethods(fg);const mg=fg;function gg(t,e){const n=this||ug,r=e||n,i=mg.from(r.headers);let o=r.data;return Pm.forEach(t,function(t){o=t.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function _g(t){return!(!t||!t.__CANCEL__)}function yg(t,e,n){$m.call(this,null==t?"canceled":t,$m.ERR_CANCELED,e,n),this.name="CanceledError"}Pm.inherits(yg,$m,{__CANCEL__:!0});const vg=yg;function bg(t,e,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?e(new $m("Request failed with status code "+n.status,[$m.ERR_BAD_REQUEST,$m.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}const wg=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 xg=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.apply(null,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)]},Tg=(t,e,n=3)=>{let r=0;const i=wg(50,250);return xg(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)},kg=(t,e)=>{const n=null!=t;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Sg=t=>(...e)=>Pm.asap(()=>t(...e)),Ag=og.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,og.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(og.origin),og.navigator&&/(msie|trident)/i.test(og.navigator.userAgent)):()=>!0,Og=og.hasStandardBrowserEnv?{write(t,e,n,r,i,o){const s=[t+"="+encodeURIComponent(e)];Pm.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),Pm.isString(r)&&s.push("path="+r),Pm.isString(i)&&s.push("domain="+i),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Eg(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 Cg=t=>t instanceof mg?{...t}:t;function Mg(t,e){e=e||{};const n={};function r(t,e,n,r){return Pm.isPlainObject(t)&&Pm.isPlainObject(e)?Pm.merge.call({caseless:r},t,e):Pm.isPlainObject(e)?Pm.merge({},e):Pm.isArray(e)?e.slice():e}function i(t,e,n,i){return Pm.isUndefined(e)?Pm.isUndefined(t)?void 0:r(void 0,t,0,i):r(t,e,0,i)}function o(t,e){if(!Pm.isUndefined(e))return r(void 0,e)}function s(t,e){return Pm.isUndefined(e)?Pm.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(Cg(t),Cg(e),0,!0)};return Pm.forEach(Object.keys(Object.assign({},t,e)),function(r){const o=u[r]||i,s=o(t[r],e[r],r);Pm.isUndefined(s)&&o!==a||(n[r]=s)}),n}const Ig=t=>{const e=Mg({},t);let n,{data:r,withXSRFToken:i,xsrfHeaderName:o,xsrfCookieName:s,headers:a,auth:u}=e;if(e.headers=a=mg.from(a),e.url=Km(Eg(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),u&&a.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):""))),Pm.isFormData(r))if(og.hasStandardBrowserEnv||og.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[t,...e]=n?n.split(";").map(t=>t.trim()).filter(Boolean):[];a.setContentType([t||"multipart/form-data",...e].join("; "))}if(og.hasStandardBrowserEnv&&(i&&Pm.isFunction(i)&&(i=i(e)),i||!1!==i&&Ag(e.url))){const t=o&&s&&Og.read(s);t&&a.set(o,t)}return e},Ng="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise(function(e,n){const r=Ig(t);let i=r.data;const o=mg.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=mg.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());bg(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 $m("Request aborted",$m.ECONNABORTED,t,m)),m=null)},m.onerror=function(){n(new $m("Network Error",$m.ERR_NETWORK,t,m)),m=null},m.ontimeout=function(){let e=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const i=r.transitional||Zm;r.timeoutErrorMessage&&(e=r.timeoutErrorMessage),n(new $m(e,i.clarifyTimeoutError?$m.ETIMEDOUT:$m.ECONNABORTED,t,m)),m=null},void 0===i&&o.setContentType(null),"setRequestHeader"in m&&Pm.forEach(o.toJSON(),function(t,e){m.setRequestHeader(e,t)}),Pm.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),h&&"json"!==h&&(m.responseType=r.responseType),p&&([u,l]=Tg(p,!0),m.addEventListener("progress",u)),d&&m.upload&&([a,c]=Tg(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(r.cancelToken||r.signal)&&(s=e=>{m&&(n(!e||e.type?new vg(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===og.protocols.indexOf(_)?n(new $m("Unsupported protocol "+_+":",$m.ERR_BAD_REQUEST,t)):m.send(i||null)})},jg=(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 $m?e:new vg(e instanceof Error?e.message:e))}};let o=e&&setTimeout(()=>{o=null,i(new $m(`timeout ${e} of ms exceeded`,$m.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=()=>Pm.asap(s),a}},Rg=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},Pg=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()}},Dg=(t,e,n,r)=>{const i=async function*(t,e){for await(const n of Pg(t))yield*Rg(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})},Lg="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Fg=Lg&&"function"==typeof ReadableStream,$g=Lg&&("function"==typeof TextEncoder?(Bg=new TextEncoder,t=>Bg.encode(t)):async t=>new Uint8Array(await new Response(t).arrayBuffer()));var Bg;const qg=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},Ug=Fg&&qg(()=>{let t=!1;const e=new Request(og.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Vg=Fg&&qg(()=>Pm.isReadableStream(new Response("").body)),Gg={stream:Vg&&(t=>t.body)};var zg;Lg&&(zg=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Gg[t]&&(Gg[t]=Pm.isFunction(zg[t])?e=>e[t]():(e,n)=>{throw new $m(`Response type '${t}' is not supported`,$m.ERR_NOT_SUPPORT,n)})}));const Wg=async(t,e)=>{const n=Pm.toFiniteNumber(t.getContentLength());return null==n?(async t=>{if(null==t)return 0;if(Pm.isBlob(t))return t.size;if(Pm.isSpecCompliantForm(t)){const e=new Request(og.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return Pm.isArrayBufferView(t)||Pm.isArrayBuffer(t)?t.byteLength:(Pm.isURLSearchParams(t)&&(t+=""),Pm.isString(t)?(await $g(t)).byteLength:void 0)})(e):n},Jg=Lg&&(async t=>{let{url:e,method:n,data:r,signal:i,cancelToken:o,timeout:s,onDownloadProgress:a,onUploadProgress:u,responseType:c,headers:l,withCredentials:h="same-origin",fetchOptions:d}=Ig(t);c=c?(c+"").toLowerCase():"text";let p,f=jg([i,o&&o.toAbortSignal()],s);const m=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let g;try{if(u&&Ug&&"get"!==n&&"head"!==n&&0!==(g=await Wg(l,r))){let t,n=new Request(e,{method:"POST",body:r,duplex:"half"});if(Pm.isFormData(r)&&(t=n.headers.get("content-type"))&&l.setContentType(t),n.body){const[t,e]=kg(g,Tg(Sg(u)));r=Dg(n.body,65536,t,e)}}Pm.isString(h)||(h=h?"include":"omit");const i="credentials"in Request.prototype;p=new Request(e,{...d,signal:f,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:i?h:void 0});let o=await fetch(p,d);const s=Vg&&("stream"===c||"response"===c);if(Vg&&(a||s&&m)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=o[e]});const e=Pm.toFiniteNumber(o.headers.get("content-length")),[n,r]=a&&kg(e,Tg(Sg(a),!0))||[];o=new Response(Dg(o.body,65536,n,()=>{r&&r(),m&&m()}),t)}c=c||"text";let _=await Gg[Pm.findKey(Gg,c)||"text"](o,t);return!s&&m&&m(),await new Promise((e,n)=>{bg(e,n,{data:_,headers:mg.from(o.headers),status:o.status,statusText:o.statusText,config:t,request:p})})}catch(e){if(m&&m(),e&&"TypeError"===e.name&&/Load failed|fetch/i.test(e.message))throw Object.assign(new $m("Network Error",$m.ERR_NETWORK,t,p),{cause:e.cause||e});throw $m.from(e,e&&e.code,t,p)}}),Hg={http:null,xhr:Ng,fetch:Jg};Pm.forEach(Hg,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}});const Xg=t=>`- ${t}`,Kg=t=>Pm.isFunction(t)||null===t||!1===t,Qg=t=>{t=Pm.isArray(t)?t:[t];const{length:e}=t;let n,r;const i={};for(let o=0;o<e;o++){let e;if(n=t[o],r=n,!Kg(n)&&(r=Hg[(e=String(n)).toLowerCase()],void 0===r))throw new $m(`Unknown adapter '${e}'`);if(r)break;i[e||"#"+o]=r}if(!r){const t=Object.entries(i).map(([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build"));let n=e?t.length>1?"since :\n"+t.map(Xg).join("\n"):" "+Xg(t[0]):"as no adapter specified";throw new $m("There is no suitable adapter to dispatch the request "+n,"ERR_NOT_SUPPORT")}return r};function Zg(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new vg(null,t)}function Yg(t){Zg(t),t.headers=mg.from(t.headers),t.data=gg.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Qg(t.adapter||ug.adapter)(t).then(function(e){return Zg(t),e.data=gg.call(t,t.transformResponse,e),e.headers=mg.from(e.headers),e},function(e){return _g(e)||(Zg(t),e&&e.response&&(e.response.data=gg.call(t,t.transformResponse,e.response),e.response.headers=mg.from(e.response.headers))),Promise.reject(e)})}const t_="1.10.0",e_={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{e_[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const n_={};e_.transitional=function(t,e,n){return(r,i,o)=>{if(!1===t)throw new $m(function(t,e){return"[Axios v"+t_+"] Transitional option '"+t+"'"+e+(n?". "+n:"")}(i," has been removed"+(e?" in "+e:"")),$m.ERR_DEPRECATED);return e&&!n_[i]&&(n_[i]=!0),!t||t(r,i,o)}},e_.spelling=function(t){return(t,e)=>!0};const r_={assertOptions:function(t,e,n){if("object"!=typeof t)throw new $m("options must be an object",$m.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 $m("option "+o+" must be "+n,$m.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new $m("Unknown option "+o,$m.ERR_BAD_OPTION)}},validators:e_},i_=r_.validators;class o_{constructor(t){this.defaults=t||{},this.interceptors={request:new Qm,response:new Qm}}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=Mg(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:i}=e;void 0!==n&&r_.assertOptions(n,{silentJSONParsing:i_.transitional(i_.boolean),forcedJSONParsing:i_.transitional(i_.boolean),clarifyTimeoutError:i_.transitional(i_.boolean)},!1),null!=r&&(Pm.isFunction(r)?e.paramsSerializer={serialize:r}:r_.assertOptions(r,{encode:i_.function,serialize:i_.function},!0)),void 0!==e.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),r_.assertOptions(e,{baseUrl:i_.spelling("baseURL"),withXsrfToken:i_.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=i&&Pm.merge(i.common,i[e.method]);i&&Pm.forEach(["delete","get","head","post","put","patch","common"],t=>{delete i[t]}),e.headers=mg.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=[Yg.bind(this),void 0];for(t.unshift.apply(t,s),t.push.apply(t,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=0;h<l;){const t=s[h++],e=s[h++];try{d=t(d)}catch(t){e.call(this,t);break}}try{c=Yg.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 Km(Eg((t=Mg(this.defaults,t)).baseURL,t.url,t.allowAbsoluteUrls),t.params,t.paramsSerializer)}}Pm.forEach(["delete","get","head","options"],function(t){o_.prototype[t]=function(e,n){return this.request(Mg(n||{},{method:t,url:e,data:(n||{}).data}))}}),Pm.forEach(["post","put","patch"],function(t){function e(e){return function(n,r,i){return this.request(Mg(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}o_.prototype[t]=e(),o_.prototype[t+"Form"]=e(!0)});const s_=o_;class a_{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 vg(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 a_(function(e){t=e}),cancel:t}}}const u_=a_;const c_={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};Object.entries(c_).forEach(([t,e])=>{c_[e]=t});const l_=c_;const h_=function t(e){const n=new s_(e),r=Wf(s_.prototype.request,n);return Pm.extend(r,s_.prototype,n,{allOwnKeys:!0}),Pm.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return t(Mg(e,n))},r}(ug);h_.Axios=s_,h_.CanceledError=vg,h_.CancelToken=u_,h_.isCancel=_g,h_.VERSION=t_,h_.toFormData=Gm,h_.AxiosError=$m,h_.Cancel=h_.CanceledError,h_.all=function(t){return Promise.all(t)},h_.spread=function(t){return function(e){return t.apply(null,e)}},h_.isAxiosError=function(t){return Pm.isObject(t)&&!0===t.isAxiosError},h_.mergeConfig=Mg,h_.AxiosHeaders=mg,h_.formToJSON=t=>sg(Pm.isHTMLForm(t)?new FormData(t):t),h_.getAdapter=Qg,h_.HttpStatusCode=l_,h_.default=h_;const d_=h_,{memoize:p_}=ft(),f_=(Bt("error",{type:"critical",message:"LEAF core error: race condition detected in http.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library.js"},{}),t=>{const e=t[m_.LAMBDA_OBJ],n="uri"in e&&"_default"in e.uri?e.uri._default:void 0,r="header"in e&&"_default"in e.header?e.header._default:void 0,i=async n=>{t[m_.http.URI];const r=t[m_.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=(m_.DOMAIN&&t[m_.DOMAIN],m_.APPID&&t[m_.APPID],s.includes("post")?"post":s.includes("put")?"put":"get"),u=ft().throttle(async()=>await(async({http_mode:t,uri:e}={})=>{if(["post","put"].includes(t)){r?.X_CSRF_Token&&(d_.defaults.headers.post["X-CSRF-Token"]=r.X_CSRF_Token);try{const t=s.includes("put")?d_.put(e,i):d_.post(e,i);return await t}catch(t){return t.response||t.request,t.response}}else try{const t=e?d_.get(e):ve([{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[m_.REFNODE]};return{leaflogic:(e,s)=>{const a=new Ct,u=n?Ss(s,e,void 0,o,{leaflogic:n,datalogic:{post:e=>(t[m_.http.URI]=e,e)}}):{_stream:ve("https://httpbin.org"),_control:{_stream:s._stream}},c=r?Ss(s,e,void 0,o,{leaflogic:r,datalogic:{post:e=>(t[m_.http.HEADER]=e,e)}}):{_stream:ve(""),_control:{_stream:s._stream}},l=Ee([u._control._stream,c._control._stream]),h=Ee([u._stream,c._stream]),d=l.pipe(oe(h),Y(t=>t[0]));let p=!1;const f=d.pipe(oe(...e.map(t=>t._stream)),ue(t=>i(t.slice(1))),Y(e=>(p=!0,e?.length>1||!Array.isArray(e)?a.next(e):1===e?.length&&a.next(e[0]),t[m_.CTRLIN])),se());return{_stream:a.pipe(Q(t=>p),Y(t=>t),se()),_control:{_stream:f.pipe(Y(t=>t),se())}}},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={"&":"&","<":"<",">":">",'"':""","'":"'"};return t.replace(/[&<>"']/g,function(t){return e[t]})})(t):t};return g_(e(t),"elementio")}}}}),m_={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"}},g_=(t,e="defaultio",n=!0)=>n?Bt(e,t):t,__={mediaplayer:ta,http:$f,gnav:Lf,popup:ia,image:ua,editor:sa,text:aa,prompt:na,mediainput:ca,midi:pa,sound:Pf,html:Gf,href:qf,form:zf,directus:f_},y_=it("leafdeckspade"),v_={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 F_({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(await Ks.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i}),ps.lambda(t)({refnodedata:{leaf:{logic:{args:{graphuuid:"",domain:"breezyforest",appid:"leafdeckspade",graphaddrstr:"breezyforest/spade"}}}},nodelambda:[],contextuallambda:[]})),a=(await s,{codebase:"leafdeckspade.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data});return(t,r)=>{let i=["_leafdeckdiamond"];const s=r._config?.loopidx,{type:u,args:c}=n.leaf.logic,l="_default"in o?(t,n)=>{const r={...n};s>=0&&(r._config.loopidx=s),r._config.clubrefnode=e;return o._default(t,r)}:(t,e)=>({...ze(t),_control:e}),d=r._stream;return Ss({_stream:d},t,void 0,{...a,metastep:"creating a leafdeckspade element"},{datalogic:{pre:t=>Array.isArray(t)?t.map(t=>qt(i,t)).filter(t=>t):qt(i,t),post:t=>{const e=Array.isArray(t)?t:[t],n={type:"leafdeckspade",uuid:h(),name:Yo(y_.editorconfig.namedatakey,c),description:"{description}",lambdas:{default:"defaultLambda",defaultLambda:l,bro:t=>t},diamonds:e};return Bt("screenio",n)}}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await F_({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}},b_=it("leafdeckheart"),w_={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 F_({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(await Ks.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i}),await pr.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckheart"}}}},nodelambda:[],contextuallambda:i}),{codebase:"leafdeckheart.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data});return(t,r)=>{let i=["_leafdeckdiamond"];const a=r._config?.loopidx,{type:u,args:c}=n.leaf.logic,l="_default"in o?(t,n)=>{const r={...n};a>=0&&(r._config.loopidx=a),r._config.clubrefnode=e;return o._default(t,r)}:(t,e)=>({...ze(t),_control:e}),d=r._stream;return Ss({_stream:d},t,void 0,{...s,metastep:"creating a leafdeckheart element"},{datalogic:{pre:t=>Array.isArray(t)?t.map(t=>qt(i,t)).filter(t=>t):qt(i,t),post:t=>{const e=Array.isArray(t)?t:[t],n={type:"leafdeckheart",uuid:h(),name:Yo(b_.editorconfig.namedatakey,c),description:"{description}",lambdas:{default:"defaultLambda",defaultLambda:l,bro:t=>t},diamonds:e};return Bt("screenio",n)}}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await F_({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}},x_=it("leafdeckdiamond"),T_={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 F_({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(await Ks.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i}),{codebase:"leafdeckdiamond.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data});return(t,r)=>{let i=["_leafdeckclub"];const a=r._config?.loopidx,{type:u,args:c}=n.leaf.logic,l="_default"in o?(t,n)=>{const r={_stream:n._stream.pipe(Y(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(Y(t=>t)),_control:{_stream:i._control._stream.pipe(Y(t=>t))}}}:"href"in o&&"_default"in o.href?(t,e)=>{const n=o.href._default(t,e);return{_stream:n._stream.pipe(Y(t=>(window.location.href.slice(-t.length)!==t&&(window.location.href=t),t))),_control:{...e._control,_stream:n._control._stream.pipe(Y(t=>t))}}}:(t,e)=>({...ze(t),_control:e}),d=r._stream,p=Ss({_stream:d},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=>{Dt(t)&&(t._bname===i[0]?n.clubs.push(qt(i,t)):"nodeinput"===t._bname&&n.nodeinput.push(qt("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:h(),nodeuuid:e,name:Yo(x_.editorconfig.namedatakey,c),svgicon:"https://www.leafgon.com/icons/hardware/laptop_mac/materialicons/24px.svg",description:"{description}",nodeinput:t.nodeinput,lambdas:{default:"defaultLambda",defaultLambda:l,bro:t=>t},subscription:r,clubs:n};return Bt("_leafdeckdiamond",i)}}});return{_stream:p._stream.pipe(Y(t=>t)),_control:p._control}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await F_({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}},k_=it("leafdeckclub"),S_={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 F_({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s={codebase:"leafdeckclub.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,r)=>{const i=r._config?.loopidx,{type:a,args:u}=n.leaf.logic,c="_default"in o?(t,n)=>{const r={...n};i>=0&&(r._config.loopidx=i),r._config.clubrefnode=e;return o._default(t,r)}:(t,e)=>({...ze(t),_control:e}),l=r._stream.pipe(Y(t=>t)),d=Ss({_stream:l},t,void 0,{...s,metastep:"creating a leafdeckclub element"},{datalogic:{pre:t=>{const e=Array.isArray(t)?t:[t],n={nodeinput:[]};return e.map(t=>{Dt(t)&&"nodeinput"===t._bname&&n.nodeinput.push(qt("nodeinput",t))}),n},post:t=>{const n="subscribe"in o,r={type:"leafdeckclub",uuid:h(),nodeuuid:e,name:Yo(k_.editorconfig.namedatakey,u),svgicon:"https://www.leafgon.com/icons/hardware/laptop_mac/materialicons/24px.svg",description:"{description}",nodeinput:t.nodeinput,lambdas:{default:"defaultLambda",defaultLambda:c,bro:t=>t},subscription:n};return Bt("_leafdeckclub",r)}}});return{_stream:d._stream.pipe(Y(t=>t)),_control:d._control}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await F_({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=t=>({...e(t,controlflow$obj),_control:controlflow$obj})}),s}},A_={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 F_({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree});const o=fr.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckspade"}}}},nodelambda:[],contextuallambda:i}),s=fr.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckheart"}}}},nodelambda:[],contextuallambda:i}),a=fr.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafpopupview"}}}},nodelambda:[],contextuallambda:i}),u=void 0;return t=>{const e=o(t),n=s(t),r=a(t),i=u([e,n]).pipe(Y(t=>t),Y(t=>t));r.pipe(Y(t=>t),Y(t=>{}));return i.pipe(Q(t=>t))}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await F_({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=t=>e(t)}),s}},O_={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 F_({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s="_default"in o?t=>o._default([t]):t=>t,a=pr.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafpopupview"}}}},nodelambda:[],contextuallambda:i});return t=>{const e=t.pipe(Y(t=>t),Y(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(Q(t=>t)))}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await F_({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=t=>e(t)}),s}},E_=Bt("error",{type:"critical",message:"LEAF core error: race condition detected in leafelement.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/leafelement.js"},{}),C_={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 F_({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{type:s,args:a}=n.leaf.logic,u=n.leaf.logic.args.elementname,c=(t.gos.etaTree.hostdomain,t.gos.etaTree.hostappid,t.gos.etaTree.domain),l=t.gos.etaTree.appid;"domain"in o&&"_default"in o.domain&&o.domain._default,"appid"in o&&"_default"in o.appid&&o.appid._default,"uidefs"in o&&"_default"in o.uidefs&&o.uidefs._default,"edges"in o&&"_default"in o.edges&&o.edges._default,new It(E_);["f30e","7a65"].includes(e.slice(0,4));const h={codebase:"leafelement.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};let d={};d[m_.LAMBDA_OBJ]=o,d[m_.REFNODE]=e,d[m_.RTCONTEXT]={graphdomain:c,graphappid:l,refnodedata:n,nodelambda:r,contextuallambda:i};const p=((t,e)=>Object.keys(__).includes(e)&&__[e]?{...__[e](t)}:void 0)(d,u);return(n,r)=>{e?.slice(0,4);const i=r._stream.pipe(Y(e=>(d[m_.CTRLIN]=e,d[m_.DOMAIN]=t.gos.etaTree.domain,d[m_.APPID]=t.gos.etaTree.appid,e)));"elementio$"in p&&(t.gos.etaTree.leafio.elementioLUT[e]=p.elementio$);return Ss({_stream:i},n,void 0,{...h,metastep:"element "+u},{leaflogic:p?p.leaflogic:void 0,datalogic:{pre:p?p.datalogic.pre:void 0,post:p?p.datalogic.post:void 0}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await F_({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s},methods:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={configtext:""};return{texteditor:{setTextSource:r=>{o.configtext=r;const i={...n};i.leaf.logic.args.elementconfig=r,is_interactive||t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:encodeUnicode(JSON.stringify(i))}})},getTextSource:()=>n.leaf.logic.args.elementconfig},general:{getNodeData:()=>n,getLambdaLUT:async()=>{const n=await F_({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),o={};return Object.entries(n).map(([t,e])=>{o[t]=(t,n)=>({...e(t,n),_control:n})}),o},setElementName:r=>{const i={...n};i.leaf.logic.args.elementname=r,t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:encodeUnicode(JSON.stringify(i))}})}}}}};r(4106);function M_(t,e,n){const r={leafoutflowport:Es,leafinflowport:Os,leafscreenio:Cs,leafmemoryio:Rs,leafdeckspade:v_,leafdeckheart:w_,leafdeckdiamond:T_,leafdeckclub:S_,leafgnav:A_,leafpopupview:O_,leafelement:C_,leafgraph:ps,leaflambdagraph:ir,leafanchor:fs,leafspell:cr,leafspelldef:Ho,leafloopyspell:Zo,leafchronosflow:Xs,leafasyncflow:Xs,leafmixflow:Ks,leafgateflow:Zs,leaflisp:Hs,leaflabel:hr,leafdelabel:dr,leafbottle:pr,leafunbottle:fr,leafcrate:mr,leafconfig:Jo};return r[t][e]?r[t][e](n):void 0}const{memoize:I_}=ft(),N_={isdebug:!1},j_=Bt("error",{type:"critical",message:"LEAF core error: race condition detected in eta.js",codebase:"/src/ghostos/api/parser/eta.js"},{}),R_=(t,e)=>([...Array(e).keys()].map(e=>{t[e]=!1}),t),P_=(t,e={time:-1,count:-1},n=void 0,r={})=>{Bt("empty_bottle","empty_data",{_provenance:{rt_context:r,codebase:"eta.js doChronosSynchronize"}});const i=new Ct,o=(t[0]._control._stream,t.length,t.map(t=>t._control._stream)),s=t.map(t=>t._stream),a={};let u={};const c=t.length;R_(a,c);return{ctrl:n&&n.synchronized?ye(...t.map((t,e)=>t._control._stream.pipe(oe(t._stream),Y(t=>[e,t])))).pipe(Y(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)){R_(a,c);const t=Object.values(u);return u={},t}}),Q(t=>void 0!==t),Y(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}}),Q(t=>void 0!==t)):o.length>1?ye(...o.map((t,e)=>t.pipe(oe(s[e]),Y(t=>{const e=t[0];e.length>1&&e.includes(void 0),r.nodeuuid,Dt(t[1])&&t[1]._bname;let n=t.slice(1);return i.next(n),e})))):o[0].pipe(oe(s[0]),Y(t=>{const e=t[0];Dt(t[1])&&t[1]._bname;let n=t[1];return i.next(n),e})),data:i.pipe(Q(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(j_)))}},D_=(t,e,n,r,i,o,s)=>{const a={refnode:t,codebase:"eta.js weaveDataflowPlane",domain:i.domain,appid:i.appid},u=Bt("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(Y(t=>t)),_control:{_stream:c[t].ctrl_out._stream.pipe(Y(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(Q(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(j_)),Y(t=>(["c10cbbbb-14d5-4270-b17a-1965afcabc98"].includes(o),Dt(t)&&t._bname,["c822ae2e-1be8-46be-b2cb-21a43cef0555","e9e6e44b-792b-46d0-b1d3-58ce2f46c45b"].includes(o)&&Dt(t)&&t._bname,t)))),data_out:void 0,ctrl_in$Arr:e.map((t,e)=>t._stream.pipe(Q(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(j_)),Y(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:ye(...c[t].get_composite_in$objArr().map(t=>t._control._stream)),data:void 0}:P_(c[t].get_composite_in$objArr(),{time:-1,count:-1},c[t],{...a,...m,at:"eta.js _weaveDataflowPlane",nodeuuid:t}),v={_stream:_.pipe(Y(t=>t))},b=g?c[t].get_composite_in$objArr().map((t,e)=>({_stream:t._stream.pipe(Y(t=>t))})):[{_stream:y.pipe(Y(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(Y(t=>t)),_control:{_stream:e._control._stream.pipe(Y(t=>t))}}}{const e=d._default(b,v);return c[t].data_out={_stream:e._stream.pipe(Y(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(Y(t=>t))},{_stream:c[t].data_out._stream.pipe(Y(t=>t)),_control:{_stream:c[t].ctrl_out._stream.pipe(Y(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(Y(t=>t)),_control:{_stream:e._control._stream.pipe(Y(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(Y(t=>t)),_control:{_stream:e._control._stream.pipe(Y(t=>t))}}}{const e=b.map(t=>({_stream:t._stream.pipe(Y(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(Y(t=>t)),_control:{_stream:n._control._stream.pipe(Y(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 Ct;return{ctrl:ye(...t.map(t=>{let e;return t._control._stream.pipe(Y(t=>(e=globalThis.TRACEON?{...t,traces:ks(t?.traces,{...n,desc:"doChronosAsynchronize(), a ctrl signal came through out of inputcount of "+r},!0)}:t,e)),oe(t._stream),Y(t=>(i.next(2===t.length?t[1]:t.slice(1)),t[0])),se())})).pipe(Y(t=>t)),data:i.pipe(Q(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(j_)))}})(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]},L_=I_(async({refnode:t,component_members:e,contextuallambda:n,etaTree:r}={})=>{const i=[],o=[],s={};["7b1f"].includes(t?.slice(0,4)),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t);const a=e.map(t=>{r.leafgraph.edges.lambda.sourcelut[t];const e=r.etaReduceLEAFNode({nodeuuid:t,contextuallambda:n});return e.then(e=>{s[t]=e;const n=r.leafgraph.edges.data.sources.has(t);r.leafgraph.edges.data.targets.has(t)||i.push(t),n||o.push(t)}),e});["7b1f","main"].includes(t?.slice(0,4)),await Promise.all(a),["7b1f","main"].includes(t?.slice(0,4)),["2ee89b44-16af-472f-97d4-47ae65f064c8"].includes(t);const u=((t,e,n,r,i,o={})=>{const s={main:"nav main dataflow",leafgraph:"leafgraph main dataflow",editor:"editor main dataflow"},a={codebase:"eta.js",refnode:t,leafnode:Object.keys(s).includes(t)?s[t]:i.leafgraph.graph.dataflow.getNodeAttributes(t)?.leafnode.data,metadata:o,domain:i.domain,appid:i.appid};return(u=[],c)=>{const l={data_in:new Ct,ctrl_in:new Ct,data_out:new Ct,ctrl_out:new Ct},h={_stream:l.data_in},d={_stream:l.ctrl_in,_config:{}};["3980759d-7c59-4b9e-b799-87b5fd4cbcec","62890d97-837a-463e-aac9-d7fca2293427"].includes(t),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t);const[p,f]=D_(t,e,n,r,i,d,h);return Ss(c,u,void 0,{...a,metastep:"invoking parseDataflowFunc()"},{leaflogic:(e,n)=>{const r=new Ct;let a;const u=n._stream.pipe(Y(t=>(a=t,t)),oe(...e.map(t=>t._stream)),ue(n=>{o.refnode,e.length;const r=1===e.length?n[1]:n.slice(1);return t in s||i.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data.leaf.logic,i.domain,i.appid,a.traces,setTimeout(()=>{l.data_in.next(r),l.ctrl_in.next(a)},1),p._control._stream}),oe(p._stream),Y(t=>{if(Dt(t[1])&&"error"===t[1]._bname);else{const e=t[1];void 0!==e&&r.next(e)}return t[0]}),se());return{_stream:r.pipe(Q(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(j_))),_control:{...n,_stream:u}}},datalogic:{}})}})(t,i,o,s,r);return u},({refnode:t,component_members:e,contextuallambda:n,etaTree:r}={})=>JSON.stringify([...e,...n,r.sessionid])),F_=async({refnode:t,nodelambda:e,contextuallambda:n,etaTree:r,addnodelut:i=!1,metadata:o={}}={})=>{["7b1f"].includes(t?.slice(0,4)),["530acdcf-067d-4868-ba0c-b7a83e6edfdf"].includes(t),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t);const s=i?{_nodelut:{}}:{},a=e.map(e=>{r.graphcomponents.components.lut;const{idx:o,scope:a}=r.graphcomponents.components.lut[e],u=r.graphcomponents.components.nodegroups.lambda[o];if("dataflow"===a){const o=L_({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,e,n,r,i,o,s,a,u,c,l=void 0)=>{const d={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 ls(d).getEtaTree(t,e);return o?await d.etaReduceLEAFNode({nodeuuid:n,contextuallambda:i}):await F_({refnode:n,nodelambda:r,contextuallambda:i,etaTree:s})},lookupLEAFNodeMethods:async(t,e=void 0)=>{if(t in d.leafnodemethods)return d.leafnodemethods[t];if(d.leafgraph.graph.dataflow.nodes().includes(t)){const e=d.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data,n=e.leaf.logic,r={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:d.leafio,etaTree:d},user:{spellbook:d.graphcomponents.spelldefs,lambdalut:d.leafgraph.edges.lambda.sourcelut}},i=M_(n.type,"methods",r);if(i&&!(t in d.leafnodemethods)){const n=d.leafgraph.edges.lambda.sourcelut[t]?d.leafgraph.edges.lambda.sourcelut[t]:[];return d.leafnodemethods[t]=await i({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:[]}),d.leafnodemethods[t]}return}if(d.hostEtaTree)return d.hostEtaTree.lookupLEAFNodeMethods(t,e);if(void 0!==e){const n=e,r=n.leaf.logic,i={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:d.leafio,etaTree:d},user:{spellbook:d.graphcomponents.spelldefs,lambdalut:d.leafgraph.edges.lambda.sourcelut}},o=M_(r.type,"methods",i);if(o&&!(t in d.leafnodemethods)){d.leafgraph.edges.lambda.sourcelut[t]&&d.leafgraph.edges.lambda.sourcelut[t];return d.leafnodemethods[t]=await o({refnode:t,refnodedata:n,nodelambda:[],contextuallambda:[]}),d.leafnodemethods[t]}}return},etaReduceLEAFNode:async({nodeuuid:t,contextuallambda:e}={})=>({_default:t=>{}}),loadElementJsEsmModule:async t=>{if(!(t in d.esmcache)){const e=await d_.get(t);d.esmcache[t]=e.data}return d.esmcache[t]},initTree:(t,e,n,r,i)=>{d.config=N_,d.leafgraph=t,d.graphcomponents=e,d.rootgraphstate="initialized",d.leafio=n,d.leaflakeio=r,d.mnemosyne=i,d.esmcache={},void 0===d.hostEtaTree&&ls(d).initEtaTreeForest();return d.etaReduceLEAFNode=I_(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?d.leafgraph.graph.dataflow.getNodeAttributes(n).leafnode.data.leaf.logic:void 0,i=t in d.leafgraph.edges.lambda.sourcelut?d.leafgraph.edges.lambda.sourcelut[t]:[];let o;if(t in d.graphcomponents.components.lut){const{scope:e}=d.graphcomponents.components.lut[t];o=e}const s={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:d.leafio,etaTree:d},user:{spellbook:d.graphcomponents.spelldefs,lambdalut:d.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=M_(r.type,o,s),u=d.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])),d.etaReduceLEAFNode}};return d.initTree(o,s,a,u,c),d.sessionid=h(),d},B_="https://gdb.leafgon.com/qmgraphql",q_=dt({endpoint:B_,headers:{Accept:"application/json"}}),U_=async({variables:t})=>{const e={endpoint:B_,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 n;try{n=await q_.query(e),n.data}catch(t){}},V_=async({node_uuid:t})=>{const e={endpoint:B_,query:JSON.stringify({query:"mutation DeleteNode($uuid: String!) {\n deleteNode(nfilter: {uuid: {eq: $uuid}}) {node {uuid}}\n}",variables:{uuid:t}||{}}).replace(/\\n/g,"")};let n;try{n=await q_.query(e),n.data}catch(t){}},G_=async({variables:t})=>{const e={endpoint:B_,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 n;try{n=await q_.query(e),n.data}catch(t){}},z_=async({variables:t})=>{const e={endpoint:B_,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 n;try{n=await q_.query(e),n.data}catch(t){}},W_=async({edge_uuid:t})=>{const e={endpoint:B_,query:JSON.stringify({query:"mutation DeleteEdge($uuid: String!) {\n deleteEdge(efilter: {uuid: {eq: $uuid}}) {edge {uuid}}\n}",variables:{uuid:t}||{}}).replace(/\\n/g,"")};let n;try{n=await q_.query(e),n.data}catch(t){}};export{rt as LEAFIOmetamodel,Ns as SHA1,st as _breezyforeststdlib_hierarchy,ot as _breezyforeststdlib_name,at as _edge_handle_dict,ut as _edge_style_dict,C_ as _leafelement,ps as _leafgraph,it as _leafstdlib_dataflow_api,gs as analyzeLEAFGraph,dt as createGQLClient,Ds as decodeUnicode,If as destroySoundStageNode,Bt as doBottle,qt as doUnbottle,Ss as driveDataflowByCtrlflow,Ps as encodeUnicode,L_ as etaReduceDataflowComponent,ls as etaTreeForest,vs as executeLEAFLogic,xs as executeLEAFLogicInSync,Yo as fetchMultiKeyedData,jt as initLEAFIOapi,Us as init_gRuntimeLEAFlisp,vt as initializeLEAFlakeGQLClient,Pt as initializeMasterSubsDirectory,Mf as initializeSoundStage,z_ as mutateAddEdge,U_ as mutateAddNode,W_ as mutateDelEdge,V_ as mutateDelNode,G_ as mutateUpdateNode,As as parseAddressableGraph,$s as parseJsonToLEAFlisp,ms as reconstructLEAFGraph,Ws as runLEAFlispcode,$_ as runtimeEtaTree,ts as setMultiKeyedData,ws as subscribeToLEAFLogic,bt as useGosPersistentStateIO,ct as useGosVolatileStateIO,Nt as useLEAFIOapi,xt as useMVIframework};
|
|
2
|
+
import"react";var t={1795(t,e,n){!function(t,e,n,r){var i=function(t,e,n){return{endTime:e,insertTime:n,type:"exponentialRampToValue",value:t}},o=function(t,e,n){return{endTime:e,insertTime:n,type:"linearRampToValue",value:t}},s=function(t,e){return{startTime:e,type:"setValue",value:t}},a=function(t,e,n){return{duration:n,startTime:e,type:"setValueCurve",values:t}},u=function(t,e,n){var r=n.startTime,i=n.target,o=n.timeConstant;return i+(e-i)*Math.exp((r-t)/o)},c=function(t){return"exponentialRampToValue"===t.type},l=function(t){return"linearRampToValue"===t.type},h=function(t){return c(t)||l(t)},d=function(t){return"setValue"===t.type},p=function(t){return"setValueCurve"===t.type},f=function(t,e,n,r){var i=t[e];return void 0===i?r:h(i)||d(i)?i.value:p(i)?i.values[i.values.length-1]:u(n,f(t,e-1,i.startTime,r),i)},m=function(t,e,n,r,i){return void 0===n?[r.insertTime,i]:h(n)?[n.endTime,n.value]:d(n)?[n.startTime,n.value]:p(n)?[n.startTime+n.duration,n.values[n.values.length-1]]:[n.startTime,f(t,e-1,n.startTime,i)]},g=function(t){return"cancelAndHold"===t.type},_=function(t){return"cancelScheduledValues"===t.type},y=function(t){return g(t)||_(t)?t.cancelTime:c(t)||l(t)?t.endTime:t.startTime},v=function(t,e,n,r){var i=r.endTime,o=r.value;return n===o?o:0<n&&0<o||n<0&&o<0?n*Math.pow(o/n,(t-e)/(i-e)):0},b=function(t,e,n,r){return n+(t-e)/(r.endTime-e)*(r.value-n)},w=function(t,e){var n=Math.floor(e),r=Math.ceil(e);return n===r?t[n]:(1-(e-n))*t[n]+(1-(r-e))*t[r]},x=function(t,e){var n=e.duration,r=e.startTime,i=e.values,o=(t-r)/n*(i.length-1);return w(i,o)},T=function(t){return"setTarget"===t.type},k=function(){function t(e){n(this,t),this._automationEvents=[],this._currenTime=0,this._defaultValue=e}return r(t,[{key:Symbol.iterator,value:function(){return this._automationEvents[Symbol.iterator]()}},{key:"add",value:function(t){var e=y(t);if(g(t)||_(t)){var n=this._automationEvents.findIndex(function(n){return _(t)&&p(n)?n.startTime+n.duration>=e:y(n)>=e}),r=this._automationEvents[n];if(-1!==n&&(this._automationEvents=this._automationEvents.slice(0,n)),g(t)){var u=this._automationEvents[this._automationEvents.length-1];if(void 0!==r&&h(r)){if(void 0!==u&&T(u))throw new Error("The internal list is malformed.");var d=void 0===u?r.insertTime:p(u)?u.startTime+u.duration:y(u),f=void 0===u?this._defaultValue:p(u)?u.values[u.values.length-1]:u.value,m=c(r)?v(e,d,f,r):b(e,d,f,r),w=c(r)?i(m,e,this._currenTime):o(m,e,this._currenTime);this._automationEvents.push(w)}if(void 0!==u&&T(u)&&this._automationEvents.push(s(this.getValue(e),e)),void 0!==u&&p(u)&&u.startTime+u.duration>e){var x=e-u.startTime,k=(u.values.length-1)/u.duration,S=Math.max(2,1+Math.ceil(x*k)),A=x/(S-1)*k,E=u.values.slice(0,S);if(A<1)for(var O=1;O<S;O+=1){var C=A*O%1;E[O]=u.values[O-1]*(1-C)+u.values[O]*C}this._automationEvents[this._automationEvents.length-1]=a(E,u.startTime,x)}}}else{var M=this._automationEvents.findIndex(function(t){return y(t)>e}),N=-1===M?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[M-1];if(void 0!==N&&p(N)&&y(N)+N.duration>e)return!1;var I=c(t)?i(t.value,t.endTime,this._currenTime):l(t)?o(t.value,e,this._currenTime):t;if(-1===M)this._automationEvents.push(I);else{if(p(t)&&e+t.duration>y(this._automationEvents[M]))return!1;this._automationEvents.splice(M,0,I)}}return!0}},{key:"flush",value:function(t){var e=this._automationEvents.findIndex(function(e){return y(e)>t});if(e>1){var n=this._automationEvents.slice(e-1),r=n[0];T(r)&&n.unshift(s(f(this._automationEvents,e-2,r.startTime,this._defaultValue),r.startTime)),this._automationEvents=n}}},{key:"getValue",value:function(t){if(0===this._automationEvents.length)return this._defaultValue;var n=this._automationEvents.findIndex(function(e){return y(e)>t}),r=this._automationEvents[n],i=(-1===n?this._automationEvents.length:n)-1,o=this._automationEvents[i];if(void 0!==o&&T(o)&&(void 0===r||!h(r)||r.insertTime>t))return u(t,f(this._automationEvents,i-1,o.startTime,this._defaultValue),o);if(void 0!==o&&d(o)&&(void 0===r||!h(r)))return o.value;if(void 0!==o&&p(o)&&(void 0===r||!h(r)||o.startTime+o.duration>t))return t<o.startTime+o.duration?x(t,o):o.values[o.values.length-1];if(void 0!==o&&h(o)&&(void 0===r||!h(r)))return o.value;if(void 0!==r&&c(r)){var s=m(this._automationEvents,i,o,r,this._defaultValue),a=e(s,2),g=a[0],_=a[1];return v(t,g,_,r)}if(void 0!==r&&l(r)){var w=m(this._automationEvents,i,o,r,this._defaultValue),k=e(w,2),S=k[0],A=k[1];return b(t,S,A,r)}return this._defaultValue}}])}(),S=function(t){return{cancelTime:t,type:"cancelAndHold"}},A=function(t){return{cancelTime:t,type:"cancelScheduledValues"}},E=function(t,e){return{endTime:e,type:"exponentialRampToValue",value:t}},O=function(t,e){return{endTime:e,type:"linearRampToValue",value:t}},C=function(t,e,n){return{startTime:e,target:t,timeConstant:n,type:"setTarget"}};t.AutomationEventList=k,t.createCancelAndHoldAutomationEvent=S,t.createCancelScheduledValuesAutomationEvent=A,t.createExponentialRampToValueAutomationEvent=E,t.createLinearRampToValueAutomationEvent=O,t.createSetTargetAutomationEvent=C,t.createSetValueAutomationEvent=s,t.createSetValueCurveAutomationEvent=a}(e,n(5715),n(7383),n(4579))},7526(t,e){e.byteLength=function(t){var e=a(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,o=a(t),s=o[0],u=o[1],c=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,u)),l=0,h=u>0?s-4:s;for(n=0;n<h;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],c[l++]=e>>16&255,c[l++]=e>>8&255,c[l++]=255&e;2===u&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,c[l++]=255&e);1===u&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,c[l++]=e>>8&255,c[l++]=255&e);return c},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,u=r-i;a<u;a+=s)o.push(c(t,a,a+s>u?u:a+s));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=o[s],r[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function u(t){return n[t>>18&63]+n[t>>12&63]+n[t>>6&63]+n[63&t]}function c(t,e,n){for(var r,i=[],o=e;o<n;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(u(r));return i.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},8287(t,e,n){const r=n(7526),i=n(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=u,e.IS=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return c(t,e,n)}function c(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|m(t,e);let r=a(n);const i=r.write(t,e);i!==n&&(r=r.slice(0,i));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(X(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(X(t,ArrayBuffer)||t&&X(t.buffer,ArrayBuffer))return p(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(X(t,SharedArrayBuffer)||t&&X(t.buffer,SharedArrayBuffer)))return p(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return u.from(r,e,n);const i=function(t){if(u.isBuffer(t)){const e=0|f(t.length),n=a(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||K(t.length)?a(0):d(t);if("Buffer"===t.type&&Array.isArray(t.data))return d(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return l(t),a(t<0?0:0|f(t))}function d(t){const e=t.length<0?0:0|f(t.length),n=a(e);for(let r=0;r<e;r+=1)n[r]=255&t[r];return n}function p(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,u.prototype),r}function f(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function m(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||X(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return J(t).length;default:if(i)return r?-1:W(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return M(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return O(this,e,n);case"latin1":case"binary":return C(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function _(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),K(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:v(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,r,i){let o,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;o<a;o++)if(c(t,o)===c(e,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===u)return r*s}else-1!==r&&(o-=o-r),r=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){let n=!0;for(let r=0;r<u;r++)if(c(t,o+r)!==c(e,r)){n=!1;break}if(n)return o}return-1}function b(t,e,n,r){n=Number(n)||0;const i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s<r;++s){const r=parseInt(e.substr(2*s,2),16);if(K(r))return s;t[n+s]=r}return s}function w(t,e,n,r){return H(W(e,t.length-n),t,n,r)}function x(t,e,n,r){return H(function(t){const e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function T(t,e,n,r){return H(J(e),t,n,r)}function k(t,e,n,r){return H(function(t,e){let n,r,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function S(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function A(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i<n;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=E)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=E));return n}(r)}u.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),!u.TYPED_ARRAY_SUPPORT&&"undefined"!=typeof console&&console.error,Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,n){return c(t,e,n)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,n){return function(t,e,n){return l(t),t<=0?a(t):void 0!==e?"string"==typeof n?a(t).fill(e,n):a(t).fill(e):a(t)}(t,e,n)},u.allocUnsafe=function(t){return h(t)},u.allocUnsafeSlow=function(t){return h(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(X(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),X(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;const r=u.allocUnsafe(e);let i=0;for(n=0;n<t.length;++n){let e=t[n];if(X(e,Uint8Array))i+e.length>r.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},u.byteLength=m,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)_(this,e,e+1);return this},u.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)_(this,e,e+3),_(this,e+1,e+2);return this},u.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)_(this,e,e+7),_(this,e+1,e+6),_(this,e+2,e+5),_(this,e+3,e+4);return this},u.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):g.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){let t="";const n=e.IS;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,n,r,i){if(X(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const a=Math.min(o,s),c=this.slice(r,i),l=t.slice(e,n);for(let t=0;t<a;++t)if(c[t]!==l[t]){o=c[t],s=l[t];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},u.prototype.indexOf=function(t,e,n){return y(this,t,e,n,!0)},u.prototype.lastIndexOf=function(t,e,n){return y(this,t,e,n,!1)},u.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return w(this,t,e,n);case"ascii":case"latin1":case"binary":return x(this,t,e,n);case"base64":return T(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const E=4096;function O(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function C(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function M(t,e,n){const r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=e;r<n;++r)i+=Q[t[r]];return i}function N(t,e,n){const r=t.slice(e,n);let i="";for(let t=0;t<r.length-1;t+=2)i+=String.fromCharCode(r[t]+256*r[t+1]);return i}function I(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function j(t,e,n,r,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function R(t,e,n,r,i){U(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function P(t,e,n,r,i){U(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function D(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(t,e,n,r,o){return e=+e,n>>>=0,o||D(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function F(t,e,n,r,o){return e=+e,n>>>=0,o||D(t,0,n,8),i.write(t,e,n,r,52,8),n+8}u.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);const r=this.subarray(t,e);return Object.setPrototypeOf(r,u.prototype),r},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return r},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=Z(function(t){V(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||G(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),u.prototype.readBigUInt64BE=Z(function(t){V(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||G(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),u.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},u.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||I(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(t,e){t>>>=0,e||I(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=Z(function(t){V(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||G(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)}),u.prototype.readBigInt64BE=Z(function(t){V(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||G(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)}),u.prototype.readFloatLE=function(t,e){return t>>>=0,e||I(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||I(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||I(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||I(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){j(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){j(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=Z(function(t,e=0){return R(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Z(function(t,e=0){return P(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);j(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i<n&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o|0)-s&255;return e+n},u.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);j(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o|0)-s&255;return e+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=Z(function(t,e=0){return R(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Z(function(t,e=0){return P(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeFloatLE=function(t,e,n){return L(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return L(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return F(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return F(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,r){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);const i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},u.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){const e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{const o=u.isBuffer(t)?t:u.from(t,r),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=o[i%s]}return this};const $={};function B(t,e,n){$[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function q(t){let e="",n=t.length;const r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function U(t,e,n,r,i,o){if(t>n||t<e){const r="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new $.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){V(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||G(e,t.length-(n+1))}(r,i,o)}function V(t,e){if("number"!=typeof t)throw new $.ERR_INVALID_ARG_TYPE(e,"number",t)}function G(t,e,n){if(Math.floor(t)!==t)throw V(t,n),new $.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new $.ERR_BUFFER_OUT_OF_BOUNDS;throw new $.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}B("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),B("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),B("ERR_OUT_OF_RANGE",function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=q(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=q(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r},RangeError);const z=/[^+/0-9A-Za-z-_]/g;function W(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s<r;++s){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function J(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,n,r){let i;for(i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function X(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function K(t){return t!=t}const Q=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Z(t){return"undefined"==typeof BigInt?Y:t}function Y(){throw new Error("BigInt not supported")}},7007(t){var e,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};e=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise(function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}m(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&m(t,"error",e,n)}(t,i,{once:!0})})},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function c(t,e,n,r){var i,o,s;if(a(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]),void 0===s)s=o[e]=n,++t._eventsCount;else if("function"==typeof s?s=o[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=u(t))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=s.length,console&&console.warn}return t}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=l.bind(r);return i.listener=n,r.wrapFn=i,i}function d(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(i):f(i,i.length)}function p(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function f(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function m(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,function i(o){r.once&&t.removeEventListener(e,i),n(o)})}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");s=t}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var i="error"===t,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)r(u,this,e);else{var c=u.length,l=f(u,c);for(n=0;n<c;++n)r(l[n],this,e)}return!0},o.prototype.addListener=function(t,e){return c(this,t,e,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(t,e){return c(this,t,e,!0)},o.prototype.once=function(t,e){return a(e),this.on(t,h(this,t,e)),this},o.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,h(this,t,e)),this},o.prototype.removeListener=function(t,e){var n,r,i,o,s;if(a(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0===--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,i),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,s||e)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},o.prototype.listeners=function(t){return d(this,t,!0)},o.prototype.rawListeners=function(t){return d(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},8463(t){t.exports=s,s.default=s,s.stable=l,s.stableStringify=l;var e="[...]",n="[Circular]",r=[],i=[];function o(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function s(t,e,n,s){var a;void 0===s&&(s=o()),u(t,"",0,[],void 0,0,s);try{a=0===i.length?JSON.stringify(t,e,n):JSON.stringify(t,d(e),n)}catch(t){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var c=r.pop();4===c.length?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return a}function a(t,e,n,o){var s=Object.getOwnPropertyDescriptor(o,n);void 0!==s.get?s.configurable?(Object.defineProperty(o,n,{value:t}),r.push([o,n,e,s])):i.push([e,n,t]):(o[n]=t,r.push([o,n,e]))}function u(t,r,i,o,s,c,l){var h;if(c+=1,"object"==typeof t&&null!==t){for(h=0;h<o.length;h++)if(o[h]===t)return void a(n,t,r,s);if(void 0!==l.depthLimit&&c>l.depthLimit)return void a(e,t,r,s);if(void 0!==l.edgesLimit&&i+1>l.edgesLimit)return void a(e,t,r,s);if(o.push(t),Array.isArray(t))for(h=0;h<t.length;h++)u(t[h],h,h,o,t,c,l);else{var d=Object.keys(t);for(h=0;h<d.length;h++){var p=d[h];u(t[p],p,h,o,t,c,l)}}o.pop()}}function c(t,e){return t<e?-1:t>e?1:0}function l(t,e,n,s){void 0===s&&(s=o());var a,u=h(t,"",0,[],void 0,0,s)||t;try{a=0===i.length?JSON.stringify(u,e,n):JSON.stringify(u,d(e),n)}catch(t){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var c=r.pop();4===c.length?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return a}function h(t,i,o,s,u,l,d){var p;if(l+=1,"object"==typeof t&&null!==t){for(p=0;p<s.length;p++)if(s[p]===t)return void a(n,t,i,u);try{if("function"==typeof t.toJSON)return}catch(t){return}if(void 0!==d.depthLimit&&l>d.depthLimit)return void a(e,t,i,u);if(void 0!==d.edgesLimit&&o+1>d.edgesLimit)return void a(e,t,i,u);if(s.push(t),Array.isArray(t))for(p=0;p<t.length;p++)h(t[p],p,p,s,t,l,d);else{var f={},m=Object.keys(t).sort(c);for(p=0;p<m.length;p++){var g=m[p];h(t[g],g,p,s,t,l,d),f[g]=t[g]}if(void 0===u)return f;r.push([u,i,t]),u[i]=f}s.pop()}}function d(t){return t=void 0!==t?t:function(t,e){return e},function(e,n){if(i.length>0)for(var r=0;r<i.length;r++){var o=i[r];if(o[1]===e&&o[0]===n){n=o[2],i.splice(r,1);break}}return t.call(this,e,n)}}},639(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var i=r(n(261)),o=r(n(2300)),s=n(9027),a=n(1127),u=r(n(6727)),c=r(n(1350)),l=r(n(1148)),h=i.default.create;function d(){var t=h();return t.compile=function(e,n){return a.compile(e,n,t)},t.precompile=function(e,n){return a.precompile(e,n,t)},t.AST=o.default,t.Compiler=a.Compiler,t.JavaScriptCompiler=u.default,t.Parser=s.parser,t.parse=s.parse,t.parseWithoutProcessing=s.parseWithoutProcessing,t}var p=d();p.create=d,l.default(p),p.Visitor=c.default,p.default=p,e.default=p,t.exports=e.default},261(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}function i(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}e.__esModule=!0;var o=i(n(2871)),s=r(n(9613)),a=r(n(3769)),u=i(n(2849)),c=i(n(7624)),l=r(n(1148));function h(){var t=new o.HandlebarsEnvironment;return u.extend(t,o),t.SafeString=s.default,t.Exception=a.default,t.Utils=u,t.escapeExpression=u.escapeExpression,t.VM=c,t.template=function(e){return c.template(e,t)},t}var d=h();d.create=h,l.default(d),d.default=d,e.default=d,t.exports=e.default},2871(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.HandlebarsEnvironment=h;var i=n(2849),o=r(n(3769)),s=n(2277),a=n(5940),u=r(n(566)),c=n(3865);e.VERSION="4.7.8";e.COMPILER_REVISION=8;e.LAST_COMPATIBLE_COMPILER_REVISION=7;e.REVISION_CHANGES={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};var l="[object Object]";function h(t,e,n){this.helpers=t||{},this.partials=e||{},this.decorators=n||{},s.registerDefaultHelpers(this),a.registerDefaultDecorators(this)}h.prototype={constructor:h,logger:u.default,log:u.default.log,registerHelper:function(t,e){if(i.toString.call(t)===l){if(e)throw new o.default("Arg not supported with multiple helpers");i.extend(this.helpers,t)}else this.helpers[t]=e},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,e){if(i.toString.call(t)===l)i.extend(this.partials,t);else{if(void 0===e)throw new o.default('Attempting to register a partial called "'+t+'" as undefined');this.partials[t]=e}},unregisterPartial:function(t){delete this.partials[t]},registerDecorator:function(t,e){if(i.toString.call(t)===l){if(e)throw new o.default("Arg not supported with multiple decorators");i.extend(this.decorators,t)}else this.decorators[t]=e},unregisterDecorator:function(t){delete this.decorators[t]},resetLoggedPropertyAccesses:function(){c.resetLoggedProperties()}};var d=u.default.log;e.log=d,e.createFrame=i.createFrame,e.logger=u.default},2300(t,e){e.__esModule=!0;var n={helpers:{helperExpression:function(t){return"SubExpression"===t.type||("MustacheStatement"===t.type||"BlockStatement"===t.type)&&!!(t.params&&t.params.length||t.hash)},scopedId:function(t){return/^\.|this\b/.test(t.original)},simpleId:function(t){return 1===t.parts.length&&!n.helpers.scopedId(t)&&!t.depth}}};e.default=n,t.exports=e.default},9027(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.parseWithoutProcessing=c,e.parse=function(t,e){var n=c(t,e);return new o.default(e).accept(n)};var i=r(n(6201)),o=r(n(915)),s=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(8425)),a=n(2849);e.parser=i.default;var u={};function c(t,e){return"Program"===t.type?t:(i.default.yy=u,u.locInfo=function(t){return new u.SourceLocation(e&&e.srcName,t)},i.default.parse(t))}a.extend(u,s)},9632(t,e,n){e.__esModule=!0;var r=n(2849),i=void 0;try{}catch(t){}function o(t,e,n){if(r.isArray(t)){for(var i=[],o=0,s=t.length;o<s;o++)i.push(e.wrap(t[o],n));return i}return"boolean"==typeof t||"number"==typeof t?t+"":t}function s(t){this.srcFile=t,this.source=[]}i||((i=function(t,e,n,r){this.src="",r&&this.add(r)}).prototype={add:function(t){r.isArray(t)&&(t=t.join("")),this.src+=t},prepend:function(t){r.isArray(t)&&(t=t.join("")),this.src=t+this.src},toStringWithSourceMap:function(){return{code:this.toString()}},toString:function(){return this.src}}),s.prototype={isEmpty:function(){return!this.source.length},prepend:function(t,e){this.source.unshift(this.wrap(t,e))},push:function(t,e){this.source.push(this.wrap(t,e))},merge:function(){var t=this.empty();return this.each(function(e){t.add([" ",e,"\n"])}),t},each:function(t){for(var e=0,n=this.source.length;e<n;e++)t(this.source[e])},empty:function(){var t=this.currentLocation||{start:{}};return new i(t.start.line,t.start.column,this.srcFile)},wrap:function(t){var e=arguments.length<=1||void 0===arguments[1]?this.currentLocation||{start:{}}:arguments[1];return t instanceof i?t:(t=o(t,this,e),new i(e.start.line,e.start.column,this.srcFile,t))},functionCall:function(t,e,n){return n=this.generateList(n),this.wrap([t,e?"."+e+"(":"(",n,")"])},quotedString:function(t){return'"'+(t+"").replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(t){var e=this,n=[];Object.keys(t).forEach(function(r){var i=o(t[r],e);"undefined"!==i&&n.push([e.quotedString(r),":",i])});var r=this.generateList(n);return r.prepend("{"),r.add("}"),r},generateList:function(t){for(var e=this.empty(),n=0,r=t.length;n<r;n++)n&&e.add(","),e.add(o(t[n],this));return e},generateArray:function(t){var e=this.generateList(t);return e.prepend("["),e.add("]"),e}},e.default=s,t.exports=e.default},1127(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.Compiler=u,e.precompile=function(t,e,n){if(null==t||"string"!=typeof t&&"Program"!==t.type)throw new i.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+t);"data"in(e=e||{})||(e.data=!0);e.compat&&(e.useDepths=!0);var r=n.parse(t,e),o=(new n.Compiler).compile(r,e);return(new n.JavaScriptCompiler).compile(o,e)},e.compile=function(t,e,n){void 0===e&&(e={});if(null==t||"string"!=typeof t&&"Program"!==t.type)throw new i.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+t);"data"in(e=o.extend({},e))||(e.data=!0);e.compat&&(e.useDepths=!0);var r=void 0;function s(){var r=n.parse(t,e),i=(new n.Compiler).compile(r,e),o=(new n.JavaScriptCompiler).compile(i,e,void 0,!0);return n.template(o)}function a(t,e){return r||(r=s()),r.call(this,t,e)}return a._setup=function(t){return r||(r=s()),r._setup(t)},a._child=function(t,e,n,i){return r||(r=s()),r._child(t,e,n,i)},a};var i=r(n(3769)),o=n(2849),s=r(n(2300)),a=[].slice;function u(){}function c(t,e){if(t===e)return!0;if(o.isArray(t)&&o.isArray(e)&&t.length===e.length){for(var n=0;n<t.length;n++)if(!c(t[n],e[n]))return!1;return!0}}function l(t){if(!t.path.parts){var e=t.path;t.path={type:"PathExpression",data:!1,depth:0,parts:[e.original+""],original:e.original+"",loc:e.loc}}}u.prototype={compiler:u,equals:function(t){var e=this.opcodes.length;if(t.opcodes.length!==e)return!1;for(var n=0;n<e;n++){var r=this.opcodes[n],i=t.opcodes[n];if(r.opcode!==i.opcode||!c(r.args,i.args))return!1}e=this.children.length;for(n=0;n<e;n++)if(!this.children[n].equals(t.children[n]))return!1;return!0},guid:0,compile:function(t,e){return this.sourceNode=[],this.opcodes=[],this.children=[],this.options=e,this.stringParams=e.stringParams,this.trackIds=e.trackIds,e.blockParams=e.blockParams||[],e.knownHelpers=o.extend(Object.create(null),{helperMissing:!0,blockHelperMissing:!0,each:!0,if:!0,unless:!0,with:!0,log:!0,lookup:!0},e.knownHelpers),this.accept(t)},compileProgram:function(t){var e=(new this.compiler).compile(t,this.options),n=this.guid++;return this.usePartial=this.usePartial||e.usePartial,this.children[n]=e,this.useDepths=this.useDepths||e.useDepths,n},accept:function(t){if(!this[t.type])throw new i.default("Unknown type: "+t.type,t);this.sourceNode.unshift(t);var e=this[t.type](t);return this.sourceNode.shift(),e},Program:function(t){this.options.blockParams.unshift(t.blockParams);for(var e=t.body,n=e.length,r=0;r<n;r++)this.accept(e[r]);return this.options.blockParams.shift(),this.isSimple=1===n,this.blockParams=t.blockParams?t.blockParams.length:0,this},BlockStatement:function(t){l(t);var e=t.program,n=t.inverse;e=e&&this.compileProgram(e),n=n&&this.compileProgram(n);var r=this.classifySexpr(t);"helper"===r?this.helperSexpr(t,e,n):"simple"===r?(this.simpleSexpr(t),this.opcode("pushProgram",e),this.opcode("pushProgram",n),this.opcode("emptyHash"),this.opcode("blockValue",t.path.original)):(this.ambiguousSexpr(t,e,n),this.opcode("pushProgram",e),this.opcode("pushProgram",n),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},DecoratorBlock:function(t){var e=t.program&&this.compileProgram(t.program),n=this.setupFullMustacheParams(t,e,void 0),r=t.path;this.useDecorators=!0,this.opcode("registerDecorator",n.length,r.original)},PartialStatement:function(t){this.usePartial=!0;var e=t.program;e&&(e=this.compileProgram(t.program));var n=t.params;if(n.length>1)throw new i.default("Unsupported number of partial arguments: "+n.length,t);n.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):n.push({type:"PathExpression",parts:[],depth:0}));var r=t.name.original,o="SubExpression"===t.name.type;o&&this.accept(t.name),this.setupFullMustacheParams(t,e,void 0,!0);var s=t.indent||"";this.options.preventIndent&&s&&(this.opcode("appendContent",s),s=""),this.opcode("invokePartial",o,r,s),this.opcode("append")},PartialBlockStatement:function(t){this.PartialStatement(t)},MustacheStatement:function(t){this.SubExpression(t),t.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(t){this.DecoratorBlock(t)},ContentStatement:function(t){t.value&&this.opcode("appendContent",t.value)},CommentStatement:function(){},SubExpression:function(t){l(t);var e=this.classifySexpr(t);"simple"===e?this.simpleSexpr(t):"helper"===e?this.helperSexpr(t):this.ambiguousSexpr(t)},ambiguousSexpr:function(t,e,n){var r=t.path,i=r.parts[0],o=null!=e||null!=n;this.opcode("getContext",r.depth),this.opcode("pushProgram",e),this.opcode("pushProgram",n),r.strict=!0,this.accept(r),this.opcode("invokeAmbiguous",i,o)},simpleSexpr:function(t){var e=t.path;e.strict=!0,this.accept(e),this.opcode("resolvePossibleLambda")},helperSexpr:function(t,e,n){var r=this.setupFullMustacheParams(t,e,n),o=t.path,a=o.parts[0];if(this.options.knownHelpers[a])this.opcode("invokeKnownHelper",r.length,a);else{if(this.options.knownHelpersOnly)throw new i.default("You specified knownHelpersOnly, but used the unknown helper "+a,t);o.strict=!0,o.falsy=!0,this.accept(o),this.opcode("invokeHelper",r.length,o.original,s.default.helpers.simpleId(o))}},PathExpression:function(t){this.addDepth(t.depth),this.opcode("getContext",t.depth);var e=t.parts[0],n=s.default.helpers.scopedId(t),r=!t.depth&&!n&&this.blockParamIndex(e);r?this.opcode("lookupBlockParam",r,t.parts):e?t.data?(this.options.data=!0,this.opcode("lookupData",t.depth,t.parts,t.strict)):this.opcode("lookupOnContext",t.parts,t.falsy,t.strict,n):this.opcode("pushContext")},StringLiteral:function(t){this.opcode("pushString",t.value)},NumberLiteral:function(t){this.opcode("pushLiteral",t.value)},BooleanLiteral:function(t){this.opcode("pushLiteral",t.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(t){var e=t.pairs,n=0,r=e.length;for(this.opcode("pushHash");n<r;n++)this.pushParam(e[n].value);for(;n--;)this.opcode("assignToHash",e[n].key);this.opcode("popHash")},opcode:function(t){this.opcodes.push({opcode:t,args:a.call(arguments,1),loc:this.sourceNode[0].loc})},addDepth:function(t){t&&(this.useDepths=!0)},classifySexpr:function(t){var e=s.default.helpers.simpleId(t.path),n=e&&!!this.blockParamIndex(t.path.parts[0]),r=!n&&s.default.helpers.helperExpression(t),i=!n&&(r||e);if(i&&!r){var o=t.path.parts[0],a=this.options;a.knownHelpers[o]?r=!0:a.knownHelpersOnly&&(i=!1)}return r?"helper":i?"ambiguous":"simple"},pushParams:function(t){for(var e=0,n=t.length;e<n;e++)this.pushParam(t[e])},pushParam:function(t){var e=null!=t.value?t.value:t.original||"";if(this.stringParams)e.replace&&(e=e.replace(/^(\.?\.\/)*/g,"").replace(/\//g,".")),t.depth&&this.addDepth(t.depth),this.opcode("getContext",t.depth||0),this.opcode("pushStringParam",e,t.type),"SubExpression"===t.type&&this.accept(t);else{if(this.trackIds){var n=void 0;if(!t.parts||s.default.helpers.scopedId(t)||t.depth||(n=this.blockParamIndex(t.parts[0])),n){var r=t.parts.slice(1).join(".");this.opcode("pushId","BlockParam",n,r)}else(e=t.original||e).replace&&(e=e.replace(/^this(?:\.|$)/,"").replace(/^\.\//,"").replace(/^\.$/,"")),this.opcode("pushId",t.type,e)}this.accept(t)}},setupFullMustacheParams:function(t,e,n,r){var i=t.params;return this.pushParams(i),this.opcode("pushProgram",e),this.opcode("pushProgram",n),t.hash?this.accept(t.hash):this.opcode("emptyHash",r),i},blockParamIndex:function(t){for(var e=0,n=this.options.blockParams.length;e<n;e++){var r=this.options.blockParams[e],i=r&&o.indexOf(r,t);if(r&&i>=0)return[e,i]}}}},8425(t,e,n){e.__esModule=!0,e.SourceLocation=function(t,e){this.source=t,this.start={line:e.first_line,column:e.first_column},this.end={line:e.last_line,column:e.last_column}},e.id=function(t){return/^\[.*\]$/.test(t)?t.substring(1,t.length-1):t},e.stripFlags=function(t,e){return{open:"~"===t.charAt(2),close:"~"===e.charAt(e.length-3)}},e.stripComment=function(t){return t.replace(/^\{\{~?!-?-?/,"").replace(/-?-?~?\}\}$/,"")},e.preparePath=function(t,e,n){n=this.locInfo(n);for(var r=t?"@":"",i=[],s=0,a=0,u=e.length;a<u;a++){var c=e[a].part,l=e[a].original!==c;if(r+=(e[a].separator||"")+c,l||".."!==c&&"."!==c&&"this"!==c)i.push(c);else{if(i.length>0)throw new o.default("Invalid path: "+r,{loc:n});".."===c&&s++}}return{type:"PathExpression",data:t,depth:s,parts:i,original:r,loc:n}},e.prepareMustache=function(t,e,n,r,i,o){var s=r.charAt(3)||r.charAt(2),a="{"!==s&&"&"!==s;return{type:/\*/.test(r)?"Decorator":"MustacheStatement",path:t,params:e,hash:n,escaped:a,strip:i,loc:this.locInfo(o)}},e.prepareRawBlock=function(t,e,n,r){s(t,n),r=this.locInfo(r);var i={type:"Program",body:e,strip:{},loc:r};return{type:"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:i,openStrip:{},inverseStrip:{},closeStrip:{},loc:r}},e.prepareBlock=function(t,e,n,r,i,a){r&&r.path&&s(t,r);var u=/\*/.test(t.open);e.blockParams=t.blockParams;var c=void 0,l=void 0;if(n){if(u)throw new o.default("Unexpected inverse block on decorator",n);n.chain&&(n.program.body[0].closeStrip=r.strip),l=n.strip,c=n.program}i&&(i=c,c=e,e=i);return{type:u?"DecoratorBlock":"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:e,inverse:c,openStrip:t.strip,inverseStrip:l,closeStrip:r&&r.strip,loc:this.locInfo(a)}},e.prepareProgram=function(t,e){if(!e&&t.length){var n=t[0].loc,r=t[t.length-1].loc;n&&r&&(e={source:n.source,start:{line:n.start.line,column:n.start.column},end:{line:r.end.line,column:r.end.column}})}return{type:"Program",body:t,strip:{},loc:e}},e.preparePartialBlock=function(t,e,n,r){return s(t,n),{type:"PartialBlockStatement",name:t.path,params:t.params,hash:t.hash,program:e,openStrip:t.strip,closeStrip:n&&n.strip,loc:this.locInfo(r)}};var r,i=n(3769),o=(r=i)&&r.__esModule?r:{default:r};function s(t,e){if(e=e.path?e.path.original:e,t.path.original!==e){var n={loc:t.path.loc};throw new o.default(t.path.original+" doesn't match "+e,n)}}},6727(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var i=n(2871),o=r(n(3769)),s=n(2849),a=r(n(9632));function u(t){this.value=t}function c(){}c.prototype={nameLookup:function(t,e){return this.internalNameLookup(t,e)},depthedLookup:function(t){return[this.aliasable("container.lookup"),"(depths, ",JSON.stringify(t),")"]},compilerInfo:function(){var t=i.COMPILER_REVISION;return[t,i.REVISION_CHANGES[t]]},appendToBuffer:function(t,e,n){return s.isArray(t)||(t=[t]),t=this.source.wrap(t,e),this.environment.isSimple?["return ",t,";"]:n?["buffer += ",t,";"]:(t.appendToBuffer=!0,t)},initializeBuffer:function(){return this.quotedString("")},internalNameLookup:function(t,e){return this.lookupPropertyFunctionIsUsed=!0,["lookupProperty(",t,",",JSON.stringify(e),")"]},lookupPropertyFunctionIsUsed:!1,compile:function(t,e,n,r){this.environment=t,this.options=e,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!r,this.name=this.environment.name,this.isChild=!!n,this.context=n||{decorators:[],programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.blockParams=[],this.compileChildren(t,e),this.useDepths=this.useDepths||t.useDepths||t.useDecorators||this.options.compat,this.useBlockParams=this.useBlockParams||t.useBlockParams;var i=t.opcodes,s=void 0,a=void 0,u=void 0,c=void 0;for(u=0,c=i.length;u<c;u++)s=i[u],this.source.currentLocation=s.loc,a=a||s.loc,this[s.opcode].apply(this,s.args);if(this.source.currentLocation=a,this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new o.default("Compile completed with content left on stack");this.decorators.isEmpty()?this.decorators=void 0:(this.useDecorators=!0,this.decorators.prepend(["var decorators = container.decorators, ",this.lookupPropertyFunctionVarDeclaration(),";\n"]),this.decorators.push("return fn;"),r?this.decorators=Function.apply(this,["fn","props","container","depth0","data","blockParams","depths",this.decorators.merge()]):(this.decorators.prepend("function(fn, props, container, depth0, data, blockParams, depths) {\n"),this.decorators.push("}\n"),this.decorators=this.decorators.merge()));var l=this.createFunctionContext(r);if(this.isChild)return l;var h={compiler:this.compilerInfo(),main:l};this.decorators&&(h.main_d=this.decorators,h.useDecorators=!0);var d=this.context,p=d.programs,f=d.decorators;for(u=0,c=p.length;u<c;u++)p[u]&&(h[u]=p[u],f[u]&&(h[u+"_d"]=f[u],h.useDecorators=!0));return this.environment.usePartial&&(h.usePartial=!0),this.options.data&&(h.useData=!0),this.useDepths&&(h.useDepths=!0),this.useBlockParams&&(h.useBlockParams=!0),this.options.compat&&(h.compat=!0),r?h.compilerOptions=this.options:(h.compiler=JSON.stringify(h.compiler),this.source.currentLocation={start:{line:1,column:0}},h=this.objectLiteral(h),e.srcName?(h=h.toStringWithSourceMap({file:e.destName})).map=h.map&&h.map.toString():h=h.toString()),h},preamble:function(){this.lastContext=0,this.source=new a.default(this.options.srcName),this.decorators=new a.default(this.options.srcName)},createFunctionContext:function(t){var e=this,n="",r=this.stackVars.concat(this.registers.list);r.length>0&&(n+=", "+r.join(", "));var i=0;Object.keys(this.aliases).forEach(function(t){var r=e.aliases[t];r.children&&r.referenceCount>1&&(n+=", alias"+ ++i+"="+t,r.children[0]="alias"+i)}),this.lookupPropertyFunctionIsUsed&&(n+=", "+this.lookupPropertyFunctionVarDeclaration());var o=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&o.push("blockParams"),this.useDepths&&o.push("depths");var s=this.mergeSource(n);return t?(o.push(s),Function.apply(this,o)):this.source.wrap(["function(",o.join(","),") {\n ",s,"}"])},mergeSource:function(t){var e=this.environment.isSimple,n=!this.forceBuffer,r=void 0,i=void 0,o=void 0,s=void 0;return this.source.each(function(t){t.appendToBuffer?(o?t.prepend(" + "):o=t,s=t):(o&&(i?o.prepend("buffer += "):r=!0,s.add(";"),o=s=void 0),i=!0,e||(n=!1))}),n?o?(o.prepend("return "),s.add(";")):i||this.source.push('return "";'):(t+=", buffer = "+(r?"":this.initializeBuffer()),o?(o.prepend("return buffer + "),s.add(";")):this.source.push("return buffer;")),t&&this.source.prepend("var "+t.substring(2)+(r?"":";\n")),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return"\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n ".trim()},blockValue:function(t){var e=this.aliasable("container.hooks.blockHelperMissing"),n=[this.contextName(0)];this.setupHelperArgs(t,0,n);var r=this.popStack();n.splice(1,0,r),this.push(this.source.functionCall(e,"call",n))},ambiguousBlockValue:function(){var t=this.aliasable("container.hooks.blockHelperMissing"),e=[this.contextName(0)];this.setupHelperArgs("",0,e,!0),this.flushInline();var n=this.topStack();e.splice(1,0,n),this.pushSource(["if (!",this.lastHelper,") { ",n," = ",this.source.functionCall(t,"call",e),"}"])},appendContent:function(t){this.pendingContent?t=this.pendingContent+t:this.pendingLocation=this.source.currentLocation,this.pendingContent=t},append:function(){if(this.isInline())this.replaceStack(function(t){return[" != null ? ",t,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var t=this.popStack();this.pushSource(["if (",t," != null) { ",this.appendToBuffer(t,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(t){this.lastContext=t},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(t,e,n,r){var i=0;r||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(t[i++])),this.resolvePath("context",t,i,e,n)},lookupBlockParam:function(t,e){this.useBlockParams=!0,this.push(["blockParams[",t[0],"][",t[1],"]"]),this.resolvePath("context",e,1)},lookupData:function(t,e,n){t?this.pushStackLiteral("container.data(data, "+t+")"):this.pushStackLiteral("data"),this.resolvePath("data",e,0,!0,n)},resolvePath:function(t,e,n,r,i){var o=this;if(this.options.strict||this.options.assumeObjects)this.push(function(t,e,n,r,i){var o=e.popStack(),s=n.length;t&&s--;for(;r<s;r++)o=e.nameLookup(o,n[r],i);return t?[e.aliasable("container.strict"),"(",o,", ",e.quotedString(n[r]),", ",JSON.stringify(e.source.currentLocation)," )"]:o}(this.options.strict&&i,this,e,n,t));else for(var s=e.length;n<s;n++)this.replaceStack(function(i){var s=o.nameLookup(i,e[n],t);return r?[" && ",s]:[" != null ? ",s," : ",i]})},resolvePossibleLambda:function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},pushStringParam:function(t,e){this.pushContext(),this.pushString(e),"SubExpression"!==e&&("string"==typeof t?this.pushString(t):this.pushStackLiteral(t))},emptyHash:function(t){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(t?"undefined":"{}")},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:{},types:[],contexts:[],ids:[]}},popHash:function(){var t=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(t.ids)),this.stringParams&&(this.push(this.objectLiteral(t.contexts)),this.push(this.objectLiteral(t.types))),this.push(this.objectLiteral(t.values))},pushString:function(t){this.pushStackLiteral(this.quotedString(t))},pushLiteral:function(t){this.pushStackLiteral(t)},pushProgram:function(t){null!=t?this.pushStackLiteral(this.programExpression(t)):this.pushStackLiteral(null)},registerDecorator:function(t,e){var n=this.nameLookup("decorators",e,"decorator"),r=this.setupHelperArgs(e,t);this.decorators.push(["fn = ",this.decorators.functionCall(n,"",["fn","props","container",r])," || fn;"])},invokeHelper:function(t,e,n){var r=this.popStack(),i=this.setupHelper(t,e),o=[];n&&o.push(i.name),o.push(r),this.options.strict||o.push(this.aliasable("container.hooks.helperMissing"));var s=["(",this.itemsSeparatedBy(o,"||"),")"],a=this.source.functionCall(s,"call",i.callParams);this.push(a)},itemsSeparatedBy:function(t,e){var n=[];n.push(t[0]);for(var r=1;r<t.length;r++)n.push(e,t[r]);return n},invokeKnownHelper:function(t,e){var n=this.setupHelper(t,e);this.push(this.source.functionCall(n.name,"call",n.callParams))},invokeAmbiguous:function(t,e){this.useRegister("helper");var n=this.popStack();this.emptyHash();var r=this.setupHelper(0,t,e),i=["(","(helper = ",this.lastHelper=this.nameLookup("helpers",t,"helper")," || ",n,")"];this.options.strict||(i[0]="(helper = ",i.push(" != null ? helper : ",this.aliasable("container.hooks.helperMissing"))),this.push(["(",i,r.paramsInit?["),(",r.paramsInit]:[],"),","(typeof helper === ",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",r.callParams)," : helper))"])},invokePartial:function(t,e,n){var r=[],i=this.setupParams(e,1,r);t&&(e=this.popStack(),delete i.name),n&&(i.indent=JSON.stringify(n)),i.helpers="helpers",i.partials="partials",i.decorators="container.decorators",t?r.unshift(e):r.unshift(this.nameLookup("partials",e,"partial")),this.options.compat&&(i.depths="depths"),i=this.objectLiteral(i),r.push(i),this.push(this.source.functionCall("container.invokePartial","",r))},assignToHash:function(t){var e=this.popStack(),n=void 0,r=void 0,i=void 0;this.trackIds&&(i=this.popStack()),this.stringParams&&(r=this.popStack(),n=this.popStack());var o=this.hash;n&&(o.contexts[t]=n),r&&(o.types[t]=r),i&&(o.ids[t]=i),o.values[t]=e},pushId:function(t,e,n){"BlockParam"===t?this.pushStackLiteral("blockParams["+e[0]+"].path["+e[1]+"]"+(n?" + "+JSON.stringify("."+n):"")):"PathExpression"===t?this.pushString(e):"SubExpression"===t?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:c,compileChildren:function(t,e){for(var n=t.children,r=void 0,i=void 0,o=0,s=n.length;o<s;o++){r=n[o],i=new this.compiler;var a=this.matchExistingProgram(r);if(null==a){this.context.programs.push("");var u=this.context.programs.length;r.index=u,r.name="program"+u,this.context.programs[u]=i.compile(r,e,this.context,!this.precompile),this.context.decorators[u]=i.decorators,this.context.environments[u]=r,this.useDepths=this.useDepths||i.useDepths,this.useBlockParams=this.useBlockParams||i.useBlockParams,r.useDepths=this.useDepths,r.useBlockParams=this.useBlockParams}else r.index=a.index,r.name="program"+a.index,this.useDepths=this.useDepths||a.useDepths,this.useBlockParams=this.useBlockParams||a.useBlockParams}},matchExistingProgram:function(t){for(var e=0,n=this.context.environments.length;e<n;e++){var r=this.context.environments[e];if(r&&r.equals(t))return r}},programExpression:function(t){var e=this.environment.children[t],n=[e.index,"data",e.blockParams];return(this.useBlockParams||this.useDepths)&&n.push("blockParams"),this.useDepths&&n.push("depths"),"container.program("+n.join(", ")+")"},useRegister:function(t){this.registers[t]||(this.registers[t]=!0,this.registers.list.push(t))},push:function(t){return t instanceof u||(t=this.source.wrap(t)),this.inlineStack.push(t),t},pushStackLiteral:function(t){this.push(new u(t))},pushSource:function(t){this.pendingContent&&(this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0),t&&this.source.push(t)},replaceStack:function(t){var e=["("],n=void 0,r=void 0,i=void 0;if(!this.isInline())throw new o.default("replaceStack on non-inline");var s=this.popStack(!0);if(s instanceof u)e=["(",n=[s.value]],i=!0;else{r=!0;var a=this.incrStack();e=["((",this.push(a)," = ",s,")"],n=this.topStack()}var c=t.call(this,n);i||this.popStack(),r&&this.stackSlot--,this.push(e.concat(c,")"))},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var t=this.inlineStack;this.inlineStack=[];for(var e=0,n=t.length;e<n;e++){var r=t[e];if(r instanceof u)this.compileStack.push(r);else{var i=this.incrStack();this.pushSource([i," = ",r,";"]),this.compileStack.push(i)}}},isInline:function(){return this.inlineStack.length},popStack:function(t){var e=this.isInline(),n=(e?this.inlineStack:this.compileStack).pop();if(!t&&n instanceof u)return n.value;if(!e){if(!this.stackSlot)throw new o.default("Invalid stack pop");this.stackSlot--}return n},topStack:function(){var t=this.isInline()?this.inlineStack:this.compileStack,e=t[t.length-1];return e instanceof u?e.value:e},contextName:function(t){return this.useDepths&&t?"depths["+t+"]":"depth"+t},quotedString:function(t){return this.source.quotedString(t)},objectLiteral:function(t){return this.source.objectLiteral(t)},aliasable:function(t){var e=this.aliases[t];return e?(e.referenceCount++,e):((e=this.aliases[t]=this.source.wrap(t)).aliasable=!0,e.referenceCount=1,e)},setupHelper:function(t,e,n){var r=[];return{params:r,paramsInit:this.setupHelperArgs(e,t,r,n),name:this.nameLookup("helpers",e,"helper"),callParams:[this.aliasable(this.contextName(0)+" != null ? "+this.contextName(0)+" : (container.nullContext || {})")].concat(r)}},setupParams:function(t,e,n){var r={},i=[],o=[],s=[],a=!n,u=void 0;a&&(n=[]),r.name=this.quotedString(t),r.hash=this.popStack(),this.trackIds&&(r.hashIds=this.popStack()),this.stringParams&&(r.hashTypes=this.popStack(),r.hashContexts=this.popStack());var c=this.popStack(),l=this.popStack();(l||c)&&(r.fn=l||"container.noop",r.inverse=c||"container.noop");for(var h=e;h--;)u=this.popStack(),n[h]=u,this.trackIds&&(s[h]=this.popStack()),this.stringParams&&(o[h]=this.popStack(),i[h]=this.popStack());return a&&(r.args=this.source.generateArray(n)),this.trackIds&&(r.ids=this.source.generateArray(s)),this.stringParams&&(r.types=this.source.generateArray(o),r.contexts=this.source.generateArray(i)),this.options.data&&(r.data="data"),this.useBlockParams&&(r.blockParams="blockParams"),r},setupHelperArgs:function(t,e,n,r){var i=this.setupParams(t,e,n);return i.loc=JSON.stringify(this.source.currentLocation),i=this.objectLiteral(i),r?(this.useRegister("options"),n.push("options"),["options=",i]):n?(n.push(i),""):i}},function(){for(var t="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield await null true false".split(" "),e=c.RESERVED_WORDS={},n=0,r=t.length;n<r;n++)e[t[n]]=!0}(),c.isValidJavaScriptVariableName=function(t){return!c.RESERVED_WORDS[t]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(t)},e.default=c,t.exports=e.default},6201(t,e){e.__esModule=!0;var n=function(){var t={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,partialBlock:12,content:13,COMMENT:14,CONTENT:15,openRawBlock:16,rawBlock_repetition0:17,END_RAW_BLOCK:18,OPEN_RAW_BLOCK:19,helperName:20,openRawBlock_repetition0:21,openRawBlock_option0:22,CLOSE_RAW_BLOCK:23,openBlock:24,block_option0:25,closeBlock:26,openInverse:27,block_option1:28,OPEN_BLOCK:29,openBlock_repetition0:30,openBlock_option0:31,openBlock_option1:32,CLOSE:33,OPEN_INVERSE:34,openInverse_repetition0:35,openInverse_option0:36,openInverse_option1:37,openInverseChain:38,OPEN_INVERSE_CHAIN:39,openInverseChain_repetition0:40,openInverseChain_option0:41,openInverseChain_option1:42,inverseAndProgram:43,INVERSE:44,inverseChain:45,inverseChain_option0:46,OPEN_ENDBLOCK:47,OPEN:48,mustache_repetition0:49,mustache_option0:50,OPEN_UNESCAPED:51,mustache_repetition1:52,mustache_option1:53,CLOSE_UNESCAPED:54,OPEN_PARTIAL:55,partialName:56,partial_repetition0:57,partial_option0:58,openPartialBlock:59,OPEN_PARTIAL_BLOCK:60,openPartialBlock_repetition0:61,openPartialBlock_option0:62,param:63,sexpr:64,OPEN_SEXPR:65,sexpr_repetition0:66,sexpr_option0:67,CLOSE_SEXPR:68,hash:69,hash_repetition_plus0:70,hashSegment:71,ID:72,EQUALS:73,blockParams:74,OPEN_BLOCK_PARAMS:75,blockParams_repetition_plus0:76,CLOSE_BLOCK_PARAMS:77,path:78,dataName:79,STRING:80,NUMBER:81,BOOLEAN:82,UNDEFINED:83,NULL:84,DATA:85,pathSegments:86,SEP:87,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"COMMENT",15:"CONTENT",18:"END_RAW_BLOCK",19:"OPEN_RAW_BLOCK",23:"CLOSE_RAW_BLOCK",29:"OPEN_BLOCK",33:"CLOSE",34:"OPEN_INVERSE",39:"OPEN_INVERSE_CHAIN",44:"INVERSE",47:"OPEN_ENDBLOCK",48:"OPEN",51:"OPEN_UNESCAPED",54:"CLOSE_UNESCAPED",55:"OPEN_PARTIAL",60:"OPEN_PARTIAL_BLOCK",65:"OPEN_SEXPR",68:"CLOSE_SEXPR",72:"ID",73:"EQUALS",75:"OPEN_BLOCK_PARAMS",77:"CLOSE_BLOCK_PARAMS",80:"STRING",81:"NUMBER",82:"BOOLEAN",83:"UNDEFINED",84:"NULL",85:"DATA",87:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[13,1],[10,3],[16,5],[9,4],[9,4],[24,6],[27,6],[38,6],[43,2],[45,3],[45,1],[26,3],[8,5],[8,5],[11,5],[12,3],[59,5],[63,1],[63,1],[64,5],[69,1],[71,3],[74,3],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[56,1],[56,1],[79,2],[78,1],[86,3],[86,1],[6,0],[6,2],[17,0],[17,2],[21,0],[21,2],[22,0],[22,1],[25,0],[25,1],[28,0],[28,1],[30,0],[30,2],[31,0],[31,1],[32,0],[32,1],[35,0],[35,2],[36,0],[36,1],[37,0],[37,1],[40,0],[40,2],[41,0],[41,1],[42,0],[42,1],[46,0],[46,1],[49,0],[49,2],[50,0],[50,1],[52,0],[52,2],[53,0],[53,1],[57,0],[57,2],[58,0],[58,1],[61,0],[61,2],[62,0],[62,1],[66,0],[66,2],[67,0],[67,1],[70,1],[70,2],[76,1],[76,2]],performAction:function(t,e,n,r,i,o,s){var a=o.length-1;switch(i){case 1:return o[a-1];case 2:this.$=r.prepareProgram(o[a]);break;case 3:case 4:case 5:case 6:case 7:case 8:case 20:case 27:case 28:case 33:case 34:case 40:case 41:this.$=o[a];break;case 9:this.$={type:"CommentStatement",value:r.stripComment(o[a]),strip:r.stripFlags(o[a],o[a]),loc:r.locInfo(this._$)};break;case 10:this.$={type:"ContentStatement",original:o[a],value:o[a],loc:r.locInfo(this._$)};break;case 11:this.$=r.prepareRawBlock(o[a-2],o[a-1],o[a],this._$);break;case 12:this.$={path:o[a-3],params:o[a-2],hash:o[a-1]};break;case 13:this.$=r.prepareBlock(o[a-3],o[a-2],o[a-1],o[a],!1,this._$);break;case 14:this.$=r.prepareBlock(o[a-3],o[a-2],o[a-1],o[a],!0,this._$);break;case 15:this.$={open:o[a-5],path:o[a-4],params:o[a-3],hash:o[a-2],blockParams:o[a-1],strip:r.stripFlags(o[a-5],o[a])};break;case 16:case 17:this.$={path:o[a-4],params:o[a-3],hash:o[a-2],blockParams:o[a-1],strip:r.stripFlags(o[a-5],o[a])};break;case 18:this.$={strip:r.stripFlags(o[a-1],o[a-1]),program:o[a]};break;case 19:var u=r.prepareBlock(o[a-2],o[a-1],o[a],o[a],!1,this._$),c=r.prepareProgram([u],o[a-1].loc);c.chained=!0,this.$={strip:o[a-2].strip,program:c,chain:!0};break;case 21:this.$={path:o[a-1],strip:r.stripFlags(o[a-2],o[a])};break;case 22:case 23:this.$=r.prepareMustache(o[a-3],o[a-2],o[a-1],o[a-4],r.stripFlags(o[a-4],o[a]),this._$);break;case 24:this.$={type:"PartialStatement",name:o[a-3],params:o[a-2],hash:o[a-1],indent:"",strip:r.stripFlags(o[a-4],o[a]),loc:r.locInfo(this._$)};break;case 25:this.$=r.preparePartialBlock(o[a-2],o[a-1],o[a],this._$);break;case 26:this.$={path:o[a-3],params:o[a-2],hash:o[a-1],strip:r.stripFlags(o[a-4],o[a])};break;case 29:this.$={type:"SubExpression",path:o[a-3],params:o[a-2],hash:o[a-1],loc:r.locInfo(this._$)};break;case 30:this.$={type:"Hash",pairs:o[a],loc:r.locInfo(this._$)};break;case 31:this.$={type:"HashPair",key:r.id(o[a-2]),value:o[a],loc:r.locInfo(this._$)};break;case 32:this.$=r.id(o[a-1]);break;case 35:this.$={type:"StringLiteral",value:o[a],original:o[a],loc:r.locInfo(this._$)};break;case 36:this.$={type:"NumberLiteral",value:Number(o[a]),original:Number(o[a]),loc:r.locInfo(this._$)};break;case 37:this.$={type:"BooleanLiteral",value:"true"===o[a],original:"true"===o[a],loc:r.locInfo(this._$)};break;case 38:this.$={type:"UndefinedLiteral",original:void 0,value:void 0,loc:r.locInfo(this._$)};break;case 39:this.$={type:"NullLiteral",original:null,value:null,loc:r.locInfo(this._$)};break;case 42:this.$=r.preparePath(!0,o[a],this._$);break;case 43:this.$=r.preparePath(!1,o[a],this._$);break;case 44:o[a-2].push({part:r.id(o[a]),original:o[a],separator:o[a-1]}),this.$=o[a-2];break;case 45:this.$=[{part:r.id(o[a]),original:o[a]}];break;case 46:case 48:case 50:case 58:case 64:case 70:case 78:case 82:case 86:case 90:case 94:this.$=[];break;case 47:case 49:case 51:case 59:case 65:case 71:case 79:case 83:case 87:case 91:case 95:case 99:case 101:o[a-1].push(o[a]);break;case 98:case 100:this.$=[o[a]]}},table:[{3:1,4:2,5:[2,46],6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:11,14:[1,12],15:[1,20],16:17,19:[1,23],24:15,27:16,29:[1,21],34:[1,22],39:[2,2],44:[2,2],47:[2,2],48:[1,13],51:[1,14],55:[1,18],59:19,60:[1,24]},{1:[2,1]},{5:[2,47],14:[2,47],15:[2,47],19:[2,47],29:[2,47],34:[2,47],39:[2,47],44:[2,47],47:[2,47],48:[2,47],51:[2,47],55:[2,47],60:[2,47]},{5:[2,3],14:[2,3],15:[2,3],19:[2,3],29:[2,3],34:[2,3],39:[2,3],44:[2,3],47:[2,3],48:[2,3],51:[2,3],55:[2,3],60:[2,3]},{5:[2,4],14:[2,4],15:[2,4],19:[2,4],29:[2,4],34:[2,4],39:[2,4],44:[2,4],47:[2,4],48:[2,4],51:[2,4],55:[2,4],60:[2,4]},{5:[2,5],14:[2,5],15:[2,5],19:[2,5],29:[2,5],34:[2,5],39:[2,5],44:[2,5],47:[2,5],48:[2,5],51:[2,5],55:[2,5],60:[2,5]},{5:[2,6],14:[2,6],15:[2,6],19:[2,6],29:[2,6],34:[2,6],39:[2,6],44:[2,6],47:[2,6],48:[2,6],51:[2,6],55:[2,6],60:[2,6]},{5:[2,7],14:[2,7],15:[2,7],19:[2,7],29:[2,7],34:[2,7],39:[2,7],44:[2,7],47:[2,7],48:[2,7],51:[2,7],55:[2,7],60:[2,7]},{5:[2,8],14:[2,8],15:[2,8],19:[2,8],29:[2,8],34:[2,8],39:[2,8],44:[2,8],47:[2,8],48:[2,8],51:[2,8],55:[2,8],60:[2,8]},{5:[2,9],14:[2,9],15:[2,9],19:[2,9],29:[2,9],34:[2,9],39:[2,9],44:[2,9],47:[2,9],48:[2,9],51:[2,9],55:[2,9],60:[2,9]},{20:25,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:36,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:37,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{4:38,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{15:[2,48],17:39,18:[2,48]},{20:41,56:40,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:44,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{5:[2,10],14:[2,10],15:[2,10],18:[2,10],19:[2,10],29:[2,10],34:[2,10],39:[2,10],44:[2,10],47:[2,10],48:[2,10],51:[2,10],55:[2,10],60:[2,10]},{20:45,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:46,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:47,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:41,56:48,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[2,78],49:49,65:[2,78],72:[2,78],80:[2,78],81:[2,78],82:[2,78],83:[2,78],84:[2,78],85:[2,78]},{23:[2,33],33:[2,33],54:[2,33],65:[2,33],68:[2,33],72:[2,33],75:[2,33],80:[2,33],81:[2,33],82:[2,33],83:[2,33],84:[2,33],85:[2,33]},{23:[2,34],33:[2,34],54:[2,34],65:[2,34],68:[2,34],72:[2,34],75:[2,34],80:[2,34],81:[2,34],82:[2,34],83:[2,34],84:[2,34],85:[2,34]},{23:[2,35],33:[2,35],54:[2,35],65:[2,35],68:[2,35],72:[2,35],75:[2,35],80:[2,35],81:[2,35],82:[2,35],83:[2,35],84:[2,35],85:[2,35]},{23:[2,36],33:[2,36],54:[2,36],65:[2,36],68:[2,36],72:[2,36],75:[2,36],80:[2,36],81:[2,36],82:[2,36],83:[2,36],84:[2,36],85:[2,36]},{23:[2,37],33:[2,37],54:[2,37],65:[2,37],68:[2,37],72:[2,37],75:[2,37],80:[2,37],81:[2,37],82:[2,37],83:[2,37],84:[2,37],85:[2,37]},{23:[2,38],33:[2,38],54:[2,38],65:[2,38],68:[2,38],72:[2,38],75:[2,38],80:[2,38],81:[2,38],82:[2,38],83:[2,38],84:[2,38],85:[2,38]},{23:[2,39],33:[2,39],54:[2,39],65:[2,39],68:[2,39],72:[2,39],75:[2,39],80:[2,39],81:[2,39],82:[2,39],83:[2,39],84:[2,39],85:[2,39]},{23:[2,43],33:[2,43],54:[2,43],65:[2,43],68:[2,43],72:[2,43],75:[2,43],80:[2,43],81:[2,43],82:[2,43],83:[2,43],84:[2,43],85:[2,43],87:[1,50]},{72:[1,35],86:51},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{52:52,54:[2,82],65:[2,82],72:[2,82],80:[2,82],81:[2,82],82:[2,82],83:[2,82],84:[2,82],85:[2,82]},{25:53,38:55,39:[1,57],43:56,44:[1,58],45:54,47:[2,54]},{28:59,43:60,44:[1,58],47:[2,56]},{13:62,15:[1,20],18:[1,61]},{33:[2,86],57:63,65:[2,86],72:[2,86],80:[2,86],81:[2,86],82:[2,86],83:[2,86],84:[2,86],85:[2,86]},{33:[2,40],65:[2,40],72:[2,40],80:[2,40],81:[2,40],82:[2,40],83:[2,40],84:[2,40],85:[2,40]},{33:[2,41],65:[2,41],72:[2,41],80:[2,41],81:[2,41],82:[2,41],83:[2,41],84:[2,41],85:[2,41]},{20:64,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:65,47:[1,66]},{30:67,33:[2,58],65:[2,58],72:[2,58],75:[2,58],80:[2,58],81:[2,58],82:[2,58],83:[2,58],84:[2,58],85:[2,58]},{33:[2,64],35:68,65:[2,64],72:[2,64],75:[2,64],80:[2,64],81:[2,64],82:[2,64],83:[2,64],84:[2,64],85:[2,64]},{21:69,23:[2,50],65:[2,50],72:[2,50],80:[2,50],81:[2,50],82:[2,50],83:[2,50],84:[2,50],85:[2,50]},{33:[2,90],61:70,65:[2,90],72:[2,90],80:[2,90],81:[2,90],82:[2,90],83:[2,90],84:[2,90],85:[2,90]},{20:74,33:[2,80],50:71,63:72,64:75,65:[1,43],69:73,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{72:[1,79]},{23:[2,42],33:[2,42],54:[2,42],65:[2,42],68:[2,42],72:[2,42],75:[2,42],80:[2,42],81:[2,42],82:[2,42],83:[2,42],84:[2,42],85:[2,42],87:[1,50]},{20:74,53:80,54:[2,84],63:81,64:75,65:[1,43],69:82,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:83,47:[1,66]},{47:[2,55]},{4:84,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{47:[2,20]},{20:85,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:86,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{26:87,47:[1,66]},{47:[2,57]},{5:[2,11],14:[2,11],15:[2,11],19:[2,11],29:[2,11],34:[2,11],39:[2,11],44:[2,11],47:[2,11],48:[2,11],51:[2,11],55:[2,11],60:[2,11]},{15:[2,49],18:[2,49]},{20:74,33:[2,88],58:88,63:89,64:75,65:[1,43],69:90,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{65:[2,94],66:91,68:[2,94],72:[2,94],80:[2,94],81:[2,94],82:[2,94],83:[2,94],84:[2,94],85:[2,94]},{5:[2,25],14:[2,25],15:[2,25],19:[2,25],29:[2,25],34:[2,25],39:[2,25],44:[2,25],47:[2,25],48:[2,25],51:[2,25],55:[2,25],60:[2,25]},{20:92,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,31:93,33:[2,60],63:94,64:75,65:[1,43],69:95,70:76,71:77,72:[1,78],75:[2,60],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,66],36:96,63:97,64:75,65:[1,43],69:98,70:76,71:77,72:[1,78],75:[2,66],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,22:99,23:[2,52],63:100,64:75,65:[1,43],69:101,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,92],62:102,63:103,64:75,65:[1,43],69:104,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,105]},{33:[2,79],65:[2,79],72:[2,79],80:[2,79],81:[2,79],82:[2,79],83:[2,79],84:[2,79],85:[2,79]},{33:[2,81]},{23:[2,27],33:[2,27],54:[2,27],65:[2,27],68:[2,27],72:[2,27],75:[2,27],80:[2,27],81:[2,27],82:[2,27],83:[2,27],84:[2,27],85:[2,27]},{23:[2,28],33:[2,28],54:[2,28],65:[2,28],68:[2,28],72:[2,28],75:[2,28],80:[2,28],81:[2,28],82:[2,28],83:[2,28],84:[2,28],85:[2,28]},{23:[2,30],33:[2,30],54:[2,30],68:[2,30],71:106,72:[1,107],75:[2,30]},{23:[2,98],33:[2,98],54:[2,98],68:[2,98],72:[2,98],75:[2,98]},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],73:[1,108],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{23:[2,44],33:[2,44],54:[2,44],65:[2,44],68:[2,44],72:[2,44],75:[2,44],80:[2,44],81:[2,44],82:[2,44],83:[2,44],84:[2,44],85:[2,44],87:[2,44]},{54:[1,109]},{54:[2,83],65:[2,83],72:[2,83],80:[2,83],81:[2,83],82:[2,83],83:[2,83],84:[2,83],85:[2,83]},{54:[2,85]},{5:[2,13],14:[2,13],15:[2,13],19:[2,13],29:[2,13],34:[2,13],39:[2,13],44:[2,13],47:[2,13],48:[2,13],51:[2,13],55:[2,13],60:[2,13]},{38:55,39:[1,57],43:56,44:[1,58],45:111,46:110,47:[2,76]},{33:[2,70],40:112,65:[2,70],72:[2,70],75:[2,70],80:[2,70],81:[2,70],82:[2,70],83:[2,70],84:[2,70],85:[2,70]},{47:[2,18]},{5:[2,14],14:[2,14],15:[2,14],19:[2,14],29:[2,14],34:[2,14],39:[2,14],44:[2,14],47:[2,14],48:[2,14],51:[2,14],55:[2,14],60:[2,14]},{33:[1,113]},{33:[2,87],65:[2,87],72:[2,87],80:[2,87],81:[2,87],82:[2,87],83:[2,87],84:[2,87],85:[2,87]},{33:[2,89]},{20:74,63:115,64:75,65:[1,43],67:114,68:[2,96],69:116,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,117]},{32:118,33:[2,62],74:119,75:[1,120]},{33:[2,59],65:[2,59],72:[2,59],75:[2,59],80:[2,59],81:[2,59],82:[2,59],83:[2,59],84:[2,59],85:[2,59]},{33:[2,61],75:[2,61]},{33:[2,68],37:121,74:122,75:[1,120]},{33:[2,65],65:[2,65],72:[2,65],75:[2,65],80:[2,65],81:[2,65],82:[2,65],83:[2,65],84:[2,65],85:[2,65]},{33:[2,67],75:[2,67]},{23:[1,123]},{23:[2,51],65:[2,51],72:[2,51],80:[2,51],81:[2,51],82:[2,51],83:[2,51],84:[2,51],85:[2,51]},{23:[2,53]},{33:[1,124]},{33:[2,91],65:[2,91],72:[2,91],80:[2,91],81:[2,91],82:[2,91],83:[2,91],84:[2,91],85:[2,91]},{33:[2,93]},{5:[2,22],14:[2,22],15:[2,22],19:[2,22],29:[2,22],34:[2,22],39:[2,22],44:[2,22],47:[2,22],48:[2,22],51:[2,22],55:[2,22],60:[2,22]},{23:[2,99],33:[2,99],54:[2,99],68:[2,99],72:[2,99],75:[2,99]},{73:[1,108]},{20:74,63:125,64:75,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,23],14:[2,23],15:[2,23],19:[2,23],29:[2,23],34:[2,23],39:[2,23],44:[2,23],47:[2,23],48:[2,23],51:[2,23],55:[2,23],60:[2,23]},{47:[2,19]},{47:[2,77]},{20:74,33:[2,72],41:126,63:127,64:75,65:[1,43],69:128,70:76,71:77,72:[1,78],75:[2,72],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,24],14:[2,24],15:[2,24],19:[2,24],29:[2,24],34:[2,24],39:[2,24],44:[2,24],47:[2,24],48:[2,24],51:[2,24],55:[2,24],60:[2,24]},{68:[1,129]},{65:[2,95],68:[2,95],72:[2,95],80:[2,95],81:[2,95],82:[2,95],83:[2,95],84:[2,95],85:[2,95]},{68:[2,97]},{5:[2,21],14:[2,21],15:[2,21],19:[2,21],29:[2,21],34:[2,21],39:[2,21],44:[2,21],47:[2,21],48:[2,21],51:[2,21],55:[2,21],60:[2,21]},{33:[1,130]},{33:[2,63]},{72:[1,132],76:131},{33:[1,133]},{33:[2,69]},{15:[2,12],18:[2,12]},{14:[2,26],15:[2,26],19:[2,26],29:[2,26],34:[2,26],47:[2,26],48:[2,26],51:[2,26],55:[2,26],60:[2,26]},{23:[2,31],33:[2,31],54:[2,31],68:[2,31],72:[2,31],75:[2,31]},{33:[2,74],42:134,74:135,75:[1,120]},{33:[2,71],65:[2,71],72:[2,71],75:[2,71],80:[2,71],81:[2,71],82:[2,71],83:[2,71],84:[2,71],85:[2,71]},{33:[2,73],75:[2,73]},{23:[2,29],33:[2,29],54:[2,29],65:[2,29],68:[2,29],72:[2,29],75:[2,29],80:[2,29],81:[2,29],82:[2,29],83:[2,29],84:[2,29],85:[2,29]},{14:[2,15],15:[2,15],19:[2,15],29:[2,15],34:[2,15],39:[2,15],44:[2,15],47:[2,15],48:[2,15],51:[2,15],55:[2,15],60:[2,15]},{72:[1,137],77:[1,136]},{72:[2,100],77:[2,100]},{14:[2,16],15:[2,16],19:[2,16],29:[2,16],34:[2,16],44:[2,16],47:[2,16],48:[2,16],51:[2,16],55:[2,16],60:[2,16]},{33:[1,138]},{33:[2,75]},{33:[2,32]},{72:[2,101],77:[2,101]},{14:[2,17],15:[2,17],19:[2,17],29:[2,17],34:[2,17],39:[2,17],44:[2,17],47:[2,17],48:[2,17],51:[2,17],55:[2,17],60:[2,17]}],defaultActions:{4:[2,1],54:[2,55],56:[2,20],60:[2,57],73:[2,81],82:[2,85],86:[2,18],90:[2,89],101:[2,53],104:[2,93],110:[2,19],111:[2,77],116:[2,97],119:[2,63],122:[2,69],135:[2,75],136:[2,32]},parseError:function(t,e){throw new Error(t)},parse:function(t){var e=this,n=[0],r=[null],i=[],o=this.table,s="",a=0,u=0,c=0;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,void 0===this.lexer.yylloc&&(this.lexer.yylloc={});var l=this.lexer.yylloc;i.push(l);var h=this.lexer.options&&this.lexer.options.ranges;function d(){var t;return"number"!=typeof(t=e.lexer.lex()||1)&&(t=e.symbols_[t]||t),t}"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var p,f,m,g,_,y,v,b,w,x={};;){if(m=n[n.length-1],this.defaultActions[m]?g=this.defaultActions[m]:(null==p&&(p=d()),g=o[m]&&o[m][p]),void 0===g||!g.length||!g[0]){var T="";if(!c){for(y in w=[],o[m])this.terminals_[y]&&y>2&&w.push("'"+this.terminals_[y]+"'");T=this.lexer.showPosition?"Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+w.join(", ")+", got '"+(this.terminals_[p]||p)+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==p?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(T,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:l,expected:w})}}if(g[0]instanceof Array&&g.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+p);switch(g[0]){case 1:n.push(p),r.push(this.lexer.yytext),i.push(this.lexer.yylloc),n.push(g[1]),p=null,f?(p=f,f=null):(u=this.lexer.yyleng,s=this.lexer.yytext,a=this.lexer.yylineno,l=this.lexer.yylloc,c>0&&c--);break;case 2:if(v=this.productions_[g[1]][1],x.$=r[r.length-v],x._$={first_line:i[i.length-(v||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(v||1)].first_column,last_column:i[i.length-1].last_column},h&&(x._$.range=[i[i.length-(v||1)].range[0],i[i.length-1].range[1]]),void 0!==(_=this.performAction.call(x,s,u,a,this.yy,g[1],r,i)))return _;v&&(n=n.slice(0,-1*v*2),r=r.slice(0,-1*v),i=i.slice(0,-1*v)),n.push(this.productions_[g[1]][0]),r.push(x.$),i.push(x._$),b=o[n[n.length-2]][n[n.length-1]],n.push(b);break;case 3:return!0}}return!0}},e=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t){return this._input=t,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e-1),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this},more:function(){return this._more=!0,this},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},next:function(){if(this.done)return this.EOF;var t,e,n,r,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var o=this._currentRules(),s=0;s<o.length&&(!(n=this._input.match(this.rules[o[s]]))||e&&!(n[0].length>e[0].length)||(e=n,r=s,this.options.flex));s++);return e?((i=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],t=this.performAction.call(this,this.yy,this,o[r],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t||void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return void 0!==t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)},options:{},performAction:function(t,e,n,r){function i(t,n){return e.yytext=e.yytext.substring(t,e.yyleng-n+t)}switch(n){case 0:if("\\\\"===e.yytext.slice(-2)?(i(0,1),this.begin("mu")):"\\"===e.yytext.slice(-1)?(i(0,1),this.begin("emu")):this.begin("mu"),e.yytext)return 15;break;case 1:case 5:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),"raw"===this.conditionStack[this.conditionStack.length-1]?15:(i(5,9),"END_RAW_BLOCK");case 6:case 22:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:case 23:return 48;case 21:this.unput(e.yytext),this.popState(),this.begin("com");break;case 24:return 73;case 25:case 26:case 41:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return e.yytext=i(1,2).replace(/\\"/g,'"'),80;case 32:return e.yytext=i(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 42:return e.yytext=e.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},rules:[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],conditions:{mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}}};return t}();function n(){this.yy={}}return t.lexer=e,n.prototype=t,t.Parser=n,new n}();e.default=n,t.exports=e.default},1350(t,e,n){e.__esModule=!0;var r,i=n(3769),o=(r=i)&&r.__esModule?r:{default:r};function s(){this.parents=[]}function a(t){this.acceptRequired(t,"path"),this.acceptArray(t.params),this.acceptKey(t,"hash")}function u(t){a.call(this,t),this.acceptKey(t,"program"),this.acceptKey(t,"inverse")}function c(t){this.acceptRequired(t,"name"),this.acceptArray(t.params),this.acceptKey(t,"hash")}s.prototype={constructor:s,mutating:!1,acceptKey:function(t,e){var n=this.accept(t[e]);if(this.mutating){if(n&&!s.prototype[n.type])throw new o.default('Unexpected node type "'+n.type+'" found when accepting '+e+" on "+t.type);t[e]=n}},acceptRequired:function(t,e){if(this.acceptKey(t,e),!t[e])throw new o.default(t.type+" requires "+e)},acceptArray:function(t){for(var e=0,n=t.length;e<n;e++)this.acceptKey(t,e),t[e]||(t.splice(e,1),e--,n--)},accept:function(t){if(t){if(!this[t.type])throw new o.default("Unknown type: "+t.type,t);this.current&&this.parents.unshift(this.current),this.current=t;var e=this[t.type](t);return this.current=this.parents.shift(),!this.mutating||e?e:!1!==e?t:void 0}},Program:function(t){this.acceptArray(t.body)},MustacheStatement:a,Decorator:a,BlockStatement:u,DecoratorBlock:u,PartialStatement:c,PartialBlockStatement:function(t){c.call(this,t),this.acceptKey(t,"program")},ContentStatement:function(){},CommentStatement:function(){},SubExpression:a,PathExpression:function(){},StringLiteral:function(){},NumberLiteral:function(){},BooleanLiteral:function(){},UndefinedLiteral:function(){},NullLiteral:function(){},Hash:function(t){this.acceptArray(t.pairs)},HashPair:function(t){this.acceptRequired(t,"value")}},e.default=s,t.exports=e.default},915(t,e,n){e.__esModule=!0;var r,i=n(1350),o=(r=i)&&r.__esModule?r:{default:r};function s(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.options=t}function a(t,e,n){void 0===e&&(e=t.length);var r=t[e-1],i=t[e-2];return r?"ContentStatement"===r.type?(i||!n?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(r.original):void 0:n}function u(t,e,n){void 0===e&&(e=-1);var r=t[e+1],i=t[e+2];return r?"ContentStatement"===r.type?(i||!n?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(r.original):void 0:n}function c(t,e,n){var r=t[null==e?0:e+1];if(r&&"ContentStatement"===r.type&&(n||!r.rightStripped)){var i=r.value;r.value=r.value.replace(n?/^\s+/:/^[ \t]*\r?\n?/,""),r.rightStripped=r.value!==i}}function l(t,e,n){var r=t[null==e?t.length-1:e-1];if(r&&"ContentStatement"===r.type&&(n||!r.leftStripped)){var i=r.value;return r.value=r.value.replace(n?/\s+$/:/[ \t]+$/,""),r.leftStripped=r.value!==i,r.leftStripped}}s.prototype=new o.default,s.prototype.Program=function(t){var e=!this.options.ignoreStandalone,n=!this.isRootSeen;this.isRootSeen=!0;for(var r=t.body,i=0,o=r.length;i<o;i++){var s=r[i],h=this.accept(s);if(h){var d=a(r,i,n),p=u(r,i,n),f=h.openStandalone&&d,m=h.closeStandalone&&p,g=h.inlineStandalone&&d&&p;h.close&&c(r,i,!0),h.open&&l(r,i,!0),e&&g&&(c(r,i),l(r,i)&&"PartialStatement"===s.type&&(s.indent=/([ \t]+$)/.exec(r[i-1].original)[1])),e&&f&&(c((s.program||s.inverse).body),l(r,i)),e&&m&&(c(r,i),l((s.inverse||s.program).body))}}return t},s.prototype.BlockStatement=s.prototype.DecoratorBlock=s.prototype.PartialBlockStatement=function(t){this.accept(t.program),this.accept(t.inverse);var e=t.program||t.inverse,n=t.program&&t.inverse,r=n,i=n;if(n&&n.chained)for(r=n.body[0].program;i.chained;)i=i.body[i.body.length-1].program;var o={open:t.openStrip.open,close:t.closeStrip.close,openStandalone:u(e.body),closeStandalone:a((r||e).body)};if(t.openStrip.close&&c(e.body,null,!0),n){var s=t.inverseStrip;s.open&&l(e.body,null,!0),s.close&&c(r.body,null,!0),t.closeStrip.open&&l(i.body,null,!0),!this.options.ignoreStandalone&&a(e.body)&&u(r.body)&&(l(e.body),c(r.body))}else t.closeStrip.open&&l(e.body,null,!0);return o},s.prototype.Decorator=s.prototype.MustacheStatement=function(t){return t.strip},s.prototype.PartialStatement=s.prototype.CommentStatement=function(t){var e=t.strip||{};return{inlineStandalone:!0,open:e.open,close:e.close}},e.default=s,t.exports=e.default},5940(t,e,n){e.__esModule=!0,e.registerDefaultDecorators=function(t){o.default(t)};var r,i=n(7430),o=(r=i)&&r.__esModule?r:{default:r}},7430(t,e,n){e.__esModule=!0;var r=n(2849);e.default=function(t){t.registerDecorator("inline",function(t,e,n,i){var o=t;return e.partials||(e.partials={},o=function(i,o){var s=n.partials;n.partials=r.extend({},s,e.partials);var a=t(i,o);return n.partials=s,a}),e.partials[i.args[0]]=i.fn,o})},t.exports=e.default},3769(t,e){e.__esModule=!0;var n=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function r(t,e){var i=e&&e.loc,o=void 0,s=void 0,a=void 0,u=void 0;i&&(o=i.start.line,s=i.end.line,a=i.start.column,u=i.end.column,t+=" - "+o+":"+a);for(var c=Error.prototype.constructor.call(this,t),l=0;l<n.length;l++)this[n[l]]=c[n[l]];Error.captureStackTrace&&Error.captureStackTrace(this,r);try{i&&(this.lineNumber=o,this.endLineNumber=s,Object.defineProperty?(Object.defineProperty(this,"column",{value:a,enumerable:!0}),Object.defineProperty(this,"endColumn",{value:u,enumerable:!0})):(this.column=a,this.endColumn=u))}catch(t){}}r.prototype=new Error,e.default=r,t.exports=e.default},2277(t,e,n){function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.registerDefaultHelpers=function(t){i.default(t),o.default(t),s.default(t),a.default(t),u.default(t),c.default(t),l.default(t)},e.moveHelperToHooks=function(t,e,n){t.helpers[e]&&(t.hooks[e]=t.helpers[e],n||delete t.helpers[e])};var i=r(n(6097)),o=r(n(6785)),s=r(n(4353)),a=r(n(2355)),u=r(n(5300)),c=r(n(7466)),l=r(n(908))},6097(t,e,n){e.__esModule=!0;var r=n(2849);e.default=function(t){t.registerHelper("blockHelperMissing",function(e,n){var i=n.inverse,o=n.fn;if(!0===e)return o(this);if(!1===e||null==e)return i(this);if(r.isArray(e))return e.length>0?(n.ids&&(n.ids=[n.name]),t.helpers.each(e,n)):i(this);if(n.data&&n.ids){var s=r.createFrame(n.data);s.contextPath=r.appendContextPath(n.data.contextPath,n.name),n={data:s}}return o(e,n)})},t.exports=e.default},6785(t,e,n){e.__esModule=!0;var r,i=n(2849),o=n(3769),s=(r=o)&&r.__esModule?r:{default:r};e.default=function(t){t.registerHelper("each",function(t,e){if(!e)throw new s.default("Must pass iterator to #each");var n,r=e.fn,o=e.inverse,a=0,u="",c=void 0,l=void 0;function h(e,n,o){c&&(c.key=e,c.index=n,c.first=0===n,c.last=!!o,l&&(c.contextPath=l+e)),u+=r(t[e],{data:c,blockParams:i.blockParams([t[e],e],[l+e,null])})}if(e.data&&e.ids&&(l=i.appendContextPath(e.data.contextPath,e.ids[0])+"."),i.isFunction(t)&&(t=t.call(this)),e.data&&(c=i.createFrame(e.data)),t&&"object"==typeof t)if(i.isArray(t))for(var d=t.length;a<d;a++)a in t&&h(a,a,a===t.length-1);else if("function"==typeof Symbol&&t[Symbol.iterator]){for(var p=[],f=t[Symbol.iterator](),m=f.next();!m.done;m=f.next())p.push(m.value);for(d=(t=p).length;a<d;a++)h(a,a,a===t.length-1)}else n=void 0,Object.keys(t).forEach(function(t){void 0!==n&&h(n,a-1),n=t,a++}),void 0!==n&&h(n,a-1,!0);return 0===a&&(u=o(this)),u})},t.exports=e.default},4353(t,e,n){e.__esModule=!0;var r,i=n(3769),o=(r=i)&&r.__esModule?r:{default:r};e.default=function(t){t.registerHelper("helperMissing",function(){if(1!==arguments.length)throw new o.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})},t.exports=e.default},2355(t,e,n){e.__esModule=!0;var r,i=n(2849),o=n(3769),s=(r=o)&&r.__esModule?r:{default:r};e.default=function(t){t.registerHelper("if",function(t,e){if(2!=arguments.length)throw new s.default("#if requires exactly one argument");return i.isFunction(t)&&(t=t.call(this)),!e.hash.includeZero&&!t||i.isEmpty(t)?e.inverse(this):e.fn(this)}),t.registerHelper("unless",function(e,n){if(2!=arguments.length)throw new s.default("#unless requires exactly one argument");return t.helpers.if.call(this,e,{fn:n.inverse,inverse:n.fn,hash:n.hash})})},t.exports=e.default},5300(t,e){e.__esModule=!0,e.default=function(t){t.registerHelper("log",function(){for(var e=[void 0],n=arguments[arguments.length-1],r=0;r<arguments.length-1;r++)e.push(arguments[r]);var i=1;null!=n.hash.level?i=n.hash.level:n.data&&null!=n.data.level&&(i=n.data.level),e[0]=i,t.log.apply(t,e)})},t.exports=e.default},7466(t,e){e.__esModule=!0,e.default=function(t){t.registerHelper("lookup",function(t,e,n){return t?n.lookupProperty(t,e):t})},t.exports=e.default},908(t,e,n){e.__esModule=!0;var r,i=n(2849),o=n(3769),s=(r=o)&&r.__esModule?r:{default:r};e.default=function(t){t.registerHelper("with",function(t,e){if(2!=arguments.length)throw new s.default("#with requires exactly one argument");i.isFunction(t)&&(t=t.call(this));var n=e.fn;if(i.isEmpty(t))return e.inverse(this);var r=e.data;return e.data&&e.ids&&((r=i.createFrame(e.data)).contextPath=i.appendContextPath(e.data.contextPath,e.ids[0])),n(t,{data:r,blockParams:i.blockParams([t],[r&&r.contextPath])})})},t.exports=e.default},9726(t,e,n){e.__esModule=!0,e.createNewLookupObject=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return r.extend.apply(void 0,[Object.create(null)].concat(e))};var r=n(2849)},3865(t,e,n){e.__esModule=!0,e.createProtoAccessControl=function(t){var e=Object.create(null);e.constructor=!1,e.__defineGetter__=!1,e.__defineSetter__=!1,e.__lookupGetter__=!1;var n=Object.create(null);return n.__proto__=!1,{properties:{whitelist:i.createNewLookupObject(n,t.allowedProtoProperties),defaultValue:t.allowProtoPropertiesByDefault},methods:{whitelist:i.createNewLookupObject(e,t.allowedProtoMethods),defaultValue:t.allowProtoMethodsByDefault}}},e.resultIsAllowed=function(t,e,n){return u("function"==typeof t?e.methods:e.properties,n)},e.resetLoggedProperties=function(){Object.keys(a).forEach(function(t){delete a[t]})};var r,i=n(9726),o=n(566),s=(r=o)&&r.__esModule?r:{default:r},a=Object.create(null);function u(t,e){return void 0!==t.whitelist[e]?!0===t.whitelist[e]:void 0!==t.defaultValue?t.defaultValue:(function(t){!0!==a[t]&&(a[t]=!0,s.default.log("error",'Handlebars: Access has been denied to resolve the property "'+t+'" because it is not an "own property" of its parent.\nYou can add a runtime option to disable the check or this warning:\nSee https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'))}(e),!1)}},2614(t,e){e.__esModule=!0,e.wrapHelper=function(t,e){if("function"!=typeof t)return t;return function(){return arguments[arguments.length-1]=e(arguments[arguments.length-1]),t.apply(this,arguments)}}},566(t,e,n){e.__esModule=!0;var r=n(2849),i={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(t){if("string"==typeof t){var e=r.indexOf(i.methodMap,t.toLowerCase());t=e>=0?e:parseInt(t,10)}return t},log:function(t){if(t=i.lookupLevel(t),"undefined"!=typeof console&&i.lookupLevel(i.level)<=t){var e=i.methodMap[t];console[e]||(e="log");for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o]}}};e.default=i,t.exports=e.default},1148(t,e){e.__esModule=!0,e.default=function(t){"object"!=typeof globalThis&&(Object.prototype.__defineGetter__("__magic__",function(){return this}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__);var e=globalThis.Handlebars;t.noConflict=function(){return globalThis.Handlebars===t&&(globalThis.Handlebars=e),t}},t.exports=e.default},7624(t,e,n){e.__esModule=!0,e.checkRevision=function(t){var e=t&&t[0]||1,n=a.COMPILER_REVISION;if(e>=a.LAST_COMPATIBLE_COMPILER_REVISION&&e<=a.COMPILER_REVISION)return;if(e<a.LAST_COMPATIBLE_COMPILER_REVISION){var r=a.REVISION_CHANGES[n],i=a.REVISION_CHANGES[e];throw new s.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+r+") or downgrade your runtime to an older version ("+i+").")}throw new s.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+t[1]+").")},e.template=function(t,e){if(!e)throw new s.default("No environment passed to template");if(!t||!t.main)throw new s.default("Unknown template object: "+typeof t);t.main.decorator=t.main_d,e.VM.checkRevision(t.compiler);var n=t.compiler&&7===t.compiler[0];var r={strict:function(t,e,n){if(!t||!(e in t))throw new s.default('"'+e+'" not defined in '+t,{loc:n});return r.lookupProperty(t,e)},lookupProperty:function(t,e){var n=t[e];return null==n||Object.prototype.hasOwnProperty.call(t,e)||l.resultIsAllowed(n,r.protoAccessControl,e)?n:void 0},lookup:function(t,e){for(var n=t.length,i=0;i<n;i++){if(null!=(t[i]&&r.lookupProperty(t[i],e)))return t[i][e]}},lambda:function(t,e){return"function"==typeof t?t.call(e):t},escapeExpression:i.escapeExpression,invokePartial:function(n,r,o){o.hash&&(r=i.extend({},r,o.hash),o.ids&&(o.ids[0]=!0)),n=e.VM.resolvePartial.call(this,n,r,o);var a=i.extend({},o,{hooks:this.hooks,protoAccessControl:this.protoAccessControl}),u=e.VM.invokePartial.call(this,n,r,a);if(null==u&&e.compile&&(o.partials[o.name]=e.compile(n,t.compilerOptions,e),u=o.partials[o.name](r,a)),null!=u){if(o.indent){for(var c=u.split("\n"),l=0,h=c.length;l<h&&(c[l]||l+1!==h);l++)c[l]=o.indent+c[l];u=c.join("\n")}return u}throw new s.default("The partial "+o.name+" could not be compiled when running in runtime-only mode")},fn:function(e){var n=t[e];return n.decorator=t[e+"_d"],n},programs:[],program:function(t,e,n,r,i){var o=this.programs[t],s=this.fn(t);return e||i||r||n?o=h(this,t,s,e,n,r,i):o||(o=this.programs[t]=h(this,t,s)),o},data:function(t,e){for(;t&&e--;)t=t._parent;return t},mergeIfNeeded:function(t,e){var n=t||e;return t&&e&&t!==e&&(n=i.extend({},e,t)),n},nullContext:Object.seal({}),noop:e.VM.noop,compilerInfo:t.compiler};function o(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=n.data;o._setup(n),!n.partial&&t.useData&&(i=function(t,e){e&&"root"in e||((e=e?a.createFrame(e):{}).root=t);return e}(e,i));var s=void 0,u=t.useBlockParams?[]:void 0;function c(e){return""+t.main(r,e,r.helpers,r.partials,i,u,s)}return t.useDepths&&(s=n.depths?e!=n.depths[0]?[e].concat(n.depths):n.depths:[e]),(c=p(t.main,c,r,n.depths||[],i,u))(e,n)}return o.isTop=!0,o._setup=function(o){if(o.partial)r.protoAccessControl=o.protoAccessControl,r.helpers=o.helpers,r.partials=o.partials,r.decorators=o.decorators,r.hooks=o.hooks;else{var s=i.extend({},e.helpers,o.helpers);!function(t,e){Object.keys(t).forEach(function(n){var r=t[n];t[n]=function(t,e){var n=e.lookupProperty;return c.wrapHelper(t,function(t){return i.extend({lookupProperty:n},t)})}(r,e)})}(s,r),r.helpers=s,t.usePartial&&(r.partials=r.mergeIfNeeded(o.partials,e.partials)),(t.usePartial||t.useDecorators)&&(r.decorators=i.extend({},e.decorators,o.decorators)),r.hooks={},r.protoAccessControl=l.createProtoAccessControl(o);var a=o.allowCallsToHelperMissing||n;u.moveHelperToHooks(r,"helperMissing",a),u.moveHelperToHooks(r,"blockHelperMissing",a)}},o._child=function(e,n,i,o){if(t.useBlockParams&&!i)throw new s.default("must pass block params");if(t.useDepths&&!o)throw new s.default("must pass parent depths");return h(r,e,t[e],n,0,i,o)},o},e.wrapProgram=h,e.resolvePartial=function(t,e,n){t?t.call||n.name||(n.name=t,t=n.partials[t]):t="@partial-block"===n.name?n.data["partial-block"]:n.partials[n.name];return t},e.invokePartial=function(t,e,n){var r=n.data&&n.data["partial-block"];n.partial=!0,n.ids&&(n.data.contextPath=n.ids[0]||n.data.contextPath);var o=void 0;n.fn&&n.fn!==d&&function(){n.data=a.createFrame(n.data);var t=n.fn;o=n.data["partial-block"]=function(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return n.data=a.createFrame(n.data),n.data["partial-block"]=r,t(e,n)},t.partials&&(n.partials=i.extend({},n.partials,t.partials))}();void 0===t&&o&&(t=o);if(void 0===t)throw new s.default("The partial "+n.name+" could not be found");if(t instanceof Function)return t(e,n)},e.noop=d;var r,i=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2849)),o=n(3769),s=(r=o)&&r.__esModule?r:{default:r},a=n(2871),u=n(2277),c=n(2614),l=n(3865);function h(t,e,n,r,i,o,s){function a(e){var i=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],a=s;return!s||e==s[0]||e===t.nullContext&&null===s[0]||(a=[e].concat(s)),n(t,e,t.helpers,t.partials,i.data||r,o&&[i.blockParams].concat(o),a)}return(a=p(n,a,t,s,r,o)).program=e,a.depth=s?s.length:0,a.blockParams=i||0,a}function d(){return""}function p(t,e,n,r,o,s){if(t.decorator){var a={};e=t.decorator(e,a,n,r&&r[0],o,s,r),i.extend(e,a)}return e}},9613(t,e){function n(t){this.string=t}e.__esModule=!0,n.prototype.toString=n.prototype.toHTML=function(){return""+this.string},e.default=n,t.exports=e.default},2849(t,e){e.__esModule=!0,e.extend=s,e.indexOf=function(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1},e.escapeExpression=function(t){if("string"!=typeof t){if(t&&t.toHTML)return t.toHTML();if(null==t)return"";if(!t)return t+"";t=""+t}if(!i.test(t))return t;return t.replace(r,o)},e.isEmpty=function(t){return!t&&0!==t||!(!c(t)||0!==t.length)},e.createFrame=function(t){var e=s({},t);return e._parent=t,e},e.blockParams=function(t,e){return t.path=e,t},e.appendContextPath=function(t,e){return(t?t+".":"")+e};var n={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},r=/[&<>"'`=]/g,i=/[&<>"'`=]/;function o(t){return n[t]}function s(t){for(var e=1;e<arguments.length;e++)for(var n in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],n)&&(t[n]=arguments[e][n]);return t}var a=Object.prototype.toString;e.toString=a;var u=function(t){return"function"==typeof t};u(/x/)&&(e.isFunction=u=function(t){return"function"==typeof t&&"[object Function]"===a.call(t)}),e.isFunction=u;var c=Array.isArray||function(t){return!(!t||"object"!=typeof t)&&"[object Array]"===a.call(t)};e.isArray=c},251(t,e){e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,h=n?i-1:0,d=n?-1:1,p=t[e+h];for(h+=d,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+t[e+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+t[e+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=c}return(p?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(e*u-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+p]=255&a,p+=f,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[n+p]=255&s,p+=f,s/=256,c-=8);t[n+p-f]|=128*m}},6655(t){t.exports=void 0},4106(t,e){function n(t,e){var n=[],r=[];return null==e&&(e=function(t,e){return n[0]===e?"[Circular ~]":"[Circular ~."+r.slice(0,n.indexOf(e)).join(".")+"]"}),function(i,o){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?r.splice(s,1/0,i):r.push(i),~n.indexOf(o)&&(o=e.call(this,i,o))}else n.push(o);return null==t?o:t.call(this,i,o)}}(t.exports=function(t,e,r,i){return JSON.stringify(t,n(e,i),r)}).getSerialize=n},7799(t,e,n){t.exports=function(){var e,r,i,o,s,a="undefined"==typeof window?n.g:window,u="1.9.6",c=Date.now||function(){return(new Date).getTime()},l=c(),h="undefined"!=typeof performance&&performance.now?function(){return performance.now()}:function(){return c()-l},d=function(t){setTimeout(t,0)};function p(){}function f(t){return"function"==typeof t}function m(){this._orig=this,this._ready=!1,this._queue=[],this._log=[]}function g(t,e){this._bad?f(e)&&e.apply(this,[new Error(this._err())]):f(t)&&t.apply(this,[this])}function _(t,e){this._bad?t._crash(this._err()):setTimeout(function(){t._resume()},e)}function y(t){this._bad&&t._break(this._err()),t._resume()}function v(t,e,n){t[n]=function(){var t=arguments,r=e._image();return this._push(y,[r]),r[n].apply(r,t)}}function b(t){this._bad||f(t)&&t.apply(this)}function w(t){this._bad&&f(t)&&t.apply(this)}function x(t){this._bad?t._crash(this._err()):(this._break("Closed"),t._resume())}function T(t){if(t.length){var e=t.shift();if(t.length){var n=this;this._slip(w,[function(){T.apply(n,[t])}])}try{this._repair(),e.apply(this)}catch(t){this._break(t.toString())}}else this._break()}function k(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return;t.push(e)}function S(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return void t.splice(n,1)}function A(){m.apply(this)}function E(t,e){for(var n in t)t.hasOwnProperty(n)&&e.call(this,n)}function O(t,e,n){if(void 0===e)return O(t,[],[]);if(t instanceof Object){for(var r=0;r<e.length;r++)if(e[r]===t)return n[r];var i;return i=t instanceof Array?[]:{},e.push(t),n.push(i),E(t,function(r){i[r]=O(t[r],e,n)}),i}return t}m.prototype._exec=function(){for(;this._ready&&this._queue.length;){var t=this._queue.shift();t[0].apply(this,t[1])}},m.prototype._push=function(t,e){this._queue.push([t,e]),m.prototype._exec.apply(this)},m.prototype._slip=function(t,e){this._queue.unshift([t,e])},m.prototype._pause=function(){this._ready=!1},m.prototype._resume=function(){this._ready=!0,m.prototype._exec.apply(this)},m.prototype._break=function(t){this._orig._bad=!0,this._orig._log.push(t||"Unknown JZZ error")},m.prototype._repair=function(){this._orig._bad=!1},m.prototype._crash=function(t){this._break(t),this._resume()},m.prototype._err=function(){return this._log[this._log.length-1]},m.prototype.log=function(){return O(this._log)},m.prototype._dup=function(){var t=function(){};t.prototype=this._orig;var e=new t;return e._ready=!1,e._queue=[],e},m.prototype._image=function(){return this._dup()},m.prototype._thenable=function(){if(this.then)return this;var t=this,e=function(){};e.prototype=t;var n=new e;return n.then=function(e,n){return t._push(g,[e,n]),this},n},m.prototype.wait=function(t){if(!t)return this;var e=this._image();return this._push(_,[e,t]),e._thenable()},m.prototype.and=function(t){return this._push(b,[t]),this._thenable()},m.prototype.or=function(t){return this._push(w,[t]),this._thenable()},m.prototype._info={},m.prototype.info=function(){var t=O(this._orig._info);return void 0===t.engine&&(t.engine="none"),void 0===t.sysex&&(t.sysex=!0),t},m.prototype.name=function(){return this.info().name},m.prototype.close=function(){var t=new m;return this._close&&this._push(this._close,[]),this._push(x,[t]),t._thenable()},A.prototype=new m,A.prototype._info={name:"JZZ.js",ver:u,version:u,inputs:[],outputs:[]};var C,M=[],N=[],I=[],j=[],R={},P={};function D(){var t,e;for(C._info.engine=at._type,C._info.version=at._version,C._info.sysex=at._sysex,C._info.inputs=[],C._info.outputs=[],M=[],N=[],at._allOuts={},at._allIns={},t=0;t<at._outs.length;t++)e=at._outs[t],R[e.name]||(e.engine=at,at._allOuts[e.name]=e,C._info.outputs.push({id:e.name,name:e.name,manufacturer:e.manufacturer,version:e.version,engine:at._type}),M.push(e));for(t=0;t<ut._outs.length;t++)e=ut._outs[t],R[e.name]||(C._info.outputs.push({id:e.name,name:e.name,manufacturer:e.manufacturer,version:e.version,engine:e.type}),M.push(e));for(t=0;t<at._ins.length;t++)e=at._ins[t],P[e.name]||(e.engine=at,at._allIns[e.name]=e,C._info.inputs.push({id:e.name,name:e.name,manufacturer:e.manufacturer,version:e.version,engine:at._type}),N.push(e));for(t=0;t<ut._ins.length;t++)e=ut._ins[t],P[e.name]||(C._info.inputs.push({id:e.name,name:e.name,manufacturer:e.manufacturer,version:e.version,engine:e.type}),N.push(e));if(C._watcher&&C._watcher._handles.length){var n=rt(j,I,C._info.inputs,C._info.outputs);if(n){for(r=0;r<n.inputs.removed.length;r++)(e=at._inMap[n.inputs.removed[r].name])&&e._closeAll();for(r=0;r<n.outputs.removed.length;r++)(e=at._outMap[n.outputs.removed[r].name])&&e._closeAll();d(function(){it(n)})}}j=C._info.inputs,I=C._info.outputs}function L(){this._bad||at._refresh(this)}function F(t,e){var n,r;f(t)&&(t=t(e)),t instanceof Array||(t=[t]);var i=[],o=[],s=e.slice(),a=i;for(n=0;n<t.length;n++)if(void 0===t[n])a=o;else if(t[n]instanceof RegExp)for(r=0;r<s.length;r++)t[n].test(s[r].name)&&(a.push(s[r]),s.splice(r,1),r--);else for(r=0;r<s.length;r++)(t[n]+""==r+""||t[n]===s[r].name||t[n]instanceof Object&&t[n].name===s[r].name)&&(a.push(s[r]),s.splice(r,1),r--);return a==i?i:i.concat(s).concat(o)}function $(t,e){var n;n=e instanceof RegExp?"Port matching "+e+" not found":e instanceof Object||void 0===e?"Port not found":'Port "'+e+'" not found',t._crash(n)}function B(t,e){if(this._bad)t._crash(this._err());else{var n=F(e,M);if(!n.length)return void $(t,e);for(var r=function(t){return function(){t.engine._openOut(this,t.name)}},i=0;i<n.length;i++)n[i]=r(n[i]);t._slip(T,[n]),t._resume()}}function q(t,e){if(this._bad)t._crash(this._err());else{var n=F(e,N);if(!n.length)return void $(t,e);for(var r=function(t){return function(){t.engine._openIn(this,t.name)}},i=0;i<n.length;i++)n[i]=r(n[i]);t._slip(T,[n]),t._resume()}}function U(t,e){this._bad?t._crash():(t._slip(tt,[e]),t._resume())}function V(){m.apply(this),this._handles=[],this._outs=[]}function G(t){this._bad||this._receive(t)}function z(t){return t.isMidi2?new Xe(t):Pt.apply(null,arguments)}function W(t){this._emit(t)}function J(t){f(t)?k(this._orig._handles,t):k(this._orig._outs,t)}function H(t){void 0===t?(this._orig._handles=[],this._orig._outs=[]):f(t)?S(this._orig._handles,t):S(this._orig._outs,t)}function X(t,e){this._orig._mpe||(this._orig._mpe=new He),this._orig._mpe.setup(t,e)}function K(t){if(t!=parseInt(t)||t<0||t>15)throw RangeError("Bad channel value (must not be less than 0 or more than 15): "+t)}function Q(t){m.apply(this),this._sink=t}function Z(t){return t.isMidi&&!t.isMidi2?new Pt(t):Xe.apply(null,arguments)}function Y(){m.apply(this),this._handles=[],v(this,C,"refresh"),v(this,C,"openMidiOut"),v(this,C,"openMidiIn"),v(this,C,"onChange"),v(this,C,"close")}function tt(t){f(t)&&(this._orig._handles.length||at._watch(),k(this._orig._handles,t))}function et(t){void 0===t?this._orig._handles=[]:S(this._orig._handles,t),this._orig._handles.length||at._unwatch()}function nt(t,e,n,r){var i;if(t.length!=n.length||e.length!=r.length)return!0;for(i=0;i<t.length;i++)if(t[i].name!=n[i].name)return!0;for(i=0;i<e.length;i++)if(e[i].name!=r[i].name)return!0;return!1}function rt(t,e,n,r){if(nt(t,e,n,r)){var i,o=[],s=[],a=[],u=[],c={};for(i=0;i<t.length;i++)c[t[i].name]=!0;for(i=0;i<n.length;i++)c[n[i].name]||o.push(n[i]);for(c={},i=0;i<n.length;i++)c[n[i].name]=!0;for(i=0;i<t.length;i++)c[t[i].name]||a.push(t[i]);for(c={},i=0;i<e.length;i++)c[e[i].name]=!0;for(i=0;i<r.length;i++)c[r[i].name]||s.push(r[i]);for(c={},i=0;i<r.length;i++)c[r[i].name]=!0;for(i=0;i<e.length;i++)c[e[i].name]||u.push(e[i]);return{inputs:{added:o,removed:a},outputs:{added:s,removed:u}}}}function it(t){for(e=0;e<C._watcher._handles.length;e++)C._watcher._handles[e].apply(C,[t])}A.prototype.refresh=function(){return this._push(L,[]),this._thenable()},A.prototype.openMidiOut=function(t){var e=new V;return this._push(L,[]),this._push(B,[e,t]),e._thenable()},A.prototype._openMidiOutNR=function(t){var e=new V;return this._push(B,[e,t]),e._thenable()},A.prototype.openMidiIn=function(t){var e=new V;return this._push(L,[]),this._push(q,[e,t]),e._thenable()},A.prototype._openMidiInNR=function(t){var e=new V;return this._push(q,[e,t]),e._thenable()},A.prototype.onChange=function(t){this._orig._watcher||(this._orig._watcher=new Y);var e=this._orig._watcher._image();return this._push(U,[e,t]),e._thenable()},A.prototype._close=function(){at._close();for(var t=ct.slice(),e=0;e<t.length;e++)t[e]&&(t[e]._close?t[e]._close():t[e].close&&t[e].close())},V.prototype=new m,V.prototype._filter=function(t){if(this._orig._mpe){var e,n=0;this._handles&&this._handles.length&&(n=this._handles.length,e=this._handles[0]),this._outs&&this._outs.length&&(n=this._outs.length,e=this._outs[0]),1!=n||e._mpe||(t=this._orig._mpe.filter(t))}return t},V.prototype._receive=function(t){this._emit(this._filter(t))},V.prototype.send=function(){return this._push(G,[z.apply(null,arguments)]),this._thenable()},V.prototype.note=function(t,e,n,r){return this.noteOn(t,e,n),void 0===this._ch&&void 0===this._master?r>0&&this.wait(r).noteOff(t,e):n>0&&this.wait(n).noteOff(t),this._thenable()},V.prototype._emit=function(t){var e,n;for(e=0;e<this._handles.length;e++)n=z(t),this._handles[e].apply(this,[n._stamp(this)]);for(e=0;e<this._outs.length;e++)(n=z(t))._stamped(this._outs[e])||this._outs[e].send(n._stamp(this))},V.prototype.emit=function(t){return this._push(W,[t]),this._thenable()},V.prototype.connect=function(t){return this._push(J,[t]),this._thenable()},V.prototype.disconnect=function(t){return this._push(H,[t]),this._thenable()},V.prototype.connected=function(){return this._orig._handles.length+this._orig._outs.length},V.prototype._image=function(){var t=this._dup();return t._gr=this._gr,t._ch=this._ch,t._sxid=this._sxid,t._master=this._master,t._band=this._band,t},V.prototype._sxid=127,V.prototype.sxId=function(t){if(void 0===t&&(t=V.prototype._sxid),t==this._sxid)return this._thenable();t=zt(t);var e=this._image();return e._sxid=t,this._push(y,[e]),e._thenable()},V.prototype.ch=function(t){if(t==this._ch||void 0===t&&void 0===this._ch)return this._thenable();var e=this._image();return void 0!==t&&(t=Vt(t)),e._ch=t,e._master=void 0,e._band=void 0,this._push(y,[e]),e._thenable()},V.prototype.MIDI1=function(){var t=this._image();return t._ch=void 0,t._sxid=V.prototype._sxid,t._master=void 0,t._band=void 0,this._push(y,[t]),t._thenable()},V.prototype.MIDI2=function(){var t=this._image();t._ch=void 0,t._sxid=V.prototype._sxid,t._master=void 0,t._band=void 0;var e=new Q(t);return this._push(y,[e]),e._thenable()},V.prototype.mpe=function(t,e){if(t==this._master&&e==this._band||void 0===t&&void 0===this._master)return this._thenable();if(void 0!==t&&He.validate(t,e),!e)return this.ch(t);var n=this._image();return n._ch=void 0,n._master=t,n._band=e,this._push(X,[t,e]),this._push(y,[n]),n._thenable()},Q.prototype=new m,Q.prototype._sxid=V.prototype._sxid,Q.prototype._receive=function(t){this._sink._receive(t)},Q.prototype.send=function(){return this._push(G,[Z.apply(null,arguments)]),this._thenable()},Q.prototype._image=V.prototype._image,Q.prototype.connect=function(t){return this._sink.connect(t),this._push(y,[this._sink]),this._thenable()},Q.prototype.disconnect=function(t){return this._sink.disconnect(t),this._push(y,[this._sink]),this._thenable()},Q.prototype.connected=function(){return this._sink.connected()},Q.prototype.sxId=V.prototype.sxId,Q.prototype.ch=V.prototype.ch,Q.prototype.gr=function(t){if(t==this._gr||void 0===t&&void 0===this._gr)return this._thenable();var e=this._image();return void 0!==t&&(t=zt(t)),e._gr=t,this._push(y,[e]),e._thenable()},Q.prototype.MIDI1=function(){var t=this._sink._image();return this._push(y,[t]),t._thenable()},Q.prototype.MIDI2=function(){var t=this._image();return t._gr=void 0,t._ch=void 0,t._sxid=V.prototype._sxid,this._push(y,[t]),t._thenable()},Y.prototype=new m,Y.prototype.connect=function(t){return this._push(tt,[t]),this._thenable()},Y.prototype.disconnect=function(t){return this._push(et,[t]),this._thenable()};var ot,st,at={_outs:[],_ins:[],_close:p},ut={_outs:[],_ins:[]},ct=[];function lt(){if(t.exports){var e=n(6655);if(e)return void xt(e)}this._break()}function ht(){var t=document.createElement("div");t.style.visibility="hidden",document.body.appendChild(t);var e=document.createElement("object");e.style.visibility="hidden",e.style.width="0px",e.style.height="0px",e.classid="CLSID:1ACE1618-1C7D-4561-AEE1-34842AA85E90",e.type="audio/x-jazz",document.body.appendChild(e),e.isJazz?Tt(e):this._break()}function dt(){if("undefined"!=typeof navigator&&navigator.requestMIDIAccess){ot=navigator,st=navigator.requestMIDIAccess;try{-1!=st.toString().indexOf("JZZ(")&&(st=void 0)}catch(t){}}}function pt(){if(dt(),st){var t=this,e=function(e){kt(e),t._resume()},n=function(e){t._crash(e)},r={};return st.call(ot,r).then(e,n),void this._pause()}this._break()}function ft(){if(dt(),st){var t=this,e=function(e){kt(e,!0),t._resume()},n=function(e){t._crash(e)},r={sysex:!0};return st.call(ot,r).then(e,n),void this._pause()}this._break()}function mt(){var t,e,n=this;function r(i){t=!0;var o=i.detail;if(!o){if(e||(e=document.getElementById("jazz-midi-msg")),!e)return;try{o=JSON.parse(e.innerText)}catch(t){}e.innerText=""}document.removeEventListener("jazz-midi-msg",r),o&&"version"===o[0]?(St(e,o[2]),n._resume()):n._crash()}this._pause();try{document.addEventListener("jazz-midi-msg",r),document.dispatchEvent(new Event("jazz-midi"))}catch(t){}setTimeout(function(){t||n._crash()},50)}function gt(){this._pause();var t=this;d(function(){t._crash()})}function _t(t){for(var e=[],n=yt(t),r=0;r<n.length;r++)"webmidi"==n[r]?(t&&!0===t.sysex&&e.push(ft),t&&!0===t.sysex&&!0!==t.degrade||e.push(pt)):"node"==n[r]?(e.push(lt),e.push(gt)):"extension"==n[r]?e.push(mt):"plugin"==n[r]&&e.push(ht);return e.push(bt),e}function yt(t){var e=["node","extension","plugin","webmidi"];if(!t||!t.engine)return e;var n,r,i,o=t.engine instanceof Array?t.engine:[t.engine],s={},a=[],u=[];for(i=0;i<o.length;i++){var c=o[i].toString().toLowerCase();s[c]||(s[c]=!0,"none"===c&&(n=!0),"etc"!==c&&void 0!==c||(r=!0),r?u.push(c):a.push(c),S(e,c))}return(r||a.length||u.length)&&(n=!1),n?[]:a.concat(r?e:u)}function vt(t){(C=new A)._options=t,C._push(T,[_t(t)]),C.refresh(),C._resume()}function bt(){at._type="none",at._version=u,at._sysex=!0,at._outs=[],at._ins=[],at._outMap={},at._inMap={},at._refresh=function(){D()},at._watch=p,at._unwatch=p,at._close=p}function wt(){var t;function e(){for(var t=0;t<this.clients.length;t++)this._close(this.clients[t])}at._inArr=[],at._outArr=[],at._inMap={},at._outMap={},at._outsW=[],at._insW=[],at._version=at._main.version,at._sysex=!0,at._refresh=function(){var t,e;for(at._outs=[],at._ins=[],t=0;(e=at._main.MidiOutInfo(t)).length;t++)at._outs.push({type:at._type,name:e[0],manufacturer:e[1],version:e[2]});for(t=0;(e=at._main.MidiInInfo(t)).length;t++)at._ins.push({type:at._type,name:e[0],manufacturer:e[1],version:e[2]});D()},at._openOut=function(t,n){var r=at._outMap[n];if(!r){at._pool.length<=at._outArr.length&&at._pool.push(at._newPlugin()),r={name:n,clients:[],info:{name:n,manufacturer:at._allOuts[n].manufacturer,version:at._allOuts[n].version,type:"MIDI-out",sysex:at._sysex,engine:at._type},_close:function(t){at._closeOut(t)},_closeAll:e,_receive:function(t){t.length&&this.plugin.MidiOutRaw(t.slice())}};var i=at._pool[at._outArr.length];r.plugin=i,at._outArr.push(r),at._outMap[n]=r}if(!r.open){var o=r.plugin.MidiOutOpen(n);if(o!==n)return o&&r.plugin.MidiOutClose(),void t._break();r.open=!0}t._orig._impl=r,k(r.clients,t._orig),t._info=r.info,t._receive=function(t){r._receive(t)},t._close=function(){r._close(this)}},at._openIn=function(t,n){var r=at._inMap[n];if(!r){at._pool.length<=at._inArr.length&&at._pool.push(at._newPlugin()),r={name:n,clients:[],info:{name:n,manufacturer:at._allIns[n].manufacturer,version:at._allIns[n].version,type:"MIDI-in",sysex:at._sysex,engine:at._type},_close:function(t){at._closeIn(t)},_closeAll:e,handle:function(t,e){for(var n=0;n<this.clients.length;n++){var r=Pt(e);this.clients[n]._emit(r)}}};var i=function(t){return function(e,n){t.handle(e,n)}};r.onmidi=i(r);var o=at._pool[at._inArr.length];r.plugin=o,at._inArr.push(r),at._inMap[n]=r}if(!r.open){var s=r.plugin.MidiInOpen(n,r.onmidi);if(s!==n)return s&&r.plugin.MidiInClose(),void t._break();r.open=!0}t._orig._impl=r,k(r.clients,t._orig),t._info=r.info,t._close=function(){r._close(this)}},at._closeOut=function(t){var e=t._impl;S(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,e.plugin.MidiOutClose())},at._closeIn=function(t){var e=t._impl;S(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,e.plugin.MidiInClose())},at._close=function(){for(var t=0;t<at._inArr.length;t++)at._inArr[t].open&&at._inArr[t].plugin.MidiInClose();at._unwatch()},at._watch=function(){t||(t=setInterval(function(){at._refresh()},250))},at._unwatch=function(){t&&clearInterval(t),t=void 0}}function xt(t){at._type="node",at._main=t,at._pool=[],at._newPlugin=function(){return new t.MIDI},wt()}function Tt(t){at._type="plugin",at._main=t,at._pool=[t],at._newPlugin=function(){var e=document.createElement("object");return e.style.visibility="hidden",e.style.width="0px",t.style.height="0px",e.classid="CLSID:1ACE1618-1C7D-4561-AEE1-34842AA85E90",e.type="audio/x-jazz",document.body.appendChild(e),e.isJazz?e:void 0},wt()}function kt(t,e){var n;function r(){for(var t=0;t<this.clients.length;t++)this._close(this.clients[t])}at._type="webmidi",at._version=43,at._sysex=!!e,at._access=t,at._inMap={},at._outMap={},at._outsW=[],at._insW=[],at._refresh=function(){at._outs=[],at._ins=[],at._access.outputs.forEach(function(t){at._outs.push({type:at._type,name:t.name,manufacturer:t.manufacturer,version:t.version})}),at._access.inputs.forEach(function(t){at._ins.push({type:at._type,name:t.name,manufacturer:t.manufacturer,version:t.version})}),D()},at._openOut=function(t,e){var n,i=at._outMap[e];i||(i={name:e,clients:[],info:{name:e,manufacturer:at._allOuts[e].manufacturer,version:at._allOuts[e].version,type:"MIDI-out",sysex:at._sysex,engine:at._type},_close:function(t){at._closeOut(t)},_closeAll:r,_receive:function(t){i.dev&&t.length&&this.dev.send(t.slice())}}),at._access.outputs.forEach(function(t){t.name===e&&(n=t)}),n?(i.dev=n,at._outMap[e]=i,t._orig._impl=i,k(i.clients,t._orig),t._info=i.info,t._receive=function(t){i._receive(t)},t._close=function(){i._close(this)},i.dev.open&&(t._pause(),i.dev.open().then(function(){t._resume()},function(){t._crash()}))):t._break()},at._openIn=function(t,e){var n,i=at._inMap[e];if(i||(i={name:e,clients:[],info:{name:e,manufacturer:at._allIns[e].manufacturer,version:at._allIns[e].version,type:"MIDI-in",sysex:at._sysex,engine:at._type},_close:function(t){at._closeIn(t)},_closeAll:r,handle:function(t){for(var e=0;e<this.clients.length;e++){var n=Pt([].slice.call(t.data));this.clients[e]._emit(n)}}}),at._access.inputs.forEach(function(t){t.name===e&&(n=t)}),n){i.dev=n;var o=function(t){return function(e){t.handle(e)}};i.dev.onmidimessage=o(i),at._inMap[e]=i,t._orig._impl=i,k(i.clients,t._orig),t._info=i.info,t._close=function(){i._close(this)},i.dev.open&&(t._pause(),i.dev.open().then(function(){t._resume()},function(){t._crash()}))}else t._break()},at._closeOut=function(t){var e=t._impl;S(e.clients,t._orig),e.clients.length||(e.dev&&e.dev.close&&e.dev.close(),e.dev=void 0)},at._closeIn=function(t){var e=t._impl;S(e.clients,t._orig),e.clients.length||(e.dev&&(e.dev.onmidimessage=null,e.dev.close&&e.dev.close()),e.dev=void 0)},at._close=function(){at._unwatch()},at._watch=function(){at._access.onstatechange=function(){n=!0,d(function(){n&&(at._refresh(),n=!1)})}},at._unwatch=function(){at._access.onstatechange=void 0}}function St(t,e){function n(){for(var t=0;t<this.clients.length;t++)this._close(this.clients[t])}var r;at._type="extension",at._version=e,at._sysex=!0,at._pool=[],at._outs=[],at._ins=[],at._inArr=[],at._outArr=[],at._inMap={},at._outMap={},at._outsW=[],at._insW=[],at.refreshClients=[],at._msg=t,at._newPlugin=function(){var t={id:at._pool.length};at._pool.push(t),t.id?document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["new"]})):t.ready=!0},at._newPlugin(),at._refresh=function(t){at.refreshClients.push(t),t._pause(),d(function(){document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["refresh"]}))})},at._openOut=function(t,e){var r=at._outMap[e];if(!r){at._pool.length<=at._outArr.length&&at._newPlugin();var i=at._pool[at._outArr.length];r={name:e,clients:[],info:{name:e,manufacturer:at._allOuts[e].manufacturer,version:at._allOuts[e].version,type:"MIDI-out",sysex:at._sysex,engine:at._type},_start:function(){document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["openout",i.id,e]}))},_close:function(t){at._closeOut(t)},_closeAll:n,_receive:function(t){if(t.length){var e=t.slice();e.splice(0,0,"play",i.id),document.dispatchEvent(new CustomEvent("jazz-midi",{detail:e}))}}},r.plugin=i,i.output=r,at._outArr.push(r),at._outMap[e]=r}t._orig._impl=r,k(r.clients,t._orig),t._info=r.info,t._receive=function(t){r._receive(t)},t._close=function(){r._close(this)},r.open||(t._pause(),r.plugin.ready&&r._start())},at._openIn=function(t,e){var r=at._inMap[e];if(!r){at._pool.length<=at._inArr.length&&at._newPlugin();var i=at._pool[at._inArr.length];r={name:e,clients:[],info:{name:e,manufacturer:at._allIns[e].manufacturer,version:at._allIns[e].version,type:"MIDI-in",sysex:at._sysex,engine:at._type},_start:function(){document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["openin",i.id,e]}))},_close:function(t){at._closeIn(t)},_closeAll:n},r.plugin=i,i.input=r,at._inArr.push(r),at._inMap[e]=r}t._orig._impl=r,k(r.clients,t._orig),t._info=r.info,t._close=function(){r._close(this)},r.open||(t._pause(),r.plugin.ready&&r._start())},at._closeOut=function(t){var e=t._impl;S(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["closeout",e.plugin.id]})))},at._closeIn=function(t){var e=t._impl;S(e.clients,t._orig),!e.clients.length&&e.open&&(e.open=!1,document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["closein",e.plugin.id]})))},at._close=function(){at._unwatch()},at._watch=function(){at._insW=at._ins,at._outsW=at._outs,r=setInterval(function(){document.dispatchEvent(new CustomEvent("jazz-midi",{detail:["refresh"]}))},250)},at._unwatch=function(){clearInterval(r),r=void 0},document.addEventListener("jazz-midi-msg",function(t){var e,n,r,i=t.detail?[t.detail]:void 0;if(!i)for(i=at._msg.innerText.split("\n"),at._msg.innerText="",e=0;e<i.length;e++)try{i[e]=JSON.parse(i[e])}catch(t){i[e]=[]}for(e=0;e<i.length;e++){var o=i[e];if(o.length)if("refresh"===o[0]){if(o[1].ins){for(n=0;n<o[1].ins.length;n++)o[1].ins[n].type=at._type;at._ins=o[1].ins}if(o[1].outs){for(n=0;n<o[1].outs.length;n++)o[1].outs[n].type=at._type;at._outs=o[1].outs}for(D(),n=0;n<at.refreshClients.length;n++)at.refreshClients[n]._resume();at.refreshClients=[]}else if("version"===o[0]){var s=at._pool[o[1]];s&&(s.ready=!0,s.input&&s.input._start(),s.output&&s.output._start())}else if("openout"===o[0]){if(r=at._pool[o[1]].output)if(o[2]==r.name){if(r.open=!0,r.clients)for(n=0;n<r.clients.length;n++)r.clients[n]._resume()}else if(r.clients)for(n=0;n<r.clients.length;n++)r.clients[n]._crash()}else if("openin"===o[0]){if(r=at._pool[o[1]].input)if(o[2]==r.name){if(r.open=!0,r.clients)for(n=0;n<r.clients.length;n++)r.clients[n]._resume()}else if(r.clients)for(n=0;n<r.clients.length;n++)r.clients[n]._crash()}else if("midi"===o[0]&&(r=at._pool[o[1]].input)&&r.clients)for(n=0;n<r.clients.length;n++){var a=Pt(o.slice(3));r.clients[n]._emit(a)}}})}var At=function(t){return C||vt(t),C._thenable()};function Et(t){var e=new V;return t instanceof Object&&E(t,function(n){e[n]=t[n]}),e._resume(),e}function Ot(){var t=this instanceof Ot?this:t=new Ot;return Ot.prototype.reset.apply(t,arguments),t}function Ct(){29.97==this.type&&!this.second&&this.frame<2&&this.minute%10&&(this.frame=2)}function Mt(t){return[[24,25,29.97,30][t[7]>>1&3],(1&t[7])<<4|t[6],t[5]<<4|t[4],t[3]<<4|t[2],t[1]<<4|t[0]]}function Nt(t){var e;switch(!t.backwards&&t.quarter>=4?t.decrFrame():t.backwards&&t.quarter<4&&t.incrFrame(),t.quarter>>1){case 0:e=t.frame;break;case 1:e=t.second;break;case 2:e=t.minute;break;default:e=t.hour}return 1&t.quarter?e>>=4:e&=15,7==t.quarter&&(25==t.type?e|=2:29.97==t.type?e|=4:30==t.type&&(e|=6)),!t.backwards&&t.quarter>=4?t.incrFrame():t.backwards&&t.quarter<4&&t.decrFrame(),e|t.quarter<<4}function It(t){return 25==t.type?32|t.hour:29.97==t.type?64|t.hour:30==t.type?96|t.hour:t.hour}function jt(t){return t<10?"0"+t:t}function Rt(t){for(var e=[],n=0;n<t.length;n++)e[n]=jt(n?t[n]:31&t[n]);return e.join(":")}function Pt(t){var e,n=this instanceof Pt?this:n=new Pt;if(t instanceof Pt)return n._from=t._from.slice(),E(t,function(e){"_from"!=e&&(n[e]=t[e])}),n;if(n._from=[],void 0===t)return n;var r=t instanceof Array?t:arguments;for(e=0;e<r.length;e++)s=r[e],1==e&&(n[0]>=128&&n[0]<=175&&(s=Pt.noteValue(s)),n[0]>=192&&n[0]<=207&&(s=Pt.programValue(s))),(s!=parseInt(s)||s<0||s>255)&&Bt(r[e]),n.push(s);return n}At.JZZ=At,At.version=u,At.info=function(){return A.prototype.info()},At.Widget=Et,A.prototype.Widget=At.Widget,At.addMidiIn=function(t,e){var n=O(e._info||{});n.name=t,n.type=n.type||"javascript",n.manufacturer=n.manufacturer||"virtual",n.version=n.version||"0.0";var r={_info:function(){return n},_openIn:function(t){t._pause(),t._info=O(n),t._close=function(){e.disconnect(t)},e.connect(t),t._resume()}};return At.lib.registerMidiIn(t,r)},A.prototype.addMidiIn=At.addMidiIn,At.addMidiOut=function(t,e){var n=O(e._info||{});n.name=t,n.type=n.type||"javascript",n.manufacturer=n.manufacturer||"virtual",n.version=n.version||"0.0";var r={_info:function(){return n},_openOut:function(t){t._pause(),t._info=O(n),t._close=function(){t.disconnect()},J.apply(t,[e]),t._resume()}};return At.lib.registerMidiOut(t,r)},A.prototype.addMidiOut=At.addMidiOut,At.removeMidiOut=function(t){return At.lib.unregisterMidiOut(t)},A.prototype.removeMidiOut=At.removeMidiOut,At.removeMidiIn=function(t){return At.lib.unregisterMidiIn(t)},A.prototype.removeMidiIn=At.removeMidiIn,At.maskMidiIn=function(t){P[t]=!0},A.prototype.maskMidiIn=At.maskMidiIn,At.unmaskMidiIn=function(t){delete P[t]},A.prototype.unmaskMidiIn=At.unmaskMidiIn,At.maskMidiOut=function(t){R[t]=!0},A.prototype.maskMidiOut=At.maskMidiOut,At.unmaskMidiOut=function(t){delete R[t]},A.prototype.unmaskMidiOut=At.unmaskMidiOut,Ot.prototype.reset=function(t){if(t instanceof Ot)return this.setType(t.getType()),this.setHour(t.getHour()),this.setMinute(t.getMinute()),this.setSecond(t.getSecond()),this.setFrame(t.getFrame()),this.setQuarter(t.getQuarter()),this;var e=t instanceof Array?t:arguments;return this.setType(e[0]),this.setHour(e[1]),this.setMinute(e[2]),this.setSecond(e[3]),this.setFrame(e[4]),this.setQuarter(e[5]),this},Ot.prototype.isFullFrame=function(){return 0==this.quarter||4==this.quarter},Ot.prototype.getType=function(){return this.type},Ot.prototype.getHour=function(){return this.hour},Ot.prototype.getMinute=function(){return this.minute},Ot.prototype.getSecond=function(){return this.second},Ot.prototype.getFrame=function(){return this.frame},Ot.prototype.getQuarter=function(){return this.quarter},Ot.prototype.setType=function(t){if(void 0===t||24==t)this.type=24;else if(25==t)this.type=25;else if(29.97==t)this.type=29.97,Ct.apply(this);else{if(30!=t)throw RangeError("Bad SMPTE frame rate: "+t);this.type=30}return this.frame>=this.type&&(this.frame=this.type-1),this},Ot.prototype.setHour=function(t){if(void 0===t&&(t=0),t!=parseInt(t)||t<0||t>=24)throw RangeError("Bad SMPTE hours value: "+t);return this.hour=t,this},Ot.prototype.setMinute=function(t){if(void 0===t&&(t=0),t!=parseInt(t)||t<0||t>=60)throw RangeError("Bad SMPTE minutes value: "+t);return this.minute=t,Ct.apply(this),this},Ot.prototype.setSecond=function(t){if(void 0===t&&(t=0),t!=parseInt(t)||t<0||t>=60)throw RangeError("Bad SMPTE seconds value: "+t);return this.second=t,Ct.apply(this),this},Ot.prototype.setFrame=function(t){if(void 0===t&&(t=0),t!=parseInt(t)||t<0||t>=this.type)throw RangeError("Bad SMPTE frame number: "+t);return this.frame=t,Ct.apply(this),this},Ot.prototype.setQuarter=function(t){if(void 0===t&&(t=0),t!=parseInt(t)||t<0||t>=8)throw RangeError("Bad SMPTE quarter frame: "+t);return this.quarter=t,this},Ot.prototype.incrFrame=function(){return this.frame++,this.frame>=this.type&&(this.frame=0,this.second++,this.second>=60&&(this.second=0,this.minute++,this.minute>=60&&(this.minute=0,this.hour=this.hour>=23?0:this.hour+1))),Ct.apply(this),this},Ot.prototype.decrFrame=function(){return!this.second&&2==this.frame&&29.97==this.type&&this.minute%10&&(this.frame=0),this.frame--,this.frame<0&&(this.frame=29.97==this.type?29:this.type-1,this.second--,this.second<0&&(this.second=59,this.minute--,this.minute<0&&(this.minute=59,this.hour=this.hour?this.hour-1:23))),this},Ot.prototype.incrQF=function(){return this.backwards=!1,this.quarter=this.quarter+1&7,0!=this.quarter&&4!=this.quarter||this.incrFrame(),this},Ot.prototype.decrQF=function(){return this.backwards=!0,this.quarter=this.quarter+7&7,3!=this.quarter&&7!=this.quarter||this.decrFrame(),this},Ot.prototype.read=function(t){if(t instanceof Pt||(t=Pt.apply(null,arguments)),240==t[0]&&127==t[1]&&1==t[3]&&1==t[4]&&247==t[9])return this.type=[24,25,29.97,30][t[5]>>5&3],this.hour=31&t[5],this.minute=t[6],this.second=t[7],this.frame=t[8],this.quarter=0,this._=void 0,this._b=void 0,this._f=void 0,!0;if(241==t[0]&&void 0!==t[1]){var e=t[1]>>4,n=15&t[1];return 0==e?7==this._&&(7==this._f&&(this.reset(Mt(this._a)),this.incrFrame()),this.incrFrame()):3==e?4==this._&&this.decrFrame():4==e?3==this._&&this.incrFrame():7==e&&0===this._&&(0===this._b&&(this.reset(Mt(this._a)),this.decrFrame()),this.decrFrame()),this._a||(this._a=[]),this._a[e]=n,this._f=this._f===e-1||0==e?e:void 0,this._b=this._b===e+1||7==e?e:void 0,this._=e,this.quarter=e,!0}return!1},Ot.prototype.toString=function(){return Rt([this.hour,this.minute,this.second,this.frame])},At.SMPTE=Ot,A.prototype.SMPTE=Ot,Pt.prototype=[],Pt.prototype.constructor=Pt,Pt.prototype.isMidi=function(){return 1};var Dt={};function Lt(t){if(t!=parseFloat(t))throw TypeError("Not a number: "+t)}function Ft(){}Pt.noteValue=function(t){return void 0===t?void 0:Dt[t.toString().toLowerCase()]},Pt.programValue=function(t){return t},Pt.octaveValue=function(t){var e=Dt[t.toString().toLowerCase()];return void 0===e&&(e=Dt[t.toString().toLowerCase()+"1"]),void 0===e?void 0:e%12},Pt.freq=function(t,e){return void 0===e&&(e=440),Lt(e),t!=parseFloat(t)&&(t=Zt(t)),e*Math.pow(2,(t-69)/12)},Pt.shift=function(t,e){return void 0===e&&(e=440),Lt(t),Lt(e),12*Math.log2(t/e)},Pt.midi=function(t,e){return t!=parseFloat(t)?Zt(t):Pt.shift(t,e)+69},Pt.to7b=function(t){return Lt(t),t<=0?0:t>=1?127:Math.floor(128*t)},Pt.to14b=function(t){return Lt(t),t<=0?0:t>=1?16383:Math.floor(16384*t)},Pt.to21b=function(t){return void 0===t?2097151:(Lt(t),t<=0?0:(t=(Math.floor(t)<<14)+Pt.to14b(t-Math.floor(t)))<2097151?t:2097150)},Pt.to32b=function(t){return Lt(t),t<=0?0:t>=1?4294967295:Math.floor(4294967296*t)},Ft.prototype=Pt,Pt._sxid=127,Pt.sxId=function(t){if(void 0===t&&(t=Pt._sxid),t==this._sxid)return this;t=zt(t);var e=new Ft;return e._ch=this._ch,e._sxid=t,e},Pt.ch=function(t){if(t==this._ch||void 0===t&&void 0===this._ch)return this;var e=new Ft;return void 0!==t&&(t=Vt(t)),e._ch=t,e._sxid=this._sxid,e};var $t={c:0,d:2,e:4,f:5,g:7,a:9,b:11,h:11};for(E($t,function(t){for(s=0;s<12&&!((o=$t[t]+12*s)>127);s++)Dt[t+s]=o,Dt[t+"♮"+s]=o,o>0&&(Dt[t+"b"+s]=o-1,Dt[t+"♭"+s]=o-1,Dt[t+"bb"+s]=o-2,Dt[t+"♭♭"+s]=o-2,Dt[t+"𝄫"+s]=o-2),o<127&&(Dt[t+"#"+s]=o+1,Dt[t+"♯"+s]=o+1,Dt[t+"##"+s]=o+2,Dt[t+"♯♯"+s]=o+2,Dt[t+"𝄪"+s]=o+2)}),s=0;s<128;s++)Dt[s]=s;function Bt(t){throw RangeError("Bad MIDI value: "+t)}function qt(t){throw TypeError("Invalid value: "+t)}function Ut(t){throw RangeError("Out of range: "+t)}function Vt(t){return K(t),parseInt(t)}function Gt(t){if(t!=parseInt(t)||t<0||t>15)throw RangeError("Expected a 4-bit value: "+t);return parseInt(t)}function zt(t,e){return(t!=parseInt(t)||t<0||t>127)&&Bt(void 0===e?t:e),parseInt(t)}function Wt(t){return(t!=parseInt(t)||t<0||t>255)&&Bt(t),parseInt(t)}function Jt(t){return(t!=parseInt(t)||t<0||t>16383)&&Bt(t),parseInt(t)}function Ht(t){if(t!=parseInt(t)||t<0||t>65535)throw RangeError("Expected a 16-bit value: "+t);return parseInt(t)}function Xt(t){if(t!=parseInt(t)||t<0||t>1048575)throw RangeError("Expected a 20-bit value: "+t);return parseInt(t)}function Kt(t){return(t!=parseInt(t)||t<0||t>2097151)&&Bt(t),parseInt(t)}function Qt(t){return(t!=parseInt(t)||t<0||t>4294967295)&&Bt(t),parseInt(t)}function Zt(t){return zt(Pt.noteValue(t),t)}function Yt(t){return 127&Jt(t)}function te(t){return Jt(t)>>7}function ee(t){t=""+t;for(var e=0;e<t.length;e++)t.charCodeAt(e)>255&&Bt(t[e]);return t}function ne(t){return[t>>14,t>>7&127,127&t]}function re(t,e){return t!=parseFloat(t)&&qt(void 0===e?t:e),(t<0||t>1)&&Ut(void 0===e?t:e),parseFloat(t)}function ie(t){return void 0===t||t?127:126}function oe(t){var e,n,r=[],i={};E(t,function(e){if(n=Kt(t[e]),(e=Zt(e))in i)throw RangeError("Duplicate MIDI value: "+e);r.push(e),i[e]=n}),r.sort();var o=[r.length];for(e=0;e<r.length;e++)o=o.concat([r[e]],ne(i[r[e]]));return o}function se(t){var e={};return E(t,function(n){e[n]=Pt.to21b(t[n]==parseFloat(t[n])?t[n]:Zt(t[n]))}),e}function ae(t){var e={};return E(t,function(n){e[n]=Pt.to21b(Pt.midi(t[n]))}),e}function ue(t){var e=[];if(!(t instanceof Array)||12!=t.length)throw TypeError("Expected an array of size 12");for(var n=0;n<12;n++)e.push(zt(t[n]));return e}function ce(t){var e=[];if(!(t instanceof Array)||12!=t.length)throw TypeError("Expected an array of size 12");for(var n=0;n<12;n++)e.push(te(t[n])),e.push(Yt(t[n]));return e}var le={noteOff:function(t,e,n){return void 0===n&&(n=64),[128+Vt(t),Zt(e),zt(n)]},noteOn:function(t,e,n){return void 0===n&&(n=127),[144+Vt(t),Zt(e),zt(n)]},aftertouch:function(t,e,n){return[160+Vt(t),Zt(e),zt(n)]}},he={control:function(t,e,n){return[176+Vt(t),zt(e),zt(n)]},program:function(t,e){return[192+Vt(t),zt(Pt.programValue(e),e)]},pressure:function(t,e){return[208+Vt(t),zt(e)]},pitchBend:function(t,e,n){return void 0===n?[224+Vt(t),Yt(e),te(e)]:[224+Vt(t),zt(n),zt(e)]},pitchBendF:function(t,e){return he.pitchBend(t,Pt.to14b((e+1)/2))},bankMSB:function(t,e){return[176+Vt(t),0,zt(e)]},bankLSB:function(t,e){return[176+Vt(t),32,zt(e)]},modMSB:function(t,e){return[176+Vt(t),1,zt(e)]},modLSB:function(t,e){return[176+Vt(t),33,zt(e)]},breathMSB:function(t,e){return[176+Vt(t),2,zt(e)]},breathLSB:function(t,e){return[176+Vt(t),34,zt(e)]},footMSB:function(t,e){return[176+Vt(t),4,zt(e)]},footLSB:function(t,e){return[176+Vt(t),36,zt(e)]},portamentoMSB:function(t,e){return[176+Vt(t),5,zt(e)]},portamentoLSB:function(t,e){return[176+Vt(t),37,zt(e)]},dataMSB:function(t,e){return[176+Vt(t),6,zt(e)]},dataLSB:function(t,e){return[176+Vt(t),38,zt(e)]},volumeMSB:function(t,e){return[176+Vt(t),7,zt(e)]},volumeLSB:function(t,e){return[176+Vt(t),39,zt(e)]},balanceMSB:function(t,e){return[176+Vt(t),8,zt(e)]},balanceLSB:function(t,e){return[176+Vt(t),40,zt(e)]},panMSB:function(t,e){return[176+Vt(t),10,zt(e)]},panLSB:function(t,e){return[176+Vt(t),42,zt(e)]},expressionMSB:function(t,e){return[176+Vt(t),11,zt(e)]},expressionLSB:function(t,e){return[176+Vt(t),43,zt(e)]},damper:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),64,e?127:0]},portamento:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),65,e?127:0]},sostenuto:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),66,e?127:0]},soft:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),67,e?127:0]},legato:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),68,e?127:0]},hold2:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),69,e?127:0]},soundVariation:function(t,e){return[176+Vt(t),70,Zt(e)]},filterResonance:function(t,e){return[176+Vt(t),71,Zt(e)]},releaseTime:function(t,e){return[176+Vt(t),72,Zt(e)]},attackTime:function(t,e){return[176+Vt(t),73,Zt(e)]},brightness:function(t,e){return[176+Vt(t),74,Zt(e)]},decayTime:function(t,e){return[176+Vt(t),75,Zt(e)]},vibratoRate:function(t,e){return[176+Vt(t),76,Zt(e)]},vibratoDepth:function(t,e){return[176+Vt(t),77,Zt(e)]},vibratoDelay:function(t,e){return[176+Vt(t),78,Zt(e)]},ptc:function(t,e){return[176+Vt(t),84,Zt(e)]},dataIncr:function(t){return[176+Vt(t),96,0]},dataDecr:function(t){return[176+Vt(t),97,0]},nrpnLSB:function(t,e){return[176+Vt(t),98,zt(e)]},nrpnMSB:function(t,e){return[176+Vt(t),99,zt(e)]},rpnLSB:function(t,e){return[176+Vt(t),100,zt(e)]},rpnMSB:function(t,e){return[176+Vt(t),101,zt(e)]},allSoundOff:function(t){return[176+Vt(t),120,0]},resetAllControllers:function(t){return[176+Vt(t),121,0]},localControl:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),122,e?127:0]},allNotesOff:function(t){return[176+Vt(t),123,0]},omni:function(t,e){return void 0===e&&(e=!0),[176+Vt(t),e?125:124,0]},mono:function(t,e){return void 0===e&&(e=1),[176+Vt(t),126,zt(e)]},poly:function(t){return[176+Vt(t),127,0]}};function de(t,e,n,r){return void 0!==e?[zt(t),zt(e),zt(n),zt(r)]:((t!=parseInt(t)||t<0||t>65535)&&qt(t),[(t=parseInt(t))>>12&15,t>>8&15,t>>4&15,15&t])}function pe(t){return Lt(t),(t=Math.round(65536*t+16384))<0?0:t>65535?65535:t}var fe={mtc:function(t){return[241,Nt(t)]},songPosition:function(t,e){return void 0===e?[242,Yt(t),te(t)]:[242,zt(e),zt(t)]},songSelect:function(t){return[243,zt(t)]},tune:function(){return[246]},clock:function(){return[248]},start:function(){return[250]},continue:function(){return[251]},stop:function(){return[252]},active:function(){return[254]},reset:function(){return[255]}},me={sxIdRequest:function(){return[240,126,this._sxid,6,1,247]},sxTuningDumpRequest:function(t,e){return void 0===e?[240,126,this._sxid,8,0,zt(t),247]:[240,126,this._sxid,8,3,zt(t),zt(e),247]},sxFullFrame:function(t){return[240,127,this._sxid,1,1,It(t),t.getMinute(),t.getSecond(),t.getFrame(),247]},sxMasterVolume:function(t,e){return void 0===e?[240,127,this._sxid,4,1,Yt(t),te(t),247]:[240,127,this._sxid,4,1,zt(e),zt(t),247]},sxMasterVolumeF:function(t){return me.sxMasterVolume.call(this,Pt.to14b(re(t)))},sxMasterFineTuning:function(t,e){return void 0===e?[240,127,this._sxid,4,3,Yt(t),te(t),247]:[240,127,this._sxid,4,3,zt(e),zt(t),247]},sxMasterFineTuningF:function(t){return me.sxMasterFineTuning.call(this,Pt.to14b(re((t%1+1)/2,t)))},sxMasterCoarseTuning:function(t){return[240,127,this._sxid,4,4,0,zt(t),247]},sxMasterCoarseTuningF:function(t){return me.sxMasterCoarseTuning.call(this,t-t%1+64)},sxNoteTuning:function(t,e,n,r){return e==parseInt(e)?[240,ie(r),this._sxid,8,7,zt(t),zt(e)].concat(oe(n),[247]):[240,127,this._sxid,8,2,zt(t)].concat(oe(e),[247])},sxNoteTuningF:function(t,e,n,r){return e==parseInt(e)?me.sxNoteTuning.call(this,t,e,se(n),r):me.sxNoteTuning.call(this,t,se(e))},sxNoteTuningHZ:function(t,e,n,r){return e==parseInt(e)?me.sxNoteTuning.call(this,t,e,ae(n),r):me.sxNoteTuning.call(this,t,ae(e))},sxScaleTuning1:function(t,e,n){return t==parseInt(t)?[240,ie(n),this._sxid,8,8].concat(ne(Ht(t)),ue(e),[247]):me.sxScaleTuning1.call(this,65535,t,e)},sxScaleTuning1F:function(t,e,n){if(t!=parseInt(t))return me.sxScaleTuning1F.call(this,65535,t,e);for(var r=[],i=0;i<e.length;i++){if(e[i]<-.64||e[i]>.63)throw RangeError("Out of range: "+e[i]);r.push(Math.floor(100*e[i]+64))}return me.sxScaleTuning1.call(this,t,r,n)},sxScaleTuning2:function(t,e,n){return t==parseInt(t)?[240,ie(n),this._sxid,8,9].concat(ne(Ht(t)),ce(e),[247]):me.sxScaleTuning2.call(this,65535,t,e)},sxScaleTuning2F:function(t,e,n){if(t!=parseInt(t))return me.sxScaleTuning2F.call(this,65535,t,e);for(var r=[],i=0;i<e.length;i++){var o=(e[i]+1)/2;if(o<-1||o>1)throw RangeError("Out of range: "+e[i]);r.push(Pt.to14b((e[i]+1)/2))}return me.sxScaleTuning2.call(this,t,r,n)},sxGM:function(t){return void 0===t&&(t=1),[240,126,this._sxid,9,t?2==t?3:1:2,247]},sxGS:function(t){for(var e=void 0===t?[64,0,127,0]:t instanceof Array?t:arguments,n=0,r=[240,65,this._sxid,66,18],i=0;i<e.length;i++){var o=zt(e[i]);r.push(o),n+=o}return n%=128,r.push(n?128-n:0),r.push(247),r},sxXG:function(t){var e=void 0===t?[0,0,126,0]:t instanceof Array?t:arguments,n=127==this._sxid?0:this._sxid;n>15&&Bt("Bad Yamaha device number: "+n);for(var r=[240,67,16+n,76],i=0;i<e.length;i++)r.push(zt(e[i]));return r.push(247),r},sxMidiSoft:function(t,e){var n=[240,0,32,36,0,zt(t||0)];e=void 0===e?"":""+e;for(var r=0;r<e.length;r++)n.push(zt(e.charCodeAt(r)));return n.push(247),n},gsMasterVolume:function(t){return me.sxGS.call(this,[64,0,4,zt(t)])},gsMasterVolumeF:function(t){return me.gsMasterVolume.call(this,Pt.to7b(re(t)))},gsMasterFineTuning:function(t,e,n,r){return t=de(t,e,n,r),me.sxGS.call(this,[64,0,0,t[0],t[1],t[2],t[3]])},gsMasterFineTuningF:function(t){return me.gsMasterFineTuning.call(this,pe(t%1))},gsMasterCoarseTuning:function(t){return me.sxGS.call(this,[64,0,5,zt(t)])},gsMasterCoarseTuningF:function(t){return me.gsMasterCoarseTuning.call(this,t-t%1+64)},gsOctaveTuning:function(t,e,n){return me.sxGS.call(this,[64,16+[1,2,3,4,5,6,7,8,9,0,11,12,13,14,15][Vt(t)],64+Pt.octaveValue(e),zt(n)])},gsOctaveTuningF:function(t,e,n){if(n<-.64||n>.63)throw RangeError("Out of range: "+n);return me.gsOctaveTuning.call(this,t,e,Math.floor(100*n+64))},xgMasterVolume:function(t){return me.sxXG.call(this,[0,0,4,zt(t)])},xgMasterVolumeF:function(t){return me.xgMasterVolume.call(this,Pt.to7b(re(t)))},xgMasterFineTuning:function(t,e,n,r){return t=de(t,e,n,r),me.sxXG.call(this,[0,0,0,t[0],t[1],t[2],t[3]])},xgMasterFineTuningF:function(t){return me.xgMasterFineTuning.call(this,pe(t%1))},xgMasterCoarseTuning:function(t){return me.sxXG.call(this,[0,0,6,zt(t)])},xgMasterCoarseTuningF:function(t){return me.xgMasterCoarseTuning.call(this,t-t%1+64)},xgOctaveTuning:function(t,e,n){return me.sxXG.call(this,[8,Vt(t),65+Pt.octaveValue(e),zt(n)])},xgOctaveTuningF:function(t,e,n){if(n<-.64||n>.63)throw RangeError("Out of range: "+n);return me.xgOctaveTuning.call(this,t,e,Math.floor(100*n+64))}};me.sxScaleTuning=me.sxScaleTuning2,me.sxScaleTuningF=me.sxScaleTuning2F,me.sxMasterTranspose=me.sxMasterCoarseTuning,me.sxMasterTransposeF=me.sxMasterCoarseTuningF,me.gsMasterTranspose=me.gsMasterCoarseTuning,me.gsMasterTransposeF=me.gsMasterCoarseTuningF,me.xgMasterTranspose=me.xgMasterCoarseTuning,me.xgMasterTransposeF=me.xgMasterCoarseTuningF;var ge={bank:function(t,e,n){return void 0===n?[he.bankMSB(t,te(e)),he.bankLSB(t,Yt(e))]:[he.bankMSB(t,e),he.bankLSB(t,n)]},modF:function(t,e){return ge.mod(t,Pt.to14b(e))},mod:function(t,e,n){return void 0===n?[he.modMSB(t,te(e)),he.modLSB(t,Yt(e))]:[he.modMSB(t,e),he.modLSB(t,n)]},breathF:function(t,e){return ge.breath(t,Pt.to14b(e))},breath:function(t,e,n){return void 0===n?[he.breathMSB(t,te(e)),he.breathLSB(t,Yt(e))]:[he.breathMSB(t,e),he.breathLSB(t,n)]},footF:function(t,e){return ge.foot(t,Pt.to14b(e))},foot:function(t,e,n){return void 0===n?[he.footMSB(t,te(e)),he.footLSB(t,Yt(e))]:[he.footMSB(t,e),he.footLSB(t,n)]},portamentoTimeF:function(t,e){return ge.portamentoTime(t,Pt.to14b(e))},portamentoTime:function(t,e,n){return void 0===n?[he.portamentoMSB(t,te(e)),he.portamentoLSB(t,Yt(e))]:[he.portamentoMSB(t,e),he.portamentoLSB(t,n)]},dataF:function(t,e){return ge.data(t,Pt.to14b(e))},data:function(t,e,n){return void 0===n?[he.dataMSB(t,te(e)),he.dataLSB(t,Yt(e))]:[he.dataMSB(t,e),he.dataLSB(t,n)]},volumeF:function(t,e){return ge.volume(t,Pt.to14b(e))},volume:function(t,e,n){return void 0===n?[he.volumeMSB(t,te(e)),he.volumeLSB(t,Yt(e))]:[he.volumeMSB(t,e),he.volumeLSB(t,n)]},balanceF:function(t,e){return ge.balance(t,Pt.to14b((e+1)/2))},balance:function(t,e,n){return void 0===n?[he.balanceMSB(t,te(e)),he.balanceLSB(t,Yt(e))]:[he.balanceMSB(t,e),he.balanceLSB(t,n)]},panF:function(t,e){return ge.pan(t,Pt.to14b((e+1)/2))},pan:function(t,e,n){return void 0===n?[he.panMSB(t,te(e)),he.panLSB(t,Yt(e))]:[he.panMSB(t,e),he.panLSB(t,n)]},expressionF:function(t,e){return ge.expression(t,Pt.to14b(e))},expression:function(t,e,n){return void 0===n?[he.expressionMSB(t,te(e)),he.expressionLSB(t,Yt(e))]:[he.expressionMSB(t,e),he.expressionLSB(t,n)]},nrpn:function(t,e,n){return void 0===n?[he.nrpnMSB(t,te(e)),he.nrpnLSB(t,Yt(e))]:[he.nrpnMSB(t,e),he.nrpnLSB(t,n)]},rpn:function(t,e,n){return void 0===n?[he.rpnMSB(t,te(e)),he.rpnLSB(t,Yt(e))]:[he.rpnMSB(t,e),he.rpnLSB(t,n)]},rpnPitchBendRange:function(t,e,n){return ge.rpn(t,0,0).concat(ge.data(t,e,n))},rpnPitchBendRangeF:function(t,e){return ge.rpnPitchBendRange(t,zt(e-e%1),Math.floor(e%1*100))},rpnFineTuning:function(t,e,n){return ge.rpn(t,0,1).concat(ge.data(t,e,n))},rpnFineTuningF:function(t,e){return ge.rpn(t,0,1).concat(ge.dataF(t,(e%1+1)/2))},rpnCoarseTuning:function(t,e){return ge.rpn(t,0,2).concat([he.dataMSB(t,e)])},rpnCoarseTuningF:function(t,e){return ge.rpn(t,0,2).concat([he.dataMSB(t,e-e%1+64)])},rpnTuning:function(t,e,n,r){return ge.rpnCoarseTuning(t,e).concat(ge.rpnFineTuning(t,n,r))},rpnTuningF:function(t,e){return ge.rpnCoarseTuningF(t,e).concat(ge.rpnFineTuningF(t,e))},rpnTuningA:function(t,e){return ge.rpnTuningF(t,Pt.shift(e))},rpnSelectTuningProgram:function(t,e){return ge.rpn(t,0,3).concat([he.dataMSB(t,e)])},rpnSelectTuningBank:function(t,e){return ge.rpn(t,0,4).concat([he.dataMSB(t,e)])},rpnSelectTuning:function(t,e,n){return void 0===n?ge.rpnSelectTuningProgram(t,e):ge.rpnSelectTuningBank(t,e).concat(ge.rpnSelectTuningProgram(t,n))},rpnModulationDepthRange:function(t,e,n){return ge.rpn(t,0,5).concat(ge.data(t,e,n))},rpnModulationDepthRangeF:function(t,e){return ge.rpnModulationDepthRange(t,zt(e-e%1),Math.floor(e%1*128))},rpnNull:function(t){return ge.rpn(t,127,127)},mode1:function(t){return[he.omni(t,!0),he.poly(t)]},mode2:function(t){return[he.omni(t,!0),he.mono(t)]},mode3:function(t){return[he.omni(t,!1),he.poly(t)]},mode4:function(t){return[he.omni(t,!1),he.mono(t)]}};ge.rpnTranspose=ge.rpnCoarseTuningF;var _e={sxMasterTuning:function(t,e,n){return[me.sxMasterCoarseTuning.call(this,t),me.sxMasterFineTuning.call(this,e,n)]},sxMasterTuningF:function(t){return[me.sxMasterCoarseTuningF.call(this,t),me.sxMasterFineTuningF.call(this,t)]},gsMasterTuningF:function(t){return[me.gsMasterCoarseTuningF.call(this,t),me.gsMasterFineTuningF.call(this,t)]},xgMasterTuningF:function(t){return[me.xgMasterCoarseTuningF.call(this,t),me.xgMasterFineTuningF.call(this,t)]},sxMasterTuningA:function(t){return _e.sxMasterTuningF.call(this,Pt.shift(t))},gsMasterTuningA:function(t){return _e.gsMasterTuningF.call(this,Pt.shift(t))},xgMasterTuningA:function(t){return _e.xgMasterTuningF.call(this,Pt.shift(t))},gsScaleTuning:function(t,e){var n=[];if(12!=e.length)throw RangeError("Wrong input size: "+e.length);for(var r=0;r<12;r++)n.push(me.gsOctaveTuning.call(this,t,r,e[r]));return n},gsScaleTuningF:function(t,e){var n=[];if(12!=e.length)throw RangeError("Wrong input size: "+e.length);for(var r=0;r<12;r++)n.push(me.gsOctaveTuningF.call(this,t,r,e[r]));return n},xgScaleTuning:function(t,e){var n=[];if(12!=e.length)throw RangeError("Wrong input size: "+e.length);for(var r=0;r<12;r++)n.push(me.xgOctaveTuning.call(this,t,r,e[r]));return n},xgScaleTuningF:function(t,e){var n=[];if(12!=e.length)throw RangeError("Wrong input size: "+e.length);for(var r=0;r<12;r++)n.push(me.xgOctaveTuningF.call(this,t,r,e[r]));return n}};function ye(t,e){var n=new Pt;return n.ff=Wt(t),n.dd=void 0===e?"":ee(e),n}var ve={smf:function(t){if(t instanceof Pt)return new Pt(t);var e=t instanceof Array?t:arguments,n=Wt(e[0]),r="";return 2==e.length?r=Re(e[1]):e.length>2&&(r=Re(Array.prototype.slice.call(e,1))),ye(n,r)},smfSeqNumber:function(t){if(t==parseInt(t)){if(t<0||t>65535)throw RangeError("Sequence number out of range: "+t);t=String.fromCharCode(t>>8)+String.fromCharCode(255&t)}else if(0==(t=""+t).length)t="\0\0";else if(1==t.length)t="\0"+t;else if(t.length>2)throw RangeError("Sequence number out of range"+qe(t));return ye(0,t)},smfText:function(t){return ye(1,At.lib.toUTF8(t))},smfCopyright:function(t){return ye(2,At.lib.toUTF8(t))},smfSeqName:function(t){return ye(3,At.lib.toUTF8(t))},smfInstrName:function(t){return ye(4,At.lib.toUTF8(t))},smfLyric:function(t){return ye(5,At.lib.toUTF8(t))},smfMarker:function(t){return ye(6,At.lib.toUTF8(t))},smfCuePoint:function(t){return ye(7,At.lib.toUTF8(t))},smfProgName:function(t){return ye(8,At.lib.toUTF8(t))},smfDevName:function(t){return ye(9,At.lib.toUTF8(t))},smfChannelPrefix:function(t){if(t==parseInt(t))K(t),t=String.fromCharCode(t);else if(0==(t=""+t).length)t="\0";else if(t.length>1||t.charCodeAt(0)>15)throw RangeError("Channel number out of range"+qe(t));return ye(32,t)},smfMidiPort:function(t){if(t==parseInt(t)){if(t<0||t>127)throw RangeError("Port number out of range: "+t);t=String.fromCharCode(t)}else if(0==(t=""+t).length)t="\0";else if(t.length>1||t.charCodeAt(0)>127)throw RangeError("Port number out of range"+qe(t));return ye(33,t)},smfEndOfTrack:function(t){if(""!=Re(t))throw RangeError("Unexpected data"+qe(Re(t)));return ye(47)},smfTempo:function(t){if(3==(""+t).length)return ye(81,t);if(t==parseInt(t)&&t>0&&t<=16777215)return ye(81,String.fromCharCode(t>>16)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t));throw RangeError("Out of range"+qe(Re(t)))},smfBPM:function(t){return ve.smfTempo(Math.round(6e7/t))},smfSMPTE:function(t){if(t instanceof Ot)return ye(84,String.fromCharCode(t.hour)+String.fromCharCode(t.minute)+String.fromCharCode(t.second)+String.fromCharCode(t.frame)+String.fromCharCode(t.quarter%4*25));if(5==(""+t).length)return ye(84,t);var e=t instanceof Array?t:Array.prototype.slice.call(arguments);return e.splice(0,0,30),ve.smfSMPTE(new Ot(e))},smfTimeSignature:function(t,e,n,r){var i,o,s,a,u=(""+t).match(/^\s*(\d+)\s*\/\s*(\d+)\s*$/);if(u){if(i=parseInt(u[1]),o=parseInt(u[2]),i>0&&i<256&&o>0&&!(o&o-1)){for(s=o,o=0,s>>=1;s;s>>=1)o++;return s=e==parseInt(e)?e:24,a=n==parseInt(n)?n:8,ye(88,String.fromCharCode(i)+String.fromCharCode(o)+String.fromCharCode(s)+String.fromCharCode(a))}if(4==(""+t).length)return ye(88,t)}else if(t==parseInt(t)&&e==parseInt(e)){if(t>0&&t<256&&e>0&&!(e&e-1)){for(i=t,o=0,s=e,s>>=1;s;s>>=1)o++;return s=n==parseInt(n)?n:24,a=r==parseInt(r)?r:8,ye(88,String.fromCharCode(i)+String.fromCharCode(o)+String.fromCharCode(s)+String.fromCharCode(a))}if(4==(""+t).length)return ye(88,t);t=t+"/"+e}else if(4==(""+t).length)return ye(88,t);throw RangeError("Wrong time signature"+qe(Re(""+t)))},smfKeySignature:function(t){var e=(t=""+t).match(/^\s*([A-H][b#]?)\s*(|maj|major|dur|m|min|minor|moll)\s*$/i);if(e){var n={CB:0,GB:1,DB:2,AB:3,EB:4,BB:5,F:6,C:7,G:8,D:9,A:10,E:11,B:12,H:12,"F#":13,"C#":14,"G#":15,"D#":16,"A#":17}[e[1].toUpperCase()],r={"":0,MAJ:0,MAJOR:0,DUR:0,M:1,MIN:1,MINOR:1,MOLL:1}[e[2].toUpperCase()];void 0!==n&&void 0!==r&&(r&&(n-=3),(n-=7)>=-7&&n<0?t=String.fromCharCode(256+n)+String.fromCharCode(r):n>=0&&n<=7&&(t=String.fromCharCode(n)+String.fromCharCode(r)))}if(2==t.length&&t.charCodeAt(1)<=1&&(t.charCodeAt(0)<=7||t.charCodeAt(0)<=255&&t.charCodeAt(0)>=249))return ye(89,t);throw RangeError("Incorrect key signature"+qe(t))},smfSequencer:function(t){return ye(127,Re(t))}},be={};function we(t,e){Pt[t]=function(){return new Pt(e.apply(this,arguments))},be[t]=function(){return this.send(e.apply(this,arguments))}}function xe(t,e){Pt[t]=function(){return e.apply(this,arguments)},be[t]=function(){return this.send(e.apply(this,arguments))}}function Te(t,e){Pt[t]=function(){var t,n=[],r=e.apply(this,arguments);for(t=0;t<r.length;t++)n.push(new Pt(r[t]));return n},be[t]=function(){for(var t=e.apply(this,arguments),n=this,r=0;r<t.length;r++)n=n.send(t[r]);return n}}function ke(t,e){Pt[t]=function(){return new Pt(e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))))},be[t]=function(){if(void 0!==this._master){var t=new Pt(e.apply(this,[this._master].concat(Array.prototype.slice.call(arguments))));return t._mpe=t[1],this.send(t)}return this.send(e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))))}}function Se(t,e){Pt[t]=function(){return new Pt(e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))))},be[t]=function(){if(void 0!==this._master){var t,n=Array.prototype.slice.call(arguments);n.length<e.length?n=[this._master].concat(n):(t=Zt(n[0]),n[0]=this._master);var r=new Pt(e.apply(this,n));return r._mpe=t,this.send(r)}return this.send(e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))))}}function Ae(t,e){Pt[t]=function(){var t,n=[],r=e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments)));for(t=0;t<r.length;t++)n.push(new Pt(r[t]));return n},be[t]=function(){var t,n,r;if(void 0!==this._master){var i,o=Array.prototype.slice.call(arguments);for(o.length<e.length?o=[this._master].concat(o):(i=Zt(o[0]),o[0]=this._master),n=e.apply(this,o),r=this,t=0;t<n.length;t++){var s=Pt(n[t]);s._mpe=i,r=r.send(s)}return r}for(n=e.apply(this,void 0===this._ch?arguments:[this._ch].concat(Array.prototype.slice.call(arguments))),r=this,t=0;t<n.length;t++)r=r.send(n[t]);return r}}function Ee(t){E(be,function(e){t.prototype[e]=be[e]})}E(fe,function(t){we(t,fe[t])}),E(me,function(t){we(t,me[t])}),E(ve,function(t){xe(t,ve[t])}),E(_e,function(t){Te(t,_e[t])}),E(le,function(t){ke(t,le[t])}),E(he,function(t){Se(t,he[t])}),E(ge,function(t){Ae(t,ge[t])}),Ee(V);var Oe={a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};for(i=0;i<16;i++)Oe[i]=i;function Ce(t,e){return 127==t&&void 0!==e&&67==e.charCodeAt(0)&&123==e.charCodeAt(1)}function Me(t,e){return Ce(t,e)&&1==e.charCodeAt(2)}function Ne(t,e){if(t>=0&&t<=127&&e>=0&&e<=127){var n=15&t,r=t>>4;return n>0&&n<8&&r<7?(n=["C","D","E","F","G","A","B"][n-1]+["bbb","bb","b","","#","##","###"][r],e>34?n+"?":n+["","6","Maj7","Maj7(#11)","(9)","Maj7(9)","6(9)","aug","m","m6","m7","m7b5","m(9)","m7(9)","m7(11)","m+7","m+7(9)","dim","dim7","7","7sus4","7b5","7(9)","7(#11)","7(13)","7(b9)","7(b13)","7(#9)","Maj7aug","7aug","1+8","1+5","sus4","1+2+5","cc"][e]):"-"}return"-"}function Ie(t){for(var e=[],n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function je(t){for(var e="",n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e}function Re(t){return t instanceof Array?je(t):void 0===t?"":""+t}function Pe(t){for(var e=0,n=0;n<t.length;n++)e=(e<<8)+t.charCodeAt(n);return e}function De(t){return(t<16?"0":"")+t.toString(16)}function Le(t){for(var e=[],n=0;n<t.length;n++)e.push(De(t[n]));return e.join(" ")}function Fe(t){for(var e=[],n=0;n<t.length;n++)n&&n%4==0&&e.push(" "),e.push(De(t[n]));return e.join("")}function $e(t){for(var e="",n=0;n<t.length;n++)"\n"==t[n]?e+="\\n":"\r"==t[n]?e+="\\r":"\t"==t[n]?e+="\\t":t.charCodeAt(n)<32?e+="\\x"+De(t.charCodeAt(n)):e+=t[n];return e}function Be(t){return t.length?": "+Le(Ie(t)):""}function qe(t){return t.length?": "+$e(At.lib.fromUTF8(t)):""}function Ue(t){void 0===t?this._cc={}:this._cc[t]={}}function Ve(t,e){var n=void 0===t?"??":De(t),r=void 0===e?"??":De(e),i={"0000":"Pitch Bend Sensitivity","0001":"Channel Fine Tuning","0002":"Channel Coarse Tuning","0003":"Select Tuning Program","0004":"Select Tuning Bank","0005":"Vibrato Depth Range","7f7f":"NONE"}[n+""+r];return"RPN "+n+" "+r+(i?": "+i:"")}function Ge(t,e){return"NRPN "+(void 0===t?"??":De(t))+" "+(void 0===e?"??":De(e))}function ze(t){var e,n="";for(e=0;e<t.length&&t[e];e++)n+=String.fromCharCode(t[e]);return At.lib.fromUTF8(n)}function We(t){var e,n,r,i,o,s,a,u="x",c="x";if(t.isMidi2?(r=t[0]>>4,n=u=(15&t[0]).toString(16),this._cc[n]||(this._cc[n]={}),2==r?e=new Pt(t.slice(1)):3==r?(i=t[1]>>4,o=15&t[1],s=t.slice(2,2+o),0==i&&(e=new Pt([240].concat(s,[247])),this._cc[n].sx=void 0),1==i&&(this._cc[n].sx=s),2==i&&this._cc[n].sx&&(this._cc[n].sx=this._cc[n].sx.concat(s)),3==i&&this._cc[n].sx&&(s=this._cc[n].sx.concat(s),e=new Pt([240].concat(s,[247])),this._cc[n].sx=void 0)):4==r?(i=t[1]>>4,n=u+(c=(15&t[1]).toString(16)),this._cc[n]||(this._cc[n]={}),12==i&&(1&t[3]&&(this._cc[n].bm=t[6],this._cc[n].bl=t[7]),t._bm=this._cc[n].bm,t._bl=this._cc[n].bl,At.MIDI.programName&&t.label(At.MIDI.programName(t[4],t._bm,t._bl)))):13==r&&(i=t[1]>>6,48&t[1]||(c=(15&t[1]).toString(16)),n=u+c,this._cc[n]||(this._cc[n]={}),s=t.slice(4),0==i&&(t.label(ze(s)),this._cc[n].tx=void 0),1==i&&(this._cc[n].tx=s),2==i&&this._cc[n].tx&&(this._cc[n].tx=this._cc[n].tx.concat(s)),3==i&&this._cc[n].tx&&(s=this._cc[n].tx.concat(s),t.label(ze(s)),this._cc[n].tx=void 0))):e=t,!e||!e.length||e[0]<128)return t;if(255==e[0])return this._clear(),t;if(i=e[0]>>4,c=(15&e[0]).toString(16),n=15==i?u:u+c,this._cc[n]||(this._cc[n]={}),12==i)e._bm=this._cc[n].bm,e._bl=this._cc[n].bl,At.MIDI.programName&&t.label(At.MIDI.programName(e[1],e._bm,e._bl));else if(11==i)switch(e[1]){case 0:this._cc[n].bm=e[2];break;case 32:this._cc[n].bl=e[2];break;case 98:this._cc[n].nl=e[2],this._cc[n].rn="n";break;case 99:this._cc[n].nm=e[2],this._cc[n].rn="n";break;case 100:this._cc[n].rl=e[2],this._cc[n].rn="r";break;case 101:this._cc[n].rm=e[2],this._cc[n].rn="r";break;case 6:case 38:case 96:case 97:"r"==this._cc[n].rn&&(e._rm=this._cc[n].rm,e._rl=this._cc[n].rl,t.label(Ve(this._cc[n].rm,this._cc[n].rl))),"n"==this._cc[n].rn&&(e._nm=this._cc[n].rm,e._nl=this._cc[n].nl,t.label(Ge(this._cc[n].nm,this._cc[n].nl)))}else e.isFullSysEx()&&(127==e[1]?4==e[3]?(a={1:"Master Volume",2:"Master Balance",3:"Master Fine Tuning",4:"Master Coarse Tuning"}[e[4]])&&t.label(a):8==e[3]&&(a={2:"Note Tuning",7:"Note Tuning, Bank",8:"Scale Tuning, 1 byte format",9:"Scale Tuning, 2 byte format"}[e[4]])&&t.label(a):126==e[1]?6==e[3]?1==e[4]?t.label("Device ID Request"):2==e[4]&&t.label("Device ID Response"):8==e[3]?(a={0:"Bulk Tuning Dump Request",1:"Bulk Tuning Dump",3:"Bulk Tuning Dump Request, Bank",4:"Bulk Tuning Dump, Bank",5:"Scale Tuning Dump, 1 byte format",6:"Scale Tuning Dump, 2 byte format",7:"Note Tuning, Bank",8:"Scale Tuning, 1 byte format",9:"Scale Tuning, 2 byte format"}[e[4]])&&t.label(a):9==e[3]&&(1==e[4]?(t.label("GM1 System On"),this._clear(u),this._cc[u].gm="1"):2==e[4]?(t.label("GM System Off"),this._clear(u),this._cc[u].gm="0"):3==e[4]&&(t.label("GM2 System On"),this._clear(u),this._cc[u].gm="2")):67==e[1]?16==(240&e[2])&&76==e[3]&&(0==e[4]&&0==e[5]&&126==e[6]&&0==e[7]?(t.label("XG System On"),this._clear(u),this._cc[u].gm="Y"):0==e[4]&&0==e[5]&&0==e[6]?t.label("XG Master Tuning"):0==e[4]&&0==e[5]&&4==e[6]?t.label("XG Master Volume"):0==e[4]&&0==e[5]&&6==e[6]?t.label("XG Master Transpose"):8==e[4]&&e[5]<16&&e[6]>=65&&e[6]<=76?t.label("XG Scale Tuning"):t.label("XG Parameter")):65==e[1]&&66==e[3]&&18==e[4]&&(64==e[5]&&(0==e[6]?127==e[7]&&0==e[8]&&65==e[9]?(t.label("GS Reset"),this._clear(u),this._cc[u].gm="R"):0==e[7]?t.label("GS Master Tuning"):4==e[7]?t.label("GS Master Volume"):5==e[7]?t.label("GS Master Transpose"):t.label("GS Parameter"):16==(240&e[6])&&21==e[7]?t.label("GS Drum Part Change"):16==(240&e[6])&&e[7]>=64&&e[7]<=75?t.label("GS Scale Tuning"):t.label("GS Parameter")),65==e[5]&&t.label("GS Parameter")));return t}function Je(){var t=new V;return t._clear=Ue,t._read=We,t._receive=function(t){this._emit(this._read(t))},t.gm=function(t){return void 0===t&&(t="x"),this._cc[t]&&this._cc[t].gm||0},t._clear(),t._resume(),t}function He(){var t=this instanceof He?this:t=new He;return t.reset(),arguments.length&&He.prototype.setup.apply(t,arguments),t}function Xe(t){var e,n=this instanceof Xe?this:n=new Xe;if(t instanceof Xe)return n._from=t._from.slice(),E(t,function(e){"_from"!=e&&(n[e]=t[e])}),n;n._from=[],void 0===t&&(t=[0,0,0,0]);var r=t instanceof Array?t:arguments;for(n.length=0,e=0;e<r.length;e++)((s=r[e])!=parseInt(s)||s<0||s>255)&&Bt(r[e]),n.push(s);if(n.length!=[4,4,4,8,8,16,4,4,8,8,8,12,12,16,16,16][n[0]>>4])throw RangeError("Wrong UMP size");return n}function Ke(){}Pt.prototype.getChannel=function(){if(32==this.ff&&1==this.dd.length&&this.dd.charCodeAt(0)<16)return this.dd.charCodeAt(0);var t=this[0];return void 0===t||t<128||t>239?void 0:15&t},Pt.prototype.setChannel=function(t){if(void 0===(t=Oe[t]))return this;if(32==this.ff)this.dd=String.fromCharCode(t);else{var e=this[0];void 0!==e&&e>=128&&e<=239&&(this[0]=240&e|t)}return this},Pt.prototype.getNote=function(){var t=this[0];if(!(void 0===t||t<128||t>175))return this[1]},Pt.prototype.setNote=function(t){var e=this[0];return void 0===e||e<128||e>175||void 0!==(t=Pt.noteValue(t))&&(this[1]=t),this},Pt.prototype.getVelocity=function(){var t=this[0];if(!(void 0===t||t<128||t>159))return this[2]},Pt.prototype.setVelocity=function(t){var e=this[0];return void 0===e||e<128||e>159||(t=parseInt(t))>=0&&t<128&&(this[2]=t),this},Pt.prototype.getSysExId=function(){if(240==this[0])return this[2]},Pt.prototype.setSysExId=function(t){return 240==this[0]&&this.length>2&&(t=parseInt(t))>=0&&t<128&&(this[2]=t),this},Pt.prototype.getData=function(){if(void 0!==this.dd)return this.dd.toString()},Pt.prototype.setData=function(t){return this.dd=Re(t),this},Pt.prototype.getText=function(){if(void 0!==this.dd)return Me(this.ff,this.dd)?Ne(this.dd.charCodeAt(3),this.dd.charCodeAt(4)):At.lib.fromUTF8(this.dd);if(this.isMidiSoft()){for(var t=[],e=6;e<this.length-1;e++)t.push(String.fromCharCode(this[e]));return t.join("")}},Pt.prototype.setText=function(t){return this.dd=At.lib.toUTF8(t),this},Pt.prototype.getTempo=function(){if(81==this.ff&&void 0!==this.dd)return 65536*this.dd.charCodeAt(0)+256*this.dd.charCodeAt(1)+this.dd.charCodeAt(2)},Pt.prototype.getBPM=function(){var t=this.getTempo();if(t)return 6e7/t},Pt.prototype.getTimeSignature=function(){if(88==this.ff&&void 0!==this.dd)return[this.dd.charCodeAt(0),1<<this.dd.charCodeAt(1)]},Pt.prototype.getTimeSignature4=function(){if(88==this.ff&&void 0!==this.dd){var t=[this.dd.charCodeAt(0),1<<this.dd.charCodeAt(1)];return 4==this.dd.length&&t.push(this.dd.charCodeAt(2),this.dd.charCodeAt(3)),t}},Pt.prototype.getKeySignature=function(){if(89==this.ff&&void 0!==this.dd){var t=this.dd.charCodeAt(0),e=this.dd.charCodeAt(1);if(128&t&&(t-=256),t>=-7&&t<=7&&e>=0&&e<=1)return[t,["Cb","Gb","Db","Ab","Eb","Bb","F","C","G","D","A","E","B","F#","C#","G#","D#","A#"][e?t+10:t+7],!!e]}},Pt.prototype.isNoteOn=function(){var t=this[0];return!(void 0===t||t<144||t>159)&&this[2]>0},Pt.prototype.isNoteOff=function(){var t=this[0];return!(void 0===t||t<128||t>159)&&(t<144||0==this[2])},Pt.prototype.isSysEx=function(){return 240==this[0]},Pt.prototype.isFullSysEx=function(){return 240==this[0]&&247==this[this.length-1]},Pt.prototype.isMidiSoft=function(){return this.isFullSysEx()&&0==this[1]&&32==this[2]&&36==this[3]&&0==this[4]},Pt.prototype.isSMF=function(){return this.ff>=0&&this.ff<=127},Pt.prototype.isEOT=function(){return 47==this.ff},Pt.prototype.isText=function(){return 1==this.ff},Pt.prototype.isCopyright=function(){return 2==this.ff},Pt.prototype.isSeqName=function(){return 3==this.ff},Pt.prototype.isInstrName=function(){return 4==this.ff},Pt.prototype.isLyric=function(){return 5==this.ff},Pt.prototype.isMarker=function(){return 6==this.ff},Pt.prototype.isCuePoint=function(){return 7==this.ff},Pt.prototype.isProgName=function(){return 8==this.ff},Pt.prototype.isDevName=function(){return 9==this.ff},Pt.prototype.isTempo=function(){return 81==this.ff},Pt.prototype.isTimeSignature=function(){return 88==this.ff},Pt.prototype.isKeySignature=function(){return 89==this.ff},Pt.prototype.isGmReset=function(){return this.match([240,126,[0,0],9,[0,0],247])},Pt.prototype.isGsReset=function(){return this.match([240,65,[0,0],66,18,64,0,127,0,65,247])},Pt.prototype.isXgReset=function(){return this.match([240,67,[16,240],76,0,0,126,0,247])},Pt.prototype.match=function(t){var e,n;for(e=0;e<t.length;e++)if(void 0===(n=t[e][1])){if(this[e]!=t[e])return!1}else if((this[e]&n)!=(t[e][0]&n))return!1;return!0},Pt.prototype.label=function(t){return this.lbl=this.lbl?this.lbl+", "+t:t,this},Pt.prototype.toString=function(){return this.lbl?this._str()+" ("+this.lbl+")":this._str()},Pt.prototype._str=function(){var t,e;if(this.length)t=Le(this);else{if(void 0===this.ff)return"empty";t="ff"+De(this.ff)}return(e=this._string())?t+" -- "+e:t},Pt.prototype._string=function(){var t,e="";if(!this.length){if(0==this.ff)e+="Sequence Number: "+Pe(this.dd);else if(this.ff>0&&this.ff<10)e+=["","Text","Copyright","Sequence Name","Instrument Name","Lyric","Marker","Cue Point","Program Name","Device Name"][this.ff]+qe(this.dd);else if(32==this.ff)e+="Channel Prefix"+Be(this.dd);else if(33==this.ff)e+="MIDI Port"+Be(this.dd);else if(47==this.ff)e+="End of Track"+Be(this.dd);else if(81==this.ff)e+="Tempo: "+Math.round(100*this.getBPM())/100+" bpm";else if(84==this.ff)e+="SMPTE Offset: "+Rt(Ie(this.dd));else if(88==this.ff){var n=1<<this.dd.charCodeAt(1);e+="Time Signature: "+this.dd.charCodeAt(0)+"/"+n,e+=" "+this.dd.charCodeAt(2)+" "+this.dd.charCodeAt(3)}else if(89==this.ff){e+="Key Signature: ";var r=this.getKeySignature();r?(e+=r[1],r[2]&&(e+=" min")):e+="invalid"}else if(127==this.ff){if(67==this.dd.charCodeAt(0)&&123==this.dd.charCodeAt(1))return e+="[XF:"+De(this.dd.charCodeAt(2))+"]",e+=(t={0:"Version",1:"Chord",2:"Rehearsal Mark",3:"Phrase Mark",4:"Max Phrase Mark",5:"Fingering Number",12:"Guide Track Flag",16:"Guitar Info",18:"Chord Voicing",127:"XG Song Data Number"}[this.dd.charCodeAt(2)])?" "+t:"",e+=": ",0==this.dd.charCodeAt(2)?e+this.dd.substring(3,7)+" "+Le(Ie(this.dd.substring(7))):1==this.dd.charCodeAt(2)?e+this.getText():e+Le(Ie(this.dd.substring(3)));e+="Sequencer Specific"+Be(this.dd)}else e+="SMF"+Be(this.dd);return e}if(t={241:"MIDI Time Code",242:"Song Position",243:"Song Select",244:"Undefined",245:"Undefined",246:"Tune request",248:"Timing clock",249:"Undefined",250:"Start",251:"Continue",252:"Stop",253:"Undefined",254:"Active Sensing",255:"Reset"}[this[0]])return t;if(this.isMidiSoft())return(t=$e(this.getText()))&&(t=" "+t),"[K:"+De(this[5])+"]"+t;var i=this[0]>>4;return(t={8:"Note Off",10:"Aftertouch",12:"Program Change",13:"Channel Aftertouch",14:"Pitch Wheel"}[i])?t:9==i?this[2]?"Note On":"Note Off":11!=i?e:(t={0:"Bank Select MSB",1:"Modulation Wheel MSB",2:"Breath Controller MSB",4:"Foot Controller MSB",5:"Portamento Time MSB",6:"Data Entry MSB",7:"Channel Volume MSB",8:"Balance MSB",10:"Pan MSB",11:"Expression Controller MSB",12:"Effect Control 1 MSB",13:"Effect Control 2 MSB",16:"General Purpose Controller 1 MSB",17:"General Purpose Controller 2 MSB",18:"General Purpose Controller 3 MSB",19:"General Purpose Controller 4 MSB",31:"Karaoke",32:"Bank Select LSB",33:"Modulation Wheel LSB",34:"Breath Controller LSB",36:"Foot Controller LSB",37:"Portamento Time LSB",38:"Data Entry LSB",39:"Channel Volume LSB",40:"Balance LSB",42:"Pan LSB",43:"Expression Controller LSB",44:"Effect control 1 LSB",45:"Effect control 2 LSB",48:"General Purpose Controller 1 LSB",49:"General Purpose Controller 2 LSB",50:"General Purpose Controller 3 LSB",51:"General Purpose Controller 4 LSB",64:"Damper Pedal",65:"Portamento",66:"Sostenuto",67:"Soft Pedal",68:"Legato",69:"Hold 2",70:"Sound Variation",71:"Filter Resonance",72:"Release Time",73:"Attack Time",74:"Brightness",75:"Decay Time",76:"Vibrato Rate",77:"Vibrato Depth",78:"Vibrato Delay",79:"Sound Controller 10",80:"General Purpose Controller 5",81:"General Purpose Controller 6",82:"General Purpose Controller 7",83:"General Purpose Controller 8",84:"Portamento Control",88:"High Resolution Velocity Prefix",91:"Effects 1 Depth",92:"Effects 2 Depth",93:"Effects 3 Depth",94:"Effects 4 Depth",95:"Effects 5 Depth",96:"Data Increment",97:"Data Decrement",98:"Non-Registered Parameter Number LSB",99:"Non-Registered Parameter Number MSB",100:"Registered Parameter Number LSB",101:"Registered Parameter Number MSB",120:"All Sound Off",121:"Reset All Controllers",122:"Local Control On/Off",123:"All Notes Off",124:"Omni Mode Off",125:"Omni Mode On",126:"Mono Mode On",127:"Poly Mode On"}[this[1]],this[1]>=64&&this[1]<=69&&(t+=this[2]<64?" Off":" On"),t||(t="Undefined"),t)},Pt.prototype._stamp=function(t){return this._from.push(t._orig?t._orig:t),this},Pt.prototype._unstamp=function(t){if(void 0===t)this._from=[];else{t._orig&&(t=t._orig);var e=this._from.indexOf(t);e>-1&&this._from.splice(e,1)}return this},Pt.prototype._stamped=function(t){t._orig&&(t=t._orig);for(var e=0;e<this._from.length;e++)if(this._from[e]==t)return!0;return!1},At.MIDI=Pt,A.prototype.MIDI=Pt,At.Context=Je,A.prototype.Context=Je,He.validate=function(t){var e=t instanceof Array?t:arguments;if(e[0]!=parseInt(e[0])||e[0]<0||e[0]>14)throw RangeError("Bad master channel value: "+e[0]);if(e[1]!=parseInt(e[1])||e[1]<0||e[0]+e[1]>15)throw RangeError("Bad zone size value: "+e[1])},He.prototype.reset=function(){for(var t=0;t<16;t++)this[t]={band:0,master:t}},He.prototype.setup=function(t,e){var n;He.validate(t,e);var r=t+e;if((this[t].master!=t||this[t].band!=e)&&(e||this[t].band)){for(this[t].band?r<(n=t+this[t].band)&&(r=n):this[t].master==t-1?(n=t-1,r<(n+=this[n].band)&&(r=n),this[t-1]={band:0,master:t-1}):this[t].master!=t&&(n=this[t].master,r<(n+=this[n].band)&&(r=n),this[this[t].master].band=t-this[t].master-1),this[t].master=t,this[t].band=e,n=t+1;n<=t+e;n++)this[n].band&&r<n+this[n].band&&(r=n+this[n].band),this[n]={band:0,master:t};for(;n<=r;n++)this[n]={band:0,master:n}}},He.prototype.filter=function(t){var e=t.getChannel();if(!this[e]||!this[this[e].master].band)return t;var n,r,i,o=this[e].master,s=this[o].band;if(void 0!==t._mpe){for(i=256,n=o+1;n<=o+s;n++)if(this[n].notes){for(i>this[n].notes.length&&(e=n,i=this[n].notes.length),r=0;r<this[n].notes.length;r++)if(this[n].notes[r]==t._mpe){e=n,i=-1;break}}else i>0&&(e=n,i=0);t.setChannel(e),t._mpe=void 0}return e==o||(t.isNoteOn()?(this[e].notes||(this[e].notes=[]),k(this[e].notes,t.getNote())):t.isNoteOff()&&this[e].notes&&S(this[e].notes,t.getNote())),t},At.MPE=He,Xe.prototype=[],Xe.prototype.constructor=Xe,Xe.prototype.isMidi=function(){return 2},Xe.prototype.isMidi2=!0,Xe.prototype.dump=function(){var t,e="";for(t=0;t<this.length;t++)e+=String.fromCharCode(this[t]);return e},Ke.prototype=Xe,Xe._sxid=127,Xe.sxId=function(t){if(void 0===t&&(t=Xe._sxid),t==this._sxid)return this;t=zt(t);var e=new Ke;return e._ch=this._ch,e._gr=this._gr,e._sxid=t,e},Xe.ch=function(t){if(t==this._ch||void 0===t&&void 0===this._ch)return this;var e=new Ke;return void 0!==t&&(t=Vt(t)),e._ch=t,e._gr=this._gr,e._sxid=this._sxid,e},Xe.gr=function(t){if(t==this._gr||void 0===t&&void 0===this._gr)return this;var e=new Ke;return void 0!==t&&(t=Gt(t)),e._ch=this._ch,e._gr=t,e._sxid=this._sxid,e},Xe.prototype.getGroup=function(){if(this[0]){var t=this[0]>>4;return 1==t||2==t||3==t||4==t||5==t||13==t?15&this[0]:void 0}};var Qe=[0,0,0,0,0,0,0,0,0,0,0,0,0];function Ze(t,e,n,r){return void 0!==e?[Wt(t),Wt(e),Wt(n),Wt(r)]:[(t=Qt(t))>>24&255,t>>16&255,t>>8&255,255&t]}function Ye(t){return(t=Math.floor(4294967296*t))>4294967295?4294967295:t<0?0:t}var tn={noop:function(){return[0,0,0,0]},umpClock:function(t){return[0,16,(t=Ht(t))>>8,255&t]},umpTimestamp:function(t){return[0,32,(t=Ht(t))>>8,255&t]},umpTicksPQN:function(t){return[0,48,(t=Ht(t))>>8,255&t]},umpDelta:function(t){return[0,64+((t=Xt(t=t||0))>>16),t>>8&255,255&t]},umpStartClip:function(){return[240,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},umpEndClip:function(){return[240,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},en={umpTempo:function(t,e){return[208+Gt(t),16,0,0].concat(Ze(e),[0,0,0,0,0,0,0,0])},umpBPM:function(t,e){return en.umpTempo(t,Math.round(6e9/e))},umpTimeSignature:function(t,e,n){var r,i,o,s=(""+e).match(/^\s*(\d+)\s*\/\s*(\d+)\s*$/);if(s?(r=parseInt(s[1]),i=parseInt(s[2])):e==parseInt(e)&&n==parseInt(n)&&(r=parseInt(e),i=parseInt(n)),r>0&&r<256&&i>0&&!(i&i-1)){for(o=0,i>>=1;i;i>>=1)o++;if((i=Math.round(32*r/(1<<o)))<256)return[208+Gt(t),16,0,1,r,o,i,0,0,0,0,0,0,0,0,0]}throw RangeError("Wrong time signature "+e+(void 0===n?"":"/"+n))}},nn={umpMetadata:function(t,e){return sn.umpCustomText(t,0,1,1,0,e)},umpProjectName:function(t,e){return sn.umpCustomText(t,0,1,1,1,e)},umpCompositionName:function(t,e){return sn.umpCustomText(t,0,1,1,2,e)},umpClipName:function(t,e){return sn.umpCustomText(t,0,1,1,3,e)},umpCopyright:function(t,e){return sn.umpCustomText(t,0,1,1,4,e)},umpComposerName:function(t,e){return sn.umpCustomText(t,0,1,1,5,e)},umpLyricistName:function(t,e){return sn.umpCustomText(t,0,1,1,6,e)},umpArrangerName:function(t,e){return sn.umpCustomText(t,0,1,1,7,e)},umpPublisherName:function(t,e){return sn.umpCustomText(t,0,1,1,8,e)},umpPerformerName:function(t,e){return sn.umpCustomText(t,0,1,1,9,e)},umpAccPerformerName:function(t,e){return sn.umpCustomText(t,0,1,1,10,e)},umpRecordingDate:function(t,e){return sn.umpCustomText(t,0,1,1,11,e)},umpRecordingLocation:function(t,e){return sn.umpCustomText(t,0,1,1,12,e)},umpText:function(t,e){return sn.umpCustomText(t,0,1,2,0,e)},umpLyrics:function(t,e){return sn.umpCustomText(t,0,1,2,1,e)},umpLyricsLanguage:function(t,e){return sn.umpCustomText(t,0,1,2,2,e)},umpRuby:function(t,e){return sn.umpCustomText(t,0,1,2,3,e)},umpRubyLanguage:function(t,e){return sn.umpCustomText(t,0,1,2,4,e)},umpData:function(t,e,n){var r;void 0===n&&(n=e,e=0);var i=fn(gn(n),13);for(r=0;r<i.length;r++)i[r]=[80+Gt(t),16*pn(i.length,r)+i[r].length,Wt(e)].concat(i[r],Qe).slice(0,16);return i}},rn=[0,6,32,38,98,99,100,101],on={umpNoteOn:function(t,e,n,r,i,o){return void 0===r&&(r=65535),i=i||0,o=o||0,r=Ht(r),o=Ht(o),[64+Gt(t),144+Vt(e),Zt(n),Wt(i),r>>8,255&r,o>>8,255&o]},umpNoteOff:function(t,e,n,r,i,o){return i=i||0,o=o||0,r=Ht(r=r||0),o=Ht(o),[64+Gt(t),128+Vt(e),Zt(n),Wt(i),r>>8,255&r,o>>8,255&o]},umpAftertouch:function(t,e,n,r,i,o,s){return[64+Gt(t),160+Vt(e),Zt(n),0].concat(Ze(r,i,o,s))},umpAftertouchF:function(t,e,n,r){return on.umpAftertouch(t,e,n,Ye(r))},umpControl:function(t,e,n,r,i,o,s){return rn.includes(n)&&Bt(n),[64+Gt(t),176+Vt(e),zt(n),0].concat(Ze(r,i,o,s))},umpPortamento:function(t,e,n){return[64+Gt(t),176+Vt(e),84,0,Zt(n),0,0,0]},umpPressure:function(t,e,n,r,i,o){return[64+Gt(t),208+Vt(e),0,0].concat(Ze(n,r,i,o))},umpPressureF:function(t,e,n){return on.umpPressure(t,e,Ye(n))},umpProgram:function(t,e,n,r,i){return void 0===r&&void 0===i?[64+Gt(t),192+Vt(e),0,0,Zt(n),0,0,0]:void 0===i?[64+Gt(t),192+Vt(e),0,1,Zt(n),0,te(r),Yt(r)]:[64+Gt(t),192+Vt(e),0,1,Zt(n),0,zt(r),zt(i)]},umpPitchBend:function(t,e,n,r,i,o){return[64+Gt(t),224+Vt(e),0,0].concat(Ze(n,r,i,o))},umpPitchBendF:function(t,e,n){return on.umpPitchBend(t,e,Ye((n+1)/2))},umpPnPitchBend:function(t,e,n,r,i,o,s){return[64+Gt(t),96+Vt(e),Zt(n),0].concat(Ze(r,i,o,s))},umpPnPitchBendF:function(t,e,n,r){return on.umpPnPitchBend(t,e,n,Ye((r+1)/2))},umpRPN:function(t,e,n,r,i,o,s,a){return[64+Gt(t),32+Vt(e),zt(n),zt(r)].concat(Ze(i,o,s,a))},umpNRPN:function(t,e,n,r,i,o,s,a){return[64+Gt(t),48+Vt(e),zt(n),zt(r)].concat(Ze(i,o,s,a))},umpPnRPN:function(t,e,n,r,i,o,s,a){return[64+Gt(t),0+Vt(e),Zt(n),Wt(r)].concat(Ze(i,o,s,a))},umpPnNRPN:function(t,e,n,r,i,o,s,a){return[64+Gt(t),16+Vt(e),Zt(n),Wt(r)].concat(Ze(i,o,s,a))},umpFineTuning:function(t,e,n,r,i,o){return on.umpRPN(t,e,0,1,n,r,i,o)},umpFineTuningF:function(t,e,n){return on.umpFineTuning(t,e,Pt.to32b(re((n%1+1)/2,n)))},umpCoarseTuning:function(t,e,n){return[64+Gt(t),32+Vt(e),0,2,2*zt(n),0,0,0]},umpCoarseTuningF:function(t,e,n){return on.umpCoarseTuning(t,e,n-n%1+64)},umpTuningProgram:function(t,e,n){return[64+Gt(t),32+Vt(e),0,3,2*zt(n),0,0,0]},umpTuningBank:function(t,e,n){return[64+Gt(t),32+Vt(e),0,4,2*zt(n),0,0,0]},umpPnManagement:function(t,e,n,r){for(var i=r.toString().split(""),o=0,s=0;s<i.length;s++)if("S"!=i[s]||1&o){if("D"!=i[s]||2&o){o=r;break}o|=2}else o|=1;return[64+Gt(t),240+Vt(e),Zt(n),Wt(o),0,0,0,0]}};on.umpPnPressure=on.umpAftertouch,on.umpPnPressureF=on.umpAftertouchF,on.umpTranspose=on.umpCoarseTuningF;var sn={umpTuningF:function(t,e,n){return[on.umpCoarseTuningF(t,e,n),on.umpFineTuningF(t,e,n)]},umpTuningA:function(t,e,n){return sn.umpTuningF(t,e,Pt.shift(n))},umpCustomText:function(t,e,n,r,i,o){var s,a=[];for(o=At.lib.toUTF8(""+o),s=0;s<o.length;s++)a.push(o.charCodeAt(s));for(a=fn(a,12),s=0;s<a.length;s++)a[s]=[208+Gt(t),64*pn(a.length,s)+(n?16:0)+Vt(e),r,i].concat(a[s],Qe).slice(0,16);return a},umpCMetadata:function(t,e,n){return sn.umpCustomText(t,e,0,1,0,n)},umpCProjectName:function(t,e,n){return sn.umpCustomText(t,e,0,1,1,n)},umpCCompositionName:function(t,e,n){return sn.umpCustomText(t,e,0,1,2,n)},umpCClipName:function(t,e,n){return sn.umpCustomText(t,e,0,1,3,n)},umpCCopyright:function(t,e,n){return sn.umpCustomText(t,e,0,1,4,n)},umpCComposerName:function(t,e,n){return sn.umpCustomText(t,e,0,1,5,n)},umpCLyricistName:function(t,e,n){return sn.umpCustomText(t,e,0,1,6,n)},umpCArrangerName:function(t,e,n){return sn.umpCustomText(t,e,0,1,7,n)},umpCPublisherName:function(t,e,n){return sn.umpCustomText(t,e,0,1,8,n)},umpCPerformerName:function(t,e,n){return sn.umpCustomText(t,e,0,1,9,n)},umpCAccPerformerName:function(t,e,n){return sn.umpCustomText(t,e,0,1,10,n)},umpCRecordingDate:function(t,e,n){return sn.umpCustomText(t,e,0,1,11,n)},umpCRecordingLocation:function(t,e,n){return sn.umpCustomText(t,e,0,1,12,n)},umpCText:function(t,e,n){return sn.umpCustomText(t,e,0,2,0,n)},umpCLyrics:function(t,e,n){return sn.umpCustomText(t,e,0,2,1,n)},umpCLyricsLanguage:function(t,e,n){return sn.umpCustomText(t,e,0,2,2,n)},umpCRuby:function(t,e,n){return sn.umpCustomText(t,e,0,2,3,n)},umpCRubyLanguage:function(t,e,n){return sn.umpCustomText(t,e,0,2,4,n)}},an={};function un(t,e){Xe[t]=function(){return new Xe(e.apply(this,arguments))},an[t]=function(){return this.send(e.apply(this,arguments))}}function cn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),new Xe(e.apply(this,t))},an[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),this.send(e.apply(this,t))}}function ln(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=e.apply(this,t),r=0;r<n.length;r++)n[r]=new Xe(n[r]);return n},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=e.apply(this,t),r=0;r<n.length;r++)this.send(n[r]);return this}}function hn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1))),new Xe(e.apply(this,t))},an[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1))),this.send(e.apply(this,t))}}function dn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1)));for(var n=e.apply(this,t),r=0;r<n.length;r++)n[r]=new Xe(n[r]);return n},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1)));for(var n=e.apply(this,t),r=0;r<n.length;r++)this.send(n[r]);return this}}function pn(t,e){return 1==t?0:0==e?1:e==t-1?3:2}function fn(t,e){for(var n=[],r=t;r.length;r=r.slice(e))n.push(r.slice(0,e));return n.length?n:[[]]}function mn(t,e){for(var n=fn(e.slice(1,e.length-1),6),r=0;r<n.length;r++)n[r]=new Xe([48+t,16*pn(n.length,r)+n[r].length].concat(n[r],Qe).slice(0,8));return n}function gn(t){var e,n=[];if("string"==typeof t)for(e=0;e<t.length;e++)n.push(t.charCodeAt(e));else for(e=0;e<t.length;e++)n.push(t[e]);for(e=0;e<n.length;e++)if(n[e]!=parseInt(n[e])||n[e]<0||n[e]>255)throw RangeError("Bad data");return n}function _n(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),mn(Gt(t[0]),e.apply(this,t.slice(1)))},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=mn(Gt(t[0]),e.apply(this,t.slice(1))),r=this,i=0;i<n.length;i++)r=r.send(n[i]);return r}}function yn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=e.apply(this,t.slice(1)),r=[],i=0;i<n.length;i++)r=r.concat(mn(Gt(t[0]),n[i]));return r},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t));for(var n=e.apply(this,t.slice(1)),r=this,i=0;i<n.length;i++)for(var o=mn(Gt(t[0]),n[i]),s=0;s<o.length;s++)r=r.send(o[s]);return r}}function vn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),new Xe([16+Gt(t[0])].concat(e.apply(this,t.slice(1)),Qe).slice(0,4))},an[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),this.send([16+Gt(t[0])].concat(e.apply(this,t.slice(1)),Qe).slice(0,4))}}function bn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1))),new Xe([32+Gt(t[0])].concat(e.apply(this,t.slice(1)),Qe).slice(0,4))},an[t]=function(){var t=Array.prototype.slice.call(arguments);return void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1))),this.send([32+Gt(t[0])].concat(e.apply(this,t.slice(1)),Qe).slice(0,4))}}function wn(t,e){Xe[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1)));for(var n=e.apply(this,t.slice(1)),r=0;r<n.length;r++)n[r]=new Xe([32+Gt(t[0])].concat(n[r],Qe).slice(0,4));return n},an[t]=function(){var t=Array.prototype.slice.call(arguments);void 0!==this._gr&&(t=[this._gr].concat(t)),void 0!==this._ch&&(t=[t[0]].concat([this._ch]).concat(t.slice(1)));for(var n=e.apply(this,t.slice(1)),r=this,i=0;i<n.length;i++)r=r.send([32+Gt(t[0])].concat(n[i],Qe).slice(0,4));return r}}function xn(t){E(an,function(e){t.prototype[e]=an[e]})}function Tn(t,e){var n=256*t+e;return n?n>>9||1:0}function kn(t,e,n,r){return 16777216*t+65536*e+256*n+r>>25&127}function Sn(t,e){return t.gr=e,t}function An(t){if(t.isMidi2){var e,n,r,i=t[0]>>4,o=15&t[0];if(1==i||2==i)this._emit(Sn(new Pt(t.slice(1)),o));else if(3==i)n=t[1]>>4,e=15&t[1],0==n?(this._emit(Sn(new Pt([240].concat(t.slice(2,2+e),[247])),o)),this._sx[o]=void 0):1==n?this._sx[o]=t.slice(2,2+e):2==n?this._sx[o]&&(this._sx[o]=this._sx[o].concat(t.slice(2,2+e))):3==n&&(this._sx[o]&&this._emit(Sn(new Pt([240].concat(this._sx[o],t.slice(2,2+e),[247])),o)),this._sx[o]=void 0);else if(4==i){if(e=t[1]>>4,n=15&t[1],2==e||3==e?(this._emit(Sn(new Pt([176+n,2==e?101:99,t[2]]),o)),this._emit(Sn(new Pt([176+n,2==e?100:98,t[3]]),o)),this._emit(Sn(new Pt([176+n,6,t[4]>>1]),o)),this._emit(Sn(new Pt([176+n,38,64*(1&t[4])+(t[4]>>2)]),o))):8!=e&&9!=e||this._emit(Sn(new Pt([t[1],t[2],Tn(t[4],t[5])]),o)),10==e&&this._emit(Sn(new Pt([t[1],t[2],kn(t[4],t[5],t[6],t[7])]),o)),11==e){if(rn.includes(t[2]))return;this._emit(Sn(new Pt([t[1],t[2],kn(t[4],t[5],t[6],t[7])]),o))}13==e&&this._emit(Sn(new Pt([t[1],kn(t[4],t[5],t[6],t[7])]),o)),14==e?(r=16777216*t[4]+65536*t[5]+256*t[6]+t[4]>>18,this._emit(Sn(new Pt([t[1],127&r,r>>7&127]),o))):12==e&&(t[3]&&(this._emit(Sn(new Pt([176+n,0,t[6]]),o)),this._emit(Sn(new Pt([176+n,32,t[7]]),o))),this._emit(Sn(new Pt([t[1],t[4]]),o)))}}else this._emit(t)}function En(){var t=new V;return t._sx=[],t._receive=An,t._resume(),t.MIDI2()}function On(t){if(t.isMidi2)this._emit(t);else{var e=t.gr>=0&&t.gr<=15?t.gr:0;if(t[0]>=128&&t[0]<240)this._emit(At.MIDI2([32+e].concat(t.slice(),Qe).slice(0,4)));else if(t[0]>240&&t[0]<=255&&247!=t[0])this._emit(At.MIDI2([16+e].concat(t.slice(),Qe).slice(0,4)));else if(t.isFullSysEx())for(var n=mn(e,t.slice()),r=0;r<n.length;r++)this._emit(At.MIDI2(n[r]))}}function Cn(){var t=new V;return t._receive=On,t._resume(),t}E(tn,function(t){un(t,tn[t])}),E(en,function(t){cn(t,en[t])}),E(nn,function(t){ln(t,nn[t])}),E(on,function(t){hn(t,on[t])}),E(sn,function(t){dn(t,sn[t])}),E(fe,function(t){vn(t,fe[t])}),E(le,function(t){bn(t,le[t])}),E(he,function(t){bn(t,he[t])}),E(ge,function(t){wn(t,ge[t])}),E(me,function(t){_n(t,me[t])}),E(_e,function(t){yn(t,_e[t])}),xn(Q),Xe.prototype.getTempo=function(){if(this.isTempo())return(this[4]<<24)+(this[5]<<16)+(this[6]<<8)+this[7]},Xe.prototype.getBPM=function(){var t=this.getTempo();if(t)return Math.round(6e9/t)},Xe.prototype.getTimeSignature=function(){if(this.isTimeSignature())return[this[4],1<<this[5]]},Xe.prototype.getTicksPQN=function(){if(this.isTicksPQN())return(this[2]<<8)+this[3]},Xe.prototype.getDelta=function(){if(this.isDelta())return((15&this[1])<<16)+(this[2]<<8)+this[3]},Xe.prototype.getStatus=function(){return this.isFlex()?this[1]>>6:this.isData()||this.isSX()?this[1]>>4:void 0},Xe.prototype.isTempo=function(){return this[0]>>4==13&&this[1]>>4==1&&0==this[2]&&0==this[3]},Xe.prototype.isTimeSignature=function(){return this[0]>>4==13&&this[1]>>4==1&&0==this[2]&&1==this[3]},Xe.prototype.isTicksPQN=function(){return 0==this[0]&&this[1]>>4==3},Xe.prototype.isDelta=function(){return 0==this[0]&&this[1]>>4==4},Xe.prototype.isStartClip=function(){return this.match([240,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0])},Xe.prototype.isEndClip=function(){return this.match([240,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0])},Xe.prototype.isData=function(){return 80==(240&this[0])},Xe.prototype.isFlex=function(){return 208==(240&this[0])},Xe.prototype.isText=function(){return 208==(240&this[0])&&(1==this[2]||2==this[2])},Xe.prototype.isSX=function(){return 48==(240&this[0])},Xe.prototype.isNoteOn=function(){var t=(this[0]||0)>>4,e=(this[1]||0)>>4;return 4==t?9==e:2==t&&9==e&&!!this[3]},Xe.prototype.isNoteOff=function(){var t=(this[0]||0)>>4,e=(this[1]||0)>>4;return 4==t?8==e:2==t&&(8==e||9==e&&!this[3])},Xe.prototype.label=Pt.prototype.label,Xe.prototype.toString=Pt.prototype.toString,Xe.prototype._str=function(){var t=this._string();return t?Fe(this)+" -- "+t:Fe(this)},Xe.prototype._string=function(){var t,e,n,r=this[0]>>4;return 1==r||2==r?new Pt(this.slice(1))._string():(0==r?e=["NOOP","JR Clock","JR Timestamp","Ticks Per Quarter Note","Delta Ticks"][t=this[1]>>4]:3==r?e="SysEx":4==r?(e={0:"Registered Per-Note Controller",1:"Assignable Per-Note Controller",2:"Registered Controller",3:"Assignable Controller",4:"Relative Registered Controller",5:"Relative Assignable Controller",6:"Per-Note Pitch Bend",8:"Note Off",9:"Note On",10:"Poly Pressure",11:"Control Change",12:"Program Change",13:"Channel Pressure",14:"Pitch Bend",15:"Per-Note Management"}[t=this[1]>>4],11==t&&(e={84:"Portamento"}[this[2]]||e),2==t&&(n={"0000":"Pitch Bend Sensitivity","0001":"Fine Tuning","0002":"Coarse Tuning","0003":"Select Tuning Program","0004":"Select Tuning Bank","0005":"Vibrato Depth Range","7f7f":"NONE"}[De(this[2])+""+De(this[3])])&&(e+=": "+n)):5==r?e="Data":13==r&&(0==(t=this[2])?(e={0:"Tempo ",1:"Time Signature ",2:"Metronome",5:"Key Signature",6:"Chord Name"}[t=this[3]],0==t?e+=this.getBPM()+" BPM":1==t&&(e+=this.getTimeSignature().join("/"))):1==t?e={0:"Metadata",1:"Project Name",2:"Composition Name",3:"Clip Name",4:"Copyright",5:"Composer Name",6:"Lyricist Name",7:"Arranger Name",8:"Publisher Name",9:"Primary Performer Name",10:"Accompanying Performer Name",11:"Recording Date",12:"Recording Location"}[t=this[3]]||"Unknown Text":2==t&&(e={0:"Text",1:"Lyrics",2:"Lyrics Language",3:"Ruby",4:"Ruby Language"}[t=this[3]]||"Unknown Text")),15==r&&(e={32:"Start of Clip",33:"End of Clip"}[this[1]]),e)},Xe.prototype._stamp=Pt.prototype._stamp,Xe.prototype._unstamp=Pt.prototype._unstamp,Xe.prototype._stamped=Pt.prototype._stamped,Xe.prototype.match=Pt.prototype.match,At.UMP=Xe,A.prototype.UMP=Xe,At.MIDI2=Xe,A.prototype.MIDI2=Xe,At.M2M1=En,A.prototype.M2M1=At.M2M1,At.M1M2=Cn,A.prototype.M1M2=At.M1M2,At.lib={},At.lib.now=h,At.lib.schedule=d,At.lib.R=m;var Mn,Nn,In=[],jn=0;try{var Rn=URL.createObjectURL(new Blob(["(",function(){function t(){postMessage({}),setTimeout(t,0)}t()}.toString(),")()"],{type:"application/javascript"})),Pn=function(){for(var t=In.length,e=0;e<t;e++)In.shift()();++jn>20&&Mn&&(Mn.terminate(),Mn=void 0)},Dn=function(t){In.push(t),jn=0,Mn||((Mn=new Worker(Rn)).onmessage=Pn)};Dn(function(){At.lib.schedule=Dn})}catch(t){}function Ln(){if(!Nn&&"undefined"!=typeof window){var t=window.AudioContext||window.webkitAudioContext;if(t){(Nn=new t)&&!Nn.createGain&&(Nn.createGain=Nn.createGainNode);var e=function(){if("running"!=Nn.state){Nn.resume();var t=Nn.createOscillator(),n=Nn.createGain();try{n.gain.value=0}catch(t){}n.gain.setTargetAtTime(0,Nn.currentTime,.01),t.connect(n),n.connect(Nn.destination),t.start||(t.start=t.noteOn),t.stop||(t.stop=t.noteOff),t.start(.1),t.stop(.11)}else"undefined"!=typeof document&&(document.removeEventListener("touchstart",e),document.removeEventListener("touchend",e),document.removeEventListener("mousedown",e),document.removeEventListener("keydown",e))};"undefined"!=typeof document&&(document.addEventListener("touchstart",e),document.addEventListener("touchend",e),document.addEventListener("mousedown",e),document.addEventListener("keydown",e)),e()}}}At.lib.openMidiOut=function(t,e){var n=new V;return e._openOut(n),n._info=e._info(t),n},At.lib.openMidiIn=function(t,e){var n=new V;return e._openIn(n),n._info=e._info(t),n},At.lib.registerMidiOut=function(t,e){for(var n=e._info(t),r=0;r<ut._outs.length;r++)if(ut._outs[r].name==n.name)return!1;return n.engine=e,ut._outs.push(n),C&&(D(),C._bad&&(C._repair(),C._resume())),!0},At.lib.registerMidiIn=function(t,e){for(var n=e._info(t),r=0;r<ut._ins.length;r++)if(ut._ins[r].name==n.name)return!1;return n.engine=e,ut._ins.push(n),C&&(D(),C._bad&&(C._repair(),C._resume())),!0},At.lib.unregisterMidiOut=function(t){for(var e=0;e<ut._outs.length;e++)if(ut._outs[e].name==t)return ut._outs.splice(e,e+1),C&&D(),!0;return!1},At.lib.unregisterMidiIn=function(t){for(var e=0;e<ut._ins.length;e++)if(ut._ins[e].name==t)return ut._ins.splice(e,e+1),C&&D(),!0;return!1},At.lib.plug=function(t){for(var e=0;e<ct.length;e++)if(ct[e]==t)return;ct.push(t)},At.lib.unplug=function(t){for(var e=0;e<ct.length;e++)if(ct[e]==t)return void ct.splice(e,1)},At.lib.copyMidiHelpers=Ee,At.lib.copyMidi2Helpers=xn,At.lib.copyUmpHelpers=xn,At.lib.getAudioContext=function(){return Ln(),Nn},At.lib.closeAudioContext=function(){Nn&&Nn.close(),Nn=void 0};var Fn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";At.lib.fromBase64=function(t){var e,n,r,i,o,s,a="",u=0;for(t=t.replace(/[^A-Za-z0-9+/=]/g,"");u<t.length;)e=Fn.indexOf(t.charAt(u++))<<2|(i=Fn.indexOf(t.charAt(u++)))>>4,n=(15&i)<<4|(o=Fn.indexOf(t.charAt(u++)))>>2,r=(3&o)<<6|(s=Fn.indexOf(t.charAt(u++))),a+=String.fromCharCode(e),64!=o&&(a+=String.fromCharCode(n)),64!=s&&(a+=String.fromCharCode(r));return a},At.lib.toBase64=function(t){var e,n,r,i,o,s=0,a=0,u="",c=[];if(!t)return t;do{e=(o=t.charCodeAt(s++)<<16|t.charCodeAt(s++)<<8|t.charCodeAt(s++))>>18&63,n=o>>12&63,r=o>>6&63,i=63&o,c[a++]=Fn.charAt(e)+Fn.charAt(n)+Fn.charAt(r)+Fn.charAt(i)}while(s<t.length);u=c.join("");var l=t.length%3;return l?u.slice(0,l-3)+"===".slice(l):u},At.lib.fromUTF8=function(t){t=void 0===t?"":""+t;var e,n,r,i="";for(e=0;e<t.length;e++){if((n=t.charCodeAt(e))>255)return t;if(n<128)i+=t[e];else if(192==(224&n)){if(n=(31&n)<<6,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;n+=63&r,i+=String.fromCharCode(n)}else if(224==(240&n)){if(n=(15&n)<<12,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;if(n+=(63&r)<<6,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;n+=63&r,i+=String.fromCharCode(n)}else if(240==(248&n)){if(n=(7&n)<<18,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;if(n+=(63&r)<<12,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;if(n+=(63&r)<<6,++e>=t.length)return t;if(128!=(192&(r=t.charCodeAt(e))))return t;if((n+=63&r)>1114111)return t;n-=65536,i+=String.fromCharCode(55296+(n>>10)),i+=String.fromCharCode(56320+(1023&n))}}return i},At.lib.toUTF8=function(t){t=void 0===t?"":""+t;var e,n,r="";for(e=0;e<t.length;e++)(n=t.charCodeAt(e))<128?r+=t[e]:n<2048?(r+=String.fromCharCode(192+(n>>6)),r+=String.fromCharCode(128+(63&n))):n<65536?(r+=String.fromCharCode(224+(n>>12)),r+=String.fromCharCode(128+(n>>6&63)),r+=String.fromCharCode(128+(63&n))):(r+=String.fromCharCode(240+(n>>18)),r+=String.fromCharCode(128+(n>>12&63)),r+=String.fromCharCode(128+(n>>6&63)),r+=String.fromCharCode(128+(63&n)));return r};var $n=[],Bn={},qn={},Un=a.Promise;function Vn(t,e,n){this.name=t,this.message=e,this.code=n}function Gn(t,e){this.bubbles=!1,this.cancelBubble=!1,this.cancelable=!1,this.currentTarget=e,this.defaultPrevented=!1,this.eventPhase=0,this.path=[],this.port=t,this.returnValue=!0,this.srcElement=e,this.target=e,this.timeStamp=h(),this.type="statechange"}function zn(t,e){this.bubbles=!1,this.cancelBubble=!1,this.cancelable=!1,this.currentTarget=t,this.data=e,this.defaultPrevented=!1,this.eventPhase=0,this.path=[],this.receivedTime=h(),this.returnValue=!0,this.srcElement=t,this.target=t,this.timeStamp=this.receivedTime,this.type="midimessage"}function Wn(t,e){t&&(t.onstatechange&&t.onstatechange(new Gn(t,t)),e.onstatechange&&e.onstatechange(new Gn(t,e)))}function Jn(t,e){var n=this,r=!1,i=null,o=null;this.type="input",this.id=e.id,this.name=e.name,this.manufacturer=e.man,this.version=e.ver,Object.defineProperty(this,"state",{get:function(){return e.connected?"connected":"disconnected"},enumerable:!0}),Object.defineProperty(this,"connection",{get:function(){return r?e.proxy?"open":"pending":"closed"},enumerable:!0}),Object.defineProperty(this,"onmidimessage",{get:function(){return o},set:function(t){f(t)?(o=t,r||n.open().then(p,p)):o=null},enumerable:!0}),Object.defineProperty(this,"onstatechange",{get:function(){return i},set:function(t){i=f(t)?t:null},enumerable:!0}),this.open=function(){return new Un(function(i,o){r?i(n):e.open().then(function(){r||(r=!0,Wn(n,t)),i(n)},function(){o(new Vn("InvalidAccessError","Port is not available",15))})})},this.close=function(){return new Un(function(i){r&&(r=!1,e.close(),Wn(n,t)),i(n)})},Object.freeze(this)}function Hn(t){for(var e,n;t.length;){for(e=0;e<t.length&&!(t[e]==parseInt(t[e])&&t[e]>=128&&t[e]<=255&&247!=t[e]);e++);if(t.splice(0,e),!t.length)return;if(240==t[0]){for(e=1;e<t.length&&247!=t[e];e++);if(e==t.length)return;return t.splice(0,e+1)}if((n=Kn(t[0])+1)>t.length)return;for(e=1;e<n&&!(t[e]!=parseInt(t[e])||t[e]<0||t[e]>=128);e++);if(e==n)return t.splice(0,e);t.splice(0,e)}}function Xn(t,n,r,i){var o=this;this.id=t,this.name=n,this.man=r,this.ver=i,this.connected=!0,this.ports=[],this.pending=[],this.proxy=void 0,this.queue=[],this.onmidi=function(t){var n;for(o.queue=o.queue.concat(t.slice()),n=Hn(o.queue);n;n=Hn(o.queue))for(e=0;e<o.ports.length;e++)o.ports[e][0].onmidimessage&&(240!=n[0]||o.ports[e][1])&&o.ports[e][0].onmidimessage(new zn(o,new Uint8Array(n)))}}function Kn(t){return t>=128&&t<=191||t>=224&&t<=239||242==t?2:t>=192&&t<=223||241==t||243==t?1:0}"function"!=typeof Un&&((Un=function(t){this.executor=t}).prototype.then=function(t,e){"function"!=typeof t&&(t=p),"function"!=typeof e&&(e=p),this.executor(t,e)}),Xn.prototype.open=function(){var t=this;return new Un(function(e,n){var r;t.proxy||!t.connected?e():(t.pending.push([e,n]),1==t.pending.length&&At().openMidiIn(t.name).or(function(){for(r=0;r<t.pending.length;r++)t.pending[r][1]();t.pending=[]}).and(function(){for(t.proxy=this,t.proxy.connect(t.onmidi),r=0;r<t.pending.length;r++)t.pending[r][0]();t.pending=[]}))})},Xn.prototype.close=function(){var t;if(this.proxy){for(t=0;t<this.ports.length;t++)if("open"==this.ports[t].connection)return;this.proxy.close(),this.proxy=void 0}},Xn.prototype.disconnect=function(){this.connected=!1,this.proxy&&(this.proxy.close(),this.proxy=void 0)},Xn.prototype.reconnect=function(){var t,e,n=this,r=[];for(this.connected=!0,t=0;t<$n.length;t++)"closed"==(e=$n[t].inputs.get(this.id)).connection?Wn(e,$n[t]):r.push([e,$n[t]]);r.length&&At()._openMidiInNR(n.name).or(function(){for(t=0;t<r.length;t++)r[t][0].close()}).and(function(){for(n.proxy=this,n.proxy.connect(n.onmidi),t=0;t<r.length;t++)Wn(r[t][0],r[t][1])})};var Qn="Failed to execute 'send' on 'MIDIOutput': ";function Zn(t,e){var n,r,i,o=[];for(n=0;n<t.length;n++)if(t[n]!=parseInt(t[n])||t[n]<0||t[n]>255)throw TypeError(Qn+t[n]+" is not a UInt8 value.");for(r=0,n=0;n<t.length;n++)if(r){if(t[n]>127)throw TypeError(Qn+"Unexpected status byte at index "+n+" ("+t[n]+").");i.push(t[n]),r--}else{if(t[n]<128)throw TypeError(Qn+"Running status is not allowed at index "+n+" ("+t[n]+").");if(247==t[n])throw TypeError(Qn+"Unexpected end of system exclusive message at index "+n+" ("+t[n]+").");if(i=[t[n]],o.push(i),240==t[n]){if(!e)throw new Vn("InvalidAccessError",Qn+"System exclusive messag is not allowed at index "+n+" ("+t[n]+").",15);for(r=-1;n<t.length;n++)if(i.push(t[n]),247==t[n]){r=0;break}}else r=Kn(t[n])}if(r)throw TypeError(Qn+"Message is incomplete");return[o]}function Yn(t,e){var n=this,r=!1,i=null;this.type="output",this.id=e.id,this.name=e.name,this.manufacturer=e.man,this.version=e.ver,Object.defineProperty(this,"state",{get:function(){return e.connected?"connected":"disconnected"},enumerable:!0}),Object.defineProperty(this,"connection",{get:function(){return r?e.proxy?"open":"pending":"closed"},enumerable:!0}),Object.defineProperty(this,"onstatechange",{get:function(){return i},set:function(t){i=f(t)?t:null},enumerable:!0}),this.open=function(){return new Un(function(i,o){r?i(n):e.open().then(function(){r||(r=!0,Wn(n,t)),i(n)},function(){o(new Vn("InvalidAccessError","Port is not available",15))})})},this.close=function(){return new Un(function(i){r&&(r=!1,n.clear(),e.close(),Wn(n,t)),i(n)})},this.clear=function(){},this.send=function(i,o){if(Zn(i,t.sysexEnabled),!e.connected)throw new Vn("InvalidStateError","Port is not connected",11);if(r){var s=h();o>s?setTimeout(function(){e.proxy.send(i)},o-s):e.proxy.send(i)}else this.open().then(function(){n.send(i,o)},p)},Object.freeze(this)}function tr(t,e,n,r){this.id=t,this.name=e,this.man=n,this.ver=r,this.connected=!0,this.ports=[],this.pending=[],this.proxy=void 0}function er(t){this.has=function(e){return t.hasOwnProperty(e)&&t[e].connected},this.keys=function(){try{var e=new Map;for(var n in t)this.has(n)&&e.set(n,this.get(n));return e.keys()}catch(t){}},this.values=function(){try{var e=new Map;for(var n in t)this.has(n)&&e.set(n,this.get(n));return e.values()}catch(t){}},this.entries=function(){try{var e=new Map;for(var n in t)this.has(n)&&e.set(n,this.get(n));return e.entries()}catch(t){}},this.forEach=function(e,n){for(var r in void 0===n&&(n=this),t)this.has(r)&&e.call(n,this.get(r),r,this)},Object.defineProperty(this,"size",{get:function(){var e=0;for(var n in t)this.has(n)&&e++;return e},enumerable:!0})}function nr(t,e){this.get=function(n){if(qn.hasOwnProperty(n)&&qn[n].connected)return e[n]||(e[n]=new Jn(t,qn[n]),qn[n].ports.push([e[n],t.sysexEnabled])),e[n]},Object.freeze(this)}function rr(t,e){this.get=function(n){if(Bn.hasOwnProperty(n)&&Bn[n].connected)return e[n]||(e[n]=new Yn(t,Bn[n]),Bn[n].ports.push([e[n],t.sysexEnabled])),e[n]},Object.freeze(this)}function ir(t){var e,n,r,i;for(e=0;e<t.inputs.added.length;e++)r=t.inputs.added[e],qn.hasOwnProperty(r.id)||(qn[r.id]=new Xn(r.id,r.name,r.manufacturer,r.version)),qn[r.id].reconnect();for(e=0;e<t.outputs.added.length;e++)r=t.outputs.added[e],Bn.hasOwnProperty(r.id)||(Bn[r.id]=new tr(r.id,r.name,r.manufacturer,r.version)),Bn[r.id].reconnect();for(e=0;e<t.inputs.removed.length;e++)if(r=t.inputs.removed[e],qn.hasOwnProperty(r.id)){for(i=[],n=0;n<$n.length;n++)i.push([$n[n].inputs.get(r.id),$n[n]]);for(qn[r.id].disconnect(),n=0;n<i.length;n++)Wn(i[n][0],i[n][1])}for(e=0;e<t.outputs.removed.length;e++)if(r=t.outputs.removed[e],Bn.hasOwnProperty(r.id)){for(i=[],n=0;n<$n.length;n++)i.push([$n[n].outputs.get(r.id),$n[n]]);for(Bn[r.id].disconnect(),n=0;n<i.length;n++)Wn(i[n][0],i[n][1])}}function or(t){var e,n,r={},i={},o=null,s=this;this.sysexEnabled=t,this.inputs=new nr(s,r),this.outputs=new rr(s,i),Object.defineProperty(this,"onstatechange",{get:function(){return o},set:function(t){o=f(t)?t:null},enumerable:!0}),Object.freeze(this);var a=C._info;for(e=0;e<a.inputs.length;e++)n=a.inputs[e],qn.hasOwnProperty(n.id)||(qn[n.id]=new Xn(n.id,n.name,n.manufacturer,n.version));for(e=0;e<a.outputs.length;e++)n=a.outputs[e],Bn.hasOwnProperty(n.id)||(Bn[n.id]=new tr(n.id,n.name,n.manufacturer,n.version));$n.length||At().onChange(ir),$n.push(this)}return tr.prototype.open=function(){var t=this;return new Un(function(e,n){var r;t.proxy||!t.connected?e():(t.pending.push([e,n]),1==t.pending.length&&At().openMidiOut(t.name).or(function(){for(r=0;r<t.pending.length;r++)t.pending[r][1]();t.pending=[]}).and(function(){for(t.proxy=this,r=0;r<t.pending.length;r++)t.pending[r][0]();t.pending=[]}))})},tr.prototype.close=function(){var t;if(this.proxy){for(t=0;t<this.ports.length;t++)if("open"==this.ports[t].connection)return;this.proxy.close(),this.proxy=void 0}},tr.prototype.disconnect=function(){this.connected=!1,this.proxy&&(this.proxy.close(),this.proxy=void 0)},tr.prototype.reconnect=function(){var t,e,n=this,r=[];for(this.connected=!0,t=0;t<$n.length;t++)"closed"==(e=$n[t].outputs.get(this.id)).connection?Wn(e,$n[t]):r.push([e,$n[t]]);r.length&&At()._openMidiOutNR(n.name).or(function(){for(t=0;t<r.length;t++)r[t][0].close()}).and(function(){for(n.proxy=this,t=0;t<r.length;t++)Wn(r[t][0],r[t][1])})},nr.prototype=new er(qn),nr.prototype.constructor=nr,rr.prototype=new er(Bn),rr.prototype.constructor=rr,At.requestMIDIAccess=function(t){return new Un(function(e,n){At.JZZ(t).or(function(){}).and(function(){var r=!(!t||!t.sysex);if(r&&!this.info().sysex)n(new Vn("SecurityError","Sysex is not allowed",18));else{var i=new or(r);e(i)}})})},"undefined"==typeof navigator||navigator.requestMIDIAccess||(navigator.requestMIDIAccess=At.requestMIDIAccess),At.close=function(){at._close&&at._close()},At}()},2543(t,e,n){var r;t=n.nmd(t),function(){var i,o="Expected a function",s="__lodash_hash_undefined__",a="__lodash_placeholder__",u=16,c=32,l=64,h=128,d=256,p=1/0,f=9007199254740991,m=NaN,g=4294967295,_=[["ary",h],["bind",1],["bindKey",2],["curry",8],["curryRight",u],["flip",512],["partial",c],["partialRight",l],["rearg",d]],y="[object Arguments]",v="[object Array]",b="[object Boolean]",w="[object Date]",x="[object Error]",T="[object Function]",k="[object GeneratorFunction]",S="[object Map]",A="[object Number]",E="[object Object]",O="[object Promise]",C="[object RegExp]",M="[object Set]",N="[object String]",I="[object Symbol]",j="[object WeakMap]",R="[object ArrayBuffer]",P="[object DataView]",D="[object Float32Array]",L="[object Float64Array]",F="[object Int8Array]",$="[object Int16Array]",B="[object Int32Array]",q="[object Uint8Array]",U="[object Uint8ClampedArray]",V="[object Uint16Array]",G="[object Uint32Array]",z=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,J=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,X=/[&<>"']/g,K=RegExp(H.source),Q=RegExp(X.source),Z=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,tt=/<%=([\s\S]+?)%>/g,et=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nt=/^\w*$/,rt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/[\\^$.*+?()[\]{}|]/g,ot=RegExp(it.source),st=/^\s+/,at=/\s/,ut=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ct=/\{\n\/\* \[wrapped with (.+)\] \*/,lt=/,? & /,ht=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,dt=/[()=,{}\[\]\/\s]/,pt=/\\(\\)?/g,ft=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,mt=/\w*$/,gt=/^[-+]0x[0-9a-f]+$/i,_t=/^0b[01]+$/i,yt=/^\[object .+?Constructor\]$/,vt=/^0o[0-7]+$/i,bt=/^(?:0|[1-9]\d*)$/,wt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,xt=/($^)/,Tt=/['\n\r\u2028\u2029\\]/g,kt="\\ud800-\\udfff",St="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",At="\\u2700-\\u27bf",Et="a-z\\xdf-\\xf6\\xf8-\\xff",Ot="A-Z\\xc0-\\xd6\\xd8-\\xde",Ct="\\ufe0e\\ufe0f",Mt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Nt="['’]",It="["+kt+"]",jt="["+Mt+"]",Rt="["+St+"]",Pt="\\d+",Dt="["+At+"]",Lt="["+Et+"]",Ft="[^"+kt+Mt+Pt+At+Et+Ot+"]",$t="\\ud83c[\\udffb-\\udfff]",Bt="[^"+kt+"]",qt="(?:\\ud83c[\\udde6-\\uddff]){2}",Ut="[\\ud800-\\udbff][\\udc00-\\udfff]",Vt="["+Ot+"]",Gt="\\u200d",zt="(?:"+Lt+"|"+Ft+")",Wt="(?:"+Vt+"|"+Ft+")",Jt="(?:['’](?:d|ll|m|re|s|t|ve))?",Ht="(?:['’](?:D|LL|M|RE|S|T|VE))?",Xt="(?:"+Rt+"|"+$t+")"+"?",Kt="["+Ct+"]?",Qt=Kt+Xt+("(?:"+Gt+"(?:"+[Bt,qt,Ut].join("|")+")"+Kt+Xt+")*"),Zt="(?:"+[Dt,qt,Ut].join("|")+")"+Qt,Yt="(?:"+[Bt+Rt+"?",Rt,qt,Ut,It].join("|")+")",te=RegExp(Nt,"g"),ee=RegExp(Rt,"g"),ne=RegExp($t+"(?="+$t+")|"+Yt+Qt,"g"),re=RegExp([Vt+"?"+Lt+"+"+Jt+"(?="+[jt,Vt,"$"].join("|")+")",Wt+"+"+Ht+"(?="+[jt,Vt+zt,"$"].join("|")+")",Vt+"?"+zt+"+"+Jt,Vt+"+"+Ht,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Pt,Zt].join("|"),"g"),ie=RegExp("["+Gt+kt+St+Ct+"]"),oe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,se=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ae=-1,ue={};ue[D]=ue[L]=ue[F]=ue[$]=ue[B]=ue[q]=ue[U]=ue[V]=ue[G]=!0,ue[y]=ue[v]=ue[R]=ue[b]=ue[P]=ue[w]=ue[x]=ue[T]=ue[S]=ue[A]=ue[E]=ue[C]=ue[M]=ue[N]=ue[j]=!1;var ce={};ce[y]=ce[v]=ce[R]=ce[P]=ce[b]=ce[w]=ce[D]=ce[L]=ce[F]=ce[$]=ce[B]=ce[S]=ce[A]=ce[E]=ce[C]=ce[M]=ce[N]=ce[I]=ce[q]=ce[U]=ce[V]=ce[G]=!0,ce[x]=ce[T]=ce[j]=!1;var le={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},he=parseFloat,de=parseInt,pe="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,fe="object"==typeof self&&self&&self.Object===Object&&self,me=pe||fe||Function("return this")(),ge=e&&!e.nodeType&&e,_e=ge&&t&&!t.nodeType&&t,ye=_e&&_e.exports===ge,ve=ye&&pe.process,be=function(){try{var t=_e&&_e.require&&_e.require("util").types;return t||ve&&ve.binding&&ve.binding("util")}catch(t){}}(),we=be&&be.isArrayBuffer,xe=be&&be.isDate,Te=be&&be.isMap,ke=be&&be.isRegExp,Se=be&&be.isSet,Ae=be&&be.isTypedArray;function Ee(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Oe(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var s=t[i];e(r,s,n(s),t)}return r}function Ce(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Me(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Ne(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Ie(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var s=t[n];e(s,n,t)&&(o[i++]=s)}return o}function je(t,e){return!!(null==t?0:t.length)&&Ve(t,e,0)>-1}function Re(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function Pe(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function De(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function Le(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function Fe(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function $e(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Be=Je("length");function qe(t,e,n){var r;return n(t,function(t,n,i){if(e(t,n,i))return r=n,!1}),r}function Ue(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function Ve(t,e,n){return e==e?function(t,e,n){var r=n-1,i=t.length;for(;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):Ue(t,ze,n)}function Ge(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function ze(t){return t!=t}function We(t,e){var n=null==t?0:t.length;return n?Ke(t,e)/n:m}function Je(t){return function(e){return null==e?i:e[t]}}function He(t){return function(e){return null==t?i:t[e]}}function Xe(t,e,n,r,i){return i(t,function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)}),n}function Ke(t,e){for(var n,r=-1,o=t.length;++r<o;){var s=e(t[r]);s!==i&&(n=n===i?s:n+s)}return n}function Qe(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ze(t){return t?t.slice(0,gn(t)+1).replace(st,""):t}function Ye(t){return function(e){return t(e)}}function tn(t,e){return Pe(e,function(e){return t[e]})}function en(t,e){return t.has(e)}function nn(t,e){for(var n=-1,r=t.length;++n<r&&Ve(e,t[n],0)>-1;);return n}function rn(t,e){for(var n=t.length;n--&&Ve(e,t[n],0)>-1;);return n}var on=He({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),sn=He({"&":"&","<":"<",">":">",'"':""","'":"'"});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({"&":"&","<":"<",">":">",""":'"',"'":"'"});var yn=function t(e){var n,r=(e=null==e?me:yn.defaults(me.Object(),e,yn.pick(me,se))).Array,at=e.Date,kt=e.Error,St=e.Function,At=e.Math,Et=e.Object,Ot=e.RegExp,Ct=e.String,Mt=e.TypeError,Nt=r.prototype,It=St.prototype,jt=Et.prototype,Rt=e["__core-js_shared__"],Pt=It.toString,Dt=jt.hasOwnProperty,Lt=0,Ft=(n=/[^.]+$/.exec(Rt&&Rt.keys&&Rt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",$t=jt.toString,Bt=Pt.call(Et),qt=me._,Ut=Ot("^"+Pt.call(Dt).replace(it,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Vt=ye?e.Buffer:i,Gt=e.Symbol,zt=e.Uint8Array,Wt=Vt?Vt.allocUnsafe:i,Jt=ln(Et.getPrototypeOf,Et),Ht=Et.create,Xt=jt.propertyIsEnumerable,Kt=Nt.splice,Qt=Gt?Gt.isConcatSpreadable:i,Zt=Gt?Gt.iterator:i,Yt=Gt?Gt.toStringTag:i,ne=function(){try{var t=po(Et,"defineProperty");return t({},"",{}),t}catch(t){}}(),ie=e.clearTimeout!==me.clearTimeout&&e.clearTimeout,le=at&&at.now!==me.Date.now&&at.now,pe=e.setTimeout!==me.setTimeout&&e.setTimeout,fe=At.ceil,ge=At.floor,_e=Et.getOwnPropertySymbols,ve=Vt?Vt.isBuffer:i,be=e.isFinite,Be=Nt.join,He=ln(Et.keys,Et),vn=At.max,bn=At.min,wn=at.now,xn=e.parseInt,Tn=At.random,kn=Nt.reverse,Sn=po(e,"DataView"),An=po(e,"Map"),En=po(e,"Promise"),On=po(e,"Set"),Cn=po(e,"WeakMap"),Mn=po(Et,"create"),Nn=Cn&&new Cn,In={},jn=$o(Sn),Rn=$o(An),Pn=$o(En),Dn=$o(On),Ln=$o(Cn),Fn=Gt?Gt.prototype:i,$n=Fn?Fn.valueOf:i,Bn=Fn?Fn.toString:i;function qn(t){if(na(t)&&!zs(t)&&!(t instanceof zn)){if(t instanceof Gn)return t;if(Dt.call(t,"__wrapped__"))return Bo(t)}return new Gn(t)}var Un=function(){function t(){}return function(e){if(!ea(e))return{};if(Ht)return Ht(e);t.prototype=e;var n=new t;return t.prototype=i,n}}();function Vn(){}function Gn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=i}function zn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=g,this.__views__=[]}function Wn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Jn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Hn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Xn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Hn;++e<n;)this.add(t[e])}function Kn(t){var e=this.__data__=new Jn(t);this.size=e.size}function Qn(t,e){var n=zs(t),r=!n&&Gs(t),i=!n&&!r&&Xs(t),o=!n&&!r&&!i&&la(t),s=n||r||i||o,a=s?Qe(t.length,Ct):[],u=a.length;for(var c in t)!e&&!Dt.call(t,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||bo(c,u))||a.push(c);return a}function Zn(t){var e=t.length;return e?t[Xr(0,e-1)]:i}function Yn(t,e){return Do(Mi(t),ur(e,0,t.length))}function tr(t){return Do(Mi(t))}function er(t,e,n){(n!==i&&!qs(t[e],n)||n===i&&!(e in t))&&sr(t,e,n)}function nr(t,e,n){var r=t[e];Dt.call(t,e)&&qs(r,n)&&(n!==i||e in t)||sr(t,e,n)}function rr(t,e){for(var n=t.length;n--;)if(qs(t[n][0],e))return n;return-1}function ir(t,e,n,r){return pr(t,function(t,i,o){e(r,t,n(t),o)}),r}function or(t,e){return t&&Ni(e,Ia(e),t)}function sr(t,e,n){"__proto__"==e&&ne?ne(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function ar(t,e){for(var n=-1,o=e.length,s=r(o),a=null==t;++n<o;)s[n]=a?i:Ea(t,e[n]);return s}function ur(t,e,n){return t==t&&(n!==i&&(t=t<=n?t:n),e!==i&&(t=t>=e?t:e)),t}function cr(t,e,n,r,o,s){var a,u=1&e,c=2&e,l=4&e;if(n&&(a=o?n(t,r,o,s):n(t)),a!==i)return a;if(!ea(t))return t;var h=zs(t);if(h){if(a=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&Dt.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!u)return Mi(t,a)}else{var d=go(t),p=d==T||d==k;if(Xs(t))return ki(t,u);if(d==E||d==y||p&&!o){if(a=c||p?{}:yo(t),!u)return c?function(t,e){return Ni(t,mo(t),e)}(t,function(t,e){return t&&Ni(e,ja(e),t)}(a,t)):function(t,e){return Ni(t,fo(t),e)}(t,or(a,t))}else{if(!ce[d])return o?t:{};a=function(t,e,n){var r=t.constructor;switch(e){case R:return Si(t);case b:case w:return new r(+t);case P:return function(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case D:case L:case F:case $:case B:case q:case U:case V:case G:return Ai(t,n);case S:return new r;case A:case N:return new r(t);case C:return function(t){var e=new t.constructor(t.source,mt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case M:return new r;case I:return i=t,$n?Et($n.call(i)):{}}var i}(t,d,u)}}s||(s=new Kn);var f=s.get(t);if(f)return f;s.set(t,a),aa(t)?t.forEach(function(r){a.add(cr(r,e,n,r,t,s))}):ra(t)&&t.forEach(function(r,i){a.set(i,cr(r,e,n,i,t,s))});var m=h?i:(l?c?oo:io:c?ja:Ia)(t);return Ce(m||t,function(r,i){m&&(r=t[i=r]),nr(a,i,cr(r,e,n,i,t,s))}),a}function lr(t,e,n){var r=n.length;if(null==t)return!r;for(t=Et(t);r--;){var o=n[r],s=e[o],a=t[o];if(a===i&&!(o in t)||!s(a))return!1}return!0}function hr(t,e,n){if("function"!=typeof t)throw new Mt(o);return Io(function(){t.apply(i,n)},e)}function dr(t,e,n,r){var i=-1,o=je,s=!0,a=t.length,u=[],c=e.length;if(!a)return u;n&&(e=Pe(e,Ye(n))),r?(o=Re,s=!1):e.length>=200&&(o=en,s=!1,e=new Xn(e));t:for(;++i<a;){var l=t[i],h=null==n?l:n(l);if(l=r||0!==l?l:0,s&&h==h){for(var d=c;d--;)if(e[d]===h)continue t;u.push(l)}else o(e,h,r)||u.push(l)}return u}qn.templateSettings={escape:Z,evaluate:Y,interpolate:tt,variable:"",imports:{_:qn}},qn.prototype=Vn.prototype,qn.prototype.constructor=qn,Gn.prototype=Un(Vn.prototype),Gn.prototype.constructor=Gn,zn.prototype=Un(Vn.prototype),zn.prototype.constructor=zn,Wn.prototype.clear=function(){this.__data__=Mn?Mn(null):{},this.size=0},Wn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Wn.prototype.get=function(t){var e=this.__data__;if(Mn){var n=e[t];return n===s?i:n}return Dt.call(e,t)?e[t]:i},Wn.prototype.has=function(t){var e=this.__data__;return Mn?e[t]!==i:Dt.call(e,t)},Wn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Mn&&e===i?s:e,this},Jn.prototype.clear=function(){this.__data__=[],this.size=0},Jn.prototype.delete=function(t){var e=this.__data__,n=rr(e,t);return!(n<0)&&(n==e.length-1?e.pop():Kt.call(e,n,1),--this.size,!0)},Jn.prototype.get=function(t){var e=this.__data__,n=rr(e,t);return n<0?i:e[n][1]},Jn.prototype.has=function(t){return rr(this.__data__,t)>-1},Jn.prototype.set=function(t,e){var n=this.__data__,r=rr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(An||Jn),string:new Wn}},Hn.prototype.delete=function(t){var e=lo(this,t).delete(t);return this.size-=e?1:0,e},Hn.prototype.get=function(t){return lo(this,t).get(t)},Hn.prototype.has=function(t){return lo(this,t).has(t)},Hn.prototype.set=function(t,e){var n=lo(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Xn.prototype.add=Xn.prototype.push=function(t){return this.__data__.set(t,s),this},Xn.prototype.has=function(t){return this.__data__.has(t)},Kn.prototype.clear=function(){this.__data__=new Jn,this.size=0},Kn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Kn.prototype.get=function(t){return this.__data__.get(t)},Kn.prototype.has=function(t){return this.__data__.has(t)},Kn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Jn){var r=n.__data__;if(!An||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(t,e),this.size=n.size,this};var pr=Ri(wr),fr=Ri(xr,!0);function mr(t,e){var n=!0;return pr(t,function(t,r,i){return n=!!e(t,r,i)}),n}function gr(t,e,n){for(var r=-1,o=t.length;++r<o;){var s=t[r],a=e(s);if(null!=a&&(u===i?a==a&&!ca(a):n(a,u)))var u=a,c=s}return c}function _r(t,e){var n=[];return pr(t,function(t,r,i){e(t,r,i)&&n.push(t)}),n}function yr(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=vo),i||(i=[]);++o<s;){var a=t[o];e>0&&n(a)?e>1?yr(a,e-1,n,r,i):De(i,a):r||(i[i.length]=a)}return i}var vr=Pi(),br=Pi(!0);function wr(t,e){return t&&vr(t,e,Ia)}function xr(t,e){return t&&br(t,e,Ia)}function Tr(t,e){return Ie(e,function(e){return Zs(t[e])})}function kr(t,e){for(var n=0,r=(e=bi(e,t)).length;null!=t&&n<r;)t=t[Fo(e[n++])];return n&&n==r?t:i}function Sr(t,e,n){var r=e(t);return zs(t)?r:De(r,n(t))}function Ar(t){return null==t?t===i?"[object Undefined]":"[object Null]":Yt&&Yt in Et(t)?function(t){var e=Dt.call(t,Yt),n=t[Yt];try{t[Yt]=i;var r=!0}catch(t){}var o=$t.call(t);r&&(e?t[Yt]=n:delete t[Yt]);return o}(t):function(t){return $t.call(t)}(t)}function Er(t,e){return t>e}function Or(t,e){return null!=t&&Dt.call(t,e)}function Cr(t,e){return null!=t&&e in Et(t)}function Mr(t,e,n){for(var o=n?Re:je,s=t[0].length,a=t.length,u=a,c=r(a),l=1/0,h=[];u--;){var d=t[u];u&&e&&(d=Pe(d,Ye(e))),l=bn(d.length,l),c[u]=!n&&(e||s>=120&&d.length>=120)?new Xn(u&&d):i}d=t[0];var p=-1,f=c[0];t:for(;++p<s&&h.length<l;){var m=d[p],g=e?e(m):m;if(m=n||0!==m?m:0,!(f?en(f,g):o(h,g,n))){for(u=a;--u;){var _=c[u];if(!(_?en(_,g):o(t[u],g,n)))continue t}f&&f.push(g),h.push(m)}}return h}function Nr(t,e,n){var r=null==(t=Co(t,e=bi(e,t)))?t:t[Fo(Qo(e))];return null==r?i:Ee(r,t,n)}function Ir(t){return na(t)&&Ar(t)==y}function jr(t,e,n,r,o){return t===e||(null==t||null==e||!na(t)&&!na(e)?t!=t&&e!=e:function(t,e,n,r,o,s){var a=zs(t),u=zs(e),c=a?v:go(t),l=u?v:go(e),h=(c=c==y?E:c)==E,d=(l=l==y?E:l)==E,p=c==l;if(p&&Xs(t)){if(!Xs(e))return!1;a=!0,h=!1}if(p&&!h)return s||(s=new Kn),a||la(t)?no(t,e,n,r,o,s):function(t,e,n,r,i,o,s){switch(n){case P:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case R:return!(t.byteLength!=e.byteLength||!o(new zt(t),new zt(e)));case b:case w:case A:return qs(+t,+e);case x:return t.name==e.name&&t.message==e.message;case C:case N:return t==e+"";case S:var a=cn;case M:var u=1&r;if(a||(a=dn),t.size!=e.size&&!u)return!1;var c=s.get(t);if(c)return c==e;r|=2,s.set(t,e);var l=no(a(t),a(e),r,i,o,s);return s.delete(t),l;case I:if($n)return $n.call(t)==$n.call(e)}return!1}(t,e,c,n,r,o,s);if(!(1&n)){var f=h&&Dt.call(t,"__wrapped__"),m=d&&Dt.call(e,"__wrapped__");if(f||m){var g=f?t.value():t,_=m?e.value():e;return s||(s=new Kn),o(g,_,n,r,s)}}if(!p)return!1;return s||(s=new Kn),function(t,e,n,r,o,s){var a=1&n,u=io(t),c=u.length,l=io(e),h=l.length;if(c!=h&&!a)return!1;var d=c;for(;d--;){var p=u[d];if(!(a?p in e:Dt.call(e,p)))return!1}var f=s.get(t),m=s.get(e);if(f&&m)return f==e&&m==t;var g=!0;s.set(t,e),s.set(e,t);var _=a;for(;++d<c;){var y=t[p=u[d]],v=e[p];if(r)var b=a?r(v,y,p,e,t,s):r(y,v,p,t,e,s);if(!(b===i?y===v||o(y,v,n,r,s):b)){g=!1;break}_||(_="constructor"==p)}if(g&&!_){var w=t.constructor,x=e.constructor;w==x||!("constructor"in t)||!("constructor"in e)||"function"==typeof w&&w instanceof w&&"function"==typeof x&&x instanceof x||(g=!1)}return s.delete(t),s.delete(e),g}(t,e,n,r,o,s)}(t,e,n,r,jr,o))}function Rr(t,e,n,r){var o=n.length,s=o,a=!r;if(null==t)return!s;for(t=Et(t);o--;){var u=n[o];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<s;){var c=(u=n[o])[0],l=t[c],h=u[1];if(a&&u[2]){if(l===i&&!(c in t))return!1}else{var d=new Kn;if(r)var p=r(l,h,c,t,e,d);if(!(p===i?jr(h,l,3,r,d):p))return!1}}return!0}function Pr(t){return!(!ea(t)||(e=t,Ft&&Ft in e))&&(Zs(t)?Ut:yt).test($o(t));var e}function Dr(t){return"function"==typeof t?t:null==t?iu:"object"==typeof t?zs(t)?Ur(t[0],t[1]):qr(t):pu(t)}function Lr(t){if(!So(t))return He(t);var e=[];for(var n in Et(t))Dt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Fr(t){if(!ea(t))return function(t){var e=[];if(null!=t)for(var n in Et(t))e.push(n);return e}(t);var e=So(t),n=[];for(var r in t)("constructor"!=r||!e&&Dt.call(t,r))&&n.push(r);return n}function $r(t,e){return t<e}function Br(t,e){var n=-1,i=Js(t)?r(t.length):[];return pr(t,function(t,r,o){i[++n]=e(t,r,o)}),i}function qr(t){var e=ho(t);return 1==e.length&&e[0][2]?Eo(e[0][0],e[0][1]):function(n){return n===t||Rr(n,t,e)}}function Ur(t,e){return xo(t)&&Ao(e)?Eo(Fo(t),e):function(n){var r=Ea(n,t);return r===i&&r===e?Oa(n,t):jr(e,r,3)}}function Vr(t,e,n,r,o){t!==e&&vr(e,function(s,a){if(o||(o=new Kn),ea(s))!function(t,e,n,r,o,s,a){var u=Mo(t,n),c=Mo(e,n),l=a.get(c);if(l)return void er(t,n,l);var h=s?s(u,c,n+"",t,e,a):i,d=h===i;if(d){var p=zs(c),f=!p&&Xs(c),m=!p&&!f&&la(c);h=c,p||f||m?zs(u)?h=u:Hs(u)?h=Mi(u):f?(d=!1,h=ki(c,!0)):m?(d=!1,h=Ai(c,!0)):h=[]:oa(c)||Gs(c)?(h=u,Gs(u)?h=ya(u):ea(u)&&!Zs(u)||(h=yo(c))):d=!1}d&&(a.set(c,h),o(h,c,r,s,a),a.delete(c));er(t,n,h)}(t,e,a,n,Vr,r,o);else{var u=r?r(Mo(t,a),s,a+"",t,e,o):i;u===i&&(u=s),er(t,a,u)}},ja)}function Gr(t,e){var n=t.length;if(n)return bo(e+=e<0?n:0,n)?t[e]:i}function zr(t,e,n){e=e.length?Pe(e,function(t){return zs(t)?function(e){return kr(e,1===t.length?t[0]:t)}:t}):[iu];var r=-1;e=Pe(e,Ye(co()));var i=Br(t,function(t,n,i){var o=Pe(e,function(e){return e(t)});return{criteria:o,index:++r,value:t}});return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(i,function(t,e){return function(t,e,n){var r=-1,i=t.criteria,o=e.criteria,s=i.length,a=n.length;for(;++r<s;){var u=Ei(i[r],o[r]);if(u)return r>=a?u:u*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)})}function Wr(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var s=e[r],a=kr(t,s);n(a,s)&&ti(o,bi(s,t),a)}return o}function Jr(t,e,n,r){var i=r?Ge:Ve,o=-1,s=e.length,a=t;for(t===e&&(e=Mi(e)),n&&(a=Pe(t,Ye(n)));++o<s;)for(var u=0,c=e[o],l=n?n(c):c;(u=i(a,l,u,r))>-1;)a!==t&&Kt.call(a,u,1),Kt.call(t,u,1);return t}function Hr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;bo(i)?Kt.call(t,i,1):di(t,i)}}return t}function Xr(t,e){return t+ge(Tn()*(e-t+1))}function Kr(t,e){var n="";if(!t||e<1||e>f)return n;do{e%2&&(n+=t),(e=ge(e/2))&&(t+=t)}while(e);return n}function Qr(t,e){return jo(Oo(t,e,iu),t+"")}function Zr(t){return Zn(qa(t))}function Yr(t,e){var n=qa(t);return Do(n,ur(e,0,n.length))}function ti(t,e,n,r){if(!ea(t))return t;for(var o=-1,s=(e=bi(e,t)).length,a=s-1,u=t;null!=u&&++o<s;){var c=Fo(e[o]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(o!=a){var h=u[c];(l=r?r(h,c,u):i)===i&&(l=ea(h)?h:bo(e[o+1])?[]:{})}nr(u,c,l),u=u[c]}return t}var ei=Nn?function(t,e){return Nn.set(t,e),t}:iu,ni=ne?function(t,e){return ne(t,"toString",{configurable:!0,enumerable:!1,value:eu(e),writable:!0})}:iu;function ri(t){return Do(qa(t))}function ii(t,e,n){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var s=r(o);++i<o;)s[i]=t[i+e];return s}function oi(t,e){var n;return pr(t,function(t,r,i){return!(n=e(t,r,i))}),!!n}function si(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,s=t[o];null!==s&&!ca(s)&&(n?s<=e:s<e)?r=o+1:i=o}return i}return ai(t,e,iu,n)}function ai(t,e,n,r){var o=0,s=null==t?0:t.length;if(0===s)return 0;for(var a=(e=n(e))!=e,u=null===e,c=ca(e),l=e===i;o<s;){var h=ge((o+s)/2),d=n(t[h]),p=d!==i,f=null===d,m=d==d,g=ca(d);if(a)var _=r||m;else _=l?m&&(r||p):u?m&&p&&(r||!f):c?m&&p&&!f&&(r||!g):!f&&!g&&(r?d<=e:d<e);_?o=h+1:s=h}return bn(s,4294967294)}function ui(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n],a=e?e(s):s;if(!n||!qs(a,u)){var u=a;o[i++]=0===s?0:s}}return o}function ci(t){return"number"==typeof t?t:ca(t)?m:+t}function li(t){if("string"==typeof t)return t;if(zs(t))return Pe(t,li)+"";if(ca(t))return Bn?Bn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function hi(t,e,n){var r=-1,i=je,o=t.length,s=!0,a=[],u=a;if(n)s=!1,i=Re;else if(o>=200){var c=e?null:Ki(t);if(c)return dn(c);s=!1,i=en,u=new Xn}else u=e?[]:a;t:for(;++r<o;){var l=t[r],h=e?e(l):l;if(l=n||0!==l?l:0,s&&h==h){for(var d=u.length;d--;)if(u[d]===h)continue t;e&&u.push(h),a.push(l)}else i(u,h,n)||(u!==a&&u.push(h),a.push(l))}return a}function di(t,e){var n=-1,r=(e=bi(e,t)).length;if(!r)return!0;for(var i=null==t||"object"!=typeof t&&"function"!=typeof t;++n<r;){var o=e[n];if("string"==typeof o){if("__proto__"===o&&!Dt.call(t,"__proto__"))return!1;if("constructor"===o&&n+1<r&&"string"==typeof e[n+1]&&"prototype"===e[n+1]){if(i&&0===n)continue;return!1}}}var s=Co(t,e);return null==s||delete s[Fo(Qo(e))]}function pi(t,e,n,r){return ti(t,e,n(kr(t,e)),r)}function fi(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?ii(t,r?0:o,r?o+1:i):ii(t,r?o+1:0,r?i:o)}function mi(t,e){var n=t;return n instanceof zn&&(n=n.value()),Le(e,function(t,e){return e.func.apply(e.thisArg,De([t],e.args))},n)}function gi(t,e,n){var i=t.length;if(i<2)return i?hi(t[0]):[];for(var o=-1,s=r(i);++o<i;)for(var a=t[o],u=-1;++u<i;)u!=o&&(s[o]=dr(s[o]||a,t[u],e,n));return hi(yr(s,1),e,n)}function _i(t,e,n){for(var r=-1,o=t.length,s=e.length,a={};++r<o;){var u=r<s?e[r]:i;n(a,t[r],u)}return a}function yi(t){return Hs(t)?t:[]}function vi(t){return"function"==typeof t?t:iu}function bi(t,e){return zs(t)?t:xo(t,e)?[t]:Lo(va(t))}var wi=Qr;function xi(t,e,n){var r=t.length;return n=n===i?r:n,!e&&n>=r?t:ii(t,e,n)}var Ti=ie||function(t){return me.clearTimeout(t)};function ki(t,e){if(e)return t.slice();var n=t.length,r=Wt?Wt(n):new t.constructor(n);return t.copy(r),r}function Si(t){var e=new t.constructor(t.byteLength);return new zt(e).set(new zt(t)),e}function Ai(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ei(t,e){if(t!==e){var n=t!==i,r=null===t,o=t==t,s=ca(t),a=e!==i,u=null===e,c=e==e,l=ca(e);if(!u&&!l&&!s&&t>e||s&&a&&c&&!u&&!l||r&&a&&c||!n&&c||!o)return 1;if(!r&&!s&&!l&&t<e||l&&n&&o&&!r&&!s||u&&n&&o||!a&&o||!c)return-1}return 0}function Oi(t,e,n,i){for(var o=-1,s=t.length,a=n.length,u=-1,c=e.length,l=vn(s-a,0),h=r(c+l),d=!i;++u<c;)h[u]=e[u];for(;++o<a;)(d||o<s)&&(h[n[o]]=t[o]);for(;l--;)h[u++]=t[o++];return h}function Ci(t,e,n,i){for(var o=-1,s=t.length,a=-1,u=n.length,c=-1,l=e.length,h=vn(s-u,0),d=r(h+l),p=!i;++o<h;)d[o]=t[o];for(var f=o;++c<l;)d[f+c]=e[c];for(;++a<u;)(p||o<s)&&(d[f+n[a]]=t[o++]);return d}function Mi(t,e){var n=-1,i=t.length;for(e||(e=r(i));++n<i;)e[n]=t[n];return e}function Ni(t,e,n,r){var o=!n;n||(n={});for(var s=-1,a=e.length;++s<a;){var u=e[s],c=r?r(n[u],t[u],u,n,t):i;c===i&&(c=t[u]),o?sr(n,u,c):nr(n,u,c)}return n}function Ii(t,e){return function(n,r){var i=zs(n)?Oe:ir,o=e?e():{};return i(n,t,co(r,2),o)}}function ji(t){return Qr(function(e,n){var r=-1,o=n.length,s=o>1?n[o-1]:i,a=o>2?n[2]:i;for(s=t.length>3&&"function"==typeof s?(o--,s):i,a&&wo(n[0],n[1],a)&&(s=o<3?i:s,o=1),e=Et(e);++r<o;){var u=n[r];u&&t(e,u,r,s)}return e})}function Ri(t,e){return function(n,r){if(null==n)return n;if(!Js(n))return t(n,r);for(var i=n.length,o=e?i:-1,s=Et(n);(e?o--:++o<i)&&!1!==r(s[o],o,s););return n}}function Pi(t){return function(e,n,r){for(var i=-1,o=Et(e),s=r(e),a=s.length;a--;){var u=s[t?a:++i];if(!1===n(o[u],u,o))break}return e}}function Di(t){return function(e){var n=un(e=va(e))?mn(e):i,r=n?n[0]:e.charAt(0),o=n?xi(n,1).join(""):e.slice(1);return r[t]()+o}}function Li(t){return function(e){return Le(Za(Ga(e).replace(te,"")),t,"")}}function Fi(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Un(t.prototype),r=t.apply(n,e);return ea(r)?r:n}}function $i(t){return function(e,n,r){var o=Et(e);if(!Js(e)){var s=co(n,3);e=Ia(e),n=function(t){return s(o[t],t,o)}}var a=t(e,n,r);return a>-1?o[s?e[a]:a]:i}}function Bi(t){return ro(function(e){var n=e.length,r=n,s=Gn.prototype.thru;for(t&&e.reverse();r--;){var a=e[r];if("function"!=typeof a)throw new Mt(o);if(s&&!u&&"wrapper"==ao(a))var u=new Gn([],!0)}for(r=u?r:n;++r<n;){var c=ao(a=e[r]),l="wrapper"==c?so(a):i;u=l&&To(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?u[ao(l[0])].apply(u,l[3]):1==a.length&&To(a)?u[c]():u.thru(a)}return function(){var t=arguments,r=t[0];if(u&&1==t.length&&zs(r))return u.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}})}function qi(t,e,n,o,s,a,u,c,l,d){var p=e&h,f=1&e,m=2&e,g=24&e,_=512&e,y=m?i:Fi(t);return function h(){for(var v=arguments.length,b=r(v),w=v;w--;)b[w]=arguments[w];if(g)var x=uo(h),T=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(b,x);if(o&&(b=Oi(b,o,s,g)),a&&(b=Ci(b,a,u,g)),v-=T,g&&v<d){var k=hn(b,x);return Hi(t,e,qi,h.placeholder,n,b,k,c,l,d-v)}var S=f?n:this,A=m?S[t]:t;return v=b.length,c?b=function(t,e){var n=t.length,r=bn(e.length,n),o=Mi(t);for(;r--;){var s=e[r];t[r]=bo(s,n)?o[s]:i}return t}(b,c):_&&v>1&&b.reverse(),p&&l<v&&(b.length=l),this&&this!==me&&this instanceof h&&(A=y||Fi(A)),A.apply(S,b)}}function Ui(t,e){return function(n,r){return function(t,e,n,r){return wr(t,function(t,i,o){e(r,n(t),i,o)}),r}(n,t,e(r),{})}}function Vi(t,e){return function(n,r){var o;if(n===i&&r===i)return e;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=li(n),r=li(r)):(n=ci(n),r=ci(r)),o=t(n,r)}return o}}function Gi(t){return ro(function(e){return e=Pe(e,Ye(co())),Qr(function(n){var r=this;return t(e,function(t){return Ee(t,r,n)})})})}function zi(t,e){var n=(e=e===i?" ":li(e)).length;if(n<2)return n?Kr(e,t):e;var r=Kr(e,fe(t/fn(e)));return un(e)?xi(mn(r),0,t).join(""):r.slice(0,t)}function Wi(t){return function(e,n,o){return o&&"number"!=typeof o&&wo(e,n,o)&&(n=o=i),e=fa(e),n===i?(n=e,e=0):n=fa(n),function(t,e,n,i){for(var o=-1,s=vn(fe((e-t)/(n||1)),0),a=r(s);s--;)a[i?s:++o]=t,t+=n;return a}(e,n,o=o===i?e<n?1:-1:fa(o),t)}}function Ji(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=_a(e),n=_a(n)),t(e,n)}}function Hi(t,e,n,r,o,s,a,u,h,d){var p=8&e;e|=p?c:l,4&(e&=~(p?l:c))||(e&=-4);var f=[t,e,o,p?s:i,p?a:i,p?i:s,p?i:a,u,h,d],m=n.apply(i,f);return To(t)&&No(m,f),m.placeholder=r,Ro(m,t,e)}function Xi(t){var e=At[t];return function(t,n){if(t=_a(t),(n=null==n?0:bn(ma(n),292))&&be(t)){var r=(va(t)+"e").split("e");return+((r=(va(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Ki=On&&1/dn(new On([,-0]))[1]==p?function(t){return new On(t)}:cu;function Qi(t){return function(e){var n=go(e);return n==S?cn(e):n==M?pn(e):function(t,e){return Pe(e,function(e){return[e,t[e]]})}(e,t(e))}}function Zi(t,e,n,s,p,f,m,g){var _=2&e;if(!_&&"function"!=typeof t)throw new Mt(o);var y=s?s.length:0;if(y||(e&=-97,s=p=i),m=m===i?m:vn(ma(m),0),g=g===i?g:ma(g),y-=p?p.length:0,e&l){var v=s,b=p;s=p=i}var w=_?i:so(t),x=[t,e,n,s,p,v,b,f,m,g];if(w&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,s=r==h&&8==n||r==h&&n==d&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!s)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var u=e[3];if(u){var c=t[3];t[3]=c?Oi(c,u,e[4]):u,t[4]=c?hn(t[3],a):e[4]}(u=e[5])&&(c=t[5],t[5]=c?Ci(c,u,e[6]):u,t[6]=c?hn(t[5],a):e[6]);(u=e[7])&&(t[7]=u);r&h&&(t[8]=null==t[8]?e[8]:bn(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(x,w),t=x[0],e=x[1],n=x[2],s=x[3],p=x[4],!(g=x[9]=x[9]===i?_?0:t.length:vn(x[9]-y,0))&&24&e&&(e&=-25),e&&1!=e)T=8==e||e==u?function(t,e,n){var o=Fi(t);return function s(){for(var a=arguments.length,u=r(a),c=a,l=uo(s);c--;)u[c]=arguments[c];var h=a<3&&u[0]!==l&&u[a-1]!==l?[]:hn(u,l);return(a-=h.length)<n?Hi(t,e,qi,s.placeholder,i,u,h,i,i,n-a):Ee(this&&this!==me&&this instanceof s?o:t,this,u)}}(t,e,g):e!=c&&33!=e||p.length?qi.apply(i,x):function(t,e,n,i){var o=1&e,s=Fi(t);return function e(){for(var a=-1,u=arguments.length,c=-1,l=i.length,h=r(l+u),d=this&&this!==me&&this instanceof e?s:t;++c<l;)h[c]=i[c];for(;u--;)h[c++]=arguments[++a];return Ee(d,o?n:this,h)}}(t,e,n,s);else var T=function(t,e,n){var r=1&e,i=Fi(t);return function e(){return(this&&this!==me&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return Ro((w?ei:No)(T,x),t,e)}function Yi(t,e,n,r){return t===i||qs(t,jt[n])&&!Dt.call(r,n)?e:t}function to(t,e,n,r,o,s){return ea(t)&&ea(e)&&(s.set(e,t),Vr(t,e,i,to,s),s.delete(e)),t}function eo(t){return oa(t)?i:t}function no(t,e,n,r,o,s){var a=1&n,u=t.length,c=e.length;if(u!=c&&!(a&&c>u))return!1;var l=s.get(t),h=s.get(e);if(l&&h)return l==e&&h==t;var d=-1,p=!0,f=2&n?new Xn:i;for(s.set(t,e),s.set(e,t);++d<u;){var m=t[d],g=e[d];if(r)var _=a?r(g,m,d,e,t,s):r(m,g,d,t,e,s);if(_!==i){if(_)continue;p=!1;break}if(f){if(!$e(e,function(t,e){if(!en(f,e)&&(m===t||o(m,t,n,r,s)))return f.push(e)})){p=!1;break}}else if(m!==g&&!o(m,g,n,r,s)){p=!1;break}}return s.delete(t),s.delete(e),p}function ro(t){return jo(Oo(t,i,Wo),t+"")}function io(t){return Sr(t,Ia,fo)}function oo(t){return Sr(t,ja,mo)}var so=Nn?function(t){return Nn.get(t)}:cu;function ao(t){for(var e=t.name+"",n=In[e],r=Dt.call(In,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function uo(t){return(Dt.call(qn,"placeholder")?qn:t).placeholder}function co(){var t=qn.iteratee||ou;return t=t===ou?Dr:t,arguments.length?t(arguments[0],arguments[1]):t}function lo(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function ho(t){for(var e=Ia(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,Ao(i)]}return e}function po(t,e){var n=function(t,e){return null==t?i:t[e]}(t,e);return Pr(n)?n:i}var fo=_e?function(t){return null==t?[]:(t=Et(t),Ie(_e(t),function(e){return Xt.call(t,e)}))}:gu,mo=_e?function(t){for(var e=[];t;)De(e,fo(t)),t=Jt(t);return e}:gu,go=Ar;function _o(t,e,n){for(var r=-1,i=(e=bi(e,t)).length,o=!1;++r<i;){var s=Fo(e[r]);if(!(o=null!=t&&n(t,s)))break;t=t[s]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&ta(i)&&bo(s,i)&&(zs(t)||Gs(t))}function yo(t){return"function"!=typeof t.constructor||So(t)?{}:Un(Jt(t))}function vo(t){return zs(t)||Gs(t)||!!(Qt&&t&&t[Qt])}function bo(t,e){var n=typeof t;return!!(e=null==e?f:e)&&("number"==n||"symbol"!=n&&bt.test(t))&&t>-1&&t%1==0&&t<e}function wo(t,e,n){if(!ea(n))return!1;var r=typeof e;return!!("number"==r?Js(n)&&bo(e,n.length):"string"==r&&e in n)&&qs(n[e],t)}function xo(t,e){if(zs(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ca(t))||(nt.test(t)||!et.test(t)||null!=e&&t in Et(e))}function To(t){var e=ao(t),n=qn[e];if("function"!=typeof n||!(e in zn.prototype))return!1;if(t===n)return!0;var r=so(n);return!!r&&t===r[0]}(Sn&&go(new Sn(new ArrayBuffer(1)))!=P||An&&go(new An)!=S||En&&go(En.resolve())!=O||On&&go(new On)!=M||Cn&&go(new Cn)!=j)&&(go=function(t){var e=Ar(t),n=e==E?t.constructor:i,r=n?$o(n):"";if(r)switch(r){case jn:return P;case Rn:return S;case Pn:return O;case Dn:return M;case Ln:return j}return e});var ko=Rt?Zs:_u;function So(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||jt)}function Ao(t){return t==t&&!ea(t)}function Eo(t,e){return function(n){return null!=n&&(n[t]===e&&(e!==i||t in Et(n)))}}function Oo(t,e,n){return e=vn(e===i?t.length-1:e,0),function(){for(var i=arguments,o=-1,s=vn(i.length-e,0),a=r(s);++o<s;)a[o]=i[e+o];o=-1;for(var u=r(e+1);++o<e;)u[o]=i[o];return u[e]=n(a),Ee(t,this,u)}}function Co(t,e){return e.length<2?t:kr(t,ii(e,0,-1))}function Mo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var No=Po(ei),Io=pe||function(t,e){return me.setTimeout(t,e)},jo=Po(ni);function Ro(t,e,n){var r=e+"";return jo(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(ut,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Ce(_,function(n){var r="_."+n[0];e&n[1]&&!je(t,r)&&t.push(r)}),t.sort()}(function(t){var e=t.match(ct);return e?e[1].split(lt):[]}(r),n)))}function Po(t){var e=0,n=0;return function(){var r=wn(),o=16-(r-n);if(n=r,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(i,arguments)}}function Do(t,e){var n=-1,r=t.length,o=r-1;for(e=e===i?r:e;++n<e;){var s=Xr(n,o),a=t[s];t[s]=t[n],t[n]=a}return t.length=e,t}var Lo=function(t){var e=Ps(t,function(t){return 500===n.size&&n.clear(),t}),n=e.cache;return e}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(rt,function(t,n,r,i){e.push(r?i.replace(pt,"$1"):n||t)}),e});function Fo(t){if("string"==typeof t||ca(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function $o(t){if(null!=t){try{return Pt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Bo(t){if(t instanceof zn)return t.clone();var e=new Gn(t.__wrapped__,t.__chain__);return e.__actions__=Mi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var qo=Qr(function(t,e){return Hs(t)?dr(t,yr(e,1,Hs,!0)):[]}),Uo=Qr(function(t,e){var n=Qo(e);return Hs(n)&&(n=i),Hs(t)?dr(t,yr(e,1,Hs,!0),co(n,2)):[]}),Vo=Qr(function(t,e){var n=Qo(e);return Hs(n)&&(n=i),Hs(t)?dr(t,yr(e,1,Hs,!0),i,n):[]});function Go(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ma(n);return i<0&&(i=vn(r+i,0)),Ue(t,co(e,3),i)}function zo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r-1;return n!==i&&(o=ma(n),o=n<0?vn(r+o,0):bn(o,r-1)),Ue(t,co(e,3),o,!0)}function Wo(t){return(null==t?0:t.length)?yr(t,1):[]}function Jo(t){return t&&t.length?t[0]:i}var Ho=Qr(function(t){var e=Pe(t,yi);return e.length&&e[0]===t[0]?Mr(e):[]}),Xo=Qr(function(t){var e=Qo(t),n=Pe(t,yi);return e===Qo(n)?e=i:n.pop(),n.length&&n[0]===t[0]?Mr(n,co(e,2)):[]}),Ko=Qr(function(t){var e=Qo(t),n=Pe(t,yi);return(e="function"==typeof e?e:i)&&n.pop(),n.length&&n[0]===t[0]?Mr(n,i,e):[]});function Qo(t){var e=null==t?0:t.length;return e?t[e-1]:i}var Zo=Qr(Yo);function Yo(t,e){return t&&t.length&&e&&e.length?Jr(t,e):t}var ts=ro(function(t,e){var n=null==t?0:t.length,r=ar(t,e);return Hr(t,Pe(e,function(t){return bo(t,n)?+t:t}).sort(Ei)),r});function es(t){return null==t?t:kn.call(t)}var ns=Qr(function(t){return hi(yr(t,1,Hs,!0))}),rs=Qr(function(t){var e=Qo(t);return Hs(e)&&(e=i),hi(yr(t,1,Hs,!0),co(e,2))}),is=Qr(function(t){var e=Qo(t);return e="function"==typeof e?e:i,hi(yr(t,1,Hs,!0),i,e)});function os(t){if(!t||!t.length)return[];var e=0;return t=Ie(t,function(t){if(Hs(t))return e=vn(t.length,e),!0}),Qe(e,function(e){return Pe(t,Je(e))})}function ss(t,e){if(!t||!t.length)return[];var n=os(t);return null==e?n:Pe(n,function(t){return Ee(e,i,t)})}var as=Qr(function(t,e){return Hs(t)?dr(t,e):[]}),us=Qr(function(t){return gi(Ie(t,Hs))}),cs=Qr(function(t){var e=Qo(t);return Hs(e)&&(e=i),gi(Ie(t,Hs),co(e,2))}),ls=Qr(function(t){var e=Qo(t);return e="function"==typeof e?e:i,gi(Ie(t,Hs),i,e)}),hs=Qr(os);var ds=Qr(function(t){var e=t.length,n=e>1?t[e-1]:i;return n="function"==typeof n?(t.pop(),n):i,ss(t,n)});function ps(t){var e=qn(t);return e.__chain__=!0,e}function fs(t,e){return e(t)}var ms=ro(function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,o=function(e){return ar(e,t)};return!(e>1||this.__actions__.length)&&r instanceof zn&&bo(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:fs,args:[o],thisArg:i}),new Gn(r,this.__chain__).thru(function(t){return e&&!t.length&&t.push(i),t})):this.thru(o)});var gs=Ii(function(t,e,n){Dt.call(t,n)?++t[n]:sr(t,n,1)});var _s=$i(Go),ys=$i(zo);function vs(t,e){return(zs(t)?Ce:pr)(t,co(e,3))}function bs(t,e){return(zs(t)?Me:fr)(t,co(e,3))}var ws=Ii(function(t,e,n){Dt.call(t,n)?t[n].push(e):sr(t,n,[e])});var xs=Qr(function(t,e,n){var i=-1,o="function"==typeof e,s=Js(t)?r(t.length):[];return pr(t,function(t){s[++i]=o?Ee(e,t,n):Nr(t,e,n)}),s}),Ts=Ii(function(t,e,n){sr(t,n,e)});function ks(t,e){return(zs(t)?Pe:Br)(t,co(e,3))}var Ss=Ii(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});var As=Qr(function(t,e){if(null==t)return[];var n=e.length;return n>1&&wo(t,e[0],e[1])?e=[]:n>2&&wo(e[0],e[1],e[2])&&(e=[e[0]]),zr(t,yr(e,1),[])}),Es=le||function(){return me.Date.now()};function Os(t,e,n){return e=n?i:e,e=t&&null==e?t.length:e,Zi(t,h,i,i,i,i,e)}function Cs(t,e){var n;if("function"!=typeof e)throw new Mt(o);return t=ma(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=i),n}}var Ms=Qr(function(t,e,n){var r=1;if(n.length){var i=hn(n,uo(Ms));r|=c}return Zi(t,r,e,n,i)}),Ns=Qr(function(t,e,n){var r=3;if(n.length){var i=hn(n,uo(Ns));r|=c}return Zi(e,r,t,n,i)});function Is(t,e,n){var r,s,a,u,c,l,h=0,d=!1,p=!1,f=!0;if("function"!=typeof t)throw new Mt(o);function m(e){var n=r,o=s;return r=s=i,h=e,u=t.apply(o,n)}function g(t){var n=t-l;return l===i||n>=e||n<0||p&&t-h>=a}function _(){var t=Es();if(g(t))return y(t);c=Io(_,function(t){var n=e-(t-l);return p?bn(n,a-(t-h)):n}(t))}function y(t){return c=i,f&&r?m(t):(r=s=i,u)}function v(){var t=Es(),n=g(t);if(r=arguments,s=this,l=t,n){if(c===i)return function(t){return h=t,c=Io(_,e),d?m(t):u}(l);if(p)return Ti(c),c=Io(_,e),m(l)}return c===i&&(c=Io(_,e)),u}return e=_a(e)||0,ea(n)&&(d=!!n.leading,a=(p="maxWait"in n)?vn(_a(n.maxWait)||0,e):a,f="trailing"in n?!!n.trailing:f),v.cancel=function(){c!==i&&Ti(c),h=0,r=l=s=c=i},v.flush=function(){return c===i?u:y(Es())},v}var js=Qr(function(t,e){return hr(t,1,e)}),Rs=Qr(function(t,e,n){return hr(t,_a(e)||0,n)});function Ps(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Mt(o);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Ps.Cache||Hn),n}function Ds(t){if("function"!=typeof t)throw new Mt(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Ps.Cache=Hn;var Ls=wi(function(t,e){var n=(e=1==e.length&&zs(e[0])?Pe(e[0],Ye(co())):Pe(yr(e,1),Ye(co()))).length;return Qr(function(r){for(var i=-1,o=bn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return Ee(t,this,r)})}),Fs=Qr(function(t,e){var n=hn(e,uo(Fs));return Zi(t,c,i,e,n)}),$s=Qr(function(t,e){var n=hn(e,uo($s));return Zi(t,l,i,e,n)}),Bs=ro(function(t,e){return Zi(t,d,i,i,i,e)});function qs(t,e){return t===e||t!=t&&e!=e}var Us=Ji(Er),Vs=Ji(function(t,e){return t>=e}),Gs=Ir(function(){return arguments}())?Ir:function(t){return na(t)&&Dt.call(t,"callee")&&!Xt.call(t,"callee")},zs=r.isArray,Ws=we?Ye(we):function(t){return na(t)&&Ar(t)==R};function Js(t){return null!=t&&ta(t.length)&&!Zs(t)}function Hs(t){return na(t)&&Js(t)}var Xs=ve||_u,Ks=xe?Ye(xe):function(t){return na(t)&&Ar(t)==w};function Qs(t){if(!na(t))return!1;var e=Ar(t);return e==x||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!oa(t)}function Zs(t){if(!ea(t))return!1;var e=Ar(t);return e==T||e==k||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Ys(t){return"number"==typeof t&&t==ma(t)}function ta(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=f}function ea(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function na(t){return null!=t&&"object"==typeof t}var ra=Te?Ye(Te):function(t){return na(t)&&go(t)==S};function ia(t){return"number"==typeof t||na(t)&&Ar(t)==A}function oa(t){if(!na(t)||Ar(t)!=E)return!1;var e=Jt(t);if(null===e)return!0;var n=Dt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Pt.call(n)==Bt}var sa=ke?Ye(ke):function(t){return na(t)&&Ar(t)==C};var aa=Se?Ye(Se):function(t){return na(t)&&go(t)==M};function ua(t){return"string"==typeof t||!zs(t)&&na(t)&&Ar(t)==N}function ca(t){return"symbol"==typeof t||na(t)&&Ar(t)==I}var la=Ae?Ye(Ae):function(t){return na(t)&&ta(t.length)&&!!ue[Ar(t)]};var ha=Ji($r),da=Ji(function(t,e){return t<=e});function pa(t){if(!t)return[];if(Js(t))return ua(t)?mn(t):Mi(t);if(Zt&&t[Zt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Zt]());var e=go(t);return(e==S?cn:e==M?dn:qa)(t)}function fa(t){return t?(t=_a(t))===p||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ma(t){var e=fa(t),n=e%1;return e==e?n?e-n:e:0}function ga(t){return t?ur(ma(t),0,g):0}function _a(t){if("number"==typeof t)return t;if(ca(t))return m;if(ea(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ze(t);var n=_t.test(t);return n||vt.test(t)?de(t.slice(2),n?2:8):gt.test(t)?m:+t}function ya(t){return Ni(t,ja(t))}function va(t){return null==t?"":li(t)}var ba=ji(function(t,e){if(So(e)||Js(e))Ni(e,Ia(e),t);else for(var n in e)Dt.call(e,n)&&nr(t,n,e[n])}),wa=ji(function(t,e){Ni(e,ja(e),t)}),xa=ji(function(t,e,n,r){Ni(e,ja(e),t,r)}),Ta=ji(function(t,e,n,r){Ni(e,Ia(e),t,r)}),ka=ro(ar);var Sa=Qr(function(t,e){t=Et(t);var n=-1,r=e.length,o=r>2?e[2]:i;for(o&&wo(e[0],e[1],o)&&(r=1);++n<r;)for(var s=e[n],a=ja(s),u=-1,c=a.length;++u<c;){var l=a[u],h=t[l];(h===i||qs(h,jt[l])&&!Dt.call(t,l))&&(t[l]=s[l])}return t}),Aa=Qr(function(t){return t.push(i,to),Ee(Pa,i,t)});function Ea(t,e,n){var r=null==t?i:kr(t,e);return r===i?n:r}function Oa(t,e){return null!=t&&_o(t,e,Cr)}var Ca=Ui(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=$t.call(e)),t[e]=n},eu(iu)),Ma=Ui(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=$t.call(e)),Dt.call(t,e)?t[e].push(n):t[e]=[n]},co),Na=Qr(Nr);function Ia(t){return Js(t)?Qn(t):Lr(t)}function ja(t){return Js(t)?Qn(t,!0):Fr(t)}var Ra=ji(function(t,e,n){Vr(t,e,n)}),Pa=ji(function(t,e,n,r){Vr(t,e,n,r)}),Da=ro(function(t,e){var n={};if(null==t)return n;var r=!1;e=Pe(e,function(e){return e=bi(e,t),r||(r=e.length>1),e}),Ni(t,oo(t),n),r&&(n=cr(n,7,eo));for(var i=e.length;i--;)di(n,e[i]);return n});var La=ro(function(t,e){return null==t?{}:function(t,e){return Wr(t,e,function(e,n){return Oa(t,n)})}(t,e)});function Fa(t,e){if(null==t)return{};var n=Pe(oo(t),function(t){return[t]});return e=co(e),Wr(t,n,function(t,n){return e(t,n[0])})}var $a=Qi(Ia),Ba=Qi(ja);function qa(t){return null==t?[]:tn(t,Ia(t))}var Ua=Li(function(t,e,n){return e=e.toLowerCase(),t+(n?Va(e):e)});function Va(t){return Qa(va(t).toLowerCase())}function Ga(t){return(t=va(t))&&t.replace(wt,on).replace(ee,"")}var za=Li(function(t,e,n){return t+(n?"-":"")+e.toLowerCase()}),Wa=Li(function(t,e,n){return t+(n?" ":"")+e.toLowerCase()}),Ja=Di("toLowerCase");var Ha=Li(function(t,e,n){return t+(n?"_":"")+e.toLowerCase()});var Xa=Li(function(t,e,n){return t+(n?" ":"")+Qa(e)});var Ka=Li(function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}),Qa=Di("toUpperCase");function Za(t,e,n){return t=va(t),(e=n?i:e)===i?function(t){return oe.test(t)}(t)?function(t){return t.match(re)||[]}(t):function(t){return t.match(ht)||[]}(t):t.match(e)||[]}var Ya=Qr(function(t,e){try{return Ee(t,i,e)}catch(t){return Qs(t)?t:new kt(t)}}),tu=ro(function(t,e){return Ce(e,function(e){e=Fo(e),sr(t,e,Ms(t[e],t))}),t});function eu(t){return function(){return t}}var nu=Bi(),ru=Bi(!0);function iu(t){return t}function ou(t){return Dr("function"==typeof t?t:cr(t,1))}var su=Qr(function(t,e){return function(n){return Nr(n,t,e)}}),au=Qr(function(t,e){return function(n){return Nr(t,n,e)}});function uu(t,e,n){var r=Ia(e),i=Tr(e,r);null!=n||ea(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=Tr(e,Ia(e)));var o=!(ea(n)&&"chain"in n&&!n.chain),s=Zs(t);return Ce(i,function(n){var r=e[n];t[n]=r,s&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__);return(n.__actions__=Mi(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,De([this.value()],arguments))})}),t}function cu(){}var lu=Gi(Pe),hu=Gi(Ne),du=Gi($e);function pu(t){return xo(t)?Je(Fo(t)):function(t){return function(e){return kr(e,t)}}(t)}var fu=Wi(),mu=Wi(!0);function gu(){return[]}function _u(){return!1}var yu=Vi(function(t,e){return t+e},0),vu=Xi("ceil"),bu=Vi(function(t,e){return t/e},1),wu=Xi("floor");var xu,Tu=Vi(function(t,e){return t*e},1),ku=Xi("round"),Su=Vi(function(t,e){return t-e},0);return qn.after=function(t,e){if("function"!=typeof e)throw new Mt(o);return t=ma(t),function(){if(--t<1)return e.apply(this,arguments)}},qn.ary=Os,qn.assign=ba,qn.assignIn=wa,qn.assignInWith=xa,qn.assignWith=Ta,qn.at=ka,qn.before=Cs,qn.bind=Ms,qn.bindAll=tu,qn.bindKey=Ns,qn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return zs(t)?t:[t]},qn.chain=ps,qn.chunk=function(t,e,n){e=(n?wo(t,e,n):e===i)?1:vn(ma(e),0);var o=null==t?0:t.length;if(!o||e<1)return[];for(var s=0,a=0,u=r(fe(o/e));s<o;)u[a++]=ii(t,s,s+=e);return u},qn.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},qn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=r(t-1),n=arguments[0],i=t;i--;)e[i-1]=arguments[i];return De(zs(n)?Mi(n):[n],yr(e,1))},qn.cond=function(t){var e=null==t?0:t.length,n=co();return t=e?Pe(t,function(t){if("function"!=typeof t[1])throw new Mt(o);return[n(t[0]),t[1]]}):[],Qr(function(n){for(var r=-1;++r<e;){var i=t[r];if(Ee(i[0],this,n))return Ee(i[1],this,n)}})},qn.conforms=function(t){return function(t){var e=Ia(t);return function(n){return lr(n,t,e)}}(cr(t,1))},qn.constant=eu,qn.countBy=gs,qn.create=function(t,e){var n=Un(t);return null==e?n:or(n,e)},qn.curry=function t(e,n,r){var o=Zi(e,8,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},qn.curryRight=function t(e,n,r){var o=Zi(e,u,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},qn.debounce=Is,qn.defaults=Sa,qn.defaultsDeep=Aa,qn.defer=js,qn.delay=Rs,qn.difference=qo,qn.differenceBy=Uo,qn.differenceWith=Vo,qn.drop=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,(e=n||e===i?1:ma(e))<0?0:e,r):[]},qn.dropRight=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,0,(e=r-(e=n||e===i?1:ma(e)))<0?0:e):[]},qn.dropRightWhile=function(t,e){return t&&t.length?fi(t,co(e,3),!0,!0):[]},qn.dropWhile=function(t,e){return t&&t.length?fi(t,co(e,3),!0):[]},qn.fill=function(t,e,n,r){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&wo(t,e,n)&&(n=0,r=o),function(t,e,n,r){var o=t.length;for((n=ma(n))<0&&(n=-n>o?0:o+n),(r=r===i||r>o?o:ma(r))<0&&(r+=o),r=n>r?0:ga(r);n<r;)t[n++]=e;return t}(t,e,n,r)):[]},qn.filter=function(t,e){return(zs(t)?Ie:_r)(t,co(e,3))},qn.flatMap=function(t,e){return yr(ks(t,e),1)},qn.flatMapDeep=function(t,e){return yr(ks(t,e),p)},qn.flatMapDepth=function(t,e,n){return n=n===i?1:ma(n),yr(ks(t,e),n)},qn.flatten=Wo,qn.flattenDeep=function(t){return(null==t?0:t.length)?yr(t,p):[]},qn.flattenDepth=function(t,e){return(null==t?0:t.length)?yr(t,e=e===i?1:ma(e)):[]},qn.flip=function(t){return Zi(t,512)},qn.flow=nu,qn.flowRight=ru,qn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},qn.functions=function(t){return null==t?[]:Tr(t,Ia(t))},qn.functionsIn=function(t){return null==t?[]:Tr(t,ja(t))},qn.groupBy=ws,qn.initial=function(t){return(null==t?0:t.length)?ii(t,0,-1):[]},qn.intersection=Ho,qn.intersectionBy=Xo,qn.intersectionWith=Ko,qn.invert=Ca,qn.invertBy=Ma,qn.invokeMap=xs,qn.iteratee=ou,qn.keyBy=Ts,qn.keys=Ia,qn.keysIn=ja,qn.map=ks,qn.mapKeys=function(t,e){var n={};return e=co(e,3),wr(t,function(t,r,i){sr(n,e(t,r,i),t)}),n},qn.mapValues=function(t,e){var n={};return e=co(e,3),wr(t,function(t,r,i){sr(n,r,e(t,r,i))}),n},qn.matches=function(t){return qr(cr(t,1))},qn.matchesProperty=function(t,e){return Ur(t,cr(e,1))},qn.memoize=Ps,qn.merge=Ra,qn.mergeWith=Pa,qn.method=su,qn.methodOf=au,qn.mixin=uu,qn.negate=Ds,qn.nthArg=function(t){return t=ma(t),Qr(function(e){return Gr(e,t)})},qn.omit=Da,qn.omitBy=function(t,e){return Fa(t,Ds(co(e)))},qn.once=function(t){return Cs(2,t)},qn.orderBy=function(t,e,n,r){return null==t?[]:(zs(e)||(e=null==e?[]:[e]),zs(n=r?i:n)||(n=null==n?[]:[n]),zr(t,e,n))},qn.over=lu,qn.overArgs=Ls,qn.overEvery=hu,qn.overSome=du,qn.partial=Fs,qn.partialRight=$s,qn.partition=Ss,qn.pick=La,qn.pickBy=Fa,qn.property=pu,qn.propertyOf=function(t){return function(e){return null==t?i:kr(t,e)}},qn.pull=Zo,qn.pullAll=Yo,qn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Jr(t,e,co(n,2)):t},qn.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?Jr(t,e,i,n):t},qn.pullAt=ts,qn.range=fu,qn.rangeRight=mu,qn.rearg=Bs,qn.reject=function(t,e){return(zs(t)?Ie:_r)(t,Ds(co(e,3)))},qn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=co(e,3);++r<o;){var s=t[r];e(s,r,t)&&(n.push(s),i.push(r))}return Hr(t,i),n},qn.rest=function(t,e){if("function"!=typeof t)throw new Mt(o);return Qr(t,e=e===i?e:ma(e))},qn.reverse=es,qn.sampleSize=function(t,e,n){return e=(n?wo(t,e,n):e===i)?1:ma(e),(zs(t)?Yn:Yr)(t,e)},qn.set=function(t,e,n){return null==t?t:ti(t,e,n)},qn.setWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:ti(t,e,n,r)},qn.shuffle=function(t){return(zs(t)?tr:ri)(t)},qn.slice=function(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&wo(t,e,n)?(e=0,n=r):(e=null==e?0:ma(e),n=n===i?r:ma(n)),ii(t,e,n)):[]},qn.sortBy=As,qn.sortedUniq=function(t){return t&&t.length?ui(t):[]},qn.sortedUniqBy=function(t,e){return t&&t.length?ui(t,co(e,2)):[]},qn.split=function(t,e,n){return n&&"number"!=typeof n&&wo(t,e,n)&&(e=n=i),(n=n===i?g:n>>>0)?(t=va(t))&&("string"==typeof e||null!=e&&!sa(e))&&!(e=li(e))&&un(t)?xi(mn(t),0,n):t.split(e,n):[]},qn.spread=function(t,e){if("function"!=typeof t)throw new Mt(o);return e=null==e?0:vn(ma(e),0),Qr(function(n){var r=n[e],i=xi(n,0,e);return r&&De(i,r),Ee(t,this,i)})},qn.tail=function(t){var e=null==t?0:t.length;return e?ii(t,1,e):[]},qn.take=function(t,e,n){return t&&t.length?ii(t,0,(e=n||e===i?1:ma(e))<0?0:e):[]},qn.takeRight=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,(e=r-(e=n||e===i?1:ma(e)))<0?0:e,r):[]},qn.takeRightWhile=function(t,e){return t&&t.length?fi(t,co(e,3),!1,!0):[]},qn.takeWhile=function(t,e){return t&&t.length?fi(t,co(e,3)):[]},qn.tap=function(t,e){return e(t),t},qn.throttle=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new Mt(o);return ea(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Is(t,e,{leading:r,maxWait:e,trailing:i})},qn.thru=fs,qn.toArray=pa,qn.toPairs=$a,qn.toPairsIn=Ba,qn.toPath=function(t){return zs(t)?Pe(t,Fo):ca(t)?[t]:Mi(Lo(va(t)))},qn.toPlainObject=ya,qn.transform=function(t,e,n){var r=zs(t),i=r||Xs(t)||la(t);if(e=co(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:ea(t)&&Zs(o)?Un(Jt(t)):{}}return(i?Ce:wr)(t,function(t,r,i){return e(n,t,r,i)}),n},qn.unary=function(t){return Os(t,1)},qn.union=ns,qn.unionBy=rs,qn.unionWith=is,qn.uniq=function(t){return t&&t.length?hi(t):[]},qn.uniqBy=function(t,e){return t&&t.length?hi(t,co(e,2)):[]},qn.uniqWith=function(t,e){return e="function"==typeof e?e:i,t&&t.length?hi(t,i,e):[]},qn.unset=function(t,e){return null==t||di(t,e)},qn.unzip=os,qn.unzipWith=ss,qn.update=function(t,e,n){return null==t?t:pi(t,e,vi(n))},qn.updateWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:pi(t,e,vi(n),r)},qn.values=qa,qn.valuesIn=function(t){return null==t?[]:tn(t,ja(t))},qn.without=as,qn.words=Za,qn.wrap=function(t,e){return Fs(vi(e),t)},qn.xor=us,qn.xorBy=cs,qn.xorWith=ls,qn.zip=hs,qn.zipObject=function(t,e){return _i(t||[],e||[],nr)},qn.zipObjectDeep=function(t,e){return _i(t||[],e||[],ti)},qn.zipWith=ds,qn.entries=$a,qn.entriesIn=Ba,qn.extend=wa,qn.extendWith=xa,uu(qn,qn),qn.add=yu,qn.attempt=Ya,qn.camelCase=Ua,qn.capitalize=Va,qn.ceil=vu,qn.clamp=function(t,e,n){return n===i&&(n=e,e=i),n!==i&&(n=(n=_a(n))==n?n:0),e!==i&&(e=(e=_a(e))==e?e:0),ur(_a(t),e,n)},qn.clone=function(t){return cr(t,4)},qn.cloneDeep=function(t){return cr(t,5)},qn.cloneDeepWith=function(t,e){return cr(t,5,e="function"==typeof e?e:i)},qn.cloneWith=function(t,e){return cr(t,4,e="function"==typeof e?e:i)},qn.conformsTo=function(t,e){return null==e||lr(t,e,Ia(e))},qn.deburr=Ga,qn.defaultTo=function(t,e){return null==t||t!=t?e:t},qn.divide=bu,qn.endsWith=function(t,e,n){t=va(t),e=li(e);var r=t.length,o=n=n===i?r:ur(ma(n),0,r);return(n-=e.length)>=0&&t.slice(n,o)==e},qn.eq=qs,qn.escape=function(t){return(t=va(t))&&Q.test(t)?t.replace(X,sn):t},qn.escapeRegExp=function(t){return(t=va(t))&&ot.test(t)?t.replace(it,"\\$&"):t},qn.every=function(t,e,n){var r=zs(t)?Ne:mr;return n&&wo(t,e,n)&&(e=i),r(t,co(e,3))},qn.find=_s,qn.findIndex=Go,qn.findKey=function(t,e){return qe(t,co(e,3),wr)},qn.findLast=ys,qn.findLastIndex=zo,qn.findLastKey=function(t,e){return qe(t,co(e,3),xr)},qn.floor=wu,qn.forEach=vs,qn.forEachRight=bs,qn.forIn=function(t,e){return null==t?t:vr(t,co(e,3),ja)},qn.forInRight=function(t,e){return null==t?t:br(t,co(e,3),ja)},qn.forOwn=function(t,e){return t&&wr(t,co(e,3))},qn.forOwnRight=function(t,e){return t&&xr(t,co(e,3))},qn.get=Ea,qn.gt=Us,qn.gte=Vs,qn.has=function(t,e){return null!=t&&_o(t,e,Or)},qn.hasIn=Oa,qn.head=Jo,qn.identity=iu,qn.includes=function(t,e,n,r){t=Js(t)?t:qa(t),n=n&&!r?ma(n):0;var i=t.length;return n<0&&(n=vn(i+n,0)),ua(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Ve(t,e,n)>-1},qn.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ma(n);return i<0&&(i=vn(r+i,0)),Ve(t,e,i)},qn.inRange=function(t,e,n){return e=fa(e),n===i?(n=e,e=0):n=fa(n),function(t,e,n){return t>=bn(e,n)&&t<vn(e,n)}(t=_a(t),e,n)},qn.invoke=Na,qn.isArguments=Gs,qn.isArray=zs,qn.isArrayBuffer=Ws,qn.isArrayLike=Js,qn.isArrayLikeObject=Hs,qn.isBoolean=function(t){return!0===t||!1===t||na(t)&&Ar(t)==b},qn.isBuffer=Xs,qn.isDate=Ks,qn.isElement=function(t){return na(t)&&1===t.nodeType&&!oa(t)},qn.isEmpty=function(t){if(null==t)return!0;if(Js(t)&&(zs(t)||"string"==typeof t||"function"==typeof t.splice||Xs(t)||la(t)||Gs(t)))return!t.length;var e=go(t);if(e==S||e==M)return!t.size;if(So(t))return!Lr(t).length;for(var n in t)if(Dt.call(t,n))return!1;return!0},qn.isEqual=function(t,e){return jr(t,e)},qn.isEqualWith=function(t,e,n){var r=(n="function"==typeof n?n:i)?n(t,e):i;return r===i?jr(t,e,i,n):!!r},qn.isError=Qs,qn.isFinite=function(t){return"number"==typeof t&&be(t)},qn.isFunction=Zs,qn.isInteger=Ys,qn.isLength=ta,qn.isMap=ra,qn.isMatch=function(t,e){return t===e||Rr(t,e,ho(e))},qn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:i,Rr(t,e,ho(e),n)},qn.isNaN=function(t){return ia(t)&&t!=+t},qn.isNative=function(t){if(ko(t))throw new kt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Pr(t)},qn.isNil=function(t){return null==t},qn.isNull=function(t){return null===t},qn.isNumber=ia,qn.isObject=ea,qn.isObjectLike=na,qn.isPlainObject=oa,qn.isRegExp=sa,qn.isSafeInteger=function(t){return Ys(t)&&t>=-9007199254740991&&t<=f},qn.isSet=aa,qn.isString=ua,qn.isSymbol=ca,qn.isTypedArray=la,qn.isUndefined=function(t){return t===i},qn.isWeakMap=function(t){return na(t)&&go(t)==j},qn.isWeakSet=function(t){return na(t)&&"[object WeakSet]"==Ar(t)},qn.join=function(t,e){return null==t?"":Be.call(t,e)},qn.kebabCase=za,qn.last=Qo,qn.lastIndexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=ma(n))<0?vn(r+o,0):bn(o,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,o):Ue(t,ze,o,!0)},qn.lowerCase=Wa,qn.lowerFirst=Ja,qn.lt=ha,qn.lte=da,qn.max=function(t){return t&&t.length?gr(t,iu,Er):i},qn.maxBy=function(t,e){return t&&t.length?gr(t,co(e,2),Er):i},qn.mean=function(t){return We(t,iu)},qn.meanBy=function(t,e){return We(t,co(e,2))},qn.min=function(t){return t&&t.length?gr(t,iu,$r):i},qn.minBy=function(t,e){return t&&t.length?gr(t,co(e,2),$r):i},qn.stubArray=gu,qn.stubFalse=_u,qn.stubObject=function(){return{}},qn.stubString=function(){return""},qn.stubTrue=function(){return!0},qn.multiply=Tu,qn.nth=function(t,e){return t&&t.length?Gr(t,ma(e)):i},qn.noConflict=function(){return me._===this&&(me._=qt),this},qn.noop=cu,qn.now=Es,qn.pad=function(t,e,n){t=va(t);var r=(e=ma(e))?fn(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return zi(ge(i),n)+t+zi(fe(i),n)},qn.padEnd=function(t,e,n){t=va(t);var r=(e=ma(e))?fn(t):0;return e&&r<e?t+zi(e-r,n):t},qn.padStart=function(t,e,n){t=va(t);var r=(e=ma(e))?fn(t):0;return e&&r<e?zi(e-r,n)+t:t},qn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),xn(va(t).replace(st,""),e||0)},qn.random=function(t,e,n){if(n&&"boolean"!=typeof n&&wo(t,e,n)&&(e=n=i),n===i&&("boolean"==typeof e?(n=e,e=i):"boolean"==typeof t&&(n=t,t=i)),t===i&&e===i?(t=0,e=1):(t=fa(t),e===i?(e=t,t=0):e=fa(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var o=Tn();return bn(t+o*(e-t+he("1e-"+((o+"").length-1))),e)}return Xr(t,e)},qn.reduce=function(t,e,n){var r=zs(t)?Le:Xe,i=arguments.length<3;return r(t,co(e,4),n,i,pr)},qn.reduceRight=function(t,e,n){var r=zs(t)?Fe:Xe,i=arguments.length<3;return r(t,co(e,4),n,i,fr)},qn.repeat=function(t,e,n){return e=(n?wo(t,e,n):e===i)?1:ma(e),Kr(va(t),e)},qn.replace=function(){var t=arguments,e=va(t[0]);return t.length<3?e:e.replace(t[1],t[2])},qn.result=function(t,e,n){var r=-1,o=(e=bi(e,t)).length;for(o||(o=1,t=i);++r<o;){var s=null==t?i:t[Fo(e[r])];s===i&&(r=o,s=n),t=Zs(s)?s.call(t):s}return t},qn.round=ku,qn.runInContext=t,qn.sample=function(t){return(zs(t)?Zn:Zr)(t)},qn.size=function(t){if(null==t)return 0;if(Js(t))return ua(t)?fn(t):t.length;var e=go(t);return e==S||e==M?t.size:Lr(t).length},qn.snakeCase=Ha,qn.some=function(t,e,n){var r=zs(t)?$e:oi;return n&&wo(t,e,n)&&(e=i),r(t,co(e,3))},qn.sortedIndex=function(t,e){return si(t,e)},qn.sortedIndexBy=function(t,e,n){return ai(t,e,co(n,2))},qn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=si(t,e);if(r<n&&qs(t[r],e))return r}return-1},qn.sortedLastIndex=function(t,e){return si(t,e,!0)},qn.sortedLastIndexBy=function(t,e,n){return ai(t,e,co(n,2),!0)},qn.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var n=si(t,e,!0)-1;if(qs(t[n],e))return n}return-1},qn.startCase=Xa,qn.startsWith=function(t,e,n){return t=va(t),n=null==n?0:ur(ma(n),0,t.length),e=li(e),t.slice(n,n+e.length)==e},qn.subtract=Su,qn.sum=function(t){return t&&t.length?Ke(t,iu):0},qn.sumBy=function(t,e){return t&&t.length?Ke(t,co(e,2)):0},qn.template=function(t,e,n){var r=qn.templateSettings;n&&wo(t,e,n)&&(e=i),t=va(t),e=xa({},e,r,Yi);var o,s,a=xa({},e.imports,r.imports,Yi),u=Ia(a),c=tn(a,u),l=0,h=e.interpolate||xt,d="__p += '",p=Ot((e.escape||xt).source+"|"+h.source+"|"+(h===tt?ft:xt).source+"|"+(e.evaluate||xt).source+"|$","g"),f="//# sourceURL="+(Dt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ae+"]")+"\n";t.replace(p,function(e,n,r,i,a,u){return r||(r=i),d+=t.slice(l,u).replace(Tt,an),n&&(o=!0,d+="' +\n__e("+n+") +\n'"),a&&(s=!0,d+="';\n"+a+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+e.length,e}),d+="';\n";var m=Dt.call(e,"variable")&&e.variable;if(m){if(dt.test(m))throw new kt("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(s?d.replace(z,""):d).replace(W,"$1").replace(J,"$1;"),d="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=Ya(function(){return St(u,f+"return "+d).apply(i,c)});if(g.source=d,Qs(g))throw g;return g},qn.times=function(t,e){if((t=ma(t))<1||t>f)return[];var n=g,r=bn(t,g);e=co(e),t-=g;for(var i=Qe(r,e);++n<t;)e(n);return i},qn.toFinite=fa,qn.toInteger=ma,qn.toLength=ga,qn.toLower=function(t){return va(t).toLowerCase()},qn.toNumber=_a,qn.toSafeInteger=function(t){return t?ur(ma(t),-9007199254740991,f):0===t?t:0},qn.toString=va,qn.toUpper=function(t){return va(t).toUpperCase()},qn.trim=function(t,e,n){if((t=va(t))&&(n||e===i))return Ze(t);if(!t||!(e=li(e)))return t;var r=mn(t),o=mn(e);return xi(r,nn(r,o),rn(r,o)+1).join("")},qn.trimEnd=function(t,e,n){if((t=va(t))&&(n||e===i))return t.slice(0,gn(t)+1);if(!t||!(e=li(e)))return t;var r=mn(t);return xi(r,0,rn(r,mn(e))+1).join("")},qn.trimStart=function(t,e,n){if((t=va(t))&&(n||e===i))return t.replace(st,"");if(!t||!(e=li(e)))return t;var r=mn(t);return xi(r,nn(r,mn(e))).join("")},qn.truncate=function(t,e){var n=30,r="...";if(ea(e)){var o="separator"in e?e.separator:o;n="length"in e?ma(e.length):n,r="omission"in e?li(e.omission):r}var s=(t=va(t)).length;if(un(t)){var a=mn(t);s=a.length}if(n>=s)return t;var u=n-fn(r);if(u<1)return r;var c=a?xi(a,0,u).join(""):t.slice(0,u);if(o===i)return c+r;if(a&&(u+=c.length-u),sa(o)){if(t.slice(u).search(o)){var l,h=c;for(o.global||(o=Ot(o.source,va(mt.exec(o))+"g")),o.lastIndex=0;l=o.exec(h);)var d=l.index;c=c.slice(0,d===i?u:d)}}else if(t.indexOf(li(o),u)!=u){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+r},qn.unescape=function(t){return(t=va(t))&&K.test(t)?t.replace(H,_n):t},qn.uniqueId=function(t){var e=++Lt;return va(t)+e},qn.upperCase=Ka,qn.upperFirst=Qa,qn.each=vs,qn.eachRight=bs,qn.first=Jo,uu(qn,(xu={},wr(qn,function(t,e){Dt.call(qn.prototype,e)||(xu[e]=t)}),xu),{chain:!1}),qn.VERSION="4.17.23",Ce(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){qn[t].placeholder=qn}),Ce(["drop","take"],function(t,e){zn.prototype[t]=function(n){n=n===i?1:vn(ma(n),0);var r=this.__filtered__&&!e?new zn(this):this.clone();return r.__filtered__?r.__takeCount__=bn(n,r.__takeCount__):r.__views__.push({size:bn(n,g),type:t+(r.__dir__<0?"Right":"")}),r},zn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),Ce(["filter","map","takeWhile"],function(t,e){var n=e+1,r=1==n||3==n;zn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:co(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}}),Ce(["head","last"],function(t,e){var n="take"+(e?"Right":"");zn.prototype[t]=function(){return this[n](1).value()[0]}}),Ce(["initial","tail"],function(t,e){var n="drop"+(e?"":"Right");zn.prototype[t]=function(){return this.__filtered__?new zn(this):this[n](1)}}),zn.prototype.compact=function(){return this.filter(iu)},zn.prototype.find=function(t){return this.filter(t).head()},zn.prototype.findLast=function(t){return this.reverse().find(t)},zn.prototype.invokeMap=Qr(function(t,e){return"function"==typeof t?new zn(this):this.map(function(n){return Nr(n,t,e)})}),zn.prototype.reject=function(t){return this.filter(Ds(co(t)))},zn.prototype.slice=function(t,e){t=ma(t);var n=this;return n.__filtered__&&(t>0||e<0)?new zn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==i&&(n=(e=ma(e))<0?n.dropRight(-e):n.take(e-t)),n)},zn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},zn.prototype.toArray=function(){return this.take(g)},wr(zn.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),o=qn[r?"take"+("last"==e?"Right":""):e],s=r||/^find/.test(e);o&&(qn.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,u=e instanceof zn,c=a[0],l=u||zs(e),h=function(t){var e=o.apply(qn,De([t],a));return r&&d?e[0]:e};l&&n&&"function"==typeof c&&1!=c.length&&(u=l=!1);var d=this.__chain__,p=!!this.__actions__.length,f=s&&!d,m=u&&!p;if(!s&&l){e=m?e:new zn(this);var g=t.apply(e,a);return g.__actions__.push({func:fs,args:[h],thisArg:i}),new Gn(g,d)}return f&&m?t.apply(this,a):(g=this.thru(h),f?r?g.value()[0]:g.value():g)})}),Ce(["pop","push","shift","sort","splice","unshift"],function(t){var e=Nt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);qn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(zs(i)?i:[],t)}return this[n](function(n){return e.apply(zs(n)?n:[],t)})}}),wr(zn.prototype,function(t,e){var n=qn[e];if(n){var r=n.name+"";Dt.call(In,r)||(In[r]=[]),In[r].push({name:e,func:n})}}),In[qi(i,2).name]=[{name:"wrapper",func:i}],zn.prototype.clone=function(){var t=new zn(this.__wrapped__);return t.__actions__=Mi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Mi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Mi(this.__views__),t},zn.prototype.reverse=function(){if(this.__filtered__){var t=new zn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},zn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=zs(t),r=e<0,i=n?t.length:0,o=function(t,e,n){var r=-1,i=n.length;for(;++r<i;){var o=n[r],s=o.size;switch(o.type){case"drop":t+=s;break;case"dropRight":e-=s;break;case"take":e=bn(e,t+s);break;case"takeRight":t=vn(t,e-s)}}return{start:t,end:e}}(0,i,this.__views__),s=o.start,a=o.end,u=a-s,c=r?a:s-1,l=this.__iteratees__,h=l.length,d=0,p=bn(u,this.__takeCount__);if(!n||!r&&i==u&&p==u)return mi(t,this.__actions__);var f=[];t:for(;u--&&d<p;){for(var m=-1,g=t[c+=e];++m<h;){var _=l[m],y=_.iteratee,v=_.type,b=y(g);if(2==v)g=b;else if(!b){if(1==v)continue t;break t}}f[d++]=g}return f},qn.prototype.at=ms,qn.prototype.chain=function(){return ps(this)},qn.prototype.commit=function(){return new Gn(this.value(),this.__chain__)},qn.prototype.next=function(){this.__values__===i&&(this.__values__=pa(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?i:this.__values__[this.__index__++]}},qn.prototype.plant=function(t){for(var e,n=this;n instanceof Vn;){var r=Bo(n);r.__index__=0,r.__values__=i,e?o.__wrapped__=r:e=r;var o=r;n=n.__wrapped__}return o.__wrapped__=t,e},qn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof zn){var e=t;return this.__actions__.length&&(e=new zn(this)),(e=e.reverse()).__actions__.push({func:fs,args:[es],thisArg:i}),new Gn(e,this.__chain__)}return this.thru(es)},qn.prototype.toJSON=qn.prototype.valueOf=qn.prototype.value=function(){return mi(this.__wrapped__,this.__actions__)},qn.prototype.first=qn.prototype.head,Zt&&(qn.prototype[Zt]=function(){return this}),qn}();me._=yn,(r=function(){return yn}.call(e,n,e,t))===i||(t.exports=r)}.call(this)},79(t){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r},t.exports.__esModule=!0,t.exports.default=t.exports},2987(t){t.exports=function(t){if(Array.isArray(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},7383(t){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},4579(t,e,n){var r=n(7736);function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,r(i.key),i)}}t.exports=function(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},1156(t){t.exports=function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,s,a=[],u=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);u=!0);}catch(t){c=!0,i=t}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}},t.exports.__esModule=!0,t.exports.default=t.exports},7752(t){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},5715(t,e,n){var r=n(2987),i=n(1156),o=n(7122),s=n(7752);t.exports=function(t,e){return r(t)||i(t,e)||o(t,e)||s()},t.exports.__esModule=!0,t.exports.default=t.exports},9045(t,e,n){var r=n(3738).default;t.exports=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},7736(t,e,n){var r=n(3738).default,i=n(9045);t.exports=function(t){var e=i(t,"string");return"symbol"==r(e)?e:e+""},t.exports.__esModule=!0,t.exports.default=t.exports},3738(t){function e(n){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},7122(t,e,n){var r=n(79);t.exports=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var r={};n.r(r),n.d(r,{hasBrowserEnv:()=>Yf,hasStandardBrowserEnv:()=>em,hasStandardBrowserWebWorkerEnv:()=>nm,navigator:()=>tm,origin:()=>rm});var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},i(t,e)};function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function s(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s}function a(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}u((r=r.apply(t,e||[])).next())})}function u(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}Object.create;function c(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function h(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function d(t){return this instanceof d?(this.v=t,this):new d(t)}function p(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(t,e||[]),o=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",function(t){return function(e){return Promise.resolve(e).then(t,c)}}),r[Symbol.asyncIterator]=function(){return this},r;function s(t,e){i[t]&&(r[t]=function(e){return new Promise(function(n,r){o.push([t,e,n,r])>1||a(t,e)})},e&&(r[t]=e(r[t])))}function a(t,e){try{(n=i[t](e)).value instanceof d?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(t){l(o[0][3],t)}var n}function u(t){a("next",t)}function c(t){a("throw",t)}function l(t,e){t(e),o.shift(),o.length&&a(o[0][0],o[0][1])}}function f(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=c(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise(function(r,i){(function(t,e,n,r){Promise.resolve(r).then(function(e){t({value:e,done:n})},e)})(r,i,(e=t[n](e)).done,e.value)})}}}Object.create;"function"==typeof SuppressedError&&SuppressedError;function m(t){return"function"==typeof t}function g(t){return function(e){if(function(t){return m(null==t?void 0:t.lift)}(e))return e.lift(function(e){try{return t(e,this)}catch(t){this.error(t)}});throw new TypeError("Unable to lift unknown Observable type")}}function y(t){var e=t(function(t){Error.call(t),t.stack=(new Error).stack});return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var v=y(function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map(function(t,e){return e+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}});function b(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var w=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var t,e,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=c(o),a=s.next();!a.done;a=s.next()){a.value.remove(this)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}else o.remove(this);var u=this.initialTeardown;if(m(u))try{u()}catch(t){i=t instanceof v?t.errors:[t]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var p=c(d),f=p.next();!f.done;f=p.next()){var g=f.value;try{k(g)}catch(t){i=null!=i?i:[],t instanceof v?i=h(h([],l(i)),l(t.errors)):i.push(t)}}}catch(t){n={error:t}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}}if(i)throw new v(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)k(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&b(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&b(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),x=w.EMPTY;function T(t){return t instanceof w||t&&"closed"in t&&m(t.remove)&&m(t.add)&&m(t.unsubscribe)}function k(t){m(t)?t():t.unsubscribe()}var S={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},A={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=A.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,h([t,e],l(n))):setTimeout.apply(void 0,h([t,e],l(n)))},clearTimeout:function(t){var e=A.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function E(t){A.setTimeout(function(){var e=S.onUnhandledError;if(!e)throw t;e(t)})}function O(){}var C=M("C",void 0,void 0);function M(t,e,n){return{kind:t,value:e,error:n}}var N=null;function I(t){if(S.useDeprecatedSynchronousErrorHandling){var e=!N;if(e&&(N={errorThrown:!1,error:null}),t(),e){var n=N,r=n.errorThrown,i=n.error;if(N=null,r)throw i}}else t()}var j=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,T(e)&&e.add(n)):n.destination=B,n}return o(e,t),e.create=function(t,e,n){return new L(t,e,n)},e.prototype.next=function(t){this.isStopped?$(function(t){return M("N",t,void 0)}(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?$(M("E",void 0,t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?$(C,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(w),R=Function.prototype.bind;function P(t,e){return R.call(t,e)}var D=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){F(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){F(t)}else F(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){F(t)}},t}(),L=function(t){function e(e,n,r){var i,o,s=t.call(this)||this;m(e)||!e?i={next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&S.useDeprecatedNextContext?((o=Object.create(e)).unsubscribe=function(){return s.unsubscribe()},i={next:e.next&&P(e.next,o),error:e.error&&P(e.error,o),complete:e.complete&&P(e.complete,o)}):i=e;return s.destination=new D(i),s}return o(e,t),e}(j);function F(t){var e;S.useDeprecatedSynchronousErrorHandling?(e=t,S.useDeprecatedSynchronousErrorHandling&&N&&(N.errorThrown=!0,N.error=e)):E(t)}function $(t,e){var n=S.onStoppedNotification;n&&A.setTimeout(function(){return n(t,e)})}var B={closed:!0,next:O,error:function(t){throw t},complete:O};function q(t,e,n,r,i){return new U(t,e,n,r,i)}var U=function(t){function e(e,n,r,i,o,s){var a=t.call(this,e)||this;return a.onFinalize=o,a.shouldUnsubscribe=s,a._next=n?function(t){try{n(t)}catch(t){e.error(t)}}:t.prototype._next,a._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,a._complete=r?function(){try{r()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,a}return o(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(j);function V(t,e){return g(function(n,r){var i=0;n.subscribe(q(r,function(n){r.next(t.call(e,n,i++))}))})}var G=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function z(t){return m(null==t?void 0:t.then)}var W="function"==typeof Symbol&&Symbol.observable||"@@observable";function J(t){return t}function H(t){return 0===t.length?J:1===t.length?t[0]:function(e){return t.reduce(function(t,e){return e(t)},e)}}var X=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r,i=this,o=(r=t)&&r instanceof j||function(t){return t&&m(t.next)&&m(t.error)&&m(t.complete)}(r)&&T(r)?t:new L(t,e,n);return I(function(){var t=i,e=t.operator,n=t.source;o.add(e?e.call(o,n):n?i._subscribe(o):i._trySubscribe(o))}),o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=K(e))(function(e,r){var i=new L({next:function(e){try{t(e)}catch(t){r(t),i.unsubscribe()}},error:r,complete:e});n.subscribe(i)})},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[W]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return H(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=K(t))(function(t,n){var r;e.subscribe(function(t){return r=t},function(t){return n(t)},function(){return t(r)})})},t.create=function(e){return new t(e)},t}();function K(t){var e;return null!==(e=null!=t?t:S.Promise)&&void 0!==e?e:Promise}function Q(t){return m(t[W])}function Z(t){return Symbol.asyncIterator&&m(null==t?void 0:t[Symbol.asyncIterator])}function Y(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var tt="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function et(t){return m(null==t?void 0:t[tt])}function nt(t){return p(this,arguments,function(){var e,n,r;return u(this,function(i){switch(i.label){case 0:e=t.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,d(e.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,d(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,d(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function rt(t){return m(null==t?void 0:t.getReader)}function it(t){if(t instanceof X)return t;if(null!=t){if(Q(t))return i=t,new X(function(t){var e=i[W]();if(m(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(G(t))return r=t,new X(function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()});if(z(t))return n=t,new X(function(t){n.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,E)});if(Z(t))return ot(t);if(et(t))return e=t,new X(function(t){var n,r;try{for(var i=c(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()});if(rt(t))return ot(nt(t))}var e,n,r,i;throw Y(t)}function ot(t){return new X(function(e){(function(t,e){var n,r,i,o;return a(this,void 0,void 0,function(){var s,a;return u(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),n=f(t),u.label=1;case 1:return[4,n.next()];case 2:if((r=u.sent()).done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=u.sent(),i={error:a},[3,11];case 6:return u.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})})(t,e).catch(function(t){return e.error(t)})})}function st(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=e.schedule(function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(o),!i)return o}function at(t,e,n){return void 0===n&&(n=1/0),m(e)?at(function(n,r){return V(function(t,i){return e(n,t,r,i)})(it(t(n,r)))},n):("number"==typeof e&&(n=e),g(function(e,r){return function(t,e,n,r,i,o,s,a){var u=[],c=0,l=0,h=!1,d=function(){!h||u.length||c||e.complete()},p=function(t){return c<r?f(t):u.push(t)},f=function(t){o&&e.next(t),c++;var a=!1;it(n(t,l++)).subscribe(q(e,function(t){null==i||i(t),o?p(t):e.next(t)},function(){a=!0},void 0,function(){if(a)try{c--;for(var t=function(){var t=u.shift();s?st(e,s,function(){return f(t)}):f(t)};u.length&&c<r;)t();d()}catch(t){e.error(t)}}))};return t.subscribe(q(e,p,function(){h=!0,d()})),function(){null==a||a()}}(e,r,t,n)}))}function ut(t){return void 0===t&&(t=1/0),at(J,t)}function ct(t){return t&&m(t.schedule)}function lt(t){return t[t.length-1]}function ht(t){return m(lt(t))?t.pop():void 0}function dt(t){return ct(lt(t))?t.pop():void 0}function pt(t,e){return"number"==typeof lt(t)?t.pop():e}function ft(t,e){return void 0===e&&(e=0),g(function(n,r){n.subscribe(q(r,function(n){return st(r,t,function(){return r.next(n)},e)},function(){return st(r,t,function(){return r.complete()},e)},function(n){return st(r,t,function(){return r.error(n)},e)}))})}function mt(t,e){return void 0===e&&(e=0),g(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function gt(t,e){if(!t)throw new Error("Iterable cannot be null");return new X(function(n){st(n,e,function(){var r=t[Symbol.asyncIterator]();st(n,e,function(){r.next().then(function(t){t.done?n.complete():n.next(t.value)})},0,!0)})})}function _t(t,e){if(null!=t){if(Q(t))return function(t,e){return it(t).pipe(mt(e),ft(e))}(t,e);if(G(t))return function(t,e){return new X(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}(t,e);if(z(t))return function(t,e){return it(t).pipe(mt(e),ft(e))}(t,e);if(Z(t))return gt(t,e);if(et(t))return function(t,e){return new X(function(n){var r;return st(n,e,function(){r=t[tt](),st(n,e,function(){var t,e,i;try{e=(t=r.next()).value,i=t.done}catch(t){return void n.error(t)}i?n.complete():n.next(e)},0,!0)}),function(){return m(null==r?void 0:r.return)&&r.return()}})}(t,e);if(rt(t))return function(t,e){return gt(nt(t),e)}(t,e)}throw Y(t)}function yt(t,e){return e?_t(t,e):it(t)}Array.isArray;var vt=new X(function(t){return t.complete()});var bt=Array.isArray,wt=Object.getPrototypeOf,xt=Object.prototype,Tt=Object.keys;function kt(t){if(1===t.length){var e=t[0];if(bt(e))return{args:e,keys:null};if((r=e)&&"object"==typeof r&&wt(r)===xt){var n=Tt(e);return{args:n.map(function(t){return e[t]}),keys:n}}}var r;return{args:t,keys:null}}var St=Array.isArray;function At(t){return V(function(e){return function(t,e){return St(e)?t.apply(void 0,h([],l(e))):t(e)}(t,e)})}function Et(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=dt(t),r=ht(t),i=kt(t),o=i.args,s=i.keys;if(0===o.length)return yt([],n);var a=new X(Ot(o,n,s?function(t){return function(t,e){return t.reduce(function(t,n,r){return t[n]=e[r],t},{})}(s,t)}:J));return r?a.pipe(At(r)):a}function Ot(t,e,n){return void 0===n&&(n=J),function(r){Ct(e,function(){for(var i=t.length,o=new Array(i),s=i,a=i,u=function(i){Ct(e,function(){var u=yt(t[i],e),c=!1;u.subscribe(q(r,function(t){o[i]=t,c||(c=!0,a--),a||r.next(n(o.slice()))},function(){--s||r.complete()}))},r)},c=0;c<i;c++)u(c)},r)}}function Ct(t,e,n){t?st(n,t,e):e()}function Mt(){return ut(1)}function Nt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=ht(t);return g(function(e,r){for(var i=t.length,o=new Array(i),s=t.map(function(){return!1}),a=!1,u=function(e){it(t[e]).subscribe(q(r,function(t){o[e]=t,a||s[e]||(s[e]=!0,(a=s.every(J))&&(s=null))},O))},c=0;c<i;c++)u(c);e.subscribe(q(r,function(t){if(a){var e=h([t],l(o));r.next(n?n.apply(void 0,h([],l(e))):e)}}))})}function It(t,e){return g(function(n,r){var i=null,o=0,s=!1,a=function(){return s&&!i&&r.complete()};n.subscribe(q(r,function(n){null==i||i.unsubscribe();var s=0,u=o++;it(t(n,u)).subscribe(i=q(r,function(t){return r.next(e?e(n,t,u,s++):t)},function(){i=null,a()}))},function(){s=!0,a()}))})}function jt(t){return g(function(e,n){it(t).subscribe(q(n,function(){return n.complete()},O)),!n.closed&&e.subscribe(n)})}var Rt=y(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Pt=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return o(e,t),e.prototype.lift=function(t){var e=new Dt(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new Rt},e.prototype.next=function(t){var e=this;I(function(){var n,r;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=c(e.currentObservers),o=i.next();!o.done;o=i.next()){o.value.next(t)}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},e.prototype.error=function(t){var e=this;I(function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var n=e.observers;n.length;)n.shift().error(t)}})},e.prototype.complete=function(){var t=this;I(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?x:(this.currentObservers=null,o.push(t),new w(function(){e.currentObservers=null,b(o,t)}))},e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e.thrownError,i=e.isStopped;n?t.error(r):i&&t.complete()},e.prototype.asObservable=function(){var t=new X;return t.source=this,t},e.create=function(t,e){return new Dt(t,e)},e}(X),Dt=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return o(e,t),e.prototype.next=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===n||n.call(e,t)},e.prototype.error=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===n||n.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,n;return null!==(n=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==n?n:x},e}(Pt);function Lt(t){void 0===t&&(t={});var e=t.connector,n=void 0===e?function(){return new Pt}:e,r=t.resetOnError,i=void 0===r||r,o=t.resetOnComplete,s=void 0===o||o,a=t.resetOnRefCountZero,u=void 0===a||a;return function(t){var e,r,o,a=0,c=!1,l=!1,h=function(){null==r||r.unsubscribe(),r=void 0},d=function(){h(),e=o=void 0,c=l=!1},p=function(){var t=e;d(),null==t||t.unsubscribe()};return g(function(t,f){a++,l||c||h();var m=o=null!=o?o:n();f.add(function(){0!==--a||l||c||(r=Ft(p,u))}),m.subscribe(f),!e&&a>0&&(e=new L({next:function(t){return m.next(t)},error:function(t){l=!0,h(),r=Ft(d,i,t),m.error(t)},complete:function(){c=!0,h(),r=Ft(d,s),m.complete()}}),it(t).subscribe(e))})(t)}}function Ft(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!0!==e){if(!1!==e){var i=new L({next:function(){i.unsubscribe(),t()}});return it(e.apply(void 0,h([],l(n)))).subscribe(i)}}else t()}function $t(t,e){return g(function(n,r){var i=0;n.subscribe(q(r,function(n){return t.call(e,n,i++)&&r.next(n)}))})}function Bt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=dt(t),r=pt(t,1/0),i=t;return i.length?1===i.length?it(i[0]):ut(r)(yt(i,n)):vt}var qt=function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}return o(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return!n.closed&&e.next(this._value),n},e.prototype.getValue=function(){var t=this,e=t.hasError,n=t.thrownError,r=t._value;if(e)throw n;return this._throwIfClosed(),r},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(Pt);const Ut="https://gdb.leafgon.com/sgraphql",Vt="wss://gdb.leafgon.com/sgraphql",Gt="https://gdb.leafgon.com/qmgraphql",zt={breezyforest:{_version:"1.0",_nickname:"breezyforest",scaffold:{map:{leaf:{logic:{type:"",args:{}},provenance:{api:"breezyforest",uuid:"",graph:{appuuid:"",name:"",version:""}},appdata:{}}},directory:{api:["leaf","api"],logic:["leaf","logic"],type:["leaf","logic","type"],args:["leaf","logic","args"],provenance:["leaf","provenance"],uuid:["leaf","provenance","uuid"],leafapp:["leaf","provenance","leafapp"],appdata:["leaf","appdata"]},fetch:(t,e)=>{const n=(t,e)=>{const r=e[0],i=e.slice(1);return 0===i.length?t[r]:n(t[r],i)};try{return n(t,Array.isArray(e)?e:zt.breezyforest.scaffold.directory[e])}catch(t){return null}}},originType:{FRONTEND:1,BACKEND:2,SCREEN:4},subsDirectory:{readmefirst:{},leaflake:{bridges:{gql:"clientconfig_full"}},appintent:{},appmodel:{},appview:{},osview:{},osview2:{},dataflowplane:{},appcache:{}},IOAccessPermission:{Owner:1,Observer:2,Contributor:4,All:7},IOStateGroundZero:{dirOfSubjects:{},subsCache:{},subscriptions:{},callbacks:{},permissions:{}},GQLParameters:{clientconfig_full:{keepGQLConnected:!0,dburi_subs:Ut,dburi_subs_ws:Vt,dburi_qm:Gt},clientconfig_sub:{keepGQLConnected:!0,dburi_subs:Ut,dburi_subs_ws:Vt},clientconfig_qm:{dburi_qm:Gt},masterquery:"\n {\n domain\n appid\n nodes {\n uuid\n out_edges {uuid source {uuid} target {uuid} data}\n data\n }\n update {\n added {uuid out_edges {uuid source {uuid} target {uuid} data} data} \n removed {uuid}\n }\n }\n ".replace(/\s+/g," ")},LEAFdictionary:{map:V}}},Wt=t=>{const e={leafradioRX:{leaf:{logic:{type:"leafradioRX",args:{keyname:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["keyname"],bannednames:["Lambda"],banduplicatename:!0,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafradioRX.svg",width:40,height:30,bgColor:"rgba(235,255,35,0.2)",jsx:void 0}},lambdaports:{input:void 0,output:void 0},dataflow:{input:void 0,output:{_leafradiokey:{keyname:"",subsDirectory:Object},_leafradiorx:{txkey:"",payload:Object}}}},leafradioTX:{leaf:{logic:{type:"leafradioTX",args:{keyname:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["keyname"],bannednames:["Lambda"],banduplicatename:!1,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafradioTX.svg",width:40,height:30,bgColor:"rgba(135,255,135,0.2)",jsx:void 0}},lambdaports:{input:void 0,output:void 0},dataflow:{input:{_leafradiokey:{keyname:"",subsDirectory:Object},_leafradiotx:{txkey:"",payload:Object}},output:void 0}},leafoutflowport:{leaf:{logic:{type:"leafoutflowport",args:{}}},editorconfig:{nodetype:"tinynode",svgicon:{unicode:"⊖",url:void 0,jsx:void 0,fgColor:"rgba(255,255,255,1)",bgColor:"rgba(22,22,55,1)"}},lambdaports:{input:void 0,output:void 0},dataflow:{input:Object,output:void 0}},leafinflowport:{leaf:{logic:{type:"leafinflowport",args:{}}},editorconfig:{nodetype:"tinynode",svgicon:{unicode:"⊕",url:void 0,jsx:void 0,fgColor:"rgba(255,255,255,1)",bgColor:"rgba(55,22,22,1)"}},lambdaports:{input:void 0,output:void 0},dataflow:{input:void 0,output:Object}},leafmemoryio:{leaf:{logic:{type:"leafmemoryio",args:{elementconfig:{leafnodename:""},persistencyref:{updateref:"",dbref:""}}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["elementconfig","leafnodename"],banduplicatename:!1,banmultiplenode:!1,svgicon:{iconname:"memory io",unicode:void 0,url:"leafmemoryio.svg",jsx:void 0,width:40,height:40,bgColor:"rgba(255,255,255,0.6)"}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leafdeckdiamond:Object,_leafdeckclub:Object},output:{_leafdeckheart:Object}}},leafscreenio:{leaf:{logic:{type:"leafscreenio",args:{lispexpression:""}}},editorconfig:{nodetype:"circularnode",banduplicatename:!1,banmultiplenode:!1,svgicon:{iconname:"screen io",unicode:void 0,url:"leafscreenio.svg",jsx:void 0,width:40,height:40,bgColor:"rgba(205,155,215,0.6)"}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leaflisp_in:Object},output:{_leaflisp_out:Object}}},leafdeckspade:{leaf:{logic:{type:"leafdeckspade",args:{elementconfig:{leafnodename:""}}}},editorconfig:{nodetype:"circularnode",namedatakey:["elementconfig","leafnodename"],banmultiplenode:!0,svgicon:{unicode:void 0,url:"leafspade.svg",jsx:void 0}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leafdeckdiamond:Object,_leafdeckclub:Object},output:{_leafdeckspade:Object}}},leafdeckheart:{leaf:{logic:{type:"leafdeckheart",args:{elementconfig:{leafnodename:""}}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["elementconfig","leafnodename"],banduplicatename:!0,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafheart.svg",jsx:void 0}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leafdeckdiamond:Object,_leafdeckclub:Object},output:{_leafdeckheart:Object}}},leafdeckdiamond:{leaf:{logic:{type:"leafdeckdiamond",args:{elementconfig:{leafnodename:""}}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["elementconfig","leafnodename"],svgicon:{unicode:void 0,url:"diamond2.svg",jsx:void 0}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leafdeckclub:Object},output:{_leafdeckdiamond:Object}}},leafdeckclub:{leaf:{logic:{type:"leafdeckclub",args:{elementconfig:{leafnodename:""}}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["elementconfig","leafnodename"],svgicon:{unicode:void 0,url:"club3.svg",jsx:void 0}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leafdeckclubinit:Object},output:{_leafdeckclub:Object}}},leafelement:{leaf:{logic:{type:"leafelement",args:{elementname:"",svgicon:{unicode:void 0,url:"",jsx:Object},elementconfig:""}}},editorconfig:{nodetype:"circularnamednode",is_committable:!0,namedatakey:["elementname"],allowednames:["gnav","popup","editor","text","prompt","http","href","mediaplayer","image","mediainput","midi","sound","html","form","directus","openai","rancher"],banduplicatename:!1,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafelement.svg",width:40,height:40,bgColor:"rgba(35,5,15,0.7)",fgColor:"rgba(255,255,255,1)",jsx:void 0}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafgraph:{leaf:{logic:{type:"leafgraph",args:{graphuuid:"",domain:"",appid:"",graphaddrstr:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["graphaddrstr"],svgicon:{unicode:"✵",url:void 0,jsx:void 0,fgColor:"rgba(255,255,255,1.0)",bgColor:"rgba(220,02,100, 0.5)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leaflambdagraph:{leaf:{logic:{type:"leaflambdagraph",args:{}}},editorconfig:{nodetype:"circularnode",svgicon:{iconname:"contextual lambda",unicode:"λ",url:void 0,jsx:void 0,fgColor:"rgba(255,255,255,1.0)",bgColor:"rgba(0,0,0,0.5)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafanchor:{leaf:{logic:{type:"leafanchor",args:{}}},editorconfig:{nodetype:"tinynode",svgicon:{unicode:void 0,url:"trident_white.svg",width:15,height:15,jsx:void 0,fgColor:"rgba(255,255,255,1)",bgColor:"rgba(102, 102, 255, 1)"}},lambdaports:{input:void 0,output:void 0},dataflow:{input:void 0,output:void 0}},leafspelldef:{leaf:{logic:{type:"leafspelldef",args:{spellname:"",svgicon:{unicode:void 0,url:"",jsx:Object}}}},editorconfig:{nodetype:"rectangularnamednode",namedatakey:["spellname"],banduplicatename:!0,svgicon:{iconname:"spelldef",unicode:void 0,url:"leafspell.svg",jsx:void 0,bgColor:"rgba(80,80,135,0.8)",fgColor:"rgba(250,250,250,1.0)",width:40,height:30}},lambdaports:{input:Object,output:void 0},dataflow:{input:void 0,output:void 0}},leafspell:{leaf:{logic:{type:"leafspell",args:{spellname:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["spellname"],svgicon:{unicode:void 0,url:"leafloopyspell.svg",jsx:void 0,bgColor:"rgba(80,180,135,0.8)",fgColor:"rgba(250,250,250,1.0)",width:40,height:30}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafloopyspell:{leaf:{logic:{type:"leafloopyspell",args:{}}},editorconfig:{nodetype:"rectangularnode",banduplicatename:!0,svgicon:{iconname:"loopy spell",unicode:void 0,url:"leafloopyspell.svg",jsx:void 0,bgColor:"rgba(80,180,135,0.8)",fgColor:"rgba(250,250,250,1.0)",width:40,height:30}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafsyncflow:{leaf:{logic:{type:"leafsyncflow",args:{}}},fconfig:{inputsync:{combineOperator:"combine"}},editorconfig:{nodetype:"circularnode",svgicon:{unicode:void 0,iconname:"sync",url:"leafsyncflow.svg",jsx:void 0,bgColor:"rgba(80,200,255,1.0)",width:40,height:40}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafchronosflow:{leaf:{logic:{type:"leafchronosflow",args:{}}},fconfig:{inputsync:{combineOperator:"combine"}},editorconfig:{nodetype:"circularnode",svgicon:{unicode:void 0,iconname:"Chronos",url:"leafsyncflow.svg",jsx:void 0,bgColor:"rgba(80,200,255,1.0)",width:40,height:40}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafasyncflow:{leaf:{logic:{type:"leafasyncflow",args:{}}},fconfig:{inputsync:{combineOperator:"combine"}},editorconfig:{nodetype:"circularnode",svgicon:{unicode:void 0,iconname:"async",url:"leafsyncflow.svg",jsx:void 0,bgColor:"rgba(80,200,255,1.0)",width:40,height:40}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafmixflow:{leaf:{logic:{type:"leafmixflow",args:{mixOperator:"merge"}}},fconfig:{inputsync:void 0},editorconfig:{nodetype:"circularnode",svgicon:{iconname:"mix",unicode:void 0,url:"leafmixflow.svg",jsx:void 0,bgColor:"rgba(80,150,255,0.8)",width:40,height:40}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafgateflow:{leaf:{logic:{type:"leafgateflow",args:{keyname:"",notgatetoggle:!1}}},fconfig:{inputsync:{combineOperator:"merge"}},editorconfig:{nodetype:"circularnamedboolnode",namedatakey:["keyname"],toggledatakey:["notgatetoggle"],svgicon:{unicode:void 0,url:"leafgate.svg",jsx:void 0,width:40,height:30,bgColor0:"rgba(135,55,135,0.2)",bgColor1:"rgba(35,255,135,0.2)",toggleSymbol0:"⊜",toggleSymbol1:"≠"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leaflabel:{leaf:{logic:{type:"leaflabel",args:{labelstr:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["labelstr"],svgicon:{unicode:void 0,url:"leaflabel.svg",jsx:void 0,width:40,height:30,bgColor:"rgba(165,55,185,0.7)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafdelabel:{leaf:{logic:{type:"leafdelabel",args:{labelstr:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["labelstr"],svgicon:{unicode:void 0,url:"leafdelabel.svg",jsx:void 0,width:40,height:30,bgColor:"rgba(235,55,135,0.7)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafbottle:{leaf:{logic:{type:"leafbottle",args:{bottlekey:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["bottlekey"],banduplicatename:!1,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafbottle.svg",jsx:void 0,width:40,height:30,bgColor:"rgba(135,255,135,0.2)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafunbottle:{leaf:{logic:{type:"leafunbottle",args:{bottlekey:""}}},editorconfig:{nodetype:"circularnamednode",namedatakey:["bottlekey"],banduplicatename:!1,banmultiplenode:!1,svgicon:{unicode:void 0,url:"leafunbottle.svg",jsx:void 0,width:40,height:30,bgColor:"rgba(255,155,215,0.4)"}},lambdaports:{input:void 0,output:Object},dataflow:{input:Object,output:Object}},leafcrate:{leaf:{logic:{type:"leafcrate",args:{}}},editorconfig:{nodetype:"circularnode",svgicon:{iconname:"{crate}",unicode:void 0,url:"leafcrate.svg",jsx:void 0,width:40,height:40,bgColor:"rgba(155,205,85,0.7)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leafconfig:{leaf:{logic:{type:"leafconfig",args:{}}},editorconfig:{nodetype:"rectangularnode",banmultiplenode:!0,svgicon:{iconname:"config",unicode:void 0,url:"leafconfig.svg",jsx:void 0,width:40,height:40,bgColor:"rgba(255,205,85,1.0)"}},lambdaports:{input:Object,output:Object},dataflow:{input:Object,output:Object}},leaflisp:{leaf:{logic:{type:"leaflisp",args:{lispexpression:""}}},editorconfig:{nodetype:"circularnode",svgicon:{iconname:"leaflisp",unicode:void 0,url:"leaflisp.svg",jsx:void 0,width:40,height:40,bgColor:"rgba(205,255,215,0.7)"}},lambdaports:{input:Object,output:Object},dataflow:{input:{_leaflisp_in:Object},output:{_leaflisp_out:Object}}}};return void 0===t?e:t in e?e[t]:void 0},Jt={outport:"leafoutflowport",inport:"leafinflowport",screenio:"leafscreenio",memoryio:"leafmemoryio",spade:"leafdeckspade",heart:"leafdeckheart",diamond:"leafdeckdiamond",club:"leafdeckclub",element:"leafelement",anchor:"leafanchor",leafgraph:"leafgraph",lambda:"leaflambdagraph",spelldef:"leafspelldef",spell:"leafspell",loopyspell:"leafloopyspell",label:"leaflabel",delabel:"leafdelabel",bottle:"leafbottle",unbottle:"leafunbottle",crate:"leafcrate",config:"leafconfig",chronos:"leafchronosflow",async:"leafasyncflow",sync:"leafsyncflow",mix:"leafmixflow",gate:"leafgateflow",leaflisp:"leaflisp"},Ht={io:["leafradioRX","leafradioTX","leafoutflowport","leafinflowport","leafscreenio","leafmemoryio"],elements:["leafdeckspade","leafdeckheart","leafdeckdiamond","leafdeckclub","leafelement"],abstraction:["leafgraph","leaflambdagraph","leafspelldef","leafspell","leafloopyspell"],dataflow:["leaflabel","leafdelabel","leafbottle","leafunbottle","leafcrate"],arcane:["leaflisp"]},Xt={leaflambdaedge:{sourceHandle:"out_aux",targetHandle:"in_aux"},leafanchoredge:{sourceHandle:"out_anchor",targetHandle:"in_anchor"},leafdataedge:{sourceHandle:"out_a",targetHandle:"in_a"}},Kt={leaflambdaedge:{stroke:"#fff",fillOpacity:0},leafanchoredge:{stroke:"#88f",fillOpacity:0},leafdataedge:{stroke:"#fff",fillOpacity:0}};var Qt=n(7007);let Zt=function(){const t=arguments[0];for(let e=1,n=arguments.length;e<n;e++)if(arguments[e])for(const n in arguments[e])t[n]=arguments[e][n];return t};function Yt(t,e,n,r){const i=t._nodes.get(e);let o=null;return i?(o="mixed"===r?i.out&&i.out[n]||i.undirected&&i.undirected[n]:"directed"===r?i.out&&i.out[n]:i.undirected&&i.undirected[n],o):o}function te(t){return"object"==typeof t&&null!==t}function ee(t){let e;for(e in t)return!1;return!0}function ne(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function re(t,e,n){const r={enumerable:!0,configurable:!0};"function"==typeof n?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(t,e,r)}function ie(t){return!!te(t)&&!(t.attributes&&!Array.isArray(t.attributes))}function oe(){const t=arguments;let e=null,n=-1;return{[Symbol.iterator](){return this},next(){let r=null;for(;;){if(null===e){if(n++,n>=t.length)return{done:!0};e=t[n][Symbol.iterator]()}if(r=e.next(),!r.done)break;e=null}return r}}}function se(){return{[Symbol.iterator](){return this},next:()=>({done:!0})}}"function"==typeof Object.assign&&(Zt=Object.assign);class ae extends Error{constructor(t){super(),this.name="GraphError",this.message=t}}class ue extends ae{constructor(t){super(t),this.name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,ue.prototype.constructor)}}class ce extends ae{constructor(t){super(t),this.name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,ce.prototype.constructor)}}class le extends ae{constructor(t){super(t),this.name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,le.prototype.constructor)}}function he(t,e){this.key=t,this.attributes=e,this.clear()}function de(t,e){this.key=t,this.attributes=e,this.clear()}function pe(t,e){this.key=t,this.attributes=e,this.clear()}function fe(t,e,n,r,i){this.key=e,this.attributes=i,this.undirected=t,this.source=n,this.target=r}he.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},de.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},pe.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},fe.prototype.attach=function(){let t="out",e="in";this.undirected&&(t=e="undirected");const n=this.source.key,r=this.target.key;this.source[t][r]=this,this.undirected&&n===r||(this.target[e][n]=this)},fe.prototype.attachMulti=function(){let t="out",e="in";const n=this.source.key,r=this.target.key;this.undirected&&(t=e="undirected");const i=this.source[t],o=i[r];if(void 0===o)return i[r]=this,void(this.undirected&&n===r||(this.target[e][n]=this));o.previous=this,this.next=o,i[r]=this,this.target[e][n]=this},fe.prototype.detach=function(){const t=this.source.key,e=this.target.key;let n="out",r="in";this.undirected&&(n=r="undirected"),delete this.source[n][e],delete this.target[r][t]},fe.prototype.detachMulti=function(){const t=this.source.key,e=this.target.key;let n="out",r="in";this.undirected&&(n=r="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][e],delete this.target[r][t]):(this.next.previous=void 0,this.source[n][e]=this.next,this.target[r][t]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};function me(t,e,n,r,i,o,s){let a,u,c,l;if(r=""+r,0===n){if(a=t._nodes.get(r),!a)throw new ce(`Graph.${e}: could not find the "${r}" node in the graph.`);c=i,l=o}else if(3===n){if(i=""+i,u=t._edges.get(i),!u)throw new ce(`Graph.${e}: could not find the "${i}" edge in the graph.`);const n=u.source.key,h=u.target.key;if(r===n)a=u.target;else{if(r!==h)throw new ce(`Graph.${e}: the "${r}" node is not attached to the "${i}" edge (${n}, ${h}).`);a=u.source}c=o,l=s}else{if(u=t._edges.get(r),!u)throw new ce(`Graph.${e}: could not find the "${r}" edge in the graph.`);a=1===n?u.source:u.target,c=i,l=o}return[a,c,l]}const ge=[{name:t=>`get${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=me(this,e,n,t,r,i);return o.attributes[s]}}},{name:t=>`get${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r){const[i]=me(this,e,n,t,r);return i.attributes}}},{name:t=>`has${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=me(this,e,n,t,r,i);return o.attributes.hasOwnProperty(s)}}},{name:t=>`set${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i,o){const[s,a,u]=me(this,e,n,t,r,i,o);return s.attributes[a]=u,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:a}),this}}},{name:t=>`update${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i,o){const[s,a,u]=me(this,e,n,t,r,i,o);if("function"!=typeof u)throw new ue(`Graph.${e}: updater should be a function.`);const c=s.attributes,l=u(c[a]);return c[a]=l,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:a}),this}}},{name:t=>`remove${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=me(this,e,n,t,r,i);return delete o.attributes[s],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:s}),this}}},{name:t=>`replace${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=me(this,e,n,t,r,i);if(!te(s))throw new ue(`Graph.${e}: provided attributes are not a plain object.`);return o.attributes=s,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}},{name:t=>`merge${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=me(this,e,n,t,r,i);if(!te(s))throw new ue(`Graph.${e}: provided attributes are not a plain object.`);return Zt(o.attributes,s),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:s}),this}}},{name:t=>`update${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){const[o,s]=me(this,e,n,t,r,i);if("function"!=typeof s)throw new ue(`Graph.${e}: provided updater is not a function.`);return o.attributes=s(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}}];const _e=[{name:t=>`get${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Yt(this,o,s,n),!i)throw new ce(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return i.attributes[r]}}},{name:t=>`get${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t){let r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const i=""+t,o=""+arguments[1];if(r=Yt(this,i,o,n),!r)throw new ce(`Graph.${e}: could not find an edge for the given path ("${i}" - "${o}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,r=this._edges.get(t),!r)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return r.attributes}}},{name:t=>`has${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Yt(this,o,s,n),!i)throw new ce(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return i.attributes.hasOwnProperty(r)}}},{name:t=>`set${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){let o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+t,a=""+r;if(r=arguments[2],i=arguments[3],o=Yt(this,s,a,n),!o)throw new ce(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,o=this._edges.get(t),!o)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return o.attributes[r]=i,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}},{name:t=>`update${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r,i){let o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+t,a=""+r;if(r=arguments[2],i=arguments[3],o=Yt(this,s,a,n),!o)throw new ce(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,o=this._edges.get(t),!o)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if("function"!=typeof i)throw new ue(`Graph.${e}: updater should be a function.`);return o.attributes[r]=i(o.attributes[r]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}},{name:t=>`remove${t}Attribute`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Yt(this,o,s,n),!i)throw new ce(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return delete i.attributes[r],this.emit("edgeAttributesUpdated",{key:i.key,type:"remove",attributes:i.attributes,name:r}),this}}},{name:t=>`replace${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Yt(this,o,s,n),!i)throw new ce(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if(!te(r))throw new ue(`Graph.${e}: provided attributes are not a plain object.`);return i.attributes=r,this.emit("edgeAttributesUpdated",{key:i.key,type:"replace",attributes:i.attributes}),this}}},{name:t=>`merge${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Yt(this,o,s,n),!i)throw new ce(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if(!te(r))throw new ue(`Graph.${e}: provided attributes are not a plain object.`);return Zt(i.attributes,r),this.emit("edgeAttributesUpdated",{key:i.key,type:"merge",attributes:i.attributes,data:r}),this}}},{name:t=>`update${t}Attributes`,attacher:function(t,e,n){t.prototype[e]=function(t,r){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new le(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new le(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+t,s=""+r;if(r=arguments[2],i=Yt(this,o,s,n),!i)throw new ce(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==n)throw new le(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(t=""+t,i=this._edges.get(t),!i)throw new ce(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if("function"!=typeof r)throw new ue(`Graph.${e}: provided updater is not a function.`);return i.attributes=r(i.attributes),this.emit("edgeAttributesUpdated",{key:i.key,type:"update",attributes:i.attributes}),this}}}];const ye=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function ve(t,e,n,r){let i=!1;for(const o in e){if(o===r)continue;const s=e[o];if(i=n(s.key,s.attributes,s.source.key,s.target.key,s.source.attributes,s.target.attributes,s.undirected),t&&i)return s.key}}function be(t,e,n,r){let i,o,s,a=!1;for(const u in e)if(u!==r){i=e[u];do{if(o=i.source,s=i.target,a=n(i.key,i.attributes,o.key,s.key,o.attributes,s.attributes,i.undirected),t&&a)return i.key;i=i.next}while(void 0!==i)}}function we(t,e){const n=Object.keys(t),r=n.length;let i,o=0;return{[Symbol.iterator](){return this},next(){do{if(i)i=i.next;else{if(o>=r)return{done:!0};const s=n[o++];if(s===e){i=void 0;continue}i=t[s]}}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function xe(t,e,n,r){const i=e[n];if(!i)return;const o=i.source,s=i.target;return r(i.key,i.attributes,o.key,s.key,o.attributes,s.attributes,i.undirected)&&t?i.key:void 0}function Te(t,e,n,r){let i=e[n];if(!i)return;let o=!1;do{if(o=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),t&&o)return i.key;i=i.next}while(void 0!==i)}function ke(t,e){let n=t[e];if(void 0!==n.next)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};const t={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:t}}};let r=!1;return{[Symbol.iterator](){return this},next:()=>!0===r?{done:!0}:(r=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}})}}function Se(t,e,n,r){if(0===e.size)return;const i="mixed"!==n&&n!==e.type,o="undirected"===n;let s,a,u=!1;const c=e._edges.values();for(;s=c.next(),!0!==s.done;){if(a=s.value,i&&a.undirected!==o)continue;const{key:e,attributes:n,source:c,target:l}=a;if(u=r(e,n,c.key,l.key,c.attributes,l.attributes,a.undirected),t&&u)return e}}function Ae(t,e,n,r,i,o){const s=e?be:ve;let a;if("undirected"!==n){if("out"!==r&&(a=s(t,i.in,o),t&&a))return a;if("in"!==r&&(a=s(t,i.out,o,r?void 0:i.key),t&&a))return a}if("directed"!==n&&(a=s(t,i.undirected,o),t&&a))return a}function Ee(t,e,n,r,i,o,s){const a=n?Te:xe;let u;if("undirected"!==e){if(void 0!==i.in&&"out"!==r&&(u=a(t,i.in,o,s),t&&u))return u;if(void 0!==i.out&&"in"!==r&&(r||i.key!==o)&&(u=a(t,i.out,o,s),t&&u))return u}if("directed"!==e&&void 0!==i.undirected&&(u=a(t,i.undirected,o,s),t&&u))return u}function Oe(t,e){const{name:n,type:r,direction:i}=e;t.prototype[n]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];if(!arguments.length)return function(t,e){if(0===t.size)return[];if("mixed"===e||e===t.type)return Array.from(t._edges.keys());const n="undirected"===e?t.undirectedSize:t.directedSize,r=new Array(n),i="undirected"===e,o=t._edges.values();let s,a,u=0;for(;s=o.next(),!0!==s.done;)a=s.value,a.undirected===i&&(r[u++]=a.key);return r}(this,r);if(1===arguments.length){t=""+t;const e=this._nodes.get(t);if(void 0===e)throw new ce(`Graph.${n}: could not find the "${t}" node in the graph.`);return function(t,e,n,r){const i=[];return Ae(!1,t,e,n,r,function(t){i.push(t)}),i}(this.multi,"mixed"===r?this.type:r,i,e)}if(2===arguments.length){t=""+t,e=""+e;const o=this._nodes.get(t);if(!o)throw new ce(`Graph.${n}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ce(`Graph.${n}: could not find the "${e}" target node in the graph.`);return function(t,e,n,r,i){const o=[];return Ee(!1,t,e,n,r,i,function(t){o.push(t)}),o}(r,this.multi,i,o,e)}throw new ue(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Ce(t,e){const{name:n,type:r,direction:i}=e,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return se();if(!arguments.length)return function(t,e){if(0===t.size)return se();const n="mixed"!==e&&e!==t.type,r="undirected"===e,i=t._edges.values();return{[Symbol.iterator](){return this},next(){let t,e;for(;;){if(t=i.next(),t.done)return t;if(e=t.value,!n||e.undirected===r)break}return{value:{edge:e.key,attributes:e.attributes,source:e.source.key,target:e.target.key,sourceAttributes:e.source.attributes,targetAttributes:e.target.attributes,undirected:e.undirected},done:!1}}}}(this,r);if(1===arguments.length){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.${o}: could not find the "${t}" node in the graph.`);return function(t,e,n){let r=se();return"undirected"!==t&&("out"!==e&&void 0!==n.in&&(r=oe(r,we(n.in))),"in"!==e&&void 0!==n.out&&(r=oe(r,we(n.out,e?void 0:n.key)))),"directed"!==t&&void 0!==n.undirected&&(r=oe(r,we(n.undirected))),r}(r,i,e)}if(2===arguments.length){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ce(`Graph.${o}: could not find the "${e}" target node in the graph.`);return function(t,e,n,r){let i=se();return"undirected"!==t&&(void 0!==n.in&&"out"!==e&&r in n.in&&(i=oe(i,ke(n.in,r))),void 0!==n.out&&"in"!==e&&r in n.out&&(e||n.key!==r)&&(i=oe(i,ke(n.out,r)))),"directed"!==t&&void 0!==n.undirected&&r in n.undirected&&(i=oe(i,ke(n.undirected,r))),i}(r,i,n,e)}throw new ue(`Graph.${o}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}const Me=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function Ne(){this.A=null,this.B=null}function Ie(t,e,n,r,i){for(const o in r){const s=r[o],a=s.source,u=s.target,c=a===n?u:a;if(e&&e.has(c.key))continue;const l=i(c.key,c.attributes);if(t&&l)return c.key}}function je(t,e,n,r,i){if("mixed"!==e){if("undirected"===e)return Ie(t,null,r,r.undirected,i);if("string"==typeof n)return Ie(t,null,r,r[n],i)}const o=new Ne;let s;if("undirected"!==e){if("out"!==n){if(s=Ie(t,null,r,r.in,i),t&&s)return s;o.wrap(r.in)}if("in"!==n){if(s=Ie(t,o,r,r.out,i),t&&s)return s;o.wrap(r.out)}}if("directed"!==e&&(s=Ie(t,o,r,r.undirected,i),t&&s))return s}function Re(t,e,n){const r=Object.keys(n),i=r.length;let o=0;return{[Symbol.iterator](){return this},next(){let s=null;do{if(o>=i)return t&&t.wrap(n),{done:!0};const a=n[r[o++]],u=a.source,c=a.target;s=u===e?c:u,t&&t.has(s.key)&&(s=null)}while(null===s);return{done:!1,value:{neighbor:s.key,attributes:s.attributes}}}}}function Pe(t,e){const{name:n,type:r,direction:i}=e;t.prototype[n]=function(t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];t=""+t;const e=this._nodes.get(t);if(void 0===e)throw new ce(`Graph.${n}: could not find the "${t}" node in the graph.`);return function(t,e,n){if("mixed"!==t){if("undirected"===t)return Object.keys(n.undirected);if("string"==typeof e)return Object.keys(n[e])}const r=[];return je(!1,t,e,n,function(t){r.push(t)}),r}("mixed"===r?this.type:r,i,e)}}function De(t,e){const{name:n,type:r,direction:i}=e,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return se();t=""+t;const e=this._nodes.get(t);if(void 0===e)throw new ce(`Graph.${o}: could not find the "${t}" node in the graph.`);return function(t,e,n){if("mixed"!==t){if("undirected"===t)return Re(null,n,n.undirected);if("string"==typeof e)return Re(null,n,n[e])}let r=se();const i=new Ne;return"undirected"!==t&&("out"!==e&&(r=oe(r,Re(i,n,n.in))),"in"!==e&&(r=oe(r,Re(i,n,n.out)))),"directed"!==t&&(r=oe(r,Re(i,n,n.undirected))),r}("mixed"===r?this.type:r,i,e)}}function Le(t,e,n,r,i){const o=r._nodes.values(),s=r.type;let a,u,c,l,h,d,p;for(;a=o.next(),!0!==a.done;){let r=!1;if(u=a.value,"undirected"!==s)for(c in l=u.out,l){h=l[c];do{if(d=h.target,r=!0,p=i(u.key,d.key,u.attributes,d.attributes,h.key,h.attributes,h.undirected),t&&p)return h;h=h.next}while(h)}if("directed"!==s)for(c in l=u.undirected,l)if(!(e&&u.key>c)){h=l[c];do{if(d=h.target,d.key!==c&&(d=h.source),r=!0,p=i(u.key,d.key,u.attributes,d.attributes,h.key,h.attributes,h.undirected),t&&p)return h;h=h.next}while(h)}if(n&&!r&&(p=i(u.key,null,u.attributes,null,null,null,null),t&&p))return null}}function Fe(t){if(!te(t))throw new ue('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in t))throw new ue("Graph.import: serialized node is missing its key.");if("attributes"in t&&(!te(t.attributes)||null===t.attributes))throw new ue("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function $e(t){if(!te(t))throw new ue('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in t))throw new ue("Graph.import: serialized edge is missing its source.");if(!("target"in t))throw new ue("Graph.import: serialized edge is missing its target.");if("attributes"in t&&(!te(t.attributes)||null===t.attributes))throw new ue("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in t&&"boolean"!=typeof t.undirected)throw new ue("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}Ne.prototype.wrap=function(t){null===this.A?this.A=t:null===this.B&&(this.B=t)},Ne.prototype.has=function(t){return null!==this.A&&t in this.A||null!==this.B&&t in this.B};const Be=function(){let t=255&Math.floor(256*Math.random());return()=>t++}(),qe=new Set(["directed","undirected","mixed"]),Ue=new Set(["domain","_events","_eventsCount","_maxListeners"]),Ve={allowSelfLoops:!0,multi:!1,type:"mixed"};function Ge(t,e,n){const r=new t.NodeDataClass(e,n);return t._nodes.set(e,r),t.emit("nodeAdded",{key:e,attributes:n}),r}function ze(t,e,n,r,i,o,s,a){if(!r&&"undirected"===t.type)throw new le(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&"directed"===t.type)throw new le(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(a&&!te(a))throw new ue(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`);if(o=""+o,s=""+s,a=a||{},!t.allowSelfLoops&&o===s)throw new le(`Graph.${e}: source & target are the same ("${o}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const u=t._nodes.get(o),c=t._nodes.get(s);if(!u)throw new ce(`Graph.${e}: source node "${o}" not found.`);if(!c)throw new ce(`Graph.${e}: target node "${s}" not found.`);const l={key:null,undirected:r,source:o,target:s,attributes:a};if(n)i=t._edgeKeyGenerator();else if(i=""+i,t._edges.has(i))throw new le(`Graph.${e}: the "${i}" edge already exists in the graph.`);if(!t.multi&&(r?void 0!==u.undirected[s]:void 0!==u.out[s]))throw new le(`Graph.${e}: an edge linking "${o}" to "${s}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const h=new fe(r,i,u,c,a);t._edges.set(i,h);const d=o===s;return r?(u.undirectedDegree++,c.undirectedDegree++,d&&(u.undirectedLoops++,t._undirectedSelfLoopCount++)):(u.outDegree++,c.inDegree++,d&&(u.directedLoops++,t._directedSelfLoopCount++)),t.multi?h.attachMulti():h.attach(),r?t._undirectedSize++:t._directedSize++,l.key=i,t.emit("edgeAdded",l),i}function We(t,e,n,r,i,o,s,a,u){if(!r&&"undirected"===t.type)throw new le(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&"directed"===t.type)throw new le(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(a)if(u){if("function"!=typeof a)throw new ue(`Graph.${e}: invalid updater function. Expecting a function but got "${a}"`)}else if(!te(a))throw new ue(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`);let c;if(o=""+o,s=""+s,u&&(c=a,a=void 0),!t.allowSelfLoops&&o===s)throw new le(`Graph.${e}: source & target are the same ("${o}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let l,h,d=t._nodes.get(o),p=t._nodes.get(s);if(!n&&(l=t._edges.get(i),l)){if(!(l.source.key===o&&l.target.key===s||r&&l.source.key===s&&l.target.key===o))throw new le(`Graph.${e}: inconsistency detected when attempting to merge the "${i}" edge with "${o}" source & "${s}" target vs. ("${l.source.key}", "${l.target.key}").`);h=l}if(h||t.multi||!d||(h=r?d.undirected[s]:d.out[s]),h){const e=[h.key,!1,!1,!1];if(u?!c:!a)return e;if(u){const e=h.attributes;h.attributes=c(e),t.emit("edgeAttributesUpdated",{type:"replace",key:h.key,attributes:h.attributes})}else Zt(h.attributes,a),t.emit("edgeAttributesUpdated",{type:"merge",key:h.key,attributes:h.attributes,data:a});return e}a=a||{},u&&c&&(a=c(a));const f={key:null,undirected:r,source:o,target:s,attributes:a};if(n)i=t._edgeKeyGenerator();else if(i=""+i,t._edges.has(i))throw new le(`Graph.${e}: the "${i}" edge already exists in the graph.`);let m=!1,g=!1;d||(d=Ge(t,o,{}),m=!0,o===s&&(p=d,g=!0)),p||(p=Ge(t,s,{}),g=!0),l=new fe(r,i,d,p,a),t._edges.set(i,l);const _=o===s;return r?(d.undirectedDegree++,p.undirectedDegree++,_&&(d.undirectedLoops++,t._undirectedSelfLoopCount++)):(d.outDegree++,p.inDegree++,_&&(d.directedLoops++,t._directedSelfLoopCount++)),t.multi?l.attachMulti():l.attach(),r?t._undirectedSize++:t._directedSize++,f.key=i,t.emit("edgeAdded",f),[i,!0,m,g]}function Je(t,e){t._edges.delete(e.key);const{source:n,target:r,attributes:i}=e,o=e.undirected,s=n===r;o?(n.undirectedDegree--,r.undirectedDegree--,s&&(n.undirectedLoops--,t._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,s&&(n.directedLoops--,t._directedSelfLoopCount--)),t.multi?e.detachMulti():e.detach(),o?t._undirectedSize--:t._directedSize--,t.emit("edgeDropped",{key:e.key,attributes:i,source:n.key,target:r.key,undirected:o})}class He extends Qt.EventEmitter{constructor(t){if(super(),"boolean"!=typeof(t=Zt({},Ve,t)).multi)throw new ue(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${t.multi}".`);if(!qe.has(t.type))throw new ue(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${t.type}".`);if("boolean"!=typeof t.allowSelfLoops)throw new ue(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${t.allowSelfLoops}".`);ne(this,"NodeDataClass","mixed"===t.type?he:"directed"===t.type?de:pe);const e="geid_"+Be()+"_";let n=0;ne(this,"_attributes",{}),ne(this,"_nodes",new Map),ne(this,"_edges",new Map),ne(this,"_directedSize",0),ne(this,"_undirectedSize",0),ne(this,"_directedSelfLoopCount",0),ne(this,"_undirectedSelfLoopCount",0),ne(this,"_edgeKeyGenerator",()=>{let t;do{t=e+n++}while(this._edges.has(t));return t}),ne(this,"_options",t),Ue.forEach(t=>ne(this,t,this[t])),re(this,"order",()=>this._nodes.size),re(this,"size",()=>this._edges.size),re(this,"directedSize",()=>this._directedSize),re(this,"undirectedSize",()=>this._undirectedSize),re(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),re(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),re(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),re(this,"multi",this._options.multi),re(this,"type",this._options.type),re(this,"allowSelfLoops",this._options.allowSelfLoops),re(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(t){return this._nodes.has(""+t)}hasDirectedEdge(t,e){if("undirected"===this.type)return!1;if(1===arguments.length){const e=""+t,n=this._edges.get(e);return!!n&&!n.undirected}if(2===arguments.length){t=""+t,e=""+e;const n=this._nodes.get(t);return!!n&&n.out.hasOwnProperty(e)}throw new ue(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(t,e){if("directed"===this.type)return!1;if(1===arguments.length){const e=""+t,n=this._edges.get(e);return!!n&&n.undirected}if(2===arguments.length){t=""+t,e=""+e;const n=this._nodes.get(t);return!!n&&n.undirected.hasOwnProperty(e)}throw new ue(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(t,e){if(1===arguments.length){const e=""+t;return this._edges.has(e)}if(2===arguments.length){t=""+t,e=""+e;const n=this._nodes.get(t);return!!n&&(void 0!==n.out&&n.out.hasOwnProperty(e)||void 0!==n.undirected&&n.undirected.hasOwnProperty(e))}throw new ue(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(t,e){if("undirected"===this.type)return;if(t=""+t,e=""+e,this.multi)throw new le("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const n=this._nodes.get(t);if(!n)throw new ce(`Graph.directedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ce(`Graph.directedEdge: could not find the "${e}" target node in the graph.`);const r=n.out&&n.out[e]||void 0;return r?r.key:void 0}undirectedEdge(t,e){if("directed"===this.type)return;if(t=""+t,e=""+e,this.multi)throw new le("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const n=this._nodes.get(t);if(!n)throw new ce(`Graph.undirectedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ce(`Graph.undirectedEdge: could not find the "${e}" target node in the graph.`);const r=n.undirected&&n.undirected[e]||void 0;return r?r.key:void 0}edge(t,e){if(this.multi)throw new le("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.edge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ce(`Graph.edge: could not find the "${e}" target node in the graph.`);const r=n.out&&n.out[e]||n.undirected&&n.undirected[e]||void 0;if(r)return r.key}areDirectedNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.areDirectedNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&(e in n.in||e in n.out)}areOutNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.areOutNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&e in n.out}areInNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.areInNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&e in n.in}areUndirectedNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.areUndirectedNeighbors: could not find the "${t}" node in the graph.`);return"directed"!==this.type&&e in n.undirected}areNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.areNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&(e in n.in||e in n.out)||"directed"!==this.type&&e in n.undirected}areInboundNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.areInboundNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&e in n.in||"directed"!==this.type&&e in n.undirected}areOutboundNeighbors(t,e){t=""+t,e=""+e;const n=this._nodes.get(t);if(!n)throw new ce(`Graph.areOutboundNeighbors: could not find the "${t}" node in the graph.`);return"undirected"!==this.type&&e in n.out||"directed"!==this.type&&e in n.undirected}inDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.inDegree: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.inDegree}outDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.outDegree: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.outDegree}directedDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.directedDegree: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.inDegree+e.outDegree}undirectedDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.undirectedDegree: could not find the "${t}" node in the graph.`);return"directed"===this.type?0:e.undirectedDegree}inboundDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.inboundDegree: could not find the "${t}" node in the graph.`);let n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree),n}outboundDegree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.outboundDegree: could not find the "${t}" node in the graph.`);let n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.outDegree),n}degree(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.degree: could not find the "${t}" node in the graph.`);let n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree),n}inDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.inDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.inDegree-e.directedLoops}outDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.outDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.outDegree-e.directedLoops}directedDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.directedDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return"undirected"===this.type?0:e.inDegree+e.outDegree-2*e.directedLoops}undirectedDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return"directed"===this.type?0:e.undirectedDegree-2*e.undirectedLoops}inboundDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree,r+=e.directedLoops),n-r}outboundDegreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.outDegree,r+=e.directedLoops),n-r}degreeWithoutSelfLoops(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.degreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree,r+=2*e.directedLoops),n-r}source(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ce(`Graph.source: could not find the "${t}" edge in the graph.`);return e.source.key}target(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ce(`Graph.target: could not find the "${t}" edge in the graph.`);return e.target.key}extremities(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ce(`Graph.extremities: could not find the "${t}" edge in the graph.`);return[e.source.key,e.target.key]}opposite(t,e){t=""+t,e=""+e;const n=this._edges.get(e);if(!n)throw new ce(`Graph.opposite: could not find the "${e}" edge in the graph.`);const r=n.source.key,i=n.target.key;if(t===r)return i;if(t===i)return r;throw new ce(`Graph.opposite: the "${t}" node is not attached to the "${e}" edge (${r}, ${i}).`)}hasExtremity(t,e){t=""+t,e=""+e;const n=this._edges.get(t);if(!n)throw new ce(`Graph.hasExtremity: could not find the "${t}" edge in the graph.`);return n.source.key===e||n.target.key===e}isUndirected(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ce(`Graph.isUndirected: could not find the "${t}" edge in the graph.`);return e.undirected}isDirected(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ce(`Graph.isDirected: could not find the "${t}" edge in the graph.`);return!e.undirected}isSelfLoop(t){t=""+t;const e=this._edges.get(t);if(!e)throw new ce(`Graph.isSelfLoop: could not find the "${t}" edge in the graph.`);return e.source===e.target}addNode(t,e){const n=function(t,e,n){if(n&&!te(n))throw new ue(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(e=""+e,n=n||{},t._nodes.has(e))throw new le(`Graph.addNode: the "${e}" node already exist in the graph.`);const r=new t.NodeDataClass(e,n);return t._nodes.set(e,r),t.emit("nodeAdded",{key:e,attributes:n}),r}(this,t,e);return n.key}mergeNode(t,e){if(e&&!te(e))throw new ue(`Graph.mergeNode: invalid attributes. Expecting an object but got "${e}"`);t=""+t,e=e||{};let n=this._nodes.get(t);return n?(e&&(Zt(n.attributes,e),this.emit("nodeAttributesUpdated",{type:"merge",key:t,attributes:n.attributes,data:e})),[t,!1]):(n=new this.NodeDataClass(t,e),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:e}),[t,!0])}updateNode(t,e){if(e&&"function"!=typeof e)throw new ue(`Graph.updateNode: invalid updater function. Expecting a function but got "${e}"`);t=""+t;let n=this._nodes.get(t);if(n){if(e){const r=n.attributes;n.attributes=e(r),this.emit("nodeAttributesUpdated",{type:"replace",key:t,attributes:n.attributes})}return[t,!1]}const r=e?e({}):{};return n=new this.NodeDataClass(t,r),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:r}),[t,!0]}dropNode(t){t=""+t;const e=this._nodes.get(t);if(!e)throw new ce(`Graph.dropNode: could not find the "${t}" node in the graph.`);let n;if("undirected"!==this.type){for(const t in e.out){n=e.out[t];do{Je(this,n),n=n.next}while(n)}for(const t in e.in){n=e.in[t];do{Je(this,n),n=n.next}while(n)}}if("directed"!==this.type)for(const t in e.undirected){n=e.undirected[t];do{Je(this,n),n=n.next}while(n)}this._nodes.delete(t),this.emit("nodeDropped",{key:t,attributes:e.attributes})}dropEdge(t){let e;if(arguments.length>1){const t=""+arguments[0],n=""+arguments[1];if(e=Yt(this,t,n,this.type),!e)throw new ce(`Graph.dropEdge: could not find the "${t}" -> "${n}" edge in the graph.`)}else if(t=""+t,e=this._edges.get(t),!e)throw new ce(`Graph.dropEdge: could not find the "${t}" edge in the graph.`);return Je(this,e),this}dropDirectedEdge(t,e){if(arguments.length<2)throw new le("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new le("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const n=Yt(this,t=""+t,e=""+e,"directed");if(!n)throw new ce(`Graph.dropDirectedEdge: could not find a "${t}" -> "${e}" edge in the graph.`);return Je(this,n),this}dropUndirectedEdge(t,e){if(arguments.length<2)throw new le("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new le("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const n=Yt(this,t,e,"undirected");if(!n)throw new ce(`Graph.dropUndirectedEdge: could not find a "${t}" -> "${e}" edge in the graph.`);return Je(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const t=this._nodes.values();let e;for(;e=t.next(),!0!==e.done;)e.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(t){return this._attributes[t]}getAttributes(){return this._attributes}hasAttribute(t){return this._attributes.hasOwnProperty(t)}setAttribute(t,e){return this._attributes[t]=e,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this}updateAttribute(t,e){if("function"!=typeof e)throw new ue("Graph.updateAttribute: updater should be a function.");const n=this._attributes[t];return this._attributes[t]=e(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this}removeAttribute(t){return delete this._attributes[t],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:t}),this}replaceAttributes(t){if(!te(t))throw new ue("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=t,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(t){if(!te(t))throw new ue("Graph.mergeAttributes: provided attributes are not a plain object.");return Zt(this._attributes,t),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:t}),this}updateAttributes(t){if("function"!=typeof t)throw new ue("Graph.updateAttributes: provided updater is not a function.");return this._attributes=t(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(t,e){if("function"!=typeof t)throw new ue("Graph.updateEachNodeAttributes: expecting an updater function.");if(e&&!ie(e))throw new ue("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._nodes.values();let r,i;for(;r=n.next(),!0!==r.done;)i=r.value,i.attributes=t(i.key,i.attributes);this.emit("eachNodeAttributesUpdated",{hints:e||null})}updateEachEdgeAttributes(t,e){if("function"!=typeof t)throw new ue("Graph.updateEachEdgeAttributes: expecting an updater function.");if(e&&!ie(e))throw new ue("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._edges.values();let r,i,o,s;for(;r=n.next(),!0!==r.done;)i=r.value,o=i.source,s=i.target,i.attributes=t(i.key,i.attributes,o.key,s.key,o.attributes,s.attributes,i.undirected);this.emit("eachEdgeAttributesUpdated",{hints:e||null})}forEachAdjacencyEntry(t){if("function"!=typeof t)throw new ue("Graph.forEachAdjacencyEntry: expecting a callback.");Le(!1,!1,!1,this,t)}forEachAdjacencyEntryWithOrphans(t){if("function"!=typeof t)throw new ue("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");Le(!1,!1,!0,this,t)}forEachAssymetricAdjacencyEntry(t){if("function"!=typeof t)throw new ue("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");Le(!1,!0,!1,this,t)}forEachAssymetricAdjacencyEntryWithOrphans(t){if("function"!=typeof t)throw new ue("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");Le(!1,!0,!0,this,t)}nodes(){return Array.from(this._nodes.keys())}forEachNode(t){if("function"!=typeof t)throw new ue("Graph.forEachNode: expecting a callback.");const e=this._nodes.values();let n,r;for(;n=e.next(),!0!==n.done;)r=n.value,t(r.key,r.attributes)}findNode(t){if("function"!=typeof t)throw new ue("Graph.findNode: expecting a callback.");const e=this._nodes.values();let n,r;for(;n=e.next(),!0!==n.done;)if(r=n.value,t(r.key,r.attributes))return r.key}mapNodes(t){if("function"!=typeof t)throw new ue("Graph.mapNode: expecting a callback.");const e=this._nodes.values();let n,r;const i=new Array(this.order);let o=0;for(;n=e.next(),!0!==n.done;)r=n.value,i[o++]=t(r.key,r.attributes);return i}someNode(t){if("function"!=typeof t)throw new ue("Graph.someNode: expecting a callback.");const e=this._nodes.values();let n,r;for(;n=e.next(),!0!==n.done;)if(r=n.value,t(r.key,r.attributes))return!0;return!1}everyNode(t){if("function"!=typeof t)throw new ue("Graph.everyNode: expecting a callback.");const e=this._nodes.values();let n,r;for(;n=e.next(),!0!==n.done;)if(r=n.value,!t(r.key,r.attributes))return!1;return!0}filterNodes(t){if("function"!=typeof t)throw new ue("Graph.filterNodes: expecting a callback.");const e=this._nodes.values();let n,r;const i=[];for(;n=e.next(),!0!==n.done;)r=n.value,t(r.key,r.attributes)&&i.push(r.key);return i}reduceNodes(t,e){if("function"!=typeof t)throw new ue("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new ue("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let n=e;const r=this._nodes.values();let i,o;for(;i=r.next(),!0!==i.done;)o=i.value,n=t(n,o.key,o.attributes);return n}nodeEntries(){const t=this._nodes.values();return{[Symbol.iterator](){return this},next(){const e=t.next();if(e.done)return e;const n=e.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){const t=new Array(this._nodes.size);let e=0;this._nodes.forEach((n,r)=>{t[e++]=function(t,e){const n={key:t};return ee(e.attributes)||(n.attributes=Zt({},e.attributes)),n}(r,n)});const n=new Array(this._edges.size);return e=0,this._edges.forEach((t,r)=>{n[e++]=function(t,e,n){const r={key:e,source:n.source.key,target:n.target.key};return ee(n.attributes)||(r.attributes=Zt({},n.attributes)),"mixed"===t&&n.undirected&&(r.undirected=!0),r}(this.type,r,t)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:t,edges:n}}import(t,e=!1){if(t instanceof He)return t.forEachNode((t,n)=>{e?this.mergeNode(t,n):this.addNode(t,n)}),t.forEachEdge((t,n,r,i,o,s,a)=>{e?a?this.mergeUndirectedEdgeWithKey(t,r,i,n):this.mergeDirectedEdgeWithKey(t,r,i,n):a?this.addUndirectedEdgeWithKey(t,r,i,n):this.addDirectedEdgeWithKey(t,r,i,n)}),this;if(!te(t))throw new ue("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!te(t.attributes))throw new ue("Graph.import: invalid attributes. Expecting a plain object.");e?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}let n,r,i,o,s;if(t.nodes){if(i=t.nodes,!Array.isArray(i))throw new ue("Graph.import: invalid nodes. Expecting an array.");for(n=0,r=i.length;n<r;n++){o=i[n],Fe(o);const{key:t,attributes:r}=o;e?this.mergeNode(t,r):this.addNode(t,r)}}if(t.edges){let o=!1;if("undirected"===this.type&&(o=!0),i=t.edges,!Array.isArray(i))throw new ue("Graph.import: invalid edges. Expecting an array.");for(n=0,r=i.length;n<r;n++){s=i[n],$e(s);const{source:t,target:r,attributes:a,undirected:u=o}=s;let c;"key"in s?(c=e?u?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:u?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,c.call(this,s.key,t,r,a)):(c=e?u?this.mergeUndirectedEdge:this.mergeDirectedEdge:u?this.addUndirectedEdge:this.addDirectedEdge,c.call(this,t,r,a))}}return this}nullCopy(t){const e=new He(Zt({},this._options,t));return e.replaceAttributes(Zt({},this.getAttributes())),e}emptyCopy(t){const e=this.nullCopy(t);return this._nodes.forEach((t,n)=>{const r=Zt({},t.attributes);t=new e.NodeDataClass(n,r),e._nodes.set(n,t)}),e}copy(t){if("string"==typeof(t=t||{}).type&&t.type!==this.type&&"mixed"!==t.type)throw new le(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${t.type}" because this would mean losing information about the current graph.`);if("boolean"==typeof t.multi&&t.multi!==this.multi&&!0!==t.multi)throw new le("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if("boolean"==typeof t.allowSelfLoops&&t.allowSelfLoops!==this.allowSelfLoops&&!0!==t.allowSelfLoops)throw new le("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const e=this.emptyCopy(t),n=this._edges.values();let r,i;for(;r=n.next(),!0!==r.done;)i=r.value,ze(e,"copy",!1,i.undirected,i.key,i.source.key,i.target.key,Zt({},i.attributes));return e}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const t={};this._nodes.forEach((e,n)=>{t[n]=e.attributes});const e={},n={};this._edges.forEach((t,r)=>{const i=t.undirected?"--":"->";let o,s="",a=t.source.key,u=t.target.key;t.undirected&&a>u&&(o=a,a=u,u=o);const c=`(${a})${i}(${u})`;r.startsWith("geid_")?this.multi&&(void 0===n[c]?n[c]=0:n[c]++,s+=`${n[c]}. `):s+=`[${r}]: `,s+=c,e[s]=t.attributes});const r={};for(const t in this)this.hasOwnProperty(t)&&!Ue.has(t)&&"function"!=typeof this[t]&&"symbol"!=typeof t&&(r[t]=this[t]);return r.attributes=this._attributes,r.nodes=t,r.edges=e,ne(r,"constructor",this.constructor),r}}"undefined"!=typeof Symbol&&(He.prototype[Symbol.for("nodejs.util.inspect.custom")]=He.prototype.inspect),[{name:t=>`${t}Edge`,generateKey:!0},{name:t=>`${t}DirectedEdge`,generateKey:!0,type:"directed"},{name:t=>`${t}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:t=>`${t}EdgeWithKey`},{name:t=>`${t}DirectedEdgeWithKey`,type:"directed"},{name:t=>`${t}UndirectedEdgeWithKey`,type:"undirected"}].forEach(t=>{["add","merge","update"].forEach(e=>{const n=t.name(e),r="add"===e?ze:We;t.generateKey?He.prototype[n]=function(i,o,s){return r(this,n,!0,"undirected"===(t.type||this.type),null,i,o,s,"update"===e)}:He.prototype[n]=function(i,o,s,a){return r(this,n,!1,"undirected"===(t.type||this.type),i,o,s,a,"update"===e)}})}),function(t){ge.forEach(function({name:e,attacher:n}){n(t,e("Node"),0),n(t,e("Source"),1),n(t,e("Target"),2),n(t,e("Opposite"),3)})}(He),function(t){_e.forEach(function({name:e,attacher:n}){n(t,e("Edge"),"mixed"),n(t,e("DirectedEdge"),"directed"),n(t,e("UndirectedEdge"),"undirected")})}(He),function(t){ye.forEach(e=>{Oe(t,e),function(t,e){const{name:n,type:r,direction:i}=e,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"===r||"mixed"===this.type||r===this.type){if(1===arguments.length)return Se(!1,this,r,n=t);if(2===arguments.length){t=""+t,n=e;const s=this._nodes.get(t);if(void 0===s)throw new ce(`Graph.${o}: could not find the "${t}" node in the graph.`);return Ae(!1,this.multi,"mixed"===r?this.type:r,i,s,n)}if(3===arguments.length){t=""+t,e=""+e;const s=this._nodes.get(t);if(!s)throw new ce(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ce(`Graph.${o}: could not find the "${e}" target node in the graph.`);return Ee(!1,r,this.multi,i,s,e,n)}throw new ue(`Graph.${o}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const s="map"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(){const t=Array.prototype.slice.call(arguments),e=t.pop();let n;if(0===t.length){let i=0;"directed"!==r&&(i+=this.undirectedSize),"undirected"!==r&&(i+=this.directedSize),n=new Array(i);let o=0;t.push((t,r,i,s,a,u,c)=>{n[o++]=e(t,r,i,s,a,u,c)})}else n=[],t.push((t,r,i,o,s,a,u)=>{n.push(e(t,r,i,o,s,a,u))});return this[o].apply(this,t),n};const a="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(){const t=Array.prototype.slice.call(arguments),e=t.pop(),n=[];return t.push((t,r,i,o,s,a,u)=>{e(t,r,i,o,s,a,u)&&n.push(t)}),this[o].apply(this,t),n};const u="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[u]=function(){let t,e,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new ue(`Graph.${u}: invalid number of arguments (expecting 2, 3 or 4 and got ${n.length}).`);if("function"==typeof n[n.length-1]&&"function"!=typeof n[n.length-2])throw new ue(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);2===n.length?(t=n[0],e=n[1],n=[]):3===n.length?(t=n[1],e=n[2],n=[n[0]]):4===n.length&&(t=n[2],e=n[3],n=[n[0],n[1]]);let r=e;return n.push((e,n,i,o,s,a,u)=>{r=t(r,e,n,i,o,s,a,u)}),this[o].apply(this,n),r}}(t,e),function(t,e){const{name:n,type:r,direction:i}=e,o="find"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return!1;if(1===arguments.length)return Se(!0,this,r,n=t);if(2===arguments.length){t=""+t,n=e;const s=this._nodes.get(t);if(void 0===s)throw new ce(`Graph.${o}: could not find the "${t}" node in the graph.`);return Ae(!0,this.multi,"mixed"===r?this.type:r,i,s,n)}if(3===arguments.length){t=""+t,e=""+e;const s=this._nodes.get(t);if(!s)throw new ce(`Graph.${o}: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(e))throw new ce(`Graph.${o}: could not find the "${e}" target node in the graph.`);return Ee(!0,r,this.multi,i,s,e,n)}throw new ue(`Graph.${o}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const s="some"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[s]=function(){const t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((t,n,r,i,o,s,a)=>e(t,n,r,i,o,s,a)),!!this[o].apply(this,t)};const a="every"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[a]=function(){const t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((t,n,r,i,o,s,a)=>!e(t,n,r,i,o,s,a)),!this[o].apply(this,t)}}(t,e),Ce(t,e)})}(He),function(t){Me.forEach(e=>{Pe(t,e),function(t,e){const{name:n,type:r,direction:i}=e,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return;t=""+t;const n=this._nodes.get(t);if(void 0===n)throw new ce(`Graph.${o}: could not find the "${t}" node in the graph.`);je(!1,"mixed"===r?this.type:r,i,n,e)};const s="map"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(t,e){const n=[];return this[o](t,(t,r)=>{n.push(e(t,r))}),n};const a="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(t,e){const n=[];return this[o](t,(t,r)=>{e(t,r)&&n.push(t)}),n};const u="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[u]=function(t,e,n){if(arguments.length<3)throw new ue(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let r=n;return this[o](t,(t,n)=>{r=e(r,t,n)}),r}}(t,e),function(t,e){const{name:n,type:r,direction:i}=e,o=n[0].toUpperCase()+n.slice(1,-1),s="find"+o;t.prototype[s]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return;t=""+t;const n=this._nodes.get(t);if(void 0===n)throw new ce(`Graph.${s}: could not find the "${t}" node in the graph.`);return je(!0,"mixed"===r?this.type:r,i,n,e)};const a="some"+o;t.prototype[a]=function(t,e){return!!this[s](t,e)};const u="every"+o;t.prototype[u]=function(t,e){return!this[s](t,(t,n)=>!e(t,n))}}(t,e),De(t,e)})}(He);class Xe extends He{constructor(t){const e=Zt({type:"directed"},t);if("multi"in e&&!1!==e.multi)throw new ue("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==e.type)throw new ue('DirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class Ke extends He{constructor(t){const e=Zt({type:"undirected"},t);if("multi"in e&&!1!==e.multi)throw new ue("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==e.type)throw new ue('UndirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class Qe extends He{constructor(t){const e=Zt({multi:!0},t);if("multi"in e&&!0!==e.multi)throw new ue("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(e)}}class Ze extends He{constructor(t){const e=Zt({type:"directed",multi:!0},t);if("multi"in e&&!0!==e.multi)throw new ue("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==e.type)throw new ue('MultiDirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}class Ye extends He{constructor(t){const e=Zt({type:"undirected",multi:!0},t);if("multi"in e&&!0!==e.multi)throw new ue("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==e.type)throw new ue('MultiUndirectedGraph.from: inconsistent "'+e.type+'" type in given options!');super(e)}}function tn(t){t.from=function(e,n){const r=Zt({},e.options,n),i=new t(r);return i.import(e),i}}tn(He),tn(Xe),tn(Ke),tn(Qe),tn(Ze),tn(Ye),He.Graph=He,He.DirectedGraph=Xe,He.UndirectedGraph=Ke,He.MultiGraph=Qe,He.MultiDirectedGraph=Ze,He.MultiUndirectedGraph=Ye,He.InvalidArgumentsGraphError=ue,He.NotFoundGraphError=ce,He.UsageGraphError=le;class en{constructor(t){this.graph=t,this.stack=new Array(t.order),this.seen=new Set,this.size=0}hasAlreadySeenEverything(){return this.seen.size===this.graph.order}countUnseenNodes(){return this.graph.order-this.seen.size}forEachNodeYetUnseen(t){const e=this.seen,n=this.graph;n.someNode(function(r,i){if(e.size===n.order)return!0;if(e.has(r))return!1;return!!t(r,i)})}has(t){return this.seen.has(t)}push(t){const e=this.seen.size;return this.seen.add(t),e!==this.seen.size&&(this.stack[this.size++]=t,!0)}pop(){if(0!==this.size)return this.stack[--this.size]}}const nn=t=>"object"==typeof t&&!Array.isArray(t)&&null!==t&&"_bname"in t,rn=t=>"object"==typeof t&&!Array.isArray(t)&&null!==t&&"_crate"in t,on=t=>nn(t)&&("empty_bottle"===t._bname&&"empty_data"===t._content||void 0===t._content),sn=t=>/^\d+$/.test(t);var an=n(8287),un=y(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function cn(t,e){var n="object"==typeof e;return new Promise(function(r,i){var o=new L({next:function(t){r(t),o.unsubscribe()},error:i,complete:function(){n?r(e.defaultValue):i(new un)}});t.subscribe(o)})}function ln(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return yt(t,dt(t))}function hn(t,e){return m(e)?at(t,e,1):at(t,1)}var dn=function(t){function e(e,n){return t.call(this)||this}return o(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(w),pn={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=pn.delegate;return(null==i?void 0:i.setInterval)?i.setInterval.apply(i,h([t,e],l(n))):setInterval.apply(void 0,h([t,e],l(n)))},clearInterval:function(t){var e=pn.delegate;return((null==e?void 0:e.clearInterval)||clearInterval)(t)},delegate:void 0},fn=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return o(e,t),e.prototype.schedule=function(t,e){var n;if(void 0===e&&(e=0),this.closed)return this;this.state=t;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,e)),this.pending=!0,this.delay=e,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),pn.setInterval(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return e;null!=e&&pn.clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n,r=!1;try{this.work(t)}catch(t){r=!0,n=t||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},e.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,b(r,this),null!=e&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(dn),mn={now:function(){return(mn.delegate||Date).now()},delegate:void 0},gn=function(){function t(e,n){void 0===n&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.schedulerActionCtor(this,t).schedule(n,e)},t.now=mn.now,t}(),_n=new(function(t){function e(e,n){void 0===n&&(n=gn.now);var r=t.call(this,e,n)||this;return r.actions=[],r._active=!1,r}return o(e,t),e.prototype.flush=function(t){var e=this.actions;if(this._active)e.push(t);else{var n;this._active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this._active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(gn))(fn),yn=_n;function vn(t){for(var e,n,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var o=null!==(e=dt(r))&&void 0!==e?e:_n,s=null!==(n=r[0])&&void 0!==n?n:null,a=r[1]||1/0;return g(function(e,n){var r=[],i=!1,u=function(t){var e=t.buffer;t.subs.unsubscribe(),b(r,t),n.next(e),i&&l()},l=function(){if(r){var e=new w;n.add(e);var i={buffer:[],subs:e};r.push(i),st(e,o,function(){return u(i)},t)}};null!==s&&s>=0?st(n,o,l,s,!0):i=!0,l();var h=q(n,function(t){var e,n,i=r.slice();try{for(var o=c(i),s=o.next();!s.done;s=o.next()){var l=s.value,h=l.buffer;h.push(t),a<=h.length&&u(l)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}},function(){for(;null==r?void 0:r.length;)n.next(r.shift().buffer);null==h||h.unsubscribe(),n.complete(),n.unsubscribe()},void 0,function(){return r=null});e.subscribe(h)})}var bn=n(2543);const wn=(t,e,n={})=>({_bname:t,_content:e,_label:n}),xn=(t,e,n={})=>nn(e)&&(void 0===t||(t.includes(e._bname)||"*"===t))?e._content:void 0,Tn=wn("empty_bottle","empty_data"),kn={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={codebase:"leafinflowport.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>{wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafinflowport.js",codebase:"/src/ghostos/api/parser/nodelogic/io/leafinflowport.js"},{});return p_(e,t,void 0,{...o,metastep:"leaf inflow"},{leaflogic:(t,e)=>{const n=new Pt,r=e._stream.pipe(Nt(...t.map(t=>t._stream)),V(t=>(n.next(t[1]),t[0])),Lt());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(e,n)=>({...Lg(t,e),_control:n})},Sn={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={codebase:"leafoutflowport.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>{wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafoutflowport.js",codebase:"/src/ghostos/api/parser/nodelogic/io/leafoutflowport.js"},{});return p_(e,t,void 0,{...o,metastep:"leaf outflow"},{leaflogic:(t,e)=>{const n=new Pt,r=e._stream.pipe(V(t=>t),Nt(...t.map(t=>t._stream)),V(t=>(n.next(t[1]),t[0])),Lt());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...Lg(t),_control:e})};const An={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=(t=>{if(!t)return"appview";const e=Object.keys(t).filter(t=>"osview"===t||"osview2"===t);return e.length>0?e[0]:"appview"})(await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree})),s={codebase:"leafscreenio.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(e,n)=>p_(n,e,void 0,{...s,metastep:"invoking screenio"},{leaflogic:(t,e)=>{const n=new Pt,r=e._stream.pipe(Nt(...t.map(t=>t._stream)),It(t=>{const e=t.slice(1).filter(t=>void 0!==t);return 1===e.length?n.next(e[0]):e.length>1&&n.next(e),ln(t[0])}),Lt());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{post:e=>{const n=(Array.isArray(e)?e:[e]).map(t=>xn("screenio",t)).filter(t=>t);void 0!==n&&t.gos.leafio.getMasterSubsDir()[o].main.doWrite({control:{},data:n});return wn("screenio","written")}}})},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...Bg(t),_control:e})},En=(t,e)=>{if(t.length>0&&t[0]in e)return 1===t.length?e[t[0]]:En(t.slice(1),e[t[0]])},On=(t,e,n)=>{t.length>0&&t[0]in e&&(1===t.length?e[t[0]]=n:On(t.slice(1),e[t[0]],n))};var Cn=n(8463);function Mn(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:case 3:return e^n^r;case 2:return e&n^e&r^n&r}}function Nn(t,e){return t<<e|t>>>32-e}const In=function(t){const e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(t.length+1);r.set(t),r[t.length]=128;const i=(t=r).length/4+2,o=Math.ceil(i/16),s=new Array(o);for(let e=0;e<o;++e){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=t[64*e+4*r]<<24|t[64*e+4*r+1]<<16|t[64*e+4*r+2]<<8|t[64*e+4*r+3];s[e]=n}s[o-1][14]=8*(t.length-1)/Math.pow(2,32),s[o-1][14]=Math.floor(s[o-1][14]),s[o-1][15]=8*(t.length-1)&4294967295;for(let t=0;t<o;++t){const r=new Uint32Array(80);for(let e=0;e<16;++e)r[e]=s[t][e];for(let t=16;t<80;++t)r[t]=Nn(r[t-3]^r[t-8]^r[t-14]^r[t-16],1);let i=n[0],o=n[1],a=n[2],u=n[3],c=n[4];for(let t=0;t<80;++t){const n=Math.floor(t/20),s=Nn(i,5)+Mn(n,o,a,u)+c+e[n]+r[t]>>>0;c=u,u=a,a=Nn(o,30)>>>0,o=i,i=s}n[0]=n[0]+i>>>0,n[1]=n[1]+o>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+u>>>0,n[4]=n[4]+c>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])},jn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;const Rn=function(t){return"string"==typeof t&&jn.test(t)};const Pn=function(t){if(!Rn(t))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(t.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,255&e,(e=parseInt(t.slice(9,13),16))>>>8,255&e,(e=parseInt(t.slice(14,18),16))>>>8,255&e,(e=parseInt(t.slice(19,23),16))>>>8,255&e,(e=parseInt(t.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,255&e)};const Dn=[];for(let t=0;t<256;++t)Dn.push((t+256).toString(16).slice(1));function Ln(t,e=0){return(Dn[t[e+0]]+Dn[t[e+1]]+Dn[t[e+2]]+Dn[t[e+3]]+"-"+Dn[t[e+4]]+Dn[t[e+5]]+"-"+Dn[t[e+6]]+Dn[t[e+7]]+"-"+Dn[t[e+8]]+Dn[t[e+9]]+"-"+Dn[t[e+10]]+Dn[t[e+11]]+Dn[t[e+12]]+Dn[t[e+13]]+Dn[t[e+14]]+Dn[t[e+15]]).toLowerCase()}function Fn(t,e,n,r,i,o){const s="string"==typeof n?function(t){t=unescape(encodeURIComponent(t));const e=new Uint8Array(t.length);for(let n=0;n<t.length;++n)e[n]=t.charCodeAt(n);return e}(n):n,a="string"==typeof r?Pn(r):r;if("string"==typeof r&&(r=Pn(r)),16!==r?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+s.length);if(u.set(a),u.set(s,a.length),u=e(u),u[6]=15&u[6]|t,u[8]=63&u[8]|128,i){o=o||0;for(let t=0;t<16;++t)i[o+t]=u[t];return i}return Ln(u)}function $n(t,e,n,r){return Fn(80,In,t,e,n,r)}$n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",$n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";const Bn=$n;function qn(t){function e(t,e){return t<<e|t>>>32-e}function n(t){var e,n="";for(e=7;e>=0;e--)n+=(t>>>4*e&15).toString(16);return n}var r,i,o,s,a,u,c,l,h,d=new Array(80),p=1732584193,f=4023233417,m=2562383102,g=271733878,_=3285377520,y=(t=function(t){t=t.replace(/\r\n/g,"\n");for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?e+=String.fromCharCode(r):r>127&&r<2048?(e+=String.fromCharCode(r>>6|192),e+=String.fromCharCode(63&r|128)):(e+=String.fromCharCode(r>>12|224),e+=String.fromCharCode(r>>6&63|128),e+=String.fromCharCode(63&r|128))}return e}(t)).length,v=new Array;for(i=0;i<y-3;i+=4)o=t.charCodeAt(i)<<24|t.charCodeAt(i+1)<<16|t.charCodeAt(i+2)<<8|t.charCodeAt(i+3),v.push(o);switch(y%4){case 0:i=2147483648;break;case 1:i=t.charCodeAt(y-1)<<24|8388608;break;case 2:i=t.charCodeAt(y-2)<<24|t.charCodeAt(y-1)<<16|32768;break;case 3:i=t.charCodeAt(y-3)<<24|t.charCodeAt(y-2)<<16|t.charCodeAt(y-1)<<8|128}for(v.push(i);v.length%16!=14;)v.push(0);for(v.push(y>>>29),v.push(y<<3&4294967295),r=0;r<v.length;r+=16){for(i=0;i<16;i++)d[i]=v[r+i];for(i=16;i<=79;i++)d[i]=e(d[i-3]^d[i-8]^d[i-14]^d[i-16],1);for(s=p,a=f,u=m,c=g,l=_,i=0;i<=19;i++)h=e(s,5)+(a&u|~a&c)+l+d[i]+1518500249&4294967295,l=c,c=u,u=e(a,30),a=s,s=h;for(i=20;i<=39;i++)h=e(s,5)+(a^u^c)+l+d[i]+1859775393&4294967295,l=c,c=u,u=e(a,30),a=s,s=h;for(i=40;i<=59;i++)h=e(s,5)+(a&u|a&c|u&c)+l+d[i]+2400959708&4294967295,l=c,c=u,u=e(a,30),a=s,s=h;for(i=60;i<=79;i++)h=e(s,5)+(a^u^c)+l+d[i]+3395469782&4294967295,l=c,c=u,u=e(a,30),a=s,s=h;p=p+s&4294967295,f=f+a&4294967295,m=m+u&4294967295,g=g+c&4294967295,_=_+l&4294967295}return(h=n(p)+n(f)+n(m)+n(g)+n(_)).toLowerCase()}const Un="github",Vn=async(t,e)=>{const n=(t=>{const[e,n]=t.split("?"),r=e.split("/");if(r[0]===Un&&r.shift(),r.length<3)return null;const i=r.shift(),o=r.shift();if(!i||!o)return null;const s=o.split("@"),a=s[0],u=s[1]||"main";let c=r.join("/");return a&&c?(c.endsWith(".json")||(c=`${c}.json`),{user:i,repo:a,ref:u,path:c,query:n}):null})(e);if(!n)throw new Error(`Invalid GitHub graph reference: ${e}`);if(!globalThis.fetch)throw new Error("GitHub graph fetch requires global fetch.");const{user:r,repo:i,ref:o,path:s,query:a}=n,u=`https://raw.githubusercontent.com/${r}/${i}/refs/heads/${o}/${s}${a?`?${a}`:""}`,c=await globalThis.fetch(u);if(!c.ok)throw new Error(`Failed to fetch GitHub graph ${t}/${e}: ${c.status}`);const l=(t=>t?t.graph?.nodes?t.graph.nodes:t.data?.graph?.nodes?t.data.graph.nodes:t.nodes?t.nodes:[]:[])(await c.json());return{graph:{nodes:l}}},Gn=t=>{const e=t=>t.hostEtaTree?(t.hostEtaTree,e(t.hostEtaTree)):t,n=e(t),{appmode:r,domain:i,appid:o}=n,s=Bn(`https://www.leafgon.com/${i}/${o}/_etaTreeForest`,Bn.URL),a=n.mnemosyne.current[s],u={initEtaTreeForest:()=>{s in n.mnemosyne.current||(n.mnemosyne.current[s]={})},getEtaTree:async(t,e)=>{const r=t+"/"+e;if(r in a)return n.mnemosyne.current[s][r].tree;return await u.parseGraphEtaTree(t,e)},setEtaTree:(t,e,r,i)=>{const o=t+"/"+e;n.mnemosyne.current[s][o]={tree:r,parent:i}},removeEtaBush:(t,e)=>{const r=t+"/"+e,i=Object.entries(a).filter(([t,e])=>t!==r&&e.parent!==r).reduce((t,e)=>(t[e[0]]=e[1],t),{});n.mnemosyne.current[s]=i},parseGraphEtaTree:async(t,e)=>{const s=i,a=o;if(globalThis?.DEBUG){const n=t+"/"+e;globalThis.trace[n]?globalThis.trace[n].push("parsing"):globalThis.trace[n]=["parsing"]}const c=((t,e)=>t===Un||"string"==typeof e&&e.startsWith(`${Un}/`)&&e.includes("/"))(t,e)?await Vn(t,e):await n.leaflakeio.qm_methods.queryGraph({_appmode:r,_hostdomain:i,_hostappid:o,_domain:t,_appid:e}),{nodes:l}=c.graph?c.graph:{nodes:[]},h=r_(l),d=i_(h),p=n,f=Rg(r,s,a,t,e,h,d,p.leafio,p.leaflakeio,p.mnemosyne,p),m=(d.components.nodegroups.runtime[0],d.components.nodegroups.lambda,p?s+"/"+a:void 0);if(u.setEtaTree(t,e,f,m),globalThis?.DEBUG){const n=t+"/"+e;globalThis.trace[n]?globalThis.trace[n].push("parsed"):globalThis.trace[n]=["parsed"]}return f}};return u},zn=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafmemoryio.js",codebase:"/src/ghostos/api/parser/nodelogic/io/leafmemoryio.js"},{}),Wt("leafmemoryio")),Wn={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{type:s,args:a}=n.leaf.logic,u=En(zn.editorconfig.namedatakey,a),{domain:c,appid:l}=t.gos.etaTree,h=`www.leafgon.com/mnemosyne/${c}/${l}/${u}`,d=Bn(h,Bn.URL),p="global"in o,f="on-tap"in o,m="proxy"in o,g=t.gos.etaTree.leafgraph.thespade?.uuid,_=g&&p?await t.gos.etaTree.lookupRuntimeLambdaLUT("breezyforest","main",g,t.gos.etaTree.leafgraph.edges.lambda.sourcelut[g],[]):void 0;e.slice(0,4);!!p&&(y=u,v=_,Object.keys(v).includes(y));var y,v;const b={codebase:"leafmemoryio.js",refnode:e,leafnode:"jest"!==e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e)?.leafnode.data};return(n,r)=>{const i=(n,r=void 0)=>{const i=r||d;if(void 0===n||(t=>!!nn(t)&&("empty_bottle"===t._bname||"nothing"===t._bname))(n)){if(i in t.gos.etaTree.mnemosyne.current){const n=t.gos.etaTree.mnemosyne.current[i];return f?n.raw:wn(u,n.raw,{_type:"memoryio",_command:"o",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}{const n=f?wn("nothing",null,{_type:"memoryio",_command:"forget",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}}):null;return f?n:wn(u,n,{_type:"memoryio",_command:"forget",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}}if("main"===u&&e.slice(0,4),nn(o=n)&&void 0!==o._bname&&"memoryio"===o._label._type&&"forget"===o._label._command){const n=f?wn("nothing",null,{_type:"memoryio",_command:"io",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}}):null,r=Cn(n),o={signature:qn(r),payload:r,raw:n};return t.gos.etaTree.mnemosyne.current={...t.gos.etaTree.mnemosyne.current,[i]:o},f?n:wn(u,n,{_type:"memoryio",_command:"io",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}{const r=n,o=Cn(r),s={signature:qn(o),payload:o,raw:r};return t.gos.etaTree.mnemosyne.current={...t.gos.etaTree.mnemosyne.current,[i]:s},f?r:wn(u,r,{_type:"memoryio",_command:"io",_memoryname:u,_refnode:e,_nodelocation:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid}})}var o};return p_(r,n,void 0,{...b,metastep:"memory io "+u},{leaflogic:(t,e)=>{const n=new Pt,r=e._stream.pipe(Nt(...t.map(t=>t._stream)),V(t=>{if(m){const e=t[0].sid.slice(-1).pop(),r=Bn(`www.leafgon.com/mnemosyne/${c}/${l}/${u}/${e}`,Bn.URL),o=i(t[1],r);n.next(o)}else{const e=i(t[1]);n.next(e)}return t[0]}),Lt());return{_stream:n,_control:{...e,_stream:r}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={},s=t.gos.etaTree.leafgraph.thespade?.uuid;if(!!s&&t.gos.etaTree.leafgraph.edges.lambda.sourcelut[s].includes(e)){const{type:s,args:a}=n.leaf.logic,u=En(zn.editorconfig.namedatakey,a);if(r.length>0){const n=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});o[u]={...n}}else o[u]={};return o}return o},methods:t=>({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=t=>t.hostEtaTree?(t.hostEtaTree,o(t.hostEtaTree)):t,s=o(t.gos.etaTree);return{etatreeforest:Gn(s),general:{setMasterMemory:(e,n)=>{const{domain:r,appid:i}=t.gos.etaTree,o=Bn(`www.leafgon.com/mnemosyne/${r}/${i}/${e}`,Bn.URL);return s.mnemosyne.current[o]=n,n},getMasterMemory:e=>{const{domain:n,appid:r}=t.gos.etaTree,i=Bn(`www.leafgon.com/mnemosyne/${n}/${r}/${e}`,Bn.URL);return s.mnemosyne.current[i]}}}}},Jn={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let Hn;const Xn=new Uint8Array(16);const Kn=function(t,e,n){if(Jn.randomUUID&&!e&&!t)return Jn.randomUUID();const r=(t=t||{}).random??t.rng?.()??function(){if(!Hn){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Hn=crypto.getRandomValues.bind(crypto)}return Hn(Xn)}();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){if((n=n||0)<0||n+16>e.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let t=0;t<16;++t)e[n+t]=r[t];return e}return Ln(r)};function Qn(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}u((r=r.apply(t,e||[])).next())})}const Zn=t=>void 0!==t&&t>="0"&&t<="9",Yn=t=>t>="a"&&t<="z"||t>="A"&&t<="Z"||"_"==t||"."==t||"-"==t,tr=t=>t>="a"&&t<="z"||t>="A"&&t<="Z"||"_"==t||"."==t||"-"==t||":"==t,er=t=>"=+-*/\\&%$_!<>?".includes(t);class nr{constructor(t,e,n,r){this.source=t,this.startIndex=e,this.endIndex=n,this.line=r,this.offset=void 0}get start(){return this.startIndex-(this.line<=1?0:this.getLineOffset())}get end(){return this.endIndex-(this.line<=1?0:this.getLineOffset())}get length(){return this.endIndex-this.startIndex}getLineOffset(){var t;if(void 0===this.offset){const e=new RegExp("(\n)","mg");let n=null;for(let t=1;t<this.line;t++)n=e.exec(this.source);this.offset=null!==(t=null==n?void 0:n.index)&&void 0!==t?t:0}return this.offset}}var rr,ir;nr.unknown=new nr("",-1,-1,-1),function(t){t[t.Init=0]="Init",t[t.LeftParen=1]="LeftParen",t[t.RightParen=2]="RightParen",t[t.LeftBrace=3]="LeftBrace",t[t.RightBrace=4]="RightBrace",t[t.LeftSquare=5]="LeftSquare",t[t.RightSquare=6]="RightSquare",t[t.Dispatch=7]="Dispatch",t[t.True=8]="True",t[t.False=9]="False",t[t.Identifier=10]="Identifier",t[t.Keyword=11]="Keyword",t[t.String=12]="String",t[t.Integer=13]="Integer",t[t.Float=14]="Float",t[t.FractionNumber=15]="FractionNumber",t[t.Error=16]="Error",t[t.EOF=17]="EOF",t[t.Nothing=18]="Nothing"}(rr||(rr={}));class or{constructor(t,e,n){this.type=t,this.value=e,this.position=n}}or.INIT=new or(rr.Init,"",new nr("",0,0,0));class sr{constructor(t){this.source=t,this.start=0,this.current=0,this.line=1}isEnd(){return this.source.length===this.current}advance(){return this.current+=1,this.source[this.current-1]}peek(){return this.source[this.current]}peekNext(){return this.source[this.current+1]}makeToken(t){const{start:e,line:n,current:r,source:i}=this,o=t===rr.Keyword,s=i.substring(o?e+1:e,r);return new or(t,s,new nr(i,e,r,n))}makeStringToken(){const{start:t,line:e,current:n,source:r}=this,i=r.substring(t+1,n-1).replace(/\\n/g,"\n").replace(/\\\\/g,"\\").replace(/\\"/g,'"');return new or(rr.String,i,new nr(r,t,n,e))}errorToken(t){const{start:e,line:n,current:r,source:i}=this;return new or(rr.Error,t,new nr(i,e,r,n))}identifier(){for(;;){const t=this.peek();if(!t||!(Yn(t)||Zn(t)||er(t)))break;this.advance()}return this.makeIdentifierToken()}makeIdentifierToken(){const{start:t,current:e,source:n}=this;switch(n.substring(t,e)){case"true":return this.makeToken(rr.True);case"false":return this.makeToken(rr.False);case"null":return this.makeToken(rr.Nothing);default:return this.makeToken(rr.Identifier)}}keyword(){if(!tr(this.peek())&&!Zn(this.peek()))return this.makeToken(rr.Identifier);for(;tr(this.peek())||Zn(this.peek());)this.advance();return this.makeToken(rr.Keyword)}number(){for(;Zn(this.peek());)this.advance();if("."===this.peek()&&Zn(this.peekNext())){for(this.advance();Zn(this.peek());)this.advance();return this.makeToken(rr.Float)}if("/"===this.peek()){if(!Zn(this.peekNext()))return this.errorToken("Unterminated fraction number");for(this.advance();Zn(this.peek());)this.advance();return this.makeToken(rr.FractionNumber)}return this.makeToken(rr.Integer)}string(){for(;'"'!==this.peek()&&!this.isEnd();)"\n"===this.peek()&&(this.line+=1),"\\"===this.peek()&&this.advance(),this.advance();return this.isEnd()?this.errorToken("Unterminated string"):(this.advance(),this.makeStringToken())}skipWhitespace(){let t=0;for(;;){switch(this.peek()){case" ":case"\r":case"\t":case",":this.advance();break;case"\n":this.line+=1,this.advance();break;case";":if("#"===this.peekNext()){for(this.advance(),this.advance();"#"!==this.peek()&&";"!==this.peekNext()&&!this.isEnd();)"\n"===this.peek()&&(this.line+=1),this.advance();this.advance(),this.advance()}else for(;"\n"!==this.peek()&&!this.isEnd();)this.advance();break;default:return}t+=1}return t}scanToken(){this.skipWhitespace();if(this.start=this.current,this.isEnd())return this.makeToken(rr.EOF);const t=this.advance();if(Zn(t)||"-"===t&&Zn(this.peek()))return this.number();if((Yn(t)||er(t))&&!Zn(t))return this.identifier();switch(t){case"(":return this.makeToken(rr.LeftParen);case")":return this.makeToken(rr.RightParen);case"{":return this.makeToken(rr.LeftBrace);case"}":return this.makeToken(rr.RightBrace);case"[":return this.makeToken(rr.LeftSquare);case"]":return this.makeToken(rr.RightSquare);case"#":return this.makeToken(rr.Dispatch);case":":return this.keyword();case'"':return this.string()}return this.errorToken(`Unexpected character '${t}'.`)}scanAllToken(){const t=[];for(;!this.isEnd();)t.push(this.scanToken());return t}}!function(t){t.Boolean="bool",t.Integer="int",t.Float="float",t.FractionNumber="fractionNumber",t.String="string",t.Keyword="keyword",t.Identifier="identifier",t.List="list",t.Nothing="null"}(ir||(ir={}));class ar{constructor(t,e,n){this.kind=t,this.value=e,this.position=n}}class ur extends Error{constructor(t,e){"string"==typeof t?super(t):(super(t.message),this.stack=t.stack),this._position=e}get position(){return this._position}}ur.kind="RuntimeError";const cr=t=>t,lr=(t,e)=>{if(t)throw new ur(e);return!0},hr=(t,e,n)=>lr(t.length!==e,n||`Expected ${e} argument${e>1?"s":""}, but got ${t.length}.`),dr=(t,...e)=>lr(void 0===e.find(e=>e===t.kind),`Invalid function parameter, actual: '${t.kind}', expected: '${e.join(" or ")}'.`);const pr=t=>()=>{throw new ur(`${t} is not implemented.`)},fr=t=>({parser:()=>{throw new ur(`${t} is not implemented.`)},factory:pr(t)}),mr={Bool:{parser:t=>"true"===t,factory:Boolean},Nothing:{parser:t=>"null"==t,factory:pr("NULL")},Int:{parser:t=>parseInt(t,10),factory:Number},Float:{parser:parseFloat,factory:Number},String:{parser:t=>t,factory:String},FractionNumber:{parser:t=>t,factory:pr("FractionNumber")},Vector:fr("Vector"),HashMap:fr("HashMap")},gr="Vector",_r="HashMap";class yr{constructor(t,e=mr){this.scanner=t,this.literals=e,this.hadError=!1,this.panicMode=!1,this.current=or.INIT,this._program=[],this._errors=[],this.dispatchMode=!1,this.missingParser=t=>{this.errorAtCurrent(`Missing parser '${t}'.`)}}parse(){try{for(this.checkLiteralParsers(),this.advance();!this.isEnd();){const t=this.expression();t&&this._program.push(t)}this.consume(rr.EOF,"Expect end of program.")}finally{return{hasError:this.hadError,program:this.program,errors:this.errors}}}get program(){return this._program}get errors(){return this._errors}advance(){for(;this.current=this.scanner.scanToken(),this.current.type===rr.Error;)this.errorAtCurrent(this.current.value)}consume(t,e){this.current.type!=t?this.errorAtCurrent(e):this.advance()}errorAtCurrent(t){this.errorAt(this.current,t)}errorAt(t,e){if(!this.panicMode)throw this._errors.push({position:t.position,message:e}),this.hadError=!0,new Error(e)}isEnd(){return this.peek().type===rr.EOF}peek(){return this.current}expression(){const t=this.current,{Bool:e,FractionNumber:n,Int:r,Float:i,String:o,Nothing:s}=this.literals;switch(t.type){case rr.True:case rr.False:return this.makeLiteral(ir.Boolean,e.parser,t);case rr.Nothing:return this.makeLiteral(ir.Nothing,s.parser,t);case rr.Integer:return this.makeLiteral(ir.Integer,r.parser,t);case rr.Float:return this.makeLiteral(ir.Float,i.parser,t);case rr.FractionNumber:return this.makeLiteral(ir.FractionNumber,n.parser,t);case rr.String:return this.makeLiteral(ir.String,o.parser,t);case rr.Identifier:return this.makeLiteral(ir.Identifier,cr,t);case rr.Keyword:return this.makeLiteral(ir.Keyword,o.parser,t);case rr.LeftParen:return new ar(ir.List,this.advanceUntil(rr.RightParen),t.position);case rr.LeftSquare:return new ar(ir.List,[new ar(ir.Identifier,gr,t.position),...this.advanceUntil(rr.RightSquare)],t.position);case rr.LeftBrace:return new ar(ir.List,[new ar(ir.Identifier,_r,t.position),...this.advanceUntil(rr.RightBrace)],t.position);case rr.Dispatch:return this.formatDispatch();default:return void this.errorAtCurrent(`Unknown token: '${t.value}'.`)}}makeLiteral(t,e,n){const r=new ar(t,e(this.current.value),n.position);return this.advance(),r}advanceUntil(t){const e=[];for(this.advance();this.current.type!==t&&!this.isEnd();){const t=this.expression();e.push(t)}return this.consume(t,`Expected '${this.closeParentheses(t)}'.`),e}formatDispatch(){this.advance(),this.dispatchMode&&this.errorAtCurrent("Nested dispatch expression not allowed."),this.dispatchMode=!0;const t=this.expression();t&&t.kind===ir.List||this.errorAtCurrent(`List expression expected after dispatch, but get '${t&&t.kind}'.`);const e=t;let n=e;switch(e.value[0].value){case _r:this.errorAtCurrent("Invalid dispatch: #{...}.");break;case gr:this.errorAtCurrent("Invalid dispatch: #[...].");break;default:n=this.anonymousFunction(e)}return this.dispatchMode=!1,n}anonymousFunction(t){const e=function(t,e){let n=[];const r=t=>{switch(t.kind){case ir.Boolean:case ir.Nothing:case ir.Integer:case ir.Float:case ir.FractionNumber:case ir.String:case ir.Keyword:case ir.Identifier:return n=e(n,t);case ir.List:return t.value.map(r),n=e(n,t)}};return r(t),n}(t,(t,e)=>{if(e.kind===ir.Identifier){const n=e;/^%\d+$/.test(n.value)&&t.push(parseInt(n.value.substr(1)))}return t}).sort((t,e)=>t-e).reverse()[0],n=Array.from({length:e},(e,n)=>new ar(ir.Identifier,`%${n+1}`,t.position)),r=new ar(ir.List,[new ar(ir.Identifier,gr,t.position),...n],t.position);return new ar(ir.List,[new ar(ir.Identifier,"fn",t.position),r,t],t.position)}closeParentheses(t){switch(t){case rr.RightParen:return")";case rr.RightBrace:return"}";case rr.RightSquare:return"]"}}checkLiteralParsers(){const{Bool:t,FractionNumber:e,Int:n,Float:r,String:i,Nothing:o}=this.literals;t.parser||this.missingParser("Bool"),n.parser||this.missingParser("Int"),r.parser||this.missingParser("Float"),e.parser||this.missingParser("FractionNumber"),i.parser||this.missingParser("String"),o.parser||this.missingParser("Nothing")}}const vr="<native function>";class br{constructor(t,e,n=!0,r=vr){this._fn=t,this._arity=e,this._resolveIds=n,this._toString=r}call(t,e,n){const r=this.arity-n.length,i=this._resolveIds?n.map(n=>n.kind===ir.Identifier?t.execLiteral(n,e):n):n;if(-1===this.arity||0===r)return this._fn(t,e,i);if(r>0){const t=(t,e,n)=>this._fn(t,e,[...i,...n]);return new br(t,r,this._resolveIds,this.toString())}{const r=this._fn(t,e,i.slice(0,this.arity));return r instanceof br?r.call(t,e,i.slice(this.arity)):lr(!0,`Expected ${this.arity} argument${this.arity>1?"s":""}, but got ${n.length}.`)}}get arity(){return this._arity}toString(){return this._toString===vr?vr:`<${this._toString} function>`}toJS(){return this.toString()}debugTypeOf(){return br.kind}}br.kind="Function";const wr=t=>{var e;return new br(t.fn,t.arity,null===(e=t.resolveArgsIdentifiers)||void 0===e||e,t.name||t.fn.name)},xr=(t,e)=>wr({name:t.name,arity:null!=e?e:t.length,fn:(e,n,r)=>{const i=r.map(t=>e.execLiteral(t,n),e);return t.apply(e,i)},resolveArgsIdentifiers:!0}),Tr=wr({name:"const",arity:1,fn:(t,e,n)=>{lr(1!==n.length,`Const expected 1 argument, but got ${n.length}.`);const[r]=n;return wr({name:"const",arity:-1,fn:(t,e)=>t.execLiteral(r,e)})}}),kr=wr({name:"def",arity:2,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{hr(n,2);const[r,i]=n;dr(r,ir.Identifier);const o=t.execLiteral(i,e);return e.define(r.value,o),o}}),Sr=wr({name:"defn",arity:-1,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{hr(n,3);const[r,i,o]=n;return e.get("def").call(t,e,[r,new ar(ir.List,[new ar(ir.Identifier,"fn",nr.unknown),i,o],nr.unknown)])}}),Ar=wr({name:"if",arity:3,fn:(t,e,n)=>{hr(n,3);const[r,i,o]=n,s=t.execLiteral(r,e),a=t.options.utils.unboxing(s);if(!0===a)return t.execLiteral(i,e);if(!1===a)return t.execLiteral(o,e);throw new ur(`Expected boolean value in the if condition, but get '${a}'`)}}),Er=wr({arity:-1,name:"case",fn:(t,e,n)=>{lr(n.length<2,`Case expected at least 2 argument, but got ${n.length}.`);const[r,...i]=n,o=t.execLiteral(r,e);for(const n of i){dr(n,ir.List);const r=n.value;hr(r,2,`Case branch expected list with 2 items, but got ${r.length}`);const[i,s]=r,a=t.execLiteral(i,e),u=t.options.utils.unboxing(a);lr(!("else"===u||a instanceof br),"Case branch must start with a function or :else.");let c=!1;if("else"===u)c=!0;else{const e=t.evalFn(a,[o]),n=t.options.utils.unboxing(e);lr(!("boolean"==typeof n),"Case branch function must return with Bool."),c=n}if(c)return t.execLiteral(s,e)}lr(!0,`At least one of the case branch must match with the condition: ${o}`)}});class Or{constructor(t=null){this.enclosing=t,this.values=Object.create(null),this.locked=Object.create(null)}define(t,e,n=!1){if(this.locked[t])throw new ur(`'${t}' is locked and it is not re-definable.`);this.values[t]=e,n&&(this.locked[t]=!0)}get(t){if(this.values[t])return this.values[t];if(null!==this.enclosing)return this.enclosing.get(t);throw new ur(`Undefined identifier: '${t}'.`)}assign(t,e){if(!this.values[t]){if(null!==this.enclosing)return this.enclosing.assign(t,e);throw new ur(`Undefined identifier: '${t}'.`)}this.values[t]=e}getNames(){return Object.keys(this.values)}get parent(){return this.enclosing}}const Cr=wr({name:"fn",arity:-1,resolveArgsIdentifiers:!1,fn:(t,e,n)=>{hr(n,2);const[r,i]=n;dr(r,ir.List);const o=r.value.slice(1);return o.map(t=>dr(t,ir.Identifier)),wr({name:"lambda",arity:o.length,fn:(t,n,r)=>{hr(r,o.length);const s=new Or(e);o.forEach((e,i)=>{const o=t.execLiteral(r[i],n);s.define(e.value,o)});const a=t.execLiteral(i,s);return t.clearEnv(),a}})}}),Mr=wr({name:"do",arity:-1,fn:(t,e,n)=>(lr(n.length<1,`Expected at least 1 argument, but got ${n.length}.`),n.map(n=>t.execLiteral(n,e)).pop())}),Nr=wr({name:"side-effect",arity:-1,fn:(t,e,n)=>{lr(n.length<1,`Eff expected at least 1 argument, but got ${n.length}.`);const[r,...i]=n,o=t.execLiteral(r,e);return lr(!(o instanceof br),"Eff first parameter must be a function."),wr({name:"side-effect",arity:-1,fn:t=>t.evalFn(o,i)})}}),Ir={stdout:void 0,lockedGlobals:!0,globals:{},utils:{unboxing:cr}},jr=[gr,_r];class Rr{constructor(t,e){this.globals=new Or,this.currentEnv=this.globals,this.lastLiteral=void 0,this.lastPrint=void 0,this.execLiteral=(t,e)=>{switch(this.currentEnv=e,this.lastLiteral=t,t.kind){case ir.Boolean:case ir.Integer:case ir.Float:case ir.FractionNumber:case ir.String:case ir.Keyword:case ir.Nothing:return t.value;case ir.Identifier:return e.get(t.value);case ir.List:return this.execList(t,e);default:return t}},this.options=Object.assign(Object.assign({},Ir),t);const{stdout:n,globals:r,lockedGlobals:i}=this.options,o=Object.assign(Object.assign({},mr),e);Object.keys(o).forEach(t=>{const e=o[t].factory,n=jr.includes(t)?-1:e.length;this.globals.define(t,xr(e,n))}),this.globals.define("print",xr(t=>{var e;return(n||console.log)(t,null===(e=this.lastPrint)||void 0===e?void 0:e.position)},-1)),this.globals.define("const",Tr),this.globals.define("def",kr),this.globals.define("defn",Sr),this.globals.define("if",Ar),this.globals.define("case",Er),this.globals.define("fn",Cr),this.globals.define("do",Mr),this.globals.define("side-effect",Nr),Object.keys(r).forEach(t=>{const e=r[t];let n=e;"function"==typeof e&&e.toString()!==vr&&(n=xr(e)),this.globals.define(t,n,i)})}interpret(t){let e;this.lastLiteral=t[0];try{for(const n of t)this.lastLiteral=n,e=this.execLiteral(n,this.globals)}catch(t){throw t.king===ur.kind?t:new ur(t,this.lastLiteral.position)}return e}evalFn(t,e){return t.call(this,this.currentEnv,e)}execList(t,e){const[n,...r]=t.value;"print"===n.value&&(this.lastPrint=n);const i=this.execLiteral(n,e);if("function"==typeof i.call)return i.call(this,e,r);throw new ur(`'${i}' is not a function`,t.position)}getGlobalNames(){return this.globals.getNames()}clearEnv(){null!==this.currentEnv.parent&&(this.currentEnv=this.currentEnv.parent)}}var Pr;!function(t){t.Parser="Parser",t.Runtime="Runtime"}(Pr||(Pr={}));class Dr{constructor(t,e){this.literals=e,this.interpreter=new Rr(t,e)}insituexecute(t){const e=new sr(t),n=new yr(e,this.literals).parse();if(n.hasError)throw{type:Pr.Parser,errors:n.errors};try{return this.interpreter.interpret(n.program)}catch(t){throw{type:Pr.Runtime,errors:[{message:t.message,position:t.position}]}}}execute(t){return Qn(this,void 0,void 0,function*(){const e=new sr(t),n=new yr(e,this.literals).parse();if(n.hasError)throw{type:Pr.Parser,errors:n.errors};try{this.interpreter.interpret(n.program)}catch(t){throw{type:Pr.Runtime,errors:[{message:t.message,position:t.position}]}}})}evalFn(t,e){return this.interpreter.evalFn(t,e)}}var Lr,Fr={const:t=>()=>t};class $r extends Error{constructor(t){"string"==typeof t?super(t):(super(t.message),this.stack=t.stack)}}!function(t){t[t.Less=0]="Less",t[t.Equal=1]="Equal",t[t.Greater=2]="Greater"}(Lr||(Lr={}));class Br{constructor(t){this._value=t}static fromJS(t){return new Br(t)}static fromStr(t){switch(t.value){case"true":return new Br(!0);case"false":return new Br(!1);default:throw new $r(`Invalid boolean: "${t.value}".`)}}get value(){return this._value}not(){return new Br(!this._value)}and(t){return new Br(this._value&&t._value)}or(t){return new Br(this._value||t._value)}equals(t){return new Br(this._value===t._value)}partialCmp(t){return this.value===t.value?Lr.Equal:this.value?Lr.Greater:Lr.Less}copy(){return new Br(this._value)}toString(){return this._value?"true":"false"}toJS(){return this._value}toJSON(){return this.toJS()}debugTypeOf(){return Vr(Br.kind)}}Br.kind="Bool";const qr=t=>new Br(t);class Ur{constructor(t){this._value=t}static fromJS(t){return new Ur(t)}static fromStr(t){return t.copy()}get value(){return this._value}add(t){return new Ur(this._value+t.value)}index(t){var e;return Number.isInteger(t.value)?new Ur(null!==(e=this._value.charAt(t.value))&&void 0!==e?e:""):new Ur("")}slice(t,e){return new Ur(this.value.slice(t.value,e.value))}equals(t){return qr(this._value===t.value)}partialCmp(t){const e=this._value.localeCompare(t.value);return e<0?Lr.Less:0===e?Lr.Equal:Lr.Greater}copy(){return new Ur(this._value)}toJS(){return this._value}toJSON(){return this.toJS()}toString(){return`${this._value}`}debugTypeOf(){return new Ur(Ur.kind)}contains(t){return qr(this.value.indexOf(t.value)>-1)}count(){return ei(this.value.length)}}Ur.kind="String";const Vr=(t="")=>new Ur(t);class Gr{constructor(){this._value=null}static fromStr(t){switch(t.value){case"undefined":case"nil":case"null":return new Gr;default:throw new $r(`Invalid Nothing literal: "${t.value}".`)}}get value(){return null}equals(t){return qr(this._value==t._value)}not(){return qr(!0)}toJS(){return null}toJSON(){return null}toString(){return"null"}debugTypeOf(){return Vr(Gr.kind)}}Gr.kind="null";const zr=new Gr,Wr=t=>~~t,Jr=t=>null==t||null==t||t==zr,Hr=(t,e)=>{if(t)throw new $r(e);return!0},Xr=(t,e)=>Hr(t.constructor!==e.constructor,`Type Error! Expected '${ti(t)}', but got '${ti(e)}'`),Kr=(t,e)=>{var n;return Hr(t!==e.constructor,`Expected '${null!==(n=t.kind)&&void 0!==n?n:t.name}', but got '${ti(e)}'.`)},Qr=(t,e)=>Hr(!t[e],`"${e.toString()}" is not defined on ${t}`),Zr=t=>Hr(!Number.isInteger(t),`Expected integer number', but got '${t}'.`),Yr=(t,e)=>(Hr(Jr(t),e),t),ti=t=>{var e,n,r,i;return null!==(i=null!==(n=null===(e=null==t?void 0:t.constructor)||void 0===e?void 0:e.kind)&&void 0!==n?n:null===(r=null==t?void 0:t.constructor)||void 0===r?void 0:r.name)&&void 0!==i?i:"unknown"};function ei(t,e=0){if("string"==typeof t){ni(t);const e=ri(t)?ii(t):oi(t);return ei(e.intValue,e.decimals)}return Number.isInteger(t)||0!==e?(Zr(t),Zr(e),new li(t,e)):ei(t.toString())}function ni(t){return Hr(""===t||isNaN(Number(t)),`Invalid number: "${t}"`)}function ri(t){return t.startsWith("0")?/^0[eE]0$/.test(t):/^[-+]?[1-9](\.\d+)?[eE][-+]?\d+$/.test(t)}function ii(t){Hr(!ri(t),`Input is not in scientific form: "${t}"`);const e=t.split(/[eE]/),n=oi(e[0]),r=parseInt(e[1]);return n.decimals>r?n.decimals-=r:(n.intValue*=Math.pow(10,r-n.decimals),n.decimals=0),n}function oi(t){var e;ni(t);const[,n]=t.split("."),r=null!==(e=null==n?void 0:n.length)&&void 0!==e?e:0;return{intValue:parseInt(t.replace(".","")),decimals:r}}function si(t,e){const n=Math.max(t.decimals,e.decimals);return{maxDecimal:n,intValue1:t.intValue*Math.pow(10,n-t.decimals),intValue2:e.intValue*Math.pow(10,n-e.decimals)}}var ai={modulo:function(t,e){const n=t.value,r=e.value;return Zr(n),Zr(r),Hr(r<1,`Modulo (${r}) must be positive.`),Hr(n<0,`Number (${n}) cannot be negative.`),ei(n%r)}};const ui=(t,e)=>t!==e&&t?e?ui(e,t%e):t:e,ci=t=>Math.abs(t)<=Number.EPSILON;class li{constructor(t,e=0){const n=function(t,e){if(0===t)return{intValue:0,decimals:0};for(;t>Number.MAX_SAFE_INTEGER||t%10==0&&e>0;){const n=t.toString();t=parseInt(n.substring(0,n.length-1)),e-=1}return{intValue:t,decimals:e}}(t,e);this._decimals=n.decimals,this._intValue=n.intValue}get intValue(){return this._intValue}get decimals(){return this._decimals}get value(){return this._intValue*Math.pow(10,-this._decimals)}equals(t){return qr((e=this.value,n=t.value,ci(e-n)));var e,n}negate(){return new li(-this.intValue,this.decimals)}add(t){const e=si(this,t),n=e.intValue1+e.intValue2;return new li(n,e.maxDecimal)}subtract(t){const e=si(this,t),n=e.intValue1-e.intValue2;return new li(n,e.maxDecimal)}multiply(t){return new li(this.intValue*t.intValue,this.decimals+t.decimals)}divide(t){if(0===t.intValue)throw new $r("Cannot divide by zero!");const e=si(this,t),n=Math.round(e.intValue1/e.intValue2*Math.pow(10,12));return new li(n,12)}partialCmp(t){const e=si(this,t);return e.intValue1<e.intValue2?Lr.Less:e.intValue1>e.intValue2?Lr.Greater:Lr.Equal}toJS(){return this.intValue/Math.pow(10,this.decimals)}toString(){return`${t=this.intValue,e=this.decimals,(t/Math.pow(10,e)).toFixed(e)}`;var t,e}copy(){return new li(this.intValue,this.decimals)}debugTypeOf(){return Vr(li.kind)}isInteger(){return qr(0===this.decimals)}toJSON(){return this.toString()}}li.kind="Number";const hi=t=>e=>{Kr(li,e);try{return ei(t(e.value))}catch(n){throw new $r(`Invalid argument for ${t.name}: ${e.value}`)}},di=t=>(e,n)=>(Kr(li,e),Kr(li,n),ei(t(e.value,n.value))),pi=ei(Math.E),fi=ei(Math.LN2),mi=ei(Math.LN10),gi=ei(Math.LOG2E),_i=ei(Math.LOG10E),yi=ei(Math.PI),vi=ei(Math.SQRT1_2),bi=ei(Math.SQRT2),wi=hi(Math.abs),xi=hi(Math.sign),Ti=di((t,e)=>Math.min(t,e)),ki=di((t,e)=>Math.max(t,e)),Si=hi(Math.floor),Ai=hi(Math.round),Ei=hi(Math.ceil),Oi=hi(Math.trunc),Ci=hi(Math.cbrt),Mi=hi(Math.sqrt),Ni=hi(Math.exp),Ii=di(Math.pow),ji=hi(Math.log),Ri=hi(Math.log2),Pi=hi(Math.log10),Di=Math.PI/180,Li=hi(t=>{const e=t%Math.PI;return ci(e)||ci(e-Math.PI)?0:Math.sin(t)}),Fi=hi(Math.asin),$i=hi(Math.asinh),Bi=hi(Math.cos),qi=hi(Math.acos),Ui=hi(Math.acosh),Vi=hi(Math.tan),Gi=hi(Math.atan),zi=di(Math.atan2),Wi=hi(Math.atanh);var Ji=Object.freeze({__proto__:null,E:pi,LN2:fi,LN10:mi,LOG2E:gi,LOG10E:_i,PI:yi,SQRT1_2:vi,SQRT2:bi,abs:wi,sign:xi,min:Ti,max:ki,floor:Si,round:Ai,ceil:Ei,trunc:Oi,cbrt:Ci,sqrt:Mi,exp:Ni,pow:Ii,log:ji,log2:Ri,log10:Pi,deg2rad:t=>t.multiply(ei(Di)),rad2deg:t=>t.divide(ei(Di)),sin:Li,asin:Fi,asinh:$i,cos:Bi,acos:qi,acosh:Ui,tan:Vi,atan:Gi,atan2:zi,atanh:Wi});const Hi=t=>(Qr(t,"copy"),t.copy());var Xi={typeof:t=>{const e=t.debugTypeOf?t.debugTypeOf():Vr("<unknown>");return e instanceof String?Vr(e):e},copy:Hi,"deep-copy":t=>{var e;return Qr(t,"copy"),t.deepCopy?null===(e=t.deepCopy)||void 0===e?void 0:e.call(t):Hi(t)},str:t=>Vr(t.toString()),"to-json":t=>{let e=null;return"function"==typeof t.toJSON?e=t.toJSON():"function"==typeof t.toJS&&(e=t.toJS()),Vr(JSON.stringify(e))}};const Ki=(t,e)=>t.constructor!==e.constructor?qr(!1):t.equals(e),Qi=(t,e)=>{Xr(t,e);const n=t.lt;return"function"==typeof n?n(e):qr(t.partialCmp(e)===Lr.Less)},Zi=(t,e)=>{Xr(t,e);const n=t.gt;return"function"==typeof n?n(e):qr(t.partialCmp(e)===Lr.Greater)};var Yi={"==":Ki,"!=":(t,e)=>Ki(t,e).not(),"<":Qi,"<=":(t,e)=>qr(Ki(t,e).value||Qi(t,e).value),">":Zi,">=":(t,e)=>qr(Ki(t,e).value||Zi(t,e).value)};var to={count:t=>t.count(),contains:function(t,e){return e.contains(t)},map:function(t,e){return e.map(e=>this.evalFn(t,[e]))},filter:function(t,e){return e.filter(e=>this.evalFn(t,[e]))},reduce:function(t,e,n){return n.reduce(t,(t,n)=>this.evalFn(e,[t,n]))},slice:function(t,e,n){return n.slice(t,e)}};const eo=(t,e)=>(Xr(t,e),t.add(e)),no=(t,e)=>(Xr(t,e),t.multiply(e));var ro={negate:t=>t.negate(),not:t=>t.not(),and:(t,e)=>t.and(e),or:(t,e)=>t.or(e),"+":eo,"-":(t,e)=>(Xr(t,e),t.subtract(e)),"*":no,"/":(t,e)=>(Xr(t,e),t.divide(e)),get:(t,e)=>t.index(e)};class io{constructor(t){t.map(e=>Xr(t[0],e)),this._value=t}get value(){return this._value}contains(t){return qr(void 0!==this.value.find(e=>Ki(e,t).value))}add(t){return new io(this._value.concat(t.value))}count(){var t;return new li(null!==(t=this._value.length)&&void 0!==t?t:0)}map(t){return new io(this.value.map(e=>t(e)))}filter(t){return new io(this.value.filter(e=>t(e).toJS()))}reverse(){return new io(this.value.reverse())}reduce(t,e){return this.value.reduce(e,t)}intersperse(t){const e=this.value.length-1;return new io(this.value.reduce((n,r,i)=>(n.push(r),i<e&&n.push(t),n),[]))}toJS(){return this.value.map(t=>t.toJS())}toJSON(){return this.value.map(t=>t.toJSON())}toString(){return`[${this._value.map(t=>t.toString()).join(",")}]`}index(t){Kr(li,t);return Yr(this.value[t.value],`Vector index ${t.toString()} is not defined`)}slice(t,e){return Kr(li,t),Kr(li,e),new io(this.value.slice(t.value,e.value))}copy(){return new io([...this._value])}deepCopy(){return new io(this._value.map(t=>Hi(t)))}debugTypeOf(){return Vr(io.kind)}}function oo(...t){return new io(t)}io.kind="Vector";var so={sum:t=>(Kr(io,t),t.reduce(ei(0),eo)),prod:t=>(Kr(io,t),t.reduce(ei(1),no)),intersperse:(t,e)=>(Kr(io,e),e.intersperse(t)),join:t=>(Kr(io,t),t.reduce(Vr(""),eo)),"join-with":(t,e)=>(Kr(io,e),e.intersperse(t).reduce(Vr(""),eo)),"num-list":(t,e)=>(Kr(io,e),e.map(t=>Vr(t.toString())).intersperse(t).reduce(Vr(""),eo)),head:t=>{Kr(io,t);return Yr(t.value[0],"Vector is empty")},reverse:t=>(Kr(io,t),oo(...t.value.reverse())),slice:(t,e,n)=>(Kr(io,t),Kr(li,n),Kr(li,e),Yr(t.value.length,"Vector is not defined correctly"),oo(...t.value.slice(e.value,n.value))),tail:t=>{Kr(io,t),Yr(t.value.length,"Vector is not defined correctly");return oo(...t.value.slice(1))}};const ao=Math.random;var uo=Object.freeze({__proto__:null,random:()=>ei(ao()),randomInt:(t,e)=>{const n=Wr(t.value),r=Wr(e.value);return ei(Wr(n+ao()*(r-n)))},shuffle:t=>{const e=[...t.value];let n,r,i;for(i=e.length-1;i>0;i--)n=Math.floor(Math.random()*(i+1)),r=e[i],e[i]=e[n],e[n]=r;return oo(...e)},range:(t,e,n)=>{const r=t.value,i=n.value,o=Wr(e.value);let s=r;const a=[];for(let t=0;t<o;t++)a.push(ei(s)),s+=i;return oo(...a)},range0:t=>{const e=Wr(t.value);return oo(...Array.from({length:e},(t,e)=>ei(e)))}});class co{constructor(t){this._value=t}get value(){return this._value}toJS(){var t,e;return null===(e=null===(t=this._value)||void 0===t?void 0:t.toJS)||void 0===e?void 0:e.call(t)}toJSON(){return this.toJS()}toString(){return`Just(${this._value.toString()})`}debugTypeOf(){return Vr(co.kind)}}co.kind="Just";class lo{constructor(t=[]){if(t.length%2!=0)throw new $r("Invalid hash map definition.\nDefinition must contains key value pairs");const e=((t,e=2)=>{const n=[],r=t.length;for(let i=0;i<r;i+=e)n.push(t.slice(i,i+e));return n})(t).map(([t,e])=>{if(Ur!==t.constructor)throw new $r("Invalid hash map definition.\n Keys are must be string or keyword");return[t.value,e]});this._value=new Map(e)}get value(){return this._value}toJS(){return new Map(Array.from(this._value.entries()).map(([t,e])=>[t,e instanceof li?e.toString():e.toJS()]))}toJSON(){return Array.from(this._value.entries()).reduce((t,[e,n])=>(t[e]=n.toJSON(),t),{})}toString(){return`{${Array.from(this._value.entries()).map(([t,e])=>`${t.toString()} -> ${e.toString()}`).join(", ")}}`}debugTypeOf(){return Vr(lo.kind)}index(t){Kr(Ur,t);try{const e=this._value.get(t.value);return Jr(e)?new Gr:e}catch(t){return new Gr}}}lo.kind="HashMap";const ho=(...t)=>new lo(t);var po={keys:t=>(Kr(lo,t),oo(...Array.from(t.value.keys()).map(t=>Vr(t)))),values:t=>(Kr(lo,t),oo(...Array.from(t.value.values()))),"hash-map":ho};class fo{constructor(t){const e=t.value;e.map(t=>Xr(e[0],t)),this._value=e.reduce((t,e)=>(t.find(t=>Ki(t,e).value)||t.push(e),t),[])}get value(){return this._value}contains(t){return qr(void 0!==this.value.find(e=>Ki(e,t).value))}union(t){return new fo(oo(...this._value.concat(t.value)))}difference(t){return new fo(oo(...this.value.filter(e=>!t.contains(e).value)))}intersection(t){return new fo(oo(...this.value.concat(t.value).filter(e=>t.contains(e).value&&this.contains(e).value)))}symmetricDifference(t){return new fo(oo(...this.value.concat(t.value).filter(e=>!(t.contains(e).value&&this.contains(e).value))))}count(){var t;return new li(null!==(t=this._value.length)&&void 0!==t?t:0)}map(t){return new fo(oo(...this.value.map(t)))}filter(t){return new fo(oo(...this.value.filter(e=>t(e).toJS())))}reduce(t,e){return this.value.reduce(e,t)}toJS(){return this.value.map(t=>t.toJS())}toJSON(){return this.value.map(t=>t.toJSON())}toString(){return`[${this.value.map(t=>t.toString()).join(",")}]`}copy(){return new fo(oo(...this.value))}deepCopy(){return new fo(oo(...this.value.map(t=>Hi(t))))}debugTypeOf(){return Vr(fo.kind)}}fo.kind="Set";var mo={Set:t=>new fo(t),"set-2-list":function(t){return oo(...t.value)},"set-union":function(t,e){return t.union(e)},"set-diff":function(t,e){return t.difference(e)},"set-intersection":function(t,e){return t.intersection(e)},"set-symmetric-difference":function(t,e){return t.symmetricDifference(e)}};const go=(t,e)=>Number.isInteger(t)&&Number.isInteger(e)&&0!==e;class _o{constructor(t,e){if(!go(t,e))throw new $r("Invalid fraction number parameters!");e<0&&(t*=-1,e*=-1);const n=ui(Math.abs(t),Math.abs(e));this._n=t/n,this._d=e/n}get numerator(){return this._n}get denominator(){return this._d}equals(t){return qr(this.numerator===t.numerator&&this.denominator===t.denominator)}negate(){return new _o(-this._n,this._d)}add(t){const e=this.numerator*t.denominator+this.denominator*t.numerator,n=this.denominator*t.denominator;return new _o(e,n)}subtract(t){const e=this.numerator*t.denominator-this.denominator*t.numerator,n=this.denominator*t.denominator;return new _o(e,n)}multiply(t){const e=this.numerator*t.numerator,n=this.denominator*t.denominator;return new _o(e,n)}divide(t){const e=this.numerator*t.denominator,n=this.denominator*t.numerator;return new _o(e,n)}partialCmp(t){const e=this._d*t._d/ui(this._d,t._d),n=this._n*e/this._d,r=t._n*e/t._d;return n<r?Lr.Less:n>r?Lr.Greater:Lr.Equal}toJS(){return{numerator:this._n,denominator:this._d}}toJSON(){return this.toString()}toString(){return`${this._n}/${this._d}`}copy(){return new _o(this._n,this._d)}debugTypeOf(){return Vr(_o.kind)}}_o.kind="Fraction";const yo=(t,e)=>new _o(t,e);var vo={"number-2-fraction":(t,e)=>{const n=t.value;Hr(n<1||!Number.isInteger(n),`Accuracy must be a positive integer number instead of ${n}`);const r=e.value,i=Math.pow(10,n);return yo(Math.round(r*i),i)},"fraction-2-number":t=>ei(t.numerator).divide(ei(t.denominator)),reciprocal:t=>(Kr(_o,t),yo(t.denominator,t.numerator))};const bo=t=>t,wo={Bool:{parser:t=>Br.fromStr(Vr(t)),factory:t=>(Kr(Br,t),t)},Nothing:{parser:t=>Gr.fromStr(Vr(t)),factory:t=>(Kr(Gr,t),t)},Int:{parser:ei,factory:function(t){return Kr(li,t),Hr(!t.isInteger().value,"Expected integer, but got float number."),t}},Float:{parser:ei,factory:function(t){return Kr(li,t),t}},FractionNumber:{parser:t=>{const[e,n]=t.split("/").map(parseFloat);if(go(e,n))return new _o(e,n);throw new $r(`Invalid fraction number: ${t}.`)},factory:(t,e)=>(Hr(!t.isInteger().value,"Numerator must be integer"),Hr(!e.isInteger().value,"Denominator must be integer"),new _o(t.toJS(),e.toJS()))},String:{parser:Vr,factory:t=>(Kr(Ur,t),t)},Vector:{parser:bo,factory:oo},HashMap:{parser:bo,factory:ho}},xo=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Xi),Yi),to),ro),Fr),Ji),ai),vo),so),po),mo),uo),{maybe:t=>Jr(t)?zr:new co(t),Nothing:zr}),To={unboxing:t=>t.toJS()};function ko(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(t,e){return String.fromCharCode("0x"+e)}))}function So(t){return decodeURIComponent(atob(t).split("").map(function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)}).join(""))}wn("error",{type:"critical",message:"LEAF core error: race condition detected in leaflisp.js",codebase:"/src/ghostos/api/parser/nodelogic/wizardry/leaflisp.js"},{});const Ao=t=>t>0?" ".repeat(t):"",Eo={trace:[],probe:[]},Oo=(t,e=0,n=!1)=>{const r=typeof t,i=Ao(e),o=Ao(e+1);return"string"===r?(n?"":i)+`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"\n`:"object"===r?Array.isArray(t)?(n?"":i)+"[\n"+`${t.map(t=>Oo(t,e+1)).join("")}`+i+"]\n":[null,void 0].includes(t)?(n?"":i)+"null\n":(n?"":i)+"{\n"+`${Object.entries(t).map(([t,n])=>o+":"+t+" "+Oo(n,e+1,!0)).join("")}`+i+"}\n":"boolean"===r?(n?"":i)+(t?"true\n":"false\n"):"number"===r?(n?"":i)+String(t)+"\n":(n?"":i)+"null\n"};const Co=(t,e=!0)=>{if(null==t)return xo.Nothing;const n=typeof t;return"string"===n?Vr(t):"object"===n?Array.isArray(t)?oo(...t.filter(t=>t).map(t=>Co(t,!1))):[null,void 0].includes(t)?xo.Nothing:ho(...Object.entries(t).map(([t,e])=>[Vr(t),Co(e,!1)]).flat()):"boolean"===n?qr(t):"number"===n?ei(t.toString().includes("e")?function(t){let e="";"-"==(t+="").charAt(0)&&(t=t.substring(1),e="-");let n=t.split(/[e]/gi);if(n.length<2)return e+t;let r=.1.toLocaleString().substr(1,1),i=n[0],o=+n[1],s=(i=i.replace(/^0+/,"")).replace(r,""),a=i.split(r)[1]?i.indexOf(r)+o:s.length+o,u=a-s.length,c=""+BigInt(s);return s=o>=0?u>=0?c+"0".repeat(u):l():a<=0?"0"+r+"0".repeat(Math.abs(a))+c:l(),u=s.split(r),(0==u[0]&&0==u[1]||0==+s&&0==+c)&&(s=0),e+s;function l(){return s.replace(new RegExp(`^(.{${a}})(.)`),`$1${r}$2`)}}(t):t):xo.Nothing},Mo=({_probefunc:t,_tracefunc:e}=args)=>({return:t=>t,outport:t=>t,undefined:xo.Nothing,nil:xo.Nothing,null:xo.Nothing,trace:t=>{const n=t.toJSON();try{e&&e(n)}catch(e){return t}return t},probe:e=>{const n=e.toJSON();try{t&&t(n)}catch(t){return e}return e},format:(t,e)=>{const n=e.toJSON(),r=t.toJS().replace(/\$\{([^{}]*)\}/gm,(t,e)=>`\${this.${e.replace(/\s*/g,"")}}`);return Vr(function(t,e){const n=new Proxy(e,{get:(t,e)=>{const n=t[e];return"object"==typeof n&&null!==n?JSON.stringify(n).replace(/"/g,'"'):n}});return new Function("return `"+t+"`;").call(n)}(r.replace(/"/g,'"'),n))},isnil:t=>qr("null"==t||t.constructor==xo.Nothing.constructor),isbottle:t=>{const e=t.toJSON();return qr(nn(e))},islist:t=>{const e=t.toJSON();return qr(Array.isArray(e))},flatten:t=>{const e=t.toJSON();return Co(e.flat().filter(t=>t),!1)},join:(t,e)=>{const n=t.toJSON();return Vr(n.join(e))},bottle:(t,e)=>{if(t.constructor!==Ur)throw new $r(`Expected '${Ur.kind??Ur.name}', but got '${getObjectName(t.value)}'.`);const n=t.toJSON(),r=e.toJSON(),i="object"==typeof r&&!Array.isArray(r)&&"_content"in r&&"_label"in r?{_bname:n,_content:r._content,_label:r._label}:{_bname:n,_content:r,_label:{}};return Co(i)},getbottle:(t,e)=>{if(t.constructor!==io)throw new $r(`Expected '${io.kind??io.name}', but got '${getObjectName(t.value)}'.`);const n=t.value.filter(t=>t.value.get("_bname").value===e.value);return 1===n.length?n[0]:n.length>1?n:void 0},unbottle:t=>{if(t.constructor!==lo)throw new $r(`Expected '${lo.kind??lo.name}', but got '${getObjectName(t.value)}'.`);return t.value.get("_content")},regexp:(t,e)=>{const n=e.toJSON().match(/\/(.*)\/(.*)/),r=new RegExp(n[1],n[2]),i=t.toJSON(),o="string"===typeof i?i.match(r):[];return Co(o||[])},min:t=>{if(t.constructor!==io)throw new $r(`Expected '${io.kind??io.name}', but got '${getObjectName(t.value)}'.`);const e=t.value.map(t=>t.value);return ei(Math.min(...e))},max:t=>{if(t.constructor!==io)throw new $r(`Expected '${io.kind??io.name}', but got '${getObjectName(t.value)}'.`);const e=t.value.map(t=>t.value);return ei(Math.max(...e))},parse:t=>{const e=t.toJSON();let n;return ni(e),n=ri(e)?ii(e):oi(e),0===n.decimals?ei(n.intValue):ei(n.intValue,n.decimals)},"merge-dict":(t,e)=>{if(t.constructor!==lo)throw new $r(`Expected '${lo.kind??lo.name}', but got '${getObjectName(t.value)}'.`);if(e.constructor!==lo)throw new $r(`Expected '${lo.kind??lo.name}', but got '${getObjectName(e.value)}'.`);const n={...t.toJSON(),...e.toJSON()};return Co(n)},"make-dict":(t,e)=>{if(t.constructor!==io)throw new $r(`Expected '${io.kind??io.name}', but got '${getObjectName(t.value)}'.`);if(e.constructor!==io)throw new $r(`Expected '${io.kind??io.name}', but got '${getObjectName(e.value)}'.`);const n=t.toJSON(),r=e.toJSON(),i=[...Array(n.length).keys()].reduce((t,e)=>({...t,[n[e]]:r[e]}),{});return Co(i)},concat:(t,e)=>{if(t.constructor!==io)throw new $r(`Expected '${io.kind??io.name}', but got '${getObjectName(t.value)}'.`);if(e.constructor!==io)throw new $r(`Expected '${io.kind??io.name}', but got '${getObjectName(e.value)}'.`);return oo(...t.value.concat(e.value))},gload:t=>{Ro(t.toJSON(),plisp_instance)},uuid4:()=>Vr(Kn()),uuid5:t=>{const e=Bn(t.toString(),Bn.URL);return Vr(e)},"*":(t,e)=>ei(t*e),"/":(t,e)=>ei(t/e),"+":(t,e)=>isNaN(t.value)||isNaN(e.value)?t.add(e):ei(t.value+e.value),"-":(t,e)=>ei(t-e),tofixed:(t,e)=>Vr(Number(t).toFixed(e))}),No=(t,e)=>{const n={};(async()=>{const n={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:t.leafio,etaTree:t},user:{spellbook:t.graphcomponents.spelldefs,lambdalut:t.leafgraph.edges.lambda.sourcelut}},r=e_.lambda(n)({refnode:"leaflisp_runtime",refnodedata:{leaf:{logic:{args:{graphuuid:"",domain:"breezyforest",appid:"leaflisp-help",graphaddrstr:"breezyforest/leaflisp-help"}}}},nodelambda:[],contextuallambda:[]}),i=await r;return i?.cheatsheet?await a_(i.cheatsheet._default,e.data,{}):[]})().then(t=>{n.cheatsheet=t});const r={cheat:()=>{const t={help:"-LEAFlisp help text----------------------------------------------\n--------------------------------------------------------------------------\n"};return Object.keys(n.cheatsheet).map(e=>{t[e]=e in n.cheatsheet?n.cheatsheet[e]:`LEAFlisp error: no help is available for an unknown command ${e}.`}),Co(t)},help:t=>{const e={},r=t.toJSON();return r.length>0?(e.help="-LEAFlisp help text----------------------------------------------\n--------------------------------------------------------------------------\n",r.map(t=>{e[t]=t in n.cheatsheet?n.cheatsheet[t]:`LEAFlisp error: no help is available for an unknown command ${t}.`}),Co(e)):(e.help="-LEAFlisp help text----------------------------------------------\n--------------------------------------------------------------------------\n",Object.keys(n.cheatsheet).map(t=>{e[t]=t in n.cheatsheet?n.cheatsheet[t]:`LEAFlisp error: no help is available for an unknown command ${t}.`}),Co(e))}};return new Dr({globals:{...xo,...Mo({}),...r},utils:To},wo)},Io=["linear-algebra"],jo={"linear-algebra":{lp:(t,e)=>ho(Vr("a"),t,Vr("b"),e)}},Ro=(t,e)=>{Io.includes(t)&&Object.entries(jo[t]).map(([t,n])=>{e.interpreter.globals.define(t,xr(n))})},Po=(t,e,n,r,i=0)=>{try{e?.slice(0,4);const r=n.insituexecute(t);try{return[0,r.toJSON()]}catch(t){return[0,null]}}catch(t){let n=[];if("errors"in t)for(let o of t.errors){const s=`LEAFlisp error: {refnode: ${e}}: ${"Parser"===t.type?`line: ${o.line-i} - ${o.message}`:`line: ${o.position?.line-i} - ${o.message}`}`;n.push(wn("error",{address:r,refnode:e,message:s}))}else n.push(`LEAFlisp error: ${e}: unidentified execution failure. please check your leaflisp code for anomalies. exception: ${t.message}`);return[-1,n]}};let Do={};const Lo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{let o,s;const a=bn.memoize(async()=>await f_("breezyforest/probe",t.gos.etaTree,"leaflisp")),u=t.gos.etaTree.domain+"/"+t.gos.etaTree.appid,c=(t,n=e,r=0)=>{a().then(i=>{Object.entries(i).length>0&&(r>0&&Eo.trace.length===r&&Eo.trace.shift(),Eo.trace.push({timestamp:Date.now(),address:u,refnode:e,trace:t}),a_(i.probe._default,Eo.trace,{},n).then(t=>{}))})},l=(t,n=e,r=1)=>{a().then(i=>{Object.entries(i).length>0&&(r>0&&Eo.probe.length===r&&Eo.probe.shift(),Eo.probe.push({timestamp:Date.now(),address:u,refnode:e,trace:t}),a_(i.probe._default,Eo.probe,{},n).then(t=>{}))})},h=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});Do[e]="interactive"in h;const d=Do[e],p=n.leaf.logic.args.lispexpression;o="global"in h?t.gos.etaTree.gRuntimeLEAFlisp:new Dr({globals:{...xo,...Mo({_probefunc:l,_tracefunc:c})},utils:To},wo);const f="rewrite"in h,m="bottle"in h;e.slice(0,4);const g={codebase:"leaflisp.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data,leafaddress:t.gos.etaTree.domain+"/"+t.gos.etaTree.appid},_=new Pt;if(d){t.gos.etaTree.leafio.elementioLUT[e]=_;const n={graphuuid:"",domain:"breezyforest",appid:"leaflisp",graphaddrstr:"breezyforest/leaflisp"},r=e_.lambda(t)({refnode:"leaflisp_runtime_interactive",refnodedata:{leaf:{logic:{args:n}}},nodelambda:[],contextuallambda:[]}),i=await r;s=()=>{const n=wn("dataevent",{_refnode:e,_provenance:{domain:t.gos.etaTree.domain,appid:t.gos.etaTree.appid,refnodedata:g.leafnode,codebase:"leaflisp.js"}},{});a_(i.vim._default,n,{})}}return(r,i)=>{e.slice(0,4);const a=i?._config?.loopidx,u=i?._config?.clubrefnode,c=(t,n=p)=>{e.slice(0,4);let r=`(def inport ${Oo(null==t?[]:t)})`;a>=0&&(r+=`(def loopyindex ${a})`),u&&(r+=`(def clubref "${u}")`);const i=r.split(/\r\n|\r|\n/).length;r+=`${n}`;try{const[t,n]=Po(r,e,o,g.leafaddress,i);return-1===t&&l(n,e),n}catch(t){throw new $r(`LEAFlisp Error: ${t}`)}};return p_(i,r,void 0,{...g,metastep:"invoking leaflisp"},{leaflogic:d?(t,e)=>{const n=new Pt;let r=!1;const i=e._stream.pipe(V(t=>(s&&s(),t)),Nt(...t.map(t=>t._stream)),It(t=>Et(new qt(t[0]),_)),V(t=>{globalThis.DEBUG;const e=t[1];return r=!0,n.next(e),t[0]}),Lt());return{_stream:n.pipe($t(t=>r),V(t=>t),Lt()),_control:{...e,_stream:i}}}:(r,i)=>{const o=new Pt;let s=!1,a=p;const u=f?i._stream.pipe(V(t=>t),Nt(...r.map(t=>t._stream)),V(r=>{globalThis.DEBUG;let i=r[1];if(nn(i)&&"rewrite"===i._bname){const r=xn("*",i),o={...n},s=Oo(null==r?[]:r);o.leaf.logic.args.lispexpression=s,n.leaf.logic.args.lispexpression=s,a=s,t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:ko(JSON.stringify(o))}}),i=void 0}if(null!=i){s=!0;const t=c(i);return o.next(t),r[0]}}),$t(t=>void 0!==t),Lt()):m?i._stream.pipe(V(t=>t),Nt(...r.map(t=>t._stream)),V(t=>{globalThis.DEBUG;const e=t[1];if(nn(e)&&"codebottle"===e._bname){const n=xn("*",e);s=!0;const r=n.data,i=n.code,a=c(r,i);return o.next(a),t[0]}}),$t(t=>void 0!==t),Lt()):i._stream.pipe(V(t=>t),Nt(...r.map(t=>t._stream)),V(t=>{globalThis.DEBUG;const e=t[1];s=!0;const n=c(e);return o.next(n),t[0]}),Lt());return{_stream:o.pipe($t(t=>s),V(t=>t),Lt()),_control:{...i,_stream:u}}},datalogic:{pre:t=>t}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>(n,r)=>({...Lg(e,n,!1,!1,!1,{provenance:"leaflisp.js lambda",refnode:e,etaTree:t.gos.etaTree}),_control:r}),methods:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={lispcode:""},s=(t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>(await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{version:"breezyforest",nodequery:t=>({_stream:t._stream.pipe(map(t=>(node_output=n,node_output))),_control:controlflow$obj}),nodemethod:t=>({})}))(t)({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}),a=Do[e];return{...s,isinteractive:a,texteditor:{setTextSource:r=>{o.lispcode=r;const i={...n};i.leaf.logic.args.lispexpression=r,a||t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:ko(JSON.stringify(i))}})},getTextSource:()=>n.leaf.logic.args.lispexpression},general:{getNodeData:()=>n,executeLEAFlisp:t=>run(t)}}}},Fo=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafchronosflow.js",codebase:"/src/ghostos/api/parser/nodelogic/dataflow/leafchronosflow.js"},{}),{dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s={codebase:"leafchronosflow.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data},a="_default"in o?(t,e)=>o._default(t,e):(t,e)=>{const n=new Pt,r=t[0]._stream,i=e._stream.pipe(V(t=>t),Nt(r),V(t=>(n.next(t[1]),t[0])),Lt());return{_stream:n.pipe(V(t=>t),Lt()),_control:{...e,_stream:i.pipe(V(t=>t),Lt())}}};return(t,n)=>{if(t.length>1){const r=Bt(...t.map((t,e)=>t._stream.pipe(V(t=>t),Lt())));if("concat"in o){return{...$g(t),_control:n}}if("merge"in o){return{...Bg(t),_control:n}}if("combine"in o){return{...Lg(e,t),_control:n}}if("substitute"in o){const e=Object.keys(o.substitute);return{...Fg(t,e),_control:n}}{const t=t=>t,e=n._stream.pipe(V(t=>t));return p_({_stream:e},[{_stream:r}],void 0,{...s,metastep:"executing leafchronosflow "},{leaflogic:a,datalogic:{pre:t}})}}if(1===t.length)return{...t[0],_control:n}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t),_control:n})}),s}}),$o=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafmixflow.js",codebase:"/src/ghostos/api/parser/nodelogic/dataflow/leafmixflow.js"},{}),{dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s={codebase:"leafmixflow.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data},a="_default"in o?(t,e)=>o._default(t,e):(t,e)=>{const n=new Pt,r=e._stream.pipe(Nt(...t.map(t=>t._stream)),It(t=>{const e="bottle"in o,r="parfait"in o,i="crate"in o,s="dictionary"in o,a="raw"in o;let u;return"flatten"in o?(u=Array.isArray(t[1])?t[1].flat():t[1],n.next(e?wn("mix",u):u)):r&&!s?(u=[t[1]].flat().map(t=>nn(t)?xn("*",t):void 0).filter(t=>t&&"empty_data"!==t),a||(u=[...new Set(u.flat())]),n.next(e?wn("mix",u):u)):i&&!s?(u=[t[1]].flat().map(t=>nn(t)?t:void 0).filter(t=>void 0!==t&&!on(t)),a||(u=[...new Set(u.flat())]),1===u.length?n.next(e?wn("mix",u[0]):u[0]):n.next(e?wn("mix",u):u)):(u={},[t[1]].flat().filter(t=>nn(t)&&!on(t)).map(t=>{if(nn(t))return u=((e,n={})=>{const r=e._bname;return{...n,[r]:xn("*",t)}})(t,u),t}),n.next(e?wn("mix",u):u)),ln(t[0])}),Lt());return{_stream:n.pipe(V(t=>t),Lt()),_control:{...e,_stream:r}}};return(t,n)=>{if(t.length>1){if("concat"in o){return{...$g(t),_control:n}}if("merge"in o){return{...Bg(t),_control:n}}if("combine"in o){return{...Lg(e,t),_control:n}}if("substitute"in o){const e=Object.keys(o.substitute);return{...Fg(t,e),_control:n}}{const e=t=>t,r=n._stream;return p_({_stream:r},t,void 0,{...s,metastep:"executing leafmixflow "},{leaflogic:a,datalogic:{pre:e}})}}if(1===t.length){const e=t=>t,r=n._stream;return p_({_stream:r},t,void 0,{...s,metastep:"executing leafmixflow "},{leaflogic:a,datalogic:{pre:e}})}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t),_control:n})}),s}}),Bo=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafgateflow.js",codebase:"/src/ghostos/api/parser/nodelogic/dataflow/leafgateflow.js"},{}),Wt("leafgateflow")),qo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{type:s,args:a}=n.leaf.logic,u=En(Bo.editorconfig.namedatakey,a).toLowerCase(),c=En(Bo.editorconfig.toggledatakey,a),l=(()=>{const t=Object.keys(o).filter(t=>0===Object.keys(o[t]).length);return t.length>0?t.sort().join(";"):void 0})(),h={codebase:"leafgateflow.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>p_(e,t,void 0,{...h,metastep:"gateflow "+(c?"NOT gate, ":"normal gate, ")+u},{leaflogic:(t,e)=>{const n=new Pt,r=e._stream.pipe(Nt(...t.map(t=>t._stream)),V(t=>{const e=t[1],r=t=>nn(t)?!c&&t._bname?.toLowerCase()===u||c&&t._bname?.toLowerCase()!==u?t:void 0:"{crate}"===u?!c&&t._cratelabel?"uncrate"===l?Object.keys(t).filter(t=>"_cratelabel"!==t).map(e=>t[e]).flat():t:c&&!t._cratelabel?t:void 0:((t,e)=>{const n=t?Object.entries(t).map(t=>t[0]+"="+("object"==typeof t[1]?JSON.stringify(t[1]):t[1])):[];if(e?!n.includes(u):n.includes(u))return t})(t,c),i=Array.isArray(e),o=i?e.map(t=>r(t)).filter(t=>void 0!==t):r(e);if(o?.length>0||!i&&void 0!==o)return n.next(o),t[0]}),$t(t=>void 0!==t),Lt());return{_stream:n.pipe(V(t=>t),Lt()),_control:{...e,_stream:r.pipe(V(t=>t),Lt())}}},datalogic:{post:t=>t}})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t),_control:n})}),s}},Uo=wn("error",{type:"critical",message:"LEAF core error: race condition detected in leaflabel.js",codebase:"/src/ghostos/api/parser/nodelogic/datautils/leaflabel.js"},{}),Vo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={codebase:"leaflabel.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(r,i)=>{const a=r=>{if(t.gos.etaTree.leafgraph.edges.data.targets.has(e))return n.leaf.logic.args.labelstr,r.map(t=>t._stream);if(n.leaf.logic.args.labelstr){const t=(async(t,n="")=>{let r=n.match(/^\\(.*)$/);if(r){const n=r[1];return n in t?await a_(t(n)._default,e):""}if(r=n.match(/^\?([A-Za-z0-9-]*)$/),r){const t=r[1],e=window.location.search,n=new Proxy(new URLSearchParams(e),{get:(t,e)=>t.get(e)}),i={};return n[t]&&(i[t]=n[t]),t in i?i:void 0}return n})(o,n.leaf.logic.args.labelstr);return[Promise.resolve(t)]}return r.map(t=>t._stream)};return p_(i,r,void 0,{...s,metastep:"leaflabel "+e},{leaflogic:(t,e)=>{const n=new qt({...Uo,_label:{...s}}),r=a(t),i=t.length>0?e._stream.pipe(It(t=>Et([ln(t),...r])),V(t=>(2==t.length?n.next(t[1]):n.next(t.slice(1)),t[0])),$t(t=>t),Lt()):e._stream;return{_stream:n,_control:{...e,_stream:i}}},datalogic:{}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={};if(r.length>0){const s=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});o[n.leaf.logic.args.labelstr]={...s}}else o[n.leaf.logic.args.labelstr]={};return o},methods:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{let o;if(r.length>0){o={...await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree})}}else o={};return o}},Go={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s=(t,e)=>(t in e._label&&(e._label[t]-=1),0===e._label[t]&&delete e._label[t],e);return(t,e)=>{if(n.leaf.logic.args.label||"label"in o){const r=o.label?o.label(t):{_stream:ln([n.leaf.logic.args.label])};return{_stream:Bg(t)._stream.pipe(Nt(r._stream),V(t=>t),$t(([t,e])=>t.every(t=>nn(t)||rn(t)&&t._crate.every(nn))),V(([t,e]=[])=>{const n=1===e.length?t.map(t=>[t,e[0]]):t.length===e.length?t.map((t,n)=>[t,e[n]]):[],r=t=>({...t,_label:{...t._label}}),i=n.reduce((t,[e,n]=[])=>(nn(e)?t.push(s(n,r(e))):rn(e)&&t.push({...e,_crate:e._crate.map(t=>s(n,r(t)))}),t),[]);if(i.length>0)return i}),$t(t=>t)),_control:e}}throw"LEAF Error: flow data cannot be labelled without a label, at _leafdataDelabel()"}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=n.leaf.logic.args.labelstr;return o&&s in o?{...o[s]}:{}}},zo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(()=>{const t=Object.keys(o).filter(t=>0===Object.keys(o[t]).length);return t.length>0?t.sort().join(";"):void 0})(),a={codebase:"leafbottle.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>{let r,i;const u=o.name?o.name._default(t,e):{_stream:ln(n.leaf.logic.args.bottlekey),_control:e},c=e._stream.pipe(hn(t=>(r=t,u._stream)),V(t=>(i=t,r)));return p_({_stream:c},t,void 0,{...a,metastep:"executing bottle with key "+i},{datalogic:{pre:t=>void 0===s?wn(i,t):wn(i,t,{tag:s})}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,n])=>{s[t]=(t,r)=>{const i=Lg(e,t);return{...n([i],r),_control:r}}}),s}},Wo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s={codebase:"leafunbottle.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,e)=>{if(n.leaf.logic.args.bottlekey||"bottlekey"in o){const r=o.label?o.label._default(t,e):{_stream:ln([n.leaf.logic.args.bottlekey]),_control:e};let i;const a=e._stream.pipe(Nt(r._stream),V(t=>{const e=t[1];return i=e,t[0]}),Lt()),u=(t,e)=>{const n=new Pt,r=e._stream.pipe(Nt(...t.map(t=>t._stream)),V(t=>{const e=t[1],r=t=>{const e=[t].flat().map(t=>nn(t)&&i.includes(t._bname)?t._content:void 0).filter(t=>t);if(e.length>0)return 1===e.length?e[0]:e},o=Array.isArray(e),s=o?e.map(t=>r(t)).filter(t=>void 0!==t):r(e);if(s?.length>0||!o&&void 0!==s)return n.next(s),t[0]}),$t(t=>void 0!==t),Lt());return{_stream:n.pipe(V(t=>t),Lt()),_control:{...e,_stream:r.pipe(V(t=>t),Lt())}}};return p_({_stream:a},t,void 0,{...s,metastep:"executing unbottle with key "+i},{leaflogic:u,datalogic:{post:t=>t}})}throw"LEAF Error: flow data cannot be unbottled without a bottlekey, at _leafdataUnbottle()"}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s}},Jo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data,(()=>{const t=Object.keys(o).filter(t=>0===Object.keys(o[t]).length);return t.length>0?t.sort().join(";"):void 0})());a="in the leafdataunbottle lambda";var a;return(t,e)=>{const n=new Pt,r=e._stream.pipe(Nt(...t.map(t=>t._stream)),V(t=>{const e={_cratelabel:s?{tag:s}:{}};if((Array.isArray(t[1])?t[1]:[t[1]]).flat().map(t=>nn(t)&&t._label.tag&&"string"==typeof t._label.tag?t:void 0).filter(t=>void 0!==t).map(t=>{e[t._bname]=t._bname in e?[...e[t._bname],t]:[t]}),Object.keys(e).length>1)return n.next(e),t[0]}),$t(t=>void 0!==t),Lt());return{_stream:n.pipe(V(t=>t),Lt()),_control:{...e,_stream:r}}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s}};function Ho(t,e,n){if(this.outer=n,this.dict=Object.create(null),this.get=function(t){return this.dict["$"+t]},this.set=function(t,e){this.dict["$"+t]=e},this.find=function(t){return"$"+t in this.dict?this:this.outer?this.outer.find(t):null},t&&e)for(let n=0;n<t.length;++n)this.set(t[n],e[n])}let Xo=new Ho;const Ko=(t,e=!0)=>"object"===typeof t?e?JSON.stringify(Object.entries(t).map(t=>[t[0],Ko(t[1],!1)]).sort()):Object.entries(t).map(t=>[t[0],Ko(t[1],!1)]).sort():JSON.stringify(t);let Qo={"+":function(){return[].reduce.call(arguments,function(t,e){return t+e})},"-":function(t,e){return t-e},"*":function(){return[].reduce.call(arguments,function(t,e){return t*e})},"/":function(t,e){return t/e},"%":function(t,e){return t%e},and:function(t,e){return t&&e},or:function(t,e){return t||e},not:function(t){return!t},">":function(t,e){return t>e},"<":function(t,e){return t<e},">=":function(t,e){return t>=e},"<=":function(t,e){return t<=e},"=":function(t,e){return t==e},":":function(t,e){return e[t]},"...":function(t,e){const n={...t};return Object.entries(e).forEach(([t,e])=>{n[t]=e}),n},"in?":function(t,e){const n=Array.isArray(t);return Object.entries(t).some(([t,r])=>{let i={};return i[t]=r,n?Ko(r)===Ko(e):Ko(i)===Ko(e)})},"equal?":function(t,e){return t===e},"eq?":function(t,e){return t===e},length:function(t){return t.length},cons:function(t,e){return[t].concat(e)},car:function(t){return t[0]},cdr:function(t){return t.slice(1)},append:function(t,e){return t.concat(e)},list:function(){return[].slice.call(arguments)},"list?":function(t){return Array.isArray(t)},"null?":function(t){return Array.isArray(t)&&!t.length},"symbol?":function(t){return"string"==typeof t},MathPI:Math.PI,MathE:Math.E,MathLN10:Math.LN10,MathLN2:Math.LN2,MathLOG10E:Math.LOG10E,MathLOG2E:Math.LOG2E,MathSQRT2:Math.SQRT2,False:!1,True:!0,Null:null};Object.keys(Qo).forEach(function(t){Xo.set(t,Qo[t])}),["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","log10","log2","max","min","pow","random","round","sin","sqrt","tan"].forEach(function(t){Xo.set(t,Math[t])});(t=>{function e(n,r){r=r||t;const i=typeof n;if("string"===i)return r.find(n).get(n);if(!Array.isArray(n)){if("object"===i){let t={};return Object.entries(n).map(([n,i])=>{t[n]=e(i,r)}),t}return n}if("quote"===n[0])return n.slice(1).join(" ");if("if"===n[0])return e((o=e(n[1],r),(Array.isArray(o)?o.length:o)?n[2]:n[3]),r);var o;if("set!"===n[0])return r.find(n[1]).set(n[1],e(n[1],r));if("define"===n[0])return r.set(n[1],e(n[2],r));if("lambda"===n[0])return function(){return e(n[2],new Ho(n[1],arguments,r))};if("begin"===n[0]){let t;for(let i=1;i<n.length;++i)t=e(n[i],r);return t}let s=n.map(function(t){return e(t,r)}),a=s.shift();return"function"==typeof a?a.apply(null,s):a}function n(t){return r(function(t){return t.replace(/\(/g," ( ").replace(/\)/g," ) ").replace(/\{/g," { ").replace(/\}/g," } ").replace(/^\s+|\s+$/g,"").split(/\s+/g)}(t))}function r(t){if(!t.length)throw new SyntaxError("unexpected EOF while reading");let e=t.shift();if("("===e){let e=[];for(;")"!==t[0];)e.push(r(t));return t.shift(),e}if("{"===e){let e={};for(;"}"!==t[0];){let n=t.shift(),i=":"===n[0]?n.slice(1):null;if(!i)throw new SyntaxError("unexpected key: "+n);e[i]=r(t)}return t.shift(),e}if("}"===e)throw new SyntaxError("unexpected )");if(")"===e)throw new SyntaxError("unexpected )");return function(t){let e=Number(t);return isNaN(e)&&"NaN"!==t?String(t):e}(e)}})(Xo);const Zo={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});return(t,e)=>{const n=Bg(t);if(n&&"_stream"in n){return{_stream:n._stream.pipe(V(t=>t)),_control:e}}return{_stream:ln([]),_control:e}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={};if(r.length>0){const s=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});o[n.leaf.logic.type]={...s}}else o[n.leaf.logic.type]={};return o},methods:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});return{config:{getConfigData:async()=>{const t="_default"in o?o._default:void 0;return t?await a_(t,[],{}):{}}}}}};var Yo=function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=mn);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,n),i}return o(e,t),e.prototype.next=function(e){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,s=n._timestampProvider,a=n._windowTime;r||(i.push(e),!o&&i.push(s.now()+a)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!t.closed;i+=n?1:2)t.next(r[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,n=t._timestampProvider,r=t._buffer,i=t._infiniteTimeWindow,o=(i?1:2)*e;if(e<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var s=n.now(),a=0,u=1;u<r.length&&r[u]<=s;u+=2)a=u;a&&r.splice(0,a+1)}},e}(Pt);const ts=wn("error",{type:"critical",message:"LEAF core error: race condition detected in mediaplayer.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/mediaplayer.js"},{}),es=t=>{const e=t[lg.LAMBDA_OBJ],n="uri"in e&&"_default"in e.uri?e.uri._default:void 0,r={codebase:"ghostos/api/parser/nodelogic/elements/library/mediaplayer.js",refnode:t[lg.REFNODE]};return{leaflogic:(e,i)=>{const o=p_(i,e,void 0,r,{leaflogic:n,datalogic:{post:e=>(t[lg.mediaplayer.URI]=e,e)}})._control,s=new qt(ts),a=o._stream.pipe(Nt(...e.map(t=>t._stream)),V(t=>{const e=t[1];return s.next(e),t[0]}));return{_stream:s,_control:{_stream:a}}},datalogic:{pre:t=>t,post:n=>{const r=Object.keys(e);["uri"].filter(t=>r.includes(t)),e.margin&&Object.keys(e.margin),e.fieldwidth&&Object.keys(e.fieldwidth);return hg({element:{nodeuuid:t[lg.REFNODE],type:"mediaplayer",componentdata:{uri:t[lg.mediaplayer.URI],...t[lg.RTCONTEXT]}}},"screenio")}}}},ns=wn("error",{type:"critical",message:"LEAF core error: race condition detected in prompt.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/prompt.js"},{}),rs=t=>{const e=t[lg.LAMBDA_OBJ],n="uidefs"in e&&"_default"in e.uidefs?e.uidefs._default:void 0,r=("margin"in e&&"_default"in e.margin&&e.margin._default,"fieldwidth"in e&&"_default"in e.fieldwidth&&e.fieldwidth._default,new Pt),i={codebase:"ghostos/api/parser/nodelogic/elements/library/prompt.js",refnode:t[lg.REFNODE]};return{elementio$:r,leaflogic:(o,s)=>{const a=new Pt,u=n?p_(s,o,void 0,i,{leaflogic:n,datalogic:{post:e=>(t[lg.prompt.UIDEFS]=e,e)}}):{_stream:ln('[ ; an open square bracket [ denotes the beginning of a list, followed by a matching \n ; close square bracket ] appearing at the end of this page. you can bring your blinking cursor\n ; to one of the brackets and type Shift-5 (or %) to jump the cursor in between a pair of matching brackets. \n ; please give it a go, it is a fun way to read any text written in LEAFlisp. \n ; other helpful command keys to help you navigate LEAFlisp include h j k l with which the blinking cursor\n ; can be moved to the left, down, up and right respectively. Also useful are w b respectively used to command\n ; the cursor to move forward and backward by one word along the line. Shift-v can be used to select one line,\n ; v to select from where the cursor currently is and navigating away from the initial cursor point by using\n ; any mix of the navigation command keys, namely h j k l w and b would allow you to select any range of text of interest.\n ; at which point you could either copy, delete and/or paste the selected text by respectively pressing y, d and p\n ; pressing u would undo the changes you have made going back in time one change by one change as you repeat u in a series. \n ; Ctrl-r would redo what had been undone. \n ; using the command keys would require the editor to be in the "command" mode. pressing the escape key would put the editor \n ; in the "command" mode, while pressing i would put the editor in the "edit" mode in which none of the navigation keys\n ; would work as navigation commands but as entering respective alphabets instead. \n ; \n {\n :prompt "setting"\n :backgroundColor "primary.light" \n ; "primary.dark" | "secondary.light" "secondary.dark"\n :margin "1" \n ; please note that any positive number in between quotes is accepted here. \n ; the recommended value however would range from 0 to 20 in almost all general \n ; usage scenarios where 0 to 5 whould perhaps comprise about 90% of the cases. \n :fieldWidth "45ch" \n ; ch is a unit length represented in terms of the width of the letter 0 (zero).\n ; so "15ch" would result in the width as wide as 15 zeros for all the text inputs below. \n ; please refer to the following site for units in html/css lingo, if you have all the time in the world.\n ; https://www.w3schools.com/cssref/css_units.asp for units\n :buttonWidth "20ch"\n ; likewise, buttonWidth specifies the width of all the buttons declared below. \n }\n {\n :prompt "text"\n :key "maintext1" ; :key is a user-defined string value, that should be unique within the context of the UI definition.\n :label "LEAF newsletter mailing list" ; a user-defined string label to be displayed on the text input.\n :variant "outlined" ; a text :variant with a choice of "standard", "outlined", or "filled" as its style.\n :multiline true\n :rows "2"\n :InputProps {:readOnly true}\n :defaultValue "Please fill out the info and subscribe to the mailing list."\n }\n {\n :prompt "text"\n ;:key (get (get (get (get uinodes 1) :meta) :label) :id) ; :key is a user-defined string value, that should be unique within the context of the UI definition.\n :key "name" ; :key is a user-defined string value, that should be unique within the context of the UI definition.\n ;:id (get (get (get (get uinodes 1) :meta) :label) :id)\n :fieldWidth "25ch" \n :required true ;true\n :group 1\n :label "Your name" ;(get (get (get (get uinodes 1) :meta) :label) :text); a user-defined string label to be displayed on the text input.\n :variant "standard" ; a text :variant with a choice of "standard", "outlined", or "filled" as its style.\n }\n {\n :prompt "text"\n :key "email"\n :fieldWidth "25ch" \n :required true\n :label "Your email"\n :type "email"\n :variant "standard"\n }\n { \n :prompt "button"\n :color "secondary" \n ; the value can be of "primary", "secondary", "error", "warning", "info", "success"\n :variant "outlined"\n ; the value can be of "text", "contained", "outlined"\n :key "subscribebtn"\n ; :href "/editor/breezyforest/main"\n ; :href can support a relative path\n :label "Subscribe"\n }\n ]'),_control:{_stream:s._stream}};const c=u._control._stream.pipe(Nt(u._stream),It(n=>{const i=n[1];t[lg.CTRLIN]=n[0];const o=Object.keys(e),s=(["uidefs","margin","fieldwidth"].filter(t=>o.includes(t)),e.margin?Object.keys(e.margin):void 0),a=e.fieldwidth?Object.keys(e.fieldwidth):void 0,u=nn(i)&&"error"===i._bname?void 0:Array.isArray(i)?hg({element:{nodeuuid:t[lg.REFNODE],type:"prompt",componentdata:{nodeuuid:t[lg.REFNODE],uidefs:i,margin:s?s[0]:1,fieldwidth:a?a[0]:"25ch",...t[lg.RTCONTEXT]}}},"screenio"):void 0;return u?Bt(ln(u),r):r}),V(e=>(a.next(e),t[lg.CTRLIN])),Lt());return{_stream:a.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(ns)),V(t=>t),Lt()),_control:{_stream:c.pipe(V(t=>t),Lt())}}},datalogic:{pre:t=>t,post:t=>t}}},is=wn("error",{type:"critical",message:"LEAF core error: race condition detected in popup.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/popup.js"},{}),os=t=>{const e=t[lg.LAMBDA_OBJ],n=new Pt,r=new Pt;return{elementio$:r,leaflogic:(i,o)=>{const s=o._stream.pipe(Nt(...i.map(t=>t._stream)),It(t=>Et(new qt(t[0]),Bt(new qt(t[1]),r))),It(i=>{const o=i[1],s=Object.keys(e),a=["headless","jester","top","tt","bottom","bb","left","ll","right","rr","topleft","ttll","topright","ttrr","bottomleft","bbll","bottomright","bbrr","center","centre"].filter(t=>s.includes(t)),u=a.length>0?a[0]:void 0,c=[o].flat().map(n=>{if(nn(n)){if("screenio"===n._bname){const i=xn("screenio",n);return hg({element:{nodeuuid:t[lg.REFNODE],type:"popup",componentdata:{poprect:u,headless:"headless"in e,ismenu:"jester"in e,unmountCallback:async()=>{const n="onclose"in e&&"_default"in e.onclose?e.onclose._default:void 0,i=n?await a_(n,[],{...t[lg.RTCONTEXT]._config}):[];return r.next(wn("elementio",{element:"popup",nodeuuid:t[lg.REFNODE],io:{onclose:i}})),i},children:Array.isArray(i)?i:[i],...t[lg.RTCONTEXT]}}},"screenio")}return"elementio"===n._bname?n:void 0}}).filter(t=>t);return c.length>1?n.next(c):1===c.length&&n.next(c[0]),ln(i[0])}));return{_stream:n.pipe($t(t=>JSON.stringify(t)!==JSON.stringify(is)),V(t=>t)),_control:{_stream:s}}},datalogic:{pre:t=>t,post:t=>t}}},ss=wn("error",{type:"critical",message:"LEAF core error: race condition detected in editor.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/editor.js"},{}),as=t=>{const e=t[lg.LAMBDA_OBJ];"uidefs"in e&&"_default"in e.uidefs&&e.uidefs._default,"margin"in e&&"_default"in e.margin&&e.margin._default,"fieldwidth"in e&&"_default"in e.fieldwidth&&e.fieldwidth._default;return{leaflogic:(e,n)=>{const r=new qt(ss),i=n._stream.pipe(hn(n=>{t[lg.CTRLIN]=n;return Et([...e.map(t=>t._stream)])}),V(e=>(e.length>1?r.next(e):1===e.length&&r.next(e[0]),t[lg.CTRLIN])));return{_stream:r,_control:{_stream:i}}},datalogic:{pre:t=>t,post:n=>{const r=Object.keys(e),i=["top","bottom","left","right","topleft","topright","bottomleft","bottomright","center","centre"].filter(t=>r.includes(t));i.length>0&&i[0];let o=n;o=1===o.length?o[0]:o;return hg({element:{nodeuuid:t[lg.REFNODE],type:"editor",componentdata:{domain:t[lg.DOMAIN],appid:t[lg.APPID],...t[lg.RTCONTEXT]}}},"screenio")}}}},us=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in text.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/text.js"},{}),t=>{const e=t[lg.LAMBDA_OBJ];return{leaflogic:(t,e)=>{const n=new Pt,r=e._stream.pipe(Nt(...t.map(t=>t._stream)),V(t=>{const e=t[1];return n.next(e),t[0]}));return{_stream:n,_control:{_stream:r}}},datalogic:{pre:t=>t,post:n=>{const r=Object.keys(e),i=(["lambda","onsave","gspot"].filter(t=>r.includes(t)),"lambda"in e?"lambda":"dataflow");let o;nn(n)&&n._content?._provenance?.refnodedata?(t[lg.RTCONTEXT].lambdarefnodedata=n._content?._provenance?.refnodedata,t[lg.RTCONTEXT].lambdasourceuuid=n._content?._refnode,o=n):o=n;return hg({element:{nodeuuid:t[lg.REFNODE],type:"text",componentdata:{refnode:t[lg.REFNODE],textsource:i,lambdarefnodedata:t[lg.RTCONTEXT].lambdarefnodedata,lambdasourceuuid:t[lg.RTCONTEXT].lambdasourceuuid,dataflowinput:o,domain:t[lg.DOMAIN],appid:t[lg.APPID],...t[lg.RTCONTEXT]}}},"screenio")}}}}),cs=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in image.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/image.js"},{}),t=>{const e=t[lg.LAMBDA_OBJ];return{leaflogic:(e,n)=>{const r=new Pt,i=n._stream.pipe(Nt(...e.map(t=>t._stream)),V(e=>{t[lg.CTRLIN]=e[0];const n=e[1];return r.next(n),e[0]}));return{_stream:r,_control:{_stream:i}}},datalogic:{pre:t=>{const e=[t].flat().map(t=>{if(nn(t)&&"image"===t._bname)return xn("image",t)}).filter(t=>t);return 1===e.length?e[0]:e.length>1?e:void 0},post:n=>{const r=Object.keys(e);["onclose"].filter(t=>r.includes(t)),"onclose"in e&&e.onclose;return hg({element:{nodeuuid:t[lg.REFNODE],type:"image",componentdata:{imagelist:Array.isArray(n)?n:[n],...t[lg.RTCONTEXT]}}},"screenio")}}}});function ls(t){return g(function(e,n){try{e.subscribe(n)}finally{n.add(t)}})}wn("error",{type:"critical",message:"LEAF core error: race condition detected in mediainput.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/mediainput.js"},{});const hs=t=>{const e=t[lg.LAMBDA_OBJ],n=("uidefs"in e&&"_default"in e.uidefs&&e.uidefs._default,"margin"in e&&"_default"in e.margin&&e.margin._default,"fieldwidth"in e&&"_default"in e.fieldwidth&&e.fieldwidth._default,new Pt);return{elementio$:n,leaflogic:(r,i)=>{const o=new Pt,s=i._stream.pipe(Nt(...r.map(t=>t._stream)),It(r=>{t[lg.CTRLIN]=r[0];const i=r[1],o=Object.keys(e),s=["image","audio","video"].filter(t=>o.includes(t)),a=s.length>0?s[0]:"image";let u=i;u=1===u.length?u[0]:u;const c=Array.isArray(u)?u:[u],l=hg({element:{nodeuuid:t[lg.REFNODE],type:"mediainput",componentdata:{mediatype:a,nodeinput:c,callbacks:{onDropAccepted:async r=>{const i=e.ondrop?._default?await a_(e.ondrop._default,[wn("elementinput",r),wn("nodeinput",c)],{},t[lg.REFNODE]):void 0,o=wn("elementio",i);n.next(o)}}}}},"screenio");return l?Bt(new qt(l),n):n}),It(e=>(o.next(e),new qt(t[lg.CTRLIN]))),Lt());return{_stream:o.pipe(V(t=>t),ls(()=>{}),Lt()),_control:{_stream:s.pipe(V(t=>t),ls(()=>{}),Lt())}}},datalogic:{pre:t=>t,post:t=>{let e=t;return e=1===e.length?e[0]:e,e}}}};var ds=n(7799);const{JZZ:ps}=ds,fs=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in midi.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/midi.js"},{}),t=>{const e=t[lg.LAMBDA_OBJ],n=new Pt;let r=-1;const i=t=>{if(r=(r+1)%24,0===r){}const[e,i,o,s]=t;n.next(wn("_midi_in",{cmd:e,noteNumber:i,velocity:o},{timestamp:Date.now()}))},o={};return{leaflogic:(e,r)=>{const s=new Pt,a=r._stream.pipe(It(r=>{t[lg.CTRLIN]=r,"default"in o||(o.default=ps().openMidiIn().or("Error: Cannot open MIDI In port").and(t=>{}).connect(i));return Bt(...e.map(t=>t._stream),n)}),V(e=>{!Array.isArray(e)&&e._bname;const n=(Array.isArray(e)?e:[e]).map(t=>"_data_in"===t._bname?on(t._content)?void 0:xn("*",t):nn(t)?t:void 0).filter(t=>t);return n.length>0&&s.next(n),t[lg.CTRLIN]}),Lt());return{_stream:s,_control:{_stream:a}}},datalogic:{pre:t=>wn("_data_in",t),post:t=>{const n=Object.keys(e),r=["image","audio","video"].filter(t=>n.includes(t));r.length>0&&r[0];let i=t;i=1===i.length?i[0]:i;return i}}}});function ms(t){return Math.pow(2,t/12)}let gs=440;function _s(t){return Math.round(ys(t))}function ys(t){return 69+12*Math.log2(t/gs)}function vs(t){return gs*Math.pow(2,(t-69)/12)}var bs=n(1795);const ws=new WeakSet,xs=new WeakMap,Ts=new WeakMap,ks=new WeakMap,Ss=new WeakMap,As=new WeakMap,Es=new WeakMap,Os=new WeakMap,Cs=new WeakMap,Ms=new WeakMap,Ns={construct:()=>Ns},Is=/^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/,js=(t,e)=>{const n=[];let r=t.replace(/^[\s]+/,""),i=r.match(Is);for(;null!==i;){const t=i[1].slice(1,-1),o=i[0].replace(/([\s]+)?;?$/,"").replace(t,new URL(t,e).toString());n.push(o),r=r.slice(i[0].length).replace(/^[\s]+/,""),i=r.match(Is)}return[n.join(";"),r]},Rs=t=>{if(void 0!==t&&!Array.isArray(t))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},Ps=t=>{if(!(t=>{try{new new Proxy(t,Ns)}catch{return!1}return!0})(t))throw new TypeError("The given value for processorCtor should be a constructor.");if(null===t.prototype||"object"!=typeof t.prototype)throw new TypeError("The given value for processorCtor should have a prototype.")},Ds=(t,e)=>{const n=t.get(e);if(void 0===n)throw new Error("A value with the given key could not be found.");return n},Ls=(t,e)=>{const n=Array.from(t).filter(e);if(n.length>1)throw Error("More than one element was found.");if(0===n.length)throw Error("No element was found.");const[r]=n;return t.delete(r),r},Fs=(t,e,n,r)=>{const i=Ds(t,e),o=Ls(i,t=>t[0]===n&&t[1]===r);return 0===i.size&&t.delete(e),o},$s=t=>Ds(Es,t),Bs=t=>{if(ws.has(t))throw new Error("The AudioNode is already stored.");ws.add(t),$s(t).forEach(t=>t(!0))},qs=t=>"port"in t,Us=t=>{if(!ws.has(t))throw new Error("The AudioNode is not stored.");ws.delete(t),$s(t).forEach(t=>t(!1))},Vs=(t,e)=>{!qs(t)&&e.every(t=>0===t.size)&&Us(t)},Gs={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},zs=(t,e)=>t.context===e,Ws=t=>{try{t.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},Js=()=>new DOMException("","IndexSizeError"),Hs=t=>{var e;t.getChannelData=(e=t.getChannelData,n=>{try{return e.call(t,n)}catch(t){if(12===t.code)throw Js();throw t}})},Xs={numberOfChannels:1},Ks=-34028234663852886e22,Qs=-Ks,Zs=t=>ws.has(t),Ys={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},ta=t=>Ds(xs,t),ea=t=>Ds(ks,t),na=(t,e)=>{const{activeInputs:n}=ta(t);n.forEach(n=>n.forEach(([n])=>{e.includes(t)||na(n,[...e,t])}));const r=(t=>"playbackRate"in t)(t)?[t.playbackRate]:qs(t)?Array.from(t.parameters.values()):(t=>"frequency"in t&&"gain"in t)(t)?[t.Q,t.detune,t.frequency,t.gain]:(t=>"offset"in t)(t)?[t.offset]:(t=>!("frequency"in t)&&"gain"in t)(t)?[t.gain]:(t=>"detune"in t&&"frequency"in t&&!("gain"in t))(t)?[t.detune,t.frequency]:(t=>"pan"in t)(t)?[t.pan]:[];for(const t of r){const n=ea(t);void 0!==n&&n.activeInputs.forEach(([t])=>na(t,e))}Zs(t)&&Us(t)},ra=t=>{na(t.destination,[])},ia=t=>void 0===t||"number"==typeof t||"string"==typeof t&&("balanced"===t||"interactive"===t||"playback"===t),oa=t=>"context"in t,sa=t=>oa(t[0]),aa=(t,e,n,r)=>{for(const e of t)if(n(e)){if(r)return!1;throw Error("The set contains at least one similar element.")}return t.add(e),!0},ua=(t,e,[n,r],i)=>{aa(t,[e,n,r],t=>t[0]===e&&t[1]===n,i)},ca=(t,[e,n,r],i)=>{const o=t.get(e);void 0===o?t.set(e,new Set([[n,r]])):aa(o,[n,r],t=>t[0]===n,i)},la=t=>"inputs"in t,ha=(t,e,n,r)=>{if(la(e)){const i=e.inputs[r];return t.connect(i,n,0),[i,n,0]}return t.connect(e,n,r),[e,n,r]},da=(t,e,n)=>{for(const r of t)if(r[0]===e&&r[1]===n)return t.delete(r),r;return null},pa=(t,e)=>{if(!$s(t).delete(e))throw new Error("Missing the expected event listener.")},fa=(t,e,n)=>{const r=Ds(t,e),i=Ls(r,t=>t[0]===n);return 0===r.size&&t.delete(e),i},ma=(t,e,n,r)=>{la(e)?t.disconnect(e.inputs[r],n,0):t.disconnect(e,n,r)},ga=t=>Ds(Ts,t),_a=t=>Ds(Ss,t),ya=t=>Os.has(t),va=t=>!ws.has(t),ba=(t,e)=>new Promise(n=>{if(null!==e)n(!0);else{const e=t.createScriptProcessor(256,1,1),r=t.createGain(),i=t.createBuffer(1,2,44100),o=i.getChannelData(0);o[0]=1,o[1]=1;const s=t.createBufferSource();s.buffer=i,s.loop=!0,s.connect(e).connect(t.destination),s.connect(r),s.disconnect(r),e.onaudioprocess=r=>{const i=r.inputBuffer.getChannelData(0);Array.prototype.some.call(i,t=>1===t)?n(!0):n(!1),s.stop(),e.onaudioprocess=null,s.disconnect(e),e.disconnect(t.destination)},s.start()}}),wa=(t,e)=>{const n=new Map;for(const e of t)for(const t of e){const e=n.get(t);n.set(t,void 0===e?1:e+1)}n.forEach((t,n)=>e(n,t))},xa=t=>"context"in t,Ta=t=>{const e=new Map;t.connect=(t=>(n,r=0,i=0)=>{const o=xa(n)?t(n,r,i):t(n,r),s=e.get(n);return void 0===s?e.set(n,[{input:i,output:r}]):s.every(t=>t.input!==i||t.output!==r)&&s.push({input:i,output:r}),o})(t.connect.bind(t)),t.disconnect=(n=>(r,i,o)=>{if(n.apply(t),void 0===r)e.clear();else if("number"==typeof r)for(const[t,n]of e){const i=n.filter(t=>t.output!==r);0===i.length?e.delete(t):e.set(t,i)}else if(e.has(r))if(void 0===i)e.delete(r);else{const t=e.get(r);if(void 0!==t){const n=t.filter(t=>t.output!==i&&(t.input!==o||void 0===o));0===n.length?e.delete(r):e.set(r,n)}}for(const[n,r]of e)r.forEach(e=>{xa(n)?t.connect(n,e.output,e.input):t.connect(n,e.output)})})(t.disconnect)},ka=(t,e,n,r)=>{const{activeInputs:i,passiveInputs:o}=ea(e),{outputs:s}=ta(t),a=$s(t),u=s=>{const a=ga(t),u=_a(e);if(s){const e=fa(o,t,n);ua(i,t,e,!1),r||ya(t)||a.connect(u,n)}else{const e=((t,e,n)=>Ls(t,t=>t[0]===e&&t[1]===n))(i,t,n);ca(o,e,!1),r||ya(t)||a.disconnect(u,n)}};return!!aa(s,[e,n],t=>t[0]===e&&t[1]===n,!0)&&(a.add(u),Zs(t)?ua(i,t,[n,u],!0):ca(o,[t,n,u],!0),!0)},Sa=(t,e,n,r,i)=>{const[o,s]=((t,e,n,r)=>{const{activeInputs:i,passiveInputs:o}=ta(e),s=da(i[r],t,n);if(null===s)return[Fs(o,t,n,r)[2],!1];return[s[2],!0]})(t,n,r,i);if(null!==o&&(pa(t,o),!s||e||ya(t)||ma(ga(t),ga(n),r,i)),Zs(n)){const{activeInputs:t}=ta(n);Vs(n,t)}},Aa=(t,e,n,r)=>{const[i,o]=((t,e,n)=>{const{activeInputs:r,passiveInputs:i}=ea(e),o=da(r,t,n);if(null===o)return[fa(i,t,n)[1],!1];return[o[2],!0]})(t,n,r);null!==i&&(pa(t,i),!o||e||ya(t)||ga(t).disconnect(_a(n),r))};class Ea{constructor(t){this._map=new Map(t)}get size(){return this._map.size}entries(){return this._map.entries()}forEach(t,e=null){return this._map.forEach((n,r)=>t.call(e,n,r,this))}get(t){return this._map.get(t)}has(t){return this._map.has(t)}keys(){return this._map.keys()}values(){return this._map.values()}}const Oa={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}};function Ca(t,e,n,r,i){if("function"==typeof t.copyFromChannel)0===e[n].byteLength&&(e[n]=new Float32Array(128)),t.copyFromChannel(e[n],r,i);else{const o=t.getChannelData(r);if(0===e[n].byteLength)e[n]=o.slice(i,i+128);else{const t=new Float32Array(o.buffer,i*Float32Array.BYTES_PER_ELEMENT,128);e[n].set(t)}}}const Ma=(t,e,n,r,i)=>{"function"==typeof t.copyToChannel?0!==e[n].byteLength&&t.copyToChannel(e[n],r,i):0!==e[n].byteLength&&t.getChannelData(r).set(e[n],i)},Na=(t,e)=>{const n=[];for(let r=0;r<t;r+=1){const t=[],i="number"==typeof e?e:e[r];for(let e=0;e<i;e+=1)t.push(new Float32Array(128));n.push(t)}return n},Ia=async(t,e,n,r,i,o,s)=>{const a=null===e?128*Math.ceil(t.context.length/128):e.length,u=r.channelCount*r.numberOfInputs,c=i.reduce((t,e)=>t+e,0),l=0===c?null:n.createBuffer(c,a,n.sampleRate);if(void 0===o)throw new Error("Missing the processor constructor.");const h=ta(t),d=await((t,e)=>{const n=Ds(Ms,t),r=ga(e);return Ds(n,r)})(n,t),p=Na(r.numberOfInputs,r.channelCount),f=Na(r.numberOfOutputs,i),m=Array.from(t.parameters.keys()).reduce((t,e)=>({...t,[e]:new Float32Array(128)}),{});for(let c=0;c<a;c+=128){if(r.numberOfInputs>0&&null!==e)for(let t=0;t<r.numberOfInputs;t+=1)for(let n=0;n<r.channelCount;n+=1)Ca(e,p[t],n,n,c);void 0!==o.parameterDescriptors&&null!==e&&o.parameterDescriptors.forEach(({name:t},n)=>{Ca(e,m,t,u+n,c)});for(let t=0;t<r.numberOfInputs;t+=1)for(let e=0;e<i[t];e+=1)0===f[t][e].byteLength&&(f[t][e]=new Float32Array(128));try{const t=p.map((t,e)=>0===h.activeInputs[e].size?[]:t),e=s(c/n.sampleRate,n.sampleRate,()=>d.process(t,f,m));if(null!==l)for(let t=0,e=0;t<r.numberOfOutputs;t+=1){for(let n=0;n<i[t];n+=1)Ma(l,f[t],n,e+n,c);e+=i[t]}if(!e)break}catch(e){t.dispatchEvent(new ErrorEvent("processorerror",{colno:e.colno,filename:e.filename,lineno:e.lineno,message:e.message}));break}}return l},ja={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},Ra={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},Pa={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},Da={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},La={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},Fa=t=>{const{port1:e,port2:n}=new MessageChannel;return new Promise(r=>{const i=()=>{n.onmessage=null,e.close(),n.close(),r()};n.onmessage=()=>i();try{e.postMessage(t,[t])}catch{}finally{i()}})},$a={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},Ba=(t,e,n)=>{const r=e[n];if(void 0===r)throw t();return r},qa={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},Ua={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},Va=()=>new DOMException("","InvalidStateError"),Ga=()=>new DOMException("","InvalidAccessError"),za={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},Wa=(t,e,n,r,i,o,s,a,u,c,l)=>{const h=c.length;let d=a;for(let a=0;a<h;a+=1){let h=n[0]*c[a];for(let e=1;e<i;e+=1){const r=d-e&u-1;h+=n[e]*o[r],h-=t[e]*s[r]}for(let t=i;t<r;t+=1)h+=n[t]*o[d-t&u-1];for(let n=i;n<e;n+=1)h-=t[n]*s[d-n&u-1];o[d]=c[a],s[d]=h,d=d+1&u-1,l[a]=h}return d},Ja={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},Ha=t=>{const e=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{const n=t.decodeAudioData(e.buffer,()=>{});return void 0!==n&&(n.catch(()=>{}),!0)}catch{}return!1},Xa={numberOfChannels:1},Ka=(t,e,n)=>{const r=e[n];void 0!==r&&r!==t[n]&&(t[n]=r)},Qa=(t,e)=>{Ka(t,e,"channelCount"),Ka(t,e,"channelCountMode"),Ka(t,e,"channelInterpretation")},Za=t=>"function"==typeof t.getFloatTimeDomainData,Ya=(t,e,n)=>{const r=e[n];void 0!==r&&r!==t[n].value&&(t[n].value=r)},tu=t=>{t.start=(e=>(n=0,r=0,i)=>{if("number"==typeof i&&i<0||r<0||n<0)throw new RangeError("The parameters can't be negative.");e.call(t,n,r,i)})(t.start)},eu=t=>{var e;t.stop=(e=t.stop,(n=0)=>{if(n<0)throw new RangeError("The parameter can't be negative.");e.call(t,n)})},nu=(t,e)=>null===t?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(t*e))))),ru=async(t,e)=>{const n=await(t=>new Promise((e,n)=>{const{port1:r,port2:i}=new MessageChannel;r.onmessage=({data:t})=>{r.close(),i.close(),e(t)},r.onmessageerror=({data:t})=>{r.close(),i.close(),n(t)},i.postMessage(t)}))(e);return new t(n)},iu=(t,e)=>{const n=t.createBiquadFilter();return Qa(n,e),Ya(n,e,"Q"),Ya(n,e,"detune"),Ya(n,e,"frequency"),Ya(n,e,"gain"),Ka(n,e,"type"),n},ou=(t,e)=>{const n=t.createChannelSplitter(e.numberOfOutputs);return Qa(n,e),(t=>{const e=t.numberOfOutputs;Object.defineProperty(t,"channelCount",{get:()=>e,set:t=>{if(t!==e)throw Va()}}),Object.defineProperty(t,"channelCountMode",{get:()=>"explicit",set:t=>{if("explicit"!==t)throw Va()}}),Object.defineProperty(t,"channelInterpretation",{get:()=>"discrete",set:t=>{if("discrete"!==t)throw Va()}})})(n),n},su=(t,e)=>(t.connect=e.connect.bind(e),t.disconnect=e.disconnect.bind(e),t),au=(t,e)=>{const n=t.createDelay(e.maxDelayTime);return Qa(n,e),Ya(n,e,"delayTime"),n},uu=(t,e)=>{const n=t.createGain();return Qa(n,e),Ya(n,e,"gain"),n};function cu(t,e){const n=e[0]*e[0]+e[1]*e[1];return[(t[0]*e[0]+t[1]*e[1])/n,(t[1]*e[0]-t[0]*e[1])/n]}function lu(t,e){return[t[0]*e[0]-t[1]*e[1],t[0]*e[1]+t[1]*e[0]]}function hu(t,e){let n=[0,0];for(let r=t.length-1;r>=0;r-=1)n=lu(n,e),n[0]+=t[r];return n}const du=(t,e,n,r)=>t.createScriptProcessor(e,n,r),pu=()=>new DOMException("","NotSupportedError"),fu={numberOfChannels:1},mu={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},gu={channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0,distanceModel:"inverse",maxDistance:1e4,orientationX:1,orientationY:0,orientationZ:0,panningModel:"equalpower",positionX:0,positionY:0,positionZ:0,refDistance:1,rolloffFactor:1},_u={disableNormalization:!1},yu={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},vu=()=>new DOMException("","UnknownError"),bu={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},wu=(t,e,n)=>void 0===t.copyFromChannel?t.getChannelData(n)[0]:(t.copyFromChannel(e,n),e[0]),xu=t=>{if(null===t)return!1;const e=t.length;return e%2!=0?0!==t[Math.floor(e/2)]:t[e/2-1]+t[e/2]!==0},Tu=(t,e,n,r)=>{let i=t;for(;!i.hasOwnProperty(e);)i=Object.getPrototypeOf(i);const{get:o,set:s}=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(t,e,{get:n(o),set:r(s)})},ku=(t,e,n)=>{try{t.setValueAtTime(e,n)}catch(r){if(9!==r.code)throw r;ku(t,e,n+1e-7)}},Su=t=>{const e=t.createOscillator();try{e.start(-1)}catch(t){return t instanceof RangeError}return!1},Au=t=>{const e=t.createBuffer(1,1,44100),n=t.createBufferSource();n.buffer=e,n.start(),n.stop();try{return n.stop(),!0}catch{return!1}},Eu=t=>{const e=t.createOscillator();try{e.stop(-1)}catch(t){return t instanceof RangeError}return!1},Ou=(t,e)=>{const n=e.createGain();t.connect(n);const r=(e=>()=>{e.call(t,n),t.removeEventListener("ended",r)})(t.disconnect);t.addEventListener("ended",r),su(t,n),t.stop=(e=>{let r=!1;return(i=0)=>{if(r)try{e.call(t,i)}catch{n.gain.setValueAtTime(0,i)}else e.call(t,i),r=!0}})(t.stop)},Cu=(t,e)=>n=>{const r={value:t};return Object.defineProperties(n,{currentTarget:r,target:r}),"function"==typeof e?e.call(t,n):e.handleEvent.call(t,n)};const Mu=(t=>(e,n,[r,i,o],s)=>{t(e[i],[n,r,o],t=>t[0]===n&&t[1]===r,s)})(aa),Nu=(t=>(e,n,[r,i,o],s)=>{const a=e.get(r);void 0===a?e.set(r,new Set([[i,n,o]])):t(a,[i,n,o],t=>t[0]===i&&t[1]===n,s)})(aa),Iu=(t=>(e,n,r,i)=>t(e[i],t=>t[0]===n&&t[1]===r))(Ls),ju=new WeakMap,Ru=(t=>e=>{var n;return null!==(n=t.get(e))&&void 0!==n?n:0})(ju),Pu=(Du=new Map,Lu=new WeakMap,(t,e)=>{const n=Lu.get(t);if(void 0!==n)return n;const r=Du.get(t);if(void 0!==r)return r;try{const n=e();return n instanceof Promise?(Du.set(t,n),n.catch(()=>!1).then(e=>(Du.delete(t),Lu.set(t,e),e))):(Lu.set(t,n),n)}catch{return Lu.set(t,!1),!1}});var Du,Lu;const Fu="undefined"==typeof window?null:window,$u=((t,e)=>(n,r)=>{const i=n.createAnalyser();if(Qa(i,r),!(r.maxDecibels>r.minDecibels))throw e();return Ka(i,r,"fftSize"),Ka(i,r,"maxDecibels"),Ka(i,r,"minDecibels"),Ka(i,r,"smoothingTimeConstant"),t(Za,()=>Za(i))||(t=>{t.getFloatTimeDomainData=e=>{const n=new Uint8Array(e.length);t.getByteTimeDomainData(n);const r=Math.max(n.length,t.fftSize);for(let t=0;t<r;t+=1)e[t]=.0078125*(n[t]-128);return e}})(i),i})(Pu,Js),Bu=(t=>e=>{const n=t(e);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioNode in the audio graph.");return n.renderer})(ta),qu=((t,e,n)=>async(r,i,o)=>{const s=t(r);await Promise.all(s.activeInputs.map((t,s)=>Array.from(t).map(async([t,a])=>{const u=e(t),c=await u.render(t,i),l=r.context.destination;n(t)||r===l&&n(r)||c.connect(o,a,s)})).reduce((t,e)=>[...t,...e],[]))})(ta,Bu,ya),Uu=((t,e,n)=>()=>{const r=new WeakMap;return{render(i,o){const s=r.get(o);return void 0!==s?Promise.resolve(s):(async(i,o)=>{let s=e(i);if(!zs(s,o)){const e={channelCount:s.channelCount,channelCountMode:s.channelCountMode,channelInterpretation:s.channelInterpretation,fftSize:s.fftSize,maxDecibels:s.maxDecibels,minDecibels:s.minDecibels,smoothingTimeConstant:s.smoothingTimeConstant};s=t(o,e)}return r.set(o,s),await n(i,o,s),s})(i,o)}}})($u,ga,qu),Vu=(Gu=As,t=>{const e=Gu.get(t);if(void 0===e)throw Va();return e});var Gu;const zu=(t=>null===t?null:t.hasOwnProperty("OfflineAudioContext")?t.OfflineAudioContext:t.hasOwnProperty("webkitOfflineAudioContext")?t.webkitOfflineAudioContext:null)(Fu),Wu=(t=>e=>null!==t&&e instanceof t)(zu),Ju=new WeakMap,Hu=(t=>class{constructor(t){this._nativeEventTarget=t,this._listeners=new WeakMap}addEventListener(e,n,r){if(null!==n){let i=this._listeners.get(n);void 0===i&&(i=t(this,n),"function"==typeof n&&this._listeners.set(n,i)),this._nativeEventTarget.addEventListener(e,i,r)}}dispatchEvent(t){return this._nativeEventTarget.dispatchEvent(t)}removeEventListener(t,e,n){const r=null===e?void 0:this._listeners.get(e);this._nativeEventTarget.removeEventListener(t,void 0===r?null:r,n)}})(Cu),Xu=(t=>null===t?null:t.hasOwnProperty("AudioContext")?t.AudioContext:t.hasOwnProperty("webkitAudioContext")?t.webkitAudioContext:null)(Fu),Ku=(t=>e=>null!==t&&e instanceof t)(Xu),Qu=(t=>e=>null!==t&&"function"==typeof t.AudioNode&&e instanceof t.AudioNode)(Fu),Zu=(t=>e=>null!==t&&"function"==typeof t.AudioParam&&e instanceof t.AudioParam)(Fu),Yu=(t=>null===t?null:t.hasOwnProperty("AudioWorkletNode")?t.AudioWorkletNode:null)(Fu),tc=((t,e,n,r,i,o,s,a,u,c,l,h,d,p,f,m)=>class extends c{constructor(e,r,i,o){super(i),this._context=e,this._nativeAudioNode=i;const s=l(e);h(s)&&!0!==n(ba,()=>ba(s,m))&&Ta(i),Ts.set(this,i),Es.set(this,new Set),"closed"!==e.state&&r&&Bs(this),t(this,o,i)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(t){this._nativeAudioNode.channelCount=t}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(t){this._nativeAudioNode.channelCountMode=t}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(t){this._nativeAudioNode.channelInterpretation=t}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(t,n=0,a=0){if(n<0||n>=this._nativeAudioNode.numberOfOutputs)throw i();const c=l(this._context),h=f(c);if(d(t)||p(t))throw o();if(oa(t)){const i=ga(t);try{const e=ha(this._nativeAudioNode,i,n,a),r=va(this);(h||r)&&this._nativeAudioNode.disconnect(...e),"closed"!==this.context.state&&!r&&va(t)&&Bs(t)}catch(t){if(12===t.code)throw o();throw t}if(e(this,t,n,a,h)){const e=u([this],t);wa(e,r(h))}return t}const m=_a(t);if("playbackRate"===m.name&&1024===m.maxValue)throw s();try{this._nativeAudioNode.connect(m,n),(h||va(this))&&this._nativeAudioNode.disconnect(m,n)}catch(t){if(12===t.code)throw o();throw t}if(ka(this,t,n,h)){const e=u([this],t);wa(e,r(h))}}disconnect(t,e,n){let r;const s=l(this._context),c=f(s);if(void 0===t)r=((t,e)=>{const n=ta(t),r=[];for(const i of n.outputs)sa(i)?Sa(t,e,...i):Aa(t,e,...i),r.push(i[0]);return n.outputs.clear(),r})(this,c);else if("number"==typeof t){if(t<0||t>=this.numberOfOutputs)throw i();r=((t,e,n)=>{const r=ta(t),i=[];for(const o of r.outputs)o[1]===n&&(sa(o)?Sa(t,e,...o):Aa(t,e,...o),i.push(o[0]),r.outputs.delete(o));return i})(this,c,t)}else{if(void 0!==e&&(e<0||e>=this.numberOfOutputs))throw i();if(oa(t)&&void 0!==n&&(n<0||n>=t.numberOfInputs))throw i();if(r=((t,e,n,r,i)=>{const o=ta(t);return Array.from(o.outputs).filter(t=>!(t[0]!==n||void 0!==r&&t[1]!==r||void 0!==i&&t[2]!==i)).map(n=>(sa(n)?Sa(t,e,...n):Aa(t,e,...n),o.outputs.delete(n),n[0]))})(this,c,t,e,n),0===r.length)throw o()}for(const t of r){const e=u([this],t);wa(e,a)}}})((ec=xs,(t,e,n)=>{const r=[];for(let t=0;t<n.numberOfInputs;t+=1)r.push(new Set);ec.set(t,{activeInputs:r,outputs:new Set,passiveInputs:new WeakMap,renderer:e})}),((t,e,n,r,i,o,s,a,u,c,l,h,d)=>{const p=new WeakMap;return(f,m,g,_,y)=>{const{activeInputs:v,passiveInputs:b}=o(m),{outputs:w}=o(f),x=a(f),T=o=>{const a=u(m),c=u(f);if(o){const e=Fs(b,f,g,_);t(v,f,e,!1),y||h(f)||n(c,a,g,_),d(m)&&Bs(m)}else{const t=r(v,f,g,_);e(b,_,t,!1),y||h(f)||i(c,a,g,_);const n=s(m);if(0===n)l(m)&&Vs(m,v);else{const t=p.get(m);void 0!==t&&clearTimeout(t),p.set(m,setTimeout(()=>{l(m)&&Vs(m,v)},1e3*n))}}};return!!c(w,[m,g,_],t=>t[0]===m&&t[1]===g&&t[2]===_,!0)&&(x.add(T),l(f)?t(v,f,[g,_,T],!0):e(b,_,[f,g,T],!0),!0)}})(Mu,Nu,ha,Iu,ma,ta,Ru,$s,ga,aa,Zs,ya,va),Pu,((t,e,n,r,i,o)=>s=>(a,u)=>{const c=t.get(a);if(void 0===c){if(!s&&o(a)){const t=r(a),{outputs:o}=n(a);for(const n of o)if(sa(n)){const i=r(n[0]);e(t,i,n[1],n[2])}else{const e=i(n[0]);t.disconnect(e,n[1])}}t.set(a,u)}else t.set(a,c+u)})(Os,ma,ta,ga,_a,Zs),Js,Ga,pu,((t,e,n,r,i,o,s,a)=>(u,c)=>{const l=e.get(u);if(void 0===l)throw new Error("Missing the expected cycle count.");const h=o(u.context),d=a(h);if(l===c){if(e.delete(u),!d&&s(u)){const e=r(u),{outputs:o}=n(u);for(const n of o)if(sa(n)){const i=r(n[0]);t(e,i,n[1],n[2])}else{const t=i(n[0]);e.connect(t,n[1])}}}else e.set(u,l-c)})(ha,Os,ta,ga,_a,Vu,Zs,Wu),((t,e,n)=>function r(i,o){const s=oa(o)?o:n(t,o);if((t=>"delayTime"in t)(s))return[];if(i[0]===s)return[i];if(i.includes(s))return[];const{outputs:a}=e(s);return Array.from(a).map(t=>r([...i,s],t[0])).reduce((t,e)=>t.concat(e),[])})(Ju,ta,Ds),Hu,Vu,Ku,Qu,Zu,Wu,Yu);var ec;const nc=((t,e,n,r,i,o)=>class extends t{constructor(t,n){const s=i(t),a={...Gs,...n},u=r(s,a);super(t,!1,u,o(s)?e():null),this._nativeAnalyserNode=u}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(t){this._nativeAnalyserNode.fftSize=t}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(t){const e=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=t,!(t>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=e,n()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(t){const e=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=t,!(this._nativeAnalyserNode.maxDecibels>t))throw this._nativeAnalyserNode.minDecibels=e,n()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(t){this._nativeAnalyserNode.smoothingTimeConstant=t}getByteFrequencyData(t){this._nativeAnalyserNode.getByteFrequencyData(t)}getByteTimeDomainData(t){this._nativeAnalyserNode.getByteTimeDomainData(t)}getFloatFrequencyData(t){this._nativeAnalyserNode.getFloatFrequencyData(t)}getFloatTimeDomainData(t){this._nativeAnalyserNode.getFloatTimeDomainData(t)}})(tc,Uu,Js,$u,Vu,Wu),rc=new WeakSet,ic=(t=>null===t?null:t.hasOwnProperty("AudioBuffer")?t.AudioBuffer:null)(Fu),oc=(sc=new Uint32Array(1),t=>(sc[0]=t,sc[0]));var sc;const ac=((t,e)=>n=>{n.copyFromChannel=(r,i,o=0)=>{const s=t(o),a=t(i);if(a>=n.numberOfChannels)throw e();const u=n.length,c=n.getChannelData(a),l=r.length;for(let t=s<0?-s:0;t+s<u&&t<l;t+=1)r[t]=c[t+s]},n.copyToChannel=(r,i,o=0)=>{const s=t(o),a=t(i);if(a>=n.numberOfChannels)throw e();const u=n.length,c=n.getChannelData(a),l=r.length;for(let t=s<0?-s:0;t+s<u&&t<l;t+=1)c[t+s]=r[t]}})(oc,Js),uc=(t=>e=>{e.copyFromChannel=(n=>(r,i,o=0)=>{const s=t(o),a=t(i);if(s<e.length)return n.call(e,r,a,s)})(e.copyFromChannel),e.copyToChannel=(n=>(r,i,o=0)=>{const s=t(o),a=t(i);if(s<e.length)return n.call(e,r,a,s)})(e.copyToChannel)})(oc),cc=((t,e,n,r,i,o,s,a)=>{let u=null;return class c{constructor(c){if(null===i)throw new Error("Missing the native OfflineAudioContext constructor.");const{length:l,numberOfChannels:h,sampleRate:d}={...Xs,...c};null===u&&(u=new i(1,1,44100));const p=null!==r&&e(o,o)?new r({length:l,numberOfChannels:h,sampleRate:d}):u.createBuffer(h,l,d);if(0===p.numberOfChannels)throw n();return"function"!=typeof p.copyFromChannel?(s(p),Hs(p)):e(Ws,()=>Ws(p))||a(p),t.add(p),p}static[Symbol.hasInstance](e){return null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===c.prototype||t.has(e)}}})(rc,Pu,pu,ic,zu,(t=>()=>{if(null===t)return!1;try{new t({length:1,sampleRate:44100})}catch{return!1}return!0})(ic),ac,uc),lc=(t=>(e,n)=>{const r=t(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});n.connect(r).connect(e.destination);const i=()=>{n.removeEventListener("ended",i),n.disconnect(r),r.disconnect()};n.addEventListener("ended",i)})(uu),hc=((t,e,n)=>async(r,i,o)=>{const s=e(r);await Promise.all(Array.from(s.activeInputs).map(async([e,r])=>{const s=t(e),a=await s.render(e,i);n(e)||a.connect(o,r)}))})(Bu,ea,ya),dc=(t=>(e,n,r)=>t(n,e,r))(hc),pc=((t,e,n,r,i,o,s,a,u,c,l)=>(h,d)=>{const p=h.createBufferSource();return Qa(p,d),Ya(p,d,"playbackRate"),Ka(p,d,"buffer"),Ka(p,d,"loop"),Ka(p,d,"loopEnd"),Ka(p,d,"loopStart"),e(n,()=>n(h))||(t=>{t.start=(e=>{let n=!1;return(r=0,i=0,o)=>{if(n)throw Va();e.call(t,r,i,o),n=!0}})(t.start)})(p),e(r,()=>r(h))||u(p),e(i,()=>i(h))||c(p,h),e(o,()=>o(h))||tu(p),e(s,()=>s(h))||l(p,h),e(a,()=>a(h))||eu(p),t(h,p),p})(lc,Pu,t=>{const e=t.createBufferSource();e.start();try{e.start()}catch{return!0}return!1},t=>{const e=t.createBufferSource(),n=t.createBuffer(1,1,44100);e.buffer=n;try{e.start(0,1)}catch{return!1}return!0},t=>{const e=t.createBufferSource();e.start();try{e.stop()}catch{return!1}return!0},Su,Au,Eu,t=>{t.start=(e=>(n=0,r=0,i)=>{const o=t.buffer,s=null===o?r:Math.min(o.duration,r);null!==o&&s>o.duration-.5/t.context.sampleRate?e.call(t,n,0,0):e.call(t,n,s,i)})(t.start)},(t=>(e,n)=>{const r=n.createBuffer(1,1,44100);null===e.buffer&&(e.buffer=r),t(e,"buffer",t=>()=>{const n=t.call(e);return n===r?null:n},t=>n=>t.call(e,null===n?r:n))})(Tu),Ou),fc=((t,e)=>(n,r,i)=>(t(r).replay(i),e(r,n,i)))((t=>e=>{const n=t(e);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioParam in the audio graph.");return n.renderer})(ea),hc),mc=((t,e,n,r,i)=>()=>{const o=new WeakMap;let s=null,a=null;return{set start(t){s=t},set stop(t){a=t},render(u,c){const l=o.get(c);return void 0!==l?Promise.resolve(l):(async(u,c)=>{let l=n(u);const h=zs(l,c);if(!h){const t={buffer:l.buffer,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,loop:l.loop,loopEnd:l.loopEnd,loopStart:l.loopStart,playbackRate:l.playbackRate.value};l=e(c,t),null!==s&&l.start(...s),null!==a&&l.stop(a)}return o.set(c,l),h?await t(c,u.playbackRate,l.playbackRate):await r(c,u.playbackRate,l.playbackRate),await i(u,c,l),l})(u,c)}}})(dc,pc,ga,fc,qu),gc=((t,e,n,r,i,o,s,a,u,c,l,h,d)=>(p,f,m,g=null,_=null)=>{const y=m.value,v=new bs.AutomationEventList(y),b=f?r(v):null,w={get defaultValue(){return y},get maxValue(){return null===g?m.maxValue:g},get minValue(){return null===_?m.minValue:_},get value(){return m.value},set value(t){m.value=t,w.setValueAtTime(t,p.context.currentTime)},cancelAndHoldAtTime(t){if("function"==typeof m.cancelAndHoldAtTime)null===b&&v.flush(p.context.currentTime),v.add(i(t)),m.cancelAndHoldAtTime(t);else{const e=Array.from(v).pop();null===b&&v.flush(p.context.currentTime),v.add(i(t));const n=Array.from(v).pop();m.cancelScheduledValues(t),e!==n&&void 0!==n&&("exponentialRampToValue"===n.type?m.exponentialRampToValueAtTime(n.value,n.endTime):"linearRampToValue"===n.type?m.linearRampToValueAtTime(n.value,n.endTime):"setValue"===n.type?m.setValueAtTime(n.value,n.startTime):"setValueCurve"===n.type&&m.setValueCurveAtTime(n.values,n.startTime,n.duration))}return w},cancelScheduledValues:t=>(null===b&&v.flush(p.context.currentTime),v.add(o(t)),m.cancelScheduledValues(t),w),exponentialRampToValueAtTime(t,e){if(0===t)throw new RangeError;if(!Number.isFinite(e)||e<0)throw new RangeError;const n=p.context.currentTime;return null===b&&v.flush(n),0===Array.from(v).length&&(v.add(c(y,n)),m.setValueAtTime(y,n)),v.add(s(t,e)),m.exponentialRampToValueAtTime(t,e),w},linearRampToValueAtTime(t,e){const n=p.context.currentTime;return null===b&&v.flush(n),0===Array.from(v).length&&(v.add(c(y,n)),m.setValueAtTime(y,n)),v.add(a(t,e)),m.linearRampToValueAtTime(t,e),w},setTargetAtTime:(t,e,n)=>(null===b&&v.flush(p.context.currentTime),v.add(u(t,e,n)),m.setTargetAtTime(t,e,n),w),setValueAtTime:(t,e)=>(null===b&&v.flush(p.context.currentTime),v.add(c(t,e)),m.setValueAtTime(t,e),w),setValueCurveAtTime(t,e,n){const r=t instanceof Float32Array?t:new Float32Array(t);if(null!==h&&"webkitAudioContext"===h.name){const t=e+n,i=p.context.sampleRate,o=Math.ceil(e*i),s=Math.floor(t*i),a=s-o,u=new Float32Array(a);for(let t=0;t<a;t+=1){const s=(r.length-1)/n*((o+t)/i-e),a=Math.floor(s),c=Math.ceil(s);u[t]=a===c?r[a]:(1-(s-a))*r[a]+(1-(c-s))*r[c]}null===b&&v.flush(p.context.currentTime),v.add(l(u,e,n)),m.setValueCurveAtTime(u,e,n);const c=s/i;c<t&&d(w,u[u.length-1],c),d(w,r[r.length-1],t)}else null===b&&v.flush(p.context.currentTime),v.add(l(r,e,n)),m.setValueCurveAtTime(r,e,n);return w}};return n.set(w,m),e.set(w,p),t(w,b),w})((_c=ks,(t,e)=>{_c.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:e})}),Ju,Ss,t=>({replay(e){for(const n of t)if("exponentialRampToValue"===n.type){const{endTime:t,value:r}=n;e.exponentialRampToValueAtTime(r,t)}else if("linearRampToValue"===n.type){const{endTime:t,value:r}=n;e.linearRampToValueAtTime(r,t)}else if("setTarget"===n.type){const{startTime:t,target:r,timeConstant:i}=n;e.setTargetAtTime(r,t,i)}else if("setValue"===n.type){const{startTime:t,value:r}=n;e.setValueAtTime(r,t)}else{if("setValueCurve"!==n.type)throw new Error("Can't apply an unknown automation.");{const{duration:t,startTime:r,values:i}=n;e.setValueCurveAtTime(i,r,t)}}}}),bs.createCancelAndHoldAutomationEvent,bs.createCancelScheduledValuesAutomationEvent,bs.createExponentialRampToValueAutomationEvent,bs.createLinearRampToValueAutomationEvent,bs.createSetTargetAutomationEvent,bs.createSetValueAutomationEvent,bs.createSetValueCurveAutomationEvent,Xu,ku);var _c;const yc=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,r){const a=o(t),u={...Ys,...r},c=i(a,u),l=s(a),h=l?e():null;super(t,!1,c,h),this._audioBufferSourceNodeRenderer=h,this._isBufferNullified=!1,this._isBufferSet=null!==u.buffer,this._nativeAudioBufferSourceNode=c,this._onended=null,this._playbackRate=n(this,l,c.playbackRate,Qs,Ks)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(t){if(this._nativeAudioBufferSourceNode.buffer=t,null!==t){if(this._isBufferSet)throw r();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(t){this._nativeAudioBufferSourceNode.loop=t}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(t){this._nativeAudioBufferSourceNode.loopEnd=t}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(t){this._nativeAudioBufferSourceNode.loopStart=t}get onended(){return this._onended}set onended(t){const e="function"==typeof t?a(this,t):null;this._nativeAudioBufferSourceNode.onended=e;const n=this._nativeAudioBufferSourceNode.onended;this._onended=null!==n&&n===e?t:n}get playbackRate(){return this._playbackRate}start(t=0,e=0,n){if(this._nativeAudioBufferSourceNode.start(t,e,n),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.start=void 0===n?[t,e]:[t,e,n]),"closed"!==this.context.state){Bs(this);const t=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",t),Zs(this)&&Us(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeAudioBufferSourceNode.stop(t),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.stop=t)}})(tc,mc,gc,Va,pc,Vu,Wu,Cu),vc=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,n){const r=o(t),u=s(r),c=i(r,n,u);super(t,!1,c,u?e(a):null),this._isNodeOfNativeOfflineAudioContext=u,this._nativeAudioDestinationNode=c}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(t){if(this._isNodeOfNativeOfflineAudioContext)throw r();if(t>this._nativeAudioDestinationNode.maxChannelCount)throw n();this._nativeAudioDestinationNode.channelCount=t}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(t){if(this._isNodeOfNativeOfflineAudioContext)throw r();this._nativeAudioDestinationNode.channelCountMode=t}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}})(tc,t=>{const e=new WeakMap;return{render(n,r){const i=e.get(r);return void 0!==i?Promise.resolve(i):(async(n,r)=>{const i=r.destination;return e.set(r,i),await t(n,r,i),i})(n,r)}}},Js,Va,((t,e)=>(n,r,i)=>{const o=n.destination;if(o.channelCount!==r)try{o.channelCount=r}catch{}i&&"explicit"!==o.channelCountMode&&(o.channelCountMode="explicit"),0===o.maxChannelCount&&Object.defineProperty(o,"maxChannelCount",{value:r});const s=t(n,{channelCount:r,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,gain:1});return e(s,"channelCount",t=>()=>t.call(s),t=>e=>{t.call(s,e);try{o.channelCount=e}catch(t){if(e>o.maxChannelCount)throw t}}),e(s,"channelCountMode",t=>()=>t.call(s),t=>e=>{t.call(s,e),o.channelCountMode=e}),e(s,"channelInterpretation",t=>()=>t.call(s),t=>e=>{t.call(s,e),o.channelInterpretation=e}),Object.defineProperty(s,"maxChannelCount",{get:()=>o.maxChannelCount}),s.connect(o),s})(uu,Tu),Vu,Wu,qu),bc=((t,e,n,r,i)=>()=>{const o=new WeakMap;return{render(s,a){const u=o.get(a);return void 0!==u?Promise.resolve(u):(async(s,a)=>{let u=n(s);const c=zs(u,a);if(!c){const t={Q:u.Q.value,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,detune:u.detune.value,frequency:u.frequency.value,gain:u.gain.value,type:u.type};u=e(a,t)}return o.set(a,u),c?(await t(a,s.Q,u.Q),await t(a,s.detune,u.detune),await t(a,s.frequency,u.frequency),await t(a,s.gain,u.gain)):(await r(a,s.Q,u.Q),await r(a,s.detune,u.detune),await r(a,s.frequency,u.frequency),await r(a,s.gain,u.gain)),await i(s,a,u),u})(s,a)}}})(dc,iu,ga,fc,qu),wc=(t=>(e,n)=>t.set(e,n))(ju),xc=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,r){const u=o(t),c={...ja,...r},l=i(u,c),h=s(u);super(t,!1,l,h?n():null),this._Q=e(this,h,l.Q,Qs,Ks),this._detune=e(this,h,l.detune,1200*Math.log2(Qs),-1200*Math.log2(Qs)),this._frequency=e(this,h,l.frequency,t.sampleRate/2,0),this._gain=e(this,h,l.gain,40*Math.log10(Qs),Ks),this._nativeBiquadFilterNode=l,a(this,1)}get detune(){return this._detune}get frequency(){return this._frequency}get gain(){return this._gain}get Q(){return this._Q}get type(){return this._nativeBiquadFilterNode.type}set type(t){this._nativeBiquadFilterNode.type=t}getFrequencyResponse(t,e,n){try{this._nativeBiquadFilterNode.getFrequencyResponse(t,e,n)}catch(t){if(11===t.code)throw r();throw t}if(t.length!==e.length||e.length!==n.length)throw r()}})(tc,gc,bc,Ga,iu,Vu,Wu,wc),Tc=((t,e)=>(n,r,i)=>{const o=new Set;return n.connect=(i=>(s,a=0,u=0)=>{const c=0===o.size;if(e(s))return i.call(n,s,a,u),t(o,[s,a,u],t=>t[0]===s&&t[1]===a&&t[2]===u,!0),c&&r(),s;i.call(n,s,a),t(o,[s,a],t=>t[0]===s&&t[1]===a,!0),c&&r()})(n.connect),n.disconnect=(t=>(r,s,a)=>{const u=o.size>0;if(void 0===r)t.apply(n),o.clear();else if("number"==typeof r){t.call(n,r);for(const t of o)t[1]===r&&o.delete(t)}else{e(r)?t.call(n,r,s,a):t.call(n,r,s);for(const t of o)t[0]!==r||void 0!==s&&t[1]!==s||void 0!==a&&t[2]!==a||o.delete(t)}const c=0===o.size;u&&c&&i()})(n.disconnect),n})(aa,Qu),kc=((t,e)=>(n,r)=>{r.channelCount=1,r.channelCountMode="explicit",Object.defineProperty(r,"channelCount",{get:()=>1,set:()=>{throw t()}}),Object.defineProperty(r,"channelCountMode",{get:()=>"explicit",set:()=>{throw t()}});const i=n.createBufferSource();e(r,()=>{const t=r.numberOfInputs;for(let e=0;e<t;e+=1)i.connect(r,0,e)},()=>i.disconnect(r))})(Va,Tc),Sc=((t,e)=>(n,r)=>{const i=n.createChannelMerger(r.numberOfInputs);return null!==t&&"webkitAudioContext"===t.name&&e(n,i),Qa(i,r),i})(Xu,kc),Ac=((t,e,n)=>()=>{const r=new WeakMap;return{render(i,o){const s=r.get(o);return void 0!==s?Promise.resolve(s):(async(i,o)=>{let s=e(i);if(!zs(s,o)){const e={channelCount:s.channelCount,channelCountMode:s.channelCountMode,channelInterpretation:s.channelInterpretation,numberOfInputs:s.numberOfInputs};s=t(o,e)}return r.set(o,s),await n(i,o,s),s})(i,o)}}})(Sc,ga,qu),Ec=((t,e,n,r,i)=>class extends t{constructor(t,o){const s=r(t),a={...Ra,...o};super(t,!1,n(s,a),i(s)?e():null)}})(tc,Ac,Sc,Vu,Wu),Oc=((t,e,n)=>()=>{const r=new WeakMap;return{render(i,o){const s=r.get(o);return void 0!==s?Promise.resolve(s):(async(i,o)=>{let s=e(i);if(!zs(s,o)){const e={channelCount:s.channelCount,channelCountMode:s.channelCountMode,channelInterpretation:s.channelInterpretation,numberOfOutputs:s.numberOfOutputs};s=t(o,e)}return r.set(o,s),await n(i,o,s),s})(i,o)}}})(ou,ga,qu),Cc=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u=o({...Pa,...s});super(t,!1,n(a,u),i(a)?e():null)}})(tc,Oc,ou,Vu,Wu,t=>({...t,channelCount:t.numberOfOutputs})),Mc=((t,e,n,r)=>(i,{offset:o,...s})=>{const a=i.createBuffer(1,2,44100),u=e(i,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),c=n(i,{...s,gain:o}),l=a.getChannelData(0);l[0]=1,l[1]=1,u.buffer=a,u.loop=!0;const h={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(t){c.channelCount=t},get channelCountMode(){return c.channelCountMode},set channelCountMode(t){c.channelCountMode=t},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(t){c.channelInterpretation=t},get context(){return c.context},get inputs(){return[]},get numberOfInputs(){return u.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get offset(){return c.gain},get onended(){return u.onended},set onended(t){u.onended=t},addEventListener:(...t)=>u.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>u.dispatchEvent(t[0]),removeEventListener:(...t)=>u.removeEventListener(t[0],t[1],t[2]),start(t=0){u.start.call(u,t)},stop(t=0){u.stop.call(u,t)}};return t(i,u),r(su(h,c),()=>u.connect(c),()=>u.disconnect(c))})(lc,pc,uu,Tc),Nc=((t,e,n,r,i)=>(o,s)=>{if(void 0===o.createConstantSource)return n(o,s);const a=o.createConstantSource();return Qa(a,s),Ya(a,s,"offset"),e(r,()=>r(o))||tu(a),e(i,()=>i(o))||eu(a),t(o,a),a})(lc,Pu,Mc,Su,Eu),Ic=((t,e,n,r,i)=>()=>{const o=new WeakMap;let s=null,a=null;return{set start(t){s=t},set stop(t){a=t},render(u,c){const l=o.get(c);return void 0!==l?Promise.resolve(l):(async(u,c)=>{let l=n(u);const h=zs(l,c);if(!h){const t={channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,offset:l.offset.value};l=e(c,t),null!==s&&l.start(s),null!==a&&l.stop(a)}return o.set(c,l),h?await t(c,u.offset,l.offset):await r(c,u.offset,l.offset),await i(u,c,l),l})(u,c)}}})(dc,Nc,ga,fc,qu),jc=((t,e,n,r,i,o,s)=>class extends t{constructor(t,s){const a=i(t),u={...Da,...s},c=r(a,u),l=o(a),h=l?n():null;super(t,!1,c,h),this._constantSourceNodeRenderer=h,this._nativeConstantSourceNode=c,this._offset=e(this,l,c.offset,Qs,Ks),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(t){const e="function"==typeof t?s(this,t):null;this._nativeConstantSourceNode.onended=e;const n=this._nativeConstantSourceNode.onended;this._onended=null!==n&&n===e?t:n}start(t=0){if(this._nativeConstantSourceNode.start(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.start=t),"closed"!==this.context.state){Bs(this);const t=()=>{this._nativeConstantSourceNode.removeEventListener("ended",t),Zs(this)&&Us(this)};this._nativeConstantSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeConstantSourceNode.stop(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.stop=t)}})(tc,gc,Ic,Nc,Vu,Wu,Cu),Rc=((t,e)=>(n,r)=>{const i=n.createConvolver();if(Qa(i,r),r.disableNormalization===i.normalize&&(i.normalize=!r.disableNormalization),Ka(i,r,"buffer"),r.channelCount>2)throw t();if(e(i,"channelCount",t=>()=>t.call(i),e=>n=>{if(n>2)throw t();return e.call(i,n)}),"max"===r.channelCountMode)throw t();return e(i,"channelCountMode",t=>()=>t.call(i),e=>n=>{if("max"===n)throw t();return e.call(i,n)}),i})(pu,Tu),Pc=((t,e,n)=>()=>{const r=new WeakMap;return{render(i,o){const s=r.get(o);return void 0!==s?Promise.resolve(s):(async(i,o)=>{let s=e(i);if(!zs(s,o)){const e={buffer:s.buffer,channelCount:s.channelCount,channelCountMode:s.channelCountMode,channelInterpretation:s.channelInterpretation,disableNormalization:!s.normalize};s=t(o,e)}return r.set(o,s),la(s)?await n(i,o,s.inputs[0]):await n(i,o,s),s})(i,o)}}})(Rc,ga,qu),Dc=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u={...La,...s},c=n(a,u);super(t,!1,c,i(a)?e():null),this._isBufferNullified=!1,this._nativeConvolverNode=c,null!==u.buffer&&o(this,u.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(t){if(this._nativeConvolverNode.buffer=t,null===t&&null!==this._nativeConvolverNode.buffer){const t=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=t.createBuffer(1,1,t.sampleRate),this._isBufferNullified=!0,o(this,0)}else this._isBufferNullified=!1,o(this,null===this._nativeConvolverNode.buffer?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(t){this._nativeConvolverNode.normalize=t}})(tc,Pc,Rc,Vu,Wu,wc),Lc=((t,e,n,r,i)=>o=>{const s=new WeakMap;return{render(a,u){const c=s.get(u);return void 0!==c?Promise.resolve(c):(async(a,u)=>{let c=n(a);const l=zs(c,u);if(!l){const t={channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,delayTime:c.delayTime.value,maxDelayTime:o};c=e(u,t)}return s.set(u,c),l?await t(u,a.delayTime,c.delayTime):await r(u,a.delayTime,c.delayTime),await i(a,u,c),c})(a,u)}}})(dc,au,ga,fc,qu),Fc=((t,e,n,r,i,o,s)=>class extends t{constructor(t,a){const u=i(t),c={...$a,...a},l=r(u,c),h=o(u);super(t,!1,l,h?n(c.maxDelayTime):null),this._delayTime=e(this,h,l.delayTime),s(this,c.maxDelayTime)}get delayTime(){return this._delayTime}})(tc,gc,Lc,au,Vu,Wu,wc),$c=(t=>(e,n)=>{const r=e.createDynamicsCompressor();if(Qa(r,n),n.channelCount>2)throw t();if("max"===n.channelCountMode)throw t();return Ya(r,n,"attack"),Ya(r,n,"knee"),Ya(r,n,"ratio"),Ya(r,n,"release"),Ya(r,n,"threshold"),r})(pu),Bc=((t,e,n,r,i)=>()=>{const o=new WeakMap;return{render(s,a){const u=o.get(a);return void 0!==u?Promise.resolve(u):(async(s,a)=>{let u=n(s);const c=zs(u,a);if(!c){const t={attack:u.attack.value,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,knee:u.knee.value,ratio:u.ratio.value,release:u.release.value,threshold:u.threshold.value};u=e(a,t)}return o.set(a,u),c?(await t(a,s.attack,u.attack),await t(a,s.knee,u.knee),await t(a,s.ratio,u.ratio),await t(a,s.release,u.release),await t(a,s.threshold,u.threshold)):(await r(a,s.attack,u.attack),await r(a,s.knee,u.knee),await r(a,s.ratio,u.ratio),await r(a,s.release,u.release),await r(a,s.threshold,u.threshold)),await i(s,a,u),u})(s,a)}}})(dc,$c,ga,fc,qu),qc=((t,e,n,r,i,o,s,a)=>class extends t{constructor(t,i){const u=o(t),c={...qa,...i},l=r(u,c),h=s(u);super(t,!1,l,h?n():null),this._attack=e(this,h,l.attack),this._knee=e(this,h,l.knee),this._nativeDynamicsCompressorNode=l,this._ratio=e(this,h,l.ratio),this._release=e(this,h,l.release),this._threshold=e(this,h,l.threshold),a(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(t){const e=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=t,t>2)throw this._nativeDynamicsCompressorNode.channelCount=e,i()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(t){const e=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=t,"max"===t)throw this._nativeDynamicsCompressorNode.channelCountMode=e,i()}get knee(){return this._knee}get ratio(){return this._ratio}get reduction(){return"number"==typeof this._nativeDynamicsCompressorNode.reduction.value?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}get release(){return this._release}get threshold(){return this._threshold}})(tc,gc,Bc,$c,pu,Vu,Wu,wc),Uc=((t,e,n,r,i)=>()=>{const o=new WeakMap;return{render(s,a){const u=o.get(a);return void 0!==u?Promise.resolve(u):(async(s,a)=>{let u=n(s);const c=zs(u,a);if(!c){const t={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,gain:u.gain.value};u=e(a,t)}return o.set(a,u),c?await t(a,s.gain,u.gain):await r(a,s.gain,u.gain),await i(s,a,u),u})(s,a)}}})(dc,uu,ga,fc,qu),Vc=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=i(t),u={...Ua,...s},c=r(a,u),l=o(a);super(t,!1,c,l?n():null),this._gain=e(this,l,c.gain,Qs,Ks)}get gain(){return this._gain}})(tc,gc,Uc,uu,Vu,Wu),Gc=((t,e,n,r)=>(i,o,{channelCount:s,channelCountMode:a,channelInterpretation:u,feedback:c,feedforward:l})=>{const h=nu(o,i.sampleRate),d=c instanceof Float64Array?c:new Float64Array(c),p=l instanceof Float64Array?l:new Float64Array(l),f=d.length,m=p.length,g=Math.min(f,m);if(0===f||f>20)throw r();if(0===d[0])throw e();if(0===m||m>20)throw r();if(0===p[0])throw e();if(1!==d[0]){for(let t=0;t<m;t+=1)p[t]/=d[0];for(let t=1;t<f;t+=1)d[t]/=d[0]}const _=n(i,h,s,s);_.channelCount=s,_.channelCountMode=a,_.channelInterpretation=u;const y=[],v=[],b=[];for(let t=0;t<s;t+=1){y.push(0);const t=new Float32Array(32),e=new Float32Array(32);t.fill(0),e.fill(0),v.push(t),b.push(e)}_.onaudioprocess=t=>{const e=t.inputBuffer,n=t.outputBuffer,r=e.numberOfChannels;for(let t=0;t<r;t+=1){const r=e.getChannelData(t),i=n.getChannelData(t);y[t]=Wa(d,f,p,m,g,v[t],b[t],y[t],32,r,i)}};const w=i.sampleRate/2;return su({get bufferSize(){return h},get channelCount(){return _.channelCount},set channelCount(t){_.channelCount=t},get channelCountMode(){return _.channelCountMode},set channelCountMode(t){_.channelCountMode=t},get channelInterpretation(){return _.channelInterpretation},set channelInterpretation(t){_.channelInterpretation=t},get context(){return _.context},get inputs(){return[_]},get numberOfInputs(){return _.numberOfInputs},get numberOfOutputs(){return _.numberOfOutputs},addEventListener:(...t)=>_.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>_.dispatchEvent(t[0]),getFrequencyResponse(e,n,r){if(e.length!==n.length||n.length!==r.length)throw t();const i=e.length;for(let t=0;t<i;t+=1){const i=-Math.PI*(e[t]/w),o=[Math.cos(i),Math.sin(i)],s=cu(hu(p,o),hu(d,o));n[t]=Math.sqrt(s[0]*s[0]+s[1]*s[1]),r[t]=Math.atan2(s[1],s[0])}},removeEventListener:(...t)=>_.removeEventListener(t[0],t[1],t[2])},_)})(Ga,Va,du,pu),zc=((t,e,n,r)=>i=>t(Ha,()=>Ha(i))?Promise.resolve(t(r,r)).then(t=>{if(!t){const t=n(i,512,0,1);i.oncomplete=()=>{t.onaudioprocess=null,t.disconnect()},t.onaudioprocess=()=>i.currentTime,t.connect(i.destination)}return i.startRendering()}):new Promise(t=>{const n=e(i,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});i.oncomplete=e=>{n.disconnect(),t(e.renderedBuffer)},n.connect(i.destination),i.startRendering()}))(Pu,uu,du,((t,e)=>()=>{if(null===e)return Promise.resolve(!1);const n=new e(1,1,44100),r=t(n,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return new Promise(t=>{n.oncomplete=()=>{r.disconnect(),t(0!==n.currentTime)},n.startRendering()})})(uu,zu)),Wc=((t,e,n,r,i)=>(o,s)=>{const a=new WeakMap;let u=null;const c=async(c,l)=>{let h=null,d=e(c);const p=zs(d,l);if(void 0===l.createIIRFilter?h=t(l,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):p||(d=l.createIIRFilter(s,o)),a.set(l,null===h?d:h),null!==h){if(null===u){if(null===n)throw new Error("Missing the native OfflineAudioContext constructor.");const t=new n(c.context.destination.channelCount,c.context.length,l.sampleRate);u=(async()=>{await r(c,t,t.destination);return((t,e,n,r)=>{const i=n instanceof Float64Array?n:new Float64Array(n),o=r instanceof Float64Array?r:new Float64Array(r),s=i.length,a=o.length,u=Math.min(s,a);if(1!==i[0]){for(let t=0;t<s;t+=1)o[t]/=i[0];for(let t=1;t<a;t+=1)i[t]/=i[0]}const c=new Float32Array(32),l=new Float32Array(32),h=e.createBuffer(t.numberOfChannels,t.length,t.sampleRate),d=t.numberOfChannels;for(let e=0;e<d;e+=1){const n=t.getChannelData(e),r=h.getChannelData(e);c.fill(0),l.fill(0),Wa(i,s,o,a,u,c,l,0,32,n,r)}return h})(await i(t),l,o,s)})()}const t=await u;return h.buffer=t,h.start(0),h}return await r(c,l,d),d};return{render(t,e){const n=a.get(e);return void 0!==n?Promise.resolve(n):c(t,e)}}})(pc,ga,zu,qu,zc),Jc=(t=>(e,n,r)=>{if(void 0===e.createIIRFilter)return t(e,n,r);const i=e.createIIRFilter(r.feedforward,r.feedback);return Qa(i,r),i})(Gc),Hc=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=r(t),u=i(a),c={...za,...s},l=e(a,u?null:t.baseLatency,c);super(t,!1,l,u?n(c.feedback,c.feedforward):null),(t=>{var e;t.getFrequencyResponse=(e=t.getFrequencyResponse,(n,r,i)=>{if(n.length!==r.length||r.length!==i.length)throw Ga();return e.call(t,n,r,i)})})(l),this._nativeIIRFilterNode=l,o(this,1)}getFrequencyResponse(t,e,n){return this._nativeIIRFilterNode.getFrequencyResponse(t,e,n)}})(tc,Jc,Wc,Vu,Wu,wc),Xc=((t,e,n,r,i,o,s,a)=>(u,c)=>{const l=c.listener,{forwardX:h,forwardY:d,forwardZ:p,positionX:f,positionY:m,positionZ:g,upX:_,upY:y,upZ:v}=void 0===l.forwardX?(()=>{const h=new Float32Array(1),d=e(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:9}),p=s(c);let f=!1,m=[0,0,-1,0,1,0],g=[0,0,0];const _=()=>{if(f)return;f=!0;const t=r(c,256,9,0);t.onaudioprocess=({inputBuffer:t})=>{const e=[o(t,h,0),o(t,h,1),o(t,h,2),o(t,h,3),o(t,h,4),o(t,h,5)];e.some((t,e)=>t!==m[e])&&(l.setOrientation(...e),m=e);const n=[o(t,h,6),o(t,h,7),o(t,h,8)];n.some((t,e)=>t!==g[e])&&(l.setPosition(...n),g=n)},d.connect(t)},y=t=>e=>{e!==m[t]&&(m[t]=e,l.setOrientation(...m))},v=t=>e=>{e!==g[t]&&(g[t]=e,l.setPosition(...g))},b=(e,r,o)=>{const s=n(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:r});s.connect(d,0,e),s.start(),Object.defineProperty(s.offset,"defaultValue",{get:()=>r});const l=t({context:u},p,s.offset,Qs,Ks);var h,f,m,g,y,v,b;return a(l,"value",t=>()=>t.call(l),t=>e=>{try{t.call(l,e)}catch(t){if(9!==t.code)throw t}_(),p&&o(e)}),l.cancelAndHoldAtTime=(h=l.cancelAndHoldAtTime,p?()=>{throw i()}:(...t)=>{const e=h.apply(l,t);return _(),e}),l.cancelScheduledValues=(f=l.cancelScheduledValues,p?()=>{throw i()}:(...t)=>{const e=f.apply(l,t);return _(),e}),l.exponentialRampToValueAtTime=(m=l.exponentialRampToValueAtTime,p?()=>{throw i()}:(...t)=>{const e=m.apply(l,t);return _(),e}),l.linearRampToValueAtTime=(g=l.linearRampToValueAtTime,p?()=>{throw i()}:(...t)=>{const e=g.apply(l,t);return _(),e}),l.setTargetAtTime=(y=l.setTargetAtTime,p?()=>{throw i()}:(...t)=>{const e=y.apply(l,t);return _(),e}),l.setValueAtTime=(v=l.setValueAtTime,p?()=>{throw i()}:(...t)=>{const e=v.apply(l,t);return _(),e}),l.setValueCurveAtTime=(b=l.setValueCurveAtTime,p?()=>{throw i()}:(...t)=>{const e=b.apply(l,t);return _(),e}),l};return{forwardX:b(0,0,y(0)),forwardY:b(1,0,y(1)),forwardZ:b(2,-1,y(2)),positionX:b(6,0,v(0)),positionY:b(7,0,v(1)),positionZ:b(8,0,v(2)),upX:b(3,0,y(3)),upY:b(4,1,y(4)),upZ:b(5,0,y(5))}})():l;return{get forwardX(){return h},get forwardY(){return d},get forwardZ(){return p},get positionX(){return f},get positionY(){return m},get positionZ(){return g},get upX(){return _},get upY(){return y},get upZ(){return v}}})(gc,Sc,Nc,du,pu,wu,Wu,Tu),Kc=new WeakMap,Qc=((t,e,n,r,i,o)=>class extends n{constructor(n,o){super(n),this._nativeContext=n,As.set(this,n),r(n)&&i.set(n,new Set),this._destination=new t(this,o),this._listener=e(this,n),this._onstatechange=null}get currentTime(){return this._nativeContext.currentTime}get destination(){return this._destination}get listener(){return this._listener}get onstatechange(){return this._onstatechange}set onstatechange(t){const e="function"==typeof t?o(this,t):null;this._nativeContext.onstatechange=e;const n=this._nativeContext.onstatechange;this._onstatechange=null!==n&&n===e?t:n}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}})(vc,Xc,Hu,Wu,Kc,Cu),Zc=((t,e,n,r,i,o)=>(s,a)=>{const u=s.createOscillator();return Qa(u,a),Ya(u,a,"detune"),Ya(u,a,"frequency"),void 0!==a.periodicWave?u.setPeriodicWave(a.periodicWave):Ka(u,a,"type"),e(n,()=>n(s))||tu(u),e(r,()=>r(s))||o(u,s),e(i,()=>i(s))||eu(u),t(s,u),u})(lc,Pu,Su,Au,Eu,Ou),Yc=((t,e,n,r,i)=>()=>{const o=new WeakMap;let s=null,a=null,u=null;return{set periodicWave(t){s=t},set start(t){a=t},set stop(t){u=t},render(c,l){const h=o.get(l);return void 0!==h?Promise.resolve(h):(async(c,l)=>{let h=n(c);const d=zs(h,l);if(!d){const t={channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,detune:h.detune.value,frequency:h.frequency.value,periodicWave:null===s?void 0:s,type:h.type};h=e(l,t),null!==a&&h.start(a),null!==u&&h.stop(u)}return o.set(l,h),d?(await t(l,c.detune,h.detune),await t(l,c.frequency,h.frequency)):(await r(l,c.detune,h.detune),await r(l,c.frequency,h.frequency)),await i(c,l,h),h})(c,l)}}})(dc,Zc,ga,fc,qu),tl=((t,e,n,r,i,o,s)=>class extends t{constructor(t,s){const a=i(t),u={...mu,...s},c=n(a,u),l=o(a),h=l?r():null,d=t.sampleRate/2;super(t,!1,c,h),this._detune=e(this,l,c.detune,153600,-153600),this._frequency=e(this,l,c.frequency,d,-d),this._nativeOscillatorNode=c,this._onended=null,this._oscillatorNodeRenderer=h,null!==this._oscillatorNodeRenderer&&void 0!==u.periodicWave&&(this._oscillatorNodeRenderer.periodicWave=u.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(t){const e="function"==typeof t?s(this,t):null;this._nativeOscillatorNode.onended=e;const n=this._nativeOscillatorNode.onended;this._onended=null!==n&&n===e?t:n}get type(){return this._nativeOscillatorNode.type}set type(t){this._nativeOscillatorNode.type=t,null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(t){this._nativeOscillatorNode.setPeriodicWave(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=t)}start(t=0){if(this._nativeOscillatorNode.start(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.start=t),"closed"!==this.context.state){Bs(this);const t=()=>{this._nativeOscillatorNode.removeEventListener("ended",t),Zs(this)&&Us(this)};this._nativeOscillatorNode.addEventListener("ended",t)}}stop(t=0){this._nativeOscillatorNode.stop(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.stop=t)}})(tc,gc,Zc,Yc,Vu,Wu,Cu),el=(t=>(e,n)=>{const r=t(e,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),i=e.createBuffer(1,2,44100);return r.buffer=i,r.loop=!0,r.connect(n),r.start(),()=>{r.stop(),r.disconnect(n)}})(pc),nl=((t,e,n,r,i)=>(o,{curve:s,oversample:a,...u})=>{const c=o.createWaveShaper(),l=o.createWaveShaper();Qa(c,u),Qa(l,u);const h=n(o,{...u,gain:1}),d=n(o,{...u,gain:-1}),p=n(o,{...u,gain:1}),f=n(o,{...u,gain:-1});let m=null,g=!1,_=null;const y={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(t){h.channelCount=t,d.channelCount=t,c.channelCount=t,p.channelCount=t,l.channelCount=t,f.channelCount=t},get channelCountMode(){return c.channelCountMode},set channelCountMode(t){h.channelCountMode=t,d.channelCountMode=t,c.channelCountMode=t,p.channelCountMode=t,l.channelCountMode=t,f.channelCountMode=t},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(t){h.channelInterpretation=t,d.channelInterpretation=t,c.channelInterpretation=t,p.channelInterpretation=t,l.channelInterpretation=t,f.channelInterpretation=t},get context(){return c.context},get curve(){return _},set curve(n){if(null!==n&&n.length<2)throw e();if(null===n)c.curve=n,l.curve=n;else{const t=n.length,e=new Float32Array(t+2-t%2),r=new Float32Array(t+2-t%2);e[0]=n[0],r[0]=-n[t-1];const i=Math.ceil((t+1)/2),o=(t+1)/2-1;for(let s=1;s<i;s+=1){const a=s/i*o,u=Math.floor(a),c=Math.ceil(a);e[s]=u===c?n[u]:(1-(a-u))*n[u]+(1-(c-a))*n[c],r[s]=u===c?-n[t-1-u]:-(1-(a-u))*n[t-1-u]-(1-(c-a))*n[t-1-c]}e[i]=t%2==1?n[i-1]:(n[i-2]+n[i-1])/2,c.curve=e,l.curve=r}_=n,g&&(r(_)&&null===m?m=t(o,h):null!==m&&(m(),m=null))},get inputs(){return[h]},get numberOfInputs(){return c.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get oversample(){return c.oversample},set oversample(t){c.oversample=t,l.oversample=t},addEventListener:(...t)=>h.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>h.dispatchEvent(t[0]),removeEventListener:(...t)=>h.removeEventListener(t[0],t[1],t[2])};null!==s&&(y.curve=s instanceof Float32Array?s:new Float32Array(s)),a!==y.oversample&&(y.oversample=a);return i(su(y,p),()=>{h.connect(c).connect(p),h.connect(d).connect(l).connect(f).connect(p),g=!0,r(_)&&(m=t(o,h))},()=>{h.disconnect(c),c.disconnect(p),h.disconnect(d),d.disconnect(l),l.disconnect(f),f.disconnect(p),g=!1,null!==m&&(m(),m=null)})})(el,Va,uu,xu,Tc),rl=((t,e,n,r,i,o,s)=>(a,u)=>{const c=a.createWaveShaper();if(null!==o&&"webkitAudioContext"===o.name&&void 0===a.createGain().gain.automationRate)return n(a,u);Qa(c,u);const l=null===u.curve||u.curve instanceof Float32Array?u.curve:new Float32Array(u.curve);if(null!==l&&l.length<2)throw e();Ka(c,{curve:l},"curve"),Ka(c,u,"oversample");let h=null,d=!1;s(c,"curve",t=>()=>t.call(c),e=>n=>(e.call(c,n),d&&(r(n)&&null===h?h=t(a,c):r(n)||null===h||(h(),h=null)),n));return i(c,()=>{d=!0,r(c.curve)&&(h=t(a,c))},()=>{d=!1,null!==h&&(h(),h=null)})})(el,Va,nl,xu,Tc,Xu,Tu),il=((t,e,n,r,i,o,s,a,u,c)=>(l,{coneInnerAngle:h,coneOuterAngle:d,coneOuterGain:p,distanceModel:f,maxDistance:m,orientationX:g,orientationY:_,orientationZ:y,panningModel:v,positionX:b,positionY:w,positionZ:x,refDistance:T,rolloffFactor:k,...S})=>{const A=l.createPanner();if(S.channelCount>2)throw s();if("max"===S.channelCountMode)throw s();Qa(A,S);const E={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},O=n(l,{...E,channelInterpretation:"speakers",numberOfInputs:6}),C=r(l,{...S,gain:1}),M=r(l,{...E,gain:1}),N=r(l,{...E,gain:0}),I=r(l,{...E,gain:0}),j=r(l,{...E,gain:0}),R=r(l,{...E,gain:0}),P=r(l,{...E,gain:0}),D=i(l,256,6,1),L=o(l,{...E,curve:new Float32Array([1,1]),oversample:"none"});let F=[g,_,y],$=[b,w,x];const B=new Float32Array(1);D.onaudioprocess=({inputBuffer:t})=>{const e=[u(t,B,0),u(t,B,1),u(t,B,2)];e.some((t,e)=>t!==F[e])&&(A.setOrientation(...e),F=e);const n=[u(t,B,3),u(t,B,4),u(t,B,5)];n.some((t,e)=>t!==$[e])&&(A.setPosition(...n),$=n)},Object.defineProperty(N.gain,"defaultValue",{get:()=>0}),Object.defineProperty(I.gain,"defaultValue",{get:()=>0}),Object.defineProperty(j.gain,"defaultValue",{get:()=>0}),Object.defineProperty(R.gain,"defaultValue",{get:()=>0}),Object.defineProperty(P.gain,"defaultValue",{get:()=>0});const q={get bufferSize(){},get channelCount(){return A.channelCount},set channelCount(t){if(t>2)throw s();C.channelCount=t,A.channelCount=t},get channelCountMode(){return A.channelCountMode},set channelCountMode(t){if("max"===t)throw s();C.channelCountMode=t,A.channelCountMode=t},get channelInterpretation(){return A.channelInterpretation},set channelInterpretation(t){C.channelInterpretation=t,A.channelInterpretation=t},get coneInnerAngle(){return A.coneInnerAngle},set coneInnerAngle(t){A.coneInnerAngle=t},get coneOuterAngle(){return A.coneOuterAngle},set coneOuterAngle(t){A.coneOuterAngle=t},get coneOuterGain(){return A.coneOuterGain},set coneOuterGain(t){if(t<0||t>1)throw e();A.coneOuterGain=t},get context(){return A.context},get distanceModel(){return A.distanceModel},set distanceModel(t){A.distanceModel=t},get inputs(){return[C]},get maxDistance(){return A.maxDistance},set maxDistance(t){if(t<0)throw new RangeError;A.maxDistance=t},get numberOfInputs(){return A.numberOfInputs},get numberOfOutputs(){return A.numberOfOutputs},get orientationX(){return M.gain},get orientationY(){return N.gain},get orientationZ(){return I.gain},get panningModel(){return A.panningModel},set panningModel(t){A.panningModel=t},get positionX(){return j.gain},get positionY(){return R.gain},get positionZ(){return P.gain},get refDistance(){return A.refDistance},set refDistance(t){if(t<0)throw new RangeError;A.refDistance=t},get rolloffFactor(){return A.rolloffFactor},set rolloffFactor(t){if(t<0)throw new RangeError;A.rolloffFactor=t},addEventListener:(...t)=>C.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>C.dispatchEvent(t[0]),removeEventListener:(...t)=>C.removeEventListener(t[0],t[1],t[2])};h!==q.coneInnerAngle&&(q.coneInnerAngle=h),d!==q.coneOuterAngle&&(q.coneOuterAngle=d),p!==q.coneOuterGain&&(q.coneOuterGain=p),f!==q.distanceModel&&(q.distanceModel=f),m!==q.maxDistance&&(q.maxDistance=m),g!==q.orientationX.value&&(q.orientationX.value=g),_!==q.orientationY.value&&(q.orientationY.value=_),y!==q.orientationZ.value&&(q.orientationZ.value=y),v!==q.panningModel&&(q.panningModel=v),b!==q.positionX.value&&(q.positionX.value=b),w!==q.positionY.value&&(q.positionY.value=w),x!==q.positionZ.value&&(q.positionZ.value=x),T!==q.refDistance&&(q.refDistance=T),k!==q.rolloffFactor&&(q.rolloffFactor=k),1===F[0]&&0===F[1]&&0===F[2]||A.setOrientation(...F),0===$[0]&&0===$[1]&&0===$[2]||A.setPosition(...$);return c(su(q,A),()=>{C.connect(A),t(C,L,0,0),L.connect(M).connect(O,0,0),L.connect(N).connect(O,0,1),L.connect(I).connect(O,0,2),L.connect(j).connect(O,0,3),L.connect(R).connect(O,0,4),L.connect(P).connect(O,0,5),O.connect(D).connect(l.destination)},()=>{C.disconnect(A),a(C,L,0,0),L.disconnect(M),M.disconnect(O),L.disconnect(N),N.disconnect(O),L.disconnect(I),I.disconnect(O),L.disconnect(j),j.disconnect(O),L.disconnect(R),R.disconnect(O),L.disconnect(P),P.disconnect(O),O.disconnect(D),D.disconnect(l.destination)})})(ha,Va,Sc,uu,du,rl,pu,ma,wu,Tc),ol=(t=>(e,n)=>{const r=e.createPanner();return void 0===r.orientationX?t(e,n):(Qa(r,n),Ya(r,n,"orientationX"),Ya(r,n,"orientationY"),Ya(r,n,"orientationZ"),Ya(r,n,"positionX"),Ya(r,n,"positionY"),Ya(r,n,"positionZ"),Ka(r,n,"coneInnerAngle"),Ka(r,n,"coneOuterAngle"),Ka(r,n,"coneOuterGain"),Ka(r,n,"distanceModel"),Ka(r,n,"maxDistance"),Ka(r,n,"panningModel"),Ka(r,n,"refDistance"),Ka(r,n,"rolloffFactor"),r)})(il),sl=((t,e,n,r,i,o,s,a,u,c)=>()=>{const l=new WeakMap;let h=null;return{render(d,p){const f=l.get(p);return void 0!==f?Promise.resolve(f):(async(d,p)=>{let f=null,m=o(d);const g={channelCount:m.channelCount,channelCountMode:m.channelCountMode,channelInterpretation:m.channelInterpretation},_={...g,coneInnerAngle:m.coneInnerAngle,coneOuterAngle:m.coneOuterAngle,coneOuterGain:m.coneOuterGain,distanceModel:m.distanceModel,maxDistance:m.maxDistance,panningModel:m.panningModel,refDistance:m.refDistance,rolloffFactor:m.rolloffFactor},y=zs(m,p);if("bufferSize"in m)f=r(p,{...g,gain:1});else if(!y){const t={..._,orientationX:m.orientationX.value,orientationY:m.orientationY.value,orientationZ:m.orientationZ.value,positionX:m.positionX.value,positionY:m.positionY.value,positionZ:m.positionZ.value};m=i(p,t)}if(l.set(p,null===f?m:f),null!==f){if(null===h){if(null===s)throw new Error("Missing the native OfflineAudioContext constructor.");const t=new s(6,d.context.length,p.sampleRate),r=e(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6});r.connect(t.destination),h=(async()=>{const e=await Promise.all([d.orientationX,d.orientationY,d.orientationZ,d.positionX,d.positionY,d.positionZ].map(async(e,r)=>{const i=n(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:0===r?1:0});return await a(t,e,i.offset),i}));for(let t=0;t<6;t+=1)e[t].connect(r,0,t),e[t].start(0);return c(t)})()}const t=await h,o=r(p,{...g,gain:1});await u(d,p,o);const l=[];for(let e=0;e<t.numberOfChannels;e+=1)l.push(t.getChannelData(e));let m=[l[0][0],l[1][0],l[2][0]],y=[l[3][0],l[4][0],l[5][0]],v=r(p,{...g,gain:1}),b=i(p,{..._,orientationX:m[0],orientationY:m[1],orientationZ:m[2],positionX:y[0],positionY:y[1],positionZ:y[2]});o.connect(v).connect(b.inputs[0]),b.connect(f);for(let e=128;e<t.length;e+=128){const t=[l[0][e],l[1][e],l[2][e]],n=[l[3][e],l[4][e],l[5][e]];if(t.some((t,e)=>t!==m[e])||n.some((t,e)=>t!==y[e])){m=t,y=n;const s=e/p.sampleRate;v.gain.setValueAtTime(0,s),v=r(p,{...g,gain:0}),b=i(p,{..._,orientationX:m[0],orientationY:m[1],orientationZ:m[2],positionX:y[0],positionY:y[1],positionZ:y[2]}),v.gain.setValueAtTime(1,s),o.connect(v).connect(b.inputs[0]),b.connect(f)}}return f}return y?(await t(p,d.orientationX,m.orientationX),await t(p,d.orientationY,m.orientationY),await t(p,d.orientationZ,m.orientationZ),await t(p,d.positionX,m.positionX),await t(p,d.positionY,m.positionY),await t(p,d.positionZ,m.positionZ)):(await a(p,d.orientationX,m.orientationX),await a(p,d.orientationY,m.orientationY),await a(p,d.orientationZ,m.orientationZ),await a(p,d.positionX,m.positionX),await a(p,d.positionY,m.positionY),await a(p,d.positionZ,m.positionZ)),la(m)?await u(d,p,m.inputs[0]):await u(d,p,m),m})(d,p)}}})(dc,Sc,Nc,uu,ol,ga,zu,fc,qu,zc),al=((t,e,n,r,i,o,s)=>class extends t{constructor(t,a){const u=i(t),c={...gu,...a},l=n(u,c),h=o(u);super(t,!1,l,h?r():null),this._nativePannerNode=l,this._orientationX=e(this,h,l.orientationX,Qs,Ks),this._orientationY=e(this,h,l.orientationY,Qs,Ks),this._orientationZ=e(this,h,l.orientationZ,Qs,Ks),this._positionX=e(this,h,l.positionX,Qs,Ks),this._positionY=e(this,h,l.positionY,Qs,Ks),this._positionZ=e(this,h,l.positionZ,Qs,Ks),s(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(t){this._nativePannerNode.coneInnerAngle=t}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(t){this._nativePannerNode.coneOuterAngle=t}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(t){this._nativePannerNode.coneOuterGain=t}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(t){this._nativePannerNode.distanceModel=t}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(t){this._nativePannerNode.maxDistance=t}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(t){this._nativePannerNode.panningModel=t}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(t){this._nativePannerNode.refDistance=t}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(t){this._nativePannerNode.rolloffFactor=t}})(tc,gc,ol,sl,Vu,Wu,wc),ul=(t=>(e,{disableNormalization:n,imag:r,real:i})=>{const o=r instanceof Float32Array?r:new Float32Array(r),s=i instanceof Float32Array?i:new Float32Array(i),a=e.createPeriodicWave(s,o,{disableNormalization:n});if(Array.from(r).length<2)throw t();return a})(Js),cl=((t,e,n,r)=>class i{constructor(i,o){const s=e(i),a=r({..._u,...o}),u=t(s,a);return n.add(u),u}static[Symbol.hasInstance](t){return null!==t&&"object"==typeof t&&Object.getPrototypeOf(t)===i.prototype||n.has(t)}})(ul,Vu,new WeakSet,t=>{const{imag:e,real:n}=t;return void 0===e?void 0===n?{...t,imag:[0,0],real:[0,0]}:{...t,imag:Array.from(n,()=>0),real:n}:void 0===n?{...t,imag:e,real:Array.from(e,()=>0)}:{...t,imag:e,real:n}}),ll=((t,e,n,r,i,o)=>{const s=16385,a=new Float32Array([1,1]),u=Math.PI/2,c={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},l={...c,oversample:"none"},h=(t,o,h,d,p)=>{if(1===o)return((t,e,i,o)=>{const h=new Float32Array(s),d=new Float32Array(s);for(let t=0;t<s;t+=1){const e=t/16384*u;h[t]=Math.cos(e),d[t]=Math.sin(e)}const p=n(t,{...c,gain:0}),f=r(t,{...l,curve:h}),m=r(t,{...l,curve:a}),g=n(t,{...c,gain:0}),_=r(t,{...l,curve:d});return{connectGraph(){e.connect(p),e.connect(void 0===m.inputs?m:m.inputs[0]),e.connect(g),m.connect(i),i.connect(void 0===f.inputs?f:f.inputs[0]),i.connect(void 0===_.inputs?_:_.inputs[0]),f.connect(p.gain),_.connect(g.gain),p.connect(o,0,0),g.connect(o,0,1)},disconnectGraph(){e.disconnect(p),e.disconnect(void 0===m.inputs?m:m.inputs[0]),e.disconnect(g),m.disconnect(i),i.disconnect(void 0===f.inputs?f:f.inputs[0]),i.disconnect(void 0===_.inputs?_:_.inputs[0]),f.disconnect(p.gain),_.disconnect(g.gain),p.disconnect(o,0,0),g.disconnect(o,0,1)}}})(t,h,d,p);if(2===o)return((t,i,o,h)=>{const d=new Float32Array(s),p=new Float32Array(s),f=new Float32Array(s),m=new Float32Array(s),g=Math.floor(8192.5);for(let t=0;t<s;t+=1)if(t>g){const e=(t-g)/(16384-g)*u;d[t]=Math.cos(e),p[t]=Math.sin(e),f[t]=0,m[t]=1}else{const e=t/(16384-g)*u;d[t]=1,p[t]=0,f[t]=Math.cos(e),m[t]=Math.sin(e)}const _=e(t,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),y=n(t,{...c,gain:0}),v=r(t,{...l,curve:d}),b=n(t,{...c,gain:0}),w=r(t,{...l,curve:p}),x=r(t,{...l,curve:a}),T=n(t,{...c,gain:0}),k=r(t,{...l,curve:f}),S=n(t,{...c,gain:0}),A=r(t,{...l,curve:m});return{connectGraph(){i.connect(_),i.connect(void 0===x.inputs?x:x.inputs[0]),_.connect(y,0),_.connect(b,0),_.connect(T,1),_.connect(S,1),x.connect(o),o.connect(void 0===v.inputs?v:v.inputs[0]),o.connect(void 0===w.inputs?w:w.inputs[0]),o.connect(void 0===k.inputs?k:k.inputs[0]),o.connect(void 0===A.inputs?A:A.inputs[0]),v.connect(y.gain),w.connect(b.gain),k.connect(T.gain),A.connect(S.gain),y.connect(h,0,0),T.connect(h,0,0),b.connect(h,0,1),S.connect(h,0,1)},disconnectGraph(){i.disconnect(_),i.disconnect(void 0===x.inputs?x:x.inputs[0]),_.disconnect(y,0),_.disconnect(b,0),_.disconnect(T,1),_.disconnect(S,1),x.disconnect(o),o.disconnect(void 0===v.inputs?v:v.inputs[0]),o.disconnect(void 0===w.inputs?w:w.inputs[0]),o.disconnect(void 0===k.inputs?k:k.inputs[0]),o.disconnect(void 0===A.inputs?A:A.inputs[0]),v.disconnect(y.gain),w.disconnect(b.gain),k.disconnect(T.gain),A.disconnect(S.gain),y.disconnect(h,0,0),T.disconnect(h,0,0),b.disconnect(h,0,1),S.disconnect(h,0,1)}}})(t,h,d,p);throw i()};return(e,{channelCount:r,channelCountMode:s,pan:a,...u})=>{if("max"===s)throw i();const c=t(e,{...u,channelCount:1,channelCountMode:s,numberOfInputs:2}),l=n(e,{...u,channelCount:r,channelCountMode:s,gain:1}),d=n(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:a});let{connectGraph:p,disconnectGraph:f}=h(e,r,l,d,c);Object.defineProperty(d.gain,"defaultValue",{get:()=>0}),Object.defineProperty(d.gain,"maxValue",{get:()=>1}),Object.defineProperty(d.gain,"minValue",{get:()=>-1});const m={get bufferSize(){},get channelCount(){return l.channelCount},set channelCount(t){l.channelCount!==t&&(g&&f(),({connectGraph:p,disconnectGraph:f}=h(e,t,l,d,c)),g&&p()),l.channelCount=t},get channelCountMode(){return l.channelCountMode},set channelCountMode(t){if("clamped-max"===t||"max"===t)throw i();l.channelCountMode=t},get channelInterpretation(){return l.channelInterpretation},set channelInterpretation(t){l.channelInterpretation=t},get context(){return l.context},get inputs(){return[l]},get numberOfInputs(){return l.numberOfInputs},get numberOfOutputs(){return l.numberOfOutputs},get pan(){return d.gain},addEventListener:(...t)=>l.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>l.dispatchEvent(t[0]),removeEventListener:(...t)=>l.removeEventListener(t[0],t[1],t[2])};let g=!1;return o(su(m,c),()=>{p(),g=!0},()=>{f(),g=!1})}})(Sc,ou,uu,rl,pu,Tc),hl=((t,e)=>(n,r)=>{const i=r.channelCountMode;if("clamped-max"===i)throw e();if(void 0===n.createStereoPanner)return t(n,r);const o=n.createStereoPanner();return Qa(o,r),Ya(o,r,"pan"),Object.defineProperty(o,"channelCountMode",{get:()=>i,set:t=>{if(t!==i)throw e()}}),o})(ll,pu),dl=((t,e,n,r,i)=>()=>{const o=new WeakMap;return{render(s,a){const u=o.get(a);return void 0!==u?Promise.resolve(u):(async(s,a)=>{let u=n(s);const c=zs(u,a);if(!c){const t={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,pan:u.pan.value};u=e(a,t)}return o.set(a,u),c?await t(a,s.pan,u.pan):await r(a,s.pan,u.pan),la(u)?await i(s,a,u.inputs[0]):await i(s,a,u),u})(s,a)}}})(dc,hl,ga,fc,qu),pl=((t,e,n,r,i,o)=>class extends t{constructor(t,s){const a=i(t),u={...yu,...s},c=n(a,u),l=o(a);super(t,!1,c,l?r():null),this._pan=e(this,l,c.pan)}get pan(){return this._pan}})(tc,gc,hl,dl,Vu,Wu),fl=((t,e,n)=>()=>{const r=new WeakMap;return{render(i,o){const s=r.get(o);return void 0!==s?Promise.resolve(s):(async(i,o)=>{let s=e(i);if(!zs(s,o)){const e={channelCount:s.channelCount,channelCountMode:s.channelCountMode,channelInterpretation:s.channelInterpretation,curve:s.curve,oversample:s.oversample};s=t(o,e)}return r.set(o,s),la(s)?await n(i,o,s.inputs[0]):await n(i,o,s),s})(i,o)}}})(rl,ga,qu),ml=((t,e,n,r,i,o,s)=>class extends t{constructor(t,e){const a=i(t),u={...bu,...e},c=n(a,u);super(t,!0,c,o(a)?r():null),this._isCurveNullified=!1,this._nativeWaveShaperNode=c,s(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(t){if(null===t)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(t.length<2)throw e();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=t}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(t){this._nativeWaveShaperNode.oversample=t}})(tc,Va,rl,fl,Vu,Wu,wc),gl=(t=>null!==t&&t.isSecureContext)(Fu),_l=(t=>(e,n,r)=>{Object.defineProperties(t,{currentFrame:{configurable:!0,get:()=>Math.round(e*n)},currentTime:{configurable:!0,get:()=>e}});try{return r()}finally{null!==t&&(delete t.currentFrame,delete t.currentTime)}})(Fu),yl=new WeakMap,vl=((t,e)=>n=>{let r=t.get(n);if(void 0!==r)return r;if(null===e)throw new Error("Missing the native OfflineAudioContext constructor.");return r=new e(1,1,44100),t.set(n,r),r})(yl,zu),bl=gl?((t,e,n,r,i,o,s,a,u,c,l,h,d)=>{let p=0;return(f,m,g={credentials:"omit"})=>{const _=l.get(f);if(void 0!==_&&_.has(m))return Promise.resolve();const y=c.get(f);if(void 0!==y){const t=y.get(m);if(void 0!==t)return t}const v=o(f),b=void 0===v.audioWorklet?i(m).then(([t,e])=>{const[r,i]=js(t,e);return n(`${r};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${i}\n})})(window,'_AWGS')`)}).then(()=>{const t=d._AWGS.pop();if(void 0===t)throw new SyntaxError;r(v.currentTime,v.sampleRate,()=>t(class{},void 0,(t,n)=>{if(""===t.trim())throw e();const r=Cs.get(v);if(void 0!==r){if(r.has(t))throw e();Ps(n),Rs(n.parameterDescriptors),r.set(t,n)}else Ps(n),Rs(n.parameterDescriptors),Cs.set(v,new Map([[t,n]]))},v.sampleRate,void 0,void 0))}):Promise.all([i(m),Promise.resolve(t(h,h))]).then(([[t,e],n])=>{const r=p+1;p=r;const[i,o]=js(t,e),c=new Blob([`${i};((AudioWorkletProcessor,registerProcessor)=>{${o}\n})(${n?"AudioWorkletProcessor":"class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}"},(n,p)=>registerProcessor(n,class extends p{${n?"":"__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${n?"":"i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));"}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${r}',class extends AudioWorkletProcessor{process(){return !1}})`],{type:"application/javascript; charset=utf-8"}),l=URL.createObjectURL(c);return v.audioWorklet.addModule(l,g).then(()=>{if(a(v))return v;const t=s(v);return t.audioWorklet.addModule(l,g).then(()=>t)}).then(t=>{if(null===u)throw new SyntaxError;try{new u(t,`__sac${r}`)}catch{throw new SyntaxError}}).finally(()=>URL.revokeObjectURL(l))});return void 0===y?c.set(f,new Map([[m,b]])):y.set(m,b),b.then(()=>{const t=l.get(f);void 0===t?l.set(f,new Set([m])):t.add(m)}).finally(()=>{const t=c.get(f);void 0!==t&&t.delete(m)}),b}})(Pu,pu,(t=>e=>new Promise((n,r)=>{if(null===t)return void r(new SyntaxError);const i=t.document.head;if(null===i)r(new SyntaxError);else{const o=t.document.createElement("script"),s=new Blob([e],{type:"application/javascript"}),a=URL.createObjectURL(s),u=t.onerror,c=()=>{t.onerror=u,URL.revokeObjectURL(a)};t.onerror=(e,n,i,o,s)=>n===a||n===t.location.href&&1===i&&1===o?(c(),r(s),!1):null!==u?u(e,n,i,o,s):void 0,o.onerror=()=>{c(),r(new SyntaxError)},o.onload=()=>{c(),n()},o.src=a,o.type="module",i.appendChild(o)}}))(Fu),_l,(t=>async e=>{try{const t=await fetch(e);if(t.ok)return[await t.text(),t.url]}catch{}throw t()})(()=>new DOMException("","AbortError")),Vu,vl,Wu,Yu,new WeakMap,new WeakMap,((t,e)=>async()=>{if(null===t)return!0;if(null===e)return!1;const n=new Blob(['class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor("a",A)'],{type:"application/javascript; charset=utf-8"}),r=new e(1,128,44100),i=URL.createObjectURL(n);let o=!1,s=!1;try{await r.audioWorklet.addModule(i);const e=new t(r,"a",{numberOfOutputs:0}),n=r.createOscillator();e.port.onmessage=()=>o=!0,e.onprocessorerror=()=>s=!0,n.connect(e),n.start(0),await r.startRendering(),await new Promise(t=>setTimeout(t))}catch{}finally{URL.revokeObjectURL(i)}return o&&!s})(Yu,zu),Fu):void 0,wl=((t,e)=>n=>t(n)||e(n))(Ku,Wu),xl=((t,e,n,r,i,o,s,a,u,c,l)=>(h,d)=>{const p=s(h)?h:o(h);if(i.has(d)){const t=n();return Promise.reject(t)}try{i.add(d)}catch{}return e(u,()=>u(p))?p.decodeAudioData(d).then(n=>(Fa(d).catch(()=>{}),e(a,()=>a(n))||l(n),t.add(n),n)):new Promise((e,n)=>{const i=async()=>{try{await Fa(d)}catch{}},o=t=>{n(t),i()};try{p.decodeAudioData(d,n=>{"function"!=typeof n.copyFromChannel&&(c(n),Hs(n)),t.add(n),i().then(()=>e(n))},t=>{o(null===t?r():t)})}catch(t){o(t)}})})(rc,Pu,()=>new DOMException("","DataCloneError"),()=>new DOMException("","EncodingError"),new WeakSet,Vu,wl,Ws,Ha,ac,uc),Tl=((t,e,n,r,i,o,s,a,u,c,l,h,d,p,f,m,g,_,y,v)=>class extends f{constructor(e,n){super(e,n),this._nativeContext=e,this._audioWorklet=void 0===t?void 0:{addModule:(e,n)=>t(this,e,n)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new e(this)}createBiquadFilter(){return new i(this)}createBuffer(t,e,r){return new n({length:e,numberOfChannels:t,sampleRate:r})}createBufferSource(){return new r(this)}createChannelMerger(t=6){return new o(this,{numberOfInputs:t})}createChannelSplitter(t=6){return new s(this,{numberOfOutputs:t})}createConstantSource(){return new a(this)}createConvolver(){return new u(this)}createDelay(t=1){return new l(this,{maxDelayTime:t})}createDynamicsCompressor(){return new h(this)}createGain(){return new d(this)}createIIRFilter(t,e){return new p(this,{feedback:e,feedforward:t})}createOscillator(){return new m(this)}createPanner(){return new g(this)}createPeriodicWave(t,e,n={disableNormalization:!1}){return new _(this,{...n,imag:e,real:t})}createStereoPanner(){return new y(this)}createWaveShaper(){return new v(this)}decodeAudioData(t,e,n){return c(this._nativeContext,t).then(t=>("function"==typeof e&&e(t),t),t=>{throw"function"==typeof n&&n(t),t})}})(bl,nc,cc,yc,xc,Ec,Cc,jc,Dc,xl,Fc,qc,Vc,Hc,Qc,tl,al,cl,pl,ml),kl=((t,e,n,r)=>class extends t{constructor(t,i){const o=n(t),s=e(o,i);if(r(o))throw TypeError();super(t,!0,s,null),this._nativeMediaElementAudioSourceNode=s}get mediaElement(){return this._nativeMediaElementAudioSourceNode.mediaElement}})(tc,(t,e)=>t.createMediaElementSource(e.mediaElement),Vu,Wu),Sl=((t,e,n,r)=>class extends t{constructor(t,i){const o=n(t);if(r(o))throw new TypeError;const s={...Ja,...i},a=e(o,s);super(t,!1,a,null),this._nativeMediaStreamAudioDestinationNode=a}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}})(tc,(t,e)=>{const n=t.createMediaStreamDestination();return Qa(n,e),1===n.numberOfOutputs&&Object.defineProperty(n,"numberOfOutputs",{get:()=>0}),n},Vu,Wu),Al=((t,e,n,r)=>class extends t{constructor(t,i){const o=n(t),s=e(o,i);if(r(o))throw new TypeError;super(t,!0,s,null),this._nativeMediaStreamAudioSourceNode=s}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}})(tc,(t,{mediaStream:e})=>{const n=e.getAudioTracks();n.sort((t,e)=>t.id<e.id?-1:t.id>e.id?1:0);const r=n.slice(0,1),i=t.createMediaStreamSource(new MediaStream(r));return Object.defineProperty(i,"mediaStream",{value:e}),i},Vu,Wu),El=((t,e)=>(n,{mediaStreamTrack:r})=>{if("function"==typeof n.createMediaStreamTrackSource)return n.createMediaStreamTrackSource(r);const i=new MediaStream([r]),o=n.createMediaStreamSource(i);if("audio"!==r.kind)throw t();if(e(n))throw new TypeError;return o})(Va,Wu),Ol=((t,e,n)=>class extends t{constructor(t,r){const i=n(t);super(t,!0,e(i,r),null)}})(tc,El,Vu),Cl=((t,e,n,r,i,o,s,a,u)=>class extends t{constructor(t={}){if(null===u)throw new Error("Missing the native AudioContext constructor.");let e;try{e=new u(t)}catch(t){if(12===t.code&&"sampleRate is not in range"===t.message)throw n();throw t}if(null===e)throw r();if(!ia(t.latencyHint))throw new TypeError(`The provided value '${t.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(void 0!==t.sampleRate&&e.sampleRate!==t.sampleRate)throw n();super(e,2);const{latencyHint:i}=t,{sampleRate:o}=e;if(this._baseLatency="number"==typeof e.baseLatency?e.baseLatency:"balanced"===i?512/o:"interactive"===i||void 0===i?256/o:"playback"===i?1024/o:128*Math.max(2,Math.min(128,Math.round(i*o/128)))/o,this._nativeAudioContext=e,"webkitAudioContext"===u.name?(this._nativeGainNode=e.createGain(),this._nativeOscillatorNode=e.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(e.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,"running"===e.state){this._state="suspended";const t=()=>{"suspended"===this._state&&(this._state=null),e.removeEventListener("statechange",t)};e.addEventListener("statechange",t)}}get baseLatency(){return this._baseLatency}get state(){return null!==this._state?this._state:this._nativeAudioContext.state}close(){return"closed"===this.state?this._nativeAudioContext.close().then(()=>{throw e()}):("suspended"===this._state&&(this._state=null),this._nativeAudioContext.close().then(()=>{null!==this._nativeGainNode&&null!==this._nativeOscillatorNode&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),ra(this)}))}createMediaElementSource(t){return new i(this,{mediaElement:t})}createMediaStreamDestination(){return new o(this)}createMediaStreamSource(t){return new s(this,{mediaStream:t})}createMediaStreamTrackSource(t){return new a(this,{mediaStreamTrack:t})}resume(){return"suspended"===this._state?new Promise((t,e)=>{const n=()=>{this._nativeAudioContext.removeEventListener("statechange",n),"running"===this._nativeAudioContext.state?t():this.resume().then(t,e)};this._nativeAudioContext.addEventListener("statechange",n)}):this._nativeAudioContext.resume().catch(t=>{if(void 0===t||15===t.code)throw e();throw t})}suspend(){return this._nativeAudioContext.suspend().catch(t=>{if(void 0===t)throw e();throw t})}})(Tl,Va,pu,vu,kl,Sl,Al,Ol,Xu),Ml=(t=>e=>{const n=t.get(e);if(void 0===n)throw new Error("The context has no set of AudioWorkletNodes.");return n})(Kc),Nl=(t=>(e,n)=>{t(e).add(n)})(Ml),Il=(t=>(e,n,r=0,i=0)=>{const o=e[r];if(void 0===o)throw t();return xa(n)?o.connect(n,0,i):o.connect(n,0)})(Js),jl=(t=>(e,n)=>{t(e).delete(n)})(Ml),Rl=(t=>(e,n=void 0,r=void 0,i=0)=>void 0===n?e.forEach(t=>t.disconnect()):"number"==typeof n?Ba(t,e,n).disconnect():xa(n)?void 0===r?e.forEach(t=>t.disconnect(n)):void 0===i?Ba(t,e,r).disconnect(n,0):Ba(t,e,r).disconnect(n,0,i):void 0===r?e.forEach(t=>t.disconnect(n)):Ba(t,e,r).disconnect(n,0))(Js),Pl=new WeakMap,Dl=((t,e)=>n=>e(t,n))(Pl,Ds),Ll=((t,e,n,r,i,o,s,a,u,c,l,h,d)=>(p,f,m,g)=>{if(0===g.numberOfInputs&&0===g.numberOfOutputs)throw u();const _=Array.isArray(g.outputChannelCount)?g.outputChannelCount:Array.from(g.outputChannelCount);if(_.some(t=>t<1))throw u();if(_.length!==g.numberOfOutputs)throw e();if("explicit"!==g.channelCountMode)throw u();const y=g.channelCount*g.numberOfInputs,v=_.reduce((t,e)=>t+e,0),b=void 0===m.parameterDescriptors?0:m.parameterDescriptors.length;if(y+b>6||v>6)throw u();const w=new MessageChannel,x=[],T=[];for(let t=0;t<g.numberOfInputs;t+=1)x.push(s(p,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1})),T.push(i(p,{channelCount:g.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:g.channelCount}));const k=[];if(void 0!==m.parameterDescriptors)for(const{defaultValue:t,maxValue:e,minValue:n,name:r}of m.parameterDescriptors){const i=o(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:void 0!==g.parameterData[r]?g.parameterData[r]:void 0===t?0:t});Object.defineProperties(i.offset,{defaultValue:{get:()=>void 0===t?0:t},maxValue:{get:()=>void 0===e?Qs:e},minValue:{get:()=>void 0===n?Ks:n}}),k.push(i)}const S=r(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,y+b)}),A=nu(f,p.sampleRate),E=a(p,A,y+b,Math.max(1,v)),O=i(p,{channelCount:Math.max(1,v),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,v)}),C=[];for(let t=0;t<g.numberOfOutputs;t+=1)C.push(r(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:_[t]}));for(let t=0;t<g.numberOfInputs;t+=1){x[t].connect(T[t]);for(let e=0;e<g.channelCount;e+=1)T[t].connect(S,e,t*g.channelCount+e)}const M=new Ea(void 0===m.parameterDescriptors?[]:m.parameterDescriptors.map(({name:t},e)=>{const n=k[e];return n.connect(S,0,y+e),n.start(0),[t,n.offset]}));S.connect(E);let N=g.channelInterpretation,I=null;const j=0===g.numberOfOutputs?[E]:C,R={get bufferSize(){return A},get channelCount(){return g.channelCount},set channelCount(t){throw n()},get channelCountMode(){return g.channelCountMode},set channelCountMode(t){throw n()},get channelInterpretation(){return N},set channelInterpretation(t){for(const e of x)e.channelInterpretation=t;N=t},get context(){return E.context},get inputs(){return x},get numberOfInputs(){return g.numberOfInputs},get numberOfOutputs(){return g.numberOfOutputs},get onprocessorerror(){return I},set onprocessorerror(t){"function"==typeof I&&R.removeEventListener("processorerror",I),I="function"==typeof t?t:null,"function"==typeof I&&R.addEventListener("processorerror",I)},get parameters(){return M},get port(){return w.port2},addEventListener:(...t)=>E.addEventListener(t[0],t[1],t[2]),connect:t.bind(null,j),disconnect:c.bind(null,j),dispatchEvent:(...t)=>E.dispatchEvent(t[0]),removeEventListener:(...t)=>E.removeEventListener(t[0],t[1],t[2])},P=new Map;var D,L;w.port1.addEventListener=(D=w.port1.addEventListener,(...t)=>{if("message"===t[0]){const e="function"==typeof t[1]?t[1]:"object"==typeof t[1]&&null!==t[1]&&"function"==typeof t[1].handleEvent?t[1].handleEvent:null;if(null!==e){const n=P.get(t[1]);void 0!==n?t[1]=n:(t[1]=t=>{l(p.currentTime,p.sampleRate,()=>e(t))},P.set(e,t[1]))}}return D.call(w.port1,t[0],t[1],t[2])}),w.port1.removeEventListener=(L=w.port1.removeEventListener,(...t)=>{if("message"===t[0]){const e=P.get(t[1]);void 0!==e&&(P.delete(t[1]),t[1]=e)}return L.call(w.port1,t[0],t[1],t[2])});let F=null;Object.defineProperty(w.port1,"onmessage",{get:()=>F,set:t=>{"function"==typeof F&&w.port1.removeEventListener("message",F),F="function"==typeof t?t:null,"function"==typeof F&&(w.port1.addEventListener("message",F),w.port1.start())}}),m.prototype.port=w.port1;let $=null;const B=((t,e,n,r)=>{let i=Ms.get(t);void 0===i&&(i=new WeakMap,Ms.set(t,i));const o=ru(n,r);return i.set(e,o),o})(p,R,m,g);B.then(t=>$=t);const q=Na(g.numberOfInputs,g.channelCount),U=Na(g.numberOfOutputs,_),V=void 0===m.parameterDescriptors?[]:m.parameterDescriptors.reduce((t,{name:e})=>({...t,[e]:new Float32Array(128)}),{});let G=!0;const z=()=>{g.numberOfOutputs>0&&E.disconnect(O);for(let t=0,e=0;t<g.numberOfOutputs;t+=1){const n=C[t];for(let r=0;r<_[t];r+=1)O.disconnect(n,e+r,r);e+=_[t]}},W=new Map;E.onaudioprocess=({inputBuffer:t,outputBuffer:e})=>{if(null!==$){const n=h(R);for(let r=0;r<A;r+=128){for(let e=0;e<g.numberOfInputs;e+=1)for(let n=0;n<g.channelCount;n+=1)Ca(t,q[e],n,n,r);void 0!==m.parameterDescriptors&&m.parameterDescriptors.forEach(({name:e},n)=>{Ca(t,V,e,y+n,r)});for(let t=0;t<g.numberOfInputs;t+=1)for(let e=0;e<_[t];e+=1)0===U[t][e].byteLength&&(U[t][e]=new Float32Array(128));try{const t=q.map((t,e)=>{if(n[e].size>0)return W.set(e,A/128),t;const r=W.get(e);return void 0===r?[]:(t.every(t=>t.every(t=>0===t))&&(1===r?W.delete(e):W.set(e,r-1)),t)}),i=l(p.currentTime+r/p.sampleRate,p.sampleRate,()=>$.process(t,U,V));G=i;for(let t=0,n=0;t<g.numberOfOutputs;t+=1){for(let i=0;i<_[t];i+=1)Ma(e,U[t],i,n+i,r);n+=_[t]}}catch(t){G=!1,R.dispatchEvent(new ErrorEvent("processorerror",{colno:t.colno,filename:t.filename,lineno:t.lineno,message:t.message}))}if(!G){for(let t=0;t<g.numberOfInputs;t+=1){x[t].disconnect(T[t]);for(let e=0;e<g.channelCount;e+=1)T[r].disconnect(S,e,t*g.channelCount+e)}if(void 0!==m.parameterDescriptors){const t=m.parameterDescriptors.length;for(let e=0;e<t;e+=1){const t=k[e];t.disconnect(S,0,y+e),t.stop()}}S.disconnect(E),E.onaudioprocess=null,J?z():K();break}}}};let J=!1;const H=s(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0}),X=()=>E.connect(H).connect(p.destination),K=()=>{E.disconnect(H),H.disconnect()};return X(),d(R,()=>{if(G){K(),g.numberOfOutputs>0&&E.connect(O);for(let t=0,e=0;t<g.numberOfOutputs;t+=1){const n=C[t];for(let r=0;r<_[t];r+=1)O.connect(n,e+r,r);e+=_[t]}}J=!0},()=>{G&&(X(),z()),J=!1})})(Il,Js,Va,Sc,ou,Nc,uu,du,pu,Rl,_l,Dl,Tc),Fl=((t,e,n,r,i)=>(o,s,a,u,c,l)=>{if(null!==a)try{const e=new a(o,u,l),r=new Map;let s=null;if(Object.defineProperties(e,{channelCount:{get:()=>l.channelCount,set:()=>{throw t()}},channelCountMode:{get:()=>"explicit",set:()=>{throw t()}},onprocessorerror:{get:()=>s,set:t=>{"function"==typeof s&&e.removeEventListener("processorerror",s),s="function"==typeof t?t:null,"function"==typeof s&&e.addEventListener("processorerror",s)}}}),e.addEventListener=(d=e.addEventListener,(...t)=>{if("processorerror"===t[0]){const e="function"==typeof t[1]?t[1]:"object"==typeof t[1]&&null!==t[1]&&"function"==typeof t[1].handleEvent?t[1].handleEvent:null;if(null!==e){const n=r.get(t[1]);void 0!==n?t[1]=n:(t[1]=n=>{"error"===n.type?(Object.defineProperties(n,{type:{value:"processorerror"}}),e(n)):e(new ErrorEvent(t[0],{...n}))},r.set(e,t[1]))}}return d.call(e,"error",t[1],t[2]),d.call(e,...t)}),e.removeEventListener=(h=e.removeEventListener,(...t)=>{if("processorerror"===t[0]){const e=r.get(t[1]);void 0!==e&&(r.delete(t[1]),t[1]=e)}return h.call(e,"error",t[1],t[2]),h.call(e,t[0],t[1],t[2])}),0!==l.numberOfOutputs){const t=n(o,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});e.connect(t).connect(o.destination);return i(e,()=>t.disconnect(),()=>t.connect(o.destination))}return e}catch(t){if(11===t.code)throw r();throw t}var h,d;if(void 0===c)throw r();return(t=>{const{port1:e}=new MessageChannel;try{e.postMessage(t)}finally{e.close()}})(l),e(o,s,c,l)})(Va,Ll,uu,pu,Tc),$l=((t,e,n,r,i,o,s,a,u,c,l,h,d,p,f,m)=>(g,_,y)=>{const v=new WeakMap;let b=null;return{render(w,x){a(x,w);const T=v.get(x);return void 0!==T?Promise.resolve(T):(async(a,w)=>{let x=l(a),T=null;const k=zs(x,w),S=Array.isArray(_.outputChannelCount)?_.outputChannelCount:Array.from(_.outputChannelCount);if(null===h){const t=S.reduce((t,e)=>t+e,0),n=i(w,{channelCount:Math.max(1,t),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,t)}),o=[];for(let t=0;t<a.numberOfOutputs;t+=1)o.push(r(w,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:S[t]}));const c=s(w,{channelCount:_.channelCount,channelCountMode:_.channelCountMode,channelInterpretation:_.channelInterpretation,gain:1});c.connect=e.bind(null,o),c.disconnect=u.bind(null,o),T=[n,o,c]}else k||(x=new h(w,g));if(v.set(w,null===T?x:T[2]),null!==T){if(null===b){if(void 0===y)throw new Error("Missing the processor constructor.");if(null===d)throw new Error("Missing the native OfflineAudioContext constructor.");const t=a.channelCount*a.numberOfInputs,e=void 0===y.parameterDescriptors?0:y.parameterDescriptors.length,n=t+e,u=async()=>{const u=new d(n,128*Math.ceil(a.context.length/128),w.sampleRate),c=[],l=[];for(let t=0;t<_.numberOfInputs;t+=1)c.push(s(u,{channelCount:_.channelCount,channelCountMode:_.channelCountMode,channelInterpretation:_.channelInterpretation,gain:1})),l.push(i(u,{channelCount:_.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:_.channelCount}));const h=await Promise.all(Array.from(a.parameters.values()).map(async t=>{const e=o(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:t.value});return await p(u,t,e.offset),e})),g=r(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,t+e)});for(let t=0;t<_.numberOfInputs;t+=1){c[t].connect(l[t]);for(let e=0;e<_.channelCount;e+=1)l[t].connect(g,e,t*_.channelCount+e)}for(const[e,n]of h.entries())n.connect(g,0,t+e),n.start(0);return g.connect(u.destination),await Promise.all(c.map(t=>f(a,u,t))),m(u)};b=Ia(a,0===n?null:await u(),w,_,S,y,c)}const t=await b,e=n(w,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[u,l,h]=T;null!==t&&(e.buffer=t,e.start(0)),e.connect(u);for(let t=0,e=0;t<a.numberOfOutputs;t+=1){const n=l[t];for(let r=0;r<S[t];r+=1)u.connect(n,e+r,r);e+=S[t]}return h}if(k)for(const[e,n]of a.parameters.entries())await t(w,n,x.parameters.get(e));else for(const[t,e]of a.parameters.entries())await p(w,e,x.parameters.get(t));return await f(a,w,x),x})(w,x)}}})(dc,Il,pc,Sc,ou,Nc,uu,jl,Rl,_l,ga,Yu,zu,fc,qu,zc),Bl=(t=>e=>t.get(e))(yl),ql=(t=>(e,n)=>{t.set(e,n)})(Pl),Ul=gl?((t,e,n,r,i,o,s,a,u,c,l,h,d,p)=>class extends e{constructor(e,p,f){var m;const g=a(e),_=u(g),y=l({...Oa,...f});d(y);const v=Cs.get(g),b=null==v?void 0:v.get(p),w=_||"closed"!==g.state?g:null!==(m=s(g))&&void 0!==m?m:g,x=i(w,_?null:e.baseLatency,c,p,b,y);super(e,!0,x,_?r(p,y,b):null);const T=[];x.parameters.forEach((t,e)=>{const r=n(this,_,t);T.push([e,r])}),this._nativeAudioWorkletNode=x,this._onprocessorerror=null,this._parameters=new Ea(T),_&&t(g,this);const{activeInputs:k}=o(this);h(x,k)}get onprocessorerror(){return this._onprocessorerror}set onprocessorerror(t){const e="function"==typeof t?p(this,t):null;this._nativeAudioWorkletNode.onprocessorerror=e;const n=this._nativeAudioWorkletNode.onprocessorerror;this._onprocessorerror=null!==n&&n===e?t:n}get parameters(){return null===this._parameters?this._nativeAudioWorkletNode.parameters:this._parameters}get port(){return this._nativeAudioWorkletNode.port}})(Nl,tc,gc,$l,Fl,ta,Bl,Vu,Wu,Yu,t=>({...t,outputChannelCount:void 0!==t.outputChannelCount?t.outputChannelCount:1===t.numberOfInputs&&1===t.numberOfOutputs?[t.channelCount]:Array.from({length:t.numberOfOutputs},()=>1)}),ql,t=>{const{port1:e,port2:n}=new MessageChannel;try{e.postMessage(t)}finally{e.close(),n.close()}},Cu):void 0,Vl=(((t,e,n,r,i)=>{})(Va,pu,vu,Qc,Xu),((t,e)=>(n,r,i)=>{if(null===e)throw new Error("Missing the native OfflineAudioContext constructor.");try{return new e(n,r,i)}catch(e){if("SyntaxError"===e.name)throw t();throw e}})(pu,zu)),Gl=((t,e,n,r,i,o,s,a)=>(u,c)=>n(u).render(u,c).then(()=>Promise.all(Array.from(r(c)).map(t=>n(t).render(t,c)))).then(()=>i(c)).then(n=>("function"!=typeof n.copyFromChannel?(s(n),Hs(n)):e(o,()=>o(n))||a(n),t.add(n),n)))(rc,Pu,Bu,Ml,zc,Ws,ac,uc),zl=(((t,e,n,r,i)=>{})(Pu,Va,Vl,Qc,Gl),((t,e,n,r,i)=>class extends t{constructor(t,n,i){let o;if("number"==typeof t&&void 0!==n&&void 0!==i)o={length:n,numberOfChannels:t,sampleRate:i};else{if("object"!=typeof t)throw new Error("The given parameters are not valid.");o=t}const{length:s,numberOfChannels:a,sampleRate:u}={...fu,...o},c=r(a,s,u);e(Ha,()=>Ha(c))||c.addEventListener("statechange",(()=>{let t=0;const e=n=>{"running"===this._state&&(t>0?(c.removeEventListener("statechange",e),n.stopImmediatePropagation(),this._waitForThePromiseToSettle(n)):t+=1)};return e})()),super(c,a),this._length=s,this._nativeOfflineAudioContext=c,this._state=null}get length(){return void 0===this._nativeOfflineAudioContext.length?this._length:this._nativeOfflineAudioContext.length}get state(){return null===this._state?this._nativeOfflineAudioContext.state:this._state}startRendering(){return"running"===this._state?Promise.reject(n()):(this._state="running",i(this.destination,this._nativeOfflineAudioContext).finally(()=>{this._state=null,ra(this)}))}_waitForThePromiseToSettle(t){null===this._state?this._nativeOfflineAudioContext.dispatchEvent(t):setTimeout(()=>this._waitForThePromiseToSettle(t))}})(Tl,Pu,Va,Vl,Gl)),Wl=((t,e)=>n=>{const r=t.get(n);return e(r)||e(n)})(As,Ku),Jl=((t,e)=>n=>t.has(n)||e(n))(Ts,Qu),Hl=((t,e)=>n=>t.has(n)||e(n))(Ss,Zu),Xl=((t,e)=>n=>{const r=t.get(n);return e(r)||e(n)})(As,Wu);function Kl(t){return Hl(t)}function Ql(t){return Jl(t)}function Zl(t){return Xl(t)}function Yl(t){return Wl(t)}function th(t){return void 0===t}function eh(t){return void 0!==t}function nh(t){return"number"==typeof t}function rh(t){return"[object Object]"===Object.prototype.toString.call(t)&&t.constructor===Object}function ih(t){return Array.isArray(t)}function oh(t){return"string"==typeof t}function sh(t){return oh(t)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(t)}function ah(t,e){return"value"===t||Kl(e)||Ql(e)||function(t){return t instanceof cc}(e)}function uh(t,...e){if(!e.length)return t;const n=e.shift();if(rh(t)&&rh(n))for(const e in n)ah(e,n[e])?t[e]=n[e]:rh(n[e])?(t[e]||Object.assign(t,{[e]:{}}),uh(t[e],n[e])):Object.assign(t,{[e]:n[e]});return uh(t,...e)}function ch(t,e,n=[],r){const i={},o=Array.from(e);if(rh(o[0])&&r&&!Reflect.has(o[0],r)){Object.keys(o[0]).some(e=>Reflect.has(t,e))||(uh(i,{[r]:o[0]}),n.splice(n.indexOf(r),1),o.shift())}if(1===o.length&&rh(o[0]))uh(i,o[0]);else for(let t=0;t<n.length;t++)eh(o[t])&&(i[n[t]]=o[t]);return uh(t,i)}function lh(t,e){return th(t)?e:t}function hh(t,e){return e.forEach(e=>{Reflect.has(t,e)&&delete t[e]}),t}const dh="15.1.22";function ph(t,e){if(!t)throw new Error(e)}function fh(t,e,n=1/0){if(!(e<=t&&t<=n))throw new RangeError(`Value must be within [${e}, ${n}], got: ${t}`)}function mh(t){t.isOffline||"running"===t.state||bh('The AudioContext is "suspended". Invoke Tone.start() from a user action to start the audio.')}let gh=!1,_h=!1;function yh(t){gh=t}let vh=console;function bh(...t){vh.warn(...t)}const wh="object"==typeof self?self:null,xh=wh&&(wh.hasOwnProperty("AudioContext")||wh.hasOwnProperty("webkitAudioContext"));class Th{constructor(){this.debug=!1,this._wasDisposed=!1}static getDefaults(){return{}}log(...t){(this.debug||wh&&this.toString()===wh.TONE_DEBUG_CLASS)&&function(...t){vh.log(...t)}(this,...t)}dispose(){return this._wasDisposed=!0,this}get disposed(){return this._wasDisposed}toString(){return this.name}}Th.version=dh;const kh=1e-6;function Sh(t,e){return t>e+kh}function Ah(t,e){return Sh(t,e)||Oh(t,e)}function Eh(t,e){return t+kh<e}function Oh(t,e){return Math.abs(t-e)<kh}class Ch extends Th{constructor(){super(),this.name="Timeline",this._timeline=[];const t=ch(Ch.getDefaults(),arguments,["memory"]);this.memory=t.memory,this.increasing=t.increasing}static getDefaults(){return{memory:1/0,increasing:!1}}get length(){return this._timeline.length}add(t){if(ph(Reflect.has(t,"time"),"Timeline: events must have a time attribute"),t.time=t.time.valueOf(),this.increasing&&this.length){const e=this._timeline[this.length-1];ph(Ah(t.time,e.time),"The time must be greater than or equal to the last scheduled time"),this._timeline.push(t)}else{const e=this._search(t.time);this._timeline.splice(e+1,0,t)}if(this.length>this.memory){const t=this.length-this.memory;this._timeline.splice(0,t)}return this}remove(t){const e=this._timeline.indexOf(t);return-1!==e&&this._timeline.splice(e,1),this}get(t,e="time"){const n=this._search(t,e);return-1!==n?this._timeline[n]:null}peek(){return this._timeline[0]}shift(){return this._timeline.shift()}getAfter(t,e="time"){const n=this._search(t,e);return n+1<this._timeline.length?this._timeline[n+1]:null}getBefore(t){const e=this._timeline.length;if(e>0&&this._timeline[e-1].time<t)return this._timeline[e-1];const n=this._search(t);return n-1>=0?this._timeline[n-1]:null}cancel(t){if(this._timeline.length>1){let e=this._search(t);if(e>=0)if(Oh(this._timeline[e].time,t)){for(let n=e;n>=0&&Oh(this._timeline[n].time,t);n--)e=n;this._timeline=this._timeline.slice(0,e)}else this._timeline=this._timeline.slice(0,e+1);else this._timeline=[]}else 1===this._timeline.length&&Ah(this._timeline[0].time,t)&&(this._timeline=[]);return this}cancelBefore(t){const e=this._search(t);return e>=0&&(this._timeline=this._timeline.slice(e+1)),this}previousEvent(t){const e=this._timeline.indexOf(t);return e>0?this._timeline[e-1]:null}_search(t,e="time"){if(0===this._timeline.length)return-1;let n=0;const r=this._timeline.length;let i=r;if(r>0&&this._timeline[r-1][e]<=t)return r-1;for(;n<i;){let r=Math.floor(n+(i-n)/2);const o=this._timeline[r],s=this._timeline[r+1];if(Oh(o[e],t)){for(let n=r;n<this._timeline.length;n++){if(!Oh(this._timeline[n][e],t))break;r=n}return r}if(Eh(o[e],t)&&Sh(s[e],t))return r;Sh(o[e],t)?i=r:n=r+1}return-1}_iterate(t,e=0,n=this._timeline.length-1){this._timeline.slice(e,n+1).forEach(t)}forEach(t){return this._iterate(t),this}forEachBefore(t,e){const n=this._search(t);return-1!==n&&this._iterate(e,0,n),this}forEachAfter(t,e){const n=this._search(t);return this._iterate(e,n+1),this}forEachBetween(t,e,n){let r=this._search(t),i=this._search(e);return-1!==r&&-1!==i?(this._timeline[r].time!==t&&(r+=1),this._timeline[i].time===e&&(i-=1),this._iterate(n,r,i)):-1===r&&this._iterate(n,0,i),this}forEachFrom(t,e){let n=this._search(t);for(;n>=0&&this._timeline[n].time>=t;)n--;return this._iterate(e,n+1),this}forEachAtTime(t,e){const n=this._search(t);if(-1!==n&&Oh(this._timeline[n].time,t)){let r=n;for(let e=n;e>=0&&Oh(this._timeline[e].time,t);e--)r=e;this._iterate(t=>{e(t)},r,n)}return this}dispose(){return super.dispose(),this._timeline=[],this}}class Mh{constructor(t,e,n,r){this._callback=t,this._type=e,this._minimumUpdateInterval=Math.max(128/(r||44100),.001),this.updateInterval=n,this._createClock()}_createWorker(){const t=new Blob([`\n\t\t\t// the initial timeout time\n\t\t\tlet timeoutTime = ${(1e3*this._updateInterval).toFixed(1)};\n\t\t\t// onmessage callback\n\t\t\tself.onmessage = function(msg){\n\t\t\t\ttimeoutTime = parseInt(msg.data);\n\t\t\t};\n\t\t\t// the tick function which posts a message\n\t\t\t// and schedules a new tick\n\t\t\tfunction tick(){\n\t\t\t\tsetTimeout(tick, timeoutTime);\n\t\t\t\tself.postMessage('tick');\n\t\t\t}\n\t\t\t// call tick initially\n\t\t\ttick();\n\t\t\t`],{type:"text/javascript"}),e=URL.createObjectURL(t),n=new Worker(e);n.onmessage=this._callback.bind(this),this._worker=n}_createTimeout(){this._timeout=setTimeout(()=>{this._createTimeout(),this._callback()},1e3*this._updateInterval)}_createClock(){if("worker"===this._type)try{this._createWorker()}catch(t){this._type="timeout",this._createClock()}else"timeout"===this._type&&this._createTimeout()}_disposeClock(){this._timeout&&clearTimeout(this._timeout),this._worker&&(this._worker.terminate(),this._worker.onmessage=null)}get updateInterval(){return this._updateInterval}set updateInterval(t){var e;this._updateInterval=Math.max(t,this._minimumUpdateInterval),"worker"===this._type&&(null===(e=this._worker)||void 0===e||e.postMessage(1e3*this._updateInterval))}get type(){return this._type}set type(t){this._disposeClock(),this._type=t,this._createClock()}dispose(){this._disposeClock()}}const Nh=[];function Ih(t){Nh.push(t)}const jh=[];function Rh(t){jh.push(t)}class Ph extends Th{constructor(){super(...arguments),this.name="Emitter"}on(t,e){return t.split(/\W+/).forEach(t=>{th(this._events)&&(this._events={}),this._events.hasOwnProperty(t)||(this._events[t]=[]),this._events[t].push(e)}),this}once(t,e){const n=(...r)=>{e(...r),this.off(t,n)};return this.on(t,n),this}off(t,e){return t.split(/\W+/).forEach(t=>{if(th(this._events)&&(this._events={}),this._events.hasOwnProperty(t))if(th(e))this._events[t]=[];else{const n=this._events[t];for(let t=n.length-1;t>=0;t--)n[t]===e&&n.splice(t,1)}}),this}emit(t,...e){if(this._events&&this._events.hasOwnProperty(t)){const n=this._events[t].slice(0);for(let t=0,r=n.length;t<r;t++)n[t].apply(this,e)}return this}static mixin(t){["on","once","off","emit"].forEach(e=>{const n=Object.getOwnPropertyDescriptor(Ph.prototype,e);Object.defineProperty(t.prototype,e,n)})}dispose(){return super.dispose(),this._events=void 0,this}}class Dh extends Ph{constructor(){super(...arguments),this.isOffline=!1}toJSON(){return{}}}class Lh extends Dh{constructor(){var t,e;super(),this.name="Context",this._constants=new Map,this._timeouts=new Ch,this._timeoutIds=0,this._initialized=!1,this._closeStarted=!1,this.isOffline=!1,this._workletPromise=null;const n=ch(Lh.getDefaults(),arguments,["context"]);n.context?(this._context=n.context,this._latencyHint=(null===(t=arguments[0])||void 0===t?void 0:t.latencyHint)||""):(this._context=function(t){return new Cl(t)}({latencyHint:n.latencyHint}),this._latencyHint=n.latencyHint),this._ticker=new Mh(this.emit.bind(this,"tick"),n.clockSource,n.updateInterval,this._context.sampleRate),this.on("tick",this._timeoutLoop.bind(this)),this._context.onstatechange=()=>{this.emit("statechange",this.state)},this[(null===(e=arguments[0])||void 0===e?void 0:e.hasOwnProperty("updateInterval"))?"_lookAhead":"lookAhead"]=n.lookAhead}static getDefaults(){return{clockSource:"worker",latencyHint:"interactive",lookAhead:.1,updateInterval:.05}}initialize(){var t;return this._initialized||(t=this,Nh.forEach(e=>e(t)),this._initialized=!0),this}createAnalyser(){return this._context.createAnalyser()}createOscillator(){return this._context.createOscillator()}createBufferSource(){return this._context.createBufferSource()}createBiquadFilter(){return this._context.createBiquadFilter()}createBuffer(t,e,n){return this._context.createBuffer(t,e,n)}createChannelMerger(t){return this._context.createChannelMerger(t)}createChannelSplitter(t){return this._context.createChannelSplitter(t)}createConstantSource(){return this._context.createConstantSource()}createConvolver(){return this._context.createConvolver()}createDelay(t){return this._context.createDelay(t)}createDynamicsCompressor(){return this._context.createDynamicsCompressor()}createGain(){return this._context.createGain()}createIIRFilter(t,e){return this._context.createIIRFilter(t,e)}createPanner(){return this._context.createPanner()}createPeriodicWave(t,e,n){return this._context.createPeriodicWave(t,e,n)}createStereoPanner(){return this._context.createStereoPanner()}createWaveShaper(){return this._context.createWaveShaper()}createMediaStreamSource(t){ph(Yl(this._context),"Not available if OfflineAudioContext");return this._context.createMediaStreamSource(t)}createMediaElementSource(t){ph(Yl(this._context),"Not available if OfflineAudioContext");return this._context.createMediaElementSource(t)}createMediaStreamDestination(){ph(Yl(this._context),"Not available if OfflineAudioContext");return this._context.createMediaStreamDestination()}decodeAudioData(t){return this._context.decodeAudioData(t)}get currentTime(){return this._context.currentTime}get state(){return this._context.state}get sampleRate(){return this._context.sampleRate}get listener(){return this.initialize(),this._listener}set listener(t){ph(!this._initialized,"The listener cannot be set after initialization."),this._listener=t}get transport(){return this.initialize(),this._transport}set transport(t){ph(!this._initialized,"The transport cannot be set after initialization."),this._transport=t}get draw(){return this.initialize(),this._draw}set draw(t){ph(!this._initialized,"Draw cannot be set after initialization."),this._draw=t}get destination(){return this.initialize(),this._destination}set destination(t){ph(!this._initialized,"The destination cannot be set after initialization."),this._destination=t}createAudioWorkletNode(t,e){return function(t,e,n){return ph(eh(Ul),"AudioWorkletNode only works in a secure context (https or localhost)"),new(t instanceof(null==wh?void 0:wh.BaseAudioContext)?null==wh?void 0:wh.AudioWorkletNode:Ul)(t,e,n)}(this.rawContext,t,e)}addAudioWorkletModule(t){return a(this,void 0,void 0,function*(){ph(eh(this.rawContext.audioWorklet),"AudioWorkletNode is only available in a secure context (https or localhost)"),this._workletPromise||(this._workletPromise=this.rawContext.audioWorklet.addModule(t)),yield this._workletPromise})}workletsAreReady(){return a(this,void 0,void 0,function*(){(yield this._workletPromise)?this._workletPromise:Promise.resolve()})}get updateInterval(){return this._ticker.updateInterval}set updateInterval(t){this._ticker.updateInterval=t}get clockSource(){return this._ticker.type}set clockSource(t){this._ticker.type=t}get lookAhead(){return this._lookAhead}set lookAhead(t){this._lookAhead=t,this.updateInterval=t?t/2:.01}get latencyHint(){return this._latencyHint}get rawContext(){return this._context}now(){return this._context.currentTime+this._lookAhead}immediate(){return this._context.currentTime}resume(){return Yl(this._context)?this._context.resume():Promise.resolve()}close(){return a(this,void 0,void 0,function*(){var t;Yl(this._context)&&"closed"!==this.state&&!this._closeStarted&&(this._closeStarted=!0,yield this._context.close()),this._initialized&&(t=this,jh.forEach(e=>e(t)))})}getConstant(t){if(this._constants.has(t))return this._constants.get(t);{const e=this._context.createBuffer(1,128,this._context.sampleRate),n=e.getChannelData(0);for(let e=0;e<n.length;e++)n[e]=t;const r=this._context.createBufferSource();return r.channelCount=1,r.channelCountMode="explicit",r.buffer=e,r.loop=!0,r.start(0),this._constants.set(t,r),r}}dispose(){return super.dispose(),this._ticker.dispose(),this._timeouts.dispose(),Object.keys(this._constants).map(t=>this._constants[t].disconnect()),this.close(),this}_timeoutLoop(){const t=this.now();this._timeouts.forEachBefore(t,t=>{t.callback(),this._timeouts.remove(t)})}setTimeout(t,e){this._timeoutIds++;const n=this.now();return this._timeouts.add({callback:t,id:this._timeoutIds,time:n+e}),this._timeoutIds}clearTimeout(t){return this._timeouts.forEach(e=>{e.id===t&&this._timeouts.remove(e)}),this}clearInterval(t){return this.clearTimeout(t)}setInterval(t,e){const n=++this._timeoutIds,r=()=>{const i=this.now();this._timeouts.add({callback:()=>{t(),r()},id:n,time:i+e})};return r(),n}}function Fh(t,e){ih(e)?e.forEach(e=>Fh(t,e)):Object.defineProperty(t,e,{enumerable:!0,writable:!1})}function $h(t,e){ih(e)?e.forEach(e=>$h(t,e)):Object.defineProperty(t,e,{writable:!0})}const Bh=()=>{};class qh extends Th{constructor(){super(),this.name="ToneAudioBuffer",this.onload=Bh;const t=ch(qh.getDefaults(),arguments,["url","onload","onerror"]);this.reverse=t.reverse,this.onload=t.onload,oh(t.url)?this.load(t.url).catch(t.onerror):t.url&&this.set(t.url)}static getDefaults(){return{onerror:Bh,onload:Bh,reverse:!1}}get sampleRate(){return this._buffer?this._buffer.sampleRate:zh().sampleRate}set(t){return t instanceof qh?t.loaded?this._buffer=t.get():t.onload=()=>{this.set(t),this.onload(this)}:this._buffer=t,this._reversed&&this._reverse(),this}get(){return this._buffer}load(t){return a(this,void 0,void 0,function*(){const e=qh.load(t).then(t=>{this.set(t),this.onload(this)});qh.downloads.push(e);try{yield e}finally{const t=qh.downloads.indexOf(e);qh.downloads.splice(t,1)}return this})}dispose(){return super.dispose(),this._buffer=void 0,this}fromArray(t){const e=ih(t)&&t[0].length>0,n=e?t.length:1,r=e?t[0].length:t.length,i=zh(),o=i.createBuffer(n,r,i.sampleRate),s=e||1!==n?t:[t];for(let t=0;t<n;t++)o.copyToChannel(s[t],t);return this._buffer=o,this}toMono(t){if(nh(t))this.fromArray(this.toArray(t));else{let t=new Float32Array(this.length);const e=this.numberOfChannels;for(let n=0;n<e;n++){const e=this.toArray(n);for(let n=0;n<e.length;n++)t[n]+=e[n]}t=t.map(t=>t/e),this.fromArray(t)}return this}toArray(t){if(nh(t))return this.getChannelData(t);if(1===this.numberOfChannels)return this.toArray(0);{const t=[];for(let e=0;e<this.numberOfChannels;e++)t[e]=this.getChannelData(e);return t}}getChannelData(t){return this._buffer?this._buffer.getChannelData(t):new Float32Array(0)}slice(t,e=this.duration){ph(this.loaded,"Buffer is not loaded");const n=Math.floor(t*this.sampleRate),r=Math.floor(e*this.sampleRate);ph(n<r,"The start time must be less than the end time");const i=r-n,o=zh().createBuffer(this.numberOfChannels,i,this.sampleRate);for(let t=0;t<this.numberOfChannels;t++)o.copyToChannel(this.getChannelData(t).subarray(n,r),t);return new qh(o)}_reverse(){if(this.loaded)for(let t=0;t<this.numberOfChannels;t++)this.getChannelData(t).reverse();return this}get loaded(){return this.length>0}get duration(){return this._buffer?this._buffer.duration:0}get length(){return this._buffer?this._buffer.length:0}get numberOfChannels(){return this._buffer?this._buffer.numberOfChannels:0}get reverse(){return this._reversed}set reverse(t){this._reversed!==t&&(this._reversed=t,this._reverse())}static fromArray(t){return(new qh).fromArray(t)}static fromUrl(t){return a(this,void 0,void 0,function*(){const e=new qh;return yield e.load(t)})}static load(t){return a(this,void 0,void 0,function*(){const e=""===qh.baseUrl||qh.baseUrl.endsWith("/")?qh.baseUrl:qh.baseUrl+"/",n=yield fetch(e+t);if(!n.ok)throw new Error(`could not load url: ${t}`);const r=yield n.arrayBuffer();return yield zh().decodeAudioData(r)})}static supportsType(t){const e=t.split("."),n=e[e.length-1];return""!==document.createElement("audio").canPlayType("audio/"+n)}static loaded(){return a(this,void 0,void 0,function*(){for(yield Promise.resolve();qh.downloads.length;)yield qh.downloads[0]})}}qh.baseUrl="",qh.downloads=[];class Uh extends Lh{constructor(){var t,e,n;super({clockSource:"offline",context:Zl(arguments[0])?arguments[0]:(t=arguments[0],e=arguments[1]*arguments[2],n=arguments[2],new zl(t,e,n)),lookAhead:0,updateInterval:Zl(arguments[0])?128/arguments[0].sampleRate:128/arguments[2]}),this.name="OfflineContext",this._currentTime=0,this.isOffline=!0,this._duration=Zl(arguments[0])?arguments[0].length/arguments[0].sampleRate:arguments[1]}now(){return this._currentTime}get currentTime(){return this._currentTime}_renderClock(t){return a(this,void 0,void 0,function*(){let e=0;for(;this._duration-this._currentTime>=0;){this.emit("tick"),this._currentTime+=128/this.sampleRate,e++;const n=Math.floor(this.sampleRate/128);t&&e%n===0&&(yield new Promise(t=>setTimeout(t,1)))}})}render(){return a(this,arguments,void 0,function*(t=!0){yield this.workletsAreReady(),yield this._renderClock(t);const e=yield this._context.startRendering();return new qh(e)})}close(){return Promise.resolve()}}const Vh=new class extends Dh{constructor(){super(...arguments),this.lookAhead=0,this.latencyHint=0,this.isOffline=!1}createAnalyser(){return{}}createOscillator(){return{}}createBufferSource(){return{}}createBiquadFilter(){return{}}createBuffer(t,e,n){return{}}createChannelMerger(t){return{}}createChannelSplitter(t){return{}}createConstantSource(){return{}}createConvolver(){return{}}createDelay(t){return{}}createDynamicsCompressor(){return{}}createGain(){return{}}createIIRFilter(t,e){return{}}createPanner(){return{}}createPeriodicWave(t,e,n){return{}}createStereoPanner(){return{}}createWaveShaper(){return{}}createMediaStreamSource(t){return{}}createMediaElementSource(t){return{}}createMediaStreamDestination(){return{}}decodeAudioData(t){return Promise.resolve({})}createAudioWorkletNode(t,e){return{}}get rawContext(){return{}}addAudioWorkletModule(t){return a(this,void 0,void 0,function*(){return Promise.resolve()})}resume(){return Promise.resolve()}setTimeout(t,e){return 0}clearTimeout(t){return this}setInterval(t,e){return 0}clearInterval(t){return this}getConstant(t){return{}}get currentTime(){return 0}get state(){return{}}get sampleRate(){return 0}get listener(){return{}}get transport(){return{}}get draw(){return{}}set draw(t){}get destination(){return{}}set destination(t){}now(){return 0}immediate(){return 0}};let Gh=Vh;function zh(){return Gh===Vh&&xh&&function(t,e=!1){e&&Gh.dispose();Gh=Yl(t)?new Lh(t):Zl(t)?new Uh(t):t}(new Lh),Gh}if(wh&&!wh.TONE_SILENCE_LOGGING){0}class Wh extends Th{constructor(t,e,n){super(),this.defaultUnits="s",this._val=e,this._units=n,this.context=t,this._expressions=this._getExpressions()}_getExpressions(){return{hz:{method:t=>this._frequencyToUnits(parseFloat(t)),regexp:/^(\d+(?:\.\d+)?)hz$/i},i:{method:t=>this._ticksToUnits(parseInt(t,10)),regexp:/^(\d+)i$/i},m:{method:t=>this._beatsToUnits(parseInt(t,10)*this._getTimeSignature()),regexp:/^(\d+)m$/i},n:{method:(t,e)=>{const n=parseInt(t,10),r="."===e?1.5:1;return 1===n?this._beatsToUnits(this._getTimeSignature())*r:this._beatsToUnits(4/n)*r},regexp:/^(\d+)n(\.?)$/i},number:{method:t=>this._expressions[this.defaultUnits].method.call(this,t),regexp:/^(\d+(?:\.\d+)?)$/},s:{method:t=>this._secondsToUnits(parseFloat(t)),regexp:/^(\d+(?:\.\d+)?)s$/},samples:{method:t=>parseInt(t,10)/this.context.sampleRate,regexp:/^(\d+)samples$/},t:{method:t=>{const e=parseInt(t,10);return this._beatsToUnits(8/(3*Math.floor(e)))},regexp:/^(\d+)t$/i},tr:{method:(t,e,n)=>{let r=0;return t&&"0"!==t&&(r+=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(r+=this._beatsToUnits(parseFloat(e))),n&&"0"!==n&&(r+=this._beatsToUnits(parseFloat(n)/4)),r},regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/}}}valueOf(){if(this._val instanceof Wh&&this.fromType(this._val),th(this._val))return this._noArg();if(oh(this._val)&&th(this._units)){for(const t in this._expressions)if(this._expressions[t].regexp.test(this._val.trim())){this._units=t;break}}else if(rh(this._val)){let t=0;for(const e in this._val)if(eh(this._val[e])){const n=this._val[e];t+=new this.constructor(this.context,e).valueOf()*n}return t}if(eh(this._units)){const t=this._expressions[this._units],e=this._val.toString().trim().match(t.regexp);return e?t.method.apply(this,e.slice(1)):t.method.call(this,this._val)}return oh(this._val)?parseFloat(this._val):this._val}_frequencyToUnits(t){return 1/t}_beatsToUnits(t){return 60/this._getBpm()*t}_secondsToUnits(t){return t}_ticksToUnits(t){return t*this._beatsToUnits(1)/this._getPPQ()}_noArg(){return this._now()}_getBpm(){return this.context.transport.bpm.value}_getTimeSignature(){return this.context.transport.timeSignature}_getPPQ(){return this.context.transport.PPQ}fromType(t){switch(this._units=void 0,this.defaultUnits){case"s":this._val=t.toSeconds();break;case"i":this._val=t.toTicks();break;case"hz":this._val=t.toFrequency();break;case"midi":this._val=t.toMidi()}return this}toFrequency(){return 1/this.toSeconds()}toSamples(){return this.toSeconds()*this.context.sampleRate}toMilliseconds(){return 1e3*this.toSeconds()}}class Jh extends Wh{constructor(){super(...arguments),this.name="TimeClass"}_getExpressions(){return Object.assign(super._getExpressions(),{now:{method:t=>this._now()+new this.constructor(this.context,t).valueOf(),regexp:/^\+(.+)/},quantize:{method:t=>{const e=new Jh(this.context,t).valueOf();return this._secondsToUnits(this.context.transport.nextSubdivision(e))},regexp:/^@(.+)/}})}quantize(t,e=1){const n=new this.constructor(this.context,t).valueOf(),r=this.valueOf();return r+(Math.round(r/n)*n-r)*e}toNotation(){const t=this.toSeconds(),e=["1m"];for(let t=1;t<9;t++){const n=Math.pow(2,t);e.push(n+"n."),e.push(n+"n"),e.push(n+"t")}e.push("0");let n=e[0],r=new Jh(this.context,e[0]).toSeconds();return e.forEach(e=>{const i=new Jh(this.context,e).toSeconds();Math.abs(i-t)<Math.abs(r-t)&&(n=e,r=i)}),n}toBarsBeatsSixteenths(){const t=this._beatsToUnits(1);let e=this.valueOf()/t;e=parseFloat(e.toFixed(4));const n=Math.floor(e/this._getTimeSignature());let r=e%1*4;e=Math.floor(e)%this._getTimeSignature();const i=r.toString();i.length>3&&(r=parseFloat(parseFloat(i).toFixed(3)));return[n,e,r].join(":")}toTicks(){const t=this._beatsToUnits(1);return this.valueOf()/t*this._getPPQ()}toSeconds(){return this.valueOf()}toMidi(){return _s(this.toFrequency())}_now(){return this.context.now()}}class Hh extends Jh{constructor(){super(...arguments),this.name="Frequency",this.defaultUnits="hz"}static get A4(){return gs}static set A4(t){!function(t){gs=t}(t)}_getExpressions(){return Object.assign({},super._getExpressions(),{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method(t){return"midi"===this.defaultUnits?t:Hh.mtof(t)}},note:{regexp:/^([a-g]{1}(?:b|#|##|x|bb|###|#x|x#|bbb)?)(-?[0-9]+)/i,method(t,e){const n=Xh[t.toLowerCase()]+12*(parseInt(e,10)+1);return"midi"===this.defaultUnits?n:Hh.mtof(n)}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method(t,e,n){let r=1;return t&&"0"!==t&&(r*=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(r*=this._beatsToUnits(parseFloat(e))),n&&"0"!==n&&(r*=this._beatsToUnits(parseFloat(n)/4)),r}}})}transpose(t){return new Hh(this.context,this.valueOf()*ms(t))}harmonize(t){return t.map(t=>this.transpose(t))}toMidi(){return _s(this.valueOf())}toNote(){const t=this.toFrequency(),e=Math.log2(t/Hh.A4);let n=Math.round(12*e)+57;const r=Math.floor(n/12);r<0&&(n+=-12*r);return Kh[n%12]+r.toString()}toSeconds(){return 1/super.toSeconds()}toTicks(){const t=this._beatsToUnits(1),e=this.valueOf()/t;return Math.floor(e*this._getPPQ())}_noArg(){return 0}_frequencyToUnits(t){return t}_ticksToUnits(t){return 1/(60*t/(this._getBpm()*this._getPPQ()))}_beatsToUnits(t){return 1/super._beatsToUnits(t)}_secondsToUnits(t){return 1/t}static mtof(t){return vs(t)}static ftom(t){return _s(t)}}const Xh={cbbb:-3,cbb:-2,cb:-1,c:0,"c#":1,cx:2,"c##":2,"c###":3,"cx#":3,"c#x":3,dbbb:-1,dbb:0,db:1,d:2,"d#":3,dx:4,"d##":4,"d###":5,"dx#":5,"d#x":5,ebbb:1,ebb:2,eb:3,e:4,"e#":5,ex:6,"e##":6,"e###":7,"ex#":7,"e#x":7,fbbb:2,fbb:3,fb:4,f:5,"f#":6,fx:7,"f##":7,"f###":8,"fx#":8,"f#x":8,gbbb:4,gbb:5,gb:6,g:7,"g#":8,gx:9,"g##":9,"g###":10,"gx#":10,"g#x":10,abbb:6,abb:7,ab:8,a:9,"a#":10,ax:11,"a##":11,"a###":12,"ax#":12,"a#x":12,bbbb:8,bbb:9,bb:10,b:11,"b#":12,bx:13,"b##":13,"b###":14,"bx#":14,"b#x":14},Kh=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];class Qh extends Jh{constructor(){super(...arguments),this.name="TransportTime"}_now(){return this.context.transport.seconds}}class Zh extends Th{constructor(){super();const t=ch(Zh.getDefaults(),arguments,["context"]);this.defaultContext?this.context=this.defaultContext:this.context=t.context}static getDefaults(){return{context:zh()}}now(){return this.context.currentTime+this.context.lookAhead}immediate(){return this.context.currentTime}get sampleTime(){return 1/this.context.sampleRate}get blockTime(){return 128/this.context.sampleRate}toSeconds(t){return function(t){th(t)&&gh&&!_h&&(_h=!0,bh("Events scheduled inside of scheduled callbacks should use the passed in scheduling time. See https://github.com/Tonejs/Tone.js/wiki/Accurate-Timing"))}(t),new Jh(this.context,t).toSeconds()}toFrequency(t){return new Hh(this.context,t).toFrequency()}toTicks(t){return new Qh(this.context,t).toTicks()}_getPartialProperties(t){const e=this.get();return Object.keys(e).forEach(n=>{th(t[n])&&delete e[n]}),e}get(){const t=this.constructor.getDefaults();return Object.keys(t).forEach(e=>{if(Reflect.has(this,e)){const n=this[e];eh(n)&&eh(n.value)&&eh(n.setValueAtTime)?t[e]=n.value:n instanceof Zh?t[e]=n._getPartialProperties(t[e]):ih(n)||nh(n)||oh(n)||"boolean"==typeof n?t[e]=n:delete t[e]}}),t}set(t){return Object.keys(t).forEach(e=>{Reflect.has(this,e)&&eh(this[e])&&(this[e]&&eh(this[e].value)&&eh(this[e].setValueAtTime)?this[e].value!==t[e]&&(this[e].value=t[e]):this[e]instanceof Zh?this[e].set(t[e]):this[e]=t[e])}),this}}class Yh extends Zh{constructor(){const t=ch(Yh.getDefaults(),arguments,["param","units","convert"]);for(super(t),this.name="Param",this.overridden=!1,this._minOutput=1e-7,ph(eh(t.param)&&(Kl(t.param)||t.param instanceof Yh),"param must be an AudioParam");!Kl(t.param);)t.param=t.param._param;this._swappable=!!eh(t.swappable)&&t.swappable,this._swappable?(this.input=this.context.createGain(),this._param=t.param,this.input.connect(this._param)):this._param=this.input=t.param,this._events=new Ch(1e3),this._initialValue=this._param.defaultValue,this.units=t.units,this.convert=t.convert,this._minValue=t.minValue,this._maxValue=t.maxValue,eh(t.value)&&t.value!==this._toType(this._initialValue)&&this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(Zh.getDefaults(),{convert:!0,units:"number"})}get value(){const t=this.now();return this.getValueAtTime(t)}set value(t){this.cancelScheduledValues(this.now()),this.setValueAtTime(t,this.now())}get minValue(){return eh(this._minValue)?this._minValue:"time"===this.units||"frequency"===this.units||"normalRange"===this.units||"positive"===this.units||"transportTime"===this.units||"ticks"===this.units||"bpm"===this.units||"hertz"===this.units||"samples"===this.units?0:"audioRange"===this.units?-1:"decibels"===this.units?-1/0:this._param.minValue}get maxValue(){return eh(this._maxValue)?this._maxValue:"normalRange"===this.units||"audioRange"===this.units?1:this._param.maxValue}_is(t,e){return this.units===e}_assertRange(t){return eh(this.maxValue)&&eh(this.minValue)&&fh(t,this._fromType(this.minValue),this._fromType(this.maxValue)),t}_fromType(t){return this.convert&&!this.overridden?this._is(t,"time")?this.toSeconds(t):this._is(t,"decibels")?(e=t,Math.pow(10,e/20)):this._is(t,"frequency")?this.toFrequency(t):t:this.overridden?0:t;var e}_toType(t){return this.convert&&"decibels"===this.units?(e=t,Math.log(e)/Math.LN10*20):t;var e}setValueAtTime(t,e){const n=this.toSeconds(e),r=this._fromType(t);return ph(isFinite(r)&&isFinite(n),`Invalid argument(s) to setValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(r),this.log(this.units,"setValueAtTime",t,n),this._events.add({time:n,type:"setValueAtTime",value:r}),this._param.setValueAtTime(r,n),this}getValueAtTime(t){const e=Math.max(this.toSeconds(t),0),n=this._events.getAfter(e),r=this._events.get(e);let i=this._initialValue;if(null===r)i=this._initialValue;else if("setTargetAtTime"!==r.type||null!==n&&"setValueAtTime"!==n.type)if(null===n)i=r.value;else if("linearRampToValueAtTime"===n.type||"exponentialRampToValueAtTime"===n.type){let t=r.value;if("setTargetAtTime"===r.type){const e=this._events.getBefore(r.time);t=null===e?this._initialValue:e.value}i="linearRampToValueAtTime"===n.type?this._linearInterpolate(r.time,t,n.time,n.value,e):this._exponentialInterpolate(r.time,t,n.time,n.value,e)}else i=r.value;else{const t=this._events.getBefore(r.time);let n;n=null===t?this._initialValue:t.value,"setTargetAtTime"===r.type&&(i=this._exponentialApproach(r.time,n,r.value,r.constant,e))}return this._toType(i)}setRampPoint(t){t=this.toSeconds(t);let e=this.getValueAtTime(t);return this.cancelAndHoldAtTime(t),0===this._fromType(e)&&(e=this._toType(this._minOutput)),this.setValueAtTime(e,t),this}linearRampToValueAtTime(t,e){const n=this._fromType(t),r=this.toSeconds(e);return ph(isFinite(n)&&isFinite(r),`Invalid argument(s) to linearRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(n),this._events.add({time:r,type:"linearRampToValueAtTime",value:n}),this.log(this.units,"linearRampToValueAtTime",t,r),this._param.linearRampToValueAtTime(n,r),this}exponentialRampToValueAtTime(t,e){let n=this._fromType(t);n=Oh(n,0)?this._minOutput:n,this._assertRange(n);const r=this.toSeconds(e);return ph(isFinite(n)&&isFinite(r),`Invalid argument(s) to exponentialRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({time:r,type:"exponentialRampToValueAtTime",value:n}),this.log(this.units,"exponentialRampToValueAtTime",t,r),this._param.exponentialRampToValueAtTime(n,r),this}exponentialRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialRampToValueAtTime(t,n+this.toSeconds(e)),this}linearRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.linearRampToValueAtTime(t,n+this.toSeconds(e)),this}targetRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialApproachValueAtTime(t,n,e),this}exponentialApproachValueAtTime(t,e,n){e=this.toSeconds(e),n=this.toSeconds(n);const r=Math.log(n+1)/Math.log(200);return this.setTargetAtTime(t,e,r),this.cancelAndHoldAtTime(e+.9*n),this.linearRampToValueAtTime(t,e+n),this}setTargetAtTime(t,e,n){const r=this._fromType(t);ph(isFinite(n)&&n>0,"timeConstant must be a number greater than 0");const i=this.toSeconds(e);return this._assertRange(r),ph(isFinite(r)&&isFinite(i),`Invalid argument(s) to setTargetAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({constant:n,time:i,type:"setTargetAtTime",value:r}),this.log(this.units,"setTargetAtTime",t,i,n),this._param.setTargetAtTime(r,i,n),this}setValueCurveAtTime(t,e,n,r=1){n=this.toSeconds(n),e=this.toSeconds(e);const i=this._fromType(t[0])*r;this.setValueAtTime(this._toType(i),e);const o=n/(t.length-1);for(let n=1;n<t.length;n++){const i=this._fromType(t[n])*r;this.linearRampToValueAtTime(this._toType(i),e+n*o)}return this}cancelScheduledValues(t){const e=this.toSeconds(t);return ph(isFinite(e),`Invalid argument to cancelScheduledValues: ${JSON.stringify(t)}`),this._events.cancel(e),this._param.cancelScheduledValues(e),this.log(this.units,"cancelScheduledValues",e),this}cancelAndHoldAtTime(t){const e=this.toSeconds(t),n=this._fromType(this.getValueAtTime(e));ph(isFinite(e),`Invalid argument to cancelAndHoldAtTime: ${JSON.stringify(t)}`),this.log(this.units,"cancelAndHoldAtTime",e,"value="+n);const r=this._events.get(e),i=this._events.getAfter(e);return r&&Oh(r.time,e)?i?(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time)):(this._param.cancelAndHoldAtTime(e),this._events.cancel(e+this.sampleTime)):i&&(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time),"linearRampToValueAtTime"===i.type?this.linearRampToValueAtTime(this._toType(n),e):"exponentialRampToValueAtTime"===i.type&&this.exponentialRampToValueAtTime(this._toType(n),e)),this._events.add({time:e,type:"setValueAtTime",value:n}),this._param.setValueAtTime(n,e),this}rampTo(t,e=.1,n){return"frequency"===this.units||"bpm"===this.units||"decibels"===this.units?this.exponentialRampTo(t,e,n):this.linearRampTo(t,e,n),this}apply(t){const e=this.context.currentTime;t.setValueAtTime(this.getValueAtTime(e),e);const n=this._events.get(e);if(n&&"setTargetAtTime"===n.type){const r=this._events.getAfter(n.time),i=r?r.time:e+2,o=(i-e)/10;for(let n=e;n<i;n+=o)t.linearRampToValueAtTime(this.getValueAtTime(n),n)}return this._events.forEachAfter(this.context.currentTime,e=>{"cancelScheduledValues"===e.type?t.cancelScheduledValues(e.time):"setTargetAtTime"===e.type?t.setTargetAtTime(e.value,e.time,e.constant):t[e.type](e.value,e.time)}),this}setParam(t){ph(this._swappable,"The Param must be assigned as 'swappable' in the constructor");const e=this.input;return e.disconnect(this._param),this.apply(t),this._param=t,e.connect(this._param),this}dispose(){return super.dispose(),this._events.dispose(),this}get defaultValue(){return this._toType(this._param.defaultValue)}_exponentialApproach(t,e,n,r,i){return n+(e-n)*Math.exp(-(i-t)/r)}_linearInterpolate(t,e,n,r,i){return e+(i-t)/(n-t)*(r-e)}_exponentialInterpolate(t,e,n,r,i){return e*Math.pow(r/e,(i-t)/(n-t))}}class td extends Zh{constructor(){super(...arguments),this._internalChannels=[]}get numberOfInputs(){return eh(this.input)?Kl(this.input)||this.input instanceof Yh?1:this.input.numberOfInputs:0}get numberOfOutputs(){return eh(this.output)?this.output.numberOfOutputs:0}_isAudioNode(t){return eh(t)&&(t instanceof td||Ql(t))}_getInternalNodes(){const t=this._internalChannels.slice(0);return this._isAudioNode(this.input)&&t.push(this.input),this._isAudioNode(this.output)&&this.input!==this.output&&t.push(this.output),t}_setChannelProperties(t){this._getInternalNodes().forEach(e=>{e.channelCount=t.channelCount,e.channelCountMode=t.channelCountMode,e.channelInterpretation=t.channelInterpretation})}_getChannelProperties(){const t=this._getInternalNodes();ph(t.length>0,"ToneAudioNode does not have any internal nodes");const e=t[0];return{channelCount:e.channelCount,channelCountMode:e.channelCountMode,channelInterpretation:e.channelInterpretation}}get channelCount(){return this._getChannelProperties().channelCount}set channelCount(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelCount:t}))}get channelCountMode(){return this._getChannelProperties().channelCountMode}set channelCountMode(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelCountMode:t}))}get channelInterpretation(){return this._getChannelProperties().channelInterpretation}set channelInterpretation(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelInterpretation:t}))}connect(t,e=0,n=0){return nd(this,t,e,n),this}toDestination(){return this.connect(this.context.destination),this}toMaster(){return bh("toMaster() has been renamed toDestination()"),this.toDestination()}disconnect(t,e=0,n=0){return rd(this,t,e,n),this}chain(...t){return ed(this,...t),this}fan(...t){return t.forEach(t=>this.connect(t)),this}dispose(){return super.dispose(),eh(this.input)&&(this.input instanceof td?this.input.dispose():Ql(this.input)&&this.input.disconnect()),eh(this.output)&&(this.output instanceof td?this.output.dispose():Ql(this.output)&&this.output.disconnect()),this._internalChannels=[],this}}function ed(...t){const e=t.shift();t.reduce((t,e)=>(t instanceof td?t.connect(e):Ql(t)&&nd(t,e),e),e)}function nd(t,e,n=0,r=0){for(ph(eh(t),"Cannot connect from undefined node"),ph(eh(e),"Cannot connect to undefined node"),(e instanceof td||Ql(e))&&ph(e.numberOfInputs>0,"Cannot connect to node with no inputs"),ph(t.numberOfOutputs>0,"Cannot connect from node with no outputs");e instanceof td||e instanceof Yh;)eh(e.input)&&(e=e.input);for(;t instanceof td;)eh(t.output)&&(t=t.output);Kl(e)?t.connect(e,n):t.connect(e,n,r)}function rd(t,e,n=0,r=0){if(eh(e))for(;e instanceof td;)e=e.input;for(;!Ql(t);)eh(t.output)&&(t=t.output);Kl(e)?t.disconnect(e,n):Ql(e)?t.disconnect(e,n,r):t.disconnect()}class id extends td{constructor(){const t=ch(id.getDefaults(),arguments,["gain","units"]);super(t),this.name="Gain",this._gainNode=this.context.createGain(),this.input=this._gainNode,this.output=this._gainNode,this.gain=new Yh({context:this.context,convert:t.convert,param:this._gainNode.gain,units:t.units,value:t.gain,minValue:t.minValue,maxValue:t.maxValue}),Fh(this,"gain")}static getDefaults(){return Object.assign(td.getDefaults(),{convert:!0,gain:1,units:"gain"})}dispose(){return super.dispose(),this._gainNode.disconnect(),this.gain.dispose(),this}}class od extends td{constructor(t){super(t),this.onended=Bh,this._startTime=-1,this._stopTime=-1,this._timeout=-1,this.output=new id({context:this.context,gain:0}),this._gainNode=this.output,this.getStateAtTime=function(t){const e=this.toSeconds(t);return-1!==this._startTime&&e>=this._startTime&&(-1===this._stopTime||e<=this._stopTime)?"started":"stopped"},this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut,this._curve=t.curve,this.onended=t.onended}static getDefaults(){return Object.assign(td.getDefaults(),{curve:"linear",fadeIn:0,fadeOut:0,onended:Bh})}_startGain(t,e=1){ph(-1===this._startTime,"Source cannot be started more than once");const n=this.toSeconds(this._fadeIn);return this._startTime=t+n,this._startTime=Math.max(this._startTime,this.context.currentTime),n>0?(this._gainNode.gain.setValueAtTime(0,t),"linear"===this._curve?this._gainNode.gain.linearRampToValueAtTime(e,t+n):this._gainNode.gain.exponentialApproachValueAtTime(e,t,n)):this._gainNode.gain.setValueAtTime(e,t),this}stop(t){return this.log("stop",t),this._stopGain(this.toSeconds(t)),this}_stopGain(t){ph(-1!==this._startTime,"'start' must be called before 'stop'"),this.cancelStop();const e=this.toSeconds(this._fadeOut);return this._stopTime=this.toSeconds(t)+e,this._stopTime=Math.max(this._stopTime,this.now()),e>0?"linear"===this._curve?this._gainNode.gain.linearRampTo(0,e,t):this._gainNode.gain.targetRampTo(0,e,t):(this._gainNode.gain.cancelAndHoldAtTime(t),this._gainNode.gain.setValueAtTime(0,t)),this.context.clearTimeout(this._timeout),this._timeout=this.context.setTimeout(()=>{const t="exponential"===this._curve?2*e:0;this._stopSource(this.now()+t),this._onended()},this._stopTime-this.context.currentTime),this}_onended(){if(this.onended!==Bh&&(this.onended(this),this.onended=Bh,!this.context.isOffline)){const t=()=>this.dispose();"undefined"!=typeof requestIdleCallback?requestIdleCallback(t):setTimeout(t,10)}}get state(){return this.getStateAtTime(this.now())}cancelStop(){return this.log("cancelStop"),ph(-1!==this._startTime,"Source is not started"),this._gainNode.gain.cancelScheduledValues(this._startTime+this.sampleTime),this.context.clearTimeout(this._timeout),this._stopTime=-1,this}dispose(){return super.dispose(),this._gainNode.dispose(),this.onended=Bh,this}}class sd extends od{constructor(){const t=ch(sd.getDefaults(),arguments,["offset"]);super(t),this.name="ToneConstantSource",this._source=this.context.createConstantSource(),nd(this._source,this._gainNode),this.offset=new Yh({context:this.context,convert:t.convert,param:this._source.offset,units:t.units,value:t.offset,minValue:t.minValue,maxValue:t.maxValue})}static getDefaults(){return Object.assign(od.getDefaults(),{convert:!0,offset:1,units:"number"})}start(t){const e=this.toSeconds(t);return this.log("start",e),this._startGain(e),this._source.start(e),this}_stopSource(t){this._source.stop(t)}dispose(){return super.dispose(),"started"===this.state&&this.stop(),this._source.disconnect(),this.offset.dispose(),this}}class ad extends td{constructor(){const t=ch(ad.getDefaults(),arguments,["value","units"]);super(t),this.name="Signal",this.override=!0,this.output=this._constantSource=new sd({context:this.context,convert:t.convert,offset:t.value,units:t.units,minValue:t.minValue,maxValue:t.maxValue}),this._constantSource.start(0),this.input=this._param=this._constantSource.offset}static getDefaults(){return Object.assign(td.getDefaults(),{convert:!0,units:"number",value:0})}connect(t,e=0,n=0){return ud(this,t,e,n),this}dispose(){return super.dispose(),this._param.dispose(),this._constantSource.dispose(),this}setValueAtTime(t,e){return this._param.setValueAtTime(t,e),this}getValueAtTime(t){return this._param.getValueAtTime(t)}setRampPoint(t){return this._param.setRampPoint(t),this}linearRampToValueAtTime(t,e){return this._param.linearRampToValueAtTime(t,e),this}exponentialRampToValueAtTime(t,e){return this._param.exponentialRampToValueAtTime(t,e),this}exponentialRampTo(t,e,n){return this._param.exponentialRampTo(t,e,n),this}linearRampTo(t,e,n){return this._param.linearRampTo(t,e,n),this}targetRampTo(t,e,n){return this._param.targetRampTo(t,e,n),this}exponentialApproachValueAtTime(t,e,n){return this._param.exponentialApproachValueAtTime(t,e,n),this}setTargetAtTime(t,e,n){return this._param.setTargetAtTime(t,e,n),this}setValueCurveAtTime(t,e,n,r){return this._param.setValueCurveAtTime(t,e,n,r),this}cancelScheduledValues(t){return this._param.cancelScheduledValues(t),this}cancelAndHoldAtTime(t){return this._param.cancelAndHoldAtTime(t),this}rampTo(t,e,n){return this._param.rampTo(t,e,n),this}get value(){return this._param.value}set value(t){this._param.value=t}get convert(){return this._param.convert}set convert(t){this._param.convert=t}get units(){return this._param.units}get overridden(){return this._param.overridden}set overridden(t){this._param.overridden=t}get maxValue(){return this._param.maxValue}get minValue(){return this._param.minValue}apply(t){return this._param.apply(t),this}}function ud(t,e,n,r){(e instanceof Yh||Kl(e)||e instanceof ad&&e.override)&&(e.cancelScheduledValues(0),e.setValueAtTime(0,0),e instanceof ad&&(e.overridden=!0)),nd(t,e,n,r)}function cd(t,e=1/0){const n=new WeakMap;return function(r,i){Reflect.defineProperty(r,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(r){fh(r,t,e),n.set(this,r)}})}}function ld(t,e=1/0){const n=new WeakMap;return function(r,i){Reflect.defineProperty(r,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(r){fh(this.toSeconds(r),t,e),n.set(this,r)}})}}class hd extends td{constructor(){const t=ch(hd.getDefaults(),arguments,["attack","decay","sustain","release"]);super(t),this.name="Envelope",this._sig=new ad({context:this.context,value:0}),this.output=this._sig,this.input=void 0,this.attack=t.attack,this.decay=t.decay,this.sustain=t.sustain,this.release=t.release,this.attackCurve=t.attackCurve,this.releaseCurve=t.releaseCurve,this.decayCurve=t.decayCurve}static getDefaults(){return Object.assign(td.getDefaults(),{attack:.01,attackCurve:"linear",decay:.1,decayCurve:"exponential",release:1,releaseCurve:"exponential",sustain:.5})}get value(){return this.getValueAtTime(this.now())}_getCurve(t,e){if(oh(t))return t;{let n;for(n in dd)if(dd[n][e]===t)return n;return t}}_setCurve(t,e,n){if(oh(n)&&Reflect.has(dd,n)){const r=dd[n];rh(r)?"_decayCurve"!==t&&(this[t]=r[e]):this[t]=r}else{if(!ih(n)||"_decayCurve"===t)throw new Error("Envelope: invalid curve: "+n);this[t]=n}}get attackCurve(){return this._getCurve(this._attackCurve,"In")}set attackCurve(t){this._setCurve("_attackCurve","In",t)}get releaseCurve(){return this._getCurve(this._releaseCurve,"Out")}set releaseCurve(t){this._setCurve("_releaseCurve","Out",t)}get decayCurve(){return this._getCurve(this._decayCurve,"Out")}set decayCurve(t){this._setCurve("_decayCurve","Out",t)}triggerAttack(t,e=1){this.log("triggerAttack",t,e),t=this.toSeconds(t);let n=this.toSeconds(this.attack);const r=this.toSeconds(this.decay),i=this.getValueAtTime(t);if(i>0){n=(1-i)/(1/n)}if(n<this.sampleTime)this._sig.cancelScheduledValues(t),this._sig.setValueAtTime(e,t);else if("linear"===this._attackCurve)this._sig.linearRampTo(e,n,t);else if("exponential"===this._attackCurve)this._sig.targetRampTo(e,n,t);else{this._sig.cancelAndHoldAtTime(t);let r=this._attackCurve;for(let t=1;t<r.length;t++)if(r[t-1]<=i&&i<=r[t]){r=this._attackCurve.slice(t),r[0]=i;break}this._sig.setValueCurveAtTime(r,t,n,e)}if(r&&this.sustain<1){const i=e*this.sustain,o=t+n;this.log("decay",o),"linear"===this._decayCurve?this._sig.linearRampToValueAtTime(i,r+o):this._sig.exponentialApproachValueAtTime(i,o,r)}return this}triggerRelease(t){this.log("triggerRelease",t),t=this.toSeconds(t);const e=this.getValueAtTime(t);if(e>0){const n=this.toSeconds(this.release);n<this.sampleTime?this._sig.setValueAtTime(0,t):"linear"===this._releaseCurve?this._sig.linearRampTo(0,n,t):"exponential"===this._releaseCurve?this._sig.targetRampTo(0,n,t):(ph(ih(this._releaseCurve),"releaseCurve must be either 'linear', 'exponential' or an array"),this._sig.cancelAndHoldAtTime(t),this._sig.setValueCurveAtTime(this._releaseCurve,t,n,e))}return this}getValueAtTime(t){return this._sig.getValueAtTime(t)}triggerAttackRelease(t,e,n=1){return e=this.toSeconds(e),this.triggerAttack(e,n),this.triggerRelease(e+this.toSeconds(t)),this}cancel(t){return this._sig.cancelScheduledValues(this.toSeconds(t)),this}connect(t,e=0,n=0){return ud(this,t,e,n),this}asArray(){return a(this,arguments,void 0,function*(t=1024){const e=t/this.context.sampleRate,n=new Uh(1,e,this.context.sampleRate),r=this.toSeconds(this.attack)+this.toSeconds(this.decay),i=r+this.toSeconds(this.release),o=.1*i,s=i+o,a=new this.constructor(Object.assign(this.get(),{attack:e*this.toSeconds(this.attack)/s,decay:e*this.toSeconds(this.decay)/s,release:e*this.toSeconds(this.release)/s,context:n}));a._sig.toDestination(),a.triggerAttackRelease(e*(r+o)/s,0);return(yield n.render()).getChannelData(0)})}dispose(){return super.dispose(),this._sig.dispose(),this}}s([ld(0)],hd.prototype,"attack",void 0),s([ld(0)],hd.prototype,"decay",void 0),s([cd(0,1)],hd.prototype,"sustain",void 0),s([ld(0)],hd.prototype,"release",void 0);const dd=(()=>{const t=128;let e,n;const r=[];for(e=0;e<t;e++)r[e]=Math.sin(e/127*(Math.PI/2));const i=[];for(e=0;e<127;e++){n=e/127;const t=Math.sin(n*(2*Math.PI)*6.4-Math.PI/2)+1;i[e]=t/10+.83*n}i[127]=1;const o=[];for(e=0;e<t;e++)o[e]=Math.ceil(e/127*5)/5;const s=[];for(e=0;e<t;e++)n=e/127,s[e]=.5*(1-Math.cos(Math.PI*n));const a=[];for(e=0;e<t;e++){n=e/127;const t=4*Math.pow(n,3)+.2,r=Math.cos(t*Math.PI*2*n);a[e]=Math.abs(r*(1-n))}function u(t){const e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=1-t[n];return e}return{bounce:{In:u(a),Out:a},cosine:{In:r,Out:(c=r,c.slice(0).reverse())},exponential:"exponential",linear:"linear",ripple:{In:i,Out:u(i)},sine:{In:s,Out:u(s)},step:{In:o,Out:u(o)}};var c})();class pd extends hd{constructor(){super(ch(pd.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="AmplitudeEnvelope",this._gainNode=new id({context:this.context,gain:0}),this.output=this._gainNode,this.input=this._gainNode,this._sig.connect(this._gainNode.gain),this.output=this._gainNode,this.input=this._gainNode}dispose(){return super.dispose(),this._gainNode.dispose(),this}}class fd extends td{constructor(){const t=ch(fd.getDefaults(),arguments,["volume"]);super(t),this.name="Volume",this.input=this.output=new id({context:this.context,gain:t.volume,units:"decibels"}),this.volume=this.output.gain,Fh(this,"volume"),this._unmutedVolume=t.volume,this.mute=t.mute}static getDefaults(){return Object.assign(td.getDefaults(),{mute:!1,volume:0})}get mute(){return this.volume.value===-1/0}set mute(t){!this.mute&&t?(this._unmutedVolume=this.volume.value,this.volume.value=-1/0):this.mute&&!t&&(this.volume.value=this._unmutedVolume)}dispose(){return super.dispose(),this.input.dispose(),this.volume.dispose(),this}}class md extends td{constructor(){const t=ch(md.getDefaults(),arguments);super(t),this.name="Destination",this.input=new fd({context:this.context}),this.output=new id({context:this.context}),this.volume=this.input.volume,ed(this.input,this.output,this.context.rawContext.destination),this.mute=t.mute,this._internalChannels=[this.input,this.context.rawContext.destination,this.output]}static getDefaults(){return Object.assign(td.getDefaults(),{mute:!1,volume:0})}get mute(){return this.input.mute}set mute(t){this.input.mute=t}chain(...t){return this.input.disconnect(),t.unshift(this.input),t.push(this.output),ed(...t),this}get maxChannelCount(){return this.context.rawContext.destination.maxChannelCount}dispose(){return super.dispose(),this.volume.dispose(),this}}Ih(t=>{t.destination=new md({context:t})}),Rh(t=>{t.destination.dispose()});class gd extends Th{constructor(t){super(),this.name="TimelineValue",this._timeline=new Ch({memory:10}),this._initialValue=t}set(t,e){return this._timeline.add({value:t,time:e}),this}get(t){const e=this._timeline.get(t);return e?e.value:this._initialValue}}class _d extends td{constructor(){super(ch(_d.getDefaults(),arguments,["context"]))}connect(t,e=0,n=0){return ud(this,t,e,n),this}}class yd extends _d{constructor(){const t=ch(yd.getDefaults(),arguments,["mapping","length"]);super(t),this.name="WaveShaper",this._shaper=this.context.createWaveShaper(),this.input=this._shaper,this.output=this._shaper,ih(t.mapping)||t.mapping instanceof Float32Array?this.curve=Float32Array.from(t.mapping):"function"==typeof t.mapping&&this.setMap(t.mapping,t.length)}static getDefaults(){return Object.assign(ad.getDefaults(),{length:1024})}setMap(t,e=1024){const n=new Float32Array(e);for(let r=0,i=e;r<i;r++){const e=r/(i-1)*2-1;n[r]=t(e,r)}return this.curve=n,this}get curve(){return this._shaper.curve}set curve(t){this._shaper.curve=t}get oversample(){return this._shaper.oversample}set oversample(t){const e=["none","2x","4x"].some(e=>e.includes(t));ph(e,"oversampling must be either 'none', '2x', or '4x'"),this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.disconnect(),this}}class vd extends _d{constructor(){const t=ch(vd.getDefaults(),arguments,["value"]);super(t),this.name="Pow",this._exponentScaler=this.input=this.output=new yd({context:this.context,mapping:this._expFunc(t.value),length:8192}),this._exponent=t.value}static getDefaults(){return Object.assign(_d.getDefaults(),{value:1})}_expFunc(t){return e=>Math.pow(Math.abs(e),t)}get value(){return this._exponent}set value(t){this._exponent=t,this._exponentScaler.setMap(this._expFunc(this._exponent))}dispose(){return super.dispose(),this._exponentScaler.dispose(),this}}class bd extends Qh{constructor(){super(...arguments),this.name="Ticks",this.defaultUnits="i"}_now(){return this.context.transport.ticks}_beatsToUnits(t){return this._getPPQ()*t}_secondsToUnits(t){return Math.floor(t/(60/this._getBpm())*this._getPPQ())}_ticksToUnits(t){return t}toTicks(){return this.valueOf()}toSeconds(){return this.valueOf()/this._getPPQ()*(60/this._getBpm())}}class wd extends Th{constructor(){super(...arguments),this.name="IntervalTimeline",this._root=null,this._length=0}add(t){ph(eh(t.time),"Events must have a time property"),ph(eh(t.duration),"Events must have a duration parameter"),t.time=t.time.valueOf();let e=new xd(t.time,t.time+t.duration,t);for(null===this._root?this._root=e:this._root.insert(e),this._length++;null!==e;)e.updateHeight(),e.updateMax(),this._rebalance(e),e=e.parent;return this}remove(t){if(null!==this._root){const e=[];this._root.search(t.time,e);for(const n of e)if(n.event===t){this._removeNode(n),this._length--;break}}return this}get length(){return this._length}cancel(t){return this.forEachFrom(t,t=>this.remove(t)),this}_setRoot(t){this._root=t,null!==this._root&&(this._root.parent=null)}_replaceNodeInParent(t,e){null!==t.parent?(t.isLeftChild()?t.parent.left=e:t.parent.right=e,this._rebalance(t.parent)):this._setRoot(e)}_removeNode(t){if(null===t.left&&null===t.right)this._replaceNodeInParent(t,null);else if(null===t.right)this._replaceNodeInParent(t,t.left);else if(null===t.left)this._replaceNodeInParent(t,t.right);else{let e,n=null;if(t.getBalance()>0)if(null===t.left.right)e=t.left,e.right=t.right,n=e;else{for(e=t.left.right;null!==e.right;)e=e.right;e.parent&&(e.parent.right=e.left,n=e.parent,e.left=t.left,e.right=t.right)}else if(null===t.right.left)e=t.right,e.left=t.left,n=e;else{for(e=t.right.left;null!==e.left;)e=e.left;e.parent&&(e.parent.left=e.right,n=e.parent,e.left=t.left,e.right=t.right)}null!==t.parent?t.isLeftChild()?t.parent.left=e:t.parent.right=e:this._setRoot(e),n&&this._rebalance(n)}t.dispose()}_rotateLeft(t){const e=t.parent,n=t.isLeftChild(),r=t.right;r&&(t.right=r.left,r.left=t),null!==e?n?e.left=r:e.right=r:this._setRoot(r)}_rotateRight(t){const e=t.parent,n=t.isLeftChild(),r=t.left;r&&(t.left=r.right,r.right=t),null!==e?n?e.left=r:e.right=r:this._setRoot(r)}_rebalance(t){const e=t.getBalance();e>1&&t.left?t.left.getBalance()<0?this._rotateLeft(t.left):this._rotateRight(t):e<-1&&t.right&&(t.right.getBalance()>0?this._rotateRight(t.right):this._rotateLeft(t))}get(t){if(null!==this._root){const e=[];if(this._root.search(t,e),e.length>0){let t=e[0];for(let n=1;n<e.length;n++)e[n].low>t.low&&(t=e[n]);return t.event}}return null}forEach(t){if(null!==this._root){const e=[];this._root.traverse(t=>e.push(t)),e.forEach(e=>{e.event&&t(e.event)})}return this}forEachAtTime(t,e){if(null!==this._root){const n=[];this._root.search(t,n),n.forEach(t=>{t.event&&e(t.event)})}return this}forEachFrom(t,e){if(null!==this._root){const n=[];this._root.searchAfter(t,n),n.forEach(t=>{t.event&&e(t.event)})}return this}dispose(){return super.dispose(),null!==this._root&&this._root.traverse(t=>t.dispose()),this._root=null,this}}class xd{constructor(t,e,n){this._left=null,this._right=null,this.parent=null,this.height=0,this.event=n,this.low=t,this.high=e,this.max=this.high}insert(t){t.low<=this.low?null===this.left?this.left=t:this.left.insert(t):null===this.right?this.right=t:this.right.insert(t)}search(t,e){t>this.max||(null!==this.left&&this.left.search(t,e),this.low<=t&&this.high>t&&e.push(this),this.low>t||null!==this.right&&this.right.search(t,e))}searchAfter(t,e){this.low>=t&&(e.push(this),null!==this.left&&this.left.searchAfter(t,e)),null!==this.right&&this.right.searchAfter(t,e)}traverse(t){t(this),null!==this.left&&this.left.traverse(t),null!==this.right&&this.right.traverse(t)}updateHeight(){null!==this.left&&null!==this.right?this.height=Math.max(this.left.height,this.right.height)+1:null!==this.right?this.height=this.right.height+1:null!==this.left?this.height=this.left.height+1:this.height=0}updateMax(){this.max=this.high,null!==this.left&&(this.max=Math.max(this.max,this.left.max)),null!==this.right&&(this.max=Math.max(this.max,this.right.max))}getBalance(){let t=0;return null!==this.left&&null!==this.right?t=this.left.height-this.right.height:null!==this.left?t=this.left.height+1:null!==this.right&&(t=-(this.right.height+1)),t}isLeftChild(){return null!==this.parent&&this.parent.left===this}get left(){return this._left}set left(t){this._left=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}get right(){return this._right}set right(t){this._right=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}dispose(){this.parent=null,this._left=null,this._right=null,this.event=null}}class Td extends Ch{constructor(t="stopped"){super(),this.name="StateTimeline",this._initial=t,this.setStateAtTime(this._initial,0)}getValueAtTime(t){const e=this.get(t);return null!==e?e.state:this._initial}setStateAtTime(t,e,n){return fh(e,0),this.add(Object.assign({},n,{state:t,time:e})),this}getLastState(t,e){for(let n=this._search(e);n>=0;n--){const e=this._timeline[n];if(e.state===t)return e}}getNextState(t,e){const n=this._search(e);if(-1!==n)for(let e=n;e<this._timeline.length;e++){const n=this._timeline[e];if(n.state===t)return n}}}class kd extends Yh{constructor(){const t=ch(kd.getDefaults(),arguments,["value"]);super(t),this.name="TickParam",this._events=new Ch(1/0),this._multiplier=1,this._multiplier=t.multiplier,this._events.cancel(0),this._events.add({ticks:0,time:0,type:"setValueAtTime",value:this._fromType(t.value)}),this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(Yh.getDefaults(),{multiplier:1,units:"hertz",value:1})}setTargetAtTime(t,e,n){e=this.toSeconds(e),this.setRampPoint(e);const r=this._fromType(t),i=this._events.get(e),o=Math.round(Math.max(1/n,1));for(let t=0;t<=o;t++){const o=n*t+e,s=this._exponentialApproach(i.time,i.value,r,n,o);this.linearRampToValueAtTime(this._toType(s),o)}return this}setValueAtTime(t,e){const n=this.toSeconds(e);super.setValueAtTime(t,e);const r=this._events.get(n),i=this._events.previousEvent(r),o=this._getTicksUntilEvent(i,n);return r.ticks=Math.max(o,0),this}linearRampToValueAtTime(t,e){const n=this.toSeconds(e);super.linearRampToValueAtTime(t,e);const r=this._events.get(n),i=this._events.previousEvent(r),o=this._getTicksUntilEvent(i,n);return r.ticks=Math.max(o,0),this}exponentialRampToValueAtTime(t,e){e=this.toSeconds(e);const n=this._fromType(t),r=this._events.get(e),i=Math.round(Math.max(10*(e-r.time),1)),o=(e-r.time)/i;for(let t=0;t<=i;t++){const i=o*t+r.time,s=this._exponentialInterpolate(r.time,r.value,e,n,i);this.linearRampToValueAtTime(this._toType(s),i)}return this}_getTicksUntilEvent(t,e){if(null===t)t={ticks:0,time:0,type:"setValueAtTime",value:0};else if(th(t.ticks)){const e=this._events.previousEvent(t);t.ticks=this._getTicksUntilEvent(e,t.time)}const n=this._fromType(this.getValueAtTime(t.time));let r=this._fromType(this.getValueAtTime(e));const i=this._events.get(e);return i&&i.time===e&&"setValueAtTime"===i.type&&(r=this._fromType(this.getValueAtTime(e-this.sampleTime))),.5*(e-t.time)*(n+r)+t.ticks}getTicksAtTime(t){const e=this.toSeconds(t),n=this._events.get(e);return Math.max(this._getTicksUntilEvent(n,e),0)}getDurationOfTicks(t,e){const n=this.toSeconds(e),r=this.getTicksAtTime(e);return this.getTimeOfTick(r+t)-n}getTimeOfTick(t){const e=this._events.get(t,"ticks"),n=this._events.getAfter(t,"ticks");if(e&&e.ticks===t)return e.time;if(e&&n&&"linearRampToValueAtTime"===n.type&&e.value!==n.value){const r=this._fromType(this.getValueAtTime(e.time)),i=(this._fromType(this.getValueAtTime(n.time))-r)/(n.time-e.time),o=Math.sqrt(Math.pow(r,2)-2*i*(e.ticks-t)),s=(-r+o)/i;return(s>0?s:(-r-o)/i)+e.time}return e?0===e.value?1/0:e.time+(t-e.ticks)/e.value:t/this._initialValue}ticksToTime(t,e){return this.getDurationOfTicks(t,e)}timeToTicks(t,e){const n=this.toSeconds(e),r=this.toSeconds(t),i=this.getTicksAtTime(n);return this.getTicksAtTime(n+r)-i}_fromType(t){return"bpm"===this.units&&this.multiplier?1/(60/t/this.multiplier):super._fromType(t)}_toType(t){return"bpm"===this.units&&this.multiplier?t/this.multiplier*60:super._toType(t)}get multiplier(){return this._multiplier}set multiplier(t){const e=this.value;this._multiplier=t,this.cancelScheduledValues(0),this.setValueAtTime(e,0)}}class Sd extends ad{constructor(){const t=ch(Sd.getDefaults(),arguments,["value"]);super(t),this.name="TickSignal",this.input=this._param=new kd({context:this.context,convert:t.convert,multiplier:t.multiplier,param:this._constantSource.offset,units:t.units,value:t.value})}static getDefaults(){return Object.assign(ad.getDefaults(),{multiplier:1,units:"hertz",value:1})}ticksToTime(t,e){return this._param.ticksToTime(t,e)}timeToTicks(t,e){return this._param.timeToTicks(t,e)}getTimeOfTick(t){return this._param.getTimeOfTick(t)}getDurationOfTicks(t,e){return this._param.getDurationOfTicks(t,e)}getTicksAtTime(t){return this._param.getTicksAtTime(t)}get multiplier(){return this._param.multiplier}set multiplier(t){this._param.multiplier=t}dispose(){return super.dispose(),this._param.dispose(),this}}class Ad extends Zh{constructor(){const t=ch(Ad.getDefaults(),arguments,["frequency"]);super(t),this.name="TickSource",this._state=new Td,this._tickOffset=new Ch,this._ticksAtTime=new Ch,this._secondsAtTime=new Ch,this.frequency=new Sd({context:this.context,units:t.units,value:t.frequency}),Fh(this,"frequency"),this._state.setStateAtTime("stopped",0),this.setTicksAtTime(0,0)}static getDefaults(){return Object.assign({frequency:1,units:"hertz"},Zh.getDefaults())}get state(){return this.getStateAtTime(this.now())}start(t,e){const n=this.toSeconds(t);return"started"!==this._state.getValueAtTime(n)&&(this._state.setStateAtTime("started",n),eh(e)&&this.setTicksAtTime(e,n),this._ticksAtTime.cancel(n),this._secondsAtTime.cancel(n)),this}stop(t){const e=this.toSeconds(t);if("stopped"===this._state.getValueAtTime(e)){const t=this._state.get(e);t&&t.time>0&&(this._tickOffset.cancel(t.time),this._state.cancel(t.time))}return this._state.cancel(e),this._state.setStateAtTime("stopped",e),this.setTicksAtTime(0,e),this._ticksAtTime.cancel(e),this._secondsAtTime.cancel(e),this}pause(t){const e=this.toSeconds(t);return"started"===this._state.getValueAtTime(e)&&(this._state.setStateAtTime("paused",e),this._ticksAtTime.cancel(e),this._secondsAtTime.cancel(e)),this}cancel(t){return t=this.toSeconds(t),this._state.cancel(t),this._tickOffset.cancel(t),this._ticksAtTime.cancel(t),this._secondsAtTime.cancel(t),this}getTicksAtTime(t){const e=this.toSeconds(t),n=this._state.getLastState("stopped",e),r=this._ticksAtTime.get(e),i={state:"paused",time:e};this._state.add(i);let o=r||n,s=r?r.ticks:0,a=null;return this._state.forEachBetween(o.time,e+this.sampleTime,t=>{let e=o.time;const n=this._tickOffset.get(t.time);n&&n.time>=o.time&&(s=n.ticks,e=n.time),"started"===o.state&&"started"!==t.state&&(s+=this.frequency.getTicksAtTime(t.time)-this.frequency.getTicksAtTime(e),t.time!==i.time&&(a={state:t.state,time:t.time,ticks:s})),o=t}),this._state.remove(i),a&&this._ticksAtTime.add(a),s}get ticks(){return this.getTicksAtTime(this.now())}set ticks(t){this.setTicksAtTime(t,this.now())}get seconds(){return this.getSecondsAtTime(this.now())}set seconds(t){const e=this.now(),n=this.frequency.timeToTicks(t,e);this.setTicksAtTime(n,e)}getSecondsAtTime(t){t=this.toSeconds(t);const e=this._state.getLastState("stopped",t),n={state:"paused",time:t};this._state.add(n);const r=this._secondsAtTime.get(t);let i=r||e,o=r?r.seconds:0,s=null;return this._state.forEachBetween(i.time,t+this.sampleTime,t=>{let e=i.time;const r=this._tickOffset.get(t.time);r&&r.time>=i.time&&(o=r.seconds,e=r.time),"started"===i.state&&"started"!==t.state&&(o+=t.time-e,t.time!==n.time&&(s={state:t.state,time:t.time,seconds:o})),i=t}),this._state.remove(n),s&&this._secondsAtTime.add(s),o}setTicksAtTime(t,e){return e=this.toSeconds(e),this._tickOffset.cancel(e),this._tickOffset.add({seconds:this.frequency.getDurationOfTicks(t,e),ticks:t,time:e}),this._ticksAtTime.cancel(e),this._secondsAtTime.cancel(e),this}getStateAtTime(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)}getTimeOfTick(t,e=this.now()){const n=this._tickOffset.get(e),r=this._state.get(e),i=Math.max(n.time,r.time),o=this.frequency.getTicksAtTime(i)+t-n.ticks;return this.frequency.getTimeOfTick(o)}forEachTickBetween(t,e,n){let r=this._state.get(t);this._state.forEachBetween(t,e,e=>{r&&"started"===r.state&&"started"!==e.state&&this.forEachTickBetween(Math.max(r.time,t),e.time-this.sampleTime,n),r=e});let i=null;if(r&&"started"===r.state){const o=Math.max(r.time,t),s=this.frequency.getTicksAtTime(o),a=s-this.frequency.getTicksAtTime(r.time);let u=Math.ceil(a)-a;u=Oh(u,1)?0:u;let c=this.frequency.getTimeOfTick(s+u);for(;c<e;){try{n(c,Math.round(this.getTicksAtTime(c)))}catch(t){i=t;break}c+=this.frequency.getDurationOfTicks(1,c)}}if(i)throw i;return this}dispose(){return super.dispose(),this._state.dispose(),this._tickOffset.dispose(),this._ticksAtTime.dispose(),this._secondsAtTime.dispose(),this.frequency.dispose(),this}}class Ed extends Zh{constructor(){const t=ch(Ed.getDefaults(),arguments,["callback","frequency"]);super(t),this.name="Clock",this.callback=Bh,this._lastUpdate=0,this._state=new Td("stopped"),this._boundLoop=this._loop.bind(this),this.callback=t.callback,this._tickSource=new Ad({context:this.context,frequency:t.frequency,units:t.units}),this._lastUpdate=0,this.frequency=this._tickSource.frequency,Fh(this,"frequency"),this._state.setStateAtTime("stopped",0),this.context.on("tick",this._boundLoop)}static getDefaults(){return Object.assign(Zh.getDefaults(),{callback:Bh,frequency:1,units:"hertz"})}get state(){return this._state.getValueAtTime(this.now())}start(t,e){mh(this.context);const n=this.toSeconds(t);return this.log("start",n),"started"!==this._state.getValueAtTime(n)&&(this._state.setStateAtTime("started",n),this._tickSource.start(n,e),n<this._lastUpdate&&this.emit("start",n,e)),this}stop(t){const e=this.toSeconds(t);return this.log("stop",e),this._state.cancel(e),this._state.setStateAtTime("stopped",e),this._tickSource.stop(e),e<this._lastUpdate&&this.emit("stop",e),this}pause(t){const e=this.toSeconds(t);return"started"===this._state.getValueAtTime(e)&&(this._state.setStateAtTime("paused",e),this._tickSource.pause(e),e<this._lastUpdate&&this.emit("pause",e)),this}get ticks(){return Math.ceil(this.getTicksAtTime(this.now()))}set ticks(t){this._tickSource.ticks=t}get seconds(){return this._tickSource.seconds}set seconds(t){this._tickSource.seconds=t}getSecondsAtTime(t){return this._tickSource.getSecondsAtTime(t)}setTicksAtTime(t,e){return this._tickSource.setTicksAtTime(t,e),this}getTimeOfTick(t,e=this.now()){return this._tickSource.getTimeOfTick(t,e)}getTicksAtTime(t){return this._tickSource.getTicksAtTime(t)}nextTickTime(t,e){const n=this.toSeconds(e),r=this.getTicksAtTime(n);return this._tickSource.getTimeOfTick(r+t,n)}_loop(){const t=this._lastUpdate,e=this.now();this._lastUpdate=e,this.log("loop",t,e),t!==e&&(this._state.forEachBetween(t,e,t=>{switch(t.state){case"started":const e=this._tickSource.getTicksAtTime(t.time);this.emit("start",t.time,e);break;case"stopped":0!==t.time&&this.emit("stop",t.time);break;case"paused":this.emit("pause",t.time)}}),this._tickSource.forEachTickBetween(t,e,(t,e)=>{this.callback(t,e)}))}getStateAtTime(t){const e=this.toSeconds(t);return this._state.getValueAtTime(e)}dispose(){return super.dispose(),this.context.off("tick",this._boundLoop),this._tickSource.dispose(),this._state.dispose(),this}}Ph.mixin(Ed);class Od{constructor(t,e){this.id=Od._eventId++,this._remainderTime=0;const n=Object.assign(Od.getDefaults(),e);this.transport=t,this.callback=n.callback,this._once=n.once,this.time=Math.floor(n.time),this._remainderTime=n.time-this.time}static getDefaults(){return{callback:Bh,once:!1,time:0}}get floatTime(){return this.time+this._remainderTime}invoke(t){if(this.callback){const e=this.transport.bpm.getDurationOfTicks(1,t);this.callback(t+this._remainderTime*e),this._once&&this.transport.clear(this.id)}}dispose(){return this.callback=void 0,this}}Od._eventId=0;class Cd extends Od{constructor(t,e){super(t,e),this._currentId=-1,this._nextId=-1,this._nextTick=this.time,this._boundRestart=this._restart.bind(this);const n=Object.assign(Cd.getDefaults(),e);this.duration=n.duration,this._interval=n.interval,this._nextTick=n.time,this.transport.on("start",this._boundRestart),this.transport.on("loopStart",this._boundRestart),this.transport.on("ticks",this._boundRestart),this.context=this.transport.context,this._restart()}static getDefaults(){return Object.assign({},Od.getDefaults(),{duration:1/0,interval:1,once:!1})}invoke(t){this._createEvents(t),super.invoke(t)}_createEvent(){return Eh(this._nextTick,this.floatTime+this.duration)?this.transport.scheduleOnce(this.invoke.bind(this),new bd(this.context,this._nextTick).toSeconds()):-1}_createEvents(t){Eh(this._nextTick+this._interval,this.floatTime+this.duration)&&(this._nextTick+=this._interval,this._currentId=this._nextId,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new bd(this.context,this._nextTick).toSeconds()))}_restart(t){this.transport.clear(this._currentId),this.transport.clear(this._nextId),this._nextTick=this.floatTime;const e=this.transport.getTicksAtTime(t);Sh(e,this.time)&&(this._nextTick=this.floatTime+Math.ceil((e-this.floatTime)/this._interval)*this._interval),this._currentId=this._createEvent(),this._nextTick+=this._interval,this._nextId=this._createEvent()}dispose(){return super.dispose(),this.transport.clear(this._currentId),this.transport.clear(this._nextId),this.transport.off("start",this._boundRestart),this.transport.off("loopStart",this._boundRestart),this.transport.off("ticks",this._boundRestart),this}}class Md extends Zh{constructor(){const t=ch(Md.getDefaults(),arguments);super(t),this.name="Transport",this._loop=new gd(!1),this._loopStart=0,this._loopEnd=0,this._scheduledEvents={},this._timeline=new Ch,this._repeatedEvents=new wd,this._syncedSignals=[],this._swingAmount=0,this._ppq=t.ppq,this._clock=new Ed({callback:this._processTick.bind(this),context:this.context,frequency:0,units:"bpm"}),this._bindClockEvents(),this.bpm=this._clock.frequency,this._clock.frequency.multiplier=t.ppq,this.bpm.setValueAtTime(t.bpm,0),Fh(this,"bpm"),this._timeSignature=t.timeSignature,this._swingTicks=t.ppq/2}static getDefaults(){return Object.assign(Zh.getDefaults(),{bpm:120,loopEnd:"4m",loopStart:0,ppq:192,swing:0,swingSubdivision:"8n",timeSignature:4})}_processTick(t,e){if(this._loop.get(t)&&e>=this._loopEnd&&(this.emit("loopEnd",t),this._clock.setTicksAtTime(this._loopStart,t),e=this._loopStart,this.emit("loopStart",t,this._clock.getSecondsAtTime(t)),this.emit("loop",t)),this._swingAmount>0&&e%this._ppq!==0&&e%(2*this._swingTicks)!=0){const n=e%(2*this._swingTicks)/(2*this._swingTicks),r=Math.sin(n*Math.PI)*this._swingAmount;t+=new bd(this.context,2*this._swingTicks/3).toSeconds()*r}yh(!0),this._timeline.forEachAtTime(e,e=>e.invoke(t)),yh(!1)}schedule(t,e){const n=new Od(this,{callback:t,time:new Qh(this.context,e).toTicks()});return this._addEvent(n,this._timeline)}scheduleRepeat(t,e,n,r=1/0){const i=new Cd(this,{callback:t,duration:new Jh(this.context,r).toTicks(),interval:new Jh(this.context,e).toTicks(),time:new Qh(this.context,n).toTicks()});return this._addEvent(i,this._repeatedEvents)}scheduleOnce(t,e){const n=new Od(this,{callback:t,once:!0,time:new Qh(this.context,e).toTicks()});return this._addEvent(n,this._timeline)}clear(t){if(this._scheduledEvents.hasOwnProperty(t)){const e=this._scheduledEvents[t.toString()];e.timeline.remove(e.event),e.event.dispose(),delete this._scheduledEvents[t.toString()]}return this}_addEvent(t,e){return this._scheduledEvents[t.id.toString()]={event:t,timeline:e},e.add(t),t.id}cancel(t=0){const e=this.toTicks(t);return this._timeline.forEachFrom(e,t=>this.clear(t.id)),this._repeatedEvents.forEachFrom(e,t=>this.clear(t.id)),this}_bindClockEvents(){this._clock.on("start",(t,e)=>{e=new bd(this.context,e).toSeconds(),this.emit("start",t,e)}),this._clock.on("stop",t=>{this.emit("stop",t)}),this._clock.on("pause",t=>{this.emit("pause",t)})}get state(){return this._clock.getStateAtTime(this.now())}start(t,e){let n;return this.context.resume(),eh(e)&&(n=this.toTicks(e)),this._clock.start(t,n),this}stop(t){return this._clock.stop(t),this}pause(t){return this._clock.pause(t),this}toggle(t){return t=this.toSeconds(t),"started"!==this._clock.getStateAtTime(t)?this.start(t):this.stop(t),this}get timeSignature(){return this._timeSignature}set timeSignature(t){ih(t)&&(t=t[0]/t[1]*4),this._timeSignature=t}get loopStart(){return new Jh(this.context,this._loopStart,"i").toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t)}get loopEnd(){return new Jh(this.context,this._loopEnd,"i").toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t)}get loop(){return this._loop.get(this.now())}set loop(t){this._loop.set(t,this.now())}setLoopPoints(t,e){return this.loopStart=t,this.loopEnd=e,this}get swing(){return this._swingAmount}set swing(t){this._swingAmount=t}get swingSubdivision(){return new bd(this.context,this._swingTicks).toNotation()}set swingSubdivision(t){this._swingTicks=this.toTicks(t)}get position(){const t=this.now(),e=this._clock.getTicksAtTime(t);return new bd(this.context,e).toBarsBeatsSixteenths()}set position(t){const e=this.toTicks(t);this.ticks=e}get seconds(){return this._clock.seconds}set seconds(t){const e=this.now(),n=this._clock.frequency.timeToTicks(t,e);this.ticks=n}get progress(){if(this.loop){const t=this.now();return(this._clock.getTicksAtTime(t)-this._loopStart)/(this._loopEnd-this._loopStart)}return 0}get ticks(){return this._clock.ticks}set ticks(t){if(this._clock.ticks!==t){const e=this.now();if("started"===this.state){const n=this._clock.getTicksAtTime(e),r=e+this._clock.frequency.getDurationOfTicks(Math.ceil(n)-n,e);this.emit("stop",r),this._clock.setTicksAtTime(t,r),this.emit("start",r,this._clock.getSecondsAtTime(r))}else this.emit("ticks",e),this._clock.setTicksAtTime(t,e)}}getTicksAtTime(t){return this._clock.getTicksAtTime(t)}getSecondsAtTime(t){return this._clock.getSecondsAtTime(t)}get PPQ(){return this._clock.frequency.multiplier}set PPQ(t){this._clock.frequency.multiplier=t}nextSubdivision(t){if(t=this.toTicks(t),"started"!==this.state)return 0;{const e=this.now(),n=t-this.getTicksAtTime(e)%t;return this._clock.nextTickTime(n,e)}}syncSignal(t,e){const n=this.now();let r=this.bpm,i=1/(60/r.getValueAtTime(n)/this.PPQ),o=[];if("time"===t.units){const t=1/64/i,e=new id(t),n=new vd(-1),s=new id(t);r.chain(e,n,s),r=s,i=1/i,o=[e,n,s]}e||(e=0!==t.getValueAtTime(n)?t.getValueAtTime(n)/i:0);const s=new id(e);return r.connect(s),s.connect(t._param),o.push(s),this._syncedSignals.push({initial:t.value,nodes:o,signal:t}),t.value=0,this}unsyncSignal(t){for(let e=this._syncedSignals.length-1;e>=0;e--){const n=this._syncedSignals[e];n.signal===t&&(n.nodes.forEach(t=>t.dispose()),n.signal.value=n.initial,this._syncedSignals.splice(e,1))}return this}dispose(){return super.dispose(),this._clock.dispose(),$h(this,"bpm"),this._timeline.dispose(),this._repeatedEvents.dispose(),this}}Ph.mixin(Md),Ih(t=>{t.transport=new Md({context:t})}),Rh(t=>{t.transport.dispose()});class Nd extends td{constructor(t){super(t),this.input=void 0,this._state=new Td("stopped"),this._synced=!1,this._scheduled=[],this._syncedStart=Bh,this._syncedStop=Bh,this._state.memory=100,this._state.increasing=!0,this._volume=this.output=new fd({context:this.context,mute:t.mute,volume:t.volume}),this.volume=this._volume.volume,Fh(this,"volume"),this.onstop=t.onstop}static getDefaults(){return Object.assign(td.getDefaults(),{mute:!1,onstop:Bh,volume:0})}get state(){return this._synced?"started"===this.context.transport.state?this._state.getValueAtTime(this.context.transport.seconds):"stopped":this._state.getValueAtTime(this.now())}get mute(){return this._volume.mute}set mute(t){this._volume.mute=t}_clampToCurrentTime(t){return this._synced?t:Math.max(t,this.context.currentTime)}start(t,e,n){let r=th(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(r=this._clampToCurrentTime(r),this._synced||"started"!==this._state.getValueAtTime(r))if(this.log("start",r),this._state.setStateAtTime("started",r),this._synced){const t=this._state.get(r);t&&(t.offset=this.toSeconds(lh(e,0)),t.duration=n?this.toSeconds(n):void 0);const i=this.context.transport.schedule(t=>{this._start(t,e,n)},r);this._scheduled.push(i),"started"===this.context.transport.state&&this.context.transport.getSecondsAtTime(this.immediate())>r&&this._syncedStart(this.now(),this.context.transport.seconds)}else mh(this.context),this._start(r,e,n);else ph(Sh(r,this._state.get(r).time),"Start time must be strictly greater than previous start time"),this._state.cancel(r),this._state.setStateAtTime("started",r),this.log("restart",r),this.restart(r,e,n);return this}stop(t){let e=th(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(e=this._clampToCurrentTime(e),"started"===this._state.getValueAtTime(e)||eh(this._state.getNextState("started",e))){if(this.log("stop",e),this._synced){const t=this.context.transport.schedule(this._stop.bind(this),e);this._scheduled.push(t)}else this._stop(e);this._state.cancel(e),this._state.setStateAtTime("stopped",e)}return this}restart(t,e,n){return t=this.toSeconds(t),"started"===this._state.getValueAtTime(t)&&(this._state.cancel(t),this._restart(t,e,n)),this}sync(){return this._synced||(this._synced=!0,this._syncedStart=(t,e)=>{if(Sh(e,0)){const n=this._state.get(e);if(n&&"started"===n.state&&n.time!==e){const r=e-this.toSeconds(n.time);let i;n.duration&&(i=this.toSeconds(n.duration)-r),this._start(t,this.toSeconds(n.offset)+r,i)}}},this._syncedStop=t=>{const e=this.context.transport.getSecondsAtTime(Math.max(t-this.sampleTime,0));"started"===this._state.getValueAtTime(e)&&this._stop(t)},this.context.transport.on("start",this._syncedStart),this.context.transport.on("loopStart",this._syncedStart),this.context.transport.on("stop",this._syncedStop),this.context.transport.on("pause",this._syncedStop),this.context.transport.on("loopEnd",this._syncedStop)),this}unsync(){return this._synced&&(this.context.transport.off("stop",this._syncedStop),this.context.transport.off("pause",this._syncedStop),this.context.transport.off("loopEnd",this._syncedStop),this.context.transport.off("start",this._syncedStart),this.context.transport.off("loopStart",this._syncedStart)),this._synced=!1,this._scheduled.forEach(t=>this.context.transport.clear(t)),this._scheduled=[],this._state.cancel(0),this._stop(0),this}dispose(){return super.dispose(),this.onstop=Bh,this.unsync(),this._volume.dispose(),this._state.dispose(),this}}class Id extends _d{constructor(){super(...arguments),this.name="AudioToGain",this._norm=new yd({context:this.context,mapping:t=>(t+1)/2}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class jd extends ad{constructor(){const t=ch(jd.getDefaults(),arguments,["value"]);super(t),this.name="Multiply",this.override=!1,this._mult=this.input=this.output=new id({context:this.context,minValue:t.minValue,maxValue:t.maxValue}),this.factor=this._param=this._mult.gain,this.factor.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(ad.getDefaults(),{value:0})}dispose(){return super.dispose(),this._mult.dispose(),this}}function Rd(t,e){return a(this,void 0,void 0,function*(){const n=e/t.context.sampleRate,r=new Uh(1,n,t.context.sampleRate);new t.constructor(Object.assign(t.get(),{frequency:2/n,detune:0,context:r})).toDestination().start(0);return(yield r.render()).getChannelData(0)})}class Pd extends od{constructor(){const t=ch(Pd.getDefaults(),arguments,["frequency","type"]);super(t),this.name="ToneOscillatorNode",this._oscillator=this.context.createOscillator(),this._internalChannels=[this._oscillator],nd(this._oscillator,this._gainNode),this.type=t.type,this.frequency=new Yh({context:this.context,param:this._oscillator.frequency,units:"frequency",value:t.frequency}),this.detune=new Yh({context:this.context,param:this._oscillator.detune,units:"cents",value:t.detune}),Fh(this,["frequency","detune"])}static getDefaults(){return Object.assign(od.getDefaults(),{detune:0,frequency:440,type:"sine"})}start(t){const e=this.toSeconds(t);return this.log("start",e),this._startGain(e),this._oscillator.start(e),this}_stopSource(t){this._oscillator.stop(t)}setPeriodicWave(t){return this._oscillator.setPeriodicWave(t),this}get type(){return this._oscillator.type}set type(t){this._oscillator.type=t}dispose(){return super.dispose(),"started"===this.state&&this.stop(),this._oscillator.disconnect(),this.frequency.dispose(),this.detune.dispose(),this}}class Dd extends Nd{constructor(){const t=ch(Dd.getDefaults(),arguments,["frequency","type"]);super(t),this.name="Oscillator",this._oscillator=null,this.frequency=new ad({context:this.context,units:"frequency",value:t.frequency}),Fh(this,"frequency"),this.detune=new ad({context:this.context,units:"cents",value:t.detune}),Fh(this,"detune"),this._partials=t.partials,this._partialCount=t.partialCount,this._type=t.type,t.partialCount&&"custom"!==t.type&&(this._type=this.baseType+t.partialCount.toString()),this.phase=t.phase}static getDefaults(){return Object.assign(Nd.getDefaults(),{detune:0,frequency:440,partialCount:0,partials:[],phase:0,type:"sine"})}_start(t){const e=this.toSeconds(t),n=new Pd({context:this.context,onended:()=>this.onstop(this)});this._oscillator=n,this._wave?this._oscillator.setPeriodicWave(this._wave):this._oscillator.type=this._type,this._oscillator.connect(this.output),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.start(e)}_stop(t){const e=this.toSeconds(t);this._oscillator&&this._oscillator.stop(e)}_restart(t){const e=this.toSeconds(t);return this.log("restart",e),this._oscillator&&this._oscillator.cancelStop(),this._state.cancel(e),this}syncFrequency(){return this.context.transport.syncSignal(this.frequency),this}unsyncFrequency(){return this.context.transport.unsyncSignal(this.frequency),this}_getCachedPeriodicWave(){if("custom"===this._type){return Dd._periodicWaveCache.find(t=>{return t.phase===this._phase&&(e=t.partials,n=this._partials,e.length===n.length&&e.every((t,e)=>n[e]===t));var e,n})}{const t=Dd._periodicWaveCache.find(t=>t.type===this._type&&t.phase===this._phase);return this._partialCount=t?t.partialCount:this._partialCount,t}}get type(){return this._type}set type(t){this._type=t;const e=-1!==["sine","square","sawtooth","triangle"].indexOf(t);if(0===this._phase&&e)this._wave=void 0,this._partialCount=0,null!==this._oscillator&&(this._oscillator.type=t);else{const e=this._getCachedPeriodicWave();if(eh(e)){const{partials:t,wave:n}=e;this._wave=n,this._partials=t,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave)}else{const[e,n]=this._getRealImaginary(t,this._phase),r=this.context.createPeriodicWave(e,n);this._wave=r,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave),Dd._periodicWaveCache.push({imag:n,partialCount:this._partialCount,partials:this._partials,phase:this._phase,real:e,type:this._type,wave:this._wave}),Dd._periodicWaveCache.length>100&&Dd._periodicWaveCache.shift()}}}get baseType(){return this._type.replace(this.partialCount.toString(),"")}set baseType(t){this.partialCount&&"custom"!==this._type&&"custom"!==t?this.type=t+this.partialCount:this.type=t}get partialCount(){return this._partialCount}set partialCount(t){fh(t,0);let e=this._type;const n=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(this._type);if(n&&(e=n[1]),"custom"!==this._type)this.type=0===t?e:e+t.toString();else{const e=new Float32Array(t);this._partials.forEach((t,n)=>e[n]=t),this._partials=Array.from(e),this.type=this._type}}_getRealImaginary(t,e){let n=2048;const r=new Float32Array(n),i=new Float32Array(n);let o=1;if("custom"===t){if(o=this._partials.length+1,this._partialCount=this._partials.length,n=o,0===this._partials.length)return[r,i]}else{const e=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(t);e?(o=parseInt(e[2],10)+1,this._partialCount=parseInt(e[2],10),t=e[1],o=Math.max(o,2),n=o):this._partialCount=0,this._partials=[]}for(let s=1;s<n;++s){const n=2/(s*Math.PI);let a;switch(t){case"sine":a=s<=o?1:0,this._partials[s-1]=a;break;case"square":a=1&s?2*n:0,this._partials[s-1]=a;break;case"sawtooth":a=n*(1&s?1:-1),this._partials[s-1]=a;break;case"triangle":a=1&s?n*n*2*(s-1>>1&1?-1:1):0,this._partials[s-1]=a;break;case"custom":a=this._partials[s-1];break;default:throw new TypeError("Oscillator: invalid type: "+t)}0!==a?(r[s]=-a*Math.sin(e*s),i[s]=a*Math.cos(e*s)):(r[s]=0,i[s]=0)}return[r,i]}_inverseFFT(t,e,n){let r=0;const i=t.length;for(let o=0;o<i;o++)r+=t[o]*Math.cos(o*n)+e[o]*Math.sin(o*n);return r}getInitialValue(){const[t,e]=this._getRealImaginary(this._type,0);let n=0;const r=2*Math.PI;for(let i=0;i<32;i++)n=Math.max(this._inverseFFT(t,e,i/32*r),n);return function(t,e,n){return Math.max(Math.min(t,n),e)}(-this._inverseFFT(t,e,this._phase)/n,-1,1)}get partials(){return this._partials.slice(0,this.partialCount)}set partials(t){this._partials=t,this._partialCount=this._partials.length,t.length&&(this.type="custom")}get phase(){return this._phase*(180/Math.PI)}set phase(t){this._phase=t*Math.PI/180,this.type=this._type}asArray(){return a(this,arguments,void 0,function*(t=1024){return Rd(this,t)})}dispose(){return super.dispose(),null!==this._oscillator&&this._oscillator.dispose(),this._wave=void 0,this.frequency.dispose(),this.detune.dispose(),this}}Dd._periodicWaveCache=[];class Ld extends Nd{constructor(){const t=ch(Ld.getDefaults(),arguments,["frequency","type","modulationType"]);super(t),this.name="AMOscillator",this._modulationScale=new Id({context:this.context}),this._modulationNode=new id({context:this.context}),this._carrier=new Dd({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase,type:t.type}),this.frequency=this._carrier.frequency,this.detune=this._carrier.detune,this._modulator=new Dd({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new jd({context:this.context,units:"positive",value:t.harmonicity}),this.frequency.chain(this.harmonicity,this._modulator.frequency),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output),Fh(this,["frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Dd.getDefaults(),{harmonicity:1,modulationType:"square"})}_start(t){this._modulator.start(t),this._carrier.start(t)}_stop(t){this._modulator.stop(t),this._carrier.stop(t)}_restart(t){this._modulator.restart(t),this._carrier.restart(t)}get type(){return this._carrier.type}set type(t){this._carrier.type=t}get baseType(){return this._carrier.baseType}set baseType(t){this._carrier.baseType=t}get partialCount(){return this._carrier.partialCount}set partialCount(t){this._carrier.partialCount=t}get modulationType(){return this._modulator.type}set modulationType(t){this._modulator.type=t}get phase(){return this._carrier.phase}set phase(t){this._carrier.phase=t,this._modulator.phase=t}get partials(){return this._carrier.partials}set partials(t){this._carrier.partials=t}asArray(){return a(this,arguments,void 0,function*(t=1024){return Rd(this,t)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this._modulationScale.dispose(),this}}class Fd extends Nd{constructor(){const t=ch(Fd.getDefaults(),arguments,["frequency","type","spread"]);super(t),this.name="FatOscillator",this._oscillators=[],this.frequency=new ad({context:this.context,units:"frequency",value:t.frequency}),this.detune=new ad({context:this.context,units:"cents",value:t.detune}),this._spread=t.spread,this._type=t.type,this._phase=t.phase,this._partials=t.partials,this._partialCount=t.partialCount,this.count=t.count,Fh(this,["frequency","detune"])}static getDefaults(){return Object.assign(Dd.getDefaults(),{count:3,spread:20,type:"sawtooth"})}_start(t){t=this.toSeconds(t),this._forEach(e=>e.start(t))}_stop(t){t=this.toSeconds(t),this._forEach(e=>e.stop(t))}_restart(t){this._forEach(e=>e.restart(t))}_forEach(t){for(let e=0;e<this._oscillators.length;e++)t(this._oscillators[e],e)}get type(){return this._type}set type(t){this._type=t,this._forEach(e=>e.type=t)}get spread(){return this._spread}set spread(t){if(this._spread=t,this._oscillators.length>1){const e=-t/2,n=t/(this._oscillators.length-1);this._forEach((t,r)=>t.detune.value=e+n*r)}}get count(){return this._oscillators.length}set count(t){if(fh(t,1),this._oscillators.length!==t){this._forEach(t=>t.dispose()),this._oscillators=[];for(let e=0;e<t;e++){const n=new Dd({context:this.context,volume:-6-1.1*t,type:this._type,phase:this._phase+e/t*360,partialCount:this._partialCount,onstop:0===e?()=>this.onstop(this):Bh});"custom"===this.type&&(n.partials=this._partials),this.frequency.connect(n.frequency),this.detune.connect(n.detune),n.detune.overridden=!1,n.connect(this.output),this._oscillators[e]=n}this.spread=this._spread,"started"===this.state&&this._forEach(t=>t.start())}}get phase(){return this._phase}set phase(t){this._phase=t,this._forEach((t,e)=>t.phase=this._phase+e/this.count*360)}get baseType(){return this._oscillators[0].baseType}set baseType(t){this._forEach(e=>e.baseType=t),this._type=this._oscillators[0].type}get partials(){return this._oscillators[0].partials}set partials(t){this._partials=t,this._partialCount=this._partials.length,t.length&&(this._type="custom",this._forEach(e=>e.partials=t))}get partialCount(){return this._oscillators[0].partialCount}set partialCount(t){this._partialCount=t,this._forEach(e=>e.partialCount=t),this._type=this._oscillators[0].type}asArray(){return a(this,arguments,void 0,function*(t=1024){return Rd(this,t)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this._forEach(t=>t.dispose()),this}}class $d extends Nd{constructor(){const t=ch($d.getDefaults(),arguments,["frequency","type","modulationType"]);super(t),this.name="FMOscillator",this._modulationNode=new id({context:this.context,gain:0}),this._carrier=new Dd({context:this.context,detune:t.detune,frequency:0,onstop:()=>this.onstop(this),phase:t.phase,type:t.type}),this.detune=this._carrier.detune,this.frequency=new ad({context:this.context,units:"frequency",value:t.frequency}),this._modulator=new Dd({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new jd({context:this.context,units:"positive",value:t.harmonicity}),this.modulationIndex=new jd({context:this.context,units:"positive",value:t.modulationIndex}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output),this.detune.connect(this._modulator.detune),Fh(this,["modulationIndex","frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Dd.getDefaults(),{harmonicity:1,modulationIndex:2,modulationType:"square"})}_start(t){this._modulator.start(t),this._carrier.start(t)}_stop(t){this._modulator.stop(t),this._carrier.stop(t)}_restart(t){return this._modulator.restart(t),this._carrier.restart(t),this}get type(){return this._carrier.type}set type(t){this._carrier.type=t}get baseType(){return this._carrier.baseType}set baseType(t){this._carrier.baseType=t}get partialCount(){return this._carrier.partialCount}set partialCount(t){this._carrier.partialCount=t}get modulationType(){return this._modulator.type}set modulationType(t){this._modulator.type=t}get phase(){return this._carrier.phase}set phase(t){this._carrier.phase=t,this._modulator.phase=t}get partials(){return this._carrier.partials}set partials(t){this._carrier.partials=t}asArray(){return a(this,arguments,void 0,function*(t=1024){return Rd(this,t)})}dispose(){return super.dispose(),this.frequency.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this.modulationIndex.dispose(),this}}class Bd extends Nd{constructor(){const t=ch(Bd.getDefaults(),arguments,["frequency","width"]);super(t),this.name="PulseOscillator",this._widthGate=new id({context:this.context,gain:0}),this._thresh=new yd({context:this.context,mapping:t=>t<=0?-1:1}),this.width=new ad({context:this.context,units:"audioRange",value:t.width}),this._triangle=new Dd({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase,type:"triangle"}),this.frequency=this._triangle.frequency,this.detune=this._triangle.detune,this._triangle.chain(this._thresh,this.output),this.width.chain(this._widthGate,this._thresh),Fh(this,["width","frequency","detune"])}static getDefaults(){return Object.assign(Nd.getDefaults(),{detune:0,frequency:440,phase:0,type:"pulse",width:.2})}_start(t){t=this.toSeconds(t),this._triangle.start(t),this._widthGate.gain.setValueAtTime(1,t)}_stop(t){t=this.toSeconds(t),this._triangle.stop(t),this._widthGate.gain.cancelScheduledValues(t),this._widthGate.gain.setValueAtTime(0,t)}_restart(t){this._triangle.restart(t),this._widthGate.gain.cancelScheduledValues(t),this._widthGate.gain.setValueAtTime(1,t)}get phase(){return this._triangle.phase}set phase(t){this._triangle.phase=t}get type(){return"pulse"}get baseType(){return"pulse"}get partials(){return[]}get partialCount(){return 0}set carrierType(t){this._triangle.type=t}asArray(){return a(this,arguments,void 0,function*(t=1024){return Rd(this,t)})}dispose(){return super.dispose(),this._triangle.dispose(),this.width.dispose(),this._widthGate.dispose(),this._thresh.dispose(),this}}class qd extends Nd{constructor(){const t=ch(qd.getDefaults(),arguments,["frequency","modulationFrequency"]);super(t),this.name="PWMOscillator",this.sourceType="pwm",this._scale=new jd({context:this.context,value:2}),this._pulse=new Bd({context:this.context,frequency:t.modulationFrequency}),this._pulse.carrierType="sine",this.modulationFrequency=this._pulse.frequency,this._modulator=new Dd({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase}),this.frequency=this._modulator.frequency,this.detune=this._modulator.detune,this._modulator.chain(this._scale,this._pulse.width),this._pulse.connect(this.output),Fh(this,["modulationFrequency","frequency","detune"])}static getDefaults(){return Object.assign(Nd.getDefaults(),{detune:0,frequency:440,modulationFrequency:.4,phase:0,type:"pwm"})}_start(t){t=this.toSeconds(t),this._modulator.start(t),this._pulse.start(t)}_stop(t){t=this.toSeconds(t),this._modulator.stop(t),this._pulse.stop(t)}_restart(t){this._modulator.restart(t),this._pulse.restart(t)}get type(){return"pwm"}get baseType(){return"pwm"}get partials(){return[]}get partialCount(){return 0}get phase(){return this._modulator.phase}set phase(t){this._modulator.phase=t}asArray(){return a(this,arguments,void 0,function*(t=1024){return Rd(this,t)})}dispose(){return super.dispose(),this._pulse.dispose(),this._scale.dispose(),this._modulator.dispose(),this}}const Ud={am:Ld,fat:Fd,fm:$d,oscillator:Dd,pulse:Bd,pwm:qd};class Vd extends Nd{constructor(){const t=ch(Vd.getDefaults(),arguments,["frequency","type"]);super(t),this.name="OmniOscillator",this.frequency=new ad({context:this.context,units:"frequency",value:t.frequency}),this.detune=new ad({context:this.context,units:"cents",value:t.detune}),Fh(this,["frequency","detune"]),this.set(t)}static getDefaults(){return Object.assign(Dd.getDefaults(),$d.getDefaults(),Ld.getDefaults(),Fd.getDefaults(),Bd.getDefaults(),qd.getDefaults())}_start(t){this._oscillator.start(t)}_stop(t){this._oscillator.stop(t)}_restart(t){return this._oscillator.restart(t),this}get type(){let t="";return["am","fm","fat"].some(t=>this._sourceType===t)&&(t=this._sourceType),t+this._oscillator.type}set type(t){"fm"===t.substr(0,2)?(this._createNewOscillator("fm"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(2)):"am"===t.substr(0,2)?(this._createNewOscillator("am"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(2)):"fat"===t.substr(0,3)?(this._createNewOscillator("fat"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(3)):"pwm"===t?(this._createNewOscillator("pwm"),this._oscillator=this._oscillator):"pulse"===t?this._createNewOscillator("pulse"):(this._createNewOscillator("oscillator"),this._oscillator=this._oscillator,this._oscillator.type=t)}get partials(){return this._oscillator.partials}set partials(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||(this._oscillator.partials=t)}get partialCount(){return this._oscillator.partialCount}set partialCount(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||(this._oscillator.partialCount=t)}set(t){return Reflect.has(t,"type")&&t.type&&(this.type=t.type),super.set(t),this}_createNewOscillator(t){if(t!==this._sourceType){this._sourceType=t;const e=Ud[t],n=this.now();if(this._oscillator){const t=this._oscillator;t.stop(n),this.context.setTimeout(()=>t.dispose(),this.blockTime)}this._oscillator=new e({context:this.context}),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.connect(this.output),this._oscillator.onstop=()=>this.onstop(this),"started"===this.state&&this._oscillator.start(n)}}get phase(){return this._oscillator.phase}set phase(t){this._oscillator.phase=t}get sourceType(){return this._sourceType}set sourceType(t){let e="sine";"pwm"!==this._oscillator.type&&"pulse"!==this._oscillator.type&&(e=this._oscillator.type),"fm"===t?this.type="fm"+e:"am"===t?this.type="am"+e:"fat"===t?this.type="fat"+e:"oscillator"===t?this.type=e:"pulse"===t?this.type="pulse":"pwm"===t&&(this.type="pwm")}_getOscType(t,e){return t instanceof Ud[e]}get baseType(){return this._oscillator.baseType}set baseType(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||"pulse"===t||"pwm"===t||(this._oscillator.baseType=t)}get width(){return this._getOscType(this._oscillator,"pulse")?this._oscillator.width:void 0}get count(){return this._getOscType(this._oscillator,"fat")?this._oscillator.count:void 0}set count(t){this._getOscType(this._oscillator,"fat")&&nh(t)&&(this._oscillator.count=t)}get spread(){return this._getOscType(this._oscillator,"fat")?this._oscillator.spread:void 0}set spread(t){this._getOscType(this._oscillator,"fat")&&nh(t)&&(this._oscillator.spread=t)}get modulationType(){return this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am")?this._oscillator.modulationType:void 0}set modulationType(t){(this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am"))&&oh(t)&&(this._oscillator.modulationType=t)}get modulationIndex(){return this._getOscType(this._oscillator,"fm")?this._oscillator.modulationIndex:void 0}get harmonicity(){return this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am")?this._oscillator.harmonicity:void 0}get modulationFrequency(){return this._getOscType(this._oscillator,"pwm")?this._oscillator.modulationFrequency:void 0}asArray(){return a(this,arguments,void 0,function*(t=1024){return Rd(this,t)})}dispose(){return super.dispose(),this.detune.dispose(),this.frequency.dispose(),this._oscillator.dispose(),this}}class Gd extends td{constructor(){const t=ch(Gd.getDefaults(),arguments);super(t),this._scheduledEvents=[],this._synced=!1,this._original_triggerAttack=this.triggerAttack,this._original_triggerRelease=this.triggerRelease,this._syncedRelease=t=>this._original_triggerRelease(t),this._volume=this.output=new fd({context:this.context,volume:t.volume}),this.volume=this._volume.volume,Fh(this,"volume")}static getDefaults(){return Object.assign(td.getDefaults(),{volume:0})}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",0),this.context.transport.on("stop",this._syncedRelease),this.context.transport.on("pause",this._syncedRelease),this.context.transport.on("loopEnd",this._syncedRelease)),this}_syncState(){let t=!1;return this._synced||(this._synced=!0,t=!0),t}_syncMethod(t,e){const n=this["_original_"+t]=this[t];this[t]=(...t)=>{const r=t[e],i=this.context.transport.schedule(r=>{t[e]=r,n.apply(this,t)},r);this._scheduledEvents.push(i)}}unsync(){return this._scheduledEvents.forEach(t=>this.context.transport.clear(t)),this._scheduledEvents=[],this._synced&&(this._synced=!1,this.triggerAttack=this._original_triggerAttack,this.triggerRelease=this._original_triggerRelease,this.context.transport.off("stop",this._syncedRelease),this.context.transport.off("pause",this._syncedRelease),this.context.transport.off("loopEnd",this._syncedRelease)),this}triggerAttackRelease(t,e,n,r){const i=this.toSeconds(n),o=this.toSeconds(e);return this.triggerAttack(t,i,r),this.triggerRelease(i+o),this}dispose(){return super.dispose(),this._volume.dispose(),this.unsync(),this._scheduledEvents=[],this}}class zd extends Gd{constructor(){const t=ch(zd.getDefaults(),arguments);super(t),this.portamento=t.portamento,this.onsilence=t.onsilence}static getDefaults(){return Object.assign(Gd.getDefaults(),{detune:0,onsilence:Bh,portamento:0})}triggerAttack(t,e,n=1){this.log("triggerAttack",t,e,n);const r=this.toSeconds(e);return this._triggerEnvelopeAttack(r,n),this.setNote(t,r),this}triggerRelease(t){this.log("triggerRelease",t);const e=this.toSeconds(t);return this._triggerEnvelopeRelease(e),this}setNote(t,e){const n=this.toSeconds(e),r=t instanceof Hh?t.toFrequency():t;if(this.portamento>0&&this.getLevelAtTime(n)>.05){const t=this.toSeconds(this.portamento);this.frequency.exponentialRampTo(r,t,n)}else this.frequency.setValueAtTime(r,n);return this}}s([ld(0)],zd.prototype,"portamento",void 0);class Wd extends zd{constructor(){const t=ch(Wd.getDefaults(),arguments);super(t),this.name="Synth",this.oscillator=new Vd(Object.assign({context:this.context,detune:t.detune,onstop:()=>this.onsilence(this)},t.oscillator)),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.envelope=new pd(Object.assign({context:this.context},t.envelope)),this.oscillator.chain(this.envelope,this.output),Fh(this,["oscillator","frequency","detune","envelope"])}static getDefaults(){return Object.assign(zd.getDefaults(),{envelope:Object.assign(hh(hd.getDefaults(),Object.keys(td.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.3}),oscillator:Object.assign(hh(Vd.getDefaults(),[...Object.keys(Nd.getDefaults()),"frequency","detune"]),{type:"triangle"})})}_triggerEnvelopeAttack(t,e){if(this.envelope.triggerAttack(t,e),this.oscillator.start(t),0===this.envelope.sustain){const e=this.toSeconds(this.envelope.attack),n=this.toSeconds(this.envelope.decay);this.oscillator.stop(t+e+n)}}_triggerEnvelopeRelease(t){this.envelope.triggerRelease(t),this.oscillator.stop(t+this.toSeconds(this.envelope.release))}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}dispose(){return super.dispose(),this.oscillator.dispose(),this.envelope.dispose(),this}}class Jd extends zd{constructor(){const t=ch(Jd.getDefaults(),arguments);super(t),this.name="ModulationSynth",this._carrier=new Wd({context:this.context,oscillator:t.oscillator,envelope:t.envelope,onsilence:()=>this.onsilence(this),volume:-10}),this._modulator=new Wd({context:this.context,oscillator:t.modulation,envelope:t.modulationEnvelope,volume:-10}),this.oscillator=this._carrier.oscillator,this.envelope=this._carrier.envelope,this.modulation=this._modulator.oscillator,this.modulationEnvelope=this._modulator.envelope,this.frequency=new ad({context:this.context,units:"frequency"}),this.detune=new ad({context:this.context,value:t.detune,units:"cents"}),this.harmonicity=new jd({context:this.context,value:t.harmonicity,minValue:0}),this._modulationNode=new id({context:this.context,gain:0}),Fh(this,["frequency","harmonicity","oscillator","envelope","modulation","modulationEnvelope","detune"])}static getDefaults(){return Object.assign(zd.getDefaults(),{harmonicity:3,oscillator:Object.assign(hh(Vd.getDefaults(),[...Object.keys(Nd.getDefaults()),"frequency","detune"]),{type:"sine"}),envelope:Object.assign(hh(hd.getDefaults(),Object.keys(td.getDefaults())),{attack:.01,decay:.01,sustain:1,release:.5}),modulation:Object.assign(hh(Vd.getDefaults(),[...Object.keys(Nd.getDefaults()),"frequency","detune"]),{type:"square"}),modulationEnvelope:Object.assign(hh(hd.getDefaults(),Object.keys(td.getDefaults())),{attack:.5,decay:0,sustain:1,release:.5})})}_triggerEnvelopeAttack(t,e){this._carrier._triggerEnvelopeAttack(t,e),this._modulator._triggerEnvelopeAttack(t,e)}_triggerEnvelopeRelease(t){return this._carrier._triggerEnvelopeRelease(t),this._modulator._triggerEnvelopeRelease(t),this}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}dispose(){return super.dispose(),this._carrier.dispose(),this._modulator.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._modulationNode.dispose(),this}}class Hd extends Jd{constructor(){super(ch(Hd.getDefaults(),arguments)),this.name="AMSynth",this._modulationScale=new Id({context:this.context}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.detune.fan(this._carrier.detune,this._modulator.detune),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output)}dispose(){return super.dispose(),this._modulationScale.dispose(),this}}class Xd extends td{constructor(){const t=ch(Xd.getDefaults(),arguments,["frequency","type"]);super(t),this.name="BiquadFilter",this._filter=this.context.createBiquadFilter(),this.input=this.output=this._filter,this.Q=new Yh({context:this.context,units:"number",value:t.Q,param:this._filter.Q}),this.frequency=new Yh({context:this.context,units:"frequency",value:t.frequency,param:this._filter.frequency}),this.detune=new Yh({context:this.context,units:"cents",value:t.detune,param:this._filter.detune}),this.gain=new Yh({context:this.context,units:"decibels",convert:!1,value:t.gain,param:this._filter.gain}),this.type=t.type}static getDefaults(){return Object.assign(td.getDefaults(),{Q:1,type:"lowpass",frequency:350,detune:0,gain:0})}get type(){return this._filter.type}set type(t){ph(-1!==["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t),`Invalid filter type: ${t}`),this._filter.type=t}getFrequencyResponse(t=128){const e=new Float32Array(t);for(let n=0;n<t;n++){const r=19980*Math.pow(n/t,2)+20;e[n]=r}const n=new Float32Array(t),r=new Float32Array(t),i=this.context.createBiquadFilter();return i.type=this.type,i.Q.value=this.Q.value,i.frequency.value=this.frequency.value,i.gain.value=this.gain.value,i.getFrequencyResponse(e,n,r),n}dispose(){return super.dispose(),this._filter.disconnect(),this.Q.dispose(),this.frequency.dispose(),this.gain.dispose(),this.detune.dispose(),this}}class Kd extends td{constructor(){const t=ch(Kd.getDefaults(),arguments,["frequency","type","rolloff"]);super(t),this.name="Filter",this.input=new id({context:this.context}),this.output=new id({context:this.context}),this._filters=[],this._filters=[],this.Q=new ad({context:this.context,units:"positive",value:t.Q}),this.frequency=new ad({context:this.context,units:"frequency",value:t.frequency}),this.detune=new ad({context:this.context,units:"cents",value:t.detune}),this.gain=new ad({context:this.context,units:"decibels",convert:!1,value:t.gain}),this._type=t.type,this.rolloff=t.rolloff,Fh(this,["detune","frequency","gain","Q"])}static getDefaults(){return Object.assign(td.getDefaults(),{Q:1,detune:0,frequency:350,gain:0,rolloff:-12,type:"lowpass"})}get type(){return this._type}set type(t){ph(-1!==["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t),`Invalid filter type: ${t}`),this._type=t,this._filters.forEach(e=>e.type=t)}get rolloff(){return this._rolloff}set rolloff(t){const e=nh(t)?t:parseInt(t,10),n=[-12,-24,-48,-96];let r=n.indexOf(e);ph(-1!==r,`rolloff can only be ${n.join(", ")}`),r+=1,this._rolloff=e,this.input.disconnect(),this._filters.forEach(t=>t.disconnect()),this._filters=new Array(r);for(let t=0;t<r;t++){const e=new Xd({context:this.context});e.type=this._type,this.frequency.connect(e.frequency),this.detune.connect(e.detune),this.Q.connect(e.Q),this.gain.connect(e.gain),this._filters[t]=e}this._internalChannels=this._filters,ed(this.input,...this._internalChannels,this.output)}getFrequencyResponse(t=128){const e=new Xd({context:this.context,frequency:this.frequency.value,gain:this.gain.value,Q:this.Q.value,type:this._type,detune:this.detune.value}),n=new Float32Array(t).map(()=>1);return this._filters.forEach(()=>{e.getFrequencyResponse(t).forEach((t,e)=>n[e]*=t)}),e.dispose(),n}dispose(){return super.dispose(),this._filters.forEach(t=>{t.dispose()}),$h(this,["detune","frequency","gain","Q"]),this.frequency.dispose(),this.Q.dispose(),this.detune.dispose(),this.gain.dispose(),this}}class Qd extends ad{constructor(){super(ch(Qd.getDefaults(),arguments,["value"])),this.override=!1,this.name="Add",this._sum=new id({context:this.context}),this.input=this._sum,this.output=this._sum,this.addend=this._param,ed(this._constantSource,this._sum)}static getDefaults(){return Object.assign(ad.getDefaults(),{value:0})}dispose(){return super.dispose(),this._sum.dispose(),this}}class Zd extends _d{constructor(){const t=ch(Zd.getDefaults(),arguments,["min","max"]);super(t),this.name="Scale",this._mult=this.input=new jd({context:this.context,value:t.max-t.min}),this._add=this.output=new Qd({context:this.context,value:t.min}),this._min=t.min,this._max=t.max,this.input.connect(this.output)}static getDefaults(){return Object.assign(_d.getDefaults(),{max:1,min:0})}get min(){return this._min}set min(t){this._min=t,this._setRange()}get max(){return this._max}set max(t){this._max=t,this._setRange()}_setRange(){this._add.value=this._min,this._mult.value=this._max-this._min}dispose(){return super.dispose(),this._add.dispose(),this._mult.dispose(),this}}class Yd extends hd{constructor(){const t=ch(Yd.getDefaults(),arguments,["attack","decay","sustain","release"]);super(t),this.name="FrequencyEnvelope",this._octaves=t.octaves,this._baseFrequency=this.toFrequency(t.baseFrequency),this._exponent=this.input=new vd({context:this.context,value:t.exponent}),this._scale=this.output=new Zd({context:this.context,min:this._baseFrequency,max:this._baseFrequency*Math.pow(2,this._octaves)}),this._sig.chain(this._exponent,this._scale)}static getDefaults(){return Object.assign(hd.getDefaults(),{baseFrequency:200,exponent:1,octaves:4})}get baseFrequency(){return this._baseFrequency}set baseFrequency(t){const e=this.toFrequency(t);fh(e,0),this._baseFrequency=e,this._scale.min=this._baseFrequency,this.octaves=this._octaves}get octaves(){return this._octaves}set octaves(t){this._octaves=t,this._scale.max=this._baseFrequency*Math.pow(2,t)}get exponent(){return this._exponent.value}set exponent(t){this._exponent.value=t}dispose(){return super.dispose(),this._exponent.dispose(),this._scale.dispose(),this}}class tp extends zd{constructor(){const t=ch(tp.getDefaults(),arguments);super(t),this.name="MonoSynth",this.oscillator=new Vd(Object.assign(t.oscillator,{context:this.context,detune:t.detune,onstop:()=>this.onsilence(this)})),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.filter=new Kd(Object.assign(t.filter,{context:this.context})),this.filterEnvelope=new Yd(Object.assign(t.filterEnvelope,{context:this.context})),this.envelope=new pd(Object.assign(t.envelope,{context:this.context})),this.oscillator.chain(this.filter,this.envelope,this.output),this.filterEnvelope.connect(this.filter.frequency),Fh(this,["oscillator","frequency","detune","filter","filterEnvelope","envelope"])}static getDefaults(){return Object.assign(zd.getDefaults(),{envelope:Object.assign(hh(hd.getDefaults(),Object.keys(td.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.9}),filter:Object.assign(hh(Kd.getDefaults(),Object.keys(td.getDefaults())),{Q:1,rolloff:-12,type:"lowpass"}),filterEnvelope:Object.assign(hh(Yd.getDefaults(),Object.keys(td.getDefaults())),{attack:.6,baseFrequency:200,decay:.2,exponent:2,octaves:3,release:2,sustain:.5}),oscillator:Object.assign(hh(Vd.getDefaults(),Object.keys(Nd.getDefaults())),{type:"sawtooth"})})}_triggerEnvelopeAttack(t,e=1){if(this.envelope.triggerAttack(t,e),this.filterEnvelope.triggerAttack(t),this.oscillator.start(t),0===this.envelope.sustain){const e=this.toSeconds(this.envelope.attack),n=this.toSeconds(this.envelope.decay);this.oscillator.stop(t+e+n)}}_triggerEnvelopeRelease(t){this.envelope.triggerRelease(t),this.filterEnvelope.triggerRelease(t),this.oscillator.stop(t+this.toSeconds(this.envelope.release))}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}dispose(){return super.dispose(),this.oscillator.dispose(),this.envelope.dispose(),this.filterEnvelope.dispose(),this.filter.dispose(),this}}class ep extends _d{constructor(){super(ch(ep.getDefaults(),arguments)),this.name="Zero",this._gain=new id({context:this.context}),this.output=this._gain,this.input=void 0,nd(this.context.getConstant(0),this._gain)}dispose(){return super.dispose(),rd(this.context.getConstant(0),this._gain),this}}class np extends td{constructor(){const t=ch(np.getDefaults(),arguments,["frequency","min","max"]);super(t),this.name="LFO",this._stoppedValue=0,this._units="number",this.convert=!0,this._fromType=Yh.prototype._fromType,this._toType=Yh.prototype._toType,this._is=Yh.prototype._is,this._clampValue=Yh.prototype._clampValue,this._oscillator=new Dd(t),this.frequency=this._oscillator.frequency,this._amplitudeGain=new id({context:this.context,gain:t.amplitude,units:"normalRange"}),this.amplitude=this._amplitudeGain.gain,this._stoppedSignal=new ad({context:this.context,units:"audioRange",value:0}),this._zeros=new ep({context:this.context}),this._a2g=new Id({context:this.context}),this._scaler=this.output=new Zd({context:this.context,max:t.max,min:t.min}),this.units=t.units,this.min=t.min,this.max=t.max,this._oscillator.chain(this._amplitudeGain,this._a2g,this._scaler),this._zeros.connect(this._a2g),this._stoppedSignal.connect(this._a2g),Fh(this,["amplitude","frequency"]),this.phase=t.phase}static getDefaults(){return Object.assign(Dd.getDefaults(),{amplitude:1,frequency:"4n",max:1,min:0,type:"sine",units:"number"})}start(t){return t=this.toSeconds(t),this._stoppedSignal.setValueAtTime(0,t),this._oscillator.start(t),this}stop(t){return t=this.toSeconds(t),this._stoppedSignal.setValueAtTime(this._stoppedValue,t),this._oscillator.stop(t),this}sync(){return this._oscillator.sync(),this._oscillator.syncFrequency(),this}unsync(){return this._oscillator.unsync(),this._oscillator.unsyncFrequency(),this}_setStoppedValue(){this._stoppedValue=this._oscillator.getInitialValue(),this._stoppedSignal.value=this._stoppedValue}get min(){return this._toType(this._scaler.min)}set min(t){t=this._fromType(t),this._scaler.min=t}get max(){return this._toType(this._scaler.max)}set max(t){t=this._fromType(t),this._scaler.max=t}get type(){return this._oscillator.type}set type(t){this._oscillator.type=t,this._setStoppedValue()}get partials(){return this._oscillator.partials}set partials(t){this._oscillator.partials=t,this._setStoppedValue()}get phase(){return this._oscillator.phase}set phase(t){this._oscillator.phase=t,this._setStoppedValue()}get units(){return this._units}set units(t){const e=this.min,n=this.max;this._units=t,this.min=e,this.max=n}get state(){return this._oscillator.state}connect(t,e,n){return(t instanceof Yh||t instanceof ad)&&(this.convert=t.convert,this.units=t.units),ud(this,t,e,n),this}dispose(){return super.dispose(),this._oscillator.dispose(),this._stoppedSignal.dispose(),this._zeros.dispose(),this._scaler.dispose(),this._a2g.dispose(),this._amplitudeGain.dispose(),this.amplitude.dispose(),this}}class rp extends zd{constructor(){const t=ch(rp.getDefaults(),arguments);super(t),this.name="DuoSynth",this.voice0=new tp(Object.assign(t.voice0,{context:this.context,onsilence:()=>this.onsilence(this)})),this.voice1=new tp(Object.assign(t.voice1,{context:this.context})),this.harmonicity=new jd({context:this.context,units:"positive",value:t.harmonicity}),this._vibrato=new np({frequency:t.vibratoRate,context:this.context,min:-50,max:50}),this._vibrato.start(),this.vibratoRate=this._vibrato.frequency,this._vibratoGain=new id({context:this.context,units:"normalRange",gain:t.vibratoAmount}),this.vibratoAmount=this._vibratoGain.gain,this.frequency=new ad({context:this.context,units:"frequency",value:440}),this.detune=new ad({context:this.context,units:"cents",value:t.detune}),this.frequency.connect(this.voice0.frequency),this.frequency.chain(this.harmonicity,this.voice1.frequency),this._vibrato.connect(this._vibratoGain),this._vibratoGain.fan(this.voice0.detune,this.voice1.detune),this.detune.fan(this.voice0.detune,this.voice1.detune),this.voice0.connect(this.output),this.voice1.connect(this.output),Fh(this,["voice0","voice1","frequency","vibratoAmount","vibratoRate"])}getLevelAtTime(t){return t=this.toSeconds(t),this.voice0.envelope.getValueAtTime(t)+this.voice1.envelope.getValueAtTime(t)}static getDefaults(){return uh(zd.getDefaults(),{vibratoAmount:.5,vibratoRate:5,harmonicity:1.5,voice0:uh(hh(tp.getDefaults(),Object.keys(zd.getDefaults())),{filterEnvelope:{attack:.01,decay:0,sustain:1,release:.5},envelope:{attack:.01,decay:0,sustain:1,release:.5}}),voice1:uh(hh(tp.getDefaults(),Object.keys(zd.getDefaults())),{filterEnvelope:{attack:.01,decay:0,sustain:1,release:.5},envelope:{attack:.01,decay:0,sustain:1,release:.5}})})}_triggerEnvelopeAttack(t,e){this.voice0._triggerEnvelopeAttack(t,e),this.voice1._triggerEnvelopeAttack(t,e)}_triggerEnvelopeRelease(t){return this.voice0._triggerEnvelopeRelease(t),this.voice1._triggerEnvelopeRelease(t),this}dispose(){return super.dispose(),this.voice0.dispose(),this.voice1.dispose(),this.frequency.dispose(),this.detune.dispose(),this._vibrato.dispose(),this.vibratoRate.dispose(),this._vibratoGain.dispose(),this.harmonicity.dispose(),this}}class ip extends Jd{constructor(){const t=ch(ip.getDefaults(),arguments);super(t),this.name="FMSynth",this.modulationIndex=new jd({context:this.context,value:t.modulationIndex}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this.detune.fan(this._carrier.detune,this._modulator.detune),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output)}static getDefaults(){return Object.assign(Jd.getDefaults(),{modulationIndex:10})}dispose(){return super.dispose(),this.modulationIndex.dispose(),this}}class op extends Wd{constructor(){const t=ch(op.getDefaults(),arguments);super(t),this.name="MembraneSynth",this.portamento=0,this.pitchDecay=t.pitchDecay,this.octaves=t.octaves,Fh(this,["oscillator","envelope"])}static getDefaults(){return uh(zd.getDefaults(),Wd.getDefaults(),{envelope:{attack:.001,attackCurve:"exponential",decay:.4,release:1.4,sustain:.01},octaves:10,oscillator:{type:"sine"},pitchDecay:.05})}setNote(t,e){const n=this.toSeconds(e),r=this.toFrequency(t instanceof Hh?t.toFrequency():t),i=r*this.octaves;return this.oscillator.frequency.setValueAtTime(i,n),this.oscillator.frequency.exponentialRampToValueAtTime(r,n+this.toSeconds(this.pitchDecay)),this}dispose(){return super.dispose(),this}}s([cd(0)],op.prototype,"octaves",void 0),s([ld(0)],op.prototype,"pitchDecay",void 0);const sp=[1,1.483,1.932,2.546,2.63,3.897];class ap extends zd{constructor(){const t=ch(ap.getDefaults(),arguments);super(t),this.name="MetalSynth",this._oscillators=[],this._freqMultipliers=[],this.detune=new ad({context:this.context,units:"cents",value:t.detune}),this.frequency=new ad({context:this.context,units:"frequency"}),this._amplitude=new id({context:this.context,gain:0}).connect(this.output),this._highpass=new Kd({Q:0,context:this.context,type:"highpass"}).connect(this._amplitude);for(let e=0;e<sp.length;e++){const n=new $d({context:this.context,harmonicity:t.harmonicity,modulationIndex:t.modulationIndex,modulationType:"square",onstop:0===e?()=>this.onsilence(this):Bh,type:"square"});n.connect(this._highpass),this._oscillators[e]=n;const r=new jd({context:this.context,value:sp[e]});this._freqMultipliers[e]=r,this.frequency.chain(r,n.frequency),this.detune.connect(n.detune)}this._filterFreqScaler=new Zd({context:this.context,max:7e3,min:this.toFrequency(t.resonance)}),this.envelope=new hd({attack:t.envelope.attack,attackCurve:"linear",context:this.context,decay:t.envelope.decay,release:t.envelope.release,sustain:0}),this.envelope.chain(this._filterFreqScaler,this._highpass.frequency),this.envelope.connect(this._amplitude.gain),this._octaves=t.octaves,this.octaves=t.octaves}static getDefaults(){return uh(zd.getDefaults(),{envelope:Object.assign(hh(hd.getDefaults(),Object.keys(td.getDefaults())),{attack:.001,decay:1.4,release:.2}),harmonicity:5.1,modulationIndex:32,octaves:1.5,resonance:4e3})}_triggerEnvelopeAttack(t,e=1){return this.envelope.triggerAttack(t,e),this._oscillators.forEach(e=>e.start(t)),0===this.envelope.sustain&&this._oscillators.forEach(e=>{e.stop(t+this.toSeconds(this.envelope.attack)+this.toSeconds(this.envelope.decay))}),this}_triggerEnvelopeRelease(t){return this.envelope.triggerRelease(t),this._oscillators.forEach(e=>e.stop(t+this.toSeconds(this.envelope.release))),this}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}get modulationIndex(){return this._oscillators[0].modulationIndex.value}set modulationIndex(t){this._oscillators.forEach(e=>e.modulationIndex.value=t)}get harmonicity(){return this._oscillators[0].harmonicity.value}set harmonicity(t){this._oscillators.forEach(e=>e.harmonicity.value=t)}get resonance(){return this._filterFreqScaler.min}set resonance(t){this._filterFreqScaler.min=this.toFrequency(t),this.octaves=this._octaves}get octaves(){return this._octaves}set octaves(t){this._octaves=t,this._filterFreqScaler.max=this._filterFreqScaler.min*Math.pow(2,t)}dispose(){return super.dispose(),this._oscillators.forEach(t=>t.dispose()),this._freqMultipliers.forEach(t=>t.dispose()),this.frequency.dispose(),this.detune.dispose(),this._filterFreqScaler.dispose(),this._amplitude.dispose(),this.envelope.dispose(),this._highpass.dispose(),this}}class up extends od{constructor(){const t=ch(up.getDefaults(),arguments,["url","onload"]);super(t),this.name="ToneBufferSource",this._source=this.context.createBufferSource(),this._internalChannels=[this._source],this._sourceStarted=!1,this._sourceStopped=!1,nd(this._source,this._gainNode),this._source.onended=()=>this._stopSource(),this.playbackRate=new Yh({context:this.context,param:this._source.playbackRate,units:"positive",value:t.playbackRate}),this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this._buffer=new qh(t.url,t.onload,t.onerror),this._internalChannels.push(this._source)}static getDefaults(){return Object.assign(od.getDefaults(),{url:new qh,loop:!1,loopEnd:0,loopStart:0,onload:Bh,onerror:Bh,playbackRate:1})}get fadeIn(){return this._fadeIn}set fadeIn(t){this._fadeIn=t}get fadeOut(){return this._fadeOut}set fadeOut(t){this._fadeOut=t}get curve(){return this._curve}set curve(t){this._curve=t}start(t,e,n,r=1){ph(this.buffer.loaded,"buffer is either not set or not loaded");const i=this.toSeconds(t);this._startGain(i,r),e=this.loop?lh(e,this.loopStart):lh(e,0);let o=Math.max(this.toSeconds(e),0);if(this.loop){const t=this.toSeconds(this.loopEnd)||this.buffer.duration,e=this.toSeconds(this.loopStart),n=t-e;Ah(o,t)&&(o=(o-e)%n+e),Oh(o,this.buffer.duration)&&(o=0)}if(this._source.buffer=this.buffer.get(),this._source.loopEnd=this.toSeconds(this.loopEnd)||this.buffer.duration,Eh(o,this.buffer.duration)&&(this._sourceStarted=!0,this._source.start(i,o)),eh(n)){let t=this.toSeconds(n);t=Math.max(t,0),this.stop(i+t)}return this}_stopSource(t){!this._sourceStopped&&this._sourceStarted&&(this._sourceStopped=!0,this._source.stop(this.toSeconds(t)),this._onended())}get loopStart(){return this._source.loopStart}set loopStart(t){this._source.loopStart=this.toSeconds(t)}get loopEnd(){return this._source.loopEnd}set loopEnd(t){this._source.loopEnd=this.toSeconds(t)}get buffer(){return this._buffer}set buffer(t){this._buffer.set(t)}get loop(){return this._source.loop}set loop(t){this._source.loop=t,this._sourceStarted&&this.cancelStop()}dispose(){return super.dispose(),this._source.onended=null,this._source.disconnect(),this._buffer.dispose(),this.playbackRate.dispose(),this}}class cp extends Nd{constructor(){const t=ch(cp.getDefaults(),arguments,["type"]);super(t),this.name="Noise",this._source=null,this._playbackRate=t.playbackRate,this.type=t.type,this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut}static getDefaults(){return Object.assign(Nd.getDefaults(),{fadeIn:0,fadeOut:0,playbackRate:1,type:"white"})}get type(){return this._type}set type(t){if(ph(t in dp,"Noise: invalid type: "+t),this._type!==t&&(this._type=t,"started"===this.state)){const t=this.now();this._stop(t),this._start(t)}}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._source&&(this._source.playbackRate.value=t)}_start(t){const e=dp[this._type];this._source=new up({url:e,context:this.context,fadeIn:this._fadeIn,fadeOut:this._fadeOut,loop:!0,onended:()=>this.onstop(this),playbackRate:this._playbackRate}).connect(this.output),this._source.start(this.toSeconds(t),Math.random()*(e.duration-.001))}_stop(t){this._source&&(this._source.stop(this.toSeconds(t)),this._source=null)}get fadeIn(){return this._fadeIn}set fadeIn(t){this._fadeIn=t,this._source&&(this._source.fadeIn=this._fadeIn)}get fadeOut(){return this._fadeOut}set fadeOut(t){this._fadeOut=t,this._source&&(this._source.fadeOut=this._fadeOut)}_restart(t){this._stop(t),this._start(t)}dispose(){return super.dispose(),this._source&&this._source.disconnect(),this}}const lp=220500,hp={brown:null,pink:null,white:null},dp={get brown(){if(!hp.brown){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(lp);t[e]=n;let r=0;for(let t=0;t<lp;t++){const e=2*Math.random()-1;n[t]=(r+.02*e)/1.02,r=n[t],n[t]*=3.5}}hp.brown=(new qh).fromArray(t)}return hp.brown},get pink(){if(!hp.pink){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(lp);let r,i,o,s,a,u,c;t[e]=n,r=i=o=s=a=u=c=0;for(let t=0;t<lp;t++){const e=2*Math.random()-1;r=.99886*r+.0555179*e,i=.99332*i+.0750759*e,o=.969*o+.153852*e,s=.8665*s+.3104856*e,a=.55*a+.5329522*e,u=-.7616*u-.016898*e,n[t]=r+i+o+s+a+u+c+.5362*e,n[t]*=.11,c=.115926*e}}hp.pink=(new qh).fromArray(t)}return hp.pink},get white(){if(!hp.white){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(lp);t[e]=n;for(let t=0;t<lp;t++)n[t]=2*Math.random()-1}hp.white=(new qh).fromArray(t)}return hp.white}};class pp extends Gd{constructor(){const t=ch(pp.getDefaults(),arguments);super(t),this.name="NoiseSynth",this.noise=new cp(Object.assign({context:this.context},t.noise)),this.envelope=new pd(Object.assign({context:this.context},t.envelope)),this.noise.chain(this.envelope,this.output)}static getDefaults(){return Object.assign(Gd.getDefaults(),{envelope:Object.assign(hh(hd.getDefaults(),Object.keys(td.getDefaults())),{decay:.1,sustain:0}),noise:Object.assign(hh(cp.getDefaults(),Object.keys(Nd.getDefaults())),{type:"white"})})}triggerAttack(t,e=1){return t=this.toSeconds(t),this.envelope.triggerAttack(t,e),this.noise.start(t),0===this.envelope.sustain&&this.noise.stop(t+this.toSeconds(this.envelope.attack)+this.toSeconds(this.envelope.decay)),this}triggerRelease(t){return t=this.toSeconds(t),this.envelope.triggerRelease(t),this.noise.stop(t+this.toSeconds(this.envelope.release)),this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",0),this._syncMethod("triggerRelease",0)),this}triggerAttackRelease(t,e,n=1){return e=this.toSeconds(e),t=this.toSeconds(t),this.triggerAttack(e,n),this.triggerRelease(e+t),this}dispose(){return super.dispose(),this.noise.dispose(),this.envelope.dispose(),this}}const fp=new Set;function mp(t){fp.add(t)}class gp extends td{constructor(t){super(t),this.name="ToneAudioWorklet",this.workletOptions={},this.onprocessorerror=Bh;const e=URL.createObjectURL(new Blob([Array.from(fp).join("\n")],{type:"text/javascript"})),n=this._audioWorkletName();this._dummyGain=this.context.createGain(),this._dummyParam=this._dummyGain.gain,this.context.addAudioWorkletModule(e).then(()=>{this.disposed||(this._worklet=this.context.createAudioWorkletNode(n,this.workletOptions),this._worklet.onprocessorerror=this.onprocessorerror.bind(this),this.onReady(this._worklet))})}dispose(){return super.dispose(),this._dummyGain.disconnect(),this._worklet&&(this._worklet.port.postMessage("dispose"),this._worklet.disconnect()),this}}mp('\n\t/**\n\t * The base AudioWorkletProcessor for use in Tone.js. Works with the {@link ToneAudioWorklet}. \n\t */\n\tclass ToneAudioWorkletProcessor extends AudioWorkletProcessor {\n\n\t\tconstructor(options) {\n\t\t\t\n\t\t\tsuper(options);\n\t\t\t/**\n\t\t\t * If the processor was disposed or not. Keep alive until it\'s disposed.\n\t\t\t */\n\t\t\tthis.disposed = false;\n\t\t \t/** \n\t\t\t * The number of samples in the processing block\n\t\t\t */\n\t\t\tthis.blockSize = 128;\n\t\t\t/**\n\t\t\t * the sample rate\n\t\t\t */\n\t\t\tthis.sampleRate = sampleRate;\n\n\t\t\tthis.port.onmessage = (event) => {\n\t\t\t\t// when it receives a dispose \n\t\t\t\tif (event.data === "dispose") {\n\t\t\t\t\tthis.disposed = true;\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n');mp("\n\t/**\n\t * Abstract class for a single input/output processor. \n\t * has a 'generate' function which processes one sample at a time\n\t */\n\tclass SingleIOProcessor extends ToneAudioWorkletProcessor {\n\n\t\tconstructor(options) {\n\t\t\tsuper(Object.assign(options, {\n\t\t\t\tnumberOfInputs: 1,\n\t\t\t\tnumberOfOutputs: 1\n\t\t\t}));\n\t\t\t/**\n\t\t\t * Holds the name of the parameter and a single value of that\n\t\t\t * parameter at the current sample\n\t\t\t * @type { [name: string]: number }\n\t\t\t */\n\t\t\tthis.params = {}\n\t\t}\n\n\t\t/**\n\t\t * Generate an output sample from the input sample and parameters\n\t\t * @abstract\n\t\t * @param input number\n\t\t * @param channel number\n\t\t * @param parameters { [name: string]: number }\n\t\t * @returns number\n\t\t */\n\t\tgenerate(){}\n\n\t\t/**\n\t\t * Update the private params object with the \n\t\t * values of the parameters at the given index\n\t\t * @param parameters { [name: string]: Float32Array },\n\t\t * @param index number\n\t\t */\n\t\tupdateParams(parameters, index) {\n\t\t\tfor (const paramName in parameters) {\n\t\t\t\tconst param = parameters[paramName];\n\t\t\t\tif (param.length > 1) {\n\t\t\t\t\tthis.params[paramName] = parameters[paramName][index];\n\t\t\t\t} else {\n\t\t\t\t\tthis.params[paramName] = parameters[paramName][0];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Process a single frame of the audio\n\t\t * @param inputs Float32Array[][]\n\t\t * @param outputs Float32Array[][]\n\t\t */\n\t\tprocess(inputs, outputs, parameters) {\n\t\t\tconst input = inputs[0];\n\t\t\tconst output = outputs[0];\n\t\t\t// get the parameter values\n\t\t\tconst channelCount = Math.max(input && input.length || 0, output.length);\n\t\t\tfor (let sample = 0; sample < this.blockSize; sample++) {\n\t\t\t\tthis.updateParams(parameters, sample);\n\t\t\t\tfor (let channel = 0; channel < channelCount; channel++) {\n\t\t\t\t\tconst inputSample = input && input.length ? input[channel][sample] : 0;\n\t\t\t\t\toutput[channel][sample] = this.generate(inputSample, channel, this.params);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn !this.disposed;\n\t\t}\n\t};\n");mp("\n\t/**\n\t * A multichannel buffer for use within an AudioWorkletProcessor as a delay line\n\t */\n\tclass DelayLine {\n\t\t\n\t\tconstructor(size, channels) {\n\t\t\tthis.buffer = [];\n\t\t\tthis.writeHead = []\n\t\t\tthis.size = size;\n\n\t\t\t// create the empty channels\n\t\t\tfor (let i = 0; i < channels; i++) {\n\t\t\t\tthis.buffer[i] = new Float32Array(this.size);\n\t\t\t\tthis.writeHead[i] = 0;\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Push a value onto the end\n\t\t * @param channel number\n\t\t * @param value number\n\t\t */\n\t\tpush(channel, value) {\n\t\t\tthis.writeHead[channel] += 1;\n\t\t\tif (this.writeHead[channel] > this.size) {\n\t\t\t\tthis.writeHead[channel] = 0;\n\t\t\t}\n\t\t\tthis.buffer[channel][this.writeHead[channel]] = value;\n\t\t}\n\n\t\t/**\n\t\t * Get the recorded value of the channel given the delay\n\t\t * @param channel number\n\t\t * @param delay number delay samples\n\t\t */\n\t\tget(channel, delay) {\n\t\t\tlet readHead = this.writeHead[channel] - Math.floor(delay);\n\t\t\tif (readHead < 0) {\n\t\t\t\treadHead += this.size;\n\t\t\t}\n\t\t\treturn this.buffer[channel][readHead];\n\t\t}\n\t}\n");const _p="feedback-comb-filter";!function(t,e){const n=`registerProcessor("${t}", ${e})`;fp.add(n)}(_p,'\n\tclass FeedbackCombFilterWorklet extends SingleIOProcessor {\n\n\t\tconstructor(options) {\n\t\t\tsuper(options);\n\t\t\tthis.delayLine = new DelayLine(this.sampleRate, options.channelCount || 2);\n\t\t}\n\n\t\tstatic get parameterDescriptors() {\n\t\t\treturn [{\n\t\t\t\tname: "delayTime",\n\t\t\t\tdefaultValue: 0.1,\n\t\t\t\tminValue: 0,\n\t\t\t\tmaxValue: 1,\n\t\t\t\tautomationRate: "k-rate"\n\t\t\t}, {\n\t\t\t\tname: "feedback",\n\t\t\t\tdefaultValue: 0.5,\n\t\t\t\tminValue: 0,\n\t\t\t\tmaxValue: 0.9999,\n\t\t\t\tautomationRate: "k-rate"\n\t\t\t}];\n\t\t}\n\n\t\tgenerate(input, channel, parameters) {\n\t\t\tconst delayedSample = this.delayLine.get(channel, parameters.delayTime * this.sampleRate);\n\t\t\tthis.delayLine.push(channel, input + delayedSample * parameters.feedback);\n\t\t\treturn delayedSample;\n\t\t}\n\t}\n');class yp extends gp{constructor(){const t=ch(yp.getDefaults(),arguments,["delayTime","resonance"]);super(t),this.name="FeedbackCombFilter",this.input=new id({context:this.context}),this.output=new id({context:this.context}),this.delayTime=new Yh({context:this.context,value:t.delayTime,units:"time",minValue:0,maxValue:1,param:this._dummyParam,swappable:!0}),this.resonance=new Yh({context:this.context,value:t.resonance,units:"normalRange",param:this._dummyParam,swappable:!0}),Fh(this,["resonance","delayTime"])}_audioWorkletName(){return _p}static getDefaults(){return Object.assign(td.getDefaults(),{delayTime:.1,resonance:.5})}onReady(t){ed(this.input,t,this.output);const e=t.parameters.get("delayTime");this.delayTime.setParam(e);const n=t.parameters.get("feedback");this.resonance.setParam(n)}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this.delayTime.dispose(),this.resonance.dispose(),this}}class vp extends td{constructor(){const t=ch(vp.getDefaults(),arguments,["frequency","type"]);super(t),this.name="OnePoleFilter",this._frequency=t.frequency,this._type=t.type,this.input=new id({context:this.context}),this.output=new id({context:this.context}),this._createFilter()}static getDefaults(){return Object.assign(td.getDefaults(),{frequency:880,type:"lowpass"})}_createFilter(){const t=this._filter,e=this.toFrequency(this._frequency),n=1/(2*Math.PI*e);if("lowpass"===this._type){const t=1/(n*this.context.sampleRate),e=t-1;this._filter=this.context.createIIRFilter([t,0],[1,e])}else{const t=1/(n*this.context.sampleRate)-1;this._filter=this.context.createIIRFilter([1,-1],[1,t])}this.input.chain(this._filter,this.output),t&&this.context.setTimeout(()=>{this.disposed||(this.input.disconnect(t),t.disconnect())},this.blockTime)}get frequency(){return this._frequency}set frequency(t){this._frequency=t,this._createFilter()}get type(){return this._type}set type(t){this._type=t,this._createFilter()}getFrequencyResponse(t=128){const e=new Float32Array(t);for(let n=0;n<t;n++){const r=19980*Math.pow(n/t,2)+20;e[n]=r}const n=new Float32Array(t),r=new Float32Array(t);return this._filter.getFrequencyResponse(e,n,r),n}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this._filter.disconnect(),this}}class bp extends td{constructor(){const t=ch(bp.getDefaults(),arguments,["delayTime","resonance","dampening"]);super(t),this.name="LowpassCombFilter",this._combFilter=this.output=new yp({context:this.context,delayTime:t.delayTime,resonance:t.resonance}),this.delayTime=this._combFilter.delayTime,this.resonance=this._combFilter.resonance,this._lowpass=this.input=new vp({context:this.context,frequency:t.dampening,type:"lowpass"}),this._lowpass.connect(this._combFilter)}static getDefaults(){return Object.assign(td.getDefaults(),{dampening:3e3,delayTime:.1,resonance:.5})}get dampening(){return this._lowpass.frequency}set dampening(t){this._lowpass.frequency=t}dispose(){return super.dispose(),this._combFilter.dispose(),this._lowpass.dispose(),this}}class wp extends Gd{constructor(){const t=ch(wp.getDefaults(),arguments);super(t),this.name="PluckSynth",this._noise=new cp({context:this.context,type:"pink"}),this.attackNoise=t.attackNoise,this._lfcf=new bp({context:this.context,dampening:t.dampening,resonance:t.resonance}),this.resonance=t.resonance,this.release=t.release,this._noise.connect(this._lfcf),this._lfcf.connect(this.output)}static getDefaults(){return uh(Gd.getDefaults(),{attackNoise:1,dampening:4e3,resonance:.7,release:1})}get dampening(){return this._lfcf.dampening}set dampening(t){this._lfcf.dampening=t}triggerAttack(t,e){const n=this.toFrequency(t);e=this.toSeconds(e);const r=1/n;return this._lfcf.delayTime.setValueAtTime(r,e),this._noise.start(e),this._noise.stop(e+r*this.attackNoise),this._lfcf.resonance.cancelScheduledValues(e),this._lfcf.resonance.setValueAtTime(this.resonance,e),this}triggerRelease(t){return this._lfcf.resonance.linearRampTo(0,this.release,t),this}dispose(){return super.dispose(),this._noise.dispose(),this._lfcf.dispose(),this}}class xp extends Hh{constructor(){super(...arguments),this.name="MidiClass",this.defaultUnits="midi"}_frequencyToUnits(t){return _s(super._frequencyToUnits(t))}_ticksToUnits(t){return _s(super._ticksToUnits(t))}_beatsToUnits(t){return _s(super._beatsToUnits(t))}_secondsToUnits(t){return _s(super._secondsToUnits(t))}toMidi(){return this.valueOf()}toFrequency(){return vs(this.toMidi())}transpose(t){return new xp(this.context,this.toMidi()+t)}}class Tp extends Gd{constructor(){const t=ch(Tp.getDefaults(),arguments,["voice","options"]);super(t),this.name="PolySynth",this._availableVoices=[],this._activeVoices=[],this._voices=[],this._gcTimeout=-1,this._averageActiveVoices=0,this._syncedRelease=t=>this.releaseAll(t),ph(!nh(t.voice),"DEPRECATED: The polyphony count is no longer the first argument.");const e=t.voice.getDefaults();this.options=Object.assign(e,t.options),this.voice=t.voice,this.maxPolyphony=t.maxPolyphony,this._dummyVoice=this._getNextAvailableVoice();const n=this._voices.indexOf(this._dummyVoice);this._voices.splice(n,1),this._gcTimeout=this.context.setInterval(this._collectGarbage.bind(this),1)}static getDefaults(){return Object.assign(Gd.getDefaults(),{maxPolyphony:32,options:{},voice:Wd})}get activeVoices(){return this._activeVoices.length}_makeVoiceAvailable(t){this._availableVoices.push(t);const e=this._activeVoices.findIndex(e=>e.voice===t);this._activeVoices.splice(e,1)}_getNextAvailableVoice(){if(this._availableVoices.length)return this._availableVoices.shift();if(this._voices.length<this.maxPolyphony){const t=new this.voice(Object.assign(this.options,{context:this.context,onsilence:this._makeVoiceAvailable.bind(this)}));return ph(t instanceof zd,"Voice must extend Monophonic class"),t.connect(this.output),this._voices.push(t),t}bh("Max polyphony exceeded. Note dropped.")}_collectGarbage(){if(this._averageActiveVoices=Math.max(.95*this._averageActiveVoices,this.activeVoices),this._availableVoices.length&&this._voices.length>Math.ceil(this._averageActiveVoices+1)){const t=this._availableVoices.shift(),e=this._voices.indexOf(t);this._voices.splice(e,1),this.context.isOffline||t.dispose()}}_triggerAttack(t,e,n){t.forEach(t=>{const r=new xp(this.context,t).toMidi(),i=this._getNextAvailableVoice();i&&(i.triggerAttack(t,e,n),this._activeVoices.push({midi:r,voice:i,released:!1}),this.log("triggerAttack",t,e))})}_triggerRelease(t,e){t.forEach(t=>{const n=new xp(this.context,t).toMidi(),r=this._activeVoices.find(({midi:t,released:e})=>t===n&&!e);r&&(r.voice.triggerRelease(e),r.released=!0,this.log("triggerRelease",t,e))})}_scheduleEvent(t,e,n,r){ph(!this.disposed,"Synth was already disposed"),n<=this.now()?"attack"===t?this._triggerAttack(e,n,r):this._triggerRelease(e,n):this.context.setTimeout(()=>{this.disposed||this._scheduleEvent(t,e,n,r)},n-this.now())}triggerAttack(t,e,n){Array.isArray(t)||(t=[t]);const r=this.toSeconds(e);return this._scheduleEvent("attack",t,r,n),this}triggerRelease(t,e){Array.isArray(t)||(t=[t]);const n=this.toSeconds(e);return this._scheduleEvent("release",t,n),this}triggerAttackRelease(t,e,n,r){const i=this.toSeconds(n);if(this.triggerAttack(t,i,r),ih(e)){ph(ih(t),"If the duration is an array, the notes must also be an array");for(let n=0;n<t.length;n++){const r=e[Math.min(n,e.length-1)],o=this.toSeconds(r);ph(o>0,"The duration must be greater than 0"),this.triggerRelease(t[n],i+o)}}else{const n=this.toSeconds(e);ph(n>0,"The duration must be greater than 0"),this.triggerRelease(t,i+n)}return this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1),this.context.transport.on("stop",this._syncedRelease),this.context.transport.on("pause",this._syncedRelease),this.context.transport.on("loopEnd",this._syncedRelease)),this}set(t){const e=hh(t,["onsilence","context"]);return this.options=uh(this.options,e),this._voices.forEach(t=>t.set(e)),this._dummyVoice.set(e),this}get(){return this._dummyVoice.get()}releaseAll(t){const e=this.toSeconds(t);return this._activeVoices.forEach(({voice:t})=>{t.triggerRelease(e)}),this}dispose(){return super.dispose(),this._dummyVoice.dispose(),this._voices.forEach(t=>t.dispose()),this._activeVoices=[],this._availableVoices=[],this.context.clearInterval(this._gcTimeout),this}}class kp extends Th{constructor(){super(),this.name="ToneAudioBuffers",this._buffers=new Map,this._loadingCount=0;const t=ch(kp.getDefaults(),arguments,["urls","onload","baseUrl"],"urls");this.baseUrl=t.baseUrl,Object.keys(t.urls).forEach(e=>{this._loadingCount++;const n=t.urls[e];this.add(e,n,this._bufferLoaded.bind(this,t.onload),t.onerror)})}static getDefaults(){return{baseUrl:"",onerror:Bh,onload:Bh,urls:{}}}has(t){return this._buffers.has(t.toString())}get(t){return ph(this.has(t),`ToneAudioBuffers has no buffer named: ${t}`),this._buffers.get(t.toString())}_bufferLoaded(t){this._loadingCount--,0===this._loadingCount&&t&&t()}get loaded(){return Array.from(this._buffers).every(([t,e])=>e.loaded)}add(t,e,n=Bh,r=Bh){return oh(e)?(this.baseUrl&&"data:audio/"===e.trim().substring(0,11).toLowerCase()&&(this.baseUrl=""),this._buffers.set(t.toString(),new qh(this.baseUrl+e,n,r))):this._buffers.set(t.toString(),new qh(e,n,r)),this}dispose(){return super.dispose(),this._buffers.forEach(t=>t.dispose()),this._buffers.clear(),this}}class Sp extends Gd{constructor(){const t=ch(Sp.getDefaults(),arguments,["urls","onload","baseUrl"],"urls");super(t),this.name="Sampler",this._activeSources=new Map;const e={};Object.keys(t.urls).forEach(n=>{const r=parseInt(n,10);if(ph(sh(n)||nh(r)&&isFinite(r),`url key is neither a note or midi pitch: ${n}`),sh(n)){const r=new Hh(this.context,n).toMidi();e[r]=t.urls[n]}else nh(r)&&isFinite(r)&&(e[r]=t.urls[r])}),this._buffers=new kp({urls:e,onload:t.onload,baseUrl:t.baseUrl,onerror:t.onerror}),this.attack=t.attack,this.release=t.release,this.curve=t.curve,this._buffers.loaded&&Promise.resolve().then(t.onload)}static getDefaults(){return Object.assign(Gd.getDefaults(),{attack:0,baseUrl:"",curve:"exponential",onload:Bh,onerror:Bh,release:.1,urls:{}})}_findClosest(t){let e=0;for(;e<96;){if(this._buffers.has(t+e))return-e;if(this._buffers.has(t-e))return e;e++}throw new Error(`No available buffers for note: ${t}`)}triggerAttack(t,e,n=1){return this.log("triggerAttack",t,e,n),Array.isArray(t)||(t=[t]),t.forEach(t=>{const r=ys(new Hh(this.context,t).toFrequency()),i=Math.round(r),o=r-i,s=this._findClosest(i),a=i-s,u=this._buffers.get(a),c=ms(s+o),l=new up({url:u,context:this.context,curve:this.curve,fadeIn:this.attack,fadeOut:this.release,playbackRate:c}).connect(this.output);l.start(e,0,u.duration/c,n),ih(this._activeSources.get(i))||this._activeSources.set(i,[]),this._activeSources.get(i).push(l),l.onended=()=>{if(this._activeSources&&this._activeSources.has(i)){const t=this._activeSources.get(i),e=t.indexOf(l);-1!==e&&t.splice(e,1)}}}),this}triggerRelease(t,e){return this.log("triggerRelease",t,e),Array.isArray(t)||(t=[t]),t.forEach(t=>{const n=new Hh(this.context,t).toMidi();if(this._activeSources.has(n)&&this._activeSources.get(n).length){const t=this._activeSources.get(n);e=this.toSeconds(e),t.forEach(t=>{t.stop(e)}),this._activeSources.set(n,[])}}),this}releaseAll(t){const e=this.toSeconds(t);return this._activeSources.forEach(t=>{for(;t.length;){t.shift().stop(e)}}),this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1)),this}triggerAttackRelease(t,e,n,r=1){const i=this.toSeconds(n);return this.triggerAttack(t,i,r),ih(e)?(ph(ih(t),"notes must be an array when duration is array"),t.forEach((t,n)=>{const r=e[Math.min(n,e.length-1)];this.triggerRelease(t,i+this.toSeconds(r))})):this.triggerRelease(t,i+this.toSeconds(e)),this}add(t,e,n){if(ph(sh(t)||isFinite(t),`note must be a pitch or midi: ${t}`),sh(t)){const r=new Hh(this.context,t).toMidi();this._buffers.add(r,e,n)}else this._buffers.add(t,e,n);return this}get loaded(){return this._buffers.loaded}dispose(){return super.dispose(),this._buffers.dispose(),this._activeSources.forEach(t=>{t.forEach(t=>t.dispose())}),this._activeSources.clear(),this}}s([ld(0)],Sp.prototype,"attack",void 0),s([ld(0)],Sp.prototype,"release",void 0);const Ap={synth:{new:t=>new Wd(t)},amsynth:{new:t=>new Hd(t)},duosynth:{new:t=>new rp(t)},fmsynth:{new:t=>new ip(t)},membranesynth:{new:t=>new op(t)},metalsynth:{new:t=>new ap(t)},monosynth:{new:t=>new tp(t)},noisesynth:{new:t=>new pp(t)},plucksynth:{new:t=>new wp(t)},polysynth:{new:(t,e)=>new Tp(t,e)},sampler:{new:t=>new Sp(t)}},Ep={synth:Wd,monosynth:tp,fmsynth:ip,duosyntho:rp,amsynth:Hd},Op={autofilter:{new:t=>new tonepkg.AutoFilter(t)},bitcrusher:{new:t=>new tonepkg.BitCrusher(t)},chebyshev:{new:t=>new tonepkg.Chebyshev(t)},pitchshift:{new:t=>new tonepkg.PitchShift(t)}},Cp=(t,e,n=!1)=>{try{if(e?.effect){return n?(globalThis.sound[t].set(e.effect.options),globalThis.sound[t]):Op[e.effect.type]?.new(e.effect.options)}throw"effect is not defined in the config"}catch(t){return}},Mp=()=>{globalThis.sound={}},Np=t=>{globalThis.sound[t]&&(globalThis.sound[t].dispose(),delete globalThis.sound[t])},{JZZ:Ip}=ds,jp=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in sound.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/sound.js"},{}),{24:["C"],25:["C#","Db"],26:["D"],27:["D#","Eb"],28:["E"],29:["F"],30:["F#","Gb"],31:["G"],32:["G#","Ab"],33:["A"],34:["A#","Bb"],35:["B"]}),Rp=(t,e=0)=>{const n=1+Math.floor((t-24)/12);return jp[t-12*(n-1)][e]+String(n)},Pp=t=>{const e=t[lg.LAMBDA_OBJ],n="_default"in e?e._default:void 0,r="instrument"in e||"inst"in e,i="source"in e||"src"in e,o="effect"in e||"fx"in e,s="target"in e||"trg"in e,a={codebase:"ghostos/api/parser/nodelogic/elements/library/sound.js",refnode:t[lg.REFNODE]},u=(wn("accio","ctrl_accio"),wn("accio","data_accio"));(n?a_(n,u,{},a.refnode):Promise.resolve({audionode:{type:"gain",value:.5},source:{type:"oscillator",options:{type:"sine"}},timing:{bpm:150},instrument:{type:"polysynth",voice:"synth",options:{}}})).then(e=>{t[lg.sound.CONFIG]=e});const c=(e=void 0)=>{if(e){const o=e._content.soundnode_trail.slice(-1)[0],a=t[lg.REFNODE];s?(i=o,globalThis.sound[i].toDestination()):o&&a&&(n=o,r=a,globalThis.sound[n].connect(globalThis.sound[r]))}var n,r,i;return{...e,_content:{soundnode_trail:e._content.soundnode_trail.concat(t[lg.REFNODE])}}},l=(e=void 0)=>{let n,s;e?(n=xn("soundconfig",e),t[lg.sound.CONFIG]=n):n=t[lg.sound.CONFIG],s=r?((t,e,n=!1)=>{try{if(e?.instrument)return n?(globalThis.sound[t].set(e.instrument.options),globalThis.sound[t]):Ap[e.instrument.type]?.new(e.instrument.voice?Ep[e.instrument.voice]:Wd,e.instrument.options);throw"instrument is not defined in the config"}catch(t){return}})(t[lg.REFNODE],n):i?void 0:o?Cp(t[lg.REFNODE],n,void 0!==t[lg.sound.SOUNDSTAGE]):Cp(t[lg.REFNODE],n),t[lg.sound.SOUNDSTAGE]=s,((t,e)=>{globalThis.sound[t]=e})(t[lg.REFNODE],s)};return{leaflogic:(e,n)=>{const r=new qt(void 0),i=n._stream.pipe(V(e=>(t[lg.CTRLIN]=e,e)),Nt(...e.map(t=>t._stream)),V(e=>{const n=e.slice(1).flat().map(t=>{if("_data_in"===t._bname)return xn("*",t);if("_midi_in"===t._bname){const{cmd:e,noteNumber:n,velocity:r}=t._content;return t}if("soundconfig"===t._bname)l(t);else if("soundinit"===t._bname)return c(t)}).filter(t=>t);return n.length>0&&r.next(n),t[lg.CTRLIN]}),Lt());return{_stream:r.pipe($t(t=>t)),_control:{_stream:i}}},datalogic:{pre:e=>{const n=e;return t[lg.sound.SOUNDSTAGE]||s||l(),s&&"started"!==tonepkg.Transport.state&&(tonepkg.start(),tonepkg.Transport.start()),n},post:n=>{const r=Object.keys(e),i=["image","audio","video"].filter(t=>r.includes(t));i.length>0&&i[0];Array.isArray(n);let o=n.map(e=>{if("_midi_in"===e._bname){const n=t[lg.sound.SOUNDSTAGE];if(e._content.velocity>0){const t=Rp(e._content.noteNumber),r=e._content.duration;r?n.triggerAttackRelease(t,r):n.triggerAttack(t)}else{const t=Rp(e._content.noteNumber);n.triggerRelease(t)}return Tn}return e});o=1===o.length?o[0]:o;return o}}}},Dp=wn("error",{type:"critical",message:"LEAF core error: race condition detected in gnav.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/gnav.js"},{}),Lp=t=>{const e=t[lg.LAMBDA_OBJ],n="elementio"in e,r="edges"in e&&"_default"in e.edges?e.edges._default:void 0,i="backdrop"in e&&"_default"in e.backdrop?e.backdrop._default:void 0,o={codebase:"ghostos/api/parser/nodelogic/elements/library/gnav.js",refnode:t[lg.REFNODE]};let s={};return{leaflogic:(e,n)=>{s=n._config;const a=new Pt,u=r?p_(n,e,void 0,o,{leaflogic:r,datalogic:{post:e=>(t[lg.gnav.EDGES]=e,e)}}):{_stream:ln([]),_control:n._stream},c=(i?p_(u._control,e,void 0,o,{leaflogic:i,datalogic:{post:e=>(t[lg.gnav.BACKDROP]=e,e)}}):{_stream:ln("/assets/test/hubbleinfrared_dark2.jpg"),_control:u._control})._control._stream.pipe(Nt(...e.map(t=>t._stream)),V(t=>{const e=t[1];return void 0!==e&&a.next(e),t[0]}));return{_stream:a,_control:{_stream:c}}},datalogic:{pre:t=>Array.isArray(t)?t.map(t=>xn("screenio",t)).filter(t=>t):xn("screenio",t),post:r=>{const i=r,o=xn(t[lg.gnav.EDGES]),a=(o||[]).map(t=>({...t,uuid:uuid4()})),u=t[lg.gnav.BACKDROP],c=Object.keys(e),l=(["edges","backdrop","tagvectors","tagaction","blankaction"].filter(t=>c.includes(t)),new qt(Dp)),h=hg({element:{nodeuuid:t[lg.REFNODE],type:"gnav",componentdata:{graph_data:{nodes:Array.isArray(i)?i:[i],edges:a},backdrop_url:u,bgtagvectors:async()=>{const t="tagvectors"in e&&"_default"in e.tagvectors?e.tagvectors._default:void 0;return t?await a_(t,[],{...s}):[]},tagaction:async r=>{const i="tagaction"in e&&"_default"in e.tagaction?e.tagaction._default:void 0,o=i?await a_(i,r,{...s}):r;return n&&l.next(wn("elementio",{element:"gnav",nodeuuid:t[lg.REFNODE],io:{tagaction:o}})),o},blankaction:async t=>{const n="blankaction"in e&&"_default"in e.blankaction?e.blankaction._default:void 0;return n?await a_(n,t,{...s}):t},graph_options:{layout:"3d"},...t[lg.RTCONTEXT]}}},"screenio");return h}}}},{memoize:Fp}=bn,$p=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in http.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library.js"},{}),t=>{const e=t[lg.LAMBDA_OBJ],n="uri"in e&&"_default"in e.uri?e.uri._default:void 0,r="header"in e&&"_default"in e.header?e.header._default:void 0,i={codebase:"ghostos/api/parser/nodelogic/elements/library/http.js",refnode:t[lg.REFNODE]},o=async(n,r={})=>{let i=t[lg.http.URI],o=t[lg.http.HEADER],s=n;s=1===s.length?s[0]:s;const a=Object.keys(e),u=["uri","post","put","get","header","?graph"].filter(t=>a.includes(t));let c=u.includes("post")?"post":u.includes("put")?"put":"get";"{*}"===i&&nn(s)&&"http-request"===s._bname&&(i=s._content.uri?s._content.uri:"https://www.leafgon.com",o=s._content.header?s._content.header:o,c=s._content.mode?s._content.mode:c,s=s._content.data?s._content.data:"");const l=lg.DOMAIN?t[lg.DOMAIN]:void 0,h=lg.APPID?t[lg.APPID]:void 0,d=u.includes("?graph")?i+`?graph=${l}/${h}`:i;let p;r.some(t=>Object.values(t).some(t=>"object"==typeof t&&"leaf-nodejs"===t._label?.provenance&&(p=t._content,!0)));const f=bn.throttle(async()=>await(async({http_mode:t,uri:e}={})=>{if(["post","put"].includes(t))try{const n=e?fetch(e,{method:t.toUpperCase(),mode:"cors",headers:p?{...o,Cookie:p}:{...o},credentials:"include",body:JSON.stringify(s)}):ln([{data:"LEAF element error: http get request submitted with undefined URI"}]),r=await n;return await r.json()}catch(t){return t.response||t.request,t.response}else try{const t=e?fetch(e,{method:"GET",headers:p?{...o,Accept:"application/json",Cookie:p}:{...o,Accept:"application/json"},credentials:"include"}):ln([{data:"LEAF element error: http get request submitted with undefined URI"}]),n=await t;return await n.json()}catch(t){return t.response||t.request,t}})({http_mode:c,uri:d}),1e3);return await f()};return{leaflogic:(e,s)=>{const a=new Pt,u=n?p_(s,e,void 0,i,{leaflogic:n,datalogic:{post:e=>(t[lg.http.URI]=e,e)}}):(t[lg.http.URI]="{*}",{_stream:new qt("{*}"),_control:{_stream:s._stream}}),c=r?p_(s,e,void 0,i,{leaflogic:r,datalogic:{post:e=>(t[lg.http.HEADER]=e,e)}}):(t[lg.http.HEADER]="",{_stream:new qt(""),_control:{_stream:s._stream}}),l=Et([u._control._stream,c._control._stream]),h=Et([u._stream,c._stream]),d=l.pipe(Nt(h),V(t=>t[0]));let p=!1;const f=d.pipe(Nt(...e.map(t=>t._stream)),It(t=>o(t.slice(1),t[0])),V(e=>(p=!0,e?.length>1||!Array.isArray(e)?a.next(e):1===e?.length&&a.next(e[0]),t[lg.CTRLIN])),Lt());return{_stream:a.pipe($t(t=>p),V(t=>t),Lt()),_control:{_stream:f.pipe(V(t=>t),Lt())}}},datalogic:{pre:t=>t,post:t=>{const e=t,n=t=>{const e=typeof t;return"object"===e?Array.isArray(t)?t.map(t=>n(t)):t?Object.fromEntries(Object.entries(t).map(([t,e])=>[t,n(e)])):t:"string"===e?(t=>{var e={"&":"&","<":"<",">":">",'"':""","'":"'"};return t.replace(/[&<>"']/g,function(t){return e[t]})})(t):t};return hg(e?.name&&"AxiosError"===e.name?{error:e.message,data:e.response.data}:n(e),"elementio")}}}}),{memoize:Bp}=bn,qp=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in href.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library.js"},{}),t=>{const e=t[lg.LAMBDA_OBJ],n="uri"in e&&"_default"in e.uri?e.uri._default:void 0,r={codebase:"ghostos/api/parser/nodelogic/elements/library/href.js",refnode:t[lg.REFNODE]},i=async n=>{let r=t[lg.href.URI],i=n;i=1===i.length?i[0]:i;const o=Object.keys(e),s=["uri","post","put","get","header","?graph"].filter(t=>o.includes(t));"{*}"===r&&nn(i)&&"href-request"===i._bname&&(r=i._content.uri?i._content.uri:"https://www.leafgon.com",i=i._content.data?i._content.data:"");const a=lg.DOMAIN?t[lg.DOMAIN]:void 0,u=lg.APPID?t[lg.APPID]:void 0,c=s.includes("?graph")?r+`?graph=${a}/${u}`:r,l=bn.throttle(async()=>await(async({uri:t}={})=>{try{return"undefined"!=typeof window&&window.location.href.slice(-t.length)!==t&&(window.location.href=t),t}catch(t){return t}})({uri:c}),1e3);return await l()};return{leaflogic:(e,o)=>{const s=new Pt,a=n?p_(o,e,void 0,r,{leaflogic:n,datalogic:{post:e=>(t[lg.href.URI]=e,e)}}):(t[lg.href.URI]="{*}",{_stream:new qt("{*}"),_control:{_stream:o._stream}}),u=a._control._stream,c=a._stream,l=u.pipe(Nt(c),V(t=>t[0]));let h=!1;const d=l.pipe(Nt(...e.map(t=>t._stream)),It(t=>i(t.slice(1))),V(e=>(h=!0,e?.length>1||!Array.isArray(e)?s.next(e):1===e?.length&&s.next(e[0]),t[lg.CTRLIN])),Lt());return{_stream:s.pipe($t(t=>h),V(t=>t),Lt()),_control:{_stream:d.pipe(V(t=>t),Lt())}}},datalogic:{pre:t=>t}}});var Up=n(639);wn("error",{type:"critical",message:"LEAF core error: race condition detected in text.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/text.js"},{});const Vp=t=>{const e=new Pt,n=new Pt,r=new Pt,i=t[lg.LAMBDA_OBJ],o="_default"in i?i._default:void 0,s={codebase:"ghostos/api/parser/nodelogic/elements/library/html.js",...t},a=wn("accio","ctrl_accio"),u=wn("accio","data_accio"),c=o?p_({_stream:ln(a)},[{_stream:ln(u)}],void 0,s,{leaflogic:o,datalogic:{post:t=>t}}):{_stream:ln(""),_control:{_stream:ln(a)}};t[lg.html.TEMPLATE]=void 0,cn(c._control._stream.pipe(Nt(c._stream))).then(e=>{const n=typeof e[1];if("string"===n)t[lg.html.TEMPLATE]={_default:Up.compile(e[1])};else if("object"===n){const n={};Object.entries(e[1]).map(([t,e])=>{const r=[e].flat().map(t=>{if("string"==typeof t)return t}).filter(t=>void 0!==t).join("\n");""!==r&&(n[t]=Up.compile(r))}),Object.keys(n).length>0&&(t[lg.html.TEMPLATE]=n)}Up.registerHelper("markdown",function(t){t=(t=(t=(t=(t=(t=t.replace(/>/gm,">")).replace(/</gm,"<")).replace(/&/gm,"&")).replace(/(\r\n|\n|\r)/gm,"\n")).replace(/\\"/gm,'\\"')).replace(/"/gm,'"');return`atob('${Buffer.from(t).toString("base64")}')`}),Up.registerHelper("json",function(t){const e=Buffer.from(JSON.stringify(t,function t(e,n){const r=typeof n;if("string"===r){const t=/^\{((?:-(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))|(?:0|(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))))(?:.\d+|))\}$/,e=n.match(t);if(null!==e){return Number(e[1])}return n}if("object"===r){if(Array.isArray(n))return n.map((e,n)=>t(n,e));return Object.assign({},...Object.entries(n).map(([e,n])=>({[e]:t(e,n)})))}return n})).toString("base64");return`JSON.parse(atob('${e}'))`}),Up.registerHelper("tostring",function(t){return String(t)}),r.next()});return{elementio$:n,leaflogic:(i,o)=>{const s=o._stream.pipe(Nt(...i.map(t=>t._stream)),It(e=>{const i=new qt(e[0]),o=new qt(e[1]);return t[lg.html.TEMPLATE]?Et(i,Bt(o,n)):r.pipe(Nt(i,Bt(o,n)),V(t=>t[1]))}),V(r=>{const i=t[lg.html.TEMPLATE],o=r[1];if(nn(o)&&"elementio"===o._bname)return e.next(o),r[0];if(void 0!==i){const s=((t,e)=>{if(void 0!==e){const n=Object.keys(e);return(1===n.length&&n.includes("_default")?[e._default(Object.assign({},...[t].flat().map(t=>xn("*",t))))]:[t].flat().sort((t,e)=>{const n=t._label?.tag?.toLowerCase(),r=e._label?.tag?.toLowerCase();return n>r?1:n<r?-1:0}).map(t=>{if(nn(t)){const n=xn("*",t),r=t._bname;return[n].flat().map(t=>t&&r in e?e[r](t):t&&"_default"in e?e._default(t):"string"==typeof t?t:void 0).filter(t=>void 0!==t).join("\n")}}).filter(t=>void 0!==t)).join("\n").replace(/(\r\n|\n|\r)/gm,"")}return t})(o,i),a=hg({element:{nodeuuid:t[lg.REFNODE],type:"html",componentdata:{innerhtml:s,callback:t=>{n.next(wn("elementio",t))},...t[lg.RTCONTEXT]}}},"screenio");return e.next(a),r[0]}}),$t(t=>void 0!==t));return{_stream:e,_control:{_stream:s}}},datalogic:{pre:t=>t,post:t=>t}}},Gp=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in text.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library/text.js"},{}),t=>{const e=new Pt,n=new Pt,r=new Pt,i=t[lg.LAMBDA_OBJ],o="_default"in i?i._default:void 0,s="single"in i,a={codebase:"ghostos/api/parser/nodelogic/elements/library/form.js",...t},u=wn("accio","ctrl_accio"),c=wn("accio","data_accio"),l=o?p_({_stream:ln(u)},[{_stream:ln(c)}],void 0,a,{leaflogic:o,datalogic:{post:t=>t}}):{_stream:ln(""),_control:{_stream:ln(u)}};t[lg.html.TEMPLATE]=void 0,cn(l._control._stream.pipe(Nt(l._stream))).then(e=>{const n=typeof e[1];if("string"===n)t[lg.html.TEMPLATE]={_default:Up.compile(e[1])};else if("object"===n){const n={};Object.entries(e[1]).map(([t,e])=>{const r=[e].flat().map(t=>{if("string"==typeof t)return t}).filter(t=>void 0!==t).join("\n");""!==r&&(n[t]=Up.compile(r))}),Object.keys(n).length>0&&(t[lg.html.TEMPLATE]=n)}Up.registerHelper("json",function(t){return JSON.stringify(t,function t(e,n){const r=typeof n;if("string"===r){const t=/^\{((?:-(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))|(?:0|(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))))(?:.\d+|))\}$/,e=n.match(t);if(null!==e){return Number(e[1])}return n}if("object"===r){if(Array.isArray(n))return n.map((e,n)=>t(n,e));return Object.assign({},...Object.entries(n).map(([e,n])=>({[e]:t(e,n)})))}return n})}),r.next()});return{elementio$:n,leaflogic:(i,o)=>{const a=o._stream.pipe(Nt(...i.map(t=>t._stream)),It(e=>{const i=new qt(e[0]),o=new qt(e[1]);return t[lg.html.TEMPLATE]?Et(i,Bt(o,n)):r.pipe(Nt(i,Bt(o,n)),V(t=>t[1]))}),V(n=>{const r=t[lg.html.TEMPLATE],i=n[1];if(nn(i)&&"elementio"===i._bname)return e.next(i),n[0];if(void 0!==r){const r=(()=>{const e=`\n <script type='text/babel'>\n const Form = JSONSchemaForm.default;\n const schema = {\n title: 'react-jsonschema-form demo',\n type: 'object',\n required: ['name', 'email'],\n properties: {\n name: {type: 'string', minLength: 3},\n email: {type: 'string'},\n dob: {type: 'string'},\n age: {type: 'number'},\n thing: {type: 'string'},\n other: {type: 'string'},\n }\n };\n const uiSchema = {\n email: {\n 'ui:options': {\n inputType: 'email'\n }\n },\n dob: {\n 'ui:widget': 'alt-date',\n 'ui:options': {\n yearsRange: [1980, 2030],\n hideNowButton: true,\n hideClearButton: true,\n },\n },\n };\n \n function Tpl(props) {\n const {id, label, required, children} = props;\n return (\n <div className='myfield'>\n <label htmlFor={id}>{label}{required ? '*' : null}</label>\n {children}\n </div>\n );\n };\n\n function dosubmit({ formData }, e) {\n doelementio({_bname: '${t[lg.REFNODE].slice(0,8)}', _content: formData, _label: {refnode: '${t[lg.REFNODE]}'}});\n };\n\n function SubmitButton(props) {\n const { uiSchema } = props;\n return (\n <button type='submit'>\n Yadda\n </button>\n );\n }\n \n ReactDOM.render(\n (<Form onSubmit={dosubmit} className='row' schema={schema} uiSchema={uiSchema} FieldTemplate={Tpl} liveValidate >\n <div style={{marginBottom: '70px'}}>\n <button className='unicornbutton' type='submit'>\n Yadda\n </button>\n </div>\n </Form>\n ),\n document.getElementById('${t[lg.REFNODE]}')\n );\n <\/script>\n `,n=`\n <div id='${t[lg.REFNODE]}'></div>\n `,r=t=>t.replace(/(\r\n|\n|\r)/gm,"").replace(/(\s+)/gm," "),i=t[lg.REFNODE].slice(0,8),o=s?"form-style":"form-style-"+i,a=s?"form-script":"form-script-"+i,u=s?"form-body":"form-body-"+i;return wn(i,{"form-common":r("\n \x3c!-- Bootstrap core CSS --\x3e\n <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css' rel='stylesheet' integrity='sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH' crossorigin='anonymous'>\n <script crossorigin src='https://unpkg.com/react@17.0.2/umd/react.development.js'><\/script>\n <script crossorigin src='https://unpkg.com/react-dom@17.0.2/umd/react-dom.development.js'><\/script>\n <script src='https://unpkg.com/@babel/standalone@7.23.10/babel.min.js'><\/script>\n <script src='https://unpkg.com/@rjsf/core@4.2.3/dist/react-jsonschema-form.js'><\/script>\n "),[o]:r("\n <style>\n .unicornbutton {\n background-image: url('https://leas3.ams3.cdn.digitaloceanspaces.com/static/lax/assets/button-bg.jpg');\n width: 250px;\n height: 70px;\n background-size: 160px;\n color: white;\n font-weight: 800;\n text-align: center;\n line-height: 70px;\n font-size: 30px;\n text-decoration: none;\n border-radius: 20px;\n z-index: 100;\n pointer-events: all;\n cursor: pointer;\n }\n </style>\n "),[a]:r(e),[u]:r(n)},{uuid:t[lg.REFNODE]})})();return e.next(r),n[0]}}),$t(t=>void 0!==t));return{_stream:e,_control:{_stream:a}}},datalogic:{pre:t=>t,post:t=>t}}});function zp(t,e){return function(){return t.apply(e,arguments)}}const{toString:Wp}=Object.prototype,{getPrototypeOf:Jp}=Object,{iterator:Hp,toStringTag:Xp}=Symbol,Kp=(Qp=Object.create(null),t=>{const e=Wp.call(t);return Qp[e]||(Qp[e]=e.slice(8,-1).toLowerCase())});var Qp;const Zp=t=>(t=t.toLowerCase(),e=>Kp(e)===t),Yp=t=>e=>typeof e===t,{isArray:tf}=Array,ef=Yp("undefined");function nf(t){return null!==t&&!ef(t)&&null!==t.constructor&&!ef(t.constructor)&&sf(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const rf=Zp("ArrayBuffer");const of=Yp("string"),sf=Yp("function"),af=Yp("number"),uf=t=>null!==t&&"object"==typeof t,cf=t=>{if("object"!==Kp(t))return!1;const e=Jp(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Xp in t||Hp in t)},lf=Zp("Date"),hf=Zp("File"),df=Zp("Blob"),pf=Zp("FileList"),ff=Zp("URLSearchParams"),[mf,gf,_f,yf]=["ReadableStream","Request","Response","Headers"].map(Zp);function vf(t,e,{allOwnKeys:n=!1}={}){if(null==t)return;let r,i;if("object"!=typeof t&&(t=[t]),tf(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{if(nf(t))return;const i=n?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let s;for(r=0;r<o;r++)s=i[r],e.call(null,t[s],s,t)}}function bf(t,e){if(nf(t))return null;e=e.toLowerCase();const n=Object.keys(t);let r,i=n.length;for(;i-- >0;)if(r=n[i],e===r.toLowerCase())return r;return null}const wf="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,xf=t=>!ef(t)&&t!==wf;const Tf=(kf="undefined"!=typeof Uint8Array&&Jp(Uint8Array),t=>kf&&t instanceof kf);var kf;const Sf=Zp("HTMLFormElement"),Af=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Ef=Zp("RegExp"),Of=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};vf(n,(n,i)=>{let o;!1!==(o=e(n,i,t))&&(r[i]=o||n)}),Object.defineProperties(t,r)};const Cf=Zp("AsyncFunction"),Mf=(Nf="function"==typeof setImmediate,If=sf(wf.postMessage),Nf?setImmediate:If?(jf=`axios@${Math.random()}`,Rf=[],wf.addEventListener("message",({source:t,data:e})=>{t===wf&&e===jf&&Rf.length&&Rf.shift()()},!1),t=>{Rf.push(t),wf.postMessage(jf,"*")}):t=>setTimeout(t));var Nf,If,jf,Rf;const Pf="undefined"!=typeof queueMicrotask?queueMicrotask.bind(wf):"undefined"!=typeof process&&process.nextTick||Mf,Df={isArray:tf,isArrayBuffer:rf,isBuffer:nf,isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||sf(t.append)&&("formdata"===(e=Kp(t))||"object"===e&&sf(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&rf(t.buffer),e},isString:of,isNumber:af,isBoolean:t=>!0===t||!1===t,isObject:uf,isPlainObject:cf,isEmptyObject:t=>{if(!uf(t)||nf(t))return!1;try{return 0===Object.keys(t).length&&Object.getPrototypeOf(t)===Object.prototype}catch(t){return!1}},isReadableStream:mf,isRequest:gf,isResponse:_f,isHeaders:yf,isUndefined:ef,isDate:lf,isFile:hf,isBlob:df,isRegExp:Ef,isFunction:sf,isStream:t=>uf(t)&&sf(t.pipe),isURLSearchParams:ff,isTypedArray:Tf,isFileList:pf,forEach:vf,merge:function t(){const{caseless:e,skipUndefined:n}=xf(this)&&this||{},r={},i=(i,o)=>{const s=e&&bf(r,o)||o;cf(r[s])&&cf(i)?r[s]=t(r[s],i):cf(i)?r[s]=t({},i):tf(i)?r[s]=i.slice():n&&ef(i)||(r[s]=i)};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&vf(arguments[t],i);return r},extend:(t,e,n,{allOwnKeys:r}={})=>(vf(e,(e,r)=>{n&&sf(e)?Object.defineProperty(t,r,{value:zp(e,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,r,{value:e,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},toFlatObject:(t,e,n,r)=>{let i,o,s;const a={};if(e=e||{},null==t)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],r&&!r(s,t,e)||a[s]||(e[s]=t[s],a[s]=!0);t=!1!==n&&Jp(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:Kp,kindOfTest:Zp,endsWith:(t,e,n)=>{t=String(t),(void 0===n||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return-1!==r&&r===n},toArray:t=>{if(!t)return null;if(tf(t))return t;let e=t.length;if(!af(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},forEachEntry:(t,e)=>{const n=(t&&t[Hp]).call(t);let r;for(;(r=n.next())&&!r.done;){const n=r.value;e.call(t,n[0],n[1])}},matchAll:(t,e)=>{let n;const r=[];for(;null!==(n=t.exec(e));)r.push(n);return r},isHTMLForm:Sf,hasOwnProperty:Af,hasOwnProp:Af,reduceDescriptors:Of,freezeMethods:t=>{Of(t,(e,n)=>{if(sf(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=t[n];sf(r)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(t,e)=>{const n={},r=t=>{t.forEach(t=>{n[t]=!0})};return tf(t)?r(t):r(String(t).split(e)),n},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,e,n){return e.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(t,e)=>null!=t&&Number.isFinite(t=+t)?t:e,findKey:bf,global:wf,isContextDefined:xf,isSpecCompliantForm:function(t){return!!(t&&sf(t.append)&&"FormData"===t[Xp]&&t[Hp])},toJSONObject:t=>{const e=new Array(10),n=(t,r)=>{if(uf(t)){if(e.indexOf(t)>=0)return;if(nf(t))return t;if(!("toJSON"in t)){e[r]=t;const i=tf(t)?[]:{};return vf(t,(t,e)=>{const o=n(t,r+1);!ef(o)&&(i[e]=o)}),e[r]=void 0,i}}return t};return n(t,0)},isAsyncFn:Cf,isThenable:t=>t&&(uf(t)||sf(t))&&sf(t.then)&&sf(t.catch),setImmediate:Mf,asap:Pf,isIterable:t=>null!=t&&sf(t[Hp])};class Lf extends Error{static from(t,e,n,r,i,o){const s=new Lf(t.message,e||t.code,n,r,i);return s.cause=t,s.name=t.name,o&&Object.assign(s,o),s}constructor(t,e,n,r,i){super(t),this.name="AxiosError",this.isAxiosError=!0,e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Df.toJSONObject(this.config),code:this.code,status:this.status}}}Lf.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Lf.ERR_BAD_OPTION="ERR_BAD_OPTION",Lf.ECONNABORTED="ECONNABORTED",Lf.ETIMEDOUT="ETIMEDOUT",Lf.ERR_NETWORK="ERR_NETWORK",Lf.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Lf.ERR_DEPRECATED="ERR_DEPRECATED",Lf.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Lf.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Lf.ERR_CANCELED="ERR_CANCELED",Lf.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Lf.ERR_INVALID_URL="ERR_INVALID_URL";const Ff=Lf;function $f(t){return Df.isPlainObject(t)||Df.isArray(t)}function Bf(t){return Df.endsWith(t,"[]")?t.slice(0,-2):t}function qf(t,e,n){return t?t.concat(e).map(function(t,e){return t=Bf(t),!n&&e?"["+t+"]":t}).join(n?".":""):e}const Uf=Df.toFlatObject(Df,{},null,function(t){return/^is[A-Z]/.test(t)});const Vf=function(t,e,n){if(!Df.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const r=(n=Df.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(t,e){return!Df.isUndefined(e[t])})).metaTokens,i=n.visitor||c,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Df.isSpecCompliantForm(e);if(!Df.isFunction(i))throw new TypeError("visitor must be a function");function u(t){if(null===t)return"";if(Df.isDate(t))return t.toISOString();if(Df.isBoolean(t))return t.toString();if(!a&&Df.isBlob(t))throw new Ff("Blob is not supported. Use a Buffer instead.");return Df.isArrayBuffer(t)||Df.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function c(t,n,i){let a=t;if(t&&!i&&"object"==typeof t)if(Df.endsWith(n,"{}"))n=r?n:n.slice(0,-2),t=JSON.stringify(t);else if(Df.isArray(t)&&function(t){return Df.isArray(t)&&!t.some($f)}(t)||(Df.isFileList(t)||Df.endsWith(n,"[]"))&&(a=Df.toArray(t)))return n=Bf(n),a.forEach(function(t,r){!Df.isUndefined(t)&&null!==t&&e.append(!0===s?qf([n],r,o):null===s?n:n+"[]",u(t))}),!1;return!!$f(t)||(e.append(qf(i,n,o),u(t)),!1)}const l=[],h=Object.assign(Uf,{defaultVisitor:c,convertValue:u,isVisitable:$f});if(!Df.isObject(t))throw new TypeError("data must be an object");return function t(n,r){if(!Df.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),Df.forEach(n,function(n,o){!0===(!(Df.isUndefined(n)||null===n)&&i.call(e,n,Df.isString(o)?o.trim():o,r,h))&&t(n,r?r.concat(o):[o])}),l.pop()}}(t),e};function Gf(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}function zf(t,e){this._pairs=[],t&&Vf(t,this,e)}const Wf=zf.prototype;Wf.append=function(t,e){this._pairs.push([t,e])},Wf.toString=function(t){const e=t?function(e){return t.call(this,e,Gf)}:Gf;return this._pairs.map(function(t){return e(t[0])+"="+e(t[1])},"").join("&")};const Jf=zf;function Hf(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Xf(t,e,n){if(!e)return t;const r=n&&n.encode||Hf,i=Df.isFunction(n)?{serialize:n}:n,o=i&&i.serialize;let s;if(s=o?o(e,i):Df.isURLSearchParams(e)?e.toString():new Jf(e,i).toString(r),s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t}const Kf=class{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Df.forEach(this.handlers,function(e){null!==e&&t(e)})}},Qf={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Zf={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Jf,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Yf="undefined"!=typeof window&&"undefined"!=typeof document,tm="object"==typeof navigator&&navigator||void 0,em=Yf&&(!tm||["ReactNative","NativeScript","NS"].indexOf(tm.product)<0),nm="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,rm=Yf&&window.location.href||"http://localhost",im={...r,...Zf};const om=function(t){function e(t,n,r,i){let o=t[i++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=i>=t.length;if(o=!o&&Df.isArray(r)?r.length:o,a)return Df.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!s;r[o]&&Df.isObject(r[o])||(r[o]=[]);return e(t,n,r[o],i)&&Df.isArray(r[o])&&(r[o]=function(t){const e={},n=Object.keys(t);let r;const i=n.length;let o;for(r=0;r<i;r++)o=n[r],e[o]=t[o];return e}(r[o])),!s}if(Df.isFormData(t)&&Df.isFunction(t.entries)){const n={};return Df.forEachEntry(t,(t,r)=>{e(function(t){return Df.matchAll(/\w+|\[(\w*)]/g,t).map(t=>"[]"===t[0]?"":t[1]||t[0])}(t),r,n,0)}),n}return null};const sm={transitional:Qf,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",r=n.indexOf("application/json")>-1,i=Df.isObject(t);i&&Df.isHTMLForm(t)&&(t=new FormData(t));if(Df.isFormData(t))return r?JSON.stringify(om(t)):t;if(Df.isArrayBuffer(t)||Df.isBuffer(t)||Df.isStream(t)||Df.isFile(t)||Df.isBlob(t)||Df.isReadableStream(t))return t;if(Df.isArrayBufferView(t))return t.buffer;if(Df.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return Vf(t,new im.classes.URLSearchParams,{visitor:function(t,e,n,r){return im.isNode&&Df.isBuffer(t)?(this.append(e,t.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...e})}(t,this.formSerializer).toString();if((o=Df.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return Vf(o?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||r?(e.setContentType("application/json",!1),function(t,e,n){if(Df.isString(t))try{return(e||JSON.parse)(t),Df.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||sm.transitional,n=e&&e.forcedJSONParsing,r="json"===this.responseType;if(Df.isResponse(t)||Df.isReadableStream(t))return t;if(t&&Df.isString(t)&&(n&&!this.responseType||r)){const n=!(e&&e.silentJSONParsing)&&r;try{return JSON.parse(t,this.parseReviver)}catch(t){if(n){if("SyntaxError"===t.name)throw Ff.from(t,Ff.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:im.classes.FormData,Blob:im.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Df.forEach(["delete","get","head","post","put","patch"],t=>{sm.headers[t]={}});const am=sm,um=Df.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),cm=Symbol("internals");function lm(t){return t&&String(t).trim().toLowerCase()}function hm(t){return!1===t||null==t?t:Df.isArray(t)?t.map(hm):String(t)}function dm(t,e,n,r,i){return Df.isFunction(r)?r.call(this,e,n):(i&&(e=n),Df.isString(e)?Df.isString(r)?-1!==e.indexOf(r):Df.isRegExp(r)?r.test(e):void 0:void 0)}class pm{constructor(t){t&&this.set(t)}set(t,e,n){const r=this;function i(t,e,n){const i=lm(e);if(!i)throw new Error("header name must be a non-empty string");const o=Df.findKey(r,i);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||e]=hm(t))}const o=(t,e)=>Df.forEach(t,(t,n)=>i(t,n,e));if(Df.isPlainObject(t)||t instanceof this.constructor)o(t,e);else if(Df.isString(t)&&(t=t.trim())&&!(t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()))(t))o((t=>{const e={};let n,r,i;return t&&t.split("\n").forEach(function(t){i=t.indexOf(":"),n=t.substring(0,i).trim().toLowerCase(),r=t.substring(i+1).trim(),!n||e[n]&&um[n]||("set-cookie"===n?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e})(t),e);else if(Df.isObject(t)&&Df.isIterable(t)){let n,r,i={};for(const e of t){if(!Df.isArray(e))throw TypeError("Object iterator must return a key-value pair");i[r=e[0]]=(n=i[r])?Df.isArray(n)?[...n,e[1]]:[n,e[1]]:e[1]}o(i,e)}else null!=t&&i(e,t,n);return this}get(t,e){if(t=lm(t)){const n=Df.findKey(this,t);if(n){const t=this[n];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}(t);if(Df.isFunction(e))return e.call(this,t,n);if(Df.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=lm(t)){const n=Df.findKey(this,t);return!(!n||void 0===this[n]||e&&!dm(0,this[n],n,e))}return!1}delete(t,e){const n=this;let r=!1;function i(t){if(t=lm(t)){const i=Df.findKey(n,t);!i||e&&!dm(0,n[i],i,e)||(delete n[i],r=!0)}}return Df.isArray(t)?t.forEach(i):i(t),r}clear(t){const e=Object.keys(this);let n=e.length,r=!1;for(;n--;){const i=e[n];t&&!dm(0,this[i],i,t,!0)||(delete this[i],r=!0)}return r}normalize(t){const e=this,n={};return Df.forEach(this,(r,i)=>{const o=Df.findKey(n,i);if(o)return e[o]=hm(r),void delete e[i];const s=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,n)=>e.toUpperCase()+n)}(i):String(i).trim();s!==i&&delete e[i],e[s]=hm(r),n[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return Df.forEach(this,(n,r)=>{null!=n&&!1!==n&&(e[r]=t&&Df.isArray(n)?n.join(", "):n)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach(t=>n.set(t)),n}static accessor(t){const e=(this[cm]=this[cm]={accessors:{}}).accessors,n=this.prototype;function r(t){const r=lm(t);e[r]||(!function(t,e){const n=Df.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(t,n,i){return this[r].call(this,e,t,n,i)},configurable:!0})})}(n,t),e[r]=!0)}return Df.isArray(t)?t.forEach(r):r(t),this}}pm.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Df.reduceDescriptors(pm.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}}),Df.freezeMethods(pm);const fm=pm;function mm(t,e){const n=this||am,r=e||n,i=fm.from(r.headers);let o=r.data;return Df.forEach(t,function(t){o=t.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function gm(t){return!(!t||!t.__CANCEL__)}const _m=class extends Ff{constructor(t,e,n){super(null==t?"canceled":t,Ff.ERR_CANCELED,e,n),this.name="CanceledError",this.__CANCEL__=!0}};function ym(t,e,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?e(new Ff("Request failed with status code "+n.status,[Ff.ERR_BAD_REQUEST,Ff.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}const vm=function(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i,o=0,s=0;return e=void 0!==e?e:1e3,function(a){const u=Date.now(),c=r[s];i||(i=u),n[o]=a,r[o]=u;let l=s,h=0;for(;l!==o;)h+=n[l++],l%=t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),u-i<e)return;const d=c&&u-c;return d?Math.round(1e3*h/d):void 0}};const bm=function(t,e){let n,r,i=0,o=1e3/e;const s=(e,o=Date.now())=>{i=o,n=null,r&&(clearTimeout(r),r=null),t(...e)};return[(...t)=>{const e=Date.now(),a=e-i;a>=o?s(t,e):(n=t,r||(r=setTimeout(()=>{r=null,s(n)},o-a)))},()=>n&&s(n)]},wm=(t,e,n=3)=>{let r=0;const i=vm(50,250);return bm(n=>{const o=n.loaded,s=n.lengthComputable?n.total:void 0,a=o-r,u=i(a);r=o;t({loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:u||void 0,estimated:u&&s&&o<=s?(s-o)/u:void 0,event:n,lengthComputable:null!=s,[e?"download":"upload"]:!0})},n)},xm=(t,e)=>{const n=null!=t;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Tm=t=>(...e)=>Df.asap(()=>t(...e)),km=im.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,im.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(im.origin),im.navigator&&/(msie|trident)/i.test(im.navigator.userAgent)):()=>!0,Sm=im.hasStandardBrowserEnv?{write(t,e,n,r,i,o,s){if("undefined"==typeof document)return;const a=[`${t}=${encodeURIComponent(e)}`];Df.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),Df.isString(r)&&a.push(`path=${r}`),Df.isString(i)&&a.push(`domain=${i}`),!0===o&&a.push("secure"),Df.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(t){if("undefined"==typeof document)return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function Am(t,e,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);return t&&(r||0==n)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const Em=t=>t instanceof fm?{...t}:t;function Om(t,e){e=e||{};const n={};function r(t,e,n,r){return Df.isPlainObject(t)&&Df.isPlainObject(e)?Df.merge.call({caseless:r},t,e):Df.isPlainObject(e)?Df.merge({},e):Df.isArray(e)?e.slice():e}function i(t,e,n,i){return Df.isUndefined(e)?Df.isUndefined(t)?void 0:r(void 0,t,0,i):r(t,e,0,i)}function o(t,e){if(!Df.isUndefined(e))return r(void 0,e)}function s(t,e){return Df.isUndefined(e)?Df.isUndefined(t)?void 0:r(void 0,t):r(void 0,e)}function a(n,i,o){return o in e?r(n,i):o in t?r(void 0,n):void 0}const u={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(t,e,n)=>i(Em(t),Em(e),0,!0)};return Df.forEach(Object.keys({...t,...e}),function(r){const o=u[r]||i,s=o(t[r],e[r],r);Df.isUndefined(s)&&o!==a||(n[r]=s)}),n}const Cm=t=>{const e=Om({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=e;if(e.headers=s=fm.from(s),e.url=Xf(Am(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Df.isFormData(n))if(im.hasStandardBrowserEnv||im.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(Df.isFunction(n.getHeaders)){const t=n.getHeaders(),e=["content-type","content-length"];Object.entries(t).forEach(([t,n])=>{e.includes(t.toLowerCase())&&s.set(t,n)})}if(im.hasStandardBrowserEnv&&(r&&Df.isFunction(r)&&(r=r(e)),r||!1!==r&&km(e.url))){const t=i&&o&&Sm.read(o);t&&s.set(i,t)}return e},Mm="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise(function(e,n){const r=Cm(t);let i=r.data;const o=fm.from(r.headers).normalize();let s,a,u,c,l,{responseType:h,onUploadProgress:d,onDownloadProgress:p}=r;function f(){c&&c(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=fm.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());ym(function(t){e(t),f()},function(t){n(t),f()},{data:h&&"text"!==h&&"json"!==h?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:t,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new Ff("Request aborted",Ff.ECONNABORTED,t,m)),m=null)},m.onerror=function(e){const r=e&&e.message?e.message:"Network Error",i=new Ff(r,Ff.ERR_NETWORK,t,m);i.event=e||null,n(i),m=null},m.ontimeout=function(){let e=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const i=r.transitional||Qf;r.timeoutErrorMessage&&(e=r.timeoutErrorMessage),n(new Ff(e,i.clarifyTimeoutError?Ff.ETIMEDOUT:Ff.ECONNABORTED,t,m)),m=null},void 0===i&&o.setContentType(null),"setRequestHeader"in m&&Df.forEach(o.toJSON(),function(t,e){m.setRequestHeader(e,t)}),Df.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),h&&"json"!==h&&(m.responseType=r.responseType),p&&([u,l]=wm(p,!0),m.addEventListener("progress",u)),d&&m.upload&&([a,c]=wm(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(r.cancelToken||r.signal)&&(s=e=>{m&&(n(!e||e.type?new _m(null,t,m):e),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const _=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(r.url);_&&-1===im.protocols.indexOf(_)?n(new Ff("Unsupported protocol "+_+":",Ff.ERR_BAD_REQUEST,t)):m.send(i||null)})},Nm=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let n,r=new AbortController;const i=function(t){if(!n){n=!0,s();const e=t instanceof Error?t:this.reason;r.abort(e instanceof Ff?e:new _m(e instanceof Error?e.message:e))}};let o=e&&setTimeout(()=>{o=null,i(new Ff(`timeout of ${e}ms exceeded`,Ff.ETIMEDOUT))},e);const s=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(t=>{t.unsubscribe?t.unsubscribe(i):t.removeEventListener("abort",i)}),t=null)};t.forEach(t=>t.addEventListener("abort",i));const{signal:a}=r;return a.unsubscribe=()=>Df.asap(s),a}},Im=function*(t,e){let n=t.byteLength;if(!e||n<e)return void(yield t);let r,i=0;for(;i<n;)r=i+e,yield t.slice(i,r),i=r},jm=async function*(t){if(t[Symbol.asyncIterator])return void(yield*t);const e=t.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},Rm=(t,e,n,r)=>{const i=async function*(t,e){for await(const n of jm(t))yield*Im(n,e)}(t,e);let o,s=0,a=t=>{o||(o=!0,r&&r(t))};return new ReadableStream({async pull(t){try{const{done:e,value:r}=await i.next();if(e)return a(),void t.close();let o=r.byteLength;if(n){let t=s+=o;n(t)}t.enqueue(new Uint8Array(r))}catch(t){throw a(t),t}},cancel:t=>(a(t),i.return())},{highWaterMark:2})},{isFunction:Pm}=Df,Dm=(({Request:t,Response:e})=>({Request:t,Response:e}))(Df.global),{ReadableStream:Lm,TextEncoder:Fm}=Df.global,$m=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},Bm=t=>{t=Df.merge.call({skipUndefined:!0},Dm,t);const{fetch:e,Request:n,Response:r}=t,i=e?Pm(e):"function"==typeof fetch,o=Pm(n),s=Pm(r);if(!i)return!1;const a=i&&Pm(Lm),u=i&&("function"==typeof Fm?(c=new Fm,t=>c.encode(t)):async t=>new Uint8Array(await new n(t).arrayBuffer()));var c;const l=o&&a&&$m(()=>{let t=!1;const e=new n(im.origin,{body:new Lm,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),h=s&&a&&$m(()=>Df.isReadableStream(new r("").body)),d={stream:h&&(t=>t.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!d[t]&&(d[t]=(e,n)=>{let r=e&&e[t];if(r)return r.call(e);throw new Ff(`Response type '${t}' is not supported`,Ff.ERR_NOT_SUPPORT,n)})});const p=async(t,e)=>{const r=Df.toFiniteNumber(t.getContentLength());return null==r?(async t=>{if(null==t)return 0;if(Df.isBlob(t))return t.size;if(Df.isSpecCompliantForm(t)){const e=new n(im.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return Df.isArrayBufferView(t)||Df.isArrayBuffer(t)?t.byteLength:(Df.isURLSearchParams(t)&&(t+=""),Df.isString(t)?(await u(t)).byteLength:void 0)})(e):r};return async t=>{let{url:i,method:s,data:a,signal:u,cancelToken:c,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:_,headers:y,withCredentials:v="same-origin",fetchOptions:b}=Cm(t),w=e||fetch;_=_?(_+"").toLowerCase():"text";let x=Nm([u,c&&c.toAbortSignal()],f),T=null;const k=x&&x.unsubscribe&&(()=>{x.unsubscribe()});let S;try{if(g&&l&&"get"!==s&&"head"!==s&&0!==(S=await p(y,a))){let t,e=new n(i,{method:"POST",body:a,duplex:"half"});if(Df.isFormData(a)&&(t=e.headers.get("content-type"))&&y.setContentType(t),e.body){const[t,n]=xm(S,wm(Tm(g)));a=Rm(e.body,65536,t,n)}}Df.isString(v)||(v=v?"include":"omit");const e=o&&"credentials"in n.prototype,u={...b,signal:x,method:s.toUpperCase(),headers:y.normalize().toJSON(),body:a,duplex:"half",credentials:e?v:void 0};T=o&&new n(i,u);let c=await(o?w(T,b):w(i,u));const f=h&&("stream"===_||"response"===_);if(h&&(m||f&&k)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=c[e]});const e=Df.toFiniteNumber(c.headers.get("content-length")),[n,i]=m&&xm(e,wm(Tm(m),!0))||[];c=new r(Rm(c.body,65536,n,()=>{i&&i(),k&&k()}),t)}_=_||"text";let A=await d[Df.findKey(d,_)||"text"](c,t);return!f&&k&&k(),await new Promise((e,n)=>{ym(e,n,{data:A,headers:fm.from(c.headers),status:c.status,statusText:c.statusText,config:t,request:T})})}catch(e){if(k&&k(),e&&"TypeError"===e.name&&/Load failed|fetch/i.test(e.message))throw Object.assign(new Ff("Network Error",Ff.ERR_NETWORK,t,T),{cause:e.cause||e});throw Ff.from(e,e&&e.code,t,T)}}},qm=new Map,Um=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:i}=e,o=[r,i,n];let s,a,u=o.length,c=qm;for(;u--;)s=o[u],a=c.get(s),void 0===a&&c.set(s,a=u?new Map:Bm(e)),c=a;return a},Vm=(Um(),{http:null,xhr:Mm,fetch:{get:Um}});Df.forEach(Vm,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}});const Gm=t=>`- ${t}`,zm=t=>Df.isFunction(t)||null===t||!1===t;const Wm={getAdapter:function(t,e){t=Df.isArray(t)?t:[t];const{length:n}=t;let r,i;const o={};for(let s=0;s<n;s++){let n;if(r=t[s],i=r,!zm(r)&&(i=Vm[(n=String(r)).toLowerCase()],void 0===i))throw new Ff(`Unknown adapter '${n}'`);if(i&&(Df.isFunction(i)||(i=i.get(e))))break;o[n||"#"+s]=i}if(!i){const t=Object.entries(o).map(([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build"));let e=n?t.length>1?"since :\n"+t.map(Gm).join("\n"):" "+Gm(t[0]):"as no adapter specified";throw new Ff("There is no suitable adapter to dispatch the request "+e,"ERR_NOT_SUPPORT")}return i},adapters:Vm};function Jm(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new _m(null,t)}function Hm(t){Jm(t),t.headers=fm.from(t.headers),t.data=mm.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Wm.getAdapter(t.adapter||am.adapter,t)(t).then(function(e){return Jm(t),e.data=mm.call(t,t.transformResponse,e),e.headers=fm.from(e.headers),e},function(e){return gm(e)||(Jm(t),e&&e.response&&(e.response.data=mm.call(t,t.transformResponse,e.response),e.response.headers=fm.from(e.response.headers))),Promise.reject(e)})}const Xm="1.13.4",Km={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Km[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const Qm={};Km.transitional=function(t,e,n){return(r,i,o)=>{if(!1===t)throw new Ff(function(t,e){return"[Axios v"+Xm+"] Transitional option '"+t+"'"+e+(n?". "+n:"")}(i," has been removed"+(e?" in "+e:"")),Ff.ERR_DEPRECATED);return e&&!Qm[i]&&(Qm[i]=!0),!t||t(r,i,o)}},Km.spelling=function(t){return(t,e)=>!0};const Zm={assertOptions:function(t,e,n){if("object"!=typeof t)throw new Ff("options must be an object",Ff.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const o=r[i],s=e[o];if(s){const e=t[o],n=void 0===e||s(e,o,t);if(!0!==n)throw new Ff("option "+o+" must be "+n,Ff.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Ff("Unknown option "+o,Ff.ERR_BAD_OPTION)}},validators:Km},Ym=Zm.validators;class tg{constructor(t){this.defaults=t||{},this.interceptors={request:new Kf,response:new Kf}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const n=e.stack?e.stack.replace(/^.+\n/,""):"";try{t.stack?n&&!String(t.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(t.stack+="\n"+n):t.stack=n}catch(t){}}throw t}}_request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Om(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:i}=e;void 0!==n&&Zm.assertOptions(n,{silentJSONParsing:Ym.transitional(Ym.boolean),forcedJSONParsing:Ym.transitional(Ym.boolean),clarifyTimeoutError:Ym.transitional(Ym.boolean)},!1),null!=r&&(Df.isFunction(r)?e.paramsSerializer={serialize:r}:Zm.assertOptions(r,{encode:Ym.function,serialize:Ym.function},!0)),void 0!==e.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Zm.assertOptions(e,{baseUrl:Ym.spelling("baseURL"),withXsrfToken:Ym.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=i&&Df.merge(i.common,i[e.method]);i&&Df.forEach(["delete","get","head","post","put","patch","common"],t=>{delete i[t]}),e.headers=fm.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach(function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(a=a&&t.synchronous,s.unshift(t.fulfilled,t.rejected))});const u=[];let c;this.interceptors.response.forEach(function(t){u.push(t.fulfilled,t.rejected)});let l,h=0;if(!a){const t=[Hm.bind(this),void 0];for(t.unshift(...s),t.push(...u),l=t.length,c=Promise.resolve(e);h<l;)c=c.then(t[h++],t[h++]);return c}l=s.length;let d=e;for(;h<l;){const t=s[h++],e=s[h++];try{d=t(d)}catch(t){e.call(this,t);break}}try{c=Hm.call(this,d)}catch(t){return Promise.reject(t)}for(h=0,l=u.length;h<l;)c=c.then(u[h++],u[h++]);return c}getUri(t){return Xf(Am((t=Om(this.defaults,t)).baseURL,t.url,t.allowAbsoluteUrls),t.params,t.paramsSerializer)}}Df.forEach(["delete","get","head","options"],function(t){tg.prototype[t]=function(e,n){return this.request(Om(n||{},{method:t,url:e,data:(n||{}).data}))}}),Df.forEach(["post","put","patch"],function(t){function e(e){return function(n,r,i){return this.request(Om(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}tg.prototype[t]=e(),tg.prototype[t+"Form"]=e(!0)});const eg=tg;class ng{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(t){e=t});const n=this;this.promise.then(t=>{if(!n._listeners)return;let e=n._listeners.length;for(;e-- >0;)n._listeners[e](t);n._listeners=null}),this.promise.then=t=>{let e;const r=new Promise(t=>{n.subscribe(t),e=t}).then(t);return r.cancel=function(){n.unsubscribe(e)},r},t(function(t,r,i){n.reason||(n.reason=new _m(t,r,i),e(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}toAbortSignal(){const t=new AbortController,e=e=>{t.abort(e)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let t;return{token:new ng(function(e){t=e}),cancel:t}}}const rg=ng;const ig={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ig).forEach(([t,e])=>{ig[e]=t});const og=ig;const sg=function t(e){const n=new eg(e),r=zp(eg.prototype.request,n);return Df.extend(r,eg.prototype,n,{allOwnKeys:!0}),Df.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return t(Om(e,n))},r}(am);sg.Axios=eg,sg.CanceledError=_m,sg.CancelToken=rg,sg.isCancel=gm,sg.VERSION=Xm,sg.toFormData=Vf,sg.AxiosError=Ff,sg.Cancel=sg.CanceledError,sg.all=function(t){return Promise.all(t)},sg.spread=function(t){return function(e){return t.apply(null,e)}},sg.isAxiosError=function(t){return Df.isObject(t)&&!0===t.isAxiosError},sg.mergeConfig=Om,sg.AxiosHeaders=fm,sg.formToJSON=t=>om(Df.isHTMLForm(t)?new FormData(t):t),sg.getAdapter=Wm.getAdapter,sg.HttpStatusCode=og,sg.default=sg;const ag=sg,{memoize:ug}=bn,cg=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in http.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/library.js"},{}),t=>{const e=t[lg.LAMBDA_OBJ],n="uri"in e&&"_default"in e.uri?e.uri._default:void 0,r="header"in e&&"_default"in e.header?e.header._default:void 0,i=async n=>{t[lg.http.URI];const r=t[lg.http.HEADER];let i=n;i=1===i.length?i[0]:i;const o=Object.keys(e),s=["uri","post","put","get","header","?graph"].filter(t=>o.includes(t)),a=(lg.DOMAIN&&t[lg.DOMAIN],lg.APPID&&t[lg.APPID],s.includes("post")?"post":s.includes("put")?"put":"get"),u=bn.throttle(async()=>await(async({http_mode:t,uri:e}={})=>{if(["post","put"].includes(t)){r?.X_CSRF_Token&&(ag.defaults.headers.post["X-CSRF-Token"]=r.X_CSRF_Token);try{const t=s.includes("put")?ag.put(e,i):ag.post(e,i);return await t}catch(t){return t.response||t.request,t.response}}else try{const t=e?ag.get(e):ln([{data:"LEAF element error: http get request submitted with undefined URI"}]);return(await t).data}catch(t){return t.response||t.request,t}})({http_mode:a,uri:"localhost:51054"}),1e3);return await u()},o={codebase:"ghostos/api/parser/nodelogic/elements/library/http.js",refnode:t[lg.REFNODE]};return{leaflogic:(e,s)=>{const a=new Pt,u=n?p_(s,e,void 0,o,{leaflogic:n,datalogic:{post:e=>(t[lg.http.URI]=e,e)}}):{_stream:ln("https://httpbin.org"),_control:{_stream:s._stream}},c=r?p_(s,e,void 0,o,{leaflogic:r,datalogic:{post:e=>(t[lg.http.HEADER]=e,e)}}):{_stream:ln(""),_control:{_stream:s._stream}},l=Et([u._control._stream,c._control._stream]),h=Et([u._stream,c._stream]),d=l.pipe(Nt(h),V(t=>t[0]));let p=!1;const f=d.pipe(Nt(...e.map(t=>t._stream)),It(t=>i(t.slice(1))),V(e=>(p=!0,e?.length>1||!Array.isArray(e)?a.next(e):1===e?.length&&a.next(e[0]),t[lg.CTRLIN])),Lt());return{_stream:a.pipe($t(t=>p),V(t=>t),Lt()),_control:{_stream:f.pipe(V(t=>t),Lt())}}},datalogic:{pre:t=>t,post:t=>{const e=t=>{const n=typeof t;return"object"===n?Array.isArray(t)?t.map(t=>e(t)):t?Object.fromEntries(Object.entries(t).map(([t,n])=>[t,e(n)])):t:"string"===n?(t=>{var e={"&":"&","<":"<",">":">",'"':""","'":"'"};return t.replace(/[&<>"']/g,function(t){return e[t]})})(t):t};return hg(e(t),"elementio")}}}}),lg={LAMBDA_OBJ:"_lambda_obj",REFNODE:"_refnode",RTCONTEXT:"_rtcontext",CTRLIN:"_ctrl_in",DATAIN:"_data_in",DOMAIN:"_domain",APPID:"_appid",http:{URI:"_http_uri",HEADER:"_http_header",REQUEST_TTL_CACHE:"_http_request_ttl_cache"},href:{URI:"_href_uri"},gnav:{EDGES:"_edges",BACKDROP:"_backdrop"},prompt:{UIDEFS:"_uidefs"},mediaplayer:{URI:"_uri"},sound:{CONFIG:"_sound_config",SOUNDSTAGE:"_daw_object"},html:{TEMPLATE:"_html_template"}},hg=(t,e="defaultio",n=!0)=>n?wn(e,t):t,dg={mediaplayer:es,http:$p,gnav:Lp,popup:os,image:cs,editor:as,text:us,prompt:rs,mediainput:hs,midi:fs,sound:Pp,html:Vp,href:qp,form:Gp,directus:cg},pg=Wt("leafdeckspade"),fg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(await $o.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i}),e_.lambda(t)({refnodedata:{leaf:{logic:{args:{graphuuid:"",domain:"breezyforest",appid:"leafdeckspade",graphaddrstr:"breezyforest/spade"}}}},nodelambda:[],contextuallambda:[]})),a=(await s,{codebase:"leafdeckspade.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data});return(t,r)=>{let i=["_leafdeckdiamond"];const s=r._config?.loopidx,{type:u,args:c}=n.leaf.logic,l="_default"in o?(t,n)=>{const r={...n};s>=0&&(r._config.loopidx=s),r._config.clubrefnode=e;return o._default(t,r)}:(t,e)=>({...Bg(t),_control:e}),h=r._stream;return p_({_stream:h},t,void 0,{...a,metastep:"creating a leafdeckspade element"},{datalogic:{pre:t=>Array.isArray(t)?t.map(t=>xn(i,t)).filter(t=>t):xn(i,t),post:t=>{const e=Array.isArray(t)?t:[t],n={type:"leafdeckspade",uuid:Kn(),name:En(pg.editorconfig.namedatakey,c),description:"{description}",lambdas:{default:"defaultLambda",defaultLambda:l,bro:t=>t},diamonds:e};return wn("screenio",n)}}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s}},mg=Wt("leafdeckheart"),gg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(await $o.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i}),await zo.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckheart"}}}},nodelambda:[],contextuallambda:i}),{codebase:"leafdeckheart.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data});return(t,r)=>{let i=["_leafdeckdiamond"];const a=r._config?.loopidx,{type:u,args:c}=n.leaf.logic,l="_default"in o?(t,n)=>{const r={...n};a>=0&&(r._config.loopidx=a),r._config.clubrefnode=e;return o._default(t,r)}:(t,e)=>({...Bg(t),_control:e}),h=r._stream;return p_({_stream:h},t,void 0,{...s,metastep:"creating a leafdeckheart element"},{datalogic:{pre:t=>Array.isArray(t)?t.map(t=>xn(i,t)).filter(t=>t):xn(i,t),post:t=>{const e=Array.isArray(t)?t:[t],n={type:"leafdeckheart",uuid:Kn(),name:En(mg.editorconfig.namedatakey,c),description:"{description}",lambdas:{default:"defaultLambda",defaultLambda:l,bro:t=>t},diamonds:e};return wn("screenio",n)}}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s}},_g=Wt("leafdeckdiamond"),yg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s=(await $o.dataflow(t)({refnodedata:{leaf:{logic:{args:{}}}},nodelambda:[],contextuallambda:i}),{codebase:"leafdeckdiamond.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data});return(t,r)=>{let i=["_leafdeckclub"];const a=r._config?.loopidx,{type:u,args:c}=n.leaf.logic,l="_default"in o?(t,n)=>{const r={_stream:n._stream.pipe(V(t=>t)),_config:{...n._config}};a>=0&&(r._config.loopidx=a),r._config.clubrefnode=e;const i=o._default(t,n);return{_stream:i._stream.pipe(V(t=>t)),_control:{_stream:i._control._stream.pipe(V(t=>t))}}}:"href"in o&&"_default"in o.href?(t,e)=>{const n=o.href._default(t,e);return{_stream:n._stream.pipe(V(t=>(window.location.href.slice(-t.length)!==t&&(window.location.href=t),t))),_control:{...e._control,_stream:n._control._stream.pipe(V(t=>t))}}}:(t,e)=>({...Bg(t),_control:e}),h=r._stream,d=p_({_stream:h},t,void 0,{...s,metastep:"creating a leafdeckdiamond element"},{datalogic:{pre:t=>{const e=Array.isArray(t)?t:[t],n={clubs:[],nodeinput:[]};return e.map(t=>{nn(t)&&(t._bname===i[0]?n.clubs.push(xn(i,t)):"nodeinput"===t._bname&&n.nodeinput.push(xn("nodeinput",t)))}),n},post:t=>{t.clubs;const n=t.clubs.filter(t=>t),r="subscribe"in o&&0===n.length,i={type:"leafdeckdiamond",uuid:Kn(),nodeuuid:e,name:En(_g.editorconfig.namedatakey,c),svgicon:"https://www.leafgon.com/icons/hardware/laptop_mac/materialicons/24px.svg",description:"{description}",nodeinput:t.nodeinput,lambdas:{default:"defaultLambda",defaultLambda:l,bro:t=>t},subscription:r,clubs:n};return wn("_leafdeckdiamond",i)}}});return{_stream:d._stream.pipe(V(t=>t)),_control:d._control}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({_stream:e(t,n),_control:n})}),s}},vg=Wt("leafdeckclub"),bg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),s={codebase:"leafdeckclub.js",refnode:e,leafnode:e&&t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};return(t,r)=>{const i=r._config?.loopidx,{type:a,args:u}=n.leaf.logic,c="_default"in o?(t,n)=>{const r={...n};i>=0&&(r._config.loopidx=i),r._config.clubrefnode=e;return o._default(t,r)}:(t,e)=>({...Bg(t),_control:e}),l=r._stream.pipe(V(t=>t)),h=p_({_stream:l},t,void 0,{...s,metastep:"creating a leafdeckclub element"},{datalogic:{pre:t=>{const e=Array.isArray(t)?t:[t],n={nodeinput:[]};return e.map(t=>{nn(t)&&"nodeinput"===t._bname&&n.nodeinput.push(xn("nodeinput",t))}),n},post:t=>{const n="subscribe"in o,r={type:"leafdeckclub",uuid:Kn(),nodeuuid:e,name:En(vg.editorconfig.namedatakey,u),svgicon:"https://www.leafgon.com/icons/hardware/laptop_mac/materialicons/24px.svg",description:"{description}",nodeinput:t.nodeinput,lambdas:{default:"defaultLambda",defaultLambda:c,bro:t=>t},subscription:n};return wn("_leafdeckclub",r)}}});return{_stream:h._stream.pipe(V(t=>t)),_control:h._control}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=t=>({...e(t,controlflow$obj),_control:controlflow$obj})}),s}},wg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree});const o=Wo.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckspade"}}}},nodelambda:[],contextuallambda:i}),s=Wo.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafdeckheart"}}}},nodelambda:[],contextuallambda:i}),a=Wo.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafpopupview"}}}},nodelambda:[],contextuallambda:i}),u=void 0;return t=>{const e=o(t),n=s(t),r=a(t),i=u([e,n]).pipe(V(t=>t),V(t=>t));r.pipe(V(t=>t),V(t=>{}));return i.pipe($t(t=>t))}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=t=>e(t)}),s}},xg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s="_default"in o?t=>o._default([t]):t=>t,a=zo.dataflow(t)({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafpopupview"}}}},nodelambda:[],contextuallambda:i});return t=>{const e=t.pipe(V(t=>t),V(t=>{let e=null;return e={type:"leafpopupview",uuid:"308bd84f-3af2-478e-ae35-b2842a9bd3a1",svgicon:"https://www.leafgon.com/icons/hardware/laptop_mac/materialicons/24px.svg",description:"coolest popupview in LEAF",lambdas:{default:"defaultLambda",defaultLambda:s,bro:t=>t}},e||t}));return a(e.pipe($t(t=>t)))}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=t=>e(t)}),s}};const Tg=wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafelement.js",codebase:"/src/ghostos/api/parser/nodelogic/elements/leafelement.js"},{}),kg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),{type:s,args:a}=n.leaf.logic,u=n.leaf.logic.args.elementname,c=(t.gos.etaTree.hostdomain,t.gos.etaTree.hostappid,t.gos.etaTree.domain),l=t.gos.etaTree.appid;"domain"in o&&"_default"in o.domain&&o.domain._default,"appid"in o&&"_default"in o.appid&&o.appid._default,"uidefs"in o&&"_default"in o.uidefs&&o.uidefs._default,"edges"in o&&"_default"in o.edges&&o.edges._default,new qt(Tg);["f30e","7a65"].includes(e.slice(0,4));const h={codebase:"leafelement.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data};let d={};d[lg.LAMBDA_OBJ]=o,d[lg.REFNODE]=e,d[lg.RTCONTEXT]={graphdomain:c,graphappid:l,refnodedata:n,nodelambda:r,contextuallambda:i};const p=((t,e)=>Object.keys(dg).includes(e)&&dg[e]?{...dg[e](t)}:void 0)(d,u);return(n,r)=>{e?.slice(0,4);const i=r._stream.pipe(V(e=>(d[lg.CTRLIN]=e,d[lg.DOMAIN]=t.gos.etaTree.domain,d[lg.APPID]=t.gos.etaTree.appid,e)));"elementio$"in p&&(t.gos.etaTree.leafio.elementioLUT[e]=p.elementio$);return p_({_stream:i},n,void 0,{...h,metastep:"element "+u},{leaflogic:p?p.leaflogic:void 0,datalogic:{pre:p?p.datalogic.pre:void 0,post:p?p.datalogic.post:void 0}})}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s},methods:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o={configtext:""};return{texteditor:{setTextSource:r=>{o.configtext=r;const i={...n};i.leaf.logic.args.elementconfig=r,is_interactive||t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:encodeUnicode(JSON.stringify(i))}})},getTextSource:()=>n.leaf.logic.args.elementconfig},general:{getNodeData:()=>n,getLambdaLUT:async()=>{const n=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree}),o={};return Object.entries(n).map(([t,e])=>{o[t]=(t,n)=>({...e(t,n),_control:n})}),o},setElementName:r=>{const i={...n};i.leaf.logic.args.elementname=r,t.gos.etaTree.leaflakeio.qm_methods.updateNode({variables:{uuid:e,data:encodeUnicode(JSON.stringify(i))}})}}}}};n(4106);function Sg(t,e,n){const r={leafoutflowport:Sn,leafinflowport:kn,leafscreenio:An,leafmemoryio:Wn,leafdeckspade:fg,leafdeckheart:gg,leafdeckdiamond:yg,leafdeckclub:bg,leafgnav:wg,leafpopupview:xg,leafelement:kg,leafgraph:e_,leaflambdagraph:Vg,leafanchor:n_,leafspell:Jg,leafspelldef:Hg,leafloopyspell:Qg,leafchronosflow:Fo,leafasyncflow:Fo,leafmixflow:$o,leafgateflow:qo,leaflisp:Lo,leaflabel:Vo,leafdelabel:Go,leafbottle:zo,leafunbottle:Wo,leafcrate:Jo,leafconfig:Zo};return r[t][e]?r[t][e](n):void 0}const{memoize:Ag}=bn,Eg={isdebug:!1},Og=wn("error",{type:"critical",message:"LEAF core error: race condition detected in eta.js",codebase:"/src/ghostos/api/parser/eta.js"},{}),Cg=(t,e)=>([...Array(e).keys()].map(e=>{t[e]=!1}),t),Mg=(t,e={time:-1,count:-1},n=void 0,r={})=>{wn("empty_bottle","empty_data",{_provenance:{rt_context:r,codebase:"eta.js doChronosSynchronize"}});const i=new Pt,o=(t[0]._control._stream,t.length,t.map(t=>t._control._stream)),s=t.map(t=>t._stream),a={};let u={};const c=t.length;Cg(a,c);return{ctrl:n&&n.synchronized?Bt(...t.map((t,e)=>t._control._stream.pipe(Nt(t._stream),V(t=>[e,t])))).pipe(V(t=>{if(a[t[0]]=!0,u[t[0]]=t[1],((t,e)=>{let n=!0;return[...Array(e).keys()].map(e=>{n&&=t[e]}),n})(a,c)){Cg(a,c);const t=Object.values(u);return u={},t}}),$t(t=>void 0!==t),V(t=>{if(r.nodeuuid,n.checksync()){n.initflowcache(),r.nodeuuid;let e=t.map(t=>{const e=t.slice(1).flat();return 1===e.length?e[0]:e});i.next(e);const o={...t[0][0]};let s=t.map(t=>t[0].traces);return 1===s.length&&(s=s[0]),o.traces=[s],o}}),$t(t=>void 0!==t)):o.length>1?Bt(...o.map((t,e)=>t.pipe(Nt(s[e]),V(t=>{const e=t[0];e.length>1&&e.includes(void 0),r.nodeuuid,nn(t[1])&&t[1]._bname;let n=t.slice(1);return i.next(n),e})))):o[0].pipe(Nt(s[0]),V(t=>{const e=t[0];nn(t[1])&&t[1]._bname;let n=t[1];return i.next(n),e})),data:i.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Og)))}},Ng=(t,e,n,r,i,o,s)=>{const a={refnode:t,codebase:"eta.js weaveDataflowPlane",domain:i.domain,appid:i.appid},u=wn("empty_bottle","empty_data",{_provenance:{refnode:t,codebase:"eta.js weaveDataflowPlane"}}),c={},l=(t,h=void 0)=>t.map(t=>{if(c[t]?.data_out&&c[t]?.ctrl_out)return{_stream:c[t].data_out._stream.pipe(V(t=>t)),_control:{_stream:c[t].ctrl_out._stream.pipe(V(t=>t))}};{const d=r[t];if(!d||!("_default"in d))throw`LEAF error: weaveDataflowPlane(): the ${d?"":"undefined"} eta reduced function with the refnode ${t} has no _default defined.`;const p=h||i.leafgraph.graph.dataflow.mapInEdges(t,t=>i.leafgraph.graph.dataflow.source(t)),f=0===p.length?[{_stream:s._stream,_control:{_stream:o._stream}}]:l(p).filter(t=>t);p.length,((t,e,n,r=!0)=>{const o=t,s=i.leafgraph.graph.dataflow.mapInEdges(o,t=>i.leafgraph.graph.dataflow.source(t));o in c||(c[o]={inputnodes:s,synchronized:!1,flowcache:{},initflowcache:()=>{const t=c[o].inputnodes.length;c[o].flowcache=t>1?Object.keys(c[o].inputnodes)?.reduce((t,e)=>(t[e]=!1,t),{}):{0:!1}},recordflow:t=>{c[o].flowcache[t]=!0},checksync:()=>Object.values(c[o].flowcache).reduce((t,e)=>t&&e,!0),data_in$Arr:n.map((t,e)=>t._stream.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Og)),V(t=>(["c10cbbbb-14d5-4270-b17a-1965afcabc98"].includes(o),nn(t)&&t._bname,["c822ae2e-1be8-46be-b2cb-21a43cef0555","e9e6e44b-792b-46d0-b1d3-58ce2f46c45b"].includes(o)&&nn(t)&&t._bname,t)))),data_out:void 0,ctrl_in$Arr:e.map((t,e)=>t._stream.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Og)),V(t=>(c[o][e],["c822ae2e-1be8-46be-b2cb-21a43cef0555","e9e6e44b-792b-46d0-b1d3-58ce2f46c45b"].includes(o),c[o].recordflow(e),t)))),ctrl_out:void 0,get_composite_in$objArr:()=>c[o].data_in$Arr.map((t,e)=>({_stream:t,_control:{_stream:c[o].ctrl_in$Arr[e]}}))},c[o].initflowcache(),s.length>1&&r&&(c[o].synchronized=!0))})(t,f.map(t=>({_stream:t._control._stream})),f.map(t=>({_stream:t._stream})));const m=i.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data,g="leafchronosflow"===m.leaf.logic.type,{ctrl:_,data:y}=g?{ctrl:Bt(...c[t].get_composite_in$objArr().map(t=>t._control._stream)),data:void 0}:Mg(c[t].get_composite_in$objArr(),{time:-1,count:-1},c[t],{...a,...m,at:"eta.js _weaveDataflowPlane",nodeuuid:t}),v={_stream:_.pipe(V(t=>t))},b=g?c[t].get_composite_in$objArr().map((t,e)=>({_stream:t._stream.pipe(V(t=>t))})):[{_stream:y.pipe(V(t=>t))}];if(p.length>0){if(n.includes(t)){if("leafoutflowport"===m.leaf.logic.type){const e=d._default(b,v);return c[t].data_out={_stream:e._stream},c[t].ctrl_out={_stream:e._control._stream},{_stream:e._stream.pipe(V(t=>t)),_control:{_stream:e._control._stream.pipe(V(t=>t))}}}{const e=d._default(b,v);return c[t].data_out={_stream:e._stream.pipe(V(e=>({...u,_label:{...u._label,context:"a nudge data bottle returned by an exitless end node, "+t}})))},c[t].ctrl_out={_stream:e._control._stream.pipe(V(t=>t))},{_stream:c[t].data_out._stream.pipe(V(t=>t)),_control:{_stream:c[t].ctrl_out._stream.pipe(V(t=>t))}}}}{const e=d._default(b,v);return c[t].data_out={_stream:e._stream},c[t].ctrl_out={_stream:e._control._stream},{_stream:e._stream.pipe(V(t=>t)),_control:{_stream:e._control._stream.pipe(V(t=>t))}}}}if(!e.includes(t))throw`LEAF error: weaveDataflowPlane(): the eta reduced function with the refnode ${t} has matched against incomplete startnodes reference.`;if("leafinflowport"===i.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data.leaf.logic.type){const e=d._default(b,v);return c[t].data_out={_stream:e._stream},c[t].ctrl_out={_stream:e._control._stream},{_stream:e._stream.pipe(V(t=>t)),_control:{_stream:e._control._stream.pipe(V(t=>t))}}}{const e=b.map(t=>({_stream:t._stream.pipe(V(t=>({...u,_label:{...u._label,context:"input-less node dataflow nudging message as per ctrl signal"}})))})),n=d._default(e,v);return c[t].data_out={_stream:n._stream},c[t].ctrl_out={_stream:n._control._stream},{_stream:n._stream.pipe(V(t=>t)),_control:{_stream:n._control._stream.pipe(V(t=>t))}}}}}),h=l(n);h.length;const{ctrl:d,data:p}=h.length>1?((t,e={time:-1,count:-1},n={})=>{const r=t.length,i=new Pt;return{ctrl:Bt(...t.map(t=>{let e;return t._control._stream.pipe(V(t=>(e=globalThis.TRACEON?{...t,traces:d_(t?.traces,{...n,desc:"doChronosAsynchronize(), a ctrl signal came through out of inputcount of "+r},!0)}:t,e)),Nt(t._stream),V(t=>(i.next(2===t.length?t[1]:t.slice(1)),t[0])),Lt())})).pipe(V(t=>t)),data:i.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Og)))}})(h,{time:-1,count:-1},{...a,at:"eta.js _weaveDataflowPlane",endnodes:n}):{ctrl:h[0]._control._stream,data:h[0]._stream};return[{...{_stream:p},_control:{_stream:d}},c]},Ig=Ag(async({refnode:t,component_members:e,contextuallambda:n,etaTree:r}={})=>{const i=[],o=[],s={};["7b1f"].includes(t?.slice(0,4)),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t);const a=e.map(t=>{r.leafgraph.edges.lambda.sourcelut[t];const e=r.etaReduceLEAFNode({nodeuuid:t,contextuallambda:n});return e.then(e=>{s[t]=e;const n=r.leafgraph.edges.data.sources.has(t);r.leafgraph.edges.data.targets.has(t)||i.push(t),n||o.push(t)}),e});["7b1f","main"].includes(t?.slice(0,4)),await Promise.all(a),["7b1f","main"].includes(t?.slice(0,4)),["2ee89b44-16af-472f-97d4-47ae65f064c8"].includes(t);const u=((t,e,n,r,i,o={})=>{const s={main:"nav main dataflow",leafgraph:"leafgraph main dataflow",editor:"editor main dataflow"},a={codebase:"eta.js",refnode:t,leafnode:Object.keys(s).includes(t)?s[t]:i.leafgraph.graph.dataflow.getNodeAttributes(t)?.leafnode.data,metadata:o,domain:i.domain,appid:i.appid};return(u=[],c)=>{const l={data_in:new Pt,ctrl_in:new Pt,data_out:new Pt,ctrl_out:new Pt},h={_stream:l.data_in},d={_stream:l.ctrl_in,_config:{}};["3980759d-7c59-4b9e-b799-87b5fd4cbcec","62890d97-837a-463e-aac9-d7fca2293427"].includes(t),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t);const[p,f]=Ng(t,e,n,r,i,d,h);return p_(c,u,void 0,{...a,metastep:"invoking parseDataflowFunc()"},{leaflogic:(e,n)=>{const r=new Pt;let a;const u=n._stream.pipe(V(t=>(a=t,t)),Nt(...e.map(t=>t._stream)),It(n=>{o.refnode,e.length;const r=1===e.length?n[1]:n.slice(1);return t in s||i.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data.leaf.logic,i.domain,i.appid,a.traces,setTimeout(()=>{l.data_in.next(r),l.ctrl_in.next(a)},1),p._control._stream}),Nt(p._stream),V(t=>{if(nn(t[1])&&"error"===t[1]._bname);else{const e=t[1];void 0!==e&&r.next(e)}return t[0]}),Lt());return{_stream:r.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Og))),_control:{...n,_stream:u}}},datalogic:{}})}})(t,i,o,s,r);return u},({refnode:t,component_members:e,contextuallambda:n,etaTree:r}={})=>JSON.stringify([...e,...n,r.sessionid])),jg=async({refnode:t,nodelambda:e,contextuallambda:n,etaTree:r,addnodelut:i=!1,metadata:o={}}={})=>{["7b1f"].includes(t?.slice(0,4)),["530acdcf-067d-4868-ba0c-b7a83e6edfdf"].includes(t),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t);const s=i?{_nodelut:{}}:{},a=e.map(e=>{r.graphcomponents.components.lut;const{idx:o,scope:a}=r.graphcomponents.components.lut[e],u=r.graphcomponents.components.nodegroups.lambda[o];if("dataflow"===a){const o=Ig({refnode:t,component_members:u,contextuallambda:n,etaTree:r});return["7b1f"].includes(t?.slice(0,4)),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t),o.then(n=>{["7b1f"].includes(t?.slice(0,4)),["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(t),s._default=n,i&&(s._nodelut._default=e)}),o}if("lambda"===a){if(!(u.length>1)){const o=r.etaReduceLEAFNode({nodeuuid:e,contextuallambda:n});return o.then(n=>{Object.entries(n).map(([n,o])=>{if(n in s){r.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data.leaf.logic}else s[n]=o,i&&(s._nodelut[n]=e)})}).catch(t=>{}),o}r.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data.leaf.logic}else{r.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data.leaf.logic,r.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data.leaf.logic}});return await Promise.all(a),["e36a8dd4-c8df-4dfa-b60c-765eeb5b99fd"].includes(t),s},Rg=(t,e,n,r,i,o,s,a,u,c,l=void 0)=>{const h={sessionid:l?l.sessionid:void 0,appmode:t,hostdomain:e,hostappid:n,domain:r,appid:i,leafgraph:void 0,graphcomponents:void 0,rootgraphstate:void 0,leafio:void 0,leaflakeio:void 0,mnemosyne:void 0,hostEtaTree:l,leafnodemethods:{},lookupRuntimeLambdaLUT:async(t,e,n,r,i,o=!1)=>{if(0===r.length)return{};const s=await Gn(h).getEtaTree(t,e);return o?await h.etaReduceLEAFNode({nodeuuid:n,contextuallambda:i}):await jg({refnode:n,nodelambda:r,contextuallambda:i,etaTree:s})},lookupLEAFNodeMethods:async(t,e=void 0)=>{if(t in h.leafnodemethods)return h.leafnodemethods[t];if(h.leafgraph.graph.dataflow.nodes().includes(t)){const e=h.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data,n=e.leaf.logic,r={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:h.leafio,etaTree:h},user:{spellbook:h.graphcomponents.spelldefs,lambdalut:h.leafgraph.edges.lambda.sourcelut}},i=Sg(n.type,"methods",r);if(i&&!(t in h.leafnodemethods)){const n=h.leafgraph.edges.lambda.sourcelut[t]?h.leafgraph.edges.lambda.sourcelut[t]:[];return h.leafnodemethods[t]=await i({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:[]}),h.leafnodemethods[t]}return}if(h.hostEtaTree)return h.hostEtaTree.lookupLEAFNodeMethods(t,e);if(void 0!==e){const n=e,r=n.leaf.logic,i={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:h.leafio,etaTree:h},user:{spellbook:h.graphcomponents.spelldefs,lambdalut:h.leafgraph.edges.lambda.sourcelut}},o=Sg(r.type,"methods",i);if(o&&!(t in h.leafnodemethods)){h.leafgraph.edges.lambda.sourcelut[t]&&h.leafgraph.edges.lambda.sourcelut[t];return h.leafnodemethods[t]=await o({refnode:t,refnodedata:n,nodelambda:[],contextuallambda:[]}),h.leafnodemethods[t]}}return},etaReduceLEAFNode:async({nodeuuid:t,contextuallambda:e}={})=>({_default:t=>{}}),loadElementJsEsmModule:async t=>{if(!(t in h.esmcache)){const e=await ag.get(t);h.esmcache[t]=e.data}return h.esmcache[t]},initTree:(t,e,n,r,i)=>{h.config=Eg,h.leafgraph=t,h.graphcomponents=e,h.rootgraphstate="initialized",h.leafio=n,h.leaflakeio=r,h.mnemosyne=i,h.esmcache={},void 0===h.hostEtaTree&&Gn(h).initEtaTreeForest();return h.etaReduceLEAFNode=Ag(async({nodeuuid:t,contextuallambda:e}={})=>{const n=t;["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(n),["0f35d8bc-36a6-4fe8-b185-f8ed5188b28f"].includes(n),["5f7d8750-8ebd-46ee-9a21-029d4000f452"].includes(n);const r=n?h.leafgraph.graph.dataflow.getNodeAttributes(n).leafnode.data.leaf.logic:void 0,i=t in h.leafgraph.edges.lambda.sourcelut?h.leafgraph.edges.lambda.sourcelut[t]:[];let o;if(t in h.graphcomponents.components.lut){const{scope:e}=h.graphcomponents.components.lut[t];o=e}const s={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:h.leafio,etaTree:h},user:{spellbook:h.graphcomponents.spelldefs,lambdalut:h.leafgraph.edges.lambda.sourcelut}};try{["b490aada-daab-4322-9001-14aea8bcb3d3","97fa68cf-bcc5-44cf-8311-ffa6a1422ac3","abb18b4d-b8af-4349-949d-fae21bc142ef","e9536f42-df6d-4086-a643-5f3c0b02aac9","b5a20ce3-3e67-42cd-9f60-3f70c6acd269","59fe3646-b338-4ab0-a8a6-d6ad401be4fa"].includes(t),r.type;const a=Sg(r.type,o,s),u=h.leafgraph.graph.dataflow.getNodeAttributes(t).leafnode.data,c=await a({refnode:t,refnodedata:u,nodelambda:i,contextuallambda:e});return["633e5b3e-72b7-4536-8e68-40d0b4902cba"].includes(n),["e36a8dd4-c8df-4dfa-b60c-765eeb5b99fd"].includes(n),"dataflow"===o?{_default:c}:"lambda"===o?c:void 0}catch(t){}},({nodeuuid:t,contextuallambda:e}={})=>JSON.stringify([t,...e])),h.etaReduceLEAFNode}};return h.initTree(o,s,a,u,c),h.sessionid=Kn(),h};const Pg=200,Dg=t=>Array.isArray(t)?t.flatMap(t=>t):t,Lg=(t,e,n=!1,r=!1,i=!1,o={})=>{const s=e.filter(t=>t);if(s.length>1){const o={_stream:ln("ctrl_nudge").pipe(hn(r=>Et(e.map(t=>t._stream)).pipe(V(e=>{t?.slice(0,4);const r=i?Ug({_bus:e,_flatten:n}):e,o=!i&&n&&Array.isArray(r)?r.filter(t=>t).flat():r;return o}))))};return r&&(o._control={_stream:ln("ctrl_nudge").pipe(hn(t=>Et(e.map(t=>t?._control?._stream).filter(t=>t)).pipe(V(t=>Array.isArray(t)?t.flat():t))))}),o}return s.length>0?{...s[0],_stream:s[0]._stream.pipe(V(e=>(t?.slice(0,4),e)))}:void 0},Fg=(t,e)=>{const n=t.filter(t=>e.some(e=>e in t)),r=t.filter(t=>e.every(e=>!(e in t))),i=(t,e)=>{if(nn(t))return{...t,_content:i(t._content,e)};if(rn(t))return{...t,_crate:t._crate.map(t=>i(t,e))};if(Array.isArray(t))return t.map(t=>i(t,e));if("object"==typeof t){return Object.assign({},...Object.entries(t).map(([t,n])=>({[t]:i(n,e)})))}if("string"==typeof t){return n=e,t.replace(/\{([\w\s]+)\}/g,function(t,e){return n[e]})}return t;var n};return{_stream:Bg(r)._stream.pipe(vn(Pg,100,100),V(t=>t),V(t=>Dg(t)),Nt(...n.map(t=>t._stream.pipe(vn(Pg,100,100),V(t=>Dg(t))))),V(t=>t)).pipe(V(t=>{const e=Dg(t[0]),n=Dg(t.slice(1)).filter(t=>!Array.isArray(t)&&"object"==typeof t),r=Object.assign({},...n);return i(e,r)}))}},$g=t=>{const e=t.filter(t=>t);if(e.length>1){return{_stream:e.map(t=>t._stream).pipe(Mt())}}if(e.length>0)return e[0]},Bg=(wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafdataflow.js",codebase:"/src/ghostos/api/utils/leafdataflow.js"},{}),t=>{const e=t.filter(t=>t);if(e.length>1){return{_stream:Bt(...e.map(t=>t._stream.pipe(V(t=>t))))}}if(e.length>0)return e[0]});const qg=(t,e=t=>!0)=>nn(t)&&"_databus"===t._bname&&e(t)?t._content:t,Ug=({_bus:t,_cond:e=t=>!0,_flatten:n=!1}={})=>n?Array.isArray(t)?t.map(t=>qg(t,e)).flat().filter(t=>t):qg(t,e):Array.isArray(t)?t.map(t=>qg(t,e)).filter(t=>t):qg(t,e),Vg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}) has a leaflambdagraph node (${e}) referencing an undefined lambda construct.`;const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree});return(t,e)=>{if("_default"in o){return{...o._default(t,e),_control:e}}if(t.length>0){return{...Bg(t),_control:e}}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>({...e(t,n),_control:n})}),s}};function Gg(t,e,n){void 0===t&&(t=0),void 0===n&&(n=yn);var r=-1;return null!=e&&(ct(e)?n=e:r=e),new X(function(e){var i,o=(i=t)instanceof Date&&!isNaN(i)?+t-n.now():t;o<0&&(o=0);var s=0;return n.schedule(function(){e.closed||(e.next(s++),0<=r?this.schedule(void 0,r):e.complete())},o)})}function zg(t){return t<=0?function(){return vt}:g(function(e,n){var r=0;e.subscribe(q(n,function(e){++r<=t&&(n.next(e),t<=r&&n.complete())}))})}const Wg=t=>Object.keys(t).map(e=>0===Object.keys(t[e]).length?e:void 0).filter(t=>t).sort(),Jg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{["0b62c9db-f889-4bf8-9773-c7b93ba9bd3f"].includes(e);const o=n.leaf.logic.args.spellname,s="{*}"===o;let a=i,u=await jg({refnode:e,nodelambda:r,contextuallambda:a,etaTree:t.gos.etaTree});const c=Wg(u);let l;c.length>0&&(a=a.concat(c),u=await jg({refnode:e,nodelambda:r,contextuallambda:a,etaTree:t.gos.etaTree})),["b490aada-daab-4322-9001-14aea8bcb3d3","97fa68cf-bcc5-44cf-8311-ffa6a1422ac3","abb18b4d-b8af-4349-949d-fae21bc142ef","e9536f42-df6d-4086-a643-5f3c0b02aac9","b5a20ce3-3e67-42cd-9f60-3f70c6acd269","59fe3646-b338-4ab0-a8a6-d6ad401be4fa"].includes(e);const h=async({refnode:t,spellbook:e,spellname:n,lambdalut:r,contextuallambda:i,etaTree:o}={})=>{if(n in e){const s=e[n];s in r&&r[s],"accio"===n&&t.slice(0,4);const a=await o.etaReduceLEAFNode({nodeuuid:s,contextuallambda:i});return"accio"===n&&t.slice(0,4),a}};const d={codebase:"leafspell.js",refnode:e,leafnode:t.gos.etaTree?.leafgraph?.graph.dataflow.getNodeAttributes(e).leafnode.data};let p=s?void 0:h_((async()=>{if(!o)return;if(globalThis?.DEBUG){const n=t.gos.etaTree.domain+"/"+t.gos.etaTree.appid+"/"+o+"/"+e;globalThis.trace[n]?globalThis.trace[n].push("parsing"):globalThis.trace[n]=["parsing"]}let n;if(["2293da4a-b517-4b0b-b396-cb030dc05900"].includes(e),["e9536f42-df6d-4086-a643-5f3c0b02aac9"].includes(e),e.slice(0,4),e.slice(0,4),n||u&&o in u&&(n=u[o]),!n){const r=t.user.spellbook,i=t.user.lambdalut;n=await h({refnode:e,spellbook:r,spellname:o,lambdalut:i,contextuallambda:a,etaTree:t.gos.etaTree})}if(!n){const r=t.gos.stdlambdalut,i=t.gos.standardSpellbook;n=await h({refnode:e,spellbook:i,spellname:o,lambdalut:r,contextuallambda:a,etaTree:t.gos.etaTree})}if(!n){const r=t.gos.curatedlambdalut,i=t.gos.curatedSpellbook;n=await h({refnode:e,spellbook:i,spellname:o,lambdalut:r,contextuallambda:a,etaTree:t.gos.etaTree})}if(["e9536f42-df6d-4086-a643-5f3c0b02aac9"].includes(e),globalThis?.DEBUG){const n=t.gos.etaTree.domain+"/"+t.gos.etaTree.appid+"/"+o+"/"+e;globalThis.trace[n]?globalThis.trace[n].push("parsed"):globalThis.trace[n]=["parsed"]}return l=n,l&&"_default"in l?n:void 0})(),3e4,"leafspell.js","LEAF Error: resolving transformation.leaflogic timed out",d);return(n,r)=>{const i=t=>t,a=t=>t,u=async(t,n,s)=>{const u=await t;if(void 0===u)return;if(void 0!==u&&"function"!=typeof u?._default)return;const c=p_({...r,_stream:n.pipe(V(t=>(void 0===t.sid?t.sid=[e]:t.sid.includes(e)||t.sid.push(e),t)))},[{_stream:s}],void 0,{...d,metastep:"executing parsed spell in the flow: "+o},{leaflogic:u._default,datalogic:{pre:i,post:a}});return c._control._stream.pipe(Nt(c._stream),V(t=>(t[0].sid?.pop(),t)),ls(()=>{}))},c=p_(r,n,void 0,{...d,metastep:"executing spell "+o},{leaflogic:s?(e,n)=>{const r=new Pt,i=new Pt,o=new Pt,s=new Pt,a=new Pt;let c;const l=e.length>1?merge(...e.map(t=>t._stream)):e[0]._stream,h=n._stream.pipe(Nt(l),It(e=>{e[0];const n=e[1];if(nn(n)&&"cast-spell"===n._bname){const r=n._content.nodeuuid,a=n._content.input,l=t.gos.etaTree.leafgraph.graph.dataflow.nodes().includes(r)?t.gos.etaTree:t.gos.etaTree.hostEtaTree,h=l?.leafgraph.graph.dataflow.getNodeAttributes(r).leafnode.data;if(["leafspelldef","leaflabel"].includes(h?.leaf?.logic?.type)){h.leaf.logic.args.spellname;p=t.gos.etaTree.lookupLEAFNodeMethods(r),u(p,i,o).then(t=>{void 0===t?(o.next(e[1]),i.next(e[0])):(c=t.subscribe({next:t=>{s.next(t)},error:t=>{},complete:()=>{}}),setTimeout(()=>{o.next(a),i.next(e[0])},1))})}else o.next(e[1]),i.next(e[0])}else o.next(e[1]),i.next(e[0]);return s}),Nt(s),V(t=>(r.next(t[1][1]),a.next(t[1][0]),t[1])),Nt(a),V(t=>t[1]),ls(()=>{void 0!==c&&(c.unsubscribe(),c=void 0)}),Lt());return{_stream:r,_control:{...n,_stream:h}}}:(t,e)=>{const n=new Pt,r=new Pt,i=new Pt,o=new Pt,s=new Pt;let a;const c=e._stream.pipe(Nt(...t.map(t=>t._stream)),It(t=>(void 0===a&&p?u(p,r,i).then(e=>{void 0===e?(i.next(t[1]),r.next(t[0])):(a=e.subscribe({next:t=>{o.next(t)},error:t=>{},complete:()=>{}}),setTimeout(()=>{i.next(t[1]),r.next(t[0])},1))}):(i.next(t[1]),r.next(t[0])),o)),Nt(o),V(t=>(n.next(t[1][1]),s.next(t[1][0]),t[1])),Nt(s),V(t=>t[1]),ls(()=>{void 0!==a&&(a.unsubscribe(),a=void 0)}),Lt());return{_stream:n,_control:{...e,_stream:c}}},datalogic:{pre:i,post:a}});return{_stream:c._stream.pipe(V(t=>t),Lt()),_control:{_stream:c._control._stream.pipe(V(t=>t),Lt())}}}},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=n.leaf.logic.args.spellname;let s,a={},u=i;if(!s){a=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});const n=Wg(a);n.length>0&&(u=u.concat(n),a=await jg({refnode:e,nodelambda:r,contextuallambda:u,etaTree:t.gos.etaTree})),a&&o in a&&(s=a[o])}const c=async({refnode:t,spellbook:e,spellname:n,lambdalut:r,contextuallambda:i,etaTree:o}={})=>{if(n in e){const s=e[n];s in r&&r[s],"accio"===n&&t.slice(0,4);const a=await o.etaReduceLEAFNode({nodeuuid:s,contextuallambda:i});return"accio"===n&&t.slice(0,4),a}};if(!s){const n=t.user.spellbook,r=t.user.lambdalut;s=await c({refnode:e,spellbook:n,spellname:o,lambdalut:r,contextuallambda:u,etaTree:t.gos.etaTree})}if(!s){const n=t.gos.stdlambdalut,r=t.gos.standardSpellbook;s=await c({refnode:e,spellbook:r,spellname:o,lambdalut:n,contextuallambda:u,etaTree:t.gos.etaTree})}if(!s){const n=t.gos.curatedlambdalut,r=t.gos.curatedSpellbook;s=await c({refnode:e,spellbook:r,spellname:o,lambdalut:n,contextuallambda:u,etaTree:t.gos.etaTree})}return s}},Hg={dataflow:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>(t,e)=>({...Bg(t),_control:e}),lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=r.filter(e=>"lambda"===t.gos.etaTree.graphcomponents.components.lut[e].scope),s=r.filter(e=>"dataflow"===t.gos.etaTree.graphcomponents.components.lut[e].scope),a=await jg({refnode:e,nodelambda:o,contextuallambda:i,etaTree:t.gos.etaTree,addnodelut:!0,metadata:{codebase:"leafspelldef.js",context:"reduced_lambdalambda_obj"}}),u=await jg({refnode:e,nodelambda:s,contextuallambda:i,etaTree:t.gos.etaTree,metadata:{codebase:"leafspelldef.js",context:"reduced_defaultlambda_obj",spellname:n.leaf.logic.args.spellname}}),c=t=>t?Object.keys(t).reduce((e,n)=>("_nodelut"!==n&&("object"==typeof t[n]?e[n]=c(t[n]):e[n]=t[n]),e),{}):{};return{...c(a),...c(u)}},methods:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=r.filter(e=>"lambda"===t.gos.etaTree.graphcomponents.components.lut[e].scope),s=r.filter(e=>"dataflow"===t.gos.etaTree.graphcomponents.components.lut[e].scope),a=await jg({refnode:e,nodelambda:o,contextuallambda:i,etaTree:t.gos.etaTree,addnodelut:!0,metadata:{codebase:"leafspelldef.js",context:"reduced_lambdalambda_obj"}}),u=await jg({refnode:e,nodelambda:s,contextuallambda:i,etaTree:t.gos.etaTree,metadata:{codebase:"leafspelldef.js",context:"reduced_defaultlambda_obj",spellname:n.leaf.logic.args.spellname}}),c=t=>t?Object.keys(t).reduce((e,n)=>("_nodelut"!==n&&("object"==typeof t[n]?e[n]=c(t[n]):e[n]=t[n]),e),{}):{};return{...c(a),...c(u)}}};const Xg=wn("error",{type:"critical",message:"LEAF core error: race condition detected in leafloopyspell.js",codebase:"/src/ghostos/api/parser/nodelogic/abstraction/leafloopyspell.js"},{}),Kg=t=>{if(!t)return 1;if(Object.keys(t).filter(t=>"&"===t).length>0)return;const e=Object.keys(t).filter(t=>sn(t)).map(t=>parseInt(t)).sort();return e.length>0?e[e.length-1]:1},Qg={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;["7b1f"].includes(e.slice(0,4));const o=await jg({refnode:e,nodelambda:r,contextuallambda:i,etaTree:t.gos.etaTree});["7b1f"].includes(e.slice(0,4));const s="bypass"in o,{type:a,args:u}=n.leaf.logic,c={codebase:"leafloopyspell.js",refnode:e,leafnode:t.gos.etaTree.leafgraph.graph.dataflow.getNodeAttributes(e).leafnode.data},l=Kg(o),h=(t=>{const e="stream"in t;if(!t)return e?1e3:10;if("interval"in t){const e=Kg(t.interval);return sn(e)?parseInt(e):void 0}return e?1e3:10})(o),d="forever"in o;if(o&&"_default"in o){l>0?Gg(0,h).pipe(zg(l)):Gg(0,h);["7b1f"].includes(e.slice(0,4));return(t,n)=>{["7b1f"].includes(e?.slice(0,4));const r={_stream:n._stream.pipe(V(t=>_.throttle(()=>{},200)?t:void 0),$t(t=>void 0!==t),hn(t=>yt([...Array(l).keys()]).pipe(V(e=>({...t,_label:{...t._label,loopyidx:e}})))))};if(!o||!("_default"in o)){return p_(r,t,void 0,{...c,metastep:"relaying input data as is due to error condition"})}let i=0,a=[];let u,h=new qt(Xg),p=new Yo(1);const f=r._stream.pipe(It(t=>(u=t,h.next(t),h)),jt(p));return p_({_stream:f},t,void 0,{...c,metastep:"executing a loopy spell with idx "+i},{leaflogic:o._default,datalogic:{pre:t=>{const e=t;return s||a.push(t),e},post:t=>{if(i+=1,(d||i<l)&&h.next(u),!s)return a[0];if("stream"in o)return t;if(a.push(t),i===l){const t=[...a];return a=[],i=0,t}}}})}}return o&&"await"in o?(t,e)=>{const n={_stream:e._stream.pipe(V(t=>_.throttle(()=>{},10)?t:void 0),$t(t=>void 0!==t),V(t=>[...Array(l).keys()].map(e=>({...t,_label:{...t._label,loopyidx:e}}))))};if(!o.await||!("_default"in o.await)){return p_(n,t,void 0,{...c,metastep:"relaying input data as is due to error condition"})}let r=0,i=[];const a=t=>{const e=t;return s||i.push(t),e};let u=new Pt,h=new Pt,d=new Pt;const p=new Pt,f=new Pt;let m,g;const y=new Pt,v=new Pt,b=o.await._default([{_stream:y}],{_stream:v}),w=n._stream.pipe(Nt(...t.map(t=>t._stream)),It(t=>{const e=t[0],n=t[1];if(m=e,void 0!==g&&!g.closed)return h.next(n),u.next(e),f;r=0,i=[],d.next();const _=p_({_stream:u},[{_stream:h}],void 0,{...c,metastep:"executing a loopy spell with idx "+r},{datalogic:{pre:a,post:t=>{if(r+=1,!s)return i[0];if("stream"in o)return t;if(i.push(t),r===l){const t=[...i];return i=[],r=0,1===l?t[0]:t}}}});let w;return g=_._control._stream.pipe(Nt(_._stream),It(t=>(w=t,y.next(t[1]),v.next(t[0]),b._control._stream)),Nt(b._control._stream),Nt(b._stream),V(t=>t[1]),V(t=>(t&&(p.next(w[1]),m=w[0],d.next()),t)),jt(d)).subscribe({next:t=>{},error:t=>{},complete:()=>{}}),h.next(n),u.next(e),f}),V(t=>t),ls(()=>{void 0!==g&&(g.unsubscribe(),g=void 0)}),$t(t=>void 0!==t),Lt());return{_stream:o.final&&"_default"in o.final?p.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Xg)),It(t=>a_(o.final._default,t)),V(t=>(setTimeout(()=>{f.next(m)},0),t)),Lt()):p.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(Xg)),V(t=>(setTimeout(()=>{f.next(m)},0),t)),Lt()),_control:{_stream:w.pipe(V(t=>t),Lt())}}}:(t,e)=>({...Bg(t),_control:e})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const o=await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),s={};return Object.entries(o).map(([t,e])=>{s[t]=(t,n)=>{const r=Bg(t);return{...e([r],n),_control:n}}}),s}},Zg=Wt("leafgraph"),Yg=(t,e)=>{if(!t)return null;if(t.startsWith("/")){const n=t.slice(1);return n?{graph_domain:e,graph_appid:n}:null}const n=t.indexOf("/");return-1===n?{graph_domain:t,graph_appid:"index"}:0===n||n===t.length-1?null:{graph_domain:t.slice(0,n),graph_appid:t.slice(n+1)}},t_=async(t,e,n,r,i,o,s,a,u,c,l=!1)=>{const h=await(Gn(u)?.parseGraphEtaTree(i,o)),d=h.leafgraph,p=h.graphcomponents,f=h.graphcomponents.components.nodegroups.runtime[0];h.graphcomponents.components.nodegroups.lambda;return(async()=>{const t={};if(0===d.graph.lambda.nodes().filter(t=>{const e=d.graph.lambda.getNodeAttributes(t),{type:i,args:o}=e.leafnode.data.leaf.logic;if("leafgraph"===i){return En(Zg.editorconfig.namedatakey,o).toLowerCase()===n+"/"+r}return!1}).length){const n=[];if(f&&(["2ee89b44-16af-472f-97d4-47ae65f064c8"].includes(e),t._default=await Ig({refnode:"leafgraph",component_members:f,contextuallambda:c,etaTree:h})),l&&void 0!==p.leafconfig){const e=h.etaReduceLEAFNode({nodeuuid:p.leafconfig,contextuallambda:c}),n=await e;t._leafconfig=n.leafconfig}Object.entries(p.spelldefs).map(([e,r])=>{const i=h.etaReduceLEAFNode({nodeuuid:r,contextuallambda:c});i.then(n=>{t[e]=n}),n.push(i)}),await Promise.all(n)}return t})()},e_={dataflow:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{if(!i)throw`LEAF error: the logical construct built using the ${n.leaf.logic.type} node (${e}) called with args (${JSON.stringify(n.leaf.logic.args)}).`;await jg({refnode:e,nodelambda:i,contextuallambda:r,etaTree:t.gos.etaTree}),zo({refnodedata:{leaf:{logic:{args:{bottlekey:"_leafgraph"}}}},contextuallambda:i});const{type:o,args:s}=n.leaf.logic,a=En(Zg.editorconfig.namedatakey,s),u=a.toLowerCase(),c=(t=>{const e=t.indexOf("/");return e<=0||e===t.length-1?null:{graph_domain:t.slice(0,e),graph_appid:t.slice(e+1)}})(u.startsWith("github/")?a:u);if(!c)return{};const{graph_domain:l,graph_appid:h}=c,d=t.gos.etaTree.domain,p=t.gos.etaTree.appid;if(l+"/"+h!=d+"/"+p){const n=t_(0,e,d,p,l,h,t.gos.leafio,t.gos.etaTree.mnemosyne,t.gos.etaTree,i),r=await n;return(t,e)=>{if(r){return{...r._default(t,e),_control:e}}}}return t=>({...Bg(t),_control:controlflow$obj})},lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const{type:o,args:s}=n.leaf.logic,a=En(Zg.editorconfig.namedatakey,s),u=a.toLowerCase(),c=u.startsWith("github/")?a:u,l=t.gos.etaTree.domain,h=Yg(c,l);if(!h)return{};const d=t.gos.etaTree.appid,{graph_domain:p,graph_appid:f}=h;if("breezyforest"!==p&&p+"/"+f==l+"/"+d)return{};try{["3be30006-5b56-4b27-8eaa-249c6a46a557"].includes(e);const n=t_(0,e,l,d,p,f,t.gos.leafio,t.gos.etaTree.mnemosyne,t.gos.etaTree,i);return await n}catch(t){return}},_lambda:t=>async({refnode:e,refnodedata:n,nodelambda:r,contextuallambda:i}={})=>{const{type:o,args:s}=n.leaf.logic,a=En(Zg.editorconfig.namedatakey,s),u=a.toLowerCase(),c=u.startsWith("github/")?a:u,l=t.gos.etaTree.domain,h=Yg(c,l);if(!h)return{};const d=t.gos.etaTree.appid,{graph_domain:p,graph_appid:f}=h;if("breezyforest"!==p&&p+"/"+f==l+"/"+d)return{};try{["3be30006-5b56-4b27-8eaa-249c6a46a557"].includes(e);const n=t_(0,e,l,d,p,f,t.gos.leafio,t.gos.etaTree.mnemosyne,t.gos.etaTree,i,!0);return await n}catch(t){return}},methods:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>({})},n_={dataflow:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>{},lambda:t=>async({refnode:t,refnodedata:e,nodelambda:n,contextuallambda:r}={})=>{}};zt.breezyforest._version;const r_=(t,e)=>{const n=new He,r=new He,i=new He;new He;let o;t.forEach(t=>{const s=JSON.parse(an.hp.from(t.data,"base64").toString("utf-8"));"leafdeckspade"===s.leaf.logic.type&&(o=t.uuid),n.addNode(t.uuid,{leafnode:{...t,data:s},lambdactrl:{gos:{standardSpellBook:{},curatedSpellBook:{},masterSubsDirectory:e},user:{spellbook:{},config:s}}}),r.addNode(t.uuid,{leafnode:{...t,data:s},lambdactrl:{gos:e,user:s}}),i.addNode(t.uuid,{leafnode:{...t,data:s},lambdactrl:{gos:e,user:s}})});const s=new Set,a=new Set,u=new Set,c=new Set,l={},h=new Set;return t.forEach(t=>{t.out_edges.forEach((t,e)=>{const o=JSON.parse(an.hp.from(t.data,"base64").toString("utf-8")).leaf;if("leafdataedge"===o.logic.type)if(n.edge(t.source.uuid,t.target.uuid)){}else n.addEdgeWithKey(t.uuid,t.source.uuid,t.target.uuid,o),i.addEdgeWithKey(t.uuid,t.source.uuid,t.target.uuid,o),s.add(t.source.uuid),a.add(t.target.uuid);else if("leaflambdaedge"===o.logic.type){if("9935"===t.source.uuid.slice(0,4)){JSON.parse(an.hp.from(t.data,"base64").toString("utf-8"));return}r.addEdgeWithKey(t.uuid,t.source.uuid,t.target.uuid,o),i.addEdgeWithKey(t.uuid,t.source.uuid,t.target.uuid,o),u.add(t.source.uuid),c.add(t.target.uuid),l[t.target.uuid]=t.target.uuid in l?[t.source.uuid].concat(l[t.target.uuid]):[t.source.uuid]}else"leafanchoredge"===o.logic.type&&h.add(t.target.uuid)})}),{graph:{lambda:r,dataflow:n},thespade:{uuid:o},edges:{data:{sources:s,targets:a},lambda:{sources:u,targets:c,sourcelut:l},anchor:{targets:h}}}},i_=t=>{const e=[],n=[],r=[],i=function(t){if(null===(e=t)||"object"!=typeof e||"function"!=typeof e.addUndirectedEdgeWithKey||"function"!=typeof e.dropNode||"boolean"!=typeof e.multi)throw new Error("connectedComponents: the given graph is not a valid graphology instance.");var e;if(!t.order)return[];const n=new en(t),r=n.push.bind(n),i=[];return n.forEachNodeYetUnseen(function(e){const o=[];let s;for(n.push(e);0!==n.size;)s=n.pop(),o.push(s),t.forEachNeighbor(s,r);i.push(o)}),i}(t.graph.dataflow),o=(e,n,r,i,o)=>{const s={...o};return e.forEach(e=>{s[e]={idx:n,scope:r,category:i,metadata:t.graph.dataflow._nodes.get(e).attributes.leafnode.data.leaf.logic}}),s};let s={};const a={};let u;return i.forEach(i=>{if(((t,e)=>t.some(t=>{const n=e.edges.anchor.targets.has(t);return n||"leafanchor"===e.graph.lambda.getNodeAttributes(t).leafnode.data.leaf.logic.type}))(i,t))r.push(i);else{const r=((t,e)=>t.some(t=>(t.slice(0,4),e.edges.lambda.sources.has(t))))(i,t),c=((t,e)=>t.filter(t=>"leafspelldef"===e.graph.lambda.getNodeAttributes(t).leafnode.data.leaf.logic.type).length>0)(i,t),l=((t,e)=>t.filter(t=>"leafconfig"===e.graph.lambda.getNodeAttributes(t).leafnode.data.leaf.logic.type).length>0)(i,t);if(r||c||l){const e=n.push(i)-1;let r;(t=>t.length>1)(i)?r="dataflow":((t,e)=>1===t.length&&t.every(t=>{const n=e.graph.lambda.getNodeAttributes(t).leafnode;return!["leafinflowport","leafoutflowport"].includes(n.data.leaf.logic.type)}))(i,t)&&(r="lambda");if(s=o(i,e,r,"lambda",s),c){const e=t.graph.dataflow.getNodeAttributes(i[0]).leafnode.data;a[e.leaf.logic.args.spellname]=i[0]}else l&&(u=i[0])}else if(((t,e)=>t.every(t=>!e.edges.lambda.sources.has(t))&&t.every(t=>e.edges.data.sources.has(t)||e.edges.data.targets.has(t)))(i,t)){const t=e.push(i);s=o(i,t-1,"dataflow","main",s)}}}),{spelldefs:a,leafconfig:u,components:{nodegroups:{runtime:e,lambda:n,anchored:r},lut:s}}},o_=wn("error",{type:"critical",message:"LEAF core error: race condition detected in leaf.js",codebase:"/src/ghostos/api/parser/leaf.js"},{}),s_=wn("accio","ctrl_accio",{provenance:"executeLEAFLogic"}),a_=async(t,e,n={},r=void 0,i=void 0)=>{const o=new Pt,s=new Pt,a=t([{_stream:o}],{_stream:s,_config:n});if(a){const t=cn(a._control._stream.pipe(Nt(a._stream),V(t=>t[1])));o.next(e),i?s.next(i):s.next(s_);return await t}},u_=wn("accio","ctrl_accio",{provenance:"subscribeToLEAFLogic"}),c_=async(t,e,n,r)=>{const i=new qt({...o_,_label:{at:"leaf.js subscribeToLEAFLogic data stream"}}),o=new qt({...o_,_label:{at:"leaf.js subscribeToLEAFLogic ctrl stream"}});i.next(e),o.next(u_);const s=t([{_stream:i}],{_stream:o,_config:n});let a;s&&s._control._stream.pipe(It(t=>(a=t,s._stream)),V(t=>[a,t]),jt(r)).subscribe({next:t=>{},error:t=>{},complete:()=>{}})},l_=(t,e,n,r,i,o=void 0)=>{const s={_stream:r,_config:i};if(n){if(!n.runtime){const r=async()=>{t([{_stream:e}],s)._stream.pipe(V(t=>{const e=o?(()=>{const e=new Object;return e[o]=t,e})():t;return n&&n.subject$.next(e),e})).subscribe({next:t=>{},complete:()=>{}})};n.runtime=r()}return{_stream:n.subject$}}return t([{_stream:e}],s)};globalThis.TRACEON=!0,globalThis.TRACESIZE=30;const h_=(t,e,n,r,i)=>{let o;return Promise.race([t,new Promise((t,s)=>o=setTimeout(()=>{const e=wn("error",{type:"timeout",message:r,codebase:n,metadata:i});t(e)},e,r))]).finally(()=>clearTimeout(o))},d_=(t,e,n=!1)=>globalThis.TRACEON?Array.isArray(t)?[...t,{timestamp:Date.now(),trace:e}]:void 0===t?[{timestamp:Date.now(),trace:e}]:void 0:t||[],p_=(t,e,n,r={},i={leaflogic:void 0,datalogic:{pre:void 0,post:void 0}})=>{const o=new Pt,s=new Pt,a=new Pt;new Pt;let u,c;["e9e6e44b-792b-46d0-b1d3-58ce2f46c45b","c822ae2e-1be8-46be-b2cb-21a43cef0555","98d167d3-c1ed-4d4a-9ab9-25eaccd20a91"].includes(r.refnode);const l=i.leaflogic,h=void 0!==l?l([{_stream:a}],{_stream:void 0!==n?Bt(s,n):s,_config:{...t._config}}):{_stream:a,_control:{_stream:s,_config:{...t._config,traces:d_(t._config?.traces,r)}}},d=e.length>1?Bt(...e.map(t=>t._stream)):e[0]._stream,p=t._stream.pipe(Nt(d),It(t=>{["806e0a4b-badf-42a0-85af-5ad306385c58"].includes(r.refnode),e.length;const n=t[0],o=void 0!==i.datalogic?.pre?i.datalogic.pre(t[1]):t[1];u=1===n?.length?n[0]:n;const l={...u,traces:d_(u?.traces,{...r,at:"leaf.js driveDataflowByCtrlflow, initial switch-mapping of the ctrl signal to drive dataflow through a resolved leaflogic"},!0)};return c=o,setTimeout(()=>{a.next(o),s.next(l)},1),h._control._stream}),Nt(h._control._stream),Nt(h._stream),V(t=>[t[0][1],t[1]]),V(t=>{r.refnode,["38567c62-7513-4ec3-9011-2fcf6c51ec7b"].includes(r.refnode);const e=void 0!==i.datalogic?.post?i.datalogic.post(t[1]):t[1],n=Array.isArray(e)?e.filter(t=>void 0!==t):void 0!==e?e:void 0;return void 0!==n&&o.next(n),t[0]}),V(t=>t),Lt());return{_stream:o.pipe($t(t=>JSON.stringify({...t,_label:{}})!==JSON.stringify(o_)),Lt()),_control:{_stream:p.pipe(V(t=>(["e9e6e44b-792b-46d0-b1d3-58ce2f46c45b","c822ae2e-1be8-46be-b2cb-21a43cef0555"].includes(r.refnode),t)),Lt()),_config:{...t._config,traces:d_(t._config?.traces,r)}}}},f_=async(t,e,n)=>{const r={gos:{standardSpellbook:{},curatedSpellbook:{},stdlambdalut:{},curatedlambdalut:{},leafio:e.leafio,etaTree:e},user:{spellbook:{},lambdalut:{}}},{domain:i,appid:o}=r.gos.etaTree,s={graphuuid:"",domain:i,appid:o,graphaddrstr:t};try{const t=e_.lambda(r)({refnode:n,refnodedata:{leaf:{logic:{args:s}}},nodelambda:[],contextuallambda:[]});return await t}catch(t){return{}}};const m_=t=>{const e=t.split("://");return(e[0].includes("https")?"wss":"ws")+"://"+e[1]},g_=t=>!t||t&&"Object"!==t.constructor.name?t:JSON.parse(JSON.stringify(t)),__=t=>{const{endpoint:e,websocket:n,headers:r,hook:i}=t,o={endpoint:e,headers:g_(r||{}),websocket:{...n,endpoint:n&&n.endpoint||m_(e),parameters:n&&n.parameters||{},client:null,open:!1,subscriptions:{}}},s=async()=>{try{const t=new WebSocket(o.websocket.endpoint,"graphql-ws");return t.onerror=t=>{},t.onclose=t=>{},t}catch(t){throw new Error("Failed to establish the WebSocket connection: ",t)}},a=t=>{o.websocket.client.send(JSON.stringify(t))},u=t=>{o.websocket.client=t,o.websocket.shouldRetry&&(t.onclose=()=>{s().then(u)}),t.addEventListener("open",()=>{const t={...o.websocket.parameters,headers:{...o.headers,...o.websocket.parameters.headers}};a({type:"connection_init",payload:t})}),t.addEventListener("message",t=>{((t,e)=>{let n,{data:r}=e;try{r=JSON.parse(r)}catch(t){return}switch(r.type){case"connection_ack":return t.onConnectionSuccess&&t.onConnectionSuccess(),void(t.open=!0);case"connection_error":return void(t.onConnectionError&&t.onConnectionError(r));case"ka":return void(t.onConnectionKeepAlive&&t.onConnectionKeepAlive());case"data":return n=t.subscriptions[r.id],void(n&&n.onGraphQLData&&n.onGraphQLData(r.payload));case"error":return n=t.subscriptions[r.id],void(n&&n.onGraphQLError&&n.onGraphQLError(r.payload));case"connection_terminate":return;case"complete":n=t.subscriptions[r.id],n&&n.onGraphQLComplete&&n.onGraphQLComplete(r.payload),delete t.subscriptions[r.id]}})(o.websocket,t)})},c=()=>{s().then(t=>{u(t)}).catch(t=>{})};n&&c();return{query:async(t,e,n)=>{const{query:r,variables:s,headers:a}=t,u={...o.headers,...a||{}};Object.keys(u).some(t=>/content-type/gi.test(t));try{let t;t=await fetch(o.endpoint,{method:"POST",headers:u,credentials:"include",body:r});const s=await t.json();if(i&&i(s),s.errors)throw n&&n(s),s;return e&&e(s),s}catch(t){throw t}},subscribe:(t,e,n)=>{if(!o.websocket.client)return;const{operationId:r,subscription:i,variables:s,onGraphQLData:u,onGraphQLError:c,onGraphQLComplete:l}=t;return o.websocket.subscriptions[r]={onGraphQLData:t=>{u&&u(t),e&&e(t)},onGraphQLComplete:t=>{l&&l(t)},onGraphQLError:t=>{c&&c(t),n&&n(t)}},a({type:"start",id:r,payload:{query:i,variables:s||{}}}),{stop:()=>{a({type:"stop",id:r})}}},updateHeaders:t=>{o.headers=g_(t),o.websocket.client&&s().then(u).catch(t=>{})},establishWS:c,clientContext:o}};const{memoize:y_}=bn,v_=({_domain:t,_appid:e,filter:n={},query:r}={})=>`\n subscription {\n graph: getGraph(domain: "${t}", appid: "${e}", filter: ${n}) ${r}\n }\n`,b_=({_appmode:t,_hostdomain:e,_hostappid:n,_domain:r,_appid:i,filter:o={},query:s}={})=>`\n query {\n graph: getGraph(domain: "${r}", appid: "${i}", filter: ${o}) ${s}\n }\n`,w_={dburi_subs:"https://gdb.leafgon.com/sgraphql",dburi_subs_ws:"wss://gdb.leafgon.com/sgraphql",dburi_qm:"https://gdb.leafgon.com/qmgraphql"},x_=({_clientConfig:t=w_,_metamodel:e=zt.breezyforest,_sessionid:n}={})=>{const r=t.dburi_subs?t.dburi_subs:void 0,i=t.dburi_subs_ws?t.dburi_subs_ws:void 0,o=t.dburi_qm?t.dburi_qm:void 0,s=t.clientAuthKey?t.clientAuthKey:void 0,a=e.GQLParameters.masterquery;let u={subscriptions:{},subs_methods:{},qm_methods:{}};const c=({gql_subs_client:t,force:e=!1}={})=>{(e||[WebSocket.CLOSED,WebSocket.CLOSING].includes(t.clientContext.websocket.client.readyState))&&t.establishWS()};u.gql_qm_client=o&&__({endpoint:o,headers:s?{Accept:"application/json","X-API-Key":s}:{Accept:"application/json"}});const l=new Promise((t,e)=>{u.gql_subs_client=r&&i?__({endpoint:r,headers:s?{"Content-Type":"application/json","X-API-Key":s}:{"Content-Type":"application/json"},websocket:{endpoint:i,onConnectionSuccess:()=>{t("gql_subs_client is connected and ready")},onConnectionError:()=>{e("gql_subs_client: Connection Error")}}}):void 0}),h=async({_appmode:e,_domain:n,_appid:r,filter:i="{}",subsCallback:o,errorCallback:s,variables:h}={})=>{l.then(e=>{const l=(()=>{let t="";const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let n=0;n<5;n++)t+=e.charAt(Math.floor(62*Math.random()));return t+(Object.keys(u.subscriptions).length+1)})();try{const e=u.gql_subs_client.subscribe({operationId:l,subscription:v_({_domain:n,_appid:r,filter:i,query:a}),onGraphQLData:t=>{o&&o(t.data)},onGraphQLError:t=>{l in u.subscriptions&&u.subscriptions[l].stop(),s&&s(t)},onGraphQLComplete:e=>{t.keepGQLConnected&&c({gql_subs_client:u.gql_subs_client,force:!0})}});u.subscriptions[l]=e}catch(t){l in u.subscriptions&&u.subscriptions[l].stop()}})},d=y_(({_appmode:t,_hostdomain:e,_hostappid:n,_domain:r,_appid:i,filter:s="{}",variables:c}={})=>new Promise((l,h)=>{const d={endpoint:o,query:JSON.stringify({query:b_({_appmode:t,_hostdomain:e,_hostappid:n,_domain:r,_appid:i,filter:s,query:a}),variables:c||{}})};try{u.gql_qm_client.query(d,t=>{t.data&&l({graph:t.data.graph})})}catch(t){h({})}}),({_appmode:t,_hostdomain:e,_hostappid:r,_domain:i,_appid:o,filter:s="{}",variables:a}={})=>JSON.stringify([i,o,s,n])),p=({variables:t})=>{const e={endpoint:o,query:JSON.stringify({query:"mutation AddNode($uuid: String!, $data: String!, $graphdomain: String!, $graphappid: String!, $provdomain: String!, $provappid: String!) {\n addNode(input: [{uuid: $uuid, graph: {domain: $graphdomain, appid: $graphappid}, provenance: {domain: $provdomain, appid: $provappid}, data: $data}]) {node {uuid}}\n}",variables:t||{}})};try{u.gql_qm_client.query(e,t=>{t.data})}catch(t){}},f=({node_uuid:t})=>{const e={endpoint:o,query:JSON.stringify({query:"mutation DeleteNode($uuid: String!) {\n deleteNode(nfilter: {uuid: {eq: $uuid}}) {node {uuid}}\n}",variables:{uuid:t}||{}}).replace(/\\n/g,"")};try{u.gql_qm_client.query(e,t=>{t.data})}catch(t){}},m=({variables:t})=>{const e={endpoint:o,query:JSON.stringify({query:"mutation UpdateNode($uuid: String!, $data: String!) {\n updateNode(input: {filter: {uuid: {eq: $uuid}}, set: {data: $data}}) {node {uuid}}\n}",variables:t||{}})};try{u.gql_qm_client.query(e,t=>{t.data})}catch(t){}},g=({variables:t})=>{const e={endpoint:o,query:JSON.stringify({query:"mutation AddEdge($uuid: String!, $sourceuuid: String!, $targetuuid: String!, $data: String!, $graphdomain: String!, $graphappid: String!, $provdomain: String!, $provappid: String!) {\n addEdge(input: [{uuid: $uuid, source: {uuid: $sourceuuid}, target: {uuid: $targetuuid}, graph: {domain: $graphdomain, appid: $graphappid}, provenance: {domain: $provdomain, appid: $provappid}, data: $data}]) {edge {uuid}}\n}",variables:t||{}})};try{u.gql_qm_client.query(e,t=>{t.data})}catch(t){}},_=({edge_uuid:t})=>{const e={endpoint:o,query:JSON.stringify({query:"mutation DeleteEdge($uuid: String!) {\n deleteEdge(efilter: {uuid: {eq: $uuid}}) {edge {uuid}}\n}",variables:{uuid:t}||{}}).replace(/\\n/g,"")};try{u.gql_qm_client.query(e,t=>{t.data})}catch(t){}};return u.gql_subs_client&&(u.subs_methods={queryGraph:h,clientState:()=>u.gql_subs_client.clientContext.websocket.client.readyState,reconnect:()=>{c({gql_subs_client:u.gql_subs_client})}}),u.gql_qm_client&&(u.qm_methods={queryGraph:d,addNode:p,updateNode:m,delNode:f,addEdge:g,delEdge:_}),u};const T_=({_LEAFappList:t=[],stateObjInstanceID:e=Kn(),dirOfSubjects:n={},permissions:r={},metamodel:i=zt}={})=>{const o={current:JSON.parse(JSON.stringify(i.breezyforest.IOStateGroundZero))};o.current.dirOfSubjects=(()=>{let t={};return Object.entries(i.breezyforest.subsDirectory).forEach(([e,s])=>{e in n?(t[e]=n[e],o.current.permissions[e]=e in r?r[e]:i.breezyforest.IOAccessPermission.Observer):(t[e]={main:k_(),bridges:{}},o.current.permissions[e]=e in r?r[e]:i.breezyforest.IOAccessPermission.All),o.current.subscriptions[e]=t[e].main.doSubscribe(({control:t,data:n})=>{o.current.subsCache[e]={control:t,data:n},((t,e,n)=>{t in o.current.callbacks&&Object.entries(o.current.callbacks[t]).map(([t,r])=>{r({control:e,data:n})})})(e,t,n)})}),t})();return{getCurLEAFIOState:()=>o.current.subsCache,getMasterSubsDir:()=>o.current.dirOfSubjects,setNewLEAFIOState:(t,n,r=zt.breezyforest.originType.FRONTEND)=>{try{if(o.current.permissions[t]&i.breezyforest.IOAccessPermission.Contributor)return o.current.dirOfSubjects[t].main.doWrite({control:{provenance:{stateObjInstanceID:e,dataOrigin:r}},data:n}),!0;return o.current.permissions[t]&i.breezyforest.IOAccessPermission.Contributor}catch(t){return-1}},setLEAFIOCallback:(t,e,n=null)=>{t in o.current.subscriptions&&(null===n&&e in delete o.current.callbacks[t]?(o.current.callbacks={...o.current.callbacks,[t]:{...o.current.callbacks[t]}},delete o.current.callbacks[t][e]):n&&(o.current.callbacks={...o.current.callbacks,[t]:{...o.current.callbacks[t],[e]:n}}))},destructLEAFIOobj:()=>{Object.entries(o.current.subscriptions).forEach(([t,e])=>{o.current.dirOfSubjects[t].main.doUnsubscribe(e)})}}},k_=()=>{const t={handle$:new qt,doWrite:e=>t.handle$.next(e),doSubscribe:e=>t.handle$.pipe(function(t){return $t(function(e,n){return t<=n})}(1)).subscribe(e),doUnsubscribe:t=>t.unsubscribe(),doAddAddressee:(t,e)=>{}};return t},S_=(t,e=[],n=zt)=>{let r={};return Object.entries(n.breezyforest.subsDirectory).forEach(([t,e])=>{r[t]={main:k_(),bridges:{}}}),[t,r]},A_="https://gdb.leafgon.com/qmgraphql",E_=async({variables:t,endpoint:e=A_})=>{const n=__({endpoint:e,headers:{Accept:"application/json"}}),r={endpoint:e,query:JSON.stringify({query:"mutation AddNode($uuid: String!, $leafnodetype: String, $data: String!, $graphdomain: String!, $graphappid: String!, $provdomain: String!, $provappid: String!) {\n addNode(input: [{uuid: $uuid, leafnodetype: $leafnodetype, graph: {domain: $graphdomain, appid: $graphappid}, provenance: {domain: $provdomain, appid: $provappid}, data: $data}]) {node {uuid}}\n}",variables:t||{}})};let i;try{i=await n.query(r),i.data}catch(t){}},O_=async({node_uuid:t,endpoint:e=A_})=>{const n=__({endpoint:e,headers:{Accept:"application/json"}}),r={endpoint:e,query:JSON.stringify({query:"mutation DeleteNode($uuid: String!) {\n deleteNode(nfilter: {uuid: {eq: $uuid}}) {node {uuid}}\n}",variables:{uuid:t}||{}}).replace(/\\n/g,"")};let i;try{i=await n.query(r),i.data}catch(t){}},C_=async({variables:t,endpoint:e=A_})=>{const n=__({endpoint:e,headers:{Accept:"application/json"}}),r={endpoint:e,query:JSON.stringify({query:"mutation UpdateNode($uuid: String!, $data: String!) {\n updateNode(input: {filter: {uuid: {eq: $uuid}}, set: {data: $data}}) {node {uuid}}\n}",variables:t||{}})};let i;try{i=await n.query(r),i.data}catch(t){}},M_=async({variables:t,endpoint:e=A_})=>{const n=__({endpoint:e,headers:{Accept:"application/json"}}),r={endpoint:e,query:JSON.stringify({query:"mutation AddEdge($uuid: String!, $sourceuuid: String!, $targetuuid: String!, $data: String!, $graphdomain: String!, $graphappid: String!, $provdomain: String!, $provappid: String!) {\n addEdge(input: [{uuid: $uuid, source: {uuid: $sourceuuid}, target: {uuid: $targetuuid}, graph: {domain: $graphdomain, appid: $graphappid}, provenance: {domain: $provdomain, appid: $provappid}, data: $data}]) {edge {uuid}}\n}",variables:t||{}})};let i;try{i=await n.query(r),i.data}catch(t){}},N_=async({edge_uuid:t,endpoint:e=A_})=>{const n=__({endpoint:e,headers:{Accept:"application/json"}}),r={endpoint:e,query:JSON.stringify({query:"mutation DeleteEdge($uuid: String!) {\n deleteEdge(efilter: {uuid: {eq: $uuid}}) {edge {uuid}}\n}",variables:{uuid:t}||{}}).replace(/\\n/g,"")};let i;try{i=await n.query(r),i.data}catch(t){}};export{zt as LEAFIOmetamodel,qn as SHA1,Ht as _breezyforeststdlib_hierarchy,Jt as _breezyforeststdlib_name,Xt as _edge_handle_dict,Kt as _edge_style_dict,kg as _leafelement,e_ as _leafgraph,Wt as _leafstdlib_dataflow_api,i_ as analyzeLEAFGraph,__ as createGQLClient,So as decodeUnicode,Np as destroySoundStageNode,wn as doBottle,xn as doUnbottle,p_ as driveDataflowByCtrlflow,ko as encodeUnicode,Ig as etaReduceDataflowComponent,Gn as etaTreeForest,a_ as executeLEAFLogic,l_ as executeLEAFLogicInSync,En as fetchMultiKeyedData,T_ as initLEAFIOapi,No as init_gRuntimeLEAFlisp,x_ as initializeLEAFlakeGQLClient,S_ as initializeMasterSubsDirectory,Mp as initializeSoundStage,k_ as initializeSubsMain,M_ as mutateAddEdge,E_ as mutateAddNode,N_ as mutateDelEdge,O_ as mutateDelNode,C_ as mutateUpdateNode,f_ as parseAddressableGraph,Oo as parseJsonToLEAFlisp,r_ as reconstructLEAFGraph,Po as runLEAFlispcode,Rg as runtimeEtaTree,On as setMultiKeyedData,c_ as subscribeToLEAFLogic};
|
|
3
3
|
//# sourceMappingURL=index.esm.js.map
|