UNPKG

mapbox-gl

Version:
2 lines 966 kB
!function e(t,a,i){function n(o,s){if(!a[o]){if(!t[o]){var u="function"==typeof require&&require;if(!s&&u)return u(o,!0);if(r)return r(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var p=a[o]={exports:{}};t[o][0].call(p.exports,function(e){var a=t[o][1][e];return n(a?a:e)},p,p.exports,e,t,a,i)}return a[o].exports}for(var r="function"==typeof require&&require,o=0;o<i.length;o++)n(i[o]);return n}({1:[function(e,t,a){"use strict";function i(e){this._ev=new u,this.options=o({},this.options,e)}if(!mapboxgl)throw new Error("include mapboxgl before mapbox-gl-geocoder.js");var n=e("suggestions"),r=e("lodash.debounce"),o=e("xtend"),s=e("request"),u=e("events").EventEmitter,c="https://api.mapbox.com/geocoding/v5/mapbox.places/";i.prototype=mapboxgl.util.inherit(mapboxgl.Control,{options:{position:"top-left",placeholder:"Search",zoom:16,flyTo:!0},onAdd:function(e){this.container=this.options.container?"string"==typeof this.options.container?document.getElementById(this.options.container):this.options.container:e.getContainer();var t=document.createElement("div");t.className="mapboxgl-ctrl-geocoder";var a=document.createElement("span");a.className="geocoder-icon geocoder-icon-search";var i=this._inputEl=document.createElement("input");i.type="text",i.placeholder=this.options.placeholder,i.addEventListener("keydown",r(function(e){return e.target.value?void(e.metaKey||-1!==[9,27,37,39,13,38,40].indexOf(e.keyCode)||this._queryFromInput(e.target.value)):this._clearEl.classList.remove("active")}.bind(this)),200),i.addEventListener("change",function(){var t=this._typeahead.selected;if(t){if(this.options.flyTo)if(t.bbox&&t.context.length<=3){var a=t.bbox;e.fitBounds([[a[0],a[1]],[a[2],a[3]]])}else e.flyTo({center:t.center,zoom:this.options.zoom});this._input=t,this.fire("result",{result:t})}}.bind(this));var o=document.createElement("div");o.classList.add("geocoder-pin-right");var s=this._clearEl=document.createElement("button");s.className="geocoder-icon geocoder-icon-close",s.addEventListener("click",this._clear.bind(this));var u=this._loadingEl=document.createElement("span");return u.className="geocoder-icon geocoder-icon-loading",o.appendChild(s),o.appendChild(u),t.appendChild(a),t.appendChild(i),t.appendChild(o),this.container.appendChild(t),this.options.container&&(this.options.position=!1),this._typeahead=new n(i,[],{filter:!1}),this._typeahead.getItemValue=function(e){return e.place_name},t},_geocode:function(e,t){this._loadingEl.classList.add("active"),this.fire("loading");var a={};this.options.proximity&&(a.proximity=this.options.proximity.join()),this.options.country&&(a.country=this.options.country),this.options.types&&(a.types=this.options.types),a.access_token=this.options.accessToken?this.options.accessToken:mapboxgl.accessToken,this.request&&this.request.abort(),this.request=s({url:c+encodeURIComponent(e.trim())+".json",qs:a,json:!0},function(e,a,i){return e?this.fire("error",{error:e.message}):(this._loadingEl.classList.remove("active"),i.features.length?this._clearEl.classList.add("active"):(this._clearEl.classList.remove("active"),this._typeahead.selected=null),this._typeahead.update(i.features),t(i.features))}.bind(this))},_queryFromInput:function(e){e=e.trim(),e||this._clear(),e.length>2&&this._geocode(e,function(e){this._results=e}.bind(this))},_change:function(){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),this._inputEl.dispatchEvent(e)},_query:function(e){if(e){var t="string"==typeof e?e:e.join();this._geocode(t,function(e){if(e.length){var t=e[0];this._results=e,this._typeahead.selected=t,this._inputEl.value=t.place_name,this._change()}}.bind(this))}},_clear:function(){this._input=null,this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this._change(),this._inputEl.focus(),this._clearEl.classList.remove("active"),this.fire("clear")},getResult:function(){return this._input},query:function(e){return this._query(e),this},on:function(e,t){return this._ev.on(e,t),this},fire:function(e,t){return this._ev.emit(e,t),this},off:function(e,t){return this._ev.removeListener(e,t),this}}),window.mapboxgl?mapboxgl.Geocoder=i:"undefined"!=typeof t&&(t.exports=i)},{events:225,"lodash.debounce":323,request:341,suggestions:374,xtend:388}],2:[function(e,t,a){t.exports={newInvalidAsn1Error:function(e){var t=new Error;return t.name="InvalidAsn1Error",t.message=e||"",t}}},{}],3:[function(e,t,a){var i=e("./errors"),n=e("./types"),r=e("./reader"),o=e("./writer");t.exports={Reader:r,Writer:o};for(var s in n)n.hasOwnProperty(s)&&(t.exports[s]=n[s]);for(var u in i)i.hasOwnProperty(u)&&(t.exports[u]=i[u])},{"./errors":2,"./reader":4,"./types":5,"./writer":6}],4:[function(e,t,a){(function(a){function i(e){if(!e||!a.isBuffer(e))throw new TypeError("data must be a node Buffer");this._buf=e,this._size=e.length,this._len=0,this._offset=0}var n=e("assert"),r=e("./types"),o=e("./errors"),s=o.newInvalidAsn1Error;Object.defineProperty(i.prototype,"length",{enumerable:!0,get:function(){return this._len}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){return this._offset}}),Object.defineProperty(i.prototype,"remain",{get:function(){return this._size-this._offset}}),Object.defineProperty(i.prototype,"buffer",{get:function(){return this._buf.slice(this._offset)}}),i.prototype.readByte=function(e){if(this._size-this._offset<1)return null;var t=255&this._buf[this._offset];return e||(this._offset+=1),t},i.prototype.peek=function(){return this.readByte(!0)},i.prototype.readLength=function(e){if(void 0===e&&(e=this._offset),e>=this._size)return null;var t=255&this._buf[e++];if(null===t)return null;if(128==(128&t)){if(t&=127,0==t)throw s("Indefinite length not supported");if(t>4)throw s("encoding too long");if(this._size-e<t)return null;this._len=0;for(var a=0;t>a;a++)this._len=(this._len<<8)+(255&this._buf[e++])}else this._len=t;return e},i.prototype.readSequence=function(e){var t=this.peek();if(null===t)return null;if(void 0!==e&&e!==t)throw s("Expected 0x"+e.toString(16)+": got 0x"+t.toString(16));var a=this.readLength(this._offset+1);return null===a?null:(this._offset=a,t)},i.prototype.readInt=function(){return this._readTag(r.Integer)},i.prototype.readBoolean=function(){return 0!==this._readTag(r.Boolean)},i.prototype.readEnumeration=function(){return this._readTag(r.Enumeration)},i.prototype.readString=function(e,t){e||(e=r.OctetString);var i=this.peek();if(null===i)return null;if(i!==e)throw s("Expected 0x"+e.toString(16)+": got 0x"+i.toString(16));var n=this.readLength(this._offset+1);if(null===n)return null;if(this.length>this._size-n)return null;if(this._offset=n,0===this.length)return t?new a(0):"";var o=this._buf.slice(this._offset,this._offset+this.length);return this._offset+=this.length,t?o:o.toString("utf8")},i.prototype.readOID=function(e){e||(e=r.OID);var t=this.readString(e,!0);if(null===t)return null;for(var a=[],i=0,n=0;n<t.length;n++){var o=255&t[n];i<<=7,i+=127&o,0==(128&o)&&(a.push(i),i=0)}return i=a.shift(),a.unshift(i%40),a.unshift(i/40>>0),a.join(".")},i.prototype._readTag=function(e){n.ok(void 0!==e);var t=this.peek();if(null===t)return null;if(t!==e)throw s("Expected 0x"+e.toString(16)+": got 0x"+t.toString(16));var a=this.readLength(this._offset+1);if(null===a)return null;if(this.length>4)throw s("Integer too long: "+this.length);if(this.length>this._size-a)return null;this._offset=a;for(var i=this._buf[this._offset],r=0,o=0;o<this.length;o++)r<<=8,r|=255&this._buf[this._offset++];return 128==(128&i)&&4!==o&&(r-=1<<8*o),r>>0},t.exports=i}).call(this,e("buffer").Buffer)},{"./errors":2,"./types":5,assert:14,buffer:29}],5:[function(e,t,a){t.exports={EOC:0,Boolean:1,Integer:2,BitString:3,OctetString:4,Null:5,OID:6,ObjectDescriptor:7,External:8,Real:9,Enumeration:10,PDV:11,Utf8String:12,RelativeOID:13,Sequence:16,Set:17,NumericString:18,PrintableString:19,T61String:20,VideotexString:21,IA5String:22,UTCTime:23,GeneralizedTime:24,GraphicString:25,VisibleString:26,GeneralString:28,UniversalString:29,CharacterString:30,BMPString:31,Constructor:32,Context:128}},{}],6:[function(e,t,a){(function(a){function i(e,t){r.ok(e),r.equal(typeof e,"object"),r.ok(t),r.equal(typeof t,"object");var a=Object.getOwnPropertyNames(e);return a.forEach(function(a){if(!t[a]){var i=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,i)}}),t}function n(e){e=i(u,e||{}),this._buf=new a(e.size||1024),this._size=this._buf.length,this._offset=0,this._options=e,this._seq=[]}var r=e("assert"),o=e("./types"),s=e("./errors"),u=(s.newInvalidAsn1Error,{size:1024,growthFactor:8});Object.defineProperty(n.prototype,"buffer",{get:function(){if(this._seq.length)throw new InvalidAsn1Error(this._seq.length+" unended sequence(s)");return this._buf.slice(0,this._offset)}}),n.prototype.writeByte=function(e){if("number"!=typeof e)throw new TypeError("argument must be a Number");this._ensure(1),this._buf[this._offset++]=e},n.prototype.writeInt=function(e,t){if("number"!=typeof e)throw new TypeError("argument must be a Number");"number"!=typeof t&&(t=o.Integer);for(var a=4;(0===(4286578688&e)||-8388608===(4286578688&e))&&a>1;)a--,e<<=8;if(a>4)throw new InvalidAsn1Error("BER ints cannot be > 0xffffffff");for(this._ensure(2+a),this._buf[this._offset++]=t,this._buf[this._offset++]=a;a-- >0;)this._buf[this._offset++]=(4278190080&e)>>>24,e<<=8},n.prototype.writeNull=function(){this.writeByte(o.Null),this.writeByte(0)},n.prototype.writeEnumeration=function(e,t){if("number"!=typeof e)throw new TypeError("argument must be a Number");return"number"!=typeof t&&(t=o.Enumeration),this.writeInt(e,t)},n.prototype.writeBoolean=function(e,t){if("boolean"!=typeof e)throw new TypeError("argument must be a Boolean");"number"!=typeof t&&(t=o.Boolean),this._ensure(3),this._buf[this._offset++]=t,this._buf[this._offset++]=1,this._buf[this._offset++]=e?255:0},n.prototype.writeString=function(e,t){if("string"!=typeof e)throw new TypeError("argument must be a string (was: "+typeof e+")");"number"!=typeof t&&(t=o.OctetString);var i=a.byteLength(e);this.writeByte(t),this.writeLength(i),i&&(this._ensure(i),this._buf.write(e,this._offset),this._offset+=i)},n.prototype.writeBuffer=function(e,t){if("number"!=typeof t)throw new TypeError("tag must be a number");if(!a.isBuffer(e))throw new TypeError("argument must be a buffer");this.writeByte(t),this.writeLength(e.length),this._ensure(e.length),e.copy(this._buf,this._offset,0,e.length),this._offset+=e.length},n.prototype.writeStringArray=function(e){if(!e instanceof Array)throw new TypeError("argument must be an Array[String]");var t=this;e.forEach(function(e){t.writeString(e)})},n.prototype.writeOID=function(e,t){function a(e,t){128>t?e.push(t):16384>t?(e.push(t>>>7|128),e.push(127&t)):2097152>t?(e.push(t>>>14|128),e.push(255&(t>>>7|128)),e.push(127&t)):268435456>t?(e.push(t>>>21|128),e.push(255&(t>>>14|128)),e.push(255&(t>>>7|128)),e.push(127&t)):(e.push(255&(t>>>28|128)),e.push(255&(t>>>21|128)),e.push(255&(t>>>14|128)),e.push(255&(t>>>7|128)),e.push(127&t))}if("string"!=typeof e)throw new TypeError("argument must be a string");if("number"!=typeof t&&(t=o.OID),!/^([0-9]+\.){3,}[0-9]+$/.test(e))throw new Error("argument is not a valid OID string");var i=e.split("."),n=[];n.push(40*parseInt(i[0],10)+parseInt(i[1],10)),i.slice(2).forEach(function(e){a(n,parseInt(e,10))});var r=this;this._ensure(2+n.length),this.writeByte(t),this.writeLength(n.length),n.forEach(function(e){r.writeByte(e)})},n.prototype.writeLength=function(e){if("number"!=typeof e)throw new TypeError("argument must be a Number");if(this._ensure(4),127>=e)this._buf[this._offset++]=e;else if(255>=e)this._buf[this._offset++]=129,this._buf[this._offset++]=e;else if(65535>=e)this._buf[this._offset++]=130,this._buf[this._offset++]=e>>8,this._buf[this._offset++]=e;else{if(!(16777215>=e))throw new InvalidAsn1ERror("Length too long (> 4 bytes)");this._buf[this._offset++]=131,this._buf[this._offset++]=e>>16,this._buf[this._offset++]=e>>8,this._buf[this._offset++]=e}},n.prototype.startSequence=function(e){"number"!=typeof e&&(e=o.Sequence|o.Constructor),this.writeByte(e),this._seq.push(this._offset),this._ensure(3),this._offset+=3},n.prototype.endSequence=function(){var e=this._seq.pop(),t=e+3,a=this._offset-t;if(127>=a)this._shift(t,a,-2),this._buf[e]=a;else if(255>=a)this._shift(t,a,-1),this._buf[e]=129,this._buf[e+1]=a;else if(65535>=a)this._buf[e]=130,this._buf[e+1]=a>>8,this._buf[e+2]=a;else{if(!(16777215>=a))throw new InvalidAsn1Error("Sequence too long");this._shift(t,a,1),this._buf[e]=131,this._buf[e+1]=a>>16,this._buf[e+2]=a>>8,this._buf[e+3]=a}},n.prototype._shift=function(e,t,a){r.ok(void 0!==e),r.ok(void 0!==t),r.ok(a),this._buf.copy(this._buf,e+a,e,e+t),this._offset+=a},n.prototype._ensure=function(e){if(r.ok(e),this._size-this._offset<e){var t=this._size*this._options.growthFactor;t-this._offset<e&&(t+=e);var i=new a(t);this._buf.copy(i,0,0,this._offset),this._buf=i,this._size=t}},t.exports=n}).call(this,e("buffer").Buffer)},{"./errors":2,"./types":5,assert:14,buffer:29}],7:[function(e,t,a){var i=e("./ber/index");t.exports={Ber:i,BerReader:i.Reader,BerWriter:i.Writer}},{"./ber/index":3}],8:[function(e,t,a){(function(a,i){function n(e){return e.charAt(0).toUpperCase()+e.slice(1)}function r(e,t,a,i,n){throw new c.AssertionError({message:f.format("%s (%s) is required",e,t),actual:void 0===n?typeof i:n(i),expected:t,operator:a||"===",stackStartFunction:r.caller})}function o(e){return Object.prototype.toString.call(e).slice(8,-1)}function s(){}function u(e){var t,a=Object.keys(d);return t=i.env.NODE_NDEBUG?s:function(e,t){e||r(t,"true",e)},a.forEach(function(a){if(e)return void(t[a]=s);var i=d[a];t[a]=function(e,t){i.check(e)||r(t,a,i.operator,e,i.actual)}}),a.forEach(function(a){var i="optional"+n(a);if(e)return void(t[i]=s);var o=d[a];t[i]=function(e,t){void 0!==e&&null!==e&&(o.check(e)||r(t,a,o.operator,e,o.actual))}}),a.forEach(function(a){var i="arrayOf"+n(a);if(e)return void(t[i]=s);var o=d[a],u="["+a+"]";t[i]=function(e,t){Array.isArray(e)||r(t,u,o.operator,e,o.actual);var a;for(a=0;a<e.length;a++)o.check(e[a])||r(t,u,o.operator,e,o.actual)}}),a.forEach(function(a){var i="optionalArrayOf"+n(a);if(e)return void(t[i]=s);var o=d[a],u="["+a+"]";t[i]=function(e,t){if(void 0!==e&&null!==e){Array.isArray(e)||r(t,u,o.operator,e,o.actual);var a;for(a=0;a<e.length;a++)o.check(e[a])||r(t,u,o.operator,e,o.actual)}}}),Object.keys(c).forEach(function(a){return"AssertionError"===a?void(t[a]=c[a]):e?void(t[a]=s):void(t[a]=c[a])}),t._setExports=u,t}var c=e("assert"),p=e("stream").Stream,f=e("util"),h=/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/,d={bool:{check:function(e){return"boolean"==typeof e}},func:{check:function(e){return"function"==typeof e}},string:{check:function(e){return"string"==typeof e}},object:{check:function(e){return"object"==typeof e&&null!==e}},number:{check:function(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}},buffer:{check:function(e){return a.isBuffer(e)},operator:"Buffer.isBuffer"},array:{check:function(e){return Array.isArray(e)},operator:"Array.isArray"},stream:{check:function(e){return e instanceof p},operator:"instanceof",actual:o},date:{check:function(e){return e instanceof Date},operator:"instanceof",actual:o},regexp:{check:function(e){return e instanceof RegExp},operator:"instanceof",actual:o},uuid:{check:function(e){return"string"==typeof e&&h.test(e)},operator:"isUUID"}};t.exports=u(i.env.NODE_NDEBUG)}).call(this,{isBuffer:e("../browserify/node_modules/insert-module-globals/node_modules/is-buffer/index.js")},e("_process"))},{"../browserify/node_modules/insert-module-globals/node_modules/is-buffer/index.js":228,_process:231,assert:14,stream:249,util:262}],9:[function(e,t,a){function i(e){return"AWS "+e.key+":"+r(e)}function n(e){return f.createHmac("sha1",e.secret).update(e.message).digest("base64")}function r(e){return e.message=s(e),n(e)}function o(e){return e.message=u(e),n(e)}function s(e){var t=e.amazonHeaders||"";t&&(t+="\n");var a=[e.verb,e.md5,e.contentType,e.date?e.date.toUTCString():"",t+e.resource];return a.join("\n")}function u(e){return"GET\n\n\n"+e.date+"\n"+e.resource}function c(e){for(var t=[],a=Object.keys(e),i=0,n=a.length;n>i;++i){var r=a[i],o=e[r],r=r.toLowerCase();0===r.indexOf("x-amz")&&t.push(r+":"+o)}return t.sort().join("\n")}function p(e){var t=h(e,!0),a=t.pathname,i=[];return Object.keys(t.query).forEach(function(e){if(~d.indexOf(e)){var a=""==t.query[e]?"":"="+encodeURIComponent(t.query[e]);i.push(e+a)}}),a+(i.length?"?"+i.sort().join("&"):"")}var f=e("crypto"),h=e("url").parse,d=["acl","location","logging","notification","partNumber","policy","requestPayment","torrent","uploadId","uploads","versionId","versioning","versions","website"];t.exports=i,t.exports.authorization=i,t.exports.hmacSha1=n,t.exports.sign=r,t.exports.signQuery=o,t.exports.queryStringToSign=s,t.exports.queryStringToSign=u,t.exports.canonicalizeHeaders=c,t.exports.canonicalizeResource=p},{crypto:33,url:260}],10:[function(e,t,a){(function(t,i){function n(e,t,a){return f.createHmac("sha256",e).update(t,"utf8").digest(a)}function r(e,t){return f.createHash("sha256").update(e,"utf8").digest(t)}function o(e){return e.replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}function s(e,t){"string"==typeof e&&(e=c.parse(e));var a=e.headers=e.headers||{},i=this.matchHost(e.hostname||e.host||a.Host||a.host);this.request=e,this.credentials=t||this.defaultCredentials(),this.service=e.service||i[0]||"",this.region=e.region||i[1]||"us-east-1","email"===this.service&&(this.service="ses"),!e.method&&e.body&&(e.method="POST"),a.Host||a.host||(a.Host=e.hostname||e.host||this.createHost(),e.port&&(a.Host+=":"+e.port)),e.hostname||e.host||(e.hostname=a.Host||a.host)}var u=a,c=e("url"),p=e("querystring"),f=e("crypto"),h=e("./lru"),d=h(1e3);s.prototype.matchHost=function(e){var t=(e||"").match(/([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com$/),a=(t||[]).slice(1,3);return"es"===a[1]&&(a=a.reverse()),a},s.prototype.isSingleRegion=function(){return["s3","sdb"].indexOf(this.service)>=0&&"us-east-1"===this.region?!0:["cloudfront","ls","route53","iam","importexport","sts"].indexOf(this.service)>=0},s.prototype.createHost=function(){var e=this.isSingleRegion()?"":("s3"===this.service&&"us-east-1"!==this.region?"-":".")+this.region,t="ses"===this.service?"email":this.service;return t+e+".amazonaws.com"},s.prototype.prepareRequest=function(){this.parsePath();var e,t=this.request,a=t.headers;t.signQuery?(this.parsedPath.query=e=this.parsedPath.query||{},this.credentials.sessionToken&&(e["X-Amz-Security-Token"]=this.credentials.sessionToken),"s3"!==this.service||e["X-Amz-Expires"]||(e["X-Amz-Expires"]=86400),e["X-Amz-Date"]?this.datetime=e["X-Amz-Date"]:e["X-Amz-Date"]=this.getDateTime(),e["X-Amz-Algorithm"]="AWS4-HMAC-SHA256",e["X-Amz-Credential"]=this.credentials.accessKeyId+"/"+this.credentialString(),e["X-Amz-SignedHeaders"]=this.signedHeaders()):(t.doNotModifyHeaders||(!t.body||a["Content-Type"]||a["content-type"]||(a["Content-Type"]="application/x-www-form-urlencoded; charset=utf-8"),!t.body||a["Content-Length"]||a["content-length"]||(a["Content-Length"]=i.byteLength(t.body)),this.credentials.sessionToken&&(a["X-Amz-Security-Token"]=this.credentials.sessionToken),"s3"===this.service&&(a["X-Amz-Content-Sha256"]=r(this.request.body||"","hex")),a["X-Amz-Date"]?this.datetime=a["X-Amz-Date"]:a["X-Amz-Date"]=this.getDateTime()),delete a.Authorization,delete a.authorization)},s.prototype.sign=function(){return this.parsedPath||this.prepareRequest(),this.request.signQuery?this.parsedPath.query["X-Amz-Signature"]=this.signature():this.request.headers.Authorization=this.authHeader(),this.request.path=this.formatPath(),this.request},s.prototype.getDateTime=function(){if(!this.datetime){var e=this.request.headers,t=new Date(e.Date||e.date||new Date);this.datetime=t.toISOString().replace(/[:\-]|\.\d{3}/g,"")}return this.datetime},s.prototype.getDate=function(){return this.getDateTime().substr(0,8)},s.prototype.authHeader=function(){return["AWS4-HMAC-SHA256 Credential="+this.credentials.accessKeyId+"/"+this.credentialString(),"SignedHeaders="+this.signedHeaders(),"Signature="+this.signature()].join(", ")},s.prototype.signature=function(){var e,t,a,i=this.getDate(),r=[this.credentials.secretAccessKey,i,this.region,this.service].join(),o=d.get(r);return o||(e=n("AWS4"+this.credentials.secretAccessKey,i),t=n(e,this.region),a=n(t,this.service),o=n(a,"aws4_request"),d.set(r,o)),n(o,this.stringToSign(),"hex")},s.prototype.stringToSign=function(){return["AWS4-HMAC-SHA256",this.getDateTime(),this.credentialString(),r(this.canonicalString(),"hex")].join("\n")},s.prototype.canonicalString=function(){this.parsedPath||this.prepareRequest();var e=this.parsedPath.path,t=this.parsedPath.query,a="",i="s3"!==this.service,n="s3"===this.service||this.request.doNotEncodePath,s="s3"===this.service,u="s3"===this.service,c="s3"===this.service&&this.request.signQuery?"UNSIGNED-PAYLOAD":r(this.request.body||"","hex");return t&&(a=o(p.stringify(Object.keys(t).sort().reduce(function(e,a){return a?(e[a]=Array.isArray(t[a])?u?t[a][0]:t[a].slice().sort():t[a],e):e},{})))),"/"!==e&&(i&&(e=e.replace(/\/{2,}/g,"/")),e=e.split("/").reduce(function(e,t){return i&&".."===t?e.pop():i&&"."===t||(n&&(t=p.unescape(t)),e.push(o(p.escape(t)))),e},[]).join("/"),"/"!==e[0]&&(e="/"+e),s&&(e=e.replace(/%2F/g,"/"))),[this.request.method||"GET",e,a,this.canonicalHeaders()+"\n",this.signedHeaders(),c].join("\n")},s.prototype.canonicalHeaders=function(){function e(e){return e.toString().trim().replace(/\s+/g," ")}var t=this.request.headers;return Object.keys(t).sort(function(e,t){return e.toLowerCase()<t.toLowerCase()?-1:1}).map(function(a){return a.toLowerCase()+":"+e(t[a])}).join("\n")},s.prototype.signedHeaders=function(){return Object.keys(this.request.headers).map(function(e){return e.toLowerCase()}).sort().join(";")},s.prototype.credentialString=function(){return[this.getDate(),this.region,this.service,"aws4_request"].join("/")},s.prototype.defaultCredentials=function(){var e=t.env;return{accessKeyId:e.AWS_ACCESS_KEY_ID||e.AWS_ACCESS_KEY,secretAccessKey:e.AWS_SECRET_ACCESS_KEY||e.AWS_SECRET_KEY,sessionToken:e.AWS_SESSION_TOKEN}},s.prototype.parsePath=function(){var e=this.request.path||"/",t=e.indexOf("?"),a=null;t>=0&&(a=p.parse(e.slice(t+1)),e=e.slice(0,t)),/[^0-9A-Za-z!'()*\-._~%\/]/.test(e)&&(e=e.split("/").map(function(e){return p.escape(p.unescape(e))}).join("/")),this.parsedPath={path:e,query:a}},s.prototype.formatPath=function(){var e=this.parsedPath.path,t=this.parsedPath.query;return t?(null!=t[""]&&delete t[""],e+"?"+o(p.stringify(t))):e},u.RequestSigner=s,u.sign=function(e,t){return new s(e,t).sign()}}).call(this,e("_process"),e("buffer").Buffer)},{"./lru":11,_process:231,buffer:29,crypto:33,querystring:235,url:260}],11:[function(e,t,a){function i(e){this.capacity=0|e,this.map=Object.create(null),this.list=new n}function n(){this.firstNode=null,this.lastNode=null}function r(e,t){this.key=e,this.val=t,this.prev=null,this.next=null}t.exports=function(e){return new i(e)},i.prototype.get=function(e){var t=this.map[e];if(null!=t)return this.used(t),t.val},i.prototype.set=function(e,t){var a=this.map[e];if(null!=a)a.val=t;else{if(this.capacity||this.prune(),!this.capacity)return!1;a=new r(e,t),this.map[e]=a,this.capacity--}return this.used(a),!0},i.prototype.used=function(e){this.list.moveToFront(e)},i.prototype.prune=function(){var e=this.list.pop();null!=e&&(delete this.map[e.key],this.capacity++)},n.prototype.moveToFront=function(e){this.firstNode!=e&&(this.remove(e),null==this.firstNode?(this.firstNode=e,this.lastNode=e,e.prev=null,e.next=null):(e.prev=null,e.next=this.firstNode,e.next.prev=e,this.firstNode=e))},n.prototype.pop=function(){var e=this.lastNode;return null!=e&&this.remove(e),e},n.prototype.remove=function(e){this.firstNode==e?this.firstNode=e.next:null!=e.prev&&(e.prev.next=e.next),this.lastNode==e?this.lastNode=e.prev:null!=e.next&&(e.next.prev=e.prev)}},{}],12:[function(e,t,a){(function(a){function i(e){if(!(this instanceof i))return new i(e);if(this._bufs=[],this.length=0,"function"==typeof e){this._callback=e;var t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",function(e){e.on("error",t)}),this.on("unpipe",function(e){e.removeListener("error",t)})}else this.append(e);n.call(this)}var n=e("readable-stream/duplex"),r=e("util");r.inherits(i,n),i.prototype._offset=function(e){for(var t,a=0,i=0;i<this._bufs.length;i++){if(t=a+this._bufs[i].length,t>e)return[i,e-a];a=t}},i.prototype.append=function(e){var t,n=0;if(Array.isArray(e))for(;n<e.length;n++)this.append(e[n]);else if(e instanceof i)for(;n<e._bufs.length;n++)this.append(e._bufs[n]);else null!=e&&("number"==typeof e&&(e=e.toString()),t=a.isBuffer(e)?e:new a(e),this._bufs.push(t),this.length+=t.length);return this},i.prototype._write=function(e,t,a){this.append(e),"function"==typeof a&&a()},i.prototype._read=function(e){return this.length?(e=Math.min(e,this.length),this.push(this.slice(0,e)),void this.consume(e)):this.push(null)},i.prototype.end=function(e){n.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},i.prototype.get=function(e){return this.slice(e,e+1)[0]},i.prototype.slice=function(e,t){return this.copy(null,0,e,t)},i.prototype.copy=function o(e,t,i,n){if(("number"!=typeof i||0>i)&&(i=0),("number"!=typeof n||n>this.length)&&(n=this.length),i>=this.length)return e||new a(0);if(0>=n)return e||new a(0);var r,s,o=!!e,u=this._offset(i),c=n-i,p=c,f=o&&t||0,h=u[1];if(0===i&&n==this.length){if(!o)return a.concat(this._bufs);for(s=0;s<this._bufs.length;s++)this._bufs[s].copy(e,f),f+=this._bufs[s].length;return e}if(p<=this._bufs[u[0]].length-h)return o?this._bufs[u[0]].copy(e,t,h,h+p):this._bufs[u[0]].slice(h,h+p);for(o||(e=new a(c)),s=u[0];s<this._bufs.length;s++){if(r=this._bufs[s].length-h,!(p>r)){this._bufs[s].copy(e,f,h,h+p);break}this._bufs[s].copy(e,f,h),f+=r,p-=r,h&&(h=0)}return e},i.prototype.toString=function(e,t,a){return this.slice(t,a).toString(e)},i.prototype.consume=function(e){for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},i.prototype.duplicate=function(){for(var e=0,t=new i;e<this._bufs.length;e++)t.append(this._bufs[e]);return t},i.prototype.destroy=function(){this._bufs.length=0,this.length=0,this.push(null)},function(){var e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1};for(var t in e)!function(t){i.prototype[t]=function(a){return this.slice(a,a+e[t])[t](0)}}(t)}(),t.exports=i}).call(this,e("buffer").Buffer)},{buffer:29,"readable-stream/duplex":337,util:262}],13:[function(e,t,a){},{}],14:[function(e,t,a){function i(e,t){return d.isUndefined(t)?""+t:d.isNumber(t)&&!isFinite(t)?t.toString():d.isFunction(t)||d.isRegExp(t)?t.toString():t}function n(e,t){return d.isString(e)?e.length<t?e:e.slice(0,t):e}function r(e){return n(JSON.stringify(e.actual,i),128)+" "+e.operator+" "+n(JSON.stringify(e.expected,i),128)}function o(e,t,a,i,n){throw new b.AssertionError({message:a,actual:e,expected:t,operator:i,stackStartFunction:n})}function s(e,t){e||o(e,!0,t,"==",b.ok)}function u(e,t){if(e===t)return!0;if(d.isBuffer(e)&&d.isBuffer(t)){if(e.length!=t.length)return!1;for(var a=0;a<e.length;a++)if(e[a]!==t[a])return!1;return!0}return d.isDate(e)&&d.isDate(t)?e.getTime()===t.getTime():d.isRegExp(e)&&d.isRegExp(t)?e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase:d.isObject(e)||d.isObject(t)?p(e,t):e==t}function c(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function p(e,t){if(d.isNullOrUndefined(e)||d.isNullOrUndefined(t))return!1;if(e.prototype!==t.prototype)return!1;if(d.isPrimitive(e)||d.isPrimitive(t))return e===t;var a=c(e),i=c(t);if(a&&!i||!a&&i)return!1;if(a)return e=l.call(e),t=l.call(t),u(e,t);var n,r,o=g(e),s=g(t);if(o.length!=s.length)return!1;for(o.sort(),s.sort(),r=o.length-1;r>=0;r--)if(o[r]!=s[r])return!1;for(r=o.length-1;r>=0;r--)if(n=o[r],!u(e[n],t[n]))return!1;return!0}function f(e,t){return e&&t?"[object RegExp]"==Object.prototype.toString.call(t)?t.test(e):e instanceof t?!0:t.call({},e)===!0:!1}function h(e,t,a,i){var n;d.isString(a)&&(i=a,a=null);try{t()}catch(r){n=r}if(i=(a&&a.name?" ("+a.name+").":".")+(i?" "+i:"."),e&&!n&&o(n,a,"Missing expected exception"+i),!e&&f(n,a)&&o(n,a,"Got unwanted exception"+i),e&&n&&a&&!f(n,a)||!e&&n)throw n}var d=e("util/"),l=Array.prototype.slice,m=Object.prototype.hasOwnProperty,b=t.exports=s;b.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=r(this),this.generatedMessage=!0);var t=e.stackStartFunction||o;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var a=new Error;if(a.stack){var i=a.stack,n=t.name,s=i.indexOf("\n"+n);if(s>=0){var u=i.indexOf("\n",s+1);i=i.substring(u+1)}this.stack=i}}},d.inherits(b.AssertionError,Error),b.fail=o,b.ok=s,b.equal=function(e,t,a){e!=t&&o(e,t,a,"==",b.equal)},b.notEqual=function(e,t,a){e==t&&o(e,t,a,"!=",b.notEqual)},b.deepEqual=function(e,t,a){u(e,t)||o(e,t,a,"deepEqual",b.deepEqual)},b.notDeepEqual=function(e,t,a){u(e,t)&&o(e,t,a,"notDeepEqual",b.notDeepEqual)},b.strictEqual=function(e,t,a){e!==t&&o(e,t,a,"===",b.strictEqual)},b.notStrictEqual=function(e,t,a){e===t&&o(e,t,a,"!==",b.notStrictEqual)},b["throws"]=function(e,t,a){h.apply(this,[!0].concat(l.call(arguments)))},b.doesNotThrow=function(e,t){h.apply(this,[!1].concat(l.call(arguments)))},b.ifError=function(e){if(e)throw e};var g=Object.keys||function(e){var t=[];for(var a in e)m.call(e,a)&&t.push(a);return t}},{"util/":262}],15:[function(e,t,a){arguments[4][13][0].apply(a,arguments)},{dup:13}],16:[function(e,t,a){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;a.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var a=t.shift();if(a){if("object"!=typeof a)throw new TypeError(a+"must be non-object");for(var i in a)a.hasOwnProperty(i)&&(e[i]=a[i])}}return e},a.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,a,i,n){if(t.subarray&&e.subarray)return void e.set(t.subarray(a,a+i),n);for(var r=0;i>r;r++)e[n+r]=t[a+r]},flattenChunks:function(e){var t,a,i,n,r,o;for(i=0,t=0,a=e.length;a>t;t++)i+=e[t].length;for(o=new Uint8Array(i),n=0,t=0,a=e.length;a>t;t++)r=e[t],o.set(r,n),n+=r.length;return o}},r={arraySet:function(e,t,a,i,n){for(var r=0;i>r;r++)e[n+r]=t[a+r]},flattenChunks:function(e){return[].concat.apply([],e)}};a.setTyped=function(e){e?(a.Buf8=Uint8Array,a.Buf16=Uint16Array,a.Buf32=Int32Array,a.assign(a,n)):(a.Buf8=Array,a.Buf16=Array,a.Buf32=Array,a.assign(a,r))},a.setTyped(i)},{}],17:[function(e,t,a){"use strict";function i(e,t,a,i){for(var n=65535&e|0,r=e>>>16&65535|0,o=0;0!==a;){o=a>2e3?2e3:a,a-=o;do n=n+t[i++]|0,r=r+n|0;while(--o);n%=65521,r%=65521}return n|r<<16|0}t.exports=i},{}],18:[function(e,t,a){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],19:[function(e,t,a){"use strict";function i(){for(var e,t=[],a=0;256>a;a++){e=a;for(var i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1; t[a]=e}return t}function n(e,t,a,i){var n=r,o=i+a;e=-1^e;for(var s=i;o>s;s++)e=e>>>8^n[255&(e^t[s])];return-1^e}var r=i();t.exports=n},{}],20:[function(e,t,a){"use strict";function i(e,t){return e.msg=M[t],t}function n(e){return(e<<1)-(e>4?9:0)}function r(e){for(var t=e.length;--t>=0;)e[t]=0}function o(e){var t=e.state,a=t.pending;a>e.avail_out&&(a=e.avail_out),0!==a&&(z.arraySet(e.output,t.pending_buf,t.pending_out,a,e.next_out),e.next_out+=a,t.pending_out+=a,e.total_out+=a,e.avail_out-=a,t.pending-=a,0===t.pending&&(t.pending_out=0))}function s(e,t){B._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,o(e.strm)}function u(e,t){e.pending_buf[e.pending++]=t}function c(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function p(e,t,a,i){var n=e.avail_in;return n>i&&(n=i),0===n?0:(e.avail_in-=n,z.arraySet(t,e.input,e.next_in,n,a),1===e.state.wrap?e.adler=F(e.adler,t,n,a):2===e.state.wrap&&(e.adler=q(e.adler,t,n,a)),e.next_in+=n,e.total_in+=n,n)}function f(e,t){var a,i,n=e.max_chain_length,r=e.strstart,o=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-ce?e.strstart-(e.w_size-ce):0,c=e.window,p=e.w_mask,f=e.prev,h=e.strstart+ue,d=c[r+o-1],l=c[r+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(a=t,c[a+o]===l&&c[a+o-1]===d&&c[a]===c[r]&&c[++a]===c[r+1]){r+=2,a++;do;while(c[++r]===c[++a]&&c[++r]===c[++a]&&c[++r]===c[++a]&&c[++r]===c[++a]&&c[++r]===c[++a]&&c[++r]===c[++a]&&c[++r]===c[++a]&&c[++r]===c[++a]&&h>r);if(i=ue-(h-r),r=h-ue,i>o){if(e.match_start=t,o=i,i>=s)break;d=c[r+o-1],l=c[r+o]}}while((t=f[t&p])>u&&0!==--n);return o<=e.lookahead?o:e.lookahead}function h(e){var t,a,i,n,r,o=e.w_size;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=o+(o-ce)){z.arraySet(e.window,e.window,o,o,0),e.match_start-=o,e.strstart-=o,e.block_start-=o,a=e.hash_size,t=a;do i=e.head[--t],e.head[t]=i>=o?i-o:0;while(--a);a=o,t=a;do i=e.prev[--t],e.prev[t]=i>=o?i-o:0;while(--a);n+=o}if(0===e.strm.avail_in)break;if(a=p(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=a,e.lookahead+e.insert>=se)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=(e.ins_h<<e.hash_shift^e.window[r+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[r+se-1])&e.hash_mask,e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<se)););}while(e.lookahead<ce&&0!==e.strm.avail_in)}function d(e,t){var a=65535;for(a>e.pending_buf_size-5&&(a=e.pending_buf_size-5);;){if(e.lookahead<=1){if(h(e),0===e.lookahead&&t===I)return ve;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+a;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,s(e,!1),0===e.strm.avail_out))return ve;if(e.strstart-e.block_start>=e.w_size-ce&&(s(e,!1),0===e.strm.avail_out))return ve}return e.insert=0,t===R?(s(e,!0),0===e.strm.avail_out?ke:we):e.strstart>e.block_start&&(s(e,!1),0===e.strm.avail_out)?ve:ve}function l(e,t){for(var a,i;;){if(e.lookahead<ce){if(h(e),e.lookahead<ce&&t===I)return ve;if(0===e.lookahead)break}if(a=0,e.lookahead>=se&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+se-1])&e.hash_mask,a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==a&&e.strstart-a<=e.w_size-ce&&(e.match_length=f(e,a)),e.match_length>=se)if(i=B._tr_tally(e,e.strstart-e.match_start,e.match_length-se),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=se){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+se-1])&e.hash_mask,a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(0!==--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else i=B._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(s(e,!1),0===e.strm.avail_out))return ve}return e.insert=e.strstart<se-1?e.strstart:se-1,t===R?(s(e,!0),0===e.strm.avail_out?ke:we):e.last_lit&&(s(e,!1),0===e.strm.avail_out)?ve:ye}function m(e,t){for(var a,i,n;;){if(e.lookahead<ce){if(h(e),e.lookahead<ce&&t===I)return ve;if(0===e.lookahead)break}if(a=0,e.lookahead>=se&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+se-1])&e.hash_mask,a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=se-1,0!==a&&e.prev_length<e.max_lazy_match&&e.strstart-a<=e.w_size-ce&&(e.match_length=f(e,a),e.match_length<=5&&(e.strategy===K||e.match_length===se&&e.strstart-e.match_start>4096)&&(e.match_length=se-1)),e.prev_length>=se&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-se,i=B._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-se),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+se-1])&e.hash_mask,a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(0!==--e.prev_length);if(e.match_available=0,e.match_length=se-1,e.strstart++,i&&(s(e,!1),0===e.strm.avail_out))return ve}else if(e.match_available){if(i=B._tr_tally(e,0,e.window[e.strstart-1]),i&&s(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return ve}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=B._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<se-1?e.strstart:se-1,t===R?(s(e,!0),0===e.strm.avail_out?ke:we):e.last_lit&&(s(e,!1),0===e.strm.avail_out)?ve:ye}function b(e,t){for(var a,i,n,r,o=e.window;;){if(e.lookahead<=ue){if(h(e),e.lookahead<=ue&&t===I)return ve;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=se&&e.strstart>0&&(n=e.strstart-1,i=o[n],i===o[++n]&&i===o[++n]&&i===o[++n])){r=e.strstart+ue;do;while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&r>n);e.match_length=ue-(r-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=se?(a=B._tr_tally(e,1,e.match_length-se),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(a=B._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),a&&(s(e,!1),0===e.strm.avail_out))return ve}return e.insert=0,t===R?(s(e,!0),0===e.strm.avail_out?ke:we):e.last_lit&&(s(e,!1),0===e.strm.avail_out)?ve:ye}function g(e,t){for(var a;;){if(0===e.lookahead&&(h(e),0===e.lookahead)){if(t===I)return ve;break}if(e.match_length=0,a=B._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,a&&(s(e,!1),0===e.strm.avail_out))return ve}return e.insert=0,t===R?(s(e,!0),0===e.strm.avail_out?ke:we):e.last_lit&&(s(e,!1),0===e.strm.avail_out)?ve:ye}function v(e){e.window_size=2*e.w_size,r(e.head),e.max_lazy_match=A[e.level].max_lazy,e.good_match=A[e.level].good_length,e.nice_match=A[e.level].nice_length,e.max_chain_length=A[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=se-1,e.match_available=0,e.ins_h=0}function y(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=X,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new z.Buf16(2*re),this.dyn_dtree=new z.Buf16(2*(2*ie+1)),this.bl_tree=new z.Buf16(2*(2*ne+1)),r(this.dyn_ltree),r(this.dyn_dtree),r(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new z.Buf16(oe+1),this.heap=new z.Buf16(2*ae+1),r(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new z.Buf16(2*ae+1),r(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function k(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=G,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?fe:be,e.adler=2===t.wrap?0:1,t.last_flush=I,B._tr_init(t),D):i(e,L)}function w(e){var t=k(e);return t===D&&v(e.state),t}function x(e,t){return e&&e.state?2!==e.state.wrap?L:(e.state.gzhead=t,D):L}function _(e,t,a,n,r,o){if(!e)return L;var s=1;if(t===H&&(t=6),0>n?(s=0,n=-n):n>15&&(s=2,n-=16),1>r||r>$||a!==X||8>n||n>15||0>t||t>9||0>o||o>Y)return i(e,L);8===n&&(n=9);var u=new y;return e.state=u,u.strm=e,u.wrap=s,u.gzhead=null,u.w_bits=n,u.w_size=1<<u.w_bits,u.w_mask=u.w_size-1,u.hash_bits=r+7,u.hash_size=1<<u.hash_bits,u.hash_mask=u.hash_size-1,u.hash_shift=~~((u.hash_bits+se-1)/se),u.window=new z.Buf8(2*u.w_size),u.head=new z.Buf16(u.hash_size),u.prev=new z.Buf16(u.w_size),u.lit_bufsize=1<<r+6,u.pending_buf_size=4*u.lit_bufsize,u.pending_buf=new z.Buf8(u.pending_buf_size),u.d_buf=u.lit_bufsize>>1,u.l_buf=3*u.lit_bufsize,u.level=t,u.strategy=o,u.method=a,w(e)}function j(e,t){return _(e,t,X,J,Q,W)}function S(e,t){var a,s,p,f;if(!e||!e.state||t>T||0>t)return e?i(e,L):L;if(s=e.state,!e.output||!e.input&&0!==e.avail_in||s.status===ge&&t!==R)return i(e,0===e.avail_out?U:L);if(s.strm=e,a=s.last_flush,s.last_flush=t,s.status===fe)if(2===s.wrap)e.adler=0,u(s,31),u(s,139),u(s,8),s.gzhead?(u(s,(s.gzhead.text?1:0)+(s.gzhead.hcrc?2:0)+(s.gzhead.extra?4:0)+(s.gzhead.name?8:0)+(s.gzhead.comment?16:0)),u(s,255&s.gzhead.time),u(s,s.gzhead.time>>8&255),u(s,s.gzhead.time>>16&255),u(s,s.gzhead.time>>24&255),u(s,9===s.level?2:s.strategy>=Z||s.level<2?4:0),u(s,255&s.gzhead.os),s.gzhead.extra&&s.gzhead.extra.length&&(u(s,255&s.gzhead.extra.length),u(s,s.gzhead.extra.length>>8&255)),s.gzhead.hcrc&&(e.adler=q(e.adler,s.pending_buf,s.pending,0)),s.gzindex=0,s.status=he):(u(s,0),u(s,0),u(s,0),u(s,0),u(s,0),u(s,9===s.level?2:s.strategy>=Z||s.level<2?4:0),u(s,xe),s.status=be);else{var h=X+(s.w_bits-8<<4)<<8,d=-1;d=s.strategy>=Z||s.level<2?0:s.level<6?1:6===s.level?2:3,h|=d<<6,0!==s.strstart&&(h|=pe),h+=31-h%31,s.status=be,c(s,h),0!==s.strstart&&(c(s,e.adler>>>16),c(s,65535&e.adler)),e.adler=1}if(s.status===he)if(s.gzhead.extra){for(p=s.pending;s.gzindex<(65535&s.gzhead.extra.length)&&(s.pending!==s.pending_buf_size||(s.gzhead.hcrc&&s.pending>p&&(e.adler=q(e.adler,s.pending_buf,s.pending-p,p)),o(e),p=s.pending,s.pending!==s.pending_buf_size));)u(s,255&s.gzhead.extra[s.gzindex]),s.gzindex++;s.gzhead.hcrc&&s.pending>p&&(e.adler=q(e.adler,s.pending_buf,s.pending-p,p)),s.gzindex===s.gzhead.extra.length&&(s.gzindex=0,s.status=de)}else s.status=de;if(s.status===de)if(s.gzhead.name){p=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>p&&(e.adler=q(e.adler,s.pending_buf,s.pending-p,p)),o(e),p=s.pending,s.pending===s.pending_buf_size)){f=1;break}f=s.gzindex<s.gzhead.name.length?255&s.gzhead.name.charCodeAt(s.gzindex++):0,u(s,f)}while(0!==f);s.gzhead.hcrc&&s.pending>p&&(e.adler=q(e.adler,s.pending_buf,s.pending-p,p)),0===f&&(s.gzindex=0,s.status=le)}else s.status=le;if(s.status===le)if(s.gzhead.comment){p=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>p&&(e.adler=q(e.adler,s.pending_buf,s.pending-p,p)),o(e),p=s.pending,s.pending===s.pending_buf_size)){f=1;break}f=s.gzindex<s.gzhead.comment.length?255&s.gzhead.comment.charCodeAt(s.gzindex++):0,u(s,f)}while(0!==f);s.gzhead.hcrc&&s.pending>p&&(e.adler=q(e.adler,s.pending_buf,s.pending-p,p)),0===f&&(s.status=me)}else s.status=me;if(s.status===me&&(s.gzhead.hcrc?(s.pending+2>s.pending_buf_size&&o(e),s.pending+2<=s.pending_buf_size&&(u(s,255&e.adler),u(s,e.adler>>8&255),e.adler=0,s.status=be)):s.status=be),0!==s.pending){if(o(e),0===e.avail_out)return s.last_flush=-1,D}else if(0===e.avail_in&&n(t)<=n(a)&&t!==R)return i(e,U);if(s.status===ge&&0!==e.avail_in)return i(e,U);if(0!==e.avail_in||0!==s.lookahead||t!==I&&s.status!==ge){var l=s.strategy===Z?g(s,t):s.strategy===V?b(s,t):A[s.level].func(s,t);if(l!==ke&&l!==we||(s.status=ge),l===ve||l===ke)return 0===e.avail_out&&(s.last_flush=-1),D;if(l===ye&&(t===O?B._tr_align(s):t!==T&&(B._tr_stored_block(s,0,0,!1),t===C&&(r(s.head),0===s.lookahead&&(s.strstart=0,s.block_start=0,s.insert=0))),o(e),0===e.avail_out))return s.last_flush=-1,D}return t!==R?D:s.wrap<=0?P:(2===s.wrap?(u(s,255&e.adler),u(s,e.adler>>8&255),u(s,e.adler>>16&255),u(s,e.adler>>24&255),u(s,255&e.total_in),u(s,e.total_in>>8&255),u(s,e.total_in>>16&255),u(s,e.total_in>>24&255)):(c(s,e.adler>>>16),c(s,65535&e.adler)),o(e),s.wrap>0&&(s.wrap=-s.wrap),0!==s.pending?D:P)}function E(e){var t;return e&&e.state?(t=e.state.status,t!==fe&&t!==he&&t!==de&&t!==le&&t!==me&&t!==be&&t!==ge?i(e,L):(e.state=null,t===be?i(e,N):D)):L}var A,z=e("../utils/common"),B=e("./trees"),F=e("./adler32"),q=e("./crc32"),M=e("./messages"),I=0,O=1,C=3,R=4,T=5,D=0,P=1,L=-2,N=-3,U=-5,H=-1,K=1,Z=2,V=3,Y=4,W=0,G=2,X=8,$=9,J=15,Q=8,ee=29,te=256,ae=te+1+ee,ie=30,ne=19,re=2*ae+1,oe=15,se=3,ue=258,ce=ue+se+1,pe=32,fe=42,he=69,de=73,le=91,me=103,be=113,ge=666,ve=1,ye=2,ke=3,we=4,xe=3,_e=function(e,t,a,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=a,this.max_chain=i,this.func=n};A=[new _e(0,0,0,0,d),new _e(4,4,8,4,l),new _e(4,5,16,8,l),new _e(4,6,32,32,l),new _e(4,4,16,16,m),new _e(8,16,32,32,m),new _e(8,16,128,128,m),new _e(8,32,128,256,m),new _e(32,128,258,1024,m),new _e(32,258,258,4096,m)],a.deflateInit=j,a.deflateInit2=_,a.deflateReset=w,a.deflateResetKeep=k,a.deflateSetHeader=x,a.deflate=S,a.deflateEnd=E,a.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":16,"./adler32":17,"./crc32":19,"./messages":24,"./trees":25}],21:[function(e,t,a){"use strict";var i=30,n=12;t.exports=function(e,t){var a,r,o,s,u,c,p,f,h,d,l,m,b,g,v,y,k,w,x,_,j,S,E,A,z;a=e.state,r=e.next_in,A=e.input,o=r+(e.avail_in-5),s=e.next_out,z=e.output,u=s-(t-e.avail_out),c=s+(e.avail_out-257),p=a.dmax,f=a.wsize,h=a.whave,d=a.wnext,l=a.window,m=a.hold,b=a.bits,g=a.lencode,v=a.distcode,y=(1<<a.lenbits)-1,k=(1<<a.distbits)-1;e:do{15>b&&(m+=A[r++]<<b,b+=8,m+=A[r++]<<b,b+=8),w=g[m&y];t:for(;;){if(x=w>>>24,m>>>=x,b-=x,x=w>>>16&255,0===x)z[s++]=65535&w;else{if(!(16&x)){if(0===(64&x)){w=g[(65535&w)+(m&(1<<x)-1)];continue t}if(32&x){a.mode=n;break e}e.msg="invalid literal/length code",a.mode=i;break e}_=65535&w,x&=15,x&&(x>b&&(m+=A[r++]<<b,b+=8),_+=m&(1<<x)-1,m>>>=x,b-=x),15>b&&(m+=A[r++]<<b,b+=8,m+=A[r++]<<b,b+=8),w=v[m&k];a:for(;;){if(x=w>>>24,m>>>=x,b-=x,x=w>>>16&255,!(16&x)){if(0===(64&x)){w=v[(65535&w)+(m&(1<<x)-1)];continue a}e.msg="invalid distance code",a.mode=i;break e}if(j=65535&w,x&=15,x>b&&(m+=A[r++]<<b,b+=8,x>b&&(m+=A[r++]<<b,b+=8)),j+=m&(1<<x)-1,j>p){e.msg="invalid distance too far back",a.mode=i;break e}if(m>>>=x,b-=x,x=s-u,j>x){if(x=j-x,x>h&&a.sane){e.msg="invalid distance too far back",a.mode=i;break e}if(S=0,E=l,0===d){if(S+=f-x,_>x){_-=x;do z[s++]=l[S++];while(--x);S=s-j,E=z}}else if(x>d){if(S+=f+d-x,x-=d,_>x){_-=x;do z[s++]=l[S++];while(--x);if(S=0,_>d){x=d,_-=x;do z[s++]=l[S++];while(--x);S=s-j,E=z}}}else if(S+=d-x,_>x){_-=x;do z[s++]=l[S++];while(--x);S=s-j,E=z}for(;_>2;)z[s++]=E[S++],z[s++]=E[S++],z[s++]=E[S++],_-=3;_&&(z[s++]=E[S++],_>1&&(z[s++]=E[S++]))}else{S=s-j;do z[s++]=z[S++],z[s++]=z[S++],z[s++]=z[S++],_-=3;while(_>2);_&&(z[s++]=z[S++],_>1&&(z[s++]=z[S++]))}break}}break}}while(o>r&&c>s);_=b>>3,r-=_,b-=_<<3,m&=(1<<b)-1,e.next_in=r,e.next_out=s,e.avail_in=o>r?5+(o-r):5-(r-o),e.avail_out=c>s?257+(c-s):257-(s-c),a.hold=m,a.bits=b}},{}],22:[function(e,t,a){"use strict";function i(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function n(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new g.Buf16(320),this.work=new g.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function r(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=R,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new g.Buf32(le),t.distcode=t.distdyn=new g.Buf32(me),t.sane=1,t.back=-1,z):q}function o(e){var t;return e&&e.state?(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,r(e)):q}function s(e,t){var a,i;return e&&e.state?(i=e.state,0>t?(a=0,t=-t):(a=(t>>4)+1,48>t&&(t&=15)),t&&(8>t||t>15)?q:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=a,i.wbits=t,o(e))):q}function u(e,t){var a,i;return e?(i=new n,e.state=i,i.window=null,a=s(e,t),a!==z&&(e.state=null),a):q}function c(e){return u(e,ge)}function p(e){if(ve){var t;for(m=new g.Buf32(512),b=new g.Buf32(32),t=0;144>t;)e.lens[t++]=8;for(;256>t;)e.lens[t++]=9;for(;280>t;)e.lens[t++]=7;for(;288>t;)e.lens[t++]=8;for(w(_,e.lens,0,288,m,0,e.work,{bits:9}),t=0;32>t;)e.lens[t++]=5;w(j,e.lens,0,32,b,0,e.work,{bits:5}),ve=!1}e.lencode=m,e.lenbits=9,e.distcode=b,e.distbits=5}function f(e,t,a,i){var n,r=e.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new g.Buf8(r.wsize)),i>=r.wsize?(g.arraySet(r.window,t,a-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):(n=r.wsize-r.wnext,n>i&&(n=i),g.arraySet(r.window,t,a-i,n,r.wnext),i-=n,i?(g.arraySet(r.window,t,a-i,i,0),r.wnext=i,r.whave=r.wsize):(r.wnext+=n,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=n))),0}function h(e,t){var a,n,r,o,s,u,c,h,d,l,m,b,le,me,be,ge,ve,ye,ke,we,xe,_e,je,Se,Ee=0,Ae=new g.Buf8(4),ze=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return q;a=e.state,a.mode