async-kit
Version:
A simple and powerful async abstraction lib for easily writing Node.js code.
4 lines • 104 kB
JavaScript
(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.createTeaTime=e()}})(function(){var e,t,r;return function n(e,t,r){function i(o,a){if(!t[o]){if(!e[o]){var l=typeof require=="function"&&require;if(!a&&l)return l(o,!0);if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=t[o]={exports:{}};e[o][0].call(c.exports,function(t){var r=e[o][1][t];return i(r?r:t)},c,c.exports,n,e,t,r)}return t[o].exports}var s=typeof require=="function"&&require;for(var o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t,r){"use strict";function n(e,t){if(!t){t=Object.create(n.prototype,{teaTime:{value:e,enumerable:true}})}document.querySelector("body").insertAdjacentHTML("beforeend",'<div class="tea-time-classic-reporter" style="background-color:black;color:white"></div>');t.container=document.querySelector("div.tea-time-classic-reporter");t.teaTime.on("enterSuite",n.enterSuite.bind(t));t.teaTime.on("ok",n.ok.bind(t));t.teaTime.on("fail",n.fail.bind(t));t.teaTime.on("skip",n.skip.bind(t));t.teaTime.on("report",n.report.bind(t));t.teaTime.on("errorReport",n.errorReport.bind(t));return t}t.exports=n;function i(){(document.querySelector("div.tea-time-classic-reporter p:last-child")||document.querySelector("div.tea-time-classic-reporter h4:last-child")||document.querySelector("div.tea-time-classic-reporter pre:last-child")).scrollIntoView()}function s(e){return"margin-left:"+(1+2*e)+"%;"}var o="color:green;";var a="color:red;";var l="color:blue;";var u="color:grey;";var c="color:yellow;";var f="color:red;";var p="color:red;font-weight:bold;";var h="background-color:red;color:white;font-weight:bold;";var d="background-color:green;color:white;font-weight:bold;";var g="background-color:red;color:white;font-weight:bold;";n.enterSuite=function b(e,t){this.container.insertAdjacentHTML("beforeend",'<h4 class="tea-time-classic-reporter" style="'+s(t)+'">'+e+"</h4>");i()};n.ok=function y(e,t,r,n){var a="✔ "+e;if(!n){a+=' <span style="'+u+'">('+r+"ms)</span>"}else if(n===1){a+=' <span style="'+c+'">('+r+"ms)</span>"}else{a+=' <span style="'+f+'">('+r+"ms)</span>"}this.container.insertAdjacentHTML("beforeend",'<p class="tea-time-classic-reporter" style="'+o+s(t)+'">'+a+"</p>");i()};n.fail=function m(e,t,r,n,o){var l="✘ "+e;if(r!==undefined){if(!n){l+=' <span style="'+u+'">('+r+"ms)</span>"}else if(n===1){l+=' <span style="'+c+'">('+r+"ms)</span>"}else{l+=' <span style="'+f+'">('+r+"ms)</span>"}}this.container.insertAdjacentHTML("beforeend",'<p class="tea-time-classic-reporter" style="'+a+s(t)+'">'+l+"</p>");i()};n.skip=function v(e,t){var r="· "+e;this.container.insertAdjacentHTML("beforeend",'<p class="tea-time-classic-reporter" style="'+l+s(t)+'">'+r+"</p>");i()};n.report=function x(e,t,r){this.container.insertAdjacentHTML("beforeend","<hr />"+'<p class="tea-time-classic-reporter" style="font-weight:bold;'+o+s(1)+'">'+e+" passing</p>"+'<p class="tea-time-classic-reporter" style="font-weight:bold;'+a+s(1)+'">'+t+" failing</p>"+'<p class="tea-time-classic-reporter" style="font-weight:bold;'+l+s(1)+'">'+r+" pending</p>");i()};n.errorReport=function w(e){var t,r,n="";n+='<h4 class="tea-time-classic-reporter" style="'+p+s(0)+'">== Errors ==</h4>';for(t=0;t<e.length;t++){r=e[t];n+='<p class="tea-time-classic-reporter" style="'+p+s(1)+'">'+(t+1)+" ) ";switch(r.type){case"test":if(r.error.testTimeout){n+='<span style="'+h+'">TEST TIMEOUT</span> '}break;case"setup":n+='<span style="'+h+'">SETUP HOOK</span> ';break;case"teardown":n+='<span style="'+h+'">TEARDOWN HOOK</span> ';break;case"suiteSetup":n+='<span style="'+h+'">SUITE SETUP HOOK</span> ';break;case"suiteTeardown":n+='<span style="'+h+'">SUITE TEARDOWN HOOK</span> ';break}n+=r.name;n+="</p>";n+=this.reportOneError(r.error)}this.container.insertAdjacentHTML("beforeend","<hr />"+n);i()};n.prototype.reportOneError=function k(e){var t="";if(e.expected&&e.actual){t+='<p class="tea-time-classic-reporter" style="'+s(2)+'">'+'<span style="'+d+'">expected</span><span style="'+g+'">actual</span>'+"</p>";t+='<pre class="tea-time-classic-reporter"; style="'+s(2)+'">';t+=this.teaTime.htmlColorDiff(e.actual,e.expected);t+="</pre>"}t+='<pre class="tea-time-classic-reporter" style="'+s(2)+'">'+this.teaTime.inspect.inspectError({style:"html"},e)+"</pre>";return t}},{}],2:[function(e,t,r){"use strict";function n(e,t){if(!t){t=Object.create(n.prototype,{teaTime:{value:e,enumerable:true}})}t.teaTime.on("ok",n.ok.bind(t));t.teaTime.on("fail",n.fail.bind(t));t.teaTime.on("skip",n.skip.bind(t));t.teaTime.on("report",n.report.bind(t));return t}t.exports=n;n.ok=function i(e,t,r,n){console.log("OK:",e,"("+r+")")};n.fail=function s(e,t,r,n,i){console.log("Fail:",e,r!==undefined?"("+r+")":"")};n.skip=function o(e,t){console.log("Pending:",e)};n.report=function a(e,t,r){console.log("Report -- ok:",e," fail:",t," pending:",r)}},{}],3:[function(e,t,r){"use strict";function n(e,t){if(!t){t=Object.create(n.prototype,{teaTime:{value:e,enumerable:true}})}t.teaTime.on("ready",{fn:n.ready.bind(t),async:true});t.teaTime.on("run",n.forward.bind(t,"run"));t.teaTime.on("enterSuite",n.forward.bind(t,"enterSuite"));t.teaTime.on("exitSuite",n.forward.bind(t,"exitSuite"));t.teaTime.on("enterTest",n.forward.bind(t,"enterTest"));t.teaTime.on("exitTest",n.forward.bind(t,"exitTest"));t.teaTime.on("ok",n.forward.bind(t,"ok"));t.teaTime.on("fail",n.forward.bind(t,"fail"));t.teaTime.on("skip",n.forward.bind(t,"skip"));t.teaTime.on("report",n.forward.bind(t,"report"));t.teaTime.on("errorReport",n.forward.bind(t,"errorReport"));t.teaTime.on("exit",n.exit.bind(t,"exit"));return t}t.exports=n;n.ready=function i(e){var t=this;this.ws=new WebSocket("ws://127.0.0.1:7357/"+this.teaTime.token);this.ws.onopen=function r(){n.forward.call(t,"ready");console.log("Websocket opened!");e()};this.ws.onclose=function i(){console.log("Websocket closed!")}};n.forward=function s(e){var t=Array.prototype.slice.call(arguments,1);this.teaTime.prepareSerialize(t);this.ws.send(JSON.stringify({event:e,args:t}))};n.exit=function o(e){n.forward.call(this,"exit");this.ws.close()}},{}],4:[function(e,t,r){"use strict";var n=e("./tea-time.js");var i=e("./diff.js");var s=e("./htmlColorDiff.js");var o=e("string-kit/lib/inspect.js");var a=e("dom-kit");var l=e("url");function u(){var t={microTimeout:function(e){setTimeout(e,0)},onceUncaughtException:function(e){var t=false;window.onerror=function(r,n,i,s,o){if(t){return}e(o);return true}},offUncaughtException:function(){window.onerror=function(){}},allowConsole:true};n.populateOptionsWithArgs(t,l.parse(window.location.href,true).query);window.teaTime=n.create(t);window.teaTime.init();window.teaTime.diff=i;window.teaTime.htmlColorDiff=s;window.teaTime.inspect=o;window.teaTime.prepareSerialize=c;window.teaTime.reporters={console:e("./browser-reporters/console.js"),classic:e("./browser-reporters/classic.js"),websocket:e("./browser-reporters/websocket.js")};t.reporters.forEach(function(e){window.teaTime.reporters[e](window.teaTime)});if(t.ws){window.teaTime.ws=true}return window.teaTime}t.exports=u;function c(e){var t,r,n,i;if(!e||typeof e!=="object"){return}if(Array.isArray(e)){for(t=0,r=e.length;t<r;t++){c(e[t])}return}i=e.__proto__&&e.__proto__.constructor.name;if(i&&i!=="Object"){e.__prototype=i}if(e instanceof Error){Object.defineProperties(e,{__prototype:{value:e.constructor.name,enumerable:true,writable:true},name:{value:e.name,enumerable:true,writable:true},message:{value:e.message,enumerable:true,writable:true},type:{value:e.type||e.constructor.name,enumerable:true,writable:true},stack:{value:e.stack,enumerable:true,writable:true}})}n=Object.keys(e);for(t=0,r=n.length;t<r;t++){c(e[n[t]])}}u();a.ready(function(){window.teaTime.run()})},{"./browser-reporters/classic.js":1,"./browser-reporters/console.js":2,"./browser-reporters/websocket.js":3,"./diff.js":5,"./htmlColorDiff.js":6,"./tea-time.js":7,"dom-kit":36,"string-kit/lib/inspect.js":41,url:19}],5:[function(e,t,r){"use strict";var n=e("string-kit/lib/inspect.js");var i=e("diff");var s={minimal:true,depth:10,sort:true};function o(e,t){var r="",n=o.raw(e,t,true);n.forEach(function(e){r+=e.value.replace(/^(?!$)/gm,function(){if(e.added){return"++"}else if(e.removed){return"--"}else{return" "}})});return r}t.exports=o;o.raw=function a(e,t,r){var o,a=0;var l=n.inspect(s,e);var u=n.inspect(s,t);if(!r){o=i.diffChars(l,u);o.forEach(function(e){if(e.added||e.removed){a+=15+e.value.length}});if(a<80){return o}}o=i.diffLines(l,u);return o}},{diff:30,"string-kit/lib/inspect.js":41}],6:[function(e,t,r){"use strict";var n=e("./diff.js").raw;t.exports=function i(e,t){var r="",i=n(e,t);i.forEach(function(e){if(e.added){r+=e.value.replace(/^(\s*)(\S(?:[^\n]*\S)?)(\s*)$/gm,function(e,t,r,n){return t+'<span style="background-color:green;color:white">'+r+"</span>"+n})}else if(e.removed){r+=e.value.replace(/^(\s*)(\S(?:[^\n]*\S)?)(\s*)$/gm,function(e,t,r,n){return t+'<span style="background-color:red;color:white">'+r+"</span>"+n})}else{r+='<span style="color:grey">'+e.value+"</span>"}});return r}},{"./diff.js":5}],7:[function(e,t,r){(function(r){"use strict";var n=e("async-kit");var i=e("nextgen-events");function s(){throw new Error("Use TeaTime.create() instead")}s.prototype=Object.create(i.prototype);s.prototype.constructor=s;t.exports=s;s.create=function o(e){var t=Object.create(s.prototype,{timeout:{value:e.timeout||2e3,writable:true,enumerable:true},slowTime:{value:e.slowTime||75,writable:true,enumerable:true},suite:{value:s.createSuite(),enumerable:true},grep:{value:Array.isArray(e.grep)?e.grep:[],writable:true,enumerable:true},allowConsole:{value:!!e.allowConsole,writable:true,enumerable:true},bail:{value:!!e.bail,writable:true,enumerable:true},token:{value:e.token||null,writable:true,enumerable:true},acceptTokens:{value:e.acceptTokens||null,writable:true,enumerable:true},startTime:{value:0,writable:true,enumerable:true},testCount:{value:0,writable:true,enumerable:true},done:{value:0,writable:true,enumerable:true},ok:{value:0,writable:true,enumerable:true},fail:{value:0,writable:true,enumerable:true},skip:{value:0,writable:true,enumerable:true},errors:{value:[],enumerable:true},microTimeout:{value:e.microTimeout,enumerable:true},onceUncaughtException:{value:e.onceUncaughtException,enumerable:true},offUncaughtException:{value:e.offUncaughtException,enumerable:true}});Object.defineProperties(t,{registerStack:{value:[t.suite],writable:true,enumerable:true}});return t};s.populateOptionsWithArgs=function a(e,t){var r,n,i;if(!e.reporters){e.reporters=["classic"]}if(!e.clientReporters){e.clientReporters=["classic"]}if(t.console!==undefined){e.allowConsole=t.console}else if(t.c!==undefined){e.allowConsole=t.c}if(t.b||t.bail){e.bail=true}if(t.timeout&&(i=parseInt(t.timeout,10))){e.timeout=i}else if(t.t&&(i=parseInt(t.t,10))){e.timeout=i}if(t.slow&&(i=parseInt(t.slow,10))){e.slowTime=i}else if(t.s&&(i=parseInt(t.s,10))){e.slowTime=i}if(t.reporter){if(!Array.isArray(t.reporter)){t.reporter=[t.reporter]}e.reporters=t.reporter;if(t.R){if(!Array.isArray(t.R)){t.R=[t.R]}e.reporters=t.reporter.concat(t.R)}}else if(t.R){if(!Array.isArray(t.R)){t.R=[t.R]}e.reporters=t.R}if(t.clientReporter){if(!Array.isArray(t.clientReporter)){t.clientReporter=[t.clientReporter]}e.clientReporters=t.clientReporter}e.grep=[];e.sourceGrep=[];if(t.g){if(!Array.isArray(t.g)){t.g=[t.g]}for(r=0,n=t.g.length;r<n;r++){e.grep.push(new RegExp(t.g[r],"i"));e.sourceGrep.push(t.g[r])}}if(t.grep){if(!Array.isArray(t.grep)){t.grep=[t.grep]}for(r=0,n=t.grep.length;r<n;r++){e.grep.push(new RegExp(t.grep[r],"i"));e.sourceGrep.push(t.grep[r])}}if(t.token){e.token=t.token}};s.prototype.init=function l(e){r.suite=r.describe=r.context=s.registerSuite.bind(this);r.test=r.it=r.specify=s.registerTest.bind(this);r.test.skip=s.registerSkipTest.bind(this);r.setup=r.beforeEach=s.registerHook.bind(this,"setup");r.teardown=r.afterEach=s.registerHook.bind(this,"teardown");r.suiteSetup=r.before=s.registerHook.bind(this,"suiteSetup");r.suiteTeardown=r.after=s.registerHook.bind(this,"suiteTeardown");if(!this.allowConsole){s.disableConsole()}};s.disableConsole=function u(){console.log=console.error=console.assert=console.info=console.dir=console.warn=console.trace=console.time=console.timeEnd=function(){}};s.createSuite=function c(e){var t=[];Object.defineProperties(t,{name:{value:e},parent:{value:null,writable:true},suiteSetup:{value:[]},suiteTeardown:{value:[]},setup:{value:[]},teardown:{value:[]}});return t};s.sortSuite=function f(e){e.sort(function(e,t){var r=Array.isArray(e)?1:0;var n=Array.isArray(t)?1:0;if(r-n){return r-n}return e.order-t.order})};s.prototype.run=function p(e){var t=this,r=false;s.sortSuite(this.suite);this.emit("ready",function(){t.emit("run",t.testCount);var n=function(){if(r){return}if(typeof e==="function"){e()}};t.startTime=Date.now();t.runSuite(t.suite,0,function(){t.emit("report",t.ok,t.fail,t.skip,Date.now()-t.startTime);if(t.fail){t.emit("errorReport",t.errors)}t.emit("exit",n);setTimeout(n,1e4)})})};s.prototype.runSuite=function h(e,t,r){var n=this;if(t){n.emit("enterSuite",e.name,t-1)}var i=function(i){if(t){n.emit("exitSuite",e.name,t-1)}r(i)};this.runHooks(e.suiteSetup,t,function(r){if(r){n.patchError(r);n.errors.push({name:r.hookFn.hookName+"["+r.hookFn.hookType+"]",type:r.hookFn.hookType,fn:r.hookFn,error:r});n.failSuite(e,t,"suiteSetup",r.hookFn,r);n.runHooks(e.suiteTeardown,t,function(e){i(r)});return}n.runSuiteTests(e,t,function(r){n.runHooks(e.suiteTeardown,t,function(e){if(r){i(r)}else if(e){n.patchError(e);n.errors.push({name:e.hookFn.hookName+"["+e.hookFn.hookType+"]",type:e.hookFn.hookType,fn:e.hookFn,error:e});i(e)}else{i()}})})})};s.prototype.runSuiteTests=function d(e,t,r){var i=this;n.foreach(e,function(r,n){if(Array.isArray(r)){i.runSuite(r,t+1,n);return}i.runTest(e,t,r,n)}).fatal(i.bail).exec(r)};s.prototype.failSuite=function g(e,t,r,n,i){var s,o;for(s=0,o=e.length;s<o;s++){if(Array.isArray(e[s])){this.failSuite(e[s],t+1,r,n,i)}this.done++;this.fail++;this.emit("fail",e[s].testName,t,undefined,undefined,i)}};s.prototype.runTest=function b(e,t,r,n){var i=this;i.testInProgress=r;if(typeof r!=="function"){i.done++;i.skip++;i.emit("skip",r.testName,t);n();return}var o=e,a=e.setup,l=e.teardown;while(o.parent){o=o.parent;a=o.setup.concat(a);l=o.teardown.concat(l)}var u=r.length?s.asyncTest.bind(i):s.syncTest.bind(i);var c=function(e,s,o,a){if(e){i.done++;i.fail++;i.patchError(e);i.errors.push({name:(e.hookFn?e.hookFn.hookName+"["+e.hookFn.hookType+"] ":"")+r.testName,type:a,fn:r,error:e});i.emit("fail",r.testName,t,s,o,e);n(e)}else{i.done++;i.ok++;i.emit("ok",r.testName,t,s,o);n()}};i.runHooks(a,t,function(e){if(e){i.runHooks(l,t,function(t){c(e,undefined,undefined,"setup")});return}i.emit("enterTest",r.testName,t);u(r,function(e,n,s){i.emit("exitTest",r.testName,t);i.runHooks(l,t,function(t,i){if(e){c(e,n,s,"test",r)}else if(t){c(t,n,s,"teardown",i[i.length-1][2])}else{c(undefined,n,s)}})})})};s.syncTest=function y(e,t){var r,n,i=this.slowTime;t=this.freshCallback(t);var s={timeout:function(){},slow:function(e){i=e}};try{r=Date.now();e.call(s);n=Date.now()-r}catch(o){n=Date.now()-r;t(o,n,Math.floor(n/i));return}t(undefined,n,Math.floor(n/i))};s.asyncTest=function m(e,t){var r=this,n,i,s=false,o=null,a,l=r.slowTime;a=new Error("Test timeout");a.testTimeout=true;t=this.freshCallback(t);var u={timeout:function(e){if(s){return}if(o!==null){clearTimeout(o);o=null}var t=new Error("Test timeout (local)");t.testTimeout=true;o=setTimeout(c.bind(undefined,t),e)},slow:function(e){l=e}};var c=function p(e){if(s){return}i=Date.now()-n;s=true;if(o!==null){clearTimeout(o);o=null}r.offUncaughtException(p);t(e,i,Math.floor(i/l))};r.onceUncaughtException(c);o=setTimeout(c.bind(undefined,a),r.timeout);try{n=Date.now();e.call(u,c)}catch(f){c(f)}};s.prototype.runHooks=function v(e,t,r){var i=this;n.foreach(e,function(e,r){var n=e.length?s.asyncHook.bind(i):s.syncHook.bind(i);i.emit("enterHook",e.hookType,e.hookName,t);n(e,function(n){i.emit("exitHook",e.hookType,e.hookName,t);if(n){n.hookFn=e}r(n)})}).fatal(true).exec(r)};s.syncHook=function x(e,t){t=this.freshCallback(t);try{e()}catch(r){t(r);return}t()};s.asyncHook=function w(e,t){var r=this,n=false;t=this.freshCallback(t);var i=function o(e){if(n){return}n=true;r.offUncaughtException(o);t(e)};this.onceUncaughtException(i);try{e(i)}catch(s){i(s)}};s.registerSuite=function k(e,t){if(!e||typeof e!=="string"||typeof t!=="function"){throw new Error("Usage is suite( name , fn )")}var r=this.registerStack[this.registerStack.length-1];var n=s.createSuite(e);this.registerStack.push(n);t();this.registerStack.pop();if(!n.length){return}Object.defineProperties(n,{order:{value:r.length}});s.sortSuite(n);r.push(n);Object.defineProperty(n,"parent",{value:r})};s.registerTest=function _(e,t){var r,n,i,s,o,a;if(!e||typeof e!=="string"){throw new Error("Usage is test( name , [fn] )")}a=this.registerStack[this.registerStack.length-1];for(r=0,n=this.grep.length;r<n;r++){o=false;if(e.match(this.grep[r])){continue}for(i=1,s=this.registerStack.length;i<s;i++){if(this.registerStack[i].name.match(this.grep[r])){o=true;break}}if(!o){return}}this.testCount++;if(typeof t!=="function"){t={}}Object.defineProperties(t,{testName:{value:e},order:{value:a.length}});a.push(t)};s.registerSkipTest=function T(e){return s.registerTest.call(this,e)};s.registerHook=function j(e,t,r){var n;if(typeof t==="function"){r=t;t=undefined}else if(typeof r!=="function"){throw new Error("Usage is hook( [name] , fn )")}Object.defineProperties(r,{hookName:{value:t||r.name||"[no name]"},hookType:{value:e}});n=this.registerStack[this.registerStack.length-1];n[e].push(r)};s.prototype.freshCallback=function A(e){var t=this;return function(){var r=arguments;t.microTimeout(function(){e.apply(t,r)})}};s.prototype.patchError=function C(e){var t,r,n;if(!e.stack){return}n=e.stack;if(!Array.isArray(n)){n=e.stack.split("\n")}for(t=0,r=n.length;t<r;t++){if(n[t].match(/(^|\/)tea-time\.(min\.)?js/)){n=n.slice(0,t);break}}e.stack=n.join("\n")}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"async-kit":8,"nextgen-events":38}],8:[function(e,t,r){"use strict";var n=e("./core.js");t.exports=n;n.wrapper=e("./wrapper.js");n.exit=e("./exit.js")},{"./core.js":9,"./exit.js":10,"./wrapper.js":11}],9:[function(e,t,r){"use strict";var n=e("nextgen-events");var i=e("tree-kit/lib/extend.js");var s={};t.exports=s;s.AsyncError=function d(e){Error.call(this);Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor);this.message=e};s.AsyncError.prototype=Object.create(Error.prototype);s.AsyncError.prototype.constructor=s.AsyncError;s.Plan=function g(){throw new Error("[async] Cannot create an async Plan object directly")};s.Plan.prototype.constructor=s.Plan;var o={parallelLimit:{value:1,writable:true,enumerable:true,configurable:true},raceMode:{value:false,writable:true,enumerable:true,configurable:true},waterfallMode:{value:false,writable:true,enumerable:true,configurable:true},waterfallTransmitError:{value:false,writable:true,enumerable:true,configurable:true},whileAction:{value:undefined,writable:true,enumerable:true,configurable:true},whileActionBefore:{value:false,writable:true,enumerable:true,configurable:true},errorsAreFatal:{value:true,writable:true,enumerable:true,configurable:true},returnMapping1to1:{value:false,writable:true,enumerable:true,configurable:true},jobsData:{value:{},writable:true,enumerable:true},jobsKeys:{value:[],writable:true,enumerable:true},jobsUsing:{value:undefined,writable:true,enumerable:true},jobsTimeout:{value:undefined,writable:true,enumerable:true},returnLastJobOnly:{value:false,writable:true,enumerable:true},defaultAggregate:{value:undefined,writable:true,enumerable:true},returnAggregate:{value:false,writable:true,enumerable:true},transmitAggregate:{value:false,writable:true,enumerable:true},usingIsIterator:{value:false,writable:true,enumerable:true},thenAction:{value:undefined,writable:true,enumerable:true},catchAction:{value:undefined,writable:true,enumerable:true},finallyAction:{value:undefined,writable:true,enumerable:true},asyncEventNice:{value:-20,writable:true,enumerable:true},maxRetry:{value:0,writable:true,enumerable:true},retryTimeout:{value:0,writable:true,enumerable:true},retryMultiply:{value:1,writable:true,enumerable:true},retryMaxTimeout:{value:Infinity,writable:true,enumerable:true},execMappingMinInputs:{value:0,writable:true,enumerable:true},execMappingMaxInputs:{value:100,writable:true,enumerable:true},execMappingCallbacks:{value:["finally"],writable:true,enumerable:true},execMappingAggregateArg:{value:false,writable:true,enumerable:true},execMappingMinArgs:{value:0,writable:true,enumerable:true},execMappingMaxArgs:{value:101,writable:true,enumerable:true},execMappingSignature:{value:"( [finallyCallback] )",writable:true,enumerable:true},locked:{value:false,writable:true,enumerable:true}};s.do=function b(e){var t=Object.create(s.Plan.prototype,o);Object.defineProperties(t,{execInit:{value:a.bind(t)},execNext:{value:l.bind(t)},execCallback:{value:u},execLoopCallback:{value:c},execFinal:{value:f.bind(t)}});t.do(e);return t};s.parallel=function y(e){var t=Object.create(s.Plan.prototype,o);Object.defineProperties(t,{parallelLimit:{value:Infinity,writable:true,enumerable:true},execInit:{value:a.bind(t)},execNext:{value:l.bind(t)},execCallback:{value:u},execLoopCallback:{value:c},execFinal:{value:f.bind(t)}});t.do(e);return t};s.series=function m(e){var t=Object.create(s.Plan.prototype,o);Object.defineProperties(t,{parallelLimit:{value:1,enumerable:true},execInit:{value:a.bind(t)},execNext:{value:l.bind(t)},execCallback:{value:u},execLoopCallback:{value:c},execFinal:{value:f.bind(t)}});t.do(e);return t};s.race=function v(e){var t=Object.create(s.Plan.prototype,o);Object.defineProperties(t,{raceMode:{value:true,enumerable:true},parallelLimit:{value:Infinity,writable:true,enumerable:true},errorsAreFatal:{value:false,writable:true,enumerable:true},execInit:{value:a.bind(t)},execNext:{value:l.bind(t)},execCallback:{value:u},execLoopCallback:{value:c},execFinal:{value:f.bind(t)}});t.returnLastJobOnly=true;t.do(e);return t};s.waterfall=function x(e){var t=Object.create(s.Plan.prototype,o);Object.defineProperties(t,{waterfallMode:{value:true,enumerable:true},waterfallTransmitError:{value:false,writable:true,enumerable:true},parallelLimit:{value:1,enumerable:true},execInit:{value:a.bind(t)},execNext:{value:l.bind(t)},execCallback:{value:u},execLoopCallback:{value:c},execFinal:{value:f.bind(t)}});t.returnLastJobOnly=true;t.do(e);return t};s.foreach=s.forEach=function w(e,t){var r=Object.create(s.Plan.prototype,o);Object.defineProperties(r,{usingIsIterator:{value:true,writable:true,enumerable:true},errorsAreFatal:{value:false,writable:true,enumerable:true},execInit:{value:a.bind(r)},execNext:{value:l.bind(r)},execCallback:{value:u},execLoopCallback:{value:c},execFinal:{value:f.bind(r)}});r.do(e);r.iterator(t);return r};s.map=function k(e,t){var r=Object.create(s.Plan.prototype,o);Object.defineProperties(r,{parallelLimit:{value:Infinity,writable:true,enumerable:true},usingIsIterator:{value:true,writable:true,enumerable:true},errorsAreFatal:{value:false,writable:true,enumerable:true},returnMapping1to1:{value:true,writable:false,enumerable:true},execInit:{value:a.bind(r)},execNext:{value:l.bind(r)},execCallback:{value:u},execLoopCallback:{value:c},execFinal:{value:f.bind(r)}});r.do(e);r.iterator(t);return r};s.reduce=function _(e,t,r){var n=Object.create(s.Plan.prototype,o);Object.defineProperties(n,{parallelLimit:{value:1,writable:false,enumerable:true},usingIsIterator:{value:true,writable:true,enumerable:true},execInit:{value:a.bind(n)},execNext:{value:l.bind(n)},execCallback:{value:u},execLoopCallback:{value:c},execFinal:{value:f.bind(n)}});if(arguments.length<3){r=t;t=undefined;n.execMappingMinInputs=0;n.execMappingMaxInputs=100;n.execMappingCallbacks=["finally"];n.execMappingAggregateArg=true;n.execMappingMinArgs=1;n.execMappingMaxArgs=102;n.execMappingSignature="( aggregateArg, [finallyCallback] )"}n.transmitAggregate=true;n.returnAggregate=true;n.defaultAggregate=t;n.do(e);n.iterator(r);return n};s.while=function T(e){var t=Object.create(s.Plan.prototype,o);Object.defineProperties(t,{waterfallMode:{value:false,enumerable:true},whileAction:{value:undefined,writable:true,enumerable:true},whileActionBefore:{value:true,writable:false,enumerable:true},execInit:{value:a.bind(t)},execNext:{value:l.bind(t)},execCallback:{value:u},execLoopCallback:{value:c},execFinal:{value:f.bind(t)}});t.while(e);return t};s.and=function j(e){var t=Object.create(s.Plan.prototype,o);Object.defineProperties(t,{elseAction:{value:undefined,writable:true,enumerable:true},castToBoolean:{value:false,writable:true,enumerable:true},useLogicAnd:{value:true},execInit:{value:a.bind(t)},execNext:{value:l.bind(t)},execCallback:{value:p},execLoopCallback:{value:c},execFinal:{value:h.bind(t)}});t.do(e);return t};s.or=function A(e){var t=Object.create(s.Plan.prototype,o);Object.defineProperties(t,{elseAction:{value:undefined,writable:true,enumerable:true},castToBoolean:{value:false,writable:true,enumerable:true},useLogicAnd:{value:false},execInit:{value:a.bind(t)},execNext:{value:l.bind(t)},execCallback:{value:p},execLoopCallback:{value:c},execFinal:{value:h.bind(t)}});t.do(e);return t};s.if=function C(e){var t=Object.create(s.Plan.prototype,o);Object.defineProperties(t,{elseAction:{value:true,writable:true,enumerable:true},castToBoolean:{value:true,writable:true,enumerable:true},useLogicAnd:{value:true},execInit:{value:a.bind(t)},execNext:{value:l.bind(t)},execCallback:{value:p},execLoopCallback:{value:c},execFinal:{value:h.bind(t)}});if(e){t.do(e)}return t};s.if.and=s.if;s.if.or=function M(e){var t=Object.create(s.Plan.prototype,o);Object.defineProperties(t,{elseAction:{value:true,writable:true,enumerable:true},castToBoolean:{value:true,writable:true,enumerable:true},useLogicAnd:{value:false},execInit:{value:a.bind(t)},execNext:{value:l.bind(t)},execCallback:{value:p},execLoopCallback:{value:c},execFinal:{value:h.bind(t)}});if(e){t.do(e)}return t};s.callTimeout=function S(e,t,r,n){if(typeof r!=="function"){throw new Error("[async] async.callTimeout(): argument #0 should be a function")}var i=Object.create(s.Plan.prototype,o);Object.defineProperties(i,{returnLastJobOnly:{value:true,enumerable:true},jobsTimeout:{value:e,writable:true,enumerable:true},execInit:{value:a.bind(i)},execNext:{value:l.bind(i)},execCallback:{value:u},execLoopCallback:{value:c},execFinal:{value:f.bind(i)}});var p=[r.bind(n)].concat(Array.prototype.slice.call(arguments,4));i.do([p]);return i.exec(t)};s.Plan.prototype.do=function O(e){if(this.locked){return this}if(e&&typeof e==="object"){this.jobsData=e}else if(typeof e==="function"){this.jobsData=[e];this.returnLastJobOnly=true}else{this.jobsData={}}this.jobsKeys=Object.keys(this.jobsData);return this};s.Plan.prototype.parallel=function E(e){if(this.locked){return this}if(e===undefined||e===true){this.parallelLimit=Infinity}else if(e===false){this.parallelLimit=1}else if(typeof e==="number"){this.parallelLimit=e}return this};s.Plan.prototype.race=function L(e){if(!this.locked){this.raceMode=e||e===undefined?true:false}return this};s.Plan.prototype.waterfall=function P(e){if(!this.locked){this.waterfallMode=e||e===undefined?true:false}return this};s.Plan.prototype.while=function I(e,t){if(this.locked){return this}this.whileAction=e;if(t!==undefined){this.whileActionBefore=t?true:false}return this};s.Plan.prototype.repeat=function N(e){if(this.locked){return this}var t=0;if(typeof e!=="number"){e=parseInt(e)}this.whileActionBefore=true;this.whileAction=function(r,n,i){t++;i(t<=e)};return this};s.Plan.prototype.fatal=function D(e){if(!this.locked){this.errorsAreFatal=e||e===undefined?true:false}return this};s.Plan.prototype.boolean=function F(e){if(!this.locked){this.castToBoolean=e||e===undefined?true:false}return this};s.Plan.prototype.transmitError=function U(e){if(!this.locked){this.waterfallTransmitError=e||e===undefined?true:false}return this};s.Plan.prototype.timeout=function R(e){if(!this.locked){if(typeof e==="number"){this.jobsTimeout=e}else{this.jobsTimeout=undefined}}return this};s.Plan.prototype.retry=function q(e,t,r,n){if(this.locked){return this}if(typeof e==="number"){this.maxRetry=e}if(typeof t==="number"){this.retryTimeout=t}if(typeof r==="number"){this.retryMultiply=r}if(typeof n==="number"){this.retryMaxTimeout=n}return this};s.Plan.prototype.lastJobOnly=function H(e){if(!this.locked){this.returnLastJobOnly=e||e===undefined?true:false}return this};s.Plan.prototype.mapping1to1=function K(e){if(!this.locked){this.returnMapping1to1=e||e===undefined?true:false}return this};s.Plan.prototype.using=function J(e){if(!this.locked){this.jobsUsing=e}return this};s.Plan.prototype.iterator=function W(e){if(this.locked){return this}this.jobsUsing=e;this.usingIsIterator=true;return this};s.Plan.prototype.aggregator=function B(e,t,r){if(!this.locked){return this}this.transmitAggregate=e||e===undefined?true:false;this.returnAggregate=t||t===undefined?true:false;if(arguments.length>2){this.defaultAggregate=r}return this};s.Plan.prototype.usingIterator=function $(e){if(!this.locked){this.usingIsIterator=e||e===undefined?true:false}return this};s.Plan.prototype.nice=function z(e){if(this.locked){return this}if(e===undefined||e===null||e===true){this.asyncEventNice=-1}else if(e===false){this.asyncEventNice=-20}else{this.asyncEventNice=e}return this};s.Plan.prototype.then=function X(e){if(!this.locked){this.thenAction=e}return this};s.Plan.prototype.else=function G(e){if(!this.locked){this.elseAction=e||true}return this};s.Plan.prototype.catch=function Q(e){if(!this.locked){this.catchAction=e||true}return this};s.Plan.prototype.finally=function V(e){if(!this.locked){this.finallyAction=e||true}return this};s.Plan.prototype.clone=function Y(){var e=Object.create(s.Plan.prototype,o);i(null,e,this);e.locked=false;return e};s.Plan.prototype.export=function Z(e){switch(e){case"execFinally":return this.clone().execFinally.bind(this);case"execThenCatch":return this.clone().execThenCatch.bind(this);case"execThenElse":return this.clone().execThenElse.bind(this);case"execThenElseCatch":return this.clone().execThenElseCatch.bind(this);case"execArgs":return this.clone().execArgs.bind(this);case"execKV":return this.clone().execKV.bind(this);default:return this.clone().exec.bind(this)}};s.Plan.prototype.exec=function ee(){var e={inputs:[],callbacks:{}},t=0,r;if(arguments.length<this.execMappingMinArgs){throw new Error("[async] Too few arguments, in this instance, the function signature is: fn"+this.execMappingSignature)}else if(arguments.length>this.execMappingMaxArgs){throw new Error("[async] Too much arguments, in this instance, the function signature is: fn"+this.execMappingSignature)}if(this.execMappingAggregateArg){t++;e.aggregate=arguments[0]}if(this.execMappingMinInputs===this.execMappingMaxInputs){e.inputs=Array.prototype.slice.call(arguments,t,this.execMappingMaxInputs+t);for(r=0;r<this.execMappingCallbacks.length&&e.inputs.length+r<arguments.length;r++){e.callbacks[this.execMappingCallbacks[r]]=arguments[e.inputs.length+t+r]}}else{e.inputs=Array.prototype.slice.call(arguments,t,-this.execMappingCallbacks.length);for(r=0;r<this.execMappingCallbacks.length;r++){e.callbacks[this.execMappingCallbacks[r]]=arguments[e.inputs.length+t+r]}}return this.execInit(e)};s.Plan.prototype.execFinally=function te(e){return this.execInit({inputs:[],callbacks:{"finally":e}})};s.Plan.prototype.execThenCatch=function re(e,t,r){return this.execInit({inputs:[],callbacks:{then:e,"catch":t,"finally":r}})};s.Plan.prototype.execThenElse=function ne(e,t,r){return this.execInit({
inputs:[],callbacks:{then:e,"else":t,"finally":r}})};s.Plan.prototype.execThenElseCatch=function ie(e,t,r,n){return this.execInit({inputs:[],callbacks:{then:e,"else":t,"catch":r,"finally":n}})};s.Plan.prototype.execArgs=function se(){return this.execInit({inputs:arguments,callbacks:{}})};s.Plan.prototype.execMapping=function oe(e){if(this.locked){return this}e=i(null,{minInputs:0,maxInputs:0},e);var t,r,n=5;e.minInputs=parseInt(e.minInputs);e.maxInputs=parseInt(e.maxInputs);if(e.minInputs<e.maxInputs){this.execMappingMinInputs=e.minInputs;this.execMappingMaxInputs=e.maxInputs}else{this.execMappingMinInputs=e.maxInputs;this.execMappingMaxInputs=e.minInputs}this.execMappingCallbacks=Array.isArray(e.callbacks)?e.callbacks:[];this.execMappingInputsName=Array.isArray(e.inputsName)?e.inputsName:[];this.execMappingSignature="( ";if(this.execMappingMinInputs===this.execMappingMaxInputs){this.execMappingMinArgs=this.execMappingMinInputs;this.execMappingMaxArgs=this.execMappingMaxInputs+this.execMappingCallbacks.length;if(e.aggregateArg){this.execMappingAggregateArg=e.aggregateArg;this.execMappingMinArgs++;this.execMappingMaxArgs++;this.execMappingSignature+="aggregateValue"}for(t=0;t<this.execMappingMaxInputs;t++){if(t>0||e.aggregateArg){this.execMappingSignature+=", "}if(t>=n&&typeof this.execMappingInputsName[t]!=="string"){this.execMappingSignature+="... ";break}this.execMappingSignature+=typeof this.execMappingInputsName[t]==="string"?this.execMappingInputsName[t]:"arg#"+(t+1)}for(r=0;r<this.execMappingCallbacks.length;r++){if(t+r>0||e.aggregateArg){this.execMappingSignature+=", "}this.execMappingSignature+="["+this.execMappingCallbacks[r]+"Callback]"}}else{this.execMappingMinArgs=this.execMappingMinInputs+this.execMappingCallbacks.length;this.execMappingMaxArgs=this.execMappingMaxInputs+this.execMappingCallbacks.length;if(e.aggregateArg){this.execMappingAggregateArg=e.aggregateArg;this.execMappingMinArgs++;this.execMappingMaxArgs++;this.execMappingSignature+="aggregateValue"}for(t=0;t<this.execMappingMaxInputs;t++){if(t>0||e.aggregateArg){this.execMappingSignature+=", "}if(t<this.execMappingMinInputs){if(t>=n&&typeof this.execMappingInputsName[t]!=="string"){this.execMappingSignature+="... ";break}this.execMappingSignature+=typeof this.execMappingInputsName[t]==="string"?this.execMappingInputsName[t]:"arg#"+(t+1)}else{if(t>=n&&typeof this.execMappingInputsName[t]!=="string"){this.execMappingSignature+="[...] ";break}this.execMappingSignature+="["+(typeof this.execMappingInputsName[t]==="string"?this.execMappingInputsName[t]:"arg#"+(t+1))+"]"}}for(r=0;r<this.execMappingCallbacks.length;r++){if(t+r>0||e.aggregateArg){this.execMappingSignature+=", "}this.execMappingSignature+=this.execMappingCallbacks[r]+"Callback"}}this.execMappingSignature+=" )";return this};s.Plan.prototype.execKV=function ae(e){if(e.inputs===undefined){e.inputs=[]}else if(!Array.isArray(e.inputs)){e.inputs=[e.inputs]}if(e.callbacks===undefined||typeof e.callbacks!=="object"){e.callbacks={}}if(e.then){e.callbacks.then=e.then}if(e.else){e.callbacks.else=e.else}if(e.catch){e.callbacks.catch=e.catch}if(e.finally){e.callbacks.finally=e.finally}return this.execInit(e)};s.Plan.prototype.execLoop=function le(e){return this.execInit({},e)};s.Plan.prototype.execJob=function ue(e,t,r,n){var o=this,a,l=e.jobsKeys[r];var u=Object.create(s.JobContext.prototype,{execContext:{value:e,enumerable:true},indexOfKey:{value:r,enumerable:true},tryIndex:{value:n,enumerable:true},aborted:{value:false,writable:true,enumerable:true},abortedLoop:{value:false,writable:true,enumerable:true}});Object.defineProperty(u,"callback",{value:this.execCallback.bind(this,u),enumerable:true});Object.defineProperty(u.callback,"jobContext",{value:u,enumerable:true});e.jobsStatus[l].status="pending";e.jobsStatus[l].tried++;if(typeof this.jobsUsing==="function"){if(this.usingIsIterator){if(this.transmitAggregate){if(this.jobsUsing.length<=3){this.jobsUsing.call(u,e.aggregate,t,u.callback)}else if(this.jobsUsing.length<=4){this.jobsUsing.call(u,e.aggregate,t,Array.isArray(e.jobsData)?r:l,u.callback)}else{this.jobsUsing.call(u,e.aggregate,t,Array.isArray(e.jobsData)?r:l,e.jobsData,u.callback)}}else{if(this.jobsUsing.length<=2){this.jobsUsing.call(u,t,u.callback)}else if(this.jobsUsing.length<=3){this.jobsUsing.call(u,t,Array.isArray(e.jobsData)?r:l,u.callback)}else{this.jobsUsing.call(u,t,Array.isArray(e.jobsData)?r:l,e.jobsData,u.callback)}}}else if(Array.isArray(t)){a=t.slice();if(this.transmitAggregate){a.unshift(e.aggregate)}a.push(u.callback);this.jobsUsing.apply(u,a)}else{this.jobsUsing.call(u,t,u.callback)}}else if(typeof t==="function"){if(this.waterfallMode&&r>0){a=e.results[e.jobsKeys[r-1]].slice(this.waterfallTransmitError?0:1);a.push(u.callback);t.apply(u,a)}else if(Array.isArray(this.jobsUsing)||this.execMappingMaxInputs){if(Array.isArray(this.jobsUsing)){a=i(null,[],this.jobsUsing,e.execInputs)}else{a=i(null,[],e.execInputs)}a.push(u.callback);t.apply(u,a)}else{t.call(u,u.callback)}}else if(Array.isArray(t)&&typeof t[0]==="function"){a=t.slice(1);a.push(u.callback);t[0].apply(u,a)}else if(typeof t==="object"&&t instanceof s.Plan){t.exec(u.callback)}else{this.execCallback.call(this,u);return this}if(e.jobsTimeoutTimers[l]!==undefined){clearTimeout(e.jobsTimeoutTimers[l]);e.jobsTimeoutTimers[l]=undefined}if(e.retriesTimers[l]!==undefined){clearTimeout(e.retriesTimers[l]);e.retriesTimers[l]=undefined}if(typeof this.jobsTimeout==="number"&&this.jobsTimeout!==Infinity){e.jobsTimeoutTimers[l]=setTimeout(function(){e.jobsTimeoutTimers[l]=undefined;e.jobsStatus[l].status="timeout";u.emit("timeout");o.execCallback.call(o,u,new s.AsyncError("jobTimeout"))},this.jobsTimeout)}return this};s.Plan.prototype.execAction=function ce(e,t,r){if(typeof t==="function"){t.apply(e,r)}else if(typeof t==="object"&&t instanceof s.Plan){t.exec()}};s.JobContext=function fe(){throw new Error("[async] Cannot create an async JobContext object directly")};s.JobContext.prototype=Object.create(n.prototype);s.JobContext.prototype.constructor=s.JobContext;s.JobContext.prototype.abort=function pe(){this.aborted=true;this.callback.apply(undefined,arguments)};s.JobContext.prototype.abortLoop=function he(){this.aborted=true;this.abortedLoop=true;this.callback.apply(undefined,arguments)};s.ExecContext=function de(){throw new Error("[async] Cannot create an async ExecContext object directly")};s.ExecContext.prototype=Object.create(n.prototype);s.ExecContext.prototype.constructor=s.ExecContext;s.ExecContext.prototype.getJobsStatus=function ge(){var e,t,r=Array.isArray(this.jobsData)?[]:{};for(e=0;e<this.jobsKeys.length;e++){t=this.jobsKeys[e];r[t]=i(null,{job:this.jobsData[t],result:this.results[t]},this.jobsStatus[t])}return r};function a(e,t){var r,n=Array.isArray(this.jobsData);var o=Object.create(s.ExecContext.prototype,{plan:{value:this},aggregate:{value:"aggregate"in e?e.aggregate:this.defaultAggregate,writable:true,enumerable:true},results:{value:n?[]:{},writable:true,enumerable:true},result:{value:undefined,writable:true,enumerable:true},jobsTimeoutTimers:{value:n?[]:{},writable:true},jobsStatus:{value:n?[]:{},writable:true,enumerable:true},retriesTimers:{value:n?[]:{},writable:true},retriesCounter:{value:n?[]:{},writable:true,enumerable:true},tryUserResponseCounter:{value:n?[]:{},writable:true,enumerable:true},tryResponseCounter:{value:n?[]:{},writable:true,enumerable:true},iterator:{value:0,writable:true,enumerable:true},pending:{value:0,writable:true,enumerable:true},resolved:{value:0,writable:true,enumerable:true},ok:{value:0,writable:true,enumerable:true},failed:{value:0,writable:true,enumerable:true},status:{value:undefined,writable:true,enumerable:true},error:{value:undefined,writable:true,enumerable:true},statusTriggerJobsKey:{value:undefined,writable:true,enumerable:true},whileStatus:{value:undefined,writable:true},whileChecked:{value:false,writable:true}});if(!t){Object.defineProperties(o,{root:{value:o,enumerable:true},jobsData:{value:n?this.jobsData.slice(0):i(null,{},this.jobsData),enumerable:true},jobsKeys:{value:this.jobsKeys.slice(0),enumerable:true},execInputs:{value:e.inputs,enumerable:true},execCallbacks:{value:e.callbacks},whileIterator:{value:0,enumerable:true,writable:true}})}else{Object.defineProperties(o,{root:{value:t.root,enumerable:true},jobsData:{value:t.jobsData,enumerable:true},jobsKeys:{value:t.jobsKeys,enumerable:true},execInputs:{value:t.execInputs,enumerable:true},execCallbacks:{value:t.execCallbacks},whileIterator:{value:t.whileIterator+1,enumerable:true,writable:true}})}Object.defineProperties(o,{waiting:{value:o.jobsKeys.length,writable:true,enumerable:true}});for(r=0;r<o.jobsKeys.length;r++){o.jobsStatus[o.jobsKeys[r]]={status:"waiting",errors:[],tried:0}}o.setNice(this.asyncEventNice);if(t===undefined){o.root.on("resolved",this.execFinal.bind(this,o));if(typeof this.whileAction==="function"){o.root.on("while",this.whileAction.bind(this));o.root.on("nextLoop",this.execLoop.bind(this))}else{this.whileAction=undefined;o.whileStatus=false}o.root.on("next",this.execNext.bind(this));if(this.whileAction&&this.whileActionBefore){o.whileIterator=-1;o.root.emit("while",o.error,o.results,this.execLoopCallback.bind(this,o),null);return this}}if(o.jobsKeys.length<=0){o.root.emit("resolved",o.error,o.results);o.root.emit("progress",{resolved:o.resolved,ok:o.ok,failed:o.failed,pending:o.pending,waiting:o.waiting,loop:o.whileIterator},o.error,o.results);o.root.emit("finish",o.error,o.results);return o.root}o.root.emit("next",o);return o.root}function l(e){var t,r,n=e.jobsKeys.length,i,s;i=e.iterator;for(;e.iterator<n&&e.pending<this.parallelLimit;e.iterator++){e.pending++;e.waiting--;t=e.iterator;r=e.jobsKeys[t];e.retriesCounter[r]=0;e.tryResponseCounter[r]=[];e.tryResponseCounter[r][0]=0;e.tryUserResponseCounter[r]=[];e.tryUserResponseCounter[r][0]=0;e.results[r]=undefined;s=e.iterator}for(t=i;t<=s;t++){this.execJob(e,e.jobsData[e.jobsKeys[t]],t,0)}}function u(e,t){var r=e.execContext,n=e.aborted,i=e.abortedLoop,o=e.indexOfKey,a=e.tryIndex;var l=this,u,c,f=r.jobsKeys.length,p=r.jobsKeys[o];var h=false,d=false,g=false,b=false;r.tryResponseCounter[p][a]++;if(!(t instanceof s.AsyncError)){r.tryUserResponseCounter[p][a]++}if(r.jobsTimeoutTimers[p]!==undefined){clearTimeout(r.jobsTimeoutTimers[p]);r.jobsTimeoutTimers[p]=undefined}if(r.retriesTimers[p]!==undefined){clearTimeout(r.retriesTimers[p]);r.retriesTimers[p]=undefined}if(r.tryUserResponseCounter[p][a]>1){r.jobsStatus[p].errors.push(new Error("This job has called its completion callback "+r.tryUserResponseCounter[p][a]+" times"));return}if(!n&&r.results[p]!==undefined){return}if(!n&&t&&this.maxRetry>r.retriesCounter[p]&&r.tryResponseCounter[p][a]<=1){r.jobsStatus[p].errors.push(t);u=this.retryTimeout*Math.pow(this.retryMultiply,r.retriesCounter[p]);if(u>this.retryMaxTimeout){u=this.retryMaxTimeout}r.retriesCounter[p]++;c=r.retriesCounter[p];r.retriesTimers[p]=setTimeout(function(){r.retriesTimers[p]=undefined;r.tryResponseCounter[p][c]=0;r.tryUserResponseCounter[p][c]=0;l.execJob(r,r.jobsData[p],o,c)},u);return}if(!n&&t&&a<r.retriesCounter[p]){return}r.resolved++;r.pending--;r.aggregate=arguments[2];if(n){r.failed++;r.jobsStatus[p].status="aborted"}else if(t){r.failed++;r.jobsStatus[p].errors.push(t);if(t instanceof s.AsyncError&&t.message==="jobTimeout"){r.jobsStatus[p].status="timeout"}else{r.jobsStatus[p].status="failed"}}else{r.ok++;r.jobsStatus[p].status="ok"}if(this.returnMapping1to1){r.results[p]=arguments[2]}else{r.results[p]=Array.prototype.slice.call(arguments,1)}if(r.status===undefined){if(this.raceMode&&!t){r.status="ok";r.statusTriggerJobsKey=p;if(this.whileAction&&!i){b=true}else{d=true}}else if(!this.raceMode&&t&&this.errorsAreFatal){r.status="fail";r.error=t;r.statusTriggerJobsKey=p;if(this.whileAction&&!i){b=true}else{d=true}}else if(n){r.status="aborted";r.statusTriggerJobsKey=p;if(this.whileAction&&!i){b=true}else{d=true}}}if(r.resolved>=f){if(r.status===undefined){if(this.raceMode){r.status="fail"}else{r.status="ok"}r.statusTriggerJobsKey=p;if(this.whileAction){b=true}else{d=g=true}}else{if(!this.whileAction||r.whileChecked&&r.whileStatus!==true){g=true}}}else if(r.status===undefined){if(r.iterator<f){h=true}}else if(r.pending<=0){if(!this.whileAction||r.whileChecked&&r.whileStatus!==true){g=true}}if(d){r.root.emit("resolved",r.error,r.results)}if(h){r.root.emit("next",r)}if(b){r.root.emit("while",r.error,r.results,this.execLoopCallback.bind(this,r),null)}r.root.emit("progress",{resolved:r.resolved,ok:r.ok,failed:r.failed,pending:r.pending,waiting:r.waiting,loop:r.whileIterator},r.error,r.results);if(g){r.root.emit("finish",r.error,r.results)}}function c(e){var t,r;var n=false,i=false,s=false;if(arguments.length<=1){t=undefined;r=false}else if(arguments[1]instanceof Error){e.error=arguments[1];t=arguments[1];r=false}else if(arguments.length<=2){t=arguments[1];r=t?true:false}else{t=arguments[2];r=t?true:false}if(r){e.whileStatus=true;n=true}else{e.whileStatus=false;i=true;if(e.pending<=0){s=true}}if(i){e.root.emit("resolved",e.error,e.results)}if(n){e.root.emit("nextLoop",e)}if(s){e.root.emit("finish",e.error,e.results)}e.whileChecked=true}function f(e,t,r){var n;if(t){if(this.returnAggregate){n=[t,e.aggregate]}else if(this.returnLastJobOnly){n=r[e.statusTriggerJobsKey]}else{n=[t,r]}if(this.catchAction){this.execAction(e,this.catchAction,n)}if(t&&e.execCallbacks.catch){this.execAction(e,e.execCallbacks.catch,n)}}else{if(this.returnAggregate){n=[e.aggregate]}else if(this.returnLastJobOnly){n=r[e.statusTriggerJobsKey].slice(1)}else{n=[r]}if(this.thenAction){this.execAction(e,this.thenAction,n)}if(e.execCallbacks.then){this.execAction(e,e.execCallbacks.then,n)}}if(this.returnAggregate){n=[t,e.aggregate]}else if(this.returnLastJobOnly){n=r[e.statusTriggerJobsKey]}else{n=[t,r]}if(this.finallyAction){this.execAction(e,this.finallyAction,n)}if(e.execCallbacks.finally){this.execAction(e,e.execCallbacks.finally,n)}}function p(e){var t=e.execContext,r=e.indexOfKey,n=e.tryIndex;var i=this,o,a,l,u,c=t.jobsKeys.length,f=t.jobsKeys[r];var p=false,h=false,d=false;if(arguments.length<=1){t.result=undefined;o=false}else if(arguments[1]instanceof Error){t.error=u=arguments[1];t.result=arguments[1];o=false}else if(arguments.length<=2){t.result=arguments[1];o=t.result?true:false}else{t.result=arguments[2];o=t.result?true:false}t.tryResponseCounter[f][n]++;if(!(u instanceof s.AsyncError)){t.tryUserResponseCounter[f][n]++}if(t.jobsTimeoutTimers[f]!==undefined){clearTimeout(t.jobsTimeoutTimers[f]);t.jobsTimeoutTimers[f]=undefined}if(t.retriesTimers[f]!==undefined){clearTimeout(t.retriesTimers[f]);t.retriesTimers[f]=undefined}if(t.results[f]!==undefined){return}if(t.tryUserResponseCounter[f][n]>1){return}if(u&&this.maxRetry>t.retriesCounter[f]&&t.tryResponseCounter[f][n]<=1){a=this.retryTimeout*Math.pow(this.retryMultiply,t.retriesCounter[f]);if(a>this.retryMaxTimeout){a=this.retryMaxTimeout}t.retriesCounter[f]++;l=t.retriesCounter[f];t.retriesTimers[f]=setTimeout(function(){t.retriesTimers[f]=undefined;t.tryResponseCounter[f][l]=0;t.tryUserResponseCounter[f][l]=0;i.execJob(t,t.jobsData[f],r,l)},a);return}if(u&&n<t.retriesCounter[f]){return}t.resolved++;t.pending--;if(u){t.failed++;if(u instanceof s.AsyncError&&u.message==="jobTimeout"){t.jobsStatus[f].status="timeout"}else{t.jobsStatus[f].status="failed"}}else{t.ok++;t.jobsStatus[f].status="ok"}if(this.castToBoolean&&(!(t.result instanceof Error)||!this.catchAction)){t.result=o}t.results[f]=t.result;if(o!==this.useLogicAnd&&t.status===undefined){t.status=!this.useLogicAnd;h=true}if(t.resolved>=c){if(t.status===undefined){t.status=this.useLogicAnd;h=true}d=true}else if(t.status===undefined){if(t.iterator<c){p=true}}else if(t.pending<=0){d=true}if(h){t.root.emit("resolved",t.result)}if(p){t.root.emit("next",t)}t.root.emit("progress",{resolved:t.resolved,pending:t.pending,waiting:t.waiting,loop:t.whileIterator},t.result);if(d){t.root.emit("finish",t.result)}}function h(e,t){if(t instanceof Error){if(this.catchAction){this.execAction(e,this.catchAction,[t])}else if(this.elseAction){this.execAction(e,this.elseAction,[t])}}else if(!e.result&&this.elseAction){this.execAction(e,this.elseAction,[t])}else if(e.result&&this.thenAction){this.execAction(e,this.thenAction,[t])}if(this.finallyAction){this.execAction(e,this.finallyAction,[t])}if(t instanceof Error){if(e.execCallbacks.catch){this.execAction(e,e.execCallbacks.catch,[t])}else if(e.execCallbacks.else){this.execAction(e,e.execCallbacks.else,[t])}}else if(!e.result&&e.execCallbacks.else){this.execAction(e,e.execCallbacks.else,[t])}else if(e.result&&e.execCallbacks.then){this.execAction(e,e.execCallbacks.then,[t])}if(e.execCallbacks.finally){this.execAction(e,e.execCallbacks.finally,[t])}}},{"nextgen-events":38,"tree-kit/lib/extend.js":42}],10:[function(e,t,r){(function(r){"use strict";var n=e("./async.js");var i=false;function s(e,t){if(i){return}i=true;var s=r.listeners("asyncExit");if(!s.length){r.exit(e);return}if(t===undefined){t=1e3}n.parallel(s).using(function(r,n){if(r.length<3){r(e,t);n()}else{r(e,t,n)}}).fatal(false).timeout(t).exec(function(){r.exit(e)})}t.exports=s}).call(this,e("_process"))},{"./async.js":8,_process:14}],11:[function(e,t,r){"use strict";var n={};t.exports=n;n.timeout=function i(e,t,r){var n=function(){var n=r||this,i=false,s=Array.prototype.slice.call(arguments),o=s.pop();var a=function(){if(i){return}i=true;o.apply(n,arguments)};s.push(a);e.apply(n,s);setTimeout(a.bind(undefined,new Error("Timeout")),t)};return n}},{}],12:[function(e,t,r){},{}],13:[function(e,t,r){t.exports=function(e){return!!(e!=null&&(e._isBuffer||e.constructor&&typeof e.constructor.isBuffer==="function"&&e.constructor.isBuffer(e)))}},{}],14:[function(e,t,r){var n=t.exports={};var i=[];var s=false;var o;var a=-1;function l(){if(!s||!o){return}s=false;if(o.length){i=o.concat(i)}else{a=-1}if(i.length){u()}}function u(){if(s){return}var e=setTimeout(l);s=true;var t=i.length;while(t){o=i;i=[];while(++a<t){if(o){o[a].run()}}a=-1;t=i.length}o=null;s=false;clearTimeout(e)}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1){for(var r=1;r<arguments.length;r++){t[r-1]=arguments[r]}}i.push(new c(e,t));if(i.length===1&&!s){setTimeout(u,0)}};function c(e,t){this.fun=e;this.array=t}c.prototype.run=function(){this.fun.apply(null,this.array)};n.title="browser";n.browser=true;n.env={};n.argv=[];n.version="";n.versions={};function f(){}n.on=f;n.addListener=f;n.once=f;n.off=f;n.removeListener=f;n.removeAllListeners=f;n.emit=f;n.binding=function(e){throw new Error("process.binding is not supported")};n.cwd=function(){return"/"};n.chdir=function(e){throw new Error("process.chdir is not supported")};n.umask=function(){return 0}},{}],15:[function(t,r,n){(function(t){(function(i){var s=typeof n=="object"&&n&&!n.nodeType&&n;var o=typeof r=="object"&&r&&!r.nodeType&&r;var a=typeof t=="object"&&t;if(a.global===a||a.window===a||a.self===a){i=a}var l,u=2147483647,c=36,f=1,p=26,h=38,d=700,g=72,b=128,y="-",m=/^xn--/,v=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,w={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=c-f,_=Math.floor,T=String.fromCharCode,j;function A(e){throw new RangeError(w[e])}function C(e,t){var r=e.length;var n=[];while(r--){n[r]=t(e[r])}return n}function M(e,t){var r=e.split("@");var n="";if(r.length>1){n=r[0]+"@";e=r[1]}e=e.replace(x,".");var i=e.split(".");var s=C(i,t).join(".");return n+s}function S(e){var t=[],r=0,n=e.length,i,s;while(r<n){i=e.charCodeAt(r++);if(i>=55296&&i<=56319&&r<n){s=e.charCodeAt(r++);if((s&64512)==56320){t.push(((i&1023)<<10)+(s&1023)+65536)}else{t.push(i);r--}}else{t.push(i)}}return t}function O(e){return C(e,function(e){var t="";if(e>65535){e-=65536;t+=T(e>>>10&1023|55296);e=56320|e&1023}t+=T(e);return t}).join("")}function E(e){if(e-48<10){return e-22}if(e-65<26){return e-65}if(e-97<26){return e-97}return c}function L(e,t){return e+22+75*(e<26)-((t!=0)<<5)}function P(e,t,r){var n=0;e=r?_(e/d):e>>1;e+=_(e/t);for(;e>k*p>>1;n+=c){e=_(e/k)}return _(n+(k+1)*e/(e+h))}function I(e){var t=[],r=e.length,n,i=0,s=b,o=g,a,l,h,d,m,v,x,w,k;a=e.lastIndexOf(y);if(a<0){a=0}for(l=0;l<a;++l){if(e.charCodeAt(l)>=128){A("not-basic")}t.push(e.charCodeAt(l))}for(h=a>0?a+1:0;h<r;){for(d=i,m=1,v=c;;v+=c){if(h>=r){A("invalid-input")}x=E(e.charCodeAt(h++));if(x>=c||x>_((u-i)/m)){A("overflow")}i+=x*m;w=v<=o?f:v>=o+p?p:v-o;if(x<w){break}k=c-w;if(m>_(u/k)){A("overflow")}m*=k}n=t.length+1;o=P(i-d,n,d==0);if(_(i/n)>u-s){A("overflow")}s+=_(i/n);i%=n;t.splice(i++,0,s)}return O(t)}function N(e){var t,r,n,i,s,o,a,l,h,d,m,v=[],x,w,k,j;e=S(e);x=e.length;t=b;r=0;s=g;for(o=0;o<x;++o){m=e[o];if(m<128){v.push(T(m))}}n=i=v.length;if(i){v.push(y)}while(n<x){for(a=u,o=0;o<x;++o){m=e[o];if(m>=t&&m<a){a=m}}w=n+1;if(a-t>_((u-r)/w)){A("overflow")}r+=(a-t)*w;t=a;for(o=0;o<x;++o){m=e[o];if(m<t&&++r>u){A("overflow")}if(m==t){for(l=r,h=c;;h+=c){d=h<=s?f:h>=s+p?p:h-s;if(l<d){break}j=l-d;k=c-d;v.push(T(L(d+j%k,0)));l=_(j/k)}v.push(T(L(l,0)));s=P(r,w,n==i);r=0;++n}}++r;++t}return v.join("")}function D(e){return M(e,function(e){return m.test(e)?I(e.slice(4).toLowerCase()):e})}function F(e){return M(e,function(e){return v.test(e)?"xn--"+N(e):e})}l={version:"1.4.1",ucs2:{decode:S,encode:O},decode:I,encode:N,toASCII:F,toUnicode:D};if(typeof e=="function"&&typeof e.amd=="object"&&e.amd){e("punycode",function(){return l})}else if(s&&o){if(r.exports==s){o.exports=l}else{for(j in l){l.hasOwnProperty(j)&&(s[j]=l[j])}}}else{i.punycode=l}})(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],16:[function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,s){t=t||"&";r=r||"=";var o={};if(typeof e!=="string"||e.length===0){return o}var a=/\+/g;e=e.split(t);var l=1e3;if(s&&typeof s.maxKeys==="number"){l=s.maxKeys}var u=e.length;if(l>0&&u>l){u=l}for(var c=0;c<u;++c){var f=e[c].replace(a,"%20"),p=f.indexOf(r),h,d,g,b;if(p>=0){h=f.substr(0,p);d=f.substr(p+1)}else{h=f;d=""}g=decodeURIComponent(h);b=decodeURIComponent(d);if(!n(o,g)){o[g]=b}else if(i(o[g])){o[g].push(b)}else{o[g]=[o[g],b]}}return o};var i=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}},{}],17:[function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,r,a){t=t||"&";r=r||"=";if(e===null){e=undefined}if(typeof e==="object"){return s(o(e),function(o){var a=encodeURIComponent(n(o))+r;if(i(e[o])){return s(e[o],function(e){return a+encodeURIComponent(n(e))}).join(t)}else{return a+encodeURIComponent(n(e[o]))}}).join(t)}if(!a)return"";return encodeURIComponent(n(a))+r+encodeURIComponent(n(e))};var i=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};function s(e,t){if(e.map)return e.map(t);var r=[];for(var n=0;n<e.length;n++){r.push(t(e[n],n))}return r}var o=Object.keys||function(e){var t=[];for(var r in e){if(Object.prototype.hasOwnProperty.call(e,r))t.push(r)}return t}},{}],18:[function(e,t,r){"use strict";r.decode=r.parse=e("./decode");r.encode=r.stringify=e("./encode")},{"./decode":16,"./encode":17}],19:[function(e,t,r){"use strict";var n=e("punycode");var i=e("./util");r.parse=w;r.resolve=_;r.resolveObject=T;r.format=k;r.Url=s;function s(){this.protocol=null;this.slashes=null;this.auth=null;this.host=null;this.port=null;this.hostname=null;this.hash=null;this.search=null;this.query=null;this.pathname=null;this.path=null;this.href=null}var o=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["<",">",'"',"`"," ","\r","\n"," "],c=["{","}","|","\\","^","`"].concat(u),f=["'"].concat(c),p=["%","/","?",";","#"].concat(f),h=["/","?","#"],d=255,g=/^[+a-z0-9A-Z_-]{0,63}$/,b=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:true,"javascript:":true},m={javascript:true,"javascript:":true},v={http:true,https:true,ftp:true,gopher:true,file:true,"http:":true,"https:":true,"ftp:":true,"gopher:":true,"file:":true},x=e("querystring");function w(e,t,r){if(e&&i.isObject(e)&&e instanceof s)return e;var n=new s;n.parse(e,t,r);return n}s.prototype.parse=function(e,t,r){if(!i.isString(e)){throw new TypeError("Parameter 'url' must be a string, not "+typeof e)}var s=e.indexOf("?"),a=s!==-1&&s<e.indexOf("#")?"?":"#",u=e.split(a),c=/\\/g;u[0]=u[0].replace(c,"/");e=u.join(a);var w=e;w=w.trim();if(!r&&e.split("#").length===1){var k=l.exec(w);if(k){this.path=w;this.href=w;this.pathname=k[1];if(k[2]){this.search=k[2];if(t){this.query=x.parse(this.search.substr(1))}else{this.query=this.search.substr(1)}}else if(t){this.search="";this.query={}}return this}}var _=o.exec(w);if(_){_=_[0];var T=_.toLowerCase();this.protocol=T;w=w.substr(_.length)}if(r||_||w.match(/^\/\/[^@\/]+@[^@\/]+/)){var j=w.substr(0,2)==="//";if(j&&!(_&&m[_])){w=w.substr(2);this.slashes=true}}if(!m[_]&&(j||_&&!v[_])){var A=-1;for(var C=0;C<h.length;C++){var M=w.indexOf(h[C]);if(M!==-1&&(A===-1||M<A))A=M}var S,O;if(A===-1){O=w.lastIndexOf("@")}else{O=w.lastIndexOf("@",A)}if(O!==-1){S=w.slice(0,O);w=w.slice(O+1);this.auth=decodeURIComponent(S)}A=-1;for(var C=0;C<p.length;C++){var M=w.indexOf(p[C]);if(M!==-1&&(A===-1||M<A))A=M}if(A===-1)A=w.length;this.host=w.slice(0,A);w=w.slice(A);this.parseHost();this.hostname=this.hostname||"";var E=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!E){var L=this.hostname.split(/\./);for(var C=0,P=L.length;C<P;C++){var I=L[C];if(!I)continue;if(!I.match(g)){var N="";for(var D=0,F=I.length;D<F;D++){if(I.charCodeAt(D)>127){N+="x"}else{N+=I[D]}}if(!N.match(g)){var U=L.slice(0,C);var R=L.slice(C+1);var q=I.match(b);if(q){U.push(q[1]);R.unshift(q[2])}if(R.length){w="/"+R.join(".")+w}this.hostname=U.join(".");break}}}}if(this.hostname.length>d){this.hostname=""}else{this.hostname=this.hostname.toLowerCase()}if(!E){this.hostname=n.toASCII(this.hostname)}var H=this.port?":"+this.port:"";var K=this.hostname||"";this.host=K+H;this.href+=this.host;if(E){this.hostname=this.hostname.substr(1,this.hostname.length-2);if(w[0]!=="/"){w="/"+w}}}if(!y[T]){for(var C=0,P=f.length;C<P;C++){var J=f[C];if(w.indexOf(J)===-1)continue;var W=encodeURIComponent(J);if(W===J){W=escape(J)}w=w.split(J).join(W)}}var B=w.indexOf("#");if(B!==-1){this.hash=w.substr(B);w=w.slice(0,B)}var $=w.indexOf("?");if($!==-1){this.search=w.substr($);this.query=w.substr($+1);if(t){this.query=x.parse(this.query)}w=w.slice(0,$)}else if(t){this.search="";this.query={}}if(w)this.pathname=w;if(v[T]&&this.hostname&&!this.pathname){this.pathname="/"}if(this.pathname||this.search){var H=this.pathname||"";var z=this.search||"";this.path=H+z}this.href=this.format();return this};function k(e){if(i.isString(e))e=w(e);if(!(e instanceof s))return s.prototype.format.call(e);return e.format()}s.prototype.format=function(){var e=this.auth||"";if(e){e=encodeURIComponent(e);e=e.replace(/%3A/i,":");e+="@"}var t=this.protocol||"",r=this.pathname||"",n=this.hash||"",s=false,o="";if(this.host){s=e+this.host}else if(this.hostname){s=e+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]");if(this.port){s+=":"+this.port}}if(this.query&&i.isObject(this.query)&&Object.keys(this.query).length){o=x.stringify(this.query)}var a=this.search||o&&"?"+o||"";if(t&&t.substr(-1)!==":")t+=":";if(this.slashes||(!t||v[t])&&s!==false){s="//"+(s||"");if(r&&r.charAt(0)!=="/")r="/"+r}else if(!s){s=""}if(n&&n.charAt(0)!=="#")n="#"+n;if(a&&a.charAt(0)!=="?")a="?"+a;r=r.replace(/[?#]/g,function(e){return encodeURIComponent(e)});a=a.replace("#","%23");return t+s+r+a+n};function _(e,t){return w(e,false,true).resolve(t)}s.prototype.resolve=function(e){return this.resolveObject(w(e,false,true)).format()};function T(e,t){if(!e)return t;return w(e,false,true).resolveObject(t)}s.prototype.resolveObject=function(e){if(i.isString(e)){var t=new s;t.parse(e,false,true);e=t}var r=new s;var n=Object.keys(this);for(var o=0;o<n.length;o++){var a=n[o];r[a]=this[a]}r.hash=e.hash;if(e.href===""){r.href=r.format();return r}if(e.slashes&&!e.protocol){var l=Object.keys(e);for(var u=0;u<l.length;u++){var c=l[u];if(c!=="protocol")r[c]=e[c]}if(v[r.protocol]&&r.hostname&&!r.pathname){r.path=r.pathname="/"}r.href=r.format();return r}if(e.protocol&&e.protocol!==r.protocol){if(!v[e.protocol]){var f=Object.keys(e);for(var p=0;p<f.length;p++){var h=f[p];r[h]=e[h]}r.href=r.format();return r}r.protocol=e.protocol;if(!e.host&&!m[e.protocol]){var d=(e.pathname||"").split("/");while(d.length&&!(e.host=d.shift()));if(!e.host)e.host="";if(!e.hostname)e.hostname="";if(d[0]!=="")d.unshift("");if(d.length<2)d.unshift("");r.pathname=d.join("/")}else{r.pathname=e.pathname}r.search=e.search;r.query=e.query;r.host=e.host||"";r.auth=e.auth;r.hostname=e.hostname||e.host;r.port=e.port;if(r.pathname||r.search){var g=r.pathname||"";var b=r.search||"";r.path=g+b}r.slashes=r.slashes||e.slashes;r.href=r.format();return r}var y=r.pathname&&r.pathname.charAt(0)==="/",x=e.host||e.pathname&&e.pathname.charAt(0)==="/",w=x||y||r.host&&e.pathname,k=w,_=r.pathname&&r.pathname.split("/")||[],d=e.pathname&&e.pathname.split("/")||[],T=r.protocol&&!v[r.protocol];if(T){r.hostname="";r.port=null;if(r.host){if(_[0]==="")_[0]=r.host;else _.unshift(r.host)}r.host="";if(e.protocol){e.hostname=null;e.port=null;if(e.host){if(d[0]==="")d[0]=e.host;else d.unshift(e.host)}e.host=null}w=w&&(d[0]===""||_[0]==="")}if(x){r.host=e.host||e.host===""?e.host:r.host;r.hostname=e.hostname||e.hostname===""?e.hostname:r.hostname;r.search=e.search;r.query=e.query;_=d}else if(d.length){if(!_)_=[];_.pop();_=_.concat(d);r.search=e.search;r.query=e.query}else if(!i.isNullOrUndefined(e.search)){if(T){r.hostname=r.host=_.shift();var j=r.host&&r.host.indexOf("@")>0?r.host.split("@"):false;if(j){r.auth=j.shift();r.host=r.hostname=j.shift()}}r.search=e.search;r.query=e.query;if(!i.isNull(r.pathname)||!i.isNull(r.search)){r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")}r.href=r.format();return r}if(!_.length){r.pathname=null;if(r.search){r.path="/"+r.search}else{r.path=null}r.href=r.format();return r}var A=_.slice(-1)[0];var C=(r.host||e.host||_.length>1)&&(A==="."||A==="..")||A==="";var M=0;for(var S=_.length;S>=0;S--){A=_[S];if(A==="."){_.splice(S,1)}else if(A===".."){_.splice(S,1);M++}else if(M){_.splice(S,1);M--}}if(!w&&!k){for(;M--;M){_.unshift("..")}}if(w&&_[0]!==""&&(!_[0]||_[0].charAt(0)!=="/")){_.unshift("")}if(C&&_.join("/").substr(-1)!=="/"){_.push("")}var O=_[0]===""||_[0]&&_[0].charAt(0)==="/";if(T){r.hostname=r.host=O?"":_.length?_.shift():"";var j=r.host&&r.host.indexOf("@")>0?r.host.split("@"):false;if(j){r.auth=j.shift();r.host=r.hostname=j.shift()}}w=w||r.host&&_.length;if(w&&!O){_.unshift("")}if(!_.length){r.pathname=null;r.path=null}else{r.pathname=_.join("/")}if(!i.isNull(r.pathname)||!i.isNull(r.search)){r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")}r.auth=e.auth||r.auth;r.slashes=r.slashes||e.slashes;r.href=r.format();return r};s.prototype.parseHost=function(){var e=this.host;var t=a.exec(e);if(t){t=t[0];if(t!==":"){this.port=t.substr(1)}e=e.substr(0,e.length-t.length)}if(e)this.hostname=e}},{"./util":20,punycode:15,querystring:18}],20:[function(e,t,r){"use strict";t.exports={isString:function(e){return typeof e==="string"},isObject:function(e){return typeof e==="object"&&e!==null},isNull:function(e){return e===null},isNullOrUndefined:function(e){return e==null}}},{}],21:[function(e,t,r){"use strict";r.__esModule=true;r.convertChangesToDMP=n;function n(e){var t=[],r=void 0,n=void 0;for(var i=0;i<e.length;i++){r=e[i];if(r.added){n=1}else if(r.removed){n=-1}else{n=0}t.push([n,r.value])}return t}},{}],22:[function(e,t,r){"use strict";r.__esModule=true;r.convertChangesToXML=n;function n(e){var t=[];for(var r=0;r<e.length;r++){var n=e[r];if(n.added){t.push("<ins>");
}else if(n.removed){t.push("<del>")}t.push(i(n.value));if(n.added){t.push("</ins>")}else if(n.removed){t.push("</del>")}}return t.join("")}function i(e){var t=e;t=t.replace(/&/g,"&");t=t.replace(/</g,"<");t=t.replace(/>/g,">");t=t.replace(/"/g,""");return t}},{}],23:[function(e,t,r){"use strict";r.__esModule=true;r.default=n;function n(){}n.prototype={diff:function o(e,t){var r=arguments.length<=2||arguments[2]===undefined?{}:arguments[2];var n=r.callback;if(typeof r==="function"){n=r;r={}}this.options=r;var o=this;function a(e){if(n){setTimeout(function(){n(undefined,e)},0);return true}else{return e}}e=this.castInput(e);t=this.castInput(t);e=this.removeEmpty(this.tokenize(e));t=this.removeEmpty(this.tokenize(t));var l=t.length,u=e.length;var c=1;var f=l+u;var p=[{newPos:-1,components:[]}];var h=this.extractCommon(p[0],t,e,0);if(p[0].newPos+1>=l&&h+1>=u){return a([{value:t.join(""),count:t.length}])}function d(){for(var r=-1*c;r<=c;r+=2){var n=void 0;var f=p[r-1],h=p[r+1],d=(h?h.newPos:0)-r;if(f){p[r-1]=undefined}var g=f&&f.newPos+1<l,b=h&&0<=d&&d<u;if(!g&&!b){p[r]=undefined;continue}if(!g||b&&f.newPos<h.newPos){n=s(h);o.pushComponent(n.components,undefined,true)}else{n=f;n.newPos++;o.pushComponent(n.components,true,undefined)}d=o.extractCommon(n,t,e,r);if(n.newPos+1>=l&&d+1>=u){return a(i(o,n.components,t,e,o.useLongestToken))}else{p[r]=n}}c++}if(n){(function b(){setTimeout(function(){if(c>f){return n()}if(!d()){b()}},0)})()}else{while(c<=f){var g=d();if(g){return g}}}},pushComponent:function a(e,t,r){var n=e[e.length-1];if(n&&n.added===t&&n.removed===r){e[e.length-1]={count:n.count+1,added:t,removed:r}}else{e.push({count:1,added:t,removed:r})}},extractCommon:function l(e,t,r,n){var i=t.length,s=r.length,o=e.newPos,a=o-n,l=0;while(o+1<i&&a+1<s&&this.equals(t[o+1],r[a+1])){o++;a++;l++}if(l){e.components.push({count:l})}e.newPos=o;return a},equals:function u(e,t){return e===t},removeEmpty:function c(e){var t=[];for(var r=0;r<e.length;r++){if(e[r]){t.push(e[r])}}return t},castInput:function f(e){return e},tokenize:function p(e){return e.split("")}};function i(e,t,r,n,i){var s=0,o=t.length,a=0,l=0;for(;s<o;s++){var u=t[s];if(!u.removed){if(!u.added&&i){var c=r.slice(a,a+u.count);c=c.map(function(e,t){var r=n[l+t];return r.length>e.length?r:e});u.value=c.join("")}else{u.value=r.slice(a,a+u.count).join("")}a+=u.count;if(!u.added){l+=u.count}}else{u.value=n.slice(l,l+u.count).join("");l+=u.count;if(s&&t[s-1].added){var f=t[s-1];t[s-1]=t[s];t[s]=f}}}var p=t[o-1];if(o>1&&(p.added||p.removed)&&e.equals("",p.value)){t[o-2].value+=p.value;t.pop()}return t}function s(e){return{newPos:e.newPos,components:e.components.slice(0)}}},{}],24:[function(e,t,r){"use strict";r.__esModule=true;r.characterDiff=undefined;r.diffChars=a;var n=e("./base");var i=s(n);function s(e){return e&&e.__esModule?e:{"default":e}}var o=r.characterDiff=new i.default;function a(e,t,r){return o.diff(e,t,r)}},{"./base":23}],25:[function(e,t,r){"use strict";r.__esModule=true;r.cssDiff=undefined;r.diffCss=a;var n=e("./base");var i=s(n);function s(e){return e&&e.__esModule?e:{"default":e}}var o=r.cssDiff=new i.default;o.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function a(e,t,r){return o.diff(e,t,r)}},{"./base":23}],26:[function(e,t,r){"use strict";r.__esModule=true;r.jsonDiff=undefined;var n=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol?"symbol":typeof e};r.diffJson=c;r.canonicalize=f;var i=e("./base");var s=a(i);var o=e("./line");function a(e){return e&&e.__esModule?e:{"default":e}}var l=Object.prototype.toString;var u=r.jsonDiff=new s.default;u.useLongestToken=true;u.tokenize=o.lineDiff.tokenize;u.castInput=function(e){return typeof e==="string"?e:JSON.stringify(f(e),undefined," ")};u.equals=function(e,t){return s.default.prototype.equals(e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"))};function c(e,t,r){return u.diff(e,t,r)}function f(e,t,r){t=t||[];r=r||[];var i=void 0;for(i=0;i<t.length;i+=1){if(t[i]===e){return r[i]}}var s=void 0;if("[object Array]"===l.call(e)){t.push(e);s=new Array(e.length);r.push(s);for(i=0;i<e.length;i+=1){s[i]=f(e[i],t,r)}t.pop();r.pop();return s}if(e&&e.toJSON){e=e.toJSON()}if((typeof e==="undefined"?"undefined":n(e))==="object"&&e!==null){t.push(e);s={};r.push(s);var o=[],a=void 0;for(a in e){if(e.hasOwnProperty(a)){o.push(a)}}o.sort();for(i=0;i<o.length;i+=1){a=o[i];s[a]=f(e[a],t,r)}t.pop();r.pop()}else{s=e}return s}},{"./base":23,"./line":27}],27:[function(e,t,r){"use strict";r.__esModule=true;r.lineDiff=undefined;r.diffLines=l;r.diffTrimmedLines=u;var n=e("./base");var i=o(n);var s=e("../util/params");function o(e){return e&&e.__esModule?e:{"default":e}}var a=r.lineDiff=new i.default;a.tokenize=function(e){var t=[],r=e.split(/(\n|\r\n)/);if(!r[r.length-1]){r.pop()}for(var n=0;n<r.length;n++){var i=r[n];if(n%2&&!this.options.newlineIsToken){t[t.length-1]+=i}else{if(this.options.ignoreWhitespace){i=i.trim()}t.push(i)}}return t};function l(e,t,r){return a.diff(e,t,r)}function u(e,t,r){var n=(0,s.generateOptions)(r,{ignoreWhitespace:true});return a.diff(e,t,n)}},{"../util/params":35,"./base":23}],28:[function(e,t,r){"use strict";r.__esModule=true;r.sentenceDiff=undefined;r.diffSentences=a;var n=e("./base");var i=s(n);function s(e){return e&&e.__esModule?e:{"default":e}}var o=r.sentenceDiff=new i.default;o.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};function a(e,t,r){return o.diff(e,t,r)}},{"./base":23}],29:[function(e,t,r){"use strict";r.__esModule=true;r.wordDiff=undefined;r.diffWords=c;r.diffWordsWithSpace=f;var n=e("./base");var i=o(n);var s=e("../util/params");function o(e){return e&&e.__esModule?e:{"default":e}}var a=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;var l=/\S/;var u=r.wordDiff=new i.default;u.equals=function(e,t){return e===t||this.options.ignoreWhitespace&&!l.test(e)&&!l.test(t)};u.tokenize=function(e){var t=e.split(/(\s+|\b)/);for(var r=0;r<t.length-1;r++){if(!t[r+1]&&t[r+2]&&a.test(t[r])&&a.test(t[r+2])){t[r]+=t[r+2];t.splice(r+1,2);r--}}return t};function c(e,t,r){var n=(0,s.generateOptions)(r,{ignoreWhitespace:true});return u.diff(e,t,n)}function f(e,t,r){return u.diff(e,t,r)}},{"../util/params":35,"./base":23}],30:[function(e,t,r){"use strict";r.__esModule=true;r.canonicalize=r.convertChangesToXML=r.convertChangesToDMP=r.parsePatch=r.applyPatches=r.applyPatch=r.createPatch=r.createTwoFilesPatch=r.structuredPatch=r.diffJson=r.diffCss=r.diffSentences=r.diffTrimmedLines=r.diffLines=r.diffWordsWithSpace=r.diffWords=r.diffChars=r.Diff=undefined;var n=e("./diff/base");var i=b(n);var s=e("./diff/character");var o=e("./diff/word");var a=e("./diff/line");var l=e("./diff/sentence");var u=e("./diff/css");var c=e("./diff/json");var f=e("./patch/apply");var p=e("./patch/parse");var h=e("./patch/create");var d=e("./convert/dmp");var g=e("./convert/xml");function b(e){return e&&e.__esModule?e:{"default":e}}r.Diff=i.default;r.diffChars=s.diffChars;r.diffWords=o.diffWords;r.diffWordsWithSpace=o.diffWordsWithSpace;r.diffLines=a.diffLines;r.diffTrimmedLines=a.diffTrimmedLines;r.diffSentences=l.diffSentences;r.diffCss=u.diffCss;r.diffJson=c.diffJson;r.structuredPatch=h.structuredPatch;r.createTwoFilesPatch=h.createTwoFilesPatch;r.createPatch=h.createPatch;r.applyPatch=f.applyPatch;r.applyPatches=f.applyPatches;r.parsePatch=p.parsePatch;r.convertChangesToDMP=d.convertChangesToDMP;r.convertChangesToXML=g.convertChangesToXML;r.canonicalize=c.canonicalize},{"./convert/dmp":21,"./convert/xml":22,"./diff/base":23,"./diff/character":24,"./diff/css":25,"./diff/json":26,"./diff/line":27,"./diff/sentence":28,"./diff/word":29,"./patch/apply":31,"./patch/create":32,"./patch/parse":33}],31:[function(e,t,r){"use strict";r.__esModule=true;r.applyPatch=a;r.applyPatches=l;var n=e("./parse");var i=e("../util/distance-iterator");var s=o(i);function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r=arguments.length<=2||arguments[2]===undefined?{}:arguments[2];if(typeof t==="string"){t=(0,n.parsePatch)(t)}if(Array.isArray(t)){if(t.length>1){throw new Error("applyPatch only works with a single input.")}t=t[0]}var i=e.split("\n"),o=t.hunks,a=r.compareLine||function(e,t,r,n){return t===n},l=0,u=r.fuzzFactor||0,c=0,f=0,p=void 0,h=void 0;function d(e,t){for(var r=0;r<e.lines.length;r++){var n=e.lines[r],s=n[0],o=n.substr(1);if(s===" "||s==="-"){if(!a(t+1,i[t],s,o)){l++;if(l>u){return false}}t++}}return true}for(var g=0;g<o.length;g++){var b=o[g],y=i.length-b.oldLines,m=0,v=f+b.oldStart-1;var x=(0,s.default)(v,c,y);for(;m!==undefined;m=x()){if(d(b,v+m)){b.offset=f+=m;break}}if(m===undefined){return false}c=b.offset+b.oldStart+b.oldLines}for(var w=0;w<o.length;w++){var k=o[w],_=k.offset+k.newStart-1;for(var T=0;T<k.lines.length;T++){var j=k.lines[T],A=j[0],C=j.substr(1);if(A===" "){_++}else if(A==="-"){i.splice(_,1)}else if(A==="+"){i.splice(_,0,C);_++}else if(A==="\\"){var M=k.lines[T-1]?k.lines[T-1][0]:null;if(M==="+"){p=true}else if(M==="-"){h=true}}}}if(p){while(!i[i.length-1]){i.pop()}}else if(h){i.push("")}return i.join("\n")}function l(e,t){if(typeof e==="string"){e=(0,n.parsePatch)(e)}var r=0;function i(){var n=e[r++];if(!n){return t.complete()}t.loadFile(n,function(e,r){if(e){return t.complete(e)}var s=a(r,n,t);t.patched(n,s);setTimeout(i,0)})}i()}},{"../util/distance-iterator":34,"./parse":33}],32:[function(e,t,r){"use strict";r.__esModule=true;r.structuredPatch=s;r.createTwoFilesPatch=o;r.createPatch=a;var n=e("../diff/line");function i(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++){r[t]=e[t]}return r}else{return Array.from(e)}}function s(e,t,r,s,o,a,l){if(!l){l={context:4}}var u=(0,n.diffLines)(r,s);u.push({value:"",lines:[]});function c(e){return e.map(function(e){return" "+e})}var f=[];var p=0,h=0,d=[],g=1,b=1;var y=function v(e){var t=u[e],n=t.lines||t.value.replace(/\n$/,"").split("\n");t.lines=n;if(t.added||t.removed){var o;if(!p){var a=u[e-1];p=g;h=b;if(a){d=l.context>0?c(a.lines.slice(-l.context)):[];p-=d.length;h-=d.length}}(o=d).push.apply(o,i(n.map(function(e){return(t.added?"+":"-")+e})));if(t.added){b+=n.length}else{g+=n.length}}else{if(p){if(n.length<=l.context*2&&e<u.length-2){var y;(y=d).push.apply(y,i(c(n)))}else{var m;var v=Math.min(n.length,l.context);(m=d).push.apply(m,i(c(n.slice(0,v))));var x={oldStart:p,oldLines:g-p+v,newStart:h,newLines:b-h+v,lines:d};if(e>=u.length-2&&n.length<=l.context){var w=/\n$/.test(r);var k=/\n$/.test(s);if(n.length==0&&!w){d.splice(x.oldLines,0,"\\ No newline at end of file")}else if(!w||!k){d.push("\\ No newline at end of file")}}f.push(x);p=0;h=0;d=[]}}g+=n.length;b+=n.length}};for(var m=0;m<u.length;m++){y(m)}return{oldFileName:e,newFileName:t,oldHeader:o,newHeader:a,hunks:f}}function o(e,t,r,n,i,o,a){var l=s(e,t,r,n,i,o,a);var u=[];if(e==t){u.push("Index: "+e)}u.push("===================================================================");u.push("--- "+l.oldFileName+(typeof l.oldHeader==="undefined"?"":" "+l.oldHeader));u.push("+++ "+l.newFileName+(typeof l.newHeader==="undefined"?"":" "+l.newHeader));for(var c=0;c<l.hunks.length;c++){var f=l.hunks[c];u.push("@@ -"+f.oldStart+","+f.oldLines+" +"+f.newStart+","+f.newLines+" @@");u.push.apply(u,f.lines)}return u.join("\n")+"\n"}function a(e,t,r,n,i,s){return o(e,e,t,r,n,i,s)}},{"../diff/line":27}],33:[function(e,t,r){"use strict";r.__esModule=true;r.parsePatch=n;function n(e){var t=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];var r=e.split("\n"),n=[],i=0;function s(){var e={};n.push(e);while(i<r.length){var s=r[i];if(/^(\-\-\-|\+\+\+|@@)\s/.test(s)){break}var l=/^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(s);if(l){e.index=l[1]}i++}o(e);o(e);e.hunks=[];while(i<r.length){var u=r[i];if(/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(u)){break}else if(/^@@/.test(u)){e.hunks.push(a())}else if(u&&t.strict){throw new Error("Unknown line "+(i+1)+" "+JSON.stringify(u))}else{i++}}}function o(e){var t=/^(\-\-\-|\+\+\+)\s+(\S*)\s?(.*?)\s*$/.exec(r[i]);if(t){var n=t[1]==="---"?"old":"new";e[n+"FileName"]=t[2];e[n+"Header"]=t[3];i++}}function a(){var e=i,n=r[i++],s=n.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);var o={oldStart:+s[1],oldLines:+s[2]||1,newStart:+s[3],newLines:+s[4]||1,lines:[]};var a=0,l=0;for(;i<r.length;i++){var u=r[i][0];if(u==="+"||u==="-"||u===" "||u==="\\"){o.lines.push(r[i]);if(u==="+"){a++}else if(u==="-"){l++}else if(u===" "){a++;l++}}else{break}}if(!a&&o.newLines===1){o.newLines=0}if(!l&&o.oldLines===1){o.oldLines=0}if(t.strict){if(a!==o.newLines){throw new Error("Added line count did not match for hunk at line "+(e+1))}if(l!==o.oldLines){throw new Error("Removed line count did not match for hunk at line "+(e+1))}}return o}while(i<r.length){s()}return n}},{}],34:[function(e,t,r){"use strict";r.__esModule=true;r.default=function(e,t,r){var n=true,i=false,s=false,o=1;return function a(){if(n&&!s){if(i){o++}else{n=false}if(e+o<=r){return o}s=true}if(!i){if(!s){n=true}if(t<=e-o){return-o++}i=true;return a()}}}},{}],35:[function(e,t,r){"use strict";r.__esModule=true;r.generateOptions=n;function n(e,t){if(typeof e==="function"){t.callback=e}else if(e){for(var r in e){if(e.hasOwnProperty(r)){t[r]=e[r]}}}return t}},{}],36:[function(e,t,r){var n={};t.exports=n;n.svg=e("./svg.js");n.ready=function i(e){document.addEventListener("DOMContentLoaded",function t(){document.removeEventListener("DOMContentLoaded",t,false);e()},false)};n.fromHtml=function s(e){var t,r,n;n=document.createDocumentFragment();r=document.createElement("div");r.insertAdjacentHTML("beforeend",e);for(t=0;t<r.children.length;t++){n.appendChild(r.children[t])}return n};n.batch=function o(e,t){var r,n=Array.prototype.slice.call(arguments,1);if(t instanceof Element){n[0]=t;e.apply(this,n)}else if(Array.isArray(t)){for(r=0;r<t.length;r++){n[0]=t[r];e.apply(this,n)}}else if(t instanceof NodeList||t instanceof NamedNodeMap){for(r=0;r<t.length;r++){n[0]=t[r];e.apply(this,n)}}};n.css=function a(e,t){var r;for(r in t){e.style[r]=t[r]}};n.attr=function l(e,t){var r;for(r in t){if(t[r]===null){e.removeAttribute(r)}else{e.setAttribute(r,t[r])}}};n.remove=function u(e){e.parentNode.removeChild(e)};n.empty=function c(e){while(e.firstChild){e.removeChild(e.firstChild)}};n.cloneInto=function f(e,t){n.empty(e);e.appendChild(t.cloneNode(true))};n.insertInto=function p(e,t){n.empty(e);e.appendChild(t)};n.idNamespace=function h(e,t){var r,i={};r=e.querySelectorAll("*");n.batch(n.idNamespace.idAttributePass,r,t,i);n.batch(n.idNamespace.otherAttributesPass,r,i)};n.idNamespace.idAttributePass=function d(e,t,r){r[e.id]=t+"."+e.id;e.id=r[e.id]};n.idNamespace.otherAttributesPass=function g(e,t){n.batch(n.idNamespace.oneAttributeSubPass,e.attributes,t)};n.idNamespace.oneAttributeSubPass=function b(e,t){e.value=e.value.replace(/url\(#([^)]+)\)/g,function(e,r){if(!t[r]){return e}return"url(#"+t[r]+")"})};n.id=function y(e,y){e.id=y};n.text=function m(e,m){e.textContent=m};n.html=function v(e,v){e.innerHTML=v}},{"./svg.js":37}],37:[function(e,t,r){var n=e("fs");var i=e("./dom.js");var s={};t.exports=s;s.load=function a(e,t,r,i){if(typeof r==="function"){i=r}if(!r||typeof r!=="object"){r={}}if(t.substring(0,7)==="file://"){n.readFile(t.slice(7),function(t,n){if(t){i(t);return}var o=new DOMParser;var a=o.parseFromString(n.toString(),"application/xml").documentElement;try{s.attachXmlTo(e,a,r)}catch(t){i(t);return}i(undefined,a)})}else{s.ajax(t,function(t,n){var o=n.documentElement;if(t){i(t);return}try{s.attachXmlTo(e,o,r)}catch(t){i(t);return}i(undefined,o)})}};s.attachXmlTo=function l(e,t,r){s.lightCleanup(t);if(r.id!==undefined){if(typeof r.id==="string"){t.setAttribute("id",r.id)}else if(!r.id){t.removeAttribute("id")}}if(typeof r.class==="string"){t.setAttribute("class",r.class)}if(r.idNamespace){i.idNamespace(t,r.idNamespace)}if(r.hidden){t.style.visibility="hidden"}e.appendChild(t)};s.lightCleanup=function u(e){o(e,"metadata");o(e,"script")};function o(e,t){var r,n,i;n=e.getElementsByTagName(t);for(r=0;r<n.length;r++){i=n.item(r);i.parentNode.removeChild(i)}}s.ajax=function c(e,t){var r=new XMLHttpRequest;r.responseType="document";r.onreadystatechange=s.ajax.ajaxStatus.bind(r,t);r.open("GET",e);r.send()};s.ajax.ajaxStatus=function f(e){try{if(this.readyState===4){if(this.status===200){e(undefined,this.responseXML)}else if(this.status===0&&this.responseXML){e(undefined,this.responseXML)}else{if(this.status){e(this.status)}else{e(new Error("[dom-kit.svg] ajaxStatus(): Error with falsy status"))}}}}catch(t){e(t)}}},{"./dom.js":36,fs:12}],38:[function(e,t,r){"use strict";function n(){return Object.create(n.prototype)}t.exports=n;n.SYNC=-Infinity;n.init=function s(){Object.defineProperty(this,"__ngev",{value:{nice:n.SYNC,interruptible:false,recursion:0,contexts:{},events:{error:[],interrupt:[],newListener:[],removeListener:[]}}})};n.filterOutCallback=function(e,t){return e!==t};n.prototype.addListener=function o(e,t,r){var i={};if(!this.__ngev){n.init.call(this)}if(!this.__ngev.events[e]){this.__ngev.events[e]=[]}if(!e||typeof e!=="string"){throw new TypeError(".addListener(): argument #0 should be a non-empty string")}if(typeof t!=="function"){r=t;t=undefined}if(!r||typeof r!=="object"){r={}}i.fn=t||r.fn;i.id=typeof r.id==="string"?r.id:i.fn;i.once=!!r.once;i.async=!!r.async;i.nice=r.nice!==undefined?Math.floor(r.nice):n.SYNC;i.context=typeof r.context==="string"?r.context:null;if(typeof i.fn!=="function"){throw new TypeError(".addListener(): a function or an object with a 'fn' property which value is a function should be provided")}if(i.context&&typeof i.context==="string"&&!this.__ngev.contexts[i.context]){this.addListenerContext(i.context)}i.event=e;if(this.__ngev.events.newListener.length){this.emit("newListener",[i])}this.__ngev.events[e].push(i);return this};n.prototype.on=n.prototype.addListener;n.prototype.once=function a(e,t){if(!e||typeof e!=="string"){throw new TypeError(".once(): argument #0 should be a non-empty string")}if(typeof t==="function"){t={id:t,fn:t}}else if(!t||typeof t!=="object"||typeof t.fn!=="function"){throw new TypeError(".once(): argument #1 should be a function or an object with a 'fn' property which value is a function")}t.once=true;return this.addListener(e,t)};n.prototype.removeListener=function l(e,t){var r,i,s=[],o=[];if(!e||typeof e!=="string"){throw new TypeError(".removeListener(): argument #0 should be a non-empty string")}if(!this.__ngev){n.init.call(this)}if(!this.__ngev.events[e]){this.__ngev.events[e]=[]}i=this.__ngev.events[e].length;for(r=0;r<i;r++){if(this.__ngev.events[e][r].id===t){o.push(this.__ngev.events[e][r])}else{s.push(this.__ngev.events[e][r])}}this.__ngev.events[e]=s;if(o.length&&this.__ngev.events.removeListener.length){this.emit("removeListener",o)}return this};n.prototype.off=n.prototype.removeListener;n.prototype.removeAllListeners=function u(e){var t;if(!this.__ngev){n.init.call(this)}if(e){if(!e||typeof e!=="string"){throw new TypeError(".removeAllListener(): argument #0 should be undefined or a non-empty string")}if(!this.__ngev.events[e]){this.__ngev.events[e]=[]}t=this.__ngev.events[e];this.__ngev.events[e]=[];if(t.length&&this.__ngev.events.removeListener.length){this.emit("removeListener",t)}}else{this.__ngev.events={}}return this};n.listenerWrapper=function c(e,t,r){var i,s;if(t.interrupt){return}if(e.async){if(r){s=r.serial;r.ready=!s}i=e.fn.apply(undefined,t.args.concat(function(r){t.listenersDone++;if(r&&t.emitter.__ngev.interruptible&&!t.interrupt&&t.name!=="interrupt"){t.interrupt=r;if(t.callback){t.callback(t.interrupt,t);delete t.callback}t.emitter.emit("interrupt",t.interrupt)}else if(t.listenersDone>=t.listeners&&t.callback){t.callback(undefined,t);delete t.callback}if(s){n.processQueue.call(t.emitter,e.context,true)}}))}else{i=e.fn.apply(undefined,t.args);t.listenersDone++}if(i&&t.emitter.__ngev.interruptible&&!t.interrupt&&t.name!=="interrupt"){t.interrupt=i;if(t.callback){t.callback(t.interrupt,t);delete t.callback}t.emitter.emit("interrupt",t.interrupt)}else if(t.listenersDone>=t.listeners&&t.callback){t.callback(undefined,t);delete t.callback}};var i=0;n.prototype.emit=function f(){var e,t,r=0,s,o,a,l,u,c=[];s={emitter:this,id:i++,name:null,args:null,nice:null,interrupt:null,listeners:null,listenersDone:0,callback:null};if(!this.__ngev){n.init.call(this)}if(typeof arguments[0]==="number"){s.nice=Math.floor(arguments[0]);s.name=arguments[1];if(!s.name||typeof s.name!=="string"){throw new TypeError(".emit(): when argument #0 is a number, argument #1 should be a non-empty string")}if(typeof arguments[arguments.length-1]==="function"){s.callback=arguments[arguments.length-1];s.args=Array.prototype.slice.call(arguments,2,-1)}else{s.args=Array.prototype.slice.call(arguments,2)}}else{s.nice=this.__ngev.nice;s.name=arguments[0];if(!s.name||typeof s.name!=="string"){throw new TypeError(".emit(): argument #0 should be an number or a non-empty string")}s.args=Array.prototype.slice.call(arguments,1);if(typeof arguments[arguments.length-1]==="function"){s.callback=arguments[arguments.length-1];s.args=Array.prototype.slice.call(arguments,1,-1)}else{s.args=Array.prototype.slice.call(arguments,1)}}if(!this.__ngev.events[s.name]){this.__ngev.events[s.name]=[]}s.listeners=this.__ngev.events[s.name].length;this.__ngev.recursion++;u=this.__ngev.events[s.name].slice();for(e=0,t=u.length;e<t;e++){r++;o=u[e];a=o.context&&this.__ngev.contexts[o.context];if(a&&a.status===n.CONTEXT_DISABLED){continue}if(a){l=Math.max(s.nice,o.nice,a.nice)}else{l=Math.max(s.nice,o.nice)}if(o.once){this.__ngev.events[s.name]=this.__ngev.events[s.name].filter(n.filterOutCallback.bind(undefined,o));c.push(o)}if(a&&(a.status===n.CONTEXT_QUEUED||!a.ready)){a.queue.push({event:s,listener:o,nice:l})}else{try{if(l<0){if(this.__ngev.recursion>=-l){setImmediate(n.listenerWrapper.bind(this,o,s,a))}else{n.listenerWrapper.call(this,o,s,a)}}else{setTimeout(n.listenerWrapper.bind(this,o,s,a),l)}}catch(f){this.__ngev.recursion--;throw f}}}this.__ngev.recursion--;if(c.length&&this.__ngev.events.removeListener.length){this.emit("removeListener",c)}if(!r){if(s.name==="error"){if(arguments[1]){throw arguments[1]}else{throw Error("Uncaught, unspecified 'error' event.")}}if(s.callback){s.callback(undefined,s);delete s.callback}}return s};n.prototype.listeners=function p(e){if(!e||typeof e!=="string"){throw new TypeError(".listeners(): argument #0 should be a non-empty string")}if(!this.__ngev){n.init.call(this)}if(!this.__ngev.events[e]){this.__ngev.events[e]=[]}return this.__ngev.events[e].slice()};n.listenerCount=function(e,t){if(!e||!(e instanceof n)){throw new TypeError(".listenerCount(): argument #0 should be an instance of NextGenEvents")}return e.listenerCount(t)};n.prototype.listenerCount=function(e){if(!e||typeof e!=="string"){throw new TypeError(".listenerCount(): argument #1 should be a non-empty string")}if(!this.__ngev){n.init.call(this)}if(!this.__ngev.events[e]){this.__ngev.events[e]=[]}return this.__ngev.events[e].length};n.prototype.setNice=function h(e){if(!this.__ngev){n.init.call(this)}this.__ngev.nice=Math.floor(+e||0)};n.prototype.setInterruptible=function d(e){if(!this.__ngev){n.init.call(this)}this.__ngev.interruptible=!!e};n.prototype.setMaxListeners=function(){};n.noop=function(){};n.CONTEXT_ENABLED=0;n.CONTEXT_DISABLED=1;n.CONTEXT_QUEUED=2;n.prototype.addListenerContext=function g(e,t){if(!this.__ngev){n.init.call(this)}if(!e||typeof e!=="string"){throw new TypeError(".addListenerContext(): argument #0 should be a non-empty string")}if(!t||typeof t!=="object"){t={}}if(!this.__ngev.contexts[e]){this.__ngev.contexts[e]=Object.create(n.prototype);this.__ngev.contexts[e].nice=n.SYNC;this.__ngev.contexts[e].ready=true;this.__ngev.contexts[e].status=n.CONTEXT_ENABLED;this.__ngev.contexts[e].serial=false;this.__ngev.contexts[e].queue=[]}if(t.nice!==undefined){this.__ngev.contexts[e].nice=Math.floor(t.nice)}if(t.status!==undefined){this.__ngev.contexts[e].status=t.status}if(t.serial!==undefined){this.__ngev.contexts[e].serial=!!t.serial}return this};n.prototype.disableListenerContext=function b(e){if(!this.__ngev){n.init.call(this)}if(!e||typeof e!=="string"){throw new TypeError(".disableListenerContext(): argument #0 should be a non-empty string")}if(!this.__ngev.contexts[e]){this.addListenerContext(e)}this.__ngev.contexts[e].status=n.CONTEXT_DISABLED;return this};n.prototype.enableListenerContext=function y(e){if(!this.__ngev){n.init.call(this)}if(!e||typeof e!=="string"){throw new TypeError(".enableListenerContext(): argument #0 should be a non-empty string")}if(!this.__ngev.contexts[e]){this.addListenerContext(e)}this.__ngev.contexts[e].status=n.CONTEXT_ENABLED;if(this.__ngev.contexts[e].queue.length>0){n.processQueue.call(this,e)}return this};n.prototype.queueListenerContext=function m(e){if(!this.__ngev){n.init.call(this)}if(!e||typeof e!=="string"){throw new TypeError(".queueListenerContext(): argument #0 should be a non-empty string")}if(!this.__ngev.contexts[e]){this.addListenerContext(e)}this.__ngev.contexts[e].status=n.CONTEXT_QUEUED;return this};n.prototype.serializeListenerContext=function v(e,t){if(!this.__ngev){n.init.call(this)}if(!e||typeof e!=="string"){throw new TypeError(".serializeListenerContext(): argument #0 should be a non-empty string")}if(!this.__ngev.contexts[e]){this.addListenerContext(e)}this.__ngev.contexts[e].serial=t===undefined?true:!!t;return this};n.prototype.setListenerContextNice=function x(e,t){if(!this.__ngev){n.init.call(this)}if(!e||typeof e!=="string"){throw new TypeError(".setListenerContextNice(): argument #0 should be a non-empty string")}if(!this.__ngev.contexts[e]){this.addListenerContext(e)}this.__ngev.contexts[e].nice=Math.floor(t);return this};n.prototype.destroyListenerContext=function w(e){var t,r,i,s,o=[];if(!e||typeof e!=="string"){throw new TypeError(".disableListenerContext(): argument #0 should be a non-empty string")}if(!this.__ngev){n.init.call(this)}for(i in this.__ngev.events){s=null;r=this.__ngev.events[i].length;for(t=0;t<r;t++){if(this.__ngev.events[i][t].context===e){s=[];o.push(this.__ngev.events[i][t])}else if(s){s.push(this.__ngev.events[i][t])}}if(s){this.__ngev.events[i]=s}}if(this.__ngev.contexts[e]){delete this.__ngev.contexts[e]}if(o.length&&this.__ngev.events.removeListener.length){this.emit("removeListener",o)}return this};n.processQueue=function k(e,t){var r,i;if(!this.__ngev.contexts[e]){return}r=this.__ngev.contexts[e];if(t){r.ready=true}this.__ngev.recursion++;while(r.ready&&r.queue.length){i=r.queue.shift();if(i.event.interrupt){continue}try{if(i.nice<0){if(this.__ngev.recursion>=-i.nice){setImmediate(n.listenerWrapper.bind(this,i.listener,i.event,r))}else{n.listenerWrapper.call(this,i.listener,i.event,r)}}else{setTimeout(n.listenerWrapper.bind(this,i.listener,i.event,r),i.nice)}}catch(s){this.__ngev.recursion--;throw s}}this.__ngev.recursion--}},{}],39:[function(e,t,r){"use strict";t.exports={reset:"[0m",bold:"[1m",dim:"[2m",italic:"[3m",underline:"[4m",inverse:"[7m",defaultColor:"[39m",black:"[30m",red:"[31m",green:"[32m",yellow:"[33m",blue:"[34m",magenta:"[35m",cyan:"[36m",white:"[37m",brightBlack:"[90m",brightRed:"[91m",brightGreen:"[92m",brightYellow:"[93m",brightBlue:"[94m",brightMagenta:"[95m",brightCyan:"[96m",brightWhite:"[97m"}},{}],40:[function(e,t,r){"use strict";r.regExp=r.regExpPattern=function s(e){return e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")};r.regExpReplacement=function o(e){return e.replace(/\$/g,"$$$$")};r.format=function a(e){return e.replace(/%/g,"%%")};r.shellArg=function l(e){return"'"+e.replace(/\'/g,"'\\''")+"'"};var n={"\r":"\\r","\n":"\\n"," ":"\\t","":"\\x7f"};r.control=function u(e){return e.replace(/[\x00-\x1f\x7f]/g,function(e){if(n[e]!==undefined){return n[e]}var t=e.charCodeAt(0).toString(16);if(t.length%2){t="0"+t}return"\\x"+t})};var i={"&":"&","<":"<",">":">",'"':""","'":"'"};r.html=function c(e){return e.replace(/[&<>]/g,function(e){return i[e]})};r.htmlAttr=function f(e){return e.replace(/[&<>"]/g,function(e){return i[e]})};r.htmlSpecialChars=function p(e){return e.replace(/[&<>"']/g,function(e){return i[e]})}},{}],41:[function(e,t,r){(function(t,n){"use strict";var i=e("tree-kit/lib/extend.js");var s=e("./escape.js");var o=e("./ansi.js");function a(e,t){if(arguments.length<2){t=e;e={}}else if(!e||typeof e!=="object"){e={}}var r={depth:0,ancestors:[]};if(!e.style){e.style=h.none}else if(typeof e.style==="string"){e.style=h[e.style]}if(e.depth===undefined){e.depth=3}if(e.nofunc){e.noFunc=true}if(e.minimal){e.noFunc=true;e.noDescriptor=true;e.noType=true;e.enumOnly=true;e.funcDetails=false;e.proto=false}return l(r,e,t)}function l(e,r,n){var i,o,a,f,p,h,d,g,b,y,m,v,x="",w="",k="",_,T;d=typeof n;b=r.style.tab.repeat(e.depth);if(d==="function"&&r.noFunc){return""}if(e.key!==undefined){if(e.descriptor){k=[];if(!e.descriptor.configurable){k.push("-conf")}if(!e.descriptor.enumerable){k.push("-enum")}if(!e.descriptor.writable){k.push("-w")}if(k.length){k=k.join(" ")}else{k=""}}if(e.keyIsProperty){if(u(e.key)){w='"'+r.style.key(e.key)+'": '}else{w=r.style.key(e.key)+": "}}else{w="["+r.style.index(e.key)+"] "}if(k){k=" "+r.style.type(k)}}g=e.noPre?"":b+w;if(n===undefined){x+=g+r.style.constant("undefined")+k+r.style.nl}else if(n===null){x+=g+r.style.constant("null")+k+r.style.nl}else if(n===false){x+=g+r.style.constant("false")+k+r.style.nl}else if(n===true){x+=g+r.style.constant("true")+k+r.style.nl}else if(d==="number"){x+=g+r.style.number(n.toString())+(r.noType?"":" "+r.style.type("number"))+k+r.style.nl}else if(d==="string"){x+=g+'"'+r.style.string(s.control(n))+'" '+(r.noType?"":r.style.type("string")+r.style.length("("+n.length+")"))+k+r.style.nl}else if(t.isBuffer(n)){x+=g+r.style.inspect(n.inspect())+" "+(r.noType?"":r.style.type("Buffer")+r.style.length("("+n.length+")"))+k+r.style.nl}else if(d==="object"||d==="function"){o=a="";m=false;if(d==="function"){m=true;o=" "+r.style.funcName(n.name?n.name:"(anonymous)");a=r.style.length("("+n.length+")")}y=false;if(Array.isArray(n)){y=true;a=r.style.length("("+n.length+")")}if(!n.constructor){p="(no constructor)"}else if(!n.constructor.name){p="(anonymous)"}else{p=n.constructor.name}p=r.style.constructorName(p);x+=g;if(!r.noType){if(e.forceType){x+=r.style.type(e.forceType)}else{x+=p+o+a+" "+r.style.type(d)+k}if(!m||r.funcDetails){x+=" "}}f=Object.getOwnPropertyNames(n);if(r.sort){f.sort()}v=c(n);if(v!==undefined){x+="=> "+l({depth:e.depth,ancestors:e.ancestors,noPre:true},r,v)}else if(m&&!r.funcDetails){x+=r.style.nl}else if(!f.length&&!r.proto){x+="{}"+r.style.nl}else if(e.depth>=r.depth){x+=r.style.limit("[depth limit]")+r.style.nl}else if(e.ancestors.indexOf(n)!==-1){x+=r.style.limit("[circular]")+r.style.nl}else{x+=(y&&r.noType?"[":"{")+r.style.nl;T=e.ancestors.slice();T.push(n);for(i=0;i<f.length;i++){try{_=Object.getOwnPropertyDescriptor(n,f[i]);if(!_.enumerable&&r.enumOnly){continue}h=!y||!_.enumerable||isNaN(f[i]);if(!r.noDescriptor&&(_.get||_.set)){x+=l({depth:e.depth+1,ancestors:T,key:f[i],keyIsProperty:h,descriptor:_,forceType:"getter/setter"},r,{get:_.get,set:_.set})}else{x+=l({depth:e.depth+1,ancestors:T,key:f[i],keyIsProperty:h,descriptor:r.noDescriptor?undefined:_},r,n[f[i]])}}catch(j){x+=l({depth:e.depth+1,ancestors:T,key:f[i],keyIsProperty:h,descriptor:r.noDescriptor?undefined:_},r,j)}}if(r.proto){x+=l({depth:e.depth+1,ancestors:T,key:"__proto__",keyIsProperty:true},r,n.__proto__)}x+=b+(y&&r.noType?"]":"}")+r.style.nl}}if(e.depth===0){if(r.style==="html"){x=s.html(x)}}return x}r.inspect=a;function u(e){if(!e.length){return true}return false}function c(e){switch(e.constructor.name){case"Date":if(e instanceof Date){return e.toString()+" ["+e.getTime()+"]"}break;case"Set":if(typeof Set==="function"&&e instanceof Set){return Array.from(e)}break;case"Map":if(typeof Map==="function"&&e instanceof Map){return Array.from(e)}break;case"ObjectID":if(e._bsontype){return e.toString();
}break}return}function f(e,t){var r="",n,i,s;if(arguments.length<2){t=e;e={}}else if(!e||typeof e!=="object"){e={}}if(!(t instanceof Error)){return}if(!e.style){e.style=h.none}else if(typeof e.style==="string"){e.style=h[e.style]}if(t.stack){n=p(e,t.stack)}i=t.type||t.constructor.name;s=t.code||t.name||t.errno||t.number;r+=e.style.errorType(i)+(s?" ["+e.style.errorType(s)+"]":"")+": ";r+=e.style.errorMessage(t.message)+"\n";if(n){r+=e.style.errorStack(n)+"\n"}return r}r.inspectError=f;function p(e,t){if(arguments.length<2){t=e;e={}}else if(!e||typeof e!=="object"){e={}}if(!e.style){e.style=h.none}else if(typeof e.style==="string"){e.style=h[e.style]}if(!t){return}if((e.browser||n.browser)&&t.indexOf("@")!==-1){t=t.replace(/[<\/]*(?=@)/g,"").replace(/^\s*([^@]*)\s*@\s*([^\n]*)(?::([0-9]+):([0-9]+))?$/gm,function(t,r,n,i,s){return e.style.errorStack(" at ")+(r?e.style.errorStackMethod(r)+" ":"")+e.style.errorStack("(")+(n?e.style.errorStackFile(n):e.style.errorStack("unknown"))+(i?e.style.errorStack(":")+e.style.errorStackLine(i):"")+(s?e.style.errorStack(":")+e.style.errorStackColumn(s):"")+e.style.errorStack(")")})}else{t=t.replace(/^[^\n]*\n/,"");t=t.replace(/^\s*(at)\s+(?:([^\s:\(\)\[\]\n]+)\s)?(?:\[as ([^\s:\(\)\[\]\n]+)\]\s)?(?:\(?([^:\(\)\[\]\n]+):([0-9]+):([0-9]+)\)?)?$/gm,function(t,r,n,i,s,o,a){return e.style.errorStack(" at ")+(n?e.style.errorStackMethod(n)+" ":"")+(i?e.style.errorStack("[as ")+e.style.errorStackMethodAs(i)+e.style.errorStack("] "):"")+e.style.errorStack("(")+(s?e.style.errorStackFile(s):e.style.errorStack("unknown"))+(o?e.style.errorStack(":")+e.style.errorStackLine(o):"")+(a?e.style.errorStack(":")+e.style.errorStackColumn(a):"")+e.style.errorStack(")")})}return t}r.inspectStack=p;var h={};var d=function(e){return e};h.none={tab:" ",nl:"\n",limit:d,type:function(e){return"<"+e+">"},constant:d,funcName:d,constructorName:function(e){return"<"+e+">"},length:d,key:d,index:d,number:d,inspect:d,string:d,errorType:d,errorMessage:d,errorStack:d,errorStackMethod:d,errorStackMethodAs:d,errorStackFile:d,errorStackLine:d,errorStackColumn:d};h.color=i(null,{},h.none,{limit:function(e){return o.bold+o.brightRed+e+o.reset},type:function(e){return o.italic+o.brightBlack+e+o.reset},constant:function(e){return o.cyan+e+o.reset},funcName:function(e){return o.italic+o.magenta+e+o.reset},constructorName:function(e){return o.magenta+e+o.reset},length:function(e){return o.italic+o.brightBlack+e+o.reset},key:function(e){return o.green+e+o.reset},index:function(e){return o.blue+e+o.reset},number:function(e){return o.cyan+e+o.reset},inspect:function(e){return o.cyan+e+o.reset},string:function(e){return o.blue+e+o.reset},errorType:function(e){return o.red+o.bold+e+o.reset},errorMessage:function(e){return o.red+o.italic+e+o.reset},errorStack:function(e){return o.brightBlack+e+o.reset},errorStackMethod:function(e){return o.brightYellow+e+o.reset},errorStackMethodAs:function(e){return o.yellow+e+o.reset},errorStackFile:function(e){return o.brightCyan+e+o.reset},errorStackLine:function(e){return o.blue+e+o.reset},errorStackColumn:function(e){return o.magenta+e+o.reset}});h.html=i(null,{},h.none,{tab:" ",nl:"<br />",limit:function(e){return'<span style="color:red">'+e+"</span>"},type:function(e){return'<i style="color:gray">'+e+"</i>"},constant:function(e){return'<span style="color:cyan">'+e+"</span>"},funcName:function(e){return'<i style="color:magenta">'+e+"</i>"},constructorName:function(e){return'<span style="color:magenta">'+e+"</span>"},length:function(e){return'<i style="color:gray">'+e+"</i>"},key:function(e){return'<span style="color:green">'+e+"</span>"},index:function(e){return'<span style="color:blue">'+e+"</span>"},number:function(e){return'<span style="color:cyan">'+e+"</span>"},inspect:function(e){return'<span style="color:cyan">'+e+"</span>"},string:function(e){return'<span style="color:blue">'+e+"</span>"},errorType:function(e){return'<span style="color:red">'+e+"</span>"},errorMessage:function(e){return'<span style="color:red">'+e+"</span>"},errorStack:function(e){return'<span style="color:gray">'+e+"</span>"},errorStackMethod:function(e){return'<span style="color:yellow">'+e+"</span>"},errorStackMethodAs:function(e){return'<span style="color:yellow">'+e+"</span>"},errorStackFile:function(e){return'<span style="color:cyan">'+e+"</span>"},errorStackLine:function(e){return'<span style="color:blue">'+e+"</span>"},errorStackColumn:function(e){return'<span style="color:gray">'+e+"</span>"}})}).call(this,{isBuffer:e("../../browserify/node_modules/insert-module-globals/node_modules/is-buffer/index.js")},e("_process"))},{"../../browserify/node_modules/insert-module-globals/node_modules/is-buffer/index.js":13,"./ansi.js":39,"./escape.js":40,_process:14,"tree-kit/lib/extend.js":42}],42:[function(e,t,r){"use strict";function n(e,t,r){var i,s,o,a,l,u,c,f,p,h,d,g,b=-1,y=false,m=arguments.length;if(!t||typeof t!=="object"){t={}}if(!e){e={depth:0,prefix:""};if(!t.maxDepth&&t.deep&&!t.circular){t.maxDepth=100}if(t.deepFunc){t.deep=true}if(t.deepFilter&&typeof t.deepFilter==="object"){if(t.deepFilter.whitelist&&(!Array.isArray(t.deepFilter.whitelist)||!t.deepFilter.whitelist.length)){delete t.deepFilter.whitelist}if(t.deepFilter.blacklist&&(!Array.isArray(t.deepFilter.blacklist)||!t.deepFilter.blacklist.length)){delete t.deepFilter.blacklist}if(!t.deepFilter.whitelist&&!t.deepFilter.blacklist){delete t.deepFilter}}if(t.flat){t.deep=true;t.proto=false;t.inherit=false;t.unflat=false;if(typeof t.flat!=="string"){t.flat="."}}if(t.unflat){t.deep=false;t.proto=false;t.inherit=false;t.flat=false;if(typeof t.unflat!=="string"){t.unflat="."}}if(t.inherit){t.own=true;t.proto=false}else if(t.proto){t.own=true}if(!r||typeof r!=="object"&&typeof r!=="function"){y=true}if(!t.skipRoot&&(t.inherit||t.proto)){for(i=m-1;i>=3;i--){a=arguments[i];if(a&&(typeof a==="object"||typeof a==="function")){if(t.inherit){if(y){r=Object.create(a)}else{r.__proto__=a}}else if(t.proto){if(y){r=Object.create(a.__proto__)}else{r.__proto__=a.__proto__}}break}}}else if(y){r={}}e.references={sources:[],targets:[]}}if(t.maxDepth&&e.depth>t.maxDepth){throw new Error("[tree] extend(): max depth reached("+t.maxDepth+")")}for(i=3;i<m;i++){a=arguments[i];if(!a||typeof a!=="object"&&typeof a!=="function"){continue}if(t.circular){e.references.sources.push(a);e.references.targets.push(r)}if(t.own){if(t.nonEnum){l=Object.getOwnPropertyNames(a)}else{l=Object.keys(a)}}else{l=a}for(u in l){if(t.own){u=l[u]}if(t.descriptor){p=Object.getOwnPropertyDescriptor(a,u);c=p.value}else{c=a[u]}d=r;h=e.prefix+u;if(t.nofunc&&typeof c==="function"){continue}if(t.unflat&&e.depth===0){g=u.split(t.unflat);o=g.length-1;if(o){for(s=0;s<o;s++){if(!d[g[s]]||typeof d[g[s]]!=="object"&&typeof d[g[s]]!=="function"){d[g[s]]={}}d=d[g[s]]}h=e.prefix+g[o]}}if(t.deep&&c&&(typeof c==="object"||t.deepFunc&&typeof c==="function")&&(!t.descriptor||!p.get)&&(!t.deepFilter||(!t.deepFilter.whitelist||t.deepFilter.whitelist.indexOf(c.__proto__)!==-1)&&(!t.deepFilter.blacklist||t.deepFilter.blacklist.indexOf(c.__proto__)===-1))){if(t.circular){b=e.references.sources.indexOf(c)}if(t.flat){if(b>=0){continue}n({depth:e.depth+1,prefix:e.prefix+u+t.flat,references:e.references},t,d,c)}else{if(b>=0){if(t.descriptor){Object.defineProperty(d,h,{value:e.references.targets[b],enumerable:p.enumerable,writable:p.writable,configurable:p.configurable})}else{d[h]=e.references.targets[b]}continue}if(!d[h]||!d.hasOwnProperty(h)||typeof d[h]!=="object"&&typeof d[h]!=="function"){if(Array.isArray(c)){f=[]}else if(t.proto){f=Object.create(c.__proto__)}else if(t.inherit){f=Object.create(c)}else{f={}}if(t.descriptor){Object.defineProperty(d,h,{value:f,enumerable:p.enumerable,writable:p.writable,configurable:p.configurable})}else{d[h]=f}}else if(t.proto&&d[h].__proto__!==c.__proto__){d[h].__proto__=c.__proto__}else if(t.inherit&&d[h].__proto__!==c){d[h].__proto__=c}if(t.circular){e.references.sources.push(c);e.references.targets.push(d[h])}n({depth:e.depth+1,prefix:"",references:e.references},t,d[h],c)}}else if(t.preserve&&d[h]!==undefined){continue}else if(!t.inherit){if(t.descriptor){Object.defineProperty(d,h,p)}else{d[h]=c}}if(t.move){delete a[u]}}}return r}t.exports=n.bind(undefined,null)},{}]},{},[4])(4)});