/*! ExcelJS 04-06-2020 */ "use strict";function _createForOfIteratorHelper2(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=_unsupportedIterableToArray2(e))){var t=0,r=function(){};return{s:r,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,i,o=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}function _toConsumableArray2(e){return _arrayWithoutHoles2(e)||_iterableToArray2(e)||_unsupportedIterableToArray2(e)||_nonIterableSpread2()}function _nonIterableSpread2(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray2(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray2(e,t):void 0}}function _iterableToArray2(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _arrayWithoutHoles2(e){if(Array.isArray(e))return _arrayLikeToArray2(e)}function _arrayLikeToArray2(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&void 0!==arguments[2]?arguments[2]:0;if(n(this,e),r)if("string"==typeof r){var a=o.decodeAddress(r);this.nativeCol=a.col+i,this.nativeColOff=0,this.nativeRow=a.row+i,this.nativeRowOff=0}else void 0!==r.nativeCol?(this.nativeCol=r.nativeCol||0,this.nativeColOff=r.nativeColOff||0,this.nativeRow=r.nativeRow||0,this.nativeRowOff=r.nativeRowOff||0):void 0!==r.col?(this.col=r.col+i,this.row=r.row+i):(this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0);else this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0;this.worksheet=t}var t,r,a;return t=e,a=[{key:"asInstance",value:function(t){return t instanceof e||null==t?t:new e(t)}}],(r=[{key:"col",get:function(){return this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth},set:function(e){this.nativeCol=Math.floor(e),this.nativeColOff=Math.floor((e-this.nativeCol)*this.colWidth)}},{key:"row",get:function(){return this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight},set:function(e){this.nativeRow=Math.floor(e),this.nativeRowOff=Math.floor((e-this.nativeRow)*this.rowHeight)}},{key:"colWidth",get:function(){return this.worksheet&&this.worksheet.getColumn(this.nativeCol+1)&&this.worksheet.getColumn(this.nativeCol+1).isCustomWidth?Math.floor(1e4*this.worksheet.getColumn(this.nativeCol+1).width):64e4}},{key:"rowHeight",get:function(){return this.worksheet&&this.worksheet.getRow(this.nativeRow+1)&&this.worksheet.getRow(this.nativeRow+1).height?Math.floor(1e4*this.worksheet.getRow(this.nativeRow+1).height):18e4}},{key:"model",get:function(){return{nativeCol:this.nativeCol,nativeColOff:this.nativeColOff,nativeRow:this.nativeRow,nativeRowOff:this.nativeRowOff}},set:function(e){this.nativeCol=e.nativeCol,this.nativeColOff=e.nativeColOff,this.nativeRow=e.nativeRow,this.nativeRowOff=e.nativeRowOff}}])&&i(t.prototype,r),a&&i(t,a),e}();t.exports=a},{"../utils/col-cache":17}],3:[function(e,t,r){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r0||this.type===e.Types.Merge}},{key:"master",get:function(){return this.type===e.Types.Merge?this._value.master:this}},{key:"isHyperlink",get:function(){return this._value.type===e.Types.Hyperlink}},{key:"hyperlink",get:function(){return this._value.hyperlink}},{key:"value",get:function(){return this._value.value},set:function(t){this.type!==e.Types.Merge?(this._value.release(),this._value=S.create(S.getType(t),this,t)):this._value.master.value=t}},{key:"note",get:function(){return this._comment&&this._comment.note},set:function(e){this._comment=new f(e)}},{key:"text",get:function(){return this._value.toString()}},{key:"html",get:function(){return s.escapeHtml(this.text)}},{key:"formula",get:function(){return this._value.formula}},{key:"result",get:function(){return this._value.result}},{key:"formulaType",get:function(){return this._value.formulaType}},{key:"fullAddress",get:function(){return{sheetName:this._row.worksheet.name,address:this.address,row:this.row,col:this.col}}},{key:"name",get:function(){return this.names[0]},set:function(e){this.names=[e]}},{key:"names",get:function(){return this.workbook.definedNames.getNamesEx(this.fullAddress)},set:function(e){var t=this,r=this.workbook.definedNames;r.removeAllNames(this.fullAddress),e.forEach((function(e){r.addEx(t.fullAddress,e)}))}},{key:"_dataValidations",get:function(){return this.worksheet.dataValidations}},{key:"dataValidation",get:function(){return this._dataValidations.find(this.address)},set:function(e){this._dataValidations.add(this.address,e)}},{key:"model",get:function(){var e=this._value.model;return e.style=this.style,this._comment&&(e.comment=this._comment.model),e},set:function(e){if(this._value.release(),this._value=S.create(e.type,this),this._value.model=e,e.comment)switch(e.comment.type){case"note":this._comment=f.fromModel(e.comment)}e.style?this.style=e.style:this.style={}}}]),e}();l.Types=u.ValueType;var h=function(){function e(t){n(this,e),this.model={address:t.address,type:l.Types.Null}}return o(e,[{key:"toCsvString",value:function(){return""}},{key:"release",value:function(){}},{key:"toString",value:function(){return""}},{key:"value",get:function(){return null},set:function(e){}},{key:"type",get:function(){return l.Types.Null}},{key:"effectiveType",get:function(){return l.Types.Null}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),d=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.Number,value:r}}return o(e,[{key:"toCsvString",value:function(){return this.model.value.toString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}},{key:"value",get:function(){return this.model.value},set:function(e){this.model.value=e}},{key:"type",get:function(){return l.Types.Number}},{key:"effectiveType",get:function(){return l.Types.Number}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),p=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.String,value:r}}return o(e,[{key:"toCsvString",value:function(){return'"'.concat(this.model.value.replace(/"/g,'""'),'"')}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value}},{key:"value",get:function(){return this.model.value},set:function(e){this.model.value=e}},{key:"type",get:function(){return l.Types.String}},{key:"effectiveType",get:function(){return l.Types.String}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),m=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.String,value:r}}return o(e,[{key:"toString",value:function(){return this.model.value.richText.map((function(e){return e.text})).join("")}},{key:"toCsvString",value:function(){return'"'.concat(this.text.replace(/"/g,'""'),'"')}},{key:"release",value:function(){}},{key:"value",get:function(){return this.model.value},set:function(e){this.model.value=e}},{key:"type",get:function(){return l.Types.RichText}},{key:"effectiveType",get:function(){return l.Types.RichText}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),y=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.Date,value:r}}return o(e,[{key:"toCsvString",value:function(){return this.model.value.toISOString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}},{key:"value",get:function(){return this.model.value},set:function(e){this.model.value=e}},{key:"type",get:function(){return l.Types.Date}},{key:"effectiveType",get:function(){return l.Types.Date}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),b=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.Hyperlink,text:r?r.text:void 0,hyperlink:r?r.hyperlink:void 0},r&&r.tooltip&&(this.model.tooltip=r.tooltip)}return o(e,[{key:"toCsvString",value:function(){return this.model.hyperlink}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.text}},{key:"value",get:function(){var e={text:this.model.text,hyperlink:this.model.hyperlink};return this.model.tooltip&&(e.tooltip=this.model.tooltip),e},set:function(e){this.model={text:e.text,hyperlink:e.hyperlink},e.tooltip&&(this.model.tooltip=e.tooltip)}},{key:"text",get:function(){return this.model.text},set:function(e){this.model.text=e}},{key:"hyperlink",get:function(){return this.model.hyperlink},set:function(e){this.model.hyperlink=e}},{key:"type",get:function(){return l.Types.Hyperlink}},{key:"effectiveType",get:function(){return l.Types.Hyperlink}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),v=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.Merge,master:r?r.address:void 0},this._master=r,r&&r.addMergeRef()}return o(e,[{key:"isMergedTo",value:function(e){return e===this._master}},{key:"toCsvString",value:function(){return""}},{key:"release",value:function(){this._master.releaseMergeRef()}},{key:"toString",value:function(){return this.value.toString()}},{key:"value",get:function(){return this._master.value},set:function(e){e instanceof l?(this._master&&this._master.releaseMergeRef(),e.addMergeRef(),this._master=e):this._master.value=e}},{key:"master",get:function(){return this._master}},{key:"type",get:function(){return l.Types.Merge}},{key:"effectiveType",get:function(){return this._master.effectiveType}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),g=function(){function e(t,r){n(this,e),this.cell=t,this.model={address:t.address,type:l.Types.Formula,shareType:r?r.shareType:void 0,ref:r?r.ref:void 0,formula:r?r.formula:void 0,sharedFormula:r?r.sharedFormula:void 0,result:r?r.result:void 0}}return o(e,[{key:"_copyModel",value:function(e){var t={},r=function(r){var n=e[r];n&&(t[r]=n)};return r("formula"),r("result"),r("ref"),r("shareType"),r("sharedFormula"),t}},{key:"validate",value:function(e){switch(S.getType(e)){case l.Types.Null:case l.Types.String:case l.Types.Number:case l.Types.Date:break;case l.Types.Hyperlink:case l.Types.Formula:default:throw new Error("Cannot process that type of result value")}}},{key:"_getTranslatedFormula",value:function(){if(!this._translatedFormula&&this.model.sharedFormula){var e=this.cell.worksheet.findCell(this.model.sharedFormula);this._translatedFormula=e&&c(e.formula,e.address,this.model.address)}return this._translatedFormula}},{key:"toCsvString",value:function(){return"".concat(this.model.result||"")}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.result?this.model.result.toString():""}},{key:"value",get:function(){return this._copyModel(this.model)},set:function(e){this.model=this._copyModel(e)}},{key:"dependencies",get:function(){return{ranges:this.formula.match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g),cells:this.formula.replace(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g,"").match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}/g)}}},{key:"formula",get:function(){return this.model.formula||this._getTranslatedFormula()},set:function(e){this.model.formula=e}},{key:"formulaType",get:function(){return this.model.formula?u.FormulaType.Master:this.model.sharedFormula?u.FormulaType.Shared:u.FormulaType.None}},{key:"result",get:function(){return this.model.result},set:function(e){this.model.result=e}},{key:"type",get:function(){return l.Types.Formula}},{key:"effectiveType",get:function(){var e=this.model.result;return null==e?u.ValueType.Null:e instanceof String||"string"==typeof e?u.ValueType.String:"number"==typeof e?u.ValueType.Number:e instanceof Date?u.ValueType.Date:e.text&&e.hyperlink?u.ValueType.Hyperlink:e.formula?u.ValueType.Formula:u.ValueType.Null}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),w=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.SharedString,value:r}}return o(e,[{key:"toCsvString",value:function(){return this.model.value.toString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}},{key:"value",get:function(){return this.model.value},set:function(e){this.model.value=e}},{key:"type",get:function(){return l.Types.SharedString}},{key:"effectiveType",get:function(){return l.Types.SharedString}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),_=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.Boolean,value:r}}return o(e,[{key:"toCsvString",value:function(){return this.model.value?1:0}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}},{key:"value",get:function(){return this.model.value},set:function(e){this.model.value=e}},{key:"type",get:function(){return l.Types.Boolean}},{key:"effectiveType",get:function(){return l.Types.Boolean}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),k=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.Error,value:r}}return o(e,[{key:"toCsvString",value:function(){return this.toString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.error.toString()}},{key:"value",get:function(){return this.model.value},set:function(e){this.model.value=e}},{key:"type",get:function(){return l.Types.Error}},{key:"effectiveType",get:function(){return l.Types.Error}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),x=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.String,value:JSON.stringify(r),rawValue:r}}return o(e,[{key:"toCsvString",value:function(){return this.model.value}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value}},{key:"value",get:function(){return this.model.rawValue},set:function(e){this.model.rawValue=e,this.model.value=JSON.stringify(e)}},{key:"type",get:function(){return l.Types.String}},{key:"effectiveType",get:function(){return l.Types.String}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),S={getType:function(e){return null==e?l.Types.Null:e instanceof String||"string"==typeof e?l.Types.String:"number"==typeof e?l.Types.Number:"boolean"==typeof e?l.Types.Boolean:e instanceof Date?l.Types.Date:e.text&&e.hyperlink?l.Types.Hyperlink:e.formula||e.sharedFormula?l.Types.Formula:e.richText?l.Types.RichText:e.sharedString?l.Types.SharedString:e.error?l.Types.Error:l.Types.JSON},types:[{t:l.Types.Null,f:h},{t:l.Types.Number,f:d},{t:l.Types.String,f:p},{t:l.Types.Date,f:y},{t:l.Types.Hyperlink,f:b},{t:l.Types.Formula,f:g},{t:l.Types.Merge,f:v},{t:l.Types.JSON,f:x},{t:l.Types.SharedString,f:w},{t:l.Types.RichText,f:m},{t:l.Types.Boolean,f:_},{t:l.Types.Error,f:k}].reduce((function(e,t){return e[t.t]=t.f,e}),[]),create:function(e,t,r){var n=this.types[e];if(!n)throw new Error("Could not create Value of type ".concat(e));return new n(t,r)}};t.exports=l},{"../utils/col-cache":17,"../utils/shared-formula":20,"../utils/under-dash":23,"./enums":7,"./note":9}],4:[function(e,t,r){function n(e,t){for(var r=0;r=this._worksheet.properties.outlineLevelCol)}},{key:"isDefault",get:function(){if(this.isCustomWidth)return!1;if(this.hidden)return!1;if(this.outlineLevel)return!1;var e=this.style;return!e||!(e.font||e.numFmt||e.alignment||e.border||e.fill||e.protection)}},{key:"headerCount",get:function(){return this.headers.length}},{key:"values",get:function(){var e=[];return this.eachCell((function(t,r){t&&t.type!==o.ValueType.Null&&(e[r]=t.value)})),e},set:function(e){var t=this;if(e){var r=this.number,n=0;e.hasOwnProperty("0")&&(n=1),e.forEach((function(e,i){t._worksheet.getCell(i+n,r).value=e}))}}},{key:"numFmt",get:function(){return this.style.numFmt},set:function(e){this._applyStyle("numFmt",e)}},{key:"font",get:function(){return this.style.font},set:function(e){this._applyStyle("font",e)}},{key:"alignment",get:function(){return this.style.alignment},set:function(e){this._applyStyle("alignment",e)}},{key:"protection",get:function(){return this.style.protection},set:function(e){this._applyStyle("protection",e)}},{key:"border",get:function(){return this.style.border},set:function(e){this._applyStyle("border",e)}},{key:"fill",get:function(){return this.style.fill},set:function(e){this._applyStyle("fill",e)}}])&&n(t.prototype,r),s&&n(t,s),e}();t.exports=s},{"../utils/col-cache":17,"../utils/under-dash":23,"./enums":7}],5:[function(e,t,r){function n(e,t){for(var r=0;rthis.bottom)&&(this.bottom=r),(!this.model.right||n>this.right)&&(this.right=n)}},{key:"expandRow",value:function(e){if(e){var t=e.dimensions,r=e.number;t&&this.expand(r,t.min,r,t.max)}}},{key:"expandToAddress",value:function(e){var t=o.decodeEx(e);this.expand(t.row,t.col,t.row,t.col)}},{key:"toString",value:function(){return this.range}},{key:"intersects",value:function(e){return!(e.sheetName&&this.sheetName&&e.sheetName!==this.sheetName||e.bottomthis.bottom||e.rightthis.right)}},{key:"contains",value:function(e){var t=o.decodeEx(e);return this.containsEx(t)}},{key:"containsEx",value:function(e){return(!e.sheetName||!this.sheetName||e.sheetName===this.sheetName)&&e.row>=this.top&&e.row<=this.bottom&&e.col>=this.left&&e.col<=this.right}},{key:"forEachAddress",value:function(e){for(var t=this.left;t<=this.right;t++)for(var r=this.top;r<=this.bottom;r++)e(o.encodeAddress(r,t),r,t)}},{key:"top",get:function(){return this.model.top||1},set:function(e){this.model.top=e}},{key:"left",get:function(){return this.model.left||1},set:function(e){this.model.left=e}},{key:"bottom",get:function(){return this.model.bottom||1},set:function(e){this.model.bottom=e}},{key:"right",get:function(){return this.model.right||1},set:function(e){this.model.right=e}},{key:"sheetName",get:function(){return this.model.sheetName},set:function(e){this.model.sheetName=e}},{key:"_serialisedSheetName",get:function(){var e=this.model.sheetName;return e?/^[a-zA-Z0-9]*$/.test(e)?"".concat(e,"!"):"'".concat(e,"'!"):""}},{key:"tl",get:function(){return o.n2l(this.left)+this.top}},{key:"$t$l",get:function(){return"$".concat(o.n2l(this.left),"$").concat(this.top)}},{key:"br",get:function(){return o.n2l(this.right)+this.bottom}},{key:"$b$r",get:function(){return"$".concat(o.n2l(this.right),"$").concat(this.bottom)}},{key:"range",get:function(){return"".concat(this._serialisedSheetName+this.tl,":").concat(this.br)}},{key:"$range",get:function(){return"".concat(this._serialisedSheetName+this.$t$l,":").concat(this.$b$r)}},{key:"shortRange",get:function(){return this.count>1?this.range:this._serialisedSheetName+this.tl}},{key:"$shortRange",get:function(){return this.count>1?this.$range:this._serialisedSheetName+this.$t$l}},{key:"count",get:function(){return(1+this.bottom-this.top)*(1+this.right-this.left)}}])&&i(t.prototype,r),a&&i(t,a),e}();t.exports=a},{"./../utils/col-cache":17}],11:[function(e,t,r){function n(e,t){for(var r=0;r2?n-2:0),o=2;o0)for(a=f;a>=r;a--)(s=this._cells[a-1])?((u=this.getCell(a+c)).value=s.value,u.style=s.style):this._cells[a+c-1]=void 0;for(a=0;ar.col)&&(e=r.col),t0?{min:e,max:t}:null}},{key:"numFmt",get:function(){return this.style.numFmt},set:function(e){this._applyStyle("numFmt",e)}},{key:"font",get:function(){return this.style.font},set:function(e){this._applyStyle("font",e)}},{key:"alignment",get:function(){return this.style.alignment},set:function(e){this._applyStyle("alignment",e)}},{key:"protection",get:function(){return this.style.protection},set:function(e){this._applyStyle("protection",e)}},{key:"border",get:function(){return this.style.border},set:function(e){this._applyStyle("border",e)}},{key:"fill",get:function(){return this.style.fill},set:function(e){this._applyStyle("fill",e)}},{key:"hidden",get:function(){return!!this._hidden},set:function(e){this._hidden=e}},{key:"outlineLevel",get:function(){return this._outlineLevel||0},set:function(e){this._outlineLevel=e}},{key:"collapsed",get:function(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelRow)}},{key:"model",get:function(){var e=[],t=0,r=0;return this._cells.forEach((function(n){if(n){var i=n.model;i&&((!t||t>n.col)&&(t=n.col),r0,"Table must be on valid row"),n(s>0,"Table must be on valid col");var u=this.width,c=this.filterHeight,f=this.tableHeight;t.autoFilterRef=a.encode(o,s,o+c-1,s+u-1),t.tableRef=a.encode(o,s,o+f-1,s+u-1),t.columns.forEach((function(t,i){n(t.name,"Column ".concat(i," must have a name")),0===i?r(t,"totalsRowLabel","Total"):(r(t,"totalsRowFunction","none"),t.totalsRowFormula=e.getFormula(t))}))}},{key:"store",value:function(){var e=this,t=function(e,t){t&&Object.keys(t).forEach((function(r){e[r]=t[r]}))},r=this.worksheet,n=this.table,i=n.tl,o=i.row,a=i.col,s=0;if(n.headerRow){var u=r.getRow(o+s++);n.columns.forEach((function(e,r){var n=e.style,i=e.name,o=u.getCell(a+r);o.value=i,t(o,n)}))}if(n.rows.forEach((function(e){var i=r.getRow(o+s++);e.forEach((function(e,r){var o=i.getCell(a+r);o.value=e,t(o,n.columns[r].style)}))})),n.totalsRow){var c=r.getRow(o+s++);n.columns.forEach((function(r,n){var i=c.getCell(a+n);if(0===n)i.value=r.totalsRowLabel;else{var o=e.getFormula(r);i.value=o?{formula:r.totalsRowFormula,result:r.totalsRowResult}:null}t(i,r.style)}))}}},{key:"load",value:function(e){var t=this,r=this.table,n=r.tl,i=n.row,o=n.col,a=0;if(r.headerRow){var s=e.getRow(i+a++);r.columns.forEach((function(e,t){s.getCell(o+t).value=e.name}))}if(r.rows.forEach((function(t){var r=e.getRow(i+a++);t.forEach((function(e,t){r.getCell(o+t).value=e}))})),r.totalsRow){var u=e.getRow(i+a++);r.columns.forEach((function(e,r){var n=u.getCell(o+r);0===r?n.value=e.totalsRowLabel:t.getFormula(e)&&(n.value={formula:e.totalsRowFormula,result:e.totalsRowResult})}))}}},{key:"cacheState",value:function(){this._cache||(this._cache={ref:this.ref,width:this.width,tableHeight:this.tableHeight})}},{key:"commit",value:function(){if(this._cache){this.validate();var e=a.decodeAddress(this._cache.ref);if(this.ref!==this._cache.ref)for(var t=0;t1&&void 0!==arguments[1]?arguments[1]:1;this.cacheState(),this.table.rows.splice(e,t)}},{key:"getColumn",value:function(e){var t=this.table.columns[e];return new s(this,t,e)}},{key:"addColumn",value:function(e,t,r){this.cacheState(),void 0===r?(this.table.columns.push(e),this.table.rows.forEach((function(e,r){e.push(t[r])}))):(this.table.columns.splice(r,0,e),this.table.rows.forEach((function(e,n){e.splice(r,0,t[n])})))}},{key:"removeColumns",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.cacheState(),this.table.columns.splice(e,t),this.table.rows.forEach((function(r){r.splice(e,t)}))}},{key:"_assign",value:function(e,t,r){this.cacheState(),e[t]=r}},{key:"width",get:function(){return this.table.columns.length}},{key:"height",get:function(){return this.table.rows.length}},{key:"filterHeight",get:function(){return this.height+(this.table.headerRow?1:0)}},{key:"tableHeight",get:function(){return this.filterHeight+(this.table.totalsRow?1:0)}},{key:"model",get:function(){return this.table},set:function(e){this.table=e}},{key:"ref",get:function(){return this.table.ref},set:function(e){this._assign(this.table,"ref",e)}},{key:"name",get:function(){return this.table.name},set:function(e){this.table.name=e}},{key:"displayName",get:function(){return this.table.displyName||this.table.name}},{key:"displayNamename",set:function(e){this.table.displayName=e}},{key:"headerRow",get:function(){return this.table.headerRow},set:function(e){this._assign(this.table,"headerRow",e)}},{key:"totalsRow",get:function(){return this.table.totalsRow},set:function(e){this._assign(this.table,"totalsRow",e)}},{key:"theme",get:function(){return this.table.style.name},set:function(e){this.table.style.name=e}},{key:"showFirstColumn",get:function(){return this.table.style.showFirstColumn},set:function(e){this.table.style.showFirstColumn=e}},{key:"showLastColumn",get:function(){return this.table.style.showLastColumn},set:function(e){this.table.style.showLastColumn=e}},{key:"showRowStripes",get:function(){return this.table.style.showRowStripes},set:function(e){this.table.style.showRowStripes=e}},{key:"showColumnStripes",get:function(){return this.table.style.showColumnStripes},set:function(e){this.table.style.showColumnStripes=e}}]),e}();t.exports=u},{"./../utils/col-cache":17}],13:[function(e,t,r){function n(e,t){for(var r=0;r31&&console.warn("Worksheet name ".concat(e," exceeds 31 chars. This will be truncated")),e=(e||"sheet".concat(r)).substring(0,31),this._worksheets.find((function(t){return t&&t.name.toLowerCase()===e.toLowerCase()})))throw new Error("Worksheet name already exists: ".concat(e));t&&("string"==typeof t?(console.trace('tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { argb: "rbg value" } }'),t={properties:{tabColor:{argb:t}}}):(t.argb||t.theme||t.indexed)&&(console.trace("tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { ... } }"),t={properties:{tabColor:t}}));var n=this._worksheets.reduce((function(e,t){return(t&&t.orderNo)>e?t.orderNo:e}),0),o=Object.assign({},t,{id:r,name:e,orderNo:n+1,workbook:this}),a=new i(o);return this._worksheets[r]=a,a}},{key:"removeWorksheetEx",value:function(e){delete this._worksheets[e.id]}},{key:"removeWorksheet",value:function(e){var t=this.getWorksheet(e);t&&t.destroy()}},{key:"getWorksheet",value:function(e){return void 0===e?this._worksheets.find(Boolean):"number"==typeof e?this._worksheets[e]:"string"==typeof e?this._worksheets.find((function(t){return t&&t.name===e})):void 0}},{key:"eachSheet",value:function(e){this.worksheets.forEach((function(t){e(t,t.id)}))}},{key:"clearThemes",value:function(){this._themes=void 0}},{key:"addImage",value:function(e){var t=this.media.length;return this.media.push(Object.assign({},e,{type:"image"})),t}},{key:"getImage",value:function(e){return this.media[e]}},{key:"xlsx",get:function(){return this._xlsx||(this._xlsx=new a(this)),this._xlsx}},{key:"csv",get:function(){return this._csv||(this._csv=new s(this)),this._csv}},{key:"nextId",get:function(){for(var e=1;ee.length)&&(t=e.length);for(var r=0,n=new Array(t);rthis._columns.length)for(var r=this._columns.length+1;r<=e;)this._columns.push(new f(this,r++));return this._columns[e-1]}},{key:"spliceColumns",value:function(e,t){for(var r=this,n=this._rows,i=n.length,o=arguments.length,a=new Array(o>2?o-2:0),s=2;s0)for(var u=function(n){var i=[e,t];a.forEach((function(e){i.push(e[n]||null)}));var o=r.getRow(n+1);o.splice.apply(o,i)},c=0;c0)for(var p=h;p>=l;p--)this.getColumn(p+f).defn=this.getColumn(p).defn;for(var m=e;m2&&void 0!==arguments[2]&&arguments[2],o=this._rows[e-1],a=new Array(t).fill(o.values);this.spliceRows.apply(this,[e+1,i?0:t].concat(n(a)));for(var s=function(t){var n=r._rows[e+t];n.style=o.style,n.height=o.height,o.eachCell({includeEmpty:!0},(function(e,t){n.getCell(t).style=e.style}))},u=0;u2?i-2:0),a=2;a0)for(s=f;s>=n;s--)(u=this._rows[s-1])?function(){var e=r.getRow(s+c);e.values=u.values,e.style=u.style,e.height=u.height,u.eachCell({includeEmpty:!0},(function(t,r){e.getCell(r).style=t.style}))}():this._rows[s+c-1]=void 0;for(s=0;se.top||i>e.left)&&this.getCell(n,i).merge(r,t);this._merges[r.address]=e}},{key:"_unMergeMaster",value:function(e){var t=this._merges[e.address];if(t){for(var r=t.top;r<=t.bottom;r++)for(var n=t.left;n<=t.right;n++)this.getCell(r,n).unmerge();delete this._merges[e.address]}}},{key:"unMergeCells",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r3&&void 0!==arguments[3]?arguments[3]:"shared",o=s.decode(e),a=o.top,u=o.left,c=o.bottom,f=o.right,l=f-u+1,h=s.encodeAddress(a,u),d="shared"===i;n="function"==typeof r?r:Array.isArray(r)?Array.isArray(r[0])?function(e,t){return r[e-a][t-u]}:function(e,t){return r[(e-a)*l+(t-u)]}:function(){};for(var p=!0,m=a;m<=c;m++)for(var y=u;y<=f;y++)p?(this.getCell(m,y).value={shareType:i,formula:t,ref:e,result:n(m,y)},p=!1):this.getCell(m,y).value=d?{sharedFormula:h,result:n(m,y)}:n(m,y)}},{key:"addImage",value:function(e,t){var r={type:"image",imageId:e,range:t};this._media.push(new h(this,r))}},{key:"getImages",value:function(){return this._media.filter((function(e){return"image"===e.type}))}},{key:"addBackgroundImage",value:function(e){var t={type:"background",imageId:e};this._media.push(new h(this,t))}},{key:"getBackgroundImageId",value:function(){var e=this._media.find((function(e){return"background"===e.type}));return e&&e.imageId}},{key:"protect",value:function(e,t){var r=this;return new Promise((function(n){r.sheetProtection={sheet:!0},t&&"spinCount"in t&&(t.spinCount=Number.isFinite(t.spinCount)?Math.round(Math.max(0,t.spinCount)):1e5),e&&(r.sheetProtection.algorithmName="SHA-512",r.sheetProtection.saltValue=m.randomBytes(16).toString("base64"),r.sheetProtection.spinCount=t&&"spinCount"in t?t.spinCount:1e5,r.sheetProtection.hashValue=m.convertPasswordToHash(e,"SHA512",r.sheetProtection.saltValue,r.sheetProtection.spinCount)),t&&(r.sheetProtection=Object.assign(r.sheetProtection,t),!e&&"spinCount"in t&&delete r.sheetProtection.spinCount),n()}))}},{key:"unprotect",value:function(){this.sheetProtection=null}},{key:"addTable",value:function(e){var t=new d(this,e);return this.tables[e.name]=t,t}},{key:"getTable",value:function(e){return this.tables[e]}},{key:"removeTable",value:function(e){delete this.tables[e]}},{key:"getTables",value:function(){return Object.values(this.tables)}},{key:"addConditionalFormatting",value:function(e){this.conditionalFormattings.push(e)}},{key:"removeConditionalFormatting",value:function(e){"number"==typeof e?this.conditionalFormattings.splice(e,1):this.conditionalFormattings=e instanceof Function?this.conditionalFormattings.filter(e):[]}},{key:"_parseRows",value:function(e){var t=this;this._rows=[],e.rows.forEach((function(e){var r=new c(t,e.number);t._rows[r.number-1]=r,r.model=e}))}},{key:"_parseMergeCells",value:function(e){var t=this;a.each(e.mergeCells,(function(e){t.mergeCellsWithoutStyle(e)}))}},{key:"workbook",get:function(){return this._workbook}},{key:"dimensions",get:function(){var e=new u;return this._rows.forEach((function(t){if(t){var r=t.dimensions;r&&e.expand(t.number,r.min,t.number,r.max)}})),e}},{key:"columns",get:function(){return this._columns},set:function(e){var t=this;this._headerRowCount=e.reduce((function(e,t){var r=(t.header?1:t.headers&&t.headers.length)||0;return Math.max(e,r)}),0);var r=1,n=this._columns=[];e.forEach((function(e){var i=new f(t,r++,!1);n.push(i),i.defn=e}))}},{key:"columnCount",get:function(){var e=0;return this.eachRow((function(t){e=Math.max(e,t.cellCount)})),e}},{key:"actualColumnCount",get:function(){var e=[],t=0;return this.eachRow((function(r){r.eachCell((function(r){var n=r.col;e[n]||(e[n]=!0,t++)}))})),t}},{key:"_lastRowNumber",get:function(){for(var e=this._rows,t=e.length;t>0&&void 0===e[t-1];)t--;return t}},{key:"_nextRow",get:function(){return this._lastRowNumber+1}},{key:"lastRow",get:function(){if(this._rows.length)return this._rows[this._rows.length-1]}},{key:"rowCount",get:function(){return this._lastRowNumber}},{key:"actualRowCount",get:function(){var e=0;return this.eachRow((function(){e++})),e}},{key:"hasMerges",get:function(){return a.some(this._merges,Boolean)}},{key:"tabColor",get:function(){return console.trace("worksheet.tabColor property is now deprecated. Please use worksheet.properties.tabColor"),this.properties.tabColor},set:function(e){console.trace("worksheet.tabColor property is now deprecated. Please use worksheet.properties.tabColor"),this.properties.tabColor=e}},{key:"model",get:function(){var e={id:this.id,name:this.name,dataValidations:this.dataValidations.model,properties:this.properties,state:this.state,pageSetup:this.pageSetup,headerFooter:this.headerFooter,rowBreaks:this.rowBreaks,views:this.views,autoFilter:this.autoFilter,media:this._media.map((function(e){return e.model})),sheetProtection:this.sheetProtection,tables:Object.values(this.tables).map((function(e){return e.model})),conditionalFormattings:this.conditionalFormattings};e.cols=f.toModel(this.columns);var t=e.rows=[],r=e.dimensions=new u;return this._rows.forEach((function(e){var n=e&&e.model;n&&(r.expand(n.number,n.min,n.number,n.max),t.push(n))})),e.merges=[],a.each(this._merges,(function(t){e.merges.push(t.range)})),e},set:function(e){var t=this;this.name=e.name,this._columns=f.fromModel(this,e.cols),this._parseRows(e),this._parseMergeCells(e),this.dataValidations=new p(e.dataValidations),this.properties=e.properties,this.pageSetup=e.pageSetup,this.headerFooter=e.headerFooter,this.views=e.views,this.autoFilter=e.autoFilter,this._media=e.media.map((function(e){return new h(t,e)})),this.sheetProtection=e.sheetProtection,this.tables=e.tables.reduce((function(e,t){var r=new d;return r.model=t,e[t.name]=r,e}),{}),this.conditionalFormattings=e.conditionalFormattings}}])&&o(t.prototype,r),i&&o(t,i),e}();t.exports=y},{"../utils/col-cache":17,"../utils/encryptor":18,"../utils/under-dash":23,"./column":4,"./data-validations":5,"./enums":7,"./image":8,"./range":10,"./row":11,"./table":12}],15:[function(e,t,r){e("core-js/modules/es.promise"),e("core-js/modules/es.object.assign"),e("core-js/modules/es.object.keys"),e("core-js/modules/es.symbol"),e("core-js/modules/es.symbol.async-iterator"),e("regenerator-runtime/runtime");var n={Workbook:e("./doc/workbook")},i=e("./doc/enums");Object.keys(i).forEach((function(e){n[e]=i[e]})),t.exports=n},{"./doc/enums":7,"./doc/workbook":13,"core-js/modules/es.object.assign":300,"core-js/modules/es.object.keys":301,"core-js/modules/es.promise":302,"core-js/modules/es.symbol":304,"core-js/modules/es.symbol.async-iterator":303,"regenerator-runtime/runtime":468}],16:[function(e,t,r){function n(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r=1)for(;a<=26;)t=this._dictionary[a-1],this._n2l[a]=t,this._l2n[t]=a,a++;if(e>=2)for(;a<=702;)n=(r=a-27)%26,i=Math.floor(r/26),t=this._dictionary[i]+this._dictionary[n],this._n2l[a]=t,this._l2n[t]=a,a++;if(e>=3)for(;a<=16384;)n=(r=a-703)%26,i=Math.floor(r/26)%26,o=Math.floor(r/676),t=this._dictionary[o]+this._dictionary[i]+this._dictionary[n],this._n2l[a]=t,this._l2n[t]=a,a++},l2n:function(e){if(this._l2n[e]||this._fill(e.length),!this._l2n[e])throw new Error("Out of bounds. Invalid column letter: ".concat(e));return this._l2n[e]},n2l:function(e){if(e<1||e>16384)throw new Error("".concat(e," is out of bounds. Excel supports columns from 1 to 16384"));return this._n2l[e]||this._fill(this._level(e)),this._n2l[e]},_hash:{},validateAddress:function(e){if(!e.match(/^[A-Z]+\d+$/))throw new Error("Invalid Address: ".concat(e));return!0},decodeAddress:function(e){var t=this._hash[e];if(t)return t;var r,n,i=e.match(/[A-Z]+/);i&&(r=i[0],n=this.l2n(r));var o,a,s=e.match(/\d+/);s&&(o=s[0],a=parseInt(o,10));var u={address:e=(r||"")+(o||""),col:n,row:a,$col$row:"$".concat(r||"","$").concat(o||"")};return n<=100&&a<=100&&(this._hash[e]=u,this._hash[u.$col$row]=u),u},getAddress:function(e,t){if(t){var r=this.n2l(t)+e;return this.decodeAddress(r)}return this.decodeAddress(e)},decode:function(e){var t=e.split(":");if(2===t.length){var r=this.decodeAddress(t[0]),n=this.decodeAddress(t[1]),i={top:Math.min(r.row,n.row),left:Math.min(r.col,n.col),bottom:Math.max(r.row,n.row),right:Math.max(r.col,n.col)};return i.tl=this.n2l(i.left)+i.top,i.br=this.n2l(i.right)+i.bottom,i.dimensions="".concat(i.tl,":").concat(i.br),i}return this.decodeAddress(e)},decodeEx:function(e){var t=e.match(/(?:(?:(?:'((?:[^']|'')*)')|([^'^ !]*))!)?(.*)/),r=t[1]||t[2],n=t[3],i=n.split(":");if(i.length>1){var s=this.decodeAddress(i[0]),u=this.decodeAddress(i[1]),c=Math.min(s.row,u.row),f=Math.min(s.col,u.col),l=Math.max(s.row,u.row),h=Math.max(s.col,u.col);return s=this.n2l(f)+c,u=this.n2l(h)+l,{top:c,left:f,bottom:l,right:h,sheetName:r,tl:{address:s,col:f,row:c,$col$row:"$".concat(this.n2l(f),"$").concat(c),sheetName:r},br:{address:u,col:h,row:l,$col$row:"$".concat(this.n2l(h),"$").concat(l),sheetName:r},dimensions:"".concat(s,":").concat(u)}}if(n.startsWith("#"))return r?{sheetName:r,error:n}:{error:n};var d=this.decodeAddress(n);return r?function(e){for(var t=1;t=i&&c<=a&&f>=o&&f<=s}};t.exports=s},{}],18:[function(e,t,r){(function(r){var n=e("crypto"),i={hash:function(e){for(var t=n.createHash(e),i=arguments.length,o=new Array(i>1?i-1:0),a=1;a3||3===l.length&&l>"XFD")return e;var p=n.l2n(l),m=parseInt(d,10);return f||(p+=s.col-a.col),h||(m+=s.row-a.row),(t||"")+(f||"")+n.n2l(p)+(h||"")+m}return e}))}}},{"./col-cache":17}],21:[function(e,t,r){(function(r,n){function i(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function o(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function s(e){i(a,n,o,s,u,"next",e)}function u(e){i(a,n,o,s,u,"throw",e)}s(void 0)}))}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r=this.length?(t=this.toBuffer(),this.iRead=this.iWrite,t):(t=n.alloc(e),this.buffer.copy(t,0,this.iRead,e),this.iRead+=e,t)}},{key:"write",value:function(e,t,r){var n=Math.min(r,this.size-this.iWrite);return e.copy(this.buffer,this.iWrite,t,t+n),this.iWrite+=n,n}},{key:"length",get:function(){return this.iWrite-this.iRead}},{key:"eod",get:function(){return this.iRead===this.iWrite}},{key:"full",get:function(){return this.iWrite===this.size}}]),e}(),y=function(e){e=e||{},this.bufSize=e.bufSize||1048576,this.buffers=[],this.batch=e.batch||!1,this.corked=!1,this.inPos=0,this.outPos=0,this.pipes=[],this.paused=!1,this.encoding=null};f.inherits(y,c.Duplex,{toBuffer:function(){switch(this.buffers.length){case 0:return null;case 1:return this.buffers[0].toBuffer();default:return n.concat(this.buffers.map((function(e){return e.toBuffer()})))}},_getWritableBuffer:function(){if(this.buffers.length){var e=this.buffers[this.buffers.length-1];if(!e.full)return e}var t=new m(this.bufSize);return this.buffers.push(t),t},_pipe:function(e){var t=this;return o(regeneratorRuntime.mark((function r(){var n;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=function(t){return new Promise((function(r){t.write(e.toBuffer(),(function(){r()}))}))},r.next=3,Promise.all(t.pipes.map(n));case 3:case"end":return r.stop()}}),r)})))()},_writeToBuffers:function(e){for(var t=0,r=e.length;t1;)a._pipe(a.buffers.shift());o.next=29;break;case 21:if(a.corked){o.next=27;break}return o.next=24,a._pipe(s);case 24:i(),o.next=29;break;case 27:a._writeToBuffers(s),r.nextTick(i);case 29:o.next=34;break;case 31:a.paused||a.emit("data",s.toBuffer()),a._writeToBuffers(s),a.emit("readable");case 34:return o.abrupt("return",!0);case 35:case"end":return o.stop()}}),o)})))()},cork:function(){this.corked=!0},_flush:function(){if(this.pipes.length)for(;this.buffers.length;)this._pipe(this.buffers.shift())},uncork:function(){this.corked=!1,this._flush()},end:function(e,t,r){var n=this,i=function(e){e?r(e):(n._flush(),n.pipes.forEach((function(e){e.end()})),n.emit("finish"))};e?this.write(e,t,i):i()},read:function(e){var t;if(e){for(t=[];e&&this.buffers.length&&!this.buffers[0].eod;){var r=this.buffers[0],i=r.read(e);e-=i.length,t.push(i),r.eod&&r.full&&this.buffers.shift()}return n.concat(t)}return t=this.buffers.map((function(e){return e.toBuffer()})).filter(Boolean),this.buffers=[],n.concat(t)},setEncoding:function(e){this.encoding=e},pause:function(){this.paused=!0},resume:function(){this.paused=!1},isPaused:function(){return!!this.paused},pipe:function(e){this.pipes.push(e),!this.paused&&this.buffers.length&&this.end()},unpipe:function(e){this.pipes=this.pipes.filter((function(t){return t!==e}))},unshift:function(){throw new Error("Not Implemented")},wrap:function(){throw new Error("Not Implemented")}}),t.exports=y}).call(this,e("_process"),e("buffer").Buffer)},{"./string-buf":22,"./utils":24,_process:443,buffer:214,"readable-stream":467}],22:[function(e,t,r){(function(e){function r(e,t){for(var r=0;r=this._buf.length-4;)this._grow(this._inPos+e.length),t=this._inPos+this._buf.write(e,this._inPos,this._encoding);this._inPos=t}},{key:"addStringBuf",value:function(e){e.length&&(this._buffer=void 0,this.length+e.length>this.capacity&&this._grow(this.length+e.length),e._buf.copy(this._buf,this._inPos,0,e.length),this._inPos+=e.length)}},{key:"length",get:function(){return this._inPos}},{key:"capacity",get:function(){return this._buf.length}},{key:"buffer",get:function(){return this._buf}}])&&r(n.prototype,i),o&&r(n,o),t}();t.exports=n}).call(this,e("buffer").Buffer)},{buffer:214}],23:[function(e,t,r){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i=Object.prototype.toString,o={each:function(e,t){e&&(Array.isArray(e)?e.forEach(t):Object.keys(e).forEach((function(r){t(e[r],r)})))},some:function(e,t){return!!e&&(Array.isArray(e)?e.some(t):Object.keys(e).some((function(r){return t(e[r],r)})))},every:function(e,t){return!e||(Array.isArray(e)?e.every(t):Object.keys(e).every((function(r){return t(e[r],r)})))},map:function(e,t){return e?Array.isArray(e)?e.map(t):Object.keys(e).map((function(r){return t(e[r],r)})):[]},keyBy:function(e,t){return e.reduce((function(e,r){return e[r[t]]=r,e}),{})},isEqual:function(e,t){var r=n(e),i=n(t),a=Array.isArray(e),s=Array.isArray(t);if(r!==i)return!1;switch(n(e)){case"object":return a||s?!(!a||!s)&&(e.length===t.length&&e.every((function(e,r){var n=t[r];return o.isEqual(e,n)}))):o.every(e,(function(e,r){var n=t[r];return o.isEqual(e,n)}));default:return e===t}},escapeHtml:function(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},strcmp:function(e,t){return et?1:0},isUndefined:function(e){return"[object Undefined]"===i.call(e)},isObject:function(e){return"[object Object]"===i.call(e)},deepMerge:function(){var e,t,r,n=arguments[0]||{},i=arguments.length;function a(i,a){e=n[a],r=Array.isArray(i),o.isObject(i)||r?(r?(r=!1,t=e&&Array.isArray(e)?e:[]):t=e&&o.isObject(e)?e:{},n[a]=o.deepMerge(t,i)):o.isUndefined(i)||(n[a]=i)}for(var s=0;s&'"\x7F\x00-\x08\x0B-\x0C\x0E-\x1F]/g,(function(e){switch(e){case"<":return"<";case">":return">";case"&":return"&";case"'":return"'";case'"':return""";default:return""}}))},xmlDecode:function(e){return e.replace(/&([a-z]*);/,(function(e){switch(e){case"<":return"<";case">":return">";case"&":return"&";case"'":return"'";case""":return'"';default:return e}}))},validInt:function(e){var t=parseInt(e,10);return Number.isNaN(t)?0:t},isDateFmt:function(e){return!!e&&null!==(e=(e=e.replace(/\[[^\]]*]/g,"")).replace(/"[^"]*"/g,"")).match(/[ymdhMsb]+/)},fs:{exists:function(e){return new Promise((function(t){i.access(e,i.constants.F_OK,(function(e){t(!e)}))}))}},toIsoDateString:function(e){return e.toIsoString().subsstr(0,10)}};t.exports=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("timers").setImmediate)},{fs:213,timers:496}],25:[function(e,t,r){function n(e,t){for(var r=0;r\n")}},{key:"openNode",value:function(e,t){var r=this.tos,n=this._xml;r&&this.open&&n.push(">"),this._stack.push(e),n.push("<"),n.push(e),s(n,t),this.leaf=!0,this.open=!0}},{key:"addAttribute",value:function(e,t){if(!this.open)throw new Error("Cannot write attributes to node if it is not open");void 0!==t&&a(this._xml,e,t)}},{key:"addAttributes",value:function(e){if(!this.open)throw new Error("Cannot write attributes to node if it is not open");s(this._xml,e)}},{key:"writeText",value:function(e){var t=this._xml;this.open&&(t.push(">"),this.open=!1),this.leaf=!1,t.push(o.xmlEncode(e.toString()))}},{key:"writeXml",value:function(e){this.open&&(this._xml.push(">"),this.open=!1),this.leaf=!1,this._xml.push(e)}},{key:"closeNode",value:function(){var e=this._stack.pop(),t=this._xml;this.leaf?t.push("/>"):(t.push("")),this.open=!1,this.leaf=!1}},{key:"leafNode",value:function(e,t,r){this.openNode(e,t),void 0!==r&&this.writeText(r),this.closeNode()}},{key:"closeAll",value:function(){for(;this._stack.length;)this.closeNode()}},{key:"addRollback",value:function(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}},{key:"commit",value:function(){this._rollbacks.pop()}},{key:"rollback",value:function(){var e=this._rollbacks.pop();this._xml.length>e.xml&&this._xml.splice(e.xml,this._xml.length-e.xml),this._stack.length>e.stack&&this._stack.splice(e.stack,this._stack.length-e.stack),this.leaf=e.leaf,this.open=e.open}},{key:"tos",get:function(){return this._stack.length?this._stack[this._stack.length-1]:void 0}},{key:"cursor",get:function(){return this._xml.length}},{key:"xml",get:function(){return this.closeAll(),this._xml.join("")}}])&&n(t.prototype,r),i&&n(t,i),e}();u.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"},t.exports=u},{"./under-dash":23,"./utils":24}],26:[function(e,t,r){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function o(e,t){for(var r=0;r=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,o,a=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&void 0!==arguments[2]&&arguments[2];if(void 0===e){if(r)return t}else if(r||e!==t)return e.toString()}},{key:"toStringAttribute",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e.toAttribute(t,r,n)}},{key:"toStringValue",value:function(e,t){return void 0===e?t:e}},{key:"toBoolAttribute",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(void 0===e){if(r)return t}else if(r||e!==t)return e?"1":"0"}},{key:"toBoolValue",value:function(e,t){return void 0===e?t:"1"===e}},{key:"toIntAttribute",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e.toAttribute(t,r,n)}},{key:"toIntValue",value:function(e,t){return void 0===e?t:parseInt(e,10)}},{key:"toFloatAttribute",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e.toAttribute(t,r,n)}},{key:"toFloatValue",value:function(e,t){return void 0===e?t:parseFloat(e)}}],r&&s(t.prototype,r),i&&s(t,i),e}();t.exports=l},{"../../utils/parse-sax":19,"../../utils/xml-stream":25}],30:[function(e,t,r){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;rthis.maxItems))throw new Error("Max ".concat(this.childXform.tag," count (").concat(this.maxItems,") exceeded"));return!0}return!1}},{key:"reconcile",value:function(e,t){if(e){var r=this.childXform;e.forEach((function(e){r.reconcile(e,t)}))}}}])&&i(r.prototype,n),c&&i(r,c),l}(e("./base-xform"));t.exports=c},{"./base-xform":29}],69:[function(e,t,r){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0");case"containsErrors":return"ISERROR(".concat(t,")");case"notContainsErrors":return"NOT(ISERROR(".concat(t,"))");default:return}}(t);r&&this.formulaXform.render(e,r),e.closeNode()}},{key:"renderTimePeriod",value:function(e,t){e.openNode(this.tag,{type:"timePeriod",dxfId:t.dxfId,priority:t.priority,timePeriod:t.timePeriod});var r=function(e){if(e.formulae&&e.formulae[0])return e.formulae[0];var t=new p(e.ref).tl;switch(e.timePeriod){case"thisWeek":return"AND(TODAY()-ROUNDDOWN(".concat(t,",0)<=WEEKDAY(TODAY())-1,ROUNDDOWN(").concat(t,",0)-TODAY()<=7-WEEKDAY(TODAY()))");case"lastWeek":return"AND(TODAY()-ROUNDDOWN(".concat(t,",0)>=(WEEKDAY(TODAY())),TODAY()-ROUNDDOWN(").concat(t,",0)<(WEEKDAY(TODAY())+7))");case"nextWeek":return"AND(ROUNDDOWN(".concat(t,",0)-TODAY()>(7-WEEKDAY(TODAY())),ROUNDDOWN(").concat(t,",0)-TODAY()<(15-WEEKDAY(TODAY())))");case"yesterday":return"FLOOR(".concat(t,",1)=TODAY()-1");case"today":return"FLOOR(".concat(t,",1)=TODAY()");case"tomorrow":return"FLOOR(".concat(t,",1)=TODAY()+1");case"last7Days":return"AND(TODAY()-FLOOR(".concat(t,",1)<=6,FLOOR(").concat(t,",1)<=TODAY())");case"lastMonth":return"AND(MONTH(".concat(t,")=MONTH(EDATE(TODAY(),0-1)),YEAR(").concat(t,")=YEAR(EDATE(TODAY(),0-1)))");case"thisMonth":return"AND(MONTH(".concat(t,")=MONTH(TODAY()),YEAR(").concat(t,")=YEAR(TODAY()))");case"nextMonth":return"AND(MONTH(".concat(t,")=MONTH(EDATE(TODAY(),0+1)),YEAR(").concat(t,")=YEAR(EDATE(TODAY(),0+1)))");default:return}}(t);r&&this.formulaXform.render(e,r),e.closeNode()}},{key:"createNewModel",value:function(e){var t=e.attributes;return o(o({},function(e){var t=e.type,r=e.operator;switch(t){case"containsText":case"containsBlanks":case"notContainsBlanks":case"containsErrors":case"notContainsErrors":return{type:"containsText",operator:t};default:return{type:t,operator:r}}}(t)),{},{dxfId:h.toIntValue(t.dxfId),priority:h.toIntValue(t.priority),timePeriod:t.timePeriod,percent:h.toBoolValue(t.percent),bottom:h.toBoolValue(t.bottom),rank:h.toIntValue(t.rank),aboveAverage:h.toBoolValue(t.aboveAverage)})}},{key:"onParserClose",value:function(e,t){switch(e){case"dataBar":case"extLst":case"colorScale":case"iconSet":Object.assign(this.model,t.model);break;case"formula":this.model.formulae=this.model.formulae||[],this.model.formulae.push(t.model)}}},{key:"tag",get:function(){return"cfRule"}}])&&s(r.prototype,n),i&&s(r,i),d}(d);t.exports=_},{"../../../../doc/range":10,"../../base-xform":29,"../../composite-xform":45,"./color-scale-xform":82,"./databar-xform":85,"./ext-lst-ref-xform":86,"./formula-xform":87,"./icon-set-xform":88}],81:[function(e,t,r){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1||s>1){var f=i.row+(o-1),h=i.col+(s-1);return l(l({},t.dataValidation),{},{sqref:"".concat(t.address,":").concat(m.encodeAddress(f,h))})}return l(l({},t.dataValidation),{},{sqref:t.address})}return null})).filter(Boolean)}(t);r.length&&(e.openNode("dataValidations",{count:r.length}),r.forEach((function(t){e.openNode("dataValidation"),"any"!==t.type&&(e.addAttribute("type",t.type),t.operator&&"list"!==t.type&&"between"!==t.operator&&e.addAttribute("operator",t.operator),t.allowBlank&&e.addAttribute("allowBlank","1")),t.showInputMessage&&e.addAttribute("showInputMessage","1"),t.promptTitle&&e.addAttribute("promptTitle",t.promptTitle),t.prompt&&e.addAttribute("prompt",t.prompt),t.showErrorMessage&&e.addAttribute("showErrorMessage","1"),t.errorStyle&&e.addAttribute("errorStyle",t.errorStyle),t.errorTitle&&e.addAttribute("errorTitle",t.errorTitle),t.error&&e.addAttribute("error",t.error),e.addAttribute("sqref",t.sqref),(t.formulae||[]).forEach((function(r,n){e.openNode("formula".concat(n+1)),"date"===t.type?e.writeText(p.dateToExcel(new Date(r))):e.writeText(r),e.closeNode()})),e.closeNode()})),e.closeNode())}},{key:"parseOpen",value:function(e){switch(e.name){case"dataValidations":return this.model={},!0;case"dataValidation":this._address=e.attributes.sqref;var t={type:e.attributes.type||"any",formulae:[]};switch(e.attributes.type&&g(t,e.attributes,"allowBlank"),g(t,e.attributes,"showInputMessage"),g(t,e.attributes,"showErrorMessage"),t.type){case"any":case"list":case"custom":break;default:v(t,e.attributes,"operator","between")}return v(t,e.attributes,"promptTitle"),v(t,e.attributes,"prompt"),v(t,e.attributes,"errorStyle"),v(t,e.attributes,"errorTitle"),v(t,e.attributes,"error"),this._dataValidation=t,!0;case"formula1":case"formula2":return this._formula=[],!0;default:return!1}}},{key:"parseText",value:function(e){this._formula&&this._formula.push(e)}},{key:"parseClose",value:function(e){var t=this;switch(e){case"dataValidations":return!1;case"dataValidation":return this._dataValidation.formulae&&this._dataValidation.formulae.length||(delete this._dataValidation.formulae,delete this._dataValidation.operator),(this._address.split(/\s+/g)||[]).forEach((function(e){e.includes(":")?new b(e).forEachAddress((function(e){t.model[e]=t._dataValidation})):t.model[e]=t._dataValidation})),!0;case"formula1":case"formula2":var r=this._formula.join("");switch(this._dataValidation.type){case"whole":case"textLength":r=parseInt(r,10);break;case"decimal":r=parseFloat(r);break;case"date":r=p.excelToDate(parseFloat(r))}return this._dataValidation.formulae.push(r),this._formula=void 0,!0;default:return!0}}},{key:"tag",get:function(){return"dataValidations"}}])&&o(r.prototype,n),f&&o(r,f),y}(y);t.exports=w},{"../../../doc/range":10,"../../../utils/col-cache":17,"../../../utils/under-dash":23,"../../../utils/utils":24,"../base-xform":29}],91:[function(e,t,r){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r0&&t.max>0&&t.min<=t.max&&e.addAttribute("spans","".concat(t.min,":").concat(t.max)),t.styleId&&(e.addAttribute("s",t.styleId),e.addAttribute("customFormat","1")),e.addAttribute("x14ac:dyDescent","0.25"),t.outlineLevel&&e.addAttribute("outlineLevel",t.outlineLevel),t.collapsed&&e.addAttribute("collapsed","1");var n=this.map.c;t.cells.forEach((function(t){n.render(e,t,r)})),e.closeNode()}},{key:"parseOpen",value:function(e){if(this.parser)return this.parser.parseOpen(e),!0;if("row"===e.name){this.numRowsSeen+=1;var t=e.attributes.spans?e.attributes.spans.split(":").map((function(e){return parseInt(e,10)})):[void 0,void 0],r=this.model={number:parseInt(e.attributes.r,10),min:t[0],max:t[1],cells:[]};return e.attributes.s&&(r.styleId=parseInt(e.attributes.s,10)),!0!==e.attributes.hidden&&"true"!==e.attributes.hidden&&1!==e.attributes.hidden&&"1"!==e.attributes.hidden||(r.hidden=!0),e.attributes.bestFit&&(r.bestFit=!0),e.attributes.ht&&(r.height=parseFloat(e.attributes.ht)),e.attributes.outlineLevel&&(r.outlineLevel=parseInt(e.attributes.outlineLevel,10)),e.attributes.collapsed&&(r.collapsed=!0),!0}return this.parser=this.map[e.name],!!this.parser&&(this.parser.parseOpen(e),!0)}},{key:"parseText",value:function(e){this.parser&&this.parser.parseText(e)}},{key:"parseClose",value:function(e){if(this.parser){if(!this.parser.parseClose(e)){if(this.model.cells.push(this.parser.model),this.maxItems&&this.model.cells.length>this.maxItems)throw new Error("Max column count (".concat(this.maxItems,") exceeded"));this.parser=void 0}return!0}return!1}},{key:"reconcile",value:function(e,t){e.style=e.styleId?t.styles.getStyleModel(e.styleId):{},void 0!==e.styleId&&(e.styleId=void 0);var r=this.map.c;e.cells.forEach((function(e){r.reconcile(e,t)}))}},{key:"tag",get:function(){return"row"}}])&&i(r.prototype,n),c&&i(r,c),h}(c);t.exports=l},{"../base-xform":29,"./cell-xform":70}],107:[function(e,t,r){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r0){var o={Id:i(n),Type:h.Comments,Target:"../comments".concat(e.id,".xml")};n.push(o);var a={Id:i(n),Type:h.VmlDrawing,Target:"../drawings/vmlDrawing".concat(e.id,".vml")};n.push(a),e.comments.forEach((function(e){e.refAddress=f.decodeAddress(e.ref)})),t.commentRefs.push({commentName:"comments".concat(e.id),vmlDrawing:"vmlDrawing".concat(e.id)})}var s,u=[];e.media.forEach((function(o){if("background"===o.type){var a=i(n);s=t.media[o.imageId],n.push({Id:a,Type:h.Image,Target:"../media/".concat(s.name,".").concat(s.extension)}),e.background={rId:a},e.image=t.media[o.imageId]}else if("image"===o.type){var c=e.drawing;s=t.media[o.imageId],c||(c=e.drawing={rId:i(n),name:"drawing".concat(++t.drawingsCount),anchors:[],rels:[]},t.drawings.push(c),n.push({Id:c.rId,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",Target:"../drawings/".concat(c.name,".xml")}));var f=r.preImageId===o.imageId?u[o.imageId]:u[c.rels.length];f||(f=i(c.rels),u[c.rels.length]=f,c.rels.push({Id:f,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:"../media/".concat(s.name,".").concat(s.extension)}));var l={picture:{rId:f},range:o.range};if(o.hyperlinks&&o.hyperlinks.hyperlink){var d=i(c.rels);u[c.rels.length]=d,l.picture.hyperlinks={tooltip:o.hyperlinks.tooltip,rId:d},c.rels.push({Id:d,Type:h.Hyperlink,Target:o.hyperlinks.hyperlink,TargetMode:"External"})}r.preImageId=o.imageId,c.anchors.push(l)}})),e.tables.forEach((function(e){var r=i(n);e.rId=r,n.push({Id:r,Type:h.Table,Target:"../tables/".concat(e.target)}),e.columns.forEach((function(e){var r=e.style;r&&(e.dxfId=t.styles.addDxfStyle(r))}))})),this.map.extLst.prepare(e,t)}},{key:"render",value:function(e,t){e.openXml(l.StdDocAttributes),e.openNode("worksheet",L.WORKSHEET_ATTRIBUTES);var r=t.properties?{defaultRowHeight:t.properties.defaultRowHeight,dyDescent:t.properties.dyDescent,outlineLevelCol:t.properties.outlineLevelCol,outlineLevelRow:t.properties.outlineLevelRow}:void 0;t.properties&&t.properties.defaultColWidth&&(r.defaultColWidth=t.properties.defaultColWidth);var n={outlineProperties:t.properties&&t.properties.outlineProperties,tabColor:t.properties&&t.properties.tabColor,pageSetup:t.pageSetup&&t.pageSetup.fitToPage?{fitToPage:t.pageSetup.fitToPage}:void 0},i=t.pageSetup&&t.pageSetup.margins,o={showRowColHeaders:t.pageSetup&&t.pageSetup.showRowColHeaders,showGridLines:t.pageSetup&&t.pageSetup.showGridLines,horizontalCentered:t.pageSetup&&t.pageSetup.horizontalCentered,verticalCentered:t.pageSetup&&t.pageSetup.verticalCentered},a=t.sheetProtection;this.map.sheetPr.render(e,n),this.map.dimension.render(e,t.dimensions),this.map.sheetViews.render(e,t.views),this.map.sheetFormatPr.render(e,r),this.map.cols.render(e,t.cols),this.map.sheetData.render(e,t.rows),this.map.sheetProtection.render(e,a),this.map.autoFilter.render(e,t.autoFilter),this.map.mergeCells.render(e,t.mergeCells),this.map.conditionalFormatting.render(e,t.conditionalFormattings),this.map.dataValidations.render(e,t.dataValidations),this.map.hyperlinks.render(e,t.hyperlinks),this.map.printOptions.render(e,o),this.map.pageMargins.render(e,i),this.map.pageSetup.render(e,t.pageSetup),this.map.headerFooter.render(e,t.headerFooter),this.map.rowBreaks.render(e,t.rowBreaks),this.map.drawing.render(e,t.drawing),this.map.picture.render(e,t.background),this.map.tableParts.render(e,t.tables),this.map.extLst.render(e,t),t.rels&&t.rels.forEach((function(t){t.Type===h.VmlDrawing&&e.leafNode("legacyDrawing",{"r:id":t.Id})})),e.closeNode()}},{key:"parseOpen",value:function(e){return this.parser?(this.parser.parseOpen(e),!0):"worksheet"===e.name?(c.each(this.map,(function(e){e.reset()})),!0):(this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0)}},{key:"parseText",value:function(e){this.parser&&this.parser.parseText(e)}},{key:"parseClose",value:function(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case"worksheet":var t=this.map.sheetFormatPr.model||{};this.map.sheetPr.model&&this.map.sheetPr.model.tabColor&&(t.tabColor=this.map.sheetPr.model.tabColor),this.map.sheetPr.model&&this.map.sheetPr.model.outlineProperties&&(t.outlineProperties=this.map.sheetPr.model.outlineProperties);var r={fitToPage:this.map.sheetPr.model&&this.map.sheetPr.model.pageSetup&&this.map.sheetPr.model.pageSetup.fitToPage||!1,margins:this.map.pageMargins.model},n=Object.assign(r,this.map.pageSetup.model,this.map.printOptions.model),i=B(this.map.conditionalFormatting.model,this.map.extLst.model&&this.map.extLst.model["x14:conditionalFormattings"]);return this.model={dimensions:this.map.dimension.model,cols:this.map.cols.model,rows:this.map.sheetData.model,mergeCells:this.map.mergeCells.model,hyperlinks:this.map.hyperlinks.model,dataValidations:this.map.dataValidations.model,properties:t,views:this.map.sheetViews.model,pageSetup:n,headerFooter:this.map.headerFooter.model,background:this.map.picture.model,drawing:this.map.drawing.model,tables:this.map.tableParts.model,conditionalFormattings:i},this.map.autoFilter.model&&(this.model.autoFilter=this.map.autoFilter.model),this.map.sheetProtection.model&&(this.model.sheetProtection=this.map.sheetProtection.model),!1;default:return!0}}},{key:"reconcile",value:function(e,t){var r=(e.relationships||[]).reduce((function(r,n){if(r[n.Id]=n,n.Type===h.Comments&&(e.comments=t.comments[n.Target].comments),n.Type===h.VmlDrawing&&e.comments&&e.comments.length){var i=t.vmlDrawings[n.Target].comments;e.comments.forEach((function(e,t){e.note=Object.assign({},e.note,i[t])}))}return r}),{});if(t.commentsMap=(e.comments||[]).reduce((function(e,t){return t.ref&&(e[t.ref]=t),e}),{}),t.hyperlinkMap=(e.hyperlinks||[]).reduce((function(e,t){return t.rId&&(e[t.address]=r[t.rId].Target),e}),{}),t.formulae={},e.rows=e.rows&&e.rows.filter(Boolean)||[],e.rows.forEach((function(e){e.cells=e.cells&&e.cells.filter(Boolean)||[]})),this.map.cols.reconcile(e.cols,t),this.map.sheetData.reconcile(e.rows,t),this.map.conditionalFormatting.reconcile(e.conditionalFormattings,t),e.media=[],e.drawing){var n=r[e.drawing.rId].Target.match(/\/drawings\/([a-zA-Z0-9]+)[.][a-zA-Z]{3,4}$/);if(n){var i=n[1];t.drawings[i].anchors.forEach((function(t){if(t.medium){var r={type:"image",imageId:t.medium.index,range:t.range,hyperlinks:t.picture.hyperlinks};e.media.push(r)}}))}}var o=e.background&&r[e.background.rId];if(o){var a=o.Target.split("/media/")[1],s=t.mediaIndex&&t.mediaIndex[a];void 0!==s&&e.media.push({type:"background",imageId:s})}e.tables=(e.tables||[]).map((function(e){var n=r[e.rId];return t.tables[n.Target]})),delete e.relationships,delete e.hyperlinks,delete e.comments}}])&&i(r.prototype,n),p&&i(r,p),L}(p);F.WORKSHEET_ATTRIBUTES={xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","mc:Ignorable":"x14ac","xmlns:x14ac":"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"},t.exports=F},{"../../../utils/col-cache":17,"../../../utils/under-dash":23,"../../../utils/xml-stream":25,"../../rel-type":28,"../base-xform":29,"../list-xform":68,"./auto-filter-xform":69,"./cf/conditional-formattings-xform":84,"./col-xform":89,"./data-validations-xform":90,"./dimension-xform":91,"./drawing-xform":92,"./ext-lst-xform":93,"./header-footer-xform":94,"./hyperlink-xform":95,"./merge-cell-xform":96,"./merges":97,"./page-margins-xform":100,"./page-setup-xform":102,"./picture-xform":103,"./print-options-xform":104,"./row-breaks-xform":105,"./row-xform":106,"./sheet-format-properties-xform":107,"./sheet-properties-xform":108,"./sheet-protection-xform":109,"./sheet-view-xform":110,"./table-part-xform":111}],113:[function(e,t,r){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){for(var r=0;r=-90&&e<=90?e:void 0}},indent:function(e){return e=l.validInt(e),Math.max(0,e)},readingOrder:function(e){switch(e){case"ltr":return f.ReadingOrder.LeftToRight;case"rtl":return f.ReadingOrder.RightToLeft;default:return}}},p=function(e){if(e=d.textRotation(e)){if("vertical"===e)return 255;var t=Math.round(e);if(t>=0&&t<=90)return t;if(t<0&&t>=-90)return 90-t}},m=function(e){var t=l.validInt(e);if(void 0!==t){if(255===t)return"vertical";if(t>=0&&t<=90)return t;if(t>90&&t<=180)return 90-t}},y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(h,e);var t,r,n,f,l=(t=h,function(){var e,r=c(t);if(u()){var n=c(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return s(this,e)});function h(){return i(this,h),l.apply(this,arguments)}return r=h,(n=[{key:"render",value:function(e,t){e.addRollback(),e.openNode("alignment");var r=!1;function n(t,n){n&&(e.addAttribute(t,n),r=!0)}n("horizontal",d.horizontal(t.horizontal)),n("vertical",d.vertical(t.vertical)),n("wrapText",!!d.wrapText(t.wrapText)&&"1"),n("shrinkToFit",!!d.shrinkToFit(t.shrinkToFit)&&"1"),n("indent",d.indent(t.indent)),n("textRotation",p(t.textRotation)),n("readingOrder",d.readingOrder(t.readingOrder)),e.closeNode(),r?e.commit():e.rollback()}},{key:"parseOpen",value:function(e){var t={},r=!1;function n(e,n,i){e&&(t[n]=i,r=!0)}n(e.attributes.horizontal,"horizontal",e.attributes.horizontal),n(e.attributes.vertical,"vertical","center"===e.attributes.vertical?"middle":e.attributes.vertical),n(e.attributes.wrapText,"wrapText",!!e.attributes.wrapText),n(e.attributes.shrinkToFit,"shrinkToFit",!!e.attributes.shrinkToFit),n(e.attributes.indent,"indent",parseInt(e.attributes.indent,10)),n(e.attributes.textRotation,"textRotation",m(e.attributes.textRotation)),n(e.attributes.readingOrder,"readingOrder","2"===e.attributes.readingOrder?"rtl":"ltr"),this.model=r?t:null}},{key:"parseText",value:function(){}},{key:"parseClose",value:function(){return!1}},{key:"tag",get:function(){return"alignment"}}])&&o(r.prototype,n),f&&o(r,f),h}(h);t.exports=y},{"../../../doc/enums":7,"../../../utils/utils":24,"../base-xform":29}],124:[function(e,t,r){function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=1)){e.next=6;break}return o=n.substr(i+1),a=n.substr(0,i),e.next=6,new Promise((function(e,i){var s=new l;s.on("finish",(function(){r.mediaIndex[n]=r.media.length,r.mediaIndex[a]=r.media.length;var t={type:"image",name:a,extension:o,buffer:s.toBuffer()};r.media.push(t),e()})),t.on("error",(function(e){i(e)})),t.pipe(s)}));case 6:case"end":return e.stop()}}),e)}))),function(e,t,r){return K.apply(this,arguments)})},{key:"_processDrawingEntry",value:(X=i(regeneratorRuntime.mark((function e(t,r,n){var i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=new k,e.next=3,i.parseStream(t);case 3:o=e.sent,r.drawings[n]=o;case 5:case"end":return e.stop()}}),e)}))),function(e,t,r){return X.apply(this,arguments)})},{key:"_processDrawingRelsEntry",value:($=i(regeneratorRuntime.mark((function e(t,r,n){var i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=new b,e.next=3,i.parseStream(t);case 3:o=e.sent,r.drawingRels[n]=o;case 5:case"end":return e.stop()}}),e)}))),function(e,t,r){return $.apply(this,arguments)})},{key:"_processVmlDrawingEntry",value:(W=i(regeneratorRuntime.mark((function e(t,r,n){var i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=new O,e.next=3,i.parseStream(t);case 3:o=e.sent,r.vmlDrawings["../drawings/".concat(n,".vml")]=o;case 5:case"end":return e.stop()}}),e)}))),function(e,t,r){return W.apply(this,arguments)})},{key:"_processThemeEntry",value:(q=i(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e,i){var o=new l;t.on("error",i),o.on("error",i),o.on("finish",(function(){r.themes[n]=o.read().toString(),e()})),t.pipe(o)}));case 2:case"end":return e.stop()}}),e)}))),function(e,t,r){return q.apply(this,arguments)})},{key:"createInputStream",value:function(){throw new Error("`XLSX#createInputStream` is deprecated. You should use `XLSX#read` instead. This method will be removed in version 5.0. Please follow upgrade instruction: https://github.com/exceljs/exceljs/blob/master/UPGRADE-4.0.md")}},{key:"read",value:(V=i(regeneratorRuntime.mark((function e(t,n){var i,o,s,u,f,l,h,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:!t[Symbol.asyncIterator]&&t.pipe&&(t=t.pipe(new c)),i=[],o=!0,s=!1,e.prev=4,f=a(t);case 6:return e.next=8,f.next();case 8:return l=e.sent,o=l.done,e.next=12,l.value;case 12:if(h=e.sent,o){e.next=19;break}d=h,i.push(d);case 16:o=!0,e.next=6;break;case 19:e.next=25;break;case 21:e.prev=21,e.t0=e.catch(4),s=!0,u=e.t0;case 25:if(e.prev=25,e.prev=26,o||null==f.return){e.next=30;break}return e.next=30,f.return();case 30:if(e.prev=30,!s){e.next=33;break}throw u;case 33:return e.finish(30);case 34:return e.finish(25);case 35:return e.abrupt("return",this.load(r.concat(i),n));case 36:case"end":return e.stop()}}),e,this,[[4,21,25,35],[26,,30,34]])}))),function(e,t){return V.apply(this,arguments)})},{key:"load",value:(H=i(regeneratorRuntime.mark((function e(t,n){var i,o,a,s,f,l,h,d,b,v,w,_,k,x,S,O;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n&&n.base64?r.from(t.toString(),"base64"):t,o={worksheets:[],worksheetHash:{},worksheetRels:[],themes:{},media:[],mediaIndex:{},drawings:{},drawingRels:{},comments:{},tables:{},vmlDrawings:{}},e.next=4,u.loadAsync(i);case 4:a=e.sent,s=0,f=Object.values(a.files);case 6:if(!(s0&&(r=new d,o.render(r,e),t.append(r.xml,{name:"xl/comments".concat(e.id,".xml")}),r=new d,a.render(r,e),t.append(r.xml,{name:"xl/drawings/vmlDrawing".concat(e.id,".vml")}))}));case 5:case"end":return e.stop()}}),e)}))),function(e,t){return M.apply(this,arguments)})},{key:"_finalize",value:function(e){var t=this;return new Promise((function(r,n){e.on("finish",(function(){r(t)})),e.on("error",n),e.finalize()}))}},{key:"prepareModel",value:function(e,t){e.creator=e.creator||"ExcelJS",e.lastModifiedBy=e.lastModifiedBy||"ExcelJS",e.created=e.created||new Date,e.modified=e.modified||new Date,e.useSharedStrings=void 0===t.useSharedStrings||t.useSharedStrings,e.useStyles=void 0===t.useStyles||t.useStyles,e.sharedStrings=new y,e.styles=e.useStyles?new p(!0):new p.Mock;var r=new w,n=new _;r.prepare(e);var i={sharedStrings:e.sharedStrings,styles:e.styles,date1904:e.properties.date1904,drawingsCount:0,media:e.media};i.drawings=e.drawings=[],i.commentRefs=e.commentRefs=[];var o=0;e.tables=[],e.worksheets.forEach((function(t){t.tables.forEach((function(t){o++,t.target="table".concat(o,".xml"),t.id=o,e.tables.push(t)})),n.prepare(t,i)}))}},{key:"write",value:(C=i(regeneratorRuntime.mark((function e(t,r){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=r||{},n=this.workbook.model,(i=new f.ZipWriter(r.zip)).pipe(t),this.prepareModel(n,r),e.next=7,this.addContentTypes(i,n);case 7:return e.next=9,this.addOfficeRels(i,n);case 9:return e.next=11,this.addWorkbookRels(i,n);case 11:return e.next=13,this.addWorksheets(i,n);case 13:return e.next=15,this.addSharedStrings(i,n);case 15:return e.next=17,this.addDrawings(i,n);case 17:return e.next=19,this.addTables(i,n);case 19:return e.next=21,Promise.all([this.addThemes(i,n),this.addStyles(i,n)]);case 21:return e.next=23,this.addMedia(i,n);case 23:return e.next=25,Promise.all([this.addApp(i,n),this.addCore(i,n)]);case 25:return e.next=27,this.addWorkbook(i,n);case 27:return e.abrupt("return",this._finalize(i));case 28:case"end":return e.stop()}}),e,this)}))),function(e,t){return C.apply(this,arguments)})},{key:"writeFile",value:function(e,t){var r=this,n=s.createWriteStream(e);return new Promise((function(e,i){n.on("finish",(function(){e()})),n.on("error",(function(e){i(e)})),r.write(n,t).then((function(){n.end()}))}))}},{key:"writeBuffer",value:(T=i(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new l,e.next=3,this.write(r,t);case 3:return e.abrupt("return",r.read());case 4:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})}])&&o(t.prototype,n),R&&o(t,R),e}();R.RelType=e("./rel-type"),t.exports=R}).call(this,e("buffer").Buffer)},{"../utils/stream-buf":21,"../utils/utils":24,"../utils/xml-stream":25,"../utils/zip-stream":26,"./rel-type":28,"./xform/book/workbook-xform":35,"./xform/comment/comments-xform":37,"./xform/comment/vml-notes-xform":42,"./xform/core/app-xform":48,"./xform/core/content-types-xform":49,"./xform/core/core-xform":50,"./xform/core/relationships-xform":52,"./xform/drawing/drawing-xform":59,"./xform/sheet/worksheet-xform":112,"./xform/strings/shared-strings-xform":121,"./xform/style/styles-xform":132,"./xform/table/table-xform":138,"./xml/theme1.js":140,buffer:214,fs:213,jszip:376,"readable-stream":467}],140:[function(e,t,r){t.exports='\n '},{}],141:[function(e,t,r){(function(t){Object.defineProperty(r,"__esModule",{value:!0}),r.CsvFormatterStream=void 0;var n=e("stream"),i=e("./formatter"),o=function(e){_inherits2(n,e);var r=_createSuper2(n);function n(e){var t;return _classCallCheck2(this,n),(t=r.call(this,{writableObjectMode:e.objectMode})).hasWrittenBOM=!1,t.formatterOptions=e,t.rowFormatter=new i.RowFormatter(e),t.hasWrittenBOM=!e.writeBOM,t}return _createClass2(n,[{key:"transform",value:function(e){return this.rowFormatter.rowTransform=e,this}},{key:"_transform",value:function(e,r,n){var i=this,o=!1;try{this.hasWrittenBOM||(this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0),this.rowFormatter.format(e,(function(e,r){return e?(o=!0,n(e)):(r&&r.forEach((function(e){i.push(t.from(e,"utf8"))})),o=!0,n())}))}catch(e){if(o)throw e;n(e)}}},{key:"_flush",value:function(e){var r=this;this.rowFormatter.finish((function(n,i){return n?e(n):(i&&i.forEach((function(e){r.push(t.from(e,"utf8"))})),e())}))}}]),n}(n.Transform);r.CsvFormatterStream=o}).call(this,e("buffer").Buffer)},{"./formatter":145,buffer:214,stream:481}],142:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.FormatterOptions=void 0;r.FormatterOptions=function e(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck2(this,e),this.objectMode=!0,this.delimiter=",",this.rowDelimiter="\n",this.quote='"',this.escape=this.quote,this.quoteColumns=!1,this.quoteHeaders=this.quoteColumns,this.headers=null,this.includeEndRowDelimiter=!1,this.writeBOM=!1,this.BOM="\ufeff",this.alwaysWriteHeaders=!1,Object.assign(this,r||{}),void 0===(null==r?void 0:r.quoteHeaders)&&(this.quoteHeaders=this.quoteColumns),!0===(null==r?void 0:r.quote)?this.quote='"':!1===(null==r?void 0:r.quote)&&(this.quote=""),"string"!=typeof(null==r?void 0:r.escape)&&(this.escape=this.quote),this.shouldWriteHeaders=!!this.headers&&(null===(t=r.writeHeaders)||void 0===t||t),this.headers=Array.isArray(this.headers)?this.headers:null,this.escapedQuote="".concat(this.escape).concat(this.quote)}},{}],143:[function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.FieldFormatter=void 0;var i=n(e("lodash.isboolean")),o=n(e("lodash.isnil")),a=n(e("lodash.escaperegexp")),s=function(){function e(t){_classCallCheck2(this,e),this._headers=null,this.formatterOptions=t,null!==t.headers&&(this.headers=t.headers),this.REPLACE_REGEXP=new RegExp(t.quote,"g");var r="[".concat(t.delimiter).concat(a.default(t.rowDelimiter),"|\r|\n']");this.ESCAPE_REGEXP=new RegExp(r)}return _createClass2(e,[{key:"shouldQuote",value:function(e,t){var r=t?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;return i.default(r)?r:Array.isArray(r)?r[e]:null!==this._headers&&r[this._headers[e]]}},{key:"format",value:function(e,t,r){var n="".concat(o.default(e)?"":e).replace(/\0/g,""),i=this.formatterOptions;if(""!==i.quote&&-1!==n.indexOf(i.quote))return this.quoteField(n.replace(this.REPLACE_REGEXP,i.escapedQuote));return-1!==n.search(this.ESCAPE_REGEXP)||this.shouldQuote(t,r)?this.quoteField(n):n}},{key:"quoteField",value:function(e){var t=this.formatterOptions.quote;return"".concat(t).concat(e).concat(t)}},{key:"headers",set:function(e){this._headers=e}}]),e}();r.FieldFormatter=s},{"lodash.escaperegexp":403,"lodash.isboolean":405,"lodash.isnil":408}],144:[function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.RowFormatter=void 0;var i=n(e("lodash.isfunction")),o=n(e("lodash.isequal")),a=e("./FieldFormatter"),s=e("../types"),u=function(){function e(t){_classCallCheck2(this,e),this.rowCount=0,this.formatterOptions=t,this.fieldFormatter=new a.FieldFormatter(t),this.headers=t.headers,this.shouldWriteHeaders=t.shouldWriteHeaders,this.hasWrittenHeaders=!1,null!==this.headers&&(this.fieldFormatter.headers=this.headers),t.transform&&(this.rowTransform=t.transform)}return _createClass2(e,[{key:"format",value:function(e,t){var r=this;this.callTransformer(e,(function(n,i){if(n)return t(n);if(!e)return t(null);var o=[];if(i){var a=r.checkHeaders(i),s=a.shouldFormatColumns,u=a.headers;if(r.shouldWriteHeaders&&u&&!r.hasWrittenHeaders&&(o.push(r.formatColumns(u,!0)),r.hasWrittenHeaders=!0),s){var c=r.gatherColumns(i);o.push(r.formatColumns(c,!1))}}return t(null,o)}))}},{key:"finish",value:function(e){var t=[];if(this.formatterOptions.alwaysWriteHeaders&&0===this.rowCount){if(!this.headers)return e(new Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));t.push(this.formatColumns(this.headers,!0))}return this.formatterOptions.includeEndRowDelimiter&&t.push(this.formatterOptions.rowDelimiter),e(null,t)}},{key:"checkHeaders",value:function(t){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};var r=e.gatherHeaders(t);return this.headers=r,this.fieldFormatter.headers=r,this.shouldWriteHeaders?{shouldFormatColumns:!o.default(r,t),headers:r}:{shouldFormatColumns:!0,headers:null}}},{key:"gatherColumns",value:function(t){if(null===this.headers)throw new Error("Headers is currently null");return Array.isArray(t)?e.isHashArray(t)?this.headers.map((function(e,r){var n=t[r];return n?n[1]:""})):this.headers.map((function(e,r){return t[r]})):this.headers.map((function(e){return t[e]}))}},{key:"callTransformer",value:function(e,t){return this._rowTransform?this._rowTransform(e,t):t(null,e)}},{key:"formatColumns",value:function(e,t){var r=this,n=e.map((function(e,n){return r.fieldFormatter.format(e,n,t)})).join(this.formatterOptions.delimiter),i=this.rowCount;return this.rowCount+=1,i?[this.formatterOptions.rowDelimiter,n].join(""):n}},{key:"rowTransform",set:function(t){if(!i.default(t))throw new TypeError("The transform should be a function");this._rowTransform=e.createTransform(t)}}],[{key:"isHashArray",value:function(e){return!!Array.isArray(e)&&(Array.isArray(e[0])&&2===e[0].length)}},{key:"gatherHeaders",value:function(t){return e.isHashArray(t)?t.map((function(e){return e[0]})):Array.isArray(t)?t:Object.keys(t)}},{key:"createTransform",value:function(e){return s.isSyncTransform(e)?function(t,r){var n=null;try{n=e(t)}catch(e){return r(e)}return r(null,n)}:function(t,r){e(t,r)}}}]),e}();r.RowFormatter=u},{"../types":147,"./FieldFormatter":143,"lodash.isequal":406,"lodash.isfunction":407}],145:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./RowFormatter");Object.defineProperty(r,"RowFormatter",{enumerable:!0,get:function(){return n.RowFormatter}});var i=e("./FieldFormatter");Object.defineProperty(r,"FieldFormatter",{enumerable:!0,get:function(){return i.FieldFormatter}})},{"./FieldFormatter":143,"./RowFormatter":144}],146:[function(e,t,r){(function(t){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),r.writeToPath=r.writeToString=r.writeToBuffer=r.writeToStream=r.write=r.format=void 0;var s=e("util"),u=e("stream"),c=o(e("fs")),f=e("./FormatterOptions"),l=e("./CsvFormatterStream");a(e("./types"),r);var h=e("./CsvFormatterStream");Object.defineProperty(r,"CsvFormatterStream",{enumerable:!0,get:function(){return h.CsvFormatterStream}});var d=e("./FormatterOptions");Object.defineProperty(r,"FormatterOptions",{enumerable:!0,get:function(){return d.FormatterOptions}}),r.format=function(e){return new l.CsvFormatterStream(new f.FormatterOptions(e))},r.write=function(e,t){var n=r.format(t),i=s.promisify((function(e,t){n.write(e,void 0,t)}));return e.reduce((function(e,t){return e.then((function(){return i(t)}))}),Promise.resolve()).then((function(){return n.end()})).catch((function(e){n.emit("error",e)})),n},r.writeToStream=function(e,t,n){return r.write(t,n).pipe(e)},r.writeToBuffer=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=[],o=new u.Writable({write:function(e,t,r){i.push(e),r()}});return new Promise((function(a,s){o.on("error",s).on("finish",(function(){return a(t.concat(i))})),r.write(e,n).pipe(o)}))},r.writeToString=function(e,t){return r.writeToBuffer(e,t).then((function(e){return e.toString()}))},r.writeToPath=function(e,t,n){var i=c.createWriteStream(e,{encoding:"utf8"});return r.write(t,n).pipe(i)}}).call(this,e("buffer").Buffer)},{"./CsvFormatterStream":141,"./FormatterOptions":142,"./types":147,buffer:214,fs:213,stream:481,util:500}],147:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.isSyncTransform=void 0,r.isSyncTransform=function(e){return 1===e.length}},{}],148:[function(e,t,r){(function(t){Object.defineProperty(r,"__esModule",{value:!0}),r.CsvParserStream=void 0;var n=e("string_decoder"),i=e("stream"),o=e("./transforms"),a=e("./parser"),s=function(e){_inherits2(i,e);var r=_createSuper2(i);function i(e){var t;return _classCallCheck2(this,i),(t=r.call(this,{objectMode:e.objectMode})).lines="",t.rowCount=0,t.parsedRowCount=0,t.parsedLineCount=0,t.endEmitted=!1,t.headersEmitted=!1,t.parserOptions=e,t.parser=new a.Parser(e),t.headerTransformer=new o.HeaderTransformer(e),t.decoder=new n.StringDecoder(e.encoding),t.rowTransformerValidator=new o.RowTransformerValidator,t}return _createClass2(i,[{key:"transform",value:function(e){return this.rowTransformerValidator.rowTransform=e,this}},{key:"validate",value:function(e){return this.rowTransformerValidator.rowValidator=e,this}},{key:"emit",value:function(e){var t;if("end"===e)return this.endEmitted||(this.endEmitted=!0,_get(_getPrototypeOf2(i.prototype),"emit",this).call(this,"end",this.rowCount)),!1;for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o=i||n.hasHitRowLimit)return r();if(n.parsedLineCount+=1,n.shouldSkipLine)return s();var u=e[a];n.rowCount+=1,n.parsedRowCount+=1;var c=n.rowCount;return n.transformRow(u,(function(e,t){if(e)return n.rowCount-=1,s(e);if(!t)return s(new Error("expected transform result"));if(t.isValid){if(t.row)return n.pushRow(t.row,s)}else n.emit("data-invalid",t.row,c,t.reason);return s()}))}(0)}},{key:"transformRow",value:function(e,t){var r=this;try{this.headerTransformer.transform(e,(function(n,i){return n?t(n):i?i.isValid?i.row?r.shouldEmitRows?r.rowTransformerValidator.transformAndValidate(i.row,t):r.skipRow(t):(r.rowCount-=1,r.parsedRowCount-=1,t(null,{row:null,isValid:!0})):r.shouldEmitRows?t(null,{isValid:!1,row:e}):r.skipRow(t):t(new Error("Expected result from header transform"))}))}catch(e){t(e)}}},{key:"checkAndEmitHeaders",value:function(){!this.headersEmitted&&this.headerTransformer.headers&&(this.headersEmitted=!0,this.emit("headers",this.headerTransformer.headers))}},{key:"skipRow",value:function(e){return this.rowCount-=1,e(null,{row:null,isValid:!0})}},{key:"pushRow",value:function(e,t){try{this.parserOptions.objectMode?this.push(e):this.push(JSON.stringify(e)),t()}catch(e){t(e)}}},{key:"hasHitRowLimit",get:function(){return this.parserOptions.limitRows&&this.rowCount>=this.parserOptions.maxRows}},{key:"shouldEmitRows",get:function(){return this.parsedRowCount>this.parserOptions.skipRows}},{key:"shouldSkipLine",get:function(){return this.parsedLineCount<=this.parserOptions.skipLines}}]),i}(i.Transform);r.CsvParserStream=s}).call(this,e("timers").setImmediate)},{"./parser":160,"./transforms":163,stream:481,string_decoder:495,timers:496}],149:[function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.ParserOptions=void 0;var i=n(e("lodash.escaperegexp")),o=n(e("lodash.isnil"));r.ParserOptions=function e(t){var r;if(_classCallCheck2(this,e),this.objectMode=!0,this.delimiter=",",this.ignoreEmpty=!1,this.quote='"',this.escape=null,this.escapeChar=this.quote,this.comment=null,this.supportsComments=!1,this.ltrim=!1,this.rtrim=!1,this.trim=!1,this.headers=null,this.renameHeaders=!1,this.strictColumnHandling=!1,this.discardUnmappedColumns=!1,this.carriageReturn="\r",this.encoding="utf8",this.limitRows=!1,this.maxRows=0,this.skipLines=0,this.skipRows=0,Object.assign(this,t||{}),this.delimiter.length>1)throw new Error("delimiter option must be one character long");this.escapedDelimiter=i.default(this.delimiter),this.escapeChar=null!==(r=this.escape)&&void 0!==r?r:this.quote,this.supportsComments=!o.default(this.comment),this.NEXT_TOKEN_REGEXP=new RegExp("([^\\s]|\\r\\n|\\n|\\r|".concat(this.escapedDelimiter,")")),this.maxRows>0&&(this.limitRows=!0)}},{"lodash.escaperegexp":403,"lodash.isnil":408}],150:[function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),r.parseString=r.parseFile=r.parseStream=r.parse=void 0;var s=o(e("fs")),u=e("stream"),c=e("./ParserOptions"),f=e("./CsvParserStream");a(e("./types"),r);var l=e("./CsvParserStream");Object.defineProperty(r,"CsvParserStream",{enumerable:!0,get:function(){return l.CsvParserStream}});var h=e("./ParserOptions");Object.defineProperty(r,"ParserOptions",{enumerable:!0,get:function(){return h.ParserOptions}}),r.parse=function(e){return new f.CsvParserStream(new c.ParserOptions(e))},r.parseStream=function(e,t){return e.pipe(new f.CsvParserStream(new c.ParserOptions(t)))},r.parseFile=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s.createReadStream(e).pipe(new f.CsvParserStream(new c.ParserOptions(t)))},r.parseString=function(e,t){var r=new u.Readable;return r.push(e),r.push(null),r.pipe(new f.CsvParserStream(new c.ParserOptions(t)))}},{"./CsvParserStream":148,"./ParserOptions":149,"./types":164,fs:213,stream:481}],151:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.Parser=void 0;var n=e("./Scanner"),i=e("./RowParser"),o=e("./Token"),a=/^\s*(?:''|"")?\s*(?:,\s*(?:''|"")?\s*)*$/,s=function(){function e(t){_classCallCheck2(this,e),this.parserOptions=t,this.rowParser=new i.RowParser(this.parserOptions)}return _createClass2(e,[{key:"parse",value:function(t,r){var i=new n.Scanner({line:e.removeBOM(t),parserOptions:this.parserOptions,hasMoreData:r});return this.parserOptions.supportsComments?this.parseWithComments(i):this.parseWithoutComments(i)}},{key:"parseWithoutComments",value:function(e){for(var t=[],r=!0;r;)r=this.parseRow(e,t);return{line:e.line,rows:t}}},{key:"parseWithComments",value:function(e){for(var t=this.parserOptions,r=[],n=e.nextCharacterToken;null!==n;n=e.nextCharacterToken)if(o.Token.isTokenComment(n,t)){if(null===e.advancePastLine())return{line:e.lineFromCursor,rows:r};if(!e.hasMoreCharacters)return{line:e.lineFromCursor,rows:r};e.truncateToCursor()}else if(!this.parseRow(e,r))break;return{line:e.line,rows:r}}},{key:"parseRow",value:function(e,t){if(!e.nextNonSpaceToken)return!1;var r=this.rowParser.parse(e);return null!==r&&(this.parserOptions.ignoreEmpty&&a.test(r.join(""))||t.push(r),!0)}}],[{key:"removeBOM",value:function(e){return e&&65279===e.charCodeAt(0)?e.slice(1):e}}]),e}();r.Parser=s},{"./RowParser":152,"./Scanner":153,"./Token":154}],152:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.RowParser=void 0;var n=e("./column"),i=e("./Token").Token,o=i.isTokenRowDelimiter,a=i.isTokenCarriageReturn,s=i.isTokenDelimiter,u=function(){function e(t){_classCallCheck2(this,e),this.parserOptions=t,this.columnParser=new n.ColumnParser(t)}return _createClass2(e,[{key:"parse",value:function(e){for(var t=this.parserOptions,r=e.hasMoreData,n=e,i=[],s=this.getStartToken(n,i);s;){if(o(s))return n.advancePastToken(s),!n.hasMoreCharacters&&a(s,t)&&r?null:(n.truncateToCursor(),i);if(!this.shouldSkipColumnParse(n,s,i)){var u=this.columnParser.parse(n);if(null===u)return null;i.push(u)}s=n.nextNonSpaceToken}return r?null:(n.truncateToCursor(),i)}},{key:"getStartToken",value:function(e,t){var r=e.nextNonSpaceToken;return null!==r&&s(r,this.parserOptions)?(t.push(""),e.nextNonSpaceToken):r}},{key:"shouldSkipColumnParse",value:function(e,t,r){var n=this.parserOptions;if(s(t,n)){e.advancePastToken(t);var i=e.nextCharacterToken;if(!e.hasMoreCharacters||null!==i&&o(i))return r.push(""),!0;if(null!==i&&s(i,n))return r.push(""),!0}return!1}}]),e}();r.RowParser=u},{"./Token":154,"./column":159}],153:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.Scanner=void 0;var n=e("./Token"),i=/((?:\r\n)|\n|\r)/,o=function(){function e(t){_classCallCheck2(this,e),this.cursor=0,this.line=t.line,this.lineLength=this.line.length,this.parserOptions=t.parserOptions,this.hasMoreData=t.hasMoreData,this.cursor=t.cursor||0}return _createClass2(e,[{key:"advancePastLine",value:function(){var e=i.exec(this.lineFromCursor);return e?(this.cursor+=(e.index||0)+e[0].length,this):this.hasMoreData?null:(this.cursor=this.lineLength,this)}},{key:"advanceTo",value:function(e){return this.cursor=e,this}},{key:"advanceToToken",value:function(e){return this.cursor=e.startCursor,this}},{key:"advancePastToken",value:function(e){return this.cursor=e.endCursor+1,this}},{key:"truncateToCursor",value:function(){return this.line=this.lineFromCursor,this.lineLength=this.line.length,this.cursor=0,this}},{key:"hasMoreCharacters",get:function(){return this.lineLength>this.cursor}},{key:"nextNonSpaceToken",get:function(){var e=this.lineFromCursor,t=this.parserOptions.NEXT_TOKEN_REGEXP;if(-1===e.search(t))return null;var r=t.exec(e);if(null==r)return null;var i=r[1],o=this.cursor+(r.index||0);return new n.Token({token:i,startCursor:o,endCursor:o+i.length-1})}},{key:"nextCharacterToken",get:function(){var e=this.cursor;return this.lineLength<=e?null:new n.Token({token:this.line[e],startCursor:e,endCursor:e})}},{key:"lineFromCursor",get:function(){return this.line.substr(this.cursor)}}]),e}();r.Scanner=o},{"./Token":154}],154:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.Token=void 0;var n=function(){function e(t){_classCallCheck2(this,e),this.token=t.token,this.startCursor=t.startCursor,this.endCursor=t.endCursor}return _createClass2(e,null,[{key:"isTokenRowDelimiter",value:function(e){var t=e.token;return"\r"===t||"\n"===t||"\r\n"===t}},{key:"isTokenCarriageReturn",value:function(e,t){return e.token===t.carriageReturn}},{key:"isTokenComment",value:function(e,t){return t.supportsComments&&!!e&&e.token===t.comment}},{key:"isTokenEscapeCharacter",value:function(e,t){return e.token===t.escapeChar}},{key:"isTokenQuote",value:function(e,t){return e.token===t.quote}},{key:"isTokenDelimiter",value:function(e,t){return e.token===t.delimiter}}]),e}();r.Token=n},{}],155:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.ColumnFormatter=void 0;r.ColumnFormatter=function e(t){_classCallCheck2(this,e),t.trim?this.format=function(e){return e.trim()}:t.ltrim?this.format=function(e){return e.trimLeft()}:t.rtrim?this.format=function(e){return e.trimRight()}:this.format=function(e){return e}}},{}],156:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.ColumnParser=void 0;var n=e("./NonQuotedColumnParser"),i=e("./QuotedColumnParser"),o=e("../Token"),a=function(){function e(t){_classCallCheck2(this,e),this.parserOptions=t,this.quotedColumnParser=new i.QuotedColumnParser(t),this.nonQuotedColumnParser=new n.NonQuotedColumnParser(t)}return _createClass2(e,[{key:"parse",value:function(e){var t=e.nextNonSpaceToken;return null!==t&&o.Token.isTokenQuote(t,this.parserOptions)?(e.advanceToToken(t),this.quotedColumnParser.parse(e)):this.nonQuotedColumnParser.parse(e)}}]),e}();r.ColumnParser=a},{"../Token":154,"./NonQuotedColumnParser":157,"./QuotedColumnParser":158}],157:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.NonQuotedColumnParser=void 0;var n=e("./ColumnFormatter"),i=e("../Token").Token,o=i.isTokenDelimiter,a=i.isTokenRowDelimiter,s=function(){function e(t){_classCallCheck2(this,e),this.parserOptions=t,this.columnFormatter=new n.ColumnFormatter(t)}return _createClass2(e,[{key:"parse",value:function(e){if(!e.hasMoreCharacters)return null;for(var t=this.parserOptions,r=[],n=e.nextCharacterToken;n&&(!o(n,t)&&!a(n));n=e.nextCharacterToken)r.push(n.token),e.advancePastToken(n);return this.columnFormatter.format(r.join(""))}}]),e}();r.NonQuotedColumnParser=s},{"../Token":154,"./ColumnFormatter":155}],158:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.QuotedColumnParser=void 0;var n=e("./ColumnFormatter"),i=e("../Token").Token,o=i.isTokenDelimiter,a=i.isTokenRowDelimiter,s=i.isTokenEscapeCharacter,u=i.isTokenQuote,c=function(){function e(t){_classCallCheck2(this,e),this.parserOptions=t,this.columnFormatter=new n.ColumnFormatter(t)}return _createClass2(e,[{key:"parse",value:function(e){if(!e.hasMoreCharacters)return null;var t=e.cursor,r=this.gatherDataBetweenQuotes(e),n=r.foundClosingQuote,i=r.col;if(!n){if(e.advanceTo(t),!e.hasMoreData)throw new Error("Parse Error: missing closing: '".concat(this.parserOptions.quote||"","' in line: at '").concat(e.lineFromCursor.replace(/[\r\n]/g,"\\n'"),"'"));return null}return this.checkForMalformedColumn(e),i}},{key:"gatherDataBetweenQuotes",value:function(e){for(var t=this.parserOptions,r=!1,n=!1,i=[],o=e.nextCharacterToken;!n&&null!==o;o=e.nextCharacterToken){var a=u(o,t);if(!r&&a)r=!0;else if(r)if(s(o,t)){e.advancePastToken(o);var c=e.nextCharacterToken;null!==c&&(u(c,t)||s(c,t))?(i.push(c.token),o=c):a?n=!0:i.push(o.token)}else a?n=!0:i.push(o.token);e.advancePastToken(o)}return{col:this.columnFormatter.format(i.join("")),foundClosingQuote:n}}},{key:"checkForMalformedColumn",value:function(e){var t=this.parserOptions,r=e.nextNonSpaceToken;if(r){var n=o(r,t),i=a(r);if(!n&&!i){var s=e.lineFromCursor.substr(0,10).replace(/[\r\n]/g,"\\n'");throw new Error("Parse Error: expected: '".concat(t.escapedDelimiter,"' OR new line got: '").concat(r.token,"'. at '").concat(s))}e.advanceToToken(r)}else e.hasMoreData||e.advancePastLine()}}]),e}();r.QuotedColumnParser=c},{"../Token":154,"./ColumnFormatter":155}],159:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./ColumnParser");Object.defineProperty(r,"ColumnParser",{enumerable:!0,get:function(){return n.ColumnParser}});var i=e("./NonQuotedColumnParser");Object.defineProperty(r,"NonQuotedColumnParser",{enumerable:!0,get:function(){return i.NonQuotedColumnParser}});var o=e("./QuotedColumnParser");Object.defineProperty(r,"QuotedColumnParser",{enumerable:!0,get:function(){return o.QuotedColumnParser}});var a=e("./ColumnFormatter");Object.defineProperty(r,"ColumnFormatter",{enumerable:!0,get:function(){return a.ColumnFormatter}})},{"./ColumnFormatter":155,"./ColumnParser":156,"./NonQuotedColumnParser":157,"./QuotedColumnParser":158}],160:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./Parser");Object.defineProperty(r,"Parser",{enumerable:!0,get:function(){return n.Parser}});var i=e("./RowParser");Object.defineProperty(r,"RowParser",{enumerable:!0,get:function(){return i.RowParser}});var o=e("./Scanner");Object.defineProperty(r,"Scanner",{enumerable:!0,get:function(){return o.Scanner}});var a=e("./Token");Object.defineProperty(r,"Token",{enumerable:!0,get:function(){return a.Token}});var s=e("./column");Object.defineProperty(r,"ColumnParser",{enumerable:!0,get:function(){return s.ColumnParser}}),Object.defineProperty(r,"NonQuotedColumnParser",{enumerable:!0,get:function(){return s.NonQuotedColumnParser}}),Object.defineProperty(r,"QuotedColumnParser",{enumerable:!0,get:function(){return s.QuotedColumnParser}})},{"./Parser":151,"./RowParser":152,"./Scanner":153,"./Token":154,"./column":159}],161:[function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.HeaderTransformer=void 0;var i=n(e("lodash.isundefined")),o=n(e("lodash.isfunction")),a=n(e("lodash.uniq")),s=n(e("lodash.groupby")),u=function(){function e(t){_classCallCheck2(this,e),this.headers=null,this.receivedHeaders=!1,this.shouldUseFirstRow=!1,this.processedFirstRow=!1,this.headersLength=0,this.parserOptions=t,!0===t.headers?this.shouldUseFirstRow=!0:Array.isArray(t.headers)?this.setHeaders(t.headers):o.default(t.headers)&&(this.headersTransform=t.headers)}return _createClass2(e,[{key:"transform",value:function(e,t){return this.shouldMapRow(e)?t(null,this.processRow(e)):t(null,{row:null,isValid:!0})}},{key:"shouldMapRow",value:function(e){var t=this.parserOptions;if(!this.headersTransform&&t.renameHeaders&&!this.processedFirstRow){if(!this.receivedHeaders)throw new Error("Error renaming headers: new headers must be provided in an array");return this.processedFirstRow=!0,!1}if(!this.receivedHeaders&&Array.isArray(e)){if(this.headersTransform)this.setHeaders(this.headersTransform(e));else{if(!this.shouldUseFirstRow)return!0;this.setHeaders(e)}return!1}return!0}},{key:"processRow",value:function(e){if(!this.headers)return{row:e,isValid:!0};var t=this.parserOptions;if(!t.discardUnmappedColumns&&e.length>this.headersLength){if(!t.strictColumnHandling)throw new Error("Unexpected Error: column header mismatch expected: ".concat(this.headersLength," columns got: ").concat(e.length));return{row:e,isValid:!1,reason:"Column header mismatch expected: ".concat(this.headersLength," columns got: ").concat(e.length)}}return t.strictColumnHandling&&e.length1}));throw new Error("Duplicate headers found ".concat(JSON.stringify(i)))}this.headers=e,this.receivedHeaders=!0,this.headersLength=(null===(t=this.headers)||void 0===t?void 0:t.length)||0}}]),e}();r.HeaderTransformer=u},{"lodash.groupby":404,"lodash.isfunction":407,"lodash.isundefined":409,"lodash.uniq":410}],162:[function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.RowTransformerValidator=void 0;var i=n(e("lodash.isfunction")),o=e("../types"),a=function(){function e(){_classCallCheck2(this,e),this._rowTransform=null,this._rowValidator=null}return _createClass2(e,[{key:"transformAndValidate",value:function(e,t){var r=this;return this.callTransformer(e,(function(e,n){return e?t(e):n?r.callValidator(n,(function(e,r){return e?t(e):r&&!r.isValid?t(null,{row:n,isValid:!1,reason:r.reason}):t(null,{row:n,isValid:!0})})):t(null,{row:null,isValid:!0})}))}},{key:"callTransformer",value:function(e,t){return this._rowTransform?this._rowTransform(e,t):t(null,e)}},{key:"callValidator",value:function(e,t){return this._rowValidator?this._rowValidator(e,t):t(null,{row:e,isValid:!0})}},{key:"rowTransform",set:function(t){if(!i.default(t))throw new TypeError("The transform should be a function");this._rowTransform=e.createTransform(t)}},{key:"rowValidator",set:function(t){if(!i.default(t))throw new TypeError("The validate should be a function");this._rowValidator=e.createValidator(t)}}],[{key:"createTransform",value:function(e){return o.isSyncTransform(e)?function(t,r){var n=null;try{n=e(t)}catch(e){return r(e)}return r(null,n)}:e}},{key:"createValidator",value:function(e){return o.isSyncValidate(e)?function(t,r){r(null,{row:t,isValid:e(t)})}:function(t,r){e(t,(function(e,n,i){return e?r(e):r(null,n?{row:t,isValid:n,reason:i}:{row:t,isValid:!1,reason:i})}))}}}]),e}();r.RowTransformerValidator=a},{"../types":164,"lodash.isfunction":407}],163:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./RowTransformerValidator");Object.defineProperty(r,"RowTransformerValidator",{enumerable:!0,get:function(){return n.RowTransformerValidator}});var i=e("./HeaderTransformer");Object.defineProperty(r,"HeaderTransformer",{enumerable:!0,get:function(){return i.HeaderTransformer}})},{"./HeaderTransformer":161,"./RowTransformerValidator":162}],164:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.isSyncValidate=r.isSyncTransform=void 0,r.isSyncTransform=function(e){return 1===e.length},r.isSyncValidate=function(e){return 1===e.length}},{}],165:[function(e,t,r){var n=r;n.bignum=e("bn.js"),n.define=e("./asn1/api").define,n.base=e("./asn1/base"),n.constants=e("./asn1/constants"),n.decoders=e("./asn1/decoders"),n.encoders=e("./asn1/encoders")},{"./asn1/api":166,"./asn1/base":168,"./asn1/constants":172,"./asn1/decoders":174,"./asn1/encoders":177,"bn.js":179}],166:[function(e,t,r){var n=e("../asn1"),i=e("inherits");function o(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}r.define=function(e,t){return new o(e,t)},o.prototype._createNamed=function(t){var r;try{r=e("vm").runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){r=function(e){this._initNamed(e)}}return i(r,t),r.prototype._initNamed=function(e){t.call(this,e)},new r(this)},o.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(n.decoders[e])),this.decoders[e]},o.prototype.decode=function(e,t,r){return this._getDecoder(t).decode(e,r)},o.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(n.encoders[e])),this.encoders[e]},o.prototype.encode=function(e,t,r){return this._getEncoder(t).encode(e,r)}},{"../asn1":165,inherits:364,vm:511}],167:[function(e,t,r){var n=e("inherits"),i=e("../base").Reporter,o=e("buffer").Buffer;function a(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function s(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return e instanceof s||(e=new s(e,t)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+_typeof2(e));this.value=e,this.length=e.length}}n(a,i),r.DecoderBuffer=a,a.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},a.prototype.restore=function(e){var t=new a(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,i.prototype.restore.call(this,e.reporter),t},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},a.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var r=new a(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},a.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},r.EncoderBuffer=s,s.prototype.join=function(e,t){return e||(e=new o(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(e,t),t+=r.length})):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):o.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e}},{"../base":168,buffer:214,inherits:364}],168:[function(e,t,r){var n=r;n.Reporter=e("./reporter").Reporter,n.DecoderBuffer=e("./buffer").DecoderBuffer,n.EncoderBuffer=e("./buffer").EncoderBuffer,n.Node=e("./node")},{"./buffer":167,"./node":169,"./reporter":170}],169:[function(e,t,r){var n=e("../base").Reporter,i=e("../base").EncoderBuffer,o=e("../base").DecoderBuffer,a=e("minimalistic-assert"),s=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function c(e,t){var r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}t.exports=c;var f=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];c.prototype.clone=function(){var e=this._baseState,t={};f.forEach((function(r){t[r]=e[r]}));var r=new this.constructor(t.parent);return r._baseState=t,r},c.prototype._wrap=function(){var e=this._baseState;u.forEach((function(t){this[t]=function(){var r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}}),this)},c.prototype._init=function(e){var t=this._baseState;a(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),a.equal(t.children.length,1,"Root node can have only one child")},c.prototype._useArgs=function(e){var t=this._baseState,r=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==r.length&&(a(null===t.children),t.children=r,r.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(a(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!==_typeof2(e)||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach((function(r){r==(0|r)&&(r|=0);var n=e[r];t[n]=r})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){c.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),s.forEach((function(e){c.prototype[e]=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return a(null===t.tag),t.tag=e,this._useArgs(r),this}})),c.prototype.use=function(e){a(e);var t=this._baseState;return a(null===t.use),t.use=e,this},c.prototype.optional=function(){return this._baseState.optional=!0,this},c.prototype.def=function(e){var t=this._baseState;return a(null===t.default),t.default=e,t.optional=!0,this},c.prototype.explicit=function(e){var t=this._baseState;return a(null===t.explicit&&null===t.implicit),t.explicit=e,this},c.prototype.implicit=function(e){var t=this._baseState;return a(null===t.explicit&&null===t.implicit),t.implicit=e,this},c.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},c.prototype.key=function(e){var t=this._baseState;return a(null===t.key),t.key=e,this},c.prototype.any=function(){return this._baseState.any=!0,this},c.prototype.choice=function(e){var t=this._baseState;return a(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},c.prototype.contains=function(e){var t=this._baseState;return a(null===t.use),t.contains=e,this},c.prototype._decode=function(e,t){var r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));var n,i=r.default,a=!0,s=null;if(null!==r.key&&(s=e.enterKey(r.key)),r.optional){var u=null;if(null!==r.explicit?u=r.explicit:null!==r.implicit?u=r.implicit:null!==r.tag&&(u=r.tag),null!==u||r.any){if(a=this._peekTag(e,u,r.any),e.isError(a))return a}else{var c=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),a=!0}catch(e){a=!1}e.restore(c)}}if(r.obj&&a&&(n=e.enterObject()),a){if(null!==r.explicit){var f=this._decodeTag(e,r.explicit);if(e.isError(f))return f;e=f}var l=e.offset;if(null===r.use&&null===r.choice){if(r.any)c=e.save();var h=this._decodeTag(e,null!==r.implicit?r.implicit:r.tag,r.any);if(e.isError(h))return h;r.any?i=e.raw(c):e=h}if(t&&t.track&&null!==r.tag&&t.track(e.path(),l,e.length,"tagged"),t&&t.track&&null!==r.tag&&t.track(e.path(),e.offset,e.length,"content"),i=r.any?i:null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),e.isError(i))return i;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(e,t)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var d=new o(i);i=this._getUse(r.contains,e._reporterState.obj)._decode(d,t)}}return r.obj&&a&&(i=e.leaveObject(n)),null===r.key||null===i&&!0!==a?null!==s&&e.exitKey(s):e.leaveKey(s,r.key,i),i},c.prototype._decodeGeneric=function(e,t,r){var n=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,n.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&n.args?this._decodeObjid(t,n.args[0],n.args[1],r):"objid"===e?this._decodeObjid(t,null,null,r):"gentime"===e||"utctime"===e?this._decodeTime(t,e,r):"null_"===e?this._decodeNull(t,r):"bool"===e?this._decodeBool(t,r):"objDesc"===e?this._decodeStr(t,e,r):"int"===e||"enum"===e?this._decodeInt(t,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},c.prototype._getUse=function(e,t){var r=this._baseState;return r.useDecoder=this._use(e,t),a(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},c.prototype._decodeChoice=function(e,t){var r=this._baseState,n=null,i=!1;return Object.keys(r.choice).some((function(o){var a=e.save(),s=r.choice[o];try{var u=s._decode(e,t);if(e.isError(u))return!1;n={type:o,value:u},i=!0}catch(t){return e.restore(a),!1}return!0}),this),i?n:e.error("Choice not matched")},c.prototype._createEncoderBuffer=function(e){return new i(e,this.reporter)},c.prototype._encode=function(e,t,r){var n=this._baseState;if(null===n.default||n.default!==e){var i=this._encodeValue(e,t,r);if(void 0!==i&&!this._skipDefault(i,t,r))return i}},c.prototype._encodeValue=function(e,t,r){var i=this._baseState;if(null===i.parent)return i.children[0]._encode(e,t||new n);var o=null;if(this.reporter=t,i.optional&&void 0===e){if(null===i.default)return;e=i.default}var a=null,s=!1;if(i.any)o=this._createEncoderBuffer(e);else if(i.choice)o=this._encodeChoice(e,t);else if(i.contains)a=this._getUse(i.contains,r)._encode(e,t),s=!0;else if(i.children)a=i.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,t,e);if(null===r._baseState.key)return t.error("Child should have a key");var n=t.enterKey(r._baseState.key);if("object"!==_typeof2(e))return t.error("Child expected, but input is not object");var i=r._encode(e[r._baseState.key],t,e);return t.leaveKey(n),i}),this).filter((function(e){return e})),a=this._createEncoderBuffer(a);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return t.error("Too many args for : "+i.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");var u=this.clone();u._baseState.implicit=null,a=this._createEncoderBuffer(e.map((function(r){var n=this._baseState;return this._getUse(n.args[0],e)._encode(r,t)}),u))}else null!==i.use?o=this._getUse(i.use,r)._encode(e,t):(a=this._encodePrimitive(i.tag,e),s=!0);if(!i.any&&null===i.choice){var c=null!==i.implicit?i.implicit:i.tag,f=null===i.implicit?"universal":"context";null===c?null===i.use&&t.error("Tag could be omitted only for .use()"):null===i.use&&(o=this._encodeComposite(c,s,f,a))}return null!==i.explicit&&(o=this._encodeComposite(i.explicit,!1,"context",o)),o},c.prototype._encodeChoice=function(e,t){var r=this._baseState,n=r.choice[e.type];return n||a(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(e.value,t)},c.prototype._encodePrimitive=function(e,t){var r=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&r.args)return this._encodeObjid(t,r.reverseArgs[0],r.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,r.args&&r.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},c.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},c.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}},{"../base":168,"minimalistic-assert":414}],170:[function(e,t,r){var n=e("inherits");function i(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function o(e,t){this.path=e,this.rethrow(t)}r.Reporter=i,i.prototype.isError=function(e){return e instanceof o},i.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},i.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},i.prototype.enterKey=function(e){return this._reporterState.path.push(e)},i.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},i.prototype.leaveKey=function(e,t,r){var n=this._reporterState;this.exitKey(e),null!==n.obj&&(n.obj[t]=r)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},i.prototype.leaveObject=function(e){var t=this._reporterState,r=t.obj;return t.obj=e,r},i.prototype.error=function(e){var t,r=this._reporterState,n=e instanceof o;if(t=n?e:new o(r.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!r.options.partial)throw t;return n||r.errors.push(t),t},i.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},n(o,Error),o.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},{inherits:364}],171:[function(e,t,r){var n=e("../constants");r.tagClass={0:"universal",1:"application",2:"context",3:"private"},r.tagClassByName=n._reverse(r.tagClass),r.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},r.tagByName=n._reverse(r.tag)},{"../constants":172}],172:[function(e,t,r){var n=r;n._reverse=function(e){var t={};return Object.keys(e).forEach((function(r){(0|r)==r&&(r|=0);var n=e[r];t[n]=r})),t},n.der=e("./der")},{"./der":171}],173:[function(e,t,r){var n=e("inherits"),i=e("../../asn1"),o=i.base,a=i.bignum,s=i.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function f(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var n=s.tagClass[r>>6],i=0==(32&r);if(31==(31&r)){var o=r;for(r=0;128==(128&o);){if(o=e.readUInt8(t),e.isError(o))return o;r<<=7,r|=127&o}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:s.tag[r]}}function l(e,t,r){var n=e.readUInt8(r);if(e.isError(n))return n;if(!t&&128===n)return null;if(0==(128&n))return n;var i=127&n;if(i>4)return e.error("length octect is too long");n=0;for(var o=0;o=31)return n.error("Multi-octet tag encoding unsupported");t||(i|=32);return i|=s.tagClassByName[r||"universal"]<<6}(e,t,r,this.reporter);if(n.length<128)return(o=new i(2))[0]=a,o[1]=n.length,this._createEncoderBuffer([o,n]);for(var u=1,c=n.length;c>=256;c>>=8)u++;(o=new i(2+u))[0]=a,o[1]=128|u;c=1+u;for(var f=n.length;f>0;c--,f>>=8)o[c]=255&f;return this._createEncoderBuffer([o,n])},c.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var r=new i(2*e.length),n=0;n=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}var o=0;for(n=0;n=128;a>>=7)o++}var s=new i(o),u=s.length-1;for(n=e.length-1;n>=0;n--){a=e[n];for(s[u--]=127&a;(a>>=7)>0;)s[u--]=128|127&a}return this._createEncoderBuffer(s)},c.prototype._encodeTime=function(e,t){var r,n=new Date(e);return"gentime"===t?r=[f(n.getFullYear()),f(n.getUTCMonth()+1),f(n.getUTCDate()),f(n.getUTCHours()),f(n.getUTCMinutes()),f(n.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[f(n.getFullYear()%100),f(n.getUTCMonth()+1),f(n.getUTCDate()),f(n.getUTCHours()),f(n.getUTCMinutes()),f(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},c.prototype._encodeNull=function(){return this._createEncoderBuffer("")},c.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!i.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new i(r)}if(i.isBuffer(e)){var n=e.length;0===e.length&&n++;var o=new i(n);return e.copy(o),0===e.length&&(o[0]=0),this._createEncoderBuffer(o)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);n=1;for(var a=e;a>=256;a>>=8)n++;for(a=(o=new Array(n)).length-1;a>=0;a--)o[a]=255&e,e>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new i(o))},c.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},c.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},c.prototype._skipDefault=function(e,t,r){var n,i=this._baseState;if(null===i.default)return!1;var o=e.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,t,r).join()),o.length!==i.defaultBuffer.length)return!1;for(n=0;n=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return n}function u(e,t,r,n){for(var i=0,o=Math.min(e.length,r),a=t;a=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"===_typeof2(e)&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"===_typeof2(e))return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=6)i=s(e,r,r+6),this.words[n]|=i<>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);r+6!==t&&(i=s(e,t,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,c=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=h;d++){var p=c-d|0;f+=(a=(i=0|e.words[p])*(o=0|t.words[d])+l)/67108864|0,l=67108863&a}r.words[c]=0|l,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?c[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var h=f[e],d=l[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(e);r=(p=p.idivn(d)).isZero()?m+r:c[h-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return n(void 0!==a),this.toArrayLike(a,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===t,c=new e(o),f=this.clone();if(u){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[s]=a;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,d=0|a[1],p=8191&d,m=d>>>13,y=0|a[2],b=8191&y,v=y>>>13,g=0|a[3],w=8191&g,_=g>>>13,k=0|a[4],x=8191&k,S=k>>>13,O=0|a[5],j=8191&O,E=O>>>13,R=0|a[6],T=8191&R,C=R>>>13,M=0|a[7],P=8191&M,A=M>>>13,I=0|a[8],N=8191&I,D=I>>>13,B=0|a[9],F=8191&B,L=B>>>13,z=0|s[0],U=8191&z,H=z>>>13,V=0|s[1],q=8191&V,W=V>>>13,$=0|s[2],X=8191&$,K=$>>>13,Z=0|s[3],Y=8191&Z,G=Z>>>13,J=0|s[4],Q=8191&J,ee=J>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,fe=0|s[8],le=8191&fe,he=fe>>>13,de=0|s[9],pe=8191&de,me=de>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(c+(n=Math.imul(l,U))|0)+((8191&(i=(i=Math.imul(l,H))+Math.imul(h,U)|0))<<13)|0;c=((o=Math.imul(h,H))+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(p,U),i=(i=Math.imul(p,H))+Math.imul(m,U)|0,o=Math.imul(m,H);var be=(c+(n=n+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,W)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,W)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(b,U),i=(i=Math.imul(b,H))+Math.imul(v,U)|0,o=Math.imul(v,H),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,W)|0;var ve=(c+(n=n+Math.imul(l,X)|0)|0)+((8191&(i=(i=i+Math.imul(l,K)|0)+Math.imul(h,X)|0))<<13)|0;c=((o=o+Math.imul(h,K)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(w,U),i=(i=Math.imul(w,H))+Math.imul(_,U)|0,o=Math.imul(_,H),n=n+Math.imul(b,q)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,W)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,K)|0;var ge=(c+(n=n+Math.imul(l,Y)|0)|0)+((8191&(i=(i=i+Math.imul(l,G)|0)+Math.imul(h,Y)|0))<<13)|0;c=((o=o+Math.imul(h,G)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(x,U),i=(i=Math.imul(x,H))+Math.imul(S,U)|0,o=Math.imul(S,H),n=n+Math.imul(w,q)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(_,q)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(b,X)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,K)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,G)|0;var we=(c+(n=n+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,ee)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(j,U),i=(i=Math.imul(j,H))+Math.imul(E,U)|0,o=Math.imul(E,H),n=n+Math.imul(x,q)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(S,q)|0,o=o+Math.imul(S,W)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,K)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(v,Y)|0,o=o+Math.imul(v,G)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var _e=(c+(n=n+Math.imul(l,re)|0)|0)+((8191&(i=(i=i+Math.imul(l,ne)|0)+Math.imul(h,re)|0))<<13)|0;c=((o=o+Math.imul(h,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(T,U),i=(i=Math.imul(T,H))+Math.imul(C,U)|0,o=Math.imul(C,H),n=n+Math.imul(j,q)|0,i=(i=i+Math.imul(j,W)|0)+Math.imul(E,q)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,K)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,K)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0;var ke=(c+(n=n+Math.imul(l,oe)|0)|0)+((8191&(i=(i=i+Math.imul(l,ae)|0)+Math.imul(h,oe)|0))<<13)|0;c=((o=o+Math.imul(h,ae)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(P,U),i=(i=Math.imul(P,H))+Math.imul(A,U)|0,o=Math.imul(A,H),n=n+Math.imul(T,q)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(C,q)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(j,X)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,K)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(S,Y)|0,o=o+Math.imul(S,G)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(b,re)|0,i=(i=i+Math.imul(b,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var xe=(c+(n=n+Math.imul(l,ue)|0)|0)+((8191&(i=(i=i+Math.imul(l,ce)|0)+Math.imul(h,ue)|0))<<13)|0;c=((o=o+Math.imul(h,ce)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(N,U),i=(i=Math.imul(N,H))+Math.imul(D,U)|0,o=Math.imul(D,H),n=n+Math.imul(P,q)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,W)|0,n=n+Math.imul(T,X)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,K)|0,n=n+Math.imul(j,Y)|0,i=(i=i+Math.imul(j,G)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,G)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,ce)|0;var Se=(c+(n=n+Math.imul(l,le)|0)|0)+((8191&(i=(i=i+Math.imul(l,he)|0)+Math.imul(h,le)|0))<<13)|0;c=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(F,U),i=(i=Math.imul(F,H))+Math.imul(L,U)|0,o=Math.imul(L,H),n=n+Math.imul(N,q)|0,i=(i=i+Math.imul(N,W)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,W)|0,n=n+Math.imul(P,X)|0,i=(i=i+Math.imul(P,K)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,K)|0,n=n+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,G)|0,n=n+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,ee)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(S,re)|0,o=o+Math.imul(S,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,n=n+Math.imul(p,le)|0,i=(i=i+Math.imul(p,he)|0)+Math.imul(m,le)|0,o=o+Math.imul(m,he)|0;var Oe=(c+(n=n+Math.imul(l,pe)|0)|0)+((8191&(i=(i=i+Math.imul(l,me)|0)+Math.imul(h,pe)|0))<<13)|0;c=((o=o+Math.imul(h,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(F,q),i=(i=Math.imul(F,W))+Math.imul(L,q)|0,o=Math.imul(L,W),n=n+Math.imul(N,X)|0,i=(i=i+Math.imul(N,K)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,K)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,G)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,ee)|0,n=n+Math.imul(j,re)|0,i=(i=i+Math.imul(j,ne)|0)+Math.imul(E,re)|0,o=o+Math.imul(E,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,n=n+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,ce)|0,n=n+Math.imul(b,le)|0,i=(i=i+Math.imul(b,he)|0)+Math.imul(v,le)|0,o=o+Math.imul(v,he)|0;var je=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;c=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(F,X),i=(i=Math.imul(F,K))+Math.imul(L,X)|0,o=Math.imul(L,K),n=n+Math.imul(N,Y)|0,i=(i=i+Math.imul(N,G)|0)+Math.imul(D,Y)|0,o=o+Math.imul(D,G)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(C,re)|0,o=o+Math.imul(C,ne)|0,n=n+Math.imul(j,oe)|0,i=(i=i+Math.imul(j,ae)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,ae)|0,n=n+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,n=n+Math.imul(w,le)|0,i=(i=i+Math.imul(w,he)|0)+Math.imul(_,le)|0,o=o+Math.imul(_,he)|0;var Ee=(c+(n=n+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,me)|0)+Math.imul(v,pe)|0))<<13)|0;c=((o=o+Math.imul(v,me)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(F,Y),i=(i=Math.imul(F,G))+Math.imul(L,Y)|0,o=Math.imul(L,G),n=n+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,ee)|0,n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,n=n+Math.imul(j,ue)|0,i=(i=i+Math.imul(j,ce)|0)+Math.imul(E,ue)|0,o=o+Math.imul(E,ce)|0,n=n+Math.imul(x,le)|0,i=(i=i+Math.imul(x,he)|0)+Math.imul(S,le)|0,o=o+Math.imul(S,he)|0;var Re=(c+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(_,pe)|0))<<13)|0;c=((o=o+Math.imul(_,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,ee))+Math.imul(L,Q)|0,o=Math.imul(L,ee),n=n+Math.imul(N,re)|0,i=(i=i+Math.imul(N,ne)|0)+Math.imul(D,re)|0,o=o+Math.imul(D,ne)|0,n=n+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,n=n+Math.imul(T,ue)|0,i=(i=i+Math.imul(T,ce)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,ce)|0,n=n+Math.imul(j,le)|0,i=(i=i+Math.imul(j,he)|0)+Math.imul(E,le)|0,o=o+Math.imul(E,he)|0;var Te=(c+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,me)|0)+Math.imul(S,pe)|0))<<13)|0;c=((o=o+Math.imul(S,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(F,re),i=(i=Math.imul(F,ne))+Math.imul(L,re)|0,o=Math.imul(L,ne),n=n+Math.imul(N,oe)|0,i=(i=i+Math.imul(N,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,n=n+Math.imul(P,ue)|0,i=(i=i+Math.imul(P,ce)|0)+Math.imul(A,ue)|0,o=o+Math.imul(A,ce)|0,n=n+Math.imul(T,le)|0,i=(i=i+Math.imul(T,he)|0)+Math.imul(C,le)|0,o=o+Math.imul(C,he)|0;var Ce=(c+(n=n+Math.imul(j,pe)|0)|0)+((8191&(i=(i=i+Math.imul(j,me)|0)+Math.imul(E,pe)|0))<<13)|0;c=((o=o+Math.imul(E,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(F,oe),i=(i=Math.imul(F,ae))+Math.imul(L,oe)|0,o=Math.imul(L,ae),n=n+Math.imul(N,ue)|0,i=(i=i+Math.imul(N,ce)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,ce)|0,n=n+Math.imul(P,le)|0,i=(i=i+Math.imul(P,he)|0)+Math.imul(A,le)|0,o=o+Math.imul(A,he)|0;var Me=(c+(n=n+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(C,pe)|0))<<13)|0;c=((o=o+Math.imul(C,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(F,ue),i=(i=Math.imul(F,ce))+Math.imul(L,ue)|0,o=Math.imul(L,ce),n=n+Math.imul(N,le)|0,i=(i=i+Math.imul(N,he)|0)+Math.imul(D,le)|0,o=o+Math.imul(D,he)|0;var Pe=(c+(n=n+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(A,pe)|0))<<13)|0;c=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(F,le),i=(i=Math.imul(F,he))+Math.imul(L,le)|0,o=Math.imul(L,he);var Ae=(c+(n=n+Math.imul(N,pe)|0)|0)+((8191&(i=(i=i+Math.imul(N,me)|0)+Math.imul(D,pe)|0))<<13)|0;c=((o=o+Math.imul(D,me)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863;var Ie=(c+(n=Math.imul(F,pe))|0)+((8191&(i=(i=Math.imul(F,me))+Math.imul(L,pe)|0))<<13)|0;return c=((o=Math.imul(L,me))+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u[0]=ye,u[1]=be,u[2]=ve,u[3]=ge,u[4]=we,u[5]=_e,u[6]=ke,u[7]=xe,u[8]=Se,u[9]=Oe,u[10]=je,u[11]=Ee,u[12]=Re,u[13]=Te,u[14]=Ce,u[15]=Me,u[16]=Pe,u[17]=Ae,u[18]=Ie,0!==c&&(u[19]=c,r.length++),r};function p(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(d=h),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?d(this,e,t):r<63?h(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):p(this,e,t)},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},m.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==f||c>=i);c--){var l=0|this.words[c];this.words[c]=f<<26-o|l>>>o,f=l&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==t){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;l--){var h=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(h=Math.min(h/a|0,67108863),n._ishlnsubmul(i,h,l);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);s&&(s.words[l]=h)}return s&&s.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},o.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var f=r.clone(),l=t.clone();!t.isZero();){for(var h=0,d=1;0==(t.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(f),a.isub(l)),i.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(l)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(s),a.isub(u)):(r.isub(t),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new o(1),s=new o(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,f=1;0==(t.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var l=0,h=1;0==(r.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new k(e)},o.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function x(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},i(v,b),v.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n>>22,i=o}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new g;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return y[e]=t,t},k.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,i),h=this.pow(e,i.addn(1).iushrn(1)),d=this.pow(e,i),p=a;0!==d.cmp(s);){for(var m=d,y=0;0!==m.cmp(s);y++)m=m.redSqr();n(y=0;n--){for(var c=t.words[n],f=u-1;f>=0;f--){var l=c>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==a?(a<<=1,a|=l,(4===++s||0===n&&0===f)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}u=26}return i},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new x(e)},i(x,k),x.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},x.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},x.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:183}],180:[function(e,t,r){r.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},r.toByteArray=function(e){var t,r,n=c(e),a=n[0],s=n[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,a,s)),f=0,l=s>0?a-4:a;for(r=0;r>16&255,u[f++]=t>>8&255,u[f++]=255&t;2===s&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[f++]=255&t);1===s&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[f++]=t>>8&255,u[f++]=255&t);return u},r.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],a=0,s=r-i;as?s:a+16383));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function f(e,t,r){for(var i,o,a=[],s=t;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],181:[function(e,t,r){!function(t,r){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"===_typeof2(t)?t.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{a=e("buffer").Buffer}catch(e){}function s(e,t,r){for(var i=0,o=Math.min(e.length,r),a=0,s=t;s=49&&c<=54?c-49+10:c>=17&&c<=22?c-17+10:c,a|=u}return n(!(240&a),"Invalid character in "+e),i}function u(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a"}o.isBN=function(e){return e instanceof o||null!==e&&"object"===_typeof2(e)&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"===_typeof2(e))return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this._strip(),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=6)i=s(e,r,r+6),this.words[n]|=i<>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);r+6!==t&&(i=s(e,t,r+6),this.words[n]|=i<>>26-o&4194303),this._strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,c=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for?o.prototype[Symbol.for("nodejs.util.inspect.custom")]=f:o.prototype.inspect=f;var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?l[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=h[e],f=d[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(f).toString(e);r=(p=p.idivn(f)).isZero()?m+r:l[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function p(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=h;d++){var p=c-d|0;f+=(a=(i=0|e.words[p])*(o=0|t.words[d])+l)/67108864|0,l=67108863&a}r.words[c]=0|l,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r._strip()}o.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},o.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r=0&&(e[r--]=a>>8&255),r>=0&&(e[r--]=a>>16&255),6===o?(r>=0&&(e[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,d=0|a[1],p=8191&d,m=d>>>13,y=0|a[2],b=8191&y,v=y>>>13,g=0|a[3],w=8191&g,_=g>>>13,k=0|a[4],x=8191&k,S=k>>>13,O=0|a[5],j=8191&O,E=O>>>13,R=0|a[6],T=8191&R,C=R>>>13,M=0|a[7],P=8191&M,A=M>>>13,I=0|a[8],N=8191&I,D=I>>>13,B=0|a[9],F=8191&B,L=B>>>13,z=0|s[0],U=8191&z,H=z>>>13,V=0|s[1],q=8191&V,W=V>>>13,$=0|s[2],X=8191&$,K=$>>>13,Z=0|s[3],Y=8191&Z,G=Z>>>13,J=0|s[4],Q=8191&J,ee=J>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,fe=0|s[8],le=8191&fe,he=fe>>>13,de=0|s[9],pe=8191&de,me=de>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(c+(n=Math.imul(l,U))|0)+((8191&(i=(i=Math.imul(l,H))+Math.imul(h,U)|0))<<13)|0;c=((o=Math.imul(h,H))+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(p,U),i=(i=Math.imul(p,H))+Math.imul(m,U)|0,o=Math.imul(m,H);var be=(c+(n=n+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,W)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,W)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(b,U),i=(i=Math.imul(b,H))+Math.imul(v,U)|0,o=Math.imul(v,H),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,W)|0;var ve=(c+(n=n+Math.imul(l,X)|0)|0)+((8191&(i=(i=i+Math.imul(l,K)|0)+Math.imul(h,X)|0))<<13)|0;c=((o=o+Math.imul(h,K)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(w,U),i=(i=Math.imul(w,H))+Math.imul(_,U)|0,o=Math.imul(_,H),n=n+Math.imul(b,q)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,W)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,K)|0;var ge=(c+(n=n+Math.imul(l,Y)|0)|0)+((8191&(i=(i=i+Math.imul(l,G)|0)+Math.imul(h,Y)|0))<<13)|0;c=((o=o+Math.imul(h,G)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(x,U),i=(i=Math.imul(x,H))+Math.imul(S,U)|0,o=Math.imul(S,H),n=n+Math.imul(w,q)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(_,q)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(b,X)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,K)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,G)|0;var we=(c+(n=n+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,ee)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(j,U),i=(i=Math.imul(j,H))+Math.imul(E,U)|0,o=Math.imul(E,H),n=n+Math.imul(x,q)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(S,q)|0,o=o+Math.imul(S,W)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,K)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(v,Y)|0,o=o+Math.imul(v,G)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var _e=(c+(n=n+Math.imul(l,re)|0)|0)+((8191&(i=(i=i+Math.imul(l,ne)|0)+Math.imul(h,re)|0))<<13)|0;c=((o=o+Math.imul(h,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(T,U),i=(i=Math.imul(T,H))+Math.imul(C,U)|0,o=Math.imul(C,H),n=n+Math.imul(j,q)|0,i=(i=i+Math.imul(j,W)|0)+Math.imul(E,q)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,K)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,K)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0;var ke=(c+(n=n+Math.imul(l,oe)|0)|0)+((8191&(i=(i=i+Math.imul(l,ae)|0)+Math.imul(h,oe)|0))<<13)|0;c=((o=o+Math.imul(h,ae)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(P,U),i=(i=Math.imul(P,H))+Math.imul(A,U)|0,o=Math.imul(A,H),n=n+Math.imul(T,q)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(C,q)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(j,X)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,K)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(S,Y)|0,o=o+Math.imul(S,G)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(b,re)|0,i=(i=i+Math.imul(b,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var xe=(c+(n=n+Math.imul(l,ue)|0)|0)+((8191&(i=(i=i+Math.imul(l,ce)|0)+Math.imul(h,ue)|0))<<13)|0;c=((o=o+Math.imul(h,ce)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(N,U),i=(i=Math.imul(N,H))+Math.imul(D,U)|0,o=Math.imul(D,H),n=n+Math.imul(P,q)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,W)|0,n=n+Math.imul(T,X)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,K)|0,n=n+Math.imul(j,Y)|0,i=(i=i+Math.imul(j,G)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,G)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,ce)|0;var Se=(c+(n=n+Math.imul(l,le)|0)|0)+((8191&(i=(i=i+Math.imul(l,he)|0)+Math.imul(h,le)|0))<<13)|0;c=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(F,U),i=(i=Math.imul(F,H))+Math.imul(L,U)|0,o=Math.imul(L,H),n=n+Math.imul(N,q)|0,i=(i=i+Math.imul(N,W)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,W)|0,n=n+Math.imul(P,X)|0,i=(i=i+Math.imul(P,K)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,K)|0,n=n+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,G)|0,n=n+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,ee)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(S,re)|0,o=o+Math.imul(S,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,n=n+Math.imul(p,le)|0,i=(i=i+Math.imul(p,he)|0)+Math.imul(m,le)|0,o=o+Math.imul(m,he)|0;var Oe=(c+(n=n+Math.imul(l,pe)|0)|0)+((8191&(i=(i=i+Math.imul(l,me)|0)+Math.imul(h,pe)|0))<<13)|0;c=((o=o+Math.imul(h,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(F,q),i=(i=Math.imul(F,W))+Math.imul(L,q)|0,o=Math.imul(L,W),n=n+Math.imul(N,X)|0,i=(i=i+Math.imul(N,K)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,K)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,G)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,ee)|0,n=n+Math.imul(j,re)|0,i=(i=i+Math.imul(j,ne)|0)+Math.imul(E,re)|0,o=o+Math.imul(E,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,n=n+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,ce)|0,n=n+Math.imul(b,le)|0,i=(i=i+Math.imul(b,he)|0)+Math.imul(v,le)|0,o=o+Math.imul(v,he)|0;var je=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;c=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(F,X),i=(i=Math.imul(F,K))+Math.imul(L,X)|0,o=Math.imul(L,K),n=n+Math.imul(N,Y)|0,i=(i=i+Math.imul(N,G)|0)+Math.imul(D,Y)|0,o=o+Math.imul(D,G)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(C,re)|0,o=o+Math.imul(C,ne)|0,n=n+Math.imul(j,oe)|0,i=(i=i+Math.imul(j,ae)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,ae)|0,n=n+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,n=n+Math.imul(w,le)|0,i=(i=i+Math.imul(w,he)|0)+Math.imul(_,le)|0,o=o+Math.imul(_,he)|0;var Ee=(c+(n=n+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,me)|0)+Math.imul(v,pe)|0))<<13)|0;c=((o=o+Math.imul(v,me)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(F,Y),i=(i=Math.imul(F,G))+Math.imul(L,Y)|0,o=Math.imul(L,G),n=n+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,ee)|0,n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,n=n+Math.imul(j,ue)|0,i=(i=i+Math.imul(j,ce)|0)+Math.imul(E,ue)|0,o=o+Math.imul(E,ce)|0,n=n+Math.imul(x,le)|0,i=(i=i+Math.imul(x,he)|0)+Math.imul(S,le)|0,o=o+Math.imul(S,he)|0;var Re=(c+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(_,pe)|0))<<13)|0;c=((o=o+Math.imul(_,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,ee))+Math.imul(L,Q)|0,o=Math.imul(L,ee),n=n+Math.imul(N,re)|0,i=(i=i+Math.imul(N,ne)|0)+Math.imul(D,re)|0,o=o+Math.imul(D,ne)|0,n=n+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,n=n+Math.imul(T,ue)|0,i=(i=i+Math.imul(T,ce)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,ce)|0,n=n+Math.imul(j,le)|0,i=(i=i+Math.imul(j,he)|0)+Math.imul(E,le)|0,o=o+Math.imul(E,he)|0;var Te=(c+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,me)|0)+Math.imul(S,pe)|0))<<13)|0;c=((o=o+Math.imul(S,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(F,re),i=(i=Math.imul(F,ne))+Math.imul(L,re)|0,o=Math.imul(L,ne),n=n+Math.imul(N,oe)|0,i=(i=i+Math.imul(N,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,n=n+Math.imul(P,ue)|0,i=(i=i+Math.imul(P,ce)|0)+Math.imul(A,ue)|0,o=o+Math.imul(A,ce)|0,n=n+Math.imul(T,le)|0,i=(i=i+Math.imul(T,he)|0)+Math.imul(C,le)|0,o=o+Math.imul(C,he)|0;var Ce=(c+(n=n+Math.imul(j,pe)|0)|0)+((8191&(i=(i=i+Math.imul(j,me)|0)+Math.imul(E,pe)|0))<<13)|0;c=((o=o+Math.imul(E,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(F,oe),i=(i=Math.imul(F,ae))+Math.imul(L,oe)|0,o=Math.imul(L,ae),n=n+Math.imul(N,ue)|0,i=(i=i+Math.imul(N,ce)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,ce)|0,n=n+Math.imul(P,le)|0,i=(i=i+Math.imul(P,he)|0)+Math.imul(A,le)|0,o=o+Math.imul(A,he)|0;var Me=(c+(n=n+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(C,pe)|0))<<13)|0;c=((o=o+Math.imul(C,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(F,ue),i=(i=Math.imul(F,ce))+Math.imul(L,ue)|0,o=Math.imul(L,ce),n=n+Math.imul(N,le)|0,i=(i=i+Math.imul(N,he)|0)+Math.imul(D,le)|0,o=o+Math.imul(D,he)|0;var Pe=(c+(n=n+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(A,pe)|0))<<13)|0;c=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(F,le),i=(i=Math.imul(F,he))+Math.imul(L,le)|0,o=Math.imul(L,he);var Ae=(c+(n=n+Math.imul(N,pe)|0)|0)+((8191&(i=(i=i+Math.imul(N,me)|0)+Math.imul(D,pe)|0))<<13)|0;c=((o=o+Math.imul(D,me)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863;var Ie=(c+(n=Math.imul(F,pe))|0)+((8191&(i=(i=Math.imul(F,me))+Math.imul(L,pe)|0))<<13)|0;return c=((o=Math.imul(L,me))+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u[0]=ye,u[1]=be,u[2]=ve,u[3]=ge,u[4]=we,u[5]=_e,u[6]=ke,u[7]=xe,u[8]=Se,u[9]=Oe,u[10]=je,u[11]=Ee,u[12]=Re,u[13]=Te,u[14]=Ce,u[15]=Me,u[16]=Pe,u[17]=Ae,u[18]=Ie,0!==c&&(u[19]=c,r.length++),r};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function b(e,t,r){return y(e,t,r)}function v(e,t){this.x=e,this.y=t}Math.imul||(m=p),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?p(this,e,t):r<1024?y(this,e,t):b(this,e,t)},v.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},v.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i&1}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==f||c>=i);c--){var l=0|this.words[c];this.words[c]=f<<26-o|l>>>o,f=l&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==t){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;l--){var h=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(h=Math.min(h/a|0,67108863),n._ishlnsubmul(i,h,l);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);s&&(s.words[l]=h)}return s&&s._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var f=r.clone(),l=t.clone();!t.isZero();){for(var h=0,d=1;0==(t.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(f),a.isub(l)),i.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(l)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(s),a.isub(u)):(r.isub(t),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new o(1),s=new o(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,f=1;0==(t.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var l=0,h=1;0==(r.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new O(e)},o.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function O(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function j(e){O.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},i(_,w),_.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n>>22,i=o}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},_.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new _;else if("p224"===e)t=new k;else if("p192"===e)t=new x;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new S}return g[e]=t,t},O.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},O.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},O.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},O.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},O.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},O.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},O.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},O.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},O.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},O.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},O.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},O.prototype.isqr=function(e){return this.imul(e,e.clone())},O.prototype.sqr=function(e){return this.mul(e,e)},O.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,i),h=this.pow(e,i.addn(1).iushrn(1)),d=this.pow(e,i),p=a;0!==d.cmp(s);){for(var m=d,y=0;0!==m.cmp(s);y++)m=m.redSqr();n(y=0;n--){for(var c=t.words[n],f=u-1;f>=0;f--){var l=c>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==a?(a<<=1,a|=l,(4===++s||0===n&&0===f)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}u=26}return i},O.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},O.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new j(e)},i(j,O),j.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},j.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},j.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},j.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},j.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:183}],182:[function(e,t,r){var n;function i(e){this.rand=e}if(t.exports=function(e){return n||(n=new i(null)),n.generate(e)},t.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r>>24]^f[p>>>16&255]^l[m>>>8&255]^h[255&y]^t[b++],a=c[p>>>24]^f[m>>>16&255]^l[y>>>8&255]^h[255&d]^t[b++],s=c[m>>>24]^f[y>>>16&255]^l[d>>>8&255]^h[255&p]^t[b++],u=c[y>>>24]^f[d>>>16&255]^l[p>>>8&255]^h[255&m]^t[b++],d=o,p=a,m=s,y=u;return o=(n[d>>>24]<<24|n[p>>>16&255]<<16|n[m>>>8&255]<<8|n[255&y])^t[b++],a=(n[p>>>24]<<24|n[m>>>16&255]<<16|n[y>>>8&255]<<8|n[255&d])^t[b++],s=(n[m>>>24]<<24|n[y>>>16&255]<<16|n[d>>>8&255]<<8|n[255&p])^t[b++],u=(n[y>>>24]<<24|n[d>>>16&255]<<16|n[p>>>8&255]<<8|n[255&m])^t[b++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var c=s^s<<1^s<<2^s<<3^s<<4;c=c>>>8^255&c^99,r[a]=c,n[c]=a;var f=e[a],l=e[f],h=e[l],d=257*e[c]^16843008*c;i[0][a]=d<<24|d>>>8,i[1][a]=d<<16|d>>>16,i[2][a]=d<<8|d>>>24,i[3][a]=d,d=16843009*h^65537*l^257*f^16843008*a,o[0][c]=d<<24|d>>>8,o[1][c]=d<<16|d>>>16,o[2][c]=d<<8|d>>>24,o[3][c]=d,0===a?a=s=1:(a=f^e[e[e[h^f]]],s^=e[e[s]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function c(e){this._key=i(e),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,n=4*(r+1),i=[],o=0;o>>24,a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a],a^=s[o/t|0]<<24):t>6&&o%t==4&&(a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a]),i[o]=i[o-t]^a}for(var c=[],f=0;f>>24]]^u.INV_SUB_MIX[1][u.SBOX[h>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[h>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&h]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=c},c.prototype.encryptBlockRaw=function(e){return a(e=i(e),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},c.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=n.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},c.prototype.decryptBlock=function(e){var t=(e=i(e))[1];e[1]=e[3],e[3]=t;var r=a(e,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=n.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},c.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=c},{"safe-buffer":470}],185:[function(e,t,r){var n=e("./aes"),i=e("safe-buffer").Buffer,o=e("cipher-base"),a=e("inherits"),s=e("./ghash"),u=e("buffer-xor"),c=e("./incr32");function f(e,t,r,a){o.call(this);var u=i.alloc(4,0);this._cipher=new n.AES(t);var f=this._cipher.encryptBlock(u);this._ghash=new s(f),r=function(e,t,r){if(12===t.length)return e._finID=i.concat([t,i.from([0,0,0,1])]),i.concat([t,i.from([0,0,0,2])]);var n=new s(r),o=t.length,a=o%16;n.update(t),a&&(a=16-a,n.update(i.alloc(a,0))),n.update(i.alloc(8,0));var u=8*o,f=i.alloc(8);f.writeUIntBE(u,0,8),n.update(f),e._finID=n.state;var l=i.from(e._finID);return c(l),l}(this,r,f),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}a(f,o),f.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=i.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},f.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var r=0;e.length!==t.length&&r++;for(var n=Math.min(e.length,t.length),i=0;i16)throw new Error("unable to decrypt data");var r=-1;for(;++r16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},l.prototype.flush=function(){if(this.cache.length)return this.cache},r.createDecipher=function(e,t){var r=o[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=c(t,!1,r.key,r.iv);return h(e,n.key,n.iv)},r.createDecipheriv=h},{"./aes":184,"./authCipher":185,"./modes":197,"./streamCipher":200,"cipher-base":216,evp_bytestokey:345,inherits:364,"safe-buffer":470}],188:[function(e,t,r){var n=e("./modes"),i=e("./authCipher"),o=e("safe-buffer").Buffer,a=e("./streamCipher"),s=e("cipher-base"),u=e("./aes"),c=e("evp_bytestokey");function f(e,t,r){s.call(this),this._cache=new h,this._cipher=new u.AES(t),this._prev=o.from(r),this._mode=e,this._autopadding=!0}e("inherits")(f,s),f.prototype._update=function(e){var t,r;this._cache.add(e);for(var n=[];t=this._cache.get();)r=this._mode.encrypt(this,t),n.push(r);return o.concat(n)};var l=o.alloc(16,16);function h(){this.cache=o.allocUnsafe(0)}function d(e,t,r){var s=n[e.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=o.from(t)),t.length!==s.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof r&&(r=o.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===s.type?new a(s.module,t,r):"auth"===s.type?new i(s.module,t,r):new f(s.module,t,r)}f.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(l))throw this._cipher.scrub(),new Error("data not multiple of block length")},f.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},h.prototype.add=function(e){this.cache=o.concat([this.cache,e])},h.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},h.prototype.flush=function(){for(var e=16-this.cache.length,t=o.allocUnsafe(e),r=-1;++r>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function a(e){this.h=e,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}a.prototype.ghash=function(e){for(var t=-1;++t0;t--)n[t]=n[t]>>>1|(1&n[t-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=o(i)},a.prototype.update=function(e){var t;for(this.cache=n.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},a.prototype.final=function(e,t){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(o([0,e,0,t])),this.state},t.exports=a},{"safe-buffer":470}],190:[function(e,t,r){t.exports=function(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}},{}],191:[function(e,t,r){var n=e("buffer-xor");r.encrypt=function(e,t){var r=n(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},r.decrypt=function(e,t){var r=e._prev;e._prev=t;var i=e._cipher.decryptBlock(t);return n(i,r)}},{"buffer-xor":215}],192:[function(e,t,r){var n=e("safe-buffer").Buffer,i=e("buffer-xor");function o(e,t,r){var o=t.length,a=i(t,e._cache);return e._cache=e._cache.slice(o),e._prev=n.concat([e._prev,r?t:a]),a}r.encrypt=function(e,t,r){for(var i,a=n.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=n.allocUnsafe(0)),!(e._cache.length<=t.length)){a=n.concat([a,o(e,t,r)]);break}i=e._cache.length,a=n.concat([a,o(e,t.slice(0,i),r)]),t=t.slice(i)}return a}},{"buffer-xor":215,"safe-buffer":470}],193:[function(e,t,r){var n=e("safe-buffer").Buffer;function i(e,t,r){for(var n,i,a=-1,s=0;++a<8;)n=t&1<<7-a?128:0,s+=(128&(i=e._cipher.encryptBlock(e._prev)[0]^n))>>a%8,e._prev=o(e._prev,r?n:i);return s}function o(e,t){var r=e.length,i=-1,o=n.allocUnsafe(e.length);for(e=n.concat([e,n.from([t])]);++i>7;return o}r.encrypt=function(e,t,r){for(var o=t.length,a=n.allocUnsafe(o),s=-1;++s=0||!r.umod(e.prime1)||!r.umod(e.prime2);)r=new n(i(t));return r}t.exports=o,o.getr=a}).call(this,e("buffer").Buffer)},{"bn.js":205,buffer:214,randombytes:451}],205:[function(e,t,r){arguments[4][179][0].apply(r,arguments)},{buffer:183,dup:179}],206:[function(e,t,r){t.exports=e("./browser/algorithms.json")},{"./browser/algorithms.json":207}],207:[function(e,t,r){t.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},{}],208:[function(e,t,r){t.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},{}],209:[function(e,t,r){var n=e("safe-buffer").Buffer,i=e("create-hash"),o=e("readable-stream"),a=e("inherits"),s=e("./sign"),u=e("./verify"),c=e("./algorithms.json");function f(e){o.Writable.call(this);var t=c[e];if(!t)throw new Error("Unknown message digest");this._hashType=t.hash,this._hash=i(t.hash),this._tag=t.id,this._signType=t.sign}function l(e){o.Writable.call(this);var t=c[e];if(!t)throw new Error("Unknown message digest");this._hash=i(t.hash),this._tag=t.id,this._signType=t.sign}function h(e){return new f(e)}function d(e){return new l(e)}Object.keys(c).forEach((function(e){c[e].id=n.from(c[e].id,"hex"),c[e.toLowerCase()]=c[e]})),a(f,o.Writable),f.prototype._write=function(e,t,r){this._hash.update(e),r()},f.prototype.update=function(e,t){return"string"==typeof e&&(e=n.from(e,t)),this._hash.update(e),this},f.prototype.sign=function(e,t){this.end();var r=this._hash.digest(),n=s(r,e,this._hashType,this._signType,this._tag);return t?n.toString(t):n},a(l,o.Writable),l.prototype._write=function(e,t,r){this._hash.update(e),r()},l.prototype.update=function(e,t){return"string"==typeof e&&(e=n.from(e,t)),this._hash.update(e),this},l.prototype.verify=function(e,t,r){"string"==typeof t&&(t=n.from(t,r)),this.end();var i=this._hash.digest();return u(t,i,e,this._signType,this._tag)},t.exports={Sign:h,Verify:d,createSign:h,createVerify:d}},{"./algorithms.json":207,"./sign":210,"./verify":211,"create-hash":308,inherits:364,"readable-stream":467,"safe-buffer":212}],210:[function(e,t,r){var n=e("safe-buffer").Buffer,i=e("create-hmac"),o=e("browserify-rsa"),a=e("elliptic").ec,s=e("bn.js"),u=e("parse-asn1"),c=e("./curves.json");function f(e,t,r,o){if((e=n.from(e.toArray())).length0&&r.ishrn(n),r}function h(e,t,r){var o,a;do{for(o=n.alloc(0);8*o.length=t)throw new Error("invalid sig")}t.exports=function(e,t,r,c,f){var l=a(r);if("ec"===l.type){if("ecdsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");return function(e,t,r){var n=s[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new o(n),a=r.data.subjectPrivateKey.data;return i.verify(t,e,a)}(e,t,l)}if("dsa"===l.type){if("dsa"!==c)throw new Error("wrong public key type");return function(e,t,r){var n=r.data.p,o=r.data.q,s=r.data.g,c=r.data.pub_key,f=a.signature.decode(e,"der"),l=f.s,h=f.r;u(l,o),u(h,o);var d=i.mont(n),p=l.invm(o);return 0===s.toRed(d).redPow(new i(t).mul(p).mod(o)).fromRed().mul(c.toRed(d).redPow(h.mul(p).mod(o)).fromRed()).mod(n).mod(o).cmp(h)}(e,t,l)}if("rsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");t=n.concat([f,t]);for(var h=l.modulus.byteLength(),d=[1],p=0;t.length+d.length+2 */var n=e("buffer"),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,r),r.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},{buffer:214}],213:[function(e,t,r){arguments[4][183][0].apply(r,arguments)},{dup:183}],214:[function(e,t,r){(function(t){var n=e("base64-js"),i=e("ieee754");r.Buffer=t,r.SlowBuffer=function(e){+e!=e&&(e=0);return t.alloc(+e)},r.INSPECT_MAX_BYTES=50;function o(e){if(e>2147483647)throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=new Uint8Array(e);return r.__proto__=t.prototype,r}function t(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return a(e,t,r)}function a(e,r,n){if("string"==typeof e)return function(e,r){"string"==typeof r&&""!==r||(r="utf8");if(!t.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var n=0|l(e,r),i=o(n),a=i.write(e,r);a!==n&&(i=i.slice(0,a));return i}(e,r);if(ArrayBuffer.isView(e))return c(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+_typeof2(e));if(F(e,ArrayBuffer)||e&&F(e.buffer,ArrayBuffer))return function(e,r,n){if(r<0||e.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|e}function l(e,r){if(t.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||F(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+_typeof2(e));var n=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;for(var o=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return N(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return D(e).length;default:if(o)return i?-1:N(e).length;r=(""+r).toLowerCase(),o=!0}}function h(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return j(this,t,r);case"utf8":case"utf-8":return x(this,t,r);case"ascii":return S(this,t,r);case"latin1":case"binary":return O(this,t,r);case"base64":return k(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function d(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function p(e,r,n,i,o){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),L(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof r&&(r=t.from(r,i)),t.isBuffer(r))return 0===r.length?-1:m(e,r,n,i,o);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,r,n):Uint8Array.prototype.lastIndexOf.call(e,r,n):m(e,[r],n,i,o);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,i){var o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var f=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var l=!0,h=0;hi&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function k(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function x(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+l<=r)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(f=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(f=u)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nt&&(e+=" ... "),""},t.prototype.compare=function(e,r,n,i,o){if(F(e,Uint8Array)&&(e=t.from(e,e.offset,e.byteLength)),!t.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+_typeof2(e));if(void 0===r&&(r=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(this===e)return 0;for(var a=(o>>>=0)-(i>>>=0),s=(n>>>=0)-(r>>>=0),u=Math.min(a,s),c=this.slice(i,o),f=e.slice(r,n),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return y(this,e,t,r);case"utf8":case"utf-8":return b(this,e,t,r);case"ascii":return v(this,e,t,r);case"latin1":case"binary":return g(this,e,t,r);case"base64":return w(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function S(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function T(e,r,n,i,o,a){if(!t.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||re.length)throw new RangeError("Index out of range")}function C(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(e,t,r,n,o){return t=+t,r>>>=0,o||C(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function P(e,t,r,n,o){return t=+t,r>>>=0,o||C(e,0,r,8),i.write(e,t,r,n,52,8),r+8}t.prototype.slice=function(e,r){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r>>=0,t>>>=0,r||R(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||R(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},t.prototype.readUInt8=function(e,t){return e>>>=0,t||R(e,1,this.length),this[e]},t.prototype.readUInt16LE=function(e,t){return e>>>=0,t||R(e,2,this.length),this[e]|this[e+1]<<8},t.prototype.readUInt16BE=function(e,t){return e>>>=0,t||R(e,2,this.length),this[e]<<8|this[e+1]},t.prototype.readUInt32LE=function(e,t){return e>>>=0,t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},t.prototype.readUInt32BE=function(e,t){return e>>>=0,t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},t.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||R(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},t.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||R(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},t.prototype.readInt8=function(e,t){return e>>>=0,t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},t.prototype.readInt16LE=function(e,t){e>>>=0,t||R(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt16BE=function(e,t){e>>>=0,t||R(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt32LE=function(e,t){return e>>>=0,t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},t.prototype.readInt32BE=function(e,t){return e>>>=0,t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},t.prototype.readFloatLE=function(e,t){return e>>>=0,t||R(e,4,this.length),i.read(this,e,!0,23,4)},t.prototype.readFloatBE=function(e,t){return e>>>=0,t||R(e,4,this.length),i.read(this,e,!1,23,4)},t.prototype.readDoubleLE=function(e,t){return e>>>=0,t||R(e,8,this.length),i.read(this,e,!0,52,8)},t.prototype.readDoubleBE=function(e,t){return e>>>=0,t||R(e,8,this.length),i.read(this,e,!1,52,8)},t.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||T(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n)||T(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},t.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,255,0),this[t]=255&e,t+1},t.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},t.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},t.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},t.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},t.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);T(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},t.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);T(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},t.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},t.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},t.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},t.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},t.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},t.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},t.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},t.prototype.writeDoubleLE=function(e,t,r){return P(this,e,t,!0,r)},t.prototype.writeDoubleBE=function(e,t,r){return P(this,e,t,!1,r)},t.prototype.copy=function(e,r,n,i){if(!t.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r=0;--a)e[a+r]=this[a+n];else Uint8Array.prototype.set.call(e,this.subarray(n,i),r);return o},t.prototype.fill=function(e,r,n,i){if("string"==typeof e){if("string"==typeof r?(i=r,r=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!t.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){var o=e.charCodeAt(0);("utf8"===i&&o<128||"latin1"===i)&&(e=o)}}else"number"==typeof e&&(e&=255);if(r<0||this.length>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=r;a55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function D(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(A,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function B(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function F(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}).call(this,e("buffer").Buffer)},{"base64-js":180,buffer:214,ieee754:362}],215:[function(e,t,r){(function(e){t.exports=function(t,r){for(var n=Math.min(t.length,r.length),i=new e(n),o=0;of;)if((s=u[f++])!=s)return!0}else for(;c>f;f++)if((e||f in u)&&u[f]===r)return e||f||0;return!e&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},{"../internals/to-absolute-index":289,"../internals/to-indexed-object":290,"../internals/to-length":292}],221:[function(e,t,r){var n=e("../internals/function-bind-context"),i=e("../internals/indexed-object"),o=e("../internals/to-object"),a=e("../internals/to-length"),s=e("../internals/array-species-create"),u=[].push,c=function(e){var t=1==e,r=2==e,c=3==e,f=4==e,l=6==e,h=5==e||l;return function(d,p,m,y){for(var b,v,g=o(d),w=i(g),_=n(p,m,3),k=a(w.length),x=0,S=y||s,O=t?S(d,k):r?S(d,0):void 0;k>x;x++)if((h||x in w)&&(v=_(b=w[x],x,g),e))if(t)O[x]=v;else if(v)switch(e){case 3:return!0;case 5:return b;case 6:return x;case 2:u.call(O,b)}else if(f)return!1;return l?-1:c||f?f:O}};t.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6)}},{"../internals/array-species-create":222,"../internals/function-bind-context":239,"../internals/indexed-object":248,"../internals/to-length":292,"../internals/to-object":293}],222:[function(e,t,r){var n=e("../internals/is-object"),i=e("../internals/is-array"),o=e("../internals/well-known-symbol")("species");t.exports=function(e,t){var r;return i(e)&&("function"!=typeof(r=e.constructor)||r!==Array&&!i(r.prototype)?n(r)&&null===(r=r[o])&&(r=void 0):r=void 0),new(void 0===r?Array:r)(0===t?0:t)}},{"../internals/is-array":252,"../internals/is-object":254,"../internals/well-known-symbol":299}],223:[function(e,t,r){var n=e("../internals/an-object");t.exports=function(e,t,r,i){try{return i?t(n(r)[0],r[1]):t(r)}catch(t){var o=e.return;throw void 0!==o&&n(o.call(e)),t}}},{"../internals/an-object":219}],224:[function(e,t,r){var n=e("../internals/well-known-symbol")("iterator"),i=!1;try{var o=0,a={next:function(){return{done:!!o++}},return:function(){i=!0}};a[n]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}t.exports=function(e,t){if(!t&&!i)return!1;var r=!1;try{var o={};o[n]=function(){return{next:function(){return{done:r=!0}}}},e(o)}catch(e){}return r}},{"../internals/well-known-symbol":299}],225:[function(e,t,r){var n={}.toString;t.exports=function(e){return n.call(e).slice(8,-1)}},{}],226:[function(e,t,r){var n=e("../internals/to-string-tag-support"),i=e("../internals/classof-raw"),o=e("../internals/well-known-symbol")("toStringTag"),a="Arguments"==i(function(){return arguments}());t.exports=n?i:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),o))?r:a?i(t):"Object"==(n=i(t))&&"function"==typeof t.callee?"Arguments":n}},{"../internals/classof-raw":225,"../internals/to-string-tag-support":295,"../internals/well-known-symbol":299}],227:[function(e,t,r){var n=e("../internals/has"),i=e("../internals/own-keys"),o=e("../internals/object-get-own-property-descriptor"),a=e("../internals/object-define-property");t.exports=function(e,t){for(var r=i(t),s=a.f,u=o.f,c=0;c=74)&&(n=a.match(/Chrome\/(\d+)/))&&(i=n[1]),t.exports=i&&+i},{"../internals/engine-user-agent":234,"../internals/global":242}],236:[function(e,t,r){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},{}],237:[function(e,t,r){var n=e("../internals/global"),i=e("../internals/object-get-own-property-descriptor").f,o=e("../internals/create-non-enumerable-property"),a=e("../internals/redefine"),s=e("../internals/set-global"),u=e("../internals/copy-constructor-properties"),c=e("../internals/is-forced");t.exports=function(e,t){var r,f,l,h,d,p=e.target,m=e.global,y=e.stat;if(r=m?n:y?n[p]||s(p,{}):(n[p]||{}).prototype)for(f in t){if(h=t[f],l=e.noTargetGet?(d=i(r,f))&&d.value:r[f],!c(m?f:p+(y?".":"#")+f,e.forced)&&void 0!==l){if(_typeof2(h)===_typeof2(l))continue;u(h,l)}(e.sham||l&&l.sham)&&o(h,"sham",!0),a(r,f,h,e)}}},{"../internals/copy-constructor-properties":227,"../internals/create-non-enumerable-property":228,"../internals/global":242,"../internals/is-forced":253,"../internals/object-get-own-property-descriptor":267,"../internals/redefine":279,"../internals/set-global":281}],238:[function(e,t,r){t.exports=function(e){try{return!!e()}catch(e){return!0}}},{}],239:[function(e,t,r){var n=e("../internals/a-function");t.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 0:return function(){return e.call(t)};case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},{"../internals/a-function":217}],240:[function(e,t,r){var n=e("../internals/path"),i=e("../internals/global"),o=function(e){return"function"==typeof e?e:void 0};t.exports=function(e,t){return arguments.length<2?o(n[e])||o(i[e]):n[e]&&n[e][t]||i[e]&&i[e][t]}},{"../internals/global":242,"../internals/path":275}],241:[function(e,t,r){var n=e("../internals/classof"),i=e("../internals/iterators"),o=e("../internals/well-known-symbol")("iterator");t.exports=function(e){if(null!=e)return e[o]||e["@@iterator"]||i[n(e)]}},{"../internals/classof":226,"../internals/iterators":257,"../internals/well-known-symbol":299}],242:[function(e,t,r){(function(e){var r=function(e){return e&&e.Math==Math&&e};t.exports=r("object"==("undefined"==typeof globalThis?"undefined":_typeof2(globalThis))&&globalThis)||r("object"==("undefined"==typeof window?"undefined":_typeof2(window))&&window)||r("object"==("undefined"==typeof self?"undefined":_typeof2(self))&&self)||r("object"==_typeof2(e)&&e)||Function("return this")()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],243:[function(e,t,r){var n={}.hasOwnProperty;t.exports=function(e,t){return n.call(e,t)}},{}],244:[function(e,t,r){t.exports={}},{}],245:[function(e,t,r){var n=e("../internals/global");t.exports=function(e,t){var r=n.console;r&&r.error&&(1===arguments.length?r.error(e):r.error(e,t))}},{"../internals/global":242}],246:[function(e,t,r){var n=e("../internals/get-built-in");t.exports=n("document","documentElement")},{"../internals/get-built-in":240}],247:[function(e,t,r){var n=e("../internals/descriptors"),i=e("../internals/fails"),o=e("../internals/document-create-element");t.exports=!n&&!i((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},{"../internals/descriptors":231,"../internals/document-create-element":232,"../internals/fails":238}],248:[function(e,t,r){var n=e("../internals/fails"),i=e("../internals/classof-raw"),o="".split;t.exports=n((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==i(e)?o.call(e,""):Object(e)}:Object},{"../internals/classof-raw":225,"../internals/fails":238}],249:[function(e,t,r){var n=e("../internals/shared-store"),i=Function.toString;"function"!=typeof n.inspectSource&&(n.inspectSource=function(e){return i.call(e)}),t.exports=n.inspectSource},{"../internals/shared-store":285}],250:[function(e,t,r){var n,i,o,a=e("../internals/native-weak-map"),s=e("../internals/global"),u=e("../internals/is-object"),c=e("../internals/create-non-enumerable-property"),f=e("../internals/has"),l=e("../internals/shared-key"),h=e("../internals/hidden-keys"),d=s.WeakMap;if(a){var p=new d,m=p.get,y=p.has,b=p.set;n=function(e,t){return b.call(p,e,t),t},i=function(e){return m.call(p,e)||{}},o=function(e){return y.call(p,e)}}else{var v=l("state");h[v]=!0,n=function(e,t){return c(e,v,t),t},i=function(e){return f(e,v)?e[v]:{}},o=function(e){return f(e,v)}}t.exports={set:n,get:i,has:o,enforce:function(e){return o(e)?i(e):n(e,{})},getterFor:function(e){return function(t){var r;if(!u(t)||(r=i(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return r}}}},{"../internals/create-non-enumerable-property":228,"../internals/global":242,"../internals/has":243,"../internals/hidden-keys":244,"../internals/is-object":254,"../internals/native-weak-map":261,"../internals/shared-key":284}],251:[function(e,t,r){var n=e("../internals/well-known-symbol"),i=e("../internals/iterators"),o=n("iterator"),a=Array.prototype;t.exports=function(e){return void 0!==e&&(i.Array===e||a[o]===e)}},{"../internals/iterators":257,"../internals/well-known-symbol":299}],252:[function(e,t,r){var n=e("../internals/classof-raw");t.exports=Array.isArray||function(e){return"Array"==n(e)}},{"../internals/classof-raw":225}],253:[function(e,t,r){var n=e("../internals/fails"),i=/#|\.prototype\./,o=function(e,t){var r=s[a(e)];return r==c||r!=u&&("function"==typeof t?n(t):!!t)},a=o.normalize=function(e){return String(e).replace(i,".").toLowerCase()},s=o.data={},u=o.NATIVE="N",c=o.POLYFILL="P";t.exports=o},{"../internals/fails":238}],254:[function(e,t,r){t.exports=function(e){return"object"===_typeof2(e)?null!==e:"function"==typeof e}},{}],255:[function(e,t,r){t.exports=!1},{}],256:[function(e,t,r){var n=e("../internals/an-object"),i=e("../internals/is-array-iterator-method"),o=e("../internals/to-length"),a=e("../internals/function-bind-context"),s=e("../internals/get-iterator-method"),u=e("../internals/call-with-safe-iteration-closing"),c=function(e,t){this.stopped=e,this.result=t};(t.exports=function(e,t,r,f,l){var h,d,p,m,y,b,v,g=a(t,r,f?2:1);if(l)h=e;else{if("function"!=typeof(d=s(e)))throw TypeError("Target is not iterable");if(i(d)){for(p=0,m=o(e.length);m>p;p++)if((y=f?g(n(v=e[p])[0],v[1]):g(e[p]))&&y instanceof c)return y;return new c(!1)}h=d.call(e)}for(b=h.next;!(v=b.call(h)).done;)if("object"==_typeof2(y=u(h,g,v.value,f))&&y&&y instanceof c)return y;return new c(!1)}).stop=function(e){return new c(!0,e)}},{"../internals/an-object":219,"../internals/call-with-safe-iteration-closing":223,"../internals/function-bind-context":239,"../internals/get-iterator-method":241,"../internals/is-array-iterator-method":251,"../internals/to-length":292}],257:[function(e,t,r){arguments[4][244][0].apply(r,arguments)},{dup:244}],258:[function(e,t,r){var n,i,o,a,s,u,c,f,l=e("../internals/global"),h=e("../internals/object-get-own-property-descriptor").f,d=e("../internals/classof-raw"),p=e("../internals/task").set,m=e("../internals/engine-is-ios"),y=l.MutationObserver||l.WebKitMutationObserver,b=l.process,v=l.Promise,g="process"==d(b),w=h(l,"queueMicrotask"),_=w&&w.value;_||(n=function(){var e,t;for(g&&(e=b.domain)&&e.exit();i;){t=i.fn,i=i.next;try{t()}catch(e){throw i?a():o=void 0,e}}o=void 0,e&&e.enter()},g?a=function(){b.nextTick(n)}:y&&!m?(s=!0,u=document.createTextNode(""),new y(n).observe(u,{characterData:!0}),a=function(){u.data=s=!s}):v&&v.resolve?(c=v.resolve(void 0),f=c.then,a=function(){f.call(c,n)}):a=function(){p.call(l,n)}),t.exports=_||function(e){var t={fn:e,next:void 0};o&&(o.next=t),i||(i=t,a()),o=t}},{"../internals/classof-raw":225,"../internals/engine-is-ios":233,"../internals/global":242,"../internals/object-get-own-property-descriptor":267,"../internals/task":288}],259:[function(e,t,r){var n=e("../internals/global");t.exports=n.Promise},{"../internals/global":242}],260:[function(e,t,r){var n=e("../internals/fails");t.exports=!!Object.getOwnPropertySymbols&&!n((function(){return!String(Symbol())}))},{"../internals/fails":238}],261:[function(e,t,r){var n=e("../internals/global"),i=e("../internals/inspect-source"),o=n.WeakMap;t.exports="function"==typeof o&&/native code/.test(i(o))},{"../internals/global":242,"../internals/inspect-source":249}],262:[function(e,t,r){var n=e("../internals/a-function"),i=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n})),this.resolve=n(t),this.reject=n(r)};t.exports.f=function(e){return new i(e)}},{"../internals/a-function":217}],263:[function(e,t,r){var n=e("../internals/descriptors"),i=e("../internals/fails"),o=e("../internals/object-keys"),a=e("../internals/object-get-own-property-symbols"),s=e("../internals/object-property-is-enumerable"),u=e("../internals/to-object"),c=e("../internals/indexed-object"),f=Object.assign,l=Object.defineProperty;t.exports=!f||i((function(){if(n&&1!==f({b:1},f(l({},"a",{enumerable:!0,get:function(){l(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol();return e[r]=7,"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),7!=f({},e)[r]||"abcdefghijklmnopqrst"!=o(f({},t)).join("")}))?function(e,t){for(var r=u(e),i=arguments.length,f=1,l=a.f,h=s.f;i>f;)for(var d,p=c(arguments[f++]),m=l?o(p).concat(l(p)):o(p),y=m.length,b=0;y>b;)d=m[b++],n&&!h.call(p,d)||(r[d]=p[d]);return r}:f},{"../internals/descriptors":231,"../internals/fails":238,"../internals/indexed-object":248,"../internals/object-get-own-property-symbols":270,"../internals/object-keys":272,"../internals/object-property-is-enumerable":273,"../internals/to-object":293}],264:[function(e,t,r){var n,i=e("../internals/an-object"),o=e("../internals/object-define-properties"),a=e("../internals/enum-bug-keys"),s=e("../internals/hidden-keys"),u=e("../internals/html"),c=e("../internals/document-create-element"),f=e("../internals/shared-key"),l=f("IE_PROTO"),h=function(){},d=function(e){return"