9 lines
113 KiB
JavaScript
9 lines
113 KiB
JavaScript
/*! elasticsearch-js - v0.0.1 - 2013-11-05
|
||
* https://github.com/elasticsearch/elasticsearch-js
|
||
* Copyright (c) 2013 Spencer Alger; Licensed Apache License */
|
||
// built using browserify
|
||
|
||
!function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):"undefined"!=typeof window?window.elasticsearch=a():"undefined"!=typeof global?global.elasticsearch=a():"undefined"!=typeof self&&(self.elasticsearch=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);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};a[g][0].call(j.exports,function(b){var c=a[g][1][b];return e(c?c:b)},j,j.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(){},{}],2:[function(a,b,c){function d(a){return"[object Array]"===j.call(a)}function e(a,b){var c;if(null===a)c={__proto__:null};else{if("object"!=typeof a)throw new TypeError("typeof prototype["+typeof a+"] != 'object'");var d=function(){};d.prototype=a,c=new d,c.__proto__=a}return"undefined"!=typeof b&&Object.defineProperties&&Object.defineProperties(c,b),c}function f(a){return"object"!=typeof a&&"function"!=typeof a||null===a}function g(a){if(f(a))throw new TypeError("Object.keys called on a non-object");var b=[];for(var c in a)k.call(a,c)&&b.push(c);return b}function h(a){if(f(a))throw new TypeError("Object.getOwnPropertyNames called on a non-object");var b=g(a);return c.isArray(a)&&-1===c.indexOf(a,"length")&&b.push("length"),b}function i(a,b){return{value:a[b]}}var j=Object.prototype.toString,k=Object.prototype.hasOwnProperty;c.isArray="function"==typeof Array.isArray?Array.isArray:d,c.indexOf=function(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0;c<a.length;c++)if(b===a[c])return c;return-1},c.filter=function(a,b){if(a.filter)return a.filter(b);for(var c=[],d=0;d<a.length;d++)b(a[d],d,a)&&c.push(a[d]);return c},c.forEach=function(a,b,c){if(a.forEach)return a.forEach(b,c);for(var d=0;d<a.length;d++)b.call(c,a[d],d,a)},c.map=function(a,b){if(a.map)return a.map(b);for(var c=new Array(a.length),d=0;d<a.length;d++)c[d]=b(a[d],d,a);return c},c.reduce=function(a,b,c){if(a.reduce)return a.reduce(b,c);var d,e=!1;2<arguments.length&&(d=c,e=!0);for(var f=0,g=a.length;g>f;++f)a.hasOwnProperty(f)&&(e?d=b(d,a[f],f,a):(d=a[f],e=!0));return d},c.substr="b"!=="ab".substr(-1)?function(a,b,c){return 0>b&&(b=a.length+b),a.substr(b,c)}:function(a,b,c){return a.substr(b,c)},c.trim=function(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")},c.bind=function(){var a=Array.prototype.slice.call(arguments),b=a.shift();if(b.bind)return b.bind.apply(b,a);var c=a.shift();return function(){b.apply(c,a.concat([Array.prototype.slice.call(arguments)]))}},c.create="function"==typeof Object.create?Object.create:e;var l="function"==typeof Object.keys?Object.keys:g,m="function"==typeof Object.getOwnPropertyNames?Object.getOwnPropertyNames:h;if((new Error).hasOwnProperty("description")){var n=function(a,b){return"[object Error]"===j.call(a)&&(b=c.filter(b,function(a){return"description"!==a&&"number"!==a&&"message"!==a})),b};c.keys=function(a){return n(a,l(a))},c.getOwnPropertyNames=function(a){return n(a,m(a))}}else c.keys=l,c.getOwnPropertyNames=m;if("function"==typeof Object.getOwnPropertyDescriptor)try{Object.getOwnPropertyDescriptor({a:1},"a"),c.getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor}catch(o){c.getOwnPropertyDescriptor=function(a,b){try{return Object.getOwnPropertyDescriptor(a,b)}catch(c){return i(a,b)}}}else c.getOwnPropertyDescriptor=i},{}],3:[function(a,b){function c(a,b){return m.isUndefined(b)?""+b:!m.isNumber(b)||!isNaN(b)&&isFinite(b)?m.isFunction(b)||m.isRegExp(b)?b.toString():b:b.toString()}function d(a,b){return m.isString(a)?a.length<b?a:a.slice(0,b):a}function e(a){return d(JSON.stringify(a.actual,c),128)+" "+a.operator+" "+d(JSON.stringify(a.expected,c),128)}function f(a,b,c,d,e){throw new p.AssertionError({message:c,actual:a,expected:b,operator:d,stackStartFunction:e})}function g(a,b){a||f(a,!0,b,"==",p.ok)}function h(a,b){if(a===b)return!0;if(m.isBuffer(a)&&m.isBuffer(b)){if(a.length!=b.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!==b[c])return!1;return!0}return m.isDate(a)&&m.isDate(b)?a.getTime()===b.getTime():m.isRegExp(a)&&m.isRegExp(b)?a.source===b.source&&a.global===b.global&&a.multiline===b.multiline&&a.lastIndex===b.lastIndex&&a.ignoreCase===b.ignoreCase:m.isObject(a)||m.isObject(b)?j(a,b):a==b}function i(a){return"[object Arguments]"==Object.prototype.toString.call(a)}function j(a,b){if(m.isNullOrUndefined(a)||m.isNullOrUndefined(b))return!1;if(a.prototype!==b.prototype)return!1;if(i(a))return i(b)?(a=o.call(a),b=o.call(b),h(a,b)):!1;try{var c,d,e=n.keys(a),f=n.keys(b)}catch(g){return!1}if(e.length!=f.length)return!1;for(e.sort(),f.sort(),d=e.length-1;d>=0;d--)if(e[d]!=f[d])return!1;for(d=e.length-1;d>=0;d--)if(c=e[d],!h(a[c],b[c]))return!1;return!0}function k(a,b){return a&&b?"[object RegExp]"==Object.prototype.toString.call(b)?b.test(a):a instanceof b?!0:b.call({},a)===!0?!0:!1:!1}function l(a,b,c,d){var e;m.isString(c)&&(d=c,c=null);try{b()}catch(g){e=g}if(d=(c&&c.name?" ("+c.name+").":".")+(d?" "+d:"."),a&&!e&&f(e,c,"Missing expected exception"+d),!a&&k(e,c)&&f(e,c,"Got unwanted exception"+d),a&&e&&c&&!k(e,c)||!a&&e)throw e}var m=a("util"),n=a("_shims"),o=Array.prototype.slice,p=b.exports=g;p.AssertionError=function(a){this.name="AssertionError",this.actual=a.actual,this.expected=a.expected,this.operator=a.operator,this.message=a.message||e(this)},m.inherits(p.AssertionError,Error),p.fail=f,p.ok=g,p.equal=function(a,b,c){a!=b&&f(a,b,c,"==",p.equal)},p.notEqual=function(a,b,c){a==b&&f(a,b,c,"!=",p.notEqual)},p.deepEqual=function(a,b,c){h(a,b)||f(a,b,c,"deepEqual",p.deepEqual)},p.notDeepEqual=function(a,b,c){h(a,b)&&f(a,b,c,"notDeepEqual",p.notDeepEqual)},p.strictEqual=function(a,b,c){a!==b&&f(a,b,c,"===",p.strictEqual)},p.notStrictEqual=function(a,b,c){a===b&&f(a,b,c,"!==",p.notStrictEqual)},p.throws=function(){l.apply(this,[!0].concat(o.call(arguments)))},p.doesNotThrow=function(){l.apply(this,[!1].concat(o.call(arguments)))},p.ifError=function(a){if(a)throw a}},{_shims:2,util:8}],4:[function(a,b){function c(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}var d=a("util");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(!d.isNumber(a)||0>a)throw TypeError("n must be a positive number");return this._maxListeners=a,this},c.prototype.emit=function(a){var b,c,e,f,g,h;if(this._events||(this._events={}),"error"===a&&(!this._events.error||d.isObject(this._events.error)&&!this._events.error.length))throw b=arguments[1],b instanceof Error?b:TypeError('Uncaught, unspecified "error" event.');if(c=this._events[a],d.isUndefined(c))return!1;if(d.isFunction(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,f=new Array(e-1),g=1;e>g;g++)f[g-1]=arguments[g];c.apply(this,f)}else if(d.isObject(c)){for(e=arguments.length,f=new Array(e-1),g=1;e>g;g++)f[g-1]=arguments[g];for(h=c.slice(),e=h.length,g=0;e>g;g++)h[g].apply(this,f)}return!0},c.prototype.addListener=function(a,b){var e;if(!d.isFunction(b))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,d.isFunction(b.listener)?b.listener:b),this._events[a]?d.isObject(this._events[a])?this._events[a].push(b):this._events[a]=[this._events[a],b]:this._events[a]=b,d.isObject(this._events[a])&&!this._events[a].warned){var e;e=d.isUndefined(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),console.trace())}return this},c.prototype.on=c.prototype.addListener,c.prototype.once=function(a,b){function c(){this.removeListener(a,c),b.apply(this,arguments)}if(!d.isFunction(b))throw TypeError("listener must be a function");return c.listener=b,this.on(a,c),this},c.prototype.removeListener=function(a,b){var c,e,f,g;if(!d.isFunction(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],f=c.length,e=-1,c===b||d.isFunction(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(d.isObject(c)){for(g=f;g-->0;)if(c[g]===b||c[g].listener&&c[g].listener===b){e=g;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.isFunction(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.isFunction(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.isFunction(a._events[b])?1:a._events[b].length:0}},{util:8}],5:[function(a,b,c){function d(a,b){for(var c=0,d=a.length-1;d>=0;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c--;c)a.unshift("..");return a}var e=a("__browserify_process"),f=a("util"),g=a("_shims"),h=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(a){return h.exec(a).slice(1)};c.resolve=function(){for(var a="",b=!1,c=arguments.length-1;c>=-1&&!b;c--){var h=c>=0?arguments[c]:e.cwd();if(!f.isString(h))throw new TypeError("Arguments to path.resolve must be strings");h&&(a=h+"/"+a,b="/"===h.charAt(0))}return a=d(g.filter(a.split("/"),function(a){return!!a}),!b).join("/"),(b?"/":"")+a||"."},c.normalize=function(a){var b=c.isAbsolute(a),e="/"===g.substr(a,-1);return a=d(g.filter(a.split("/"),function(a){return!!a}),!b).join("/"),a||b||(a="."),a&&e&&(a+="/"),(b?"/":"")+a},c.isAbsolute=function(a){return"/"===a.charAt(0)},c.join=function(){var a=Array.prototype.slice.call(arguments,0);return c.normalize(g.filter(a,function(a){if(!f.isString(a))throw new TypeError("Arguments to path.join must be strings");return a}).join("/"))},c.relative=function(a,b){function d(a){for(var b=0;b<a.length&&""===a[b];b++);for(var c=a.length-1;c>=0&&""===a[c];c--);return b>c?[]:a.slice(b,c-b+1)}a=c.resolve(a).substr(1),b=c.resolve(b).substr(1);for(var e=d(a.split("/")),f=d(b.split("/")),g=Math.min(e.length,f.length),h=g,i=0;g>i;i++)if(e[i]!==f[i]){h=i;break}for(var j=[],i=h;i<e.length;i++)j.push("..");return j=j.concat(f.slice(h)),j.join("/")},c.sep="/",c.delimiter=":",c.dirname=function(a){var b=i(a),c=b[0],d=b[1];return c||d?(d&&(d=d.substr(0,d.length-1)),c+d):"."},c.basename=function(a,b){var c=i(a)[2];return b&&c.substr(-1*b.length)===b&&(c=c.substr(0,c.length-b.length)),c},c.extname=function(a){return i(a)[3]}},{__browserify_process:12,_shims:2,util:8}],6:[function(a,b,c){function d(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function e(a){return a.charCodeAt(0)}var f=c,g=a("util"),h=a("_shims"),i=a("buffer").Buffer;f.unescapeBuffer=function(a,b){for(var c,d,f,g=new i(a.length),h="CHAR",j=0,k=0;j<=a.length;j++){var l=a.charCodeAt(j);switch(h){case"CHAR":switch(l){case e("%"):c=0,d=0,h="HEX0";break;case e("+"):b&&(l=e(" "));default:g[k++]=l}break;case"HEX0":if(h="HEX1",f=l,e("0")<=l&&l<=e("9"))c=l-e("0");else if(e("a")<=l&&l<=e("f"))c=l-e("a")+10;else{if(!(e("A")<=l&&l<=e("F"))){g[k++]=e("%"),g[k++]=l,h="CHAR";break}c=l-e("A")+10}break;case"HEX1":if(h="CHAR",e("0")<=l&&l<=e("9"))d=l-e("0");else if(e("a")<=l&&l<=e("f"))d=l-e("a")+10;else{if(!(e("A")<=l&&l<=e("F"))){g[k++]=e("%"),g[k++]=f,g[k++]=l;break}d=l-e("A")+10}g[k++]=16*c+d}}return g.slice(0,k-1)},f.unescape=function(a,b){return f.unescapeBuffer(a,b).toString()},f.escape=function(a){return encodeURIComponent(a)};var j=function(a){return g.isString(a)?a:g.isBoolean(a)?a?"true":"false":g.isNumber(a)?isFinite(a)?a:"":""};f.stringify=f.encode=function(a,b,c,d){return b=b||"&",c=c||"=",g.isNull(a)&&(a=void 0),g.isObject(a)?h.map(h.keys(a),function(d){var e=f.escape(j(d))+c;return g.isArray(a[d])?h.map(a[d],function(a){return e+f.escape(j(a))}).join(b):e+f.escape(j(a[d]))}).join(b):d?f.escape(j(d))+c+f.escape(j(a)):""},f.parse=f.decode=function(a,b,c,e){b=b||"&",c=c||"=";var h={};if(!g.isString(a)||0===a.length)return h;var i=/\+/g;a=a.split(b);var j=1e3;e&&g.isNumber(e.maxKeys)&&(j=e.maxKeys);var k=a.length;j>0&&k>j&&(k=j);for(var l=0;k>l;++l){var m,n,o,p,q=a[l].replace(i,"%20"),r=q.indexOf(c);r>=0?(m=q.substr(0,r),n=q.substr(r+1)):(m=q,n="");try{o=decodeURIComponent(m),p=decodeURIComponent(n)}catch(s){o=f.unescape(m,!0),p=f.unescape(n,!0)}d(h,o)?g.isArray(h[o])?h[o].push(p):h[o]=[h[o],p]:h[o]=p}return h}},{_shims:2,buffer:10,util:8}],7:[function(a,b,c){function d(){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}function e(a,b,c){if(a&&j.isObject(a)&&a instanceof d)return a;var e=new d;return e.parse(a,b,c),e}function f(a){return j.isString(a)&&(a=e(a)),a instanceof d?a.format():d.prototype.format.call(a)}function g(a,b){return e(a,!1,!0).resolve(b)}function h(a,b){return a?e(a,!1,!0).resolveObject(b):b}var i={encode:function(a){return a}},j=a("util"),k=a("_shims");c.parse=e,c.resolve=g,c.resolveObject=h,c.format=f,c.Url=d;var l=/^([a-z0-9.+-]+:)/i,m=/:[0-9]*$/,n=["<",">",'"',"`"," ","\r","\n"," "],o=["{","}","|","\\","^","`"].concat(n),p=["'"].concat(o),q=["%","/","?",";","#"].concat(p),r=["/","?","#"],s=255,t=/^[a-z0-9A-Z_-]{0,63}$/,u=/^([a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},x={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=a("querystring");d.prototype.parse=function(a,b,c){if(!j.isString(a))throw new TypeError("Parameter 'url' must be a string, not "+typeof a);var d=a;d=k.trim(d);var e=l.exec(d);if(e){e=e[0];var f=e.toLowerCase();this.protocol=f,d=d.substr(e.length)}if(c||e||d.match(/^\/\/[^@\/]+@[^@\/]+/)){var g="//"===d.substr(0,2);!g||e&&w[e]||(d=d.substr(2),this.slashes=!0)}if(!w[e]&&(g||e&&!x[e])){for(var h=-1,m=0;m<r.length;m++){var n=d.indexOf(r[m]);-1!==n&&(-1===h||h>n)&&(h=n)}var o,z;z=-1===h?d.lastIndexOf("@"):d.lastIndexOf("@",h),-1!==z&&(o=d.slice(0,z),d=d.slice(z+1),this.auth=decodeURIComponent(o)),h=-1;for(var m=0;m<q.length;m++){var n=d.indexOf(q[m]);-1!==n&&(-1===h||h>n)&&(h=n)}-1===h&&(h=d.length),this.host=d.slice(0,h),d=d.slice(h),this.parseHost(),this.hostname=this.hostname||"";var A="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!A)for(var B=this.hostname.split(/\./),m=0,C=B.length;C>m;m++){var D=B[m];if(D&&!D.match(t)){for(var E="",F=0,G=D.length;G>F;F++)E+=D.charCodeAt(F)>127?"x":D[F];if(!E.match(t)){var H=B.slice(0,m),I=B.slice(m+1),J=D.match(u);J&&(H.push(J[1]),I.unshift(J[2])),I.length&&(d="/"+I.join(".")+d),this.hostname=H.join(".");break}}}if(this.hostname=this.hostname.length>s?"":this.hostname.toLowerCase(),!A){for(var K=this.hostname.split("."),L=[],m=0;m<K.length;++m){var M=K[m];L.push(M.match(/[^A-Za-z0-9_-]/)?"xn--"+i.encode(M):M)}this.hostname=L.join(".")}var N=this.port?":"+this.port:"",O=this.hostname||"";this.host=O+N,this.href+=this.host,A&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==d[0]&&(d="/"+d))}if(!v[f])for(var m=0,C=p.length;C>m;m++){var P=p[m],Q=encodeURIComponent(P);Q===P&&(Q=escape(P)),d=d.split(P).join(Q)}var R=d.indexOf("#");-1!==R&&(this.hash=d.substr(R),d=d.slice(0,R));var S=d.indexOf("?");if(-1!==S?(this.search=d.substr(S),this.query=d.substr(S+1),b&&(this.query=y.parse(this.query)),d=d.slice(0,S)):b&&(this.search="",this.query={}),d&&(this.pathname=d),x[f]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var N=this.pathname||"",M=this.search||"";this.path=N+M}return this.href=this.format(),this},d.prototype.format=function(){var a=this.auth||"";a&&(a=encodeURIComponent(a),a=a.replace(/%3A/i,":"),a+="@");var b=this.protocol||"",c=this.pathname||"",d=this.hash||"",e=!1,f="";this.host?e=a+this.host:this.hostname&&(e=a+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(e+=":"+this.port)),this.query&&j.isObject(this.query)&&k.keys(this.query).length&&(f=y.stringify(this.query));var g=this.search||f&&"?"+f||"";return b&&":"!==k.substr(b,-1)&&(b+=":"),this.slashes||(!b||x[b])&&e!==!1?(e="//"+(e||""),c&&"/"!==c.charAt(0)&&(c="/"+c)):e||(e=""),d&&"#"!==d.charAt(0)&&(d="#"+d),g&&"?"!==g.charAt(0)&&(g="?"+g),c=c.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),g=g.replace("#","%23"),b+e+c+g+d},d.prototype.resolve=function(a){return this.resolveObject(e(a,!1,!0)).format()},d.prototype.resolveObject=function(a){if(j.isString(a)){var b=new d;b.parse(a,!1,!0),a=b}var c=new d;if(k.forEach(k.keys(this),function(a){c[a]=this[a]},this),c.hash=a.hash,""===a.href)return c.href=c.format(),c;if(a.slashes&&!a.protocol)return k.forEach(k.keys(a),function(b){"protocol"!==b&&(c[b]=a[b])}),x[c.protocol]&&c.hostname&&!c.pathname&&(c.path=c.pathname="/"),c.href=c.format(),c;if(a.protocol&&a.protocol!==c.protocol){if(!x[a.protocol])return k.forEach(k.keys(a),function(b){c[b]=a[b]}),c.href=c.format(),c;if(c.protocol=a.protocol,a.host||w[a.protocol])c.pathname=a.pathname;else{for(var e=(a.pathname||"").split("/");e.length&&!(a.host=e.shift()););a.host||(a.host=""),a.hostname||(a.hostname=""),""!==e[0]&&e.unshift(""),e.length<2&&e.unshift(""),c.pathname=e.join("/")}if(c.search=a.search,c.query=a.query,c.host=a.host||"",c.auth=a.auth,c.hostname=a.hostname||a.host,c.port=a.port,c.pathname||c.search){var f=c.pathname||"",g=c.search||"";c.path=f+g}return c.slashes=c.slashes||a.slashes,c.href=c.format(),c}var h=c.pathname&&"/"===c.pathname.charAt(0),i=a.host||a.pathname&&"/"===a.pathname.charAt(0),l=i||h||c.host&&a.pathname,m=l,n=c.pathname&&c.pathname.split("/")||[],e=a.pathname&&a.pathname.split("/")||[],o=c.protocol&&!x[c.protocol];if(o&&(c.hostname="",c.port=null,c.host&&(""===n[0]?n[0]=c.host:n.unshift(c.host)),c.host="",a.protocol&&(a.hostname=null,a.port=null,a.host&&(""===e[0]?e[0]=a.host:e.unshift(a.host)),a.host=null),l=l&&(""===e[0]||""===n[0])),i)c.host=a.host||""===a.host?a.host:c.host,c.hostname=a.hostname||""===a.hostname?a.hostname:c.hostname,c.search=a.search,c.query=a.query,n=e;else if(e.length)n||(n=[]),n.pop(),n=n.concat(e),c.search=a.search,c.query=a.query;else if(!j.isNullOrUndefined(a.search)){if(o){c.hostname=c.host=n.shift();var p=c.host&&c.host.indexOf("@")>0?c.host.split("@"):!1;p&&(c.auth=p.shift(),c.host=c.hostname=p.shift())}return c.search=a.search,c.query=a.query,j.isNull(c.pathname)&&j.isNull(c.search)||(c.path=(c.pathname?c.pathname:"")+(c.search?c.search:"")),c.href=c.format(),c}if(!n.length)return c.pathname=null,c.path=c.search?"/"+c.search:null,c.href=c.format(),c;for(var q=n.slice(-1)[0],r=(c.host||a.host)&&("."===q||".."===q)||""===q,s=0,t=n.length;t>=0;t--)q=n[t],"."==q?n.splice(t,1):".."===q?(n.splice(t,1),s++):s&&(n.splice(t,1),s--);if(!l&&!m)for(;s--;s)n.unshift("..");!l||""===n[0]||n[0]&&"/"===n[0].charAt(0)||n.unshift(""),r&&"/"!==k.substr(n.join("/"),-1)&&n.push("");var u=""===n[0]||n[0]&&"/"===n[0].charAt(0);if(o){c.hostname=c.host=u?"":n.length?n.shift():"";var p=c.host&&c.host.indexOf("@")>0?c.host.split("@"):!1;p&&(c.auth=p.shift(),c.host=c.hostname=p.shift())}return l=l||c.host&&n.length,l&&!u&&n.unshift(""),n.length?c.pathname=n.join("/"):(c.pathname=null,c.path=null),j.isNull(c.pathname)&&j.isNull(c.search)||(c.path=(c.pathname?c.pathname:"")+(c.search?c.search:"")),c.auth=a.auth||c.auth,c.slashes=c.slashes||a.slashes,c.href=c.format(),c},d.prototype.parseHost=function(){var a=this.host,b=m.exec(a);b&&(b=b[0],":"!==b&&(this.port=b.substr(1)),a=a.substr(0,a.length-b.length)),a&&(this.hostname=a)}},{_shims:2,querystring:6,util:8}],8:[function(a,b,c){function d(a,b){var d={seen:[],stylize:f};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),o(b)?d.showHidden=b:b&&c._extend(d,b),u(d.showHidden)&&(d.showHidden=!1),u(d.depth)&&(d.depth=2),u(d.colors)&&(d.colors=!1),u(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=e),h(d,a,d.depth)}function e(a,b){var c=d.styles[b];return c?"["+d.colors[c][0]+"m"+a+"["+d.colors[c][1]+"m":a}function f(a){return a}function g(a){var b={};return G.forEach(a,function(a){b[a]=!0}),b}function h(a,b,d){if(a.customInspect&&b&&z(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d);return s(e)||(e=h(a,e,d)),e}var f=i(a,b);if(f)return f;var o=G.keys(b),p=g(o);if(a.showHidden&&(o=G.getOwnPropertyNames(b)),0===o.length){if(z(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(v(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(x(b))return a.stylize(Date.prototype.toString.call(b),"date");if(y(b))return j(b)}var r="",t=!1,u=["{","}"];if(n(b)&&(t=!0,u=["[","]"]),z(b)){var w=b.name?": "+b.name:"";r=" [Function"+w+"]"}if(v(b)&&(r=" "+RegExp.prototype.toString.call(b)),x(b)&&(r=" "+Date.prototype.toUTCString.call(b)),y(b)&&(r=" "+j(b)),0===o.length&&(!t||0==b.length))return u[0]+r+u[1];if(0>d)return v(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var A;return A=t?k(a,b,d,p,o):o.map(function(c){return l(a,b,d,p,c,t)}),a.seen.pop(),m(A,r,u)}function i(a,b){if(u(b))return a.stylize("undefined","undefined");if(s(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return r(b)?a.stylize(""+b,"number"):o(b)?a.stylize(""+b,"boolean"):p(b)?a.stylize("null","null"):void 0}function j(a){return"["+Error.prototype.toString.call(a)+"]"}function k(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)F(b,String(g))?f.push(l(a,b,c,d,String(g),!0)):f.push("");return G.forEach(e,function(e){e.match(/^\d+$/)||f.push(l(a,b,c,d,e,!0))}),f}function l(a,b,c,d,e,f){var g,i,j;if(j=G.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?i=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(i=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),i||(G.indexOf(a.seen,j.value)<0?(i=p(c)?h(a,j.value,null):h(a,j.value,c-1),i.indexOf("\n")>-1&&(i=f?i.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+i.split("\n").map(function(a){return" "+a}).join("\n"))):i=a.stylize("[Circular]","special")),u(g)){if(f&&e.match(/^\d+$/))return i;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+i}function m(a,b,c){var d=0,e=G.reduce(a,function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function n(a){return G.isArray(a)}function o(a){return"boolean"==typeof a}function p(a){return null===a}function q(a){return null==a}function r(a){return"number"==typeof a}function s(a){return"string"==typeof a}function t(a){return"symbol"==typeof a}function u(a){return void 0===a}function v(a){return w(a)&&"[object RegExp]"===C(a)}function w(a){return"object"==typeof a&&a}function x(a){return w(a)&&"[object Date]"===C(a)}function y(a){return w(a)&&"[object Error]"===C(a)}function z(a){return"function"==typeof a}function A(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function B(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.binarySlice}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),I[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=a("_shims"),H=/%[sdj%]/g;c.format=function(a){if(!s(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(d(arguments[c]));return b.join(" ")}for(var c=1,e=arguments,f=e.length,g=String(a).replace(H,function(a){if("%%"===a)return"%";if(c>=f)return a;switch(a){case"%s":return String(e[c++]);case"%d":return Number(e[c++]);case"%j":try{return JSON.stringify(e[c++])}catch(b){return"[Circular]"}default:return a}}),h=e[c];f>c;h=e[++c])g+=p(h)||!w(h)?" "+h:" "+d(h);return g},c.inspect=d,d.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},d.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=n,c.isBoolean=o,c.isNull=p,c.isNullOrUndefined=q,c.isNumber=r,c.isString=s,c.isSymbol=t,c.isUndefined=u,c.isRegExp=v,c.isObject=w,c.isDate=x,c.isError=y,c.isFunction=z,c.isPrimitive=A,c.isBuffer=B;var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=function(a,b){a.super_=b,a.prototype=G.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})},c._extend=function(a,b){if(!b||!w(b))return a;for(var c=G.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}},{_shims:2}],9:[function(a,b,c){c.readIEEE754=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?0:e-1,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.writeIEEE754=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?f-1:0,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}},{}],10:[function(a,b,c){function d(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function e(b,c,f){if(E||(E=a("assert")),!(this instanceof e))return new e(b,c,f);if(this.parent=this,this.offset=0,"base64"==c&&"string"==typeof b)for(b=d(b);0!=b.length%4;)b+="=";var h;if("number"==typeof f){this.length=g(c);for(var j=0;j<this.length;j++)this[j]=b.get(j+f)}else{switch(h=typeof b){case"number":this.length=g(b);break;case"string":this.length=e.byteLength(b,c);break;case"object":this.length=g(b.length);break;default:throw new Error("First argument needs to be a number, array or string.")}if(i(b))for(var j=0;j<this.length;j++)this[j]=b instanceof e?b.readUInt8(j):b[j];else if("string"==h)this.length=this.write(b,0,c);else if("number"===h)for(var j=0;j<this.length;j++)this[j]=0}}function f(a,b,c){return"number"!=typeof a?c:(a=~~a,a>=b?b:a>=0?a:(a+=b,a>=0?a:0))}function g(a){return a=~~Math.ceil(+a),0>a?0:a}function h(a){return(Array.isArray||function(a){return"[object Array]"=={}.toString.apply(a)})(a)}function i(a){return h(a)||e.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function j(a){return 16>a?"0"+a.toString(16):a.toString(16)}function k(a){for(var b=[],c=0;c<a.length;c++)if(a.charCodeAt(c)<=127)b.push(a.charCodeAt(c));else for(var d=encodeURIComponent(a.charAt(c)).substr(1).split("%"),e=0;e<d.length;e++)b.push(parseInt(d[e],16));return b}function l(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function m(b){return a("base64-js").toByteArray(b)}function n(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);)b[e+c]=a[e],e++;return e}function o(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function p(a,b,c,d){var e=0;return d||(E.ok("boolean"==typeof c,"missing or invalid endian"),E.ok(void 0!==b&&null!==b,"missing offset"),E.ok(b+1<a.length,"Trying to read beyond buffer length")),b>=a.length?0:(c?(e=a[b]<<8,b+1<a.length&&(e|=a[b+1])):(e=a[b],b+1<a.length&&(e|=a[b+1]<<8)),e)}function q(a,b,c,d){var e=0;return d||(E.ok("boolean"==typeof c,"missing or invalid endian"),E.ok(void 0!==b&&null!==b,"missing offset"),E.ok(b+3<a.length,"Trying to read beyond buffer length")),b>=a.length?0:(c?(b+1<a.length&&(e=a[b+1]<<16),b+2<a.length&&(e|=a[b+2]<<8),b+3<a.length&&(e|=a[b+3]),e+=a[b]<<24>>>0):(b+2<a.length&&(e=a[b+2]<<16),b+1<a.length&&(e|=a[b+1]<<8),e|=a[b],b+3<a.length&&(e+=a[b+3]<<24>>>0)),e)}function r(a,b,c,d){var e,f;return d||(E.ok("boolean"==typeof c,"missing or invalid endian"),E.ok(void 0!==b&&null!==b,"missing offset"),E.ok(b+1<a.length,"Trying to read beyond buffer length")),f=p(a,b,c,d),e=32768&f,e?-1*(65535-f+1):f}function s(a,b,c,d){var e,f;return d||(E.ok("boolean"==typeof c,"missing or invalid endian"),E.ok(void 0!==b&&null!==b,"missing offset"),E.ok(b+3<a.length,"Trying to read beyond buffer length")),f=q(a,b,c,d),e=2147483648&f,e?-1*(4294967295-f+1):f}function t(b,c,d,e){return e||(E.ok("boolean"==typeof d,"missing or invalid endian"),E.ok(c+3<b.length,"Trying to read beyond buffer length")),a("./buffer_ieee754").readIEEE754(b,c,d,23,4)}function u(b,c,d,e){return e||(E.ok("boolean"==typeof d,"missing or invalid endian"),E.ok(c+7<b.length,"Trying to read beyond buffer length")),a("./buffer_ieee754").readIEEE754(b,c,d,52,8)}function v(a,b){E.ok("number"==typeof a,"cannot write a non-number as a number"),E.ok(a>=0,"specified a negative value for writing an unsigned value"),E.ok(b>=a,"value is larger than maximum value for type"),E.ok(Math.floor(a)===a,"value has a fractional component")}function w(a,b,c,d,e){e||(E.ok(void 0!==b&&null!==b,"missing value"),E.ok("boolean"==typeof d,"missing or invalid endian"),E.ok(void 0!==c&&null!==c,"missing offset"),E.ok(c+1<a.length,"trying to write beyond buffer length"),v(b,65535));for(var f=0;f<Math.min(a.length-c,2);f++)a[c+f]=(b&255<<8*(d?1-f:f))>>>8*(d?1-f:f)}function x(a,b,c,d,e){e||(E.ok(void 0!==b&&null!==b,"missing value"),E.ok("boolean"==typeof d,"missing or invalid endian"),E.ok(void 0!==c&&null!==c,"missing offset"),E.ok(c+3<a.length,"trying to write beyond buffer length"),v(b,4294967295));for(var f=0;f<Math.min(a.length-c,4);f++)a[c+f]=255&b>>>8*(d?3-f:f)}function y(a,b,c){E.ok("number"==typeof a,"cannot write a non-number as a number"),E.ok(b>=a,"value larger than maximum allowed value"),E.ok(a>=c,"value smaller than minimum allowed value"),E.ok(Math.floor(a)===a,"value has a fractional component")}function z(a,b,c){E.ok("number"==typeof a,"cannot write a non-number as a number"),E.ok(b>=a,"value larger than maximum allowed value"),E.ok(a>=c,"value smaller than minimum allowed value")}function A(a,b,c,d,e){e||(E.ok(void 0!==b&&null!==b,"missing value"),E.ok("boolean"==typeof d,"missing or invalid endian"),E.ok(void 0!==c&&null!==c,"missing offset"),E.ok(c+1<a.length,"Trying to write beyond buffer length"),y(b,32767,-32768)),b>=0?w(a,b,c,d,e):w(a,65535+b+1,c,d,e)}function B(a,b,c,d,e){e||(E.ok(void 0!==b&&null!==b,"missing value"),E.ok("boolean"==typeof d,"missing or invalid endian"),E.ok(void 0!==c&&null!==c,"missing offset"),E.ok(c+3<a.length,"Trying to write beyond buffer length"),y(b,2147483647,-2147483648)),b>=0?x(a,b,c,d,e):x(a,4294967295+b+1,c,d,e)
|
||
}function C(b,c,d,e,f){f||(E.ok(void 0!==c&&null!==c,"missing value"),E.ok("boolean"==typeof e,"missing or invalid endian"),E.ok(void 0!==d&&null!==d,"missing offset"),E.ok(d+3<b.length,"Trying to write beyond buffer length"),z(c,3.4028234663852886e38,-3.4028234663852886e38)),a("./buffer_ieee754").writeIEEE754(b,c,d,e,23,4)}function D(b,c,d,e,f){f||(E.ok(void 0!==c&&null!==c,"missing value"),E.ok("boolean"==typeof e,"missing or invalid endian"),E.ok(void 0!==d&&null!==d,"missing offset"),E.ok(d+7<b.length,"Trying to write beyond buffer length"),z(c,1.7976931348623157e308,-1.7976931348623157e308)),a("./buffer_ieee754").writeIEEE754(b,c,d,e,52,8)}var E;c.Buffer=e,c.SlowBuffer=e,e.poolSize=8192,c.INSPECT_MAX_BYTES=50,e.prototype.get=function(a){if(0>a||a>=this.length)throw new Error("oob");return this[a]},e.prototype.set=function(a,b){if(0>a||a>=this.length)throw new Error("oob");return this[a]=b},e.byteLength=function(a,b){switch(b||"utf8"){case"hex":return a.length/2;case"utf8":case"utf-8":return k(a).length;case"ascii":case"binary":return a.length;case"base64":return m(a).length;default:throw new Error("Unknown encoding")}},e.prototype.utf8Write=function(a,b,c){return e._charsWritten=n(k(a),this,b,c)},e.prototype.asciiWrite=function(a,b,c){return e._charsWritten=n(l(a),this,b,c)},e.prototype.binaryWrite=e.prototype.asciiWrite,e.prototype.base64Write=function(a,b,c){return e._charsWritten=n(m(a),this,b,c)},e.prototype.base64Slice=function(){var b=Array.prototype.slice.apply(this,arguments);return a("base64-js").fromByteArray(b)},e.prototype.utf8Slice=function(){for(var a=Array.prototype.slice.apply(this,arguments),b="",c="",d=0;d<a.length;)a[d]<=127?(b+=o(c)+String.fromCharCode(a[d]),c=""):c+="%"+a[d].toString(16),d++;return b+o(c)},e.prototype.asciiSlice=function(){for(var a=Array.prototype.slice.apply(this,arguments),b="",c=0;c<a.length;c++)b+=String.fromCharCode(a[c]);return b},e.prototype.binarySlice=e.prototype.asciiSlice,e.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=j(this[d]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<Buffer "+a.join(" ")+">"},e.prototype.hexSlice=function(a,b){var c=this.length;(!a||0>a)&&(a=0),(!b||0>b||b>c)&&(b=c);for(var d="",e=a;b>e;e++)d+=j(this[e]);return d},e.prototype.toString=function(a,b,c){if(a=String(a||"utf8").toLowerCase(),b=+b||0,"undefined"==typeof c&&(c=this.length),+c==b)return"";switch(a){case"hex":return this.hexSlice(b,c);case"utf8":case"utf-8":return this.utf8Slice(b,c);case"ascii":return this.asciiSlice(b,c);case"binary":return this.binarySlice(b,c);case"base64":return this.base64Slice(b,c);case"ucs2":case"ucs-2":return this.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},e.prototype.hexWrite=function(a,b,c){b=+b||0;var d=this.length-b;c?(c=+c,c>d&&(c=d)):c=d;var f=a.length;if(f%2)throw new Error("Invalid hex string");c>f/2&&(c=f/2);for(var g=0;c>g;g++){var h=parseInt(a.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");this[b+g]=h}return e._charsWritten=2*g,g},e.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var e=d;d=b,b=c,c=e}b=+b||0;var f=this.length-b;switch(c?(c=+c,c>f&&(c=f)):c=f,d=String(d||"utf8").toLowerCase()){case"hex":return this.hexWrite(a,b,c);case"utf8":case"utf-8":return this.utf8Write(a,b,c);case"ascii":return this.asciiWrite(a,b,c);case"binary":return this.binaryWrite(a,b,c);case"base64":return this.base64Write(a,b,c);case"ucs2":case"ucs-2":return this.ucs2Write(a,b,c);default:throw new Error("Unknown encoding")}},e.prototype.slice=function(a,b){var c=this.length;return a=f(a,c,0),b=f(b,c,c),new e(this,b-a,+a)},e.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),(void 0===d||isNaN(d))&&(d=this.length),b||(b=0),c>d)throw new Error("sourceEnd < sourceStart");if(d===c)return 0;if(0==a.length||0==e.length)return 0;if(0>b||b>=a.length)throw new Error("targetStart out of bounds");if(0>c||c>=e.length)throw new Error("sourceStart out of bounds");if(0>d||d>e.length)throw new Error("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);for(var f=[],g=c;d>g;g++)E.ok("undefined"!=typeof this[g],"copying undefined buffer bytes!"),f.push(this[g]);for(var g=b;g<b+f.length;g++)a[g]=f[g-b]},e.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),"string"==typeof a&&(a=a.charCodeAt(0)),"number"!=typeof a||isNaN(a))throw new Error("value is not a number");if(b>c)throw new Error("end < start");if(c===b)return 0;if(0==this.length)return 0;if(0>b||b>=this.length)throw new Error("start out of bounds");if(0>c||c>this.length)throw new Error("end out of bounds");for(var d=b;c>d;d++)this[d]=a},e.isBuffer=function(a){return a instanceof e||a instanceof e},e.concat=function(a,b){if(!h(a))throw new Error("Usage: Buffer.concat(list, [totalLength])\n list should be an Array.");if(0===a.length)return new e(0);if(1===a.length)return a[0];if("number"!=typeof b){b=0;for(var c=0;c<a.length;c++){var d=a[c];b+=d.length}}for(var f=new e(b),g=0,c=0;c<a.length;c++){var d=a[c];d.copy(f,g),g+=d.length}return f},e.isEncoding=function(a){switch((a+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},e.prototype.readUInt8=function(a,b){var c=this;return b||(E.ok(void 0!==a&&null!==a,"missing offset"),E.ok(a<c.length,"Trying to read beyond buffer length")),a>=c.length?void 0:c[a]},e.prototype.readUInt16LE=function(a,b){return p(this,a,!1,b)},e.prototype.readUInt16BE=function(a,b){return p(this,a,!0,b)},e.prototype.readUInt32LE=function(a,b){return q(this,a,!1,b)},e.prototype.readUInt32BE=function(a,b){return q(this,a,!0,b)},e.prototype.readInt8=function(a,b){var c,d=this;return b||(E.ok(void 0!==a&&null!==a,"missing offset"),E.ok(a<d.length,"Trying to read beyond buffer length")),a>=d.length?void 0:(c=128&d[a],c?-1*(255-d[a]+1):d[a])},e.prototype.readInt16LE=function(a,b){return r(this,a,!1,b)},e.prototype.readInt16BE=function(a,b){return r(this,a,!0,b)},e.prototype.readInt32LE=function(a,b){return s(this,a,!1,b)},e.prototype.readInt32BE=function(a,b){return s(this,a,!0,b)},e.prototype.readFloatLE=function(a,b){return t(this,a,!1,b)},e.prototype.readFloatBE=function(a,b){return t(this,a,!0,b)},e.prototype.readDoubleLE=function(a,b){return u(this,a,!1,b)},e.prototype.readDoubleBE=function(a,b){return u(this,a,!0,b)},e.prototype.writeUInt8=function(a,b,c){var d=this;c||(E.ok(void 0!==a&&null!==a,"missing value"),E.ok(void 0!==b&&null!==b,"missing offset"),E.ok(b<d.length,"trying to write beyond buffer length"),v(a,255)),b<d.length&&(d[b]=a)},e.prototype.writeUInt16LE=function(a,b,c){w(this,a,b,!1,c)},e.prototype.writeUInt16BE=function(a,b,c){w(this,a,b,!0,c)},e.prototype.writeUInt32LE=function(a,b,c){x(this,a,b,!1,c)},e.prototype.writeUInt32BE=function(a,b,c){x(this,a,b,!0,c)},e.prototype.writeInt8=function(a,b,c){var d=this;c||(E.ok(void 0!==a&&null!==a,"missing value"),E.ok(void 0!==b&&null!==b,"missing offset"),E.ok(b<d.length,"Trying to write beyond buffer length"),y(a,127,-128)),a>=0?d.writeUInt8(a,b,c):d.writeUInt8(255+a+1,b,c)},e.prototype.writeInt16LE=function(a,b,c){A(this,a,b,!1,c)},e.prototype.writeInt16BE=function(a,b,c){A(this,a,b,!0,c)},e.prototype.writeInt32LE=function(a,b,c){B(this,a,b,!1,c)},e.prototype.writeInt32BE=function(a,b,c){B(this,a,b,!0,c)},e.prototype.writeFloatLE=function(a,b,c){C(this,a,b,!1,c)},e.prototype.writeFloatBE=function(a,b,c){C(this,a,b,!0,c)},e.prototype.writeDoubleLE=function(a,b,c){D(this,a,b,!1,c)},e.prototype.writeDoubleBE=function(a,b,c){D(this,a,b,!0,c)}},{"./buffer_ieee754":9,assert:3,"base64-js":11}],11:[function(a,b){!function(){"use strict";function a(a){var b,c,e,f,g,h;if(a.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(g=a.indexOf("="),g=g>0?a.length-g:0,h=[],e=g>0?a.length-4:a.length,b=0,c=0;e>b;b+=4,c+=3)f=d.indexOf(a[b])<<18|d.indexOf(a[b+1])<<12|d.indexOf(a[b+2])<<6|d.indexOf(a[b+3]),h.push((16711680&f)>>16),h.push((65280&f)>>8),h.push(255&f);return 2===g?(f=d.indexOf(a[b])<<2|d.indexOf(a[b+1])>>4,h.push(255&f)):1===g&&(f=d.indexOf(a[b])<<10|d.indexOf(a[b+1])<<4|d.indexOf(a[b+2])>>2,h.push(255&f>>8),h.push(255&f)),h}function c(a){function b(a){return d[63&a>>18]+d[63&a>>12]+d[63&a>>6]+d[63&a]}var c,e,f,g=a.length%3,h="";for(c=0,f=a.length-g;f>c;c+=3)e=(a[c]<<16)+(a[c+1]<<8)+a[c+2],h+=b(e);switch(g){case 1:e=a[a.length-1],h+=d[e>>2],h+=d[63&e<<4],h+="==";break;case 2:e=(a[a.length-2]<<8)+a[a.length-1],h+=d[e>>10],h+=d[63&e>>4],h+=d[63&e<<2],h+="="}return h}var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";b.exports.toByteArray=a,b.exports.fromByteArray=c}()},{}],12:[function(a,b){var c=b.exports={};c.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){if(a.source===window&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var b=c.shift();b()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),c.title="browser",c.browser=!0,c.env={},c.argv=[],c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(){throw new Error("process.chdir is not supported")}},{}],13:[function(b,c,d){var e="undefined"!=typeof self?self:"undefined"!=typeof window?window:{};(function(){function b(a,b,c){for(var d=(c||0)-1,e=a?a.length:0;++d<e;)if(a[d]===b)return d;return-1}function f(a,c){var d=typeof c;if(a=a.cache,"boolean"==d||null==c)return a[c]?0:-1;"number"!=d&&"string"!=d&&(d="object");var e="number"==d?c:w+c;return a=(a=a[d])&&a[e],"object"==d?a&&b(a,c)>-1?0:-1:a?0:-1}function g(a){var b=this.cache,c=typeof a;if("boolean"==c||null==a)b[a]=!0;else{"number"!=c&&"string"!=c&&(c="object");var d="number"==c?a:w+a,e=b[c]||(b[c]={});"object"==c?(e[d]||(e[d]=[])).push(a):e[d]=!0}}function h(a){return a.charCodeAt(0)}function i(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||"undefined"==typeof c)return 1;if(d>c||"undefined"==typeof d)return-1}return a.index-b.index}function j(a){var b=-1,c=a.length,d=a[0],e=a[0|c/2],f=a[c-1];if(d&&"object"==typeof d&&e&&"object"==typeof e&&f&&"object"==typeof f)return!1;var h=m();h["false"]=h["null"]=h["true"]=h.undefined=!1;var i=m();for(i.array=a,i.cache=h,i.push=g;++b<c;)i.push(a[b]);return i}function k(a){return"\\"+$[a]}function l(){return t.pop()||[]}function m(){return u.pop()||{array:null,cache:null,criteria:null,"false":!1,index:0,"null":!1,number:null,object:null,push:null,string:null,"true":!1,undefined:!1,value:null}}function n(){}function o(a){a.length=0,t.length<y&&t.push(a)}function p(a){var b=a.cache;b&&p(b),a.array=a.cache=a.criteria=a.object=a.number=a.string=a.value=null,u.length<y&&u.push(a)}function q(a,b,c){b||(b=0),"undefined"==typeof c&&(c=a?a.length:0);for(var d=-1,e=c-b||0,f=Array(0>e?0:e);++d<e;)f[d]=a[b+d];return f}function r(a){function c(a){return a&&"object"==typeof a&&!Xd(a)&&yd.call(a,"__wrapped__")?a:new d(a)}function d(a,b){this.__chain__=!!b,this.__wrapped__=a}function e(a,b,c,d,f){if(c){var g=c(a);if("undefined"!=typeof g)return g}var h=Ab(a);if(!h)return a;var i=Ed.call(a);if(!W[i])return a;var j=Ud[i];switch(i){case P:case Q:return new j(+a);case S:case V:return new j(a);case U:return g=j(a.source,E.exec(a)),g.lastIndex=a.lastIndex,g}var k=Xd(a);if(b){var m=!d;d||(d=l()),f||(f=l());for(var n=d.length;n--;)if(d[n]==a)return f[n];g=k?j(a.length):{}}else g=k?q(a):ce({},a);return k&&(yd.call(a,"index")&&(g.index=a.index),yd.call(a,"input")&&(g.input=a.input)),b?(d.push(a),f.push(g),(k?Tb:fe)(a,function(a,h){g[h]=e(a,b,c,d,f)}),m&&(o(d),o(f)),g):g}function g(a,b,c){if("function"!=typeof a)return Tc;if("undefined"==typeof b)return a;var d=a.__bindData__||Vd.funcNames&&!a.name;if("undefined"==typeof d){var e=J&&wd.call(a);Vd.funcNames||!e||F.test(e)||(d=!0),(Vd.funcNames||!d)&&(d=!Vd.funcDecomp||J.test(e),Wd(a,d))}if(d!==!0&&d&&1&d[1])return a;switch(c){case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)};case 4:return function(c,d,e,f){return a.call(b,c,d,e,f)}}return Dc(a,b)}function t(a,b,c,d){for(var e=(d||0)-1,f=a?a.length:0,g=[];++e<f;){var h=a[e];if(h&&"object"==typeof h&&"number"==typeof h.length&&(Xd(h)||jb(h))){b||(h=t(h,b,c));var i=-1,j=h.length,k=g.length;for(g.length+=j;++i<j;)g[k++]=h[i]}else c||g.push(h)}return g}function u(a,b,c,d,e,f){if(c){var g=c(a,b);if("undefined"!=typeof g)return!!g}if(a===b)return 0!==a||1/a==1/b;var h=typeof a,i=typeof b;if(!(a!==a||a&&Z[h]||b&&Z[i]))return!1;if(null==a||null==b)return a===b;var j=Ed.call(a),k=Ed.call(b);if(j==N&&(j=T),k==N&&(k=T),j!=k)return!1;switch(j){case P:case Q:return+a==+b;case S:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case U:case V:return a==nd(b)}var m=j==O;if(!m){if(yd.call(a,"__wrapped__ ")||yd.call(b,"__wrapped__"))return u(a.__wrapped__||a,b.__wrapped__||b,c,d,e,f);if(j!=T)return!1;var n=a.constructor,p=b.constructor;if(n!=p&&!(zb(n)&&n instanceof n&&zb(p)&&p instanceof p))return!1}var q=!e;e||(e=l()),f||(f=l());for(var r=e.length;r--;)if(e[r]==a)return f[r]==b;var s=0;if(g=!0,e.push(a),f.push(b),m){if(r=a.length,s=b.length,g=s==a.length,!g&&!d)return g;for(;s--;){var t=r,v=b[s];if(d)for(;t--&&!(g=u(a[t],v,c,d,e,f)););else if(!(g=u(a[s],v,c,d,e,f)))break}return g}return ee(b,function(b,h,i){return yd.call(i,h)?(s++,g=yd.call(a,h)&&u(a[h],b,c,d,e,f)):void 0}),g&&!d&&ee(a,function(a,b,c){return yd.call(c,b)?g=--s>-1:void 0}),q&&(o(e),o(f)),g}function y(a,b,c,d,e){(Xd(b)?Tb:fe)(b,function(b,f){var g,h,i=b,j=a[f];if(b&&((h=Xd(b))||ge(b))){for(var k=d.length;k--;)if(g=d[k]==b){j=e[k];break}if(!g){var l;c&&(i=c(j,b),(l="undefined"!=typeof i)&&(j=i)),l||(j=h?Xd(j)?j:[]:ge(j)?j:{}),d.push(b),e.push(j),l||y(j,b,c,d,e)}}else c&&(i=c(j,b),"undefined"==typeof i&&(i=b)),"undefined"!=typeof i&&(j=i);a[f]=j})}function $(a,c,d){var e=-1,g=gb(),h=a?a.length:0,i=[],k=!c&&h>=x&&g===b,m=d||k?l():i;if(k){var n=j(m);n?(g=f,m=n):(k=!1,m=d?m:(o(m),i))}for(;++e<h;){var q=a[e],r=d?d(q,e,a):q;(c?!e||m[m.length-1]!==r:g(m,r)<0)&&((d||k)&&m.push(r),i.push(q))}return k?(o(m.array),p(m)):d&&o(m),i}function ab(a){return function(b,d,e){var f={};d=c.createCallback(d,e,3);var g=-1,h=b?b.length:0;if("number"==typeof h)for(;++g<h;){var i=b[g];a(f,i,d(i,g,b),b)}else fe(b,function(b,c,e){a(f,b,d(b,c,e),e)});return f}}function bb(a,b,c,d,e,f){var g=1&b,h=2&b,i=4&b,j=8&b,k=16&b,l=32&b,m=a;if(!h&&!zb(a))throw new od;k&&!c.length&&(b&=-17,k=c=!1),l&&!d.length&&(b&=-33,l=d=!1);var n=a&&a.__bindData__;if(n)return!g||1&n[1]||(n[4]=e),!g&&1&n[1]&&(b|=8),!i||4&n[1]||(n[5]=f),k&&Ad.apply(n[2]||(n[2]=[]),c),l&&Ad.apply(n[3]||(n[3]=[]),d),n[1]|=b,bb.apply(null,n);if(!g||h||i||l||!(Vd.fastBind||Hd&&k))p=function(){var n=arguments,o=g?e:this;if((i||k||l)&&(n=Rd.call(n),k&&Fd.apply(n,c),l&&Ad.apply(n,d),i&&n.length<f))return b|=16,bb(a,j?b:-4&b,n,null,e,f);if(h&&(a=o[m]),this instanceof p){o=db(a.prototype);var q=a.apply(o,n);return Ab(q)?q:o}return a.apply(o,n)};else{if(k){var o=[e];Ad.apply(o,c)}var p=k?Hd.apply(a,o):Hd.call(a,e)}return Wd(p,Rd.call(arguments)),p}function db(a){return Ab(a)?Id(a):{}}function fb(a){return $d[a]}function gb(){var a=(a=c.indexOf)===nc?b:a;return a}function hb(a){var b,c;return a&&Ed.call(a)==T&&(b=a.constructor,!zb(b)||b instanceof b)?(ee(a,function(a,b){c=b}),"undefined"==typeof c||yd.call(a,c)):!1}function ib(a){return _d[a]}function jb(a){return a&&"object"==typeof a&&"number"==typeof a.length&&Ed.call(a)==N||!1}function kb(a,b,c,d){return"boolean"!=typeof b&&null!=b&&(d=c,c=b,b=!1),e(a,b,"function"==typeof c&&g(c,d,1))}function lb(a,b,c){return e(a,!0,"function"==typeof b&&g(b,c,1))}function mb(a,b,d){var e;return b=c.createCallback(b,d,3),fe(a,function(a,c,d){return b(a,c,d)?(e=c,!1):void 0}),e}function nb(a,b,d){var e;return b=c.createCallback(b,d,3),pb(a,function(a,c,d){return b(a,c,d)?(e=c,!1):void 0}),e}function ob(a,b,c){var d=[];ee(a,function(a,b){d.push(b,a)});var e=d.length;for(b=g(b,c,3);e--&&b(d[e--],d[e],a)!==!1;);return a}function pb(a,b,c){var d=Zd(a),e=d.length;for(b=g(b,c,3);e--;){var f=d[e];if(b(a[f],f,a)===!1)break}return a}function qb(a){var b=[];return ee(a,function(a,c){zb(a)&&b.push(c)}),b.sort()}function rb(a,b){return a?yd.call(a,b):!1}function sb(a){for(var b=-1,c=Zd(a),d=c.length,e={};++b<d;){var f=c[b];e[a[f]]=f}return e}function tb(a){return a===!0||a===!1||Ed.call(a)==P}function ub(a){return a?"object"==typeof a&&Ed.call(a)==Q:!1}function vb(a){return a?1===a.nodeType:!1}function wb(a){var b=!0;if(!a)return b;var c=Ed.call(a),d=a.length;return c==O||c==V||c==N||c==T&&"number"==typeof d&&zb(a.splice)?!d:(fe(a,function(){return b=!1}),b)}function xb(a,b,c,d){return u(a,b,"function"==typeof c&&g(c,d,2))}function yb(a){return Kd(a)&&!Ld(parseFloat(a))}function zb(a){return"function"==typeof a}function Ab(a){return!(!a||!Z[typeof a])}function Bb(a){return Db(a)&&a!=+a}function Cb(a){return null===a}function Db(a){return"number"==typeof a||Ed.call(a)==S}function Eb(a){return a?"object"==typeof a&&Ed.call(a)==U:!1}function Fb(a){return"string"==typeof a||Ed.call(a)==V}function Gb(a){return"undefined"==typeof a}function Hb(a){var b=arguments,c=2;if(!Ab(a))return a;if("number"!=typeof b[2]&&(c=b.length),c>3&&"function"==typeof b[c-2])var d=g(b[--c-1],b[c--],2);else c>2&&"function"==typeof b[c-1]&&(d=b[--c]);for(var e=Rd.call(arguments,1,c),f=-1,h=l(),i=l();++f<c;)y(a,e[f],d,h,i);return o(h),o(i),a}function Ib(a,b,d){var e=gb(),f="function"==typeof b,g={};if(f)b=c.createCallback(b,d,3);else var h=t(arguments,!0,!1,1);return ee(a,function(a,c,d){(f?!b(a,c,d):e(h,c)<0)&&(g[c]=a)}),g}function Jb(a){for(var b=-1,c=Zd(a),d=c.length,e=fd(d);++b<d;){var f=c[b];e[b]=[f,a[f]]}return e}function Kb(a,b,d){var e={};if("function"!=typeof b)for(var f=-1,g=t(arguments,!0,!1,1),h=Ab(a)?g.length:0;++f<h;){var i=g[f];i in a&&(e[i]=a[i])}else b=c.createCallback(b,d,3),ee(a,function(a,c,d){b(a,c,d)&&(e[c]=a)});return e}function Lb(a,b,c,d){var e=Xd(a);if(b=g(b,d,4),null==c)if(e)c=[];else{var f=a&&a.constructor,h=f&&f.prototype;c=db(h)}return(e?Tb:fe)(a,function(a,d,e){return b(c,a,d,e)}),c}function Mb(a){for(var b=-1,c=Zd(a),d=c.length,e=fd(d);++b<d;)e[b]=a[c[b]];return e}function Nb(a){for(var b=arguments,c=-1,d=t(b,!0,!1,1),e=b[2]&&b[2][b[1]]===a?1:d.length,f=fd(e);++c<e;)f[c]=a[d[c]];return f}function Ob(a,b,c){var d=-1,e=gb(),f=a?a.length:0,g=!1;return c=(0>c?Nd(0,f+c):c)||0,Xd(a)?g=e(a,b,c)>-1:"number"==typeof f?g=(Fb(a)?a.indexOf(b,c):e(a,b,c))>-1:fe(a,function(a){return++d>=c?!(g=a===b):void 0}),g}function Pb(a,b,d){var e=!0;b=c.createCallback(b,d,3);var f=-1,g=a?a.length:0;if("number"==typeof g)for(;++f<g&&(e=!!b(a[f],f,a)););else fe(a,function(a,c,d){return e=!!b(a,c,d)});return e}function Qb(a,b,d){var e=[];b=c.createCallback(b,d,3);var f=-1,g=a?a.length:0;if("number"==typeof g)for(;++f<g;){var h=a[f];b(h,f,a)&&e.push(h)}else fe(a,function(a,c,d){b(a,c,d)&&e.push(a)});return e}function Rb(a,b,d){b=c.createCallback(b,d,3);var e=-1,f=a?a.length:0;if("number"!=typeof f){var g;return fe(a,function(a,c,d){return b(a,c,d)?(g=a,!1):void 0}),g}for(;++e<f;){var h=a[e];if(b(h,e,a))return h}}function Sb(a,b,d){var e;return b=c.createCallback(b,d,3),Ub(a,function(a,c,d){return b(a,c,d)?(e=a,!1):void 0}),e}function Tb(a,b,c){var d=-1,e=a?a.length:0;if(b=b&&"undefined"==typeof c?b:g(b,c,3),"number"==typeof e)for(;++d<e&&b(a[d],d,a)!==!1;);else fe(a,b);return a}function Ub(a,b,c){var d=a?a.length:0;if(b=b&&"undefined"==typeof c?b:g(b,c,3),"number"==typeof d)for(;d--&&b(a[d],d,a)!==!1;);else{var e=Zd(a);d=e.length,fe(a,function(a,c,f){return c=e?e[--d]:--d,b(f[c],c,f)})}return a}function Vb(a,b){var c=Rd.call(arguments,2),d=-1,e="function"==typeof b,f=a?a.length:0,g=fd("number"==typeof f?f:0);return Tb(a,function(a){g[++d]=(e?b:a[b]).apply(a,c)}),g}function Wb(a,b,d){var e=-1,f=a?a.length:0;if(b=c.createCallback(b,d,3),"number"==typeof f)for(var g=fd(f);++e<f;)g[e]=b(a[e],e,a);else g=[],fe(a,function(a,c,d){g[++e]=b(a,c,d)});return g}function Xb(a,b,d){var e=-1/0,f=e;if(!b&&Xd(a))for(var g=-1,i=a.length;++g<i;){var j=a[g];j>f&&(f=j)}else b=!b&&Fb(a)?h:c.createCallback(b,d,3),Tb(a,function(a,c,d){var g=b(a,c,d);g>e&&(e=g,f=a)});return f}function Yb(a,b,d){var e=1/0,f=e;if(!b&&Xd(a))for(var g=-1,i=a.length;++g<i;){var j=a[g];f>j&&(f=j)}else b=!b&&Fb(a)?h:c.createCallback(b,d,3),Tb(a,function(a,c,d){var g=b(a,c,d);e>g&&(e=g,f=a)});return f}function Zb(a,b){var c=-1,d=a?a.length:0;if("number"==typeof d)for(var e=fd(d);++c<d;)e[c]=a[c][b];return e||Wb(a,b)}function $b(a,b,c,d){if(!a)return c;var e=arguments.length<3;b=g(b,d,4);var f=-1,h=a.length;if("number"==typeof h)for(e&&(c=a[++f]);++f<h;)c=b(c,a[f],f,a);else fe(a,function(a,d,f){c=e?(e=!1,a):b(c,a,d,f)});return c}function _b(a,b,c,d){var e=arguments.length<3;return b=g(b,d,4),Ub(a,function(a,d,f){c=e?(e=!1,a):b(c,a,d,f)}),c}function ac(a,b,d){return b=c.createCallback(b,d,3),Qb(a,function(a,c,d){return!b(a,c,d)})}function bc(a,b,c){var d=a?a.length:0;if("number"!=typeof d&&(a=Mb(a)),null==b||c)return a?a[Wc(d-1)]:s;var e=cc(a);return e.length=Od(Nd(0,b),e.length),e}function cc(a){var b=-1,c=a?a.length:0,d=fd("number"==typeof c?c:0);return Tb(a,function(a){var c=Wc(++b);d[b]=d[c],d[c]=a}),d}function dc(a){var b=a?a.length:0;return"number"==typeof b?b:Zd(a).length}function ec(a,b,d){var e;b=c.createCallback(b,d,3);var f=-1,g=a?a.length:0;if("number"==typeof g)for(;++f<g&&!(e=b(a[f],f,a)););else fe(a,function(a,c,d){return!(e=b(a,c,d))});return!!e}function fc(a,b,d){var e=-1,f=a?a.length:0,g=fd("number"==typeof f?f:0);for(b=c.createCallback(b,d,3),Tb(a,function(a,c,d){var f=g[++e]=m();f.criteria=b(a,c,d),f.index=e,f.value=a}),f=g.length,g.sort(i);f--;){var h=g[f];g[f]=h.value,p(h)}return g}function gc(a){return a&&"number"==typeof a.length?q(a):Mb(a)}function hc(a){for(var b=-1,c=a?a.length:0,d=[];++b<c;){var e=a[b];e&&d.push(e)}return d}function ic(a){var c=-1,d=gb(),e=a?a.length:0,g=t(arguments,!0,!0,1),h=[],i=e>=x&&d===b;if(i){var k=j(g);k?(d=f,g=k):i=!1}for(;++c<e;){var l=a[c];d(g,l)<0&&h.push(l)}return i&&p(g),h}function jc(a,b,d){var e=-1,f=a?a.length:0;for(b=c.createCallback(b,d,3);++e<f;)if(b(a[e],e,a))return e;return-1}function kc(a,b,d){var e=a?a.length:0;for(b=c.createCallback(b,d,3);e--;)if(b(a[e],e,a))return e;return-1}function lc(a,b,d){var e=0,f=a?a.length:0;if("number"!=typeof b&&null!=b){var g=-1;for(b=c.createCallback(b,d,3);++g<f&&b(a[g],g,a);)e++}else if(e=b,null==e||d)return a?a[0]:s;return q(a,0,Od(Nd(0,e),f))}function mc(a,b,c,d){return"boolean"!=typeof b&&null!=b&&(d=c,c=d&&d[b]===a?null:b,b=!1),null!=c&&(a=Wb(a,c,d)),t(a,b)}function nc(a,c,d){if("number"==typeof d){var e=a?a.length:0;d=0>d?Nd(0,e+d):d||0}else if(d){var f=wc(a,c);return a[f]===c?f:-1}return b(a,c,d)}function oc(a,b,d){var e=0,f=a?a.length:0;if("number"!=typeof b&&null!=b){var g=f;for(b=c.createCallback(b,d,3);g--&&b(a[g],g,a);)e++}else e=null==b||d?1:b||e;return q(a,0,Od(Nd(0,f-e),f))}function pc(a){for(var c=arguments,d=c.length,e=-1,g=l(),h=-1,i=gb(),k=a?a.length:0,m=[],n=l();++e<d;){var q=c[e];g[e]=i===b&&(q?q.length:0)>=x&&j(e?c[e]:n)}a:for(;++h<k;){var r=g[0];if(q=a[h],(r?f(r,q):i(n,q))<0){for(e=d,(r||n).push(q);--e;)if(r=g[e],(r?f(r,q):i(c[e],q))<0)continue a;m.push(q)}}for(;d--;)r=g[d],r&&p(r);return o(g),o(n),m}function qc(a,b,d){var e=0,f=a?a.length:0;if("number"!=typeof b&&null!=b){var g=f;for(b=c.createCallback(b,d,3);g--&&b(a[g],g,a);)e++}else if(e=b,null==e||d)return a?a[f-1]:s;return q(a,Nd(0,f-e))}function rc(a,b,c){var d=a?a.length:0;for("number"==typeof c&&(d=(0>c?Nd(0,d+c):Od(c,d-1))+1);d--;)if(a[d]===b)return d;return-1}function sc(a){for(var b=arguments,c=0,d=b.length,e=a?a.length:0;++c<d;)for(var f=-1,g=b[c];++f<e;)a[f]===g&&(Dd.call(a,f--,1),e--);return a}function tc(a,b,c){a=+a||0,c="number"==typeof c?c:+c||1,null==b&&(b=a,a=0);for(var d=-1,e=Nd(0,td((b-a)/(c||1))),f=fd(e);++d<e;)f[d]=a,a+=c;return f}function uc(a,b,d){var e=-1,f=a?a.length:0,g=[];for(b=c.createCallback(b,d,3);++e<f;){var h=a[e];b(h,e,a)&&(g.push(h),Dd.call(a,e--,1),f--)}return g}function vc(a,b,d){if("number"!=typeof b&&null!=b){var e=0,f=-1,g=a?a.length:0;for(b=c.createCallback(b,d,3);++f<g&&b(a[f],f,a);)e++}else e=null==b||d?1:Nd(0,b);return q(a,e)}function wc(a,b,d,e){var f=0,g=a?a.length:f;for(d=d?c.createCallback(d,e,1):Tc,b=d(b);g>f;){var h=f+g>>>1;d(a[h])<b?f=h+1:g=h}return f}function xc(){return $(t(arguments,!0,!0))}function yc(a,b,d,e){return"boolean"!=typeof b&&null!=b&&(e=d,d=e&&e[b]===a?null:b,b=!1),null!=d&&(d=c.createCallback(d,e,3)),$(a,b,d)}function zc(a){return ic(a,Rd.call(arguments,1))}function Ac(){for(var a=arguments.length>1?arguments:arguments[0],b=-1,c=a?Xb(Zb(a,"length")):0,d=fd(0>c?0:c);++b<c;)d[b]=Zb(a,b);return d}function Bc(a,b){for(var c=-1,d=a?a.length:0,e={};++c<d;){var f=a[c];b?e[f]=b[c]:f&&(e[f[0]]=f[1])}return e}function Cc(a,b){if(!zb(b))throw new od;return function(){return--a<1?b.apply(this,arguments):void 0}}function Dc(a,b){return arguments.length>2?bb(a,17,Rd.call(arguments,2),null,b):bb(a,1,null,null,b)}function Ec(a){for(var b=arguments.length>1?t(arguments,!0,!1,1):qb(a),c=-1,d=b.length;++c<d;){var e=b[c];a[e]=bb(a[e],1,null,null,a)}return a}function Fc(a,b){return arguments.length>2?bb(b,19,Rd.call(arguments,2),null,a):bb(b,3,null,null,a)}function Gc(){for(var a=arguments,b=a.length;b--;)if(!zb(a[b]))throw new od;return function(){for(var b=arguments,c=a.length;c--;)b=[a[c].apply(this,b)];return b[0]}}function Hc(a,b,c){var d=typeof a;if(null==a||"function"==d)return g(a,b,c);if("object"!=d)return function(b){return b[a]};var e=Zd(a),f=e[0],h=a[f];return 1!=e.length||h!==h||Ab(h)?function(b){for(var c=e.length,d=!1;c--&&(d=u(b[e[c]],a[e[c]],null,!0)););return d}:function(a){var b=a[f];return h===b&&(0!==h||1/h==1/b)}}function Ic(a,b){return b="number"==typeof b?b:+b||a.length,bb(a,4,null,null,null,b)}function Jc(a,b,c){var d,e,f,g,h,i,j,k=0,l=!1,m=!0;if(!zb(a))throw new od;if(b=Nd(0,b)||0,c===!0){var n=!0;m=!1}else Ab(c)&&(n=c.leading,l="maxWait"in c&&(Nd(b,c.maxWait)||0),m="trailing"in c?c.trailing:m);var o=function(){var c=b-(zd()-g);if(0>=c){e&&ud(e);var l=j;e=i=j=s,l&&(k=zd(),f=a.apply(h,d))}else i=Cd(o,c)},p=function(){i&&ud(i),e=i=j=s,(m||l!==b)&&(k=zd(),f=a.apply(h,d))};return function(){if(d=arguments,g=zd(),h=this,j=m&&(i||!n),l===!1)var c=n&&!i;else{e||n||(k=g);var q=l-(g-k);0>=q?(e&&(e=ud(e)),k=g,f=a.apply(h,d)):e||(e=Cd(p,q))}return i||b===l||(i=Cd(o,b)),c&&(f=a.apply(h,d)),f}}function Kc(a){if(!zb(a))throw new od;var b=Rd.call(arguments,1);return Cd(function(){a.apply(s,b)},1)}function Lc(a,b){if(!zb(a))throw new od;var c=Rd.call(arguments,2);return Cd(function(){a.apply(s,c)},b)}function Mc(a,b){if(!zb(a))throw new od;var c=function(){var d=c.cache,e=b?b.apply(this,arguments):w+arguments[0];return yd.call(d,e)?d[e]:d[e]=a.apply(this,arguments)};return c.cache={},c}function Nc(a){var b,c;if(!zb(a))throw new od;return function(){return b?c:(b=!0,c=a.apply(this,arguments),a=null,c)}}function Oc(a){return bb(a,16,Rd.call(arguments,1))}function Pc(a){return bb(a,32,null,Rd.call(arguments,1))}function Qc(a,b,c){var d=!0,e=!0;if(!zb(a))throw new od;c===!1?d=!1:Ab(c)&&(d="leading"in c?c.leading:d,e="trailing"in c?c.trailing:e),X.leading=d,X.maxWait=b,X.trailing=e;var f=Jc(a,b,X);return f}function Rc(a,b){if(!zb(b))throw new od;return function(){var c=[a];return Ad.apply(c,arguments),b.apply(this,c)}}function Sc(a){return null==a?"":nd(a).replace(be,fb)}function Tc(a){return a}function Uc(a,b){var e=a,f=!b||zb(e);b||(e=d,b=a,a=c),Tb(qb(b),function(c){var d=a[c]=b[c];f&&(e.prototype[c]=function(){var b=this.__wrapped__,c=[b];Ad.apply(c,arguments);var f=d.apply(a,c);return b&&"object"==typeof b&&b===f?this:(f=new e(f),f.__chain__=this.__chain__,f)})})}function Vc(){return a._=rd,this}function Wc(a,b,c){var d=null==a,e=null==b;null==c&&("boolean"==typeof a&&e?(c=a,a=1):e||"boolean"!=typeof b||(c=b,e=!0)),d&&e&&(b=1),a=+a||0,e?(b=a,a=0):b=+b||0;var f=Qd();return c||a%1||b%1?Od(a+f*(b-a+parseFloat("1e-"+((f+"").length-1))),b):a+vd(f*(b-a+1))}function Xc(a,b){if(a){var c=a[b];return zb(c)?a[b]():c}}function Yc(a,b,d){var e=c.templateSettings;a||(a=""),d=de({},d,e);var f,g=de({},d.imports,e.imports),h=Zd(g),i=Mb(g),j=0,l=d.interpolate||I,m="__p += '",n=md((d.escape||I).source+"|"+l.source+"|"+(l===G?D:I).source+"|"+(d.evaluate||I).source+"|$","g");a.replace(n,function(b,c,d,e,g,h){return d||(d=e),m+=a.slice(j,h).replace(K,k),c&&(m+="' +\n__e("+c+") +\n'"),g&&(f=!0,m+="';\n"+g+";\n__p += '"),d&&(m+="' +\n((__t = ("+d+")) == null ? '' : __t) +\n'"),j=h+b.length,b}),m+="';\n";var o=d.variable,p=o;p||(o="obj",m="with ("+o+") {\n"+m+"\n}\n"),m=(f?m.replace(A,""):m).replace(B,"$1").replace(C,"$1;"),m="function("+o+") {\n"+(p?"":o+" || ("+o+" = {});\n")+"var __t, __p = '', __e = _.escape"+(f?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+m+"return __p\n}";var q="\n/*\n//# sourceURL="+(d.sourceURL||"/lodash/template/source["+M++ +"]")+"\n*/";try{var r=id(h,"return "+m+q).apply(s,i)}catch(t){throw t.source=m,t}return b?r(b):(r.source=m,r)}function Zc(a,b,c){a=(a=+a)>-1?a:0;var d=-1,e=fd(a);for(b=g(b,c,1);++d<a;)e[d]=b(d);return e}function $c(a){return null==a?"":nd(a).replace(ae,ib)}function _c(a){var b=++v;return nd(null==a?"":a)+b}function ad(a){return a=new d(a),a.__chain__=!0,a}function bd(a,b){return b(a),a}function cd(){return this.__chain__=!0,this}function dd(){return nd(this.__wrapped__)}function ed(){return this.__wrapped__}a=a?eb.defaults(_.Object(),a,eb.pick(_,L)):_;var fd=a.Array,gd=a.Boolean,hd=a.Date,id=a.Function,jd=a.Math,kd=a.Number,ld=a.Object,md=a.RegExp,nd=a.String,od=a.TypeError,pd=[],qd=ld.prototype,rd=a._,sd=md("^"+nd(qd.valueOf).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),td=jd.ceil,ud=a.clearTimeout,vd=jd.floor,wd=id.prototype.toString,xd=sd.test(xd=ld.getPrototypeOf)&&xd,yd=qd.hasOwnProperty,zd=sd.test(zd=hd.now)&&zd||function(){return+new hd},Ad=pd.push,Bd=a.setImmediate,Cd=a.setTimeout,Dd=pd.splice,Ed=qd.toString,Fd=pd.unshift,Gd=function(){try{var a={},b=sd.test(b=ld.defineProperty)&&b,c=b(a,a,a)&&b}catch(d){}return c}(),Hd=sd.test(Hd=Ed.bind)&&Hd,Id=sd.test(Id=ld.create)&&Id,Jd=sd.test(Jd=fd.isArray)&&Jd,Kd=a.isFinite,Ld=a.isNaN,Md=sd.test(Md=ld.keys)&&Md,Nd=jd.max,Od=jd.min,Pd=a.parseInt,Qd=jd.random,Rd=pd.slice,Sd=sd.test(a.attachEvent),Td=Hd&&!/\n|true/.test(Hd+Sd),Ud={};Ud[O]=fd,Ud[P]=gd,Ud[Q]=hd,Ud[R]=id,Ud[T]=ld,Ud[S]=kd,Ud[U]=md,Ud[V]=nd,d.prototype=c.prototype;var Vd=c.support={};Vd.fastBind=Hd&&!Td,Vd.funcDecomp=!sd.test(a.WinRTError)&&J.test(r),Vd.funcNames="string"==typeof id.name,c.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:G,variable:"",imports:{_:c}},Id||(db=function(a){if(Ab(a)){n.prototype=a;var b=new n;n.prototype=null}return b||{}});var Wd=Gd?function(a,b){Y.value=b,Gd(a,"__bindData__",Y)}:n,Xd=Jd||function(a){return a&&"object"==typeof a&&"number"==typeof a.length&&Ed.call(a)==O||!1},Yd=function(a){var b,c=a,d=[];if(!c)return d;if(!Z[typeof a])return d;for(b in c)yd.call(c,b)&&d.push(b);return d},Zd=Md?function(a){return Ab(a)?Md(a):[]}:Yd,$d={"&":"&","<":"<",">":">",'"':""","'":"'"},_d=sb($d),ae=md("("+Zd(_d).join("|")+")","g"),be=md("["+Zd($d).join("")+"]","g"),ce=function(a,b,c){var d,e=a,f=e;if(!e)return f;var h=arguments,i=0,j="number"==typeof c?2:h.length;if(j>3&&"function"==typeof h[j-2])var k=g(h[--j-1],h[j--],2);else j>2&&"function"==typeof h[j-1]&&(k=h[--j]);for(;++i<j;)if(e=h[i],e&&Z[typeof e])for(var l=-1,m=Z[typeof e]&&Zd(e),n=m?m.length:0;++l<n;)d=m[l],f[d]=k?k(f[d],e[d]):e[d];return f},de=function(a,b,c){var d,e=a,f=e;if(!e)return f;for(var g=arguments,h=0,i="number"==typeof c?2:g.length;++h<i;)if(e=g[h],e&&Z[typeof e])for(var j=-1,k=Z[typeof e]&&Zd(e),l=k?k.length:0;++j<l;)d=k[j],"undefined"==typeof f[d]&&(f[d]=e[d]);
|
||
return f},ee=function(a,b,c){var d,e=a,f=e;if(!e)return f;if(!Z[typeof e])return f;b=b&&"undefined"==typeof c?b:g(b,c,3);for(d in e)if(b(e[d],d,a)===!1)return f;return f},fe=function(a,b,c){var d,e=a,f=e;if(!e)return f;if(!Z[typeof e])return f;b=b&&"undefined"==typeof c?b:g(b,c,3);for(var h=-1,i=Z[typeof e]&&Zd(e),j=i?i.length:0;++h<j;)if(d=i[h],b(e[d],d,a)===!1)return f;return f},ge=function(a){if(!a||Ed.call(a)!=T)return!1;var b=a.valueOf,c="function"==typeof b&&(c=xd(b))&&xd(c);return c?a==c||xd(a)==c:hb(a)},he=ab(function(a,b,c){yd.call(a,c)?a[c]++:a[c]=1}),ie=ab(function(a,b,c){(yd.call(a,c)?a[c]:a[c]=[]).push(b)}),je=ab(function(a,b,c){a[c]=b}),ke=Qb;Td&&cb&&"function"==typeof Bd&&(Kc=function(b){if(!zb(b))throw new od;return Bd.apply(a,arguments)});var le=8==Pd(z+"08")?Pd:function(a,b){return Pd(Fb(a)?a.replace(H,""):a,b||0)};return c.after=Cc,c.assign=ce,c.at=Nb,c.bind=Dc,c.bindAll=Ec,c.bindKey=Fc,c.chain=ad,c.compact=hc,c.compose=Gc,c.countBy=he,c.createCallback=Hc,c.curry=Ic,c.debounce=Jc,c.defaults=de,c.defer=Kc,c.delay=Lc,c.difference=ic,c.filter=Qb,c.flatten=mc,c.forEach=Tb,c.forEachRight=Ub,c.forIn=ee,c.forInRight=ob,c.forOwn=fe,c.forOwnRight=pb,c.functions=qb,c.groupBy=ie,c.indexBy=je,c.initial=oc,c.intersection=pc,c.invert=sb,c.invoke=Vb,c.keys=Zd,c.map=Wb,c.max=Xb,c.memoize=Mc,c.merge=Hb,c.min=Yb,c.omit=Ib,c.once=Nc,c.pairs=Jb,c.partial=Oc,c.partialRight=Pc,c.pick=Kb,c.pluck=Zb,c.pull=sc,c.range=tc,c.reject=ac,c.remove=uc,c.rest=vc,c.shuffle=cc,c.sortBy=fc,c.tap=bd,c.throttle=Qc,c.times=Zc,c.toArray=gc,c.transform=Lb,c.union=xc,c.uniq=yc,c.values=Mb,c.where=ke,c.without=zc,c.wrap=Rc,c.zip=Ac,c.zipObject=Bc,c.collect=Wb,c.drop=vc,c.each=Tb,c.eachRight=Ub,c.extend=ce,c.methods=qb,c.object=Bc,c.select=Qb,c.tail=vc,c.unique=yc,c.unzip=Ac,Uc(c),c.clone=kb,c.cloneDeep=lb,c.contains=Ob,c.escape=Sc,c.every=Pb,c.find=Rb,c.findIndex=jc,c.findKey=mb,c.findLast=Sb,c.findLastIndex=kc,c.findLastKey=nb,c.has=rb,c.identity=Tc,c.indexOf=nc,c.isArguments=jb,c.isArray=Xd,c.isBoolean=tb,c.isDate=ub,c.isElement=vb,c.isEmpty=wb,c.isEqual=xb,c.isFinite=yb,c.isFunction=zb,c.isNaN=Bb,c.isNull=Cb,c.isNumber=Db,c.isObject=Ab,c.isPlainObject=ge,c.isRegExp=Eb,c.isString=Fb,c.isUndefined=Gb,c.lastIndexOf=rc,c.mixin=Uc,c.noConflict=Vc,c.parseInt=le,c.random=Wc,c.reduce=$b,c.reduceRight=_b,c.result=Xc,c.runInContext=r,c.size=dc,c.some=ec,c.sortedIndex=wc,c.template=Yc,c.unescape=$c,c.uniqueId=_c,c.all=Pb,c.any=ec,c.detect=Rb,c.findWhere=Rb,c.foldl=$b,c.foldr=_b,c.include=Ob,c.inject=$b,fe(c,function(a,b){c.prototype[b]||(c.prototype[b]=function(){var b=[this.__wrapped__],e=this.__chain__;Ad.apply(b,arguments);var f=a.apply(c,b);return e?new d(f,e):f})}),c.first=lc,c.last=qc,c.sample=bc,c.take=lc,c.head=lc,fe(c,function(a,b){var e="sample"!==b;c.prototype[b]||(c.prototype[b]=function(b,c){var f=this.__chain__,g=a(this.__wrapped__,b,c);return f||null!=b&&(!c||e&&"function"==typeof b)?new d(g,f):g})}),c.VERSION="2.2.1",c.prototype.chain=cd,c.prototype.toString=dd,c.prototype.value=ed,c.prototype.valueOf=ed,Tb(["join","pop","shift"],function(a){var b=pd[a];c.prototype[a]=function(){var a=this.__chain__,c=b.apply(this.__wrapped__,arguments);return a?new d(c,a):c}}),Tb(["push","reverse","sort","unshift"],function(a){var b=pd[a];c.prototype[a]=function(){return b.apply(this.__wrapped__,arguments),this}}),Tb(["concat","slice","splice"],function(a){var b=pd[a];c.prototype[a]=function(){return new d(b.apply(this.__wrapped__,arguments),this.__chain__)}}),c}var s,t=[],u=[],v=0,w=+new Date+"",x=75,y=40,z=" \f \n\r\u2028\u2029 ",A=/\b__p \+= '';/g,B=/\b(__p \+=) '' \+/g,C=/(__e\(.*?\)|\b__t\)) \+\n'';/g,D=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,E=/\w*$/,F=/^function[ \n\r\t]+\w/,G=/<%=([\s\S]+?)%>/g,H=RegExp("^["+z+"]*0+(?=.$)"),I=/($^)/,J=/\bthis\b/,K=/['\n\r\t\u2028\u2029\\]/g,L=["Array","Boolean","Date","Function","Math","Number","Object","RegExp","String","_","attachEvent","clearTimeout","isFinite","isNaN","parseInt","setImmediate","setTimeout"],M=0,N="[object Arguments]",O="[object Array]",P="[object Boolean]",Q="[object Date]",R="[object Function]",S="[object Number]",T="[object Object]",U="[object RegExp]",V="[object String]",W={};W[R]=!1,W[N]=W[O]=W[P]=W[Q]=W[S]=W[T]=W[U]=W[V]=!0;var X={leading:!1,maxWait:0,trailing:!1},Y={configurable:!1,enumerable:!1,value:null,writable:!1},Z={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},$={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},_=Z[typeof window]&&window||this,ab=Z[typeof d]&&d&&!d.nodeType&&d,bb=Z[typeof c]&&c&&!c.nodeType&&c,cb=bb&&bb.exports===ab&&ab,db=Z[typeof e]&&e;!db||db.global!==db&&db.window!==db||(_=db);var eb=r();"function"==typeof a&&"object"==typeof a.amd&&a.amd?(_._=eb,a(function(){return eb})):ab&&bb?cb?(bb.exports=eb)._=eb:ab._=eb:_._=eb}).call(this)},{}],14:[function(a,b){var c={Client:a("./lib/client")};b.exports=c},{"./lib/client":16}],15:[function(a,b){var c=a("./client_action");a("./errors");var d=b.exports={};d._namespaces=["cluster","indices"],d.bulk=c({methods:["POST","PUT"],params:{consistency:{type:"enum",options:["one","quorum","all"]},refresh:{type:"boolean"},replication:{type:"enum","default":"sync",options:["sync","async"]},type:{type:"string"}},urls:[{fmt:"/<%=index%>/<%=type%>/_bulk",req:{index:{type:"string"},type:{type:"string"}}},{fmt:"/<%=index%>/_bulk",req:{index:{type:"string"}}},{fmt:"/_bulk"}],bulkBody:!0}),d.clearScroll=c({methods:["DELETE"],params:{},urls:[{fmt:"/_search/scroll/<%=scrollId%>",req:{scrollId:{type:"list"}}}]}),d.cluster=function e(a){return this instanceof e?(this.client=a,void 0):new e(a)},d.cluster.prototype.getSettings=c({methods:["GET"],params:{},urls:[{fmt:"/_cluster/settings"}]}),d.cluster.prototype.health=c({methods:["GET"],params:{level:{type:"enum","default":"cluster",options:["cluster","indices","shards"]},local:{type:"boolean"},masterTimeout:{type:"time",name:"master_timeout"},timeout:{type:"time"},waitForActiveShards:{type:"number",name:"wait_for_active_shards"},waitForNodes:{type:"string",name:"wait_for_nodes"},waitForRelocatingShards:{type:"number",name:"wait_for_relocating_shards"},waitForStatus:{type:"enum","default":null,options:["green","yellow","red"],name:"wait_for_status"}},urls:[{fmt:"/_cluster/health/<%=index%>",req:{index:{type:"string"}}},{fmt:"/_cluster/health"}]}),d.cluster.prototype.nodeHotThreads=c({methods:["GET"],params:{interval:{type:"time"},snapshots:{type:"number"},threads:{type:"number"},type:{type:"enum",options:["cpu","wait","block"]}},urls:[{fmt:"/_nodes/<%=nodeId%>/hotthreads",req:{nodeId:{type:"list"}}},{fmt:"/_nodes/hotthreads"}]}),d.cluster.prototype.nodeInfo=c({methods:["GET"],params:{all:{type:"boolean"},clear:{type:"boolean"},http:{type:"boolean"},jvm:{type:"boolean"},network:{type:"boolean"},os:{type:"boolean"},plugin:{type:"boolean"},process:{type:"boolean"},settings:{type:"boolean"},threadPool:{type:"boolean",name:"thread_pool"},timeout:{type:"time"},transport:{type:"boolean"}},urls:[{fmt:"/_nodes/<%=nodeId%>",req:{nodeId:{type:"list"}}},{fmt:"/_nodes"}]}),d.cluster.prototype.nodeShutdown=c({methods:["POST"],params:{delay:{type:"time"},exit:{type:"boolean"}},urls:[{fmt:"/_cluster/nodes/<%=nodeId%>/_shutdown",req:{nodeId:{type:"list"}}},{fmt:"/_shutdown"}]}),d.cluster.prototype.nodeStats=c({methods:["GET"],params:{all:{type:"boolean"},clear:{type:"boolean"},fields:{type:"list"},fs:{type:"boolean"},http:{type:"boolean"},indices:{type:"boolean"},jvm:{type:"boolean"},network:{type:"boolean"},os:{type:"boolean"},process:{type:"boolean"},threadPool:{type:"boolean",name:"thread_pool"},transport:{type:"boolean"}},urls:[{fmt:"/_nodes/<%=nodeId%>/stats",req:{nodeId:{type:"list"}}},{fmt:"/_nodes/stats"}]}),d.cluster.prototype.putSettings=c({methods:["PUT"],params:{},urls:[{fmt:"/_cluster/settings"}]}),d.cluster.prototype.reroute=c({methods:["POST"],params:{dryRun:{type:"boolean",name:"dry_run"},filterMetadata:{type:"boolean",name:"filter_metadata"}},urls:[{fmt:"/_cluster/reroute"}]}),d.cluster.prototype.state=c({methods:["GET"],params:{filterBlocks:{type:"boolean",name:"filter_blocks"},filterIndexTemplates:{type:"boolean",name:"filter_index_templates"},filterIndices:{type:"list",name:"filter_indices"},filterMetadata:{type:"boolean",name:"filter_metadata"},filterNodes:{type:"boolean",name:"filter_nodes"},filterRoutingTable:{type:"boolean",name:"filter_routing_table"},local:{type:"boolean"},masterTimeout:{type:"time",name:"master_timeout"}},urls:[{fmt:"/_cluster/state"}]}),d.count=c({methods:["POST","GET"],params:{ignoreIndices:{type:"enum","default":"none",options:["none","missing"],name:"ignore_indices"},minScore:{type:"number",name:"min_score"},preference:{type:"string"},routing:{type:"string"},source:{type:"string"}},urls:[{fmt:"/<%=index%>/<%=type%>/_count",req:{index:{type:"list"},type:{type:"list"}}},{fmt:"/<%=index%>/_count",req:{index:{type:"list"}}},{fmt:"/_count"}]}),d.create=c({methods:["POST","PUT"],params:{consistency:{type:"enum",options:["one","quorum","all"]},id:{type:"string"},parent:{type:"string"},percolate:{type:"string"},refresh:{type:"boolean"},replication:{type:"enum","default":"sync",options:["sync","async"]},routing:{type:"string"},timeout:{type:"time"},timestamp:{type:"time"},ttl:{type:"duration"},version:{type:"number"},versionType:{type:"enum",options:["internal","external"],name:"version_type"}},urls:[{fmt:"/<%=index%>/<%=type%>/<%=id%>/_create",req:{index:{type:"string"},type:{type:"string"},id:{type:"string"}}},{fmt:"/<%=index%>/<%=type%>",req:{index:{type:"string"},type:{type:"string"}}}]}),d["delete"]=c({methods:["DELETE"],params:{consistency:{type:"enum",options:["one","quorum","all"]},parent:{type:"string"},refresh:{type:"boolean"},replication:{type:"enum","default":"sync",options:["sync","async"]},routing:{type:"string"},timeout:{type:"time"},version:{type:"number"},versionType:{type:"enum",options:["internal","external"],name:"version_type"}},urls:[{fmt:"/<%=index%>/<%=type%>/<%=id%>",req:{index:{type:"string"},type:{type:"string"},id:{type:"string"}}}]}),d.deleteByQuery=c({methods:["DELETE"],params:{analyzer:{type:"string"},consistency:{type:"enum",options:["one","quorum","all"]},defaultOperator:{type:"enum","default":"OR",options:["AND","OR"],name:"default_operator"},df:{type:"string"},ignoreIndices:{type:"enum","default":"none",options:["none","missing"],name:"ignore_indices"},replication:{type:"enum","default":"sync",options:["sync","async"]},q:{type:"string"},routing:{type:"string"},source:{type:"string"},timeout:{type:"time"}},urls:[{fmt:"/<%=index%>/<%=type%>/_query",req:{index:{type:"list"},type:{type:"list"}}},{fmt:"/<%=index%>/_query",req:{index:{type:"list"}}}]}),d.exists=c({methods:["HEAD"],params:{parent:{type:"string"},preference:{type:"string"},realtime:{type:"boolean"},refresh:{type:"boolean"},routing:{type:"string"}},urls:[{fmt:"/<%=index%>/<%=type%>/<%=id%>",opt:{type:{type:"string","default":"_all"}},req:{index:{type:"string"},id:{type:"string"}}}],castExists:!0}),d.explain=c({methods:["GET","POST"],params:{analyzeWildcard:{type:"boolean",name:"analyze_wildcard"},analyzer:{type:"string"},defaultOperator:{type:"enum","default":"OR",options:["AND","OR"],name:"default_operator"},df:{type:"string"},fields:{type:"list"},lenient:{type:"boolean"},lowercaseExpandedTerms:{type:"boolean",name:"lowercase_expanded_terms"},parent:{type:"string"},preference:{type:"string"},q:{type:"string"},routing:{type:"string"},source:{type:"list",name:"_source"},sourceExclude:{type:"list",name:"_source_exclude"},sourceInclude:{type:"list",name:"_source_include"}},urls:[{fmt:"/<%=index%>/<%=type%>/<%=id%>/_explain",req:{index:{type:"string"},type:{type:"string"},id:{type:"string"}}}]}),d.get=c({methods:["GET"],params:{fields:{type:"list"},parent:{type:"string"},preference:{type:"string"},realtime:{type:"boolean"},refresh:{type:"boolean"},routing:{type:"string"},source:{type:"list",name:"_source"},sourceExclude:{type:"list",name:"_source_exclude"},sourceInclude:{type:"list",name:"_source_include"}},urls:[{fmt:"/<%=index%>/<%=type%>/<%=id%>",opt:{type:{type:"string","default":"_all"}},req:{index:{type:"string"},id:{type:"string"}}}]}),d.getSource=c({methods:["GET"],params:{exclude:{type:"list"},include:{type:"list"},parent:{type:"string"},preference:{type:"string"},realtime:{type:"boolean"},refresh:{type:"boolean"},routing:{type:"string"}},urls:[{fmt:"/<%=index%>/<%=type%>/<%=id%>/_source",opt:{type:{type:"string","default":"_all"}},req:{index:{type:"string"},id:{type:"string"}}}]}),d.index=c({methods:["POST","PUT"],params:{consistency:{type:"enum",options:["one","quorum","all"]},opType:{type:"enum","default":"index",options:["index","create"],name:"op_type"},parent:{type:"string"},percolate:{type:"string"},refresh:{type:"boolean"},replication:{type:"enum","default":"sync",options:["sync","async"]},routing:{type:"string"},timeout:{type:"time"},timestamp:{type:"time"},ttl:{type:"duration"},version:{type:"number"},versionType:{type:"enum",options:["internal","external"],name:"version_type"}},urls:[{fmt:"/<%=index%>/<%=type%>/<%=id%>",req:{index:{type:"string"},type:{type:"string"},id:{type:"string"}}},{fmt:"/<%=index%>/<%=type%>",req:{index:{type:"string"},type:{type:"string"}}}]}),d.indices=function f(a){return this instanceof f?(this.client=a,void 0):new f(a)},d.indices.prototype.analyze=c({methods:["GET","POST"],params:{analyzer:{type:"string"},field:{type:"string"},filters:{type:"list"},index:{type:"string"},preferLocal:{type:"boolean",name:"prefer_local"},text:{type:"string"},tokenizer:{type:"string"},format:{type:"enum","default":"detailed",options:["detailed","text"]}},urls:[{fmt:"/<%=index%>/_analyze",req:{index:{type:"string"}}},{fmt:"/_analyze"}]}),d.indices.prototype.clearCache=c({methods:["POST","GET"],params:{fieldData:{type:"boolean",name:"field_data"},fielddata:{type:"boolean"},fields:{type:"list"},filter:{type:"boolean"},filterCache:{type:"boolean",name:"filter_cache"},filterKeys:{type:"boolean",name:"filter_keys"},id:{type:"boolean"},idCache:{type:"boolean",name:"id_cache"},ignoreIndices:{type:"enum","default":"none",options:["none","missing"],name:"ignore_indices"},index:{type:"list"},recycler:{type:"boolean"}},urls:[{fmt:"/<%=index%>/_cache/clear",req:{index:{type:"list"}}},{fmt:"/_cache/clear"}]}),d.indices.prototype.close=c({methods:["POST"],params:{timeout:{type:"time"},masterTimeout:{type:"time",name:"master_timeout"}},urls:[{fmt:"/<%=index%>/_close",req:{index:{type:"string"}}}]}),d.indices.prototype.create=c({methods:["PUT","POST"],params:{timeout:{type:"time"},masterTimeout:{type:"time",name:"master_timeout"}},urls:[{fmt:"/<%=index%>",req:{index:{type:"string"}}}]}),d.indices.prototype["delete"]=c({methods:["DELETE"],params:{timeout:{type:"time"},masterTimeout:{type:"time",name:"master_timeout"}},urls:[{fmt:"/<%=index%>",req:{index:{type:"list"}}},{fmt:"/"}]}),d.indices.prototype.deleteAlias=c({methods:["DELETE"],params:{timeout:{type:"time"},masterTimeout:{type:"time",name:"master_timeout"}},urls:[{fmt:"/<%=index%>/_alias/<%=name%>",req:{index:{type:"string"},name:{type:"string"}}}]}),d.indices.prototype.deleteMapping=c({methods:["DELETE"],params:{masterTimeout:{type:"time",name:"master_timeout"}},urls:[{fmt:"/<%=index%>/<%=type%>",req:{index:{type:"list"},type:{type:"string"}}}]}),d.indices.prototype.deleteTemplate=c({methods:["DELETE"],params:{timeout:{type:"time"},masterTimeout:{type:"time",name:"master_timeout"}},urls:[{fmt:"/_template/<%=name%>",req:{name:{type:"string"}}}]}),d.indices.prototype.deleteWarmer=c({methods:["DELETE"],params:{masterTimeout:{type:"time",name:"master_timeout"}},urls:[{fmt:"/<%=index%>/<%=type%>/_warmer/<%=name%>",req:{index:{type:"list"},type:{type:"list"},name:{type:"string"}}},{fmt:"/<%=index%>/_warmer/<%=name%>",req:{index:{type:"list"},name:{type:"string"}}},{fmt:"/<%=index%>/_warmer",req:{index:{type:"list"}}}]}),d.indices.prototype.exists=c({methods:["HEAD"],params:{},urls:[{fmt:"/<%=index%>",req:{index:{type:"list"}}}],castExists:!0}),d.indices.prototype.existsAlias=c({methods:["HEAD"],params:{ignoreIndices:{type:"enum","default":"none",options:["none","missing"],name:"ignore_indices"}},urls:[{fmt:"/<%=index%>/_alias/<%=name%>",req:{index:{type:"list"},name:{type:"list"}}},{fmt:"/_alias/<%=name%>",req:{name:{type:"list"}}}],castExists:!0}),d.indices.prototype.existsType=c({methods:["HEAD"],params:{ignoreIndices:{type:"enum","default":"none",options:["none","missing"],name:"ignore_indices"}},urls:[{fmt:"/<%=index%>/<%=type%>",req:{index:{type:"list"},type:{type:"list"}}}],castExists:!0}),d.indices.prototype.flush=c({methods:["POST","GET"],params:{force:{type:"boolean"},full:{type:"boolean"},ignoreIndices:{type:"enum","default":"none",options:["none","missing"],name:"ignore_indices"},refresh:{type:"boolean"}},urls:[{fmt:"/<%=index%>/_flush",req:{index:{type:"list"}}},{fmt:"/_flush"}]}),d.indices.prototype.getAlias=c({methods:["GET"],params:{ignoreIndices:{type:"enum","default":"none",options:["none","missing"],name:"ignore_indices"}},urls:[{fmt:"/<%=index%>/_alias/<%=name%>",req:{index:{type:"list"},name:{type:"list"}}},{fmt:"/_alias/<%=name%>",req:{name:{type:"list"}}}]}),d.indices.prototype.getAliases=c({methods:["GET"],params:{timeout:{type:"time"}},urls:[{fmt:"/<%=index%>/_aliases",req:{index:{type:"list"}}},{fmt:"/_aliases"}]}),d.indices.prototype.getFieldMapping=c({methods:["GET"],params:{includeDefaults:{type:"boolean",name:"include_defaults"}},urls:[{fmt:"/<%=index%>/<%=type%>/_mapping/field/<%=field%>",req:{index:{type:"list"},type:{type:"list"},field:{type:"list"}}},{fmt:"/<%=index%>/_mapping/field/<%=field%>",req:{index:{type:"list"},field:{type:"list"}}},{fmt:"/_mapping/field/<%=field%>",req:{field:{type:"list"}}}]}),d.indices.prototype.getMapping=c({methods:["GET"],params:{},urls:[{fmt:"/<%=index%>/<%=type%>/_mapping",req:{index:{type:"list"},type:{type:"list"}}},{fmt:"/<%=index%>/_mapping",req:{index:{type:"list"}}},{fmt:"/_mapping"}]}),d.indices.prototype.getSettings=c({methods:["GET"],params:{},urls:[{fmt:"/<%=index%>/_settings",req:{index:{type:"list"}}},{fmt:"/_settings"}]}),d.indices.prototype.getTemplate=c({methods:["GET"],params:{},urls:[{fmt:"/_template/<%=name%>",req:{name:{type:"string"}}},{fmt:"/_template"}]}),d.indices.prototype.getWarmer=c({methods:["GET"],params:{},urls:[{fmt:"/<%=index%>/<%=type%>/_warmer/<%=name%>",req:{index:{type:"list"},type:{type:"list"},name:{type:"string"}}},{fmt:"/<%=index%>/_warmer/<%=name%>",req:{index:{type:"list"},name:{type:"string"}}},{fmt:"/<%=index%>/_warmer",req:{index:{type:"list"}}}]}),d.indices.prototype.open=c({methods:["POST"],params:{timeout:{type:"time"},masterTimeout:{type:"time",name:"master_timeout"}},urls:[{fmt:"/<%=index%>/_open",req:{index:{type:"string"}}}]}),d.indices.prototype.optimize=c({methods:["POST","GET"],params:{flush:{type:"boolean"},ignoreIndices:{type:"enum","default":"none",options:["none","missing"],name:"ignore_indices"},maxNumSegments:{type:"number",name:"max_num_segments"},onlyExpungeDeletes:{type:"boolean",name:"only_expunge_deletes"},operationThreading:{name:"operation_threading"},refresh:{type:"boolean"},waitForMerge:{type:"boolean",name:"wait_for_merge"}},urls:[{fmt:"/<%=index%>/_optimize",req:{index:{type:"list"}}},{fmt:"/_optimize"}]}),d.indices.prototype.putAlias=c({methods:["PUT"],params:{timeout:{type:"time"},masterTimeout:{type:"time",name:"master_timeout"}},urls:[{fmt:"/<%=index%>/_alias/<%=name%>",req:{index:{type:"string"},name:{type:"string"}}},{fmt:"/_alias/<%=name%>",req:{name:{type:"string"}}},{fmt:"/<%=index%>/_alias",req:{index:{type:"string"}}},{fmt:"/_alias"}]}),d.indices.prototype.putMapping=c({methods:["PUT","POST"],params:{ignoreConflicts:{type:"boolean",name:"ignore_conflicts"},timeout:{type:"time"},masterTimeout:{type:"time",name:"master_timeout"}},urls:[{fmt:"/<%=index%>/<%=type%>/_mapping",req:{index:{type:"list"},type:{type:"string"}}}]}),d.indices.prototype.putSettings=c({methods:["PUT"],params:{masterTimeout:{type:"time",name:"master_timeout"}},urls:[{fmt:"/<%=index%>/_settings",req:{index:{type:"list"}}},{fmt:"/_settings"}]}),d.indices.prototype.putTemplate=c({methods:["PUT","POST"],params:{order:{type:"number"},timeout:{type:"time"},masterTimeout:{type:"time",name:"master_timeout"}},urls:[{fmt:"/_template/<%=name%>",req:{name:{type:"string"}}}]}),d.indices.prototype.putWarmer=c({methods:["PUT"],params:{masterTimeout:{type:"time",name:"master_timeout"}},urls:[{fmt:"/<%=index%>/<%=type%>/_warmer/<%=name%>",req:{index:{type:"list"},type:{type:"list"},name:{type:"string"}}},{fmt:"/<%=index%>/_warmer/<%=name%>",req:{index:{type:"list"},name:{type:"string"}}}]}),d.indices.prototype.refresh=c({methods:["POST","GET"],params:{ignoreIndices:{type:"enum","default":"none",options:["none","missing"],name:"ignore_indices"},operationThreading:{name:"operation_threading"}},urls:[{fmt:"/<%=index%>/_refresh",req:{index:{type:"list"}}},{fmt:"/_refresh"}]}),d.indices.prototype.segments=c({methods:["GET"],params:{ignoreIndices:{type:"enum","default":"none",options:["none","missing"],name:"ignore_indices"},operationThreading:{name:"operation_threading"}},urls:[{fmt:"/<%=index%>/_segments",req:{index:{type:"list"}}},{fmt:"/_segments"}]}),d.indices.prototype.snapshotIndex=c({methods:["POST"],params:{ignoreIndices:{type:"enum","default":"none",options:["none","missing"],name:"ignore_indices"}},urls:[{fmt:"/<%=index%>/_gateway/snapshot",req:{index:{type:"list"}}},{fmt:"/_gateway/snapshot"}]}),d.indices.prototype.stats=c({methods:["GET"],params:{all:{type:"boolean"},clear:{type:"boolean"},completion:{type:"boolean"},completionFields:{type:"list",name:"completion_fields"},docs:{type:"boolean"},fielddata:{type:"boolean"},fielddataFields:{type:"list",name:"fielddata_fields"},fields:{type:"list"},filterCache:{type:"boolean",name:"filter_cache"},flush:{type:"boolean"},get:{type:"boolean"},groups:{type:"boolean"},idCache:{type:"boolean",name:"id_cache"},ignoreIndices:{type:"enum","default":"none",options:["none","missing"],name:"ignore_indices"},indexing:{type:"boolean"},merge:{type:"boolean"},refresh:{type:"boolean"},search:{type:"boolean"},store:{type:"boolean"},warmer:{type:"boolean"}},urls:[{fmt:"/<%=index%>/_stats",req:{index:{type:"list"}}},{fmt:"/_stats"}]}),d.indices.prototype.status=c({methods:["GET"],params:{ignoreIndices:{type:"enum","default":"none",options:["none","missing"],name:"ignore_indices"},operationThreading:{name:"operation_threading"},recovery:{type:"boolean"},snapshot:{type:"boolean"}},urls:[{fmt:"/<%=index%>/_status",req:{index:{type:"list"}}},{fmt:"/_status"}]}),d.indices.prototype.updateAliases=c({methods:["POST"],params:{timeout:{type:"time"},masterTimeout:{type:"time",name:"master_timeout"}},urls:[{fmt:"/_aliases"}]}),d.indices.prototype.validateQuery=c({methods:["GET","POST"],params:{explain:{type:"boolean"},ignoreIndices:{type:"enum","default":"none",options:["none","missing"],name:"ignore_indices"},operationThreading:{name:"operation_threading"},source:{type:"string"},q:{type:"string"}},urls:[{fmt:"/<%=index%>/<%=type%>/_validate/query",req:{index:{type:"list"},type:{type:"list"}}},{fmt:"/<%=index%>/_validate/query",req:{index:{type:"list"}}},{fmt:"/_validate/query"}]}),d.info=c({methods:["GET","HEAD"],params:{},urls:[{fmt:"/"}]}),d.mget=c({methods:["GET","POST"],params:{fields:{type:"list"},preference:{type:"string"},realtime:{type:"boolean"},refresh:{type:"boolean"},source:{type:"list",name:"_source"},sourceExclude:{type:"list",name:"_source_exclude"},sourceInclude:{type:"list",name:"_source_include"}},urls:[{fmt:"/<%=index%>/<%=type%>/_mget",req:{index:{type:"string"},type:{type:"string"}}},{fmt:"/<%=index%>/_mget",req:{index:{type:"string"}}},{fmt:"/_mget"}]}),d.mlt=c({methods:["GET","POST"],params:{boostTerms:{type:"number",name:"boost_terms"},maxDocFreq:{type:"number",name:"max_doc_freq"},maxQueryTerms:{type:"number",name:"max_query_terms"},maxWordLen:{type:"number",name:"max_word_len"},minDocFreq:{type:"number",name:"min_doc_freq"},minTermFreq:{type:"number",name:"min_term_freq"},minWordLen:{type:"number",name:"min_word_len"},mltFields:{type:"list",name:"mlt_fields"},percentTermsToMatch:{type:"number",name:"percent_terms_to_match"},routing:{type:"string"},searchFrom:{type:"number",name:"search_from"},searchIndices:{type:"list",name:"search_indices"},searchQueryHint:{type:"string",name:"search_query_hint"},searchScroll:{type:"string",name:"search_scroll"},searchSize:{type:"number",name:"search_size"},searchSource:{type:"string",name:"search_source"},searchType:{type:"string",name:"search_type"},searchTypes:{type:"list",name:"search_types"},stopWords:{type:"list",name:"stop_words"}},urls:[{fmt:"/<%=index%>/<%=type%>/<%=id%>/_mlt",req:{index:{type:"string"},type:{type:"string"},id:{type:"string"}}}]}),d.msearch=c({methods:["GET","POST"],params:{searchType:{type:"enum",options:["query_then_fetch","query_and_fetch","dfs_query_then_fetch","dfs_query_and_fetch","count","scan"],name:"search_type"}},urls:[{fmt:"/<%=index%>/<%=type%>/_msearch",req:{index:{type:"list"},type:{type:"list"}}},{fmt:"/<%=index%>/_msearch",req:{index:{type:"list"}}},{fmt:"/_msearch"}],bulkBody:!0}),d.percolate=c({methods:["GET","POST"],params:{preferLocal:{type:"boolean",name:"prefer_local"}},urls:[{fmt:"/<%=index%>/<%=type%>/_percolate",req:{index:{type:"string"},type:{type:"string"}}}]}),d.scroll=c({methods:["GET","POST"],params:{scroll:{type:"duration"},scrollId:{type:"string",name:"scroll_id"}},urls:[{fmt:"/_search/scroll/<%=scrollId%>",req:{scrollId:{type:"string"}}},{fmt:"/_search/scroll"}]}),d.search=c({methods:["GET","POST"],params:{analyzer:{type:"string"},analyzeWildcard:{type:"boolean",name:"analyze_wildcard"},defaultOperator:{type:"enum","default":"OR",options:["AND","OR"],name:"default_operator"},df:{type:"string"},explain:{type:"boolean"},fields:{type:"list"},from:{type:"number"},ignoreIndices:{type:"enum","default":"none",options:["none","missing"],name:"ignore_indices"},indicesBoost:{type:"list",name:"indices_boost"},lenient:{type:"boolean"},lowercaseExpandedTerms:{type:"boolean",name:"lowercase_expanded_terms"},preference:{type:"string"},q:{type:"string"},routing:{type:"list"},scroll:{type:"duration"},searchType:{type:"enum",options:["query_then_fetch","query_and_fetch","dfs_query_then_fetch","dfs_query_and_fetch","count","scan"],name:"search_type"},size:{type:"number"},sort:{type:"list"},source:{type:"list",name:"_source"},sourceExclude:{type:"list",name:"_source_exclude"},sourceInclude:{type:"list",name:"_source_include"},stats:{type:"list"},suggestField:{type:"string",name:"suggest_field"},suggestMode:{type:"enum","default":"missing",options:["missing","popular","always"],name:"suggest_mode"},suggestSize:{type:"number",name:"suggest_size"},suggestText:{type:"text",name:"suggest_text"},timeout:{type:"time"},version:{type:"boolean"}},urls:[{fmt:"/<%=index%>/<%=type%>/_search",opt:{index:{type:"list","default":"_all"}},req:{type:{type:"list"}}},{fmt:"/<%=index%>/_search",opt:{index:{type:"list","default":"_all"}}}]}),d.suggest=c({methods:["POST","GET"],params:{ignoreIndices:{type:"enum","default":"none",options:["none","missing"],name:"ignore_indices"},preference:{type:"string"},routing:{type:"string"},source:{type:"string"}},urls:[{fmt:"/<%=index%>/_suggest",req:{index:{type:"list"}}},{fmt:"/_suggest"}]}),d.update=c({methods:["POST"],params:{consistency:{type:"enum",options:["one","quorum","all"]},fields:{type:"list"},lang:{type:"string"},parent:{type:"string"},percolate:{type:"string"},refresh:{type:"boolean"},replication:{type:"enum","default":"sync",options:["sync","async"]},retryOnConflict:{type:"number",name:"retry_on_conflict"},routing:{type:"string"},script:{},timeout:{type:"time"},timestamp:{type:"time"},ttl:{type:"duration"},version:{type:"number"},versionType:{type:"enum",options:["internal","external"],name:"version_type"}},urls:[{fmt:"/<%=index%>/<%=type%>/<%=id%>/_update",req:{index:{type:"string"},type:{type:"string"},id:{type:"string"}}}]})},{"./client_action":17,"./errors":22}],16:[function(a,b){function c(a){this.client=this,Object.defineProperty(this,"config",{configurable:!1,enumerable:!1,writable:!1,value:!a||d.isPlainObject(a)?new e(a):a}),this.config.client=this;for(var b=0;b<this._namespaces.length;b++)this[this._namespaces[b]]=new this[this._namespaces[b]](this)}b.exports=c;var d=a("./utils"),e=a("./client_config"),f=a("./api.js");c.prototype=d.clone(f),c.prototype.ping=function(a,b){"function"==typeof a&&(b=a,a={}),this.config.transport.request({method:"HEAD",path:"/"},b)},c.prototype.close=function(){this.config.close()}},{"./api.js":15,"./client_config":18,"./utils":33}],17:[function(a,b){function c(a,b){var c,d,g={};if(a.req)for(a.reqParamKeys||(a.reqParamKeys=e.keys(a.req)),c=0;c<a.reqParamKeys.length;c++){if(d=a.reqParamKeys[c],!b.hasOwnProperty(d))return!1;g[d]=b[d]}if(a.opt)for(a.optParamKeys||(a.optParamKeys=e.keys(a.opt)),c=0;c<a.optParamKeys.length;c++)d=a.optParamKeys[c],g[d]=b[d]?f[a.opt[d].type]?f[a.opt[d].type](a.opt[d],b[d],d):b[d]:a.opt[d]["default"];return a.template||(a.template=e.template(a.fmt)),a.template(e.transform(g,function(a,c,d){a[d]=encodeURIComponent(c),delete b[d]},{}))}function d(a,b,d,g){"function"==typeof d?(g=d,d={}):(d=d||{},g="function"==typeof g?g:e.noop);var h,i={},j={};if(b.needsBody&&!d.body)return e.nextTick(g,new TypeError("A request body is required."));if(d.body&&(i.body=d.body),d.ignore&&(i.ignore=e.isArray(d.ignore)?d.ignore:[d.ignore]),i.timeout=void 0===d.timeout?1e4:d.timeout,b.bulkBody&&(i.bulkBody=!0),b.castExists&&(i.castExists=!0),1===b.methods.length)i.method=b.methods[0];else if(i.method=e.toUpperString(d.method),i.method){if(!e.contains(b.methods,i.method))return e.nextTick(g,new TypeError("Invalid method: should be one of "+b.methods.join(", ")))}else i.method=i.body?b.methodWithBody||(b.methodWithBody=e.find(b.methods,function(a){return"GET"!==a})):b.methods[0];if(b.url)i.path=c(b.url,d);else for(h=0;h<b.urls.length&&!(i.path=c(b.urls[h],d));h++);if(!i.path)return e.nextTick(g,new TypeError("Unable to build a path with those params. Supply at least "+e.keys(b.urls[b.urls.length-1].req).join(", ")));b.paramKeys||(b.paramKeys=e.keys(b.params));var k,l,m;for(h=0;h<b.paramKeys.length;h++){k=b.paramKeys[h],l=b.params[k],m=l.name||k;try{if(null!=d[k])j[m]=f[l.type]?f[l.type](l,d[k],k):d[k],l["default"]&&j[m]===l["default"]&&delete j[m];else if(l.required)throw new TypeError("Missing required parameter "+k)}catch(n){return e.nextTick(g,n)}}return i.query=j,a.request(i,g)}b.exports=function(a,b){return function(c,e){return d((b||this.client).config.transport,a,c,e)}},a("./errors");var e=a("./utils"),f={"enum":function(a,b,c){if(e.contains(a.options,b))return b;throw new TypeError("Invalid "+c+": expected one of "+a.options.join(","))},duration:function(a,b,c){if(e.isNumeric(b)||e.isInterval(b))return b;throw new TypeError("Invalid "+c+": expected a number or interval (an integer followed by one of Mwdhmsy).")},list:function(a,b,c){switch(typeof b){case"string":return b;case"object":if(e.isArray(b))return b.join(",");throw new TypeError("Invalid "+c+": expected be a comma seperated list, array, or boolean.");default:return!!b}},"boolean":function(a,b){return b=e.isString(b)?b.toLowerCase():b,"no"===b||"off"===b?!1:!!b},number:function(a,b,c){if(e.isNumeric(b))return 1*b;throw new TypeError("Invalid "+c+": expected a number.")},string:function(a,b,c){if("object"!=typeof b&&b)return""+b;throw new TypeError("Invalid "+c+": expected a string.")},time:function(a,b,c){if("string"==typeof b||e.isNumeric(b))return b;if(b instanceof Date)return b.getTime();throw new TypeError("Invalid "+c+": expected some sort of time.")}}},{"./errors":22,"./utils":33}],18:[function(a,b){function c(a){if(e.extend(this,l,a),this.log&&(this.loggers=this.log,delete this.log),"string"==typeof this.connectionClass&&(this.connectionClass=h[e.studlyCase(this.connectionClass)]),"function"!=typeof this.connectionClass)throw new TypeError('Invalid connectionClass "'+this.connectionClass+'". Expected a constructor or one of '+e.keys(h).join(", "));
|
||
if("string"==typeof this.selector&&(this.selector=g[e.camelCase(this.selector)]),"function"!=typeof this.selector)throw new TypeError('Invalid Selector "'+this.selector+'". Expected a function or one of '+e.keys(g).join(", "));e.each(k,function(a,b){this[b]="function"==typeof this[b]?new this[b](this):new a(this)},this),this.connectionPool.setNodes(this.prepareHosts(this.hosts)),delete this.hosts}var d=a("__browserify_process");b.exports=c,a("url");var e=a("./utils"),f=a("./host"),g=a("./selectors"),h={};d.browser?(h.Xhr=a("./connectors/xhr"),h.Angular=a("./connectors/angular"),h.jQuery=a("./connectors/jquery")):h.Http=a("./connectors/http"),e.each(h,function(a,b){"function"!=typeof a&&delete h[b]});var i={Json:a("./serializers/json")},j=/\[([^:]+):(\d+)]/,k={log:a("./log"),serializer:i.Json,connectionPool:a("./connection_pool"),transport:a("./transport")},l={loggers:[{level:"warning"}],hosts:[{host:"localhost",port:9200,protocol:"http"}],connectionClass:d.browser?h.Xhr:h.Http,selector:g.roundRobin,sniffOnStart:!1,sniffAfterRequests:null,sniffOnConnectionFail:!1,maxRetries:3,timeout:1e4,deadTimeout:6e4,maxSockets:10,nodesToHostCallback:function(a){var b=[];return e.each(a,function(a,c){var d=j.exec(a.host);b.push({host:d[1],port:d[2],_meta:{id:c,name:a.name,servername:a.host,version:a.version}})}),b}};h=e.transform(h,function(a,b,c){b&&(a[c]=b)},{}),c.prototype.prepareHosts=function(a){return e.isArray(a)||(a=[a]),e.map(a,function(a){return new f(a)})},c.prototype.close=function(){this.log.close(),this.connectionPool.close()}},{"./connection_pool":20,"./connectors/angular":1,"./connectors/http":1,"./connectors/jquery":1,"./connectors/xhr":21,"./host":23,"./log":24,"./selectors":27,"./serializers/json":30,"./transport":31,"./utils":33,__browserify_process:12,url:7}],19:[function(a,b){function c(a,b){if(e.call(this),this.config=b,this.host=a,this.requestCount=0,!this.host)throw new Error("Missing host config");d.makeBoundMethods(this)}b.exports=c;var d=a("./utils"),e=a("events").EventEmitter;d.inherits(c,e),c.prototype.request=function(){throw new Error("Connection#request must be overwritten by the Connector")},c.prototype.ping=function(a,b){if("function"==typeof a)b=a;else if("function"!=typeof b)throw new TypeError("Callback must be a function");return this.request({path:"/",method:"HEAD",timeout:"100"},b)},c.prototype.setStatus=function(a){var b=this.status;this.status=a,("dead"===a||"closed"===a)&&(this.__deadTimeout&&clearTimeout(this.__deadTimeout),"dead"===a&&(this.__deadTimeout=setTimeout(this.bound.resuscitate,this.config.deadTimeout))),this.emit("status changed",a,b,this)},c.prototype.resuscitate=d.scheduled(function(){var a=this;"dead"===a.status&&a.ping(function(b){b?a.emit("dead"):a.setStatus("alive")})})},{"./utils":33,events:4}],20:[function(a,b){function c(a){d.makeBoundMethods(this),this.config=a,this.index={},this.connections={alive:[],dead:[]}}b.exports=c;var d=a("./utils");a("./selectors"),a("events").EventEmitter,a("./errors");var e=a("./host");c.prototype.select=function(a){if(this.connections.alive.length)if(this.config.selector.length>1)this.config.selector(this.connections.alive,a);else try{d.nextTick(a,null,this.config.selector(this.connections.alive))}catch(b){this.config.log.error(b),a(b)}else a()},c.prototype.onStatusChanged=d.handler(function(a,b,c){var d,e,f;if(b===a)return!0;switch(this.config.log.info("connection id:",c.__id,"is",a),a){case"alive":d=this.connections.dead,e=this.connections.alive;break;case"dead":d=this.connections.alive,e=this.connections.dead;break;case"closed":d=this.connections[b]}d&&d.indexOf&&(f=d.indexOf(c),~f&&d.splice(f,1)),e&&e.indexOf&&(f=e.indexOf(c),~f||e.push(c))}),c.prototype._add=function(a){this.index[a.__id]||(this.index[a.__id]=a,a.on("status changed",this.bound.onStatusChanged),a.setStatus("alive"))},c.prototype._remove=function(a){this.index[a.__id]&&(delete this.index[a.__id],a.setStatus("closed"),a.removeListener("status changed",this.bound.onStatusChanged))},c.prototype.setNodes=function(a){var b,c,f,g,h=d.clone(this.index);for(c=0;c<a.length;c++)g=a[c],g instanceof e&&(f=g.toString(),this.index[f]?delete h[f]:(b=new this.config.connectionClass(g,this.config),b.__id=f,this._add(b)));d.each(h,this._remove,this)},c.prototype.close=function(){this.setNodes([])},c.prototype.empty=c.prototype.close},{"./errors":22,"./host":23,"./selectors":27,"./utils":33,events:4}],21:[function(a,b){function c(a,b){e.call(this,a,b)}b.exports=c;var d=a("../utils"),e=a("../connection"),f=a("../errors").ConnectionFault,g=a("../errors").RequestTimeout,h=!(navigator&&/PhantomJS/i.test(navigator.userAgent));d.inherits(c,e);var i=d.noop;if(i="undefined"!=typeof XMLHttpRequest?function(){return new XMLHttpRequest}:d.first(["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],function(a){try{return new window.ActiveXObject(a),function(){return new window.ActiveXObject(a)}}catch(b){return null}}),!i)throw new Error("getXhr(): XMLHttpRequest not available");c.prototype.request=function(a,b){var c,e=i(),j=a.timeout?a.timeout:1e4,k=this.host.makeUrl(a),l=this.config.log,m=a.async===!1?!1:h;a.auth?e.open(a.method,k,m,a.auth.user,a.auth.pass):e.open(a.method,k,m),e.onreadystatechange=function(){if(4===e.readyState){clearTimeout(c),l.trace(a.method,k,a.body,e.responseText,e.status);var d=e.status?void 0:new f(e.statusText||"Request failed to complete.");b(d,e.responseText,e.status)}},1/0!==j&&(c=setTimeout(function(){e.onreadystatechange=d.noop,e.abort(),b(new g)},j)),e.send(a.body||void 0)}},{"../connection":19,"../errors":22,"../utils":33}],22:[function(a,b){function c(a,b){this.message=a,Error.call(this,this.message),d.browser?this.stack="":Error.captureStackTrace(this,b)}var d=a("__browserify_process"),e=a("./utils"),f=b.exports;e.inherits(c,Error),f.ConnectionFault=function(a){c.call(this,a||"Connection Failure",f.ConnectionFault)},e.inherits(f.ConnectionFault,c),f.Generic=function(a){c.call(this,a||"Generic Error",f.Generic)},e.inherits(f.Generic,c),f.RequestTimeout=function(a){c.call(this,a||"Request Timeout",f.RequestTimeout)},e.inherits(f.RequestTimeout,c),f.Serialization=function(a){c.call(this,a||"Unable to parse/serialize body",f.Serialization)},e.inherits(f.Serialization,c);var g={503:"Service Unavailable",500:"Internal Server Error",412:"Precondition Failed",409:"Conflict",403:"Forbidden",404:"Not Found",400:"Bad Request",301:"Moved Permanently"};e.each(g,function(a,b){function d(b){c.call(this,b||a,f[g])}var g=e.studlyCase(a);e.inherits(d,c),f[g]=d,f[b]=d})},{"./utils":33,__browserify_process:12}],23:[function(a,b){function c(a){return this instanceof c?"string"==typeof a?c.fromString(a):(f.extend(this,a||{}),void 0):new c(a)}b.exports=c;var d=a("url"),e=a("querystring"),f=a("./utils"),g=/^([a-z]+:)?\/\//,h={http:80,https:443};c.fromString=function(a){g.test(a)||(a="http://"+a);var b=d.parse(a,!0,!0);return new c({protocol:b.protocol?b.protocol.substring(0,b.protocol.length-1):"http",host:b.hostname||"localhost",port:b.port||9200,auth:b.auth||"",path:b.pathname,query:b.query})},c.prototype={protocol:"http",host:"localhost",port:9200,auth:"",path:"",query:!1},c.prototype.makeUrl=function(a){a=a||{};var b="";this.port!==h[this.protocol]&&(b=":"+this.port);var c="";this.path&&(c+=this.path),a.path&&(c+=a.path),c&&"/"!==c.charAt(0)&&(c="/"+c);var d="";return a.query?d=e.stringify(f.defaults("string"==typeof a.query?e.parse(a.query):a.query,this.query)):this.query&&(d=e.stringify(this.query)),this.protocol+"://"+this.host+b+c+(d?"?"+d:"")}},{"./utils":33,querystring:6,url:7}],24:[function(a,b){function c(a){this.config=a||{};var b,c=a.loggers?a.loggers:"warning";if(e.isString(c)||e.isFinite(c))c=[{level:c}];else if(e.isPlainObject(c))c=[c];else if(e.isArray(c))for(b=0;b<c.length;b++)e.isString(c[b])&&(c[b]={level:c[b]});if(!e.isArrayOfPlainObjects(c))throw new TypeError("Invalid Logging output config");for(b=0;b<c.length;b++)this.addOutput(c[b])}var d=a("__browserify_process"),e=a("./utils"),f=a("url"),g=a("events").EventEmitter;if(d.browser)var h={Console:a("./loggers/console")};else var h={File:a("./loggers/file"),Stream:a("./loggers/file"),Stdio:a("./loggers/stdio")};e.inherits(c,g),c.prototype.close=function(){this.emit("closing"),g.listenerCount(this)&&(console.error("Something is still listening for log events, but the logger is closing."),this.clearAllListeners())},c.levels=["error","warning","info","debug","trace"],c.parseLevels=function(a){return e.isString(a)?c.levels.slice(0,e.indexOf(c.levels,a)+1):e.isArray(a)?e.intersection(a,c.levels):void 0},c.join=function(a){return e.map(a,function(a){return e.isPlainObject(a)?e.inspect(a)+"\n":a.toString()}).join(" ")},c.prototype.addOutput=function(a){var b=c.parseLevels(a.levels||a.level||"warning");e.defaults(a||{},{type:d.browser?"Console":"Stdio"}),delete a.level,a.levels=b;var f=h[e.studlyCase(a.type)];if(f)return new f(a,this);throw new Error('Invalid logger type "'+a.type+'". Expected one of '+e.keys(h).join(", "))},c.prototype.error=function(a){return g.listenerCount(this,"error")?this.emit("error",a instanceof Error?a:new Error(a)):void 0},c.prototype.warning=function(){return g.listenerCount(this,"warning")?this.emit("warning",c.join(arguments)):void 0},c.prototype.info=function(){return g.listenerCount(this,"info")?this.emit("info",c.join(arguments)):void 0},c.prototype.debug=function(){return g.listenerCount(this,"debug")?this.emit("debug",c.join(arguments)):void 0},c.prototype.trace=function(a,b,c,d,h){return g.listenerCount(this,"trace")?("string"==typeof b&&(b=f.parse(b,!0,!0)),b=e.defaults({host:"localhost:9200",query:e.defaults({pretty:!0},b.query)},b),delete b.auth,this.emit("trace",a,f.format(b),c,d,h)):void 0},b.exports=c},{"./loggers/console":26,"./loggers/file":1,"./loggers/stdio":1,"./utils":33,__browserify_process:12,events:4,url:7}],25:[function(a,b){function c(a,b){this.bridge=b,this.listeningLevels=[],f.makeBoundMethods(this),this.bridge.on("closing",this.bound.cleanUpListeners),this.setupListeners(a.levels)}function d(a){return 10>a?"0"+a.toString(10):a.toString(10)}function e(a,b){var c=f.repeat(" ",b||2);return a.split(/\r?\n/).map(function(a){return c+a}).join("\n")}var f=(a("./log"),a("./utils"));c.prototype.timestamp=function(){var a=new Date;return a.getUTCFullYear()+"-"+d(a.getUTCMonth()+1)+"-"+d(a.getUTCDate())+"T"+d(a.getUTCHours())+":"+d(a.getUTCMinutes())+":"+d(a.getUTCSeconds())+"Z"},c.prototype.format=function(a,b){return a+": "+this.timestamp()+"\n"+e(b)+"\n\n"},c.prototype.write=function(){throw new Error("This should be overwritten by the logger")},c.prototype.setupListeners=function(a){this.cleanUpListeners(),this.listeningLevels=a,f.each(this.listeningLevels,function(a){var b="on"+f.ucfirst(a);if(!this.bound[b])throw new Error(b+" is not a function");this.bridge.on(a,this.bound[b])},this)},c.prototype.cleanUpListeners=f.handler(function(){f.each(this.listeningLevels,function(a){this.bridge.removeListener(a,this.bound["on"+f.ucfirst(a)])},this)}),c.prototype.onError=f.handler(function(a){this.write("Error"===a.name?"ERROR":a.name,a.stack)}),c.prototype.onWarning=f.handler(function(a){this.write("WARNING",a)}),c.prototype.onInfo=f.handler(function(a){this.write("INFO",a)}),c.prototype.onDebug=f.handler(function(a){this.write("DEBUG",a)}),c.prototype.onTrace=f.handler(function(a,b,c,d,e){var f='curl "'+b.replace(/"/g,'\\"')+'" -X'+a.toUpperCase();c&&(f+=' -d "'+c.replace(/"/g,'\\"')+'"'),f+="\n<- "+e+"\n"+d,this.write("TRACE",f)}),b.exports=c},{"./log":24,"./utils":33}],26:[function(a,b){function c(a,b){d.call(this,a,b),this.color=e.has(a,"color")?!!a.color:!0}b.exports=c;var d=a("../logger"),e=a("../utils");e.inherits(c,d),c.prototype.setupListeners=function(a){this.bound.onWarning=this.onWarning,this.bound.onInfo=this.onInfo,this.bound.onDebug=this.onDebug,d.prototype.setupListeners.call(this,a)},c.prototype.onError=e.handler(function(a){console.error&&console.trace?console.error("Error"===a.name?"ERROR":a.name,a.stack||a.message):console.log("Error"===a.name?"ERROR":a.name,a.stack||a.message)}),c.prototype.onWarning=e.bindKey(console,console.warn?"warn":"log","WARNING"),c.prototype.onInfo=e.bindKey(console,console.info?"info":"log","INFO"),c.prototype.onDebug=e.bindKey(console,console.debug?"debug":"log","DEBUG"),c.prototype.onTrace=e.handler(function(a,b,c,d,e){var f='curl "'+b.replace(/"/g,'\\"')+'" -X'+a.toUpperCase();c&&(f+=' -d "'+c.replace(/"/g,'\\"')+'"'),f+="\n<- "+e+"\n"+d,console.log("TRACE:\n"+f+"\n\n")})},{"../logger":25,"../utils":33}],27:[function(a,b){b.exports={random:a("./random"),roundRobin:a("./round_robin")}},{"./random":28,"./round_robin":29}],28:[function(a,b){function c(a){return a[Math.floor(Math.random()*a.length)]}b.exports=c},{}],29:[function(a,b){function c(a){return a.unshift(a.pop()),a[0]}b.exports=c},{}],30:[function(a,b){function c(a){this.client=a}b.exports=c;var d=a("../utils");c.prototype.serialize=function(a,b,c){return null==a?null:"string"==typeof a?a:JSON.stringify(a,b,c)},c.prototype.unserialize=function(a){if("string"!=typeof a)return a;try{return JSON.parse(a)}catch(b){return this.client.log.error(new Error("unable to parse",a)),null}},c.prototype.bulkBody=function(a){var b,c="";if(d.isArray(a))for(b=0;b<a.length;b++)c+=this.serialize(a[b])+"\n";else{if("string"!=typeof a)throw new TypeError("Bulk body should either be an Array of commands/string, or a String");c=a+("\n"===a[a.length-1]?"":"\n")}return c}},{"../utils":33}],31:[function(a,b){function c(a){this.config=a}b.exports=c;var d=a("./utils"),e=a("./transport_request");a("./errors"),c.prototype.request=function(a,b){return new e(this.config,a,b)},c.prototype.sniff=function(a){var b=this.config;a="function"==typeof a?a:d.noop,this.request({path:"/_cluster/nodes",method:"GET"},function(c,d){if(!c&&d&&d.nodes){var e=b.nodesToHostCallback(d.nodes);b.connectionPool.setNodes(e)}a(c,d)})}},{"./errors":22,"./transport_request":32,"./utils":33}],32:[function(a,b){function c(a,b,c){f.call(this),e.makeBoundMethods(this),this._params=b,this._log=a.log,this._serializer=a.serializer,this._connectionPool=a.connectionPool,this._remainingRetries=a.maxRetries,"function"==typeof c&&this.once("done",c),this._startRequest()}var d=a("__browserify_process");b.exports=c;var e=a("./utils"),f=a("events").EventEmitter,g=a("./errors");e.inherits(c,f),c.prototype._startRequest=function(){var a=this._params;return this._log.debug("starting request",a),a.body&&"GET"===a.method?(d.nextTick(e.bindKey(this,"respond",new TypeError('Body can not be sent with method "GET"'))),void 0):(a.body&&(a.body=this._serializer[a.bulkBody?"bulkBody":"serialize"](a.body)),a.req={timeout:a.timeout,path:a.path,query:a.query,method:a.method,body:a.body},this._connectionPool.select(this.bound._sendReqWithCon),void 0)},c.prototype._sendReqWithCon=e.handler(function(a,b){a?this._respond(a):b?(this._connection=b,this._log.info("Selected",b.status,"Connection, making request"),this._request=b.request(this._params.req,this.bound._checkRespForFail)):(this._log.warning("No living connections"),this._respond(new g.ConnectionFault("No living connections.")))}),c.prototype._checkRespForFail=e.handler(function(a,b,c){a&&this._remainingRetries?(this._remainingRetries--,this._log.error(a.message,"-- retrying"),this._connectionPool.select(this.bound._sendReqWithCon)):(this._log.info("Request complete"),this._respond(a,b,c))}),c.prototype._respond=e.handler(function(a,b,c){if(this._response)throw new Error("Request responded twice");var d,f=this._serializer,h=this._params.ignore;h&&!e.isArray(h)&&(h=[h]),!a&&b&&(d=f.unserialize(b),null==d&&(a=new g.Serialization)),a||(200>c||c>=300)&&!e.contains(h,c)&&(a=g[c]?new g[c](d&&d.error):new g.Generic("unknown error")),this._params.castExists&&(a&&a instanceof g.NotFound?(d=!1,a=void 0):d=!a),this._error=a,this._response={body:d,status:c},this.emit("done",this._error,this._response.body,this._response.status)}),c.prototype.abort=function(){return this.aborted=!0,this.__request?(this.__request.abort(),!0):!1},c.prototype.then=function(a,b){this._error?b(this._error):this._response?a(this._response):this.once("done",e.bindKey(this,"then",a,b))}},{"./errors":22,"./utils":33,__browserify_process:12,events:4}],33:[function(a,b){function c(a,b,c){return function(d){for(var e,f,g,h,i=0,j=[],k="";i<d.length;i++)e=d.charCodeAt(i),f=d.charAt(i),h=e>=97&&122>=e,g=e>=65&&90>=e,(g||!h)&&(k.length&&j.push(k),k=""),(g||h)&&(h&&k.length?k+=f:k=!j.length&&a||j.length&&b?f.toUpperCase():f.toLowerCase());return k.length&&j.push(k),j.lenth&&"_"===d.charAt(0)&&(j[0]="_"+j[0]),j.join(c)}}var d=a("__browserify_process"),e=a("path"),f=a("lodash"),g=a("util"),h=f.extend({},f,g);f=h,h.inspect=function(a,b){return g.inspect(a,f.defaults(b||{},{showHidden:!0,depth:null,color:!0}))},h.joinPath=e.join,h.reKey=function(a,b,c){if(void 0===c&&(c=!0),"function"!=typeof b)throw new TypeError("invalid transform function");var d={};return f.each(a,function(a,e){d[b(e)]=c&&"object"==typeof a?h.reKey(a,b,c):a}),d},h.deepMerge=function(a,b){return Object.keys(b).forEach(function(c){switch(typeof a[c]){case"undefined":a[c]=b[c];break;case"object":f.isArray(a[c])&&f.isArray(b[c])?a[c]=a[c].concat(b[c]):f.isPlainObject(a[c])&&f.isPlainObject(b[c])&&h.deepMerge(a[c],b[c])}}),a},"String Object PlainObject Array Finite Function RegExp".split(" ").forEach(function(a){var b=f.bindKey(f,"is"+a);h["isArrayOf"+a+"s"]=function(a){return f.isArray(a)&&f.every(a.slice(0,10),b)}}),h.ucfirst=function(a){return a[0].toUpperCase()+a.substring(1).toLowerCase()},h.studlyCase=c(!0,!0,""),h.camelCase=c(!1,!0,""),h.snakeCase=c(!1,!1,"_"),h.toLowerString=function(a){return a?"string"!=typeof a&&(a=a.toString()):a="",a.toLowerCase()},h.toUpperString=function(a){return a?"string"!=typeof a&&(a=a.toString()):a="",a.toUpperCase()},h.isNumeric=function(a){return!isNaN(null===a?0/0:1*a)};var i=/^(\d+(?:\.\d+)?)([Mwdhmsy])$/;h.isInterval=function(a){return!(!a.match||!a.match(i))},h.repeat=function(a,b){return new Array(b+1).join(a)},h.inherits=function(a,b){g.inherits(a,b),a.callSuper=function(a,c){c?f.isArguments(c)?h.applyArgs(b,a,c):h.applyArgs(b,a,arguments,1):b.call(a)}},h.trim=function(a){return"string"==typeof a?a.replace(/^\s+|\s+$/g,""):""},h.collectMatches=function(a,b){for(var c,d=[];(c=b.exec(a))&&(d.push(c),b.global===!0););return d},h.applyArgs=function(a,b,c,d){switch(d=d||0,c.length-d){case 0:return a.call(b);case 1:return a.call(b,c[0+d]);case 2:return a.call(b,c[0+d],c[1+d]);case 3:return a.call(b,c[0+d],c[1+d],c[2+d]);case 4:return a.call(b,c[0+d],c[1+d],c[2+d],c[3+d]);case 5:return a.call(b,c[0+d],c[1+d],c[2+d],c[3+d],c[4+d]);default:return a.apply(b,Array.prototype.slice.call(c,d))}},f.nextTick=function(a){d.nextTick(f.bindKey(f,"applyArgs",a,null,arguments,1))},f.handler=function(a){return a._provideBound=!0,a},f.scheduled=f.handler,f.makeBoundMethods=function(a,b){if(a.bound={},b)f.each(b,function(b){a.bound[b]=f.bindKey(a,b)});else{b=[];for(var c in a)"function"==typeof a[c]&&a[c]._provideBound===!0&&(a.bound[c]=f.bind(a[c],a))}},f.noop=function(){},b.exports=h},{__browserify_process:12,lodash:13,path:5,util:8}]},{},[14])(14)}); |