text: (window.webpackJsonp=window.webpackJsonp||[]).push([[1],[function(t,e,i){"use strict";t.exports=i(21)},function(t,e,i){var n;void 0===(n=function(){return function(){"use strict";var t,e;function i(e){e(t)}return e=function(){var t=function t(){if(!(this instanceof t))throw new Error("constructor needs to be called with the 'new' keyword")};t.prototype.toString=function(){for(var e in t){var i=e[0].match(/^[A-Z]$/),n=t[e]===this.constructor;if(t.isFunction(t[e])&&i&&n)return e}return"Tone"},t.prototype.dispose=function(){return this},t.prototype.set=function(e,i,n){if(t.isObject(e))n=i;else if(t.isString(e)){var o={};o[e]=i,e=o}t:for(var r in e){i=e[r];var s=this;if(-1!==r.indexOf(".")){for(var a=r.split("."),l=0;l<a.length-1;l++)if((s=s[a[l]])instanceof t){a.splice(0,l+1);var u=a.join(".");s.set(u,i);continue t}r=a[a.length-1]}var h=s[r];t.isUndef(h)||(t.Signal&&h instanceof t.Signal||t.Param&&h instanceof t.Param?h.value!==i&&(t.isUndef(n)?h.value=i:h.rampTo(i,n)):h instanceof AudioParam?h.value!==i&&(h.value=i):t.TimeBase&&h instanceof t.TimeBase?s[r]=i:h instanceof t?h.set(i):h!==i&&(s[r]=i))}return this},t.prototype.get=function(e){t.isUndef(e)?e=this._collectDefaults(this.constructor):t.isString(e)&&(e=[e]);for(var i={},n=0;n<e.length;n++){var o=e[n],r=this,s=i;if(-1!==o.indexOf(".")){for(var a=o.split("."),l=0;l<a.length-1;l++){var u=a[l];s[u]=s[u]||{},s=s[u],r=r[u]}o=a[a.length-1]}var h=r[o];t.isObject(e[o])?s[o]=h.get():t.Signal&&h instanceof t.Signal?s[o]=h.value:t.Param&&h instanceof t.Param?s[o]=h.value:h instanceof AudioParam?s[o]=h.value:h instanceof t?s[o]=h.get():!t.isFunction(h)&&t.isDefined(h)&&(s[o]=h)}return i},t.prototype._collectDefaults=function(e){var i=[];if(t.isDefined(e.defaults)&&(i=Object.keys(e.defaults)),t.isDefined(e._super))for(var n=this._collectDefaults(e._super),o=0;o<n.length;o++)-1===i.indexOf(n[o])&&i.push(n[o]);return i},t.defaults=function(e,i,n){var o={};if(1===e.length&&t.isObject(e[0]))o=e[0];else for(var r=0;r<i.length;r++)o[i[r]]=e[r];return t.isDefined(n.defaults)?t.defaultArg(o,n.defaults):t.isObject(n)?t.defaultArg(o,n):o},t.defaultArg=function(e,i){if(t.isObject(e)&&t.isObject(i)){var n={};for(var o in e)n[o]=t.defaultArg(i[o],e[o]);for(var r in i)n[r]=t.defaultArg(e[r],i[r]);return n}return t.isUndef(e)?i:e},t.connectSeries=function(){for(var e=arguments[0],i=1;i<arguments.length;i++){var n=arguments[i];e.connect(n),e=n}return t},t.isUndef=function(t){return"undefined"===typeof t},t.isDefined=function(e){return!t.isUndef(e)},t.isFunction=function(t){return"function"===typeof t},t.isNumber=function(t){return"number"===typeof t},t.isObject=function(t){return"[object Object]"===Object.prototype.toString.call(t)&&t.constructor===Object},t.isBoolean=function(t){return"boolean"===typeof t},t.isArray=function(t){return Array.isArray(t)},t.isString=function(t){return"string"===typeof t},t.isNote=function(e){return t.isString(e)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(e)},t.noOp=function(){},t.prototype._readOnly=function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)this._readOnly(t[e]);else Object.defineProperty(this,t,{writable:!1,enumerable:!0})},t.prototype._writable=function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)this._writable(t[e]);else Object.defineProperty(this,t,{writable:!0})},t.State={Started:"started",Stopped:"stopped",Paused:"paused"},t.equalPowerScale=function(t){var e=.5*Math.PI;return Math.sin(t*e)},t.dbToGain=function(t){return Math.pow(10,t/20)},t.gainToDb=function(t){return Math.log(t)/Math.LN10*20},t.intervalToFrequencyRatio=function(t){return Math.pow(2,t/12)},t.prototype.now=function(){return t.context.now()},t.now=function(){return t.context.now()},t.extend=function(e,i){function n(){}t.isUndef(i)&&(i=t),n.prototype=i.prototype,e.prototype=new n,e.prototype.constructor=e,e._super=i};var e=null;return Object.defineProperty(t,"context",{get:function(){return e},set:function(i){e=t.Context&&i instanceof t.Context?i:new t.Context(i),t.Context.emit("init",e)}}),Object.defineProperty(t.prototype,"context",{get:function(){return t.context}}),t.setContext=function(e){t.context=e},Object.defineProperty(t.prototype,"blockTime",{get:function(){return 128/this.context.sampleRate}}),Object.defineProperty(t.prototype,"sampleTime",{get:function(){return 1/this.context.sampleRate}}),Object.defineProperty(t,"supported",{get:function(){var t=window.hasOwnProperty("AudioContext")||window.hasOwnProperty("webkitAudioContext"),e=window.hasOwnProperty("Promise"),i=window.hasOwnProperty("Worker");return t&&e&&i}}),Object.defineProperty(t,"initialized",{get:function(){return null!==e}}),t.getContext=function(e){return t.initialized?e(t.context):t.Context.on("init",function i(){e(t.context),t.Context.off("init",i)}),t},t.version="r12",t},t=e(),i(function(t){return t.Emitter=function(){t.call(this),this._events={}},t.extend(t.Emitter),t.Emitter.prototype.on=function(t,e){for(var i=t.split(/\W+/),n=0;n<i.length;n++){var o=i[n];this._events.hasOwnProperty(o)||(this._events[o]=[]),this._events[o].push(e)}return this},t.Emitter.prototype.once=function(t,e){var i=function(){e.apply(this,arguments),this.off(t,i)}.bind(this);return this.on(t,i),this},t.Emitter.prototype.off=function(e,i){for(var n=e.split(/\W+/),o=0;o<n.length;o++)if(e=n[o],this._events.hasOwnProperty(e))if(t.isUndef(i))this._events[e]=[];else for(var r=this._events[e],s=0;s<r.length;s++)r[s]===i&&r.splice(s,1);return this},t.Emitter.prototype.emit=function(t){if(this._events){var e=Array.apply(null,arguments).slice(1);if(this._events.hasOwnProperty(t))for(var i=this._events[t].slice(0),n=0,o=i.length;n<o;n++)i[n].apply(this,e)}return this},t.Emitter.mixin=function(e){var i=["on","once","off","emit"];e._events={};for(var n=0;n<i.length;n++){var o=i[n],r=t.Emitter.prototype[o];e[o]=r}return t.Emitter},t.Emitter.prototype.dispose=function(){return t.prototype.dispose.call(this),this._events=null,this},t.Emitter}),i(function(t){return t.Timeline=function(){var e=t.defaults(arguments,["memory"],t.Timeline);t.call(this),this._timeline=[],this.memory=e.memory},t.extend(t.Timeline),t.Timeline.defaults={memory:1/0},Object.defineProperty(t.Timeline.prototype,"length",{get:function(){return this._timeline.length}}),t.Timeline.prototype.add=function(e){if(t.isUndef(e.time))throw new Error("Tone.Timeline: events must have a time attribute");e.time=e.time.valueOf();var i=this._search(e.time);if(this._timeline.splice(i+1,0,e),this.length>this.memory){var n=this.length-this.memory;this._timeline.splice(0,n)}return this},t.Timeline.prototype.remove=function(t){var e=this._timeline.indexOf(t);return-1!==e&&this._timeline.splice(e,1),this},t.Timeline.prototype.get=function(e,i){i=t.defaultArg(i,"time");var n=this._search(e,i);return-1!==n?this._timeline[n]:null},t.Timeline.prototype.peek=function(){return this._timeline[0]},t.Timeline.prototype.shift=function(){return this._timeline.shift()},t.Timeline.prototype.getAfter=function(e,i){i=t.defaultArg(i,"time");var n=this._search(e,i);return n+1<this._timeline.length?this._timeline[n+1]:null},t.Timeline.prototype.getBefore=function(e,i){i=t.defaultArg(i,"time");var n=this._timeline.length;if(n>0&&this._timeline[n-1][i]<e)return this._timeline[n-1];var o=this._search(e,i);return o-1>=0?this._timeline[o-1]:null},t.Timeline.prototype.cancel=function(t){if(this._timeline.length>1){var e=this._search(t);if(e>=0)if(this._timeline[e].time===t){for(var i=e;i>=0&&this._timeline[i].time===t;i--)e=i;this._timeline=this._timeline.slice(0,e)}else this._timeline=this._timeline.slice(0,e+1);else this._timeline=[]}else 1===this._timeline.length&&this._timeline[0].time>=t&&(this._timeline=[]);return this},t.Timeline.prototype.cancelBefore=function(t){var e=this._search(t);return e>=0&&(this._timeline=this._timeline.slice(e+1)),this},t.Timeline.prototype.previousEvent=function(t){var e=this._timeline.indexOf(t);return e>0?this._timeline[e-1]:null},t.Timeline.prototype._search=function(e,i){if(0===this._timeline.length)return-1;i=t.defaultArg(i,"time");var n=0,o=this._timeline.length,r=o;if(o>0&&this._timeline[o-1][i]<=e)return o-1;for(;n<r;){var s=Math.floor(n+(r-n)/2),a=this._timeline[s],l=this._timeline[s+1];if(a[i]===e){for(var u=s;u<this._timeline.length;u++)this._timeline[u][i]===e&&(s=u);return s}if(a[i]<e&&l[i]>e)return s;a[i]>e?r=s:n=s+1}return-1},t.Timeline.prototype._iterate=function(e,i,n){i=t.defaultArg(i,0),n=t.defaultArg(n,this._timeline.length-1),this._timeline.slice(i,n+1).forEach(function(t){e.call(this,t)}.bind(this))},t.Timeline.prototype.forEach=function(t){return this._iterate(t),this},t.Timeline.prototype.forEachBefore=function(t,e){var i=this._search(t);return-1!==i&&this._iterate(e,0,i),this},t.Timeline.prototype.forEachAfter=function(t,e){var i=this._search(t);return this._iterate(e,i+1),this},t.Timeline.prototype.forEachBetween=function(t,e,i){var n=this._search(t),o=this._search(e);return-1!==n&&-1!==o?(this._timeline[n].time!==t&&(n+=1),this._timeline[o].time===e&&(o-=1),this._iterate(i,n,o)):-1===n&&this._iterate(i,0,o),this},t.Timeline.prototype.forEachFrom=function(t,e){for(var i=this._search(t);i>=0&&this._timeline[i].time>=t;)i--;return this._iterate(e,i+1),this},t.Timeline.prototype.forEachAtTime=function(t,e){var i=this._search(t);return-1!==i&&this._iterate(function(i){i.time===t&&e.call(this,i)},0,i),this},t.Timeline.prototype.dispose=function(){return t.prototype.dispose.call(this),this._timeline=null,this},t.Timeline}),i(function(t){t.supported&&(!window.hasOwnProperty("OfflineAudioContext")&&window.hasOwnProperty("webkitOfflineAudioContext")&&(window.OfflineAudioContext=window.webkitOfflineAudioContext),new OfflineAudioContext(1,1,44100).startRendering()instanceof Promise||(OfflineAudioContext.prototype._native_startRendering=OfflineAudioContext.prototype.startRendering,OfflineAudioContext.prototype.startRendering=function(){return new Promise(function(t){this.oncomplete=function(e){t(e.renderedBuffer)},this._native_startRendering()}.bind(this))}))}),i(function(t){if(t.supported){!window.hasOwnProperty("AudioContext")&&window.hasOwnProperty("webkitAudioContext")&&(window.AudioContext=window.webkitAudioContext),AudioContext.prototype.close||(AudioContext.prototype.close=function(){return t.isFunction(this.suspend)&&this.suspend(),Promise.resolve()}),AudioContext.prototype.resume||(AudioContext.prototype.resume=function(){return Promise.resolve()}),!AudioContext.prototype.createGain&&AudioContext.prototype.createGainNode&&(AudioContext.prototype.createGain=AudioContext.prototype.createGainNode),!AudioContext.prototype.createDelay&&AudioContext.prototype.createDelayNode&&(AudioContext.prototype.createDelay=AudioContext.prototype.createDelayNode);var e=!1,i=new OfflineAudioContext(1,1,44100),n=new Uint32Array([1179011410,48,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,8,0,0,0,0]).buffer;try{i.decodeAudioData(n)instanceof Promise&&(e=!0)}catch(o){e=!1}e||(AudioContext.prototype._native_decodeAudioData=AudioContext.prototype.decodeAudioData,AudioContext.prototype.decodeAudioData=function(t){return new Promise(function(e,i){this._native_decodeAudioData(t,e,i)}.bind(this))})}}),i(function(t){t.Context=function(){t.Emitter.call(this);var i=t.defaults(arguments,["context"],t.Context);if(!i.context&&(i.context=new window.AudioContext,!i.context))throw new Error("could not create AudioContext. Possibly too many AudioContexts running already.");for(var n in this._context=i.context,this._context)this._defineProperty(this._context,n);this._latencyHint=i.latencyHint,this._constants={},this.lookAhead=i.lookAhead,this._computedUpdateInterval=0,this._ticker=new e(this.emit.bind(this,"tick"),i.clockSource,i.updateInterval),this._timeouts=new t.Timeline,this._timeoutIds=0,this.on("tick",this._timeoutLoop.bind(this))},t.extend(t.Context,t.Emitter),t.Emitter.mixin(t.Context),t.Context.defaults={clockSource:"worker",latencyHint:"interactive",lookAhead:.1,updateInterval:.03},t.Context.prototype._defineProperty=function(e,i){t.isUndef(this[i])&&Object.defineProperty(this,i,{get:function(){return"function"===typeof e[i]?e[i].bind(e):e[i]},set:function(t){e[i]=t}})},t.Context.prototype.now=function(){return this._context.currentTime+this.lookAhead},t.Context.prototype.ready=function(){return new Promise(function(t){"running"===this._context.state?t():this._context.resume().then(function(){t()})}.bind(this))},t.Context.prototype.close=function(){return this._context.close().then(function(){t.Context.emit("close",this)}.bind(this))},t.Context.prototype.getConstant=function(t){if(this._constants[t])return this._constants[t];for(var e=this._context.createBuffer(1,128,this._context.sampleRate),i=e.getChannelData(0),n=0;n<i.length;n++)i[n]=t;var o=this._context.createBufferSource();return o.channelCount=1,o.channelCountMode="explicit",o.buffer=e,o.loop=!0,o.start(0),this._constants[t]=o,o},t.Context.prototype._timeoutLoop=function(){for(var t=this.now();this._timeouts&&this._timeouts.length&&this._timeouts.peek().time<=t;)this._timeouts.shift().callback()},t.Context.prototype.setTimeout=function(t,e){this._timeoutIds++;var i=this.now();return this._timeouts.add({callback:t,time:i+e,id:this._timeoutIds}),this._timeoutIds},t.Context.prototype.clearTimeout=function(t){return this._timeouts.forEach(function(e){e.id===t&&this.remove(e)}),this},Object.defineProperty(t.Context.prototype,"updateInterval",{get:function(){return this._ticker.updateInterval},set:function(t){this._ticker.updateInterval=t}}),Object.defineProperty(t.Context.prototype,"clockSource",{get:function(){return this._ticker.type},set:function(t){this._ticker.type=t}}),Object.defineProperty(t.Context.prototype,"latencyHint",{get:function(){return this._latencyHint},set:function(e){var i=e;if(this._latencyHint=e,t.isString(e))switch(e){case"interactive":i=.1,this._context.latencyHint=e;break;case"playback":i=.8,this._context.latencyHint=e;break;case"balanced":i=.25,this._context.latencyHint=e;break;case"fastest":this._context.latencyHint="interactive",i=.01}this.lookAhead=i,this.updateInterval=i/3}}),t.Context.prototype.dispose=function(){return this.close().then(function(){for(var e in t.Emitter.prototype.dispose.call(this),this._ticker.dispose(),this._ticker=null,this._timeouts.dispose(),this._timeouts=null,this._constants)this._constants[e].disconnect();this._constants=null}.bind(this))};var e=function(e,i,n){this._type=i,this._updateInterval=n,this._callback=t.defaultArg(e,t.noOp),this._createClock()};return e.Type={Worker:"worker",Timeout:"timeout",Offline:"offline"},e.prototype._createWorker=function(){window.URL=window.URL||window.webkitURL;var t=new Blob(["var timeoutTime = "+(1e3*this._updateInterval).toFixed(1)+";self.onmessage = function(msg){\ttimeoutTime = parseInt(msg.data);};function tick(){\tsetTimeout(tick, timeoutTime);\tself.postMessage('tick');}tick();"]),e=URL.createObjectURL(t),i=new Worker(e);i.onmessage=this._callback.bind(this),this._worker=i},e.prototype._createTimeout=function(){this._timeout=setTimeout(function(){this._createTimeout(),this._callback()}.bind(this),1e3*this._updateInterval)},e.prototype._createClock=function(){if(this._type===e.Type.Worker)try{this._createWorker()}catch(t){this._type=e.Type.Timeout,this._createClock()}else this._type===e.Type.Timeout&&this._createTimeout()},Object.defineProperty(e.prototype,"updateInterval",{get:function(){return this._updateInterval},set:function(t){this._updateInterval=Math.max(t,128/44100),this._type===e.Type.Worker&&this._worker.postMessage(Math.max(1e3*t,1))}}),Object.defineProperty(e.prototype,"type",{get:function(){return this._type},set:function(t){this._disposeClock(),this._type=t,this._createClock()}}),e.prototype._disposeClock=function(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null),this._worker&&(this._worker.terminate(),this._worker.onmessage=null,this._worker=null)},e.prototype.dispose=function(){this._disposeClock(),this._callback=null},t.getContext(function(){var e=AudioNode.prototype.connect,i=AudioNode.prototype.disconnect;function n(i,n,o){if(i.input)return o=t.defaultArg(o,0),t.isArray(i.input)?this.connect(i.input[o]):this.connect(i.input,n,o);try{return i instanceof AudioNode?(e.call(this,i,n,o),i):(e.call(this,i,n),i)}catch(r){throw new Error("error connecting to node: "+i+"\n"+r)}}AudioNode.prototype.connect!==n&&(AudioNode.prototype.connect=n,AudioNode.prototype.disconnect=function(e,n,o){if(e&&e.input&&t.isArray(e.input))o=t.defaultArg(o,0),this.disconnect(e.input[o],n,0);else if(e&&e.input)this.disconnect(e.input,n,o);else try{i.apply(this,arguments)}catch(r){throw new Error("error disconnecting node: "+e+"\n"+r)}})}),t.supported&&!t.initialized?(t.context=new t.Context,window.TONE_SILENCE_VERSION_LOGGING||console.log("%c * Tone.js "+t.version+" * ","background: #000; color: #fff")):t.supported||console.warn("This browser does not support Tone.js"),t.Context}),i(function(t){return t.AudioNode=function(){t.call(this);var e=t.defaults(arguments,["context"],{context:t.context});this._context=e.context},t.extend(t.AudioNode),Object.defineProperty(t.AudioNode.prototype,"context",{get:function(){return this._context}}),t.AudioNode.prototype.createInsOuts=function(t,e){1===t?this.input=this.context.createGain():t>1&&(this.input=new Array(t)),1===e?this.output=this.context.createGain():e>1&&(this.output=new Array(e))},Object.defineProperty(t.AudioNode.prototype,"channelCount",{get:function(){return this.output.channelCount},set:function(t){return this.output.channelCount=t}}),Object.defineProperty(t.AudioNode.prototype,"channelCountMode",{get:function(){return this.output.channelCountMode},set:function(t){return this.output.channelCountMode=t}}),Object.defineProperty(t.AudioNode.prototype,"channelInterpretation",{get:function(){return this.output.channelInterpretation},set:function(t){return this.output.channelInterpretation=t}}),Object.defineProperty(t.AudioNode.prototype,"numberOfInputs",{get:function(){return this.input?t.isArray(this.input)?this.input.length:1:0}}),Object.defineProperty(t.AudioNode.prototype,"numberOfOutputs",{get:function(){return this.output?t.isArray(this.output)?this.output.length:1:0}}),t.AudioNode.prototype._onConnect=function(){},t.AudioNode.prototype.connect=function(e,i,n){return e._onConnect&&e._onConnect(this),t.isArray(this.output)?(i=t.defaultArg(i,0),this.output[i].connect(e,0,n)):this.output.connect(e,i,n),this},t.AudioNode.prototype.disconnect=function(e,i,n){t.isArray(this.output)?t.isNumber(e)?this.output[e].disconnect():(i=t.defaultArg(i,0),this.output[i].disconnect(e,0,n)):this.output.disconnect.apply(this.output,arguments)},t.AudioNode.prototype.chain=function(){for(var t=this,e=0;e<arguments.length;e++){var i=arguments[e];t.connect(i),t=i}return this},t.AudioNode.prototype.fan=function(){for(var t=0;t<arguments.length;t++)this.connect(arguments[t]);return this},window.AudioNode&&(AudioNode.prototype.chain=t.AudioNode.prototype.chain,AudioNode.prototype.fan=t.AudioNode.prototype.fan),t.AudioNode.prototype.dispose=function(){return t.isDefined(this.input)&&(this.input instanceof AudioNode&&this.input.disconnect(),this.input=null),t.isDefined(this.output)&&(this.output instanceof AudioNode&&this.output.disconnect(),this.output=null),this._context=null,this},t.AudioNode}),i(function(t){return t.SignalBase=function(){t.AudioNode.call(this)},t.extend(t.SignalBase,t.AudioNode),t.SignalBase.prototype.connect=function(e,i,n){return t.Signal&&t.Signal===e.constructor||t.Param&&t.Param===e.constructor?(e._param.cancelScheduledValues(0),e._param.value=0,e.overridden=!0):e instanceof AudioParam&&(e.cancelScheduledValues(0),e.value=0),t.AudioNode.prototype.connect.call(this,e,i,n),this},t.SignalBase}),i(function(t){if(t.supported){var e=navigator.userAgent.toLowerCase();if(e.includes("safari")&&!e.includes("chrome")){var i=function(t){for(var e in this._internalNode=this.input=this.output=t._native_createWaveShaper(),this._curve=null,this._internalNode)this._defineProperty(this._internalNode,e)};Object.defineProperty(i.prototype,"curve",{get:function(){return this._curve},set:function(t){this._curve=t;var e=new Float32Array(t.length+1);e.set(t,1),e[0]=t[0],this._internalNode.curve=e}}),i.prototype._defineProperty=function(e,i){t.isUndef(this[i])&&Object.defineProperty(this,i,{get:function(){return"function"===typeof e[i]?e[i].bind(e):e[i]},set:function(t){e[i]=t}})},AudioContext.prototype._native_createWaveShaper=AudioContext.prototype.createWaveShaper,AudioContext.prototype.createWaveShaper=function(){return new i(this)}}}}),i(function(t){return t.WaveShaper=function(e,i){t.SignalBase.call(this),this._shaper=this.input=this.output=this.context.createWaveShaper(),this._curve=null,Array.isArray(e)?this.curve=e:isFinite(e)||t.isUndef(e)?this._curve=new Float32Array(t.defaultArg(e,1024)):t.isFunction(e)&&(this._curve=new Float32Array(t.defaultArg(i,1024)),this.setMap(e))},t.extend(t.WaveShaper,t.SignalBase),t.WaveShaper.prototype.setMap=function(t){for(var e=new Array(this._curve.length),i=0,n=this._curve.length;i<n;i++){var o=i/(n-1)*2-1;e[i]=t(o,i)}return this.curve=e,this},Object.defineProperty(t.WaveShaper.prototype,"curve",{get:function(){return this._shaper.curve},set:function(t){this._curve=new Float32Array(t),this._shaper.curve=this._curve}}),Object.defineProperty(t.WaveShaper.prototype,"oversample",{get:function(){return this._shaper.oversample},set:function(t){if(!["none","2x","4x"].includes(t))throw new RangeError("Tone.WaveShaper: oversampling must be either 'none', '2x', or '4x'");this._shaper.oversample=t}}),t.WaveShaper.prototype.dispose=function(){return t.SignalBase.prototype.dispose.call(this),this._shaper.disconnect(),this._shaper=null,this._curve=null,this},t.WaveShaper}),i(function(t){return t.TimeBase=function(e,i){if(!(this instanceof t.TimeBase))return new t.TimeBase(e,i);if(this._val=e,this._units=i,t.isUndef(this._units)&&t.isString(this._val)&&parseFloat(this._val)==this._val&&"+"!==this._val.charAt(0))this._val=parseFloat(this._val),this._units=this._defaultUnits;else if(e&&e.constructor===this.constructor)this._val=e._val,this._units=e._units;else if(e instanceof t.TimeBase)switch(this._defaultUnits){case"s":this._val=e.toSeconds();break;case"i":this._val=e.toTicks();break;case"hz":this._val=e.toFrequency();break;case"midi":this._val=e.toMidi();break;default:throw new Error("Unrecognized default units "+this._defaultUnits)}},t.extend(t.TimeBase),t.TimeBase.prototype._expressions={n:{regexp:/^(\d+)n(\.?)$/i,method:function(t,e){var i="."===e?1.5:1;return 1===(t=parseInt(t))?this._beatsToUnits(this._getTimeSignature())*i:this._beatsToUnits(4/t)*i}},t:{regexp:/^(\d+)t$/i,method:function(t){return t=parseInt(t),this._beatsToUnits(8/(3*parseInt(t)))}},m:{regexp:/^(\d+)m$/i,method:function(t){return this._beatsToUnits(parseInt(t)*this._getTimeSignature())}},i:{regexp:/^(\d+)i$/i,method:function(t){return this._ticksToUnits(parseInt(t))}},hz:{regexp:/^(\d+(?:\.\d+)?)hz$/i,method:function(t){return this._frequencyToUnits(parseFloat(t))}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/,method:function(t,e,i){var n=0;return t&&"0"!==t&&(n+=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(n+=this._beatsToUnits(parseFloat(e))),i&&"0"!==i&&(n+=this._beatsToUnits(parseFloat(i)/4)),n}},s:{regexp:/^(\d+(?:\.\d+)?)s$/,method:function(t){return this._secondsToUnits(parseFloat(t))}},samples:{regexp:/^(\d+)samples$/,method:function(t){return parseInt(t)/this.context.sampleRate}},default:{regexp:/^(\d+(?:\.\d+)?)$/,method:function(t){return this._expressions[this._defaultUnits].method.call(this,t)}}},t.TimeBase.prototype._defaultUnits="s",t.TimeBase.prototype._getBpm=function(){return t.Transport?t.Transport.bpm.value:120},t.TimeBase.prototype._getTimeSignature=function(){return t.Transport?t.Transport.timeSignature:4},t.TimeBase.prototype._getPPQ=function(){return t.Transport?t.Transport.PPQ:192},t.TimeBase.prototype._now=function(){return this.now()},t.TimeBase.prototype._frequencyToUnits=function(t){return 1/t},t.TimeBase.prototype._beatsToUnits=function(t){return 60/this._getBpm()*t},t.TimeBase.prototype._secondsToUnits=function(t){return t},t.TimeBase.prototype._ticksToUnits=function(t){return t*(this._beatsToUnits(1)/this._getPPQ())},t.TimeBase.prototype._noArg=function(){return this._now()},t.TimeBase.prototype.valueOf=function(){if(t.isUndef(this._val))return this._noArg();if(t.isString(this._val)&&t.isUndef(this._units))for(var e in this._expressions)if(this._expressions[e].regexp.test(this._val.trim())){this._units=e;break}if(t.isDefined(this._units)){var i=this._expressions[this._units],n=this._val.toString().trim().match(i.regexp);return n?i.method.apply(this,n.slice(1)):i.method.call(this,parseFloat(this._val))}return this._val},t.TimeBase.prototype.toSeconds=function(){return this.valueOf()},t.TimeBase.prototype.toFrequency=function(){return 1/this.toSeconds()},t.TimeBase.prototype.toSamples=function(){return this.toSeconds()*this.context.sampleRate},t.TimeBase.prototype.toMilliseconds=function(){return 1e3*this.toSeconds()},t.TimeBase.prototype.dispose=function(){this._val=null,this._units=null},t.TimeBase}),i(function(t){t.Frequency=function(e,i){if(!(this instanceof t.Frequency))return new t.Frequency(e,i);t.TimeBase.call(this,e,i)},t.extend(t.Frequency,t.TimeBase),t.Frequency.prototype._expressions=Object.assign({},t.TimeBase.prototype._expressions,{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method:function(e){return"midi"===this._defaultUnits?e:t.Frequency.mtof(e)}},note:{regexp:/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i,method:function(i,n){var o=e[i.toLowerCase()]+12*(parseInt(n)+1);return"midi"===this._defaultUnits?o:t.Frequency.mtof(o)}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method:function(t,e,i){var n=1;return t&&"0"!==t&&(n*=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(n*=this._beatsToUnits(parseFloat(e))),i&&"0"!==i&&(n*=this._beatsToUnits(parseFloat(i)/4)),n}}}),t.Frequency.prototype.transpose=function(e){return new this.constructor(this.valueOf()*t.intervalToFrequencyRatio(e))},t.Frequency.prototype.harmonize=function(t){return t.map(function(t){return this.transpose(t)}.bind(this))},t.Frequency.prototype.toMidi=function(){return t.Frequency.ftom(this.valueOf())},t.Frequency.prototype.toNote=function(){var e=this.toFrequency(),n=Math.log2(e/t.Frequency.A4),o=Math.round(12*n)+57,r=Math.floor(o/12);return r<0&&(o+=-12*r),i[o%12]+r.toString()},t.Frequency.prototype.toSeconds=function(){return 1/t.TimeBase.prototype.toSeconds.call(this)},t.Frequency.prototype.toFrequency=function(){return t.TimeBase.prototype.toFrequency.call(this)},t.Frequency.prototype.toTicks=function(){var e=this._beatsToUnits(1),i=this.valueOf()/e;return Math.floor(i*t.Transport.PPQ)},t.Frequency.prototype._noArg=function(){return 0},t.Frequency.prototype._frequencyToUnits=function(t){return t},t.Frequency.prototype._ticksToUnits=function(e){return 1/(60*e/(t.Transport.bpm.value*t.Transport.PPQ))},t.Frequency.prototype._beatsToUnits=function(e){return 1/t.TimeBase.prototype._beatsToUnits.call(this,e)},t.Frequency.prototype._secondsToUnits=function(t){return 1/t},t.Frequency.prototype._defaultUnits="hz";var e={cbb:-2,cb:-1,c:0,"c#":1,cx:2,dbb:0,db:1,d:2,"d#":3,dx:4,ebb:2,eb:3,e:4,"e#":5,ex:6,fbb:3,fb:4,f:5,"f#":6,fx:7,gbb:5,gb:6,g:7,"g#":8,gx:9,abb:7,ab:8,a:9,"a#":10,ax:11,bbb:9,bb:10,b:11,"b#":12,bx:13},i=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];return t.Frequency.A4=440,t.Frequency.mtof=function(e){return t.Frequency.A4*Math.pow(2,(e-69)/12)},t.Frequency.ftom=function(e){return 69+Math.round(12*Math.log2(e/t.Frequency.A4))},t.Frequency}),i(function(t){return t.Time=function(e,i){if(!(this instanceof t.Time))return new t.Time(e,i);t.TimeBase.call(this,e,i)},t.extend(t.Time,t.TimeBase),t.Time.prototype._expressions=Object.assign({},t.TimeBase.prototype._expressions,{quantize:{regexp:/^@(.+)/,method:function(e){if(t.Transport){var i=new this.constructor(e);return t.Transport.nextSubdivision(i)}return 0}},now:{regexp:/^\+(.+)/,method:function(t){return this._now()+new this.constructor(t)}}}),t.Time.prototype.quantize=function(e,i){i=t.defaultArg(i,1);var n=new this.constructor(e),o=this.valueOf();return o+(Math.round(o/n)*n-o)*i},t.Time.prototype.toNotation=function(){for(var e=this.toSeconds(),i=["1m"],n=1;n<8;n++){var o=Math.pow(2,n);i.push(o+"n."),i.push(o+"n"),i.push(o+"t")}i.push("0");var r=i[0],s=t.Time(i[0]).toSeconds();return i.forEach(function(i){var n=t.Time(i).toSeconds();Math.abs(n-e)<Math.abs(s-e)&&(r=i,s=n)}),r},t.Time.prototype.toBarsBeatsSixteenths=function(){var t=this._beatsToUnits(1),e=this.valueOf()/t,i=Math.floor(e/this._getTimeSignature()),n=e%1*4;return e=Math.floor(e)%this._getTimeSignature(),(n=n.toString()).length>3&&(n=parseFloat(parseFloat(n).toFixed(3))),[i,e,n].join(":")},t.Time.prototype.toTicks=function(){var t=this._beatsToUnits(1),e=this.valueOf()/t;return Math.round(e*this._getPPQ())},t.Time.prototype.toSeconds=function(){return this.valueOf()},t.Time.prototype.toMidi=function(){return t.Frequency.ftom(this.toFrequency())},t.Time}),i(function(t){return t.TransportTime=function(e,i){if(!(this instanceof t.TransportTime))return new t.TransportTime(e,i);t.Time.call(this,e,i)},t.extend(t.TransportTime,t.Time),t.TransportTime.prototype._now=function(){return t.Transport.seconds},t.TransportTime}),i(function(t){return t.Type={Default:"number",Time:"time",Frequency:"frequency",TransportTime:"transportTime",Ticks:"ticks",NormalRange:"normalRange",AudioRange:"audioRange",Decibels:"db",Interval:"interval",BPM:"bpm",Positive:"positive",Gain:"gain",Cents:"cents",Degrees:"degrees",MIDI:"midi",BarsBeatsSixteenths:"barsBeatsSixteenths",Samples:"samples",Hertz:"hertz",Note:"note",Milliseconds:"milliseconds",Seconds:"seconds",Notation:"notation"},t.prototype.toSeconds=function(e){return t.isNumber(e)?e:t.isUndef(e)?this.now():t.isString(e)?new t.Time(e).toSeconds():e instanceof t.TimeBase?e.toSeconds():void 0},t.prototype.toFrequency=function(e){return t.isNumber(e)?e:t.isString(e)||t.isUndef(e)?new t.Frequency(e).valueOf():e instanceof t.TimeBase?e.toFrequency():void 0},t.prototype.toTicks=function(e){return t.isNumber(e)||t.isString(e)?new t.TransportTime(e).toTicks():t.isUndef(e)?t.Transport.ticks:e instanceof t.TimeBase?e.toTicks():void 0},t}),i(function(t){return t.Param=function(){var e=t.defaults(arguments,["param","units","convert"],t.Param);t.AudioNode.call(this),this._param=this.input=e.param,this.units=e.units,this.convert=e.convert,this.overridden=!1,this._events=new t.Timeline(1e3),t.isDefined(e.value)&&this._param&&(this.value=e.value)},t.extend(t.Param,t.AudioNode),t.Param.defaults={units:t.Type.Default,convert:!0,param:void 0},Object.defineProperty(t.Param.prototype,"value",{get:function(){var t=this.now();return this._toUnits(this.getValueAtTime(t))},set:function(t){this._initialValue=this._fromUnits(t),this.cancelScheduledValues(this.context.currentTime),this.setValueAtTime(t,this.context.currentTime)}}),Object.defineProperty(t.Param.prototype,"minValue",{get:function(){return this.units===t.Type.Time||this.units===t.Type.Frequency||this.units===t.Type.NormalRange||this.units===t.Type.Positive||this.units===t.Type.BPM?0:this.units===t.Type.AudioRange?-1:this.units===t.Type.Decibels?-1/0:this._param.minValue}}),Object.defineProperty(t.Param.prototype,"maxValue",{get:function(){return this.units===t.Type.NormalRange||this.units===t.Type.AudioRange?1:this._param.maxValue}}),t.Param.prototype._fromUnits=function(e){if(!this.convert&&!t.isUndef(this.convert)||this.overridden)return e;switch(this.units){case t.Type.Time:return this.toSeconds(e);case t.Type.Frequency:return this.toFrequency(e);case t.Type.Decibels:return t.dbToGain(e);case t.Type.NormalRange:return Math.min(Math.max(e,0),1);case t.Type.AudioRange:return Math.min(Math.max(e,-1),1);case t.Type.Positive:return Math.max(e,0);default:return e}},t.Param.prototype._toUnits=function(e){if(!this.convert&&!t.isUndef(this.convert))return e;switch(this.units){case t.Type.Decibels:return t.gainToDb(e);default:return e}},t.Param.prototype._minOutput=1e-5,t.Param.AutomationType={Linear:"linearRampToValueAtTime",Exponential:"exponentialRampToValueAtTime",Target:"setTargetAtTime",SetValue:"setValueAtTime"},t.Param.prototype.setValueAtTime=function(e,i){return i=this.toSeconds(i),e=this._fromUnits(e),this._events.add({type:t.Param.AutomationType.SetValue,value:e,time:i}),this._param.setValueAtTime(e,i),this},t.Param.prototype.getValueAtTime=function(e){e=this.toSeconds(e);var i=this._events.getAfter(e),n=this._events.get(e),o=t.defaultArg(this._initialValue,this._param.defaultValue),r=o;if(null===n)r=o;else if(n.type===t.Param.AutomationType.Target){var s,a=this._events.getBefore(n.time);s=null===a?o:a.value,r=this._exponentialApproach(n.time,s,n.value,n.constant,e)}else r=null===i?n.value:i.type===t.Param.AutomationType.Linear?this._linearInterpolate(n.time,n.value,i.time,i.value,e):i.type===t.Param.AutomationType.Exponential?this._exponentialInterpolate(n.time,n.value,i.time,i.value,e):n.value;return r},t.Param.prototype.setRampPoint=function(t){t=this.toSeconds(t);var e=this.getValueAtTime(t);return this.cancelAndHoldAtTime(t),0===e&&(e=this._minOutput),this.setValueAtTime(this._toUnits(e),t),this},t.Param.prototype.linearRampToValueAtTime=function(e,i){return e=this._fromUnits(e),i=this.toSeconds(i),this._events.add({type:t.Param.AutomationType.Linear,value:e,time:i}),this._param.linearRampToValueAtTime(e,i),this},t.Param.prototype.exponentialRampToValueAtTime=function(e,i){return e=this._fromUnits(e),e=Math.max(this._minOutput,e),i=this.toSeconds(i),this._events.add({type:t.Param.AutomationType.Exponential,time:i,value:e}),this._param.exponentialRampToValueAtTime(e,i),this},t.Param.prototype.exponentialRampTo=function(t,e,i){return i=this.toSeconds(i),this.setRampPoint(i),this.exponentialRampToValueAtTime(t,i+this.toSeconds(e)),this},t.Param.prototype.linearRampTo=function(t,e,i){return i=this.toSeconds(i),this.setRampPoint(i),this.linearRampToValueAtTime(t,i+this.toSeconds(e)),this},t.Param.prototype.targetRampTo=function(t,e,i){return i=this.toSeconds(i),this.setRampPoint(i),this.exponentialApproachValueAtTime(t,i,e),this},t.Param.prototype.exponentialApproachValueAtTime=function(t,e,i){var n=Math.log(this.toSeconds(i)+1)/Math.log(200);return e=this.toSeconds(e),this.setTargetAtTime(t,e,n)},t.Param.prototype.setTargetAtTime=function(e,i,n){if(e=this._fromUnits(e),n<=0)throw new Error("timeConstant must be greater than 0");return i=this.toSeconds(i),this._events.add({type:t.Param.AutomationType.Target,value:e,time:i,constant:n}),this._param.setTargetAtTime(e,i,n),this},t.Param.prototype.setValueCurveAtTime=function(e,i,n,o){o=t.defaultArg(o,1),n=this.toSeconds(n),i=this.toSeconds(i),this.setValueAtTime(e[0]*o,i);for(var r=n/(e.length-1),s=1;s<e.length;s++)this.linearRampToValueAtTime(e[s]*o,i+s*r);return this},t.Param.prototype.cancelScheduledValues=function(t){return t=this.toSeconds(t),this._events.cancel(t),this._param.cancelScheduledValues(t),this},t.Param.prototype.cancelAndHoldAtTime=function(e){var i=this.getValueAtTime(e),n=this._events.get(e),o=this._events.getAfter(e);return n&&n.time===e?o?this._events.cancel(o.time):this._events.cancel(e+1e-6):o&&(this._events.cancel(o.time),this._param.cancelAndHoldAtTime||this._param.cancelScheduledValues(e),o.type===t.Param.AutomationType.Linear?this._param.cancelAndHoldAtTime?this._events.add({type:t.Param.AutomationType.Linear,value:i,time:e}):this.linearRampToValueAtTime(i,e):o.type===t.Param.AutomationType.Exponential&&(this._param.cancelAndHoldAtTime?this._events.add({type:t.Param.AutomationType.Exponential,value:i,time:e}):this.exponentialRampToValueAtTime(i,e))),this._events.add({type:t.Param.AutomationType.SetValue,value:i,time:e}),this._param.cancelAndHoldAtTime?this._param.cancelAndHoldAtTime(e):this._param.setValueAtTime(i,e),this},t.Param.prototype.rampTo=function(e,i,n){return i=t.defaultArg(i,.1),this.units===t.Type.Frequency||this.units===t.Type.BPM||this.units===t.Type.Decibels?this.exponentialRampTo(e,i,n):this.linearRampTo(e,i,n),this},t.Param.prototype._exponentialApproach=function(t,e,i,n,o){return i+(e-i)*Math.exp(-(o-t)/n)},t.Param.prototype._linearInterpolate=function(t,e,i,n,o){return e+(o-t)/(i-t)*(n-e)},t.Param.prototype._exponentialInterpolate=function(t,e,i,n,o){return e*Math.pow(n/e,(o-t)/(i-t))},t.Param.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._param=null,this._events=null,this},t.Param}),i(function(t){return t.OfflineContext=function(e,i,n){var o=new OfflineAudioContext(e,i*n,n);t.Context.call(this,{context:o,clockSource:"offline",lookAhead:0,updateInterval:128/n}),this._duration=i,this._currentTime=0},t.extend(t.OfflineContext,t.Context),t.OfflineContext.prototype.now=function(){return this._currentTime},t.OfflineContext.prototype.render=function(){for(;this._duration-this._currentTime>=0;)this.emit("tick"),this._currentTime+=this.blockTime;return this._context.startRendering()},t.OfflineContext.prototype.close=function(){return this._context=null,Promise.resolve()},t.OfflineContext}),i(function(t){if(t.supported){var e=navigator.userAgent.toLowerCase();e.includes("safari")&&!e.includes("chrome")&&e.includes("mobile")&&(t.OfflineContext.prototype.createBufferSource=function(){var t=this._context.createBufferSource(),e=t.start;return t.start=function(i){this.setTimeout(function(){e.call(t,i)}.bind(this),0)}.bind(this),t})}}),i(function(t){return t.Gain=function(){var e=t.defaults(arguments,["gain","units"],t.Gain);t.AudioNode.call(this),this.input=this.output=this._gainNode=this.context.createGain(),this.gain=new t.Param({param:this._gainNode.gain,units:e.units,value:e.gain,convert:e.convert}),this._readOnly("gain")},t.extend(t.Gain,t.AudioNode),t.Gain.defaults={gain:1,convert:!0},t.Gain.prototype.dispose=function(){t.AudioNode.prototype.dispose.call(this),this._gainNode.disconnect(),this._gainNode=null,this._writable("gain"),this.gain.dispose(),this.gain=null},t.Gain}),i(function(t){if(t.supported&&!AudioContext.prototype.createConstantSource){var e=function(t){this.context=t;for(var e=t.createBuffer(1,128,t.sampleRate),i=e.getChannelData(0),n=0;n<i.length;n++)i[n]=1;this._bufferSource=t.createBufferSource(),this._bufferSource.channelCount=1,this._bufferSource.channelCountMode="explicit",this._bufferSource.buffer=e,this._bufferSource.loop=!0;var o=this._output=t.createGain();this.offset=o.gain,this._bufferSource.connect(o)};e.prototype.start=function(t){return this._bufferSource.start(t),this},e.prototype.stop=function(t){return this._bufferSource.stop(t),this},e.prototype.connect=function(){return this._output.connect.apply(this._output,arguments),this},e.prototype.disconnect=function(){return this._output.disconnect.apply(this._output,arguments),this},AudioContext.prototype.createConstantSource=function(){return new e(this)},t.Context.prototype.createConstantSource=function(){return new e(this)}}}),i(function(t){return t.Signal=function(){var e=t.defaults(arguments,["value","units"],t.Signal);t.Param.call(this,e),this._proxies=[],this._sourceStarted=!1,this._constantSource=this.context.createConstantSource(),this._param=this._constantSource.offset,this.value=e.value,this.output=this._constantSource,this.input=this._param=this.output.offset},t.extend(t.Signal,t.Param),t.Signal.defaults={value:0,units:t.Type.Default,convert:!0},t.Signal.prototype.connect=function(e){return this._isParam(e)&&!this._sourceStarted?(this._proxies.push(e),e.overridden=!0,this._applyAutomations(e)):(t.SignalBase.prototype.connect.apply(this,arguments),this._sourceStarted||(this._sourceStarted=!0,this._constantSource.start(0))),this},t.Signal.prototype._isParam=function(e){return t.Param&&t.Param===e.constructor||e instanceof AudioParam},t.Signal.prototype._connectProxies=function(){this._sourceStarted||(this._sourceStarted=!0,this._constantSource.start(0)),this._proxies.forEach(function(e){t.SignalBase.prototype.connect.call(this,e),e._proxies&&e._connectProxies()}.bind(this))},t.Signal.prototype._onConnect=function(t){this._isParam(t)||this._connectProxies()},t.Signal.prototype._applyAutomations=function(t){var e=this.context.currentTime;t.cancelScheduledValues(e);var i=this.getValueAtTime(e);t.setValueAtTime(i,e),this._events.forEachFrom(e,function(e){t[e.type](e.value,e.time,e.constant)})},t.Signal.prototype.disconnect=function(e){if(this._proxies.includes(e)){var i=this._proxies.indexOf(e);this._proxies.splice(i,1)}else e||(this._proxies=[]);return t.SignalBase.prototype.disconnect.apply(this,arguments)},t.Signal.prototype.getValueAtTime=function(e){return this._param.getValueAtTime?this._param.getValueAtTime(e):t.Param.prototype.getValueAtTime.call(this,e)},["setValueAtTime","linearRampToValueAtTime","exponentialRampToValueAtTime","setTargetAtTime"].forEach(function(e){var i=t.Signal.prototype[e];t.Signal.prototype[e]=function(){var t=arguments;i.apply(this,arguments),t[0]=this._fromUnits(t[0]),t[1]=this.toSeconds(t[1]),this._proxies.forEach(function(i){i[e].apply(i,t)})}}),["cancelScheduledValues","cancelAndHoldAtTime"].forEach(function(e){var i=t.Signal.prototype[e];t.Signal.prototype[e]=function(){var t=arguments;i.apply(this,arguments),t[0]=this.toSeconds(t[0]),this._proxies.forEach(function(i){i[e].apply(i,t)})}}),t.Signal.prototype.dispose=function(){return t.Param.prototype.dispose.call(this),this._constantSource.disconnect(),this._constantSource=null,this._proxies=null,this},t.Signal}),i(function(t){return t.Pow=function(e){t.SignalBase.call(this),this._exp=t.defaultArg(e,1),this._expScaler=this.input=this.output=new t.WaveShaper(this._expFunc(this._exp),8192)},t.extend(t.Pow,t.SignalBase),Object.defineProperty(t.Pow.prototype,"value",{get:function(){return this._exp},set:function(t){this._exp=t,this._expScaler.setMap(this._expFunc(this._exp))}}),t.Pow.prototype._expFunc=function(t){return function(e){return Math.pow(Math.abs(e),t)}},t.Pow.prototype.dispose=function(){return t.SignalBase.prototype.dispose.call(this),this._expScaler.dispose(),this._expScaler=null,this},t.Pow}),i(function(t){return t.Envelope=function(){var e=t.defaults(arguments,["attack","decay","sustain","release"],t.Envelope);t.AudioNode.call(this),this.attack=e.attack,this.decay=e.decay,this.sustain=e.sustain,this.release=e.release,this._attackCurve="linear",this._releaseCurve="exponential",this._sig=this.output=new t.Signal(0),this.attackCurve=e.attackCurve,this.releaseCurve=e.releaseCurve},t.extend(t.Envelope,t.AudioNode),t.Envelope.defaults={attack:.01,decay:.1,sustain:.5,release:1,attackCurve:"linear",releaseCurve:"exponential"},Object.defineProperty(t.Envelope.prototype,"value",{get:function(){return this.getValueAtTime(this.now())}}),Object.defineProperty(t.Envelope.prototype,"attackCurve",{get:function(){if(t.isString(this._attackCurve))return this._attackCurve;if(t.isArray(this._attackCurve)){for(var e in t.Envelope.Type)if(t.Envelope.Type[e].In===this._attackCurve)return e;return this._attackCurve}},set:function(e){if(t.Envelope.Type.hasOwnProperty(e)){var i=t.Envelope.Type[e];t.isObject(i)?this._attackCurve=i.In:this._attackCurve=i}else{if(!t.isArray(e))throw new Error("Tone.Envelope: invalid curve: "+e);this._attackCurve=e}}}),Object.defineProperty(t.Envelope.prototype,"releaseCurve",{get:function(){if(t.isString(this._releaseCurve))return this._releaseCurve;if(t.isArray(this._releaseCurve)){for(var e in t.Envelope.Type)if(t.Envelope.Type[e].Out===this._releaseCurve)return e;return this._releaseCurve}},set:function(e){if(t.Envelope.Type.hasOwnProperty(e)){var i=t.Envelope.Type[e];t.isObject(i)?this._releaseCurve=i.Out:this._releaseCurve=i}else{if(!t.isArray(e))throw new Error("Tone.Envelope: invalid curve: "+e);this._releaseCurve=e}}}),t.Envelope.prototype.triggerAttack=function(e,i){e=this.toSeconds(e);var n=this.toSeconds(this.attack),o=n,r=this.toSeconds(this.decay);i=t.defaultArg(i,1);var s=this.getValueAtTime(e);if(s>0&&(o=(1-s)/(1/o)),"linear"===this._attackCurve)this._sig.linearRampTo(i,o,e);else if("exponential"===this._attackCurve)this._sig.targetRampTo(i,o,e);else if(o>0){this._sig.cancelAndHoldAtTime(e);var a=this._attackCurve;if(o<n){var l=1-o/n,u=Math.floor(l*this._attackCurve.length);(a=this._attackCurve.slice(u))[0]=s}this._sig.setValueCurveAtTime(a,e,o,i)}return r&&this._sig.targetRampTo(i*this.sustain,r,o+e),this},t.Envelope.prototype.triggerRelease=function(e){e=this.toSeconds(e);var i=this.getValueAtTime(e);if(i>0){var n=this.toSeconds(this.release);if("linear"===this._releaseCurve)this._sig.linearRampTo(0,n,e);else if("exponential"===this._releaseCurve)this._sig.targetRampTo(0,n,e);else{var o=this._releaseCurve;t.isArray(o)&&(this._sig.cancelAndHoldAtTime(e),this._sig.setValueCurveAtTime(o,e,n,i))}}return this},t.Envelope.prototype.getValueAtTime=function(t){return this._sig.getValueAtTime(t)},t.Envelope.prototype.triggerAttackRelease=function(t,e,i){return e=this.toSeconds(e),this.triggerAttack(e,i),this.triggerRelease(e+this.toSeconds(t)),this},t.Envelope.prototype.cancel=function(t){return this._sig.cancelScheduledValues(t),this},t.Envelope.prototype.connect=t.SignalBase.prototype.connect,function(){var e,i,n=[];for(e=0;e<128;e++)n[e]=Math.sin(e/127*(Math.PI/2));var o=[];for(e=0;e<127;e++){i=e/127;var r=Math.sin(i*(2*Math.PI)*6.4-Math.PI/2)+1;o[e]=r/10+.83*i}o[127]=1;var s=[];for(e=0;e<128;e++)s[e]=Math.ceil(e/127*5)/5;var a=[];for(e=0;e<128;e++)i=e/127,a[e]=.5*(1-Math.cos(Math.PI*i));var l,u=[];for(e=0;e<128;e++){i=e/127;var h=4*Math.pow(i,3)+.2,c=Math.cos(h*Math.PI*2*i);u[e]=Math.abs(c*(1-i))}function d(t){for(var e=new Array(t.length),i=0;i<t.length;i++)e[i]=1-t[i];return e}t.Envelope.Type={linear:"linear",exponential:"exponential",bounce:{In:d(u),Out:u},cosine:{In:n,Out:(l=n,l.slice(0).reverse())},step:{In:s,Out:d(s)},ripple:{In:o,Out:d(o)},sine:{In:a,Out:d(a)}}}(),t.Envelope.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._sig.dispose(),this._sig=null,this._attackCurve=null,this._releaseCurve=null,this},t.Envelope}),i(function(t){return t.AmplitudeEnvelope=function(){t.Envelope.apply(this,arguments),this.input=this.output=new t.Gain,this._sig.connect(this.output.gain)},t.extend(t.AmplitudeEnvelope,t.Envelope),t.AmplitudeEnvelope.prototype.dispose=function(){return t.Envelope.prototype.dispose.call(this),this},t.AmplitudeEnvelope}),i(function(t){t.supported&&(AnalyserNode.prototype.getFloatTimeDomainData||(AnalyserNode.prototype.getFloatTimeDomainData=function(t){var e=new Uint8Array(t.length);this.getByteTimeDomainData(e);for(var i=0;i<e.length;i++)t[i]=(e[i]-128)/128}))}),i(function(t){return t.Analyser=function(){var e=t.defaults(arguments,["type","size"],t.Analyser);t.AudioNode.call(this),this._analyser=this.input=this.output=this.context.createAnalyser(),this._type=e.type,this._buffer=null,this.size=e.size,this.type=e.type},t.extend(t.Analyser,t.AudioNode),t.Analyser.defaults={size:1024,type:"fft",smoothing:.8},t.Analyser.Type={Waveform:"waveform",FFT:"fft"},t.Analyser.prototype.getValue=function(){return this._type===t.Analyser.Type.FFT?this._analyser.getFloatFrequencyData(this._buffer):this._type===t.Analyser.Type.Waveform&&this._analyser.getFloatTimeDomainData(this._buffer),this._buffer},Object.defineProperty(t.Analyser.prototype,"size",{get:function(){return this._analyser.frequencyBinCount},set:function(t){this._analyser.fftSize=2*t,this._buffer=new Float32Array(t)}}),Object.defineProperty(t.Analyser.prototype,"type",{get:function(){return this._type},set:function(e){if(e!==t.Analyser.Type.Waveform&&e!==t.Analyser.Type.FFT)throw new TypeError("Tone.Analyser: invalid type: "+e);this._type=e}}),Object.defineProperty(t.Analyser.prototype,"smoothing",{get:function(){return this._analyser.smoothingTimeConstant},set:function(t){this._analyser.smoothingTimeConstant=t}}),t.Analyser.prototype.dispose=function(){t.AudioNode.prototype.dispose.call(this),this._analyser.disconnect(),this._analyser=null,this._buffer=null},t.Analyser}),i(function(t){return t.Compressor=function(){var e=t.defaults(arguments,["threshold","ratio"],t.Compressor);t.AudioNode.call(this),this._compressor=this.input=this.output=this.context.createDynamicsCompressor(),this.threshold=new t.Param({param:this._compressor.threshold,units:t.Type.Decibels,convert:!1}),this.attack=new t.Param(this._compressor.attack,t.Type.Time),this.release=new t.Param(this._compressor.release,t.Type.Time),this.knee=new t.Param({param:this._compressor.knee,units:t.Type.Decibels,convert:!1}),this.ratio=new t.Param({param:this._compressor.ratio,convert:!1}),this._readOnly(["knee","release","attack","ratio","threshold"]),this.set(e)},t.extend(t.Compressor,t.AudioNode),t.Compressor.defaults={ratio:12,threshold:-24,release:.25,attack:.003,knee:30},t.Compressor.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._writable(["knee","release","attack","ratio","threshold"]),this._compressor.disconnect(),this._compressor=null,this.attack.dispose(),this.attack=null,this.release.dispose(),this.release=null,this.threshold.dispose(),this.threshold=null,this.ratio.dispose(),this.ratio=null,this.knee.dispose(),this.knee=null,this},t.Compressor}),i(function(t){return t.Add=function(e){t.Signal.call(this),this.createInsOuts(2,0),this._sum=this.input[0]=this.input[1]=this.output=new t.Gain,this._param=this.input[1]=new t.Signal(e),this._param.connect(this._sum)},t.extend(t.Add,t.Signal),t.Add.prototype.dispose=function(){return t.Signal.prototype.dispose.call(this),this._sum.dispose(),this._sum=null,this},t.Add}),i(function(t){return t.Multiply=function(e){t.Signal.call(this),this.createInsOuts(2,0),this._mult=this.input[0]=this.output=new t.Gain,this._param=this.input[1]=this.output.gain,this.value=t.defaultArg(e,0)},t.extend(t.Multiply,t.Signal),t.Multiply.prototype.dispose=function(){return t.Signal.prototype.dispose.call(this),this._mult.dispose(),this._mult=null,this._param=null,this},t.Multiply}),i(function(t){return t.Negate=function(){t.SignalBase.call(this),this._multiply=this.input=this.output=new t.Multiply(-1)},t.extend(t.Negate,t.SignalBase),t.Negate.prototype.dispose=function(){return t.SignalBase.prototype.dispose.call(this),this._multiply.dispose(),this._multiply=null,this},t.Negate}),i(function(t){return t.Subtract=function(e){t.Signal.call(this),this.createInsOuts(2,0),this._sum=this.input[0]=this.output=new t.Gain,this._neg=new t.Negate,this._param=this.input[1]=new t.Signal(e),this._param.chain(this._neg,this._sum)},t.extend(t.Subtract,t.Signal),t.Subtract.prototype.dispose=function(){return t.Signal.prototype.dispose.call(this),this._neg.dispose(),this._neg=null,this._sum.disconnect(),this._sum=null,this},t.Subtract}),i(function(t){return t.EqualPowerGain=function(){t.SignalBase.call(this),this._eqPower=this.input=this.output=new t.WaveShaper(function(e){return Math.abs(e)<.001?0:t.equalPowerScale(e)}.bind(this),4096)},t.extend(t.EqualPowerGain,t.SignalBase),t.EqualPowerGain.prototype.dispose=function(){return t.SignalBase.prototype.dispose.call(this),this._eqPower.dispose(),this._eqPower=null,this},t.EqualPowerGain}),i(function(t){return t.CrossFade=function(e){t.AudioNode.call(this),this.createInsOuts(2,1),this.a=this.input[0]=new t.Gain,this.b=this.input[1]=new t.Gain,this.fade=new t.Signal(t.defaultArg(e,.5),t.Type.NormalRange),this._equalPowerA=new t.EqualPowerGain,this._equalPowerB=new t.EqualPowerGain,this._one=this.context.getConstant(1),this._invert=new t.Subtract,this.a.connect(this.output),this.b.connect(this.output),this.fade.chain(this._equalPowerB,this.b.gain),this._one.connect(this._invert,0,0),this.fade.connect(this._invert,0,1),this._invert.chain(this._equalPowerA,this.a.gain),this._readOnly("fade")},t.extend(t.CrossFade,t.AudioNode),t.CrossFade.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._writable("fade"),this._equalPowerA.dispose(),this._equalPowerA=null,this._equalPowerB.dispose(),this._equalPowerB=null,this.fade.dispose(),this.fade=null,this._invert.dispose(),this._invert=null,this._one=null,this.a.dispose(),this.a=null,this.b.dispose(),this.b=null,this},t.CrossFade}),i(function(t){return t.Filter=function(){var e=t.defaults(arguments,["frequency","type","rolloff"],t.Filter);t.AudioNode.call(this),this.createInsOuts(1,1),this._filters=[],this.frequency=new t.Signal(e.frequency,t.Type.Frequency),this.detune=new t.Signal(0,t.Type.Cents),this.gain=new t.Signal({value:e.gain,convert:!1}),this.Q=new t.Signal(e.Q),this._type=e.type,this._rolloff=e.rolloff,this.rolloff=e.rolloff,this._readOnly(["detune","frequency","gain","Q"])},t.extend(t.Filter,t.AudioNode),t.Filter.defaults={type:"lowpass",frequency:350,rolloff:-12,Q:1,gain:0},Object.defineProperty(t.Filter.prototype,"type",{get:function(){return this._type},set:function(t){if(-1===["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t))throw new TypeError("Tone.Filter: invalid type "+t);this._type=t;for(var e=0;e<this._filters.length;e++)this._filters[e].type=t}}),Object.defineProperty(t.Filter.prototype,"rolloff",{get:function(){return this._rolloff},set:function(e){e=parseInt(e,10);var i=[-12,-24,-48,-96].indexOf(e);if(-1===i)throw new RangeError("Tone.Filter: rolloff can only be -12, -24, -48 or -96");i+=1,this._rolloff=e,this.input.disconnect();for(var n=0;n<this._filters.length;n++)this._filters[n].disconnect(),this._filters[n]=null;this._filters=new Array(i);for(var o=0;o<i;o++){var r=this.context.createBiquadFilter();r.type=this._type,this.frequency.connect(r.frequency),this.detune.connect(r.detune),this.Q.connect(r.Q),this.gain.connect(r.gain),this._filters[o]=r}var s=[this.input].concat(this._filters).concat([this.output]);t.connectSeries.apply(t,s)}}),t.Filter.prototype.dispose=function(){t.AudioNode.prototype.dispose.call(this);for(var e=0;e<this._filters.length;e++)this._filters[e].disconnect(),this._filters[e]=null;return this._filters=null,this._writable(["detune","frequency","gain","Q"]),this.frequency.dispose(),this.Q.dispose(),this.frequency=null,this.Q=null,this.detune.dispose(),this.detune=null,this.gain.dispose(),this.gain=null,this},t.Filter}),i(function(t){return t.MultibandSplit=function(){var e=t.defaults(arguments,["lowFrequency","highFrequency"],t.MultibandSplit);t.AudioNode.call(this),this.input=new t.Gain,this.output=new Array(3),this.low=this.output[0]=new t.Filter(0,"lowpass"),this._lowMidFilter=new t.Filter(0,"highpass"),this.mid=this.output[1]=new t.Filter(0,"lowpass"),this.high=this.output[2]=new t.Filter(0,"highpass"),this.lowFrequency=new t.Signal(e.lowFrequency,t.Type.Frequency),this.highFrequency=new t.Signal(e.highFrequency,t.Type.Frequency),this.Q=new t.Signal(e.Q),this.input.fan(this.low,this.high),this.input.chain(this._lowMidFilter,this.mid),this.lowFrequency.connect(this.low.frequency),this.lowFrequency.connect(this._lowMidFilter.frequency),this.highFrequency.connect(this.mid.frequency),this.highFrequency.connect(this.high.frequency),this.Q.connect(this.low.Q),this.Q.connect(this._lowMidFilter.Q),this.Q.connect(this.mid.Q),this.Q.connect(this.high.Q),this._readOnly(["high","mid","low","highFrequency","lowFrequency"])},t.extend(t.MultibandSplit,t.AudioNode),t.MultibandSplit.defaults={lowFrequency:400,highFrequency:2500,Q:1},t.MultibandSplit.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._writable(["high","mid","low","highFrequency","lowFrequency"]),this.low.dispose(),this.low=null,this._lowMidFilter.dispose(),this._lowMidFilter=null,this.mid.dispose(),this.mid=null,this.high.dispose(),this.high=null,this.lowFrequency.dispose(),this.lowFrequency=null,this.highFrequency.dispose(),this.highFrequency=null,this.Q.dispose(),this.Q=null,this},t.MultibandSplit}),i(function(t){return t.EQ3=function(){var e=t.defaults(arguments,["low","mid","high"],t.EQ3);t.AudioNode.call(this),this.output=new t.Gain,this._multibandSplit=this.input=new t.MultibandSplit({lowFrequency:e.lowFrequency,highFrequency:e.highFrequency}),this._lowGain=new t.Gain(e.low,t.Type.Decibels),this._midGain=new t.Gain(e.mid,t.Type.Decibels),this._highGain=new t.Gain(e.high,t.Type.Decibels),this.low=this._lowGain.gain,this.mid=this._midGain.gain,this.high=this._highGain.gain,this.Q=this._multibandSplit.Q,this.lowFrequency=this._multibandSplit.lowFrequency,this.highFrequency=this._multibandSplit.highFrequency,this._multibandSplit.low.chain(this._lowGain,this.output),this._multibandSplit.mid.chain(this._midGain,this.output),this._multibandSplit.high.chain(this._highGain,this.output),this._readOnly(["low","mid","high","lowFrequency","highFrequency"])},t.extend(t.EQ3,t.AudioNode),t.EQ3.defaults={low:0,mid:0,high:0,lowFrequency:400,highFrequency:2500},t.EQ3.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._writable(["low","mid","high","lowFrequency","highFrequency"]),this._multibandSplit.dispose(),this._multibandSplit=null,this.lowFrequency=null,this.highFrequency=null,this._lowGain.dispose(),this._lowGain=null,this._midGain.dispose(),this._midGain=null,this._highGain.dispose(),this._highGain=null,this.low=null,this.mid=null,this.high=null,this.Q=null,this},t.EQ3}),i(function(t){return t.Scale=function(e,i){t.SignalBase.call(this),this._outputMin=t.defaultArg(e,0),this._outputMax=t.defaultArg(i,1),this._scale=this.input=new t.Multiply(1),this._add=this.output=new t.Add(0),this._scale.connect(this._add),this._setRange()},t.extend(t.Scale,t.SignalBase),Object.defineProperty(t.Scale.prototype,"min",{get:function(){return this._outputMin},set:function(t){this._outputMin=t,this._setRange()}}),Object.defineProperty(t.Scale.prototype,"max",{get:function(){return this._outputMax},set:function(t){this._outputMax=t,this._setRange()}}),t.Scale.prototype._setRange=function(){this._add.value=this._outputMin,this._scale.value=this._outputMax-this._outputMin},t.Scale.prototype.dispose=function(){return t.SignalBase.prototype.dispose.call(this),this._add.dispose(),this._add=null,this._scale.dispose(),this._scale=null,this},t.Scale}),i(function(t){return t.ScaleExp=function(e,i,n){t.SignalBase.call(this),this._scale=this.output=new t.Scale(e,i),this._exp=this.input=new t.Pow(t.defaultArg(n,2)),this._exp.connect(this._scale)},t.extend(t.ScaleExp,t.SignalBase),Object.defineProperty(t.ScaleExp.prototype,"exponent",{get:function(){return this._exp.value},set:function(t){this._exp.value=t}}),Object.defineProperty(t.ScaleExp.prototype,"min",{get:function(){return this._scale.min},set:function(t){this._scale.min=t}}),Object.defineProperty(t.ScaleExp.prototype,"max",{get:function(){return this._scale.max},set:function(t){this._scale.max=t}}),t.ScaleExp.prototype.dispose=function(){return t.SignalBase.prototype.dispose.call(this),this._scale.dispose(),this._scale=null,this._exp.dispose(),this._exp=null,this},t.ScaleExp}),i(function(t){return t.Delay=function(){var e=t.defaults(arguments,["delayTime","maxDelay"],t.Delay);t.AudioNode.call(this),this._maxDelay=Math.max(this.toSeconds(e.maxDelay),this.toSeconds(e.delayTime)),this._delayNode=this.input=this.output=this.context.createDelay(this._maxDelay),this.delayTime=new t.Param({param:this._delayNode.delayTime,units:t.Type.Time,value:e.delayTime}),this._readOnly("delayTime")},t.extend(t.Delay,t.AudioNode),t.Delay.defaults={maxDelay:1,delayTime:0},Object.defineProperty(t.Delay.prototype,"maxDelay",{get:function(){return this._maxDelay}}),t.Delay.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._delayNode.disconnect(),this._delayNode=null,this._writable("delayTime"),this.delayTime=null,this},t.Delay}),i(function(t){return t.FeedbackCombFilter=function(){var e=t.defaults(arguments,["delayTime","resonance"],t.FeedbackCombFilter);t.AudioNode.call(this),this._delay=this.input=this.output=new t.Delay(e.delayTime),this.delayTime=this._delay.delayTime,this._feedback=new t.Gain(e.resonance,t.Type.NormalRange),this.resonance=this._feedback.gain,this._delay.chain(this._feedback,this._delay),this._readOnly(["resonance","delayTime"])},t.extend(t.FeedbackCombFilter,t.AudioNode),t.FeedbackCombFilter.defaults={delayTime:.1,resonance:.5},t.FeedbackCombFilter.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._writable(["resonance","delayTime"]),this._delay.dispose(),this._delay=null,this.delayTime=null,this._feedback.dispose(),this._feedback=null,this.resonance=null,this},t.FeedbackCombFilter}),i(function(t){return t.FFT=function(){var e=t.defaults(arguments,["size"],t.FFT);e.type=t.Analyser.Type.FFT,t.AudioNode.call(this),this._analyser=this.input=this.output=new t.Analyser(e)},t.extend(t.FFT,t.AudioNode),t.FFT.defaults={size:1024},t.FFT.prototype.getValue=function(){return this._analyser.getValue()},Object.defineProperty(t.FFT.prototype,"size",{get:function(){return this._analyser.size},set:function(t){this._analyser.size=t}}),t.FFT.prototype.dispose=function(){t.AudioNode.prototype.dispose.call(this),this._analyser.dispose(),this._analyser=null},t.FFT}),i(function(t){return t.Abs=function(){t.SignalBase.call(this),this._abs=this.input=this.output=new t.WaveShaper(function(t){return Math.abs(t)<.001?0:Math.abs(t)},1024)},t.extend(t.Abs,t.SignalBase),t.Abs.prototype.dispose=function(){return t.SignalBase.prototype.dispose.call(this),this._abs.dispose(),this._abs=null,this},t.Abs}),i(function(t){return t.Follower=function(){var e=t.defaults(arguments,["attack","release"],t.Follower);t.AudioNode.call(this),this.createInsOuts(1,1),this._abs=new t.Abs,this._filter=this.context.createBiquadFilter(),this._filter.type="lowpass",this._filter.frequency.value=0,this._filter.Q.value=-100,this._frequencyValues=new t.WaveShaper,this._sub=new t.Subtract,this._delay=new t.Delay(this.blockTime),this._mult=new t.Multiply(1e4),this._attack=e.attack,this._release=e.release,this.input.chain(this._abs,this._filter,this.output),this._abs.connect(this._sub,0,1),this._filter.chain(this._delay,this._sub),this._sub.chain(this._mult,this._frequencyValues,this._filter.frequency),this._setAttackRelease(this._attack,this._release)},t.extend(t.Follower,t.AudioNode),t.Follower.defaults={attack:.05,release:.5},t.Follower.prototype._setAttackRelease=function(e,i){var n=this.blockTime;e=t.Time(e).toFrequency(),i=t.Time(i).toFrequency(),e=Math.max(e,n),i=Math.max(i,n),this._frequencyValues.setMap(function(t){return t<=0?e:i})},Object.defineProperty(t.Follower.prototype,"attack",{get:function(){return this._attack},set:function(t){this._attack=t,this._setAttackRelease(this._attack,this._release)}}),Object.defineProperty(t.Follower.prototype,"release",{get:function(){return this._release},set:function(t){this._release=t,this._setAttackRelease(this._attack,this._release)}}),t.Follower.prototype.connect=t.SignalBase.prototype.connect,t.Follower.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._filter.disconnect(),this._filter=null,this._frequencyValues.disconnect(),this._frequencyValues=null,this._delay.dispose(),this._delay=null,this._sub.disconnect(),this._sub=null,this._abs.dispose(),this._abs=null,this._mult.dispose(),this._mult=null,this._curve=null,this},t.Follower}),i(function(t){return t.ScaledEnvelope=function(){var e=t.defaults(arguments,["attack","decay","sustain","release"],t.Envelope);t.Envelope.call(this,e),e=t.defaultArg(e,t.ScaledEnvelope.defaults),this._exp=this.output=new t.Pow(e.exponent),this._scale=this.output=new t.Scale(e.min,e.max),this._sig.chain(this._exp,this._scale)},t.extend(t.ScaledEnvelope,t.Envelope),t.ScaledEnvelope.defaults={min:0,max:1,exponent:1},Object.defineProperty(t.ScaledEnvelope.prototype,"min",{get:function(){return this._scale.min},set:function(t){this._scale.min=t}}),Object.defineProperty(t.ScaledEnvelope.prototype,"max",{get:function(){return this._scale.max},set:function(t){this._scale.max=t}}),Object.defineProperty(t.ScaledEnvelope.prototype,"exponent",{get:function(){return this._exp.value},set:function(t){this._exp.value=t}}),t.ScaledEnvelope.prototype.dispose=function(){return t.Envelope.prototype.dispose.call(this),this._scale.dispose(),this._scale=null,this._exp.dispose(),this._exp=null,this},t.ScaledEnvelope}),i(function(t){return t.FrequencyEnvelope=function(){var e=t.defaults(arguments,["attack","decay","sustain","release"],t.Envelope);t.ScaledEnvelope.call(this,e),e=t.defaultArg(e,t.FrequencyEnvelope.defaults),this._octaves=e.octaves,this.baseFrequency=e.baseFrequency,this.octaves=e.octaves},t.extend(t.FrequencyEnvelope,t.Envelope),t.FrequencyEnvelope.defaults={baseFrequency:200,octaves:4,exponent:2},Object.defineProperty(t.FrequencyEnvelope.prototype,"baseFrequency",{get:function(){return this._scale.min},set:function(t){this._scale.min=this.toFrequency(t),this.octaves=this._octaves}}),Object.defineProperty(t.FrequencyEnvelope.prototype,"octaves",{get:function(){return this._octaves},set:function(t){this._octaves=t,this._scale.max=this.baseFrequency*Math.pow(2,t)}}),Object.defineProperty(t.FrequencyEnvelope.prototype,"exponent",{get:function(){return this._exp.value},set:function(t){this._exp.value=t}}),t.FrequencyEnvelope.prototype.dispose=function(){return t.ScaledEnvelope.prototype.dispose.call(this),this},t.FrequencyEnvelope}),i(function(t){return t.GreaterThanZero=function(){t.SignalBase.call(this),this._thresh=this.output=new t.WaveShaper(function(t){return t<=0?0:1},127),this._scale=this.input=new t.Multiply(1e4),this._scale.connect(this._thresh)},t.extend(t.GreaterThanZero,t.SignalBase),t.GreaterThanZero.prototype.dispose=function(){return t.SignalBase.prototype.dispose.call(this),this._scale.dispose(),this._scale=null,this._thresh.dispose(),this._thresh=null,this},t.GreaterThanZero}),i(function(t){return t.GreaterThan=function(e){t.Signal.call(this),this.createInsOuts(2,0),this._param=this.input[0]=new t.Subtract(e),this.input[1]=this._param.input[1],this._gtz=this.output=new t.GreaterThanZero,this._param.connect(this._gtz)},t.extend(t.GreaterThan,t.Signal),t.GreaterThan.prototype.dispose=function(){return t.Signal.prototype.dispose.call(this),this._gtz.dispose(),this._gtz=null,this},t.GreaterThan}),i(function(t){return t.Gate=function(){var e=t.defaults(arguments,["threshold","attack","release"],t.Gate);t.AudioNode.call(this),this.createInsOuts(1,1),this._follower=new t.Follower(e.attack,e.release),this._gt=new t.GreaterThan(t.dbToGain(e.threshold)),this.input.connect(this.output),this.input.chain(this._gt,this._follower,this.output.gain)},t.extend(t.Gate,t.AudioNode),t.Gate.defaults={attack:.1,release:.1,threshold:-40},Object.defineProperty(t.Gate.prototype,"threshold",{get:function(){return t.gainToDb(this._gt.value)},set:function(e){this._gt.value=t.dbToGain(e)}}),Object.defineProperty(t.Gate.prototype,"attack",{get:function(){return this._follower.attack},set:function(t){this._follower.attack=t}}),Object.defineProperty(t.Gate.prototype,"release",{get:function(){return this._follower.release},set:function(t){this._follower.release=t}}),t.Gate.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._follower.dispose(),this._gt.dispose(),this._follower=null,this._gt=null,this},t.Gate}),i(function(t){function e(t){return function(e,i){i=this.toSeconds(i),t.apply(this,arguments);var n=this._events.get(i),o=this._events.previousEvent(n),r=this._getTicksUntilEvent(o,i);return n.ticks=Math.max(r,0),this}}return t.TickSignal=function(e){e=t.defaultArg(e,1),t.Signal.call(this,{units:t.Type.Ticks,value:e}),this._events.memory=1/0,this.cancelScheduledValues(0),this._events.add({type:t.Param.AutomationType.SetValue,time:0,value:e})},t.extend(t.TickSignal,t.Signal),t.TickSignal.prototype.setValueAtTime=e(t.Signal.prototype.setValueAtTime),t.TickSignal.prototype.linearRampToValueAtTime=e(t.Signal.prototype.linearRampToValueAtTime),t.TickSignal.prototype.setTargetAtTime=function(t,e,i){e=this.toSeconds(e),this.setRampPoint(e),t=this._fromUnits(t);for(var n=this._events.get(e),o=Math.round(Math.max(1/i,1)),r=0;r<=o;r++){var s=i*r+e,a=this._exponentialApproach(n.time,n.value,t,i,s);this.linearRampToValueAtTime(this._toUnits(a),s)}return this},t.TickSignal.prototype.exponentialRampToValueAtTime=function(t,e){e=this.toSeconds(e),t=this._fromUnits(t);var i=this._events.get(e);null===i&&(i={value:this._initialValue,time:0});for(var n=Math.round(Math.max(10*(e-i.time),1)),o=(e-i.time)/n,r=0;r<=n;r++){var s=o*r+i.time,a=this._exponentialInterpolate(i.time,i.value,e,t,s);this.linearRampToValueAtTime(this._toUnits(a),s)}return this},t.TickSignal.prototype._getTicksUntilEvent=function(e,i){if(null===e)e={ticks:0,time:0};else if(t.isUndef(e.ticks)){var n=this._events.previousEvent(e);e.ticks=this._getTicksUntilEvent(n,e.time)}var o=this.getValueAtTime(e.time),r=this.getValueAtTime(i);return this._events.get(i).time===i&&this._events.get(i).type===t.Param.AutomationType.SetValue&&(r=this.getValueAtTime(i-this.sampleTime)),.5*(i-e.time)*(o+r)+e.ticks},t.TickSignal.prototype.getTicksAtTime=function(t){t=this.toSeconds(t);var e=this._events.get(t);return Math.max(this._getTicksUntilEvent(e,t),0)},t.TickSignal.prototype.getDurationOfTicks=function(t,e){e=this.toSeconds(e);var i=this.getTicksAtTime(e);return this.getTimeOfTick(i+t)-e},t.TickSignal.prototype.getTimeOfTick=function(e){var i=this._events.get(e,"ticks"),n=this._events.getAfter(e,"ticks");if(i&&i.ticks===e)return i.time;if(i&&n&&n.type===t.Param.AutomationType.Linear&&i.value!==n.value){var o=this.getValueAtTime(i.time),r=(this.getValueAtTime(n.time)-o)/(n.time-i.time),s=Math.sqrt(Math.pow(o,2)-2*r*(i.ticks-e)),a=(-o+s)/r;return(a>0?a:(-o-s)/r)+i.time}return i?0===i.value?1/0:i.time+(e-i.ticks)/i.value:e/this._initialValue},t.TickSignal.prototype.ticksToTime=function(e,i){return i=this.toSeconds(i),new t.Time(this.getDurationOfTicks(e,i))},t.TickSignal.prototype.timeToTicks=function(e,i){i=this.toSeconds(i),e=this.toSeconds(e);var n=this.getTicksAtTime(i),o=this.getTicksAtTime(i+e);return new t.Ticks(o-n)},t.TickSignal}),i(function(t){return t.TimelineState=function(e){t.Timeline.call(this),this._initial=e},t.extend(t.TimelineState,t.Timeline),t.TimelineState.prototype.getValueAtTime=function(t){var e=this.get(t);return null!==e?e.state:this._initial},t.TimelineState.prototype.setStateAtTime=function(t,e){return this.add({state:t,time:e}),this},t.TimelineState.prototype.getLastState=function(t,e){e=this.toSeconds(e);for(var i=this._search(e);i>=0;i--){var n=this._timeline[i];if(n.state===t)return n}},t.TimelineState.prototype.getNextState=function(t,e){e=this.toSeconds(e);var i=this._search(e);if(-1!==i)for(var n=i;n<this._timeline.length;n++){var o=this._timeline[n];if(o.state===t)return o}},t.TimelineState}),i(function(t){return t.TickSource=function(){var e=t.defaults(arguments,["frequency"],t.TickSource);this.frequency=new t.TickSignal(e.frequency,t.Type.Frequency),this._readOnly("frequency"),this._state=new t.TimelineState(t.State.Stopped),this._state.setStateAtTime(t.State.Stopped,0),this._tickOffset=new t.Timeline,this.setTicksAtTime(0,0)},t.extend(t.TickSource),t.TickSource.defaults={frequency:1},Object.defineProperty(t.TickSource.prototype,"state",{get:function(){return this._state.getValueAtTime(this.now())}}),t.TickSource.prototype.start=function(e,i){return e=this.toSeconds(e),this._state.getValueAtTime(e)!==t.State.Started&&(this._state.setStateAtTime(t.State.Started,e),t.isDefined(i)&&this.setTicksAtTime(i,e)),this},t.TickSource.prototype.stop=function(e){if(e=this.toSeconds(e),this._state.getValueAtTime(e)===t.State.Stopped){var i=this._state.get(e);i.time>0&&(this._tickOffset.cancel(i.time),this._state.cancel(i.time))}return this._state.cancel(e),this._state.setStateAtTime(t.State.Stopped,e),this.setTicksAtTime(0,e),this},t.TickSource.prototype.pause=function(e){return e=this.toSeconds(e),this._state.getValueAtTime(e)===t.State.Started&&this._state.setStateAtTime(t.State.Paused,e),this},t.TickSource.prototype.cancel=function(t){return t=this.toSeconds(t),this._state.cancel(t),this._tickOffset.cancel(t),this},t.TickSource.prototype.getTicksAtTime=function(e){e=this.toSeconds(e);var i=this._state.getLastState(t.State.Stopped,e),n={state:t.State.Paused,time:e};this._state.add(n);var o=i,r=0;return this._state.forEachBetween(i.time,e+this.sampleTime,function(e){var i=o.time,n=this._tickOffset.get(e.time);n.time>=o.time&&(r=n.ticks,i=n.time),o.state===t.State.Started&&e.state!==t.State.Started&&(r+=this.frequency.getTicksAtTime(e.time)-this.frequency.getTicksAtTime(i)),o=e}.bind(this)),this._state.remove(n),r},Object.defineProperty(t.TickSource.prototype,"ticks",{get:function(){return this.getTicksAtTime(this.now())},set:function(t){this.setTicksAtTime(t,this.now())}}),Object.defineProperty(t.TickSource.prototype,"seconds",{get:function(){return this.getSecondsAtTime(this.now())},set:function(t){var e=this.now(),i=this.frequency.timeToTicks(t,e);this.setTicksAtTime(i,e)}}),t.TickSource.prototype.getSecondsAtTime=function(e){e=this.toSeconds(e);var i=this._state.getLastState(t.State.Stopped,e),n={state:t.State.Paused,time:e};this._state.add(n);var o=i,r=0;return this._state.forEachBetween(i.time,e+this.sampleTime,function(e){var i=o.time,n=this._tickOffset.get(e.time);n.time>=o.time&&(r=n.seconds,i=n.time),o.state===t.State.Started&&e.state!==t.State.Started&&(r+=e.time-i),o=e}.bind(this)),this._state.remove(n),r},t.TickSource.prototype.setTicksAtTime=function(t,e){return e=this.toSeconds(e),this._tickOffset.cancel(e),this._tickOffset.add({time:e,ticks:t,seconds:this.frequency.getDurationOfTicks(t,e)}),this},t.TickSource.prototype.getStateAtTime=function(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)},t.TickSource.prototype.getTimeOfTick=function(e,i){i=t.defaultArg(i,this.now());var n=this._tickOffset.get(i),o=this._state.get(i),r=Math.max(n.time,o.time),s=this.frequency.getTicksAtTime(r)+e-n.ticks;return this.frequency.getTimeOfTick(s)},t.TickSource.prototype.forEachTickBetween=function(e,i,n){var o=this._state.get(e);if(this._state.forEachBetween(e,i,function(i){o.state===t.State.Started&&i.state!==t.State.Started&&this.forEachTickBetween(Math.max(o.time,e),i.time-this.sampleTime,n),o=i}.bind(this)),e=Math.max(o.time,e),o.state===t.State.Started&&this._state){var r=this.frequency.getTicksAtTime(e),s=(r-this.frequency.getTicksAtTime(o.time))%1;0!==s&&(s=1-s);for(var a=this.frequency.getTimeOfTick(r+s),l=null;a<i&&this._state;){try{n(a,Math.round(this.getTicksAtTime(a)))}catch(u){l=u;break}this._state&&(a+=this.frequency.getDurationOfTicks(1,a))}}if(l)throw l;return this},t.TickSource.prototype.dispose=function(){return t.Param.prototype.dispose.call(this),this._state.dispose(),this._state=null,this._tickOffset.dispose(),this._tickOffset=null,this._writable("frequency"),this.frequency.dispose(),this.frequency=null,this},t.TickSource}),i(function(t){return t.Clock=function(){var e=t.defaults(arguments,["callback","frequency"],t.Clock);t.Emitter.call(this),this.callback=e.callback,this._nextTick=0,this._tickSource=new t.TickSource(e.frequency),this._lastUpdate=0,this.frequency=this._tickSource.frequency,this._readOnly("frequency"),this._state=new t.TimelineState(t.State.Stopped),this._state.setStateAtTime(t.State.Stopped,0),this._boundLoop=this._loop.bind(this),this.context.on("tick",this._boundLoop)},t.extend(t.Clock,t.Emitter),t.Clock.defaults={callback:t.noOp,frequency:1},Object.defineProperty(t.Clock.prototype,"state",{get:function(){return this._state.getValueAtTime(this.now())}}),t.Clock.prototype.start=function(e,i){return e=this.toSeconds(e),this._state.getValueAtTime(e)!==t.State.Started&&(this._state.setStateAtTime(t.State.Started,e),this._tickSource.start(e,i),e<this._lastUpdate&&this.emit("start",e,i)),this},t.Clock.prototype.stop=function(e){return e=this.toSeconds(e),this._state.cancel(e),this._state.setStateAtTime(t.State.Stopped,e),this._tickSource.stop(e),e<this._lastUpdate&&this.emit("stop",e),this},t.Clock.prototype.pause=function(e){return e=this.toSeconds(e),this._state.getValueAtTime(e)===t.State.Started&&(this._state.setStateAtTime(t.State.Paused,e),this._tickSource.pause(e),e<this._lastUpdate&&this.emit("pause",e)),this},Object.defineProperty(t.Clock.prototype,"ticks",{get:function(){return Math.ceil(this.getTicksAtTime(this.now()))},set:function(t){this._tickSource.ticks=t}}),Object.defineProperty(t.Clock.prototype,"seconds",{get:function(){return this._tickSource.seconds},set:function(t){this._tickSource.seconds=t}}),t.Clock.prototype.getSecondsAtTime=function(t){return this._tickSource.getSecondsAtTime(t)},t.Clock.prototype.setTicksAtTime=function(t,e){return this._tickSource.setTicksAtTime(t,e),this},t.Clock.prototype.getTicksAtTime=function(t){return this._tickSource.getTicksAtTime(t)},t.Clock.prototype.nextTickTime=function(t,e){e=this.toSeconds(e);var i=this.getTicksAtTime(e);return this._tickSource.getTimeOfTick(i+t,e)},t.Clock.prototype._loop=function(){var e=this._lastUpdate,i=this.now();this._lastUpdate=i,e!==i&&(this._state.forEachBetween(e,i,function(e){switch(e.state){case t.State.Started:var i=this._tickSource.getTicksAtTime(e.time);this.emit("start",e.time,i);break;case t.State.Stopped:0!==e.time&&this.emit("stop",e.time);break;case t.State.Paused:this.emit("pause",e.time)}}.bind(this)),this._tickSource.forEachTickBetween(e,i,function(t,e){this.callback(t,e)}.bind(this)))},t.Clock.prototype.getStateAtTime=function(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)},t.Clock.prototype.dispose=function(){t.Emitter.prototype.dispose.call(this),this.context.off("tick",this._boundLoop),this._writable("frequency"),this._tickSource.dispose(),this._tickSource=null,this.frequency=null,this._boundLoop=null,this._nextTick=1/0,this.callback=null,this._state.dispose(),this._state=null},t.Clock}),i(function(t){t.IntervalTimeline=function(){t.call(this),this._root=null,this._length=0},t.extend(t.IntervalTimeline),t.IntervalTimeline.prototype.add=function(i){if(t.isUndef(i.time)||t.isUndef(i.duration))throw new Error("Tone.IntervalTimeline: events must have time and duration parameters");i.time=i.time.valueOf();var n=new e(i.time,i.time+i.duration,i);for(null===this._root?this._root=n:this._root.insert(n),this._length++;null!==n;)n.updateHeight(),n.updateMax(),this._rebalance(n),n=n.parent;return this},t.IntervalTimeline.prototype.remove=function(t){if(null!==this._root){var e=[];this._root.search(t.time,e);for(var i=0;i<e.length;i++){var n=e[i];if(n.event===t){this._removeNode(n),this._length--;break}}}return this},Object.defineProperty(t.IntervalTimeline.prototype,"length",{get:function(){return this._length}}),t.IntervalTimeline.prototype.cancel=function(t){return this.forEachFrom(t,function(t){this.remove(t)}.bind(this)),this},t.IntervalTimeline.prototype._setRoot=function(t){this._root=t,null!==this._root&&(this._root.parent=null)},t.IntervalTimeline.prototype._replaceNodeInParent=function(t,e){null!==t.parent?(t.isLeftChild()?t.parent.left=e:t.parent.right=e,this._rebalance(t.parent)):this._setRoot(e)},t.IntervalTimeline.prototype._removeNode=function(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{var e,i;if(t.getBalance()>0)if(null===t.left.right)(e=t.left).right=t.right,i=e;else{for(e=t.left.right;null!==e.right;)e=e.right;e.parent.right=e.left,i=e.parent,e.left=t.left,e.right=t.right}else if(null===t.right.left)(e=t.right).left=t.left,i=e;else{for(e=t.right.left;null!==e.left;)e=e.left;e.parent=e.parent,e.parent.left=e.right,i=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),this._rebalance(i)}t.dispose()},t.IntervalTimeline.prototype._rotateLeft=function(t){var e=t.parent,i=t.isLeftChild(),n=t.right;t.right=n.left,n.left=t,null!==e?i?e.left=n:e.right=n:this._setRoot(n)},t.IntervalTimeline.prototype._rotateRight=function(t){var e=t.parent,i=t.isLeftChild(),n=t.left;t.left=n.right,n.right=t,null!==e?i?e.left=n:e.right=n:this._setRoot(n)},t.IntervalTimeline.prototype._rebalance=function(t){var e=t.getBalance();e>1?t.left.getBalance()<0?this._rotateLeft(t.left):this._rotateRight(t):e<-1&&(t.right.getBalance()>0?this._rotateRight(t.right):this._rotateLeft(t))},t.IntervalTimeline.prototype.get=function(t){if(null!==this._root){var e=[];if(this._root.search(t,e),e.length>0){for(var i=e[0],n=1;n<e.length;n++)e[n].low>i.low&&(i=e[n]);return i.event}}return null},t.IntervalTimeline.prototype.forEach=function(t){if(null!==this._root){var e=[];this._root.traverse(function(t){e.push(t)});for(var i=0;i<e.length;i++){var n=e[i].event;n&&t(n)}}return this},t.IntervalTimeline.prototype.forEachAtTime=function(t,e){if(null!==this._root){var i=[];this._root.search(t,i);for(var n=i.length-1;n>=0;n--){var o=i[n].event;o&&e(o)}}return this},t.IntervalTimeline.prototype.forEachFrom=function(t,e){if(null!==this._root){var i=[];this._root.searchAfter(t,i);for(var n=i.length-1;n>=0;n--)e(i[n].event)}return this},t.IntervalTimeline.prototype.dispose=function(){var t=[];null!==this._root&&this._root.traverse(function(e){t.push(e)});for(var e=0;e<t.length;e++)t[e].dispose();return t=null,this._root=null,this};var e=function(t,e,i){this.event=i,this.low=t,this.high=e,this.max=this.high,this._left=null,this._right=null,this.parent=null,this.height=0};return e.prototype.insert=function(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)},e.prototype.search=function(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))},e.prototype.searchAfter=function(t,e){this.low>=t&&(e.push(this),null!==this.left&&this.left.searchAfter(t,e)),null!==this.right&&this.right.searchAfter(t,e)},e.prototype.traverse=function(t){t(this),null!==this.left&&this.left.traverse(t),null!==this.right&&this.right.traverse(t)},e.prototype.updateHeight=function(){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},e.prototype.updateMax=function(){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))},e.prototype.getBalance=function(){var 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},e.prototype.isLeftChild=function(){return null!==this.parent&&this.parent.left===this},Object.defineProperty(e.prototype,"left",{get:function(){return this._left},set:function(t){this._left=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}}),Object.defineProperty(e.prototype,"right",{get:function(){return this._right},set:function(t){this._right=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}}),e.prototype.dispose=function(){this.parent=null,this._left=null,this._right=null,this.event=null},t.IntervalTimeline}),i(function(t){return t.Ticks=function(e,i){if(!(this instanceof t.Ticks))return new t.Ticks(e,i);t.TransportTime.call(this,e,i)},t.extend(t.Ticks,t.TransportTime),t.Ticks.prototype._defaultUnits="i",t.Ticks.prototype._now=function(){return t.Transport.ticks},t.Ticks.prototype._beatsToUnits=function(t){return this._getPPQ()*t},t.Ticks.prototype._secondsToUnits=function(t){return t/(60/this._getBpm())*this._getPPQ()},t.Ticks.prototype._ticksToUnits=function(t){return t},t.Ticks.prototype.toTicks=function(){return this.valueOf()},t.Ticks.prototype.toSeconds=function(){return this.valueOf()/this._getPPQ()*(60/this._getBpm())},t.Ticks}),i(function(t){return t.TransportEvent=function(e,i){i=t.defaultArg(i,t.TransportEvent.defaults),t.call(this),this.Transport=e,this.id=t.TransportEvent._eventId++,this.time=t.Ticks(i.time),this.callback=i.callback,this._once=i.once},t.extend(t.TransportEvent),t.TransportEvent.defaults={once:!1,callback:t.noOp},t.TransportEvent._eventId=0,t.TransportEvent.prototype.invoke=function(t){this.callback&&(this.callback(t),this._once&&this.Transport&&this.Transport.clear(this.id))},t.TransportEvent.prototype.dispose=function(){return t.prototype.dispose.call(this),this.Transport=null,this.callback=null,this.time=null,this},t.TransportEvent}),i(function(t){return t.TransportRepeatEvent=function(e,i){t.TransportEvent.call(this,e,i),i=t.defaultArg(i,t.TransportRepeatEvent.defaults),this.duration=t.Ticks(i.duration),this._interval=t.Ticks(i.interval),this._currentId=-1,this._nextId=-1,this._nextTick=this.time,this._boundRestart=this._restart.bind(this),this.Transport.on("start loopStart",this._boundRestart),this._restart()},t.extend(t.TransportRepeatEvent,t.TransportEvent),t.TransportRepeatEvent.defaults={duration:1/0,interval:1},t.TransportRepeatEvent.prototype.invoke=function(e){this._createEvents(e),t.TransportEvent.prototype.invoke.call(this,e)},t.TransportRepeatEvent.prototype._createEvents=function(e){var i=this.Transport.getTicksAtTime(e);i>=this.time&&i>=this._nextTick&&this._nextTick+this._interval<this.time+this.duration&&(this._nextTick+=this._interval,this._currentId=this._nextId,this._nextId=this.Transport.scheduleOnce(this.invoke.bind(this),t.Ticks(this._nextTick)))},t.TransportRepeatEvent.prototype._restart=function(e){this.Transport.clear(this._currentId),this.Transport.clear(this._nextId),this._nextTick=this.time;var i=this.Transport.getTicksAtTime(e);i>this.time&&(this._nextTick=this.time+Math.ceil((i-this.time)/this._interval)*this._interval),this._currentId=this.Transport.scheduleOnce(this.invoke.bind(this),t.Ticks(this._nextTick)),this._nextTick+=this._interval,this._nextId=this.Transport.scheduleOnce(this.invoke.bind(this),t.Ticks(this._nextTick))},t.TransportRepeatEvent.prototype.dispose=function(){return this.Transport.clear(this._currentId),this.Transport.clear(this._nextId),this.Transport.off("start loopStart",this._boundRestart),this._boundCreateEvents=null,t.TransportEvent.prototype.dispose.call(this),this.duration=null,this._interval=null,this},t.TransportRepeatEvent}),i(function(t){t.Transport=function(){t.Emitter.call(this),t.getContext(function(){this.loop=!1,this._loopStart=0,this._loopEnd=0,this._ppq=e.defaults.PPQ,this._clock=new t.Clock({callback:this._processTick.bind(this),frequency:0}),this._bindClockEvents(),this.bpm=this._clock.frequency,this.bpm._toUnits=this._toUnits.bind(this),this.bpm._fromUnits=this._fromUnits.bind(this),this.bpm.units=t.Type.BPM,this.bpm.value=e.defaults.bpm,this._readOnly("bpm"),this._timeSignature=e.defaults.timeSignature,this._scheduledEvents={},this._timeline=new t.Timeline,this._repeatedEvents=new t.IntervalTimeline,this._syncedSignals=[],this._swingTicks=e.defaults.PPQ/2,this._swingAmount=0}.bind(this))},t.extend(t.Transport,t.Emitter),t.Transport.defaults={bpm:120,swing:0,swingSubdivision:"8n",timeSignature:4,loopStart:0,loopEnd:"4m",PPQ:192},t.Transport.prototype._processTick=function(e,i){if(this._swingAmount>0&&i%this._ppq!==0&&i%(2*this._swingTicks)!==0){var n=i%(2*this._swingTicks)/(2*this._swingTicks),o=Math.sin(n*Math.PI)*this._swingAmount;e+=t.Ticks(2*this._swingTicks/3).toSeconds()*o}this.loop&&i>=this._loopEnd&&(this.emit("loopEnd",e),this._clock.setTicksAtTime(this._loopStart,e),i=this._loopStart,this.emit("loopStart",e,this._clock.getSecondsAtTime(e)),this.emit("loop",e)),this._timeline.forEachAtTime(i,function(t){t.invoke(e)})},t.Transport.prototype.schedule=function(e,i){var n=new t.TransportEvent(this,{time:t.TransportTime(i),callback:e});return this._addEvent(n,this._timeline)},t.Transport.prototype.scheduleRepeat=function(e,i,n,o){var r=new t.TransportRepeatEvent(this,{callback:e,interval:t.Time(i),time:t.TransportTime(n),duration:t.Time(t.defaultArg(o,1/0))});return this._addEvent(r,this._repeatedEvents)},t.Transport.prototype.scheduleOnce=function(e,i){var n=new t.TransportEvent(this,{time:t.TransportTime(i),callback:e,once:!0});return this._addEvent(n,this._timeline)},t.Transport.prototype.clear=function(t){if(this._scheduledEvents.hasOwnProperty(t)){var e=this._scheduledEvents[t.toString()];e.timeline.remove(e.event),e.event.dispose(),delete this._scheduledEvents[t.toString()]}return this},t.Transport.prototype._addEvent=function(t,e){return this._scheduledEvents[t.id.toString()]={event:t,timeline:e},e.add(t),t.id},t.Transport.prototype.cancel=function(e){return e=t.defaultArg(e,0),e=this.toTicks(e),this._timeline.forEachFrom(e,function(t){this.clear(t.id)}.bind(this)),this._repeatedEvents.forEachFrom(e,function(t){this.clear(t.id)}.bind(this)),this},t.Transport.prototype._bindClockEvents=function(){this._clock.on("start",function(e,i){i=t.Ticks(i).toSeconds(),this.emit("start",e,i)}.bind(this)),this._clock.on("stop",function(t){this.emit("stop",t)}.bind(this)),this._clock.on("pause",function(t){this.emit("pause",t)}.bind(this))},Object.defineProperty(t.Transport.prototype,"state",{get:function(){return this._clock.getStateAtTime(this.now())}}),t.Transport.prototype.start=function(e,i){return t.isDefined(i)&&(i=this.toTicks(i)),this._clock.start(e,i),this},t.Transport.prototype.stop=function(t){return this._clock.stop(t),this},t.Transport.prototype.pause=function(t){return this._clock.pause(t),this},t.Transport.prototype.toggle=function(e){return e=this.toSeconds(e),this._clock.getStateAtTime(e)!==t.State.Started?this.start(e):this.stop(e),this},Object.defineProperty(t.Transport.prototype,"timeSignature",{get:function(){return this._timeSignature},set:function(e){t.isArray(e)&&(e=e[0]/e[1]*4),this._timeSignature=e}}),Object.defineProperty(t.Transport.prototype,"loopStart",{get:function(){return t.Ticks(this._loopStart).toSeconds()},set:function(t){this._loopStart=this.toTicks(t)}}),Object.defineProperty(t.Transport.prototype,"loopEnd",{get:function(){return t.Ticks(this._loopEnd).toSeconds()},set:function(t){this._loopEnd=this.toTicks(t)}}),t.Transport.prototype.setLoopPoints=function(t,e){return this.loopStart=t,this.loopEnd=e,this},Object.defineProperty(t.Transport.prototype,"swing",{get:function(){return this._swingAmount},set:function(t){this._swingAmount=t}}),Object.defineProperty(t.Transport.prototype,"swingSubdivision",{get:function(){return t.Ticks(this._swingTicks).toNotation()},set:function(t){this._swingTicks=this.toTicks(t)}}),Object.defineProperty(t.Transport.prototype,"position",{get:function(){var e=this.now(),i=this._clock.getTicksAtTime(e);return t.Ticks(i).toBarsBeatsSixteenths()},set:function(t){var e=this.toTicks(t);this.ticks=e}}),Object.defineProperty(t.Transport.prototype,"seconds",{get:function(){return this._clock.seconds},set:function(t){var e=this.now(),i=this.bpm.timeToTicks(t,e);this.ticks=i}}),Object.defineProperty(t.Transport.prototype,"progress",{get:function(){if(this.loop){var t=this.now();return(this._clock.getTicksAtTime(t)-this._loopStart)/(this._loopEnd-this._loopStart)}return 0}}),Object.defineProperty(t.Transport.prototype,"ticks",{get:function(){return this._clock.ticks},set:function(e){if(this._clock.ticks!==e){var i=this.now();this.state===t.State.Started?(this.emit("stop",i),this._clock.setTicksAtTime(e,i),this.emit("start",i,this.seconds)):this._clock.setTicksAtTime(e,i)}}}),t.Transport.prototype.getTicksAtTime=function(t){return Math.round(this._clock.getTicksAtTime(t))},t.Transport.prototype.getSecondsAtTime=function(t){return this._clock.getSecondsAtTime(t)},Object.defineProperty(t.Transport.prototype,"PPQ",{get:function(){return this._ppq},set:function(t){var e=this.bpm.value;this._ppq=t,this.bpm.value=e}}),t.Transport.prototype._fromUnits=function(t){return 1/(60/t/this.PPQ)},t.Transport.prototype._toUnits=function(t){return t/this.PPQ*60},t.Transport.prototype.nextSubdivision=function(e){if(e=this.toTicks(e),this.state!==t.State.Started)return 0;var i=this.now(),n=e-this.getTicksAtTime(i)%e;return this._clock.nextTickTime(n,i)},t.Transport.prototype.syncSignal=function(e,i){if(!i){var n=this.now();i=0!==e.getValueAtTime(n)?e.getValueAtTime(n)/this.bpm.getValueAtTime(n):0}var o=new t.Gain(i);return this.bpm.chain(o,e._param),this._syncedSignals.push({ratio:o,signal:e,initial:e.value}),e.value=0,this},t.Transport.prototype.unsyncSignal=function(t){for(var e=this._syncedSignals.length-1;e>=0;e--){var i=this._syncedSignals[e];i.signal===t&&(i.ratio.dispose(),i.signal.value=i.initial,this._syncedSignals.splice(e,1))}return this},t.Transport.prototype.dispose=function(){return t.Emitter.prototype.dispose.call(this),this._clock.dispose(),this._clock=null,this._writable("bpm"),this.bpm=null,this._timeline.dispose(),this._timeline=null,this._repeatedEvents.dispose(),this._repeatedEvents=null,this};var e=t.Transport;return t.Transport=new e,t.Context.on("init",function(i){i.Transport instanceof e?t.Transport=i.Transport:t.Transport=new e,i.Transport=t.Transport}),t.Context.on("close",function(t){t.Transport instanceof e&&t.Transport.dispose()}),t.Transport}),i(function(t){return t.Volume=function(){var e=t.defaults(arguments,["volume"],t.Volume);t.AudioNode.call(this),this.output=this.input=new t.Gain(e.volume,t.Type.Decibels),this._unmutedVolume=e.volume,this.volume=this.output.gain,this._readOnly("volume"),this.mute=e.mute},t.extend(t.Volume,t.AudioNode),t.Volume.defaults={volume:0,mute:!1},Object.defineProperty(t.Volume.prototype,"mute",{get:function(){return this.volume.value===-1/0},set:function(t){!this.mute&&t?(this._unmutedVolume=this.volume.value,this.volume.value=-1/0):this.mute&&!t&&(this.volume.value=this._unmutedVolume)}}),t.Volume.prototype.dispose=function(){return this.input.dispose(),t.AudioNode.prototype.dispose.call(this),this._writable("volume"),this.volume.dispose(),this.volume=null,this},t.Volume}),i(function(t){t.Master=function(){t.AudioNode.call(this),t.getContext(function(){this.createInsOuts(1,0),this._volume=this.output=new t.Volume,this.volume=this._volume.volume,this._readOnly("volume"),this.input.chain(this.output,this.context.destination)}.bind(this))},t.extend(t.Master,t.AudioNode),t.Master.defaults={volume:0,mute:!1},Object.defineProperty(t.Master.prototype,"mute",{get:function(){return this._volume.mute},set:function(t){this._volume.mute=t}}),t.Master.prototype.chain=function(){this.input.disconnect(),this.input.chain.apply(this.input,arguments),arguments[arguments.length-1].connect(this.output)},t.Master.prototype.dispose=function(){t.AudioNode.prototype.dispose.call(this),this._writable("volume"),this._volume.dispose(),this._volume=null,this.volume=null},t.AudioNode.prototype.toMaster=function(){return this.connect(t.Master),this},window.AudioNode&&(AudioNode.prototype.toMaster=function(){return this.connect(t.Master),this});var e=t.Master;return t.Master=new e,t.Context.on("init",function(i){i.Master instanceof e?t.Master=i.Master:t.Master=new e,i.Master=t.Master}),t.Context.on("close",function(t){t.Master instanceof e&&t.Master.dispose()}),t.Master}),i(function(t){return t.Source=function(e){e=t.defaultArg(e,t.Source.defaults),t.AudioNode.call(this),this._volume=this.output=new t.Volume(e.volume),this.volume=this._volume.volume,this._readOnly("volume"),this._state=new t.TimelineState(t.State.Stopped),this._state.memory=100,this._synced=!1,this._scheduled=[],this._volume.output.output.channelCount=2,this._volume.output.output.channelCountMode="explicit",this.mute=e.mute},t.extend(t.Source,t.AudioNode),t.Source.defaults={volume:0,mute:!1},Object.defineProperty(t.Source.prototype,"state",{get:function(){return this._synced?t.Transport.state===t.State.Started?this._state.getValueAtTime(t.Transport.seconds):t.State.Stopped:this._state.getValueAtTime(this.now())}}),Object.defineProperty(t.Source.prototype,"mute",{get:function(){return this._volume.mute},set:function(t){this._volume.mute=t}}),t.Source.prototype._start=t.noOp,t.Source.prototype.restart=t.noOp,t.Source.prototype._stop=t.noOp,t.Source.prototype.start=function(e,i,n){if(e=t.isUndef(e)&&this._synced?t.Transport.seconds:this.toSeconds(e),this._state.getValueAtTime(e)===t.State.Started)this._state.cancel(e),this._state.setStateAtTime(t.State.Started,e),this.restart(e,i,n);else if(this._state.setStateAtTime(t.State.Started,e),this._synced){var o=this._state.get(e);o.offset=t.defaultArg(i,0),o.duration=n;var r=t.Transport.schedule(function(t){this._start(t,i,n)}.bind(this),e);this._scheduled.push(r),t.Transport.state===t.State.Started&&this._syncedStart(this.now(),t.Transport.seconds)}else this._start.apply(this,arguments);return this},t.Source.prototype.stop=function(e){if(e=t.isUndef(e)&&this._synced?t.Transport.seconds:this.toSeconds(e),this._synced){var i=t.Transport.schedule(this._stop.bind(this),e);this._scheduled.push(i)}else this._stop.apply(this,arguments);return this._state.cancel(e),this._state.setStateAtTime(t.State.Stopped,e),this},t.Source.prototype.sync=function(){return this._synced=!0,this._syncedStart=function(e,i){if(i>0){var n=this._state.get(i);if(n&&n.state===t.State.Started&&n.time!==i){var o,r=i-this.toSeconds(n.time);n.duration&&(o=this.toSeconds(n.duration)-r),this._start(e,this.toSeconds(n.offset)+r,o)}}}.bind(this),this._syncedStop=function(e){var i=t.Transport.getSecondsAtTime(Math.max(e-this.sampleTime,0));this._state.getValueAtTime(i)===t.State.Started&&this._stop(e)}.bind(this),t.Transport.on("start loopStart",this._syncedStart),t.Transport.on("stop pause loopEnd",this._syncedStop),this},t.Source.prototype.unsync=function(){this._synced&&(t.Transport.off("stop pause loopEnd",this._syncedStop),t.Transport.off("start loopStart",this._syncedStart)),this._synced=!1;for(var e=0;e<this._scheduled.length;e++){var i=this._scheduled[e];t.Transport.clear(i)}return this._scheduled=[],this._state.cancel(0),this},t.Source.prototype.dispose=function(){t.AudioNode.prototype.dispose.call(this),this.unsync(),this._scheduled=null,this._writable("volume"),this._volume.dispose(),this._volume=null,this.volume=null,this._state.dispose(),this._state=null},t.Source}),i(function(t){t.supported&&(AudioBuffer.prototype.copyToChannel||(AudioBuffer.prototype.copyToChannel=function(t,e,i){var n=this.getChannelData(e);i=i||0;for(var o=0;o<n.length;o++)n[o+i]=t[o]},AudioBuffer.prototype.copyFromChannel=function(t,e,i){var n=this.getChannelData(e);i=i||0;for(var o=0;o<t.length;o++)t[o]=n[o+i]}))}),i(function(t){return t.Buffer=function(){var e=t.defaults(arguments,["url","onload","onerror"],t.Buffer);t.call(this),this._buffer=null,this._reversed=e.reverse,this._xhr=null,this._onload=t.noOp,e.url instanceof AudioBuffer||e.url instanceof t.Buffer?(this.set(e.url),e.onload&&(this.loaded?e.onload(this):this._onload=e.onload)):t.isString(e.url)&&this.load(e.url).then(e.onload).catch(e.onerror)},t.extend(t.Buffer),t.Buffer.defaults={url:void 0,reverse:!1,onload:t.noOp,onerror:t.noOp},t.Buffer.prototype.set=function(e){return e instanceof t.Buffer?e.loaded?this._buffer=e.get():e._onload=function(){this.set(e),this._onload(this)}.bind(this):this._buffer=e,this},t.Buffer.prototype.get=function(){return this._buffer},t.Buffer.prototype.load=function(e,i,n){return new Promise(function(o,r){this._xhr=t.Buffer.load(e,function(t){this._xhr=null,this.set(t),o(this),this._onload(this),i&&i(this)}.bind(this),function(t){this._xhr=null,r(t),n&&n(t)}.bind(this))}.bind(this))},t.Buffer.prototype.dispose=function(){return t.prototype.dispose.call(this),this._buffer=null,this._xhr&&(t.Buffer._removeFromDownloadQueue(this._xhr),this._xhr.abort(),this._xhr=null),this},Object.defineProperty(t.Buffer.prototype,"loaded",{get:function(){return this.length>0}}),Object.defineProperty(t.Buffer.prototype,"duration",{get:function(){return this._buffer?this._buffer.duration:0}}),Object.defineProperty(t.Buffer.prototype,"length",{get:function(){return this._buffer?this._buffer.length:0}}),Object.defineProperty(t.Buffer.prototype,"numberOfChannels",{get:function(){return this._buffer?this._buffer.numberOfChannels:0}}),t.Buffer.prototype.fromArray=function(t){var e=t[0].length>0,i=e?t.length:1,n=e?t[0].length:t.length,o=this.context.createBuffer(i,n,this.context.sampleRate);e||1!==i||(t=[t]);for(var r=0;r<i;r++)o.copyToChannel(t[r],r);return this._buffer=o,this},t.Buffer.prototype.toMono=function(e){if(t.isNumber(e))this.fromArray(this.toArray(e));else{for(var i=new Float32Array(this.length),n=this.numberOfChannels,o=0;o<n;o++)for(var r=this.toArray(o),s=0;s<r.length;s++)i[s]+=r[s];i=i.map(function(t){return t/n}),this.fromArray(i)}return this},t.Buffer.prototype.toArray=function(e){if(t.isNumber(e))return this.getChannelData(e);if(1===this.numberOfChannels)return this.toArray(0);for(var i=[],n=0;n<this.numberOfChannels;n++)i[n]=this.getChannelData(n);return i},t.Buffer.prototype.getChannelData=function(t){return this._buffer.getChannelData(t)},t.Buffer.prototype.slice=function(e,i){i=t.defaultArg(i,this.duration);for(var n=Math.floor(this.context.sampleRate*this.toSeconds(e)),o=Math.floor(this.context.sampleRate*this.toSeconds(i)),r=[],s=0;s<this.numberOfChannels;s++)r[s]=this.toArray(s).slice(n,o);return(new t.Buffer).fromArray(r)},t.Buffer.prototype._reverse=function(){if(this.loaded)for(var t=0;t<this.numberOfChannels;t++)Array.prototype.reverse.call(this.getChannelData(t));return this},Object.defineProperty(t.Buffer.prototype,"reverse",{get:function(){return this._reversed},set:function(t){this._reversed!==t&&(this._reversed=t,this._reverse())}}),t.Emitter.mixin(t.Buffer),t.Buffer._downloadQueue=[],t.Buffer.baseUrl="",t.Buffer.fromArray=function(e){return(new t.Buffer).fromArray(e)},t.Buffer.fromUrl=function(e){var i=new t.Buffer;return i.load(e).then(function(){return i})},t.Buffer._removeFromDownloadQueue=function(e){var i=t.Buffer._downloadQueue.indexOf(e);-1!==i&&t.Buffer._downloadQueue.splice(i,1)},t.Buffer.load=function(e,i,n){i=t.defaultArg(i,t.noOp);var o=e.match(/\[(.+\|?)+\]$/);if(o){for(var r=o[1].split("|"),s=r[0],a=0;a<r.length;a++)if(t.Buffer.supportsType(r[a])){s=r[a];break}e=e.replace(o[0],s)}function l(e){if(t.Buffer._removeFromDownloadQueue(h),t.Buffer.emit("error",e),!n)throw e;n(e)}function u(){for(var e=0,i=0;i<t.Buffer._downloadQueue.length;i++)e+=t.Buffer._downloadQueue[i].progress;t.Buffer.emit("progress",e/t.Buffer._downloadQueue.length)}var h=new XMLHttpRequest;return h.open("GET",t.Buffer.baseUrl+e,!0),h.responseType="arraybuffer",h.progress=0,t.Buffer._downloadQueue.push(h),h.addEventListener("load",function(){200===h.status?t.context.decodeAudioData(h.response).then(function(e){h.progress=1,u(),i(e),t.Buffer._removeFromDownloadQueue(h),0===t.Buffer._downloadQueue.length&&t.Buffer.emit("load")}).catch(function(){t.Buffer._removeFromDownloadQueue(h),l("Tone.Buffer: could not decode audio data: "+e)}):l("Tone.Buffer: could not locate file: "+e)}),h.addEventListener("error",l),h.addEventListener("progress",function(t){t.lengthComputable&&(h.progress=t.loaded/t.total*.95,u())}),h.send(),h},t.Buffer.cancelDownloads=function(){return t.Buffer._downloadQueue.slice().forEach(function(e){t.Buffer._removeFromDownloadQueue(e),e.abort()}),t.Buffer},t.Buffer.supportsType=function(t){var e=t.split(".");return e=e[e.length-1],""!==document.createElement("audio").canPlayType("audio/"+e)},t.loaded=function(){var e,i;function n(){t.Buffer.off("load",e),t.Buffer.off("error",i)}return new Promise(function(n,o){e=function(){n()},i=function(){o()},t.Buffer.on("load",e),t.Buffer.on("error",i)}).then(n).catch(function(t){throw n(),new Error(t)})},t.Buffer}),i(function(t){return t.OscillatorNode=function(){var e=t.defaults(arguments,["frequency","type"],t.OscillatorNode);t.AudioNode.call(this,e),this.onended=e.onended,this._startTime=-1,this._stopTime=-1,this._gainNode=this.output=new t.Gain,this._gainNode.gain.setValueAtTime(0,this.context.currentTime),this._oscillator=this.context.createOscillator(),this._oscillator.connect(this._gainNode),this.type=e.type,this.frequency=new t.Param(this._oscillator.frequency,t.Type.Frequency),this.frequency.value=e.frequency,this.detune=new t.Param(this._oscillator.detune,t.Type.Cents),this.detune.value=e.detune,this._gain=1},t.extend(t.OscillatorNode,t.AudioNode),t.OscillatorNode.defaults={frequency:440,detune:0,type:"sine",onended:t.noOp},Object.defineProperty(t.OscillatorNode.prototype,"state",{get:function(){return this.getStateAtTime(this.now())}}),t.OscillatorNode.prototype.getStateAtTime=function(e){return e=this.toSeconds(e),-1!==this._startTime&&e>=this._startTime&&(-1===this._stopTime||e<=this._stopTime)?t.State.Started:t.State.Stopped},t.OscillatorNode.prototype.start=function(t){if(-1!==this._startTime)throw new Error("cannot call OscillatorNode.start more than once");this._startTime=this.toSeconds(t),this._oscillator.start(this._startTime);var e=this.context.currentTime;return this._gainNode.gain.cancelScheduledValues(e),this._gainNode.gain.setValueAtTime(0,e),this._gainNode.gain.setValueAtTime(1,this._startTime),this},t.OscillatorNode.prototype.setPeriodicWave=function(t){return this._oscillator.setPeriodicWave(t),this},t.OscillatorNode.prototype.stop=function(t){return this.cancelStop(),this._stopTime=this.toSeconds(t),this._gainNode.gain.setValueAtTime(0,this._stopTime),this.context.clearTimeout(this._timeout),this._timeout=this.context.setTimeout(function(){this._oscillator.stop(this.now()),this.onended()}.bind(this),this._stopTime-this.now()),this},t.OscillatorNode.prototype.cancelStop=function(){return-1!==this._startTime&&(this._gainNode.gain.cancelScheduledValues(this._startTime+this.sampleTime),this._gainNode.gain.setValueAtTime(1,Math.max(this.now(),this._startTime)),this.context.clearTimeout(this._timeout),this._stopTime=-1),this},Object.defineProperty(t.OscillatorNode.prototype,"type",{get:function(){return this._oscillator.type},set:function(t){this._oscillator.type=t}}),t.OscillatorNode.prototype.dispose=function(){return this.context.clearTimeout(this._timeout),t.AudioNode.prototype.dispose.call(this),this.onended=null,this._oscillator.disconnect(),this._oscillator=null,this._gainNode.dispose(),this._gainNode=null,this.frequency.dispose(),this.frequency=null,this.detune.dispose(),this.detune=null,this},t.OscillatorNode}),i(function(t){return t.Oscillator=function(){var e=t.defaults(arguments,["frequency","type"],t.Oscillator);t.Source.call(this,e),this._oscillator=null,this.frequency=new t.Signal(e.frequency,t.Type.Frequency),this.detune=new t.Signal(e.detune,t.Type.Cents),this._wave=null,this._partials=t.defaultArg(e.partials,[1]),this._phase=e.phase,this._type=null,this.type=e.type,this.phase=this._phase,this._readOnly(["frequency","detune"])},t.extend(t.Oscillator,t.Source),t.Oscillator.defaults={type:"sine",frequency:440,detune:0,phase:0,partials:[]},t.Oscillator.Type={Sine:"sine",Triangle:"triangle",Sawtooth:"sawtooth",Square:"square",Custom:"custom"},t.Oscillator.prototype._start=function(e){this._oscillator=new t.OscillatorNode,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),e=this.toSeconds(e),this._oscillator.start(e)},t.Oscillator.prototype._stop=function(t){return this._oscillator&&(t=this.toSeconds(t),this._oscillator.stop(t)),this},t.Oscillator.prototype.restart=function(t){return this._oscillator.cancelStop(),this._state.cancel(this.toSeconds(t)),this},t.Oscillator.prototype.syncFrequency=function(){return t.Transport.syncSignal(this.frequency),this},t.Oscillator.prototype.unsyncFrequency=function(){return t.Transport.unsyncSignal(this.frequency),this},Object.defineProperty(t.Oscillator.prototype,"type",{get:function(){return this._type},set:function(e){var i=[t.Oscillator.Type.Sine,t.Oscillator.Type.Square,t.Oscillator.Type.Triangle,t.Oscillator.Type.Sawtooth].includes(e);if(0===this._phase&&i)this._wave=null,null!==this._oscillator&&this._oscillator.type;else{var n=this._getRealImaginary(e,this._phase),o=this.context.createPeriodicWave(n[0],n[1]);this._wave=o,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave)}this._type=e}}),t.Oscillator.prototype._getRealImaginary=function(e,i){var n=2048,o=new Float32Array(n),r=new Float32Array(n),s=1;if(e===t.Oscillator.Type.Custom)n=s=this._partials.length+1;else{var a=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(e);a&&(s=parseInt(a[2])+1,e=a[1],n=s=Math.max(s,2))}for(var l=1;l<n;++l){var u,h=2/(l*Math.PI);switch(e){case t.Oscillator.Type.Sine:u=l<=s?1:0;break;case t.Oscillator.Type.Square:u=1&l?2*h:0;break;case t.Oscillator.Type.Sawtooth:u=h*(1&l?1:-1);break;case t.Oscillator.Type.Triangle:u=1&l?h*h*2*(l-1>>1&1?-1:1):0;break;case t.Oscillator.Type.Custom:u=this._partials[l-1];break;default:throw new TypeError("Tone.Oscillator: invalid type: "+e)}0!==u?(o[l]=-u*Math.sin(i*l),r[l]=u*Math.cos(i*l)):(o[l]=0,r[l]=0)}return[o,r]},t.Oscillator.prototype._inverseFFT=function(t,e,i){for(var n=0,o=t.length,r=0;r<o;r++)n+=t[r]*Math.cos(r*i)+e[r]*Math.sin(r*i);return n},t.Oscillator.prototype._getInitialValue=function(){for(var t=this._getRealImaginary(this._type,0),e=t[0],i=t[1],n=0,o=2*Math.PI,r=0;r<8;r++)n=Math.max(this._inverseFFT(e,i,r/8*o),n);return-this._inverseFFT(e,i,this._phase)/n},Object.defineProperty(t.Oscillator.prototype,"partials",{get:function(){return this._type!==t.Oscillator.Type.Custom?[]:this._partials},set:function(e){this._partials=e,this.type=t.Oscillator.Type.Custom}}),Object.defineProperty(t.Oscillator.prototype,"phase",{get:function(){return this._phase*(180/Math.PI)},set:function(t){this._phase=t*Math.PI/180,this.type=this._type}}),t.Oscillator.prototype.dispose=function(){return t.Source.prototype.dispose.call(this),null!==this._oscillator&&(this._oscillator.dispose(),this._oscillator=null),this._wave=null,this._writable(["frequency","detune"]),this.frequency.dispose(),this.frequency=null,this.detune.dispose(),this.detune=null,this._partials=null,this},t.Oscillator}),i(function(t){return t.AudioToGain=function(){t.SignalBase.call(this),this._norm=this.input=this.output=new t.WaveShaper(function(t){return(t+1)/2})},t.extend(t.AudioToGain,t.SignalBase),t.AudioToGain.prototype.dispose=function(){return t.SignalBase.prototype.dispose.call(this),this._norm.dispose(),this._norm=null,this},t.AudioToGain}),i(function(t){return t.Zero=function(){t.SignalBase.call(this),this._gain=this.input=this.output=new t.Gain,this.context.getConstant(0).connect(this._gain)},t.extend(t.Zero,t.SignalBase),t.Zero.prototype.dispose=function(){return t.SignalBase.prototype.dispose.call(this),this._gain.dispose(),this._gain=null,this},t.Zero}),i(function(t){return t.LFO=function(){var e=t.defaults(arguments,["frequency","min","max"],t.LFO);t.AudioNode.call(this),this._oscillator=new t.Oscillator({frequency:e.frequency,type:e.type}),this.frequency=this._oscillator.frequency,this.amplitude=this._oscillator.volume,this.amplitude.units=t.Type.NormalRange,this.amplitude.value=e.amplitude,this._stoppedSignal=new t.Signal(0,t.Type.AudioRange),this._zeros=new t.Zero,this._stoppedValue=0,this._a2g=new t.AudioToGain,this._scaler=this.output=new t.Scale(e.min,e.max),this._units=t.Type.Default,this.units=e.units,this._oscillator.chain(this._a2g,this._scaler),this._zeros.connect(this._a2g),this._stoppedSignal.connect(this._a2g),this._readOnly(["amplitude","frequency"]),this.phase=e.phase},t.extend(t.LFO,t.AudioNode),t.LFO.defaults={type:"sine",min:0,max:1,phase:0,frequency:"4n",amplitude:1,units:t.Type.Default},t.LFO.prototype.start=function(t){return t=this.toSeconds(t),this._stoppedSignal.setValueAtTime(0,t),this._oscillator.start(t),this},t.LFO.prototype.stop=function(t){return t=this.toSeconds(t),this._stoppedSignal.setValueAtTime(this._stoppedValue,t),this._oscillator.stop(t),this},t.LFO.prototype.sync=function(){return this._oscillator.sync(),this._oscillator.syncFrequency(),this},t.LFO.prototype.unsync=function(){return this._oscillator.unsync(),this._oscillator.unsyncFrequency(),this},Object.defineProperty(t.LFO.prototype,"min",{get:function(){return this._toUnits(this._scaler.min)},set:function(t){t=this._fromUnits(t),this._scaler.min=t}}),Object.defineProperty(t.LFO.prototype,"max",{get:function(){return this._toUnits(this._scaler.max)},set:function(t){t=this._fromUnits(t),this._scaler.max=t}}),Object.defineProperty(t.LFO.prototype,"type",{get:function(){return this._oscillator.type},set:function(t){this._oscillator.type=t,this._stoppedValue=this._oscillator._getInitialValue(),this._stoppedSignal.value=this._stoppedValue}}),Object.defineProperty(t.LFO.prototype,"phase",{get:function(){return this._oscillator.phase},set:function(t){this._oscillator.phase=t,this._stoppedValue=this._oscillator._getInitialValue(),this._stoppedSignal.value=this._stoppedValue}}),Object.defineProperty(t.LFO.prototype,"units",{get:function(){return this._units},set:function(t){var e=this.min,i=this.max;this._units=t,this.min=e,this.max=i}}),Object.defineProperty(t.LFO.prototype,"mute",{get:function(){return this._oscillator.mute},set:function(t){this._oscillator.mute=t}}),Object.defineProperty(t.LFO.prototype,"state",{get:function(){return this._oscillator.state}}),t.LFO.prototype.connect=function(e){return e.constructor!==t.Signal&&e.constructor!==t.Param||(this.convert=e.convert,this.units=e.units),t.SignalBase.prototype.connect.apply(this,arguments),this},t.LFO.prototype._fromUnits=t.Param.prototype._fromUnits,t.LFO.prototype._toUnits=t.Param.prototype._toUnits,t.LFO.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._writable(["amplitude","frequency"]),this._oscillator.dispose(),this._oscillator=null,this._stoppedSignal.dispose(),this._stoppedSignal=null,this._zeros.dispose(),this._zeros=null,this._scaler.dispose(),this._scaler=null,this._a2g.dispose(),this._a2g=null,this.frequency=null,this.amplitude=null,this},t.LFO}),i(function(t){return t.Limiter=function(){var e=t.defaults(arguments,["threshold"],t.Limiter);t.AudioNode.call(this),this._compressor=this.input=this.output=new t.Compressor({attack:.001,decay:.001,threshold:e.threshold}),this.threshold=this._compressor.threshold,this._readOnly("threshold")},t.extend(t.Limiter,t.AudioNode),t.Limiter.defaults={threshold:-12},t.Limiter.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._compressor.dispose(),this._compressor=null,this._writable("threshold"),this.threshold=null,this},t.Limiter}),i(function(t){return t.LowpassCombFilter=function(){var e=t.defaults(arguments,["delayTime","resonance","dampening"],t.LowpassCombFilter);t.AudioNode.call(this),this.createInsOuts(1,1),this._delay=this.input=new t.Delay(e.delayTime),this.delayTime=this._delay.delayTime,this._lowpass=this.output=this.context.createBiquadFilter(),this._lowpass.Q.value=-3.0102999566398125,this._lowpass.type="lowpass",this.dampening=new t.Param({param:this._lowpass.frequency,units:t.Type.Frequency,value:e.dampening}),this._feedback=new t.Gain(e.resonance,t.Type.NormalRange),this.resonance=this._feedback.gain,this._delay.chain(this._lowpass,this._feedback,this._delay),this._readOnly(["dampening","resonance","delayTime"])},t.extend(t.LowpassCombFilter,t.AudioNode),t.LowpassCombFilter.defaults={delayTime:.1,resonance:.5,dampening:3e3},t.LowpassCombFilter.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._writable(["dampening","resonance","delayTime"]),this.dampening.dispose(),this.dampening=null,this.resonance.dispose(),this.resonance=null,this._delay.dispose(),this._delay=null,this.delayTime=null,this._lowpass.disconnect(),this._lowpass=null,this._feedback.disconnect(),this._feedback=null,this},t.LowpassCombFilter}),i(function(t){return t.Merge=function(){t.AudioNode.call(this),this.createInsOuts(2,0),this.left=this.input[0]=new t.Gain,this.right=this.input[1]=new t.Gain,this._merger=this.output=this.context.createChannelMerger(2),this.left.connect(this._merger,0,0),this.right.connect(this._merger,0,1),this.left.channelCount=1,this.right.channelCount=1,this.left.channelCountMode="explicit",this.right.channelCountMode="explicit"},t.extend(t.Merge,t.AudioNode),t.Merge.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this.left.dispose(),this.left=null,this.right.dispose(),this.right=null,this._merger.disconnect(),this._merger=null,this},t.Merge}),i(function(t){return t.Meter=function(){var e=t.defaults(arguments,["smoothing"],t.Meter);t.AudioNode.call(this),this.input=this.output=this._analyser=new t.Analyser("waveform",1024),this.smoothing=e.smoothing},t.extend(t.Meter,t.AudioNode),t.Meter.defaults={smoothing:.8},t.Meter.prototype.getLevel=function(){this._analyser.type="fft";var t=this._analyser.getValue();return Math.max.apply(this,t)+28},t.Meter.prototype.getValue=function(){return this._analyser.type="waveform",this._analyser.getValue()[0]},Object.defineProperty(t.Meter.prototype,"smoothing",{get:function(){return this._analyser.smoothing},set:function(t){this._analyser.smoothing=t}}),t.Meter.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._analyser.dispose(),this._analyser=null,this},t.Meter}),i(function(t){return t.Split=function(){t.AudioNode.call(this),this.createInsOuts(0,2),this._splitter=this.input=this.context.createChannelSplitter(2),this._splitter.channelCount=2,this._splitter.channelCountMode="explicit",this.left=this.output[0]=new t.Gain,this.right=this.output[1]=new t.Gain,this._splitter.connect(this.left,0,0),this._splitter.connect(this.right,1,0)},t.extend(t.Split,t.AudioNode),t.Split.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._splitter.disconnect(),this.left.dispose(),this.left=null,this.right.dispose(),this.right=null,this._splitter=null,this},t.Split}),i(function(t){return t.MidSideSplit=function(){t.AudioNode.call(this),this.createInsOuts(0,2),this._split=this.input=new t.Split,this._midAdd=new t.Add,this.mid=this.output[0]=new t.Multiply(Math.SQRT1_2),this._sideSubtract=new t.Subtract,this.side=this.output[1]=new t.Multiply(Math.SQRT1_2),this._split.connect(this._midAdd,0,0),this._split.connect(this._midAdd,1,1),this._split.connect(this._sideSubtract,0,0),this._split.connect(this._sideSubtract,1,1),this._midAdd.connect(this.mid),this._sideSubtract.connect(this.side)},t.extend(t.MidSideSplit,t.AudioNode),t.MidSideSplit.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this.mid.dispose(),this.mid=null,this.side.dispose(),this.side=null,this._midAdd.dispose(),this._midAdd=null,this._sideSubtract.dispose(),this._sideSubtract=null,this._split.dispose(),this._split=null,this},t.MidSideSplit}),i(function(t){return t.MidSideMerge=function(){t.AudioNode.call(this),this.createInsOuts(2,0),this.mid=this.input[0]=new t.Gain,this._left=new t.Add,this._timesTwoLeft=new t.Multiply(Math.SQRT1_2),this.side=this.input[1]=new t.Gain,this._right=new t.Subtract,this._timesTwoRight=new t.Multiply(Math.SQRT1_2),this._merge=this.output=new t.Merge,this.mid.connect(this._left,0,0),this.side.connect(this._left,0,1),this.mid.connect(this._right,0,0),this.side.connect(this._right,0,1),this._left.connect(this._timesTwoLeft),this._right.connect(this._timesTwoRight),this._timesTwoLeft.connect(this._merge,0,0),this._timesTwoRight.connect(this._merge,0,1)},t.extend(t.MidSideMerge,t.AudioNode),t.MidSideMerge.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this.mid.dispose(),this.mid=null,this.side.dispose(),this.side=null,this._left.dispose(),this._left=null,this._timesTwoLeft.dispose(),this._timesTwoLeft=null,this._right.dispose(),this._right=null,this._timesTwoRight.dispose(),this._timesTwoRight=null,this._merge.dispose(),this._merge=null,this},t.MidSideMerge}),i(function(t){return t.MidSideCompressor=function(e){t.AudioNode.call(this),e=t.defaultArg(e,t.MidSideCompressor.defaults),this._midSideSplit=this.input=new t.MidSideSplit,this._midSideMerge=this.output=new t.MidSideMerge,this.mid=new t.Compressor(e.mid),this.side=new t.Compressor(e.side),this._midSideSplit.mid.chain(this.mid,this._midSideMerge.mid),this._midSideSplit.side.chain(this.side,this._midSideMerge.side),this._readOnly(["mid","side"])},t.extend(t.MidSideCompressor,t.AudioNode),t.MidSideCompressor.defaults={mid:{ratio:3,threshold:-24,release:.03,attack:.02,knee:16},side:{ratio:6,threshold:-30,release:.25,attack:.03,knee:10}},t.MidSideCompressor.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._writable(["mid","side"]),this.mid.dispose(),this.mid=null,this.side.dispose(),this.side=null,this._midSideSplit.dispose(),this._midSideSplit=null,this._midSideMerge.dispose(),this._midSideMerge=null,this},t.MidSideCompressor}),i(function(t){return t.Mono=function(){t.AudioNode.call(this),this.createInsOuts(1,0),this._merge=this.output=new t.Merge,this.input.connect(this._merge,0,0),this.input.connect(this._merge,0,1)},t.extend(t.Mono,t.AudioNode),t.Mono.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._merge.dispose(),this._merge=null,this},t.Mono}),i(function(t){return t.MultibandCompressor=function(e){t.AudioNode.call(this),e=t.defaultArg(arguments,t.MultibandCompressor.defaults),this._splitter=this.input=new t.MultibandSplit({lowFrequency:e.lowFrequency,highFrequency:e.highFrequency}),this.lowFrequency=this._splitter.lowFrequency,this.highFrequency=this._splitter.highFrequency,this.output=new t.Gain,this.low=new t.Compressor(e.low),this.mid=new t.Compressor(e.mid),this.high=new t.Compressor(e.high),this._splitter.low.chain(this.low,this.output),this._splitter.mid.chain(this.mid,this.output),this._splitter.high.chain(this.high,this.output),this._readOnly(["high","mid","low","highFrequency","lowFrequency"])},t.extend(t.MultibandCompressor,t.AudioNode),t.MultibandCompressor.defaults={low:t.Compressor.defaults,mid:t.Compressor.defaults,high:t.Compressor.defaults,lowFrequency:250,highFrequency:2e3},t.MultibandCompressor.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._splitter.dispose(),this._writable(["high","mid","low","highFrequency","lowFrequency"]),this.low.dispose(),this.mid.dispose(),this.high.dispose(),this._splitter=null,this.low=null,this.mid=null,this.high=null,this.lowFrequency=null,this.highFrequency=null,this},t.MultibandCompressor}),i(function(t){if(t.supported&&!window.StereoPannerNode){var e=function(e){this.context=e,this.pan=new t.Signal(0,t.Type.AudioRange);var i=new t.WaveShaper(function(e){return t.equalPowerScale((e+1)/2)},4096),n=new t.WaveShaper(function(e){return t.equalPowerScale(1-(e+1)/2)},4096),o=new t.Gain,r=new t.Gain,s=this.input=new t.Split;(new t.Zero).fan(i,n);var a=this.output=new t.Merge;s.left.chain(o,a.left),s.right.chain(r,a.right),this.pan.chain(n,o.gain),this.pan.chain(i,r.gain)};e.prototype.disconnect=function(){this.output.disconnect.apply(this.output,arguments)},e.prototype.connect=function(){this.output.connect.apply(this.output,arguments)},AudioContext.prototype.createStereoPanner=function(){return new e(this)},t.Context.prototype.createStereoPanner=function(){return new e(this)}}}),i(function(t){return t.Panner=function(e){t.AudioNode.call(this),this._panner=this.input=this.output=this.context.createStereoPanner(),this.pan=this._panner.pan,this.pan.value=t.defaultArg(e,0),this._readOnly("pan")},t.extend(t.Panner,t.AudioNode),t.Panner.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._writable("pan"),this._panner.disconnect(),this._panner=null,this.pan=null,this},t.Panner}),i(function(t){return t.Panner3D=function(){var e=t.defaults(arguments,["positionX","positionY","positionZ"],t.Panner3D);t.AudioNode.call(this),this._panner=this.input=this.output=this.context.createPanner(),this._panner.panningModel=e.panningModel,this._panner.maxDistance=e.maxDistance,this._panner.distanceModel=e.distanceModel,this._panner.coneOuterGain=e.coneOuterGain,this._panner.coneOuterAngle=e.coneOuterAngle,this._panner.coneInnerAngle=e.coneInnerAngle,this._panner.refDistance=e.refDistance,this._panner.rolloffFactor=e.rolloffFactor,this._orientation=[e.orientationX,e.orientationY,e.orientationZ],this._position=[e.positionX,e.positionY,e.positionZ],this.orientationX=e.orientationX,this.orientationY=e.orientationY,this.orientationZ=e.orientationZ,this.positionX=e.positionX,this.positionY=e.positionY,this.positionZ=e.positionZ},t.extend(t.Panner3D,t.AudioNode),t.Panner3D.defaults={positionX:0,positionY:0,positionZ:0,orientationX:0,orientationY:0,orientationZ:0,panningModel:"equalpower",maxDistance:1e4,distanceModel:"inverse",coneOuterGain:0,coneOuterAngle:360,coneInnerAngle:360,refDistance:1,rolloffFactor:1},t.Panner3D.prototype._rampTimeConstant=.01,t.Panner3D.prototype.setPosition=function(t,e,i){if(this._panner.positionX){var n=this.now();this._panner.positionX.setTargetAtTime(t,n,this._rampTimeConstant),this._panner.positionY.setTargetAtTime(e,n,this._rampTimeConstant),this._panner.positionZ.setTargetAtTime(i,n,this._rampTimeConstant)}else this._panner.setPosition(t,e,i);return this._position=Array.prototype.slice.call(arguments),this},t.Panner3D.prototype.setOrientation=function(t,e,i){if(this._panner.orientationX){var n=this.now();this._panner.orientationX.setTargetAtTime(t,n,this._rampTimeConstant),this._panner.orientationY.setTargetAtTime(e,n,this._rampTimeConstant),this._panner.orientationZ.setTargetAtTime(i,n,this._rampTimeConstant)}else this._panner.setOrientation(t,e,i);return this._orientation=Array.prototype.slice.call(arguments),this},Object.defineProperty(t.Panner3D.prototype,"positionX",{set:function(t){this._position[0]=t,this.setPosition.apply(this,this._position)},get:function(){return this._position[0]}}),Object.defineProperty(t.Panner3D.prototype,"positionY",{set:function(t){this._position[1]=t,this.setPosition.apply(this,this._position)},get:function(){return this._position[1]}}),Object.defineProperty(t.Panner3D.prototype,"positionZ",{set:function(t){this._position[2]=t,this.setPosition.apply(this,this._position)},get:function(){return this._position[2]}}),Object.defineProperty(t.Panner3D.prototype,"orientationX",{set:function(t){this._orientation[0]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[0]}}),Object.defineProperty(t.Panner3D.prototype,"orientationY",{set:function(t){this._orientation[1]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[1]}}),Object.defineProperty(t.Panner3D.prototype,"orientationZ",{set:function(t){this._orientation[2]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[2]}}),t.Panner3D._aliasProperty=function(e){Object.defineProperty(t.Panner3D.prototype,e,{set:function(t){this._panner[e]=t},get:function(){return this._panner[e]}})},t.Panner3D._aliasProperty("panningModel"),t.Panner3D._aliasProperty("refDistance"),t.Panner3D._aliasProperty("rolloffFactor"),t.Panner3D._aliasProperty("distanceModel"),t.Panner3D._aliasProperty("coneInnerAngle"),t.Panner3D._aliasProperty("coneOuterAngle"),t.Panner3D._aliasProperty("coneOuterGain"),t.Panner3D._aliasProperty("maxDistance"),t.Panner3D.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._panner.disconnect(),this._panner=null,this._orientation=null,this._position=null,this},t.Panner3D}),i(function(t){return t.PanVol=function(){var e=t.defaults(arguments,["pan","volume"],t.PanVol);t.AudioNode.call(this),this._panner=this.input=new t.Panner(e.pan),this.pan=this._panner.pan,this._volume=this.output=new t.Volume(e.volume),this.volume=this._volume.volume,this._panner.connect(this._volume),this.mute=e.mute,this._readOnly(["pan","volume"])},t.extend(t.PanVol,t.AudioNode),t.PanVol.defaults={pan:0,volume:0,mute:!1},Object.defineProperty(t.PanVol.prototype,"mute",{get:function(){return this._volume.mute},set:function(t){this._volume.mute=t}}),t.PanVol.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._writable(["pan","volume"]),this._panner.dispose(),this._panner=null,this.pan=null,this._volume.dispose(),this._volume=null,this.volume=null,this},t.PanVol}),i(function(t){return t.Solo=function(){var e=t.defaults(arguments,["solo"],t.Solo);t.AudioNode.call(this),this.input=this.output=new t.Gain,this._soloBind=this._soloed.bind(this),this.context.on("solo",this._soloBind),this.solo=e.solo},t.extend(t.Solo,t.AudioNode),t.Solo.defaults={solo:!1},Object.defineProperty(t.Solo.prototype,"solo",{get:function(){return this._isSoloed()},set:function(t){t?this._addSolo():this._removeSolo(),this.context.emit("solo",this)}}),Object.defineProperty(t.Solo.prototype,"muted",{get:function(){return 0===this.input.gain.value}}),t.Solo.prototype._addSolo=function(){t.isArray(this.context._currentSolo)||(this.context._currentSolo=[]),this._isSoloed()||this.context._currentSolo.push(this)},t.Solo.prototype._removeSolo=function(){if(this._isSoloed()){var t=this.context._currentSolo.indexOf(this);this.context._currentSolo.splice(t,1)}},t.Solo.prototype._isSoloed=function(){return!!t.isArray(this.context._currentSolo)&&0!==this.context._currentSolo.length&&-1!==this.context._currentSolo.indexOf(this)},t.Solo.prototype._noSolos=function(){return!t.isArray(this.context._currentSolo)||0===this.context._currentSolo.length},t.Solo.prototype._soloed=function(){this._isSoloed()?this.input.gain.value=1:this._noSolos()?this.input.gain.value=1:this.input.gain.value=0},t.Solo.prototype.dispose=function(){return this.context.off("solo",this._soloBind),this._removeSolo(),this._soloBind=null,t.AudioNode.prototype.dispose.call(this),this},t.Solo}),i(function(t){return t.Waveform=function(){var e=t.defaults(arguments,["size"],t.Waveform);e.type=t.Analyser.Type.Waveform,t.AudioNode.call(this),this._analyser=this.input=this.output=new t.Analyser(e)},t.extend(t.Waveform,t.AudioNode),t.Waveform.defaults={size:1024},t.Waveform.prototype.getValue=function(){return this._analyser.getValue()},Object.defineProperty(t.Waveform.prototype,"size",{get:function(){return this._analyser.size},set:function(t){this._analyser.size=t}}),t.Waveform.prototype.dispose=function(){t.AudioNode.prototype.dispose.call(this),this._analyser.dispose(),this._analyser=null},t.Waveform}),i(function(t){return t.CtrlInterpolate=function(){var e=t.defaults(arguments,["values","index"],t.CtrlInterpolate);t.call(this),this.values=e.values,this.index=e.index},t.extend(t.CtrlInterpolate),t.CtrlInterpolate.defaults={index:0,values:[]},Object.defineProperty(t.CtrlInterpolate.prototype,"value",{get:function(){var t=this.index;t=Math.min(t,this.values.length-1);var e=Math.floor(t),i=this.values[e],n=this.values[Math.ceil(t)];return this._interpolate(t-e,i,n)}}),t.CtrlInterpolate.prototype._interpolate=function(e,i,n){if(t.isArray(i)){for(var o=[],r=0;r<i.length;r++)o[r]=this._interpolate(e,i[r],n[r]);return o}if(t.isObject(i)){var s={};for(var a in i)s[a]=this._interpolate(e,i[a],n[a]);return s}return(1-e)*(i=this._toNumber(i))+e*(n=this._toNumber(n))},t.CtrlInterpolate.prototype._toNumber=function(e){return t.isNumber(e)?e:this.toSeconds(e)},t.CtrlInterpolate.prototype.dispose=function(){this.values=null},t.CtrlInterpolate}),i(function(t){return t.CtrlMarkov=function(e,i){t.call(this),this.values=t.defaultArg(e,{}),this.value=t.defaultArg(i,Object.keys(this.values)[0])},t.extend(t.CtrlMarkov),t.CtrlMarkov.prototype.next=function(){if(this.values.hasOwnProperty(this.value)){var e=this.values[this.value];if(t.isArray(e))for(var i=this._getProbDistribution(e),n=Math.random(),o=0,r=0;r<i.length;r++){var s=i[r];if(n>o&&n<o+s){var a=e[r];t.isObject(a)?this.value=a.value:this.value=a}o+=s}else this.value=e}return this.value},t.CtrlMarkov.prototype._getProbDistribution=function(e){for(var i=[],n=0,o=!1,r=0;r<e.length;r++){var s=e[r];t.isObject(s)?(o=!0,i[r]=s.probability):i[r]=1/e.length,n+=i[r]}if(o)for(var a=0;a<i.length;a++)i[a]=i[a]/n;return i},t.CtrlMarkov.prototype.dispose=function(){this.values=null},t.CtrlMarkov}),i(function(t){return t.CtrlPattern=function(){var e=t.defaults(arguments,["values","type"],t.CtrlPattern);t.call(this),this.values=e.values,this.index=0,this._type=null,this._shuffled=null,this._direction=null,this.type=e.type},t.extend(t.CtrlPattern),t.CtrlPattern.Type={Up:"up",Down:"down",UpDown:"upDown",DownUp:"downUp",AlternateUp:"alternateUp",AlternateDown:"alternateDown",Random:"random",RandomWalk:"randomWalk",RandomOnce:"randomOnce"},t.CtrlPattern.defaults={type:t.CtrlPattern.Type.Up,values:[]},Object.defineProperty(t.CtrlPattern.prototype,"value",{get:function(){if(0!==this.values.length){if(1===this.values.length)return this.values[0];this.index=Math.min(this.index,this.values.length-1);var e=this.values[this.index];return this.type===t.CtrlPattern.Type.RandomOnce&&(this.values.length!==this._shuffled.length&&this._shuffleValues(),e=this.values[this._shuffled[this.index]]),e}}}),Object.defineProperty(t.CtrlPattern.prototype,"type",{get:function(){return this._type},set:function(e){this._type=e,this._shuffled=null,this._type===t.CtrlPattern.Type.Up||this._type===t.CtrlPattern.Type.UpDown||this._type===t.CtrlPattern.Type.RandomOnce||this._type===t.CtrlPattern.Type.AlternateUp?this.index=0:this._type!==t.CtrlPattern.Type.Down&&this._type!==t.CtrlPattern.Type.DownUp&&this._type!==t.CtrlPattern.Type.AlternateDown||(this.index=this.values.length-1),this._type===t.CtrlPattern.Type.UpDown||this._type===t.CtrlPattern.Type.AlternateUp?this._direction=t.CtrlPattern.Type.Up:this._type!==t.CtrlPattern.Type.DownUp&&this._type!==t.CtrlPattern.Type.AlternateDown||(this._direction=t.CtrlPattern.Type.Down),this._type===t.CtrlPattern.Type.RandomOnce?this._shuffleValues():this._type===t.CtrlPattern.Random&&(this.index=Math.floor(Math.random()*this.values.length))}}),t.CtrlPattern.prototype.next=function(){var e=this.type;return e===t.CtrlPattern.Type.Up?(this.index++,this.index>=this.values.length&&(this.index=0)):e===t.CtrlPattern.Type.Down?(this.index--,this.index<0&&(this.index=this.values.length-1)):e===t.CtrlPattern.Type.UpDown||e===t.CtrlPattern.Type.DownUp?(this._direction===t.CtrlPattern.Type.Up?this.index++:this.index--,this.index<0?(this.index=1,this._direction=t.CtrlPattern.Type.Up):this.index>=this.values.length&&(this.index=this.values.length-2,this._direction=t.CtrlPattern.Type.Down)):e===t.CtrlPattern.Type.Random?this.index=Math.floor(Math.random()*this.values.length):e===t.CtrlPattern.Type.RandomWalk?Math.random()<.5?(this.index--,this.index=Math.max(this.index,0)):(this.index++,this.index=Math.min(this.index,this.values.length-1)):e===t.CtrlPattern.Type.RandomOnce?(this.index++,this.index>=this.values.length&&(this.index=0,this._shuffleValues())):e===t.CtrlPattern.Type.AlternateUp?(this._direction===t.CtrlPattern.Type.Up?(this.index+=2,this._direction=t.CtrlPattern.Type.Down):(this.index-=1,this._direction=t.CtrlPattern.Type.Up),this.index>=this.values.length&&(this.index=0,this._direction=t.CtrlPattern.Type.Up)):e===t.CtrlPattern.Type.AlternateDown&&(this._direction===t.CtrlPattern.Type.Up?(this.index+=1,this._direction=t.CtrlPattern.Type.Down):(this.index-=2,this._direction=t.CtrlPattern.Type.Up),this.index<0&&(this.index=this.values.length-1,this._direction=t.CtrlPattern.Type.Down)),this.value},t.CtrlPattern.prototype._shuffleValues=function(){var t=[];this._shuffled=[];for(var e=0;e<this.values.length;e++)t[e]=e;for(;t.length>0;){var i=t.splice(Math.floor(t.length*Math.random()),1);this._shuffled.push(i[0])}},t.CtrlPattern.prototype.dispose=function(){this._shuffled=null,this.values=null},t.CtrlPattern}),i(function(t){return t.CtrlRandom=function(){var e=t.defaults(arguments,["min","max"],t.CtrlRandom);t.call(this),this.min=e.min,this.max=e.max,this.integer=e.integer},t.extend(t.CtrlRandom),t.CtrlRandom.defaults={min:0,max:1,integer:!1},Object.defineProperty(t.CtrlRandom.prototype,"value",{get:function(){var t=this.toSeconds(this.min),e=this.toSeconds(this.max),i=Math.random(),n=i*t+(1-i)*e;return this.integer&&(n=Math.floor(n)),n}}),t.CtrlRandom}),i(function(t){return t.Buffers=function(e){var i=Array.prototype.slice.call(arguments);i.shift();var n=t.defaults(i,["onload","baseUrl"],t.Buffers);for(var o in t.call(this),this._buffers={},this.baseUrl=n.baseUrl,this._loadingCount=0,e)this._loadingCount++,this.add(o,e[o],this._bufferLoaded.bind(this,n.onload))},t.extend(t.Buffers),t.Buffers.defaults={onload:t.noOp,baseUrl:""},t.Buffers.prototype.has=function(t){return this._buffers.hasOwnProperty(t)},t.Buffers.prototype.get=function(t){if(this.has(t))return this._buffers[t];throw new Error("Tone.Buffers: no buffer named "+t)},t.Buffers.prototype._bufferLoaded=function(t){this._loadingCount--,0===this._loadingCount&&t&&t(this)},Object.defineProperty(t.Buffers.prototype,"loaded",{get:function(){var t=!0;for(var e in this._buffers){var i=this.get(e);t=t&&i.loaded}return t}}),t.Buffers.prototype.add=function(e,i,n){return n=t.defaultArg(n,t.noOp),i instanceof t.Buffer?(this._buffers[e]=i,n(this)):i instanceof AudioBuffer?(this._buffers[e]=new t.Buffer(i),n(this)):t.isString(i)&&(this._buffers[e]=new t.Buffer(this.baseUrl+i,n)),this},t.Buffers.prototype.dispose=function(){for(var e in t.prototype.dispose.call(this),this._buffers)this._buffers[e].dispose();return this._buffers=null,this},t.Buffers}),i(function(t){var e={};return t.prototype.send=function(i,n){e.hasOwnProperty(i)||(e[i]=this.context.createGain()),n=t.defaultArg(n,0);var o=new t.Gain(n,t.Type.Decibels);return this.connect(o),o.connect(e[i]),o},t.prototype.receive=function(t,i){return e.hasOwnProperty(t)||(e[t]=this.context.createGain()),e[t].connect(this,0,i),this},t.Context.on("init",function(t){t.Buses?e=t.Buses:(e={},t.Buses=e)}),t}),i(function(t){return t.Draw=function(){t.call(this),this._events=new t.Timeline,this.expiration=.25,this.anticipation=.008,this._boundDrawLoop=this._drawLoop.bind(this)},t.extend(t.Draw),t.Draw.prototype.schedule=function(t,e){return this._events.add({callback:t,time:this.toSeconds(e)}),1===this._events.length&&requestAnimationFrame(this._boundDrawLoop),this},t.Draw.prototype.cancel=function(t){return this._events.cancel(this.toSeconds(t)),this},t.Draw.prototype._drawLoop=function(){for(var e=t.now();this._events.length&&this._events.peek().time-this.anticipation<=e;){var i=this._events.shift();e-i.time<=this.expiration&&i.callback()}this._events.length>0&&requestAnimationFrame(this._boundDrawLoop)},t.Draw=new t.Draw,t.Draw}),i(function(t){t.Listener=function(){t.call(this),this._orientation=[0,0,0,0,0,0],this._position=[0,0,0],t.getContext(function(){this.set(e.defaults)}.bind(this))},t.extend(t.Listener),t.Listener.defaults={positionX:0,positionY:0,positionZ:0,forwardX:0,forwardY:0,forwardZ:1,upX:0,upY:1,upZ:0},t.Listener.prototype._rampTimeConstant=.01,t.Listener.prototype.setPosition=function(t,e,i){if(this.context.listener.positionX){var n=this.now();this.context.listener.positionX.setTargetAtTime(t,n,this._rampTimeConstant),this.context.listener.positionY.setTargetAtTime(e,n,this._rampTimeConstant),this.context.listener.positionZ.setTargetAtTime(i,n,this._rampTimeConstant)}else this.context.listener.setPosition(t,e,i);return this._position=Array.prototype.slice.call(arguments),this},t.Listener.prototype.setOrientation=function(t,e,i,n,o,r){if(this.context.listener.forwardX){var s=this.now();this.context.listener.forwardX.setTargetAtTime(t,s,this._rampTimeConstant),this.context.listener.forwardY.setTargetAtTime(e,s,this._rampTimeConstant),this.context.listener.forwardZ.setTargetAtTime(i,s,this._rampTimeConstant),this.context.listener.upX.setTargetAtTime(n,s,this._rampTimeConstant),this.context.listener.upY.setTargetAtTime(o,s,this._rampTimeConstant),this.context.listener.upZ.setTargetAtTime(r,s,this._rampTimeConstant)}else this.context.listener.setOrientation(t,e,i,n,o,r);return this._orientation=Array.prototype.slice.call(arguments),this},Object.defineProperty(t.Listener.prototype,"positionX",{set:function(t){this._position[0]=t,this.setPosition.apply(this,this._position)},get:function(){return this._position[0]}}),Object.defineProperty(t.Listener.prototype,"positionY",{set:function(t){this._position[1]=t,this.setPosition.apply(this,this._position)},get:function(){return this._position[1]}}),Object.defineProperty(t.Listener.prototype,"positionZ",{set:function(t){this._position[2]=t,this.setPosition.apply(this,this._position)},get:function(){return this._position[2]}}),Object.defineProperty(t.Listener.prototype,"forwardX",{set:function(t){this._orientation[0]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[0]}}),Object.defineProperty(t.Listener.prototype,"forwardY",{set:function(t){this._orientation[1]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[1]}}),Object.defineProperty(t.Listener.prototype,"forwardZ",{set:function(t){this._orientation[2]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[2]}}),Object.defineProperty(t.Listener.prototype,"upX",{set:function(t){this._orientation[3]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[3]}}),Object.defineProperty(t.Listener.prototype,"upY",{set:function(t){this._orientation[4]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[4]}}),Object.defineProperty(t.Listener.prototype,"upZ",{set:function(t){this._orientation[5]=t,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[5]}}),t.Listener.prototype.dispose=function(){return this._orientation=null,this._position=null,this};var e=t.Listener;return t.Listener=new e,t.Context.on("init",function(i){i.Listener instanceof e?t.Listener=i.Listener:t.Listener=new e,i.Listener=t.Listener}),t.Listener}),i(function(t){return t.Offline=function(e,i){var n,o=t.context.sampleRate,r=t.context,s=function e(i,n,o,r){r=t.defaultArg(r,0);var s=new t.OfflineContext(2,n,o);t.context=s;var a=i(t.Transport);return s.currentTime>0&&r<1e3?e(i,n,o,++r):{response:a,context:s}}(e,i,o),a=s.response,l=s.context;return n=a instanceof Promise?a.then(function(){return l.render()}):l.render(),t.context=r,n.then(function(e){return new t.Buffer(e)})},t.Offline}),i(function(t){return t.Effect=function(){var e=t.defaults(arguments,["wet"],t.Effect);t.AudioNode.call(this),this.createInsOuts(1,1),this._dryWet=new t.CrossFade(e.wet),this.wet=this._dryWet.fade,this.effectSend=new t.Gain,this.effectReturn=new t.Gain,this.input.connect(this._dryWet.a),this.input.connect(this.effectSend),this.effectReturn.connect(this._dryWet.b),this._dryWet.connect(this.output),this._readOnly(["wet"])},t.extend(t.Effect,t.AudioNode),t.Effect.defaults={wet:1},t.Effect.prototype.connectEffect=function(t){return this.effectSend.chain(t,this.effectReturn),this},t.Effect.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._dryWet.dispose(),this._dryWet=null,this.effectSend.dispose(),this.effectSend=null,this.effectReturn.dispose(),this.effectReturn=null,this._writable(["wet"]),this.wet=null,this},t.Effect}),i(function(t){return t.AutoFilter=function(){var e=t.defaults(arguments,["frequency","baseFrequency","octaves"],t.AutoFilter);t.Effect.call(this,e),this._lfo=new t.LFO({frequency:e.frequency,amplitude:e.depth}),this.depth=this._lfo.amplitude,this.frequency=this._lfo.frequency,this.filter=new t.Filter(e.filter),this._octaves=0,this.connectEffect(this.filter),this._lfo.connect(this.filter.frequency),this.type=e.type,this._readOnly(["frequency","depth"]),this.octaves=e.octaves,this.baseFrequency=e.baseFrequency},t.extend(t.AutoFilter,t.Effect),t.AutoFilter.defaults={frequency:1,type:"sine",depth:1,baseFrequency:200,octaves:2.6,filter:{type:"lowpass",rolloff:-12,Q:1}},t.AutoFilter.prototype.start=function(t){return this._lfo.start(t),this},t.AutoFilter.prototype.stop=function(t){return this._lfo.stop(t),this},t.AutoFilter.prototype.sync=function(t){return this._lfo.sync(t),this},t.AutoFilter.prototype.unsync=function(){return this._lfo.unsync(),this},Object.defineProperty(t.AutoFilter.prototype,"type",{get:function(){return this._lfo.type},set:function(t){this._lfo.type=t}}),Object.defineProperty(t.AutoFilter.prototype,"baseFrequency",{get:function(){return this._lfo.min},set:function(t){this._lfo.min=this.toFrequency(t),this.octaves=this._octaves}}),Object.defineProperty(t.AutoFilter.prototype,"octaves",{get:function(){return this._octaves},set:function(t){this._octaves=t,this._lfo.max=this.baseFrequency*Math.pow(2,t)}}),t.AutoFilter.prototype.dispose=function(){return t.Effect.prototype.dispose.call(this),this._lfo.dispose(),this._lfo=null,this.filter.dispose(),this.filter=null,this._writable(["frequency","depth"]),this.frequency=null,this.depth=null,this},t.AutoFilter}),i(function(t){return t.AutoPanner=function(){var e=t.defaults(arguments,["frequency"],t.AutoPanner);t.Effect.call(this,e),this._lfo=new t.LFO({frequency:e.frequency,amplitude:e.depth,min:-1,max:1}),this.depth=this._lfo.amplitude,this._panner=new t.Panner,this.frequency=this._lfo.frequency,this.connectEffect(this._panner),this._lfo.connect(this._panner.pan),this.type=e.type,this._readOnly(["depth","frequency"])},t.extend(t.AutoPanner,t.Effect),t.AutoPanner.defaults={frequency:1,type:"sine",depth:1},t.AutoPanner.prototype.start=function(t){return this._lfo.start(t),this},t.AutoPanner.prototype.stop=function(t){return this._lfo.stop(t),this},t.AutoPanner.prototype.sync=function(t){return this._lfo.sync(t),this},t.AutoPanner.prototype.unsync=function(){return this._lfo.unsync(),this},Object.defineProperty(t.AutoPanner.prototype,"type",{get:function(){return this._lfo.type},set:function(t){this._lfo.type=t}}),t.AutoPanner.prototype.dispose=function(){return t.Effect.prototype.dispose.call(this),this._lfo.dispose(),this._lfo=null,this._panner.dispose(),this._panner=null,this._writable(["depth","frequency"]),this.frequency=null,this.depth=null,this},t.AutoPanner}),i(function(t){return t.AutoWah=function(){var e=t.defaults(arguments,["baseFrequency","octaves","sensitivity"],t.AutoWah);t.Effect.call(this,e),this.follower=new t.Follower(e.follower),this._sweepRange=new t.ScaleExp(0,1,.5),this._baseFrequency=e.baseFrequency,this._octaves=e.octaves,this._inputBoost=new t.Gain,this._bandpass=new t.Filter({rolloff:-48,frequency:0,Q:e.Q}),this._peaking=new t.Filter(0,"peaking"),this._peaking.gain.value=e.gain,this.gain=this._peaking.gain,this.Q=this._bandpass.Q,this.effectSend.chain(this._inputBoost,this.follower,this._sweepRange),this._sweepRange.connect(this._bandpass.frequency),this._sweepRange.connect(this._peaking.frequency),this.effectSend.chain(this._bandpass,this._peaking,this.effectReturn),this._setSweepRange(),this.sensitivity=e.sensitivity,this._readOnly(["gain","Q"])},t.extend(t.AutoWah,t.Effect),t.AutoWah.defaults={baseFrequency:100,octaves:6,sensitivity:0,Q:2,gain:2,follower:{attack:.3,release:.5}},Object.defineProperty(t.AutoWah.prototype,"octaves",{get:function(){return this._octaves},set:function(t){this._octaves=t,this._setSweepRange()}}),Object.defineProperty(t.AutoWah.prototype,"baseFrequency",{get:function(){return this._baseFrequency},set:function(t){this._baseFrequency=t,this._setSweepRange()}}),Object.defineProperty(t.AutoWah.prototype,"sensitivity",{get:function(){return t.gainToDb(1/this._inputBoost.gain.value)},set:function(e){this._inputBoost.gain.value=1/t.dbToGain(e)}}),t.AutoWah.prototype._setSweepRange=function(){this._sweepRange.min=this._baseFrequency,this._sweepRange.max=Math.min(this._baseFrequency*Math.pow(2,this._octaves),this.context.sampleRate/2)},t.AutoWah.prototype.dispose=function(){return t.Effect.prototype.dispose.call(this),this.follower.dispose(),this.follower=null,this._sweepRange.dispose(),this._sweepRange=null,this._bandpass.dispose(),this._bandpass=null,this._peaking.dispose(),this._peaking=null,this._inputBoost.dispose(),this._inputBoost=null,this._writable(["gain","Q"]),this.gain=null,this.Q=null,this},t.AutoWah}),i(function(t){return t.Modulo=function(e){t.SignalBase.call(this),this.createInsOuts(1,0),this._shaper=new t.WaveShaper(Math.pow(2,16)),this._multiply=new t.Multiply,this._subtract=this.output=new t.Subtract,this._modSignal=new t.Signal(e),this.input.fan(this._shaper,this._subtract),this._modSignal.connect(this._multiply,0,0),this._shaper.connect(this._multiply,0,1),this._multiply.connect(this._subtract,0,1),this._setWaveShaper(e)},t.extend(t.Modulo,t.SignalBase),t.Modulo.prototype._setWaveShaper=function(t){this._shaper.setMap(function(e){return Math.floor((e+1e-4)/t)})},Object.defineProperty(t.Modulo.prototype,"value",{get:function(){return this._modSignal.value},set:function(t){this._modSignal.value=t,this._setWaveShaper(t)}}),t.Modulo.prototype.dispose=function(){return t.SignalBase.prototype.dispose.call(this),this._shaper.dispose(),this._shaper=null,this._multiply.dispose(),this._multiply=null,this._subtract.dispose(),this._subtract=null,this._modSignal.dispose(),this._modSignal=null,this},t.Modulo}),i(function(t){return t.BitCrusher=function(){var e=t.defaults(arguments,["bits"],t.BitCrusher);t.Effect.call(this,e);var i=1/Math.pow(2,e.bits-1);this._subtract=new t.Subtract,this._modulo=new t.Modulo(i),this._bits=e.bits,this.effectSend.fan(this._subtract,this._modulo),this._modulo.connect(this._subtract,0,1),this._subtract.connect(this.effectReturn)},t.extend(t.BitCrusher,t.Effect),t.BitCrusher.defaults={bits:4},Object.defineProperty(t.BitCrusher.prototype,"bits",{get:function(){return this._bits},set:function(t){this._bits=t;var e=1/Math.pow(2,t-1);this._modulo.value=e}}),t.BitCrusher.prototype.dispose=function(){return t.Effect.prototype.dispose.call(this),this._subtract.dispose(),this._subtract=null,this._modulo.dispose(),this._modulo=null,this},t.BitCrusher}),i(function(t){return t.Chebyshev=function(){var e=t.defaults(arguments,["order"],t.Chebyshev);t.Effect.call(this,e),this._shaper=new t.WaveShaper(4096),this._order=e.order,this.connectEffect(this._shaper),this.order=e.order,this.oversample=e.oversample},t.extend(t.Chebyshev,t.Effect),t.Chebyshev.defaults={order:1,oversample:"none"},t.Chebyshev.prototype._getCoefficient=function(t,e,i){return i.hasOwnProperty(e)?i[e]:(i[e]=0===e?0:1===e?t:2*t*this._getCoefficient(t,e-1,i)-this._getCoefficient(t,e-2,i),i[e])},Object.defineProperty(t.Chebyshev.prototype,"order",{get:function(){return this._order},set:function(t){this._order=t;for(var e=new Array(4096),i=e.length,n=0;n<i;++n){var o=2*n/i-1;e[n]=0===o?0:this._getCoefficient(o,t,{})}this._shaper.curve=e}}),Object.defineProperty(t.Chebyshev.prototype,"oversample",{get:function(){return this._shaper.oversample},set:function(t){this._shaper.oversample=t}}),t.Chebyshev.prototype.dispose=function(){return t.Effect.prototype.dispose.call(this),this._shaper.dispose(),this._shaper=null,this},t.Chebyshev}),i(function(t){return t.StereoEffect=function(){t.AudioNode.call(this);var e=t.defaults(arguments,["wet"],t.Effect);this.createInsOuts(1,1),this._dryWet=new t.CrossFade(e.wet),this.wet=this._dryWet.fade,this._split=new t.Split,this.effectSendL=this._split.left,this.effectSendR=this._split.right,this._merge=new t.Merge,this.effectReturnL=this._merge.left,this.effectReturnR=this._merge.right,this.input.connect(this._split),this.input.connect(this._dryWet,0,0),this._merge.connect(this._dryWet,0,1),this._dryWet.connect(this.output),this._readOnly(["wet"])},t.extend(t.StereoEffect,t.Effect),t.StereoEffect.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._dryWet.dispose(),this._dryWet=null,this._split.dispose(),this._split=null,this._merge.dispose(),this._merge=null,this.effectSendL=null,this.effectSendR=null,this.effectReturnL=null,this.effectReturnR=null,this._writable(["wet"]),this.wet=null,this},t.StereoEffect}),i(function(t){return t.Chorus=function(){var e=t.defaults(arguments,["frequency","delayTime","depth"],t.Chorus);t.StereoEffect.call(this,e),this._depth=e.depth,this._delayTime=e.delayTime/1e3,this._lfoL=new t.LFO({frequency:e.frequency,min:0,max:1}),this._lfoR=new t.LFO({frequency:e.frequency,min:0,max:1,phase:180}),this._delayNodeL=new t.Delay,this._delayNodeR=new t.Delay,this.frequency=this._lfoL.frequency,this.effectSendL.chain(this._delayNodeL,this.effectReturnL),this.effectSendR.chain(this._delayNodeR,this.effectReturnR),this.effectSendL.connect(this.effectReturnL),this.effectSendR.connect(this.effectReturnR),this._lfoL.connect(this._delayNodeL.delayTime),this._lfoR.connect(this._delayNodeR.delayTime),this._lfoL.start(),this._lfoR.start(),this._lfoL.frequency.connect(this._lfoR.frequency),this.depth=this._depth,this.frequency.value=e.frequency,this.type=e.type,this._readOnly(["frequency"]),this.spread=e.spread},t.extend(t.Chorus,t.StereoEffect),t.Chorus.defaults={frequency:1.5,delayTime:3.5,depth:.7,type:"sine",spread:180},Object.defineProperty(t.Chorus.prototype,"depth",{get:function(){return this._depth},set:function(t){this._depth=t;var e=this._delayTime*t;this._lfoL.min=Math.max(this._delayTime-e,0),this._lfoL.max=this._delayTime+e,this._lfoR.min=Math.max(this._delayTime-e,0),this._lfoR.max=this._delayTime+e}}),Object.defineProperty(t.Chorus.prototype,"delayTime",{get:function(){return 1e3*this._delayTime},set:function(t){this._delayTime=t/1e3,this.depth=this._depth}}),Object.defineProperty(t.Chorus.prototype,"type",{get:function(){return this._lfoL.type},set:function(t){this._lfoL.type=t,this._lfoR.type=t}}),Object.defineProperty(t.Chorus.prototype,"spread",{get:function(){return this._lfoR.phase-this._lfoL.phase},set:function(t){this._lfoL.phase=90-t/2,this._lfoR.phase=t/2+90}}),t.Chorus.prototype.dispose=function(){return t.StereoEffect.prototype.dispose.call(this),this._lfoL.dispose(),this._lfoL=null,this._lfoR.dispose(),this._lfoR=null,this._delayNodeL.dispose(),this._delayNodeL=null,this._delayNodeR.dispose(),this._delayNodeR=null,this._writable("frequency"),this.frequency=null,this},t.Chorus}),i(function(t){return t.Convolver=function(){var e=t.defaults(arguments,["url","onload"],t.Convolver);t.Effect.call(this,e),this._convolver=this.context.createConvolver(),this._buffer=new t.Buffer(e.url,function(t){this._convolver.buffer=t.get(),e.onload()}.bind(this)),this.connectEffect(this._convolver)},t.extend(t.Convolver,t.Effect),t.Convolver.defaults={onload:t.noOp},Object.defineProperty(t.Convolver.prototype,"buffer",{get:function(){return this._buffer.get()},set:function(t){this._buffer.set(t),this._convolver.buffer=this._buffer.get()}}),t.Convolver.prototype.load=function(t,e){return this._buffer.load(t,function(t){this.buffer=t,e&&e()}.bind(this))},t.Convolver.prototype.dispose=function(){return t.Effect.prototype.dispose.call(this),this._convolver.disconnect(),this._convolver=null,this._buffer.dispose(),this._buffer=null,this},t.Convolver}),i(function(t){return t.Distortion=function(){var e=t.defaults(arguments,["distortion"],t.Distortion);t.Effect.call(this,e),this._shaper=new t.WaveShaper(4096),this._distortion=e.distortion,this.connectEffect(this._shaper),this.distortion=e.distortion,this.oversample=e.oversample},t.extend(t.Distortion,t.Effect),t.Distortion.defaults={distortion:.4,oversample:"none"},Object.defineProperty(t.Distortion.prototype,"distortion",{get:function(){return this._distortion},set:function(t){this._distortion=t;var e=100*t,i=Math.PI/180;this._shaper.setMap(function(t){return Math.abs(t)<.001?0:(3+e)*t*20*i/(Math.PI+e*Math.abs(t))})}}),Object.defineProperty(t.Distortion.prototype,"oversample",{get:function(){return this._shaper.oversample},set:function(t){this._shaper.oversample=t}}),t.Distortion.prototype.dispose=function(){return t.Effect.prototype.dispose.call(this),this._shaper.dispose(),this._shaper=null,this},t.Distortion}),i(function(t){return t.FeedbackEffect=function(){var e=t.defaults(arguments,["feedback"],t.FeedbackEffect);t.Effect.call(this,e),this._feedbackGain=new t.Gain(e.feedback,t.Type.NormalRange),this.feedback=this._feedbackGain.gain,this.effectReturn.chain(this._feedbackGain,this.effectSend),this._readOnly(["feedback"])},t.extend(t.FeedbackEffect,t.Effect),t.FeedbackEffect.defaults={feedback:.125},t.FeedbackEffect.prototype.dispose=function(){return t.Effect.prototype.dispose.call(this),this._writable(["feedback"]),this._feedbackGain.dispose(),this._feedbackGain=null,this.feedback=null,this},t.FeedbackEffect}),i(function(t){return t.FeedbackDelay=function(){var e=t.defaults(arguments,["delayTime","feedback"],t.FeedbackDelay);t.FeedbackEffect.call(this,e),this._delayNode=new t.Delay(e.delayTime,e.maxDelay),this.delayTime=this._delayNode.delayTime,this.connectEffect(this._delayNode),this._readOnly(["delayTime"])},t.extend(t.FeedbackDelay,t.FeedbackEffect),t.FeedbackDelay.defaults={delayTime:.25,maxDelay:1},t.FeedbackDelay.prototype.dispose=function(){return t.FeedbackEffect.prototype.dispose.call(this),this._delayNode.dispose(),this._delayNode=null,this._writable(["delayTime"]),this.delayTime=null,this},t.FeedbackDelay}),i(function(t){var e=[1557/44100,1617/44100,1491/44100,1422/44100,1277/44100,1356/44100,1188/44100,1116/44100],i=[225,556,441,341];return t.Freeverb=function(){var n=t.defaults(arguments,["roomSize","dampening"],t.Freeverb);t.StereoEffect.call(this,n),this.roomSize=new t.Signal(n.roomSize,t.Type.NormalRange),this.dampening=new t.Signal(n.dampening,t.Type.Frequency),this._combFilters=[],this._allpassFiltersL=[],this._allpassFiltersR=[];for(var o=0;o<i.length;o++){var r=this.context.createBiquadFilter();r.type="allpass",r.frequency.value=i[o],this._allpassFiltersL.push(r)}for(var s=0;s<i.length;s++){var a=this.context.createBiquadFilter();a.type="allpass",a.frequency.value=i[s],this._allpassFiltersR.push(a)}for(var l=0;l<e.length;l++){var u=new t.LowpassCombFilter(e[l]);l<e.length/2?this.effectSendL.chain(u,this._allpassFiltersL[0]):this.effectSendR.chain(u,this._allpassFiltersR[0]),this.roomSize.connect(u.resonance),this.dampening.connect(u.dampening),this._combFilters.push(u)}t.connectSeries.apply(t,this._allpassFiltersL),t.connectSeries.apply(t,this._allpassFiltersR),this._allpassFiltersL[this._allpassFiltersL.length-1].connect(this.effectReturnL),this._allpassFiltersR[this._allpassFiltersR.length-1].connect(this.effectReturnR),this._readOnly(["roomSize","dampening"])},t.extend(t.Freeverb,t.StereoEffect),t.Freeverb.defaults={roomSize:.7,dampening:3e3},t.Freeverb.prototype.dispose=function(){t.StereoEffect.prototype.dispose.call(this);for(var e=0;e<this._allpassFiltersL.length;e++)this._allpassFiltersL[e].disconnect(),this._allpassFiltersL[e]=null;this._allpassFiltersL=null;for(var i=0;i<this._allpassFiltersR.length;i++)this._allpassFiltersR[i].disconnect(),this._allpassFiltersR[i]=null;this._allpassFiltersR=null;for(var n=0;n<this._combFilters.length;n++)this._combFilters[n].dispose(),this._combFilters[n]=null;return this._combFilters=null,this._writable(["roomSize","dampening"]),this.roomSize.dispose(),this.roomSize=null,this.dampening.dispose(),this.dampening=null,this},t.Freeverb}),i(function(t){var e=[.06748,.06404,.08212,.09004],i=[.773,.802,.753,.733],n=[347,113,37];return t.JCReverb=function(){var o=t.defaults(arguments,["roomSize"],t.JCReverb);t.StereoEffect.call(this,o),this.roomSize=new t.Signal(o.roomSize,t.Type.NormalRange),this._scaleRoomSize=new t.Scale(-.733,.197),this._allpassFilters=[],this._feedbackCombFilters=[];for(var r=0;r<n.length;r++){var s=this.context.createBiquadFilter();s.type="allpass",s.frequency.value=n[r],this._allpassFilters.push(s)}for(var a=0;a<e.length;a++){var l=new t.FeedbackCombFilter(e[a],.1);this._scaleRoomSize.connect(l.resonance),l.resonance.value=i[a],this._allpassFilters[this._allpassFilters.length-1].connect(l),a<e.length/2?l.connect(this.effectReturnL):l.connect(this.effectReturnR),this._feedbackCombFilters.push(l)}this.roomSize.connect(this._scaleRoomSize),t.connectSeries.apply(t,this._allpassFilters),this.effectSendL.connect(this._allpassFilters[0]),this.effectSendR.connect(this._allpassFilters[0]),this._readOnly(["roomSize"])},t.extend(t.JCReverb,t.StereoEffect),t.JCReverb.defaults={roomSize:.5},t.JCReverb.prototype.dispose=function(){t.StereoEffect.prototype.dispose.call(this);for(var e=0;e<this._allpassFilters.length;e++)this._allpassFilters[e].disconnect(),this._allpassFilters[e]=null;this._allpassFilters=null;for(var i=0;i<this._feedbackCombFilters.length;i++)this._feedbackCombFilters[i].dispose(),this._feedbackCombFilters[i]=null;return this._feedbackCombFilters=null,this._writable(["roomSize"]),this.roomSize.dispose(),this.roomSize=null,this._scaleRoomSize.dispose(),this._scaleRoomSize=null,this},t.JCReverb}),i(function(t){return t.MidSideEffect=function(){t.Effect.apply(this,arguments),this._midSideSplit=new t.MidSideSplit,this._midSideMerge=new t.MidSideMerge,this.midSend=this._midSideSplit.mid,this.sideSend=this._midSideSplit.side,this.midReturn=this._midSideMerge.mid,this.sideReturn=this._midSideMerge.side,this.effectSend.connect(this._midSideSplit),this._midSideMerge.connect(this.effectReturn)},t.extend(t.MidSideEffect,t.Effect),t.MidSideEffect.prototype.dispose=function(){return t.Effect.prototype.dispose.call(this),this._midSideSplit.dispose(),this._midSideSplit=null,this._midSideMerge.dispose(),this._midSideMerge=null,this.midSend=null,this.sideSend=null,this.midReturn=null,this.sideReturn=null,this},t.MidSideEffect}),i(function(t){return t.Phaser=function(){var e=t.defaults(arguments,["frequency","octaves","baseFrequency"],t.Phaser);t.StereoEffect.call(this,e),this._lfoL=new t.LFO(e.frequency,0,1),this._lfoR=new t.LFO(e.frequency,0,1),this._lfoR.phase=180,this._baseFrequency=e.baseFrequency,this._octaves=e.octaves,this.Q=new t.Signal(e.Q,t.Type.Positive),this._filtersL=this._makeFilters(e.stages,this._lfoL,this.Q),this._filtersR=this._makeFilters(e.stages,this._lfoR,this.Q),this.frequency=this._lfoL.frequency,this.frequency.value=e.frequency,this.effectSendL.connect(this._filtersL[0]),this.effectSendR.connect(this._filtersR[0]),this._filtersL[e.stages-1].connect(this.effectReturnL),this._filtersR[e.stages-1].connect(this.effectReturnR),this._lfoL.frequency.connect(this._lfoR.frequency),this.baseFrequency=e.baseFrequency,this.octaves=e.octaves,this._lfoL.start(),this._lfoR.start(),this._readOnly(["frequency","Q"])},t.extend(t.Phaser,t.StereoEffect),t.Phaser.defaults={frequency:.5,octaves:3,stages:10,Q:10,baseFrequency:350},t.Phaser.prototype._makeFilters=function(e,i,n){for(var o=new Array(e),r=0;r<e;r++){var s=this.context.createBiquadFilter();s.type="allpass",n.connect(s.Q),i.connect(s.frequency),o[r]=s}return t.connectSeries.apply(t,o),o},Object.defineProperty(t.Phaser.prototype,"octaves",{get:function(){return this._octaves},set:function(t){this._octaves=t;var e=this._baseFrequency*Math.pow(2,t);this._lfoL.max=e,this._lfoR.max=e}}),Object.defineProperty(t.Phaser.prototype,"baseFrequency",{get:function(){return this._baseFrequency},set:function(t){this._baseFrequency=t,this._lfoL.min=t,this._lfoR.min=t,this.octaves=this._octaves}}),t.Phaser.prototype.dispose=function(){t.StereoEffect.prototype.dispose.call(this),this._writable(["frequency","Q"]),this.Q.dispose(),this.Q=null,this._lfoL.dispose(),this._lfoL=null,this._lfoR.dispose(),this._lfoR=null;for(var e=0;e<this._filtersL.length;e++)this._filtersL[e].disconnect(),this._filtersL[e]=null;this._filtersL=null;for(var i=0;i<this._filtersR.length;i++)this._filtersR[i].disconnect(),this._filtersR[i]=null;return this._filtersR=null,this.frequency=null,this},t.Phaser}),i(function(t){return t.StereoXFeedbackEffect=function(){var e=t.defaults(arguments,["feedback"],t.FeedbackEffect);t.StereoEffect.call(this,e),this.feedback=new t.Signal(e.feedback,t.Type.NormalRange),this._feedbackLR=new t.Gain,this._feedbackRL=new t.Gain,this.effectReturnL.chain(this._feedbackLR,this.effectSendR),this.effectReturnR.chain(this._feedbackRL,this.effectSendL),this.feedback.fan(this._feedbackLR.gain,this._feedbackRL.gain),this._readOnly(["feedback"])},t.extend(t.StereoXFeedbackEffect,t.StereoEffect),t.StereoXFeedbackEffect.prototype.dispose=function(){return t.StereoEffect.prototype.dispose.call(this),this._writable(["feedback"]),this.feedback.dispose(),this.feedback=null,this._feedbackLR.dispose(),this._feedbackLR=null,this._feedbackRL.dispose(),this._feedbackRL=null,this},t.StereoXFeedbackEffect}),i(function(t){return t.PingPongDelay=function(){var e=t.defaults(arguments,["delayTime","feedback"],t.PingPongDelay);t.StereoXFeedbackEffect.call(this,e),this._leftDelay=new t.Delay(0,e.maxDelayTime),this._rightDelay=new t.Delay(0,e.maxDelayTime),this._rightPreDelay=new t.Delay(0,e.maxDelayTime),this.delayTime=new t.Signal(e.delayTime,t.Type.Time),this.effectSendL.chain(this._leftDelay,this.effectReturnL),this.effectSendR.chain(this._rightPreDelay,this._rightDelay,this.effectReturnR),this.delayTime.fan(this._leftDelay.delayTime,this._rightDelay.delayTime,this._rightPreDelay.delayTime),this._feedbackLR.disconnect(),this._feedbackLR.connect(this._rightDelay),this._readOnly(["delayTime"])},t.extend(t.PingPongDelay,t.StereoXFeedbackEffect),t.PingPongDelay.defaults={delayTime:.25,maxDelayTime:1},t.PingPongDelay.prototype.dispose=function(){return t.StereoXFeedbackEffect.prototype.dispose.call(this),this._leftDelay.dispose(),this._leftDelay=null,this._rightDelay.dispose(),this._rightDelay=null,this._rightPreDelay.dispose(),this._rightPreDelay=null,this._writable(["delayTime"]),this.delayTime.dispose(),this.delayTime=null,this},t.PingPongDelay}),i(function(t){return t.PitchShift=function(){var e=t.defaults(arguments,["pitch"],t.PitchShift);t.FeedbackEffect.call(this,e),this._frequency=new t.Signal(0),this._delayA=new t.Delay(0,1),this._lfoA=new t.LFO({min:0,max:.1,type:"sawtooth"}).connect(this._delayA.delayTime),this._delayB=new t.Delay(0,1),this._lfoB=new t.LFO({min:0,max:.1,type:"sawtooth",phase:180}).connect(this._delayB.delayTime),this._crossFade=new t.CrossFade,this._crossFadeLFO=new t.LFO({min:0,max:1,type:"triangle",phase:90}).connect(this._crossFade.fade),this._feedbackDelay=new t.Delay(e.delayTime),this.delayTime=this._feedbackDelay.delayTime,this._readOnly("delayTime"),this._pitch=e.pitch,this._windowSize=e.windowSize,this._delayA.connect(this._crossFade.a),this._delayB.connect(this._crossFade.b),this._frequency.fan(this._lfoA.frequency,this._lfoB.frequency,this._crossFadeLFO.frequency),this.effectSend.fan(this._delayA,this._delayB),this._crossFade.chain(this._feedbackDelay,this.effectReturn);var i=this.now();this._lfoA.start(i),this._lfoB.start(i),this._crossFadeLFO.start(i),this.windowSize=this._windowSize},t.extend(t.PitchShift,t.FeedbackEffect),t.PitchShift.defaults={pitch:0,windowSize:.1,delayTime:0,feedback:0},Object.defineProperty(t.PitchShift.prototype,"pitch",{get:function(){return this._pitch},set:function(e){this._pitch=e;var i=0;e<0?(this._lfoA.min=0,this._lfoA.max=this._windowSize,this._lfoB.min=0,this._lfoB.max=this._windowSize,i=t.intervalToFrequencyRatio(e-1)+1):(this._lfoA.min=this._windowSize,this._lfoA.max=0,this._lfoB.min=this._windowSize,this._lfoB.max=0,i=t.intervalToFrequencyRatio(e)-1),this._frequency.value=i*(1.2/this._windowSize)}}),Object.defineProperty(t.PitchShift.prototype,"windowSize",{get:function(){return this._windowSize},set:function(t){this._windowSize=this.toSeconds(t),this.pitch=this._pitch}}),t.PitchShift.prototype.dispose=function(){return t.FeedbackEffect.prototype.dispose.call(this),this._frequency.dispose(),this._frequency=null,this._delayA.disconnect(),this._delayA=null,this._delayB.disconnect(),this._delayB=null,this._lfoA.dispose(),this._lfoA=null,this._lfoB.dispose(),this._lfoB=null,this._crossFade.dispose(),this._crossFade=null,this._crossFadeLFO.dispose(),this._crossFadeLFO=null,this._writable("delayTime"),this._feedbackDelay.dispose(),this._feedbackDelay=null,this.delayTime=null,this},t.PitchShift}),i(function(t){return t.BufferSource=function(){var e=t.defaults(arguments,["buffer","onload"],t.BufferSource);t.AudioNode.call(this,e),this.onended=e.onended,this._startTime=-1,this._sourceStarted=!1,this._sourceStopped=!1,this._stopTime=-1,this._gainNode=this.output=new t.Gain,this._source=this.context.createBufferSource(),this._source.connect(this._gainNode),this._source.onended=this._onended.bind(this),this._buffer=new t.Buffer(e.buffer,e.onload),this.playbackRate=new t.Param(this._source.playbackRate,t.Type.Positive),this.fadeIn=e.fadeIn,this.fadeOut=e.fadeOut,this.curve=e.curve,this._gain=1,this._onendedTimeout=-1,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.playbackRate.value=e.playbackRate},t.extend(t.BufferSource,t.AudioNode),t.BufferSource.defaults={onended:t.noOp,onload:t.noOp,loop:!1,loopStart:0,loopEnd:0,fadeIn:0,fadeOut:0,curve:"linear",playbackRate:1},Object.defineProperty(t.BufferSource.prototype,"state",{get:function(){return this.getStateAtTime(this.now())}}),t.BufferSource.prototype.getStateAtTime=function(e){return e=this.toSeconds(e),-1!==this._startTime&&e>=this._startTime&&!this._sourceStopped?t.State.Started:t.State.Stopped},t.BufferSource.prototype.start=function(e,i,n,o,r){if(-1!==this._startTime)throw new Error("Tone.BufferSource can only be started once.");if(!this.buffer.loaded)throw new Error("Tone.BufferSource: buffer is either not set or not loaded.");e=this.toSeconds(e),i=this.loop?t.defaultArg(i,this.loopStart):t.defaultArg(i,0),i=this.toSeconds(i),o=t.defaultArg(o,1),this._gain=o,r=this.toSeconds(t.defaultArg(r,this.fadeIn)),this.fadeIn=r,r>0?(this._gainNode.gain.setValueAtTime(0,e),"linear"===this.curve?this._gainNode.gain.linearRampToValueAtTime(this._gain,e+r):this._gainNode.gain.exponentialApproachValueAtTime(this._gain,e,r)):this._gainNode.gain.setValueAtTime(o,e),this._startTime=e;var s=this.toSeconds(t.defaultArg(n,this.buffer.duration-i%this.buffer.duration));if(s=Math.max(s,0),t.isDefined(n)&&(this.loop||(s=Math.min(s,this.buffer.duration-i%this.buffer.duration)),this.stop(e+s,this.fadeOut)),this.loop){var a=this.loopEnd||this.buffer.duration,l=this.loopStart;i>=a&&(i=(i-l)%(a-l)+l)}return this._source.buffer=this.buffer.get(),this._source.loopEnd=this.loopEnd||this.buffer.duration,i<this.buffer.duration&&(this._sourceStarted=!0,this._source.start(e,i)),this},t.BufferSource.prototype.stop=function(e,i){if(!this.buffer.loaded)throw new Error("Tone.BufferSource: buffer is either not set or not loaded.");if(!this._sourceStopped){if(e=this.toSeconds(e),-1!==this._stopTime&&this.cancelStop(),e<=this._startTime)return this._gainNode.gain.cancelScheduledValues(e),this._gainNode.gain.value=0,this;e=Math.max(this._startTime+this.fadeIn+this.sampleTime,e),this._gainNode.gain.cancelScheduledValues(e),this._stopTime=e,i=this.toSeconds(t.defaultArg(i,this.fadeOut));var n=e-this._startTime-this.fadeIn-this.sampleTime;this.loop||(n=Math.min(n,this.buffer.duration));var o=e-(i=Math.min(n,i));return i>this.sampleTime?(this._gainNode.gain.setValueAtTime(this._gain,o),"linear"===this.curve?this._gainNode.gain.linearRampToValueAtTime(0,e):this._gainNode.gain.exponentialApproachValueAtTime(0,o,i)):this._gainNode.gain.setValueAtTime(0,e),t.context.clearTimeout(this._onendedTimeout),this._onendedTimeout=t.context.setTimeout(this._onended.bind(this),this._stopTime-this.now()),this}},t.BufferSource.prototype.cancelStop=function(){if(-1!==this._startTime&&!this._sourceStopped){var t=this.toSeconds(this.fadeIn);this._gainNode.gain.cancelScheduledValues(this._startTime+t+this.sampleTime),this._gainNode.gain.setValueAtTime(1,Math.max(this.now(),this._startTime+t+this.sampleTime)),this.context.clearTimeout(this._onendedTimeout),this._stopTime=-1}return this},t.BufferSource.prototype._onended=function(){if(!this._sourceStopped){this._sourceStopped=!0;var t="exponential"===this.curve?2*this.fadeOut:0;this._sourceStarted&&-1!==this._stopTime&&this._source.stop(this._stopTime+t),this.onended(this)}},Object.defineProperty(t.BufferSource.prototype,"loopStart",{get:function(){return this._source.loopStart},set:function(t){this._source.loopStart=this.toSeconds(t)}}),Object.defineProperty(t.BufferSource.prototype,"loopEnd",{get:function(){return this._source.loopEnd},set:function(t){this._source.loopEnd=this.toSeconds(t)}}),Object.defineProperty(t.BufferSource.prototype,"buffer",{get:function(){return this._buffer},set:function(t){this._buffer.set(t)}}),Object.defineProperty(t.BufferSource.prototype,"loop",{get:function(){return this._source.loop},set:function(t){this._source.loop=t,this.cancelStop()}}),t.BufferSource.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this.onended=null,this._source.onended=null,this._source.disconnect(),this._source=null,this._gainNode.dispose(),this._gainNode=null,this._buffer.dispose(),this._buffer=null,this._startTime=-1,this.playbackRate=null,t.context.clearTimeout(this._onendedTimeout),this},t.BufferSource}),i(function(t){t.Noise=function(){var e=t.defaults(arguments,["type"],t.Noise);t.Source.call(this,e),this._source=null,this._type=e.type,this._playbackRate=e.playbackRate},t.extend(t.Noise,t.Source),t.Noise.defaults={type:"white",playbackRate:1},Object.defineProperty(t.Noise.prototype,"type",{get:function(){return this._type},set:function(e){if(this._type!==e){if(!(e in i))throw new TypeError("Tone.Noise: invalid type: "+e);if(this._type=e,this.state===t.State.Started){var n=this.now();this._stop(n),this._start(n)}}}}),Object.defineProperty(t.Noise.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(t){this._playbackRate=t,this._source&&(this._source.playbackRate.value=t)}}),t.Noise.prototype._start=function(e){var n=i[this._type];this._source=new t.BufferSource(n).connect(this.output),this._source.loop=!0,this._source.playbackRate.value=this._playbackRate,this._source.start(this.toSeconds(e),Math.random()*(n.duration-.001))},t.Noise.prototype._stop=function(t){this._source&&(this._source.stop(this.toSeconds(t)),this._source=null)},t.Noise.prototype.restart=function(t){this._stop(t),this._start(t)},t.Noise.prototype.dispose=function(){return t.Source.prototype.dispose.call(this),null!==this._source&&(this._source.disconnect(),this._source=null),this._buffer=null,this};var e={pink:function(){for(var t=[],e=0;e<2;e++){var i,n,o,r,s,a,l,u=new Float32Array(220500);t[e]=u,i=n=o=r=s=a=l=0;for(var h=0;h<220500;h++){var c=2*Math.random()-1;i=.99886*i+.0555179*c,n=.99332*n+.0750759*c,o=.969*o+.153852*c,r=.8665*r+.3104856*c,s=.55*s+.5329522*c,a=-.7616*a-.016898*c,u[h]=i+n+o+r+s+a+l+.5362*c,u[h]*=.11,l=.115926*c}}return t}(),brown:function(){for(var t=[],e=0;e<2;e++){var i=new Float32Array(220500);t[e]=i;for(var n=0,o=0;o<220500;o++){var r=2*Math.random()-1;i[o]=(n+.02*r)/1.02,n=i[o],i[o]*=3.5}}return t}(),white:function(){for(var t=[],e=0;e<2;e++){var i=new Float32Array(220500);t[e]=i;for(var n=0;n<220500;n++)i[n]=2*Math.random()-1}return t}()},i={};function n(){for(var n in e)i[n]=(new t.Buffer).fromArray(e[n])}return t.getContext(n),t.Context.on("init",n),t.Noise}),i(function(t){return t.Reverb=function(){var e=t.defaults(arguments,["decay"],t.Reverb);t.Effect.call(this,e),this._convolver=this.context.createConvolver(),this.decay=e.decay,this.preDelay=e.preDelay,this.connectEffect(this._convolver)},t.extend(t.Reverb,t.Effect),t.Reverb.defaults={decay:1.5,preDelay:.01},t.Reverb.prototype.generate=function(){return t.Offline(function(){var e=new t.Noise,i=new t.Noise,n=new t.Merge;e.connect(n.left),i.connect(n.right);var o=(new t.Gain).toMaster();n.connect(o),e.start(0),i.start(0),o.gain.setValueAtTime(0,0),o.gain.linearRampToValueAtTime(1,this.preDelay),o.gain.exponentialApproachValueAtTime(0,this.preDelay,this.decay-this.preDelay)}.bind(this),this.decay).then(function(t){return this._convolver.buffer=t.get(),this}.bind(this))},t.Reverb.prototype.dispose=function(){return t.Effect.prototype.dispose.call(this),this._convolver.disconnect(),this._convolver=null,this},t.Reverb}),i(function(t){return t.StereoFeedbackEffect=function(){var e=t.defaults(arguments,["feedback"],t.FeedbackEffect);t.StereoEffect.call(this,e),this.feedback=new t.Signal(e.feedback,t.Type.NormalRange),this._feedbackL=new t.Gain,this._feedbackR=new t.Gain,this.effectReturnL.chain(this._feedbackL,this.effectSendL),this.effectReturnR.chain(this._feedbackR,this.effectSendR),this.feedback.fan(this._feedbackL.gain,this._feedbackR.gain),this._readOnly(["feedback"])},t.extend(t.StereoFeedbackEffect,t.StereoEffect),t.StereoFeedbackEffect.prototype.dispose=function(){return t.StereoEffect.prototype.dispose.call(this),this._writable(["feedback"]),this.feedback.dispose(),this.feedback=null,this._feedbackL.dispose(),this._feedbackL=null,this._feedbackR.dispose(),this._feedbackR=null,this},t.StereoFeedbackEffect}),i(function(t){return t.StereoWidener=function(){var e=t.defaults(arguments,["width"],t.StereoWidener);t.MidSideEffect.call(this,e),this.width=new t.Signal(e.width,t.Type.NormalRange),this._readOnly(["width"]),this._twoTimesWidthMid=new t.Multiply(2),this._twoTimesWidthSide=new t.Multiply(2),this._midMult=new t.Multiply,this._twoTimesWidthMid.connect(this._midMult,0,1),this.midSend.chain(this._midMult,this.midReturn),this._oneMinusWidth=new t.Subtract,this._oneMinusWidth.connect(this._twoTimesWidthMid),this.context.getConstant(1).connect(this._oneMinusWidth,0,0),this.width.connect(this._oneMinusWidth,0,1),this._sideMult=new t.Multiply,this.width.connect(this._twoTimesWidthSide),this._twoTimesWidthSide.connect(this._sideMult,0,1),this.sideSend.chain(this._sideMult,this.sideReturn)},t.extend(t.StereoWidener,t.MidSideEffect),t.StereoWidener.defaults={width:.5},t.StereoWidener.prototype.dispose=function(){return t.MidSideEffect.prototype.dispose.call(this),this._writable(["width"]),this.width.dispose(),this.width=null,this._midMult.dispose(),this._midMult=null,this._sideMult.dispose(),this._sideMult=null,this._twoTimesWidthMid.dispose(),this._twoTimesWidthMid=null,this._twoTimesWidthSide.dispose(),this._twoTimesWidthSide=null,this._oneMinusWidth.dispose(),this._oneMinusWidth=null,this},t.StereoWidener}),i(function(t){return t.Tremolo=function(){var e=t.defaults(arguments,["frequency","depth"],t.Tremolo);t.StereoEffect.call(this,e),this._lfoL=new t.LFO({phase:e.spread,min:1,max:0}),this._lfoR=new t.LFO({phase:e.spread,min:1,max:0}),this._amplitudeL=new t.Gain,this._amplitudeR=new t.Gain,this.frequency=new t.Signal(e.frequency,t.Type.Frequency),this.depth=new t.Signal(e.depth,t.Type.NormalRange),this._readOnly(["frequency","depth"]),this.effectSendL.chain(this._amplitudeL,this.effectReturnL),this.effectSendR.chain(this._amplitudeR,this.effectReturnR),this._lfoL.connect(this._amplitudeL.gain),this._lfoR.connect(this._amplitudeR.gain),this.frequency.fan(this._lfoL.frequency,this._lfoR.frequency),this.depth.fan(this._lfoR.amplitude,this._lfoL.amplitude),this.type=e.type,this.spread=e.spread},t.extend(t.Tremolo,t.StereoEffect),t.Tremolo.defaults={frequency:10,type:"sine",depth:.5,spread:180},t.Tremolo.prototype.start=function(t){return this._lfoL.start(t),this._lfoR.start(t),this},t.Tremolo.prototype.stop=function(t){return this._lfoL.stop(t),this._lfoR.stop(t),this},t.Tremolo.prototype.sync=function(e){return this._lfoL.sync(e),this._lfoR.sync(e),t.Transport.syncSignal(this.frequency),this},t.Tremolo.prototype.unsync=function(){return this._lfoL.unsync(),this._lfoR.unsync(),t.Transport.unsyncSignal(this.frequency),this},Object.defineProperty(t.Tremolo.prototype,"type",{get:function(){return this._lfoL.type},set:function(t){this._lfoL.type=t,this._lfoR.type=t}}),Object.defineProperty(t.Tremolo.prototype,"spread",{get:function(){return this._lfoR.phase-this._lfoL.phase},set:function(t){this._lfoL.phase=90-t/2,this._lfoR.phase=t/2+90}}),t.Tremolo.prototype.dispose=function(){return t.StereoEffect.prototype.dispose.call(this),this._writable(["frequency","depth"]),this._lfoL.dispose(),this._lfoL=null,this._lfoR.dispose(),this._lfoR=null,this._amplitudeL.dispose(),this._amplitudeL=null,this._amplitudeR.dispose(),this._amplitudeR=null,this.frequency=null,this.depth=null,this},t.Tremolo}),i(function(t){return t.Vibrato=function(){var e=t.defaults(arguments,["frequency","depth"],t.Vibrato);t.Effect.call(this,e),this._delayNode=new t.Delay(0,e.maxDelay),this._lfo=new t.LFO({type:e.type,min:0,max:e.maxDelay,frequency:e.frequency,phase:-90}).start().connect(this._delayNode.delayTime),this.frequency=this._lfo.frequency,this.depth=this._lfo.amplitude,this.depth.value=e.depth,this._readOnly(["frequency","depth"]),this.effectSend.chain(this._delayNode,this.effectReturn)},t.extend(t.Vibrato,t.Effect),t.Vibrato.defaults={maxDelay:.005,frequency:5,depth:.1,type:"sine"},Object.defineProperty(t.Vibrato.prototype,"type",{get:function(){return this._lfo.type},set:function(t){this._lfo.type=t}}),t.Vibrato.prototype.dispose=function(){t.Effect.prototype.dispose.call(this),this._delayNode.dispose(),this._delayNode=null,this._lfo.dispose(),this._lfo=null,this._writable(["frequency","depth"]),this.frequency=null,this.depth=null},t.Vibrato}),i(function(t){return t.Event=function(){var e=t.defaults(arguments,["callback","value"],t.Event);t.call(this),this._loop=e.loop,this.callback=e.callback,this.value=e.value,this._loopStart=this.toTicks(e.loopStart),this._loopEnd=this.toTicks(e.loopEnd),this._state=new t.TimelineState(t.State.Stopped),this._playbackRate=1,this._startOffset=0,this._probability=e.probability,this._humanize=e.humanize,this.mute=e.mute,this.playbackRate=e.playbackRate},t.extend(t.Event),t.Event.defaults={callback:t.noOp,loop:!1,loopEnd:"1m",loopStart:0,playbackRate:1,value:null,probability:1,mute:!1,humanize:!1},t.Event.prototype._rescheduleEvents=function(e){return e=t.defaultArg(e,-1),this._state.forEachFrom(e,function(e){var i;if(e.state===t.State.Started){t.isDefined(e.id)&&t.Transport.clear(e.id);var n=e.time+Math.round(this.startOffset/this._playbackRate);if(this._loop){i=1/0,t.isNumber(this._loop)&&(i=this._loop*this._getLoopDuration());var o=this._state.getAfter(n);null!==o&&(i=Math.min(i,o.time-n)),i!==1/0&&(this._state.setStateAtTime(t.State.Stopped,n+i+1),i=t.Ticks(i));var r=t.Ticks(this._getLoopDuration());e.id=t.Transport.scheduleRepeat(this._tick.bind(this),r,t.Ticks(n),i)}else e.id=t.Transport.schedule(this._tick.bind(this),t.Ticks(n))}}.bind(this)),this},Object.defineProperty(t.Event.prototype,"state",{get:function(){return this._state.getValueAtTime(t.Transport.ticks)}}),Object.defineProperty(t.Event.prototype,"startOffset",{get:function(){return this._startOffset},set:function(t){this._startOffset=t}}),Object.defineProperty(t.Event.prototype,"probability",{get:function(){return this._probability},set:function(t){this._probability=t}}),Object.defineProperty(t.Event.prototype,"humanize",{get:function(){return this._humanize},set:function(t){this._humanize=t}}),t.Event.prototype.start=function(e){return e=this.toTicks(e),this._state.getValueAtTime(e)===t.State.Stopped&&(this._state.add({state:t.State.Started,time:e,id:void 0}),this._rescheduleEvents(e)),this},t.Event.prototype.stop=function(e){if(this.cancel(e),e=this.toTicks(e),this._state.getValueAtTime(e)===t.State.Started){this._state.setStateAtTime(t.State.Stopped,e);var i=this._state.getBefore(e),n=e;null!==i&&(n=i.time),this._rescheduleEvents(n)}return this},t.Event.prototype.cancel=function(e){return e=t.defaultArg(e,-1/0),e=this.toTicks(e),this._state.forEachFrom(e,function(e){t.Transport.clear(e.id)}),this._state.cancel(e),this},t.Event.prototype._tick=function(e){var i=t.Transport.getTicksAtTime(e);if(!this.mute&&this._state.getValueAtTime(i)===t.State.Started){if(this.probability<1&&Math.random()>this.probability)return;if(this.humanize){var n=.02;t.isBoolean(this.humanize)||(n=this.toSeconds(this.humanize)),e+=(2*Math.random()-1)*n}this.callback(e,this.value)}},t.Event.prototype._getLoopDuration=function(){return Math.round((this._loopEnd-this._loopStart)/this._playbackRate)},Object.defineProperty(t.Event.prototype,"loop",{get:function(){return this._loop},set:function(t){this._loop=t,this._rescheduleEvents()}}),Object.defineProperty(t.Event.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(t){this._playbackRate=t,this._rescheduleEvents()}}),Object.defineProperty(t.Event.prototype,"loopEnd",{get:function(){return t.Ticks(this._loopEnd).toSeconds()},set:function(t){this._loopEnd=this.toTicks(t),this._loop&&this._rescheduleEvents()}}),Object.defineProperty(t.Event.prototype,"loopStart",{get:function(){return t.Ticks(this._loopStart).toSeconds()},set:function(t){this._loopStart=this.toTicks(t),this._loop&&this._rescheduleEvents()}}),Object.defineProperty(t.Event.prototype,"progress",{get:function(){if(this._loop){var e=t.Transport.ticks,i=this._state.get(e);if(null!==i&&i.state===t.State.Started){var n=this._getLoopDuration();return(e-i.time)%n/n}return 0}return 0}}),t.Event.prototype.dispose=function(){this.cancel(),this._state.dispose(),this._state=null,this.callback=null,this.value=null},t.Event}),i(function(t){return t.Loop=function(){var e=t.defaults(arguments,["callback","interval"],t.Loop);t.call(this),this._event=new t.Event({callback:this._tick.bind(this),loop:!0,loopEnd:e.interval,playbackRate:e.playbackRate,probability:e.probability}),this.callback=e.callback,this.iterations=e.iterations},t.extend(t.Loop),t.Loop.defaults={interval:"4n",callback:t.noOp,playbackRate:1,iterations:1/0,probability:!0,mute:!1},t.Loop.prototype.start=function(t){return this._event.start(t),this},t.Loop.prototype.stop=function(t){return this._event.stop(t),this},t.Loop.prototype.cancel=function(t){return this._event.cancel(t),this},t.Loop.prototype._tick=function(t){this.callback(t)},Object.defineProperty(t.Loop.prototype,"state",{get:function(){return this._event.state}}),Object.defineProperty(t.Loop.prototype,"progress",{get:function(){return this._event.progress}}),Object.defineProperty(t.Loop.prototype,"interval",{get:function(){return this._event.loopEnd},set:function(t){this._event.loopEnd=t}}),Object.defineProperty(t.Loop.prototype,"playbackRate",{get:function(){return this._event.playbackRate},set:function(t){this._event.playbackRate=t}}),Object.defineProperty(t.Loop.prototype,"humanize",{get:function(){return this._event.humanize},set:function(t){this._event.humanize=t}}),Object.defineProperty(t.Loop.prototype,"probability",{get:function(){return this._event.probability},set:function(t){this._event.probability=t}}),Object.defineProperty(t.Loop.prototype,"mute",{get:function(){return this._event.mute},set:function(t){this._event.mute=t}}),Object.defineProperty(t.Loop.prototype,"iterations",{get:function(){return!0===this._event.loop?1/0:this._event.loop},set:function(t){this._event.loop=t===1/0||t}}),t.Loop.prototype.dispose=function(){this._event.dispose(),this._event=null,this.callback=null},t.Loop}),i(function(t){return t.Part=function(){var e=t.defaults(arguments,["callback","events"],t.Part);t.Event.call(this,e),this._events=[];for(var i=0;i<e.events.length;i++)Array.isArray(e.events[i])?this.add(e.events[i][0],e.events[i][1]):this.add(e.events[i])},t.extend(t.Part,t.Event),t.Part.defaults={callback:t.noOp,loop:!1,loopEnd:"1m",loopStart:0,playbackRate:1,probability:1,humanize:!1,mute:!1,events:[]},t.Part.prototype.start=function(e,i){var n=this.toTicks(e);return this._state.getValueAtTime(n)!==t.State.Started&&(i=this._loop?t.defaultArg(i,this._loopStart):t.defaultArg(i,0),i=this.toTicks(i),this._state.add({state:t.State.Started,time:n,offset:i}),this._forEach(function(t){this._startNote(t,n,i)})),this},t.Part.prototype._startNote=function(e,i,n){i-=n,this._loop?e.startOffset>=this._loopStart&&e.startOffset<this._loopEnd?(e.startOffset<n&&(i+=this._getLoopDuration()),e.start(t.Ticks(i))):e.startOffset<this._loopStart&&e.startOffset>=n&&(e.loop=!1,e.start(t.Ticks(i))):e.startOffset>=n&&e.start(t.Ticks(i))},Object.defineProperty(t.Part.prototype,"startOffset",{get:function(){return this._startOffset},set:function(t){this._startOffset=t,this._forEach(function(t){t.startOffset+=this._startOffset})}}),t.Part.prototype.stop=function(e){var i=this.toTicks(e);return this._state.cancel(i),this._state.setStateAtTime(t.State.Stopped,i),this._forEach(function(t){t.stop(e)}),this},t.Part.prototype.at=function(e,i){e=t.TransportTime(e);for(var n=t.Ticks(1).toSeconds(),o=0;o<this._events.length;o++){var r=this._events[o];if(Math.abs(e.toTicks()-r.startOffset)<n)return t.isDefined(i)&&(r.value=i),r}return t.isDefined(i)?(this.add(e,i),this._events[this._events.length-1]):null},t.Part.prototype.add=function(e,i){var n;return e.hasOwnProperty("time")&&(e=(i=e).time),e=this.toTicks(e),i instanceof t.Event?(n=i).callback=this._tick.bind(this):n=new t.Event({callback:this._tick.bind(this),value:i}),n.startOffset=e,n.set({loopEnd:this.loopEnd,loopStart:this.loopStart,loop:this.loop,humanize:this.humanize,playbackRate:this.playbackRate,probability:this.probability}),this._events.push(n),this._restartEvent(n),this},t.Part.prototype._restartEvent=function(e){this._state.forEach(function(i){i.state===t.State.Started?this._startNote(e,i.time,i.offset):e.stop(t.Ticks(i.time))}.bind(this))},t.Part.prototype.remove=function(e,i){e.hasOwnProperty("time")&&(e=(i=e).time),e=this.toTicks(e);for(var n=this._events.length-1;n>=0;n--){var o=this._events[n];o instanceof t.Part?o.remove(e,i):o.startOffset===e&&(t.isUndef(i)||t.isDefined(i)&&o.value===i)&&(this._events.splice(n,1),o.dispose())}return this},t.Part.prototype.removeAll=function(){return this._forEach(function(t){t.dispose()}),this._events=[],this},t.Part.prototype.cancel=function(t){return this._forEach(function(e){e.cancel(t)}),this._state.cancel(this.toTicks(t)),this},t.Part.prototype._forEach=function(e,i){if(this._events){i=t.defaultArg(i,this);for(var n=this._events.length-1;n>=0;n--){var o=this._events[n];o instanceof t.Part?o._forEach(e,i):e.call(i,o)}}return this},t.Part.prototype._setAll=function(t,e){this._forEach(function(i){i[t]=e})},t.Part.prototype._tick=function(t,e){this.mute||this.callback(t,e)},t.Part.prototype._testLoopBoundries=function(e){e.startOffset<this._loopStart||e.startOffset>=this._loopEnd?e.cancel(0):e.state===t.State.Stopped&&this._restartEvent(e)},Object.defineProperty(t.Part.prototype,"probability",{get:function(){return this._probability},set:function(t){this._probability=t,this._setAll("probability",t)}}),Object.defineProperty(t.Part.prototype,"humanize",{get:function(){return this._humanize},set:function(t){this._humanize=t,this._setAll("humanize",t)}}),Object.defineProperty(t.Part.prototype,"loop",{get:function(){return this._loop},set:function(t){this._loop=t,this._forEach(function(e){e._loopStart=this._loopStart,e._loopEnd=this._loopEnd,e.loop=t,this._testLoopBoundries(e)})}}),Object.defineProperty(t.Part.prototype,"loopEnd",{get:function(){return t.Ticks(this._loopEnd).toSeconds()},set:function(t){this._loopEnd=this.toTicks(t),this._loop&&this._forEach(function(e){e.loopEnd=t,this._testLoopBoundries(e)})}}),Object.defineProperty(t.Part.prototype,"loopStart",{get:function(){return t.Ticks(this._loopStart).toSeconds()},set:function(t){this._loopStart=this.toTicks(t),this._loop&&this._forEach(function(t){t.loopStart=this.loopStart,this._testLoopBoundries(t)})}}),Object.defineProperty(t.Part.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(t){this._playbackRate=t,this._setAll("playbackRate",t)}}),Object.defineProperty(t.Part.prototype,"length",{get:function(){return this._events.length}}),t.Part.prototype.dispose=function(){return this.removeAll(),this._state.dispose(),this._state=null,this.callback=null,this._events=null,this},t.Part}),i(function(t){return t.Pattern=function(){var e=t.defaults(arguments,["callback","values","pattern"],t.Pattern);t.Loop.call(this,e),this._pattern=new t.CtrlPattern({values:e.values,type:e.pattern,index:e.index})},t.extend(t.Pattern,t.Loop),t.Pattern.defaults={pattern:t.CtrlPattern.Type.Up,callback:t.noOp,values:[]},t.Pattern.prototype._tick=function(t){this.callback(t,this._pattern.value),this._pattern.next()},Object.defineProperty(t.Pattern.prototype,"index",{get:function(){return this._pattern.index},set:function(t){this._pattern.index=t}}),Object.defineProperty(t.Pattern.prototype,"values",{get:function(){return this._pattern.values},set:function(t){this._pattern.values=t}}),Object.defineProperty(t.Pattern.prototype,"value",{get:function(){return this._pattern.value}}),Object.defineProperty(t.Pattern.prototype,"pattern",{get:function(){return this._pattern.type},set:function(t){this._pattern.type=t}}),t.Pattern.prototype.dispose=function(){t.Loop.prototype.dispose.call(this),this._pattern.dispose(),this._pattern=null},t.Pattern}),i(function(t){return t.Sequence=function(){var e=t.defaults(arguments,["callback","events","subdivision"],t.Sequence),i=e.events;if(delete e.events,t.Part.call(this,e),this._subdivision=this.toTicks(e.subdivision),t.isUndef(e.loopEnd)&&t.isDefined(i)&&(this._loopEnd=i.length*this._subdivision),this._loop=!0,t.isDefined(i))for(var n=0;n<i.length;n++)this.add(n,i[n])},t.extend(t.Sequence,t.Part),t.Sequence.defaults={subdivision:"4n"},Object.defineProperty(t.Sequence.prototype,"subdivision",{get:function(){return t.Ticks(this._subdivision).toSeconds()}}),t.Sequence.prototype.at=function(e,i){return t.isArray(i)&&this.remove(e),t.Part.prototype.at.call(this,this._indexTime(e),i)},t.Sequence.prototype.add=function(e,i){if(null===i)return this;if(t.isArray(i)){var n=Math.round(this._subdivision/i.length);i=new t.Sequence(this._tick.bind(this),i,t.Ticks(n))}return t.Part.prototype.add.call(this,this._indexTime(e),i),this},t.Sequence.prototype.remove=function(e,i){return t.Part.prototype.remove.call(this,this._indexTime(e),i),this},t.Sequence.prototype._indexTime=function(e){return e instanceof t.TransportTime?e:t.Ticks(e*this._subdivision+this.startOffset).toSeconds()},t.Sequence.prototype.dispose=function(){return t.Part.prototype.dispose.call(this),this},t.Sequence}),i(function(t){return t.PulseOscillator=function(){var e=t.defaults(arguments,["frequency","width"],t.Oscillator);t.Source.call(this,e),this.width=new t.Signal(e.width,t.Type.NormalRange),this._widthGate=new t.Gain,this._sawtooth=new t.Oscillator({frequency:e.frequency,detune:e.detune,type:"sawtooth",phase:e.phase}),this.frequency=this._sawtooth.frequency,this.detune=this._sawtooth.detune,this._thresh=new t.WaveShaper(function(t){return t<0?-1:1}),this._sawtooth.chain(this._thresh,this.output),this.width.chain(this._widthGate,this._thresh),this._readOnly(["width","frequency","detune"])},t.extend(t.PulseOscillator,t.Source),t.PulseOscillator.defaults={frequency:440,detune:0,phase:0,width:.2},t.PulseOscillator.prototype._start=function(t){t=this.toSeconds(t),this._sawtooth.start(t),this._widthGate.gain.setValueAtTime(1,t)},t.PulseOscillator.prototype._stop=function(t){t=this.toSeconds(t),this._sawtooth.stop(t),this._widthGate.gain.setValueAtTime(0,t)},t.PulseOscillator.prototype.restart=function(t){this._sawtooth.restart(t)},Object.defineProperty(t.PulseOscillator.prototype,"phase",{get:function(){return this._sawtooth.phase},set:function(t){this._sawtooth.phase=t}}),Object.defineProperty(t.PulseOscillator.prototype,"type",{get:function(){return"pulse"}}),Object.defineProperty(t.PulseOscillator.prototype,"partials",{get:function(){return[]}}),t.PulseOscillator.prototype.dispose=function(){return t.Source.prototype.dispose.call(this),this._sawtooth.dispose(),this._sawtooth=null,this._writable(["width","frequency","detune"]),this.width.dispose(),this.width=null,this._widthGate.dispose(),this._widthGate=null,this._thresh.dispose(),this._thresh=null,this.frequency=null,this.detune=null,this},t.PulseOscillator}),i(function(t){return t.PWMOscillator=function(){var e=t.defaults(arguments,["frequency","modulationFrequency"],t.PWMOscillator);t.Source.call(this,e),this._pulse=new t.PulseOscillator(e.modulationFrequency),this._pulse._sawtooth.type="sine",this._modulator=new t.Oscillator({frequency:e.frequency,detune:e.detune,phase:e.phase}),this._scale=new t.Multiply(2),this.frequency=this._modulator.frequency,this.detune=this._modulator.detune,this.modulationFrequency=this._pulse.frequency,this._modulator.chain(this._scale,this._pulse.width),this._pulse.connect(this.output),this._readOnly(["modulationFrequency","frequency","detune"])},t.extend(t.PWMOscillator,t.Source),t.PWMOscillator.defaults={frequency:440,detune:0,phase:0,modulationFrequency:.4},t.PWMOscillator.prototype._start=function(t){t=this.toSeconds(t),this._modulator.start(t),this._pulse.start(t)},t.PWMOscillator.prototype._stop=function(t){t=this.toSeconds(t),this._modulator.stop(t),this._pulse.stop(t)},t.PWMOscillator.prototype.restart=function(t){this._modulator.restart(t),this._pulse.restart(t)},Object.defineProperty(t.PWMOscillator.prototype,"type",{get:function(){return"pwm"}}),Object.defineProperty(t.PWMOscillator.prototype,"partials",{get:function(){return[]}}),Object.defineProperty(t.PWMOscillator.prototype,"phase",{get:function(){return this._modulator.phase},set:function(t){this._modulator.phase=t}}),t.PWMOscillator.prototype.dispose=function(){return t.Source.prototype.dispose.call(this),this._pulse.dispose(),this._pulse=null,this._scale.dispose(),this._scale=null,this._modulator.dispose(),this._modulator=null,this._writable(["modulationFrequency","frequency","detune"]),this.frequency=null,this.detune=null,this.modulationFrequency=null,this},t.PWMOscillator}),i(function(t){return t.FMOscillator=function(){var e=t.defaults(arguments,["frequency","type","modulationType"],t.FMOscillator);t.Source.call(this,e),this._carrier=new t.Oscillator(e.frequency,e.type),this.frequency=new t.Signal(e.frequency,t.Type.Frequency),this.detune=this._carrier.detune,this.detune.value=e.detune,this.modulationIndex=new t.Multiply(e.modulationIndex),this.modulationIndex.units=t.Type.Positive,this._modulator=new t.Oscillator(e.frequency,e.modulationType),this.harmonicity=new t.Multiply(e.harmonicity),this.harmonicity.units=t.Type.Positive,this._modulationNode=new t.Gain(0),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),this.phase=e.phase,this._readOnly(["modulationIndex","frequency","detune","harmonicity"])},t.extend(t.FMOscillator,t.Source),t.FMOscillator.defaults={frequency:440,detune:0,phase:0,modulationIndex:2,modulationType:"square",harmonicity:1},t.FMOscillator.prototype._start=function(t){this._modulator.start(t),this._carrier.start(t)},t.FMOscillator.prototype._stop=function(t){this._modulator.stop(t),this._carrier.stop(t)},t.FMOscillator.prototype.restart=function(t){this._modulator.restart(t),this._carrier.restart(t)},Object.defineProperty(t.FMOscillator.prototype,"type",{get:function(){return this._carrier.type},set:function(t){this._carrier.type=t}}),Object.defineProperty(t.FMOscillator.prototype,"modulationType",{get:function(){return this._modulator.type},set:function(t){this._modulator.type=t}}),Object.defineProperty(t.FMOscillator.prototype,"phase",{get:function(){return this._carrier.phase},set:function(t){this._carrier.phase=t,this._modulator.phase=t}}),Object.defineProperty(t.FMOscillator.prototype,"partials",{get:function(){return this._carrier.partials},set:function(t){this._carrier.partials=t}}),t.FMOscillator.prototype.dispose=function(){return t.Source.prototype.dispose.call(this),this._writable(["modulationIndex","frequency","detune","harmonicity"]),this.frequency.dispose(),this.frequency=null,this.detune=null,this.harmonicity.dispose(),this.harmonicity=null,this._carrier.dispose(),this._carrier=null,this._modulator.dispose(),this._modulator=null,this._modulationNode.dispose(),this._modulationNode=null,this.modulationIndex.dispose(),this.modulationIndex=null,this},t.FMOscillator}),i(function(t){return t.AMOscillator=function(){var e=t.defaults(arguments,["frequency","type","modulationType"],t.AMOscillator);t.Source.call(this,e),this._carrier=new t.Oscillator(e.frequency,e.type),this.frequency=this._carrier.frequency,this.detune=this._carrier.detune,this.detune.value=e.detune,this._modulator=new t.Oscillator(e.frequency,e.modulationType),this._modulationScale=new t.AudioToGain,this.harmonicity=new t.Multiply(e.harmonicity),this.harmonicity.units=t.Type.Positive,this._modulationNode=new t.Gain(0),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.detune.connect(this._modulator.detune),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output),this.phase=e.phase,this._readOnly(["frequency","detune","harmonicity"])},t.extend(t.AMOscillator,t.Oscillator),t.AMOscillator.defaults={frequency:440,detune:0,phase:0,modulationType:"square",harmonicity:1},t.AMOscillator.prototype._start=function(t){this._modulator.start(t),this._carrier.start(t)},t.AMOscillator.prototype._stop=function(t){this._modulator.stop(t),this._carrier.stop(t)},t.AMOscillator.prototype.restart=function(t){this._modulator.restart(t),this._carrier.restart(t)},Object.defineProperty(t.AMOscillator.prototype,"type",{get:function(){return this._carrier.type},set:function(t){this._carrier.type=t}}),Object.defineProperty(t.AMOscillator.prototype,"modulationType",{get:function(){return this._modulator.type},set:function(t){this._modulator.type=t}}),Object.defineProperty(t.AMOscillator.prototype,"phase",{get:function(){return this._carrier.phase},set:function(t){this._carrier.phase=t,this._modulator.phase=t}}),Object.defineProperty(t.AMOscillator.prototype,"partials",{get:function(){return this._carrier.partials},set:function(t){this._carrier.partials=t}}),t.AMOscillator.prototype.dispose=function(){return t.Source.prototype.dispose.call(this),this._writable(["frequency","detune","harmonicity"]),this.frequency=null,this.detune=null,this.harmonicity.dispose(),this.harmonicity=null,this._carrier.dispose(),this._carrier=null,this._modulator.dispose(),this._modulator=null,this._modulationNode.dispose(),this._modulationNode=null,this._modulationScale.dispose(),this._modulationScale=null,this},t.AMOscillator}),i(function(t){return t.FatOscillator=function(){var e=t.defaults(arguments,["frequency","type","spread"],t.FatOscillator);t.Source.call(this,e),this.frequency=new t.Signal(e.frequency,t.Type.Frequency),this.detune=new t.Signal(e.detune,t.Type.Cents),this._oscillators=[],this._spread=e.spread,this._type=e.type,this._phase=e.phase,this._partials=t.defaultArg(e.partials,[]),this.count=e.count,this._readOnly(["frequency","detune"])},t.extend(t.FatOscillator,t.Source),t.FatOscillator.defaults={frequency:440,detune:0,phase:0,spread:20,count:3,type:"sawtooth"},t.FatOscillator.prototype._start=function(t){t=this.toSeconds(t),this._forEach(function(e){e.start(t)})},t.FatOscillator.prototype._stop=function(t){t=this.toSeconds(t),this._forEach(function(e){e.stop(t)})},t.FatOscillator.prototype.restart=function(t){t=this.toSeconds(t),this._forEach(function(e){e.restart(t)})},t.FatOscillator.prototype._forEach=function(t){for(var e=0;e<this._oscillators.length;e++)t.call(this,this._oscillators[e],e)},Object.defineProperty(t.FatOscillator.prototype,"type",{get:function(){return this._type},set:function(t){this._type=t,this._forEach(function(e){e.type=t})}}),Object.defineProperty(t.FatOscillator.prototype,"spread",{get:function(){return this._spread},set:function(t){if(this._spread=t,this._oscillators.length>1){var e=-t/2,i=t/(this._oscillators.length-1);this._forEach(function(t,n){t.detune.value=e+i*n})}}}),Object.defineProperty(t.FatOscillator.prototype,"count",{get:function(){return this._oscillators.length},set:function(e){if(e=Math.max(e,1),this._oscillators.length!==e){this._forEach(function(t){t.dispose()}),this._oscillators=[];for(var i=0;i<e;i++){var n=new t.Oscillator;this.type===t.Oscillator.Type.Custom?n.partials=this._partials:n.type=this._type,n.phase=this._phase,n.volume.value=-6-1.1*e,this.frequency.connect(n.frequency),this.detune.connect(n.detune),n.connect(this.output),this._oscillators[i]=n}this.spread=this._spread,this.state===t.State.Started&&this._forEach(function(t){t.start()})}}}),Object.defineProperty(t.FatOscillator.prototype,"phase",{get:function(){return this._phase},set:function(t){this._phase=t,this._forEach(function(e){e.phase=t})}}),Object.defineProperty(t.FatOscillator.prototype,"partials",{get:function(){return this._partials},set:function(e){this._partials=e,this._type=t.Oscillator.Type.Custom,this._forEach(function(t){t.partials=e})}}),t.FatOscillator.prototype.dispose=function(){return t.Source.prototype.dispose.call(this),this._writable(["frequency","detune"]),this.frequency.dispose(),this.frequency=null,this.detune.dispose(),this.detune=null,this._forEach(function(t){t.dispose()}),this._oscillators=null,this._partials=null,this},t.FatOscillator}),i(function(t){t.OmniOscillator=function(){var e=t.defaults(arguments,["frequency","type"],t.OmniOscillator);t.Source.call(this,e),this.frequency=new t.Signal(e.frequency,t.Type.Frequency),this.detune=new t.Signal(e.detune,t.Type.Cents),this._sourceType=void 0,this._oscillator=null,this.type=e.type,this._readOnly(["frequency","detune"]),this.set(e)},t.extend(t.OmniOscillator,t.Source),t.OmniOscillator.defaults={frequency:440,detune:0,type:"sine",phase:0};var e="PulseOscillator",i="PWMOscillator",n="Oscillator",o="FMOscillator",r="AMOscillator",s="FatOscillator";return t.OmniOscillator.prototype._start=function(t){this._oscillator.start(t)},t.OmniOscillator.prototype._stop=function(t){this._oscillator.stop(t)},t.OmniOscillator.prototype.restart=function(t){this._oscillator.restart(t)},Object.defineProperty(t.OmniOscillator.prototype,"type",{get:function(){var t="";return this._sourceType===o?t="fm":this._sourceType===r?t="am":this._sourceType===s&&(t="fat"),t+this._oscillator.type},set:function(t){"fm"===t.substr(0,2)?(this._createNewOscillator(o),this._oscillator.type=t.substr(2)):"am"===t.substr(0,2)?(this._createNewOscillator(r),this._oscillator.type=t.substr(2)):"fat"===t.substr(0,3)?(this._createNewOscillator(s),this._oscillator.type=t.substr(3)):"pwm"===t?this._createNewOscillator(i):"pulse"===t?this._createNewOscillator(e):(this._createNewOscillator(n),this._oscillator.type=t)}}),Object.defineProperty(t.OmniOscillator.prototype,"partials",{get:function(){return this._oscillator.partials},set:function(t){this._oscillator.partials=t}}),t.OmniOscillator.prototype.set=function(e,i){return"type"===e?this.type=i:t.isObject(e)&&e.hasOwnProperty("type")&&(this.type=e.type),t.prototype.set.apply(this,arguments),this},t.OmniOscillator.prototype._createNewOscillator=function(e){if(e!==this._sourceType){this._sourceType=e;var i=t[e],n=this.now();if(null!==this._oscillator){var o=this._oscillator;o.stop(n),this.context.setTimeout(function(){o.dispose(),o=null},this.blockTime)}this._oscillator=new i,this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.connect(this.output),this.state===t.State.Started&&this._oscillator.start(n)}},Object.defineProperty(t.OmniOscillator.prototype,"phase",{get:function(){return this._oscillator.phase},set:function(t){this._oscillator.phase=t}}),Object.defineProperty(t.OmniOscillator.prototype,"width",{get:function(){if(this._sourceType===e)return this._oscillator.width}}),Object.defineProperty(t.OmniOscillator.prototype,"count",{get:function(){if(this._sourceType===s)return this._oscillator.count},set:function(t){this._sourceType===s&&(this._oscillator.count=t)}}),Object.defineProperty(t.OmniOscillator.prototype,"spread",{get:function(){if(this._sourceType===s)return this._oscillator.spread},set:function(t){this._sourceType===s&&(this._oscillator.spread=t)}}),Object.defineProperty(t.OmniOscillator.prototype,"modulationType",{get:function(){if(this._sourceType===o||this._sourceType===r)return this._oscillator.modulationType},set:function(t){this._sourceType!==o&&this._sourceType!==r||(this._oscillator.modulationType=t)}}),Object.defineProperty(t.OmniOscillator.prototype,"modulationIndex",{get:function(){if(this._sourceType===o)return this._oscillator.modulationIndex}}),Object.defineProperty(t.OmniOscillator.prototype,"harmonicity",{get:function(){if(this._sourceType===o||this._sourceType===r)return this._oscillator.harmonicity}}),Object.defineProperty(t.OmniOscillator.prototype,"modulationFrequency",{get:function(){if(this._sourceType===i)return this._oscillator.modulationFrequency}}),t.OmniOscillator.prototype.dispose=function(){return t.Source.prototype.dispose.call(this),this._writable(["frequency","detune"]),this.detune.dispose(),this.detune=null,this.frequency.dispose(),this.frequency=null,this._oscillator.dispose(),this._oscillator=null,this._sourceType=null,this},t.OmniOscillator}),i(function(t){return t.Instrument=function(e){e=t.defaultArg(e,t.Instrument.defaults),t.AudioNode.call(this),this._volume=this.output=new t.Volume(e.volume),this.volume=this._volume.volume,this._readOnly("volume"),this._scheduledEvents=[]},t.extend(t.Instrument,t.AudioNode),t.Instrument.defaults={volume:0},t.Instrument.prototype.triggerAttack=t.noOp,t.Instrument.prototype.triggerRelease=t.noOp,t.Instrument.prototype.sync=function(){return this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",0),this},t.Instrument.prototype._syncMethod=function(e,i){var n=this["_original_"+e]=this[e];this[e]=function(){var e=Array.prototype.slice.call(arguments),o=e[i],r=t.Transport.schedule(function(t){e[i]=t,n.apply(this,e)}.bind(this),o);this._scheduledEvents.push(r)}.bind(this)},t.Instrument.prototype.unsync=function(){return this._scheduledEvents.forEach(function(e){t.Transport.clear(e)}),this._scheduledEvents=[],this._original_triggerAttack&&(this.triggerAttack=this._original_triggerAttack,this.triggerRelease=this._original_triggerRelease),this},t.Instrument.prototype.triggerAttackRelease=function(t,e,i,n){return i=this.toSeconds(i),e=this.toSeconds(e),this.triggerAttack(t,i,n),this.triggerRelease(i+e),this},t.Instrument.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._volume.dispose(),this._volume=null,this._writable(["volume"]),this.volume=null,this.unsync(),this._scheduledEvents=null,this},t.Instrument}),i(function(t){return t.Monophonic=function(e){e=t.defaultArg(e,t.Monophonic.defaults),t.Instrument.call(this,e),this.portamento=e.portamento},t.extend(t.Monophonic,t.Instrument),t.Monophonic.defaults={portamento:0},t.Monophonic.prototype.triggerAttack=function(t,e,i){return e=this.toSeconds(e),this._triggerEnvelopeAttack(e,i),this.setNote(t,e),this},t.Monophonic.prototype.triggerRelease=function(t){return t=this.toSeconds(t),this._triggerEnvelopeRelease(t),this},t.Monophonic.prototype._triggerEnvelopeAttack=function(){},t.Monophonic.prototype._triggerEnvelopeRelease=function(){},t.Monophonic.prototype.getLevelAtTime=function(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)},t.Monophonic.prototype.setNote=function(t,e){if(e=this.toSeconds(e),this.portamento>0&&this.getLevelAtTime(e)>.05){var i=this.toSeconds(this.portamento);this.frequency.exponentialRampTo(t,i,e)}else this.frequency.setValueAtTime(t,e);return this},t.Monophonic}),i(function(t){return t.Synth=function(e){e=t.defaultArg(e,t.Synth.defaults),t.Monophonic.call(this,e),this.oscillator=new t.OmniOscillator(e.oscillator),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.envelope=new t.AmplitudeEnvelope(e.envelope),this.oscillator.chain(this.envelope,this.output),this._readOnly(["oscillator","frequency","detune","envelope"])},t.extend(t.Synth,t.Monophonic),t.Synth.defaults={oscillator:{type:"triangle"},envelope:{attack:.005,decay:.1,sustain:.3,release:1}},t.Synth.prototype._triggerEnvelopeAttack=function(t,e){return this.envelope.triggerAttack(t,e),this.oscillator.start(t),0===this.envelope.sustain&&this.oscillator.stop(t+this.envelope.attack+this.envelope.decay),this},t.Synth.prototype._triggerEnvelopeRelease=function(t){return t=this.toSeconds(t),this.envelope.triggerRelease(t),this.oscillator.stop(t+this.envelope.release),this},t.Synth.prototype.dispose=function(){return t.Monophonic.prototype.dispose.call(this),this._writable(["oscillator","frequency","detune","envelope"]),this.oscillator.dispose(),this.oscillator=null,this.envelope.dispose(),this.envelope=null,this.frequency=null,this.detune=null,this},t.Synth}),i(function(t){return t.AMSynth=function(e){e=t.defaultArg(e,t.AMSynth.defaults),t.Monophonic.call(this,e),this._carrier=new t.Synth,this._carrier.volume.value=-10,this.oscillator=this._carrier.oscillator,this.envelope=this._carrier.envelope.set(e.envelope),this._modulator=new t.Synth,this._modulator.volume.value=-10,this.modulation=this._modulator.oscillator.set(e.modulation),this.modulationEnvelope=this._modulator.envelope.set(e.modulationEnvelope),this.frequency=new t.Signal(440,t.Type.Frequency),this.detune=new t.Signal(e.detune,t.Type.Cents),this.harmonicity=new t.Multiply(e.harmonicity),this.harmonicity.units=t.Type.Positive,this._modulationScale=new t.AudioToGain,this._modulationNode=new t.Gain,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),this._readOnly(["frequency","harmonicity","oscillator","envelope","modulation","modulationEnvelope","detune"])},t.extend(t.AMSynth,t.Monophonic),t.AMSynth.defaults={harmonicity:3,detune:0,oscillator:{type:"sine"},envelope:{attack:.01,decay:.01,sustain:1,release:.5},modulation:{type:"square"},modulationEnvelope:{attack:.5,decay:0,sustain:1,release:.5}},t.AMSynth.prototype._triggerEnvelopeAttack=function(t,e){return t=this.toSeconds(t),this._carrier._triggerEnvelopeAttack(t,e),this._modulator._triggerEnvelopeAttack(t),this},t.AMSynth.prototype._triggerEnvelopeRelease=function(t){return this._carrier._triggerEnvelopeRelease(t),this._modulator._triggerEnvelopeRelease(t),this},t.AMSynth.prototype.dispose=function(){return t.Monophonic.prototype.dispose.call(this),this._writable(["frequency","harmonicity","oscillator","envelope","modulation","modulationEnvelope","detune"]),this._carrier.dispose(),this._carrier=null,this._modulator.dispose(),this._modulator=null,this.frequency.dispose(),this.frequency=null,this.detune.dispose(),this.detune=null,this.harmonicity.dispose(),this.harmonicity=null,this._modulationScale.dispose(),this._modulationScale=null,this._modulationNode.dispose(),this._modulationNode=null,this.oscillator=null,this.envelope=null,this.modulationEnvelope=null,this.modulation=null,this},t.AMSynth}),i(function(t){return t.MonoSynth=function(e){e=t.defaultArg(e,t.MonoSynth.defaults),t.Monophonic.call(this,e),this.oscillator=new t.OmniOscillator(e.oscillator),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.filter=new t.Filter(e.filter),this.filterEnvelope=new t.FrequencyEnvelope(e.filterEnvelope),this.envelope=new t.AmplitudeEnvelope(e.envelope),this.oscillator.chain(this.filter,this.envelope,this.output),this.filterEnvelope.connect(this.filter.frequency),this._readOnly(["oscillator","frequency","detune","filter","filterEnvelope","envelope"])},t.extend(t.MonoSynth,t.Monophonic),t.MonoSynth.defaults={frequency:"C4",detune:0,oscillator:{type:"square"},filter:{Q:6,type:"lowpass",rolloff:-24},envelope:{attack:.005,decay:.1,sustain:.9,release:1},filterEnvelope:{attack:.06,decay:.2,sustain:.5,release:2,baseFrequency:200,octaves:7,exponent:2}},t.MonoSynth.prototype._triggerEnvelopeAttack=function(t,e){return t=this.toSeconds(t),this.envelope.triggerAttack(t,e),this.filterEnvelope.triggerAttack(t),this.oscillator.start(t),0===this.envelope.sustain&&this.oscillator.stop(t+this.envelope.attack+this.envelope.decay),this},t.MonoSynth.prototype._triggerEnvelopeRelease=function(t){return this.envelope.triggerRelease(t),this.filterEnvelope.triggerRelease(t),this.oscillator.stop(t+this.envelope.release),this},t.MonoSynth.prototype.dispose=function(){return t.Monophonic.prototype.dispose.call(this),this._writable(["oscillator","frequency","detune","filter","filterEnvelope","envelope"]),this.oscillator.dispose(),this.oscillator=null,this.envelope.dispose(),this.envelope=null,this.filterEnvelope.dispose(),this.filterEnvelope=null,this.filter.dispose(),this.filter=null,this.frequency=null,this.detune=null,this},t.MonoSynth}),i(function(t){return t.DuoSynth=function(e){e=t.defaultArg(e,t.DuoSynth.defaults),t.Monophonic.call(this,e),this.voice0=new t.MonoSynth(e.voice0),this.voice0.volume.value=-10,this.voice1=new t.MonoSynth(e.voice1),this.voice1.volume.value=-10,this._vibrato=new t.LFO(e.vibratoRate,-50,50),this._vibrato.start(),this.vibratoRate=this._vibrato.frequency,this._vibratoGain=new t.Gain(e.vibratoAmount,t.Type.Positive),this.vibratoAmount=this._vibratoGain.gain,this.frequency=new t.Signal(440,t.Type.Frequency),this.harmonicity=new t.Multiply(e.harmonicity),this.harmonicity.units=t.Type.Positive,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.voice0.connect(this.output),this.voice1.connect(this.output),this._readOnly(["voice0","voice1","frequency","vibratoAmount","vibratoRate"])},t.extend(t.DuoSynth,t.Monophonic),t.DuoSynth.defaults={vibratoAmount:.5,vibratoRate:5,harmonicity:1.5,voice0:{volume:-10,portamento:0,oscillator:{type:"sine"},filterEnvelope:{attack:.01,decay:0,sustain:1,release:.5},envelope:{attack:.01,decay:0,sustain:1,release:.5}},voice1:{volume:-10,portamento:0,oscillator:{type:"sine"},filterEnvelope:{attack:.01,decay:0,sustain:1,release:.5},envelope:{attack:.01,decay:0,sustain:1,release:.5}}},t.DuoSynth.prototype._triggerEnvelopeAttack=function(t,e){return t=this.toSeconds(t),this.voice0._triggerEnvelopeAttack(t,e),this.voice1._triggerEnvelopeAttack(t,e),this},t.DuoSynth.prototype._triggerEnvelopeRelease=function(t){return this.voice0._triggerEnvelopeRelease(t),this.voice1._triggerEnvelopeRelease(t),this},t.DuoSynth.prototype.getLevelAtTime=function(t){return(this.voice0.getLevelAtTime(t)+this.voice1.getLevelAtTime(t))/2},t.DuoSynth.prototype.dispose=function(){return t.Monophonic.prototype.dispose.call(this),this._writable(["voice0","voice1","frequency","vibratoAmount","vibratoRate"]),this.voice0.dispose(),this.voice0=null,this.voice1.dispose(),this.voice1=null,this.frequency.dispose(),this.frequency=null,this._vibratoGain.dispose(),this._vibratoGain=null,this._vibrato=null,this.harmonicity.dispose(),this.harmonicity=null,this.vibratoAmount.dispose(),this.vibratoAmount=null,this.vibratoRate=null,this},t.DuoSynth}),i(function(t){return t.FMSynth=function(e){e=t.defaultArg(e,t.FMSynth.defaults),t.Monophonic.call(this,e),this._carrier=new t.Synth(e.carrier),this._carrier.volume.value=-10,this.oscillator=this._carrier.oscillator,this.envelope=this._carrier.envelope.set(e.envelope),this._modulator=new t.Synth(e.modulator),this._modulator.volume.value=-10,this.modulation=this._modulator.oscillator.set(e.modulation),this.modulationEnvelope=this._modulator.envelope.set(e.modulationEnvelope),this.frequency=new t.Signal(440,t.Type.Frequency),this.detune=new t.Signal(e.detune,t.Type.Cents),this.harmonicity=new t.Multiply(e.harmonicity),this.harmonicity.units=t.Type.Positive,this.modulationIndex=new t.Multiply(e.modulationIndex),this.modulationIndex.units=t.Type.Positive,this._modulationNode=new t.Gain(0),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),this._readOnly(["frequency","harmonicity","modulationIndex","oscillator","envelope","modulation","modulationEnvelope","detune"])},t.extend(t.FMSynth,t.Monophonic),t.FMSynth.defaults={harmonicity:3,modulationIndex:10,detune:0,oscillator:{type:"sine"},envelope:{attack:.01,decay:.01,sustain:1,release:.5},modulation:{type:"square"},modulationEnvelope:{attack:.5,decay:0,sustain:1,release:.5}},t.FMSynth.prototype._triggerEnvelopeAttack=function(t,e){return t=this.toSeconds(t),this._carrier._triggerEnvelopeAttack(t,e),this._modulator._triggerEnvelopeAttack(t),this},t.FMSynth.prototype._triggerEnvelopeRelease=function(t){return t=this.toSeconds(t),this._carrier._triggerEnvelopeRelease(t),this._modulator._triggerEnvelopeRelease(t),this},t.FMSynth.prototype.dispose=function(){return t.Monophonic.prototype.dispose.call(this),this._writable(["frequency","harmonicity","modulationIndex","oscillator","envelope","modulation","modulationEnvelope","detune"]),this._carrier.dispose(),this._carrier=null,this._modulator.dispose(),this._modulator=null,this.frequency.dispose(),this.frequency=null,this.detune.dispose(),this.detune=null,this.modulationIndex.dispose(),this.modulationIndex=null,this.harmonicity.dispose(),this.harmonicity=null,this._modulationNode.dispose(),this._modulationNode=null,this.oscillator=null,this.envelope=null,this.modulationEnvelope=null,this.modulation=null,this},t.FMSynth}),i(function(t){return t.MembraneSynth=function(e){e=t.defaultArg(e,t.MembraneSynth.defaults),t.Instrument.call(this,e),this.oscillator=new t.OmniOscillator(e.oscillator),this.envelope=new t.AmplitudeEnvelope(e.envelope),this.octaves=e.octaves,this.pitchDecay=e.pitchDecay,this.oscillator.chain(this.envelope,this.output),this._readOnly(["oscillator","envelope"])},t.extend(t.MembraneSynth,t.Instrument),t.MembraneSynth.defaults={pitchDecay:.05,octaves:10,oscillator:{type:"sine"},envelope:{attack:.001,decay:.4,sustain:.01,release:1.4,attackCurve:"exponential"}},t.MembraneSynth.prototype.triggerAttack=function(t,e,i){e=this.toSeconds(e);var n=(t=this.toFrequency(t))*this.octaves;return this.oscillator.frequency.setValueAtTime(n,e),this.oscillator.frequency.exponentialRampToValueAtTime(t,e+this.toSeconds(this.pitchDecay)),this.envelope.triggerAttack(e,i),this.oscillator.start(e),this},t.MembraneSynth.prototype.triggerRelease=function(t){return t=this.toSeconds(t),this.envelope.triggerRelease(t),this.oscillator.stop(t+this.envelope.release),this},t.MembraneSynth.prototype.dispose=function(){return t.Instrument.prototype.dispose.call(this),this._writable(["oscillator","envelope"]),this.oscillator.dispose(),this.oscillator=null,this.envelope.dispose(),this.envelope=null,this},t.MembraneSynth}),i(function(t){var e=[1,1.483,1.932,2.546,2.63,3.897];return t.MetalSynth=function(i){i=t.defaultArg(i,t.MetalSynth.defaults),t.Instrument.call(this,i),this.frequency=new t.Signal(i.frequency,t.Type.Frequency),this._oscillators=[],this._freqMultipliers=[],this._amplitue=new t.Gain(0).connect(this.output),this._highpass=new t.Filter({type:"highpass",Q:-3.0102999566398125}).connect(this._amplitue),this._octaves=i.octaves,this._filterFreqScaler=new t.Scale(i.resonance,7e3),this.envelope=new t.Envelope({attack:i.envelope.attack,attackCurve:"linear",decay:i.envelope.decay,sustain:0,release:i.envelope.release}).chain(this._filterFreqScaler,this._highpass.frequency),this.envelope.connect(this._amplitue.gain);for(var n=0;n<e.length;n++){var o=new t.FMOscillator({type:"square",modulationType:"square",harmonicity:i.harmonicity,modulationIndex:i.modulationIndex});o.connect(this._highpass),this._oscillators[n]=o;var r=new t.Multiply(e[n]);this._freqMultipliers[n]=r,this.frequency.chain(r,o.frequency)}this.octaves=i.octaves},t.extend(t.MetalSynth,t.Instrument),t.MetalSynth.defaults={frequency:200,envelope:{attack:.001,decay:1.4,release:.2},harmonicity:5.1,modulationIndex:32,resonance:4e3,octaves:1.5},t.MetalSynth.prototype.triggerAttack=function(e,i){return e=this.toSeconds(e),i=t.defaultArg(i,1),this.envelope.triggerAttack(e,i),this._oscillators.forEach(function(t){t.start(e)}),0===this.envelope.sustain&&this._oscillators.forEach(function(t){t.stop(e+this.envelope.attack+this.envelope.decay)}.bind(this)),this},t.MetalSynth.prototype.triggerRelease=function(t){return t=this.toSeconds(t),this.envelope.triggerRelease(t),this._oscillators.forEach(function(e){e.stop(t+this.envelope.release)}.bind(this)),this},t.MetalSynth.prototype.sync=function(){return this._syncMethod("triggerAttack",0),this._syncMethod("triggerRelease",0),this},t.MetalSynth.prototype.triggerAttackRelease=function(t,e,i){return e=this.toSeconds(e),t=this.toSeconds(t),this.triggerAttack(e,i),this.triggerRelease(e+t),this},Object.defineProperty(t.MetalSynth.prototype,"modulationIndex",{get:function(){return this._oscillators[0].modulationIndex.value},set:function(t){for(var e=0;e<this._oscillators.length;e++)this._oscillators[e].modulationIndex.value=t}}),Object.defineProperty(t.MetalSynth.prototype,"harmonicity",{get:function(){return this._oscillators[0].harmonicity.value},set:function(t){for(var e=0;e<this._oscillators.length;e++)this._oscillators[e].harmonicity.value=t}}),Object.defineProperty(t.MetalSynth.prototype,"resonance",{get:function(){return this._filterFreqScaler.min},set:function(t){this._filterFreqScaler.min=t,this.octaves=this._octaves}}),Object.defineProperty(t.MetalSynth.prototype,"octaves",{get:function(){return this._octaves},set:function(t){this._octaves=t,this._filterFreqScaler.max=this._filterFreqScaler.min*Math.pow(2,t)}}),t.MetalSynth.prototype.dispose=function(){t.Instrument.prototype.dispose.call(this);for(var e=0;e<this._oscillators.length;e++)this._oscillators[e].dispose(),this._freqMultipliers[e].dispose();this._oscillators=null,this._freqMultipliers=null,this.frequency.dispose(),this.frequency=null,this._filterFreqScaler.dispose(),this._filterFreqScaler=null,this._amplitue.dispose(),this._amplitue=null,this.envelope.dispose(),this.envelope=null,this._highpass.dispose(),this._highpass=null},t.MetalSynth}),i(function(t){return t.NoiseSynth=function(e){e=t.defaultArg(e,t.NoiseSynth.defaults),t.Instrument.call(this,e),this.noise=new t.Noise,this.envelope=new t.AmplitudeEnvelope(e.envelope),this.noise.chain(this.envelope,this.output),this._readOnly(["noise","envelope"])},t.extend(t.NoiseSynth,t.Instrument),t.NoiseSynth.defaults={noise:{type:"white"},envelope:{attack:.005,decay:.1,sustain:0}},t.NoiseSynth.prototype.triggerAttack=function(t,e){return this.envelope.triggerAttack(t,e),this.noise.start(t),0===this.envelope.sustain&&this.noise.stop(t=this.envelope.attack+this.envelope.decay),this},t.NoiseSynth.prototype.triggerRelease=function(t){return this.envelope.triggerRelease(t),this.noise.stop(t+this.envelope.release),this},t.NoiseSynth.prototype.sync=function(){return this._syncMethod("triggerAttack",0),this._syncMethod("triggerRelease",0),this},t.NoiseSynth.prototype.triggerAttackRelease=function(t,e,i){return e=this.toSeconds(e),t=this.toSeconds(t),this.triggerAttack(e,i),this.triggerRelease(e+t),this},t.NoiseSynth.prototype.dispose=function(){return t.Instrument.prototype.dispose.call(this),this._writable(["noise","envelope"]),this.noise.dispose(),this.noise=null,this.envelope.dispose(),this.envelope=null,this},t.NoiseSynth}),i(function(t){return t.PluckSynth=function(e){e=t.defaultArg(e,t.PluckSynth.defaults),t.Instrument.call(this,e),this._noise=new t.Noise("pink"),this.attackNoise=e.attackNoise,this._lfcf=new t.LowpassCombFilter({resonance:e.resonance,dampening:e.dampening}),this.resonance=this._lfcf.resonance,this.dampening=this._lfcf.dampening,this._noise.connect(this._lfcf),this._lfcf.connect(this.output),this._readOnly(["resonance","dampening"])},t.extend(t.PluckSynth,t.Instrument),t.PluckSynth.defaults={attackNoise:1,dampening:4e3,resonance:.7},t.PluckSynth.prototype.triggerAttack=function(t,e){t=this.toFrequency(t),e=this.toSeconds(e);var i=1/t;return this._lfcf.delayTime.setValueAtTime(i,e),this._noise.start(e),this._noise.stop(e+i*this.attackNoise),this},t.PluckSynth.prototype.dispose=function(){return t.Instrument.prototype.dispose.call(this),this._noise.dispose(),this._lfcf.dispose(),this._noise=null,this._lfcf=null,this._writable(["resonance","dampening"]),this.dampening=null,this.resonance=null,this},t.PluckSynth}),i(function(t){return t.PolySynth=function(){var e=t.defaults(arguments,["polyphony","voice"],t.PolySynth);t.Instrument.call(this,e),(e=t.defaultArg(e,t.Instrument.defaults)).polyphony=Math.min(t.PolySynth.MAX_POLYPHONY,e.polyphony),this.voices=new Array(e.polyphony),this._triggers=new Array(e.polyphony),this.detune=new t.Signal(e.detune,t.Type.Cents),this._readOnly("detune");for(var i=0;i<e.polyphony;i++){var n=new e.voice(arguments[2],arguments[3]);if(!(n instanceof t.Monophonic))throw new Error("Synth constructor must be instance of Tone.Monophonic");this.voices[i]=n,n.connect(this.output),n.hasOwnProperty("detune")&&this.detune.connect(n.detune),this._triggers[i]={release:-1,note:null,voice:n}}},t.extend(t.PolySynth,t.Instrument),t.PolySynth.defaults={polyphony:4,volume:0,detune:0,voice:t.Synth},t.PolySynth.prototype.triggerAttack=function(t,e,i){Array.isArray(t)||(t=[t]),e=this.toSeconds(e);for(var n=0;n<t.length;n++){for(var o=t[n],r=this._triggers[0],s=1;s<this._triggers.length;s++)this._triggers[s].release<r.release&&(r=this._triggers[s]);r.release=1/0,r.note=JSON.stringify(o),r.voice.triggerAttack(o,e,i)}return this},t.PolySynth.prototype.triggerAttackRelease=function(e,i,n,o){if(n=this.toSeconds(n),this.triggerAttack(e,n,o),t.isArray(i)&&t.isArray(e))for(var r=0;r<e.length;r++){var s=i[Math.min(r,i.length-1)];this.triggerRelease(e[r],n+this.toSeconds(s))}else this.triggerRelease(e,n+this.toSeconds(i));return this},t.PolySynth.prototype.triggerRelease=function(t,e){Array.isArray(t)||(t=[t]),e=this.toSeconds(e);for(var i=0;i<t.length;i++)for(var n=JSON.stringify(t[i]),o=0;o<this._triggers.length;o++){var r=this._triggers[o];r.note===n&&r.release>e&&(r.voice.triggerRelease(e),r.release=e)}return this},t.PolySynth.prototype.sync=function(){return this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1),this},t.PolySynth.prototype.set=function(t,e,i){for(var n=0;n<this.voices.length;n++)this.voices[n].set(t,e,i);return this},t.PolySynth.prototype.get=function(t){return this.voices[0].get(t)},t.PolySynth.prototype.releaseAll=function(t){t=this.toSeconds(t);for(var e=0;e<this._triggers.length;e++){var i=this._triggers[e];i.release>t&&(i.release=t,i.voice.triggerRelease(t))}return this},t.PolySynth.prototype.dispose=function(){t.Instrument.prototype.dispose.call(this);for(var e=0;e<this.voices.length;e++)this.voices[e].dispose(),this.voices[e]=null;return this._writable("detune"),this.detune.dispose(),this.detune=null,this.voices=null,this._triggers=null,this},t.PolySynth.MAX_POLYPHONY=20,t.PolySynth}),i(function(t){return t.Sampler=function(e){var i=Array.prototype.slice.call(arguments);i.shift();var n=t.defaults(i,["onload","baseUrl"],t.Sampler);t.Instrument.call(this,n);var o={};for(var r in e)if(t.isNote(r))o[t.Frequency(r).toMidi()]=e[r];else{if(isNaN(parseFloat(r)))throw new Error("Tone.Sampler: url keys must be the note's pitch");o[r]=e[r]}this._buffers=new t.Buffers(o,n.onload,n.baseUrl),this._activeSources={},this.attack=n.attack,this.release=n.release},t.extend(t.Sampler,t.Instrument),t.Sampler.defaults={attack:0,release:.1,onload:t.noOp,baseUrl:""},t.Sampler.prototype._findClosest=function(t){for(var e=0;e<96;){if(this._buffers.has(t+e))return-e;if(this._buffers.has(t-e))return e;e++}return null},t.Sampler.prototype.triggerAttack=function(e,i,n){var o=t.Frequency(e).toMidi(),r=this._findClosest(o);if(null!==r){var s=o-r,a=this._buffers.get(s),l=new t.BufferSource({buffer:a,playbackRate:t.intervalToFrequencyRatio(r),fadeIn:this.attack,fadeOut:this.release,curve:"exponential"}).connect(this.output);l.start(i,0,a.duration,n),t.isArray(this._activeSources[o])||(this._activeSources[o]=[]),this._activeSources[o].push({note:o,source:l})}return this},t.Sampler.prototype.triggerRelease=function(e,i){var n=t.Frequency(e).toMidi();if(this._activeSources[n]&&this._activeSources[n].length){var o=this._activeSources[n].shift().source;i=this.toSeconds(i),o.stop(i+this.release,this.release)}return this},t.Sampler.prototype.releaseAll=function(t){for(var e in t=this.toSeconds(t),this._activeSources)for(var i=this._activeSources[e];i.length;)i.shift().source.stop(t+this.release,this.release);return this},t.Sampler.prototype.sync=function(){return this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1),this},t.Sampler.prototype.triggerAttackRelease=function(t,e,i,n){return i=this.toSeconds(i),e=this.toSeconds(e),this.triggerAttack(t,i,n),this.triggerRelease(t,i+e),this},t.Sampler.prototype.add=function(e,i,n){if(t.isNote(e)){var o=t.Frequency(e).toMidi();this._buffers.add(o,i,n)}else{if(isNaN(parseFloat(e)))throw new Error("Tone.Sampler: note must be the note's pitch. Instead got "+e);this._buffers.add(e,i,n)}},Object.defineProperty(t.Sampler.prototype,"loaded",{get:function(){return this._buffers.loaded}}),t.Sampler.prototype.dispose=function(){for(var e in t.Instrument.prototype.dispose.call(this),this._buffers.dispose(),this._buffers=null,this._activeSources)this._activeSources[e].forEach(function(t){t.source.dispose()});return this._activeSources=null,this},t.Sampler}),i(function(t){t.supported&&(OscillatorNode.prototype.setPeriodicWave||(OscillatorNode.prototype.setPeriodicWave=OscillatorNode.prototype.setWaveTable),AudioContext.prototype.createPeriodicWave||(AudioContext.prototype.createPeriodicWave=AudioContext.prototype.createWaveTable))}),i(function(t){return t.GainToAudio=function(){t.SignalBase.call(this),this._norm=this.input=this.output=new t.WaveShaper(function(t){return 2*Math.abs(t)-1})},t.extend(t.GainToAudio,t.SignalBase),t.GainToAudio.prototype.dispose=function(){return t.SignalBase.prototype.dispose.call(this),this._norm.dispose(),this._norm=null,this},t.GainToAudio}),i(function(t){return t.Normalize=function(e,i){t.SignalBase.call(this),this._inputMin=t.defaultArg(e,0),this._inputMax=t.defaultArg(i,1),this._sub=this.input=new t.Add(0),this._div=this.output=new t.Multiply(1),this._sub.connect(this._div),this._setRange()},t.extend(t.Normalize,t.SignalBase),Object.defineProperty(t.Normalize.prototype,"min",{get:function(){return this._inputMin},set:function(t){this._inputMin=t,this._setRange()}}),Object.defineProperty(t.Normalize.prototype,"max",{get:function(){return this._inputMax},set:function(t){this._inputMax=t,this._setRange()}}),t.Normalize.prototype._setRange=function(){this._sub.value=-this._inputMin,this._div.value=1/(this._inputMax-this._inputMin)},t.Normalize.prototype.dispose=function(){return t.SignalBase.prototype.dispose.call(this),this._sub.dispose(),this._sub=null,this._div.dispose(),this._div=null,this},t.Normalize}),i(function(t){return t.TransportTimelineSignal=function(){t.Signal.apply(this,arguments),this.output=this._outputSig=new t.Signal(this._initialValue),this._lastVal=this.value,this._synced=t.Transport.scheduleRepeat(this._onTick.bind(this),"1i"),this._bindAnchorValue=this._anchorValue.bind(this),t.Transport.on("start stop pause",this._bindAnchorValue),this._events.memory=1/0},t.extend(t.TransportTimelineSignal,t.Signal),t.TransportTimelineSignal.prototype._onTick=function(e){var i=this.getValueAtTime(t.Transport.seconds);this._lastVal!==i&&(this._lastVal=i,this._outputSig.linearRampToValueAtTime(i,e))},t.TransportTimelineSignal.prototype._anchorValue=function(e){var i=this.getValueAtTime(t.Transport.seconds);return this._lastVal=i,this._outputSig.cancelScheduledValues(e),this._outputSig.setValueAtTime(i,e),this},t.TransportTimelineSignal.prototype.getValueAtTime=function(e){return e=t.TransportTime(e),t.Signal.prototype.getValueAtTime.call(this,e)},t.TransportTimelineSignal.prototype.setValueAtTime=function(e,i){return i=t.TransportTime(i),t.Signal.prototype.setValueAtTime.call(this,e,i),this},t.TransportTimelineSignal.prototype.linearRampToValueAtTime=function(e,i){return i=t.TransportTime(i),t.Signal.prototype.linearRampToValueAtTime.call(this,e,i),this},t.TransportTimelineSignal.prototype.exponentialRampToValueAtTime=function(e,i){return i=t.TransportTime(i),t.Signal.prototype.exponentialRampToValueAtTime.call(this,e,i),this},t.TransportTimelineSignal.prototype.setTargetAtTime=function(e,i,n){return i=t.TransportTime(i),t.Signal.prototype.setTargetAtTime.call(this,e,i,n),this},t.TransportTimelineSignal.prototype.cancelScheduledValues=function(e){return e=t.TransportTime(e),t.Signal.prototype.cancelScheduledValues.call(this,e),this},t.TransportTimelineSignal.prototype.setValueCurveAtTime=function(e,i,n,o){return i=t.TransportTime(i),n=t.TransportTime(n),t.Signal.prototype.setValueCurveAtTime.call(this,e,i,n,o),this},t.TransportTimelineSignal.prototype.cancelAndHoldAtTime=function(e){return t.Signal.prototype.cancelAndHoldAtTime.call(this,t.TransportTime(e))},t.TransportTimelineSignal.prototype.dispose=function(){t.Transport.clear(this._synced),t.Transport.off("start stop pause",this._syncedCallback),this._events.cancel(0),t.Signal.prototype.dispose.call(this),this._outputSig.dispose(),this._outputSig=null},t.TransportTimelineSignal}),i(function(t){return t.GrainPlayer=function(){var e=t.defaults(arguments,["url","onload"],t.GrainPlayer);t.Source.call(this,e),this.buffer=new t.Buffer(e.url,e.onload),this._clock=new t.Clock(this._tick.bind(this),e.grainSize),this._loopStart=0,this._loopEnd=0,this._activeSources=[],this._playbackRate=e.playbackRate,this._grainSize=e.grainSize,this._overlap=e.overlap,this.detune=e.detune,this.overlap=e.overlap,this.loop=e.loop,this.playbackRate=e.playbackRate,this.grainSize=e.grainSize,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.reverse=e.reverse,this._clock.on("stop",this._onstop.bind(this))},t.extend(t.GrainPlayer,t.Source),t.GrainPlayer.defaults={onload:t.noOp,overlap:.1,grainSize:.2,playbackRate:1,detune:0,loop:!1,loopStart:0,loopEnd:0,reverse:!1},t.GrainPlayer.prototype._start=function(e,i,n){i=t.defaultArg(i,0),i=this.toSeconds(i),e=this.toSeconds(e),this._offset=i,this._clock.start(e),n&&this.stop(e+this.toSeconds(n))},t.GrainPlayer.prototype._stop=function(t){this._clock.stop(t)},t.GrainPlayer.prototype._onstop=function(t){this._activeSources.forEach(function(e){e.stop(t,0)})},t.GrainPlayer.prototype._tick=function(e){var i=this._offset<this._overlap?0:this._overlap,n=new t.BufferSource({buffer:this.buffer,fadeIn:i,fadeOut:this._overlap,loop:this.loop,loopStart:this._loopStart,loopEnd:this._loopEnd,playbackRate:t.intervalToFrequencyRatio(this.detune/100)}).connect(this.output);n.start(e,this._offset),this._offset+=this.grainSize,n.stop(e+this.grainSize),this._activeSources.push(n),n.onended=function(){var t=this._activeSources.indexOf(n);-1!==t&&this._activeSources.splice(t,1)}.bind(this)},t.GrainPlayer.prototype.seek=function(t,e){return this._offset=this.toSeconds(t),this._tick(this.toSeconds(e)),this},Object.defineProperty(t.GrainPlayer.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(t){this._playbackRate=t,this.grainSize=this._grainSize}}),Object.defineProperty(t.GrainPlayer.prototype,"loopStart",{get:function(){return this._loopStart},set:function(t){this._loopStart=this.toSeconds(t)}}),Object.defineProperty(t.GrainPlayer.prototype,"loopEnd",{get:function(){return this._loopEnd},set:function(t){this._loopEnd=this.toSeconds(t)}}),Object.defineProperty(t.GrainPlayer.prototype,"reverse",{get:function(){return this.buffer.reverse},set:function(t){this.buffer.reverse=t}}),Object.defineProperty(t.GrainPlayer.prototype,"grainSize",{get:function(){return this._grainSize},set:function(t){this._grainSize=this.toSeconds(t),this._clock.frequency.value=this._playbackRate/this._grainSize}}),Object.defineProperty(t.GrainPlayer.prototype,"overlap",{get:function(){return this._overlap},set:function(t){this._overlap=this.toSeconds(t)}}),t.GrainPlayer.prototype.dispose=function(){return t.Source.prototype.dispose.call(this),this.buffer.dispose(),this.buffer=null,this._clock.dispose(),this._clock=null,this._activeSources.forEach(function(t){t.dispose()}),this._activeSources=null,this},t.GrainPlayer}),i(function(t){return t.Player=function(e){var i;e instanceof t.Buffer&&e.loaded?(e=e.get(),i=t.Player.defaults):i=t.defaults(arguments,["url","onload"],t.Player),t.Source.call(this,i),this.autostart=i.autostart,this._buffer=new t.Buffer({url:i.url,onload:this._onload.bind(this,i.onload),reverse:i.reverse}),e instanceof AudioBuffer&&this._buffer.set(e),this._loop=i.loop,this._loopStart=i.loopStart,this._loopEnd=i.loopEnd,this._playbackRate=i.playbackRate,this._activeSources=[],this._elapsedTime=new t.TickSource(i.playbackRate),this.fadeIn=i.fadeIn,this.fadeOut=i.fadeOut},t.extend(t.Player,t.Source),t.Player.defaults={onload:t.noOp,playbackRate:1,loop:!1,autostart:!1,loopStart:0,loopEnd:0,retrigger:!1,reverse:!1,fadeIn:0,fadeOut:0},t.Player.prototype.load=function(t,e){return this._buffer.load(t,this._onload.bind(this,e))},t.Player.prototype._onload=function(e){(e=t.defaultArg(e,t.noOp))(this),this.autostart&&this.start()},t.Player.prototype._onSourceEnd=function(t){var e=this._activeSources.indexOf(t);this._activeSources.splice(e,1)},t.Player.prototype._start=function(e,i,n){i=this._loop?t.defaultArg(i,this._loopStart):t.defaultArg(i,0),i=this.toSeconds(i);var o=t.defaultArg(n,Math.max(this._buffer.duration-i,0));o=this.toSeconds(o),e=this.toSeconds(e),this._elapsedTime.start(e,i);var r=new t.BufferSource({buffer:this._buffer,loop:this._loop,loopStart:this._loopStart,loopEnd:this._loopEnd,onended:this._onSourceEnd.bind(this),playbackRate:this._playbackRate,fadeIn:this.fadeIn,fadeOut:this.fadeOut}).connect(this.output);return this._loop||this._synced||this._state.setStateAtTime(t.State.Stopped,e+o/this._playbackRate),this._activeSources.push(r),this._loop&&t.isUndef(n)?r.start(e,i):r.start(e,i,o),this},t.Player.prototype._stop=function(t){return t=this.toSeconds(t),this._elapsedTime.stop(t),this._activeSources.forEach(function(e){e.stop(t)}),this},t.Player.prototype.restart=function(t,e,i){return this._stop(t),this._start(t,e,i),this},t.Player.prototype.seek=function(e,i){return i=this.toSeconds(i),this._state.getValueAtTime(i)===t.State.Started&&(e=this.toSeconds(e),this._stop(i),this._start(i,e)),this},t.Player.prototype.setLoopPoints=function(t,e){return this.loopStart=t,this.loopEnd=e,this},Object.defineProperty(t.Player.prototype,"loopStart",{get:function(){return this._loopStart},set:function(t){this._loopStart=t,this._activeSources.forEach(function(e){e.loopStart=t})}}),Object.defineProperty(t.Player.prototype,"loopEnd",{get:function(){return this._loopEnd},set:function(t){this._loopEnd=t,this._activeSources.forEach(function(e){e.loopEnd=t})}}),Object.defineProperty(t.Player.prototype,"buffer",{get:function(){return this._buffer},set:function(t){this._buffer.set(t)}}),Object.defineProperty(t.Player.prototype,"loop",{get:function(){return this._loop},set:function(e){if(this._loop!==e){this._loop=e;var i=this.now();if(e){var n=this._state.getNextState(t.State.Stopped,i);n&&(this._activeSources.forEach(function(t){t.loop=e}),this._state.cancel(n.time),this._elapsedTime.cancel(n.time))}else this._stopAtNextIteration(i)}}}),t.Player.prototype._stopAtNextIteration=function(e){if(this._state.getValueAtTime(e)===t.State.Started){var i=this._state.getNextState(t.State.Stopped,e),n=this._elapsedTime.getTicksAtTime(e),o=Math.max(Math.ceil(n/this.buffer.duration),1),r=this._elapsedTime.getTimeOfTick(o*this.buffer.duration,i?i.time-this.sampleTime:1/0);this.stop(r)}},Object.defineProperty(t.Player.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(t){this._playbackRate=t;var e=this.now();this._elapsedTime.frequency.setValueAtTime(t,e),this._loop||this._stopAtNextIteration(e),this._activeSources.forEach(function(i){i.playbackRate.setValueAtTime(t,e)})}}),Object.defineProperty(t.Player.prototype,"position",{get:function(){var e=this.now();if(this._state.getValueAtTime(e)===t.State.Started&&this.loaded){var i=this.buffer.duration;return this._elapsedTime.getTicksAtTime(e)%i}return 0}}),Object.defineProperty(t.Player.prototype,"reverse",{get:function(){return this._buffer.reverse},set:function(t){this._buffer.reverse=t}}),Object.defineProperty(t.Player.prototype,"loaded",{get:function(){return this._buffer.loaded}}),t.Player.prototype.dispose=function(){return this._activeSources.forEach(function(t){t.dispose()}),this._activeSources=null,t.Source.prototype.dispose.call(this),this._buffer.dispose(),this._buffer=null,this._elapsedTime.dispose(),this._elapsedTime=null,this},t.Player}),i(function(t){return t.Players=function(e){var i=Array.prototype.slice.call(arguments);i.shift();var n=t.defaults(i,["onload"],t.Players);for(var o in t.call(this),this._volume=this.output=new t.Volume(n.volume),this.volume=this._volume.volume,this._readOnly("volume"),this._volume.output.output.channelCount=2,this._volume.output.output.channelCountMode="explicit",this.mute=n.mute,this._players={},this._loadingCount=0,this._fadeIn=n.fadeIn,this._fadeOut=n.fadeOut,e)this._loadingCount++,this.add(o,e[o],this._bufferLoaded.bind(this,n.onload))},t.extend(t.Players,t.AudioNode),t.Players.defaults={volume:0,mute:!1,onload:t.noOp,fadeIn:0,fadeOut:0},t.Players.prototype._bufferLoaded=function(t){this._loadingCount--,0===this._loadingCount&&t&&t(this)},Object.defineProperty(t.Players.prototype,"mute",{get:function(){return this._volume.mute},set:function(t){this._volume.mute=t}}),Object.defineProperty(t.Players.prototype,"fadeIn",{get:function(){return this._fadeIn},set:function(t){this._fadeIn=t,this._forEach(function(e){e.fadeIn=t})}}),Object.defineProperty(t.Players.prototype,"fadeOut",{get:function(){return this._fadeOut},set:function(t){this._fadeOut=t,this._forEach(function(e){e.fadeOut=t})}}),Object.defineProperty(t.Players.prototype,"state",{get:function(){var e=!1;return this._forEach(function(i){e=e||i.state===t.State.Started}),e?t.State.Started:t.State.Stopped}}),t.Players.prototype.has=function(t){return this._players.hasOwnProperty(t)},t.Players.prototype.get=function(t){if(this.has(t))return this._players[t];throw new Error("Tone.Players: no player named "+t)},t.Players.prototype._forEach=function(t){for(var e in this._players)t(this._players[e],e);return this},Object.defineProperty(t.Players.prototype,"loaded",{get:function(){var t=!0;return this._forEach(function(e){t=t&&e.loaded}),t}}),t.Players.prototype.add=function(e,i,n){return this._players[e]=new t.Player(i,n).connect(this.output),this._players[e].fadeIn=this._fadeIn,this._players[e].fadeOut=this._fadeOut,this},t.Players.prototype.stopAll=function(t){this._forEach(function(e){e.stop(t)})},t.Players.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this._volume.dispose(),this._volume=null,this._writable("volume"),this.volume=null,this.output=null,this._forEach(function(t){t.dispose()}),this._players=null,this},t.Players}),i(function(t){return t.UserMedia=function(){var e=t.defaults(arguments,["volume"],t.UserMedia);t.AudioNode.call(this),this._mediaStream=null,this._stream=null,this._device=null,this._volume=this.output=new t.Volume(e.volume),this.volume=this._volume.volume,this._readOnly("volume"),this.mute=e.mute},t.extend(t.UserMedia,t.AudioNode),t.UserMedia.defaults={volume:0,mute:!1},t.UserMedia.prototype.open=function(e){return t.UserMedia.enumerateDevices().then(function(i){var n;if(t.isNumber(e))n=i[e];else if(!(n=i.find(function(t){return t.label===e||t.deviceId===e}))&&i.length>0)n=i[0];else if(!n&&t.isDefined(e))throw new Error("Tone.UserMedia: no matching device: "+e);this._device=n;var o={audio:{echoCancellation:!1,sampleRate:this.context.sampleRate}};return n&&(o.audio.deviceId=n.deviceId),navigator.mediaDevices.getUserMedia(o).then(function(t){return this._stream||(this._stream=t,this._mediaStream=this.context.createMediaStreamSource(t),this._mediaStream.connect(this.output)),this}.bind(this))}.bind(this))},t.UserMedia.prototype.close=function(){return this._stream&&(this._stream.getAudioTracks().forEach(function(t){t.stop()}),this._stream=null,this._mediaStream.disconnect(),this._mediaStream=null),this._device=null,this},t.UserMedia.enumerateDevices=function(){return navigator.mediaDevices.enumerateDevices().then(function(t){return t.filter(function(t){return"audioinput"===t.kind})})},Object.defineProperty(t.UserMedia.prototype,"state",{get:function(){return this._stream&&this._stream.active?t.State.Started:t.State.Stopped}}),Object.defineProperty(t.UserMedia.prototype,"deviceId",{get:function(){if(this._device)return this._device.deviceId}}),Object.defineProperty(t.UserMedia.prototype,"groupId",{get:function(){if(this._device)return this._device.groupId}}),Object.defineProperty(t.UserMedia.prototype,"label",{get:function(){if(this._device)return this._device.label}}),Object.defineProperty(t.UserMedia.prototype,"mute",{get:function(){return this._volume.mute},set:function(t){this._volume.mute=t}}),t.UserMedia.prototype.dispose=function(){return t.AudioNode.prototype.dispose.call(this),this.close(),this._writable("volume"),this._volume.dispose(),this._volume=null,this.volume=null,this},Object.defineProperty(t.UserMedia,"supported",{get:function(){return t.isDefined(navigator.mediaDevices)&&t.isFunction(navigator.mediaDevices.getUserMedia)}}),t.UserMedia}),i(function(t){return t.Midi=function(e,i){if(!(this instanceof t.Midi))return new t.Midi(e,i);t.Frequency.call(this,e,i)},t.extend(t.Midi,t.Frequency),t.Midi.prototype._defaultUnits="midi",t.Midi.prototype._frequencyToUnits=function(e){return t.Frequency.ftom(t.Frequency.prototype._frequencyToUnits.call(this,e))},t.Midi.prototype._ticksToUnits=function(e){return t.Frequency.ftom(t.Frequency.prototype._ticksToUnits.call(this,e))},t.Midi.prototype._beatsToUnits=function(e){return t.Frequency.ftom(t.Frequency.prototype._beatsToUnits.call(this,e))},t.Midi.prototype._secondsToUnits=function(e){return t.Frequency.ftom(t.Frequency.prototype._secondsToUnits.call(this,e))},t.Midi.prototype.toMidi=function(){return this.valueOf()},t.Midi.prototype.toFrequency=function(){return t.Frequency.mtof(this.toMidi())},t.Midi.prototype.transpose=function(t){return new this.constructor(this.toMidi()+t)},t.Midi}),t}()}.call(e,i,e,t))||(t.exports=n)},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}i.d(e,"a",function(){return n})},function(t,e,i){"use strict";function n(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}i.d(e,"a",function(){return o})},function(t,e,i){"use strict";function n(t){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}i.d(e,"a",function(){return n})},function(t,e,i){"use strict";function n(t){return(n="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)}function o(t){return(o="function"===typeof Symbol&&"symbol"===n(Symbol.iterator)?function(t){return n(t)}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)})(t)}function r(t,e){return!e||"object"!==o(e)&&"function"!==typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}i.d(e,"a",function(){return r})},function(t,e,i){"use strict";function n(t,e){return(n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function o(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}i.d(e,"a",function(){return o})},function(t,e,i){(function(e){!function(){"use strict";var i=Math.PI/180,n={version:"2.4.0",stages:[],idCounter:0,ids:{},names:{},shapes:{},listenClickTap:!1,inDblClickWindow:!1,isBrowser:"undefined"!==typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),isUnminified:/comment/.test(function(){}),enableTrace:!1,traceArrMax:100,dblClickWindow:400,pixelRatio:void 0,dragDistance:3,angleDeg:!0,showWarnings:!0,Filters:{},isDragging:function(){var t=n.DD;return!!t&&t.isDragging},isDragReady:function(){var t=n.DD;return!!t&&!!t.node},_addId:function(t,e){e&&(this.ids[e]=t)},_removeId:function(t){void 0!==t&&delete this.ids[t]},_addName:function(t,e){e&&(this.names[e]||(this.names[e]=[]),this.names[e].push(t))},_removeName:function(t,e){if(t){var i=this.names[t];if(i){for(var n=0;n<i.length;n++){i[n]._id===e&&i.splice(n,1)}0===i.length&&delete this.names[t]}}},getAngle:function(t){return this.angleDeg?t*i:t},_detectIE:function(t){var e=t.indexOf("msie ");if(e>0)return parseInt(t.substring(e+5,t.indexOf(".",e)),10);if(t.indexOf("trident/")>0){var i=t.indexOf("rv:");return parseInt(t.substring(i+3,t.indexOf(".",i)),10)}var n=t.indexOf("edge/");return n>0&&parseInt(t.substring(n+5,t.indexOf(".",n)),10)},_parseUA:function(t){var e=t.toLowerCase(),i=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[],o=!!t.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i),r=!!t.match(/IEMobile/i);return{browser:i[1]||"",version:i[2]||"0",isIE:n._detectIE(e),mobile:o,ieMobile:r}},UA:void 0},o="undefined"!==typeof e?e:"undefined"!==typeof window?window:"undefined"!==typeof WorkerGlobalScope?self:{};n.UA=n._parseUA(o.navigator&&o.navigator.userAgent||""),o.Konva&&console.error("Konva instance is already exist in current eviroment. Please use only one instance."),o.Konva=n,n.global=o,n.window=o,n.document=o.document,t.exports=n}(),function(){"use strict";Konva.Collection=function(){var t=[].slice.call(arguments),e=t.length,i=0;for(this.length=e;i<e;i++)this[i]=t[i];return this},Konva.Collection.prototype=[],Konva.Collection.prototype.each=function(t){for(var e=0;e<this.length;e++)t(this[e],e)},Konva.Collection.prototype.toArray=function(){var t,e=[],i=this.length;for(t=0;t<i;t++)e.push(this[t]);return e},Konva.Collection.toCollection=function(t){var e,i=new Konva.Collection,n=t.length;for(e=0;e<n;e++)i.push(t[e]);return i},Konva.Collection._mapMethod=function(t){Konva.Collection.prototype[t]=function(){var e,i=this.length,n=[].slice.call(arguments);for(e=0;e<i;e++)this[e][t].apply(this[e],n);return this}},Konva.Collection.mapMethods=function(t){var e=t.prototype;for(var i in e)Konva.Collection._mapMethod(i)},Konva.Transform=function(t){this.m=t&&t.slice()||[1,0,0,1,0,0]},Konva.Transform.prototype={copy:function(){return new Konva.Transform(this.m)},point:function(t){var e=this.m;return{x:e[0]*t.x+e[2]*t.y+e[4],y:e[1]*t.x+e[3]*t.y+e[5]}},translate:function(t,e){return this.m[4]+=this.m[0]*t+this.m[2]*e,this.m[5]+=this.m[1]*t+this.m[3]*e,this},scale:function(t,e){return this.m[0]*=t,this.m[1]*=t,this.m[2]*=e,this.m[3]*=e,this},rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=this.m[0]*e+this.m[2]*i,o=this.m[1]*e+this.m[3]*i,r=this.m[0]*-i+this.m[2]*e,s=this.m[1]*-i+this.m[3]*e;return this.m[0]=n,this.m[1]=o,this.m[2]=r,this.m[3]=s,this},getTranslation:function(){return{x:this.m[4],y:this.m[5]}},skew:function(t,e){var i=this.m[0]+this.m[2]*e,n=this.m[1]+this.m[3]*e,o=this.m[2]+this.m[0]*t,r=this.m[3]+this.m[1]*t;return this.m[0]=i,this.m[1]=n,this.m[2]=o,this.m[3]=r,this},multiply:function(t){var e=this.m[0]*t.m[0]+this.m[2]*t.m[1],i=this.m[1]*t.m[0]+this.m[3]*t.m[1],n=this.m[0]*t.m[2]+this.m[2]*t.m[3],o=this.m[1]*t.m[2]+this.m[3]*t.m[3],r=this.m[0]*t.m[4]+this.m[2]*t.m[5]+this.m[4],s=this.m[1]*t.m[4]+this.m[3]*t.m[5]+this.m[5];return this.m[0]=e,this.m[1]=i,this.m[2]=n,this.m[3]=o,this.m[4]=r,this.m[5]=s,this},invert:function(){var t=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),e=this.m[3]*t,i=-this.m[1]*t,n=-this.m[2]*t,o=this.m[0]*t,r=t*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),s=t*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=e,this.m[1]=i,this.m[2]=n,this.m[3]=o,this.m[4]=r,this.m[5]=s,this},getMatrix:function(){return this.m},setAbsolutePosition:function(t,e){var i=this.m[0],n=this.m[1],o=this.m[2],r=this.m[3],s=this.m[4],a=(i*(e-this.m[5])-n*(t-s))/(i*r-n*o),l=(t-s-o*a)/i;return this.translate(l,a)}};var t=Math.PI/180,e=180/Math.PI,i={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},n=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;Konva.Util={_isElement:function(t){return!(!t||1!=t.nodeType)},_isFunction:function(t){return!!(t&&t.constructor&&t.call&&t.apply)},_isObject:function(t){return!!t&&t.constructor===Object},_isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},_isNumber:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&!isNaN(t)&&isFinite(t)},_isString:function(t){return"[object String]"===Object.prototype.toString.call(t)},_isBoolean:function(t){return"[object Boolean]"===Object.prototype.toString.call(t)},isObject:function(t){return t instanceof Object},isValidSelector:function(t){if("string"!==typeof t)return!1;var e=t[0];return"#"===e||"."===e||e===e.toUpperCase()},_sign:function(t){return 0===t?0:t>0?1:-1},createCanvasElement:function(){var t=Konva.isBrowser?Konva.document.createElement("canvas"):new Konva._nodeCanvas;try{t.style=t.style||{}}catch(e){}return t},_isInDocument:function(t){for(;t=t.parentNode;)if(t==Konva.document)return!0;return!1},_simplifyArray:function(t){var e,i,n=[],o=t.length,r=Konva.Util;for(e=0;e<o;e++)i=t[e],r._isNumber(i)?i=Math.round(1e3*i)/1e3:r._isString(i)||(i=i.toString()),n.push(i);return n},_getImage:function(t,e){var i,n;if(t)if(this._isElement(t))e(t);else if(this._isString(t))(i=new Konva.window.Image).onload=function(){e(i)},i.src=t;else if(t.data){(n=Konva.Util.createCanvasElement()).width=t.width,n.height=t.height,n.getContext("2d").putImageData(t,0,0),this._getImage(n.toDataURL(),e)}else e(null);else e(null)},_getRGBAString:function(t){return["rgba(",t.red||0,",",t.green||0,",",t.blue||0,",",t.alpha||1,")"].join("")},_rgbToHex:function(t,e,i){return((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},_hexToRgb:function(t){t=t.replace("#","");var e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:255&e}},getRandomColor:function(){for(var t=(16777215*Math.random()<<0).toString(16);t.length<6;)t="0"+t;return"#"+t},get:function(t,e){return void 0===t?e:t},getRGB:function(t){var e;return t in i?{r:(e=i[t])[0],g:e[1],b:e[2]}:"#"===t[0]?this._hexToRgb(t.substring(1)):"rgb("===t.substr(0,4)?(e=n.exec(t.replace(/ /g,"")),{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)}):{r:0,g:0,b:0}},colorToRGBA:function(t){return t=t||"black",Konva.Util._namedColorToRBA(t)||Konva.Util._hex3ColorToRGBA(t)||Konva.Util._hex6ColorToRGBA(t)||Konva.Util._rgbColorToRGBA(t)||Konva.Util._rgbaColorToRGBA(t)},_namedColorToRBA:function(t){var e=i[t.toLowerCase()];return e?{r:e[0],g:e[1],b:e[2],a:1}:null},_rgbColorToRGBA:function(t){if(0===t.indexOf("rgb(")){var e=(t=t.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:1}}},_rgbaColorToRGBA:function(t){if(0===t.indexOf("rgba(")){var e=(t=t.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:e[3]}}},_hex6ColorToRGBA:function(t){if("#"===t[0]&&7===t.length)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}},_hex3ColorToRGBA:function(t){if("#"===t[0]&&4===t.length)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1}},_merge:function(t,e){var i=this._clone(e);for(var n in t)this._isObject(t[n])?i[n]=this._merge(t[n],i[n]):i[n]=t[n];return i},haveIntersection:function(t,e){return!(e.x>t.x+t.width||e.x+e.width<t.x||e.y>t.y+t.height||e.y+e.height<t.y)},cloneObject:function(t){var e={};for(var i in t)this._isObject(t[i])?e[i]=this.cloneObject(t[i]):this._isArray(t[i])?e[i]=this.cloneArray(t[i]):e[i]=t[i];return e},cloneArray:function(t){return t.slice(0)},_degToRad:function(e){return e*t},_radToDeg:function(t){return t*e},_capitalize:function(t){return t.charAt(0).toUpperCase()+t.slice(1)},throw:function(t){throw new Error("Konva error: "+t)},error:function(t){console.error("Konva error: "+t)},warn:function(t){Konva.global.console&&console.warn&&Konva.showWarnings&&console.warn("Konva warning: "+t)},extend:function(t,e){function i(){this.constructor=t}i.prototype=e.prototype;var n=t.prototype;for(var o in t.prototype=new i,n)n.hasOwnProperty(o)&&(t.prototype[o]=n[o]);t.__super__=e.prototype,t.super=e},addMethods:function(t,e){var i;for(i in e)t.prototype[i]=e[i]},_getControlPoints:function(t,e,i,n,o,r,s){var a=Math.sqrt(Math.pow(i-t,2)+Math.pow(n-e,2)),l=Math.sqrt(Math.pow(o-i,2)+Math.pow(r-n,2)),u=s*a/(a+l),h=s*l/(a+l);return[i-u*(o-t),n-u*(r-e),i+h*(o-t),n+h*(r-e)]},_expandPoints:function(t,e){var i,n,o=t.length,r=[];for(i=2;i<o-2;i+=2)n=Konva.Util._getControlPoints(t[i-2],t[i-1],t[i],t[i+1],t[i+2],t[i+3],e),r.push(n[0]),r.push(n[1]),r.push(t[i]),r.push(t[i+1]),r.push(n[2]),r.push(n[3]);return r},_removeLastLetter:function(t){return t.substring(0,t.length-1)},each:function(t,e){for(var i in t)e(i,t[i])},_inRange:function(t,e,i){return e<=t&&t<i},_getProjectionToSegment:function(t,e,i,n,o,r){var s,a,l,u=(t-i)*(t-i)+(e-n)*(e-n);if(0==u)s=t,a=e,l=(o-i)*(o-i)+(r-n)*(r-n);else{var h=((o-t)*(i-t)+(r-e)*(n-e))/u;h<0?(s=t,a=e,l=(t-o)*(t-o)+(e-r)*(e-r)):h>1?(s=i,a=n,l=(i-o)*(i-o)+(n-r)*(n-r)):l=((s=t+h*(i-t))-o)*(s-o)+((a=e+h*(n-e))-r)*(a-r)}return[s,a,l]},_getProjectionToLine:function(t,e,i){var n=Konva.Util.cloneObject(t),o=Number.MAX_VALUE;return e.forEach(function(r,s){if(i||s!==e.length-1){var a=e[(s+1)%e.length],l=Konva.Util._getProjectionToSegment(r.x,r.y,a.x,a.y,t.x,t.y),u=l[0],h=l[1],c=l[2];c<o&&(n.x=u,n.y=h,o=c)}}),n},_prepareArrayForTween:function(t,e,i){var n,o=[],r=[];if(t.length>e.length){var s=e;e=t,t=s}for(n=0;n<t.length;n+=2)o.push({x:t[n],y:t[n+1]});for(n=0;n<e.length;n+=2)r.push({x:e[n],y:e[n+1]});var a=[];return r.forEach(function(t){var e=Konva.Util._getProjectionToLine(t,o,i);a.push(e.x),a.push(e.y)}),a},_prepareToStringify:function(t){var e;for(var i in t.visitedByCircularReferenceRemoval=!0,t)if(t.hasOwnProperty(i)&&t[i]&&"object"==typeof t[i])if(e=Object.getOwnPropertyDescriptor(t,i),t[i].visitedByCircularReferenceRemoval||Konva.Util._isElement(t[i])){if(!e.configurable)return null;delete t[i]}else if(null===Konva.Util._prepareToStringify(t[i])){if(!e.configurable)return null;delete t[i]}return delete t.visitedByCircularReferenceRemoval,t}}}(),function(){"use strict";var t;Konva.Canvas=function(t){this.init(t)},Konva.Canvas.prototype={init:function(e){var i=(e||{}).pixelRatio||Konva.pixelRatio||function(){if(t)return t;var e=Konva.Util.createCanvasElement().getContext("2d");return t=(Konva.window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)}();this.pixelRatio=i,this._canvas=Konva.Util.createCanvasElement(),this._canvas.style.padding=0,this._canvas.style.margin=0,this._canvas.style.border=0,this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top=0,this._canvas.style.left=0},getContext:function(){return this.context},getPixelRatio:function(){return this.pixelRatio},setPixelRatio:function(t){var e=this.pixelRatio;this.pixelRatio=t,this.setSize(this.getWidth()/e,this.getHeight()/e)},setWidth:function(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+"px";var e=this.pixelRatio;this.getContext()._context.scale(e,e)},setHeight:function(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";var e=this.pixelRatio;this.getContext()._context.scale(e,e)},getWidth:function(){return this.width},getHeight:function(){return this.height},setSize:function(t,e){this.setWidth(t),this.setHeight(e)},toDataURL:function(t,e){try{return this._canvas.toDataURL(t,e)}catch(i){try{return this._canvas.toDataURL()}catch(n){return Konva.Util.warn("Unable to get data URL. "+n.message),""}}}},Konva.SceneCanvas=function(t){var e=t||{},i=e.width||0,n=e.height||0;Konva.Canvas.call(this,e),this.context=new Konva.SceneContext(this),this.setSize(i,n)},Konva.Util.extend(Konva.SceneCanvas,Konva.Canvas),Konva.HitCanvas=function(t){var e=t||{},i=e.width||0,n=e.height||0;Konva.Canvas.call(this,e),this.context=new Konva.HitContext(this),this.setSize(i,n),this.hitCanvas=!0},Konva.Util.extend(Konva.HitCanvas,Konva.Canvas)}(),function(){"use strict";var t=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"];Konva.Context=function(t){this.init(t)},Konva.Context.prototype={init:function(t){this.canvas=t,this._context=t._canvas.getContext("2d"),Konva.enableTrace&&(this.traceArr=[],this._enableTrace())},fillShape:function(t){t.getFillEnabled()&&this._fill(t)},strokeShape:function(t){t.getStrokeEnabled()&&this._stroke(t)},fillStrokeShape:function(t){t.getFillEnabled()&&this._fill(t),t.getStrokeEnabled()&&this._stroke(t)},getTrace:function(t){var e,i,n,o,r=this.traceArr,s=r.length,a="";for(e=0;e<s;e++)(n=(i=r[e]).method)?(o=i.args,a+=n,t?a+="()":Konva.Util._isArray(o[0])?a+="(["+o.join(",")+"])":a+="("+o.join(",")+")"):(a+=i.property,t||(a+="="+i.val)),a+=";";return a},clearTrace:function(){this.traceArr=[]},_trace:function(t){var e=this.traceArr;e.push(t),e.length>=Konva.traceArrMax&&e.shift()},reset:function(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)},getCanvas:function(){return this.canvas},clear:function(t){var e=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,e.getWidth()/e.pixelRatio,e.getHeight()/e.pixelRatio)},_applyLineCap:function(t){var e=t.getLineCap();e&&this.setAttr("lineCap",e)},_applyOpacity:function(t){var e=t.getAbsoluteOpacity();1!==e&&this.setAttr("globalAlpha",e)},_applyLineJoin:function(t){var e=t.getLineJoin();e&&this.setAttr("lineJoin",e)},setAttr:function(t,e){this._context[t]=e},arc:function(){var t=arguments;this._context.arc(t[0],t[1],t[2],t[3],t[4],t[5])},beginPath:function(){this._context.beginPath()},bezierCurveTo:function(){var t=arguments;this._context.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5])},clearRect:function(){var t=arguments;this._context.clearRect(t[0],t[1],t[2],t[3])},clip:function(){this._context.clip()},closePath:function(){this._context.closePath()},createImageData:function(){var t=arguments;return 2===t.length?this._context.createImageData(t[0],t[1]):1===t.length?this._context.createImageData(t[0]):void 0},createLinearGradient:function(){var t=arguments;return this._context.createLinearGradient(t[0],t[1],t[2],t[3])},createPattern:function(){var t=arguments;return this._context.createPattern(t[0],t[1])},createRadialGradient:function(){var t=arguments;return this._context.createRadialGradient(t[0],t[1],t[2],t[3],t[4],t[5])},drawImage:function(){var t=arguments,e=this._context;3===t.length?e.drawImage(t[0],t[1],t[2]):5===t.length?e.drawImage(t[0],t[1],t[2],t[3],t[4]):9===t.length&&e.drawImage(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},isPointInPath:function(t,e){return this._context.isPointInPath(t,e)},fill:function(){this._context.fill()},fillRect:function(t,e,i,n){this._context.fillRect(t,e,i,n)},strokeRect:function(t,e,i,n){this._context.strokeRect(t,e,i,n)},fillText:function(){var t=arguments;this._context.fillText(t[0],t[1],t[2])},measureText:function(t){return this._context.measureText(t)},getImageData:function(){var t=arguments;return this._context.getImageData(t[0],t[1],t[2],t[3])},lineTo:function(){var t=arguments;this._context.lineTo(t[0],t[1])},moveTo:function(){var t=arguments;this._context.moveTo(t[0],t[1])},rect:function(){var t=arguments;this._context.rect(t[0],t[1],t[2],t[3])},putImageData:function(){var t=arguments;this._context.putImageData(t[0],t[1],t[2])},quadraticCurveTo:function(){var t=arguments;this._context.quadraticCurveTo(t[0],t[1],t[2],t[3])},restore:function(){this._context.restore()},rotate:function(){var t=arguments;this._context.rotate(t[0])},save:function(){this._context.save()},scale:function(){var t=arguments;this._context.scale(t[0],t[1])},setLineDash:function(){var t=arguments,e=this._context;this._context.setLineDash?e.setLineDash(t[0]):"mozDash"in e?e.mozDash=t[0]:"webkitLineDash"in e&&(e.webkitLineDash=t[0])},getLineDash:function(){return this._context.getLineDash()},setTransform:function(){var t=arguments;this._context.setTransform(t[0],t[1],t[2],t[3],t[4],t[5])},stroke:function(){this._context.stroke()},strokeText:function(){var t=arguments;this._context.strokeText(t[0],t[1],t[2])},transform:function(){var t=arguments;this._context.transform(t[0],t[1],t[2],t[3],t[4],t[5])},translate:function(){var t=arguments;this._context.translate(t[0],t[1])},_enableTrace:function(){var e,i,n=this,o=t.length,r=Konva.Util._simplifyArray,s=this.setAttr,a=function(t){var e,o=n[t];n[t]=function(){return i=r(Array.prototype.slice.call(arguments,0)),e=o.apply(n,arguments),n._trace({method:t,args:i}),e}};for(e=0;e<o;e++)a(t[e]);n.setAttr=function(){s.apply(n,arguments);var t=arguments[0],e=arguments[1];"shadowOffsetX"!==t&&"shadowOffsetY"!==t&&"shadowBlur"!==t||(e/=this.canvas.getPixelRatio()),n._trace({property:t,val:e})}}},["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation"].forEach(function(t){Object.defineProperty(Konva.Context.prototype,t,{get:function(){return this._context[t]},set:function(e){this._context[t]=e}})}),Konva.SceneContext=function(t){Konva.Context.call(this,t)},Konva.SceneContext.prototype={_fillColor:function(t){var e=t.fill();this.setAttr("fillStyle",e),t._fillFunc(this)},_fillPattern:function(t){var e=t.getFillPatternX(),i=t.getFillPatternY(),n=t.getFillPatternScale(),o=Konva.getAngle(t.getFillPatternRotation()),r=t.getFillPatternOffset();(e||i)&&this.translate(e||0,i||0),o&&this.rotate(o),n&&this.scale(n.x,n.y),r&&this.translate(-1*r.x,-1*r.y),this.setAttr("fillStyle",this.createPattern(t.getFillPatternImage(),t.getFillPatternRepeat()||"repeat")),this.fill()},_fillLinearGradient:function(t){var e=t.getFillLinearGradientStartPoint(),i=t.getFillLinearGradientEndPoint(),n=t.getFillLinearGradientColorStops(),o=this.createLinearGradient(e.x,e.y,i.x,i.y);if(n){for(var r=0;r<n.length;r+=2)o.addColorStop(n[r],n[r+1]);this.setAttr("fillStyle",o),t._fillFunc(this)}},_fillRadialGradient:function(t){for(var e=t.getFillRadialGradientStartPoint(),i=t.getFillRadialGradientEndPoint(),n=t.getFillRadialGradientStartRadius(),o=t.getFillRadialGradientEndRadius(),r=t.getFillRadialGradientColorStops(),s=this.createRadialGradient(e.x,e.y,n,i.x,i.y,o),a=0;a<r.length;a+=2)s.addColorStop(r[a],r[a+1]);this.setAttr("fillStyle",s),this.fill()},_fill:function(t){var e=t.fill(),i=t.getFillPriority();if(e&&"color"===i)this._fillColor(t);else{var n=t.getFillPatternImage();if(n&&"pattern"===i)this._fillPattern(t);else{var o=t.getFillLinearGradientColorStops();if(o&&"linear-gradient"===i)this._fillLinearGradient(t);else{var r=t.getFillRadialGradientColorStops();r&&"radial-gradient"===i?this._fillRadialGradient(t):e?this._fillColor(t):n?this._fillPattern(t):o?this._fillLinearGradient(t):r&&this._fillRadialGradient(t)}}}},_strokeLinearGradient:function(t){var e=t.getStrokeLinearGradientStartPoint(),i=t.getStrokeLinearGradientEndPoint(),n=t.getStrokeLinearGradientColorStops(),o=this.createLinearGradient(e.x,e.y,i.x,i.y);if(n){for(var r=0;r<n.length;r+=2)o.addColorStop(n[r],n[r+1]);this.setAttr("strokeStyle",o)}},_stroke:function(t){var e=t.dash(),i=t.getStrokeScaleEnabled()||t instanceof Konva.Text;t.hasStroke()&&(i||(this.save(),this.setTransform(1,0,0,1,0,0)),this._applyLineCap(t),e&&t.dashEnabled()&&(this.setLineDash(e),this.setAttr("lineDashOffset",t.dashOffset())),this.setAttr("lineWidth",t.strokeWidth()),t.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),t.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(t):this.setAttr("strokeStyle",t.stroke()),t._strokeFunc(this),i||this.restore())},_applyShadow:function(t){var e=Konva.Util,i=e.get(t.getShadowRGBA(),"black"),n=e.get(t.getShadowBlur(),5),o=e.get(t.getShadowOffset(),{x:0,y:0}),r=t.getAbsoluteScale(),s=this.canvas.getPixelRatio(),a=r.x*s,l=r.y*s;this.setAttr("shadowColor",i),this.setAttr("shadowBlur",n*Math.min(Math.abs(a),Math.abs(l))),this.setAttr("shadowOffsetX",o.x*a),this.setAttr("shadowOffsetY",o.y*l)},_applyGlobalCompositeOperation:function(t){var e=t.getGlobalCompositeOperation();"source-over"!==e&&this.setAttr("globalCompositeOperation",e)}},Konva.Util.extend(Konva.SceneContext,Konva.Context),Konva.HitContext=function(t){Konva.Context.call(this,t)},Konva.HitContext.prototype={_fill:function(t){this.save(),this.setAttr("fillStyle",t.colorKey),t._fillFuncHit(this),this.restore()},_stroke:function(t){if(t.hasStroke()&&t.strokeHitEnabled()){var e=t.getStrokeScaleEnabled()||t instanceof Konva.Text;e||(this.save(),this.setTransform(1,0,0,1,0,0)),this._applyLineCap(t),this.setAttr("lineWidth",t.strokeWidth()),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),e||this.restore()}}},Konva.Util.extend(Konva.HitContext,Konva.Context)}(),function(){"use strict";Konva.Factory={addGetterSetter:function(t,e,i,n,o){this.addGetter(t,e,i),this.addSetter(t,e,n,o),this.addOverloadedGetterSetter(t,e)},addGetter:function(t,e,i){var n="get"+Konva.Util._capitalize(e);t.prototype[n]=function(){var t=this.attrs[e];return void 0===t?i:t}},addSetter:function(t,e,i,n){var o="set"+Konva.Util._capitalize(e);t.prototype[o]=function(t){return i&&void 0!==t&&null!==t&&(t=i.call(this,t,e)),this._setAttr(e,t),n&&n.call(this),this}},addComponentsGetterSetter:function(t,e,i,n,o){var r,s,a=i.length,l=Konva.Util._capitalize,u="get"+l(e),h="set"+l(e);t.prototype[u]=function(){var t={};for(r=0;r<a;r++)t[s=i[r]]=this.getAttr(e+l(s));return t},t.prototype[h]=function(t){var i,r=this.attrs[e];for(i in n&&(t=n.call(this,t)),t)t.hasOwnProperty(i)&&this._setAttr(e+l(i),t[i]);return this._fireChangeEvent(e,r,t),o&&o.call(this),this},this.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter:function(t,e){var i=Konva.Util._capitalize(e),n="set"+i,o="get"+i;t.prototype[e]=function(){return arguments.length?(this[n](arguments[0]),this):this[o]()}},addDeprecatedGetterSetter:function(t,e,i,n){Konva.Util.error("Adding deprecated "+e);var o="get"+Konva.Util._capitalize(e),r=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[o]=function(){Konva.Util.error(r);var t=this.attrs[e];return void 0===t?i:t},this.addSetter(t,e,n,function(){Konva.Util.error(r)}),this.addOverloadedGetterSetter(t,e)},backCompat:function(t,e){Konva.Util.each(e,function(e,i){var n=t.prototype[i],o="get"+Konva.Util._capitalize(e),r="set"+Konva.Util._capitalize(e);function s(){n.apply(this,arguments),Konva.Util.error('"'+e+'" method is deprecated and will be removed soon. Use ""'+i+'" instead.')}t.prototype[e]=s,t.prototype[o]=s,t.prototype[r]=s})},afterSetFilter:function(){this._filterUpToDate=!1}},Konva.Validators={RGBComponent:function(t){return t>255?255:t<0?0:Math.round(t)},alphaComponent:function(t){return t>1?1:t<1e-4?1e-4:t},_formatValue:function(t){return Konva.Util._isString(t)?'"'+t+'"':"[object Number]"===Object.prototype.toString.call(t)?t:Konva.Util._isBoolean(t)?t:Object.prototype.toString.call(t)},getNumberValidator:function(){if(Konva.isUnminified)return function(t,e){return Konva.Util._isNumber(t)||Konva.Util.warn(Konva.Validators._formatValue(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}},getNumberOrAutoValidator:function(){if(Konva.isUnminified)return function(t,e){return Konva.Util._isNumber(t)||"auto"===t||Konva.Util.warn(Konva.Validators._formatValue(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}},getStringValidator:function(){if(Konva.isUnminified)return function(t,e){return Konva.Util._isString(t)||Konva.Util.warn(Konva.Validators._formatValue(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}},getFunctionValidator:function(){if(Konva.isUnminified)return function(t,e){return Konva.Util._isFunction(t)||Konva.Util.warn(Konva.Validators._formatValue(t)+' is a not valid value for "'+e+'" attribute. The value should be a function.'),t}},getNumberArrayValidator:function(){if(Konva.isUnminified)return function(t,e){return Konva.Util._isArray(t)?t.forEach(function(t){Konva.Util._isNumber(t)||Konva.Util.warn('"'+e+'" attribute has non numeric element '+t+". Make sure that all elements are numbers.")}):Konva.Util.warn(Konva.Validators._formatValue(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.'),t}},getBooleanValidator:function(){if(Konva.isUnminified)return function(t,e){return!0===t||!1===t||Konva.Util.warn(Konva.Validators._formatValue(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}}}(),function(t){"use strict";var e="Shape",i=["id"],n=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(" "),o=["scaleXChange.konva","scaleYChange.konva"].join(" ");t.Node=function(t){this._init(t)},t.Util.addMethods(t.Node,{_init:function(e){this._id=t.idCounter++,this.eventListeners={},this.attrs={},this._cache={},this._filterUpToDate=!1,this._isUnderCache=!1,this.setAttrs(e),this.on(n,function(){this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}),this.on(o,function(){this._clearSelfAndDescendantCache("absoluteScale")}),this.on("visibleChange.konva",function(){this._clearSelfAndDescendantCache("visible")}),this.on("listeningChange.konva",function(){this._clearSelfAndDescendantCache("listening")}),this.on("opacityChange.konva",function(){this._clearSelfAndDescendantCache("absoluteOpacity")})},_clearCache:function(t){t?delete this._cache[t]:this._cache={}},_getCache:function(t,e){return void 0===this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},_clearSelfAndDescendantCache:function(t){this._clearCache(t),this.children&&this.getChildren().each(function(e){e._clearSelfAndDescendantCache(t)})},clearCache:function(){return delete this._cache.canvas,this._filterUpToDate=!1,this},cache:function(e){var i=e||{},n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}),o=i.width||n.width,r=i.height||n.height,s=i.pixelRatio,a=i.x||n.x,l=i.y||n.y,u=i.offset||0,h=i.drawBorder||!1;if(o&&r){o+=2*u,r+=2*u,a-=u,l-=u;var c=new t.SceneCanvas({pixelRatio:s,width:o,height:r}),d=new t.SceneCanvas({pixelRatio:s,width:o,height:r}),p=new t.HitCanvas({pixelRatio:1,width:o,height:r}),f=c.getContext(),m=p.getContext();return p.isCache=!0,this.clearCache(),f.save(),m.save(),f.translate(-a,-l),m.translate(-a,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache("absoluteOpacity"),this._clearSelfAndDescendantCache("absoluteScale"),this.drawScene(c,this,!0),this.drawHit(p,this,!0),this._isUnderCache=!1,f.restore(),m.restore(),h&&(f.save(),f.beginPath(),f.rect(0,0,o,r),f.closePath(),f.setAttr("strokeStyle","red"),f.setAttr("lineWidth",5),f.stroke(),f.restore()),this._cache.canvas={scene:c,filter:d,hit:p,x:a,y:l},this}t.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.")},getClientRect:function(){throw new Error('abstract "getClientRect" method call')},_transformedRect:function(t,e){var i,n,o,r,s=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],a=this.getAbsoluteTransform(e);return s.forEach(function(t){var e=a.point(t);void 0===i&&(i=o=e.x,n=r=e.y),i=Math.min(i,e.x),n=Math.min(n,e.y),o=Math.max(o,e.x),r=Math.max(r,e.y)}),{x:i,y:n,width:o-i,height:r-n}},_drawCachedSceneCanvas:function(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this),t.translate(this._cache.canvas.x,this._cache.canvas.y);var e=this._getCachedSceneCanvas(),i=e.pixelRatio;t.drawImage(e._canvas,0,0,e.width/i,e.height/i),t.restore()},_drawCachedHitCanvas:function(t){var e=this._cache.canvas.hit;t.save(),t.translate(this._cache.canvas.x,this._cache.canvas.y),t.drawImage(e._canvas,0,0),t.restore()},_getCachedSceneCanvas:function(){var e,i,n,o,r=this.filters(),s=this._cache.canvas,a=s.scene,l=s.filter,u=l.getContext();if(r){if(!this._filterUpToDate){var h=a.pixelRatio;try{for(e=r.length,u.clear(),u.drawImage(a._canvas,0,0,a.getWidth()/h,a.getHeight()/h),i=u.getImageData(0,0,l.getWidth(),l.getHeight()),n=0;n<e;n++)"function"===typeof(o=r[n])?(o.call(this,i),u.putImageData(i,0,0)):t.Util.error("Filter should be type of function, but got "+typeof o+" insted. Please check correct filters")}catch(c){t.Util.error("Unable to apply filter. "+c.message)}this._filterUpToDate=!0}return l}return a},on:function(t,e){if(3===arguments.length)return this._delegate.apply(this,arguments);var i,n,o,r,s=t.split(" "),a=s.length;for(i=0;i<a;i++)o=(n=s[i].split("."))[0],r=n[1]||"",this.eventListeners[o]||(this.eventListeners[o]=[]),this.eventListeners[o].push({name:r,handler:e});return this},off:function(t,e){var i,n,o,r,s,a=(t||"").split(" "),l=a.length;if(!t)for(n in this.eventListeners)this._off(n);for(i=0;i<l;i++)if(r=(o=a[i].split("."))[0],s=o[1],r)this.eventListeners[r]&&this._off(r,s,e);else for(n in this.eventListeners)this._off(n,s,e);return this},dispatchEvent:function(t){var e={target:this,type:t.type,evt:t};return this.fire(t.type,e),this},addEventListener:function(t,e){return this.on(t,function(t){e.call(this,t.evt)}),this},removeEventListener:function(t){return this.off(t),this},_delegate:function(e,i,n){var o=this;this.on(e,function(e){for(var r=e.target.findAncestors(i,!0,o),s=0;s<r.length;s++)(e=t.Util.cloneObject(e)).currentTarget=r[s],n.call(r[s],e)})},remove:function(){var t=this.getParent();return t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),delete this.parent),this._clearSelfAndDescendantCache("stage"),this._clearSelfAndDescendantCache("absoluteTransform"),this._clearSelfAndDescendantCache("visible"),this._clearSelfAndDescendantCache("listening"),this._clearSelfAndDescendantCache("absoluteOpacity"),this},destroy:function(){t._removeId(this.getId());for(var e=(this.getName()||"").split(/\s/g),i=0;i<e.length;i++){var n=e[i];t._removeName(n,this._id)}return this.remove(),this},getAttr:function(e){var i="get"+t.Util._capitalize(e);return t.Util._isFunction(this[i])?this[i]():this.attrs[e]},getAncestors:function(){for(var e=this.getParent(),i=new t.Collection;e;)i.push(e),e=e.getParent();return i},getAttrs:function(){return this.attrs||{}},setAttrs:function(e){var i,n;if(!e)return this;for(i in e)"children"!==i&&(n="set"+t.Util._capitalize(i),t.Util._isFunction(this[n])?this[n](e[i]):this._setAttr(i,e[i]));return this},isListening:function(){return this._getCache("listening",this._isListening)},_isListening:function(){var t=this.getListening(),e=this.getParent();return"inherit"===t?!e||e.isListening():t},isVisible:function(){return this._getCache("visible",this._isVisible)},_isVisible:function(){var t=this.getVisible(),e=this.getParent();return"inherit"===t?!e||e.isVisible():t},shouldDrawHit:function(t){var e=this.getLayer();return t&&t.isCache||e&&e.hitGraphEnabled()&&this.isListening()&&this.isVisible()},show:function(){return this.setVisible(!0),this},hide:function(){return this.setVisible(!1),this},getZIndex:function(){return this.index||0},getAbsoluteZIndex:function(){var t,i,n,o,r=this.getDepth(),s=this,a=0;return"Stage"!==s.nodeType&&function l(u){for(t=[],i=u.length,n=0;n<i;n++)o=u[n],a++,o.nodeType!==e&&(t=t.concat(o.getChildren().toArray())),o._id===s._id&&(n=i);t.length>0&&t[0].getDepth()<=r&&l(t)}(s.getStage().getChildren()),a},getDepth:function(){for(var t=0,e=this.parent;e;)t++,e=e.parent;return t},setPosition:function(t){return this.setX(t.x),this.setY(t.y),this},getPosition:function(){return{x:this.getX(),y:this.getY()}},getAbsolutePosition:function(e){var i=this.getAbsoluteTransform(e).getMatrix(),n=new t.Transform,o=this.offset();return n.m=i.slice(),n.translate(o.x,o.y),n.getTranslation()},setAbsolutePosition:function(t){var e,i=this._clearTransform();return this.attrs.x=i.x,this.attrs.y=i.y,delete i.x,delete i.y,(e=this.getAbsoluteTransform()).invert(),e.translate(t.x,t.y),t={x:this.attrs.x+e.getTranslation().x,y:this.attrs.y+e.getTranslation().y},this.setPosition({x:t.x,y:t.y}),this._setTransform(i),this},_setTransform:function(t){var e;for(e in t)this.attrs[e]=t[e];this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")},_clearTransform:function(){var t={x:this.getX(),y:this.getY(),rotation:this.getRotation(),scaleX:this.getScaleX(),scaleY:this.getScaleY(),offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),skewX:this.getSkewX(),skewY:this.getSkewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform"),t},move:function(t){var e=t.x,i=t.y,n=this.getX(),o=this.getY();return void 0!==e&&(n+=e),void 0!==i&&(o+=i),this.setPosition({x:n,y:o}),this},_eachAncestorReverse:function(t,e){var i,n,o=[],r=this.getParent();if(e&&e._id===this._id)t(this);else{for(o.unshift(this);r&&(!e||r._id!==e._id);)o.unshift(r),r=r.parent;for(i=o.length,n=0;n<i;n++)t(o[n])}},rotate:function(t){return this.setRotation(this.getRotation()+t),this},moveToTop:function(){if(!this.parent)return t.Util.warn("Node has no parent. moveToTop function is ignored."),!1;var e=this.index;return this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0},moveUp:function(){if(!this.parent)return t.Util.warn("Node has no parent. moveUp function is ignored."),!1;var e=this.index;return e<this.parent.getChildren().length-1&&(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0)},moveDown:function(){if(!this.parent)return t.Util.warn("Node has no parent. moveDown function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0)},moveToBottom:function(){if(!this.parent)return t.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)},setZIndex:function(e){if(!this.parent)return t.Util.warn("Node has no parent. zIndex parameter is ignored."),!1;var i=this.index;return this.parent.children.splice(i,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this},getAbsoluteOpacity:function(){return this._getCache("absoluteOpacity",this._getAbsoluteOpacity)},_getAbsoluteOpacity:function(){var t=this.getOpacity(),e=this.getParent();return e&&!e._isUnderCache&&(t*=this.getParent().getAbsoluteOpacity()),t},moveTo:function(t){return this.getParent()!==t&&((this.__originalRemove||this.remove).call(this),t.add(this)),this},toObject:function(){var e,i,n,o,r={},s=this.getAttrs();for(e in r.attrs={},s)i=s[e],n="function"===typeof this[e]&&this[e],delete s[e],o=n?n.call(this):null,s[e]=i,o!==i&&(r.attrs[e]=i);return r.className=this.getClassName(),t.Util._prepareToStringify(r)},toJSON:function(){return JSON.stringify(this.toObject())},getParent:function(){return this.parent},findAncestors:function(t,e,i){var n=[];e&&this._isMatch(t)&&n.push(this);for(var o=this.parent;o;){if(o===i)return n;o._isMatch(t)&&n.push(o),o=o.parent}return n},findAncestor:function(t,e,i){return this.findAncestors(t,e,i)[0]},_isMatch:function(e){if(!e)return!1;var i,n,o=e.replace(/ /g,"").split(","),r=o.length;for(i=0;i<r;i++)if(n=o[i],t.Util.isValidSelector(n)||(t.Util.warn('Selector "'+n+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),t.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),t.Util.warn("Konva is awesome, right?")),"#"===n.charAt(0)){if(this.id()===n.slice(1))return!0}else if("."===n.charAt(0)){if(this.hasName(n.slice(1)))return!0}else if(0!==this._get(n).length)return!0;return!1},getLayer:function(){var t=this.getParent();return t?t.getLayer():null},getStage:function(){return this._getCache("stage",this._getStage)},_getStage:function(){var t=this.getParent();return t?t.getStage():void 0},fire:function(t,e,i){return(e=e||{}).target=e.target||this,i?this._fireAndBubble(t,e):this._fire(t,e),this},getAbsoluteTransform:function(t){return t?this._getAbsoluteTransform(t):this._getCache("absoluteTransform",this._getAbsoluteTransform)},_getAbsoluteTransform:function(e){var i=new t.Transform;return this._eachAncestorReverse(function(t){var e=t.transformsEnabled();"all"===e?i.multiply(t.getTransform()):"position"===e&&i.translate(t.getX()-t.getOffsetX(),t.getY()-t.getOffsetY())},e),i},getAbsoluteScale:function(t){return t?this._getAbsoluteScale(t):this._getCache("absoluteScale",this._getAbsoluteScale)},_getAbsoluteScale:function(t){for(var e=this;e;)e._isUnderCache&&(t=e),e=e.getParent();var i=1,n=1;return this._eachAncestorReverse(function(t){i*=t.scaleX(),n*=t.scaleY()},t),{x:i,y:n}},getTransform:function(){return this._getCache("transform",this._getTransform)},_getTransform:function(){var e=new t.Transform,i=this.getX(),n=this.getY(),o=t.getAngle(this.getRotation()),r=this.getScaleX(),s=this.getScaleY(),a=this.getSkewX(),l=this.getSkewY(),u=this.getOffsetX(),h=this.getOffsetY();return 0===i&&0===n||e.translate(i,n),0!==o&&e.rotate(o),0===a&&0===l||e.skew(a,l),1===r&&1===s||e.scale(r,s),0===u&&0===h||e.translate(-1*u,-1*h),e},clone:function(e){var n,o,r,s,a,l=t.Util.cloneObject(this.attrs);for(var u in i){delete l[i[u]]}for(n in e)l[n]=e[n];var h=new this.constructor(l);for(n in this.eventListeners)for(r=(o=this.eventListeners[n]).length,s=0;s<r;s++)(a=o[s]).name.indexOf("konva")<0&&(h.eventListeners[n]||(h.eventListeners[n]=[]),h.eventListeners[n].push(a));return h},_toKonvaCanvas:function(e){e=e||{};var i=this.getClientRect(),n=this.getStage(),o=void 0!==e.x?e.x:i.x,r=void 0!==e.y?e.y:i.y,s=e.pixelRatio||1,a=new t.SceneCanvas({width:e.width||i.width||(n?n.getWidth():0),height:e.height||i.height||(n?n.getHeight():0),pixelRatio:s}),l=a.getContext();return l.save(),(o||r)&&l.translate(-1*o,-1*r),this.drawScene(a),l.restore(),a},toCanvas:function(t){return this._toKonvaCanvas(t)._canvas},toDataURL:function(t){var e=(t=t||{}).mimeType||null,i=t.quality||null,n=this._toKonvaCanvas(t).toDataURL(e,i);return t.callback&&t.callback(n),n},toImage:function(e){if(!e||!e.callback)throw"callback required for toImage method config argument";var i=e.callback;delete e.callback,t.Util._getImage(this.toDataURL(e),function(t){i(t)})},setSize:function(t){return this.setWidth(t.width),this.setHeight(t.height),this},getSize:function(){return{width:this.getWidth(),height:this.getHeight()}},getWidth:function(){return this.attrs.width||0},getHeight:function(){return this.attrs.height||0},getClassName:function(){return this.className||this.nodeType},getType:function(){return this.nodeType},getDragDistance:function(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():t.dragDistance},_get:function(t){return this.className===t||this.nodeType===t?[this]:[]},_off:function(t,e,i){var n,o,r,s=this.eventListeners[t];for(n=0;n<s.length;n++)if(o=s[n].name,r=s[n].handler,("konva"!==o||"konva"===e)&&(!e||o===e)&&(!i||i===r)){if(s.splice(n,1),0===s.length){delete this.eventListeners[t];break}n--}},_fireChangeEvent:function(t,e,i){this._fire(t+"Change",{oldVal:e,newVal:i})},setId:function(e){var i=this.getId();return t._removeId(i),t._addId(this,e),this._setAttr("id",e),this},setName:function(e){var i,n,o=(this.getName()||"").split(/\s/g),r=(e||"").split(/\s/g);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&i&&t._removeName(i,this._id);for(n=0;n<r.length;n++)i=r[n],-1===o.indexOf(i)&&i&&t._addName(this,i);return this._setAttr("name",e),this},addName:function(t){if(!this.hasName(t)){var e=this.name(),i=e?e+" "+t:t;this.setName(i)}return this},hasName:function(t){return-1!==(this.name()||"").split(/\s/g).indexOf(t)},removeName:function(t){var e=(this.name()||"").split(/\s/g),i=e.indexOf(t);return-1!==i&&(e.splice(i,1),this.setName(e.join(" "))),this},setAttr:function(e,i){var n=this["set"+t.Util._capitalize(e)];return t.Util._isFunction(n)?n.call(this,i):this._setAttr(e,i),this},_setAttr:function(e,i){var n;(n=this.attrs[e])===i&&!t.Util.isObject(i)||(void 0===i||null===i?delete this.attrs[e]:this.attrs[e]=i,this._fireChangeEvent(e,n,i))},_setComponentAttr:function(t,e,i){var n;void 0!==i&&((n=this.attrs[t])||(this.attrs[t]=this.getAttr(t)),this.attrs[t][e]=i,this._fireChangeEvent(t,n,i))},_fireAndBubble:function(t,i,n){var o=!0;if(i&&this.nodeType===e&&(i.target=this),"mouseenter"===t&&n&&(this._id===n._id||this.isAncestorOf&&this.isAncestorOf(n))?o=!1:"mouseleave"===t&&n&&(this._id===n._id||this.isAncestorOf&&this.isAncestorOf(n))&&(o=!1),o){this._fire(t,i);var r=("mouseenter"===t||"mouseleave"===t)&&n&&n.isAncestorOf&&n.isAncestorOf(this)&&!n.isAncestorOf(this.parent);(i&&!i.cancelBubble||!i)&&this.parent&&this.parent.isListening()&&!r&&(n&&n.parent?this._fireAndBubble.call(this.parent,t,i,n.parent):this._fireAndBubble.call(this.parent,t,i))}},_fire:function(t,e){var i,n=this.eventListeners[t];if((e=e||{}).currentTarget=this,e.type=t,n)for(i=0;i<n.length;i++)n[i].handler.call(this,e)},draw:function(){return this.drawScene(),this.drawHit(),this}}),t.Node.create=function(e,i){return t.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,i)},t.Node._createNode=function(e,i){var n,o,r,s=t.Node.prototype.getClassName.call(e),a=e.children;if(i&&(e.attrs.container=i),n=new t[s](e.attrs),a)for(o=a.length,r=0;r<o;r++)n.add(this._createNode(a[r]));return n},t.Factory.addOverloadedGetterSetter(t.Node,"position"),t.Factory.addGetterSetter(t.Node,"x",0,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Node,"y",0,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Node,"globalCompositeOperation","source-over",t.Validators.getStringValidator()),t.Factory.addGetterSetter(t.Node,"opacity",1,t.Validators.getNumberValidator()),t.Factory.addGetter(t.Node,"name"),t.Factory.addOverloadedGetterSetter(t.Node,"name"),t.Factory.addGetter(t.Node,"id"),t.Factory.addOverloadedGetterSetter(t.Node,"id"),t.Factory.addGetterSetter(t.Node,"rotation",0,t.Validators.getNumberValidator()),t.Factory.addComponentsGetterSetter(t.Node,"scale",["x","y"]),t.Factory.addGetterSetter(t.Node,"scaleX",1,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Node,"scaleY",1,t.Validators.getNumberValidator()),t.Factory.addComponentsGetterSetter(t.Node,"skew",["x","y"]),t.Factory.addGetterSetter(t.Node,"skewX",0,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Node,"skewY",0,t.Validators.getNumberValidator()),t.Factory.addComponentsGetterSetter(t.Node,"offset",["x","y"]),t.Factory.addGetterSetter(t.Node,"offsetX",0,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Node,"offsetY",0,t.Validators.getNumberValidator()),t.Factory.addSetter(t.Node,"dragDistance",t.Validators.getNumberValidator()),t.Factory.addOverloadedGetterSetter(t.Node,"dragDistance"),t.Factory.addSetter(t.Node,"width",t.Validators.getNumberValidator()),t.Factory.addOverloadedGetterSetter(t.Node,"width"),t.Factory.addSetter(t.Node,"height",t.Validators.getNumberValidator()),t.Factory.addOverloadedGetterSetter(t.Node,"height"),t.Factory.addGetterSetter(t.Node,"listening","inherit",function(e){return!0===e||!1===e||"inherit"===e||t.Util.warn(e+' is a not valid value for "listening" attribute. The value may be true, false or "inherit".'),e}),t.Factory.addGetterSetter(t.Node,"preventDefault",!0,t.Validators.getBooleanValidator()),t.Factory.addGetterSetter(t.Node,"filters",null,function(t){return this._filterUpToDate=!1,t}),t.Factory.addGetterSetter(t.Node,"visible","inherit",function(e){return!0===e||!1===e||"inherit"===e||t.Util.warn(e+' is a not valid value for "visible" attribute. The value may be true, false or "inherit".'),e}),t.Factory.addGetterSetter(t.Node,"transformsEnabled","all",t.Validators.getStringValidator()),t.Factory.addOverloadedGetterSetter(t.Node,"size"),t.Factory.backCompat(t.Node,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"}),t.Collection.mapMethods(t.Node)}(Konva),function(){"use strict";Konva.Filters.Grayscale=function(t){var e,i,n=t.data,o=n.length;for(e=0;e<o;e+=4)i=.34*n[e]+.5*n[e+1]+.16*n[e+2],n[e]=i,n[e+1]=i,n[e+2]=i}}(),function(t){"use strict";t.Filters.Brighten=function(t){var e,i=255*this.brightness(),n=t.data,o=n.length;for(e=0;e<o;e+=4)n[e]+=i,n[e+1]+=i,n[e+2]+=i},t.Factory.addGetterSetter(t.Node,"brightness",0,t.Validators.getNumberValidator(),t.Factory.afterSetFilter)}(Konva),function(){"use strict";Konva.Filters.Invert=function(t){var e,i=t.data,n=i.length;for(e=0;e<n;e+=4)i[e]=255-i[e],i[e+1]=255-i[e+1],i[e+2]=255-i[e+2]}}(),function(t){"use strict";function e(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var i=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],n=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];t.Filters.Blur=function(t){var o=Math.round(this.blurRadius());o>0&&function(t,o){var r,s,a,l,u,h,c,d,p,f,m,y,v,g,_,b,S,T,w,P,x,k,A,M,C=t.data,O=t.width,F=t.height,E=o+o+1,R=O-1,N=F-1,K=o+1,D=K*(K+1)/2,L=new e,q=null,I=L,U=null,V=null,B=i[o],G=n[o];for(a=1;a<E;a++)I=I.next=new e,a===K&&(q=I);for(I.next=L,c=h=0,s=0;s<F;s++){for(b=S=T=w=d=p=f=m=0,y=K*(P=C[h]),v=K*(x=C[h+1]),g=K*(k=C[h+2]),_=K*(A=C[h+3]),d+=D*P,p+=D*x,f+=D*k,m+=D*A,I=L,a=0;a<K;a++)I.r=P,I.g=x,I.b=k,I.a=A,I=I.next;for(a=1;a<K;a++)l=h+((R<a?R:a)<<2),d+=(I.r=P=C[l])*(M=K-a),p+=(I.g=x=C[l+1])*M,f+=(I.b=k=C[l+2])*M,m+=(I.a=A=C[l+3])*M,b+=P,S+=x,T+=k,w+=A,I=I.next;for(U=L,V=q,r=0;r<O;r++)C[h+3]=A=m*B>>G,0!==A?(A=255/A,C[h]=(d*B>>G)*A,C[h+1]=(p*B>>G)*A,C[h+2]=(f*B>>G)*A):C[h]=C[h+1]=C[h+2]=0,d-=y,p-=v,f-=g,m-=_,y-=U.r,v-=U.g,g-=U.b,_-=U.a,l=c+((l=r+o+1)<R?l:R)<<2,d+=b+=U.r=C[l],p+=S+=U.g=C[l+1],f+=T+=U.b=C[l+2],m+=w+=U.a=C[l+3],U=U.next,y+=P=V.r,v+=x=V.g,g+=k=V.b,_+=A=V.a,b-=P,S-=x,T-=k,w-=A,V=V.next,h+=4;c+=O}for(r=0;r<O;r++){for(S=T=w=b=p=f=m=d=0,y=K*(P=C[h=r<<2]),v=K*(x=C[h+1]),g=K*(k=C[h+2]),_=K*(A=C[h+3]),d+=D*P,p+=D*x,f+=D*k,m+=D*A,I=L,a=0;a<K;a++)I.r=P,I.g=x,I.b=k,I.a=A,I=I.next;for(u=O,a=1;a<=o;a++)h=u+r<<2,d+=(I.r=P=C[h])*(M=K-a),p+=(I.g=x=C[h+1])*M,f+=(I.b=k=C[h+2])*M,m+=(I.a=A=C[h+3])*M,b+=P,S+=x,T+=k,w+=A,I=I.next,a<N&&(u+=O);for(h=r,U=L,V=q,s=0;s<F;s++)C[3+(l=h<<2)]=A=m*B>>G,A>0?(A=255/A,C[l]=(d*B>>G)*A,C[l+1]=(p*B>>G)*A,C[l+2]=(f*B>>G)*A):C[l]=C[l+1]=C[l+2]=0,d-=y,p-=v,f-=g,m-=_,y-=U.r,v-=U.g,g-=U.b,_-=U.a,l=r+((l=s+K)<N?l:N)*O<<2,d+=b+=U.r=C[l],p+=S+=U.g=C[l+1],f+=T+=U.b=C[l+2],m+=w+=U.a=C[l+3],U=U.next,y+=P=V.r,v+=x=V.g,g+=k=V.b,_+=A=V.a,b-=P,S-=x,T-=k,w-=A,V=V.next,h+=O}}(t,o)},t.Factory.addGetterSetter(t.Node,"blurRadius",0,t.Validators.getNumberValidator(),t.Factory.afterSetFilter)}(Konva),function(){"use strict";function t(t,e,i){var n=4*(i*t.width+e),o=[];return o.push(t.data[n++],t.data[n++],t.data[n++],t.data[n++]),o}function e(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2))}Konva.Filters.Mask=function(i){var n=function(i,n){var o=t(i,0,0),r=t(i,i.width-1,0),s=t(i,0,i.height-1),a=t(i,i.width-1,i.height-1),l=n||10;if(e(o,r)<l&&e(r,a)<l&&e(a,s)<l&&e(s,o)<l){for(var u=function(t){for(var e=[0,0,0],i=0;i<t.length;i++)e[0]+=t[i][0],e[1]+=t[i][1],e[2]+=t[i][2];return e[0]/=t.length,e[1]/=t.length,e[2]/=t.length,e}([r,o,a,s]),h=[],c=0;c<i.width*i.height;c++){var d=e(u,[i.data[4*c],i.data[4*c+1],i.data[4*c+2]]);h[c]=d<l?0:255}return h}}(i,this.threshold());return n&&function(t,e){for(var i=0;i<t.width*t.height;i++)t.data[4*i+3]=e[i]}(i,n=function(t,e,i){for(var n=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],o=Math.round(Math.sqrt(n.length)),r=Math.floor(o/2),s=[],a=0;a<i;a++)for(var l=0;l<e;l++){for(var u=a*e+l,h=0,c=0;c<o;c++)for(var d=0;d<o;d++){var p=a+c-r,f=l+d-r;if(p>=0&&p<i&&f>=0&&f<e){var m=n[c*o+d];h+=t[p*e+f]*m}}s[u]=h}return s}(n=function(t,e,i){for(var n=[1,1,1,1,1,1,1,1,1],o=Math.round(Math.sqrt(n.length)),r=Math.floor(o/2),s=[],a=0;a<i;a++)for(var l=0;l<e;l++){for(var u=a*e+l,h=0,c=0;c<o;c++)for(var d=0;d<o;d++){var p=a+c-r,f=l+d-r;if(p>=0&&p<i&&f>=0&&f<e){var m=n[c*o+d];h+=t[p*e+f]*m}}s[u]=h>=1020?255:0}return s}(n=function(t,e,i){for(var n=[1,1,1,1,0,1,1,1,1],o=Math.round(Math.sqrt(n.length)),r=Math.floor(o/2),s=[],a=0;a<i;a++)for(var l=0;l<e;l++){for(var u=a*e+l,h=0,c=0;c<o;c++)for(var d=0;d<o;d++){var p=a+c-r,f=l+d-r;if(p>=0&&p<i&&f>=0&&f<e){var m=n[c*o+d];h+=t[p*e+f]*m}}s[u]=2040===h?255:0}return s}(n,i.width,i.height),i.width,i.height),i.width,i.height)),i},Konva.Factory.addGetterSetter(Konva.Node,"threshold",0,Konva.Validators.getNumberValidator(),Konva.Factory.afterSetFilter)}(),function(){"use strict";Konva.Filters.RGB=function(t){var e,i,n=t.data,o=n.length,r=this.red(),s=this.green(),a=this.blue();for(e=0;e<o;e+=4)i=(.34*n[e]+.5*n[e+1]+.16*n[e+2])/255,n[e]=i*r,n[e+1]=i*s,n[e+2]=i*a,n[e+3]=n[e+3]},Konva.Factory.addGetterSetter(Konva.Node,"red",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)}),Konva.Factory.addGetterSetter(Konva.Node,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)}),Konva.Factory.addGetterSetter(Konva.Node,"blue",0,Konva.Validators.RGBComponent,Konva.Factory.afterSetFilter)}(),function(){"use strict";Konva.Filters.RGBA=function(t){var e,i,n=t.data,o=n.length,r=this.red(),s=this.green(),a=this.blue(),l=this.alpha();for(e=0;e<o;e+=4)i=1-l,n[e]=r*l+n[e]*i,n[e+1]=s*l+n[e+1]*i,n[e+2]=a*l+n[e+2]*i},Konva.Factory.addGetterSetter(Konva.Node,"red",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)}),Konva.Factory.addGetterSetter(Konva.Node,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)}),Konva.Factory.addGetterSetter(Konva.Node,"blue",0,Konva.Validators.RGBComponent,Konva.Factory.afterSetFilter),Konva.Factory.addGetterSetter(Konva.Node,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t})}(),function(){"use strict";Konva.Filters.HSV=function(t){var e,i,n,o,r,s=t.data,a=s.length,l=Math.pow(2,this.value()),u=Math.pow(2,this.saturation()),h=Math.abs(this.hue()+360)%360,c=l*u*Math.cos(h*Math.PI/180),d=l*u*Math.sin(h*Math.PI/180),p=.299*l+.701*c+.167*d,f=.587*l-.587*c+.33*d,m=.114*l-.114*c-.497*d,y=.299*l-.299*c-.328*d,v=.587*l+.413*c+.035*d,g=.114*l-.114*c+.293*d,_=.299*l-.3*c+1.25*d,b=.587*l-.586*c-1.05*d,S=.114*l+.886*c-.2*d;for(e=0;e<a;e+=4)i=s[e+0],n=s[e+1],o=s[e+2],r=s[e+3],s[e+0]=p*i+f*n+m*o,s[e+1]=y*i+v*n+g*o,s[e+2]=_*i+b*n+S*o,s[e+3]=r},Konva.Factory.addGetterSetter(Konva.Node,"hue",0,Konva.Validators.getNumberValidator(),Konva.Factory.afterSetFilter),Konva.Factory.addGetterSetter(Konva.Node,"saturation",0,Konva.Validators.getNumberValidator(),Konva.Factory.afterSetFilter),Konva.Factory.addGetterSetter(Konva.Node,"value",0,Konva.Validators.getNumberValidator(),Konva.Factory.afterSetFilter)}(),function(){"use strict";Konva.Factory.addGetterSetter(Konva.Node,"hue",0,Konva.Validators.getNumberValidator(),Konva.Factory.afterSetFilter),Konva.Factory.addGetterSetter(Konva.Node,"saturation",0,Konva.Validators.getNumberValidator(),Konva.Factory.afterSetFilter),Konva.Factory.addGetterSetter(Konva.Node,"luminance",0,Konva.Validators.getNumberValidator(),Konva.Factory.afterSetFilter),Konva.Filters.HSL=function(t){var e,i,n,o,r,s=t.data,a=s.length,l=Math.pow(2,this.saturation()),u=Math.abs(this.hue()+360)%360,h=127*this.luminance(),c=1*l*Math.cos(u*Math.PI/180),d=1*l*Math.sin(u*Math.PI/180),p=.299+.701*c+.167*d,f=.587-.587*c+.33*d,m=.114-.114*c-.497*d,y=.299-.299*c-.328*d,v=.587+.413*c+.035*d,g=.114-.114*c+.293*d,_=.299-.3*c+1.25*d,b=.587-.586*c-1.05*d,S=.114+.886*c-.2*d;for(e=0;e<a;e+=4)i=s[e+0],n=s[e+1],o=s[e+2],r=s[e+3],s[e+0]=p*i+f*n+m*o+h,s[e+1]=y*i+v*n+g*o+h,s[e+2]=_*i+b*n+S*o+h,s[e+3]=r}}(),function(){"use strict";Konva.Filters.Emboss=function(t){var e=10*this.embossStrength(),i=255*this.embossWhiteLevel(),n=this.embossDirection(),o=this.embossBlend(),r=0,s=0,a=t.data,l=t.width,u=t.height,h=4*l,c=u;switch(n){case"top-left":r=-1,s=-1;break;case"top":r=-1,s=0;break;case"top-right":r=-1,s=1;break;case"right":r=0,s=1;break;case"bottom-right":r=1,s=1;break;case"bottom":r=1,s=0;break;case"bottom-left":r=1,s=-1;break;case"left":r=0,s=-1;break;default:Konva.Util.error("Unknown emboss direction: "+n)}do{var d=(c-1)*h,p=r;c+p<1&&(p=0),c+p>u&&(p=0);var f=(c-1+p)*l*4,m=l;do{var y=d+4*(m-1),v=s;m+v<1&&(v=0),m+v>l&&(v=0);var g=f+4*(m-1+v),_=a[y]-a[g],b=a[y+1]-a[g+1],S=a[y+2]-a[g+2],T=_,w=T>0?T:-T;if((b>0?b:-b)>w&&(T=b),(S>0?S:-S)>w&&(T=S),T*=e,o){var P=a[y]+T,x=a[y+1]+T,k=a[y+2]+T;a[y]=P>255?255:P<0?0:P,a[y+1]=x>255?255:x<0?0:x,a[y+2]=k>255?255:k<0?0:k}else{var A=i-T;A<0?A=0:A>255&&(A=255),a[y]=a[y+1]=a[y+2]=A}}while(--m)}while(--c)},Konva.Factory.addGetterSetter(Konva.Node,"embossStrength",.5,Konva.Validators.getNumberValidator(),Konva.Factory.afterSetFilter),Konva.Factory.addGetterSetter(Konva.Node,"embossWhiteLevel",.5,Konva.Validators.getNumberValidator(),Konva.Factory.afterSetFilter),Konva.Factory.addGetterSetter(Konva.Node,"embossDirection","top-left",null,Konva.Factory.afterSetFilter),Konva.Factory.addGetterSetter(Konva.Node,"embossBlend",!1,null,Konva.Factory.afterSetFilter)}(),function(){"use strict";function t(t,e,i,n,o){var r=i-e,s=o-n;return 0===r?n+s/2:0===s?n:s*((t-e)/r)+n}Konva.Filters.Enhance=function(e){var i,n,o,r,s=e.data,a=s.length,l=s[0],u=l,h=s[1],c=h,d=s[2],p=d,f=this.enhance();if(0!==f){for(r=0;r<a;r+=4)(i=s[r+0])<l?l=i:i>u&&(u=i),(n=s[r+1])<h?h=n:n>c&&(c=n),(o=s[r+2])<d?d=o:o>p&&(p=o);var m,y,v,g,_,b,S,T,w;for(u===l&&(u=255,l=0),c===h&&(c=255,h=0),p===d&&(p=255,d=0),f>0?(y=u+f*(255-u),v=l-f*(l-0),_=c+f*(255-c),b=h-f*(h-0),T=p+f*(255-p),w=d-f*(d-0)):(y=u+f*(u-(m=.5*(u+l))),v=l+f*(l-m),_=c+f*(c-(g=.5*(c+h))),b=h+f*(h-g),T=p+f*(p-(S=.5*(p+d))),w=d+f*(d-S)),r=0;r<a;r+=4)s[r+0]=t(s[r+0],l,u,v,y),s[r+1]=t(s[r+1],h,c,b,_),s[r+2]=t(s[r+2],d,p,w,T)}},Konva.Factory.addGetterSetter(Konva.Node,"enhance",0,Konva.Validators.getNumberValidator(),Konva.Factory.afterSetFilter)}(),function(){"use strict";Konva.Filters.Posterize=function(t){var e,i=Math.round(254*this.levels())+1,n=t.data,o=n.length,r=255/i;for(e=0;e<o;e+=1)n[e]=Math.floor(n[e]/r)*r},Konva.Factory.addGetterSetter(Konva.Node,"levels",.5,Konva.Validators.getNumberValidator(),Konva.Factory.afterSetFilter)}(),function(){"use strict";Konva.Filters.Noise=function(t){var e,i=255*this.noise(),n=t.data,o=n.length,r=i/2;for(e=0;e<o;e+=4)n[e+0]+=r-2*r*Math.random(),n[e+1]+=r-2*r*Math.random(),n[e+2]+=r-2*r*Math.random()},Konva.Factory.addGetterSetter(Konva.Node,"noise",.2,Konva.Validators.getNumberValidator(),Konva.Factory.afterSetFilter)}(),function(){"use strict";Konva.Filters.Pixelate=function(t){var e,i,n,o,r,s,a,l,u,h,c,d,p,f,m=Math.ceil(this.pixelSize()),y=t.width,v=t.height,g=Math.ceil(y/m),_=Math.ceil(v/m);if(t=t.data,m<=0)Konva.Util.error("pixelSize value can not be <= 0");else for(d=0;d<g;d+=1)for(p=0;p<_;p+=1){for(o=0,r=0,s=0,a=0,u=(l=d*m)+m,c=(h=p*m)+m,f=0,e=l;e<u;e+=1)if(!(e>=y))for(i=h;i<c;i+=1)i>=v||(o+=t[(n=4*(y*i+e))+0],r+=t[n+1],s+=t[n+2],a+=t[n+3],f+=1);for(o/=f,r/=f,s/=f,a/=f,e=l;e<u;e+=1)if(!(e>=y))for(i=h;i<c;i+=1)i>=v||(t[(n=4*(y*i+e))+0]=o,t[n+1]=r,t[n+2]=s,t[n+3]=a)}},Konva.Factory.addGetterSetter(Konva.Node,"pixelSize",8,Konva.Validators.getNumberValidator(),Konva.Factory.afterSetFilter)}(),function(){"use strict";Konva.Filters.Threshold=function(t){var e,i=255*this.threshold(),n=t.data,o=n.length;for(e=0;e<o;e+=1)n[e]=n[e]<i?0:255},Konva.Factory.addGetterSetter(Konva.Node,"threshold",.5,Konva.Validators.getNumberValidator(),Konva.Factory.afterSetFilter)}(),function(){"use strict";Konva.Filters.Sepia=function(t){var e,i,n,o,r,s,a,l,u,h=t.data,c=t.width,d=t.height,p=4*c;do{e=(d-1)*p,i=c;do{a=.393*(o=h[n=e+4*(i-1)])+.769*(r=h[n+1])+.189*(s=h[n+2]),l=.349*o+.686*r+.168*s,u=.272*o+.534*r+.131*s,h[n]=a>255?255:a,h[n+1]=l>255?255:l,h[n+2]=u>255?255:u,h[n+3]=h[n+3]}while(--i)}while(--d)}}(),function(){"use strict";Konva.Filters.Solarize=function(t){var e=t.data,i=t.width,n=4*i,o=t.height;do{var r=(o-1)*n,s=i;do{var a=r+4*(s-1),l=e[a],u=e[a+1],h=e[a+2];l>127&&(l=255-l),u>127&&(u=255-u),h>127&&(h=255-h),e[a]=l,e[a+1]=u,e[a+2]=h}while(--s)}while(--o)}}(),function(){"use strict";Konva.Filters.Kaleidoscope=function(t){var e,i,n,o,r,s,a,l,u,h=t.width,c=t.height,d=Math.round(this.kaleidoscopePower()),p=Math.round(this.kaleidoscopeAngle()),f=Math.floor(h*(p%360)/360);if(!(d<1)){var m=Konva.Util.createCanvasElement();m.width=h,m.height=c;var y=m.getContext("2d").getImageData(0,0,h,c);!function(t,e,i){var n,o,r,s,a=t.data,l=e.data,u=t.width,h=t.height,c=i.polarCenterX||u/2,d=i.polarCenterY||h/2,p=0,f=0,m=0,y=0,v=Math.sqrt(c*c+d*d);o=u-c,r=h-d,v=(s=Math.sqrt(o*o+r*r))>v?s:v;var g,_,b,S,T=h,w=u,P=360/w*Math.PI/180;for(_=0;_<w;_+=1)for(b=Math.sin(_*P),S=Math.cos(_*P),g=0;g<T;g+=1)o=Math.floor(c+v*g/T*S),p=a[0+(n=4*((r=Math.floor(d+v*g/T*b))*u+o))],f=a[n+1],m=a[n+2],y=a[n+3],l[0+(n=4*(_+g*u))]=p,l[n+1]=f,l[n+2]=m,l[n+3]=y}(t,y,{polarCenterX:h/2,polarCenterY:c/2});for(var v=h/Math.pow(2,d);v<=8;)v*=2,d-=1;var g=v=Math.ceil(v),_=0,b=g,S=1;for(f+v>h&&(_=g,b=0,S=-1),i=0;i<c;i+=1)for(e=_;e!==b;e+=S)l=4*(h*i+Math.round(e+f)%h),o=y.data[l+0],r=y.data[l+1],s=y.data[l+2],a=y.data[l+3],u=4*(h*i+e),y.data[u+0]=o,y.data[u+1]=r,y.data[u+2]=s,y.data[u+3]=a;for(i=0;i<c;i+=1)for(g=Math.floor(v),n=0;n<d;n+=1){for(e=0;e<g+1;e+=1)l=4*(h*i+e),o=y.data[l+0],r=y.data[l+1],s=y.data[l+2],a=y.data[l+3],u=4*(h*i+2*g-e-1),y.data[u+0]=o,y.data[u+1]=r,y.data[u+2]=s,y.data[u+3]=a;g*=2}!function(t,e,i){var n,o,r,s,a,l,u=t.data,h=e.data,c=t.width,d=t.height,p=i.polarCenterX||c/2,f=i.polarCenterY||d/2,m=0,y=0,v=0,g=0,_=Math.sqrt(p*p+f*f);o=c-p,r=d-f,_=(l=Math.sqrt(o*o+r*r))>_?l:_;var b,S,T,w=d,P=c,x=i.polarRotation||0;for(o=0;o<c;o+=1)for(r=0;r<d;r+=1)s=o-p,a=r-f,b=Math.sqrt(s*s+a*a)*w/_,S=(S=(180*Math.atan2(a,s)/Math.PI+360+x)%360)*P/360,T=Math.floor(S),m=u[0+(n=4*(Math.floor(b)*c+T))],y=u[n+1],v=u[n+2],g=u[n+3],h[0+(n=4*(r*c+o))]=m,h[n+1]=y,h[n+2]=v,h[n+3]=g}(y,t,{polarRotation:0})}},Konva.Factory.addGetterSetter(Konva.Node,"kaleidoscopePower",2,Konva.Validators.getNumberValidator(),Konva.Factory.afterSetFilter),Konva.Factory.addGetterSetter(Konva.Node,"kaleidoscopeAngle",0,Konva.Validators.getNumberValidator(),Konva.Factory.afterSetFilter)}(),function(t){"use strict";t.Filters.Contrast=function(t){var e,i=Math.pow((parseInt(this.contrast())+100)/100,2),n=t.data,o=n.length,r=150,s=150,a=150;for(e=0;e<o;e+=4)r=n[e],s=n[e+1],a=n[e+2],r/=255,r-=.5,r*=i,r+=.5,s/=255,s-=.5,s*=i,s+=.5,a/=255,a-=.5,a*=i,a+=.5,r=(r*=255)<0?0:r>255?255:r,s=(s*=255)<0?0:s>255?255:s,a=(a*=255)<0?0:a>255?255:a,n[e]=r,n[e+1]=s,n[e+2]=a},t.Factory.addGetterSetter(t.Node,"contrast",0,t.Validators.getNumberValidator(),t.Factory.afterSetFilter)}(Konva),function(){"use strict";Konva.Container=function(t){this.__init(t)},Konva.Util.addMethods(Konva.Container,{__init:function(t){this.children=new Konva.Collection,Konva.Node.call(this,t)},getChildren:function(t){if(!t)return this.children;var e=new Konva.Collection;return this.children.each(function(i){t(i)&&e.push(i)}),e},hasChildren:function(){return this.getChildren().length>0},removeChildren:function(){for(var t,e=Konva.Collection.toCollection(this.children),i=0;i<e.length;i++)delete(t=e[i]).parent,t.index=0,t.remove();return e=null,this.children=new Konva.Collection,this},destroyChildren:function(){for(var t,e=Konva.Collection.toCollection(this.children),i=0;i<e.length;i++)delete(t=e[i]).parent,t.index=0,t.destroy();return e=null,this.children=new Konva.Collection,this},add:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}if(t.getParent())return t.moveTo(this),this;var i=this.children;return this._validateAdd(t),t.index=i.length,t.parent=this,i.push(t),this._fire("add",{child:t}),Konva.DD&&t.isDragging()&&Konva.DD.anim.setLayers(t.getLayer()),this},destroy:function(){return this.hasChildren()&&this.destroyChildren(),Konva.Node.prototype.destroy.call(this),this},find:function(t){return this._generalFind(t,!1)},findOne:function(t){var e=this._generalFind(t,!0);return e.length>0?e[0]:void 0},_generalFind:function(t,e){var i=[];return"string"===typeof t?i=this._findByString(t,e):"function"===typeof t&&(i=this._findByFunction(t,e)),Konva.Collection.toCollection(i)},_findByString:function(t){var e,i,n,o,r,s,a,l=[],u=t.replace(/ /g,"").split(","),h=u.length;for(e=0;e<h;e++){if(n=u[e],!Konva.Util.isValidSelector(n)){var c='Selector "'+n+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".\nIf you have a custom shape with such className, please change it to start with upper letter like "Triangle".\nKonva is awesome, right?';Konva.Util.warn(c)}if("#"===n.charAt(0))(r=this._getNodeById(n.slice(1)))&&l.push(r);else if("."===n.charAt(0))o=this._getNodesByName(n.slice(1)),l=l.concat(o);else for(a=(s=this.getChildren()).length,i=0;i<a;i++)l=l.concat(s[i]._get(n))}return l},_findByFunction:function(t,e){var i=[];return function n(o){if(!(e&&i.length>0)){var r=o.getChildren(),s=r.length;t(o)&&(i=i.concat(o));for(var a=0;a<s;a++)n(r[a])}}(this),i},_getNodeById:function(t){var e=Konva.ids[t];return void 0!==e&&this.isAncestorOf(e)?e:null},_getNodesByName:function(t){var e=Konva.names[t]||[];return this._getDescendants(e)},_get:function(t){for(var e=Konva.Node.prototype._get.call(this,t),i=this.getChildren(),n=i.length,o=0;o<n;o++)e=e.concat(i[o]._get(t));return e},toObject:function(){var t=Konva.Node.prototype.toObject.call(this);t.children=[];for(var e=this.getChildren(),i=e.length,n=0;n<i;n++){var o=e[n];t.children.push(o.toObject())}return t},_getDescendants:function(t){for(var e=[],i=t.length,n=0;n<i;n++){var o=t[n];this.isAncestorOf(o)&&e.push(o)}return e},isAncestorOf:function(t){for(var e=t.getParent();e;){if(e._id===this._id)return!0;e=e.getParent()}return!1},clone:function(t){var e=Konva.Node.prototype.clone.call(this,t);return this.getChildren().each(function(t){e.add(t.clone())}),e},getAllIntersections:function(t){var e=[];return this.find("Shape").each(function(i){i.isVisible()&&i.intersects(t)&&e.push(i)}),e},_setChildrenIndices:function(){this.children.each(function(t,e){t.index=e})},drawScene:function(t,e,i){var n=this.getLayer(),o=t||n&&n.getCanvas(),r=o&&o.getContext(),s=this._cache.canvas,a=s&&s.scene;return(this.isVisible()||i)&&(!i&&a?(r.save(),n._applyTransform(this,r,e),this._drawCachedSceneCanvas(r),r.restore()):this._drawChildren(o,"drawScene",e,!1,i)),this},drawHit:function(t,e,i){var n=this.getLayer(),o=t||n&&n.hitCanvas,r=o&&o.getContext(),s=this._cache.canvas,a=s&&s.hit;return(this.shouldDrawHit(o)||i)&&(n&&n.clearHitCache(),!i&&a?(r.save(),n._applyTransform(this,r,e),this._drawCachedHitCanvas(r),r.restore()):this._drawChildren(o,"drawHit",e)),this},_drawChildren:function(t,e,i,n,o){var r,s,a=this.getLayer(),l=t&&t.getContext(),u=this.getClipWidth(),h=this.getClipHeight(),c=this.getClipFunc(),d=u&&h||c;if(d&&a){l.save();var p=this.getAbsoluteTransform(i),f=p.getMatrix();l.transform(f[0],f[1],f[2],f[3],f[4],f[5]),l.beginPath(),c?c.call(this,l,this):(r=this.getClipX(),s=this.getClipY(),l.rect(r,s,u,h)),l.clip(),f=p.copy().invert().getMatrix(),l.transform(f[0],f[1],f[2],f[3],f[4],f[5])}this.children.each(function(r){r[e](t,i,n,o)}),d&&l.restore()},shouldDrawHit:function(t){var e=this.getLayer(),i=Konva.DD&&Konva.isDragging()&&-1!==Konva.DD.anim.getLayers().indexOf(e);return t&&t.isCache||e&&e.hitGraphEnabled()&&this.isVisible()&&!i},getClientRect:function(t){var e,i,n,o,r=(t=t||{}).skipTransform,s=t.relativeTo,a={x:1/0,y:1/0,width:0,height:0},l=this;this.children.each(function(t){if(t.getVisible()){var r=t.getClientRect({relativeTo:l});void 0===e?(e=r.x,i=r.y,n=r.x+r.width,o=r.y+r.height):(e=Math.min(e,r.x),i=Math.min(i,r.y),n=Math.max(n,r.x+r.width),o=Math.max(o,r.y+r.height))}});for(var u=this.find("Shape"),h=!1,c=0;c<u.length;c++){if(u[c].getVisible()){h=!0;break}}return a=h?{x:e,y:i,width:n-e,height:o-i}:{x:0,y:0,width:0,height:0},r?a:this._transformedRect(a,s)}}),Konva.Util.extend(Konva.Container,Konva.Node),Konva.Container.prototype.get=Konva.Container.prototype.find,Konva.Factory.addComponentsGetterSetter(Konva.Container,"clip",["x","y","width","height"]),Konva.Factory.addGetterSetter(Konva.Container,"clipX",void 0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Container,"clipY",void 0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Container,"clipWidth",void 0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Container,"clipHeight",void 0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Container,"clipFunc"),Konva.Collection.mapMethods(Konva.Container)}(),function(t){"use strict";var e="hasShadow",i="shadowRGBA";function n(t){t.fill()}function o(t){t.stroke()}function r(t){t.fill()}function s(t){t.stroke()}function a(){this._clearCache(e)}function l(){this._clearCache(i)}t.Shape=function(t){this.__init(t)},t.Util.addMethods(t.Shape,{__init:function(e){this.nodeType="Shape",this._fillFunc=n,this._strokeFunc=o,this._fillFuncHit=r,this._strokeFuncHit=s;for(var i,u=t.shapes;!(i=t.Util.getRandomColor())||i in u;);this.colorKey=i,u[i]=this,t.Node.call(this,e),this.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",a),this.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",l)},hasChildren:function(){return!1},getChildren:function(){return[]},getContext:function(){return this.getLayer().getContext()},getCanvas:function(){return this.getLayer().getCanvas()},hasShadow:function(){return this._getCache(e,this._hasShadow)},_hasShadow:function(){return this.getShadowEnabled()&&0!==this.getShadowOpacity()&&!!(this.getShadowColor()||this.getShadowBlur()||this.getShadowOffsetX()||this.getShadowOffsetY())},getShadowRGBA:function(){return this._getCache(i,this._getShadowRGBA)},_getShadowRGBA:function(){if(this.hasShadow()){var e=t.Util.colorToRGBA(this.shadowColor());return"rgba("+e.r+","+e.g+","+e.b+","+e.a*(this.getShadowOpacity()||1)+")"}},hasFill:function(){return!!(this.getFill()||this.getFillPatternImage()||this.getFillLinearGradientColorStops()||this.getFillRadialGradientColorStops())},hasStroke:function(){return this.strokeEnabled()&&!(!this.stroke()&&!this.getStrokeLinearGradientColorStops())},intersects:function(t){var e=this.getStage().bufferHitCanvas;return e.getContext().clear(),this.drawHit(e),e.context.getImageData(Math.round(t.x),Math.round(t.y),1,1).data[3]>0},destroy:function(){return t.Node.prototype.destroy.call(this),delete t.shapes[this.colorKey],this},_useBufferCanvas:function(t){return!t&&this.perfectDrawEnabled()&&1!==this.getAbsoluteOpacity()&&this.hasFill()&&this.hasStroke()&&this.getStage()||this.perfectDrawEnabled()&&this.hasShadow()&&1!==this.getAbsoluteOpacity()&&this.hasFill()&&this.hasStroke()&&this.getStage()},getSelfRect:function(){var t=this.getSize();return{x:this._centroid?Math.round(-t.width/2):0,y:this._centroid?Math.round(-t.height/2):0,width:t.width,height:t.height}},getClientRect:function(t){var e=(t=t||{}).skipTransform,i=t.relativeTo,n=this.getSelfRect(),o=this.hasStroke()&&this.strokeWidth()||0,r=n.width+o,s=n.height+o,a=this.hasShadow()?this.shadowOffsetX():0,l=this.hasShadow()?this.shadowOffsetY():0,u=r+Math.abs(a),h=s+Math.abs(l),c=this.hasShadow()&&this.shadowBlur()||0,d=u+2*c,p=h+2*c,f=0;Math.round(o/2)!==o/2&&(f=1);var m={width:d+f,height:p+f,x:-Math.round(o/2+c)+Math.min(a,0)+n.x,y:-Math.round(o/2+c)+Math.min(l,0)+n.y};return e?m:this._transformedRect(m,i)},drawScene:function(t,e,i,n){var o,r,s=this.getLayer(),a=t||s.getCanvas(),l=a.getContext(),u=this._cache.canvas,h=this.sceneFunc(),c=this.hasShadow(),d=this.hasStroke();if(!this.isVisible()&&!i)return this;if(u)return l.save(),s._applyTransform(this,l,e),this._drawCachedSceneCanvas(l),l.restore(),this;if(!h)return this;if(l.save(),this._useBufferCanvas(i)&&!n){if((r=(o=this.getStage().bufferCanvas).getContext()).clear(),r.save(),r._applyLineJoin(this),!i)if(s)s._applyTransform(this,r,e);else{var p=this.getAbsoluteTransform(e).getMatrix();l.transform(p[0],p[1],p[2],p[3],p[4],p[5])}h.call(this,r,this),r.restore();var f=o.pixelRatio;c&&!a.hitCanvas?(l.save(),l._applyShadow(this),l._applyOpacity(this),l._applyGlobalCompositeOperation(this),l.drawImage(o._canvas,0,0,o.width/f,o.height/f),l.restore()):(l._applyOpacity(this),l._applyGlobalCompositeOperation(this),l.drawImage(o._canvas,0,0,o.width/f,o.height/f))}else{if(l._applyLineJoin(this),!i)if(s)s._applyTransform(this,l,e);else{var m=this.getAbsoluteTransform(e).getMatrix();l.transform(m[0],m[1],m[2],m[3],m[4],m[5])}c&&d&&!a.hitCanvas?(l.save(),i||(l._applyOpacity(this),l._applyGlobalCompositeOperation(this)),l._applyShadow(this),h.call(this,l,this),l.restore(),this.hasFill()&&this.getShadowForStrokeEnabled()&&h.call(this,l,this)):c&&!a.hitCanvas?(l.save(),i||(l._applyOpacity(this),l._applyGlobalCompositeOperation(this)),l._applyShadow(this),h.call(this,l,this),l.restore()):(i||(l._applyOpacity(this),l._applyGlobalCompositeOperation(this)),h.call(this,l,this))}return l.restore(),this},drawHit:function(t,e,i){var n=this.getLayer(),o=t||n.hitCanvas,r=o.getContext(),s=this.hitFunc()||this.sceneFunc(),a=this._cache.canvas,l=a&&a.hit;if(!this.shouldDrawHit(o)&&!i)return this;if(n&&n.clearHitCache(),l)return r.save(),n._applyTransform(this,r,e),this._drawCachedHitCanvas(r),r.restore(),this;if(!s)return this;if(r.save(),r._applyLineJoin(this),!i)if(n)n._applyTransform(this,r,e);else{var u=this.getAbsoluteTransform(e).getMatrix();r.transform(u[0],u[1],u[2],u[3],u[4],u[5])}return s.call(this,r,this),r.restore(),this},drawHitFromCache:function(e){var i,n,o,r,s,a=e||0,l=this._cache.canvas,u=this._getCachedSceneCanvas(),h=l.hit,c=h.getContext(),d=h.getWidth(),p=h.getHeight();c.clear(),c.drawImage(u._canvas,0,0,d,p);try{for(o=(n=(i=c.getImageData(0,0,d,p)).data).length,r=t.Util._hexToRgb(this.colorKey),s=0;s<o;s+=4)n[s+3]>a?(n[s]=r.r,n[s+1]=r.g,n[s+2]=r.b,n[s+3]=255):n[s+3]=0;c.putImageData(i,0,0)}catch(f){t.Util.error("Unable to draw hit graph from cached scene canvas. "+f.message)}return this}}),t.Util.extend(t.Shape,t.Node),t.Factory.addGetterSetter(t.Shape,"stroke",void 0,t.Validators.getStringValidator()),t.Factory.addGetterSetter(t.Shape,"strokeWidth",2,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Shape,"strokeHitEnabled",!0,t.Validators.getBooleanValidator()),t.Factory.addGetterSetter(t.Shape,"perfectDrawEnabled",!0,t.Validators.getBooleanValidator()),t.Factory.addGetterSetter(t.Shape,"shadowForStrokeEnabled",!0,t.Validators.getBooleanValidator()),t.Factory.addGetterSetter(t.Shape,"lineJoin"),t.Factory.addGetterSetter(t.Shape,"lineCap"),t.Factory.addGetterSetter(t.Shape,"sceneFunc"),t.Factory.addGetterSetter(t.Shape,"hitFunc"),t.Factory.addGetterSetter(t.Shape,"dash"),t.Factory.addGetterSetter(t.Shape,"dashOffset",0,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Shape,"shadowColor",void 0,t.Validators.getStringValidator()),t.Factory.addGetterSetter(t.Shape,"shadowBlur",0,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Shape,"shadowOpacity",1,t.Validators.getNumberValidator()),t.Factory.addComponentsGetterSetter(t.Shape,"shadowOffset",["x","y"]),t.Factory.addGetterSetter(t.Shape,"shadowOffsetX",0,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Shape,"shadowOffsetY",0,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Shape,"fillPatternImage"),t.Factory.addGetterSetter(t.Shape,"fill",void 0,t.Validators.getStringValidator()),t.Factory.addGetterSetter(t.Shape,"fillPatternX",0,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Shape,"fillPatternY",0,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Shape,"fillLinearGradientColorStops"),t.Factory.addGetterSetter(t.Shape,"strokeLinearGradientColorStops"),t.Factory.addGetterSetter(t.Shape,"fillRadialGradientStartRadius",0),t.Factory.addGetterSetter(t.Shape,"fillRadialGradientEndRadius",0),t.Factory.addGetterSetter(t.Shape,"fillRadialGradientColorStops"),t.Factory.addGetterSetter(t.Shape,"fillPatternRepeat","repeat"),t.Factory.addGetterSetter(t.Shape,"fillEnabled",!0),t.Factory.addGetterSetter(t.Shape,"strokeEnabled",!0),t.Factory.addGetterSetter(t.Shape,"shadowEnabled",!0),t.Factory.addGetterSetter(t.Shape,"dashEnabled",!0),t.Factory.addGetterSetter(t.Shape,"strokeScaleEnabled",!0),t.Factory.addGetterSetter(t.Shape,"fillPriority","color"),t.Factory.addComponentsGetterSetter(t.Shape,"fillPatternOffset",["x","y"]),t.Factory.addGetterSetter(t.Shape,"fillPatternOffsetX",0,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Shape,"fillPatternOffsetY",0,t.Validators.getNumberValidator()),t.Factory.addComponentsGetterSetter(t.Shape,"fillPatternScale",["x","y"]),t.Factory.addGetterSetter(t.Shape,"fillPatternScaleX",1,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Shape,"fillPatternScaleY",1,t.Validators.getNumberValidator()),t.Factory.addComponentsGetterSetter(t.Shape,"fillLinearGradientStartPoint",["x","y"]),t.Factory.addComponentsGetterSetter(t.Shape,"strokeLinearGradientStartPoint",["x","y"]),t.Factory.addGetterSetter(t.Shape,"fillLinearGradientStartPointX",0),t.Factory.addGetterSetter(t.Shape,"strokeLinearGradientStartPointX",0),t.Factory.addGetterSetter(t.Shape,"fillLinearGradientStartPointY",0),t.Factory.addGetterSetter(t.Shape,"strokeLinearGradientStartPointY",0),t.Factory.addComponentsGetterSetter(t.Shape,"fillLinearGradientEndPoint",["x","y"]),t.Factory.addComponentsGetterSetter(t.Shape,"strokeLinearGradientEndPoint",["x","y"]),t.Factory.addGetterSetter(t.Shape,"fillLinearGradientEndPointX",0),t.Factory.addGetterSetter(t.Shape,"strokeLinearGradientEndPointX",0),t.Factory.addGetterSetter(t.Shape,"fillLinearGradientEndPointY",0),t.Factory.addGetterSetter(t.Shape,"strokeLinearGradientEndPointY",0),t.Factory.addComponentsGetterSetter(t.Shape,"fillRadialGradientStartPoint",["x","y"]),t.Factory.addGetterSetter(t.Shape,"fillRadialGradientStartPointX",0),t.Factory.addGetterSetter(t.Shape,"fillRadialGradientStartPointY",0),t.Factory.addComponentsGetterSetter(t.Shape,"fillRadialGradientEndPoint",["x","y"]),t.Factory.addGetterSetter(t.Shape,"fillRadialGradientEndPointX",0),t.Factory.addGetterSetter(t.Shape,"fillRadialGradientEndPointY",0),t.Factory.addGetterSetter(t.Shape,"fillPatternRotation",0),t.Factory.backCompat(t.Shape,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"}),t.Collection.mapMethods(t.Shape)}(Konva),function(){"use strict";var t="_",e=["mousedown","mousemove","mouseup","mouseout","touchstart","touchmove","touchend","mouseover","wheel","contextmenu"],i=e.length;function n(e,i){e.content.addEventListener(i,function(n){e[t+i](n)},!1)}Konva.Stage=function(t){this.___init(t)},Konva.Util.addMethods(Konva.Stage,{___init:function(t){this.nodeType="Stage",Konva.Container.call(this,t),this._id=Konva.idCounter++,this._buildDOM(),this._bindContentEvents(),this._enableNestedTransforms=!1,Konva.stages.push(this)},_validateAdd:function(t){"Layer"!==t.getType()&&Konva.Util.throw("You may only add layers to the stage.")},setContainer:function(t){if("string"===typeof t){if("."===t.charAt(0)){var e=t.slice(1);t=Konva.document.getElementsByClassName(e)[0]}else{var i;i="#"!==t.charAt(0)?t:t.slice(1),t=Konva.document.getElementById(i)}if(!t)throw"Can not find container in document with id "+i}return this._setAttr("container",t),this},shouldDrawHit:function(){return!0},draw:function(){return Konva.Node.prototype.draw.call(this),this},setHeight:function(t){return Konva.Node.prototype.setHeight.call(this,t),this._resizeDOM(),this},setWidth:function(t){return Konva.Node.prototype.setWidth.call(this,t),this._resizeDOM(),this},clear:function(){var t,e=this.children,i=e.length;for(t=0;t<i;t++)e[t].clear();return this},clone:function(t){return t||(t={}),t.container=Konva.document.createElement("div"),Konva.Container.prototype.clone.call(this,t)},destroy:function(){var t=this.content;Konva.Container.prototype.destroy.call(this),t&&Konva.Util._isInDocument(t)&&this.getContainer().removeChild(t);var e=Konva.stages.indexOf(this);return e>-1&&Konva.stages.splice(e,1),this},getPointerPosition:function(){return this.pointerPos},getStage:function(){return this},getContent:function(){return this.content},_toKonvaCanvas:function(t){var e=(t=t||{}).x||0,i=t.y||0,n=new Konva.SceneCanvas({width:t.width||this.getWidth(),height:t.height||this.getHeight(),pixelRatio:t.pixelRatio||1}),o=n.getContext()._context,r=this.children;return(e||i)&&o.translate(-1*e,-1*i),r.each(function(n){if(n.isVisible()){var r=n._toKonvaCanvas(t);o.drawImage(r._canvas,e,i,r.getWidth()/r.getPixelRatio(),r.getHeight()/r.getPixelRatio())}}),n},toImage:function(t){var e=t.callback;t.callback=function(t){Konva.Util._getImage(t,function(t){e(t)})},this.toDataURL(t)},getIntersection:function(t,e){var i,n,o=this.getChildren();for(i=o.length-1;i>=0;i--)if(n=o[i].getIntersection(t,e))return n;return null},_resizeDOM:function(){if(this.content){var t,e,i=this.getWidth(),n=this.getHeight(),o=this.getChildren(),r=o.length;for(this.content.style.width=i+"px",this.content.style.height=n+"px",this.bufferCanvas.setSize(i,n),this.bufferHitCanvas.setSize(i,n),t=0;t<r;t++)(e=o[t]).setSize(i,n),e.draw()}},add:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return Konva.Container.prototype.add.call(this,t),t._setCanvasSize(this.width(),this.height()),t.draw(),Konva.isBrowser&&this.content.appendChild(t.canvas._canvas),this},getParent:function(){return null},getLayer:function(){return null},getLayers:function(){return this.getChildren()},_bindContentEvents:function(){if(Konva.isBrowser)for(var t=0;t<i;t++)n(this,e[t])},_mouseover:function(t){Konva.UA.mobile||(this._setPointerPosition(t),this._fire("contentMouseover",{evt:t}))},_mouseout:function(t){if(!Konva.UA.mobile){this._setPointerPosition(t);var e=this.targetShape;e&&!Konva.isDragging()&&(e._fireAndBubble("mouseout",{evt:t}),e._fireAndBubble("mouseleave",{evt:t}),this.targetShape=null),this.pointerPos=void 0,this._fire("contentMouseout",{evt:t})}},_mousemove:function(t){return Konva.UA.ieMobile?this._touchmove(t):"undefined"===typeof t.movementX&&"undefined"===typeof t.movementY||0!==t.movementY||0!==t.movementX?Konva.UA.mobile?null:(this._setPointerPosition(t),Konva.isDragging()||((e=this.getIntersection(this.getPointerPosition()))&&e.isListening()?Konva.isDragging()||this.targetShape&&this.targetShape._id===e._id?e._fireAndBubble("mousemove",{evt:t}):(this.targetShape&&(this.targetShape._fireAndBubble("mouseout",{evt:t},e),this.targetShape._fireAndBubble("mouseleave",{evt:t},e)),e._fireAndBubble("mouseover",{evt:t},this.targetShape),e._fireAndBubble("mouseenter",{evt:t},this.targetShape),this.targetShape=e):(this.targetShape&&!Konva.isDragging()&&(this.targetShape._fireAndBubble("mouseout",{evt:t}),this.targetShape._fireAndBubble("mouseleave",{evt:t}),this.targetShape=null),this._fire("mousemove",{evt:t,target:this,currentTarget:this})),this._fire("contentMousemove",{evt:t})),void(t.cancelable&&t.preventDefault())):null;var e},_mousedown:function(t){if(Konva.UA.ieMobile)return this._touchstart(t);if(!Konva.UA.mobile){this._setPointerPosition(t);var e=this.getIntersection(this.getPointerPosition());Konva.listenClickTap=!0,e&&e.isListening()?(this.clickStartShape=e,e._fireAndBubble("mousedown",{evt:t})):this._fire("mousedown",{evt:t,target:this,currentTarget:this}),this._fire("contentMousedown",{evt:t})}},_mouseup:function(t){if(Konva.UA.ieMobile)return this._touchend(t);if(!Konva.UA.mobile){this._setPointerPosition(t);var e=this.getIntersection(this.getPointerPosition()),i=this.clickStartShape,n=this.clickEndShape,o=!1,r=Konva.DD;Konva.inDblClickWindow?(o=!0,clearTimeout(this.dblTimeout)):r&&r.justDragged?r&&(r.justDragged=!1):(Konva.inDblClickWindow=!0,clearTimeout(this.dblTimeout)),this.dblTimeout=setTimeout(function(){Konva.inDblClickWindow=!1},Konva.dblClickWindow),e&&e.isListening()?(this.clickEndShape=e,e._fireAndBubble("mouseup",{evt:t}),Konva.listenClickTap&&i&&i._id===e._id&&(e._fireAndBubble("click",{evt:t}),o&&n&&n._id===e._id&&e._fireAndBubble("dblclick",{evt:t}))):(this._fire("mouseup",{evt:t,target:this,currentTarget:this}),this._fire("click",{evt:t,target:this,currentTarget:this}),o&&this._fire("dblclick",{evt:t,target:this,currentTarget:this})),this._fire("contentMouseup",{evt:t}),Konva.listenClickTap&&(this._fire("contentClick",{evt:t}),o&&this._fire("contentDblclick",{evt:t})),Konva.listenClickTap=!1}t.cancelable&&t.preventDefault()},_contextmenu:function(t){this._setPointerPosition(t);var e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble("contextmenu",{evt:t}):this._fire("contextmenu",{evt:t,target:this,currentTarget:this}),this._fire("contentContextmenu",{evt:t})},_touchstart:function(t){this._setPointerPosition(t);var e=this.getIntersection(this.getPointerPosition());Konva.listenClickTap=!0,e&&e.isListening()?(this.tapStartShape=e,e._fireAndBubble("touchstart",{evt:t}),e.isListening()&&e.preventDefault()&&t.cancelable&&t.preventDefault()):this._fire("touchstart",{evt:t,target:this,currentTarget:this}),this._fire("contentTouchstart",{evt:t})},_touchend:function(t){this._setPointerPosition(t);var e=this.getIntersection(this.getPointerPosition()),i=!1;Konva.inDblClickWindow?(i=!0,clearTimeout(this.dblTimeout)):(Konva.inDblClickWindow=!0,clearTimeout(this.dblTimeout)),this.dblTimeout=setTimeout(function(){Konva.inDblClickWindow=!1},Konva.dblClickWindow),e&&e.isListening()?(e._fireAndBubble("touchend",{evt:t}),Konva.listenClickTap&&this.tapStartShape&&e._id===this.tapStartShape._id&&(e._fireAndBubble("tap",{evt:t}),i&&e._fireAndBubble("dbltap",{evt:t})),e.isListening()&&e.preventDefault()&&t.cancelable&&t.preventDefault()):(this._fire("touchend",{evt:t,target:this,currentTarget:this}),this._fire("tap",{evt:t,target:this,currentTarget:this}),i&&this._fire("dbltap",{evt:t,target:this,currentTarget:this})),this._fire("contentTouchend",{evt:t}),Konva.listenClickTap&&(this._fire("contentTap",{evt:t}),i&&this._fire("contentDbltap",{evt:t})),Konva.listenClickTap=!1},_touchmove:function(t){this._setPointerPosition(t);var e,i=Konva.DD;Konva.isDragging()||((e=this.getIntersection(this.getPointerPosition()))&&e.isListening()?(e._fireAndBubble("touchmove",{evt:t}),e.isListening()&&e.preventDefault()&&t.cancelable&&t.preventDefault()):this._fire("touchmove",{evt:t,target:this,currentTarget:this}),this._fire("contentTouchmove",{evt:t})),i&&Konva.isDragging()&&Konva.DD.node.preventDefault()&&t.cancelable&&t.preventDefault()},_wheel:function(t){this._setPointerPosition(t);var e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble("wheel",{evt:t}):this._fire("wheel",{evt:t,target:this,currentTarget:this}),this._fire("contentWheel",{evt:t})},_setPointerPosition:function(t){var e=this._getContentPosition(),i=null,n=null;if(void 0!==(t=t||window.event).touches){if(t.touches.length>0){var o=t.touches[0];i=o.clientX-e.left,n=o.clientY-e.top}}else i=t.clientX-e.left,n=t.clientY-e.top;null!==i&&null!==n&&(this.pointerPos={x:i,y:n})},_getContentPosition:function(){var t=this.content.getBoundingClientRect?this.content.getBoundingClientRect():{top:0,left:0};return{top:t.top,left:t.left}},_buildDOM:function(){if(this.bufferCanvas=new Konva.SceneCanvas,this.bufferHitCanvas=new Konva.HitCanvas({pixelRatio:1}),Konva.isBrowser){var t=this.getContainer();if(!t)throw"Stage has no container. A container is required.";t.innerHTML="",this.content=Konva.document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),t.appendChild(this.content),this._resizeDOM()}},_onContent:function(t,e){var i,n,o=t.split(" "),r=o.length;for(i=0;i<r;i++)n=o[i],this.content.addEventListener(n,e,!1)},cache:function(){Konva.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes.")},clearCache:function(){}}),Konva.Util.extend(Konva.Stage,Konva.Container),Konva.Factory.addGetter(Konva.Stage,"container"),Konva.Factory.addOverloadedGetterSetter(Konva.Stage,"container")}(),function(t){"use strict";t.BaseLayer=function(t){this.___init(t)},t.Util.addMethods(t.BaseLayer,{___init:function(e){this.nodeType="Layer",t.Container.call(this,e)},createPNGStream:function(){return this.canvas._canvas.createPNGStream()},getCanvas:function(){return this.canvas},getHitCanvas:function(){return this.hitCanvas},getContext:function(){return this.getCanvas().getContext()},clear:function(t){return this.getContext().clear(t),this},clearHitCache:function(){this._hitImageData=void 0},setZIndex:function(e){t.Node.prototype.setZIndex.call(this,e);var i=this.getStage();return i&&(i.content.removeChild(this.getCanvas()._canvas),e<i.getChildren().length-1?i.content.insertBefore(this.getCanvas()._canvas,i.getChildren()[e+1].getCanvas()._canvas):i.content.appendChild(this.getCanvas()._canvas)),this},moveToTop:function(){t.Node.prototype.moveToTop.call(this);var e=this.getStage();return e&&(e.content.removeChild(this.getCanvas()._canvas),e.content.appendChild(this.getCanvas()._canvas)),this},moveUp:function(){if(!t.Node.prototype.moveUp.call(this))return this;var e=this.getStage();return e?(e.content.removeChild(this.getCanvas()._canvas),this.index<e.getChildren().length-1?e.content.insertBefore(this.getCanvas()._canvas,e.getChildren()[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getCanvas()._canvas),this):this},moveDown:function(){if(t.Node.prototype.moveDown.call(this)){var e=this.getStage();if(e){var i=e.getChildren();e.content.removeChild(this.getCanvas()._canvas),e.content.insertBefore(this.getCanvas()._canvas,i[this.index+1].getCanvas()._canvas)}}return this},moveToBottom:function(){if(t.Node.prototype.moveToBottom.call(this)){var e=this.getStage();if(e){var i=e.getChildren();e.content.removeChild(this.getCanvas()._canvas),e.content.insertBefore(this.getCanvas()._canvas,i[1].getCanvas()._canvas)}}return this},getLayer:function(){return this},remove:function(){var e=this.getCanvas()._canvas;return t.Node.prototype.remove.call(this),e&&e.parentNode&&t.Util._isInDocument(e)&&e.parentNode.removeChild(e),this},getStage:function(){return this.parent},setSize:function(t,e){return this.canvas.setSize(t,e),this},_toKonvaCanvas:function(e){return(e=e||{}).width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=void 0!==e.x?e.x:this.getX(),e.y=void 0!==e.y?e.y:this.getY(),t.Node.prototype._toKonvaCanvas.call(this,e)},getWidth:function(){if(this.parent)return this.parent.getWidth()},setWidth:function(){t.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')},getHeight:function(){if(this.parent)return this.parent.getHeight()},setHeight:function(){t.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')},_applyTransform:function(t,e,i){var n=t.getAbsoluteTransform(i).getMatrix();e.transform(n[0],n[1],n[2],n[3],n[4],n[5])}}),t.Util.extend(t.BaseLayer,t.Container),t.Factory.addGetterSetter(t.BaseLayer,"clearBeforeDraw",!0),t.Collection.mapMethods(t.BaseLayer)}(Konva),function(){"use strict";var t=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],e=t.length;Konva.Layer=function(t){this.____init(t)},Konva.Util.addMethods(Konva.Layer,{____init:function(t){this.nodeType="Layer",this.canvas=new Konva.SceneCanvas,this.hitCanvas=new Konva.HitCanvas({pixelRatio:1}),Konva.BaseLayer.call(this,t)},_setCanvasSize:function(t,e){this.canvas.setSize(t,e),this.hitCanvas.setSize(t,e)},_validateAdd:function(t){var e=t.getType();"Group"!==e&&"Shape"!==e&&Konva.Util.throw("You may only add groups and shapes to a layer.")},getIntersection:function(i,n){var o,r,s,a;if(!this.hitGraphEnabled()||!this.isVisible())return null;for(var l=1,u=!1;;){for(r=0;r<e;r++){if(s=t[r],(a=(o=this._getIntersection({x:i.x+s.x*l,y:i.y+s.y*l})).shape)&&n)return a.findAncestor(n,!0);if(a)return a;if(u=!!o.antialiased,!o.antialiased)break}if(!u)return null;l+=1}},_getImageData:function(t,e){var i=this.hitCanvas.width||1,n=this.hitCanvas.height||1,o=Math.round(e)*i+Math.round(t);return this._hitImageData||(this._hitImageData=this.hitCanvas.context.getImageData(0,0,i,n)),[this._hitImageData.data[4*o+0],this._hitImageData.data[4*o+1],this._hitImageData.data[4*o+2],this._hitImageData.data[4*o+3]]},_getIntersection:function(t){var e,i,n=this.hitCanvas.pixelRatio,o=this.hitCanvas.context.getImageData(Math.round(t.x*n),Math.round(t.y*n),1,1).data,r=o[3];return 255===r?(e=Konva.Util._rgbToHex(o[0],o[1],o[2]),(i=Konva.shapes["#"+e])?{shape:i}:{antialiased:!0}):r>0?{antialiased:!0}:{}},drawScene:function(t,e){var i=this.getLayer(),n=t||i&&i.getCanvas();return this._fire("beforeDraw",{node:this}),this.getClearBeforeDraw()&&n.getContext().clear(),Konva.Container.prototype.drawScene.call(this,n,e),this._fire("draw",{node:this}),this},drawHit:function(t,e){var i=this.getLayer(),n=t||i&&i.hitCanvas;return i&&i.getClearBeforeDraw()&&i.getHitCanvas().getContext().clear(),Konva.Container.prototype.drawHit.call(this,n,e),this.imageData=null,this},clear:function(t){return Konva.BaseLayer.prototype.clear.call(this,t),this.getHitCanvas().getContext().clear(t),this.imageData=null,this},setVisible:function(t){return Konva.Node.prototype.setVisible.call(this,t),t?(this.getCanvas()._canvas.style.display="block",this.hitCanvas._canvas.style.display="block"):(this.getCanvas()._canvas.style.display="none",this.hitCanvas._canvas.style.display="none"),this},enableHitGraph:function(){return this.setHitGraphEnabled(!0),this},disableHitGraph:function(){return this.setHitGraphEnabled(!1),this},setSize:function(t,e){return Konva.BaseLayer.prototype.setSize.call(this,t,e),this.hitCanvas.setSize(t,e),this}}),Konva.Util.extend(Konva.Layer,Konva.BaseLayer),Konva.Factory.addGetterSetter(Konva.Layer,"hitGraphEnabled",!0),Konva.Collection.mapMethods(Konva.Layer)}(),function(){"use strict";Konva.FastLayer=function(t){this.____init(t)},Konva.Util.addMethods(Konva.FastLayer,{____init:function(t){this.nodeType="Layer",this.canvas=new Konva.SceneCanvas,Konva.BaseLayer.call(this,t)},_validateAdd:function(t){"Shape"!==t.getType()&&Konva.Util.throw("You may only add shapes to a fast layer.")},_setCanvasSize:function(t,e){this.canvas.setSize(t,e)},hitGraphEnabled:function(){return!1},getIntersection:function(){return null},drawScene:function(t){var e=this.getLayer(),i=t||e&&e.getCanvas();return this.getClearBeforeDraw()&&i.getContext().clear(),Konva.Container.prototype.drawScene.call(this,i),this},draw:function(){return this.drawScene(),this},setVisible:function(t){return Konva.Node.prototype.setVisible.call(this,t),this.getCanvas()._canvas.style.display=t?"block":"none",this}}),Konva.Util.extend(Konva.FastLayer,Konva.BaseLayer),Konva.Collection.mapMethods(Konva.FastLayer)}(),function(){"use strict";Konva.Group=function(t){this.___init(t)},Konva.Util.addMethods(Konva.Group,{___init:function(t){this.nodeType="Group",Konva.Container.call(this,t)},_validateAdd:function(t){var e=t.getType();"Group"!==e&&"Shape"!==e&&Konva.Util.throw("You may only add groups and shapes to groups.")}}),Konva.Util.extend(Konva.Group,Konva.Container),Konva.Collection.mapMethods(Konva.Group)}(),function(t){"use strict";var e=t.global.performance&&t.global.performance.now?function(){return t.global.performance.now()}:function(){return(new Date).getTime()};function i(t){setTimeout(t,1e3/60)}var n=t.global.requestAnimationFrame||t.global.webkitRequestAnimationFrame||t.global.mozRequestAnimationFrame||t.global.oRequestAnimationFrame||t.global.msRequestAnimationFrame||i;function o(){return n.apply(t.global,arguments)}t.Animation=function(i,n){var o=t.Animation;this.func=i,this.setLayers(n),this.id=o.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:e()}},t.Animation.prototype={setLayers:function(t){var e=[];return e=t?t.length>0?t:[t]:[],this.layers=e,this},getLayers:function(){return this.layers},addLayer:function(t){var e,i=this.layers,n=i.length;for(e=0;e<n;e++)if(i[e]._id===t._id)return!1;return this.layers.push(t),!0},isRunning:function(){var e,i=t.Animation.animations,n=i.length;for(e=0;e<n;e++)if(i[e].id===this.id)return!0;return!1},start:function(){var i=t.Animation;return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=e(),i._addAnimation(this),this},stop:function(){return t.Animation._removeAnimation(this),this},_updateFrameObject:function(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}},t.Animation.animations=[],t.Animation.animIdCounter=0,t.Animation.animRunning=!1,t.Animation._addAnimation=function(t){this.animations.push(t),this._handleAnimation()},t.Animation._removeAnimation=function(t){var e,i=t.id,n=this.animations,o=n.length;for(e=0;e<o;e++)if(n[e].id===i){this.animations.splice(e,1);break}},t.Animation._runFrames=function(){var t,i,n,o,r,s,a,l,u={},h=this.animations;for(o=0;o<h.length;o++)if(i=(t=h[o]).layers,n=t.func,t._updateFrameObject(e()),s=i.length,!n||!1!==n.call(t,t.frame))for(r=0;r<s;r++)void 0!==(a=i[r])._id&&(u[a._id]=a);for(l in u)u.hasOwnProperty(l)&&u[l].draw()},t.Animation._animationLoop=function(){var e=t.Animation;e.animations.length?(e._runFrames(),o(e._animationLoop)):e.animRunning=!1},t.Animation._handleAnimation=function(){this.animRunning||(this.animRunning=!0,o(this._animationLoop))},t.BaseLayer.prototype.batchDraw=function(){var e=this,i=t.Animation;return this.batchAnim||(this.batchAnim=new i(function(){e.batchAnim.stop()},this)),this.batchAnim.isRunning()||this.batchAnim.start(),this},t.Stage.prototype.batchDraw=function(){return this.getChildren().each(function(t){t.batchDraw()}),this}}(Konva),function(){"use strict";var t={node:1,duration:1,easing:1,onFinish:1,yoyo:1},e=0,i=["fill","stroke","shadowColor"],n=function(t,e,i,n,o,r,s){this.prop=t,this.propFunc=e,this.begin=n,this._pos=n,this.duration=r,this._change=0,this.prevPos=0,this.yoyo=s,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=i,this._change=o-this.begin,this.pause()};n.prototype={fire:function(t){var e=this[t];e&&e()},setTime:function(t){t>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():t<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=t,this.update())},getTime:function(){return this._time},setPosition:function(t){this.prevPos=this._pos,this.propFunc(t),this._pos=t},getPosition:function(t){return void 0===t&&(t=this._time),this.func(t,this.begin,this._change,this.duration)},play:function(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")},reverse:function(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")},seek:function(t){this.pause(),this._time=t,this.update(),this.fire("onSeek")},reset:function(){this.pause(),this._time=0,this.update(),this.fire("onReset")},finish:function(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")},update:function(){this.setPosition(this.getPosition(this._time))},onEnterFrame:function(){var t=this.getTimer()-this._startTime;2===this.state?this.setTime(t):3===this.state&&this.setTime(this.duration-t)},pause:function(){this.state=1,this.fire("onPause")},getTimer:function(){return(new Date).getTime()}},Konva.Tween=function(i){var o,r,s=this,a=i.node,l=a._id,u=i.easing||Konva.Easings.Linear,h=!!i.yoyo;o="undefined"===typeof i.duration?.3:0===i.duration?.001:i.duration,this.node=a,this._id=e++;var c=a.getLayer()||(a instanceof Konva.Stage?a.getLayers():null);for(r in c||Konva.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new Konva.Animation(function(){s.tween.onEnterFrame()},c),this.tween=new n(r,function(t){s._tweenFunc(t)},u,0,1,1e3*o,h),this._addListeners(),Konva.Tween.attrs[l]||(Konva.Tween.attrs[l]={}),Konva.Tween.attrs[l][this._id]||(Konva.Tween.attrs[l][this._id]={}),Konva.Tween.tweens[l]||(Konva.Tween.tweens[l]={}),i)void 0===t[r]&&this._addAttr(r,i[r]);this.reset(),this.onFinish=i.onFinish,this.onReset=i.onReset},Konva.Tween.attrs={},Konva.Tween.tweens={},Konva.Tween.prototype={_addAttr:function(t,e){var n,o,r,s,a,l,u,h,c=this.node,d=c._id;if((r=Konva.Tween.tweens[d][t])&&delete Konva.Tween.attrs[d][r][t],n=c.getAttr(t),Konva.Util._isArray(e))if(o=[],a=Math.max(e.length,n.length),"points"===t&&e.length!==n.length&&(e.length>n.length?(u=n,n=Konva.Util._prepareArrayForTween(n,e,c.closed())):(l=e,e=Konva.Util._prepareArrayForTween(e,n,c.closed()))),0===t.indexOf("fill"))for(s=0;s<a;s++)if(s%2===0)o.push(e[s]-n[s]);else{var p=Konva.Util.colorToRGBA(n[s]);h=Konva.Util.colorToRGBA(e[s]),n[s]=p,o.push({r:h.r-p.r,g:h.g-p.g,b:h.b-p.b,a:h.a-p.a})}else for(s=0;s<a;s++)o.push(e[s]-n[s]);else-1!==i.indexOf(t)?(n=Konva.Util.colorToRGBA(n),o={r:(h=Konva.Util.colorToRGBA(e)).r-n.r,g:h.g-n.g,b:h.b-n.b,a:h.a-n.a}):o=e-n;Konva.Tween.attrs[d][this._id][t]={start:n,diff:o,end:e,trueEnd:l,trueStart:u},Konva.Tween.tweens[d][t]=this._id},_tweenFunc:function(t){var e,n,o,r,s,a,l,u,h=this.node,c=Konva.Tween.attrs[h._id][this._id];for(e in c){if(o=(n=c[e]).start,r=n.diff,u=n.end,Konva.Util._isArray(o))if(s=[],l=Math.max(o.length,u.length),0===e.indexOf("fill"))for(a=0;a<l;a++)a%2===0?s.push((o[a]||0)+r[a]*t):s.push("rgba("+Math.round(o[a].r+r[a].r*t)+","+Math.round(o[a].g+r[a].g*t)+","+Math.round(o[a].b+r[a].b*t)+","+(o[a].a+r[a].a*t)+")");else for(a=0;a<l;a++)s.push((o[a]||0)+r[a]*t);else s=-1!==i.indexOf(e)?"rgba("+Math.round(o.r+r.r*t)+","+Math.round(o.g+r.g*t)+","+Math.round(o.b+r.b*t)+","+(o.a+r.a*t)+")":o+r*t;h.setAttr(e,s)}},_addListeners:function(){var t=this;this.tween.onPlay=function(){t.anim.start()},this.tween.onReverse=function(){t.anim.start()},this.tween.onPause=function(){t.anim.stop()},this.tween.onFinish=function(){var e=t.node,i=Konva.Tween.attrs[e._id][t._id];i.points&&i.points.trueEnd&&e.points(i.points.trueEnd),t.onFinish&&t.onFinish.call(t)},this.tween.onReset=function(){var e=t.node,i=Konva.Tween.attrs[e._id][t._id];i.points&&i.points.trueStart&&e.points(i.points.trueStart),t.onReset&&t.onReset()}},play:function(){return this.tween.play(),this},reverse:function(){return this.tween.reverse(),this},reset:function(){return this.tween.reset(),this},seek:function(t){return this.tween.seek(1e3*t),this},pause:function(){return this.tween.pause(),this},finish:function(){return this.tween.finish(),this},destroy:function(){var t,e=this.node._id,i=this._id,n=Konva.Tween.tweens[e];for(t in this.pause(),n)delete Konva.Tween.tweens[e][t];delete Konva.Tween.attrs[e][i]}},Konva.Node.prototype.to=function(t){var e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()},new Konva.Tween(t).play()},Konva.Easings={BackEaseIn:function(t,e,i,n){var o=1.70158;return i*(t/=n)*t*((o+1)*t-o)+e},BackEaseOut:function(t,e,i,n){var o=1.70158;return i*((t=t/n-1)*t*((o+1)*t+o)+1)+e},BackEaseInOut:function(t,e,i,n){var o=1.70158;return(t/=n/2)<1?i/2*(t*t*((1+(o*=1.525))*t-o))+e:i/2*((t-=2)*t*((1+(o*=1.525))*t+o)+2)+e},ElasticEaseIn:function(t,e,i,n,o,r){var s=0;return 0===t?e:1===(t/=n)?e+i:(r||(r=.3*n),!o||o<Math.abs(i)?(o=i,s=r/4):s=r/(2*Math.PI)*Math.asin(i/o),-o*Math.pow(2,10*(t-=1))*Math.sin((t*n-s)*(2*Math.PI)/r)+e)},ElasticEaseOut:function(t,e,i,n,o,r){var s=0;return 0===t?e:1===(t/=n)?e+i:(r||(r=.3*n),!o||o<Math.abs(i)?(o=i,s=r/4):s=r/(2*Math.PI)*Math.asin(i/o),o*Math.pow(2,-10*t)*Math.sin((t*n-s)*(2*Math.PI)/r)+i+e)},ElasticEaseInOut:function(t,e,i,n,o,r){var s=0;return 0===t?e:2===(t/=n/2)?e+i:(r||(r=n*(.3*1.5)),!o||o<Math.abs(i)?(o=i,s=r/4):s=r/(2*Math.PI)*Math.asin(i/o),t<1?o*Math.pow(2,10*(t-=1))*Math.sin((t*n-s)*(2*Math.PI)/r)*-.5+e:o*Math.pow(2,-10*(t-=1))*Math.sin((t*n-s)*(2*Math.PI)/r)*.5+i+e)},BounceEaseOut:function(t,e,i,n){return(t/=n)<1/2.75?i*(7.5625*t*t)+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e},BounceEaseIn:function(t,e,i,n){return i-Konva.Easings.BounceEaseOut(n-t,0,i,n)+e},BounceEaseInOut:function(t,e,i,n){return t<n/2?.5*Konva.Easings.BounceEaseIn(2*t,0,i,n)+e:.5*Konva.Easings.BounceEaseOut(2*t-n,0,i,n)+.5*i+e},EaseIn:function(t,e,i,n){return i*(t/=n)*t+e},EaseOut:function(t,e,i,n){return-i*(t/=n)*(t-2)+e},EaseInOut:function(t,e,i,n){return(t/=n/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},StrongEaseIn:function(t,e,i,n){return i*(t/=n)*t*t*t*t+e},StrongEaseOut:function(t,e,i,n){return i*((t=t/n-1)*t*t*t*t+1)+e},StrongEaseInOut:function(t,e,i,n){return(t/=n/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e},Linear:function(t,e,i,n){return i*t/n+e}}}(),function(){"use strict";Konva.DD={anim:new Konva.Animation(function(){var t=this.dirty;return this.dirty=!1,t}),isDragging:!1,justDragged:!1,offset:{x:0,y:0},node:null,_drag:function(t){var e=Konva.DD,i=e.node;if(i){if(!e.isDragging){var n=i.getStage().getPointerPosition();n||(i.getStage()._setPointerPosition(t),n=i.getStage().getPointerPosition());var o=i.dragDistance();if(Math.max(Math.abs(n.x-e.startPointerPos.x),Math.abs(n.y-e.startPointerPos.y))<o)return}i.getStage()._setPointerPosition(t),i._setDragPosition(t),e.isDragging||(e.isDragging=!0,i.fire("dragstart",{type:"dragstart",target:i,evt:t},!0)),i.fire("dragmove",{type:"dragmove",target:i,evt:t},!0)}},_endDragBefore:function(t){var e,i=Konva.DD,n=i.node;n&&(e=n.getLayer(),i.anim.stop(),i.isDragging&&(i.isDragging=!1,i.justDragged=!0,Konva.listenClickTap=!1,t&&(t.dragEndNode=n)),delete i.node,(n.getLayer()||e||n instanceof Konva.Stage)&&(e||n).draw())},_endDragAfter:function(t){var e=(t=t||{}).dragEndNode;t&&e&&e.fire("dragend",{type:"dragend",target:e,evt:t},!0)}},Konva.Node.prototype.startDrag=function(){var t=Konva.DD,e=this.getStage(),i=this.getLayer(),n=e.getPointerPosition(),o=this.getAbsolutePosition();n&&(t.node&&t.node.stopDrag(),t.node=this,t.startPointerPos=n,t.offset.x=n.x-o.x,t.offset.y=n.y-o.y,t.anim.setLayers(i||this.getLayers()),t.anim.start(),this._setDragPosition())},Konva.Node.prototype._setDragPosition=function(t){var e=Konva.DD,i=this.getStage().getPointerPosition(),n=this.getDragBoundFunc();if(i){var o={x:i.x-e.offset.x,y:i.y-e.offset.y};void 0!==n&&(o=n.call(this,o,t)),this.setAbsolutePosition(o),this._lastPos&&this._lastPos.x===o.x&&this._lastPos.y===o.y||(e.anim.dirty=!0),this._lastPos=o}},Konva.Node.prototype.stopDrag=function(){var t=Konva.DD,e={};t._endDragBefore(e),t._endDragAfter(e)},Konva.Node.prototype.setDraggable=function(t){this._setAttr("draggable",t),this._dragChange()};var t=Konva.Node.prototype.remove;Konva.Node.prototype.__originalRemove=t,Konva.Node.prototype.remove=function(){var e=Konva.DD;e.node&&e.node._id===this._id&&this.stopDrag(),t.call(this)},Konva.Node.prototype.isDragging=function(){var t=Konva.DD;return!(!t.node||t.node._id!==this._id||!t.isDragging)},Konva.Node.prototype._listenDrag=function(){var t=this;this._dragCleanup(),"Stage"===this.getClassName()?this.on("contentMousedown.konva contentTouchstart.konva",function(e){Konva.DD.node||t.startDrag(e)}):this.on("mousedown.konva touchstart.konva",function(e){1!==e.evt.button&&2!==e.evt.button&&(Konva.DD.node||t.startDrag(e))})},Konva.Node.prototype._dragChange=function(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage(),e=Konva.DD;t&&e.node&&e.node._id===this._id&&e.node.stopDrag()}},Konva.Node.prototype._dragCleanup=function(){"Stage"===this.getClassName()?(this.off("contentMousedown.konva"),this.off("contentTouchstart.konva")):(this.off("mousedown.konva"),this.off("touchstart.konva"))},Konva.Factory.addGetterSetter(Konva.Node,"dragBoundFunc"),Konva.Factory.addGetter(Konva.Node,"draggable",!1),Konva.Factory.addOverloadedGetterSetter(Konva.Node,"draggable"),Konva.isBrowser&&(window.addEventListener("mouseup",Konva.DD._endDragBefore,!0),window.addEventListener("touchend",Konva.DD._endDragBefore,!0),window.addEventListener("mousemove",Konva.DD._drag),window.addEventListener("touchmove",Konva.DD._drag),window.addEventListener("mouseup",Konva.DD._endDragAfter,!1),window.addEventListener("touchend",Konva.DD._endDragAfter,!1))}(),function(){"use strict";Konva.Rect=function(t){this.___init(t)},Konva.Rect.prototype={___init:function(t){Konva.Shape.call(this,t),this.className="Rect",this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){var e=this.getCornerRadius(),i=this.getWidth(),n=this.getHeight();t.beginPath(),e?(e=Math.min(e,i/2,n/2),t.moveTo(e,0),t.lineTo(i-e,0),t.arc(i-e,e,e,3*Math.PI/2,0,!1),t.lineTo(i,n-e),t.arc(i-e,n-e,e,0,Math.PI/2,!1),t.lineTo(e,n),t.arc(e,n-e,e,Math.PI/2,Math.PI,!1),t.lineTo(0,e),t.arc(e,e,e,Math.PI,3*Math.PI/2,!1)):t.rect(0,0,i,n),t.closePath(),t.fillStrokeShape(this)}},Konva.Util.extend(Konva.Rect,Konva.Shape),Konva.Factory.addGetterSetter(Konva.Rect,"cornerRadius",0,Konva.Validators.getNumberValidator()),Konva.Collection.mapMethods(Konva.Rect)}(),function(t){"use strict";var e=2*Math.PI-1e-4;t.Circle=function(t){this.___init(t)},t.Circle.prototype={_centroid:!0,___init:function(e){t.Shape.call(this,e),this.className="Circle",this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){t.beginPath(),t.arc(0,0,this.getRadius(),0,e,!1),t.closePath(),t.fillStrokeShape(this)},getWidth:function(){return 2*this.getRadius()},getHeight:function(){return 2*this.getRadius()},setWidth:function(e){t.Node.prototype.setWidth.call(this,e),this.radius()!==e/2&&this.setRadius(e/2)},setHeight:function(e){t.Node.prototype.setHeight.call(this,e),this.radius()!==e/2&&this.setRadius(e/2)}},t.Util.extend(t.Circle,t.Shape),t.Factory.addGetterSetter(t.Circle,"radius",0,t.Validators.getNumberValidator()),t.Factory.addOverloadedGetterSetter(t.Circle,"radius"),t.Collection.mapMethods(t.Circle)}(Konva),function(){"use strict";var t=2*Math.PI-1e-4;Konva.Ellipse=function(t){this.___init(t)},Konva.Ellipse.prototype={_centroid:!0,___init:function(t){Konva.Shape.call(this,t),this.className="Ellipse",this.sceneFunc(this._sceneFunc)},_sceneFunc:function(e){var i=this.getRadiusX(),n=this.getRadiusY();e.beginPath(),e.save(),i!==n&&e.scale(1,n/i),e.arc(0,0,i,0,t,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)},getWidth:function(){return 2*this.getRadiusX()},getHeight:function(){return 2*this.getRadiusY()},setWidth:function(t){Konva.Node.prototype.setWidth.call(this,t),this.setRadius({x:t/2})},setHeight:function(t){Konva.Node.prototype.setHeight.call(this,t),this.setRadius({y:t/2})}},Konva.Util.extend(Konva.Ellipse,Konva.Shape),Konva.Factory.addComponentsGetterSetter(Konva.Ellipse,"radius",["x","y"]),Konva.Factory.addGetterSetter(Konva.Ellipse,"radiusX",0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Ellipse,"radiusY",0,Konva.Validators.getNumberValidator()),Konva.Collection.mapMethods(Konva.Ellipse)}(),function(){"use strict";var t=2*Math.PI-1e-4;Konva.Ring=function(t){this.___init(t)},Konva.Ring.prototype={_centroid:!0,___init:function(t){Konva.Shape.call(this,t),this.className="Ring",this.sceneFunc(this._sceneFunc)},_sceneFunc:function(e){e.beginPath(),e.arc(0,0,this.getInnerRadius(),0,t,!1),e.moveTo(this.getOuterRadius(),0),e.arc(0,0,this.getOuterRadius(),t,0,!0),e.closePath(),e.fillStrokeShape(this)},getWidth:function(){return 2*this.getOuterRadius()},getHeight:function(){return 2*this.getOuterRadius()},setWidth:function(t){Konva.Node.prototype.setWidth.call(this,t),this.outerRadius()!==t/2&&this.setOuterRadius(t/2)},setHeight:function(t){Konva.Node.prototype.setHeight.call(this,t),this.outerRadius()!==t/2&&this.setOuterRadius(t/2)},setOuterRadius:function(t){this._setAttr("outerRadius",t),this.setWidth(2*t),this.setHeight(2*t)}},Konva.Util.extend(Konva.Ring,Konva.Shape),Konva.Factory.addGetterSetter(Konva.Ring,"innerRadius",0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetter(Konva.Ring,"outerRadius",0,Konva.Validators.getNumberValidator()),Konva.Factory.addOverloadedGetterSetter(Konva.Ring,"outerRadius"),Konva.Collection.mapMethods(Konva.Ring)}(),function(){"use strict";Konva.Wedge=function(t){this.___init(t)},Konva.Wedge.prototype={_centroid:!0,___init:function(t){Konva.Shape.call(this,t),this.className="Wedge",this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){t.beginPath(),t.arc(0,0,this.getRadius(),0,Konva.getAngle(this.getAngle()),this.getClockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)},getWidth:function(){return 2*this.getRadius()},getHeight:function(){return 2*this.getRadius()},setWidth:function(t){Konva.Node.prototype.setWidth.call(this,t),this.radius()!==t/2&&this.setRadius(t/2)},setHeight:function(t){Konva.Node.prototype.setHeight.call(this,t),this.radius()!==t/2&&this.setRadius(t/2)}},Konva.Util.extend(Konva.Wedge,Konva.Shape),Konva.Factory.addGetterSetter(Konva.Wedge,"radius",0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Wedge,"angle",0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Wedge,"clockwise",!1),Konva.Factory.backCompat(Konva.Wedge,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"}),Konva.Collection.mapMethods(Konva.Wedge)}(),function(t){"use strict";t.Arc=function(t){this.___init(t)},t.Arc.prototype={_centroid:!0,___init:function(e){t.Shape.call(this,e),this.className="Arc",this.sceneFunc(this._sceneFunc)},_sceneFunc:function(e){var i=t.getAngle(this.angle()),n=this.clockwise();e.beginPath(),e.arc(0,0,this.getOuterRadius(),0,i,n),e.arc(0,0,this.getInnerRadius(),i,0,!n),e.closePath(),e.fillStrokeShape(this)},getWidth:function(){return 2*this.getOuterRadius()},getHeight:function(){return 2*this.getOuterRadius()},setWidth:function(e){t.Node.prototype.setWidth.call(this,e),this.getOuterRadius()!==e/2&&this.setOuterRadius(e/2)},setHeight:function(e){t.Node.prototype.setHeight.call(this,e),this.getOuterRadius()!==e/2&&this.setOuterRadius(e/2)}},t.Util.extend(t.Arc,t.Shape),t.Factory.addGetterSetter(t.Arc,"innerRadius",0,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Arc,"outerRadius",0,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Arc,"angle",0,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Arc,"clockwise",!1),t.Collection.mapMethods(t.Arc)}(Konva),function(){"use strict";Konva.Image=function(t){this.___init(t)},Konva.Image.prototype={___init:function(t){Konva.Shape.call(this,t),this.className="Image",this.sceneFunc(this._sceneFunc),this.hitFunc(this._hitFunc)},_useBufferCanvas:function(){return(this.hasShadow()||1!==this.getAbsoluteOpacity())&&this.hasStroke()&&this.getStage()},_sceneFunc:function(t){var e,i,n,o=this.getWidth(),r=this.getHeight(),s=this.getImage();s&&(e=this.getCropWidth(),i=this.getCropHeight(),n=e&&i?[s,this.getCropX(),this.getCropY(),e,i,0,0,o,r]:[s,0,0,o,r]),(this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,o,r),t.closePath(),t.fillStrokeShape(this)),s&&t.drawImage.apply(t,n)},_hitFunc:function(t){var e=this.getWidth(),i=this.getHeight();t.beginPath(),t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)},getWidth:function(){var t=this.getImage();return this.attrs.width||(t?t.width:0)},getHeight:function(){var t=this.getImage();return this.attrs.height||(t?t.height:0)}},Konva.Util.extend(Konva.Image,Konva.Shape),Konva.Factory.addGetterSetter(Konva.Image,"image"),Konva.Factory.addComponentsGetterSetter(Konva.Image,"crop",["x","y","width","height"]),Konva.Factory.addGetterSetter(Konva.Image,"cropX",0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Image,"cropY",0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Image,"cropWidth",0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Image,"cropHeight",0,Konva.Validators.getNumberValidator()),Konva.Collection.mapMethods(Konva.Image),Konva.Image.fromURL=function(t,e){var i=new Image;i.onload=function(){var t=new Konva.Image({image:i});e(t)},i.crossOrigin="Anonymous",i.src=t}}(),function(){"use strict";var t,e="2d",i=["fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],n=i.length;function o(){return t||(t=Konva.Util.createCanvasElement().getContext(e))}function r(t){t.fillText(this.partialText,0,0)}function s(t){t.strokeText(this.partialText,0,0)}Konva.Text=function(t){this.___init(t)},Konva.Text.prototype={___init:function(t){(t=t||{}).fillLinearGradientColorStops||t.fillRadialGradientColorStops||(t.fill=t.fill||"black"),Konva.Shape.call(this,t),this._fillFunc=r,this._strokeFunc=s,this.className="Text";for(var e=0;e<n;e++)this.on(i[e]+"Change.konva",this._setTextData);this._setTextData(),this.sceneFunc(this._sceneFunc),this.hitFunc(this._hitFunc)},_sceneFunc:function(t){var e,i=this.getPadding(),n=this.getTextHeight(),o=this.getLineHeight()*n,r=this.textArr,s=r.length,a=this.getVerticalAlign(),l=0,u=this.getAlign(),h=this.getWidth(),c=this.getLetterSpacing(),d=this.textDecoration(),p=this.fill(),f=this.fontSize();for(t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline","middle"),t.setAttr("textAlign","left"),"middle"===a?l=(this.getHeight()-s*o-2*i)/2:"bottom"===a&&(l=this.getHeight()-s*o-2*i),i?(t.translate(i,0),t.translate(0,l+i+o/2)):t.translate(0,l+o/2),e=0;e<s;e++){var m,y,v,g=r[e],_=g.text,b=g.width,S=e!==s-1;if(t.save(),"right"===u?t.translate(h-b-2*i,0):"center"===u&&t.translate((h-b-2*i)/2,0),-1!==d.indexOf("underline")&&(t.save(),t.beginPath(),t.moveTo(0,Math.round(o/2)),y=0===(m=_.split(" ").length-1),v="justify"===u&&S&&!y?h-2*i:b,t.lineTo(Math.round(v),Math.round(o/2)),t.lineWidth=f/15,t.strokeStyle=p,t.stroke(),t.restore()),-1!==d.indexOf("line-through")&&(t.save(),t.beginPath(),t.moveTo(0,0),y=0===(m=_.split(" ").length-1),v="justify"===u&&S&&!y?h-2*i:b,t.lineTo(Math.round(v),0),t.lineWidth=f/15,t.strokeStyle=p,t.stroke(),t.restore()),0!==c||"justify"===u){m=_.split(" ").length-1;for(var T=0;T<_.length;T++){var w=_[T];" "===w&&e!==s-1&&"justify"===u&&t.translate(Math.floor((h-2*i-b)/m),0),this.partialText=w,t.fillStrokeShape(this),t.translate(Math.round(this._getTextSize(w).width)+c,0)}}else this.partialText=_,t.fillStrokeShape(this);t.restore(),s>1&&t.translate(0,o)}},_hitFunc:function(t){var e=this.getWidth(),i=this.getHeight();t.beginPath(),t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)},setText:function(t){var e=Konva.Util._isString(t)?t:(t||"").toString();return this._setAttr("text",e),this},getWidth:function(){return"auto"===this.attrs.width||void 0===this.attrs.width?this.getTextWidth()+2*this.getPadding():this.attrs.width},getHeight:function(){return"auto"===this.attrs.height||void 0===this.attrs.height?this.getTextHeight()*this.textArr.length*this.getLineHeight()+2*this.getPadding():this.attrs.height},getTextWidth:function(){return this.textWidth},getTextHeight:function(){return this.textHeight},_getTextSize:function(t){var e,i=o(),n=this.getFontSize();return i.save(),i.font=this._getContextFont(),e=i.measureText(t),i.restore(),{width:e.width,height:parseInt(n,10)}},_getContextFont:function(){return Konva.UA.isIE?this.getFontStyle()+" "+this.getFontSize()+"px "+this.getFontFamily():this.getFontStyle()+" "+this.getFontVariant()+" "+this.getFontSize()+"px "+this.getFontFamily()},_addTextLine:function(t){"justify"===this.align()&&(t=t.trim());var e=this._getTextWidth(t);return this.textArr.push({text:t,width:e})},_getTextWidth:function(t){var e=this.getLetterSpacing(),i=t.length;return o().measureText(t).width+(i?e*(i-1):0)},_setTextData:function(){var t=this.getText().split("\n"),e=+this.getFontSize(),i=0,n=this.getLineHeight()*e,r=this.attrs.width,s=this.attrs.height,a="auto"!==r,l="auto"!==s,u=this.getPadding(),h=r-2*u,c=s-2*u,d=0,p=this.getWrap(),f="none"!==p,m="char"!==p&&f,y=this.getEllipsis()&&!f;this.textArr=[],o().font=this._getContextFont();for(var v=0,g=t.length;v<g;++v){var _=t[v],b=y?this._getTextWidth("\u2026"):0,S=this._getTextWidth(_);if(a&&S>h)for(;_.length>0;){for(var T=0,w=_.length,P="",x=0;T<w;){var k=T+w>>>1,A=_.slice(0,k+1),M=this._getTextWidth(A)+b;M<=h?(T=k+1,P=A+(y?"\u2026":""),x=M):w=k}if(!P)break;if(m){var C,O=_[P.length];(C=(" "===O||"-"===O)&&x<=h?P.length:Math.max(P.lastIndexOf(" "),P.lastIndexOf("-"))+1)>0&&(T=C,P=P.slice(0,T),x=this._getTextWidth(P))}if(this._addTextLine(P),i=Math.max(i,x),d+=n,!f||l&&d+n>c)break;if((_=_.slice(T)).length>0&&(S=this._getTextWidth(_))<=h){this._addTextLine(_),d+=n,i=Math.max(i,S);break}}else this._addTextLine(_),d+=n,i=Math.max(i,S);if(l&&d+n>c)break}this.textHeight=e,this.textWidth=i}},Konva.Util.extend(Konva.Text,Konva.Shape),Konva.Factory.addSetter(Konva.Node,"width",Konva.Validators.getNumberOrAutoValidator()),Konva.Factory.addSetter(Konva.Node,"height",Konva.Validators.getNumberOrAutoValidator()),Konva.Factory.addGetterSetter(Konva.Text,"fontFamily","Arial"),Konva.Factory.addGetterSetter(Konva.Text,"fontSize",12,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Text,"fontStyle","normal"),Konva.Factory.addGetterSetter(Konva.Text,"fontVariant","normal"),Konva.Factory.addGetterSetter(Konva.Text,"padding",0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Text,"align","left"),Konva.Factory.addGetterSetter(Konva.Text,"verticalAlign","top"),Konva.Factory.addGetterSetter(Konva.Text,"lineHeight",1,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Text,"wrap","word"),Konva.Factory.addGetterSetter(Konva.Text,"ellipsis",!1),Konva.Factory.addGetterSetter(Konva.Text,"letterSpacing",0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetter(Konva.Text,"text",""),Konva.Factory.addOverloadedGetterSetter(Konva.Text,"text"),Konva.Factory.addGetterSetter(Konva.Text,"textDecoration",""),Konva.Collection.mapMethods(Konva.Text)}(),function(){"use strict";Konva.Line=function(t){this.___init(t)},Konva.Line.prototype={___init:function(t){Konva.Shape.call(this,t),this.className="Line",this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")}),this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){var e,i,n,o=this.getPoints(),r=o.length,s=this.getTension(),a=this.getClosed(),l=this.getBezier();if(r){if(t.beginPath(),t.moveTo(o[0],o[1]),0!==s&&r>4){for(i=(e=this.getTensionPoints()).length,n=a?0:4,a||t.quadraticCurveTo(e[0],e[1],e[2],e[3]);n<i-2;)t.bezierCurveTo(e[n++],e[n++],e[n++],e[n++],e[n++],e[n++]);a||t.quadraticCurveTo(e[i-2],e[i-1],o[r-2],o[r-1])}else if(l)for(n=2;n<r;)t.bezierCurveTo(o[n++],o[n++],o[n++],o[n++],o[n++],o[n++]);else for(n=2;n<r;n+=2)t.lineTo(o[n],o[n+1]);a?(t.closePath(),t.fillStrokeShape(this)):t.strokeShape(this)}},getTensionPoints:function(){return this._getCache("tensionPoints",this._getTensionPoints)},_getTensionPoints:function(){return this.getClosed()?this._getTensionPointsClosed():Konva.Util._expandPoints(this.getPoints(),this.getTension())},_getTensionPointsClosed:function(){var t=this.getPoints(),e=t.length,i=this.getTension(),n=Konva.Util,o=n._getControlPoints(t[e-2],t[e-1],t[0],t[1],t[2],t[3],i),r=n._getControlPoints(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],i),s=Konva.Util._expandPoints(t,i);return[o[2],o[3]].concat(s).concat([r[0],r[1],t[e-2],t[e-1],r[2],r[3],o[0],o[1],t[0],t[1]])},getWidth:function(){return this.getSelfRect().width},getHeight:function(){return this.getSelfRect().height},getSelfRect:function(){for(var t,e,i,n=(t=0!==this.getTension()?this._getTensionPoints():this.getPoints())[0],o=t[0],r=t[1],s=t[1],a=0;a<t.length/2;a++)e=t[2*a],i=t[2*a+1],n=Math.min(n,e),o=Math.max(o,e),r=Math.min(r,i),s=Math.max(s,i);return{x:Math.round(n),y:Math.round(r),width:Math.round(o-n),height:Math.round(s-r)}}},Konva.Util.extend(Konva.Line,Konva.Shape),Konva.Factory.addGetterSetter(Konva.Line,"closed",!1),Konva.Factory.addGetterSetter(Konva.Line,"bezier",!1),Konva.Factory.addGetterSetter(Konva.Line,"tension",0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Line,"points",[],Konva.Validators.getNumberArrayValidator()),Konva.Collection.mapMethods(Konva.Line)}(),function(){"use strict";Konva.Sprite=function(t){this.___init(t)},Konva.Sprite.prototype={___init:function(t){Konva.Shape.call(this,t),this.className="Sprite",this._updated=!0;var e=this;this.anim=new Konva.Animation(function(){var t=e._updated;return e._updated=!1,t}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())}),this.sceneFunc(this._sceneFunc),this.hitFunc(this._hitFunc)},_sceneFunc:function(t){var e=this.getAnimation(),i=this.frameIndex(),n=4*i,o=this.getAnimations()[e],r=this.frameOffsets(),s=o[n+0],a=o[n+1],l=o[n+2],u=o[n+3],h=this.getImage();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,l,u),t.closePath(),t.fillStrokeShape(this)),h)if(r){var c=r[e],d=2*i;t.drawImage(h,s,a,l,u,c[d+0],c[d+1],l,u)}else t.drawImage(h,s,a,l,u,0,0,l,u)},_hitFunc:function(t){var e=this.getAnimation(),i=this.frameIndex(),n=4*i,o=this.getAnimations()[e],r=this.frameOffsets(),s=o[n+2],a=o[n+3];if(t.beginPath(),r){var l=r[e],u=2*i;t.rect(l[u+0],l[u+1],s,a)}else t.rect(0,0,s,a);t.closePath(),t.fillShape(this)},_useBufferCanvas:function(){return(this.hasShadow()||1!==this.getAbsoluteOpacity())&&this.hasStroke()},_setInterval:function(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.getFrameRate())},start:function(){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()},stop:function(){this.anim.stop(),clearInterval(this.interval)},isRunning:function(){return this.anim.isRunning()},_updateIndex:function(){var t=this.frameIndex(),e=this.getAnimation();t<this.getAnimations()[e].length/4-1?this.frameIndex(t+1):this.frameIndex(0)}},Konva.Util.extend(Konva.Sprite,Konva.Shape),Konva.Factory.addGetterSetter(Konva.Sprite,"animation"),Konva.Factory.addGetterSetter(Konva.Sprite,"animations"),Konva.Factory.addGetterSetter(Konva.Sprite,"frameOffsets"),Konva.Factory.addGetterSetter(Konva.Sprite,"image"),Konva.Factory.addGetterSetter(Konva.Sprite,"frameIndex",0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Sprite,"frameRate",17,Konva.Validators.getNumberValidator()),Konva.Factory.backCompat(Konva.Sprite,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"}),Konva.Collection.mapMethods(Konva.Sprite)}(),function(){"use strict";Konva.Path=function(t){this.___init(t)},Konva.Path.prototype={___init:function(t){this.dataArray=[];var e=this;Konva.Shape.call(this,t),this.className="Path",this.dataArray=Konva.Path.parsePathData(this.getData()),this.pathLength=0;for(var i=0;i<this.dataArray.length;++i)this.pathLength+=this.dataArray[i].pathLength;this.on("dataChange.konva",function(){e.dataArray=Konva.Path.parsePathData(this.getData()),this.pathLength=0;for(var t=0;t<this.dataArray.length;++t)this.pathLength+=this.dataArray[t].pathLength}),this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){var e=this.dataArray;t.beginPath();for(var i=0;i<e.length;i++){var n=e[i].command,o=e[i].points;switch(n){case"L":t.lineTo(o[0],o[1]);break;case"M":t.moveTo(o[0],o[1]);break;case"C":t.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case"Q":t.quadraticCurveTo(o[0],o[1],o[2],o[3]);break;case"A":var r=o[0],s=o[1],a=o[2],l=o[3],u=o[4],h=o[5],c=o[6],d=o[7],p=a>l?a:l,f=a>l?1:a/l,m=a>l?l/a:1;t.translate(r,s),t.rotate(c),t.scale(f,m),t.arc(0,0,p,u,u+h,1-d),t.scale(1/f,1/m),t.rotate(-c),t.translate(-r,-s);break;case"z":t.closePath()}}t.fillStrokeShape(this)},getSelfRect:function(){var t=[];this.dataArray.forEach(function(e){t=t.concat(e.points)});for(var e,i,n=t[0],o=t[0],r=t[1],s=t[1],a=0;a<t.length/2;a++)e=t[2*a],i=t[2*a+1],n=Math.min(n,e),o=Math.max(o,e),r=Math.min(r,i),s=Math.max(s,i);return{x:Math.round(n),y:Math.round(r),width:Math.round(o-n),height:Math.round(s-r)}},getLength:function(){return this.pathLength},getPointAtLength:function(t){var e,i=0,n=this.dataArray.length;if(!n)return null;for(;i<n&&t>this.dataArray[i].pathLength;)t-=this.dataArray[i].pathLength,++i;if(i===n)return{x:(e=this.dataArray[i-1].points.slice(-2))[0],y:e[1]};if(t<.01)return{x:(e=this.dataArray[i].points.slice(0,2))[0],y:e[1]};var o=this.dataArray[i],r=o.points;switch(o.command){case"L":return Konva.Path.getPointOnLine(t,o.start.x,o.start.y,r[0],r[1]);case"C":return Konva.Path.getPointOnCubicBezier(t/o.pathLength,o.start.x,o.start.y,r[0],r[1],r[2],r[3],r[4],r[5]);case"Q":return Konva.Path.getPointOnQuadraticBezier(t/o.pathLength,o.start.x,o.start.y,r[0],r[1],r[2],r[3]);case"A":var s=r[0],a=r[1],l=r[2],u=r[3],h=r[4],c=r[5],d=r[6];return h+=c*t/o.pathLength,Konva.Path.getPointOnEllipticalArc(s,a,l,u,h,d)}return null}},Konva.Util.extend(Konva.Path,Konva.Shape),Konva.Path.getLineLength=function(t,e,i,n){return Math.sqrt((i-t)*(i-t)+(n-e)*(n-e))},Konva.Path.getPointOnLine=function(t,e,i,n,o,r,s){void 0===r&&(r=e),void 0===s&&(s=i);var a=(o-i)/(n-e+1e-8),l=Math.sqrt(t*t/(1+a*a));n<e&&(l*=-1);var u,h=a*l;if(n===e)u={x:r,y:s+h};else if((s-i)/(r-e+1e-8)===a)u={x:r+l,y:s+h};else{var c,d,p=this.getLineLength(e,i,n,o);if(p<1e-8)return;var f=(r-e)*(n-e)+(s-i)*(o-i);c=e+(f/=p*p)*(n-e),d=i+f*(o-i);var m=this.getLineLength(r,s,c,d),y=Math.sqrt(t*t-m*m);l=Math.sqrt(y*y/(1+a*a)),n<e&&(l*=-1),u={x:c+l,y:d+(h=a*l)}}return u},Konva.Path.getPointOnCubicBezier=function(t,e,i,n,o,r,s,a,l){function u(t){return t*t*t}function h(t){return 3*t*t*(1-t)}function c(t){return 3*t*(1-t)*(1-t)}function d(t){return(1-t)*(1-t)*(1-t)}return{x:a*u(t)+r*h(t)+n*c(t)+e*d(t),y:l*u(t)+s*h(t)+o*c(t)+i*d(t)}},Konva.Path.getPointOnQuadraticBezier=function(t,e,i,n,o,r,s){function a(t){return t*t}function l(t){return 2*t*(1-t)}function u(t){return(1-t)*(1-t)}return{x:r*a(t)+n*l(t)+e*u(t),y:s*a(t)+o*l(t)+i*u(t)}},Konva.Path.getPointOnEllipticalArc=function(t,e,i,n,o,r){var s=Math.cos(r),a=Math.sin(r),l=i*Math.cos(o),u=n*Math.sin(o);return{x:t+(l*s-u*a),y:e+(l*a+u*s)}},Konva.Path.parsePathData=function(t){if(!t)return[];var e=t,i=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];e=e.replace(new RegExp(" ","g"),",");for(var n=0;n<i.length;n++)e=e.replace(new RegExp(i[n],"g"),"|"+i[n]);var o,r=e.split("|"),s=[],a=[],l=0,u=0,h=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;for(n=1;n<r.length;n++){var c=r[n],d=c.charAt(0);for(c=c.slice(1),a.length=0;o=h.exec(c);)a.push(o[0]);for(var p=[],f=0,m=a.length;f<m;f++){var y=parseFloat(a[f]);isNaN(y)||p.push(y)}for(;p.length>0&&!isNaN(p[0]);){var v,g,_,b,S,T,w,P,x,k,A=null,M=[],C=l,O=u;switch(d){case"l":l+=p.shift(),u+=p.shift(),A="L",M.push(l,u);break;case"L":l=p.shift(),u=p.shift(),M.push(l,u);break;case"m":var F=p.shift(),E=p.shift();if(l+=F,u+=E,A="M",s.length>2&&"z"===s[s.length-1].command)for(var R=s.length-2;R>=0;R--)if("M"===s[R].command){l=s[R].points[0]+F,u=s[R].points[1]+E;break}M.push(l,u),d="l";break;case"M":l=p.shift(),u=p.shift(),A="M",M.push(l,u),d="L";break;case"h":l+=p.shift(),A="L",M.push(l,u);break;case"H":l=p.shift(),A="L",M.push(l,u);break;case"v":u+=p.shift(),A="L",M.push(l,u);break;case"V":u=p.shift(),A="L",M.push(l,u);break;case"C":M.push(p.shift(),p.shift(),p.shift(),p.shift()),l=p.shift(),u=p.shift(),M.push(l,u);break;case"c":M.push(l+p.shift(),u+p.shift(),l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),A="C",M.push(l,u);break;case"S":g=l,_=u,"C"===(v=s[s.length-1]).command&&(g=l+(l-v.points[2]),_=u+(u-v.points[3])),M.push(g,_,p.shift(),p.shift()),l=p.shift(),u=p.shift(),A="C",M.push(l,u);break;case"s":g=l,_=u,"C"===(v=s[s.length-1]).command&&(g=l+(l-v.points[2]),_=u+(u-v.points[3])),M.push(g,_,l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),A="C",M.push(l,u);break;case"Q":M.push(p.shift(),p.shift()),l=p.shift(),u=p.shift(),M.push(l,u);break;case"q":M.push(l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),A="Q",M.push(l,u);break;case"T":g=l,_=u,"Q"===(v=s[s.length-1]).command&&(g=l+(l-v.points[0]),_=u+(u-v.points[1])),l=p.shift(),u=p.shift(),A="Q",M.push(g,_,l,u);break;case"t":g=l,_=u,"Q"===(v=s[s.length-1]).command&&(g=l+(l-v.points[0]),_=u+(u-v.points[1])),l+=p.shift(),u+=p.shift(),A="Q",M.push(g,_,l,u);break;case"A":b=p.shift(),S=p.shift(),T=p.shift(),w=p.shift(),P=p.shift(),x=l,k=u,l=p.shift(),u=p.shift(),A="A",M=this.convertEndpointToCenterParameterization(x,k,l,u,w,P,b,S,T);break;case"a":b=p.shift(),S=p.shift(),T=p.shift(),w=p.shift(),P=p.shift(),x=l,k=u,l+=p.shift(),u+=p.shift(),A="A",M=this.convertEndpointToCenterParameterization(x,k,l,u,w,P,b,S,T)}s.push({command:A||d,points:M,start:{x:C,y:O},pathLength:this.calcLength(C,O,A||d,M)})}"z"!==d&&"Z"!==d||s.push({command:"z",points:[],start:void 0,pathLength:0})}return s},Konva.Path.calcLength=function(t,e,i,n){var o,r,s,a,l=Konva.Path;switch(i){case"L":return l.getLineLength(t,e,n[0],n[1]);case"C":for(o=0,r=l.getPointOnCubicBezier(0,t,e,n[0],n[1],n[2],n[3],n[4],n[5]),a=.01;a<=1;a+=.01)s=l.getPointOnCubicBezier(a,t,e,n[0],n[1],n[2],n[3],n[4],n[5]),o+=l.getLineLength(r.x,r.y,s.x,s.y),r=s;return o;case"Q":for(o=0,r=l.getPointOnQuadraticBezier(0,t,e,n[0],n[1],n[2],n[3]),a=.01;a<=1;a+=.01)s=l.getPointOnQuadraticBezier(a,t,e,n[0],n[1],n[2],n[3]),o+=l.getLineLength(r.x,r.y,s.x,s.y),r=s;return o;case"A":o=0;var u=n[4],h=n[5],c=n[4]+h,d=Math.PI/180;if(Math.abs(u-c)<d&&(d=Math.abs(u-c)),r=l.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],u,0),h<0)for(a=u-d;a>c;a-=d)s=l.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],a,0),o+=l.getLineLength(r.x,r.y,s.x,s.y),r=s;else for(a=u+d;a<c;a+=d)s=l.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],a,0),o+=l.getLineLength(r.x,r.y,s.x,s.y),r=s;return s=l.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],c,0),o+=l.getLineLength(r.x,r.y,s.x,s.y)}return 0},Konva.Path.convertEndpointToCenterParameterization=function(t,e,i,n,o,r,s,a,l){var u=l*(Math.PI/180),h=Math.cos(u)*(t-i)/2+Math.sin(u)*(e-n)/2,c=-1*Math.sin(u)*(t-i)/2+Math.cos(u)*(e-n)/2,d=h*h/(s*s)+c*c/(a*a);d>1&&(s*=Math.sqrt(d),a*=Math.sqrt(d));var p=Math.sqrt((s*s*(a*a)-s*s*(c*c)-a*a*(h*h))/(s*s*(c*c)+a*a*(h*h)));o===r&&(p*=-1),isNaN(p)&&(p=0);var f=p*s*c/a,m=p*-a*h/s,y=(t+i)/2+Math.cos(u)*f-Math.sin(u)*m,v=(e+n)/2+Math.sin(u)*f+Math.cos(u)*m,g=function(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])},_=function(t,e){return(t[0]*e[0]+t[1]*e[1])/(g(t)*g(e))},b=function(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(_(t,e))},S=b([1,0],[(h-f)/s,(c-m)/a]),T=[(h-f)/s,(c-m)/a],w=[(-1*h-f)/s,(-1*c-m)/a],P=b(T,w);return _(T,w)<=-1&&(P=Math.PI),_(T,w)>=1&&(P=0),0===r&&P>0&&(P-=2*Math.PI),1===r&&P<0&&(P+=2*Math.PI),[y,v,s,a,S,P,u,r]},Konva.Factory.addGetterSetter(Konva.Path,"data"),Konva.Collection.mapMethods(Konva.Path)}(),function(){"use strict";function t(t){t.fillText(this.partialText,0,0)}function e(t){t.strokeText(this.partialText,0,0)}Konva.TextPath=function(t){this.___init(t)},Konva.TextPath.prototype={___init:function(i){var n=this;this.dummyCanvas=Konva.Util.createCanvasElement(),this.dataArray=[],this.getKerning=i&&i.getKerning,Konva.Shape.call(this,i),this._fillFunc=t,this._strokeFunc=e,this._fillFuncHit=t,this._strokeFuncHit=e,this.className="TextPath",this.dataArray=Konva.Path.parsePathData(this.attrs.data),this.on("dataChange.konva",function(){n.dataArray=Konva.Path.parsePathData(this.attrs.data),n._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva",n._setTextData),n._setTextData(),this.sceneFunc(this._sceneFunc),this.hitFunc(this._hitFunc)},_sceneFunc:function(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.getTextBaseline()),t.setAttr("textAlign","left"),t.save();var e=this.textDecoration(),i=this.fill(),n=this.fontSize(),o=this.glyphInfo;"underline"===e&&t.beginPath();for(var r=0;r<o.length;r++){t.save();var s=o[r].p0;t.translate(s.x,s.y),t.rotate(o[r].rotation),this.partialText=o[r].text,t.fillStrokeShape(this),"underline"===e&&(0===r&&t.moveTo(0,n/2+1),t.lineTo(n,n/2+1)),t.restore()}"underline"===e&&(t.strokeStyle=i,t.lineWidth=n/20,t.stroke()),t.restore()},_hitFunc:function(t){t.beginPath();var e=this.glyphInfo;if(e.length>=1){var i=e[0].p0;t.moveTo(i.x,i.y)}for(var n=0;n<e.length;n++){var o=e[n].p1;t.lineTo(o.x,o.y)}t.setAttr("lineWidth",this.getFontSize()),t.setAttr("strokeStyle",this.colorKey),t.stroke()},getTextWidth:function(){return this.textWidth},getTextHeight:function(){return this.textHeight},setText:function(t){Konva.Text.prototype.setText.call(this,t)},_getTextSize:function(t){var e=this.dummyCanvas.getContext("2d");e.save(),e.font=this._getContextFont();var i=e.measureText(t);return e.restore(),{width:i.width,height:parseInt(this.attrs.fontSize,10)}},_setTextData:function(){var t=this,e=this._getTextSize(this.attrs.text),i=this.getLetterSpacing(),n=this.align();this.textWidth=e.width,this.textHeight=e.height;var o=Math.max(this.textWidth+((this.attrs.text||"").length-1)*i,0);this.glyphInfo=[];for(var r=0,s=0;s<t.dataArray.length;s++)t.dataArray[s].pathLength>0&&(r+=t.dataArray[s].pathLength);var a=0;"center"===n&&(a=Math.max(0,r/2-o/2)),"right"===n&&(a=Math.max(0,r-o));for(var l,u,h,c=this.getText().split(""),d=this.getText().split(" ").length-1,p=-1,f=0,m=function(){f=0;for(var e=t.dataArray,i=p+1;i<e.length;i++){if(e[i].pathLength>0)return p=i,e[i];"M"===e[i].command&&(l={x:e[i].points[0],y:e[i].points[1]})}return{}},y=function(e){var s=t._getTextSize(e).width+i;" "===e&&"justify"===n&&(s+=(r-o)/d);var a=0,c=0;for(u=void 0;Math.abs(s-a)/s>.01&&c<25;){c++;for(var p=a;void 0===h;)(h=m())&&p+h.pathLength<s&&(p+=h.pathLength,h=void 0);if(h==={}||void 0===l)return;var y=!1;switch(h.command){case"L":Konva.Path.getLineLength(l.x,l.y,h.points[0],h.points[1])>s?u=Konva.Path.getPointOnLine(s,l.x,l.y,h.points[0],h.points[1],l.x,l.y):h=void 0;break;case"A":var v=h.points[4],g=h.points[5],_=h.points[4]+g;0===f?f=v+1e-8:s>a?f+=Math.PI/180*g/Math.abs(g):f-=Math.PI/360*g/Math.abs(g),(g<0&&f<_||g>=0&&f>_)&&(f=_,y=!0),u=Konva.Path.getPointOnEllipticalArc(h.points[0],h.points[1],h.points[2],h.points[3],f,h.points[6]);break;case"C":0===f?f=s>h.pathLength?1e-8:s/h.pathLength:s>a?f+=(s-a)/h.pathLength:f-=(a-s)/h.pathLength,f>1&&(f=1,y=!0),u=Konva.Path.getPointOnCubicBezier(f,h.start.x,h.start.y,h.points[0],h.points[1],h.points[2],h.points[3],h.points[4],h.points[5]);break;case"Q":0===f?f=s/h.pathLength:s>a?f+=(s-a)/h.pathLength:f-=(a-s)/h.pathLength,f>1&&(f=1,y=!0),u=Konva.Path.getPointOnQuadraticBezier(f,h.start.x,h.start.y,h.points[0],h.points[1],h.points[2],h.points[3])}void 0!==u&&(a=Konva.Path.getLineLength(l.x,l.y,u.x,u.y)),y&&(y=!1,h=void 0)}},v=t._getTextSize("C").width+i,g=0;g<a/v&&(y("C"),void 0!==l&&void 0!==u);g++)l=u;for(var _=0;_<c.length&&(y(c[_]),void 0!==l&&void 0!==u);_++){var b=Konva.Path.getLineLength(l.x,l.y,u.x,u.y),S=0;if(this.getKerning)try{S=this.getKerning(c[_-1],c[_])*this.fontSize()}catch(P){S=0}l.x+=S,u.x+=S,this.textWidth+=S;var T=Konva.Path.getPointOnLine(S+b/2,l.x,l.y,u.x,u.y),w=Math.atan2(u.y-l.y,u.x-l.x);this.glyphInfo.push({transposeX:T.x,transposeY:T.y,text:c[_],rotation:w,p0:l,p1:u}),l=u}},getSelfRect:function(){var t=[];this.glyphInfo.forEach(function(e){t.push(e.p0.x),t.push(e.p0.y),t.push(e.p1.x),t.push(e.p1.y)});for(var e,i,n=t[0],o=t[0],r=t[0],s=t[0],a=0;a<t.length/2;a++)e=t[2*a],i=t[2*a+1],n=Math.min(n,e),o=Math.max(o,e),r=Math.min(r,i),s=Math.max(s,i);var l=this.fontSize();return{x:Math.round(n)-l/2,y:Math.round(r)-l/2,width:Math.round(o-n)+l,height:Math.round(s-r)+l}}},Konva.TextPath.prototype._getContextFont=Konva.Text.prototype._getContextFont,Konva.Util.extend(Konva.TextPath,Konva.Shape),Konva.Factory.addGetterSetter(Konva.TextPath,"data"),Konva.Factory.addGetterSetter(Konva.TextPath,"fontFamily","Arial"),Konva.Factory.addGetterSetter(Konva.TextPath,"fontSize",12,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.TextPath,"fontStyle","normal"),Konva.Factory.addGetterSetter(Konva.TextPath,"align","left"),Konva.Factory.addGetterSetter(Konva.TextPath,"letterSpacing",0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.TextPath,"textBaseline","middle"),Konva.Factory.addGetterSetter(Konva.TextPath,"fontVariant","normal"),Konva.Factory.addGetter(Konva.TextPath,"text",""),Konva.Factory.addGetterSetter(Konva.TextPath,"textDecoration",null),Konva.Collection.mapMethods(Konva.TextPath)}(),function(){"use strict";Konva.RegularPolygon=function(t){this.___init(t)},Konva.RegularPolygon.prototype={_centroid:!0,___init:function(t){Konva.Shape.call(this,t),this.className="RegularPolygon",this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){var e,i,n,o=this.attrs.sides,r=this.attrs.radius;for(t.beginPath(),t.moveTo(0,0-r),e=1;e<o;e++)i=r*Math.sin(2*e*Math.PI/o),n=-1*r*Math.cos(2*e*Math.PI/o),t.lineTo(i,n);t.closePath(),t.fillStrokeShape(this)},getWidth:function(){return 2*this.getRadius()},getHeight:function(){return 2*this.getRadius()},setWidth:function(t){Konva.Node.prototype.setWidth.call(this,t),this.radius()!==t/2&&this.setRadius(t/2)},setHeight:function(t){Konva.Node.prototype.setHeight.call(this,t),this.radius()!==t/2&&this.setRadius(t/2)}},Konva.Util.extend(Konva.RegularPolygon,Konva.Shape),Konva.Factory.addGetterSetter(Konva.RegularPolygon,"radius",0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.RegularPolygon,"sides",0,Konva.Validators.getNumberValidator()),Konva.Collection.mapMethods(Konva.RegularPolygon)}(),function(){"use strict";Konva.Star=function(t){this.___init(t)},Konva.Star.prototype={_centroid:!0,___init:function(t){Konva.Shape.call(this,t),this.className="Star",this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){var e=this.innerRadius(),i=this.outerRadius(),n=this.numPoints();t.beginPath(),t.moveTo(0,0-i);for(var o=1;o<2*n;o++){var r=o%2===0?i:e,s=r*Math.sin(o*Math.PI/n),a=-1*r*Math.cos(o*Math.PI/n);t.lineTo(s,a)}t.closePath(),t.fillStrokeShape(this)},getWidth:function(){return 2*this.getOuterRadius()},getHeight:function(){return 2*this.getOuterRadius()},setWidth:function(t){Konva.Node.prototype.setWidth.call(this,t),this.outerRadius()!==t/2&&this.setOuterRadius(t/2)},setHeight:function(t){Konva.Node.prototype.setHeight.call(this,t),this.outerRadius()!==t/2&&this.setOuterRadius(t/2)}},Konva.Util.extend(Konva.Star,Konva.Shape),Konva.Factory.addGetterSetter(Konva.Star,"numPoints",5,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Star,"innerRadius",0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Star,"outerRadius",0,Konva.Validators.getNumberValidator()),Konva.Collection.mapMethods(Konva.Star)}(),function(){"use strict";var t=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width"],e=t.length;Konva.Label=function(t){this.____init(t)},Konva.Label.prototype={____init:function(t){var e=this;Konva.Group.call(this,t),this.className="Label",this.on("add.konva",function(t){e._addListeners(t.child),e._sync()})},getText:function(){return this.find("Text")[0]},getTag:function(){return this.find("Tag")[0]},_addListeners:function(i){var n,o=this,r=function(){o._sync()};for(n=0;n<e;n++)i.on(t[n]+"Change.konva",r)},getWidth:function(){return this.getText().getWidth()},getHeight:function(){return this.getText().getHeight()},_sync:function(){var t,e,i,n,o,r,s,a=this.getText(),l=this.getTag();if(a&&l){switch(t=a.getWidth(),e=a.getHeight(),i=l.getPointerDirection(),n=l.getPointerWidth(),s=l.getPointerHeight(),o=0,r=0,i){case"up":o=t/2,r=-1*s;break;case"right":o=t+n,r=e/2;break;case"down":o=t/2,r=e+s;break;case"left":o=-1*n,r=e/2}l.setAttrs({x:-1*o,y:-1*r,width:t,height:e}),a.setAttrs({x:-1*o,y:-1*r})}}},Konva.Util.extend(Konva.Label,Konva.Group),Konva.Collection.mapMethods(Konva.Label),Konva.Tag=function(t){this.___init(t)},Konva.Tag.prototype={___init:function(t){Konva.Shape.call(this,t),this.className="Tag",this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){var e=this.getWidth(),i=this.getHeight(),n=this.getPointerDirection(),o=this.getPointerWidth(),r=this.getPointerHeight(),s=Math.min(this.getCornerRadius(),e/2,i/2);t.beginPath(),s?t.moveTo(s,0):t.moveTo(0,0),"up"===n&&(t.lineTo((e-o)/2,0),t.lineTo(e/2,-1*r),t.lineTo((e+o)/2,0)),s?(t.lineTo(e-s,0),t.arc(e-s,s,s,3*Math.PI/2,0,!1)):t.lineTo(e,0),"right"===n&&(t.lineTo(e,(i-r)/2),t.lineTo(e+o,i/2),t.lineTo(e,(i+r)/2)),s?(t.lineTo(e,i-s),t.arc(e-s,i-s,s,0,Math.PI/2,!1)):t.lineTo(e,i),"down"===n&&(t.lineTo((e+o)/2,i),t.lineTo(e/2,i+r),t.lineTo((e-o)/2,i)),s?(t.lineTo(s,i),t.arc(s,i-s,s,Math.PI/2,Math.PI,!1)):t.lineTo(0,i),"left"===n&&(t.lineTo(0,(i+r)/2),t.lineTo(-1*o,i/2),t.lineTo(0,(i-r)/2)),s&&(t.lineTo(0,s),t.arc(s,s,s,Math.PI,3*Math.PI/2,!1)),t.closePath(),t.fillStrokeShape(this)},getSelfRect:function(){var t=0,e=0,i=this.getPointerWidth(),n=this.getPointerHeight(),o=this.pointerDirection(),r=this.getWidth(),s=this.getHeight();return"up"===o?(e-=n,s+=n):"down"===o?s+=n:"left"===o?(t-=1.5*i,r+=i):"right"===o&&(r+=1.5*i),{x:t,y:e,width:r,height:s}}},Konva.Util.extend(Konva.Tag,Konva.Shape),Konva.Factory.addGetterSetter(Konva.Tag,"pointerDirection","none"),Konva.Factory.addGetterSetter(Konva.Tag,"pointerWidth",0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Tag,"pointerHeight",0,Konva.Validators.getNumberValidator()),Konva.Factory.addGetterSetter(Konva.Tag,"cornerRadius",0,Konva.Validators.getNumberValidator()),Konva.Collection.mapMethods(Konva.Tag)}(),function(t){"use strict";t.Arrow=function(t){this.____init(t)},t.Arrow.prototype={____init:function(e){t.Line.call(this,e),this.className="Arrow"},_sceneFunc:function(e){t.Line.prototype._sceneFunc.apply(this,arguments);var i=2*Math.PI,n=this.points(),o=n,r=0!==this.getTension()&&n.length>4;r&&(o=this.getTensionPoints());var s,a,l=n.length;r?(s=n[l-2]-o[l-2],a=n[l-1]-o[l-1]):(s=n[l-2]-n[l-4],a=n[l-1]-n[l-3]);var u=(Math.atan2(a,s)+i)%i,h=this.pointerLength(),c=this.pointerWidth();e.save(),e.beginPath(),e.translate(n[l-2],n[l-1]),e.rotate(u),e.moveTo(0,0),e.lineTo(-h,c/2),e.lineTo(-h,-c/2),e.closePath(),e.restore(),this.pointerAtBeginning()&&(e.save(),e.translate(n[0],n[1]),r?(s=o[0]-n[0],a=o[1]-n[1]):(s=n[2]-n[0],a=n[3]-n[1]),e.rotate((Math.atan2(-a,-s)+i)%i),e.moveTo(0,0),e.lineTo(-h,c/2),e.lineTo(-h,-c/2),e.closePath(),e.restore());var d=this.dashEnabled();d&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),d&&(this.attrs.dashEnabled=!0)}},t.Util.extend(t.Arrow,t.Line),t.Factory.addGetterSetter(t.Arrow,"pointerLength",10,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Arrow,"pointerWidth",10,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Arrow,"pointerAtBeginning",!1),t.Collection.mapMethods(t.Arrow)}(Konva),function(t){"use strict";var e=["resizeEnabledChange","rotateAnchorOffsetChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange"].join(" "),i=["xChange.resizer","yChange.resizer","widthChange.resizer","heightChange.resizer","scaleXChange.resizer","scaleYChange.resizer","skewXChange.resizer","skewYChange.resizer","rotationChange.resizer","offsetXChange.resizer","offsetYChange.resizer","transformsEnabledChange.resizer"].join(" "),n=["widthChange.resizer","heightChange.resizer","scaleXChange.resizer","scaleYChange.resizer","skewXChange.resizer","skewYChange.resizer","rotationChange.resizer","offsetXChange.resizer","offsetYChange.resizer"].join(" "),o={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};t.Transformer=function(t){this.____init(t)};var r=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];t.Transformer.prototype={_centroid:!1,____init:function(i){t.Group.call(this,i),this.className="Transformer",this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(e,this.update),this.getNode()&&this.update()},attachTo:function(t){this.setNode(t)},setNode:function(t){return this._node&&this.detach(),this._node=t,this._resetTransformCache(),t.on(i,this._resetTransformCache.bind(this)),t.on(n,function(){this._transforming||this.update()}.bind(this)),!!this.findOne(".top-left")&&this.update(),this},getNode:function(){return this._node},detach:function(){this.getNode()&&(this.getNode().off(".resizer"),this._node=void 0),this._resetTransformCache()},_resetTransformCache:function(){this._clearCache("nodeRect"),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")},_getNodeRect:function(){return this._getCache("nodeRect",this.__getNodeRect)},__getNodeRect:function(){var e=this.getNode();if(!e)return{x:-Number.MAX_SAFE_INTEGER,y:-Number.MAX_SAFE_INTEGER,width:0,height:0,rotation:0};var i=e.getClientRect({skipTransform:!0}),n=t.getAngle(e.rotation()),o=i.x*e.scaleX()-e.offsetX()*e.scaleX(),r=i.y*e.scaleY()-e.offsetY()*e.scaleY();return{x:e.x()+o*Math.cos(n)+r*Math.sin(-n),y:e.y()+r*Math.cos(n)+o*Math.sin(n),width:i.width*e.scaleX(),height:i.height*e.scaleY(),rotation:e.rotation()}},getX:function(){return this._getNodeRect().x},getY:function(){return this._getNodeRect().y},getRotation:function(){return this._getNodeRect().rotation},getWidth:function(){return this._getNodeRect().width},getHeight:function(){return this._getNodeRect().height},_createElements:function(){this._createBack(),r.forEach(function(t){this._createAnchor(t)}.bind(this)),this._createAnchor("rotater")},_createAnchor:function(e){var i=new t.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0}),n=this;i.on("mousedown touchstart",function(t){n._handleMouseDown(t)}),i.on("dragstart",function(t){t.cancelBubble=!0}),i.on("dragmove",function(t){t.cancelBubble=!0}),i.on("dragend",function(t){t.cancelBubble=!0}),i.on("mouseenter",function(){var n=this.getLayer(),r=this.getParent(),s=t.getAngle(r.rotation()),a=r.getNode().getAbsoluteScale(),l=a.y*a.x<0,u=function(e,i,n){if("rotater"===e)return"crosshair";i+=t.Util._degToRad(o[e]||0),n&&(i*=-1);var r=(t.Util._radToDeg(i)%360+360)%360;return t.Util._inRange(r,337.5,360)||t.Util._inRange(r,0,22.5)?"ns-resize":t.Util._inRange(r,22.5,67.5)?"nesw-resize":t.Util._inRange(r,67.5,112.5)?"ew-resize":t.Util._inRange(r,112.5,157.5)?"nwse-resize":t.Util._inRange(r,157.5,202.5)?"ns-resize":t.Util._inRange(r,202.5,247.5)?"nesw-resize":t.Util._inRange(r,247.5,292.5)?"ew-resize":t.Util._inRange(r,292.5,337.5)?"nwse-resize":(t.Util.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}(e,s,l);i.getStage().content.style.cursor=u,n.batchDraw()}),i.on("mouseout",function(){var t=this.getLayer();t&&(i.getStage().content.style.cursor="",t.batchDraw())}),this.add(i)},_createBack:function(){var e=new t.Shape({name:"back",width:0,height:0,listening:!1,sceneFunc:function(e){var i=this.getParent(),n=i.getPadding();e.beginPath(),e.rect(-n,-n,this.width()+2*n,this.height()+2*n),e.moveTo(this.width()/2,-n),i.rotateEnabled()&&e.lineTo(this.width()/2,-i.rotateAnchorOffset()*t.Util._sign(this.height())),e.fillStrokeShape(this)}});this.add(e)},_handleMouseDown:function(t){this.movingResizer=t.target.name().split(" ")[0];var e=this._getNodeRect(),i=e.width,n=e.height,o=Math.sqrt(Math.pow(i,2)+Math.pow(n,2));this.sin=n/o,this.cos=i/o,window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0),this._transforming=!0,this._fire("transformstart",{evt:t}),this.getNode()._fire("transformstart",{evt:t})},_handleMouseMove:function(e){var i,n,o,r=this.findOne("."+this.movingResizer),s=r.getStage().getContent().getBoundingClientRect(),a=s.left,l=s.top,u={x:(void 0!==e.clientX?e.clientX:e.touches[0].clientX)-a,y:(void 0!==e.clientX?e.clientY:e.touches[0].clientY)-l};r.setAbsolutePosition(u);var h=this.keepRatio()||e.shiftKey;if("top-left"===this.movingResizer)h&&(i=(o=Math.sqrt(Math.pow(this.findOne(".bottom-right").x()-r.x(),2)+Math.pow(this.findOne(".bottom-right").y()-r.y(),2)))*this.cos,n=o*this.sin,this.findOne(".top-left").x(this.findOne(".bottom-right").x()-i),this.findOne(".top-left").y(this.findOne(".bottom-right").y()-n));else if("top-center"===this.movingResizer)this.findOne(".top-left").y(r.y());else if("top-right"===this.movingResizer){h&&(i=(o=Math.sqrt(Math.pow(this.findOne(".bottom-left").x()-r.x(),2)+Math.pow(this.findOne(".bottom-left").y()-r.y(),2)))*this.cos,n=o*this.sin,this.findOne(".top-right").x(i),this.findOne(".top-right").y(this.findOne(".bottom-left").y()-n));var c=r.position();this.findOne(".top-left").y(c.y),this.findOne(".bottom-right").x(c.x)}else if("middle-left"===this.movingResizer)this.findOne(".top-left").x(r.x());else if("middle-right"===this.movingResizer)this.findOne(".bottom-right").x(r.x());else if("bottom-left"===this.movingResizer)h&&(i=(o=Math.sqrt(Math.pow(this.findOne(".top-right").x()-r.x(),2)+Math.pow(this.findOne(".top-right").y()-r.y(),2)))*this.cos,n=o*this.sin,this.findOne(".bottom-left").x(this.findOne(".top-right").x()-i),this.findOne(".bottom-left").y(n)),c=r.position(),this.findOne(".top-left").x(c.x),this.findOne(".bottom-right").y(c.y);else if("bottom-center"===this.movingResizer)this.findOne(".bottom-right").y(r.y());else if("bottom-right"===this.movingResizer)h&&(i=(o=Math.sqrt(Math.pow(this.findOne(".bottom-right").x(),2)+Math.pow(this.findOne(".bottom-right").y(),2)))*this.cos,n=o*this.sin,this.findOne(".bottom-right").x(i),this.findOne(".bottom-right").y(n));else if("rotater"===this.movingResizer){var d=this.getPadding(),p=this._getNodeRect();i=r.x()-p.width/2,n=-r.y()+p.height/2;var f=Math.atan2(-n,i)+Math.PI/2;p.height<0&&(f-=Math.PI);for(var m=t.getAngle(this.rotation()),y=t.Util._radToDeg(m)+t.Util._radToDeg(f),v=t.getAngle(this.getNode().rotation()),g=t.Util._degToRad(y),_=this.rotationSnaps(),b=0;b<_.length;b++){var S=t.getAngle(_[b]);Math.abs(S-t.Util._degToRad(y))%(2*Math.PI)<.1&&(y=t.Util._radToDeg(S),g=t.Util._degToRad(y))}var T=d,w=d;this._fitNodeInto({rotation:t.angleDeg?y:t.Util._degToRad(y),x:p.x+(p.width/2+d)*(Math.cos(v)-Math.cos(g))+(p.height/2+d)*(Math.sin(-v)-Math.sin(-g))-(T*Math.cos(m)+w*Math.sin(-m)),y:p.y+(p.height/2+d)*(Math.cos(v)-Math.cos(g))+(p.width/2+d)*(Math.sin(v)-Math.sin(g))-(w*Math.cos(m)+T*Math.sin(m)),width:p.width+2*d,height:p.height+2*d},e)}else console.error(new Error("Wrong position argument of selection resizer: ",this.movingResizer));if("rotater"!==this.movingResizer){var P=this.findOne(".top-left").getAbsolutePosition(this.getParent());if(this.getCenteredScaling()||e.altKey){var x=this.findOne(".top-left"),k=this.findOne(".bottom-right"),A=x.x(),M=x.y(),C=this.getWidth()-k.x(),O=this.getHeight()-k.y();k.move({x:-A,y:-M}),x.move({x:C,y:O}),P=x.getAbsolutePosition(this.getParent())}i=P.x,n=P.y;var F=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),E=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodeInto({x:i+this.offsetX(),y:n+this.offsetY(),width:F,height:E},e)}},_handleMouseUp:function(t){this._removeEvents(t)},_removeEvents:function(t){if(this._transforming){this._transforming=!1,window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0),this._fire("transformend",{evt:t});var e=this.getNode();e&&e.fire("transformend",{evt:t})}},_fitNodeInto:function(e,i){var n=this.getBoundBoxFunc();if(n){var o=this._getNodeRect();e=n.call(this,o,e)}this._settings=!0;var r=this.getNode();void 0!==e.rotation&&this.getNode().rotation(e.rotation);var s=r.getClientRect({skipTransform:!0}),a=this.getPadding(),l=(e.width-2*a)/s.width,u=(e.height-2*a)/s.height,h=t.getAngle(r.getRotation()),c=s.x*l-a-r.offsetX()*l,d=s.y*u-a-r.offsetY()*u;this.getNode().setAttrs({scaleX:l,scaleY:u,x:e.x-(c*Math.cos(h)+d*Math.sin(-h)),y:e.y-(d*Math.cos(h)+c*Math.sin(h))}),this._settings=!1,this._fire("transform",{evt:i}),this.getNode()._fire("transform",{evt:i}),this.update(),this.getLayer().batchDraw()},forceUpdate:function(){this._resetTransformCache(),this.update()},update:function(){var e=this._getNodeRect(),i=this.getNode(),n={x:1,y:1};i&&i.getParent()&&(n=i.getParent().getAbsoluteScale());var o={x:1/n.x,y:1/n.y},r=e.width,s=e.height,a=this.enabledAnchors(),l=this.resizeEnabled(),u=this.getPadding(),h=this.getAnchorSize();this.find("._anchor").setAttrs({width:h,height:h,offsetX:h/2,offsetY:h/2,stroke:this.getAnchorStroke(),strokeWidth:this.getAnchorStrokeWidth(),fill:this.getAnchorFill()}),this.findOne(".top-left").setAttrs({x:-u,y:-u,scale:o,visible:l&&a.indexOf("top-left")>=0}),this.findOne(".top-center").setAttrs({x:r/2,y:-u,scale:o,visible:l&&a.indexOf("top-center")>=0}),this.findOne(".top-right").setAttrs({x:r+u,y:-u,scale:o,visible:l&&a.indexOf("top-right")>=0}),this.findOne(".middle-left").setAttrs({x:-u,y:s/2,scale:o,visible:l&&a.indexOf("middle-left")>=0}),this.findOne(".middle-right").setAttrs({x:r+u,y:s/2,scale:o,visible:l&&a.indexOf("middle-right")>=0}),this.findOne(".bottom-left").setAttrs({x:-u,y:s+u,scale:o,visible:l&&a.indexOf("bottom-left")>=0}),this.findOne(".bottom-center").setAttrs({x:r/2,y:s+u,scale:o,visible:l&&a.indexOf("bottom-center")>=0}),this.findOne(".bottom-right").setAttrs({x:r+u,y:s+u,scale:o,visible:l&&a.indexOf("bottom-right")>=0});var c=-this.rotateAnchorOffset()*Math.abs(o.y);this.findOne(".rotater").setAttrs({x:r/2,y:c*t.Util._sign(s),scale:o,visible:this.rotateEnabled()}),this.findOne(".back").setAttrs({width:r*n.x,height:s*n.y,scale:o,visible:this.borderEnabled(),stroke:this.getBorderStroke(),strokeWidth:this.getBorderStrokeWidth(),dash:this.getBorderDash()})},isTransforming:function(){return this._transforming},stopTransform:function(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this.movingResizer);t&&t.stopDrag()}},destroy:function(){t.Group.prototype.destroy.call(this),this.detach(),this._removeEvents()},toObject:function(){return t.Node.prototype.toObject.call(this)}},t.Util.extend(t.Transformer,t.Group),t.Factory.addGetterSetter(t.Transformer,"enabledAnchors",r,function(e){return e instanceof Array||t.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(e){-1===r.indexOf(e)&&t.Util.warn("Unknown anchor name: "+e+". Available names are: "+r.join(", "))}),e||[]}),t.Factory.addGetterSetter(t.Transformer,"resizeEnabled",!0),t.Factory.addGetterSetter(t.Transformer,"anchorSize",10,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Transformer,"rotateEnabled",!0),t.Factory.addGetterSetter(t.Transformer,"rotationSnaps",[]),t.Factory.addGetterSetter(t.Transformer,"rotateAnchorOffset",50,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Transformer,"borderEnabled",!0),t.Factory.addGetterSetter(t.Transformer,"anchorStroke","rgb(0, 161, 255)"),t.Factory.addGetterSetter(t.Transformer,"anchorStrokeWidth",1,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Transformer,"anchorFill","white"),t.Factory.addGetterSetter(t.Transformer,"borderStroke","rgb(0, 161, 255)"),t.Factory.addGetterSetter(t.Transformer,"borderStrokeWidth",1,t.Validators.getNumberValidator()),t.Factory.addGetterSetter(t.Transformer,"borderDash"),t.Factory.addGetterSetter(t.Transformer,"keepRatio",!0),t.Factory.addGetterSetter(t.Transformer,"centeredScaling",!1),t.Factory.addGetterSetter(t.Transformer,"padding",0,t.Validators.getNumberValidator()),t.Factory.addOverloadedGetterSetter(t.Transformer,"node"),t.Factory.addGetterSetter(t.Transformer,"boundBoxFunc"),t.Factory.backCompat(t.Transformer,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"}),t.Collection.mapMethods(t.Transformer)}(Konva)}).call(this,i(12))},function(t,e,i){"use strict";function n(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}i.d(e,"a",function(){return n})},function(t,e,i){"use strict";var n={};i.r(n),i.d(n,"props",function(){return X}),i.d(n,"names",function(){return Q}),i.d(n,"intervals",function(){return Y}),i.d(n,"notes",function(){return $}),i.d(n,"exists",function(){return Z}),i.d(n,"tokenize",function(){return J}),i.d(n,"modeNames",function(){return tt}),i.d(n,"chords",function(){return et}),i.d(n,"toScale",function(){return it}),i.d(n,"supersets",function(){return nt}),i.d(n,"subsets",function(){return ot});var o="C C# Db D D# Eb E F F# Gb G G# Ab A A# Bb B".split(" "),r=function(t){return"string"!==typeof t?o.slice():o.filter(function(e){var i=e[1]||" ";return-1!==t.indexOf(i)})},s=(r(" #"),r(" b"),/^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/);function a(t){"string"!==typeof t&&(t="");var e=s.exec(t);return e?[e[1].toUpperCase(),e[2].replace(/x/g,"##"),e[3],e[4]]:null}var l=Object.freeze({pc:null,name:null,step:null,alt:null,oct:null,octStr:null,chroma:null,midi:null,freq:null}),u=[0,2,4,5,7,9,11],h=function(t,e){return void 0===e&&(e={}),function(i){return e[i]||(e[i]=t(i))}}(function(t){var e=a(t);if(""===e[0]||""!==e[3])return l;var i=e[0],n=e[1],o=e[2],r={letter:i,acc:n,octStr:o};return r.pc=r.letter+r.acc,r.name=r.pc+o,r.step=(r.letter.charCodeAt(0)+3)%7,r.alt="b"===r.acc[0]?-r.acc.length:r.acc.length,r.oct=o.length?+o:null,r.chroma=(u[r.step]+r.alt+120)%12,r.midi=null!==r.oct?u[r.step]+r.alt+12*(r.oct+1):null,r.freq=p(r.midi),Object.freeze(r)}),c=function(t){return h(t).name},d=function(t){return h(t).pc},p=function(t,e){return void 0===e&&(e=440),"number"===typeof t?Math.pow(2,(t-69)/12)*e:null},f=(Math.log(2),Math.log(440),function(t,e){return Array(e+1).join(t)}),m=function(t,e){void 0===t&&(t={}),void 0===e&&(e=null);var i=e?Object.assign({},h(e),t):t,n=i.step,o=i.alt,r=i.oct,s=function(t){return"CDEFGAB"[t]}(n);if(!s)return null;var a=s+function(t){return i=function(t){return t<0?f("b",-t):f("#",t)},"number"!==typeof(e=t)?"":i(e);var e,i}(o);return r||0===r?a+r:a};function y(t,e){var i=e.length,n=(t%i+i)%i;return e.slice(n,i).concat(e.slice(0,n))}var v=function(t){return t.filter(function(t){return 0===t||t})},g=function(t){var e=h(t).midi;return null!==e?e:h(t+"-100").midi};function _(t){return(e=t,v(e.map(c)).sort(function(t,e){return g(t)>g(e)})).filter(function(t,e,i){return 0===e||t!==i[e-1]});var e}var b=new RegExp("^([-+]?\\d+)(d{1,4}|m|M|P|A{1,4})|(AA|A|P|M|m|d|dd)([-+]?\\d+)$"),S=[0,2,4,5,7,9,11],T=("1P 2m 2M 3m 3M 4P 5P 6m 6M 7m 7M 8P".split(" "),Object.freeze({name:null,num:null,q:null,step:null,alt:null,dir:null,type:null,simple:null,semitones:null,chroma:null})),w=function(t){return(Math.abs(t)-1)%7},P=function(t){var e=function(t){var e=b.exec(t);return null===e?null:e[1]?[e[1],e[2]]:[e[4],e[3]]}(t);if(null===e)return T;var i,n,o={num:+e[0],q:e[1]};return o.step=w(o.num),o.type="PMMPPMM"[o.step],"M"===o.type&&"P"===o.q?T:(o.name=""+o.num+o.q,o.dir=o.num<0?-1:1,o.simple=8===o.num||-8===o.num?o.num:o.dir*(o.step+1),o.alt=(i=o.type,"M"===(n=o.q)&&"M"===i?0:"P"===n&&"P"===i?0:"m"===n&&"M"===i?-1:/^A+$/.test(n)?n.length:/^d+$/.test(n)?"P"===i?-n.length:-n.length-1:null),o.oct=Math.floor((Math.abs(o.num)-1)/7),o.semitones=o.dir*(S[o.step]+o.alt+12*o.oct),o.chroma=(o.dir*(S[o.step]+o.alt)%12+12)%12,Object.freeze(o))},x={};function k(t){return"string"!==typeof t?T:x[t]||(x[t]=P(t))}"P m M m M P d P m M m M".split(" ");var A=[0,2,4,-1,1,3,5],M=A.map(function(t){return Math.floor(7*t/12)}),C=[3,0,4,1,5,2,6];var O=function(t,e,i){var n=C[function(t){var e=(t+1)%7;return e<0?7+e:e}(t)],o=Math.floor((t+1)/7);return void 0===e?{step:n,alt:o,dir:i}:{step:n,alt:o,oct:e+4*o+M[n],dir:i}},F=function(t){return e=function(e){var i=t(e);return null===i.name?null:function(t){var e=t.step,i=t.alt,n=t.oct,o=t.dir;void 0===o&&(o=1);var r=A[e]+7*i;return null===n?[o*r]:[o*r,o*(n-M[e]-4*i)]}(i)},void 0===i&&(i={}),function(t){return i[t]||(i[t]=e(t))};var e,i},E=F(h),R=F(k);function N(t,e){if(1===arguments.length)return function(e){return N(t,e)};var i=E(t),n=R(e);if(null===i||null===n)return null;var o=1===i.length?[i[0]+n[0]]:[i[0]+n[0],i[1]+n[1]];return m(O(o[0],o[1]))}var K=i(16),D=i(17),L=function(t){return function(t){return h(t).chroma}(t)||function(t){return k(t).chroma}(t)||0},q=function(t){return parseInt(I(t),2)};function I(t){if(V(t))return t;if(!Array.isArray(t))return"";var e=[0,0,0,0,0,0,0,0,0,0,0,0];return t.map(L).forEach(function(t){e[t]=1}),e.join("")}var U=/^[01]{12}$/;function V(t){return U.test(t)}"1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M".split(" ");function B(t,e){return arguments.length>1?B(t)(e):(t=q(t),function(e){return(e=q(e))!==t&&(e&t)===e})}function G(t,e){return arguments.length>1?G(t)(e):(t=q(t),function(e){return(e=q(e))!==t&&(e|t)===e})}var j=function(t){var e=Object.keys(t).sort(),i=[],n=[],o=function(t,e,o){i[t]=e,n[o]=n[o]||[],n[o].push(t)};e.forEach(function(e){var i=t[e][0].split(" "),n=t[e][1],r=I(i);o(e,i,r),n&&n.forEach(function(t){return o(t,i,r)})});var r=Object.keys(i).sort(),s=function(t){return i[t]};return s.names=function(t){return"string"===typeof t?(n[t]||[]).slice():(!0===t?r:e).slice()},s},z=j(K),W=j(D),H=(function(t,e){var i=function(i){return t(i)||e(i)};i.names=function(i){return t.names(i).concat(e.names(i))}}(z,W),Object.freeze({name:null,intervals:[],names:[],chroma:null,setnum:null})),X=function(t,e){return function(i){return e[i]||(e[i]=t(i))}}(function(t){var e=z(t);if(!e)return H;var i={intervals:e,name:t};return i.chroma=I(e),i.setnum=parseInt(i.chroma,2),i.names=z.names(i.chroma),Object.freeze(i)},{}),Q=z.names,Y=function(t){var e=J(t);return X(e[1]).intervals};function $(t,e){var i=J(t);return e=e||i[1],Y(e).map(N(i[0]))}function Z(t){var e=J(t);return void 0!==z(e[1])}function J(t){if("string"!==typeof t)return["",""];var e=t.indexOf(" "),i=c(t.substring(0,e))||c(t)||"",n=""!==i?t.substring(i.length+1):t;return[i,n.length?n:""]}var tt=function(t){var e=Y(t),i=$(t);return function(t,e){e=!1!==e;var i=I(t).split("");return v(i.map(function(t,n){var o=y(n,i);return e&&"0"===o[0]?null:o.join("")}))}(e).map(function(t,n){var o=z.names(t)[0];if(o)return[i[n]||e[n],o]}).filter(function(t){return t})},et=function(t){var e=B(Y(t));return W.names().filter(function(t){return e(W(t))})},it=function(t){var e=v(t.map(d));if(!e.length)return e;var i=e[0],n=_(e);return y(n.indexOf(i),n)},nt=function(t){if(!Y(t).length)return[];var e=G(Y(t));return z.names().filter(function(t){return e(z(t))})},ot=function(t){var e=B(Y(t));return z.names().filter(function(t){return e(z(t))})},rt=(W.names,Object.freeze({name:null,names:[],intervals:[],chroma:null,setnum:null}));!function(t,e){void 0===e&&(e={})}(function(t){var e=W(t);if(!e)return rt;var i={intervals:e,name:t};return i.chroma=I(e),i.setnum=parseInt(i.chroma,2),i.names=W.names(i.chroma),i});i.d(e,"a",function(){return n})},,function(t,e,i){"use strict";var n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},i=0;i<10;i++)e["_"+String.fromCharCode(i)]=i;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(t){n[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(o){return!1}}()?Object.assign:function(t,e){for(var i,s,a=function(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),l=1;l<arguments.length;l++){for(var u in i=Object(arguments[l]))o.call(i,u)&&(a[u]=i[u]);if(n){s=n(i);for(var h=0;h<s.length;h++)r.call(i,s[h])&&(a[s[h]]=i[s[h]])}}return a}},function(t,e){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(n){"object"===typeof window&&(i=window)}t.exports=i},,function(t,e,i){"use strict";!function t(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}(),t.exports=i(22)},function(t,e,i){"use strict";i.d(e,"a",function(){return o});var n=i(8);function o(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{},o=Object.keys(i);"function"===typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(i).filter(function(t){return Object.getOwnPropertyDescriptor(i,t).enumerable}))),o.forEach(function(e){Object(n.a)(t,e,i[e])})}return t}},function(t){t.exports={chromatic:["1P 2m 2M 3m 3M 4P 4A 5P 6m 6M 7m 7M"],lydian:["1P 2M 3M 4A 5P 6M 7M"],major:["1P 2M 3M 4P 5P 6M 7M",["ionian"]],mixolydian:["1P 2M 3M 4P 5P 6M 7m",["dominant"]],dorian:["1P 2M 3m 4P 5P 6M 7m"],aeolian:["1P 2M 3m 4P 5P 6m 7m",["minor"]],phrygian:["1P 2m 3m 4P 5P 6m 7m"],locrian:["1P 2m 3m 4P 5d 6m 7m"],"melodic minor":["1P 2M 3m 4P 5P 6M 7M"],"melodic minor second mode":["1P 2m 3m 4P 5P 6M 7m"],"lydian augmented":["1P 2M 3M 4A 5A 6M 7M"],"lydian dominant":["1P 2M 3M 4A 5P 6M 7m",["lydian b7"]],"melodic minor fifth mode":["1P 2M 3M 4P 5P 6m 7m",["hindu","mixolydian b6M"]],"locrian #2":["1P 2M 3m 4P 5d 6m 7m",["half-diminished"]],altered:["1P 2m 3m 3M 5d 6m 7m",["super locrian","diminished whole tone","pomeroy"]],"harmonic minor":["1P 2M 3m 4P 5P 6m 7M"],"phrygian dominant":["1P 2m 3M 4P 5P 6m 7m",["spanish","phrygian major"]],"half-whole diminished":["1P 2m 3m 3M 4A 5P 6M 7m",["dominant diminished"]],diminished:["1P 2M 3m 4P 5d 6m 6M 7M",["whole-half diminished"]],"major pentatonic":["1P 2M 3M 5P 6M",["pentatonic"]],"lydian pentatonic":["1P 3M 4A 5P 7M",["chinese"]],"mixolydian pentatonic":["1P 3M 4P 5P 7m",["indian"]],"locrian pentatonic":["1P 3m 4P 5d 7m",["minor seven flat five pentatonic"]],"minor pentatonic":["1P 3m 4P 5P 7m"],"minor six pentatonic":["1P 3m 4P 5P 6M"],"minor hexatonic":["1P 2M 3m 4P 5P 7M"],"flat three pentatonic":["1P 2M 3m 5P 6M",["kumoi"]],"flat six pentatonic":["1P 2M 3M 5P 6m"],"major flat two pentatonic":["1P 2m 3M 5P 6M"],"whole tone pentatonic":["1P 3M 5d 6m 7m"],"ionian pentatonic":["1P 3M 4P 5P 7M"],"lydian #5P pentatonic":["1P 3M 4A 5A 7M"],"lydian dominant pentatonic":["1P 3M 4A 5P 7m"],"minor #7M pentatonic":["1P 3m 4P 5P 7M"],"super locrian pentatonic":["1P 3m 4d 5d 7m"],"in-sen":["1P 2m 4P 5P 7m"],iwato:["1P 2m 4P 5d 7m"],hirajoshi:["1P 2M 3m 5P 6m"],kumoijoshi:["1P 2m 4P 5P 6m"],pelog:["1P 2m 3m 5P 6m"],"vietnamese 1":["1P 3m 4P 5P 6m"],"vietnamese 2":["1P 3m 4P 5P 7m"],prometheus:["1P 2M 3M 4A 6M 7m"],"prometheus neopolitan":["1P 2m 3M 4A 6M 7m"],ritusen:["1P 2M 4P 5P 6M"],scriabin:["1P 2m 3M 5P 6M"],piongio:["1P 2M 4P 5P 6M 7m"],"major blues":["1P 2M 3m 3M 5P 6M"],"minor blues":["1P 3m 4P 5d 5P 7m",["blues"]],"composite blues":["1P 2M 3m 3M 4P 5d 5P 6M 7m"],augmented:["1P 2A 3M 5P 5A 7M"],"augmented heptatonic":["1P 2A 3M 4P 5P 5A 7M"],"dorian #4":["1P 2M 3m 4A 5P 6M 7m"],"lydian diminished":["1P 2M 3m 4A 5P 6M 7M"],"whole tone":["1P 2M 3M 4A 5A 7m"],"leading whole tone":["1P 2M 3M 4A 5A 7m 7M"],"lydian minor":["1P 2M 3M 4A 5P 6m 7m"],"locrian major":["1P 2M 3M 4P 5d 6m 7m",["arabian"]],neopolitan:["1P 2m 3m 4P 5P 6m 7M"],"neopolitan minor":["1P 2m 3m 4P 5P 6m 7M"],"neopolitan major":["1P 2m 3m 4P 5P 6M 7M",["dorian b2"]],"neopolitan major pentatonic":["1P 3M 4P 5d 7m"],"romanian minor":["1P 2M 3m 5d 5P 6M 7m"],"double harmonic lydian":["1P 2m 3M 4A 5P 6m 7M"],"harmonic major":["1P 2M 3M 4P 5P 6m 7M"],"double harmonic major":["1P 2m 3M 4P 5P 6m 7M",["gypsy"]],egyptian:["1P 2M 4P 5P 7m"],"hungarian minor":["1P 2M 3m 4A 5P 6m 7M"],"hungarian major":["1P 2A 3M 4A 5P 6M 7m"],oriental:["1P 2m 3M 4P 5d 6M 7m"],"spanish heptatonic":["1P 2m 3m 3M 4P 5P 6m 7m"],flamenco:["1P 2m 3m 3M 4A 5P 7m"],balinese:["1P 2m 3m 4P 5P 6m 7M"],"todi raga":["1P 2m 3m 4A 5P 6m 7M"],"malkos raga":["1P 3m 4P 6m 7m"],"kafi raga":["1P 3m 3M 4P 5P 6M 7m 7M"],"purvi raga":["1P 2m 3M 4P 4A 5P 6m 7M"],persian:["1P 2m 3M 4P 5d 6m 7M"],bebop:["1P 2M 3M 4P 5P 6M 7m 7M"],"bebop dominant":["1P 2M 3M 4P 5P 6M 7m 7M"],"bebop minor":["1P 2M 3m 3M 4P 5P 6M 7m"],"bebop major":["1P 2M 3M 4P 5P 5A 6M 7M"],"bebop locrian":["1P 2m 3m 4P 5d 5P 6m 7m"],"minor bebop":["1P 2M 3m 4P 5P 6m 7m 7M"],"mystery #1":["1P 2m 3M 5d 6m 7m"],enigmatic:["1P 2m 3M 5d 6m 7m 7M"],"minor six diminished":["1P 2M 3m 4P 5P 6m 6M 7M"],"ionian augmented":["1P 2M 3M 4P 5A 6M 7M"],"lydian #9":["1P 2m 3M 4A 5P 6M 7M"],ichikosucho:["1P 2M 3M 4P 5d 5P 6M 7M"],"six tone symmetric":["1P 2m 3M 4P 5A 6M"]}},function(t){t.exports={4:["1P 4P 7m 10m",["quartal"]],5:["1P 5P"],7:["1P 3M 5P 7m",["Dominant","Dom"]],9:["1P 3M 5P 7m 9M",["79"]],11:["1P 5P 7m 9M 11P"],13:["1P 3M 5P 7m 9M 13M",["13_"]],64:["5P 8P 10M"],M:["1P 3M 5P",["Major",""]],"M#5":["1P 3M 5A",["augmented","maj#5","Maj#5","+","aug"]],"M#5add9":["1P 3M 5A 9M",["+add9"]],M13:["1P 3M 5P 7M 9M 13M",["maj13","Maj13"]],"M13#11":["1P 3M 5P 7M 9M 11A 13M",["maj13#11","Maj13#11","M13+4","M13#4"]],M6:["1P 3M 5P 13M",["6"]],"M6#11":["1P 3M 5P 6M 11A",["M6b5","6#11","6b5"]],M69:["1P 3M 5P 6M 9M",["69"]],"M69#11":["1P 3M 5P 6M 9M 11A"],"M7#11":["1P 3M 5P 7M 11A",["maj7#11","Maj7#11","M7+4","M7#4"]],"M7#5":["1P 3M 5A 7M",["maj7#5","Maj7#5","maj9#5","M7+"]],"M7#5sus4":["1P 4P 5A 7M"],"M7#9#11":["1P 3M 5P 7M 9A 11A"],M7add13:["1P 3M 5P 6M 7M 9M"],M7b5:["1P 3M 5d 7M"],M7b6:["1P 3M 6m 7M"],M7b9:["1P 3M 5P 7M 9m"],M7sus4:["1P 4P 5P 7M"],M9:["1P 3M 5P 7M 9M",["maj9","Maj9"]],"M9#11":["1P 3M 5P 7M 9M 11A",["maj9#11","Maj9#11","M9+4","M9#4"]],"M9#5":["1P 3M 5A 7M 9M",["Maj9#5"]],"M9#5sus4":["1P 4P 5A 7M 9M"],M9b5:["1P 3M 5d 7M 9M"],M9sus4:["1P 4P 5P 7M 9M"],Madd9:["1P 3M 5P 9M",["2","add9","add2"]],Maj7:["1P 3M 5P 7M",["maj7","M7"]],Mb5:["1P 3M 5d"],Mb6:["1P 3M 13m"],Msus2:["1P 2M 5P",["add9no3","sus2"]],Msus4:["1P 4P 5P",["sus","sus4"]],Maddb9:["1P 3M 5P 9m"],"11b9":["1P 5P 7m 9m 11P"],"13#11":["1P 3M 5P 7m 9M 11A 13M",["13+4","13#4"]],"13#9":["1P 3M 5P 7m 9A 13M",["13#9_"]],"13#9#11":["1P 3M 5P 7m 9A 11A 13M"],"13b5":["1P 3M 5d 6M 7m 9M"],"13b9":["1P 3M 5P 7m 9m 13M"],"13b9#11":["1P 3M 5P 7m 9m 11A 13M"],"13no5":["1P 3M 7m 9M 13M"],"13sus4":["1P 4P 5P 7m 9M 13M",["13sus"]],"69#11":["1P 3M 5P 6M 9M 11A"],"7#11":["1P 3M 5P 7m 11A",["7+4","7#4","7#11_","7#4_"]],"7#11b13":["1P 3M 5P 7m 11A 13m",["7b5b13"]],"7#5":["1P 3M 5A 7m",["+7","7aug","aug7"]],"7#5#9":["1P 3M 5A 7m 9A",["7alt","7#5#9_","7#9b13_"]],"7#5b9":["1P 3M 5A 7m 9m"],"7#5b9#11":["1P 3M 5A 7m 9m 11A"],"7#5sus4":["1P 4P 5A 7m"],"7#9":["1P 3M 5P 7m 9A",["7#9_"]],"7#9#11":["1P 3M 5P 7m 9A 11A",["7b5#9"]],"7#9#11b13":["1P 3M 5P 7m 9A 11A 13m"],"7#9b13":["1P 3M 5P 7m 9A 13m"],"7add6":["1P 3M 5P 7m 13M",["67","7add13"]],"7b13":["1P 3M 7m 13m"],"7b5":["1P 3M 5d 7m"],"7b6":["1P 3M 5P 6m 7m"],"7b9":["1P 3M 5P 7m 9m"],"7b9#11":["1P 3M 5P 7m 9m 11A",["7b5b9"]],"7b9#9":["1P 3M 5P 7m 9m 9A"],"7b9b13":["1P 3M 5P 7m 9m 13m"],"7b9b13#11":["1P 3M 5P 7m 9m 11A 13m",["7b9#11b13","7b5b9b13"]],"7no5":["1P 3M 7m"],"7sus4":["1P 4P 5P 7m",["7sus"]],"7sus4b9":["1P 4P 5P 7m 9m",["susb9","7susb9","7b9sus","7b9sus4","phryg"]],"7sus4b9b13":["1P 4P 5P 7m 9m 13m",["7b9b13sus4"]],"9#11":["1P 3M 5P 7m 9M 11A",["9+4","9#4","9#11_","9#4_"]],"9#11b13":["1P 3M 5P 7m 9M 11A 13m",["9b5b13"]],"9#5":["1P 3M 5A 7m 9M",["9+"]],"9#5#11":["1P 3M 5A 7m 9M 11A"],"9b13":["1P 3M 7m 9M 13m"],"9b5":["1P 3M 5d 7m 9M"],"9no5":["1P 3M 7m 9M"],"9sus4":["1P 4P 5P 7m 9M",["9sus"]],m:["1P 3m 5P"],"m#5":["1P 3m 5A",["m+","mb6"]],m11:["1P 3m 5P 7m 9M 11P",["_11"]],"m11A 5":["1P 3m 6m 7m 9M 11P"],m11b5:["1P 3m 7m 12d 2M 4P",["h11","_11b5"]],m13:["1P 3m 5P 7m 9M 11P 13M",["_13"]],m6:["1P 3m 4P 5P 13M",["_6"]],m69:["1P 3m 5P 6M 9M",["_69"]],m7:["1P 3m 5P 7m",["minor7","_","_7"]],"m7#5":["1P 3m 6m 7m"],m7add11:["1P 3m 5P 7m 11P",["m7add4"]],m7b5:["1P 3m 5d 7m",["half-diminished","h7","_7b5"]],m9:["1P 3m 5P 7m 9M",["_9"]],"m9#5":["1P 3m 6m 7m 9M"],m9b5:["1P 3m 7m 12d 2M",["h9","-9b5"]],mMaj7:["1P 3m 5P 7M",["mM7","_M7"]],mMaj7b6:["1P 3m 5P 6m 7M",["mM7b6"]],mM9:["1P 3m 5P 7M 9M",["mMaj9","-M9"]],mM9b6:["1P 3m 5P 6m 7M 9M",["mMaj9b6"]],mb6M7:["1P 3m 6m 7M"],mb6b9:["1P 3m 6m 9m"],o:["1P 3m 5d",["mb5","dim"]],o7:["1P 3m 5d 13M",["diminished","m6b5","dim7"]],o7M7:["1P 3m 5d 6M 7M"],oM7:["1P 3m 5d 7M"],sus24:["1P 2M 4P 5P",["sus4add9"]],"+add#9":["1P 3M 5A 9A"],madd4:["1P 3m 4P 5P"],madd9:["1P 3m 5P 9M"]}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,o=i(40),r=(n=o)&&n.__esModule?n:{default:n};e.default=r.default},function(t,e,i){"use strict";function n(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}i.d(e,"a",function(){return n})},,function(t,e,i){"use strict";var n=i(11),o="function"===typeof Symbol&&Symbol.for,r=o?Symbol.for("react.element"):60103,s=o?Symbol.for("react.portal"):60106,a=o?Symbol.for("react.fragment"):60107,l=o?Symbol.for("react.strict_mode"):60108,u=o?Symbol.for("react.profiler"):60114,h=o?Symbol.for("react.provider"):60109,c=o?Symbol.for("react.context"):60110,d=o?Symbol.for("react.async_mode"):60111,p=o?Symbol.for("react.forward_ref"):60112;o&&Symbol.for("react.placeholder");var f="function"===typeof Symbol&&Symbol.iterator;function m(t){for(var e=arguments.length-1,i="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=0;n<e;n++)i+="&args[]="+encodeURIComponent(arguments[n+1]);!function(t,e,i,n,o,r,s,a){if(!t){if(t=void 0,void 0===e)t=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[i,n,o,r,s,a],u=0;(t=Error(e.replace(/%s/g,function(){return l[u++]}))).name="Invariant Violation"}throw t.framesToPop=1,t}}(!1,"Minified React error #"+t+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",i)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v={};function g(t,e,i){this.props=t,this.context=e,this.refs=v,this.updater=i||y}function _(){}function b(t,e,i){this.props=t,this.context=e,this.refs=v,this.updater=i||y}g.prototype.isReactComponent={},g.prototype.setState=function(t,e){"object"!==typeof t&&"function"!==typeof t&&null!=t&&m("85"),this.updater.enqueueSetState(this,t,e,"setState")},g.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")},_.prototype=g.prototype;var S=b.prototype=new _;S.constructor=b,n(S,g.prototype),S.isPureReactComponent=!0;var T={current:null,currentDispatcher:null},w=Object.prototype.hasOwnProperty,P={key:!0,ref:!0,__self:!0,__source:!0};function x(t,e,i){var n=void 0,o={},s=null,a=null;if(null!=e)for(n in void 0!==e.ref&&(a=e.ref),void 0!==e.key&&(s=""+e.key),e)w.call(e,n)&&!P.hasOwnProperty(n)&&(o[n]=e[n]);var l=arguments.length-2;if(1===l)o.children=i;else if(1<l){for(var u=Array(l),h=0;h<l;h++)u[h]=arguments[h+2];o.children=u}if(t&&t.defaultProps)for(n in l=t.defaultProps)void 0===o[n]&&(o[n]=l[n]);return{$$typeof:r,type:t,key:s,ref:a,props:o,_owner:T.current}}function k(t){return"object"===typeof t&&null!==t&&t.$$typeof===r}var A=/\/+/g,M=[];function C(t,e,i,n){if(M.length){var o=M.pop();return o.result=t,o.keyPrefix=e,o.func=i,o.context=n,o.count=0,o}return{result:t,keyPrefix:e,func:i,context:n,count:0}}function O(t){t.result=null,t.keyPrefix=null,t.func=null,t.context=null,t.count=0,10>M.length&&M.push(t)}function F(t,e,i){return null==t?0:function t(e,i,n,o){var a=typeof e;"undefined"!==a&&"boolean"!==a||(e=null);var l=!1;if(null===e)l=!0;else switch(a){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case r:case s:l=!0}}if(l)return n(o,e,""===i?"."+E(e,0):i),1;if(l=0,i=""===i?".":i+":",Array.isArray(e))for(var u=0;u<e.length;u++){var h=i+E(a=e[u],u);l+=t(a,h,n,o)}else if(h=null===e||"object"!==typeof e?null:"function"===typeof(h=f&&e[f]||e["@@iterator"])?h:null,"function"===typeof h)for(e=h.call(e),u=0;!(a=e.next()).done;)l+=t(a=a.value,h=i+E(a,u++),n,o);else"object"===a&&m("31","[object Object]"===(n=""+e)?"object with keys {"+Object.keys(e).join(", ")+"}":n,"");return l}(t,"",e,i)}function E(t,e){return"object"===typeof t&&null!==t&&null!=t.key?function(t){var e={"=":"=0",":":"=2"};return"$"+(""+t).replace(/[=:]/g,function(t){return e[t]})}(t.key):e.toString(36)}function R(t,e){t.func.call(t.context,e,t.count++)}function N(t,e,i){var n=t.result,o=t.keyPrefix;t=t.func.call(t.context,e,t.count++),Array.isArray(t)?K(t,n,i,function(t){return t}):null!=t&&(k(t)&&(t=function(t,e){return{$$typeof:r,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}(t,o+(!t.key||e&&e.key===t.key?"":(""+t.key).replace(A,"$&/")+"/")+i)),n.push(t))}function K(t,e,i,n,o){var r="";null!=i&&(r=(""+i).replace(A,"$&/")+"/"),F(t,N,e=C(e,r,n,o)),O(e)}var D={Children:{map:function(t,e,i){if(null==t)return t;var n=[];return K(t,n,null,e,i),n},forEach:function(t,e,i){if(null==t)return t;F(t,R,e=C(null,null,e,i)),O(e)},count:function(t){return F(t,function(){return null},null)},toArray:function(t){var e=[];return K(t,e,null,function(t){return t}),e},only:function(t){return k(t)||m("143"),t}},createRef:function(){return{current:null}},Component:g,PureComponent:b,createContext:function(t,e){return void 0===e&&(e=null),(t={$$typeof:c,_calculateChangedBits:e,_currentValue:t,_currentValue2:t,Provider:null,Consumer:null,unstable_read:null}).Provider={$$typeof:h,_context:t},t.Consumer=t,t.unstable_read=function(t,e){var i=T.currentDispatcher;return null===i&&m("277"),i.readContext(t,e)}.bind(null,t),t},forwardRef:function(t){return{$$typeof:p,render:t}},Fragment:a,StrictMode:l,unstable_AsyncMode:d,unstable_Profiler:u,createElement:x,cloneElement:function(t,e,i){(null===t||void 0===t)&&m("267",t);var o=void 0,s=n({},t.props),a=t.key,l=t.ref,u=t._owner;if(null!=e){void 0!==e.ref&&(l=e.ref,u=T.current),void 0!==e.key&&(a=""+e.key);var h=void 0;for(o in t.type&&t.type.defaultProps&&(h=t.type.defaultProps),e)w.call(e,o)&&!P.hasOwnProperty(o)&&(s[o]=void 0===e[o]&&void 0!==h?h[o]:e[o])}if(1===(o=arguments.length-2))s.children=i;else if(1<o){h=Array(o);for(var c=0;c<o;c++)h[c]=arguments[c+2];s.children=h}return{$$typeof:r,type:t.type,key:a,ref:l,props:s,_owner:u}},createFactory:function(t){var e=x.bind(null,t);return e.type=t,e},isValidElement:k,version:"16.5.0",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:T,assign:n}},L={default:D},q=L&&D||L;t.exports=q.default||q},function(t,e,i){"use strict";var n=i(0),o=i(11),r=i(23);function s(t){for(var e=arguments.length-1,i="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=0;n<e;n++)i+="&args[]="+encodeURIComponent(arguments[n+1]);!function(t,e,i,n,o,r,s,a){if(!t){if(t=void 0,void 0===e)t=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[i,n,o,r,s,a],u=0;(t=Error(e.replace(/%s/g,function(){return l[u++]}))).name="Invariant Violation"}throw t.framesToPop=1,t}}(!1,"Minified React error #"+t+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",i)}n||s("227");var a=!1,l=null,u=!1,h=null,c={onError:function(t){a=!0,l=t}};function d(t,e,i,n,o,r,s,u,h){a=!1,l=null,function(t,e,i,n,o,r,s,a,l){var u=Array.prototype.slice.call(arguments,3);try{e.apply(i,u)}catch(h){this.onError(h)}}.apply(c,arguments)}var p=null,f={};function m(){if(p)for(var t in f){var e=f[t],i=p.indexOf(t);if(-1<i||s("96",t),!v[i])for(var n in e.extractEvents||s("97",t),v[i]=e,i=e.eventTypes){var o=void 0,r=i[n],a=e,l=n;g.hasOwnProperty(l)&&s("99",l),g[l]=r;var u=r.phasedRegistrationNames;if(u){for(o in u)u.hasOwnProperty(o)&&y(u[o],a,l);o=!0}else r.registrationName?(y(r.registrationName,a,l),o=!0):o=!1;o||s("98",n,t)}}}function y(t,e,i){_[t]&&s("100",t),_[t]=e,b[t]=e.eventTypes[i].dependencies}var v=[],g={},_={},b={},S=null,T=null,w=null;function P(t,e,i,n){e=t.type||"unknown-event",t.currentTarget=w(n),function(t,e,i,n,o,r,c,p,f){if(d.apply(this,arguments),a){if(a){var m=l;a=!1,l=null}else s("198"),m=void 0;u||(u=!0,h=m)}}(e,i,void 0,t),t.currentTarget=null}function x(t,e){return null==e&&s("30"),null==t?e:Array.isArray(t)?Array.isArray(e)?(t.push.apply(t,e),t):(t.push(e),t):Array.isArray(e)?[t].concat(e):[t,e]}function k(t,e,i){Array.isArray(t)?t.forEach(e,i):t&&e.call(i,t)}var A=null;function M(t,e){if(t){var i=t._dispatchListeners,n=t._dispatchInstances;if(Array.isArray(i))for(var o=0;o<i.length&&!t.isPropagationStopped();o++)P(t,e,i[o],n[o]);else i&&P(t,e,i,n);t._dispatchListeners=null,t._dispatchInstances=null,t.isPersistent()||t.constructor.release(t)}}function C(t){return M(t,!0)}function O(t){return M(t,!1)}var F=function(t){p&&s("101"),p=Array.prototype.slice.call(t),m()},E=function(t){var e,i=!1;for(e in t)if(t.hasOwnProperty(e)){var n=t[e];f.hasOwnProperty(e)&&f[e]===n||(f[e]&&s("102",e),f[e]=n,i=!0)}i&&m()};function R(t,e){var i=t.stateNode;if(!i)return null;var n=S(i);if(!n)return null;i=n[e];t:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":(n=!n.disabled)||(n=!("button"===(t=t.type)||"input"===t||"select"===t||"textarea"===t)),t=!n;break t;default:t=!1}return t?null:(i&&"function"!==typeof i&&s("231",e,typeof i),i)}function N(t,e){if(null!==t&&(A=x(A,t)),t=A,A=null,t&&(k(t,e?C:O),A&&s("95"),u))throw e=h,u=!1,h=null,e}var K=Math.random().toString(36).slice(2),D="__reactInternalInstance$"+K,L="__reactEventHandlers$"+K;function q(t){if(t[D])return t[D];for(;!t[D];){if(!t.parentNode)return null;t=t.parentNode}return 7===(t=t[D]).tag||8===t.tag?t:null}function I(t){return!(t=t[D])||7!==t.tag&&8!==t.tag?null:t}function U(t){if(7===t.tag||8===t.tag)return t.stateNode;s("33")}function V(t){return t[L]||null}function B(t){do{t=t.return}while(t&&7!==t.tag);return t||null}function G(t,e,i){(e=R(t,i.dispatchConfig.phasedRegistrationNames[e]))&&(i._dispatchListeners=x(i._dispatchListeners,e),i._dispatchInstances=x(i._dispatchInstances,t))}function j(t){if(t&&t.dispatchConfig.phasedRegistrationNames){for(var e=t._targetInst,i=[];e;)i.push(e),e=B(e);for(e=i.length;0<e--;)G(i[e],"captured",t);for(e=0;e<i.length;e++)G(i[e],"bubbled",t)}}function z(t,e,i){t&&i&&i.dispatchConfig.registrationName&&(e=R(t,i.dispatchConfig.registrationName))&&(i._dispatchListeners=x(i._dispatchListeners,e),i._dispatchInstances=x(i._dispatchInstances,t))}function W(t){t&&t.dispatchConfig.registrationName&&z(t._targetInst,null,t)}function H(t){k(t,j)}var X=!("undefined"===typeof window||!window.document||!window.document.createElement);function Q(t,e){var i={};return i[t.toLowerCase()]=e.toLowerCase(),i["Webkit"+t]="webkit"+e,i["Moz"+t]="moz"+e,i}var Y={animationend:Q("Animation","AnimationEnd"),animationiteration:Q("Animation","AnimationIteration"),animationstart:Q("Animation","AnimationStart"),transitionend:Q("Transition","TransitionEnd")},$={},Z={};function J(t){if($[t])return $[t];if(!Y[t])return t;var e,i=Y[t];for(e in i)if(i.hasOwnProperty(e)&&e in Z)return $[t]=i[e];return t}X&&(Z=document.createElement("div").style,"AnimationEvent"in window||(delete Y.animationend.animation,delete Y.animationiteration.animation,delete Y.animationstart.animation),"TransitionEvent"in window||delete Y.transitionend.transition);var tt=J("animationend"),et=J("animationiteration"),it=J("animationstart"),nt=J("transitionend"),ot="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),rt=null,st=null,at=null;function lt(){if(at)return at;var t,e,i=st,n=i.length,o="value"in rt?rt.value:rt.textContent,r=o.length;for(t=0;t<n&&i[t]===o[t];t++);var s=n-t;for(e=1;e<=s&&i[n-e]===o[r-e];e++);return at=o.slice(t,1<e?1-e:void 0)}function ut(){return!0}function ht(){return!1}function ct(t,e,i,n){for(var o in this.dispatchConfig=t,this._targetInst=e,this.nativeEvent=i,t=this.constructor.Interface)t.hasOwnProperty(o)&&((e=t[o])?this[o]=e(i):"target"===o?this.target=n:this[o]=i[o]);return this.isDefaultPrevented=(null!=i.defaultPrevented?i.defaultPrevented:!1===i.returnValue)?ut:ht,this.isPropagationStopped=ht,this}function dt(t,e,i,n){if(this.eventPool.length){var o=this.eventPool.pop();return this.call(o,t,e,i,n),o}return new this(t,e,i,n)}function pt(t){t instanceof this||s("279"),t.destructor(),10>this.eventPool.length&&this.eventPool.push(t)}function ft(t){t.eventPool=[],t.getPooled=dt,t.release=pt}o(ct.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():"unknown"!==typeof t.returnValue&&(t.returnValue=!1),this.isDefaultPrevented=ut)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():"unknown"!==typeof t.cancelBubble&&(t.cancelBubble=!0),this.isPropagationStopped=ut)},persist:function(){this.isPersistent=ut},isPersistent:ht,destructor:function(){var t,e=this.constructor.Interface;for(t in e)this[t]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=ht,this._dispatchInstances=this._dispatchListeners=null}}),ct.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},ct.extend=function(t){function e(){}function i(){return n.apply(this,arguments)}var n=this;e.prototype=n.prototype;var r=new e;return o(r,i.prototype),i.prototype=r,i.prototype.constructor=i,i.Interface=o({},n.Interface,t),i.extend=n.extend,ft(i),i},ft(ct);var mt=ct.extend({data:null}),yt=ct.extend({data:null}),vt=[9,13,27,32],gt=X&&"CompositionEvent"in window,_t=null;X&&"documentMode"in document&&(_t=document.documentMode);var bt=X&&"TextEvent"in window&&!_t,St=X&&(!gt||_t&&8<_t&&11>=_t),Tt=String.fromCharCode(32),wt={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},Pt=!1;function xt(t,e){switch(t){case"keyup":return-1!==vt.indexOf(e.keyCode);case"keydown":return 229!==e.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function kt(t){return"object"===typeof(t=t.detail)&&"data"in t?t.data:null}var At=!1;var Mt={eventTypes:wt,extractEvents:function(t,e,i,n){var o=void 0,r=void 0;if(gt)t:{switch(t){case"compositionstart":o=wt.compositionStart;break t;case"compositionend":o=wt.compositionEnd;break t;case"compositionupdate":o=wt.compositionUpdate;break t}o=void 0}else At?xt(t,i)&&(o=wt.compositionEnd):"keydown"===t&&229===i.keyCode&&(o=wt.compositionStart);return o?(St&&"ko"!==i.locale&&(At||o!==wt.compositionStart?o===wt.compositionEnd&&At&&(r=lt()):(st="value"in(rt=n)?rt.value:rt.textContent,At=!0)),o=mt.getPooled(o,e,i,n),r?o.data=r:null!==(r=kt(i))&&(o.data=r),H(o),r=o):r=null,(t=bt?function(t,e){switch(t){case"compositionend":return kt(e);case"keypress":return 32!==e.which?null:(Pt=!0,Tt);case"textInput":return(t=e.data)===Tt&&Pt?null:t;default:return null}}(t,i):function(t,e){if(At)return"compositionend"===t||!gt&&xt(t,e)?(t=lt(),at=st=rt=null,At=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return St&&"ko"!==e.locale?null:e.data;default:return null}}(t,i))?((e=yt.getPooled(wt.beforeInput,e,i,n)).data=t,H(e)):e=null,null===r?e:null===e?r:[r,e]}},Ct=null,Ot=null,Ft=null;function Et(t){if(t=T(t)){"function"!==typeof Ct&&s("280");var e=S(t.stateNode);Ct(t.stateNode,t.type,e)}}function Rt(t){Ot?Ft?Ft.push(t):Ft=[t]:Ot=t}function Nt(){if(Ot){var t=Ot,e=Ft;if(Ft=Ot=null,Et(t),e)for(t=0;t<e.length;t++)Et(e[t])}}function Kt(t,e){return t(e)}function Dt(t,e,i){return t(e,i)}function Lt(){}var qt=!1;function It(t,e){if(qt)return t(e);qt=!0;try{return Kt(t,e)}finally{qt=!1,(null!==Ot||null!==Ft)&&(Lt(),Nt())}}var Ut={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Vt(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return"input"===e?!!Ut[t.type]:"textarea"===e}function Bt(t){return(t=t.target||t.srcElement||window).correspondingUseElement&&(t=t.correspondingUseElement),3===t.nodeType?t.parentNode:t}function Gt(t){if(!X)return!1;var e=(t="on"+t)in document;return e||((e=document.createElement("div")).setAttribute(t,"return;"),e="function"===typeof e[t]),e}function jt(t){var e=t.type;return(t=t.nodeName)&&"input"===t.toLowerCase()&&("checkbox"===e||"radio"===e)}function zt(t){t._valueTracker||(t._valueTracker=function(t){var e=jt(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&"undefined"!==typeof i&&"function"===typeof i.get&&"function"===typeof i.set){var o=i.get,r=i.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return o.call(this)},set:function(t){n=""+t,r.call(this,t)}}),Object.defineProperty(t,e,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(t){n=""+t},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}(t))}function Wt(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var i=e.getValue(),n="";return t&&(n=jt(t)?t.checked?"true":"false":t.value),(t=n)!==i&&(e.setValue(t),!0)}var Ht=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Xt=/^(.*)[\\\/]/,Qt="function"===typeof Symbol&&Symbol.for,Yt=Qt?Symbol.for("react.element"):60103,$t=Qt?Symbol.for("react.portal"):60106,Zt=Qt?Symbol.for("react.fragment"):60107,Jt=Qt?Symbol.for("react.strict_mode"):60108,te=Qt?Symbol.for("react.profiler"):60114,ee=Qt?Symbol.for("react.provider"):60109,ie=Qt?Symbol.for("react.context"):60110,ne=Qt?Symbol.for("react.async_mode"):60111,oe=Qt?Symbol.for("react.forward_ref"):60112,re=Qt?Symbol.for("react.placeholder"):60113,se="function"===typeof Symbol&&Symbol.iterator;function ae(t){return null===t||"object"!==typeof t?null:"function"===typeof(t=se&&t[se]||t["@@iterator"])?t:null}function le(t){if(null==t)return null;if("function"===typeof t)return t.displayName||t.name||null;if("string"===typeof t)return t;switch(t){case ne:return"AsyncMode";case Zt:return"Fragment";case $t:return"Portal";case te:return"Profiler";case Jt:return"StrictMode";case re:return"Placeholder"}if("object"===typeof t){switch(t.$$typeof){case ie:return"Context.Consumer";case ee:return"Context.Provider";case oe:return""!==(t=(t=t.render).displayName||t.name||"")?"ForwardRef("+t+")":"ForwardRef"}if("function"===typeof t.then&&(t=1===t._reactStatus?t._reactResult:null))return le(t)}return null}function ue(t){var e="";do{t:switch(t.tag){case 4:case 0:case 1:case 2:case 3:case 7:case 10:var i=t._debugOwner,n=t._debugSource,o=le(t.type),r=null;i&&(r=le(i.type)),i=o,o="",n?o=" (at "+n.fileName.replace(Xt,"")+":"+n.lineNumber+")":r&&(o=" (created by "+r+")"),r="\n    in "+(i||"Unknown")+o;break t;default:r=""}e+=r,t=t.return}while(t);return e}var he=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ce=Object.prototype.hasOwnProperty,de={},pe={};function fe(t,e,i,n,o){this.acceptsBooleans=2===e||3===e||4===e,this.attributeName=n,this.attributeNamespace=o,this.mustUseProperty=i,this.propertyName=t,this.type=e}var me={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){me[t]=new fe(t,0,!1,t,null)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];me[e]=new fe(e,1,!1,t[1],null)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){me[t]=new fe(t,2,!1,t.toLowerCase(),null)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){me[t]=new fe(t,2,!1,t,null)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){me[t]=new fe(t,3,!1,t.toLowerCase(),null)}),["checked","multiple","muted","selected"].forEach(function(t){me[t]=new fe(t,3,!0,t,null)}),["capture","download"].forEach(function(t){me[t]=new fe(t,4,!1,t,null)}),["cols","rows","size","span"].forEach(function(t){me[t]=new fe(t,6,!1,t,null)}),["rowSpan","start"].forEach(function(t){me[t]=new fe(t,5,!1,t.toLowerCase(),null)});var ye=/[\-:]([a-z])/g;function ve(t){return t[1].toUpperCase()}function ge(t,e,i,n){var o=me.hasOwnProperty(e)?me[e]:null;(null!==o?0===o.type:!n&&(2<e.length&&("o"===e[0]||"O"===e[0])&&("n"===e[1]||"N"===e[1])))||(function(t,e,i,n){if(null===e||"undefined"===typeof e||function(t,e,i,n){if(null!==i&&0===i.type)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return!n&&(null!==i?!i.acceptsBooleans:"data-"!==(t=t.toLowerCase().slice(0,5))&&"aria-"!==t);default:return!1}}(t,e,i,n))return!0;if(n)return!1;if(null!==i)switch(i.type){case 3:return!e;case 4:return!1===e;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}(e,i,o,n)&&(i=null),n||null===o?function(t){return!!ce.call(pe,t)||!ce.call(de,t)&&(he.test(t)?pe[t]=!0:(de[t]=!0,!1))}(e)&&(null===i?t.removeAttribute(e):t.setAttribute(e,""+i)):o.mustUseProperty?t[o.propertyName]=null===i?3!==o.type&&"":i:(e=o.attributeName,n=o.attributeNamespace,null===i?t.removeAttribute(e):(i=3===(o=o.type)||4===o&&!0===i?"":""+i,n?t.setAttributeNS(n,e,i):t.setAttribute(e,i))))}function _e(t){switch(typeof t){case"boolean":case"number":case"object":case"string":case"undefined":return t;default:return""}}function be(t,e){var i=e.checked;return o({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=i?i:t._wrapperState.initialChecked})}function Se(t,e){var i=null==e.defaultValue?"":e.defaultValue,n=null!=e.checked?e.checked:e.defaultChecked;i=_e(null!=e.value?e.value:i),t._wrapperState={initialChecked:n,initialValue:i,controlled:"checkbox"===e.type||"radio"===e.type?null!=e.checked:null!=e.value}}function Te(t,e){null!=(e=e.checked)&&ge(t,"checked",e,!1)}function we(t,e){Te(t,e);var i=_e(e.value),n=e.type;if(null!=i)"number"===n?(0===i&&""===t.value||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if("submit"===n||"reset"===n)return void t.removeAttribute("value");e.hasOwnProperty("value")?xe(t,e.type,i):e.hasOwnProperty("defaultValue")&&xe(t,e.type,_e(e.defaultValue)),null==e.checked&&null!=e.defaultChecked&&(t.defaultChecked=!!e.defaultChecked)}function Pe(t,e,i){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!("submit"!==n&&"reset"!==n||void 0!==e.value&&null!==e.value))return;e=""+t._wrapperState.initialValue,n=t.value,i||e===n||(t.value=e),t.defaultValue=e}""!==(i=t.name)&&(t.name=""),t.defaultChecked=!t.defaultChecked,t.defaultChecked=!!t._wrapperState.initialChecked,""!==i&&(t.name=i)}function xe(t,e,i){"number"===e&&t.ownerDocument.activeElement===t||(null==i?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(ye,ve);me[e]=new fe(e,1,!1,t,null)}),"xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(ye,ve);me[e]=new fe(e,1,!1,t,"http://www.w3.org/1999/xlink")}),["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(ye,ve);me[e]=new fe(e,1,!1,t,"http://www.w3.org/XML/1998/namespace")}),me.tabIndex=new fe("tabIndex",1,!1,"tabindex",null);var ke={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function Ae(t,e,i){return(t=ct.getPooled(ke.change,t,e,i)).type="change",Rt(i),H(t),t}var Me=null,Ce=null;function Oe(t){N(t,!1)}function Fe(t){if(Wt(U(t)))return t}function Ee(t,e){if("change"===t)return e}var Re=!1;function Ne(){Me&&(Me.detachEvent("onpropertychange",Ke),Ce=Me=null)}function Ke(t){"value"===t.propertyName&&Fe(Ce)&&It(Oe,t=Ae(Ce,t,Bt(t)))}function De(t,e,i){"focus"===t?(Ne(),Ce=i,(Me=e).attachEvent("onpropertychange",Ke)):"blur"===t&&Ne()}function Le(t){if("selectionchange"===t||"keyup"===t||"keydown"===t)return Fe(Ce)}function qe(t,e){if("click"===t)return Fe(e)}function Ie(t,e){if("input"===t||"change"===t)return Fe(e)}X&&(Re=Gt("input")&&(!document.documentMode||9<document.documentMode));var Ue={eventTypes:ke,_isInputEventSupported:Re,extractEvents:function(t,e,i,n){var o=e?U(e):window,r=void 0,s=void 0,a=o.nodeName&&o.nodeName.toLowerCase();if("select"===a||"input"===a&&"file"===o.type?r=Ee:Vt(o)?Re?r=Ie:(r=Le,s=De):(a=o.nodeName)&&"input"===a.toLowerCase()&&("checkbox"===o.type||"radio"===o.type)&&(r=qe),r&&(r=r(t,e)))return Ae(r,i,n);s&&s(t,o,e),"blur"===t&&(t=o._wrapperState)&&t.controlled&&"number"===o.type&&xe(o,"number",o.value)}},Ve=ct.extend({view:null,detail:null}),Be={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ge(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):!!(t=Be[t])&&!!e[t]}function je(){return Ge}var ze=0,We=0,He=!1,Xe=!1,Qe=Ve.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:je,button:null,buttons:null,relatedTarget:function(t){return t.relatedTarget||(t.fromElement===t.srcElement?t.toElement:t.fromElement)},movementX:function(t){if("movementX"in t)return t.movementX;var e=ze;return ze=t.screenX,He?"mousemove"===t.type?t.screenX-e:0:(He=!0,0)},movementY:function(t){if("movementY"in t)return t.movementY;var e=We;return We=t.screenY,Xe?"mousemove"===t.type?t.screenY-e:0:(Xe=!0,0)}}),Ye=Qe.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),$e={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",dependencies:["pointerout","pointerover"]}},Ze={eventTypes:$e,extractEvents:function(t,e,i,n){var o="mouseover"===t||"pointerover"===t,r="mouseout"===t||"pointerout"===t;if(o&&(i.relatedTarget||i.fromElement)||!r&&!o)return null;if(o=n.window===n?n:(o=n.ownerDocument)?o.defaultView||o.parentWindow:window,r?(r=e,e=(e=i.relatedTarget||i.toElement)?q(e):null):r=null,r===e)return null;var s=void 0,a=void 0,l=void 0,u=void 0;"mouseout"===t||"mouseover"===t?(s=Qe,a=$e.mouseLeave,l=$e.mouseEnter,u="mouse"):"pointerout"!==t&&"pointerover"!==t||(s=Ye,a=$e.pointerLeave,l=$e.pointerEnter,u="pointer");var h=null==r?o:U(r);if(o=null==e?o:U(e),(t=s.getPooled(a,r,i,n)).type=u+"leave",t.target=h,t.relatedTarget=o,(i=s.getPooled(l,e,i,n)).type=u+"enter",i.target=o,i.relatedTarget=h,n=e,r&&n)t:{for(o=n,u=0,s=e=r;s;s=B(s))u++;for(s=0,l=o;l;l=B(l))s++;for(;0<u-s;)e=B(e),u--;for(;0<s-u;)o=B(o),s--;for(;u--;){if(e===o||e===o.alternate)break t;e=B(e),o=B(o)}e=null}else e=null;for(o=e,e=[];r&&r!==o&&(null===(u=r.alternate)||u!==o);)e.push(r),r=B(r);for(r=[];n&&n!==o&&(null===(u=n.alternate)||u!==o);)r.push(n),n=B(n);for(n=0;n<e.length;n++)z(e[n],"bubbled",t);for(n=r.length;0<n--;)z(r[n],"captured",i);return[t,i]}},Je=Object.prototype.hasOwnProperty;function ti(t,e){return t===e?0!==t||0!==e||1/t===1/e:t!==t&&e!==e}function ei(t,e){if(ti(t,e))return!0;if("object"!==typeof t||null===t||"object"!==typeof e||null===e)return!1;var i=Object.keys(t),n=Object.keys(e);if(i.length!==n.length)return!1;for(n=0;n<i.length;n++)if(!Je.call(e,i[n])||!ti(t[i[n]],e[i[n]]))return!1;return!0}function ii(t){var e=t;if(t.alternate)for(;e.return;)e=e.return;else{if(0!==(2&e.effectTag))return 1;for(;e.return;)if(0!==(2&(e=e.return).effectTag))return 1}return 5===e.tag?2:3}function ni(t){2!==ii(t)&&s("188")}function oi(t){if(!(t=function(t){var e=t.alternate;if(!e)return 3===(e=ii(t))&&s("188"),1===e?null:t;for(var i=t,n=e;;){var o=i.return,r=o?o.alternate:null;if(!o||!r)break;if(o.child===r.child){for(var a=o.child;a;){if(a===i)return ni(o),t;if(a===n)return ni(o),e;a=a.sibling}s("188")}if(i.return!==n.return)i=o,n=r;else{a=!1;for(var l=o.child;l;){if(l===i){a=!0,i=o,n=r;break}if(l===n){a=!0,n=o,i=r;break}l=l.sibling}if(!a){for(l=r.child;l;){if(l===i){a=!0,i=r,n=o;break}if(l===n){a=!0,n=r,i=o;break}l=l.sibling}a||s("189")}}i.alternate!==n&&s("190")}return 5!==i.tag&&s("188"),i.stateNode.current===i?t:e}(t)))return null;for(var e=t;;){if(7===e.tag||8===e.tag)return e;if(e.child)e.child.return=e,e=e.child;else{if(e===t)break;for(;!e.sibling;){if(!e.return||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}}return null}var ri=ct.extend({animationName:null,elapsedTime:null,pseudoElement:null}),si=ct.extend({clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),ai=Ve.extend({relatedTarget:null});function li(t){var e=t.keyCode;return"charCode"in t?0===(t=t.charCode)&&13===e&&(t=13):t=e,10===t&&(t=13),32<=t||13===t?t:0}var ui={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},hi={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},ci=Ve.extend({key:function(t){if(t.key){var e=ui[t.key]||t.key;if("Unidentified"!==e)return e}return"keypress"===t.type?13===(t=li(t))?"Enter":String.fromCharCode(t):"keydown"===t.type||"keyup"===t.type?hi[t.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:je,charCode:function(t){return"keypress"===t.type?li(t):0},keyCode:function(t){return"keydown"===t.type||"keyup"===t.type?t.keyCode:0},which:function(t){return"keypress"===t.type?li(t):"keydown"===t.type||"keyup"===t.type?t.keyCode:0}}),di=Qe.extend({dataTransfer:null}),pi=Ve.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:je}),fi=ct.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),mi=Qe.extend({deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:null,deltaMode:null}),yi=[["abort","abort"],[tt,"animationEnd"],[et,"animationIteration"],[it,"animationStart"],["canplay","canPlay"],["canplaythrough","canPlayThrough"],["drag","drag"],["dragenter","dragEnter"],["dragexit","dragExit"],["dragleave","dragLeave"],["dragover","dragOver"],["durationchange","durationChange"],["emptied","emptied"],["encrypted","encrypted"],["ended","ended"],["error","error"],["gotpointercapture","gotPointerCapture"],["load","load"],["loadeddata","loadedData"],["loadedmetadata","loadedMetadata"],["loadstart","loadStart"],["lostpointercapture","lostPointerCapture"],["mousemove","mouseMove"],["mouseout","mouseOut"],["mouseover","mouseOver"],["playing","playing"],["pointermove","pointerMove"],["pointerout","pointerOut"],["pointerover","pointerOver"],["progress","progress"],["scroll","scroll"],["seeking","seeking"],["stalled","stalled"],["suspend","suspend"],["timeupdate","timeUpdate"],["toggle","toggle"],["touchmove","touchMove"],[nt,"transitionEnd"],["waiting","waiting"],["wheel","wheel"]],vi={},gi={};function _i(t,e){var i=t[0],n="on"+((t=t[1])[0].toUpperCase()+t.slice(1));e={phasedRegistrationNames:{bubbled:n,captured:n+"Capture"},dependencies:[i],isInteractive:e},vi[t]=e,gi[i]=e}[["blur","blur"],["cancel","cancel"],["click","click"],["close","close"],["contextmenu","contextMenu"],["copy","copy"],["cut","cut"],["auxclick","auxClick"],["dblclick","doubleClick"],["dragend","dragEnd"],["dragstart","dragStart"],["drop","drop"],["focus","focus"],["input","input"],["invalid","invalid"],["keydown","keyDown"],["keypress","keyPress"],["keyup","keyUp"],["mousedown","mouseDown"],["mouseup","mouseUp"],["paste","paste"],["pause","pause"],["play","play"],["pointercancel","pointerCancel"],["pointerdown","pointerDown"],["pointerup","pointerUp"],["ratechange","rateChange"],["reset","reset"],["seeked","seeked"],["submit","submit"],["touchcancel","touchCancel"],["touchend","touchEnd"],["touchstart","touchStart"],["volumechange","volumeChange"]].forEach(function(t){_i(t,!0)}),yi.forEach(function(t){_i(t,!1)});var bi={eventTypes:vi,isInteractiveTopLevelEventType:function(t){return void 0!==(t=gi[t])&&!0===t.isInteractive},extractEvents:function(t,e,i,n){var o=gi[t];if(!o)return null;switch(t){case"keypress":if(0===li(i))return null;case"keydown":case"keyup":t=ci;break;case"blur":case"focus":t=ai;break;case"click":if(2===i.button)return null;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":t=Qe;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":t=di;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":t=pi;break;case tt:case et:case it:t=ri;break;case nt:t=fi;break;case"scroll":t=Ve;break;case"wheel":t=mi;break;case"copy":case"cut":case"paste":t=si;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":t=Ye;break;default:t=ct}return H(e=t.getPooled(o,e,i,n)),e}},Si=bi.isInteractiveTopLevelEventType,Ti=[];function wi(t){var e=t.targetInst,i=e;do{if(!i){t.ancestors.push(i);break}var n;for(n=i;n.return;)n=n.return;if(!(n=5!==n.tag?null:n.stateNode.containerInfo))break;t.ancestors.push(i),i=q(n)}while(i);for(i=0;i<t.ancestors.length;i++){e=t.ancestors[i];var o=Bt(t.nativeEvent);n=t.topLevelType;for(var r=t.nativeEvent,s=null,a=0;a<v.length;a++){var l=v[a];l&&(l=l.extractEvents(n,e,r,o))&&(s=x(s,l))}N(s,!1)}}var Pi=!0;function xi(t,e){if(!e)return null;var i=(Si(t)?Ai:Mi).bind(null,t);e.addEventListener(t,i,!1)}function ki(t,e){if(!e)return null;var i=(Si(t)?Ai:Mi).bind(null,t);e.addEventListener(t,i,!0)}function Ai(t,e){Dt(Mi,t,e)}function Mi(t,e){if(Pi){var i=Bt(e);if(null===(i=q(i))||"number"!==typeof i.tag||2===ii(i)||(i=null),Ti.length){var n=Ti.pop();n.topLevelType=t,n.nativeEvent=e,n.targetInst=i,t=n}else t={topLevelType:t,nativeEvent:e,targetInst:i,ancestors:[]};try{It(wi,t)}finally{t.topLevelType=null,t.nativeEvent=null,t.targetInst=null,t.ancestors.length=0,10>Ti.length&&Ti.push(t)}}}var Ci={},Oi=0,Fi="_reactListenersID"+(""+Math.random()).slice(2);function Ei(t){return Object.prototype.hasOwnProperty.call(t,Fi)||(t[Fi]=Oi++,Ci[t[Fi]]={}),Ci[t[Fi]]}function Ri(t){if("undefined"===typeof(t=t||("undefined"!==typeof document?document:void 0)))return null;try{return t.activeElement||t.body}catch(e){return t.body}}function Ni(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Ki(t,e){var i,n=Ni(t);for(t=0;n;){if(3===n.nodeType){if(i=t+n.textContent.length,t<=e&&i>=e)return{node:n,offset:e-t};t=i}t:{for(;n;){if(n.nextSibling){n=n.nextSibling;break t}n=n.parentNode}n=void 0}n=Ni(n)}}function Di(){for(var t=window,e=Ri();e instanceof t.HTMLIFrameElement;){try{t=e.contentDocument.defaultView}catch(i){break}e=Ri(t.document)}return e}function Li(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&("input"===e&&("text"===t.type||"search"===t.type||"tel"===t.type||"url"===t.type||"password"===t.type)||"textarea"===e||"true"===t.contentEditable)}var qi=X&&"documentMode"in document&&11>=document.documentMode,Ii={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Ui=null,Vi=null,Bi=null,Gi=!1;function ji(t,e){var i=e.window===e?e.document:9===e.nodeType?e:e.ownerDocument;return Gi||null==Ui||Ui!==Ri(i)?null:("selectionStart"in(i=Ui)&&Li(i)?i={start:i.selectionStart,end:i.selectionEnd}:i={anchorNode:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset},Bi&&ei(Bi,i)?null:(Bi=i,(t=ct.getPooled(Ii.select,Vi,t,e)).type="select",t.target=Ui,H(t),t))}var zi={eventTypes:Ii,extractEvents:function(t,e,i,n){var o,r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;if(!(o=!r)){t:{r=Ei(r),o=b.onSelect;for(var s=0;s<o.length;s++){var a=o[s];if(!r.hasOwnProperty(a)||!r[a]){r=!1;break t}}r=!0}o=!r}if(o)return null;switch(r=e?U(e):window,t){case"focus":(Vt(r)||"true"===r.contentEditable)&&(Ui=r,Vi=e,Bi=null);break;case"blur":Bi=Vi=Ui=null;break;case"mousedown":Gi=!0;break;case"contextmenu":case"mouseup":case"dragend":return Gi=!1,ji(i,n);case"selectionchange":if(qi)break;case"keydown":case"keyup":return ji(i,n)}return null}};function Wi(t,e){return t=o({children:void 0},e),(e=function(t){var e="";return n.Children.forEach(t,function(t){null!=t&&(e+=t)}),e}(e.children))&&(t.children=e),t}function Hi(t,e,i,n){if(t=t.options,e){e={};for(var o=0;o<i.length;o++)e["$"+i[o]]=!0;for(i=0;i<t.length;i++)o=e.hasOwnProperty("$"+t[i].value),t[i].selected!==o&&(t[i].selected=o),o&&n&&(t[i].defaultSelected=!0)}else{for(i=""+_e(i),e=null,o=0;o<t.length;o++){if(t[o].value===i)return t[o].selected=!0,void(n&&(t[o].defaultSelected=!0));null!==e||t[o].disabled||(e=t[o])}null!==e&&(e.selected=!0)}}function Xi(t,e){return null!=e.dangerouslySetInnerHTML&&s("91"),o({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Qi(t,e){var i=e.value;null==i&&(i=e.defaultValue,null!=(e=e.children)&&(null!=i&&s("92"),Array.isArray(e)&&(1>=e.length||s("93"),e=e[0]),i=e),null==i&&(i="")),t._wrapperState={initialValue:_e(i)}}function Yi(t,e){var i=_e(e.value);null!=i&&((i=""+i)!==t.value&&(t.value=i),null==e.defaultValue&&(t.defaultValue=i)),null!=e.defaultValue&&(t.defaultValue=""+_e(e.defaultValue))}function $i(t){var e=t.textContent;e===t._wrapperState.initialValue&&(t.value=e)}F("ResponderEventPlugin SimpleEventPlugin TapEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" ")),S=V,T=I,w=U,E({SimpleEventPlugin:bi,EnterLeaveEventPlugin:Ze,ChangeEventPlugin:Ue,SelectEventPlugin:zi,BeforeInputEventPlugin:Mt});var Zi={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function Ji(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function tn(t,e){return null==t||"http://www.w3.org/1999/xhtml"===t?Ji(e):"http://www.w3.org/2000/svg"===t&&"foreignObject"===e?"http://www.w3.org/1999/xhtml":t}var en,nn=void 0,on=(en=function(t,e){if(t.namespaceURI!==Zi.svg||"innerHTML"in t)t.innerHTML=e;else{for((nn=nn||document.createElement("div")).innerHTML="<svg>"+e+"</svg>",e=nn.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}},"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,e,i,n){MSApp.execUnsafeLocalFunction(function(){return en(t,e)})}:en);function rn(t,e){if(e){var i=t.firstChild;if(i&&i===t.lastChild&&3===i.nodeType)return void(i.nodeValue=e)}t.textContent=e}var sn={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},an=["Webkit","ms","Moz","O"];function ln(t,e){for(var i in t=t.style,e)if(e.hasOwnProperty(i)){var n=0===i.indexOf("--"),o=i,r=e[i];o=null==r||"boolean"===typeof r||""===r?"":n||"number"!==typeof r||0===r||sn.hasOwnProperty(o)&&sn[o]?(""+r).trim():r+"px","float"===i&&(i="cssFloat"),n?t.setProperty(i,o):t[i]=o}}Object.keys(sn).forEach(function(t){an.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),sn[e]=sn[t]})});var un=o({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function hn(t,e){e&&(un[t]&&(null!=e.children||null!=e.dangerouslySetInnerHTML)&&s("137",t,""),null!=e.dangerouslySetInnerHTML&&(null!=e.children&&s("60"),"object"===typeof e.dangerouslySetInnerHTML&&"__html"in e.dangerouslySetInnerHTML||s("61")),null!=e.style&&"object"!==typeof e.style&&s("62",""))}function cn(t,e){if(-1===t.indexOf("-"))return"string"===typeof e.is;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function dn(t,e){var i=Ei(t=9===t.nodeType||11===t.nodeType?t:t.ownerDocument);e=b[e];for(var n=0;n<e.length;n++){var o=e[n];if(!i.hasOwnProperty(o)||!i[o]){switch(o){case"scroll":ki("scroll",t);break;case"focus":case"blur":ki("focus",t),ki("blur",t),i.blur=!0,i.focus=!0;break;case"cancel":case"close":Gt(o)&&ki(o,t);break;case"invalid":case"submit":case"reset":break;default:-1===ot.indexOf(o)&&xi(o,t)}i[o]=!0}}}function pn(){}var fn=null,mn=null;function yn(t,e){switch(t){case"button":case"input":case"select":case"textarea":return!!e.autoFocus}return!1}function vn(t,e){return"textarea"===t||"option"===t||"noscript"===t||"string"===typeof e.children||"number"===typeof e.children||"object"===typeof e.dangerouslySetInnerHTML&&null!==e.dangerouslySetInnerHTML&&null!=e.dangerouslySetInnerHTML.__html}function gn(t){for(t=t.nextSibling;t&&1!==t.nodeType&&3!==t.nodeType;)t=t.nextSibling;return t}function _n(t){for(t=t.firstChild;t&&1!==t.nodeType&&3!==t.nodeType;)t=t.nextSibling;return t}new Set;var bn=[],Sn=-1;function Tn(t){0>Sn||(t.current=bn[Sn],bn[Sn]=null,Sn--)}function wn(t,e){bn[++Sn]=t.current,t.current=e}var Pn={},xn={current:Pn},kn={current:!1},An=Pn;function Mn(t,e){var i=t.type.contextTypes;if(!i)return Pn;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var o,r={};for(o in i)r[o]=e[o];return n&&((t=t.stateNode).__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=r),r}function Cn(t){return null!==(t=t.childContextTypes)&&void 0!==t}function On(t){Tn(kn),Tn(xn)}function Fn(t){Tn(kn),Tn(xn)}function En(t,e,i){xn.current!==Pn&&s("168"),wn(xn,e),wn(kn,i)}function Rn(t,e,i){var n=t.stateNode;if(t=e.childContextTypes,"function"!==typeof n.getChildContext)return i;for(var r in n=n.getChildContext())r in t||s("108",le(e)||"Unknown",r);return o({},i,n)}function Nn(t){var e=t.stateNode;return e=e&&e.__reactInternalMemoizedMergedChildContext||Pn,An=xn.current,wn(xn,e),wn(kn,kn.current),!0}function Kn(t,e,i){var n=t.stateNode;n||s("169"),i?(e=Rn(t,e,An),n.__reactInternalMemoizedMergedChildContext=e,Tn(kn),Tn(xn),wn(xn,e)):Tn(kn),wn(kn,i)}var Dn=null,Ln=null;function qn(t){return function(e){try{return t(e)}catch(i){}}}function In(t,e,i,n){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=null,this.index=0,this.ref=null,this.pendingProps=e,this.firstContextDependency=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childExpirationTime=this.expirationTime=0,this.alternate=null}function Un(t){return"object"===typeof(t=t.prototype)&&null!==t&&"object"===typeof t.isReactComponent&&null!==t.isReactComponent}function Vn(t,e,i){var n=t.alternate;return null===n?((n=new In(t.tag,e,t.key,t.mode)).type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.effectTag=0,n.nextEffect=null,n.firstEffect=null,n.lastEffect=null),n.childExpirationTime=t.childExpirationTime,n.expirationTime=e!==t.pendingProps?i:t.expirationTime,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,n.firstContextDependency=t.firstContextDependency,n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Bn(t,e,i){var n=t.type,o=t.key;t=t.props;var r=void 0;if("function"===typeof n)r=Un(n)?2:4;else if("string"===typeof n)r=7;else t:switch(n){case Zt:return Gn(t.children,e,i,o);case ne:r=10,e|=3;break;case Jt:r=10,e|=2;break;case te:return(n=new In(15,t,o,4|e)).type=te,n.expirationTime=i,n;case re:r=16;break;default:if("object"===typeof n&&null!==n)switch(n.$$typeof){case ee:r=12;break t;case ie:r=11;break t;case oe:r=13;break t;default:if("function"===typeof n.then){r=4;break t}}s("130",null==n?n:typeof n,"")}return(e=new In(r,t,o,e)).type=n,e.expirationTime=i,e}function Gn(t,e,i,n){return(t=new In(9,t,n,e)).expirationTime=i,t}function jn(t,e,i){return(t=new In(8,t,null,e)).expirationTime=i,t}function zn(t,e,i){return(e=new In(6,null!==t.children?t.children:[],t.key,e)).expirationTime=i,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Wn(t,e){t.didError=!1;var i=t.earliestPendingTime;0===i?t.earliestPendingTime=t.latestPendingTime=e:i>e?t.earliestPendingTime=e:t.latestPendingTime<e&&(t.latestPendingTime=e),Hn(e,t)}function Hn(t,e){var i=e.earliestSuspendedTime,n=e.latestSuspendedTime,o=e.earliestPendingTime,r=e.latestPingedTime;0===(o=0!==o?o:r)&&(0===t||n>t)&&(o=n),0!==(t=o)&&0!==i&&i<t&&(t=i),e.nextExpirationTimeToWorkOn=o,e.expirationTime=t}var Xn=!1;function Qn(t){return{baseState:t,firstUpdate:null,lastUpdate:null,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function Yn(t){return{baseState:t.baseState,firstUpdate:t.firstUpdate,lastUpdate:t.lastUpdate,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function $n(t){return{expirationTime:t,tag:0,payload:null,callback:null,next:null,nextEffect:null}}function Zn(t,e){null===t.lastUpdate?t.firstUpdate=t.lastUpdate=e:(t.lastUpdate.next=e,t.lastUpdate=e)}function Jn(t,e){var i=t.alternate;if(null===i){var n=t.updateQueue,o=null;null===n&&(n=t.updateQueue=Qn(t.memoizedState))}else n=t.updateQueue,o=i.updateQueue,null===n?null===o?(n=t.updateQueue=Qn(t.memoizedState),o=i.updateQueue=Qn(i.memoizedState)):n=t.updateQueue=Yn(o):null===o&&(o=i.updateQueue=Yn(n));null===o||n===o?Zn(n,e):null===n.lastUpdate||null===o.lastUpdate?(Zn(n,e),Zn(o,e)):(Zn(n,e),o.lastUpdate=e)}function to(t,e){var i=t.updateQueue;null===(i=null===i?t.updateQueue=Qn(t.memoizedState):eo(t,i)).lastCapturedUpdate?i.firstCapturedUpdate=i.lastCapturedUpdate=e:(i.lastCapturedUpdate.next=e,i.lastCapturedUpdate=e)}function eo(t,e){var i=t.alternate;return null!==i&&e===i.updateQueue&&(e=t.updateQueue=Yn(e)),e}function io(t,e,i,n,r,s){switch(i.tag){case 1:return"function"===typeof(t=i.payload)?t.call(s,n,r):t;case 3:t.effectTag=-1025&t.effectTag|64;case 0:if(null===(r="function"===typeof(t=i.payload)?t.call(s,n,r):t)||void 0===r)break;return o({},n,r);case 2:Xn=!0}return n}function no(t,e,i,n,o){Xn=!1;for(var r=(e=eo(t,e)).baseState,s=null,a=0,l=e.firstUpdate,u=r;null!==l;){var h=l.expirationTime;h>o?(null===s&&(s=l,r=u),(0===a||a>h)&&(a=h)):(u=io(t,0,l,u,i,n),null!==l.callback&&(t.effectTag|=32,l.nextEffect=null,null===e.lastEffect?e.firstEffect=e.lastEffect=l:(e.lastEffect.nextEffect=l,e.lastEffect=l))),l=l.next}for(h=null,l=e.firstCapturedUpdate;null!==l;){var c=l.expirationTime;c>o?(null===h&&(h=l,null===s&&(r=u)),(0===a||a>c)&&(a=c)):(u=io(t,0,l,u,i,n),null!==l.callback&&(t.effectTag|=32,l.nextEffect=null,null===e.lastCapturedEffect?e.firstCapturedEffect=e.lastCapturedEffect=l:(e.lastCapturedEffect.nextEffect=l,e.lastCapturedEffect=l))),l=l.next}null===s&&(e.lastUpdate=null),null===h?e.lastCapturedUpdate=null:t.effectTag|=32,null===s&&null===h&&(r=u),e.baseState=r,e.firstUpdate=s,e.firstCapturedUpdate=h,t.expirationTime=a,t.memoizedState=u}function oo(t,e,i){null!==e.firstCapturedUpdate&&(null!==e.lastUpdate&&(e.lastUpdate.next=e.firstCapturedUpdate,e.lastUpdate=e.lastCapturedUpdate),e.firstCapturedUpdate=e.lastCapturedUpdate=null),ro(e.firstEffect,i),e.firstEffect=e.lastEffect=null,ro(e.firstCapturedEffect,i),e.firstCapturedEffect=e.lastCapturedEffect=null}function ro(t,e){for(;null!==t;){var i=t.callback;if(null!==i){t.callback=null;var n=e;"function"!==typeof i&&s("191",i),i.call(n)}t=t.nextEffect}}function so(t,e){return{value:t,source:e,stack:ue(e)}}var ao={current:null},lo=null,uo=null,ho=null;function co(t,e){var i=t.type._context;wn(ao,i._currentValue),i._currentValue=e}function po(t){var e=ao.current;Tn(ao),t.type._context._currentValue=e}function fo(t){lo=t,ho=uo=null,t.firstContextDependency=null}function mo(t,e){return ho!==t&&!1!==e&&0!==e&&("number"===typeof e&&1073741823!==e||(ho=t,e=1073741823),e={context:t,observedBits:e,next:null},null===uo?(null===lo&&s("277"),lo.firstContextDependency=uo=e):uo=uo.next=e),t._currentValue}var yo={},vo={current:yo},go={current:yo},_o={current:yo};function bo(t){return t===yo&&s("174"),t}function So(t,e){wn(_o,e),wn(go,t),wn(vo,yo);var i=e.nodeType;switch(i){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:tn(null,"");break;default:e=tn(e=(i=8===i?e.parentNode:e).namespaceURI||null,i=i.tagName)}Tn(vo),wn(vo,e)}function To(t){Tn(vo),Tn(go),Tn(_o)}function wo(t){bo(_o.current);var e=bo(vo.current),i=tn(e,t.type);e!==i&&(wn(go,t),wn(vo,i))}function Po(t){go.current===t&&(Tn(vo),Tn(go))}var xo=(new n.Component).refs;function ko(t,e,i,n){i=null===(i=i(n,e=t.memoizedState))||void 0===i?e:o({},e,i),t.memoizedState=i,null!==(n=t.updateQueue)&&0===t.expirationTime&&(n.baseState=i)}var Ao={isMounted:function(t){return!!(t=t._reactInternalFiber)&&2===ii(t)},enqueueSetState:function(t,e,i){t=t._reactInternalFiber;var n=ls(),o=$n(n=Nr(n,t));o.payload=e,void 0!==i&&null!==i&&(o.callback=i),Jn(t,o),Kr(t,n)},enqueueReplaceState:function(t,e,i){t=t._reactInternalFiber;var n=ls(),o=$n(n=Nr(n,t));o.tag=1,o.payload=e,void 0!==i&&null!==i&&(o.callback=i),Jn(t,o),Kr(t,n)},enqueueForceUpdate:function(t,e){t=t._reactInternalFiber;var i=ls(),n=$n(i=Nr(i,t));n.tag=2,void 0!==e&&null!==e&&(n.callback=e),Jn(t,n),Kr(t,i)}};function Mo(t,e,i,n,o,r,s){return"function"===typeof(t=t.stateNode).shouldComponentUpdate?t.shouldComponentUpdate(n,r,s):!e.prototype||!e.prototype.isPureReactComponent||(!ei(i,n)||!ei(o,r))}function Co(t,e,i,n){t=e.state,"function"===typeof e.componentWillReceiveProps&&e.componentWillReceiveProps(i,n),"function"===typeof e.UNSAFE_componentWillReceiveProps&&e.UNSAFE_componentWillReceiveProps(i,n),e.state!==t&&Ao.enqueueReplaceState(e,e.state,null)}function Oo(t,e,i,n){var o=t.stateNode,r=Cn(e)?An:xn.current;o.props=i,o.state=t.memoizedState,o.refs=xo,o.context=Mn(t,r),null!==(r=t.updateQueue)&&(no(t,r,i,o,n),o.state=t.memoizedState),"function"===typeof(r=e.getDerivedStateFromProps)&&(ko(t,e,r,i),o.state=t.memoizedState),"function"===typeof e.getDerivedStateFromProps||"function"===typeof o.getSnapshotBeforeUpdate||"function"!==typeof o.UNSAFE_componentWillMount&&"function"!==typeof o.componentWillMount||(e=o.state,"function"===typeof o.componentWillMount&&o.componentWillMount(),"function"===typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount(),e!==o.state&&Ao.enqueueReplaceState(o,o.state,null),null!==(r=t.updateQueue)&&(no(t,r,i,o,n),o.state=t.memoizedState)),"function"===typeof o.componentDidMount&&(t.effectTag|=4)}var Fo=Array.isArray;function Eo(t,e,i){if(null!==(t=i.ref)&&"function"!==typeof t&&"object"!==typeof t){if(i._owner){i=i._owner;var n=void 0;i&&(2!==i.tag&&3!==i.tag&&s("110"),n=i.stateNode),n||s("147",t);var o=""+t;return null!==e&&null!==e.ref&&"function"===typeof e.ref&&e.ref._stringRef===o?e.ref:((e=function(t){var e=n.refs;e===xo&&(e=n.refs={}),null===t?delete e[o]:e[o]=t})._stringRef=o,e)}"string"!==typeof t&&s("284"),i._owner||s("254",t)}return t}function Ro(t,e){"textarea"!==t.type&&s("31","[object Object]"===Object.prototype.toString.call(e)?"object with keys {"+Object.keys(e).join(", ")+"}":e,"")}function No(t){function e(e,i){if(t){var n=e.lastEffect;null!==n?(n.nextEffect=i,e.lastEffect=i):e.firstEffect=e.lastEffect=i,i.nextEffect=null,i.effectTag=8}}function i(i,n){if(!t)return null;for(;null!==n;)e(i,n),n=n.sibling;return null}function n(t,e){for(t=new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function o(t,e,i){return(t=Vn(t,e,i)).index=0,t.sibling=null,t}function r(e,i,n){return e.index=n,t?null!==(n=e.alternate)?(n=n.index)<i?(e.effectTag=2,i):n:(e.effectTag=2,i):i}function a(e){return t&&null===e.alternate&&(e.effectTag=2),e}function l(t,e,i,n){return null===e||8!==e.tag?((e=jn(i,t.mode,n)).return=t,e):((e=o(e,i,n)).return=t,e)}function u(t,e,i,n){return null!==e&&e.type===i.type?((n=o(e,i.props,n)).ref=Eo(t,e,i),n.return=t,n):((n=Bn(i,t.mode,n)).ref=Eo(t,e,i),n.return=t,n)}function h(t,e,i,n){return null===e||6!==e.tag||e.stateNode.containerInfo!==i.containerInfo||e.stateNode.implementation!==i.implementation?((e=zn(i,t.mode,n)).return=t,e):((e=o(e,i.children||[],n)).return=t,e)}function c(t,e,i,n,r){return null===e||9!==e.tag?((e=Gn(i,t.mode,n,r)).return=t,e):((e=o(e,i,n)).return=t,e)}function d(t,e,i){if("string"===typeof e||"number"===typeof e)return(e=jn(""+e,t.mode,i)).return=t,e;if("object"===typeof e&&null!==e){switch(e.$$typeof){case Yt:return(i=Bn(e,t.mode,i)).ref=Eo(t,null,e),i.return=t,i;case $t:return(e=zn(e,t.mode,i)).return=t,e}if(Fo(e)||ae(e))return(e=Gn(e,t.mode,i,null)).return=t,e;Ro(t,e)}return null}function p(t,e,i,n){var o=null!==e?e.key:null;if("string"===typeof i||"number"===typeof i)return null!==o?null:l(t,e,""+i,n);if("object"===typeof i&&null!==i){switch(i.$$typeof){case Yt:return i.key===o?i.type===Zt?c(t,e,i.props.children,n,o):u(t,e,i,n):null;case $t:return i.key===o?h(t,e,i,n):null}if(Fo(i)||ae(i))return null!==o?null:c(t,e,i,n,null);Ro(t,i)}return null}function f(t,e,i,n,o){if("string"===typeof n||"number"===typeof n)return l(e,t=t.get(i)||null,""+n,o);if("object"===typeof n&&null!==n){switch(n.$$typeof){case Yt:return t=t.get(null===n.key?i:n.key)||null,n.type===Zt?c(e,t,n.props.children,o,n.key):u(e,t,n,o);case $t:return h(e,t=t.get(null===n.key?i:n.key)||null,n,o)}if(Fo(n)||ae(n))return c(e,t=t.get(i)||null,n,o,null);Ro(e,n)}return null}function m(o,s,a,l){for(var u=null,h=null,c=s,m=s=0,y=null;null!==c&&m<a.length;m++){c.index>m?(y=c,c=null):y=c.sibling;var v=p(o,c,a[m],l);if(null===v){null===c&&(c=y);break}t&&c&&null===v.alternate&&e(o,c),s=r(v,s,m),null===h?u=v:h.sibling=v,h=v,c=y}if(m===a.length)return i(o,c),u;if(null===c){for(;m<a.length;m++)(c=d(o,a[m],l))&&(s=r(c,s,m),null===h?u=c:h.sibling=c,h=c);return u}for(c=n(o,c);m<a.length;m++)(y=f(c,o,m,a[m],l))&&(t&&null!==y.alternate&&c.delete(null===y.key?m:y.key),s=r(y,s,m),null===h?u=y:h.sibling=y,h=y);return t&&c.forEach(function(t){return e(o,t)}),u}function y(o,a,l,u){var h=ae(l);"function"!==typeof h&&s("150"),null==(l=h.call(l))&&s("151");for(var c=h=null,m=a,y=a=0,v=null,g=l.next();null!==m&&!g.done;y++,g=l.next()){m.index>y?(v=m,m=null):v=m.sibling;var _=p(o,m,g.value,u);if(null===_){m||(m=v);break}t&&m&&null===_.alternate&&e(o,m),a=r(_,a,y),null===c?h=_:c.sibling=_,c=_,m=v}if(g.done)return i(o,m),h;if(null===m){for(;!g.done;y++,g=l.next())null!==(g=d(o,g.value,u))&&(a=r(g,a,y),null===c?h=g:c.sibling=g,c=g);return h}for(m=n(o,m);!g.done;y++,g=l.next())null!==(g=f(m,o,y,g.value,u))&&(t&&null!==g.alternate&&m.delete(null===g.key?y:g.key),a=r(g,a,y),null===c?h=g:c.sibling=g,c=g);return t&&m.forEach(function(t){return e(o,t)}),h}return function(t,n,r,l){var u="object"===typeof r&&null!==r&&r.type===Zt&&null===r.key;u&&(r=r.props.children);var h="object"===typeof r&&null!==r;if(h)switch(r.$$typeof){case Yt:t:{for(h=r.key,u=n;null!==u;){if(u.key===h){if(9===u.tag?r.type===Zt:u.type===r.type){i(t,u.sibling),(n=o(u,r.type===Zt?r.props.children:r.props,l)).ref=Eo(t,u,r),n.return=t,t=n;break t}i(t,u);break}e(t,u),u=u.sibling}r.type===Zt?((n=Gn(r.props.children,t.mode,l,r.key)).return=t,t=n):((l=Bn(r,t.mode,l)).ref=Eo(t,n,r),l.return=t,t=l)}return a(t);case $t:t:{for(u=r.key;null!==n;){if(n.key===u){if(6===n.tag&&n.stateNode.containerInfo===r.containerInfo&&n.stateNode.implementation===r.implementation){i(t,n.sibling),(n=o(n,r.children||[],l)).return=t,t=n;break t}i(t,n);break}e(t,n),n=n.sibling}(n=zn(r,t.mode,l)).return=t,t=n}return a(t)}if("string"===typeof r||"number"===typeof r)return r=""+r,null!==n&&8===n.tag?(i(t,n.sibling),(n=o(n,r,l)).return=t,t=n):(i(t,n),(n=jn(r,t.mode,l)).return=t,t=n),a(t);if(Fo(r))return m(t,n,r,l);if(ae(r))return y(t,n,r,l);if(h&&Ro(t,r),"undefined"===typeof r&&!u)switch(t.tag){case 2:case 3:case 0:s("152",(l=t.type).displayName||l.name||"Component")}return i(t,n)}}var Ko=No(!0),Do=No(!1),Lo=null,qo=null,Io=!1;function Uo(t,e){var i=new In(7,null,null,0);i.type="DELETED",i.stateNode=e,i.return=t,i.effectTag=8,null!==t.lastEffect?(t.lastEffect.nextEffect=i,t.lastEffect=i):t.firstEffect=t.lastEffect=i}function Vo(t,e){switch(t.tag){case 7:var i=t.type;return null!==(e=1!==e.nodeType||i.toLowerCase()!==e.nodeName.toLowerCase()?null:e)&&(t.stateNode=e,!0);case 8:return null!==(e=""===t.pendingProps||3!==e.nodeType?null:e)&&(t.stateNode=e,!0);default:return!1}}function Bo(t){if(Io){var e=qo;if(e){var i=e;if(!Vo(t,e)){if(!(e=gn(i))||!Vo(t,e))return t.effectTag|=2,Io=!1,void(Lo=t);Uo(Lo,i)}Lo=t,qo=_n(e)}else t.effectTag|=2,Io=!1,Lo=t}}function Go(t){for(t=t.return;null!==t&&7!==t.tag&&5!==t.tag;)t=t.return;Lo=t}function jo(t){if(t!==Lo)return!1;if(!Io)return Go(t),Io=!0,!1;var e=t.type;if(7!==t.tag||"head"!==e&&"body"!==e&&!vn(e,t.memoizedProps))for(e=qo;e;)Uo(t,e),e=gn(e);return Go(t),qo=Lo?gn(t.stateNode):null,!0}function zo(){qo=Lo=null,Io=!1}var Wo=Ht.ReactCurrentOwner;function Ho(t,e,i,n){e.child=null===t?Do(e,null,i,n):Ko(e,t.child,i,n)}function Xo(t,e,i,n,o){i=i.render;var r=e.ref;return kn.current||e.memoizedProps!==n||r!==(null!==t?t.ref:null)?(Ho(t,e,i=i(n,r),o),e.memoizedProps=n,e.child):er(t,e,o)}function Qo(t,e){var i=e.ref;(null===t&&null!==i||null!==t&&t.ref!==i)&&(e.effectTag|=128)}function Yo(t,e,i,n,o){var r=Cn(i)?An:xn.current;return r=Mn(e,r),fo(e),i=i(n,r),e.effectTag|=1,Ho(t,e,i,o),e.memoizedProps=n,e.child}function $o(t,e,i,n,o){if(Cn(i)){var r=!0;Nn(e)}else r=!1;if(fo(e),null===t)if(null===e.stateNode){var s=Cn(i)?An:xn.current,a=i.contextTypes,l=null!==a&&void 0!==a,u=new i(n,a=l?Mn(e,s):Pn);e.memoizedState=null!==u.state&&void 0!==u.state?u.state:null,u.updater=Ao,e.stateNode=u,u._reactInternalFiber=e,l&&((l=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=s,l.__reactInternalMemoizedMaskedChildContext=a),Oo(e,i,n,o),n=!0}else{s=e.stateNode,a=e.memoizedProps,s.props=a;var h=s.context;l=Mn(e,l=Cn(i)?An:xn.current);var c=i.getDerivedStateFromProps;(u="function"===typeof c||"function"===typeof s.getSnapshotBeforeUpdate)||"function"!==typeof s.UNSAFE_componentWillReceiveProps&&"function"!==typeof s.componentWillReceiveProps||(a!==n||h!==l)&&Co(e,s,n,l),Xn=!1;var d=e.memoizedState;h=s.state=d;var p=e.updateQueue;null!==p&&(no(e,p,n,s,o),h=e.memoizedState),a!==n||d!==h||kn.current||Xn?("function"===typeof c&&(ko(e,i,c,n),h=e.memoizedState),(a=Xn||Mo(e,i,a,n,d,h,l))?(u||"function"!==typeof s.UNSAFE_componentWillMount&&"function"!==typeof s.componentWillMount||("function"===typeof s.componentWillMount&&s.componentWillMount(),"function"===typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount()),"function"===typeof s.componentDidMount&&(e.effectTag|=4)):("function"===typeof s.componentDidMount&&(e.effectTag|=4),e.memoizedProps=n,e.memoizedState=h),s.props=n,s.state=h,s.context=l,n=a):("function"===typeof s.componentDidMount&&(e.effectTag|=4),n=!1)}else s=e.stateNode,a=e.memoizedProps,s.props=a,h=s.context,l=Mn(e,l=Cn(i)?An:xn.current),(u="function"===typeof(c=i.getDerivedStateFromProps)||"function"===typeof s.getSnapshotBeforeUpdate)||"function"!==typeof s.UNSAFE_componentWillReceiveProps&&"function"!==typeof s.componentWillReceiveProps||(a!==n||h!==l)&&Co(e,s,n,l),Xn=!1,h=e.memoizedState,d=s.state=h,null!==(p=e.updateQueue)&&(no(e,p,n,s,o),d=e.memoizedState),a!==n||h!==d||kn.current||Xn?("function"===typeof c&&(ko(e,i,c,n),d=e.memoizedState),(c=Xn||Mo(e,i,a,n,h,d,l))?(u||"function"!==typeof s.UNSAFE_componentWillUpdate&&"function"!==typeof s.componentWillUpdate||("function"===typeof s.componentWillUpdate&&s.componentWillUpdate(n,d,l),"function"===typeof s.UNSAFE_componentWillUpdate&&s.UNSAFE_componentWillUpdate(n,d,l)),"function"===typeof s.componentDidUpdate&&(e.effectTag|=4),"function"===typeof s.getSnapshotBeforeUpdate&&(e.effectTag|=256)):("function"!==typeof s.componentDidUpdate||a===t.memoizedProps&&h===t.memoizedState||(e.effectTag|=4),"function"!==typeof s.getSnapshotBeforeUpdate||a===t.memoizedProps&&h===t.memoizedState||(e.effectTag|=256),e.memoizedProps=n,e.memoizedState=d),s.props=n,s.state=d,s.context=l,n=c):("function"!==typeof s.componentDidUpdate||a===t.memoizedProps&&h===t.memoizedState||(e.effectTag|=4),"function"!==typeof s.getSnapshotBeforeUpdate||a===t.memoizedProps&&h===t.memoizedState||(e.effectTag|=256),n=!1);return Zo(t,e,i,n,r,o)}function Zo(t,e,i,n,o,r){Qo(t,e);var s=0!==(64&e.effectTag);if(!n&&!s)return o&&Kn(e,i,!1),er(t,e,r);n=e.stateNode,Wo.current=e;var a=s?null:n.render();return e.effectTag|=1,null!==t&&s&&(Ho(t,e,null,r),e.child=null),Ho(t,e,a,r),e.memoizedState=n.state,e.memoizedProps=n.props,o&&Kn(e,i,!0),e.child}function Jo(t){var e=t.stateNode;e.pendingContext?En(0,e.pendingContext,e.pendingContext!==e.context):e.context&&En(0,e.context,!1),So(t,e.containerInfo)}function tr(t,e){if(t&&t.defaultProps)for(var i in e=o({},e),t=t.defaultProps)void 0===e[i]&&(e[i]=t[i]);return e}function er(t,e,i){null!==t&&(e.firstContextDependency=t.firstContextDependency);var n=e.childExpirationTime;if(0===n||n>i)return null;if(null!==t&&e.child!==t.child&&s("153"),null!==e.child){for(i=Vn(t=e.child,t.pendingProps,t.expirationTime),e.child=i,i.return=e;null!==t.sibling;)t=t.sibling,(i=i.sibling=Vn(t,t.pendingProps,t.expirationTime)).return=e;i.sibling=null}return e.child}function ir(t,e,i){var n=e.expirationTime;if(!kn.current&&(0===n||n>i)){switch(e.tag){case 5:Jo(e),zo();break;case 7:wo(e);break;case 2:Cn(e.type)&&Nn(e);break;case 3:Cn(e.type._reactResult)&&Nn(e);break;case 6:So(e,e.stateNode.containerInfo);break;case 12:co(e,e.memoizedProps.value)}return er(t,e,i)}switch(e.expirationTime=0,e.tag){case 4:return function(t,e,i,n){null!==t&&s("155");var o=e.pendingProps;if("object"===typeof i&&null!==i&&"function"===typeof i.then){var r=i=function(t){switch(t._reactStatus){case 1:return t._reactResult;case 2:throw t._reactResult;case 0:throw t;default:throw t._reactStatus=0,t.then(function(e){if(0===t._reactStatus){if(t._reactStatus=1,"object"===typeof e&&null!==e){var i=e.default;e=void 0!==i&&null!==i?i:e}t._reactResult=e}},function(e){0===t._reactStatus&&(t._reactStatus=2,t._reactResult=e)}),t}}(i);r="function"===typeof r?Un(r)?3:1:void 0!==r&&null!==r&&r.$$typeof?14:4,r=e.tag=r;var a=tr(i,o);switch(r){case 1:return Yo(t,e,i,a,n);case 3:return $o(t,e,i,a,n);case 14:return Xo(t,e,i,a,n);default:s("283",i)}}if(r=Mn(e,xn.current),fo(e),r=i(o,r),e.effectTag|=1,"object"===typeof r&&null!==r&&"function"===typeof r.render&&void 0===r.$$typeof){e.tag=2,Cn(i)?(a=!0,Nn(e)):a=!1,e.memoizedState=null!==r.state&&void 0!==r.state?r.state:null;var l=i.getDerivedStateFromProps;return"function"===typeof l&&ko(e,i,l,o),r.updater=Ao,e.stateNode=r,r._reactInternalFiber=e,Oo(e,i,o,n),Zo(t,e,i,!0,a,n)}return e.tag=0,Ho(t,e,r,n),e.memoizedProps=o,e.child}(t,e,e.type,i);case 0:return Yo(t,e,e.type,e.pendingProps,i);case 1:var o=e.type._reactResult;return t=Yo(t,e,o,tr(o,n=e.pendingProps),i),e.memoizedProps=n,t;case 2:return $o(t,e,e.type,e.pendingProps,i);case 3:return t=$o(t,e,o=e.type._reactResult,tr(o,n=e.pendingProps),i),e.memoizedProps=n,t;case 5:return Jo(e),null===(n=e.updateQueue)&&s("282"),o=null!==(o=e.memoizedState)?o.element:null,no(e,n,e.pendingProps,null,i),(n=e.memoizedState.element)===o?(zo(),e=er(t,e,i)):(o=e.stateNode,(o=(null===t||null===t.child)&&o.hydrate)&&(qo=_n(e.stateNode.containerInfo),Lo=e,o=Io=!0),o?(e.effectTag|=2,e.child=Do(e,null,n,i)):(Ho(t,e,n,i),zo()),e=e.child),e;case 7:wo(e),null===t&&Bo(e),n=e.type,o=e.pendingProps;var r=null!==t?t.memoizedProps:null,a=o.children;return vn(n,o)?a=null:null!==r&&vn(n,r)&&(e.effectTag|=16),Qo(t,e),1073741823!==i&&1&e.mode&&o.hidden?(e.expirationTime=1073741823,e.memoizedProps=o,e=null):(Ho(t,e,a,i),e.memoizedProps=o,e=e.child),e;case 8:return null===t&&Bo(e),e.memoizedProps=e.pendingProps,null;case 16:return null;case 6:return So(e,e.stateNode.containerInfo),n=e.pendingProps,null===t?e.child=Ko(e,null,n,i):Ho(t,e,n,i),e.memoizedProps=n,e.child;case 13:return Xo(t,e,e.type,e.pendingProps,i);case 14:return t=Xo(t,e,o=e.type._reactResult,tr(o,n=e.pendingProps),i),e.memoizedProps=n,t;case 9:return Ho(t,e,n=e.pendingProps,i),e.memoizedProps=n,e.child;case 10:return Ho(t,e,n=e.pendingProps.children,i),e.memoizedProps=n,e.child;case 15:return Ho(t,e,(n=e.pendingProps).children,i),e.memoizedProps=n,e.child;case 12:t:{if(n=e.type._context,o=e.pendingProps,a=e.memoizedProps,r=o.value,e.memoizedProps=o,co(e,r),null!==a){var l=a.value;if(0===(r=l===r&&(0!==l||1/l===1/r)||l!==l&&r!==r?0:0|("function"===typeof n._calculateChangedBits?n._calculateChangedBits(l,r):1073741823))){if(a.children===o.children&&!kn.current){e=er(t,e,i);break t}}else for(null!==(a=e.child)&&(a.return=e);null!==a;){if(null!==(l=a.firstContextDependency))do{if(l.context===n&&0!==(l.observedBits&r)){if(2===a.tag||3===a.tag){var u=$n(i);u.tag=2,Jn(a,u)}(0===a.expirationTime||a.expirationTime>i)&&(a.expirationTime=i),null!==(u=a.alternate)&&(0===u.expirationTime||u.expirationTime>i)&&(u.expirationTime=i);for(var h=a.return;null!==h;){if(u=h.alternate,0===h.childExpirationTime||h.childExpirationTime>i)h.childExpirationTime=i,null!==u&&(0===u.childExpirationTime||u.childExpirationTime>i)&&(u.childExpirationTime=i);else{if(null===u||!(0===u.childExpirationTime||u.childExpirationTime>i))break;u.childExpirationTime=i}h=h.return}}u=a.child,l=l.next}while(null!==l);else u=12===a.tag&&a.type===e.type?null:a.child;if(null!==u)u.return=a;else for(u=a;null!==u;){if(u===e){u=null;break}if(null!==(a=u.sibling)){a.return=u.return,u=a;break}u=u.return}a=u}}Ho(t,e,o.children,i),e=e.child}return e;case 11:return r=e.type,o=(n=e.pendingProps).children,fo(e),o=o(r=mo(r,n.unstable_observedBits)),e.effectTag|=1,Ho(t,e,o,i),e.memoizedProps=n,e.child;default:s("156")}}function nr(t){t.effectTag|=4}var or=void 0,rr=void 0,sr=void 0;function ar(t,e){var i=e.source,n=e.stack;null===n&&null!==i&&(n=ue(i)),null!==i&&le(i.type),e=e.value,null!==t&&2===t.tag&&le(t.type);try{console.error(e)}catch(o){setTimeout(function(){throw o})}}function lr(t){var e=t.ref;if(null!==e)if("function"===typeof e)try{e(null)}catch(i){Rr(t,i)}else e.current=null}function ur(t){switch("function"===typeof Ln&&Ln(t),t.tag){case 2:case 3:lr(t);var e=t.stateNode;if("function"===typeof e.componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(i){Rr(t,i)}break;case 7:lr(t);break;case 6:dr(t)}}function hr(t){return 7===t.tag||5===t.tag||6===t.tag}function cr(t){t:{for(var e=t.return;null!==e;){if(hr(e)){var i=e;break t}e=e.return}s("160"),i=void 0}var n=e=void 0;switch(i.tag){case 7:e=i.stateNode,n=!1;break;case 5:case 6:e=i.stateNode.containerInfo,n=!0;break;default:s("161")}16&i.effectTag&&(rn(e,""),i.effectTag&=-17);t:e:for(i=t;;){for(;null===i.sibling;){if(null===i.return||hr(i.return)){i=null;break t}i=i.return}for(i.sibling.return=i.return,i=i.sibling;7!==i.tag&&8!==i.tag;){if(2&i.effectTag)continue e;if(null===i.child||6===i.tag)continue e;i.child.return=i,i=i.child}if(!(2&i.effectTag)){i=i.stateNode;break t}}for(var o=t;;){if(7===o.tag||8===o.tag)if(i)if(n){var r=e,a=o.stateNode,l=i;8===r.nodeType?r.parentNode.insertBefore(a,l):r.insertBefore(a,l)}else e.insertBefore(o.stateNode,i);else n?(r=e,a=o.stateNode,8===r.nodeType?(l=r.parentNode).insertBefore(a,r):(l=r).appendChild(a),null===l.onclick&&(l.onclick=pn)):e.appendChild(o.stateNode);else if(6!==o.tag&&null!==o.child){o.child.return=o,o=o.child;continue}if(o===t)break;for(;null===o.sibling;){if(null===o.return||o.return===t)return;o=o.return}o.sibling.return=o.return,o=o.sibling}}function dr(t){for(var e=t,i=!1,n=void 0,o=void 0;;){if(!i){i=e.return;t:for(;;){switch(null===i&&s("160"),i.tag){case 7:n=i.stateNode,o=!1;break t;case 5:case 6:n=i.stateNode.containerInfo,o=!0;break t}i=i.return}i=!0}if(7===e.tag||8===e.tag){t:for(var r=e,a=r;;)if(ur(a),null!==a.child&&6!==a.tag)a.child.return=a,a=a.child;else{if(a===r)break;for(;null===a.sibling;){if(null===a.return||a.return===r)break t;a=a.return}a.sibling.return=a.return,a=a.sibling}o?(r=n,a=e.stateNode,8===r.nodeType?r.parentNode.removeChild(a):r.removeChild(a)):n.removeChild(e.stateNode)}else if(6===e.tag?(n=e.stateNode.containerInfo,o=!0):ur(e),null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)return;6===(e=e.return).tag&&(i=!1)}e.sibling.return=e.return,e=e.sibling}}function pr(t,e){switch(e.tag){case 2:case 3:break;case 7:var i=e.stateNode;if(null!=i){var n=e.memoizedProps,o=null!==t?t.memoizedProps:n;t=e.type;var r=e.updateQueue;if(e.updateQueue=null,null!==r){for(i[L]=n,"input"===t&&"radio"===n.type&&null!=n.name&&Te(i,n),cn(t,o),e=cn(t,n),o=0;o<r.length;o+=2){var a=r[o],l=r[o+1];"style"===a?ln(i,l):"dangerouslySetInnerHTML"===a?on(i,l):"children"===a?rn(i,l):ge(i,a,l,e)}switch(t){case"input":we(i,n);break;case"textarea":Yi(i,n);break;case"select":t=i._wrapperState.wasMultiple,i._wrapperState.wasMultiple=!!n.multiple,null!=(r=n.value)?Hi(i,!!n.multiple,r,!1):t!==!!n.multiple&&(null!=n.defaultValue?Hi(i,!!n.multiple,n.defaultValue,!0):Hi(i,!!n.multiple,n.multiple?[]:"",!1))}}}break;case 8:null===e.stateNode&&s("162"),e.stateNode.nodeValue=e.memoizedProps;break;case 5:case 15:case 16:break;default:s("163")}}function fr(t,e,i){(i=$n(i)).tag=3,i.payload={element:null};var n=e.value;return i.callback=function(){ms(n),ar(t,e)},i}function mr(t,e,i){(i=$n(i)).tag=3;var n=t.stateNode;return null!==n&&"function"===typeof n.componentDidCatch&&(i.callback=function(){null===Mr?Mr=new Set([this]):Mr.add(this);var i=e.value,n=e.stack;ar(t,e),this.componentDidCatch(i,{componentStack:null!==n?n:""})}),i}function yr(t){switch(t.tag){case 2:Cn(t.type)&&On();var e=t.effectTag;return 1024&e?(t.effectTag=-1025&e|64,t):null;case 3:return Cn(t.type._reactResult)&&On(),1024&(e=t.effectTag)?(t.effectTag=-1025&e|64,t):null;case 5:return To(),Fn(),0!==(64&(e=t.effectTag))&&s("285"),t.effectTag=-1025&e|64,t;case 7:return Po(t),null;case 16:return 1024&(e=t.effectTag)?(t.effectTag=-1025&e|64,t):null;case 6:return To(),null;case 12:return po(t),null;default:return null}}or=function(){},rr=function(t,e,i){(e.updateQueue=i)&&nr(e)},sr=function(t,e,i,n){i!==n&&nr(e)};var vr={readContext:mo},gr=Ht.ReactCurrentOwner,_r=0,br=0,Sr=!1,Tr=null,wr=null,Pr=0,xr=!1,kr=null,Ar=!1,Mr=null;function Cr(){if(null!==Tr)for(var t=Tr.return;null!==t;){var e=t;switch(e.tag){case 2:var i=e.type.childContextTypes;null!==i&&void 0!==i&&On();break;case 3:null!==(i=e.type._reactResult.childContextTypes)&&void 0!==i&&On();break;case 5:To(),Fn();break;case 7:Po(e);break;case 6:To();break;case 12:po(e)}t=t.return}wr=null,Pr=0,xr=!1,Tr=null}function Or(t){for(;;){var e=t.alternate,i=t.return,n=t.sibling;if(0===(512&t.effectTag)){var r=e,a=(e=t).pendingProps;switch(e.tag){case 0:case 1:break;case 2:Cn(e.type)&&On();break;case 3:Cn(e.type._reactResult)&&On();break;case 5:To(),Fn(),(a=e.stateNode).pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),null!==r&&null!==r.child||(jo(e),e.effectTag&=-3),or(e);break;case 7:Po(e);var l=bo(_o.current),u=e.type;if(null!==r&&null!=e.stateNode){var h=r.memoizedProps;if(h!==a){var c=e.stateNode,d=bo(vo.current),p=c,f=u,m=h,y=a;c=l;var v=null;switch(f){case"input":m=be(p,m),y=be(p,y),v=[];break;case"option":m=Wi(p,m),y=Wi(p,y),v=[];break;case"select":m=o({},m,{value:void 0}),y=o({},y,{value:void 0}),v=[];break;case"textarea":m=Xi(p,m),y=Xi(p,y),v=[];break;default:"function"!==typeof m.onClick&&"function"===typeof y.onClick&&(p.onclick=pn)}hn(f,y),f=p=void 0;var g=null;for(p in m)if(!y.hasOwnProperty(p)&&m.hasOwnProperty(p)&&null!=m[p])if("style"===p){var b=m[p];for(f in b)b.hasOwnProperty(f)&&(g||(g={}),g[f]="")}else"dangerouslySetInnerHTML"!==p&&"children"!==p&&"suppressContentEditableWarning"!==p&&"suppressHydrationWarning"!==p&&"autoFocus"!==p&&(_.hasOwnProperty(p)?v||(v=[]):(v=v||[]).push(p,null));for(p in y){var S=y[p];if(b=null!=m?m[p]:void 0,y.hasOwnProperty(p)&&S!==b&&(null!=S||null!=b))if("style"===p)if(b){for(f in b)!b.hasOwnProperty(f)||S&&S.hasOwnProperty(f)||(g||(g={}),g[f]="");for(f in S)S.hasOwnProperty(f)&&b[f]!==S[f]&&(g||(g={}),g[f]=S[f])}else g||(v||(v=[]),v.push(p,g)),g=S;else"dangerouslySetInnerHTML"===p?(S=S?S.__html:void 0,b=b?b.__html:void 0,null!=S&&b!==S&&(v=v||[]).push(p,""+S)):"children"===p?b===S||"string"!==typeof S&&"number"!==typeof S||(v=v||[]).push(p,""+S):"suppressContentEditableWarning"!==p&&"suppressHydrationWarning"!==p&&(_.hasOwnProperty(p)?(null!=S&&dn(c,p),v||b===S||(v=[])):(v=v||[]).push(p,S))}g&&(v=v||[]).push("style",g),rr(r,e,v,u,h,a,l,d)}r.ref!==e.ref&&(e.effectTag|=128)}else if(a){if(v=bo(vo.current),jo(e)){switch(c=(a=e).stateNode,r=a.type,h=a.memoizedProps,d=l,c[D]=a,c[L]=h,u=void 0,l=c,r){case"iframe":case"object":xi("load",l);break;case"video":case"audio":for(c=0;c<ot.length;c++)xi(ot[c],l);break;case"source":xi("error",l);break;case"img":case"image":case"link":xi("error",l),xi("load",l);break;case"form":xi("reset",l),xi("submit",l);break;case"details":xi("toggle",l);break;case"input":Se(l,h),xi("invalid",l),dn(d,"onChange");break;case"select":l._wrapperState={wasMultiple:!!h.multiple},xi("invalid",l),dn(d,"onChange");break;case"textarea":Qi(l,h),xi("invalid",l),dn(d,"onChange")}for(u in hn(r,h),c=null,h)h.hasOwnProperty(u)&&(v=h[u],"children"===u?"string"===typeof v?l.textContent!==v&&(c=["children",v]):"number"===typeof v&&l.textContent!==""+v&&(c=["children",""+v]):_.hasOwnProperty(u)&&null!=v&&dn(d,u));switch(r){case"input":zt(l),Pe(l,h,!0);break;case"textarea":zt(l),$i(l);break;case"select":case"option":break;default:"function"===typeof h.onClick&&(l.onclick=pn)}u=c,a.updateQueue=u,(a=null!==u)&&nr(e)}else{h=e,r=u,d=a,c=9===l.nodeType?l:l.ownerDocument,v===Zi.html&&(v=Ji(r)),v===Zi.html?"script"===r?((r=c.createElement("div")).innerHTML="<script><\/script>",c=r.removeChild(r.firstChild)):"string"===typeof d.is?c=c.createElement(r,{is:d.is}):(c=c.createElement(r),"select"===r&&d.multiple&&(c.multiple=!0)):c=c.createElementNS(v,r),(r=c)[D]=h,r[L]=a;t:for(h=r,d=e,c=d.child;null!==c;){if(7===c.tag||8===c.tag)h.appendChild(c.stateNode);else if(6!==c.tag&&null!==c.child){c.child.return=c,c=c.child;continue}if(c===d)break;for(;null===c.sibling;){if(null===c.return||c.return===d)break t;c=c.return}c.sibling.return=c.return,c=c.sibling}switch(d=r,p=l,g=cn(c=u,h=a),c){case"iframe":case"object":xi("load",d),l=h;break;case"video":case"audio":for(l=0;l<ot.length;l++)xi(ot[l],d);l=h;break;case"source":xi("error",d),l=h;break;case"img":case"image":case"link":xi("error",d),xi("load",d),l=h;break;case"form":xi("reset",d),xi("submit",d),l=h;break;case"details":xi("toggle",d),l=h;break;case"input":Se(d,h),l=be(d,h),xi("invalid",d),dn(p,"onChange");break;case"option":l=Wi(d,h);break;case"select":d._wrapperState={wasMultiple:!!h.multiple},l=o({},h,{value:void 0}),xi("invalid",d),dn(p,"onChange");break;case"textarea":Qi(d,h),l=Xi(d,h),xi("invalid",d),dn(p,"onChange");break;default:l=h}for(v in hn(c,l),v=void 0,m=c,y=d,f=l)f.hasOwnProperty(v)&&(b=f[v],"style"===v?ln(y,b):"dangerouslySetInnerHTML"===v?null!=(b=b?b.__html:void 0)&&on(y,b):"children"===v?"string"===typeof b?("textarea"!==m||""!==b)&&rn(y,b):"number"===typeof b&&rn(y,""+b):"suppressContentEditableWarning"!==v&&"suppressHydrationWarning"!==v&&"autoFocus"!==v&&(_.hasOwnProperty(v)?null!=b&&dn(p,v):null!=b&&ge(y,v,b,g)));switch(c){case"input":zt(d),Pe(d,h,!1);break;case"textarea":zt(d),$i(d);break;case"option":null!=h.value&&d.setAttribute("value",""+_e(h.value));break;case"select":(l=d).multiple=!!h.multiple,null!=(d=h.value)?Hi(l,!!h.multiple,d,!1):null!=h.defaultValue&&Hi(l,!!h.multiple,h.defaultValue,!0);break;default:"function"===typeof l.onClick&&(d.onclick=pn)}(a=yn(u,a))&&nr(e),e.stateNode=r}null!==e.ref&&(e.effectTag|=128)}else null===e.stateNode&&s("166");break;case 8:r&&null!=e.stateNode?sr(r,e,r.memoizedProps,a):("string"!==typeof a&&(null===e.stateNode&&s("166")),l=bo(_o.current),bo(vo.current),jo(e)?(u=(a=e).stateNode,l=a.memoizedProps,u[D]=a,(a=u.nodeValue!==l)&&nr(e)):(u=e,(a=(9===l.nodeType?l:l.ownerDocument).createTextNode(a))[D]=u,e.stateNode=a));break;case 13:case 14:case 16:case 9:case 10:case 15:break;case 6:To(),or(e);break;case 12:po(e);break;case 11:break;case 4:s("167");default:s("156")}if(e=Tr=null,a=t,1073741823===Pr||1073741823!==a.childExpirationTime){for(u=0,l=a.child;null!==l;)r=l.expirationTime,h=l.childExpirationTime,(0===u||0!==r&&r<u)&&(u=r),(0===u||0!==h&&h<u)&&(u=h),l=l.sibling;a.childExpirationTime=u}if(null!==e)return e;null!==i&&0===(512&i.effectTag)&&(null===i.firstEffect&&(i.firstEffect=t.firstEffect),null!==t.lastEffect&&(null!==i.lastEffect&&(i.lastEffect.nextEffect=t.firstEffect),i.lastEffect=t.lastEffect),1<t.effectTag&&(null!==i.lastEffect?i.lastEffect.nextEffect=t:i.firstEffect=t,i.lastEffect=t))}else{if(null!==(t=yr(t)))return t.effectTag&=511,t;null!==i&&(i.firstEffect=i.lastEffect=null,i.effectTag|=512)}if(null!==n)return n;if(null===i)break;t=i}return null}function Fr(t){var e=ir(t.alternate,t,Pr);return null===e&&(e=Or(t)),gr.current=null,e}function Er(t,e,i){Sr&&s("243"),Sr=!0,gr.currentDispatcher=vr;var n=t.nextExpirationTimeToWorkOn;n===Pr&&t===wr&&null!==Tr||(Cr(),Pr=n,Tr=Vn((wr=t).current,null,Pr),t.pendingCommitExpirationTime=0);for(var o=!1;;){try{if(e)for(;null!==Tr&&!fs();)Tr=Fr(Tr);else for(;null!==Tr;)Tr=Fr(Tr)}catch(d){if(null===Tr)o=!0,ms(d);else{null===Tr&&s("271");var r=Tr,a=r.return;if(null!==a){t:{var l=a,u=r,h=d;a=Pr,u.effectTag|=512,u.firstEffect=u.lastEffect=null,xr=!0,h=so(h,u);do{switch(l.tag){case 5:l.effectTag|=1024,l.expirationTime=a,to(l,a=fr(l,h,a));break t;case 2:case 3:u=h;var c=l.stateNode;if(0===(64&l.effectTag)&&null!==c&&"function"===typeof c.componentDidCatch&&(null===Mr||!Mr.has(c))){l.effectTag|=1024,l.expirationTime=a,to(l,a=mr(l,u,a));break t}}l=l.return}while(null!==l)}Tr=Or(r);continue}o=!0,ms(d)}}break}if(Sr=!1,ho=uo=lo=gr.currentDispatcher=null,o)wr=null,t.finishedWork=null;else if(null!==Tr)t.finishedWork=null;else{if(null===(e=t.current.alternate)&&s("281"),wr=null,xr){if(o=t.latestPendingTime,r=t.latestSuspendedTime,a=t.latestPingedTime,0!==o&&o>n||0!==r&&r>n||0!==a&&a>n)return t.didError=!1,0!==(i=t.latestPingedTime)&&i<=n&&(t.latestPingedTime=0),i=t.earliestPendingTime,e=t.latestPendingTime,i===n?t.earliestPendingTime=e===n?t.latestPendingTime=0:e:e===n&&(t.latestPendingTime=i),i=t.earliestSuspendedTime,e=t.latestSuspendedTime,0===i?t.earliestSuspendedTime=t.latestSuspendedTime=n:i>n?t.earliestSuspendedTime=n:e<n&&(t.latestSuspendedTime=n),Hn(n,t),void(t.expirationTime=t.expirationTime);if(!t.didError&&!i)return t.didError=!0,t.nextExpirationTimeToWorkOn=n,n=t.expirationTime=1,void(t.expirationTime=n)}t.pendingCommitExpirationTime=n,t.finishedWork=e}}function Rr(t,e){var i;t:{for(Sr&&!Ar&&s("263"),i=t.return;null!==i;){switch(i.tag){case 2:case 3:var n=i.stateNode;if("function"===typeof i.type.getDerivedStateFromCatch||"function"===typeof n.componentDidCatch&&(null===Mr||!Mr.has(n))){Jn(i,t=mr(i,t=so(e,t),1)),Kr(i,1),i=void 0;break t}break;case 5:Jn(i,t=fr(i,t=so(e,t),1)),Kr(i,1),i=void 0;break t}i=i.return}5===t.tag&&(Jn(t,i=fr(t,i=so(e,t),1)),Kr(t,1)),i=void 0}return i}function Nr(t,e){return 0!==br?t=br:Sr?t=Ar?1:Pr:1&e.mode?(t=$r?2+10*(1+((t-2+15)/10|0)):2+25*(1+((t-2+500)/25|0)),null!==wr&&t===Pr&&(t+=1)):t=1,$r&&(0===jr||t>jr)&&(jr=t),t}function Kr(t,e){t:{(0===t.expirationTime||t.expirationTime>e)&&(t.expirationTime=e);var i=t.alternate;null!==i&&(0===i.expirationTime||i.expirationTime>e)&&(i.expirationTime=e);var n=t.return;if(null===n&&5===t.tag)t=t.stateNode;else{for(;null!==n;){if(i=n.alternate,(0===n.childExpirationTime||n.childExpirationTime>e)&&(n.childExpirationTime=e),null!==i&&(0===i.childExpirationTime||i.childExpirationTime>e)&&(i.childExpirationTime=e),null===n.return&&5===n.tag){t=n.stateNode;break t}n=n.return}t=null}}null!==t&&(!Sr&&0!==Pr&&e<Pr&&Cr(),Wn(t,e),Sr&&!Ar&&wr===t||(e=t,t=t.expirationTime,null===e.nextScheduledRoot?(e.expirationTime=t,null===qr?(Lr=qr=e,e.nextScheduledRoot=e):(qr=qr.nextScheduledRoot=e).nextScheduledRoot=Lr):(0===(i=e.expirationTime)||t<i)&&(e.expirationTime=t),Vr||(Qr?Yr&&(Br=e,Gr=1,ds(e,1,!0)):1===t?cs(1,null):as(e,t))),ns>is&&(ns=0,s("185")))}function Dr(t,e,i,n,o){var r=br;br=1;try{return t(e,i,n,o)}finally{br=r}}var Lr=null,qr=null,Ir=0,Ur=void 0,Vr=!1,Br=null,Gr=0,jr=0,zr=!1,Wr=!1,Hr=null,Xr=null,Qr=!1,Yr=!1,$r=!1,Zr=null,Jr=r.unstable_now(),ts=2+(Jr/10|0),es=ts,is=50,ns=0,os=null,rs=1;function ss(){ts=2+((r.unstable_now()-Jr)/10|0)}function as(t,e){if(0!==Ir){if(e>Ir)return;null!==Ur&&r.unstable_cancelScheduledWork(Ur)}Ir=e,t=r.unstable_now()-Jr,Ur=r.unstable_scheduleWork(hs,{timeout:10*(e-2)-t})}function ls(){return Vr?es:(us(),0!==Gr&&1073741823!==Gr||(ss(),es=ts),es)}function us(){var t=0,e=null;if(null!==qr)for(var i=qr,n=Lr;null!==n;){var o=n.expirationTime;if(0===o){if((null===i||null===qr)&&s("244"),n===n.nextScheduledRoot){Lr=qr=n.nextScheduledRoot=null;break}if(n===Lr)Lr=o=n.nextScheduledRoot,qr.nextScheduledRoot=o,n.nextScheduledRoot=null;else{if(n===qr){(qr=i).nextScheduledRoot=Lr,n.nextScheduledRoot=null;break}i.nextScheduledRoot=n.nextScheduledRoot,n.nextScheduledRoot=null}n=i.nextScheduledRoot}else{if((0===t||o<t)&&(t=o,e=n),n===qr)break;if(1===t)break;i=n,n=n.nextScheduledRoot}}Br=e,Gr=t}function hs(t){if(t.didTimeout&&null!==Lr){ss();var e=Lr;do{var i=e.expirationTime;0!==i&&ts>=i&&(e.nextExpirationTimeToWorkOn=ts),e=e.nextScheduledRoot}while(e!==Lr)}cs(0,t)}function cs(t,e){if(Xr=e,us(),null!==Xr)for(ss(),es=ts;null!==Br&&0!==Gr&&(0===t||t>=Gr)&&(!zr||ts>=Gr);)ds(Br,Gr,ts>=Gr),us(),ss(),es=ts;else for(;null!==Br&&0!==Gr&&(0===t||t>=Gr);)ds(Br,Gr,!0),us();if(null!==Xr&&(Ir=0,Ur=null),0!==Gr&&as(Br,Gr),Xr=null,zr=!1,ns=0,os=null,null!==Zr)for(t=Zr,Zr=null,e=0;e<t.length;e++){var i=t[e];try{i._onComplete()}catch(n){Wr||(Wr=!0,Hr=n)}}if(Wr)throw t=Hr,Hr=null,Wr=!1,t}function ds(t,e,i){if(Vr&&s("245"),Vr=!0,null===Xr||i){var n=t.finishedWork;null!==n?ps(t,n,e):(t.finishedWork=null,Er(t,!1,i),null!==(n=t.finishedWork)&&ps(t,n,e))}else null!==(n=t.finishedWork)?ps(t,n,e):(t.finishedWork=null,Er(t,!0,i),null!==(n=t.finishedWork)&&(fs()?t.finishedWork=n:ps(t,n,e)));Vr=!1}function ps(t,e,i){var n=t.firstBatch;if(null!==n&&n._expirationTime<=i&&(null===Zr?Zr=[n]:Zr.push(n),n._defer))return t.finishedWork=e,void(t.expirationTime=0);t.finishedWork=null,t===os?ns++:(os=t,ns=0),Ar=Sr=!0,t.current===e&&s("177"),0===(i=t.pendingCommitExpirationTime)&&s("261"),t.pendingCommitExpirationTime=0,n=e.expirationTime;var o=e.childExpirationTime;if(n=0===n||0!==o&&o<n?o:n,t.didError=!1,0===n?(t.earliestPendingTime=0,t.latestPendingTime=0,t.earliestSuspendedTime=0,t.latestSuspendedTime=0,t.latestPingedTime=0):(0!==(o=t.latestPendingTime)&&(o<n?t.earliestPendingTime=t.latestPendingTime=0:t.earliestPendingTime<n&&(t.earliestPendingTime=t.latestPendingTime)),0===(o=t.earliestSuspendedTime)?Wn(t,n):n>t.latestSuspendedTime?(t.earliestSuspendedTime=0,t.latestSuspendedTime=0,t.latestPingedTime=0,Wn(t,n)):n<o&&Wn(t,n)),Hn(0,t),gr.current=null,1<e.effectTag?null!==e.lastEffect?(e.lastEffect.nextEffect=e,n=e.firstEffect):n=e:n=e.firstEffect,fn=Pi,Li(o=Di())){if("selectionStart"in o)var r={start:o.selectionStart,end:o.selectionEnd};else t:{var a=(r=(r=o.ownerDocument)&&r.defaultView||window).getSelection&&r.getSelection();if(a&&0!==a.rangeCount){r=a.anchorNode;var l=a.anchorOffset,u=a.focusNode;a=a.focusOffset;try{r.nodeType,u.nodeType}catch(q){r=null;break t}var h=0,c=-1,d=-1,p=0,f=0,m=o,y=null;e:for(;;){for(var v;m!==r||0!==l&&3!==m.nodeType||(c=h+l),m!==u||0!==a&&3!==m.nodeType||(d=h+a),3===m.nodeType&&(h+=m.nodeValue.length),null!==(v=m.firstChild);)y=m,m=v;for(;;){if(m===o)break e;if(y===r&&++p===l&&(c=h),y===u&&++f===a&&(d=h),null!==(v=m.nextSibling))break;y=(m=y).parentNode}m=v}r=-1===c||-1===d?null:{start:c,end:d}}else r=null}r=r||{start:0,end:0}}else r=null;for(mn={focusedElem:o,selectionRange:r},Pi=!1,kr=n;null!==kr;){o=!1,r=void 0;try{for(;null!==kr;){if(256&kr.effectTag){var g=kr.alternate;t:switch(l=kr,l.tag){case 2:case 3:if(256&l.effectTag&&null!==g){var _=g.memoizedProps,b=g.memoizedState,S=l.stateNode;S.props=l.memoizedProps,S.state=l.memoizedState;var T=S.getSnapshotBeforeUpdate(_,b);S.__reactInternalSnapshotBeforeUpdate=T}break t;case 5:case 7:case 8:case 6:break t;default:s("163")}}kr=kr.nextEffect}}catch(q){o=!0,r=q}o&&(null===kr&&s("178"),Rr(kr,r),null!==kr&&(kr=kr.nextEffect))}for(kr=n;null!==kr;){g=!1,_=void 0;try{for(;null!==kr;){var w=kr.effectTag;if(16&w&&rn(kr.stateNode,""),128&w){var P=kr.alternate;if(null!==P){var x=P.ref;null!==x&&("function"===typeof x?x(null):x.current=null)}}switch(14&w){case 2:cr(kr),kr.effectTag&=-3;break;case 6:cr(kr),kr.effectTag&=-3,pr(kr.alternate,kr);break;case 4:pr(kr.alternate,kr);break;case 8:dr(b=kr),b.return=null,b.child=null,b.alternate&&(b.alternate.child=null,b.alternate.return=null)}kr=kr.nextEffect}}catch(q){g=!0,_=q}g&&(null===kr&&s("178"),Rr(kr,_),null!==kr&&(kr=kr.nextEffect))}if(x=mn,P=Di(),w=x.focusedElem,_=x.selectionRange,P!==w&&w&&w.ownerDocument&&function t(e,i){return!(!e||!i)&&(e===i||(!e||3!==e.nodeType)&&(i&&3===i.nodeType?t(e,i.parentNode):"contains"in e?e.contains(i):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(i))))}(w.ownerDocument.documentElement,w)){null!==_&&Li(w)&&(P=_.start,void 0===(x=_.end)&&(x=P),"selectionStart"in w?(w.selectionStart=P,w.selectionEnd=Math.min(x,w.value.length)):(P=((g=w.ownerDocument||document)?g.defaultView:window).getSelection(),b=w.textContent.length,x=Math.min(_.start,b),_=void 0===_.end?x:Math.min(_.end,b),!P.extend&&x>_&&(b=_,_=x,x=b),b=Ki(w,x),S=Ki(w,_),b&&S&&(1!==P.rangeCount||P.anchorNode!==b.node||P.anchorOffset!==b.offset||P.focusNode!==S.node||P.focusOffset!==S.offset)&&((g=g.createRange()).setStart(b.node,b.offset),P.removeAllRanges(),x>_?(P.addRange(g),P.extend(S.node,S.offset)):(g.setEnd(S.node,S.offset),P.addRange(g))))),P=[];for(x=w;x=x.parentNode;)1===x.nodeType&&P.push({element:x,left:x.scrollLeft,top:x.scrollTop});for("function"===typeof w.focus&&w.focus(),w=0;w<P.length;w++)(x=P[w]).element.scrollLeft=x.left,x.element.scrollTop=x.top}for(mn=null,Pi=!!fn,fn=null,t.current=e,kr=n;null!==kr;){n=!1,w=void 0;try{for(P=i;null!==kr;){var k=kr.effectTag;if(36&k){var A=kr.alternate;switch(g=P,(x=kr).tag){case 2:case 3:var M=x.stateNode;if(4&x.effectTag)if(null===A)M.props=x.memoizedProps,M.state=x.memoizedState,M.componentDidMount();else{var C=A.memoizedProps,O=A.memoizedState;M.props=x.memoizedProps,M.state=x.memoizedState,M.componentDidUpdate(C,O,M.__reactInternalSnapshotBeforeUpdate)}var F=x.updateQueue;null!==F&&(M.props=x.memoizedProps,M.state=x.memoizedState,oo(0,F,M));break;case 5:var E=x.updateQueue;if(null!==E){if(_=null,null!==x.child)switch(x.child.tag){case 7:_=x.child.stateNode;break;case 2:case 3:_=x.child.stateNode}oo(0,E,_)}break;case 7:var R=x.stateNode;null===A&&4&x.effectTag&&yn(x.type,x.memoizedProps)&&R.focus();break;case 8:case 6:case 15:case 16:break;default:s("163")}}if(128&k){var N=kr.ref;if(null!==N){var K=kr.stateNode;switch(kr.tag){case 7:var D=K;break;default:D=K}"function"===typeof N?N(D):N.current=D}}var L=kr.nextEffect;kr.nextEffect=null,kr=L}}catch(q){n=!0,w=q}n&&(null===kr&&s("178"),Rr(kr,w),null!==kr&&(kr=kr.nextEffect))}Sr=Ar=!1,"function"===typeof Dn&&Dn(e.stateNode),k=e.expirationTime,e=e.childExpirationTime,0===(e=0===k||0!==e&&e<k?e:k)&&(Mr=null),t.expirationTime=e,t.finishedWork=null}function fs(){return!!zr||!(null===Xr||Xr.timeRemaining()>rs)&&(zr=!0)}function ms(t){null===Br&&s("246"),Br.expirationTime=0,Wr||(Wr=!0,Hr=t)}function ys(t,e){var i=Qr;Qr=!0;try{return t(e)}finally{(Qr=i)||Vr||cs(1,null)}}function vs(t,e){if(Qr&&!Yr){Yr=!0;try{return t(e)}finally{Yr=!1}}return t(e)}function gs(t,e,i){if($r)return t(e,i);Qr||Vr||0===jr||(cs(jr,null),jr=0);var n=$r,o=Qr;Qr=$r=!0;try{return t(e,i)}finally{$r=n,(Qr=o)||Vr||cs(1,null)}}function _s(t,e,i,n,o){var r=e.current;return i=function(t){if(!t)return Pn;t:{(2!==ii(t=t._reactInternalFiber)||2!==t.tag&&3!==t.tag)&&s("170");var e=t;do{switch(e.tag){case 5:e=e.stateNode.context;break t;case 2:if(Cn(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break t}break;case 3:if(Cn(e.type._reactResult)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break t}}e=e.return}while(null!==e);s("171"),e=void 0}if(2===t.tag){var i=t.type;if(Cn(i))return Rn(t,i,e)}else if(3===t.tag&&Cn(i=t.type._reactResult))return Rn(t,i,e);return e}(i),null===e.context?e.context=i:e.pendingContext=i,e=o,(o=$n(n)).payload={element:t},null!==(e=void 0===e?null:e)&&(o.callback=e),Jn(r,o),Kr(r,n),n}function bs(t,e,i,n){var o=e.current;return _s(t,e,i,o=Nr(ls(),o),n)}function Ss(t){if(!(t=t.current).child)return null;switch(t.child.tag){case 7:default:return t.child.stateNode}}function Ts(t){var e=2+25*(1+((ls()-2+500)/25|0));e<=_r&&(e=_r+1),this._expirationTime=_r=e,this._root=t,this._callbacks=this._next=null,this._hasChildren=this._didComplete=!1,this._children=null,this._defer=!0}function ws(){this._callbacks=null,this._didCommit=!1,this._onCommit=this._onCommit.bind(this)}function Ps(t,e,i){t={current:e=new In(5,null,null,e?3:0),containerInfo:t,pendingChildren:null,earliestPendingTime:0,latestPendingTime:0,earliestSuspendedTime:0,latestSuspendedTime:0,latestPingedTime:0,didError:!1,pendingCommitExpirationTime:0,finishedWork:null,timeoutHandle:-1,context:null,pendingContext:null,hydrate:i,nextExpirationTimeToWorkOn:0,expirationTime:0,firstBatch:null,nextScheduledRoot:null},this._internalRoot=e.stateNode=t}function xs(t){return!(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType&&(8!==t.nodeType||" react-mount-point-unstable "!==t.nodeValue))}function ks(t,e,i,n,o){xs(i)||s("200");var r=i._reactRootContainer;if(r){if("function"===typeof o){var a=o;o=function(){var t=Ss(r._internalRoot);a.call(t)}}null!=t?r.legacy_renderSubtreeIntoContainer(t,e,o):r.render(e,o)}else{if(r=i._reactRootContainer=function(t,e){if(e||(e=!(!(e=t?9===t.nodeType?t.documentElement:t.firstChild:null)||1!==e.nodeType||!e.hasAttribute("data-reactroot"))),!e)for(var i;i=t.lastChild;)t.removeChild(i);return new Ps(t,!1,e)}(i,n),"function"===typeof o){var l=o;o=function(){var t=Ss(r._internalRoot);l.call(t)}}vs(function(){null!=t?r.legacy_renderSubtreeIntoContainer(t,e,o):r.render(e,o)})}return Ss(r._internalRoot)}function As(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;return xs(e)||s("200"),function(t,e,i){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:$t,key:null==n?null:""+n,children:t,containerInfo:e,implementation:i}}(t,e,null,i)}Ct=function(t,e,i){switch(e){case"input":if(we(t,i),e=i.name,"radio"===i.type&&null!=e){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<i.length;e++){var n=i[e];if(n!==t&&n.form===t.form){var o=V(n);o||s("90"),Wt(n),we(n,o)}}}break;case"textarea":Yi(t,i);break;case"select":null!=(e=i.value)&&Hi(t,!!i.multiple,e,!1)}},Ts.prototype.render=function(t){this._defer||s("250"),this._hasChildren=!0,this._children=t;var e=this._root._internalRoot,i=this._expirationTime,n=new ws;return _s(t,e,null,i,n._onCommit),n},Ts.prototype.then=function(t){if(this._didComplete)t();else{var e=this._callbacks;null===e&&(e=this._callbacks=[]),e.push(t)}},Ts.prototype.commit=function(){var t=this._root._internalRoot,e=t.firstBatch;if(this._defer&&null!==e||s("251"),this._hasChildren){var i=this._expirationTime;if(e!==this){this._hasChildren&&(i=this._expirationTime=e._expirationTime,this.render(this._children));for(var n=null,o=e;o!==this;)n=o,o=o._next;null===n&&s("251"),n._next=o._next,this._next=e,t.firstBatch=this}this._defer=!1,e=i,Vr&&s("253"),Br=t,Gr=e,ds(t,e,!0),cs(1,null),e=this._next,this._next=null,null!==(e=t.firstBatch=e)&&e._hasChildren&&e.render(e._children)}else this._next=null,this._defer=!1},Ts.prototype._onComplete=function(){if(!this._didComplete){this._didComplete=!0;var t=this._callbacks;if(null!==t)for(var e=0;e<t.length;e++)(0,t[e])()}},ws.prototype.then=function(t){if(this._didCommit)t();else{var e=this._callbacks;null===e&&(e=this._callbacks=[]),e.push(t)}},ws.prototype._onCommit=function(){if(!this._didCommit){this._didCommit=!0;var t=this._callbacks;if(null!==t)for(var e=0;e<t.length;e++){var i=t[e];"function"!==typeof i&&s("191",i),i()}}},Ps.prototype.render=function(t,e){var i=this._internalRoot,n=new ws;return null!==(e=void 0===e?null:e)&&n.then(e),bs(t,i,null,n._onCommit),n},Ps.prototype.unmount=function(t){var e=this._internalRoot,i=new ws;return null!==(t=void 0===t?null:t)&&i.then(t),bs(null,e,null,i._onCommit),i},Ps.prototype.legacy_renderSubtreeIntoContainer=function(t,e,i){var n=this._internalRoot,o=new ws;return null!==(i=void 0===i?null:i)&&o.then(i),bs(e,n,t,o._onCommit),o},Ps.prototype.createBatch=function(){var t=new Ts(this),e=t._expirationTime,i=this._internalRoot,n=i.firstBatch;if(null===n)i.firstBatch=t,t._next=null;else{for(i=null;null!==n&&n._expirationTime<=e;)i=n,n=n._next;t._next=n,null!==i&&(i._next=t)}return t},Kt=ys,Dt=gs,Lt=function(){Vr||0===jr||(cs(jr,null),jr=0)};var Ms={createPortal:As,findDOMNode:function(t){if(null==t)return null;if(1===t.nodeType)return t;var e=t._reactInternalFiber;return void 0===e&&("function"===typeof t.render?s("188"):s("268",Object.keys(t))),t=null===(t=oi(e))?null:t.stateNode},hydrate:function(t,e,i){return ks(null,t,e,!0,i)},render:function(t,e,i){return ks(null,t,e,!1,i)},unstable_renderSubtreeIntoContainer:function(t,e,i,n){return(null==t||void 0===t._reactInternalFiber)&&s("38"),ks(t,e,i,!1,n)},unmountComponentAtNode:function(t){return xs(t)||s("40"),!!t._reactRootContainer&&(vs(function(){ks(null,null,t,!1,function(){t._reactRootContainer=null})}),!0)},unstable_createPortal:function(){return As.apply(void 0,arguments)},unstable_batchedUpdates:ys,unstable_interactiveUpdates:gs,flushSync:function(t,e){Vr&&s("187");var i=Qr;Qr=!0;try{return Dr(t,e)}finally{Qr=i,cs(1,null)}},unstable_flushControlled:function(t){var e=Qr;Qr=!0;try{Dr(t)}finally{(Qr=e)||Vr||cs(1,null)}},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{Events:[I,U,V,g,H,function(t){k(t,W)},Rt,Nt,Mi,N]},unstable_createRoot:function(t,e){return xs(t)||s("278"),new Ps(t,!0,null!=e&&!0===e.hydrate)}};!function(t){var e=t.findFiberByHostInstance;(function(t){if("undefined"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var e=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(e.isDisabled||!e.supportsFiber)return!0;try{var i=e.inject(t);Dn=qn(function(t){return e.onCommitFiberRoot(i,t)}),Ln=qn(function(t){return e.onCommitFiberUnmount(i,t)})}catch(n){}})(o({},t,{findHostInstanceByFiber:function(t){return null===(t=oi(t))?null:t.stateNode},findFiberByHostInstance:function(t){return e?e(t):null}}))}({findFiberByHostInstance:q,bundleType:0,version:"16.5.0",rendererPackageName:"react-dom"});var Cs={default:Ms},Os=Cs&&Ms||Cs;t.exports=Os.default||Os},function(t,e,i){"use strict";t.exports=i(24)},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=!("undefined"===typeof window||!window.document||!window.document.createElement),o=Date,r="function"===typeof setTimeout?setTimeout:void 0,s="function"===typeof clearTimeout?clearTimeout:void 0,a="function"===typeof requestAnimationFrame?requestAnimationFrame:void 0,l="function"===typeof cancelAnimationFrame?cancelAnimationFrame:void 0,u="object"===typeof performance&&"function"===typeof performance.now;if(e.unstable_now=void 0,u){var h=performance;e.unstable_now=function(){return h.now()}}else e.unstable_now=function(){return o.now()};if(e.unstable_scheduleWork=void 0,e.unstable_cancelScheduledWork=void 0,n){var c=null,d=null,p=-1,f=!1,m=!1,y=void 0,v=void 0,g=function(t){y=a(function(e){s(v),t(e)}),v=r(function(){l(y),t(e.unstable_now())},100)},_=0,b=33,S=33,T={didTimeout:!1,timeRemaining:function(){var t=_-e.unstable_now();return 0<t?t:0}},w=function(t,i){var n=t.scheduledCallback,o=!1;try{n(i),o=!0}finally{e.unstable_cancelScheduledWork(t),o||(f=!0,window.postMessage(P,"*"))}},P="__reactIdleCallback$"+Math.random().toString(36).slice(2);window.addEventListener("message",function(t){if(t.source===window&&t.data===P&&(f=!1,null!==c)){if(null!==c){var i=e.unstable_now();if(!(-1===p||p>i)){t=-1;for(var n=[],o=c;null!==o;){var r=o.timeoutTime;-1!==r&&r<=i?n.push(o):-1!==r&&(-1===t||r<t)&&(t=r),o=o.next}if(0<n.length)for(T.didTimeout=!0,i=0,o=n.length;i<o;i++)w(n[i],T);p=t}}for(t=e.unstable_now();0<_-t&&null!==c;)t=c,T.didTimeout=!1,w(t,T),t=e.unstable_now();null===c||m||(m=!0,g(x))}},!1);var x=function(t){m=!1;var e=t-_+S;e<S&&b<S?(8>e&&(e=8),S=e<b?b:e):b=e,_=t+S,f||(f=!0,window.postMessage(P,"*"))};e.unstable_scheduleWork=function(t,i){var n=-1;return null!=i&&"number"===typeof i.timeout&&(n=e.unstable_now()+i.timeout),(-1===p||-1!==n&&n<p)&&(p=n),t={scheduledCallback:t,timeoutTime:n,prev:null,next:null},null===c?c=t:null!==(i=t.prev=d)&&(i.next=t),d=t,m||(m=!0,g(x)),t},e.unstable_cancelScheduledWork=function(t){if(null!==t.prev||c===t){var e=t.next,i=t.prev;t.next=null,t.prev=null,null!==e?null!==i?(i.next=e,e.prev=i):(e.prev=null,c=e):null!==i?(i.next=null,d=i):d=c=null}}}else{var k=new Map;e.unstable_scheduleWork=function(t){var e={scheduledCallback:t,timeoutTime:0,next:null,prev:null},i=r(function(){t({timeRemaining:function(){return 1/0},didTimeout:!1})});return k.set(t,i),e},e.unstable_cancelScheduledWork=function(t){var e=k.get(t.scheduledCallback);k.delete(t),s(e)}}},,,,,,,,,,,,,,,,function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),o=h(i(41)),r=i(0),s=h(r),a=h(i(42)),l=h(i(45)),u=i(46);function h(t){return t&&t.__esModule?t:{default:t}}function c(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var d={orientation:{horizontal:{dimension:"width",direction:"left",reverseDirection:"right",coordinate:"x"},vertical:{dimension:"height",direction:"top",reverseDirection:"bottom",coordinate:"y"}}},p=function(t){function e(t,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i));return n.handleFormat=function(t){var e=n.props.format;return e?e(t):t},n.handleUpdate=function(){if(n.slider){var t=n.props.orientation,e=(0,u.capitalize)(d.orientation[t].dimension),i=n.slider["offset"+e],o=n.handle["offset"+e];n.setState({limit:i-o,grab:o/2})}},n.handleStart=function(t){var e=n.props.onChangeStart;document.addEventListener("mousemove",n.handleDrag),document.addEventListener("mouseup",n.handleEnd),n.setState({active:!0},function(){e&&e(t)})},n.handleDrag=function(t){t.stopPropagation();var e=n.props.onChange,i=t.target,o=i.className,r=i.classList,s=i.dataset;if(e&&"rangeslider__labels"!==o){var a=n.position(t);r&&r.contains("rangeslider__label-item")&&s.value&&(a=parseFloat(s.value)),e&&e(a,t)}},n.handleEnd=function(t){var e=n.props.onChangeComplete;n.setState({active:!1},function(){e&&e(t)}),document.removeEventListener("mousemove",n.handleDrag),document.removeEventListener("mouseup",n.handleEnd)},n.handleKeyDown=function(t){t.preventDefault();var e=t.keyCode,i=n.props,o=i.value,r=i.min,s=i.max,a=i.step,l=i.onChange,u=void 0;switch(e){case 38:case 39:u=o+a>s?s:o+a,l&&l(u,t);break;case 37:case 40:u=o-a<r?r:o-a,l&&l(u,t)}},n.getPositionFromValue=function(t){var e=n.state.limit,i=n.props,o=i.min,r=(t-o)/(i.max-o);return Math.round(r*e)},n.getValueFromPosition=function(t){var e=n.state.limit,i=n.props,o=i.orientation,r=i.min,s=i.max,a=i.step,l=(0,u.clamp)(t,0,e)/(e||1),h=a*Math.round(l*(s-r)/a),c="horizontal"===o?h+r:s-h;return(0,u.clamp)(c,r,s)},n.position=function(t){var e=n.state.grab,i=n.props,o=i.orientation,r=i.reverse,s=n.slider,a=d.orientation[o].coordinate,l=r?d.orientation[o].reverseDirection:d.orientation[o].direction,h="client"+(0,u.capitalize)(a),c=t.touches?t.touches[0][h]:t[h],p=s.getBoundingClientRect()[l],f=r?p-c-e:c-p-e;return n.getValueFromPosition(f)},n.coordinates=function(t){var e=n.state,i=e.limit,o=e.grab,r=n.props.orientation,s=n.getValueFromPosition(t),a=n.getPositionFromValue(s),l="horizontal"===r?a+o:a;return{fill:"horizontal"===r?l:i-l,handle:l,label:l}},n.renderLabels=function(t){return s.default.createElement("ul",{ref:function(t){n.labels=t},className:(0,o.default)("rangeslider__labels")},t)},n.state={active:!1,limit:0,grab:0},n}return function(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,r.Component),n(e,[{key:"componentDidMount",value:function(){this.handleUpdate(),new l.default(this.handleUpdate).observe(this.slider)}},{key:"render",value:function(){var t=this,e=this.props,i=e.value,n=e.orientation,r=e.className,a=e.tooltip,l=e.reverse,u=e.labels,h=e.min,p=e.max,f=e.handleLabel,m=this.state.active,y=d.orientation[n].dimension,v=l?d.orientation[n].reverseDirection:d.orientation[n].direction,g=this.getPositionFromValue(i),_=this.coordinates(g),b=c({},y,_.fill+"px"),S=c({},v,_.handle+"px"),T=a&&m,w=[],P=Object.keys(u);if(P.length>0){P=P.sort(function(t,e){return l?t-e:e-t});var x=!0,k=!1,A=void 0;try{for(var M,C=P[Symbol.iterator]();!(x=(M=C.next()).done);x=!0){var O=M.value,F=this.getPositionFromValue(O),E=c({},v,this.coordinates(F).label+"px");w.push(s.default.createElement("li",{key:O,className:(0,o.default)("rangeslider__label-item"),"data-value":O,onMouseDown:this.handleDrag,onTouchStart:this.handleStart,onTouchEnd:this.handleEnd,style:E},this.props.labels[O]))}}catch(R){k=!0,A=R}finally{try{!x&&C.return&&C.return()}finally{if(k)throw A}}}return s.default.createElement("div",{ref:function(e){t.slider=e},className:(0,o.default)("rangeslider","rangeslider-"+n,{"rangeslider-reverse":l},r),onMouseDown:this.handleDrag,onMouseUp:this.handleEnd,onTouchStart:this.handleStart,onTouchEnd:this.handleEnd,"aria-valuemin":h,"aria-valuemax":p,"aria-valuenow":i,"aria-orientation":n},s.default.createElement("div",{className:"rangeslider__fill",style:b}),s.default.createElement("div",{ref:function(e){t.handle=e},className:"rangeslider__handle",onMouseDown:this.handleStart,onTouchMove:this.handleDrag,onTouchEnd:this.handleEnd,onKeyDown:this.handleKeyDown,style:S,tabIndex:0},T?s.default.createElement("div",{ref:function(e){t.tooltip=e},className:"rangeslider__handle-tooltip"},s.default.createElement("span",null,this.handleFormat(i))):null,s.default.createElement("div",{className:"rangeslider__handle-label"},f)),u?this.renderLabels(w):null)}}]),e}();p.propTypes={min:a.default.number,max:a.default.number,step:a.default.number,value:a.default.number,orientation:a.default.string,tooltip:a.default.bool,reverse:a.default.bool,labels:a.default.object,handleLabel:a.default.string,format:a.default.func,onChangeStart:a.default.func,onChange:a.default.func,onChangeComplete:a.default.func},p.defaultProps={min:0,max:100,step:1,value:0,orientation:"horizontal",tooltip:!0,reverse:!1,labels:{},handleLabel:""},e.default=p},function(t,e,i){var n;!function(){"use strict";var i={}.hasOwnProperty;function o(){for(var t=[],e=0;e<arguments.length;e++){var n=arguments[e];if(n){var r=typeof n;if("string"===r||"number"===r)t.push(n);else if(Array.isArray(n)&&n.length){var s=o.apply(null,n);s&&t.push(s)}else if("object"===r)for(var a in n)i.call(n,a)&&n[a]&&t.push(a)}}return t.join(" ")}"undefined"!==typeof t&&t.exports?(o.default=o,t.exports=o):void 0===(n=function(){return o}.apply(e,[]))||(t.exports=n)}()},function(t,e,i){t.exports=i(43)()},function(t,e,i){"use strict";var n=i(44);function o(){}t.exports=function(){function t(t,e,i,o,r,s){if(s!==n){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function e(){return t}t.isRequired=t;var i={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e};return i.checkPropTypes=o,i.PropTypes=i,i}},function(t,e,i){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,e,i){"use strict";i.r(e),function(t){var i=function(){if("undefined"!==typeof Map)return Map;function t(t,e){var i=-1;return t.some(function(t,n){return t[0]===e&&(i=n,!0)}),i}return function(){function e(){this.__entries__=[]}var i={size:{configurable:!0}};return i.size.get=function(){return this.__entries__.length},e.prototype.get=function(e){var i=t(this.__entries__,e),n=this.__entries__[i];return n&&n[1]},e.prototype.set=function(e,i){var n=t(this.__entries__,e);~n?this.__entries__[n][1]=i:this.__entries__.push([e,i])},e.prototype.delete=function(e){var i=this.__entries__,n=t(i,e);~n&&i.splice(n,1)},e.prototype.has=function(e){return!!~t(this.__entries__,e)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var i=0,n=this.__entries__;i<n.length;i+=1){var o=n[i];t.call(e,o[1],o[0])}},Object.defineProperties(e.prototype,i),e}()}(),n="undefined"!==typeof window&&"undefined"!==typeof document&&window.document===document,o="undefined"!==typeof t&&t.Math===Math?t:"undefined"!==typeof self&&self.Math===Math?self:"undefined"!==typeof window&&window.Math===Math?window:Function("return this")(),r="function"===typeof requestAnimationFrame?requestAnimationFrame.bind(o):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)},s=2,a=["top","right","bottom","left","width","height","size","weight"],l="undefined"!==typeof MutationObserver,u=function(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(t,e){var i=!1,n=!1,o=0;function a(){i&&(i=!1,t()),n&&u()}function l(){r(a)}function u(){var t=Date.now();if(i){if(t-o<s)return;n=!0}else i=!0,n=!1,setTimeout(l,e);o=t}return u}(this.refresh.bind(this),20)};u.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},u.prototype.removeObserver=function(t){var e=this.observers_,i=e.indexOf(t);~i&&e.splice(i,1),!e.length&&this.connected_&&this.disconnect_()},u.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},u.prototype.updateObservers_=function(){var t=this.observers_.filter(function(t){return t.gatherActive(),t.hasActive()});return t.forEach(function(t){return t.broadcastActive()}),t.length>0},u.prototype.connect_=function(){n&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),l?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},u.prototype.disconnect_=function(){n&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},u.prototype.onTransitionEnd_=function(t){var e=t.propertyName;void 0===e&&(e=""),a.some(function(t){return!!~e.indexOf(t)})&&this.refresh()},u.getInstance=function(){return this.instance_||(this.instance_=new u),this.instance_},u.instance_=null;var h=function(t,e){for(var i=0,n=Object.keys(e);i<n.length;i+=1){var o=n[i];Object.defineProperty(t,o,{value:e[o],enumerable:!1,writable:!1,configurable:!0})}return t},c=function(t){return t&&t.ownerDocument&&t.ownerDocument.defaultView||o},d=g(0,0,0,0);function p(t){return parseFloat(t)||0}function f(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];return e.reduce(function(e,i){return e+p(t["border-"+i+"-width"])},0)}function m(t){var e=t.clientWidth,i=t.clientHeight;if(!e&&!i)return d;var n=c(t).getComputedStyle(t),o=function(t){for(var e={},i=0,n=["top","right","bottom","left"];i<n.length;i+=1){var o=n[i],r=t["padding-"+o];e[o]=p(r)}return e}(n),r=o.left+o.right,s=o.top+o.bottom,a=p(n.width),l=p(n.height);if("border-box"===n.boxSizing&&(Math.round(a+r)!==e&&(a-=f(n,"left","right")+r),Math.round(l+s)!==i&&(l-=f(n,"top","bottom")+s)),!function(t){return t===c(t).document.documentElement}(t)){var u=Math.round(a+r)-e,h=Math.round(l+s)-i;1!==Math.abs(u)&&(a-=u),1!==Math.abs(h)&&(l-=h)}return g(o.left,o.top,a,l)}var y="undefined"!==typeof SVGGraphicsElement?function(t){return t instanceof c(t).SVGGraphicsElement}:function(t){return t instanceof c(t).SVGElement&&"function"===typeof t.getBBox};function v(t){return n?y(t)?function(t){var e=t.getBBox();return g(0,0,e.width,e.height)}(t):m(t):d}function g(t,e,i,n){return{x:t,y:e,width:i,height:n}}var _=function(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=g(0,0,0,0),this.target=t};_.prototype.isActive=function(){var t=v(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},_.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t};var b=function(t,e){var i=function(t){var e=t.x,i=t.y,n=t.width,o=t.height,r="undefined"!==typeof DOMRectReadOnly?DOMRectReadOnly:Object,s=Object.create(r.prototype);return h(s,{x:e,y:i,width:n,height:o,top:i,right:e+n,bottom:o+i,left:e}),s}(e);h(this,{target:t,contentRect:i})},S=function(t,e,n){if(this.activeObservations_=[],this.observations_=new i,"function"!==typeof t)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=e,this.callbackCtx_=n};S.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!==typeof Element&&Element instanceof Object){if(!(t instanceof c(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)||(e.set(t,new _(t)),this.controller_.addObserver(this),this.controller_.refresh())}},S.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!==typeof Element&&Element instanceof Object){if(!(t instanceof c(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)&&(e.delete(t),e.size||this.controller_.removeObserver(this))}},S.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},S.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(e){e.isActive()&&t.activeObservations_.push(e)})},S.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,e=this.activeObservations_.map(function(t){return new b(t.target,t.broadcastRect())});this.callback_.call(t,e,t),this.clearActive()}},S.prototype.clearActive=function(){this.activeObservations_.splice(0)},S.prototype.hasActive=function(){return this.activeObservations_.length>0};var T="undefined"!==typeof WeakMap?new WeakMap:new i,w=function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var i=u.getInstance(),n=new S(e,i,this);T.set(this,n)};["observe","unobserve","disconnect"].forEach(function(t){w.prototype[t]=function(){return(e=T.get(this))[t].apply(e,arguments);var e}});var P="undefined"!==typeof o.ResizeObserver?o.ResizeObserver:w;e.default=P}.call(this,i(12))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.capitalize=function(t){return t.charAt(0).toUpperCase()+t.substr(1)},e.clamp=function(t,e,i){return Math.min(Math.max(t,e),i)}}]]);
  //# sourceMappingURL=1.5388b013.chunk.js.map