UNPKG

jsforce

Version:

Salesforce API Library for JavaScript

3 lines 134 kB
/*! jsforce - v1.3.0 - 2014-09-15 */ !function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self);var c=b;c=c.jsforce||(c.jsforce={}),c=c.modules||(c.modules={}),c=c.api||(c.api={}),c.Metadata=a()}}(function(){var a;return function b(a,c,d){function e(g,h){if(!c[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};a[g][0].call(k.exports,function(b){var c=a[g][1][b];return e(c?c:b)},k,k.exports,b,a,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){(function(c,d){function e(a){var b=k.clone(a);return b.success="true"===b.success,b}function f(a){var b=k.clone(a);return delete b.$,b}var g=jsforce.require("util"),h=jsforce.require("events"),i=jsforce.require("stream"),j=i.Stream,k=jsforce.require("underscore"),l=a("../promise"),m=a("../soap"),n=b.exports=function(a){this._conn=a};n.prototype.pollInterval=1e3,n.prototype.pollTimeout=1e4,n.prototype._invoke=function(a,b,c){var d=new m({sessionId:this._conn.accessToken,serverUrl:this._conn.instanceUrl+"/services/Soap/m/"+this._conn.version,xmlns:"http://soap.sforce.com/2006/04/metadata"},this._conn._transport);return d.invoke(a,b).then(function(a){return a.result}).thenCall(c)},n.prototype.createAsync=function(a,b,c){if(Number(this._conn.version)>30)throw new Error("Async metadata CRUD calls are not supported on ver 31.0 or later.");var d=function(b){return b["@xsi:type"]=a,b},e=k.isArray(b);b=e?k.map(b,d):d(b);var f=this._invoke("create",{metadata:b});return new o(this,f,e).thenCall(c)},n.prototype.createSync=n.prototype.create=function(a,b,c){var d=function(b){return b["@xsi:type"]=a,b},f=k.isArray(b);return b=f?k.map(b,d):d(b),this._invoke("createMetadata",{metadata:b}).then(function(a){return k.isArray(a)?k.map(a,e):e(a)}).thenCall(c)},n.prototype.readSync=n.prototype.read=function(a,b,c){return this._invoke("readMetadata",{type:a,fullNames:b}).then(function(a){return k.isArray(a.records)?k.map(a.records,f):f(a.records)}).thenCall(c)},n.prototype.updateAsync=function(a,b,c){if(Number(this._conn.version)>30)throw new Error("Async metadata CRUD calls are not supported on ver 31.0 or later.");var d=function(b){return b.metadata["@xsi:type"]=a,b},e=k.isArray(b);b=e?k.map(b,d):d(b);var f=this._invoke("update",{updateMetadata:b});return new o(this,f,e).thenCall(c)},n.prototype.updateSync=n.prototype.update=function(a,b,c){var d=function(b){return b["@xsi:type"]=a,b},f=k.isArray(b);return b=f?k.map(b,d):d(b),this._invoke("updateMetadata",{metadata:b}).then(function(a){return k.isArray(a)?k.map(a,e):e(a)}).thenCall(c)},n.prototype.upsertSync=n.prototype.upsert=function(a,b,c){var d=function(b){return b["@xsi:type"]=a,b},f=k.isArray(b);return b=f?k.map(b,d):d(b),this._invoke("upsertMetadata",{metadata:b}).then(function(a){return k.isArray(a)?k.map(a,e):e(a)}).thenCall(c)},n.prototype.deleteAsync=function(a,b,c){if(Number(this._conn.version)>30)throw new Error("Async metadata CRUD calls are not supported on ver 31.0 or later.");var d=function(b){return k.isString(b)&&(b={fullName:b}),b["@xsi:type"]=a,b},e=k.isArray(b);b=e?k.map(b,d):d(b);var f=this._invoke("delete",{metadata:b});return new o(this,f,e).thenCall(c)},n.prototype.del=n.prototype.deleteSync=n.prototype["delete"]=function(a,b,c){return this._invoke("deleteMetadata",{type:a,fullNames:b}).then(function(a){return k.isArray(a)?k.map(a,e):e(a)}).thenCall(c)},n.prototype.rename=function(a,b,c,d){return this._invoke("renameMetadata",{type:a,oldFullName:b,newFullName:c}).then(function(a){return e(a)}).thenCall(d)},n.prototype.checkStatus=function(a,b){var c=k.isArray(a),d=this._invoke("checkStatus",{asyncProcessId:a});return new o(this,d,c).thenCall(b)},n.prototype.describe=function(a,b){return k.isString(a)||(b=a,a=this._conn.version),this._invoke("describeMetadata",{asOfVersion:a}).then(function(a){return a.metadataObjects=k.isArray(a.metadataObjects)?a.metadataObjects:[a.metadataObjects],a.metadataObjects=k.map(a.metadataObjects,function(a){return a.childXmlNames&&(a.childXmlNames=k.isArray(a.childXmlNames)?a.childXmlNames:[a.childXmlNames]),a.inFolder="true"===a.inFolder,a.metaFile="true"===a.metaFile,a}),a.partialSaveAllowed="true"===a.partialSaveAllowed,a.testRequired="true"===a.testRequired,a}).thenCall(b)},n.prototype.list=function(a,b,c){return k.isString(b)||(c=b,b=this._conn.version),k.isArray(a)||(a=[a]),this._invoke("listMetadata",{queries:a,asOfVersion:b},c)},n.prototype.retrieve=function(a,b){var c=this._invoke("retrieve",{request:a});return new p(this,c).thenCall(b)},n.prototype.checkRetrieveStatus=function(a,b){return this._invoke("checkRetrieveStatus",{asyncProcessId:a},b)},n.prototype.deploy=function(a,b,c){(!b||k.isFunction(b))&&(c=b,b={});var e=l.defer();if(a instanceof j){var f=[];a.on("data",function(a){f.push(a)}),a.on("end",function(){e.resolve(d.concat(f))}),a.resume()}else{if(!(a instanceof d))throw"Unexpected zipInput type";e.resolve(a)}var g=this,h=e.promise.then(function(a){var d=a.toString("base64");return g._invoke("deploy",{ZipFile:d,DeployOptions:b},c)});return new q(this,h).thenCall(c)},n.prototype.checkDeployStatus=function(a,b,c){return k.isObject(b)||k.isBoolean(b)?b=!!b:(c=b,b=!1),this._invoke("checkDeployStatus",{asyncProcessId:a,includeDetails:b}).then(function(a){return a.done="true"===a.done,a.success="true"===a.success,a.checkOnly="true"===a.checkOnly,a.ignoreWarnings&&(a.ignoreWarnings="true"===a.ignoreWarnings),a.rollbackOnError&&(a.rollbackOnError="true"===a.rollbackOnError),a.numberComponentErrors=Number(a.numberComponentErrors),a.numberComponentsDeployed=Number(a.numberComponentsDeployed),a.numberComponentsTotal=Number(a.numberComponentsTotal),a.numberTestErrors=Number(a.numberTestErrors),a.numberTestsCompleted=Number(a.numberTestsCompleted),a.numberTestsTotal=Number(a.numberTestsTotal),a}).thenCall(c)};var o=function(a,b,c){this._meta=a,this._results=b,this._isArray=c};g.inherits(o,h.EventEmitter),o.prototype.then=function(a,b){var c=this;return this._results.then(function(b){var d=function(a){return a.$&&"true"===a.$["xsi:nil"]?null:(a.done="true"===a.done,a)};return b=k.isArray(b)?k.map(b,d):d(b),c._isArray&&!k.isArray(b)&&(b=[b]),a(b)},b)},o.prototype.thenCall=function(a){return k.isFunction(a)?this.then(function(b){c.nextTick(function(){a(null,b)})},function(b){c.nextTick(function(){a(b)})}):this},o.prototype.check=function(a){var b=this._meta;return this.then(function(a){var c=k.isArray(a)?k.map(a,function(a){return a.id}):a.id;return b.checkStatus(c)}).thenCall(a)},o.prototype.poll=function(a,b){var c=this,d=(new Date).getTime(),e=function(){var f=(new Date).getTime();return f>d+b?void c.emit("error",new Error("polling time out")):void c.check().then(function(b){for(var d=!0,f=k.isArray(b)?b:[b],g=0,h=f.length;h>g;g++){var i=f[g];i&&!i.done&&(d=!1)}d?c.emit("complete",b):setTimeout(e,a)},function(a){c.emit("error",a)})};setTimeout(e,a)},o.prototype.complete=function(a){var b=l.defer();this.on("complete",function(a){b.resolve(a)}),this.on("error",function(a){b.reject(a)});var c=this._meta;return this.poll(c.pollInterval,c.pollTimeout),b.promise.thenCall(a)};var p=function(a,b){p.super_.call(this,a,b)};g.inherits(p,o),p.prototype.complete=function(a){var b=this._meta;return p.super_.prototype.complete.call(this).then(function(a){return b.checkRetrieveStatus(a.id)}).thenCall(a)},p.prototype.stream=function(){var a=new j;return a.readable=!0,this.complete(function(b,c){b?a.emit("error",b):(a.emit("data",new d(c.zipFile,"base64")),a.emit("end"))}),a};var q=function(a,b){q.super_.call(this,a,b)};g.inherits(q,o),q.prototype.complete=function(a,b){k.isFunction(a)&&(b=a,a=!1);var c=this._meta;return q.super_.prototype.complete.call(this).then(function(b){return c.checkDeployStatus(b.id,a)}).thenCall(b)}}).call(this,a("_process"),a("buffer").Buffer)},{"../promise":5,"../soap":6,_process:16,buffer:10}],2:[function(a,b){function c(a){var b={};return a.split(/\n/).forEach(function(a){var c=a.split(/\s*:\s*/),d=c[0].toLowerCase(),e=c[1];b[d]=e}),b}var d=jsforce.require("stream"),e=jsforce.require("underscore");b.exports={supported:"object"==typeof Sfdc&&"undefined"!=typeof Sfdc.canvas,createRequest:function(a){return function(b,f){function g(d){var g={client:a.client,method:b.method,data:d};if(b.headers){g.headers={};for(var j in b.headers)"content-type"===j.toLowerCase()?g.contentType=b.headers[j]:g.headers[j]=b.headers[j]}g.success=function(a){var b=c(a.responseHeaders),d=a.payload;e.isString(d)||(d=JSON.stringify(d)),h={statusCode:a.status,headers:b,body:d},f&&f(null,h,h.body),i.end()},g.failure=function(a){f&&f(a)},Sfdc.canvas.client.ajax(b.url,g)}var h,i=new d.Duplex;i._read=function(){h&&i.push(h.body)};var j=[],k=!1;return i._write=function(a,b,c){j.push(a.toString(b)),c()},i.on("finish",function(){k||(g(j.join("")),k=!0)}),(b.body||""===b.body||!/^(put|post|patch)$/i.test(b.method))&&(g(b.body),k=!0),i}}}},{}],3:[function(a,b){var c=0;b.exports={supported:"undefined"!=typeof window,createRequest:function(a,b){return a=a||"callback",b=b||1e4,function(d,e){if("GET"!==d.method.toUpperCase())return e(new Error("JSONP only supports GET request."));var f="_jsforce_jsonpCallback_"+ ++c,g=window,h=d.url;h+=h.indexOf("?")>0?"&":"?",h+=a+"="+f;var i=document.createElement("script");i.type="text/javascript",i.src=h,document.documentElement.appendChild(i);var j=setTimeout(function(){k(),e(new Error("JSONP call time out."))},b);g[f]=function(a){k(),e(null,{statusCode:200,headers:{"content-type":"application/json"},body:JSON.stringify(a)})};var k=function(){clearTimeout(j),document.documentElement.removeChild(i),delete g[f]}}}}},{}],4:[function(a,b){var c=jsforce.require("stream");b.exports=function(a,b){var d=new XMLHttpRequest;if(d.open(a.method,a.url),a.headers)for(var e in a.headers)d.setRequestHeader(e,a.headers[e]);d.setRequestHeader("Accept","*/*");var f,g=new c.Duplex;g._read=function(){f&&g.push(f.body)};var h=[],i=!1;return g._write=function(a,b,c){h.push(a.toString("buffer"===b?"binary":b)),c()},g.on("finish",function(){i||(d.send(h.join("")),i=!0)}),(a.body||""===a.body||!/^(put|post|patch)$/i.test(a.method))&&(d.send(a.body),i=!0),d.onreadystatechange=function(){if(4===d.readyState){var a={"content-type":d.getResponseHeader("content-type")};f={statusCode:d.status,headers:a,body:d.response},f.statusCode||(f.statusCode=400,f.body="Access Declined"),b&&b(null,f,f.body),g.end()}},g}},{}],5:[function(a,b){(function(c){var d=a("q"),e=jsforce.require("underscore")._,f=function(a){this._promise=d(a)};f.prototype.then=function(){return new f(this._promise.then.apply(this._promise,arguments))},f.prototype.thenCall=function(a){return e.isFunction(a)&&this.then(function(b){c.nextTick(function(){a(null,b)})},function(b){c.nextTick(function(){a(b)})}),this},f.prototype.fail=function(){return new f(this._promise.fail.apply(this._promise,arguments))},f.prototype.done=function(){return new f(this._promise.done.apply(this._promise,arguments))},f.when=function(){return new f(d.when.apply(d,arguments))},f.reject=function(a){return new f(d.reject(a))},f.all=function(){return new f(d.all.apply(d,arguments))},f.defer=function(){return new g};var g=function(){this._deferred=d.defer(),this.promise=new f(this._deferred.promise)};g.prototype.resolve=function(){return this._deferred.resolve.apply(this._promise,arguments)},g.prototype.reject=function(){return this._deferred.reject.apply(this._promise,arguments)},b.exports=f}).call(this,a("_process"))},{_process:16,q:19}],6:[function(a,b){function c(a,b){var d=b.shift();if(d){for(var e in a)if(d.test(e))return c(a[e],b);return null}return a}function d(a,b){if(e.isObject(a)&&(b=a,a=null),e.isArray(b))return e.map(b,function(b){return d(a,b)}).join("");var c=[],f=[];if(e.isObject(b)){for(var g in b){var h=b[g];"@"===g[0]?(g=g.substring(1),c.push(g+'="'+h+'"')):f.push(d(g,h))}b=f.join("")}else b=String(b);var i=a?"<"+a+(c.length>0?" "+c.join(" "):"")+">":"",j=a?"</"+a+">":"";return i+b+j}var e=jsforce.require("underscore"),f=a("xml2js"),g=a("./transport"),h=b.exports=function(a,b){this.serverUrl=a.serverUrl,this.sessionId=a.sessionId,this.xmlns=a.xmlns||"urn:partner.soap.sforce.com",this._transport=b,this._transport||(this._transport=a.proxyUrl?new g:new g.ProxyTransport(a.proxyUrl))};h.prototype.invoke=function(a,b,d){var e={};e[a]=b;var g=this._createEnvelope(e);return this._transport.httpRequest({method:"POST",url:this.serverUrl,headers:{"Content-Type":"text/xml",SOAPAction:'""'},body:g}).then(function(a){var b=null;if(f.parseString(a.body,{explicitArray:!1},function(a,c){b=c}),b){var d=c(b,[/:Envelope$/,/:Body$/,/:Fault$/,/faultstring$/]);if(d)throw new Error(d);return c(b,[/:Envelope$/,/:Body$/,/.+/])}throw new Error("invalid response")}).thenCall(d)},h.prototype._createEnvelope=function(a){return['<?xml version="1.0" encoding="UTF-8"?>','<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"',' xmlns:xsd="http://www.w3.org/2001/XMLSchema"',' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">','<soapenv:Header xmlns="'+this.xmlns+'">',"<SessionHeader>","<sessionId>"+this.sessionId+"</sessionId>","</SessionHeader>","</soapenv:Header>",'<soapenv:Body xmlns="'+this.xmlns+'">',d(a),"</soapenv:Body>","</soapenv:Envelope>"].join("")}},{"./transport":7,xml2js:36}],7:[function(a,b){(function(c){function d(a,b){var c=a.then;return a.then=function(){b();var e=c.apply(a,arguments);return d(e,b)},a.stream=b,a}function e(a){var b=/(\w+)\.(visual\.force|salesforce)\.com$/.exec(a);return b&&(a=b[1]+".salesforce.com"),a}var f,g,h=jsforce.require("util"),i=(jsforce.require("stream"),a("./promise")),j=a("request"),k=a("./browser/request"),l=a("./browser/canvas"),m=a("./browser/jsonp");if("undefined"==typeof window){var n={followAllRedirects:!0};c.env.HTTP_PROXY&&(n.proxy=c.env.HTTP_PROXY),c.env.HTTP_TIMEOUT&&(n.timeout=c.env.HTTP_TIMEOUT),f=j.defaults(n),g=c.env.LOCATION_BASE_URL||""}else{f=k;var o=e(window.location.host);g=o?"https://"+o:""}var p=b.exports=function(){};p.prototype.httpRequest=function(a,b,c){var e,g=i.defer(),h=f;c&&c.jsonp&&m.supported?h=m.createRequest(c.jsonp):c&&c.signedRequest&&l.supported&&(h=l.createRequest(c.signedRequest));var j=function(){return e||(e=h(a,function(a,b){a?g.reject(a):g.resolve(b)})),e};return d(g.promise,j).thenCall(b)};var q=p.ProxyTransport=function(a){this._proxyUrl=a};h.inherits(q,p),q.prototype.httpRequest=function(a,b){var c=a.url;0===c.indexOf("/")&&(c=g+c);var d={method:a.method,url:this._proxyUrl+"?"+Date.now()+"."+(""+Math.random()).substring(2),headers:{"salesforceproxy-endpoint":c}};if((a.body||""===a.body)&&(d.body=a.body),a.headers)for(var e in a.headers)d.headers[e]=a.headers[e];return q.super_.prototype.httpRequest.call(this,d,b)}}).call(this,a("_process"))},{"./browser/canvas":2,"./browser/jsonp":3,"./browser/request":4,"./promise":5,_process:16,request:8}],8:[function(){},{}],9:[function(a,b){b.exports=a(8)},{"/Users/stomita/Work/Salesforce/jsforce.publish/node_modules/browserify/lib/_empty.js":8}],10:[function(a,b,c){function d(a,b,c){if(!(this instanceof d))return new d(a,b,c);var e,f=typeof a;if("number"===f)e=a>0?a>>>0:0;else if("string"===f)"base64"===b&&(a=x(a)),e=d.byteLength(a,b);else{if("object"!==f||null===a)throw new TypeError("must start with number, buffer, array or string");"Buffer"===a.type&&J(a.data)&&(a=a.data),e=+a.length>0?Math.floor(+a.length):0}if(this.length>K)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K.toString(16)+" bytes");var g;d.TYPED_ARRAY_SUPPORT?g=d._augment(new Uint8Array(e)):(g=this,g.length=e,g._isBuffer=!0);var h;if(d.TYPED_ARRAY_SUPPORT&&"number"==typeof a.byteLength)g._set(a);else if(z(a))if(d.isBuffer(a))for(h=0;e>h;h++)g[h]=a.readUInt8(h);else for(h=0;e>h;h++)g[h]=(a[h]%256+256)%256;else if("string"===f)g.write(a,0,b);else if("number"===f&&!d.TYPED_ARRAY_SUPPORT&&!c)for(h=0;e>h;h++)g[h]=0;return g}function e(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;if(f%2!==0)throw new Error("Invalid hex string");d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");a[c+g]=h}return g}function f(a,b,c,d){var e=F(B(b),a,c,d);return e}function g(a,b,c,d){var e=F(C(b),a,c,d);return e}function h(a,b,c,d){return g(a,b,c,d)}function i(a,b,c,d){var e=F(E(b),a,c,d);return e}function j(a,b,c,d){var e=F(D(b),a,c,d);return e}function k(a,b,c){return H.fromByteArray(0===b&&c===a.length?a:a.slice(b,c))}function l(a,b,c){var d="",e="";c=Math.min(a.length,c);for(var f=b;c>f;f++)a[f]<=127?(d+=G(e)+String.fromCharCode(a[f]),e=""):e+="%"+a[f].toString(16);return d+G(e)}function m(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function n(a,b,c){return m(a,b,c)}function o(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=A(a[f]);return e}function p(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function q(a,b,c){if(a%1!==0||0>a)throw new RangeError("offset is not uint");if(a+b>c)throw new RangeError("Trying to access beyond buffer length")}function r(a,b,c,e,f,g){if(!d.isBuffer(a))throw new TypeError("buffer must be a Buffer instance");if(b>f||g>b)throw new TypeError("value is out of bounds");if(c+e>a.length)throw new TypeError("index out of range")}function s(a,b,c,d){0>b&&(b=65535+b+1);for(var e=0,f=Math.min(a.length-c,2);f>e;e++)a[c+e]=(b&255<<8*(d?e:1-e))>>>8*(d?e:1-e)}function t(a,b,c,d){0>b&&(b=4294967295+b+1);for(var e=0,f=Math.min(a.length-c,4);f>e;e++)a[c+e]=b>>>8*(d?e:3-e)&255}function u(a,b,c,d,e,f){if(b>e||f>b)throw new TypeError("value is out of bounds");if(c+d>a.length)throw new TypeError("index out of range")}function v(a,b,c,d,e){return e||u(a,b,c,4,3.4028234663852886e38,-3.4028234663852886e38),I.write(a,b,c,d,23,4),c+4}function w(a,b,c,d,e){return e||u(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),I.write(a,b,c,d,52,8),c+8}function x(a){for(a=y(a).replace(M,"");a.length%4!==0;)a+="=";return a}function y(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function z(a){return J(a)||d.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function A(a){return 16>a?"0"+a.toString(16):a.toString(16)}function B(a){for(var b=[],c=0;c<a.length;c++){var d=a.charCodeAt(c);if(127>=d)b.push(d);else{var e=c;d>=55296&&57343>=d&&c++;for(var f=encodeURIComponent(a.slice(e,c+1)).substr(1).split("%"),g=0;g<f.length;g++)b.push(parseInt(f[g],16))}}return b}function C(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function D(a){for(var b,c,d,e=[],f=0;f<a.length;f++)b=a.charCodeAt(f),c=b>>8,d=b%256,e.push(d),e.push(c);return e}function E(a){return H.toByteArray(a)}function F(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}function G(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}var H=a("base64-js"),I=a("ieee754"),J=a("is-array");c.Buffer=d,c.SlowBuffer=d,c.INSPECT_MAX_BYTES=50,d.poolSize=8192;var K=1073741823;d.TYPED_ARRAY_SUPPORT=function(){try{var a=new ArrayBuffer(0),b=new Uint8Array(a);return b.foo=function(){return 42},42===b.foo()&&"function"==typeof b.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(c){return!1}}(),d.isBuffer=function(a){return!(null==a||!a._isBuffer)},d.compare=function(a,b){if(!d.isBuffer(a)||!d.isBuffer(b))throw new TypeError("Arguments must be Buffers");for(var c=a.length,e=b.length,f=0,g=Math.min(c,e);g>f&&a[f]===b[f];f++);return f!==g&&(c=a[f],e=b[f]),e>c?-1:c>e?1:0},d.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.concat=function(a,b){if(!J(a))throw new TypeError("Usage: Buffer.concat(list[, length])");if(0===a.length)return new d(0);if(1===a.length)return a[0];var c;if(void 0===b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var e=new d(b),f=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(e,f),f+=g.length}return e},d.byteLength=function(a,b){var c;switch(a+="",b||"utf8"){case"ascii":case"binary":case"raw":c=a.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":c=2*a.length;break;case"hex":c=a.length>>>1;break;case"utf8":case"utf-8":c=B(a).length;break;case"base64":c=E(a).length;break;default:c=a.length}return c},d.prototype.length=void 0,d.prototype.parent=void 0,d.prototype.toString=function(a,b,c){var d=!1;if(b>>>=0,c=void 0===c||1/0===c?this.length:c>>>0,a||(a="utf8"),0>b&&(b=0),c>this.length&&(c=this.length),b>=c)return"";for(;;)switch(a){case"hex":return o(this,b,c);case"utf8":case"utf-8":return l(this,b,c);case"ascii":return m(this,b,c);case"binary":return n(this,b,c);case"base64":return k(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return p(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}},d.prototype.equals=function(a){if(!d.isBuffer(a))throw new TypeError("Argument must be a Buffer");return 0===d.compare(this,a)},d.prototype.inspect=function(){var a="",b=c.INSPECT_MAX_BYTES;return this.length>0&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... ")),"<Buffer "+a+">"},d.prototype.compare=function(a){if(!d.isBuffer(a))throw new TypeError("Argument must be a Buffer");return d.compare(this,a)},d.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},d.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var k=d;d=b,b=c,c=k}b=Number(b)||0;var l=this.length-b;c?(c=Number(c),c>l&&(c=l)):c=l,d=String(d||"utf8").toLowerCase();var m;switch(d){case"hex":m=e(this,a,b,c);break;case"utf8":case"utf-8":m=f(this,a,b,c);break;case"ascii":m=g(this,a,b,c);break;case"binary":m=h(this,a,b,c);break;case"base64":m=i(this,a,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":m=j(this,a,b,c);break;default:throw new TypeError("Unknown encoding: "+d)}return m},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},d.prototype.slice=function(a,b){var c=this.length;if(a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a),d.TYPED_ARRAY_SUPPORT)return d._augment(this.subarray(a,b));for(var e=b-a,f=new d(e,void 0,!0),g=0;e>g;g++)f[g]=this[g+a];return f},d.prototype.readUInt8=function(a,b){return b||q(a,1,this.length),this[a]},d.prototype.readUInt16LE=function(a,b){return b||q(a,2,this.length),this[a]|this[a+1]<<8},d.prototype.readUInt16BE=function(a,b){return b||q(a,2,this.length),this[a]<<8|this[a+1]},d.prototype.readUInt32LE=function(a,b){return b||q(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]},d.prototype.readUInt32BE=function(a,b){return b||q(a,4,this.length),16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])},d.prototype.readInt8=function(a,b){return b||q(a,1,this.length),128&this[a]?-1*(255-this[a]+1):this[a]},d.prototype.readInt16LE=function(a,b){b||q(a,2,this.length);var c=this[a]|this[a+1]<<8;return 32768&c?4294901760|c:c},d.prototype.readInt16BE=function(a,b){b||q(a,2,this.length);var c=this[a+1]|this[a]<<8;return 32768&c?4294901760|c:c},d.prototype.readInt32LE=function(a,b){return b||q(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},d.prototype.readInt32BE=function(a,b){return b||q(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},d.prototype.readFloatLE=function(a,b){return b||q(a,4,this.length),I.read(this,a,!0,23,4)},d.prototype.readFloatBE=function(a,b){return b||q(a,4,this.length),I.read(this,a,!1,23,4)},d.prototype.readDoubleLE=function(a,b){return b||q(a,8,this.length),I.read(this,a,!0,52,8)},d.prototype.readDoubleBE=function(a,b){return b||q(a,8,this.length),I.read(this,a,!1,52,8)},d.prototype.writeUInt8=function(a,b,c){return a=+a,b>>>=0,c||r(this,a,b,1,255,0),d.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),this[b]=a,b+1},d.prototype.writeUInt16LE=function(a,b,c){return a=+a,b>>>=0,c||r(this,a,b,2,65535,0),d.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8):s(this,a,b,!0),b+2},d.prototype.writeUInt16BE=function(a,b,c){return a=+a,b>>>=0,c||r(this,a,b,2,65535,0),d.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a):s(this,a,b,!1),b+2},d.prototype.writeUInt32LE=function(a,b,c){return a=+a,b>>>=0,c||r(this,a,b,4,4294967295,0),d.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=a):t(this,a,b,!0),b+4},d.prototype.writeUInt32BE=function(a,b,c){return a=+a,b>>>=0,c||r(this,a,b,4,4294967295,0),d.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a):t(this,a,b,!1),b+4},d.prototype.writeInt8=function(a,b,c){return a=+a,b>>>=0,c||r(this,a,b,1,127,-128),d.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),0>a&&(a=255+a+1),this[b]=a,b+1},d.prototype.writeInt16LE=function(a,b,c){return a=+a,b>>>=0,c||r(this,a,b,2,32767,-32768),d.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8):s(this,a,b,!0),b+2},d.prototype.writeInt16BE=function(a,b,c){return a=+a,b>>>=0,c||r(this,a,b,2,32767,-32768),d.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a):s(this,a,b,!1),b+2},d.prototype.writeInt32LE=function(a,b,c){return a=+a,b>>>=0,c||r(this,a,b,4,2147483647,-2147483648),d.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):t(this,a,b,!0),b+4},d.prototype.writeInt32BE=function(a,b,c){return a=+a,b>>>=0,c||r(this,a,b,4,2147483647,-2147483648),0>a&&(a=4294967295+a+1),d.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a):t(this,a,b,!1),b+4},d.prototype.writeFloatLE=function(a,b,c){return v(this,a,b,!0,c)},d.prototype.writeFloatBE=function(a,b,c){return v(this,a,b,!1,c)},d.prototype.writeDoubleLE=function(a,b,c){return w(this,a,b,!0,c)},d.prototype.writeDoubleBE=function(a,b,c){return w(this,a,b,!1,c)},d.prototype.copy=function(a,b,c,e){var f=this;if(c||(c=0),e||0===e||(e=this.length),b||(b=0),e!==c&&0!==a.length&&0!==f.length){if(c>e)throw new TypeError("sourceEnd < sourceStart");if(0>b||b>=a.length)throw new TypeError("targetStart out of bounds");if(0>c||c>=f.length)throw new TypeError("sourceStart out of bounds");if(0>e||e>f.length)throw new TypeError("sourceEnd out of bounds");e>this.length&&(e=this.length),a.length-b<e-c&&(e=a.length-b+c);var g=e-c;if(100>g||!d.TYPED_ARRAY_SUPPORT)for(var h=0;g>h;h++)a[h+b]=this[h+c];else a._set(this.subarray(c,c+g),b)}},d.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),b>c)throw new TypeError("end < start");if(c!==b&&0!==this.length){if(0>b||b>=this.length)throw new TypeError("start out of bounds");if(0>c||c>this.length)throw new TypeError("end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=B(a.toString()),f=e.length;for(d=b;c>d;d++)this[d]=e[d%f]}return this}},d.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(d.TYPED_ARRAY_SUPPORT)return new d(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var L=d.prototype;d._augment=function(a){return a._isBuffer=!0,a._get=a.get,a._set=a.set,a.get=L.get,a.set=L.set,a.write=L.write,a.toString=L.toString,a.toLocaleString=L.toString,a.toJSON=L.toJSON,a.equals=L.equals,a.compare=L.compare,a.copy=L.copy,a.slice=L.slice,a.readUInt8=L.readUInt8,a.readUInt16LE=L.readUInt16LE,a.readUInt16BE=L.readUInt16BE,a.readUInt32LE=L.readUInt32LE,a.readUInt32BE=L.readUInt32BE,a.readInt8=L.readInt8,a.readInt16LE=L.readInt16LE,a.readInt16BE=L.readInt16BE,a.readInt32LE=L.readInt32LE,a.readInt32BE=L.readInt32BE,a.readFloatLE=L.readFloatLE,a.readFloatBE=L.readFloatBE,a.readDoubleLE=L.readDoubleLE,a.readDoubleBE=L.readDoubleBE,a.writeUInt8=L.writeUInt8,a.writeUInt16LE=L.writeUInt16LE,a.writeUInt16BE=L.writeUInt16BE,a.writeUInt32LE=L.writeUInt32LE,a.writeUInt32BE=L.writeUInt32BE,a.writeInt8=L.writeInt8,a.writeInt16LE=L.writeInt16LE,a.writeInt16BE=L.writeInt16BE,a.writeInt32LE=L.writeInt32LE,a.writeInt32BE=L.writeInt32BE,a.writeFloatLE=L.writeFloatLE,a.writeFloatBE=L.writeFloatBE,a.writeDoubleLE=L.writeDoubleLE,a.writeDoubleBE=L.writeDoubleBE,a.fill=L.fill,a.inspect=L.inspect,a.toArrayBuffer=L.toArrayBuffer,a};var M=/[^+\/0-9A-z]/g},{"base64-js":11,ieee754:12,"is-array":13}],11:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g?62:b===h?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],12:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],13:[function(a,b){var c=Array.isArray,d=Object.prototype.toString;b.exports=c||function(a){return!!a&&"[object Array]"==d.call(a)}},{}],14:[function(a,b){function c(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function d(a){return"function"==typeof a}function e(a){return"number"==typeof a}function f(a){return"object"==typeof a&&null!==a}function g(a){return void 0===a}b.exports=c,c.EventEmitter=c,c.prototype._events=void 0,c.prototype._maxListeners=void 0,c.defaultMaxListeners=10,c.prototype.setMaxListeners=function(a){if(!e(a)||0>a||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this},c.prototype.emit=function(a){var b,c,e,h,i,j;if(this._events||(this._events={}),"error"===a&&(!this._events.error||f(this._events.error)&&!this._events.error.length)){if(b=arguments[1],b instanceof Error)throw b; throw TypeError('Uncaught, unspecified "error" event.')}if(c=this._events[a],g(c))return!1;if(d(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(e=arguments.length,h=new Array(e-1),i=1;e>i;i++)h[i-1]=arguments[i];c.apply(this,h)}else if(f(c)){for(e=arguments.length,h=new Array(e-1),i=1;e>i;i++)h[i-1]=arguments[i];for(j=c.slice(),e=j.length,i=0;e>i;i++)j[i].apply(this,h)}return!0},c.prototype.addListener=function(a,b){var e;if(!d(b))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,d(b.listener)?b.listener:b),this._events[a]?f(this._events[a])?this._events[a].push(b):this._events[a]=[this._events[a],b]:this._events[a]=b,f(this._events[a])&&!this._events[a].warned){var e;e=g(this._maxListeners)?c.defaultMaxListeners:this._maxListeners,e&&e>0&&this._events[a].length>e&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),"function"==typeof console.trace&&console.trace())}return this},c.prototype.on=c.prototype.addListener,c.prototype.once=function(a,b){function c(){this.removeListener(a,c),e||(e=!0,b.apply(this,arguments))}if(!d(b))throw TypeError("listener must be a function");var e=!1;return c.listener=b,this.on(a,c),this},c.prototype.removeListener=function(a,b){var c,e,g,h;if(!d(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],g=c.length,e=-1,c===b||d(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(f(c)){for(h=g;h-->0;)if(c[h]===b||c[h].listener&&c[h].listener===b){e=h;break}if(0>e)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(e,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},c.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],d(c))this.removeListener(a,c);else for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},c.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?d(this._events[a])?[this._events[a]]:this._events[a].slice():[]},c.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?d(a._events[b])?1:a._events[b].length:0}},{}],15:[function(a,b){b.exports="function"==typeof Object.create?function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],16:[function(a,b){function c(){}var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],17:[function(a,b){function c(){d.call(this)}b.exports=c;var d=a("events").EventEmitter,e=a("inherits");e(c,d),c.Readable=a("readable-stream/readable.js"),c.Writable=a("readable-stream/writable.js"),c.Duplex=a("readable-stream/duplex.js"),c.Transform=a("readable-stream/transform.js"),c.PassThrough=a("readable-stream/passthrough.js"),c.Stream=c,c.prototype.pipe=function(a,b){function c(b){a.writable&&!1===a.write(b)&&j.pause&&j.pause()}function e(){j.readable&&j.resume&&j.resume()}function f(){k||(k=!0,a.end())}function g(){k||(k=!0,"function"==typeof a.destroy&&a.destroy())}function h(a){if(i(),0===d.listenerCount(this,"error"))throw a}function i(){j.removeListener("data",c),a.removeListener("drain",e),j.removeListener("end",f),j.removeListener("close",g),j.removeListener("error",h),a.removeListener("error",h),j.removeListener("end",i),j.removeListener("close",i),a.removeListener("close",i)}var j=this;j.on("data",c),a.on("drain",e),a._isStdio||b&&b.end===!1||(j.on("end",f),j.on("close",g));var k=!1;return j.on("error",h),a.on("error",h),j.on("end",i),j.on("close",i),a.on("close",i),a.emit("pipe",j),a}},{events:14,inherits:15,"readable-stream/duplex.js":20,"readable-stream/passthrough.js":30,"readable-stream/readable.js":31,"readable-stream/transform.js":32,"readable-stream/writable.js":33}],18:[function(a,b,c){function d(a){if(a&&!h.isEncoding(a))throw new Error("Unknown encoding: "+a)}function e(a){return a.toString(this.encoding)}function f(a){var b=this.charReceived=a.length%2;return this.charLength=b?2:0,b}function g(a){var b=this.charReceived=a.length%3;return this.charLength=b?3:0,b}var h=a("buffer").Buffer,i=c.StringDecoder=function(a){switch(this.encoding=(a||"utf8").toLowerCase().replace(/[-_]/,""),d(a),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=f;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=g;break;default:return void(this.write=e)}this.charBuffer=new h(6),this.charReceived=0,this.charLength=0};i.prototype.write=function(a){for(var b="",c=0;this.charLength;){var d=a.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:a.length;if(a.copy(this.charBuffer,this.charReceived,c,d),this.charReceived+=d-c,c=d,this.charReceived<this.charLength)return"";b=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var e=b.charCodeAt(b.length-1);if(!(e>=55296&&56319>=e)){if(this.charReceived=this.charLength=0,d==a.length)return b;a=a.slice(d,a.length);break}this.charLength+=this.surrogateSize,b=""}var f=this.detectIncompleteChar(a),g=a.length;this.charLength&&(a.copy(this.charBuffer,0,a.length-f,g),this.charReceived=f,g-=f),b+=a.toString(this.encoding,0,g);var g=b.length-1,e=b.charCodeAt(g);if(e>=55296&&56319>=e){var h=this.surrogateSize;return this.charLength+=h,this.charReceived+=h,this.charBuffer.copy(this.charBuffer,h,0,h),this.charBuffer.write(b.charAt(b.length-1),this.encoding),b.substring(0,g)}return b},i.prototype.detectIncompleteChar=function(a){for(var b=a.length>=3?3:a.length;b>0;b--){var c=a[a.length-b];if(1==b&&c>>5==6){this.charLength=2;break}if(2>=b&&c>>4==14){this.charLength=3;break}if(3>=b&&c>>3==30){this.charLength=4;break}}return b},i.prototype.end=function(a){var b="";if(a&&a.length&&(b=this.write(a)),this.charReceived){var c=this.charReceived,d=this.charBuffer,e=this.encoding;b+=d.slice(0,c).toString(e)}return b}},{buffer:10}],19:[function(b,c,d){(function(b){!function(b){if("function"==typeof bootstrap)bootstrap("promise",b);else if("object"==typeof d)c.exports=b();else if("function"==typeof a&&a.amd)a(b);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeQ=b}else Q=b()}(function(){"use strict";function a(a){return function(){return Y.apply(a,arguments)}}function c(a){return a===Object(a)}function d(a){return"[object StopIteration]"===eb(a)||a instanceof U}function e(a,b){if(R&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(gb)){for(var c=[],d=b;d;d=d.source)d.stack&&c.unshift(d.stack);c.unshift(a.stack);var e=c.join("\n"+gb+"\n");a.stack=f(e)}}function f(a){for(var b=a.split("\n"),c=[],d=0;d<b.length;++d){var e=b[d];i(e)||g(e)||!e||c.push(e)}return c.join("\n")}function g(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function h(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function i(a){var b=h(a);if(!b)return!1;var c=b[0],d=b[1];return c===T&&d>=V&&lb>=d}function j(){if(R)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=h(c);if(!d)return;return T=d[0],d[1]}}function k(a,b,c){return function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(b+" is deprecated, use "+c+" instead.",new Error("").stack),a.apply(a,arguments)}}function l(a){return s(a)?a:t(a)?E(a):D(a)}function m(){function a(a){b=a,f.source=a,$(c,function(b,c){X(function(){a.promiseDispatch.apply(a,c)})},void 0),c=void 0,d=void 0}var b,c=[],d=[],e=bb(m.prototype),f=bb(p.prototype);if(f.promiseDispatch=function(a,e,f){var g=Z(arguments);c?(c.push(g),"when"===e&&f[1]&&d.push(f[1])):X(function(){b.promiseDispatch.apply(b,g)})},f.valueOf=k(function(){if(c)return f;var a=r(b);return s(a)&&(b=a),a},"valueOf","inspect"),f.inspect=function(){return b?b.inspect():{state:"pending"}},l.longStackSupport&&R)try{throw new Error}catch(g){f.stack=g.stack.substring(g.stack.indexOf("\n")+1)}return e.promise=f,e.resolve=function(c){b||a(l(c))},e.fulfill=function(c){b||a(D(c))},e.reject=function(c){b||a(C(c))},e.notify=function(a){b||$(d,function(b,c){X(function(){c(a)})},void 0)},e}function n(a){if("function"!=typeof a)throw new TypeError("resolver must be a function.");var b=m();try{a(b.resolve,b.reject,b.notify)}catch(c){b.reject(c)}return b.promise}function o(a){return n(function(b,c){for(var d=0,e=a.length;e>d;d++)l(a[d]).then(b,c)})}function p(a,b,c){void 0===b&&(b=function(a){return C(new Error("Promise does not support operation: "+a))}),void 0===c&&(c=function(){return{state:"unknown"}});var d=bb(p.prototype);if(d.promiseDispatch=function(c,e,f){var g;try{g=a[e]?a[e].apply(d,f):b.call(d,e,f)}catch(h){g=C(h)}c&&c(g)},d.inspect=c,c){var e=c();"rejected"===e.state&&(d.exception=e.reason),d.valueOf=k(function(){var a=c();return"pending"===a.state||"rejected"===a.state?d:a.value})}return d}function q(a,b,c,d){return l(a).then(b,c,d)}function r(a){if(s(a)){var b=a.inspect();if("fulfilled"===b.state)return b.value}return a}function s(a){return c(a)&&"function"==typeof a.promiseDispatch&&"function"==typeof a.inspect}function t(a){return c(a)&&"function"==typeof a.then}function u(a){return s(a)&&"pending"===a.inspect().state}function v(a){return!s(a)||"fulfilled"===a.inspect().state}function w(a){return s(a)&&"rejected"===a.inspect().state}function x(){jb||"undefined"==typeof window||window.Touch||!window.console||console.warn("[Q] Unhandled rejection reasons (should be empty):",hb),jb=!0}function y(){for(var a=0;a<hb.length;a++){var b=hb[a];console.warn("Unhandled rejection reason:",b)}}function z(){hb.length=0,ib.length=0,jb=!1,kb||(kb=!0,"undefined"!=typeof b&&b.on&&b.on("exit",y))}function A(a,b){kb&&(ib.push(a),hb.push(b&&"undefined"!=typeof b.stack?b.stack:"(no stack) "+b),x())}function B(a){if(kb){var b=_(ib,a);-1!==b&&(ib.splice(b,1),hb.splice(b,1))}}function C(a){var b=p({when:function(b){return b&&B(this),b?b(a):this}},function(){return this},function(){return{state:"rejected",reason:a}});return A(b,a),b}function D(a){return p({when:function(){return a},get:function(b){return a[b]},set:function(b,c){a[b]=c},"delete":function(b){delete a[b]},post:function(b,c){return null===b||void 0===b?a.apply(void 0,c):a[b].apply(a,c)},apply:function(b,c){return a.apply(b,c)},keys:function(){return db(a)}},void 0,function(){return{state:"fulfilled",value:a}})}function E(a){var b=m();return X(function(){try{a.then(b.resolve,b.reject,b.notify)}catch(c){b.reject(c)}}),b.promise}function F(a){return p({isDef:function(){}},function(b,c){return L(a,b,c)},function(){return l(a).inspect()})}function G(a,b,c){return l(a).spread(b,c)}function H(a){return function(){function b(a,b){var g;if(fb){try{g=c[a](b)}catch(h){return C(h)}return g.done?g.value:q(g.value,e,f)}try{g=c[a](b)}catch(h){return d(h)?h.value:C(h)}return q(g,e,f)}var c=a.apply(this,arguments),e=b.bind(b,"next"),f=b.bind(b,"throw");return e()}}function I(a){l.done(l.async(a)())}function J(a){throw new U(a)}function K(a){return function(){return G([this,M(arguments)],function(b,c){return a.apply(b,c)})}}function L(a,b,c){return l(a).dispatch(b,c)}function M(a){return q(a,function(a){var b=0,c=m();return $(a,function(d,e,f){var g;s(e)&&"fulfilled"===(g=e.inspect()).state?a[f]=g.value:(++b,q(e,function(d){a[f]=d,0===--b&&c.resolve(a)},c.reject,function(a){c.notify({index:f,value:a})}))},void 0),0===b&&c.resolve(a),c.promise})}function N(a){return q(a,function(a){return a=ab(a,l),q(M(ab(a,function(a){return q(a,W,W)})),function(){return a})})}function O(a){return l(a).allSettled()}function P(a,b){return l(a).then(void 0,void 0,b)}function Q(a,b){return l(a).nodeify(b)}var R=!1;try{throw new Error}catch(S){R=!!S.stack}var T,U,V=j(),W=function(){},X=function(){function a(){for(;c.next;){c=c.next;var b=c.task;c.task=void 0;var d=c.domain;d&&(c.domain=void 0,d.enter());try{b()}catch(f){if(g)throw d&&d.exit(),setTimeout(a,0),d&&d.enter(),f;setTimeout(function(){throw f},0)}d&&d.exit()}e=!1}var c={task:void 0,next:null},d=c,e=!1,f=void 0,g=!1;if(X=function(a){d=d.next={task:a,domain:g&&b.domain,next:null},e||(e=!0,f())},"undefined"!=typeof b&&b.nextTick)g=!0,f=function(){b.nextTick(a)};else if("function"==typeof setImmediate)f="undefined"!=typeof window?setImmediate.bind(window,a):function(){setImmediate(a)};else if("undefined"!=typeof MessageChannel){var h=new MessageChannel;h.port1.onmessage=function(){f=i,h.port1.onmessage=a,a()};var i=function(){h.port2.postMessage(0)};f=function(){setTimeout(a,0),i()}}else f=function(){setTimeout(a,0)};return X}(),Y=Function.call,Z=a(Array.prototype.slice),$=a(Array.prototype.reduce||function(a,b){var c=0,d=this.length;if(1===arguments.length)for(;;){if(c in this){b=this[c++];break}if(++c>=d)throw new TypeError}for(;d>c;c++)c in this&&(b=a(b,this[c],c));return b}),_=a(Array.prototype.indexOf||function(a){for(var b=0;b<this.length;b++)if(this[b]===a)return b;return-1}),ab=a(Array.prototype.map||function(a,b){var c=this,d=[];return $(c,function(e,f,g){d.push(a.call(b,f,g,c))},void 0),d}),bb=Object.create||function(a){function b(){}return b.prototype=a,new b},cb=a(Object.prototype.hasOwnProperty),db=Object.keys||function(a){var b=[];for(var c in a)cb(a,c)&&b.push(c);return b},eb=a(Object.prototype.toString);U="undefined"!=typeof ReturnValue?ReturnValue:function(a){this.value=a};var fb;try{new Function("(function* (){ yield 1; })"),fb=!0}catch(S){fb=!1}var gb="From previous event:";l.resolve=l,l.nextTick=X,l.longStackSupport=!1,l.defer=m,m.prototype.makeNodeResolver=function(){var a=this;return function(b,c){b?a.reject(b):a.resolve(arguments.length>2?Z(arguments,1):c)}},l.promise=n,l.passByCopy=function(a){return a},p.prototype.passByCopy=function(){return this},l.join=function(a,b){return l(a).join(b)},p.prototype.join=function(a){return l([this,a]).spread(function(a,b){if(a===b)return a;throw new Error("Can't join: not the same: "+a+" "+b)})},l.race=o,p.prototype.race=function(){return this.then(l.race)},l.makePromise=p,p.prototype.toString=function(){return"[object Promise]"},p.prototype.then=function(a,b,c){function d(b){try{return"function"==typeof a?a(b):b}catch(c){return C(c)}}function f(a){if("function"==typeof b){e(a,h);try{return b(a)}catch(c){return C(c)}}return C(a)}function g(a){return"function"==typeof c?c(a):a}var h=this,i=m(),j=!1;return X(function(){h.promiseDispatch(function(a){j||(j=!0,i.resolve(d(a)))},"when",[function(a){j||(j=!0,i.resolve(f(a)))}])}),h.promiseDispatch(void 0,"when",[void 0,function(a){var b,c=!1;try{b=g(a)}catch(d){if(c=!0,!l.onerror)throw d;l.onerror(d)}c||i.notify(b)}]),i.promise},l.when=q,p.prototype.thenResolve=function(a){return this.then(function(){return a})},l.thenResolve=function(a,b){return l(a).thenResolve(b)},p.prototype.thenReject=function(a){return this.then(function(){throw a})},l.thenReject=function(a,b){return l(a).thenReject(b)},l.nearer=r,l.isPromise=s,l.isPromiseAlike=t,l.isPending=u,p.prototype.isPending=function(){return"pending"===this.inspect().state},l.isFulfilled=v,p.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},l.isRejected=w,p.prototype.isRejected=function(){return"rejected"===this.inspect().state};var hb=[],ib=[],jb=!1,kb=!0;l.resetUnhandledRejections=z,l.getUnhandledReasons=function(){return hb.slice()},l.stopUnhandledRejectionTracking=function(){z(),"undefined"!=typeof b&&b.on&&b.removeListener("exit",y),kb=!1},z(),l.reject=C,l.fulfill=D,l.master=F,l.spread=G,p.prototype.spread=function(a,b){return this.all().then(function(b){return a.apply(void 0,b)},b)},l.async=H,l.spawn=I,l["return"]=J,l.promised=K,l.dispatch=L,p.prototype.dispatch=function(a,b){var c=this,d=m();return X(function(){c.promiseDispatch(d.resolve,a,b)}),d.promise},l.get=function(a,b){return l(a).dispatch("get",[b])},p.prototype.get=function(a){return this.dispatch("get",[a])},l.set=function(a,b,c){return l(a).dispatch("set",[b,c])},p.prototype.set=function(a,b){return this.dispatch("set",[a,b])},l.del=l["delete"]=function(a,b){return l(a).dispatch("delete",[b])},p.prototype.del=p.prototype["delete"]=function(a){return this.dispatch("delete",[a])},l.mapply=l.post=function(a,b,c){return l(a).dispatch("post",[b,c])},p.prototype.mapply=p.prototype.post=function(a,b){return this.dispatch("post",[a,b])},l.send=l.mcall=l.invoke=function(a,b){return l(a).dispa