6 lines
151 KiB
JavaScript
6 lines
151 KiB
JavaScript
/*! filer 0.0.25 2014-08-20 */
|
||
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Filer=t()}}(function(){var t;return function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);throw Error("Cannot find module '"+a+"'")}var f=n[a]={exports:{}};t[a][0].call(f.exports,function(e){var n=t[a][1][e];return i(n?n:e)},f,f.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;r.length>a;a++)i(r[a]);return i}({1:[function(e,n){(function(e){(function(){function r(t){var e=!1;return function(){if(e)throw Error("Callback was already called.");e=!0,t.apply(i,arguments)}}var i,o,a={};i=this,null!=i&&(o=i.async),a.noConflict=function(){return i.async=o,a};var s=function(t,e){if(t.forEach)return t.forEach(e);for(var n=0;t.length>n;n+=1)e(t[n],n,t)},u=function(t,e){if(t.map)return t.map(e);var n=[];return s(t,function(t,r,i){n.push(e(t,r,i))}),n},f=function(t,e,n){return t.reduce?t.reduce(e,n):(s(t,function(t,r,i){n=e(n,t,r,i)}),n)},c=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e};void 0!==e&&e.nextTick?(a.nextTick=e.nextTick,a.setImmediate="undefined"!=typeof setImmediate?function(t){setImmediate(t)}:a.nextTick):"function"==typeof setImmediate?(a.nextTick=function(t){setImmediate(t)},a.setImmediate=a.nextTick):(a.nextTick=function(t){setTimeout(t,0)},a.setImmediate=a.nextTick),a.each=function(t,e,n){if(n=n||function(){},!t.length)return n();var i=0;s(t,function(o){e(o,r(function(e){e?(n(e),n=function(){}):(i+=1,i>=t.length&&n(null))}))})},a.forEach=a.each,a.eachSeries=function(t,e,n){if(n=n||function(){},!t.length)return n();var r=0,i=function(){e(t[r],function(e){e?(n(e),n=function(){}):(r+=1,r>=t.length?n(null):i())})};i()},a.forEachSeries=a.eachSeries,a.eachLimit=function(t,e,n,r){var i=l(e);i.apply(null,[t,n,r])},a.forEachLimit=a.eachLimit;var l=function(t){return function(e,n,r){if(r=r||function(){},!e.length||0>=t)return r();var i=0,o=0,a=0;(function s(){if(i>=e.length)return r();for(;t>a&&e.length>o;)o+=1,a+=1,n(e[o-1],function(t){t?(r(t),r=function(){}):(i+=1,a-=1,i>=e.length?r():s())})})()}},d=function(t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[a.each].concat(e))}},h=function(t,e){return function(){var n=Array.prototype.slice.call(arguments);return e.apply(null,[l(t)].concat(n))}},p=function(t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[a.eachSeries].concat(e))}},g=function(t,e,n,r){var i=[];e=u(e,function(t,e){return{index:e,value:t}}),t(e,function(t,e){n(t.value,function(n,r){i[t.index]=r,e(n)})},function(t){r(t,i)})};a.map=d(g),a.mapSeries=p(g),a.mapLimit=function(t,e,n,r){return m(e)(t,n,r)};var m=function(t){return h(t,g)};a.reduce=function(t,e,n,r){a.eachSeries(t,function(t,r){n(e,t,function(t,n){e=n,r(t)})},function(t){r(t,e)})},a.inject=a.reduce,a.foldl=a.reduce,a.reduceRight=function(t,e,n,r){var i=u(t,function(t){return t}).reverse();a.reduce(i,e,n,r)},a.foldr=a.reduceRight;var v=function(t,e,n,r){var i=[];e=u(e,function(t,e){return{index:e,value:t}}),t(e,function(t,e){n(t.value,function(n){n&&i.push(t),e()})},function(){r(u(i.sort(function(t,e){return t.index-e.index}),function(t){return t.value}))})};a.filter=d(v),a.filterSeries=p(v),a.select=a.filter,a.selectSeries=a.filterSeries;var b=function(t,e,n,r){var i=[];e=u(e,function(t,e){return{index:e,value:t}}),t(e,function(t,e){n(t.value,function(n){n||i.push(t),e()})},function(){r(u(i.sort(function(t,e){return t.index-e.index}),function(t){return t.value}))})};a.reject=d(b),a.rejectSeries=p(b);var y=function(t,e,n,r){t(e,function(t,e){n(t,function(n){n?(r(t),r=function(){}):e()})},function(){r()})};a.detect=d(y),a.detectSeries=p(y),a.some=function(t,e,n){a.each(t,function(t,r){e(t,function(t){t&&(n(!0),n=function(){}),r()})},function(){n(!1)})},a.any=a.some,a.every=function(t,e,n){a.each(t,function(t,r){e(t,function(t){t||(n(!1),n=function(){}),r()})},function(){n(!0)})},a.all=a.every,a.sortBy=function(t,e,n){a.map(t,function(t,n){e(t,function(e,r){e?n(e):n(null,{value:t,criteria:r})})},function(t,e){if(t)return n(t);var r=function(t,e){var n=t.criteria,r=e.criteria;return r>n?-1:n>r?1:0};n(null,u(e.sort(r),function(t){return t.value}))})},a.auto=function(t,e){e=e||function(){};var n=c(t);if(!n.length)return e(null);var r={},i=[],o=function(t){i.unshift(t)},u=function(t){for(var e=0;i.length>e;e+=1)if(i[e]===t)return i.splice(e,1),void 0},l=function(){s(i.slice(0),function(t){t()})};o(function(){c(r).length===n.length&&(e(null,r),e=function(){})}),s(n,function(n){var i=t[n]instanceof Function?[t[n]]:t[n],d=function(t){var i=Array.prototype.slice.call(arguments,1);if(1>=i.length&&(i=i[0]),t){var o={};s(c(r),function(t){o[t]=r[t]}),o[n]=i,e(t,o),e=function(){}}else r[n]=i,a.setImmediate(l)},h=i.slice(0,Math.abs(i.length-1))||[],p=function(){return f(h,function(t,e){return t&&r.hasOwnProperty(e)},!0)&&!r.hasOwnProperty(n)};if(p())i[i.length-1](d,r);else{var g=function(){p()&&(u(g),i[i.length-1](d,r))};o(g)}})},a.waterfall=function(t,e){if(e=e||function(){},t.constructor!==Array){var n=Error("First argument to waterfall must be an array of functions");return e(n)}if(!t.length)return e();var r=function(t){return function(n){if(n)e.apply(null,arguments),e=function(){};else{var i=Array.prototype.slice.call(arguments,1),o=t.next();o?i.push(r(o)):i.push(e),a.setImmediate(function(){t.apply(null,i)})}}};r(a.iterator(t))()};var _=function(t,e,n){if(n=n||function(){},e.constructor===Array)t.map(e,function(t,e){t&&t(function(t){var n=Array.prototype.slice.call(arguments,1);1>=n.length&&(n=n[0]),e.call(null,t,n)})},n);else{var r={};t.each(c(e),function(t,n){e[t](function(e){var i=Array.prototype.slice.call(arguments,1);1>=i.length&&(i=i[0]),r[t]=i,n(e)})},function(t){n(t,r)})}};a.parallel=function(t,e){_({map:a.map,each:a.each},t,e)},a.parallelLimit=function(t,e,n){_({map:m(e),each:l(e)},t,n)},a.series=function(t,e){if(e=e||function(){},t.constructor===Array)a.mapSeries(t,function(t,e){t&&t(function(t){var n=Array.prototype.slice.call(arguments,1);1>=n.length&&(n=n[0]),e.call(null,t,n)})},e);else{var n={};a.eachSeries(c(t),function(e,r){t[e](function(t){var i=Array.prototype.slice.call(arguments,1);1>=i.length&&(i=i[0]),n[e]=i,r(t)})},function(t){e(t,n)})}},a.iterator=function(t){var e=function(n){var r=function(){return t.length&&t[n].apply(null,arguments),r.next()};return r.next=function(){return t.length-1>n?e(n+1):null},r};return e(0)},a.apply=function(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e.concat(Array.prototype.slice.call(arguments)))}};var w=function(t,e,n,r){var i=[];t(e,function(t,e){n(t,function(t,n){i=i.concat(n||[]),e(t)})},function(t){r(t,i)})};a.concat=d(w),a.concatSeries=p(w),a.whilst=function(t,e,n){t()?e(function(r){return r?n(r):(a.whilst(t,e,n),void 0)}):n()},a.doWhilst=function(t,e,n){t(function(r){return r?n(r):(e()?a.doWhilst(t,e,n):n(),void 0)})},a.until=function(t,e,n){t()?n():e(function(r){return r?n(r):(a.until(t,e,n),void 0)})},a.doUntil=function(t,e,n){t(function(r){return r?n(r):(e()?n():a.doUntil(t,e,n),void 0)})},a.queue=function(t,e){function n(t,n,r,i){n.constructor!==Array&&(n=[n]),s(n,function(n){var o={data:n,callback:"function"==typeof i?i:null};r?t.tasks.unshift(o):t.tasks.push(o),t.saturated&&t.tasks.length===e&&t.saturated(),a.setImmediate(t.process)})}void 0===e&&(e=1);var i=0,o={tasks:[],concurrency:e,saturated:null,empty:null,drain:null,push:function(t,e){n(o,t,!1,e)},unshift:function(t,e){n(o,t,!0,e)},process:function(){if(o.concurrency>i&&o.tasks.length){var e=o.tasks.shift();o.empty&&0===o.tasks.length&&o.empty(),i+=1;var n=function(){i-=1,e.callback&&e.callback.apply(e,arguments),o.drain&&0===o.tasks.length+i&&o.drain(),o.process()},a=r(n);t(e.data,a)}},length:function(){return o.tasks.length},running:function(){return i}};return o},a.cargo=function(t,e){var n=!1,r=[],i={tasks:r,payload:e,saturated:null,empty:null,drain:null,push:function(t,n){t.constructor!==Array&&(t=[t]),s(t,function(t){r.push({data:t,callback:"function"==typeof n?n:null}),i.saturated&&r.length===e&&i.saturated()}),a.setImmediate(i.process)},process:function o(){if(!n){if(0===r.length)return i.drain&&i.drain(),void 0;var a="number"==typeof e?r.splice(0,e):r.splice(0),f=u(a,function(t){return t.data});i.empty&&i.empty(),n=!0,t(f,function(){n=!1;var t=arguments;s(a,function(e){e.callback&&e.callback.apply(null,t)}),o()})}},length:function(){return r.length},running:function(){return n}};return i};var E=function(t){return function(e){var n=Array.prototype.slice.call(arguments,1);e.apply(null,n.concat([function(e){var n=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(e?console.error&&console.error(e):console[t]&&s(n,function(e){console[t](e)}))}]))}};a.log=E("log"),a.dir=E("dir"),a.memoize=function(t,e){var n={},r={};e=e||function(t){return t};var i=function(){var i=Array.prototype.slice.call(arguments),o=i.pop(),a=e.apply(null,i);a in n?o.apply(null,n[a]):a in r?r[a].push(o):(r[a]=[o],t.apply(null,i.concat([function(){n[a]=arguments;var t=r[a];delete r[a];for(var e=0,i=t.length;i>e;e++)t[e].apply(null,arguments)}])))};return i.memo=n,i.unmemoized=t,i},a.unmemoize=function(t){return function(){return(t.unmemoized||t).apply(null,arguments)}},a.times=function(t,e,n){for(var r=[],i=0;t>i;i++)r.push(i);return a.map(r,e,n)},a.timesSeries=function(t,e,n){for(var r=[],i=0;t>i;i++)r.push(i);return a.mapSeries(r,e,n)},a.compose=function(){var t=Array.prototype.reverse.call(arguments);return function(){var e=this,n=Array.prototype.slice.call(arguments),r=n.pop();a.reduce(t,n,function(t,n,r){n.apply(e,t.concat([function(){var t=arguments[0],e=Array.prototype.slice.call(arguments,1);r(t,e)}]))},function(t,n){r.apply(e,[t].concat(n))})}};var x=function(t,e){var n=function(){var n=this,r=Array.prototype.slice.call(arguments),i=r.pop();return t(e,function(t,e){t.apply(n,r.concat([e]))},i)};if(arguments.length>2){var r=Array.prototype.slice.call(arguments,2);return n.apply(this,r)}return n};a.applyEach=d(x),a.applyEachSeries=p(x),a.forever=function(t,e){function n(r){if(r){if(e)return e(r);throw r}t(n)}n()},t!==void 0&&t.amd?t([],function(){return a}):n!==void 0&&n.exports?n.exports=a:i.async=a})()}).call(this,e("JkpR2F"))},{JkpR2F:10}],2:[function(t,e){function n(t,e){for(var n=e.length-1;n>=0;n--)e[n]===t&&e.splice(n,1);return e}var r=function(){};r.createInterface=function(t){var e={};return e.on=function(e,n){this[t]===void 0&&(this[t]={}),this[t].hasOwnProperty(e)||(this[t][e]=[]),this[t][e].push(n)},e.off=function(e,r){void 0!==this[t]&&this[t].hasOwnProperty(e)&&n(r,this[t][e])},e.trigger=function(e){if(this[t]!==void 0&&this[t].hasOwnProperty(e))for(var n=Array.prototype.slice.call(arguments,1),r=0;this[t][e].length>r;r++)this[t][e][r].apply(this[t][e][r],n)},e.removeAllListeners=function(e){if(void 0!==this[t]){var n=this;n[t][e].forEach(function(t){n.off(e,t)})}},e};var i=r.createInterface("_handlers");r.prototype._on=i.on,r.prototype._off=i.off,r.prototype._trigger=i.trigger;var o=r.createInterface("handlers");r.prototype.on=function(){o.on.apply(this,arguments),Array.prototype.unshift.call(arguments,"on"),this._trigger.apply(this,arguments)},r.prototype.off=o.off,r.prototype.trigger=o.trigger,r.prototype.removeAllListeners=o.removeAllListeners,e.exports=r},{}],3:[function(t,e){(function(n){function r(t,e){var n=0;return function(){var r=Date.now();r-n>t&&(n=r,e.apply(this,arguments))}}function i(t,e){if(void 0!==t&&t||(t={}),"object"==typeof e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function o(){var t=this,e=Date.now();this.origin=s(),this.lastMessage=e,this.receivedIDs={},this.previousValues={};var r=function(){t._onStorageEvent.apply(t,arguments)};"undefined"!=typeof document&&(document.attachEvent?document.attachEvent("onstorage",r):n.addEventListener("storage",r,!1))}var a=t("./eventemitter.js"),s=t("../src/shared.js").guid,u=function(t){return t===void 0||t.localStorage===void 0?{getItem:function(){},setItem:function(){},removeItem:function(){}}:t.localStorage}(n);o.prototype._transaction=function(t){function e(){if(!a){var c=Date.now(),d=0|u.getItem(l);if(d&&r>c-d)return s||(o._on("storage",e),s=!0),f=setTimeout(e,i),void 0;a=!0,u.setItem(l,c),t(),n()}}function n(){s&&o._off("storage",e),f&&clearTimeout(f),u.removeItem(l)}var r=1e3,i=20,o=this,a=!1,s=!1,f=null;e()},o.prototype._cleanup_emit=r(100,function(){var t=this;t._transaction(function(){var t,e=Date.now(),n=e-d,r=0;try{t=JSON.parse(u.getItem(f)||"[]")}catch(i){t=[]}for(var o=t.length-1;o>=0;o--)n>t[o].timestamp&&(t.splice(o,1),r++);r>0&&u.setItem(f,JSON.stringify(t))})}),o.prototype._cleanup_once=r(100,function(){var t=this;t._transaction(function(){var e,n;Date.now();var r=0;try{n=JSON.parse(u.getItem(c)||"{}")}catch(i){n={}}for(e in n)t._once_expired(e,n)&&(delete n[e],r++);r>0&&u.setItem(c,JSON.stringify(n))})}),o.prototype._once_expired=function(t,e){if(!e)return!0;if(!e.hasOwnProperty(t))return!0;if("object"!=typeof e[t])return!0;var n=e[t].ttl||h,r=Date.now(),i=e[t].timestamp;return r-n>i},o.prototype._localStorageChanged=function(t,e){if(t&&t.key)return t.key===e;var n=u.getItem(e);return n===this.previousValues[e]?!1:(this.previousValues[e]=n,!0)},o.prototype._onStorageEvent=function(t){t=t||n.event;var e=this;this._localStorageChanged(t,f)&&this._transaction(function(){var t,n=Date.now(),r=u.getItem(f);try{t=JSON.parse(r||"[]")}catch(i){t=[]}for(var o=0;t.length>o;o++)if(t[o].origin!==e.origin&&!(t[o].timestamp<e.lastMessage)){if(t[o].id){if(e.receivedIDs.hasOwnProperty(t[o].id))continue;e.receivedIDs[t[o].id]=!0}e.trigger(t[o].name,t[o].payload)}e.lastMessage=n}),this._trigger("storage",t)},o.prototype._emit=function(t,e,n){if(n="string"==typeof n||"number"==typeof n?n+"":null,n&&n.length){if(this.receivedIDs.hasOwnProperty(n))return;this.receivedIDs[n]=!0}var r={id:n,name:t,origin:this.origin,timestamp:Date.now(),payload:e},i=this;this._transaction(function(){var n=u.getItem(f)||"[]",o="[]"===n?"":",";n=[n.substring(0,n.length-1),o,JSON.stringify(r),"]"].join(""),u.setItem(f,n),i.trigger(t,e),setTimeout(function(){i._cleanup_emit()},50)})},o.prototype.emit=function(t,e){this._emit.apply(this,arguments),this._trigger("emit",t,e)},o.prototype.once=function(t,e,n){if(o.supported){var r=this;this._transaction(function(){var i;try{i=JSON.parse(u.getItem(c)||"{}")}catch(o){i={}}r._once_expired(t,i)&&(i[t]={},i[t].timestamp=Date.now(),"number"==typeof n&&(i[t].ttl=1e3*n),u.setItem(c,JSON.stringify(i)),e(),setTimeout(function(){r._cleanup_once()},50))})}},i(o.prototype,a.prototype),o.supported=u!==void 0;var f="intercom",c="intercom_once",l="intercom_lock",d=5e4,h=36e5;o.destroy=function(){u.removeItem(l),u.removeItem(f),u.removeItem(c)},o.getInstance=function(){var t;return function(){return t||(t=new o),t}}(),e.exports=o}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../src/shared.js":61,"./eventemitter.js":2}],4:[function(t,e){function n(t,e){return g.call(t,e)}function r(t){return null==t?0:t.length===+t.length?t.length:b(t).length}function i(t){return t}function o(t,e,n){var r,i;if(null!=t)if(l&&t.forEach===l)t.forEach(e,n);else if(t.length===+t.length){for(r=0,i=t.length;i>r;r++)if(e.call(n,t[r],r,t)===v)return}else{var o=o(t);for(r=0,i=o.length;i>r;r++)if(e.call(n,t[o[r]],o[r],t)===v)return}}function a(t,e,n){e||(e=i);var r=!1;return null==t?r:h&&t.some===h?t.some(e,n):(o(t,function(t,i,o){return r||(r=e.call(n,t,i,o))?v:void 0}),!!r)}function s(t,e){return null==t?!1:d&&t.indexOf===d?-1!=t.indexOf(e):a(t,function(t){return t===e})}function u(t){this.value=t}function f(t){return t&&"object"==typeof t&&!Array.isArray(t)&&g.call(t,"__wrapped__")?t:new u(t)}var c=Array.prototype,l=c.forEach,d=c.indexOf,h=c.some,p=Object.prototype,g=p.hasOwnProperty,m=Object.keys,v={},b=m||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var e=[];for(var r in t)n(t,r)&&e.push(r);return e};u.prototype.has=function(t){return n(this.value,t)},u.prototype.contains=function(t){return s(this.value,t)},u.prototype.size=function(){return r(this.value)},e.exports=f},{}],5:[function(t,e,n){(function(t){"use strict";n.encode=function(e){var n,r=new Uint8Array(e),i=r.length,o="";for(n=0;i>n;n+=3)o+=t[r[n]>>2],o+=t[(3&r[n])<<4|r[n+1]>>4],o+=t[(15&r[n+1])<<2|r[n+2]>>6],o+=t[63&r[n+2]];return 2===i%3?o=o.substring(0,o.length-1)+"=":1===i%3&&(o=o.substring(0,o.length-2)+"=="),o},n.decode=function(e){var n,r,i,o,a,s=.75*e.length,u=e.length,f=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);var c=new ArrayBuffer(s),l=new Uint8Array(c);for(n=0;u>n;n+=4)r=t.indexOf(e[n]),i=t.indexOf(e[n+1]),o=t.indexOf(e[n+2]),a=t.indexOf(e[n+3]),l[f++]=r<<2|i>>4,l[f++]=(15&i)<<4|o>>2,l[f++]=(3&o)<<6|63&a;return c}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],6:[function(t,e){(function(t){function n(t,e){if("function"!=typeof e)throw Error("Bad callback given: "+e);if(!t)throw Error("No options given");var a=t.onResponse;if(t="string"==typeof t?{uri:t}:JSON.parse(JSON.stringify(t)),t.onResponse=a,t.verbose&&(n.log=o()),t.url&&(t.uri=t.url,delete t.url),!t.uri&&""!==t.uri)throw Error("options.uri is a required argument");if("string"!=typeof t.uri)throw Error("options.uri must be a string");for(var s=["proxy","_redirectsFollowed","maxRedirects","followRedirect"],f=0;s.length>f;f++)if(t[s[f]])throw Error("options."+s[f]+" is not supported");if(t.callback=e,t.method=t.method||"GET",t.headers=t.headers||{},t.body=t.body||null,t.timeout=t.timeout||n.DEFAULT_TIMEOUT,t.headers.host)throw Error("Options.headers.host is not supported");t.json&&(t.headers.accept=t.headers.accept||"application/json","GET"!==t.method&&(t.headers["content-type"]="application/json"),"boolean"!=typeof t.json?t.body=JSON.stringify(t.json):"string"!=typeof t.body&&(t.body=JSON.stringify(t.body)));var c=function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e.join("&")};if(t.qs){var l="string"==typeof t.qs?t.qs:c(t.qs);t.uri=-1!==t.uri.indexOf("?")?t.uri+"&"+l:t.uri+"?"+l}var d=function(t){var e={};e.boundry="-------------------------------"+Math.floor(1e9*Math.random());var n=[];for(var r in t)t.hasOwnProperty(r)&&n.push("--"+e.boundry+"\n"+'Content-Disposition: form-data; name="'+r+'"'+"\n"+"\n"+t[r]+"\n");return n.push("--"+e.boundry+"--"),e.body=n.join(""),e.length=e.body.length,e.type="multipart/form-data; boundary="+e.boundry,e};if(t.form){if("string"==typeof t.form)throw"form name unsupported";if("POST"===t.method){var h=(t.encoding||"application/x-www-form-urlencoded").toLowerCase();switch(t.headers["content-type"]=h,h){case"application/x-www-form-urlencoded":t.body=c(t.form).replace(/%20/g,"+");break;case"multipart/form-data":var p=d(t.form);t.body=p.body,t.headers["content-type"]=p.type;break;default:throw Error("unsupported encoding:"+h)}}}return t.onResponse=t.onResponse||i,t.onResponse===!0&&(t.onResponse=e,t.callback=i),!t.headers.authorization&&t.auth&&(t.headers.authorization="Basic "+u(t.auth.username+":"+t.auth.password)),r(t)}function r(e){function r(){d=!0;var t=Error("ETIMEDOUT");return t.code="ETIMEDOUT",t.duration=e.timeout,n.log.error("Timeout",{id:c._id,milliseconds:e.timeout}),e.callback(t,c)}function i(){if(d)return n.log.debug("Ignoring timed out state change",{state:c.readyState,id:c.id});if(n.log.debug("State change",{state:c.readyState,id:c.id,timed_out:d}),c.readyState===f.OPENED){n.log.debug("Request started",{id:c.id});for(var t in e.headers)c.setRequestHeader(t,e.headers[t])}else c.readyState===f.HEADERS_RECEIVED?o():c.readyState===f.LOADING?(o(),a()):c.readyState===f.DONE&&(o(),a(),u())}function o(){if(!m.response){if(m.response=!0,n.log.debug("Got response",{id:c.id,status:c.status}),clearTimeout(c.timeoutTimer),c.statusCode=c.status,h&&0==c.statusCode){var t=Error("CORS request rejected: "+e.uri);return t.cors="rejected",m.loading=!0,m.end=!0,e.callback(t,c)}e.onResponse(null,c)}}function a(){m.loading||(m.loading=!0,n.log.debug("Response body loading",{id:c.id}))}function u(){if(!m.end){if(m.end=!0,n.log.debug("Request done",{id:c.id}),null===e.encoding)c.body=new t(new Uint8Array(c.response));else if(c.body=c.responseText,e.json)try{c.body=JSON.parse(c.responseText)}catch(r){return e.callback(r,c)}e.callback(null,c,c.body)}}var c=new f,d=!1,h=s(e.uri),p="withCredentials"in c;if(l+=1,c.seq_id=l,c.id=l+": "+e.method+" "+e.uri,c._id=c.id,h&&!p){var g=Error("Browser does not support cross-origin request: "+e.uri);return g.cors="unsupported",e.callback(g,c)}c.timeoutTimer=setTimeout(r,e.timeout);var m={response:!1,loading:!1,end:!1};return c.onreadystatechange=i,c.open(e.method,e.uri,!0),null===e.encoding&&(c.responseType="arraybuffer"),h&&(c.withCredentials=!!e.withCredentials),c.send(e.body),c}function i(){}function o(){var t,e,n={},r=["trace","debug","info","warn","error"];for(e=0;r.length>e;e++)t=r[e],n[t]=i,"undefined"!=typeof console&&console&&console[t]&&(n[t]=a(console,t));return n}function a(t,e){function n(n,r){return"object"==typeof r&&(n+=" "+JSON.stringify(r)),t[e].call(t,n)}return n}function s(t){var e,n=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/;try{e=location.href}catch(r){e=document.createElement("a"),e.href="",e=e.href}var i=n.exec(e.toLowerCase())||[],o=n.exec(t.toLowerCase()),a=!(!o||o[1]==i[1]&&o[2]==i[2]&&(o[3]||("http:"===o[1]?80:443))==(i[3]||("http:"===i[1]?80:443)));return a}function u(t){var e,n,r,i,o,a,s,u,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=0,l=0,d="",h=[];if(!t)return t;do e=t.charCodeAt(c++),n=t.charCodeAt(c++),r=t.charCodeAt(c++),u=e<<16|n<<8|r,i=63&u>>18,o=63&u>>12,a=63&u>>6,s=63&u,h[l++]=f.charAt(i)+f.charAt(o)+f.charAt(a)+f.charAt(s);while(t.length>c);switch(d=h.join(""),t.length%3){case 1:d=d.slice(0,-2)+"==";break;case 2:d=d.slice(0,-1)+"="}return d}var f=XMLHttpRequest;if(!f)throw Error("missing XMLHttpRequest");n.log={trace:i,debug:i,info:i,warn:i,error:i};var c=18e4,l=0;n.withCredentials=!1,n.DEFAULT_TIMEOUT=c,n.defaults=function(t){var e=function(e){var n=function(n,r){n="string"==typeof n?{uri:n}:JSON.parse(JSON.stringify(n));for(var i in t)void 0===n[i]&&(n[i]=t[i]);return e(n,r)};return n},r=e(n);return r.get=e(n.get),r.post=e(n.post),r.put=e(n.put),r.head=e(n.head),r};var d=["get","put","post","head"];d.forEach(function(t){var e=t.toUpperCase(),r=t.toLowerCase();n[r]=function(t){"string"==typeof t?t={method:e,uri:t}:(t=JSON.parse(JSON.stringify(t)),t.method=e);var r=[t].concat(Array.prototype.slice.apply(arguments,[1]));return n.apply(this,r)}}),n.couch=function(t,e){function r(t,n,r){if(t)return e(t,n,r);if((200>n.statusCode||n.statusCode>299)&&r.error){t=Error("CouchDB error: "+(r.error.reason||r.error.error));for(var i in r)t[i]=r[i];return e(t,n,r)}return e(t,n,r)}"string"==typeof t&&(t={uri:t}),t.json=!0,t.body&&(t.json=t.body),delete t.body,e=e||i;var o=n(t,r);return o},e.exports=n}).call(this,t("buffer").Buffer)},{buffer:7}],7:[function(t,e,n){function r(t,e,n){if(!(this instanceof r))return new r(t,e,n);var i=typeof t;"base64"===e&&"string"===i&&(t=S(t));var o;if("number"===i)o=R(t);else if("string"===i)o=r.byteLength(t,e);else{if("object"!==i)throw Error("First argument needs to be a number, array or string.");o=R(t.length)}var a;r._useTypedArrays?a=r._augment(new Uint8Array(o)):(a=this,a.length=o,a._isBuffer=!0);var s;if(r._useTypedArrays&&"number"==typeof t.byteLength)a._set(t);else if(N(t))if(r.isBuffer(t))for(s=0;o>s;s++)a[s]=t.readUInt8(s);else for(s=0;o>s;s++)a[s]=(t[s]%256+256)%256;else if("string"===i)a.write(t,0,e);else if("number"===i&&!r._useTypedArrays&&!n)for(s=0;o>s;s++)a[s]=0;return a}function i(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;var o=e.length;Y(0===o%2,"Invalid hex string"),r>o/2&&(r=o/2);for(var a=0;r>a;a++){var s=parseInt(e.substr(2*a,2),16);Y(!isNaN(s),"Invalid hex string"),t[n+a]=s}return a}function o(t,e,n,r){var i=M(B(e),t,n,r);return i}function a(t,e,n,r){var i=M(L(e),t,n,r);return i}function s(t,e,n,r){return a(t,e,n,r)}function u(t,e,n,r){var i=M(F(e),t,n,r);return i}function f(t,e,n,r){var i=M(z(e),t,n,r);return i}function c(t,e,n){return 0===e&&n===t.length?X.fromByteArray(t):X.fromByteArray(t.slice(e,n))}function l(t,e,n){var r="",i="";n=Math.min(t.length,n);for(var o=e;n>o;o++)127>=t[o]?(r+=U(i)+String.fromCharCode(t[o]),i=""):i+="%"+t[o].toString(16);return r+U(i)}function d(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;n>i;i++)r+=String.fromCharCode(t[i]);return r}function h(t,e,n){return d(t,e,n)}function p(t,e,n){var r=t.length;(!e||0>e)&&(e=0),(!n||0>n||n>r)&&(n=r);for(var i="",o=e;n>o;o++)i+=D(t[o]);return i}function g(t,e,n){for(var r=t.slice(e,n),i="",o=0;r.length>o;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function m(t,e,n,r){r||(Y("boolean"==typeof n,"missing or invalid endian"),Y(void 0!==e&&null!==e,"missing offset"),Y(t.length>e+1,"Trying to read beyond buffer length"));var i=t.length;if(!(e>=i)){var o;return n?(o=t[e],i>e+1&&(o|=t[e+1]<<8)):(o=t[e]<<8,i>e+1&&(o|=t[e+1])),o}}function v(t,e,n,r){r||(Y("boolean"==typeof n,"missing or invalid endian"),Y(void 0!==e&&null!==e,"missing offset"),Y(t.length>e+3,"Trying to read beyond buffer length"));var i=t.length;if(!(e>=i)){var o;return n?(i>e+2&&(o=t[e+2]<<16),i>e+1&&(o|=t[e+1]<<8),o|=t[e],i>e+3&&(o+=t[e+3]<<24>>>0)):(i>e+1&&(o=t[e+1]<<16),i>e+2&&(o|=t[e+2]<<8),i>e+3&&(o|=t[e+3]),o+=t[e]<<24>>>0),o}}function b(t,e,n,r){r||(Y("boolean"==typeof n,"missing or invalid endian"),Y(void 0!==e&&null!==e,"missing offset"),Y(t.length>e+1,"Trying to read beyond buffer length"));var i=t.length;if(!(e>=i)){var o=m(t,e,n,!0),a=32768&o;return a?-1*(65535-o+1):o}}function y(t,e,n,r){r||(Y("boolean"==typeof n,"missing or invalid endian"),Y(void 0!==e&&null!==e,"missing offset"),Y(t.length>e+3,"Trying to read beyond buffer length"));var i=t.length;if(!(e>=i)){var o=v(t,e,n,!0),a=2147483648&o;return a?-1*(4294967295-o+1):o}}function _(t,e,n,r){return r||(Y("boolean"==typeof n,"missing or invalid endian"),Y(t.length>e+3,"Trying to read beyond buffer length")),H.read(t,e,n,23,4)}function w(t,e,n,r){return r||(Y("boolean"==typeof n,"missing or invalid endian"),Y(t.length>e+7,"Trying to read beyond buffer length")),H.read(t,e,n,52,8)}function E(t,e,n,r,i){i||(Y(void 0!==e&&null!==e,"missing value"),Y("boolean"==typeof r,"missing or invalid endian"),Y(void 0!==n&&null!==n,"missing offset"),Y(t.length>n+1,"trying to write beyond buffer length"),P(e,65535));var o=t.length;if(!(n>=o)){for(var a=0,s=Math.min(o-n,2);s>a;a++)t[n+a]=(e&255<<8*(r?a:1-a))>>>8*(r?a:1-a);return n+2}}function x(t,e,n,r,i){i||(Y(void 0!==e&&null!==e,"missing value"),Y("boolean"==typeof r,"missing or invalid endian"),Y(void 0!==n&&null!==n,"missing offset"),Y(t.length>n+3,"trying to write beyond buffer length"),P(e,4294967295));var o=t.length;if(!(n>=o)){for(var a=0,s=Math.min(o-n,4);s>a;a++)t[n+a]=255&e>>>8*(r?a:3-a);return n+4}}function I(t,e,n,r,i){i||(Y(void 0!==e&&null!==e,"missing value"),Y("boolean"==typeof r,"missing or invalid endian"),Y(void 0!==n&&null!==n,"missing offset"),Y(t.length>n+1,"Trying to write beyond buffer length"),V(e,32767,-32768));var o=t.length;if(!(n>=o))return e>=0?E(t,e,n,r,i):E(t,65535+e+1,n,r,i),n+2}function k(t,e,n,r,i){i||(Y(void 0!==e&&null!==e,"missing value"),Y("boolean"==typeof r,"missing or invalid endian"),Y(void 0!==n&&null!==n,"missing offset"),Y(t.length>n+3,"Trying to write beyond buffer length"),V(e,2147483647,-2147483648));var o=t.length;if(!(n>=o))return e>=0?x(t,e,n,r,i):x(t,4294967295+e+1,n,r,i),n+4}function A(t,e,n,r,i){i||(Y(void 0!==e&&null!==e,"missing value"),Y("boolean"==typeof r,"missing or invalid endian"),Y(void 0!==n&&null!==n,"missing offset"),Y(t.length>n+3,"Trying to write beyond buffer length"),Z(e,3.4028234663852886e38,-3.4028234663852886e38));var o=t.length;if(!(n>=o))return H.write(t,e,n,r,23,4),n+4}function O(t,e,n,r,i){i||(Y(void 0!==e&&null!==e,"missing value"),Y("boolean"==typeof r,"missing or invalid endian"),Y(void 0!==n&&null!==n,"missing offset"),Y(t.length>n+7,"Trying to write beyond buffer length"),Z(e,1.7976931348623157e308,-1.7976931348623157e308));var o=t.length;if(!(n>=o))return H.write(t,e,n,r,52,8),n+8}function S(t){for(t=T(t).replace(q,"");0!==t.length%4;)t+="=";return t}function T(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function C(t,e,n){return"number"!=typeof t?n:(t=~~t,t>=e?e:t>=0?t:(t+=e,t>=0?t:0))}function R(t){return t=~~Math.ceil(+t),0>t?0:t}function j(t){return(Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)})(t)}function N(t){return j(t)||r.isBuffer(t)||t&&"object"==typeof t&&"number"==typeof t.length}function D(t){return 16>t?"0"+t.toString(16):t.toString(16)}function B(t){for(var e=[],n=0;t.length>n;n++){var r=t.charCodeAt(n);if(127>=r)e.push(r);else{var i=n;r>=55296&&57343>=r&&n++;for(var o=encodeURIComponent(t.slice(i,n+1)).substr(1).split("%"),a=0;o.length>a;a++)e.push(parseInt(o[a],16))}}return e}function L(t){for(var e=[],n=0;t.length>n;n++)e.push(255&t.charCodeAt(n));return e}function z(t){for(var e,n,r,i=[],o=0;t.length>o;o++)e=t.charCodeAt(o),n=e>>8,r=e%256,i.push(r),i.push(n);return i}function F(t){return X.toByteArray(t)}function M(t,e,n,r){for(var i=0;r>i&&!(i+n>=e.length||i>=t.length);i++)e[i+n]=t[i];return i}function U(t){try{return decodeURIComponent(t)}catch(e){return String.fromCharCode(65533)}}function P(t,e){Y("number"==typeof t,"cannot write a non-number as a number"),Y(t>=0,"specified a negative value for writing an unsigned value"),Y(e>=t,"value is larger than maximum value for type"),Y(Math.floor(t)===t,"value has a fractional component")}function V(t,e,n){Y("number"==typeof t,"cannot write a non-number as a number"),Y(e>=t,"value larger than maximum allowed value"),Y(t>=n,"value smaller than minimum allowed value"),Y(Math.floor(t)===t,"value has a fractional component")}function Z(t,e,n){Y("number"==typeof t,"cannot write a non-number as a number"),Y(e>=t,"value larger than maximum allowed value"),Y(t>=n,"value smaller than minimum allowed value")}function Y(t,e){if(!t)throw Error(e||"Failed assertion")}var X=t("base64-js"),H=t("ieee754");n.Buffer=r,n.SlowBuffer=r,n.INSPECT_MAX_BYTES=50,r.poolSize=8192,r._useTypedArrays=function(){try{var t=new ArrayBuffer(0),e=new Uint8Array(t);return e.foo=function(){return 42},42===e.foo()&&"function"==typeof e.subarray}catch(n){return!1}}(),r.isEncoding=function(t){switch((t+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},r.isBuffer=function(t){return!(null===t||void 0===t||!t._isBuffer)},r.byteLength=function(t,e){var n;switch(t=""+t,e||"utf8"){case"hex":n=t.length/2;break;case"utf8":case"utf-8":n=B(t).length;break;case"ascii":case"binary":case"raw":n=t.length;break;case"base64":n=F(t).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*t.length;break;default:throw Error("Unknown encoding")}return n},r.concat=function(t,e){if(Y(j(t),"Usage: Buffer.concat(list[, length])"),0===t.length)return new r(0);if(1===t.length)return t[0];var n;if(void 0===e)for(e=0,n=0;t.length>n;n++)e+=t[n].length;var i=new r(e),o=0;for(n=0;t.length>n;n++){var a=t[n];a.copy(i,o),o+=a.length}return i},r.compare=function(t,e){Y(r.isBuffer(t)&&r.isBuffer(e),"Arguments must be Buffers");for(var n=t.length,i=e.length,o=0,a=Math.min(n,i);a>o&&t[o]===e[o];o++);return o!==a&&(n=t[o],i=e[o]),i>n?-1:n>i?1:0},r.prototype.write=function(t,e,n,r){if(isFinite(e))isFinite(n)||(r=n,n=void 0);else{var c=r;r=e,e=n,n=c}e=Number(e)||0;var l=this.length-e;
|
||
n?(n=Number(n),n>l&&(n=l)):n=l,r=((r||"utf8")+"").toLowerCase();var d;switch(r){case"hex":d=i(this,t,e,n);break;case"utf8":case"utf-8":d=o(this,t,e,n);break;case"ascii":d=a(this,t,e,n);break;case"binary":d=s(this,t,e,n);break;case"base64":d=u(this,t,e,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":d=f(this,t,e,n);break;default:throw Error("Unknown encoding")}return d},r.prototype.toString=function(t,e,n){var r=this;if(t=((t||"utf8")+"").toLowerCase(),e=Number(e)||0,n=void 0===n?r.length:Number(n),n===e)return"";var i;switch(t){case"hex":i=p(r,e,n);break;case"utf8":case"utf-8":i=l(r,e,n);break;case"ascii":i=d(r,e,n);break;case"binary":i=h(r,e,n);break;case"base64":i=c(r,e,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":i=g(r,e,n);break;default:throw Error("Unknown encoding")}return i},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},r.prototype.equals=function(t){return Y(r.isBuffer(t),"Argument must be a Buffer"),0===r.compare(this,t)},r.prototype.compare=function(t){return Y(r.isBuffer(t),"Argument must be a Buffer"),r.compare(this,t)},r.prototype.copy=function(t,e,n,i){var o=this;if(n||(n=0),i||0===i||(i=this.length),e||(e=0),i!==n&&0!==t.length&&0!==o.length){Y(i>=n,"sourceEnd < sourceStart"),Y(e>=0&&t.length>e,"targetStart out of bounds"),Y(n>=0&&o.length>n,"sourceStart out of bounds"),Y(i>=0&&o.length>=i,"sourceEnd out of bounds"),i>this.length&&(i=this.length),i-n>t.length-e&&(i=t.length-e+n);var a=i-n;if(100>a||!r._useTypedArrays)for(var s=0;a>s;s++)t[s+e]=this[s+n];else t._set(this.subarray(n,n+a),e)}},r.prototype.slice=function(t,e){var n=this.length;if(t=C(t,n,0),e=C(e,n,n),r._useTypedArrays)return r._augment(this.subarray(t,e));for(var i=e-t,o=new r(i,void 0,!0),a=0;i>a;a++)o[a]=this[a+t];return o},r.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},r.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},r.prototype.readUInt8=function(t,e){return e||(Y(void 0!==t&&null!==t,"missing offset"),Y(this.length>t,"Trying to read beyond buffer length")),t>=this.length?void 0:this[t]},r.prototype.readUInt16LE=function(t,e){return m(this,t,!0,e)},r.prototype.readUInt16BE=function(t,e){return m(this,t,!1,e)},r.prototype.readUInt32LE=function(t,e){return v(this,t,!0,e)},r.prototype.readUInt32BE=function(t,e){return v(this,t,!1,e)},r.prototype.readInt8=function(t,e){if(e||(Y(void 0!==t&&null!==t,"missing offset"),Y(this.length>t,"Trying to read beyond buffer length")),!(t>=this.length)){var n=128&this[t];return n?-1*(255-this[t]+1):this[t]}},r.prototype.readInt16LE=function(t,e){return b(this,t,!0,e)},r.prototype.readInt16BE=function(t,e){return b(this,t,!1,e)},r.prototype.readInt32LE=function(t,e){return y(this,t,!0,e)},r.prototype.readInt32BE=function(t,e){return y(this,t,!1,e)},r.prototype.readFloatLE=function(t,e){return _(this,t,!0,e)},r.prototype.readFloatBE=function(t,e){return _(this,t,!1,e)},r.prototype.readDoubleLE=function(t,e){return w(this,t,!0,e)},r.prototype.readDoubleBE=function(t,e){return w(this,t,!1,e)},r.prototype.writeUInt8=function(t,e,n){return n||(Y(void 0!==t&&null!==t,"missing value"),Y(void 0!==e&&null!==e,"missing offset"),Y(this.length>e,"trying to write beyond buffer length"),P(t,255)),e>=this.length?void 0:(this[e]=t,e+1)},r.prototype.writeUInt16LE=function(t,e,n){return E(this,t,e,!0,n)},r.prototype.writeUInt16BE=function(t,e,n){return E(this,t,e,!1,n)},r.prototype.writeUInt32LE=function(t,e,n){return x(this,t,e,!0,n)},r.prototype.writeUInt32BE=function(t,e,n){return x(this,t,e,!1,n)},r.prototype.writeInt8=function(t,e,n){return n||(Y(void 0!==t&&null!==t,"missing value"),Y(void 0!==e&&null!==e,"missing offset"),Y(this.length>e,"Trying to write beyond buffer length"),V(t,127,-128)),e>=this.length?void 0:(t>=0?this.writeUInt8(t,e,n):this.writeUInt8(255+t+1,e,n),e+1)},r.prototype.writeInt16LE=function(t,e,n){return I(this,t,e,!0,n)},r.prototype.writeInt16BE=function(t,e,n){return I(this,t,e,!1,n)},r.prototype.writeInt32LE=function(t,e,n){return k(this,t,e,!0,n)},r.prototype.writeInt32BE=function(t,e,n){return k(this,t,e,!1,n)},r.prototype.writeFloatLE=function(t,e,n){return A(this,t,e,!0,n)},r.prototype.writeFloatBE=function(t,e,n){return A(this,t,e,!1,n)},r.prototype.writeDoubleLE=function(t,e,n){return O(this,t,e,!0,n)},r.prototype.writeDoubleBE=function(t,e,n){return O(this,t,e,!1,n)},r.prototype.fill=function(t,e,n){if(t||(t=0),e||(e=0),n||(n=this.length),Y(n>=e,"end < start"),n!==e&&0!==this.length){Y(e>=0&&this.length>e,"start out of bounds"),Y(n>=0&&this.length>=n,"end out of bounds");var r;if("number"==typeof t)for(r=e;n>r;r++)this[r]=t;else{var i=B(""+t),o=i.length;for(r=e;n>r;r++)this[r]=i[r%o]}return this}},r.prototype.inspect=function(){for(var t=[],e=this.length,r=0;e>r;r++)if(t[r]=D(this[r]),r===n.INSPECT_MAX_BYTES){t[r+1]="...";break}return"<Buffer "+t.join(" ")+">"},r.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(r._useTypedArrays)return new r(this).buffer;for(var t=new Uint8Array(this.length),e=0,n=t.length;n>e;e+=1)t[e]=this[e];return t.buffer}throw Error("Buffer.toArrayBuffer not supported in this browser")};var W=r.prototype;r._augment=function(t){return t._isBuffer=!0,t._get=t.get,t._set=t.set,t.get=W.get,t.set=W.set,t.write=W.write,t.toString=W.toString,t.toLocaleString=W.toString,t.toJSON=W.toJSON,t.equals=W.equals,t.compare=W.compare,t.copy=W.copy,t.slice=W.slice,t.readUInt8=W.readUInt8,t.readUInt16LE=W.readUInt16LE,t.readUInt16BE=W.readUInt16BE,t.readUInt32LE=W.readUInt32LE,t.readUInt32BE=W.readUInt32BE,t.readInt8=W.readInt8,t.readInt16LE=W.readInt16LE,t.readInt16BE=W.readInt16BE,t.readInt32LE=W.readInt32LE,t.readInt32BE=W.readInt32BE,t.readFloatLE=W.readFloatLE,t.readFloatBE=W.readFloatBE,t.readDoubleLE=W.readDoubleLE,t.readDoubleBE=W.readDoubleBE,t.writeUInt8=W.writeUInt8,t.writeUInt16LE=W.writeUInt16LE,t.writeUInt16BE=W.writeUInt16BE,t.writeUInt32LE=W.writeUInt32LE,t.writeUInt32BE=W.writeUInt32BE,t.writeInt8=W.writeInt8,t.writeInt16LE=W.writeInt16LE,t.writeInt16BE=W.writeInt16BE,t.writeInt32LE=W.writeInt32LE,t.writeInt32BE=W.writeInt32BE,t.writeFloatLE=W.writeFloatLE,t.writeFloatBE=W.writeFloatBE,t.writeDoubleLE=W.writeDoubleLE,t.writeDoubleBE=W.writeDoubleBE,t.fill=W.fill,t.inspect=W.inspect,t.toArrayBuffer=W.toArrayBuffer,t};var q=/[^+\/0-9A-z]/g},{"base64-js":8,ieee754:9}],8:[function(t,e,n){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(t){"use strict";function e(t){var e=t.charCodeAt(0);return e===a?62:e===s?63:u>e?-1:u+10>e?e-u+26+26:c+26>e?e-c:f+26>e?e-f+26:void 0}function n(t){function n(t){f[l++]=t}var r,i,a,s,u,f;if(t.length%4>0)throw Error("Invalid string. Length must be a multiple of 4");var c=t.length;u="="===t.charAt(c-2)?2:"="===t.charAt(c-1)?1:0,f=new o(3*t.length/4-u),a=u>0?t.length-4:t.length;var l=0;for(r=0,i=0;a>r;r+=4,i+=3)s=e(t.charAt(r))<<18|e(t.charAt(r+1))<<12|e(t.charAt(r+2))<<6|e(t.charAt(r+3)),n((16711680&s)>>16),n((65280&s)>>8),n(255&s);return 2===u?(s=e(t.charAt(r))<<2|e(t.charAt(r+1))>>4,n(255&s)):1===u&&(s=e(t.charAt(r))<<10|e(t.charAt(r+1))<<4|e(t.charAt(r+2))>>2,n(255&s>>8),n(255&s)),f}function i(t){function e(t){return r.charAt(t)}function n(t){return e(63&t>>18)+e(63&t>>12)+e(63&t>>6)+e(63&t)}var i,o,a,s=t.length%3,u="";for(i=0,a=t.length-s;a>i;i+=3)o=(t[i]<<16)+(t[i+1]<<8)+t[i+2],u+=n(o);switch(s){case 1:o=t[t.length-1],u+=e(o>>2),u+=e(63&o<<4),u+="==";break;case 2:o=(t[t.length-2]<<8)+t[t.length-1],u+=e(o>>10),u+=e(63&o>>4),u+=e(63&o<<2),u+="="}return u}var o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="+".charCodeAt(0),s="/".charCodeAt(0),u="0".charCodeAt(0),f="a".charCodeAt(0),c="A".charCodeAt(0);t.toByteArray=n,t.fromByteArray=i})(n===void 0?this.base64js={}:n)},{}],9:[function(t,e,n){n.read=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,f=u>>1,c=-7,l=n?i-1:0,d=n?-1:1,h=t[e+l];for(l+=d,o=h&(1<<-c)-1,h>>=-c,c+=s;c>0;o=256*o+t[e+l],l+=d,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+t[e+l],l+=d,c-=8);if(0===o)o=1-f;else{if(o===u)return a?0/0:1/0*(h?-1:1);a+=Math.pow(2,r),o-=f}return(h?-1:1)*a*Math.pow(2,o-r)},n.write=function(t,e,n,r,i,o){var a,s,u,f=8*o-i-1,c=(1<<f)-1,l=c>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,g=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||1/0===e?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),1>e*(u=Math.pow(2,-a))&&(a--,u*=2),e+=a+l>=1?d/u:d*Math.pow(2,1-l),e*u>=2&&(a++,u/=2),a+l>=c?(s=0,a=c):a+l>=1?(s=(e*u-1)*Math.pow(2,i),a+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[n+h]=255&s,h+=p,s/=256,i-=8);for(a=a<<i|s,f+=i;f>0;t[n+h]=255&a,h+=p,a/=256,f-=8);t[n+h-p]|=128*g}},{}],10:[function(t,e){function n(){}var r=e.exports={};r.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw Error("process.chdir is not supported")}},{}],11:[function(t,e,n){"use strict";var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.encode=function(t){for(var e,n,i,o,a,s,u,f="",c=0;t.length>c;)e=t.charCodeAt(c++),n=t.charCodeAt(c++),i=t.charCodeAt(c++),o=e>>2,a=(3&e)<<4|n>>4,s=(15&n)<<2|i>>6,u=63&i,isNaN(n)?s=u=64:isNaN(i)&&(u=64),f=f+r.charAt(o)+r.charAt(a)+r.charAt(s)+r.charAt(u);return f},n.decode=function(t){var e,n,i,o,a,s,u,f="",c=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");t.length>c;)o=r.indexOf(t.charAt(c++)),a=r.indexOf(t.charAt(c++)),s=r.indexOf(t.charAt(c++)),u=r.indexOf(t.charAt(c++)),e=o<<2|a>>4,n=(15&a)<<4|s>>2,i=(3&s)<<6|u,f+=String.fromCharCode(e),64!=s&&(f+=String.fromCharCode(n)),64!=u&&(f+=String.fromCharCode(i));return f}},{}],12:[function(t,e){"use strict";function n(){this.compressedSize=0,this.uncompressedSize=0,this.crc32=0,this.compressionMethod=null,this.compressedContent=null}n.prototype={getContent:function(){return null},getCompressedContent:function(){return null}},e.exports=n},{}],13:[function(t,e,n){"use strict";n.STORE={magic:"\0\0",compress:function(t){return t},uncompress:function(t){return t},compressInputType:null,uncompressInputType:null},n.DEFLATE=t("./flate")},{"./flate":16}],14:[function(t,e){"use strict";function n(){this.data=null,this.length=0,this.index=0}var r=t("./utils");n.prototype={checkOffset:function(t){this.checkIndex(this.index+t)},checkIndex:function(t){if(t>this.length||0>t)throw Error("End of data reached (data length = "+this.length+", asked index = "+t+"). Corrupted zip ?")},setIndex:function(t){this.checkIndex(t),this.index=t},skip:function(t){this.setIndex(this.index+t)},byteAt:function(){},readInt:function(t){var e,n=0;for(this.checkOffset(t),e=this.index+t-1;e>=this.index;e--)n=(n<<8)+this.byteAt(e);return this.index+=t,n},readString:function(t){return r.transformTo("string",this.readData(t))},readData:function(){},lastIndexOfSignature:function(){},readDate:function(){var t=this.readInt(4);return new Date((127&t>>25)+1980,(15&t>>21)-1,31&t>>16,31&t>>11,63&t>>5,(31&t)<<1)}},e.exports=n},{"./utils":26}],15:[function(t,e,n){"use strict";n.base64=!1,n.binary=!1,n.dir=!1,n.date=null,n.compression=null},{}],16:[function(t,e,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=t("pako");n.uncompressInputType=r?"uint8array":"array",n.compressInputType=r?"uint8array":"array",n.magic="\b\0",n.compress=function(t){return i.deflateRaw(t)},n.uncompress=function(t){return i.inflateRaw(t)}},{pako:29}],17:[function(t,e){"use strict";function n(t,e){return this instanceof n?(this.files={},this.root="",t&&this.load(t,e),this.clone=function(){var t=new n;for(var e in this)"function"!=typeof this[e]&&(t[e]=this[e]);return t},void 0):new n(t,e)}n.prototype=t("./object"),n.prototype.load=t("./load"),n.support=t("./support"),n.defaults=t("./defaults"),n.utils=t("./utils"),n.base64=t("./base64"),n.compressions=t("./compressions"),e.exports=n},{"./base64":11,"./compressions":13,"./defaults":15,"./load":18,"./object":21,"./support":24,"./utils":26}],18:[function(t,e){"use strict";var n=t("./base64"),r=t("./zipEntries");e.exports=function(t,e){var i,o,a,s;for(e=e||{},e.base64&&(t=n.decode(t)),o=new r(t,e),i=o.files,a=0;i.length>a;a++)s=i[a],this.file(s.fileName,s.decompressed,{binary:!0,optimizedBinaryString:!0,date:s.date,dir:s.dir});return this}},{"./base64":11,"./zipEntries":27}],19:[function(t,e){(function(t){"use strict";e.exports=function(e,n){return new t(e,n)},e.exports.test=function(e){return t.isBuffer(e)}}).call(this,t("buffer").Buffer)},{buffer:7}],20:[function(t,e){"use strict";function n(t){this.data=t,this.length=this.data.length,this.index=0}var r=t("./uint8ArrayReader");n.prototype=new r,n.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.index,this.index+t);return this.index+=t,e},e.exports=n},{"./uint8ArrayReader":25}],21:[function(t,e){"use strict";var n,r,i=t("./support"),o=t("./utils"),a=t("./signature"),s=t("./defaults"),u=t("./base64"),f=t("./compressions"),c=t("./compressedObject"),l=t("./nodeBuffer");i.uint8array&&"function"==typeof TextEncoder&&"function"==typeof TextDecoder&&(n=new TextEncoder("utf-8"),r=new TextDecoder("utf-8"));var d=function(t){if(t._data instanceof c&&(t._data=t._data.getContent(),t.options.binary=!0,t.options.base64=!1,"uint8array"===o.getTypeOf(t._data))){var e=t._data;t._data=new Uint8Array(e.length),0!==e.length&&t._data.set(e,0)}return t._data},h=function(t){var e=d(t),r=o.getTypeOf(e);if("string"===r){if(!t.options.binary){if(n)return n.encode(e);if(i.nodebuffer)return l(e,"utf-8")}return t.asBinary()}return e},p=function(t){var e=d(this);return null===e||e===void 0?"":(this.options.base64&&(e=u.decode(e)),e=t&&this.options.binary?k.utf8decode(e):o.transformTo("string",e),t||this.options.binary||(e=k.utf8encode(e)),e)},g=function(t,e,n){this.name=t,this._data=e,this.options=n};g.prototype={asText:function(){return p.call(this,!0)},asBinary:function(){return p.call(this,!1)},asNodeBuffer:function(){var t=h(this);return o.transformTo("nodebuffer",t)},asUint8Array:function(){var t=h(this);return o.transformTo("uint8array",t)},asArrayBuffer:function(){return this.asUint8Array().buffer}};var m=function(t,e){var n,r="";for(n=0;e>n;n++)r+=String.fromCharCode(255&t),t>>>=8;return r},v=function(){var t,e,n={};for(t=0;arguments.length>t;t++)for(e in arguments[t])arguments[t].hasOwnProperty(e)&&n[e]===void 0&&(n[e]=arguments[t][e]);return n},b=function(t){return t=t||{},t.base64!==!0||null!==t.binary&&void 0!==t.binary||(t.binary=!0),t=v(t,s),t.date=t.date||new Date,null!==t.compression&&(t.compression=t.compression.toUpperCase()),t},y=function(t,e,n){var r=o.getTypeOf(e);if(n=b(n),n.dir||null===e||e===void 0)n.base64=!1,n.binary=!1,e=null;else if("string"===r)n.binary&&!n.base64&&n.optimizedBinaryString!==!0&&(e=o.string2binary(e));else{if(n.base64=!1,n.binary=!0,!(r||e instanceof c))throw Error("The data of '"+t+"' is in an unsupported format !");"arraybuffer"===r&&(e=o.transformTo("uint8array",e))}var i=new g(t,e,n);return this.files[t]=i,i},_=function(t){return"/"!=t.slice(-1)&&(t+="/"),this.files[t]||y.call(this,t,null,{dir:!0}),this.files[t]},w=function(t,e){var n,r=new c;return t._data instanceof c?(r.uncompressedSize=t._data.uncompressedSize,r.crc32=t._data.crc32,0===r.uncompressedSize||t.options.dir?(e=f.STORE,r.compressedContent="",r.crc32=0):t._data.compressionMethod===e.magic?r.compressedContent=t._data.getCompressedContent():(n=t._data.getContent(),r.compressedContent=e.compress(o.transformTo(e.compressInputType,n)))):(n=h(t),(!n||0===n.length||t.options.dir)&&(e=f.STORE,n=""),r.uncompressedSize=n.length,r.crc32=this.crc32(n),r.compressedContent=e.compress(o.transformTo(e.compressInputType,n))),r.compressedSize=r.compressedContent.length,r.compressionMethod=e.magic,r},E=function(t,e,n,r){var i,o,s=(n.compressedContent,this.utf8encode(e.name)),u=s!==e.name,f=e.options,c="",l="";i=f.date.getHours(),i<<=6,i|=f.date.getMinutes(),i<<=5,i|=f.date.getSeconds()/2,o=f.date.getFullYear()-1980,o<<=4,o|=f.date.getMonth()+1,o<<=5,o|=f.date.getDate(),u&&(l=m(1,1)+m(this.crc32(s),4)+s,c+="up"+m(l.length,2)+l);var d="";d+="\n\0",d+=u?"\0\b":"\0\0",d+=n.compressionMethod,d+=m(i,2),d+=m(o,2),d+=m(n.crc32,4),d+=m(n.compressedSize,4),d+=m(n.uncompressedSize,4),d+=m(s.length,2),d+=m(c.length,2);var h=a.LOCAL_FILE_HEADER+d+s+c,p=a.CENTRAL_FILE_HEADER+"\0"+d+"\0\0"+"\0\0"+"\0\0"+(e.options.dir===!0?"\0\0\0":"\0\0\0\0")+m(r,4)+s+c;return{fileRecord:h,dirRecord:p,compressedObject:n}},x=function(){this.data=[]};x.prototype={append:function(t){t=o.transformTo("string",t),this.data.push(t)},finalize:function(){return this.data.join("")}};var I=function(t){this.data=new Uint8Array(t),this.index=0};I.prototype={append:function(t){0!==t.length&&(t=o.transformTo("uint8array",t),this.data.set(t,this.index),this.index+=t.length)},finalize:function(){return this.data}};var k={load:function(){throw Error("Load method is not defined. Is the file jszip-load.js included ?")},filter:function(t){var e,n,r,i,o=[];for(e in this.files)this.files.hasOwnProperty(e)&&(r=this.files[e],i=new g(r.name,r._data,v(r.options)),n=e.slice(this.root.length,e.length),e.slice(0,this.root.length)===this.root&&t(n,i)&&o.push(i));return o},file:function(t,e,n){if(1===arguments.length){if(o.isRegExp(t)){var r=t;return this.filter(function(t,e){return!e.options.dir&&r.test(t)})}return this.filter(function(e,n){return!n.options.dir&&e===t})[0]||null}return t=this.root+t,y.call(this,t,e,n),this},folder:function(t){if(!t)return this;if(o.isRegExp(t))return this.filter(function(e,n){return n.options.dir&&t.test(e)});var e=this.root+t,n=_.call(this,e),r=this.clone();return r.root=n.name,r},remove:function(t){t=this.root+t;var e=this.files[t];if(e||("/"!=t.slice(-1)&&(t+="/"),e=this.files[t]),e&&!e.options.dir)delete this.files[t];else for(var n=this.filter(function(e,n){return n.name.slice(0,t.length)===t}),r=0;n.length>r;r++)delete this.files[n[r].name];return this},generate:function(t){t=v(t||{},{base64:!0,compression:"STORE",type:"base64"}),o.checkSupport(t.type);var e,n,r=[],i=0,s=0;for(var c in this.files)if(this.files.hasOwnProperty(c)){var l=this.files[c],d=l.options.compression||t.compression.toUpperCase(),h=f[d];if(!h)throw Error(d+" is not a valid compression method !");var p=w.call(this,l,h),g=E.call(this,c,l,p,i);i+=g.fileRecord.length+p.compressedSize,s+=g.dirRecord.length,r.push(g)}var b="";b=a.CENTRAL_DIRECTORY_END+"\0\0"+"\0\0"+m(r.length,2)+m(r.length,2)+m(s,4)+m(i,4)+"\0\0";var y=t.type.toLowerCase();for(e="uint8array"===y||"arraybuffer"===y||"blob"===y||"nodebuffer"===y?new I(i+s+b.length):new x(i+s+b.length),n=0;r.length>n;n++)e.append(r[n].fileRecord),e.append(r[n].compressedObject.compressedContent);for(n=0;r.length>n;n++)e.append(r[n].dirRecord);e.append(b);var _=e.finalize();switch(t.type.toLowerCase()){case"uint8array":case"arraybuffer":case"nodebuffer":return o.transformTo(t.type.toLowerCase(),_);case"blob":return o.arrayBuffer2Blob(o.transformTo("arraybuffer",_));case"base64":return t.base64?u.encode(_):_;default:return _}},crc32:function(t,e){if(t===void 0||!t.length)return 0;var n="string"!==o.getTypeOf(t),r=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];e===void 0&&(e=0);var i=0,a=0,s=0;e=-1^e;for(var u=0,f=t.length;f>u;u++)s=n?t[u]:t.charCodeAt(u),a=255&(e^s),i=r[a],e=e>>>8^i;return-1^e},utf8encode:function(t){if(n){var e=n.encode(t);return o.transformTo("string",e)}if(i.nodebuffer)return o.transformTo("string",l(t,"utf-8"));for(var r=[],a=0,s=0;t.length>s;s++){var u=t.charCodeAt(s);128>u?r[a++]=String.fromCharCode(u):u>127&&2048>u?(r[a++]=String.fromCharCode(192|u>>6),r[a++]=String.fromCharCode(128|63&u)):(r[a++]=String.fromCharCode(224|u>>12),r[a++]=String.fromCharCode(128|63&u>>6),r[a++]=String.fromCharCode(128|63&u))}return r.join("")},utf8decode:function(t){var e=[],n=0,a=o.getTypeOf(t),s="string"!==a,u=0,f=0,c=0,l=0;if(r)return r.decode(o.transformTo("uint8array",t));if(i.nodebuffer)return o.transformTo("nodebuffer",t).toString("utf-8");for(;t.length>u;)f=s?t[u]:t.charCodeAt(u),128>f?(e[n++]=String.fromCharCode(f),u++):f>191&&224>f?(c=s?t[u+1]:t.charCodeAt(u+1),e[n++]=String.fromCharCode((31&f)<<6|63&c),u+=2):(c=s?t[u+1]:t.charCodeAt(u+1),l=s?t[u+2]:t.charCodeAt(u+2),e[n++]=String.fromCharCode((15&f)<<12|(63&c)<<6|63&l),u+=3);return e.join("")}};e.exports=k},{"./base64":11,"./compressedObject":12,"./compressions":13,"./defaults":15,"./nodeBuffer":19,"./signature":22,"./support":24,"./utils":26}],22:[function(t,e,n){"use strict";n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],23:[function(t,e){"use strict";function n(t,e){this.data=t,e||(this.data=i.string2binary(this.data)),this.length=this.data.length,this.index=0}var r=t("./dataReader"),i=t("./utils");n.prototype=new r,n.prototype.byteAt=function(t){return this.data.charCodeAt(t)},n.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)},n.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.index,this.index+t);return this.index+=t,e},e.exports=n},{"./dataReader":14,"./utils":26}],24:[function(t,e,n){(function(t){"use strict";if(n.base64=!0,n.array=!0,n.string=!0,n.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,n.nodebuffer=t!==void 0,n.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)n.blob=!1;else{var e=new ArrayBuffer(0);try{n.blob=0===new Blob([e],{type:"application/zip"}).size}catch(r){try{var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,o=new i;o.append(e),n.blob=0===o.getBlob("application/zip").size}catch(r){n.blob=!1}}}}).call(this,t("buffer").Buffer)},{buffer:7}],25:[function(t,e){"use strict";function n(t){t&&(this.data=t,this.length=this.data.length,this.index=0)}var r=t("./dataReader");n.prototype=new r,n.prototype.byteAt=function(t){return this.data[t]},n.prototype.lastIndexOfSignature=function(t){for(var e=t.charCodeAt(0),n=t.charCodeAt(1),r=t.charCodeAt(2),i=t.charCodeAt(3),o=this.length-4;o>=0;--o)if(this.data[o]===e&&this.data[o+1]===n&&this.data[o+2]===r&&this.data[o+3]===i)return o;return-1},n.prototype.readData=function(t){this.checkOffset(t);var e=this.data.subarray(this.index,this.index+t);return this.index+=t,e},e.exports=n},{"./dataReader":14}],26:[function(t,e,n){"use strict";function r(t){return t}function i(t,e){for(var n=0;t.length>n;++n)e[n]=255&t.charCodeAt(n);return e}function o(t){var e=65536,r=[],i=t.length,o=n.getTypeOf(t),a=0,s=!0;try{switch(o){case"uint8array":String.fromCharCode.apply(null,new Uint8Array(0));break;case"nodebuffer":String.fromCharCode.apply(null,f(0))}}catch(u){s=!1}if(!s){for(var c="",l=0;t.length>l;l++)c+=String.fromCharCode(t[l]);return c}for(;i>a&&e>1;)try{"array"===o||"nodebuffer"===o?r.push(String.fromCharCode.apply(null,t.slice(a,Math.min(a+e,i)))):r.push(String.fromCharCode.apply(null,t.subarray(a,Math.min(a+e,i)))),a+=e}catch(u){e=Math.floor(e/2)}return r.join("")}function a(t,e){for(var n=0;t.length>n;n++)e[n]=t[n];return e}var s=t("./support"),u=t("./compressions"),f=t("./nodeBuffer");n.string2binary=function(t){for(var e="",n=0;t.length>n;n++)e+=String.fromCharCode(255&t.charCodeAt(n));return e},n.string2Uint8Array=function(t){return n.transformTo("uint8array",t)},n.uint8Array2String=function(t){return n.transformTo("string",t)},n.string2Blob=function(t){var e=n.transformTo("arraybuffer",t);return n.arrayBuffer2Blob(e)},n.arrayBuffer2Blob=function(t){n.checkSupport("blob");try{return new Blob([t],{type:"application/zip"})}catch(e){try{var r=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,i=new r;return i.append(t),i.getBlob("application/zip")}catch(e){throw Error("Bug : can't construct the Blob.")}}};var c={};c.string={string:r,array:function(t){return i(t,Array(t.length))},arraybuffer:function(t){return c.string.uint8array(t).buffer},uint8array:function(t){return i(t,new Uint8Array(t.length))},nodebuffer:function(t){return i(t,f(t.length))}},c.array={string:o,array:r,arraybuffer:function(t){return new Uint8Array(t).buffer},uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return f(t)}},c.arraybuffer={string:function(t){return o(new Uint8Array(t))},array:function(t){return a(new Uint8Array(t),Array(t.byteLength))},arraybuffer:r,uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return f(new Uint8Array(t))}},c.uint8array={string:o,array:function(t){return a(t,Array(t.length))},arraybuffer:function(t){return t.buffer},uint8array:r,nodebuffer:function(t){return f(t)}},c.nodebuffer={string:o,array:function(t){return a(t,Array(t.length))},arraybuffer:function(t){return c.nodebuffer.uint8array(t).buffer},uint8array:function(t){return a(t,new Uint8Array(t.length))},nodebuffer:r},n.transformTo=function(t,e){if(e||(e=""),!t)return e;n.checkSupport(t);var r=n.getTypeOf(e),i=c[r][t](e);return i},n.getTypeOf=function(t){return"string"==typeof t?"string":"[object Array]"===Object.prototype.toString.call(t)?"array":s.nodebuffer&&f.test(t)?"nodebuffer":s.uint8array&&t instanceof Uint8Array?"uint8array":s.arraybuffer&&t instanceof ArrayBuffer?"arraybuffer":void 0},n.checkSupport=function(t){var e=s[t.toLowerCase()];if(!e)throw Error(t+" is not supported by this browser")},n.MAX_VALUE_16BITS=65535,n.MAX_VALUE_32BITS=-1,n.pretty=function(t){var e,n,r="";for(n=0;(t||"").length>n;n++)e=t.charCodeAt(n),r+="\\x"+(16>e?"0":"")+e.toString(16).toUpperCase();return r},n.findCompression=function(t){for(var e in u)if(u.hasOwnProperty(e)&&u[e].magic===t)return u[e];return null},n.isRegExp=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)}},{"./compressions":13,"./nodeBuffer":19,"./support":24}],27:[function(t,e){"use strict";function n(t,e){this.files=[],this.loadOptions=e,t&&this.load(t)}var r=t("./stringReader"),i=t("./nodeBufferReader"),o=t("./uint8ArrayReader"),a=t("./utils"),s=t("./signature"),u=t("./zipEntry"),f=t("./support");n.prototype={checkSignature:function(t){var e=this.reader.readString(4);if(e!==t)throw Error("Corrupted zip or bug : unexpected signature ("+a.pretty(e)+", expected "+a.pretty(t)+")")},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2),this.zipComment=this.reader.readString(this.zipCommentLength)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.versionMadeBy=this.reader.readString(2),this.versionNeeded=this.reader.readInt(2),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var t,e,n,r=this.zip64EndOfCentralSize-44,i=0;r>i;)t=this.reader.readInt(2),e=this.reader.readInt(4),n=this.reader.readString(e),this.zip64ExtensibleData[t]={id:t,length:e,value:n}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var t,e;for(t=0;this.files.length>t;t++)e=this.files[t],this.reader.setIndex(e.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),e.readLocalPart(this.reader),e.handleUTF8()},readCentralDir:function(){var t;for(this.reader.setIndex(this.centralDirOffset);this.reader.readString(4)===s.CENTRAL_FILE_HEADER;)t=new u({zip64:this.zip64},this.loadOptions),t.readCentralPart(this.reader),this.files.push(t)},readEndOfCentral:function(){var t=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(-1===t)throw Error("Corrupted zip : can't find end of central directory");if(this.reader.setIndex(t),this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,t=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),-1===t)throw Error("Corrupted zip : can't find the ZIP64 end of central directory locator");
|
||
this.reader.setIndex(t),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}},prepareReader:function(t){var e=a.getTypeOf(t);this.reader="string"!==e||f.uint8array?"nodebuffer"===e?new i(t):new o(a.transformTo("uint8array",t)):new r(t,this.loadOptions.optimizedBinaryString)},load:function(t){this.prepareReader(t),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},e.exports=n},{"./nodeBufferReader":20,"./signature":22,"./stringReader":23,"./support":24,"./uint8ArrayReader":25,"./utils":26,"./zipEntry":28}],28:[function(t,e){"use strict";function n(t,e){this.options=t,this.loadOptions=e}var r=t("./stringReader"),i=t("./utils"),o=t("./compressedObject"),a=t("./object");n.prototype={isEncrypted:function(){return 1===(1&this.bitFlag)},useUTF8:function(){return 2048===(2048&this.bitFlag)},prepareCompressedContent:function(t,e,n){return function(){var r=t.index;t.setIndex(e);var i=t.readData(n);return t.setIndex(r),i}},prepareContent:function(t,e,n,r,o){return function(){var t=i.transformTo(r.uncompressInputType,this.getCompressedContent()),e=r.uncompress(t);if(e.length!==o)throw Error("Bug : uncompressed data size mismatch");return e}},readLocalPart:function(t){var e,n;if(t.skip(22),this.fileNameLength=t.readInt(2),n=t.readInt(2),this.fileName=t.readString(this.fileNameLength),t.skip(n),-1==this.compressedSize||-1==this.uncompressedSize)throw Error("Bug or corrupted zip : didn't get enough informations from the central directory (compressedSize == -1 || uncompressedSize == -1)");if(e=i.findCompression(this.compressionMethod),null===e)throw Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+this.fileName+")");if(this.decompressed=new o,this.decompressed.compressedSize=this.compressedSize,this.decompressed.uncompressedSize=this.uncompressedSize,this.decompressed.crc32=this.crc32,this.decompressed.compressionMethod=this.compressionMethod,this.decompressed.getCompressedContent=this.prepareCompressedContent(t,t.index,this.compressedSize,e),this.decompressed.getContent=this.prepareContent(t,t.index,this.compressedSize,e,this.uncompressedSize),this.loadOptions.checkCRC32&&(this.decompressed=i.transformTo("string",this.decompressed.getContent()),a.crc32(this.decompressed)!==this.crc32))throw Error("Corrupted zip : CRC32 mismatch")},readCentralPart:function(t){if(this.versionMadeBy=t.readString(2),this.versionNeeded=t.readInt(2),this.bitFlag=t.readInt(2),this.compressionMethod=t.readString(2),this.date=t.readDate(),this.crc32=t.readInt(4),this.compressedSize=t.readInt(4),this.uncompressedSize=t.readInt(4),this.fileNameLength=t.readInt(2),this.extraFieldsLength=t.readInt(2),this.fileCommentLength=t.readInt(2),this.diskNumberStart=t.readInt(2),this.internalFileAttributes=t.readInt(2),this.externalFileAttributes=t.readInt(4),this.localHeaderOffset=t.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");this.fileName=t.readString(this.fileNameLength),this.readExtraFields(t),this.parseZIP64ExtraField(t),this.fileComment=t.readString(this.fileCommentLength),this.dir=16&this.externalFileAttributes?!0:!1},parseZIP64ExtraField:function(){if(this.extraFields[1]){var t=new r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(t){var e,n,r,i=t.index;for(this.extraFields=this.extraFields||{};t.index<i+this.extraFieldsLength;)e=t.readInt(2),n=t.readInt(2),r=t.readString(n),this.extraFields[e]={id:e,length:n,value:r}},handleUTF8:function(){if(this.useUTF8())this.fileName=a.utf8decode(this.fileName),this.fileComment=a.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();null!==t&&(this.fileName=t)}},findExtraFieldUnicodePath:function(){var t=this.extraFields[28789];if(t){var e=new r(t.value);return 1!==e.readInt(1)?null:a.crc32(this.fileName)!==e.readInt(4)?null:a.utf8decode(e.readString(t.length-5))}return null}},e.exports=n},{"./compressedObject":12,"./object":21,"./stringReader":23,"./utils":26}],29:[function(t,e){"use strict";var n=t("./lib/utils/common").assign,r=t("./lib/deflate"),i=t("./lib/inflate"),o=t("./lib/zlib/constants"),a={};n(a,r,i,o),e.exports=a},{"./lib/deflate":30,"./lib/inflate":31,"./lib/utils/common":32,"./lib/zlib/constants":35}],30:[function(t,e,n){"use strict";function r(t,e){var n=new b(e);if(n.push(t,!0),n.err)throw n.msg;return n.result}function i(t,e){return e=e||{},e.raw=!0,r(t,e)}function o(t,e){return e=e||{},e.gzip=!0,r(t,e)}var a=t("./zlib/deflate.js"),s=t("./utils/common"),u=t("./utils/strings"),f=t("./zlib/messages"),c=t("./zlib/zstream"),l=0,d=4,h=0,p=1,g=-1,m=0,v=8,b=function(t){this.options=s.assign({level:g,method:v,chunkSize:16384,windowBits:15,memLevel:8,strategy:m,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&16>e.windowBits&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var n=a.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==h)throw Error(f[n]);e.header&&a.deflateSetHeader(this.strm,e.header)};b.prototype.push=function(t,e){var n,r,i=this.strm,o=this.options.chunkSize;if(this.ended)return!1;r=e===~~e?e:e===!0?d:l,i.input="string"==typeof t?u.string2buf(t):t,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new s.Buf8(o),i.next_out=0,i.avail_out=o),n=a.deflate(i,r),n!==p&&n!==h)return this.onEnd(n),this.ended=!0,!1;(0===i.avail_out||0===i.avail_in&&r===d)&&("string"===this.options.to?this.onData(u.buf2binstring(s.shrinkBuf(i.output,i.next_out))):this.onData(s.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&n!==p);return r===d?(n=a.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===h):!0},b.prototype.onData=function(t){this.chunks.push(t)},b.prototype.onEnd=function(t){t===h&&(this.result="string"===this.options.to?this.chunks.join(""):s.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},n.Deflate=b,n.deflate=r,n.deflateRaw=i,n.gzip=o},{"./utils/common":32,"./utils/strings":33,"./zlib/deflate.js":37,"./zlib/messages":42,"./zlib/zstream":44}],31:[function(t,e,n){"use strict";function r(t,e){var n=new d(e);if(n.push(t,!0),n.err)throw n.msg;return n.result}function i(t,e){return e=e||{},e.raw=!0,r(t,e)}var o=t("./zlib/inflate.js"),a=t("./utils/common"),s=t("./utils/strings"),u=t("./zlib/constants"),f=t("./zlib/messages"),c=t("./zlib/zstream"),l=t("./zlib/gzheader"),d=function(t){this.options=a.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&16>e.windowBits&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&16>e.windowBits)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&48>e.windowBits&&0===(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var n=o.inflateInit2(this.strm,e.windowBits);if(n!==u.Z_OK)throw Error(f[n]);this.header=new l,o.inflateGetHeader(this.strm,this.header)};d.prototype.push=function(t,e){var n,r,i,f,c,l=this.strm,d=this.options.chunkSize;if(this.ended)return!1;r=e===~~e?e:e===!0?u.Z_FINISH:u.Z_NO_FLUSH,l.input="string"==typeof t?s.binstring2buf(t):t,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new a.Buf8(d),l.next_out=0,l.avail_out=d),n=o.inflate(l,u.Z_NO_FLUSH),n!==u.Z_STREAM_END&&n!==u.Z_OK)return this.onEnd(n),this.ended=!0,!1;l.next_out&&(0===l.avail_out||n===u.Z_STREAM_END||0===l.avail_in&&r===u.Z_FINISH)&&("string"===this.options.to?(i=s.utf8border(l.output,l.next_out),f=l.next_out-i,c=s.buf2string(l.output,i),l.next_out=f,l.avail_out=d-f,f&&a.arraySet(l.output,l.output,i,f,0),this.onData(c)):this.onData(a.shrinkBuf(l.output,l.next_out)))}while((l.avail_in>0||0===l.avail_out)&&n!==u.Z_STREAM_END);return n===u.Z_STREAM_END&&(r=u.Z_FINISH),r===u.Z_FINISH?(n=o.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===u.Z_OK):!0},d.prototype.onData=function(t){this.chunks.push(t)},d.prototype.onEnd=function(t){t===u.Z_OK&&(this.result="string"===this.options.to?this.chunks.join(""):a.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},n.Inflate=d,n.inflate=r,n.inflateRaw=i,n.ungzip=r},{"./utils/common":32,"./utils/strings":33,"./zlib/constants":35,"./zlib/gzheader":38,"./zlib/inflate.js":40,"./zlib/messages":42,"./zlib/zstream":44}],32:[function(t,e,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;n.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}}return t},n.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var i={arraySet:function(t,e,n,r,i){if(e.subarray&&t.subarray)return t.set(e.subarray(n,n+r),i),void 0;for(var o=0;r>o;o++)t[i+o]=e[n+o]},flattenChunks:function(t){var e,n,r,i,o,a;for(r=0,e=0,n=t.length;n>e;e++)r+=t[e].length;for(a=new Uint8Array(r),i=0,e=0,n=t.length;n>e;e++)o=t[e],a.set(o,i),i+=o.length;return a}},o={arraySet:function(t,e,n,r,i){for(var o=0;r>o;o++)t[i+o]=e[n+o]},flattenChunks:function(t){return[].concat.apply([],t)}};n.setTyped=function(t){t?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,i)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,o))},n.setTyped(r)},{}],33:[function(t,e,n){"use strict";function r(t,e){if(65537>e&&(t.subarray&&a||!t.subarray&&o))return String.fromCharCode.apply(null,i.shrinkBuf(t,e));for(var n="",r=0;e>r;r++)n+=String.fromCharCode(t[r]);return n}var i=t("./common"),o=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(s){o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(s){a=!1}for(var u=new i.Buf8(256),f=0;256>f;f++)u[f]=f>=252?6:f>=248?5:f>=240?4:f>=224?3:f>=192?2:1;u[254]=u[254]=1,n.string2buf=function(t){var e,n,r,o,a,s=t.length,u=0;for(o=0;s>o;o++)n=t.charCodeAt(o),55296===(64512&n)&&s>o+1&&(r=t.charCodeAt(o+1),56320===(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),o++)),u+=128>n?1:2048>n?2:65536>n?3:4;for(e=new i.Buf8(u),a=0,o=0;u>a;o++)n=t.charCodeAt(o),55296===(64512&n)&&s>o+1&&(r=t.charCodeAt(o+1),56320===(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),o++)),128>n?e[a++]=n:2048>n?(e[a++]=192|n>>>6,e[a++]=128|63&n):65536>n?(e[a++]=224|n>>>12,e[a++]=128|63&n>>>6,e[a++]=128|63&n):(e[a++]=240|n>>>18,e[a++]=128|63&n>>>12,e[a++]=128|63&n>>>6,e[a++]=128|63&n);return e},n.buf2binstring=function(t){return r(t,t.length)},n.binstring2buf=function(t){for(var e=new i.Buf8(t.length),n=0,r=e.length;r>n;n++)e[n]=t.charCodeAt(n);return e},n.buf2string=function(t,e){var n,i,o,a,s=e||t.length,f=Array(2*s);for(i=0,n=0;s>n;)if(o=t[n++],128>o)f[i++]=o;else if(a=u[o],a>4)f[i++]=65533,n+=a-1;else{for(o&=2===a?31:3===a?15:7;a>1&&s>n;)o=o<<6|63&t[n++],a--;a>1?f[i++]=65533:65536>o?f[i++]=o:(o-=65536,f[i++]=55296|1023&o>>10,f[i++]=56320|1023&o)}return r(f,i)},n.utf8border=function(t,e){var n;for(e=e||t.length,e>t.length&&(e=t.length),n=e-1;n>=0&&128===(192&t[n]);)n--;return 0>n?e:0===n?e:n+u[t[n]]>e?n:e}},{"./common":32}],34:[function(t,e){"use strict";function n(t,e,n,r){for(var i=0|65535&t,o=0|65535&t>>>16,a=0;0!==n;){a=n>2e3?2e3:n,n-=a;do i=0|i+e[r++],o=0|o+i;while(--a);i%=65521,o%=65521}return 0|(i|o<<16)}e.exports=n},{}],35:[function(t,e){e.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}},{}],36:[function(t,e){"use strict";function n(){for(var t,e=[],n=0;256>n;n++){t=n;for(var r=0;8>r;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}function r(t,e,n,r){var o=i,a=r+n;t=-1^t;for(var s=r;a>s;s++)t=t>>>8^o[255&(t^e[s])];return-1^t}var i=n();e.exports=r},{}],37:[function(t,e,n){"use strict";function r(t,e){return t.msg=j[e],e}function i(t){return(t<<1)-(t>4?9:0)}function o(t){for(var e=t.length;--e>=0;)t[e]=0}function a(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(S.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function s(t,e){T._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,a(t.strm)}function u(t,e){t.pending_buf[t.pending++]=e}function f(t,e){t.pending_buf[t.pending++]=255&e>>>8,t.pending_buf[t.pending++]=255&e}function c(t,e,n,r){var i=t.avail_in;return i>r&&(i=r),0===i?0:(t.avail_in-=i,S.arraySet(e,t.input,t.next_in,i,n),1===t.state.wrap?t.adler=C(t.adler,e,i,n):2===t.state.wrap&&(t.adler=R(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)}function l(t,e){var n,r,i=t.max_chain_length,o=t.strstart,a=t.prev_length,s=t.nice_match,u=t.strstart>t.w_size-fe?t.strstart-(t.w_size-fe):0,f=t.window,c=t.w_mask,l=t.prev,d=t.strstart+ue,h=f[o+a-1],p=f[o+a];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do if(n=e,f[n+a]===p&&f[n+a-1]===h&&f[n]===f[o]&&f[++n]===f[o+1]){o+=2,n++;do;while(f[++o]===f[++n]&&f[++o]===f[++n]&&f[++o]===f[++n]&&f[++o]===f[++n]&&f[++o]===f[++n]&&f[++o]===f[++n]&&f[++o]===f[++n]&&f[++o]===f[++n]&&d>o);if(r=ue-(d-o),o=d-ue,r>a){if(t.match_start=e,a=r,r>=s)break;h=f[o+a-1],p=f[o+a]}}while((e=l[e&c])>u&&0!==--i);return t.lookahead>=a?a:t.lookahead}function d(t){var e,n,r,i,o,a=t.w_size;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=a+(a-fe)){S.arraySet(t.window,t.window,a,a,0),t.match_start-=a,t.strstart-=a,t.block_start-=a,n=t.hash_size,e=n;do r=t.head[--e],t.head[e]=r>=a?r-a:0;while(--n);n=a,e=n;do r=t.prev[--e],t.prev[e]=r>=a?r-a:0;while(--n);i+=a}if(0===t.strm.avail_in)break;if(n=c(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=n,t.lookahead+t.insert>=se)for(o=t.strstart-t.insert,t.ins_h=t.window[o],t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+se-1])&t.hash_mask,t.prev[o&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=o,o++,t.insert--,!(se>t.lookahead+t.insert)););}while(fe>t.lookahead&&0!==t.strm.avail_in)}function h(t,e){var n=65535;for(n>t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(1>=t.lookahead){if(d(t),0===t.lookahead&&e===N)return be;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,s(t,!1),0===t.strm.avail_out))return be;if(t.strstart-t.block_start>=t.w_size-fe&&(s(t,!1),0===t.strm.avail_out))return be}return t.insert=0,e===L?(s(t,!0),0===t.strm.avail_out?_e:we):t.strstart>t.block_start&&(s(t,!1),0===t.strm.avail_out)?be:be}function p(t,e){for(var n,r;;){if(fe>t.lookahead){if(d(t),fe>t.lookahead&&e===N)return be;if(0===t.lookahead)break}if(n=0,t.lookahead>=se&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+se-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==n&&t.strstart-n<=t.w_size-fe&&(t.match_length=l(t,n)),t.match_length>=se)if(r=T._tr_tally(t,t.strstart-t.match_start,t.match_length-se),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=se){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+se-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(0!==--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else r=T._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(s(t,!1),0===t.strm.avail_out))return be}return t.insert=se-1>t.strstart?t.strstart:se-1,e===L?(s(t,!0),0===t.strm.avail_out?_e:we):t.last_lit&&(s(t,!1),0===t.strm.avail_out)?be:ye}function g(t,e){for(var n,r,i;;){if(fe>t.lookahead){if(d(t),fe>t.lookahead&&e===N)return be;if(0===t.lookahead)break}if(n=0,t.lookahead>=se&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+se-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=se-1,0!==n&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-fe&&(t.match_length=l(t,n),5>=t.match_length&&(t.strategy===Y||t.match_length===se&&t.strstart-t.match_start>4096)&&(t.match_length=se-1)),t.prev_length>=se&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-se,r=T._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-se),t.lookahead-=t.prev_length-1,t.prev_length-=2;do i>=++t.strstart&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+se-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(0!==--t.prev_length);if(t.match_available=0,t.match_length=se-1,t.strstart++,r&&(s(t,!1),0===t.strm.avail_out))return be}else if(t.match_available){if(r=T._tr_tally(t,0,t.window[t.strstart-1]),r&&s(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return be}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=T._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=se-1>t.strstart?t.strstart:se-1,e===L?(s(t,!0),0===t.strm.avail_out?_e:we):t.last_lit&&(s(t,!1),0===t.strm.avail_out)?be:ye}function m(t,e){for(var n,r,i,o,a=t.window;;){if(ue>=t.lookahead){if(d(t),ue>=t.lookahead&&e===N)return be;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=se&&t.strstart>0&&(i=t.strstart-1,r=a[i],r===a[++i]&&r===a[++i]&&r===a[++i])){o=t.strstart+ue;do;while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&o>i);t.match_length=ue-(o-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=se?(n=T._tr_tally(t,1,t.match_length-se),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=T._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(s(t,!1),0===t.strm.avail_out))return be}return t.insert=0,e===L?(s(t,!0),0===t.strm.avail_out?_e:we):t.last_lit&&(s(t,!1),0===t.strm.avail_out)?be:ye}function v(t,e){for(var n;;){if(0===t.lookahead&&(d(t),0===t.lookahead)){if(e===N)return be;break}if(t.match_length=0,n=T._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(s(t,!1),0===t.strm.avail_out))return be}return t.insert=0,e===L?(s(t,!0),0===t.strm.avail_out?_e:we):t.last_lit&&(s(t,!1),0===t.strm.avail_out)?be:ye}function b(t){t.window_size=2*t.w_size,o(t.head),t.max_lazy_match=O[t.level].max_lazy,t.good_match=O[t.level].good_length,t.nice_match=O[t.level].nice_length,t.max_chain_length=O[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=se-1,t.match_available=0,t.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=K,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 S.Buf16(2*oe),this.dyn_dtree=new S.Buf16(2*(2*re+1)),this.bl_tree=new S.Buf16(2*(2*ie+1)),o(this.dyn_ltree),o(this.dyn_dtree),o(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new S.Buf16(ae+1),this.heap=new S.Buf16(2*ne+1),o(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new S.Buf16(2*ne+1),o(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 _(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=J,e=t.state,e.pending=0,e.pending_out=0,0>e.wrap&&(e.wrap=-e.wrap),e.status=e.wrap?le:me,t.adler=2===e.wrap?0:1,e.last_flush=N,T._tr_init(e),F):r(t,U)}function w(t){var e=_(t);return e===F&&b(t.state),e}function E(t,e){return t&&t.state?2!==t.state.wrap?U:(t.state.gzhead=e,F):U}function x(t,e,n,i,o,a){if(!t)return U;var s=1;if(e===Z&&(e=6),0>i?(s=0,i=-i):i>15&&(s=2,i-=16),1>o||o>G||n!==K||8>i||i>15||0>e||e>9||0>a||a>W)return r(t,U);8===i&&(i=9);var u=new y;return t.state=u,u.strm=t,u.wrap=s,u.gzhead=null,u.w_bits=i,u.w_size=1<<u.w_bits,u.w_mask=u.w_size-1,u.hash_bits=o+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 S.Buf8(2*u.w_size),u.head=new S.Buf16(u.hash_size),u.prev=new S.Buf16(u.w_size),u.lit_bufsize=1<<o+6,u.pending_buf_size=4*u.lit_bufsize,u.pending_buf=new S.Buf8(u.pending_buf_size),u.d_buf=u.lit_bufsize>>1,u.l_buf=3*u.lit_bufsize,u.level=e,u.strategy=a,u.method=n,w(t)}function I(t,e){return x(t,e,K,Q,$,q)}function k(t,e){var n,s,c,l;if(!t||!t.state||e>z||0>e)return t?r(t,U):U;if(s=t.state,!t.output||!t.input&&0!==t.avail_in||s.status===ve&&e!==L)return r(t,0===t.avail_out?V:U);if(s.strm=t,n=s.last_flush,s.last_flush=e,s.status===le)if(2===s.wrap)t.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,255&s.gzhead.time>>8),u(s,255&s.gzhead.time>>16),u(s,255&s.gzhead.time>>24),u(s,9===s.level?2:s.strategy>=X||2>s.level?4:0),u(s,255&s.gzhead.os),s.gzhead.extra&&s.gzhead.extra.length&&(u(s,255&s.gzhead.extra.length),u(s,255&s.gzhead.extra.length>>8)),s.gzhead.hcrc&&(t.adler=R(t.adler,s.pending_buf,s.pending,0)),s.gzindex=0,s.status=de):(u(s,0),u(s,0),u(s,0),u(s,0),u(s,0),u(s,9===s.level?2:s.strategy>=X||2>s.level?4:0),u(s,Ee),s.status=me);else{var d=K+(s.w_bits-8<<4)<<8,h=-1;h=s.strategy>=X||2>s.level?0:6>s.level?1:6===s.level?2:3,d|=h<<6,0!==s.strstart&&(d|=ce),d+=31-d%31,s.status=me,f(s,d),0!==s.strstart&&(f(s,t.adler>>>16),f(s,65535&t.adler)),t.adler=1}if(s.status===de)if(s.gzhead.extra){for(c=s.pending;s.gzindex<(65535&s.gzhead.extra.length)&&(s.pending!==s.pending_buf_size||(s.gzhead.hcrc&&s.pending>c&&(t.adler=R(t.adler,s.pending_buf,s.pending-c,c)),a(t),c=s.pending,s.pending!==s.pending_buf_size));)u(s,255&s.gzhead.extra[s.gzindex]),s.gzindex++;s.gzhead.hcrc&&s.pending>c&&(t.adler=R(t.adler,s.pending_buf,s.pending-c,c)),s.gzindex===s.gzhead.extra.length&&(s.gzindex=0,s.status=he)}else s.status=he;if(s.status===he)if(s.gzhead.name){c=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>c&&(t.adler=R(t.adler,s.pending_buf,s.pending-c,c)),a(t),c=s.pending,s.pending===s.pending_buf_size)){l=1;break}l=s.gzindex<s.gzhead.name.length?255&s.gzhead.name.charCodeAt(s.gzindex++):0,u(s,l)}while(0!==l);s.gzhead.hcrc&&s.pending>c&&(t.adler=R(t.adler,s.pending_buf,s.pending-c,c)),0===l&&(s.gzindex=0,s.status=pe)}else s.status=pe;if(s.status===pe)if(s.gzhead.comment){c=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>c&&(t.adler=R(t.adler,s.pending_buf,s.pending-c,c)),a(t),c=s.pending,s.pending===s.pending_buf_size)){l=1;break}l=s.gzindex<s.gzhead.comment.length?255&s.gzhead.comment.charCodeAt(s.gzindex++):0,u(s,l)}while(0!==l);s.gzhead.hcrc&&s.pending>c&&(t.adler=R(t.adler,s.pending_buf,s.pending-c,c)),0===l&&(s.status=ge)}else s.status=ge;if(s.status===ge&&(s.gzhead.hcrc?(s.pending+2>s.pending_buf_size&&a(t),s.pending+2<=s.pending_buf_size&&(u(s,255&t.adler),u(s,255&t.adler>>8),t.adler=0,s.status=me)):s.status=me),0!==s.pending){if(a(t),0===t.avail_out)return s.last_flush=-1,F}else if(0===t.avail_in&&i(e)<=i(n)&&e!==L)return r(t,V);if(s.status===ve&&0!==t.avail_in)return r(t,V);if(0!==t.avail_in||0!==s.lookahead||e!==N&&s.status!==ve){var p=s.strategy===X?v(s,e):s.strategy===H?m(s,e):O[s.level].func(s,e);if((p===_e||p===we)&&(s.status=ve),p===be||p===_e)return 0===t.avail_out&&(s.last_flush=-1),F;if(p===ye&&(e===D?T._tr_align(s):e!==z&&(T._tr_stored_block(s,0,0,!1),e===B&&(o(s.head),0===s.lookahead&&(s.strstart=0,s.block_start=0,s.insert=0))),a(t),0===t.avail_out))return s.last_flush=-1,F}return e!==L?F:0>=s.wrap?M:(2===s.wrap?(u(s,255&t.adler),u(s,255&t.adler>>8),u(s,255&t.adler>>16),u(s,255&t.adler>>24),u(s,255&t.total_in),u(s,255&t.total_in>>8),u(s,255&t.total_in>>16),u(s,255&t.total_in>>24)):(f(s,t.adler>>>16),f(s,65535&t.adler)),a(t),s.wrap>0&&(s.wrap=-s.wrap),0!==s.pending?F:M)}function A(t){var e;return t&&t.state?(e=t.state.status,e!==le&&e!==de&&e!==he&&e!==pe&&e!==ge&&e!==me&&e!==ve?r(t,U):(t.state=null,e===me?r(t,P):F)):U}var O,S=t("../utils/common"),T=t("./trees"),C=t("./adler32"),R=t("./crc32"),j=t("./messages"),N=0,D=1,B=3,L=4,z=5,F=0,M=1,U=-2,P=-3,V=-5,Z=-1,Y=1,X=2,H=3,W=4,q=0,J=2,K=8,G=9,Q=15,$=8,te=29,ee=256,ne=ee+1+te,re=30,ie=19,oe=2*ne+1,ae=15,se=3,ue=258,fe=ue+se+1,ce=32,le=42,de=69,he=73,pe=91,ge=103,me=113,ve=666,be=1,ye=2,_e=3,we=4,Ee=3,xe=function(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i};O=[new xe(0,0,0,0,h),new xe(4,4,8,4,p),new xe(4,5,16,8,p),new xe(4,6,32,32,p),new xe(4,4,16,16,g),new xe(8,16,32,32,g),new xe(8,16,128,128,g),new xe(8,32,128,256,g),new xe(32,128,258,1024,g),new xe(32,258,258,4096,g)],n.deflateInit=I,n.deflateInit2=x,n.deflateReset=w,n.deflateResetKeep=_,n.deflateSetHeader=E,n.deflate=k,n.deflateEnd=A,n.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":32,"./adler32":34,"./crc32":36,"./messages":42,"./trees":43}],38:[function(t,e){"use strict";function n(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}e.exports=n},{}],39:[function(t,e){"use strict";var n=30,r=12;e.exports=function(t,e){var i,o,a,s,u,f,c,l,d,h,p,g,m,v,b,y,_,w,E,x,I,k,A,O,S;i=t.state,o=t.next_in,O=t.input,a=o+(t.avail_in-5),s=t.next_out,S=t.output,u=s-(e-t.avail_out),f=s+(t.avail_out-257),c=i.dmax,l=i.wsize,d=i.whave,h=i.wnext,p=i.window,g=i.hold,m=i.bits,v=i.lencode,b=i.distcode,y=(1<<i.lenbits)-1,_=(1<<i.distbits)-1;t:do{15>m&&(g+=O[o++]<<m,m+=8,g+=O[o++]<<m,m+=8),w=v[g&y];e:for(;;){if(E=w>>>24,g>>>=E,m-=E,E=255&w>>>16,0===E)S[s++]=65535&w;else{if(!(16&E)){if(0===(64&E)){w=v[(65535&w)+(g&(1<<E)-1)];continue e}if(32&E){i.mode=r;break t}t.msg="invalid literal/length code",i.mode=n;break t}x=65535&w,E&=15,E&&(E>m&&(g+=O[o++]<<m,m+=8),x+=g&(1<<E)-1,g>>>=E,m-=E),15>m&&(g+=O[o++]<<m,m+=8,g+=O[o++]<<m,m+=8),w=b[g&_];n:for(;;){if(E=w>>>24,g>>>=E,m-=E,E=255&w>>>16,!(16&E)){if(0===(64&E)){w=b[(65535&w)+(g&(1<<E)-1)];continue n}t.msg="invalid distance code",i.mode=n;break t}if(I=65535&w,E&=15,E>m&&(g+=O[o++]<<m,m+=8,E>m&&(g+=O[o++]<<m,m+=8)),I+=g&(1<<E)-1,I>c){t.msg="invalid distance too far back",i.mode=n;break t}if(g>>>=E,m-=E,E=s-u,I>E){if(E=I-E,E>d&&i.sane){t.msg="invalid distance too far back",i.mode=n;break t}if(k=0,A=p,0===h){if(k+=l-E,x>E){x-=E;do S[s++]=p[k++];while(--E);k=s-I,A=S}}else if(E>h){if(k+=l+h-E,E-=h,x>E){x-=E;do S[s++]=p[k++];while(--E);if(k=0,x>h){E=h,x-=E;do S[s++]=p[k++];while(--E);k=s-I,A=S}}}else if(k+=h-E,x>E){x-=E;do S[s++]=p[k++];while(--E);k=s-I,A=S}for(;x>2;)S[s++]=A[k++],S[s++]=A[k++],S[s++]=A[k++],x-=3;x&&(S[s++]=A[k++],x>1&&(S[s++]=A[k++]))}else{k=s-I;do S[s++]=S[k++],S[s++]=S[k++],S[s++]=S[k++],x-=3;while(x>2);x&&(S[s++]=S[k++],x>1&&(S[s++]=S[k++]))}break}}break}}while(a>o&&f>s);x=m>>3,o-=x,m-=x<<3,g&=(1<<m)-1,t.next_in=o,t.next_out=s,t.avail_in=a>o?5+(a-o):5-(o-a),t.avail_out=f>s?257+(f-s):257-(s-f),i.hold=g,i.bits=m}},{}],40:[function(t,e,n){"use strict";function r(t){return(255&t>>>24)+(65280&t>>>8)+((65280&t)<<8)+((255&t)<<24)}function i(){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 v.Buf16(320),this.work=new v.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function o(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=L,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new v.Buf32(pe),e.distcode=e.distdyn=new v.Buf32(ge),e.sane=1,e.back=-1,S):R}function a(t){var e;return t&&t.state?(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,o(t)):R}function s(t,e){var n,r;return t&&t.state?(r=t.state,0>e?(n=0,e=-e):(n=(e>>4)+1,48>e&&(e&=15)),e&&(8>e||e>15)?R:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,a(t))):R}function u(t,e){var n,r;return t?(r=new i,t.state=r,r.window=null,n=s(t,e),n!==S&&(t.state=null),n):R}function f(t){return u(t,ve)}function c(t){if(be){var e;for(g=new v.Buf32(512),m=new v.Buf32(32),e=0;144>e;)t.lens[e++]=8;for(;256>e;)t.lens[e++]=9;for(;280>e;)t.lens[e++]=7;for(;288>e;)t.lens[e++]=8;for(w(x,t.lens,0,288,g,0,t.work,{bits:9}),e=0;32>e;)t.lens[e++]=5;w(I,t.lens,0,32,m,0,t.work,{bits:5}),be=!1}t.lencode=g,t.lenbits=9,t.distcode=m,t.distbits=5}function l(t,e,n,r){var i,o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new v.Buf8(o.wsize)),r>=o.wsize?(v.arraySet(o.window,e,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),v.arraySet(o.window,e,n-r,i,o.wnext),r-=i,r?(v.arraySet(o.window,e,n-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0}function d(t,e){var n,i,o,a,s,u,f,d,h,p,g,m,pe,ge,me,ve,be,ye,_e,we,Ee,xe,Ie,ke,Ae=0,Oe=new v.Buf8(4),Se=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return R;n=t.state,n.mode===W&&(n.mode=q),s=t.next_out,o=t.output,f=t.avail_out,a=t.next_in,i=t.input,u=t.avail_in,d=n.hold,h=n.bits,p=u,g=f,xe=S;t:for(;;)switch(n.mode){case L:if(0===n.wrap){n.mode=q;break}for(;16>h;){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}if(2&n.wrap&&35615===d){n.check=0,Oe[0]=255&d,Oe[1]=255&d>>>8,n.check=y(n.check,Oe,2,0),d=0,h=0,n.mode=z;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&d)<<8)+(d>>8))%31){t.msg="incorrect header check",n.mode=le;break}if((15&d)!==B){t.msg="unknown compression method",n.mode=le;break}if(d>>>=4,h-=4,Ee=(15&d)+8,0===n.wbits)n.wbits=Ee;else if(Ee>n.wbits){t.msg="invalid window size",n.mode=le;break}n.dmax=1<<Ee,t.adler=n.check=1,n.mode=512&d?X:W,d=0,h=0;break;case z:for(;16>h;){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}if(n.flags=d,(255&n.flags)!==B){t.msg="unknown compression method",n.mode=le;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=le;break}n.head&&(n.head.text=1&d>>8),512&n.flags&&(Oe[0]=255&d,Oe[1]=255&d>>>8,n.check=y(n.check,Oe,2,0)),d=0,h=0,n.mode=F;case F:for(;32>h;){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}n.head&&(n.head.time=d),512&n.flags&&(Oe[0]=255&d,Oe[1]=255&d>>>8,Oe[2]=255&d>>>16,Oe[3]=255&d>>>24,n.check=y(n.check,Oe,4,0)),d=0,h=0,n.mode=M;case M:for(;16>h;){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}n.head&&(n.head.xflags=255&d,n.head.os=d>>8),512&n.flags&&(Oe[0]=255&d,Oe[1]=255&d>>>8,n.check=y(n.check,Oe,2,0)),d=0,h=0,n.mode=U;
|
||
case U:if(1024&n.flags){for(;16>h;){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}n.length=d,n.head&&(n.head.extra_len=d),512&n.flags&&(Oe[0]=255&d,Oe[1]=255&d>>>8,n.check=y(n.check,Oe,2,0)),d=0,h=0}else n.head&&(n.head.extra=null);n.mode=P;case P:if(1024&n.flags&&(m=n.length,m>u&&(m=u),m&&(n.head&&(Ee=n.head.extra_len-n.length,n.head.extra||(n.head.extra=Array(n.head.extra_len)),v.arraySet(n.head.extra,i,a,m,Ee)),512&n.flags&&(n.check=y(n.check,i,m,a)),u-=m,a+=m,n.length-=m),n.length))break t;n.length=0,n.mode=V;case V:if(2048&n.flags){if(0===u)break t;m=0;do Ee=i[a+m++],n.head&&Ee&&65536>n.length&&(n.head.name+=String.fromCharCode(Ee));while(Ee&&u>m);if(512&n.flags&&(n.check=y(n.check,i,m,a)),u-=m,a+=m,Ee)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=Z;case Z:if(4096&n.flags){if(0===u)break t;m=0;do Ee=i[a+m++],n.head&&Ee&&65536>n.length&&(n.head.comment+=String.fromCharCode(Ee));while(Ee&&u>m);if(512&n.flags&&(n.check=y(n.check,i,m,a)),u-=m,a+=m,Ee)break t}else n.head&&(n.head.comment=null);n.mode=Y;case Y:if(512&n.flags){for(;16>h;){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}if(d!==(65535&n.check)){t.msg="header crc mismatch",n.mode=le;break}d=0,h=0}n.head&&(n.head.hcrc=1&n.flags>>9,n.head.done=!0),t.adler=n.check=0,n.mode=W;break;case X:for(;32>h;){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}t.adler=n.check=r(d),d=0,h=0,n.mode=H;case H:if(0===n.havedict)return t.next_out=s,t.avail_out=f,t.next_in=a,t.avail_in=u,n.hold=d,n.bits=h,C;t.adler=n.check=1,n.mode=W;case W:if(e===A||e===O)break t;case q:if(n.last){d>>>=7&h,h-=7&h,n.mode=ue;break}for(;3>h;){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}switch(n.last=1&d,d>>>=1,h-=1,3&d){case 0:n.mode=J;break;case 1:if(c(n),n.mode=ee,e===O){d>>>=2,h-=2;break t}break;case 2:n.mode=Q;break;case 3:t.msg="invalid block type",n.mode=le}d>>>=2,h-=2;break;case J:for(d>>>=7&h,h-=7&h;32>h;){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}if((65535&d)!==(65535^d>>>16)){t.msg="invalid stored block lengths",n.mode=le;break}if(n.length=65535&d,d=0,h=0,n.mode=K,e===O)break t;case K:n.mode=G;case G:if(m=n.length){if(m>u&&(m=u),m>f&&(m=f),0===m)break t;v.arraySet(o,i,a,m,s),u-=m,a+=m,f-=m,s+=m,n.length-=m;break}n.mode=W;break;case Q:for(;14>h;){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}if(n.nlen=(31&d)+257,d>>>=5,h-=5,n.ndist=(31&d)+1,d>>>=5,h-=5,n.ncode=(15&d)+4,d>>>=4,h-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=le;break}n.have=0,n.mode=$;case $:for(;n.have<n.ncode;){for(;3>h;){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}n.lens[Se[n.have++]]=7&d,d>>>=3,h-=3}for(;19>n.have;)n.lens[Se[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,Ie={bits:n.lenbits},xe=w(E,n.lens,0,19,n.lencode,0,n.work,Ie),n.lenbits=Ie.bits,xe){t.msg="invalid code lengths set",n.mode=le;break}n.have=0,n.mode=te;case te:for(;n.have<n.nlen+n.ndist;){for(;Ae=n.lencode[d&(1<<n.lenbits)-1],me=Ae>>>24,ve=255&Ae>>>16,be=65535&Ae,!(h>=me);){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}if(16>be)d>>>=me,h-=me,n.lens[n.have++]=be;else{if(16===be){for(ke=me+2;ke>h;){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}if(d>>>=me,h-=me,0===n.have){t.msg="invalid bit length repeat",n.mode=le;break}Ee=n.lens[n.have-1],m=3+(3&d),d>>>=2,h-=2}else if(17===be){for(ke=me+3;ke>h;){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}d>>>=me,h-=me,Ee=0,m=3+(7&d),d>>>=3,h-=3}else{for(ke=me+7;ke>h;){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}d>>>=me,h-=me,Ee=0,m=11+(127&d),d>>>=7,h-=7}if(n.have+m>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=le;break}for(;m--;)n.lens[n.have++]=Ee}}if(n.mode===le)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=le;break}if(n.lenbits=9,Ie={bits:n.lenbits},xe=w(x,n.lens,0,n.nlen,n.lencode,0,n.work,Ie),n.lenbits=Ie.bits,xe){t.msg="invalid literal/lengths set",n.mode=le;break}if(n.distbits=6,n.distcode=n.distdyn,Ie={bits:n.distbits},xe=w(I,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,Ie),n.distbits=Ie.bits,xe){t.msg="invalid distances set",n.mode=le;break}if(n.mode=ee,e===O)break t;case ee:n.mode=ne;case ne:if(u>=6&&f>=258){t.next_out=s,t.avail_out=f,t.next_in=a,t.avail_in=u,n.hold=d,n.bits=h,_(t,g),s=t.next_out,o=t.output,f=t.avail_out,a=t.next_in,i=t.input,u=t.avail_in,d=n.hold,h=n.bits,n.mode===W&&(n.back=-1);break}for(n.back=0;Ae=n.lencode[d&(1<<n.lenbits)-1],me=Ae>>>24,ve=255&Ae>>>16,be=65535&Ae,!(h>=me);){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}if(ve&&0===(240&ve)){for(ye=me,_e=ve,we=be;Ae=n.lencode[we+((d&(1<<ye+_e)-1)>>ye)],me=Ae>>>24,ve=255&Ae>>>16,be=65535&Ae,!(h>=ye+me);){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}d>>>=ye,h-=ye,n.back+=ye}if(d>>>=me,h-=me,n.back+=me,n.length=be,0===ve){n.mode=se;break}if(32&ve){n.back=-1,n.mode=W;break}if(64&ve){t.msg="invalid literal/length code",n.mode=le;break}n.extra=15&ve,n.mode=re;case re:if(n.extra){for(ke=n.extra;ke>h;){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}n.length+=d&(1<<n.extra)-1,d>>>=n.extra,h-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=ie;case ie:for(;Ae=n.distcode[d&(1<<n.distbits)-1],me=Ae>>>24,ve=255&Ae>>>16,be=65535&Ae,!(h>=me);){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}if(0===(240&ve)){for(ye=me,_e=ve,we=be;Ae=n.distcode[we+((d&(1<<ye+_e)-1)>>ye)],me=Ae>>>24,ve=255&Ae>>>16,be=65535&Ae,!(h>=ye+me);){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}d>>>=ye,h-=ye,n.back+=ye}if(d>>>=me,h-=me,n.back+=me,64&ve){t.msg="invalid distance code",n.mode=le;break}n.offset=be,n.extra=15&ve,n.mode=oe;case oe:if(n.extra){for(ke=n.extra;ke>h;){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}n.offset+=d&(1<<n.extra)-1,d>>>=n.extra,h-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=le;break}n.mode=ae;case ae:if(0===f)break t;if(m=g-f,n.offset>m){if(m=n.offset-m,m>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=le;break}m>n.wnext?(m-=n.wnext,pe=n.wsize-m):pe=n.wnext-m,m>n.length&&(m=n.length),ge=n.window}else ge=o,pe=s-n.offset,m=n.length;m>f&&(m=f),f-=m,n.length-=m;do o[s++]=ge[pe++];while(--m);0===n.length&&(n.mode=ne);break;case se:if(0===f)break t;o[s++]=n.length,f--,n.mode=ne;break;case ue:if(n.wrap){for(;32>h;){if(0===u)break t;u--,d|=i[a++]<<h,h+=8}if(g-=f,t.total_out+=g,n.total+=g,g&&(t.adler=n.check=n.flags?y(n.check,o,g,s-g):b(n.check,o,g,s-g)),g=f,(n.flags?d:r(d))!==n.check){t.msg="incorrect data check",n.mode=le;break}d=0,h=0}n.mode=fe;case fe:if(n.wrap&&n.flags){for(;32>h;){if(0===u)break t;u--,d+=i[a++]<<h,h+=8}if(d!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=le;break}d=0,h=0}n.mode=ce;case ce:xe=T;break t;case le:xe=j;break t;case de:return N;case he:default:return R}return t.next_out=s,t.avail_out=f,t.next_in=a,t.avail_in=u,n.hold=d,n.bits=h,(n.wsize||g!==t.avail_out&&le>n.mode&&(ue>n.mode||e!==k))&&l(t,t.output,t.next_out,g-t.avail_out)?(n.mode=de,N):(p-=t.avail_in,g-=t.avail_out,t.total_in+=p,t.total_out+=g,n.total+=g,n.wrap&&g&&(t.adler=n.check=n.flags?y(n.check,o,g,t.next_out-g):b(n.check,o,g,t.next_out-g)),t.data_type=n.bits+(n.last?64:0)+(n.mode===W?128:0)+(n.mode===ee||n.mode===K?256:0),(0===p&&0===g||e===k)&&xe===S&&(xe=D),xe)}function h(t){if(!t||!t.state)return R;var e=t.state;return e.window&&(e.window=null),t.state=null,S}function p(t,e){var n;return t&&t.state?(n=t.state,0===(2&n.wrap)?R:(n.head=e,e.done=!1,S)):R}var g,m,v=t("../utils/common"),b=t("./adler32"),y=t("./crc32"),_=t("./inffast"),w=t("./inftrees"),E=0,x=1,I=2,k=4,A=5,O=6,S=0,T=1,C=2,R=-2,j=-3,N=-4,D=-5,B=8,L=1,z=2,F=3,M=4,U=5,P=6,V=7,Z=8,Y=9,X=10,H=11,W=12,q=13,J=14,K=15,G=16,Q=17,$=18,te=19,ee=20,ne=21,re=22,ie=23,oe=24,ae=25,se=26,ue=27,fe=28,ce=29,le=30,de=31,he=32,pe=852,ge=592,me=15,ve=me,be=!0;n.inflateReset=a,n.inflateReset2=s,n.inflateResetKeep=o,n.inflateInit=f,n.inflateInit2=u,n.inflate=d,n.inflateEnd=h,n.inflateGetHeader=p,n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":32,"./adler32":34,"./crc32":36,"./inffast":39,"./inftrees":41}],41:[function(t,e){"use strict";var n=t("../utils/common"),r=15,i=852,o=592,a=0,s=1,u=2,f=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],c=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],d=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(t,e,h,p,g,m,v,b){var y,_,w,E,x,I,k,A,O,S=b.bits,T=0,C=0,R=0,j=0,N=0,D=0,B=0,L=0,z=0,F=0,M=null,U=0,P=new n.Buf16(r+1),V=new n.Buf16(r+1),Z=null,Y=0;for(T=0;r>=T;T++)P[T]=0;for(C=0;p>C;C++)P[e[h+C]]++;for(N=S,j=r;j>=1&&0===P[j];j--);if(N>j&&(N=j),0===j)return g[m++]=20971520,g[m++]=20971520,b.bits=1,0;for(R=1;j>R&&0===P[R];R++);for(R>N&&(N=R),L=1,T=1;r>=T;T++)if(L<<=1,L-=P[T],0>L)return-1;if(L>0&&(t===a||1!==j))return-1;for(V[1]=0,T=1;r>T;T++)V[T+1]=V[T]+P[T];for(C=0;p>C;C++)0!==e[h+C]&&(v[V[e[h+C]]++]=C);switch(t){case a:M=Z=v,I=19;break;case s:M=f,U-=257,Z=c,Y-=257,I=256;break;default:M=l,Z=d,I=-1}if(F=0,C=0,T=R,x=m,D=N,B=0,w=-1,z=1<<N,E=z-1,t===s&&z>i||t===u&&z>o)return 1;for(var X=0;;){X++,k=T-B,I>v[C]?(A=0,O=v[C]):v[C]>I?(A=Z[Y+v[C]],O=M[U+v[C]]):(A=96,O=0),y=1<<T-B,_=1<<D,R=_;do _-=y,g[x+(F>>B)+_]=0|(k<<24|A<<16|O);while(0!==_);for(y=1<<T-1;F&y;)y>>=1;if(0!==y?(F&=y-1,F+=y):F=0,C++,0===--P[T]){if(T===j)break;T=e[h+v[C]]}if(T>N&&(F&E)!==w){for(0===B&&(B=N),x+=R,D=T-B,L=1<<D;j>D+B&&(L-=P[D+B],!(0>=L));)D++,L<<=1;if(z+=1<<D,t===s&&z>i||t===u&&z>o)return 1;w=F&E,g[w]=0|(N<<24|D<<16|x-m)}}return 0!==F&&(g[x+F]=0|(T-B<<24|64<<16)),b.bits=N,0}},{"../utils/common":32}],42:[function(t,e){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],43:[function(t,e,n){"use strict";function r(t){for(var e=t.length;--e>=0;)t[e]=0}function i(t){return 256>t?ae[t]:ae[256+(t>>>7)]}function o(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=255&e>>>8}function a(t,e,n){t.bi_valid>W-n?(t.bi_buf|=65535&e<<t.bi_valid,o(t,t.bi_buf),t.bi_buf=e>>W-t.bi_valid,t.bi_valid+=n-W):(t.bi_buf|=65535&e<<t.bi_valid,t.bi_valid+=n)}function s(t,e,n){a(t,n[2*e],n[2*e+1])}function u(t,e){var n=0;do n|=1&t,t>>>=1,n<<=1;while(--e>0);return n>>>1}function f(t){16===t.bi_valid?(o(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}function c(t,e){var n,r,i,o,a,s,u=e.dyn_tree,f=e.max_code,c=e.stat_desc.static_tree,l=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,h=e.stat_desc.extra_base,p=e.stat_desc.max_length,g=0;for(o=0;H>=o;o++)t.bl_count[o]=0;for(u[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;X>n;n++)r=t.heap[n],o=u[2*u[2*r+1]+1]+1,o>p&&(o=p,g++),u[2*r+1]=o,r>f||(t.bl_count[o]++,a=0,r>=h&&(a=d[r-h]),s=u[2*r],t.opt_len+=s*(o+a),l&&(t.static_len+=s*(c[2*r+1]+a)));if(0!==g){do{for(o=p-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[p]--,g-=2}while(g>0);for(o=p;0!==o;o--)for(r=t.bl_count[o];0!==r;)i=t.heap[--n],i>f||(u[2*i+1]!==o&&(t.opt_len+=(o-u[2*i+1])*u[2*i],u[2*i+1]=o),r--)}}function l(t,e,n){var r,i,o=Array(H+1),a=0;for(r=1;H>=r;r++)o[r]=a=a+n[r-1]<<1;for(i=0;e>=i;i++){var s=t[2*i+1];0!==s&&(t[2*i]=u(o[s]++,s))}}function d(){var t,e,n,r,i,o=Array(H+1);for(n=0,r=0;U-1>r;r++)for(ue[r]=n,t=0;1<<$[r]>t;t++)se[n++]=r;for(se[n-1]=r,i=0,r=0;16>r;r++)for(fe[r]=i,t=0;1<<te[r]>t;t++)ae[i++]=r;for(i>>=7;Z>r;r++)for(fe[r]=i<<7,t=0;1<<te[r]-7>t;t++)ae[256+i++]=r;for(e=0;H>=e;e++)o[e]=0;for(t=0;143>=t;)ie[2*t+1]=8,t++,o[8]++;for(;255>=t;)ie[2*t+1]=9,t++,o[9]++;for(;279>=t;)ie[2*t+1]=7,t++,o[7]++;for(;287>=t;)ie[2*t+1]=8,t++,o[8]++;for(l(ie,V+1,o),t=0;Z>t;t++)oe[2*t+1]=5,oe[2*t]=u(t,5);ce=new he(ie,$,P+1,V,H),le=new he(oe,te,0,Z,H),de=new he(Array(0),ee,0,Y,q)}function h(t){var e;for(e=0;V>e;e++)t.dyn_ltree[2*e]=0;for(e=0;Z>e;e++)t.dyn_dtree[2*e]=0;for(e=0;Y>e;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*J]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function p(t){t.bi_valid>8?o(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function g(t,e,n,r){p(t),r&&(o(t,n),o(t,~n)),C.arraySet(t.pending_buf,t.window,e,n,t.pending),t.pending+=n}function m(t,e,n,r){var i=2*e,o=2*n;return t[i]<t[o]||t[i]===t[o]&&r[e]<=r[n]}function v(t,e,n){for(var r=t.heap[n],i=n<<1;t.heap_len>=i&&(t.heap_len>i&&m(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!m(e,r,t.heap[i],t.depth));)t.heap[n]=t.heap[i],n=i,i<<=1;t.heap[n]=r}function b(t,e,n){var r,o,u,f,c=0;if(0!==t.last_lit)do r=t.pending_buf[t.d_buf+2*c]<<8|t.pending_buf[t.d_buf+2*c+1],o=t.pending_buf[t.l_buf+c],c++,0===r?s(t,o,e):(u=se[o],s(t,u+P+1,e),f=$[u],0!==f&&(o-=ue[u],a(t,o,f)),r--,u=i(r),s(t,u,n),f=te[u],0!==f&&(r-=fe[u],a(t,r,f)));while(t.last_lit>c);s(t,J,e)}function y(t,e){var n,r,i,o=e.dyn_tree,a=e.stat_desc.static_tree,s=e.stat_desc.has_stree,u=e.stat_desc.elems,f=-1;for(t.heap_len=0,t.heap_max=X,n=0;u>n;n++)0!==o[2*n]?(t.heap[++t.heap_len]=f=n,t.depth[n]=0):o[2*n+1]=0;for(;2>t.heap_len;)i=t.heap[++t.heap_len]=2>f?++f:0,o[2*i]=1,t.depth[i]=0,t.opt_len--,s&&(t.static_len-=a[2*i+1]);for(e.max_code=f,n=t.heap_len>>1;n>=1;n--)v(t,o,n);i=u;do n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],v(t,o,1),r=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=r,o[2*i]=o[2*n]+o[2*r],t.depth[i]=(t.depth[n]>=t.depth[r]?t.depth[n]:t.depth[r])+1,o[2*n+1]=o[2*r+1]=i,t.heap[1]=i++,v(t,o,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],c(t,e),l(o,f,t.bl_count)}function _(t,e,n){var r,i,o=-1,a=e[1],s=0,u=7,f=4;for(0===a&&(u=138,f=3),e[2*(n+1)+1]=65535,r=0;n>=r;r++)i=a,a=e[2*(r+1)+1],u>++s&&i===a||(f>s?t.bl_tree[2*i]+=s:0!==i?(i!==o&&t.bl_tree[2*i]++,t.bl_tree[2*K]++):10>=s?t.bl_tree[2*G]++:t.bl_tree[2*Q]++,s=0,o=i,0===a?(u=138,f=3):i===a?(u=6,f=3):(u=7,f=4))}function w(t,e,n){var r,i,o=-1,u=e[1],f=0,c=7,l=4;for(0===u&&(c=138,l=3),r=0;n>=r;r++)if(i=u,u=e[2*(r+1)+1],!(c>++f&&i===u)){if(l>f){do s(t,i,t.bl_tree);while(0!==--f)}else 0!==i?(i!==o&&(s(t,i,t.bl_tree),f--),s(t,K,t.bl_tree),a(t,f-3,2)):10>=f?(s(t,G,t.bl_tree),a(t,f-3,3)):(s(t,Q,t.bl_tree),a(t,f-11,7));f=0,o=i,0===u?(c=138,l=3):i===u?(c=6,l=3):(c=7,l=4)}}function E(t){var e;for(_(t,t.dyn_ltree,t.l_desc.max_code),_(t,t.dyn_dtree,t.d_desc.max_code),y(t,t.bl_desc),e=Y-1;e>=3&&0===t.bl_tree[2*ne[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}function x(t,e,n,r){var i;for(a(t,e-257,5),a(t,n-1,5),a(t,r-4,4),i=0;r>i;i++)a(t,t.bl_tree[2*ne[i]+1],3);w(t,t.dyn_ltree,e-1),w(t,t.dyn_dtree,n-1)}function I(t){var e,n=4093624447;for(e=0;31>=e;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return j;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return N;for(e=32;P>e;e++)if(0!==t.dyn_ltree[2*e])return N;return j}function k(t){ge||(d(),ge=!0),t.l_desc=new pe(t.dyn_ltree,ce),t.d_desc=new pe(t.dyn_dtree,le),t.bl_desc=new pe(t.bl_tree,de),t.bi_buf=0,t.bi_valid=0,h(t)}function A(t,e,n,r){a(t,(B<<1)+(r?1:0),3),g(t,e,n,!0)}function O(t){a(t,L<<1,3),s(t,J,ie),f(t)}function S(t,e,n,r){var i,o,s=0;t.level>0?(t.strm.data_type===D&&(t.strm.data_type=I(t)),y(t,t.l_desc),y(t,t.d_desc),s=E(t),i=t.opt_len+3+7>>>3,o=t.static_len+3+7>>>3,i>=o&&(i=o)):i=o=n+5,i>=n+4&&-1!==e?A(t,e,n,r):t.strategy===R||o===i?(a(t,(L<<1)+(r?1:0),3),b(t,ie,oe)):(a(t,(z<<1)+(r?1:0),3),x(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),b(t,t.dyn_ltree,t.dyn_dtree)),h(t),r&&p(t)}function T(t,e,n){return t.pending_buf[t.d_buf+2*t.last_lit]=255&e>>>8,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(se[n]+P+1)]++,t.dyn_dtree[2*i(e)]++),t.last_lit===t.lit_bufsize-1}var C=t("../utils/common"),R=4,j=0,N=1,D=2,B=0,L=1,z=2,F=3,M=258,U=29,P=256,V=P+1+U,Z=30,Y=19,X=2*V+1,H=15,W=16,q=7,J=256,K=16,G=17,Q=18,$=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],te=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],ee=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ne=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],re=512,ie=Array(2*(V+2));r(ie);var oe=Array(2*Z);r(oe);var ae=Array(re);r(ae);var se=Array(M-F+1);r(se);var ue=Array(U);r(ue);var fe=Array(Z);r(fe);var ce,le,de,he=function(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length},pe=function(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e},ge=!1;n._tr_init=k,n._tr_stored_block=A,n._tr_flush_block=S,n._tr_tally=T,n._tr_align=O},{"../utils/common":32}],44:[function(t,e){"use strict";function n(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}e.exports=n},{}],45:[function(t,e){(function(t){function n(e,n,r){return e instanceof ArrayBuffer&&(e=new Uint8Array(e)),new t(e,n,r)}n.prototype=Object.create(t.prototype),n.prototype.constructor=n,Object.keys(t).forEach(function(e){t.hasOwnProperty(e)&&(n[e]=t[e])}),e.exports=n}).call(this,t("buffer").Buffer)},{buffer:7}],46:[function(t,e){var n="READ",r="WRITE",i="CREATE",o="EXCLUSIVE",a="TRUNCATE",s="APPEND",u="CREATE",f="REPLACE";e.exports={FILE_SYSTEM_NAME:"local",FILE_STORE_NAME:"files",IDB_RO:"readonly",IDB_RW:"readwrite",WSQL_VERSION:"1",WSQL_SIZE:5242880,WSQL_DESC:"FileSystem Storage",MODE_FILE:"FILE",MODE_DIRECTORY:"DIRECTORY",MODE_SYMBOLIC_LINK:"SYMLINK",MODE_META:"META",SYMLOOP_MAX:10,BINARY_MIME_TYPE:"application/octet-stream",JSON_MIME_TYPE:"application/json",ROOT_DIRECTORY_NAME:"/",FS_FORMAT:"FORMAT",FS_NOCTIME:"NOCTIME",FS_NOMTIME:"NOMTIME",FS_NODUPEIDCHECK:"FS_NODUPEIDCHECK",O_READ:n,O_WRITE:r,O_CREATE:i,O_EXCLUSIVE:o,O_TRUNCATE:a,O_APPEND:s,O_FLAGS:{r:[n],"r+":[n,r],w:[r,i,a],"w+":[r,n,i,a],wx:[r,i,o,a],"wx+":[r,n,i,o,a],a:[r,i,s],"a+":[r,n,i,s],ax:[r,i,o,s],"ax+":[r,n,i,o,s]},XATTR_CREATE:u,XATTR_REPLACE:f,FS_READY:"READY",FS_PENDING:"PENDING",FS_ERROR:"ERROR",SUPER_NODE_ID:"00000000-0000-0000-0000-000000000000",STDIN:0,STDOUT:1,STDERR:2,FIRST_DESCRIPTOR:3,ENVIRONMENT:{TMP:"/tmp",PATH:""}}},{}],47:[function(t,e){var n=t("./constants.js").MODE_FILE;e.exports=function(t,e){this.id=t,this.type=e||n}},{"./constants.js":46}],48:[function(t,e){(function(t){function n(t){return t.toString("utf8")}function r(e){return new t(e,"utf8")}e.exports={encode:r,decode:n}}).call(this,t("buffer").Buffer)},{buffer:7}],49:[function(t,e){var n={};["9:EBADF:bad file descriptor","10:EBUSY:resource busy or locked","18:EINVAL:invalid argument","27:ENOTDIR:not a directory","28:EISDIR:illegal operation on a directory","34:ENOENT:no such file or directory","47:EEXIST:file already exists","51:ELOOP:too many symbolic links encountered","53:ENOTEMPTY:directory not empty","55:EIO:i/o error","1000:ENOTMOUNTED:not mounted","1001:EFILESYSTEMERROR:missing super node, use 'FORMAT' flag to format filesystem.","1002:ENOATTR:attribute does not exist"].forEach(function(t){function e(t,e){Error.call(this),this.name=i,this.code=i,this.errno=r,this.message=t||o,e&&(this.path=e),this.stack=Error(this.message).stack}t=t.split(":");var r=+t[0],i=t[1],o=t[2];e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=function(){var t=this.path?", '"+this.path+"'":"";return this.name+": "+this.message+t},n[i]=n[r]=e}),e.exports=n},{}],50:[function(t,e){function n(t){return function(e,n){e?t(e):t(null,n)}}function r(t,e,n,r,i){function o(n){t.changes.push({event:"change",path:e}),i(n)}var a=t.flags;de(a).contains(Le)&&delete r.ctime,de(a).contains(Be)&&delete r.mtime;var s=!1;r.ctime&&(n.ctime=r.ctime,n.atime=r.ctime,s=!0),r.atime&&(n.atime=r.atime,s=!0),r.mtime&&(n.mtime=r.mtime,s=!0),s?t.putObject(n.id,n,o):o()}function i(t,e,n,i){function a(n,r){n?i(n):r.mode!==we?i(new Fe.ENOTDIR("a component of the path prefix is not a directory",e)):(l=r,o(t,e,s))}function s(n,r){!n&&r?i(new Fe.EEXIST("path name already exists",e)):!n||n instanceof Fe.ENOENT?t.getObject(l.data,u):i(n)}function u(e,r){e?i(e):(d=r,Ve.create({guid:t.guid,mode:n},function(e,n){return e?(i(e),void 0):(h=n,h.nlinks+=1,t.putObject(h.id,h,c),void 0)}))}function f(e){if(e)i(e);else{var n=Date.now();r(t,g,h,{mtime:n,ctime:n},i)}}function c(e){e?i(e):(d[p]=new Me(h.id,n),t.putObject(l.data,d,f))}if(n!==we&&n!==_e)return i(new Fe.EINVAL("mode must be a directory or file",e));e=pe(e);var l,d,h,p=me(e),g=ge(e);o(t,g,a)}function o(t,e,n){function r(e,r){e?n(e):r&&r.mode===xe&&r.rnode?t.getObject(r.rnode,i):n(new Fe.EFILESYSTEMERROR)}function i(t,e){t?n(t):e?n(null,e):n(new Fe.ENOENT)}function a(r,i){r?n(r):i.mode===we&&i.data?t.getObject(i.data,s):n(new Fe.ENOTDIR("a component of the path prefix is not a directory",e))}function s(r,i){if(r)n(r);else if(de(i).has(c)){var o=i[c].id;t.getObject(o,u)}else n(new Fe.ENOENT(null,e))}function u(t,r){t?n(t):r.mode==Ee?(d++,d>Ae?n(new Fe.ELOOP(null,e)):f(r.data)):n(null,r)}function f(e){e=pe(e),l=ge(e),c=me(e),Ie==c?t.getObject(ke,r):o(t,l,a)}if(e=pe(e),!e)return n(new Fe.ENOENT("path is an empty string"));var c=me(e),l=ge(e),d=0;Ie==c?t.getObject(ke,r):o(t,l,a)}function a(t,e,n,i,a,s){function u(o,u){function c(e){e?s(e):r(t,f,u,{ctime:Date.now()},s)}u?u.xattrs[n]:null,o?s(o):a===Ne&&u.xattrs.hasOwnProperty(n)?s(new Fe.EEXIST("attribute already exists",e)):a!==De||u.xattrs.hasOwnProperty(n)?(u.xattrs[n]=i,t.putObject(u.id,u,c)):s(new Fe.ENOATTR(null,e))}var f;"string"==typeof e?(f=e,o(t,e,u)):"object"==typeof e&&"string"==typeof e.id?(f=e.path,t.getObject(e.id,u)):s(new Fe.EINVAL("path or file descriptor of wrong type",e))}function s(t,e){function n(n,i){!n&&i?e():!n||n instanceof Fe.ENOENT?Pe.create({guid:t.guid},function(n,i){return n?(e(n),void 0):(o=i,t.putObject(o.id,o,r),void 0)}):e(n)}function r(n){n?e(n):Ve.create({guid:t.guid,id:o.rnode,mode:we},function(n,r){return n?(e(n),void 0):(a=r,a.nlinks+=1,t.putObject(a.id,a,i),void 0)})}function i(n){n?e(n):(s={},t.putObject(a.data,s,e))}var o,a,s;t.getObject(ke,n)}function u(t,e,n){function i(r,i){!r&&i?n(new Fe.EEXIST(null,e)):!r||r instanceof Fe.ENOENT?o(t,m,a):n(r)}function a(e,r){e?n(e):(h=r,t.getObject(h.data,s))}function s(e,r){e?n(e):(p=r,Ve.create({guid:t.guid,mode:we},function(e,r){return e?(n(e),void 0):(l=r,l.nlinks+=1,t.putObject(l.id,l,u),void 0)}))}function u(e){e?n(e):(d={},t.putObject(l.data,d,c))}function f(e){if(e)n(e);else{var i=Date.now();r(t,m,h,{mtime:i,ctime:i},n)}}function c(e){e?n(e):(p[g]=new Me(l.id,we),t.putObject(h.data,p,f))}e=pe(e);var l,d,h,p,g=me(e),m=ge(e);o(t,e,i)}function f(t,e,n){function i(e,r){e?n(e):(g=r,t.getObject(g.data,a))}function a(r,i){r?n(r):Ie==v?n(new Fe.EBUSY(null,e)):de(i).has(v)?(m=i,h=m[v].id,t.getObject(h,s)):n(new Fe.ENOENT(null,e))}function s(r,i){r?n(r):i.mode!=we?n(new Fe.ENOTDIR(null,e)):(h=i,t.getObject(h.data,u))}function u(t,r){t?n(t):(p=r,de(p).size()>0?n(new Fe.ENOTEMPTY(null,e)):c())}function f(e){if(e)n(e);else{var i=Date.now();r(t,b,g,{mtime:i,ctime:i},l)}}function c(){delete m[v],t.putObject(g.data,m,f)}function l(e){e?n(e):t.delete(h.id,d)}function d(e){e?n(e):t.delete(h.data,n)}e=pe(e);var h,p,g,m,v=me(e),b=ge(e);o(t,b,i)}function c(t,e,n,i){function a(n,r){n?i(n):r.mode!==we?i(new Fe.ENOENT(null,e)):(m=r,t.getObject(m.data,s))}function s(r,o){r?i(r):(v=o,de(v).has(w)?de(n).contains(Ce)?i(new Fe.ENOENT("O_CREATE and O_EXCLUSIVE are set, and the named file exists",e)):(b=v[w],b.type==we&&de(n).contains(Se)?i(new Fe.EISDIR("the named file is a directory and O_WRITE is set",e)):t.getObject(b.id,u)):de(n).contains(Te)?l():i(new Fe.ENOENT("O_CREATE is not set and the named file does not exist",e)))}function u(t,n){if(t)i(t);else{var r=n;r.mode==Ee?(x++,x>Ae?i(new Fe.ELOOP(null,e)):f(r.data)):c(void 0,r)}}function f(r){r=pe(r),E=ge(r),w=me(r),Ie==w&&(de(n).contains(Se)?i(new Fe.EISDIR("the named file is a directory and O_WRITE is set",e)):o(t,e,c)),o(t,E,a)}function c(t,e){t?i(t):(y=e,i(null,y))}function l(){Ve.create({guid:t.guid,mode:_e},function(e,n){return e?(i(e),void 0):(y=n,y.nlinks+=1,t.putObject(y.id,y,d),void 0)})}function d(e){e?i(e):(_=new Ye(0),_.fill(0),t.putBuffer(y.data,_,p))}function h(e){if(e)i(e);else{var n=Date.now();r(t,E,m,{mtime:n,ctime:n},g)}}function p(e){e?i(e):(v[w]=new Me(y.id,_e),t.putObject(m.data,v,h))}function g(t){t?i(t):i(null,y)}e=pe(e);var m,v,b,y,_,w=me(e),E=ge(e),x=0;Ie==w?de(n).contains(Se)?i(new Fe.EISDIR("the named file is a directory and O_WRITE is set",e)):o(t,e,c):o(t,E,a)}function l(t,e,n,i,o,a){function s(t){t?a(t):a(null,o)}function u(n){if(n)a(n);else{var i=Date.now();r(t,e.path,l,{mtime:i,ctime:i},s)}}function f(e){e?a(e):t.putObject(l.id,l,u)}function c(r,s){if(r)a(r);else{l=s;var u=new Ye(o);u.fill(0),n.copy(u,0,i,i+o),e.position=o,l.size=o,l.version+=1,t.putBuffer(l.data,u,f)}}var l;t.getObject(e.id,c)}function d(t,e,n,i,o,a,s){function u(t){t?s(t):s(null,o)}function f(n){if(n)s(n);else{var i=Date.now();r(t,e.path,h,{mtime:i,ctime:i},u)}}function c(e){e?s(e):t.putObject(h.id,h,f)}function l(r,u){if(r)s(r);else{if(p=u,!p)return s(new Fe.EIO("Expected Buffer"));var f=void 0!==a&&null!==a?a:e.position,l=Math.max(p.length,f+o),d=new Ye(l);d.fill(0),p&&p.copy(d),n.copy(d,f,i,i+o),void 0===a&&(e.position+=o),h.size=l,h.version+=1,t.putBuffer(h.data,d,c)}}function d(e,n){e?s(e):(h=n,t.getBuffer(h.data,l))}var h,p;t.getObject(e.id,d)}function h(t,e,n,r,i,o,a){function s(t,s){if(t)a(t);else{if(c=s,!c)return a(new Fe.EIO("Expected Buffer"));var u=void 0!==o&&null!==o?o:e.position;i=u+i>n.length?i-u:i,c.copy(n,r,u,u+i),void 0===o&&(e.position+=i),a(null,i)}}function u(e,n){e?a(e):(f=n,t.getBuffer(f.data,s))}var f,c;t.getObject(e.id,u)}function p(t,e,r){e=pe(e),me(e),o(t,e,n(r))}function g(t,e,r){t.getObject(e.id,n(r))}function m(t,e,r){function i(e,n){e?r(e):(s=n,t.getObject(s.data,a))}function a(i,o){i?r(i):(u=o,de(u).has(f)?t.getObject(u[f].id,n(r)):r(new Fe.ENOENT("a component of the path does not name an existing file",e)))}e=pe(e);var s,u,f=me(e),c=ge(e);Ie==f?o(t,e,n(r)):o(t,c,i)}function v(t,e,n,i){function a(e){e?i(e):r(t,n,y,{ctime:Date.now()},i)}function s(e,n){e?i(e):(y=n,y.nlinks+=1,t.putObject(y.id,y,a))}function u(e){e?i(e):t.getObject(b[_].id,s)}function f(e,n){e?i(e):(b=n,de(b).has(_)?i(new Fe.EEXIST("newpath resolves to an existing file",_)):(b[_]=m[h],t.putObject(v.data,b,u)))}function c(e,n){e?i(e):(v=n,t.getObject(v.data,f))}function l(e,n){e?i(e):(m=n,de(m).has(h)?o(t,w,c):i(new Fe.ENOENT("a component of either path prefix does not exist",h)))}function d(e,n){e?i(e):(g=n,t.getObject(g.data,l))}e=pe(e);var h=me(e),p=ge(e);n=pe(n);var g,m,v,b,y,_=me(n),w=ge(n);o(t,p,d)}function b(t,e,n){function i(e){e?n(e):(delete l[h],t.putObject(c.data,l,function(){var e=Date.now();r(t,p,c,{mtime:e,ctime:e},n)}))}function a(e){e?n(e):t.delete(d.data,i)}function s(o,s){o?n(o):(d=s,d.nlinks-=1,1>d.nlinks?t.delete(d.id,a):t.putObject(d.id,d,function(){r(t,e,d,{ctime:Date.now()},i)}))}function u(e,r){e?n(e):(l=r,de(l).has(h)?t.getObject(l[h].id,s):n(new Fe.ENOENT("a component of the path does not name an existing file",h)))}function f(e,r){e?n(e):(c=r,t.getObject(c.data,u))}e=pe(e);var c,l,d,h=me(e),p=ge(e);o(t,p,f)}function y(t,e,n){function r(t,e){if(t)n(t);else{s=e;var r=Object.keys(s);n(null,r)}}function i(i,o){i?n(i):o.mode!==we?n(new Fe.ENOTDIR(null,e)):(a=o,t.getObject(a.data,r))}e=pe(e),me(e);var a,s;o(t,e,i)}function _(t,e,n,i){function a(e,n){e?i(e):(l=n,t.getObject(l.data,s))}function s(t,e){t?i(t):(d=e,de(d).has(p)?i(new Fe.EEXIST(null,p)):u())}function u(){Ve.create({guid:t.guid,mode:Ee},function(n,r){return n?(i(n),void 0):(h=r,h.nlinks+=1,h.size=e.length,h.data=e,t.putObject(h.id,h,c),void 0)})}function f(e){if(e)i(e);else{var n=Date.now();r(t,g,l,{mtime:n,ctime:n},i)}}function c(e){e?i(e):(d[p]=new Me(h.id,Ee),t.putObject(l.data,d,f))}n=pe(n);var l,d,h,p=me(n),g=ge(n);Ie==p?i(new Fe.EEXIST(null,p)):o(t,g,a)}function w(t,e,n){function r(e,r){e?n(e):(s=r,t.getObject(s.data,i))}function i(e,r){e?n(e):(u=r,de(u).has(f)?t.getObject(u[f].id,a):n(new Fe.ENOENT("a component of the path does not name an existing file",f)))}function a(t,r){t?n(t):r.mode!=Ee?n(new Fe.EINVAL("path not a symbolic link",e)):n(null,r.data)}e=pe(e);var s,u,f=me(e),c=ge(e);o(t,c,r)}function E(t,e,n,i){function a(n,r){n?i(n):r.mode==we?i(new Fe.EISDIR(null,e)):(c=r,t.getBuffer(c.data,s))}function s(e,r){if(e)i(e);else{if(!r)return i(new Fe.EIO("Expected Buffer"));var o=new Ye(n);o.fill(0),r&&r.copy(o),t.putBuffer(c.data,o,f)}}function u(n){if(n)i(n);else{var o=Date.now();r(t,e,c,{mtime:o,ctime:o},i)}}function f(e){e?i(e):(c.size=n,c.version+=1,t.putObject(c.id,c,u))}e=pe(e);var c;0>n?i(new Fe.EINVAL("length cannot be negative")):o(t,e,a)}function x(t,e,n,i){function o(e,n){e?i(e):n.mode==we?i(new Fe.EISDIR):(f=n,t.getBuffer(f.data,a))}function a(e,r){if(e)i(e);else{var o;if(!r)return i(new Fe.EIO("Expected Buffer"));r?o=r.slice(0,n):(o=new Ye(n),o.fill(0)),t.putBuffer(f.data,o,u)}}function s(n){if(n)i(n);else{var o=Date.now();r(t,e.path,f,{mtime:o,ctime:o},i)}}function u(e){e?i(e):(f.size=n,f.version+=1,t.putObject(f.id,f,s))}var f;0>n?i(new Fe.EINVAL("length cannot be negative")):t.getObject(e.id,o)}function I(t,e,n,i,a){function s(o,s){o?a(o):r(t,e,s,{atime:n,ctime:i,mtime:i},a)}e=pe(e),"number"!=typeof n||"number"!=typeof i?a(new Fe.EINVAL("atime and mtime must be number",e)):0>n||0>i?a(new Fe.EINVAL("atime and mtime must be positive integers",e)):o(t,e,s)}function k(t,e,n,i,o){function a(a,s){a?o(a):r(t,e.path,s,{atime:n,ctime:i,mtime:i},o)}"number"!=typeof n||"number"!=typeof i?o(new Fe.EINVAL("atime and mtime must be a number")):0>n||0>i?o(new Fe.EINVAL("atime and mtime must be positive integers")):t.getObject(e.id,a)}function A(t,e,n,r,i,o){e=pe(e),"string"!=typeof n?o(new Fe.EINVAL("attribute name must be a string",e)):n?null!==i&&i!==Ne&&i!==De?o(new Fe.EINVAL("invalid flag, must be null, XATTR_CREATE or XATTR_REPLACE",e)):a(t,e,n,r,i,o):o(new Fe.EINVAL("attribute name cannot be an empty string",e))}function O(t,e,n,r,i,o){"string"!=typeof n?o(new Fe.EINVAL("attribute name must be a string")):n?null!==i&&i!==Ne&&i!==De?o(new Fe.EINVAL("invalid flag, must be null, XATTR_CREATE or XATTR_REPLACE")):a(t,e,n,r,i,o):o(new Fe.EINVAL("attribute name cannot be an empty string"))}function S(t,e,n,r){function i(t,i){i?i.xattrs[n]:null,t?r(t):i.xattrs.hasOwnProperty(n)?r(null,i.xattrs[n]):r(new Fe.ENOATTR(null,e))}e=pe(e),"string"!=typeof n?r(new Fe.EINVAL("attribute name must be a string",e)):n?o(t,e,i):r(new Fe.EINVAL("attribute name cannot be an empty string",e))}function T(t,e,n,r){function i(t,e){e?e.xattrs[n]:null,t?r(t):e.xattrs.hasOwnProperty(n)?r(null,e.xattrs[n]):r(new Fe.ENOATTR)}"string"!=typeof n?r(new Fe.EINVAL):n?t.getObject(e.id,i):r(new Fe.EINVAL("attribute name cannot be an empty string"))}function C(t,e,n,i){function a(o,a){function s(n){n?i(n):r(t,e,a,{ctime:Date.now()},i)}var u=a?a.xattrs:null;o?i(o):u.hasOwnProperty(n)?(delete a.xattrs[n],t.putObject(a.id,a,s)):i(new Fe.ENOATTR(null,e))}e=pe(e),"string"!=typeof n?i(new Fe.EINVAL("attribute name must be a string",e)):n?o(t,e,a):i(new Fe.EINVAL("attribute name cannot be an empty string",e))}function R(t,e,n,i){function o(o,a){function s(n){n?i(n):r(t,e.path,a,{ctime:Date.now()},i)}o?i(o):a.xattrs.hasOwnProperty(n)?(delete a.xattrs[n],t.putObject(a.id,a,s)):i(new Fe.ENOATTR)}"string"!=typeof n?i(new Fe.EINVAL("attribute name must be a string")):n?t.getObject(e.id,o):i(new Fe.EINVAL("attribute name cannot be an empty string"))}function j(t){return de(je).has(t)?je[t]:null}function N(t,e,n){return t?"function"==typeof t?t={encoding:e,flag:n}:"string"==typeof t&&(t={encoding:t,flag:n}):t={encoding:e,flag:n},t}function D(t,e){var n;return be(t)?n=new Fe.EINVAL("Path must be a string without null bytes.",t):ve(t)||(n=new Fe.EINAVL("Path must be absolute.",t)),n?(e(n),!1):!0}function B(t,e,n,r,i,o){function a(e,i){if(e)o(e);else{var a;a=de(r).contains(Re)?i.size:0;var s=new Ue(n,i.id,r,a),u=t.allocDescriptor(s);o(null,u)}}o=arguments[arguments.length-1],D(n,o)&&(r=j(r),r||o(new Fe.EINVAL("flags is not valid"),n),c(e,n,r,a))}function L(t,e,n,r){de(t.openFiles).has(n)?(t.releaseDescriptor(n),r(null)):r(new Fe.EBADF)
|
||
}function z(t,e,n,r,o){D(n,o)&&i(e,n,r,o)}function F(t,e,r,i,o){o=arguments[arguments.length-1],D(r,o)&&u(e,r,n(o))}function M(t,e,r,i){D(r,i)&&f(e,r,n(i))}function U(t,e,n,r){function i(e,n){if(e)r(e);else{var i=new Ze(n,t.name);r(null,i)}}D(n,r)&&p(e,n,i)}function P(t,e,n,r){function i(e,n){if(e)r(e);else{var i=new Ze(n,t.name);r(null,i)}}var o=t.openFiles[n];o?g(e,o,i):r(new Fe.EBADF)}function V(t,e,r,i,o){D(r,o)&&D(i,o)&&v(e,r,i,n(o))}function Z(t,e,r,i){D(r,i)&&b(e,r,n(i))}function Y(t,e,r,i,o,a,s,u){function f(t,e){u(t,e||0,i)}o=void 0===o?0:o,a=void 0===a?i.length-o:a,u=arguments[arguments.length-1];var c=t.openFiles[r];c?de(c.flags).contains(Oe)?h(e,c,i,o,a,s,n(f)):u(new Fe.EBADF("descriptor does not permit reading")):u(new Fe.EBADF)}function X(t,e,n,r,i){if(i=arguments[arguments.length-1],r=N(r,null,"r"),D(n,i)){var o=j(r.flag||"r");return o?(c(e,n,o,function(a,s){function u(){t.releaseDescriptor(c)}if(a)return i(a);var f=new Ue(n,s.id,o,0),c=t.allocDescriptor(f);g(e,f,function(o,a){if(o)return u(),i(o);var s=new Ze(a,t.name);if(s.isDirectory())return u(),i(new Fe.EISDIR("illegal operation on directory",n));var c=s.size,l=new Ye(c);l.fill(0),h(e,f,l,0,c,0,function(t){if(u(),t)return i(t);var e;e="utf8"===r.encoding?ze.decode(l):l,i(null,e)})})}),void 0):i(new Fe.EINVAL("flags is not valid",n))}}function H(t,e,r,i,o,a,s,u){u=arguments[arguments.length-1],o=void 0===o?0:o,a=void 0===a?i.length-o:a;var f=t.openFiles[r];f?de(f.flags).contains(Se)?a>i.length-o?u(new Fe.EIO("intput buffer is too small")):d(e,f,i,o,a,s,n(u)):u(new Fe.EBADF("descriptor does not permit writing")):u(new Fe.EBADF)}function W(t,e,n,r,i,o){if(o=arguments[arguments.length-1],i=N(i,"utf8","w"),D(n,o)){var a=j(i.flag||"w");if(!a)return o(new Fe.EINVAL("flags is not valid",n));r=r||"","number"==typeof r&&(r=""+r),"string"==typeof r&&"utf8"===i.encoding&&(r=ze.encode(r)),c(e,n,a,function(i,s){if(i)return o(i);var u=new Ue(n,s.id,a,0),f=t.allocDescriptor(u);l(e,u,r,0,r.length,function(e){return t.releaseDescriptor(f),e?o(e):(o(null),void 0)})})}}function q(t,e,n,r,i,o){if(o=arguments[arguments.length-1],i=N(i,"utf8","a"),D(n,o)){var a=j(i.flag||"a");if(!a)return o(new Fe.EINVAL("flags is not valid",n));r=r||"","number"==typeof r&&(r=""+r),"string"==typeof r&&"utf8"===i.encoding&&(r=ze.encode(r)),c(e,n,a,function(i,s){if(i)return o(i);var u=new Ue(n,s.id,a,s.size),f=t.allocDescriptor(u);d(e,u,r,0,r.length,u.position,function(e){return t.releaseDescriptor(f),e?o(e):(o(null),void 0)})})}}function J(t,e,n,r){function i(t){r(t?!1:!0)}U(t,e,n,i)}function K(t,e,r,i,o){D(r,o)&&S(e,r,i,n(o))}function G(t,e,r,i,o){var a=t.openFiles[r];a?T(e,a,i,n(o)):o(new Fe.EBADF)}function Q(t,e,r,i,o,a,s){"function"==typeof a&&(s=a,a=null),D(r,s)&&A(e,r,i,o,a,n(s))}function $(t,e,r,i,o,a,s){"function"==typeof a&&(s=a,a=null);var u=t.openFiles[r];u?de(u.flags).contains(Se)?O(e,u,i,o,a,n(s)):s(new Fe.EBADF("descriptor does not permit writing")):s(new Fe.EBADF)}function te(t,e,r,i,o){D(r,o)&&C(e,r,i,n(o))}function ee(t,e,r,i,o){var a=t.openFiles[r];a?de(a.flags).contains(Se)?R(e,a,i,n(o)):o(new Fe.EBADF("descriptor does not permit writing")):o(new Fe.EBADF)}function ne(t,e,n,r,i,o){function a(t,e){t?o(t):0>e.size+r?o(new Fe.EINVAL("resulting file offset would be negative")):(s.position=e.size+r,o(null,s.position))}var s=t.openFiles[n];s||o(new Fe.EBADF),"SET"===i?0>r?o(new Fe.EINVAL("resulting file offset would be negative")):(s.position=r,o(null,s.position)):"CUR"===i?0>s.position+r?o(new Fe.EINVAL("resulting file offset would be negative")):(s.position+=r,o(null,s.position)):"END"===i?g(e,s,a):o(new Fe.EINVAL("whence argument is not a proper value"))}function re(t,e,r,i){D(r,i)&&y(e,r,n(i))}function ie(t,e,r,i,o,a){if(D(r,a)){var s=Date.now();i=i?i:s,o=o?o:s,I(e,r,i,o,n(a))}}function oe(t,e,r,i,o,a){var s=Date.now();i=i?i:s,o=o?o:s;var u=t.openFiles[r];u?de(u.flags).contains(Se)?k(e,u,i,o,n(a)):a(new Fe.EBADF("descriptor does not permit writing")):a(new Fe.EBADF)}function ae(t,e,r,i,o){function a(t){t?o(t):b(e,r,n(o))}D(r,o)&&D(i,o)&&v(e,r,i,a)}function se(t,e,r,i,o,a){a=arguments[arguments.length-1],D(r,a)&&D(i,a)&&_(e,r,i,n(a))}function ue(t,e,r,i){D(r,i)&&w(e,r,n(i))}function fe(t,e,n,r){function i(e,n){if(e)r(e);else{var i=new Ze(n,t.name);r(null,i)}}D(n,r)&&m(e,n,i)}function ce(t,e,r,i,o){o=arguments[arguments.length-1],i=i||0,D(r,o)&&E(e,r,i,n(o))}function le(t,e,r,i,o){o=arguments[arguments.length-1],i=i||0;var a=t.openFiles[r];a?de(a.flags).contains(Se)?x(e,a,i,n(o)):o(new Fe.EBADF("descriptor does not permit writing")):o(new Fe.EBADF)}var de=t("../../lib/nodash.js"),he=t("../path.js"),pe=he.normalize,ge=he.dirname,me=he.basename,ve=he.isAbsolute,be=he.isNull,ye=t("../constants.js"),_e=ye.MODE_FILE,we=ye.MODE_DIRECTORY,Ee=ye.MODE_SYMBOLIC_LINK,xe=ye.MODE_META,Ie=ye.ROOT_DIRECTORY_NAME,ke=ye.SUPER_NODE_ID,Ae=ye.SYMLOOP_MAX,Oe=ye.O_READ,Se=ye.O_WRITE,Te=ye.O_CREATE,Ce=ye.O_EXCLUSIVE;ye.O_TRUNCATE;var Re=ye.O_APPEND,je=ye.O_FLAGS,Ne=ye.XATTR_CREATE,De=ye.XATTR_REPLACE,Be=ye.FS_NOMTIME,Le=ye.FS_NOCTIME,ze=t("../encoding.js"),Fe=t("../errors.js"),Me=t("../directory-entry.js"),Ue=t("../open-file-description.js"),Pe=t("../super-node.js"),Ve=t("../node.js"),Ze=t("../stats.js"),Ye=t("../buffer.js");e.exports={ensureRootDirectory:s,open:B,close:L,mknod:z,mkdir:F,rmdir:M,unlink:Z,stat:U,fstat:P,link:V,read:Y,readFile:X,write:H,writeFile:W,appendFile:q,exists:J,getxattr:K,fgetxattr:G,setxattr:Q,fsetxattr:$,removexattr:te,fremovexattr:ee,lseek:ne,readdir:re,utimes:ie,futimes:oe,rename:ae,symlink:se,readlink:ue,lstat:fe,truncate:ce,ftruncate:le}},{"../../lib/nodash.js":4,"../buffer.js":45,"../constants.js":46,"../directory-entry.js":47,"../encoding.js":48,"../errors.js":49,"../node.js":54,"../open-file-description.js":55,"../path.js":56,"../stats.js":65,"../super-node.js":66}],51:[function(t,e){function n(t){return"function"==typeof t?t:function(t){if(t)throw t}}function r(t,e){function n(){j.forEach(function(t){t.call(this)}.bind(T)),j=null}function r(t){return function(e){function n(e){var r=k();t.getObject(r,function(t,i){return t?(e(t),void 0):(i?n(e):e(null,r),void 0)})}return i(g).contains(h)?(e(null,k()),void 0):(n(e),void 0)}}function s(t){if(t.length){var e=m.getInstance();t.forEach(function(t){e.emit(t.event,t.path)})}}t=t||{},e=e||a;var g=t.flags,k=t.guid?t.guid:y,A=t.provider||new p.Default(t.name||u),O=t.name||A.name,S=i(g).contains(f),T=this;T.readyState=l,T.name=O,T.error=null,T.stdin=_,T.stdout=w,T.stderr=E;var C={},R=x;Object.defineProperty(this,"openFiles",{get:function(){return C}}),this.allocDescriptor=function(t){var e=R++;return C[e]=t,e},this.releaseDescriptor=function(t){delete C[t]};var j=[];this.queueOrRun=function(t){var e;return c==T.readyState?t.call(T):d==T.readyState?e=new b.EFILESYSTEMERROR("unknown error"):j.push(t),e},this.watch=function(t,e,n){if(o(t))throw Error("Path must be a string without null bytes.");"function"==typeof e&&(n=e,e={}),e=e||{},n=n||a;var r=new v;return r.start(t,!1,e.recursive),r.on("change",n),r},A.open(function(t,i){function o(t){function i(t){var e=A[t]();return e.flags=g,e.changes=[],e.guid=r(e),e.close=function(){var t=e.changes;s(t),t.length=0},e}T.provider={openReadWriteContext:function(){return i("getReadWriteContext")},openReadOnlyContext:function(){return i("getReadOnlyContext")}},T.readyState=t?d:c,n(),e(t,T)}if(t)return o(t);if(!S&&!i)return o(null);var a=A.getReadWriteContext();a.guid=r(a),a.clear(function(t){return t?(o(t),void 0):(I.ensureRootDirectory(a,o),void 0)})})}var i=t("../../lib/nodash.js"),o=t("../path.js").isNull,a=t("../shared.js").nop,s=t("../constants.js"),u=s.FILE_SYSTEM_NAME,f=s.FS_FORMAT,c=s.FS_READY,l=s.FS_PENDING,d=s.FS_ERROR,h=s.FS_NODUPEIDCHECK,p=t("../providers/index.js"),g=t("../shell/shell.js"),m=t("../../lib/intercom.js"),v=t("../fs-watcher.js"),b=t("../errors.js"),y=t("../shared.js").guid,_=s.STDIN,w=s.STDOUT,E=s.STDERR,x=s.FIRST_DESCRIPTOR,I=t("./implementation.js");r.providers=p,["open","close","mknod","mkdir","rmdir","stat","fstat","link","unlink","read","readFile","write","writeFile","appendFile","exists","lseek","readdir","rename","readlink","symlink","lstat","truncate","ftruncate","utimes","futimes","setxattr","getxattr","fsetxattr","fgetxattr","removexattr","fremovexattr"].forEach(function(t){r.prototype[t]=function(){var e=this,r=Array.prototype.slice.call(arguments,0),i=r.length-1,o="function"!=typeof r[i],a=n(r[i]),s=e.queueOrRun(function(){function n(){s.close(),a.apply(e,arguments)}var s=e.provider.openReadWriteContext();if(d===e.readyState){var u=new b.EFILESYSTEMERROR("filesystem unavailable, operation canceled");return a.call(e,u)}o?r.push(n):r[i]=n;var f=[e,s].concat(r);I[t].apply(null,f)});s&&a(s)}}),r.prototype.Shell=function(t){return new g(this,t)},e.exports=r},{"../../lib/intercom.js":3,"../../lib/nodash.js":4,"../constants.js":46,"../errors.js":49,"../fs-watcher.js":52,"../path.js":56,"../providers/index.js":57,"../shared.js":61,"../shell/shell.js":64,"./implementation.js":50}],52:[function(t,e){function n(){function t(t){(n===t||s&&0===t.indexOf(e))&&a.trigger("change","change",t)}r.call(this);var e,n,a=this,s=!1;a.start=function(r,a,u){if(!n){if(i.isNull(r))throw Error("Path must be a string without null bytes.");n=i.normalize(r),s=u===!0,s&&(e="/"===n?"/":n+"/");var f=o.getInstance();f.on("change",t)}},a.close=function(){var e=o.getInstance();e.off("change",t),a.removeAllListeners("change")}}var r=t("../lib/eventemitter.js"),i=t("./path.js"),o=t("../lib/intercom.js");n.prototype=new r,n.prototype.constructor=n,e.exports=n},{"../lib/eventemitter.js":2,"../lib/intercom.js":3,"./path.js":56}],53:[function(t,e){e.exports={FileSystem:t("./filesystem/interface.js"),Buffer:t("./buffer.js"),Path:t("./path.js"),Errors:t("./errors.js")}},{"./buffer.js":45,"./errors.js":49,"./filesystem/interface.js":51,"./path.js":56}],54:[function(t,e){function n(t){var e=Date.now();this.id=t.id,this.mode=t.mode||i,this.size=t.size||0,this.atime=t.atime||e,this.ctime=t.ctime||e,this.mtime=t.mtime||e,this.flags=t.flags||[],this.xattrs=t.xattrs||{},this.nlinks=t.nlinks||0,this.version=t.version||0,this.blksize=void 0,this.nblocks=1,this.data=t.data}function r(t,e,n){t[e]?n(null):t.guid(function(r,i){t[e]=i,n(r)})}var i=t("./constants.js").MODE_FILE;n.create=function(t,e){r(t,"id",function(i){return i?(e(i),void 0):(r(t,"data",function(r){return r?(e(r),void 0):(e(null,new n(t)),void 0)}),void 0)})},e.exports=n},{"./constants.js":46}],55:[function(t,e){e.exports=function(t,e,n,r){this.path=t,this.id=e,this.flags=n,this.position=r}},{}],56:[function(t,e,n){function r(t,e){for(var n=0,r=t.length-1;r>=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function i(){for(var t="",e=!1,n=arguments.length-1;n>=-1&&!e;n--){var i=n>=0?arguments[n]:"/";"string"==typeof i&&i&&(t=i+"/"+t,e="/"===i.charAt(0))}return t=r(t.split("/").filter(function(t){return!!t}),!e).join("/"),(e?"/":"")+t||"."}function o(t){var e="/"===t.charAt(0);return"/"===t.substr(-1),t=r(t.split("/").filter(function(t){return!!t}),!e).join("/"),t||e||(t="."),(e?"/":"")+t}function a(){var t=Array.prototype.slice.call(arguments,0);return o(t.filter(function(t){return t&&"string"==typeof t}).join("/"))}function s(t,e){function r(t){for(var e=0;t.length>e&&""===t[e];e++);for(var n=t.length-1;n>=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=n.resolve(t).substr(1),e=n.resolve(e).substr(1);for(var i=r(t.split("/")),o=r(e.split("/")),a=Math.min(i.length,o.length),s=a,u=0;a>u;u++)if(i[u]!==o[u]){s=u;break}for(var f=[],u=s;i.length>u;u++)f.push("..");return f=f.concat(o.slice(s)),f.join("/")}function u(t){var e=p(t),n=e[0],r=e[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."}function f(t,e){var n=p(t)[2];return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),""===n?"/":n}function c(t){return p(t)[3]}function l(t){return"/"===t.charAt(0)?!0:!1}function d(t){return-1!==(""+t).indexOf("\0")?!0:!1}var h=/^(\/?)([\s\S]+\/(?!$)|\/)?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/]*)?)$/,p=function(t){var e=h.exec(t);return[e[1]||"",e[2]||"",e[3]||"",e[4]||""]};e.exports={normalize:o,resolve:i,join:a,relative:s,sep:"/",delimiter:":",dirname:u,basename:f,extname:c,isAbsolute:l,isNull:d}},{}],57:[function(t,e){var n=t("./indexeddb.js"),r=t("./websql.js"),i=t("./memory.js");e.exports={IndexedDB:n,WebSQL:r,Memory:i,Default:n,Fallback:function(){function t(){throw"[Filer Error] Your browser doesn't support IndexedDB or WebSQL."}return n.isSupported()?n:r.isSupported()?r:(t.isSupported=function(){return!1},t)}()}},{"./indexeddb.js":58,"./memory.js":59,"./websql.js":60}],58:[function(t,e){(function(n){function r(t,e){var n=t.transaction(u,e);this.objectStore=n.objectStore(u)}function i(t,e,n){try{var r=t.get(e);r.onsuccess=function(t){var e=t.target.result;n(null,e)},r.onerror=function(t){n(t)}}catch(i){n(i)}}function o(t,e,n,r){try{var i=t.put(n,e);i.onsuccess=function(t){var e=t.target.result;r(null,e)},i.onerror=function(t){r(t)}}catch(o){r(o)}}function a(t){this.name=t||s,this.db=null}var s=t("../constants.js").FILE_SYSTEM_NAME,u=t("../constants.js").FILE_STORE_NAME,f=t("../constants.js").IDB_RW;t("../constants.js").IDB_RO;var c=t("../errors.js"),l=t("../buffer.js"),d=n.indexedDB||n.mozIndexedDB||n.webkitIndexedDB||n.msIndexedDB;r.prototype.clear=function(t){try{var e=this.objectStore.clear();e.onsuccess=function(){t()},e.onerror=function(e){t(e)}}catch(n){t(n)}},r.prototype.getObject=function(t,e){i(this.objectStore,t,e)},r.prototype.getBuffer=function(t,e){i(this.objectStore,t,function(t,n){return t?e(t):(e(null,new l(n)),void 0)})},r.prototype.putObject=function(t,e,n){o(this.objectStore,t,e,n)},r.prototype.putBuffer=function(t,e,n){o(this.objectStore,t,e.buffer,n)},r.prototype.delete=function(t,e){try{var n=this.objectStore.delete(t);n.onsuccess=function(t){var n=t.target.result;e(null,n)},n.onerror=function(t){e(t)}}catch(r){e(r)}},a.isSupported=function(){return!!d},a.prototype.open=function(t){var e=this;if(e.db)return t(null,!1),void 0;var n=!1,r=d.open(e.name);r.onupgradeneeded=function(t){var e=t.target.result;e.objectStoreNames.contains(u)&&e.deleteObjectStore(u),e.createObjectStore(u),n=!0},r.onsuccess=function(r){e.db=r.target.result,t(null,n)},r.onerror=function(){t(new c.EINVAL("IndexedDB cannot be accessed. If private browsing is enabled, disable it."))}},a.prototype.getReadOnlyContext=function(){return new r(this.db,f)},a.prototype.getReadWriteContext=function(){return new r(this.db,f)},e.exports=a}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../buffer.js":45,"../constants.js":46,"../errors.js":49}],59:[function(t,e){function n(t,e){this.readOnly=e,this.objectStore=t}function r(t){this.name=t||i}var i=t("../constants.js").FILE_SYSTEM_NAME,o=t("../../lib/async.js").setImmediate,a=function(){var t={};return function(e){var n=!t.hasOwnProperty(e);return n&&(t[e]={}),{firstAccess:n,db:t[e]}}}();n.prototype.clear=function(t){if(this.readOnly)return o(function(){t("[MemoryContext] Error: write operation on read only context")}),void 0;var e=this.objectStore;Object.keys(e).forEach(function(t){delete e[t]}),o(t)},n.prototype.getObject=n.prototype.getBuffer=function(t,e){var n=this;o(function(){e(null,n.objectStore[t])})},n.prototype.putObject=n.prototype.putBuffer=function(t,e,n){return this.readOnly?(o(function(){n("[MemoryContext] Error: write operation on read only context")}),void 0):(this.objectStore[t]=e,o(n),void 0)},n.prototype.delete=function(t,e){return this.readOnly?(o(function(){e("[MemoryContext] Error: write operation on read only context")}),void 0):(delete this.objectStore[t],o(e),void 0)},r.isSupported=function(){return!0},r.prototype.open=function(t){var e=a(this.name);this.db=e.db,o(function(){t(null,e.firstAccess)})},r.prototype.getReadOnlyContext=function(){return new n(this.db,!0)},r.prototype.getReadWriteContext=function(){return new n(this.db,!1)},e.exports=r},{"../../lib/async.js":1,"../constants.js":46}],60:[function(t,e){(function(n){function r(t,e){var n=this;this.getTransaction=function(r){return n.transaction?(r(n.transaction),void 0):(t[e?"readTransaction":"transaction"](function(t){n.transaction=t,r(t)}),void 0)}}function i(t,e,n){function r(t,e){var r=0===e.rows.length?null:e.rows.item(0).data;n(null,r)}function i(t,e){n(e)}t(function(t){t.executeSql("SELECT data FROM "+u+" WHERE id = ? LIMIT 1;",[e],r,i)})}function o(t,e,n,r){function i(){r(null)}function o(t,e){r(e)}t(function(t){t.executeSql("INSERT OR REPLACE INTO "+u+" (id, data) VALUES (?, ?);",[e,n],i,o)})}function a(t){this.name=t||s,this.db=null}var s=t("../constants.js").FILE_SYSTEM_NAME,u=t("../constants.js").FILE_STORE_NAME,f=t("../constants.js").WSQL_VERSION,c=t("../constants.js").WSQL_SIZE,l=t("../constants.js").WSQL_DESC,d=t("../errors.js"),h=t("../buffer.js"),p=t("base64-arraybuffer");r.prototype.clear=function(t){function e(e,n){t(n)}function n(){t(null)}this.getTransaction(function(t){t.executeSql("DELETE FROM "+u+";",[],n,e)})},r.prototype.getObject=function(t,e){i(this.getTransaction,t,function(t,n){if(t)return e(t);try{n&&(n=JSON.parse(n))}catch(r){return e(r)}e(null,n)})},r.prototype.getBuffer=function(t,e){i(this.getTransaction,t,function(t,n){if(t)return e(t);if(n||""===n){var r=p.decode(n);n=new h(r)}e(null,n)})},r.prototype.putObject=function(t,e,n){var r=JSON.stringify(e);o(this.getTransaction,t,r,n)},r.prototype.putBuffer=function(t,e,n){var r=p.encode(e.buffer);o(this.getTransaction,t,r,n)},r.prototype.delete=function(t,e){function n(){e(null)}function r(t,n){e(n)}this.getTransaction(function(e){e.executeSql("DELETE FROM "+u+" WHERE id = ?;",[t],n,r)})},a.isSupported=function(){return!!n.openDatabase},a.prototype.open=function(t){function e(e,n){5===n.code&&t(new d.EINVAL("WebSQL cannot be accessed. If private browsing is enabled, disable it.")),t(n)}function r(e){function n(e,n){var r=0===n.rows.item(0).count;t(null,r)}function r(e,n){t(n)}i.db=o,e.executeSql("SELECT COUNT(id) AS count FROM "+u+";",[],n,r)}var i=this;if(i.db)return t(null,!1),void 0;var o=n.openDatabase(i.name,f,l,c);return o?(o.transaction(function(t){function n(t){t.executeSql("CREATE INDEX IF NOT EXISTS idx_"+u+"_id"+" on "+u+" (id);",[],r,e)}t.executeSql("CREATE TABLE IF NOT EXISTS "+u+" (id unique, data TEXT);",[],n,e)}),void 0):(t("[WebSQL] Unable to open database."),void 0)},a.prototype.getReadOnlyContext=function(){return new r(this.db,!0)},a.prototype.getReadWriteContext=function(){return new r(this.db,!1)},e.exports=a}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../buffer.js":45,"../constants.js":46,"../errors.js":49,"base64-arraybuffer":5}],61:[function(t,e){function n(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=0|16*Math.random(),n="x"==t?e:8|3&e;return n.toString(16)}).toUpperCase()}function r(){}function i(t){for(var e=[],n=t.length,r=0;n>r;r++)e[r]=t[r];return e}e.exports={guid:n,u8toArray:i,nop:r}},{}],62:[function(t,e){var n=t("../constants.js").ENVIRONMENT;e.exports=function(t){t=t||{},t.TMP=t.TMP||n.TMP,t.PATH=t.PATH||n.PATH,this.get=function(e){return t[e]},this.set=function(e,n){t[e]=n}}},{"../constants.js":46}],63:[function(t,e){var n=t("request");e.exports.download=function(t,e){n({url:t,method:"GET",encoding:null},function(t,n,r){var i,o;return n=n||null,i=n&&n.statusCode,(o=200!==i?{message:t||"Not found!",code:i}:null)?(e(o,null),void 0):(e(null,r),void 0)})}},{request:6}],64:[function(t,e){function n(t,e){e=e||{};var n=new o(e.env),a="/";Object.defineProperty(this,"fs",{get:function(){return t},enumerable:!0}),Object.defineProperty(this,"env",{get:function(){return n},enumerable:!0}),this.cd=function(e,n){e=r.resolve(a,e),t.stat(e,function(t,r){return t?(n(new i.ENOTDIR(null,e)),void 0):("DIRECTORY"===r.type?(a=e,n()):n(new i.ENOTDIR(null,e)),void 0)})},this.pwd=function(){return a}}var r=t("../path.js"),i=t("../errors.js"),o=t("./environment.js"),a=t("../../lib/async.js"),s=t("./network.js");t("../encoding.js");var u=t("jszip");n.prototype.exec=function(t,e,n){var i=this,o=i.fs;"function"==typeof e&&(n=e,e=[]),e=e||[],n=n||function(){},t=r.resolve(i.pwd(),t),o.readFile(t,"utf8",function(t,r){if(t)return n(t),void 0;try{var i=Function("fs","args","callback",r);i(o,e,n)}catch(a){n(a)}})},n.prototype.touch=function(t,e,n){function i(t){s.writeFile(t,"",n)}function o(t){var r=Date.now(),i=e.date||r,o=e.date||r;s.utimes(t,i,o,n)}var a=this,s=a.fs;"function"==typeof e&&(n=e,e={}),e=e||{},n=n||function(){},t=r.resolve(a.pwd(),t),s.stat(t,function(r){r?e.updateOnly===!0?n():i(t):o(t)})},n.prototype.cat=function(t,e){function n(t,e){var n=r.resolve(o.pwd(),t);s.readFile(n,"utf8",function(t,n){return t?(e(t),void 0):(u+=n+"\n",e(),void 0)})}var o=this,s=o.fs,u="";return e=e||function(){},t?(t="string"==typeof t?[t]:t,a.eachSeries(t,n,function(t){t?e(t):e(null,u.replace(/\n$/,""))}),void 0):(e(new i.EINVAL("Missing files argument")),void 0)},n.prototype.ls=function(t,e,n){function o(t,n){var i=r.resolve(s.pwd(),t),f=[];u.readdir(i,function(t,s){function c(t,n){t=r.join(i,t),u.stat(t,function(a,s){if(a)return n(a),void 0;var u={path:r.basename(t),links:s.nlinks,size:s.size,modified:s.mtime,type:s.type};e.recursive&&"DIRECTORY"===s.type?o(r.join(i,u.path),function(t,e){return t?(n(t),void 0):(u.contents=e,f.push(u),n(),void 0)}):(f.push(u),n())})}return t?(n(t),void 0):(a.eachSeries(s,c,function(t){n(t,f)}),void 0)})}var s=this,u=s.fs;return"function"==typeof e&&(n=e,e={}),e=e||{},n=n||function(){},t?(o(t,n),void 0):(n(new i.EINVAL("Missing dir argument")),void 0)},n.prototype.rm=function(t,e,n){function o(t,n){t=r.resolve(s.pwd(),t),u.stat(t,function(s,f){return s?(n(s),void 0):"FILE"===f.type?(u.unlink(t,n),void 0):(u.readdir(t,function(s,f){return s?(n(s),void 0):0===f.length?(u.rmdir(t,n),void 0):e.recursive?(f=f.map(function(e){return r.join(t,e)}),a.eachSeries(f,o,function(e){return e?(n(e),void 0):(u.rmdir(t,n),void 0)}),void 0):(n(new i.ENOTEMPTY(null,t)),void 0)}),void 0)})}var s=this,u=s.fs;return"function"==typeof e&&(n=e,e={}),e=e||{},n=n||function(){},t?(o(t,n),void 0):(n(new i.EINVAL("Missing path argument")),void 0)},n.prototype.tempDir=function(t){var e=this,n=e.fs,r=e.env.get("TMP");t=t||function(){},n.mkdir(r,function(){t(null,r)})},n.prototype.mkdirp=function(t,e){function n(t,e){a.stat(t,function(o,s){if(s){if(s.isDirectory())return e(),void 0;if(s.isFile())return e(new i.ENOTDIR(null,t)),void 0}else{if(o&&"ENOENT"!==o.code)return e(o),void 0;var u=r.dirname(t);"/"===u?a.mkdir(t,function(t){return t&&"EEXIST"!=t.code?(e(t),void 0):(e(),void 0)}):n(u,function(n){return n?e(n):(a.mkdir(t,function(t){return t&&"EEXIST"!=t.code?(e(t),void 0):(e(),void 0)}),void 0)})}})}var o=this,a=o.fs;return e=e||function(){},t?"/"===t?(e(),void 0):(n(t,e),void 0):(e(new i.EINVAL("Missing path argument")),void 0)},n.prototype.wget=function(t,e,n){function o(){n(Error("unable to get resource"))}var a=this,u=a.fs;if("function"==typeof e&&(n=e,e={}),e=e||{},n=n||function(){},!t)return n(new i.EINVAL("Missing url argument")),void 0;var f=e.filename||t.split("/").pop();f=r.resolve(a.pwd(),f),s.download(t,function(t,e){return t||!e?o():(u.writeFile(f,e,function(t){t?n(t):n(null,f)}),void 0)})},n.prototype.unzip=function(t,e,n){var o=this,s=o.fs;if("function"==typeof e&&(n=e,e={}),e=e||{},n=n||function(){},!t)return n(new i.EINVAL("Missing zipfile argument")),void 0;var f=r.resolve(o.pwd(),t),c=r.resolve(e.destination||o.pwd());s.readFile(f,function(t,e){function i(t,e){t.isDirectory?o.mkdirp(t.absPath,e):s.writeFile(t.absPath,t.data,e)}if(t)return n(t);var f=new u(e),l=[];f.filter(function(t,e){var n=e.options.dir,i=n?null:e.asNodeBuffer();l.push({absPath:r.join(c,e.name),isDirectory:n,data:i})}),a.eachSeries(l,i,n)})},n.prototype.zip=function(t,e,n,o){function s(t){return t.replace(/^\//,"")}function f(t,e){h.readFile(t,function(n,r){return n?e(n):(p.file(s(t),r,{binary:!0}),e(),void 0)})}function c(t,e){h.readdir(t,function(i,o){p.folder(s(t)),n.recursive||e(),a.eachSeries(o,function(e,n){l(r.join(t,e),n)},e)})}function l(t,e){t=r.resolve(d.pwd(),t),h.stat(t,function(n,r){return n?e(n):(r.isDirectory()?c(t,e):f(t,e),void 0)})}var d=this,h=d.fs;if("function"==typeof n&&(o=n,n={}),n=n||{},o=o||function(){},!t)return o(new i.EINVAL("Missing zipfile argument")),void 0;if(!e)return o(new i.EINVAL("Missing paths argument")),void 0;"string"==typeof e&&(e=[e]),t=r.resolve(d.pwd(),t);var p=new u;h.exists(t,function(n){return n?o(new i.EEXIST("zipfile already exists",t)):(a.eachSeries(e,l,function(e){if(e)return o(e);var n;n=p.generate({type:"nodebuffer"}),h.writeFile(t,n,o)}),void 0)})},e.exports=n},{"../../lib/async.js":1,"../encoding.js":48,"../errors.js":49,"../path.js":56,"./environment.js":62,"./network.js":63,jszip:17}],65:[function(t,e){function n(t,e){this.node=t.id,this.dev=e,this.size=t.size,this.nlinks=t.nlinks,this.atime=t.atime,this.mtime=t.mtime,this.ctime=t.ctime,this.type=t.mode}var r=t("./constants.js");n.prototype.isFile=function(){return this.type===r.MODE_FILE},n.prototype.isDirectory=function(){return this.type===r.MODE_DIRECTORY},n.prototype.isSymbolicLink=function(){return this.type===r.MODE_SYMBOLIC_LINK},n.prototype.isSocket=n.prototype.isFIFO=n.prototype.isCharacterDevice=n.prototype.isBlockDevice=function(){return!1},e.exports=n},{"./constants.js":46}],66:[function(t,e){function n(t){var e=Date.now();this.id=r.SUPER_NODE_ID,this.mode=r.MODE_META,this.atime=t.atime||e,this.ctime=t.ctime||e,this.mtime=t.mtime||e,this.rnode=t.rnode}var r=t("./constants.js");n.create=function(t,e){t.guid(function(r,i){return r?(e(r),void 0):(t.rnode=t.rnode||i,e(null,new n(t)),void 0)})},e.exports=n},{"./constants.js":46}]},{},[53])(53)}); |