@actual-app/web 4.1.1 → 22.10.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,31 @@
1
+ var backend=function(t){self.webpackChunkbackend=function(e,n){for(var i in n)t[i]=n[i];for(;e.length;)r[e.pop()]=1};var e={},r={main:1};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.e=function(t){var e=[];return e.push(Promise.resolve().then((function(){r[t]||importScripts(n.p+""+t+".kcab.worker.f4a8ab06d7e2c88f7f6e.js")}))),Promise.all(e)},n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/kcab/",n(n.s=282)}([function(t,e,r){"use strict";function n(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object.prototype.toString.call(t);return t instanceof Date||"object"==typeof t&&"[object Date]"===e?new Date(t.getTime()):"number"==typeof t||"[object Number]"===e?new Date(t):("string"!=typeof t&&"[object String]"!==e||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as arguments. Please use `parseISO` to parse strings. See: https://git.io/fpAk2"),console.warn((new Error).stack)),new Date(NaN))}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";r.r(e),r.d(e,"toDateRepr",(function(){return f.h})),r.d(e,"fromDateRepr",(function(){return f.d})),r.d(e,"getDatabasePath",(function(){return v})),r.d(e,"openDatabase",(function(){return E})),r.d(e,"reopenDatabase",(function(){return S})),r.d(e,"closeDatabase",(function(){return O})),r.d(e,"setDatabase",(function(){return T})),r.d(e,"getDatabase",(function(){return A})),r.d(e,"loadClock",(function(){return M})),r.d(e,"runQuery",(function(){return j})),r.d(e,"execQuery",(function(){return I})),r.d(e,"cache",(function(){return D})),r.d(e,"transaction",(function(){return k})),r.d(e,"asyncTransaction",(function(){return N})),r.d(e,"all",(function(){return C})),r.d(e,"first",(function(){return x})),r.d(e,"firstSync",(function(){return L})),r.d(e,"run",(function(){return P})),r.d(e,"select",(function(){return B})),r.d(e,"update",(function(){return U})),r.d(e,"insertWithUUID",(function(){return F})),r.d(e,"insert",(function(){return W})),r.d(e,"delete_",(function(){return H})),r.d(e,"selectWithSchema",(function(){return q})),r.d(e,"selectFirstWithSchema",(function(){return z})),r.d(e,"insertWithSchema",(function(){return V})),r.d(e,"updateWithSchema",(function(){return Y})),r.d(e,"getCategories",(function(){return G})),r.d(e,"getCategoriesGrouped",(function(){return $})),r.d(e,"insertCategoryGroup",(function(){return K})),r.d(e,"updateCategoryGroup",(function(){return Z})),r.d(e,"moveCategoryGroup",(function(){return J})),r.d(e,"deleteCategoryGroup",(function(){return X})),r.d(e,"insertCategory",(function(){return Q})),r.d(e,"updateCategory",(function(){return tt})),r.d(e,"moveCategory",(function(){return et})),r.d(e,"deleteCategory",(function(){return rt})),r.d(e,"getPayee",(function(){return nt})),r.d(e,"insertPayee",(function(){return it})),r.d(e,"deletePayee",(function(){return ot})),r.d(e,"deleteTransferPayee",(function(){return at})),r.d(e,"updatePayee",(function(){return st})),r.d(e,"mergePayees",(function(){return ut})),r.d(e,"getPayees",(function(){return ct})),r.d(e,"getOrphanedPayees",(function(){return lt})),r.d(e,"getPayeeByName",(function(){return ft})),r.d(e,"insertPayeeRule",(function(){return dt})),r.d(e,"deletePayeeRule",(function(){return ht})),r.d(e,"updatePayeeRule",(function(){return gt})),r.d(e,"getPayeeRules",(function(){return pt})),r.d(e,"getAccounts",(function(){return mt})),r.d(e,"insertAccount",(function(){return yt})),r.d(e,"updateAccount",(function(){return bt})),r.d(e,"deleteAccount",(function(){return wt})),r.d(e,"moveAccount",(function(){return _t})),r.d(e,"getTransaction",(function(){return vt})),r.d(e,"getTransactionsByDate",(function(){return Et})),r.d(e,"getTransactions",(function(){return St})),r.d(e,"insertTransaction",(function(){return Ot})),r.d(e,"updateTransaction",(function(){return Tt})),r.d(e,"deleteTransaction",(function(){return At}));var n=r(164),i=r.n(n),o=r(4),a=r.n(o),s=r(13),u=r(15),c=r(12),l=r(9),f=r(18),d=r(8);function h(t,e){const r=t[e-1],n=t[e];return r?n?(r.sort_order+n.sort_order)/2:r.sort_order+16384:n.sort_order/2}function g(t,e){const r=t.findIndex(t=>t.id===e),n=t[r],i=t[r-1];let o=[];if(e&&-1!==r){if(n.sort_order-(i?i.sort_order:0)<=2){let e=r,n=16384+(0|t[e].sort_order);for(;e<t.length&&!(n<=t[e].sort_order);)o.push({id:t[e].id,sort_order:n}),e++,n+=16384}return{updates:o,sort_order:h(t,r)}}{let e;return e=t.length>0?t[t.length-1].sort_order+16384:16384,{updates:o,sort_order:e}}}function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function m(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach((function(e){y(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function y(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const b=r(41);let w,_;function v(){return w}async function E(t){_&&await s.closeDatabase(_),w=a.a.join(a.a.getBudgetDir(t),"db.sqlite"),T(await s.openDatabase(w))}async function S(){await s.closeDatabase(_),T(await s.openDatabase(w))}async function O(){_&&(await s.closeDatabase(_),T(null))}function T(t){_=t,R=new i.a({max:100})}function A(){return _}async function M(){let t=await x("SELECT * FROM messages_clock");if(t){let e=Object(l.b)(t.clock);Object(l.h)(e)}else{let t=new l.a(0,0,Object(l.d)()),e=Object(l.e)(t);Object(l.h)(e),await j("INSERT INTO messages_clock (id, clock) VALUES (?, ?)",[1,Object(l.g)(e)])}}function j(t,e,r){return s.runQuery(_,t,e,r)}function I(t){s.execQuery(_,t)}let R=new i.a({max:100});function D(t){let e=R.get(t);if(e)return e;let r=s.prepare(_,t);return R.set(t,r),r}function k(t){return s.transaction(_,t)}function N(t){return s.asyncTransaction(_,t)}async function C(t,e){return j(t,e,!0)}async function x(t,e){const r=await j(t,e,!0);return 0===r.length?null:r[0]}function L(t,e){const r=j(t,e,!0);return 0===r.length?null:r[0]}async function P(t,e){return j(t,e)}async function B(t,e){return(await j("SELECT * FROM "+t+" WHERE id = ?",[e],!0))[0]}async function U(t,e){let r=Object.keys(e).filter(t=>"id"!==t);if(null==e.id)throw new Error("update: id is required");await Object(d.j)(r.map(r=>({dataset:t,row:e.id,column:r,value:e[r],timestamp:l.a.send()})))}async function F(t,e){return e.id||(e=m(m({},e),{},{id:b.v4Sync()})),await W(t,e),e.id}async function W(t,e){let r=Object.keys(e).filter(t=>"id"!==t);if(null==e.id)throw new Error("insert: id is required");await Object(d.j)(r.map(r=>({dataset:t,row:e.id,column:r,value:e[r],timestamp:l.a.send()})))}async function H(t,e){await Object(d.j)([{dataset:t,row:e,column:"tombstone",value:1,timestamp:l.a.send()}])}async function q(t,e,r){return(await j(e,r,!0)).map(e=>Object(c.d)(c.h,c.i,t,e)).filter(Boolean)}async function z(t,e,r){let n=await q(t,e,r);return n.length>0?n[0]:null}function V(t,e){return e.id||(e=m(m({},e),{},{id:b.v4Sync()})),F(t,Object(c.b)(c.h,c.i,t,e))}function Y(t,e){return U(t,Object(c.c)(c.h,c.i,t,e))}async function G(){return C("\n SELECT c.* FROM categories c\n LEFT JOIN category_groups cg ON c.cat_group = cg.id\n WHERE c.tombstone = 0\n ORDER BY cg.sort_order, cg.id, c.sort_order, c.id\n ")}async function $(){const t=await C("SELECT * FROM category_groups WHERE tombstone = 0 ORDER BY is_income, sort_order, id"),e=await C("\n SELECT * FROM categories WHERE tombstone = 0\n ORDER BY sort_order, id\n ");return t.map(t=>m(m({},t),{},{categories:e.filter(e=>e.cat_group===t.id)}))}async function K(t){const e=await x("\n SELECT sort_order FROM category_groups WHERE tombstone = 0 ORDER BY sort_order DESC, id DESC LIMIT 1\n "),r=(e?e.sort_order:0)+16384;return F("category_groups",t=m(m({},f.b.validate(t)),{},{sort_order:r}))}function Z(t){return U("category_groups",t=f.b.validate(t,{update:!0}))}async function J(t,e){const r=g(await C("SELECT id, sort_order FROM category_groups WHERE tombstone = 0 ORDER BY sort_order, id"),e),n=r.updates,i=r.sort_order;for(let t of n)await U("category_groups",t);await U("category_groups",{id:t,sort_order:i})}async function X(t,e){const r=await C("SELECT * FROM categories WHERE cat_group = ?",[t.id]);await Promise.all(r.map(t=>rt(t,e))),await H("category_groups",t.id)}async function Q(t,{atEnd:e}={}){let r,n;return await Object(d.c)(async()=>{if(e){const t=await x("\n SELECT sort_order FROM categories WHERE tombstone = 0 ORDER BY sort_order DESC, id DESC LIMIT 1\n ");r=(t?t.sort_order:0)+16384}else{const e=await C("SELECT id, sort_order FROM categories WHERE cat_group = ? AND tombstone = 0 ORDER BY sort_order, id",[t.cat_group]),n=g(e,e.length>0?e[0].id:null),i=n.updates,o=n.sort_order;for(let t of i)await U("categories",t);r=o}t=m(m({},f.c.validate(t)),{},{sort_order:r});const i=await F("categories",t);await W("category_mapping",{id:i,transferId:i}),n=i}),n}function tt(t){return U("categories",t=f.c.validate(t,{update:!0}))}async function et(t,e,r){if(!e)throw new Error("moveCategory: groupId is required");const n=g(await C("SELECT id, sort_order FROM categories WHERE cat_group = ? AND tombstone = 0 ORDER BY sort_order, id",[e]),r),i=n.updates,o=n.sort_order;for(let t of i)await U("categories",t);await U("categories",{id:t,sort_order:o,cat_group:e})}async function rt(t,e){if(e){const r=await C("SELECT * FROM category_mapping WHERE transferId = ?",[t.id]);for(let t of r)await U("category_mapping",{id:t.id,transferId:e});await U("category_mapping",{id:t.id,transferId:e})}return H("categories",t.id)}async function nt(t){return x("SELECT * FROM payees WHERE id = ?",[t])}async function it(t){let e;return t=f.e.validate(t),await Object(d.c)(async()=>{e=await F("payees",t),await W("payee_mapping",{id:e,targetId:e})}),e}async function ot(t){if((await x("SELECT * FROM payees WHERE id = ?",[t.id])).transfer_acct)return;let e=await C("SELECT * FROM payee_rules WHERE payee_id = ?",[t.id]);return await Promise.all(e.map(t=>ht({id:t.id}))),H("payees",t.id)}async function at(t){return H("payees",t.id)}function st(t){return U("payees",t=f.e.validate(t,{update:!0}))}async function ut(t,e){let r=Object(u.i)(await C("SELECT * FROM payees"));null==r[t].transfer_acct&&(e=e.filter(t=>null==r[t].transfer_acct),await Object(d.c)(async()=>(await Promise.all(e.map(async e=>{let r=await C("SELECT id FROM payee_mapping WHERE targetId = ?",[e]);await Promise.all(r.map(e=>U("payee_mapping",{id:e.id,targetId:t})))})),Promise.all(e.map(e=>Promise.all([U("payee_mapping",{id:e,targetId:t}),H("payees",e)]))))))}function ct(){return C("\n SELECT p.*, COALESCE(a.name, p.name) AS name FROM payees p\n LEFT JOIN accounts a ON (p.transfer_acct = a.id AND a.tombstone = 0)\n WHERE p.tombstone = 0 AND (p.transfer_acct IS NULL OR a.id IS NOT NULL)\n ORDER BY p.transfer_acct IS NULL DESC, p.name COLLATE NOCASE\n ")}async function lt(){return(await C("\n SELECT p.id FROM payees p\n LEFT JOIN payee_mapping pm ON pm.id = p.id\n LEFT JOIN v_transactions_internal_alive t ON t.payee = pm.targetId\n WHERE p.tombstone = 0 AND p.transfer_acct IS NULL AND t.id IS NULL\n ")).map(t=>t.id)}async function ft(t){return x("SELECT * FROM payees WHERE LOWER(name) = ? AND tombstone = 0",[t.toLowerCase()])}function dt(t){return F("payee_rules",t=f.f.validate(t))}function ht(t){return H("payee_rules",t.id)}function gt(t){return U("payee_rules",t=f.e.validate(t,{update:!0}))}function pt(t){return C("SELECT pr.* FROM payee_rules pr\n LEFT JOIN payee_mapping pm ON pm.id = pr.payee_id\n WHERE pm.targetId = ? AND pr.tombstone = 0",[t])}function mt(){return C("SELECT a.*, b.name as bankName, b.id as bankId FROM accounts a\n LEFT JOIN banks b ON a.bank = b.id\n WHERE a.tombstone = 0\n ORDER BY sort_order, name")}async function yt(t){void 0===t.type&&(t=m(m({},t),{},{type:"checking"}));let e=g(await C("SELECT * FROM accounts WHERE offbudget = ? ORDER BY sort_order, name",[null!=t.offbudget?t.offbudget:0])).sort_order;return F("accounts",t=f.a.validate(m(m({},t),{},{sort_order:e})))}function bt(t){return U("accounts",t=f.a.validate(t,{update:!0}))}function wt(t){return H("accounts",t.id)}async function _t(t,e){let r,n=await x("SELECT * FROM accounts WHERE id = ?",[t]);r=n.closed?await C("SELECT id, sort_order FROM accounts WHERE closed = 1 ORDER BY sort_order, name"):await C("SELECT id, sort_order FROM accounts WHERE tombstone = 0 AND offbudget = ? ORDER BY sort_order, name",[n.offbudget]);const i=g(r,e),o=i.updates,a=i.sort_order;await Object(d.c)(()=>{for(let t of o)U("accounts",t);U("accounts",{id:t,sort_order:a})})}async function vt(t){return(await q("transactions","SELECT * FROM v_transactions WHERE id = ?",[t]))[0]}async function Et(t,e,r,n={}){throw new Error("`getTransactionsByDate` is deprecated")}async function St(t,e){if(void 0!==e)throw new Error("`getTransactions` was given a second argument, it now only takes a single argument `accountId`");return q("transactions","SELECT * FROM v_transactions WHERE account = ?",[t])}function Ot(t){return V("transactions",t)}function Tt(t){return Y("transactions",t)}async function At(t){return H("transactions",t.id)}},function(t,e,r){"use strict";(function(t){r.d(e,"l",(function(){return m})),r.d(e,"s",(function(){return y})),r.d(e,"k",(function(){return b})),r.d(e,"f",(function(){return w})),r.d(e,"e",(function(){return _})),r.d(e,"d",(function(){return v})),r.d(e,"m",(function(){return E})),r.d(e,"b",(function(){return S})),r.d(e,"r",(function(){return O})),r.d(e,"a",(function(){return T})),r.d(e,"q",(function(){return A})),r.d(e,"j",(function(){return M})),r.d(e,"i",(function(){return j})),r.d(e,"c",(function(){return I})),r.d(e,"n",(function(){return D})),r.d(e,"o",(function(){return k})),r.d(e,"h",(function(){return N})),r.d(e,"p",(function(){return C})),r.d(e,"g",(function(){return x}));var n=r(34),i=r(55),o=r(126),a=r(46),s=r(127),u=r(105),c=r(163),l=r(62),f=r(79),d=r(75);function h(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return g(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function p(t){if("string"==typeof t){let e=h(t.split("-"),3),r=e[0],n=e[1],i=e[2];return null!=i?new Date(parseInt(r),parseInt(n)-1,parseInt(i),12):null!=n?new Date(parseInt(r),parseInt(n)-1,1,12):new Date(parseInt(r),0,1,12)}return t}const m=p;function y(t){return n.a(p(t),"yyyy")}function b(t){return n.a(p(t),"yyyy-MM")}function w(t){return n.a(p(t),"yyyy-MM-dd")}function _(){return t.IS_TESTING?"2017-01":n.a(new Date,"yyyy-MM")}function v(){return t.IS_TESTING?"2017-01-01":n.a(new Date,"yyyy-MM-dd")}function E(t){return n.a(o.a(p(t),1),"yyyy-MM")}function S(t,e){return n.a(i.a(p(t),e),"yyyy-MM")}function O(t,e){return n.a(o.a(p(t),e),"yyyy-MM")}function T(t,e){return n.a(a.a(p(t),e),"yyyy-MM-dd")}function A(t,e){return n.a(s.a(p(t),e),"yyyy-MM-dd")}function M(t,e){return u.a(p(t),p(e))}function j(t,e){return c.a(p(t),p(e))}function I(t){return{start:parseInt(n.a(l.a(p(t)),"yyyyMMdd")),end:parseInt(n.a(f.a(p(t)),"yyyyMMdd"))}}function R(t,e,r){const n=[];let i=b(t);for(;u.a(p(i),p(e));)n.push(i),i=S(i,1);return r&&n.push(i),n}function D(t,e){return R(t,e)}function k(t,e){return R(t,e,!0)}function N(t){return t.slice(0,7)}function C(t){return"budget"+t.replace("-","")}function x(t,e){return n.a(p(t),e)}Object(d.a)(t=>new RegExp(t.replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{4}"))),Object(d.a)(t=>t.replace(/y+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"")),Object(d.a)(t=>{let e=t.replace(/y+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}");return new RegExp("^"+e+"$")}),Object(d.a)(t=>t.replace(/d+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/\/\//,"/").replace(/\.\./,".").replace(/--/,"-")),Object(d.a)(t=>{let e=t.replace(/d+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/\/\//,"/").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{2,4}");return new RegExp("^"+e+"$")}),Object(d.a)(t=>t.replace(/y+/g,"yy")),Object(d.a)(t=>{let e=t.replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{2}");return new RegExp("^"+e+"$")})}).call(this,r(24))},function(t,e,r){"use strict";function n(t){if(null===t||!0===t||!1===t)return NaN;var e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}r.d(e,"a",(function(){return n}))},function(t,e,r){(function(e){let n=r(290).SQLiteFS,i=r(291).default,o=r(49),a=r(174),s=r(13)._getModule,u=r(398),c=r(399),l=null,f=null;function d(t){return t.replace(/^\//,"").replace(/\//g,"-")}function h(t){try{return l.readlink(t),!0}catch(t){}try{return l.stat(t),!0}catch(t){}return!1}function g(t){let e=t.split("/").filter(t=>""!==t),r="";for(let t of e)r+="/"+t,h(r)||l.mkdir(r)}function p(t){return t.startsWith("/documents")&&(t.endsWith(".sqlite")?h(t)||l.symlink("/blocked/"+d(t),t):l.writeFile(t,"!$@) this should never read !$@)")),t}async function m(t,e){if(t.startsWith("/documents")&&!t.endsWith(".sqlite")){if(!h(t))throw new Error("File does not exist: "+t);let r=a.getStore(await a.getDatabase(),"files").store,n=await a.get(r,t);if(null==n)throw new Error("File does not exist: "+t);return"utf8"===e.encoding&&ArrayBuffer.isView(n.contents)?String.fromCharCode.apply(null,new Uint16Array(n.contents.buffer)):n.contents}return l.readFile(y(t),e)}function y(t){try{return l.lookupPath(t,{follow:!1}).node.link?l.readlink(t):t}catch(e){return t}}async function b(t,e){if(e instanceof ArrayBuffer?e=new Uint8Array(e):ArrayBuffer.isView(e)&&(e=new Uint8Array(e.buffer)),p(t),t.startsWith("/documents")){let r=t.endsWith(".sqlite"),n=a.getStore(await a.getDatabase(),"files").store;r?(await a.set(n,{filepath:t,contents:""}),await Promise.resolve(),l.writeFile(y(t),e)):await a.set(n,{filepath:t,contents:e})}else l.writeFile(y(t),e)}async function w(){let t=(await(await fetch("/data-file-index.txt")).text()).split("\n").map(t=>t.trim()).filter(t=>""!==t);await O("/migrations"),await O("/demo-budget"),await Promise.all(t.map(async t=>{var e;b("/"+t,await(e="/data/"+t,fetch(e).then(t=>t.arrayBuffer())))}))}async function _(){let t=a.getStore(await a.getDatabase(),"files").store.getAllKeys(),e=await new Promise((e,r)=>{t.onsuccess=t=>e(t.target.result),t.onerror=t=>r(t)});for(let t of e)g(v(t)),p(t)}function v(t){return t.split("/").slice(0,-1).join("/")}async function E(t){return l.readdir(t).filter(t=>"."!==t&&".."!==t)}async function S(t){return h(t)}async function O(t){l.mkdir(t)}async function T(t){return async function(t){if(t.startsWith("/documents")){let e=t.endsWith(".sqlite"),r=a.getStore(await a.getDatabase(),"files").store;if(await a.del(r,t),e){let e=y(t);h(e)&&l.unlink(e)}}l.unlink(t)}(t)}async function A(t){l.rmdir(t)}t.exports={pathToId:d,populateFileHeirarchy:_,init:async function(){let t=s();if(l=t.FS,l.mkdir("/uploads"),l.mkdir("/documents"),l.mkdir("/blocked"),!e.__TESTING__){let e=new i(()=>{o.send("fallback-write-error")});f=new n(l,e),t.register_for_idb(f),l.mount(f,{},"/blocked"),await w()}await _()},shutdown:function(){f.backend.shutdown()},bundledDatabasePath:"/default-db.sqlite",migrationsPath:"/migrations",demoBudgetPath:"/demo-budget",getDataDir:u.getDataDir,getDocumentDir:u.getDocumentDir,getBudgetDir:u.getBudgetDir,_setDocumentDir:u._setDocumentDir,join:c,basename:v,listDir:E,exists:S,mkdir:O,size:async function(t){return l.stat(y(t)).size},copyFile:async function(t,e){return b(e,await m(t))},readFile:async function(t,e="utf8"){return m(t,{encoding:e})},writeFile:async function(t,e){return b(t,e)},removeFile:T,removeDir:A,removeDirRecursively:async function t(e){if(await S(e)){for(let r of await E(e)){let n=c(e,r),i=l.stat(n,!0);l.isDir(i.mode)?await t(n):await T(n)}await A(e)}},getModifiedTime:async function(t){throw new Error("getModifiedTime not supported on the web (only used for backups)")}}}).call(this,r(24))},function(t,e,r){"use strict";(function(t){r.d(e,"b",(function(){return h})),r.d(e,"e",(function(){return m})),r.d(e,"i",(function(){return y})),r.d(e,"g",(function(){return b})),r.d(e,"f",(function(){return w})),r.d(e,"c",(function(){return _})),r.d(e,"d",(function(){return v})),r.d(e,"h",(function(){return E})),r.d(e,"a",(function(){return S})),r.d(e,"j",(function(){return O}));var n=r(25),i=r(13),o=r(2),a=r(40),s=r(7),u=r(165);const c=r(54).resolveName;let l,f,d;function h(){return l}async function g(t,e){await i.transaction(t,()=>{e.forEach(e=>{const r=l._getNode(e);null==r.sql&&i.runQuery(t,"INSERT OR REPLACE INTO kvcache (key, value) VALUES (?, ?)",[e,JSON.stringify(r.value)])})})}function p(t,e,{clean:r}){if(r){let r=1e7*Math.random();i.runQuery(e,"INSERT OR REPLACE INTO kvcache_key (id, key) VALUES (1, ?)",[r]),t&&i.runQuery(t,"INSERT OR REPLACE INTO kvcache_key (id, key) VALUES (1, ?)",[r])}else i.runQuery(e,"DELETE FROM kvcache_key")}async function m(e,r){let o,s,c=!t.__TESTING__,h=e.getDatabase();if(a.a.isDesktop&&c){let t=e.getDatabasePath().replace(/db\.sqlite$/,"cache.sqlite");d=o=i.openDatabase(t),i.execQuery(o,"\n CREATE TABLE IF NOT EXISTS kvcache (key TEXT PRIMARY KEY, value TEXT);\n CREATE TABLE IF NOT EXISTS kvcache_key (id INTEGER PRIMARY KEY, key REAL)\n ")}else o=h;if(s=c?new u.a(g.bind(null,o),p.bind(null,h,o)):new u.a,Object(n.captureBreadcrumb)({message:"loading spreaadsheet",category:"server"}),l=s,f=r,r&&s.addEventListener("change",r),c&&!function(t,e){let r=i.runQuery(e,"SELECT key FROM kvcache_key WHERE id = 1",[],!0),n=0===r.length?null:r[0].key;if(null==n)return!0;if(t){let e=i.runQuery(t,"SELECT key FROM kvcache_key WHERE id = 1",[],!0);if(0===e.length||e[0].key!==n)return!0}return r=i.runQuery(e,"SELECT * FROM kvcache LIMIT 1",[],!0),0===r.length}(h,o)){let t=await i.runQuery(o,"SELECT * FROM kvcache",[],!0);console.log(`Loaded spreadsheet from cache (${t.length} items)`);for(let e of t){let t=JSON.parse(e.value);s.load(e.key,t)}}else console.log("Loading fresh spreadsheet"),await w(e);return Object(n.captureBreadcrumb)({message:"loaded spreaadsheet",category:"server"}),s}function y(){l&&(l.unload(),l=null),d&&(i.closeDatabase(d),d=null)}async function b(t){if(l)return y(),m(t,f)}async function w(t){let e=l,r=(s.b()||{}).budgetType,n="report"===r?"reflect_budgets":"zero_budgets",i=await t.all(`\n SELECT * FROM ${n} b\n LEFT JOIN categories c ON c.id = b.category\n WHERE c.tombstone = 0\n `);e.startTransaction();for(let t of i)if(t.month&&t.category){let r="budget"+t.month;e.set(`${r}!budget-${t.category}`,t.amount),e.set(`${r}!carryover-${t.category}`,1===t.carryover)}if("report"!==r){let r=await t.all("SELECT * FROM zero_budget_months");for(let t of r){let r=Object(o.p)(t.id);e.set(r+"!buffered",t.buffered)}}e.endTransaction()}function _(t,e){return l._getNode(c(t,e))}function v(t,e){return l.getValue(c(t,e))}function E(){l&&l.startTransaction()}function S(){l&&l.endTransaction()}function O(){return new Promise(t=>{l?l.onFinish(t):t()})}}).call(this,r(24))},function(t,e,r){"use strict";r.r(e),function(t){r.d(e,"mutator",(function(){return h})),r.d(e,"isMutating",(function(){return g})),r.d(e,"runHandler",(function(){return m})),r.d(e,"enableGlobalMutations",(function(){return y})),r.d(e,"disableGlobalMutations",(function(){return b})),r.d(e,"runMutator",(function(){return w})),r.d(e,"withMutatorContext",(function(){return _})),r.d(e,"getMutatorContext",(function(){return v}));var n=r(25),i=r(90);function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function s(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}let u=new Set,c=null,l=new WeakMap,f=!1,d=[];function h(t){return l.set(t,!0),t}function g(t){return l.has(t)}function p(t){return new Promise(e=>setTimeout(e,t))}async function m(t,e,{undoTag:r,name:n}={}){if(d.push(n),d.length>5&&(d=d.slice(-5)),l.has(t))return w(()=>t(e),{undoTag:r});"close-budget"===n&&await async function(){for(await p(200);u.size>0;)await Promise.all([...u.values()]),await p(100)}();let i=t(e);return u.add(i),i.then(()=>{u.delete(i)}),i}function y(){t.__TESTING__&&(f=!0)}function b(){t.__TESTING__&&(f=!1)}const w=Object(i.sequential)(async(t,e={})=>(c=e,t().finally(()=>{c=null})));function _(t,e){if(null==c&&!f)return Object(n.captureBreadcrumb)("Recent methods: "+d.join(", ")),Object(n.captureException)(new Error("withMutatorContext: mutator not running")),e();let r=c;return c=a(a({},c),t),e().finally(()=>{c=r})}function v(){return null==c?(Object(n.captureBreadcrumb)({category:"server",message:"Recent methods: "+d.join(", ")}),{}):null==c&&f?{}:c}}.call(this,r(24))},function(t,e,r){"use strict";(function(t){r.d(e,"c",(function(){return s})),r.d(e,"d",(function(){return u})),r.d(e,"e",(function(){return c})),r.d(e,"b",(function(){return l})),r.d(e,"a",(function(){return f}));var n=r(9),i=r(8);const o=r(4);let a=null;async function s(e){if(t.__TESTING__&&!e)return a={dummyTestPrefs:!0},a;const r=o.join(o.getBudgetDir(e),"metadata.json");try{a=JSON.parse(await o.readFile(r))}catch(t){a={id:e,budgetName:e}}return a.id=e,a}async function u(t,{avoidSync:e=!1}={}){if(Object.assign(a,t),!e){let e=Object.keys(t).map(e=>"budgetType"===e||"budgetName"===e?{dataset:"prefs",row:e,column:"value",value:t[e],timestamp:n.a.send()}:null).filter(t=>t);e.length>0&&await Object(i.j)(e)}if(!a.dummyTestPrefs){let t=o.join(o.getBudgetDir(a.id),"metadata.json");await o.writeFile(t,JSON.stringify(a))}}function c(){a=null}function l(){return a}function f(t,e){return{id:t,budgetName:e,"notifications.schedules":!0,"notifications.repair-splits":!0}}}).call(this,r(24))},function(t,e,r){"use strict";(function(t){r.d(e,"k",(function(){return D})),r.d(e,"a",(function(){return B})),r.d(e,"b",(function(){return U})),r.d(e,"c",(function(){return z})),r.d(e,"j",(function(){return V})),r.d(e,"l",(function(){return G})),r.d(e,"d",(function(){return $})),r.d(e,"f",(function(){return J})),r.d(e,"e",(function(){return X}));var n=r(25),i=r(10),o=r.n(i),a=r(65),s=r(90),u=r(15),c=r(59),l=r(9),f=r(1),d=r(28),h=r(6),g=r(30),p=r(7),m=r(19),y=r(5),b=r(16),w=r(166),_=r(121),v=r(232);r.d(e,"g",(function(){return v.a}));var E=r(233);function S(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function O(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?S(Object(r),!0).forEach((function(e){T(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function T(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.d(e,"i",(function(){return E.a})),r.d(e,"h",(function(){return _.a}));const A=r(49),M=r(21),j=M.PostError,I=M.SyncError;let R="enabled";function D(t){let e=R;switch(t){case"enabled":R="enabled";break;case"offline":R="offline";break;case"disabled":R="disabled";break;case"import":R="import";break;default:throw new Error("setSyncingMode: invalid mode: "+t)}return e}function k(t){switch(t){case"enabled":return"enabled"===R||"offline"===R;case"disabled":return"disabled"===R||"import"===R;case"offline":return"offline"===R;case"import":return"import"===R;default:throw new Error("checkSyncingMode: invalid mode: "+t)}}function N(t,e){let r=t.dataset,n=t.row,i=t.column,o=t.value;if("prefs"===r);else try{let t;t=e?{sql:f.cache(`UPDATE ${r} SET ${i} = ? WHERE id = ?`),params:[o,n]}:{sql:f.cache(`INSERT INTO ${r} (id, ${i}) VALUES (?, ?)`),params:[n,o]},f.runQuery(t.sql,t.params)}catch(t){throw new I("invalid-schema")}}async function C(t,e){let r=[];for(let n=0;n<e.length;n+=500){let i,o=e.slice(n,n+500),a=t+".id";"transactions"===t?(i="\n SELECT t.*, c.transferId AS category\n FROM transactions t\n LEFT JOIN category_mapping c ON c.id = t.category\n ",a="t.id"):i="SELECT * FROM "+t,i+=" WHERE ",i+=o.map(t=>a+" = ?").join(" OR ");try{let t=await f.runQuery(i,o,!0);r=r.concat(t)}catch(t){throw new I("invalid-schema")}}return r}function x(t){if(null===t)return"0:";if("number"==typeof t)return"N:"+t;if("string"==typeof t)return"S:"+t;throw new Error("Unserializable value type: "+JSON.stringify(t))}function L(t){switch(t[0]){case"0":return null;case"N":return parseFloat(t.slice(2));case"S":return t.slice(2)}throw new Error("Invalid type key for value: "+t)}let P=[];function B(t){return P.push(t),()=>{P=P.filter(e=>e!==t)}}const U=Object(s.sequential)(async t=>{if(k("import"))return function(t){f.transaction(()=>{for(let e=0;e<t.length;e++){let r=t[e],n=r.dataset;r.row,r.column,r.timestamp,r.value;if(!r.old){try{N(r)}catch(t){N(r,!0)}if("prefs"===n)throw new Error("Cannot set prefs while importing")}}})}(t);k("enabled")&&(t=await async function(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r],i=n.dataset,o=n.row,a=n.column,s=n.timestamp.toString(),u=f.runQuery(f.cache("SELECT timestamp FROM messages_crdt WHERE dataset = ? AND row = ? AND column = ? AND timestamp >= ?"),[i,o,a,s],!0);0===u.length?e.push(n):u[0].timestamp!==s&&e.push(O(O({},n),{},{old:!0}))}return e}(t)),t=[...t].sort((t,e)=>{let r=t.timestamp?t.timestamp.toString():"",n=e.timestamp?e.timestamp.toString():"";return r<n?-1:r>n?1:0});let e={};async function r(){let t=new Map;for(let r of Object.keys(e)){const n=await C(r,e[r]);for(let e=0;e<n.length;e++){let i=n[e];Object(u.o)(t,[r,i.id],i)}}return t}t.forEach(t=>{"prefs"!==t.dataset&&(null==e[t.dataset]&&(e[t.dataset]=[]),e[t.dataset].push(t.row))});let n,i,o={},a=await r();b.a(t,a),k("enabled")&&(n=Object(l.c)(),i=n.merkle),y.b()&&y.b().startCacheBarrier(),f.transaction(()=>{let e=new Set;for(let r=0;r<t.length;r++){let n=t[r],s=n.dataset,c=n.row,d=n.column,h=n.timestamp,g=n.value;n.old||(N(n,Object(u.g)(a,[s,c])||e.has(s+c)),"prefs"===s?o[c]=g:e.add(s+c)),k("enabled")&&(f.runQuery(f.cache("INSERT INTO messages_crdt (timestamp, dataset, row, column, value)\n VALUES (?, ?, ?, ?, ?)"),[h.toString(),s,c,d,x(g)]),i=l.f.insert(i,n.timestamp))}k("enabled")&&(i=l.f.prune(i),f.runQuery(f.cache("INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)"),[Object(l.g)(O(O({},n),{},{merkle:i}))]))}),k("enabled")&&(n.merkle=i),Object.keys(o).length>0&&(p.d(o,{avoidSync:!0}),o.budgetType&&Object(c.c)(o.budgetType),A.send("prefs-updated"));let s=await r();y.b()&&(y.h(),Object(c.d)(a,s),y.b().triggerDatabaseChanges(a,s),y.a(),y.b().endCacheBarrier()),P.forEach(t=>t(a,s));let h=Z(t.filter(t=>!t.old));return d.a.events.emit("sync",{type:"applied",tables:h,data:s,prevData:a}),t});function F(t){return t.forEach(t=>{l.a.recv(t.timestamp)}),Object(h.runMutator)(()=>U(t))}async function W(e){try{await U(e)}catch(t){throw t instanceof I&&("invalid-schema"===t.reason?d.a.events.emit("sync",{type:"error",subtype:"apply-failure"}):d.a.events.emit("sync",{type:"error"})),t}await function(){if($(),k("enabled")&&!k("offline")){if(t.__TESTING__)return X().then(t=>{if(t.error)throw t.error;return t});K=setTimeout(X,1e3)}}()}let H=!1,q=[];async function z(t){if(H)return void await t();H=!0;let e=[];try{await t()}finally{H=!1,e=q,q=[]}e.length>0&&await W(e)}async function V(t){if(!H)return W(t);q=q.concat(t)}function Y(t){return f.runQuery("SELECT timestamp, dataset, row, column, value FROM messages_crdt WHERE timestamp > ?",[t],!0)}async function G(t,e){let r=await Y(e);return await F(t.map(t=>O(O({},t),{},{value:L(t.value),timestamp:l.a.parse(t.timestamp)}))),r}function $(){K&&(clearTimeout(K),K=null)}let K=null;function Z(t){return t.reduce((t,e)=>{let r="schedules_next_date"===e.dataset?"schedules":e.dataset;return t.includes(r)||t.push(r),t},[])}async function J(){(await X()).error||await y.j()}const X=Object(s.once)((async function(){let t;d.a.events.emit("sync",{type:"start"});try{t=await async function t(e,r,n){let i=p.b()||{},s=i.cloudFileId,u=i.groupId,c=i.lastSyncedTimestamp;if($(),k("disabled")||k("offline"))return[];let d=Object(l.c)().timestamp.toString(),h=e||c||new l.a(Date.now()-3e5,0,"0").toString(),y=Y(h),b=await o.a.getItem("user-token");a.a.info("Syncing since",h,y.length,"(attempt: "+r+")");let v=await w.b(u,s,h,y),E=await Object(g.postBinary)(Object(m.a)().SYNC_SERVER+"/sync",v,{"X-ACTUAL-TOKEN":b});if(!p.b()||p.b().groupId!==u)return[];let S=await w.a(E);a.a.info("Got messages from server",S.messages.length);let T=Object(l.c)().timestamp.toString()!==d,A=[];S.messages.length>0&&(A=await F(S.messages.map(t=>O(O({},t),{},{value:L(t.value),timestamp:l.a.parse(t.timestamp)}))));let M=l.f.diff(S.merkle,Object(l.c)().merkle);S.messages;if(null!==M){if(r>=10&&M===n||r>=100){a.a.info("SENT -------"),a.a.info(JSON.stringify(y)),a.a.info("RECEIVED -------"),a.a.info(JSON.stringify(S.messages));let t=Object(_.b)();if(console.log(r,"messages:",y.length,y.length>0?y[0]:null,"res.messages:",S.messages.length,S.messages.length>0?S.messages[0]:null,"clientId",Object(l.c)().timestamp.node(),"groupId",u,"diffTime:",M,M===n,"local clock:",Object(l.c)().timestamp.toString(),Object(l.c)().merkle.hash,"rebuilt hash:",t.numMessages,t.trie.hash,"server hash:",S.merkle.hash,"localTimeChanged:",T),t.trie.hash===S.merkle.hash){let t=await f.all("SELECT * FROM messages_clock");1!==t.length&&console.log("Bad number of clocks:",t.length);let e=Object(l.b)(t[0]).merkle.hash;console.log("Merkle hash in db:",e)}throw new I("out-of-sync")}A=A.concat(await t(new l.a(M,0,"0").toString(),T?0:r+1,M))}else await p.d({lastSyncedTimestamp:Object(l.c)().timestamp.toString()});return A}(null,0,null)}catch(t){return console.log(t),t instanceof I?"out-of-sync"===t.reason?(Object(n.captureException)(t),d.a.events.emit("sync",{type:"error",subtype:"out-of-sync"})):"invalid-schema"===t.reason?d.a.events.emit("sync",{type:"error",subtype:"invalid-schema"}):"decrypt-failure"===t.reason||"encrypt-failure"===t.reason?d.a.events.emit("sync",{type:"error",subtype:t.reason,meta:t.meta}):"beta-version"===t.reason?d.a.events.emit("sync",{type:"error",subtype:t.reason}):d.a.events.emit("sync",{type:"error"}):t instanceof j?(console.log(t),"unauthorized"===t.reason?(d.a.events.emit("sync",{type:"unauthorized"}),o.a.setItem("readOnly","true")):"network-failure"===t.reason?d.a.events.emit("sync",{type:"error",subtype:"network"}):d.a.events.emit("sync",{type:"error",subtype:t.reason})):(Object(n.captureException)(t),d.a.events.emit("sync",{type:"error"})),{error:{message:t.message,reason:t.reason,meta:t.meta}}}let e=Z(t);return d.a.events.emit("sync",{type:"success",tables:e,syncDisabled:k("disabled")}),{messages:t}}))}).call(this,r(24))},function(t,e,r){"use strict";r.d(e,"f",(function(){return n})),r.d(e,"c",(function(){return m})),r.d(e,"h",(function(){return p})),r.d(e,"e",(function(){return y})),r.d(e,"d",(function(){return _})),r.d(e,"g",(function(){return b})),r.d(e,"b",(function(){return w})),r.d(e,"a",(function(){return S}));var n={};function i(t){return Object.keys(t).filter(t=>"hash"!==t)}function o(t){let e=t+"0".repeat(16-t.length);return 1e3*parseInt(e,3)*60}function a(t,e){let r=e.hash(),n=Number(e.millis()/1e3/60|0).toString(3);return function t(e,r,n){if(0===r.length)return e;const i=r[0],o=e[i]||{};return Object.assign({},e,{[i]:Object.assign({},o,t(o,r.slice(1),n),{hash:o.hash^n})})}(t=Object.assign({},t,{hash:t.hash^r}),n,r)}function s(t){let e={};for(let r of t)a(e,r);return e}function u(t,e){if(t.hash===e.hash)return null;let r=t,n=e,a="";for(;;){let t=[...new Set([...i(r),...i(n)]).values()];t.sort();let e=null;for(let i=0;i<t.length;i++){let o=t[i];if(!r[o]||!n[o])break;let a=r[o],s=n[o];if(a.hash!==s.hash){e=o;break}}if(!e)return o(a);a+=e,r=r[e]||{},n=n[e]||{}}}function c(t,e=2){if(!t.hash)return t;let r=i(t);r.sort();let n={hash:t.hash};return r=r.slice(-e).map(r=>n[r]=c(t[r],e)),n}function l(t,e="",r=0){return" ".repeat(r)+(""!==e?`k: ${e} `:"")+`hash: ${t.hash||"(empty)"}\n`+i(t).map(e=>l(t[e],e,r+2)).join("")}r.r(n),r.d(n,"getKeys",(function(){return i})),r.d(n,"keyToTimestamp",(function(){return o})),r.d(n,"insert",(function(){return a})),r.d(n,"build",(function(){return s})),r.d(n,"diff",(function(){return u})),r.d(n,"prune",(function(){return c})),r.d(n,"debug",(function(){return l}));var f=r(270),d=r.n(f);const h=r(41);let g=null;function p(t){g=t}function m(){return g}function y(t,e={}){return{timestamp:O.from(t),merkle:e}}function b(t){return JSON.stringify({timestamp:t.timestamp.toString(),merkle:t.merkle})}function w(t){let e;try{e=JSON.parse(t)}catch(t){e={timestamp:"1970-01-01T00:00:00.000Z-0000-"+_(),merkle:{}}}return{timestamp:O.from(S.parse(e.timestamp)),merkle:e.merkle}}function _(){return h.v4Sync().replace(/-/g,"").slice(-16)}var v={maxDrift:3e5};const E=parseInt("0xFFFF");class S{constructor(t,e,r){this._state={millis:t,counter:e,node:r}}valueOf(){return this.toString()}toString(){return[new Date(this.millis()).toISOString(),("0000"+this.counter().toString(16).toUpperCase()).slice(-4),("0000000000000000"+this.node()).slice(-16)].join("-")}millis(){return this._state.millis}counter(){return this._state.counter}node(){return this._state.node}hash(){return d.a.v3(this.toString())}}class O extends S{setMillis(t){this._state.millis=t}setCounter(t){this._state.counter=t}setNode(t){this._state.node=t}}O.from=t=>new O(t.millis(),t.counter(),t.node()),S.init=function(t={}){t.maxDrift&&(v.maxDrift=t.maxDrift),p(y(new S(0,0,t.node?("0000000000000000"+t.node).toString().slice(-16):"")))},S.send=function(){if(!g)return null;var t=Date.now(),e=g.timestamp.millis(),r=g.timestamp.counter(),n=Math.max(e,t),i=e===n?r+1:0;if(n-t>v.maxDrift)throw new S.ClockDriftError(n,t,v.maxDrift);if(i>E)throw new S.OverflowError;return g.timestamp.setMillis(n),g.timestamp.setCounter(i),new S(g.timestamp.millis(),g.timestamp.counter(),g.timestamp.node())},S.recv=function(t){if(!g)return null;var e=Date.now(),r=t.millis(),n=t.counter();if(r-e>v.maxDrift)throw new S.ClockDriftError;var i=g.timestamp.millis(),o=g.timestamp.counter(),a=Math.max(Math.max(i,e),r),s=a===i&&a===r?Math.max(o,n)+1:a===i?o+1:a===r?n+1:0;if(a-e>v.maxDrift)throw new S.ClockDriftError;if(s>E)throw new S.OverflowError;return g.timestamp.setMillis(a),g.timestamp.setCounter(s),new S(g.timestamp.millis(),g.timestamp.counter(),g.timestamp.node())},S.parse=function(t){if("string"==typeof t){var e=t.split("-");if(e&&5===e.length){var r=Date.parse(e.slice(0,3).join("-")).valueOf(),n=parseInt(e[3],16),i=e[4];if(!isNaN(r)&&r>=0&&!isNaN(n)&&n<=E&&"string"==typeof i&&i.length<=16)return new S(r,n,i)}}return null};var T=S.parse("1970-01-01T00:00:00.000Z-0000-0000000000000000");S.zero=function(){return T};var A=S.parse("9999-12-31T23:59:59.999Z-FFFF-FFFFFFFFFFFFFFFF");S.max=function(){return A},S.since=t=>t+"-0000-0000000000000000",S.DuplicateNodeError=class extends Error{constructor(t){super(),this.type="DuplicateNodeError",this.message="duplicate node identifier "+t}},S.ClockDriftError=class extends Error{constructor(...t){super(),this.type="ClockDriftError",this.message=["maximum clock drift exceeded"].concat(t).join(" ")}},S.OverflowError=class extends Error{constructor(){super(),this.type="OverflowError",this.message="timestamp counter overflow"}}},function(t,e,r){let n=r(174),i=n.getDatabase,o=n.closeDatabase;function a(t){t.commit&&t.commit()}t.exports={init:function(){},shutdown:function(){o()},getItem:async function(t){let e=(await i()).transaction(["asyncStorage"],"readonly"),r=e.objectStore("asyncStorage");return new Promise((n,i)=>{let o=r.get(t);o.onerror=t=>i(t),o.onsuccess=t=>n(t.target.result),a(e)})},setItem:async function(t,e){let r=(await i()).transaction(["asyncStorage"],"readwrite"),n=r.objectStore("asyncStorage");new Promise((i,o)=>{let s=n.put(e,t);s.onerror=t=>o(t),s.onsuccess=t=>i(),a(r)})},removeItem:async function(t){let e=(await i()).transaction(["asyncStorage"],"readwrite"),r=e.objectStore("asyncStorage");return new Promise((n,i)=>{let o=r.delete(t);o.onerror=t=>i(t),o.onsuccess=t=>n(),a(e)})},multiGet:async function(t){let e=(await i()).transaction(["asyncStorage"],"readonly"),r=e.objectStore("asyncStorage"),n=Promise.all(t.map(t=>new Promise((e,n)=>{let i=r.get(t);i.onerror=t=>n(t),i.onsuccess=r=>e([t,r.target.result])})));return a(e),n},multiSet:async function(t){let e=(await i()).transaction(["asyncStorage"],"readwrite"),r=e.objectStore("asyncStorage"),n=Promise.all(t.map(([t,e])=>new Promise((n,i)=>{let o=r.put(e,t);o.onerror=t=>i(t),o.onsuccess=t=>n()})));return a(e),n},multiRemove:async function(t){let e=(await i()).transaction(["asyncStorage"],"readwrite"),r=e.objectStore("asyncStorage"),n=Promise.all(t.map(t=>new Promise((e,n)=>{let i=r.delete(t);i.onerror=t=>n(t),i.onsuccess=t=>e()})));return a(e),n}}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},function(t,e,r){"use strict";r.d(e,"b",(function(){return d})),r.d(e,"c",(function(){return h})),r.d(e,"d",(function(){return g})),r.d(e,"a",(function(){return et})),r.d(e,"e",(function(){return ct})),r.d(e,"h",(function(){return gt})),r.d(e,"i",(function(){return pt})),r.d(e,"g",(function(){return Mt})),r.d(e,"f",(function(){return At}));var n=r(2),i=r(18);function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function s(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t,e){return e.required||"id"===t}function c(t,e){if(void 0===t)throw new Error("Query value cannot be undefined");if(null===t)return"boolean"===e?0:null;switch(e){case"date":if(t instanceof Date)return Object(i.h)(Object(n.f)(t));if(null==t.match(/^\d{4}-\d{2}-\d{2}$/)||t.date<"2000-01-01")throw new Error("Invalid date: "+t);return Object(i.h)(t);case"date-month":return Object(i.h)(t.slice(0,7));case"date-year":return Object(i.h)(t.slice(0,4));case"boolean":return t?1:0;case"id":if("string"!=typeof t&&null!==t)throw new Error("Invalid id, must be string: "+t);return t;case"integer":if("number"==typeof t&&(0|t)===t)return t;throw new Error("Can't convert to integer: "+JSON.stringify(t));case"json":return JSON.stringify(t)}return t}function l(t,e){if(null===t)return"boolean"!==e&&null;switch(e){case"date":return Object(i.d)(t);case"date-month":return Object(i.d)(t).slice(0,7);case"date-year":return Object(i.d)(t).slice(0,4);case"boolean":return 1===t;case"json":case"json/fallback":try{return JSON.parse(t)}catch(r){return"json/fallback"===e?t:null}}return t}function f(t,e,r,n,{skipNull:i}={}){let o=t[r];if(null==o)throw new Error(`Table "${r}" does not exist`);let a=e.views||{},s=t=>a[r]&&a[r].fields&&a[r].fields[t]||t;return Object.fromEntries(Object.keys(n).map(t=>{if("_"===t[0])return null;let e=o[t];if(null==e)throw new Error(`Field "${t}" does not exist on table ${r}: ${JSON.stringify(n)}`);if(u(t,e)&&null==n[t])throw new Error(`"${t}" is required for table "${r}": ${JSON.stringify(n)}`);return i&&null==n[t]?null:[s(t),c(n[t],e.type)]}).filter(Boolean))}function d(t,e,r,n){let i=a({},n),o=t[r];if(null==o)throw new Error(`Error inserting: table "${r}" does not exist`);return Object.keys(o).forEach(t=>{let e=o[t];if(null==i[t])if(void 0!==e.default)i[t]="function"==typeof e.default?e.default():e.default;else if(u(t,e))throw new Error(`"${t}" is required for table "${r}": ${JSON.stringify(i)}`)}),f(t,e,r,i,{skipNull:!0})}function h(t,e,r,n){let i=a({},n);if(null==t[r])throw new Error(`Error updating: table "${r}" does not exist`);return f(t,e,r,i)}function g(t,e,r,n){let i=t[r];if(null==i)throw new Error(`Table "${r}" does not exist`);let o=Object.keys(i),a={};for(let t=0;t<o.length;t++){let e=o[t],r=i[e];a[e]=l(n[e],r.type)}return a}const p=["$transform"],m=["$dir"];function y(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?y(Object(r),!0).forEach((function(e){w(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function w(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _(t,e){if(null==t)return{};var r,n,i=function(t,e){if(null==t)return{};var r,n,i={},o=Object.keys(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||(i[r]=t[r]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}function v(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return E(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return E(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}let S=0;function O(t){return S++,t+S}class T extends Error{}function A(t){return parseInt(t.replace(/-/g,""))}function M(t,e,r,n){return null!=t[e].tombstone?`${n} AND ${r}.tombstone = 0`:n}function j(t){let e=t.split(".");return{path:e.slice(0,-1).join("."),field:e[e.length-1]}}function I(t){return-1===t.indexOf(".")&&"group"!==t?t:`"${t}"`}function R(t,e,{literal:r=!1}={}){return{value:t,type:e,literal:r}}function D(t,e){let r=t.schema,n=t.paths,i=e.split(".");if(i.length<2)throw new T("Invalid path: "+e);let o,a=i[0],s=i.slice(1).reduce((t,e)=>{let n=r[t];if(null==n)throw new T(`Path error: ${t} table does not exist`);if(!n[e]||null==n[e].ref)throw new T(`Field not joinable on table ${t}: "${e}"`);return n[e].ref},a),u=i.slice(0,-1);if(1===u.length)o=u[0];else{let t=u.join("."),e=n.get(t);if(!e)throw new T("Path does not exist: "+t);o=e.tableId}return{tableName:s,tableId:O(s),joinField:i[i.length-1],joinTable:o}}function k(t,e){let r=e.split(".");return r=r.reduce((t,e)=>{let r=t.context+"."+e;return{context:r,path:[...t.path,r]}},{context:t.implicitTableName,path:[]}).path,r.forEach(e=>{t.paths.get(e)||t.paths.set(e,D(t,e))}),t.paths.get(r[r.length-1])}function N(t,e){if("string"!=typeof e)throw new T("Invalid field name, must be a string");let r,n=j(e),i=n.path,o=n.field;r=""===i?{tableName:t.implicitTableName,tableId:t.implicitTableId}:k(t,i);let a=function(t,e,r){if(null==t[e])throw new T(`Table "${e}" does not exist in the schema`);let n=t[e][r];if(null==n)throw new T(`Field "${r}" does not exist in table "${e}"`);return n}(t.schema,r.tableName,o);if(t.validateRefs&&a.ref&&"id"===a.type&&"id"!==o){let n=t.implicitTableName+"."+e,i=t.paths.get(n);i||(i=D(t,n),i.noMapping=!0,t.paths.set(n,i)),o="id",r=i}return R(r.tableId+"."+o,a.type)}function C(t){let e=t.match(/^(\d{4}-\d{2}-\d{2})$/);return e?R(A(e[1]),"date",{literal:!0}):null}function x(t){let e=t.match(/^(\d{4}-\d{2})$/);return e?R(A(e[1]),"date",{literal:!0}):null}function L(t,e){throw new T(`Bad ${e} format: ${t}`)}function P(t,e,r){if(e.type===r)return e;if("param"===e.type)return function(t,e){let r=t.paramType;if(r){let t={date:["string"],"date-month":["date"],"date-year":["date","date-month"],id:["string"],float:["integer"]};if(!(r===e||t[e]&&t[e].includes(r)))throw new Error(`Parameter "${name}" can't convert to ${e} (already inferred as ${r})`)}else t.paramType=e}(e,r),R(e.value,r);if("null"===e.type){if(!e.literal)throw new T("A non-literal null doesn't make sense");return"boolean"===r?R(0,"boolean",{literal:!0}):e}if("date"===r){if("string"===e.type){if(e.literal)return C(e.value)||L(e.value,"date");throw new T("Casting string fields to dates is not supported")}throw new T(`Can't cast ${e.type} to date`)}if("date-month"===r){let t;if("date"===e.type)t=e;else{if("string"!==e.type&&"any"!==e.type)throw new T(`Can't cast ${e.type} to date-month`);t=x(e.value)||C(e.value)||L(e.value,"date-month")}return t.literal?R(A(t.value.toString().slice(0,6)),"date-month",{literal:!0}):R(`CAST(SUBSTR(${t.value}, 1, 6) AS integer)`,"date-month")}if("date-year"===r){let t;if("date"===e.type||"date-month"===e.type)t=e;else{if("string"!==e.type)throw new T(`Can't cast ${e.type} to date-year`);t=function(t){let e=t.match(/^(\d{4})$/);return e?R(A(e[1]),"date",{literal:!0}):null}(e.value)||x(e.value)||C(e.value)||L(e.value,"date-year")}return t.literal?R(A(t.value.toString().slice(0,4)),"date-year",{literal:!0}):R(`CAST(SUBSTR(${t.value}, 1, 4) AS integer)`,"date-year")}if("id"===r){if("string"===e.type)return R(e.value,"id",{literal:e.literal})}else if("float"===r&&"integer"===e.type)return R(e.value,"float",{literal:e.literal});if("any"===e.type)return R(e.value,r,{literal:e.literal});throw new T(`Can't convert ${e.type} to ${r}`)}function B(t,e,r){let n=e;if(r&&(n=P(0,e,r)),n.literal){if("id"===n.type)return`'${n.value}'`;if("string"===n.type){return`'${n.value.replace(/'/g,"''")}'`}}return n.value}function U(t,e,r){return e.map((t,e)=>B(0,t,r?r[e]:null))}function F(t,e,r){if(null==r&&(r=e),null!=e&&t.length<e)throw new T("Too few arguments");if(null!=r&&t.length>r)throw new T("Too many arguments")}function W(t,e){return(r,...n)=>{if(null==r||null==r.compileStack)throw new T("This function cannot track error data. It needs to accept the compiler state as the first argument.");r.compileStack.push({type:t,args:n});let i=e(r,...n);return r.compileStack.pop(),i}}function H(t){if("string"==typeof t)return t;if(void 0===t)return"undefined";let e=JSON.stringify(t);if(e.length>70){return JSON.stringify(t,null,2).split("\n").join("\n ")}return e}function q(t){if(void 0===t)throw new T("`undefined` is not a valid query value");if(null===t)return R("NULL","null",{literal:!0});if(t instanceof Date)return R(function(t){let e=t=>(t<10?"0":"")+t;return t.getFullYear()+e(t.getMonth()+1)+e(t.getDate())}(t),"date",{literal:!0});if("string"==typeof t)return R(t=t.replace(/\\\$/g,"$"),"string",{literal:!0});if("boolean"==typeof t)return R(t?1:0,"boolean",{literal:!0});if("number"==typeof t)return R(t,(0|t)===t?"integer":"float",{literal:!0});if(Array.isArray(t))return R(t,"array",{literal:!0});throw new T("Unsupported type of expression: "+JSON.stringify(t))}const z=W("expr",(t,e)=>{if("string"==typeof e){if("$"===e[0]){let r="$"===e?t.implicitField:e.slice(1);if(null==r||""===r)throw new T("Invalid field reference: "+e);return N(t,r)}if(":"===e[0]){let r={value:"?",type:"param",paramName:e.slice(1)};return t.namedParameters.push(r),r}}if(null!==e){if(Array.isArray(e))return q(e);if("object"==typeof e&&Object.keys(e).find(t=>"$"===t[0]))return V(t,e)}return q(e)});const V=W("function",(t,e)=>{let r=v(Object.keys(e),1)[0],n=e[r];if(Array.isArray(n)||(n=[n]),"$"!==r[0])throw new T(`Unknown property "${r}". Did you mean to call a function? Try prefixing it with $`);let i=n;switch("$condition"!==r&&(i=n.map(e=>z(t,e))),r){case"$sum":return F(i,1),R(`SUM(${v(U(0,i,["float"]),1)[0]})`,i[0].type);case"$sumOver":return R(`(SUM(${v(U(0,i,["float"]),1)[0]}) OVER (${t.orders?"ORDER BY "+X(t,t.orders):""} ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING))`,i[0].type);case"$count":return F(i,1),R(`COUNT(${v(U(0,i),1)[0]})`,"integer");case"$substr":{F(i,2,3);let t=v(U(0,i,["string","integer","integer"]),3);return R(`SUBSTR(${t[0]}, ${t[1]}, ${t[2]})`,"string")}case"$lower":return F(i,1),R(`LOWER(${v(U(0,i,["string"]),1)[0]})`,"string");case"$neg":F(i,1);v(U(0,i,["float"]),1)[0];return R(`(-${B(0,i[0])})`,i[0].type);case"$abs":F(i,1);v(U(0,i,["float"]),1)[0];return R(`ABS(${B(0,i[0])})`,i[0].type);case"$idiv":{F(i,2);let t=v(U(0,i,["integer","integer"]),2);t[0],t[1];return R(`(${B(0,i[0])} / ${B(0,i[1])})`,i[0].type)}case"$month":return F(i,1),P(0,i[0],"date-month");case"$year":return F(i,1),P(0,i[0],"date-year");case"$condition":return F(i,1),R(G(t,i[0]).join(" AND "),"boolean");case"$nocase":return F(i,1),R(v(U(0,i,["string"]),1)[0]+" COLLATE NOCASE",i[0].type);case"$literal":if(F(i,1),!i[0].literal)throw new T("Literal not passed to $literal");return i[0];default:throw new T("Unknown function: "+r)}}),Y=W("op",(t,e,r)=>{let n,i=r.$transform,o=_(r,p),a=v(Object.keys(o),1)[0],s=z(t,r[a]);switch(n=i?V(b(b({},t),{},{implicitField:e}),"string"==typeof i?{[i]:"$"}:i):z(t,"$"+e),a){case"$gte":{let t=v(U(0,[n,s],[null,n.type]),2);return`${t[0]} >= ${t[1]}`}case"$lte":{let t=v(U(0,[n,s],[null,n.type]),2);return`${t[0]} <= ${t[1]}`}case"$gt":{let t=v(U(0,[n,s],[null,n.type]),2);return`${t[0]} > ${t[1]}`}case"$lt":{let t=v(U(0,[n,s],[null,n.type]),2);return`${t[0]} < ${t[1]}`}case"$eq":{if("null"===P(0,s,n.type).type)return B(0,n)+" IS NULL";let e=v(U(0,[n,s],[null,n.type]),2),r=e[0],i=e[1];if("param"===s.type){let e=t.namedParameters.map(t=>t===s||t===n?[t,b({},t)]:t);return t.namedParameters=[].concat.apply([],e),`CASE\n WHEN ${r} IS NULL THEN ${i} IS NULL\n ELSE ${r} = ${i}\n END`}return`${r} = ${i}`}case"$oneof":{let t=v(U(0,[n,s],[null,"array"]),2),e=t[0],r=t[1];return e+" IN ("+[...new Set(r)].map(t=>`'${t}'`).join(",")+")"}case"$like":{let t=v(U(0,[n,s],["string","string"]),2);return`${t[0]} LIKE ${t[1]}`}default:throw new T("Unknown operator: "+a)}});function G(t,e){return Array.isArray(e)||(e=Object.entries(e).map(t=>({[t[0]]:t[1]}))),e.filter(Boolean).reduce((e,r)=>{let n=Object.entries(r).map(([e,r])=>"$and"===e?r?$(t,r):null:"$or"===e?r?function(t,e){if(!e)return"0";let r=G(t,e);if(0===r.length)return"0";return"("+r.join("\n OR ")+")"}(t,r):null:"string"==typeof r||"number"==typeof r||"boolean"==typeof r||r instanceof Date||null==r?Y(t,e,{$eq:r}):Array.isArray(r)?r.map(r=>Y(t,e,r)).join(" AND "):Y(t,e,r)).filter(Boolean);return[...e,...n]},[])}function $(t,e){if(!e)return"1";let r=G(t,e);return 0===r.length?"1":"("+r.join("\n AND ")+")"}const K=W("filter",(t,e)=>$(t,e));const Z=W("select",(t,e,r,n)=>(r||e.includes("id")||e.includes("*")||(e=e.concat(["id"])),e.map(e=>{if("string"==typeof e){if(-1!==e.indexOf("*")){return function(t,e){let r,n;if("*"===e)n={tableName:t.implicitTableName,tableId:t.implicitTableId};else if(e.match(/\.\*$/)){let i=j(e);r=i.path,n=k(t,i.path)}let i=t.schema[n.tableName];if(null==i)throw new Error(`Table "${n.tableName}" does not exist`);return Object.keys(i).map(t=>r?`${r}.${t}`:t)}(t,e).map(e=>{let r=z(t,"$"+e);return t.outputTypes.set(e,r.type),r.value+" AS "+I(e)}).join(", ")}let r=z(t,"$"+e);return t.outputTypes.set(e,r.type),r.value+" AS "+I(e)}let r=v(Object.entries(e)[0],2),i=r[0],o=r[1];if("$"===i[0])throw t.compileStack.push({type:"value",value:e}),new T(`Invalid field "${i}", are you trying to select a function? You need to name the expression`);if("string"==typeof o){let e=z(t,"$"+o);return t.outputTypes.set(i,e.type),`${e.value} AS ${I(i)}`}let a=V(b(b({},t),{},{orders:n}),o);return t.outputTypes.set(i,a.type),a.value+" AS "+I(i)}).join(", "))),J=W("groupBy",(t,e)=>e.map(e=>"string"==typeof e?z(t,"$"+e).value:V(t,e).value).join(", ")),X=W("orderBy",(t,e)=>e.map(e=>{let r,n=null;if("string"==typeof e)r=z(t,"$"+e).value;else{let i=Object.entries(e),o=i[0];if(1===i.length&&"$"!==o[0][0])n=o[1],r=z(t,"$"+o[0]).value;else{let i=e.$dir,o=_(e,m);n=i,r=V(t,o).value}}if(null!=n){if("desc"!==n&&"asc"!==n)throw new T("Invalid order direction: "+n);return`${r} ${n}`}return r}).join(", "));let Q=["$sum","$count"];function tt(t){return t.groupExpressions.length>0||t.selectExpressions.find(t=>{if("string"!=typeof t){let e=v(Object.entries(t)[0],2);e[0];return function t(e){if("object"!=typeof e||Array.isArray(e))return!1;let r=v(Object.entries(e)[0],2),n=r[0],i=r[1];return Array.isArray(i)||(i=[i]),-1!==Q.indexOf(n)||i.find(e=>t(e))}(e[1])}return!1})}function et(t,e,r={}){let n=t.withDead,i=t.validateRefs,o=void 0===i||i,a=t.tableOptions,s=t.rawMode,u=r.tableViews,c=void 0===u?{}:u,l=r.tableFilters,f=void 0===l?t=>[]:l,d=r.customizeQuery,h=void 0===d?t=>t:d,g=t=>{let e=f(t);for(let t of e){if(Array.isArray(t))throw new T("Invalid internal table filter: only object filters are supported");if(-1!==Object.keys(t)[0].indexOf("."))throw new T("Invalid internal table filter: field names cannot contain paths")}return e},p=(t,e)=>("function"==typeof c?c(t,{withDead:n,isJoin:e,tableOptions:a}):c[t])||t,m=t.table,y=h(t),w=y.filterExpressions,_=y.selectExpressions,E=y.groupExpressions,O=y.orderExpressions,A=y.limit,j=y.offset,R=(y.calculation,""),D="",k="",N="",C="",x={schema:e,implicitTableName:m,implicitTableId:p(m),paths:new Map,dependencies:[m],compileStack:[],outputTypes:new Map,validateRefs:o,namedParameters:[]};S=0;try{if(R=Z(x,_,tt(t),O),w.length>0){D="WHERE "+K(x,w)}else D="WHERE 1";if(!s){let t=g(m);t.length>0&&(D+=" AND "+$(x,t))}if(E.length>0){N="GROUP BY "+J(x,E)}if(O.length>0){C="ORDER BY "+X(x,O)}x.paths.size>0&&(k=function(t,e,r){let n=[];return t.paths.forEach((i,o)=>{let a=t.paths.get(o),s=a.tableName,u=a.tableId,c=a.joinField,l=a.joinTable,f=a.noMapping,d=`${u}.id = ${e(l)}.${I(c)}`,h=r(s);h.length>0&&(d+=" AND "+$(b(b({},t),{},{implicitTableName:s,implicitTableId:u}),h)),n.push(`LEFT JOIN ${f?s:e(s,!0)} ${u} ON ${M(t.schema,s,u,d)}`),-1===t.dependencies.indexOf(s)&&t.dependencies.push(s)}),n.join("\n")}(x,p,g))}catch(t){if(t instanceof T)throw function(t,e){if(0===e.length)return t;let r=e.slice(1).reverse().map(t=>{switch(t.type){case"expr":case"function":return H(t.args[0]);case"op":{let e=v(t.args,2);return H({[e[0]]:e[1]})}case"value":return H(t.value);default:return""}}).map(t=>"\n "+t).join("");const n=e[0].type,i=e[0].args[0];r+=`\n ${n}(${H(1===i.length?i[0]:i)})`;{const e=new T;return e.message=t.message+"\n\nExpression stack:"+r,e.stack=null,e}}(t,x.compileStack);throw t}return{sqlPieces:{select:R,from:p(m),joins:k,where:D,groupBy:N,orderBy:C,limit:A,offset:j},state:x}}function rt(t,e,r){let n=r,i=t.withDead?n.where:M(e.schema,e.implicitTableName,e.implicitTableId,n.where);return`\n SELECT ${n.select} FROM ${n.from}\n ${n.joins}\n ${i}\n ${n.groupBy}\n ${n.orderBy}\n ${null!=n.limit?"LIMIT "+n.limit:""}\n ${null!=n.offset?"OFFSET "+n.offset:""}\n `}const nt=["fields"];function it(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ot(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?it(Object(r),!0).forEach((function(e){at(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):it(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function at(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function st(t,e){if(null==t)return{};var r,n,i=function(t,e){if(null==t)return{};var r,n,i={},o=Object.keys(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||(i[r]=t[r]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}function ut(t){return Object.keys(t).map(e=>{let r=t[e],n=r!==e;return r.match(/[ .]/)||(r="_."+r),n?`${r} AS ${I(e)}`:""+r}).join(", ")}function ct(t,e){let r=e.views,n=[];return Object.keys(r).forEach(e=>{let i=r[e],o=i.fields,a=void 0===o?{}:o,s=st(i,nt),u=Object.fromEntries(Object.keys(t[e]).map(t=>[t,t])),c=ot(ot({},u),a);Object.keys(s).forEach(t=>{let e,r=t=>ut(ot(ot({},u),t)),i=t=>ut(ot(ot({},c),t));e="function"==typeof s[t]?s[t](i,r):s[t],e=e.trim().replace(/;$/,""),n.push(`\n DROP VIEW IF EXISTS ${t};\n CREATE VIEW ${t} AS ${e};\n `)})}),n.join("\n")}function lt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ft(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?lt(Object(r),!0).forEach((function(e){dt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):lt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function dt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ht(t,e){return ft({type:t},e)}const gt={transactions:{id:ht("id"),is_parent:ht("boolean"),is_child:ht("boolean"),parent_id:ht("id"),account:ht("id",{ref:"accounts",required:!0}),category:ht("id",{ref:"categories"}),amount:ht("integer",{default:0,required:!0}),payee:ht("id",{ref:"payees"}),notes:ht("string"),date:ht("date",{required:!0}),imported_id:ht("string"),error:ht("json"),imported_payee:ht("string"),starting_balance_flag:ht("boolean"),transfer_id:ht("id"),sort_order:ht("float",{default:()=>Date.now()}),cleared:ht("boolean",{default:!0}),tombstone:ht("boolean"),schedule:ht("id",{ref:"schedules"})},payees:{id:ht("id"),name:ht("string",{required:!0}),transfer_acct:ht("id",{ref:"accounts"}),tombstone:ht("boolean")},accounts:{id:ht("id"),name:ht("string",{required:!0}),type:ht("string"),offbudget:ht("boolean"),closed:ht("boolean"),sort_order:ht("float"),tombstone:ht("boolean")},categories:{id:ht("id"),name:ht("string"),is_income:ht("boolean"),group:ht("id",{ref:"category_groups"}),sort_order:ht("float"),tombstone:ht("boolean")},category_groups:{id:ht("id"),name:ht("string"),is_income:ht("boolean"),sort_order:ht("float"),tombstone:ht("boolean")},schedules:{id:ht("id"),rule:ht("id",{ref:"rules",required:!0}),next_date:ht("date"),completed:ht("boolean"),posts_transaction:ht("boolean"),tombstone:ht("boolean"),_payee:ht("id",{ref:"payees"}),_account:ht("id",{ref:"accounts"}),_amount:ht("json/fallback"),_amountOp:ht("string"),_date:ht("json/fallback"),_conditions:ht("json"),_actions:ht("json")},rules:{id:ht("id"),stage:ht("string"),conditions:ht("json"),actions:ht("json"),tombstone:ht("boolean")},notes:{id:ht("id"),note:ht("string")}},pt={tableViews(t,{isJoin:e,withDead:r,tableOptions:n={}}){switch(t){case"transactions":{if(e)return"v_transactions_internal_alive";let t=n.splits||"inline";return r||"inline"!==t&&"none"!==t?"v_transactions_internal":"v_transactions_internal_alive"}case"schedules":return"v_schedules";case"categories":return"v_categories";case"payees":return"v_payees"}return t},customizeQuery(t){let e=t.table;t.tableOptions;return ft(ft({},t),{},{orderExpressions:function(t){if(t.length>0)return t.concat(["id"]);switch(e){case"transactions":return[{date:"desc"},"starting_balance_flag",{sort_order:"desc"},"id"];case"payees":return[{$condition:{transfer_acct:null},$dir:"desc"},{$nocase:"$name"}];case"accounts":return["sort_order","name"];case"schedules":return[{$condition:{completed:!0}},"next_date"]}return[]}(t.orderExpressions)})},views:{payees:{v_payees:t=>`\n SELECT ${t({name:"COALESCE(__accounts.name, _.name)"})} FROM payees _\n LEFT JOIN accounts __accounts ON (_.transfer_acct = __accounts.id AND __accounts.tombstone = 0)\n -- We never want to show transfer payees that are pointing to deleted accounts.\n -- Either this isn't a transfer payee, if the account exists\n WHERE _.transfer_acct IS NULL OR __accounts.id IS NOT NULL\n `},categories:{fields:{group:"cat_group"},v_categories:t=>`SELECT ${t({group:"cat_group"})} FROM categories _`},schedules:{v_schedules:t=>`\n SELECT ${t({next_date:"\n CASE\n WHEN _nd.local_next_date_ts = _nd.base_next_date_ts THEN _nd.local_next_date\n ELSE _nd.base_next_date\n END\n ",_payee:"pm.targetId",_account:"json_extract(_rules.conditions, _paths.account || '.value')",_amount:"json_extract(_rules.conditions, _paths.amount || '.value')",_amountOp:"json_extract(_rules.conditions, _paths.amount || '.op')",_date:"json_extract(_rules.conditions, _paths.date || '.value')",_conditions:"_rules.conditions",_actions:"_rules.actions"})} FROM schedules _\n LEFT JOIN schedules_next_date _nd ON _nd.schedule_id = _.id\n LEFT JOIN schedules_json_paths _paths ON _paths.schedule_id = _.id\n LEFT JOIN rules _rules ON _rules.id = _.rule\n LEFT JOIN payee_mapping pm ON pm.id = json_extract(_rules.conditions, _paths.payee || '.value')\n `},transactions:{fields:{is_parent:"isParent",is_child:"isChild",account:"acct",imported_id:"financial_id",imported_payee:"imported_description",transfer_id:"transferred_id",payee:"description"},v_transactions_internal:t=>`\n SELECT ${t({payee:"pm.targetId",category:"CASE WHEN _.isParent = 1 THEN NULL ELSE cm.transferId END",amount:"IFNULL(_.amount, 0)",parent_id:"CASE WHEN _.isChild = 0 THEN NULL ELSE _.parent_id END"})} FROM transactions _\n LEFT JOIN category_mapping cm ON cm.id = _.category\n LEFT JOIN payee_mapping pm ON pm.id = _.description\n WHERE\n _.date IS NOT NULL AND\n _.acct IS NOT NULL AND\n (_.isChild = 0 OR _.parent_id IS NOT NULL)\n `,v_transactions_internal_alive:"\n SELECT _.* FROM v_transactions_internal _\n LEFT JOIN transactions t2 ON (_.is_child = 1 AND t2.id = _.parent_id)\n WHERE IFNULL(_.tombstone, 0) = 0 AND (_.is_child = 0 OR t2.tombstone = 0)\n ",v_transactions:(t,e)=>`\n SELECT ${e({payee:"p.id",category:"c.id",account:"a.id"})} FROM v_transactions_internal_alive _\n LEFT JOIN payees p ON (p.id = _.payee AND p.tombstone = 0)\n LEFT JOIN categories c ON (c.id = _.category AND c.tombstone = 0)\n LEFT JOIN accounts a ON (a.id = _.account AND a.tombstone = 0)\n ORDER BY _.date desc, _.starting_balance_flag, _.sort_order desc, _.id;\n `}}};var mt=r(27),yt=r(1);async function bt(t,e,r,n,i){let o=rt(t,e,r),a=await yt.all(o,n);return function(t,e){for(let r=0;r<t.length;r++){let n=t[r];Object.keys(n).forEach(t=>{n[t]=l(n[t],e.get(t))})}}(a,i),a}async function wt(t,e,r,{params:n={},executors:i={}}={}){let o,a=r.namedParameters.map(t=>{let e=t.paramName;if(void 0===n[e])throw new Error(`Parameter ${e} not provided to query`);return c(n[e],t.paramType)});if(o=i[r.implicitTableName]?await i[r.implicitTableName](r,t,e,a,r.outputTypes):await bt(t,r,e,a,r.outputTypes),t.calculation)if(o.length>0){let t=o[0];o=t[Object.keys(t)[0]]||0}else o=null;return o}var _t=r(106);function vt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Et(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?vt(Object(r),!0).forEach((function(e){St(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function St(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ot(t){for(let e of Object.keys(t))if("$or"===e||"$and"===e){if(t[e]&&Ot(t[e]))return!0}else if(0!==e.indexOf("account")&&"date"!==e)return!0;return!1}var Tt={transactions:function(t,e,r,n,i){let o=(e.tableOptions||{}).splits||"inline";if(-1===["all","inline","none","grouped"].indexOf(o))throw new Error(`Invalid "splits" option for transactions: "${o}"`);return"all"===o||"inline"===o||"none"===o?async function(t,e,r,n,i,o){let a=Et({},r);"all"!==i&&(a.where="none"===i?`${a.where} AND ${a.from}.parent_id IS NULL`:`${a.where} AND ${a.from}.is_parent = 0`);return bt(e,t,a,n,o)}(t,e,r,n,o,i):"grouped"===o?async function(t,e,r,n,i,o){e.table;let a,s=e.withDead?"":`AND ${r.from}.tombstone = 0`;if(tt(e)){let t=`\n SELECT ${r.select}\n FROM ${r.from}\n ${r.joins}\n ${r.where} AND is_parent = 0 ${s}\n ${r.groupBy}\n ${r.orderBy}\n ${null!=r.limit?"LIMIT "+r.limit:""}\n ${null!=r.offset?"OFFSET "+r.offset:""}\n `;return yt.all(t)}let u=null;if(function(t){return null==t.filterExpressions.find(Ot)}(e)){let t=`\n SELECT ${r.from}.id as group_id\n FROM ${r.from}\n ${r.joins}\n ${r.where} AND is_child = 0 ${s}\n ${r.orderBy}\n ${null!=r.limit?"LIMIT "+r.limit:""}\n ${null!=r.offset?"OFFSET "+r.offset:""}\n `;a=await yt.all(t,n)}else{let t=`\n SELECT group_id, matched FROM (\n SELECT\n group_id,\n GROUP_CONCAT(id) as matched\n FROM (\n SELECT ${r.from}.id, IFNULL(${r.from}.parent_id, ${r.from}.id) as group_id\n FROM ${r.from}\n LEFT JOIN transactions _t2 ON ${r.from}.is_child = 1 AND _t2.id = ${r.from}.parent_id\n ${r.joins}\n ${r.where} AND ${r.from}.tombstone = 0 AND IFNULL(_t2.tombstone, 0) = 0\n )\n GROUP BY group_id\n )\n LEFT JOIN ${r.from} ON ${r.from}.id = group_id\n ${r.joins}\n ${r.orderBy}\n ${null!=r.limit?"LIMIT "+r.limit:""}\n ${null!=r.offset?"OFFSET "+r.offset:""}\n `;a=await yt.all(t,n),u=new Set([].concat.apply([],a.map(t=>t.matched.split(","))))}let c=Object(_t.b)(a.map(t=>t.group_id),`IFNULL(${r.from}.parent_id, ${r.from}.id)`),f=`\n SELECT ${r.select}, parent_id AS _parent_id FROM ${r.from}\n ${r.joins}\n WHERE ${c} ${s}\n ${r.orderBy}\n `,d=(Date.now(),(await yt.all(f)).reduce((t,e)=>{let r=e._parent_id;if(delete e._parent_id,null==r)t.parents.push(e);else{let n=t.children.get(r)||[];n.push(e),t.children.set(r,n)}return t},{parents:[],children:new Map})),h=d.parents,g=d.children;return function(t,e,r=(t=>t)){return t.reduce((t,n)=>{let i=e.get(n.id)||[];return t.push(Et(Et({},r(n)),{},{subtransactions:i.map(r)})),t},[])}(h,g,t=>(Object.keys(t).forEach(e=>{t[e]=l(t[e],o.get(e))}),u&&!u.has(t.id)&&(t._unmatched=!0),t))}(0,e,r,n,0,i):void 0}};function At(t,e,r,n){return wt(t,e,r,{params:n,executors:Tt})}function Mt(t,e){return t instanceof mt.a&&(t=t.serialize()),async function(t,e,r,n){let i=et(r,t,e),o=i.sqlPieces,a=i.state;return{data:await wt(r,o,a,n),dependencies:a.dependencies}}(gt,pt,t,{params:e,executors:Tt})}},function(t,e,r){"use strict";r.r(e),r.d(e,"init",(function(){return a})),r.d(e,"_getModule",(function(){return s})),r.d(e,"prepare",(function(){return u})),r.d(e,"runQuery",(function(){return c})),r.d(e,"execQuery",(function(){return l})),r.d(e,"transaction",(function(){return d})),r.d(e,"asyncTransaction",(function(){return h})),r.d(e,"openDatabase",(function(){return g})),r.d(e,"closeDatabase",(function(){return p})),r.d(e,"exportDatabase",(function(){return m}));var n=r(269),i=r.n(n);let o=null;async function a(){return new Promise((t,e)=>{i()({locateFile:t=>"/"+t}).then(e=>{o=e,t()},t=>{e(t)})})}function s(){if(null==o)throw new Error("_getModule: sql.js must be initialized first");return o}function u(t,e){return t.prepare(e)}function c(t,e,r=[],n){r&&function(t,e){e.forEach(e=>{if("string"!=typeof e&&"number"!=typeof e&&null!==e)throw new Error("Invalid field type "+e+" for sql "+t)})}(e,r);let i="string"==typeof e?t.prepare(e):e;if(n)try{i.bind(r);let t=[];for(;i.step();)t.push(i.getAsObject());return"string"==typeof e?i.free():i.reset(),t}catch(t){throw console.log(e),t}else try{return i.run(r),{changes:t.getRowsModified()}}catch(t){throw t}}function l(t,e){t.exec(e)}let f=0;function d(t,e){let r,n,i;f>0?(r="SAVEPOINT __actual_sp",n="RELEASE __actual_sp",i="ROLLBACK TO __actual_sp"):(r="BEGIN",n="COMMIT",i="ROLLBACK"),l(t,r),f++;try{const r=e();return l(t,n),r}catch(e){throw l(t,i),"ROLLBACK"!==i&&l(t,n),e}finally{f--}}async function h(t,e){0===f&&t.exec("BEGIN TRANSACTION"),f++;try{await e()}finally{f--,0===f&&t.exec("COMMIT")}}async function g(t){if(t){if("string"!=typeof t)return new o.Database(t);let e=t;if(":memory:"!==e){if("undefined"==typeof SharedArrayBuffer){let t=o.FS.open(o.FS.readlink(e),"a+");await t.node.contents.readIfFallback(),o.FS.close(t)}let t=new o.Database(e.includes("/blocked")?e:o.FS.readlink(e),{filename:!0});return t.exec("\n PRAGMA journal_mode=MEMORY;\n PRAGMA cache_size=-10000;\n "),t}}return new o.Database}function p(t){t.close()}function m(t){return t.export()}},function(t,e,r){"use strict";(function(t){
2
+ /*!
3
+ * The buffer module from node.js, for the browser.
4
+ *
5
+ * @author Feross Aboukhadijeh <http://feross.org>
6
+ * @license MIT
7
+ */
8
+ var n=r(283),i=r(284),o=r(171);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return f(this,t)}return c(this,t,e,r)}function c(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=d(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|g(e,r),i=(t=s(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|h(e.length);return 0===(t=s(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?s(t,0):d(t,e);if("Buffer"===e.type&&o(e.data))return d(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function f(t,e){if(l(e),t=s(t,e<0?0:0|h(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function d(t,e){var r=e.length<0?0:0|h(e.length);t=s(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function h(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(t).length;default:if(n)return F(t).length;e=(""+e).toLowerCase(),n=!0}}function p(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return M(this,e,r);case"latin1":case"binary":return j(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){var o,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var l=-1;for(o=r;o<s;o++)if(c(t,o)===c(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*a}else-1!==l&&(o-=o-l),l=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){for(var f=!0,d=0;d<u;d++)if(c(t,o+d)!==c(e,d)){f=!1;break}if(f)return o}return-1}function w(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[r+a]=s}return a}function _(t,e,r,n){return H(F(e,t.length-r),t,r,n)}function v(t,e,r,n){return H(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function E(t,e,r,n){return v(t,e,r,n)}function S(t,e,r,n){return H(W(e),t,r,n)}function O(t,e,r,n){return H(function(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function T(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,s,u,c=t[i],l=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[i+1],a=t[i+2],s=t[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&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return c(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,n){return l(e),e<=0?s(t,e):void 0!==r?"string"==typeof n?s(t,e).fill(r,n):s(t,e).fill(r):s(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return f(null,t)},u.allocUnsafeSlow=function(t){return f(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var a=t[r];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?A(this,0,t):p.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,n,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(o,a),c=this.slice(n,i),l=t.slice(e,r),f=0;f<s;++f)if(c[f]!==l[f]){o=c[f],a=l[f];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return E(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function M(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function j(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function I(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=U(t[o]);return i}function R(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function D(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function k(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function N(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function C(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function x(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(t,e,r,n,o){return o||x(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function P(t,e,r,n,o){return o||x(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},u.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||D(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||D(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return e||D(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||D(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||D(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||D(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||D(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||D(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||D(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||D(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||D(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||D(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||D(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||k(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||k(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):C(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):C(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):C(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):C(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return P(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return P(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=u.isBuffer(t)?t:F(new u(t,n).toString()),s=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%s]}return this};var B=/[^+\/0-9A-Za-z-_]/g;function U(t){return t<16?"0"+t.toString(16):t.toString(16)}function F(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=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((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function W(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(B,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(24))},function(t,e,r){"use strict";r.d(e,"l",(function(){return u})),r.d(e,"f",(function(){return c})),r.d(e,"j",(function(){return l})),r.d(e,"b",(function(){return f})),r.d(e,"n",(function(){return d})),r.d(e,"h",(function(){return h})),r.d(e,"d",(function(){return p})),r.d(e,"i",(function(){return m})),r.d(e,"o",(function(){return y})),r.d(e,"g",(function(){return b})),r.d(e,"e",(function(){return w})),r.d(e,"c",(function(){return v})),r.d(e,"p",(function(){return E})),r.d(e,"a",(function(){return S})),r.d(e,"k",(function(){return O})),r.d(e,"m",(function(){return T}));const n=["id"];function i(t,e){if(null==t)return{};var r,n,i=function(t,e){if(null==t)return{};var r,n,i={},o=Object.keys(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||(i[r]=t[r]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function s(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t){return t[t.length-1]}function c(t,e){const r=t.id?{id:t.id}:{},n=Object.keys(e);let i=!1;for(let o=0;o<n.length;o++){let a=n[o];t[a]!==e[a]&&(r[a]=e[a],i=!0)}return i?r:null}function l(t,e,r){let n=!1;for(var i=0;i<r.length;i++){let o=r[i];if(t[o]!==e[o]){n=!0;break}}return n}function f(t,e){return e=[...e],t.added&&t.added.forEach(t=>{e.push(t)}),t.updated&&t.updated.forEach(t=>{let r=t.id,o=i(t,n);const s=e.findIndex(t=>t.id===r);e[s]=a(a({},e[s]),o)}),t.deleted&&t.deleted.forEach(t=>{const r=e.findIndex(e=>t.id===e.id);-1!==r&&e.splice(r,1)}),e}function d(t,e){let r=new Map;for(let n=0;n<t.length;n++){let i=t[n],o=i[e],a=r.get(o)||[];a.push(i),r.set(o,a)}return r}function h(t,e,r){let n=new Map;for(let i=0;i<t.length;i++){let o=t[i],a=o[e],s=n.get(a)||[];n.set(a,s.concat([r?r(o):t[i]]))}return n}function g(t){let e=new Map;for(let r=0;r<t.length;r++){let n=t[r];e.set(n.id,n)}return e}function p(t,e){let r=g(t),n=g(e),i=[],o=[],a=t.filter(t=>!n.has(t.id)).map(t=>({id:t.id}));return e.forEach(t=>{let e=r.get(t.id);if(e){const r=c(e,t);r&&o.push(r)}else i.push(t)}),{added:i,updated:o,deleted:a}}function m(t){let e={};for(let r=0;r<t.length;r++){let n=t[r];e[n.id]=n}return e}function y(t,e,r){for(let n=0;n<e.length;n++){let i=e[n];n===e.length-1?t.set(i,r):(t.has(i)||t.set(i,new Map),t=t.get(i))}}function b(t,e){let r=t;for(let t=0;t<e.length;t++)if(r=r.get(e[t]),null==r)return r;return r}function w(t,e){let r=new Set(t),n=e.values(),i=n.next();for(;!i.done;)r.add(i.value),i=n.next();return r}let _={value:null,formatter:null,regex:null};function v(t){let e=parseFloat(t.replace(_.regex,"").replace(_.separator,"."));return isNaN(e)?null:e}function E(t){let e=parseInt(t.replace(/[^-0-9.,]/g,""));return isNaN(e)?null:e}function S(t){return Math.round(100*t)}function O(t){return parseFloat((t/100).toFixed(2))}function T(t){function e(t){return isNaN(t)?null:t}let r=t.match(/[.,][^.,]*$/);if(!r||0===r.index)return e(parseFloat(t));let n=t.slice(0,r.index),i=t.slice(r.index+1);return e(parseFloat(n.replace(/[^0-9-]/g,"")+"."+i))}!function(t){let e,r,n;switch(t){case"space-comma":e="en-ZA",r=/[^-0-9,]/g,n=",";break;case"dot-comma":e="de-DE",r=/[^-0-9,]/g,n=",";break;case"comma-dot":default:e="en-US",r=/[^-0-9.]/g,n="."}_={value:t,separator:n,formatter:new Intl.NumberFormat(e,{minimumFractionDigits:2,maximumFractionDigits:2}),regex:r}}("comma-dot")},function(t,e,r){"use strict";r.d(e,"a",(function(){return p})),r.d(e,"b",(function(){return m})),r.d(e,"f",(function(){return y})),r.d(e,"e",(function(){return b})),r.d(e,"d",(function(){return _})),r.d(e,"c",(function(){return v}));var n=r(15),i=r(9),o=r(6),a=r(8);function s(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return u(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return u(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function l(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?c(Object(r),!0).forEach((function(e){f(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function f(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const d=r(49);let h=[{type:"marker"}],g=0;function p(t,e){let r=Object(o.getMutatorContext)();if(r.undoListening&&t.length>0){!function(){h=h.slice(0,g+1);let t=h.filter(t=>"marker"===t.type);if(t.length>20){let e=t.slice(-20),r=h.indexOf(e[0]);h=h.slice(r),g=h.length-1}}();let n=r.undoTag;h.push({type:"messages",messages:t,oldData:e,undoTag:n}),g++}}function m(){h=[{type:"marker"}],g=0}function y(t,e){let r=Object(o.getMutatorContext)();if(r.undoDisabled||r.undoListening)return t();h=h.slice(0,g+1);let n={type:"marker",meta:e};return"marker"===h[h.length-1].type?h[h.length-1]=n:(h.push(n),g++),Object(o.withMutatorContext)({undoListening:!0,undoTag:r.undoTag},t)}function b(t){return(...e)=>y(()=>t(...e))}async function w(t,e,r){await Object(o.withMutatorContext)({undoListening:!1},()=>Object(a.j)(t.map(t=>l(l({},t),{},{timestamp:i.a.send()}))));const n=t.reduce((t,e)=>(t.includes(e.dataset)||t.push(e.dataset),t),[]);d.send("undo-event",{messages:t,tables:n,meta:e,undoTag:r})}async function _(){let t=g;for(g=Math.max(g-1,0);g>0&&"marker"!==h[g].type;)g--;let e=h[g].meta,r=Math.max(g,0),i=h.slice(r,t+1).filter(t=>"messages"===t.type);if(i.length>0){let t=i.reduce((t,e)=>t.concat(e.messages.map(t=>function(t,e){let r=Object(n.g)(e,[t.dataset,t.row]);if(r){let e=t.column;return"spreadsheet_cells"===t.dataset&&(e="cachedValue"),l(l({},t),{},{value:r[e]})}if("spreadsheet_cells"===t.dataset)return"expr"===t.column?l(l({},t),{},{value:null}):t;if("category_mapping"!==t.dataset&&"payee_mapping"!==t.dataset)return"zero_budget_months"===t.dataset||"zero_budgets"===t.dataset||"reflect_budgets"===t.dataset?["buffered","amount","carryover"].includes(t.column)?l(l({},t),{},{value:0}):null:"notes"===t.dataset?l(l({},t),{},{value:null}):l(l({},t),{},{column:"tombstone",value:1});return null}(t,e.oldData)).filter(t=>t)),[]).reverse();await w(t,e,i[0].undoTag)}}async function v(){let t="marker"===h[g].type?h[g].meta:null,e=g;for(g=Math.min(g+1,h.length-1);g<h.length-1&&"marker"!==h[g].type;)g++;let r=g,o=h.slice(e+1,r+1).filter(t=>"messages"===t.type);if(o.length>0){let e=o.reduce((t,e)=>t.concat(e.messages).concat(function(t,e){let r=new Set;return t.forEach(t=>{Object(n.g)(e,[t.dataset,t.row])||["zero_budget_months","zero_budgets","reflect_budgets","notes","category_mapping","payee_mapping"].includes(t.dataset)||r.add(t.dataset+"."+t.row)}),[...r].map(t=>{let e=s(t.split("."),2);return{dataset:e[0],row:e[1],column:"tombstone",value:0,timestamp:i.a.send()}})}(e.messages,e.oldData)),[]);await w(e,t,o[o.length-1].undoTag)}}},function(t,e,r){
9
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
10
+ var n=r(14),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function a(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},a.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e,r){"use strict";r.d(e,"g",(function(){return c})),r.d(e,"h",(function(){return l})),r.d(e,"d",(function(){return f})),r.d(e,"a",(function(){return d})),r.d(e,"c",(function(){return h})),r.d(e,"b",(function(){return g})),r.d(e,"e",(function(){return p})),r.d(e,"f",(function(){return m})),r.d(e,"i",(function(){return y}));const n=["sort_order"],i=["sort_order"];function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function s(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t,e){if(null==t)return{};var r,n,i=function(t,e){if(null==t)return{};var r,n,i={},o=Object.keys(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||(i[r]=t[r]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}function c(t,e,r,n){r.forEach(r=>{if(n){if(e.hasOwnProperty(r)&&null==e[r])throw new Error(`${t} is missing field ${r}`)}else if(!e.hasOwnProperty(r)||null==e[r])throw new Error(`${t} is missing field ${r}`)})}function l(t){if("string"!=typeof t)throw new Error("toDateRepr not passed a string: "+t);return parseInt(t.replace(/-/g,""))}function f(t){if("number"!=typeof t)throw new Error("fromDateRepr not passed a number: "+t);const e=t.toString();return e.slice(0,4)+"-"+e.slice(4,6)+"-"+e.slice(6)}const d={validateAccountType(t){const e=t.type;if("checking"!==e&&"savings"!==e&&"investment"!==e&&"credit"!==e&&"mortgage"!==e&&"debt"!==e&&"other"!==e)throw new Error("Invalid account type: "+e)},validate:(t,{update:e}={})=>(e&&null==t.type||d.validateAccountType(t),c("account",t,e?["name","type","offbudget","closed"]:["name","type"],e),t)},h={validate(t,{update:e}={}){c("category",t,e?["name","is_income","cat_group"]:["name","cat_group"],e);t.sort_order;return u(t,n)}},g={validate(t,{update:e}={}){c("categoryGroup",t,e?["name","is_income"]:["name"],e);t.sort_order;return u(t,i)}},p={validate:(t,{update:e}={})=>(c("payee",t,["name"],e),t)},m={validateType(t){const e=t.type;if("equals"!==e&&"contains"!==e)throw new Error("Invalid rule type: "+e)},validate:(t,{update:e}={})=>(e&&!("type"in t)||m.validateType(t),c("payee_rules",t,["payee_id","type"],e),t)},y={validate(t,{update:e}={}){if(c("transaction",t,["date","acct"],e),"date"in t&&(null==t.date.match(/^\d{4}-\d{2}-\d{2}$/)||t.date<"2000-01-01"))throw new Error("Invalid transaction date: "+t.date);return t},toJS(t){if(!("location"in t))throw new Error("A full transaction is required to be passed to `toJS`. Instead got: "+JSON.stringify(t));let e=a({},t);return e.error=t.error?JSON.parse(t.error):null,e.isParent=1===t.isParent,e.isChild=1===t.isChild,e.starting_balance_flag=1===t.starting_balance_flag,e.cleared=1===t.cleared,e.pending=1===t.pending,e.date=e.date&&f(e.date),e},fromJS(t){let e=a({},t);return"error"in e&&(e.error=t.error?JSON.stringify(t.error):null),"isParent"in e&&(e.isParent=t.isParent?1:0),"isChild"in e&&(e.isChild=t.isChild?1:0),"cleared"in e&&(e.cleared=t.cleared?1:0),"pending"in e&&(e.pending=t.pending?1:0),"starting_balance_flag"in e&&(e.starting_balance_flag=t.starting_balance_flag?1:0),"date"in e&&(e.date=l(t.date)),e}}},function(t,e,r){"use strict";r.d(e,"b",(function(){return s})),r.d(e,"a",(function(){return u}));var n=r(4),i=r.n(n);let o=null;function a(t,...e){let r=new URL(t);return r.pathname=i.a.join(...e),r.toString()}function s(t){o=null==t?null:u(t)}function u(t){return t?{BASE_SERVER:t,SYNC_SERVER:a(t,"/sync"),SIGNUP_SERVER:a(t,"/account"),PLAID_SERVER:a(t,"/plaid")}:o}},function(t,e){var r,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var u,c=[],l=!1,f=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&h())}function h(){if(!l){var t=s(d);l=!0;for(var e=c.length;e;){for(u=c,c=[];++f<e;)u&&u[f].run();f=-1,e=c.length}u=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function g(t,e){this.fun=t,this.array=e}function p(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new g(t,e)),1!==c.length||l||s(h)},g.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,r){"use strict";r.r(e),r.d(e,"PostError",(function(){return n})),r.d(e,"HTTPError",(function(){return i})),r.d(e,"SyncError",(function(){return o})),r.d(e,"TransactionError",(function(){return a})),r.d(e,"RuleError",(function(){return s})),r.d(e,"APIError",(function(){return u})),r.d(e,"FileDownloadError",(function(){return c})),r.d(e,"FileUploadError",(function(){return l})),r.d(e,"isCodeError",(function(){return f}));class n extends Error{constructor(t,e){super("PostError: "+t),this.type="PostError",this.reason=t,this.meta=e}}class i extends Error{constructor(t,e){super(`HTTPError: unsuccessful status code (${t}): ${e}`),this.statusCode=t,this.responseBody=e}}class o extends Error{constructor(t,e){super("SyncError: "+t),this.reason=t,this.meta=e}}class a extends Error{constructor(t){super(t)}}class s extends Error{constructor(t,e){super("RuleError: "+e),this.type=t}}function u(t,e){return{type:"APIError",message:t,meta:e}}function c(t,e){return{type:"FileDownloadError",reason:t,meta:e}}function l(t,e){return{type:"FileUploadError",reason:t,meta:e}}function f(t){return t instanceof ReferenceError||t instanceof SyntaxError}},function(t,e,r){"use strict";r.d(e,"j",(function(){return M})),r.d(e,"h",(function(){return I})),r.d(e,"d",(function(){return R})),r.d(e,"f",(function(){return D})),r.d(e,"n",(function(){return k})),r.d(e,"c",(function(){return N})),r.d(e,"k",(function(){return x})),r.d(e,"b",(function(){return L})),r.d(e,"a",(function(){return P})),r.d(e,"e",(function(){return B})),r.d(e,"m",(function(){return F})),r.d(e,"l",(function(){return H})),r.d(e,"i",(function(){return q}));var n=r(2),i=r(37),o=r(15),a=r(12),s=r(1),u=r(107),c=r(21),l=r(18),f=r(8),d=r(29);function h(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return g(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function m(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach((function(e){y(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function y(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}let b,w,_,v;r.d(e,"g",(function(){return d.e}));let E=a.i.views.transactions.fields,S=(O=a.i.views.transactions.fields,Object.fromEntries(Object.entries(O).map(t=>[t[1],t[0]])));var O;function T(t){return m(m({},t),{},{field:S[t.field]||t.field})}function A(t){return m(m({},t),{},{field:E[t.field]||t.field})}const M={validate(t,{update:e}={}){if(Object(l.g)("rules",t,["conditions","actions"],e),(!e||"stage"in t)&&"pre"!==t.stage&&"post"!==t.stage&&null!==t.stage)throw new Error("Invalid rule stage: "+t.stage);return t},toJS(t){function e(t){let e;try{e="string"==typeof t?JSON.parse(t):t}catch(t){throw new c.RuleError("internal","Cannot parse rule json")}if(!Array.isArray(e))throw new c.RuleError("internal","Rule json must be an array");return e}let r=m({},t);return r.conditions=r.conditions?e(r.conditions).map(t=>T(t)):[],r.actions=r.actions?e(r.actions).map(t=>T(t)):[],r},fromJS(t){let e=m({},t);if("conditions"in e){let t=e.conditions.map(t=>A(t));e.conditions=JSON.stringify(t)}if("actions"in e){let t=e.actions.map(t=>A(t));e.actions=JSON.stringify(t)}return e}};function j(t){let e;try{e=new d.c(m(m({},M.toJS(t)),{},{fieldTypes:i.a}))}catch(t){if(console.warn("Invalid rule",t),t instanceof c.RuleError)return null;throw t}return Object(d.f)(e,Object(u.a)()),e}async function I(){b=new Map,_=new d.d({field:"imported_payee",method:"firstchar"}),v=new d.d({field:"payee"});let t=await s.all("\n SELECT * FROM rules\n WHERE conditions IS NOT NULL AND actions IS NOT NULL AND tombstone = 0\n ");for(let e=0;e<t.length;e++){let r=t[e];"cleanup"!==r.stage&&"modify"!==r.stage||(r.stage="pre");let n=j(r);n&&(b.set(n.id,n),_.index(n),v.index(n))}w&&w(),w=Object(f.a)(C)}function R(){return[...b.values()]}async function D(t){return t=M.validate(t),s.insertWithUUID("rules",M.fromJS(t))}async function k(t){return t=M.validate(t,{update:!0}),s.update("rules",M.fromJS(t))}async function N(t){return!await s.first("SELECT id FROM schedules WHERE rule = ?",[t.id])&&s.delete_("rules",t.id)}function C(t,e){e.forEach((t,e)=>{"rules"===e&&t.forEach(t=>{let e=b.get(t.id);if(1===t.tombstone){let e=b.get(t.id);e&&(b.delete(e.getId()),_.remove(e),v.remove(e))}else{let r=j(t);r&&(e&&(_.remove(e),v.remove(e)),b.set(t.id,r),_.index(r),v.index(r))}})}),[...e.keys()].find(t=>-1!==t.indexOf("mapping"))&&R().forEach(t=>{Object(d.f)(t,Object(u.a)())})}function x(t){let e=m({},t),r=Object(d.g)(Object(o.e)(_.getApplicableRules(t),v.getApplicableRules(t)));for(let t=0;t<r.length;t++)e=r[t].apply(e);return e}function L(t,{recurDateBounds:e=100}={}){let r=[];return{filters:(t=t.map(t=>{if(t instanceof d.b)return t;try{return new d.b(t.op,t.field,t.value,t.options,i.a)}catch(t){return r.push(t.type||"internal"),console.log("conditionsToAQL: invalid condition: "+t.message),null}}).filter(Boolean)).map(t=>{let r=t.type,o=t.field,a=t.op,s=t.value,u=t.options,c=t=>"number"===r?t.value:t,l=(t,e,n)=>{if("number"===r){if(u){if(u.outflow)return{$and:[{amount:{$lt:0}},{[t]:{$transform:"$neg",[e]:n}}]};if(u.inflow)return{$and:[{amount:{$gt:0}},{[t]:{[e]:n}}]}}return{amount:{[e]:n}}}return"string"===r?{[t]:{$transform:"$lower",[e]:n}}:"date"===r?{[t]:{[e]:n.date}}:{[t]:{[e]:n}}};switch(a){case"isapprox":case"is":if("date"===r){if("recur"===s.type){return{$or:s.schedule.occurrences({take:e}).toArray().map(t=>Object(n.f)(t.date)).map(t=>"isapprox"===a?{$and:[{date:{$gte:Object(n.q)(t,2)}},{date:{$lte:Object(n.a)(t,2)}}]}:{date:t})}}s.date;if("isapprox"===a){let t=Object(n.l)(s.date),e=Object(n.a)(t,2);return{$and:[{date:{$gte:Object(n.q)(t,2)}},{date:{$lte:e}}]}}switch(s.type){case"date":return{date:s.date};case"month":return{$and:[{date:{$gte:s.date+"-00"}},{date:{$lte:s.date+"-99"}}]};case"year":return{$and:[{date:{$gte:s.date+"-00-00"}},{date:{$lte:s.date+"-99-99"}}]}}}else if("number"===r){let t=s.value;if("isapprox"===a){let e=Object(i.b)(t);return{$and:[l(o,"$gte",t-e),l(o,"$lte",t+e)]}}return l(o,"$eq",t)}return l(o,"$eq",s);case"isbetween":let t=h(Object(i.c)(s.num1,s.num2),2),u=t[0],f=t[1];return{[o]:[{$gte:u},{$lte:f}]};case"contains":return l("id"===r?o+".name":o,"$like","%"+s+"%");case"oneOf":let d=s;return 0===d.length?{id:null}:{$or:d.map(t=>l(o,"$eq",t))};case"gt":return l(o,"$gt",c(s));case"gte":return l(o,"$gte",c(s));case"lt":return l(o,"$lt",c(s));case"lte":return l(o,"$lte",c(s));case"true":return l(o,"$eq",!0);case"false":return l(o,"$eq",!1);default:throw new Error("Unhandled operator: "+a)}}),errors:r}}function P(t,e,r){let n=e.map(t=>{if(t instanceof d.a)return t;try{return new d.a(t.op,t.field,t.value,t.options,i.a)}catch(t){return console.log("Action error",t),null}}).filter(Boolean);if(n.length!==e.length)return null;let o=t.map(t=>{let e={id:t};for(let t of n)t.exec(e);return e});return r["transactions-batch-update"]({updated:o})}function B(t){let e=new Set;return Object(d.e)(R(),"payee",(r,n)=>{n===t&&e.add(r)}),Object(d.g)([...e])}function*U(t,e,r,{condValue:n,actionValue:i}){let o=R();for(let a=0;a<o.length;a++){let s=o[a];s.stage!==t||1!==s.actions.length||"set"!==s.actions[0].op||s.actions[0].field!==r||void 0!==i&&s.actions[0].value!==i||1!==s.conditions.length||"is"!==s.conditions[0].op||s.conditions[0].field!==e||void 0!==n&&s.conditions[0].value!==n||(yield s.serialize())}return null}async function F(t,e){let r=function*(t,e,r,{condValue:n,actionValue:i}){let o=R();for(let a=0;a<o.length;a++){let s=o[a];s.stage!==t||1!==s.actions.length||"set"!==s.actions[0].op||s.actions[0].field!==r||null!=i&&s.actions[0].value!==i||1!==s.conditions.length||"oneOf"!==s.conditions[0].op||s.conditions[0].field!==e||null!=n&&-1===s.conditions[0].value.indexOf(n)||(yield s.serialize())}return null}("pre","imported_payee","payee",{actionValue:e}).next().value;if(r){let e=r.conditions[0],n=[...Object(o.e)(new Set(e.value),new Set(t.filter(t=>""!==t)))],i=m(m({},r),{},{conditions:[m(m({},e),{},{value:n})]});return await k(i),r.id}return D(new d.c({stage:"pre",conditions:[{op:"oneOf",field:"imported_payee",value:t}],actions:[{op:"set",field:"payee",value:e}],fieldTypes:i.a}).serialize())}function W(t){let e=new Map;t.forEach(t=>{t.category&&e.set(t.category,(e.get(t.category)||0)+1)});let r=t.reduce((t,r)=>{let n=e.get(r.category);return!t||n>t.score?{score:n,category:r.category}:t},null);return r.score>=3?r.category:null}async function H(t){if(0===t.length)return;let e=new Set(t.map(t=>t.payee)),r=new Set(t.map(t=>t.id)),a=null;for(let e=0;e<t.length;e++)(null===a||t[e].date<a)&&(a=t[e].date);a=Object(n.q)(a,180);let u=await s.all("SELECT t.* FROM v_transactions t\n LEFT JOIN accounts a ON a.id = t.account\n WHERE date >= ? AND date <= ? AND is_parent = 0 AND a.closed = 0",[Object(l.h)(a),Object(l.h)(Object(n.a)(Object(n.d)(),180))]),c=Object(o.n)(u,"payee"),g=new Map;for(let t of e)if(t){let e=(c.get(t)||[]).slice(0,5);if(e.find(t=>r.has(t.id))){let r=W(e);r&&g.set(t,r)}}await Object(f.c)(async()=>{for(let e of g.entries()){var t=h(e,2);let r=t[0],n=t[1],o=[...U(null,"payee","category",{condValue:r})];if(o.length>0)for(let t of o){let e=t.actions[0];e.value!==n&&await k(m(m({},t),{},{actions:[m(m({},e),{},{value:n})]}))}else{let t=new d.c({stage:null,conditions:[{op:"is",field:"payee",value:r}],actions:[{op:"set",field:"category",value:n}],fieldTypes:i.a});await D(t.serialize())}}})}async function q(){let t=await s.all("SELECT p.*, c.id as category FROM payees p\n LEFT JOIN category_mapping cm ON cm.id = p.category\n LEFT JOIN categories c ON (c.id = cm.transferId AND c.tombstone = 0)\n WHERE p.tombstone = 0 AND transfer_acct IS NULL"),e=await s.all("SELECT pr.*, pm.targetId as payee_id FROM payee_rules pr\n LEFT JOIN payee_mapping pm ON pm.id = pr.payee_id\n WHERE pr.tombstone = 0"),r=new Map;for(let e=0;e<t.length;e++)r.set(t[e].id,t[e]);let n=new Map;for(let t=0;t<e.length;t++){let r=e[t],i=n.get(r.payee_id)||[];i.push(r),n.set(r.payee_id,i)}let i=[];for(let t of n.entries()){var o=h(t,2);let e=o[0],n=o[1],a=n.filter(t=>{let e=r.get(t.payee_id);return!("equals"!==t.type&&null!=t.type||e&&t.value.toLowerCase()===e.name.toLowerCase())}),s=n.filter(t=>"contains"===t.type),u=[{op:"set",field:"payee",value:e}];a.length>0&&i.push({stage:null,conditions:[{op:"oneOf",field:"imported_payee",value:a.map(t=>t.value)}],actions:u}),s.length>0&&(i=i.concat(s.map(t=>({stage:null,conditions:[{op:"contains",field:"imported_payee",value:t.value}],actions:u}))))}let a=t.filter(t=>t.category).reduce((t,e)=>{let r=t.get(e.category)||new Set;return r.add(e.id),t.set(e.category,r),t},new Map);for(let t of a){var u=h(t,2);let e=u[0],r=u[1];i.push({stage:null,conditions:[{op:"oneOf",field:"payee",value:[...r]}],actions:[{op:"set",field:"category",value:e}]})}let c=Object(f.k)("disabled");await Object(f.c)(async()=>{for(let t of i)await D({stage:t.stage,conditions:t.conditions,actions:t.actions});await s.runQuery("DELETE FROM payee_rules",[])}),Object(f.k)(c)}},function(t,e,r){"use strict";function n(t,e){for(var r=t<0?"-":"",n=Math.abs(t).toString();n.length<e;)n="0"+n;return r+n}r.d(e,"a",(function(){return n}))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";function n(t){console.log("[Exception]",t),globalThis.SentryClient&&globalThis.SentryClient.captureException(t)}function i(t){globalThis.SentryClient&&globalThis.SentryClient.addBreadcrumb(t)}r.r(e),r.d(e,"captureException",(function(){return n})),r.d(e,"captureBreadcrumb",(function(){return i}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));function n(t){var e=new Date(t.getTime()),r=e.getTimezoneOffset();return e.setSeconds(0,0),6e4*r+e.getTime()%6e4}},function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.d(e,"a",(function(){return a})),r.d(e,"b",(function(){return s}));class a{constructor(t){this.state=i({filterExpressions:t.filterExpressions||[],selectExpressions:t.selectExpressions||[],groupExpressions:t.groupExpressions||[],orderExpressions:t.orderExpressions||[],calculation:!1,rawMode:!1,withDead:!1,validateRefs:!0,limit:null,offset:null},t)}filter(t){return new a(i(i({},this.state),{},{filterExpressions:[...this.state.filterExpressions,t]}))}unfilter(t){let e=new Set(t);return new a(i(i({},this.state),{},{filterExpressions:this.state.filterExpressions.filter(t=>!e.has(Object.keys(t)[0]))}))}select(t=[]){Array.isArray(t)||(t=[t]);let e=new a(i(i({},this.state),{},{selectExpressions:t}));return e.state.calculation=!1,e}calculate(t){let e=this.select({result:t});return e.state.calculation=!0,e}groupBy(t){return Array.isArray(t)||(t=[t]),new a(i(i({},this.state),{},{groupExpressions:[...this.state.groupExpressions,...t]}))}orderBy(t){return Array.isArray(t)||(t=[t]),new a(i(i({},this.state),{},{orderExpressions:[...this.state.orderExpressions,...t]}))}limit(t){return new a(i(i({},this.state),{},{limit:t}))}offset(t){return new a(i(i({},this.state),{},{offset:t}))}raw(){return new a(i(i({},this.state),{},{rawMode:!0}))}withDead(){return new a(i(i({},this.state),{},{withDead:!0}))}withoutValidatedRefs(){return new a(i(i({},this.state),{},{validateRefs:!1}))}options(t){return new a(i(i({},this.state),{},{tableOptions:t}))}serialize(){return this.state}}function s(t){return new a({table:t})}},function(t,e,r){"use strict";var n=r(56);const i=r(49),o=Object(n.a)();o.events.on("sync",t=>{i.send("sync-event",t)}),e.a=o},function(t,e,r){"use strict";r.d(e,"b",(function(){return _})),r.d(e,"a",(function(){return E})),r.d(e,"c",(function(){return S})),r.d(e,"d",(function(){return O})),r.d(e,"g",(function(){return M})),r.d(e,"f",(function(){return j})),r.d(e,"e",(function(){return I}));var n=r(63),i=r(108),o=r(127),a=r(46),s=r(2),u=r(37),c=r(39),l=r(15),f=r(21),d=r(91);function h(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function g(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?h(Object(r),!0).forEach((function(e){p(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function p(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function m(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return y(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return y(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function b(t,e,r){if(!t)throw new f.RuleError(e,r)}let w={date:{ops:["is","isapprox","gt","gte","lt","lte"],nullable:!1,parse(t,e,r){let o="string"==typeof e?"string"!=typeof(a=e)?null:10===a.length?n.a(i.a(a))?{type:"date",date:a}:null:7===a.length?n.a(i.a(a+"-01"))?{type:"month",date:a}:null:4===a.length&&n.a(i.a(a+"-01-01"))?{type:"year",date:a}:null:null!=e.frequency?function(t){try{let e=Object(c.e)(t);return{type:"recur",schedule:new d.a({rrules:e})}}catch(t){throw new f.RuleError("parse-recur-date",t.message)}}(e):null;var a;return b(o,"date-format",`Invalid date format (field: ${r})`),"isapprox"===t?b("date"===o.type||"recur"===o.type,"date-format",`Invalid date value for "isapprox" (field: ${r})`):"gt"!==t&&"gte"!==t&&"lt"!==t&&"lte"!==t||b("date"===o.type,"date-format",`Invalid date value for "${t}" (field: ${r})`),o}},id:{ops:["is","contains","oneOf"],nullable:!0,parse:(t,e,r)=>"oneOf"===t?(b(Array.isArray(e),"no-empty-array",`oneOf must have an array value (field: ${r})`),e):e},string:{ops:["is","contains","oneOf"],nullable:!1,parse:(t,e,r)=>"oneOf"===t?(b(Array.isArray(e),"no-empty-array",`oneOf must have an array value (field: ${r}): ${JSON.stringify(e)}`),e.filter(Boolean).map(t=>t.toLowerCase())):("contains"===t&&b("string"==typeof e&&e.length>0,"no-empty-string",`contains must have non-empty string (field: ${r})`),e.toLowerCase())},number:{ops:["is","isapprox","isbetween","gt","gte","lt","lte"],nullable:!1,parse(t,e,r){let n="number"==typeof e?{type:"literal",value:e}:function(t){let e=t.num1,r=t.num2;return"number"!=typeof e||"number"!=typeof r?null:{type:"between",num1:e,num2:r}}(e);return b(null!=n,"not-number",`Value must be a number or between amount: ${JSON.stringify(e)} (field: ${r})`),"isbetween"===t?b("between"===n.type,"number-format",`Invalid between value for "${t}" (field: ${r})`):b("literal"===n.type,"number-format",`Invalid number value for "${t}" (field: ${r})`),n}},boolean:{ops:["is"],nullable:!1,parse:(t,e,r)=>(b("boolean"==typeof e,"not-boolean",`Value must be a boolean: ${e} (field: ${r})`),e)}};class _{constructor(t,e,r,n,i){let o=i.get(e);b(o,"internal","Invalid condition field: "+e);let a=w[o];b(a,"internal",`Invalid condition type: ${o} (field: ${e})`),b(a.ops.includes(t),"internal",`Invalid condition operator: ${t} (type: ${o}, field: ${e})`),!0!==a.nullable&&b(null!=r,"no-null","Field cannot be empty: "+e),"string"===o&&!0!==a.nullable&&b(""!==r,"no-null","Field cannot be empty: "+e),this.rawValue=r,this.unparsedValue=r,this.op=t,this.field=e,this.value=a.parse?a.parse(t,r,e):r,this.options=n,this.type=o}eval(t){let e=t[this.field];if(void 0===e)return!1;"string"==typeof e&&(e=e.toLowerCase());let r=this.type;if("number"===r&&this.options)if(this.options.outflow){if(e>0)return!1;e=-e}else if(this.options.inflow&&e<0)return!1;let n=t=>"number"===r?t.value:t;switch(this.op){case"isapprox":case"is":if("date"===r){if(null==e)return!1;if("recur"===this.value.type){let t=this.value.schedule;if("isapprox"===this.op){let r=Object(s.l)(e);return t.occursBetween(o.a(r,2),a.a(r,2))}return t.occursOn({date:Object(s.l)(e)})}{let t=this.value.date;if("isapprox"===this.op){let r=Object(s.l)(t),n=Object(s.a)(r,2);return e>=Object(s.q)(r,2)&&e<=n}switch(this.value.type){case"date":return e===t;case"month":return Object(s.k)(e)===t;case"year":return Object(s.s)(e)===t}}}else if("number"===r){let t=this.value.value;if("isapprox"===this.op){let r=Object(u.b)(t);return e>=t-r&&e<=t+r}return e===t}return e===this.value;case"isbetween":{let t=m(Object(u.c)(this.value.num1,this.value.num2),2),r=t[0],n=t[1];return e>=r&&e<=n}case"contains":return null!==e&&-1!==e.indexOf(this.value);case"oneOf":return null!==e&&-1!==this.value.indexOf(e);case"gt":return null!==e&&("date"===r?Object(s.i)(e,this.value.date):e>n(this.value));case"gte":return null!==e&&("date"===r?e===this.value.date||Object(s.i)(e,this.value.date):e>=n(this.value));case"lt":return null!==e&&("date"===r?Object(s.j)(e,this.value.date):e<n(this.value));case"lte":return null!==e&&("date"===r?e===this.value.date||Object(s.j)(e,this.value.date):e<=n(this.value))}return!1}getValue(){return this.value}serialize(){return g({op:this.op,field:this.field,value:this.unparsedValue,type:this.type},this.options?{options:this.options}:null)}}let v=["set","link-schedule"];class E{constructor(t,e,r,n,i){if(b(v.includes(t),"internal","Invalid action operation: "+t),"set"===t){let t=i.get(e);b(t,"internal","Invalid field for action: "+e),this.field=e,this.type=t}else"link-schedule"===t&&(this.field=null,this.type="id");this.op=t,this.rawValue=r,this.value=r,this.options=n}exec(t){switch(this.op){case"set":t[this.field]=this.value;break;case"link-schedule":t.schedule=this.value}}serialize(){return g({op:this.op,field:this.field,value:this.value,type:this.type},this.options?{options:this.options}:null)}}class S{constructor({id:t,stage:e,conditions:r,actions:n,fieldTypes:i}){this.id=t,this.stage=e,this.conditions=r.map(t=>new _(t.op,t.field,t.value,t.options,i)),this.actions=n.map(t=>new E(t.op,t.field,t.value,t.options,i))}evalConditions(t){return 0!==this.conditions.length&&this.conditions.every(e=>e.eval(t))}execActions(t){let e={};return this.actions.forEach(t=>t.exec(e)),e}exec(t){return this.evalConditions(t)?this.execActions(t):null}apply(t){let e=this.exec(t);return Object.assign({},t,e)}getId(){return this.id}serialize(){return{id:this.id,stage:this.stage,conditions:this.conditions.map(t=>t.serialize()),actions:this.actions.map(t=>t.serialize())}}}class O{constructor({field:t,method:e}){this.field=t,this.method=e,this.rules=new Map}getIndex(t){return this.rules.has(t)||this.rules.set(t,new Set),this.rules.get(t)}getIndexForValue(t){return this.getIndex(this.getKey(t)||"*")}getKey(t){return"string"==typeof t&&""!==t?"firstchar"===this.method?t[0].toLowerCase():t.toLowerCase():null}getIndexes(t){let e=t.conditions.find(t=>t.field===this.field),r=[];return!e||"oneOf"!==e.op&&"is"!==e.op?r.push(this.getIndex("*")):"oneOf"===e.op?e.value.forEach(t=>r.push(this.getIndexForValue(t))):r.push(this.getIndexForValue(e.value)),r}index(t){this.getIndexes(t).forEach(e=>{e.add(t)})}remove(t){this.getIndexes(t).forEach(e=>{e.delete(t)})}getApplicableRules(t){let e;if(this.field in t){let r=this.getKey(t[this.field]);r&&(e=this.rules.get(r))}return Object(l.e)(e||new Set,this.rules.get("*")||new Set)}}const T={is:10,oneOf:9,isapprox:5,isbetween:5,gt:1,gte:1,lt:1,lte:1,contains:0};function A(t){let e=new Map;return t.forEach(t=>{e.set(t,function(t){let e=t.conditions.reduce((t,e)=>null==T[e.op]?(console.log("Found invalid operation while ranking: "+e.op),0):t+T[e.op],0);return t.conditions.every(t=>"is"===t.op||"isapprox"===t.op||"oneOf"===t.op)?2*e:e}(t))}),[...t].sort((t,r)=>{let n=e.get(t),i=e.get(r);if(n<i)return-1;if(n>i)return 1;{let e=t.getId(),n=r.getId();return e<n?-1:e>n?1:0}})}function M(t){let e=[],r=[],n=[];for(let i of t)switch(i.stage){case"pre":e.push(i);break;case"post":n.push(i);break;default:r.push(i)}return e=A(e),r=A(r),n=A(n),e.concat(r).concat(n)}function j(t,e){for(let r=0;r<t.conditions.length;r++){let n=t.conditions[r];if("id"===n.type)switch(n.op){case"is":n.value=e.get(n.rawValue)||n.rawValue,n.unparsedValue=n.value;break;case"oneOf":n.value=n.rawValue.map(t=>e.get(t)||t),n.unparsedValue=[...n.value]}}for(let r=0;r<t.actions.length;r++){let n=t.actions[r];"id"===n.type&&"set"===n.op&&(n.value=e.get(n.rawValue)||n.rawValue)}}function I(t,e,r){let n;t:for(n=0;n<t.length;n++){let i=t[n];for(let t=0;t<i.conditions.length;t++){let n=i.conditions[t];if("id"===n.type&&n.field===e)switch(n.op){case"is":if(r(i,n.value))continue t;break;case"oneOf":for(let t=0;t<n.value.length;t++)if(r(i,n.value[t]))continue t}}for(let t=0;t<i.actions.length;t++){let n=i.actions[t];if("id"===n.type&&n.field===e&&"set"===n.op&&r(i,n.value))break}}}},function(t,e,r){"use strict";r.r(e),function(t){r.d(e,"post",(function(){return l})),r.d(e,"postBinary",(function(){return f})),r.d(e,"get",(function(){return d}));var n=r(40);function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function o(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function a(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const s=r(129).fetch,u=r(21).PostError;function c(t,e){if(200!==t.status){if(500===t.status)throw new u(500===t.status?"internal":e);if(-1!==t.headers.get("Content-Type").toLowerCase().indexOf("application/json")){let t=JSON.parse(e);throw new u(t.reason)}throw new u(e)}}async function l(t,e){let r,n;(new Error).stack;try{n=await s(t,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}}),r=await n.text()}catch(t){throw new u("network-failure")}c(n,r);try{n=JSON.parse(r)}catch(t){throw new u("parse-json",{meta:r})}if("ok"!==n.status)throw console.log("API call failed: "+t+"\nData: "+JSON.stringify(e,null,2)+"\nResponse: "+JSON.stringify(n,null,2)),new u(n.description||n.reason||"unknown");return n.data}async function f(e,r,i){let a,l;try{a=await s(e,{method:"POST",body:n.a.isWeb?r:t.from(r),headers:o({"Content-Length":r.length,"Content-Type":"application/actual-sync"},i)})}catch(t){throw new u("network-failure")}return l=a.arrayBuffer?t.from(await a.arrayBuffer()):await a.buffer(),c(a,l.toString()),l}function d(t,e){return s(t,e).then(t=>t.text())}}.call(this,r(14).Buffer)},function(t,e,r){"use strict";var n=r(74);let i=r(401),o={};class a{constructor({id:t,value:e}){this.id=t||i.v4Sync()}async createFromPassword({password:t,salt:e}){this.value=await n.a({secret:t,salt:e})}async createFromBase64(t){this.value=await n.d(t)}getId(){return this.id}getValue(){return this.value}serialize(){return{id:this.id,base64:this.value.base64}}}function s(t){if(null==t||null==o[t])throw new Error("missing-key");return o[t]}e.a={decrypt:function(t,e){return n.b(s(e.keyId),t,e)},encrypt:function(t,e){return n.c(s(e),t)},randomBytes:function(t){return n.e(t)},createKey:async function({id:t,password:e,salt:r}){let n=new a({id:t});return await n.createFromPassword({password:e,salt:r}),n},loadKey:async function(t){let e;t instanceof a?e=t:(e=new a({id:t.id}),await e.createFromBase64(t.base64)),o[e.getId()]=e},getKey:s,hasKey:function(t){return t in o},unloadKey:function(t){delete o[t.getId()]},unloadAllKeys:function(){o={}}}},function(t,e,r){"use strict";r.d(e,"c",(function(){return g})),r.d(e,"i",(function(){return p})),r.d(e,"j",(function(){return m})),r.d(e,"a",(function(){return b})),r.d(e,"l",(function(){return w})),r.d(e,"g",(function(){return _})),r.d(e,"h",(function(){return v})),r.d(e,"e",(function(){return E})),r.d(e,"d",(function(){return S})),r.d(e,"f",(function(){return O})),r.d(e,"b",(function(){return T})),r.d(e,"m",(function(){return A})),r.d(e,"n",(function(){return M})),r.d(e,"k",(function(){return j}));var n=r(2),i=r(1),o=r(7),a=r(5),s=r(8);async function u(t,e){const r=await a.c(t,e);return"number"==typeof r.value?r.value:0}function c(){return"report"===(o.b()||{}).budgetType?"reflect_budgets":"zero_budgets"}function l(){return"report"===o.b().budgetType}function f(t){return parseInt(t.replace("-",""))}function d(t,e){return i.all(`\n SELECT b.*, c.is_income FROM v_categories c\n LEFT JOIN ${t} b ON b.category = c.id\n WHERE c.tombstone = 0 AND b.month = ?\n `,[e])}function h(t){let e=a.b().meta().createdMonths,r=null;for(let t of e)(null==r||t>r)&&(r=t);return n.o(t,r)}function g({category:t,month:e}){let r=c(),n=i.firstSync(`SELECT * FROM ${r} WHERE month = ? AND category = ?`,[f(e),t]);return n&&n.amount||0}function p({category:t,month:e,amount:r}){"number"!=typeof r&&(r=0);const n=c();let o=i.firstSync(`SELECT id FROM ${n} WHERE month = ? AND category = ?`,[f(e),t]);return o?i.update(n,{id:o.id,amount:r}):i.insert(n,{id:`${f(e)}-${t}`,month:f(e),category:t,amount:r})}function m(t,e){let r=i.firstSync("SELECT id FROM zero_budget_months WHERE id = ?",[t]);return r?i.update("zero_budget_months",{id:r.id,buffered:e}):i.insert("zero_budget_months",{id:t,buffered:e})}function y(t,e,r,n){let o=i.firstSync(`SELECT id FROM ${t} WHERE month = ? AND category = ?`,[r,e]);return o?i.update(t,{id:o.id,carryover:n?1:0}):i.insert(t,{id:`${r}-${e}`,month:r,category:e,carryover:n?1:0})}async function b({month:t}){let e=f(n.m(t)),r=c(),i=await d(r,e);await Object(s.c)(()=>{i.forEach(e=>{(1!==e.is_income||l())&&p({category:e.category,month:t,amount:e.amount})})})}async function w({month:t}){let e=await i.all("SELECT * FROM v_categories WHERE tombstone = 0");await Object(s.c)(()=>{e.forEach(e=>{(1!==e.is_income||l())&&p({category:e.id,month:t,amount:0})})})}async function _({month:t}){let e=await i.all("SELECT * FROM v_categories WHERE tombstone = 0"),r=n.m(t),o=n.m(r),a=n.m(o);await Object(s.c)(async()=>{for(let i of e){if(1===i.is_income&&!l())continue;const e=(await u(n.p(r),"sum-amount-"+i.id)+await u(n.p(o),"sum-amount-"+i.id)+await u(n.p(a),"sum-amount-"+i.id))/3|0;p({category:i.id,month:t,amount:-e})}})}async function v({startMonth:t}){if(!l())throw new Error("setAllFuture only applies to report budget type");let e=c(),r=await d(e,f(t)),i=h(n.b(t,1));Object(s.c)(()=>{for(let t of i)r.forEach(e=>{(1!==e.is_income||l())&&p({category:e.category,month:t,amount:e.amount})})})}async function E({month:t,amount:e}){let r=await i.first("SELECT buffered FROM zero_budget_months WHERE id = ?",[t]),o=n.p(t),a=await u(o,"to-budget");if(a>0){let n=function(t,e,r){return e+(r=Math.min(Math.max(r,-e),Math.max(t,0)))}(a,r&&r.buffered||0,e);return await m(t,n),!0}return!1}async function S({startMonth:t,amount:e}){let r=h(t);await Object(s.c)(async()=>{for(let t of r)if(!await E({month:t,amount:e}))break})}async function O({month:t}){await m(t,0)}async function T({month:t,to:e,from:r}){let i=n.p(t),o=await u(i,"budget-"+e),a=await u(i,"leftover-"+e),s=await u(i,"to-be-budgeted"===r?"to-budget":"leftover-"+r);if(a>=0||s<=0)return;let c=Math.min(-a,s);if("to-be-budgeted"!==r){const e=await u(i,"budget-"+r);await p({category:r,month:t,amount:e-c})}await p({category:e,month:t,amount:o+c})}async function A({month:t,amount:e,category:r}){let i=n.p(t),o=await u(i,"to-budget");e=Math.max(Math.min(e,o),0);let a=await u(i,"budget-"+r);await p({category:r,month:t,amount:a+e})}async function M({month:t,amount:e,from:r,to:i}){const o=n.p(t),a=await u(o,"budget-"+r);if(await p({category:r,month:t,amount:a-e}),"to-be-budgeted"!==i){const r=await u(o,"budget-"+i);await p({category:i,month:t,amount:r+e})}}async function j({startMonth:t,category:e,flag:r}){let n=c(),i=h(t);await Object(s.c)(()=>{for(let t of i)y(n,e,f(t),r)})}},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return T})),r.d(e,"h",(function(){return A})),r.d(e,"c",(function(){return M})),r.d(e,"d",(function(){return j})),r.d(e,"i",(function(){return I})),r.d(e,"f",(function(){return R})),r.d(e,"g",(function(){return D})),r.d(e,"e",(function(){return k})),r.d(e,"b",(function(){return N}));var n=r(10),i=r.n(n),o=r(129),a=r(4),s=r.n(a),u=r(13),c=r(2),l=r(31),f=r(21),d=r(6),h=r(30),g=r(7),p=r(19);function m(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return y(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return y(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function b(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function w(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?b(Object(r),!0).forEach((function(e){_(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function _(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}let v=r(234),E=r(41);async function S(t){return 200!==t.status?t.text().then(e=>{throw new f.HTTPError(t.status,e)}):t}async function O(...t){let e=await Object(o.fetch)(...t);return e=await S(e),e.json()}async function T(){let t,e=await i.a.getItem("user-token"),r=g.b(),n=r.cloudFileId,o=r.encryptKeyId;try{t=await Object(h.post)(Object(p.a)().SYNC_SERVER+"/user-get-key",{token:e,fileId:n})}catch(t){return console.log(t),{error:{reason:"network"}}}return{valid:t.id==o&&(null==o||l.a.hasKey(o))}}async function A(t){let e=await i.a.getItem("user-token"),r=g.b().cloudFileId;try{await Object(h.post)(Object(p.a)().SYNC_SERVER+"/reset-user-file",{token:e,fileId:r})}catch(t){return t instanceof f.PostError?{error:{reason:"unauthorized"===t.reason?"unauthorized":"network"}}:{error:{reason:"internal"}}}if(t)try{await Object(h.post)(Object(p.a)().SYNC_SERVER+"/user-create-key",{token:e,fileId:r,keyId:t.key.getId(),keySalt:t.salt,testContent:t.testContent})}catch(t){return t instanceof f.PostError?{error:{reason:"network"}}:{error:{reason:"internal"}}}return{}}async function M(){let e=g.b(),r=e.id;if(!e.budgetName)return null;let n=s.a.getBudgetDir(r),i=new v;return await Object(d.runMutator)(async()=>{let e=await s.a.readFile(s.a.join(n,"db.sqlite"),"binary"),r=await u.openDatabase(e);u.execQuery(r,"\n DELETE FROM kvcache;\n DELETE FROM kvcache_key;\n ");let o=u.exportDatabase(r);u.closeDatabase(r);let a=JSON.parse(await s.a.readFile(s.a.join(n,"metadata.json")));a.resetClock=!0;let c=t.from(JSON.stringify(a),"utf8");i.addFile("db.sqlite",o),i.addFile("metadata.json",c)}),t.from(i.toBuffer())}async function j(t,e){let r=new v(e),n=r.getEntries(),i=n.find(t=>t.entryName.includes("db.sqlite")),o=n.find(t=>t.entryName.includes("metadata.json"));if(!i||!o)throw Object(f.FileDownloadError)("invalid-zip-file");let a,u=r.readFile(i),l=r.readFile(o);try{a=JSON.parse(l.toString("utf8"))}catch(t){throw Object(f.FileDownloadError)("invalid-meta-file")}a=w(w({},a),{},{cloudFileId:t.fileId,groupId:t.groupId,lastUploaded:c.d(),encryptKeyId:t.encryptMeta?t.encryptMeta.keyId:null});let d=s.a.getBudgetDir(a.id);if(await s.a.exists(d)){let t=s.a.join(d,"db.sqlite"),e=s.a.join(d,"metadata.json");await s.a.exists(t)&&await s.a.removeFile(t),await s.a.exists(e)&&await s.a.removeFile(e)}else await s.a.mkdir(d);return await s.a.writeFile(s.a.join(d,"db.sqlite"),u),await s.a.writeFile(s.a.join(d,"metadata.json"),JSON.stringify(a)),{id:a.id}}async function I(){let t=await i.a.getItem("user-token");if(!t)throw Object(f.FileUploadError)("unauthorized");let e=await M();if(null==e)return;let r,n=g.b(),o=n.id,a=n.groupId,s=n.budgetName,u=n.cloudFileId,d=n.encryptKeyId,h=e,m=null;if(d){let t;try{t=await l.a.encrypt(e,d)}catch(t){throw Object(f.FileUploadError)("encrypt-failure",{isMissingKey:"missing-key"===t.message})}h=t.value,m=t.meta}u||(u=E.v4Sync());try{r=await O(Object(p.a)().SYNC_SERVER+"/upload-user-file",{method:"POST",headers:w(w({"Content-Length":h.length,"Content-Type":"application/encrypted-file","X-ACTUAL-TOKEN":t,"X-ACTUAL-FILE-ID":u,"X-ACTUAL-NAME":encodeURIComponent(s),"X-ACTUAL-FORMAT":2},m?{"X-ACTUAL-ENCRYPT-META":JSON.stringify(m)}:null),a?{"X-ACTUAL-GROUP-ID":a}:null),body:h})}catch(t){console.log("Upload failure",t);t instanceof f.PostError&&t.reason;if(t instanceof f.PostError)throw new f.FileUploadError("unauthorized"===t.reason?"unauthorized":t.reason||"network");throw Object(f.FileUploadError)("internal")}if("ok"!==r.status)throw Object(f.FileUploadError)("internal");g.b()&&g.b().id===o&&await g.d({lastUploaded:c.d(),cloudFileId:u,groupId:r.groupId})}async function R(){let t=g.b(),e=t.cloudFileId,r=t.groupId,n=t.lastUploaded,i=(t.id,n&&c.a(n,7)),o=c.d();n&&o<i||e&&r&&I().catch(t=>{})}async function D(t){const e=m(await i.a.multiGet(["user-token"]),1),r=m(e[0],2)[1];await Object(h.post)(Object(p.a)().SYNC_SERVER+"/delete-user-file",{token:r,fileId:t})}async function k(){let t,e=await i.a.getItem("user-token");if(!e)return null;try{t=await O(Object(p.a)().SYNC_SERVER+"/list-user-files",{headers:{"X-ACTUAL-TOKEN":e}})}catch(t){return console.log("Error",t),null}return"error"===t.status?null:t.data.map(t=>w(w({},t),{},{hasKey:l.a.hasKey(t.encryptKeyId)}))}async function N(e,r){let n,a,s=await i.a.getItem("user-token");try{n=await Object(o.fetch)(Object(p.a)().SYNC_SERVER+"/download-user-file",{headers:{"X-ACTUAL-TOKEN":s,"X-ACTUAL-FILE-ID":e}}).then(S).then(e=>e.arrayBuffer?e.arrayBuffer().then(e=>t.from(e)):e.buffer())}catch(t){throw console.log("Download failure",t),Object(f.FileDownloadError)("download-failure")}try{a=await O(Object(p.a)().SYNC_SERVER+"/get-user-file-info",{headers:{"X-ACTUAL-TOKEN":s,"X-ACTUAL-FILE-ID":e}})}catch(t){throw Object(f.FileDownloadError)("internal",{fileId:e})}if("ok"!==a.status)throw Object(f.FileDownloadError)("internal",{fileId:e});let u=a.data;if(u.encryptMeta)try{n=await l.a.decrypt(n,u.encryptMeta)}catch(t){throw Object(f.FileDownloadError)("decrypt-failure",{isMissingKey:"missing-key"===t.message})}return j(u,n)}}).call(this,r(14).Buffer)},function(t,e,r){"use strict";r.d(e,"a",(function(){return N}));var n=r(3),i=r(26),o=r(0),a=r(63),s=r(57),u=r(60);var c=r(133),l=r(125),f=r(132),d=r(89),h=r(23),g="midnight",p="noon",m="morning",y="afternoon",b="evening",w="night";function _(t,e){var r=t>0?"-":"+",n=Math.abs(t),i=Math.floor(n/60),o=n%60;if(0===o)return r+String(i);var a=e||"";return r+String(i)+a+Object(h.a)(o,2)}function v(t,e){return t%60==0?(t>0?"-":"+")+Object(h.a)(Math.abs(t)/60,2):E(t,e)}function E(t,e){var r=e||"",n=t>0?"-":"+",i=Math.abs(t);return n+Object(h.a)(Math.floor(i/60),2)+r+Object(h.a)(i%60,2)}var S={G:function(t,e,r){var n=t.getUTCFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(t,e,r){if("yo"===e){var n=t.getUTCFullYear(),i=n>0?n:1-n;return r.ordinalNumber(i,{unit:"year"})}return u.a.y(t,e)},Y:function(t,e,r,n){var i=Object(d.a)(t,n),o=i>0?i:1-i;if("YY"===e){var a=o%100;return Object(h.a)(a,2)}return"Yo"===e?r.ordinalNumber(o,{unit:"year"}):Object(h.a)(o,e.length)},R:function(t,e){var r=Object(l.a)(t);return Object(h.a)(r,e.length)},u:function(t,e){var r=t.getUTCFullYear();return Object(h.a)(r,e.length)},Q:function(t,e,r){var n=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return Object(h.a)(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,r){var n=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return Object(h.a)(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,r){var n=t.getUTCMonth();switch(e){case"M":case"MM":return u.a.M(t,e);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,r){var n=t.getUTCMonth();switch(e){case"L":return String(n+1);case"LL":return Object(h.a)(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(t,e,r,n){var i=Object(f.a)(t,n);return"wo"===e?r.ordinalNumber(i,{unit:"week"}):Object(h.a)(i,e.length)},I:function(t,e,r){var n=Object(c.a)(t);return"Io"===e?r.ordinalNumber(n,{unit:"week"}):Object(h.a)(n,e.length)},d:function(t,e,r){return"do"===e?r.ordinalNumber(t.getUTCDate(),{unit:"date"}):u.a.d(t,e)},D:function(t,e,r){var n=function(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(o.a)(t),r=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var n=e.getTime(),i=r-n;return Math.floor(i/864e5)+1}(t);return"Do"===e?r.ordinalNumber(n,{unit:"dayOfYear"}):Object(h.a)(n,e.length)},E:function(t,e,r){var n=t.getUTCDay();switch(e){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,r,n){var i=t.getUTCDay(),o=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return Object(h.a)(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});case"eeee":default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,r,n){var i=t.getUTCDay(),o=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return Object(h.a)(o,e.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});case"cccc":default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,r){var n=t.getUTCDay(),i=0===n?7:n;switch(e){case"i":return String(i);case"ii":return Object(h.a)(i,e.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(t,e,r){var n=t.getUTCHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(t,e,r){var n,i=t.getUTCHours();switch(n=12===i?p:0===i?g:i/12>=1?"pm":"am",e){case"b":case"bb":case"bbb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbbbb":return r.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(t,e,r){var n,i=t.getUTCHours();switch(n=i>=17?b:i>=12?y:i>=4?m:w,e){case"B":case"BB":case"BBB":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(t,e,r){if("ho"===e){var n=t.getUTCHours()%12;return 0===n&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return u.a.h(t,e)},H:function(t,e,r){return"Ho"===e?r.ordinalNumber(t.getUTCHours(),{unit:"hour"}):u.a.H(t,e)},K:function(t,e,r){var n=t.getUTCHours()%12;return"Ko"===e?r.ordinalNumber(n,{unit:"hour"}):Object(h.a)(n,e.length)},k:function(t,e,r){var n=t.getUTCHours();return 0===n&&(n=24),"ko"===e?r.ordinalNumber(n,{unit:"hour"}):Object(h.a)(n,e.length)},m:function(t,e,r){return"mo"===e?r.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):u.a.m(t,e)},s:function(t,e,r){return"so"===e?r.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):u.a.s(t,e)},S:function(t,e){var r=e.length,n=t.getUTCMilliseconds(),i=Math.floor(n*Math.pow(10,r-3));return Object(h.a)(i,r)},X:function(t,e,r,n){var i=(n._originalDate||t).getTimezoneOffset();if(0===i)return"Z";switch(e){case"X":return v(i);case"XXXX":case"XX":return E(i);case"XXXXX":case"XXX":default:return E(i,":")}},x:function(t,e,r,n){var i=(n._originalDate||t).getTimezoneOffset();switch(e){case"x":return v(i);case"xxxx":case"xx":return E(i);case"xxxxx":case"xxx":default:return E(i,":")}},O:function(t,e,r,n){var i=(n._originalDate||t).getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+_(i,":");case"OOOO":default:return"GMT"+E(i,":")}},z:function(t,e,r,n){var i=(n._originalDate||t).getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+_(i,":");case"zzzz":default:return"GMT"+E(i,":")}},t:function(t,e,r,n){var i=n._originalDate||t,o=Math.floor(i.getTime()/1e3);return Object(h.a)(o,e.length)},T:function(t,e,r,n){var i=(n._originalDate||t).getTime();return Object(h.a)(i,e.length)}};function O(t,e){switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}}function T(t,e){switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}}var A={p:T,P:function(t,e){var r,n=t.match(/(P+)(p+)?/),i=n[1],o=n[2];if(!o)return O(t,e);switch(i){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;case"PPPP":default:r=e.dateTime({width:"full"})}return r.replace("{{date}}",O(i,e)).replace("{{time}}",T(o,e))}},M=r(47),j=r(92),I=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,R=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,D=/^'(.*?)'?$/,k=/''/g;function N(t,e,r){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var u=String(e),c=r||{},l=c.locale||s.a,f=l.options&&l.options.firstWeekContainsDate,d=null==f?1:Object(n.a)(f),h=null==c.firstWeekContainsDate?d:Object(n.a)(c.firstWeekContainsDate);if(!(h>=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var g=l.options&&l.options.weekStartsOn,p=null==g?0:Object(n.a)(g),m=null==c.weekStartsOn?p:Object(n.a)(c.weekStartsOn);if(!(m>=0&&m<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!l.localize)throw new RangeError("locale must contain localize property");if(!l.formatLong)throw new RangeError("locale must contain formatLong property");var y=Object(o.a)(t);if(!Object(a.a)(y))throw new RangeError("Invalid time value");var b=Object(i.a)(y),w=Object(M.a)(y,b),_={firstWeekContainsDate:h,weekStartsOn:m,locale:l,_originalDate:y},v=u.match(R).map((function(t){var e=t[0];return"p"===e||"P"===e?(0,A[e])(t,l.formatLong,_):t})).join("").match(I).map((function(t){if("''"===t)return"'";var e=t[0];if("'"===e)return C(t);var r=S[e];return r?(!c.awareOfUnicodeTokens&&Object(j.a)(t)&&Object(j.b)(t),r(w,t,l.localize,_)):t})).join("");return v}function C(t){return t.match(D)[1].replace(k,"'")}},function(t,e,r){(function(t){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(348).Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function c(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,l=r;l<s;l+=n)u=c(t,l,l+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var f=1;for(u=c(t,l,t.length,e),l=0;l<a;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&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?"<BN-R: ":"<BN: ")+this.toString(16)+">"};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"],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],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];function h(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c<n;c++){for(var l=u>>>26,f=67108863&u,d=Math.min(c,e.length-1),h=Math.max(0,c-t.length+1);h<=d;h++){var g=c-h|0;l+=(a=(i=0|t.words[g])*(o=0|e.words[h])+f)/67108864|0,f=67108863&a}r.words[c]=0|f,u=0|l}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);r=0!==(o=s>>>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%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=f[t],h=d[t];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(h).toString(t);r=(g=g.idivn(h)).isZero()?p+r:l[c-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%e!=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 t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,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"===e,c=new t(o),l=this.clone();if(u){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a<n.length;a++)o=(e=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var g=function(t,e,r){var n,i,o,a=t.words,s=e.words,u=r.words,c=0,l=0|a[0],f=8191&l,d=l>>>13,h=0|a[1],g=8191&h,p=h>>>13,m=0|a[2],y=8191&m,b=m>>>13,w=0|a[3],_=8191&w,v=w>>>13,E=0|a[4],S=8191&E,O=E>>>13,T=0|a[5],A=8191&T,M=T>>>13,j=0|a[6],I=8191&j,R=j>>>13,D=0|a[7],k=8191&D,N=D>>>13,C=0|a[8],x=8191&C,L=C>>>13,P=0|a[9],B=8191&P,U=P>>>13,F=0|s[0],W=8191&F,H=F>>>13,q=0|s[1],z=8191&q,V=q>>>13,Y=0|s[2],G=8191&Y,$=Y>>>13,K=0|s[3],Z=8191&K,J=K>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ft=8191&lt,dt=lt>>>13,ht=0|s[9],gt=8191&ht,pt=ht>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(c+(n=Math.imul(f,W))|0)+((8191&(i=(i=Math.imul(f,H))+Math.imul(d,W)|0))<<13)|0;c=((o=Math.imul(d,H))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(g,W),i=(i=Math.imul(g,H))+Math.imul(p,W)|0,o=Math.imul(p,H);var yt=(c+(n=n+Math.imul(f,z)|0)|0)+((8191&(i=(i=i+Math.imul(f,V)|0)+Math.imul(d,z)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,W),i=(i=Math.imul(y,H))+Math.imul(b,W)|0,o=Math.imul(b,H),n=n+Math.imul(g,z)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(p,z)|0,o=o+Math.imul(p,V)|0;var bt=(c+(n=n+Math.imul(f,G)|0)|0)+((8191&(i=(i=i+Math.imul(f,$)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,$)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(_,W),i=(i=Math.imul(_,H))+Math.imul(v,W)|0,o=Math.imul(v,H),n=n+Math.imul(y,z)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,z)|0,o=o+Math.imul(b,V)|0,n=n+Math.imul(g,G)|0,i=(i=i+Math.imul(g,$)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,$)|0;var wt=(c+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,W),i=(i=Math.imul(S,H))+Math.imul(O,W)|0,o=Math.imul(O,H),n=n+Math.imul(_,z)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,z)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(y,G)|0,i=(i=i+Math.imul(y,$)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,$)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,J)|0)+Math.imul(p,Z)|0,o=o+Math.imul(p,J)|0;var _t=(c+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(A,W),i=(i=Math.imul(A,H))+Math.imul(M,W)|0,o=Math.imul(M,H),n=n+Math.imul(S,z)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(O,z)|0,o=o+Math.imul(O,V)|0,n=n+Math.imul(_,G)|0,i=(i=i+Math.imul(_,$)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,$)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,J)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var vt=(c+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(d,rt)|0))<<13)|0;c=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(I,W),i=(i=Math.imul(I,H))+Math.imul(R,W)|0,o=Math.imul(R,H),n=n+Math.imul(A,z)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(M,z)|0,o=o+Math.imul(M,V)|0,n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,$)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,$)|0,n=n+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,J)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,J)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,nt)|0;var Et=(c+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(k,W),i=(i=Math.imul(k,H))+Math.imul(N,W)|0,o=Math.imul(N,H),n=n+Math.imul(I,z)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(R,z)|0,o=o+Math.imul(R,V)|0,n=n+Math.imul(A,G)|0,i=(i=i+Math.imul(A,$)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,$)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,J)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,J)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(c+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(x,W),i=(i=Math.imul(x,H))+Math.imul(L,W)|0,o=Math.imul(L,H),n=n+Math.imul(k,z)|0,i=(i=i+Math.imul(k,V)|0)+Math.imul(N,z)|0,o=o+Math.imul(N,V)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,$)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,$)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,J)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(_,rt)|0,i=(i=i+Math.imul(_,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,n=n+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ct)|0;var Ot=(c+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,dt)|0)+Math.imul(d,ft)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(B,W),i=(i=Math.imul(B,H))+Math.imul(U,W)|0,o=Math.imul(U,H),n=n+Math.imul(x,z)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(L,z)|0,o=o+Math.imul(L,V)|0,n=n+Math.imul(k,G)|0,i=(i=i+Math.imul(k,$)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,$)|0,n=n+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,J)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,n=n+Math.imul(g,ft)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,dt)|0;var Tt=(c+(n=n+Math.imul(f,gt)|0)|0)+((8191&(i=(i=i+Math.imul(f,pt)|0)+Math.imul(d,gt)|0))<<13)|0;c=((o=o+Math.imul(d,pt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(B,z),i=(i=Math.imul(B,V))+Math.imul(U,z)|0,o=Math.imul(U,V),n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,$)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,$)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,at)|0,n=n+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,dt)|0;var At=(c+(n=n+Math.imul(g,gt)|0)|0)+((8191&(i=(i=i+Math.imul(g,pt)|0)+Math.imul(p,gt)|0))<<13)|0;c=((o=o+Math.imul(p,pt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(B,G),i=(i=Math.imul(B,$))+Math.imul(U,G)|0,o=Math.imul(U,$),n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,J)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ct)|0,n=n+Math.imul(_,ft)|0,i=(i=i+Math.imul(_,dt)|0)+Math.imul(v,ft)|0,o=o+Math.imul(v,dt)|0;var Mt=(c+(n=n+Math.imul(y,gt)|0)|0)+((8191&(i=(i=i+Math.imul(y,pt)|0)+Math.imul(b,gt)|0))<<13)|0;c=((o=o+Math.imul(b,pt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(B,Z),i=(i=Math.imul(B,J))+Math.imul(U,Z)|0,o=Math.imul(U,J),n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,at)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,n=n+Math.imul(S,ft)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,dt)|0;var jt=(c+(n=n+Math.imul(_,gt)|0)|0)+((8191&(i=(i=i+Math.imul(_,pt)|0)+Math.imul(v,gt)|0))<<13)|0;c=((o=o+Math.imul(v,pt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,n=Math.imul(B,Q),i=(i=Math.imul(B,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ct)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,dt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,dt)|0;var It=(c+(n=n+Math.imul(S,gt)|0)|0)+((8191&(i=(i=i+Math.imul(S,pt)|0)+Math.imul(O,gt)|0))<<13)|0;c=((o=o+Math.imul(O,pt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(B,rt),i=(i=Math.imul(B,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,dt)|0;var Rt=(c+(n=n+Math.imul(A,gt)|0)|0)+((8191&(i=(i=i+Math.imul(A,pt)|0)+Math.imul(M,gt)|0))<<13)|0;c=((o=o+Math.imul(M,pt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ct)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,dt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,dt)|0;var Dt=(c+(n=n+Math.imul(I,gt)|0)|0)+((8191&(i=(i=i+Math.imul(I,pt)|0)+Math.imul(R,gt)|0))<<13)|0;c=((o=o+Math.imul(R,pt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,n=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(U,ut)|0,o=Math.imul(U,ct),n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(L,ft)|0,o=o+Math.imul(L,dt)|0;var kt=(c+(n=n+Math.imul(k,gt)|0)|0)+((8191&(i=(i=i+Math.imul(k,pt)|0)+Math.imul(N,gt)|0))<<13)|0;c=((o=o+Math.imul(N,pt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(B,ft),i=(i=Math.imul(B,dt))+Math.imul(U,ft)|0,o=Math.imul(U,dt);var Nt=(c+(n=n+Math.imul(x,gt)|0)|0)+((8191&(i=(i=i+Math.imul(x,pt)|0)+Math.imul(L,gt)|0))<<13)|0;c=((o=o+Math.imul(L,pt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var Ct=(c+(n=Math.imul(B,gt))|0)+((8191&(i=(i=Math.imul(B,pt))+Math.imul(U,gt)|0))<<13)|0;return c=((o=Math.imul(U,pt))+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=yt,u[2]=bt,u[3]=wt,u[4]=_t,u[5]=vt,u[6]=Et,u[7]=St,u[8]=Ot,u[9]=Tt,u[10]=At,u[11]=Mt,u[12]=jt,u[13]=It,u[14]=Rt,u[15]=Dt,u[16]=kt,u[17]=Nt,u[18]=Ct,0!==c&&(u[19]=c,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(g=h),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?h(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var a=i;i=0;for(var s=67108863&n,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,f=(0|t.words[l])*(0|e.words[c]),d=67108863&f;s=67108863&(d=d+s|0),i+=(a=(a=a+(f/67108864|0)|0)+(d>>>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,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a<o;a++)n[a]=e[t[a]],i[a]=r[t[a]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var f=u,d=c,h=0;h<a;h++){var g=r[l+h],p=n[l+h],m=r[l+h+a],y=n[l+h+a],b=f*m-d*y;y=f*y+d*m,m=b,r[l+h]=g+m,n[l+h]=p+y,r[l+h+a]=g-m,n[l+h+a]=p-y,h!==s&&(b=u*f-c*d,d=u*d+c*f,f=b)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},m.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),u=new Array(n),c=new Array(n),l=new Array(n),f=new Array(n),d=r.words;d.length=n,this.convert13b(t.words,t.length,a,n),this.convert13b(e.words,e.length,c,n),this.transform(a,o,s,u,n,i),this.transform(c,o,l,f,n,i);for(var h=0;h<n;h++){var g=s[h]*l[h]-u[h]*f[h];u[h]=s[h]*f[h]+u[h]*l[h],s[h]=g}return this.conjugate(s,u,n),this.transform(s,u,d,o,n,i),this.conjugate(d,o,n),this.normalize13b(d,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),p(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var f=0|this.words[c];this.words[c]=l<<26-o|f>>>o,l=f&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r)&&!!(this.words[r]&i)},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,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"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=n.clone()._ishlnsubmul(i,1,u);0===l.negative&&(n=l,s&&(s.words[u]=1));for(var f=u-1;f>=0;f--){var d=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=d)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),f=e.clone();!e.isZero();){for(var d=0,h=1;0==(e.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(f)),i.iushrn(1),a.iushrn(1);for(var g=0,p=1;0==(r.words[0]&p)&&g<26;++g,p<<=1);if(g>0)for(r.iushrn(g);g-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(f)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(u)):(r.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var f=0,d=1;0==(r.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>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(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},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(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function O(t){S.call(this,t),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 t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(w,b),w.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n<r;n++)e.words[n]=t.words[n];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(_,b),i(v,b),i(E,b),E.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return y[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,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),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,i),d=this.pow(t,i.addn(1).iushrn(1)),h=this.pow(t,i),g=a;0!==h.cmp(s);){for(var p=h,m=0;0!==p.cmp(s);m++)p=p.redSqr();n(m<g);var y=this.pow(f,new o(1).iushln(g-m-1));d=d.redMul(y),f=y.redSqr(),h=h.redMul(f),g=m}return d},S.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},S.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],l=u-1;l>=0;l--){var f=c>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===n&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new O(t)},i(O,S),O.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},O.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},O.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},O.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),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)},O.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(95)(t))},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(0);function i(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(n.a)(t),i=Object(n.a)(e),o=r.getTime()-i.getTime();return o<0?-1:o>0?1:o}},function(t,e,r){"use strict";r.d(e,"a",(function(){return n})),r.d(e,"c",(function(){return i})),r.d(e,"b",(function(){return o}));r(15);const n=new Map(Object.entries({imported_payee:"string",payee:"id",date:"date",notes:"string",amount:"number",amountInflow:"number",amountOutfow:"number",category:"id",account:"id",cleared:"boolean"}));function i(t,e){return t<e?[t,e]:[e,t]}function o(t){return.075*Math.abs(t)|0}},function(t,e,r){"use strict";r.d(e,"b",(function(){return A})),r.d(e,"c",(function(){return k})),r.d(e,"a",(function(){return N})),r.d(e,"d",(function(){return C}));var n=r(2),i=r(73),o=r(15),a=r(1),s=r(6),u=r(19),c=r(8),l=r(130),f=r(271),d=r.n(f),h=r(22),g=r(64);const p=["subtransactions"],m=["payee_name","subtransactions"];function y(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?y(Object(r),!0).forEach((function(e){w(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function w(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _(t,e){if(null==t)return{};var r,n,i=function(t,e){if(null==t)return{};var r,n,i={},o=Object.keys(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||(i[r]=t[r]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}r(424);const v=r(70),E=r(41),S=r(30).post;function O(t,e){let r=Object(i.c)(b(b({},t),{},{is_parent:!0,subtransactions:e.map((e,r)=>Object(i.b)(t,b(b({},e),{},{sort_order:0-r})))})),n=r.subtransactions;return[_(r,p),...n]}function T(t){switch(t.type){case"credit":case"loan":return-t.balances.current;default:return t.balances.current}}async function A(t,e,r){let n=(await S(Object(u.a)().PLAID_SERVER+"/accounts",{userId:t,key:e,item_id:r})).accounts;return n.forEach(t=>{t.balances.current=T(t)}),n}function M(t){return{imported_id:t.transaction_id,payee_name:t.name,imported_payee:t.name,amount:-Object(o.a)(t.amount),date:t.date}}async function j(t,e,r,i,o,a){let s=[],c=null,l=0,f=0;for(;;){const g=n.d(),p=await S(Object(u.a)().PLAID_SERVER+"/transactions",{userId:t,key:e,item_id:""+i,account_id:r,start_date:o,end_date:g,count:100,offset:l});if(p.error_code)throw d=p.error_type,h=p.error_code,{type:"BankSyncError",category:d,code:h};if(0===p.transactions.length)break;if(f+=p.transactions.length,s=s.concat(p.transactions.filter(t=>!t.pending)),c=T(p.accounts[0]),f===p.total_transactions||null!=a&&s.length>=a)break;l+=100}var d,h;return s=null!=a?s.slice(0,a):s,{transactions:s.map(M),accountBalance:c}}async function I(t,e,r){if(null==t.payee&&e){let t=r.get(e.toLowerCase());if(t=t||await a.getPayeeByName(e),null!=t)return t.id;{let t={id:E.v4Sync(),name:e};return r.set(e.toLowerCase(),t),t.id}}return t.payee}async function R(t,e,{rawPayeeName:r}={}){let n=new Map,i=[];for(let o of t){if(null==o.date)throw new Error("`date` is required when adding a transaction");let t=o,a=t.payee_name,s=t.subtransactions;if(o=_(t,m),a){let t=a.trim();a=""===t?null:r?t:d()(t)}o.imported_payee=o.imported_payee||a,o.imported_payee&&(o.imported_payee=o.imported_payee.trim()),o.account=e,o.payee=await I(o,a,n),i.push({payee_name:a,subtransactions:s?s.map(t=>b(b({},t),{},{account:e})):null,trans:o})}return{normalized:i,payeesToCreate:n}}async function D(t,e){let r=new Set(e.map(t=>t.payee));await Object(c.c)(async()=>{for(let e of t.values())r.has(e.id)&&await a.insertPayee(e)})}async function k(t,e){const r=new Set,i=[],s=[];let u=await R(e,t),c=u.normalized,l=u.payeesToCreate,f=[];for(let e of c){let i=e.payee_name,o=e.trans,s=e.subtransactions;o=Object(h.k)(o);let u=null,c=null;o.imported_id&&(u=await a.first("SELECT * FROM v_transactions WHERE imported_id = ? AND account = ?",[o.imported_id,t]),u&&r.add(u.id)),u||(c=await a.all("SELECT id, date, imported_id, payee, category, notes FROM v_transactions\n WHERE date >= ? AND date <= ? AND amount = ? AND account = ? AND is_child = 0",[a.toDateRepr(n.q(o.date,4)),a.toDateRepr(n.a(o.date,1)),o.amount||0,t])),f.push({payee_name:i,trans:o,subtransactions:s,match:u,fuzzyDataset:c})}let d=f.map(t=>{if(!t.match&&t.fuzzyDataset){let e=t.fuzzyDataset.find(e=>!r.has(e.id)&&t.trans.payee===e.payee);if(e)return r.add(e.id),b(b({},t),{},{match:e})}return t}).map(t=>{if(!t.match&&t.fuzzyDataset){let e=t.fuzzyDataset.find(t=>!r.has(t.id));if(e)return r.add(e.id),b(b({},t),{},{match:e})}return t});for(let t of d){t.payee_name;let e=t.trans,r=t.subtransactions,n=t.match;if(n){let t=b(b({},n),{},{cleared:1===n.cleared,date:a.fromDateRepr(n.date)});const r={date:e.date,imported_id:e.imported_id||null,payee:t.payee||e.payee||null,category:t.category||e.category||null,imported_payee:e.imported_payee||null,notes:t.notes||e.notes||null,cleared:null==e.cleared||e.cleared};Object(o.j)(t,r,Object.keys(r))&&i.push(b({id:t.id},r))}else{let t=b(b({},e),{},{id:E.v4Sync(),category:e.category||null,cleared:null==e.cleared||e.cleared});r&&r.length>0?s.push(...O(t,r)):s.push(t)}}return await D(l,[...s,...i]),await Object(g.a)({added:s,updated:i}),{added:s.map(t=>t.id),updated:i.map(t=>t.id)}}async function N(t,e,{runTransfers:r=!0}={}){const n=[];let i,o=await R(e,t,{rawPayeeName:!0}),s=o.normalized,u=o.payeesToCreate;for(let e of s){e.payee_name;let r=e.trans,i=e.subtransactions;r=Object(h.k)(r);let o=b(b({id:E.v4Sync()},r),{},{account:t,cleared:null==r.cleared||r.cleared});i&&i.length>0?n.push(...O(o,i)):n.push(o)}if(await D(u,n),r){let t=await Object(g.a)({added:n});i=t.added.map(t=>t.id)}else await Object(c.c)(async()=>{i=await Promise.all(n.map(async t=>a.insertTransaction(t)))});return i}async function C(t,e,r,i,u){const c=await a.first("SELECT * FROM v_transactions WHERE account = ? ORDER BY date DESC LIMIT 1",[r]);if(c){const l=await a.first("SELECT date FROM v_transactions WHERE account = ? ORDER BY date ASC LIMIT 1",[r]),f=a.fromDateRepr(l.date);let d=n.q(a.fromDateRepr(c.date),31);d<f&&(d=f);let h=await j(t,e,i,u,d),g=h.transactions,p=h.accountBalance;return 0===g.length?{added:[],updated:[]}:(g=g.map(t=>b(b({},t),{},{account:r})),Object(s.runMutator)(async()=>{const t=await k(r,g);return await async function(t,e){await a.runQuery("UPDATE accounts SET balance_current = ? WHERE id = ?",[Object(o.a)(e),t])}(r,p),t}))}{const o=await a.select("accounts",r),c=n.q(n.d(),0===o.offbudget?1:30),f=(await j(t,e,i,u,v.format(v.parseISO(c),"yyyy-MM-dd"))).transactions;let d=o.balance_current;const h=f.reduce((t,e)=>t-e.amount,d),g=f.length>0?f[f.length-1].date:n.d();let p=await Object(l.a)();return Object(s.runMutator)(async()=>{let t=await a.insertTransaction({account:r,amount:h,category:0===o.offbudget?p.category:null,payee:p.id,date:g,cleared:!0,starting_balance_flag:!0}),e=await k(r,f);return b(b({},e),{},{added:[t,...e.added]})})}}},function(t,e,r){"use strict";r.d(e,"d",(function(){return u})),r.d(e,"b",(function(){return c})),r.d(e,"e",(function(){return l})),r.d(e,"a",(function(){return f})),r.d(e,"c",(function(){return d}));var n=r(2),i=r(27);function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function s(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t,e,r){let i=n.d();return e?"completed":r?"paid":t===i?"due":t>i&&t<=n.a(i,7)?"upcoming":t<i?"missed":"scheduled"}function c(t){let e=t.map(t=>{let e=t._conditions.find(t=>"date"===t.field);return{$and:{schedule:t.id,date:{$gte:e&&"is"===e.op?t.next_date:n.q(t.next_date,2)}}}});return Object(i.b)("transactions").filter({$or:e}).orderBy({date:"desc"}).groupBy("schedule").select(["schedule","date"])}function l(t){let e={start:n.l(t.start),frequency:t.frequency.toUpperCase(),byHourOfDay:[12]};t.interval&&(e.interval=t.interval);let r=t=>t.slice(0,2).toUpperCase();switch(t.frequency){case"weekly":return[e];case"monthly":if(t.patterns&&t.patterns.length>0){let n=t.patterns.filter(t=>"day"===t.type),i=t.patterns.filter(t=>"day"!==t.type);return[n.length>0&&a(a({},e),{},{byDayOfMonth:n.map(t=>t.value)}),i.length>0&&a(a({},e),{},{byDayOfWeek:i.map(t=>[r(t.type),t.value])})].filter(Boolean)}return[e];case"yearly":return[e];default:throw new Error("Invalid recurring date config")}}function f(t){return{payee:t.find(t=>"is"===t.op&&"payee"===t.field)||t.find(t=>"is"===t.op&&"description"===t.field)||null,account:t.find(t=>"is"===t.op&&"account"===t.field)||t.find(t=>"is"===t.op&&"acct"===t.field)||null,amount:t.find(t=>("is"===t.op||"isapprox"===t.op||"isbetween"===t.op)&&"amount"===t.field)||null,date:t.find(t=>("is"===t.op||"isapprox"===t.op)&&"date"===t.field)||null}}function d(t){return t&&"number"!=typeof t?(t.num1+t.num2)/2|0:t}},function(t,e,r){"use strict";e.a={isMobile:!1,isWeb:!0,isDesktop:!1}},function(t,e,r){const n=r(80);t.exports={v4:function(){return Promise.resolve(n.v4())},v4Sync:function(){return n.v4()}}},function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=r,r.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},function(t,e,r){"use strict";var n=e,i=r(35),o=r(42),a=r(217);n.assert=o,n.toArray=a.toArray,n.zero2=a.zero2,n.toHex=a.toHex,n.encode=a.encode,n.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<<e+1,o=t.clone(),a=0;a<n.length;a++){var s,u=o.andln(i-1);o.isOdd()?(s=u>(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==c?u:-u,r[0].push(a),s=0==(1&c)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?c:-c,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},function(t,e){},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(26),i=r(72);function o(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(i.a)(t),o=Object(i.a)(e),a=r.getTime()-Object(n.a)(r),s=o.getTime()-Object(n.a)(o);return Math.round((a-s)/864e5)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(3),i=r(0);function o(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(i.a)(t),o=Object(n.a)(e);return r.setDate(r.getDate()+o),r}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(3),i=r(53);function o(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(n.a)(e);return Object(i.a)(t,-r)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(3),i=r(0);function o(t,e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var r=e||{},o=r.locale,a=o&&o.options&&o.options.weekStartsOn,s=null==a?0:Object(n.a)(a),u=null==r.weekStartsOn?s:Object(n.a)(r.weekStartsOn);if(!(u>=0&&u<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var c=Object(i.a)(t),l=c.getUTCDay(),f=(l<u?7:0)+l-u;return c.setUTCDate(c.getUTCDate()-f),c.setUTCHours(0,0,0,0),c}},function(t,e,r){const n=r(6),i=n.runHandler,o=n.isMutating,a=(r(90).sequential,r(25).captureException);function s(){let t="undefined"!=typeof window?window:"undefined"!=typeof self?self:null;if(!t)throw new Error("Cannot get global object");return t}function u(t,e){s().__globalServerChannel&&s().__globalServerChannel.postMessage({type:"push",name:t,args:e})}s().__globalServerChannel=null,t.exports={init:function(t,e){s().__globalServerChannel=t,t.addEventListener("message",r=>{let n=r.data,s="string"==typeof n?JSON.parse(n):n;if(s.type&&("init"===s.type||s.type.startsWith("__")))return;let c=s.id,l=s.name,f=s.args,d=s.undoTag,h=s.catchErrors;e[l]?i(e[l],f,{undoTag:d,name:l}).then(r=>{h&&(r={data:r,error:null}),t.postMessage({type:"reply",id:c,result:r,mutated:o(e[l]),undoTag:d})},e=>{let r=function(t){return t.type&&"APIError"===t.type?t:{type:"InternalError",message:t.message}}(e);l.startsWith("api/")?t.postMessage({type:"reply",id:c,error:r}):h?t.postMessage({type:"reply",id:c,result:{error:r,data:null}}):t.postMessage({type:"error",id:c}),"InternalError"===r.type&&a(e),h||u("server-error")}):(console.warn("Unknown method: "+l),t.postMessage({type:"reply",id:c,result:null,error:{type:"APIError",message:"Unknown method: "+l}}))},!1),t.postMessage({type:"connect"})},send:u,getNumClients:function(){return 1},tapIntoAPI:function(){}}},function(t,e,r){(function(t){function r(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n<t.length;n++)e(t[n],n,t)&&r.push(t[n]);return r}e.resolve=function(){for(var e="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var a=o>=0?arguments[o]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(e=a+"/"+e,i="/"===a.charAt(0))}return(i?"/":"")+(e=r(n(e.split("/"),(function(t){return!!t})),!i).join("/"))||"."},e.normalize=function(t){var o=e.isAbsolute(t),a="/"===i(t,-1);return(t=r(n(t.split("/"),(function(t){return!!t})),!o).join("/"))||o||(t="."),t&&a&&(t+="/"),(o?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(n(t,(function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))},e.relative=function(t,r){function n(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;r>=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=e.resolve(t).substr(1),r=e.resolve(r).substr(1);for(var i=n(t.split("/")),o=n(r.split("/")),a=Math.min(i.length,o.length),s=a,u=0;u<a;u++)if(i[u]!==o[u]){s=u;break}var c=[];for(u=s;u<i.length;u++)c.push("..");return(c=c.concat(o.slice(s))).join("/")},e.sep="/",e.delimiter=":",e.dirname=function(t){if("string"!=typeof t&&(t+=""),0===t.length)return".";for(var e=t.charCodeAt(0),r=47===e,n=-1,i=!0,o=t.length-1;o>=1;--o)if(47===(e=t.charCodeAt(o))){if(!i){n=o;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"/":t.slice(0,n)},e.basename=function(t,e){var r=function(t){"string"!=typeof t&&(t+="");var e,r=0,n=-1,i=!0;for(e=t.length-1;e>=0;--e)if(47===t.charCodeAt(e)){if(!i){r=e+1;break}}else-1===n&&(i=!1,n=e+1);return-1===n?"":t.slice(r,n)}(t);return e&&r.substr(-1*e.length)===e&&(r=r.substr(0,r.length-e.length)),r},e.extname=function(t){"string"!=typeof t&&(t+="");for(var e=-1,r=0,n=-1,i=!0,o=0,a=t.length-1;a>=0;--a){var s=t.charCodeAt(a);if(47!==s)-1===n&&(i=!1,n=a+1),46===s?-1===e?e=a:1!==o&&(o=1):-1!==e&&(o=-1);else if(!i){r=a+1;break}}return-1===e||-1===n||0===o||1===o&&e===n-1&&e===r+1?"":t.slice(e,n)};var i="b"==="ab".substr(-1)?function(t,e,r){return t.substr(e,r)}:function(t,e,r){return e<0&&(e=t.length+e),t.substr(e,r)}}).call(this,r(20))},function(t,e,r){"use strict";var n=r(42),i=r(11);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function a(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function s(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(var n=0,i=0;i<t.length;i++){var a=t.charCodeAt(i);a<128?r[n++]=a:a<2048?(r[n++]=a>>6|192,r[n++]=63&a|128):o(t,i)?(a=65536+((1023&a)<<10)+(1023&t.charCodeAt(++i)),r[n++]=a>>18|240,r[n++]=a>>12&63|128,r[n++]=a>>6&63|128,r[n++]=63&a|128):(r[n++]=a>>12|224,r[n++]=a>>6&63|128,r[n++]=63&a|128)}else for(i=0;i<t.length;i++)r[i]=0|t[i];return r},e.toHex=function(t){for(var e="",r=0;r<t.length;r++)e+=s(t[r].toString(16));return e},e.htonl=a,e.toHex32=function(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];"little"===e&&(i=a(i)),r+=u(i.toString(16))}return r},e.zero2=s,e.zero8=u,e.join32=function(t,e,r,i){var o=r-e;n(o%4==0);for(var a=new Array(o/4),s=0,u=e;s<a.length;s++,u+=4){var c;c="big"===i?t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]:t[u+3]<<24|t[u+2]<<16|t[u+1]<<8|t[u],a[s]=c>>>0}return a},e.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];"big"===e?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<<e|t>>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},e.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},e.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,a=(o<n?1:0)+r+i;t[e]=a>>>0,t[e+1]=o},e.sum64_hi=function(t,e,r,n){return(e+n>>>0<e?1:0)+t+r>>>0},e.sum64_lo=function(t,e,r,n){return e+n>>>0},e.sum64_4_hi=function(t,e,r,n,i,o,a,s){var u=0,c=e;return u+=(c=c+n>>>0)<e?1:0,u+=(c=c+o>>>0)<o?1:0,t+r+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},e.sum64_4_lo=function(t,e,r,n,i,o,a,s){return e+n+o+s>>>0},e.sum64_5_hi=function(t,e,r,n,i,o,a,s,u,c){var l=0,f=e;return l+=(f=f+n>>>0)<e?1:0,l+=(f=f+o>>>0)<o?1:0,l+=(f=f+s>>>0)<s?1:0,t+r+i+a+u+(l+=(f=f+c>>>0)<c?1:0)>>>0},e.sum64_5_lo=function(t,e,r,n,i,o,a,s,u,c){return e+n+o+s+c>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},function(t,e,r){"use strict";var n=r(77),i=r(117),o=i(n("String.prototype.indexOf"));t.exports=function(t,e){var r=n(t,!!e);return"function"==typeof r&&o(t,".prototype.")>-1?i(r):r}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(3),i=r(0);function o(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(i.a)(t).getTime(),o=Object(n.a)(e);return new Date(r+o)}},function(t,e){function r(t,e){return t+"!"+e}t.exports={unresolveName:function(t){let e=t.indexOf("!");return-1!==e?{sheet:t.slice(0,e),name:t.slice(e+1)}:{sheet:null,name:t}},resolveName:r,resolveNamesAsObjects:function(t){const e={};return Object.keys(t).forEach(n=>{const i=t[n];Object.keys(i).forEach(t=>{const o=i[t];e[r(n,t)]=o})}),e},resolveNamesAsArrays:function(t){const e=[];return Object.keys(t).forEach(n=>{const i=t[n];i.forEach(t=>{i[t];e.push(r(n,t))})}),e}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(3),i=r(0),o=r(88);function a(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(i.a)(t),a=Object(n.a)(e),s=r.getMonth()+a,u=new Date(0);u.setFullYear(r.getFullYear(),s,1),u.setHours(0,0,0,0);var c=Object(o.a)(u);return r.setMonth(s,Math.min(c,r.getDate())),r}},function(t,e,r){"use strict";r.d(e,"a",(function(){return u}));var n=r(128),i=r(25);function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}class s{constructor(){this.handlers={},this.services=[],this.events=Object(n.a)(),this.unlistenServices=[]}method(t,e){if(null!=this.handlers[t])throw new Error("Conflicting method name, names must be globally unique: "+t);this.handlers[t]=e}service(t){this.services.push(t)}combine(...t){for(let r of t){Object.keys(r.handlers).forEach(t=>{this.method(t,r.handlers[t])}),r.services.forEach(t=>{this.service(t)});for(let t of r.events.all.entries()){var e=o(t,2);let r=e[0],n=e[1];for(let t of n)this.events.on(r,t)}}}startServices(){this.unlistenServices.length>0&&Object(i.captureException)(new Error("App: startServices called while services are already running")),this.unlistenServices=this.services.map(t=>t())}stopServices(){this.unlistenServices.forEach(t=>{t&&t()}),this.unlistenServices=[]}}function u(){return new s}},function(t,e,r){"use strict";var n={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function i(t){return function(e){var r=e||{},n=r.width?String(r.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}var o={date:i({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:i({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:i({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},a={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function s(t){return function(e,r){var n=r||{},i=n.width?String(n.width):t.defaultWidth;return("formatting"===(n.context?String(n.context):"standalone")&&t.formattingValues?t.formattingValues[i]||t.formattingValues[t.defaultFormattingWidth]:t.values[i]||t.values[t.defaultWidth])[t.argumentCallback?t.argumentCallback(e):e]}}function u(t){return function(e,r){var n=String(e),i=r||{},o=i.width,a=o&&t.matchPatterns[o]||t.matchPatterns[t.defaultMatchWidth],s=n.match(a);if(!s)return null;var u,c=s[0],l=o&&t.parsePatterns[o]||t.parsePatterns[t.defaultParseWidth];return u="[object Array]"===Object.prototype.toString.call(l)?l.findIndex((function(t){return t.test(n)})):function(t,e){for(var r in t)if(t.hasOwnProperty(r)&&e(t[r]))return r}(l,(function(t){return t.test(n)})),u=t.valueCallback?t.valueCallback(u):u,{value:u=i.valueCallback?i.valueCallback(u):u,rest:n.slice(c.length)}}}var c,l={formatDistance:function(t,e,r){var i;return r=r||{},i="string"==typeof n[t]?n[t]:1===e?n[t].one:n[t].other.replace("{{count}}",e),r.addSuffix?r.comparison>0?"in "+i:i+" ago":i},formatLong:o,formatRelative:function(t,e,r,n){return a[t]},localize:{ordinalNumber:function(t,e){var r=Number(t),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},era:s({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:s({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(t){return Number(t)-1}}),month:s({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:s({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:s({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(c={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(t){return parseInt(t,10)}},function(t,e){var r=String(t),n=e||{},i=r.match(c.matchPattern);if(!i)return null;var o=i[0],a=r.match(c.parsePattern);if(!a)return null;var s=c.valueCallback?c.valueCallback(a[0]):a[0];return{value:s=n.valueCallback?n.valueCallback(s):s,rest:r.slice(o.length)}}),era:u({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:u({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:u({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:u({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:u({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};e.a=l},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(0);function i(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=1,r=Object(n.a)(t),i=r.getUTCDay(),o=(i<e?7:0)+i-e;return r.setUTCDate(r.getUTCDate()-o),r.setUTCHours(0,0,0,0),r}},function(t,e,r){"use strict";r.d(e,"d",(function(){return A})),r.d(e,"b",(function(){return M})),r.d(e,"a",(function(){return I})),r.d(e,"c",(function(){return R}));var n=r(2),i=r(15),o=r(1),a=r(5),s=r(54),u=r(32),c=r(120);function l(...t){return t.reduce((t,e)=>t+Object(c.number)(e),0)}const f=r(54).resolveName;const d=r(54).resolveName;function h(t){let e=n.m(t[0]);return n.p(e,"rollover")}function g(t,e){if(e.length>0){let r=h(e);a.b().createStatic(r,"carryover-"+t.id,!1),a.b().createStatic(r,"leftover-"+t.id,0),a.b().createStatic(r,"leftover-pos-"+t.id,0)}}function p(t,e,r){let n=h(r);t.blankSheet!==n&&(a.b().clearSheet(t.blankSheet),function(t,e,r){a.b().createStatic(e,"is-blank",!0),a.b().createStatic(e,"to-budget",0),a.b().createStatic(e,"buffered",0),t.forEach(t=>g(t,r))}(e,n,r),t.blankSheet=n)}function m(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return y(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return y(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function b(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function w(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?b(Object(r),!0).forEach((function(e){_(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function _(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function v(){return a.b().meta().budgetType||"rollover"}function E(t,e,r,n,i){a.b().createDynamic(e,"sum-amount-"+t.id,{initialValue:0,run:()=>{let e=o.runQuery(`SELECT SUM(amount) as amount FROM v_transactions_internal_alive t\n LEFT JOIN accounts a ON a.id = t.account\n WHERE t.date >= ${n} AND t.date <= ${i}\n AND category = '${t.id}' AND a.offbudget = 0`,[],!0)[0];return(e?e.amount:0)||0}}),"rollover"===v()?function(t,e,r){t.is_income||(a.b().createStatic(e,"budget-"+t.id,0),null==a.b().getCellValue(e,"budget-"+t.id)&&a.b().set(d(e,"budget-"+t.id),0),a.b().createStatic(e,"carryover-"+t.id,!1),a.b().createDynamic(e,"leftover-"+t.id,{initialValue:0,dependencies:["budget-"+t.id,"sum-amount-"+t.id,`${r}!carryover-${t.id}`,`${r}!leftover-${t.id}`,`${r}!leftover-pos-${t.id}`],run:(t,e,r,n,i)=>Object(c.number)(t)+Object(c.number)(e)+(r?Object(c.number)(n):Object(c.number)(i))}),a.b().createDynamic(e,"leftover-pos-"+t.id,{initialValue:0,dependencies:["leftover-"+t.id],run:t=>t<0?0:t}))}(t,e,r):async function(t,e,r){a.b().createStatic(e,"budget-"+t.id,0),null==a.b().getCellValue(e,"budget-"+t.id)&&a.b().set(f(e,"budget-"+t.id),0),a.b().createDynamic(e,"leftover-"+t.id,{initialValue:0,dependencies:["budget-"+t.id,"sum-amount-"+t.id,`${r}!carryover-${t.id}`,`${r}!leftover-${t.id}`],run:(e,r,n,i)=>t.is_income?Object(c.number)(e)-Object(c.number)(r)+(n?Object(c.number)(i):0):Object(c.number)(e)+Object(c.number)(r)+(n?Object(c.number)(i):0)}),a.b().createDynamic(e,"spent-with-carryover-"+t.id,{initialValue:0,dependencies:["budget-"+t.id,"sum-amount-"+t.id,"carryover-"+t.id],refresh:!0,run:(t,e,r)=>r?Math.max(0,Object(c.number)(t)+Object(c.number)(e)):e}),a.b().createStatic(e,"carryover-"+t.id,!1)}(t,e,r)}function S(t,e){a.b().createDynamic(e,"group-sum-amount-"+t.id,{initialValue:0,dependencies:t.categories.map(t=>"sum-amount-"+t.id),run:l}),t.is_income&&"rollover"===v()||(a.b().createDynamic(e,"group-budget-"+t.id,{initialValue:0,dependencies:t.categories.map(t=>"budget-"+t.id),run:l}),a.b().createDynamic(e,"group-leftover-"+t.id,{initialValue:0,dependencies:t.categories.map(t=>"leftover-"+t.id),run:l}))}function O(t,e){if((e.has("date")||e.has("acct")||e.has("amount")||e.has("category")||e.has("tombstone")||e.has("isParent"))&&t.date&&t.category){let e=n.k(o.fromDateRepr(t.date)),r=n.p(e,v());a.b().recompute(Object(s.resolveName)(r,"sum-amount-"+t.category))}}function T(t,e,r){let i=v();if(1===r.tombstone&&e&&0===e.tombstone){let e=r.id;t.forEach(t=>{!function(t,e){a.b().removeDependencies(t,"total-budgeted",["group-budget-"+e]),a.b().removeDependencies(t,"total-spent",["group-sum-amount-"+e]),a.b().removeDependencies(t,"total-leftover",["group-leftover-"+e])}(n.p(t,i),e)})}else if(0===r.tombstone&&(!e||1===e.tombstone)){let e=r;e.is_income&&"rollover"===i||t.forEach(t=>{let r=n.p(t,i),s=o.runQuery("SELECT * FROM categories WHERE tombstone = 0 AND cat_group = ?",[e.id],!0);S(w(w({},e),{},{categories:s}),r),function(t,e){a.b().addDependencies(t,"total-budgeted",["group-budget-"+e]),a.b().addDependencies(t,"total-spent",["group-sum-amount-"+e]),a.b().addDependencies(t,"total-leftover",["group-leftover-"+e])}(r,e.id)})}}function A(t,e){let r=a.b().meta().createdMonths,u=void 0===r?new Set:r;a.h();try{e.forEach((e,r)=>{let c=t.get(r);e.forEach(t=>{let e=c&&c.get(t.id);if("zero_budget_months"===r)!function(t){let e=n.p(t.id);a.b().set(e+"!buffered",t.buffered)}(t);else if("zero_budgets"===r||"reflect_budgets"===r)!function(t){if(t.category){let e=n.p(t.month.toString());a.b().set(`${e}!budget-${t.category}`,t.amount||0),a.b().set(`${e}!carryover-${t.category}`,1===t.carryover)}}(t);else if("transactions"===r){let r=new Set(Object.keys(Object(i.f)(e||{},t)||{}));e&&O(e,r),O(t,r)}else"category_mapping"===r?function(t,e,r){t.forEach(t=>{let i=n.p(t,v());e&&a.b().recompute(Object(s.resolveName)(i,"sum-amount-"+e.transferId)),a.b().recompute(Object(s.resolveName)(i,"sum-amount-"+r.transferId))})}(u,e,t):"categories"===r?function(t,e,r){function i(t,e,r){a.b().addDependencies(t,"group-sum-amount-"+e,["sum-amount-"+r]),a.b().addDependencies(t,"group-budget-"+e,["budget-"+r]),a.b().addDependencies(t,"group-leftover-"+e,["leftover-"+r])}function o(t,e,r){a.b().removeDependencies(t,"group-sum-amount-"+e,["sum-amount-"+r]),a.b().removeDependencies(t,"group-budget-"+e,["budget-"+r]),a.b().removeDependencies(t,"group-leftover-"+e,["leftover-"+r])}let s=v();if(e&&0===e.tombstone&&1===r.tombstone){let e=r.id,i=r.cat_group;t.forEach(t=>{o(n.p(t),i,e)})}else if(0!==r.tombstone||e&&1!==e.tombstone){if(e&&e.cat_group!==r.cat_group){let a=r.id;t.forEach(t=>{let u=n.p(t,s);o(u,e.cat_group,a),i(u,r.cat_group,a)})}}else"rollover"===s&&g(r,t),t.forEach(t=>{let e=n.m(t),o=n.p(e,s),u=n.p(t,s),c=n.c(t),l=c.start,f=c.end;E(r,u,o,l,f);let d=r.id,h=r.cat_group;"rollover"===v()&&a.b().addDependencies(u,"last-month-overspent",[`${o}!leftover-${d}`,`${o}!carryover-${d}`]),i(u,h,d)})}(u,e,t):"category_groups"===r?T(u,e,t):"accounts"===r&&function(t,e,r){if(!e||e.offbudget!==r.offbudget){let e=o.runQuery("\n SELECT DISTINCT(category) as category FROM transactions\n WHERE acct = ?\n ",[r.id],!0);t.forEach(t=>{let r=n.p(t,v());e.forEach(t=>{a.b().recompute(Object(s.resolveName)(r,"sum-amount-"+t.category))})})}}(u,e,t)})})}finally{a.a()}}async function M(t,e){[...a.b().meta().createdMonths].forEach(r=>{let n=t.map(t=>u.c({month:r,category:t})).reduce((t,e)=>t+e,0),i=u.c({month:r,category:e});u.i({month:r,category:e,amount:n+i})})}async function j(t){const e=await o.getCategories(),r=await o.getCategoriesGrouped();a.h();let i=a.b().meta();i.createdMonths=i.createdMonths||new Set;let s=v();"rollover"===s&&p(i,e,t),t.forEach(t=>{if(!i.createdMonths.has(t)){let o=n.m(t),u=n.c(t),f=u.start,d=u.end,h=n.p(t,s),g=n.p(o,s);e.forEach(t=>{E(t,h,g,f,d)}),r.forEach(t=>{S(t,h)}),"rollover"===s?function(t,e,r,n){let i=t.filter(t=>t.is_income)[0],o=e.filter(t=>!t.is_income);var s;a.b().createStatic(n,"buffered",0),a.b().createDynamic(n,"from-last-month",{initialValue:0,dependencies:[r+"!to-budget",r+"!buffered"],run:(t,e)=>Object(c.number)(t)+Object(c.number)(e)}),a.b().createDynamic(n,"total-income",{initialValue:0,dependencies:["group-sum-amount-"+i.id],run:t=>t}),a.b().createDynamic(n,"available-funds",{initialValue:0,dependencies:["total-income","from-last-month"],run:(t,e)=>Object(c.number)(t)+Object(c.number)(e)}),a.b().createDynamic(n,"last-month-overspent",{initialValue:0,dependencies:(s=o.map(t=>[`${r}!leftover-${t.id}`,`${r}!carryover-${t.id}`]),Array.prototype.concat.apply([],s)),run:(...t)=>(t=function(t){let e=[];for(let r=0;r<t.length;r+=2)e.push([t[r],t[r+1]]);return e}(t)).reduce((t,[e,r])=>r?t:t+Math.min(0,Object(c.number)(e)),0)}),a.b().createDynamic(n,"total-budgeted",{initialValue:0,dependencies:t.filter(t=>!t.is_income).map(t=>"group-budget-"+t.id),run:(...t)=>-l(...t)}),a.b().createDynamic(n,"buffered",{initialValue:0}),a.b().createDynamic(n,"to-budget",{initialValue:0,dependencies:["available-funds","last-month-overspent","total-budgeted","buffered"],run:(t,e,r,n)=>Object(c.number)(t)+Object(c.number)(e)+Object(c.number)(r)-Object(c.number)(n)}),a.b().createDynamic(n,"total-spent",{initialValue:0,dependencies:t.filter(t=>!t.is_income).map(t=>"group-sum-amount-"+t.id),run:l}),a.b().createDynamic(n,"total-leftover",{initialValue:0,dependencies:t.filter(t=>!t.is_income).map(t=>"group-leftover-"+t.id),run:l})}(r,e,g,h):function(t,e,r){let n=t.filter(t=>t.is_income)[0],i=e.filter(t=>!t.is_income);a.b().createDynamic(r,"total-budgeted",{initialValue:0,dependencies:t.filter(t=>!t.is_income).map(t=>"group-budget-"+t.id),run:l}),a.b().createDynamic(r,"total-spent",{initialValue:0,refresh:!0,dependencies:i.map(t=>`${r}!spent-with-carryover-${t.id}`),run:l}),a.b().createDynamic(r,"total-income",{initialValue:0,dependencies:["group-sum-amount-"+n.id],run:t=>t}),a.b().createDynamic(r,"total-leftover",{initialValue:0,dependencies:["total-budgeted","total-spent"],run:l}),a.b().createDynamic(r,"total-budget-income",{initialValue:0,dependencies:["group-budget-"+n.id],run:t=>t}),a.b().createDynamic(r,"total-saved",{initialValue:0,dependencies:["total-budget-income","total-budgeted"],run:(t,e)=>t-e}),a.b().createDynamic(r,"real-saved",{initialValue:0,dependencies:["total-income","total-spent"],run:(t,e)=>t- -e})}(r,e,h),i.createdMonths.add(t)}}),a.b().setMeta(i),a.a(),await a.j()}async function I(){let t=await o.first("SELECT * FROM transactions WHERE isChild=0 AND date IS NOT NULL ORDER BY date ASC LIMIT 1"),e=t&&o.fromDateRepr(t.date),r=n.e(),i=function(t,e){return(t=n.h(t))>(e=n.h(e))&&(t=e),{start:t=n.r(t,3),end:e=n.b(e,12),range:n.o(t,e)}}(e||r,r),s=i.start,u=i.end,c=i.range,l=a.b().meta().createdMonths||new Set;return c.filter(t=>!l.has(t)).length>0&&await j(c),{start:s,end:u}}async function R(t){let e=a.b().meta();if(t===e.budgetType)return;e.budgetType=t,e.createdMonths=new Set;let r=a.b().getNodes();o.transaction(()=>{for(let t of r.keys()){let e=m(t.split("!"),2),r=e[0],n=e[1];r.match(/^budget\d+/)&&a.b().deleteCell(r,n)}}),a.b().startCacheBarrier(),a.f(o);let n=await I();return a.b().endCacheBarrier(),n}},function(t,e,r){"use strict";var n=r(23),i={y:function(t,e){var r=t.getUTCFullYear(),i=r>0?r:1-r;return Object(n.a)("yy"===e?i%100:i,e.length)},M:function(t,e){var r=t.getUTCMonth();return"M"===e?String(r+1):Object(n.a)(r+1,2)},d:function(t,e){return Object(n.a)(t.getUTCDate(),e.length)},a:function(t,e){var r=t.getUTCHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":case"aaa":return r.toUpperCase();case"aaaaa":return r[0];case"aaaa":default:return"am"===r?"a.m.":"p.m."}},h:function(t,e){return Object(n.a)(t.getUTCHours()%12||12,e.length)},H:function(t,e){return Object(n.a)(t.getUTCHours(),e.length)},m:function(t,e){return Object(n.a)(t.getUTCMinutes(),e.length)},s:function(t,e){return Object(n.a)(t.getUTCSeconds(),e.length)}};e.a=i},function(t,e,r){"use strict";var n,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(r,n){function i(r){t.removeListener(e,o),n(r)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),r([].slice.call(arguments))}y(t,e,o,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&y(t,"error",e,r)}(t,i,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function c(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function l(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function f(t,e,r,n){var i,o,a,s;if(c(r),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),a=o[e]),void 0===a)a=o[e]=r,++t._eventsCount;else if("function"==typeof a?a=o[e]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=l(t))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return t}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=d.bind(n);return i.listener=r,n.wrapFn=i,i}function g(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(i):m(i,i.length)}function p(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function m(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function y(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(o){n.once&&t.removeEventListener(e,i),r(o)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");u=t}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var a;if(e.length>0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)o(u,this,e);else{var c=u.length,l=m(u,c);for(r=0;r<c;++r)o(l[r],this,e)}return!0},s.prototype.addListener=function(t,e){return f(this,t,e,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(t,e){return f(this,t,e,!0)},s.prototype.once=function(t,e){return c(e),this.on(t,h(this,t,e)),this},s.prototype.prependOnceListener=function(t,e){return c(e),this.prependListener(t,h(this,t,e)),this},s.prototype.removeListener=function(t,e){var r,n,i,o,a;if(c(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===e||r[o].listener===e){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,a||e)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},s.prototype.listeners=function(t){return g(this,t,!0)},s.prototype.rawListeners=function(t){return g(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(0);function i(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(n.a)(t);return e.setDate(1),e.setHours(0,0,0,0),e}},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(0);function i(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(n.a)(t);return!isNaN(e)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return m}));var n=r(1),i=r(106),o=r(8),a=r(22);function s(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function u(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}async function c(t){if(t.payee){let e=await n.first("SELECT id, transfer_acct FROM v_payees WHERE id = ?",[t.payee]),r=e.transfer_acct;e.id;return r}return null}async function l(t,e){return(await n.first("SELECT offbudget FROM accounts WHERE id = ?",[t.account])).offbudget===(await n.first("SELECT offbudget FROM accounts WHERE id = ?",[e])).offbudget&&(await n.updateTransaction({id:t.id,category:null}),!0)}async function f(t,e){let r=(await n.first("SELECT id FROM payees WHERE transfer_acct = ?",[t.account])).id;if(t.parent_id){let e=await n.first("\n SELECT p.id, p.transfer_acct FROM v_transactions t\n LEFT JOIN payees p ON p.id = t.payee\n WHERE t.id = ?\n ",[t.parent_id]);if(e.transfer_acct)return e.id!==t.payee?(await n.updateTransaction({id:t.id,payee:null}),{id:t.id,payee:null}):null}const i=await n.insertTransaction({account:e,amount:-t.amount,payee:r,date:t.date,transfer_id:t.id,notes:t.notes||null,cleared:!1});await n.updateTransaction({id:t.id,transfer_id:i});const o=await l(t,e);return function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?s(Object(r),!0).forEach((function(e){u(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({id:t.id,transfer_id:i},o?{category:null}:{})}async function d(t){return(await n.getTransaction(t.transfer_id)).is_child?await n.updateTransaction({id:t.transfer_id,transfer_id:null,payee:null}):await n.deleteTransaction({id:t.transfer_id}),await n.updateTransaction({id:t.id,transfer_id:null}),{id:t.id,transfer_id:null}}async function h(t,e){let r=await async function(t){return n.first("SELECT * FROM payees WHERE transfer_acct = ?",[t])}(t.account);await n.updateTransaction({id:t.transfer_id,account:e,payee:r.id,date:t.date,notes:t.notes,amount:-t.amount});if(await l(t,e))return{id:t.id,category:null}}const g=r(49);async function p(t){return Object(i.a)((t,e)=>n.selectWithSchema("transactions",t,e),t,t=>`id = '${t}'`,t=>"SELECT * FROM v_transactions_internal WHERE "+t)}async function m({added:t,deleted:e,updated:r,learnCategories:s=!1,detectOrphanPayees:u=!0}){let l=[],m=r?r.map(t=>t.id):[],y=e?await async function(t){let e=Object(i.b)(t,"parent_id"),r=await n.all("SELECT id FROM v_transactions_internal WHERE "+e),o=new Set(t);for(let t of r)o.add(t.id);return[...o]}(e.map(t=>t.id)):[],b=new Set,w=await n.all("SELECT * FROM accounts WHERE tombstone = 0");if(r){let t=r.filter(t=>t.payee).map(t=>t.id),e=await p(t);for(let t=0;t<e.length;t++)b.add(e[t].payee)}await Object(o.c)(async()=>{t&&(l=await Promise.all(t.map(async t=>n.insertTransaction(t)))),e&&await Promise.all(y.map(async t=>{await n.deleteTransaction({id:t})})),r&&await Promise.all(r.map(async t=>{if(t.account){1===w.find(e=>e.id===t.account).offbudget&&(t.category=null)}await n.updateTransaction(t)}))});let _,v=await p(l),E=await p(m),S=await p(y),O=v;if(await Object(o.c)(async()=>{await Promise.all(v.map(t=>async function(t){let e=await c(t);if(e)return f(t,e)}(t))),_=(await Promise.all(E.map(t=>async function(t){const e=await c(t);return e&&!t.transfer_id?f(t,e):!e&&t.transfer_id?d(t):e&&t.transfer_id?h(t,e):void 0}(t)))).filter(Boolean),await Promise.all(S.map(t=>async function(t){t.transfer_id&&await d(t)}(t)))}),s){let e=new Set([...t?t.filter(t=>t.category).map(t=>t.id):[],...r?r.filter(t=>t.category).map(t=>t.id):[]]);await a.l(v.concat(E).filter(t=>e.has(t.id)))}if(u&&r){let t=r.map(t=>t.payee).filter(Boolean);if(t.length>0){let e=new Set(await n.getOrphanedPayees()),r=[...b].filter(t=>e.has(t));r.length>0&&g.send("orphaned-payees",{orphanedIds:r,updatedPayeeIds:t})}}return{added:O,updated:_}}},function(t,e,r){"use strict";e.a={info:(...t)=>{console.log(...t)},warn:(...t)=>{console.warn(...t)}}},function(t,e,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var i=r(135),o=r(175),a=r(296),s=r(316),u=s.fsSyncMethods,c=s.fsAsyncMethods,l=r(96),f=l.constants.F_OK,d=l.constants.R_OK,h=l.constants.W_OK,g=l.constants.X_OK;function p(t){for(var e={F_OK:f,R_OK:d,W_OK:h,X_OK:g,constants:l.constants,Stats:i.default,Dirent:o.default},r=0,n=u;r<n.length;r++){"function"==typeof t[m=n[r]]&&(e[m]=t[m].bind(t))}for(var s=0,p=c;s<p.length;s++){var m;"function"==typeof t[m=p[s]]&&(e[m]=t[m].bind(t))}return e.StatWatcher=t.StatWatcher,e.FSWatcher=t.FSWatcher,e.WriteStream=t.WriteStream,e.ReadStream=t.ReadStream,e.promises=t.promises,e._toUnixTimestamp=a.toUnixTimestamp,e}e.Volume=a.Volume,e.vol=new a.Volume,e.createFsFromVolume=p,e.fs=p(e.vol),t.exports=n(n({},t.exports),e.fs),t.exports.semantic=!0},function(t,e,r){"use strict";var n=r(17).Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=c,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=l,this.end=f,e=3;break;default:return this.write=d,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function l(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function d(t){return t.toString(this.encoding)}function h(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},o.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var i=a(e[n]);if(i>=0)return i>0&&(t.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if((i=a(e[n]))>=0)return i>0&&(t.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if((i=a(e[n]))>=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,r){var n=r(17).Buffer,i=r(97).Transform,o=r(67).StringDecoder;function a(t){i.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(11)(a,i),a.prototype.update=function(t,e,r){"string"==typeof t&&(t=n.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){n=t}finally{r(n)}},a.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},a.prototype._finalOrDigest=function(t){var e=this.__final()||n.alloc(0);return t&&(e=this._toString(e,t,!0)),e},a.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n},t.exports=a},function(t,e,r){"use strict";var n=r(116);t.exports=function(){return n()&&!!Symbol.toStringTag}},function(t,e,r){"use strict";r.r(e),r.d(e,"addDays",(function(){return n.a})),r.d(e,"addHours",(function(){return a})),r.d(e,"addISOWeekYears",(function(){return g})),r.d(e,"addMilliseconds",(function(){return o.a})),r.d(e,"addMinutes",(function(){return p})),r.d(e,"addMonths",(function(){return m.a})),r.d(e,"addQuarters",(function(){return y})),r.d(e,"addSeconds",(function(){return b})),r.d(e,"addWeeks",(function(){return w.a})),r.d(e,"addYears",(function(){return _.a})),r.d(e,"areIntervalsOverlapping",(function(){return v})),r.d(e,"closestIndexTo",(function(){return E})),r.d(e,"closestTo",(function(){return S})),r.d(e,"compareAsc",(function(){return O.a})),r.d(e,"compareDesc",(function(){return T})),r.d(e,"differenceInCalendarDays",(function(){return d.a})),r.d(e,"differenceInCalendarISOWeekYears",(function(){return A})),r.d(e,"differenceInCalendarISOWeeks",(function(){return j})),r.d(e,"differenceInCalendarMonths",(function(){return I})),r.d(e,"differenceInCalendarQuarters",(function(){return D})),r.d(e,"differenceInCalendarWeeks",(function(){return k})),r.d(e,"differenceInCalendarYears",(function(){return N})),r.d(e,"differenceInDays",(function(){return C.a})),r.d(e,"differenceInHours",(function(){return L})),r.d(e,"differenceInISOWeekYears",(function(){return B})),r.d(e,"differenceInMilliseconds",(function(){return x})),r.d(e,"differenceInMinutes",(function(){return U})),r.d(e,"differenceInMonths",(function(){return F})),r.d(e,"differenceInQuarters",(function(){return W})),r.d(e,"differenceInSeconds",(function(){return H})),r.d(e,"differenceInWeeks",(function(){return q})),r.d(e,"differenceInYears",(function(){return z})),r.d(e,"eachDayOfInterval",(function(){return V})),r.d(e,"eachWeekOfInterval",(function(){return Y})),r.d(e,"eachWeekendOfInterval",(function(){return K})),r.d(e,"eachWeekendOfMonth",(function(){return X})),r.d(e,"eachWeekendOfYear",(function(){return et})),r.d(e,"endOfDay",(function(){return rt})),r.d(e,"endOfDecade",(function(){return nt})),r.d(e,"endOfHour",(function(){return it})),r.d(e,"endOfISOWeek",(function(){return at})),r.d(e,"endOfISOWeekYear",(function(){return st})),r.d(e,"endOfMinute",(function(){return ut})),r.d(e,"endOfMonth",(function(){return J.a})),r.d(e,"endOfQuarter",(function(){return ct})),r.d(e,"endOfSecond",(function(){return lt})),r.d(e,"endOfWeek",(function(){return ot})),r.d(e,"endOfYear",(function(){return tt})),r.d(e,"format",(function(){return ft.a})),r.d(e,"formatDistance",(function(){return pt})),r.d(e,"formatDistanceStrict",(function(){return mt})),r.d(e,"formatRelative",(function(){return bt})),r.d(e,"fromUnixTime",(function(){return wt})),r.d(e,"getDate",(function(){return _t.a})),r.d(e,"getDay",(function(){return vt})),r.d(e,"getDayOfYear",(function(){return Et})),r.d(e,"getDaysInMonth",(function(){return St.a})),r.d(e,"getDaysInYear",(function(){return Tt})),r.d(e,"getDecade",(function(){return At})),r.d(e,"getHours",(function(){return Mt})),r.d(e,"getISODay",(function(){return jt})),r.d(e,"getISOWeek",(function(){return It})),r.d(e,"getISOWeekYear",(function(){return l})),r.d(e,"getISOWeeksInYear",(function(){return Rt})),r.d(e,"getMilliseconds",(function(){return Dt})),r.d(e,"getMinutes",(function(){return kt})),r.d(e,"getMonth",(function(){return Nt})),r.d(e,"getOverlappingDaysInIntervals",(function(){return Ct})),r.d(e,"getQuarter",(function(){return R})),r.d(e,"getSeconds",(function(){return xt})),r.d(e,"getTime",(function(){return Lt})),r.d(e,"getUnixTime",(function(){return Pt})),r.d(e,"getWeek",(function(){return Ft})),r.d(e,"getWeekOfMonth",(function(){return Wt})),r.d(e,"getWeekYear",(function(){return Bt})),r.d(e,"getWeeksInMonth",(function(){return qt})),r.d(e,"getYear",(function(){return zt})),r.d(e,"isAfter",(function(){return Vt.a})),r.d(e,"isBefore",(function(){return Yt.a})),r.d(e,"isDate",(function(){return Gt})),r.d(e,"isEqual",(function(){return $t})),r.d(e,"isFirstDayOfMonth",(function(){return Kt})),r.d(e,"isFriday",(function(){return Zt})),r.d(e,"isLastDayOfMonth",(function(){return Jt})),r.d(e,"isLeapYear",(function(){return Ot})),r.d(e,"isMonday",(function(){return Xt})),r.d(e,"isSameDay",(function(){return te})),r.d(e,"isSameHour",(function(){return re})),r.d(e,"isSameISOWeek",(function(){return ie})),r.d(e,"isSameISOWeekYear",(function(){return oe})),r.d(e,"isSameMinute",(function(){return se})),r.d(e,"isSameMonth",(function(){return ue})),r.d(e,"isSameQuarter",(function(){return le})),r.d(e,"isSameSecond",(function(){return de})),r.d(e,"isSameWeek",(function(){return ne})),r.d(e,"isSameYear",(function(){return he})),r.d(e,"isSaturday",(function(){return ge})),r.d(e,"isSunday",(function(){return G})),r.d(e,"isThursday",(function(){return pe})),r.d(e,"isTuesday",(function(){return me})),r.d(e,"isValid",(function(){return ye.a})),r.d(e,"isWednesday",(function(){return be})),r.d(e,"isWeekend",(function(){return $})),r.d(e,"isWithinInterval",(function(){return we})),r.d(e,"lastDayOfDecade",(function(){return _e})),r.d(e,"lastDayOfISOWeek",(function(){return Ee})),r.d(e,"lastDayOfISOWeekYear",(function(){return Se})),r.d(e,"lastDayOfMonth",(function(){return Ht})),r.d(e,"lastDayOfQuarter",(function(){return Oe})),r.d(e,"lastDayOfWeek",(function(){return ve})),r.d(e,"lastDayOfYear",(function(){return Te})),r.d(e,"lightFormat",(function(){return Re})),r.d(e,"max",(function(){return ke})),r.d(e,"min",(function(){return Ne})),r.d(e,"parse",(function(){return Ar})),r.d(e,"parseISO",(function(){return Ir.a})),r.d(e,"roundToNearestMinutes",(function(){return Rr})),r.d(e,"setDate",(function(){return Dr})),r.d(e,"setDay",(function(){return kr})),r.d(e,"setDayOfYear",(function(){return Nr})),r.d(e,"setHours",(function(){return Cr})),r.d(e,"setISODay",(function(){return xr})),r.d(e,"setISOWeek",(function(){return Lr})),r.d(e,"setISOWeekYear",(function(){return h})),r.d(e,"setMilliseconds",(function(){return Pr})),r.d(e,"setMinutes",(function(){return Br})),r.d(e,"setMonth",(function(){return Ur})),r.d(e,"setQuarter",(function(){return Fr})),r.d(e,"setSeconds",(function(){return Wr})),r.d(e,"setWeek",(function(){return Hr})),r.d(e,"setWeekYear",(function(){return qr})),r.d(e,"setYear",(function(){return zr})),r.d(e,"startOfDay",(function(){return Qt.a})),r.d(e,"startOfDecade",(function(){return Vr})),r.d(e,"startOfHour",(function(){return ee})),r.d(e,"startOfISOWeek",(function(){return c})),r.d(e,"startOfISOWeekYear",(function(){return f})),r.d(e,"startOfMinute",(function(){return ae})),r.d(e,"startOfMonth",(function(){return Z.a})),r.d(e,"startOfQuarter",(function(){return ce})),r.d(e,"startOfSecond",(function(){return fe})),r.d(e,"startOfWeek",(function(){return u})),r.d(e,"startOfWeekYear",(function(){return Ut})),r.d(e,"startOfYear",(function(){return Q})),r.d(e,"subDays",(function(){return Yr.a})),r.d(e,"subHours",(function(){return Gr})),r.d(e,"subISOWeekYears",(function(){return P})),r.d(e,"subMilliseconds",(function(){return yt.a})),r.d(e,"subMinutes",(function(){return $r})),r.d(e,"subMonths",(function(){return Kr.a})),r.d(e,"subQuarters",(function(){return Zr})),r.d(e,"subSeconds",(function(){return Jr})),r.d(e,"subWeeks",(function(){return Xr.a})),r.d(e,"subYears",(function(){return Qr.a})),r.d(e,"toDate",(function(){return s.a}));var n=r(46),i=r(3),o=r(53);function a(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(i.a)(e);return Object(o.a)(t,36e5*r)}var s=r(0);function u(t,e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var r=e||{},n=r.locale,o=n&&n.options&&n.options.weekStartsOn,a=null==o?0:Object(i.a)(o),u=null==r.weekStartsOn?a:Object(i.a)(r.weekStartsOn);if(!(u>=0&&u<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var c=Object(s.a)(t),l=c.getDay(),f=(l<u?7:0)+l-u;return c.setDate(c.getDate()-f),c.setHours(0,0,0,0),c}function c(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");return u(t,{weekStartsOn:1})}function l(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getFullYear(),n=new Date(0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);var i=c(n),o=new Date(0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);var a=c(o);return e.getTime()>=i.getTime()?r+1:e.getTime()>=a.getTime()?r:r-1}function f(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=l(t),r=new Date(0);r.setFullYear(e,0,4),r.setHours(0,0,0,0);var n=c(r);return n}var d=r(45);function h(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(i.a)(e),o=Object(d.a)(r,f(r)),a=new Date(0);return a.setFullYear(n,0,4),a.setHours(0,0,0,0),(r=f(a)).setDate(r.getDate()+o),r}function g(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(i.a)(e);return h(t,l(t)+r)}function p(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(i.a)(e);return Object(o.a)(t,6e4*r)}var m=r(55);function y(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(i.a)(e),n=3*r;return Object(m.a)(t,n)}function b(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(i.a)(e);return Object(o.a)(t,1e3*r)}var w=r(71),_=r(122);function v(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=t||{},n=e||{},i=Object(s.a)(r.start).getTime(),o=Object(s.a)(r.end).getTime(),a=Object(s.a)(n.start).getTime(),u=Object(s.a)(n.end).getTime();if(!(i<=o&&a<=u))throw new RangeError("Invalid interval");return i<u&&a<o}function E(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t);if(isNaN(r))return NaN;var n,i,o=r.getTime();return(null==e?[]:"function"==typeof e.forEach?e:Array.prototype.slice.call(e)).forEach((function(t,e){var r=Object(s.a)(t);if(isNaN(r))return n=NaN,void(i=NaN);var a=Math.abs(o-r.getTime());(null==n||a<i)&&(n=e,i=a)})),n}function S(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t);if(isNaN(r))return new Date(NaN);var n,i,o=r.getTime();return(null==e?[]:"function"==typeof e.forEach?e:Array.prototype.slice.call(e)).forEach((function(t){var e=Object(s.a)(t);if(isNaN(e))return n=new Date(NaN),void(i=NaN);var r=Math.abs(o-e.getTime());(null==n||r<i)&&(n=e,i=r)})),n}var O=r(36);function T(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(s.a)(e),i=r.getTime()-n.getTime();return i>0?-1:i<0?1:i}function A(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");return l(t)-l(e)}var M=r(26);function j(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=c(t),n=c(e),i=r.getTime()-Object(M.a)(r),o=n.getTime()-Object(M.a)(n);return Math.round((i-o)/6048e5)}function I(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(s.a)(e),i=r.getFullYear()-n.getFullYear(),o=r.getMonth()-n.getMonth();return 12*i+o}function R(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=Math.floor(e.getMonth()/3)+1;return r}function D(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(s.a)(e),i=r.getFullYear()-n.getFullYear(),o=R(r)-R(n);return 4*i+o}function k(t,e,r){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=u(t,r),i=u(e,r),o=n.getTime()-Object(M.a)(n),a=i.getTime()-Object(M.a)(i);return Math.round((o-a)/6048e5)}function N(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(s.a)(e);return r.getFullYear()-n.getFullYear()}var C=r(123);function x(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(s.a)(e);return r.getTime()-n.getTime()}function L(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=x(t,e)/36e5;return r>0?Math.floor(r):Math.ceil(r)}function P(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(i.a)(e);return g(t,-r)}function B(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(s.a)(e),i=Object(O.a)(r,n),o=Math.abs(A(r,n));r=P(r,i*o);var a=Object(O.a)(r,n)===-i,u=i*(o-a);return 0===u?0:u}function U(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=x(t,e)/6e4;return r>0?Math.floor(r):Math.ceil(r)}function F(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(s.a)(e),i=Object(O.a)(r,n),o=Math.abs(I(r,n));r.setMonth(r.getMonth()-i*o);var a=Object(O.a)(r,n)===-i,u=i*(o-a);return 0===u?0:u}function W(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=F(t,e)/3;return r>0?Math.floor(r):Math.ceil(r)}function H(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=x(t,e)/1e3;return r>0?Math.floor(r):Math.ceil(r)}function q(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(C.a)(t,e)/7;return r>0?Math.floor(r):Math.ceil(r)}function z(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(s.a)(e),i=Object(O.a)(r,n),o=Math.abs(N(r,n));r.setFullYear(r.getFullYear()-i*o);var a=Object(O.a)(r,n)===-i,u=i*(o-a);return 0===u?0:u}function V(t,e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var r=t||{},n=Object(s.a)(r.start),i=Object(s.a)(r.end),o=i.getTime();if(!(n.getTime()<=o))throw new RangeError("Invalid interval");var a=[],u=n;u.setHours(0,0,0,0);var c=e&&"step"in e?Number(e.step):1;if(c<1||isNaN(c))throw new RangeError("`options.step` must be a number greater than 1");for(;u.getTime()<=o;)a.push(Object(s.a)(u)),u.setDate(u.getDate()+c),u.setHours(0,0,0,0);return a}function Y(t,e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var r=t||{},n=Object(s.a)(r.start),i=Object(s.a)(r.end),o=i.getTime();if(!(n.getTime()<=o))throw new RangeError("Invalid interval");var a=u(n,e),c=u(i,e);a.setHours(15),c.setHours(15),o=c.getTime();for(var l=[],f=a;f.getTime()<=o;)f.setHours(0),l.push(Object(s.a)(f)),(f=Object(w.a)(f,1)).setHours(15);return l}function G(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");return 0===Object(s.a)(t).getDay()}function $(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getDay();return 0===r||6===r}function K(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");for(var e=V(t),r=[],n=0;n++<e.length;){var i=e[n];$(i)&&(r.push(i),G(i)&&(n+=5))}return r}var Z=r(62),J=r(79);function X(t){if(arguments.length<1)throw new TypeError("1 arguments required, but only "+arguments.length+" present");var e=Object(Z.a)(t);if(isNaN(e))throw new RangeError("The passed date is invalid");var r=Object(J.a)(t);return K({start:e,end:r})}function Q(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=new Date(0);return r.setFullYear(e.getFullYear(),0,1),r.setHours(0,0,0,0),r}function tt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getFullYear();return e.setFullYear(r+1,0,0),e.setHours(23,59,59,999),e}function et(t){if(arguments.length<1)throw new TypeError("1 arguments required, but only "+arguments.length+" present");var e=Q(t);if(isNaN(e))throw new RangeError("The passed date is invalid");var r=tt(t);return K({start:e,end:r})}function rt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t);return e.setHours(23,59,59,999),e}function nt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getFullYear(),n=9+10*Math.floor(r/10);return e.setFullYear(n,11,31),e.setHours(23,59,59,999),e}function it(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t);return e.setMinutes(59,59,999),e}function ot(t,e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var r=e||{},n=r.locale,o=n&&n.options&&n.options.weekStartsOn,a=null==o?0:Object(i.a)(o),u=null==r.weekStartsOn?a:Object(i.a)(r.weekStartsOn);if(!(u>=0&&u<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var c=Object(s.a)(t),l=c.getDay(),f=6+(l<u?-7:0)-(l-u);return c.setDate(c.getDate()+f),c.setHours(23,59,59,999),c}function at(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");return ot(t,{weekStartsOn:1})}function st(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=l(t),r=new Date(0);r.setFullYear(e+1,0,4),r.setHours(0,0,0,0);var n=c(r);return n.setMilliseconds(n.getMilliseconds()-1),n}function ut(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t);return e.setSeconds(59,999),e}function ct(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getMonth(),n=r-r%3+3;return e.setMonth(n,0),e.setHours(23,59,59,999),e}function lt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t);return e.setMilliseconds(999),e}var ft=r(34);function dt(t,e){if(null==t)throw new TypeError("assign requires that input parameter not be null or undefined");for(var r in e=e||{})e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function ht(t){return dt({},t)}var gt=r(57);function pt(t,e,r){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=r||{},i=n.locale||gt.a;if(!i.formatDistance)throw new RangeError("locale must contain formatDistance property");var o=Object(O.a)(t,e);if(isNaN(o))throw new RangeError("Invalid time value");var a,u,c=ht(n);c.addSuffix=Boolean(n.addSuffix),c.comparison=o,o>0?(a=Object(s.a)(e),u=Object(s.a)(t)):(a=Object(s.a)(t),u=Object(s.a)(e));var l,f=H(u,a),d=(Object(M.a)(u)-Object(M.a)(a))/1e3,h=Math.round((f-d)/60);if(h<2)return n.includeSeconds?f<5?i.formatDistance("lessThanXSeconds",5,c):f<10?i.formatDistance("lessThanXSeconds",10,c):f<20?i.formatDistance("lessThanXSeconds",20,c):f<40?i.formatDistance("halfAMinute",null,c):f<60?i.formatDistance("lessThanXMinutes",1,c):i.formatDistance("xMinutes",1,c):0===h?i.formatDistance("lessThanXMinutes",1,c):i.formatDistance("xMinutes",h,c);if(h<45)return i.formatDistance("xMinutes",h,c);if(h<90)return i.formatDistance("aboutXHours",1,c);if(h<1440){var g=Math.round(h/60);return i.formatDistance("aboutXHours",g,c)}if(h<2520)return i.formatDistance("xDays",1,c);if(h<43200){var p=Math.round(h/1440);return i.formatDistance("xDays",p,c)}if(h<86400)return l=Math.round(h/43200),i.formatDistance("aboutXMonths",l,c);if((l=F(u,a))<12){var m=Math.round(h/43200);return i.formatDistance("xMonths",m,c)}var y=l%12,b=Math.floor(l/12);return y<3?i.formatDistance("aboutXYears",b,c):y<9?i.formatDistance("overXYears",b,c):i.formatDistance("almostXYears",b+1,c)}function mt(t,e,r){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=r||{},i=n.locale||gt.a;if(!i.formatDistance)throw new RangeError("locale must contain localize.formatDistance property");var o=Object(O.a)(t,e);if(isNaN(o))throw new RangeError("Invalid time value");var a,u,c=ht(n);c.addSuffix=Boolean(n.addSuffix),c.comparison=o,o>0?(a=Object(s.a)(e),u=Object(s.a)(t)):(a=Object(s.a)(t),u=Object(s.a)(e));var l,f=null==n.roundingMethod?"round":String(n.roundingMethod);if("floor"===f)l=Math.floor;else if("ceil"===f)l=Math.ceil;else{if("round"!==f)throw new RangeError("roundingMethod must be 'floor', 'ceil' or 'round'");l=Math.round}var d,h=H(u,a),g=(Object(M.a)(u)-Object(M.a)(a))/1e3,p=l((h-g)/60);if("second"===(d=null==n.unit?p<1?"second":p<60?"minute":p<1440?"hour":p<43200?"day":p<525600?"month":"year":String(n.unit)))return i.formatDistance("xSeconds",h,c);if("minute"===d)return i.formatDistance("xMinutes",p,c);if("hour"===d){var m=l(p/60);return i.formatDistance("xHours",m,c)}if("day"===d){var y=l(p/1440);return i.formatDistance("xDays",y,c)}if("month"===d){var b=l(p/43200);return i.formatDistance("xMonths",b,c)}if("year"===d){var w=l(p/525600);return i.formatDistance("xYears",w,c)}throw new RangeError("unit must be 'second', 'minute', 'hour', 'day', 'month' or 'year'")}var yt=r(47);function bt(t,e,r){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=Object(s.a)(t),i=Object(s.a)(e),o=r||{},a=o.locale||gt.a;if(!a.localize)throw new RangeError("locale must contain localize property");if(!a.formatLong)throw new RangeError("locale must contain formatLong property");if(!a.formatRelative)throw new RangeError("locale must contain formatRelative property");var u,c=Object(d.a)(n,i);if(isNaN(c))throw new RangeError("Invalid time value");u=c<-6?"other":c<-1?"lastWeek":c<0?"yesterday":c<1?"today":c<2?"tomorrow":c<7?"nextWeek":"other";var l=Object(yt.a)(n,Object(M.a)(n)),f=Object(yt.a)(i,Object(M.a)(i)),h=a.formatRelative(u,l,f,o);return Object(ft.a)(n,h,o)}function wt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(i.a)(t);return Object(s.a)(1e3*e)}var _t=r(124);function vt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getDay();return r}function Et(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=Object(d.a)(e,Q(e)),n=r+1;return n}var St=r(88);function Ot(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getFullYear();return r%400==0||r%4==0&&r%100!=0}function Tt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t);return isNaN(e)?NaN:Ot(e)?366:365}function At(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getFullYear(),n=10*Math.floor(r/10);return n}function Mt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getHours();return r}function jt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getDay();return 0===r&&(r=7),r}function It(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=c(e).getTime()-f(e).getTime();return Math.round(r/6048e5)+1}function Rt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=f(t),r=f(Object(w.a)(e,60)),n=r.valueOf()-e.valueOf();return Math.round(n/6048e5)}function Dt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getMilliseconds();return r}function kt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getMinutes();return r}function Nt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getMonth();return r}function Ct(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=t||{},n=e||{},i=Object(s.a)(r.start).getTime(),o=Object(s.a)(r.end).getTime(),a=Object(s.a)(n.start).getTime(),u=Object(s.a)(n.end).getTime();if(!(i<=o&&a<=u))throw new RangeError("Invalid interval");var c=i<u&&a<o;if(!c)return 0;var l=a<i?i:a,f=u>o?o:u,d=f-l;return Math.ceil(d/864e5)}function xt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getSeconds();return r}function Lt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getTime();return r}function Pt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");return Math.floor(Lt(t)/1e3)}function Bt(t,e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=r.getFullYear(),o=e||{},a=o.locale,c=a&&a.options&&a.options.firstWeekContainsDate,l=null==c?1:Object(i.a)(c),f=null==o.firstWeekContainsDate?l:Object(i.a)(o.firstWeekContainsDate);if(!(f>=1&&f<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var d=new Date(0);d.setFullYear(n+1,0,f),d.setHours(0,0,0,0);var h=u(d,e),g=new Date(0);g.setFullYear(n,0,f),g.setHours(0,0,0,0);var p=u(g,e);return r.getTime()>=h.getTime()?n+1:r.getTime()>=p.getTime()?n:n-1}function Ut(t,e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var r=e||{},n=r.locale,o=n&&n.options&&n.options.firstWeekContainsDate,a=null==o?1:Object(i.a)(o),s=null==r.firstWeekContainsDate?a:Object(i.a)(r.firstWeekContainsDate),c=Bt(t,e),l=new Date(0);l.setFullYear(c,0,s),l.setHours(0,0,0,0);var f=u(l,e);return f}function Ft(t,e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=u(r,e).getTime()-Ut(r,e).getTime();return Math.round(n/6048e5)+1}function Wt(t,e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var r=e||{},n=r.locale,o=n&&n.options&&n.options.weekStartsOn,a=null==o?0:Object(i.a)(o),s=null==r.weekStartsOn?a:Object(i.a)(r.weekStartsOn);if(!(s>=0&&s<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var u=vt(Object(Z.a)(t)),c=vt(t),l=u<s?7-s:u,f=l>c?7-s:0;return Math.ceil((Object(_t.a)(t)+f)/7)}function Ht(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(0,0,0,0),e}function qt(t,e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");return k(Ht(t),Object(Z.a)(t),e)+1}function zt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getFullYear();return r}var Vt=r(163),Yt=r(105);function Gt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");return t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)}function $t(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(s.a)(e);return r.getTime()===n.getTime()}function Kt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");return 1===Object(s.a)(t).getDate()}function Zt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");return 5===Object(s.a)(t).getDay()}function Jt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t);return rt(e).getTime()===Object(J.a)(e).getTime()}function Xt(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");return 1===Object(s.a)(t).getDay()}var Qt=r(72);function te(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(Qt.a)(t),n=Object(Qt.a)(e);return r.getTime()===n.getTime()}function ee(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t);return e.setMinutes(0,0,0),e}function re(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=ee(t),n=ee(e);return r.getTime()===n.getTime()}function ne(t,e,r){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=u(t,r),i=u(e,r);return n.getTime()===i.getTime()}function ie(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");return ne(t,e,{weekStartsOn:1})}function oe(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=f(t),n=f(e);return r.getTime()===n.getTime()}function ae(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t);return e.setSeconds(0,0),e}function se(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=ae(t),n=ae(e);return r.getTime()===n.getTime()}function ue(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(s.a)(e);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()}function ce(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getMonth(),n=r-r%3;return e.setMonth(n,1),e.setHours(0,0,0,0),e}function le(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=ce(t),n=ce(e);return r.getTime()===n.getTime()}function fe(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t);return e.setMilliseconds(0),e}function de(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=fe(t),n=fe(e);return r.getTime()===n.getTime()}function he(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(s.a)(e);return r.getFullYear()===n.getFullYear()}function ge(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");return 6===Object(s.a)(t).getDay()}function pe(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");return 4===Object(s.a)(t).getDay()}function me(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");return 2===Object(s.a)(t).getDay()}var ye=r(63);function be(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");return 3===Object(s.a)(t).getDay()}function we(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=e||{},n=Object(s.a)(t).getTime(),i=Object(s.a)(r.start).getTime(),o=Object(s.a)(r.end).getTime();if(!(i<=o))throw new RangeError("Invalid interval");return n>=i&&n<=o}function _e(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getFullYear(),n=9+10*Math.floor(r/10);return e.setFullYear(n+1,0,0),e.setHours(0,0,0,0),e}function ve(t,e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var r=e||{},n=r.locale,o=n&&n.options&&n.options.weekStartsOn,a=null==o?0:Object(i.a)(o),u=null==r.weekStartsOn?a:Object(i.a)(r.weekStartsOn);if(!(u>=0&&u<=6))throw new RangeError("weekStartsOn must be between 0 and 6");var c=Object(s.a)(t),l=c.getDay(),f=6+(l<u?-7:0)-(l-u);return c.setHours(0,0,0,0),c.setDate(c.getDate()+f),c}function Ee(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");return ve(t,{weekStartsOn:1})}function Se(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=l(t),r=new Date(0);r.setFullYear(e+1,0,4),r.setHours(0,0,0,0);var n=c(r);return n.setDate(n.getDate()-1),n}function Oe(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getMonth(),n=r-r%3+3;return e.setMonth(n,0),e.setHours(0,0,0,0),e}function Te(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getFullYear();return e.setFullYear(r+1,0,0),e.setHours(0,0,0,0),e}var Ae=r(60),Me=/(\w)\1*|''|'(''|[^'])+('|$)|./g,je=/^'(.*?)'?$/,Ie=/''/g;function Re(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=String(e),n=Object(s.a)(t);if(!Object(ye.a)(n))throw new RangeError("Invalid time value");var i=Object(M.a)(n),o=Object(yt.a)(n,i),a=r.match(Me).map((function(t){if("''"===t)return"'";var e=t[0];if("'"===e)return De(t);var r=Ae.a[e];return r?r(o,t,null,{}):t})).join("");return a}function De(t){return t.match(je)[1].replace(Ie,"'")}function ke(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e;return(null==t?[]:"function"==typeof t.forEach?t:Array.prototype.slice.call(t)).forEach((function(t){var r=Object(s.a)(t);(void 0===e||e<r||isNaN(r))&&(e=r)})),e}function Ne(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e;return(null==t?[]:"function"==typeof t.forEach?t:Array.prototype.slice.call(t)).forEach((function(t){var r=Object(s.a)(t);(void 0===e||e>r||isNaN(r))&&(e=r)})),e}var Ce=r(89);function xe(t,e,r){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=r||{},o=n.locale,a=o&&o.options&&o.options.weekStartsOn,u=null==a?0:Object(i.a)(a),c=null==n.weekStartsOn?u:Object(i.a)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var l=Object(s.a)(t),f=Object(i.a)(e),d=l.getUTCDay(),h=f%7,g=(h+7)%7,p=(g<c?7:0)+f-d;return l.setUTCDate(l.getUTCDate()+p),l}var Le=r(132);var Pe=r(48);var Be=r(133);var Ue=r(58),Fe=/^(1[0-2]|0?\d)/,We=/^(3[0-1]|[0-2]?\d)/,He=/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,qe=/^(5[0-3]|[0-4]?\d)/,ze=/^(2[0-3]|[0-1]?\d)/,Ve=/^(2[0-4]|[0-1]?\d)/,Ye=/^(1[0-1]|0?\d)/,Ge=/^(1[0-2]|0?\d)/,$e=/^[0-5]?\d/,Ke=/^[0-5]?\d/,Ze=/^\d/,Je=/^\d{1,2}/,Xe=/^\d{1,3}/,Qe=/^\d{1,4}/,tr=/^-?\d+/,er=/^-?\d/,rr=/^-?\d{1,2}/,nr=/^-?\d{1,3}/,ir=/^-?\d{1,4}/,or=/^([+-])(\d{2})(\d{2})?|Z/,ar=/^([+-])(\d{2})(\d{2})|Z/,sr=/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,ur=/^([+-])(\d{2}):(\d{2})|Z/,cr=/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/;function lr(t,e,r){var n=e.match(t);if(!n)return null;var i=parseInt(n[0],10);return{value:r?r(i):i,rest:e.slice(n[0].length)}}function fr(t,e){var r=e.match(t);return r?"Z"===r[0]?{value:0,rest:e.slice(1)}:{value:("+"===r[1]?1:-1)*(36e5*(r[2]?parseInt(r[2],10):0)+6e4*(r[3]?parseInt(r[3],10):0)+1e3*(r[5]?parseInt(r[5],10):0)),rest:e.slice(r[0].length)}:null}function dr(t,e){return lr(tr,t,e)}function hr(t,e,r){switch(t){case 1:return lr(Ze,e,r);case 2:return lr(Je,e,r);case 3:return lr(Xe,e,r);case 4:return lr(Qe,e,r);default:return lr(new RegExp("^\\d{1,"+t+"}"),e,r)}}function gr(t,e,r){switch(t){case 1:return lr(er,e,r);case 2:return lr(rr,e,r);case 3:return lr(nr,e,r);case 4:return lr(ir,e,r);default:return lr(new RegExp("^-?\\d{1,"+t+"}"),e,r)}}function pr(t){switch(t){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function mr(t,e){var r,n=e>0,i=n?e:1-e;if(i<=50)r=t||100;else{var o=i+50;r=t+100*Math.floor(o/100)-(t>=o%100?100:0)}return n?r:1-r}var yr=[31,28,31,30,31,30,31,31,30,31,30,31],br=[31,29,31,30,31,30,31,31,30,31,30,31];function wr(t){return t%400==0||t%4==0&&t%100!=0}var _r={G:{priority:140,parse:function(t,e,r,n){switch(e){case"G":case"GG":case"GGG":return r.era(t,{width:"abbreviated"})||r.era(t,{width:"narrow"});case"GGGGG":return r.era(t,{width:"narrow"});case"GGGG":default:return r.era(t,{width:"wide"})||r.era(t,{width:"abbreviated"})||r.era(t,{width:"narrow"})}},set:function(t,e,r,n){return t.setUTCFullYear(1===r?10:-9,0,1),t.setUTCHours(0,0,0,0),t}},y:{priority:130,parse:function(t,e,r,n){var i=function(t){return{year:t,isTwoDigitYear:"yy"===e}};switch(e){case"y":return hr(4,t,i);case"yo":return r.ordinalNumber(t,{unit:"year",valueCallback:i});default:return hr(e.length,t,i)}},validate:function(t,e,r){return e.isTwoDigitYear||e.year>0},set:function(t,e,r,n){var i=Object(Ce.a)(t,n);if(r.isTwoDigitYear){var o=mr(r.year,i);return t.setUTCFullYear(o,0,1),t.setUTCHours(0,0,0,0),t}var a=i>0?r.year:1-r.year;return t.setUTCFullYear(a,0,1),t.setUTCHours(0,0,0,0),t}},Y:{priority:130,parse:function(t,e,r,n){var i=function(t){return{year:t,isTwoDigitYear:"YY"===e}};switch(e){case"Y":return hr(4,t,i);case"Yo":return r.ordinalNumber(t,{unit:"year",valueCallback:i});default:return hr(e.length,t,i)}},validate:function(t,e,r){return e.isTwoDigitYear||e.year>0},set:function(t,e,r,n){var i=t.getUTCFullYear();if(r.isTwoDigitYear){var o=mr(r.year,i);return t.setUTCFullYear(o,0,n.firstWeekContainsDate),t.setUTCHours(0,0,0,0),Object(Pe.a)(t,n)}var a=i>0?r.year:1-r.year;return t.setUTCFullYear(a,0,n.firstWeekContainsDate),t.setUTCHours(0,0,0,0),Object(Pe.a)(t,n)}},R:{priority:130,parse:function(t,e,r,n){return gr("R"===e?4:e.length,t)},set:function(t,e,r,n){var i=new Date(0);return i.setUTCFullYear(r,0,4),i.setUTCHours(0,0,0,0),Object(Ue.a)(i)}},u:{priority:130,parse:function(t,e,r,n){return gr("u"===e?4:e.length,t)},set:function(t,e,r,n){return t.setUTCFullYear(r,0,1),t.setUTCHours(0,0,0,0),t}},Q:{priority:120,parse:function(t,e,r,n){switch(e){case"Q":case"QQ":return hr(e.length,t);case"Qo":return r.ordinalNumber(t,{unit:"quarter"});case"QQQ":return r.quarter(t,{width:"abbreviated",context:"formatting"})||r.quarter(t,{width:"narrow",context:"formatting"});case"QQQQQ":return r.quarter(t,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(t,{width:"wide",context:"formatting"})||r.quarter(t,{width:"abbreviated",context:"formatting"})||r.quarter(t,{width:"narrow",context:"formatting"})}},validate:function(t,e,r){return e>=1&&e<=4},set:function(t,e,r,n){return t.setUTCMonth(3*(r-1),1),t.setUTCHours(0,0,0,0),t}},q:{priority:120,parse:function(t,e,r,n){switch(e){case"q":case"qq":return hr(e.length,t);case"qo":return r.ordinalNumber(t,{unit:"quarter"});case"qqq":return r.quarter(t,{width:"abbreviated",context:"standalone"})||r.quarter(t,{width:"narrow",context:"standalone"});case"qqqqq":return r.quarter(t,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(t,{width:"wide",context:"standalone"})||r.quarter(t,{width:"abbreviated",context:"standalone"})||r.quarter(t,{width:"narrow",context:"standalone"})}},validate:function(t,e,r){return e>=1&&e<=4},set:function(t,e,r,n){return t.setUTCMonth(3*(r-1),1),t.setUTCHours(0,0,0,0),t}},M:{priority:110,parse:function(t,e,r,n){var i=function(t){return t-1};switch(e){case"M":return lr(Fe,t,i);case"MM":return hr(2,t,i);case"Mo":return r.ordinalNumber(t,{unit:"month",valueCallback:i});case"MMM":return r.month(t,{width:"abbreviated",context:"formatting"})||r.month(t,{width:"narrow",context:"formatting"});case"MMMMM":return r.month(t,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(t,{width:"wide",context:"formatting"})||r.month(t,{width:"abbreviated",context:"formatting"})||r.month(t,{width:"narrow",context:"formatting"})}},validate:function(t,e,r){return e>=0&&e<=11},set:function(t,e,r,n){return t.setUTCMonth(r,1),t.setUTCHours(0,0,0,0),t}},L:{priority:110,parse:function(t,e,r,n){var i=function(t){return t-1};switch(e){case"L":return lr(Fe,t,i);case"LL":return hr(2,t,i);case"Lo":return r.ordinalNumber(t,{unit:"month",valueCallback:i});case"LLL":return r.month(t,{width:"abbreviated",context:"standalone"})||r.month(t,{width:"narrow",context:"standalone"});case"LLLLL":return r.month(t,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(t,{width:"wide",context:"standalone"})||r.month(t,{width:"abbreviated",context:"standalone"})||r.month(t,{width:"narrow",context:"standalone"})}},validate:function(t,e,r){return e>=0&&e<=11},set:function(t,e,r,n){return t.setUTCMonth(r,1),t.setUTCHours(0,0,0,0),t}},w:{priority:100,parse:function(t,e,r,n){switch(e){case"w":return lr(qe,t);case"wo":return r.ordinalNumber(t,{unit:"week"});default:return hr(e.length,t)}},validate:function(t,e,r){return e>=1&&e<=53},set:function(t,e,r,n){return Object(Pe.a)(function(t,e,r){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=Object(s.a)(t),o=Object(i.a)(e),a=Object(Le.a)(n,r)-o;return n.setUTCDate(n.getUTCDate()-7*a),n}(t,r,n),n)}},I:{priority:100,parse:function(t,e,r,n){switch(e){case"I":return lr(qe,t);case"Io":return r.ordinalNumber(t,{unit:"week"});default:return hr(e.length,t)}},validate:function(t,e,r){return e>=1&&e<=53},set:function(t,e,r,n){return Object(Ue.a)(function(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(i.a)(e),o=Object(Be.a)(r)-n;return r.setUTCDate(r.getUTCDate()-7*o),r}(t,r,n),n)}},d:{priority:90,parse:function(t,e,r,n){switch(e){case"d":return lr(We,t);case"do":return r.ordinalNumber(t,{unit:"date"});default:return hr(e.length,t)}},validate:function(t,e,r){var n=wr(t.getUTCFullYear()),i=t.getUTCMonth();return n?e>=1&&e<=br[i]:e>=1&&e<=yr[i]},set:function(t,e,r,n){return t.setUTCDate(r),t.setUTCHours(0,0,0,0),t}},D:{priority:90,parse:function(t,e,r,n){switch(e){case"D":case"DD":return lr(He,t);case"Do":return r.ordinalNumber(t,{unit:"date"});default:return hr(e.length,t)}},validate:function(t,e,r){return wr(t.getUTCFullYear())?e>=1&&e<=366:e>=1&&e<=365},set:function(t,e,r,n){return t.setUTCMonth(0,r),t.setUTCHours(0,0,0,0),t}},E:{priority:90,parse:function(t,e,r,n){switch(e){case"E":case"EE":case"EEE":return r.day(t,{width:"abbreviated",context:"formatting"})||r.day(t,{width:"short",context:"formatting"})||r.day(t,{width:"narrow",context:"formatting"});case"EEEEE":return r.day(t,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(t,{width:"short",context:"formatting"})||r.day(t,{width:"narrow",context:"formatting"});case"EEEE":default:return r.day(t,{width:"wide",context:"formatting"})||r.day(t,{width:"abbreviated",context:"formatting"})||r.day(t,{width:"short",context:"formatting"})||r.day(t,{width:"narrow",context:"formatting"})}},validate:function(t,e,r){return e>=0&&e<=6},set:function(t,e,r,n){return(t=xe(t,r,n)).setUTCHours(0,0,0,0),t}},e:{priority:90,parse:function(t,e,r,n){var i=function(t){var e=7*Math.floor((t-1)/7);return(t+n.weekStartsOn+6)%7+e};switch(e){case"e":case"ee":return hr(e.length,t,i);case"eo":return r.ordinalNumber(t,{unit:"day",valueCallback:i});case"eee":return r.day(t,{width:"abbreviated",context:"formatting"})||r.day(t,{width:"short",context:"formatting"})||r.day(t,{width:"narrow",context:"formatting"});case"eeeee":return r.day(t,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(t,{width:"short",context:"formatting"})||r.day(t,{width:"narrow",context:"formatting"});case"eeee":default:return r.day(t,{width:"wide",context:"formatting"})||r.day(t,{width:"abbreviated",context:"formatting"})||r.day(t,{width:"short",context:"formatting"})||r.day(t,{width:"narrow",context:"formatting"})}},validate:function(t,e,r){return e>=0&&e<=6},set:function(t,e,r,n){return(t=xe(t,r,n)).setUTCHours(0,0,0,0),t}},c:{priority:90,parse:function(t,e,r,n){var i=function(t){var e=7*Math.floor((t-1)/7);return(t+n.weekStartsOn+6)%7+e};switch(e){case"c":case"cc":return hr(e.length,t,i);case"co":return r.ordinalNumber(t,{unit:"day",valueCallback:i});case"ccc":return r.day(t,{width:"abbreviated",context:"standalone"})||r.day(t,{width:"short",context:"standalone"})||r.day(t,{width:"narrow",context:"standalone"});case"ccccc":return r.day(t,{width:"narrow",context:"standalone"});case"cccccc":return r.day(t,{width:"short",context:"standalone"})||r.day(t,{width:"narrow",context:"standalone"});case"cccc":default:return r.day(t,{width:"wide",context:"standalone"})||r.day(t,{width:"abbreviated",context:"standalone"})||r.day(t,{width:"short",context:"standalone"})||r.day(t,{width:"narrow",context:"standalone"})}},validate:function(t,e,r){return e>=0&&e<=6},set:function(t,e,r,n){return(t=xe(t,r,n)).setUTCHours(0,0,0,0),t}},i:{priority:90,parse:function(t,e,r,n){var i=function(t){return 0===t?7:t};switch(e){case"i":case"ii":return hr(e.length,t);case"io":return r.ordinalNumber(t,{unit:"day"});case"iii":return r.day(t,{width:"abbreviated",context:"formatting",valueCallback:i})||r.day(t,{width:"short",context:"formatting",valueCallback:i})||r.day(t,{width:"narrow",context:"formatting",valueCallback:i});case"iiiii":return r.day(t,{width:"narrow",context:"formatting",valueCallback:i});case"iiiiii":return r.day(t,{width:"short",context:"formatting",valueCallback:i})||r.day(t,{width:"narrow",context:"formatting",valueCallback:i});case"iiii":default:return r.day(t,{width:"wide",context:"formatting",valueCallback:i})||r.day(t,{width:"abbreviated",context:"formatting",valueCallback:i})||r.day(t,{width:"short",context:"formatting",valueCallback:i})||r.day(t,{width:"narrow",context:"formatting",valueCallback:i})}},validate:function(t,e,r){return e>=1&&e<=7},set:function(t,e,r,n){return(t=function(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(i.a)(e);r%7==0&&(r-=7);var n=1,o=Object(s.a)(t),a=o.getUTCDay(),u=r%7,c=(u+7)%7,l=(c<n?7:0)+r-a;return o.setUTCDate(o.getUTCDate()+l),o}(t,r,n)).setUTCHours(0,0,0,0),t}},a:{priority:80,parse:function(t,e,r,n){switch(e){case"a":case"aa":case"aaa":return r.dayPeriod(t,{width:"abbreviated",context:"formatting"})||r.dayPeriod(t,{width:"narrow",context:"formatting"});case"aaaaa":return r.dayPeriod(t,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(t,{width:"wide",context:"formatting"})||r.dayPeriod(t,{width:"abbreviated",context:"formatting"})||r.dayPeriod(t,{width:"narrow",context:"formatting"})}},set:function(t,e,r,n){return t.setUTCHours(pr(r),0,0,0),t}},b:{priority:80,parse:function(t,e,r,n){switch(e){case"b":case"bb":case"bbb":return r.dayPeriod(t,{width:"abbreviated",context:"formatting"})||r.dayPeriod(t,{width:"narrow",context:"formatting"});case"bbbbb":return r.dayPeriod(t,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(t,{width:"wide",context:"formatting"})||r.dayPeriod(t,{width:"abbreviated",context:"formatting"})||r.dayPeriod(t,{width:"narrow",context:"formatting"})}},set:function(t,e,r,n){return t.setUTCHours(pr(r),0,0,0),t}},B:{priority:80,parse:function(t,e,r,n){switch(e){case"B":case"BB":case"BBB":return r.dayPeriod(t,{width:"abbreviated",context:"formatting"})||r.dayPeriod(t,{width:"narrow",context:"formatting"});case"BBBBB":return r.dayPeriod(t,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(t,{width:"wide",context:"formatting"})||r.dayPeriod(t,{width:"abbreviated",context:"formatting"})||r.dayPeriod(t,{width:"narrow",context:"formatting"})}},set:function(t,e,r,n){return t.setUTCHours(pr(r),0,0,0),t}},h:{priority:70,parse:function(t,e,r,n){switch(e){case"h":return lr(Ge,t);case"ho":return r.ordinalNumber(t,{unit:"hour"});default:return hr(e.length,t)}},validate:function(t,e,r){return e>=1&&e<=12},set:function(t,e,r,n){var i=t.getUTCHours()>=12;return i&&r<12?t.setUTCHours(r+12,0,0,0):i||12!==r?t.setUTCHours(r,0,0,0):t.setUTCHours(0,0,0,0),t}},H:{priority:70,parse:function(t,e,r,n){switch(e){case"H":return lr(ze,t);case"Ho":return r.ordinalNumber(t,{unit:"hour"});default:return hr(e.length,t)}},validate:function(t,e,r){return e>=0&&e<=23},set:function(t,e,r,n){return t.setUTCHours(r,0,0,0),t}},K:{priority:70,parse:function(t,e,r,n){switch(e){case"K":return lr(Ye,t);case"Ko":return r.ordinalNumber(t,{unit:"hour"});default:return hr(e.length,t)}},validate:function(t,e,r){return e>=0&&e<=11},set:function(t,e,r,n){return t.getUTCHours()>=12&&r<12?t.setUTCHours(r+12,0,0,0):t.setUTCHours(r,0,0,0),t}},k:{priority:70,parse:function(t,e,r,n){switch(e){case"k":return lr(Ve,t);case"ko":return r.ordinalNumber(t,{unit:"hour"});default:return hr(e.length,t)}},validate:function(t,e,r){return e>=1&&e<=24},set:function(t,e,r,n){var i=r<=24?r%24:r;return t.setUTCHours(i,0,0,0),t}},m:{priority:60,parse:function(t,e,r,n){switch(e){case"m":return lr($e,t);case"mo":return r.ordinalNumber(t,{unit:"minute"});default:return hr(e.length,t)}},validate:function(t,e,r){return e>=0&&e<=59},set:function(t,e,r,n){return t.setUTCMinutes(r,0,0),t}},s:{priority:50,parse:function(t,e,r,n){switch(e){case"s":return lr(Ke,t);case"so":return r.ordinalNumber(t,{unit:"second"});default:return hr(e.length,t)}},validate:function(t,e,r){return e>=0&&e<=59},set:function(t,e,r,n){return t.setUTCSeconds(r,0),t}},S:{priority:30,parse:function(t,e,r,n){return hr(e.length,t,(function(t){return Math.floor(t*Math.pow(10,3-e.length))}))},set:function(t,e,r,n){return t.setUTCMilliseconds(r),t}},X:{priority:10,parse:function(t,e,r,n){switch(e){case"X":return fr(or,t);case"XX":return fr(ar,t);case"XXXX":return fr(sr,t);case"XXXXX":return fr(cr,t);case"XXX":default:return fr(ur,t)}},set:function(t,e,r,n){return e.timestampIsSet?t:new Date(t.getTime()-r)}},x:{priority:10,parse:function(t,e,r,n){switch(e){case"x":return fr(or,t);case"xx":return fr(ar,t);case"xxxx":return fr(sr,t);case"xxxxx":return fr(cr,t);case"xxx":default:return fr(ur,t)}},set:function(t,e,r,n){return e.timestampIsSet?t:new Date(t.getTime()-r)}},t:{priority:40,parse:function(t,e,r,n){return dr(t)},set:function(t,e,r,n){return[new Date(1e3*r),{timestampIsSet:!0}]}},T:{priority:20,parse:function(t,e,r,n){return dr(t)},set:function(t,e,r,n){return[new Date(r),{timestampIsSet:!0}]}}},vr=r(92),Er=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Sr=/^'(.*?)'?$/,Or=/''/g,Tr=/\S/;function Ar(t,e,r,n){if(arguments.length<3)throw new TypeError("3 arguments required, but only "+arguments.length+" present");var o=String(t),a=String(e),u=n||{},c=u.locale||gt.a;if(!c.match)throw new RangeError("locale must contain match property");var l=c.options&&c.options.firstWeekContainsDate,f=null==l?1:Object(i.a)(l),d=null==u.firstWeekContainsDate?f:Object(i.a)(u.firstWeekContainsDate);if(!(d>=1&&d<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=c.options&&c.options.weekStartsOn,g=null==h?0:Object(i.a)(h),p=null==u.weekStartsOn?g:Object(i.a)(u.weekStartsOn);if(!(p>=0&&p<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(""===a)return""===o?Object(s.a)(r):new Date(NaN);var m,y={firstWeekContainsDate:d,weekStartsOn:p,locale:c},b=[{priority:10,set:Mr,index:0}],w=a.match(Er);for(m=0;m<w.length;m++){var _=w[m];!u.awareOfUnicodeTokens&&Object(vr.a)(_)&&Object(vr.b)(_);var v=_[0],E=_r[v];if(E){var S=E.parse(o,_,c.match,y);if(!S)return new Date(NaN);b.push({priority:E.priority,set:E.set,validate:E.validate,value:S.value,index:b.length}),o=S.rest}else{if("''"===_?_="'":"'"===v&&(_=jr(_)),0!==o.indexOf(_))return new Date(NaN);o=o.slice(_.length)}}if(o.length>0&&Tr.test(o))return new Date(NaN);var O=b.map((function(t){return t.priority})).sort((function(t,e){return e-t})).filter((function(t,e,r){return r.indexOf(t)===e})).map((function(t){return b.filter((function(e){return e.priority===t})).reverse()})).map((function(t){return t[0]})),T=Object(s.a)(r);if(isNaN(T))return new Date(NaN);var A=Object(yt.a)(T,Object(M.a)(T)),j={};for(m=0;m<O.length;m++){var I=O[m];if(I.validate&&!I.validate(A,I.value,y))return new Date(NaN);var R=I.set(A,j,I.value,y);R[0]?(A=R[0],dt(j,R[1])):A=R}return A}function Mr(t,e){if(e.timestampIsSet)return t;var r=new Date(0);return r.setFullYear(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()),r.setHours(t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds()),r}function jr(t){return t.match(Sr)[1].replace(Or,"'")}var Ir=r(108);function Rr(t,e){if(arguments.length<1)throw new TypeError("1 argument required, but only none provided present");var r=e&&"nearestTo"in e?Object(i.a)(e.nearestTo):1;if(r<1||r>30)throw new RangeError("`options.nearestTo` must be between 1 and 30");var n=Object(s.a)(t),o=n.getSeconds(),a=n.getMinutes()+o/60,u=Math.floor(a/r)*r,c=a%r,l=Math.round(c/r)*r;return new Date(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),u+l)}function Dr(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(i.a)(e);return r.setDate(n),r}function kr(t,e,r){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var o=r||{},a=o.locale,u=a&&a.options&&a.options.weekStartsOn,c=null==u?0:Object(i.a)(u),l=null==o.weekStartsOn?c:Object(i.a)(o.weekStartsOn);if(!(l>=0&&l<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=Object(s.a)(t,o),d=Object(i.a)(e),h=f.getDay(),g=d%7,p=(g+7)%7,m=(p<l?7:0)+d-h;return Object(n.a)(f,m,o)}function Nr(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(i.a)(e);return r.setMonth(0),r.setDate(n),r}function Cr(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(i.a)(e);return r.setHours(n),r}function xr(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),o=Object(i.a)(e),a=jt(r),u=o-a;return Object(n.a)(r,u)}function Lr(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(i.a)(e),o=It(r)-n;return r.setDate(r.getDate()-7*o),r}function Pr(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(i.a)(e);return r.setMilliseconds(n),r}function Br(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(i.a)(e);return r.setMinutes(n),r}function Ur(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(i.a)(e),o=r.getFullYear(),a=r.getDate(),u=new Date(0);u.setFullYear(o,n,15),u.setHours(0,0,0,0);var c=Object(St.a)(u);return r.setMonth(n,Math.min(a,c)),r}function Fr(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(i.a)(e),o=Math.floor(r.getMonth()/3)+1,a=n-o;return Ur(r,r.getMonth()+3*a)}function Wr(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(i.a)(e);return r.setSeconds(n),r}function Hr(t,e,r){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=Object(s.a)(t),o=Object(i.a)(e),a=Ft(n,r)-o;return n.setDate(n.getDate()-7*a),n}function qr(t,e,r){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=r||{},o=n.locale,a=o&&o.options&&o.options.firstWeekContainsDate,u=null==a?1:Object(i.a)(a),c=null==n.firstWeekContainsDate?u:Object(i.a)(n.firstWeekContainsDate),l=Object(s.a)(t),f=Object(i.a)(e),h=Object(d.a)(l,Ut(l,r)),g=new Date(0);return g.setFullYear(f,0,c),g.setHours(0,0,0,0),(l=Ut(g,r)).setDate(l.getDate()+h),l}function zr(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(s.a)(t),n=Object(i.a)(e);return isNaN(r)?new Date(NaN):(r.setFullYear(n),r)}function Vr(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(s.a)(t),r=e.getFullYear(),n=10*Math.floor(r/10);return e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}var Yr=r(127);function Gr(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(i.a)(e);return a(t,-r)}function $r(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(i.a)(e);return p(t,-r)}var Kr=r(126);function Zr(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(i.a)(e);return y(t,-r)}function Jr(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(i.a)(e);return b(t,-r)}var Xr=r(242),Qr=r(243)},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(3),i=r(46);function o(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(n.a)(e),o=7*r;return Object(i.a)(t,o)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(0);function i(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(n.a)(t);return e.setHours(0,0,0,0),e}},function(t,e,r){"use strict";r.d(e,"b",(function(){return d})),r.d(e,"c",(function(){return h})),r.d(e,"d",(function(){return g})),r.d(e,"e",(function(){return b})),r.d(e,"a",(function(){return w}));var n=r(15);const i=["subtransactions"];function o(t,e){if(null==t)return{};var r,n,i=function(t,e){if(null==t)return{};var r,n,i={},o=Object.keys(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||(i[r]=t[r]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function s(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(Object(r),!0).forEach((function(e){u(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function u(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const c=r(41);function l(t){return"number"==typeof t?t:0}function f(t,e){return{type:"SplitTransactionError",version:1,difference:l(e.amount)-t}}function d(t,e){let r="temp"===t.id?"temp":"";return s(s({amount:0},e),{},{payee:e.payee||t.payee,id:e.id?e.id:r+c.v4Sync(),account:t.account,date:t.date,cleared:null!=t.cleared?t.cleared:null,starting_balance_flag:null!=t.starting_balance_flag?t.starting_balance_flag:null,is_child:!0,parent_id:t.id,error:null})}function h(t){const e=t.subtransactions.reduce((t,e)=>t+l(e.amount),0);return s(s({},t),{},{error:e===l(t.amount)?null:f(e,t)})}function g(t){return t.reduce((t,e)=>{let r=e.subtransactions,n=o(e,i);r=r||[],t.push(n);for(let e=0;e<r.length;e++)t.push(r[e]);return t},[])}function p(t){return s(s({},t[0]),{},{subtransactions:t.slice(1)})}function m(t){return null==t?null:g([t])}function y(t,e,r){let i=t.findIndex(t=>t.id===e),o=t[i],a=[...t];if(-1===i)throw new Error("Tried to edit unknown transaction id: "+e);if(o.is_parent||o.is_child){let e=function(t,e){for(;e>=0;){if(t[e].is_parent)return e;e--}return null}(t,i);if(null==e)return console.log("Cannot find parent index"),{diff:{deleted:[],updated:[]}};let o,s=function(t,e){let r=[t[e]],n=e+1;for(;n<t.length&&t[n].is_child;)r.push(t[n]),n++;return r}(t,e),u=r(p(s)),c=m(u);return null==c?(o={deleted:[{id:s[0].id}],updated:[]},u={id:s[0].id,_deleted:!0},a.splice(e,s.length)):(o=Object(n.d)(s,c),a.splice(e,s.length,...c)),{data:a,newTransaction:u,diff:o}}{let t=r(o),e=m(t)||[];return t&&(t.subtransactions=t.subtransactions||[]),a.splice(i,1,...e),{data:a,newTransaction:t||{id:o.id,_deleted:!0},diff:Object(n.d)([o],e)}}}function b(t,e){return y(t,e.id,t=>{if(t.is_parent){let r=t.id===e.id?e:t,n=t.subtransactions.map(n=>{let i=n;return t.id===e.id?i=s(s({},n),{},{payee:n.payee===t.payee?e.payee:n.payee}):n.id===e.id&&(i=e),d(r,i)});return h(s(s({},r),{},{subtransactions:n}))}return e})}function w(t,e){return y(t,e,t=>{if(t.is_parent){if(t.id===e)return null;if(1===t.subtransactions.length)return s(s({},t),{},{subtransactions:null,is_parent:!1,error:null});{let r=t.subtransactions.filter(t=>t.id!==e);return h(s(s({},t),{},{subtransactions:r}))}}return null})}},function(t,e,r){"use strict";(function(t){r.d(e,"f",(function(){return i})),r.d(e,"e",(function(){return o})),r.d(e,"c",(function(){return a})),r.d(e,"b",(function(){return s})),r.d(e,"a",(function(){return u})),r.d(e,"d",(function(){return c}));function n(t){switch(t){case"aes-256-gcm":return"AES-GCM";default:throw new Error("unsupported crypto algorithm: "+t)}}async function i(t){let e=new TextEncoder("utf-8").encode(t).buffer,r=await crypto.subtle.digest("sha-256",e),n=Array.from(new Uint8Array(r)).map(t=>String.fromCharCode(t)).join("");return btoa(n)}function o(e){return t.from(crypto.getRandomValues(new Uint8Array(e)))}async function a(e,r){let i=crypto.getRandomValues(new Uint8Array(12)),o=await crypto.subtle.encrypt({name:n("aes-256-gcm"),iv:i,tagLength:128},e.getValue().raw,r);o=t.from(o);let a=o.slice(-16);return o=o.slice(0,-16),{value:o,meta:{keyId:e.getId(),algorithm:"aes-256-gcm",iv:t.from(i).toString("base64"),authTag:a.toString("base64")}}}async function s(e,r,i){let o=i.algorithm,a=i.iv,s=i.authTag,u=await crypto.subtle.decrypt({name:n(o),iv:t.from(a,"base64"),tagLength:128},e.getValue().raw,t.concat([r,t.from(s,"base64")]));return t.from(u)}async function u({secret:e,salt:r}){let n=t.from(e),i=t.from(r),o=await crypto.subtle.importKey("raw",n,{name:"PBKDF2"},!1,["deriveBits","deriveKey"]),a=await crypto.subtle.deriveKey({name:"PBKDF2",hash:"SHA-512",salt:i,iterations:1e4},o,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),s=await crypto.subtle.exportKey("raw",a);return{raw:a,base64:t.from(s).toString("base64")}}async function c(e){return{raw:await crypto.subtle.importKey("raw",t.from(e,"base64"),{name:"AES-GCM"},!1,["encrypt","decrypt"]),base64:e}}}).call(this,r(14).Buffer)},function(t,e,r){"use strict";var n=function(t,e){return t===e};e.a=function(t,e){var r;void 0===e&&(e=n);var i,o=[],a=!1,s=function(t,r){return e(t,o[r],r)};return function(){for(var e=arguments.length,n=new Array(e),u=0;u<e;u++)n[u]=arguments[u];return a&&r===this&&n.length===o.length&&n.every(s)||(i=t.apply(this,n),a=!0,r=this,o=n),i}}},function(t,e,r){"use strict";var n=r(110),i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=f;var o=Object.create(r(98));o.inherits=r(11);var a=r(180),s=r(140);o.inherits(f,a);for(var u=i(s.prototype),c=0;c<u.length;c++){var l=u[c];f.prototype[l]||(f.prototype[l]=s.prototype[l])}function f(t){if(!(this instanceof f))return new f(t);a.call(this,t),s.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",d)}function d(){this.allowHalfOpen||this._writableState.ended||n.nextTick(h,this)}function h(t){t.end()}Object.defineProperty(f.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(f.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),f.prototype._destroy=function(t,e){this.push(null),this.end(),n.nextTick(e,t)}},function(t,e,r){"use strict";var n=SyntaxError,i=Function,o=TypeError,a=function(t){try{return i('"use strict"; return ('+t+").constructor;")()}catch(t){}},s=Object.getOwnPropertyDescriptor;if(s)try{s({},"")}catch(t){s=null}var u=function(){throw new o},c=s?function(){try{return u}catch(t){try{return s(arguments,"callee").get}catch(t){return u}}}():u,l=r(161)(),f=Object.getPrototypeOf||function(t){return t.__proto__},d={},h="undefined"==typeof Uint8Array?void 0:f(Uint8Array),g={"%AggregateError%":"undefined"==typeof AggregateError?void 0:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayIteratorPrototype%":l?f([][Symbol.iterator]()):void 0,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%BigInt%":"undefined"==typeof BigInt?void 0:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":d,"%Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":l?f(f([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&l?f((new Map)[Symbol.iterator]()):void 0,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?void 0:Promise,"%Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&l?f((new Set)[Symbol.iterator]()):void 0,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":l?f(""[Symbol.iterator]()):void 0,"%Symbol%":l?Symbol:void 0,"%SyntaxError%":n,"%ThrowTypeError%":c,"%TypedArray%":h,"%TypeError%":o,"%Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?void 0:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet},p={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},m=r(162),y=r(430),b=m.call(Function.call,Array.prototype.concat),w=m.call(Function.apply,Array.prototype.splice),_=m.call(Function.call,String.prototype.replace),v=m.call(Function.call,String.prototype.slice),E=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,S=/\\(\\)?/g,O=function(t){var e=v(t,0,1),r=v(t,-1);if("%"===e&&"%"!==r)throw new n("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new n("invalid intrinsic syntax, expected opening `%`");var i=[];return _(t,E,(function(t,e,r,n){i[i.length]=r?_(n,S,"$1"):e||t})),i},T=function(t,e){var r,i=t;if(y(p,i)&&(i="%"+(r=p[i])[0]+"%"),y(g,i)){var s=g[i];if(s===d&&(s=function t(e){var r;if("%AsyncFunction%"===e)r=a("async function () {}");else if("%GeneratorFunction%"===e)r=a("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=a("async function* () {}");else if("%AsyncGenerator%"===e){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===e){var i=t("%AsyncGenerator%");i&&(r=f(i.prototype))}return g[e]=r,r}(i)),void 0===s&&!e)throw new o("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:s}}throw new n("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new o('"allowMissing" argument must be a boolean');var r=O(t),i=r.length>0?r[0]:"",a=T("%"+i+"%",e),u=a.name,c=a.value,l=!1,f=a.alias;f&&(i=f[0],w(r,b([0,1],f)));for(var d=1,h=!0;d<r.length;d+=1){var p=r[d],m=v(p,0,1),_=v(p,-1);if(('"'===m||"'"===m||"`"===m||'"'===_||"'"===_||"`"===_)&&m!==_)throw new n("property names with quotes must have matching quotes");if("constructor"!==p&&h||(l=!0),y(g,u="%"+(i+="."+p)+"%"))c=g[u];else if(null!=c){if(!(p in c)){if(!e)throw new o("base intrinsic for "+t+" exists, but the property is not available.");return}if(s&&d+1>=r.length){var E=s(c,p);c=(h=!!E)&&"get"in E&&!("originalValue"in E.get)?E.get:c[p]}else h=y(c,p),c=c[p];h&&!l&&(g[u]=c)}}return c}},function(t,e,r){"use strict";var n=r(160),i="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,a=Array.prototype.concat,s=Object.defineProperty,u=s&&function(){var t={};try{for(var e in s(t,"x",{enumerable:!1,value:t}),t)return!1;return t.x===t}catch(t){return!1}}(),c=function(t,e,r,n){var i;(!(e in t)||"function"==typeof(i=n)&&"[object Function]"===o.call(i)&&n())&&(u?s(t,e,{configurable:!0,enumerable:!1,value:r,writable:!0}):t[e]=r)},l=function(t,e){var r=arguments.length>2?arguments[2]:{},o=n(e);i&&(o=a.call(o,Object.getOwnPropertySymbols(e)));for(var s=0;s<o.length;s+=1)c(t,o[s],e[o[s]],r[o[s]])};l.supportsDescriptors=!!u,t.exports=l},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(0);function i(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(n.a)(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(23,59,59,999),e}},function(t,e,r){var n=r(286),i=r(287),o=i;o.v1=n,o.v4=i,t.exports=o},function(t,e,r){(function(t){var n=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},n=0;n<e.length;n++)r[e[n]]=Object.getOwnPropertyDescriptor(t,e[n]);return r},i=/%[sdj%]/g;e.format=function(t){if(!y(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(s(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,o=n.length,a=String(t).replace(i,(function(t){if("%%"===t)return"%";if(r>=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),u=n[r];r<o;u=n[++r])p(u)||!_(u)?a+=" "+u:a+=" "+s(u);return a},e.deprecate=function(r,n){if(void 0!==t&&!0===t.noDeprecation)return r;if(void 0===t)return function(){return e.deprecate(r,n).apply(this,arguments)};var i=!1;return function(){if(!i){if(t.throwDeprecation)throw new Error(n);t.traceDeprecation?console.trace(n):console.error(n),i=!0}return r.apply(this,arguments)}};var o,a={};function s(t,r){var n={seen:[],stylize:c};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(r)?n.showHidden=r:r&&e._extend(n,r),b(n.showHidden)&&(n.showHidden=!1),b(n.depth)&&(n.depth=2),b(n.colors)&&(n.colors=!1),b(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),l(n,t,n.depth)}function u(t,e){var r=s.styles[e];return r?"["+s.colors[r][0]+"m"+t+"["+s.colors[r][1]+"m":t}function c(t,e){return t}function l(t,r,n){if(t.customInspect&&r&&S(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,t);return y(i)||(i=l(t,i,n)),i}var o=function(t,e){if(b(e))return t.stylize("undefined","undefined");if(y(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(m(e))return t.stylize(""+e,"number");if(g(e))return t.stylize(""+e,"boolean");if(p(e))return t.stylize("null","null")}(t,r);if(o)return o;var a=Object.keys(r),s=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(r)),E(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return f(r);if(0===a.length){if(S(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(w(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(v(r))return t.stylize(Date.prototype.toString.call(r),"date");if(E(r))return f(r)}var c,_="",O=!1,T=["{","}"];(h(r)&&(O=!0,T=["[","]"]),S(r))&&(_=" [Function"+(r.name?": "+r.name:"")+"]");return w(r)&&(_=" "+RegExp.prototype.toString.call(r)),v(r)&&(_=" "+Date.prototype.toUTCString.call(r)),E(r)&&(_=" "+f(r)),0!==a.length||O&&0!=r.length?n<0?w(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),c=O?function(t,e,r,n,i){for(var o=[],a=0,s=e.length;a<s;++a)j(e,String(a))?o.push(d(t,e,r,n,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(d(t,e,r,n,i,!0))})),o}(t,r,n,s,a):a.map((function(e){return d(t,r,n,s,e,O)})),t.seen.pop(),function(t,e,r){if(t.reduce((function(t,e){return e.indexOf("\n")>=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(c,_,T)):T[0]+_+T[1]}function f(t){return"["+Error.prototype.toString.call(t)+"]"}function d(t,e,r,n,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),j(n,i)||(a="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=p(r)?l(t,u.value,null):l(t,u.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),b(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function h(t){return Array.isArray(t)}function g(t){return"boolean"==typeof t}function p(t){return null===t}function m(t){return"number"==typeof t}function y(t){return"string"==typeof t}function b(t){return void 0===t}function w(t){return _(t)&&"[object RegExp]"===O(t)}function _(t){return"object"==typeof t&&null!==t}function v(t){return _(t)&&"[object Date]"===O(t)}function E(t){return _(t)&&("[object Error]"===O(t)||t instanceof Error)}function S(t){return"function"==typeof t}function O(t){return Object.prototype.toString.call(t)}function T(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(r){if(b(o)&&(o=t.env.NODE_DEBUG||""),r=r.toUpperCase(),!a[r])if(new RegExp("\\b"+r+"\\b","i").test(o)){var n=t.pid;a[r]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",r,n,t)}}else a[r]=function(){};return a[r]},e.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=h,e.isBoolean=g,e.isNull=p,e.isNullOrUndefined=function(t){return null==t},e.isNumber=m,e.isString=y,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=b,e.isRegExp=w,e.isObject=_,e.isDate=v,e.isError=E,e.isFunction=S,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(294);var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function M(){var t=new Date,e=[T(t.getHours()),T(t.getMinutes()),T(t.getSeconds())].join(":");return[t.getDate(),A[t.getMonth()],e].join(" ")}function j(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",M(),e.format.apply(e,arguments))},e.inherits=r(295),e._extend=function(t,e){if(!e||!_(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t};var I="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function R(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(I&&t[I]){var e;if("function"!=typeof(e=t[I]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,I,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,n=new Promise((function(t,n){e=t,r=n})),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push((function(t,n){t?r(t):e(n)}));try{t.apply(this,i)}catch(t){r(t)}return n}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),I&&Object.defineProperty(e,I,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,n(t))},e.promisify.custom=I,e.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function r(){for(var r=[],n=0;n<arguments.length;n++)r.push(arguments[n]);var i=r.pop();if("function"!=typeof i)throw new TypeError("The last argument must be of type Function");var o=this,a=function(){return i.apply(o,arguments)};e.apply(this,r).then((function(e){t.nextTick(a,null,e)}),(function(e){t.nextTick(R,e,a)}))}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),Object.defineProperties(r,n(e)),r}}).call(this,r(20))},function(t,e,r){"use strict";(function(e,n){var i=r(17).Buffer,o=e.crypto||e.msCrypto;o&&o.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError("requested too many random bytes");var r=i.allocUnsafe(t);if(t>0)if(t>65536)for(var a=0;a<t;a+=65536)o.getRandomValues(r.slice(a,a+65536));else o.getRandomValues(r);if("function"==typeof e)return n.nextTick((function(){e(null,r)}));return r}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,r(24),r(20))},function(t,e,r){"use strict";var n={};function i(t,e,r){r||(r=Error);var i=function(t){var r,n;function i(r,n,i){return t.call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,n,i))||this}return n=t,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=t,n[t]=i}function o(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}i("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,i,a,s;if("string"==typeof e&&(i="not ",e.substr(!a||a<0?0:+a,i.length)===i)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(n," ").concat(o(e,"type"));else{var u=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(u," ").concat(n," ").concat(o(e,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},function(t,e,r){"use strict";(function(e){var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=c;var i=r(186),o=r(190);r(11)(c,i);for(var a=n(o.prototype),s=0;s<a.length;s++){var u=a[s];c.prototype[u]||(c.prototype[u]=o.prototype[u])}function c(t){if(!(this instanceof c))return new c(t);i.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",l)))}function l(){this._writableState.ended||e.nextTick(f,this)}function f(t){t.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this,r(20))},function(t,e,r){var n=r(17).Buffer;function i(t,e){this._block=n.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=n.from(t,e));for(var r=this._block,i=this._blockSize,o=t.length,a=this._len,s=0;s<o;){for(var u=a%i,c=Math.min(o-s,i-u),l=0;l<c;l++)r[u+l]=t[s+l];s+=c,(a+=c)%i==0&&this._update(r)}return this._len+=o,this},i.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=i},function(t,e,r){"use strict";var n={};function i(t,e,r){r||(r=Error);var i=function(t){var r,n;function i(r,n,i){return t.call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,n,i))||this}return n=t,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=t,n[t]=i}function o(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}i("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,i,a,s;if("string"==typeof e&&(i="not ",e.substr(!a||a<0?0:+a,i.length)===i)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(n," ").concat(o(e,"type"));else{var u=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(u," ").concat(n," ").concat(o(e,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},function(t,e,r){"use strict";(function(e){var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=c;var i=r(211),o=r(215);r(11)(c,i);for(var a=n(o.prototype),s=0;s<a.length;s++){var u=a[s];c.prototype[u]||(c.prototype[u]=o.prototype[u])}function c(t){if(!(this instanceof c))return new c(t);i.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",l)))}function l(){this._writableState.ended||e.nextTick(f,this)}function f(t){t.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this,r(20))},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(0);function i(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(n.a)(t),r=e.getFullYear(),i=e.getMonth(),o=new Date(0);return o.setFullYear(r,i+1,0),o.setHours(0,0,0,0),o.getDate()}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(3),i=r(0),o=r(48);function a(t,e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var r=Object(i.a)(t,e),a=r.getUTCFullYear(),s=e||{},u=s.locale,c=u&&u.options&&u.options.firstWeekContainsDate,l=null==c?1:Object(n.a)(c),f=null==s.firstWeekContainsDate?l:Object(n.a)(s.firstWeekContainsDate);if(!(f>=1&&f<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var d=new Date(0);d.setUTCFullYear(a+1,0,f),d.setUTCHours(0,0,0,0);var h=Object(o.a)(d,e),g=new Date(0);g.setUTCFullYear(a,0,f),g.setUTCHours(0,0,0,0);var p=Object(o.a)(g,e);return r.getTime()>=h.getTime()?a+1:r.getTime()>=p.getTime()?a:a-1}},function(t,e,r){"use strict";function n(t){let e={running:null,queue:[]};function r(){if(e.queue.length>0){const t=e.queue.shift();n(t.args,t.resolve,t.reject)}else e.running=null}function n(n,i,o){e.running=t(...n),e.running.then(t=>{r(),i(t)},t=>{r(),o(t)})}return(...t)=>e.running?new Promise((r,n)=>{e.queue.push({resolve:r,reject:n,args:t})}):new Promise((e,r)=>n(t,e,r))}function i(t){let e=null;return(...r)=>e||(e=t(...r).finally(()=>{e=null}),e)}r.r(e),r.d(e,"sequential",(function(){return n})),r.d(e,"once",(function(){return i}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return Ct}));class n extends Error{}let i;class o{constructor(t,e){if(this.duration=e&&e.duration||0,this.generators=e&&e.generators&&e.generators.slice()||[],!Number.isInteger(this.duration)||this.duration<0)throw new n("duration must be a non-negative integer")}static set adapter(t){if(i)throw new Error(`"${i.name}" has already been configured.`);i=t}static get adapter(){if(!i)throw new Error("No date adapter has been configured. See rSchedule docs.");return i}static isDate(t){throw a("isDate()")}static fromDate(t,e){throw a("fromDate()")}static fromJSON(t){throw a("fromJSON()")}static fromDateTime(t){throw a("fromDateTime()")}toISOString(){return this.set("timezone","UTC").toDateTime().toISOString()}toDateTime(){return c.fromJSON(Object.assign(Object.assign({},this.toJSON()),{generators:this.generators}))}}function a(t){return new Error(`You must implement the "${t}" method for this DateAdapter class`)}var s;o.hasTimezoneSupport=!1,function(t){t.WEEKDAYS=["SU","MO","TU","WE","TH","FR","SA"],t.MILLISECONDS_IN_SECOND=1e3,t.MILLISECONDS_IN_MINUTE=60*t.MILLISECONDS_IN_SECOND,t.MILLISECONDS_IN_HOUR=60*t.MILLISECONDS_IN_MINUTE,t.MILLISECONDS_IN_DAY=24*t.MILLISECONDS_IN_HOUR,t.MILLISECONDS_IN_WEEK=7*t.MILLISECONDS_IN_DAY}(s||(s={}));class u extends Error{}class c{constructor(t,e,r,n){if(this.date=new Date(t),this.timezone=e||null,this.duration=r||0,this.generators=n&&n.slice()||[],!Number.isInteger(this.duration)||this.duration<0)throw new u("duration must be a non-negative integer");this.assertIsValid()}static fromJSON(t){const e=new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond));return new c(e,t.timezone,t.duration,t.generators)}static fromDateAdapter(t){return c.fromJSON(Object.assign(Object.assign({},t.toJSON()),{generators:t.generators}))}get end(){if(this.duration)return this._end||(this._end=this.add(this.duration,"millisecond")),this._end}isEqual(t){return!!t&&(l(this,t),this.valueOf()===t.valueOf())}isBefore(t){return l(this,t),this.valueOf()<t.valueOf()}isBeforeOrEqual(t){return l(this,t),this.valueOf()<=t.valueOf()}isAfter(t){return l(this,t),this.valueOf()>t.valueOf()}isAfterOrEqual(t){return l(this,t),this.valueOf()>=t.valueOf()}isOccurring(t){if(!this.duration)throw new Error("DateTime#isOccurring() is only applicable to DateTimes with durations");return l(this,t),t.isAfterOrEqual(this)&&t.isBeforeOrEqual(this.add(this.duration,"millisecond"))}add(t,e){switch(e){case"generator":{const e=this.generators.slice();return e.unshift(t),new c(this.date,this.timezone,this.duration,e)}case"year":return this.forkDateTime(v(this.date,t));case"month":return this.forkDateTime(E(this.date,t));case"week":return this.forkDateTime(S(this.date,t));case"day":return this.forkDateTime(O(this.date,t));case"hour":return this.forkDateTime(T(this.date,t));case"minute":return this.forkDateTime(A(this.date,t));case"second":return this.forkDateTime(M(this.date,t));case"millisecond":return this.forkDateTime(j(this.date,t));default:throw new Error("Invalid unit provided to `DateTime#add`")}}subtract(t,e){switch(e){case"year":return this.forkDateTime(function(t,e){return v(t,-e)}(this.date,t));case"month":return this.forkDateTime(function(t,e){return E(t,-e)}(this.date,t));case"week":return this.forkDateTime(function(t,e){return S(t,-e)}(this.date,t));case"day":return this.forkDateTime(I(this.date,t));case"hour":return this.forkDateTime(function(t,e){return T(t,-e)}(this.date,t));case"minute":return this.forkDateTime(function(t,e){return A(t,-e)}(this.date,t));case"second":return this.forkDateTime(function(t,e){return M(t,-e)}(this.date,t));case"millisecond":return this.forkDateTime(function(t,e){return j(t,-e)}(this.date,t));default:throw new Error("Invalid unit provided to `DateTime#subtract`")}}get(t){switch(t){case"year":return this.date.getUTCFullYear();case"month":return this.date.getUTCMonth()+1;case"yearday":return function(t){const e=new Date(Date.UTC(t.getUTCFullYear(),0,1)),r=t.valueOf()-e.valueOf();return 1+Math.floor(r/s.MILLISECONDS_IN_DAY)}(this.date);case"weekday":return s.WEEKDAYS[this.date.getUTCDay()];case"day":return this.date.getUTCDate();case"hour":return this.date.getUTCHours();case"minute":return this.date.getUTCMinutes();case"second":return this.date.getUTCSeconds();case"millisecond":return this.date.getUTCMilliseconds();default:throw new Error("Invalid unit provided to `DateTime#set`")}}set(t,e){if("duration"===t)return new c(this.date,this.timezone,e,this.generators);if("generators"===t)return new c(this.date,this.timezone,this.duration,e);let r=new Date(this.date);switch(t){case"year":r.setUTCFullYear(e);break;case"month":{const t=m(e,r.getUTCFullYear());r.getUTCDate()>t?(r.setUTCDate(1),r.setUTCMonth(e),r=I(r,1)):r.setUTCMonth(e-1);break}case"day":r.setUTCDate(e);break;case"hour":r.setUTCHours(e);break;case"minute":r.setUTCMinutes(e);break;case"second":r.setUTCSeconds(e);break;case"millisecond":r.setUTCMilliseconds(e);break;default:throw new Error("Invalid unit provided to `DateTime#set`")}return this.forkDateTime(r)}granularity(t,e={}){let r=this.forkDateTime(this.date);switch(t){case"year":r=r.set("month",1);case"month":r=r.set("day",1);break;case"week":r=function(t,e){const r=h(e).indexOf(t.get("weekday"));return t.subtract(r,"day")}(r,e.weekStart)}switch(t){case"year":case"month":case"week":case"day":r=r.set("hour",0);case"hour":r=r.set("minute",0);case"minute":r=r.set("second",0);case"second":r=r.set("millisecond",0);case"millisecond":return r;default:throw new Error("Invalid granularity provided to `DateTime#granularity`: "+t)}}endGranularity(t,e={}){let r=this.forkDateTime(this.date);switch(t){case"year":r=r.set("month",12);case"month":r=r.set("day",m(r.get("month"),r.get("year")));break;case"week":r=function(t,e){const r=h(e).indexOf(t.get("weekday"));return t.add(6-r,"day")}(r,e.weekStart)}switch(t){case"year":case"month":case"week":case"day":r=r.set("hour",23);case"hour":r=r.set("minute",59);case"minute":r=r.set("second",59);case"second":r=r.set("millisecond",999);case"millisecond":return r;default:throw new Error("Invalid granularity provided to `DateTime#granularity`: "+t)}}toISOString(){return this.date.toISOString()}toDateTime(){return this}toJSON(){const t={timezone:this.timezone,year:this.get("year"),month:this.get("month"),day:this.get("day"),hour:this.get("hour"),minute:this.get("minute"),second:this.get("second"),millisecond:this.get("millisecond")};return this.duration&&(t.duration=this.duration),t}valueOf(){return this.date.valueOf()}assertIsValid(){if(isNaN(this.valueOf()))throw new u("DateTime has invalid date.");return!0}forkDateTime(t){return new c(t,this.timezone,this.duration,this.generators)}}function l(t,e){if(t.timezone!==e.timezone)throw new u("Attempted to compare a datetime to another date in a different timezone: "+JSON.stringify(t)+" and "+JSON.stringify(e));return!0}function f(t,e){if(t.isAfter(e))return 1;if(t.isBefore(e))return-1;if(t.duration&&e.duration){if(t.duration>e.duration)return 1;if(t.duration<e.duration)return-1}return 0}function d(t){return Array.from(new Map(t.map(t=>[t.toISOString(),t])).values())}function h(t="SU"){const e=s.WEEKDAYS.slice();let r=e.indexOf(t);for(;0!==r;)g(e),r--;return e}function g(t,e="first"){return 0===t.length||("first"===e?t.push(t.shift()):t.unshift(t.pop())),t}function p(t,e){if(t===e)return 0;const r=s.WEEKDAYS.indexOf(t)-s.WEEKDAYS.indexOf(e);return r>0?7-r:Math.abs(r)}function m(t,e){return{1:31,2:y(e),3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31}[t]}function y(t){return b(t)?29:28}function b(t){return t%400==0||t%4==0&&t%100!=0}function w(t){if(null===t||!0===t||!1===t)return NaN;const e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}function _(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");const r=t.valueOf(),n=w(e);return new Date(r+n)}function v(t,e){return E(t,12*w(e))}function E(t,e){const r=w(e),n=(t=new Date(t)).getUTCMonth()+r,i=new Date(0);i.setUTCFullYear(t.getUTCFullYear(),n,1),i.setUTCHours(0,0,0,0);const o=m(i.getUTCMonth()+1,i.getUTCFullYear());return t.setUTCMonth(n,Math.min(o,t.getUTCDate())),t}function S(t,e){return O(t,7*w(e))}function O(t,e){return j(t,w(e)*s.MILLISECONDS_IN_DAY)}function T(t,e){return _(t,w(e)*s.MILLISECONDS_IN_HOUR)}function A(t,e){return _(t,w(e)*s.MILLISECONDS_IN_MINUTE)}function M(t,e){return _(t,w(e)*s.MILLISECONDS_IN_SECOND)}function j(t,e){const r=w(e),n=t.getTime();return new Date(n+r)}function I(t,e){return O(t,-e)}class R extends Error{}class D extends Error{}function k(t,e){return t>e?1:e>t?-1:0}function N(t){return JSON.parse(JSON.stringify(t))}function C(t,e){return t instanceof c?t.timezone!==e?o.adapter.fromDateTime(t).set("timezone",e).toDateTime():t:t instanceof o?t.set("timezone",e).toDateTime():o.adapter.fromDate(t).set("timezone",e).toDateTime()}function x(t,e){return t.timezone!==e?o.adapter.fromDateTime(t).set("timezone",e).toDateTime():t}class L extends Error{}function P(t,e){const r=function(t){let e,r;if(t.start instanceof c)e=t.start;else if(t.start instanceof o)e=t.start.toDateTime();else{if(!o.adapter.isDate(t.start))throw new L('"start" must be either a `DateAdapter` instance or an instance of the date a DateAdapter is wrapping (e.g. `StandardDateAdapter` wraps a `Date`)');e=o.adapter.fromDate(t.start).toDateTime()}if(t.end)if(t.end instanceof c)r=t.end;else if(t.end instanceof o)r=t.end.toDateTime();else{if(!o.adapter.isDate(t.end))throw new L('"end" must be either be `undefined`, a `DateAdapter` instance, or an instance of the date a DateAdapter is wrapping (e.g. `StandardDateAdapter` wraps a `Date`)');r=o.adapter.fromDate(t.end).toDateTime()}if(void 0!==t.duration){if(!Number.isInteger(t.duration))throw new L('"duration" expects a whole number');if(t.duration<=0)throw new L('"duration" must be greater than 0')}if(void 0!==t.count){if(!Number.isInteger(t.count))throw new L('"count" must be a whole number');if(t.count<0)throw new L('"count" must be greater than 0')}if(void 0!==t.end&&void 0!==t.count)throw new L('"end" and "count" cannot both be present');return{start:e,end:r,count:t.count,duration:t.duration}}(e),n=N(e);return t.forEach(t=>{t.normalizeOptions(n,r)}),Object.keys(r).forEach(t=>{void 0===r[t]&&delete r[t]}),r}function B(t){const e=N(t);return e.start=t.start,t.end&&(e.end=t.end),e}class U extends Error{}class F{constructor(t){this.date=t}}class W{constructor(t){this.date=t}}class H{constructor(t,e,r){this.options=e,this.args=r,this.rules=[],this.iterator=void 0===this.options.count?this.iterate():this.args.reverse?this.iterateWithReverseCount():this.iterateWithCount(),this.options=Object.assign(Object.assign({},N(e)),{start:e.start,end:e.end}),this.reverse=void 0===this.options.count&&r.reverse||!1;const n=this.normalizeDateTimeArgs(r),i=n.start,o=n.end;if(void 0!==e.count?this.start=e.start:i&&e.start?this.start=i.isAfterOrEqual(e.start)?i:e.start:this.start=i||e.start,o&&e.end?this.end=o.isBeforeOrEqual(e.end)?o:e.end:this.end=o||e.end,this.args.reverse&&void 0===e.count&&!this.end)throw new Error("When iterating in reverse, the rule must have an `end` or `count` property or you must provide an `end` argument.");this.isInfinite=!this.end&&void 0===this.options.count,this.hasDuration=!!this.options.duration,this.rules=Array.isArray(t)?t:t(this)}[Symbol.iterator](){return this.iterator}next(t){return this.iterator.next(t)}*iterateWithReverseCount(){let t;const e=Array.from(this.iterateWithCount()).reverse().slice();let r=e.shift();for(;r;)if(t&&t.skipToDate&&r.isAfter(t.skipToDate))r=e.shift();else{if(t=yield r,t&&t.skipToDate&&t.skipToDate.isAfterOrEqual(r))throw new Error("A provided `skipToDate` option must be greater than the last yielded date (or smaller, in the case of reverse iteration)");r=e.shift()}}*iterateWithCount(){if(0===this.options.count)return;const t=this.iterate(),e=this.args.start||this.start;let r,n=t.next().value,i=1;for(;n&&i<=this.options.count;)if(i++,n.isBefore(e))n=t.next().value;else if(r&&r.skipToDate&&n.isBefore(r.skipToDate))n=t.next().value;else{if(r=yield n,r&&r.skipToDate&&r.skipToDate.isBeforeOrEqual(n))throw new Error("A provided `skipToDate` option must be greater than the last yielded date (or smaller, in the case of reverse iteration)");n=t.next().value}}*iterate(){let t=this.start;this.reverse&&(t=this.end);let e=this.nextDate(t);for(;e;){const t=yield this.normalizeRunOutput(e);if(t&&t.skipToDate){if(this.reverse?t.skipToDate.isAfterOrEqual(e):t.skipToDate.isBeforeOrEqual(e))throw new Error("A provided `skipToDate` option must be greater than the last yielded date (or smaller, in the case of reverse iteration)");e=this.nextDate(t.skipToDate)}else e=this.nextDate(this.reverse?e.subtract(1,"millisecond"):e.add(1,"millisecond"))}}nextDate(t){let e=this.runRules(t.set("generators",[]));if(this.isDatePastEnd(e.date))return null;let r=0;for(;e instanceof W&&r<50;){if(e=this.runRules(e.date),this.isDatePastEnd(e.date))return null;r++}if(e instanceof W)throw new U(`Failed to find a matching occurrence in ${r} iterations. Last iterated date: "${e.date.toISOString()}"`);if(this.reverse?t.isBefore(e.date):t.isAfter(e.date))throw new U("An error occurred in a recurrence rule. If this happened using the rSchedule provided recurrence rules, you should open an issue in the rSchedule repo. The maintainer is going to want to know how to recreate the error.");return e.date}runRules(t){let e=new F(t);for(const t of this.rules){if(e instanceof W)return e;e=t.run(e.date)}return e}isDatePastEnd(t){return this.reverse?t.isBefore(this.start):this.end&&t.isAfter(this.end)}normalizeRunOutput(t){return this.hasDuration?t.set("duration",this.options.duration):t}normalizeDateTimeArgs(t){return{start:t.start&&x(t.start,this.options.start.timezone),end:t.end&&x(t.end,this.options.start.timezone)}}}class q{constructor(t={}){this.timezone=void 0!==t.timezone?t.timezone:null,this.maxDuration=t.maxDuration||0}get firstDate(){if(void 0!==this._firstDate)return this._firstDate;const t=this._run().next().value;return this._firstDate=t?this.dateAdapter.fromDateTime(t):null,this._firstDate}get lastDate(){if(void 0!==this._lastDate)return this._lastDate;if(this.isInfinite)return this._lastDate=null,null;const t=this._run({reverse:!0}).next().value;return this._lastDate=t?this.dateAdapter.fromDateTime(t):null,this._lastDate}pipe(...t){return t.reduce((t,e)=>e({base:t,timezone:this.timezone}),this)}occurrences(t={}){return new z(this,this.normalizeOccurrencesArgs(t))}collections(t={}){return new Y(this,this.normalizeCollectionsArgs(t))}occursBetween(t,e,r={}){const n=this.normalizeDateInput(t),i=this.normalizeDateInput(e);if(this.hasDuration&&!r.excludeEnds){const t=this.getMaxDuration("occursBetween",r),e=this._run({start:n.subtract(t,"millisecond"),end:i,reverse:!0});for(const t of e)if(!t.end.isBefore(n))return!0;return!1}for(const t of this._run({start:n,end:i})){if(r.excludeEnds){if(t.isEqual(n))continue;if(t.isEqual(i))break}return!0}return!1}occursOn(t){const e=this.normalizeOccursOnArgs(t);if(e.weekday){if(this.isInfinite&&!e.before)throw new R("When calling `occursOn()` with a `weekday` argument and an occurrence object that has infinite occurrences, you must include a `before` argument as well.");const t=e.after&&(e.excludeEnds?e.after.add(1,"day"):e.after),r=e.before&&(e.excludeEnds?e.before.subtract(1,"day"):e.before),n=this._run({start:t,end:r});let i=n.next().value;if(!i)return!1;for(;i;){if(i.get("weekday")===e.weekday)return!0;i=n.next({skipToDate:i.add(p(i.get("weekday"),e.weekday),"day").granularity("day")}).value}return!1}if(!e.date)throw new R('"occursOn()" must be called with either a "date" or "weekday" argument');if(this.hasDuration){const t=this.getMaxDuration("occursOn",e),r=this._run({start:e.date.subtract(t,"millisecond"),end:e.date});for(const t of r)if(!t.end.isBefore(e.date))return!t.isAfter(e.date);return!1}for(const t of this._run({start:e.date,end:e.date}))return!!t;return!1}occursAfter(t,e={}){const r=this.normalizeDateInput(t);if(this.hasDuration&&!e.excludeStart){const t=this.getMaxDuration("occursAfter",e),n=this._run({start:r.subtract(t,"millisecond")});for(const t of n)if(!t.end.isBefore(r))return!0;return!1}for(const t of this._run({start:r}))if(!e.excludeStart||!t.isEqual(r))return!0;return!1}occursBefore(t,e={}){const r=this.normalizeDateInput(t);if(this.hasDuration&&e.excludeStart){for(const t of this._run({end:r,reverse:!0}))if(!t.end.isAfterOrEqual(r))return!0;return!1}for(const t of this._run({end:r,reverse:!0}))if(!e.excludeStart||!t.isEqual(r))return!0;return!1}get dateAdapter(){return o.adapter}normalizeOccurrencesArgs(t){return Object.assign(Object.assign({},t),{start:this.normalizeDateInput(t.start),end:this.normalizeDateInput(t.end)})}normalizeCollectionsArgs(t){if(void 0!==t.reverse)throw new R("`collections()` does not support the `reverse` option at this time.");return Object.assign(Object.assign({},t),{start:this.normalizeDateInput(t.start),end:this.normalizeDateInput(t.end)})}normalizeOccursOnArgs(t={}){return Object.assign(Object.assign({},t),{date:this.normalizeDateInput(t.date),after:this.normalizeDateInput(t.after),before:this.normalizeDateInput(t.before),excludeDates:t.excludeDates&&t.excludeDates.map(t=>this.normalizeDateInput(t))})}normalizeRunArgs(t){return Object.assign(Object.assign({},t),{start:this.normalizeDateInput(t.start),end:this.normalizeDateInput(t.end)})}normalizeDateInput(t){return t?C(t,this.timezone):void 0}normalizeDateInputToAdapter(t){if(t)return function(t){return t instanceof c?o.adapter.fromDateTime(t):t instanceof o?t:o.adapter.fromDate(t)}(t)}normalizeRunOutput(t){return x(t,this.timezone)}getMaxDuration(t,e){const r=e.maxDuration||this.maxDuration;if(!Number.isInteger(r))throw new R(`When an occurrence generator has a duration, a 'maxDuration' argument must be supplied to ${t}().`);return r}}class z{constructor(t,e){this.iterable=t,this.args=e,this[Symbol.iterator]=()=>this.occurrenceIterator(),this.iterator=t._run(e),this.isInfinite=t.isInfinite}next(t){return this.occurrenceIterator(t).next()}toArray(){if(this.args.end||this.args.take||!this.isInfinite)return Array.from(this.occurrenceIterator());throw new D("OccurrenceIterator#toArray() can only be called if the iterator is not infinite, or you provide and `end` argument, or you provide a `take` argument.")}*occurrenceIterator(t){let e=this.normalizeRunArgs(t),r=this.iterator.next(e).value;for(;r;){const t=yield this.normalizeDateOutput(r);e=this.normalizeRunArgs(t),r=this.iterator.next(e).value}}normalizeRunArgs(t){return{skipToDate:this.normalizeDateInput(t&&t.skipToDate)}}normalizeDateInput(t){return t?C(t,this.iterable.timezone):void 0}normalizeDateOutput(t){if(t)return t?o.adapter.fromDateTime(t):void 0}}class V{constructor(t=[],e,r,n){this.dates=t,this.granularity=e,this.periodStart=r,this.periodEnd=n}}class Y{constructor(t,e){if(this.iterable=t,this.args=e,this.granularity="year",this[Symbol.iterator]=()=>this.iterator,e.granularity&&(this.granularity=e.granularity,"week"===this.granularity&&!e.weekStart))throw new Error('"week" granularity requires `weekStart` arg');if(e.weekStart&&(this.weekStart=e.weekStart),e.reverse)throw new Error("`OccurrenceGenerator#collections()` does not support iterating in reverse. Though `OccurrenceGenerator#occurrences()` does support iterating in reverse.");this.args=Object.assign(Object.assign({},e),{start:e.start||t._run().next().value,end:e.end&&this.getPeriod(e.end).end}),this.startDate=this.args.start&&this.normalizeDateOutput(this.getPeriod(this.args.start).start)||null,this.iterator=this.collectionIterator()}next(){return this.iterator.next()}toArray(){if(this.args.end||this.args.take||!this.iterable.isInfinite){const t=[];for(const e of this.collectionIterator())t.push(e);return t}throw new D("CollectionIterator#toArray() can only be called if the iterator is not infinite, or you provide and `end` argument, or you provide a `take` argument.")}normalizeDateOutput(t){if(t)return o.adapter.fromDateTime(t)}*collectionIterator(){if(!this.startDate)return;let t=this.occurrenceIterator(),e=t.next().value;if(!e)return;let r=this.getPeriod(this.args.start),n=[],i=0;for(;e&&(void 0===this.args.take||this.args.take>i);){for(;e&&e.isBeforeOrEqual(r.end);)n.push(e),e=t.next().value;if(yield new V(n.map(t=>this.normalizeDateOutput(t)),this.granularity,this.normalizeDateOutput(r.start),this.normalizeDateOutput(r.end)),!e)return;n=[],r=this.args.skipEmptyPeriods?this.getPeriod(e):this.getPeriod(this.incrementPeriod(r.period)),"month"===this.granularity&&this.weekStart&&(t=this.iterable._run({start:r.start,end:this.args.end}),e=t.next().value),i++}}getPeriod(t){let e,r,n;return"month"===this.granularity&&this.weekStart?(e=t.granularity("month").granularity("week",{weekStart:this.weekStart}),r=t.endGranularity("month").endGranularity("week",{weekStart:this.weekStart}),n=t.granularity("month")):(e=t.granularity(this.granularity,{weekStart:this.weekStart}),r=t.endGranularity(this.granularity,{weekStart:this.weekStart}),n=e),{start:e,end:r,period:n}}incrementPeriod(t){return t.add(1,this.granularity)}occurrenceIterator(){let t=this.args.start||this.iterable._run().next().value;return t?(t=this.getPeriod(t).start,this.iterable._run({start:t,end:this.args.end})):this.iterable._run(this.args)}}class G extends q{constructor(t,e){super(e),this.streams=t,this.config=e,this.timezone=e.timezone,this.streams=t.map(t=>t instanceof G?t:t.set("timezone",this.timezone)),this.isInfinite=this.calculateIsInfinite(),this.hasDuration=this.calculateHasDuration()}normalizeDateInput(t){if(t)return C(t,this.timezone)}normalizeRunOutput(t){return x(t,this.timezone)}}class ${constructor(t,e){this.runArgs=e,this.stream=t._run(this.runArgs),this.next()}next(t){const e=this.stream.next(t),r=e.done,n=e.value;return this.done="boolean"!=typeof r||r,this.value=n,{done:r,value:n}}}function K(t,e={},r={}){if(r.skipToDate&&0!==t.length){if(e.reverse?t.every(t=>t.value.isBeforeOrEqual(r.skipToDate)):t.every(t=>t.value.isAfterOrEqual(r.skipToDate)))throw new Error("A provided `skipToDate` option must be greater than the last yielded date (or smaller, in the case of reverse iteration)");for(const n of t)n.done||(e.reverse?n.value.isBeforeOrEqual(r.skipToDate):n.value.isAfterOrEqual(r.skipToDate))||n.next(r)}}function Z(t,e){return t.done&&e.done?0:t.done?1:e.done?-1:t.value.isAfter(e.value)?1:-1}function J(t,e){return t.done&&e.done?0:t.done?-1:e.done?1:t.value.isAfter(e.value)?-1:1}function X(t,e={},r={}){return K(t,e,r),t.sort(e.reverse?J:Z).filter(t=>!t.done).shift()}function Q(...t){return e=>new tt(t,e)}class tt extends G{set(t,e){return new tt(this.streams.map(t=>t.set("timezone",e)),Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",e),timezone:e}))}*_run(t={}){const e=this.streams.map(e=>new $(e,t));if(this.config.base&&e.push(new $(this.config.base,t)),0===e.length)return;let r=X(e,t);for(;r&&!r.done;){const n=yield this.normalizeRunOutput(r.value);n&&n.skipToDate||r.next(),r=X(e,t,n)}}calculateIsInfinite(){return this.config.base&&this.config.base.isInfinite||this.streams.some(t=>t.isInfinite)}calculateHasDuration(){const t=this.streams.every(t=>t.hasDuration);return this.config.base?this.config.base.hasDuration&&t:t}}class et extends q{constructor(t={}){super(t),this.adapters=[],this.isInfinite=!1,this.maxDuration=0,this.datetimes=[],this.data=t.data,t.dates&&(this.adapters=t.dates.map(e=>{let r=this.normalizeDateInputToAdapter(e);return t.duration&&!r.duration&&(r=r.set("duration",t.duration)),r.set("timezone",this.timezone)}),this.datetimes=this.adapters.map(t=>t.toDateTime())),this.hasDuration=this.datetimes.every(t=>!!t.duration),this.hasDuration&&(this.maxDuration=this.adapters.reduce((t,e)=>e.duration>t?e.duration:t,0))}get length(){return this.adapters.length}get firstDate(){return this.adapters[0]||null}get lastDate(){return this.adapters[this.length-1]||null}occurrences(t={}){return new z(this,this.normalizeOccurrencesArgs(t))}collections(t={}){return new Y(this,this.normalizeCollectionsArgs(t))}add(t){return new et({dates:[...this.adapters,t],timezone:this.timezone,data:this.data})}remove(t){const e=this.adapters.slice(),r=this.normalizeDateInputToAdapter(t),n=e.findIndex(t=>t.valueOf()===r.valueOf());return n>=0&&e.splice(n,1),new et({dates:e,timezone:this.timezone,data:this.data})}set(t,e,r={}){let n=this.timezone,i=this.adapters.slice();if("timezone"===t){if(e===this.timezone)return this;r.keepLocalTime&&(i=this.adapters.map(t=>{const r=t.toJSON();return r.timezone=e,this.dateAdapter.fromJSON(r)})),n=e}else if("dates"===t)i=e;else{if("duration"!==t)throw new R(`Unexpected prop argument "${t}". Accepted values are "timezone" or "dates"`);i=i.map(t=>t.set("duration",e||0))}return new et({dates:i,data:this.data,timezone:n})}filter(t){return new et({dates:this.adapters.filter(t),data:this.data,timezone:this.timezone})}*_run(t={}){let e=this.datetimes.sort(f);t.start&&(e=e.filter(e=>e.isAfterOrEqual(t.start))),t.end&&(e=e.filter(e=>e.isBeforeOrEqual(t.end))),t.reverse&&(e=e.slice().reverse()),t.take&&(e=e.slice(0,t.take));const r=e.slice();let n,i=r.shift();for(;i;)if(n&&n.skipToDate&&(t.reverse?n.skipToDate.isBefore(i):n.skipToDate.isAfter(i)))i=r.shift();else{if(i=i.add(this,"generator"),n=yield this.normalizeRunOutput(i),n&&n.skipToDate&&(t.reverse?n.skipToDate.isAfterOrEqual(i):n.skipToDate.isBeforeOrEqual(i)))throw new Error("A provided `skipToDate` option must be greater than the last yielded date (or smaller, in the case of reverse iteration)");i=r.shift()}}}class rt extends Error{}let nt;class it{constructor(t,e){if(this.duration=e&&e.duration||0,this.generators=e&&e.generators&&e.generators.slice()||[],!Number.isInteger(this.duration)||this.duration<0)throw new rt("duration must be a non-negative integer")}static set adapter(t){if(nt)throw new Error(`"${nt.name}" has already been configured.`);nt=t}static get adapter(){if(!nt)throw new Error("No date adapter has been configured. See rSchedule docs.");return nt}static isDate(t){throw ot("isDate()")}static fromDate(t,e){throw ot("fromDate()")}static fromJSON(t){throw ot("fromJSON()")}static fromDateTime(t){throw ot("fromDateTime()")}toISOString(){return this.set("timezone","UTC").toDateTime().toISOString()}toDateTime(){return ut.fromJSON(Object.assign(Object.assign({},this.toJSON()),{generators:this.generators}))}}function ot(t){return new Error(`You must implement the "${t}" method for this DateAdapter class`)}var at;it.hasTimezoneSupport=!1,function(t){t.WEEKDAYS=["SU","MO","TU","WE","TH","FR","SA"],t.MILLISECONDS_IN_SECOND=1e3,t.MILLISECONDS_IN_MINUTE=60*t.MILLISECONDS_IN_SECOND,t.MILLISECONDS_IN_HOUR=60*t.MILLISECONDS_IN_MINUTE,t.MILLISECONDS_IN_DAY=24*t.MILLISECONDS_IN_HOUR,t.MILLISECONDS_IN_WEEK=7*t.MILLISECONDS_IN_DAY}(at||(at={}));class st extends Error{}class ut{constructor(t,e,r,n){if(this.date=new Date(t),this.timezone=e||null,this.duration=r||0,this.generators=n&&n.slice()||[],!Number.isInteger(this.duration)||this.duration<0)throw new st("duration must be a non-negative integer");this.assertIsValid()}static fromJSON(t){const e=new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond));return new ut(e,t.timezone,t.duration,t.generators)}static fromDateAdapter(t){return ut.fromJSON(Object.assign(Object.assign({},t.toJSON()),{generators:t.generators}))}get end(){if(this.duration)return this._end||(this._end=this.add(this.duration,"millisecond")),this._end}isEqual(t){return!!t&&(ct(this,t),this.valueOf()===t.valueOf())}isBefore(t){return ct(this,t),this.valueOf()<t.valueOf()}isBeforeOrEqual(t){return ct(this,t),this.valueOf()<=t.valueOf()}isAfter(t){return ct(this,t),this.valueOf()>t.valueOf()}isAfterOrEqual(t){return ct(this,t),this.valueOf()>=t.valueOf()}isOccurring(t){if(!this.duration)throw new Error("DateTime#isOccurring() is only applicable to DateTimes with durations");return ct(this,t),t.isAfterOrEqual(this)&&t.isBeforeOrEqual(this.add(this.duration,"millisecond"))}add(t,e){switch(e){case"generator":{const e=this.generators.slice();return e.unshift(t),new ut(this.date,this.timezone,this.duration,e)}case"year":return this.forkDateTime(mt(this.date,t));case"month":return this.forkDateTime(yt(this.date,t));case"week":return this.forkDateTime(bt(this.date,t));case"day":return this.forkDateTime(wt(this.date,t));case"hour":return this.forkDateTime(_t(this.date,t));case"minute":return this.forkDateTime(vt(this.date,t));case"second":return this.forkDateTime(Et(this.date,t));case"millisecond":return this.forkDateTime(St(this.date,t));default:throw new Error("Invalid unit provided to `DateTime#add`")}}subtract(t,e){switch(e){case"year":return this.forkDateTime(function(t,e){return mt(t,-e)}(this.date,t));case"month":return this.forkDateTime(function(t,e){return yt(t,-e)}(this.date,t));case"week":return this.forkDateTime(function(t,e){return bt(t,-e)}(this.date,t));case"day":return this.forkDateTime(Ot(this.date,t));case"hour":return this.forkDateTime(function(t,e){return _t(t,-e)}(this.date,t));case"minute":return this.forkDateTime(function(t,e){return vt(t,-e)}(this.date,t));case"second":return this.forkDateTime(function(t,e){return Et(t,-e)}(this.date,t));case"millisecond":return this.forkDateTime(function(t,e){return St(t,-e)}(this.date,t));default:throw new Error("Invalid unit provided to `DateTime#subtract`")}}get(t){switch(t){case"year":return this.date.getUTCFullYear();case"month":return this.date.getUTCMonth()+1;case"yearday":return function(t){const e=new Date(Date.UTC(t.getUTCFullYear(),0,1)),r=t.valueOf()-e.valueOf();return 1+Math.floor(r/at.MILLISECONDS_IN_DAY)}(this.date);case"weekday":return at.WEEKDAYS[this.date.getUTCDay()];case"day":return this.date.getUTCDate();case"hour":return this.date.getUTCHours();case"minute":return this.date.getUTCMinutes();case"second":return this.date.getUTCSeconds();case"millisecond":return this.date.getUTCMilliseconds();default:throw new Error("Invalid unit provided to `DateTime#set`")}}set(t,e){if("duration"===t)return new ut(this.date,this.timezone,e,this.generators);if("generators"===t)return new ut(this.date,this.timezone,this.duration,e);let r=new Date(this.date);switch(t){case"year":r.setUTCFullYear(e);break;case"month":{const t=dt(e,r.getUTCFullYear());r.getUTCDate()>t?(r.setUTCDate(1),r.setUTCMonth(e),r=Ot(r,1)):r.setUTCMonth(e-1);break}case"day":r.setUTCDate(e);break;case"hour":r.setUTCHours(e);break;case"minute":r.setUTCMinutes(e);break;case"second":r.setUTCSeconds(e);break;case"millisecond":r.setUTCMilliseconds(e);break;default:throw new Error("Invalid unit provided to `DateTime#set`")}return this.forkDateTime(r)}granularity(t,e={}){let r=this.forkDateTime(this.date);switch(t){case"year":r=r.set("month",1);case"month":r=r.set("day",1);break;case"week":r=function(t,e){const r=lt(e).indexOf(t.get("weekday"));return t.subtract(r,"day")}(r,e.weekStart)}switch(t){case"year":case"month":case"week":case"day":r=r.set("hour",0);case"hour":r=r.set("minute",0);case"minute":r=r.set("second",0);case"second":r=r.set("millisecond",0);case"millisecond":return r;default:throw new Error("Invalid granularity provided to `DateTime#granularity`: "+t)}}endGranularity(t,e={}){let r=this.forkDateTime(this.date);switch(t){case"year":r=r.set("month",12);case"month":r=r.set("day",dt(r.get("month"),r.get("year")));break;case"week":r=function(t,e){const r=lt(e).indexOf(t.get("weekday"));return t.add(6-r,"day")}(r,e.weekStart)}switch(t){case"year":case"month":case"week":case"day":r=r.set("hour",23);case"hour":r=r.set("minute",59);case"minute":r=r.set("second",59);case"second":r=r.set("millisecond",999);case"millisecond":return r;default:throw new Error("Invalid granularity provided to `DateTime#granularity`: "+t)}}toISOString(){return this.date.toISOString()}toDateTime(){return this}toJSON(){const t={timezone:this.timezone,year:this.get("year"),month:this.get("month"),day:this.get("day"),hour:this.get("hour"),minute:this.get("minute"),second:this.get("second"),millisecond:this.get("millisecond")};return this.duration&&(t.duration=this.duration),t}valueOf(){return this.date.valueOf()}assertIsValid(){if(isNaN(this.valueOf()))throw new st("DateTime has invalid date.");return!0}forkDateTime(t){return new ut(t,this.timezone,this.duration,this.generators)}}function ct(t,e){if(t.timezone!==e.timezone)throw new st("Attempted to compare a datetime to another date in a different timezone: "+JSON.stringify(t)+" and "+JSON.stringify(e));return!0}function lt(t="SU"){const e=at.WEEKDAYS.slice();let r=e.indexOf(t);for(;0!==r;)ft(e),r--;return e}function ft(t,e="first"){return 0===t.length||("first"===e?t.push(t.shift()):t.unshift(t.pop())),t}function dt(t,e){return{1:31,2:ht(e),3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31}[t]}function ht(t){return function(t){return t%400==0||t%4==0&&t%100!=0}(t)?29:28}function gt(t){if(null===t||!0===t||!1===t)return NaN;const e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}function pt(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");const r=t.valueOf(),n=gt(e);return new Date(r+n)}function mt(t,e){return yt(t,12*gt(e))}function yt(t,e){const r=gt(e),n=(t=new Date(t)).getUTCMonth()+r,i=new Date(0);i.setUTCFullYear(t.getUTCFullYear(),n,1),i.setUTCHours(0,0,0,0);const o=dt(i.getUTCMonth()+1,i.getUTCFullYear());return t.setUTCMonth(n,Math.min(o,t.getUTCDate())),t}function bt(t,e){return wt(t,7*gt(e))}function wt(t,e){return St(t,gt(e)*at.MILLISECONDS_IN_DAY)}function _t(t,e){return pt(t,gt(e)*at.MILLISECONDS_IN_HOUR)}function vt(t,e){return pt(t,gt(e)*at.MILLISECONDS_IN_MINUTE)}function Et(t,e){return pt(t,gt(e)*at.MILLISECONDS_IN_SECOND)}function St(t,e){const r=gt(e),n=t.getTime();return new Date(n+r)}function Ot(t,e){return wt(t,-e)}function Tt(t,e){return t.timezone!==e?it.adapter.fromDateTime(t).set("timezone",e).toDateTime():t}class At extends q{constructor(t,e,r={}){super(r),this.recurrenceRules=t,this.options=B(e),this.normOptions=P(this.recurrenceRules,this.options),this.timezone=void 0!==r.timezone?r.timezone:this.normOptions.start.timezone,this.data=r.data,this.hasDuration=!!e.duration,this.hasDuration&&(this.duration=e.duration),this.isInfinite=void 0===this.normOptions.end&&void 0===this.normOptions.count}occurrences(t={}){return new z(this,this.normalizeOccurrencesArgs(t))}collections(t={}){return new Y(this,this.normalizeCollectionsArgs(t))}*_run(t={}){const e=this.normalizeRunArgs(t),r=new H((n=this.recurrenceRules,t=>n.reduce((e,r)=>{const n=r.get(t);return n&&e.push(n),e},[])),this.normOptions,e);var n;let i=r.next().value,o=0;for(;i&&(void 0===e.take||o<e.take);){o++,i=i.add(this,"generator");const t=yield this.normalizeRunOutput(i);i=(null==t?void 0:t.skipToDate)?r.next(Object.assign(Object.assign({},t),{skipToDate:Tt(t.skipToDate,r.start.timezone)})).value:r.next(t).value}}}class Mt extends At{constructor(t,e={}){super(Mt.recurrenceRules,t,e)}set(t,e,r={}){let n=B(this.options),i=this.timezone;if("timezone"===t){if(e===this.timezone&&!r.keepLocalTime)return this;if(r.keepLocalTime){const t=this.normalizeDateInput(n.start).toJSON();t.timezone=e;const r=this.dateAdapter.fromJSON(t);n.start=n.start instanceof this.dateAdapter?r:n.start instanceof c?r.toDateTime():r.date}i=e}else"options"===t?n=e:n[t]=e;return new Mt(n,{data:this.data,maxDuration:this.maxDuration,timezone:i})}}Mt.recurrenceRules=[];class jt extends q{constructor(t){super(t),this.data=t.data}occurrences(t={}){return new z(this,this.normalizeOccurrencesArgs(t))}collections(t={}){return new Y(this,this.normalizeCollectionsArgs(t))}*_run(t={}){const e=t.take;delete t.take;const r=this.occurrenceStream._run(t);let n=r.next().value,i=0;for(;n&&(void 0===e||e>i);){n=n.add(this,"generator");const t=yield this.normalizeRunOutput(n);n=r.next(t).value,i++}}}function It(...t){return e=>new Rt(t,e)}class Rt extends G{set(t,e){return new Rt(this.streams.map(t=>t.set("timezone",e)),Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",e),timezone:e}))}*_run(t={}){if(!this.config.base)return;const e=new $(this.config.base,t),r=new $(new tt(this.streams,{timezone:this.config.timezone}),t);for(Dt(e,r,t);!e.done;){const n=yield this.normalizeRunOutput(e.value);n&&n.skipToDate||e.next(),Dt(e,r,t,n)}}calculateIsInfinite(){return!(!this.config.base||!this.config.base.isInfinite)}calculateHasDuration(){return!(!this.config.base||!this.config.base.hasDuration)}}function Dt(t,e,r={},n={}){for(K([t,e],r,n),kt(t,e,r);!t.done&&!e.done&&t.value.isEqual(e.value);)t.next(),kt(t,e,r)}function kt(t,e,r={}){if(r.reverse)for(;!e.done&&!t.done&&e.value.isAfter(t.value);)e.next();else for(;!e.done&&!t.done&&e.value.isBefore(t.value);)e.next()}class Nt extends G{set(t,e){return new Nt([],Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",e),timezone:e}))}*_run(t={}){if(!this.config.base)return;const e=new $(this.config.base,t);for(;!e.done;){const t=yield this.normalizeRunOutput(e.value),r=e.value;for(e.next(t);(!t||!t.skipToDate)&&!e.done&&e.value.isEqual(r);)e.next()}}calculateIsInfinite(){return!(!this.config.base||!this.config.base.isInfinite)}calculateHasDuration(){return!(!this.config.base||!this.config.base.hasDuration)}}class Ct extends jt{constructor(t={}){super(t),this.rrules=[],this.exrules=[];for(const e of["rrules","exrules"]){const r=t[e];r&&(this[e]=r.map(t=>t instanceof Mt?t.set("timezone",this.timezone):new Mt(t,{timezone:this.timezone})))}for(const e of["rdates","exdates"]){const r=t[e];this[e]=r?r instanceof et?r.set("timezone",this.timezone):new et({dates:r,timezone:this.timezone}):new et({timezone:this.timezone})}this.hasDuration=this.rrules.every(t=>t.hasDuration)&&this.exrules.every(t=>t.hasDuration)&&this.rdates.hasDuration&&this.exdates.hasDuration,this.isInfinite=this.rrules.some(t=>t.isInfinite),this.occurrenceStream=[Q(...this.rrules),It(...this.exrules),Q(this.rdates),It(this.exdates),t=>new Nt([],t)].reduce((t,e)=>e({base:t,timezone:this.timezone}),void 0)}add(t,e){const r=this.rrules.slice(),n=this.exrules.slice();let i=this.rdates,o=this.exdates;switch(t){case"rrule":r.push(e);break;case"exrule":n.push(e);break;case"rdate":i=this.rdates.add(e);break;case"exdate":o=this.exdates.add(e)}return new Ct({timezone:this.timezone,data:this.data,rrules:r,exrules:n,rdates:i,exdates:o})}remove(t,e){let r=this.rrules,n=this.exrules,i=this.rdates,o=this.exdates;switch(t){case"rrule":r=r.filter(t=>t!==e);break;case"exrule":n=n.filter(t=>t!==e);break;case"rdate":i=this.rdates.remove(e);break;case"exdate":o=this.exdates.remove(e)}return new Ct({timezone:this.timezone,data:this.data,rrules:r,exrules:n,rdates:i,exdates:o})}set(t,e,r={}){let n=this.timezone,i=this.rrules,o=this.exrules,a=this.rdates,s=this.exdates;switch(t){case"timezone":if(e===this.timezone&&!r.keepLocalTime)return this;r.keepLocalTime&&(i=i.map(t=>t.set("timezone",e,r)),o=o.map(t=>t.set("timezone",e,r)),a=a.set("timezone",e,r),s=s.set("timezone",e,r)),n=e;break;case"rrules":i=e;break;case"exrules":o=e;break;case"rdates":a=e;break;case"exdates":s=e}return new Ct({timezone:n,data:this.data,rrules:i,exrules:o,rdates:a,exdates:s})}}Error;Error;class xt{constructor(t){this.processor=t,this.start=t.start,this.end=t.end,this.options=t.options}}class Lt extends xt{constructor(t,e){super(t),this.initDate=e,this.intervalUnit=function(t){switch(t){case"YEARLY":return"year";case"MONTHLY":return"month";case"WEEKLY":return"week";case"DAILY":return"day";case"HOURLY":return"hour";case"MINUTELY":return"minute";case"SECONDLY":return"second";case"MILLISECONDLY":return"millisecond";default:throw new Error("unknown freq passed to freqToGranularity()")}}(this.options.frequency),this.firstIntervalStartDate=this.normalizedStartDate(this.options.start),this.intervalStartDate=this.firstIntervalStartDate,this.intervalEndDate=this.normalizedEndDate(this.firstIntervalStartDate),this.skipToInterval(this.initDate)}run(t){return this.validateDate(new F(t))}validateDate(t){const e=t.date;return t instanceof F&&this.dateIsWithinInterval(e)?t:(this.skipToInterval(e),new W(this.dateIsWithinInterval(e)?e:this.setToCurrentInterval()))}setToCurrentInterval(){return this.intervalStartDate}normalizedStartDate(t){return"WEEKLY"===this.options.frequency?t.granularity("week",{weekStart:this.options.weekStart}):t.granularity(this.intervalUnit)}normalizedEndDate(t){switch(this.options.frequency){case"YEARLY":return t.add(1,"year");case"MONTHLY":return t.add(1,"month");case"WEEKLY":return t.add(1,"week");case"DAILY":return t.add(1,"day");case"HOURLY":return t.add(1,"hour");case"MINUTELY":return t.add(1,"minute");case"SECONDLY":return t.add(1,"second");case"MILLISECONDLY":return t.add(1,"millisecond");default:throw new Error("Unknown frequency "+this.options.frequency)}}skipToInterval(t){const e=this.intervalDifference(t);this.intervalStartDate=this.firstIntervalStartDate.add(e,this.intervalUnit),this.intervalEndDate=this.normalizedEndDate(this.intervalStartDate)}dateIsWithinInterval(t){return this.intervalStartDate.isBeforeOrEqual(t)&&this.intervalEndDate.isAfter(t)}intervalDifference(t){return Pt({first:this.firstIntervalStartDate,second:t,unit:this.intervalUnit,interval:this.options.interval,weekStart:this.options.weekStart,direction:"after"})}}function Pt({first:t,second:e,unit:r,interval:n,weekStart:i,direction:o}){let a=(()=>{let n,o;switch(r){case"year":return o=12*(e.get("year")-t.get("year")),o=o+e.get("month")-t.get("month"),Math.floor(o/12);case"month":return o=12*(e.get("year")-t.get("year")),o=o+e.get("month")-t.get("month"),o;case"week":t=t.granularity("week",{weekStart:i}),n=s.MILLISECONDS_IN_WEEK;break;case"day":n=s.MILLISECONDS_IN_DAY;break;case"hour":n=s.MILLISECONDS_IN_HOUR;break;case"minute":n=s.MILLISECONDS_IN_MINUTE;break;case"second":n=s.MILLISECONDS_IN_SECOND;break;case"millisecond":n=1;break;default:throw new Error("Unexpected `unit` value")}const a=e.valueOf()-t.valueOf();return Math.floor(a/n)})();return a=("after"===o?Math.ceil:Math.floor)(a/n)*n,a}class Bt extends Lt{setToCurrentInterval(){return this.intervalEndDate.subtract(1,"millisecond")}intervalDifference(t){return Pt({first:this.firstIntervalStartDate,second:t,unit:this.intervalUnit,interval:this.options.interval,weekStart:this.options.weekStart,direction:"before"})}}const Ut=["MILLISECONDLY","SECONDLY","MINUTELY","HOURLY","DAILY","WEEKLY","MONTHLY","YEARLY"],Ft={name:"FrequencyRule",get:t=>void 0!==t.options.byMillisecondOfSecond||"MILLISECONDLY"!==t.options.frequency?null:t.reverse?new Bt(t,t.end):new Lt(t,t.start),normalizeOptions:(t,e)=>{if(!Ut.includes(t.frequency))throw new L('"frequency" must be one of '+JSON.stringify(Ut));if(void 0!==t.interval){if(!Number.isInteger(t.interval))throw new L('"interval" expects a whole number');if(t.interval<1)throw new L('"interval" cannot be less than 1')}if(void 0!==t.weekStart&&!s.WEEKDAYS.includes(t.weekStart))throw new L('"weekStart" must be one of '+JSON.stringify(s.WEEKDAYS));e.frequency=t.frequency,e.interval=t.interval||1,e.weekStart=t.weekStart||"MO"},deps:()=>[Ft]};function Wt(t){return Array.isArray(t)&&t.length>0}const Ht=new WeakMap;class qt extends xt{constructor(t){super(t),Ht.has(this.processor)||Ht.set(this.processor,new Lt(t,t.start)),this.frequency=Ht.get(this.processor)}validateDate(t){return this.frequency.validateDate(t)}}class zt extends xt{constructor(t){super(t),Ht.has(this.processor)||Ht.set(this.processor,new Bt(t,t.end)),this.frequency=Ht.get(this.processor)}validateDate(t){return this.frequency.validateDate(t)}}class Vt extends zt{run(t){const e=t.get(this.granularity);for(const r of this.option)if(!(e<r))return e===r?this.validateDate(new F(t)):this.validateDate(new W(t.endGranularity(this.baseGranularity).set(this.granularity,r)));return this.validateDate(new W(t.endGranularity(this.baseGranularity).subtract(1,this.baseGranularity).set(this.granularity,this.option[0])))}}class Yt extends Vt{constructor(){super(...arguments),this.baseGranularity="second",this.granularity="millisecond",this.option=this.options.byMillisecondOfSecond.slice().reverse()}}class Gt extends qt{run(t){const e=t.get(this.granularity);for(const r of this.option)if(!(e>r))return e===r?this.validateDate(new F(t)):this.validateDate(new W(t.granularity(this.baseGranularity).set(this.granularity,r)));return this.validateDate(new W(t.granularity(this.baseGranularity).add(1,this.baseGranularity).set(this.granularity,this.option[0])))}}class $t extends Gt{constructor(){super(...arguments),this.baseGranularity="second",this.granularity="millisecond",this.option=this.options.byMillisecondOfSecond}}const Kt={name:"ByMillisecondOfSecond",get:t=>void 0===t.options.byMillisecondOfSecond?null:t.reverse?new Yt(t):new $t(t),normalizeOptions:(t,e)=>{if(void 0!==t.byMillisecondOfSecond){if(!Wt(t.byMillisecondOfSecond))throw new L('"byMillisecondOfSecond" expects a non-empty array');if(t.byMillisecondOfSecond.some(t=>t<0||t>999))throw new L('"byMillisecondOfSecond" values must be >= 0 && <= 999');e.byMillisecondOfSecond=t.byMillisecondOfSecond,e.byMillisecondOfSecond.sort(k)}else"MILLISECONDLY"!==t.frequency&&(e.byMillisecondOfSecond=[e.start.get("millisecond")])},deps:()=>[Ft,Kt]};class Zt extends Vt{constructor(){super(...arguments),this.baseGranularity="minute",this.granularity="second",this.option=this.options.bySecondOfMinute.slice().reverse()}}class Jt extends Gt{constructor(){super(...arguments),this.baseGranularity="minute",this.granularity="second",this.option=this.options.bySecondOfMinute}}const Xt={name:"BySecondOfMinute",get:t=>void 0===t.options.bySecondOfMinute?null:t.reverse?new Zt(t):new Jt(t),normalizeOptions:(t,e)=>{if(void 0!==t.bySecondOfMinute){if(!Wt(t.bySecondOfMinute))throw new L('"bySecondOfMinute" expects a non-empty array');if(t.bySecondOfMinute.some(t=>t<0||t>60))throw new L('"bySecondOfMinute" values must be >= 0 && <= 60');e.bySecondOfMinute=t.bySecondOfMinute,e.bySecondOfMinute.sort(k)}else["SECONDLY","MILLISECONDLY"].includes(t.frequency)||(e.bySecondOfMinute=[e.start.get("second")])},deps:()=>[Ft,Xt,Kt]};class Qt extends Vt{constructor(){super(...arguments),this.baseGranularity="hour",this.granularity="minute",this.option=this.options.byMinuteOfHour.slice().reverse()}}class te extends Gt{constructor(){super(...arguments),this.baseGranularity="hour",this.granularity="minute",this.option=this.options.byMinuteOfHour}}const ee={name:"ByMinuteOfHour",get:t=>void 0===t.options.byMinuteOfHour?null:t.reverse?new Qt(t):new te(t),normalizeOptions:(t,e)=>{if(void 0!==t.byMinuteOfHour){if(!Wt(t.byMinuteOfHour))throw new L('"byMinuteOfHour" expects a non-empty array');if(t.byMinuteOfHour.some(t=>t<0||t>59))throw new L('"byMinuteOfHour" values must be >= 0 && <= 59');e.byMinuteOfHour=t.byMinuteOfHour,e.byMinuteOfHour.sort(k)}else["MINUTELY","SECONDLY","MILLISECONDLY"].includes(t.frequency)||(e.byMinuteOfHour=[e.start.get("minute")])},deps:()=>[Ft,ee,Xt,Kt]};class re extends Vt{constructor(){super(...arguments),this.baseGranularity="day",this.granularity="hour",this.option=this.options.byHourOfDay.slice().reverse()}}class ne extends Gt{constructor(){super(...arguments),this.baseGranularity="day",this.granularity="hour",this.option=this.options.byHourOfDay}}const ie={name:"ByHourOfDay",get:t=>void 0===t.options.byHourOfDay?null:t.reverse?new re(t):new ne(t),normalizeOptions:(t,e)=>{if(void 0!==t.byHourOfDay){if(!Wt(t.byHourOfDay))throw new L('"byHourOfDay" expects a non-empty array');if(t.byHourOfDay.some(t=>t<0||t>23))throw new L('"byHourOfDay" values must be >= 0 && <= 23');e.byHourOfDay=t.byHourOfDay,e.byHourOfDay.sort(k)}else["YEARLY","MONTHLY","WEEKLY","DAILY"].includes(t.frequency)&&(e.byHourOfDay=[e.start.get("hour")])},deps:()=>[Ft,ie,ee,Xt,Kt]};function oe(t,e){return t.add(p(t.get("weekday"),e),"day")}function ae(t,e,r){let n=t.set("day",1);return r<0&&(n=n.add(1,"month")),n=oe(n,e),r<0?n.add(r,"week"):n.add(r-1,"week")}class se extends qt{run(t){const e=ue(t,this.options.byDayOfMonth,this.options.byDayOfWeek),r=t.get("day");for(const n of e)if(!(r>n))return r===n?this.validateDate(new F(t)):this.validateDate(new W(t.granularity("month").set("day",n)));let n,i=t,o=0;for(;!n&&o<30;)i=i.granularity("month").add(1,"month"),n=ue(i,this.options.byDayOfMonth,this.options.byDayOfWeek)[0],o++;if(o>=13)throw new U("byDayOfMonth Infinite while loop");return this.validateDate(new W(i.set("day",n)))}}function ue(t,e,r){const n=t.endGranularity("month").get("day");let i=e.filter(t=>n>=Math.abs(t)).map(t=>t>0?t:n+t+1);if(r){const e=t.granularity("month"),n=[];r.forEach(r=>{if("string"==typeof r)return void n.push(...i.filter(t=>e.set("day",t).get("weekday")===r));const o=ae(t,...r).get("day");i.includes(o)&&n.push(o)}),i=Array.from(new Set(n))}return i.sort((t,e)=>t>e?1:t<e?-1:0)}class ce extends zt{run(t){const e=ue(t,this.options.byDayOfMonth,this.options.byDayOfWeek).reverse(),r=t.get("day");for(const n of e)if(!(r<n))return r===n?this.validateDate(new F(t)):this.validateDate(new W(t.endGranularity("month").set("day",n)));let n,i=t,o=0;for(;!n&&o<30;)i=i.endGranularity("month").subtract(1,"month"),n=ue(i,this.options.byDayOfMonth,this.options.byDayOfWeek).pop(),o++;if(o>=13)throw new U("byDayOfMonth Infinite while loop");return this.validateDate(new W(i.set("day",n)))}}const le={name:"ByDayOfMonth",get:t=>void 0===t.options.byDayOfMonth?null:t.reverse?new ce(t):new se(t),normalizeOptions:(t,e)=>{if(void 0!==t.byDayOfMonth){if("WEEKLY"===t.frequency)throw new L('when "frequency" is "WEEKLY", "byDayOfMonth" cannot be present');if(!Wt(t.byDayOfMonth))throw new L('"byDayOfMonth" expects a non-empty array');if(t.byDayOfMonth.some(t=>0===t||t<-31||t>31))throw new L('"byDayOfMonth" values must be `num !== 0 && num <= 31 && num >= -31`');e.byDayOfMonth=t.byDayOfMonth.slice()}else Wt(t.byDayOfWeek)||Wt(t.byDayOfYear)||!["YEARLY","MONTHLY"].includes(t.frequency)||(e.byDayOfMonth=[e.start.get("day")])},deps:()=>[Ft,le,ie,ee,Xt,Kt]};function fe(t,e,r){let n=t.set("month",1).set("day",1);return r<0&&(n=n.add(1,"year")),n=oe(n,e),r<0?n.add(r,"week"):n.add(r-1,"week")}function de(t,e){const r=p(t.get("weekday"),e);return t.subtract(0===r?0:7-r,"day")}class he extends zt{run(t){return"YEARLY"===this.options.frequency?void 0===this.options.byMonthOfYear?this.expandYearly(t):this.expandMonthly(t):"MONTHLY"===this.options.frequency?this.expandMonthly(t):this.expand(t)}expandYearly(t){let e=ge(t,this.options.byDayOfWeek)[0],r=0,n=t;for(;!e&&r<28;)r++,n=n.granularity("year").subtract(1,"millisecond"),e=ge(n,this.options.byDayOfWeek)[0];if(!e)throw new U("The byDayOfWeek rule appears to contain an impossible combination");return this.result(t,e)}expandMonthly(t){let e=pe(t,this.options.byDayOfWeek)[0],r=0,n=t;for(;!e&&r<50;)r++,n=n.granularity("month").subtract(1,"millisecond"),e=pe(n,this.options.byDayOfWeek)[0];if(!e)throw new U("The byDayOfWeek rule appears to contain an impossible combination");return this.result(t,e)}expand(t){const e=this.options.byDayOfWeek.map(e=>de(t,e)).sort(f).pop();return this.result(t,e)}result(t,e){return e.isEqual(t)?this.validateDate(new F(t)):this.validateDate(new W(e.endGranularity("day")))}}function ge(t,e){return d([...e.filter(t=>Array.isArray(t)).map(e=>fe(t,...e)),...e.filter(t=>"string"==typeof t).map(e=>de(t,e)).filter(e=>e.get("year")===t.get("year"))]).filter(e=>e.isBeforeOrEqual(t)).sort(f).reverse()}function pe(t,e){return d([...e.filter(t=>Array.isArray(t)).map(e=>ae(t,...e)),...e.filter(t=>"string"==typeof t).map(e=>de(t,e)).filter(e=>e.get("year")===t.get("year")&&e.get("month")===t.get("month"))]).filter(e=>e.isBeforeOrEqual(t)).sort(f).reverse()}class me extends qt{run(t){return"YEARLY"===this.options.frequency?void 0===this.options.byMonthOfYear?this.expandYearly(t):this.expandMonthly(t):"MONTHLY"===this.options.frequency?this.expandMonthly(t):this.expand(t)}expandYearly(t){let e=ye(t,this.options.byDayOfWeek)[0],r=0,n=t;for(;!e&&r<28;)r++,n=n.granularity("year").add(1,"year"),e=ye(n,this.options.byDayOfWeek)[0];if(!e)throw new U("The byDayOfWeek rule appears to contain an impossible combination");return this.result(t,e)}expandMonthly(t){let e=be(t,this.options.byDayOfWeek)[0],r=0,n=t;for(;!e&&r<50;)r++,n=n.granularity("month").add(1,"month"),e=be(n,this.options.byDayOfWeek)[0];if(!e)throw new U("The byDayOfWeek rule appears to contain an impossible combination");return this.result(t,e)}expand(t){const e=this.options.byDayOfWeek.map(e=>oe(t,e)).sort(f)[0];return this.result(t,e)}result(t,e){return e.isEqual(t)?this.validateDate(new F(t)):this.validateDate(new W(e.granularity("day")))}}function ye(t,e){return d([...e.filter(t=>Array.isArray(t)).map(e=>fe(t,...e)),...e.filter(t=>"string"==typeof t).map(e=>oe(t,e)).filter(e=>e.get("year")===t.get("year"))]).filter(e=>e.isAfterOrEqual(t)).sort(f)}function be(t,e){return d([...e.filter(t=>Array.isArray(t)).map(e=>ae(t,...e)),...e.filter(t=>"string"==typeof t).map(e=>oe(t,e)).filter(e=>e.get("year")===t.get("year")&&e.get("month")===t.get("month"))]).filter(e=>e.isAfterOrEqual(t)).sort(f)}const we={name:"ByDayOfWeek",get:t=>void 0===t.options.byDayOfWeek?null:t.reverse?new he(t):new me(t),normalizeOptions:(t,e)=>{if(void 0!==t.byDayOfWeek){if(!Wt(t.byDayOfWeek))throw new L('"byDayOfWeek" expects a non-empty array');const r=t.byDayOfWeek.find(t=>Array.isArray(t)?!s.WEEKDAYS.includes(t[0]):!s.WEEKDAYS.includes(t));if(r)throw new L(`"byDayOfWeek" expects weedays in the form ${JSON.stringify(s.WEEKDAYS)} but "${r}" was provided`);if(!["YEARLY","MONTHLY"].includes(t.frequency)&&t.byDayOfWeek.some(t=>Array.isArray(t)))throw new L('"byDayOfWeek" can only include a numeric value (i.e. `[string, number]`) when the "frequency" is either "MONTHLY" or "YEARLY"');if("MONTHLY"===t.frequency&&t.byDayOfWeek.some(t=>Array.isArray(t)&&(t[1]<-31||0===t[1]||t[1]>31)))throw new L('when "frequency" is "MONTHLY", each "byDayOfWeek" can optionally only have a numeric value >= -31 and <= 31 and !== 0');if("YEARLY"===t.frequency&&t.byDayOfWeek.some(t=>Array.isArray(t)&&(t[1]<-366||0===t[1]||t[1]>366)))throw new L('when "frequency" is "YEARLY", each "byDayOfWeek" can optionally only have a numeric value >= -366 and <= 366 and !== 0');e.byDayOfWeek=t.byDayOfWeek}else Wt(t.byDayOfMonth)||"WEEKLY"!==t.frequency||(e.byDayOfWeek=[e.start.get("weekday")])},deps:()=>[Ft,we,ie,ee,Xt,Kt]};class _e extends zt{constructor(){super(...arguments),this.option=this.processor.options.byMonthOfYear.slice().reverse()}run(t){const e=t.get("month");for(const r of this.option)if(!(e<r))return e===r?this.validateDate(new F(t)):this.validateDate(new W(t.endGranularity("year").set("month",r)));return this.validateDate(new W(t.endGranularity("year").subtract(1,"year").set("month",this.option[0])))}}class ve extends qt{run(t){const e=t.get("month");for(const r of this.options.byMonthOfYear)if(!(e>r))return e===r?this.validateDate(new F(t)):this.validateDate(new W(t.granularity("year").set("month",r)));return this.validateDate(new W(t.granularity("year").add(1,"year").set("month",this.options.byMonthOfYear[0])))}}const Ee={name:"ByMonthOfYear",get:t=>void 0===t.options.byMonthOfYear?null:t.reverse?new _e(t):new ve(t),normalizeOptions:(t,e)=>{if(void 0!==t.byMonthOfYear){if(!Wt(t.byMonthOfYear))throw new L('"byMonthOfYear" expects a non-empty array');if(t.byMonthOfYear.some(t=>t<1||t>12))throw new L('"byMonthOfYear" values must be `num >= 1 && num >= 12`');e.byMonthOfYear=t.byMonthOfYear.slice(),e.byMonthOfYear.sort(k)}else Wt(t.byDayOfMonth)||Wt(t.byDayOfWeek)||Wt(t.byDayOfYear)||"YEARLY"!==t.frequency||(e.byMonthOfYear=[e.start.get("month")])},deps:()=>[Ft,Ee,le,ie,ee,Xt,Kt]},Se=[Ft,Ee,le,we,ie,ee,Xt,Kt];class Oe extends o{constructor(t,e={}){if(super(void 0,e),!["UTC",null,void 0].includes(e.timezone))throw new n(`StandardDateAdapter only supports "UTC" and local time zones but "${e.timezone}" was provided.`);this._date=new Date(t),this.timezone=void 0!==e.timezone?e.timezone:null,this.assertIsValid()}static isDate(t){return"[object Date]"===Object.prototype.toString.call(t)}static fromDate(t,e){return new Oe(t,e)}static fromJSON(t){const e=[t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond];switch(t.timezone){case"UTC":return new Oe(new Date(Date.UTC(...e)),{timezone:"UTC",duration:t.duration});case null:return new Oe(new Date(...e),{timezone:null,duration:t.duration});default:throw new n(`The \`StandardDateAdapter\` only supports datetimes in UTC or LOCAL (null) time. You provided a JSON object with timezone "${t.timezone}".`)}}static fromDateTime(t){const e=Oe.fromJSON(t.toJSON());return e.generators.push(...t.generators),e}get date(){return new Date(this._date)}get end(){if(this.duration)return this._end||(this._end=Oe.fromDateTime(this.toDateTime().add(this.duration,"millisecond")).date),this._end}set(t,e){if("timezone"===t)return this.timezone===e?this:new Oe(this._date,{timezone:e,duration:this.duration,generators:this.generators});if("duration"===t)return this.duration===e?this:new Oe(this._date,{timezone:this.timezone,duration:e,generators:this.generators});throw new R(`Unknown prop "${t}" for StandardDateAdapter#set()`)}valueOf(){return this._date.valueOf()}toJSON(){let t;return t="UTC"===this.timezone?{timezone:this.timezone,year:this._date.getUTCFullYear(),month:this._date.getUTCMonth()+1,day:this._date.getUTCDate(),hour:this._date.getUTCHours(),minute:this._date.getUTCMinutes(),second:this._date.getUTCSeconds(),millisecond:this._date.getUTCMilliseconds()}:{timezone:this.timezone,year:this._date.getFullYear(),month:this._date.getMonth()+1,day:this._date.getDate(),hour:this._date.getHours(),minute:this._date.getMinutes(),second:this._date.getSeconds(),millisecond:this._date.getMilliseconds()},this.duration&&(t.duration=this.duration),t}assertIsValid(){if(!Oe.isDate(this._date)||isNaN(this._date.valueOf()))throw new n("StandardDateAdapter has invalid date.");if(![null,"UTC"].includes(this.timezone))throw new n(`StandardDateAdapter only supports local (null) and UTC timezones but "${this.timezone}" was specified.`);if(this.duration&&this.duration<=0)throw new n("If provided, duration must be greater than 0.");return!0}}Oe.hasTimezoneSupport=!1,o.adapter=Oe,Mt.recurrenceRules=Se;class Te extends Error{}class Ae extends Error{}function Me(t,e,r){r.data&&(!0===r.data?e.data=t.data:e.data=r.data(t),void 0===e.data&&delete e.data)}function je(t,e){q.JSON_FN_MAP.set(t,e)}q.JSON_FN_MAP=new Map,q.prototype.toJSON=function(t){throw new Ae(`To support smaller bundles, ${this.constructor.name}#toJSON() must be manually added. See "@rschedule/json-tools" in the rSchedule docs.`)},q.fromJSON=function(t,e){if("object"!=typeof t||null===t)throw new Te(`Invalid json "${t}"`);const r=q.JSON_FN_MAP.get(t.type);if(!r)throw new Te(`Unknown rSchedule object type "${t.type}". Have you added a json serializer for "${t.type}"? See "@rschedule/json-tools" in the rSchedule docs.`);return r(t,e)},et.prototype.toJSON=function(t={}){const e={type:"Dates",dates:this.adapters.map(t=>t.toJSON())};return t.nested||(e.timezone=this.timezone),Me(this,e,t),e},et.fromJSON=function(t,e={}){if("Dates"!==t.type)throw new Te("Invalid Dates JSON");return new et({dates:t.dates.map(t=>o.adapter.fromJSON(t)),data:"function"==typeof e.data?e.data(t):t.data,timezone:e.timezone||t.timezone})},je("Dates",et.fromJSON),Mt.prototype.toJSON=function(t={}){const e={type:"Rule",config:Object.assign(Object.assign({},N(this.options)),{start:this.normalizeDateInput(this.options.start).toJSON()})};return this.options.end&&(e.config.end=this.normalizeDateInput(this.options.end).toJSON()),t.nested||(e.timezone=this.timezone),Me(this,e,t),e},Mt.fromJSON=function(t,e={}){const r=Object.assign(Object.assign({},t.config),{start:o.adapter.fromJSON(t.config.start),end:t.config.end&&o.adapter.fromJSON(t.config.end)});return new Mt(r,{data:"function"==typeof e.data?e.data(t):t.data,timezone:e.timezone||t.timezone})},je("Rule",Mt.fromJSON),Ct.prototype.toJSON=function(t={}){const e={type:"Schedule",rrules:this.rrules.map(e=>e.toJSON(Object.assign(Object.assign({},t),{nested:!0}))),exrules:this.exrules.map(e=>e.toJSON(Object.assign(Object.assign({},t),{nested:!0}))),rdates:this.rdates.toJSON(Object.assign(Object.assign({},t),{nested:!0})),exdates:this.exdates.toJSON(Object.assign(Object.assign({},t),{nested:!0}))};return t.nested||(e.timezone=this.timezone),Me(this,e,t),e},Ct.fromJSON=function(t,e={}){if("Schedule"!==t.type)throw new Te("Invalid Schedule JSON");return new Ct({rrules:t.rrules.map(r=>Mt.fromJSON(r,Object.assign({timezone:t.timezone},e))),exrules:t.exrules.map(r=>Mt.fromJSON(r,Object.assign({timezone:t.timezone},e))),rdates:et.fromJSON(t.rdates,Object.assign({timezone:t.timezone},e)),exdates:et.fromJSON(t.exdates,Object.assign({timezone:t.timezone},e)),data:"function"==typeof e.data?e.data(t):t.data,timezone:e.timezone||t.timezone})},je("Schedule",Ct.fromJSON)},function(t,e,r){"use strict";r.d(e,"a",(function(){return i})),r.d(e,"b",(function(){return o}));var n=["D","DD","YY","YYYY"];function i(t){return-1!==n.indexOf(t)}function o(t){throw new RangeError("`options.awareOfUnicodeTokens` must be set to `true` to use `"+t+"` token; see: https://git.io/fxCyr")}},function(t,e,r){"use strict";r.d(e,"a",(function(){return y})),r.d(e,"c",(function(){return b})),r.d(e,"b",(function(){return w})),r.d(e,"d",(function(){return _})),r.d(e,"e",(function(){return v}));var n=r(4),i=r.n(n),o=r(13),a=r(2),s=r(33),u=r(7);function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function l(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?c(Object(r),!0).forEach((function(e){f(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function f(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const d=r(70),h=r(49),g=r(41);let p=null;async function m(t){const e=i.a.getBudgetDir(t),r=i.a.join(e,"backups");let n=[];await i.a.exists(r)&&(n=await i.a.listDir(r),n=n.filter(t=>t.match(/\.sqlite$/)));const o=await Promise.all(n.map(async t=>{const e=await i.a.getModifiedTime(i.a.join(r,t));return{id:t,date:new Date(e)}}));return o.sort((t,e)=>t.date<e.date?1:t.date>e.date?-1:0),o}async function y(t){let e=await m(t),r=await async function(t){const e=i.a.getBudgetDir(t);return await i.a.exists(i.a.join(e,"db.latest.sqlite"))?{id:"db.latest.sqlite",date:null,isLatest:!0}:null}(t);return r&&e.unshift(r),e=e.map(t=>l(l({},t),{},{date:t.date?d.format(t.date,"yyyy-MM-dd h:mm"):null})),e}async function b(t){const e=i.a.getBudgetDir(t);await i.a.exists(i.a.join(e,"db.latest.sqlite"))&&await i.a.removeFile(i.a.join(i.a.getBudgetDir(t),"db.latest.sqlite"));let r=g.v4Sync()+".sqlite",n=i.a.join(e,"backups",r);await i.a.exists(i.a.join(e,"backups"))||await i.a.mkdir(i.a.join(e,"backups")),await i.a.copyFile(i.a.join(e,"db.sqlite"),n);const s=o.openDatabase(n);await o.runQuery(s,"DELETE FROM messages_crdt"),await o.runQuery(s,"DELETE FROM messages_clock"),o.closeDatabase(s);const u=await async function(t){const e=t.reduce((t,e)=>{const r=d.format(e.date,"yyyy-MM-dd");return t[r]=t[r]||[],t[r].push(e),t},{}),r=[];for(let t of Object.keys(e)){const n=e[t],i=t===a.d();for(let t of n.slice(i?3:1))r.push(t.id)}const n=t.filter(t=>!r.includes(t.id));return r.concat(n.slice(10).map(t=>t.id))}(await m(t));for(let t of u)await i.a.removeFile(i.a.join(e,"backups",t));h.send("backups-updated",await y(t))}async function w(t,e){const r=i.a.getBudgetDir(t);if(await i.a.exists(i.a.join(r,"db.latest.sqlite"))||(await i.a.copyFile(i.a.join(r,"db.sqlite"),i.a.join(r,"db.latest.sqlite")),await i.a.copyFile(i.a.join(r,"metadata.json"),i.a.join(r,"metadata.latest.json")),v(),_(t),await u.c(t)),"db.latest.sqlite"===e){console.log("Reverting backup"),await i.a.copyFile(i.a.join(r,"db.latest.sqlite"),i.a.join(r,"db.sqlite")),await i.a.copyFile(i.a.join(r,"metadata.latest.json"),i.a.join(r,"metadata.json")),await i.a.removeFile(i.a.join(r,"db.latest.sqlite")),await i.a.removeFile(i.a.join(r,"metadata.latest.json"));try{await s.i()}catch(t){}u.e()}else{console.log("Loading backup",e),await u.c(t),await u.d({groupId:null,lastSyncedTimestamp:null,lastUploaded:null});try{await s.i()}catch(t){}u.e(),await i.a.copyFile(i.a.join(r,"backups",e),i.a.join(r,"db.sqlite"))}}function _(t){p&&clearInterval(p),p=setInterval(async()=>{console.log("Making backup"),await b(t)},9e5)}function v(){clearInterval(p),p=null}},function(t,e,r){"use strict";r.d(e,"b",(function(){return i})),r.d(e,"a",(function(){return o})),r.d(e,"c",(function(){return c}));r(74);let n=!0;function i(t){n=null==t||"true"===t}async function o(){}let a=!1,s=[];function u(t){return(...e)=>{a?s.push([t,[void 0,...e]]):t(void 0,...e)}}const c=u((t,e,r)=>{});u((t,e)=>{})},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.constants={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOATIME:262144,O_NOFOLLOW:131072,O_SYNC:1052672,O_DIRECT:16384,O_NONBLOCK:2048,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,UV_FS_COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4}},function(t,e,r){t.exports=i;var n=r(61).EventEmitter;function i(){n.call(this)}r(11)(i,n),i.Readable=r(138),i.Writable=r(304),i.Duplex=r(305),i.Transform=r(306),i.PassThrough=r(307),i.Stream=i,i.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(r.on("end",s),r.on("close",u));var a=!1;function s(){a||(a=!0,t.end())}function u(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function c(t){if(l(),0===n.listenerCount(this,"error"))throw t}function l(){r.removeListener("data",i),t.removeListener("drain",o),r.removeListener("end",s),r.removeListener("close",u),r.removeListener("error",c),t.removeListener("error",c),r.removeListener("end",l),r.removeListener("close",l),t.removeListener("close",l)}return r.on("error",c),t.on("error",c),r.on("end",l),r.on("close",l),t.on("close",l),t.emit("pipe",r),t}},function(t,e,r){function n(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===n(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===n(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===n(t)},e.isError=function(t){return"[object Error]"===n(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(14).Buffer.isBuffer},function(t,e,r){"use strict";var n=r(11),i=r(142),o=r(144),a=r(145),s=r(68);function u(t){s.call(this,"digest"),this._hash=t}n(u,s),u.prototype._update=function(t){this._hash.update(t)},u.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new i:"rmd160"===t||"ripemd160"===t?new o:new u(a(t))}},function(t,e,r){(function(e){t.exports=function(t,r){for(var n=Math.min(t.length,r.length),i=new e(n),o=0;o<n;++o)i[o]=t[o]^r[o];return i}}).call(this,r(14).Buffer)},function(t,e,r){"use strict";var n=r(51),i=r(42);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}e.BlockHash=o,o.prototype.update=function(t,e){if(t=n.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-r,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},o.prototype.digest=function(t){return this.update(this._pad()),i(null===this.pending),this._digest(t)},o.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=t>>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o<this.padLength;o++)n[i++]=0;return n}},function(t,e,r){"use strict";const n=r(11),i=r(157).Reporter,o=r(155).Buffer;function a(t,e){i.call(this,e),o.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function s(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return s.isEncoderBuffer(t)||(t=new s(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=o.byteLength(t);else{if(!o.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}n(a,i),e.DecoderBuffer=a,a.isDecoderBuffer=function(t){if(t instanceof a)return!0;return"object"==typeof t&&o.isBuffer(t.base)&&"DecoderBuffer"===t.constructor.name&&"number"==typeof t.offset&&"number"==typeof t.length&&"function"==typeof t.save&&"function"==typeof t.restore&&"function"==typeof t.isEmpty&&"function"==typeof t.readUInt8&&"function"==typeof t.skip&&"function"==typeof t.raw},a.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},a.prototype.restore=function(t){const e=new a(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),e},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},a.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");const r=new a(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},a.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.EncoderBuffer=s,s.isEncoderBuffer=function(t){if(t instanceof s)return!0;return"object"==typeof t&&"EncoderBuffer"===t.constructor.name&&"number"==typeof t.length&&"function"==typeof t.join},s.prototype.join=function(t,e){return t||(t=o.alloc(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(t,e),e+=r.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):o.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}},function(t,e,r){t.exports=r(403),t.exports.Constants=r(236),t.exports.Errors=r(404),t.exports.FileAttr=r(405)},function(t,e,r){"use strict";Array.prototype.includes||(Array.prototype.includes=function(t){if(null==this)throw new TypeError("Array.prototype.includes called on null or undefined");var e=Object(this),r=parseInt(e.length,10)||0;if(0===r)return!1;var n,i,o=parseInt(arguments[1],10)||0;for(o>=0?n=o:(n=r+o)<0&&(n=0);n<r;){if(t===(i=e[n])||t!=t&&i!=i)return!0;n++}return!1}),t.exports=function(){return this._events_={},this.publish=this.trigger=this.emit=function(t){if(this.emit$.apply(this,arguments),!this._events_[t])return this;arguments.splice=Array.prototype.splice,arguments.splice(0,1);var e=this._events_[t],r=[];for(var n in e){var i=e[n];i.apply(this,arguments),i._once_&&r.push(i)}for(var n in r)this.off(t,r[n]);return this},this.subscribe=this.on=function(t,e,r){if(!e)throw new ReferenceError("handler not defined.");this._events_[t]||(this._events_[t]=[]);r&&(e._once_=r);return this._events_[t].push(e),this},this.once=function(t,e){return this.on(t,e,!0)},this.unSubscribe=this.off=function(t,e){if(!this._events_[t])return this;if(!e)throw new ReferenceError('handler not defined. if you wish to remove all handlers from the event please pass "*" as the handler');if("*"==e)return delete this._events_[t],this;var r=this._events_[t];for(;r.includes(e);)r.splice(r.indexOf(e),1);r.length<1&&delete this._events_[t];return this},this.emit$=function(t,e){if(!this._events_["*"])return this;var r=this._events_["*"];for(var n of(e.shift=Array.prototype.shift,e.shift(t),r))n.apply(this,e);return this},this}},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(0);function i(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(n.a)(t),i=Object(n.a)(e);return r.getTime()<i.getTime()}},function(t,e,r){"use strict";async function n(t,e,r,n,i=[]){let o=[],a=new Set;for(let s=0;s<e.length;s+=500){let u=e.slice(s,s+500).filter(t=>!a.has(t));if(u.length>0){let e=n("("+u.map(t=>r(t)).join(" OR ")+")"),s=await t(e,i,!0);a=new Set([...a,...u]),o=o.concat(s)}}return o}function i(t,e){return e+" IN ("+[...new Set(t)].map(t=>`'${t}'`).join(",")+")"}r.d(e,"a",(function(){return n})),r.d(e,"b",(function(){return i}))},function(t,e,r){"use strict";r.d(e,"b",(function(){return s})),r.d(e,"a",(function(){return c}));var n=r(8),i=r(1);let o,a;async function s(){let t=(await i.all("SELECT * FROM category_mapping")).map(t=>[t.id,t.transferId]),e=(await i.all("SELECT * FROM payee_mapping")).map(t=>[t.id,t.targetId]);o=new Map(t.concat(e)),a&&a(),a=Object(n.a)(u)}function u(t,e){e.forEach((t,e)=>{if(-1!==e.indexOf("mapping")){let r="category_mapping"===e?"transferId":"targetId";t.forEach(t=>{o.set(t.id,t[r])})}})}function c(){return o}},function(t,e,r){"use strict";r.d(e,"a",(function(){return c}));var n=r(3),i=r(26),o={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},a=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,s=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,u=/^([+-])(\d{2})(?::?(\d{2}))?$/;function c(t,e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var r=e||{},o=null==r.additionalDigits?2:Object(n.a)(r.additionalDigits);if(2!==o&&1!==o&&0!==o)throw new RangeError("additionalDigits must be 0, 1 or 2");if("string"!=typeof t&&"[object String]"!==Object.prototype.toString.call(t))return new Date(NaN);var a=l(t),s=f(a.date,o),u=d(s.restDateString,s.year);if(isNaN(u)||!u)return new Date(NaN);var c,h=u.getTime(),p=0;if(a.time&&(p=g(a.time),isNaN(p)))return new Date(NaN);if(a.timezone){if(c=m(a.timezone),isNaN(c))return new Date(NaN)}else{var y=h+p,b=new Date(y);c=Object(i.a)(b);var w=new Date(y);w.setDate(b.getDate()+1);var _=Object(i.a)(w)-c;_>0&&(c+=_)}return new Date(h+p+c)}function l(t){var e,r={},n=t.split(o.dateTimeDelimiter);if(/:/.test(n[0])?(r.date=null,e=n[0]):(r.date=n[0],e=n[1],o.timeZoneDelimiter.test(r.date)&&(r.date=t.split(o.timeZoneDelimiter)[0],e=t.substr(r.date.length,t.length))),e){var i=o.timezone.exec(e);i?(r.time=e.replace(i[1],""),r.timezone=i[1]):r.time=e}return r}function f(t,e){var r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),n=t.match(r);if(!n)return{year:null};var i=n[1]&&parseInt(n[1]),o=n[2]&&parseInt(n[2]);return{year:null==o?i:100*o,restDateString:t.slice((n[1]||n[2]).length)}}function d(t,e){if(null===e)return null;var r=t.match(a);if(!r)return null;var n=!!r[4],i=h(r[1]),o=h(r[2])-1,s=h(r[3]),u=h(r[4])-1,c=h(r[5])-1;if(n)return function(t,e,r){return!(e<0||e>52||r<0||r>6)}(0,u,c)?function(t,e,r){var n=new Date(0);n.setUTCFullYear(t,0,4);var i=n.getUTCDay()||7,o=7*(e||0)+(r||0)+1-i;return n.setUTCDate(n.getUTCDate()+o),n}(e,u,c):new Date(NaN);var l=new Date(0);return function(t,e,r){return!(e<0||e>11||r<1||r>(y[e]||(b(t)?29:28)))}(e,o,s)&&function(t,e){return!(e<1||e>(b(t)?366:365))}(e,i)?(l.setUTCFullYear(e,o,Math.max(i,s)),l):new Date(NaN)}function h(t){return t?parseInt(t):1}function g(t){var e=t.match(s);if(!e)return null;var r=p(e[1]),n=p(e[2]),i=p(e[3]);return function(t,e,r){return!(r<0||r>=60||e<0||e>=60||t<0||t>=25)}(r,n,i)?r%24*36e5+6e4*n+1e3*i:NaN}function p(t){return t&&parseFloat(t.replace(",","."))||0}function m(t){if("Z"===t)return 0;var e=t.match(u);if(!e)return 0;var r="+"===e[1]?-1:1,n=parseInt(e[2]),i=e[3]&&parseInt(e[3])||0;return function(t,e){return!(e<0||e>59)}(0,i)?r*(36e5*n+6e4*i):NaN}var y=[31,null,31,30,31,30,31,31,30,31,30,31];function b(t){return t%400==0||t%4==0&&t%100}},function(t,e,r){(function(t){var n=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,n,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,n,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(n,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(298),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(24))},function(t,e,r){"use strict";(function(e){void 0===e||!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,r,n,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,a,s=arguments.length;switch(s){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick((function(){t.call(null,r)}));case 3:return e.nextTick((function(){t.call(null,r,n)}));case 4:return e.nextTick((function(){t.call(null,r,n,i)}));default:for(o=new Array(s-1),a=0;a<o.length;)o[a++]=arguments[a];return e.nextTick((function(){t.apply(null,o)}))}}}:t.exports=e}).call(this,r(20))},function(t,e,r){var n=r(17).Buffer;function i(t){n.isBuffer(t)||(t=n.from(t));for(var e=t.length/4|0,r=new Array(e),i=0;i<e;i++)r[i]=t.readUInt32BE(4*i);return r}function o(t){for(;0<t.length;t++)t[0]=0}function a(t,e,r,n,i){for(var o,a,s,u,c=r[0],l=r[1],f=r[2],d=r[3],h=t[0]^e[0],g=t[1]^e[1],p=t[2]^e[2],m=t[3]^e[3],y=4,b=1;b<i;b++)o=c[h>>>24]^l[g>>>16&255]^f[p>>>8&255]^d[255&m]^e[y++],a=c[g>>>24]^l[p>>>16&255]^f[m>>>8&255]^d[255&h]^e[y++],s=c[p>>>24]^l[m>>>16&255]^f[h>>>8&255]^d[255&g]^e[y++],u=c[m>>>24]^l[h>>>16&255]^f[g>>>8&255]^d[255&p]^e[y++],h=o,g=a,p=s,m=u;return o=(n[h>>>24]<<24|n[g>>>16&255]<<16|n[p>>>8&255]<<8|n[255&m])^e[y++],a=(n[g>>>24]<<24|n[p>>>16&255]<<16|n[m>>>8&255]<<8|n[255&h])^e[y++],s=(n[p>>>24]<<24|n[m>>>16&255]<<16|n[h>>>8&255]<<8|n[255&g])^e[y++],u=(n[m>>>24]<<24|n[h>>>16&255]<<16|n[g>>>8&255]<<8|n[255&p])^e[y++],[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 t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<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 l=t[a],f=t[l],d=t[f],h=257*t[c]^16843008*c;i[0][a]=h<<24|h>>>8,i[1][a]=h<<16|h>>>16,i[2][a]=h<<8|h>>>24,i[3][a]=h,h=16843009*d^65537*f^257*l^16843008*a,o[0][c]=h<<24|h>>>8,o[1][c]=h<<16|h>>>16,o[2][c]=h<<8|h>>>24,o[3][c]=h,0===a?a=s=1:(a=l^t[t[t[d^l]]],s^=t[t[s]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function c(t){this._key=i(t),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=4*(r+1),i=[],o=0;o<e;o++)i[o]=t[o];for(o=e;o<n;o++){var a=i[o-1];o%e==0?(a=a<<8|a>>>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/e|0]<<24):e>6&&o%e==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-e]^a}for(var c=[],l=0;l<n;l++){var f=n-l,d=i[f-(l%4?0:4)];c[l]=l<4||f<=4?d:u.INV_SUB_MIX[0][u.SBOX[d>>>24]]^u.INV_SUB_MIX[1][u.SBOX[d>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[d>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&d]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=c},c.prototype.encryptBlockRaw=function(t){return a(t=i(t),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},c.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=n.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},c.prototype.decryptBlock=function(t){var e=(t=i(t))[1];t[1]=t[3],t[3]=e;var r=a(t,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},function(t,e,r){var n=r(17).Buffer,i=r(142);t.exports=function(t,e,r,o){if(n.isBuffer(t)||(t=n.from(t,"binary")),e&&(n.isBuffer(e)||(e=n.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var a=r/8,s=n.alloc(a),u=n.alloc(o||0),c=n.alloc(0);a>0||o>0;){var l=new i;l.update(c),l.update(t),e&&l.update(e),c=l.digest();var f=0;if(a>0){var d=s.length-a;f=Math.min(a,c.length),c.copy(s,d,0,f),a-=f}if(f<c.length&&o>0){var h=u.length-o,g=Math.min(o,c.length-f);c.copy(u,h,f,f+g),o-=g}}return c.fill(0),{key:s,iv:u}}},function(t,e,r){"use strict";var n=r(35),i=r(43),o=i.getNAF,a=i.getJSF,s=i.assert;function u(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){s(t.precomputed);var r=t._getDoubles(),n=o(e,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var a,u,c=[];for(a=0;a<n.length;a+=r.step){u=0;for(var l=a+r.step-1;l>=a;l--)u=(u<<1)+n[l];c.push(u)}for(var f=this.jpoint(null,null,null),d=this.jpoint(null,null,null),h=i;h>0;h--){for(a=0;a<c.length;a++)(u=c[a])===h?d=d.mixedAdd(r.points[a]):u===-h&&(d=d.mixedAdd(r.points[a].neg()));f=f.add(d)}return f.toP()},u.prototype._wnafMul=function(t,e){var r=4,n=t._getNAFPoints(r);r=n.wnd;for(var i=n.points,a=o(e,r,this._bitLength),u=this.jpoint(null,null,null),c=a.length-1;c>=0;c--){for(var l=0;c>=0&&0===a[c];c--)l++;if(c>=0&&l++,u=u.dblp(l),c<0)break;var f=a[c];s(0!==f),u="affine"===t.type?f>0?u.mixedAdd(i[f-1>>1]):u.mixedAdd(i[-f-1>>1].neg()):f>0?u.add(i[f-1>>1]):u.add(i[-f-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,i){var s,u,c,l=this._wnafT1,f=this._wnafT2,d=this._wnafT3,h=0;for(s=0;s<n;s++){var g=(c=e[s])._getNAFPoints(t);l[s]=g.wnd,f[s]=g.points}for(s=n-1;s>=1;s-=2){var p=s-1,m=s;if(1===l[p]&&1===l[m]){var y=[e[p],null,null,e[m]];0===e[p].y.cmp(e[m].y)?(y[1]=e[p].add(e[m]),y[2]=e[p].toJ().mixedAdd(e[m].neg())):0===e[p].y.cmp(e[m].y.redNeg())?(y[1]=e[p].toJ().mixedAdd(e[m]),y[2]=e[p].add(e[m].neg())):(y[1]=e[p].toJ().mixedAdd(e[m]),y[2]=e[p].toJ().mixedAdd(e[m].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],w=a(r[p],r[m]);for(h=Math.max(w[0].length,h),d[p]=new Array(h),d[m]=new Array(h),u=0;u<h;u++){var _=0|w[0][u],v=0|w[1][u];d[p][u]=b[3*(_+1)+(v+1)],d[m][u]=0,f[p]=y}}else d[p]=o(r[p],l[p],this._bitLength),d[m]=o(r[m],l[m],this._bitLength),h=Math.max(d[p].length,h),h=Math.max(d[m].length,h)}var E=this.jpoint(null,null,null),S=this._wnafT4;for(s=h;s>=0;s--){for(var O=0;s>=0;){var T=!0;for(u=0;u<n;u++)S[u]=0|d[u][s],0!==S[u]&&(T=!1);if(!T)break;O++,s--}if(s>=0&&O++,E=E.dblp(O),s<0)break;for(u=0;u<n;u++){var A=S[u];0!==A&&(A>0?c=f[u][A-1>>1]:A<0&&(c=f[u][-A-1>>1].neg()),E="affine"===c.type?E.mixedAdd(c):E.add(c))}}for(s=0;s<n;s++)f[s]=null;return i?E:E.toP()},u.BasePoint=c,c.prototype.eq=function(){throw new Error("Not implemented")},c.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(t,e){t=i.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?s(t[t.length-1]%2==0):7===t[0]&&s(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},c.prototype.encodeCompressed=function(t){return this.encode(t,!0)},c.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},c.prototype.encode=function(t,e){return i.encode(this._encode(e),t)},c.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},c.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},c.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)n=n.dbl();r.push(n)}return{step:t,points:r}},c.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},c.prototype._getBeta=function(){return null},c.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e}},function(t,e,r){var n=r(383),i=r(390),o=r(391),a=r(147),s=r(197),u=r(17).Buffer;function c(t){var e;"object"!=typeof t||u.isBuffer(t)||(e=t.passphrase,t=t.key),"string"==typeof t&&(t=u.from(t));var r,c,l=o(t,e),f=l.tag,d=l.data;switch(f){case"CERTIFICATE":c=n.certificate.decode(d,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(c||(c=n.PublicKey.decode(d,"der")),r=c.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return n.RSAPublicKey.decode(c.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return c.subjectPrivateKey=c.subjectPublicKey,{type:"ec",data:c};case"1.2.840.10040.4.1":return c.algorithm.params.pub_key=n.DSAparam.decode(c.subjectPublicKey.data,"der"),{type:"dsa",data:c.algorithm.params};default:throw new Error("unknown key id "+r)}case"ENCRYPTED PRIVATE KEY":d=function(t,e){var r=t.algorithm.decrypt.kde.kdeparams.salt,n=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=i[t.algorithm.decrypt.cipher.algo.join(".")],c=t.algorithm.decrypt.cipher.iv,l=t.subjectPrivateKey,f=parseInt(o.split("-")[1],10)/8,d=s.pbkdf2Sync(e,r,n,f,"sha1"),h=a.createDecipheriv(o,d,c),g=[];return g.push(h.update(l)),g.push(h.final()),u.concat(g)}(d=n.EncryptedPrivateKey.decode(d,"der"),e);case"PRIVATE KEY":switch(r=(c=n.PrivateKey.decode(d,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return n.RSAPrivateKey.decode(c.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:c.algorithm.curve,privateKey:n.ECPrivateKey.decode(c.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return c.algorithm.params.priv_key=n.DSAparam.decode(c.subjectPrivateKey,"der"),{type:"dsa",params:c.algorithm.params};default:throw new Error("unknown key id "+r)}case"RSA PUBLIC KEY":return n.RSAPublicKey.decode(d,"der");case"RSA PRIVATE KEY":return n.RSAPrivateKey.decode(d,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:n.DSAPrivateKey.decode(d,"der")};case"EC PRIVATE KEY":return{curve:(d=n.ECPrivateKey.decode(d,"der")).parameters.value,privateKey:d.privateKey};default:throw new Error("unknown key type "+f)}}t.exports=c,c.signature=n.signature},function(t,e,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)i(r,n)&&(t[n]=r[n])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var o={arraySet:function(t,e,r,n,i){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+n),i);else for(var o=0;o<n;o++)t[i+o]=e[r+o]},flattenChunks:function(t){var e,r,n,i,o,a;for(n=0,e=0,r=t.length;e<r;e++)n+=t[e].length;for(a=new Uint8Array(n),i=0,e=0,r=t.length;e<r;e++)o=t[e],a.set(o,i),i+=o.length;return a}},a={arraySet:function(t,e,r,n,i){for(var o=0;o<n;o++)t[i+o]=e[r+o]},flattenChunks:function(t){return[].concat.apply([],t)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,o)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,a))},e.setTyped(n)},function(t,e,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(t,e);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},function(t,e,r){"use strict";var n=r(162),i=r(77),o=i("%Function.prototype.apply%"),a=i("%Function.prototype.call%"),s=i("%Reflect.apply%",!0)||n.call(a,o),u=i("%Object.getOwnPropertyDescriptor%",!0),c=i("%Object.defineProperty%",!0),l=i("%Math.max%");if(c)try{c({},"a",{value:1})}catch(t){c=null}t.exports=function(t){var e=s(n,a,arguments);if(u&&c){var r=u(e,"length");r.configurable&&c(e,"length",{value:1+l(0,t.length-(arguments.length-1))})}return e};var f=function(){return s(n,o,arguments)};c?c(t.exports,"apply",{value:f}):t.exports.apply=f},function(t,e){e.endianness=function(){return"LE"},e.hostname=function(){return"undefined"!=typeof location?location.hostname:""},e.loadavg=function(){return[]},e.uptime=function(){return 0},e.freemem=function(){return Number.MAX_VALUE},e.totalmem=function(){return Number.MAX_VALUE},e.cpus=function(){return[]},e.type=function(){return"Browser"},e.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},e.networkInterfaces=e.getNetworkInterfaces=function(){return{}},e.arch=function(){return"javascript"},e.platform=function(){return"browser"},e.tmpdir=e.tmpDir=function(){return"/tmp"},e.EOL="\n",e.homedir=function(){return"/"}},function(t,e,r){"use strict";(function(e){let n=r(104);e.version[1]>5&&(n=r(465)),t.exports=n}).call(this,r(20))},function(t,e){t.exports={first:function(t){return t[0]},firstValue:function(t){const e=Object.keys(t[0]);return t[0][e[0]]},number:function(t){if("number"==typeof t)return t;if("string"==typeof t){const e=parseFloat(t);return isNaN(e)?0:e}return 0},min:function(t,e){return Math.min(t,e)},max:function(t,e){return Math.max(t,e)}}},function(t,e,r){"use strict";r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return a}));var n=r(9),i=r(1);function o(){let t=i.runQuery("SELECT timestamp FROM messages_crdt",[],!0),e={};for(let r=0;r<t.length;r++)e=n.f.insert(e,n.a.parse(t[r].timestamp));return{numMessages:t.length,trie:e}}async function a(){let t=o(),e=Object(n.c)();e.merkle=t.trie,i.runQuery(i.cache("INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)"),[Object(n.g)(e)])}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(3),i=r(55);function o(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(n.a)(e);return Object(i.a)(t,12*r)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(0),i=r(45),o=r(36);function a(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(n.a)(t),a=Object(n.a)(e),s=Object(o.a)(r,a),u=Math.abs(Object(i.a)(r,a));r.setDate(r.getDate()-s*u);var c=Object(o.a)(r,a)===-s,l=s*(u-c);return 0===l?0:l}},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(0);function i(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(n.a)(t),r=e.getDate();return r}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(0),i=r(58);function o(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(n.a)(t),r=e.getUTCFullYear(),o=new Date(0);o.setUTCFullYear(r+1,0,4),o.setUTCHours(0,0,0,0);var a=Object(i.a)(o),s=new Date(0);s.setUTCFullYear(r,0,4),s.setUTCHours(0,0,0,0);var u=Object(i.a)(s);return e.getTime()>=a.getTime()?r+1:e.getTime()>=u.getTime()?r:r-1}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(3),i=r(55);function o(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(n.a)(e);return Object(i.a)(t,-r)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(3),i=r(46);function o(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(n.a)(e);return Object(i.a)(t,-r)}},function(t,e,r){"use strict";e.a=function(t){return{all:t=t||new Map,on:function(e,r){var n=t.get(e);n&&n.push(r)||t.set(e,[r])},off:function(e,r){var n=t.get(e);n&&n.splice(n.indexOf(r)>>>0,1)},emit:function(e,r){(t.get(e)||[]).slice().map((function(t){t(r)})),(t.get("*")||[]).slice().map((function(t){t(e,r)}))}}}},function(t,e){t.exports={fetch:self.fetch,fetchBinary:()=>{throw new Error("fetchBinary not implemented")}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(1);async function i(){let t=await n.first("\n SELECT * FROM categories\n WHERE is_income = 1 AND\n LOWER(name) = 'starting balances' AND\n tombstone = 0\n ");return null===t&&(t=await n.first("SELECT * FROM categories WHERE is_income = 1 AND tombstone = 0")),{id:await async function(t){let e=await n.first("SELECT id FROM payees WHERE LOWER(name) = ? AND tombstone = 0",[t.toLowerCase()]);return e?e.id:n.insertPayee({name:t})}("Starting Balance"),category:t?t.id:null}}},function(t,e,r){"use strict";function n(t,e){switch(t){case"brokerage":case"investment":return"investment";case"credit":return"credit";case"loan":return"debt";case"other":return"other";case"depository":default:switch(e){case"money market":case"savings":return"savings";case"cd":return"cd";default:return"checking"}}}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return u}));var n=r(0),i=r(48),o=r(3),a=r(89);function s(t,e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var r=e||{},n=r.locale,s=n&&n.options&&n.options.firstWeekContainsDate,u=null==s?1:Object(o.a)(s),c=null==r.firstWeekContainsDate?u:Object(o.a)(r.firstWeekContainsDate),l=Object(a.a)(t,e),f=new Date(0);f.setUTCFullYear(l,0,c),f.setUTCHours(0,0,0,0);var d=Object(i.a)(f,e);return d}function u(t,e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var r=Object(n.a)(t),o=Object(i.a)(r,e).getTime()-s(r,e).getTime();return Math.round(o/6048e5)+1}},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(0),i=r(58),o=r(125);function a(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(o.a)(t),r=new Date(0);r.setUTCFullYear(e,0,4),r.setUTCHours(0,0,0,0);var n=Object(i.a)(r);return n}function s(t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var e=Object(n.a)(t),r=Object(i.a)(e).getTime()-a(e).getTime();return Math.round(r/6048e5)+1}},function(t,e,r){"use strict";r.d(e,"b",(function(){return p})),r.d(e,"a",(function(){return m}));var n=r(10),i=r.n(n),o=r(131),a=r(15),s=r(1),u=r(6),c=r(30),l=r(19),f=r(38);function d(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return h(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return h(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}const g=r(41);async function p(t,e){let r=d(await i.a.multiGet(["user-id","user-key"]),2),n=d(r[0],2)[1],o=d(r[1],2)[1];if(null==t||!t.institution_id||!t.name)throw new Error("Invalid institution object");let a=g.v4Sync();return await Object(c.post)(Object(l.a)().PLAID_SERVER+"/handoff_public_token",{userId:n,key:o,item_id:a,public_token:e}),await Object(u.runMutator)(()=>s.insertWithUUID("banks",{id:a,bank_id:t.institution_id,name:t.name})),a}async function m(t,e,r=[]){let n=d(await i.a.multiGet(["user-id","user-key"]),2),c=d(n[0],2)[1],l=d(n[1],2)[1],h=await f.b(c,l,t);return h=h.filter(t=>e.includes(t.account_id)),Promise.all(h.map(async e=>{let n=await Object(u.runMutator)(async()=>{let n=await s.insertAccount({account_id:e.account_id,name:e.name,official_name:e.official_name,type:Object(o.a)(e.type),balance_current:Object(a.a)(e.balances.current),mask:e.mask,bank:t,offbudget:r.includes(e.account_id)?1:0});return await s.insertPayee({name:"",transfer_acct:n}),n});return await f.d(c,l,n,e.account_id,t),n}))}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(96),i=r(292),o=n.constants.S_IFMT,a=n.constants.S_IFDIR,s=n.constants.S_IFREG,u=n.constants.S_IFBLK,c=n.constants.S_IFCHR,l=n.constants.S_IFLNK,f=n.constants.S_IFIFO,d=n.constants.S_IFSOCK,h=function(){function t(){}return t.build=function(e,r){void 0===r&&(r=!1);var n=new t,o=e.uid,a=e.gid,s=e.atime,u=e.mtime,c=e.ctime,l=r?i.default:function(t){return t};n.uid=l(o),n.gid=l(a),n.rdev=l(0),n.blksize=l(4096),n.ino=l(e.ino),n.size=l(e.getSize()),n.blocks=l(1),n.atime=s,n.mtime=u,n.ctime=c,n.birthtime=c,n.atimeMs=l(s.getTime()),n.mtimeMs=l(u.getTime());var f=l(c.getTime());return n.ctimeMs=f,n.birthtimeMs=f,n.dev=l(0),n.mode=l(e.mode),n.nlink=l(e.nlink),n},t.prototype._checkModeProperty=function(t){return(Number(this.mode)&o)===t},t.prototype.isDirectory=function(){return this._checkModeProperty(a)},t.prototype.isFile=function(){return this._checkModeProperty(s)},t.prototype.isBlockDevice=function(){return this._checkModeProperty(u)},t.prototype.isCharacterDevice=function(){return this._checkModeProperty(c)},t.prototype.isSymbolicLink=function(){return this._checkModeProperty(l)},t.prototype.isFIFO=function(){return this._checkModeProperty(f)},t.prototype.isSocket=function(){return this._checkModeProperty(d)},t}();e.Stats=h,e.default=h},function(t,e,r){"use strict";var n=this&&this.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),i=0;for(e=0;e<r;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)n[i]=o[a];return n};Object.defineProperty(e,"__esModule",{value:!0});var i=r(14);function o(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return new(i.Buffer.bind.apply(i.Buffer,n([void 0,t],e)))}e.Buffer=i.Buffer;var a=i.Buffer.allocUnsafe||o;e.bufferAllocUnsafe=a;var s=i.Buffer.from||o;e.bufferFrom=s},function(t,e,r){"use strict";(function(e){var n=r(293);
11
+ /*!
12
+ * The buffer module from node.js, for the browser.
13
+ *
14
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
15
+ * @license MIT
16
+ */function i(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0}function o(t){return e.Buffer&&"function"==typeof e.Buffer.isBuffer?e.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var a=r(81),s=Object.prototype.hasOwnProperty,u=Array.prototype.slice,c="foo"===function(){}.name;function l(t){return Object.prototype.toString.call(t)}function f(t){return!o(t)&&("function"==typeof e.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var d=t.exports=b,h=/\s*function\s+([^\(\s]*)\s*/;function g(t){if(a.isFunction(t)){if(c)return t.name;var e=t.toString().match(h);return e&&e[1]}}function p(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function m(t){if(c||!a.isFunction(t))return a.inspect(t);var e=g(t);return"[Function"+(e?": "+e:"")+"]"}function y(t,e,r,n,i){throw new d.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function b(t,e){t||y(t,!0,e,"==",d.ok)}function w(t,e,r,n){if(t===e)return!0;if(o(t)&&o(e))return 0===i(t,e);if(a.isDate(t)&&a.isDate(e))return t.getTime()===e.getTime();if(a.isRegExp(t)&&a.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(f(t)&&f(e)&&l(t)===l(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===i(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(o(t)!==o(e))return!1;var s=(n=n||{actual:[],expected:[]}).actual.indexOf(t);return-1!==s&&s===n.expected.indexOf(e)||(n.actual.push(t),n.expected.push(e),function(t,e,r,n){if(null==t||null==e)return!1;if(a.isPrimitive(t)||a.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=_(t),o=_(e);if(i&&!o||!i&&o)return!1;if(i)return t=u.call(t),e=u.call(e),w(t,e,r);var s,c,l=S(t),f=S(e);if(l.length!==f.length)return!1;for(l.sort(),f.sort(),c=l.length-1;c>=0;c--)if(l[c]!==f[c])return!1;for(c=l.length-1;c>=0;c--)if(s=l[c],!w(t[s],e[s],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function _(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function v(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function E(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&y(i,r,"Missing expected exception"+n);var o="string"==typeof n,s=!t&&i&&!r;if((!t&&a.isError(i)&&o&&v(i,r)||s)&&y(i,r,"Got unwanted exception"+n),t&&i&&r&&!v(i,r)||!t&&i)throw i}d.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return p(m(t.actual),128)+" "+t.operator+" "+p(m(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||y;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=g(e),o=n.indexOf("\n"+i);if(o>=0){var a=n.indexOf("\n",o+1);n=n.substring(a+1)}this.stack=n}}},a.inherits(d.AssertionError,Error),d.fail=y,d.ok=b,d.equal=function(t,e,r){t!=e&&y(t,e,r,"==",d.equal)},d.notEqual=function(t,e,r){t==e&&y(t,e,r,"!=",d.notEqual)},d.deepEqual=function(t,e,r){w(t,e,!1)||y(t,e,r,"deepEqual",d.deepEqual)},d.deepStrictEqual=function(t,e,r){w(t,e,!0)||y(t,e,r,"deepStrictEqual",d.deepStrictEqual)},d.notDeepEqual=function(t,e,r){w(t,e,!1)&&y(t,e,r,"notDeepEqual",d.notDeepEqual)},d.notDeepStrictEqual=function t(e,r,n){w(e,r,!0)&&y(e,r,n,"notDeepStrictEqual",t)},d.strictEqual=function(t,e,r){t!==e&&y(t,e,r,"===",d.strictEqual)},d.notStrictEqual=function(t,e,r){t===e&&y(t,e,r,"!==",d.notStrictEqual)},d.throws=function(t,e,r){E(!0,t,e,r)},d.doesNotThrow=function(t,e,r){E(!1,t,e,r)},d.ifError=function(t){if(t)throw t},d.strict=n((function t(e,r){e||y(e,!0,r,"==",t)}),d,{equal:d.strictEqual,deepEqual:d.deepStrictEqual,notEqual:d.notStrictEqual,notDeepEqual:d.notDeepStrictEqual}),d.strict.strict=d.strict;var S=Object.keys||function(t){var e=[];for(var r in t)s.call(t,r)&&e.push(r);return e}}).call(this,r(24))},function(t,e,r){(e=t.exports=r(180)).Stream=e,e.Readable=e,e.Writable=r(140),e.Duplex=r(76),e.Transform=r(183),e.PassThrough=r(303)},function(t,e,r){var n=r(14),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function a(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=a),o(i,a),a.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},a.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e,r){"use strict";(function(e,n,i){var o=r(110);function a(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=b;var s,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?n:o.nextTick;b.WritableState=y;var c=Object.create(r(98));c.inherits=r(11);var l={deprecate:r(141)},f=r(181),d=r(139).Buffer,h=i.Uint8Array||function(){};var g,p=r(182);function m(){}function y(t,e){s=s||r(76),t=t||{};var n=e instanceof s;this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,c=t.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(c||0===c)?c:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===t.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(o.nextTick(i,n),o.nextTick(O,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),O(t,e))}(t,r,n,e,i);else{var a=E(r);a||r.corked||r.bufferProcessing||!r.bufferedRequest||v(t,r),n?u(_,t,r,a,i):_(t,r,a,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function b(t){if(s=s||r(76),!(g.call(b,this)||this instanceof s))return new b(t);this._writableState=new y(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),f.call(this)}function w(t,e,r,n,i,o,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function _(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),O(t,e)}function v(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var s=0,u=!0;r;)i[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;i.allBuffers=u,w(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new a(e),e.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,f=r.callback;if(w(t,e,!1,e.objectMode?1:c.length,c,l,f),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function E(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function S(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),O(t,e)}))}function O(t,e){var r=E(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(S,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}c.inherits(b,f),y.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(y.prototype,"buffer",{get:l.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(g=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(t){return!!g.call(this,t)||this===b&&(t&&t._writableState instanceof y)}})):g=function(t){return t instanceof this},b.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},b.prototype.write=function(t,e,r){var n,i=this._writableState,a=!1,s=!i.objectMode&&(n=t,d.isBuffer(n)||n instanceof h);return s&&!d.isBuffer(t)&&(t=function(t){return d.from(t)}(t)),"function"==typeof e&&(r=e,e=null),s?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=m),i.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),o.nextTick(e,r)}(this,r):(s||function(t,e,r,n){var i=!0,a=!1;return null===r?a=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),o.nextTick(n,a),i=!1),i}(this,i,t,r))&&(i.pendingcb++,a=function(t,e,r,n,i,o){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=d.from(e,r));return e}(e,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=e.objectMode?1:n.length;e.length+=s;var u=e.length<e.highWaterMark;u||(e.needDrain=!0);if(e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else w(t,e,!1,s,n,i,o);return u}(this,i,s,t,e,r)),a},b.prototype.cork=function(){this._writableState.corked++},b.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||v(this,t))},b.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),b.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},b.prototype._writev=null,b.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,O(t,e),r&&(e.finished?o.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(b.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),b.prototype.destroy=p.destroy,b.prototype._undestroy=p.undestroy,b.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(20),r(109).setImmediate,r(24))},function(t,e,r){(function(e){function r(t){try{if(!e.localStorage)return!1}catch(t){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,r(24))},function(t,e,r){"use strict";var n=r(11),i=r(185),o=r(17).Buffer,a=new Array(16);function s(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<<e|t>>>32-e}function c(t,e,r,n,i,o,a){return u(t+(e&r|~e&n)+i+o|0,a)+e|0}function l(t,e,r,n,i,o,a){return u(t+(e&n|r&~n)+i+o|0,a)+e|0}function f(t,e,r,n,i,o,a){return u(t+(e^r^n)+i+o|0,a)+e|0}function d(t,e,r,n,i,o,a){return u(t+(r^(e|~n))+i+o|0,a)+e|0}n(s,i),s.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d;r=c(r,n,i,o,t[0],3614090360,7),o=c(o,r,n,i,t[1],3905402710,12),i=c(i,o,r,n,t[2],606105819,17),n=c(n,i,o,r,t[3],3250441966,22),r=c(r,n,i,o,t[4],4118548399,7),o=c(o,r,n,i,t[5],1200080426,12),i=c(i,o,r,n,t[6],2821735955,17),n=c(n,i,o,r,t[7],4249261313,22),r=c(r,n,i,o,t[8],1770035416,7),o=c(o,r,n,i,t[9],2336552879,12),i=c(i,o,r,n,t[10],4294925233,17),n=c(n,i,o,r,t[11],2304563134,22),r=c(r,n,i,o,t[12],1804603682,7),o=c(o,r,n,i,t[13],4254626195,12),i=c(i,o,r,n,t[14],2792965006,17),r=l(r,n=c(n,i,o,r,t[15],1236535329,22),i,o,t[1],4129170786,5),o=l(o,r,n,i,t[6],3225465664,9),i=l(i,o,r,n,t[11],643717713,14),n=l(n,i,o,r,t[0],3921069994,20),r=l(r,n,i,o,t[5],3593408605,5),o=l(o,r,n,i,t[10],38016083,9),i=l(i,o,r,n,t[15],3634488961,14),n=l(n,i,o,r,t[4],3889429448,20),r=l(r,n,i,o,t[9],568446438,5),o=l(o,r,n,i,t[14],3275163606,9),i=l(i,o,r,n,t[3],4107603335,14),n=l(n,i,o,r,t[8],1163531501,20),r=l(r,n,i,o,t[13],2850285829,5),o=l(o,r,n,i,t[2],4243563512,9),i=l(i,o,r,n,t[7],1735328473,14),r=f(r,n=l(n,i,o,r,t[12],2368359562,20),i,o,t[5],4294588738,4),o=f(o,r,n,i,t[8],2272392833,11),i=f(i,o,r,n,t[11],1839030562,16),n=f(n,i,o,r,t[14],4259657740,23),r=f(r,n,i,o,t[1],2763975236,4),o=f(o,r,n,i,t[4],1272893353,11),i=f(i,o,r,n,t[7],4139469664,16),n=f(n,i,o,r,t[10],3200236656,23),r=f(r,n,i,o,t[13],681279174,4),o=f(o,r,n,i,t[0],3936430074,11),i=f(i,o,r,n,t[3],3572445317,16),n=f(n,i,o,r,t[6],76029189,23),r=f(r,n,i,o,t[9],3654602809,4),o=f(o,r,n,i,t[12],3873151461,11),i=f(i,o,r,n,t[15],530742520,16),r=d(r,n=f(n,i,o,r,t[2],3299628645,23),i,o,t[0],4096336452,6),o=d(o,r,n,i,t[7],1126891415,10),i=d(i,o,r,n,t[14],2878612391,15),n=d(n,i,o,r,t[5],4237533241,21),r=d(r,n,i,o,t[12],1700485571,6),o=d(o,r,n,i,t[3],2399980690,10),i=d(i,o,r,n,t[10],4293915773,15),n=d(n,i,o,r,t[1],2240044497,21),r=d(r,n,i,o,t[8],1873313359,6),o=d(o,r,n,i,t[15],4264355552,10),i=d(i,o,r,n,t[6],2734768916,15),n=d(n,i,o,r,t[13],1309151649,21),r=d(r,n,i,o,t[4],4149444226,6),o=d(o,r,n,i,t[11],3174756917,10),i=d(i,o,r,n,t[2],718787259,15),n=d(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=s},function(t,e,r){"use strict";var n=r(83).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(o||i);var a=r.readable||!1!==r.readable&&e.readable,s=r.writable||!1!==r.writable&&e.writable,u=function(){e.writable||l()},c=e._writableState&&e._writableState.finished,l=function(){s=!1,c=!0,a||o.call(e)},f=e._readableState&&e._readableState.endEmitted,d=function(){a=!1,f=!0,s||o.call(e)},h=function(t){o.call(e,t)},g=function(){var t;return a&&!f?(e._readableState&&e._readableState.ended||(t=new n),o.call(e,t)):s&&!c?(e._writableState&&e._writableState.ended||(t=new n),o.call(e,t)):void 0},p=function(){e.req.on("finish",l)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(e)?s&&!e._writableState&&(e.on("end",u),e.on("close",u)):(e.on("complete",l),e.on("abort",g),e.req?p():e.on("request",p)),e.on("end",d),e.on("finish",l),!1!==r.error&&e.on("error",h),e.on("close",g),function(){e.removeListener("complete",l),e.removeListener("abort",g),e.removeListener("request",p),e.req&&e.req.removeListener("finish",l),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",l),e.removeListener("end",d),e.removeListener("error",h),e.removeListener("close",g)}}},function(t,e,r){"use strict";var n=r(14).Buffer,i=r(11),o=r(185),a=new Array(16),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],c=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],l=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],f=[0,1518500249,1859775393,2400959708,2840853838],d=[1352829926,1548603684,1836072691,2053994217,0];function h(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function g(t,e){return t<<e|t>>>32-e}function p(t,e,r,n,i,o,a,s){return g(t+(e^r^n)+o+a|0,s)+i|0}function m(t,e,r,n,i,o,a,s){return g(t+(e&r|~e&n)+o+a|0,s)+i|0}function y(t,e,r,n,i,o,a,s){return g(t+((e|~r)^n)+o+a|0,s)+i|0}function b(t,e,r,n,i,o,a,s){return g(t+(e&n|r&~n)+o+a|0,s)+i|0}function w(t,e,r,n,i,o,a,s){return g(t+(e^(r|~n))+o+a|0,s)+i|0}i(h,o),h.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,h=0|this._e,_=0|this._a,v=0|this._b,E=0|this._c,S=0|this._d,O=0|this._e,T=0;T<80;T+=1){var A,M;T<16?(A=p(r,n,i,o,h,t[s[T]],f[0],c[T]),M=w(_,v,E,S,O,t[u[T]],d[0],l[T])):T<32?(A=m(r,n,i,o,h,t[s[T]],f[1],c[T]),M=b(_,v,E,S,O,t[u[T]],d[1],l[T])):T<48?(A=y(r,n,i,o,h,t[s[T]],f[2],c[T]),M=y(_,v,E,S,O,t[u[T]],d[2],l[T])):T<64?(A=b(r,n,i,o,h,t[s[T]],f[3],c[T]),M=m(_,v,E,S,O,t[u[T]],d[3],l[T])):(A=w(r,n,i,o,h,t[s[T]],f[4],c[T]),M=p(_,v,E,S,O,t[u[T]],d[4],l[T])),r=h,h=o,o=g(i,10),i=n,n=A,_=O,O=S,S=g(E,10),E=v,v=M}var j=this._b+i+S|0;this._b=this._c+o+O|0,this._c=this._d+h+_|0,this._d=this._e+r+v|0,this._e=this._a+n+E|0,this._a=j},h.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=n.alloc?n.alloc(20):new n(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=h},function(t,e,r){(e=t.exports=function(t){t=t.toLowerCase();var r=e[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r}).sha=r(325),e.sha1=r(326),e.sha224=r(327),e.sha256=r(192),e.sha384=r(328),e.sha512=r(193)},function(t,e,r){"use strict";var n=r(42);function i(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}t.exports=i,i.prototype._init=function(){},i.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},i.prototype._buffer=function(t,e){for(var r=Math.min(this.buffer.length-this.bufferOff,t.length-e),n=0;n<r;n++)this.buffer[this.bufferOff+n]=t[e+n];return this.bufferOff+=r,r},i.prototype._flushBuffer=function(t,e){return this._update(this.buffer,0,t,e),this.bufferOff=0,this.blockSize},i.prototype._updateEncrypt=function(t){var e=0,r=0,n=(this.bufferOff+t.length)/this.blockSize|0,i=new Array(n*this.blockSize);0!==this.bufferOff&&(e+=this._buffer(t,e),this.bufferOff===this.buffer.length&&(r+=this._flushBuffer(i,r)));for(var o=t.length-(t.length-e)%this.blockSize;e<o;e+=this.blockSize)this._update(t,e,i,r),r+=this.blockSize;for(;e<t.length;e++,this.bufferOff++)this.buffer[this.bufferOff]=t[e];return i},i.prototype._updateDecrypt=function(t){for(var e=0,r=0,n=Math.ceil((this.bufferOff+t.length)/this.blockSize)-1,i=new Array(n*this.blockSize);n>0;n--)e+=this._buffer(t,e),r+=this._flushBuffer(i,r);return e+=this._buffer(t,e),i},i.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},i.prototype._pad=function(t,e){if(0===e)return!1;for(;e<t.length;)t[e++]=0;return!0},i.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var t=new Array(this.blockSize);return this._update(this.buffer,0,t,0),t},i.prototype._unpad=function(t){return t},i.prototype._finalDecrypt=function(){n.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var t=new Array(this.blockSize);return this._flushBuffer(t,0),this._unpad(t)}},function(t,e,r){var n=r(337),i=r(345),o=r(206);e.createCipher=e.Cipher=n.createCipher,e.createCipheriv=e.Cipheriv=n.createCipheriv,e.createDecipher=e.Decipher=i.createDecipher,e.createDecipheriv=e.Decipheriv=i.createDecipheriv,e.listCiphers=e.getCiphers=function(){return Object.keys(o)}},function(t,e,r){var n={ECB:r(338),CBC:r(339),CFB:r(340),CFB8:r(341),CFB1:r(342),OFB:r(343),CTR:r(204),GCM:r(204)},i=r(206);for(var o in i)i[o].module=n[i[o].mode];t.exports=i},function(t,e,r){var n;function i(t){this.rand=t}if(t.exports=function(t){return n||(n=new i(null)),n.generate(t)},t.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r<e.length;r++)e[r]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(i.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=r(349);if("function"!=typeof o.randomBytes)throw new Error("Not supported");i.prototype._rand=function(t){return o.randomBytes(t)}}catch(t){}},function(t,e,r){"use strict";var n=r(86).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(o||i);var a=r.readable||!1!==r.readable&&e.readable,s=r.writable||!1!==r.writable&&e.writable,u=function(){e.writable||l()},c=e._writableState&&e._writableState.finished,l=function(){s=!1,c=!0,a||o.call(e)},f=e._readableState&&e._readableState.endEmitted,d=function(){a=!1,f=!0,s||o.call(e)},h=function(t){o.call(e,t)},g=function(){var t;return a&&!f?(e._readableState&&e._readableState.ended||(t=new n),o.call(e,t)):s&&!c?(e._writableState&&e._writableState.ended||(t=new n),o.call(e,t)):void 0},p=function(){e.req.on("finish",l)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(e)?s&&!e._writableState&&(e.on("end",u),e.on("close",u)):(e.on("complete",l),e.on("abort",g),e.req?p():e.on("request",p)),e.on("end",d),e.on("finish",l),!1!==r.error&&e.on("error",h),e.on("close",g),function(){e.removeListener("complete",l),e.removeListener("abort",g),e.removeListener("request",p),e.req&&e.req.removeListener("finish",l),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",l),e.removeListener("end",d),e.removeListener("error",h),e.removeListener("close",g)}}},function(t,e,r){(function(e){var n=r(362),i=r(82);function o(t){var e,r=t.modulus.byteLength();do{e=new n(i(r))}while(e.cmp(t.modulus)>=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function a(t,r){var i=function(t){var e=o(t);return{blinder:e.toRed(n.mont(t.modulus)).redPow(new n(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(r),a=r.modulus.byteLength(),s=new n(t).mul(i.blinder).umod(r.modulus),u=s.toRed(n.mont(r.prime1)),c=s.toRed(n.mont(r.prime2)),l=r.coefficient,f=r.prime1,d=r.prime2,h=u.redPow(r.exponent1).fromRed(),g=c.redPow(r.exponent2).fromRed(),p=h.isub(g).imul(l).umod(f).imul(d);return g.iadd(p).imul(i.unblinder).umod(r.modulus).toArrayLike(e,"be",a)}a.getr=o,t.exports=a}).call(this,r(14).Buffer)},function(t,e,r){"use strict";var n=e;n.version=r(364).version,n.utils=r(43),n.rand=r(149),n.curve=r(218),n.curves=r(153),n.ec=r(375),n.eddsa=r(379)},function(t,e,r){"use strict";var n,i=e,o=r(154),a=r(218),s=r(43).assert;function u(t){"short"===t.type?this.curve=new a.short(t):"edwards"===t.type?this.curve=new a.edwards(t):this.curve=new a.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new u(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(374)}catch(t){n=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},function(t,e,r){var n=e;n.utils=r(51),n.common=r(101),n.sha=r(368),n.ripemd=r(372),n.hmac=r(373),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},function(t,e,r){"use strict";(function(e){var n,i=r(14),o=i.Buffer,a={};for(n in i)i.hasOwnProperty(n)&&"SlowBuffer"!==n&&"Buffer"!==n&&(a[n]=i[n]);var s=a.Buffer={};for(n in o)o.hasOwnProperty(n)&&"allocUnsafe"!==n&&"allocUnsafeSlow"!==n&&(s[n]=o[n]);if(a.Buffer.prototype=o.prototype,s.from&&s.from!==Uint8Array.from||(s.from=function(t,e,r){if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&void 0===t.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return o(t,e,r)}),s.alloc||(s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var n=o(t);return e&&0!==e.length?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n}),!a.kStringMaxLength)try{a.kStringMaxLength=e.binding("buffer").kStringMaxLength}catch(t){}a.constants||(a.constants={MAX_LENGTH:a.kMaxLength},a.kStringMaxLength&&(a.constants.MAX_STRING_LENGTH=a.kStringMaxLength)),t.exports=a}).call(this,r(20))},function(t,e,r){"use strict";const n=r(157).Reporter,i=r(102).EncoderBuffer,o=r(102).DecoderBuffer,a=r(42),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(t,e,r){const n={};this._baseState=n,n.name=r,n.enc=t,n.parent=e||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}t.exports=c;const l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];c.prototype.clone=function(){const t=this._baseState,e={};l.forEach((function(r){e[r]=t[r]}));const r=new this.constructor(e.parent);return r._baseState=e,r},c.prototype._wrap=function(){const t=this._baseState;u.forEach((function(e){this[e]=function(){const r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}}),this)},c.prototype._init=function(t){const e=this._baseState;a(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),a.equal(e.children.length,1,"Root node can have only one child")},c.prototype._useArgs=function(t){const e=this._baseState,r=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==r.length&&(a(null===e.children),e.children=r,r.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(a(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;const e={};return Object.keys(t).forEach((function(r){r==(0|r)&&(r|=0);const n=t[r];e[n]=r})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){c.prototype[t]=function(){const e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),s.forEach((function(t){c.prototype[t]=function(){const e=this._baseState,r=Array.prototype.slice.call(arguments);return a(null===e.tag),e.tag=t,this._useArgs(r),this}})),c.prototype.use=function(t){a(t);const e=this._baseState;return a(null===e.use),e.use=t,this},c.prototype.optional=function(){return this._baseState.optional=!0,this},c.prototype.def=function(t){const e=this._baseState;return a(null===e.default),e.default=t,e.optional=!0,this},c.prototype.explicit=function(t){const e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.explicit=t,this},c.prototype.implicit=function(t){const e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.implicit=t,this},c.prototype.obj=function(){const t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},c.prototype.key=function(t){const e=this._baseState;return a(null===e.key),e.key=t,this},c.prototype.any=function(){return this._baseState.any=!0,this},c.prototype.choice=function(t){const e=this._baseState;return a(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},c.prototype.contains=function(t){const e=this._baseState;return a(null===e.use),e.contains=t,this},c.prototype._decode=function(t,e){const r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));let n,i=r.default,a=!0,s=null;if(null!==r.key&&(s=t.enterKey(r.key)),r.optional){let n=null;if(null!==r.explicit?n=r.explicit:null!==r.implicit?n=r.implicit:null!==r.tag&&(n=r.tag),null!==n||r.any){if(a=this._peekTag(t,n,r.any),t.isError(a))return a}else{const n=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),a=!0}catch(t){a=!1}t.restore(n)}}if(r.obj&&a&&(n=t.enterObject()),a){if(null!==r.explicit){const e=this._decodeTag(t,r.explicit);if(t.isError(e))return e;t=e}const n=t.offset;if(null===r.use&&null===r.choice){let e;r.any&&(e=t.save());const n=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(n))return n;r.any?i=t.raw(e):t=n}if(e&&e.track&&null!==r.tag&&e.track(t.path(),n,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),r.any||(i=null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e)),t.isError(i))return i;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(t,e)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const n=new o(i);i=this._getUse(r.contains,t._reporterState.obj)._decode(n,e)}}return r.obj&&a&&(i=t.leaveObject(n)),null===r.key||null===i&&!0!==a?null!==s&&t.exitKey(s):t.leaveKey(s,r.key,i),i},c.prototype._decodeGeneric=function(t,e,r){const n=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,n.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&n.args?this._decodeObjid(e,n.args[0],n.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},c.prototype._getUse=function(t,e){const r=this._baseState;return r.useDecoder=this._use(t,e),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(t,e){const r=this._baseState;let n=null,i=!1;return Object.keys(r.choice).some((function(o){const a=t.save(),s=r.choice[o];try{const r=s._decode(t,e);if(t.isError(r))return!1;n={type:o,value:r},i=!0}catch(e){return t.restore(a),!1}return!0}),this),i?n:t.error("Choice not matched")},c.prototype._createEncoderBuffer=function(t){return new i(t,this.reporter)},c.prototype._encode=function(t,e,r){const n=this._baseState;if(null!==n.default&&n.default===t)return;const i=this._encodeValue(t,e,r);return void 0===i||this._skipDefault(i,e,r)?void 0:i},c.prototype._encodeValue=function(t,e,r){const i=this._baseState;if(null===i.parent)return i.children[0]._encode(t,e||new n);let o=null;if(this.reporter=e,i.optional&&void 0===t){if(null===i.default)return;t=i.default}let a=null,s=!1;if(i.any)o=this._createEncoderBuffer(t);else if(i.choice)o=this._encodeChoice(t,e);else if(i.contains)a=this._getUse(i.contains,r)._encode(t,e),s=!0;else if(i.children)a=i.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");const n=e.enterKey(r._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");const i=r._encode(t[r._baseState.key],e,t);return e.leaveKey(n),i}),this).filter((function(t){return t})),a=this._createEncoderBuffer(a);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return e.error("Too many args for : "+i.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,a=this._createEncoderBuffer(t.map((function(r){const n=this._baseState;return this._getUse(n.args[0],t)._encode(r,e)}),r))}else null!==i.use?o=this._getUse(i.use,r)._encode(t,e):(a=this._encodePrimitive(i.tag,t),s=!0);if(!i.any&&null===i.choice){const t=null!==i.implicit?i.implicit:i.tag,r=null===i.implicit?"universal":"context";null===t?null===i.use&&e.error("Tag could be omitted only for .use()"):null===i.use&&(o=this._encodeComposite(t,s,r,a))}return null!==i.explicit&&(o=this._encodeComposite(i.explicit,!1,"context",o)),o},c.prototype._encodeChoice=function(t,e){const r=this._baseState,n=r.choice[t.type];return n||a(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(t.value,e)},c.prototype._encodePrimitive=function(t,e){const r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},c.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},c.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(t,e,r){"use strict";const n=r(11);function i(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.Reporter=i,i.prototype.isError=function(t){return t instanceof o},i.prototype.save=function(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function(t){const e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},i.prototype.enterKey=function(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function(t){const e=this._reporterState;e.path=e.path.slice(0,t-1)},i.prototype.leaveKey=function(t,e,r){const n=this._reporterState;this.exitKey(t),null!==n.obj&&(n.obj[e]=r)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){const t=this._reporterState,e=t.obj;return t.obj={},e},i.prototype.leaveObject=function(t){const e=this._reporterState,r=e.obj;return e.obj=t,r},i.prototype.error=function(t){let e;const r=this._reporterState,n=t instanceof o;if(e=n?t:new o(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return n||r.errors.push(e),e},i.prototype.wrapResult=function(t){const e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},n(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},function(t,e,r){"use strict";function n(t){const e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);const n=t[r];e[n]=r})),e}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=n(e.tagClass),e.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"},e.tagByName=n(e.tag)},function(t,e,r){var n=r(402),i=n,o=globalThis;i.exportSymbol("proto.EncryptedData",null,o),i.exportSymbol("proto.Message",null,o),i.exportSymbol("proto.MessageEnvelope",null,o),i.exportSymbol("proto.SyncRequest",null,o),i.exportSymbol("proto.SyncResponse",null,o),proto.EncryptedData=function(t){n.Message.initialize(this,t,0,-1,null,null)},i.inherits(proto.EncryptedData,n.Message),i.DEBUG&&!COMPILED&&(proto.EncryptedData.displayName="proto.EncryptedData"),proto.Message=function(t){n.Message.initialize(this,t,0,-1,null,null)},i.inherits(proto.Message,n.Message),i.DEBUG&&!COMPILED&&(proto.Message.displayName="proto.Message"),proto.MessageEnvelope=function(t){n.Message.initialize(this,t,0,-1,null,null)},i.inherits(proto.MessageEnvelope,n.Message),i.DEBUG&&!COMPILED&&(proto.MessageEnvelope.displayName="proto.MessageEnvelope"),proto.SyncRequest=function(t){n.Message.initialize(this,t,0,-1,proto.SyncRequest.repeatedFields_,null)},i.inherits(proto.SyncRequest,n.Message),i.DEBUG&&!COMPILED&&(proto.SyncRequest.displayName="proto.SyncRequest"),proto.SyncResponse=function(t){n.Message.initialize(this,t,0,-1,proto.SyncResponse.repeatedFields_,null)},i.inherits(proto.SyncResponse,n.Message),i.DEBUG&&!COMPILED&&(proto.SyncResponse.displayName="proto.SyncResponse"),n.Message.GENERATE_TO_OBJECT&&(proto.EncryptedData.prototype.toObject=function(t){return proto.EncryptedData.toObject(t,this)},proto.EncryptedData.toObject=function(t,e){var r={iv:e.getIv_asB64(),authtag:e.getAuthtag_asB64(),data:e.getData_asB64()};return t&&(r.$jspbMessageInstance=e),r}),proto.EncryptedData.deserializeBinary=function(t){var e=new n.BinaryReader(t),r=new proto.EncryptedData;return proto.EncryptedData.deserializeBinaryFromReader(r,e)},proto.EncryptedData.deserializeBinaryFromReader=function(t,e){for(;e.nextField()&&!e.isEndGroup();){switch(e.getFieldNumber()){case 1:var r=e.readBytes();t.setIv(r);break;case 2:r=e.readBytes();t.setAuthtag(r);break;case 3:r=e.readBytes();t.setData(r);break;default:e.skipField()}}return t},proto.EncryptedData.prototype.serializeBinary=function(){var t=new n.BinaryWriter;return proto.EncryptedData.serializeBinaryToWriter(this,t),t.getResultBuffer()},proto.EncryptedData.serializeBinaryToWriter=function(t,e){var r=void 0;(r=t.getIv_asU8()).length>0&&e.writeBytes(1,r),(r=t.getAuthtag_asU8()).length>0&&e.writeBytes(2,r),(r=t.getData_asU8()).length>0&&e.writeBytes(3,r)},proto.EncryptedData.prototype.getIv=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.EncryptedData.prototype.getIv_asB64=function(){return n.Message.bytesAsB64(this.getIv())},proto.EncryptedData.prototype.getIv_asU8=function(){return n.Message.bytesAsU8(this.getIv())},proto.EncryptedData.prototype.setIv=function(t){return n.Message.setProto3BytesField(this,1,t)},proto.EncryptedData.prototype.getAuthtag=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.EncryptedData.prototype.getAuthtag_asB64=function(){return n.Message.bytesAsB64(this.getAuthtag())},proto.EncryptedData.prototype.getAuthtag_asU8=function(){return n.Message.bytesAsU8(this.getAuthtag())},proto.EncryptedData.prototype.setAuthtag=function(t){return n.Message.setProto3BytesField(this,2,t)},proto.EncryptedData.prototype.getData=function(){return n.Message.getFieldWithDefault(this,3,"")},proto.EncryptedData.prototype.getData_asB64=function(){return n.Message.bytesAsB64(this.getData())},proto.EncryptedData.prototype.getData_asU8=function(){return n.Message.bytesAsU8(this.getData())},proto.EncryptedData.prototype.setData=function(t){return n.Message.setProto3BytesField(this,3,t)},n.Message.GENERATE_TO_OBJECT&&(proto.Message.prototype.toObject=function(t){return proto.Message.toObject(t,this)},proto.Message.toObject=function(t,e){var r={dataset:n.Message.getFieldWithDefault(e,1,""),row:n.Message.getFieldWithDefault(e,2,""),column:n.Message.getFieldWithDefault(e,3,""),value:n.Message.getFieldWithDefault(e,4,"")};return t&&(r.$jspbMessageInstance=e),r}),proto.Message.deserializeBinary=function(t){var e=new n.BinaryReader(t),r=new proto.Message;return proto.Message.deserializeBinaryFromReader(r,e)},proto.Message.deserializeBinaryFromReader=function(t,e){for(;e.nextField()&&!e.isEndGroup();){switch(e.getFieldNumber()){case 1:var r=e.readString();t.setDataset(r);break;case 2:r=e.readString();t.setRow(r);break;case 3:r=e.readString();t.setColumn(r);break;case 4:r=e.readString();t.setValue(r);break;default:e.skipField()}}return t},proto.Message.prototype.serializeBinary=function(){var t=new n.BinaryWriter;return proto.Message.serializeBinaryToWriter(this,t),t.getResultBuffer()},proto.Message.serializeBinaryToWriter=function(t,e){var r=void 0;(r=t.getDataset()).length>0&&e.writeString(1,r),(r=t.getRow()).length>0&&e.writeString(2,r),(r=t.getColumn()).length>0&&e.writeString(3,r),(r=t.getValue()).length>0&&e.writeString(4,r)},proto.Message.prototype.getDataset=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.Message.prototype.setDataset=function(t){return n.Message.setProto3StringField(this,1,t)},proto.Message.prototype.getRow=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.Message.prototype.setRow=function(t){return n.Message.setProto3StringField(this,2,t)},proto.Message.prototype.getColumn=function(){return n.Message.getFieldWithDefault(this,3,"")},proto.Message.prototype.setColumn=function(t){return n.Message.setProto3StringField(this,3,t)},proto.Message.prototype.getValue=function(){return n.Message.getFieldWithDefault(this,4,"")},proto.Message.prototype.setValue=function(t){return n.Message.setProto3StringField(this,4,t)},n.Message.GENERATE_TO_OBJECT&&(proto.MessageEnvelope.prototype.toObject=function(t){return proto.MessageEnvelope.toObject(t,this)},proto.MessageEnvelope.toObject=function(t,e){var r={timestamp:n.Message.getFieldWithDefault(e,1,""),isencrypted:n.Message.getBooleanFieldWithDefault(e,2,!1),content:e.getContent_asB64()};return t&&(r.$jspbMessageInstance=e),r}),proto.MessageEnvelope.deserializeBinary=function(t){var e=new n.BinaryReader(t),r=new proto.MessageEnvelope;return proto.MessageEnvelope.deserializeBinaryFromReader(r,e)},proto.MessageEnvelope.deserializeBinaryFromReader=function(t,e){for(;e.nextField()&&!e.isEndGroup();){switch(e.getFieldNumber()){case 1:var r=e.readString();t.setTimestamp(r);break;case 2:r=e.readBool();t.setIsencrypted(r);break;case 3:r=e.readBytes();t.setContent(r);break;default:e.skipField()}}return t},proto.MessageEnvelope.prototype.serializeBinary=function(){var t=new n.BinaryWriter;return proto.MessageEnvelope.serializeBinaryToWriter(this,t),t.getResultBuffer()},proto.MessageEnvelope.serializeBinaryToWriter=function(t,e){var r=void 0;(r=t.getTimestamp()).length>0&&e.writeString(1,r),(r=t.getIsencrypted())&&e.writeBool(2,r),(r=t.getContent_asU8()).length>0&&e.writeBytes(3,r)},proto.MessageEnvelope.prototype.getTimestamp=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.MessageEnvelope.prototype.setTimestamp=function(t){return n.Message.setProto3StringField(this,1,t)},proto.MessageEnvelope.prototype.getIsencrypted=function(){return n.Message.getBooleanFieldWithDefault(this,2,!1)},proto.MessageEnvelope.prototype.setIsencrypted=function(t){return n.Message.setProto3BooleanField(this,2,t)},proto.MessageEnvelope.prototype.getContent=function(){return n.Message.getFieldWithDefault(this,3,"")},proto.MessageEnvelope.prototype.getContent_asB64=function(){return n.Message.bytesAsB64(this.getContent())},proto.MessageEnvelope.prototype.getContent_asU8=function(){return n.Message.bytesAsU8(this.getContent())},proto.MessageEnvelope.prototype.setContent=function(t){return n.Message.setProto3BytesField(this,3,t)},proto.SyncRequest.repeatedFields_=[1],n.Message.GENERATE_TO_OBJECT&&(proto.SyncRequest.prototype.toObject=function(t){return proto.SyncRequest.toObject(t,this)},proto.SyncRequest.toObject=function(t,e){var r={messagesList:n.Message.toObjectList(e.getMessagesList(),proto.MessageEnvelope.toObject,t),fileid:n.Message.getFieldWithDefault(e,2,""),groupid:n.Message.getFieldWithDefault(e,3,""),keyid:n.Message.getFieldWithDefault(e,5,""),since:n.Message.getFieldWithDefault(e,6,"")};return t&&(r.$jspbMessageInstance=e),r}),proto.SyncRequest.deserializeBinary=function(t){var e=new n.BinaryReader(t),r=new proto.SyncRequest;return proto.SyncRequest.deserializeBinaryFromReader(r,e)},proto.SyncRequest.deserializeBinaryFromReader=function(t,e){for(;e.nextField()&&!e.isEndGroup();){switch(e.getFieldNumber()){case 1:var r=new proto.MessageEnvelope;e.readMessage(r,proto.MessageEnvelope.deserializeBinaryFromReader),t.addMessages(r);break;case 2:r=e.readString();t.setFileid(r);break;case 3:r=e.readString();t.setGroupid(r);break;case 5:r=e.readString();t.setKeyid(r);break;case 6:r=e.readString();t.setSince(r);break;default:e.skipField()}}return t},proto.SyncRequest.prototype.serializeBinary=function(){var t=new n.BinaryWriter;return proto.SyncRequest.serializeBinaryToWriter(this,t),t.getResultBuffer()},proto.SyncRequest.serializeBinaryToWriter=function(t,e){var r=void 0;(r=t.getMessagesList()).length>0&&e.writeRepeatedMessage(1,r,proto.MessageEnvelope.serializeBinaryToWriter),(r=t.getFileid()).length>0&&e.writeString(2,r),(r=t.getGroupid()).length>0&&e.writeString(3,r),(r=t.getKeyid()).length>0&&e.writeString(5,r),(r=t.getSince()).length>0&&e.writeString(6,r)},proto.SyncRequest.prototype.getMessagesList=function(){return n.Message.getRepeatedWrapperField(this,proto.MessageEnvelope,1)},proto.SyncRequest.prototype.setMessagesList=function(t){return n.Message.setRepeatedWrapperField(this,1,t)},proto.SyncRequest.prototype.addMessages=function(t,e){return n.Message.addToRepeatedWrapperField(this,1,t,proto.MessageEnvelope,e)},proto.SyncRequest.prototype.clearMessagesList=function(){return this.setMessagesList([])},proto.SyncRequest.prototype.getFileid=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.SyncRequest.prototype.setFileid=function(t){return n.Message.setProto3StringField(this,2,t)},proto.SyncRequest.prototype.getGroupid=function(){return n.Message.getFieldWithDefault(this,3,"")},proto.SyncRequest.prototype.setGroupid=function(t){return n.Message.setProto3StringField(this,3,t)},proto.SyncRequest.prototype.getKeyid=function(){return n.Message.getFieldWithDefault(this,5,"")},proto.SyncRequest.prototype.setKeyid=function(t){return n.Message.setProto3StringField(this,5,t)},proto.SyncRequest.prototype.getSince=function(){return n.Message.getFieldWithDefault(this,6,"")},proto.SyncRequest.prototype.setSince=function(t){return n.Message.setProto3StringField(this,6,t)},proto.SyncResponse.repeatedFields_=[1],n.Message.GENERATE_TO_OBJECT&&(proto.SyncResponse.prototype.toObject=function(t){return proto.SyncResponse.toObject(t,this)},proto.SyncResponse.toObject=function(t,e){var r={messagesList:n.Message.toObjectList(e.getMessagesList(),proto.MessageEnvelope.toObject,t),merkle:n.Message.getFieldWithDefault(e,2,"")};return t&&(r.$jspbMessageInstance=e),r}),proto.SyncResponse.deserializeBinary=function(t){var e=new n.BinaryReader(t),r=new proto.SyncResponse;return proto.SyncResponse.deserializeBinaryFromReader(r,e)},proto.SyncResponse.deserializeBinaryFromReader=function(t,e){for(;e.nextField()&&!e.isEndGroup();){switch(e.getFieldNumber()){case 1:var r=new proto.MessageEnvelope;e.readMessage(r,proto.MessageEnvelope.deserializeBinaryFromReader),t.addMessages(r);break;case 2:r=e.readString();t.setMerkle(r);break;default:e.skipField()}}return t},proto.SyncResponse.prototype.serializeBinary=function(){var t=new n.BinaryWriter;return proto.SyncResponse.serializeBinaryToWriter(this,t),t.getResultBuffer()},proto.SyncResponse.serializeBinaryToWriter=function(t,e){var r=void 0;(r=t.getMessagesList()).length>0&&e.writeRepeatedMessage(1,r,proto.MessageEnvelope.serializeBinaryToWriter),(r=t.getMerkle()).length>0&&e.writeString(2,r)},proto.SyncResponse.prototype.getMessagesList=function(){return n.Message.getRepeatedWrapperField(this,proto.MessageEnvelope,1)},proto.SyncResponse.prototype.setMessagesList=function(t){return n.Message.setRepeatedWrapperField(this,1,t)},proto.SyncResponse.prototype.addMessages=function(t,e){return n.Message.addToRepeatedWrapperField(this,1,t,proto.MessageEnvelope,e)},proto.SyncResponse.prototype.clearMessagesList=function(){return this.setMessagesList([])},proto.SyncResponse.prototype.getMerkle=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.SyncResponse.prototype.setMerkle=function(t){return n.Message.setProto3StringField(this,2,t)},i.object.extend(e,proto)},function(t,e,r){"use strict";var n=Array.prototype.slice,i=r(244),o=Object.keys,a=o?function(t){return o(t)}:r(428),s=Object.keys;a.shim=function(){Object.keys?function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2)||(Object.keys=function(t){return i(t)?s(n.call(t)):s(t)}):Object.keys=a;return Object.keys||a},t.exports=a},function(t,e,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=r(116);t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},function(t,e,r){"use strict";var n=r(429);t.exports=Function.prototype.bind||n},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(0);function i(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(n.a)(t),i=Object(n.a)(e);return r.getTime()>i.getTime()}},function(t,e,r){"use strict";const n=r(288),i=Symbol("max"),o=Symbol("length"),a=Symbol("lengthCalculator"),s=Symbol("allowStale"),u=Symbol("maxAge"),c=Symbol("dispose"),l=Symbol("noDisposeOnSet"),f=Symbol("lruList"),d=Symbol("cache"),h=Symbol("updateAgeOnGet"),g=()=>1;const p=(t,e,r)=>{const n=t[d].get(e);if(n){const e=n.value;if(m(t,e)){if(b(t,n),!t[s])return}else r&&(t[h]&&(n.value.now=Date.now()),t[f].unshiftNode(n));return e.value}},m=(t,e)=>{if(!e||!e.maxAge&&!t[u])return!1;const r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[u]&&r>t[u]},y=t=>{if(t[o]>t[i])for(let e=t[f].tail;t[o]>t[i]&&null!==e;){const r=e.prev;b(t,e),e=r}},b=(t,e)=>{if(e){const r=e.value;t[c]&&t[c](r.key,r.value),t[o]-=r.length,t[d].delete(r.key),t[f].removeNode(e)}};class w{constructor(t,e,r,n,i){this.key=t,this.value=e,this.length=r,this.now=n,this.maxAge=i||0}}const _=(t,e,r,n)=>{let i=r.value;m(t,i)&&(b(t,r),t[s]||(i=void 0)),i&&e.call(n,i.value,i.key,t)};t.exports=class{constructor(t){if("number"==typeof t&&(t={max:t}),t||(t={}),t.max&&("number"!=typeof t.max||t.max<0))throw new TypeError("max must be a non-negative number");this[i]=t.max||1/0;const e=t.length||g;if(this[a]="function"!=typeof e?g:e,this[s]=t.stale||!1,t.maxAge&&"number"!=typeof t.maxAge)throw new TypeError("maxAge must be a number");this[u]=t.maxAge||0,this[c]=t.dispose,this[l]=t.noDisposeOnSet||!1,this[h]=t.updateAgeOnGet||!1,this.reset()}set max(t){if("number"!=typeof t||t<0)throw new TypeError("max must be a non-negative number");this[i]=t||1/0,y(this)}get max(){return this[i]}set allowStale(t){this[s]=!!t}get allowStale(){return this[s]}set maxAge(t){if("number"!=typeof t)throw new TypeError("maxAge must be a non-negative number");this[u]=t,y(this)}get maxAge(){return this[u]}set lengthCalculator(t){"function"!=typeof t&&(t=g),t!==this[a]&&(this[a]=t,this[o]=0,this[f].forEach(t=>{t.length=this[a](t.value,t.key),this[o]+=t.length})),y(this)}get lengthCalculator(){return this[a]}get length(){return this[o]}get itemCount(){return this[f].length}rforEach(t,e){e=e||this;for(let r=this[f].tail;null!==r;){const n=r.prev;_(this,t,r,e),r=n}}forEach(t,e){e=e||this;for(let r=this[f].head;null!==r;){const n=r.next;_(this,t,r,e),r=n}}keys(){return this[f].toArray().map(t=>t.key)}values(){return this[f].toArray().map(t=>t.value)}reset(){this[c]&&this[f]&&this[f].length&&this[f].forEach(t=>this[c](t.key,t.value)),this[d]=new Map,this[f]=new n,this[o]=0}dump(){return this[f].map(t=>!m(this,t)&&{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[f]}set(t,e,r){if((r=r||this[u])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,s=this[a](e,t);if(this[d].has(t)){if(s>this[i])return b(this,this[d].get(t)),!1;const a=this[d].get(t).value;return this[c]&&(this[l]||this[c](t,a.value)),a.now=n,a.maxAge=r,a.value=e,this[o]+=s-a.length,a.length=s,this.get(t),y(this),!0}const h=new w(t,e,s,n,r);return h.length>this[i]?(this[c]&&this[c](t,e),!1):(this[o]+=h.length,this[f].unshift(h),this[d].set(t,this[f].head),y(this),!0)}has(t){if(!this[d].has(t))return!1;const e=this[d].get(t).value;return!m(this,e)}get(t){return p(this,t,!0)}peek(t){return p(this,t,!1)}pop(){const t=this[f].tail;return t?(b(this,t),t.value):null}del(t){b(this,this[d].get(t))}load(t){this.reset();const e=Date.now();for(let r=t.length-1;r>=0;r--){const n=t[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{const t=i-e;t>0&&this.set(n.k,n.v,t)}}}prune(){this[d].forEach((t,e)=>p(this,e,!1))}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return f}));var n=r(128),i=r(12);function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}const s=r(400),u=r(54),c=u.unresolveName,l=u.resolveName;class f{constructor(t,e){this.graph=new s,this.nodes=new Map,this.transactionDepth=0,this.saveCache=t,this.setCacheStatus=e,this.dirtyCells=[],this.computeQueue=[],this.events=Object(n.a)(),this._meta={createdMonths:new Set}}meta(){return this._meta}setMeta(t){this._meta=t}_getNode(t){const e=c(t).sheet;return this.nodes.has(t)||this.nodes.set(t,{name:t,expr:null,value:null,sheet:e}),this.nodes.get(t)}getNode(t){return this._getNode(t)}hasCell(t){return this.nodes.has(t)}add(t,e,r){this.set(t,e)}getNodes(){return this.nodes}serialize(){return{graph:this.graph.getEdges(),nodes:[...this.nodes.entries()]}}transaction(t){this.startTransaction();try{t()}catch(t){console.log(t)}return this.endTransaction()}startTransaction(){this.transactionDepth++}endTransaction(){if(this.transactionDepth--,0===this.transactionDepth){const t=this.dirtyCells;this.dirtyCells=[],this.queueComputation(this.graph.topologicalSort(t))}return[]}queueComputation(t){this.computeQueue=this.computeQueue.concat(t),Promise.resolve().then(()=>{this.running||this.runComputations()})}runComputations(t=0){for(this.running=!0;t<this.computeQueue.length;){let e,r,n=this.computeQueue[t];try{if(e=this.getNode(n),e._run){let t=e._dependencies.map(t=>this.getNode(t).value);r=e._run(...t),r instanceof Promise&&console.warn("dynamic cell returned a promise! this is discouraged because errors are not handled properly")}else{if(!e.sql){t++;continue}r=Object(i.f)(e.query,e.sql.sqlPieces,e.sql.state)}}catch(t){return console.log("Error while evaluating "+n+":",t),this.running=!1,void(this.computeQueue=[])}if(r instanceof Promise)return void r.then(r=>{e.value=r,this.runComputations(t+1)},r=>{console.warn(`Failed running ${e.name}!`,r),this.runComputations(t+1)});e.value=r,t++}t===this.computeQueue.length&&(this.events.emit("change",{names:this.computeQueue}),this.saveCache&&this.saveCache(this.computeQueue),this.markCacheSafe(),this.running=!1,this.computeQueue=[])}markCacheSafe(){this.cacheBarrier||this.setCacheStatus&&this.setCacheStatus({clean:!0})}markCacheDirty(){this.setCacheStatus&&this.setCacheStatus({clean:!1})}startCacheBarrier(){this.cacheBarrier=!0,this.markCacheDirty()}endCacheBarrier(){this.cacheBarrier=!1,this.running||this.computeQueue.length>0||this.markCacheSafe()}addEventListener(t,e){return this.events.on(t,e),()=>this.events.off(t,e)}onFinish(t){if(0!==this.transactionDepth)throw new Error("onFinish called while inside a spreadsheet transaction. This is not allowed as it will lead to race conditions");if(!this.running&&0===this.computeQueue.length)return t([]),()=>{};let e=this.addEventListener("change",(...r)=>(e(),t(...r)));return e}unload(){this.events.all.clear()}getValue(t){return this.getNode(t).value}getExpr(t){return this.getNode(t).expr}getCellValue(t,e){return this.getNode(l(t,e)).value}getCellExpr(t,e){return this.getNode(l(t,e)).expr}getCellValueLoose(t,e){let r=l(t,e);return this.nodes.has(r)?this.getNode(r).value:null}bootup(t){this.onFinish(()=>{t()})}load(t,e){const r=this._getNode(t);r.expr=e,r.value=e}create(t,e){return this.transaction(()=>{const r=this._getNode(t);r.expr=e,r.value=e,this._markDirty(t)})}set(t,e){this.create(t,e)}recompute(t){this.transaction(()=>{this.dirtyCells.push(t)})}recomputeAll(){this.transaction(()=>{this.dirtyCells=[...this.nodes.keys()]})}createQuery(t,e,r){let n=l(t,e),o=this._getNode(n);if(o.query!==r){o.query=r;let t=Object(i.a)(o.query,i.h,i.i),e=t.sqlPieces,a=t.state;o.sql={sqlPieces:e,state:a},this.transaction(()=>{this._markDirty(n)})}}createStatic(t,e,r){let n=l(t,e);this.nodes.has(n)||this.create(n,r)}createDynamic(t,e,{dependencies:r=[],run:n,initialValue:i,refresh:o}){let a=l(t,e),s=this._getNode(a);s.dynamic||(s.dynamic=!0,s._run=n,r=r.map(e=>{let r;return r=c(e).sheet?e:l(t,e),r}),s._dependencies=r,this.graph.removeIncomingEdges(a),r.forEach(t=>{this.graph.addEdge(t,a)}),(null==s.value||o)&&this.transaction(()=>{s.value=i,this._markDirty(a)}))}clearSheet(t){for(let r of this.nodes.entries()){var e=o(r,2);let n=e[0];e[1].sheet===t&&this.nodes.delete(n)}}voidCell(t,e,r=null){let n=this.getNode(l(t,e));n._run=null,n.dynamic=!1,n.value=r}deleteCell(t,e){this.voidCell(t,e),this.nodes.delete(l(t,e))}addDependencies(t,e,r){let n=l(t,e);r=r.map(e=>c(e).sheet?e:l(t,e));let i=this.getNode(n),o=r.filter(t=>-1===(i._dependencies||[]).indexOf(t));o.length>0&&(i._dependencies=(i._dependencies||[]).concat(o),o.forEach(t=>{this.graph.addEdge(t,n)}),this.recompute(n))}removeDependencies(t,e,r){let n=l(t,e);r=r.map(e=>c(e).sheet?e:l(t,e));let i=this.getNode(n);i._dependencies=(i._dependencies||[]).filter(t=>-1===r.indexOf(t)),r.forEach(t=>{this.graph.removeEdge(t,n)}),this.recompute(n)}_markDirty(t){this.dirtyCells.push(t)}triggerDatabaseChanges(t,e){let r=new Set([...t.keys(),...e.keys()]);this.startTransaction(),this.nodes.forEach(t=>{t.sql&&t.sql.state.dependencies.some(t=>r.has(t))&&this._markDirty(t.name)}),this.endTransaction()}}},function(t,e,r){"use strict";(function(t){r.d(e,"b",(function(){return u})),r.d(e,"a",(function(){return c}));var n=r(31),i=r(7);let o=r(21).SyncError,a=r(159);function s(e){return t.isBuffer(e)?e:t.from(e)}async function u(e,r,s,u){let c=i.b().encryptKeyId,l=new a.SyncRequest;for(let e=0;e<u.length;e++){let r=u[e],i=new a.MessageEnvelope;i.setTimestamp(r.timestamp);let s=new a.Message;s.setDataset(r.dataset),s.setRow(r.row),s.setColumn(r.column),s.setValue(r.value);let f=s.serializeBinary();if(c){let e,r=new a.EncryptedData;try{e=await n.a.encrypt(f,c)}catch(t){throw new o("encrypt-failure",{isMissingKey:"missing-key"===t.message})}r.setData(e.value),r.setIv(t.from(e.meta.iv,"base64")),r.setAuthtag(t.from(e.meta.authTag,"base64")),i.setContent(r.serializeBinary()),i.setIsencrypted(!0)}else i.setContent(f);l.addMessages(i)}return l.setGroupid(e),l.setFileid(r),l.setKeyid(c),l.setSince(s),l.serializeBinary()}async function c(t){let e=i.b().encryptKeyId,r=a.SyncResponse.deserializeBinary(t),u=JSON.parse(r.getMerkle()),c=r.getMessagesList(),l=[];for(let t=0;t<c.length;t++){let r,i=c[t],u=i.getTimestamp();if(i.getIsencrypted()){let t,u=a.EncryptedData.deserializeBinary(i.getContent());try{t=await n.a.decrypt(s(u.getData()),{keyId:e,algorithm:"aes-256-gcm",iv:s(u.getIv()),authTag:s(u.getAuthtag())})}catch(t){throw console.log(t),new o("decrypt-failure",{isMissingKey:"missing-key"===t.message})}r=a.Message.deserializeBinary(t)}else r=a.Message.deserializeBinary(i.getContent());l.push({timestamp:u,dataset:r.getDataset(),row:r.getRow(),column:r.getColumn(),value:r.getValue()})}return{messages:l,merkle:u}}}).call(this,r(14).Buffer)},function(t,e,r){"use strict";r.d(e,"b",(function(){return s})),r.d(e,"a",(function(){return u}));var n=r(168),i=r.n(n),o=r(15),a=r(12);async function s(t,e,r,n){const a=e.reduce((t,{id:e,name:r})=>(t[e]=r,t),{}),s=r.reduce((t,{name:e,categories:r})=>(r.forEach(r=>t[r.id]=`${e}: ${r.name}`),t),{}),u=n.reduce((t,{id:e,name:r})=>(t[e]=r,t),{}),c=t.map(({account:t,date:e,payee:r,notes:n,category:i,amount:c})=>({Account:a[t],Date:e,Payee:u[r],Notes:n,Category:s[i],Amount:null==c?0:Object(o.k)(c)}));return i()(c,{header:!0})}async function u(t){let e=(await Object(a.g)(t.select([{Id:"id"},{Account:"account.name"},{Date:"date"},{Payee:"payee.name"},{ParentId:"parent_id"},{IsParent:"is_parent"},{Notes:"notes"},{Category:"category.name"},{Amount:"amount"}]).options({splits:"all"}))).data,r=new Map;for(let t of e)t.IsParent&&r.set(t.Id,t.Payee);let n=e.filter(t=>!t.IsParent).map(t=>({Account:t.Account,Date:t.Date,Payee:t.ParentId?r.get(t.ParentId):t.Payee,Notes:t.Notes,Category:t.Category,Amount:null==t.Amount?0:Object(o.k)(t.Amount)}));return i()(n,{header:!0})}},function(t,e,r){(function(e){const n=r(425),i=r(67).StringDecoder;t.exports=function(t,r={}){const o=[];if(e.isBuffer(t)){t=(new i).write(t)}function a(t){t&&o.push(t.toString())}let s=new n.Stringifier(r);s.on("data",a);for(let e of t)s.write(e);return s.end(),s.off("data",a),o.join("")}}).call(this,r(14).Buffer)},function(t,e,r){"use strict";var n=r(160),i=r(245),o=r(431),a=r(433),s=r(434),u=r(436),c=r(437),l=r(438),f=r(77),d=r(52),h=r(444),g=r(447),p=r(449),m=r(452),y=r(454),b=d("Date.prototype.getTime"),w=Object.getPrototypeOf,_=d("Object.prototype.toString"),v=f("%Set%",!0),E=d("Map.prototype.has",!0),S=d("Map.prototype.get",!0),O=d("Map.prototype.size",!0),T=d("Set.prototype.add",!0),A=d("Set.prototype.delete",!0),M=d("Set.prototype.has",!0),j=d("Set.prototype.size",!0);function I(t,e,r,n){for(var i,o=g(t);(i=o.next())&&!i.done;)if(C(e,i.value,r,n))return A(t,i.value),!0;return!1}function R(t){return void 0===t?null:"object"!=typeof t?"symbol"!=typeof t&&("string"!=typeof t&&"number"!=typeof t||+t==+t):void 0}function D(t,e,r,n,i,o){var a=R(r);if(null!=a)return a;var s=S(e,a),u=y({},i,{strict:!1});return!(void 0===s&&!E(e,a)||!C(n,s,u,o))&&(!E(t,a)&&C(n,s,u,o))}function k(t,e,r){var n=R(r);return null!=n?n:M(e,n)&&!M(t,n)}function N(t,e,r,n,i,o){for(var a,s,u=g(t);(a=u.next())&&!a.done;)if(C(r,s=a.value,i,o)&&C(n,S(e,s),i,o))return A(t,s),!0;return!1}function C(t,e,r,f){var d=r||{};if(d.strict?o(t,e):t===e)return!0;if(l(t)!==l(e))return!1;if(!t||!e||"object"!=typeof t&&"object"!=typeof e)return d.strict?o(t,e):t==e;var p,A=f.has(t),R=f.has(e);if(A&&R){if(f.get(t)===f.get(e))return!0}else p={};return A||f.set(t,p),R||f.set(e,p),function(t,e,r,o){var l,f;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(_(t)!==_(e))return!1;if(i(t)!==i(e))return!1;var d=u(t),p=u(e);if(d!==p)return!1;var A=t instanceof Error,R=e instanceof Error;if(A!==R)return!1;if((A||R)&&(t.name!==e.name||t.message!==e.message))return!1;var L=a(t),P=a(e);if(L!==P)return!1;if((L||P)&&(t.source!==e.source||s(t)!==s(e)))return!1;var B=c(t),U=c(e);if(B!==U)return!1;if((B||U)&&b(t)!==b(e))return!1;if(r.strict&&w&&w(t)!==w(e))return!1;if(m(t)!==m(e))return!1;var F=x(t),W=x(e);if(F!==W)return!1;if(F||W){if(t.length!==e.length)return!1;for(l=0;l<t.length;l++)if(t[l]!==e[l])return!1;return!0}if(typeof t!=typeof e)return!1;var H=n(t),q=n(e);if(H.length!==q.length)return!1;for(H.sort(),q.sort(),l=H.length-1;l>=0;l--)if(H[l]!=q[l])return!1;for(l=H.length-1;l>=0;l--)if(f=H[l],!C(t[f],e[f],r,o))return!1;var z=h(t),V=h(e);if(z!==V)return!1;if("Set"===z||"Set"===V)return function(t,e,r,n){if(j(t)!==j(e))return!1;var i,o,a,s=g(t),u=g(e);for(;(i=s.next())&&!i.done;)if(i.value&&"object"==typeof i.value)a||(a=new v),T(a,i.value);else if(!M(e,i.value)){if(r.strict)return!1;if(!k(t,e,i.value))return!1;a||(a=new v),T(a,i.value)}if(a){for(;(o=u.next())&&!o.done;)if(o.value&&"object"==typeof o.value){if(!I(a,o.value,r.strict,n))return!1}else if(!r.strict&&!M(t,o.value)&&!I(a,o.value,r.strict,n))return!1;return 0===j(a)}return!0}(t,e,r,o);if("Map"===z)return function(t,e,r,n){if(O(t)!==O(e))return!1;var i,o,a,s,u,c,l=g(t),f=g(e);for(;(i=l.next())&&!i.done;)if(s=i.value[0],u=i.value[1],s&&"object"==typeof s)a||(a=new v),T(a,s);else if(void 0===(c=S(e,s))&&!E(e,s)||!C(u,c,r,n)){if(r.strict)return!1;if(!D(t,e,s,u,r,n))return!1;a||(a=new v),T(a,s)}if(a){for(;(o=f.next())&&!o.done;)if(s=o.value[0],c=o.value[1],s&&"object"==typeof s){if(!N(a,t,s,c,r,n))return!1}else if(!(r.strict||t.has(s)&&C(S(t,s),c,r,n)||N(a,t,s,c,y({},r,{strict:!1}),n)))return!1;return 0===j(a)}return!0}(t,e,r,o);return!0}(t,e,d,f)}function x(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length)&&("function"==typeof t.copy&&"function"==typeof t.slice&&(!(t.length>0&&"number"!=typeof t[0])&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))))}t.exports=function(t,e,r){return C(t,e,r,p())}},function(t,e,r){"use strict";r.d(e,"b",(function(){return a})),r.d(e,"a",(function(){return s}));var n=r(4),i=r.n(n);const o=r(41);async function a(t){let e=1,r="My Finances";for(;t.find(t=>t.name===r);)r="My Finances "+e,e++;return r}async function s(t){let e=t.replace(/( |[^A-Za-z0-9])/g,"-")+"-"+o.v4Sync().slice(0,7),r=0,n=i.a.getBudgetDir(e);for(;await i.a.exists(n);)r++,n=i.a.getBudgetDir(e+r.toString());return r>0&&(e+=r.toString()),e}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){var r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(r){var n=new Uint8Array(16);t.exports=function(){return r(n),n}}else{var i=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}},function(t,e){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);t.exports=function(t,e){var n=e||0,i=r;return[i[t[n++]],i[t[n++]],i[t[n++]],i[t[n++]],"-",i[t[n++]],i[t[n++]],"-",i[t[n++]],i[t[n++]],"-",i[t[n++]],i[t[n++]],"-",i[t[n++]],i[t[n++]],i[t[n++]],i[t[n++]],i[t[n++]],i[t[n++]]].join("")}},function(t,e,r){let n=i();function i(){return new Promise((t,e)=>{let r=indexedDB.open("actual",9);r.onupgradeneeded=function(t){let e=t.target.result;e.objectStoreNames.contains("filesystem")&&e.deleteObjectStore("filesystem",{keyPath:"filepath"}),e.objectStoreNames.contains("messages")&&e.deleteObjectStore("messages",{keyPath:"filepath"}),e.objectStoreNames.contains("asyncStorage")||e.createObjectStore("asyncStorage"),e.objectStoreNames.contains("files")||e.createObjectStore("files",{keyPath:"filepath"})},r.onblocked=t=>console.log("blocked",t),r.onerror=t=>{console.log("openRequest error"),e(new Error("indexeddb-failure: Could not open IndexedDB"))},r.onsuccess=function(e){let r=e.target.result;r.onversionchange=()=>{r.close()},r.onerror=function(t){if(console.log("Database error: "+(t.target&&t.target.error)),t.target&&t.target.error){if("QuotaExceededError"===t.target.error.name)throw new Error("indexeddb-quota-error")}},t(r)}})}t.exports={getDatabase:function(){return n},openDatabase:function(){return null==n&&(n=i()),n},closeDatabase:function(){if(n){n.then(t=>{t.close()});n=null}},getStore:function(t,e){let r=t.transaction([e],"readwrite");return{trans:r,store:r.objectStore(e)}},get:async function(t,e,r=(t=>t)){return new Promise((n,i)=>{let o=t.get(e);o.onsuccess=t=>{n(r(o.result))},o.onerror=t=>i(t)})},set:async function(t,e){return new Promise((r,n)=>{let i=t.put(e);i.onsuccess=t=>r(),i.onerror=t=>n(t)})},del:async function(t,e){return new Promise((r,n)=>{let i=t.delete(e);i.onsuccess=t=>r(),i.onerror=t=>n(t)})}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(96),i=r(176),o=n.constants.S_IFMT,a=n.constants.S_IFDIR,s=n.constants.S_IFREG,u=n.constants.S_IFBLK,c=n.constants.S_IFCHR,l=n.constants.S_IFLNK,f=n.constants.S_IFIFO,d=n.constants.S_IFSOCK,h=function(){function t(){this.name="",this.mode=0}return t.build=function(e,r){var n=new t,o=e.getNode().mode;return n.name=i.strToEncoding(e.getName(),r),n.mode=o,n},t.prototype._checkModeProperty=function(t){return(this.mode&o)===t},t.prototype.isDirectory=function(){return this._checkModeProperty(a)},t.prototype.isFile=function(){return this._checkModeProperty(s)},t.prototype.isBlockDevice=function(){return this._checkModeProperty(u)},t.prototype.isCharacterDevice=function(){return this._checkModeProperty(c)},t.prototype.isSymbolicLink=function(){return this._checkModeProperty(l)},t.prototype.isFIFO=function(){return this._checkModeProperty(f)},t.prototype.isSocket=function(){return this._checkModeProperty(d)},t}();e.Dirent=h,e.default=h},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(136),i=r(177);e.ENCODING_UTF8="utf8",e.assertEncoding=function(t){if(t&&!n.Buffer.isEncoding(t))throw new i.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",t)},e.strToEncoding=function(t,r){return r&&r!==e.ENCODING_UTF8?"buffer"===r?new n.Buffer(t):new n.Buffer(t).toString(r):t}},function(t,e,r){"use strict";(function(t){var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var o=r(137),a=r(81),s="undefined"==typeof Symbol?"_kCode":Symbol("code"),u={};function c(t){return function(t){function e(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=t.call(this,f(e,r))||this;return i.code=e,i[s]=e,i.name=t.prototype.name+" ["+i[s]+"]",i}return i(e,t),e}(t)}var l=function(t){function r(r){var n=this;if("object"!=typeof r||null===r)throw new e.TypeError("ERR_INVALID_ARG_TYPE","options","object");return(n=r.message?t.call(this,r.message)||this:t.call(this,a.inspect(r.actual).slice(0,128)+" "+r.operator+" "+a.inspect(r.expected).slice(0,128))||this).generatedMessage=!r.message,n.name="AssertionError [ERR_ASSERTION]",n.code="ERR_ASSERTION",n.actual=r.actual,n.expected=r.expected,n.operator=r.operator,e.Error.captureStackTrace(n,r.stackStartFunction),n}return i(r,t),r}(t.Error);function f(t,e){o.strictEqual(typeof t,"string");var r,n=u[t];if(o(n,"An invalid error message key was used: "+t+"."),"function"==typeof n)r=n;else{if(r=a.format,void 0===e||0===e.length)return n;e.unshift(n)}return String(r.apply(null,e))}function d(t,e){u[t]="function"==typeof e?e:String(e)}function h(t,e){if(o(t,"expected is required"),o("string"==typeof e,"thing is required"),Array.isArray(t)){var r=t.length;return o(r>0,"At least one expected value needs to be specified"),t=t.map((function(t){return String(t)})),r>2?"one of "+e+" "+t.slice(0,r-1).join(", ")+", or "+t[r-1]:2===r?"one of "+e+" "+t[0]+" or "+t[1]:"of "+e+" "+t[0]}return"of "+e+" "+String(t)}e.AssertionError=l,e.message=f,e.E=d,e.Error=c(t.Error),e.TypeError=c(t.TypeError),e.RangeError=c(t.RangeError),d("ERR_ARG_NOT_ITERABLE","%s must be iterable"),d("ERR_ASSERTION","%s"),d("ERR_BUFFER_OUT_OF_BOUNDS",(function(t,e){return e?"Attempt to write outside buffer bounds":'"'+t+'" is outside of buffer bounds'})),d("ERR_CHILD_CLOSED_BEFORE_REPLY","Child closed before reply received"),d("ERR_CONSOLE_WRITABLE_STREAM","Console expects a writable stream instance for %s"),d("ERR_CPU_USAGE","Unable to obtain cpu usage %s"),d("ERR_DNS_SET_SERVERS_FAILED",(function(t,e){return'c-ares failed to set servers: "'+t+'" ['+e+"]"})),d("ERR_FALSY_VALUE_REJECTION","Promise was rejected with falsy value"),d("ERR_ENCODING_NOT_SUPPORTED",(function(t){return'The "'+t+'" encoding is not supported'})),d("ERR_ENCODING_INVALID_ENCODED_DATA",(function(t){return"The encoded data was not valid for encoding "+t})),d("ERR_HTTP_HEADERS_SENT","Cannot render headers after they are sent to the client"),d("ERR_HTTP_INVALID_STATUS_CODE","Invalid status code: %s"),d("ERR_HTTP_TRAILER_INVALID","Trailers are invalid with this transfer encoding"),d("ERR_INDEX_OUT_OF_RANGE","Index out of range"),d("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,i;o(t,"name is required"),e.includes("not ")?(n="must not be",e=e.split("not ")[1]):n="must be";if(Array.isArray(t)){var a=t.map((function(t){return'"'+t+'"'})).join(", ");i="The "+a+" arguments "+n+" "+h(e,"type")}else if(t.includes(" argument"))i="The "+t+" "+n+" "+h(e,"type");else{var s=t.includes(".")?"property":"argument";i='The "'+t+'" '+s+" "+n+" "+h(e,"type")}arguments.length>=3&&(i+=". Received type "+(null!==r?typeof r:"null"));return i})),d("ERR_INVALID_ARRAY_LENGTH",(function(t,e,r){return o.strictEqual(typeof r,"number"),'The array "'+t+'" (length '+r+") must be of length "+e+"."})),d("ERR_INVALID_BUFFER_SIZE","Buffer size must be a multiple of %s"),d("ERR_INVALID_CALLBACK","Callback must be a function"),d("ERR_INVALID_CHAR","Invalid character in %s"),d("ERR_INVALID_CURSOR_POS","Cannot set cursor row without setting its column"),d("ERR_INVALID_FD",'"fd" must be a positive integer: %s'),d("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s'),d("ERR_INVALID_FILE_URL_PATH","File URL path %s"),d("ERR_INVALID_HANDLE_TYPE","This handle type cannot be sent"),d("ERR_INVALID_IP_ADDRESS","Invalid IP address: %s"),d("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+String(e)+'" is invalid for option "'+t+'"'})),d("ERR_INVALID_OPT_VALUE_ENCODING",(function(t){return'The value "'+String(t)+'" is invalid for option "encoding"'})),d("ERR_INVALID_REPL_EVAL_CONFIG",'Cannot specify both "breakEvalOnSigint" and "eval" for REPL'),d("ERR_INVALID_SYNC_FORK_INPUT","Asynchronous forks do not support Buffer, Uint8Array or string input: %s"),d("ERR_INVALID_THIS",'Value of "this" must be of type %s'),d("ERR_INVALID_TUPLE","%s must be an iterable %s tuple"),d("ERR_INVALID_URL","Invalid URL: %s"),d("ERR_INVALID_URL_SCHEME",(function(t){return"The URL must be "+h(t,"scheme")})),d("ERR_IPC_CHANNEL_CLOSED","Channel closed"),d("ERR_IPC_DISCONNECTED","IPC channel is already disconnected"),d("ERR_IPC_ONE_PIPE","Child process can have only one IPC pipe"),d("ERR_IPC_SYNC_FORK","IPC cannot be used with synchronous forks"),d("ERR_MISSING_ARGS",(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];o(t.length>0,"At least one arg needs to be specified");var r="The ",n=t.length;switch(t=t.map((function(t){return'"'+t+'"'})),n){case 1:r+=t[0]+" argument";break;case 2:r+=t[0]+" and "+t[1]+" arguments";break;default:r+=t.slice(0,n-1).join(", "),r+=", and "+t[n-1]+" arguments"}return r+" must be specified"})),d("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),d("ERR_NAPI_CONS_FUNCTION","Constructor must be a function"),d("ERR_NAPI_CONS_PROTOTYPE_OBJECT","Constructor.prototype must be an object"),d("ERR_NO_CRYPTO","Node.js is not compiled with OpenSSL crypto support"),d("ERR_NO_LONGER_SUPPORTED","%s is no longer supported"),d("ERR_PARSE_HISTORY_DATA","Could not parse history data in %s"),d("ERR_SOCKET_ALREADY_BOUND","Socket is already bound"),d("ERR_SOCKET_BAD_PORT","Port should be > 0 and < 65536"),d("ERR_SOCKET_BAD_TYPE","Bad socket type specified. Valid types are: udp4, udp6"),d("ERR_SOCKET_CANNOT_SEND","Unable to send data"),d("ERR_SOCKET_CLOSED","Socket is closed"),d("ERR_SOCKET_DGRAM_NOT_RUNNING","Not running"),d("ERR_STDERR_CLOSE","process.stderr cannot be closed"),d("ERR_STDOUT_CLOSE","process.stdout cannot be closed"),d("ERR_STREAM_WRAP","Stream has StringDecoder set or is in objectMode"),d("ERR_TLS_CERT_ALTNAME_INVALID","Hostname/IP does not match certificate's altnames: %s"),d("ERR_TLS_DH_PARAM_SIZE",(function(t){return"DH parameter size "+t+" is less than 2048"})),d("ERR_TLS_HANDSHAKE_TIMEOUT","TLS handshake timeout"),d("ERR_TLS_RENEGOTIATION_FAILED","Failed to renegotiate"),d("ERR_TLS_REQUIRED_SERVER_NAME",'"servername" is required parameter for Server.addContext'),d("ERR_TLS_SESSION_ATTACK","TSL session renegotiation attack detected"),d("ERR_TRANSFORM_ALREADY_TRANSFORMING","Calling transform done when still transforming"),d("ERR_TRANSFORM_WITH_LENGTH_0","Calling transform done when writableState.length != 0"),d("ERR_UNKNOWN_ENCODING","Unknown encoding: %s"),d("ERR_UNKNOWN_SIGNAL","Unknown signal: %s"),d("ERR_UNKNOWN_STDIN_TYPE","Unknown stdin file type"),d("ERR_UNKNOWN_STREAM_TYPE","Unknown stream file type"),d("ERR_V8BREAKITERATOR","Full ICU data not installed. See https://github.com/nodejs/node/wiki/Intl")}).call(this,r(24))},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});function n(){var e=function(){if(void 0!==t)return t;try{return r(20)}catch(t){return}}()||{};return e.getuid||(e.getuid=function(){return 0}),e.getgid||(e.getgid=function(){return 0}),e.cwd||(e.cwd=function(){return"/"}),e.nextTick||(e.nextTick=r(179).default),e.emitWarning||(e.emitWarning=function(t,e){console.warn(e+(e?": ":"")+t)}),e.env||(e.env={}),e}e.createProcess=n,e.default=n()}).call(this,r(20))},function(t,e,r){"use strict";(function(t,r){var n;Object.defineProperty(e,"__esModule",{value:!0}),n="function"==typeof t?t.bind(r):setTimeout.bind(r),e.default=n}).call(this,r(109).setImmediate,r(24))},function(t,e,r){"use strict";(function(e,n){var i=r(110);t.exports=w;var o,a=r(171);w.ReadableState=b;r(61).EventEmitter;var s=function(t,e){return t.listeners(e).length},u=r(181),c=r(139).Buffer,l=e.Uint8Array||function(){};var f=Object.create(r(98));f.inherits=r(11);var d=r(300),h=void 0;h=d&&d.debuglog?d.debuglog("stream"):function(){};var g,p=r(301),m=r(182);f.inherits(w,u);var y=["error","close","destroy","pause","resume"];function b(t,e){t=t||{};var n=e instanceof(o=o||r(76));this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,a=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(a||0===a)?a:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(g||(g=r(67).StringDecoder),this.decoder=new g(t.encoding),this.encoding=t.encoding)}function w(t){if(o=o||r(76),!(this instanceof w))return new w(t);this._readableState=new b(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function _(t,e,r,n,i){var o,a=t._readableState;null===e?(a.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,S(t)}(t,a)):(i||(o=function(t,e){var r;n=e,c.isBuffer(n)||n instanceof l||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var n;return r}(a,e)),o?t.emit("error",o):a.objectMode||e&&e.length>0?("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===c.prototype||(e=function(t){return c.from(t)}(e)),n?a.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):v(t,a,e,!0):a.ended?t.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?v(t,a,e,!1):T(t,a)):v(t,a,e,!1))):n||(a.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(a)}function v(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&S(t)),T(t,e)}Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),w.prototype.destroy=m.destroy,w.prototype._undestroy=m.undestroy,w.prototype._destroy=function(t,e){this.push(null),e(t)},w.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=c.from(t,e),e=""),r=!0),_(this,t,e,!1,r)},w.prototype.unshift=function(t){return _(this,t,null,!0,!1)},w.prototype.isPaused=function(){return!1===this._readableState.flowing},w.prototype.setEncoding=function(t){return g||(g=r(67).StringDecoder),this._readableState.decoder=new g(t),this._readableState.encoding=t,this};function E(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function S(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(h("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(O,t):O(t))}function O(t){h("emit readable"),t.emit("readable"),I(t)}function T(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(A,t,e))}function A(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(h("maybeReadMore read 0"),t.read(0),r!==e.length);)r=e.length;e.readingMore=!1}function M(t){h("readable nexttick read 0"),t.read(0)}function j(t,e){e.reading||(h("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),I(t),e.flowing&&!e.reading&&t.read(0)}function I(t){var e=t._readableState;for(h("flow",e.flowing);e.flowing&&null!==t.read(););}function R(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;t<e.head.data.length?(n=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):n=t===e.head.data.length?e.shift():r?function(t,e){var r=e.head,n=1,i=r.data;t-=i.length;for(;r=r.next;){var o=r.data,a=t>o.length?o.length:t;if(a===o.length?i+=o:i+=o.slice(0,t),0===(t-=a)){a===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(a));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=c.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var o=n.data,a=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,a),0===(t-=a)){a===o.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(a));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function D(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(k,e,t))}function k(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function N(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}w.prototype.read=function(t){h("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return h("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?D(this):S(this),null;if(0===(t=E(t,e))&&e.ended)return 0===e.length&&D(this),null;var n,i=e.needReadable;return h("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&h("length less than watermark",i=!0),e.ended||e.reading?h("reading or ended",i=!1):i&&(h("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=E(r,e))),null===(n=t>0?R(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&D(this)),null!==n&&this.emit("data",n),n},w.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},w.prototype.pipe=function(t,e){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,h("pipe count=%d opts=%j",o.pipesCount,e);var u=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?l:w;function c(e,n){h("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,h("cleanup"),t.removeListener("close",y),t.removeListener("finish",b),t.removeListener("drain",f),t.removeListener("error",m),t.removeListener("unpipe",c),r.removeListener("end",l),r.removeListener("end",w),r.removeListener("data",p),d=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function l(){h("onend"),t.end()}o.endEmitted?i.nextTick(u):r.once("end",u),t.on("unpipe",c);var f=function(t){return function(){var e=t._readableState;h("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,I(t))}}(r);t.on("drain",f);var d=!1;var g=!1;function p(e){h("ondata"),g=!1,!1!==t.write(e)||g||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==N(o.pipes,t))&&!d&&(h("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,g=!0),r.pause())}function m(e){h("onerror",e),w(),t.removeListener("error",m),0===s(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",b),w()}function b(){h("onfinish"),t.removeListener("close",y),w()}function w(){h("unpipe"),r.unpipe(t)}return r.on("data",p),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?a(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",m),t.once("close",y),t.once("finish",b),t.emit("pipe",r),o.flowing||(h("pipe resume"),r.resume()),t},w.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,r);return this}var a=N(e.pipes,t);return-1===a||(e.pipes.splice(a,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},w.prototype.on=function(t,e){var r=u.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var n=this._readableState;n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&S(this):i.nextTick(M,this))}return r},w.prototype.addListener=w.prototype.on,w.prototype.resume=function(){var t=this._readableState;return t.flowing||(h("resume"),t.flowing=!0,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(j,t,e))}(this,t)),this},w.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this},w.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(h("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(h("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<y.length;o++)t.on(y[o],this.emit.bind(this,y[o]));return this._read=function(e){h("wrapped _read",e),n&&(n=!1,t.resume())},this},Object.defineProperty(w.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),w._fromList=R}).call(this,r(24),r(20))},function(t,e,r){t.exports=r(61).EventEmitter},function(t,e,r){"use strict";var n=r(110);function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var r=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||n.nextTick(i,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(n.nextTick(i,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,r){"use strict";t.exports=a;var n=r(76),i=Object.create(r(98));function o(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function a(t){if(!(this instanceof a))return new a(t);n.call(this,t),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",s)}function s(){var t=this;"function"==typeof this._flush?this._flush((function(e,r){u(t,e,r)})):u(this,null,null)}function u(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}i.inherits=r(11),i.inherits(a,n),a.prototype.push=function(t,e){return this._transformState.needTransform=!1,n.prototype.push.call(this,t,e)},a.prototype._transform=function(t,e,r){throw new Error("_transform() is not implemented")},a.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},a.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},a.prototype._destroy=function(t,e){var r=this;n.prototype._destroy.call(this,t,(function(t){e(t),r.emit("close")}))}},function(t,e,r){"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=r(82),e.createHash=e.Hash=r(99),e.createHmac=e.Hmac=r(194);var n=r(330),i=Object.keys(n),o=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(i);e.getHashes=function(){return o};var a=r(197);e.pbkdf2=a.pbkdf2,e.pbkdf2Sync=a.pbkdf2Sync;var s=r(332);e.Cipher=s.Cipher,e.createCipher=s.createCipher,e.Cipheriv=s.Cipheriv,e.createCipheriv=s.createCipheriv,e.Decipher=s.Decipher,e.createDecipher=s.createDecipher,e.Decipheriv=s.Decipheriv,e.createDecipheriv=s.createDecipheriv,e.getCiphers=s.getCiphers,e.listCiphers=s.listCiphers;var u=r(347);e.DiffieHellmanGroup=u.DiffieHellmanGroup,e.createDiffieHellmanGroup=u.createDiffieHellmanGroup,e.getDiffieHellman=u.getDiffieHellman,e.createDiffieHellman=u.createDiffieHellman,e.DiffieHellman=u.DiffieHellman;var c=r(352);e.createSign=c.createSign,e.Sign=c.Sign,e.createVerify=c.createVerify,e.Verify=c.Verify,e.createECDH=r(393);var l=r(394);e.publicEncrypt=l.publicEncrypt,e.privateEncrypt=l.privateEncrypt,e.publicDecrypt=l.publicDecrypt,e.privateDecrypt=l.privateDecrypt;var f=r(397);e.randomFill=f.randomFill,e.randomFillSync=f.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(t,e,r){"use strict";var n=r(17).Buffer,i=r(317).Transform;function o(t){i.call(this),this._block=n.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(11)(o,i),o.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!n.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");n.isBuffer(t)||(t=n.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)r[o++]=t[i++];this._update(),this._blockOffset=0}for(;i<t.length;)r[this._blockOffset++]=t[i++];for(var a=0,s=8*t.length;s>0;++a)this._length[a]+=s,(s=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*s);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},function(t,e,r){"use strict";(function(e,n){var i;t.exports=T,T.ReadableState=O;r(61).EventEmitter;var o=function(t,e){return t.listeners(e).length},a=r(187),s=r(14).Buffer,u=e.Uint8Array||function(){};var c,l=r(318);c=l&&l.debuglog?l.debuglog("stream"):function(){};var f,d,h,g=r(319),p=r(188),m=r(189).getHighWaterMark,y=r(83).codes,b=y.ERR_INVALID_ARG_TYPE,w=y.ERR_STREAM_PUSH_AFTER_EOF,_=y.ERR_METHOD_NOT_IMPLEMENTED,v=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(11)(T,a);var E=p.errorOrDestroy,S=["error","close","destroy","pause","resume"];function O(t,e,n){i=i||r(84),t=t||{},"boolean"!=typeof n&&(n=e instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=m(this,t,"readableHighWaterMark",n),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(f||(f=r(67).StringDecoder),this.decoder=new f(t.encoding),this.encoding=t.encoding)}function T(t){if(i=i||r(84),!(this instanceof T))return new T(t);var e=this instanceof i;this._readableState=new O(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function A(t,e,r,n,i){c("readableAddChunk",e);var o,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(c("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?I(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,R(t)))}(t,a);else if(i||(o=function(t,e){var r;n=e,s.isBuffer(n)||n instanceof u||"string"==typeof e||void 0===e||t.objectMode||(r=new b("chunk",["string","Buffer","Uint8Array"],e));var n;return r}(a,e)),o)E(t,o);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),n)a.endEmitted?E(t,new v):M(t,a,e,!0);else if(a.ended)E(t,new w);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?M(t,a,e,!1):D(t,a)):M(t,a,e,!1)}else n||(a.reading=!1,D(t,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function M(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&I(t)),D(t,e)}Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),T.prototype.destroy=p.destroy,T.prototype._undestroy=p.undestroy,T.prototype._destroy=function(t,e){e(t)},T.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=s.from(t,e),e=""),r=!0),A(this,t,e,!1,r)},T.prototype.unshift=function(t){return A(this,t,null,!0,!1)},T.prototype.isPaused=function(){return!1===this._readableState.flowing},T.prototype.setEncoding=function(t){f||(f=r(67).StringDecoder);var e=new f(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=e.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};function j(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function I(t){var e=t._readableState;c("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(c("emitReadable",e.flowing),e.emittedReadable=!0,n.nextTick(R,t))}function R(t){var e=t._readableState;c("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,L(t)}function D(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(k,t,e))}function k(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(c("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function N(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function C(t){c("readable nexttick read 0"),t.read(0)}function x(t,e){c("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),L(t),e.flowing&&!e.reading&&t.read(0)}function L(t){var e=t._readableState;for(c("flow",e.flowing);e.flowing&&null!==t.read(););}function P(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function B(t){var e=t._readableState;c("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,n.nextTick(U,e,t))}function U(t,e){if(c("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function F(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}T.prototype.read=function(t){c("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return c("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?B(this):I(this),null;if(0===(t=j(t,e))&&e.ended)return 0===e.length&&B(this),null;var n,i=e.needReadable;return c("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&c("length less than watermark",i=!0),e.ended||e.reading?c("reading or ended",i=!1):i&&(c("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=j(r,e))),null===(n=t>0?P(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&B(this)),null!==n&&this.emit("data",n),n},T.prototype._read=function(t){E(this,new _("_read()"))},T.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,e);var a=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?u:m;function s(e,n){c("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,c("cleanup"),t.removeListener("close",g),t.removeListener("finish",p),t.removeListener("drain",l),t.removeListener("error",h),t.removeListener("unpipe",s),r.removeListener("end",u),r.removeListener("end",m),r.removeListener("data",d),f=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function u(){c("onend"),t.end()}i.endEmitted?n.nextTick(a):r.once("end",a),t.on("unpipe",s);var l=function(t){return function(){var e=t._readableState;c("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,L(t))}}(r);t.on("drain",l);var f=!1;function d(e){c("ondata");var n=t.write(e);c("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==F(i.pipes,t))&&!f&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function h(e){c("onerror",e),m(),t.removeListener("error",h),0===o(t,"error")&&E(t,e)}function g(){t.removeListener("finish",p),m()}function p(){c("onfinish"),t.removeListener("close",g),m()}function m(){c("unpipe"),r.unpipe(t)}return r.on("data",d),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",h),t.once("close",g),t.once("finish",p),t.emit("pipe",r),i.flowing||(c("pipe resume"),r.resume()),t},T.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=F(e.pipes,t);return-1===a||(e.pipes.splice(a,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},T.prototype.on=function(t,e){var r=a.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?I(this):i.reading||n.nextTick(C,this))),r},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(t,e){var r=a.prototype.removeListener.call(this,t,e);return"readable"===t&&n.nextTick(N,this),r},T.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||n.nextTick(N,this),e},T.prototype.resume=function(){var t=this._readableState;return t.flowing||(c("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,n.nextTick(x,t,e))}(this,t)),t.paused=!1,this},T.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(c("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(c("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<S.length;o++)t.on(S[o],this.emit.bind(this,S[o]));return this._read=function(e){c("wrapped _read",e),n&&(n=!1,t.resume())},this},"function"==typeof Symbol&&(T.prototype[Symbol.asyncIterator]=function(){return void 0===d&&(d=r(321)),d(this)}),Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(T.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(T.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),T._fromList=P,Object.defineProperty(T.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(T.from=function(t,e){return void 0===h&&(h=r(322)),h(T,t,e)})}).call(this,r(24),r(20))},function(t,e,r){t.exports=r(61).EventEmitter},function(t,e,r){"use strict";(function(e){function r(t,e){i(t,e),n(t)}function n(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,o){var a=this,s=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return s||u?(o?o(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(i,this,t)):e.nextTick(i,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!o&&t?a._writableState?a._writableState.errorEmitted?e.nextTick(n,a):(a._writableState.errorEmitted=!0,e.nextTick(r,a,t)):e.nextTick(r,a,t):o?(e.nextTick(n,a),o(t)):e.nextTick(n,a)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}}}).call(this,r(20))},function(t,e,r){"use strict";var n=r(83).codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,r,i){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},function(t,e,r){"use strict";(function(e,n){function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}var o;t.exports=T,T.WritableState=O;var a={deprecate:r(141)},s=r(187),u=r(14).Buffer,c=e.Uint8Array||function(){};var l,f=r(188),d=r(189).getHighWaterMark,h=r(83).codes,g=h.ERR_INVALID_ARG_TYPE,p=h.ERR_METHOD_NOT_IMPLEMENTED,m=h.ERR_MULTIPLE_CALLBACK,y=h.ERR_STREAM_CANNOT_PIPE,b=h.ERR_STREAM_DESTROYED,w=h.ERR_STREAM_NULL_VALUES,_=h.ERR_STREAM_WRITE_AFTER_END,v=h.ERR_UNKNOWN_ENCODING,E=f.errorOrDestroy;function S(){}function O(t,e,a){o=o||r(84),t=t||{},"boolean"!=typeof a&&(a=e instanceof o),this.objectMode=!!t.objectMode,a&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=d(this,t,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===t.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,o=r.writecb;if("function"!=typeof o)throw new m;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,o){--e.pendingcb,r?(n.nextTick(o,i),n.nextTick(D,t,e),t._writableState.errorEmitted=!0,E(t,i)):(o(i),t._writableState.errorEmitted=!0,E(t,i),D(t,e))}(t,r,i,e,o);else{var a=I(r)||t.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||j(t,r),i?n.nextTick(M,t,r,a,o):M(t,r,a,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function T(t){var e=this instanceof(o=o||r(84));if(!e&&!l.call(T,this))return new T(t);this._writableState=new O(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),s.call(this)}function A(t,e,r,n,i,o,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new b("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function M(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),D(t,e)}function j(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,o=new Array(n),a=e.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)o[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;o.allBuffers=u,A(t,e,!0,e.length,o,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,f=r.callback;if(A(t,e,!1,e.objectMode?1:c.length,c,l,f),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function I(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function R(t,e){t._final((function(r){e.pendingcb--,r&&E(t,r),e.prefinished=!0,t.emit("prefinish"),D(t,e)}))}function D(t,e){var r=I(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,n.nextTick(R,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}r(11)(T,s),O.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(O.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(T,Symbol.hasInstance,{value:function(t){return!!l.call(this,t)||this===T&&(t&&t._writableState instanceof O)}})):l=function(t){return t instanceof this},T.prototype.pipe=function(){E(this,new y)},T.prototype.write=function(t,e,r){var i,o=this._writableState,a=!1,s=!o.objectMode&&(i=t,u.isBuffer(i)||i instanceof c);return s&&!u.isBuffer(t)&&(t=function(t){return u.from(t)}(t)),"function"==typeof e&&(r=e,e=null),s?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof r&&(r=S),o.ending?function(t,e){var r=new _;E(t,r),n.nextTick(e,r)}(this,r):(s||function(t,e,r,i){var o;return null===r?o=new w:"string"==typeof r||e.objectMode||(o=new g("chunk",["string","Buffer"],r)),!o||(E(t,o),n.nextTick(i,o),!1)}(this,o,t,r))&&(o.pendingcb++,a=function(t,e,r,n,i,o){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=u.from(e,r));return e}(e,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=e.objectMode?1:n.length;e.length+=s;var c=e.length<e.highWaterMark;c||(e.needDrain=!0);if(e.writing||e.corked){var l=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},l?l.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else A(t,e,!1,s,n,i,o);return c}(this,o,s,t,e,r)),a},T.prototype.cork=function(){this._writableState.corked++},T.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||j(this,t))},T.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new v(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),T.prototype._write=function(t,e,r){r(new p("_write()"))},T.prototype._writev=null,T.prototype.end=function(t,e,r){var i=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,D(t,e),r&&(e.finished?n.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),T.prototype.destroy=f.destroy,T.prototype._undestroy=f.undestroy,T.prototype._destroy=function(t,e){e(t)}}).call(this,r(24),r(20))},function(t,e,r){"use strict";t.exports=l;var n=r(83).codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(84);function c(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function l(t){if(!(this instanceof l))return new l(t);u.call(this,t),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",f)}function f(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?d(this,null,null):this._flush((function(e,r){d(t,e,r)}))}function d(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new s;if(t._transformState.transforming)throw new a;return t.push(null)}r(11)(l,u),l.prototype.push=function(t,e){return this._transformState.needTransform=!1,u.prototype.push.call(this,t,e)},l.prototype._transform=function(t,e,r){r(new i("_transform()"))},l.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},l.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},l.prototype._destroy=function(t,e){u.prototype._destroy.call(this,t,(function(t){e(t)}))}},function(t,e,r){var n=r(11),i=r(85),o=r(17).Buffer,a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(t,e,r){return r^t&(e^r)}function l(t,e,r){return t&e|r&(t|e)}function f(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function d(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function h(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}n(u,i),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,g=0|this._f,p=0|this._g,m=0|this._h,y=0;y<16;++y)r[y]=t.readInt32BE(4*y);for(;y<64;++y)r[y]=0|(((e=r[y-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[y-7]+h(r[y-15])+r[y-16];for(var b=0;b<64;++b){var w=m+d(u)+c(u,g,p)+a[b]+r[b]|0,_=f(n)+l(n,i,o)|0;m=p,p=g,g=u,u=s+w|0,s=o,o=i,i=n,n=w+_|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0,this._f=g+this._f|0,this._g=p+this._g|0,this._h=m+this._h|0},u.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=u},function(t,e,r){var n=r(11),i=r(85),o=r(17).Buffer,a=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function u(){this.init(),this._w=s,i.call(this,128,112)}function c(t,e,r){return r^t&(e^r)}function l(t,e,r){return t&e|r&(t|e)}function f(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function d(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function h(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function g(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function p(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function y(t,e){return t>>>0<e>>>0?1:0}n(u,i),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,s=0|this._eh,u=0|this._fh,b=0|this._gh,w=0|this._hh,_=0|this._al,v=0|this._bl,E=0|this._cl,S=0|this._dl,O=0|this._el,T=0|this._fl,A=0|this._gl,M=0|this._hl,j=0;j<32;j+=2)e[j]=t.readInt32BE(4*j),e[j+1]=t.readInt32BE(4*j+4);for(;j<160;j+=2){var I=e[j-30],R=e[j-30+1],D=h(I,R),k=g(R,I),N=p(I=e[j-4],R=e[j-4+1]),C=m(R,I),x=e[j-14],L=e[j-14+1],P=e[j-32],B=e[j-32+1],U=k+L|0,F=D+x+y(U,k)|0;F=(F=F+N+y(U=U+C|0,C)|0)+P+y(U=U+B|0,B)|0,e[j]=F,e[j+1]=U}for(var W=0;W<160;W+=2){F=e[W],U=e[W+1];var H=l(r,n,i),q=l(_,v,E),z=f(r,_),V=f(_,r),Y=d(s,O),G=d(O,s),$=a[W],K=a[W+1],Z=c(s,u,b),J=c(O,T,A),X=M+G|0,Q=w+Y+y(X,M)|0;Q=(Q=(Q=Q+Z+y(X=X+J|0,J)|0)+$+y(X=X+K|0,K)|0)+F+y(X=X+U|0,U)|0;var tt=V+q|0,et=z+H+y(tt,V)|0;w=b,M=A,b=u,A=T,u=s,T=O,s=o+Q+y(O=S+X|0,S)|0,o=i,S=E,i=n,E=v,n=r,v=_,r=Q+et+y(_=X+tt|0,X)|0}this._al=this._al+_|0,this._bl=this._bl+v|0,this._cl=this._cl+E|0,this._dl=this._dl+S|0,this._el=this._el+O|0,this._fl=this._fl+T|0,this._gl=this._gl+A|0,this._hl=this._hl+M|0,this._ah=this._ah+r+y(this._al,_)|0,this._bh=this._bh+n+y(this._bl,v)|0,this._ch=this._ch+i+y(this._cl,E)|0,this._dh=this._dh+o+y(this._dl,S)|0,this._eh=this._eh+s+y(this._el,O)|0,this._fh=this._fh+u+y(this._fl,T)|0,this._gh=this._gh+b+y(this._gl,A)|0,this._hh=this._hh+w+y(this._hl,M)|0},u.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=u},function(t,e,r){"use strict";var n=r(11),i=r(329),o=r(68),a=r(17).Buffer,s=r(195),u=r(144),c=r(145),l=a.alloc(128);function f(t,e){o.call(this,"digest"),"string"==typeof e&&(e=a.from(e));var r="sha512"===t||"sha384"===t?128:64;(this._alg=t,this._key=e,e.length>r)?e=("rmd160"===t?new u:c(t)).update(e).digest():e.length<r&&(e=a.concat([e,l],r));for(var n=this._ipad=a.allocUnsafe(r),i=this._opad=a.allocUnsafe(r),s=0;s<r;s++)n[s]=54^e[s],i[s]=92^e[s];this._hash="rmd160"===t?new u:c(t),this._hash.update(n)}n(f,o),f.prototype._update=function(t){this._hash.update(t)},f.prototype._final=function(){var t=this._hash.digest();return("rmd160"===this._alg?new u:c(this._alg)).update(this._opad).update(t).digest()},t.exports=function(t,e){return"rmd160"===(t=t.toLowerCase())||"ripemd160"===t?new f("rmd160",e):"md5"===t?new i(s,e):new f(t,e)}},function(t,e,r){var n=r(142);t.exports=function(t){return(new n).update(t).digest()}},function(t){t.exports=JSON.parse('{"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"}}')},function(t,e,r){e.pbkdf2=r(331),e.pbkdf2Sync=r(200)},function(t,e){var r=Math.pow(2,30)-1;t.exports=function(t,e){if("number"!=typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!=typeof e)throw new TypeError("Key length not a number");if(e<0||e>r||e!=e)throw new TypeError("Bad key length")}},function(t,e,r){(function(e,r){var n;if(e.process&&e.process.browser)n="utf-8";else if(e.process&&e.process.version){n=parseInt(r.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else n="utf-8";t.exports=n}).call(this,r(24),r(20))},function(t,e,r){var n=r(195),i=r(144),o=r(145),a=r(17).Buffer,s=r(198),u=r(199),c=r(201),l=a.alloc(128),f={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function d(t,e,r){var s=function(t){function e(e){return o(t).update(e).digest()}return"rmd160"===t||"ripemd160"===t?function(t){return(new i).update(t).digest()}:"md5"===t?n:e}(t),u="sha512"===t||"sha384"===t?128:64;e.length>u?e=s(e):e.length<u&&(e=a.concat([e,l],u));for(var c=a.allocUnsafe(u+f[t]),d=a.allocUnsafe(u+f[t]),h=0;h<u;h++)c[h]=54^e[h],d[h]=92^e[h];var g=a.allocUnsafe(u+r+4);c.copy(g,0,0,u),this.ipad1=g,this.ipad2=c,this.opad=d,this.alg=t,this.blocksize=u,this.hash=s,this.size=f[t]}d.prototype.run=function(t,e){return t.copy(e,this.blocksize),this.hash(e).copy(this.opad,this.blocksize),this.hash(this.opad)},t.exports=function(t,e,r,n,i){s(r,n);var o=new d(i=i||"sha1",t=c(t,u,"Password"),(e=c(e,u,"Salt")).length),l=a.allocUnsafe(n),h=a.allocUnsafe(e.length+4);e.copy(h,0,0,e.length);for(var g=0,p=f[i],m=Math.ceil(n/p),y=1;y<=m;y++){h.writeUInt32BE(y,e.length);for(var b=o.run(h,o.ipad1),w=b,_=1;_<r;_++){w=o.run(w,o.ipad2);for(var v=0;v<p;v++)b[v]^=w[v]}b.copy(l,g),g+=p}return l}},function(t,e,r){var n=r(17).Buffer;t.exports=function(t,e,r){if(n.isBuffer(t))return t;if("string"==typeof t)return n.from(t,e);if(ArrayBuffer.isView(t))return n.from(t.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")}},function(t,e,r){"use strict";e.readUInt32BE=function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},e.writeUInt32BE=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},e.ip=function(t,e,r,n){for(var i=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=e>>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=t>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1}r[n+0]=i>>>0,r[n+1]=o>>>0},e.rip=function(t,e,r,n){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)i<<=1,i|=e>>>s+a&1,i<<=1,i|=t>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=e>>>s+a&1,o<<=1,o|=t>>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},e.pc1=function(t,e,r,n){for(var i=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},e.r28shl=function(t,e){return t<<e&268435455|t>>>28-e};var n=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(t,e,r,i){for(var o=0,a=0,s=n.length>>>1,u=0;u<s;u++)o<<=1,o|=t>>>n[u]&1;for(u=s;u<n.length;u++)a<<=1,a|=e>>>n[u]&1;r[i+0]=o>>>0,r[i+1]=a>>>0},e.expand=function(t,e,r){var n=0,i=0;n=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)n<<=6,n|=t>>>o&63;for(o=11;o>=3;o-=4)i|=t>>>o&63,i<<=6;i|=(31&t)<<1|t>>>31,e[r+0]=n>>>0,e[r+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(t,e){for(var r=0,n=0;n<4;n++){r<<=4,r|=i[64*n+(t>>>18-6*n&63)]}for(n=0;n<4;n++){r<<=4,r|=i[256+64*n+(e>>>18-6*n&63)]}return r>>>0};var o=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(t){for(var e=0,r=0;r<o.length;r++)e<<=1,e|=t>>>o[r]&1;return e>>>0},e.padSplit=function(t,e,r){for(var n=t.toString(2);n.length<e;)n="0"+n;for(var i=[],o=0;o<e;o+=r)i.push(n.slice(o,o+r));return i.join(" ")}},function(t,e,r){"use strict";var n=r(42),i=r(11),o=r(202),a=r(146);function s(){this.tmp=new Array(2),this.keys=null}function u(t){a.call(this,t);var e=new s;this._desState=e,this.deriveKeys(e,t.key)}i(u,a),t.exports=u,u.create=function(t){return new u(t)};var c=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];u.prototype.deriveKeys=function(t,e){t.keys=new Array(32),n.equal(e.length,this.blockSize,"Invalid key length");var r=o.readUInt32BE(e,0),i=o.readUInt32BE(e,4);o.pc1(r,i,t.tmp,0),r=t.tmp[0],i=t.tmp[1];for(var a=0;a<t.keys.length;a+=2){var s=c[a>>>1];r=o.r28shl(r,s),i=o.r28shl(i,s),o.pc2(r,i,t.keys,a)}},u.prototype._update=function(t,e,r,n){var i=this._desState,a=o.readUInt32BE(t,e),s=o.readUInt32BE(t,e+4);o.ip(a,s,i.tmp,0),a=i.tmp[0],s=i.tmp[1],"encrypt"===this.type?this._encrypt(i,a,s,i.tmp,0):this._decrypt(i,a,s,i.tmp,0),a=i.tmp[0],s=i.tmp[1],o.writeUInt32BE(r,a,n),o.writeUInt32BE(r,s,n+4)},u.prototype._pad=function(t,e){for(var r=t.length-e,n=e;n<t.length;n++)t[n]=r;return!0},u.prototype._unpad=function(t){for(var e=t[t.length-1],r=t.length-e;r<t.length;r++)n.equal(t[r],e);return t.slice(0,t.length-e)},u.prototype._encrypt=function(t,e,r,n,i){for(var a=e,s=r,u=0;u<t.keys.length;u+=2){var c=t.keys[u],l=t.keys[u+1];o.expand(s,t.tmp,0),c^=t.tmp[0],l^=t.tmp[1];var f=o.substitute(c,l),d=s;s=(a^o.permute(f))>>>0,a=d}o.rip(s,a,n,i)},u.prototype._decrypt=function(t,e,r,n,i){for(var a=r,s=e,u=t.keys.length-2;u>=0;u-=2){var c=t.keys[u],l=t.keys[u+1];o.expand(a,t.tmp,0),c^=t.tmp[0],l^=t.tmp[1];var f=o.substitute(c,l),d=a;a=(s^o.permute(f))>>>0,s=d}o.rip(a,s,n,i)}},function(t,e,r){var n=r(100),i=r(17).Buffer,o=r(205);function a(t){var e=t._cipher.encryptBlockRaw(t._prev);return o(t._prev),e}e.encrypt=function(t,e){var r=Math.ceil(e.length/16),o=t._cache.length;t._cache=i.concat([t._cache,i.allocUnsafe(16*r)]);for(var s=0;s<r;s++){var u=a(t),c=o+16*s;t._cache.writeUInt32BE(u[0],c+0),t._cache.writeUInt32BE(u[1],c+4),t._cache.writeUInt32BE(u[2],c+8),t._cache.writeUInt32BE(u[3],c+12)}var l=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),n(e,l)}},function(t,e){t.exports=function(t){for(var e,r=t.length;r--;){if(255!==(e=t.readUInt8(r))){e++,t.writeUInt8(e,r);break}t.writeUInt8(0,r)}}},function(t){t.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')},function(t,e,r){var n=r(111),i=r(17).Buffer,o=r(68),a=r(11),s=r(344),u=r(100),c=r(205);function l(t,e,r,a){o.call(this);var u=i.alloc(4,0);this._cipher=new n.AES(e);var l=this._cipher.encryptBlock(u);this._ghash=new s(l),r=function(t,e,r){if(12===e.length)return t._finID=i.concat([e,i.from([0,0,0,1])]),i.concat([e,i.from([0,0,0,2])]);var n=new s(r),o=e.length,a=o%16;n.update(e),a&&(a=16-a,n.update(i.alloc(a,0))),n.update(i.alloc(8,0));var u=8*o,l=i.alloc(8);l.writeUIntBE(u,0,8),n.update(l),t._finID=n.state;var f=i.from(t._finID);return c(f),f}(this,r,l),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=t,this._authTag=null,this._called=!1}a(l,o),l.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=i.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},l.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var n=Math.min(t.length,e.length),i=0;i<n;++i)r+=t[i]^e[i];return r}(t,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=t,this._cipher.scrub()},l.prototype.getAuthTag=function(){if(this._decrypt||!i.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},l.prototype.setAuthTag=function(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t},l.prototype.setAAD=function(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length},t.exports=l},function(t,e,r){var n=r(111),i=r(17).Buffer,o=r(68);function a(t,e,r,a){o.call(this),this._cipher=new n.AES(e),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._mode=t}r(11)(a,o),a.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},a.prototype._final=function(){this._cipher.scrub()},t.exports=a},function(t,e,r){var n=r(82);t.exports=b,b.simpleSieve=m,b.fermatTest=y;var i=r(35),o=new i(24),a=new(r(210)),s=new i(1),u=new i(2),c=new i(5),l=(new i(16),new i(8),new i(10)),f=new i(3),d=(new i(7),new i(11)),h=new i(4),g=(new i(12),null);function p(){if(null!==g)return g;var t=[];t[0]=2;for(var e=1,r=3;r<1048576;r+=2){for(var n=Math.ceil(Math.sqrt(r)),i=0;i<e&&t[i]<=n&&r%t[i]!=0;i++);e!==i&&t[i]<=n||(t[e++]=r)}return g=t,t}function m(t){for(var e=p(),r=0;r<e.length;r++)if(0===t.modn(e[r]))return 0===t.cmpn(e[r]);return!0}function y(t){var e=i.mont(t);return 0===u.toRed(e).redPow(t.subn(1)).fromRed().cmpn(1)}function b(t,e){if(t<16)return new i(2===e||5===e?[140,123]:[140,39]);var r,g;for(e=new i(e);;){for(r=new i(n(Math.ceil(t/8)));r.bitLength()>t;)r.ishrn(1);if(r.isEven()&&r.iadd(s),r.testn(1)||r.iadd(u),e.cmp(u)){if(!e.cmp(c))for(;r.mod(l).cmp(f);)r.iadd(h)}else for(;r.mod(o).cmp(d);)r.iadd(h);if(m(g=r.shrn(1))&&m(r)&&y(g)&&y(r)&&a.test(g)&&a.test(r))return r}}},function(t,e,r){var n=r(35),i=r(149);function o(t){this.rand=t||new i.Rand}t.exports=o,o.create=function(t){return new o(t)},o.prototype._randbelow=function(t){var e=t.bitLength(),r=Math.ceil(e/8);do{var i=new n(this.rand.generate(r))}while(i.cmp(t)>=0);return i},o.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},o.prototype.test=function(t,e,r){var i=t.bitLength(),o=n.mont(t),a=new n(1).toRed(o);e||(e=Math.max(1,i/48|0));for(var s=t.subn(1),u=0;!s.testn(u);u++);for(var c=t.shrn(u),l=s.toRed(o);e>0;e--){var f=this._randrange(new n(2),s);r&&r(f);var d=f.toRed(o).redPow(c);if(0!==d.cmp(a)&&0!==d.cmp(l)){for(var h=1;h<u;h++){if(0===(d=d.redSqr()).cmp(a))return!1;if(0===d.cmp(l))break}if(h===u)return!1}}return!0},o.prototype.getDivisor=function(t,e){var r=t.bitLength(),i=n.mont(t),o=new n(1).toRed(i);e||(e=Math.max(1,r/48|0));for(var a=t.subn(1),s=0;!a.testn(s);s++);for(var u=t.shrn(s),c=a.toRed(i);e>0;e--){var l=this._randrange(new n(2),a),f=t.gcd(l);if(0!==f.cmpn(1))return f;var d=l.toRed(i).redPow(u);if(0!==d.cmp(o)&&0!==d.cmp(c)){for(var h=1;h<s;h++){if(0===(d=d.redSqr()).cmp(o))return d.fromRed().subn(1).gcd(t);if(0===d.cmp(c))break}if(h===s)return(d=d.redSqr()).fromRed().subn(1).gcd(t)}}return!1}},function(t,e,r){"use strict";(function(e,n){var i;t.exports=T,T.ReadableState=O;r(61).EventEmitter;var o=function(t,e){return t.listeners(e).length},a=r(212),s=r(14).Buffer,u=e.Uint8Array||function(){};var c,l=r(354);c=l&&l.debuglog?l.debuglog("stream"):function(){};var f,d,h,g=r(355),p=r(213),m=r(214).getHighWaterMark,y=r(86).codes,b=y.ERR_INVALID_ARG_TYPE,w=y.ERR_STREAM_PUSH_AFTER_EOF,_=y.ERR_METHOD_NOT_IMPLEMENTED,v=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(11)(T,a);var E=p.errorOrDestroy,S=["error","close","destroy","pause","resume"];function O(t,e,n){i=i||r(87),t=t||{},"boolean"!=typeof n&&(n=e instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=m(this,t,"readableHighWaterMark",n),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(f||(f=r(67).StringDecoder),this.decoder=new f(t.encoding),this.encoding=t.encoding)}function T(t){if(i=i||r(87),!(this instanceof T))return new T(t);var e=this instanceof i;this._readableState=new O(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function A(t,e,r,n,i){c("readableAddChunk",e);var o,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(c("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?I(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,R(t)))}(t,a);else if(i||(o=function(t,e){var r;n=e,s.isBuffer(n)||n instanceof u||"string"==typeof e||void 0===e||t.objectMode||(r=new b("chunk",["string","Buffer","Uint8Array"],e));var n;return r}(a,e)),o)E(t,o);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),n)a.endEmitted?E(t,new v):M(t,a,e,!0);else if(a.ended)E(t,new w);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?M(t,a,e,!1):D(t,a)):M(t,a,e,!1)}else n||(a.reading=!1,D(t,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function M(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&I(t)),D(t,e)}Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),T.prototype.destroy=p.destroy,T.prototype._undestroy=p.undestroy,T.prototype._destroy=function(t,e){e(t)},T.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=s.from(t,e),e=""),r=!0),A(this,t,e,!1,r)},T.prototype.unshift=function(t){return A(this,t,null,!0,!1)},T.prototype.isPaused=function(){return!1===this._readableState.flowing},T.prototype.setEncoding=function(t){f||(f=r(67).StringDecoder);var e=new f(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=e.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};function j(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function I(t){var e=t._readableState;c("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(c("emitReadable",e.flowing),e.emittedReadable=!0,n.nextTick(R,t))}function R(t){var e=t._readableState;c("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,L(t)}function D(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(k,t,e))}function k(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(c("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function N(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function C(t){c("readable nexttick read 0"),t.read(0)}function x(t,e){c("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),L(t),e.flowing&&!e.reading&&t.read(0)}function L(t){var e=t._readableState;for(c("flow",e.flowing);e.flowing&&null!==t.read(););}function P(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function B(t){var e=t._readableState;c("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,n.nextTick(U,e,t))}function U(t,e){if(c("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function F(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}T.prototype.read=function(t){c("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return c("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?B(this):I(this),null;if(0===(t=j(t,e))&&e.ended)return 0===e.length&&B(this),null;var n,i=e.needReadable;return c("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&c("length less than watermark",i=!0),e.ended||e.reading?c("reading or ended",i=!1):i&&(c("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=j(r,e))),null===(n=t>0?P(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&B(this)),null!==n&&this.emit("data",n),n},T.prototype._read=function(t){E(this,new _("_read()"))},T.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,e);var a=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?u:m;function s(e,n){c("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,c("cleanup"),t.removeListener("close",g),t.removeListener("finish",p),t.removeListener("drain",l),t.removeListener("error",h),t.removeListener("unpipe",s),r.removeListener("end",u),r.removeListener("end",m),r.removeListener("data",d),f=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function u(){c("onend"),t.end()}i.endEmitted?n.nextTick(a):r.once("end",a),t.on("unpipe",s);var l=function(t){return function(){var e=t._readableState;c("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,L(t))}}(r);t.on("drain",l);var f=!1;function d(e){c("ondata");var n=t.write(e);c("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==F(i.pipes,t))&&!f&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function h(e){c("onerror",e),m(),t.removeListener("error",h),0===o(t,"error")&&E(t,e)}function g(){t.removeListener("finish",p),m()}function p(){c("onfinish"),t.removeListener("close",g),m()}function m(){c("unpipe"),r.unpipe(t)}return r.on("data",d),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",h),t.once("close",g),t.once("finish",p),t.emit("pipe",r),i.flowing||(c("pipe resume"),r.resume()),t},T.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=F(e.pipes,t);return-1===a||(e.pipes.splice(a,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},T.prototype.on=function(t,e){var r=a.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?I(this):i.reading||n.nextTick(C,this))),r},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(t,e){var r=a.prototype.removeListener.call(this,t,e);return"readable"===t&&n.nextTick(N,this),r},T.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||n.nextTick(N,this),e},T.prototype.resume=function(){var t=this._readableState;return t.flowing||(c("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,n.nextTick(x,t,e))}(this,t)),t.paused=!1,this},T.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(c("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(c("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<S.length;o++)t.on(S[o],this.emit.bind(this,S[o]));return this._read=function(e){c("wrapped _read",e),n&&(n=!1,t.resume())},this},"function"==typeof Symbol&&(T.prototype[Symbol.asyncIterator]=function(){return void 0===d&&(d=r(357)),d(this)}),Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(T.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(T.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),T._fromList=P,Object.defineProperty(T.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(T.from=function(t,e){return void 0===h&&(h=r(358)),h(T,t,e)})}).call(this,r(24),r(20))},function(t,e,r){t.exports=r(61).EventEmitter},function(t,e,r){"use strict";(function(e){function r(t,e){i(t,e),n(t)}function n(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,o){var a=this,s=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return s||u?(o?o(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(i,this,t)):e.nextTick(i,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!o&&t?a._writableState?a._writableState.errorEmitted?e.nextTick(n,a):(a._writableState.errorEmitted=!0,e.nextTick(r,a,t)):e.nextTick(r,a,t):o?(e.nextTick(n,a),o(t)):e.nextTick(n,a)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}}}).call(this,r(20))},function(t,e,r){"use strict";var n=r(86).codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,r,i){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},function(t,e,r){"use strict";(function(e,n){function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}var o;t.exports=T,T.WritableState=O;var a={deprecate:r(141)},s=r(212),u=r(14).Buffer,c=e.Uint8Array||function(){};var l,f=r(213),d=r(214).getHighWaterMark,h=r(86).codes,g=h.ERR_INVALID_ARG_TYPE,p=h.ERR_METHOD_NOT_IMPLEMENTED,m=h.ERR_MULTIPLE_CALLBACK,y=h.ERR_STREAM_CANNOT_PIPE,b=h.ERR_STREAM_DESTROYED,w=h.ERR_STREAM_NULL_VALUES,_=h.ERR_STREAM_WRITE_AFTER_END,v=h.ERR_UNKNOWN_ENCODING,E=f.errorOrDestroy;function S(){}function O(t,e,a){o=o||r(87),t=t||{},"boolean"!=typeof a&&(a=e instanceof o),this.objectMode=!!t.objectMode,a&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=d(this,t,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===t.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,o=r.writecb;if("function"!=typeof o)throw new m;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,o){--e.pendingcb,r?(n.nextTick(o,i),n.nextTick(D,t,e),t._writableState.errorEmitted=!0,E(t,i)):(o(i),t._writableState.errorEmitted=!0,E(t,i),D(t,e))}(t,r,i,e,o);else{var a=I(r)||t.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||j(t,r),i?n.nextTick(M,t,r,a,o):M(t,r,a,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function T(t){var e=this instanceof(o=o||r(87));if(!e&&!l.call(T,this))return new T(t);this._writableState=new O(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),s.call(this)}function A(t,e,r,n,i,o,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new b("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function M(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),D(t,e)}function j(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,o=new Array(n),a=e.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)o[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;o.allBuffers=u,A(t,e,!0,e.length,o,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,f=r.callback;if(A(t,e,!1,e.objectMode?1:c.length,c,l,f),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function I(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function R(t,e){t._final((function(r){e.pendingcb--,r&&E(t,r),e.prefinished=!0,t.emit("prefinish"),D(t,e)}))}function D(t,e){var r=I(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,n.nextTick(R,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}r(11)(T,s),O.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(O.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(T,Symbol.hasInstance,{value:function(t){return!!l.call(this,t)||this===T&&(t&&t._writableState instanceof O)}})):l=function(t){return t instanceof this},T.prototype.pipe=function(){E(this,new y)},T.prototype.write=function(t,e,r){var i,o=this._writableState,a=!1,s=!o.objectMode&&(i=t,u.isBuffer(i)||i instanceof c);return s&&!u.isBuffer(t)&&(t=function(t){return u.from(t)}(t)),"function"==typeof e&&(r=e,e=null),s?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof r&&(r=S),o.ending?function(t,e){var r=new _;E(t,r),n.nextTick(e,r)}(this,r):(s||function(t,e,r,i){var o;return null===r?o=new w:"string"==typeof r||e.objectMode||(o=new g("chunk",["string","Buffer"],r)),!o||(E(t,o),n.nextTick(i,o),!1)}(this,o,t,r))&&(o.pendingcb++,a=function(t,e,r,n,i,o){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=u.from(e,r));return e}(e,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=e.objectMode?1:n.length;e.length+=s;var c=e.length<e.highWaterMark;c||(e.needDrain=!0);if(e.writing||e.corked){var l=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},l?l.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else A(t,e,!1,s,n,i,o);return c}(this,o,s,t,e,r)),a},T.prototype.cork=function(){this._writableState.corked++},T.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||j(this,t))},T.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new v(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),T.prototype._write=function(t,e,r){r(new p("_write()"))},T.prototype._writev=null,T.prototype.end=function(t,e,r){var i=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,D(t,e),r&&(e.finished?n.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),T.prototype.destroy=f.destroy,T.prototype._undestroy=f.undestroy,T.prototype._destroy=function(t,e){e(t)}}).call(this,r(24),r(20))},function(t,e,r){"use strict";t.exports=l;var n=r(86).codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(87);function c(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function l(t){if(!(this instanceof l))return new l(t);u.call(this,t),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",f)}function f(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?d(this,null,null):this._flush((function(e,r){d(t,e,r)}))}function d(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new s;if(t._transformState.transforming)throw new a;return t.push(null)}r(11)(l,u),l.prototype.push=function(t,e){return this._transformState.needTransform=!1,u.prototype.push.call(this,t,e)},l.prototype._transform=function(t,e,r){r(new i("_transform()"))},l.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},l.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},l.prototype._destroy=function(t,e){u.prototype._destroy.call(this,t,(function(t){e(t)}))}},function(t,e,r){"use strict";var n=e;function i(t){return 1===t.length?"0"+t:t}function o(t){for(var e="",r=0;r<t.length;r++)e+=i(t[r].toString(16));return e}n.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var n=0;n<t.length;n++)r[n]=0|t[n];return r}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(n=0;n<t.length;n++){var i=t.charCodeAt(n),o=i>>8,a=255&i;o?r.push(o,a):r.push(a)}return r},n.zero2=i,n.toHex=o,n.encode=function(t,e){return"hex"===e?o(t):t}},function(t,e,r){"use strict";var n=e;n.base=r(113),n.short=r(365),n.mont=r(366),n.edwards=r(367)},function(t,e,r){"use strict";var n=r(51).rotr32;function i(t,e,r){return t&e^~t&r}function o(t,e,r){return t&e^t&r^e&r}function a(t,e,r){return t^e^r}e.ft_1=function(t,e,r,n){return 0===t?i(e,r,n):1===t||3===t?a(e,r,n):2===t?o(e,r,n):void 0},e.ch32=i,e.maj32=o,e.p32=a,e.s0_256=function(t){return n(t,2)^n(t,13)^n(t,22)},e.s1_256=function(t){return n(t,6)^n(t,11)^n(t,25)},e.g0_256=function(t){return n(t,7)^n(t,18)^t>>>3},e.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},function(t,e,r){"use strict";var n=r(51),i=r(101),o=r(219),a=r(42),s=n.sum32,u=n.sum32_4,c=n.sum32_5,l=o.ch32,f=o.maj32,d=o.s0_256,h=o.s1_256,g=o.g0_256,p=o.g1_256,m=i.BlockHash,y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function b(){if(!(this instanceof b))return new b;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}n.inherits(b,m),t.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=u(p(r[n-2]),r[n-7],g(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],m=this.h[2],y=this.h[3],b=this.h[4],w=this.h[5],_=this.h[6],v=this.h[7];for(a(this.k.length===r.length),n=0;n<r.length;n++){var E=c(v,h(b),l(b,w,_),this.k[n],r[n]),S=s(d(i),f(i,o,m));v=_,_=w,w=b,b=s(y,E),y=m,m=o,o=i,i=s(E,S)}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],m),this.h[3]=s(this.h[3],y),this.h[4]=s(this.h[4],b),this.h[5]=s(this.h[5],w),this.h[6]=s(this.h[6],_),this.h[7]=s(this.h[7],v)},b.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(t,e,r){"use strict";var n=r(51),i=r(101),o=r(42),a=n.rotr64_hi,s=n.rotr64_lo,u=n.shr64_hi,c=n.shr64_lo,l=n.sum64,f=n.sum64_hi,d=n.sum64_lo,h=n.sum64_4_hi,g=n.sum64_4_lo,p=n.sum64_5_hi,m=n.sum64_5_lo,y=i.BlockHash,b=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function w(){if(!(this instanceof w))return new w;y.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=b,this.W=new Array(160)}function _(t,e,r,n,i){var o=t&r^~t&i;return o<0&&(o+=4294967296),o}function v(t,e,r,n,i,o){var a=e&n^~e&o;return a<0&&(a+=4294967296),a}function E(t,e,r,n,i){var o=t&r^t&i^r&i;return o<0&&(o+=4294967296),o}function S(t,e,r,n,i,o){var a=e&n^e&o^n&o;return a<0&&(a+=4294967296),a}function O(t,e){var r=a(t,e,28)^a(e,t,2)^a(e,t,7);return r<0&&(r+=4294967296),r}function T(t,e){var r=s(t,e,28)^s(e,t,2)^s(e,t,7);return r<0&&(r+=4294967296),r}function A(t,e){var r=a(t,e,14)^a(t,e,18)^a(e,t,9);return r<0&&(r+=4294967296),r}function M(t,e){var r=s(t,e,14)^s(t,e,18)^s(e,t,9);return r<0&&(r+=4294967296),r}function j(t,e){var r=a(t,e,1)^a(t,e,8)^u(t,e,7);return r<0&&(r+=4294967296),r}function I(t,e){var r=s(t,e,1)^s(t,e,8)^c(t,e,7);return r<0&&(r+=4294967296),r}function R(t,e){var r=a(t,e,19)^a(e,t,29)^u(t,e,6);return r<0&&(r+=4294967296),r}function D(t,e){var r=s(t,e,19)^s(e,t,29)^c(t,e,6);return r<0&&(r+=4294967296),r}n.inherits(w,y),t.exports=w,w.blockSize=1024,w.outSize=512,w.hmacStrength=192,w.padLength=128,w.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n<r.length;n+=2){var i=R(r[n-4],r[n-3]),o=D(r[n-4],r[n-3]),a=r[n-14],s=r[n-13],u=j(r[n-30],r[n-29]),c=I(r[n-30],r[n-29]),l=r[n-32],f=r[n-31];r[n]=h(i,o,a,s,u,c,l,f),r[n+1]=g(i,o,a,s,u,c,l,f)}},w.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,n=this.h[0],i=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],h=this.h[6],g=this.h[7],y=this.h[8],b=this.h[9],w=this.h[10],j=this.h[11],I=this.h[12],R=this.h[13],D=this.h[14],k=this.h[15];o(this.k.length===r.length);for(var N=0;N<r.length;N+=2){var C=D,x=k,L=A(y,b),P=M(y,b),B=_(y,b,w,j,I),U=v(y,b,w,j,I,R),F=this.k[N],W=this.k[N+1],H=r[N],q=r[N+1],z=p(C,x,L,P,B,U,F,W,H,q),V=m(C,x,L,P,B,U,F,W,H,q);C=O(n,i),x=T(n,i),L=E(n,i,a,s,u),P=S(n,i,a,s,u,c);var Y=f(C,x,L,P),G=d(C,x,L,P);D=I,k=R,I=w,R=j,w=y,j=b,y=f(h,g,z,V),b=d(g,g,z,V),h=u,g=c,u=a,c=s,a=n,s=i,n=f(z,V,Y,G),i=d(z,V,Y,G)}l(this.h,0,n,i),l(this.h,2,a,s),l(this.h,4,u,c),l(this.h,6,h,g),l(this.h,8,y,b),l(this.h,10,w,j),l(this.h,12,I,R),l(this.h,14,D,k)},w.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(t,e,r){(function(t){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(382).Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function c(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u<s;u++){var c=t.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function l(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,l=r;l<s;l+=n)u=c(t,l,l+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var f=1;for(u=c(t,l,t.length,e),l=0;l<a;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype._move=function(t){l(t,this)},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&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)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(t){o.prototype.inspect=f}else o.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","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],g=[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(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);r=0!==(o=s>>>24-i&16777215)||a!==this.length-1?d[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=h[t],l=g[t];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var p=f.modrn(l).toString(t);r=(f=f.idivn(l)).isZero()?p+r:d[c-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%e!=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 t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(a,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c<n;c++){for(var l=u>>>26,f=67108863&u,d=Math.min(c,e.length-1),h=Math.max(0,c-t.length+1);h<=d;h++){var g=c-h|0;l+=(a=(i=0|t.words[g])*(o=0|e.words[h])+f)/67108864|0,f=67108863&a}r.words[c]=0|f,u=0|l}return 0!==u?r.words[c]=0|u:r.length--,r._strip()}o.prototype.toArrayLike=function(t,e,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(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|n;t[r++]=255&a,r<t.length&&(t[r++]=a>>8&255),r<t.length&&(t[r++]=a>>16&255),6===o?(r<t.length&&(t[r++]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},o.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|n;t[r--]=255&a,r>=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a<n.length;a++)o=(e=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,a=t.words,s=e.words,u=r.words,c=0,l=0|a[0],f=8191&l,d=l>>>13,h=0|a[1],g=8191&h,p=h>>>13,m=0|a[2],y=8191&m,b=m>>>13,w=0|a[3],_=8191&w,v=w>>>13,E=0|a[4],S=8191&E,O=E>>>13,T=0|a[5],A=8191&T,M=T>>>13,j=0|a[6],I=8191&j,R=j>>>13,D=0|a[7],k=8191&D,N=D>>>13,C=0|a[8],x=8191&C,L=C>>>13,P=0|a[9],B=8191&P,U=P>>>13,F=0|s[0],W=8191&F,H=F>>>13,q=0|s[1],z=8191&q,V=q>>>13,Y=0|s[2],G=8191&Y,$=Y>>>13,K=0|s[3],Z=8191&K,J=K>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ft=8191&lt,dt=lt>>>13,ht=0|s[9],gt=8191&ht,pt=ht>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(c+(n=Math.imul(f,W))|0)+((8191&(i=(i=Math.imul(f,H))+Math.imul(d,W)|0))<<13)|0;c=((o=Math.imul(d,H))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(g,W),i=(i=Math.imul(g,H))+Math.imul(p,W)|0,o=Math.imul(p,H);var yt=(c+(n=n+Math.imul(f,z)|0)|0)+((8191&(i=(i=i+Math.imul(f,V)|0)+Math.imul(d,z)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,W),i=(i=Math.imul(y,H))+Math.imul(b,W)|0,o=Math.imul(b,H),n=n+Math.imul(g,z)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(p,z)|0,o=o+Math.imul(p,V)|0;var bt=(c+(n=n+Math.imul(f,G)|0)|0)+((8191&(i=(i=i+Math.imul(f,$)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,$)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(_,W),i=(i=Math.imul(_,H))+Math.imul(v,W)|0,o=Math.imul(v,H),n=n+Math.imul(y,z)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,z)|0,o=o+Math.imul(b,V)|0,n=n+Math.imul(g,G)|0,i=(i=i+Math.imul(g,$)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,$)|0;var wt=(c+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,W),i=(i=Math.imul(S,H))+Math.imul(O,W)|0,o=Math.imul(O,H),n=n+Math.imul(_,z)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,z)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(y,G)|0,i=(i=i+Math.imul(y,$)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,$)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,J)|0)+Math.imul(p,Z)|0,o=o+Math.imul(p,J)|0;var _t=(c+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(A,W),i=(i=Math.imul(A,H))+Math.imul(M,W)|0,o=Math.imul(M,H),n=n+Math.imul(S,z)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(O,z)|0,o=o+Math.imul(O,V)|0,n=n+Math.imul(_,G)|0,i=(i=i+Math.imul(_,$)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,$)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,J)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var vt=(c+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(d,rt)|0))<<13)|0;c=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(I,W),i=(i=Math.imul(I,H))+Math.imul(R,W)|0,o=Math.imul(R,H),n=n+Math.imul(A,z)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(M,z)|0,o=o+Math.imul(M,V)|0,n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,$)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,$)|0,n=n+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,J)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,J)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,nt)|0;var Et=(c+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(k,W),i=(i=Math.imul(k,H))+Math.imul(N,W)|0,o=Math.imul(N,H),n=n+Math.imul(I,z)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(R,z)|0,o=o+Math.imul(R,V)|0,n=n+Math.imul(A,G)|0,i=(i=i+Math.imul(A,$)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,$)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,J)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,J)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(c+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(x,W),i=(i=Math.imul(x,H))+Math.imul(L,W)|0,o=Math.imul(L,H),n=n+Math.imul(k,z)|0,i=(i=i+Math.imul(k,V)|0)+Math.imul(N,z)|0,o=o+Math.imul(N,V)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,$)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,$)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,J)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(_,rt)|0,i=(i=i+Math.imul(_,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,n=n+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ct)|0;var Ot=(c+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,dt)|0)+Math.imul(d,ft)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(B,W),i=(i=Math.imul(B,H))+Math.imul(U,W)|0,o=Math.imul(U,H),n=n+Math.imul(x,z)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(L,z)|0,o=o+Math.imul(L,V)|0,n=n+Math.imul(k,G)|0,i=(i=i+Math.imul(k,$)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,$)|0,n=n+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,J)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,n=n+Math.imul(g,ft)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,dt)|0;var Tt=(c+(n=n+Math.imul(f,gt)|0)|0)+((8191&(i=(i=i+Math.imul(f,pt)|0)+Math.imul(d,gt)|0))<<13)|0;c=((o=o+Math.imul(d,pt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(B,z),i=(i=Math.imul(B,V))+Math.imul(U,z)|0,o=Math.imul(U,V),n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,$)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,$)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,at)|0,n=n+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,dt)|0;var At=(c+(n=n+Math.imul(g,gt)|0)|0)+((8191&(i=(i=i+Math.imul(g,pt)|0)+Math.imul(p,gt)|0))<<13)|0;c=((o=o+Math.imul(p,pt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(B,G),i=(i=Math.imul(B,$))+Math.imul(U,G)|0,o=Math.imul(U,$),n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,J)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ct)|0,n=n+Math.imul(_,ft)|0,i=(i=i+Math.imul(_,dt)|0)+Math.imul(v,ft)|0,o=o+Math.imul(v,dt)|0;var Mt=(c+(n=n+Math.imul(y,gt)|0)|0)+((8191&(i=(i=i+Math.imul(y,pt)|0)+Math.imul(b,gt)|0))<<13)|0;c=((o=o+Math.imul(b,pt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(B,Z),i=(i=Math.imul(B,J))+Math.imul(U,Z)|0,o=Math.imul(U,J),n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,at)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,n=n+Math.imul(S,ft)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,dt)|0;var jt=(c+(n=n+Math.imul(_,gt)|0)|0)+((8191&(i=(i=i+Math.imul(_,pt)|0)+Math.imul(v,gt)|0))<<13)|0;c=((o=o+Math.imul(v,pt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,n=Math.imul(B,Q),i=(i=Math.imul(B,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ct)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,dt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,dt)|0;var It=(c+(n=n+Math.imul(S,gt)|0)|0)+((8191&(i=(i=i+Math.imul(S,pt)|0)+Math.imul(O,gt)|0))<<13)|0;c=((o=o+Math.imul(O,pt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(B,rt),i=(i=Math.imul(B,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,dt)|0;var Rt=(c+(n=n+Math.imul(A,gt)|0)|0)+((8191&(i=(i=i+Math.imul(A,pt)|0)+Math.imul(M,gt)|0))<<13)|0;c=((o=o+Math.imul(M,pt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ct)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,dt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,dt)|0;var Dt=(c+(n=n+Math.imul(I,gt)|0)|0)+((8191&(i=(i=i+Math.imul(I,pt)|0)+Math.imul(R,gt)|0))<<13)|0;c=((o=o+Math.imul(R,pt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,n=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(U,ut)|0,o=Math.imul(U,ct),n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(L,ft)|0,o=o+Math.imul(L,dt)|0;var kt=(c+(n=n+Math.imul(k,gt)|0)|0)+((8191&(i=(i=i+Math.imul(k,pt)|0)+Math.imul(N,gt)|0))<<13)|0;c=((o=o+Math.imul(N,pt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(B,ft),i=(i=Math.imul(B,dt))+Math.imul(U,ft)|0,o=Math.imul(U,dt);var Nt=(c+(n=n+Math.imul(x,gt)|0)|0)+((8191&(i=(i=i+Math.imul(x,pt)|0)+Math.imul(L,gt)|0))<<13)|0;c=((o=o+Math.imul(L,pt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var Ct=(c+(n=Math.imul(B,gt))|0)+((8191&(i=(i=Math.imul(B,pt))+Math.imul(U,gt)|0))<<13)|0;return c=((o=Math.imul(U,pt))+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=yt,u[2]=bt,u[3]=wt,u[4]=_t,u[5]=vt,u[6]=Et,u[7]=St,u[8]=Ot,u[9]=Tt,u[10]=At,u[11]=Mt,u[12]=jt,u[13]=It,u[14]=Rt,u[15]=Dt,u[16]=kt,u[17]=Nt,u[18]=Ct,0!==c&&(u[19]=c,r.length++),r};function y(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var a=i;i=0;for(var s=67108863&n,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,f=(0|t.words[l])*(0|e.words[c]),d=67108863&f;s=67108863&(d=d+s|0),i+=(a=(a=a+(f/67108864|0)|0)+(d>>>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(t,e,r){return y(t,e,r)}function w(t,e){this.x=t,this.y=e}Math.imul||(m=p),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?y(this,t,e):b(this,t,e)},w.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},w.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},w.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a<o;a++)n[a]=e[t[a]],i[a]=r[t[a]]},w.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var f=u,d=c,h=0;h<a;h++){var g=r[l+h],p=n[l+h],m=r[l+h+a],y=n[l+h+a],b=f*m-d*y;y=f*y+d*m,m=b,r[l+h]=g+m,n[l+h]=p+y,r[l+h+a]=g-m,n[l+h+a]=p-y,h!==s&&(b=u*f-c*d,d=u*d+c*f,f=b)}},w.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},w.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},w.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},w.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},w.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},w.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),u=new Array(n),c=new Array(n),l=new Array(n),f=new Array(n),d=r.words;d.length=n,this.convert13b(t.words,t.length,a,n),this.convert13b(e.words,e.length,c,n),this.transform(a,o,s,u,n,i),this.transform(c,o,l,f,n,i);for(var h=0;h<n;h++){var g=s[h]*l[h]-u[h]*f[h];u[h]=s[h]*f[h]+u[h]*l[h],s[h]=g}return this.conjugate(s,u,n),this.transform(s,u,d,o,n,i),this.conjugate(d,o,n),this.normalize13b(d,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r._strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),b(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var f=0|this.words[c];this.words[c]=l<<26-o|f>>>o,l=f&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r)&&!!(this.words[r]&i)},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,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"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=n.clone()._ishlnsubmul(i,1,u);0===l.negative&&(n=l,s&&(s.words[u]=1));for(var f=u-1;f>=0;f--){var d=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=d)}return s&&s._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),f=e.clone();!e.isZero();){for(var d=0,h=1;0==(e.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(f)),i.iushrn(1),a.iushrn(1);for(var g=0,p=1;0==(r.words[0]&p)&&g<26;++g,p<<=1);if(g>0)for(r.iushrn(g);g-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(f)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(u)):(r.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var f=0,d=1;0==(r.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>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(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new A(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},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(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var _={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function E(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function O(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function T(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){A.call(this,t),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)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(E,v),E.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n<r;n++)e.words[n]=t.words[n];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},E.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(S,v),i(O,v),i(T,v),T.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(_[t])return _[t];var e;if("k256"===t)e=new E;else if("p224"===t)e=new S;else if("p192"===t)e=new O;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new T}return _[t]=e,e},A.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(l(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,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),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,i),d=this.pow(t,i.addn(1).iushrn(1)),h=this.pow(t,i),g=a;0!==h.cmp(s);){for(var p=h,m=0;0!==p.cmp(s);m++)p=p.redSqr();n(m<g);var y=this.pow(f,new o(1).iushln(g-m-1));d=d.redMul(y),f=y.redSqr(),h=h.redMul(f),g=m}return d},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],l=u-1;l>=0;l--){var f=c>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===n&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}u=26}return i},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,A),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),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)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(95)(t))},function(t,e,r){"use strict";const n=e;n.bignum=r(35),n.define=r(384).define,n.base=r(387),n.constants=r(388),n.decoders=r(226),n.encoders=r(224)},function(t,e,r){"use strict";const n=e;n.der=r(225),n.pem=r(385)},function(t,e,r){"use strict";const n=r(11),i=r(155).Buffer,o=r(156),a=r(158);function s(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new u,this.tree._init(t.body)}function u(t){o.call(this,"der",t)}function c(t){return t<10?"0"+t:t}t.exports=s,s.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},n(u,o),u.prototype._encodeComposite=function(t,e,r,n){const o=function(t,e,r,n){let i;"seqof"===t?t="seq":"setof"===t&&(t="set");if(a.tagByName.hasOwnProperty(t))i=a.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return n.error("Unknown tag: "+t);i=t}if(i>=31)return n.error("Multi-octet tag encoding unsupported");e||(i|=32);return i|=a.tagClassByName[r||"universal"]<<6,i}(t,e,r,this.reporter);if(n.length<128){const t=i.alloc(2);return t[0]=o,t[1]=n.length,this._createEncoderBuffer([t,n])}let s=1;for(let t=n.length;t>=256;t>>=8)s++;const u=i.alloc(2+s);u[0]=o,u[1]=128|s;for(let t=1+s,e=n.length;e>0;t--,e>>=8)u[t]=255&e;return this._createEncoderBuffer([u,n])},u.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){const e=i.alloc(2*t.length);for(let r=0;r<t.length;r++)e.writeUInt16BE(t.charCodeAt(r),2*r);return this._createEncoderBuffer(e)}return"numstr"===e?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===e?this._isPrintstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(e)||"objDesc"===e?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+e+" unsupported")},u.prototype._encodeObjid=function(t,e,r){if("string"==typeof t){if(!e)return this.reporter.error("string objid given, but no values map found");if(!e.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=e[t].split(/[\s.]+/g);for(let e=0;e<t.length;e++)t[e]|=0}else if(Array.isArray(t)){t=t.slice();for(let e=0;e<t.length;e++)t[e]|=0}if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!r){if(t[1]>=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let n=0;for(let e=0;e<t.length;e++){let r=t[e];for(n++;r>=128;r>>=7)n++}const o=i.alloc(n);let a=o.length-1;for(let e=t.length-1;e>=0;e--){let r=t[e];for(o[a--]=127&r;(r>>=7)>0;)o[a--]=128|127&r}return this._createEncoderBuffer(o)},u.prototype._encodeTime=function(t,e){let r;const n=new Date(t);return"gentime"===e?r=[c(n.getUTCFullYear()),c(n.getUTCMonth()+1),c(n.getUTCDate()),c(n.getUTCHours()),c(n.getUTCMinutes()),c(n.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[c(n.getUTCFullYear()%100),c(n.getUTCMonth()+1),c(n.getUTCDate()),c(n.getUTCHours()),c(n.getUTCMinutes()),c(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},u.prototype._encodeNull=function(){return this._createEncoderBuffer("")},u.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!i.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=i.from(e)}if(i.isBuffer(t)){let e=t.length;0===t.length&&e++;const r=i.alloc(e);return t.copy(r),0===t.length&&(r[0]=0),this._createEncoderBuffer(r)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let r=1;for(let e=t;e>=256;e>>=8)r++;const n=new Array(r);for(let e=n.length-1;e>=0;e--)n[e]=255&t,t>>=8;return 128&n[0]&&n.unshift(0),this._createEncoderBuffer(i.from(n))},u.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},u.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},u.prototype._skipDefault=function(t,e,r){const n=this._baseState;let i;if(null===n.default)return!1;const o=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==n.defaultBuffer[i])return!1;return!0}},function(t,e,r){"use strict";const n=e;n.der=r(227),n.pem=r(386)},function(t,e,r){"use strict";const n=r(11),i=r(35),o=r(102).DecoderBuffer,a=r(156),s=r(158);function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new c,this.tree._init(t.body)}function c(t){a.call(this,"der",t)}function l(t,e){let r=t.readUInt8(e);if(t.isError(r))return r;const n=s.tagClass[r>>6],i=0==(32&r);if(31==(31&r)){let n=r;for(r=0;128==(128&n);){if(n=t.readUInt8(e),t.isError(n))return n;r<<=7,r|=127&n}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:s.tag[r]}}function f(t,e,r){let n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&128===n)return null;if(0==(128&n))return n;const i=127&n;if(i>4)return t.error("length octect is too long");n=0;for(let e=0;e<i;e++){n<<=8;const e=t.readUInt8(r);if(t.isError(e))return e;n|=e}return n}t.exports=u,u.prototype.decode=function(t,e){return o.isDecoderBuffer(t)||(t=new o(t,e)),this.tree._decode(t,e)},n(c,a),c.prototype._peekTag=function(t,e,r){if(t.isEmpty())return!1;const n=t.save(),i=l(t,'Failed to peek tag: "'+e+'"');return t.isError(i)?i:(t.restore(n),i.tag===e||i.tagStr===e||i.tagStr+"of"===e||r)},c.prototype._decodeTag=function(t,e,r){const n=l(t,'Failed to decode tag of "'+e+'"');if(t.isError(n))return n;let i=f(t,n.primitive,'Failed to get length of "'+e+'"');if(t.isError(i))return i;if(!r&&n.tag!==e&&n.tagStr!==e&&n.tagStr+"of"!==e)return t.error('Failed to match tag: "'+e+'"');if(n.primitive||null!==i)return t.skip(i,'Failed to match body of: "'+e+'"');const o=t.save(),a=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(a)?a:(i=t.offset-o.offset,t.restore(o),t.skip(i,'Failed to match body of: "'+e+'"'))},c.prototype._skipUntilEnd=function(t,e){for(;;){const r=l(t,e);if(t.isError(r))return r;const n=f(t,r.primitive,e);if(t.isError(n))return n;let i;if(i=r.primitive||null!==n?t.skip(n):this._skipUntilEnd(t,e),t.isError(i))return i;if("end"===r.tagStr)break}},c.prototype._decodeList=function(t,e,r,n){const i=[];for(;!t.isEmpty();){const e=this._peekTag(t,"end");if(t.isError(e))return e;const o=r.decode(t,"der",n);if(t.isError(o)&&e)break;i.push(o)}return i},c.prototype._decodeStr=function(t,e){if("bitstr"===e){const e=t.readUInt8();return t.isError(e)?e:{unused:e,data:t.raw()}}if("bmpstr"===e){const e=t.raw();if(e.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");let r="";for(let t=0;t<e.length/2;t++)r+=String.fromCharCode(e.readUInt16BE(2*t));return r}if("numstr"===e){const e=t.raw().toString("ascii");return this._isNumstr(e)?e:t.error("Decoding of string type: numstr unsupported characters")}if("octstr"===e)return t.raw();if("objDesc"===e)return t.raw();if("printstr"===e){const e=t.raw().toString("ascii");return this._isPrintstr(e)?e:t.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(e)?t.raw().toString():t.error("Decoding of string type: "+e+" unsupported")},c.prototype._decodeObjid=function(t,e,r){let n;const i=[];let o=0,a=0;for(;!t.isEmpty();)a=t.readUInt8(),o<<=7,o|=127&a,0==(128&a)&&(i.push(o),o=0);128&a&&i.push(o);const s=i[0]/40|0,u=i[0]%40;if(n=r?i:[s,u].concat(i.slice(1)),e){let t=e[n.join(" ")];void 0===t&&(t=e[n.join(".")]),void 0!==t&&(n=t)}return n},c.prototype._decodeTime=function(t,e){const r=t.raw().toString();let n,i,o,a,s,u;if("gentime"===e)n=0|r.slice(0,4),i=0|r.slice(4,6),o=0|r.slice(6,8),a=0|r.slice(8,10),s=0|r.slice(10,12),u=0|r.slice(12,14);else{if("utctime"!==e)return t.error("Decoding "+e+" time is not supported yet");n=0|r.slice(0,2),i=0|r.slice(2,4),o=0|r.slice(4,6),a=0|r.slice(6,8),s=0|r.slice(8,10),u=0|r.slice(10,12),n=n<70?2e3+n:1900+n}return Date.UTC(n,i-1,o,a,s,u,0)},c.prototype._decodeNull=function(){return null},c.prototype._decodeBool=function(t){const e=t.readUInt8();return t.isError(e)?e:0!==e},c.prototype._decodeInt=function(t,e){const r=t.raw();let n=new i(r);return e&&(n=e[n.toString(10)]||n),n},c.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getDecoder("der").tree}},function(t){t.exports=JSON.parse('{"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"}')},function(t,e,r){var n=r(99),i=r(17).Buffer;function o(t){var e=i.allocUnsafe(4);return e.writeUInt32BE(t,0),e}t.exports=function(t,e){for(var r,a=i.alloc(0),s=0;a.length<e;)r=o(s++),a=i.concat([a,n("sha1").update(t).update(r).digest()]);return a.slice(0,e)}},function(t,e){t.exports=function(t,e){for(var r=t.length,n=-1;++n<r;)t[n]^=e[n];return t}},function(t,e,r){var n=r(35),i=r(17).Buffer;t.exports=function(t,e){return i.from(t.toRed(n.mont(e.modulus)).redPow(new n(e.publicExponent)).fromRed().toArray())}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(31);let i=r(159);async function o(){return(await n.a.randomBytes(12)).toString()}async function a(t){let e=new i.Message;e.setDataset(await o()),e.setRow(await o()),e.setColumn(await o()),e.setValue(await o());let r=e.serializeBinary();return await n.a.encrypt(r,t)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return f}));var n=r(25),i=r(10),o=r.n(i),a=r(33),s=r(1),u=r(6),c=r(7);const l=r(49);async function f(t){if(!t){let t=await a.a(),e=t.valid,r=t.error;if(r)return{error:r};if(!e)return{error:{reason:"file-has-new-key"}}}let e=(await a.h(t)).error;if(e)return{error:e};if(await Object(u.runMutator)(async()=>{await s.execQuery("\n DELETE FROM messages_crdt;\n DELETE FROM messages_clock;\n DELETE FROM transactions WHERE tombstone = 1;\n DELETE FROM accounts WHERE tombstone = 1;\n DELETE FROM payees WHERE tombstone = 1;\n DELETE FROM categories WHERE tombstone = 1;\n DELETE FROM category_groups WHERE tombstone = 1;\n DELETE FROM schedules WHERE tombstone = 1;\n DELETE FROM rules WHERE tombstone = 1;\n ANALYZE;\n VACUUM;\n "),await s.loadClock()}),await c.d({groupId:null,lastSyncedTimestamp:null,lastUploaded:null}),t){let e=t.key,r=c.b().cloudFileId,n=JSON.parse(await o.a.getItem("encrypt-keys")||"{}");n[r]=e.serialize(),await o.a.setItem("encrypt-keys",JSON.stringify(n)),await c.d({encryptKeyId:e.getId()})}try{await a.i()}catch(t){return t.reason?{error:t}:(Object(n.captureException)(t),{error:{reason:"upload-failure"}})}finally{l.send("prefs-updated")}return{}}},function(t,e,r){(function(e){const n=r(103),i=r(50),o=r(237),a=r(421),s=(t,e)=>"boolean"==typeof t?t:e,u=(t,e)=>"string"==typeof t?t:e,c={noSort:!1,readEntries:!1,method:n.Constants.NONE,fs:null};t.exports=function(t,r){let l=null;const f=Object.assign(Object.create(null),c);t&&"object"==typeof t&&(t instanceof Uint8Array||(Object.assign(f,t),t=f.input?f.input:void 0,f.input&&delete f.input),e.isBuffer(t)&&(l=t,f.method=n.Constants.BUFFER,t=void 0)),Object.assign(f,r);const d=new n(f);if(t&&"string"==typeof t){if(!d.fs.existsSync(t))throw new Error(n.Errors.INVALID_FILENAME);f.method=n.Constants.FILE,f.filename=t,l=d.fs.readFileSync(t)}const h=new a(l,f),g=n.canonical,p=n.sanitize;function m(t){var e;if(t&&h&&("string"==typeof t&&(e=h.getEntry(t)),"object"==typeof t&&void 0!==t.entryName&&void 0!==t.header&&(e=h.getEntry(t.entryName)),e))return e;return null}function y(t){const e=i.posix,r=e.join,n=e.normalize,o=e.sep;return r(".",n(o+t.split("\\").join(o)+o))}return{readFile:function(t,e){var r=m(t);return r&&r.getData(e)||null},readFileAsync:function(t,e){var r=m(t);r?r.getDataAsync(e):e(null,"getEntry failed for:"+t)},readAsText:function(t,e){var r=m(t);if(r){var n=r.getData();if(n&&n.length)return n.toString(e||"utf8")}return""},readAsTextAsync:function(t,e,r){var n=m(t);n?n.getDataAsync((function(t,n){n?e(t,n):t&&t.length?e(t.toString(r||"utf8")):e("")})):e("")},deleteFile:function(t){var e=m(t);e&&h.deleteEntry(e.entryName)},addZipComment:function(t){h.comment=t},getZipComment:function(){return h.comment||""},addZipEntryComment:function(t,e){var r=m(t);r&&(r.comment=e)},getZipEntryComment:function(t){var e=m(t);return e&&e.comment||""},updateFile:function(t,e){var r=m(t);r&&r.setData(e)},addLocalFile:function(t,e,r,i){if(!d.fs.existsSync(t))throw new Error(n.Errors.FILE_NOT_FOUND.replace("%s",t));{e=e?y(e):"";var o=t.split("\\").join("/").split("/").pop();e+=r||o;const n=d.fs.statSync(t);this.addFile(e,d.fs.readFileSync(t),i,n)}},addLocalFolder:function(t,r,o){var a;if(o instanceof RegExp?(a=o,o=function(t){return a.test(t)}):"function"!=typeof o&&(o=function(){return!0}),r=r?y(r):"",t=i.normalize(t),!d.fs.existsSync(t))throw new Error(n.Errors.FILE_NOT_FOUND.replace("%s",t));{const n=d.findFiles(t),a=this;n.length&&n.forEach((function(n){var s=i.relative(t,n).split("\\").join("/");if(o(s)){var u=d.fs.statSync(n);u.isFile()?a.addFile(r+s,d.fs.readFileSync(n),"",u):a.addFile(r+s+"/",e.alloc(0),"",u)}}))}},addLocalFolderAsync:function(t,r,o,a){var s;a instanceof RegExp?(s=a,a=function(t){return s.test(t)}):"function"!=typeof a&&(a=function(){return!0}),o=o?y(o):"",t=i.normalize(t);var u=this;d.fs.open(t,"r",(function(s){if(s&&"ENOENT"===s.code)r(void 0,n.Errors.FILE_NOT_FOUND.replace("%s",t));else if(s)r(void 0,s);else{var c=d.findFiles(t),l=-1,f=function(){if((l+=1)<c.length){var n=c[l],s=i.relative(t,n).split("\\").join("/");s=s.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),a(s)?d.fs.stat(n,(function(t,i){t&&r(void 0,t),i.isFile()?d.fs.readFile(n,(function(t,e){t?r(void 0,t):(u.addFile(o+s,e,"",i),f())})):(u.addFile(o+s+"/",e.alloc(0),"",i),f())})):f()}else r(!0,void 0)};f()}}))},addLocalFolderPromise:function(t,e){return new Promise((r,n)=>{const i=Object.assign({},e),o=i.filter,a=i.zipPath;this.addLocalFolderAsync(t,(t,e)=>{e&&n(e),t&&r(this)},a,o)})},addFile:function(t,e,r,i){let a=m(t);const s=null!=a;s||(a=new o,a.entryName=t),a.comment=r||"";const u="object"==typeof i&&i instanceof d.fs.Stats;u&&(a.header.time=i.mtime);var c=a.isDirectory?16:0;if(!n.isWin){let t=a.isDirectory?16384:32768;t|=u?4095&i.mode:"number"==typeof i?4095&i:a.isDirectory?493:420,c=(c|t<<16)>>>0}a.attr=c,a.setData(e),s||h.setEntry(a)},getEntries:function(){return h?h.entries:[]},getEntry:function(t){return m(t)},getEntryCount:function(){return h.getEntryCount()},forEach:function(t){return h.forEach(t)},extractEntryTo:function(t,e,r,o,a,c){o=s(o,!1),a=s(a,!1),r=s(r,!0),c=u(c,u(a,void 0));var l=m(t);if(!l)throw new Error(n.Errors.NO_ENTRY);var f=g(l.entryName),y=p(e,c&&!l.isDirectory?c:r?f:i.basename(f));if(l.isDirectory)return h.getEntryChildren(l).forEach((function(t){if(t.isDirectory)return;var s=t.getData();if(!s)throw new Error(n.Errors.CANT_EXTRACT_FILE);var u=g(t.entryName),c=p(e,r?u:i.basename(u));const l=a?t.header.fileAttr:void 0;d.writeFileTo(c,s,o,l)})),!0;var b=l.getData();if(!b)throw new Error(n.Errors.CANT_EXTRACT_FILE);if(d.fs.existsSync(y)&&!o)throw new Error(n.Errors.CANT_OVERRIDE);const w=a?t.header.fileAttr:void 0;return d.writeFileTo(y,b,o,w),!0},test:function(t){if(!h)return!1;for(var e in h.entries)try{if(e.isDirectory)continue;if(!h.entries[e].getData(t))return!1}catch(t){return!1}return!0},extractAllTo:function(t,e,r,i){if(e=s(e,!1),i=u(r,i),r=s(r,!1),!h)throw new Error(n.Errors.NO_ZIP);h.entries.forEach((function(o){var a=p(t,g(o.entryName.toString()));if(o.isDirectory)return void d.makeDir(a);var s=o.getData(i);if(!s)throw new Error(n.Errors.CANT_EXTRACT_FILE);const u=r?o.header.fileAttr:void 0;d.writeFileTo(a,s,e,u);try{d.fs.utimesSync(a,o.header.time,o.header.time)}catch(t){throw new Error(n.Errors.CANT_EXTRACT_FILE)}}))},extractAllToAsync:function(t,e,r,o){if(o||(o=function(){}),e=s(e,!1),"function"!=typeof r||o||(o=r),r=s(r,!1),!h)return void o(new Error(n.Errors.NO_ZIP));t=i.resolve(t);const a=e=>p(t,i.normalize(g(e.entryName.toString()))),u=(t,e)=>new Error(t+': "'+e+'"'),c=[],l=new Set;h.entries.forEach(t=>{t.isDirectory?c.push(t):l.add(t)});for(const t of c){const e=a(t),n=r?t.header.fileAttr:void 0;try{d.makeDir(e),n&&d.fs.chmodSync(e,n),d.fs.utimesSync(e,t.header.time,t.header.time)}catch(t){o(u("Unable to create folder",e))}}const f=()=>{0===l.size&&o()};for(const a of l.values()){const s=i.normalize(g(a.entryName.toString())),c=p(t,s);a.getDataAsync((function(t,i){if(i)o(new Error(i));else if(t){const n=r?a.header.fileAttr:void 0;d.writeFileToAsync(c,t,e,n,(function(t){t?d.fs.utimes(c,a.header.time,a.header.time,(function(t){t?o(u("Unable to set times",c)):(l.delete(a),f())})):o(u("Unable to write file",c))}))}else o(new Error(n.Errors.CANT_EXTRACT_FILE))}))}f()},writeZip:function(t,e){if(1===arguments.length&&"function"==typeof t&&(e=t,t=""),!t&&f.filename&&(t=f.filename),t){var r=h.compressToBuffer();if(r){var n=d.writeFileTo(t,r,!0);"function"==typeof e&&e(n?null:new Error("failed"),"")}}},writeZipPromise:function(t,e){const r=Object.assign({overwrite:!0},e),n=r.overwrite,i=r.perm;return new Promise((e,r)=>{!t&&f.filename&&(t=f.filename),t||r("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(o=>{d.writeFileToAsync(t,o,n,i,t=>t?e(t):r("ADM-ZIP: Wasn't able to write zip file"))},r)})},toBufferPromise:function(){return new Promise((t,e)=>{h.toAsyncBuffer(t,e)})},toBuffer:function(t,e,r,n){return this.valueOf=2,"function"==typeof t?(h.toAsyncBuffer(t,e,r,n),null):h.compressToBuffer()}}}}).call(this,r(14).Buffer)},function(t,e,r){(function(t){e.require=function(){if("object"==typeof t&&t.versions&&t.versions.electron)try{const t=r(!function(){var t=new Error("Cannot find module 'original-fs'");throw t.code="MODULE_NOT_FOUND",t}());if(Object.keys(t).length>0)return t}catch(t){}return r(66)}}).call(this,r(20))},function(t,e){t.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}},function(t,e,r){(function(e){var n=r(103),i=r(238),o=n.Constants,a=r(408);t.exports=function(t){var r=new i.EntryHeader,s=e.alloc(0),u=e.alloc(0),c=!1,l=null,f=e.alloc(0);function d(){return t&&e.isBuffer(t)?(r.loadDataHeaderFromBinary(t),t.slice(r.realDataOffset,r.realDataOffset+r.compressedSize)):e.alloc(0)}function h(t){return 8==(8&r.flags)||n.crc32(t)===r.dataHeader.crc}function g(t,i,o){if(void 0===i&&"string"==typeof t&&(o=t,t=void 0),c)return t&&i&&i(e.alloc(0),n.Errors.DIRECTORY_CONTENT_ERROR),e.alloc(0);var u=d();if(0===u.length)return t&&i&&i(u),u;if(r.encripted){if("string"!=typeof o&&!e.isBuffer(o))throw new Error("ADM-ZIP: Incompatible password parameter");u=a.ZipCrypto.decrypt(u,r,o)}var l=e.alloc(r.size);switch(r.method){case n.Constants.STORED:if(u.copy(l),h(l))return t&&i&&i(l),l;throw t&&i&&i(l,n.Errors.BAD_CRC),new Error(n.Errors.BAD_CRC);case n.Constants.DEFLATED:var f=new a.Inflater(u);if(!t){if(f.inflate(l).copy(l,0),!h(l))throw new Error(n.Errors.BAD_CRC+" "+s.toString());return l}f.inflateAsync((function(t){t.copy(t,0),i&&(h(t)?i(t):i(t,n.Errors.BAD_CRC))}));break;default:throw t&&i&&i(e.alloc(0),n.Errors.UNKNOWN_METHOD),new Error(n.Errors.UNKNOWN_METHOD)}}function p(i,o){if((!l||!l.length)&&e.isBuffer(t))return i&&o&&o(d()),d();if(l.length&&!c){var s;switch(r.method){case n.Constants.STORED:return r.compressedSize=r.size,s=e.alloc(l.length),l.copy(s),i&&o&&o(s),s;default:case n.Constants.DEFLATED:var u=new a.Deflater(l);if(!i){var f=u.deflate();return r.compressedSize=f.length,f}u.deflateAsync((function(t){s=e.alloc(t.length),r.compressedSize=t.length,t.copy(s),o&&o(s)})),u=null}}else{if(!i||!o)return e.alloc(0);o(e.alloc(0))}}function m(t,e){return(t.readUInt32LE(e+4)<<4)+t.readUInt32LE(e)}function y(t){var e,n,i,a;t.length>=o.EF_ZIP64_SCOMP&&(e=m(t,o.EF_ZIP64_SUNCOMP),r.size===o.EF_ZIP64_OR_32&&(r.size=e)),t.length>=o.EF_ZIP64_RHO&&(n=m(t,o.EF_ZIP64_SCOMP),r.compressedSize===o.EF_ZIP64_OR_32&&(r.compressedSize=n)),t.length>=o.EF_ZIP64_DSN&&(i=m(t,o.EF_ZIP64_RHO),r.offset===o.EF_ZIP64_OR_32&&(r.offset=i)),t.length>=o.EF_ZIP64_DSN+4&&(a=t.readUInt32LE(o.EF_ZIP64_DSN),r.diskNumStart===o.EF_ZIP64_OR_16&&(r.diskNumStart=a))}return{get entryName(){return s.toString()},get rawEntryName(){return s},set entryName(t){var e=(s=n.toBuffer(t))[s.length-1];c=47===e||92===e,r.fileNameLength=s.length},get extra(){return f},set extra(t){f=t,r.extraLength=t.length,function(t){for(var e,r,n,i=0;i<t.length;)e=t.readUInt16LE(i),i+=2,r=t.readUInt16LE(i),i+=2,n=t.slice(i,i+r),i+=r,o.ID_ZIP64===e&&y(n)}(t)},get comment(){return u.toString()},set comment(t){u=n.toBuffer(t),r.commentLength=u.length},get name(){var t=s.toString();return c?t.substr(t.length-1).split("/").pop():t.split("/").pop()},get isDirectory(){return c},getCompressedData:function(){return p(!1,null)},getCompressedDataAsync:function(t){p(!0,t)},setData:function(t){l=n.toBuffer(t),!c&&l.length?(r.size=l.length,r.method=n.Constants.DEFLATED,r.crc=n.crc32(t),r.changed=!0):r.method=n.Constants.STORED},getData:function(t){return r.changed?l:g(!1,null,t)},getDataAsync:function(t,e){r.changed?t(l):g(!0,t,e)},set attr(t){r.attr=t},get attr(){return r.attr},set header(t){r.loadFromBinary(t)},get header(){return r},packHeader:function(){var t=r.entryHeaderToBinary(),e=n.Constants.CENHDR;return s.copy(t,e),e+=s.length,r.extraLength&&(f.copy(t,e),e+=r.extraLength),r.commentLength&&u.copy(t,e),t},toJSON:function(){const e=function(t){return"<"+(t&&t.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:r.toJSON(),compressedData:e(t),data:e(l)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}).call(this,r(14).Buffer)},function(t,e,r){e.EntryHeader=r(406),e.MainHeader=r(407)},function(t,e,r){"use strict";(function(t){var n=r(14).Buffer,i=r(97).Transform,o=r(410),a=r(81),s=r(137).ok,u=r(14).kMaxLength,c="Cannot create final Buffer. It would be larger than 0x"+u.toString(16)+" bytes";o.Z_MIN_WINDOWBITS=8,o.Z_MAX_WINDOWBITS=15,o.Z_DEFAULT_WINDOWBITS=15,o.Z_MIN_CHUNK=64,o.Z_MAX_CHUNK=1/0,o.Z_DEFAULT_CHUNK=16384,o.Z_MIN_MEMLEVEL=1,o.Z_MAX_MEMLEVEL=9,o.Z_DEFAULT_MEMLEVEL=8,o.Z_MIN_LEVEL=-1,o.Z_MAX_LEVEL=9,o.Z_DEFAULT_LEVEL=o.Z_DEFAULT_COMPRESSION;for(var l=Object.keys(o),f=0;f<l.length;f++){var d=l[f];d.match(/^Z/)&&Object.defineProperty(e,d,{enumerable:!0,value:o[d],writable:!1})}for(var h={Z_OK:o.Z_OK,Z_STREAM_END:o.Z_STREAM_END,Z_NEED_DICT:o.Z_NEED_DICT,Z_ERRNO:o.Z_ERRNO,Z_STREAM_ERROR:o.Z_STREAM_ERROR,Z_DATA_ERROR:o.Z_DATA_ERROR,Z_MEM_ERROR:o.Z_MEM_ERROR,Z_BUF_ERROR:o.Z_BUF_ERROR,Z_VERSION_ERROR:o.Z_VERSION_ERROR},g=Object.keys(h),p=0;p<g.length;p++){var m=g[p];h[h[m]]=m}function y(t,e,r){var i=[],o=0;function a(){for(var e;null!==(e=t.read());)i.push(e),o+=e.length;t.once("readable",a)}function s(){var e,a=null;o>=u?a=new RangeError(c):e=n.concat(i,o),i=[],t.close(),r(a,e)}t.on("error",(function(e){t.removeListener("end",s),t.removeListener("readable",a),r(e)})),t.on("end",s),t.end(e),a()}function b(t,e){if("string"==typeof e&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Not a string or buffer");var r=t._finishFlushFlag;return t._processChunk(e,r)}function w(t){if(!(this instanceof w))return new w(t);M.call(this,t,o.DEFLATE)}function _(t){if(!(this instanceof _))return new _(t);M.call(this,t,o.INFLATE)}function v(t){if(!(this instanceof v))return new v(t);M.call(this,t,o.GZIP)}function E(t){if(!(this instanceof E))return new E(t);M.call(this,t,o.GUNZIP)}function S(t){if(!(this instanceof S))return new S(t);M.call(this,t,o.DEFLATERAW)}function O(t){if(!(this instanceof O))return new O(t);M.call(this,t,o.INFLATERAW)}function T(t){if(!(this instanceof T))return new T(t);M.call(this,t,o.UNZIP)}function A(t){return t===o.Z_NO_FLUSH||t===o.Z_PARTIAL_FLUSH||t===o.Z_SYNC_FLUSH||t===o.Z_FULL_FLUSH||t===o.Z_FINISH||t===o.Z_BLOCK}function M(t,r){var a=this;if(this._opts=t=t||{},this._chunkSize=t.chunkSize||e.Z_DEFAULT_CHUNK,i.call(this,t),t.flush&&!A(t.flush))throw new Error("Invalid flush flag: "+t.flush);if(t.finishFlush&&!A(t.finishFlush))throw new Error("Invalid flush flag: "+t.finishFlush);if(this._flushFlag=t.flush||o.Z_NO_FLUSH,this._finishFlushFlag=void 0!==t.finishFlush?t.finishFlush:o.Z_FINISH,t.chunkSize&&(t.chunkSize<e.Z_MIN_CHUNK||t.chunkSize>e.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+t.chunkSize);if(t.windowBits&&(t.windowBits<e.Z_MIN_WINDOWBITS||t.windowBits>e.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+t.windowBits);if(t.level&&(t.level<e.Z_MIN_LEVEL||t.level>e.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+t.level);if(t.memLevel&&(t.memLevel<e.Z_MIN_MEMLEVEL||t.memLevel>e.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+t.memLevel);if(t.strategy&&t.strategy!=e.Z_FILTERED&&t.strategy!=e.Z_HUFFMAN_ONLY&&t.strategy!=e.Z_RLE&&t.strategy!=e.Z_FIXED&&t.strategy!=e.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+t.strategy);if(t.dictionary&&!n.isBuffer(t.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new o.Zlib(r);var s=this;this._hadError=!1,this._handle.onerror=function(t,r){j(s),s._hadError=!0;var n=new Error(t);n.errno=r,n.code=e.codes[r],s.emit("error",n)};var u=e.Z_DEFAULT_COMPRESSION;"number"==typeof t.level&&(u=t.level);var c=e.Z_DEFAULT_STRATEGY;"number"==typeof t.strategy&&(c=t.strategy),this._handle.init(t.windowBits||e.Z_DEFAULT_WINDOWBITS,u,t.memLevel||e.Z_DEFAULT_MEMLEVEL,c,t.dictionary),this._buffer=n.allocUnsafe(this._chunkSize),this._offset=0,this._level=u,this._strategy=c,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!a._handle},configurable:!0,enumerable:!0})}function j(e,r){r&&t.nextTick(r),e._handle&&(e._handle.close(),e._handle=null)}function I(t){t.emit("close")}Object.defineProperty(e,"codes",{enumerable:!0,value:Object.freeze(h),writable:!1}),e.Deflate=w,e.Inflate=_,e.Gzip=v,e.Gunzip=E,e.DeflateRaw=S,e.InflateRaw=O,e.Unzip=T,e.createDeflate=function(t){return new w(t)},e.createInflate=function(t){return new _(t)},e.createDeflateRaw=function(t){return new S(t)},e.createInflateRaw=function(t){return new O(t)},e.createGzip=function(t){return new v(t)},e.createGunzip=function(t){return new E(t)},e.createUnzip=function(t){return new T(t)},e.deflate=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new w(e),t,r)},e.deflateSync=function(t,e){return b(new w(e),t)},e.gzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new v(e),t,r)},e.gzipSync=function(t,e){return b(new v(e),t)},e.deflateRaw=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new S(e),t,r)},e.deflateRawSync=function(t,e){return b(new S(e),t)},e.unzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new T(e),t,r)},e.unzipSync=function(t,e){return b(new T(e),t)},e.inflate=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new _(e),t,r)},e.inflateSync=function(t,e){return b(new _(e),t)},e.gunzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new E(e),t,r)},e.gunzipSync=function(t,e){return b(new E(e),t)},e.inflateRaw=function(t,e,r){return"function"==typeof e&&(r=e,e={}),y(new O(e),t,r)},e.inflateRawSync=function(t,e){return b(new O(e),t)},a.inherits(M,i),M.prototype.params=function(r,n,i){if(r<e.Z_MIN_LEVEL||r>e.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+r);if(n!=e.Z_FILTERED&&n!=e.Z_HUFFMAN_ONLY&&n!=e.Z_RLE&&n!=e.Z_FIXED&&n!=e.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+n);if(this._level!==r||this._strategy!==n){var a=this;this.flush(o.Z_SYNC_FLUSH,(function(){s(a._handle,"zlib binding closed"),a._handle.params(r,n),a._hadError||(a._level=r,a._strategy=n,i&&i())}))}else t.nextTick(i)},M.prototype.reset=function(){return s(this._handle,"zlib binding closed"),this._handle.reset()},M.prototype._flush=function(t){this._transform(n.alloc(0),"",t)},M.prototype.flush=function(e,r){var i=this,a=this._writableState;("function"==typeof e||void 0===e&&!r)&&(r=e,e=o.Z_FULL_FLUSH),a.ended?r&&t.nextTick(r):a.ending?r&&this.once("end",r):a.needDrain?r&&this.once("drain",(function(){return i.flush(e,r)})):(this._flushFlag=e,this.write(n.alloc(0),"",r))},M.prototype.close=function(e){j(this,e),t.nextTick(I,this)},M.prototype._transform=function(t,e,r){var i,a=this._writableState,s=(a.ending||a.ended)&&(!t||a.length===t.length);return null===t||n.isBuffer(t)?this._handle?(s?i=this._finishFlushFlag:(i=this._flushFlag,t.length>=a.length&&(this._flushFlag=this._opts.flush||o.Z_NO_FLUSH)),void this._processChunk(t,i,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},M.prototype._processChunk=function(t,e,r){var i=t&&t.length,o=this._chunkSize-this._offset,a=0,l=this,f="function"==typeof r;if(!f){var d,h=[],g=0;this.on("error",(function(t){d=t})),s(this._handle,"zlib binding closed");do{var p=this._handle.writeSync(e,t,a,i,this._buffer,this._offset,o)}while(!this._hadError&&b(p[0],p[1]));if(this._hadError)throw d;if(g>=u)throw j(this),new RangeError(c);var m=n.concat(h,g);return j(this),m}s(this._handle,"zlib binding closed");var y=this._handle.write(e,t,a,i,this._buffer,this._offset,o);function b(u,c){if(this&&(this.buffer=null,this.callback=null),!l._hadError){var d=o-c;if(s(d>=0,"have should not go down"),d>0){var p=l._buffer.slice(l._offset,l._offset+d);l._offset+=d,f?l.push(p):(h.push(p),g+=p.length)}if((0===c||l._offset>=l._chunkSize)&&(o=l._chunkSize,l._offset=0,l._buffer=n.allocUnsafe(l._chunkSize)),0===c){if(a+=i-u,i=u,!f)return!0;var m=l._handle.write(e,t,a,i,l._buffer,l._offset,l._chunkSize);return m.callback=b,void(m.buffer=t)}if(!f)return!1;r()}}y.buffer=t,y.callback=b},a.inherits(w,M),a.inherits(_,M),a.inherits(v,M),a.inherits(E,M),a.inherits(S,M),a.inherits(O,M),a.inherits(T,M)}).call(this,r(20))},function(t,e,r){"use strict";t.exports=function(t,e,r,n){for(var i=65535&t|0,o=t>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+e[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0}},function(t,e,r){"use strict";var n=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();t.exports=function(t,e,r,i){var o=n,a=i+r;t^=-1;for(var s=i;s<a;s++)t=t>>>8^o[255&(t^e[s])];return-1^t}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(3),i=r(71);function o(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(n.a)(e);return Object(i.a)(t,-r)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(3),i=r(122);function o(t,e){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(n.a)(e);return Object(i.a)(t,-r)}},function(t,e,r){"use strict";var n=Object.prototype.toString;t.exports=function(t){var e=n.call(t),r="[object Arguments]"===e;return r||(r="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===n.call(t.callee)),r}},function(t,e,r){"use strict";var n=r(69)(),i=r(52)("Object.prototype.toString"),o=function(t){return!(n&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===i(t)},a=function(t){return!!o(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==i(t)&&"[object Function]"===i(t.callee)},s=function(){return o(arguments)}();o.isLegacyArguments=a,t.exports=s?o:a},function(t,e,r){"use strict";var n=function(t){return t!=t};t.exports=function(t,e){return 0===t&&0===e?1/t==1/e:t===e||!(!n(t)||!n(e))}},function(t,e,r){"use strict";var n=r(246);t.exports=function(){return"function"==typeof Object.is?Object.is:n}},function(t,e,r){"use strict";var n=Object,i=TypeError;t.exports=function(){if(null!=this&&this!==n(this))throw new i("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.sticky&&(t+="y"),t}},function(t,e,r){"use strict";var n=r(248),i=r(78).supportsDescriptors,o=Object.getOwnPropertyDescriptor;t.exports=function(){if(i&&"gim"===/a/gim.flags){var t=o(RegExp.prototype,"flags");if(t&&"function"==typeof t.get&&"boolean"==typeof/a/.dotAll)return t.get}return n}},function(t,e,r){"use strict";var n=String.prototype.valueOf,i=Object.prototype.toString,o=r(69)();t.exports=function(t){return"string"==typeof t||"object"==typeof t&&(o?function(t){try{return n.call(t),!0}catch(t){return!1}}(t):"[object String]"===i.call(t))}},function(t,e,r){"use strict";var n,i="function"==typeof Map&&Map.prototype?Map:null,o="function"==typeof Set&&Set.prototype?Set:null;i||(n=function(t){return!1});var a=i?Map.prototype.has:null,s=o?Set.prototype.has:null;n||a||(n=function(t){return!1}),t.exports=n||function(t){if(!t||"object"!=typeof t)return!1;try{if(a.call(t),s)try{s.call(t)}catch(t){return!0}return t instanceof i}catch(t){}return!1}},function(t,e,r){"use strict";var n,i="function"==typeof Map&&Map.prototype?Map:null,o="function"==typeof Set&&Set.prototype?Set:null;o||(n=function(t){return!1});var a=i?Map.prototype.has:null,s=o?Set.prototype.has:null;n||s||(n=function(t){return!1}),t.exports=n||function(t){if(!t||"object"!=typeof t)return!1;try{if(s.call(t),a)try{a.call(t)}catch(t){return!0}return t instanceof o}catch(t){}return!1}},function(t,e){var r=Object.prototype.hasOwnProperty,n=Object.prototype.toString;t.exports=function(t,e,i){if("[object Function]"!==n.call(e))throw new TypeError("iterator must be a function");var o=t.length;if(o===+o)for(var a=0;a<o;a++)e.call(i,t[a],a,t);else for(var s in t)r.call(t,s)&&e.call(i,t[s],s,t)}},function(t,e,r){"use strict";(function(e){var r=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],n="undefined"==typeof globalThis?e:globalThis;t.exports=function(){for(var t=[],e=0;e<r.length;e++)"function"==typeof n[r[e]]&&(t[t.length]=r[e]);return t}}).call(this,r(24))},function(t,e,r){"use strict";var n=r(77)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(t){n=null}t.exports=n},function(t,e,r){"use strict";var n=r(160),i=function(t){return null!=t},o=r(116)(),a=r(52),s=Object,u=a("Array.prototype.push"),c=a("Object.prototype.propertyIsEnumerable"),l=o?Object.getOwnPropertySymbols:null;t.exports=function(t,e){if(!i(t))throw new TypeError("target must be an object");var r,a,f,d,h,g,p,m=s(t);for(r=1;r<arguments.length;++r){a=s(arguments[r]),d=n(a);var y=o&&(Object.getOwnPropertySymbols||l);if(y)for(h=y(a),f=0;f<h.length;++f)p=h[f],c(a,p)&&u(d,p);for(f=0;f<d.length;++f)g=a[p=d[f]],c(a,p)&&(m[p]=g)}return m}},function(t,e,r){"use strict";var n=r(256);t.exports=function(){return Object.assign?function(){if(!Object.assign)return!1;for(var t="abcdefghijklmnopqrst",e=t.split(""),r={},n=0;n<e.length;++n)r[e[n]]=e[n];var i=Object.assign({},r),o="";for(var a in i)o+=a;return t!==o}()||function(){if(!Object.assign||!Object.preventExtensions)return!1;var t=Object.preventExtensions({1:2});try{Object.assign(t,"xy")}catch(e){return"y"===t[1]}return!1}()?n:Object.assign:n}},function(t,e){var r={utf8:{stringToBytes:function(t){return r.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(r.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],r=0;r<t.length;r++)e.push(255&t.charCodeAt(r));return e},bytesToString:function(t){for(var e=[],r=0;r<t.length;r++)e.push(String.fromCharCode(t[r]));return e.join("")}}};t.exports=r},function(t,e,r){"use strict";const n=r(462);t.exports=new class extends n{constructor(){super(),Object.defineProperty(this,"IPC",{enumerable:!0,writable:!1,value:n})}}},function(t,e,r){"use strict";const n=r(118);t.exports=class{constructor(){this.appspace="app.",this.socketRoot="/tmp/",this.id=n.hostname(),this.encoding="utf8",this.rawBuffer=!1,this.sync=!1,this.unlink=!0,this.delimiter="\f",this.silent=!1,this.logDepth=5,this.logInColor=!0,this.logger=console.log.bind(console),this.maxConnections=100,this.retry=500,this.maxRetries=1/0,this.stopRetrying=!1,this.IPType=function(){const t=n.networkInterfaces();let e="";t&&Array.isArray(t)&&t.length>0&&(e=t[Object.keys(t)[0]][0].family);return e}(),this.tls=!1,this.networkHost="IPv6"==this.IPType?"::1":"127.0.0.1",this.networkPort=8e3,this.interface={localAddress:!1,localPort:!1,family:!1,hints:!1,lookup:!1}}}},function(t,e,r){"use strict";const n=r(260);t.exports=class{constructor(t){t||(t=new n),this.delimiter=t.delimiter}format(t){return t.data||!1===t.data||0===t.data||(t.data={}),t.data._maxListeners&&(t.data={}),t=t.JSON+this.delimiter}parse(t){let e=t.split(this.delimiter);return e.pop(),e}}},function(t,e){t.exports=function(){Object.defineProperties(this,{data:{enumerable:!0,get:function(){return e},set:function(t){e=t}},type:{enumerable:!0,get:function(){return t},set:function(e){t=e}},load:{enumarable:!0,writable:!1,value:function(r){try{r=JSON.parse(r);t=r.type,e=r.data}catch(n){t="error",e={message:"Invalid JSON response format",err:n,response:r}}}},JSON:{enumerable:!0,get:function(){return JSON.stringify({type:t,data:e})}}});var t="",e={}}},function(t,e,r){"use strict";const n=r(473);t.exports=new class extends n{constructor(){super(),Object.defineProperty(this,"IPC",{enumerable:!0,writable:!1,value:n})}}},function(t,e,r){"use strict";const n=r(118);t.exports=class{constructor(){this.appspace="app.",this.socketRoot="/tmp/",this.id=n.hostname(),this.encoding="utf8",this.rawBuffer=!1,this.sync=!1,this.unlink=!0,this.delimiter="\f",this.silent=!1,this.logDepth=5,this.logInColor=!0,this.logger=console.log.bind(console),this.maxConnections=100,this.retry=500,this.maxRetries=1/0,this.stopRetrying=!1,this.IPType=function(){const t=n.networkInterfaces();let e="";t&&Array.isArray(t)&&t.length>0&&(e=t[Object.keys(t)[0]][0].family);return e}(),this.tls=!1,this.networkHost="IPv6"==this.IPType?"::1":"127.0.0.1",this.networkPort=8e3,this.interface={localAddress:!1,localPort:!1,family:!1,hints:!1,lookup:!1}}}},function(t,e,r){"use strict";const n=r(264);t.exports=class{constructor(t){t||(t=new n),this.delimiter=t.delimiter}format(t){return t.data||!1===t.data||0===t.data||(t.data={}),t.data._maxListeners&&(t.data={}),t=t.JSON+this.delimiter}parse(t){let e=t.split(this.delimiter);return e.pop(),e}}},function(t,e){t.exports=function(){Object.defineProperties(this,{data:{enumerable:!0,get:function(){return e},set:function(t){e=t}},type:{enumerable:!0,get:function(){return t},set:function(e){t=e}},load:{enumarable:!0,writable:!1,value:function(r){try{r=JSON.parse(r);t=r.type,e=r.data}catch(n){t="error",e={message:"Invalid JSON response format",err:n,response:r}}}},JSON:{enumerable:!0,get:function(){return JSON.stringify({type:t,data:e})}}});var t="",e={}}},function(t,e){t.exports={send:void 0}},function(t,e,r){"use strict";r.d(e,"a",(function(){return j}));var n=r(38),i=r(12),o=r(32),a=r(59),s=r(1),u=r(6),c=r(7),l=r(5),f=r(8),d=r(2),h=r(27);function g(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?g(Object(r),!0).forEach((function(e){m(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function m(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function y(t){return t[(Math.random()*t.length|0)%t.length]}function b(t,e){return 0|function(t,e){return t+(e-t)*Math.random()}(t,e)}function w(t,e){let r=t[0];for(let n=0;n<t.length;n++)t[n][e]<r[e]&&(r=t[n]);return r}function _(t){return t.find(t=>"Starting Balances"===t.name).id}function v(t,e){let r=t.find(t=>"Deposit"===t.name),n=t.filter(t=>"Deposit"!==t.name&&"Starting Balance"!==t.name),i=e.find(t=>0===t.is_income),o=e.find(t=>1===t.is_income),a=i.categories.filter(t=>-1!==["Food","Restaurants","Entertainment","Clothing","General","Gift","Medical"].indexOf(t.name));return{incomePayee:r,expensePayees:n.filter(t=>!t.bill),incomeGroup:o,expenseCategories:a,billCategories:e.find(t=>"Bills"===t.name).categories,billPayees:n.filter(t=>t.bill)}}async function E(t,e,r,i){let o=v(r,i),a=o.incomePayee,s=o.expensePayees,u=o.incomeGroup,c=o.expenseCategories,l=o.billCategories,f=o.billPayees,h=b(100,200),g=[];for(let t=0;t<h;t++){let r,n,i;r=Math.random()<.09?a:y(s),n="Deposit"===r.name?u.categories.find(t=>"Income"===t.name):y(c),i="Deposit"===r.name?b(5e4,7e4):b(0,Math.random()<.05?-8e3:-700);let o={amount:i,payee:r.id,account:e.id,date:d.q(d.d(),t/3|0),category:n.id};if(g.push(o),Math.random()<.2){let t=o.amount/3|0,e=()=>r===a?u.categories.find(t=>"Income"===t.name).id:y(c).id;o.subtransactions=[{amount:t,category:e()},{amount:t,category:e()},{amount:o.amount-2*t,category:e()}]}}let p=d.k(g[g.length-1].date),m=d.o(p,d.e()),w=d.d();for(let t of m){let r=d.a(t,"12");d.j(r,w)&&g.push({amount:-1e4,payee:f.find(t=>t.name.toLowerCase().includes("power")).id,account:e.id,date:r,category:l.find(t=>"Power"===t.name).id}),r=d.a(t,"18"),d.j(r,w)&&g.push({amount:-9e3,payee:f.find(t=>t.name.toLowerCase().includes("water")).id,account:e.id,date:r,category:l.find(t=>"Water"===t.name).id}),r=d.a(t,"2"),d.j(r,w)&&g.push({amount:-12e4,payee:f.find(t=>t.name.toLowerCase().includes("housy")).id,account:e.id,date:r,category:l.find(t=>"Mortgage"===t.name).id}),r=d.a(t,"20"),d.j(r,w)&&g.push({amount:-6e3,payee:f.find(t=>t.name.toLowerCase().includes("internet")).id,account:e.id,date:r,category:l.find(t=>"Internet"===t.name).id}),r=d.a(t,"23"),d.j(r,w)&&g.push({amount:-7500,payee:f.find(t=>t.name.toLowerCase().includes("t-mobile")).id,account:e.id,date:r,category:l.find(t=>"Cell"===t.name).id})}let E=null;return g.forEach(t=>{(null==E||t.date<E)&&(E=t.date)}),g.unshift({amount:1e5,payee:r.find(t=>"Starting Balance"===t.name).id,account:e.id,date:E,category:_(u.categories),starting_balance_flag:!0}),Object(n.a)(e.id,g)}async function S(t,e,r,n){let i=v(r,n),o=i.incomePayee,a=i.expensePayees,s=i.incomeGroup,u=i.expenseCategories,c=b(20,40),l=[];for(let t=0;t<c;t++){let r,n;r=Math.random()<.04?o:y(a),n="Deposit"===r.name?s.categories.find(t=>"Income"===t.name):y(u);let i="Deposit"===r.name?b(5e4,7e4):b(0,-1e4);l.push({amount:i,payee:r.id,account:e.id,date:d.q(d.d(),2*t|0),category:n.id})}l.unshift({amount:b(9e4,12e4),payee:r.find(t=>"Starting Balance"===t.name).id,account:e.id,date:l[l.length-1].date,category:_(s.categories),starting_balance_flag:!0}),await t["transactions-batch-update"]({added:l,fastMode:!0})}async function O(t,e,r,n){let i=v(r,n),o=i.incomePayee,a=(i.expensePayees,i.incomeGroup),s=(i.expenseCategories,b(10,30)),u=[];for(let t=0;t<s;t++){let t=o,r=a.categories.find(t=>"Income"===t.name),n=b(1e4,2e4);u.push({amount:n,payee:t.id,account:e.id,date:d.q(d.d(),b(10,360)),category:r.id})}u.unshift({amount:b(1e4,2e4),payee:r.find(t=>"Starting Balance"===t.name).id,account:e.id,date:w(u,"date").date,category:_(a.categories),starting_balance_flag:!0}),await t["transactions-batch-update"]({added:u,fastMode:!0})}async function T(t,e,r,n){let i=v(r,n),o=i.incomePayee,a=i.expensePayees,s=i.incomeGroup,u=i.expenseCategories,c=b(15,40),l=[];for(let t=0;t<c;t++){let r;r=Math.random()<.3?o:y(a);let n=r===o?s.categories.find(t=>"Income"===t.name):y(u),i=r===o?b(1e4,8e4):b(-1e4,-2e3);l.push({amount:i,payee:r.id,account:e.id,date:d.q(d.d(),5*t|0),category:n.id})}l.unshift({amount:3e4,payee:r.find(t=>"Starting Balance"===t.name).id,account:e.id,date:l[l.length-1].date,category:_(s.categories),starting_balance_flag:!0}),await t["transactions-batch-update"]({added:l,fastMode:!0})}async function A(t,e,r,n){let i=v(r,n),o=i.incomePayee,a=(i.expensePayees,i.incomeGroup),s=(i.expenseCategories,b(7,10)),u=b(1e5,2e5),c=a.categories.find(t=>"Income"===t.name),l=[{amount:100*b(-3e3,-3500)*100,payee:r.find(t=>"Starting Balance"===t.name).id,account:e.id,date:d.r(d.d(),s)+"-02",category:_(a.categories),starting_balance_flag:!0}];for(let t=0;t<s;t++){let r=o;l.push({amount:u,payee:r.id,account:e.id,date:d.r(d.d(),t)+"-02",category:c.id,starting_balance_flag:!0})}await t["transactions-batch-update"]({added:l,fastMode:!0})}async function M(t,e,r,n){let i=v(r,n),o=i.incomePayee,a=(i.expensePayees,i.incomeGroup),s=(i.expenseCategories,b(3,6)),u=a.categories.find(t=>"Income"===t.name),c=[{amount:100*b(3250,3700)*100,payee:r.find(t=>"Starting Balance"===t.name).id,account:e.id,date:d.r(d.d(),s)+"-02",category:_(a.categories),starting_balance_flag:!0}];for(let t=0;t<s;t++){let r=o,n=100*b(4,9)*100;c.push({amount:n,payee:r.id,account:e.id,date:d.r(d.d(),t)+"-02",category:u.id})}await t["transactions-batch-update"]({added:c,fastMode:!0})}async function j(t){Object(f.k)("import"),await s.execQuery("PRAGMA journal_mode = OFF"),await s.runQuery("DELETE FROM categories;"),await s.runQuery("DELETE FROM category_groups");let e=[{name:"Bank of America",type:"checking"},{name:"Ally Savings",type:"savings"},{name:"Capital One Checking",type:"checking"},{name:"HSBC",type:"checking"},{name:"Vanguard 401k",type:"investment",offBudget:1},{name:"Mortgage",type:"mortgage",offBudget:1},{name:"House Asset",type:"other",offBudget:1},{name:"Roth IRA",type:"investment",offBudget:1}];await Object(u.runMutator)(()=>Object(f.c)(async()=>{for(let r of e)r.id=await t["account-create"](r)}));let r=[{name:"Starting Balance"},{name:"Kroger"},{name:"Publix"},{name:"Home Depot"},{name:"Movies"},{name:"Online store"},{name:"Deposit"},{name:"Dominion Power",bill:!0},{name:"Extra Watery",bill:!0},{name:"Housy House",bill:!0},{name:"Fast Internet",bill:!0},{name:"T-mobile",bill:!0}];await Object(u.runMutator)(()=>Object(f.c)(async()=>{for(let e of r)e.id=await t["payee-create"]({name:e.name})}));let g=[{name:"Usual Expenses",categories:[{name:"Savings"},{name:"Medical"},{name:"Gift"},{name:"General"},{name:"Clothing"},{name:"Entertainment"},{name:"Restaurants"},{name:"Food"}]},{name:"Bills",categories:[{name:"Power"},{name:"Water"},{name:"Mortgage"},{name:"Internet"},{name:"Cell"}]},{name:"Income",is_income:!0,categories:[{name:"Income",is_income:!0},{name:"Misc",is_income:!0},{name:"Starting Balances",is_income:!0}]}];await Object(u.runMutator)(async()=>{for(let e of g){e.id=await t["category-group-create"]({name:e.name,isIncome:e.is_income?1:0});for(let r of e.categories)r.id=await t["category-create"](p(p({},r),{},{isIncome:r.is_income?1:0,groupId:e.id}))}});let m=(await Object(u.runHandler)(t["get-categories"])).grouped;Object(f.k)("import"),await Object(u.runMutator)(()=>Object(f.c)(async()=>{for(let n of e)switch(n.type){case"checking":"Bank of America"===n.name?await E(0,n,r,m):await S(t,n,r,m);break;case"investment":await O(t,n,r,m);break;case"savings":await T(t,n,r,m);break;case"mortgage":await A(t,n,r,m);break;case"other":"House Asset"===n.name?await M(t,n,r,m):await S(t,n,r,m)}})),Object(f.k)("import");let y=e.find(t=>t.name="Bank of America"),w=(await Object(i.g)(Object(h.b)("transactions").filter({account:y.id}).calculate({$sum:"$amount"}).serialize())).data;if(w<0){let e=(await Object(i.g)(Object(h.b)("transactions").filter({account:y.id,amount:{$gt:0}}).limit(1).select(["id","amount"]).serialize())).data[0];await Object(u.runHandler)(t["transaction-update"],p(p({},e),{},{amount:e.amount+-w+b(1e4,2e4)}))}Object(f.k)("disabled"),await c.d({isCached:!1}),await l.g(s),await a.a(),await l.j(),await async function(t,e,r){let i=t.find(t=>t.name="Bank of America"),a=(await s.first("SELECT * FROM v_transactions t LEFT JOIN accounts a ON t.account = a.id\n WHERE a.offbudget = 0 AND t.is_child = 0 ORDER BY date ASC LIMIT 1")).date,c=(await s.first("SELECT * FROM v_transactions t LEFT JOIN accounts a ON t.account = a.id\n WHERE a.id = ? AND a.offbudget = 0 AND t.is_child = 0 ORDER BY date ASC LIMIT 1",[i.id])).date,h=d.k(s.fromDateRepr(a)),g=d.e(),p=d.o(h,g);function m(t){for(let e of r){let r=e.categories.find(e=>e.name===t);if(r)return r}}function y(t,e,r){return o.i({month:t,category:e.id,amount:r})}function b(t,e){let r=l.d(d.p(t),"sum-amount-"+e.id);r<0&&y(t,e,-r)}await Object(u.runMutator)(()=>Object(f.c)(async()=>{for(let t of p)t>=d.k(s.fromDateRepr(c))?(y(t,m("Food"),4e4),y(t,m("Restaurants"),3e4),y(t,m("Entertainment"),1e4),y(t,m("Clothing"),3e3),y(t,m("General"),5e4),y(t,m("Gift"),7500),y(t,m("Medical"),1e4),y(t,m("Cell"),7500),y(t,m("Internet"),6e3),y(t,m("Mortgage"),12e4),y(t,m("Water"),9e3),y(t,m("Power"),1e4)):(b(t,m("Food")),b(t,m("Restaurants")),b(t,m("Entertainment")),b(t,m("Clothing")),b(t,m("General")),b(t,m("Gift")),b(t,m("Medical")),b(t,m("Cell")),b(t,m("Internet")),b(t,m("Mortgage")),b(t,m("Water")),b(t,m("Power")))})),await l.j(),await Object(u.runMutator)(()=>Object(f.c)(async()=>{let t=0;for(let e of p)if(e>=d.k(s.fromDateRepr(c))&&e<=d.e()){let r=d.p(e),n=l.d(r,"to-budget")-t;n-403e3>0?(y(e,m("Savings"),n-403e3),o.j(e,403e3),t+=n-403e3):n>0&&o.j(e,n)}})),await l.j();let w=d.p(d.e()),_=l.d(w,"to-budget");_<0&&await Object(n.a)(i.id,[{amount:-_,category:m("Income").id,date:d.e()+"-01"}]),await l.j()}(e,0,m)}},function(t,e,r){(function(t,e,n,i){var o=void 0,a=function(a){return o||(o=new Promise((function(o,s){var u,c=(u=void 0!==a?a:{}).onAbort;u.onAbort=function(t){s(new Error(t)),c&&c(t)},u.postRun=u.postRun||[],u.postRun.push((function(){o(u)})),t=void 0,u||(u=void 0!==u?u:{}),u.onRuntimeInitialized=function(){function t(t,e){this.Qa=t,this.db=e,this.Pa=1,this.wb=[]}function e(t,e){if(this.db=e,e=$(t)+1,this.hb=zt(e),null===this.hb)throw Error("Unable to allocate memory for the SQL string");G(t,U,this.hb,e),this.sb=this.hb,this.eb=this.Mb=null}function r(t,{filename:e=!1}={}){!1===e?(this.filename="dbfile_"+(4294967295*Math.random()>>>0),this.Xc=!0,null!=t&&Rt.zb("/",this.filename,t,!0,!0)):this.filename=t,this.handleError(o(this.filename,n)),this.db=R(n,"i32"),tt(this.db),this.nb={},this.Xa={}}var n=Xt(4),i=u.cwrap,o=i("sqlite3_open","number",["string","number"]),a=i("sqlite3_close_v2","number",["number"]),s=i("sqlite3_exec","number",["number","string","number","number","number"]),c=i("sqlite3_changes","number",["number"]),l=i("sqlite3_prepare_v2","number",["number","string","number","number","number"]),f=i("sqlite3_sql","string",["number"]),d=i("sqlite3_normalized_sql","string",["number"]),h=i("sqlite3_prepare_v2","number",["number","number","number","number","number"]),g=i("sqlite3_bind_text","number",["number","number","number","number","number"]),p=i("sqlite3_bind_blob","number",["number","number","number","number","number"]),m=i("sqlite3_bind_double","number",["number","number","number"]),y=i("sqlite3_bind_int","number",["number","number","number"]),b=i("sqlite3_bind_parameter_index","number",["number","string"]),w=i("sqlite3_step","number",["number"]),_=i("sqlite3_errmsg","string",["number"]),v=i("sqlite3_column_count","number",["number"]),E=i("sqlite3_data_count","number",["number"]),S=i("sqlite3_column_double","number",["number","number"]),O=i("sqlite3_column_text","string",["number","number"]),T=i("sqlite3_column_blob","number",["number","number"]),A=i("sqlite3_column_bytes","number",["number","number"]),D=i("sqlite3_column_type","number",["number","number"]),k=i("sqlite3_column_name","string",["number","number"]),N=i("sqlite3_reset","number",["number"]),C=i("sqlite3_clear_bindings","number",["number"]),x=i("sqlite3_finalize","number",["number"]),P=i("sqlite3_create_function_v2","number","number string number number number number number number number".split(" ")),F=i("sqlite3_value_type","number",["number"]),W=i("sqlite3_value_bytes","number",["number"]),H=i("sqlite3_value_text","string",["number"]),q=i("sqlite3_value_blob","number",["number"]),z=i("sqlite3_value_double","number",["number"]),V=i("sqlite3_result_double","",["number","number"]),K=i("sqlite3_result_null","",["number"]),Z=i("sqlite3_result_text","",["number","string","number","number"]),J=i("sqlite3_result_blob","",["number","number","number","number"]),X=i("sqlite3_result_int","",["number","number"]),Q=i("sqlite3_result_error","",["number","string","number"]),tt=i("RegisterExtensionFunctions","number",["number"]);t.prototype.bind=function(t){if(!this.Qa)throw"Statement closed";return this.reset(),Array.isArray(t)?this.vc(t):null==t||"object"!=typeof t||this.wc(t)},t.prototype.step=function(){if(!this.Qa)throw"Statement closed";this.Pa=1;var t=w(this.Qa);switch(t){case 100:return!0;case 101:return!1;default:throw this.db.handleError(t)}},t.prototype.Pc=function(t){return null==t&&(t=this.Pa,this.Pa+=1),S(this.Qa,t)},t.prototype.Qc=function(t){return null==t&&(t=this.Pa,this.Pa+=1),O(this.Qa,t)},t.prototype.getBlob=function(t){null==t&&(t=this.Pa,this.Pa+=1);var e=A(this.Qa,t);t=T(this.Qa,t);for(var r=new Uint8Array(e),n=0;n<e;n+=1)r[n]=B[t+n];return r},t.prototype.get=function(t){null!=t&&this.bind(t)&&this.step(),t=[];for(var e=E(this.Qa),r=0;r<e;r+=1)switch(D(this.Qa,r)){case 1:case 2:t.push(this.Pc(r));break;case 3:t.push(this.Qc(r));break;case 4:t.push(this.getBlob(r));break;default:t.push(null)}return t},t.prototype.getColumnNames=function(){for(var t=[],e=v(this.Qa),r=0;r<e;r+=1)t.push(k(this.Qa,r));return t},t.prototype.getAsObject=function(t){t=this.get(t);for(var e=this.getColumnNames(),r={},n=0;n<e.length;n+=1)r[e[n]]=t[n];return r},t.prototype.getSQL=function(){return f(this.Qa)},t.prototype.getNormalizedSQL=function(){return d(this.Qa)},t.prototype.run=function(t){return null!=t&&this.bind(t),this.step(),this.reset()},t.prototype.zc=function(t,e){null==e&&(e=this.Pa,this.Pa+=1);var r=L(t=Wt(t));this.wb.push(r),this.db.handleError(g(this.Qa,e,r,t.length-1,0))},t.prototype.uc=function(t,e){null==e&&(e=this.Pa,this.Pa+=1);var r=L(t);this.wb.push(r),this.db.handleError(p(this.Qa,e,r,t.length,0))},t.prototype.yc=function(t,e){null==e&&(e=this.Pa,this.Pa+=1),this.db.handleError((t===(0|t)?y:m)(this.Qa,e,t))},t.prototype.xc=function(t){null==t&&(t=this.Pa,this.Pa+=1),p(this.Qa,t,0,0,0)},t.prototype.Tb=function(t,e){switch(null==e&&(e=this.Pa,this.Pa+=1),typeof t){case"string":return void this.zc(t,e);case"number":case"boolean":return void this.yc(t+0,e);case"object":if(null===t)return void this.xc(e);if(null!=t.length)return void this.uc(t,e)}throw"Wrong API use : tried to bind a value of an unknown type ("+t+")."},t.prototype.wc=function(t){var e=this;return Object.keys(t).forEach((function(r){var n=b(e.Qa,r);0!==n&&e.Tb(t[r],n)})),!0},t.prototype.vc=function(t){for(var e=0;e<t.length;e+=1)this.Tb(t[e],e+1);return!0},t.prototype.reset=function(){return 0===C(this.Qa)&&0===N(this.Qa)},t.prototype.freemem=function(){for(var t;void 0!==(t=this.wb.pop());)Vt(t)},t.prototype.free=function(){var t=0===x(this.Qa);return delete this.db.nb[this.Qa],this.Qa=0,t},e.prototype.next=function(){if(null===this.hb)return{done:!0};if(null!==this.eb&&(this.eb.free(),this.eb=null),!this.db.db)throw this.Bb(),Error("Database closed");var e=Zt(),r=Xt(4);I(n),I(r);try{this.db.handleError(h(this.db.db,this.sb,-1,n,r)),this.sb=R(r,"i32");var i=R(n,"i32");return 0===i?(this.Bb(),{done:!0}):(this.eb=new t(i,this.db),this.db.nb[i]=this.eb,{value:this.eb,done:!1})}catch(t){throw this.Mb=Y(this.sb),this.Bb(),t}finally{Jt(e)}},e.prototype.Bb=function(){Vt(this.hb),this.hb=null},e.prototype.getRemainingSQL=function(){return null!==this.Mb?this.Mb:Y(this.sb)},"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator&&(e.prototype[Symbol.iterator]=function(){return this}),r.prototype.run=function(t,e){if(!this.db)throw"Database closed";if(e){t=this.prepare(t,e);try{t.step()}finally{t.free()}}else this.handleError(s(this.db,t,0,0,n));return this},r.prototype.exec=function(e,r){if(!this.db)throw"Database closed";var i=Zt(),o=null;try{var a=$(e)+1,s=Xt(a);G(e,B,s,a);var u=s,c=Xt(4);for(e=[];0!==R(u,"i8");){I(n),I(c),this.handleError(h(this.db,u,-1,n,c));var l=R(n,"i32");if(u=R(c,"i32"),0!==l){for(a=null,o=new t(l,this),null!=r&&o.bind(r);o.step();)null===a&&(a={columns:o.getColumnNames(),values:[]},e.push(a)),a.values.push(o.get());o.free()}}return e}catch(t){throw o&&o.free(),t}finally{Jt(i)}},r.prototype.each=function(t,e,r,n){"function"==typeof e&&(n=r,r=e,e=void 0),t=this.prepare(t,e);try{for(;t.step();)r(t.getAsObject())}finally{t.free()}if("function"==typeof n)return n()},r.prototype.prepare=function(e,r){if(I(n),this.handleError(l(this.db,e,-1,n,0)),0===(e=R(n,"i32")))throw"Nothing to prepare";var i=new t(e,this);return null!=r&&i.bind(r),this.nb[e]=i},r.prototype.iterateStatements=function(t){return new e(t,this)},r.prototype.export=function(){Object.values(this.nb).forEach((function(t){t.free()})),Object.values(this.Xa).forEach(M),this.Xa={},this.handleError(a(this.db));var t=Rt.readFile(this.filename,{encoding:"binary"});return this.handleError(o(this.filename,n)),this.db=R(n,"i32"),t},r.prototype.close=function(){null!==this.db&&(Object.values(this.nb).forEach((function(t){t.free()})),Object.values(this.Xa).forEach(M),this.Xa={},this.handleError(a(this.db)),this.Xc&&Rt.unlink("/"+this.filename),this.db=null)},r.prototype.handleError=function(t){if(0===t)return null;throw t=_(this.db),Error(t)},r.prototype.getRowsModified=function(){return c(this.db)},r.prototype.create_function=function(t,e){Object.prototype.hasOwnProperty.call(this.Xa,t)&&(M(this.Xa[t]),delete this.Xa[t]);var r=j((function(t,r,n){for(var i,o=[],a=0;a<r;a+=1){var s=R(n+4*a,"i32"),u=F(s);if(1===u||2===u)s=z(s);else if(3===u)s=H(s);else if(4===u){s=W(u=s),u=q(u);for(var c=new Uint8Array(s),l=0;l<s;l+=1)c[l]=B[u+l];s=c}else s=null;o.push(s)}try{i=e.apply(null,o)}catch(e){return void Q(t,e,-1)}switch(typeof i){case"boolean":X(t,i?1:0);break;case"number":V(t,i);break;case"string":Z(t,i,-1,-1);break;case"object":null===i?K(t):null!=i.length?(r=L(i),J(t,r,i.length,-1),Vt(r)):Q(t,"Wrong API use : tried to return a value of an unknown type ("+i+").",-1);break;default:K(t)}}),"viii");return this.Xa[t]=r,this.handleError(P(this.db,t,e.length,1,0,r,0,0,0)),this},u.Database=r;var et=new Map;u.register_for_idb=t=>{let e=j((function(e,r){return e=et.get(e),t.lock(e,r)?0:5}),"iii"),r=j((function(e,r){return e=et.get(e),t.unlock(e,r),0}),"iii"),n=j((function(t,e){t=Y(t),et.set(e,t)}),"vii");u._register_for_idb(e,r,n)},u.cleanup_file=t=>{let e=[...et.entries()].find(e=>e[1]===t);et.delete(e[0])},u.reset_filesystem=()=>{Rt.root=null,Rt.lc()}};var l,f={};for(l in u)u.hasOwnProperty(l)&&(f[l]=u[l]);var d,h,g,p,m,y="./this.program",b="object"==typeof window,w="function"==typeof importScripts,_="object"==typeof e&&"object"==typeof e.versions&&"string"==typeof e.versions.node,v="";_?(v=w?r(50).dirname(v)+"/":n+"/",d=function(t,e){return p||(p=r(66)),m||(m=r(50)),t=m.normalize(t),p.readFileSync(t,e?null:"utf8")},g=function(t){return(t=d(t,!0)).buffer||(t=new Uint8Array(t)),N(t.buffer),t},h=function(t,e,n){p||(p=r(66)),m||(m=r(50)),t=m.normalize(t),p.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1<e.argv.length&&(y=e.argv[1].replace(/\\/g,"/")),e.argv.slice(2),t.exports=u,u.inspect=function(){return"[Emscripten Module object]"}):(b||w)&&(w?v=self.location.href:"undefined"!=typeof document&&document.currentScript&&(v=document.currentScript.src),v=0!==v.indexOf("blob:")?v.substr(0,v.lastIndexOf("/")+1):"",d=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},w&&(g=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),h=function(t,e,r){var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?e(n.response):r()},n.onerror=r,n.send(null)});var E=u.print||console.log.bind(console),S=u.printErr||console.warn.bind(console);for(l in f)f.hasOwnProperty(l)&&(u[l]=f[l]);f=null,u.thisProgram&&(y=u.thisProgram);var O,T,A=[];function M(t){O.delete(J.get(t)),A.push(t)}function j(t,e){if(!O){O=new WeakMap;for(var r=0;r<J.length;r++){var n=J.get(r);n&&O.set(n,r)}}if(O.has(t))t=O.get(t);else{if(A.length)r=A.pop();else{try{J.grow(1)}catch(t){if(!(t instanceof RangeError))throw t;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}r=J.length-1}try{J.set(r,t)}catch(s){if(!(s instanceof TypeError))throw s;if("function"==typeof WebAssembly.Function){var i={i:"i32",j:"i64",f:"f32",d:"f64"},o={parameters:[],results:"v"==e[0]?[]:[i[e[0]]]};for(n=1;n<e.length;++n)o.parameters.push(i[e[n]]);e=new WebAssembly.Function(o,t)}else{i=[1,0,1,96],o=e.slice(0,1),e=e.slice(1);var a={i:127,j:126,f:125,d:124};for(i.push(e.length),n=0;n<e.length;++n)i.push(a[e[n]]);"v"==o?i.push(0):i=i.concat([1,a[o]]),i[1]=i.length-2,e=new Uint8Array([0,97,115,109,1,0,0,0].concat(i,[2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0])),e=new WebAssembly.Module(e),e=new WebAssembly.Instance(e,{e:{f:t}}).exports.f}J.set(r,e)}O.set(t,r),t=r}return t}u.wasmBinary&&(T=u.wasmBinary);u.noExitRuntime;function I(t){var e="i32";switch("*"===e.charAt(e.length-1)&&(e="i32"),e){case"i1":case"i8":B[t>>0]=0;break;case"i16":F[t>>1]=0;break;case"i32":W[t>>2]=0;break;case"i64":it=[0,(nt=0,1<=+Math.abs(nt)?0<nt?(0|Math.min(+Math.floor(nt/4294967296),4294967295))>>>0:~~+Math.ceil((nt-+(~~nt>>>0))/4294967296)>>>0:0)],W[t>>2]=it[0],W[t+4>>2]=it[1];break;case"float":H[t>>2]=0;break;case"double":q[t>>3]=0;break;default:ft("invalid type for setValue: "+e)}}function R(t,e){switch("*"===(e=e||"i8").charAt(e.length-1)&&(e="i32"),e){case"i1":case"i8":return B[t>>0];case"i16":return F[t>>1];case"i32":case"i64":return W[t>>2];case"float":return H[t>>2];case"double":return q[t>>3];default:ft("invalid type for getValue: "+e)}return null}"object"!=typeof WebAssembly&&ft("no native wasm support detected");var D,k=!1;function N(t,e){t||ft("Assertion failed: "+e)}function C(t){var e=u["_"+t];return N(e,"Cannot call unknown function "+t+", make sure it is exported"),e}function x(t,e,r,n){var i,o={string:function(t){var e=0;if(null!=t&&0!==t){var r=1+(t.length<<2);e=Xt(r),G(t,U,e,r)}return e},array:function(t){var e=Xt(t.length);return B.set(t,e),e}},a=C(t),s=[];if(t=0,n)for(var u=0;u<n.length;u++){var c=o[r[u]];c?(0===t&&(t=Zt()),s[u]=c(n[u])):s[u]=n[u]}return r=a.apply(null,s),i=r,r="string"===e?Y(i):"boolean"===e?!!i:i,0!==t&&Jt(t),r}function L(t){var e=zt(t.length);return t.subarray||t.slice?U.set(t,e):U.set(new Uint8Array(t),e),e}var P,B,U,F,W,H,q,z="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function V(t,e,r){var n=e+r;for(r=e;t[r]&&!(r>=n);)++r;if(16<r-e&&t.subarray&&z)return z.decode(t.subarray(e,r));for(n="";e<r;){var i=t[e++];if(128&i){var o=63&t[e++];if(192==(224&i))n+=String.fromCharCode((31&i)<<6|o);else{var a=63&t[e++];65536>(i=224==(240&i)?(15&i)<<12|o<<6|a:(7&i)<<18|o<<12|a<<6|63&t[e++])?n+=String.fromCharCode(i):(i-=65536,n+=String.fromCharCode(55296|i>>10,56320|1023&i))}}else n+=String.fromCharCode(i)}return n}function Y(t,e){return t?V(U,t,e):""}function G(t,e,r,n){if(!(0<n))return 0;var i=r;n=r+n-1;for(var o=0;o<t.length;++o){var a=t.charCodeAt(o);if(55296<=a&&57343>=a)a=65536+((1023&a)<<10)|1023&t.charCodeAt(++o);if(127>=a){if(r>=n)break;e[r++]=a}else{if(2047>=a){if(r+1>=n)break;e[r++]=192|a>>6}else{if(65535>=a){if(r+2>=n)break;e[r++]=224|a>>12}else{if(r+3>=n)break;e[r++]=240|a>>18,e[r++]=128|a>>12&63}e[r++]=128|a>>6&63}e[r++]=128|63&a}}return e[r]=0,r-i}function $(t){for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);55296<=n&&57343>=n&&(n=65536+((1023&n)<<10)|1023&t.charCodeAt(++r)),127>=n?++e:e=2047>=n?e+2:65535>=n?e+3:e+4}return e}function K(t){var e=$(t)+1,r=zt(e);return r&&G(t,B,r,e),r}function Z(){var t=D.buffer;P=t,u.HEAP8=B=new Int8Array(t),u.HEAP16=F=new Int16Array(t),u.HEAP32=W=new Int32Array(t),u.HEAPU8=U=new Uint8Array(t),u.HEAPU16=new Uint16Array(t),u.HEAPU32=new Uint32Array(t),u.HEAPF32=H=new Float32Array(t),u.HEAPF64=q=new Float64Array(t)}var J,X=[],Q=[],tt=[];function et(){var t=u.preRun.shift();X.unshift(t)}var rt,nt,it,ot,at=0,st=null,ut=null;function ct(){at++,u.monitorRunDependencies&&u.monitorRunDependencies(at)}function lt(){if(at--,u.monitorRunDependencies&&u.monitorRunDependencies(at),0==at&&(null!==st&&(clearInterval(st),st=null),ut)){var t=ut;ut=null,t()}}function ft(t){throw u.onAbort&&u.onAbort(t),S(t),k=!0,new WebAssembly.RuntimeError("abort("+t+"). Build with -s ASSERTIONS=1 for more info.")}function dt(){return rt.startsWith("data:application/octet-stream;base64,")}if(u.preloadedImages={},u.preloadedAudios={},rt="sql-wasm.wasm",!dt()){var ht=rt;rt=u.locateFile?u.locateFile(ht,v):v+ht}function gt(){var t=rt;try{if(t==rt&&T)return new Uint8Array(T);if(g)return g(t);throw"both async and sync fetching of the wasm failed"}catch(t){ft(t)}}function pt(t){for(;0<t.length;){var e=t.shift();if("function"==typeof e)e(u);else{var r=e.pd;"number"==typeof r?void 0===e.yb?J.get(r)():J.get(r)(e.yb):r(void 0===e.yb?null:e.yb)}}}function mt(t,e){for(var r=0,n=t.length-1;0<=n;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r;r--)t.unshift("..");return t}function yt(t){var e="/"===t.charAt(0),r="/"===t.substr(-1);return(t=mt(t.split("/").filter((function(t){return!!t})),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t}function bt(t){var e=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(t).slice(1);return t=e[0],e=e[1],t||e?(e&&(e=e.substr(0,e.length-1)),t+e):"."}function wt(t){if("/"===t)return"/";var e=(t=(t=yt(t)).replace(/\/$/,"")).lastIndexOf("/");return-1===e?t:t.substr(e+1)}function _t(t,e){return yt(t+"/"+e)}function vt(){for(var t="",e=!1,r=arguments.length-1;-1<=r&&!e;r--){if("string"!=typeof(e=0<=r?arguments[r]:Rt.cwd()))throw new TypeError("Arguments to path.resolve must be strings");if(!e)return"";t=e+"/"+t,e="/"===e.charAt(0)}return(e?"/":"")+(t=mt(t.split("/").filter((function(t){return!!t})),!e).join("/"))||"."}function Et(t,e){function r(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;0<=r&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=vt(t).substr(1),e=vt(e).substr(1),t=r(t.split("/")),e=r(e.split("/"));for(var n=Math.min(t.length,e.length),i=n,o=0;o<n;o++)if(t[o]!==e[o]){i=o;break}for(n=[],o=i;o<t.length;o++)n.push("..");return(n=n.concat(e.slice(i))).join("/")}var St=[];function Ot(t,e){St[t]={input:[],output:[],gb:e},Rt.Qb(t,Tt)}var Tt={open:function(t){var e=St[t.node.rdev];if(!e)throw new Rt.ErrnoError(43);t.tty=e,t.seekable=!1},close:function(t){t.tty.gb.flush(t.tty)},flush:function(t){t.tty.gb.flush(t.tty)},read:function(t,e,r,n){if(!t.tty||!t.tty.gb.cc)throw new Rt.ErrnoError(60);for(var i=0,o=0;o<n;o++){try{var a=t.tty.gb.cc(t.tty)}catch(t){throw new Rt.ErrnoError(29)}if(void 0===a&&0===i)throw new Rt.ErrnoError(6);if(null==a)break;i++,e[r+o]=a}return i&&(t.node.timestamp=Date.now()),i},write:function(t,e,r,n){if(!t.tty||!t.tty.gb.Nb)throw new Rt.ErrnoError(60);try{for(var i=0;i<n;i++)t.tty.gb.Nb(t.tty,e[r+i])}catch(t){throw new Rt.ErrnoError(29)}return n&&(t.node.timestamp=Date.now()),i}},At={cc:function(t){if(!t.input.length){var r=null;if(_){var n=i.alloc(256),o=0;try{o=p.readSync(e.stdin.fd,n,0,256,null)}catch(t){if(!t.toString().includes("EOF"))throw t;o=0}r=0<o?n.slice(0,o).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(r=window.prompt("Input: "))&&(r+="\n"):"function"==typeof readline&&(null!==(r=readline())&&(r+="\n"));if(!r)return null;t.input=Wt(r,!0)}return t.input.shift()},Nb:function(t,e){null===e||10===e?(E(V(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},flush:function(t){t.output&&0<t.output.length&&(E(V(t.output,0)),t.output=[])}},Mt={Nb:function(t,e){null===e||10===e?(S(V(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},flush:function(t){t.output&&0<t.output.length&&(S(V(t.output,0)),t.output=[])}};function jt(t){t=65536*Math.ceil(t/65536);var e=Qt(65536,t);return e?(U.fill(0,e,e+t),e):0}var It={Va:null,mount:function(){return It.createNode(null,"/",16895,0)},createNode:function(t,e,r,n){if(Rt.Rc(r)||Rt.isFIFO(r))throw new Rt.ErrnoError(63);return It.Va||(It.Va={dir:{node:{getattr:It.node_ops.getattr,setattr:It.node_ops.setattr,lookup:It.node_ops.lookup,mknod:It.node_ops.mknod,rename:It.node_ops.rename,unlink:It.node_ops.unlink,rmdir:It.node_ops.rmdir,readdir:It.node_ops.readdir,symlink:It.node_ops.symlink},stream:{llseek:It.stream_ops.llseek}},file:{node:{getattr:It.node_ops.getattr,setattr:It.node_ops.setattr},stream:{llseek:It.stream_ops.llseek,read:It.stream_ops.read,write:It.stream_ops.write,allocate:It.stream_ops.allocate,mmap:It.stream_ops.mmap,msync:It.stream_ops.msync}},link:{node:{getattr:It.node_ops.getattr,setattr:It.node_ops.setattr,readlink:It.node_ops.readlink},stream:{}},Vb:{node:{getattr:It.node_ops.getattr,setattr:It.node_ops.setattr},stream:Rt.Cc}}),r=Rt.createNode(t,e,r,n),Rt.isDir(r.mode)?(r.node_ops=It.Va.dir.node,r.stream_ops=It.Va.dir.stream,r.Na={}):Rt.isFile(r.mode)?(r.node_ops=It.Va.file.node,r.stream_ops=It.Va.file.stream,r.Ra=0,r.Na=null):Rt.fb(r.mode)?(r.node_ops=It.Va.link.node,r.stream_ops=It.Va.link.stream):Rt.pb(r.mode)&&(r.node_ops=It.Va.Vb.node,r.stream_ops=It.Va.Vb.stream),r.timestamp=Date.now(),t&&(t.Na[e]=r,t.timestamp=r.timestamp),r},qd:function(t){return t.Na?t.Na.subarray?t.Na.subarray(0,t.Ra):new Uint8Array(t.Na):new Uint8Array(0)},Zb:function(t,e){var r=t.Na?t.Na.length:0;r>=e||(e=Math.max(e,r*(1048576>r?2:1.125)>>>0),0!=r&&(e=Math.max(e,256)),r=t.Na,t.Na=new Uint8Array(e),0<t.Ra&&t.Na.set(r.subarray(0,t.Ra),0))},gd:function(t,e){if(t.Ra!=e)if(0==e)t.Na=null,t.Ra=0;else{var r=t.Na;t.Na=new Uint8Array(e),r&&t.Na.set(r.subarray(0,Math.min(e,t.Ra))),t.Ra=e}},node_ops:{getattr:function(t){var e={};return e.dev=Rt.pb(t.mode)?t.id:1,e.ino=t.id,e.mode=t.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=t.rdev,Rt.isDir(t.mode)?e.size=4096:Rt.isFile(t.mode)?e.size=t.Ra:Rt.fb(t.mode)?e.size=t.link.length:e.size=0,e.atime=new Date(t.timestamp),e.mtime=new Date(t.timestamp),e.ctime=new Date(t.timestamp),e.Ac=4096,e.blocks=Math.ceil(e.size/e.Ac),e},setattr:function(t,e){void 0!==e.mode&&(t.mode=e.mode),void 0!==e.timestamp&&(t.timestamp=e.timestamp),void 0!==e.size&&It.gd(t,e.size)},lookup:function(){throw Rt.Db[44]},mknod:function(t,e,r,n){return It.createNode(t,e,r,n)},rename:function(t,e,r){if(Rt.isDir(t.mode)){try{var n=Rt.lookupNode(e,r)}catch(t){}if(n)for(var i in n.Na)throw new Rt.ErrnoError(55)}delete t.parent.Na[t.name],t.parent.timestamp=Date.now(),t.name=r,e.Na[r]=t,e.timestamp=t.parent.timestamp,t.parent=e},unlink:function(t,e){delete t.Na[e],t.timestamp=Date.now()},rmdir:function(t,e){var r,n=Rt.lookupNode(t,e);for(r in n.Na)throw new Rt.ErrnoError(55);delete t.Na[e],t.timestamp=Date.now()},readdir:function(t){var e,r=[".",".."];for(e in t.Na)t.Na.hasOwnProperty(e)&&r.push(e);return r},symlink:function(t,e,r){return(t=It.createNode(t,e,41471,0)).link=r,t},readlink:function(t){if(!Rt.fb(t.mode))throw new Rt.ErrnoError(28);return t.link}},stream_ops:{read:function(t,e,r,n,i){var o=t.node.Na;if(i>=t.node.Ra)return 0;if(8<(t=Math.min(t.node.Ra-i,n))&&o.subarray)e.set(o.subarray(i,i+t),r);else for(n=0;n<t;n++)e[r+n]=o[i+n];return t},write:function(t,e,r,n,i,o){if(e.buffer===B.buffer&&(o=!1),!n)return 0;if((t=t.node).timestamp=Date.now(),e.subarray&&(!t.Na||t.Na.subarray)){if(o)return t.Na=e.subarray(r,r+n),t.Ra=n;if(0===t.Ra&&0===i)return t.Na=e.slice(r,r+n),t.Ra=n;if(i+n<=t.Ra)return t.Na.set(e.subarray(r,r+n),i),n}if(It.Zb(t,i+n),t.Na.subarray&&e.subarray)t.Na.set(e.subarray(r,r+n),i);else for(o=0;o<n;o++)t.Na[i+o]=e[r+o];return t.Ra=Math.max(t.Ra,i+n),n},llseek:function(t,e,r){if(1===r?e+=t.position:2===r&&Rt.isFile(t.node.mode)&&(e+=t.node.Ra),0>e)throw new Rt.ErrnoError(28);return e},allocate:function(t,e,r){It.Zb(t.node,e+r),t.node.Ra=Math.max(t.node.Ra,e+r)},mmap:function(t,e,r,n,i,o){if(0!==e)throw new Rt.ErrnoError(28);if(!Rt.isFile(t.node.mode))throw new Rt.ErrnoError(43);if(t=t.node.Na,2&o||t.buffer!==P){if((0<n||n+r<t.length)&&(t=t.subarray?t.subarray(n,n+r):Array.prototype.slice.call(t,n,n+r)),n=!0,!(r=jt(r)))throw new Rt.ErrnoError(48);B.set(t,r)}else n=!1,r=t.byteOffset;return{ed:r,vb:n}},msync:function(t,e,r,n,i){if(!Rt.isFile(t.node.mode))throw new Rt.ErrnoError(43);return 2&i||It.stream_ops.write(t,e,0,n,r,!1),0}}};var Rt={root:null,mb:[],Xb:{},streams:[],Zc:1,Ua:null,Wb:"/",Hb:!1,hc:!0,Sa:{},nc:{kc:{qc:1,rc:2}},ErrnoError:null,Db:{},Lc:null,tb:0,lookupPath:function(t,e){if(e=e||{},!(t=vt(Rt.cwd(),t)))return{path:"",node:null};var r,n={Cb:!0,Pb:0};for(r in n)void 0===e[r]&&(e[r]=n[r]);if(8<e.Pb)throw new Rt.ErrnoError(32);t=mt(t.split("/").filter((function(t){return!!t})),!1);var i=Rt.root;for(n="/",r=0;r<t.length;r++){var o=r===t.length-1;if(o&&e.parent)break;if(i=Rt.lookupNode(i,t[r]),n=_t(n,t[r]),Rt.ab(i)&&(!o||o&&e.Cb)&&(i=i.lb.root),!o||e.Ta)for(o=0;Rt.fb(i.mode);)if(i=Rt.readlink(n),n=vt(bt(n),i),i=Rt.lookupPath(n,{Pb:e.Pb}).node,40<o++)throw new Rt.ErrnoError(32)}return{path:n,node:i}},Ya:function(t){for(var e;;){if(Rt.isRoot(t))return t=t.mount.jc,e?"/"!==t[t.length-1]?t+"/"+e:t+e:t;e=e?t.name+"/"+e:t.name,t=t.parent}},Gb:function(t,e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n)|0;return(t+r>>>0)%Rt.Ua.length},ec:function(t){var e=Rt.Gb(t.parent.id,t.name);t.cb=Rt.Ua[e],Rt.Ua[e]=t},fc:function(t){var e=Rt.Gb(t.parent.id,t.name);if(Rt.Ua[e]===t)Rt.Ua[e]=t.cb;else for(e=Rt.Ua[e];e;){if(e.cb===t){e.cb=t.cb;break}e=e.cb}},lookupNode:function(t,e){var r=Rt.Vc(t);if(r)throw new Rt.ErrnoError(r,t);for(r=Rt.Ua[Rt.Gb(t.id,e)];r;r=r.cb){var n=r.name;if(r.parent.id===t.id&&n===e)return r}return Rt.lookup(t,e)},createNode:function(t,e,r,n){return t=new Rt.FSNode(t,e,r,n),Rt.ec(t),t},Ab:function(t){Rt.fc(t)},isRoot:function(t){return t===t.parent},ab:function(t){return!!t.lb},isFile:function(t){return 32768==(61440&t)},isDir:function(t){return 16384==(61440&t)},fb:function(t){return 40960==(61440&t)},pb:function(t){return 8192==(61440&t)},Rc:function(t){return 24576==(61440&t)},isFIFO:function(t){return 4096==(61440&t)},isSocket:function(t){return 49152==(49152&t)},Mc:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},Yc:function(t){var e=Rt.Mc[t];if(void 0===e)throw Error("Unknown file open mode: "+t);return e},$b:function(t){var e=["r","w","rw"][3&t];return 512&t&&(e+="w"),e},Za:function(t,e){return Rt.hc?0:!e.includes("r")||292&t.mode?e.includes("w")&&!(146&t.mode)||e.includes("x")&&!(73&t.mode)?2:0:2},Vc:function(t){var e=Rt.Za(t,"x");return e||(t.node_ops.lookup?0:2)},Lb:function(t,e){try{return Rt.lookupNode(t,e),20}catch(t){}return Rt.Za(t,"wx")},qb:function(t,e,r){try{var n=Rt.lookupNode(t,e)}catch(t){return t.Oa}if(t=Rt.Za(t,"wx"))return t;if(r){if(!Rt.isDir(n.mode))return 54;if(Rt.isRoot(n)||Rt.Ya(n)===Rt.cwd())return 10}else if(Rt.isDir(n.mode))return 31;return 0},Wc:function(t,e){return t?Rt.fb(t.mode)?32:Rt.isDir(t.mode)&&("r"!==Rt.$b(e)||512&e)?31:Rt.Za(t,Rt.$b(e)):44},oc:4096,$c:function(t,e){for(e=e||Rt.oc,t=t||0;t<=e;t++)if(!Rt.streams[t])return t;throw new Rt.ErrnoError(33)},$a:function(t){return Rt.streams[t]},Jc:function(t,e,r){Rt.ub||(Rt.ub=function(){},Rt.ub.prototype={object:{get:function(){return this.node},set:function(t){this.node=t}}});var n,i=new Rt.ub;for(n in t)i[n]=t[n];return t=i,e=Rt.$c(e,r),t.fd=e,Rt.streams[e]=t},Dc:function(t){Rt.streams[t]=null},Cc:{open:function(t){t.stream_ops=Rt.Oc(t.node.rdev).stream_ops,t.stream_ops.open&&t.stream_ops.open(t)},llseek:function(){throw new Rt.ErrnoError(70)}},Kb:function(t){return t>>8},sd:function(t){return 255&t},bb:function(t,e){return t<<8|e},Qb:function(t,e){Rt.Xb[t]={stream_ops:e}},Oc:function(t){return Rt.Xb[t]},bc:function(t){var e=[];for(t=[t];t.length;){var r=t.pop();e.push(r),t.push.apply(t,r.mb)}return e},mc:function(t,e){function r(t){return Rt.tb--,e(t)}function n(t){if(t){if(!n.Kc)return n.Kc=!0,r(t)}else++o>=i.length&&r(null)}"function"==typeof t&&(e=t,t=!1),Rt.tb++,1<Rt.tb&&S("warning: "+Rt.tb+" FS.syncfs operations in flight at once, probably just doing extra work");var i=Rt.bc(Rt.root.mount),o=0;i.forEach((function(e){if(!e.type.mc)return n(null);e.type.mc(e,t,n)}))},mount:function(t,e,r){var n="/"===r,i=!r;if(n&&Rt.root)throw new Rt.ErrnoError(10);if(!n&&!i){var o=Rt.lookupPath(r,{Cb:!1});if(r=o.path,o=o.node,Rt.ab(o))throw new Rt.ErrnoError(10);if(!Rt.isDir(o.mode))throw new Rt.ErrnoError(54)}return e={type:t,vd:e,jc:r,mb:[]},(t=t.mount(e)).mount=e,e.root=t,n?Rt.root=t:o&&(o.lb=e,o.mount&&o.mount.mb.push(e)),t},yd:function(t){if(t=Rt.lookupPath(t,{Cb:!1}),!Rt.ab(t.node))throw new Rt.ErrnoError(28);var e=(t=t.node).lb,r=Rt.bc(e);Object.keys(Rt.Ua).forEach((function(t){for(t=Rt.Ua[t];t;){var e=t.cb;r.includes(t.mount)&&Rt.Ab(t),t=e}})),t.lb=null,t.mount.mb.splice(t.mount.mb.indexOf(e),1)},lookup:function(t,e){return t.node_ops.lookup(t,e)},mknod:function(t,e,r){var n=Rt.lookupPath(t,{parent:!0}).node;if(!(t=wt(t))||"."===t||".."===t)throw new Rt.ErrnoError(28);var i=Rt.Lb(n,t);if(i)throw new Rt.ErrnoError(i);if(!n.node_ops.mknod)throw new Rt.ErrnoError(63);return n.node_ops.mknod(n,t,e,r)},create:function(t,e){return Rt.mknod(t,4095&(void 0!==e?e:438)|32768,0)},mkdir:function(t,e){return Rt.mknod(t,1023&(void 0!==e?e:511)|16384,0)},td:function(t,e){t=t.split("/");for(var r="",n=0;n<t.length;++n)if(t[n]){r+="/"+t[n];try{Rt.mkdir(r,e)}catch(t){if(20!=t.Oa)throw t}}},rb:function(t,e,r){return void 0===r&&(r=e,e=438),Rt.mknod(t,8192|e,r)},symlink:function(t,e){if(!vt(t))throw new Rt.ErrnoError(44);var r=Rt.lookupPath(e,{parent:!0}).node;if(!r)throw new Rt.ErrnoError(44);e=wt(e);var n=Rt.Lb(r,e);if(n)throw new Rt.ErrnoError(n);if(!r.node_ops.symlink)throw new Rt.ErrnoError(63);return r.node_ops.symlink(r,e,t)},rename:function(t,e){var r=bt(t),n=bt(e),i=wt(t),o=wt(e),a=Rt.lookupPath(t,{parent:!0}),s=a.node;if(a=(a=Rt.lookupPath(e,{parent:!0})).node,!s||!a)throw new Rt.ErrnoError(44);if(s.mount!==a.mount)throw new Rt.ErrnoError(75);var u=Rt.lookupNode(s,i);if("."!==(n=Et(t,n)).charAt(0))throw new Rt.ErrnoError(28);if("."!==(n=Et(e,r)).charAt(0))throw new Rt.ErrnoError(55);try{var c=Rt.lookupNode(a,o)}catch(t){}if(u!==c){if(r=Rt.isDir(u.mode),i=Rt.qb(s,i,r))throw new Rt.ErrnoError(i);if(i=c?Rt.qb(a,o,r):Rt.Lb(a,o))throw new Rt.ErrnoError(i);if(!s.node_ops.rename)throw new Rt.ErrnoError(63);if(Rt.ab(u)||c&&Rt.ab(c))throw new Rt.ErrnoError(10);if(a!==s&&(i=Rt.Za(s,"w")))throw new Rt.ErrnoError(i);try{Rt.Sa.willMovePath&&Rt.Sa.willMovePath(t,e)}catch(r){S("FS.trackingDelegate['willMovePath']('"+t+"', '"+e+"') threw an exception: "+r.message)}Rt.fc(u);try{s.node_ops.rename(u,a,o)}catch(t){throw t}finally{Rt.ec(u)}try{Rt.Sa.onMovePath&&Rt.Sa.onMovePath(t,e)}catch(r){S("FS.trackingDelegate['onMovePath']('"+t+"', '"+e+"') threw an exception: "+r.message)}}},rmdir:function(t){var e=Rt.lookupPath(t,{parent:!0}).node,r=wt(t),n=Rt.lookupNode(e,r),i=Rt.qb(e,r,!0);if(i)throw new Rt.ErrnoError(i);if(!e.node_ops.rmdir)throw new Rt.ErrnoError(63);if(Rt.ab(n))throw new Rt.ErrnoError(10);try{Rt.Sa.willDeletePath&&Rt.Sa.willDeletePath(t)}catch(e){S("FS.trackingDelegate['willDeletePath']('"+t+"') threw an exception: "+e.message)}e.node_ops.rmdir(e,r),Rt.Ab(n);try{Rt.Sa.onDeletePath&&Rt.Sa.onDeletePath(t)}catch(e){S("FS.trackingDelegate['onDeletePath']('"+t+"') threw an exception: "+e.message)}},readdir:function(t){if(!(t=Rt.lookupPath(t,{Ta:!0}).node).node_ops.readdir)throw new Rt.ErrnoError(54);return t.node_ops.readdir(t)},unlink:function(t){var e=Rt.lookupPath(t,{parent:!0}).node,r=wt(t),n=Rt.lookupNode(e,r),i=Rt.qb(e,r,!1);if(i)throw new Rt.ErrnoError(i);if(!e.node_ops.unlink)throw new Rt.ErrnoError(63);if(Rt.ab(n))throw new Rt.ErrnoError(10);try{Rt.Sa.willDeletePath&&Rt.Sa.willDeletePath(t)}catch(e){S("FS.trackingDelegate['willDeletePath']('"+t+"') threw an exception: "+e.message)}e.node_ops.unlink(e,r),Rt.Ab(n);try{Rt.Sa.onDeletePath&&Rt.Sa.onDeletePath(t)}catch(e){S("FS.trackingDelegate['onDeletePath']('"+t+"') threw an exception: "+e.message)}},readlink:function(t){if(!(t=Rt.lookupPath(t).node))throw new Rt.ErrnoError(44);if(!t.node_ops.readlink)throw new Rt.ErrnoError(28);return vt(Rt.Ya(t.parent),t.node_ops.readlink(t))},stat:function(t,e){if(!(t=Rt.lookupPath(t,{Ta:!e}).node))throw new Rt.ErrnoError(44);if(!t.node_ops.getattr)throw new Rt.ErrnoError(63);return t.node_ops.getattr(t)},lstat:function(t){return Rt.stat(t,!0)},chmod:function(t,e,r){if(!(t="string"==typeof t?Rt.lookupPath(t,{Ta:!r}).node:t).node_ops.setattr)throw new Rt.ErrnoError(63);t.node_ops.setattr(t,{mode:4095&e|-4096&t.mode,timestamp:Date.now()})},lchmod:function(t,e){Rt.chmod(t,e,!0)},fchmod:function(t,e){if(!(t=Rt.$a(t)))throw new Rt.ErrnoError(8);Rt.chmod(t.node,e)},chown:function(t,e,r,n){if(!(t="string"==typeof t?Rt.lookupPath(t,{Ta:!n}).node:t).node_ops.setattr)throw new Rt.ErrnoError(63);t.node_ops.setattr(t,{timestamp:Date.now()})},lchown:function(t,e,r){Rt.chown(t,e,r,!0)},fchown:function(t,e,r){if(!(t=Rt.$a(t)))throw new Rt.ErrnoError(8);Rt.chown(t.node,e,r)},truncate:function(t,e){if(0>e)throw new Rt.ErrnoError(28);if(!(t="string"==typeof t?Rt.lookupPath(t,{Ta:!0}).node:t).node_ops.setattr)throw new Rt.ErrnoError(63);if(Rt.isDir(t.mode))throw new Rt.ErrnoError(31);if(!Rt.isFile(t.mode))throw new Rt.ErrnoError(28);var r=Rt.Za(t,"w");if(r)throw new Rt.ErrnoError(r);t.node_ops.setattr(t,{size:e,timestamp:Date.now()})},Nc:function(t,e){if(!(t=Rt.$a(t)))throw new Rt.ErrnoError(8);if(0==(2097155&t.flags))throw new Rt.ErrnoError(28);Rt.truncate(t.node,e)},kd:function(t,e,r){(t=Rt.lookupPath(t,{Ta:!0}).node).node_ops.setattr(t,{timestamp:Math.max(e,r)})},open:function(t,e,r,n,i){if(""===t)throw new Rt.ErrnoError(44);if(r=64&(e="string"==typeof e?Rt.Yc(e):e)?4095&(void 0===r?438:r)|32768:0,"object"==typeof t)var o=t;else{t=yt(t);try{o=Rt.lookupPath(t,{Ta:!(131072&e)}).node}catch(t){}}var a=!1;if(64&e)if(o){if(128&e)throw new Rt.ErrnoError(20)}else o=Rt.mknod(t,r,0),a=!0;if(!o)throw new Rt.ErrnoError(44);if(Rt.pb(o.mode)&&(e&=-513),65536&e&&!Rt.isDir(o.mode))throw new Rt.ErrnoError(54);if(!a&&(r=Rt.Wc(o,e)))throw new Rt.ErrnoError(r);512&e&&Rt.truncate(o,0),e&=-131713,(n=Rt.Jc({node:o,path:Rt.Ya(o),flags:e,seekable:!0,position:0,stream_ops:o.stream_ops,jd:[],error:!1},n,i)).stream_ops.open&&n.stream_ops.open(n),!u.logReadFiles||1&e||(Rt.Ob||(Rt.Ob={}),t in Rt.Ob||(Rt.Ob[t]=1,S("FS.trackingDelegate error on read file: "+t)));try{Rt.Sa.onOpenFile&&(i=0,1!=(2097155&e)&&(i|=Rt.nc.kc.qc),0!=(2097155&e)&&(i|=Rt.nc.kc.rc),Rt.Sa.onOpenFile(t,i))}catch(e){S("FS.trackingDelegate['onOpenFile']('"+t+"', flags) threw an exception: "+e.message)}return n},close:function(t){if(Rt.kb(t))throw new Rt.ErrnoError(8);t.Fb&&(t.Fb=null);try{t.stream_ops.close&&t.stream_ops.close(t)}catch(t){throw t}finally{Rt.Dc(t.fd)}t.fd=null},kb:function(t){return null===t.fd},llseek:function(t,e,r){if(Rt.kb(t))throw new Rt.ErrnoError(8);if(!t.seekable||!t.stream_ops.llseek)throw new Rt.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Rt.ErrnoError(28);return t.position=t.stream_ops.llseek(t,e,r),t.jd=[],t.position},read:function(t,e,r,n,i){if(0>n||0>i)throw new Rt.ErrnoError(28);if(Rt.kb(t))throw new Rt.ErrnoError(8);if(1==(2097155&t.flags))throw new Rt.ErrnoError(8);if(Rt.isDir(t.node.mode))throw new Rt.ErrnoError(31);if(!t.stream_ops.read)throw new Rt.ErrnoError(28);var o=void 0!==i;if(o){if(!t.seekable)throw new Rt.ErrnoError(70)}else i=t.position;return e=t.stream_ops.read(t,e,r,n,i),o||(t.position+=e),e},write:function(t,e,r,n,i,o){if(0>n||0>i)throw new Rt.ErrnoError(28);if(Rt.kb(t))throw new Rt.ErrnoError(8);if(0==(2097155&t.flags))throw new Rt.ErrnoError(8);if(Rt.isDir(t.node.mode))throw new Rt.ErrnoError(31);if(!t.stream_ops.write)throw new Rt.ErrnoError(28);t.seekable&&1024&t.flags&&Rt.llseek(t,0,2);var a=void 0!==i;if(a){if(!t.seekable)throw new Rt.ErrnoError(70)}else i=t.position;e=t.stream_ops.write(t,e,r,n,i,o),a||(t.position+=e);try{t.path&&Rt.Sa.onWriteToFile&&Rt.Sa.onWriteToFile(t.path)}catch(e){S("FS.trackingDelegate['onWriteToFile']('"+t.path+"') threw an exception: "+e.message)}return e},allocate:function(t,e,r){if(Rt.kb(t))throw new Rt.ErrnoError(8);if(0>e||0>=r)throw new Rt.ErrnoError(28);if(0==(2097155&t.flags))throw new Rt.ErrnoError(8);if(!Rt.isFile(t.node.mode)&&!Rt.isDir(t.node.mode))throw new Rt.ErrnoError(43);if(!t.stream_ops.allocate)throw new Rt.ErrnoError(138);t.stream_ops.allocate(t,e,r)},mmap:function(t,e,r,n,i,o){if(0!=(2&i)&&0==(2&o)&&2!=(2097155&t.flags))throw new Rt.ErrnoError(2);if(1==(2097155&t.flags))throw new Rt.ErrnoError(2);if(!t.stream_ops.mmap)throw new Rt.ErrnoError(43);return t.stream_ops.mmap(t,e,r,n,i,o)},msync:function(t,e,r,n,i){return t&&t.stream_ops.msync?t.stream_ops.msync(t,e,r,n,i):0},ud:function(){return 0},ic:function(t,e,r){if(!t.stream_ops.ic)throw new Rt.ErrnoError(59);return t.stream_ops.ic(t,e,r)},readFile:function(t,e){if((e=e||{}).flags=e.flags||0,e.encoding=e.encoding||"binary","utf8"!==e.encoding&&"binary"!==e.encoding)throw Error('Invalid encoding type "'+e.encoding+'"');var r,n=Rt.open(t,e.flags);t=Rt.stat(t).size;var i=new Uint8Array(t);return Rt.read(n,i,0,t,0),"utf8"===e.encoding?r=V(i,0):"binary"===e.encoding&&(r=i),Rt.close(n),r},writeFile:function(t,e,r){if((r=r||{}).flags=r.flags||577,t=Rt.open(t,r.flags,r.mode),"string"==typeof e){var n=new Uint8Array($(e)+1);e=G(e,n,0,n.length),Rt.write(t,n,0,e,void 0,r.Bc)}else{if(!ArrayBuffer.isView(e))throw Error("Unsupported data type");Rt.write(t,e,0,e.byteLength,void 0,r.Bc)}Rt.close(t)},cwd:function(){return Rt.Wb},chdir:function(t){if(null===(t=Rt.lookupPath(t,{Ta:!0})).node)throw new Rt.ErrnoError(44);if(!Rt.isDir(t.node.mode))throw new Rt.ErrnoError(54);var e=Rt.Za(t.node,"x");if(e)throw new Rt.ErrnoError(e);Rt.Wb=t.path},Fc:function(){Rt.mkdir("/tmp"),Rt.mkdir("/home"),Rt.mkdir("/home/web_user")},Ec:function(){Rt.mkdir("/dev"),Rt.Qb(Rt.bb(1,3),{read:function(){return 0},write:function(t,e,r,n){return n}}),Rt.rb("/dev/null",Rt.bb(1,3)),Ot(Rt.bb(5,0),At),Ot(Rt.bb(6,0),Mt),Rt.rb("/dev/tty",Rt.bb(5,0)),Rt.rb("/dev/tty1",Rt.bb(6,0));var t=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return function(){return crypto.getRandomValues(t),t[0]}}if(_)try{var e=r(184);return function(){return e.randomBytes(1)[0]}}catch(t){}return function(){ft("randomDevice")}}();Rt.Wa("/dev","random",t),Rt.Wa("/dev","urandom",t),Rt.mkdir("/dev/shm"),Rt.mkdir("/dev/shm/tmp")},Hc:function(){Rt.mkdir("/proc");var t=Rt.mkdir("/proc/self");Rt.mkdir("/proc/self/fd"),Rt.mount({mount:function(){var e=Rt.createNode(t,"fd",16895,73);return e.node_ops={lookup:function(t,e){var r=Rt.$a(+e);if(!r)throw new Rt.ErrnoError(8);return(t={parent:null,mount:{jc:"fake"},node_ops:{readlink:function(){return r.path}}}).parent=t}},e}},{},"/proc/self/fd")},Ic:function(){u.stdin?Rt.Wa("/dev","stdin",u.stdin):Rt.symlink("/dev/tty","/dev/stdin"),u.stdout?Rt.Wa("/dev","stdout",null,u.stdout):Rt.symlink("/dev/tty","/dev/stdout"),u.stderr?Rt.Wa("/dev","stderr",null,u.stderr):Rt.symlink("/dev/tty1","/dev/stderr"),Rt.open("/dev/stdin",0),Rt.open("/dev/stdout",1),Rt.open("/dev/stderr",1)},Yb:function(){Rt.ErrnoError||(Rt.ErrnoError=function(t,e){this.node=e,this.hd=function(t){this.Oa=t},this.hd(t),this.message="FS error"},Rt.ErrnoError.prototype=Error(),Rt.ErrnoError.prototype.constructor=Rt.ErrnoError,[44].forEach((function(t){Rt.Db[t]=new Rt.ErrnoError(t),Rt.Db[t].stack="<generic error, no stack>"})))},lc:function(){Rt.Yb(),Rt.Ua=Array(4096),Rt.mount(It,{},"/"),Rt.Fc(),Rt.Ec(),Rt.Hc(),Rt.Lc={MEMFS:It}},jb:function(t,e,r){Rt.jb.Hb=!0,Rt.Yb(),u.stdin=t||u.stdin,u.stdout=e||u.stdout,u.stderr=r||u.stderr,Rt.Ic()},wd:function(){Rt.jb.Hb=!1;var t=u._fflush;for(t&&t(0),t=0;t<Rt.streams.length;t++){var e=Rt.streams[t];e&&Rt.close(e)}},Eb:function(t,e){var r=0;return t&&(r|=365),e&&(r|=146),r},od:function(t,e){return(t=Rt.xb(t,e)).exists?t.object:null},xb:function(t,e){try{var r=Rt.lookupPath(t,{Ta:!e});t=r.path}catch(t){}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,ad:!1,cd:null,bd:null};try{r=Rt.lookupPath(t,{parent:!0}),n.ad=!0,n.cd=r.path,n.bd=r.node,n.name=wt(t),r=Rt.lookupPath(t,{Ta:!e}),n.exists=!0,n.path=r.path,n.object=r.node,n.name=r.node.name,n.isRoot="/"===r.path}catch(t){n.error=t.Oa}return n},md:function(t,e){for(t="string"==typeof t?t:Rt.Ya(t),e=e.split("/").reverse();e.length;){var r=e.pop();if(r){var n=_t(t,r);try{Rt.mkdir(n)}catch(t){}t=n}}return n},Gc:function(t,e,r,n,i){return t=_t("string"==typeof t?t:Rt.Ya(t),e),Rt.create(t,Rt.Eb(n,i))},zb:function(t,e,r,n,i,o){if(t=e?_t("string"==typeof t?t:Rt.Ya(t),e):t,n=Rt.Eb(n,i),i=Rt.create(t,n),r){if("string"==typeof r){t=Array(r.length),e=0;for(var a=r.length;e<a;++e)t[e]=r.charCodeAt(e);r=t}Rt.chmod(i,146|n),t=Rt.open(i,577),Rt.write(t,r,0,r.length,0,o),Rt.close(t),Rt.chmod(i,n)}return i},Wa:function(t,e,r,n){t=_t("string"==typeof t?t:Rt.Ya(t),e),e=Rt.Eb(!!r,!!n),Rt.Wa.Kb||(Rt.Wa.Kb=64);var i=Rt.bb(Rt.Wa.Kb++,0);return Rt.Qb(i,{open:function(t){t.seekable=!1},close:function(){n&&n.buffer&&n.buffer.length&&n(10)},read:function(t,e,n,i){for(var o=0,a=0;a<i;a++){try{var s=r()}catch(t){throw new Rt.ErrnoError(29)}if(void 0===s&&0===o)throw new Rt.ErrnoError(6);if(null==s)break;o++,e[n+a]=s}return o&&(t.node.timestamp=Date.now()),o},write:function(t,e,r,i){for(var o=0;o<i;o++)try{n(e[r+o])}catch(t){throw new Rt.ErrnoError(29)}return i&&(t.node.timestamp=Date.now()),o}}),Rt.rb(t,e,i)},ac:function(t){if(t.Ib||t.Sc||t.link||t.Na)return!0;if("undefined"!=typeof XMLHttpRequest)throw Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!d)throw Error("Cannot load without read() or XMLHttpRequest.");try{t.Na=Wt(d(t.url),!0),t.Ra=t.Na.length}catch(t){throw new Rt.ErrnoError(29)}},ld:function(t,e,r,n,i){function o(){this.Jb=!1,this.ob=[]}if(o.prototype.get=function(t){if(!(t>this.length-1||0>t)){var e=t%this.chunkSize;return this.dc(t/this.chunkSize|0)[e]}},o.prototype.pc=function(t){this.dc=t},o.prototype.Ub=function(){var t=new XMLHttpRequest;if(t.open("HEAD",r,!1),t.send(null),!(200<=t.status&&300>t.status||304===t.status))throw Error("Couldn't load "+r+". Status: "+t.status);var e,n=Number(t.getResponseHeader("Content-length")),i=(e=t.getResponseHeader("Accept-Ranges"))&&"bytes"===e;t=(e=t.getResponseHeader("Content-Encoding"))&&"gzip"===e;var o=1048576;i||(o=n);var a=this;a.pc((function(t){var e=t*o,i=(t+1)*o-1;if(i=Math.min(i,n-1),void 0===a.ob[t]){var s=a.ob;if(e>i)throw Error("invalid range ("+e+", "+i+") or no bytes requested!");if(i>n-1)throw Error("only "+n+" bytes available! programmer error!");var u=new XMLHttpRequest;if(u.open("GET",r,!1),n!==o&&u.setRequestHeader("Range","bytes="+e+"-"+i),"undefined"!=typeof Uint8Array&&(u.responseType="arraybuffer"),u.overrideMimeType&&u.overrideMimeType("text/plain; charset=x-user-defined"),u.send(null),!(200<=u.status&&300>u.status||304===u.status))throw Error("Couldn't load "+r+". Status: "+u.status);e=void 0!==u.response?new Uint8Array(u.response||[]):Wt(u.responseText||"",!0),s[t]=e}if(void 0===a.ob[t])throw Error("doXHR failed!");return a.ob[t]})),!t&&n||(o=n=1,o=n=this.dc(0).length,E("LazyFiles on gzip forces download of the whole file when length is accessed")),this.tc=n,this.sc=o,this.Jb=!0},"undefined"!=typeof XMLHttpRequest){if(!w)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new o;Object.defineProperties(a,{length:{get:function(){return this.Jb||this.Ub(),this.tc}},chunkSize:{get:function(){return this.Jb||this.Ub(),this.sc}}}),a={Ib:!1,Na:a}}else a={Ib:!1,url:r};var s=Rt.Gc(t,e,a,n,i);a.Na?s.Na=a.Na:a.url&&(s.Na=null,s.url=a.url),Object.defineProperties(s,{Ra:{get:function(){return this.Na.length}}});var u={};return Object.keys(s.stream_ops).forEach((function(t){var e=s.stream_ops[t];u[t]=function(){return Rt.ac(s),e.apply(null,arguments)}})),u.read=function(t,e,r,n,i){if(Rt.ac(s),i>=(t=t.node.Na).length)return 0;if(n=Math.min(t.length-i,n),t.slice)for(var o=0;o<n;o++)e[r+o]=t[i+o];else for(o=0;o<n;o++)e[r+o]=t.get(i+o);return n},s.stream_ops=u,s},nd:function(t,e,r,n,i,o,a,s,c,l){function f(r){function f(r){l&&l(),s||Rt.zb(t,e,r,n,i,c),o&&o(),lt()}var h=!1;u.preloadPlugins.forEach((function(t){!h&&t.canHandle(d)&&(t.handle(r,d,f,(function(){a&&a(),lt()})),h=!0)})),h||f(r)}(void 0).jb();var d=e?vt(_t(t,e)):t;ct(),"string"==typeof r?function(t,e,r){var n="al "+t;h(t,(function(r){N(r,'Loading data file "'+t+'" failed (no arrayBuffer).'),e(new Uint8Array(r)),n&&lt()}),(function(){if(!r)throw'Loading data file "'+t+'" failed.';r()})),n&&ct()}(r,(function(t){f(t)}),a):f(r)},indexedDB:function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},Rb:function(){return"EM_FS_"+window.location.pathname},Sb:20,ib:"FILE_DATA",xd:function(t,e,r){e=e||function(){},r=r||function(){};var n=Rt.indexedDB();try{var i=n.open(Rt.Rb(),Rt.Sb)}catch(t){return r(t)}i.onupgradeneeded=function(){E("creating db"),i.result.createObjectStore(Rt.ib)},i.onsuccess=function(){var n=i.result.transaction([Rt.ib],"readwrite"),o=n.objectStore(Rt.ib),a=0,s=0,u=t.length;t.forEach((function(t){(t=o.put(Rt.xb(t).object.Na,t)).onsuccess=function(){++a+s==u&&(0==s?e():r())},t.onerror=function(){s++,a+s==u&&(0==s?e():r())}})),n.onerror=r},i.onerror=r},rd:function(t,e,r){e=e||function(){},r=r||function(){};var n=Rt.indexedDB();try{var i=n.open(Rt.Rb(),Rt.Sb)}catch(t){return r(t)}i.onupgradeneeded=r,i.onsuccess=function(){var n=i.result;try{var o=n.transaction([Rt.ib],"readonly")}catch(t){return void r(t)}var a=o.objectStore(Rt.ib),s=0,u=0,c=t.length;t.forEach((function(t){var n=a.get(t);n.onsuccess=function(){Rt.xb(t).exists&&Rt.unlink(t),Rt.zb(bt(t),wt(t),n.result,!0,!0,!0),++s+u==c&&(0==u?e():r())},n.onerror=function(){u++,s+u==c&&(0==u?e():r())}})),o.onerror=r},i.onerror=r}},Dt={};function kt(t,e,r){try{var n=t(e)}catch(t){if(t&&t.node&&yt(e)!==yt(Rt.Ya(t.node)))return-54;throw t}return W[r>>2]=n.dev,W[r+4>>2]=0,W[r+8>>2]=n.ino,W[r+12>>2]=n.mode,W[r+16>>2]=n.nlink,W[r+20>>2]=n.uid,W[r+24>>2]=n.gid,W[r+28>>2]=n.rdev,W[r+32>>2]=0,it=[n.size>>>0,(nt=n.size,1<=+Math.abs(nt)?0<nt?(0|Math.min(+Math.floor(nt/4294967296),4294967295))>>>0:~~+Math.ceil((nt-+(~~nt>>>0))/4294967296)>>>0:0)],W[r+40>>2]=it[0],W[r+44>>2]=it[1],W[r+48>>2]=4096,W[r+52>>2]=n.blocks,W[r+56>>2]=n.atime.getTime()/1e3|0,W[r+60>>2]=0,W[r+64>>2]=n.mtime.getTime()/1e3|0,W[r+68>>2]=0,W[r+72>>2]=n.ctime.getTime()/1e3|0,W[r+76>>2]=0,it=[n.ino>>>0,(nt=n.ino,1<=+Math.abs(nt)?0<nt?(0|Math.min(+Math.floor(nt/4294967296),4294967295))>>>0:~~+Math.ceil((nt-+(~~nt>>>0))/4294967296)>>>0:0)],W[r+80>>2]=it[0],W[r+84>>2]=it[1],0}var Nt,Ct=void 0;function xt(){return W[(Ct+=4)-4>>2]}function Lt(t){if(!(t=Rt.$a(t)))throw new Rt.ErrnoError(8);return t}Nt=_?function(){var t=e.hrtime();return 1e3*t[0]+t[1]/1e6}:function(){return performance.now()};var Pt,Bt={};function Ut(){if(!Pt){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:y||"./this.program"};for(t in Bt)void 0===Bt[t]?delete e[t]:e[t]=Bt[t];var r=[];for(t in e)r.push(t+"="+e[t]);Pt=r}return Pt}function Ft(t,e,r,n){t||(t=this),this.parent=t,this.mount=t.mount,this.lb=null,this.id=Rt.Zc++,this.name=e,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=n}function Wt(t,e){var r=Array($(t)+1);return t=G(t,r,0,r.length),e&&(r.length=t),r}Object.defineProperties(Ft.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(t){t?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(t){t?this.mode|=146:this.mode&=-147}},Sc:{get:function(){return Rt.isDir(this.mode)}},Ib:{get:function(){return Rt.pb(this.mode)}}}),Rt.FSNode=Ft,Rt.lc();var Ht={a:function(t,e,r,n){ft("Assertion failed: "+Y(t)+", at: "+[e?Y(e):"unknown filename",r,n?Y(n):"unknown function"])},u:function(t,e){!function(){function t(t){return(t=t.toTimeString().match(/\(([A-Za-z ]+)\)$/))?t[1]:"GMT"}if(!ot){ot=!0;var e=(new Date).getFullYear(),r=new Date(e,0,1),n=new Date(e,6,1);e=r.getTimezoneOffset();var i=n.getTimezoneOffset(),o=Math.max(e,i);W[Kt()>>2]=60*o,W[$t()>>2]=Number(e!=i),r=t(r),n=t(n),r=K(r),n=K(n),i<e?(W[Gt()>>2]=r,W[Gt()+4>>2]=n):(W[Gt()>>2]=n,W[Gt()+4>>2]=r)}}(),t=new Date(1e3*W[t>>2]),W[e>>2]=t.getSeconds(),W[e+4>>2]=t.getMinutes(),W[e+8>>2]=t.getHours(),W[e+12>>2]=t.getDate(),W[e+16>>2]=t.getMonth(),W[e+20>>2]=t.getFullYear()-1900,W[e+24>>2]=t.getDay();var r=new Date(t.getFullYear(),0,1);W[e+28>>2]=(t.getTime()-r.getTime())/864e5|0,W[e+36>>2]=-60*t.getTimezoneOffset();var n=new Date(t.getFullYear(),6,1).getTimezoneOffset();return t=0|(n!=(r=r.getTimezoneOffset())&&t.getTimezoneOffset()==Math.min(r,n)),W[e+32>>2]=t,t=W[Gt()+(t?4:0)>>2],W[e+40>>2]=t,e},m:function(t,e){try{var r;if(t=Y(t),-8&e)var n=-28;else(r=Rt.lookupPath(t,{Ta:!0}).node)?(t="",4&e&&(t+="r"),2&e&&(t+="w"),1&e&&(t+="x"),n=t&&Rt.Za(r,t)?-2:0):n=-44;return n}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},A:function(t,e){try{return t=Y(t),Rt.chmod(t,e),0}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},H:function(t,e,r){try{return t=Y(t),Rt.chown(t,e,r),0}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},B:function(t,e){try{return Rt.fchmod(t,e),0}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},I:function(t,e,r){try{return Rt.fchown(t,e,r),0}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},b:function(t,e,r){Ct=r;try{var n=Lt(t);switch(e){case 0:var i=xt();return 0>i?-28:Rt.open(n.path,n.flags,0,i).fd;case 1:case 2:return 0;case 3:return n.flags;case 4:return i=xt(),n.flags|=i,0;case 12:return i=xt(),F[i+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return W[qt()>>2]=28,-1;default:return-28}}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},E:function(t,e){try{var r=Lt(t);return kt(Rt.stat,r.path,e)}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},n:function(t,e,r){try{return Rt.Nc(t,r),0}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},l:function(t,e){try{if(0===e)return-28;var r=Rt.cwd();return e<$(r)+1?-68:(G(r,U,t,e),t)}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},G:function(){return 0},d:function(){return 42},z:function(t,e){try{return t=Y(t),kt(Rt.lstat,t,e)}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},C:function(t,e){try{return"/"===(t=yt(t=Y(t)))[t.length-1]&&(t=t.substr(0,t.length-1)),Rt.mkdir(t,e,0),0}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},y:function(t,e,r,n,i,o){try{t:{o<<=12;var a=!1;if(0!=(16&n)&&0!=t%65536)var s=-28;else{if(0!=(32&n)){var u=jt(e);if(!u){s=-48;break t}a=!0}else{var c=Rt.$a(i);if(!c){s=-8;break t}var l=Rt.mmap(c,t,e,o,r,n);u=l.ed,a=l.vb}Dt[u]={Uc:u,Tc:e,vb:a,fd:i,dd:r,flags:n,offset:o},s=u}}return s}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},x:function(t,e){try{var r=Dt[t];if(0!==e&&r){if(e===r.Tc){var n=Rt.$a(r.fd);if(n&&2&r.dd){var i=r.flags,o=r.offset,a=U.slice(t,t+e);Rt.msync(n,a,o,e,i)}Dt[t]=null,r.vb&&Vt(r.Uc)}var s=0}else s=-28;return s}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},w:function(t,e,r){Ct=r;try{var n=Y(t),i=r?xt():0;return Rt.open(n,e,i).fd}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},J:function(t,e,r){try{if(t=Y(t),0>=r)var n=-28;else{var i=Rt.readlink(t),o=Math.min(r,$(i)),a=B[e+o];G(i,U,e,r+1),B[e+o]=a,n=o}return n}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},F:function(t){try{return t=Y(t),Rt.rmdir(t),0}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},e:function(t,e){try{return t=Y(t),kt(Rt.stat,t,e)}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},i:function(t){try{return t=Y(t),Rt.unlink(t),0}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),-t.Oa}},v:function(){return 2147483648},p:function(t,e,r){U.copyWithin(t,e,e+r)},c:function(t){var e=U.length;if(2147483648<(t>>>=0))return!1;for(var r=1;4>=r;r*=2){var n=e*(1+.2/r);n=Math.min(n,t+100663296),0<(n=Math.max(t,n))%65536&&(n+=65536-n%65536);t:{try{D.grow(Math.min(2147483648,n)-P.byteLength+65535>>>16),Z();var i=1;break t}catch(t){}i=void 0}if(i)return!0}return!1},t:function(t){for(var e=Nt();Nt()-e<t;);},r:function(t,e){try{var r=0;return Ut().forEach((function(n,i){var o=e+r;for(i=W[t+4*i>>2]=o,o=0;o<n.length;++o)B[i++>>0]=n.charCodeAt(o);B[i>>0]=0,r+=n.length+1})),0}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),t.Oa}},s:function(t,e){try{var r=Ut();W[t>>2]=r.length;var n=0;return r.forEach((function(t){n+=t.length+1})),W[e>>2]=n,0}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),t.Oa}},f:function(t){try{var e=Lt(t);return Rt.close(e),0}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),t.Oa}},q:function(t,e){try{var r=Lt(t),n=r.tty?2:Rt.isDir(r.mode)?3:Rt.fb(r.mode)?7:4;return B[e>>0]=n,0}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),t.Oa}},j:function(t,e,r,n){try{t:{for(var i=Lt(t),o=t=0;o<r;o++){var a=W[e+(8*o+4)>>2],s=Rt.read(i,B,W[e+8*o>>2],a,void 0);if(0>s){var u=-1;break t}if(t+=s,s<a)break}u=t}return W[n>>2]=u,0}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),t.Oa}},o:function(t,e,r,n,i){try{var o=Lt(t);return-9007199254740992>=(t=4294967296*r+(e>>>0))||9007199254740992<=t?-61:(Rt.llseek(o,t,n),it=[o.position>>>0,(nt=o.position,1<=+Math.abs(nt)?0<nt?(0|Math.min(+Math.floor(nt/4294967296),4294967295))>>>0:~~+Math.ceil((nt-+(~~nt>>>0))/4294967296)>>>0:0)],W[i>>2]=it[0],W[i+4>>2]=it[1],o.Fb&&0===t&&0===n&&(o.Fb=null),0)}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),t.Oa}},k:function(t){try{var e=Lt(t);return e.stream_ops&&e.stream_ops.fsync?-e.stream_ops.fsync(e):0}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),t.Oa}},g:function(t,e,r,n){try{t:{for(var i=Lt(t),o=t=0;o<r;o++){var a=Rt.write(i,B,W[e+8*o>>2],W[e+(8*o+4)>>2],void 0);if(0>a){var s=-1;break t}t+=a}s=t}return W[n>>2]=s,0}catch(t){return void 0!==Rt&&t instanceof Rt.ErrnoError||ft(t),t.Oa}},h:function(t){var e=Date.now();return W[t>>2]=e/1e3|0,W[t+4>>2]=e%1e3*1e3|0,0},K:function(t){var e=Date.now()/1e3|0;return t&&(W[t>>2]=e),e},D:function(t,e){if(e){var r=e+8;e=1e3*W[r>>2],e+=W[r+4>>2]/1e3}else e=Date.now();t=Y(t);try{Rt.kd(t,e,e);var n=0}catch(t){if(!(t instanceof Rt.ErrnoError)){t:{if(!(n=Error()).stack){try{throw Error()}catch(t){n=t}if(!n.stack){n="(no stack trace available)";break t}}n=n.stack.toString()}throw u.extraStackTrace&&(n+="\n"+u.extraStackTrace()),t+" : "+(n=function(t){return t.replace(/\b_Z[\w\d_]+/g,(function(t){return t==t?t:t+" ["+t+"]"}))}(n))}n=t.Oa,W[qt()>>2]=n,n=-1}return n}};!function(){function t(t){u.asm=t.exports,D=u.asm.L,Z(),J=u.asm.Da,Q.unshift(u.asm.M),lt()}function e(e){t(e.instance)}function r(t){return function(){if(!T&&(b||w)){if("function"==typeof fetch&&!rt.startsWith("file://"))return fetch(rt,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+rt+"'";return t.arrayBuffer()})).catch((function(){return gt()}));if(h)return new Promise((function(t,e){h(rt,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return gt()}))}().then((function(t){return WebAssembly.instantiate(t,n)})).then(t,(function(t){S("failed to asynchronously prepare wasm: "+t),ft(t)}))}var n={a:Ht};if(ct(),u.instantiateWasm)try{return u.instantiateWasm(n,t)}catch(t){return S("Module.instantiateWasm callback failed with error: "+t),!1}T||"function"!=typeof WebAssembly.instantiateStreaming||dt()||rt.startsWith("file://")||"function"!=typeof fetch?r(e):fetch(rt,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,n).then(e,(function(t){return S("wasm streaming compile failed: "+t),S("falling back to ArrayBuffer instantiation"),r(e)}))}))}(),u.___wasm_call_ctors=function(){return(u.___wasm_call_ctors=u.asm.M).apply(null,arguments)},u._sqlite3_vfs_find=function(){return(u._sqlite3_vfs_find=u.asm.N).apply(null,arguments)},u._sqlite3_free=function(){return(u._sqlite3_free=u.asm.O).apply(null,arguments)};var qt=u.___errno_location=function(){return(qt=u.___errno_location=u.asm.P).apply(null,arguments)};u._sqlite3_finalize=function(){return(u._sqlite3_finalize=u.asm.Q).apply(null,arguments)},u._sqlite3_reset=function(){return(u._sqlite3_reset=u.asm.R).apply(null,arguments)},u._sqlite3_clear_bindings=function(){return(u._sqlite3_clear_bindings=u.asm.S).apply(null,arguments)},u._sqlite3_value_blob=function(){return(u._sqlite3_value_blob=u.asm.T).apply(null,arguments)},u._sqlite3_value_text=function(){return(u._sqlite3_value_text=u.asm.U).apply(null,arguments)},u._sqlite3_value_bytes=function(){return(u._sqlite3_value_bytes=u.asm.V).apply(null,arguments)},u._sqlite3_value_double=function(){return(u._sqlite3_value_double=u.asm.W).apply(null,arguments)},u._sqlite3_value_int=function(){return(u._sqlite3_value_int=u.asm.X).apply(null,arguments)},u._sqlite3_value_type=function(){return(u._sqlite3_value_type=u.asm.Y).apply(null,arguments)},u._sqlite3_result_blob=function(){return(u._sqlite3_result_blob=u.asm.Z).apply(null,arguments)},u._sqlite3_result_double=function(){return(u._sqlite3_result_double=u.asm._).apply(null,arguments)},u._sqlite3_result_error=function(){return(u._sqlite3_result_error=u.asm.$).apply(null,arguments)},u._sqlite3_result_int=function(){return(u._sqlite3_result_int=u.asm.aa).apply(null,arguments)},u._sqlite3_result_int64=function(){return(u._sqlite3_result_int64=u.asm.ba).apply(null,arguments)},u._sqlite3_result_null=function(){return(u._sqlite3_result_null=u.asm.ca).apply(null,arguments)},u._sqlite3_result_text=function(){return(u._sqlite3_result_text=u.asm.da).apply(null,arguments)},u._sqlite3_step=function(){return(u._sqlite3_step=u.asm.ea).apply(null,arguments)},u._sqlite3_column_count=function(){return(u._sqlite3_column_count=u.asm.fa).apply(null,arguments)},u._sqlite3_data_count=function(){return(u._sqlite3_data_count=u.asm.ga).apply(null,arguments)},u._sqlite3_column_blob=function(){return(u._sqlite3_column_blob=u.asm.ha).apply(null,arguments)},u._sqlite3_column_bytes=function(){return(u._sqlite3_column_bytes=u.asm.ia).apply(null,arguments)},u._sqlite3_column_double=function(){return(u._sqlite3_column_double=u.asm.ja).apply(null,arguments)},u._sqlite3_column_text=function(){return(u._sqlite3_column_text=u.asm.ka).apply(null,arguments)},u._sqlite3_column_type=function(){return(u._sqlite3_column_type=u.asm.la).apply(null,arguments)},u._sqlite3_column_name=function(){return(u._sqlite3_column_name=u.asm.ma).apply(null,arguments)},u._sqlite3_bind_blob=function(){return(u._sqlite3_bind_blob=u.asm.na).apply(null,arguments)},u._sqlite3_bind_double=function(){return(u._sqlite3_bind_double=u.asm.oa).apply(null,arguments)},u._sqlite3_bind_int=function(){return(u._sqlite3_bind_int=u.asm.pa).apply(null,arguments)},u._sqlite3_bind_text=function(){return(u._sqlite3_bind_text=u.asm.qa).apply(null,arguments)},u._sqlite3_bind_parameter_index=function(){return(u._sqlite3_bind_parameter_index=u.asm.ra).apply(null,arguments)},u._sqlite3_sql=function(){return(u._sqlite3_sql=u.asm.sa).apply(null,arguments)},u._sqlite3_normalized_sql=function(){return(u._sqlite3_normalized_sql=u.asm.ta).apply(null,arguments)},u._sqlite3_errmsg=function(){return(u._sqlite3_errmsg=u.asm.ua).apply(null,arguments)},u._sqlite3_exec=function(){return(u._sqlite3_exec=u.asm.va).apply(null,arguments)},u._sqlite3_prepare_v2=function(){return(u._sqlite3_prepare_v2=u.asm.wa).apply(null,arguments)},u._sqlite3_changes=function(){return(u._sqlite3_changes=u.asm.xa).apply(null,arguments)},u._sqlite3_close_v2=function(){return(u._sqlite3_close_v2=u.asm.ya).apply(null,arguments)},u._sqlite3_create_function_v2=function(){return(u._sqlite3_create_function_v2=u.asm.za).apply(null,arguments)},u._sqlite3_open=function(){return(u._sqlite3_open=u.asm.Aa).apply(null,arguments)};var zt=u._malloc=function(){return(zt=u._malloc=u.asm.Ba).apply(null,arguments)},Vt=u._free=function(){return(Vt=u._free=u.asm.Ca).apply(null,arguments)};u._RegisterExtensionFunctions=function(){return(u._RegisterExtensionFunctions=u.asm.Ea).apply(null,arguments)},u._register_for_idb=function(){return(u._register_for_idb=u.asm.Fa).apply(null,arguments)};var Yt,Gt=u.__get_tzname=function(){return(Gt=u.__get_tzname=u.asm.Ga).apply(null,arguments)},$t=u.__get_daylight=function(){return($t=u.__get_daylight=u.asm.Ha).apply(null,arguments)},Kt=u.__get_timezone=function(){return(Kt=u.__get_timezone=u.asm.Ia).apply(null,arguments)},Zt=u.stackSave=function(){return(Zt=u.stackSave=u.asm.Ja).apply(null,arguments)},Jt=u.stackRestore=function(){return(Jt=u.stackRestore=u.asm.Ka).apply(null,arguments)},Xt=u.stackAlloc=function(){return(Xt=u.stackAlloc=u.asm.La).apply(null,arguments)},Qt=u._memalign=function(){return(Qt=u._memalign=u.asm.Ma).apply(null,arguments)};function te(){function t(){if(!Yt&&(Yt=!0,u.calledRun=!0,!k)){if(u.noFSInit||Rt.jb.Hb||Rt.jb(),Rt.hc=!1,pt(Q),u.onRuntimeInitialized&&u.onRuntimeInitialized(),u.postRun)for("function"==typeof u.postRun&&(u.postRun=[u.postRun]);u.postRun.length;){var t=u.postRun.shift();tt.unshift(t)}pt(tt)}}if(!(0<at)){if(u.preRun)for("function"==typeof u.preRun&&(u.preRun=[u.preRun]);u.preRun.length;)et();pt(X),0<at||(u.setStatus?(u.setStatus("Running..."),setTimeout((function(){setTimeout((function(){u.setStatus("")}),1),t()}),1)):t())}}if(u.cwrap=function(t,e,r,n){var i=(r=r||[]).every((function(t){return"number"===t}));return"string"!==e&&i&&!n?C(t):function(){return x(t,e,r,arguments)}},u.UTF8ToString=Y,u.FS=Rt,u.stackSave=Zt,u.stackRestore=Jt,u.stackAlloc=Xt,ut=function t(){Yt||te(),Yt||(ut=t)},u.run=te,u.preInit)for("function"==typeof u.preInit&&(u.preInit=[u.preInit]);0<u.preInit.length;)u.preInit.pop()();return te(),u})))};t.exports=a,t.exports.default=a}).call(this,r(95)(t),r(20),"/",r(14).Buffer)},function(t,e,r){!function(){function e(t,e){var r,n,i,o,a,s,u,c;for(r=3&t.length,n=t.length-r,i=e,a=3432918353,s=461845907,c=0;c<n;)u=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,i=27492+(65535&(o=5*(65535&(i=(i^=u=(65535&(u=(u=(65535&u)*a+(((u>>>16)*a&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(u=0,r){case 3:u^=(255&t.charCodeAt(c+2))<<16;case 2:u^=(255&t.charCodeAt(c+1))<<8;case 1:i^=u=(65535&(u=(u=(65535&(u^=255&t.charCodeAt(c)))*a+(((u>>>16)*a&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}var r=e;r.v2=function(t,e){for(var r,n=t.length,i=e^n,o=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++o;switch(n){case 3:i^=(255&t.charCodeAt(o+2))<<16;case 2:i^=(255&t.charCodeAt(o+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(o)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0},r.v3=e,t.exports=r}()},function(t,e,r){const n=r(422),i=r(423);let o="[0-9A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶ-ͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԣԱ-Ֆՙա-ևא-תװ-ײء-يٮ-ٯٱ-ۓەۥ-ۦۮ-ۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴ-ߵߺऄ-हऽॐक़-ॡॱ-ॲॻ-ॿঅ-ঌএ-ঐও-নপ-রলশ-হঽৎড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલ-ળવ-હઽૐૠ-ૡଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହଽଡ଼-ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘ-ౙౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹഽൠ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะา-ำเ-ๆກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ະາ-ຳຽເ-ໄໆໜ-ໝༀཀ-ཇཉ-ཬྈ-ྋက-ဪဿၐ-ၕၚ-ၝၡၥ-ၦၮ-ၰၵ-ႁႎႠ-Ⴥა-ჺჼᄀ-ᅙᅟ-ᆢᆨ-ᇹሀ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙶᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦩᧁ-ᧇᨀ-ᨖᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮ-ᮯᰀ-ᰣᱍ-ᱏᱚ-ᱽᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₔℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-Ɐⱱ-ⱽⲀ-ⳤⴀ-ⴥⴰ-ⵥⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆷㇰ-ㇿ㐀䶵一鿃ꀀ-ꒌꔀ-ꘌꘐ-ꘟꘪ-ꘫꙀ-ꙟꙢ-ꙮꙿ-ꚗꜗ-ꜟꜢ-ꞈꞋ-ꞌꟻ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꤊ-ꤥꤰ-ꥆꨀ-ꨨꩀ-ꩂꩄ-ꩋ가힣豈-鶴侮-頻並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]",a=new RegExp(`(?:(?:(\\s?(?:^|[.\\(\\)!?;:"-])\\s*)(${o}))|(${o}))(${o}*[’']*${o}*)`,"g");t.exports=(t,e={})=>{t=t.toLowerCase().replace(a,(t,e="",r,i,o)=>{const a=function(t){const e=t[0];return/\s/.test(e)?t.substr(1):/[()]/.test(e)?null:t}(t);if(!a)return t;if(!r){const t=i+o;if(n.has(t))return a}return e+(i||r).toUpperCase()+o});const r=e.special||[];return(t=>t.map(t=>[new RegExp(`\\b${t}\\b`,"gi"),t]))([...i,...r]).forEach(([e,r])=>{t=t.replace(e,r)}),t}},function(t,e,r){(function(e){const n=r(426);t.exports=function(t,r={}){"string"==typeof t&&(t=e.from(t));const i=r&&r.objname?{}:[],o=new n.Parser(r);o.push=function(t){null!==t&&(void 0===r.objname?i.push(t):i[t[0]]=t[1])};const a=o.__parse(t,!1);if(void 0!==a)throw a;const s=o.__parse(void 0,!0);if(void 0!==s)throw s;return i}}).call(this,r(14).Buffer)},function(t,e,r){"use strict";var n=r(56),i=r(6),o=r(16),a=r(32);let s=Object(n.a)();s.method("budget/budget-amount",Object(i.mutator)(Object(o.e)(a.i))),s.method("budget/copy-previous-month",Object(i.mutator)(Object(o.e)(a.a))),s.method("budget/set-zero",Object(i.mutator)(Object(o.e)(a.l))),s.method("budget/set-3month-avg",Object(i.mutator)(Object(o.e)(a.g))),s.method("budget/set-all-future",Object(i.mutator)(Object(o.e)(a.h))),s.method("budget/hold-for-next-month",Object(i.mutator)(Object(o.e)(a.e))),s.method("budget/hold-for-future-months",Object(i.mutator)(Object(o.e)(a.d))),s.method("budget/reset-hold",Object(i.mutator)(Object(o.e)(a.f))),s.method("budget/cover-overspending",Object(i.mutator)(Object(o.e)(a.b))),s.method("budget/transfer-available",Object(i.mutator)(Object(o.e)(a.m))),s.method("budget/transfer-category",Object(i.mutator)(Object(o.e)(a.n))),s.method("budget/set-carryover",Object(i.mutator)(Object(o.e)(a.k))),e.a=s},function(t,e,r){"use strict";var n=r(56),i=r(1);let o=Object(n.a)();o.method("notes-save",async({id:t,note:e})=>{await i.update("notes",{id:t,note:e})}),e.a=o},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(9),i=r(8);function o(t,e){e.forEach((e,r)=>{if("transactions"===r){t.get(r);let o=[];e.forEach(t=>{if(1===t.isChild&&null==t.parent_id&&t.id.includes("/")){let e=t.id.split("/")[0];o.push({dataset:"transactions",row:t.id,column:"parent_id",value:e,timestamp:n.a.send()})}}),o.length>0&&Object(i.b)(o)}})}let a=null;function s(){a&&(a(),a=null),a=Object(i.a)(o)}},function(t,e,r){"use strict";var n=r(64),i=r(56),o=r(1),a=r(6);let s=Object(i.a)();s.method("tools/fix-split-transactions",async()=>{let t=await o.all("\n SELECT t.*, p.payee AS parentPayee FROM v_transactions_internal t\n LEFT JOIN v_transactions_internal p ON t.parent_id = p.id\n WHERE t.is_child = 1 AND t.payee IS NULL AND p.payee IS NOT NULL\n ");await Object(a.runMutator)(async()=>{let e=t.map(t=>({id:t.id,payee:t.parentPayee}));await Object(n.a)({updated:e})});let e=await o.all("\n SELECT t.id, p.cleared FROM v_transactions_internal t\n LEFT JOIN v_transactions_internal p ON t.parent_id = p.id\n WHERE t.is_child = 1 AND t.cleared != p.cleared\n ");await Object(a.runMutator)(async()=>{let t=e.map(t=>({id:t.id,cleared:1===t.cleared}));await Object(n.a)({updated:t})});let r=await o.all("\n SELECT t.* FROM v_transactions_internal t\n LEFT JOIN v_transactions_internal p ON t.parent_id = p.id\n WHERE t.is_child = 1 AND t.tombstone = 0 AND (p.tombstone = 1 OR p.id IS NULL)\n ");return await Object(a.runMutator)(async()=>{let t=r.map(t=>({id:t.id,tombstone:1}));await Object(n.a)({updated:t})}),{numBlankPayees:t.length,numCleared:e.length,numDeleted:r.length}}),e.a=s},function(t,e,r){var n,i,o,a,s;n=r(456),i=r(258).utf8,o=r(457),a=r(258).bin,(s=function(t,e){t.constructor==String?t=e&&"binary"===e.encoding?a.stringToBytes(t):i.stringToBytes(t):o(t)?t=Array.prototype.slice.call(t,0):Array.isArray(t)||t.constructor===Uint8Array||(t=t.toString());for(var r=n.bytesToWords(t),u=8*t.length,c=1732584193,l=-271733879,f=-1732584194,d=271733878,h=0;h<r.length;h++)r[h]=16711935&(r[h]<<8|r[h]>>>24)|4278255360&(r[h]<<24|r[h]>>>8);r[u>>>5]|=128<<u%32,r[14+(u+64>>>9<<4)]=u;var g=s._ff,p=s._gg,m=s._hh,y=s._ii;for(h=0;h<r.length;h+=16){var b=c,w=l,_=f,v=d;c=g(c,l,f,d,r[h+0],7,-680876936),d=g(d,c,l,f,r[h+1],12,-389564586),f=g(f,d,c,l,r[h+2],17,606105819),l=g(l,f,d,c,r[h+3],22,-1044525330),c=g(c,l,f,d,r[h+4],7,-176418897),d=g(d,c,l,f,r[h+5],12,1200080426),f=g(f,d,c,l,r[h+6],17,-1473231341),l=g(l,f,d,c,r[h+7],22,-45705983),c=g(c,l,f,d,r[h+8],7,1770035416),d=g(d,c,l,f,r[h+9],12,-1958414417),f=g(f,d,c,l,r[h+10],17,-42063),l=g(l,f,d,c,r[h+11],22,-1990404162),c=g(c,l,f,d,r[h+12],7,1804603682),d=g(d,c,l,f,r[h+13],12,-40341101),f=g(f,d,c,l,r[h+14],17,-1502002290),c=p(c,l=g(l,f,d,c,r[h+15],22,1236535329),f,d,r[h+1],5,-165796510),d=p(d,c,l,f,r[h+6],9,-1069501632),f=p(f,d,c,l,r[h+11],14,643717713),l=p(l,f,d,c,r[h+0],20,-373897302),c=p(c,l,f,d,r[h+5],5,-701558691),d=p(d,c,l,f,r[h+10],9,38016083),f=p(f,d,c,l,r[h+15],14,-660478335),l=p(l,f,d,c,r[h+4],20,-405537848),c=p(c,l,f,d,r[h+9],5,568446438),d=p(d,c,l,f,r[h+14],9,-1019803690),f=p(f,d,c,l,r[h+3],14,-187363961),l=p(l,f,d,c,r[h+8],20,1163531501),c=p(c,l,f,d,r[h+13],5,-1444681467),d=p(d,c,l,f,r[h+2],9,-51403784),f=p(f,d,c,l,r[h+7],14,1735328473),c=m(c,l=p(l,f,d,c,r[h+12],20,-1926607734),f,d,r[h+5],4,-378558),d=m(d,c,l,f,r[h+8],11,-2022574463),f=m(f,d,c,l,r[h+11],16,1839030562),l=m(l,f,d,c,r[h+14],23,-35309556),c=m(c,l,f,d,r[h+1],4,-1530992060),d=m(d,c,l,f,r[h+4],11,1272893353),f=m(f,d,c,l,r[h+7],16,-155497632),l=m(l,f,d,c,r[h+10],23,-1094730640),c=m(c,l,f,d,r[h+13],4,681279174),d=m(d,c,l,f,r[h+0],11,-358537222),f=m(f,d,c,l,r[h+3],16,-722521979),l=m(l,f,d,c,r[h+6],23,76029189),c=m(c,l,f,d,r[h+9],4,-640364487),d=m(d,c,l,f,r[h+12],11,-421815835),f=m(f,d,c,l,r[h+15],16,530742520),c=y(c,l=m(l,f,d,c,r[h+2],23,-995338651),f,d,r[h+0],6,-198630844),d=y(d,c,l,f,r[h+7],10,1126891415),f=y(f,d,c,l,r[h+14],15,-1416354905),l=y(l,f,d,c,r[h+5],21,-57434055),c=y(c,l,f,d,r[h+12],6,1700485571),d=y(d,c,l,f,r[h+3],10,-1894986606),f=y(f,d,c,l,r[h+10],15,-1051523),l=y(l,f,d,c,r[h+1],21,-2054922799),c=y(c,l,f,d,r[h+8],6,1873313359),d=y(d,c,l,f,r[h+15],10,-30611744),f=y(f,d,c,l,r[h+6],15,-1560198380),l=y(l,f,d,c,r[h+13],21,1309151649),c=y(c,l,f,d,r[h+4],6,-145523070),d=y(d,c,l,f,r[h+11],10,-1120210379),f=y(f,d,c,l,r[h+2],15,718787259),l=y(l,f,d,c,r[h+9],21,-343485551),c=c+b>>>0,l=l+w>>>0,f=f+_>>>0,d=d+v>>>0}return n.endian([c,l,f,d])})._ff=function(t,e,r,n,i,o,a){var s=t+(e&r|~e&n)+(i>>>0)+a;return(s<<o|s>>>32-o)+e},s._gg=function(t,e,r,n,i,o,a){var s=t+(e&n|r&~n)+(i>>>0)+a;return(s<<o|s>>>32-o)+e},s._hh=function(t,e,r,n,i,o,a){var s=t+(e^r^n)+(i>>>0)+a;return(s<<o|s>>>32-o)+e},s._ii=function(t,e,r,n,i,o,a){var s=t+(r^(e|~n))+(i>>>0)+a;return(s<<o|s>>>32-o)+e},s._blocksize=16,s._digestsize=16,t.exports=function(t,e){if(null==t)throw new Error("Illegal argument "+t);var r=n.wordsToBytes(s(t,e));return e&&e.asBytes?r:e&&e.asString?a.bytesToString(r):n.bytesToHex(r)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return b}));var n=r(277),i=r.n(n),o=r(12),a=r(1);function s(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return u(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return u(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var c=r(4),l=r.n(c),f=r(13);const d=r(41);let h=l.a.migrationsPath,g={1632571489012:async function(t,e){function r(t){return null!=t.expr?t.expr:t.cachedValue}t.execQuery("\nCREATE TABLE zero_budget_months\n (id TEXT PRIMARY KEY,\n buffered INTEGER DEFAULT 0); \n\nCREATE TABLE zero_budgets\n (id TEXT PRIMARY KEY,\n month INTEGER,\n category TEXT,\n amount INTEGER DEFAULT 0,\n carryover INTEGER DEFAULT 0);\n\nCREATE TABLE reflect_budgets\n (id TEXT PRIMARY KEY,\n month INTEGER,\n category TEXT,\n amount INTEGER DEFAULT 0,\n carryover INTEGER DEFAULT 0);\n\nCREATE TABLE notes\n (id TEXT PRIMARY KEY,\n note TEXT);\n\nCREATE TABLE kvcache (key TEXT PRIMARY KEY, value TEXT);\nCREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);\n");let n=t.runQuery("SELECT * FROM spreadsheet_cells WHERE name LIKE 'budget%!budget-%'",[],!0);t.transaction(()=>{n.map(e=>{let n=e.name.match(/^(budget-report|budget)(\d+)!budget-(.+)$/);if(null==n)return void console.log("Warning: invalid budget month name",e.name);let i=n[1],o=n[2].slice(0,4)+"-"+n[2].slice(4),a=parseInt(n[2]),s=n[3],u=parseInt(r(e));isNaN(u)&&(u=0);let c=e.name.split("!")[0],l=t.runQuery("SELECT * FROM spreadsheet_cells WHERE name = ?",[`${c}!carryover-${s}`],!0),f="budget-report"===i?"reflect_budgets":"zero_budgets";t.runQuery(`INSERT INTO ${f} (id, month, category, amount, carryover) VALUES (?, ?, ?, ?, ?)`,[`${o}-${s}`,a,s,u,l.length>0&&"true"===r(l[0])?1:0])})});let i=t.runQuery("SELECT * FROM spreadsheet_cells WHERE name LIKE 'budget%!buffered'",[],!0);t.transaction(()=>{i.map(e=>{let n=e.name.match(/^budget(\d+)!buffered$/);if(n){let i=n[1].slice(0,4)+"-"+n[1].slice(4),o=parseInt(r(e));isNaN(o)&&(o=0),t.runQuery("INSERT INTO zero_budget_months (id, buffered) VALUES (?, ?)",[i,o])}})});let o=t.runQuery("SELECT * FROM spreadsheet_cells WHERE name LIKE 'notes!%'",[],!0);t.transaction(()=>{o.forEach(e=>{let n=(t=>{try{let e=JSON.parse(t);return e&&""!==e?e:null}catch(t){return null}})(r(e));if(n){let r=s(e.name.split("!"),2)[1];t.runQuery("INSERT INTO notes (id, note) VALUES (?, ?)",[r,n])}})}),t.execQuery("\n DROP TABLE spreadsheet_cells;\n ANALYZE;\n VACUUM;\n ")}};function p(t){return parseInt(t.match(/^(\d)+/)[0])}async function m(t,e,r){const n=await l.a.readFile(l.a.join(r,e));e.match(/\.js$/)?await async function(t,e){const r={runQuery:(e,r,n)=>f.runQuery(t,e,r,n),execQuery:e=>f.execQuery(t,e),transaction:e=>f.transaction(t,e)};if(null==g[e])throw new Error("Could not find JS migration code to run for "+e);return(0,g[e])(r,()=>d.v4Sync())}(t,p(e)):await async function(t,e){try{await f.execQuery(t,e)}catch(t){throw console.log("Error applying sql:",e),t}}(t,n),await f.runQuery(t,"INSERT INTO __migrations__ (id) VALUES (?)",[p(e)])}async function y(t){let e=await async function(t){return(await f.runQuery(t,"SELECT * FROM __migrations__ ORDER BY id ASC",[],!0)).map(t=>t.id)}(t),r=await async function(t){return(await l.a.listDir(t)).filter(t=>t.match(/(\.sql|\.js)$/)).sort((t,e)=>{const r=p(t),n=p(e);return r<n?-1:r>n?1:0})}(h);!function(t,e){for(let r=0;r<t.length;r++)if(r>=e.length||t[r]!==p(e[r]))throw new Error("out-of-sync-migrations")}(e,r);const n=function(t,e){return e.filter(e=>{const r=p(e);return-1===t.indexOf(r)})}(e,r);for(let e of n)await m(t,e,h);return n}async function b(){await async function(){await y(a.getDatabase())}(),await async function(){let t=(await a.first("SELECT value FROM __meta__ WHERE key = ?",["view-hash"])||{}).value,e=Object(o.e)(o.h,o.i),r=i()(e);t!==r&&(await a.execQuery(e),await a.runQuery("INSERT OR REPLACE INTO __meta__ (key, value) VALUES (?, ?)",["view-hash",r]))}()}},function(t,e,r){"use strict";r.d(e,"a",(function(){return c}));var n=r(272),i=r.n(n),o=r(4),a=r.n(o),s=r(2),u=r(15);function c(t,e){let n=[],o=t.match(/\.[^.]*$/);if(o){switch(o[0].toLowerCase()){case".qif":return async function(t){let e,r=[],n=await a.a.readFile(t);try{e=function(t,e){var r=t.split("\n"),n=r.shift(),i=/!Type:([^$]*)$/.exec(n.trim()),o={},a=o.transactions=[],s={};if(e=e||{},!i||!i.length)throw new Error("File does not appear to be a valid qif file: "+n);o.type=i[1];for(var u={};n=r.shift();)if("^"!==(n=n.trim()))switch(n[0]){case"D":s.date=n.substring(1);break;case"T":s.amount=n.substring(1);break;case"N":s.number=n.substring(1);break;case"M":s.memo=n.substring(1);break;case"A":s.address=(s.address||[]).concat(n.substring(1));break;case"P":s.payee=n.substring(1).replace(/&amp;/g,"&");break;case"L":var c=n.substring(1).split(":");s.category=c[0],void 0!==c[1]&&(s.subcategory=c[1]);break;case"C":s.clearedStatus=n.substring(1);break;case"S":var l=n.substring(1).split(":");u.category=l[0],void 0!==l[1]&&(u.subcategory=l[1]);break;case"E":u.description=n.substring(1);break;case"$":u.amount=parseFloat(n.substring(1)),s.division instanceof Array||(s.division=[]),s.division.push(u),u={};break;default:throw new Error("Unknown Detail Code: "+n[0])}else a.push(s),s={};return Object.keys(s).length&&a.push(s),o.dateFormat=e.dateFormat,o}(n)}catch(t){return r.push({message:"Failed parsing: doesn't look like a valid QIF file.",internal:t.stack}),{errors:r,transactions:[]}}return{errors:r,transactions:e.transactions.map(t=>({amount:null!=t.amount?Object(u.m)(t.amount):null,date:t.date,payee_name:t.payee,imported_payee:t.payee,notes:t.memo||null}))}}(t);case".csv":return async function(t,e={}){let r,n=[],o=await a.a.readFile(t);try{r=i()(o,{columns:!0,bom:!0,delimiter:e.delimiter||",",quote:'"',trim:!0,relax_column_count:!0})}catch(t){return n.push({message:"Failed parsing: "+t.message,internal:t.message}),{errors:n,transactions:[]}}return{errors:n,transactions:r}}(t,e);case".ofx":case".qfx":return async function(t){let e=await r.e("xfo").then(r.t.bind(null,482,7)),n=e.getOFXTransactions,i=e.initModule;await i();let o,u=[],c=await a.a.readFile(t);try{o=n(c)}catch(t){return u.push({message:"Failed importing file",internal:t.stack}),{errors:u}}return{errors:u,transactions:o.map(t=>({amount:t.amount,imported_id:t.fi_id,date:t.date?Object(s.f)(1e3*t.date):null,payee_name:t.name,imported_payee:t.name,notes:t.memo||null}))}}(t)}}return n.push({message:"Invalid file type",internal:""}),{errors:n}}},function(t,e,r){"use strict";var n=r(2),i=r(27),o=r(73),a=r(15),s=r(38),u=r(18);const c=["group_id"],l=["tombstone"];function f(t,e){if(null==t)return{};var r,n,i=function(t,e){if(null==t)return{};var r,n,i={},o=Object.keys(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||(i[r]=t[r]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}function d(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?d(Object(r),!0).forEach((function(e){g(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function g(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}h(h({},u.i),{},{toExternal:(t,e,r)=>t,fromExternal(t){let e={};return"id"in t&&(e.id=t.id),"account_id"in t&&(e.acct=t.account_id),"amount"in t&&(e.amount=t.amount),"payee_id"in t&&(e.description=t.payee_id),"imported_payee"in t&&(e.imported_description=t.imported_payee),"category_id"in t&&(e.category=t.category_id),"date"in t&&(e.date=t.date),"notes"in t&&(e.notes=t.notes),"imported_id"in t&&(e.financial_id=t.imported_id),"transfer_id"in t&&(e.transferred_id=t.transfer_id),"cleared"in t&&(e.cleared=t.cleared),e}});const p=h(h({},u.a),{},{toExternal:t=>({id:t.id,name:t.name,type:t.type,offbudget:!!t.offbudget,closed:!!t.closed}),fromExternal(t){let e=h({},t);return"offbudget"in t&&(e.offbudget=t.offbudget?1:0),"closed"in t&&(e.closed=t.closed?1:0),e}}),m=h(h({},u.c),{},{toExternal:t=>({id:t.id,name:t.name,is_income:!!t.is_income,group_id:t.cat_group}),fromExternal(t){t.group_id;let e=f(t,c);return"is_income"in t&&(e.is_income=t.is_income?1:0),"group_id"in t&&(e.cat_group=t.group_id),e}}),y=h(h({},u.b),{},{toExternal:t=>({id:t.id,name:t.name,is_income:!!t.is_income,categories:t.categories.map(m.toExternal)}),fromExternal(t){let e=h({},t);return"is_income"in t&&(e.is_income=t.is_income?1:0),"categories"in t&&(e.categories=t.categories.map(m.fromExternal)),e}}),b=h(h({},u.e),{},{toExternal:t=>({id:t.id,name:t.name,category:t.category,transfer_acct:t.transfer_acct}),fromExternal:t=>t}),w=h(h({},u.f),{},{toExternal(t){t.tombstone;return f(t,l)},fromExternal:t=>t});var _=r(12),v=r(33),E=r(9),S=r(1),O=r(6),T=r(7),A=r(5),M=r(8);function j(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function I(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?j(Object(r),!0).forEach((function(e){R(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function R(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const D=r(49);let k=!1;function N(t,e){return{type:"APIError",message:t,meta:e}}function C(t){return e=>Object(O.runMutator)(async()=>{let r=Object(E.c)().timestamp.toString(),n=await t(e),i=await S.all("SELECT DISTINCT dataset FROM messages_crdt WHERE timestamp > ?",[r]);return D.getNumClients()>1&&D.send("sync-event",{type:"success",tables:i.map(t=>t.dataset)}),n},{undoDisabled:!0})}let x={};async function L(t){if(!t.match(/^\d{4}-\d{2}$/))throw N("Invalid month format, use YYYY-MM: "+t);if(!k){let e=await x["get-budget-bounds"](),r=e.start,i=e.end;if(!n.n(r,i).includes(t))throw N("No budget exists for month: "+t)}}let P=null;x["api/batch-budget-start"]=async function(){if(P)throw N("Cannot start a batch process: batch already started");k?S.asyncTransaction(()=>new Promise((t,e)=>{P={resolve:t,reject:e}})):Object(M.c)(()=>new Promise((t,e)=>{P={resolve:t,reject:e}}))},x["api/batch-budget-end"]=async function(){if(!P)throw N("Cannot end a batch process: no batch started");P.resolve(),P=null},x["api/load-budget"]=async function({id:t}){if((T.b()||{}).id!==t){D.send("start-load");let e=(await x["load-budget"]({id:t})).error;if(e)throw D.send("show-budgets"),"out-of-sync-migrations"===e||"out-of-sync-data"===e?new Error("This budget cannot be loaded with this version of the app."):"budget-not-found"===e?new Error('Budget "'+t+'" not found. Check the id of your budget in the "Advanced" section of the settings page.'):new Error('We had an unknown problem opening "'+t+'".');D.send("finish-load")}},x["api/start-import"]=async function({budgetName:t}){await x["close-budget"](),await x["create-budget"]({budgetName:t,avoidUpload:!0}),await S.runQuery("DELETE FROM categories WHERE is_income = 0"),await S.runQuery("DELETE FROM category_groups WHERE is_income = 0"),Object(M.k)("import"),D.send("start-import"),k=!0},x["api/finish-import"]=async function(){A.b().markCacheDirty();let t=T.b().id;await x["close-budget"](),await x["load-budget"]({id:t}),await x["get-budget-bounds"](),await A.j(),await v.i().catch(t=>{}),D.send("finish-import"),k=!1},x["api/abort-import"]=async function(){if(k){let t=T.b().id;await x["close-budget"](),await x["delete-budget"]({id:t}),D.send("show-budgets")}k=!1},x["api/query"]=async function({query:t}){return Object(_.g)(t)},x["api/budget-months"]=async function(){let t=await x["get-budget-bounds"](),e=t.start,r=t.end;return n.n(e,r)},x["api/budget-month"]=async function({month:t}){await L(t);let e=await S.getCategoriesGrouped(),r=n.p(t);function i(t){let e=A.b().getCellValue(r,t);return""===e?0:e}return{month:t,incomeAvailable:i("available-funds"),lastMonthOverspent:i("last-month-overspent"),forNextMonth:i("buffered"),totalBudgeted:i("total-budgeted"),toBudget:i("to-budget"),fromLastMonth:i("from-last-month"),totalIncome:i("total-income"),totalSpent:i("total-spent"),totalBalance:i("total-leftover"),categoryGroups:e.map(t=>t.is_income?I(I({},y.toExternal(t)),{},{received:i("total-income"),categories:t.categories.map(t=>I(I({},m.toExternal(t)),{},{received:i("sum-amount-"+t.id)}))}):I(I({},y.toExternal(t)),{},{budgeted:i("group-budget-"+t.id),spent:i("group-sum-amount-"+t.id),balance:i("group-leftover-"+t.id),categories:t.categories.map(t=>I(I({},m.toExternal(t)),{},{budgeted:i("budget-"+t.id),spent:i("sum-amount-"+t.id),balance:i("leftover-"+t.id),carryover:i("carryover-"+t.id)}))}))}},x["api/budget-set-amount"]=C((async function({month:t,categoryId:e,amount:r}){return x["budget/budget-amount"]({month:t,category:e,amount:r})})),x["api/budget-set-carryover"]=C((async function({month:t,categoryId:e,flag:r}){return await L(t),await async function(t,e){if(null==e)throw N(t+": category id is required");let r=await S.first("SELECT is_income FROM categories WHERE id = ?",[e]);if(!r)throw N(`${t}: category "${e}" does not exist`);if(0!==r.is_income)throw N(`${t}: category "${e}" is not an expense category`)}("budget-set-carryover",e),x["budget/set-carryover"]({startMonth:t,category:e,flag:r})})),x["api/transactions-export"]=async function({transactions:t,categoryGroups:e,payees:r}){return x["transactions-export"]({transactions:t,categoryGroups:e,payees:r})},x["api/transactions-import"]=C((async function({accountId:t,transactions:e}){return x["transactions-import"]({accountId:t,transactions:e})})),x["api/transactions-add"]=C((async function({accountId:t,transactions:e}){return await Object(s.a)(t,e,{runTransfers:!1}),"ok"})),x["api/transactions-get"]=async function({accountId:t,startDate:e,endDate:r}){return(await Object(_.g)(Object(i.b)("transactions").filter({$and:[t&&{account:t},e&&{date:{$gte:e}},r&&{date:{$lte:r}}].filter(Boolean)}).select("*").options({splits:"grouped"}))).data},x["api/transactions-filter"]=async function({text:t,accountId:e}){throw new Error("`filterTransactions` is deprecated, use `runQuery` instead")},x["api/transaction-update"]=C((async function({id:t,fields:e}){let r=(await Object(_.g)(Object(i.b)("transactions").filter({id:t}).select("*").options({splits:"grouped"}))).data,n=Object(o.d)(r);if(0===n.length)return[];let a=Object(o.e)(n,e).diff;return x["transactions-batch-update"](a)})),x["api/transaction-delete"]=C((async function({id:t}){let e=(await Object(_.g)(Object(i.b)("transactions").filter({id:t}).select("*").options({splits:"grouped"}))).data,r=Object(o.d)(e);if(0===r.length)return[];let n=Object(o.a)(r,t).diff;return x["transactions-batch-update"](n)})),x["api/accounts-get"]=async function(){return(await S.getAccounts()).map(t=>p.toExternal(t))},x["api/account-create"]=C((async function({account:t,initialBalance:e=null}){return x["account-create"]({name:t.name,type:t.type,offBudget:t.offbudget,closed:t.closed,balance:null!=e?Object(a.k)(e):null})})),x["api/account-update"]=C((async function({id:t,fields:e}){return S.updateAccount(I({id:t},p.fromExternal(e)))})),x["api/account-close"]=C((async function({id:t,transferAccountId:e,transferCategoryId:r}){return x["account-close"]({id:t,transferAccountId:e,categoryId:r})})),x["api/account-reopen"]=C((async function({id:t}){return x["account-reopen"]({id:t})})),x["api/account-delete"]=C((async function({id:t}){return x["account-close"]({id:t,forced:!0})})),x["api/categories-get"]=async function({grouped:t}={}){let e=await x["get-categories"]();return t?e.grouped.map(y.toExternal):e.list.map(m.toExternal)},x["api/category-group-create"]=C((async function({group:t}){return x["category-group-create"]({name:t.name})})),x["api/category-group-update"]=C((async function({id:t,fields:e}){return x["category-group-update"](I({id:t},y.fromExternal(e)))})),x["api/category-group-delete"]=C((async function({id:t,transferCategoryId:e}){return x["category-group-delete"]({id:t,transferId:e})})),x["api/category-create"]=C((async function({category:t}){return x["category-create"]({name:t.name,groupId:t.group_id,isIncome:t.is_income})})),x["api/category-update"]=C((async function({id:t,fields:e}){return x["category-update"](I({id:t},m.fromExternal(e)))})),x["api/category-delete"]=C((async function({id:t,transferCategoryId:e}){return x["category-delete"]({id:t,transferId:e})})),x["api/payees-get"]=async function(){return(await x["payees-get"]()).map(b.toExternal)},x["api/payee-create"]=C((async function({payee:t}){return x["payee-create"]({name:t.name})})),x["api/payee-update"]=C((async function({id:t,fields:e}){return x["payees-batch-change"]({updated:[I({id:t},b.fromExternal(e))]})})),x["api/payee-delete"]=C((async function({id:t}){return x["payees-batch-change"]({deleted:[{id:t}]})})),x["api/payee-rules-get"]=async function({payeeId:t}){return(await x["payees-get-rules"]({id:t})).map(w.toExternal)},x["api/payee-rule-create"]=C((async function({payee_id:t,rule:e}){return x["payees-add-rule"]({payee_id:t,type:e.type,value:e.value||null})})),x["api/payee-rule-update"]=C((async function({id:t,fields:e}){return x["payees-update-rule"](I({id:t},w.fromExternal(e)))})),x["api/payee-rule-delete"]=C((async function({id:t}){return x["payees-delete-rule"]({id:t})}));e.a=function(t){return x=Object.assign({},t,x),x}},function(t,e,r){"use strict";var n=r(72),i=r(46),o=r(169),a=r.n(o),s=r(25),u=r(2),c=r(27),l=r(39),f=r(29),d=r(38),h=r(22),g=r(56),p=r(12),m=r(1),y=r(18),b=r(6),w=r(7),_=r(8),v=r(16),E=r(91),S=r(127),O=r(123),T=r(242),A=r(126),M=r(124),j=r(34),I=r(243),R=r(37),D=r(15);function k(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function N(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?k(Object(r),!0).forEach((function(e){C(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):k(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function C(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const x=r(41);function L(t){return new E.a({rrules:Object(l.e)(t)}).occurrences({take:3}).toArray().map(t=>t.date)}async function P(t,e){return(await Object(p.g)(Object(c.b)("transactions").filter({account:e,schedule:null,"payee.transfer_acct":null,$and:[{date:{$gte:S.a(t,2)}},{date:{$lte:i.a(t,2)}}]}).select("*").options({splits:"none"}))).data}function B(t,e){return 1/(Math.abs(O.a(Object(u.l)(t),Object(u.l)(e)))+1)}function U(t,e,r=.5){let n=(t=[...t].reverse())[0],i=t.slice(1),o=[];for(let r of n.transactions){let a=Object(R.b)(r.amount),s=r.payee,u=(r.account,i.map(t=>{let e=t.transactions.find(t=>t.amount>=r.amount-a&&t.amount<=r.amount+a);return e=e&&e.payee===s?e:null,e?{trans:e,rank:B(t.date,e.date)}:null}));if(-1!==u.indexOf(null))continue;let c=u.reduce((t,e)=>t+e.rank,B(n.date,r.date)),l=u.reduce((t,e)=>t&&e.trans.amount===r.amount,!0);o.push({rank:c,amount:r.amount,account:r.account,payee:r.payee,date:e,exactDate:c===t.length,exactAmount:l})}return o}async function F(t,e,r,n,o){let a=[];for(let s=0;s<e;s++){let e,c=i.a(t,s);if("function"==typeof r){if(e=r(c),!1===e)continue}else e=N(N({},r),{},{start:c});e.start=Object(u.f)(e.start);let l=[],f=L(e);for(let t of f)l.push({date:Object(u.f)(t),transactions:await P(t,n)});a=a.concat(U(l,e,o))}return a}async function W(t,e){return F(T.a(Object(u.l)(t),4),14,{frequency:"weekly"},e)}async function H(t,e){return F(T.a(Object(u.l)(t),7),14,{frequency:"weekly",interval:2},e)}async function q(t,e){return F(A.a(Object(u.l)(t),4),62,t=>!(M.a(t)>28)&&{start:t,frequency:"monthly"},e)}async function z(t,e){let r=await F(A.a(Object(u.l)(t),3),1,{frequency:"monthly",patterns:[{type:"day",value:-1}]},e,.75),n=await F(A.a(Object(u.l)(t),4),1,{frequency:"monthly",patterns:[{type:"day",value:-1}]},e,.75);return r.concat(n)}async function V(t,e){return F(T.a(Object(u.l)(t),8),14,t=>{let e=j.a(new Date,"iiii").slice(0,2).toUpperCase();return{start:t,frequency:"monthly",patterns:[{type:e,value:1},{type:e,value:3}]}},e)}async function Y(t,e){return F(A.a(Object(u.l)(t),8),14,t=>{let e=j.a(new Date,"iiii").slice(0,2).toUpperCase();return{start:t,frequency:"monthly",patterns:[{type:e,value:2},{type:e,value:4}]}},e)}async function G(t){let e=t._conditions,r=e.find(t=>"date"===t.field).value;for(;;){let t=r;switch(r=N({},t),r.frequency){case"weekly":r.start=Object(u.f)(T.a(Object(u.l)(r.start),r.interval||1));break;case"monthly":r.start=Object(u.f)(A.a(Object(u.l)(r.start),r.interval||1));break;case"yearly":r.start=Object(u.f)(I.a(Object(u.l)(r.start),r.interval||1));break;default:throw new Error("findStartDate: invalid frequency")}let n=e.map(t=>"date"===t.field?N(N({},t),{},{value:r}):t),i=Object(h.b)(n,{recurDateBounds:1}),o=i.filters;if(i.errors.length>0){r=null;break}if(0===(await Object(p.g)(Object(c.b)("transactions").filter({$and:o}).select("*"))).data.length){r=t;break}}return r?N(N({},t),{},{date:r,_conditions:e.map(t=>"date"===t.field?N(N({},t),{},{value:r}):t)}):t}const $=["type"];function K(t,e){if(null==t)return{};var r,n,i=function(t,e){if(null==t)return{};var r,n,i={},o=Object.keys(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||(i[r]=t[r]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}function Z(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function J(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Z(Object(r),!0).forEach((function(e){X(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Z(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function X(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const Q=r(49),tt=r(41);function et(t,e=new Date){e=n.a(e);let r=new f.b(t.op,"date",t.value,null,new Map(Object.entries({date:"date"}))).getValue();if("date"===r.type)return r.date;if("recur"===r.type){let t=r.schedule.occurrences({start:e,take:1}).toArray();if(t.length>0){let e=t[0].date;return Object(u.f)(e)}}return null}async function rt(t){if(null==t)throw new Error("Schedule not attached to a rule");let e=(await Object(p.g)(Object(c.b)("schedules").filter({id:t}).calculate("rule"))).data;return Object(h.d)().find(t=>t.id===e)}async function nt({id:t,start:e,conditions:r,reset:n}){if(null==r){let e=await rt(t);if(null==e)throw new Error("No rule found for schedule");r=e.serialize().conditions}let i=Object(l.a)(r).date,o=(await Object(p.g)(Object(c.b)("schedules").filter({id:t}).calculate("next_date"))).data;if(i){let r=et(i,e?e(o):new Date);if(r!==o){let e=await m.first("SELECT id, base_next_date_ts FROM schedules_next_date WHERE schedule_id = ?",[t]);await m.update("schedules_next_date",n?{id:e.id,base_next_date:Object(y.h)(r),base_next_date_ts:Date.now()}:{id:e.id,local_next_date:Object(y.h)(r),local_next_date_ts:e.base_next_date_ts})}}}async function it({schedule:t,conditions:e,resetNextDate:r}){if(t.rule)throw new Error("You cannot change the rule of a schedule");let n;if(e){let r=Object(l.a)(e).date;if(r&&null==r.value)throw new Error("Date is required");n=await rt(t.id),null==n&&(n=await async function(t){let e=(await Object(p.g)(Object(c.b)("schedules").filter({id:t}).calculate("rule"))).data;e&&await m.delete_("rules",e);let r=await Object(h.f)({stage:null,conditions:[{op:"isapprox",field:"date",value:Object(u.d)()},{op:"isapprox",field:"amount",value:0}],actions:[{op:"link-schedule",value:t}]});return await m.updateWithSchema("schedules",{id:t,rule:r}),Object(h.d)().find(t=>t.id===r)}(t.id))}await Object(_.c)(async()=>{if(e){let i=n.serialize().conditions,o=function(t,e){let r=Object(l.a)(t),n=Object(l.a)(e),i=function(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}(Object.values(r),Object.values(n)),o=t.map(t=>{let e=i.find(e=>t===e[0]);return e&&e[1]?e[1]:t}),a=i.filter(t=>null==t[0]&&null!=t[1]).map(t=>t[1]);return o.concat(a)}(i,e);await Object(h.n)({id:n.id,conditions:o});let s=t=>{t.type;return K(t,$)};!r&&a()(i.find(t=>"account"===t.field),i.find(t=>"account"===t.field))&&a()(s(i.find(t=>"date"===t.field)),s(o.find(t=>"date"===t.field)))||await nt({id:t.id,conditions:o,reset:!0})}else r&&await nt({id:t.id,reset:!0});await m.updateWithSchema("schedules",t)})}function ot(t){let e=t instanceof f.c?t.serialize():h.j.toJS(t),r=e.actions,n=e.conditions;if(r&&r.find(t=>"link-schedule"===t.op)){let t=r.find(t=>"link-schedule"===t.op).value;if(t){let e=Object(l.a)(n),r=n.findIndex(t=>t===e.payee),i=n.findIndex(t=>t===e.account),o=n.findIndex(t=>t===e.amount),a=n.findIndex(t=>t===e.date);m.runQuery("INSERT OR REPLACE INTO schedules_json_paths (schedule_id, payee, account, amount, date) VALUES (?, ?, ?, ?, ?)",[t,-1===r?null:`$[${r}]`,-1===i?null:`$[${i}]`,-1===o?null:`$[${o}]`,-1===a?null:`$[${a}]`])}}}function at(t,e){let r=!1;e.forEach((t,e)=>{"rules"===e&&(r=!0,t.forEach(t=>{ot(t)}))})}async function st({id:t}){let e=(await Object(p.g)(Object(c.b)("schedules").filter({id:t}).select("*"))).data[0];if(null==e||null==e._account)return;let r={payee:e._payee,account:e._account,amount:Object(l.c)(e._amount),date:e.next_date,schedule:e.id,cleared:!1};r.account&&await Object(d.a)(r.account,[r])}async function ut(t){let e=(await Object(p.g)(Object(c.b)("schedules").filter({completed:!1,"_account.closed":!1}).select("*"))).data,r=(await Object(p.g)(Object(l.b)(e))).data,n=new Set(r.filter(Boolean).map(t=>t.schedule)),i=[],o=!1;for(let r of e){let e=Object(l.d)(r.next_date,r.completed,n.has(r.id));if("paid"===e){if(r._date)if(r._date.frequency)try{await nt({id:r.id})}catch(t){}else r._date<Object(u.d)()&&await it({schedule:{id:r.id,completed:!0}})}else("due"===e||"missed"===e)&&r.posts_transaction&&r._account&&(t?(await st({id:r.id}),o=!0):i.push(r._payee))}i.length>0?Q.send("schedules-offline",{payees:i}):o&&Q.send("sync-event",{type:"success",tables:["transactions"],syncDisabled:"false"})}let ct=Object(g.a)();ct.method("schedule/create",Object(b.mutator)(Object(v.e)((async function({schedule:t,conditions:e=[]}={}){let r=t&&t.id||tt.v4Sync(),n=Object(l.a)(e).date;if(null==n)throw new Error("A date condition is required to create a schedule");if(null==n.value)throw new Error("Date is required");let i,o=et(n),a=o?Object(y.h)(o):null;i=await Object(h.f)({stage:null,conditions:e,actions:[{op:"link-schedule",value:r}]});let s=Date.now();return await m.insertWithUUID("schedules_next_date",{schedule_id:r,local_next_date:a,local_next_date_ts:s,base_next_date:a,base_next_date_ts:s}),await m.insertWithSchema("schedules",J(J({},t),{},{id:r,rule:i})),r})))),ct.method("schedule/update",Object(b.mutator)(Object(v.e)(it))),ct.method("schedule/delete",Object(b.mutator)(Object(v.e)((async function({id:t}){let e=(await Object(p.g)(Object(c.b)("schedules").filter({id:t}).calculate("rule"))).data;await Object(_.c)(async()=>{await m.delete_("rules",e),await m.delete_("schedules",t)})})))),ct.method("schedule/skip-next-date",Object(b.mutator)(Object(v.e)((async function({id:t}){return nt({id:t,start:t=>i.a(Object(u.l)(t),1)})})))),ct.method("schedule/post-transaction",Object(b.mutator)(Object(v.e)(st))),ct.method("schedule/force-run-service",Object(b.mutator)(()=>ut(!0))),ct.method("schedule/get-possible-transactions",(function({schedule:t}){})),ct.method("schedule/discover",(function(){return async function(){let t=(await Object(p.g)(Object(c.b)("accounts").filter({closed:!1}).select("*"))).data,e=[];for(let r of t){let t=await m.first("SELECT * FROM v_transactions WHERE account = ? AND parent_id IS NULL ORDER BY date DESC LIMIT 1",[r.id]);if(t){let n=Object(y.d)(t.date);e=e.concat(await W(n,r.id),await H(n,r.id),await q(n,r.id),await z(n,r.id),await V(n,r.id),await Y(n,r.id))}}let r=[...Object(D.h)(e,"payee").entries()].map(([t,e])=>{e.sort((t,e)=>e.rank-t.rank);let r=e[0];return{id:x.v4Sync(),account:r.account,payee:r.payee,date:r.date,amount:r.amount,_conditions:[{op:"is",field:"account",value:r.account},{op:"is",field:"payee",value:r.payee},{op:r.exactDate?"is":"isapprox",field:"date",value:r.date},{op:r.exactAmount?"is":"isapprox",field:"amount",value:r.amount}]}}),n=[];for(let t of r)n.push(await G(t));return n}()})),ct.method("schedule/get-upcoming-dates",(async function({config:t,count:e}){let r=Object(l.e)(t);try{return new E.a({rrules:r}).occurrences({start:n.a(new Date),take:e}).toArray().map(t=>Object(u.f)(t.date))}catch(e){throw Object(s.captureBreadcrumb)(t),e}})),ct.service((function(){return m.transaction(()=>{Object(h.d)().forEach(t=>{ot(t)})}),Object(_.a)(at)})),ct.events.on("sync",({type:t,subtype:e})=>{if(("success"===t||"error"===t||"unauthorized"===t)&&w.b()){w.b().lastScheduleRun!==Object(u.d)()&&(Object(b.runMutator)(()=>ut("success"===t)),w.d({lastScheduleRun:Object(u.d)()}))}});e.a=ct},function(t,e,r){"use strict";r.r(e),function(t,n,i){r.d(e,"handlers",(function(){return mt})),r.d(e,"initApp",(function(){return vt})),r.d(e,"init",(function(){return Et})),r.d(e,"lib",(function(){return St}));r(285);var o=r(267),a=r.n(o),s=r(268),u=r(25),c=r(10),l=r.n(c),f=r(4),d=r.n(f),h=r(65),g=r(13),p=r(131),m=r(2),y=r(27),b=r(37),w=r(15),_=r(167),v=r(134),E=r(279),S=r(130),O=r(29),T=r(38),A=r(22),M=r(64),j=r(280),I=r(12),R=r(93),D=r(273),k=r(59),N=r(33),C=r(9),x=r(1),L=r(107),P=r(31),B=r(21),U=r(28),F=r(6),W=r(274),H=r(40),q=r(30),z=r(7),V=r(281),Y=r(19),G=r(5),$=r(8),K=r(275),Z=r(276),J=r(94),X=r(16),Q=r(278),tt=r(170);function et(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return rt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return rt(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function nt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function it(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?nt(Object(r),!0).forEach((function(e){ot(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function ot(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const at=r(458),st=r(470),ut=r(49),ct=r(41),lt=r(54),ft=lt.resolveName,dt=lt.unresolveName,ht=r(159);let gt;function pt({names:t}){const e=t.map(t=>{let e=G.b()._getNode(t);return{name:e.name,value:e.value}});ut.send("cells-changed",e)}let mt={};function yt(t){function e(t,e){let r=t.map(t=>{try{e(t)}catch(t){if(t instanceof B.RuleError)return console.warn("Invalid rule",t),t.type;throw t}return null});return r.some(Boolean)?r:null}let r=e(t.conditions,t=>new O.b(t.op,t.field,t.value,t.options,b.a)),n=e(t.actions,t=>new O.a(t.op,t.field,t.value,t.options,b.a));return r||n?{conditionErrors:r,actionErrors:n}:null}mt.undo=Object(F.mutator)((async function(){return Object(X.d)()})),mt.redo=Object(F.mutator)((function(){return Object(X.c)()})),mt["transactions-batch-update"]=Object(F.mutator)((async function({added:t,deleted:e,updated:r,learnCategories:n}){return Object(X.f)(async()=>(await Object(M.a)({added:t,updated:r,deleted:e,learnCategories:n})).updated)})),mt["transaction-add"]=Object(F.mutator)((async function(t){return await mt["transactions-batch-update"]({added:[t]}),{}})),mt["transaction-update"]=Object(F.mutator)((async function(t){return await mt["transactions-batch-update"]({updated:[t]}),{}})),mt["transaction-delete"]=Object(F.mutator)((async function(t){return await mt["transactions-batch-update"]({deleted:[t]}),{}})),mt["transactions-filter"]=async function({term:t,accountId:e,latestDate:r,count:n,notPaged:i,options:o={}}){return x.getTransactions(t,e,r,i?null:null==n?void 0:n,o)},mt["transactions-parse-file"]=async function({filepath:t,options:e}){return Object(E.a)(t,e)},mt["transactions-export"]=async function({transactions:t,accounts:e,categoryGroups:r,payees:n}){return Object(_.b)(t,e,r,n)},mt["transactions-export-query"]=async function({query:t}){return Object(_.a)(new y.a(t))},mt["get-categories"]=async function(){return{grouped:await x.getCategoriesGrouped(),list:await x.getCategories()}},mt["get-earliest-transaction"]=async function(){return(await Object(I.g)(Object(y.b)("transactions").options({splits:"none"}).orderBy({date:"asc"}).select("*").limit(1))).data[0]||null},mt["get-budget-bounds"]=async function(){return k.a()},mt["rollover-budget-month"]=async function({month:t}){let e=await x.getCategoriesGrouped(),r=m.p(t);function n(t){let e=G.d(r,t);return{value:""===e?0:e,name:ft(r,t)}}let i=[n("available-funds"),n("last-month-overspent"),n("buffered"),n("total-budgeted"),n("to-budget"),n("from-last-month"),n("total-income"),n("total-spent"),n("total-leftover")];for(let t of e)if(t.is_income){i.push(n("total-income"));for(let e of t.categories)i.push(n("sum-amount-"+e.id))}else{i=i.concat([n("group-budget-"+t.id),n("group-sum-amount-"+t.id),n("group-leftover-"+t.id)]);for(let e of t.categories)i=i.concat([n("budget-"+e.id),n("sum-amount-"+e.id),n("leftover-"+e.id),n("carryover-"+e.id)])}return i},mt["report-budget-month"]=async function({month:t}){let e=await x.getCategoriesGrouped(),r=m.p(t);function n(t){let e=G.d(r,t);return{value:""===e?0:e,name:ft(r,t)}}let i=[n("total-budgeted"),n("total-budget-income"),n("total-saved"),n("total-income"),n("total-spent"),n("real-saved"),n("total-leftover")];for(let t of e){i=i.concat([n("group-budget-"+t.id),n("group-sum-amount-"+t.id),n("group-leftover-"+t.id)]);for(let e of t.categories)i=i.concat([n("budget-"+e.id),n("sum-amount-"+e.id),n("leftover-"+e.id)]),t.is_income||i.push(n("carryover-"+e.id))}return i},mt["budget-set-type"]=async function({type:t}){if("rollover"!==t&&"report"!==t)throw new Error("Invalid budget type: "+t);if(t!==z.b().budgetType)return z.d({budgetType:t})},mt["category-create"]=Object(F.mutator)((async function({name:t,groupId:e,isIncome:r}){return Object(X.f)(async()=>{if(!e)throw Object(B.APIError)("Creating a category: groupId is required");return x.insertCategory({name:t,cat_group:e,is_income:r?1:0})})})),mt["category-update"]=Object(F.mutator)((async function(t){return Object(X.f)(async()=>{try{await x.updateCategory(t)}catch(t){if(t.message.toLowerCase().includes("unique constraint"))return{error:{type:"category-exists"}};throw t}return{}})})),mt["category-move"]=Object(F.mutator)((async function({id:t,groupId:e,targetId:r}){return Object(X.f)(async()=>(await Object($.c)(async()=>{await x.moveCategory(t,e,r)}),"ok"))})),mt["category-delete"]=Object(F.mutator)((async function({id:t,transferId:e}){return Object(X.f)(async()=>{let r={};return await Object($.c)(async()=>{let n=await x.first("SELECT is_income FROM categories WHERE id = ?",[t]);if(!n)return void(r={error:"no-categories"});let i=e&&await x.first("SELECT is_income FROM categories WHERE id = ?",[e]);!n||e&&!i?r={error:"no-categories"}:e&&n.is_income!==i.is_income?r={error:"category-type"}:(0===n.is_income&&e&&await k.b([t],e),await x.deleteCategory({id:t},e))}),r})})),mt["category-group-create"]=Object(F.mutator)((async function({name:t,isIncome:e}){return Object(X.f)(async()=>x.insertCategoryGroup({name:t,is_income:e?1:0}))})),mt["category-group-update"]=Object(F.mutator)((async function(t){return Object(X.f)(async()=>x.updateCategoryGroup(t))})),mt["category-group-move"]=Object(F.mutator)((async function({id:t,targetId:e}){return Object(X.f)(async()=>(await Object($.c)(async()=>{await x.moveCategoryGroup(t,e)}),"ok"))})),mt["category-group-delete"]=Object(F.mutator)((async function({id:t,transferId:e}){return Object(X.f)(async()=>{const r=await x.all("SELECT id FROM categories WHERE cat_group = ? AND tombstone = 0",[t]);return Object($.c)(async()=>{e&&await k.b(r.map(t=>t.id),e),await x.deleteCategoryGroup({id:t},e)})})})),mt["must-category-transfer"]=async function({id:t}){return 0!==(await x.runQuery("SELECT count(t.id) as count FROM transactions t\n LEFT JOIN category_mapping cm ON cm.id = t.category\n WHERE cm.transferId = ? AND t.tombstone = 0",[t],!0))[0].count||[...G.b().meta().createdMonths].some(e=>{const r=m.p(e);return 0!==G.b().getCellValue(r,"budget-"+t)})},mt["payee-create"]=Object(F.mutator)((async function({name:t}){return Object(X.f)(async()=>x.insertPayee({name:t}))})),mt["payees-get"]=async function(){return x.getPayees()},mt["payees-get-rule-counts"]=async function(){let t={};A.d();return A.g(A.d(),"payee",(e,r)=>{null==t[r]&&(t[r]=0),t[r]++}),t},mt["payees-merge"]=Object(F.mutator)((async function({targetId:t,mergeIds:e}){return Object(X.f)(async()=>x.mergePayees(t,e),{targetId:t,mergeIds:e})})),mt["payees-batch-change"]=Object(F.mutator)((async function({added:t,deleted:e,updated:r}){return Object(X.f)(async()=>Object($.c)(async()=>{e&&await Promise.all(e.map(t=>x.deletePayee(t))),t&&await Promise.all(t.map(t=>x.insertPayee(t))),r&&await Promise.all(r.map(t=>x.updatePayee(t)))}))})),mt["payees-check-orphaned"]=async function({ids:t}){let e=new Set(await x.getOrphanedPayees());return t.filter(t=>e.has(t))},mt["payees-get-rules"]=async function({id:t}){return A.e(t).map(t=>t.serialize())},mt["payees-delete-rule"]=Object(F.mutator)((async function({id:t,payee_id:e}){return Object(X.f)(async()=>await x.deletePayeeRule({id:t}),{payeeId:e})})),mt["payees-update-rule"]=Object(F.mutator)((async function(t){return Object(X.f)(async()=>await x.updatePayeeRule(t),{payeeId:t.payee_id})})),mt["payees-add-rule"]=Object(F.mutator)((async function(t){return Object(X.f)(async()=>{let e=await x.insertPayeeRule(t);return it(it({},t),{},{id:e})},{payeeId:t.payee_id})})),mt["rule-validate"]=async function(t){return{error:yt(t)}},mt["rule-add"]=Object(F.mutator)((async function(t){let e=yt(t);return e?{error:e}:{id:await A.f(t)}})),mt["rule-update"]=Object(F.mutator)((async function(t){let e=yt(t);return e?{error:e}:(await A.n(t),{})})),mt["rule-delete"]=Object(F.mutator)((async function(t){return A.c(t)})),mt["rule-delete-all"]=Object(F.mutator)((async function(t){let e=!1;return await Object($.c)(async()=>{for(let r of t){!1===await A.c({id:r})&&(e=!0)}}),{someDeletionsFailed:e}})),mt["rule-apply-actions"]=Object(F.mutator)((async function({transactionIds:t,actions:e}){return A.a(t,e,mt)})),mt["rule-add-payee-rename"]=Object(F.mutator)((async function({fromNames:t,to:e}){return A.m(t,e)})),mt["rules-get"]=async function(){return Object(O.g)(A.d()).map(t=>t.serialize())},mt["rule-get"]=async function({id:t}){let e=A.d().find(e=>e.id===t);return e?e.serialize():null},mt["rules-run"]=async function({transaction:t}){return A.k(t)},mt["rules-migrate"]=async function(){await A.i()},mt["make-filters-from-conditions"]=async function({conditions:t}){return A.b(t)},mt.getCell=async function({sheetName:t,name:e}){let r=["name","value"],n=G.b()._getNode(ft(t,e));if(r){let t={};return r.forEach(e=>{t[e]="run"===e?n._run?n._run.toString():null:n[e]}),t}return n},mt.getCells=async function({names:t}){return t.map(t=>({value:G.b()._getNode(t).value}))},mt.getCellNamesInSheet=async function({sheetName:t}){let e=[];for(let r of G.b().getNodes().keys()){let n=dt(r),i=n.sheet,o=n.name;i===t&&e.push(o)}return e},mt.debugCell=async function({sheetName:t,name:e}){let r=G.b().getNode(ft(t,e));return it(it({},r),{},{_run:r._run&&r._run.toString()})},mt["create-query"]=async function({sheetName:t,name:e,query:r}){return G.b().createQuery(t,e,r),"ok"},mt.query=async function(t){if(null==t.table)throw new Error("query has no table, did you forgot to call `.serialize`?");return Object(I.g)(t)},mt["bank-delete"]=async function({id:t}){const e=await x.runQuery("SELECT * FROM accounts WHERE bank = ?",[t],!0);return await x.delete_("banks",t),await Promise.all(e.map(async t=>{await x.runQuery("DELETE FROM transactions WHERE acct = ?",[t.id]),await x.delete_("accounts",t.id)})),"ok"},mt["account-update"]=Object(F.mutator)((async function({id:t,name:e}){return Object(X.f)(async()=>(await x.update("accounts",{id:t,name:e}),{}))})),mt["accounts-get"]=async function(){return x.getAccounts()},mt["account-properties"]=async function({id:t}){return{balance:(await x.first("SELECT sum(amount) as balance FROM transactions WHERE acct = ? AND isParent = 0 AND tombstone = 0",[t])).balance||0,numTransactions:(await x.first("SELECT count(id) as count FROM transactions WHERE acct = ? AND tombstone = 0",[t])).count}},mt["accounts-link"]=async function({institution:t,publicToken:e,accountId:r,upgradingId:n}){let i=await v.b(t,e),o=et(await l.a.multiGet(["user-id","user-key"]),2),a=et(o[0],2)[1],s=et(o[1],2)[1],u=(await T.b(a,s,i)).find(t=>t.account_id===r);return await x.update("accounts",{id:n,account_id:u.account_id,official_name:u.official_name,type:Object(p.a)(u.type),balance_current:Object(w.a)(u.balances.current),balance_available:Object(w.a)(u.balances.available),balance_limit:Object(w.a)(u.balances.limit),mask:u.mask,bank:i}),await T.d(a,s,n,u.account_id,i),ut.send("sync-event",{type:"success",tables:["transactions"]}),"ok"},mt["accounts-connect"]=async function({institution:t,publicToken:e,accountIds:r,offbudgetIds:n}){let i=await v.b(t,e);return await v.a(i,r,n)},mt["account-create"]=Object(F.mutator)((async function({name:t,type:e,balance:r,offBudget:n,closed:i}){return Object(X.f)(async()=>{const o=await x.insertAccount({name:t,type:e,offbudget:n?1:0,closed:i?1:0});if(await x.insertPayee({name:"",transfer_acct:o}),null!=r){let t=await Object(S.a)();await x.insertTransaction({account:o,amount:Object(w.a)(r),category:n?null:t.category,payee:t.id,date:m.d(),cleared:!0,starting_balance_flag:!0})}return o})})),mt["account-close"]=Object(F.mutator)((async function({id:t,transferAccountId:e,categoryId:r,forced:n}){return await mt["account-unlink"]({id:t}),Object(X.f)(async()=>{let i=await x.first("SELECT * FROM accounts WHERE id = ? AND tombstone = 0",[t]);if(!i||1===i.closed)return;const o=await mt["account-properties"]({id:t}),a=o.balance;if(0===o.numTransactions)await x.deleteAccount({id:t});else if(n){let e=await x.runQuery("SELECT id, transfer_id FROM v_transactions WHERE account = ?",[t],!0),r=(await x.first("SELECT id FROM payees WHERE transfer_acct = ?",[t])).id;await Object($.c)(()=>{e.forEach(t=>{t.transfer_id&&x.updateTransaction({id:t.transfer_id,payee:null,transfer_id:null}),x.deleteTransaction({id:t.id})}),x.deleteAccount({id:t}),x.deleteTransferPayee({id:r})})}else{if(0!==a&&null==e)throw Object(B.APIError)("balance is non-zero: transferAccountId is required");if(await x.update("accounts",{id:t,closed:1}),0!==a){let n=(await x.first("SELECT id FROM payees WHERE transfer_acct = ?",[e])).id;await mt["transaction-add"]({id:ct.v4Sync(),payee:n,amount:-a,account:t,date:m.d(),notes:"Closing account",category:r||null})}}})})),mt["account-reopen"]=Object(F.mutator)((async function({id:t}){return Object(X.f)(async()=>{await x.update("accounts",{id:t,closed:0})})})),mt["account-move"]=Object(F.mutator)((async function({id:t,targetId:e}){return Object(X.f)(async()=>{await x.moveAccount(t,e)})}));let bt=!1;async function wt(t,e,{showUpdate:r}={}){let n;try{n=d.a.getBudgetDir(t)}catch(t){return Object(u.captureException)(new Error("`getBudgetDir` failed in `loadBudget`: "+t.message)),{error:"budget-not-found"}}if(Object(u.captureBreadcrumb)({message:"Loading budget "+n}),!await d.a.exists(n))return Object(u.captureException)(new Error("budget directory does not exist")),{error:"budget-not-found"};try{await z.c(t),await x.openDatabase(t)}catch(e){return Object(u.captureBreadcrumb)({message:"Error loading budget "+t}),Object(u.captureException)(e),await mt["close-budget"](),{error:"opening-budget"}}if(!z.b().userId){let t=et(await l.a.multiGet(["user-token"]),1),e=et(t[0],2)[1];z.d({userId:e})}let o=z.b(),a=o.budgetVersion;o.budgetId;try{await Object(Q.a)(a,r)}catch(e){let r;return console.warn("Error updating",e),e.message.includes("out-of-sync-migrations")?r={error:"out-of-sync-migrations"}:e.message.includes("out-of-sync-data")?r={error:"out-of-sync-data"}:(Object(u.captureException)(e),h.a.info("Error updating budget "+t,e),console.log("Error updating budget",e),r={error:"loading-budget"}),await mt["close-budget"](),r}await x.loadClock(),z.b().resetClock&&(Object(C.c)().timestamp.setNode(Object(C.d)()),await x.runQuery("INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)",[Object(C.g)(Object(C.c)())]),await z.d({resetClock:!1})),H.a.isWeb||H.a.isMobile||i.__TESTING__||Object(R.d)(t);try{await G.e(x,pt)}catch(t){return Object(u.captureException)(t),await mt["close-budget"](),{error:"opening-budget"}}return G.b().meta().budgetType=z.b().budgetType,await k.a(),await L.b(),await A.h(),await K.a(),await U.a.startServices(),Object(X.b)(),i.__TESTING__||("_demo-budget"===t?Object($.k)("disabled"):"_test-budget"===t?await l.a.setItem("lastBudget",t):(Object($.k)("enabled"),await l.a.setItem("lastBudget",t),H.a.isMobile||await N.f())),U.a.events.emit("load-budget",{id:t}),{}}function _t(){return H.a.isMobile?"/documents":d.a.join("/documents","Actual")}async function vt(e,r,n){gt=e,await g.init(),await Promise.all([l.a.init(),d.a.init()]),await J.a(),await async function(){async function t(t){await d.a.exists(t)||await d.a.mkdir(t)}let e=await l.a.getItem("document-dir");if(e)try{await t(e)}catch(t){e=null}e||(e=_t()),await t(e),d.a._setDocumentDir(e)}();let o=await l.a.getItem("encrypt-keys");if(o)try{let t=JSON.parse(o);await Promise.all(Object.keys(t).map(e=>P.a.loadKey(t[e])))}catch(t){throw console.log("Error loading key",t),new Error("load-key-error")}if(r){await l.a.getItem("lastBudget")}const a=await l.a.getItem("server-url");if(a&&Object(Y.b)(a),ut.init(n,U.a.handlers),J.c("app:init",{platform:H.a.isMobile?"mobile":H.a.isWeb?"web":"desktop"}),!r&&!H.a.isMobile&&!H.a.isWeb){let e=await l.a.getItem("auto-update");t.send({type:"shouldAutoUpdate",flag:null==e||"true"===e})}r&&(i.$send=(t,e)=>Object(F.runHandler)(U.a.handlers[t],e),i.$query=I.g,i.$q=y.b,i.$db=x,i.$setSyncingMode=$.k)}async function Et({budgetId:e,config:r}){let n,i;return gt=ACTUAL_APP_VERSION,r?(n=r.dataDir,i=r.serverURL):(n="/",i=t.env.ACTUAL_SERVER_URL),await g.init(),await Promise.all([l.a.init({persist:!1}),d.a.init()]),d.a._setDocumentDir(n||t.cwd()),i?Object(Y.b)(i):(Object(Y.b)(null),U.a.events.on("load-budget",()=>{Object($.k)("offline")})),e&&await Object(F.runHandler)(mt["load-budget"],{id:e}),St}mt["poll-web-token"]=async function({token:t}){let e=et(await l.a.multiGet(["user-id","user-key"]),2),r=et(e[0],2)[1],n=et(e[1],2)[1],i=Date.now();return bt=!1,new Promise(e=>{!async function e(o){if(bt)return;if(Date.now()-i>=6e5)return void o("timeout");let a=await Object(q.post)(Object(Y.a)().PLAID_SERVER+"/get-web-token-contents",{userId:r,key:n,token:t});a?a.error?o("unknown"):o(null,a):setTimeout(()=>e(o),3e3)}((t,r)=>{e(t?{error:t}:{data:r})})})},mt["poll-web-token-stop"]=async function(){return bt=!0,"ok"},mt["accounts-sync"]=async function({id:t}){let e=et(await l.a.multiGet(["user-id","user-key"]),2),r=et(e[0],2)[1],n=et(e[1],2)[1],i=await x.runQuery("SELECT a.*, b.id as bankId FROM accounts a\n LEFT JOIN banks b ON a.bank = b.id\n WHERE a.tombstone = 0 AND a.closed = 0",[],!0);t&&(i=i.filter(e=>e.id===t));let o=[],a=[],s=[],c=[];z.b().groupId;for(var f=0;f<i.length;f++){const t=i[f];if(t.bankId)try{const e=await T.d(r,n,t.id,t.account_id,t.bankId);let i=e.added,o=e.updated;a=a.concat(i),s=s.concat(o),(i.length>0||o.length>0)&&(c=c.concat(t.id))}catch(e){"BankSyncError"===e.type?o.push({type:"SyncError",accountId:t.id,message:'Failed syncing account "'+t.name+'".',category:e.category,code:e.code}):e instanceof B.PostError&&"internal"!==e.reason?o.push({accountId:t.id,message:`Account "${t.name}" is not linked properly. Please link it again`}):(o.push({accountId:t.id,message:"There was an internal error. Please email help@actualbudget.com for support.",internal:e.stack}),e.message="Failed syncing account: "+e.message,Object(u.captureException)(e))}}return c.length>0&&ut.send("sync-event",{type:"success",tables:["transactions"]}),{errors:o,newTransactions:a,matchedTransactions:s,updatedAccounts:c}},mt["transactions-import"]=Object(F.mutator)((function({accountId:t,transactions:e}){return Object(X.f)(async()=>{if("string"!=typeof t)throw Object(B.APIError)("transactions-import: accountId must be an id");try{return await T.c(t,e)}catch(t){if(t instanceof B.TransactionError)return{errors:[{message:t.message}],added:[],updated:[]};throw t}})})),mt["account-unlink"]=Object(F.mutator)((async function({id:t}){let e=(await x.first("SELECT bank FROM accounts WHERE id = ?",[t])).bank;if(!e)return"ok";if(await x.updateAccount({id:t,account_id:null,bank:null,balance_current:null,balance_available:null,balance_limit:null}),0===(await x.first("SELECT COUNT(*) as count FROM accounts WHERE bank = ?",[e])).count){let t=et(await l.a.multiGet(["user-id","user-key"]),2),r=et(t[0],2)[1],n=et(t[1],2)[1];await Object(q.post)(Object(Y.a)().PLAID_SERVER+"/remove-access-token",{userId:r,key:n,item_id:e})}return"ok"})),mt["make-plaid-public-token"]=async function({bankId:t}){let e=et(await l.a.multiGet(["user-id","user-key"]),2),r=et(e[0],2)[1],n=et(e[1],2)[1],i=await Object(q.post)(Object(Y.a)().PLAID_SERVER+"/make-public-token",{userId:r,key:n,item_id:""+t});return i.error_code?{error:"",code:i.error_code,type:i.error_type}:{linkToken:i.link_token}},mt["save-global-prefs"]=async function(e){return"maxMonths"in e&&await l.a.setItem("max-months",""+e.maxMonths),"trackUsage"in e&&(J.b(e.trackUsage),await l.a.setItem("track-usage",""+e.trackUsage)),"autoUpdate"in e&&(await l.a.setItem("auto-update",""+e.autoUpdate),t.send({type:"shouldAutoUpdate",flag:e.autoUpdate})),"documentDir"in e&&await d.a.exists(e.documentDir)&&await l.a.setItem("document-dir",e.documentDir),"floatingSidebar"in e&&await l.a.setItem("floating-sidebar",""+e.floatingSidebar),"ok"},mt["load-global-prefs"]=async function(){let t=et(await l.a.multiGet(["floating-sidebar","seen-tutorial","max-months","track-usage","auto-update","document-dir","encrypt-key"]),7),e=et(t[0],2)[1],r=et(t[1],2)[1],n=et(t[2],2)[1],i=et(t[3],2)[1],o=et(t[4],2)[1],a=et(t[5],2)[1],s=et(t[6],2)[1];return{floatingSidebar:"true"===e,seenTutorial:"true"===r,maxMonths:Object(w.p)(n||""),trackUsage:null==i||"true"===i,autoUpdate:null==o||"true"===o,documentDir:a||_t(),keyId:s&&JSON.parse(s).id}},mt["save-prefs"]=async function(t){let e=z.b().cloudFileId;if(t.budgetName&&e){let r=await l.a.getItem("user-token");await Object(q.post)(Object(Y.a)().SYNC_SERVER+"/update-user-filename",{token:r,fileId:e,name:t.budgetName})}return await z.d(t),"ok"},mt["load-prefs"]=async function(){return z.b()},mt["sync-reset"]=async function(){return await Object($.i)()},mt["sync-repair"]=async function(){await Object($.h)()},mt["key-make"]=async function({password:t}){if(!z.b())throw new Error("user-set-key must be called with file loaded");z.b().cloudFileId;let e=P.a.randomBytes(32).toString("base64"),r=ct.v4Sync(),n=await P.a.createKey({id:r,password:t,salt:e});await P.a.loadKey(n);let i=await Object($.g)(n.getId());return await Object($.i)({key:n,salt:e,testContent:JSON.stringify(it(it({},i),{},{value:i.value.toString("base64")}))})},mt["key-test"]=async function({fileId:t,password:e}){let r,i=await l.a.getItem("user-token");null==t&&(t=z.b().cloudFileId);try{r=await Object(q.post)(Object(Y.a)().SYNC_SERVER+"/user-get-key",{token:i,fileId:t})}catch(t){return console.log(t),{error:{reason:"network"}}}let o=r,a=o.id,s=o.salt,u=o.test;if(null==u)return{error:{reason:"old-key-style"}};u=JSON.parse(u);let c=await P.a.createKey({id:a,password:e,salt:s});P.a.loadKey(c);try{await P.a.decrypt(n.from(u.value,"base64"),u.meta)}catch(t){return console.log(t),P.a.unloadKey(c),{error:{reason:"decrypt-failure"}}}let f=JSON.parse(await l.a.getItem("encrypt-keys")||"{}");return f[t]=c.serialize(),await l.a.setItem("encrypt-keys",JSON.stringify(f)),z.b()&&await z.d({encryptKeyId:c.getId()}),{}},mt["should-pitch-subscribe"]=async function(){return"true"!==await l.a.getItem("seenSubscribe")},mt["has-pitched-subscribe"]=async function(){return await l.a.setItem("seenSubscribe","true"),"ok"},mt["subscribe-needs-bootstrap"]=async function({url:t}={}){if("https://not-configured/"===Object(Y.a)(t).BASE_SERVER)return{bootstrapped:!0};let e;try{e=await Object(q.get)(Object(Y.a)(t).SIGNUP_SERVER+"/needs-bootstrap")}catch(t){return{error:"network-failure"}}try{e=JSON.parse(e)}catch(t){return{error:"parse-failure"}}return"error"===e.status?{error:e.reason}:{bootstrapped:e.data.bootstrapped}},mt["subscribe-bootstrap"]=async function({password:t}){let e;try{e=await Object(q.post)(Object(Y.a)().SIGNUP_SERVER+"/bootstrap",{password:t})}catch(t){return{error:t.reason||"network-failure"}}return e.token?(await l.a.setItem("user-token",e.token),{}):{error:"internal"}},mt["subscribe-set-user"]=async function({token:t}){await l.a.setItem("user-token",t)},mt["subscribe-get-user"]=async function(){if(Object(Y.a)()&&"https://not-configured/"===Object(Y.a)().BASE_SERVER)return{offline:!1};let t=await l.a.getItem("user-token");if(t)try{let e=await Object(q.get)(Object(Y.a)().SIGNUP_SERVER+"/validate",{headers:{"X-ACTUAL-TOKEN":t}});return e=JSON.parse(e),"error"===e.status?"unauthorized"===e.reason?null:{offline:!0}:{offline:!1}}catch(t){return console.log(t),{offline:!0}}return null},mt["subscribe-change-password"]=async function({password:t}){let e,r=await l.a.getItem("user-token");try{e=await Object(q.post)(Object(Y.a)().SIGNUP_SERVER+"/change-password",{token:r,password:t})}catch(t){return{error:t.reason||"network-failure"}}return{}},mt["subscribe-sign-in"]=async function({password:t}){let e=await Object(q.post)(Object(Y.a)().SIGNUP_SERVER+"/login",{password:t});return e.token?(await l.a.setItem("user-token",e.token),{}):{error:"invalid-password"}},mt["subscribe-sign-out"]=async function(){return P.a.unloadAllKeys(),await l.a.multiRemove(["user-token","encrypt-keys","lastBudget","readOnly"]),"ok"},mt["get-server-version"]=async function(){if(!Object(Y.a)()||"https://not-configured/"===Object(Y.a)().BASE_SERVER)return{error:"no-server"};let t;try{const e=await Object(q.get)(Object(Y.a)().BASE_SERVER+"/info");t=JSON.parse(e).build.version}catch(t){return{error:"network-failure"}}return{version:t}},mt["get-server-url"]=async function(){return Object(Y.a)()&&Object(Y.a)().BASE_SERVER},mt["set-server-url"]=async function({url:t}){if(null!=t){let e=(await Object(F.runHandler)(mt["subscribe-needs-bootstrap"],{url:t})).error;if(e)return{error:e}}else t="https://not-configured/";return l.a.setItem("server-url",t),Object(Y.b)(t),{}},mt.sync=async function(){return Object($.e)()},mt["get-version"]=async function(){return{version:gt}},mt["get-budgets"]=async function(){const t=await d.a.listDir(d.a.getDocumentDir());return(await Promise.all(t.map(async t=>{const e=d.a.join(d.a.getDocumentDir(),t,"metadata.json");if(await d.a.exists(e)){let r;try{r=JSON.parse(await d.a.readFile(e))}catch(t){return void console.log("Error parsing metadata:",t.stack)}if("_demo-budget"!==t)return{id:t,cloudFileId:r.cloudFileId,groupId:r.groupId,name:r.budgetName||"(no name)"}}return null}))).filter(t=>t)},mt["get-ynab4-files"]=async function(){return at.findBudgets()},mt["get-remote-files"]=async function(){return N.e()},mt["reset-budget-cache"]=Object(F.mutator)((async function(){await G.f(x),G.b().recomputeAll(),await G.j()})),mt["upload-budget"]=async function({id:t}={}){if(t){if(z.b())throw new Error("upload-budget: id given but prefs already loaded");await z.c(t)}try{await N.i()}catch(t){return console.log(t),"FileUploadError"===t.type?{error:t}:(Object(u.captureException)(t),{error:{reason:"internal"}})}finally{t&&z.e()}return{}},mt["download-budget"]=async function({fileId:t,replace:e}){let r;try{r=await N.b(t,e)}catch(t){if("FileDownloadError"===t.type){if("file-exists"===t.reason&&t.meta.id){await z.c(t.meta.id);let e=z.b().budgetName;z.e(),t.meta=it(it({},t.meta),{},{name:e})}return{error:t}}return Object(u.captureException)(t),{error:{reason:"internal"}}}let n=r.id;return r=await wt(r.id,gt,{showUpdate:!0}),r.error?{error:{reason:r.error}}:(Object($.k)("enabled"),await Object($.f)(),await mt["close-budget"](),{id:n})},mt["load-budget"]=async function({id:t}){let e=z.b();if(e){if(e.id===t)return{};await mt["close-budget"]()}let r=await wt(t,gt,{showUpdate:!0});return async function(){let e=async e=>{let r=d.a.join(d.a.getBudgetDir(t),e);try{return await d.a.size(r)}catch(t){return null}};try{let t=await e("db.sqlite"),r=await e("cache.sqlite");J.c("app:load-budget",{size:t,cacheSize:r})}catch(t){console.warn(t)}}(),r},mt["create-demo-budget"]=async function(){return await l.a.setItem("readOnly",""),mt["create-budget"]({budgetName:"Demo Budget",testMode:!0,testBudgetId:"_demo-budget"})},mt["close-budget"]=async function(){Object(u.captureBreadcrumb)({message:"Closing budget"}),await G.j(),G.i(),Object($.d)(),await U.a.stopServices(),await x.closeDatabase();try{await l.a.setItem("lastBudget","")}catch(t){}return z.e(),Object(R.e)(),"ok"},mt["delete-budget"]=async function({id:t,cloudFileId:e}){if(e&&await N.g(e).catch(t=>{}),t){let e=d.a.getBudgetDir(t);await d.a.removeDirRecursively(e)}return"ok"},mt["create-budget"]=async function({budgetName:t,avoidUpload:e,testMode:r,testBudgetId:n}={}){let i;if(r)t=t||"Test Budget",i=n||"_test-budget",await d.a.exists(d.a.getBudgetDir(i))&&await d.a.removeDirRecursively(d.a.getBudgetDir(i));else{if(!t){let e=await mt["get-budgets"]();t=await Object(tt.b)(e)}i=await Object(tt.a)(t)}let o=d.a.getBudgetDir(i);await d.a.mkdir(o),await d.a.copyFile(d.a.bundledDatabasePath,d.a.join(o,"db.sqlite")),await d.a.writeFile(d.a.join(o,"metadata.json"),JSON.stringify(z.a(i,t)));let a=(await wt(i,gt)).error;if(a)return console.log("Error creating budget: "+a),{error:a};if(!e&&!r)try{await N.i()}catch(t){}return r&&await Object(s.a)(mt),{}},mt["set-tutorial-seen"]=async function(){return await l.a.setItem("seen-tutorial","true"),"ok"},mt["import-budget"]=async function({filepath:t,type:e}){try{if(!await d.a.exists(t))throw new Error("File not found at the provided path: "+t);let r=n.from(await d.a.readFile(t,"binary"));switch(e){case"ynab4":try{await at.importBuffer(t,r)}catch(t){let e=t.message.toLowerCase();if(e.includes("not a ynab4")||e.includes("could not find file"))return{error:"not-ynab4"}}break;case"ynab5":let e;try{e=JSON.parse(r.toString())}catch(t){return{error:"parse-error"}}try{await st.importYNAB5(e)}catch(t){return{error:"not-ynab5"}}break;case"actual":await mt["close-budget"]();let n=(await N.d({cloudFileId:null,groupId:null},r)).id,i=await g.openDatabase(d.a.join(d.a.getBudgetDir(n),"db.sqlite"));g.execQuery(i,"\n DELETE FROM kvcache;\n DELETE FROM kvcache_key;\n "),g.closeDatabase(i),await mt["load-budget"]({id:n}),await mt["get-budget-bounds"](),await G.j(),await N.i().catch(t=>{})}}catch(t){return t.message="Error importing budget: "+t.message,Object(u.captureException)(t),{error:"internal-error"}}return{}},mt["export-budget"]=async function(){return await N.c()},mt["get-upgrade-notifications"]=async function(){let t=z.b().id;if("_test-budget"===t||"_demo-budget"===t)return[];let e=["schedules","repair-splits"],r=[];for(let t of e){let e="notifications."+t;null==z.b()[e]&&r.push(t)}return r},mt["seen-upgrade-notification"]=async function({type:t}){let e="notifications."+t;z.d({[e]:!0})},mt["upload-file-web"]=async function({filename:t,contents:e}){return H.a.isWeb?(await d.a.writeFile("/uploads/"+t,e),"ok"):null},mt["backups-get"]=async function({id:t}){return Object(R.a)(t)},mt["backup-load"]=async function({id:t,backupId:e}){await Object(R.b)(t,e)},mt["backup-make"]=async function({id:t}){await Object(R.c)(t)},mt["get-last-opened-backup"]=async function(){const t=await l.a.getItem("lastBudget");if(t&&""!==t){const e=d.a.getBudgetDir(t);if(await d.a.exists(e))return t}return null},mt["app-focused"]=async function(){z.b()&&z.b().id&&Object($.e)()},mt.track=async function({name:t,props:e}){J.c(t,e)},mt=Object(j.a)(mt),a.a.send=(t,e)=>Object(F.runHandler)(U.a.handlers[t],e),U.a.handlers=mt,U.a.combine(V.a,D.a,W.a,Z.a);const St={getDataDir:d.a.getDataDir,sendMessage:(t,e)=>ut.send(t,e),send:async(t,e)=>await Object(F.runHandler)(U.a.handlers[t],e),on:(t,e)=>U.a.events.on(t,e),syncAndReceiveMessages:$.l,q:y.b,db:x,merkle:C.f,timestamp:{getClock:C.c,setClock:C.h,makeClock:C.e,makeClientId:C.d,serializeClock:C.g,deserializeClock:C.b,Timestamp:C.a},SyncProtoBuf:ht}}.call(this,r(20),r(14).Buffer,r(24))},function(t,e,r){"use strict";e.byteLength=function(t){var e=c(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=c(t),a=n[0],s=n[1],u=new o(function(t,e,r){return 3*(e+r)/4-r}(0,a,s)),l=0,f=s>0?a-4:a;for(r=0;r<f;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;2===s&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,u[l++]=255&e);1===s&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,s=r-i;a<s;a+=16383)o.push(l(t,a,a+16383>s?s:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var i,o,a=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){
17
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
18
+ e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,c=u>>1,l=-7,f=r?i-1:0,d=r?-1:1,h=t[e+f];for(f+=d,o=h&(1<<-l)-1,h>>=-l,l+=s;l>0;o=256*o+t[e+f],f+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+t[e+f],f+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,n),o-=c}return(h?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,f=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,g=n?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+f>=1?d/u:d*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(e*u-1)*Math.pow(2,i),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;t[r+h]=255&s,h+=g,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;t[r+h]=255&a,h+=g,a/=256,c-=8);t[r+h-g]|=128*p}},function(t,e){},function(t,e,r){var n,i,o=r(172),a=r(173),s=0,u=0;t.exports=function(t,e,r){var c=e&&r||0,l=e||[],f=(t=t||{}).node||n,d=void 0!==t.clockseq?t.clockseq:i;if(null==f||null==d){var h=o();null==f&&(f=n=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==d&&(d=i=16383&(h[6]<<8|h[7]))}var g=void 0!==t.msecs?t.msecs:(new Date).getTime(),p=void 0!==t.nsecs?t.nsecs:u+1,m=g-s+(p-u)/1e4;if(m<0&&void 0===t.clockseq&&(d=d+1&16383),(m<0||g>s)&&void 0===t.nsecs&&(p=0),p>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=g,u=p,i=d;var y=(1e4*(268435455&(g+=122192928e5))+p)%4294967296;l[c++]=y>>>24&255,l[c++]=y>>>16&255,l[c++]=y>>>8&255,l[c++]=255&y;var b=g/4294967296*1e4&268435455;l[c++]=b>>>8&255,l[c++]=255&b,l[c++]=b>>>24&15|16,l[c++]=b>>>16&255,l[c++]=d>>>8|128,l[c++]=255&d;for(var w=0;w<6;++w)l[c+w]=f[w];return e||a(l)}},function(t,e,r){var n=r(172),i=r(173);t.exports=function(t,e,r){var o=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var a=(t=t||{}).random||(t.rng||n)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,e)for(var s=0;s<16;++s)e[o+s]=a[s];return e||i(a)}},function(t,e,r){"use strict";function n(t){var e=this;if(e instanceof n||(e=new n),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)e.push(arguments[r]);return e}function i(t,e,r){var n=e===t.head?new s(r,null,e,t):new s(r,e,e.next,t);return null===n.next&&(t.tail=n),null===n.prev&&(t.head=n),t.length++,n}function o(t,e){t.tail=new s(e,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function a(t,e){t.head=new s(e,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function s(t,e,r,n){if(!(this instanceof s))return new s(t,e,r,n);this.list=n,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}t.exports=n,n.Node=s,n.create=n,n.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,r=t.prev;return e&&(e.prev=r),r&&(r.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=r),t.list.length--,t.next=null,t.prev=null,t.list=null,e},n.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}},n.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}},n.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)o(this,arguments[t]);return this.length},n.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)a(this,arguments[t]);return this.length},n.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}},n.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}},n.prototype.forEach=function(t,e){e=e||this;for(var r=this.head,n=0;null!==r;n++)t.call(e,r.value,n,this),r=r.next},n.prototype.forEachReverse=function(t,e){e=e||this;for(var r=this.tail,n=this.length-1;null!==r;n--)t.call(e,r.value,n,this),r=r.prev},n.prototype.get=function(t){for(var e=0,r=this.head;null!==r&&e<t;e++)r=r.next;if(e===t&&null!==r)return r.value},n.prototype.getReverse=function(t){for(var e=0,r=this.tail;null!==r&&e<t;e++)r=r.prev;if(e===t&&null!==r)return r.value},n.prototype.map=function(t,e){e=e||this;for(var r=new n,i=this.head;null!==i;)r.push(t.call(e,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(t,e){e=e||this;for(var r=new n,i=this.tail;null!==i;)r.push(t.call(e,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(t,e){var r,n=this.head;if(arguments.length>1)r=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var i=0;null!==n;i++)r=t(r,n.value,i),n=n.next;return r},n.prototype.reduceReverse=function(t,e){var r,n=this.tail;if(arguments.length>1)r=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var i=this.length-1;null!==n;i--)r=t(r,n.value,i),n=n.prev;return r},n.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;null!==r;e++)t[e]=r.value,r=r.next;return t},n.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;null!==r;e++)t[e]=r.value,r=r.prev;return t},n.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new n;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var i=0,o=this.head;null!==o&&i<t;i++)o=o.next;for(;null!==o&&i<e;i++,o=o.next)r.push(o.value);return r},n.prototype.sliceReverse=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new n;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var i=this.length,o=this.tail;null!==o&&i>e;i--)o=o.prev;for(;null!==o&&i>t;i--,o=o.prev)r.push(o.value);return r},n.prototype.splice=function(t,e){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var r=0,n=this.head;null!==n&&r<t;r++)n=n.next;var o=[];for(r=0;n&&r<e;r++)o.push(n.value),n=this.removeNode(n);null===n&&(n=this.tail),n!==this.head&&n!==this.tail&&(n=n.prev);for(r=2;r<arguments.length;r++)n=i(this,n,arguments[r]);return o},n.prototype.reverse=function(){for(var t=this.head,e=this.tail,r=t;null!==r;r=r.prev){var n=r.prev;r.prev=r.next,r.next=n}return this.head=e,this.tail=t,this};try{r(289)(n)}catch(t){}},function(t,e,r){"use strict";t.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}},function(t,e,r){"use strict";r.r(e),r.d(e,"SQLiteFS",(function(){return o}));const n=63,i=44;const o=class{constructor(t,e){this.FS=t,this.backend=e,this.node_ops={getattr:e=>{let r=t.isFile(e.mode)?e.contents.getattr():null,n={dev:1};return n.ino=e.id,n.mode=r?r.mode:e.mode,n.nlink=1,n.uid=0,n.gid=0,n.rdev=e.rdev,n.size=r?r.size:t.isDir(e.mode)?4096:0,n.atime=new Date(0),n.mtime=new Date(0),n.ctime=new Date(0),n.blksize=r?r.blockSize:4096,n.blocks=Math.ceil(n.size/n.blksize),n},setattr:(t,e)=>{this.FS.isFile(t.mode)?t.contents.setattr(e):(null!=e.mode&&(t.mode=e.mode),null!=e.size&&(t.size=e.size))},lookup:(t,e)=>{throw new this.FS.ErrnoError(i)},mknod:(t,e,r,n)=>{if(e.endsWith(".lock"))throw new Error("Locking via lockfiles is not supported");return this.createNode(t,e,r,n)},rename:(t,e,r)=>{throw new Error("rename not implemented")},unlink:(t,e)=>{this.FS.lookupNode(t,e).contents.delete(e)},readdir:t=>{throw new Error("readdir not implemented")},symlink:(t,e,r)=>{throw new Error("symlink not implemented")},readlink:t=>{throw new Error("symlink not implemented")}},this.stream_ops={open:t=>{this.FS.isFile(t.node.mode)&&t.node.contents.open()},close:t=>{this.FS.isFile(t.node.mode)&&t.node.contents.close()},read:(t,e,r,n,i)=>t.node.contents.read(e,r,n,i),write:(t,e,r,n,i)=>t.node.contents.write(e,r,n,i),llseek:(e,r,n)=>{var i=r;if(1===n?i+=e.position:2===n&&t.isFile(e.node.mode)&&(i+=e.node.contents.getattr().size),i<0)throw new this.FS.ErrnoError(28);return i},allocate:(t,e,r)=>{t.node.contents.setattr({size:e+r})},mmap:(t,e,r,n,i,o)=>{throw new Error("mmap not implemented")},msync:(t,e,r,n,i)=>{throw new Error("msync not implemented")},fsync:(t,e,r,n,i)=>{t.node.contents.fsync()}}}mount(){return this.createNode(null,"/",16895,0)}lock(t,e){let r=this.FS.lookupPath(t).node;return!r||!r.contents||r.contents.lock(e)}unlock(t,e){let r=this.FS.lookupPath(t).node;return!r||!r.contents||r.contents.unlock(e)}createNode(t,e,r,i){if(!this.FS.isDir(r)&&!this.FS.isFile(r))throw new this.FS.ErrnoError(n);var o=this.FS.createNode(t,e,r,i);return this.FS.isDir(o.mode)?(o.node_ops={mknod:this.node_ops.mknod,lookup:this.node_ops.lookup,unlink:this.node_ops.unlink,setattr:this.node_ops.setattr},o.stream_ops={},o.contents={}):this.FS.isFile(o.mode)&&(o.node_ops=this.node_ops,o.stream_ops=this.stream_ops,o.contents=this.backend.createFile(e)),t&&(t.contents[e]=o,t.timestamp=o.timestamp),o}}},function(t,e,r){"use strict";r.r(e),function(t){let r=1,n=2;function i(t){return(t[16]<<8)+t[17]}function o(t,e,r){return function(t,e,r){let n=[];for(let i=t;i<=e;i+=r)n.push(i);return n}(e-e%t,r-1-(r-1)%t,t)}function a(t,e,r,n){let i=o(e,r,n),a=0;return i.map(i=>{let o=0,s=e;r>i&&r<i+e&&(o=r-i),n>i&&n<i+e&&(s=n-i);let u=s-o,c=new ArrayBuffer(e);if(r>i+e||n<=i)return null;let l=t.byteOffset+a,f=t.buffer.byteLength-l;if(f<=0)return null;let d=Math.min(u,f);return new Uint8Array(c).set(new Uint8Array(t.buffer,l,d),o),a+=d,{pos:i,data:c,offset:o,length:d}}).filter(Boolean)}class s{constructor(t,e,r=null){this.filename=t,this.buffer=new Map,this.ops=e,this.meta=r,this._metaDirty=!1,this.writeLock=!1,this.openHandles=0}bufferChunks(t){for(let e=0;e<t.length;e++){let r=t[e];this.buffer.set(r.pos,r)}}open(){if(this.openHandles++,1===this.openHandles){this.ops.open();let t=this.ops.readMeta();null==this.meta&&(null==t&&(t={size:0}),this.meta=t)}return this.meta}close(){this.fsync(),this.openHandles=Math.max(this.openHandles-1,0),0===this.openHandles&&this.ops.close()}delete(){this.ops.delete()}load(t){let e=t.reduce((t,e)=>{let r=this.buffer.get(e);return r?t.chunks.push(r):t.missing.push(e),t},{chunks:[],missing:[]}),r=[];return e.missing.length>0&&(r=this.ops.readBlocks(e.missing,this.meta.blockSize)),e.chunks.concat(r)}read(t,e,r,n){let i=t.buffer;if(r<=0)return 0;if(n<0)return 0;if(n>=this.meta.size){let t=new Uint8Array(i,e);for(let e=0;e<r;e++)t[e]=0;return r}n=Math.max(n,0);let a=Math.min(r,this.meta.size-n),s=n,u=n+a,c=o(this.meta.blockSize,s,u),l=function(t,e,r){let n=new ArrayBuffer(r-e),i=new Uint8Array(n);for(let n=0;n<t.length;n++){let o=t[n];if("ArrayBuffer"!==o.data.constructor.name)throw new Error("Chunk data is not an ArrayBuffer");let a=0,s=o.data.byteLength;if(e>o.pos&&(a=e-o.pos),r<o.pos+o.data.byteLength&&(s=r-o.pos),a>o.data.byteLength||s<0)continue;let u=s-a;i.set(new Uint8Array(o.data,a,u),o.pos-e+a)}return n}(this.load(c),s,u);if(i.byteLength-e<l.byteLength)throw new Error("Buffer given to `read` is too small");let f=new Uint8Array(i);f.set(new Uint8Array(l),e);for(let t=a;t<r;t++)f[e+t]=0;return r}write(t,e,r,n){if(null==this.meta.blockSize){let r=i(new Uint8Array(t.buffer,t.byteOffset+e));if(![512,1024,2048,4096,8192,16384,32768,65536].includes(r))throw new Error("File has invalid page size. (the first block of a new file must be written first)");this.setattr({blockSize:r})}let o=t.buffer;if(r<=0)return 0;if(n<0)return 0;if(0===o.byteLength)return 0;r=Math.min(r,o.byteLength-e);let s=a(new Uint8Array(o,e,r),this.meta.blockSize,n,n+r).reduce((t,e)=>(e.length!==this.meta.blockSize?t.partialWrites.push(e):t.fullWrites.push({pos:e.pos,data:e.data}),t),{fullWrites:[],partialWrites:[]}),u=s.partialWrites,c=s.fullWrites,l=[];u.length>0&&(l=this.load(u.map(t=>t.pos)));let f=c.concat(l.map(t=>{let e=u.find(e=>e.pos===t.pos);return new Uint8Array(t.data).set(new Uint8Array(e.data,e.offset,e.length),e.offset,e.length),t}));return this.bufferChunks(f),n+r>this.meta.size&&this.setattr({size:n+r}),r}async readIfFallback(){if(this.ops.readIfFallback){let t=await this.ops.readIfFallback();this.meta=t||{size:0}}}lock(t){return this._recordingLock||(this._recordingLock=!0),!!this.ops.lock(t)&&(t>=n&&(this.writeLock=!0),!0)}unlock(t){return 0===t&&(this._recordingLock=!1),this.writeLock&&(this.fsync(),this.writeLock=!1),this.ops.unlock(t)}fsync(){if(this.buffer.size>0){let t=this.buffer.get(0);if(t){let e=i(new Uint8Array(t.data));if(e!==this.meta.blockSize){let t=this.buffer;this.buffer=new Map;let r=[...t.values()],n=r.length*this.meta.blockSize,i=new ArrayBuffer(n),o=new Uint8Array(i);for(let t of r)o.set(new Uint8Array(t.data),t.pos);this.bufferChunks(a(o,e,0,n)),this.setattr({blockSize:e})}}this.ops.writeBlocks([...this.buffer.values()],this.meta.blockSize)}this._metaDirty&&(this.ops.writeMeta({size:this.meta.size}),this._metaDirty=!1),this.buffer=new Map}setattr(t){null==this.meta&&(this.meta={}),void 0!==t.mode&&(this.meta.mode=t.mode),void 0!==t.blockSize&&(this.meta.blockSize=t.blockSize),void 0!==t.size&&(this.meta.size=t.size,this._metaDirty=!0)}getattr(){return this.meta}}class u{constructor(t,{initialOffset:e=4,useAtomics:r=!0,stream:n=!0,debug:i,name:o}={}){this.buffer=t,this.atomicView=new Int32Array(t),this.offset=e,this.useAtomics=r,this.stream=n,this.debug=i,this.name=o}log(...t){this.debug&&console.log(`[reader: ${this.name}]`,...t)}waitWrite(t,e=null){if(this.useAtomics){for(this.log("waiting for "+t);0===Atomics.load(this.atomicView,0);){if(null!=e&&"timed-out"===Atomics.wait(this.atomicView,0,0,e))throw new Error("timeout");Atomics.wait(this.atomicView,0,0,500)}this.log("resumed for "+t)}else if(1!==this.atomicView[0])throw new Error("`waitWrite` expected array to be readable")}flip(){if(this.log("flip"),this.useAtomics){if(1!==Atomics.compareExchange(this.atomicView,0,1,0))throw new Error("Read data out of sync! This is disastrous");Atomics.notify(this.atomicView,0)}else this.atomicView[0]=0;this.offset=4}done(){this.waitWrite("done");let t=3735928559===new DataView(this.buffer,this.offset).getUint32(0);return t&&(this.log("done"),this.flip()),t}peek(t){this.peekOffset=this.offset;let e=t();return this.offset=this.peekOffset,this.peekOffset=null,e}string(t){this.waitWrite("string",t);let e=this._int32(),r=e/2,n=new DataView(this.buffer,this.offset,e),i=[];for(let t=0;t<r;t++)i.push(n.getUint16(2*t));let o=String.fromCharCode.apply(null,i);return this.log("string",o),this.offset+=e,null==this.peekOffset&&this.flip(),o}_int32(){let t=new DataView(this.buffer,this.offset).getInt32();return this.log("_int32",t),this.offset+=4,t}int32(){this.waitWrite("int32");let t=this._int32();return this.log("int32",t),null==this.peekOffset&&this.flip(),t}bytes(){this.waitWrite("bytes");let t=this._int32(),e=new ArrayBuffer(t);return new Uint8Array(e).set(new Uint8Array(this.buffer,this.offset,t)),this.log("bytes",e),this.offset+=t,null==this.peekOffset&&this.flip(),e}}class c{constructor(t,{initialOffset:e=4,useAtomics:r=!0,stream:n=!0,debug:i,name:o}={}){this.buffer=t,this.atomicView=new Int32Array(t),this.offset=e,this.useAtomics=r,this.stream=n,this.debug=i,this.name=o,this.useAtomics?Atomics.store(this.atomicView,0,0):this.atomicView[0]=0}log(...t){this.debug&&console.log(`[writer: ${this.name}]`,...t)}waitRead(t){if(this.useAtomics){if(this.log("waiting for "+t),0!==Atomics.compareExchange(this.atomicView,0,0,1))throw new Error("Wrote something into unwritable buffer! This is disastrous");for(Atomics.notify(this.atomicView,0);1===Atomics.load(this.atomicView,0);)Atomics.wait(this.atomicView,0,1,500);this.log("resumed for "+t)}else this.atomicView[0]=1;this.offset=4}finalize(){this.log("finalizing"),new DataView(this.buffer,this.offset).setUint32(0,3735928559),this.waitRead("finalize")}string(t){this.log("string",t);let e=2*t.length;this._int32(e);let r=new DataView(this.buffer,this.offset,e);for(let e=0;e<t.length;e++)r.setUint16(2*e,t.charCodeAt(e));this.offset+=e,this.waitRead("string")}_int32(t){new DataView(this.buffer,this.offset).setInt32(0,t),this.offset+=4}int32(t){this.log("int32",t),this._int32(t),this.waitRead("int32")}bytes(t){this.log("bytes",t);let e=t.byteLength;this._int32(e),new Uint8Array(this.buffer,this.offset).set(new Uint8Array(t)),this.offset+=e,this.waitRead("bytes")}}function l(t,e){return Math.round(t/e)}class f{constructor(t){this.filename=t}getStoreName(){return this.filename.replace(/\//g,"-")}invokeWorker(t,e){if(null==this.reader||null==this.writer)throw new Error(`Attempted ${t} on ${this.filename} but file not open`);let r=this.reader,n=this.writer;switch(t){case"readBlocks":{let t=e.name,i=e.positions,o=e.blockSize,a=[];for(let e of i){n.string("readBlock"),n.string(t),n.int32(l(e,o)),n.finalize();let i=r.bytes();r.done(),a.push({pos:e,data:0===i.byteLength?new ArrayBuffer(o):i})}return a}case"writeBlocks":{let t=e.name,i=e.writes,o=e.blockSize;n.string("writeBlocks"),n.string(t);for(let t of i)n.int32(l(t.pos,o)),n.bytes(t.data);n.finalize();let a=r.int32();return r.done(),a}case"readMeta":{n.string("readMeta"),n.string(e.name),n.finalize();let t=r.int32(),i=r.int32();return r.done(),-1===t?null:{size:t,blockSize:i}}case"writeMeta":{let t=e.name,i=e.meta;n.string("writeMeta"),n.string(t),n.int32(i.size),n.finalize();let o=r.int32();return r.done(),o}case"closeFile":{n.string("closeFile"),n.string(e.name),n.finalize();let t=r.int32();return r.done(),t}case"lockFile":{n.string("lockFile"),n.string(e.name),n.int32(e.lockType),n.finalize();let t=r.int32();return r.done(),0===t}case"unlockFile":{n.string("unlockFile"),n.string(e.name),n.int32(e.lockType),n.finalize();let t=r.int32();return r.done(),0===t}}}lock(t){return this.invokeWorker("lockFile",{name:this.getStoreName(),lockType:t})}unlock(t){return this.invokeWorker("unlockFile",{name:this.getStoreName(),lockType:t})}delete(){(this.reader||this.writer)&&this.close();let t=globalThis.indexedDB.deleteDatabase(this.getStoreName());t.onerror=()=>{console.warn(`Deleting ${this.filename} database failed`)},t.onsuccess=()=>{}}open(){let t=new SharedArrayBuffer(36864);this.writer=new c(t,{name:"args (backend)",debug:!1});let e=new SharedArrayBuffer(36864);var r,n;this.reader=new u(e,{name:"results",debug:!1}),r=this.reader,n=this.writer,self.postMessage({type:"__absurd:spawn-idb-worker",argBuffer:n.buffer,resultBuffer:r.buffer}),self.addEventListener("message",t=>{switch(t.data.type){case"__perf-deets:start-profile":n.string("profile-start"),n.finalize(),r.int32(),r.done();break;case"__perf-deets:stop-profile":n.string("profile-stop"),n.finalize(),r.int32(),r.done()}})}close(){this.invokeWorker("closeFile",{name:this.getStoreName()}),this.reader=null,this.writer=null,this.worker=null}readMeta(){return this.invokeWorker("readMeta",{name:this.getStoreName()})}writeMeta(t){return this.invokeWorker("writeMeta",{name:this.getStoreName(),meta:t})}readBlocks(t,e){return this.stats&&(this.stats.read+=t.length),this.invokeWorker("readBlocks",{name:this.getStoreName(),positions:t,blockSize:e})}writeBlocks(t,e){return this.stats&&(this.stats.writes+=t.length),this.invokeWorker("writeBlocks",{name:this.getStoreName(),writes:t,blockSize:e})}}function d(t,e){return Math.round(t/e)}class h{constructor(t){this._openDb=null,this.hasAlertedFailure=!1,this.onFallbackFailure=t}async getDb(){return this._openDb||(this._openDb=await async function(t){return new Promise((e,r)=>{let n=globalThis.indexedDB.open(t,2);n.onsuccess=t=>{let r=t.target.result;r.onversionchange=()=>{console.log("closing because version changed"),r.close()},r.onclose=()=>{},e(r)},n.onupgradeneeded=t=>{let e=t.target.result;e.objectStoreNames.contains("data")||e.createObjectStore("data")},n.onblocked=t=>console.log("blocked",t),n.onerror=n.onabort=t=>r(t.target.error)})}(this.dbName)),this._openDb}closeDb(){this._openDb&&(this._openDb.close(),this._openDb=null)}async readAll(){let t=await this.getDb(this.dbName),e=new Map,r=t.transaction(["data"],"readonly").objectStore("data");return new Promise((t,n)=>{let i=r.openCursor(IDBKeyRange.lowerBound(-1));i.onerror=n,i.onsuccess=r=>{let n=r.target.result;n?(e.set(n.key,n.value),n.continue()):t(e)}})}async write(t,e,r){let n=(await this.getDb(this.dbName)).transaction(["data"],"readwrite"),i=n.objectStore("data");await new Promise((o,a)=>{let s=i.get(0);s.onsuccess=u=>{if(r&&!function(t,e){if(null!=t&&null!=e){let r=new Uint8Array(t),n=new Uint8Array(e);for(let t=24;t<40;t++)if(r[t]!==n[t])return!1;return!0}return null==t&&null==e}(s.result,e))return this.onFallbackFailure&&!this.hasAlertedFailure&&(this.hasAlertedFailure=!0,this.onFallbackFailure()),void a(new Error("Fallback mode unable to write file changes"));for(let e of t)i.put(e.value,e.key);n.onsuccess=()=>o(),n.onerror=()=>a()},s.onerror=a})}}class g{constructor(t,e){this.filename=t,this.dbName=this.filename.replace(/\//g,"-"),this.cachedFirstBlock=null,this.writeQueue=null,this.blocks=new Map,this.lockType=0,this.transferBlockOwnership=!1,this.persistance=new h(e)}async readIfFallback(){return this.transferBlockOwnership=!0,this.blocks=await this.persistance.readAll(),this.readMeta()}lock(t){return this.cachedFirstBlock=this.blocks.get(0),this.lockType=t,!0}unlock(t){return this.lockType>r&&t===r&&this.flush(),this.lockType=t,!0}delete(){let t=globalThis.indexedDB.deleteDatabase(this.dbName);t.onerror=()=>{console.warn(`Deleting ${this.filename} database failed`)},t.onsuccess=()=>{}}open(){this.writeQueue=[],this.lockType=0}close(){this.flush(),this.transferBlockOwnership?this.transferBlockOwnership=!1:this.blocks=new Map,this.persistance.closeDb()}readMeta(){let t=this.blocks.get(-1);if(t){let e=this.blocks.get(0);return{size:t.size,blockSize:i(new Uint8Array(e))}}return null}writeMeta(t){this.blocks.set(-1,t),this.queueWrite(-1,t)}readBlocks(t,e){let r=[];for(let n of t)r.push({pos:n,data:this.blocks.get(d(n,e))});return r}writeBlocks(t,e){for(let r of t){let t=d(r.pos,e);this.blocks.set(t,r.data),this.queueWrite(t,r.data)}this.lockType<=r&&this.flush()}queueWrite(t,e){this.writeQueue.push({key:t,value:e})}flush(){this.writeQueue.length>0&&(this.persistance.write(this.writeQueue,this.cachedFirstBlock,this.lockType>r),this.writeQueue=[]),this.cachedFirstBlock=null}}e.default=class{constructor(t){this.onFallbackFailure=t}createFile(e){let r;r="undefined"!=typeof SharedArrayBuffer?new f(e):new g(e,this.onFallbackFailure);let n=new s(e,r);return t.env.PERF_BUILD&&(null==this._files&&(this._files=new Set),this._files.add(n)),n}startProfile(){for(let t of this._files)if(t.ops.writer){let e=t.ops.writer,r=t.ops.reader;e.string("profile-start"),e.finalize(),r.int32(),r.done()}}stopProfile(){for(let t of this._files)if(t.ops.writer){let e=t.ops.writer,r=t.ops.reader;e.string("profile-stop"),e.finalize(),r.int32(),r.done()}}}}.call(this,r(20))},function(t,e){"function"==typeof BigInt?e.default=BigInt:e.default=function(){throw new Error("BigInt is not supported in this environment.")}},function(t,e,r){"use strict";
19
+ /*
20
+ object-assign
21
+ (c) Sindre Sorhus
22
+ @license MIT
23
+ */var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function a(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,s,u=a(t),c=1;c<arguments.length;c++){for(var l in r=Object(arguments[c]))i.call(r,l)&&(u[l]=r[l]);if(n){s=n(r);for(var f=0;f<s.length;f++)o.call(r,s[f])&&(u[s[f]]=r[s[f]])}}return u}},function(t,e){t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),i=0;for(e=0;e<r;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)n[i]=o[a];return n};Object.defineProperty(e,"__esModule",{value:!0});var a,s,u=r(50),c=r(297),l=r(135),f=r(175),d=r(136),h=r(179),g=r(178),p=r(299),m=r(97),y=r(96),b=r(61),w=r(176),_=r(177),v=r(81),E=r(308),S=u.resolve,O=y.constants.O_RDONLY,T=y.constants.O_WRONLY,A=y.constants.O_RDWR,M=y.constants.O_CREAT,j=y.constants.O_EXCL,I=y.constants.O_TRUNC,R=y.constants.O_APPEND,D=y.constants.O_SYNC,k=y.constants.O_DIRECTORY,N=y.constants.F_OK,C=y.constants.COPYFILE_EXCL,x=y.constants.COPYFILE_FICLONE_FORCE;if(u.posix){var L=u.posix;a=L.sep,s=L.relative}else a=u.sep,s=u.relative;var P,B="win32"===g.default.platform,U="path must be a string or Buffer",F="fd must be a file descriptor",W="mode must be an int",H="callback must be a function",q="uid must be an unsigned int",z="gid must be an unsigned int",V="ENOENT";function Y(t,e,r,n,i){void 0===e&&(e=""),void 0===r&&(r=""),void 0===n&&(n=""),void 0===i&&(i=Error);var o=new i(function(t,e,r,n){void 0===e&&(e=""),void 0===r&&(r=""),void 0===n&&(n="");var i="";switch(r&&(i=" '"+r+"'"),n&&(i+=" -> '"+n+"'"),t){case V:return"ENOENT: no such file or directory, "+e+i;case"EBADF":return"EBADF: bad file descriptor, "+e+i;case"EINVAL":return"EINVAL: invalid argument, "+e+i;case"EPERM":return"EPERM: operation not permitted, "+e+i;case"EPROTO":return"EPROTO: protocol error, "+e+i;case"EEXIST":return"EEXIST: file already exists, "+e+i;case"ENOTDIR":return"ENOTDIR: not a directory, "+e+i;case"EISDIR":return"EISDIR: illegal operation on a directory, "+e+i;case"EACCES":return"EACCES: permission denied, "+e+i;case"ENOTEMPTY":return"ENOTEMPTY: directory not empty, "+e+i;case"EMFILE":return"EMFILE: too many open files, "+e+i;case"ENOSYS":return"ENOSYS: function not implemented, "+e+i;default:return t+": error occurred, "+e+i}}(t,e,r,n));return o.code=t,o}function G(t){if("number"==typeof t)return t;if("string"==typeof t){var e=P[t];if(void 0!==e)return e}throw new _.TypeError("ERR_INVALID_OPT_VALUE","flags",t)}function $(t,e){var r;if(!e)return t;var n=typeof e;switch(n){case"string":r=Object.assign({},t,{encoding:e});break;case"object":r=Object.assign({},t,e);break;default:throw TypeError(function(t){return"Expected options to be either an object or a string, but got "+t+" instead"}(n))}return"buffer"!==r.encoding&&w.assertEncoding(r.encoding),r}function K(t){return function(e){return $(t,e)}}function Z(t){if("function"!=typeof t)throw TypeError(H);return t}function J(t){return function(e,r){return"function"==typeof e?[t(),e]:[t(e),Z(r)]}}!function(t){t[t.r=O]="r",t[t["r+"]=A]="r+",t[t.rs=O|D]="rs",t[t.sr=t.rs]="sr",t[t["rs+"]=A|D]="rs+",t[t["sr+"]=t["rs+"]]="sr+",t[t.w=T|M|I]="w",t[t.wx=T|M|I|j]="wx",t[t.xw=t.wx]="xw",t[t["w+"]=A|M|I]="w+",t[t["wx+"]=A|M|I|j]="wx+",t[t["xw+"]=t["wx+"]]="xw+",t[t.a=T|R|M]="a",t[t.ax=T|R|M|j]="ax",t[t.xa=t.ax]="xa",t[t["a+"]=A|R|M]="a+",t[t["ax+"]=A|R|M|j]="ax+",t[t["xa+"]=t["ax+"]]="xa+"}(P=e.FLAGS||(e.FLAGS={})),e.flagsToNumber=G;var X={encoding:"utf8"},Q=K(X),tt=J(Q),et=K({flag:"r"}),rt={encoding:"utf8",mode:438,flag:P[P.w]},nt=K(rt),it={encoding:"utf8",mode:438,flag:P[P.a]},ot=K(it),at=J(ot),st=K(X),ut=J(st),ct={mode:511,recursive:!1},lt=function(t){return"number"==typeof t?Object.assign({},ct,{mode:t}):Object.assign({},ct,t)},ft={recursive:!1},dt=function(t){return Object.assign({},ft,t)},ht=K({encoding:"utf8",withFileTypes:!1}),gt=J(ht),pt={bigint:!1},mt=function(t){return void 0===t&&(t={}),Object.assign({},pt,t)},yt=function(t,e){return"function"==typeof t?[mt(),t]:[mt(t),Z(e)]};function bt(t){if("string"!=typeof t&&!d.Buffer.isBuffer(t)){try{if(!(t instanceof r(309).URL))throw new TypeError(U)}catch(t){throw new TypeError(U)}t=function(t){if(""!==t.hostname)throw new _.TypeError("ERR_INVALID_FILE_URL_HOST",g.default.platform);for(var e=t.pathname,r=0;r<e.length;r++)if("%"===e[r]){var n=32|e.codePointAt(r+2);if("2"===e[r+1]&&102===n)throw new _.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}return decodeURIComponent(e)}(t)}var e=String(t);return At(e),e}e.pathToFilename=bt;var wt=function(t,e){return void 0===e&&(e=g.default.cwd()),S(e,t)};if(B){var _t=wt,vt=r(315).unixify;wt=function(t,e){return vt(_t(t,e))}}function Et(t,e){var r=wt(t,e).substr(1);return r?r.split(a):[]}function St(t){return Et(bt(t))}function Ot(t,e){return void 0===e&&(e=w.ENCODING_UTF8),d.Buffer.isBuffer(t)?t:t instanceof Uint8Array?d.bufferFrom(t):d.bufferFrom(String(t),e)}function Tt(t,e){return e&&"buffer"!==e?t.toString(e):t}function At(t,e){if(-1!==(""+t).indexOf("\0")){var r=new Error("Path must be a string without null bytes");if(r.code=V,"function"!=typeof e)throw r;return g.default.nextTick(e,r),!1}return!0}function Mt(t,e){var r=function(t,e){return"number"==typeof t?t:"string"==typeof t?parseInt(t,8):e?Mt(e):void 0}(t,e);if("number"!=typeof r||isNaN(r))throw new TypeError(W);return r}function jt(t){return t>>>0===t}function It(t){if(!jt(t))throw TypeError(F)}function Rt(t){if("string"==typeof t&&+t==t)return+t;if(t instanceof Date)return t.getTime()/1e3;if(isFinite(t))return t<0?Date.now()/1e3:t;throw new Error("Cannot parse time: "+t)}function Dt(t){if("number"!=typeof t)throw TypeError(q)}function kt(t){if("number"!=typeof t)throw TypeError(z)}e.filenameToSteps=Et,e.pathToSteps=St,e.dataToStr=function(t,e){return void 0===e&&(e=w.ENCODING_UTF8),d.Buffer.isBuffer(t)?t.toString(e):t instanceof Uint8Array?d.bufferFrom(t).toString(e):String(t)},e.dataToBuffer=Ot,e.bufferToEncoding=Tt,e.toUnixTimestamp=Rt;var Nt=function(){function t(t){void 0===t&&(t={}),this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.maxFiles=1e4,this.openFiles=0,this.promisesApi=E.default(this),this.statWatchers={},this.props=Object.assign({Node:c.Node,Link:c.Link,File:c.File},t);var e=this.createLink();e.setNode(this.createNode(!0));var r=this;this.StatWatcher=function(t){function e(){return t.call(this,r)||this}return i(e,t),e}(Lt);var n=Pt;this.ReadStream=function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.apply(this,o([r],e))||this}return i(e,t),e}(n);var a=Ut;this.WriteStream=function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.apply(this,o([r],e))||this}return i(e,t),e}(a),this.FSWatcher=function(t){function e(){return t.call(this,r)||this}return i(e,t),e}(Ft),this.root=e}return t.fromJSON=function(e,r){var n=new t;return n.fromJSON(e,r),n},Object.defineProperty(t.prototype,"promises",{get:function(){if(null===this.promisesApi)throw new Error("Promise is not supported in this environment.");return this.promisesApi},enumerable:!0,configurable:!0}),t.prototype.createLink=function(t,e,r,n){if(void 0===r&&(r=!1),!t)return new this.props.Link(this,null,"");if(!e)throw new Error("createLink: name cannot be empty");return t.createChild(e,this.createNode(r,n))},t.prototype.deleteLink=function(t){var e=t.parent;return!!e&&(e.deleteChild(t),!0)},t.prototype.newInoNumber=function(){var t=this.releasedInos.pop();return t||(this.ino=(this.ino+1)%4294967295,this.ino)},t.prototype.newFdNumber=function(){var e=this.releasedFds.pop();return"number"==typeof e?e:t.fd--},t.prototype.createNode=function(t,e){void 0===t&&(t=!1);var r=new this.props.Node(this.newInoNumber(),e);return t&&r.setIsDirectory(),this.inodes[r.ino]=r,r},t.prototype.getNode=function(t){return this.inodes[t]},t.prototype.deleteNode=function(t){t.del(),delete this.inodes[t.ino],this.releasedInos.push(t.ino)},t.prototype.genRndStr=function(){var t=(Math.random()+1).toString(36).substr(2,6);return 6===t.length?t:this.genRndStr()},t.prototype.getLink=function(t){return this.root.walk(t)},t.prototype.getLinkOrThrow=function(t,e){var r=Et(t),n=this.getLink(r);if(!n)throw Y(V,e,t);return n},t.prototype.getResolvedLink=function(t){for(var e="string"==typeof t?Et(t):t,r=this.root,n=0;n<e.length;){var i=e[n];if(!(r=r.getChild(i)))return null;var o=r.getNode();o.isSymlink()?(e=o.symlink.concat(e.slice(n+1)),r=this.root,n=0):n++}return r},t.prototype.getResolvedLinkOrThrow=function(t,e){var r=this.getResolvedLink(t);if(!r)throw Y(V,e,t);return r},t.prototype.resolveSymlinks=function(t){return this.getResolvedLink(t.steps.slice(1))},t.prototype.getLinkAsDirOrThrow=function(t,e){var r=this.getLinkOrThrow(t,e);if(!r.getNode().isDirectory())throw Y("ENOTDIR",e,t);return r},t.prototype.getLinkParent=function(t){return this.root.walk(t,t.length-1)},t.prototype.getLinkParentAsDirOrThrow=function(t,e){var r=t instanceof Array?t:Et(t),n=this.getLinkParent(r);if(!n)throw Y(V,e,a+r.join(a));if(!n.getNode().isDirectory())throw Y("ENOTDIR",e,a+r.join(a));return n},t.prototype.getFileByFd=function(t){return this.fds[String(t)]},t.prototype.getFileByFdOrThrow=function(t,e){if(!jt(t))throw TypeError(F);var r=this.getFileByFd(t);if(!r)throw Y("EBADF",e);return r},t.prototype.getNodeByIdOrCreate=function(t,e,r){if("number"==typeof t){var n=this.getFileByFd(t);if(!n)throw Error("File nto found");return n.node}var i=St(t),o=this.getLink(i);if(o)return o.getNode();if(e&M){var a=this.getLinkParent(i);if(a){var s=i[i.length-1];return(o=this.createLink(a,s,!1,r)).getNode()}}throw Y(V,"getNodeByIdOrCreate",bt(t))},t.prototype.wrapAsync=function(t,e,r){var n=this;Z(r),h.default((function(){try{r(null,t.apply(n,e))}catch(t){r(t)}}))},t.prototype._toJSON=function(t,e,r){var n;void 0===t&&(t=this.root),void 0===e&&(e={});var i=!0,o=t.children;for(var a in t.getNode().isFile()&&((n={})[t.getName()]=t.parent.getChild(t.getName()),o=n,t=t.parent),o){i=!1;var u=t.getChild(a);if(!u)throw new Error("_toJSON: unexpected undefined");var c=u.getNode();if(c.isFile()){var l=u.getPath();r&&(l=s(r,l)),e[l]=c.getString()}else c.isDirectory()&&this._toJSON(u,e,r)}var f=t.getPath();return r&&(f=s(r,f)),f&&i&&(e[f]=null),e},t.prototype.toJSON=function(t,e,r){void 0===e&&(e={}),void 0===r&&(r=!1);var n=[];if(t){t instanceof Array||(t=[t]);for(var i=0,o=t;i<o.length;i++){var a=bt(o[i]);(c=this.getResolvedLink(a))&&n.push(c)}}else n.push(this.root);if(!n.length)return e;for(var s=0,u=n;s<u.length;s++){var c=u[s];this._toJSON(c,e,r?c.getPath():"")}return e},t.prototype.fromJSON=function(t,e){for(var r in void 0===e&&(e=g.default.cwd()),t){var n=t[r];if("string"==typeof n){var i=Et(r=wt(r,e));if(i.length>1){var o=a+i.slice(0,i.length-1).join(a);this.mkdirpBase(o,511)}this.writeFileSync(r,n)}else this.mkdirpBase(r,511)}},t.prototype.reset=function(){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.openFiles=0,this.root=this.createLink(),this.root.setNode(this.createNode(!0))},t.prototype.mountSync=function(t,e){this.fromJSON(e,t)},t.prototype.openLink=function(t,e,r){if(void 0===r&&(r=!0),this.openFiles>=this.maxFiles)throw Y("EMFILE","open",t.getPath());var n=t;if(r&&(n=this.resolveSymlinks(t)),!n)throw Y(V,"open",t.getPath());var i=n.getNode();if(i.isDirectory()){if((e&(O|A|T))!==O)throw Y("EISDIR","open",t.getPath())}else if(e&k)throw Y("ENOTDIR","open",t.getPath());if(!(e&T||i.canRead()))throw Y("EACCES","open",t.getPath());var o=new this.props.File(t,i,e,this.newFdNumber());return this.fds[o.fd]=o,this.openFiles++,e&I&&o.truncate(),o},t.prototype.openFile=function(t,e,r,n){void 0===n&&(n=!0);var i=Et(t),o=n?this.getResolvedLink(i):this.getLink(i);if(!o&&e&M){var s=this.getResolvedLink(i.slice(0,i.length-1));if(!s)throw Y(V,"open",a+i.join(a));e&M&&"number"==typeof r&&(o=this.createLink(s,i[i.length-1],!1,r))}if(o)return this.openLink(o,e,n);throw Y(V,"open",t)},t.prototype.openBase=function(t,e,r,n){void 0===n&&(n=!0);var i=this.openFile(t,e,r,n);if(!i)throw Y(V,"open",t);return i.fd},t.prototype.openSync=function(t,e,r){void 0===r&&(r=438);var n=Mt(r),i=bt(t),o=G(e);return this.openBase(i,o,n)},t.prototype.open=function(t,e,r,n){var i=r,o=n;"function"==typeof r&&(i=438,o=r);var a=Mt(i=i||438),s=bt(t),u=G(e);this.wrapAsync(this.openBase,[s,u,a],o)},t.prototype.closeFile=function(t){this.fds[t.fd]&&(this.openFiles--,delete this.fds[t.fd],this.releasedFds.push(t.fd))},t.prototype.closeSync=function(t){It(t);var e=this.getFileByFdOrThrow(t,"close");this.closeFile(e)},t.prototype.close=function(t,e){It(t),this.wrapAsync(this.closeSync,[t],e)},t.prototype.openFileOrGetById=function(t,e,r){if("number"==typeof t){var n=this.fds[t];if(!n)throw Y(V);return n}return this.openFile(bt(t),e,r)},t.prototype.readBase=function(t,e,r,n,i){return this.getFileByFdOrThrow(t).read(e,Number(r),Number(n),i)},t.prototype.readSync=function(t,e,r,n,i){return It(t),this.readBase(t,e,r,n,i)},t.prototype.read=function(t,e,r,n,i,o){var a=this;if(Z(o),0===n)return g.default.nextTick((function(){o&&o(null,0,e)}));h.default((function(){try{var s=a.readBase(t,e,r,n,i);o(null,s,e)}catch(t){o(t)}}))},t.prototype.readFileBase=function(t,e,r){var n,i,o="number"==typeof t&&jt(t);if(o)i=t;else{var a=Et(bt(t)),s=this.getResolvedLink(a);if(s)if(s.getNode().isDirectory())throw Y("EISDIR","open",s.getPath());i=this.openSync(t,e)}try{n=Tt(this.getFileByFdOrThrow(i).getBuffer(),r)}finally{o||this.closeSync(i)}return n},t.prototype.readFileSync=function(t,e){var r=et(e),n=G(r.flag);return this.readFileBase(t,n,r.encoding)},t.prototype.readFile=function(t,e,r){var n=J(et)(e,r),i=n[0],o=n[1],a=G(i.flag);this.wrapAsync(this.readFileBase,[t,a,i.encoding],o)},t.prototype.writeBase=function(t,e,r,n,i){return this.getFileByFdOrThrow(t,"write").write(e,r,n,i)},t.prototype.writeSync=function(t,e,r,n,i){var o,a,s,u;It(t);var c="string"!=typeof e;c?(a=0|(r||0),s=n,u=i):(u=r,o=n);var l=Ot(e,o);return c?void 0===s&&(s=l.length):(a=0,s=l.length),this.writeBase(t,l,a,s,u)},t.prototype.write=function(t,e,r,n,i,o){var a,s,u,c,l,f=this;It(t);var d=typeof e,g=typeof r,p=typeof n,m=typeof i;"string"!==d?"function"===g?l=r:"function"===p?(a=0|r,l=n):"function"===m?(a=0|r,s=n,l=i):(a=0|r,s=n,u=i,l=o):"function"===g?l=r:"function"===p?(u=r,l=n):"function"===m&&(u=r,c=n,l=i);var y=Ot(e,c);"string"!==d?void 0===s&&(s=y.length):(a=0,s=y.length);var b=Z(l);h.default((function(){try{var r=f.writeBase(t,y,a,s,u);b(null,r,"string"!==d?y:e)}catch(t){b(t)}}))},t.prototype.writeFileBase=function(t,e,r,n){var i,o="number"==typeof t;i=o?t:this.openBase(bt(t),r,n);var a=0,s=e.length,u=r&R?void 0:0;try{for(;s>0;){var c=this.writeSync(i,e,a,s,u);a+=c,s-=c,void 0!==u&&(u+=c)}}finally{o||this.closeSync(i)}},t.prototype.writeFileSync=function(t,e,r){var n=nt(r),i=G(n.flag),o=Mt(n.mode),a=Ot(e,n.encoding);this.writeFileBase(t,a,i,o)},t.prototype.writeFile=function(t,e,r,n){var i=r,o=n;"function"==typeof r&&(i=rt,o=r);var a=Z(o),s=nt(i),u=G(s.flag),c=Mt(s.mode),l=Ot(e,s.encoding);this.wrapAsync(this.writeFileBase,[t,l,u,c],a)},t.prototype.linkBase=function(t,e){var r=Et(t),n=this.getLink(r);if(!n)throw Y(V,"link",t,e);var i=Et(e),o=this.getLinkParent(i);if(!o)throw Y(V,"link",t,e);var a=i[i.length-1];if(o.getChild(a))throw Y("EEXIST","link",t,e);var s=n.getNode();s.nlink++,o.createChild(a,s)},t.prototype.copyFileBase=function(t,e,r){var n=this.readFileSync(t);if(r&C&&this.existsSync(e))throw Y("EEXIST","copyFile",t,e);if(r&x)throw Y("ENOSYS","copyFile",t,e);this.writeFileBase(e,n,P.w,438)},t.prototype.copyFileSync=function(t,e,r){var n=bt(t),i=bt(e);return this.copyFileBase(n,i,0|(r||0))},t.prototype.copyFile=function(t,e,r,n){var i,o,a=bt(t),s=bt(e);"function"==typeof r?(i=0,o=r):(i=r,o=n),Z(o),this.wrapAsync(this.copyFileBase,[a,s,i],o)},t.prototype.linkSync=function(t,e){var r=bt(t),n=bt(e);this.linkBase(r,n)},t.prototype.link=function(t,e,r){var n=bt(t),i=bt(e);this.wrapAsync(this.linkBase,[n,i],r)},t.prototype.unlinkBase=function(t){var e=Et(t),r=this.getLink(e);if(!r)throw Y(V,"unlink",t);if(r.length)throw Error("Dir not empty...");this.deleteLink(r);var n=r.getNode();n.nlink--,n.nlink<=0&&this.deleteNode(n)},t.prototype.unlinkSync=function(t){var e=bt(t);this.unlinkBase(e)},t.prototype.unlink=function(t,e){var r=bt(t);this.wrapAsync(this.unlinkBase,[r],e)},t.prototype.symlinkBase=function(t,e){var r=Et(e),n=this.getLinkParent(r);if(!n)throw Y(V,"symlink",t,e);var i=r[r.length-1];if(n.getChild(i))throw Y("EEXIST","symlink",t,e);var o=n.createChild(i);return o.getNode().makeSymlink(Et(t)),o},t.prototype.symlinkSync=function(t,e,r){var n=bt(t),i=bt(e);this.symlinkBase(n,i)},t.prototype.symlink=function(t,e,r,n){var i=Z("function"==typeof r?r:n),o=bt(t),a=bt(e);this.wrapAsync(this.symlinkBase,[o,a],i)},t.prototype.realpathBase=function(t,e){var r=Et(t),n=this.getResolvedLink(r);if(!n)throw Y(V,"realpath",t);return w.strToEncoding(n.getPath(),e)},t.prototype.realpathSync=function(t,e){return this.realpathBase(bt(t),st(e).encoding)},t.prototype.realpath=function(t,e,r){var n=ut(e,r),i=n[0],o=n[1],a=bt(t);this.wrapAsync(this.realpathBase,[a,i.encoding],o)},t.prototype.lstatBase=function(t,e){void 0===e&&(e=!1);var r=this.getLink(Et(t));if(!r)throw Y(V,"lstat",t);return l.default.build(r.getNode(),e)},t.prototype.lstatSync=function(t,e){return this.lstatBase(bt(t),mt(e).bigint)},t.prototype.lstat=function(t,e,r){var n=yt(e,r),i=n[0],o=n[1];this.wrapAsync(this.lstatBase,[bt(t),i.bigint],o)},t.prototype.statBase=function(t,e){void 0===e&&(e=!1);var r=this.getResolvedLink(Et(t));if(!r)throw Y(V,"stat",t);return l.default.build(r.getNode(),e)},t.prototype.statSync=function(t,e){return this.statBase(bt(t),mt(e).bigint)},t.prototype.stat=function(t,e,r){var n=yt(e,r),i=n[0],o=n[1];this.wrapAsync(this.statBase,[bt(t),i.bigint],o)},t.prototype.fstatBase=function(t,e){void 0===e&&(e=!1);var r=this.getFileByFd(t);if(!r)throw Y("EBADF","fstat");return l.default.build(r.node,e)},t.prototype.fstatSync=function(t,e){return this.fstatBase(t,mt(e).bigint)},t.prototype.fstat=function(t,e,r){var n=yt(e,r),i=n[0],o=n[1];this.wrapAsync(this.fstatBase,[t,i.bigint],o)},t.prototype.renameBase=function(t,e){var r=this.getLink(Et(t));if(!r)throw Y(V,"rename",t,e);var n=Et(e),i=this.getLinkParent(n);if(!i)throw Y(V,"rename",t,e);var a=r.parent;a&&a.deleteChild(r);var s=n[n.length-1];r.steps=o(i.steps,[s]),i.setChild(r.getName(),r)},t.prototype.renameSync=function(t,e){var r=bt(t),n=bt(e);this.renameBase(r,n)},t.prototype.rename=function(t,e,r){var n=bt(t),i=bt(e);this.wrapAsync(this.renameBase,[n,i],r)},t.prototype.existsBase=function(t){return!!this.statBase(t)},t.prototype.existsSync=function(t){try{return this.existsBase(bt(t))}catch(t){return!1}},t.prototype.exists=function(t,e){var r=this,n=bt(t);if("function"!=typeof e)throw Error(H);h.default((function(){try{e(r.existsBase(n))}catch(t){e(!1)}}))},t.prototype.accessBase=function(t,e){this.getLinkOrThrow(t,"access")},t.prototype.accessSync=function(t,e){void 0===e&&(e=N);var r=bt(t);e|=0,this.accessBase(r,e)},t.prototype.access=function(t,e,r){var n,i=N;"function"!=typeof e?(i=0|e,n=Z(r)):n=e;var o=bt(t);this.wrapAsync(this.accessBase,[o,i],n)},t.prototype.appendFileSync=function(t,e,r){void 0===r&&(r=it);var n=ot(r);n.flag&&!jt(t)||(n.flag="a"),this.writeFileSync(t,e,n)},t.prototype.appendFile=function(t,e,r,n){var i=at(r,n),o=i[0],a=i[1];o.flag&&!jt(t)||(o.flag="a"),this.writeFile(t,e,o,a)},t.prototype.readdirBase=function(t,e){var r=Et(t),n=this.getResolvedLink(r);if(!n)throw Y(V,"readdir",t);if(!n.getNode().isDirectory())throw Y("ENOTDIR","scandir",t);if(e.withFileTypes){var i=[];for(var o in n.children){var a=n.getChild(o);a&&i.push(f.default.build(a,e.encoding))}return B||"buffer"===e.encoding||i.sort((function(t,e){return t.name<e.name?-1:t.name>e.name?1:0})),i}var s=[];for(var u in n.children)s.push(w.strToEncoding(u,e.encoding));return B||"buffer"===e.encoding||s.sort(),s},t.prototype.readdirSync=function(t,e){var r=ht(e),n=bt(t);return this.readdirBase(n,r)},t.prototype.readdir=function(t,e,r){var n=gt(e,r),i=n[0],o=n[1],a=bt(t);this.wrapAsync(this.readdirBase,[a,i],o)},t.prototype.readlinkBase=function(t,e){var r=this.getLinkOrThrow(t,"readlink").getNode();if(!r.isSymlink())throw Y("EINVAL","readlink",t);var n=a+r.symlink.join(a);return w.strToEncoding(n,e)},t.prototype.readlinkSync=function(t,e){var r=Q(e),n=bt(t);return this.readlinkBase(n,r.encoding)},t.prototype.readlink=function(t,e,r){var n=tt(e,r),i=n[0],o=n[1],a=bt(t);this.wrapAsync(this.readlinkBase,[a,i.encoding],o)},t.prototype.fsyncBase=function(t){this.getFileByFdOrThrow(t,"fsync")},t.prototype.fsyncSync=function(t){this.fsyncBase(t)},t.prototype.fsync=function(t,e){this.wrapAsync(this.fsyncBase,[t],e)},t.prototype.fdatasyncBase=function(t){this.getFileByFdOrThrow(t,"fdatasync")},t.prototype.fdatasyncSync=function(t){this.fdatasyncBase(t)},t.prototype.fdatasync=function(t,e){this.wrapAsync(this.fdatasyncBase,[t],e)},t.prototype.ftruncateBase=function(t,e){this.getFileByFdOrThrow(t,"ftruncate").truncate(e)},t.prototype.ftruncateSync=function(t,e){this.ftruncateBase(t,e)},t.prototype.ftruncate=function(t,e,r){var n="number"==typeof e?e:0,i=Z("number"==typeof e?r:e);this.wrapAsync(this.ftruncateBase,[t,n],i)},t.prototype.truncateBase=function(t,e){var r=this.openSync(t,"r+");try{this.ftruncateSync(r,e)}finally{this.closeSync(r)}},t.prototype.truncateSync=function(t,e){if(jt(t))return this.ftruncateSync(t,e);this.truncateBase(t,e)},t.prototype.truncate=function(t,e,r){var n="number"==typeof e?e:0,i=Z("number"==typeof e?r:e);if(jt(t))return this.ftruncate(t,n,i);this.wrapAsync(this.truncateBase,[t,n],i)},t.prototype.futimesBase=function(t,e,r){var n=this.getFileByFdOrThrow(t,"futimes").node;n.atime=new Date(1e3*e),n.mtime=new Date(1e3*r)},t.prototype.futimesSync=function(t,e,r){this.futimesBase(t,Rt(e),Rt(r))},t.prototype.futimes=function(t,e,r,n){this.wrapAsync(this.futimesBase,[t,Rt(e),Rt(r)],n)},t.prototype.utimesBase=function(t,e,r){var n=this.openSync(t,"r+");try{this.futimesBase(n,e,r)}finally{this.closeSync(n)}},t.prototype.utimesSync=function(t,e,r){this.utimesBase(bt(t),Rt(e),Rt(r))},t.prototype.utimes=function(t,e,r,n){this.wrapAsync(this.utimesBase,[bt(t),Rt(e),Rt(r)],n)},t.prototype.mkdirBase=function(t,e){var r=Et(t);if(!r.length)throw Y("EISDIR","mkdir",t);var n=this.getLinkParentAsDirOrThrow(t,"mkdir"),i=r[r.length-1];if(n.getChild(i))throw Y("EEXIST","mkdir",t);n.createChild(i,this.createNode(!0,e))},t.prototype.mkdirpBase=function(t,e){for(var r=Et(t),n=this.root,i=0;i<r.length;i++){var o=r[i];if(!n.getNode().isDirectory())throw Y("ENOTDIR","mkdir",n.getPath());var a=n.getChild(o);if(a){if(!a.getNode().isDirectory())throw Y("ENOTDIR","mkdir",a.getPath());n=a}else n=n.createChild(o,this.createNode(!0,e))}},t.prototype.mkdirSync=function(t,e){var r=lt(e),n=Mt(r.mode,511),i=bt(t);r.recursive?this.mkdirpBase(i,n):this.mkdirBase(i,n)},t.prototype.mkdir=function(t,e,r){var n=lt(e),i=Z("function"==typeof e?e:r),o=Mt(n.mode,511),a=bt(t);n.recursive?this.wrapAsync(this.mkdirpBase,[a,o],i):this.wrapAsync(this.mkdirBase,[a,o],i)},t.prototype.mkdirpSync=function(t,e){this.mkdirSync(t,{mode:e,recursive:!0})},t.prototype.mkdirp=function(t,e,r){var n="function"==typeof e?void 0:e,i=Z("function"==typeof e?e:r);this.mkdir(t,{mode:n,recursive:!0},i)},t.prototype.mkdtempBase=function(t,e,r){void 0===r&&(r=5);var n=t+this.genRndStr();try{return this.mkdirBase(n,511),w.strToEncoding(n,e)}catch(n){if("EEXIST"===n.code){if(r>1)return this.mkdtempBase(t,e,r-1);throw Error("Could not create temp dir.")}throw n}},t.prototype.mkdtempSync=function(t,e){var r=Q(e).encoding;if(!t||"string"!=typeof t)throw new TypeError("filename prefix is required");return At(t),this.mkdtempBase(t,r)},t.prototype.mkdtemp=function(t,e,r){var n=tt(e,r),i=n[0].encoding,o=n[1];if(!t||"string"!=typeof t)throw new TypeError("filename prefix is required");At(t)&&this.wrapAsync(this.mkdtempBase,[t,i],o)},t.prototype.rmdirBase=function(t,e){var r=dt(e),n=this.getLinkAsDirOrThrow(t,"rmdir");if(n.length&&!r.recursive)throw Y("ENOTEMPTY","rmdir",t);this.deleteLink(n)},t.prototype.rmdirSync=function(t,e){this.rmdirBase(bt(t),e)},t.prototype.rmdir=function(t,e,r){var n=dt(e),i=Z("function"==typeof e?e:r);this.wrapAsync(this.rmdirBase,[bt(t),n],i)},t.prototype.fchmodBase=function(t,e){this.getFileByFdOrThrow(t,"fchmod").chmod(e)},t.prototype.fchmodSync=function(t,e){this.fchmodBase(t,Mt(e))},t.prototype.fchmod=function(t,e,r){this.wrapAsync(this.fchmodBase,[t,Mt(e)],r)},t.prototype.chmodBase=function(t,e){var r=this.openSync(t,"r+");try{this.fchmodBase(r,e)}finally{this.closeSync(r)}},t.prototype.chmodSync=function(t,e){var r=Mt(e),n=bt(t);this.chmodBase(n,r)},t.prototype.chmod=function(t,e,r){var n=Mt(e),i=bt(t);this.wrapAsync(this.chmodBase,[i,n],r)},t.prototype.lchmodBase=function(t,e){var r=this.openBase(t,A,0,!1);try{this.fchmodBase(r,e)}finally{this.closeSync(r)}},t.prototype.lchmodSync=function(t,e){var r=Mt(e),n=bt(t);this.lchmodBase(n,r)},t.prototype.lchmod=function(t,e,r){var n=Mt(e),i=bt(t);this.wrapAsync(this.lchmodBase,[i,n],r)},t.prototype.fchownBase=function(t,e,r){this.getFileByFdOrThrow(t,"fchown").chown(e,r)},t.prototype.fchownSync=function(t,e,r){Dt(e),kt(r),this.fchownBase(t,e,r)},t.prototype.fchown=function(t,e,r,n){Dt(e),kt(r),this.wrapAsync(this.fchownBase,[t,e,r],n)},t.prototype.chownBase=function(t,e,r){this.getResolvedLinkOrThrow(t,"chown").getNode().chown(e,r)},t.prototype.chownSync=function(t,e,r){Dt(e),kt(r),this.chownBase(bt(t),e,r)},t.prototype.chown=function(t,e,r,n){Dt(e),kt(r),this.wrapAsync(this.chownBase,[bt(t),e,r],n)},t.prototype.lchownBase=function(t,e,r){this.getLinkOrThrow(t,"lchown").getNode().chown(e,r)},t.prototype.lchownSync=function(t,e,r){Dt(e),kt(r),this.lchownBase(bt(t),e,r)},t.prototype.lchown=function(t,e,r,n){Dt(e),kt(r),this.wrapAsync(this.lchownBase,[bt(t),e,r],n)},t.prototype.watchFile=function(t,e,r){var n=bt(t),i=e,o=r;if("function"==typeof i&&(o=e,i=null),"function"!=typeof o)throw Error('"watchFile()" requires a listener function');var a=5007,s=!0;i&&"object"==typeof i&&("number"==typeof i.interval&&(a=i.interval),"boolean"==typeof i.persistent&&(s=i.persistent));var u=this.statWatchers[n];return u||((u=new this.StatWatcher).start(n,s,a),this.statWatchers[n]=u),u.addListener("change",o),u},t.prototype.unwatchFile=function(t,e){var r=bt(t),n=this.statWatchers[r];n&&("function"==typeof e?n.removeListener("change",e):n.removeAllListeners("change"),0===n.listenerCount("change")&&(n.stop(),delete this.statWatchers[r]))},t.prototype.createReadStream=function(t,e){return new this.ReadStream(t,e)},t.prototype.createWriteStream=function(t,e){return new this.WriteStream(t,e)},t.prototype.watch=function(t,e,r){var n=bt(t),i=e;"function"==typeof e&&(r=e,i=null);var o=Q(i),a=o.persistent,s=o.recursive,u=o.encoding;void 0===a&&(a=!0),void 0===s&&(s=!1);var c=new this.FSWatcher;return c.start(n,a,s,u),r&&c.addListener("change",r),c},t.fd=2147483647,t}();function Ct(t){t.emit("stop")}e.Volume=Nt;var xt,Lt=function(t){function e(e){var r=t.call(this)||this;return r.onInterval=function(){try{var t=r.vol.statSync(r.filename);r.hasChanged(t)&&(r.emit("change",t,r.prev),r.prev=t)}finally{r.loop()}},r.vol=e,r}return i(e,t),e.prototype.loop=function(){this.timeoutRef=this.setTimeout(this.onInterval,this.interval)},e.prototype.hasChanged=function(t){return t.mtimeMs>this.prev.mtimeMs||t.nlink!==this.prev.nlink},e.prototype.start=function(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=5007),this.filename=bt(t),this.setTimeout=e?setTimeout:p.default,this.interval=r,this.prev=this.vol.statSync(this.filename),this.loop()},e.prototype.stop=function(){clearTimeout(this.timeoutRef),g.default.nextTick(Ct,this)},e}(b.EventEmitter);function Pt(t,e,r){if(!(this instanceof Pt))return new Pt(t,e,r);if(this._vol=t,void 0===(r=Object.assign({},$(r,{}))).highWaterMark&&(r.highWaterMark=65536),m.Readable.call(this,r),this.path=bt(e),this.fd=void 0===r.fd?null:r.fd,this.flags=void 0===r.flags?"r":r.flags,this.mode=void 0===r.mode?438:r.mode,this.start=r.start,this.end=r.end,this.autoClose=void 0===r.autoClose||r.autoClose,this.pos=void 0,this.bytesRead=0,void 0!==this.start){if("number"!=typeof this.start)throw new TypeError('"start" option must be a Number');if(void 0===this.end)this.end=1/0;else if("number"!=typeof this.end)throw new TypeError('"end" option must be a Number');if(this.start>this.end)throw new Error('"start" option must be <= "end" option');this.pos=this.start}"number"!=typeof this.fd&&this.open(),this.on("end",(function(){this.autoClose&&this.destroy&&this.destroy()}))}function Bt(t){this.close()}function Ut(t,e,r){if(!(this instanceof Ut))return new Ut(t,e,r);if(this._vol=t,r=Object.assign({},$(r,{})),m.Writable.call(this,r),this.path=bt(e),this.fd=void 0===r.fd?null:r.fd,this.flags=void 0===r.flags?"w":r.flags,this.mode=void 0===r.mode?438:r.mode,this.start=r.start,this.autoClose=void 0===r.autoClose||!!r.autoClose,this.pos=void 0,this.bytesWritten=0,void 0!==this.start){if("number"!=typeof this.start)throw new TypeError('"start" option must be a Number');if(this.start<0)throw new Error('"start" must be >= zero');this.pos=this.start}r.encoding&&this.setDefaultEncoding(r.encoding),"number"!=typeof this.fd&&this.open(),this.once("finish",(function(){this.autoClose&&this.close()}))}e.StatWatcher=Lt,v.inherits(Pt,m.Readable),e.ReadStream=Pt,Pt.prototype.open=function(){var t=this;this._vol.open(this.path,this.flags,this.mode,(function(e,r){if(e)return t.autoClose&&t.destroy&&t.destroy(),void t.emit("error",e);t.fd=r,t.emit("open",r),t.read()}))},Pt.prototype._read=function(t){if("number"!=typeof this.fd)return this.once("open",(function(){this._read(t)}));if(!this.destroyed){var e;(!xt||xt.length-xt.used<128)&&(e=this._readableState.highWaterMark,(xt=d.bufferAllocUnsafe(e)).used=0);var r=xt,n=Math.min(xt.length-xt.used,t),i=xt.used;if(void 0!==this.pos&&(n=Math.min(this.end-this.pos+1,n)),n<=0)return this.push(null);var o=this;this._vol.read(this.fd,xt,xt.used,n,this.pos,(function(t,e){if(t)o.autoClose&&o.destroy&&o.destroy(),o.emit("error",t);else{var n=null;e>0&&(o.bytesRead+=e,n=r.slice(i,i+e)),o.push(n)}})),void 0!==this.pos&&(this.pos+=n),xt.used+=n}},Pt.prototype._destroy=function(t,e){this.close((function(r){e(t||r)}))},Pt.prototype.close=function(t){var e=this;if(t&&this.once("close",t),this.closed||"number"!=typeof this.fd)return"number"!=typeof this.fd?void this.once("open",Bt):g.default.nextTick((function(){return e.emit("close")}));this.closed=!0,this._vol.close(this.fd,(function(t){t?e.emit("error",t):e.emit("close")})),this.fd=null},v.inherits(Ut,m.Writable),e.WriteStream=Ut,Ut.prototype.open=function(){this._vol.open(this.path,this.flags,this.mode,function(t,e){if(t)return this.autoClose&&this.destroy&&this.destroy(),void this.emit("error",t);this.fd=e,this.emit("open",e)}.bind(this))},Ut.prototype._write=function(t,e,r){if(!(t instanceof d.Buffer))return this.emit("error",new Error("Invalid data"));if("number"!=typeof this.fd)return this.once("open",(function(){this._write(t,e,r)}));var n=this;this._vol.write(this.fd,t,0,t.length,this.pos,(function(t,e){if(t)return n.autoClose&&n.destroy&&n.destroy(),r(t);n.bytesWritten+=e,r()})),void 0!==this.pos&&(this.pos+=t.length)},Ut.prototype._writev=function(t,e){if("number"!=typeof this.fd)return this.once("open",(function(){this._writev(t,e)}));for(var r=this,n=t.length,i=new Array(n),o=0,a=0;a<n;a++){var s=t[a].chunk;i[a]=s,o+=s.length}var u=d.Buffer.concat(i);this._vol.write(this.fd,u,0,u.length,this.pos,(function(t,n){if(t)return r.destroy&&r.destroy(),e(t);r.bytesWritten+=n,e()})),void 0!==this.pos&&(this.pos+=o)},Ut.prototype._destroy=Pt.prototype._destroy,Ut.prototype.close=Pt.prototype.close,Ut.prototype.destroySoon=Ut.prototype.end;var Ft=function(t){function e(e){var r=t.call(this)||this;return r._filename="",r._filenameEncoded="",r._recursive=!1,r._encoding=w.ENCODING_UTF8,r._onNodeChange=function(){r._emit("change")},r._onParentChild=function(t){t.getName()===r._getName()&&r._emit("rename")},r._emit=function(t){r.emit("change",t,r._filenameEncoded)},r._persist=function(){r._timer=setTimeout(r._persist,1e6)},r._vol=e,r}return i(e,t),e.prototype._getName=function(){return this._steps[this._steps.length-1]},e.prototype.start=function(t,e,r,n){void 0===e&&(e=!0),void 0===r&&(r=!1),void 0===n&&(n=w.ENCODING_UTF8),this._filename=bt(t),this._steps=Et(this._filename),this._filenameEncoded=w.strToEncoding(this._filename),this._recursive=r,this._encoding=n;try{this._link=this._vol.getLinkOrThrow(this._filename,"FSWatcher")}catch(t){var i=new Error("watch "+this._filename+" "+t.code);throw i.code=t.code,i.errno=t.code,i}this._link.getNode().on("change",this._onNodeChange),this._link.on("child:add",this._onNodeChange),this._link.on("child:delete",this._onNodeChange);var o=this._link.parent;o&&(o.setMaxListeners(o.getMaxListeners()+1),o.on("child:delete",this._onParentChild)),e&&this._persist()},e.prototype.close=function(){clearTimeout(this._timer),this._link.getNode().removeListener("change",this._onNodeChange);var t=this._link.parent;t&&t.removeListener("child:delete",this._onParentChild)},e}(b.EventEmitter);e.FSWatcher=Ft},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var o=r(178),a=r(136),s=r(96),u=r(61),c=r(135),l=s.constants.S_IFMT,f=s.constants.S_IFDIR,d=s.constants.S_IFREG,h=s.constants.S_IFLNK,g=s.constants.O_APPEND;e.SEP="/";var p=function(t){function e(e,r){void 0===r&&(r=438);var n=t.call(this)||this;return n.uid=o.default.getuid(),n.gid=o.default.getgid(),n.atime=new Date,n.mtime=new Date,n.ctime=new Date,n.perm=438,n.mode=d,n.nlink=1,n.perm=r,n.mode|=r,n.ino=e,n}return i(e,t),e.prototype.getString=function(t){return void 0===t&&(t="utf8"),this.getBuffer().toString(t)},e.prototype.setString=function(t){this.buf=a.bufferFrom(t,"utf8"),this.touch()},e.prototype.getBuffer=function(){return this.buf||this.setBuffer(a.bufferAllocUnsafe(0)),a.bufferFrom(this.buf)},e.prototype.setBuffer=function(t){this.buf=a.bufferFrom(t),this.touch()},e.prototype.getSize=function(){return this.buf?this.buf.length:0},e.prototype.setModeProperty=function(t){this.mode=this.mode&~l|t},e.prototype.setIsFile=function(){this.setModeProperty(d)},e.prototype.setIsDirectory=function(){this.setModeProperty(f)},e.prototype.setIsSymlink=function(){this.setModeProperty(h)},e.prototype.isFile=function(){return(this.mode&l)===d},e.prototype.isDirectory=function(){return(this.mode&l)===f},e.prototype.isSymlink=function(){return(this.mode&l)===h},e.prototype.makeSymlink=function(t){this.symlink=t,this.setIsSymlink()},e.prototype.write=function(t,e,r,n){if(void 0===e&&(e=0),void 0===r&&(r=t.length),void 0===n&&(n=0),this.buf||(this.buf=a.bufferAllocUnsafe(0)),n+r>this.buf.length){var i=a.bufferAllocUnsafe(n+r);this.buf.copy(i,0,0,this.buf.length),this.buf=i}return t.copy(this.buf,n,e,e+r),this.touch(),r},e.prototype.read=function(t,e,r,n){void 0===e&&(e=0),void 0===r&&(r=t.byteLength),void 0===n&&(n=0),this.buf||(this.buf=a.bufferAllocUnsafe(0));var i=r;return i>t.byteLength&&(i=t.byteLength),i+n>this.buf.length&&(i=this.buf.length-n),this.buf.copy(t,e,n,n+i),i},e.prototype.truncate=function(t){if(void 0===t&&(t=0),t)if(this.buf||(this.buf=a.bufferAllocUnsafe(0)),t<=this.buf.length)this.buf=this.buf.slice(0,t);else{var e=a.bufferAllocUnsafe(0);this.buf.copy(e),e.fill(0,t)}else this.buf=a.bufferAllocUnsafe(0);this.touch()},e.prototype.chmod=function(t){this.perm=t,this.mode=-512&this.mode|t,this.touch()},e.prototype.chown=function(t,e){this.uid=t,this.gid=e,this.touch()},e.prototype.touch=function(){this.mtime=new Date,this.emit("change",this)},e.prototype.canRead=function(t,e){return void 0===t&&(t=o.default.getuid()),void 0===e&&(e=o.default.getgid()),!!(4&this.perm)||(!!(e===this.gid&&32&this.perm)||!!(t===this.uid&&256&this.perm))},e.prototype.canWrite=function(t,e){return void 0===t&&(t=o.default.getuid()),void 0===e&&(e=o.default.getgid()),!!(2&this.perm)||(!!(e===this.gid&&16&this.perm)||!!(t===this.uid&&128&this.perm))},e.prototype.del=function(){this.emit("delete",this)},e.prototype.toJSON=function(){return{ino:this.ino,uid:this.uid,gid:this.gid,atime:this.atime.getTime(),mtime:this.mtime.getTime(),ctime:this.ctime.getTime(),perm:this.perm,mode:this.mode,nlink:this.nlink,symlink:this.symlink,data:this.getString()}},e}(u.EventEmitter);e.Node=p;var m=function(t){function r(e,r,n){var i=t.call(this)||this;return i.children={},i.steps=[],i.ino=0,i.length=0,i.vol=e,i.parent=r,i.steps=r?r.steps.concat([n]):[n],i}return i(r,t),r.prototype.setNode=function(t){this.node=t,this.ino=t.ino},r.prototype.getNode=function(){return this.node},r.prototype.createChild=function(t,e){void 0===e&&(e=this.vol.createNode());var n=new r(this.vol,this,t);return n.setNode(e),e.isDirectory(),this.setChild(t,n),n},r.prototype.setChild=function(t,e){return void 0===e&&(e=new r(this.vol,this,t)),this.children[t]=e,e.parent=this,this.length++,this.emit("child:add",e,this),e},r.prototype.deleteChild=function(t){delete this.children[t.getName()],this.length--,this.emit("child:delete",t,this)},r.prototype.getChild=function(t){if(Object.hasOwnProperty.call(this.children,t))return this.children[t]},r.prototype.getPath=function(){return this.steps.join(e.SEP)},r.prototype.getName=function(){return this.steps[this.steps.length-1]},r.prototype.walk=function(t,e,r){if(void 0===e&&(e=t.length),void 0===r&&(r=0),r>=t.length)return this;if(r>=e)return this;var n=t[r],i=this.getChild(n);return i?i.walk(t,e,r+1):null},r.prototype.toJSON=function(){return{steps:this.steps,ino:this.ino,children:Object.keys(this.children)}},r}(u.EventEmitter);e.Link=m;var y=function(){function t(t,e,r,n){this.position=0,this.link=t,this.node=e,this.flags=r,this.fd=n}return t.prototype.getString=function(t){return void 0===t&&(t="utf8"),this.node.getString()},t.prototype.setString=function(t){this.node.setString(t)},t.prototype.getBuffer=function(){return this.node.getBuffer()},t.prototype.setBuffer=function(t){this.node.setBuffer(t)},t.prototype.getSize=function(){return this.node.getSize()},t.prototype.truncate=function(t){this.node.truncate(t)},t.prototype.seekTo=function(t){this.position=t},t.prototype.stats=function(){return c.default.build(this.node)},t.prototype.write=function(t,e,r,n){void 0===e&&(e=0),void 0===r&&(r=t.length),"number"!=typeof n&&(n=this.position),this.flags&g&&(n=this.getSize());var i=this.node.write(t,e,r,n);return this.position=n+i,i},t.prototype.read=function(t,e,r,n){void 0===e&&(e=0),void 0===r&&(r=t.byteLength),"number"!=typeof n&&(n=this.position);var i=this.node.read(t,e,r,n);return this.position=n+i,i},t.prototype.chmod=function(t){this.node.chmod(t)},t.prototype.chown=function(t,e){this.node.chown(t,e)},t}();e.File=y},function(t,e,r){(function(t,e){!function(t,r){"use strict";if(!t.setImmediate){var n,i,o,a,s,u=1,c={},l=!1,f=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?n=function(t){e.nextTick((function(){g(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){g(t.data)},n=function(t){o.port2.postMessage(t)}):f&&"onreadystatechange"in f.createElement("script")?(i=f.documentElement,n=function(t){var e=f.createElement("script");e.onreadystatechange=function(){g(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):n=function(t){setTimeout(g,0,t)}:(a="setImmediate$"+Math.random()+"$",s=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(a)&&g(+e.data.slice(a.length))},t.addEventListener?t.addEventListener("message",s,!1):t.attachEvent("onmessage",s),n=function(e){t.postMessage(a+e,"*")}),d.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r<e.length;r++)e[r]=arguments[r+1];var i={callback:t,args:e};return c[u]=i,n(u),u++},d.clearImmediate=h}function h(t){delete c[t]}function g(t){if(l)setTimeout(g,0,t);else{var e=c[t];if(e){l=!0;try{!function(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(void 0,r)}}(e)}finally{h(t),l=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,r(24),r(20))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,r){var n=setTimeout.apply(null,arguments);return n&&"object"==typeof n&&"function"==typeof n.unref&&n.unref(),n}},function(t,e){},function(t,e,r){"use strict";var n=r(139).Buffer,i=r(302);t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var e,r,i,o=n.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,r=o,i=s,e.copy(r,i),s+=a.data.length,a=a.next;return o},t}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,r){"use strict";t.exports=o;var n=r(183),i=Object.create(r(98));function o(t){if(!(this instanceof o))return new o(t);n.call(this,t)}i.inherits=r(11),i.inherits(o,n),o.prototype._transform=function(t,e,r){r(null,t)}},function(t,e,r){t.exports=r(140)},function(t,e,r){t.exports=r(76)},function(t,e,r){t.exports=r(138).Transform},function(t,e,r){t.exports=r(138).PassThrough},function(t,e,r){"use strict";var n=this&&this.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),i=0;for(e=0;e<r;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)n[i]=o[a];return n};function i(t,e,r){return void 0===r&&(r=function(t){return t}),function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return new Promise((function(o,a){t[e].bind(t).apply(void 0,n(i,[function(t,e){return t?a(t):o(r(e))}]))}))}}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){this.vol=t,this.fd=e}return t.prototype.appendFile=function(t,e){return i(this.vol,"appendFile")(this.fd,t,e)},t.prototype.chmod=function(t){return i(this.vol,"fchmod")(this.fd,t)},t.prototype.chown=function(t,e){return i(this.vol,"fchown")(this.fd,t,e)},t.prototype.close=function(){return i(this.vol,"close")(this.fd)},t.prototype.datasync=function(){return i(this.vol,"fdatasync")(this.fd)},t.prototype.read=function(t,e,r,n){return i(this.vol,"read",(function(e){return{bytesRead:e,buffer:t}}))(this.fd,t,e,r,n)},t.prototype.readFile=function(t){return i(this.vol,"readFile")(this.fd,t)},t.prototype.stat=function(t){return i(this.vol,"fstat")(this.fd,t)},t.prototype.sync=function(){return i(this.vol,"fsync")(this.fd)},t.prototype.truncate=function(t){return i(this.vol,"ftruncate")(this.fd,t)},t.prototype.utimes=function(t,e){return i(this.vol,"futimes")(this.fd,t,e)},t.prototype.write=function(t,e,r,n){return i(this.vol,"write",(function(e){return{bytesWritten:e,buffer:t}}))(this.fd,t,e,r,n)},t.prototype.writeFile=function(t,e){return i(this.vol,"writeFile")(this.fd,t,e)},t}();e.FileHandle=o,e.default=function(t){return"undefined"==typeof Promise?null:{FileHandle:o,access:function(e,r){return i(t,"access")(e,r)},appendFile:function(e,r,n){return i(t,"appendFile")(e instanceof o?e.fd:e,r,n)},chmod:function(e,r){return i(t,"chmod")(e,r)},chown:function(e,r,n){return i(t,"chown")(e,r,n)},copyFile:function(e,r,n){return i(t,"copyFile")(e,r,n)},lchmod:function(e,r){return i(t,"lchmod")(e,r)},lchown:function(e,r,n){return i(t,"lchown")(e,r,n)},link:function(e,r){return i(t,"link")(e,r)},lstat:function(e,r){return i(t,"lstat")(e,r)},mkdir:function(e,r){return i(t,"mkdir")(e,r)},mkdtemp:function(e,r){return i(t,"mkdtemp")(e,r)},open:function(e,r,n){return i(t,"open",(function(e){return new o(t,e)}))(e,r,n)},readdir:function(e,r){return i(t,"readdir")(e,r)},readFile:function(e,r){return i(t,"readFile")(e instanceof o?e.fd:e,r)},readlink:function(e,r){return i(t,"readlink")(e,r)},realpath:function(e,r){return i(t,"realpath")(e,r)},rename:function(e,r){return i(t,"rename")(e,r)},rmdir:function(e){return i(t,"rmdir")(e)},stat:function(e,r){return i(t,"stat")(e,r)},symlink:function(e,r,n){return i(t,"symlink")(e,r,n)},truncate:function(e,r){return i(t,"truncate")(e,r)},unlink:function(e){return i(t,"unlink")(e)},utimes:function(e,r,n){return i(t,"utimes")(e,r,n)},writeFile:function(e,r,n){return i(t,"writeFile")(e instanceof o?e.fd:e,r,n)}}}},function(t,e,r){"use strict";var n=r(310),i=r(311);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=w,e.resolve=function(t,e){return w(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?w(t,!1,!0).resolveObject(e):e},e.format=function(t){i.isString(t)&&(t=w(t));return t instanceof o?t.format():o.prototype.format.call(t)},e.Url=o;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),f=["%","/","?",";","#"].concat(l),d=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,p={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=r(312);function w(t,e,r){if(t&&i.isObject(t)&&t instanceof o)return t;var n=new o;return n.parse(t,e,r),n}o.prototype.parse=function(t,e,r){if(!i.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),s=-1!==o&&o<t.indexOf("#")?"?":"#",c=t.split(s);c[0]=c[0].replace(/\\/g,"/");var w=t=c.join(s);if(w=w.trim(),!r&&1===t.split("#").length){var _=u.exec(w);if(_)return this.path=w,this.href=w,this.pathname=_[1],_[2]?(this.search=_[2],this.query=e?b.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var v=a.exec(w);if(v){var E=(v=v[0]).toLowerCase();this.protocol=E,w=w.substr(v.length)}if(r||v||w.match(/^\/\/[^@\/]+@[^@\/]+/)){var S="//"===w.substr(0,2);!S||v&&m[v]||(w=w.substr(2),this.slashes=!0)}if(!m[v]&&(S||v&&!y[v])){for(var O,T,A=-1,M=0;M<d.length;M++){-1!==(j=w.indexOf(d[M]))&&(-1===A||j<A)&&(A=j)}-1!==(T=-1===A?w.lastIndexOf("@"):w.lastIndexOf("@",A))&&(O=w.slice(0,T),w=w.slice(T+1),this.auth=decodeURIComponent(O)),A=-1;for(M=0;M<f.length;M++){var j;-1!==(j=w.indexOf(f[M]))&&(-1===A||j<A)&&(A=j)}-1===A&&(A=w.length),this.host=w.slice(0,A),w=w.slice(A),this.parseHost(),this.hostname=this.hostname||"";var I="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!I)for(var R=this.hostname.split(/\./),D=(M=0,R.length);M<D;M++){var k=R[M];if(k&&!k.match(h)){for(var N="",C=0,x=k.length;C<x;C++)k.charCodeAt(C)>127?N+="x":N+=k[C];if(!N.match(h)){var L=R.slice(0,M),P=R.slice(M+1),B=k.match(g);B&&(L.push(B[1]),P.unshift(B[2])),P.length&&(w="/"+P.join(".")+w),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=n.toASCII(this.hostname));var U=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+U,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==w[0]&&(w="/"+w))}if(!p[E])for(M=0,D=l.length;M<D;M++){var W=l[M];if(-1!==w.indexOf(W)){var H=encodeURIComponent(W);H===W&&(H=escape(W)),w=w.split(W).join(H)}}var q=w.indexOf("#");-1!==q&&(this.hash=w.substr(q),w=w.slice(0,q));var z=w.indexOf("?");if(-1!==z?(this.search=w.substr(z),this.query=w.substr(z+1),e&&(this.query=b.parse(this.query)),w=w.slice(0,z)):e&&(this.search="",this.query={}),w&&(this.pathname=w),y[E]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){U=this.pathname||"";var V=this.search||"";this.path=U+V}return this.href=this.format(),this},o.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",o=!1,a="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(a=b.stringify(this.query));var s=this.search||a&&"?"+a||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||y[e])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),s&&"?"!==s.charAt(0)&&(s="?"+s),e+o+(r=r.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(s=s.replace("#","%23"))+n},o.prototype.resolve=function(t){return this.resolveObject(w(t,!1,!0)).format()},o.prototype.resolveObject=function(t){if(i.isString(t)){var e=new o;e.parse(t,!1,!0),t=e}for(var r=new o,n=Object.keys(this),a=0;a<n.length;a++){var s=n[a];r[s]=this[s]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var u=Object.keys(t),c=0;c<u.length;c++){var l=u[c];"protocol"!==l&&(r[l]=t[l])}return y[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!y[t.protocol]){for(var f=Object.keys(t),d=0;d<f.length;d++){var h=f[d];r[h]=t[h]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||m[t.protocol])r.pathname=t.pathname;else{for(var g=(t.pathname||"").split("/");g.length&&!(t.host=g.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==g[0]&&g.unshift(""),g.length<2&&g.unshift(""),r.pathname=g.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var p=r.pathname||"",b=r.search||"";r.path=p+b}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var w=r.pathname&&"/"===r.pathname.charAt(0),_=t.host||t.pathname&&"/"===t.pathname.charAt(0),v=_||w||r.host&&t.pathname,E=v,S=r.pathname&&r.pathname.split("/")||[],O=(g=t.pathname&&t.pathname.split("/")||[],r.protocol&&!y[r.protocol]);if(O&&(r.hostname="",r.port=null,r.host&&(""===S[0]?S[0]=r.host:S.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===g[0]?g[0]=t.host:g.unshift(t.host)),t.host=null),v=v&&(""===g[0]||""===S[0])),_)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,S=g;else if(g.length)S||(S=[]),S.pop(),S=S.concat(g),r.search=t.search,r.query=t.query;else if(!i.isNullOrUndefined(t.search)){if(O)r.hostname=r.host=S.shift(),(I=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=I.shift(),r.host=r.hostname=I.shift());return r.search=t.search,r.query=t.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!S.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var T=S.slice(-1)[0],A=(r.host||t.host||S.length>1)&&("."===T||".."===T)||""===T,M=0,j=S.length;j>=0;j--)"."===(T=S[j])?S.splice(j,1):".."===T?(S.splice(j,1),M++):M&&(S.splice(j,1),M--);if(!v&&!E)for(;M--;M)S.unshift("..");!v||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),A&&"/"!==S.join("/").substr(-1)&&S.push("");var I,R=""===S[0]||S[0]&&"/"===S[0].charAt(0);O&&(r.hostname=r.host=R?"":S.length?S.shift():"",(I=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=I.shift(),r.host=r.hostname=I.shift()));return(v=v||r.host&&S.length)&&!R&&S.unshift(""),S.length?r.pathname=S.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var t=this.host,e=s.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,r){(function(t,n){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){e&&e.nodeType,t&&t.nodeType;var a="object"==typeof n&&n;a.global!==a&&a.window!==a&&a.self;var s,u=2147483647,c=/^xn--/,l=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=Math.floor,g=String.fromCharCode;function p(t){throw new RangeError(d[t])}function m(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function y(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+m((t=t.replace(f,".")).split("."),e).join(".")}function b(t){for(var e,r,n=[],i=0,o=t.length;i<o;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<o?56320==(64512&(r=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--):n.push(e);return n}function w(t){return m(t,(function(t){var e="";return t>65535&&(e+=g((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=g(t)})).join("")}function _(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function v(t,e,r){var n=0;for(t=r?h(t/700):t>>1,t+=h(t/e);t>455;n+=36)t=h(t/35);return h(n+36*t/(t+38))}function E(t){var e,r,n,i,o,a,s,c,l,f,d,g=[],m=t.length,y=0,b=128,_=72;for((r=t.lastIndexOf("-"))<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&p("not-basic"),g.push(t.charCodeAt(n));for(i=r>0?r+1:0;i<m;){for(o=y,a=1,s=36;i>=m&&p("invalid-input"),((c=(d=t.charCodeAt(i++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:36)>=36||c>h((u-y)/a))&&p("overflow"),y+=c*a,!(c<(l=s<=_?1:s>=_+26?26:s-_));s+=36)a>h(u/(f=36-l))&&p("overflow"),a*=f;_=v(y-o,e=g.length+1,0==o),h(y/e)>u-b&&p("overflow"),b+=h(y/e),y%=e,g.splice(y++,0,b)}return w(g)}function S(t){var e,r,n,i,o,a,s,c,l,f,d,m,y,w,E,S=[];for(m=(t=b(t)).length,e=128,r=0,o=72,a=0;a<m;++a)(d=t[a])<128&&S.push(g(d));for(n=i=S.length,i&&S.push("-");n<m;){for(s=u,a=0;a<m;++a)(d=t[a])>=e&&d<s&&(s=d);for(s-e>h((u-r)/(y=n+1))&&p("overflow"),r+=(s-e)*y,e=s,a=0;a<m;++a)if((d=t[a])<e&&++r>u&&p("overflow"),d==e){for(c=r,l=36;!(c<(f=l<=o?1:l>=o+26?26:l-o));l+=36)E=c-f,w=36-f,S.push(g(_(f+E%w,0))),c=h(E/w);S.push(g(_(c,0))),o=v(r,y,n==i),r=0,++n}++r,++e}return S.join("")}s={version:"1.4.1",ucs2:{decode:b,encode:w},decode:E,encode:S,toASCII:function(t){return y(t,(function(t){return l.test(t)?"xn--"+S(t):t}))},toUnicode:function(t){return y(t,(function(t){return c.test(t)?E(t.slice(4).toLowerCase()):t}))}},void 0===(i=function(){return s}.call(e,r,e,t))||(t.exports=i)}()}).call(this,r(95)(t),r(24))},function(t,e,r){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e,r){"use strict";e.decode=e.parse=r(313),e.encode=e.stringify=r(314)},function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,r,o){e=e||"&",r=r||"=";var a={};if("string"!=typeof t||0===t.length)return a;var s=/\+/g;t=t.split(e);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=t.length;u>0&&c>u&&(c=u);for(var l=0;l<c;++l){var f,d,h,g,p=t[l].replace(s,"%20"),m=p.indexOf(r);m>=0?(f=p.substr(0,m),d=p.substr(m+1)):(f=p,d=""),h=decodeURIComponent(f),g=decodeURIComponent(d),n(a,h)?i(a[h])?a[h].push(g):a[h]=[a[h],g]:a[h]=g}return a};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,r){"use strict";var n=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,r,s){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?o(a(t),(function(a){var s=encodeURIComponent(n(a))+r;return i(t[a])?o(t[a],(function(t){return s+encodeURIComponent(n(t))})).join(e):s+encodeURIComponent(n(t[a]))})).join(e):s?encodeURIComponent(n(s))+r+encodeURIComponent(n(t)):""};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function o(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n<t.length;n++)r.push(e(t[n],n));return r}var a=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.unixify=o,e.correctPath=function(t){return o(t.replace(/^\\\\\?\\.:\\/,"\\"))};var r="win32"===t.platform;function n(t,e){var n=t[e];return e>0&&("/"===n||r&&"\\"===n)}function i(t,e){if("string"!=typeof t)throw new TypeError("expected a string");return t=t.replace(/[\\\/]+/g,"/"),!1!==e&&(t=function(t){var e=t.length-1;if(e<2)return t;for(;n(t,e);)e--;return t.substr(0,e+1)}(t)),t}function o(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return r?(t=i(t,e)).replace(/^([a-zA-Z]+:|\.\/)/,""):t}}).call(this,r(20))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.fsProps=["constants","F_OK","R_OK","W_OK","X_OK","Stats"],e.fsSyncMethods=["renameSync","ftruncateSync","truncateSync","chownSync","fchownSync","lchownSync","chmodSync","fchmodSync","lchmodSync","statSync","lstatSync","fstatSync","linkSync","symlinkSync","readlinkSync","realpathSync","unlinkSync","rmdirSync","mkdirSync","mkdirpSync","readdirSync","closeSync","openSync","utimesSync","futimesSync","fsyncSync","writeSync","readSync","readFileSync","writeFileSync","appendFileSync","existsSync","accessSync","fdatasyncSync","mkdtempSync","copyFileSync","createReadStream","createWriteStream"],e.fsAsyncMethods=["rename","ftruncate","truncate","chown","fchown","lchown","chmod","fchmod","lchmod","stat","lstat","fstat","link","symlink","readlink","realpath","unlink","rmdir","mkdir","mkdirp","readdir","close","open","utimes","futimes","fsync","write","read","readFile","writeFile","appendFile","exists","access","fdatasync","mkdtemp","copyFile","watchFile","unwatchFile","watch"]},function(t,e,r){(e=t.exports=r(186)).Stream=e,e.Readable=e,e.Writable=r(190),e.Duplex=r(84),e.Transform=r(191),e.PassThrough=r(323),e.finished=r(143),e.pipeline=r(324)},function(t,e){},function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var a=r(14).Buffer,s=r(320).inspect,u=s&&s.custom||"inspect";t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,r,c;return e=t,(r=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return a.alloc(0);for(var e,r,n,i=a.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,r=i,n=s,a.prototype.copy.call(e,r,n),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,n=e.data;for(t-=n.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0==(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=a.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:u,value:function(t,e){return s(this,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},e,{depth:0,customInspect:!1}))}}])&&o(e.prototype,r),c&&o(e,c),t}()},function(t,e){},function(t,e,r){"use strict";(function(e){var n;function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=r(143),a=Symbol("lastResolve"),s=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),l=Symbol("lastPromise"),f=Symbol("handlePromise"),d=Symbol("stream");function h(t,e){return{value:t,done:e}}function g(t){var e=t[a];if(null!==e){var r=t[d].read();null!==r&&(t[l]=null,t[a]=null,t[s]=null,e(h(r,!1)))}}function p(t){e.nextTick(g,t)}var m=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((i(n={get stream(){return this[d]},next:function(){var t=this,r=this[u];if(null!==r)return Promise.reject(r);if(this[c])return Promise.resolve(h(void 0,!0));if(this[d].destroyed)return new Promise((function(r,n){e.nextTick((function(){t[u]?n(t[u]):r(h(void 0,!0))}))}));var n,i=this[l];if(i)n=new Promise(function(t,e){return function(r,n){t.then((function(){e[c]?r(h(void 0,!0)):e[f](r,n)}),n)}}(i,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(h(o,!1));n=new Promise(this[f])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var t=this;return new Promise((function(e,r){t[d].destroy(null,(function(t){t?r(t):e(h(void 0,!0))}))}))})),n),m);t.exports=function(t){var e,r=Object.create(y,(i(e={},d,{value:t,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,u,{value:null,writable:!0}),i(e,c,{value:t._readableState.endEmitted,writable:!0}),i(e,f,{value:function(t,e){var n=r[d].read();n?(r[l]=null,r[a]=null,r[s]=null,t(h(n,!1))):(r[a]=t,r[s]=e)},writable:!0}),e));return r[l]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[s];return null!==e&&(r[l]=null,r[a]=null,r[s]=null,e(t)),void(r[u]=t)}var n=r[a];null!==n&&(r[l]=null,r[a]=null,r[s]=null,n(h(void 0,!0))),r[c]=!0})),t.on("readable",p.bind(null,r)),r}}).call(this,r(20))},function(t,e){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(t,e,r){"use strict";t.exports=i;var n=r(191);function i(t){if(!(this instanceof i))return new i(t);n.call(this,t)}r(11)(i,n),i.prototype._transform=function(t,e,r){r(null,t)}},function(t,e,r){"use strict";var n;var i=r(83).codes,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(t){if(t)throw t}function u(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var s=!1;t.on("close",(function(){s=!0})),void 0===n&&(n=r(143)),n(t,{readable:e,writable:i},(function(t){if(t)return o(t);s=!0,o()}));var u=!1;return function(e){if(!s&&!u)return u=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new a("pipe"))}}function c(t){t()}function l(t,e){return t.pipe(e)}function f(t){return t.length?"function"!=typeof t[t.length-1]?s:t.pop():s}t.exports=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n,i=f(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var a=e.map((function(t,r){var o=r<e.length-1;return u(t,o,r>0,(function(t){n||(n=t),t&&a.forEach(c),o||(a.forEach(c),i(n))}))}));return e.reduce(l)}},function(t,e,r){var n=r(11),i=r(85),o=r(17).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(t){return t<<30|t>>>2}function l(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,f=0;f<16;++f)r[f]=t.readInt32BE(4*f);for(;f<80;++f)r[f]=r[f-3]^r[f-8]^r[f-14]^r[f-16];for(var d=0;d<80;++d){var h=~~(d/20),g=0|((e=n)<<5|e>>>27)+l(h,i,o,s)+u+r[d]+a[h];u=s,s=o,o=c(i),i=n,n=g}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},function(t,e,r){var n=r(11),i=r(85),o=r(17).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(t){return t<<5|t>>>27}function l(t){return t<<30|t>>>2}function f(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,d=0;d<16;++d)r[d]=t.readInt32BE(4*d);for(;d<80;++d)r[d]=(e=r[d-3]^r[d-8]^r[d-14]^r[d-16])<<1|e>>>31;for(var h=0;h<80;++h){var g=~~(h/20),p=c(n)+f(g,i,o,s)+u+r[h]+a[g]|0;u=s,s=o,o=l(i),i=n,n=p}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},function(t,e,r){var n=r(11),i=r(192),o=r(85),a=r(17).Buffer,s=new Array(64);function u(){this.init(),this._w=s,o.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var t=a.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=u},function(t,e,r){var n=r(11),i=r(193),o=r(85),a=r(17).Buffer,s=new Array(160);function u(){this.init(),this._w=s,o.call(this,128,112)}n(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var t=a.allocUnsafe(48);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=u},function(t,e,r){"use strict";var n=r(11),i=r(17).Buffer,o=r(68),a=i.alloc(128);function s(t,e){o.call(this,"digest"),"string"==typeof e&&(e=i.from(e)),this._alg=t,this._key=e,e.length>64?e=t(e):e.length<64&&(e=i.concat([e,a],64));for(var r=this._ipad=i.allocUnsafe(64),n=this._opad=i.allocUnsafe(64),s=0;s<64;s++)r[s]=54^e[s],n[s]=92^e[s];this._hash=[r]}n(s,o),s.prototype._update=function(t){this._hash.push(t)},s.prototype._final=function(){var t=this._alg(i.concat(this._hash));return this._alg(i.concat([this._opad,t]))},t.exports=s},function(t,e,r){t.exports=r(196)},function(t,e,r){(function(e){var n,i,o=r(17).Buffer,a=r(198),s=r(199),u=r(200),c=r(201),l=e.crypto&&e.crypto.subtle,f={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},d=[];function h(){return i||(i=e.process&&e.process.nextTick?e.process.nextTick:e.queueMicrotask?e.queueMicrotask:e.setImmediate?e.setImmediate:e.setTimeout)}function g(t,e,r,n,i){return l.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((function(t){return l.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:i}},t,n<<3)})).then((function(t){return o.from(t)}))}t.exports=function(t,r,i,p,m,y){"function"==typeof m&&(y=m,m=void 0);var b=f[(m=m||"sha1").toLowerCase()];if(b&&"function"==typeof e.Promise){if(a(i,p),t=c(t,s,"Password"),r=c(r,s,"Salt"),"function"!=typeof y)throw new Error("No callback provided to pbkdf2");!function(t,e){t.then((function(t){h()((function(){e(null,t)}))}),(function(t){h()((function(){e(t)}))}))}(function(t){if(e.process&&!e.process.browser)return Promise.resolve(!1);if(!l||!l.importKey||!l.deriveBits)return Promise.resolve(!1);if(void 0!==d[t])return d[t];var r=g(n=n||o.alloc(8),n,10,128,t).then((function(){return!0})).catch((function(){return!1}));return d[t]=r,r}(b).then((function(e){return e?g(t,r,i,p,b):u(t,r,i,p,m)})),y)}else h()((function(){var e;try{e=u(t,r,i,p,m)}catch(t){return y(t)}y(null,e)}))}}).call(this,r(24))},function(t,e,r){var n=r(333),i=r(147),o=r(148),a=r(346),s=r(112);function u(t,e,r){if(t=t.toLowerCase(),o[t])return i.createCipheriv(t,e,r);if(a[t])return new n({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function c(t,e,r){if(t=t.toLowerCase(),o[t])return i.createDecipheriv(t,e,r);if(a[t])return new n({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}e.createCipher=e.Cipher=function(t,e){var r,n;if(t=t.toLowerCase(),o[t])r=o[t].key,n=o[t].iv;else{if(!a[t])throw new TypeError("invalid suite type");r=8*a[t].key,n=a[t].iv}var i=s(e,!1,r,n);return u(t,i.key,i.iv)},e.createCipheriv=e.Cipheriv=u,e.createDecipher=e.Decipher=function(t,e){var r,n;if(t=t.toLowerCase(),o[t])r=o[t].key,n=o[t].iv;else{if(!a[t])throw new TypeError("invalid suite type");r=8*a[t].key,n=a[t].iv}var i=s(e,!1,r,n);return c(t,i.key,i.iv)},e.createDecipheriv=e.Decipheriv=c,e.listCiphers=e.getCiphers=function(){return Object.keys(a).concat(i.getCiphers())}},function(t,e,r){var n=r(68),i=r(334),o=r(11),a=r(17).Buffer,s={"des-ede3-cbc":i.CBC.instantiate(i.EDE),"des-ede3":i.EDE,"des-ede-cbc":i.CBC.instantiate(i.EDE),"des-ede":i.EDE,"des-cbc":i.CBC.instantiate(i.DES),"des-ecb":i.DES};function u(t){n.call(this);var e,r=t.mode.toLowerCase(),i=s[r];e=t.decrypt?"decrypt":"encrypt";var o=t.key;a.isBuffer(o)||(o=a.from(o)),"des-ede"!==r&&"des-ede-cbc"!==r||(o=a.concat([o,o.slice(0,8)]));var u=t.iv;a.isBuffer(u)||(u=a.from(u)),this._des=i.create({key:o,iv:u,type:e})}s.des=s["des-cbc"],s.des3=s["des-ede3-cbc"],t.exports=u,o(u,n),u.prototype._update=function(t){return a.from(this._des.update(t))},u.prototype._final=function(){return a.from(this._des.final())}},function(t,e,r){"use strict";e.utils=r(202),e.Cipher=r(146),e.DES=r(203),e.CBC=r(335),e.EDE=r(336)},function(t,e,r){"use strict";var n=r(42),i=r(11),o={};function a(t){n.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e<this.iv.length;e++)this.iv[e]=t[e]}e.instantiate=function(t){function e(e){t.call(this,e),this._cbcInit()}i(e,t);for(var r=Object.keys(o),n=0;n<r.length;n++){var a=r[n];e.prototype[a]=o[a]}return e.create=function(t){return new e(t)},e},o._cbcInit=function(){var t=new a(this.options.iv);this._cbcState=t},o._update=function(t,e,r,n){var i=this._cbcState,o=this.constructor.super_.prototype,a=i.iv;if("encrypt"===this.type){for(var s=0;s<this.blockSize;s++)a[s]^=t[e+s];o._update.call(this,a,0,r,n);for(s=0;s<this.blockSize;s++)a[s]=r[n+s]}else{o._update.call(this,t,e,r,n);for(s=0;s<this.blockSize;s++)r[n+s]^=a[s];for(s=0;s<this.blockSize;s++)a[s]=t[e+s]}}},function(t,e,r){"use strict";var n=r(42),i=r(11),o=r(146),a=r(203);function s(t,e){n.equal(e.length,24,"Invalid key length");var r=e.slice(0,8),i=e.slice(8,16),o=e.slice(16,24);this.ciphers="encrypt"===t?[a.create({type:"encrypt",key:r}),a.create({type:"decrypt",key:i}),a.create({type:"encrypt",key:o})]:[a.create({type:"decrypt",key:o}),a.create({type:"encrypt",key:i}),a.create({type:"decrypt",key:r})]}function u(t){o.call(this,t);var e=new s(this.type,this.options.key);this._edeState=e}i(u,o),t.exports=u,u.create=function(t){return new u(t)},u.prototype._update=function(t,e,r,n){var i=this._edeState;i.ciphers[0]._update(t,e,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},u.prototype._pad=a.prototype._pad,u.prototype._unpad=a.prototype._unpad},function(t,e,r){var n=r(148),i=r(207),o=r(17).Buffer,a=r(208),s=r(68),u=r(111),c=r(112);function l(t,e,r){s.call(this),this._cache=new d,this._cipher=new u.AES(e),this._prev=o.from(r),this._mode=t,this._autopadding=!0}r(11)(l,s),l.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get();)r=this._mode.encrypt(this,e),n.push(r);return o.concat(n)};var f=o.alloc(16,16);function d(){this.cache=o.allocUnsafe(0)}function h(t,e,r){var s=n[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=o.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.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,e,r):"auth"===s.type?new i(s.module,e,r):new l(s.module,e,r)}l.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(f))throw this._cipher.scrub(),new Error("data not multiple of block length")},l.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},d.prototype.add=function(t){this.cache=o.concat([this.cache,t])},d.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},d.prototype.flush=function(){for(var t=16-this.cache.length,e=o.allocUnsafe(t),r=-1;++r<t;)e.writeUInt8(t,r);return o.concat([this.cache,e])},e.createCipheriv=h,e.createCipher=function(t,e){var r=n[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=c(e,!1,r.key,r.iv);return h(t,i.key,i.iv)}},function(t,e){e.encrypt=function(t,e){return t._cipher.encryptBlock(e)},e.decrypt=function(t,e){return t._cipher.decryptBlock(e)}},function(t,e,r){var n=r(100);e.encrypt=function(t,e){var r=n(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev},e.decrypt=function(t,e){var r=t._prev;t._prev=e;var i=t._cipher.decryptBlock(e);return n(i,r)}},function(t,e,r){var n=r(17).Buffer,i=r(100);function o(t,e,r){var o=e.length,a=i(e,t._cache);return t._cache=t._cache.slice(o),t._prev=n.concat([t._prev,r?e:a]),a}e.encrypt=function(t,e,r){for(var i,a=n.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=n.allocUnsafe(0)),!(t._cache.length<=e.length)){a=n.concat([a,o(t,e,r)]);break}i=t._cache.length,a=n.concat([a,o(t,e.slice(0,i),r)]),e=e.slice(i)}return a}},function(t,e,r){var n=r(17).Buffer;function i(t,e,r){var i=t._cipher.encryptBlock(t._prev)[0]^e;return t._prev=n.concat([t._prev.slice(1),n.from([r?e:i])]),i}e.encrypt=function(t,e,r){for(var o=e.length,a=n.allocUnsafe(o),s=-1;++s<o;)a[s]=i(t,e[s],r);return a}},function(t,e,r){var n=r(17).Buffer;function i(t,e,r){for(var n,i,a=-1,s=0;++a<8;)n=e&1<<7-a?128:0,s+=(128&(i=t._cipher.encryptBlock(t._prev)[0]^n))>>a%8,t._prev=o(t._prev,r?n:i);return s}function o(t,e){var r=t.length,i=-1,o=n.allocUnsafe(t.length);for(t=n.concat([t,n.from([e])]);++i<r;)o[i]=t[i]<<1|t[i+1]>>7;return o}e.encrypt=function(t,e,r){for(var o=e.length,a=n.allocUnsafe(o),s=-1;++s<o;)a[s]=i(t,e[s],r);return a}},function(t,e,r){(function(t){var n=r(100);function i(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}e.encrypt=function(e,r){for(;e._cache.length<r.length;)e._cache=t.concat([e._cache,i(e)]);var o=e._cache.slice(0,r.length);return e._cache=e._cache.slice(r.length),n(r,o)}}).call(this,r(14).Buffer)},function(t,e,r){var n=r(17).Buffer,i=n.alloc(16,0);function o(t){var e=n.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function a(t){this.h=t,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}a.prototype.ghash=function(t){for(var e=-1;++e<t.length;)this.state[e]^=t[e];this._multiply()},a.prototype._multiply=function(){for(var t,e,r,n=[(t=this.h).readUInt32BE(0),t.readUInt32BE(4),t.readUInt32BE(8),t.readUInt32BE(12)],i=[0,0,0,0],a=-1;++a<128;){for(0!=(this.state[~~(a/8)]&1<<7-a%8)&&(i[0]^=n[0],i[1]^=n[1],i[2]^=n[2],i[3]^=n[3]),r=0!=(1&n[3]),e=3;e>0;e--)n[e]=n[e]>>>1|(1&n[e-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=o(i)},a.prototype.update=function(t){var e;for(this.cache=n.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},a.prototype.final=function(t,e){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(o([0,t,0,e])),this.state},t.exports=a},function(t,e,r){var n=r(207),i=r(17).Buffer,o=r(148),a=r(208),s=r(68),u=r(111),c=r(112);function l(t,e,r){s.call(this),this._cache=new f,this._last=void 0,this._cipher=new u.AES(e),this._prev=i.from(r),this._mode=t,this._autopadding=!0}function f(){this.cache=i.allocUnsafe(0)}function d(t,e,r){var s=o[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=i.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof e&&(e=i.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===s.type?new a(s.module,e,r,!0):"auth"===s.type?new n(s.module,e,r,!0):new l(s.module,e,r)}r(11)(l,s),l.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,e),n.push(r);return i.concat(n)},l.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");var r=-1;for(;++r<e;)if(t[r+(16-e)]!==e)throw new Error("unable to decrypt data");if(16===e)return;return t.slice(0,16-e)}(this._mode.decrypt(this,t));if(t)throw new Error("data not multiple of block length")},l.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},f.prototype.add=function(t){this.cache=i.concat([this.cache,t])},f.prototype.get=function(t){var e;if(t){if(this.cache.length>16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},f.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=function(t,e){var r=o[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=c(e,!1,r.key,r.iv);return d(t,n.key,n.iv)},e.createDecipheriv=d},function(t,e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}},function(t,e,r){(function(t){var n=r(209),i=r(350),o=r(351);var a={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(e){var r=new t(i[e].prime,"hex"),n=new t(i[e].gen,"hex");return new o(r,n)},e.createDiffieHellman=e.DiffieHellman=function e(r,i,s,u){return t.isBuffer(i)||void 0===a[i]?e(r,"binary",i,s):(i=i||"binary",u=u||"binary",s=s||new t([2]),t.isBuffer(s)||(s=new t(s,u)),"number"==typeof r?new o(n(r,s),s,!0):(t.isBuffer(r)||(r=new t(r,i)),new o(r,s,!0)))}}).call(this,r(14).Buffer)},function(t,e){},function(t,e){},function(t){t.exports=JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}')},function(t,e,r){(function(e){var n=r(35),i=new(r(210)),o=new n(24),a=new n(11),s=new n(10),u=new n(3),c=new n(7),l=r(209),f=r(82);function d(t,r){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),this._pub=new n(t),this}function h(t,r){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),this._priv=new n(t),this}t.exports=p;var g={};function p(t,e,r){this.setGenerator(e),this.__prime=new n(t),this._prime=n.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=d,this.setPrivateKey=h):this._primeCode=8}function m(t,r){var n=new e(t.toArray());return r?n.toString(r):n}Object.defineProperty(p.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,e){var r=e.toString("hex"),n=[r,t.toString(16)].join("_");if(n in g)return g[n];var f,d=0;if(t.isEven()||!l.simpleSieve||!l.fermatTest(t)||!i.test(t))return d+=1,d+="02"===r||"05"===r?8:4,g[n]=d,d;switch(i.test(t.shrn(1))||(d+=2),r){case"02":t.mod(o).cmp(a)&&(d+=8);break;case"05":(f=t.mod(s)).cmp(u)&&f.cmp(c)&&(d+=8);break;default:d+=4}return g[n]=d,d}(this.__prime,this.__gen)),this._primeCode}}),p.prototype.generateKeys=function(){return this._priv||(this._priv=new n(f(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},p.prototype.computeSecret=function(t){var r=(t=(t=new n(t)).toRed(this._prime)).redPow(this._priv).fromRed(),i=new e(r.toArray()),o=this.getPrime();if(i.length<o.length){var a=new e(o.length-i.length);a.fill(0),i=e.concat([a,i])}return i},p.prototype.getPublicKey=function(t){return m(this._pub,t)},p.prototype.getPrivateKey=function(t){return m(this._priv,t)},p.prototype.getPrime=function(t){return m(this.__prime,t)},p.prototype.getGenerator=function(t){return m(this._gen,t)},p.prototype.setGenerator=function(t,r){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),this.__gen=t,this._gen=new n(t),this}}).call(this,r(14).Buffer)},function(t,e,r){var n=r(17).Buffer,i=r(99),o=r(353),a=r(11),s=r(361),u=r(392),c=r(196);function l(t){o.Writable.call(this);var e=c[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function f(t){o.Writable.call(this);var e=c[t];if(!e)throw new Error("Unknown message digest");this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function d(t){return new l(t)}function h(t){return new f(t)}Object.keys(c).forEach((function(t){c[t].id=n.from(c[t].id,"hex"),c[t.toLowerCase()]=c[t]})),a(l,o.Writable),l.prototype._write=function(t,e,r){this._hash.update(t),r()},l.prototype.update=function(t,e){return"string"==typeof t&&(t=n.from(t,e)),this._hash.update(t),this},l.prototype.sign=function(t,e){this.end();var r=this._hash.digest(),n=s(r,t,this._hashType,this._signType,this._tag);return e?n.toString(e):n},a(f,o.Writable),f.prototype._write=function(t,e,r){this._hash.update(t),r()},f.prototype.update=function(t,e){return"string"==typeof t&&(t=n.from(t,e)),this._hash.update(t),this},f.prototype.verify=function(t,e,r){"string"==typeof e&&(e=n.from(e,r)),this.end();var i=this._hash.digest();return u(e,i,t,this._signType,this._tag)},t.exports={Sign:d,Verify:h,createSign:d,createVerify:h}},function(t,e,r){(e=t.exports=r(211)).Stream=e,e.Readable=e,e.Writable=r(215),e.Duplex=r(87),e.Transform=r(216),e.PassThrough=r(359),e.finished=r(150),e.pipeline=r(360)},function(t,e){},function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var a=r(14).Buffer,s=r(356).inspect,u=s&&s.custom||"inspect";t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,r,c;return e=t,(r=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return a.alloc(0);for(var e,r,n,i=a.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,r=i,n=s,a.prototype.copy.call(e,r,n),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,n=e.data;for(t-=n.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0==(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=a.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:u,value:function(t,e){return s(this,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},e,{depth:0,customInspect:!1}))}}])&&o(e.prototype,r),c&&o(e,c),t}()},function(t,e){},function(t,e,r){"use strict";(function(e){var n;function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=r(150),a=Symbol("lastResolve"),s=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),l=Symbol("lastPromise"),f=Symbol("handlePromise"),d=Symbol("stream");function h(t,e){return{value:t,done:e}}function g(t){var e=t[a];if(null!==e){var r=t[d].read();null!==r&&(t[l]=null,t[a]=null,t[s]=null,e(h(r,!1)))}}function p(t){e.nextTick(g,t)}var m=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((i(n={get stream(){return this[d]},next:function(){var t=this,r=this[u];if(null!==r)return Promise.reject(r);if(this[c])return Promise.resolve(h(void 0,!0));if(this[d].destroyed)return new Promise((function(r,n){e.nextTick((function(){t[u]?n(t[u]):r(h(void 0,!0))}))}));var n,i=this[l];if(i)n=new Promise(function(t,e){return function(r,n){t.then((function(){e[c]?r(h(void 0,!0)):e[f](r,n)}),n)}}(i,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(h(o,!1));n=new Promise(this[f])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var t=this;return new Promise((function(e,r){t[d].destroy(null,(function(t){t?r(t):e(h(void 0,!0))}))}))})),n),m);t.exports=function(t){var e,r=Object.create(y,(i(e={},d,{value:t,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,u,{value:null,writable:!0}),i(e,c,{value:t._readableState.endEmitted,writable:!0}),i(e,f,{value:function(t,e){var n=r[d].read();n?(r[l]=null,r[a]=null,r[s]=null,t(h(n,!1))):(r[a]=t,r[s]=e)},writable:!0}),e));return r[l]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[s];return null!==e&&(r[l]=null,r[a]=null,r[s]=null,e(t)),void(r[u]=t)}var n=r[a];null!==n&&(r[l]=null,r[a]=null,r[s]=null,n(h(void 0,!0))),r[c]=!0})),t.on("readable",p.bind(null,r)),r}}).call(this,r(20))},function(t,e){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(t,e,r){"use strict";t.exports=i;var n=r(216);function i(t){if(!(this instanceof i))return new i(t);n.call(this,t)}r(11)(i,n),i.prototype._transform=function(t,e,r){r(null,t)}},function(t,e,r){"use strict";var n;var i=r(86).codes,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(t){if(t)throw t}function u(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var s=!1;t.on("close",(function(){s=!0})),void 0===n&&(n=r(150)),n(t,{readable:e,writable:i},(function(t){if(t)return o(t);s=!0,o()}));var u=!1;return function(e){if(!s&&!u)return u=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new a("pipe"))}}function c(t){t()}function l(t,e){return t.pipe(e)}function f(t){return t.length?"function"!=typeof t[t.length-1]?s:t.pop():s}t.exports=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n,i=f(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var a=e.map((function(t,r){var o=r<e.length-1;return u(t,o,r>0,(function(t){n||(n=t),t&&a.forEach(c),o||(a.forEach(c),i(n))}))}));return e.reduce(l)}},function(t,e,r){var n=r(17).Buffer,i=r(194),o=r(151),a=r(152).ec,s=r(222),u=r(114),c=r(228);function l(t,e,r,o){if((t=n.from(t.toArray())).length<e.byteLength()){var a=n.alloc(e.byteLength()-t.length);t=n.concat([a,t])}var s=r.length,u=function(t,e){t=(t=f(t,e)).mod(e);var r=n.from(t.toArray());if(r.length<e.byteLength()){var i=n.alloc(e.byteLength()-r.length);r=n.concat([i,r])}return r}(r,e),c=n.alloc(s);c.fill(1);var l=n.alloc(s);return l=i(o,l).update(c).update(n.from([0])).update(t).update(u).digest(),c=i(o,l).update(c).digest(),{k:l=i(o,l).update(c).update(n.from([1])).update(t).update(u).digest(),v:c=i(o,l).update(c).digest()}}function f(t,e){var r=new s(t),n=(t.length<<3)-e.bitLength();return n>0&&r.ishrn(n),r}function d(t,e,r){var o,a;do{for(o=n.alloc(0);8*o.length<t.bitLength();)e.v=i(r,e.k).update(e.v).digest(),o=n.concat([o,e.v]);a=f(o,t),e.k=i(r,e.k).update(e.v).update(n.from([0])).digest(),e.v=i(r,e.k).update(e.v).digest()}while(-1!==a.cmp(t));return a}function h(t,e,r,n){return t.toRed(s.mont(r)).redPow(e).fromRed().mod(n)}t.exports=function(t,e,r,i,g){var p=u(e);if(p.curve){if("ecdsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong private key type");return function(t,e){var r=c[e.curve.join(".")];if(!r)throw new Error("unknown curve "+e.curve.join("."));var i=new a(r).keyFromPrivate(e.privateKey).sign(t);return n.from(i.toDER())}(t,p)}if("dsa"===p.type){if("dsa"!==i)throw new Error("wrong private key type");return function(t,e,r){var i,o=e.params.priv_key,a=e.params.p,u=e.params.q,c=e.params.g,g=new s(0),p=f(t,u).mod(u),m=!1,y=l(o,u,t,r);for(;!1===m;)i=d(u,y,r),g=h(c,i,a,u),0===(m=i.invm(u).imul(p.add(o.mul(g))).mod(u)).cmpn(0)&&(m=!1,g=new s(0));return function(t,e){t=t.toArray(),e=e.toArray(),128&t[0]&&(t=[0].concat(t));128&e[0]&&(e=[0].concat(e));var r=[48,t.length+e.length+4,2,t.length];return r=r.concat(t,[2,e.length],e),n.from(r)}(g,m)}(t,p,r)}if("rsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong private key type");t=n.concat([g,t]);for(var m=p.modulus.byteLength(),y=[0,1];t.length+y.length+1<m;)y.push(255);y.push(0);for(var b=-1;++b<t.length;)y.push(t[b]);return o(y,p)},t.exports.getKey=l,t.exports.makeKey=d},function(t,e,r){(function(t){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(363).Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function c(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u<s;u++){var c=t.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function l(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,l=r;l<s;l+=n)u=c(t,l,l+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var f=1;for(u=c(t,l,t.length,e),l=0;l<a;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype._move=function(t){l(t,this)},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&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)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(t){o.prototype.inspect=f}else o.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","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],g=[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(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);r=0!==(o=s>>>24-i&16777215)||a!==this.length-1?d[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=h[t],l=g[t];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var p=f.modrn(l).toString(t);r=(f=f.idivn(l)).isZero()?p+r:d[c-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%e!=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 t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(a,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c<n;c++){for(var l=u>>>26,f=67108863&u,d=Math.min(c,e.length-1),h=Math.max(0,c-t.length+1);h<=d;h++){var g=c-h|0;l+=(a=(i=0|t.words[g])*(o=0|e.words[h])+f)/67108864|0,f=67108863&a}r.words[c]=0|f,u=0|l}return 0!==u?r.words[c]=0|u:r.length--,r._strip()}o.prototype.toArrayLike=function(t,e,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(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|n;t[r++]=255&a,r<t.length&&(t[r++]=a>>8&255),r<t.length&&(t[r++]=a>>16&255),6===o?(r<t.length&&(t[r++]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},o.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|n;t[r--]=255&a,r>=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a<n.length;a++)o=(e=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,a=t.words,s=e.words,u=r.words,c=0,l=0|a[0],f=8191&l,d=l>>>13,h=0|a[1],g=8191&h,p=h>>>13,m=0|a[2],y=8191&m,b=m>>>13,w=0|a[3],_=8191&w,v=w>>>13,E=0|a[4],S=8191&E,O=E>>>13,T=0|a[5],A=8191&T,M=T>>>13,j=0|a[6],I=8191&j,R=j>>>13,D=0|a[7],k=8191&D,N=D>>>13,C=0|a[8],x=8191&C,L=C>>>13,P=0|a[9],B=8191&P,U=P>>>13,F=0|s[0],W=8191&F,H=F>>>13,q=0|s[1],z=8191&q,V=q>>>13,Y=0|s[2],G=8191&Y,$=Y>>>13,K=0|s[3],Z=8191&K,J=K>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ft=8191&lt,dt=lt>>>13,ht=0|s[9],gt=8191&ht,pt=ht>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(c+(n=Math.imul(f,W))|0)+((8191&(i=(i=Math.imul(f,H))+Math.imul(d,W)|0))<<13)|0;c=((o=Math.imul(d,H))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(g,W),i=(i=Math.imul(g,H))+Math.imul(p,W)|0,o=Math.imul(p,H);var yt=(c+(n=n+Math.imul(f,z)|0)|0)+((8191&(i=(i=i+Math.imul(f,V)|0)+Math.imul(d,z)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,W),i=(i=Math.imul(y,H))+Math.imul(b,W)|0,o=Math.imul(b,H),n=n+Math.imul(g,z)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(p,z)|0,o=o+Math.imul(p,V)|0;var bt=(c+(n=n+Math.imul(f,G)|0)|0)+((8191&(i=(i=i+Math.imul(f,$)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,$)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(_,W),i=(i=Math.imul(_,H))+Math.imul(v,W)|0,o=Math.imul(v,H),n=n+Math.imul(y,z)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(b,z)|0,o=o+Math.imul(b,V)|0,n=n+Math.imul(g,G)|0,i=(i=i+Math.imul(g,$)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,$)|0;var wt=(c+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(S,W),i=(i=Math.imul(S,H))+Math.imul(O,W)|0,o=Math.imul(O,H),n=n+Math.imul(_,z)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,z)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(y,G)|0,i=(i=i+Math.imul(y,$)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,$)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,J)|0)+Math.imul(p,Z)|0,o=o+Math.imul(p,J)|0;var _t=(c+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(A,W),i=(i=Math.imul(A,H))+Math.imul(M,W)|0,o=Math.imul(M,H),n=n+Math.imul(S,z)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(O,z)|0,o=o+Math.imul(O,V)|0,n=n+Math.imul(_,G)|0,i=(i=i+Math.imul(_,$)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,$)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,J)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var vt=(c+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(d,rt)|0))<<13)|0;c=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(I,W),i=(i=Math.imul(I,H))+Math.imul(R,W)|0,o=Math.imul(R,H),n=n+Math.imul(A,z)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(M,z)|0,o=o+Math.imul(M,V)|0,n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,$)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,$)|0,n=n+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,J)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,J)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,nt)|0;var Et=(c+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(k,W),i=(i=Math.imul(k,H))+Math.imul(N,W)|0,o=Math.imul(N,H),n=n+Math.imul(I,z)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(R,z)|0,o=o+Math.imul(R,V)|0,n=n+Math.imul(A,G)|0,i=(i=i+Math.imul(A,$)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,$)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,J)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,J)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(c+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(x,W),i=(i=Math.imul(x,H))+Math.imul(L,W)|0,o=Math.imul(L,H),n=n+Math.imul(k,z)|0,i=(i=i+Math.imul(k,V)|0)+Math.imul(N,z)|0,o=o+Math.imul(N,V)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,$)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,$)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,J)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(_,rt)|0,i=(i=i+Math.imul(_,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,n=n+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ct)|0;var Ot=(c+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,dt)|0)+Math.imul(d,ft)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(B,W),i=(i=Math.imul(B,H))+Math.imul(U,W)|0,o=Math.imul(U,H),n=n+Math.imul(x,z)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(L,z)|0,o=o+Math.imul(L,V)|0,n=n+Math.imul(k,G)|0,i=(i=i+Math.imul(k,$)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,$)|0,n=n+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,J)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,n=n+Math.imul(g,ft)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,dt)|0;var Tt=(c+(n=n+Math.imul(f,gt)|0)|0)+((8191&(i=(i=i+Math.imul(f,pt)|0)+Math.imul(d,gt)|0))<<13)|0;c=((o=o+Math.imul(d,pt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(B,z),i=(i=Math.imul(B,V))+Math.imul(U,z)|0,o=Math.imul(U,V),n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,$)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,$)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,at)|0,n=n+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,dt)|0;var At=(c+(n=n+Math.imul(g,gt)|0)|0)+((8191&(i=(i=i+Math.imul(g,pt)|0)+Math.imul(p,gt)|0))<<13)|0;c=((o=o+Math.imul(p,pt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(B,G),i=(i=Math.imul(B,$))+Math.imul(U,G)|0,o=Math.imul(U,$),n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,J)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ct)|0,n=n+Math.imul(_,ft)|0,i=(i=i+Math.imul(_,dt)|0)+Math.imul(v,ft)|0,o=o+Math.imul(v,dt)|0;var Mt=(c+(n=n+Math.imul(y,gt)|0)|0)+((8191&(i=(i=i+Math.imul(y,pt)|0)+Math.imul(b,gt)|0))<<13)|0;c=((o=o+Math.imul(b,pt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(B,Z),i=(i=Math.imul(B,J))+Math.imul(U,Z)|0,o=Math.imul(U,J),n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,at)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,n=n+Math.imul(S,ft)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,dt)|0;var jt=(c+(n=n+Math.imul(_,gt)|0)|0)+((8191&(i=(i=i+Math.imul(_,pt)|0)+Math.imul(v,gt)|0))<<13)|0;c=((o=o+Math.imul(v,pt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,n=Math.imul(B,Q),i=(i=Math.imul(B,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ct)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,dt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,dt)|0;var It=(c+(n=n+Math.imul(S,gt)|0)|0)+((8191&(i=(i=i+Math.imul(S,pt)|0)+Math.imul(O,gt)|0))<<13)|0;c=((o=o+Math.imul(O,pt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(B,rt),i=(i=Math.imul(B,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,dt)|0;var Rt=(c+(n=n+Math.imul(A,gt)|0)|0)+((8191&(i=(i=i+Math.imul(A,pt)|0)+Math.imul(M,gt)|0))<<13)|0;c=((o=o+Math.imul(M,pt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ct)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,dt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,dt)|0;var Dt=(c+(n=n+Math.imul(I,gt)|0)|0)+((8191&(i=(i=i+Math.imul(I,pt)|0)+Math.imul(R,gt)|0))<<13)|0;c=((o=o+Math.imul(R,pt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,n=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(U,ut)|0,o=Math.imul(U,ct),n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(L,ft)|0,o=o+Math.imul(L,dt)|0;var kt=(c+(n=n+Math.imul(k,gt)|0)|0)+((8191&(i=(i=i+Math.imul(k,pt)|0)+Math.imul(N,gt)|0))<<13)|0;c=((o=o+Math.imul(N,pt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(B,ft),i=(i=Math.imul(B,dt))+Math.imul(U,ft)|0,o=Math.imul(U,dt);var Nt=(c+(n=n+Math.imul(x,gt)|0)|0)+((8191&(i=(i=i+Math.imul(x,pt)|0)+Math.imul(L,gt)|0))<<13)|0;c=((o=o+Math.imul(L,pt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var Ct=(c+(n=Math.imul(B,gt))|0)+((8191&(i=(i=Math.imul(B,pt))+Math.imul(U,gt)|0))<<13)|0;return c=((o=Math.imul(U,pt))+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=yt,u[2]=bt,u[3]=wt,u[4]=_t,u[5]=vt,u[6]=Et,u[7]=St,u[8]=Ot,u[9]=Tt,u[10]=At,u[11]=Mt,u[12]=jt,u[13]=It,u[14]=Rt,u[15]=Dt,u[16]=kt,u[17]=Nt,u[18]=Ct,0!==c&&(u[19]=c,r.length++),r};function y(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var a=i;i=0;for(var s=67108863&n,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,f=(0|t.words[l])*(0|e.words[c]),d=67108863&f;s=67108863&(d=d+s|0),i+=(a=(a=a+(f/67108864|0)|0)+(d>>>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(t,e,r){return y(t,e,r)}function w(t,e){this.x=t,this.y=e}Math.imul||(m=p),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?y(this,t,e):b(this,t,e)},w.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},w.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},w.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a<o;a++)n[a]=e[t[a]],i[a]=r[t[a]]},w.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var f=u,d=c,h=0;h<a;h++){var g=r[l+h],p=n[l+h],m=r[l+h+a],y=n[l+h+a],b=f*m-d*y;y=f*y+d*m,m=b,r[l+h]=g+m,n[l+h]=p+y,r[l+h+a]=g-m,n[l+h+a]=p-y,h!==s&&(b=u*f-c*d,d=u*d+c*f,f=b)}},w.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},w.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},w.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},w.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},w.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},w.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),u=new Array(n),c=new Array(n),l=new Array(n),f=new Array(n),d=r.words;d.length=n,this.convert13b(t.words,t.length,a,n),this.convert13b(e.words,e.length,c,n),this.transform(a,o,s,u,n,i),this.transform(c,o,l,f,n,i);for(var h=0;h<n;h++){var g=s[h]*l[h]-u[h]*f[h];u[h]=s[h]*f[h]+u[h]*l[h],s[h]=g}return this.conjugate(s,u,n),this.transform(s,u,d,o,n,i),this.conjugate(d,o,n),this.normalize13b(d,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r._strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),b(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var f=0|this.words[c];this.words[c]=l<<26-o|f>>>o,l=f&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r)&&!!(this.words[r]&i)},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,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"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=n.clone()._ishlnsubmul(i,1,u);0===l.negative&&(n=l,s&&(s.words[u]=1));for(var f=u-1;f>=0;f--){var d=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=d)}return s&&s._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),f=e.clone();!e.isZero();){for(var d=0,h=1;0==(e.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(f)),i.iushrn(1),a.iushrn(1);for(var g=0,p=1;0==(r.words[0]&p)&&g<26;++g,p<<=1);if(g>0)for(r.iushrn(g);g-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(f)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(u)):(r.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var f=0,d=1;0==(r.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>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(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new A(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},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(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var _={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function E(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function O(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function T(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){A.call(this,t),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)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(E,v),E.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n<r;n++)e.words[n]=t.words[n];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},E.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(S,v),i(O,v),i(T,v),T.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(_[t])return _[t];var e;if("k256"===t)e=new E;else if("p224"===t)e=new S;else if("p192"===t)e=new O;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new T}return _[t]=e,e},A.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(l(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,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),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,i),d=this.pow(t,i.addn(1).iushrn(1)),h=this.pow(t,i),g=a;0!==h.cmp(s);){for(var p=h,m=0;0!==p.cmp(s);m++)p=p.redSqr();n(m<g);var y=this.pow(f,new o(1).iushln(g-m-1));d=d.redMul(y),f=y.redSqr(),h=h.redMul(f),g=m}return d},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],l=u-1;l>=0;l--){var f=c>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===n&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}u=26}return i},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,A),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),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)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(95)(t))},function(t,e){},function(t){t.exports=JSON.parse('{"name":"elliptic","version":"6.5.4","description":"EC cryptography","main":"lib/elliptic.js","files":["lib"],"scripts":{"lint":"eslint lib test","lint:fix":"npm run lint -- --fix","unit":"istanbul test _mocha --reporter=spec test/index.js","test":"npm run lint && npm run unit","version":"grunt dist && git add dist/"},"repository":{"type":"git","url":"git@github.com:indutny/elliptic"},"keywords":["EC","Elliptic","curve","Cryptography"],"author":"Fedor Indutny <fedor@indutny.com>","license":"MIT","bugs":{"url":"https://github.com/indutny/elliptic/issues"},"homepage":"https://github.com/indutny/elliptic","devDependencies":{"brfs":"^2.0.2","coveralls":"^3.1.0","eslint":"^7.6.0","grunt":"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.5","mocha":"^8.0.1"},"dependencies":{"bn.js":"^4.11.9","brorand":"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1","inherits":"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}')},function(t,e,r){"use strict";var n=r(43),i=r(35),o=r(11),a=r(113),s=n.assert;function u(t){a.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(t,e,r,n){a.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(t,e,r,n){a.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,a),t.exports=u,u.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new i(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new i(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?r=o[0]:(r=o[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),r=new i(2).toRed(e).redInvm(),n=r.redNeg(),o=new i(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,r,n,o,a,s,u,c,l,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=t,h=this.n.clone(),g=new i(1),p=new i(0),m=new i(0),y=new i(1),b=0;0!==d.cmpn(0);){var w=h.div(d);c=h.sub(w.mul(d)),l=m.sub(w.mul(g));var _=y.sub(w.mul(p));if(!n&&c.cmp(f)<0)e=u.neg(),r=g,n=c.neg(),o=l;else if(n&&2==++b)break;u=c,h=d,d=c,m=g,g=l,y=p,p=_}a=c.neg(),s=l;var v=n.sqr().add(o.sqr());return a.sqr().add(s.sqr()).cmp(v)>=0&&(a=e,s=r),n.negative&&(n=n.neg(),o=o.neg()),a.negative&&(a=a.neg(),s=s.neg()),[{a:n,b:o},{a:a,b:s}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),u=i.mul(r.b),c=o.mul(n.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(e&&!o||!e&&o)&&(n=n.redNeg()),this.point(t,n)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var a=this._endoSplit(e[o]),s=t[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),n[2*o]=s,n[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var c=this._wnafMulAdd(1,n,i,2*o,r),l=0;l<2*o;l++)n[l]=null,i[l]=null;return c},o(c,a.BasePoint),u.prototype.point=function(t,e,r){return new c(this,t,e,r)},u.prototype.pointFromJSON=function(t,e){return c.fromJSON(this,t,e)},c.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,n=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return e}},c.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},c.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var n=t.point(e[0],e[1],r);if(!e[2])return n;function i(e){return t.point(e[0],e[1],r)}var o=e[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},c.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(t){return t=new i(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},c.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},c.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},c.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,a.BasePoint),u.prototype.jpoint=function(t,e,r){return new l(this,t,e,r)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),s=n.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),f=n.redMul(c),d=u.redSqr().redIAdd(l).redISub(f).redISub(f),h=u.redMul(f.redISub(d)).redISub(o.redMul(l)),g=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,h,g)},l.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=r.redMul(u),f=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(f)).redISub(i.redMul(c)),h=this.z.redMul(a);return this.curve.jpoint(f,d,h)},l.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),c=a.redAdd(a);for(e=0;e<t;e++){var l=o.redSqr(),f=c.redSqr(),d=f.redSqr(),h=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(u)),g=o.redMul(f),p=h.redSqr().redISub(g.redAdd(g)),m=g.redISub(p),y=h.redMul(m);y=y.redIAdd(y).redISub(d);var b=c.redMul(s);e+1<t&&(u=u.redMul(d)),o=p,s=b,c=y}return this.curve.jpoint(o,c.redMul(i),s)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},l.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(n).redISub(o);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n),u=s.redSqr().redISub(a).redISub(a),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=u,e=s.redMul(a.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),f=this.y.redSqr(),d=f.redSqr(),h=this.x.redAdd(f).redSqr().redISub(l).redISub(d);h=h.redIAdd(h);var g=l.redAdd(l).redIAdd(l),p=g.redSqr(),m=d.redIAdd(d);m=(m=m.redIAdd(m)).redIAdd(m),t=p.redISub(h).redISub(h),e=g.redMul(h.redISub(t)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},l.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(n).redISub(o);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);t=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=s.redMul(a.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),f=this.y.redSqr(),d=this.x.redMul(f),h=this.x.redSub(l).redMul(this.x.redAdd(l));h=h.redAdd(h).redIAdd(h);var g=d.redIAdd(d),p=(g=g.redIAdd(g)).redAdd(g);t=h.redSqr().redISub(p),r=this.y.redAdd(this.z).redSqr().redISub(f).redISub(l);var m=f.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),e=h.redMul(g.redISub(t)).redISub(m)}return this.curve.jpoint(t,e,r)},l.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=e.redSqr(),a=r.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=e.redAdd(e),c=(u=u.redIAdd(u)).redMul(a),l=s.redSqr().redISub(c.redAdd(c)),f=c.redISub(l),d=a.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var h=s.redMul(f).redISub(d),g=r.redAdd(r).redMul(n);return this.curve.jpoint(l,h,g)},l.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),a=this.x.redAdd(e).redSqr().redISub(t).redISub(n),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),l=e.redMul(c);l=(l=l.redIAdd(l)).redIAdd(l);var f=this.x.redMul(s).redISub(l);f=(f=f.redIAdd(f)).redIAdd(f);var d=this.y.redMul(c.redMul(u.redISub(c)).redISub(a.redMul(s)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var h=this.z.redAdd(a).redSqr().redISub(r).redISub(s);return this.curve.jpoint(f,d,h)},l.prototype.mul=function(t,e){return t=new i(t,e),this.curve._wnafMul(this,t)},l.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var n=e.redMul(this.z),i=r.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(n)).cmpn(0)},l.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(e);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(t,e,r){"use strict";var n=r(35),i=r(11),o=r(113),a=r(43);function s(t){o.call(this,"mont",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(t,e,r){o.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(e,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(s,o),t.exports=s,s.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},i(u,o.BasePoint),s.prototype.decodePoint=function(t,e){return this.point(a.toArray(t,e),1)},s.prototype.point=function(t,e){return new u(this,t,e)},s.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(t,e){return new u(t,e[0],e[1]||t.one)},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),n=t.redMul(e),i=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),a=i.redMul(n),s=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},u.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(t,e,r){"use strict";var n=r(43),i=r(35),o=r(11),a=r(113),s=n.assert;function u(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,a.call(this,"edwards",t),this.a=new i(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),s(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function c(t,e,r,n,o){a.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(e,16),this.y=new i(r,16),this.z=n?new i(n,16):this.curve.one,this.t=o&&new i(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(u,a),t.exports=u,u.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},u.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},u.prototype.jpoint=function(t,e,r,n){return this.point(t,e,r,n)},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),a=n.redMul(o.redInvm()),s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");var u=s.fromRed().isOdd();return(e&&!u||!e&&u)&&(s=s.redNeg()),this.point(t,s)},u.prototype.pointFromY=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),a=n.redMul(o.redInvm());if(0===a.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==e&&(s=s.redNeg()),this.point(s,t)},u.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),n=e.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===n.cmp(i)},o(c,a.BasePoint),u.prototype.pointFromJSON=function(t){return c.fromJSON(this,t)},u.prototype.point=function(t,e,r,n){return new c(this,t,e,r,n)},c.fromJSON=function(t,e){return new c(t,e[0],e[1],e[2])},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},c.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=n.redAdd(e),a=o.redSub(r),s=n.redSub(e),u=i.redMul(a),c=o.redMul(s),l=i.redMul(s),f=a.redMul(o);return this.curve.point(u,c,f,l)},c.prototype._projDbl=function(){var t,e,r,n,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(n=this.curve._mulA(s)).redAdd(u);this.zOne?(t=a.redSub(s).redSub(u).redMul(c.redSub(this.curve.two)),e=c.redMul(n.redSub(u)),r=c.redSqr().redSub(c).redSub(c)):(i=this.z.redSqr(),o=c.redSub(i).redISub(i),t=a.redSub(s).redISub(u).redMul(o),e=c.redMul(n.redSub(u)),r=c.redMul(o))}else n=s.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),t=this.curve._mulC(a.redISub(n)).redMul(o),e=this.curve._mulC(n).redMul(s.redISub(u)),r=n.redMul(o);return this.curve.point(t,e,r)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),a=i.redSub(n),s=i.redAdd(n),u=r.redAdd(e),c=o.redMul(a),l=s.redMul(u),f=o.redMul(u),d=a.redMul(s);return this.curve.point(c,l,d,f)},c.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),c=i.redAdd(s),l=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),f=n.redMul(u).redMul(l);return this.curve.twisted?(e=n.redMul(c).redMul(a.redSub(this.curve._mulA(o))),r=u.redMul(c)):(e=n.redMul(c).redMul(a.redSub(o)),r=this.curve._mulC(u).redMul(c)),this.curve.point(f,e,r)},c.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},c.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},c.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},c.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},function(t,e,r){"use strict";e.sha1=r(369),e.sha224=r(370),e.sha256=r(220),e.sha384=r(371),e.sha512=r(221)},function(t,e,r){"use strict";var n=r(51),i=r(101),o=r(219),a=n.rotl32,s=n.sum32,u=n.sum32_5,c=o.ft_1,l=i.BlockHash,f=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(d,l),t.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=a(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],o=this.h[1],l=this.h[2],d=this.h[3],h=this.h[4];for(n=0;n<r.length;n++){var g=~~(n/20),p=u(a(i,5),c(g,o,l,d),h,r[n],f[g]);h=d,d=l,l=a(o,30),o=i,i=p}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],l),this.h[3]=s(this.h[3],d),this.h[4]=s(this.h[4],h)},d.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(t,e,r){"use strict";var n=r(51),i=r(220);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},function(t,e,r){"use strict";var n=r(51),i=r(221);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},function(t,e,r){"use strict";var n=r(51),i=r(101),o=n.rotl32,a=n.sum32,s=n.sum32_3,u=n.sum32_4,c=i.BlockHash;function l(){if(!(this instanceof l))return new l;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function f(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function d(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function h(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}n.inherits(l,c),e.ripemd160=l,l.blockSize=512,l.outSize=160,l.hmacStrength=192,l.padLength=64,l.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],c=this.h[3],l=this.h[4],b=r,w=n,_=i,v=c,E=l,S=0;S<80;S++){var O=a(o(u(r,f(S,n,i,c),t[g[S]+e],d(S)),m[S]),l);r=l,l=c,c=o(i,10),i=n,n=O,O=a(o(u(b,f(79-S,w,_,v),t[p[S]+e],h(S)),y[S]),E),b=E,E=v,v=o(_,10),_=w,w=O}O=s(this.h[1],i,v),this.h[1]=s(this.h[2],c,E),this.h[2]=s(this.h[3],l,b),this.h[3]=s(this.h[4],r,w),this.h[4]=s(this.h[0],n,_),this.h[0]=O},l.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var g=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],p=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],y=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},function(t,e,r){"use strict";var n=r(51),i=r(42);function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(e,r))}t.exports=o,o.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},o.prototype.update=function(t,e){return this.inner.update(t,e),this},o.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},function(t,e){t.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(t,e,r){"use strict";var n=r(35),i=r(376),o=r(43),a=r(153),s=r(149),u=o.assert,c=r(377),l=r(378);function f(t){if(!(this instanceof f))return new f(t);"string"==typeof t&&(u(Object.prototype.hasOwnProperty.call(a,t),"Unknown curve "+t),t=a[t]),t instanceof a.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=f,f.prototype.keyPair=function(t){return new c(this,t)},f.prototype.keyFromPrivate=function(t,e){return c.fromPrivate(this,t,e)},f.prototype.keyFromPublic=function(t,e){return c.fromPublic(this,t,e)},f.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||s(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var a=new n(e.generate(r));if(!(a.cmp(o)>0))return a.iaddn(1),this.keyFromPrivate(a)}},f.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},f.prototype.sign=function(t,e,r,o){"object"==typeof r&&(o=r,r=null),o||(o={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new n(t,16));for(var a=this.n.byteLength(),s=e.getPrivate().toArray("be",a),u=t.toArray("be",a),c=new i({hash:this.hash,entropy:s,nonce:u,pers:o.pers,persEnc:o.persEnc||"utf8"}),f=this.n.sub(new n(1)),d=0;;d++){var h=o.k?o.k(d):new n(c.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(f)>=0)){var g=this.g.mul(h);if(!g.isInfinity()){var p=g.getX(),m=p.umod(this.n);if(0!==m.cmpn(0)){var y=h.invm(this.n).mul(m.mul(e.getPrivate()).iadd(t));if(0!==(y=y.umod(this.n)).cmpn(0)){var b=(g.getY().isOdd()?1:0)|(0!==p.cmp(m)?2:0);return o.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),b^=1),new l({r:m,s:y,recoveryParam:b})}}}}}},f.prototype.verify=function(t,e,r,i){t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i);var o=(e=new l(e,"hex")).r,a=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,u=a.invm(this.n),c=u.mul(t).umod(this.n),f=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(c,r.getPublic(),f)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(c,r.getPublic(),f)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},f.prototype.recoverPubKey=function(t,e,r,i){u((3&r)===r,"The recovery param is more than two bits"),e=new l(e,i);var o=this.n,a=new n(t),s=e.r,c=e.s,f=1&r,d=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");s=d?this.curve.pointFromX(s.add(this.curve.n),f):this.curve.pointFromX(s,f);var h=e.r.invm(o),g=o.sub(a).mul(h).umod(o),p=c.mul(h).umod(o);return this.g.mulAdd(g,s,p)},f.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new l(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},function(t,e,r){"use strict";var n=r(154),i=r(217),o=r(42);function a(t){if(!(this instanceof a))return new a(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=i.toArray(t.entropy,t.entropyEnc||"hex"),r=i.toArray(t.nonce,t.nonceEnc||"hex"),n=i.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}t.exports=a,a.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},a.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},a.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},a.prototype.reseed=function(t,e,r,n){"string"!=typeof e&&(n=r,r=e,e=null),t=i.toArray(t,e),r=i.toArray(r,n),o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},a.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length<t;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var a=o.slice(0,t);return this._update(r),this._reseed++,i.encode(a,e)}},function(t,e,r){"use strict";var n=r(35),i=r(43).assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=o,o.fromPublic=function(t,e,r){return e instanceof o?e:new o(t,{pub:e,pubEnc:r})},o.fromPrivate=function(t,e,r){return e instanceof o?e:new o(t,{priv:e,privEnc:r})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.validate()||i(t.validate(),"public point not validated"),t.mul(this.priv).getX()},o.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},function(t,e,r){"use strict";var n=r(35),i=r(43),o=i.assert;function a(t,e){if(t instanceof a)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function s(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,a=e.place;o<n;o++,a++)i<<=8,i|=t[a],i>>>=0;return!(i<=127)&&(e.place=a,i)}function c(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function l(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=a,a.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new s;if(48!==t[r.place++])return!1;var o=u(t,r);if(!1===o)return!1;if(o+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var a=u(t,r);if(!1===a)return!1;var c=t.slice(r.place,a+r.place);if(r.place+=a,2!==t[r.place++])return!1;var l=u(t,r);if(!1===l)return!1;if(t.length!==l+r.place)return!1;var f=t.slice(r.place,l+r.place);if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}return this.r=new n(c),this.s=new n(f),this.recoveryParam=null,!0},a.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=c(e),r=c(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];l(n,e.length),(n=n.concat(e)).push(2),l(n,r.length);var o=n.concat(r),a=[48];return l(a,o.length),a=a.concat(o),i.encode(a,t)}},function(t,e,r){"use strict";var n=r(154),i=r(153),o=r(43),a=o.assert,s=o.parseBytes,u=r(380),c=r(381);function l(t){if(a("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof l))return new l(t);t=i[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=n.sha512}t.exports=l,l.prototype.sign=function(t,e){t=s(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),u=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:o})},l.prototype.verify=function(t,e,r){t=s(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(o)},l.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return o.intFromLE(t.digest()).umod(this.curve.n)},l.prototype.keyFromPublic=function(t){return u.fromPublic(this,t)},l.prototype.keyFromSecret=function(t){return u.fromSecret(this,t)},l.prototype.makeSignature=function(t){return t instanceof c?t:new c(this,t)},l.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},l.prototype.decodePoint=function(t){var e=(t=o.parseBytes(t)).length-1,r=t.slice(0,e).concat(-129&t[e]),n=0!=(128&t[e]),i=o.intFromLE(r);return this.curve.pointFromY(i,n)},l.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},l.prototype.decodeInt=function(t){return o.intFromLE(t)},l.prototype.isPoint=function(t){return t instanceof this.pointClass}},function(t,e,r){"use strict";var n=r(43),i=n.assert,o=n.parseBytes,a=n.cachedProperty;function s(t,e){this.eddsa=t,this._secret=o(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=o(e.pub)}s.fromPublic=function(t,e){return e instanceof s?e:new s(t,{pub:e})},s.fromSecret=function(t,e){return e instanceof s?e:new s(t,{secret:e})},s.prototype.secret=function(){return this._secret},a(s,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),a(s,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),a(s,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,n=e.slice(0,t.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),a(s,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),a(s,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),a(s,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),s.prototype.sign=function(t){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},s.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},s.prototype.getSecret=function(t){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),t)},s.prototype.getPublic=function(t){return n.encode(this.pubBytes(),t)},t.exports=s},function(t,e,r){"use strict";var n=r(35),i=r(43),o=i.assert,a=i.cachedProperty,s=i.parseBytes;function u(t,e){this.eddsa=t,"object"!=typeof e&&(e=s(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),o(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof n&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}a(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),a(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),a(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),a(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},t.exports=u},function(t,e){},function(t,e,r){"use strict";var n=r(223);e.certificate=r(389);var i=n.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));e.RSAPrivateKey=i;var o=n.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));e.RSAPublicKey=o;var a=n.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())}));e.PublicKey=a;var s=n.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),u=n.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())}));e.PrivateKey=u;var c=n.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));e.EncryptedPrivateKey=c;var l=n.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));e.DSAPrivateKey=l,e.DSAparam=n.define("DSAparam",(function(){this.int()}));var f=n.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(d),this.key("publicKey").optional().explicit(1).bitstr())}));e.ECPrivateKey=f;var d=n.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})}));e.signature=n.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}))},function(t,e,r){"use strict";const n=r(224),i=r(226),o=r(11);function a(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}e.define=function(t,e){return new a(t,e)},a.prototype._createNamed=function(t){const e=this.name;function r(t){this._initNamed(t,e)}return o(r,t),r.prototype._initNamed=function(e,r){t.call(this,e,r)},new r(this)},a.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(i[t])),this.decoders[t]},a.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},a.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(n[t])),this.encoders[t]},a.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}},function(t,e,r){"use strict";const n=r(11),i=r(225);function o(t){i.call(this,t),this.enc="pem"}n(o,i),t.exports=o,o.prototype.encode=function(t,e){const r=i.prototype.encode.call(this,t).toString("base64"),n=["-----BEGIN "+e.label+"-----"];for(let t=0;t<r.length;t+=64)n.push(r.slice(t,t+64));return n.push("-----END "+e.label+"-----"),n.join("\n")}},function(t,e,r){"use strict";const n=r(11),i=r(155).Buffer,o=r(227);function a(t){o.call(this,t),this.enc="pem"}n(a,o),t.exports=a,a.prototype.decode=function(t,e){const r=t.toString().split(/[\r\n]+/g),n=e.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/;let s=-1,u=-1;for(let t=0;t<r.length;t++){const e=r[t].match(a);if(null!==e&&e[2]===n){if(-1!==s){if("END"!==e[1])break;u=t;break}if("BEGIN"!==e[1])break;s=t}}if(-1===s||-1===u)throw new Error("PEM section not found for: "+n);const c=r.slice(s+1,u).join("");c.replace(/[^a-z0-9+/=]+/gi,"");const l=i.from(c,"base64");return o.prototype.decode.call(this,l,e)}},function(t,e,r){"use strict";const n=e;n.Reporter=r(157).Reporter,n.DecoderBuffer=r(102).DecoderBuffer,n.EncoderBuffer=r(102).EncoderBuffer,n.Node=r(156)},function(t,e,r){"use strict";const n=e;n._reverse=function(t){const e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);const n=t[r];e[n]=r})),e},n.der=r(158)},function(t,e,r){"use strict";var n=r(223),i=n.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),o=n.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),a=n.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),s=n.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())})),u=n.define("RelativeDistinguishedName",(function(){this.setof(o)})),c=n.define("RDNSequence",(function(){this.seqof(u)})),l=n.define("Name",(function(){this.choice({rdnSequence:this.use(c)})})),f=n.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))})),d=n.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),h=n.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(a),this.key("issuer").use(l),this.key("validity").use(f),this.key("subject").use(l),this.key("subjectPublicKeyInfo").use(s),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(d).optional())})),g=n.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(h),this.key("signatureAlgorithm").use(a),this.key("signatureValue").bitstr())}));t.exports=g},function(t){t.exports=JSON.parse('{"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}')},function(t,e,r){var n=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,i=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,o=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,a=r(112),s=r(147),u=r(17).Buffer;t.exports=function(t,e){var r,c=t.toString(),l=c.match(n);if(l){var f="aes"+l[1],d=u.from(l[2],"hex"),h=u.from(l[3].replace(/[\r\n]/g,""),"base64"),g=a(e,d.slice(0,8),parseInt(l[1],10)).key,p=[],m=s.createDecipheriv(f,g,d);p.push(m.update(h)),p.push(m.final()),r=u.concat(p)}else{var y=c.match(o);r=u.from(y[2].replace(/[\r\n]/g,""),"base64")}return{tag:c.match(i)[1],data:r}}},function(t,e,r){var n=r(17).Buffer,i=r(222),o=r(152).ec,a=r(114),s=r(228);function u(t,e){if(t.cmpn(0)<=0)throw new Error("invalid sig");if(t.cmp(e)>=e)throw new Error("invalid sig")}t.exports=function(t,e,r,c,l){var f=a(r);if("ec"===f.type){if("ecdsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");return function(t,e,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(e,t,a)}(t,e,f)}if("dsa"===f.type){if("dsa"!==c)throw new Error("wrong public key type");return function(t,e,r){var n=r.data.p,o=r.data.q,s=r.data.g,c=r.data.pub_key,l=a.signature.decode(t,"der"),f=l.s,d=l.r;u(f,o),u(d,o);var h=i.mont(n),g=f.invm(o);return 0===s.toRed(h).redPow(new i(e).mul(g).mod(o)).fromRed().mul(c.toRed(h).redPow(d.mul(g).mod(o)).fromRed()).mod(n).mod(o).cmp(d)}(t,e,f)}if("rsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");e=n.concat([l,e]);for(var d=f.modulus.byteLength(),h=[1],g=0;e.length+h.length+2<d;)h.push(255),g++;h.push(0);for(var p=-1;++p<e.length;)h.push(e[p]);h=n.from(h);var m=i.mont(f.modulus);t=(t=new i(t).toRed(m)).redPow(new i(f.publicExponent)),t=n.from(t.fromRed().toArray());var y=g<8?1:0;for(d=Math.min(t.length,h.length),t.length!==h.length&&(y=1),p=-1;++p<d;)y|=t[p]^h[p];return 0===y}},function(t,e,r){(function(e){var n=r(152),i=r(35);t.exports=function(t){return new a(t)};var o={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function a(t){this.curveType=o[t],this.curveType||(this.curveType={name:t}),this.curve=new n.ec(this.curveType.name),this.keys=void 0}function s(t,r,n){Array.isArray(t)||(t=t.toArray());var i=new e(t);if(n&&i.length<n){var o=new e(n-i.length);o.fill(0),i=e.concat([o,i])}return r?i.toString(r):i}o.p224=o.secp224r1,o.p256=o.secp256r1=o.prime256v1,o.p192=o.secp192r1=o.prime192v1,o.p384=o.secp384r1,o.p521=o.secp521r1,a.prototype.generateKeys=function(t,e){return this.keys=this.curve.genKeyPair(),this.getPublicKey(t,e)},a.prototype.computeSecret=function(t,r,n){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),s(this.curve.keyFromPublic(t).getPublic().mul(this.keys.getPrivate()).getX(),n,this.curveType.byteLength)},a.prototype.getPublicKey=function(t,e){var r=this.keys.getPublic("compressed"===e,!0);return"hybrid"===e&&(r[r.length-1]%2?r[0]=7:r[0]=6),s(r,t)},a.prototype.getPrivateKey=function(t){return s(this.keys.getPrivate(),t)},a.prototype.setPublicKey=function(t,r){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),this.keys._importPublic(t),this},a.prototype.setPrivateKey=function(t,r){r=r||"utf8",e.isBuffer(t)||(t=new e(t,r));var n=new i(t);return n=n.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(n),this}}).call(this,r(14).Buffer)},function(t,e,r){e.publicEncrypt=r(395),e.privateDecrypt=r(396),e.privateEncrypt=function(t,r){return e.publicEncrypt(t,r,!0)},e.publicDecrypt=function(t,r){return e.privateDecrypt(t,r,!0)}},function(t,e,r){var n=r(114),i=r(82),o=r(99),a=r(229),s=r(230),u=r(35),c=r(231),l=r(151),f=r(17).Buffer;t.exports=function(t,e,r){var d;d=t.padding?t.padding:r?1:4;var h,g=n(t);if(4===d)h=function(t,e){var r=t.modulus.byteLength(),n=e.length,c=o("sha1").update(f.alloc(0)).digest(),l=c.length,d=2*l;if(n>r-d-2)throw new Error("message too long");var h=f.alloc(r-n-d-2),g=r-l-1,p=i(l),m=s(f.concat([c,h,f.alloc(1,1),e],g),a(p,g)),y=s(p,a(m,l));return new u(f.concat([f.alloc(1),y,m],r))}(g,e);else if(1===d)h=function(t,e,r){var n,o=e.length,a=t.modulus.byteLength();if(o>a-11)throw new Error("message too long");n=r?f.alloc(a-o-3,255):function(t){var e,r=f.allocUnsafe(t),n=0,o=i(2*t),a=0;for(;n<t;)a===o.length&&(o=i(2*t),a=0),(e=o[a++])&&(r[n++]=e);return r}(a-o-3);return new u(f.concat([f.from([0,r?1:2]),n,f.alloc(1),e],a))}(g,e,r);else{if(3!==d)throw new Error("unknown padding");if((h=new u(e)).cmp(g.modulus)>=0)throw new Error("data too long for modulus")}return r?l(h,g):c(h,g)}},function(t,e,r){var n=r(114),i=r(229),o=r(230),a=r(35),s=r(151),u=r(99),c=r(231),l=r(17).Buffer;t.exports=function(t,e,r){var f;f=t.padding?t.padding:r?1:4;var d,h=n(t),g=h.modulus.byteLength();if(e.length>g||new a(e).cmp(h.modulus)>=0)throw new Error("decryption error");d=r?c(new a(e),h):s(e,h);var p=l.alloc(g-d.length);if(d=l.concat([p,d],g),4===f)return function(t,e){var r=t.modulus.byteLength(),n=u("sha1").update(l.alloc(0)).digest(),a=n.length;if(0!==e[0])throw new Error("decryption error");var s=e.slice(1,a+1),c=e.slice(a+1),f=o(s,i(c,a)),d=o(c,i(f,r-a-1));if(function(t,e){t=l.from(t),e=l.from(e);var r=0,n=t.length;t.length!==e.length&&(r++,n=Math.min(t.length,e.length));var i=-1;for(;++i<n;)r+=t[i]^e[i];return r}(n,d.slice(0,a)))throw new Error("decryption error");var h=a;for(;0===d[h];)h++;if(1!==d[h++])throw new Error("decryption error");return d.slice(h)}(h,d);if(1===f)return function(t,e,r){var n=e.slice(0,2),i=2,o=0;for(;0!==e[i++];)if(i>=e.length){o++;break}var a=e.slice(2,i-1);("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&o++;a.length<8&&o++;if(o)throw new Error("decryption error");return e.slice(i)}(0,d,r);if(3===f)return d;throw new Error("unknown padding")}},function(t,e,r){"use strict";(function(t,n){function i(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var o=r(17),a=r(82),s=o.Buffer,u=o.kMaxLength,c=t.crypto||t.msCrypto,l=Math.pow(2,32)-1;function f(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>l||t<0)throw new TypeError("offset must be a uint32");if(t>u||t>e)throw new RangeError("offset out of range")}function d(t,e,r){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>l||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>u)throw new RangeError("buffer too small")}function h(t,e,r,i){if(n.browser){var o=t.buffer,s=new Uint8Array(o,e,r);return c.getRandomValues(s),i?void n.nextTick((function(){i(null,t)})):t}if(!i)return a(r).copy(t,e),t;a(r,(function(r,n){if(r)return i(r);n.copy(t,e),i(null,t)}))}c&&c.getRandomValues||!n.browser?(e.randomFill=function(e,r,n,i){if(!(s.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof r)i=r,r=0,n=e.length;else if("function"==typeof n)i=n,n=e.length-r;else if("function"!=typeof i)throw new TypeError('"cb" argument must be a function');return f(r,e.length),d(n,r,e.length),h(e,r,n,i)},e.randomFillSync=function(e,r,n){void 0===r&&(r=0);if(!(s.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');f(r,e.length),void 0===n&&(n=e.length-r);return d(n,r,e.length),h(e,r,n)}):(e.randomFill=i,e.randomFillSync=i)}).call(this,r(24),r(20))},function(t,e,r){(function(e,n){const i=r(66),o=r(50);let a,s=o.join(e,"..","..","..","..");n.match("bundle")&&(s=o.join(e,"..")),t.exports={init:()=>{},getDataDir:()=>"/",_setDocumentDir:t=>a=t,getDocumentDir:()=>{if(!a)throw new Error("Document directory is not set");return a},getBudgetDir:e=>{if(!e)throw new Error("getDocumentDir: id is falsy: "+e);if(e.match(/[^A-Za-z0-9\-_]/))throw new Error(`Invalid budget id "${e}". Check the id of your budget in the "Advanced" section of the settings page.`);return o.join(t.exports.getDocumentDir(),e)},bundledDatabasePath:o.join(s,"default-db.sqlite"),migrationsPath:o.join(s,"migrations"),demoBudgetPath:o.join(s,"demo-budget"),join:o.join,basename:t=>o.basename(t),listDir:t=>new Promise((e,r)=>{i.readdir(t,(t,n)=>{t?r(t):e(n)})}),exists:t=>new Promise(e=>{i.access(t,i.constants.F_OK,t=>e(!t))}),mkdir:t=>new Promise((e,r)=>{i.mkdir(t,t=>{t?r(t):e()})}),size:t=>new Promise((e,r)=>{i.stat(t,(t,n)=>{t?r(t):e(n.size)})}),copyFile:(t,e)=>new Promise((r,n)=>{const o=i.createReadStream(t),a=i.createWriteStream(e);o.on("error",n),a.on("error",n),a.on("open",()=>o.pipe(a)),a.once("close",r)}),readFile:(t,e="utf8")=>("binary"===e&&(e=null),new Promise((r,n)=>{i.readFile(t,e,(t,e)=>{t?n(t):r(e)})})),writeFile:(t,e)=>new Promise((function(r,n){i.writeFile(t,e,"utf8",(function(t,e){return t?n(t):r()}))})),removeFile:t=>new Promise((function(e,r){i.unlink(t,t=>t?r(t):e())})),removeDir:t=>new Promise((function(e,r){i.rmdir(t,t=>t?r(t):e())})),removeDirRecursively:async e=>{const r=t.exports;if(await r.exists(e)){for(let t of await r.listDir(e)){const n=r.join(e,t);i.statSync(n).isDirectory()?await r.removeDirRecursively(n):await r.removeFile(n)}await r.removeDir(e)}},getModifiedTime:t=>new Promise((function(e,r){i.stat(t,(t,n)=>{t?r(t):e(new Date(n.mtime))})}))}}).call(this,"/","/index.js")},function(t,e){t.exports=function(...t){if(0===t.length)return".";let e;for(var r=0;r<t.length;++r){var n=t[r];n.length>0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":function(t){if(0===t.length)return".";var e=47===t.charCodeAt(0),r=47===t.charCodeAt(t.length-1);return 0!==(t=function(t,e){for(var r,n="",i=0,o=-1,a=0,s=0;s<=t.length;++s){if(s<t.length)r=t.charCodeAt(s);else{if(47===r)break;r=47}if(47===r){if(o===s-1||1===a);else if(o!==s-1&&2===a){if(n.length<2||2!==i||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var u=n.lastIndexOf("/");if(u!==n.length-1){-1===u?(n="",i=0):i=(n=n.slice(0,u)).length-1-n.lastIndexOf("/"),o=s,a=0;continue}}else if(2===n.length||1===n.length){n="",i=0,o=s,a=0;continue}e&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+t.slice(o+1,s):n=t.slice(o+1,s),i=s-o-1;o=s,a=0}else 46===r&&-1!==a?++a:a=-1}return n}(t,!e)).length||e||(t="."),t.length>0&&r&&(t+="/"),e?"/"+t:t}(e)}},function(t,e){t.exports=function(t){var e={addNode:i,removeNode:function(t){o(t),r.delete(t),n.delete(t)},adjacent:a,adjacentIncoming:s,addEdge:function(t,r){return i(t),i(r),a(t).add(r),s(r).add(t),e},removeEdge:u,removeIncomingEdges:o,topologicalSort:function(t){const e=new Set,r=[];return t.forEach(t=>{e.has(t)||function t(e,r,n){r.add(e);let i=a(e).values(),o=i.next();for(;!o.done;)r.has(o.value)||t(o.value,r,n),o=i.next();n.unshift(e)}(t,e,r)}),r},generateDOT:function(){let t=[];return r.forEach((function(e,r){0!==e.length&&t.push(`${r} -> {${e.join(",")}}`)})),`\n digraph G {\n ${t.join("\n").replace(/!/g,"_")}\n }\n `},getEdges:function(){return{edges:r,incomingEdges:n}}},r=new Map,n=new Map;function i(t){return r.set(t,a(t)),n.set(t,s(t)),e}function o(t){const e=s(t);n.set(t,new Set);let r=e.values(),i=r.next();for(;!i.done;)u(i.value,t),i=r.next()}function a(t){return r.get(t)||new Set}function s(t){return n.get(t)||new Set}function u(t,i){return r.has(t)&&a(t).delete(i),n.has(i)&&s(i).delete(t),e}return e}},function(t,e,r){const n=r(80);t.exports={v4:function(){return Promise.resolve(n.v4())},v4Sync:function(){return n.v4()}}},function(module,exports,__webpack_require__){(function(global,Buffer){var $jscomp=$jscomp||{};$jscomp.scope={},$jscomp.findInternal=function(t,e,r){t instanceof String&&(t=String(t));for(var n=t.length,i=0;i<n;i++){var o=t[i];if(e.call(r,o,i,t))return{i:i,v:o}}return{i:-1,v:void 0}},$jscomp.ASSUME_ES5=!1,$jscomp.ASSUME_NO_NATIVE_MAP=!1,$jscomp.ASSUME_NO_NATIVE_SET=!1,$jscomp.SIMPLE_FROUND_POLYFILL=!1,$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,r){t!=Array.prototype&&t!=Object.prototype&&(t[e]=r.value)},$jscomp.getGlobal=function(t){return"undefined"!=typeof window&&window===t?t:void 0!==global&&null!=global?global:t},$jscomp.global=$jscomp.getGlobal(this),$jscomp.polyfill=function(t,e,r,n){if(e){for(r=$jscomp.global,t=t.split("."),n=0;n<t.length-1;n++){var i=t[n];i in r||(r[i]={}),r=r[i]}(e=e(n=r[t=t[t.length-1]]))!=n&&null!=e&&$jscomp.defineProperty(r,t,{configurable:!0,writable:!0,value:e})}},$jscomp.polyfill("Array.prototype.findIndex",(function(t){return t||function(t,e){return $jscomp.findInternal(this,t,e).i}}),"es6","es3"),$jscomp.checkStringArgs=function(t,e,r){if(null==t)throw new TypeError("The 'this' value for String.prototype."+r+" must not be null or undefined");if(e instanceof RegExp)throw new TypeError("First argument to String.prototype."+r+" must not be a regular expression");return t+""},$jscomp.polyfill("String.prototype.endsWith",(function(t){return t||function(t,e){var r=$jscomp.checkStringArgs(this,t,"endsWith");t+="",void 0===e&&(e=r.length),e=Math.max(0,Math.min(0|e,r.length));for(var n=t.length;0<n&&0<e;)if(r[--e]!=t[--n])return!1;return 0>=n}}),"es6","es3"),$jscomp.polyfill("Array.prototype.find",(function(t){return t||function(t,e){return $jscomp.findInternal(this,t,e).v}}),"es6","es3"),$jscomp.polyfill("String.prototype.startsWith",(function(t){return t||function(t,e){var r=$jscomp.checkStringArgs(this,t,"startsWith");t+="";var n=r.length,i=t.length;e=Math.max(0,Math.min(0|e,r.length));for(var o=0;o<i&&e<n;)if(r[e++]!=t[o++])return!1;return o>=i}}),"es6","es3"),$jscomp.polyfill("String.prototype.repeat",(function(t){return t||function(t){var e=$jscomp.checkStringArgs(this,null,"repeat");if(0>t||1342177279<t)throw new RangeError("Invalid count value");t|=0;for(var r="";t;)1&t&&(r+=e),(t>>>=1)&&(e+=e);return r}}),"es6","es3");var COMPILED=!0,goog=goog||{};goog.global=this||self,goog.isDef=function(t){return void 0!==t},goog.isString=function(t){return"string"==typeof t},goog.isBoolean=function(t){return"boolean"==typeof t},goog.isNumber=function(t){return"number"==typeof t},goog.exportPath_=function(t,e,r){t=t.split("."),r=r||goog.global,t[0]in r||void 0===r.execScript||r.execScript("var "+t[0]);for(var n;t.length&&(n=t.shift());)!t.length&&goog.isDef(e)?r[n]=e:r=r[n]&&r[n]!==Object.prototype[n]?r[n]:r[n]={}},goog.define=function(t,e){if(!COMPILED){var r=goog.global.CLOSURE_UNCOMPILED_DEFINES,n=goog.global.CLOSURE_DEFINES;r&&void 0===r.nodeType&&Object.prototype.hasOwnProperty.call(r,t)?e=r[t]:n&&void 0===n.nodeType&&Object.prototype.hasOwnProperty.call(n,t)&&(e=n[t])}return e},goog.FEATURESET_YEAR=2012,goog.DEBUG=!0,goog.LOCALE="en",goog.TRUSTED_SITE=!0,goog.STRICT_MODE_COMPATIBLE=!1,goog.DISALLOW_TEST_ONLY_CODE=COMPILED&&!goog.DEBUG,goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING=!1,goog.provide=function(t){if(goog.isInModuleLoader_())throw Error("goog.provide cannot be used within a module.");if(!COMPILED&&goog.isProvided_(t))throw Error('Namespace "'+t+'" already declared.');goog.constructNamespace_(t)},goog.constructNamespace_=function(t,e){if(!COMPILED){delete goog.implicitNamespaces_[t];for(var r=t;(r=r.substring(0,r.lastIndexOf(".")))&&!goog.getObjectByName(r);)goog.implicitNamespaces_[r]=!0}goog.exportPath_(t,e)},goog.getScriptNonce=function(t){return t&&t!=goog.global?goog.getScriptNonce_(t.document):(null===goog.cspNonce_&&(goog.cspNonce_=goog.getScriptNonce_(goog.global.document)),goog.cspNonce_)},goog.NONCE_PATTERN_=/^[\w+/_-]+[=]{0,2}$/,goog.cspNonce_=null,goog.getScriptNonce_=function(t){return(t=t.querySelector&&t.querySelector("script[nonce]"))&&(t=t.nonce||t.getAttribute("nonce"))&&goog.NONCE_PATTERN_.test(t)?t:""},goog.VALID_MODULE_RE_=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/,goog.module=function(t){if(!goog.isString(t)||!t||-1==t.search(goog.VALID_MODULE_RE_))throw Error("Invalid module identifier");if(!goog.isInGoogModuleLoader_())throw Error("Module "+t+" has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.");if(goog.moduleLoaderState_.moduleName)throw Error("goog.module may only be called once per module.");if(goog.moduleLoaderState_.moduleName=t,!COMPILED){if(goog.isProvided_(t))throw Error('Namespace "'+t+'" already declared.');delete goog.implicitNamespaces_[t]}},goog.module.get=function(t){return goog.module.getInternal_(t)},goog.module.getInternal_=function(t){if(!COMPILED){if(t in goog.loadedModules_)return goog.loadedModules_[t].exports;if(!goog.implicitNamespaces_[t])return null!=(t=goog.getObjectByName(t))?t:null}return null},goog.ModuleType={ES6:"es6",GOOG:"goog"},goog.moduleLoaderState_=null,goog.isInModuleLoader_=function(){return goog.isInGoogModuleLoader_()||goog.isInEs6ModuleLoader_()},goog.isInGoogModuleLoader_=function(){return!!goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.GOOG},goog.isInEs6ModuleLoader_=function(){if(goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.ES6)return!0;var t=goog.global.$jscomp;return!!t&&("function"==typeof t.getCurrentModulePath&&!!t.getCurrentModulePath())},goog.module.declareLegacyNamespace=function(){if(!COMPILED&&!goog.isInGoogModuleLoader_())throw Error("goog.module.declareLegacyNamespace must be called from within a goog.module");if(!COMPILED&&!goog.moduleLoaderState_.moduleName)throw Error("goog.module must be called prior to goog.module.declareLegacyNamespace.");goog.moduleLoaderState_.declareLegacyNamespace=!0},goog.declareModuleId=function(t){if(!COMPILED){if(!goog.isInEs6ModuleLoader_())throw Error("goog.declareModuleId may only be called from within an ES6 module");if(goog.moduleLoaderState_&&goog.moduleLoaderState_.moduleName)throw Error("goog.declareModuleId may only be called once per module.");if(t in goog.loadedModules_)throw Error('Module with namespace "'+t+'" already exists.')}if(goog.moduleLoaderState_)goog.moduleLoaderState_.moduleName=t;else{var e=goog.global.$jscomp;if(!e||"function"!=typeof e.getCurrentModulePath)throw Error('Module with namespace "'+t+'" has been loaded incorrectly.');e=e.require(e.getCurrentModulePath()),goog.loadedModules_[t]={exports:e,type:goog.ModuleType.ES6,moduleId:t}}},goog.setTestOnly=function(t){if(goog.DISALLOW_TEST_ONLY_CODE)throw t=t||"",Error("Importing test-only code into non-debug environment"+(t?": "+t:"."))},goog.forwardDeclare=function(t){},COMPILED||(goog.isProvided_=function(t){return t in goog.loadedModules_||!goog.implicitNamespaces_[t]&&goog.isDefAndNotNull(goog.getObjectByName(t))},goog.implicitNamespaces_={"goog.module":!0}),goog.getObjectByName=function(t,e){t=t.split("."),e=e||goog.global;for(var r=0;r<t.length;r++)if(e=e[t[r]],!goog.isDefAndNotNull(e))return null;return e},goog.globalize=function(t,e){for(var r in e=e||goog.global,t)e[r]=t[r]},goog.addDependency=function(t,e,r,n){!COMPILED&&goog.DEPENDENCIES_ENABLED&&goog.debugLoader_.addDependency(t,e,r,n)},goog.ENABLE_DEBUG_LOADER=!0,goog.logToConsole_=function(t){goog.global.console&&goog.global.console.error(t)},goog.require=function(t){if(!COMPILED){if(goog.ENABLE_DEBUG_LOADER&&goog.debugLoader_.requested(t),goog.isProvided_(t)){if(goog.isInModuleLoader_())return goog.module.getInternal_(t)}else if(goog.ENABLE_DEBUG_LOADER){var e=goog.moduleLoaderState_;goog.moduleLoaderState_=null;try{goog.debugLoader_.load_(t)}finally{goog.moduleLoaderState_=e}}return null}},goog.requireType=function(t){return{}},goog.basePath="",goog.nullFunction=function(){},goog.abstractMethod=function(){throw Error("unimplemented abstract method")},goog.addSingletonGetter=function(t){t.instance_=void 0,t.getInstance=function(){return t.instance_?t.instance_:(goog.DEBUG&&(goog.instantiatedSingletons_[goog.instantiatedSingletons_.length]=t),t.instance_=new t)}},goog.instantiatedSingletons_=[],goog.LOAD_MODULE_USING_EVAL=!0,goog.SEAL_MODULE_EXPORTS=goog.DEBUG,goog.loadedModules_={},goog.DEPENDENCIES_ENABLED=!COMPILED&&goog.ENABLE_DEBUG_LOADER,goog.TRANSPILE="detect",goog.ASSUME_ES_MODULES_TRANSPILED=!1,goog.TRANSPILE_TO_LANGUAGE="",goog.TRANSPILER="transpile.js",goog.hasBadLetScoping=null,goog.useSafari10Workaround=function(){if(null==goog.hasBadLetScoping){try{var a=!eval('"use strict";let x = 1; function f() { return typeof x; };f() == "number";')}catch(t){a=!1}goog.hasBadLetScoping=a}return goog.hasBadLetScoping},goog.workaroundSafari10EvalBug=function(t){return"(function(){"+t+"\n;})();\n"},goog.loadModule=function(t){var e=goog.moduleLoaderState_;try{if(goog.moduleLoaderState_={moduleName:"",declareLegacyNamespace:!1,type:goog.ModuleType.GOOG},goog.isFunction(t))var r=t.call(void 0,{});else{if(!goog.isString(t))throw Error("Invalid module definition");goog.useSafari10Workaround()&&(t=goog.workaroundSafari10EvalBug(t)),r=goog.loadModuleFromSource_.call(void 0,t)}var n=goog.moduleLoaderState_.moduleName;if(!goog.isString(n)||!n)throw Error('Invalid module name "'+n+'"');goog.moduleLoaderState_.declareLegacyNamespace?goog.constructNamespace_(n,r):goog.SEAL_MODULE_EXPORTS&&Object.seal&&"object"==typeof r&&null!=r&&Object.seal(r),goog.loadedModules_[n]={exports:r,type:goog.ModuleType.GOOG,moduleId:goog.moduleLoaderState_.moduleName}}finally{goog.moduleLoaderState_=e}},goog.loadModuleFromSource_=function(a){return eval(a),{}},goog.normalizePath_=function(t){t=t.split("/");for(var e=0;e<t.length;)"."==t[e]?t.splice(e,1):e&&".."==t[e]&&t[e-1]&&".."!=t[e-1]?t.splice(--e,2):e++;return t.join("/")},goog.loadFileSync_=function(t){if(goog.global.CLOSURE_LOAD_FILE_SYNC)return goog.global.CLOSURE_LOAD_FILE_SYNC(t);try{var e=new goog.global.XMLHttpRequest;return e.open("get",t,!1),e.send(),0==e.status||200==e.status?e.responseText:null}catch(t){return null}},goog.transpile_=function(t,e,r){var n=goog.global.$jscomp;n||(goog.global.$jscomp=n={});var i=n.transpile;if(!i){var o=goog.basePath+goog.TRANSPILER,a=goog.loadFileSync_(o);if(a){if(function(){(0,eval)(a+"\n//# sourceURL="+o)}.call(goog.global),goog.global.$gwtExport&&goog.global.$gwtExport.$jscomp&&!goog.global.$gwtExport.$jscomp.transpile)throw Error('The transpiler did not properly export the "transpile" method. $gwtExport: '+JSON.stringify(goog.global.$gwtExport));goog.global.$jscomp.transpile=goog.global.$gwtExport.$jscomp.transpile,i=(n=goog.global.$jscomp).transpile}}return i||(i=n.transpile=function(t,e){return goog.logToConsole_(e+" requires transpilation but no transpiler was found."),t}),i(t,e,r)},goog.typeOf=function(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var r=Object.prototype.toString.call(t);if("[object Window]"==r)return"object";if("[object Array]"==r||"number"==typeof t.length&&void 0!==t.splice&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==r||void 0!==t.call&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&void 0===t.call)return"object";return e},goog.isNull=function(t){return null===t},goog.isDefAndNotNull=function(t){return null!=t},goog.isArray=function(t){return"array"==goog.typeOf(t)},goog.isArrayLike=function(t){var e=goog.typeOf(t);return"array"==e||"object"==e&&"number"==typeof t.length},goog.isDateLike=function(t){return goog.isObject(t)&&"function"==typeof t.getFullYear},goog.isFunction=function(t){return"function"==goog.typeOf(t)},goog.isObject=function(t){var e=typeof t;return"object"==e&&null!=t||"function"==e},goog.getUid=function(t){return t[goog.UID_PROPERTY_]||(t[goog.UID_PROPERTY_]=++goog.uidCounter_)},goog.hasUid=function(t){return!!t[goog.UID_PROPERTY_]},goog.removeUid=function(t){null!==t&&"removeAttribute"in t&&t.removeAttribute(goog.UID_PROPERTY_);try{delete t[goog.UID_PROPERTY_]}catch(t){}},goog.UID_PROPERTY_="closure_uid_"+(1e9*Math.random()>>>0),goog.uidCounter_=0,goog.getHashCode=goog.getUid,goog.removeHashCode=goog.removeUid,goog.cloneObject=function(t){var e=goog.typeOf(t);if("object"==e||"array"==e){if("function"==typeof t.clone)return t.clone();for(var r in e="array"==e?[]:{},t)e[r]=goog.cloneObject(t[r]);return e}return t},goog.bindNative_=function(t,e,r){return t.call.apply(t.bind,arguments)},goog.bindJs_=function(t,e,r){if(!t)throw Error();if(2<arguments.length){var n=Array.prototype.slice.call(arguments,2);return function(){var r=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(r,n),t.apply(e,r)}}return function(){return t.apply(e,arguments)}},goog.bind=function(t,e,r){return Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?goog.bind=goog.bindNative_:goog.bind=goog.bindJs_,goog.bind.apply(null,arguments)},goog.partial=function(t,e){var r=Array.prototype.slice.call(arguments,1);return function(){var e=r.slice();return e.push.apply(e,arguments),t.apply(this,e)}},goog.mixin=function(t,e){for(var r in e)t[r]=e[r]},goog.now=goog.TRUSTED_SITE&&Date.now||function(){return+new Date},goog.globalEval=function(t){if(goog.global.execScript)goog.global.execScript(t,"JavaScript");else{if(!goog.global.eval)throw Error("goog.globalEval not available");if(null==goog.evalWorksForGlobals_){try{goog.global.eval("var _evalTest_ = 1;")}catch(t){}if(void 0!==goog.global._evalTest_){try{delete goog.global._evalTest_}catch(t){}goog.evalWorksForGlobals_=!0}else goog.evalWorksForGlobals_=!1}if(goog.evalWorksForGlobals_)goog.global.eval(t);else{var e=goog.global.document,r=e.createElement("SCRIPT");r.type="text/javascript",r.defer=!1,r.appendChild(e.createTextNode(t)),e.head.appendChild(r),e.head.removeChild(r)}}},goog.evalWorksForGlobals_=null,goog.getCssName=function(t,e){if("."==String(t).charAt(0))throw Error('className passed in goog.getCssName must not start with ".". You passed: '+t);var r=function(t){return goog.cssNameMapping_[t]||t},n=function(t){t=t.split("-");for(var e=[],n=0;n<t.length;n++)e.push(r(t[n]));return e.join("-")};return n=goog.cssNameMapping_?"BY_WHOLE"==goog.cssNameMappingStyle_?r:n:function(t){return t},t=e?t+"-"+n(e):n(t),goog.global.CLOSURE_CSS_NAME_MAP_FN?goog.global.CLOSURE_CSS_NAME_MAP_FN(t):t},goog.setCssNameMapping=function(t,e){goog.cssNameMapping_=t,goog.cssNameMappingStyle_=e},!COMPILED&&goog.global.CLOSURE_CSS_NAME_MAPPING&&(goog.cssNameMapping_=goog.global.CLOSURE_CSS_NAME_MAPPING),goog.getMsg=function(t,e,r){return r&&r.html&&(t=t.replace(/</g,"&lt;")),e&&(t=t.replace(/\{\$([^}]+)}/g,(function(t,r){return null!=e&&r in e?e[r]:t}))),t},goog.getMsgWithFallback=function(t,e){return t},goog.exportSymbol=function(t,e,r){goog.exportPath_(t,e,r)},goog.exportProperty=function(t,e,r){t[e]=r},goog.inherits=function(t,e){function r(){}r.prototype=e.prototype,t.superClass_=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.base=function(t,r,n){for(var i=Array(arguments.length-2),o=2;o<arguments.length;o++)i[o-2]=arguments[o];return e.prototype[r].apply(t,i)}},goog.base=function(t,e,r){var n=arguments.callee.caller;if(goog.STRICT_MODE_COMPATIBLE||goog.DEBUG&&!n)throw Error("arguments.caller not defined. goog.base() cannot be used with strict mode code. See http://www.ecma-international.org/ecma-262/5.1/#sec-C");if(void 0!==n.superClass_){for(var i=Array(arguments.length-1),o=1;o<arguments.length;o++)i[o-1]=arguments[o];return n.superClass_.constructor.apply(t,i)}if("string"!=typeof e&&"symbol"!=typeof e)throw Error("method names provided to goog.base must be a string or a symbol");for(i=Array(arguments.length-2),o=2;o<arguments.length;o++)i[o-2]=arguments[o];o=!1;for(var a=t.constructor.prototype;a;a=Object.getPrototypeOf(a))if(a[e]===n)o=!0;else if(o)return a[e].apply(t,i);if(t[e]===n)return t.constructor.prototype[e].apply(t,i);throw Error("goog.base called from a method of one name to a method of a different name")},goog.scope=function(t){if(goog.isInModuleLoader_())throw Error("goog.scope is not supported within a module.");t.call(goog.global)},COMPILED||(goog.global.COMPILED=COMPILED),goog.defineClass=function(t,e){var r=e.constructor,n=e.statics;return r&&r!=Object.prototype.constructor||(r=function(){throw Error("cannot instantiate an interface (no constructor defined).")}),r=goog.defineClass.createSealingConstructor_(r,t),t&&goog.inherits(r,t),delete e.constructor,delete e.statics,goog.defineClass.applyProperties_(r.prototype,e),null!=n&&(n instanceof Function?n(r):goog.defineClass.applyProperties_(r,n)),r},goog.defineClass.SEAL_CLASS_INSTANCES=goog.DEBUG,goog.defineClass.createSealingConstructor_=function(t,e){if(!goog.defineClass.SEAL_CLASS_INSTANCES)return t;var r=!goog.defineClass.isUnsealable_(e),n=function(){var e=t.apply(this,arguments)||this;return e[goog.UID_PROPERTY_]=e[goog.UID_PROPERTY_],this.constructor===n&&r&&Object.seal instanceof Function&&Object.seal(e),e};return n},goog.defineClass.isUnsealable_=function(t){return t&&t.prototype&&t.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]},goog.defineClass.OBJECT_PROTOTYPE_FIELDS_="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),goog.defineClass.applyProperties_=function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);for(var n=0;n<goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length;n++)r=goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[n],Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},goog.tagUnsealableClass=function(t){!COMPILED&&goog.defineClass.SEAL_CLASS_INSTANCES&&(t.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]=!0)},goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_="goog_defineClass_legacy_unsealable",!COMPILED&&goog.DEPENDENCIES_ENABLED&&(goog.inHtmlDocument_=function(){var t=goog.global.document;return null!=t&&"write"in t},goog.isDocumentLoading_=function(){var t=goog.global.document;return t.attachEvent?"complete"!=t.readyState:"loading"==t.readyState},goog.findBasePath_=function(){if(goog.isDef(goog.global.CLOSURE_BASE_PATH)&&goog.isString(goog.global.CLOSURE_BASE_PATH))goog.basePath=goog.global.CLOSURE_BASE_PATH;else if(goog.inHtmlDocument_()){var t=goog.global.document,e=t.currentScript;for(e=(t=e?[e]:t.getElementsByTagName("SCRIPT")).length-1;0<=e;--e){var r=t[e].src,n=r.lastIndexOf("?");if(n=-1==n?r.length:n,"base.js"==r.substr(n-7,7)){goog.basePath=r.substr(0,n-7);break}}}},goog.findBasePath_(),goog.Transpiler=function(){this.requiresTranspilation_=null,this.transpilationTarget_=goog.TRANSPILE_TO_LANGUAGE},goog.Transpiler.prototype.createRequiresTranspilation_=function(){function a(t,r){e?d[t]=!0:r()?(c=t,d[t]=!1):e=d[t]=!0}function b(a){try{return!!eval(a)}catch(t){return!1}}var c="es3",d={es3:!1},e=!1,f=goog.global.navigator&&goog.global.navigator.userAgent?goog.global.navigator.userAgent:"";return a("es5",(function(){return b("[1,].length==1")})),a("es6",(function(){return!f.match(/Edge\/(\d+)(\.\d)*/i)&&b('(()=>{"use strict";class X{constructor(){if(new.target!=String)throw 1;this.x=42}}let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof String))throw 1;for(const a of[2,3]){if(a==2)continue;function f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()==3}})()')})),a("es7",(function(){return b("2 ** 2 == 4")})),a("es8",(function(){return b("async () => 1, true")})),a("es9",(function(){return b("({...rest} = {}), true")})),a("es_next",(function(){return!1})),{target:c,map:d}},goog.Transpiler.prototype.needsTranspile=function(t,e){if("always"==goog.TRANSPILE)return!0;if("never"==goog.TRANSPILE)return!1;if(!this.requiresTranspilation_){var r=this.createRequiresTranspilation_();this.requiresTranspilation_=r.map,this.transpilationTarget_=this.transpilationTarget_||r.target}if(t in this.requiresTranspilation_)return!!this.requiresTranspilation_[t]||!(!goog.inHtmlDocument_()||"es6"!=e||"noModule"in goog.global.document.createElement("script"));throw Error("Unknown language mode: "+t)},goog.Transpiler.prototype.transpile=function(t,e){return goog.transpile_(t,e,this.transpilationTarget_)},goog.transpiler_=new goog.Transpiler,goog.protectScriptTag_=function(t){return t.replace(/<\/(SCRIPT)/gi,"\\x3c/$1")},goog.DebugLoader_=function(){this.dependencies_={},this.idToPath_={},this.written_={},this.loadingDeps_=[],this.depsToLoad_=[],this.paused_=!1,this.factory_=new goog.DependencyFactory(goog.transpiler_),this.deferredCallbacks_={},this.deferredQueue_=[]},goog.DebugLoader_.prototype.bootstrap=function(t,e){function r(){n&&(goog.global.setTimeout(n,0),n=null)}var n=e;if(t.length){e=[];for(var i=0;i<t.length;i++){var o=this.getPathFromDeps_(t[i]);if(!o)throw Error("Unregonized namespace: "+t[i]);e.push(this.dependencies_[o])}o=goog.require;var a=0;for(i=0;i<t.length;i++)o(t[i]),e[i].onLoad((function(){++a==t.length&&r()}))}else r()},goog.DebugLoader_.prototype.loadClosureDeps=function(){this.depsToLoad_.push(this.factory_.createDependency(goog.normalizePath_(goog.basePath+"deps.js"),"deps.js",[],[],{},!1)),this.loadDeps_()},goog.DebugLoader_.prototype.requested=function(t,e){(t=this.getPathFromDeps_(t))&&(e||this.areDepsLoaded_(this.dependencies_[t].requires))&&(e=this.deferredCallbacks_[t])&&(delete this.deferredCallbacks_[t],e())},goog.DebugLoader_.prototype.setDependencyFactory=function(t){this.factory_=t},goog.DebugLoader_.prototype.load_=function(t){if(!this.getPathFromDeps_(t))throw t="goog.require could not find: "+t,goog.logToConsole_(t),Error(t);var e=this,r=[],n=function(t){var i=e.getPathFromDeps_(t);if(!i)throw Error("Bad dependency path or symbol: "+t);if(!e.written_[i]){for(e.written_[i]=!0,t=e.dependencies_[i],i=0;i<t.requires.length;i++)goog.isProvided_(t.requires[i])||n(t.requires[i]);r.push(t)}};n(t),t=!!this.depsToLoad_.length,this.depsToLoad_=this.depsToLoad_.concat(r),this.paused_||t||this.loadDeps_()},goog.DebugLoader_.prototype.loadDeps_=function(){for(var t=this,e=this.paused_;this.depsToLoad_.length&&!e;)!function(){var r=!1,n=t.depsToLoad_.shift(),i=!1;t.loading_(n);var o={pause:function(){if(r)throw Error("Cannot call pause after the call to load.");e=!0},resume:function(){r?t.resume_():e=!1},loaded:function(){if(i)throw Error("Double call to loaded.");i=!0,t.loaded_(n)},pending:function(){for(var e=[],r=0;r<t.loadingDeps_.length;r++)e.push(t.loadingDeps_[r]);return e},setModuleState:function(t){goog.moduleLoaderState_={type:t,moduleName:"",declareLegacyNamespace:!1}},registerEs6ModuleExports:function(t,e,r){r&&(goog.loadedModules_[r]={exports:e,type:goog.ModuleType.ES6,moduleId:r||""})},registerGoogModuleExports:function(t,e){goog.loadedModules_[t]={exports:e,type:goog.ModuleType.GOOG,moduleId:t}},clearModuleState:function(){goog.moduleLoaderState_=null},defer:function(e){if(r)throw Error("Cannot register with defer after the call to load.");t.defer_(n,e)},areDepsLoaded:function(){return t.areDepsLoaded_(n.requires)}};try{n.load(o)}finally{r=!0}}();e&&this.pause_()},goog.DebugLoader_.prototype.pause_=function(){this.paused_=!0},goog.DebugLoader_.prototype.resume_=function(){this.paused_&&(this.paused_=!1,this.loadDeps_())},goog.DebugLoader_.prototype.loading_=function(t){this.loadingDeps_.push(t)},goog.DebugLoader_.prototype.loaded_=function(t){for(var e=0;e<this.loadingDeps_.length;e++)if(this.loadingDeps_[e]==t){this.loadingDeps_.splice(e,1);break}for(e=0;e<this.deferredQueue_.length;e++)if(this.deferredQueue_[e]==t.path){this.deferredQueue_.splice(e,1);break}if(this.loadingDeps_.length==this.deferredQueue_.length&&!this.depsToLoad_.length)for(;this.deferredQueue_.length;)this.requested(this.deferredQueue_.shift(),!0);t.loaded()},goog.DebugLoader_.prototype.areDepsLoaded_=function(t){for(var e=0;e<t.length;e++){var r=this.getPathFromDeps_(t[e]);if(!r||!(r in this.deferredCallbacks_)&&!goog.isProvided_(t[e]))return!1}return!0},goog.DebugLoader_.prototype.getPathFromDeps_=function(t){return t in this.idToPath_?this.idToPath_[t]:t in this.dependencies_?t:null},goog.DebugLoader_.prototype.defer_=function(t,e){this.deferredCallbacks_[t.path]=e,this.deferredQueue_.push(t.path)},goog.LoadController=function(){},goog.LoadController.prototype.pause=function(){},goog.LoadController.prototype.resume=function(){},goog.LoadController.prototype.loaded=function(){},goog.LoadController.prototype.pending=function(){},goog.LoadController.prototype.registerEs6ModuleExports=function(t,e,r){},goog.LoadController.prototype.setModuleState=function(t){},goog.LoadController.prototype.clearModuleState=function(){},goog.LoadController.prototype.defer=function(t){},goog.LoadController.prototype.areDepsLoaded=function(){},goog.Dependency=function(t,e,r,n,i){this.path=t,this.relativePath=e,this.provides=r,this.requires=n,this.loadFlags=i,this.loaded_=!1,this.loadCallbacks_=[]},goog.Dependency.prototype.getPathName=function(){var t=this.path,e=t.indexOf("://");return 0<=e&&(0<=(e=(t=t.substring(e+3)).indexOf("/"))&&(t=t.substring(e+1))),t},goog.Dependency.prototype.onLoad=function(t){this.loaded_?t():this.loadCallbacks_.push(t)},goog.Dependency.prototype.loaded=function(){this.loaded_=!0;var t=this.loadCallbacks_;this.loadCallbacks_=[];for(var e=0;e<t.length;e++)t[e]()},goog.Dependency.defer_=!1,goog.Dependency.callbackMap_={},goog.Dependency.registerCallback_=function(t){var e=Math.random().toString(32);return goog.Dependency.callbackMap_[e]=t,e},goog.Dependency.unregisterCallback_=function(t){delete goog.Dependency.callbackMap_[t]},goog.Dependency.callback_=function(t,e){if(!(t in goog.Dependency.callbackMap_))throw Error("Callback key "+t+" does not exist (was base.js loaded more than once?).");for(var r=goog.Dependency.callbackMap_[t],n=[],i=1;i<arguments.length;i++)n.push(arguments[i]);r.apply(void 0,n)},goog.Dependency.prototype.load=function(t){if(goog.global.CLOSURE_IMPORT_SCRIPT)goog.global.CLOSURE_IMPORT_SCRIPT(this.path)?t.loaded():t.pause();else if(goog.inHtmlDocument_()){var e=goog.global.document;if("complete"==e.readyState&&!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING){if(/\bdeps.js$/.test(this.path))return void t.loaded();throw Error('Cannot write "'+this.path+'" after document load')}if(!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING&&goog.isDocumentLoading_()){var r=goog.Dependency.registerCallback_((function(e){goog.DebugLoader_.IS_OLD_IE_&&"complete"!=e.readyState||(goog.Dependency.unregisterCallback_(r),t.loaded())})),n=!goog.DebugLoader_.IS_OLD_IE_&&goog.getScriptNonce()?' nonce="'+goog.getScriptNonce()+'"':"";n='<script src="'+this.path+'" '+(goog.DebugLoader_.IS_OLD_IE_?"onreadystatechange":"onload")+"=\"goog.Dependency.callback_('"+r+'\', this)" type="text/javascript" '+(goog.Dependency.defer_?"defer":"")+n+"><\/script>",e.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(n):n)}else{var i=e.createElement("script");i.defer=goog.Dependency.defer_,i.async=!1,i.type="text/javascript",(n=goog.getScriptNonce())&&i.setAttribute("nonce",n),goog.DebugLoader_.IS_OLD_IE_?(t.pause(),i.onreadystatechange=function(){"loaded"!=i.readyState&&"complete"!=i.readyState||(t.loaded(),t.resume())}):i.onload=function(){i.onload=null,t.loaded()},i.src=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScriptURL(this.path):this.path,e.head.appendChild(i)}}else goog.logToConsole_("Cannot use default debug loader outside of HTML documents."),"deps.js"==this.relativePath?(goog.logToConsole_("Consider setting CLOSURE_IMPORT_SCRIPT before loading base.js, or setting CLOSURE_NO_DEPS to true."),t.loaded()):t.pause()},goog.Es6ModuleDependency=function(t,e,r,n,i){goog.Dependency.call(this,t,e,r,n,i)},goog.inherits(goog.Es6ModuleDependency,goog.Dependency),goog.Es6ModuleDependency.prototype.load=function(t){if(goog.global.CLOSURE_IMPORT_SCRIPT)goog.global.CLOSURE_IMPORT_SCRIPT(this.path)?t.loaded():t.pause();else if(goog.inHtmlDocument_()){var e=goog.global.document,r=this;if(goog.isDocumentLoading_()){var n=function(t,r){t=r?'<script type="module" crossorigin>'+r+"<\/script>":'<script type="module" crossorigin src="'+t+'"><\/script>',e.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(t):t)};goog.Dependency.defer_=!0}else n=function(t,r){var n=e.createElement("script");n.defer=!0,n.async=!1,n.type="module",n.setAttribute("crossorigin",!0);var i=goog.getScriptNonce();i&&n.setAttribute("nonce",i),r?n.textContent=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScript(r):r:n.src=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScriptURL(t):t,e.head.appendChild(n)};var i=goog.Dependency.registerCallback_((function(){goog.Dependency.unregisterCallback_(i),t.setModuleState(goog.ModuleType.ES6)}));n(void 0,'goog.Dependency.callback_("'+i+'")'),n(this.path,void 0);var o=goog.Dependency.registerCallback_((function(e){goog.Dependency.unregisterCallback_(o),t.registerEs6ModuleExports(r.path,e,goog.moduleLoaderState_.moduleName)}));n(void 0,'import * as m from "'+this.path+'"; goog.Dependency.callback_("'+o+'", m)');var a=goog.Dependency.registerCallback_((function(){goog.Dependency.unregisterCallback_(a),t.clearModuleState(),t.loaded()}));n(void 0,'goog.Dependency.callback_("'+a+'")')}else goog.logToConsole_("Cannot use default debug loader outside of HTML documents."),t.pause()},goog.TransformedDependency=function(t,e,r,n,i){goog.Dependency.call(this,t,e,r,n,i),this.contents_=null,this.lazyFetch_=!goog.inHtmlDocument_()||!("noModule"in goog.global.document.createElement("script"))},goog.inherits(goog.TransformedDependency,goog.Dependency),goog.TransformedDependency.prototype.load=function(t){function e(){n.contents_=goog.loadFileSync_(n.path),n.contents_&&(n.contents_=n.transform(n.contents_),n.contents_&&(n.contents_+="\n//# sourceURL="+n.path))}function r(){if(n.lazyFetch_&&e(),n.contents_){i&&t.setModuleState(goog.ModuleType.ES6);try{var r=n.contents_;if(n.contents_=null,goog.globalEval(r),i)var o=goog.moduleLoaderState_.moduleName}finally{i&&t.clearModuleState()}i&&goog.global.$jscomp.require.ensure([n.getPathName()],(function(){t.registerEs6ModuleExports(n.path,goog.global.$jscomp.require(n.getPathName()),o)})),t.loaded()}}var n=this;if(goog.global.CLOSURE_IMPORT_SCRIPT)e(),this.contents_&&goog.global.CLOSURE_IMPORT_SCRIPT("",this.contents_)?(this.contents_=null,t.loaded()):t.pause();else{var i=this.loadFlags.module==goog.ModuleType.ES6;this.lazyFetch_||e();var o=1<t.pending().length,a=o&&goog.DebugLoader_.IS_OLD_IE_;if(o=goog.Dependency.defer_&&(o||goog.isDocumentLoading_()),a||o)t.defer((function(){r()}));else{var s=goog.global.document;if(a=goog.inHtmlDocument_()&&"ActiveXObject"in goog.global,i&&goog.inHtmlDocument_()&&goog.isDocumentLoading_()&&!a){goog.Dependency.defer_=!0,t.pause();var u=s.onreadystatechange;s.onreadystatechange=function(){"interactive"==s.readyState&&(s.onreadystatechange=u,r(),t.resume()),goog.isFunction(u)&&u.apply(void 0,arguments)}}else!goog.DebugLoader_.IS_OLD_IE_&&goog.inHtmlDocument_()&&goog.isDocumentLoading_()?function(){var t=goog.global.document,e=goog.Dependency.registerCallback_((function(){goog.Dependency.unregisterCallback_(e),r()})),n='<script type="text/javascript">'+goog.protectScriptTag_('goog.Dependency.callback_("'+e+'");')+"<\/script>";t.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(n):n)}():r()}}},goog.TransformedDependency.prototype.transform=function(t){},goog.TranspiledDependency=function(t,e,r,n,i,o){goog.TransformedDependency.call(this,t,e,r,n,i),this.transpiler=o},goog.inherits(goog.TranspiledDependency,goog.TransformedDependency),goog.TranspiledDependency.prototype.transform=function(t){return this.transpiler.transpile(t,this.getPathName())},goog.PreTranspiledEs6ModuleDependency=function(t,e,r,n,i){goog.TransformedDependency.call(this,t,e,r,n,i)},goog.inherits(goog.PreTranspiledEs6ModuleDependency,goog.TransformedDependency),goog.PreTranspiledEs6ModuleDependency.prototype.transform=function(t){return t},goog.GoogModuleDependency=function(t,e,r,n,i,o,a){goog.TransformedDependency.call(this,t,e,r,n,i),this.needsTranspile_=o,this.transpiler_=a},goog.inherits(goog.GoogModuleDependency,goog.TransformedDependency),goog.GoogModuleDependency.prototype.transform=function(t){return this.needsTranspile_&&(t=this.transpiler_.transpile(t,this.getPathName())),goog.LOAD_MODULE_USING_EVAL&&goog.isDef(goog.global.JSON)?"goog.loadModule("+goog.global.JSON.stringify(t+"\n//# sourceURL="+this.path+"\n")+");":'goog.loadModule(function(exports) {"use strict";'+t+"\n;return exports});\n//# sourceURL="+this.path+"\n"},goog.DebugLoader_.IS_OLD_IE_=!(goog.global.atob||!goog.global.document||!goog.global.document.all),goog.DebugLoader_.prototype.addDependency=function(t,e,r,n){e=e||[],t=t.replace(/\\/g,"/");var i=goog.normalizePath_(goog.basePath+t);for(n&&"boolean"!=typeof n||(n=n?{module:goog.ModuleType.GOOG}:{}),r=this.factory_.createDependency(i,t,e,r,n,goog.transpiler_.needsTranspile(n.lang||"es3",n.module)),this.dependencies_[i]=r,r=0;r<e.length;r++)this.idToPath_[e[r]]=i;this.idToPath_[t]=i},goog.DependencyFactory=function(t){this.transpiler=t},goog.DependencyFactory.prototype.createDependency=function(t,e,r,n,i,o){return i.module==goog.ModuleType.GOOG?new goog.GoogModuleDependency(t,e,r,n,i,o,this.transpiler):o?new goog.TranspiledDependency(t,e,r,n,i,this.transpiler):i.module==goog.ModuleType.ES6?"never"==goog.TRANSPILE&&goog.ASSUME_ES_MODULES_TRANSPILED?new goog.PreTranspiledEs6ModuleDependency(t,e,r,n,i):new goog.Es6ModuleDependency(t,e,r,n,i):new goog.Dependency(t,e,r,n,i)},goog.debugLoader_=new goog.DebugLoader_,goog.loadClosureDeps=function(){goog.debugLoader_.loadClosureDeps()},goog.setDependencyFactory=function(t){goog.debugLoader_.setDependencyFactory(t)},goog.global.CLOSURE_NO_DEPS||goog.debugLoader_.loadClosureDeps(),goog.bootstrap=function(t,e){goog.debugLoader_.bootstrap(t,e)}),goog.TRUSTED_TYPES_POLICY_NAME="",goog.identity_=function(t){return t},goog.createTrustedTypesPolicy=function(t){var e=null;if("undefined"==typeof TrustedTypes||!TrustedTypes.createPolicy)return e;try{e=TrustedTypes.createPolicy(t,{createHTML:goog.identity_,createScript:goog.identity_,createScriptURL:goog.identity_,createURL:goog.identity_})}catch(t){goog.logToConsole_(t.message)}return e},goog.TRUSTED_TYPES_POLICY_=goog.TRUSTED_TYPES_POLICY_NAME?goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME+"#base"):null,goog.object={},goog.object.is=function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e},goog.object.forEach=function(t,e,r){for(var n in t)e.call(r,t[n],n,t)},goog.object.filter=function(t,e,r){var n,i={};for(n in t)e.call(r,t[n],n,t)&&(i[n]=t[n]);return i},goog.object.map=function(t,e,r){var n,i={};for(n in t)i[n]=e.call(r,t[n],n,t);return i},goog.object.some=function(t,e,r){for(var n in t)if(e.call(r,t[n],n,t))return!0;return!1},goog.object.every=function(t,e,r){for(var n in t)if(!e.call(r,t[n],n,t))return!1;return!0},goog.object.getCount=function(t){var e,r=0;for(e in t)r++;return r},goog.object.getAnyKey=function(t){for(var e in t)return e},goog.object.getAnyValue=function(t){for(var e in t)return t[e]},goog.object.contains=function(t,e){return goog.object.containsValue(t,e)},goog.object.getValues=function(t){var e,r=[],n=0;for(e in t)r[n++]=t[e];return r},goog.object.getKeys=function(t){var e,r=[],n=0;for(e in t)r[n++]=e;return r},goog.object.getValueByKeys=function(t,e){var r=goog.isArrayLike(e),n=r?e:arguments;for(r=r?0:1;r<n.length;r++){if(null==t)return;t=t[n[r]]}return t},goog.object.containsKey=function(t,e){return null!==t&&e in t},goog.object.containsValue=function(t,e){for(var r in t)if(t[r]==e)return!0;return!1},goog.object.findKey=function(t,e,r){for(var n in t)if(e.call(r,t[n],n,t))return n},goog.object.findValue=function(t,e,r){return(e=goog.object.findKey(t,e,r))&&t[e]},goog.object.isEmpty=function(t){for(var e in t)return!1;return!0},goog.object.clear=function(t){for(var e in t)delete t[e]},goog.object.remove=function(t,e){var r;return(r=e in t)&&delete t[e],r},goog.object.add=function(t,e,r){if(null!==t&&e in t)throw Error('The object already contains the key "'+e+'"');goog.object.set(t,e,r)},goog.object.get=function(t,e,r){return null!==t&&e in t?t[e]:r},goog.object.set=function(t,e,r){t[e]=r},goog.object.setIfUndefined=function(t,e,r){return e in t?t[e]:t[e]=r},goog.object.setWithReturnValueIfNotSet=function(t,e,r){return e in t?t[e]:(r=r(),t[e]=r)},goog.object.equals=function(t,e){for(var r in t)if(!(r in e)||t[r]!==e[r])return!1;for(var n in e)if(!(n in t))return!1;return!0},goog.object.clone=function(t){var e,r={};for(e in t)r[e]=t[e];return r},goog.object.unsafeClone=function(t){var e=goog.typeOf(t);if("object"==e||"array"==e){if(goog.isFunction(t.clone))return t.clone();for(var r in e="array"==e?[]:{},t)e[r]=goog.object.unsafeClone(t[r]);return e}return t},goog.object.transpose=function(t){var e,r={};for(e in t)r[t[e]]=e;return r},goog.object.PROTOTYPE_FIELDS_="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),goog.object.extend=function(t,e){for(var r,n,i=1;i<arguments.length;i++){for(r in n=arguments[i])t[r]=n[r];for(var o=0;o<goog.object.PROTOTYPE_FIELDS_.length;o++)r=goog.object.PROTOTYPE_FIELDS_[o],Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}},goog.object.create=function(t){var e=arguments.length;if(1==e&&goog.isArray(arguments[0]))return goog.object.create.apply(null,arguments[0]);if(e%2)throw Error("Uneven number of arguments");for(var r={},n=0;n<e;n+=2)r[arguments[n]]=arguments[n+1];return r},goog.object.createSet=function(t){var e=arguments.length;if(1==e&&goog.isArray(arguments[0]))return goog.object.createSet.apply(null,arguments[0]);for(var r={},n=0;n<e;n++)r[arguments[n]]=!0;return r},goog.object.createImmutableView=function(t){var e=t;return Object.isFrozen&&!Object.isFrozen(t)&&(e=Object.create(t),Object.freeze(e)),e},goog.object.isImmutableView=function(t){return!!Object.isFrozen&&Object.isFrozen(t)},goog.object.getAllPropertyNames=function(t,e,r){if(!t)return[];if(!Object.getOwnPropertyNames||!Object.getPrototypeOf)return goog.object.getKeys(t);for(var n={};t&&(t!==Object.prototype||e)&&(t!==Function.prototype||r);){for(var i=Object.getOwnPropertyNames(t),o=0;o<i.length;o++)n[i[o]]=!0;t=Object.getPrototypeOf(t)}return goog.object.getKeys(n)},goog.object.getSuperClass=function(t){return(t=Object.getPrototypeOf(t.prototype))&&t.constructor},goog.debug={},goog.debug.Error=function(t){if(Error.captureStackTrace)Error.captureStackTrace(this,goog.debug.Error);else{var e=Error().stack;e&&(this.stack=e)}t&&(this.message=String(t)),this.reportErrorToServer=!0},goog.inherits(goog.debug.Error,Error),goog.debug.Error.prototype.name="CustomError",goog.dom={},goog.dom.NodeType={ELEMENT:1,ATTRIBUTE:2,TEXT:3,CDATA_SECTION:4,ENTITY_REFERENCE:5,ENTITY:6,PROCESSING_INSTRUCTION:7,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,DOCUMENT_FRAGMENT:11,NOTATION:12},goog.asserts={},goog.asserts.ENABLE_ASSERTS=goog.DEBUG,goog.asserts.AssertionError=function(t,e){goog.debug.Error.call(this,goog.asserts.subs_(t,e)),this.messagePattern=t},goog.inherits(goog.asserts.AssertionError,goog.debug.Error),goog.asserts.AssertionError.prototype.name="AssertionError",goog.asserts.DEFAULT_ERROR_HANDLER=function(t){throw t},goog.asserts.errorHandler_=goog.asserts.DEFAULT_ERROR_HANDLER,goog.asserts.subs_=function(t,e){for(var r="",n=(t=t.split("%s")).length-1,i=0;i<n;i++)r+=t[i]+(i<e.length?e[i]:"%s");return r+t[n]},goog.asserts.doAssertFailure_=function(t,e,r,n){var i="Assertion failed";if(r){i+=": "+r;var o=n}else t&&(i+=": "+t,o=e);t=new goog.asserts.AssertionError(""+i,o||[]),goog.asserts.errorHandler_(t)},goog.asserts.setErrorHandler=function(t){goog.asserts.ENABLE_ASSERTS&&(goog.asserts.errorHandler_=t)},goog.asserts.assert=function(t,e,r){return goog.asserts.ENABLE_ASSERTS&&!t&&goog.asserts.doAssertFailure_("",null,e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertExists=function(t,e,r){return goog.asserts.ENABLE_ASSERTS&&null==t&&goog.asserts.doAssertFailure_("Expected to exist: %s.",[t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.fail=function(t,e){goog.asserts.ENABLE_ASSERTS&&goog.asserts.errorHandler_(new goog.asserts.AssertionError("Failure"+(t?": "+t:""),Array.prototype.slice.call(arguments,1)))},goog.asserts.assertNumber=function(t,e,r){return goog.asserts.ENABLE_ASSERTS&&!goog.isNumber(t)&&goog.asserts.doAssertFailure_("Expected number but got %s: %s.",[goog.typeOf(t),t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertString=function(t,e,r){return goog.asserts.ENABLE_ASSERTS&&!goog.isString(t)&&goog.asserts.doAssertFailure_("Expected string but got %s: %s.",[goog.typeOf(t),t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertFunction=function(t,e,r){return goog.asserts.ENABLE_ASSERTS&&!goog.isFunction(t)&&goog.asserts.doAssertFailure_("Expected function but got %s: %s.",[goog.typeOf(t),t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertObject=function(t,e,r){return goog.asserts.ENABLE_ASSERTS&&!goog.isObject(t)&&goog.asserts.doAssertFailure_("Expected object but got %s: %s.",[goog.typeOf(t),t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertArray=function(t,e,r){return goog.asserts.ENABLE_ASSERTS&&!goog.isArray(t)&&goog.asserts.doAssertFailure_("Expected array but got %s: %s.",[goog.typeOf(t),t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertBoolean=function(t,e,r){return goog.asserts.ENABLE_ASSERTS&&!goog.isBoolean(t)&&goog.asserts.doAssertFailure_("Expected boolean but got %s: %s.",[goog.typeOf(t),t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertElement=function(t,e,r){return!goog.asserts.ENABLE_ASSERTS||goog.isObject(t)&&t.nodeType==goog.dom.NodeType.ELEMENT||goog.asserts.doAssertFailure_("Expected Element but got %s: %s.",[goog.typeOf(t),t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertInstanceof=function(t,e,r,n){return!goog.asserts.ENABLE_ASSERTS||t instanceof e||goog.asserts.doAssertFailure_("Expected instanceof %s but got %s.",[goog.asserts.getType_(e),goog.asserts.getType_(t)],r,Array.prototype.slice.call(arguments,3)),t},goog.asserts.assertFinite=function(t,e,r){return!goog.asserts.ENABLE_ASSERTS||"number"==typeof t&&isFinite(t)||goog.asserts.doAssertFailure_("Expected %s to be a finite number but it is not.",[t],e,Array.prototype.slice.call(arguments,2)),t},goog.asserts.assertObjectPrototypeIsIntact=function(){for(var t in Object.prototype)goog.asserts.fail(t+" should not be enumerable in Object.prototype.")},goog.asserts.getType_=function(t){return t instanceof Function?t.displayName||t.name||"unknown type name":t instanceof Object?t.constructor.displayName||t.constructor.name||Object.prototype.toString.call(t):null===t?"null":typeof t};var jspb={BinaryConstants:{},ConstBinaryMessage:function(){},BinaryMessage:function(){}};jspb.BinaryConstants.FieldType={INVALID:-1,DOUBLE:1,FLOAT:2,INT64:3,UINT64:4,INT32:5,FIXED64:6,FIXED32:7,BOOL:8,STRING:9,GROUP:10,MESSAGE:11,BYTES:12,UINT32:13,ENUM:14,SFIXED32:15,SFIXED64:16,SINT32:17,SINT64:18,FHASH64:30,VHASH64:31},jspb.BinaryConstants.WireType={INVALID:-1,VARINT:0,FIXED64:1,DELIMITED:2,START_GROUP:3,END_GROUP:4,FIXED32:5},jspb.BinaryConstants.FieldTypeToWireType=function(t){var e=jspb.BinaryConstants.FieldType,r=jspb.BinaryConstants.WireType;switch(t){case e.INT32:case e.INT64:case e.UINT32:case e.UINT64:case e.SINT32:case e.SINT64:case e.BOOL:case e.ENUM:case e.VHASH64:return r.VARINT;case e.DOUBLE:case e.FIXED64:case e.SFIXED64:case e.FHASH64:return r.FIXED64;case e.STRING:case e.MESSAGE:case e.BYTES:return r.DELIMITED;case e.FLOAT:case e.FIXED32:case e.SFIXED32:return r.FIXED32;default:return r.INVALID}},jspb.BinaryConstants.INVALID_FIELD_NUMBER=-1,jspb.BinaryConstants.FLOAT32_EPS=1401298464324817e-60,jspb.BinaryConstants.FLOAT32_MIN=11754943508222875e-54,jspb.BinaryConstants.FLOAT32_MAX=34028234663852886e22,jspb.BinaryConstants.FLOAT64_EPS=5e-324,jspb.BinaryConstants.FLOAT64_MIN=22250738585072014e-324,jspb.BinaryConstants.FLOAT64_MAX=17976931348623157e292,jspb.BinaryConstants.TWO_TO_20=1048576,jspb.BinaryConstants.TWO_TO_23=8388608,jspb.BinaryConstants.TWO_TO_31=2147483648,jspb.BinaryConstants.TWO_TO_32=4294967296,jspb.BinaryConstants.TWO_TO_52=4503599627370496,jspb.BinaryConstants.TWO_TO_63=0x8000000000000000,jspb.BinaryConstants.TWO_TO_64=0x10000000000000000,jspb.BinaryConstants.ZERO_HASH="\0\0\0\0\0\0\0\0",goog.array={},goog.NATIVE_ARRAY_PROTOTYPES=goog.TRUSTED_SITE,goog.array.ASSUME_NATIVE_FUNCTIONS=2012<goog.FEATURESET_YEAR,goog.array.peek=function(t){return t[t.length-1]},goog.array.last=goog.array.peek,goog.array.indexOf=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.indexOf)?function(t,e,r){return goog.asserts.assert(null!=t.length),Array.prototype.indexOf.call(t,e,r)}:function(t,e,r){if(r=null==r?0:0>r?Math.max(0,t.length+r):r,goog.isString(t))return goog.isString(e)&&1==e.length?t.indexOf(e,r):-1;for(;r<t.length;r++)if(r in t&&t[r]===e)return r;return-1},goog.array.lastIndexOf=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.lastIndexOf)?function(t,e,r){return goog.asserts.assert(null!=t.length),Array.prototype.lastIndexOf.call(t,e,null==r?t.length-1:r)}:function(t,e,r){if(0>(r=null==r?t.length-1:r)&&(r=Math.max(0,t.length+r)),goog.isString(t))return goog.isString(e)&&1==e.length?t.lastIndexOf(e,r):-1;for(;0<=r;r--)if(r in t&&t[r]===e)return r;return-1},goog.array.forEach=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.forEach)?function(t,e,r){goog.asserts.assert(null!=t.length),Array.prototype.forEach.call(t,e,r)}:function(t,e,r){for(var n=t.length,i=goog.isString(t)?t.split(""):t,o=0;o<n;o++)o in i&&e.call(r,i[o],o,t)},goog.array.forEachRight=function(t,e,r){var n=t.length,i=goog.isString(t)?t.split(""):t;for(--n;0<=n;--n)n in i&&e.call(r,i[n],n,t)},goog.array.filter=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.filter)?function(t,e,r){return goog.asserts.assert(null!=t.length),Array.prototype.filter.call(t,e,r)}:function(t,e,r){for(var n=t.length,i=[],o=0,a=goog.isString(t)?t.split(""):t,s=0;s<n;s++)if(s in a){var u=a[s];e.call(r,u,s,t)&&(i[o++]=u)}return i},goog.array.map=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.map)?function(t,e,r){return goog.asserts.assert(null!=t.length),Array.prototype.map.call(t,e,r)}:function(t,e,r){for(var n=t.length,i=Array(n),o=goog.isString(t)?t.split(""):t,a=0;a<n;a++)a in o&&(i[a]=e.call(r,o[a],a,t));return i},goog.array.reduce=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.reduce)?function(t,e,r,n){return goog.asserts.assert(null!=t.length),n&&(e=goog.bind(e,n)),Array.prototype.reduce.call(t,e,r)}:function(t,e,r,n){var i=r;return goog.array.forEach(t,(function(r,o){i=e.call(n,i,r,o,t)})),i},goog.array.reduceRight=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.reduceRight)?function(t,e,r,n){return goog.asserts.assert(null!=t.length),goog.asserts.assert(null!=e),n&&(e=goog.bind(e,n)),Array.prototype.reduceRight.call(t,e,r)}:function(t,e,r,n){var i=r;return goog.array.forEachRight(t,(function(r,o){i=e.call(n,i,r,o,t)})),i},goog.array.some=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.some)?function(t,e,r){return goog.asserts.assert(null!=t.length),Array.prototype.some.call(t,e,r)}:function(t,e,r){for(var n=t.length,i=goog.isString(t)?t.split(""):t,o=0;o<n;o++)if(o in i&&e.call(r,i[o],o,t))return!0;return!1},goog.array.every=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.every)?function(t,e,r){return goog.asserts.assert(null!=t.length),Array.prototype.every.call(t,e,r)}:function(t,e,r){for(var n=t.length,i=goog.isString(t)?t.split(""):t,o=0;o<n;o++)if(o in i&&!e.call(r,i[o],o,t))return!1;return!0},goog.array.count=function(t,e,r){var n=0;return goog.array.forEach(t,(function(t,i,o){e.call(r,t,i,o)&&++n}),r),n},goog.array.find=function(t,e,r){return 0>(e=goog.array.findIndex(t,e,r))?null:goog.isString(t)?t.charAt(e):t[e]},goog.array.findIndex=function(t,e,r){for(var n=t.length,i=goog.isString(t)?t.split(""):t,o=0;o<n;o++)if(o in i&&e.call(r,i[o],o,t))return o;return-1},goog.array.findRight=function(t,e,r){return 0>(e=goog.array.findIndexRight(t,e,r))?null:goog.isString(t)?t.charAt(e):t[e]},goog.array.findIndexRight=function(t,e,r){var n=t.length,i=goog.isString(t)?t.split(""):t;for(--n;0<=n;n--)if(n in i&&e.call(r,i[n],n,t))return n;return-1},goog.array.contains=function(t,e){return 0<=goog.array.indexOf(t,e)},goog.array.isEmpty=function(t){return 0==t.length},goog.array.clear=function(t){if(!goog.isArray(t))for(var e=t.length-1;0<=e;e--)delete t[e];t.length=0},goog.array.insert=function(t,e){goog.array.contains(t,e)||t.push(e)},goog.array.insertAt=function(t,e,r){goog.array.splice(t,r,0,e)},goog.array.insertArrayAt=function(t,e,r){goog.partial(goog.array.splice,t,r,0).apply(null,e)},goog.array.insertBefore=function(t,e,r){var n;2==arguments.length||0>(n=goog.array.indexOf(t,r))?t.push(e):goog.array.insertAt(t,e,n)},goog.array.remove=function(t,e){var r;return(r=0<=(e=goog.array.indexOf(t,e)))&&goog.array.removeAt(t,e),r},goog.array.removeLast=function(t,e){return 0<=(e=goog.array.lastIndexOf(t,e))&&(goog.array.removeAt(t,e),!0)},goog.array.removeAt=function(t,e){return goog.asserts.assert(null!=t.length),1==Array.prototype.splice.call(t,e,1).length},goog.array.removeIf=function(t,e,r){return 0<=(e=goog.array.findIndex(t,e,r))&&(goog.array.removeAt(t,e),!0)},goog.array.removeAllIf=function(t,e,r){var n=0;return goog.array.forEachRight(t,(function(i,o){e.call(r,i,o,t)&&goog.array.removeAt(t,o)&&n++})),n},goog.array.concat=function(t){return Array.prototype.concat.apply([],arguments)},goog.array.join=function(t){return Array.prototype.concat.apply([],arguments)},goog.array.toArray=function(t){var e=t.length;if(0<e){for(var r=Array(e),n=0;n<e;n++)r[n]=t[n];return r}return[]},goog.array.clone=goog.array.toArray,goog.array.extend=function(t,e){for(var r=1;r<arguments.length;r++){var n=arguments[r];if(goog.isArrayLike(n)){var i=t.length||0,o=n.length||0;t.length=i+o;for(var a=0;a<o;a++)t[i+a]=n[a]}else t.push(n)}},goog.array.splice=function(t,e,r,n){return goog.asserts.assert(null!=t.length),Array.prototype.splice.apply(t,goog.array.slice(arguments,1))},goog.array.slice=function(t,e,r){return goog.asserts.assert(null!=t.length),2>=arguments.length?Array.prototype.slice.call(t,e):Array.prototype.slice.call(t,e,r)},goog.array.removeDuplicates=function(t,e,r){e=e||t;var n=function(t){return goog.isObject(t)?"o"+goog.getUid(t):(typeof t).charAt(0)+t};r=r||n,n={};for(var i=0,o=0;o<t.length;){var a=t[o++],s=r(a);Object.prototype.hasOwnProperty.call(n,s)||(n[s]=!0,e[i++]=a)}e.length=i},goog.array.binarySearch=function(t,e,r){return goog.array.binarySearch_(t,r||goog.array.defaultCompare,!1,e)},goog.array.binarySelect=function(t,e,r){return goog.array.binarySearch_(t,e,!0,void 0,r)},goog.array.binarySearch_=function(t,e,r,n,i){for(var o,a=0,s=t.length;a<s;){var u=a+s>>1,c=r?e.call(i,t[u],u,t):e(n,t[u]);0<c?a=u+1:(s=u,o=!c)}return o?a:~a},goog.array.sort=function(t,e){t.sort(e||goog.array.defaultCompare)},goog.array.stableSort=function(t,e){for(var r=Array(t.length),n=0;n<t.length;n++)r[n]={index:n,value:t[n]};var i=e||goog.array.defaultCompare;for(goog.array.sort(r,(function(t,e){return i(t.value,e.value)||t.index-e.index})),n=0;n<t.length;n++)t[n]=r[n].value},goog.array.sortByKey=function(t,e,r){var n=r||goog.array.defaultCompare;goog.array.sort(t,(function(t,r){return n(e(t),e(r))}))},goog.array.sortObjectsByKey=function(t,e,r){goog.array.sortByKey(t,(function(t){return t[e]}),r)},goog.array.isSorted=function(t,e,r){e=e||goog.array.defaultCompare;for(var n=1;n<t.length;n++){var i=e(t[n-1],t[n]);if(0<i||0==i&&r)return!1}return!0},goog.array.equals=function(t,e,r){if(!goog.isArrayLike(t)||!goog.isArrayLike(e)||t.length!=e.length)return!1;var n=t.length;r=r||goog.array.defaultCompareEquality;for(var i=0;i<n;i++)if(!r(t[i],e[i]))return!1;return!0},goog.array.compare3=function(t,e,r){r=r||goog.array.defaultCompare;for(var n=Math.min(t.length,e.length),i=0;i<n;i++){var o=r(t[i],e[i]);if(0!=o)return o}return goog.array.defaultCompare(t.length,e.length)},goog.array.defaultCompare=function(t,e){return t>e?1:t<e?-1:0},goog.array.inverseDefaultCompare=function(t,e){return-goog.array.defaultCompare(t,e)},goog.array.defaultCompareEquality=function(t,e){return t===e},goog.array.binaryInsert=function(t,e,r){return 0>(r=goog.array.binarySearch(t,e,r))&&(goog.array.insertAt(t,e,-(r+1)),!0)},goog.array.binaryRemove=function(t,e,r){return 0<=(e=goog.array.binarySearch(t,e,r))&&goog.array.removeAt(t,e)},goog.array.bucket=function(t,e,r){for(var n={},i=0;i<t.length;i++){var o=t[i],a=e.call(r,o,i,t);goog.isDef(a)&&(n[a]||(n[a]=[])).push(o)}return n},goog.array.toObject=function(t,e,r){var n={};return goog.array.forEach(t,(function(i,o){n[e.call(r,i,o,t)]=i})),n},goog.array.range=function(t,e,r){var n=[],i=0,o=t;if(void 0!==e&&(i=t,o=e),0>(r=r||1)*(o-i))return[];if(0<r)for(t=i;t<o;t+=r)n.push(t);else for(t=i;t>o;t+=r)n.push(t);return n},goog.array.repeat=function(t,e){for(var r=[],n=0;n<e;n++)r[n]=t;return r},goog.array.flatten=function(t){for(var e=[],r=0;r<arguments.length;r++){var n=arguments[r];if(goog.isArray(n))for(var i=0;i<n.length;i+=8192){var o=goog.array.slice(n,i,i+8192);o=goog.array.flatten.apply(null,o);for(var a=0;a<o.length;a++)e.push(o[a])}else e.push(n)}return e},goog.array.rotate=function(t,e){return goog.asserts.assert(null!=t.length),t.length&&(0<(e%=t.length)?Array.prototype.unshift.apply(t,t.splice(-e,e)):0>e&&Array.prototype.push.apply(t,t.splice(0,-e))),t},goog.array.moveItem=function(t,e,r){goog.asserts.assert(0<=e&&e<t.length),goog.asserts.assert(0<=r&&r<t.length),e=Array.prototype.splice.call(t,e,1),Array.prototype.splice.call(t,r,0,e[0])},goog.array.zip=function(t){if(!arguments.length)return[];for(var e=[],r=arguments[0].length,n=1;n<arguments.length;n++)arguments[n].length<r&&(r=arguments[n].length);for(n=0;n<r;n++){for(var i=[],o=0;o<arguments.length;o++)i.push(arguments[o][n]);e.push(i)}return e},goog.array.shuffle=function(t,e){e=e||Math.random;for(var r=t.length-1;0<r;r--){var n=Math.floor(e()*(r+1)),i=t[r];t[r]=t[n],t[n]=i}},goog.array.copyByIndex=function(t,e){var r=[];return goog.array.forEach(e,(function(e){r.push(t[e])})),r},goog.array.concatMap=function(t,e,r){return goog.array.concat.apply([],goog.array.map(t,e,r))},goog.crypt={},goog.crypt.stringToByteArray=function(t){for(var e=[],r=0,n=0;n<t.length;n++){var i=t.charCodeAt(n);255<i&&(e[r++]=255&i,i>>=8),e[r++]=i}return e},goog.crypt.byteArrayToString=function(t){if(8192>=t.length)return String.fromCharCode.apply(null,t);for(var e="",r=0;r<t.length;r+=8192){var n=goog.array.slice(t,r,r+8192);e+=String.fromCharCode.apply(null,n)}return e},goog.crypt.byteArrayToHex=function(t,e){return goog.array.map(t,(function(t){return 1<(t=t.toString(16)).length?t:"0"+t})).join(e||"")},goog.crypt.hexToByteArray=function(t){goog.asserts.assert(0==t.length%2,"Key string length must be multiple of 2");for(var e=[],r=0;r<t.length;r+=2)e.push(parseInt(t.substring(r,r+2),16));return e},goog.crypt.stringToUtf8ByteArray=function(t){for(var e=[],r=0,n=0;n<t.length;n++){var i=t.charCodeAt(n);128>i?e[r++]=i:(2048>i?e[r++]=i>>6|192:(55296==(64512&i)&&n+1<t.length&&56320==(64512&t.charCodeAt(n+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++n)),e[r++]=i>>18|240,e[r++]=i>>12&63|128):e[r++]=i>>12|224,e[r++]=i>>6&63|128),e[r++]=63&i|128)}return e},goog.crypt.utf8ByteArrayToString=function(t){for(var e=[],r=0,n=0;r<t.length;){var i=t[r++];if(128>i)e[n++]=String.fromCharCode(i);else if(191<i&&224>i){var o=t[r++];e[n++]=String.fromCharCode((31&i)<<6|63&o)}else if(239<i&&365>i){o=t[r++];var a=t[r++];i=((7&i)<<18|(63&o)<<12|(63&a)<<6|63&t[r++])-65536,e[n++]=String.fromCharCode(55296+(i>>10)),e[n++]=String.fromCharCode(56320+(1023&i))}else o=t[r++],a=t[r++],e[n++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&a)}return e.join("")},goog.crypt.xorByteArray=function(t,e){goog.asserts.assert(t.length==e.length,"XOR array lengths must match");for(var r=[],n=0;n<t.length;n++)r.push(t[n]^e[n]);return r},goog.dom.asserts={},goog.dom.asserts.assertIsLocation=function(t){if(goog.asserts.ENABLE_ASSERTS){var e=goog.dom.asserts.getWindow_(t);e&&(!t||!(t instanceof e.Location)&&t instanceof e.Element)&&goog.asserts.fail("Argument is not a Location (or a non-Element mock); got: %s",goog.dom.asserts.debugStringForType_(t))}return t},goog.dom.asserts.assertIsElementType_=function(t,e){if(goog.asserts.ENABLE_ASSERTS){var r=goog.dom.asserts.getWindow_(t);r&&void 0!==r[e]&&(t&&(t instanceof r[e]||!(t instanceof r.Location||t instanceof r.Element))||goog.asserts.fail("Argument is not a %s (or a non-Element, non-Location mock); got: %s",e,goog.dom.asserts.debugStringForType_(t)))}return t},goog.dom.asserts.assertIsHTMLAnchorElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLAnchorElement")},goog.dom.asserts.assertIsHTMLButtonElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLButtonElement")},goog.dom.asserts.assertIsHTMLLinkElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLLinkElement")},goog.dom.asserts.assertIsHTMLImageElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLImageElement")},goog.dom.asserts.assertIsHTMLAudioElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLAudioElement")},goog.dom.asserts.assertIsHTMLVideoElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLVideoElement")},goog.dom.asserts.assertIsHTMLInputElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLInputElement")},goog.dom.asserts.assertIsHTMLTextAreaElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLTextAreaElement")},goog.dom.asserts.assertIsHTMLCanvasElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLCanvasElement")},goog.dom.asserts.assertIsHTMLEmbedElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLEmbedElement")},goog.dom.asserts.assertIsHTMLFormElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLFormElement")},goog.dom.asserts.assertIsHTMLFrameElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLFrameElement")},goog.dom.asserts.assertIsHTMLIFrameElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLIFrameElement")},goog.dom.asserts.assertIsHTMLObjectElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLObjectElement")},goog.dom.asserts.assertIsHTMLScriptElement=function(t){return goog.dom.asserts.assertIsElementType_(t,"HTMLScriptElement")},goog.dom.asserts.debugStringForType_=function(t){if(!goog.isObject(t))return void 0===t?"undefined":null===t?"null":typeof t;try{return t.constructor.displayName||t.constructor.name||Object.prototype.toString.call(t)}catch(t){return"<object could not be stringified>"}},goog.dom.asserts.getWindow_=function(t){try{var e=t&&t.ownerDocument,r=e&&(e.defaultView||e.parentWindow);if((r=r||goog.global).Element&&r.Location)return r}catch(t){}return null},goog.functions={},goog.functions.constant=function(t){return function(){return t}},goog.functions.FALSE=function(){return!1},goog.functions.TRUE=function(){return!0},goog.functions.NULL=function(){return null},goog.functions.identity=function(t,e){return t},goog.functions.error=function(t){return function(){throw Error(t)}},goog.functions.fail=function(t){return function(){throw t}},goog.functions.lock=function(t,e){return e=e||0,function(){return t.apply(this,Array.prototype.slice.call(arguments,0,e))}},goog.functions.nth=function(t){return function(){return arguments[t]}},goog.functions.partialRight=function(t,e){var r=Array.prototype.slice.call(arguments,1);return function(){var e=Array.prototype.slice.call(arguments);return e.push.apply(e,r),t.apply(this,e)}},goog.functions.withReturnValue=function(t,e){return goog.functions.sequence(t,goog.functions.constant(e))},goog.functions.equalTo=function(t,e){return function(r){return e?t==r:t===r}},goog.functions.compose=function(t,e){var r=arguments,n=r.length;return function(){var t;n&&(t=r[n-1].apply(this,arguments));for(var e=n-2;0<=e;e--)t=r[e].call(this,t);return t}},goog.functions.sequence=function(t){var e=arguments,r=e.length;return function(){for(var t,n=0;n<r;n++)t=e[n].apply(this,arguments);return t}},goog.functions.and=function(t){var e=arguments,r=e.length;return function(){for(var t=0;t<r;t++)if(!e[t].apply(this,arguments))return!1;return!0}},goog.functions.or=function(t){var e=arguments,r=e.length;return function(){for(var t=0;t<r;t++)if(e[t].apply(this,arguments))return!0;return!1}},goog.functions.not=function(t){return function(){return!t.apply(this,arguments)}},goog.functions.create=function(t,e){var r=function(){};return r.prototype=t.prototype,r=new r,t.apply(r,Array.prototype.slice.call(arguments,1)),r},goog.functions.CACHE_RETURN_VALUE=!0,goog.functions.cacheReturnValue=function(t){var e,r=!1;return function(){return goog.functions.CACHE_RETURN_VALUE?(r||(e=t(),r=!0),e):t()}},goog.functions.once=function(t){var e=t;return function(){if(e){var t=e;e=null,t()}}},goog.functions.debounce=function(t,e,r){var n=0;return function(i){goog.global.clearTimeout(n);var o=arguments;n=goog.global.setTimeout((function(){t.apply(r,o)}),e)}},goog.functions.throttle=function(t,e,r){var n=0,i=!1,o=[],a=function(){n=0,i&&(i=!1,s())},s=function(){n=goog.global.setTimeout(a,e),t.apply(r,o)};return function(t){o=arguments,n?i=!0:s()}},goog.functions.rateLimit=function(t,e,r){var n=0,i=function(){n=0};return function(o){n||(n=goog.global.setTimeout(i,e),t.apply(r,arguments))}},goog.dom.HtmlElement=function(){},goog.dom.TagName=function(t){this.tagName_=t},goog.dom.TagName.prototype.toString=function(){return this.tagName_},goog.dom.TagName.A=new goog.dom.TagName("A"),goog.dom.TagName.ABBR=new goog.dom.TagName("ABBR"),goog.dom.TagName.ACRONYM=new goog.dom.TagName("ACRONYM"),goog.dom.TagName.ADDRESS=new goog.dom.TagName("ADDRESS"),goog.dom.TagName.APPLET=new goog.dom.TagName("APPLET"),goog.dom.TagName.AREA=new goog.dom.TagName("AREA"),goog.dom.TagName.ARTICLE=new goog.dom.TagName("ARTICLE"),goog.dom.TagName.ASIDE=new goog.dom.TagName("ASIDE"),goog.dom.TagName.AUDIO=new goog.dom.TagName("AUDIO"),goog.dom.TagName.B=new goog.dom.TagName("B"),goog.dom.TagName.BASE=new goog.dom.TagName("BASE"),goog.dom.TagName.BASEFONT=new goog.dom.TagName("BASEFONT"),goog.dom.TagName.BDI=new goog.dom.TagName("BDI"),goog.dom.TagName.BDO=new goog.dom.TagName("BDO"),goog.dom.TagName.BIG=new goog.dom.TagName("BIG"),goog.dom.TagName.BLOCKQUOTE=new goog.dom.TagName("BLOCKQUOTE"),goog.dom.TagName.BODY=new goog.dom.TagName("BODY"),goog.dom.TagName.BR=new goog.dom.TagName("BR"),goog.dom.TagName.BUTTON=new goog.dom.TagName("BUTTON"),goog.dom.TagName.CANVAS=new goog.dom.TagName("CANVAS"),goog.dom.TagName.CAPTION=new goog.dom.TagName("CAPTION"),goog.dom.TagName.CENTER=new goog.dom.TagName("CENTER"),goog.dom.TagName.CITE=new goog.dom.TagName("CITE"),goog.dom.TagName.CODE=new goog.dom.TagName("CODE"),goog.dom.TagName.COL=new goog.dom.TagName("COL"),goog.dom.TagName.COLGROUP=new goog.dom.TagName("COLGROUP"),goog.dom.TagName.COMMAND=new goog.dom.TagName("COMMAND"),goog.dom.TagName.DATA=new goog.dom.TagName("DATA"),goog.dom.TagName.DATALIST=new goog.dom.TagName("DATALIST"),goog.dom.TagName.DD=new goog.dom.TagName("DD"),goog.dom.TagName.DEL=new goog.dom.TagName("DEL"),goog.dom.TagName.DETAILS=new goog.dom.TagName("DETAILS"),goog.dom.TagName.DFN=new goog.dom.TagName("DFN"),goog.dom.TagName.DIALOG=new goog.dom.TagName("DIALOG"),goog.dom.TagName.DIR=new goog.dom.TagName("DIR"),goog.dom.TagName.DIV=new goog.dom.TagName("DIV"),goog.dom.TagName.DL=new goog.dom.TagName("DL"),goog.dom.TagName.DT=new goog.dom.TagName("DT"),goog.dom.TagName.EM=new goog.dom.TagName("EM"),goog.dom.TagName.EMBED=new goog.dom.TagName("EMBED"),goog.dom.TagName.FIELDSET=new goog.dom.TagName("FIELDSET"),goog.dom.TagName.FIGCAPTION=new goog.dom.TagName("FIGCAPTION"),goog.dom.TagName.FIGURE=new goog.dom.TagName("FIGURE"),goog.dom.TagName.FONT=new goog.dom.TagName("FONT"),goog.dom.TagName.FOOTER=new goog.dom.TagName("FOOTER"),goog.dom.TagName.FORM=new goog.dom.TagName("FORM"),goog.dom.TagName.FRAME=new goog.dom.TagName("FRAME"),goog.dom.TagName.FRAMESET=new goog.dom.TagName("FRAMESET"),goog.dom.TagName.H1=new goog.dom.TagName("H1"),goog.dom.TagName.H2=new goog.dom.TagName("H2"),goog.dom.TagName.H3=new goog.dom.TagName("H3"),goog.dom.TagName.H4=new goog.dom.TagName("H4"),goog.dom.TagName.H5=new goog.dom.TagName("H5"),goog.dom.TagName.H6=new goog.dom.TagName("H6"),goog.dom.TagName.HEAD=new goog.dom.TagName("HEAD"),goog.dom.TagName.HEADER=new goog.dom.TagName("HEADER"),goog.dom.TagName.HGROUP=new goog.dom.TagName("HGROUP"),goog.dom.TagName.HR=new goog.dom.TagName("HR"),goog.dom.TagName.HTML=new goog.dom.TagName("HTML"),goog.dom.TagName.I=new goog.dom.TagName("I"),goog.dom.TagName.IFRAME=new goog.dom.TagName("IFRAME"),goog.dom.TagName.IMG=new goog.dom.TagName("IMG"),goog.dom.TagName.INPUT=new goog.dom.TagName("INPUT"),goog.dom.TagName.INS=new goog.dom.TagName("INS"),goog.dom.TagName.ISINDEX=new goog.dom.TagName("ISINDEX"),goog.dom.TagName.KBD=new goog.dom.TagName("KBD"),goog.dom.TagName.KEYGEN=new goog.dom.TagName("KEYGEN"),goog.dom.TagName.LABEL=new goog.dom.TagName("LABEL"),goog.dom.TagName.LEGEND=new goog.dom.TagName("LEGEND"),goog.dom.TagName.LI=new goog.dom.TagName("LI"),goog.dom.TagName.LINK=new goog.dom.TagName("LINK"),goog.dom.TagName.MAIN=new goog.dom.TagName("MAIN"),goog.dom.TagName.MAP=new goog.dom.TagName("MAP"),goog.dom.TagName.MARK=new goog.dom.TagName("MARK"),goog.dom.TagName.MATH=new goog.dom.TagName("MATH"),goog.dom.TagName.MENU=new goog.dom.TagName("MENU"),goog.dom.TagName.MENUITEM=new goog.dom.TagName("MENUITEM"),goog.dom.TagName.META=new goog.dom.TagName("META"),goog.dom.TagName.METER=new goog.dom.TagName("METER"),goog.dom.TagName.NAV=new goog.dom.TagName("NAV"),goog.dom.TagName.NOFRAMES=new goog.dom.TagName("NOFRAMES"),goog.dom.TagName.NOSCRIPT=new goog.dom.TagName("NOSCRIPT"),goog.dom.TagName.OBJECT=new goog.dom.TagName("OBJECT"),goog.dom.TagName.OL=new goog.dom.TagName("OL"),goog.dom.TagName.OPTGROUP=new goog.dom.TagName("OPTGROUP"),goog.dom.TagName.OPTION=new goog.dom.TagName("OPTION"),goog.dom.TagName.OUTPUT=new goog.dom.TagName("OUTPUT"),goog.dom.TagName.P=new goog.dom.TagName("P"),goog.dom.TagName.PARAM=new goog.dom.TagName("PARAM"),goog.dom.TagName.PICTURE=new goog.dom.TagName("PICTURE"),goog.dom.TagName.PRE=new goog.dom.TagName("PRE"),goog.dom.TagName.PROGRESS=new goog.dom.TagName("PROGRESS"),goog.dom.TagName.Q=new goog.dom.TagName("Q"),goog.dom.TagName.RP=new goog.dom.TagName("RP"),goog.dom.TagName.RT=new goog.dom.TagName("RT"),goog.dom.TagName.RTC=new goog.dom.TagName("RTC"),goog.dom.TagName.RUBY=new goog.dom.TagName("RUBY"),goog.dom.TagName.S=new goog.dom.TagName("S"),goog.dom.TagName.SAMP=new goog.dom.TagName("SAMP"),goog.dom.TagName.SCRIPT=new goog.dom.TagName("SCRIPT"),goog.dom.TagName.SECTION=new goog.dom.TagName("SECTION"),goog.dom.TagName.SELECT=new goog.dom.TagName("SELECT"),goog.dom.TagName.SMALL=new goog.dom.TagName("SMALL"),goog.dom.TagName.SOURCE=new goog.dom.TagName("SOURCE"),goog.dom.TagName.SPAN=new goog.dom.TagName("SPAN"),goog.dom.TagName.STRIKE=new goog.dom.TagName("STRIKE"),goog.dom.TagName.STRONG=new goog.dom.TagName("STRONG"),goog.dom.TagName.STYLE=new goog.dom.TagName("STYLE"),goog.dom.TagName.SUB=new goog.dom.TagName("SUB"),goog.dom.TagName.SUMMARY=new goog.dom.TagName("SUMMARY"),goog.dom.TagName.SUP=new goog.dom.TagName("SUP"),goog.dom.TagName.SVG=new goog.dom.TagName("SVG"),goog.dom.TagName.TABLE=new goog.dom.TagName("TABLE"),goog.dom.TagName.TBODY=new goog.dom.TagName("TBODY"),goog.dom.TagName.TD=new goog.dom.TagName("TD"),goog.dom.TagName.TEMPLATE=new goog.dom.TagName("TEMPLATE"),goog.dom.TagName.TEXTAREA=new goog.dom.TagName("TEXTAREA"),goog.dom.TagName.TFOOT=new goog.dom.TagName("TFOOT"),goog.dom.TagName.TH=new goog.dom.TagName("TH"),goog.dom.TagName.THEAD=new goog.dom.TagName("THEAD"),goog.dom.TagName.TIME=new goog.dom.TagName("TIME"),goog.dom.TagName.TITLE=new goog.dom.TagName("TITLE"),goog.dom.TagName.TR=new goog.dom.TagName("TR"),goog.dom.TagName.TRACK=new goog.dom.TagName("TRACK"),goog.dom.TagName.TT=new goog.dom.TagName("TT"),goog.dom.TagName.U=new goog.dom.TagName("U"),goog.dom.TagName.UL=new goog.dom.TagName("UL"),goog.dom.TagName.VAR=new goog.dom.TagName("VAR"),goog.dom.TagName.VIDEO=new goog.dom.TagName("VIDEO"),goog.dom.TagName.WBR=new goog.dom.TagName("WBR"),goog.dom.tags={},goog.dom.tags.VOID_TAGS_={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},goog.dom.tags.isVoidTag=function(t){return!0===goog.dom.tags.VOID_TAGS_[t]},goog.html={},goog.html.trustedtypes={},goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY=goog.TRUSTED_TYPES_POLICY_NAME?goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME+"#html"):null,goog.string={},goog.string.TypedString=function(){},goog.string.Const=function(t,e){this.stringConstValueWithSecurityContract__googStringSecurityPrivate_=t===goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_&&e||"",this.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_=goog.string.Const.TYPE_MARKER_},goog.string.Const.prototype.implementsGoogStringTypedString=!0,goog.string.Const.prototype.getTypedStringValue=function(){return this.stringConstValueWithSecurityContract__googStringSecurityPrivate_},goog.string.Const.prototype.toString=function(){return"Const{"+this.stringConstValueWithSecurityContract__googStringSecurityPrivate_+"}"},goog.string.Const.unwrap=function(t){return t instanceof goog.string.Const&&t.constructor===goog.string.Const&&t.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_===goog.string.Const.TYPE_MARKER_?t.stringConstValueWithSecurityContract__googStringSecurityPrivate_:(goog.asserts.fail("expected object of type Const, got '"+t+"'"),"type_error:Const")},goog.string.Const.from=function(t){return new goog.string.Const(goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_,t)},goog.string.Const.TYPE_MARKER_={},goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_={},goog.string.Const.EMPTY=goog.string.Const.from(""),goog.html.SafeScript=function(){this.privateDoNotAccessOrElseSafeScriptWrappedValue_="",this.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.SafeScript.prototype.implementsGoogStringTypedString=!0,goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.SafeScript.fromConstant=function(t){return 0===(t=goog.string.Const.unwrap(t)).length?goog.html.SafeScript.EMPTY:goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(t)},goog.html.SafeScript.fromConstantAndArgs=function(t,e){for(var r=[],n=1;n<arguments.length;n++)r.push(goog.html.SafeScript.stringify_(arguments[n]));return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse("("+goog.string.Const.unwrap(t)+")("+r.join(", ")+");")},goog.html.SafeScript.fromJson=function(t){return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(goog.html.SafeScript.stringify_(t))},goog.html.SafeScript.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeScriptWrappedValue_.toString()},goog.DEBUG&&(goog.html.SafeScript.prototype.toString=function(){return"SafeScript{"+this.privateDoNotAccessOrElseSafeScriptWrappedValue_+"}"}),goog.html.SafeScript.unwrap=function(t){return goog.html.SafeScript.unwrapTrustedScript(t).toString()},goog.html.SafeScript.unwrapTrustedScript=function(t){return t instanceof goog.html.SafeScript&&t.constructor===goog.html.SafeScript&&t.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?t.privateDoNotAccessOrElseSafeScriptWrappedValue_:(goog.asserts.fail("expected object of type SafeScript, got '"+t+"' of type "+goog.typeOf(t)),"type_error:SafeScript")},goog.html.SafeScript.stringify_=function(t){return JSON.stringify(t).replace(/</g,"\\x3c")},goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse=function(t){return(new goog.html.SafeScript).initSecurityPrivateDoNotAccessOrElse_(t)},goog.html.SafeScript.prototype.initSecurityPrivateDoNotAccessOrElse_=function(t){return this.privateDoNotAccessOrElseSafeScriptWrappedValue_=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY?goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createScript(t):t,this},goog.html.SafeScript.EMPTY=goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(""),goog.fs={},goog.fs.url={},goog.fs.url.createObjectUrl=function(t){return goog.fs.url.getUrlObject_().createObjectURL(t)},goog.fs.url.revokeObjectUrl=function(t){goog.fs.url.getUrlObject_().revokeObjectURL(t)},goog.fs.url.getUrlObject_=function(){var t=goog.fs.url.findUrlObject_();if(null!=t)return t;throw Error("This browser doesn't seem to support blob URLs")},goog.fs.url.findUrlObject_=function(){return goog.isDef(goog.global.URL)&&goog.isDef(goog.global.URL.createObjectURL)?goog.global.URL:goog.isDef(goog.global.webkitURL)&&goog.isDef(goog.global.webkitURL.createObjectURL)?goog.global.webkitURL:goog.isDef(goog.global.createObjectURL)?goog.global:null},goog.fs.url.browserSupportsObjectUrls=function(){return null!=goog.fs.url.findUrlObject_()},goog.i18n={},goog.i18n.bidi={},goog.i18n.bidi.FORCE_RTL=!1,goog.i18n.bidi.IS_RTL=goog.i18n.bidi.FORCE_RTL||("ar"==goog.LOCALE.substring(0,2).toLowerCase()||"fa"==goog.LOCALE.substring(0,2).toLowerCase()||"he"==goog.LOCALE.substring(0,2).toLowerCase()||"iw"==goog.LOCALE.substring(0,2).toLowerCase()||"ps"==goog.LOCALE.substring(0,2).toLowerCase()||"sd"==goog.LOCALE.substring(0,2).toLowerCase()||"ug"==goog.LOCALE.substring(0,2).toLowerCase()||"ur"==goog.LOCALE.substring(0,2).toLowerCase()||"yi"==goog.LOCALE.substring(0,2).toLowerCase())&&(2==goog.LOCALE.length||"-"==goog.LOCALE.substring(2,3)||"_"==goog.LOCALE.substring(2,3))||3<=goog.LOCALE.length&&"ckb"==goog.LOCALE.substring(0,3).toLowerCase()&&(3==goog.LOCALE.length||"-"==goog.LOCALE.substring(3,4)||"_"==goog.LOCALE.substring(3,4))||7<=goog.LOCALE.length&&("-"==goog.LOCALE.substring(2,3)||"_"==goog.LOCALE.substring(2,3))&&("adlm"==goog.LOCALE.substring(3,7).toLowerCase()||"arab"==goog.LOCALE.substring(3,7).toLowerCase()||"hebr"==goog.LOCALE.substring(3,7).toLowerCase()||"nkoo"==goog.LOCALE.substring(3,7).toLowerCase()||"rohg"==goog.LOCALE.substring(3,7).toLowerCase()||"thaa"==goog.LOCALE.substring(3,7).toLowerCase())||8<=goog.LOCALE.length&&("-"==goog.LOCALE.substring(3,4)||"_"==goog.LOCALE.substring(3,4))&&("adlm"==goog.LOCALE.substring(4,8).toLowerCase()||"arab"==goog.LOCALE.substring(4,8).toLowerCase()||"hebr"==goog.LOCALE.substring(4,8).toLowerCase()||"nkoo"==goog.LOCALE.substring(4,8).toLowerCase()||"rohg"==goog.LOCALE.substring(4,8).toLowerCase()||"thaa"==goog.LOCALE.substring(4,8).toLowerCase()),goog.i18n.bidi.Format={LRE:"‪",RLE:"‫",PDF:"‬",LRM:"‎",RLM:"‏"},goog.i18n.bidi.Dir={LTR:1,RTL:-1,NEUTRAL:0},goog.i18n.bidi.RIGHT="right",goog.i18n.bidi.LEFT="left",goog.i18n.bidi.I18N_RIGHT=goog.i18n.bidi.IS_RTL?goog.i18n.bidi.LEFT:goog.i18n.bidi.RIGHT,goog.i18n.bidi.I18N_LEFT=goog.i18n.bidi.IS_RTL?goog.i18n.bidi.RIGHT:goog.i18n.bidi.LEFT,goog.i18n.bidi.toDir=function(t,e){return"number"==typeof t?0<t?goog.i18n.bidi.Dir.LTR:0>t?goog.i18n.bidi.Dir.RTL:e?null:goog.i18n.bidi.Dir.NEUTRAL:null==t?null:t?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.ltrChars_="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ऀ-῿‎Ⰰ-\ud801\ud804-\ud839\ud83c-\udbff豈-﬜︀-﹯﻽-￿",goog.i18n.bidi.rtlChars_="֑-ۯۺ-ࣿ‏\ud802-\ud803\ud83a-\ud83bיִ-﷿ﹰ-ﻼ",goog.i18n.bidi.htmlSkipReg_=/<[^>]*>|&[^;]+;/g,goog.i18n.bidi.stripHtmlIfNeeded_=function(t,e){return e?t.replace(goog.i18n.bidi.htmlSkipReg_,""):t},goog.i18n.bidi.rtlCharReg_=new RegExp("["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.ltrCharReg_=new RegExp("["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.hasAnyRtl=function(t,e){return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(t,e))},goog.i18n.bidi.hasRtlChar=goog.i18n.bidi.hasAnyRtl,goog.i18n.bidi.hasAnyLtr=function(t,e){return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(t,e))},goog.i18n.bidi.ltrRe_=new RegExp("^["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.rtlRe_=new RegExp("^["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.isRtlChar=function(t){return goog.i18n.bidi.rtlRe_.test(t)},goog.i18n.bidi.isLtrChar=function(t){return goog.i18n.bidi.ltrRe_.test(t)},goog.i18n.bidi.isNeutralChar=function(t){return!goog.i18n.bidi.isLtrChar(t)&&!goog.i18n.bidi.isRtlChar(t)},goog.i18n.bidi.ltrDirCheckRe_=new RegExp("^[^"+goog.i18n.bidi.rtlChars_+"]*["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.rtlDirCheckRe_=new RegExp("^[^"+goog.i18n.bidi.ltrChars_+"]*["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.startsWithRtl=function(t,e){return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(t,e))},goog.i18n.bidi.isRtlText=goog.i18n.bidi.startsWithRtl,goog.i18n.bidi.startsWithLtr=function(t,e){return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(t,e))},goog.i18n.bidi.isLtrText=goog.i18n.bidi.startsWithLtr,goog.i18n.bidi.isRequiredLtrRe_=/^http:\/\/.*/,goog.i18n.bidi.isNeutralText=function(t,e){return t=goog.i18n.bidi.stripHtmlIfNeeded_(t,e),goog.i18n.bidi.isRequiredLtrRe_.test(t)||!goog.i18n.bidi.hasAnyLtr(t)&&!goog.i18n.bidi.hasAnyRtl(t)},goog.i18n.bidi.ltrExitDirCheckRe_=new RegExp("["+goog.i18n.bidi.ltrChars_+"][^"+goog.i18n.bidi.rtlChars_+"]*$"),goog.i18n.bidi.rtlExitDirCheckRe_=new RegExp("["+goog.i18n.bidi.rtlChars_+"][^"+goog.i18n.bidi.ltrChars_+"]*$"),goog.i18n.bidi.endsWithLtr=function(t,e){return goog.i18n.bidi.ltrExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(t,e))},goog.i18n.bidi.isLtrExitText=goog.i18n.bidi.endsWithLtr,goog.i18n.bidi.endsWithRtl=function(t,e){return goog.i18n.bidi.rtlExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(t,e))},goog.i18n.bidi.isRtlExitText=goog.i18n.bidi.endsWithRtl,goog.i18n.bidi.rtlLocalesRe_=/^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i,goog.i18n.bidi.isRtlLanguage=function(t){return goog.i18n.bidi.rtlLocalesRe_.test(t)},goog.i18n.bidi.bracketGuardTextRe_=/(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g,goog.i18n.bidi.guardBracketInText=function(t,e){return e=(void 0===e?goog.i18n.bidi.hasAnyRtl(t):e)?goog.i18n.bidi.Format.RLM:goog.i18n.bidi.Format.LRM,t.replace(goog.i18n.bidi.bracketGuardTextRe_,e+"$&"+e)},goog.i18n.bidi.enforceRtlInHtml=function(t){return"<"==t.charAt(0)?t.replace(/<\w+/,"$& dir=rtl"):"\n<span dir=rtl>"+t+"</span>"},goog.i18n.bidi.enforceRtlInText=function(t){return goog.i18n.bidi.Format.RLE+t+goog.i18n.bidi.Format.PDF},goog.i18n.bidi.enforceLtrInHtml=function(t){return"<"==t.charAt(0)?t.replace(/<\w+/,"$& dir=ltr"):"\n<span dir=ltr>"+t+"</span>"},goog.i18n.bidi.enforceLtrInText=function(t){return goog.i18n.bidi.Format.LRE+t+goog.i18n.bidi.Format.PDF},goog.i18n.bidi.dimensionsRe_=/:\s*([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)/g,goog.i18n.bidi.leftRe_=/left/gi,goog.i18n.bidi.rightRe_=/right/gi,goog.i18n.bidi.tempRe_=/%%%%/g,goog.i18n.bidi.mirrorCSS=function(t){return t.replace(goog.i18n.bidi.dimensionsRe_,":$1 $4 $3 $2").replace(goog.i18n.bidi.leftRe_,"%%%%").replace(goog.i18n.bidi.rightRe_,goog.i18n.bidi.LEFT).replace(goog.i18n.bidi.tempRe_,goog.i18n.bidi.RIGHT)},goog.i18n.bidi.doubleQuoteSubstituteRe_=/([\u0591-\u05f2])"/g,goog.i18n.bidi.singleQuoteSubstituteRe_=/([\u0591-\u05f2])'/g,goog.i18n.bidi.normalizeHebrewQuote=function(t){return t.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_,"$1״").replace(goog.i18n.bidi.singleQuoteSubstituteRe_,"$1׳")},goog.i18n.bidi.wordSeparatorRe_=/\s+/,goog.i18n.bidi.hasNumeralsRe_=/[\d\u06f0-\u06f9]/,goog.i18n.bidi.rtlDetectionThreshold_=.4,goog.i18n.bidi.estimateDirection=function(t,e){var r=0,n=0,i=!1;for(t=goog.i18n.bidi.stripHtmlIfNeeded_(t,e).split(goog.i18n.bidi.wordSeparatorRe_),e=0;e<t.length;e++){var o=t[e];goog.i18n.bidi.startsWithRtl(o)?(r++,n++):goog.i18n.bidi.isRequiredLtrRe_.test(o)?i=!0:goog.i18n.bidi.hasAnyLtr(o)?n++:goog.i18n.bidi.hasNumeralsRe_.test(o)&&(i=!0)}return 0==n?i?goog.i18n.bidi.Dir.LTR:goog.i18n.bidi.Dir.NEUTRAL:r/n>goog.i18n.bidi.rtlDetectionThreshold_?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.detectRtlDirectionality=function(t,e){return goog.i18n.bidi.estimateDirection(t,e)==goog.i18n.bidi.Dir.RTL},goog.i18n.bidi.setElementDirAndAlign=function(t,e){t&&(e=goog.i18n.bidi.toDir(e))&&(t.style.textAlign=e==goog.i18n.bidi.Dir.RTL?goog.i18n.bidi.RIGHT:goog.i18n.bidi.LEFT,t.dir=e==goog.i18n.bidi.Dir.RTL?"rtl":"ltr")},goog.i18n.bidi.setElementDirByTextDirectionality=function(t,e){switch(goog.i18n.bidi.estimateDirection(e)){case goog.i18n.bidi.Dir.LTR:t.dir="ltr";break;case goog.i18n.bidi.Dir.RTL:t.dir="rtl";break;default:t.removeAttribute("dir")}},goog.i18n.bidi.DirectionalString=function(){},goog.html.TrustedResourceUrl=function(){this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_="",this.trustedURL_=null,this.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.TrustedResourceUrl.prototype.implementsGoogStringTypedString=!0,goog.html.TrustedResourceUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_.toString()},goog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.TrustedResourceUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR},goog.html.TrustedResourceUrl.prototype.cloneWithParams=function(t,e){var r=goog.html.TrustedResourceUrl.unwrap(this),n=(r=goog.html.TrustedResourceUrl.URL_PARAM_PARSER_.exec(r))[3]||"";return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(r[1]+goog.html.TrustedResourceUrl.stringifyParams_("?",r[2]||"",t)+goog.html.TrustedResourceUrl.stringifyParams_("#",n,e))},goog.DEBUG&&(goog.html.TrustedResourceUrl.prototype.toString=function(){return"TrustedResourceUrl{"+this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_+"}"}),goog.html.TrustedResourceUrl.unwrap=function(t){return goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(t).toString()},goog.html.TrustedResourceUrl.unwrapTrustedScriptURL=function(t){return t instanceof goog.html.TrustedResourceUrl&&t.constructor===goog.html.TrustedResourceUrl&&t.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?t.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_:(goog.asserts.fail("expected object of type TrustedResourceUrl, got '"+t+"' of type "+goog.typeOf(t)),"type_error:TrustedResourceUrl")},goog.html.TrustedResourceUrl.unwrapTrustedURL=function(t){return t.trustedURL_?t.trustedURL_:goog.html.TrustedResourceUrl.unwrap(t)},goog.html.TrustedResourceUrl.format=function(t,e){var r=goog.string.Const.unwrap(t);if(!goog.html.TrustedResourceUrl.BASE_URL_.test(r))throw Error("Invalid TrustedResourceUrl format: "+r);return t=r.replace(goog.html.TrustedResourceUrl.FORMAT_MARKER_,(function(t,n){if(!Object.prototype.hasOwnProperty.call(e,n))throw Error('Found marker, "'+n+'", in format string, "'+r+'", but no valid label mapping found in args: '+JSON.stringify(e));return(t=e[n])instanceof goog.string.Const?goog.string.Const.unwrap(t):encodeURIComponent(String(t))})),goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.TrustedResourceUrl.FORMAT_MARKER_=/%{(\w+)}/g,goog.html.TrustedResourceUrl.BASE_URL_=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,goog.html.TrustedResourceUrl.URL_PARAM_PARSER_=/^([^?#]*)(\?[^#]*)?(#[\s\S]*)?/,goog.html.TrustedResourceUrl.formatWithParams=function(t,e,r,n){return goog.html.TrustedResourceUrl.format(t,e).cloneWithParams(r,n)},goog.html.TrustedResourceUrl.fromConstant=function(t){return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(t))},goog.html.TrustedResourceUrl.fromConstants=function(t){for(var e="",r=0;r<t.length;r++)e+=goog.string.Const.unwrap(t[r]);return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse=function(t){var e=new goog.html.TrustedResourceUrl;return e.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY?goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createScriptURL(t):t,goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY&&(e.trustedURL_=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createURL(t)),e},goog.html.TrustedResourceUrl.stringifyParams_=function(t,e,r){if(null==r)return e;if(goog.isString(r))return r?t+encodeURIComponent(r):"";for(var n in r){var i=r[n];i=goog.isArray(i)?i:[i];for(var o=0;o<i.length;o++){var a=i[o];null!=a&&(e||(e=t),e+=(e.length>t.length?"&":"")+encodeURIComponent(n)+"="+encodeURIComponent(String(a)))}}return e},goog.string.internal={},goog.string.internal.startsWith=function(t,e){return 0==t.lastIndexOf(e,0)},goog.string.internal.endsWith=function(t,e){var r=t.length-e.length;return 0<=r&&t.indexOf(e,r)==r},goog.string.internal.caseInsensitiveStartsWith=function(t,e){return 0==goog.string.internal.caseInsensitiveCompare(e,t.substr(0,e.length))},goog.string.internal.caseInsensitiveEndsWith=function(t,e){return 0==goog.string.internal.caseInsensitiveCompare(e,t.substr(t.length-e.length,e.length))},goog.string.internal.caseInsensitiveEquals=function(t,e){return t.toLowerCase()==e.toLowerCase()},goog.string.internal.isEmptyOrWhitespace=function(t){return/^[\s\xa0]*$/.test(t)},goog.string.internal.trim=goog.TRUSTED_SITE&&String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]},goog.string.internal.caseInsensitiveCompare=function(t,e){return(t=String(t).toLowerCase())<(e=String(e).toLowerCase())?-1:t==e?0:1},goog.string.internal.newLineToBr=function(t,e){return t.replace(/(\r\n|\r|\n)/g,e?"<br />":"<br>")},goog.string.internal.htmlEscape=function(t,e){if(e)t=t.replace(goog.string.internal.AMP_RE_,"&amp;").replace(goog.string.internal.LT_RE_,"&lt;").replace(goog.string.internal.GT_RE_,"&gt;").replace(goog.string.internal.QUOT_RE_,"&quot;").replace(goog.string.internal.SINGLE_QUOTE_RE_,"&#39;").replace(goog.string.internal.NULL_RE_,"&#0;");else{if(!goog.string.internal.ALL_RE_.test(t))return t;-1!=t.indexOf("&")&&(t=t.replace(goog.string.internal.AMP_RE_,"&amp;")),-1!=t.indexOf("<")&&(t=t.replace(goog.string.internal.LT_RE_,"&lt;")),-1!=t.indexOf(">")&&(t=t.replace(goog.string.internal.GT_RE_,"&gt;")),-1!=t.indexOf('"')&&(t=t.replace(goog.string.internal.QUOT_RE_,"&quot;")),-1!=t.indexOf("'")&&(t=t.replace(goog.string.internal.SINGLE_QUOTE_RE_,"&#39;")),-1!=t.indexOf("\0")&&(t=t.replace(goog.string.internal.NULL_RE_,"&#0;"))}return t},goog.string.internal.AMP_RE_=/&/g,goog.string.internal.LT_RE_=/</g,goog.string.internal.GT_RE_=/>/g,goog.string.internal.QUOT_RE_=/"/g,goog.string.internal.SINGLE_QUOTE_RE_=/'/g,goog.string.internal.NULL_RE_=/\x00/g,goog.string.internal.ALL_RE_=/[\x00&<>"']/,goog.string.internal.whitespaceEscape=function(t,e){return goog.string.internal.newLineToBr(t.replace(/ /g," &#160;"),e)},goog.string.internal.contains=function(t,e){return-1!=t.indexOf(e)},goog.string.internal.caseInsensitiveContains=function(t,e){return goog.string.internal.contains(t.toLowerCase(),e.toLowerCase())},goog.string.internal.compareVersions=function(t,e){var r=0;t=goog.string.internal.trim(String(t)).split("."),e=goog.string.internal.trim(String(e)).split(".");for(var n=Math.max(t.length,e.length),i=0;0==r&&i<n;i++){var o=t[i]||"",a=e[i]||"";do{if(o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],a=/(\d*)(\D*)(.*)/.exec(a)||["","","",""],0==o[0].length&&0==a[0].length)break;r=0==o[1].length?0:parseInt(o[1],10);var s=0==a[1].length?0:parseInt(a[1],10);r=goog.string.internal.compareElements_(r,s)||goog.string.internal.compareElements_(0==o[2].length,0==a[2].length)||goog.string.internal.compareElements_(o[2],a[2]),o=o[3],a=a[3]}while(0==r)}return r},goog.string.internal.compareElements_=function(t,e){return t<e?-1:t>e?1:0},goog.html.SafeUrl=function(){this.privateDoNotAccessOrElseSafeUrlWrappedValue_="",this.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.SafeUrl.INNOCUOUS_STRING="about:invalid#zClosurez",goog.html.SafeUrl.prototype.implementsGoogStringTypedString=!0,goog.html.SafeUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeUrlWrappedValue_.toString()},goog.html.SafeUrl.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.SafeUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR},goog.DEBUG&&(goog.html.SafeUrl.prototype.toString=function(){return"SafeUrl{"+this.privateDoNotAccessOrElseSafeUrlWrappedValue_+"}"}),goog.html.SafeUrl.unwrap=function(t){return goog.html.SafeUrl.unwrapTrustedURL(t).toString()},goog.html.SafeUrl.unwrapTrustedURL=function(t){return t instanceof goog.html.SafeUrl&&t.constructor===goog.html.SafeUrl&&t.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?t.privateDoNotAccessOrElseSafeUrlWrappedValue_:(goog.asserts.fail("expected object of type SafeUrl, got '"+t+"' of type "+goog.typeOf(t)),"type_error:SafeUrl")},goog.html.SafeUrl.fromConstant=function(t){return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(t))},goog.html.SAFE_MIME_TYPE_PATTERN_=/^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-wav|wav|webm)|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime))(?:;\w+=(?:\w+|"[\w;=]+"))*$/i,goog.html.SafeUrl.isSafeMimeType=function(t){return goog.html.SAFE_MIME_TYPE_PATTERN_.test(t)},goog.html.SafeUrl.fromBlob=function(t){return t=goog.html.SAFE_MIME_TYPE_PATTERN_.test(t.type)?goog.fs.url.createObjectUrl(t):goog.html.SafeUrl.INNOCUOUS_STRING,goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.DATA_URL_PATTERN_=/^data:([^,]*);base64,[a-z0-9+\/]+=*$/i,goog.html.SafeUrl.fromDataUrl=function(t){var e=(t=t.replace(/(%0A|%0D)/g,"")).match(goog.html.DATA_URL_PATTERN_);return e=e&&goog.html.SAFE_MIME_TYPE_PATTERN_.test(e[1]),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e?t:goog.html.SafeUrl.INNOCUOUS_STRING)},goog.html.SafeUrl.fromTelUrl=function(t){return goog.string.internal.caseInsensitiveStartsWith(t,"tel:")||(t=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.SIP_URL_PATTERN_=/^sip[s]?:[+a-z0-9_.!$%&'*\/=^`{|}~-]+@([a-z0-9-]+\.)+[a-z0-9]{2,63}$/i,goog.html.SafeUrl.fromSipUrl=function(t){return goog.html.SIP_URL_PATTERN_.test(decodeURIComponent(t))||(t=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.SafeUrl.fromFacebookMessengerUrl=function(t){return goog.string.internal.caseInsensitiveStartsWith(t,"fb-messenger://share")||(t=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.SafeUrl.fromWhatsAppUrl=function(t){return goog.string.internal.caseInsensitiveStartsWith(t,"whatsapp://send")||(t=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.SafeUrl.fromSmsUrl=function(t){return goog.string.internal.caseInsensitiveStartsWith(t,"sms:")&&goog.html.SafeUrl.isSmsUrlBodyValid_(t)||(t=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.SafeUrl.isSmsUrlBodyValid_=function(t){var e=t.indexOf("#");if(0<e&&(t=t.substring(0,e)),!(e=t.match(/[?&]body=/gi)))return!0;if(1<e.length)return!1;if(!(t=t.match(/[?&]body=([^&]*)/)[1]))return!0;try{decodeURIComponent(t)}catch(t){return!1}return/^(?:[a-z0-9\-_.~]|%[0-9a-f]{2})+$/i.test(t)},goog.html.SafeUrl.fromSshUrl=function(t){return goog.string.internal.caseInsensitiveStartsWith(t,"ssh://")||(t=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.SafeUrl.sanitizeChromeExtensionUrl=function(t,e){return goog.html.SafeUrl.sanitizeExtensionUrl_(/^chrome-extension:\/\/([^\/]+)\//,t,e)},goog.html.SafeUrl.sanitizeFirefoxExtensionUrl=function(t,e){return goog.html.SafeUrl.sanitizeExtensionUrl_(/^moz-extension:\/\/([^\/]+)\//,t,e)},goog.html.SafeUrl.sanitizeEdgeExtensionUrl=function(t,e){return goog.html.SafeUrl.sanitizeExtensionUrl_(/^ms-browser-extension:\/\/([^\/]+)\//,t,e)},goog.html.SafeUrl.sanitizeExtensionUrl_=function(t,e,r){return(t=t.exec(e))?(t=t[1],-1==(r instanceof goog.string.Const?[goog.string.Const.unwrap(r)]:r.map((function(t){return goog.string.Const.unwrap(t)}))).indexOf(t)&&(e=goog.html.SafeUrl.INNOCUOUS_STRING)):e=goog.html.SafeUrl.INNOCUOUS_STRING,goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromTrustedResourceUrl=function(t){return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.html.TrustedResourceUrl.unwrap(t))},goog.html.SAFE_URL_PATTERN_=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i,goog.html.SafeUrl.SAFE_URL_PATTERN=goog.html.SAFE_URL_PATTERN_,goog.html.SafeUrl.sanitize=function(t){return t instanceof goog.html.SafeUrl?t:(t="object"==typeof t&&t.implementsGoogStringTypedString?t.getTypedStringValue():String(t),goog.html.SAFE_URL_PATTERN_.test(t)||(t=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t))},goog.html.SafeUrl.sanitizeAssertUnchanged=function(t,e){return t instanceof goog.html.SafeUrl?t:(t="object"==typeof t&&t.implementsGoogStringTypedString?t.getTypedStringValue():String(t),e&&/^data:/i.test(t)&&(e=goog.html.SafeUrl.fromDataUrl(t)).getTypedStringValue()==t?e:(goog.asserts.assert(goog.html.SAFE_URL_PATTERN_.test(t),"%s does not match the safe URL pattern",t)||(t=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)))},goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse=function(t){var e=new goog.html.SafeUrl;return e.privateDoNotAccessOrElseSafeUrlWrappedValue_=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY?goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createURL(t):t,e},goog.html.SafeUrl.ABOUT_BLANK=goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse("about:blank"),goog.html.SafeStyle=function(){this.privateDoNotAccessOrElseSafeStyleWrappedValue_="",this.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.SafeStyle.prototype.implementsGoogStringTypedString=!0,goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.SafeStyle.fromConstant=function(t){return 0===(t=goog.string.Const.unwrap(t)).length?goog.html.SafeStyle.EMPTY:(goog.asserts.assert(goog.string.internal.endsWith(t,";"),"Last character of style string is not ';': "+t),goog.asserts.assert(goog.string.internal.contains(t,":"),"Style string must contain at least one ':', to specify a \"name: value\" pair: "+t),goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(t))},goog.html.SafeStyle.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeStyleWrappedValue_},goog.DEBUG&&(goog.html.SafeStyle.prototype.toString=function(){return"SafeStyle{"+this.privateDoNotAccessOrElseSafeStyleWrappedValue_+"}"}),goog.html.SafeStyle.unwrap=function(t){return t instanceof goog.html.SafeStyle&&t.constructor===goog.html.SafeStyle&&t.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?t.privateDoNotAccessOrElseSafeStyleWrappedValue_:(goog.asserts.fail("expected object of type SafeStyle, got '"+t+"' of type "+goog.typeOf(t)),"type_error:SafeStyle")},goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse=function(t){return(new goog.html.SafeStyle).initSecurityPrivateDoNotAccessOrElse_(t)},goog.html.SafeStyle.prototype.initSecurityPrivateDoNotAccessOrElse_=function(t){return this.privateDoNotAccessOrElseSafeStyleWrappedValue_=t,this},goog.html.SafeStyle.EMPTY=goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(""),goog.html.SafeStyle.INNOCUOUS_STRING="zClosurez",goog.html.SafeStyle.create=function(t){var e,r="";for(e in t){if(!/^[-_a-zA-Z0-9]+$/.test(e))throw Error("Name allows only [-_a-zA-Z0-9], got: "+e);var n=t[e];null!=n&&(r+=e+":"+(n=goog.isArray(n)?goog.array.map(n,goog.html.SafeStyle.sanitizePropertyValue_).join(" "):goog.html.SafeStyle.sanitizePropertyValue_(n))+";")}return r?goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(r):goog.html.SafeStyle.EMPTY},goog.html.SafeStyle.sanitizePropertyValue_=function(t){if(t instanceof goog.html.SafeUrl)return'url("'+goog.html.SafeUrl.unwrap(t).replace(/</g,"%3c").replace(/[\\"]/g,"\\$&")+'")';if(t=t instanceof goog.string.Const?goog.string.Const.unwrap(t):goog.html.SafeStyle.sanitizePropertyValueString_(String(t)),/[{;}]/.test(t))throw new goog.asserts.AssertionError("Value does not allow [{;}], got: %s.",[t]);return t},goog.html.SafeStyle.sanitizePropertyValueString_=function(t){var e=t.replace(goog.html.SafeStyle.FUNCTIONS_RE_,"$1").replace(goog.html.SafeStyle.FUNCTIONS_RE_,"$1").replace(goog.html.SafeStyle.URL_RE_,"url");return goog.html.SafeStyle.VALUE_RE_.test(e)?goog.html.SafeStyle.COMMENT_RE_.test(t)?(goog.asserts.fail("String value disallows comments, got: "+t),goog.html.SafeStyle.INNOCUOUS_STRING):goog.html.SafeStyle.hasBalancedQuotes_(t)?goog.html.SafeStyle.hasBalancedSquareBrackets_(t)?goog.html.SafeStyle.sanitizeUrl_(t):(goog.asserts.fail("String value requires balanced square brackets and one identifier per pair of brackets, got: "+t),goog.html.SafeStyle.INNOCUOUS_STRING):(goog.asserts.fail("String value requires balanced quotes, got: "+t),goog.html.SafeStyle.INNOCUOUS_STRING):(goog.asserts.fail("String value allows only "+goog.html.SafeStyle.VALUE_ALLOWED_CHARS_+" and simple functions, got: "+t),goog.html.SafeStyle.INNOCUOUS_STRING)},goog.html.SafeStyle.hasBalancedQuotes_=function(t){for(var e=!0,r=!0,n=0;n<t.length;n++){var i=t.charAt(n);"'"==i&&r?e=!e:'"'==i&&e&&(r=!r)}return e&&r},goog.html.SafeStyle.hasBalancedSquareBrackets_=function(t){for(var e=!0,r=/^[-_a-zA-Z0-9]$/,n=0;n<t.length;n++){var i=t.charAt(n);if("]"==i){if(e)return!1;e=!0}else if("["==i){if(!e)return!1;e=!1}else if(!e&&!r.test(i))return!1}return e},goog.html.SafeStyle.VALUE_ALLOWED_CHARS_="[-,.\"'%_!# a-zA-Z0-9\\[\\]]",goog.html.SafeStyle.VALUE_RE_=new RegExp("^"+goog.html.SafeStyle.VALUE_ALLOWED_CHARS_+"+$"),goog.html.SafeStyle.URL_RE_=/\b(url\([ \t\n]*)('[ -&(-\[\]-~]*'|"[ !#-\[\]-~]*"|[!#-&*-\[\]-~]*)([ \t\n]*\))/g,goog.html.SafeStyle.FUNCTIONS_RE_=/\b(hsl|hsla|rgb|rgba|matrix|calc|minmax|fit-content|repeat|(rotate|scale|translate)(X|Y|Z|3d)?)\([-+*/0-9a-z.%\[\], ]+\)/g,goog.html.SafeStyle.COMMENT_RE_=/\/\*/,goog.html.SafeStyle.sanitizeUrl_=function(t){return t.replace(goog.html.SafeStyle.URL_RE_,(function(t,e,r,n){var i="";return r=r.replace(/^(['"])(.*)\1$/,(function(t,e,r){return i=e,r})),t=goog.html.SafeUrl.sanitize(r).getTypedStringValue(),e+i+t+i+n}))},goog.html.SafeStyle.concat=function(t){var e="",r=function(t){goog.isArray(t)?goog.array.forEach(t,r):e+=goog.html.SafeStyle.unwrap(t)};return goog.array.forEach(arguments,r),e?goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(e):goog.html.SafeStyle.EMPTY},goog.html.SafeStyleSheet=function(){this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_="",this.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.SafeStyleSheet.prototype.implementsGoogStringTypedString=!0,goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.SafeStyleSheet.createRule=function(t,e){if(goog.string.internal.contains(t,"<"))throw Error("Selector does not allow '<', got: "+t);var r=t.replace(/('|")((?!\1)[^\r\n\f\\]|\\[\s\S])*\1/g,"");if(!/^[-_a-zA-Z0-9#.:* ,>+~[\]()=^$|]+$/.test(r))throw Error("Selector allows only [-_a-zA-Z0-9#.:* ,>+~[\\]()=^$|] and strings, got: "+t);if(!goog.html.SafeStyleSheet.hasBalancedBrackets_(r))throw Error("() and [] in selector must be balanced, got: "+t);return e instanceof goog.html.SafeStyle||(e=goog.html.SafeStyle.create(e)),t=t+"{"+goog.html.SafeStyle.unwrap(e).replace(/</g,"\\3C ")+"}",goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(t)},goog.html.SafeStyleSheet.hasBalancedBrackets_=function(t){for(var e={"(":")","[":"]"},r=[],n=0;n<t.length;n++){var i=t[n];if(e[i])r.push(e[i]);else if(goog.object.contains(e,i)&&r.pop()!=i)return!1}return 0==r.length},goog.html.SafeStyleSheet.concat=function(t){var e="",r=function(t){goog.isArray(t)?goog.array.forEach(t,r):e+=goog.html.SafeStyleSheet.unwrap(t)};return goog.array.forEach(arguments,r),goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeStyleSheet.fromConstant=function(t){return 0===(t=goog.string.Const.unwrap(t)).length?goog.html.SafeStyleSheet.EMPTY:(goog.asserts.assert(!goog.string.internal.contains(t,"<"),"Forbidden '<' character in style sheet string: "+t),goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(t))},goog.html.SafeStyleSheet.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_},goog.DEBUG&&(goog.html.SafeStyleSheet.prototype.toString=function(){return"SafeStyleSheet{"+this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_+"}"}),goog.html.SafeStyleSheet.unwrap=function(t){return t instanceof goog.html.SafeStyleSheet&&t.constructor===goog.html.SafeStyleSheet&&t.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?t.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_:(goog.asserts.fail("expected object of type SafeStyleSheet, got '"+t+"' of type "+goog.typeOf(t)),"type_error:SafeStyleSheet")},goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse=function(t){return(new goog.html.SafeStyleSheet).initSecurityPrivateDoNotAccessOrElse_(t)},goog.html.SafeStyleSheet.prototype.initSecurityPrivateDoNotAccessOrElse_=function(t){return this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_=t,this},goog.html.SafeStyleSheet.EMPTY=goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(""),goog.labs={},goog.labs.userAgent={},goog.labs.userAgent.util={},goog.labs.userAgent.util.getNativeUserAgentString_=function(){var t=goog.labs.userAgent.util.getNavigator_();return t&&(t=t.userAgent)?t:""},goog.labs.userAgent.util.getNavigator_=function(){return goog.global.navigator},goog.labs.userAgent.util.userAgent_=goog.labs.userAgent.util.getNativeUserAgentString_(),goog.labs.userAgent.util.setUserAgent=function(t){goog.labs.userAgent.util.userAgent_=t||goog.labs.userAgent.util.getNativeUserAgentString_()},goog.labs.userAgent.util.getUserAgent=function(){return goog.labs.userAgent.util.userAgent_},goog.labs.userAgent.util.matchUserAgent=function(t){var e=goog.labs.userAgent.util.getUserAgent();return goog.string.internal.contains(e,t)},goog.labs.userAgent.util.matchUserAgentIgnoreCase=function(t){var e=goog.labs.userAgent.util.getUserAgent();return goog.string.internal.caseInsensitiveContains(e,t)},goog.labs.userAgent.util.extractVersionTuples=function(t){for(var e,r=/(\w[\w ]+)\/([^\s]+)\s*(?:\((.*?)\))?/g,n=[];e=r.exec(t);)n.push([e[1],e[2],e[3]||void 0]);return n},goog.labs.userAgent.browser={},goog.labs.userAgent.browser.matchOpera_=function(){return goog.labs.userAgent.util.matchUserAgent("Opera")},goog.labs.userAgent.browser.matchIE_=function(){return goog.labs.userAgent.util.matchUserAgent("Trident")||goog.labs.userAgent.util.matchUserAgent("MSIE")},goog.labs.userAgent.browser.matchEdgeHtml_=function(){return goog.labs.userAgent.util.matchUserAgent("Edge")},goog.labs.userAgent.browser.matchEdgeChromium_=function(){return goog.labs.userAgent.util.matchUserAgent("Edg/")},goog.labs.userAgent.browser.matchOperaChromium_=function(){return goog.labs.userAgent.util.matchUserAgent("OPR")},goog.labs.userAgent.browser.matchFirefox_=function(){return goog.labs.userAgent.util.matchUserAgent("Firefox")||goog.labs.userAgent.util.matchUserAgent("FxiOS")},goog.labs.userAgent.browser.matchSafari_=function(){return goog.labs.userAgent.util.matchUserAgent("Safari")&&!(goog.labs.userAgent.browser.matchChrome_()||goog.labs.userAgent.browser.matchCoast_()||goog.labs.userAgent.browser.matchOpera_()||goog.labs.userAgent.browser.matchEdgeHtml_()||goog.labs.userAgent.browser.matchEdgeChromium_()||goog.labs.userAgent.browser.matchOperaChromium_()||goog.labs.userAgent.browser.matchFirefox_()||goog.labs.userAgent.browser.isSilk()||goog.labs.userAgent.util.matchUserAgent("Android"))},goog.labs.userAgent.browser.matchCoast_=function(){return goog.labs.userAgent.util.matchUserAgent("Coast")},goog.labs.userAgent.browser.matchIosWebview_=function(){return(goog.labs.userAgent.util.matchUserAgent("iPad")||goog.labs.userAgent.util.matchUserAgent("iPhone"))&&!goog.labs.userAgent.browser.matchSafari_()&&!goog.labs.userAgent.browser.matchChrome_()&&!goog.labs.userAgent.browser.matchCoast_()&&!goog.labs.userAgent.browser.matchFirefox_()&&goog.labs.userAgent.util.matchUserAgent("AppleWebKit")},goog.labs.userAgent.browser.matchChrome_=function(){return(goog.labs.userAgent.util.matchUserAgent("Chrome")||goog.labs.userAgent.util.matchUserAgent("CriOS"))&&!goog.labs.userAgent.browser.matchEdgeHtml_()},goog.labs.userAgent.browser.matchAndroidBrowser_=function(){return goog.labs.userAgent.util.matchUserAgent("Android")&&!(goog.labs.userAgent.browser.isChrome()||goog.labs.userAgent.browser.isFirefox()||goog.labs.userAgent.browser.isOpera()||goog.labs.userAgent.browser.isSilk())},goog.labs.userAgent.browser.isOpera=goog.labs.userAgent.browser.matchOpera_,goog.labs.userAgent.browser.isIE=goog.labs.userAgent.browser.matchIE_,goog.labs.userAgent.browser.isEdge=goog.labs.userAgent.browser.matchEdgeHtml_,goog.labs.userAgent.browser.isEdgeChromium=goog.labs.userAgent.browser.matchEdgeChromium_,goog.labs.userAgent.browser.isOperaChromium=goog.labs.userAgent.browser.matchOperaChromium_,goog.labs.userAgent.browser.isFirefox=goog.labs.userAgent.browser.matchFirefox_,goog.labs.userAgent.browser.isSafari=goog.labs.userAgent.browser.matchSafari_,goog.labs.userAgent.browser.isCoast=goog.labs.userAgent.browser.matchCoast_,goog.labs.userAgent.browser.isIosWebview=goog.labs.userAgent.browser.matchIosWebview_,goog.labs.userAgent.browser.isChrome=goog.labs.userAgent.browser.matchChrome_,goog.labs.userAgent.browser.isAndroidBrowser=goog.labs.userAgent.browser.matchAndroidBrowser_,goog.labs.userAgent.browser.isSilk=function(){return goog.labs.userAgent.util.matchUserAgent("Silk")},goog.labs.userAgent.browser.getVersion=function(){function t(t){return t=goog.array.find(t,n),r[t]||""}var e=goog.labs.userAgent.util.getUserAgent();if(goog.labs.userAgent.browser.isIE())return goog.labs.userAgent.browser.getIEVersion_(e);e=goog.labs.userAgent.util.extractVersionTuples(e);var r={};goog.array.forEach(e,(function(t){r[t[0]]=t[1]}));var n=goog.partial(goog.object.containsKey,r);return goog.labs.userAgent.browser.isOpera()?t(["Version","Opera"]):goog.labs.userAgent.browser.isEdge()?t(["Edge"]):goog.labs.userAgent.browser.isEdgeChromium()?t(["Edg"]):goog.labs.userAgent.browser.isChrome()?t(["Chrome","CriOS"]):(e=e[2])&&e[1]||""},goog.labs.userAgent.browser.isVersionOrHigher=function(t){return 0<=goog.string.internal.compareVersions(goog.labs.userAgent.browser.getVersion(),t)},goog.labs.userAgent.browser.getIEVersion_=function(t){var e=/rv: *([\d\.]*)/.exec(t);if(e&&e[1])return e[1];e="";var r=/MSIE +([\d\.]+)/.exec(t);if(r&&r[1])if(t=/Trident\/(\d.\d)/.exec(t),"7.0"==r[1])if(t&&t[1])switch(t[1]){case"4.0":e="8.0";break;case"5.0":e="9.0";break;case"6.0":e="10.0";break;case"7.0":e="11.0"}else e="7.0";else e=r[1];return e},goog.html.SafeHtml=function(){this.privateDoNotAccessOrElseSafeHtmlWrappedValue_="",this.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_,this.dir_=null},goog.html.SafeHtml.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.SafeHtml.prototype.getDirection=function(){return this.dir_},goog.html.SafeHtml.prototype.implementsGoogStringTypedString=!0,goog.html.SafeHtml.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_.toString()},goog.DEBUG&&(goog.html.SafeHtml.prototype.toString=function(){return"SafeHtml{"+this.privateDoNotAccessOrElseSafeHtmlWrappedValue_+"}"}),goog.html.SafeHtml.unwrap=function(t){return goog.html.SafeHtml.unwrapTrustedHTML(t).toString()},goog.html.SafeHtml.unwrapTrustedHTML=function(t){return t instanceof goog.html.SafeHtml&&t.constructor===goog.html.SafeHtml&&t.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?t.privateDoNotAccessOrElseSafeHtmlWrappedValue_:(goog.asserts.fail("expected object of type SafeHtml, got '"+t+"' of type "+goog.typeOf(t)),"type_error:SafeHtml")},goog.html.SafeHtml.htmlEscape=function(t){if(t instanceof goog.html.SafeHtml)return t;var e="object"==typeof t,r=null;return e&&t.implementsGoogI18nBidiDirectionalString&&(r=t.getDirection()),t=e&&t.implementsGoogStringTypedString?t.getTypedStringValue():String(t),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.htmlEscape(t),r)},goog.html.SafeHtml.htmlEscapePreservingNewlines=function(t){return t instanceof goog.html.SafeHtml?t:(t=goog.html.SafeHtml.htmlEscape(t),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.newLineToBr(goog.html.SafeHtml.unwrap(t)),t.getDirection()))},goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces=function(t){return t instanceof goog.html.SafeHtml?t:(t=goog.html.SafeHtml.htmlEscape(t),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.whitespaceEscape(goog.html.SafeHtml.unwrap(t)),t.getDirection()))},goog.html.SafeHtml.from=goog.html.SafeHtml.htmlEscape,goog.html.SafeHtml.VALID_NAMES_IN_TAG_=/^[a-zA-Z0-9-]+$/,goog.html.SafeHtml.URL_ATTRIBUTES_={action:!0,cite:!0,data:!0,formaction:!0,href:!0,manifest:!0,poster:!0,src:!0},goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_={APPLET:!0,BASE:!0,EMBED:!0,IFRAME:!0,LINK:!0,MATH:!0,META:!0,OBJECT:!0,SCRIPT:!0,STYLE:!0,SVG:!0,TEMPLATE:!0},goog.html.SafeHtml.create=function(t,e,r){return goog.html.SafeHtml.verifyTagName(String(t)),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(String(t),e,r)},goog.html.SafeHtml.verifyTagName=function(t){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(t))throw Error("Invalid tag name <"+t+">.");if(t.toUpperCase()in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_)throw Error("Tag name <"+t+"> is not allowed for SafeHtml.")},goog.html.SafeHtml.createIframe=function(t,e,r,n){t&&goog.html.TrustedResourceUrl.unwrap(t);var i={};return i.src=t||null,i.srcdoc=e&&goog.html.SafeHtml.unwrap(e),t=goog.html.SafeHtml.combineAttributes(i,{sandbox:""},r),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",t,n)},goog.html.SafeHtml.createSandboxIframe=function(t,e,r,n){if(!goog.html.SafeHtml.canUseSandboxIframe())throw Error("The browser does not support sandboxed iframes.");var i={};return i.src=t?goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(t)):null,i.srcdoc=e||null,i.sandbox="",t=goog.html.SafeHtml.combineAttributes(i,{},r),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",t,n)},goog.html.SafeHtml.canUseSandboxIframe=function(){return goog.global.HTMLIFrameElement&&"sandbox"in goog.global.HTMLIFrameElement.prototype},goog.html.SafeHtml.createScriptSrc=function(t,e){return goog.html.TrustedResourceUrl.unwrap(t),t=goog.html.SafeHtml.combineAttributes({src:t},{},e),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script",t)},goog.html.SafeHtml.createScript=function(t,e){for(var r in e){var n=r.toLowerCase();if("language"==n||"src"==n||"text"==n||"type"==n)throw Error('Cannot set "'+n+'" attribute')}for(r="",t=goog.array.concat(t),n=0;n<t.length;n++)r+=goog.html.SafeScript.unwrap(t[n]);return t=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(r,goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script",e,t)},goog.html.SafeHtml.createStyle=function(t,e){e=goog.html.SafeHtml.combineAttributes({type:"text/css"},{},e);var r="";t=goog.array.concat(t);for(var n=0;n<t.length;n++)r+=goog.html.SafeStyleSheet.unwrap(t[n]);return t=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(r,goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("style",e,t)},goog.html.SafeHtml.createMetaRefresh=function(t,e){return t=goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(t)),(goog.labs.userAgent.browser.isIE()||goog.labs.userAgent.browser.isEdge())&&goog.string.internal.contains(t,";")&&(t="'"+t.replace(/'/g,"%27")+"'"),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("meta",{"http-equiv":"refresh",content:(e||0)+"; url="+t})},goog.html.SafeHtml.getAttrNameAndValue_=function(t,e,r){if(r instanceof goog.string.Const)r=goog.string.Const.unwrap(r);else if("style"==e.toLowerCase())r=goog.html.SafeHtml.getStyleValue_(r);else{if(/^on/i.test(e))throw Error('Attribute "'+e+'" requires goog.string.Const value, "'+r+'" given.');if(e.toLowerCase()in goog.html.SafeHtml.URL_ATTRIBUTES_)if(r instanceof goog.html.TrustedResourceUrl)r=goog.html.TrustedResourceUrl.unwrap(r);else if(r instanceof goog.html.SafeUrl)r=goog.html.SafeUrl.unwrap(r);else{if(!goog.isString(r))throw Error('Attribute "'+e+'" on tag "'+t+'" requires goog.html.SafeUrl, goog.string.Const, or string, value "'+r+'" given.');r=goog.html.SafeUrl.sanitize(r).getTypedStringValue()}}return r.implementsGoogStringTypedString&&(r=r.getTypedStringValue()),goog.asserts.assert(goog.isString(r)||goog.isNumber(r),"String or number value expected, got "+typeof r+" with value: "+r),e+'="'+goog.string.internal.htmlEscape(String(r))+'"'},goog.html.SafeHtml.getStyleValue_=function(t){if(!goog.isObject(t))throw Error('The "style" attribute requires goog.html.SafeStyle or map of style properties, '+typeof t+" given: "+t);return t instanceof goog.html.SafeStyle||(t=goog.html.SafeStyle.create(t)),goog.html.SafeStyle.unwrap(t)},goog.html.SafeHtml.createWithDir=function(t,e,r,n){return(e=goog.html.SafeHtml.create(e,r,n)).dir_=t,e},goog.html.SafeHtml.join=function(t,e){var r=(t=goog.html.SafeHtml.htmlEscape(t)).getDirection(),n=[],i=function(t){goog.isArray(t)?goog.array.forEach(t,i):(t=goog.html.SafeHtml.htmlEscape(t),n.push(goog.html.SafeHtml.unwrap(t)),t=t.getDirection(),r==goog.i18n.bidi.Dir.NEUTRAL?r=t:t!=goog.i18n.bidi.Dir.NEUTRAL&&r!=t&&(r=null))};return goog.array.forEach(e,i),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(n.join(goog.html.SafeHtml.unwrap(t)),r)},goog.html.SafeHtml.concat=function(t){return goog.html.SafeHtml.join(goog.html.SafeHtml.EMPTY,Array.prototype.slice.call(arguments))},goog.html.SafeHtml.concatWithDir=function(t,e){var r=goog.html.SafeHtml.concat(goog.array.slice(arguments,1));return r.dir_=t,r},goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse=function(t,e){return(new goog.html.SafeHtml).initSecurityPrivateDoNotAccessOrElse_(t,e)},goog.html.SafeHtml.prototype.initSecurityPrivateDoNotAccessOrElse_=function(t,e){return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY?goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createHTML(t):t,this.dir_=e,this},goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse=function(t,e,r){var n=null,i="<"+t+goog.html.SafeHtml.stringifyAttributes(t,e);return goog.isDefAndNotNull(r)?goog.isArray(r)||(r=[r]):r=[],goog.dom.tags.isVoidTag(t.toLowerCase())?(goog.asserts.assert(!r.length,"Void tag <"+t+"> does not allow content."),i+=">"):(n=goog.html.SafeHtml.concat(r),i+=">"+goog.html.SafeHtml.unwrap(n)+"</"+t+">",n=n.getDirection()),(t=e&&e.dir)&&(n=/^(ltr|rtl|auto)$/i.test(t)?goog.i18n.bidi.Dir.NEUTRAL:null),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(i,n)},goog.html.SafeHtml.stringifyAttributes=function(t,e){var r="";if(e)for(var n in e){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(n))throw Error('Invalid attribute name "'+n+'".');var i=e[n];goog.isDefAndNotNull(i)&&(r+=" "+goog.html.SafeHtml.getAttrNameAndValue_(t,n,i))}return r},goog.html.SafeHtml.combineAttributes=function(t,e,r){var n,i={};for(n in t)goog.asserts.assert(n.toLowerCase()==n,"Must be lower case"),i[n]=t[n];for(n in e)goog.asserts.assert(n.toLowerCase()==n,"Must be lower case"),i[n]=e[n];for(n in r){var o=n.toLowerCase();if(o in t)throw Error('Cannot override "'+o+'" attribute, got "'+n+'" with value "'+r[n]+'"');o in e&&delete i[o],i[n]=r[n]}return i},goog.html.SafeHtml.DOCTYPE_HTML=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("<!DOCTYPE html>",goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.EMPTY=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("",goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.BR=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("<br>",goog.i18n.bidi.Dir.NEUTRAL),goog.html.uncheckedconversions={},goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract=function(t,e,r){return goog.asserts.assertString(goog.string.Const.unwrap(t),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(t)),"must provide non-empty justification"),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(e,r||null)},goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract=function(t,e){return goog.asserts.assertString(goog.string.Const.unwrap(t),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(t)),"must provide non-empty justification"),goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(e)},goog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract=function(t,e){return goog.asserts.assertString(goog.string.Const.unwrap(t),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(t)),"must provide non-empty justification"),goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(e)},goog.html.uncheckedconversions.safeStyleSheetFromStringKnownToSatisfyTypeContract=function(t,e){return goog.asserts.assertString(goog.string.Const.unwrap(t),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(t)),"must provide non-empty justification"),goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(e)},goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract=function(t,e){return goog.asserts.assertString(goog.string.Const.unwrap(t),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(t)),"must provide non-empty justification"),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.uncheckedconversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract=function(t,e){return goog.asserts.assertString(goog.string.Const.unwrap(t),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(t)),"must provide non-empty justification"),goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(e)},goog.dom.safe={},goog.dom.safe.InsertAdjacentHtmlPosition={AFTERBEGIN:"afterbegin",AFTEREND:"afterend",BEFOREBEGIN:"beforebegin",BEFOREEND:"beforeend"},goog.dom.safe.insertAdjacentHtml=function(t,e,r){t.insertAdjacentHTML(e,goog.html.SafeHtml.unwrapTrustedHTML(r))},goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_={MATH:!0,SCRIPT:!0,STYLE:!0,SVG:!0,TEMPLATE:!0},goog.dom.safe.isInnerHtmlCleanupRecursive_=goog.functions.cacheReturnValue((function(){if(goog.DEBUG&&"undefined"==typeof document)return!1;var t=document.createElement("div"),e=document.createElement("div");return e.appendChild(document.createElement("div")),t.appendChild(e),!(goog.DEBUG&&!t.firstChild)&&(e=t.firstChild.firstChild,t.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(goog.html.SafeHtml.EMPTY),!e.parentElement)})),goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse=function(t,e){if(goog.dom.safe.isInnerHtmlCleanupRecursive_())for(;t.lastChild;)t.removeChild(t.lastChild);t.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(e)},goog.dom.safe.setInnerHtml=function(t,e){if(goog.asserts.ENABLE_ASSERTS){var r=t.tagName.toUpperCase();if(goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_[r])throw Error("goog.dom.safe.setInnerHtml cannot be used to set content of "+t.tagName+".")}goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse(t,e)},goog.dom.safe.setOuterHtml=function(t,e){t.outerHTML=goog.html.SafeHtml.unwrapTrustedHTML(e)},goog.dom.safe.setFormElementAction=function(t,e){e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),goog.dom.asserts.assertIsHTMLFormElement(t).action=goog.html.SafeUrl.unwrapTrustedURL(e)},goog.dom.safe.setButtonFormAction=function(t,e){e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),goog.dom.asserts.assertIsHTMLButtonElement(t).formAction=goog.html.SafeUrl.unwrapTrustedURL(e)},goog.dom.safe.setInputFormAction=function(t,e){e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),goog.dom.asserts.assertIsHTMLInputElement(t).formAction=goog.html.SafeUrl.unwrapTrustedURL(e)},goog.dom.safe.setStyle=function(t,e){t.style.cssText=goog.html.SafeStyle.unwrap(e)},goog.dom.safe.documentWrite=function(t,e){t.write(goog.html.SafeHtml.unwrapTrustedHTML(e))},goog.dom.safe.setAnchorHref=function(t,e){goog.dom.asserts.assertIsHTMLAnchorElement(t),e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),t.href=goog.html.SafeUrl.unwrapTrustedURL(e)},goog.dom.safe.setImageSrc=function(t,e){if(goog.dom.asserts.assertIsHTMLImageElement(t),!(e instanceof goog.html.SafeUrl)){var r=/^data:image\//i.test(e);e=goog.html.SafeUrl.sanitizeAssertUnchanged(e,r)}t.src=goog.html.SafeUrl.unwrapTrustedURL(e)},goog.dom.safe.setAudioSrc=function(t,e){if(goog.dom.asserts.assertIsHTMLAudioElement(t),!(e instanceof goog.html.SafeUrl)){var r=/^data:audio\//i.test(e);e=goog.html.SafeUrl.sanitizeAssertUnchanged(e,r)}t.src=goog.html.SafeUrl.unwrapTrustedURL(e)},goog.dom.safe.setVideoSrc=function(t,e){if(goog.dom.asserts.assertIsHTMLVideoElement(t),!(e instanceof goog.html.SafeUrl)){var r=/^data:video\//i.test(e);e=goog.html.SafeUrl.sanitizeAssertUnchanged(e,r)}t.src=goog.html.SafeUrl.unwrapTrustedURL(e)},goog.dom.safe.setEmbedSrc=function(t,e){goog.dom.asserts.assertIsHTMLEmbedElement(t),t.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(e)},goog.dom.safe.setFrameSrc=function(t,e){goog.dom.asserts.assertIsHTMLFrameElement(t),t.src=goog.html.TrustedResourceUrl.unwrapTrustedURL(e)},goog.dom.safe.setIframeSrc=function(t,e){goog.dom.asserts.assertIsHTMLIFrameElement(t),t.src=goog.html.TrustedResourceUrl.unwrapTrustedURL(e)},goog.dom.safe.setIframeSrcdoc=function(t,e){goog.dom.asserts.assertIsHTMLIFrameElement(t),t.srcdoc=goog.html.SafeHtml.unwrapTrustedHTML(e)},goog.dom.safe.setLinkHrefAndRel=function(t,e,r){goog.dom.asserts.assertIsHTMLLinkElement(t),t.rel=r,goog.string.internal.caseInsensitiveContains(r,"stylesheet")?(goog.asserts.assert(e instanceof goog.html.TrustedResourceUrl,'URL must be TrustedResourceUrl because "rel" contains "stylesheet"'),t.href=goog.html.TrustedResourceUrl.unwrapTrustedURL(e)):t.href=e instanceof goog.html.TrustedResourceUrl?goog.html.TrustedResourceUrl.unwrapTrustedURL(e):e instanceof goog.html.SafeUrl?goog.html.SafeUrl.unwrapTrustedURL(e):goog.html.SafeUrl.unwrapTrustedURL(goog.html.SafeUrl.sanitizeAssertUnchanged(e))},goog.dom.safe.setObjectData=function(t,e){goog.dom.asserts.assertIsHTMLObjectElement(t),t.data=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(e)},goog.dom.safe.setScriptSrc=function(t,e){goog.dom.asserts.assertIsHTMLScriptElement(t),t.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(e),(e=goog.getScriptNonce())&&t.setAttribute("nonce",e)},goog.dom.safe.setScriptContent=function(t,e){goog.dom.asserts.assertIsHTMLScriptElement(t),t.text=goog.html.SafeScript.unwrapTrustedScript(e),(e=goog.getScriptNonce())&&t.setAttribute("nonce",e)},goog.dom.safe.setLocationHref=function(t,e){goog.dom.asserts.assertIsLocation(t),e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),t.href=goog.html.SafeUrl.unwrapTrustedURL(e)},goog.dom.safe.assignLocation=function(t,e){goog.dom.asserts.assertIsLocation(t),e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),t.assign(goog.html.SafeUrl.unwrapTrustedURL(e))},goog.dom.safe.replaceLocation=function(t,e){goog.dom.asserts.assertIsLocation(t),e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),t.replace(goog.html.SafeUrl.unwrapTrustedURL(e))},goog.dom.safe.openInWindow=function(t,e,r,n,i){return t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),(e||goog.global).open(goog.html.SafeUrl.unwrapTrustedURL(t),r?goog.string.Const.unwrap(r):"",n,i)},goog.dom.safe.parseFromStringHtml=function(t,e){return goog.dom.safe.parseFromString(t,e,"text/html")},goog.dom.safe.parseFromString=function(t,e,r){return t.parseFromString(goog.html.SafeHtml.unwrapTrustedHTML(e),r)},goog.dom.safe.createImageFromBlob=function(t){if(!/^image\/.*/g.test(t.type))throw Error("goog.dom.safe.createImageFromBlob only accepts MIME type image/.*.");var e=goog.global.URL.createObjectURL(t);return(t=new goog.global.Image).onload=function(){goog.global.URL.revokeObjectURL(e)},goog.dom.safe.setImageSrc(t,goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Image blob URL."),e)),t},goog.string.DETECT_DOUBLE_ESCAPING=!1,goog.string.FORCE_NON_DOM_HTML_UNESCAPING=!1,goog.string.Unicode={NBSP:" "},goog.string.startsWith=goog.string.internal.startsWith,goog.string.endsWith=goog.string.internal.endsWith,goog.string.caseInsensitiveStartsWith=goog.string.internal.caseInsensitiveStartsWith,goog.string.caseInsensitiveEndsWith=goog.string.internal.caseInsensitiveEndsWith,goog.string.caseInsensitiveEquals=goog.string.internal.caseInsensitiveEquals,goog.string.subs=function(t,e){for(var r=t.split("%s"),n="",i=Array.prototype.slice.call(arguments,1);i.length&&1<r.length;)n+=r.shift()+i.shift();return n+r.join("%s")},goog.string.collapseWhitespace=function(t){return t.replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")},goog.string.isEmptyOrWhitespace=goog.string.internal.isEmptyOrWhitespace,goog.string.isEmptyString=function(t){return 0==t.length},goog.string.isEmpty=goog.string.isEmptyOrWhitespace,goog.string.isEmptyOrWhitespaceSafe=function(t){return goog.string.isEmptyOrWhitespace(goog.string.makeSafe(t))},goog.string.isEmptySafe=goog.string.isEmptyOrWhitespaceSafe,goog.string.isBreakingWhitespace=function(t){return!/[^\t\n\r ]/.test(t)},goog.string.isAlpha=function(t){return!/[^a-zA-Z]/.test(t)},goog.string.isNumeric=function(t){return!/[^0-9]/.test(t)},goog.string.isAlphaNumeric=function(t){return!/[^a-zA-Z0-9]/.test(t)},goog.string.isSpace=function(t){return" "==t},goog.string.isUnicodeChar=function(t){return 1==t.length&&" "<=t&&"~">=t||"€"<=t&&"�">=t},goog.string.stripNewlines=function(t){return t.replace(/(\r\n|\r|\n)+/g," ")},goog.string.canonicalizeNewlines=function(t){return t.replace(/(\r\n|\r|\n)/g,"\n")},goog.string.normalizeWhitespace=function(t){return t.replace(/\xa0|\s/g," ")},goog.string.normalizeSpaces=function(t){return t.replace(/\xa0|[ \t]+/g," ")},goog.string.collapseBreakingSpaces=function(t){return t.replace(/[\t\r\n ]+/g," ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,"")},goog.string.trim=goog.string.internal.trim,goog.string.trimLeft=function(t){return t.replace(/^[\s\xa0]+/,"")},goog.string.trimRight=function(t){return t.replace(/[\s\xa0]+$/,"")},goog.string.caseInsensitiveCompare=goog.string.internal.caseInsensitiveCompare,goog.string.numberAwareCompare_=function(t,e,r){if(t==e)return 0;if(!t)return-1;if(!e)return 1;for(var n=t.toLowerCase().match(r),i=e.toLowerCase().match(r),o=Math.min(n.length,i.length),a=0;a<o;a++){r=n[a];var s=i[a];if(r!=s)return t=parseInt(r,10),!isNaN(t)&&(e=parseInt(s,10),!isNaN(e)&&t-e)?t-e:r<s?-1:1}return n.length!=i.length?n.length-i.length:t<e?-1:1},goog.string.intAwareCompare=function(t,e){return goog.string.numberAwareCompare_(t,e,/\d+|\D+/g)},goog.string.floatAwareCompare=function(t,e){return goog.string.numberAwareCompare_(t,e,/\d+|\.\d+|\D+/g)},goog.string.numerateCompare=goog.string.floatAwareCompare,goog.string.urlEncode=function(t){return encodeURIComponent(String(t))},goog.string.urlDecode=function(t){return decodeURIComponent(t.replace(/\+/g," "))},goog.string.newLineToBr=goog.string.internal.newLineToBr,goog.string.htmlEscape=function(t,e){return t=goog.string.internal.htmlEscape(t,e),goog.string.DETECT_DOUBLE_ESCAPING&&(t=t.replace(goog.string.E_RE_,"&#101;")),t},goog.string.E_RE_=/e/g,goog.string.unescapeEntities=function(t){return goog.string.contains(t,"&")?!goog.string.FORCE_NON_DOM_HTML_UNESCAPING&&"document"in goog.global?goog.string.unescapeEntitiesUsingDom_(t):goog.string.unescapePureXmlEntities_(t):t},goog.string.unescapeEntitiesWithDocument=function(t,e){return goog.string.contains(t,"&")?goog.string.unescapeEntitiesUsingDom_(t,e):t},goog.string.unescapeEntitiesUsingDom_=function(t,e){var r={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"'},n=e?e.createElement("div"):goog.global.document.createElement("div");return t.replace(goog.string.HTML_ENTITY_PATTERN_,(function(t,e){var i=r[t];return i||("#"==e.charAt(0)&&(e=Number("0"+e.substr(1)),isNaN(e)||(i=String.fromCharCode(e))),i||(goog.dom.safe.setInnerHtml(n,goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Single HTML entity."),t+" ")),i=n.firstChild.nodeValue.slice(0,-1)),r[t]=i)}))},goog.string.unescapePureXmlEntities_=function(t){return t.replace(/&([^;]+);/g,(function(t,e){switch(e){case"amp":return"&";case"lt":return"<";case"gt":return">";case"quot":return'"';default:return"#"!=e.charAt(0)||(e=Number("0"+e.substr(1)),isNaN(e))?t:String.fromCharCode(e)}}))},goog.string.HTML_ENTITY_PATTERN_=/&([^;\s<&]+);?/g,goog.string.whitespaceEscape=function(t,e){return goog.string.newLineToBr(t.replace(/ /g," &#160;"),e)},goog.string.preserveSpaces=function(t){return t.replace(/(^|[\n ]) /g,"$1"+goog.string.Unicode.NBSP)},goog.string.stripQuotes=function(t,e){for(var r=e.length,n=0;n<r;n++){var i=1==r?e:e.charAt(n);if(t.charAt(0)==i&&t.charAt(t.length-1)==i)return t.substring(1,t.length-1)}return t},goog.string.truncate=function(t,e,r){return r&&(t=goog.string.unescapeEntities(t)),t.length>e&&(t=t.substring(0,e-3)+"..."),r&&(t=goog.string.htmlEscape(t)),t},goog.string.truncateMiddle=function(t,e,r,n){if(r&&(t=goog.string.unescapeEntities(t)),n&&t.length>e){n>e&&(n=e);var i=t.length-n;t=t.substring(0,e-n)+"..."+t.substring(i)}else t.length>e&&(n=Math.floor(e/2),i=t.length-n,t=t.substring(0,n+e%2)+"..."+t.substring(i));return r&&(t=goog.string.htmlEscape(t)),t},goog.string.specialEscapeChars_={"\0":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},goog.string.jsEscapeCache_={"'":"\\'"},goog.string.quote=function(t){t=String(t);for(var e=['"'],r=0;r<t.length;r++){var n=t.charAt(r),i=n.charCodeAt(0);e[r+1]=goog.string.specialEscapeChars_[n]||(31<i&&127>i?n:goog.string.escapeChar(n))}return e.push('"'),e.join("")},goog.string.escapeString=function(t){for(var e=[],r=0;r<t.length;r++)e[r]=goog.string.escapeChar(t.charAt(r));return e.join("")},goog.string.escapeChar=function(t){if(t in goog.string.jsEscapeCache_)return goog.string.jsEscapeCache_[t];if(t in goog.string.specialEscapeChars_)return goog.string.jsEscapeCache_[t]=goog.string.specialEscapeChars_[t];var e=t.charCodeAt(0);if(31<e&&127>e)var r=t;else 256>e?(r="\\x",(16>e||256<e)&&(r+="0")):(r="\\u",4096>e&&(r+="0")),r+=e.toString(16).toUpperCase();return goog.string.jsEscapeCache_[t]=r},goog.string.contains=goog.string.internal.contains,goog.string.caseInsensitiveContains=goog.string.internal.caseInsensitiveContains,goog.string.countOf=function(t,e){return t&&e?t.split(e).length-1:0},goog.string.removeAt=function(t,e,r){var n=t;return 0<=e&&e<t.length&&0<r&&(n=t.substr(0,e)+t.substr(e+r,t.length-e-r)),n},goog.string.remove=function(t,e){return t.replace(e,"")},goog.string.removeAll=function(t,e){return e=new RegExp(goog.string.regExpEscape(e),"g"),t.replace(e,"")},goog.string.replaceAll=function(t,e,r){return e=new RegExp(goog.string.regExpEscape(e),"g"),t.replace(e,r.replace(/\$/g,"$$$$"))},goog.string.regExpEscape=function(t){return String(t).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")},goog.string.repeat=String.prototype.repeat?function(t,e){return t.repeat(e)}:function(t,e){return Array(e+1).join(t)},goog.string.padNumber=function(t,e,r){return-1==(r=(t=goog.isDef(r)?t.toFixed(r):String(t)).indexOf("."))&&(r=t.length),goog.string.repeat("0",Math.max(0,e-r))+t},goog.string.makeSafe=function(t){return null==t?"":String(t)},goog.string.buildString=function(t){return Array.prototype.join.call(arguments,"")},goog.string.getRandomString=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^goog.now()).toString(36)},goog.string.compareVersions=goog.string.internal.compareVersions,goog.string.hashCode=function(t){for(var e=0,r=0;r<t.length;++r)e=31*e+t.charCodeAt(r)>>>0;return e},goog.string.uniqueStringCounter_=2147483648*Math.random()|0,goog.string.createUniqueString=function(){return"goog_"+goog.string.uniqueStringCounter_++},goog.string.toNumber=function(t){var e=Number(t);return 0==e&&goog.string.isEmptyOrWhitespace(t)?NaN:e},goog.string.isLowerCamelCase=function(t){return/^[a-z]+([A-Z][a-z]*)*$/.test(t)},goog.string.isUpperCamelCase=function(t){return/^([A-Z][a-z]*)+$/.test(t)},goog.string.toCamelCase=function(t){return String(t).replace(/\-([a-z])/g,(function(t,e){return e.toUpperCase()}))},goog.string.toSelectorCase=function(t){return String(t).replace(/([A-Z])/g,"-$1").toLowerCase()},goog.string.toTitleCase=function(t,e){return e=goog.isString(e)?goog.string.regExpEscape(e):"\\s",t.replace(new RegExp("(^"+(e?"|["+e+"]+":"")+")([a-z])","g"),(function(t,e,r){return e+r.toUpperCase()}))},goog.string.capitalize=function(t){return String(t.charAt(0)).toUpperCase()+String(t.substr(1)).toLowerCase()},goog.string.parseInt=function(t){return isFinite(t)&&(t=String(t)),goog.isString(t)?/^\s*-?0x/i.test(t)?parseInt(t,16):parseInt(t,10):NaN},goog.string.splitLimit=function(t,e,r){t=t.split(e);for(var n=[];0<r&&t.length;)n.push(t.shift()),r--;return t.length&&n.push(t.join(e)),n},goog.string.lastComponent=function(t,e){if(!e)return t;"string"==typeof e&&(e=[e]);for(var r=-1,n=0;n<e.length;n++)if(""!=e[n]){var i=t.lastIndexOf(e[n]);i>r&&(r=i)}return-1==r?t:t.slice(r+1)},goog.string.editDistance=function(t,e){var r=[],n=[];if(t==e)return 0;if(!t.length||!e.length)return Math.max(t.length,e.length);for(var i=0;i<e.length+1;i++)r[i]=i;for(i=0;i<t.length;i++){n[0]=i+1;for(var o=0;o<e.length;o++)n[o+1]=Math.min(n[o]+1,r[o+1]+1,r[o]+Number(t[i]!=e[o]));for(o=0;o<r.length;o++)r[o]=n[o]}return n[e.length]},goog.labs.userAgent.engine={},goog.labs.userAgent.engine.isPresto=function(){return goog.labs.userAgent.util.matchUserAgent("Presto")},goog.labs.userAgent.engine.isTrident=function(){return goog.labs.userAgent.util.matchUserAgent("Trident")||goog.labs.userAgent.util.matchUserAgent("MSIE")},goog.labs.userAgent.engine.isEdge=function(){return goog.labs.userAgent.util.matchUserAgent("Edge")},goog.labs.userAgent.engine.isWebKit=function(){return goog.labs.userAgent.util.matchUserAgentIgnoreCase("WebKit")&&!goog.labs.userAgent.engine.isEdge()},goog.labs.userAgent.engine.isGecko=function(){return goog.labs.userAgent.util.matchUserAgent("Gecko")&&!goog.labs.userAgent.engine.isWebKit()&&!goog.labs.userAgent.engine.isTrident()&&!goog.labs.userAgent.engine.isEdge()},goog.labs.userAgent.engine.getVersion=function(){var t=goog.labs.userAgent.util.getUserAgent();if(t){t=goog.labs.userAgent.util.extractVersionTuples(t);var e,r=goog.labs.userAgent.engine.getEngineTuple_(t);if(r)return"Gecko"==r[0]?goog.labs.userAgent.engine.getVersionForKey_(t,"Firefox"):r[1];if((t=t[0])&&(e=t[2])&&(e=/Trident\/([^\s;]+)/.exec(e)))return e[1]}return""},goog.labs.userAgent.engine.getEngineTuple_=function(t){if(!goog.labs.userAgent.engine.isEdge())return t[1];for(var e=0;e<t.length;e++){var r=t[e];if("Edge"==r[0])return r}},goog.labs.userAgent.engine.isVersionOrHigher=function(t){return 0<=goog.string.compareVersions(goog.labs.userAgent.engine.getVersion(),t)},goog.labs.userAgent.engine.getVersionForKey_=function(t,e){return(t=goog.array.find(t,(function(t){return e==t[0]})))&&t[1]||""},goog.labs.userAgent.platform={},goog.labs.userAgent.platform.isAndroid=function(){return goog.labs.userAgent.util.matchUserAgent("Android")},goog.labs.userAgent.platform.isIpod=function(){return goog.labs.userAgent.util.matchUserAgent("iPod")},goog.labs.userAgent.platform.isIphone=function(){return goog.labs.userAgent.util.matchUserAgent("iPhone")&&!goog.labs.userAgent.util.matchUserAgent("iPod")&&!goog.labs.userAgent.util.matchUserAgent("iPad")},goog.labs.userAgent.platform.isIpad=function(){return goog.labs.userAgent.util.matchUserAgent("iPad")},goog.labs.userAgent.platform.isIos=function(){return goog.labs.userAgent.platform.isIphone()||goog.labs.userAgent.platform.isIpad()||goog.labs.userAgent.platform.isIpod()},goog.labs.userAgent.platform.isMacintosh=function(){return goog.labs.userAgent.util.matchUserAgent("Macintosh")},goog.labs.userAgent.platform.isLinux=function(){return goog.labs.userAgent.util.matchUserAgent("Linux")},goog.labs.userAgent.platform.isWindows=function(){return goog.labs.userAgent.util.matchUserAgent("Windows")},goog.labs.userAgent.platform.isChromeOS=function(){return goog.labs.userAgent.util.matchUserAgent("CrOS")},goog.labs.userAgent.platform.isChromecast=function(){return goog.labs.userAgent.util.matchUserAgent("CrKey")},goog.labs.userAgent.platform.isKaiOS=function(){return goog.labs.userAgent.util.matchUserAgentIgnoreCase("KaiOS")},goog.labs.userAgent.platform.isGo2Phone=function(){return goog.labs.userAgent.util.matchUserAgentIgnoreCase("GAFP")},goog.labs.userAgent.platform.getVersion=function(){var t=goog.labs.userAgent.util.getUserAgent(),e="";return goog.labs.userAgent.platform.isWindows()?e=(t=(e=/Windows (?:NT|Phone) ([0-9.]+)/).exec(t))?t[1]:"0.0":goog.labs.userAgent.platform.isIos()?e=(t=(e=/(?:iPhone|iPod|iPad|CPU)\s+OS\s+(\S+)/).exec(t))&&t[1].replace(/_/g,"."):goog.labs.userAgent.platform.isMacintosh()?e=(t=(e=/Mac OS X ([0-9_.]+)/).exec(t))?t[1].replace(/_/g,"."):"10":goog.labs.userAgent.platform.isKaiOS()?e=(t=(e=/(?:KaiOS)\/(\S+)/i).exec(t))&&t[1]:goog.labs.userAgent.platform.isAndroid()?e=(t=(e=/Android\s+([^\);]+)(\)|;)/).exec(t))&&t[1]:goog.labs.userAgent.platform.isChromeOS()&&(e=(t=(e=/(?:CrOS\s+(?:i686|x86_64)\s+([0-9.]+))/).exec(t))&&t[1]),e||""},goog.labs.userAgent.platform.isVersionOrHigher=function(t){return 0<=goog.string.compareVersions(goog.labs.userAgent.platform.getVersion(),t)},goog.reflect={},goog.reflect.object=function(t,e){return e},goog.reflect.objectProperty=function(t,e){return t},goog.reflect.sinkValue=function(t){return goog.reflect.sinkValue[" "](t),t},goog.reflect.sinkValue[" "]=goog.nullFunction,goog.reflect.canAccessProperty=function(t,e){try{return goog.reflect.sinkValue(t[e]),!0}catch(t){}return!1},goog.reflect.cache=function(t,e,r,n){return n=n?n(e):e,Object.prototype.hasOwnProperty.call(t,n)?t[n]:t[n]=r(e)},goog.userAgent={},goog.userAgent.ASSUME_IE=!1,goog.userAgent.ASSUME_EDGE=!1,goog.userAgent.ASSUME_GECKO=!1,goog.userAgent.ASSUME_WEBKIT=!1,goog.userAgent.ASSUME_MOBILE_WEBKIT=!1,goog.userAgent.ASSUME_OPERA=!1,goog.userAgent.ASSUME_ANY_VERSION=!1,goog.userAgent.BROWSER_KNOWN_=goog.userAgent.ASSUME_IE||goog.userAgent.ASSUME_EDGE||goog.userAgent.ASSUME_GECKO||goog.userAgent.ASSUME_MOBILE_WEBKIT||goog.userAgent.ASSUME_WEBKIT||goog.userAgent.ASSUME_OPERA,goog.userAgent.getUserAgentString=function(){return goog.labs.userAgent.util.getUserAgent()},goog.userAgent.getNavigatorTyped=function(){return goog.global.navigator||null},goog.userAgent.getNavigator=function(){return goog.userAgent.getNavigatorTyped()},goog.userAgent.OPERA=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_OPERA:goog.labs.userAgent.browser.isOpera(),goog.userAgent.IE=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_IE:goog.labs.userAgent.browser.isIE(),goog.userAgent.EDGE=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_EDGE:goog.labs.userAgent.engine.isEdge(),goog.userAgent.EDGE_OR_IE=goog.userAgent.EDGE||goog.userAgent.IE,goog.userAgent.GECKO=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_GECKO:goog.labs.userAgent.engine.isGecko(),goog.userAgent.WEBKIT=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_WEBKIT||goog.userAgent.ASSUME_MOBILE_WEBKIT:goog.labs.userAgent.engine.isWebKit(),goog.userAgent.isMobile_=function(){return goog.userAgent.WEBKIT&&goog.labs.userAgent.util.matchUserAgent("Mobile")},goog.userAgent.MOBILE=goog.userAgent.ASSUME_MOBILE_WEBKIT||goog.userAgent.isMobile_(),goog.userAgent.SAFARI=goog.userAgent.WEBKIT,goog.userAgent.determinePlatform_=function(){var t=goog.userAgent.getNavigatorTyped();return t&&t.platform||""},goog.userAgent.PLATFORM=goog.userAgent.determinePlatform_(),goog.userAgent.ASSUME_MAC=!1,goog.userAgent.ASSUME_WINDOWS=!1,goog.userAgent.ASSUME_LINUX=!1,goog.userAgent.ASSUME_X11=!1,goog.userAgent.ASSUME_ANDROID=!1,goog.userAgent.ASSUME_IPHONE=!1,goog.userAgent.ASSUME_IPAD=!1,goog.userAgent.ASSUME_IPOD=!1,goog.userAgent.ASSUME_KAIOS=!1,goog.userAgent.ASSUME_GO2PHONE=!1,goog.userAgent.PLATFORM_KNOWN_=goog.userAgent.ASSUME_MAC||goog.userAgent.ASSUME_WINDOWS||goog.userAgent.ASSUME_LINUX||goog.userAgent.ASSUME_X11||goog.userAgent.ASSUME_ANDROID||goog.userAgent.ASSUME_IPHONE||goog.userAgent.ASSUME_IPAD||goog.userAgent.ASSUME_IPOD,goog.userAgent.MAC=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_MAC:goog.labs.userAgent.platform.isMacintosh(),goog.userAgent.WINDOWS=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_WINDOWS:goog.labs.userAgent.platform.isWindows(),goog.userAgent.isLegacyLinux_=function(){return goog.labs.userAgent.platform.isLinux()||goog.labs.userAgent.platform.isChromeOS()},goog.userAgent.LINUX=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_LINUX:goog.userAgent.isLegacyLinux_(),goog.userAgent.isX11_=function(){var t=goog.userAgent.getNavigatorTyped();return!!t&&goog.string.contains(t.appVersion||"","X11")},goog.userAgent.X11=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_X11:goog.userAgent.isX11_(),goog.userAgent.ANDROID=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_ANDROID:goog.labs.userAgent.platform.isAndroid(),goog.userAgent.IPHONE=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPHONE:goog.labs.userAgent.platform.isIphone(),goog.userAgent.IPAD=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPAD:goog.labs.userAgent.platform.isIpad(),goog.userAgent.IPOD=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPOD:goog.labs.userAgent.platform.isIpod(),goog.userAgent.IOS=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPHONE||goog.userAgent.ASSUME_IPAD||goog.userAgent.ASSUME_IPOD:goog.labs.userAgent.platform.isIos(),goog.userAgent.KAIOS=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_KAIOS:goog.labs.userAgent.platform.isKaiOS(),goog.userAgent.GO2PHONE=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_GO2PHONE:goog.labs.userAgent.platform.isGo2Phone(),goog.userAgent.determineVersion_=function(){var t="",e=goog.userAgent.getVersionRegexResult_();return e&&(t=e?e[1]:""),goog.userAgent.IE&&(null!=(e=goog.userAgent.getDocumentMode_())&&e>parseFloat(t))?String(e):t},goog.userAgent.getVersionRegexResult_=function(){var t=goog.userAgent.getUserAgentString();return goog.userAgent.GECKO?/rv:([^\);]+)(\)|;)/.exec(t):goog.userAgent.EDGE?/Edge\/([\d\.]+)/.exec(t):goog.userAgent.IE?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(t):goog.userAgent.WEBKIT?/WebKit\/(\S+)/.exec(t):goog.userAgent.OPERA?/(?:Version)[ \/]?(\S+)/.exec(t):void 0},goog.userAgent.getDocumentMode_=function(){var t=goog.global.document;return t?t.documentMode:void 0},goog.userAgent.VERSION=goog.userAgent.determineVersion_(),goog.userAgent.compare=function(t,e){return goog.string.compareVersions(t,e)},goog.userAgent.isVersionOrHigherCache_={},goog.userAgent.isVersionOrHigher=function(t){return goog.userAgent.ASSUME_ANY_VERSION||goog.reflect.cache(goog.userAgent.isVersionOrHigherCache_,t,(function(){return 0<=goog.string.compareVersions(goog.userAgent.VERSION,t)}))},goog.userAgent.isVersion=goog.userAgent.isVersionOrHigher,goog.userAgent.isDocumentModeOrHigher=function(t){return Number(goog.userAgent.DOCUMENT_MODE)>=t},goog.userAgent.isDocumentMode=goog.userAgent.isDocumentModeOrHigher,goog.userAgent.DOCUMENT_MODE=function(){if(goog.global.document&&goog.userAgent.IE)return goog.userAgent.getDocumentMode_()}(),goog.userAgent.product={},goog.userAgent.product.ASSUME_FIREFOX=!1,goog.userAgent.product.ASSUME_IPHONE=!1,goog.userAgent.product.ASSUME_IPAD=!1,goog.userAgent.product.ASSUME_ANDROID=!1,goog.userAgent.product.ASSUME_CHROME=!1,goog.userAgent.product.ASSUME_SAFARI=!1,goog.userAgent.product.PRODUCT_KNOWN_=goog.userAgent.ASSUME_IE||goog.userAgent.ASSUME_EDGE||goog.userAgent.ASSUME_OPERA||goog.userAgent.product.ASSUME_FIREFOX||goog.userAgent.product.ASSUME_IPHONE||goog.userAgent.product.ASSUME_IPAD||goog.userAgent.product.ASSUME_ANDROID||goog.userAgent.product.ASSUME_CHROME||goog.userAgent.product.ASSUME_SAFARI,goog.userAgent.product.OPERA=goog.userAgent.OPERA,goog.userAgent.product.IE=goog.userAgent.IE,goog.userAgent.product.EDGE=goog.userAgent.EDGE,goog.userAgent.product.FIREFOX=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_FIREFOX:goog.labs.userAgent.browser.isFirefox(),goog.userAgent.product.isIphoneOrIpod_=function(){return goog.labs.userAgent.platform.isIphone()||goog.labs.userAgent.platform.isIpod()},goog.userAgent.product.IPHONE=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPHONE:goog.userAgent.product.isIphoneOrIpod_(),goog.userAgent.product.IPAD=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPAD:goog.labs.userAgent.platform.isIpad(),goog.userAgent.product.ANDROID=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_ANDROID:goog.labs.userAgent.browser.isAndroidBrowser(),goog.userAgent.product.CHROME=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_CHROME:goog.labs.userAgent.browser.isChrome(),goog.userAgent.product.isSafariDesktop_=function(){return goog.labs.userAgent.browser.isSafari()&&!goog.labs.userAgent.platform.isIos()},goog.userAgent.product.SAFARI=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_SAFARI:goog.userAgent.product.isSafariDesktop_(),goog.crypt.base64={},goog.crypt.base64.DEFAULT_ALPHABET_COMMON_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",goog.crypt.base64.ENCODED_VALS=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_+"+/=",goog.crypt.base64.ENCODED_VALS_WEBSAFE=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_+"-_.",goog.crypt.base64.Alphabet={DEFAULT:0,NO_PADDING:1,WEBSAFE:2,WEBSAFE_DOT_PADDING:3,WEBSAFE_NO_PADDING:4},goog.crypt.base64.paddingChars_="=.",goog.crypt.base64.isPadding_=function(t){return goog.string.contains(goog.crypt.base64.paddingChars_,t)},goog.crypt.base64.byteToCharMaps_={};goog.crypt.base64.charToByteMap_=null,goog.crypt.base64.ASSUME_NATIVE_SUPPORT_=goog.userAgent.GECKO||goog.userAgent.WEBKIT&&!goog.userAgent.product.SAFARI||goog.userAgent.OPERA,goog.crypt.base64.HAS_NATIVE_ENCODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||"function"==typeof goog.global.btoa,goog.crypt.base64.HAS_NATIVE_DECODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||!goog.userAgent.product.SAFARI&&!goog.userAgent.IE&&"function"==typeof goog.global.atob,goog.crypt.base64.encodeByteArray=function(t,e){goog.asserts.assert(goog.isArrayLike(t),"encodeByteArray takes an array as a parameter"),void 0===e&&(e=goog.crypt.base64.Alphabet.DEFAULT),goog.crypt.base64.init_(),e=goog.crypt.base64.byteToCharMaps_[e];for(var r=[],n=0;n<t.length;n+=3){var i=t[n],o=n+1<t.length,a=o?t[n+1]:0,s=n+2<t.length,u=s?t[n+2]:0,c=i>>2;i=(3&i)<<4|a>>4,a=(15&a)<<2|u>>6,u&=63,s||(u=64,o||(a=64)),r.push(e[c],e[i],e[a]||"",e[u]||"")}return r.join("")},goog.crypt.base64.encodeString=function(t,e){return goog.crypt.base64.HAS_NATIVE_ENCODE_&&!e?goog.global.btoa(t):goog.crypt.base64.encodeByteArray(goog.crypt.stringToByteArray(t),e)},goog.crypt.base64.decodeString=function(t,e){if(goog.crypt.base64.HAS_NATIVE_DECODE_&&!e)return goog.global.atob(t);var r="";return goog.crypt.base64.decodeStringInternal_(t,(function(t){r+=String.fromCharCode(t)})),r},goog.crypt.base64.decodeStringToByteArray=function(t,e){var r=[];return goog.crypt.base64.decodeStringInternal_(t,(function(t){r.push(t)})),r},goog.crypt.base64.decodeStringToUint8Array=function(t){goog.asserts.assert(!goog.userAgent.IE||goog.userAgent.isVersionOrHigher("10"),"Browser does not support typed arrays");var e=t.length,r=3*e/4;r%3?r=Math.floor(r):goog.crypt.base64.isPadding_(t[e-1])&&(r=goog.crypt.base64.isPadding_(t[e-2])?r-2:r-1);var n=new Uint8Array(r),i=0;return goog.crypt.base64.decodeStringInternal_(t,(function(t){n[i++]=t})),n.subarray(0,i)},goog.crypt.base64.decodeStringInternal_=function(t,e){function r(e){for(;n<t.length;){var r=t.charAt(n++),i=goog.crypt.base64.charToByteMap_[r];if(null!=i)return i;if(!goog.string.isEmptyOrWhitespace(r))throw Error("Unknown base64 encoding at char: "+r)}return e}goog.crypt.base64.init_();for(var n=0;;){var i=r(-1),o=r(0),a=r(64),s=r(64);if(64===s&&-1===i)break;e(i<<2|o>>4),64!=a&&(e(o<<4&240|a>>2),64!=s&&e(a<<6&192|s))}},goog.crypt.base64.init_=function(){if(!goog.crypt.base64.charToByteMap_){goog.crypt.base64.charToByteMap_={};for(var t=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_.split(""),e=["+/=","+/","-_=","-_.","-_"],r=0;5>r;r++){var n=t.concat(e[r].split(""));goog.crypt.base64.byteToCharMaps_[r]=n;for(var i=0;i<n.length;i++){var o=n[i],a=goog.crypt.base64.charToByteMap_[o];void 0===a?goog.crypt.base64.charToByteMap_[o]=i:goog.asserts.assert(a===i)}}}},jspb.utils={},jspb.utils.split64Low=0,jspb.utils.split64High=0,jspb.utils.splitUint64=function(t){var e=t>>>0;t=Math.floor((t-e)/jspb.BinaryConstants.TWO_TO_32)>>>0,jspb.utils.split64Low=e,jspb.utils.split64High=t},jspb.utils.splitInt64=function(t){var e=0>t,r=(t=Math.abs(t))>>>0;t=Math.floor((t-r)/jspb.BinaryConstants.TWO_TO_32),t>>>=0,e&&(t=~t>>>0,4294967295<(r=1+(~r>>>0))&&(r=0,4294967295<++t&&(t=0))),jspb.utils.split64Low=r,jspb.utils.split64High=t},jspb.utils.splitZigzag64=function(t){var e=0>t;t=2*Math.abs(t),jspb.utils.splitUint64(t),t=jspb.utils.split64Low;var r=jspb.utils.split64High;e&&(0==t?0==r?r=t=4294967295:(r--,t=4294967295):t--),jspb.utils.split64Low=t,jspb.utils.split64High=r},jspb.utils.splitFloat32=function(t){var e=0>t?1:0;if(0===(t=e?-t:t))0<1/t?(jspb.utils.split64High=0,jspb.utils.split64Low=0):(jspb.utils.split64High=0,jspb.utils.split64Low=2147483648);else if(isNaN(t))jspb.utils.split64High=0,jspb.utils.split64Low=2147483647;else if(t>jspb.BinaryConstants.FLOAT32_MAX)jspb.utils.split64High=0,jspb.utils.split64Low=(e<<31|2139095040)>>>0;else if(t<jspb.BinaryConstants.FLOAT32_MIN)t=Math.round(t/Math.pow(2,-149)),jspb.utils.split64High=0,jspb.utils.split64Low=(e<<31|t)>>>0;else{var r=Math.floor(Math.log(t)/Math.LN2);t*=Math.pow(2,-r),16777216<=(t=Math.round(t*jspb.BinaryConstants.TWO_TO_23))&&++r,jspb.utils.split64High=0,jspb.utils.split64Low=(e<<31|r+127<<23|8388607&t)>>>0}},jspb.utils.splitFloat64=function(t){var e=0>t?1:0;if(0===(t=e?-t:t))jspb.utils.split64High=0<1/t?0:2147483648,jspb.utils.split64Low=0;else if(isNaN(t))jspb.utils.split64High=2147483647,jspb.utils.split64Low=4294967295;else if(t>jspb.BinaryConstants.FLOAT64_MAX)jspb.utils.split64High=(e<<31|2146435072)>>>0,jspb.utils.split64Low=0;else if(t<jspb.BinaryConstants.FLOAT64_MIN){var r=t/Math.pow(2,-1074);t=r/jspb.BinaryConstants.TWO_TO_32,jspb.utils.split64High=(e<<31|t)>>>0,jspb.utils.split64Low=r>>>0}else{var n=0;if(2<=(r=t))for(;2<=r&&1023>n;)n++,r/=2;else for(;1>r&&-1022<n;)r*=2,n--;t=(r=t*Math.pow(2,-n))*jspb.BinaryConstants.TWO_TO_20&1048575,r=r*jspb.BinaryConstants.TWO_TO_52>>>0,jspb.utils.split64High=(e<<31|n+1023<<20|t)>>>0,jspb.utils.split64Low=r}},jspb.utils.splitHash64=function(t){var e=t.charCodeAt(0),r=t.charCodeAt(1),n=t.charCodeAt(2),i=t.charCodeAt(3),o=t.charCodeAt(4),a=t.charCodeAt(5),s=t.charCodeAt(6);t=t.charCodeAt(7),jspb.utils.split64Low=e+(r<<8)+(n<<16)+(i<<24)>>>0,jspb.utils.split64High=o+(a<<8)+(s<<16)+(t<<24)>>>0},jspb.utils.joinUint64=function(t,e){return e*jspb.BinaryConstants.TWO_TO_32+(t>>>0)},jspb.utils.joinInt64=function(t,e){var r=2147483648&e;return r&&(e=~e>>>0,0==(t=1+~t>>>0)&&(e=e+1>>>0)),t=jspb.utils.joinUint64(t,e),r?-t:t},jspb.utils.toZigzag64=function(t,e,r){var n=e>>31;return r(t<<1^n,(e<<1|t>>>31)^n)},jspb.utils.joinZigzag64=function(t,e){return jspb.utils.fromZigzag64(t,e,jspb.utils.joinInt64)},jspb.utils.fromZigzag64=function(t,e,r){var n=-(1&t);return r((t>>>1|e<<31)^n,e>>>1^n)},jspb.utils.joinFloat32=function(t,e){e=2*(t>>31)+1;var r=t>>>23&255;return t&=8388607,255==r?t?NaN:1/0*e:0==r?e*Math.pow(2,-149)*t:e*Math.pow(2,r-150)*(t+Math.pow(2,23))},jspb.utils.joinFloat64=function(t,e){var r=2*(e>>31)+1,n=e>>>20&2047;return t=jspb.BinaryConstants.TWO_TO_32*(1048575&e)+t,2047==n?t?NaN:1/0*r:0==n?r*Math.pow(2,-1074)*t:r*Math.pow(2,n-1075)*(t+jspb.BinaryConstants.TWO_TO_52)},jspb.utils.joinHash64=function(t,e){return String.fromCharCode(t>>>0&255,t>>>8&255,t>>>16&255,t>>>24&255,e>>>0&255,e>>>8&255,e>>>16&255,e>>>24&255)},jspb.utils.DIGITS="0123456789abcdef".split(""),jspb.utils.ZERO_CHAR_CODE_=48,jspb.utils.A_CHAR_CODE_=97,jspb.utils.joinUnsignedDecimalString=function(t,e){function r(t,e){return t=t?String(t):"",e?"0000000".slice(t.length)+t:t}if(2097151>=e)return""+jspb.utils.joinUint64(t,e);var n=(t>>>24|e<<8)>>>0&16777215;return t=(16777215&t)+6777216*n+6710656*(e=e>>16&65535),n+=8147497*e,e*=2,1e7<=t&&(n+=Math.floor(t/1e7),t%=1e7),1e7<=n&&(e+=Math.floor(n/1e7),n%=1e7),r(e,0)+r(n,e)+r(t,1)},jspb.utils.joinSignedDecimalString=function(t,e){var r=2147483648&e;return r&&(e=~e+(0==(t=1+~t>>>0)?1:0)>>>0),t=jspb.utils.joinUnsignedDecimalString(t,e),r?"-"+t:t},jspb.utils.hash64ToDecimalString=function(t,e){jspb.utils.splitHash64(t),t=jspb.utils.split64Low;var r=jspb.utils.split64High;return e?jspb.utils.joinSignedDecimalString(t,r):jspb.utils.joinUnsignedDecimalString(t,r)},jspb.utils.hash64ArrayToDecimalStrings=function(t,e){for(var r=Array(t.length),n=0;n<t.length;n++)r[n]=jspb.utils.hash64ToDecimalString(t[n],e);return r},jspb.utils.decimalStringToHash64=function(t){function e(t,e){for(var r=0;8>r&&(1!==t||0<e);r++)e=t*n[r]+e,n[r]=255&e,e>>>=8}goog.asserts.assert(0<t.length);var r=!1;"-"===t[0]&&(r=!0,t=t.slice(1));for(var n=[0,0,0,0,0,0,0,0],i=0;i<t.length;i++)e(10,t.charCodeAt(i)-jspb.utils.ZERO_CHAR_CODE_);return r&&(function(){for(var t=0;8>t;t++)n[t]=255&~n[t]}(),e(1,1)),goog.crypt.byteArrayToString(n)},jspb.utils.splitDecimalString=function(t){jspb.utils.splitHash64(jspb.utils.decimalStringToHash64(t))},jspb.utils.toHexDigit_=function(t){return String.fromCharCode(10>t?jspb.utils.ZERO_CHAR_CODE_+t:jspb.utils.A_CHAR_CODE_-10+t)},jspb.utils.fromHexCharCode_=function(t){return t>=jspb.utils.A_CHAR_CODE_?t-jspb.utils.A_CHAR_CODE_+10:t-jspb.utils.ZERO_CHAR_CODE_},jspb.utils.hash64ToHexString=function(t){var e=Array(18);e[0]="0",e[1]="x";for(var r=0;8>r;r++){var n=t.charCodeAt(7-r);e[2*r+2]=jspb.utils.toHexDigit_(n>>4),e[2*r+3]=jspb.utils.toHexDigit_(15&n)}return e.join("")},jspb.utils.hexStringToHash64=function(t){t=t.toLowerCase(),goog.asserts.assert(18==t.length),goog.asserts.assert("0"==t[0]),goog.asserts.assert("x"==t[1]);for(var e="",r=0;8>r;r++){var n=jspb.utils.fromHexCharCode_(t.charCodeAt(2*r+2)),i=jspb.utils.fromHexCharCode_(t.charCodeAt(2*r+3));e=String.fromCharCode(16*n+i)+e}return e},jspb.utils.hash64ToNumber=function(t,e){jspb.utils.splitHash64(t),t=jspb.utils.split64Low;var r=jspb.utils.split64High;return e?jspb.utils.joinInt64(t,r):jspb.utils.joinUint64(t,r)},jspb.utils.numberToHash64=function(t){return jspb.utils.splitInt64(t),jspb.utils.joinHash64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.utils.countVarints=function(t,e,r){for(var n=0,i=e;i<r;i++)n+=t[i]>>7;return r-e-n},jspb.utils.countVarintFields=function(t,e,r,n){var i=0;if(128>(n=8*n+jspb.BinaryConstants.WireType.VARINT))for(;e<r&&t[e++]==n;)for(i++;;){var o=t[e++];if(0==(128&o))break}else for(;e<r;){for(o=n;128<o;){if(t[e]!=(127&o|128))return i;e++,o>>=7}if(t[e++]!=o)break;for(i++;0!=(128&(o=t[e++])););}return i},jspb.utils.countFixedFields_=function(t,e,r,n,i){var o=0;if(128>n)for(;e<r&&t[e++]==n;)o++,e+=i;else for(;e<r;){for(var a=n;128<a;){if(t[e++]!=(127&a|128))return o;a>>=7}if(t[e++]!=a)break;o++,e+=i}return o},jspb.utils.countFixed32Fields=function(t,e,r,n){return jspb.utils.countFixedFields_(t,e,r,8*n+jspb.BinaryConstants.WireType.FIXED32,4)},jspb.utils.countFixed64Fields=function(t,e,r,n){return jspb.utils.countFixedFields_(t,e,r,8*n+jspb.BinaryConstants.WireType.FIXED64,8)},jspb.utils.countDelimitedFields=function(t,e,r,n){var i=0;for(n=8*n+jspb.BinaryConstants.WireType.DELIMITED;e<r;){for(var o=n;128<o;){if(t[e++]!=(127&o|128))return i;o>>=7}if(t[e++]!=o)break;i++;for(var a=0,s=1;a+=(127&(o=t[e++]))*s,s*=128,0!=(128&o););e+=a}return i},jspb.utils.debugBytesToTextFormat=function(t){var e='"';if(t){t=jspb.utils.byteSourceToUint8Array(t);for(var r=0;r<t.length;r++)e+="\\x",16>t[r]&&(e+="0"),e+=t[r].toString(16)}return e+'"'},jspb.utils.debugScalarToTextFormat=function(t){return"string"==typeof t?goog.string.quote(t):t.toString()},jspb.utils.stringToByteArray=function(t){for(var e=new Uint8Array(t.length),r=0;r<t.length;r++){var n=t.charCodeAt(r);if(255<n)throw Error("Conversion error: string contains codepoint outside of byte range");e[r]=n}return e},jspb.utils.byteSourceToUint8Array=function(t){return t.constructor===Uint8Array?t:t.constructor===ArrayBuffer||void 0!==Buffer&&t.constructor===Buffer||t.constructor===Array?new Uint8Array(t):t.constructor===String?goog.crypt.base64.decodeStringToUint8Array(t):(goog.asserts.fail("Type not convertible to Uint8Array."),new Uint8Array(0))},jspb.BinaryDecoder=function(t,e,r){this.bytes_=null,this.cursor_=this.end_=this.start_=0,this.error_=!1,t&&this.setBlock(t,e,r)},jspb.BinaryDecoder.instanceCache_=[],jspb.BinaryDecoder.alloc=function(t,e,r){if(jspb.BinaryDecoder.instanceCache_.length){var n=jspb.BinaryDecoder.instanceCache_.pop();return t&&n.setBlock(t,e,r),n}return new jspb.BinaryDecoder(t,e,r)},jspb.BinaryDecoder.prototype.free=function(){this.clear(),100>jspb.BinaryDecoder.instanceCache_.length&&jspb.BinaryDecoder.instanceCache_.push(this)},jspb.BinaryDecoder.prototype.clone=function(){return jspb.BinaryDecoder.alloc(this.bytes_,this.start_,this.end_-this.start_)},jspb.BinaryDecoder.prototype.clear=function(){this.bytes_=null,this.cursor_=this.end_=this.start_=0,this.error_=!1},jspb.BinaryDecoder.prototype.getBuffer=function(){return this.bytes_},jspb.BinaryDecoder.prototype.setBlock=function(t,e,r){this.bytes_=jspb.utils.byteSourceToUint8Array(t),this.start_=void 0!==e?e:0,this.end_=void 0!==r?this.start_+r:this.bytes_.length,this.cursor_=this.start_},jspb.BinaryDecoder.prototype.getEnd=function(){return this.end_},jspb.BinaryDecoder.prototype.setEnd=function(t){this.end_=t},jspb.BinaryDecoder.prototype.reset=function(){this.cursor_=this.start_},jspb.BinaryDecoder.prototype.getCursor=function(){return this.cursor_},jspb.BinaryDecoder.prototype.setCursor=function(t){this.cursor_=t},jspb.BinaryDecoder.prototype.advance=function(t){this.cursor_+=t,goog.asserts.assert(this.cursor_<=this.end_)},jspb.BinaryDecoder.prototype.atEnd=function(){return this.cursor_==this.end_},jspb.BinaryDecoder.prototype.pastEnd=function(){return this.cursor_>this.end_},jspb.BinaryDecoder.prototype.getError=function(){return this.error_||0>this.cursor_||this.cursor_>this.end_},jspb.BinaryDecoder.prototype.readSplitVarint64=function(t){for(var e=128,r=0,n=0,i=0;4>i&&128<=e;i++)r|=(127&(e=this.bytes_[this.cursor_++]))<<7*i;if(128<=e&&(r|=(127&(e=this.bytes_[this.cursor_++]))<<28,n|=(127&e)>>4),128<=e)for(i=0;5>i&&128<=e;i++)n|=(127&(e=this.bytes_[this.cursor_++]))<<7*i+3;if(128>e)return t(r>>>0,n>>>0);goog.asserts.fail("Failed to read varint, encoding is invalid."),this.error_=!0},jspb.BinaryDecoder.prototype.readSplitZigzagVarint64=function(t){return this.readSplitVarint64((function(e,r){return jspb.utils.fromZigzag64(e,r,t)}))},jspb.BinaryDecoder.prototype.readSplitFixed64=function(t){var e=this.bytes_,r=this.cursor_;this.cursor_+=8;for(var n=0,i=0,o=r+7;o>=r;o--)n=n<<8|e[o],i=i<<8|e[o+4];return t(n,i)},jspb.BinaryDecoder.prototype.skipVarint=function(){for(;128&this.bytes_[this.cursor_];)this.cursor_++;this.cursor_++},jspb.BinaryDecoder.prototype.unskipVarint=function(t){for(;128<t;)this.cursor_--,t>>>=7;this.cursor_--},jspb.BinaryDecoder.prototype.readUnsignedVarint32=function(){var t=this.bytes_,e=t[this.cursor_+0],r=127&e;return 128>e?(this.cursor_+=1,goog.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(e=t[this.cursor_+1]))<<7,128>e?(this.cursor_+=2,goog.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(e=t[this.cursor_+2]))<<14,128>e?(this.cursor_+=3,goog.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(e=t[this.cursor_+3]))<<21,128>e?(this.cursor_+=4,goog.asserts.assert(this.cursor_<=this.end_),r):(r|=(15&(e=t[this.cursor_+4]))<<28,128>e?(this.cursor_+=5,goog.asserts.assert(this.cursor_<=this.end_),r>>>0):(this.cursor_+=5,128<=t[this.cursor_++]&&128<=t[this.cursor_++]&&128<=t[this.cursor_++]&&128<=t[this.cursor_++]&&128<=t[this.cursor_++]&&goog.asserts.assert(!1),goog.asserts.assert(this.cursor_<=this.end_),r)))))},jspb.BinaryDecoder.prototype.readSignedVarint32=jspb.BinaryDecoder.prototype.readUnsignedVarint32,jspb.BinaryDecoder.prototype.readUnsignedVarint32String=function(){return this.readUnsignedVarint32().toString()},jspb.BinaryDecoder.prototype.readSignedVarint32String=function(){return this.readSignedVarint32().toString()},jspb.BinaryDecoder.prototype.readZigzagVarint32=function(){var t=this.readUnsignedVarint32();return t>>>1^-(1&t)},jspb.BinaryDecoder.prototype.readUnsignedVarint64=function(){return this.readSplitVarint64(jspb.utils.joinUint64)},jspb.BinaryDecoder.prototype.readUnsignedVarint64String=function(){return this.readSplitVarint64(jspb.utils.joinUnsignedDecimalString)},jspb.BinaryDecoder.prototype.readSignedVarint64=function(){return this.readSplitVarint64(jspb.utils.joinInt64)},jspb.BinaryDecoder.prototype.readSignedVarint64String=function(){return this.readSplitVarint64(jspb.utils.joinSignedDecimalString)},jspb.BinaryDecoder.prototype.readZigzagVarint64=function(){return this.readSplitVarint64(jspb.utils.joinZigzag64)},jspb.BinaryDecoder.prototype.readZigzagVarintHash64=function(){return this.readSplitZigzagVarint64(jspb.utils.joinHash64)},jspb.BinaryDecoder.prototype.readZigzagVarint64String=function(){return this.readSplitZigzagVarint64(jspb.utils.joinSignedDecimalString)},jspb.BinaryDecoder.prototype.readUint8=function(){var t=this.bytes_[this.cursor_+0];return this.cursor_+=1,goog.asserts.assert(this.cursor_<=this.end_),t},jspb.BinaryDecoder.prototype.readUint16=function(){var t=this.bytes_[this.cursor_+0],e=this.bytes_[this.cursor_+1];return this.cursor_+=2,goog.asserts.assert(this.cursor_<=this.end_),t<<0|e<<8},jspb.BinaryDecoder.prototype.readUint32=function(){var t=this.bytes_[this.cursor_+0],e=this.bytes_[this.cursor_+1],r=this.bytes_[this.cursor_+2],n=this.bytes_[this.cursor_+3];return this.cursor_+=4,goog.asserts.assert(this.cursor_<=this.end_),(t<<0|e<<8|r<<16|n<<24)>>>0},jspb.BinaryDecoder.prototype.readUint64=function(){var t=this.readUint32(),e=this.readUint32();return jspb.utils.joinUint64(t,e)},jspb.BinaryDecoder.prototype.readUint64String=function(){var t=this.readUint32(),e=this.readUint32();return jspb.utils.joinUnsignedDecimalString(t,e)},jspb.BinaryDecoder.prototype.readInt8=function(){var t=this.bytes_[this.cursor_+0];return this.cursor_+=1,goog.asserts.assert(this.cursor_<=this.end_),t<<24>>24},jspb.BinaryDecoder.prototype.readInt16=function(){var t=this.bytes_[this.cursor_+0],e=this.bytes_[this.cursor_+1];return this.cursor_+=2,goog.asserts.assert(this.cursor_<=this.end_),(t<<0|e<<8)<<16>>16},jspb.BinaryDecoder.prototype.readInt32=function(){var t=this.bytes_[this.cursor_+0],e=this.bytes_[this.cursor_+1],r=this.bytes_[this.cursor_+2],n=this.bytes_[this.cursor_+3];return this.cursor_+=4,goog.asserts.assert(this.cursor_<=this.end_),t<<0|e<<8|r<<16|n<<24},jspb.BinaryDecoder.prototype.readInt64=function(){var t=this.readUint32(),e=this.readUint32();return jspb.utils.joinInt64(t,e)},jspb.BinaryDecoder.prototype.readInt64String=function(){var t=this.readUint32(),e=this.readUint32();return jspb.utils.joinSignedDecimalString(t,e)},jspb.BinaryDecoder.prototype.readFloat=function(){var t=this.readUint32();return jspb.utils.joinFloat32(t,0)},jspb.BinaryDecoder.prototype.readDouble=function(){var t=this.readUint32(),e=this.readUint32();return jspb.utils.joinFloat64(t,e)},jspb.BinaryDecoder.prototype.readBool=function(){return!!this.bytes_[this.cursor_++]},jspb.BinaryDecoder.prototype.readEnum=function(){return this.readSignedVarint32()},jspb.BinaryDecoder.prototype.readString=function(t){var e=this.bytes_,r=this.cursor_;t=r+t;for(var n=[],i="";r<t;){var o=e[r++];if(128>o)n.push(o);else{if(192>o)continue;if(224>o){var a=e[r++];n.push((31&o)<<6|63&a)}else if(240>o){a=e[r++];var s=e[r++];n.push((15&o)<<12|(63&a)<<6|63&s)}else if(248>o){o=(7&o)<<18|(63&(a=e[r++]))<<12|(63&(s=e[r++]))<<6|63&e[r++],o-=65536,n.push(55296+(o>>10&1023),56320+(1023&o))}}8192<=n.length&&(i+=String.fromCharCode.apply(null,n),n.length=0)}return i+=goog.crypt.byteArrayToString(n),this.cursor_=r,i},jspb.BinaryDecoder.prototype.readStringWithLength=function(){var t=this.readUnsignedVarint32();return this.readString(t)},jspb.BinaryDecoder.prototype.readBytes=function(t){if(0>t||this.cursor_+t>this.bytes_.length)return this.error_=!0,goog.asserts.fail("Invalid byte length!"),new Uint8Array(0);var e=this.bytes_.subarray(this.cursor_,this.cursor_+t);return this.cursor_+=t,goog.asserts.assert(this.cursor_<=this.end_),e},jspb.BinaryDecoder.prototype.readVarintHash64=function(){return this.readSplitVarint64(jspb.utils.joinHash64)},jspb.BinaryDecoder.prototype.readFixedHash64=function(){var t=this.bytes_,e=this.cursor_,r=t[e+0],n=t[e+1],i=t[e+2],o=t[e+3],a=t[e+4],s=t[e+5],u=t[e+6];return t=t[e+7],this.cursor_+=8,String.fromCharCode(r,n,i,o,a,s,u,t)},jspb.BinaryReader=function(t,e,r){this.decoder_=jspb.BinaryDecoder.alloc(t,e,r),this.fieldCursor_=this.decoder_.getCursor(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID,this.error_=!1,this.readCallbacks_=null},jspb.BinaryReader.instanceCache_=[],jspb.BinaryReader.alloc=function(t,e,r){if(jspb.BinaryReader.instanceCache_.length){var n=jspb.BinaryReader.instanceCache_.pop();return t&&n.decoder_.setBlock(t,e,r),n}return new jspb.BinaryReader(t,e,r)},jspb.BinaryReader.prototype.alloc=jspb.BinaryReader.alloc,jspb.BinaryReader.prototype.free=function(){this.decoder_.clear(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID,this.error_=!1,this.readCallbacks_=null,100>jspb.BinaryReader.instanceCache_.length&&jspb.BinaryReader.instanceCache_.push(this)},jspb.BinaryReader.prototype.getFieldCursor=function(){return this.fieldCursor_},jspb.BinaryReader.prototype.getCursor=function(){return this.decoder_.getCursor()},jspb.BinaryReader.prototype.getBuffer=function(){return this.decoder_.getBuffer()},jspb.BinaryReader.prototype.getFieldNumber=function(){return this.nextField_},jspb.BinaryReader.prototype.getWireType=function(){return this.nextWireType_},jspb.BinaryReader.prototype.isDelimited=function(){return this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED},jspb.BinaryReader.prototype.isEndGroup=function(){return this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP},jspb.BinaryReader.prototype.getError=function(){return this.error_||this.decoder_.getError()},jspb.BinaryReader.prototype.setBlock=function(t,e,r){this.decoder_.setBlock(t,e,r),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID},jspb.BinaryReader.prototype.reset=function(){this.decoder_.reset(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID},jspb.BinaryReader.prototype.advance=function(t){this.decoder_.advance(t)},jspb.BinaryReader.prototype.nextField=function(){if(this.decoder_.atEnd())return!1;if(this.getError())return goog.asserts.fail("Decoder hit an error"),!1;this.fieldCursor_=this.decoder_.getCursor();var t=this.decoder_.readUnsignedVarint32(),e=t>>>3;return(t&=7)!=jspb.BinaryConstants.WireType.VARINT&&t!=jspb.BinaryConstants.WireType.FIXED32&&t!=jspb.BinaryConstants.WireType.FIXED64&&t!=jspb.BinaryConstants.WireType.DELIMITED&&t!=jspb.BinaryConstants.WireType.START_GROUP&&t!=jspb.BinaryConstants.WireType.END_GROUP?(goog.asserts.fail("Invalid wire type: %s (at position %s)",t,this.fieldCursor_),this.error_=!0,!1):(this.nextField_=e,this.nextWireType_=t,!0)},jspb.BinaryReader.prototype.unskipHeader=function(){this.decoder_.unskipVarint(this.nextField_<<3|this.nextWireType_)},jspb.BinaryReader.prototype.skipMatchingFields=function(){var t=this.nextField_;for(this.unskipHeader();this.nextField()&&this.getFieldNumber()==t;)this.skipField();this.decoder_.atEnd()||this.unskipHeader()},jspb.BinaryReader.prototype.skipVarintField=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.VARINT?(goog.asserts.fail("Invalid wire type for skipVarintField"),this.skipField()):this.decoder_.skipVarint()},jspb.BinaryReader.prototype.skipDelimitedField=function(){if(this.nextWireType_!=jspb.BinaryConstants.WireType.DELIMITED)goog.asserts.fail("Invalid wire type for skipDelimitedField"),this.skipField();else{var t=this.decoder_.readUnsignedVarint32();this.decoder_.advance(t)}},jspb.BinaryReader.prototype.skipFixed32Field=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.FIXED32?(goog.asserts.fail("Invalid wire type for skipFixed32Field"),this.skipField()):this.decoder_.advance(4)},jspb.BinaryReader.prototype.skipFixed64Field=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.FIXED64?(goog.asserts.fail("Invalid wire type for skipFixed64Field"),this.skipField()):this.decoder_.advance(8)},jspb.BinaryReader.prototype.skipGroup=function(){for(var t=this.nextField_;;){if(!this.nextField()){goog.asserts.fail("Unmatched start-group tag: stream EOF"),this.error_=!0;break}if(this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP){this.nextField_!=t&&(goog.asserts.fail("Unmatched end-group tag"),this.error_=!0);break}this.skipField()}},jspb.BinaryReader.prototype.skipField=function(){switch(this.nextWireType_){case jspb.BinaryConstants.WireType.VARINT:this.skipVarintField();break;case jspb.BinaryConstants.WireType.FIXED64:this.skipFixed64Field();break;case jspb.BinaryConstants.WireType.DELIMITED:this.skipDelimitedField();break;case jspb.BinaryConstants.WireType.FIXED32:this.skipFixed32Field();break;case jspb.BinaryConstants.WireType.START_GROUP:this.skipGroup();break;default:goog.asserts.fail("Invalid wire encoding for field.")}},jspb.BinaryReader.prototype.registerReadCallback=function(t,e){null===this.readCallbacks_&&(this.readCallbacks_={}),goog.asserts.assert(!this.readCallbacks_[t]),this.readCallbacks_[t]=e},jspb.BinaryReader.prototype.runReadCallback=function(t){return goog.asserts.assert(null!==this.readCallbacks_),t=this.readCallbacks_[t],goog.asserts.assert(t),t(this)},jspb.BinaryReader.prototype.readAny=function(t){this.nextWireType_=jspb.BinaryConstants.FieldTypeToWireType(t);var e=jspb.BinaryConstants.FieldType;switch(t){case e.DOUBLE:return this.readDouble();case e.FLOAT:return this.readFloat();case e.INT64:return this.readInt64();case e.UINT64:return this.readUint64();case e.INT32:return this.readInt32();case e.FIXED64:return this.readFixed64();case e.FIXED32:return this.readFixed32();case e.BOOL:return this.readBool();case e.STRING:return this.readString();case e.GROUP:goog.asserts.fail("Group field type not supported in readAny()");case e.MESSAGE:goog.asserts.fail("Message field type not supported in readAny()");case e.BYTES:return this.readBytes();case e.UINT32:return this.readUint32();case e.ENUM:return this.readEnum();case e.SFIXED32:return this.readSfixed32();case e.SFIXED64:return this.readSfixed64();case e.SINT32:return this.readSint32();case e.SINT64:return this.readSint64();case e.FHASH64:return this.readFixedHash64();case e.VHASH64:return this.readVarintHash64();default:goog.asserts.fail("Invalid field type in readAny()")}return 0},jspb.BinaryReader.prototype.readMessage=function(t,e){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var r=this.decoder_.getEnd(),n=this.decoder_.readUnsignedVarint32();n=this.decoder_.getCursor()+n,this.decoder_.setEnd(n),e(t,this),this.decoder_.setCursor(n),this.decoder_.setEnd(r)},jspb.BinaryReader.prototype.readGroup=function(t,e,r){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.START_GROUP),goog.asserts.assert(this.nextField_==t),r(e,this),this.error_||this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP||(goog.asserts.fail("Group submessage did not end with an END_GROUP tag"),this.error_=!0)},jspb.BinaryReader.prototype.getFieldDecoder=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var t=this.decoder_.readUnsignedVarint32(),e=this.decoder_.getCursor(),r=e+t;return t=jspb.BinaryDecoder.alloc(this.decoder_.getBuffer(),e,t),this.decoder_.setCursor(r),t},jspb.BinaryReader.prototype.readInt32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint32()},jspb.BinaryReader.prototype.readInt32String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint32String()},jspb.BinaryReader.prototype.readInt64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64()},jspb.BinaryReader.prototype.readInt64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64String()},jspb.BinaryReader.prototype.readUint32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint32()},jspb.BinaryReader.prototype.readUint32String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint32String()},jspb.BinaryReader.prototype.readUint64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint64()},jspb.BinaryReader.prototype.readUint64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint64String()},jspb.BinaryReader.prototype.readSint32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint32()},jspb.BinaryReader.prototype.readSint64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint64()},jspb.BinaryReader.prototype.readSint64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint64String()},jspb.BinaryReader.prototype.readFixed32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readUint32()},jspb.BinaryReader.prototype.readFixed64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readUint64()},jspb.BinaryReader.prototype.readFixed64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readUint64String()},jspb.BinaryReader.prototype.readSfixed32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readInt32()},jspb.BinaryReader.prototype.readSfixed32String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readInt32().toString()},jspb.BinaryReader.prototype.readSfixed64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readInt64()},jspb.BinaryReader.prototype.readSfixed64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readInt64String()},jspb.BinaryReader.prototype.readFloat=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readFloat()},jspb.BinaryReader.prototype.readDouble=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readDouble()},jspb.BinaryReader.prototype.readBool=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),!!this.decoder_.readUnsignedVarint32()},jspb.BinaryReader.prototype.readEnum=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64()},jspb.BinaryReader.prototype.readString=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var t=this.decoder_.readUnsignedVarint32();return this.decoder_.readString(t)},jspb.BinaryReader.prototype.readBytes=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var t=this.decoder_.readUnsignedVarint32();return this.decoder_.readBytes(t)},jspb.BinaryReader.prototype.readVarintHash64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readVarintHash64()},jspb.BinaryReader.prototype.readSintHash64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarintHash64()},jspb.BinaryReader.prototype.readSplitVarint64=function(t){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSplitVarint64(t)},jspb.BinaryReader.prototype.readSplitZigzagVarint64=function(t){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSplitVarint64((function(e,r){return jspb.utils.fromZigzag64(e,r,t)}))},jspb.BinaryReader.prototype.readFixedHash64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readFixedHash64()},jspb.BinaryReader.prototype.readSplitFixed64=function(t){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readSplitFixed64(t)},jspb.BinaryReader.prototype.readPackedField_=function(t){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32();e=this.decoder_.getCursor()+e;for(var r=[];this.decoder_.getCursor()<e;)r.push(t.call(this.decoder_));return r},jspb.BinaryReader.prototype.readPackedInt32=function(){return this.readPackedField_(this.decoder_.readSignedVarint32)},jspb.BinaryReader.prototype.readPackedInt32String=function(){return this.readPackedField_(this.decoder_.readSignedVarint32String)},jspb.BinaryReader.prototype.readPackedInt64=function(){return this.readPackedField_(this.decoder_.readSignedVarint64)},jspb.BinaryReader.prototype.readPackedInt64String=function(){return this.readPackedField_(this.decoder_.readSignedVarint64String)},jspb.BinaryReader.prototype.readPackedUint32=function(){return this.readPackedField_(this.decoder_.readUnsignedVarint32)},jspb.BinaryReader.prototype.readPackedUint32String=function(){return this.readPackedField_(this.decoder_.readUnsignedVarint32String)},jspb.BinaryReader.prototype.readPackedUint64=function(){return this.readPackedField_(this.decoder_.readUnsignedVarint64)},jspb.BinaryReader.prototype.readPackedUint64String=function(){return this.readPackedField_(this.decoder_.readUnsignedVarint64String)},jspb.BinaryReader.prototype.readPackedSint32=function(){return this.readPackedField_(this.decoder_.readZigzagVarint32)},jspb.BinaryReader.prototype.readPackedSint64=function(){return this.readPackedField_(this.decoder_.readZigzagVarint64)},jspb.BinaryReader.prototype.readPackedSint64String=function(){return this.readPackedField_(this.decoder_.readZigzagVarint64String)},jspb.BinaryReader.prototype.readPackedFixed32=function(){return this.readPackedField_(this.decoder_.readUint32)},jspb.BinaryReader.prototype.readPackedFixed64=function(){return this.readPackedField_(this.decoder_.readUint64)},jspb.BinaryReader.prototype.readPackedFixed64String=function(){return this.readPackedField_(this.decoder_.readUint64String)},jspb.BinaryReader.prototype.readPackedSfixed32=function(){return this.readPackedField_(this.decoder_.readInt32)},jspb.BinaryReader.prototype.readPackedSfixed64=function(){return this.readPackedField_(this.decoder_.readInt64)},jspb.BinaryReader.prototype.readPackedSfixed64String=function(){return this.readPackedField_(this.decoder_.readInt64String)},jspb.BinaryReader.prototype.readPackedFloat=function(){return this.readPackedField_(this.decoder_.readFloat)},jspb.BinaryReader.prototype.readPackedDouble=function(){return this.readPackedField_(this.decoder_.readDouble)},jspb.BinaryReader.prototype.readPackedBool=function(){return this.readPackedField_(this.decoder_.readBool)},jspb.BinaryReader.prototype.readPackedEnum=function(){return this.readPackedField_(this.decoder_.readEnum)},jspb.BinaryReader.prototype.readPackedVarintHash64=function(){return this.readPackedField_(this.decoder_.readVarintHash64)},jspb.BinaryReader.prototype.readPackedFixedHash64=function(){return this.readPackedField_(this.decoder_.readFixedHash64)},jspb.BinaryEncoder=function(){this.buffer_=[]},jspb.BinaryEncoder.prototype.length=function(){return this.buffer_.length},jspb.BinaryEncoder.prototype.end=function(){var t=this.buffer_;return this.buffer_=[],t},jspb.BinaryEncoder.prototype.writeSplitVarint64=function(t,e){for(goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(e==Math.floor(e)),goog.asserts.assert(0<=t&&t<jspb.BinaryConstants.TWO_TO_32),goog.asserts.assert(0<=e&&e<jspb.BinaryConstants.TWO_TO_32);0<e||127<t;)this.buffer_.push(127&t|128),t=(t>>>7|e<<25)>>>0,e>>>=7;this.buffer_.push(t)},jspb.BinaryEncoder.prototype.writeSplitFixed64=function(t,e){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(e==Math.floor(e)),goog.asserts.assert(0<=t&&t<jspb.BinaryConstants.TWO_TO_32),goog.asserts.assert(0<=e&&e<jspb.BinaryConstants.TWO_TO_32),this.writeUint32(t),this.writeUint32(e)},jspb.BinaryEncoder.prototype.writeUnsignedVarint32=function(t){for(goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(0<=t&&t<jspb.BinaryConstants.TWO_TO_32);127<t;)this.buffer_.push(127&t|128),t>>>=7;this.buffer_.push(t)},jspb.BinaryEncoder.prototype.writeSignedVarint32=function(t){if(goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(t>=-jspb.BinaryConstants.TWO_TO_31&&t<jspb.BinaryConstants.TWO_TO_31),0<=t)this.writeUnsignedVarint32(t);else{for(var e=0;9>e;e++)this.buffer_.push(127&t|128),t>>=7;this.buffer_.push(1)}},jspb.BinaryEncoder.prototype.writeUnsignedVarint64=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(0<=t&&t<jspb.BinaryConstants.TWO_TO_64),jspb.utils.splitInt64(t),this.writeSplitVarint64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeSignedVarint64=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(t>=-jspb.BinaryConstants.TWO_TO_63&&t<jspb.BinaryConstants.TWO_TO_63),jspb.utils.splitInt64(t),this.writeSplitVarint64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeZigzagVarint32=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(t>=-jspb.BinaryConstants.TWO_TO_31&&t<jspb.BinaryConstants.TWO_TO_31),this.writeUnsignedVarint32((t<<1^t>>31)>>>0)},jspb.BinaryEncoder.prototype.writeZigzagVarint64=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(t>=-jspb.BinaryConstants.TWO_TO_63&&t<jspb.BinaryConstants.TWO_TO_63),jspb.utils.splitZigzag64(t),this.writeSplitVarint64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeZigzagVarint64String=function(t){this.writeZigzagVarintHash64(jspb.utils.decimalStringToHash64(t))},jspb.BinaryEncoder.prototype.writeZigzagVarintHash64=function(t){var e=this;jspb.utils.splitHash64(t),jspb.utils.toZigzag64(jspb.utils.split64Low,jspb.utils.split64High,(function(t,r){e.writeSplitVarint64(t>>>0,r>>>0)}))},jspb.BinaryEncoder.prototype.writeUint8=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(0<=t&&256>t),this.buffer_.push(t>>>0&255)},jspb.BinaryEncoder.prototype.writeUint16=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(0<=t&&65536>t),this.buffer_.push(t>>>0&255),this.buffer_.push(t>>>8&255)},jspb.BinaryEncoder.prototype.writeUint32=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(0<=t&&t<jspb.BinaryConstants.TWO_TO_32),this.buffer_.push(t>>>0&255),this.buffer_.push(t>>>8&255),this.buffer_.push(t>>>16&255),this.buffer_.push(t>>>24&255)},jspb.BinaryEncoder.prototype.writeUint64=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(0<=t&&t<jspb.BinaryConstants.TWO_TO_64),jspb.utils.splitUint64(t),this.writeUint32(jspb.utils.split64Low),this.writeUint32(jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeInt8=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(-128<=t&&128>t),this.buffer_.push(t>>>0&255)},jspb.BinaryEncoder.prototype.writeInt16=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(-32768<=t&&32768>t),this.buffer_.push(t>>>0&255),this.buffer_.push(t>>>8&255)},jspb.BinaryEncoder.prototype.writeInt32=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(t>=-jspb.BinaryConstants.TWO_TO_31&&t<jspb.BinaryConstants.TWO_TO_31),this.buffer_.push(t>>>0&255),this.buffer_.push(t>>>8&255),this.buffer_.push(t>>>16&255),this.buffer_.push(t>>>24&255)},jspb.BinaryEncoder.prototype.writeInt64=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(t>=-jspb.BinaryConstants.TWO_TO_63&&t<jspb.BinaryConstants.TWO_TO_63),jspb.utils.splitInt64(t),this.writeSplitFixed64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeInt64String=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(+t>=-jspb.BinaryConstants.TWO_TO_63&&+t<jspb.BinaryConstants.TWO_TO_63),jspb.utils.splitHash64(jspb.utils.decimalStringToHash64(t)),this.writeSplitFixed64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeFloat=function(t){goog.asserts.assert(1/0===t||-1/0===t||isNaN(t)||t>=-jspb.BinaryConstants.FLOAT32_MAX&&t<=jspb.BinaryConstants.FLOAT32_MAX),jspb.utils.splitFloat32(t),this.writeUint32(jspb.utils.split64Low)},jspb.BinaryEncoder.prototype.writeDouble=function(t){goog.asserts.assert(1/0===t||-1/0===t||isNaN(t)||t>=-jspb.BinaryConstants.FLOAT64_MAX&&t<=jspb.BinaryConstants.FLOAT64_MAX),jspb.utils.splitFloat64(t),this.writeUint32(jspb.utils.split64Low),this.writeUint32(jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeBool=function(t){goog.asserts.assert("boolean"==typeof t||"number"==typeof t),this.buffer_.push(t?1:0)},jspb.BinaryEncoder.prototype.writeEnum=function(t){goog.asserts.assert(t==Math.floor(t)),goog.asserts.assert(t>=-jspb.BinaryConstants.TWO_TO_31&&t<jspb.BinaryConstants.TWO_TO_31),this.writeSignedVarint32(t)},jspb.BinaryEncoder.prototype.writeBytes=function(t){this.buffer_.push.apply(this.buffer_,t)},jspb.BinaryEncoder.prototype.writeVarintHash64=function(t){jspb.utils.splitHash64(t),this.writeSplitVarint64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeFixedHash64=function(t){jspb.utils.splitHash64(t),this.writeUint32(jspb.utils.split64Low),this.writeUint32(jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeString=function(t){for(var e=this.buffer_.length,r=0;r<t.length;r++){var n=t.charCodeAt(r);if(128>n)this.buffer_.push(n);else if(2048>n)this.buffer_.push(n>>6|192),this.buffer_.push(63&n|128);else if(65536>n)if(55296<=n&&56319>=n&&r+1<t.length){var i=t.charCodeAt(r+1);56320<=i&&57343>=i&&(n=1024*(n-55296)+i-56320+65536,this.buffer_.push(n>>18|240),this.buffer_.push(n>>12&63|128),this.buffer_.push(n>>6&63|128),this.buffer_.push(63&n|128),r++)}else this.buffer_.push(n>>12|224),this.buffer_.push(n>>6&63|128),this.buffer_.push(63&n|128)}return this.buffer_.length-e},jspb.arith={},jspb.arith.UInt64=function(t,e){this.lo=t,this.hi=e},jspb.arith.UInt64.prototype.cmp=function(t){return this.hi<t.hi||this.hi==t.hi&&this.lo<t.lo?-1:this.hi==t.hi&&this.lo==t.lo?0:1},jspb.arith.UInt64.prototype.rightShift=function(){return new jspb.arith.UInt64((this.lo>>>1|(1&this.hi)<<31)>>>0,this.hi>>>1>>>0)},jspb.arith.UInt64.prototype.leftShift=function(){return new jspb.arith.UInt64(this.lo<<1>>>0,(this.hi<<1|this.lo>>>31)>>>0)},jspb.arith.UInt64.prototype.msb=function(){return!!(2147483648&this.hi)},jspb.arith.UInt64.prototype.lsb=function(){return!!(1&this.lo)},jspb.arith.UInt64.prototype.zero=function(){return 0==this.lo&&0==this.hi},jspb.arith.UInt64.prototype.add=function(t){return new jspb.arith.UInt64((this.lo+t.lo&4294967295)>>>0>>>0,((this.hi+t.hi&4294967295)>>>0)+(4294967296<=this.lo+t.lo?1:0)>>>0)},jspb.arith.UInt64.prototype.sub=function(t){return new jspb.arith.UInt64((this.lo-t.lo&4294967295)>>>0>>>0,((this.hi-t.hi&4294967295)>>>0)-(0>this.lo-t.lo?1:0)>>>0)},jspb.arith.UInt64.mul32x32=function(t,e){var r=65535&t,n=65535&e,i=e>>>16;for(e=r*n+65536*(r*i&65535)+65536*((t>>>=16)*n&65535),r=t*i+(r*i>>>16)+(t*n>>>16);4294967296<=e;)e-=4294967296,r+=1;return new jspb.arith.UInt64(e>>>0,r>>>0)},jspb.arith.UInt64.prototype.mul=function(t){var e=jspb.arith.UInt64.mul32x32(this.lo,t);return(t=jspb.arith.UInt64.mul32x32(this.hi,t)).hi=t.lo,t.lo=0,e.add(t)},jspb.arith.UInt64.prototype.div=function(t){if(0==t)return[];var e=new jspb.arith.UInt64(0,0),r=new jspb.arith.UInt64(this.lo,this.hi);t=new jspb.arith.UInt64(t,0);for(var n=new jspb.arith.UInt64(1,0);!t.msb();)t=t.leftShift(),n=n.leftShift();for(;!n.zero();)0>=t.cmp(r)&&(e=e.add(n),r=r.sub(t)),t=t.rightShift(),n=n.rightShift();return[e,r]},jspb.arith.UInt64.prototype.toString=function(){for(var t="",e=this;!e.zero();){var r=(e=e.div(10))[0];t=e[1].lo+t,e=r}return""==t&&(t="0"),t},jspb.arith.UInt64.fromString=function(t){for(var e=new jspb.arith.UInt64(0,0),r=new jspb.arith.UInt64(0,0),n=0;n<t.length;n++){if("0">t[n]||"9"<t[n])return null;var i=parseInt(t[n],10);r.lo=i,e=e.mul(10).add(r)}return e},jspb.arith.UInt64.prototype.clone=function(){return new jspb.arith.UInt64(this.lo,this.hi)},jspb.arith.Int64=function(t,e){this.lo=t,this.hi=e},jspb.arith.Int64.prototype.add=function(t){return new jspb.arith.Int64((this.lo+t.lo&4294967295)>>>0>>>0,((this.hi+t.hi&4294967295)>>>0)+(4294967296<=this.lo+t.lo?1:0)>>>0)},jspb.arith.Int64.prototype.sub=function(t){return new jspb.arith.Int64((this.lo-t.lo&4294967295)>>>0>>>0,((this.hi-t.hi&4294967295)>>>0)-(0>this.lo-t.lo?1:0)>>>0)},jspb.arith.Int64.prototype.clone=function(){return new jspb.arith.Int64(this.lo,this.hi)},jspb.arith.Int64.prototype.toString=function(){var t=0!=(2147483648&this.hi),e=new jspb.arith.UInt64(this.lo,this.hi);return t&&(e=new jspb.arith.UInt64(0,0).sub(e)),(t?"-":"")+e.toString()},jspb.arith.Int64.fromString=function(t){var e=0<t.length&&"-"==t[0];return e&&(t=t.substring(1)),null===(t=jspb.arith.UInt64.fromString(t))?null:(e&&(t=new jspb.arith.UInt64(0,0).sub(t)),new jspb.arith.Int64(t.lo,t.hi))},jspb.BinaryWriter=function(){this.blocks_=[],this.totalLength_=0,this.encoder_=new jspb.BinaryEncoder,this.bookmarks_=[]},jspb.BinaryWriter.prototype.appendUint8Array_=function(t){var e=this.encoder_.end();this.blocks_.push(e),this.blocks_.push(t),this.totalLength_+=e.length+t.length},jspb.BinaryWriter.prototype.beginDelimited_=function(t){return this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),t=this.encoder_.end(),this.blocks_.push(t),this.totalLength_+=t.length,t.push(this.totalLength_),t},jspb.BinaryWriter.prototype.endDelimited_=function(t){var e=t.pop();for(e=this.totalLength_+this.encoder_.length()-e,goog.asserts.assert(0<=e);127<e;)t.push(127&e|128),e>>>=7,this.totalLength_++;t.push(e),this.totalLength_++},jspb.BinaryWriter.prototype.writeSerializedMessage=function(t,e,r){this.appendUint8Array_(t.subarray(e,r))},jspb.BinaryWriter.prototype.maybeWriteSerializedMessage=function(t,e,r){null!=t&&null!=e&&null!=r&&this.writeSerializedMessage(t,e,r)},jspb.BinaryWriter.prototype.reset=function(){this.blocks_=[],this.encoder_.end(),this.totalLength_=0,this.bookmarks_=[]},jspb.BinaryWriter.prototype.getResultBuffer=function(){goog.asserts.assert(0==this.bookmarks_.length);for(var t=new Uint8Array(this.totalLength_+this.encoder_.length()),e=this.blocks_,r=e.length,n=0,i=0;i<r;i++){var o=e[i];t.set(o,n),n+=o.length}return e=this.encoder_.end(),t.set(e,n),n+=e.length,goog.asserts.assert(n==t.length),this.blocks_=[t],t},jspb.BinaryWriter.prototype.getResultBase64String=function(t){return goog.crypt.base64.encodeByteArray(this.getResultBuffer(),t)},jspb.BinaryWriter.prototype.beginSubMessage=function(t){this.bookmarks_.push(this.beginDelimited_(t))},jspb.BinaryWriter.prototype.endSubMessage=function(){goog.asserts.assert(0<=this.bookmarks_.length),this.endDelimited_(this.bookmarks_.pop())},jspb.BinaryWriter.prototype.writeFieldHeader_=function(t,e){goog.asserts.assert(1<=t&&t==Math.floor(t)),this.encoder_.writeUnsignedVarint32(8*t+e)},jspb.BinaryWriter.prototype.writeAny=function(t,e,r){var n=jspb.BinaryConstants.FieldType;switch(t){case n.DOUBLE:this.writeDouble(e,r);break;case n.FLOAT:this.writeFloat(e,r);break;case n.INT64:this.writeInt64(e,r);break;case n.UINT64:this.writeUint64(e,r);break;case n.INT32:this.writeInt32(e,r);break;case n.FIXED64:this.writeFixed64(e,r);break;case n.FIXED32:this.writeFixed32(e,r);break;case n.BOOL:this.writeBool(e,r);break;case n.STRING:this.writeString(e,r);break;case n.GROUP:goog.asserts.fail("Group field type not supported in writeAny()");break;case n.MESSAGE:goog.asserts.fail("Message field type not supported in writeAny()");break;case n.BYTES:this.writeBytes(e,r);break;case n.UINT32:this.writeUint32(e,r);break;case n.ENUM:this.writeEnum(e,r);break;case n.SFIXED32:this.writeSfixed32(e,r);break;case n.SFIXED64:this.writeSfixed64(e,r);break;case n.SINT32:this.writeSint32(e,r);break;case n.SINT64:this.writeSint64(e,r);break;case n.FHASH64:this.writeFixedHash64(e,r);break;case n.VHASH64:this.writeVarintHash64(e,r);break;default:goog.asserts.fail("Invalid field type in writeAny()")}},jspb.BinaryWriter.prototype.writeUnsignedVarint32_=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeUnsignedVarint32(e))},jspb.BinaryWriter.prototype.writeSignedVarint32_=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSignedVarint32(e))},jspb.BinaryWriter.prototype.writeUnsignedVarint64_=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeUnsignedVarint64(e))},jspb.BinaryWriter.prototype.writeSignedVarint64_=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSignedVarint64(e))},jspb.BinaryWriter.prototype.writeZigzagVarint32_=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeZigzagVarint32(e))},jspb.BinaryWriter.prototype.writeZigzagVarint64_=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeZigzagVarint64(e))},jspb.BinaryWriter.prototype.writeZigzagVarint64String_=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeZigzagVarint64String(e))},jspb.BinaryWriter.prototype.writeZigzagVarintHash64_=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeZigzagVarintHash64(e))},jspb.BinaryWriter.prototype.writeInt32=function(t,e){null!=e&&(goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&e<jspb.BinaryConstants.TWO_TO_31),this.writeSignedVarint32_(t,e))},jspb.BinaryWriter.prototype.writeInt32String=function(t,e){null!=e&&(e=parseInt(e,10),goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&e<jspb.BinaryConstants.TWO_TO_31),this.writeSignedVarint32_(t,e))},jspb.BinaryWriter.prototype.writeInt64=function(t,e){null!=e&&(goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&e<jspb.BinaryConstants.TWO_TO_63),this.writeSignedVarint64_(t,e))},jspb.BinaryWriter.prototype.writeInt64String=function(t,e){null!=e&&(e=jspb.arith.Int64.fromString(e),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSplitVarint64(e.lo,e.hi))},jspb.BinaryWriter.prototype.writeUint32=function(t,e){null!=e&&(goog.asserts.assert(0<=e&&e<jspb.BinaryConstants.TWO_TO_32),this.writeUnsignedVarint32_(t,e))},jspb.BinaryWriter.prototype.writeUint32String=function(t,e){null!=e&&(e=parseInt(e,10),goog.asserts.assert(0<=e&&e<jspb.BinaryConstants.TWO_TO_32),this.writeUnsignedVarint32_(t,e))},jspb.BinaryWriter.prototype.writeUint64=function(t,e){null!=e&&(goog.asserts.assert(0<=e&&e<jspb.BinaryConstants.TWO_TO_64),this.writeUnsignedVarint64_(t,e))},jspb.BinaryWriter.prototype.writeUint64String=function(t,e){null!=e&&(e=jspb.arith.UInt64.fromString(e),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSplitVarint64(e.lo,e.hi))},jspb.BinaryWriter.prototype.writeSint32=function(t,e){null!=e&&(goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&e<jspb.BinaryConstants.TWO_TO_31),this.writeZigzagVarint32_(t,e))},jspb.BinaryWriter.prototype.writeSint64=function(t,e){null!=e&&(goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&e<jspb.BinaryConstants.TWO_TO_63),this.writeZigzagVarint64_(t,e))},jspb.BinaryWriter.prototype.writeSintHash64=function(t,e){null!=e&&this.writeZigzagVarintHash64_(t,e)},jspb.BinaryWriter.prototype.writeSint64String=function(t,e){null!=e&&this.writeZigzagVarint64String_(t,e)},jspb.BinaryWriter.prototype.writeFixed32=function(t,e){null!=e&&(goog.asserts.assert(0<=e&&e<jspb.BinaryConstants.TWO_TO_32),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED32),this.encoder_.writeUint32(e))},jspb.BinaryWriter.prototype.writeFixed64=function(t,e){null!=e&&(goog.asserts.assert(0<=e&&e<jspb.BinaryConstants.TWO_TO_64),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeUint64(e))},jspb.BinaryWriter.prototype.writeFixed64String=function(t,e){null!=e&&(e=jspb.arith.UInt64.fromString(e),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeSplitFixed64(e.lo,e.hi))},jspb.BinaryWriter.prototype.writeSfixed32=function(t,e){null!=e&&(goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&e<jspb.BinaryConstants.TWO_TO_31),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED32),this.encoder_.writeInt32(e))},jspb.BinaryWriter.prototype.writeSfixed64=function(t,e){null!=e&&(goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&e<jspb.BinaryConstants.TWO_TO_63),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeInt64(e))},jspb.BinaryWriter.prototype.writeSfixed64String=function(t,e){null!=e&&(e=jspb.arith.Int64.fromString(e),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeSplitFixed64(e.lo,e.hi))},jspb.BinaryWriter.prototype.writeFloat=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED32),this.encoder_.writeFloat(e))},jspb.BinaryWriter.prototype.writeDouble=function(t,e){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeDouble(e))},jspb.BinaryWriter.prototype.writeBool=function(t,e){null!=e&&(goog.asserts.assert("boolean"==typeof e||"number"==typeof e),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeBool(e))},jspb.BinaryWriter.prototype.writeEnum=function(t,e){null!=e&&(goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&e<jspb.BinaryConstants.TWO_TO_31),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSignedVarint32(e))},jspb.BinaryWriter.prototype.writeString=function(t,e){null!=e&&(t=this.beginDelimited_(t),this.encoder_.writeString(e),this.endDelimited_(t))},jspb.BinaryWriter.prototype.writeBytes=function(t,e){null!=e&&(e=jspb.utils.byteSourceToUint8Array(e),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(e.length),this.appendUint8Array_(e))},jspb.BinaryWriter.prototype.writeMessage=function(t,e,r){null!=e&&(t=this.beginDelimited_(t),r(e,this),this.endDelimited_(t))},jspb.BinaryWriter.prototype.writeMessageSet=function(t,e,r){null!=e&&(this.writeFieldHeader_(1,jspb.BinaryConstants.WireType.START_GROUP),this.writeFieldHeader_(2,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSignedVarint32(t),t=this.beginDelimited_(3),r(e,this),this.endDelimited_(t),this.writeFieldHeader_(1,jspb.BinaryConstants.WireType.END_GROUP))},jspb.BinaryWriter.prototype.writeGroup=function(t,e,r){null!=e&&(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.START_GROUP),r(e,this),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.END_GROUP))},jspb.BinaryWriter.prototype.writeFixedHash64=function(t,e){null!=e&&(goog.asserts.assert(8==e.length),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeFixedHash64(e))},jspb.BinaryWriter.prototype.writeVarintHash64=function(t,e){null!=e&&(goog.asserts.assert(8==e.length),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeVarintHash64(e))},jspb.BinaryWriter.prototype.writeSplitFixed64=function(t,e,r){this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeSplitFixed64(e,r)},jspb.BinaryWriter.prototype.writeSplitVarint64=function(t,e,r){this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSplitVarint64(e,r)},jspb.BinaryWriter.prototype.writeSplitZigzagVarint64=function(t,e,r){this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.VARINT);var n=this.encoder_;jspb.utils.toZigzag64(e,r,(function(t,e){n.writeSplitVarint64(t>>>0,e>>>0)}))},jspb.BinaryWriter.prototype.writeRepeatedInt32=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeSignedVarint32_(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedInt32String=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeInt32String(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedInt64=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeSignedVarint64_(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedSplitFixed64=function(t,e,r,n){if(null!=e)for(var i=0;i<e.length;i++)this.writeSplitFixed64(t,r(e[i]),n(e[i]))},jspb.BinaryWriter.prototype.writeRepeatedSplitVarint64=function(t,e,r,n){if(null!=e)for(var i=0;i<e.length;i++)this.writeSplitVarint64(t,r(e[i]),n(e[i]))},jspb.BinaryWriter.prototype.writeRepeatedSplitZigzagVarint64=function(t,e,r,n){if(null!=e)for(var i=0;i<e.length;i++)this.writeSplitZigzagVarint64(t,r(e[i]),n(e[i]))},jspb.BinaryWriter.prototype.writeRepeatedInt64String=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeInt64String(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedUint32=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeUnsignedVarint32_(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedUint32String=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeUint32String(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedUint64=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeUnsignedVarint64_(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedUint64String=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeUint64String(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedSint32=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeZigzagVarint32_(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedSint64=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeZigzagVarint64_(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedSint64String=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeZigzagVarint64String_(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedSintHash64=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeZigzagVarintHash64_(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedFixed32=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeFixed32(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedFixed64=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeFixed64(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedFixed64String=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeFixed64String(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedSfixed32=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeSfixed32(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedSfixed64=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeSfixed64(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedSfixed64String=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeSfixed64String(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedFloat=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeFloat(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedDouble=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeDouble(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedBool=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeBool(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedEnum=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeEnum(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedString=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeString(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedBytes=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeBytes(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedMessage=function(t,e,r){if(null!=e)for(var n=0;n<e.length;n++){var i=this.beginDelimited_(t);r(e[n],this),this.endDelimited_(i)}},jspb.BinaryWriter.prototype.writeRepeatedGroup=function(t,e,r){if(null!=e)for(var n=0;n<e.length;n++)this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.START_GROUP),r(e[n],this),this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.END_GROUP)},jspb.BinaryWriter.prototype.writeRepeatedFixedHash64=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeFixedHash64(t,e[r])},jspb.BinaryWriter.prototype.writeRepeatedVarintHash64=function(t,e){if(null!=e)for(var r=0;r<e.length;r++)this.writeVarintHash64(t,e[r])},jspb.BinaryWriter.prototype.writePackedInt32=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeSignedVarint32(e[r]);this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedInt32String=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeSignedVarint32(parseInt(e[r],10));this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedInt64=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeSignedVarint64(e[r]);this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedSplitFixed64=function(t,e,r,n){if(null!=e){t=this.beginDelimited_(t);for(var i=0;i<e.length;i++)this.encoder_.writeSplitFixed64(r(e[i]),n(e[i]));this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedSplitVarint64=function(t,e,r,n){if(null!=e){t=this.beginDelimited_(t);for(var i=0;i<e.length;i++)this.encoder_.writeSplitVarint64(r(e[i]),n(e[i]));this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedSplitZigzagVarint64=function(t,e,r,n){if(null!=e){t=this.beginDelimited_(t);for(var i=this.encoder_,o=0;o<e.length;o++)jspb.utils.toZigzag64(r(e[o]),n(e[o]),(function(t,e){i.writeSplitVarint64(t>>>0,e>>>0)}));this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedInt64String=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++){var n=jspb.arith.Int64.fromString(e[r]);this.encoder_.writeSplitVarint64(n.lo,n.hi)}this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedUint32=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeUnsignedVarint32(e[r]);this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedUint32String=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeUnsignedVarint32(parseInt(e[r],10));this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedUint64=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeUnsignedVarint64(e[r]);this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedUint64String=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++){var n=jspb.arith.UInt64.fromString(e[r]);this.encoder_.writeSplitVarint64(n.lo,n.hi)}this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedSint32=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeZigzagVarint32(e[r]);this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedSint64=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeZigzagVarint64(e[r]);this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedSint64String=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeZigzagVarintHash64(jspb.utils.decimalStringToHash64(e[r]));this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedSintHash64=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeZigzagVarintHash64(e[r]);this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedFixed32=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(4*e.length),t=0;t<e.length;t++)this.encoder_.writeUint32(e[t])},jspb.BinaryWriter.prototype.writePackedFixed64=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*e.length),t=0;t<e.length;t++)this.encoder_.writeUint64(e[t])},jspb.BinaryWriter.prototype.writePackedFixed64String=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*e.length),t=0;t<e.length;t++){var r=jspb.arith.UInt64.fromString(e[t]);this.encoder_.writeSplitFixed64(r.lo,r.hi)}},jspb.BinaryWriter.prototype.writePackedSfixed32=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(4*e.length),t=0;t<e.length;t++)this.encoder_.writeInt32(e[t])},jspb.BinaryWriter.prototype.writePackedSfixed64=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*e.length),t=0;t<e.length;t++)this.encoder_.writeInt64(e[t])},jspb.BinaryWriter.prototype.writePackedSfixed64String=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*e.length),t=0;t<e.length;t++)this.encoder_.writeInt64String(e[t])},jspb.BinaryWriter.prototype.writePackedFloat=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(4*e.length),t=0;t<e.length;t++)this.encoder_.writeFloat(e[t])},jspb.BinaryWriter.prototype.writePackedDouble=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*e.length),t=0;t<e.length;t++)this.encoder_.writeDouble(e[t])},jspb.BinaryWriter.prototype.writePackedBool=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(e.length),t=0;t<e.length;t++)this.encoder_.writeBool(e[t])},jspb.BinaryWriter.prototype.writePackedEnum=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeEnum(e[r]);this.endDelimited_(t)}},jspb.BinaryWriter.prototype.writePackedFixedHash64=function(t,e){if(null!=e&&e.length)for(this.writeFieldHeader_(t,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*e.length),t=0;t<e.length;t++)this.encoder_.writeFixedHash64(e[t])},jspb.BinaryWriter.prototype.writePackedVarintHash64=function(t,e){if(null!=e&&e.length){t=this.beginDelimited_(t);for(var r=0;r<e.length;r++)this.encoder_.writeVarintHash64(e[r]);this.endDelimited_(t)}},jspb.Map=function(t,e){this.arr_=t,this.valueCtor_=e,this.map_={},this.arrClean=!0,0<this.arr_.length&&this.loadFromArray_()},jspb.Map.prototype.loadFromArray_=function(){for(var t=0;t<this.arr_.length;t++){var e=this.arr_[t],r=e[0];this.map_[r.toString()]=new jspb.Map.Entry_(r,e[1])}this.arrClean=!0},jspb.Map.prototype.toArray=function(){if(this.arrClean){if(this.valueCtor_){var t,e=this.map_;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var r=e[t].valueWrapper;r&&r.toArray()}}}else{for(this.arr_.length=0,(e=this.stringKeys_()).sort(),t=0;t<e.length;t++){var n=this.map_[e[t]];(r=n.valueWrapper)&&r.toArray(),this.arr_.push([n.key,n.value])}this.arrClean=!0}return this.arr_},jspb.Map.prototype.toObject=function(t,e){for(var r=this.toArray(),n=[],i=0;i<r.length;i++){var o=this.map_[r[i][0].toString()];this.wrapEntry_(o);var a=o.valueWrapper;a?(goog.asserts.assert(e),n.push([o.key,e(t,a)])):n.push([o.key,o.value])}return n},jspb.Map.fromObject=function(t,e,r){e=new jspb.Map([],e);for(var n=0;n<t.length;n++){var i=t[n][0],o=r(t[n][1]);e.set(i,o)}return e},jspb.Map.ArrayIteratorIterable_=function(t){this.idx_=0,this.arr_=t},jspb.Map.ArrayIteratorIterable_.prototype.next=function(){return this.idx_<this.arr_.length?{done:!1,value:this.arr_[this.idx_++]}:{done:!0,value:void 0}},"undefined"!=typeof Symbol&&(jspb.Map.ArrayIteratorIterable_.prototype[Symbol.iterator]=function(){return this}),jspb.Map.prototype.getLength=function(){return this.stringKeys_().length},jspb.Map.prototype.clear=function(){this.map_={},this.arrClean=!1},jspb.Map.prototype.del=function(t){t=t.toString();var e=this.map_.hasOwnProperty(t);return delete this.map_[t],this.arrClean=!1,e},jspb.Map.prototype.getEntryList=function(){var t=[],e=this.stringKeys_();e.sort();for(var r=0;r<e.length;r++){var n=this.map_[e[r]];t.push([n.key,n.value])}return t},jspb.Map.prototype.entries=function(){var t=[],e=this.stringKeys_();e.sort();for(var r=0;r<e.length;r++){var n=this.map_[e[r]];t.push([n.key,this.wrapEntry_(n)])}return new jspb.Map.ArrayIteratorIterable_(t)},jspb.Map.prototype.keys=function(){var t=[],e=this.stringKeys_();e.sort();for(var r=0;r<e.length;r++)t.push(this.map_[e[r]].key);return new jspb.Map.ArrayIteratorIterable_(t)},jspb.Map.prototype.values=function(){var t=[],e=this.stringKeys_();e.sort();for(var r=0;r<e.length;r++)t.push(this.wrapEntry_(this.map_[e[r]]));return new jspb.Map.ArrayIteratorIterable_(t)},jspb.Map.prototype.forEach=function(t,e){var r=this.stringKeys_();r.sort();for(var n=0;n<r.length;n++){var i=this.map_[r[n]];t.call(e,this.wrapEntry_(i),i.key,this)}},jspb.Map.prototype.set=function(t,e){var r=new jspb.Map.Entry_(t);return this.valueCtor_?(r.valueWrapper=e,r.value=e.toArray()):r.value=e,this.map_[t.toString()]=r,this.arrClean=!1,this},jspb.Map.prototype.wrapEntry_=function(t){return this.valueCtor_?(t.valueWrapper||(t.valueWrapper=new this.valueCtor_(t.value)),t.valueWrapper):t.value},jspb.Map.prototype.get=function(t){if(t=this.map_[t.toString()])return this.wrapEntry_(t)},jspb.Map.prototype.has=function(t){return t.toString()in this.map_},jspb.Map.prototype.serializeBinary=function(t,e,r,n,i){var o=this.stringKeys_();o.sort();for(var a=0;a<o.length;a++){var s=this.map_[o[a]];e.beginSubMessage(t),r.call(e,1,s.key),this.valueCtor_?n.call(e,2,this.wrapEntry_(s),i):n.call(e,2,s.value),e.endSubMessage()}},jspb.Map.deserializeBinary=function(t,e,r,n,i,o,a){for(;e.nextField()&&!e.isEndGroup();){var s=e.getFieldNumber();1==s?o=r.call(e):2==s&&(t.valueCtor_?(goog.asserts.assert(i),a||(a=new t.valueCtor_),n.call(e,a,i)):a=n.call(e))}goog.asserts.assert(null!=o),goog.asserts.assert(null!=a),t.set(o,a)},jspb.Map.prototype.stringKeys_=function(){var t,e=this.map_,r=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.push(t);return r},jspb.Map.Entry_=function(t,e){this.key=t,this.value=e,this.valueWrapper=void 0},jspb.ExtensionFieldInfo=function(t,e,r,n,i){this.fieldIndex=t,this.fieldName=e,this.ctor=r,this.toObjectFn=n,this.isRepeated=i},jspb.ExtensionFieldBinaryInfo=function(t,e,r,n,i,o){this.fieldInfo=t,this.binaryReaderFn=e,this.binaryWriterFn=r,this.binaryMessageSerializeFn=n,this.binaryMessageDeserializeFn=i,this.isPacked=o},jspb.ExtensionFieldInfo.prototype.isMessageType=function(){return!!this.ctor},jspb.Message=function(){},jspb.Message.GENERATE_TO_OBJECT=!0,jspb.Message.GENERATE_FROM_OBJECT=!goog.DISALLOW_TEST_ONLY_CODE,jspb.Message.GENERATE_TO_STRING=!0,jspb.Message.ASSUME_LOCAL_ARRAYS=!1,jspb.Message.SERIALIZE_EMPTY_TRAILING_FIELDS=!0,jspb.Message.SUPPORTS_UINT8ARRAY_="function"==typeof Uint8Array,jspb.Message.prototype.getJsPbMessageId=function(){return this.messageId_},jspb.Message.getIndex_=function(t,e){return e+t.arrayIndexOffset_},jspb.Message.hiddenES6Property_=function(){},jspb.Message.getFieldNumber_=function(t,e){return e-t.arrayIndexOffset_},jspb.Message.initialize=function(t,e,r,n,i,o){if(t.wrappers_=null,e||(e=r?[r]:[]),t.messageId_=r?String(r):void 0,t.arrayIndexOffset_=0===r?-1:0,t.array=e,jspb.Message.initPivotAndExtensionObject_(t,n),t.convertedPrimitiveFields_={},jspb.Message.SERIALIZE_EMPTY_TRAILING_FIELDS||(t.repeatedFields=i),i)for(e=0;e<i.length;e++)(r=i[e])<t.pivot_?(r=jspb.Message.getIndex_(t,r),t.array[r]=t.array[r]||jspb.Message.EMPTY_LIST_SENTINEL_):(jspb.Message.maybeInitEmptyExtensionObject_(t),t.extensionObject_[r]=t.extensionObject_[r]||jspb.Message.EMPTY_LIST_SENTINEL_);if(o&&o.length)for(e=0;e<o.length;e++)jspb.Message.computeOneofCase(t,o[e])},jspb.Message.EMPTY_LIST_SENTINEL_=goog.DEBUG&&Object.freeze?Object.freeze([]):[],jspb.Message.isArray_=function(t){return jspb.Message.ASSUME_LOCAL_ARRAYS?t instanceof Array:Array.isArray(t)},jspb.Message.isExtensionObject_=function(t){return!(null===t||"object"!=typeof t||jspb.Message.isArray_(t)||jspb.Message.SUPPORTS_UINT8ARRAY_&&t instanceof Uint8Array)},jspb.Message.initPivotAndExtensionObject_=function(t,e){var r=t.array.length,n=-1;if(r&&(n=r-1,r=t.array[n],jspb.Message.isExtensionObject_(r)))return t.pivot_=jspb.Message.getFieldNumber_(t,n),void(t.extensionObject_=r);-1<e?(t.pivot_=Math.max(e,jspb.Message.getFieldNumber_(t,n+1)),t.extensionObject_=null):t.pivot_=Number.MAX_VALUE},jspb.Message.maybeInitEmptyExtensionObject_=function(t){var e=jspb.Message.getIndex_(t,t.pivot_);t.array[e]||(t.extensionObject_=t.array[e]={})},jspb.Message.toObjectList=function(t,e,r){for(var n=[],i=0;i<t.length;i++)n[i]=e.call(t[i],r,t[i]);return n},jspb.Message.toObjectExtension=function(t,e,r,n,i){for(var o in r){var a=r[o],s=n.call(t,a);if(null!=s){for(var u in a.fieldName)if(a.fieldName.hasOwnProperty(u))break;e[u]=a.toObjectFn?a.isRepeated?jspb.Message.toObjectList(s,a.toObjectFn,i):a.toObjectFn(i,s):s}}},jspb.Message.serializeBinaryExtensions=function(t,e,r,n){for(var i in r){var o=r[i],a=o.fieldInfo;if(!o.binaryWriterFn)throw Error("Message extension present that was generated without binary serialization support");var s=n.call(t,a);if(null!=s)if(a.isMessageType()){if(!o.binaryMessageSerializeFn)throw Error("Message extension present holding submessage without binary support enabled, and message is being serialized to binary format");o.binaryWriterFn.call(e,a.fieldIndex,s,o.binaryMessageSerializeFn)}else o.binaryWriterFn.call(e,a.fieldIndex,s)}},jspb.Message.readBinaryExtension=function(t,e,r,n,i){var o=r[e.getFieldNumber()];if(o){if(r=o.fieldInfo,!o.binaryReaderFn)throw Error("Deserializing extension whose generated code does not support binary format");if(r.isMessageType()){var a=new r.ctor;o.binaryReaderFn.call(e,a,o.binaryMessageDeserializeFn)}else a=o.binaryReaderFn.call(e);r.isRepeated&&!o.isPacked?(e=n.call(t,r))?e.push(a):i.call(t,r,[a]):i.call(t,r,a)}else e.skipField()},jspb.Message.getField=function(t,e){if(e<t.pivot_){e=jspb.Message.getIndex_(t,e);var r=t.array[e];return r===jspb.Message.EMPTY_LIST_SENTINEL_?t.array[e]=[]:r}if(t.extensionObject_)return(r=t.extensionObject_[e])===jspb.Message.EMPTY_LIST_SENTINEL_?t.extensionObject_[e]=[]:r},jspb.Message.getRepeatedField=function(t,e){return jspb.Message.getField(t,e)},jspb.Message.getOptionalFloatingPointField=function(t,e){return null==(t=jspb.Message.getField(t,e))?t:+t},jspb.Message.getBooleanField=function(t,e){return null==(t=jspb.Message.getField(t,e))?t:!!t},jspb.Message.getRepeatedFloatingPointField=function(t,e){var r=jspb.Message.getRepeatedField(t,e);if(t.convertedPrimitiveFields_||(t.convertedPrimitiveFields_={}),!t.convertedPrimitiveFields_[e]){for(var n=0;n<r.length;n++)r[n]=+r[n];t.convertedPrimitiveFields_[e]=!0}return r},jspb.Message.getRepeatedBooleanField=function(t,e){var r=jspb.Message.getRepeatedField(t,e);if(t.convertedPrimitiveFields_||(t.convertedPrimitiveFields_={}),!t.convertedPrimitiveFields_[e]){for(var n=0;n<r.length;n++)r[n]=!!r[n];t.convertedPrimitiveFields_[e]=!0}return r},jspb.Message.bytesAsB64=function(t){return null==t||"string"==typeof t?t:jspb.Message.SUPPORTS_UINT8ARRAY_&&t instanceof Uint8Array?goog.crypt.base64.encodeByteArray(t):(goog.asserts.fail("Cannot coerce to b64 string: "+goog.typeOf(t)),null)},jspb.Message.bytesAsU8=function(t){return null==t||t instanceof Uint8Array?t:"string"==typeof t?goog.crypt.base64.decodeStringToUint8Array(t):(goog.asserts.fail("Cannot coerce to Uint8Array: "+goog.typeOf(t)),null)},jspb.Message.bytesListAsB64=function(t){return jspb.Message.assertConsistentTypes_(t),t.length&&"string"!=typeof t[0]?goog.array.map(t,jspb.Message.bytesAsB64):t},jspb.Message.bytesListAsU8=function(t){return jspb.Message.assertConsistentTypes_(t),!t.length||t[0]instanceof Uint8Array?t:goog.array.map(t,jspb.Message.bytesAsU8)},jspb.Message.assertConsistentTypes_=function(t){if(goog.DEBUG&&t&&1<t.length){var e=goog.typeOf(t[0]);goog.array.forEach(t,(function(t){goog.typeOf(t)!=e&&goog.asserts.fail("Inconsistent type in JSPB repeated field array. Got "+goog.typeOf(t)+" expected "+e)}))}},jspb.Message.getFieldWithDefault=function(t,e,r){return null==(t=jspb.Message.getField(t,e))?r:t},jspb.Message.getBooleanFieldWithDefault=function(t,e,r){return null==(t=jspb.Message.getBooleanField(t,e))?r:t},jspb.Message.getFloatingPointFieldWithDefault=function(t,e,r){return null==(t=jspb.Message.getOptionalFloatingPointField(t,e))?r:t},jspb.Message.getFieldProto3=jspb.Message.getFieldWithDefault,jspb.Message.getMapField=function(t,e,r,n){if(t.wrappers_||(t.wrappers_={}),e in t.wrappers_)return t.wrappers_[e];var i=jspb.Message.getField(t,e);if(!i){if(r)return;i=[],jspb.Message.setField(t,e,i)}return t.wrappers_[e]=new jspb.Map(i,n)},jspb.Message.setField=function(t,e,r){return goog.asserts.assertInstanceof(t,jspb.Message),e<t.pivot_?t.array[jspb.Message.getIndex_(t,e)]=r:(jspb.Message.maybeInitEmptyExtensionObject_(t),t.extensionObject_[e]=r),t},jspb.Message.setProto3IntField=function(t,e,r){return jspb.Message.setFieldIgnoringDefault_(t,e,r,0)},jspb.Message.setProto3FloatField=function(t,e,r){return jspb.Message.setFieldIgnoringDefault_(t,e,r,0)},jspb.Message.setProto3BooleanField=function(t,e,r){return jspb.Message.setFieldIgnoringDefault_(t,e,r,!1)},jspb.Message.setProto3StringField=function(t,e,r){return jspb.Message.setFieldIgnoringDefault_(t,e,r,"")},jspb.Message.setProto3BytesField=function(t,e,r){return jspb.Message.setFieldIgnoringDefault_(t,e,r,"")},jspb.Message.setProto3EnumField=function(t,e,r){return jspb.Message.setFieldIgnoringDefault_(t,e,r,0)},jspb.Message.setProto3StringIntField=function(t,e,r){return jspb.Message.setFieldIgnoringDefault_(t,e,r,"0")},jspb.Message.setFieldIgnoringDefault_=function(t,e,r,n){return goog.asserts.assertInstanceof(t,jspb.Message),r!==n?jspb.Message.setField(t,e,r):e<t.pivot_?t.array[jspb.Message.getIndex_(t,e)]=null:(jspb.Message.maybeInitEmptyExtensionObject_(t),delete t.extensionObject_[e]),t},jspb.Message.addToRepeatedField=function(t,e,r,n){return goog.asserts.assertInstanceof(t,jspb.Message),e=jspb.Message.getRepeatedField(t,e),null!=n?e.splice(n,0,r):e.push(r),t},jspb.Message.setOneofField=function(t,e,r,n){return goog.asserts.assertInstanceof(t,jspb.Message),(r=jspb.Message.computeOneofCase(t,r))&&r!==e&&void 0!==n&&(t.wrappers_&&r in t.wrappers_&&(t.wrappers_[r]=void 0),jspb.Message.setField(t,r,void 0)),jspb.Message.setField(t,e,n)},jspb.Message.computeOneofCase=function(t,e){for(var r,n,i=0;i<e.length;i++){var o=e[i],a=jspb.Message.getField(t,o);null!=a&&(r=o,n=a,jspb.Message.setField(t,o,void 0))}return r?(jspb.Message.setField(t,r,n),r):0},jspb.Message.getWrapperField=function(t,e,r,n){if(t.wrappers_||(t.wrappers_={}),!t.wrappers_[r]){var i=jspb.Message.getField(t,r);(n||i)&&(t.wrappers_[r]=new e(i))}return t.wrappers_[r]},jspb.Message.getRepeatedWrapperField=function(t,e,r){return jspb.Message.wrapRepeatedField_(t,e,r),(e=t.wrappers_[r])==jspb.Message.EMPTY_LIST_SENTINEL_&&(e=t.wrappers_[r]=[]),e},jspb.Message.wrapRepeatedField_=function(t,e,r){if(t.wrappers_||(t.wrappers_={}),!t.wrappers_[r]){for(var n=jspb.Message.getRepeatedField(t,r),i=[],o=0;o<n.length;o++)i[o]=new e(n[o]);t.wrappers_[r]=i}},jspb.Message.setWrapperField=function(t,e,r){goog.asserts.assertInstanceof(t,jspb.Message),t.wrappers_||(t.wrappers_={});var n=r?r.toArray():r;return t.wrappers_[e]=r,jspb.Message.setField(t,e,n)},jspb.Message.setOneofWrapperField=function(t,e,r,n){goog.asserts.assertInstanceof(t,jspb.Message),t.wrappers_||(t.wrappers_={});var i=n?n.toArray():n;return t.wrappers_[e]=n,jspb.Message.setOneofField(t,e,r,i)},jspb.Message.setRepeatedWrapperField=function(t,e,r){goog.asserts.assertInstanceof(t,jspb.Message),t.wrappers_||(t.wrappers_={}),r=r||[];for(var n=[],i=0;i<r.length;i++)n[i]=r[i].toArray();return t.wrappers_[e]=r,jspb.Message.setField(t,e,n)},jspb.Message.addToRepeatedWrapperField=function(t,e,r,n,i){jspb.Message.wrapRepeatedField_(t,n,e);var o=t.wrappers_[e];return o||(o=t.wrappers_[e]=[]),r=r||new n,t=jspb.Message.getRepeatedField(t,e),null!=i?(o.splice(i,0,r),t.splice(i,0,r.toArray())):(o.push(r),t.push(r.toArray())),r},jspb.Message.toMap=function(t,e,r,n){for(var i={},o=0;o<t.length;o++)i[e.call(t[o])]=r?r.call(t[o],n,t[o]):t[o];return i},jspb.Message.prototype.syncMapFields_=function(){if(this.wrappers_)for(var t in this.wrappers_){var e=this.wrappers_[t];if(Array.isArray(e))for(var r=0;r<e.length;r++)e[r]&&e[r].toArray();else e&&e.toArray()}},jspb.Message.prototype.toArray=function(){return this.syncMapFields_(),this.array},jspb.Message.GENERATE_TO_STRING&&(jspb.Message.prototype.toString=function(){return this.syncMapFields_(),this.array.toString()}),jspb.Message.prototype.getExtension=function(t){if(this.extensionObject_){this.wrappers_||(this.wrappers_={});var e=t.fieldIndex;if(t.isRepeated){if(t.isMessageType())return this.wrappers_[e]||(this.wrappers_[e]=goog.array.map(this.extensionObject_[e]||[],(function(e){return new t.ctor(e)}))),this.wrappers_[e]}else if(t.isMessageType())return!this.wrappers_[e]&&this.extensionObject_[e]&&(this.wrappers_[e]=new t.ctor(this.extensionObject_[e])),this.wrappers_[e];return this.extensionObject_[e]}},jspb.Message.prototype.setExtension=function(t,e){this.wrappers_||(this.wrappers_={}),jspb.Message.maybeInitEmptyExtensionObject_(this);var r=t.fieldIndex;return t.isRepeated?(e=e||[],t.isMessageType()?(this.wrappers_[r]=e,this.extensionObject_[r]=goog.array.map(e,(function(t){return t.toArray()}))):this.extensionObject_[r]=e):t.isMessageType()?(this.wrappers_[r]=e,this.extensionObject_[r]=e?e.toArray():e):this.extensionObject_[r]=e,this},jspb.Message.difference=function(t,e){if(!(t instanceof e.constructor))throw Error("Messages have different types.");var r=t.toArray();e=e.toArray();var n=[],i=0,o=r.length>e.length?r.length:e.length;for(t.getJsPbMessageId()&&(n[0]=t.getJsPbMessageId(),i=1);i<o;i++)jspb.Message.compareFields(r[i],e[i])||(n[i]=e[i]);return new t.constructor(n)},jspb.Message.equals=function(t,e){return t==e||!(!t||!e)&&t instanceof e.constructor&&jspb.Message.compareFields(t.toArray(),e.toArray())},jspb.Message.compareExtensions=function(t,e){t=t||{},e=e||{};var r,n={};for(r in t)n[r]=0;for(r in e)n[r]=0;for(r in n)if(!jspb.Message.compareFields(t[r],e[r]))return!1;return!0},jspb.Message.compareFields=function(t,e){if(t==e)return!0;if(!goog.isObject(t)||!goog.isObject(e))return!!("number"==typeof t&&isNaN(t)||"number"==typeof e&&isNaN(e))&&String(t)==String(e);if(t.constructor!=e.constructor)return!1;if(jspb.Message.SUPPORTS_UINT8ARRAY_&&t.constructor===Uint8Array){if(t.length!=e.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!=e[r])return!1;return!0}if(t.constructor===Array){var n=void 0,i=void 0,o=Math.max(t.length,e.length);for(r=0;r<o;r++){var a=t[r],s=e[r];if(a&&a.constructor==Object&&(goog.asserts.assert(void 0===n),goog.asserts.assert(r===t.length-1),n=a,a=void 0),s&&s.constructor==Object&&(goog.asserts.assert(void 0===i),goog.asserts.assert(r===e.length-1),i=s,s=void 0),!jspb.Message.compareFields(a,s))return!1}return!n&&!i||(n=n||{},i=i||{},jspb.Message.compareExtensions(n,i))}if(t.constructor===Object)return jspb.Message.compareExtensions(t,e);throw Error("Invalid type in JSPB array")},jspb.Message.prototype.cloneMessage=function(){return jspb.Message.cloneMessage(this)},jspb.Message.prototype.clone=function(){return jspb.Message.cloneMessage(this)},jspb.Message.clone=function(t){return jspb.Message.cloneMessage(t)},jspb.Message.cloneMessage=function(t){return new t.constructor(jspb.Message.clone_(t.toArray()))},jspb.Message.copyInto=function(t,e){goog.asserts.assertInstanceof(t,jspb.Message),goog.asserts.assertInstanceof(e,jspb.Message),goog.asserts.assert(t.constructor==e.constructor,"Copy source and target message should have the same type."),t=jspb.Message.clone(t);for(var r=e.toArray(),n=t.toArray(),i=r.length=0;i<n.length;i++)r[i]=n[i];e.wrappers_=t.wrappers_,e.extensionObject_=t.extensionObject_},jspb.Message.clone_=function(t){if(Array.isArray(t)){for(var e=Array(t.length),r=0;r<t.length;r++){var n=t[r];null!=n&&(e[r]="object"==typeof n?jspb.Message.clone_(goog.asserts.assert(n)):n)}return e}if(jspb.Message.SUPPORTS_UINT8ARRAY_&&t instanceof Uint8Array)return new Uint8Array(t);for(r in e={},t)null!=(n=t[r])&&(e[r]="object"==typeof n?jspb.Message.clone_(goog.asserts.assert(n)):n);return e},jspb.Message.registerMessageType=function(t,e){e.messageId=t},jspb.Message.messageSetExtensions={},jspb.Message.messageSetExtensionsBinary={},jspb.Export={},exports.Map=jspb.Map,exports.Message=jspb.Message,exports.BinaryReader=jspb.BinaryReader,exports.BinaryWriter=jspb.BinaryWriter,exports.ExtensionFieldInfo=jspb.ExtensionFieldInfo,exports.ExtensionFieldBinaryInfo=jspb.ExtensionFieldBinaryInfo,exports.exportSymbol=goog.exportSymbol,exports.inherits=goog.inherits,exports.object={extend:goog.object.extend},exports.typeOf=goog.typeOf}).call(this,__webpack_require__(24),__webpack_require__(14).Buffer)},function(t,e,r){(function(e,n){const i=r(235).require(),o=r(50),a=r(236),s="object"==typeof e&&"win32"===e.platform,u=t=>t&&"object"==typeof t,c=new Uint32Array(256).map((t,e)=>{for(let t=0;t<8;t++)0!=(1&e)?e=3988292384^e>>>1:e>>>=1;return e>>>0});function l(t){this.sep=o.sep,this.fs=i,u(t)&&u(t.fs)&&"function"==typeof t.fs.statSync&&(this.fs=t.fs)}t.exports=l,l.prototype.makeDir=function(t){const e=this;!function(t){let r=t.split(e.sep)[0];t.split(e.sep).forEach((function(t){if(t&&":"!==t.substr(-1,1)){var n;r+=e.sep+t;try{n=e.fs.statSync(r)}catch(t){e.fs.mkdirSync(r)}if(n&&n.isFile())throw Errors.FILE_IN_THE_WAY.replace("%s",r)}}))}(t)},l.prototype.writeFileTo=function(t,e,r,n){const i=this;if(i.fs.existsSync(t)){if(!r)return!1;if(i.fs.statSync(t).isDirectory())return!1}var a,s=o.dirname(t);i.fs.existsSync(s)||i.makeDir(s);try{a=i.fs.openSync(t,"w",438)}catch(e){i.fs.chmodSync(t,438),a=i.fs.openSync(t,"w",438)}if(a)try{i.fs.writeSync(a,e,0,e.length,0)}finally{i.fs.closeSync(a)}return i.fs.chmodSync(t,n||438),!0},l.prototype.writeFileToAsync=function(t,e,r,n,i){"function"==typeof n&&(i=n,n=void 0);const a=this;a.fs.exists(t,(function(s){if(s&&!r)return i(!1);a.fs.stat(t,(function(r,u){if(s&&u.isDirectory())return i(!1);var c=o.dirname(t);a.fs.exists(c,(function(r){r||a.makeDir(c),a.fs.open(t,"w",438,(function(r,o){r?a.fs.chmod(t,438,(function(){a.fs.open(t,"w",438,(function(r,o){a.fs.write(o,e,0,e.length,0,(function(){a.fs.close(o,(function(){a.fs.chmod(t,n||438,(function(){i(!0)}))}))}))}))})):o?a.fs.write(o,e,0,e.length,0,(function(){a.fs.close(o,(function(){a.fs.chmod(t,n||438,(function(){i(!0)}))}))})):a.fs.chmod(t,n||438,(function(){i(!0)}))}))}))}))}))},l.prototype.findFiles=function(t){const e=this;return function t(r,n,i){"boolean"==typeof n&&(i=n,n=void 0);let a=[];return e.fs.readdirSync(r).forEach((function(s){var u=o.join(r,s);e.fs.statSync(u).isDirectory()&&i&&(a=a.concat(t(u,n,i))),n&&!n.test(u)||a.push(o.normalize(u)+(e.fs.statSync(u).isDirectory()?e.sep:""))})),a}(t,void 0,!0)},l.prototype.getAttributes=function(){},l.prototype.setAttributes=function(){},l.crc32update=function(t,e){return c[255&(t^e)]^t>>>8},l.crc32=function(t){"string"==typeof t&&(t=n.from(t,"utf8")),c.length||genCRCTable();let e=t.length,r=-1;for(let n=0;n<e;)r=l.crc32update(r,t[n++]);return~r>>>0},l.methodToString=function(t){switch(t){case a.STORED:return"STORED ("+t+")";case a.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}},l.canonical=function(t){if(!t)return"";var e=o.posix.normalize("/"+t.split("\\").join("/"));return o.join(".",e)},l.sanitize=function(t,e){t=o.resolve(o.normalize(t));for(var r=e.split("/"),n=0,i=r.length;n<i;n++){var a=o.normalize(o.join(t,r.slice(n,i).join(o.sep)));if(0===a.indexOf(t))return a}return o.normalize(o.join(t,o.basename(e)))},l.toBuffer=function(t){return n.isBuffer(t)?t:t instanceof Uint8Array?n.from(t):"string"==typeof t?n.from(t,"utf8"):n.alloc(0)},l.readBigUInt64LE=function(t,e){var r=n.from(t.slice(e,e+8));return r.swap64(),parseInt("0x"+r.toString("hex"))},l.isWin=s,l.crcTable=c}).call(this,r(20),r(14).Buffer)},function(t,e){t.exports={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed",FILE_IN_THE_WAY:"There is a file in the way: %s",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:"File not found: %s",NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found"}},function(t,e,r){const n=r(235).require(),i=r(50);n.existsSync=n.existsSync||i.existsSync,t.exports=function(t){var e=t||"",r={directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0},o=null;return e&&n.existsSync(e)?(o=n.statSync(e),r.directory=o.isDirectory(),r.mtime=o.mtime,r.atime=o.atime,r.executable=0!=(73&o.mode),r.readonly=0==(128&o.mode),r.hidden="."===i.basename(e)[0]):console.warn("Invalid path: "+e),{get directory(){return r.directory},get readOnly(){return r.readonly},get hidden(){return r.hidden},get mtime(){return r.mtime},get atime(){return r.atime},get executable(){return r.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:e,isDirectory:r.directory,isReadOnly:r.readonly,isHidden:r.hidden,isExecutable:r.executable,mTime:r.mtime,aTime:r.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}},function(t,e,r){(function(e){var n=r(103),i=n.Constants;t.exports=function(){var t=20,r=10,o=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,h=0,g=0,p=0,m=0,y=0;t|=n.isWin?2560:768,o|=i.FLG_EFS;var b={};function w(t){t=new Date(t),s=(t.getFullYear()-1980&127)<<25|t.getMonth()+1<<21|t.getDate()<<16|t.getHours()<<11|t.getMinutes()<<5|t.getSeconds()>>1}return w(+new Date),{get made(){return t},set made(e){t=e},get version(){return r},set version(t){r=t},get flags(){return o},set flags(t){o=t},get method(){return a},set method(t){switch(t){case i.STORED:this.version=10;case i.DEFLATED:default:this.version=20}a=t},get time(){return new Date(1980+(s>>25&127),(s>>21&15)-1,s>>16&31,s>>11&31,s>>5&63,(31&s)<<1)},set time(t){w(t)},get crc(){return u},set crc(t){u=Math.max(0,t)>>>0},get compressedSize(){return c},set compressedSize(t){c=Math.max(0,t)>>>0},get size(){return l},set size(t){l=Math.max(0,t)>>>0},get fileNameLength(){return f},set fileNameLength(t){f=t},get extraLength(){return d},set extraLength(t){d=t},get commentLength(){return h},set commentLength(t){h=t},get diskNumStart(){return g},set diskNumStart(t){g=Math.max(0,t)>>>0},get inAttr(){return p},set inAttr(t){p=Math.max(0,t)>>>0},get attr(){return m},set attr(t){m=Math.max(0,t)>>>0},get fileAttr(){return m?(m>>>0|0)>>16&4095:0},get offset(){return y},set offset(t){y=Math.max(0,t)>>>0},get encripted(){return 1==(1&o)},get entryHeaderSize(){return i.CENHDR+f+d+h},get realDataOffset(){return y+i.LOCHDR+b.fnameLen+b.extraLen},get dataHeader(){return b},loadDataHeaderFromBinary:function(t){var e=t.slice(y,y+i.LOCHDR);if(e.readUInt32LE(0)!==i.LOCSIG)throw new Error(n.Errors.INVALID_LOC);b={version:e.readUInt16LE(i.LOCVER),flags:e.readUInt16LE(i.LOCFLG),method:e.readUInt16LE(i.LOCHOW),time:e.readUInt32LE(i.LOCTIM),crc:e.readUInt32LE(i.LOCCRC),compressedSize:e.readUInt32LE(i.LOCSIZ),size:e.readUInt32LE(i.LOCLEN),fnameLen:e.readUInt16LE(i.LOCNAM),extraLen:e.readUInt16LE(i.LOCEXT)}},loadFromBinary:function(e){if(e.length!==i.CENHDR||e.readUInt32LE(0)!==i.CENSIG)throw new Error(n.Errors.INVALID_CEN);t=e.readUInt16LE(i.CENVEM),r=e.readUInt16LE(i.CENVER),o=e.readUInt16LE(i.CENFLG),a=e.readUInt16LE(i.CENHOW),s=e.readUInt32LE(i.CENTIM),u=e.readUInt32LE(i.CENCRC),c=e.readUInt32LE(i.CENSIZ),l=e.readUInt32LE(i.CENLEN),f=e.readUInt16LE(i.CENNAM),d=e.readUInt16LE(i.CENEXT),h=e.readUInt16LE(i.CENCOM),g=e.readUInt16LE(i.CENDSK),p=e.readUInt16LE(i.CENATT),m=e.readUInt32LE(i.CENATX),y=e.readUInt32LE(i.CENOFF)},dataHeaderToBinary:function(){var t=e.alloc(i.LOCHDR);return t.writeUInt32LE(i.LOCSIG,0),t.writeUInt16LE(r,i.LOCVER),t.writeUInt16LE(o,i.LOCFLG),t.writeUInt16LE(a,i.LOCHOW),t.writeUInt32LE(s,i.LOCTIM),t.writeUInt32LE(u,i.LOCCRC),t.writeUInt32LE(c,i.LOCSIZ),t.writeUInt32LE(l,i.LOCLEN),t.writeUInt16LE(f,i.LOCNAM),t.writeUInt16LE(d,i.LOCEXT),t},entryHeaderToBinary:function(){var n=e.alloc(i.CENHDR+f+d+h);return n.writeUInt32LE(i.CENSIG,0),n.writeUInt16LE(t,i.CENVEM),n.writeUInt16LE(r,i.CENVER),n.writeUInt16LE(o,i.CENFLG),n.writeUInt16LE(a,i.CENHOW),n.writeUInt32LE(s,i.CENTIM),n.writeUInt32LE(u,i.CENCRC),n.writeUInt32LE(c,i.CENSIZ),n.writeUInt32LE(l,i.CENLEN),n.writeUInt16LE(f,i.CENNAM),n.writeUInt16LE(d,i.CENEXT),n.writeUInt16LE(h,i.CENCOM),n.writeUInt16LE(g,i.CENDSK),n.writeUInt16LE(p,i.CENATT),n.writeUInt32LE(m,i.CENATX),n.writeUInt32LE(y,i.CENOFF),n.fill(0,i.CENHDR),n},toJSON:function(){const e=function(t){return t+" bytes"};return{made:t,version:r,flags:o,method:n.methodToString(a),time:this.time,crc:"0x"+u.toString(16).toUpperCase(),compressedSize:e(c),size:e(l),fileNameLength:e(f),extraLength:e(d),commentLength:e(h),diskNumStart:g,inAttr:p,attr:m,offset:y,entryHeaderSize:e(i.CENHDR+f+d+h)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}).call(this,r(14).Buffer)},function(t,e,r){(function(e){var n=r(103),i=n.Constants;t.exports=function(){var t=0,r=0,o=0,a=0,s=0;return{get diskEntries(){return t},set diskEntries(e){t=r=e},get totalEntries(){return r},set totalEntries(e){r=t=e},get size(){return o},set size(t){o=t},get offset(){return a},set offset(t){a=t},get commentLength(){return s},set commentLength(t){s=t},get mainHeaderSize(){return i.ENDHDR+s},loadFromBinary:function(e){if((e.length!==i.ENDHDR||e.readUInt32LE(0)!==i.ENDSIG)&&(e.length<i.ZIP64HDR||e.readUInt32LE(0)!==i.ZIP64SIG))throw new Error(n.Errors.INVALID_END);e.readUInt32LE(0)===i.ENDSIG?(t=e.readUInt16LE(i.ENDSUB),r=e.readUInt16LE(i.ENDTOT),o=e.readUInt32LE(i.ENDSIZ),a=e.readUInt32LE(i.ENDOFF),s=e.readUInt16LE(i.ENDCOM)):(t=n.readBigUInt64LE(e,i.ZIP64SUB),r=n.readBigUInt64LE(e,i.ZIP64TOT),o=n.readBigUInt64LE(e,i.ZIP64SIZ),a=n.readBigUInt64LE(e,i.ZIP64OFF),s=0)},toBinary:function(){var n=e.alloc(i.ENDHDR+s);return n.writeUInt32LE(i.ENDSIG,0),n.writeUInt32LE(0,4),n.writeUInt16LE(t,i.ENDSUB),n.writeUInt16LE(r,i.ENDTOT),n.writeUInt32LE(o,i.ENDSIZ),n.writeUInt32LE(a,i.ENDOFF),n.writeUInt16LE(s,i.ENDCOM),n.fill(" ",i.ENDHDR),n},toJSON:function(){return{diskEntries:t,totalEntries:r,size:o+" bytes",offset:function(t,e){let r=t.toString(16).toUpperCase();for(;r.length<e;)r="0"+r;return"0x"+r}(a,4),commentLength:s}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}).call(this,r(14).Buffer)},function(t,e,r){e.Deflater=r(409),e.Inflater=r(419),e.ZipCrypto=r(420)},function(t,e,r){(function(e){t.exports=function(t){var n=r(239),i={chunkSize:1024*(parseInt(t.length/1024)+1)};return{deflate:function(){return n.deflateRawSync(t,i)},deflateAsync:function(r){var o=n.createDeflateRaw(i),a=[],s=0;o.on("data",(function(t){a.push(t),s+=t.length})),o.on("end",(function(){var t=e.alloc(s),n=0;t.fill(0);for(var i=0;i<a.length;i++){var o=a[i];o.copy(t,n),n+=o.length}r&&r(t)})),o.end(t)}}}}).call(this,r(14).Buffer)},function(t,e,r){"use strict";(function(t,n){var i=r(137),o=r(411),a=r(412),s=r(415),u=r(418);for(var c in u)e[c]=u[c];e.NONE=0,e.DEFLATE=1,e.INFLATE=2,e.GZIP=3,e.GUNZIP=4,e.DEFLATERAW=5,e.INFLATERAW=6,e.UNZIP=7;function l(t){if("number"!=typeof t||t<e.DEFLATE||t>e.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=t,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}l.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,i(this.init_done,"close before init"),i(this.mode<=e.UNZIP),this.mode===e.DEFLATE||this.mode===e.GZIP||this.mode===e.DEFLATERAW?a.deflateEnd(this.strm):this.mode!==e.INFLATE&&this.mode!==e.GUNZIP&&this.mode!==e.INFLATERAW&&this.mode!==e.UNZIP||s.inflateEnd(this.strm),this.mode=e.NONE,this.dictionary=null)},l.prototype.write=function(t,e,r,n,i,o,a){return this._write(!0,t,e,r,n,i,o,a)},l.prototype.writeSync=function(t,e,r,n,i,o,a){return this._write(!1,t,e,r,n,i,o,a)},l.prototype._write=function(r,o,a,s,u,c,l,f){if(i.equal(arguments.length,8),i(this.init_done,"write before init"),i(this.mode!==e.NONE,"already finalized"),i.equal(!1,this.write_in_progress,"write already in progress"),i.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,i.equal(!1,void 0===o,"must provide flush value"),this.write_in_progress=!0,o!==e.Z_NO_FLUSH&&o!==e.Z_PARTIAL_FLUSH&&o!==e.Z_SYNC_FLUSH&&o!==e.Z_FULL_FLUSH&&o!==e.Z_FINISH&&o!==e.Z_BLOCK)throw new Error("Invalid flush value");if(null==a&&(a=t.alloc(0),u=0,s=0),this.strm.avail_in=u,this.strm.input=a,this.strm.next_in=s,this.strm.avail_out=f,this.strm.output=c,this.strm.next_out=l,this.flush=o,!r)return this._process(),this._checkError()?this._afterSync():void 0;var d=this;return n.nextTick((function(){d._process(),d._after()})),this},l.prototype._afterSync=function(){var t=this.strm.avail_out,e=this.strm.avail_in;return this.write_in_progress=!1,[e,t]},l.prototype._process=function(){var t=null;switch(this.mode){case e.DEFLATE:case e.GZIP:case e.DEFLATERAW:this.err=a.deflate(this.strm,this.flush);break;case e.UNZIP:switch(this.strm.avail_in>0&&(t=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===t)break;if(31!==this.strm.input[t]){this.mode=e.INFLATE;break}if(this.gzip_id_bytes_read=1,t++,1===this.strm.avail_in)break;case 1:if(null===t)break;139===this.strm.input[t]?(this.gzip_id_bytes_read=2,this.mode=e.GUNZIP):this.mode=e.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case e.INFLATE:case e.GUNZIP:case e.INFLATERAW:for(this.err=s.inflate(this.strm,this.flush),this.err===e.Z_NEED_DICT&&this.dictionary&&(this.err=s.inflateSetDictionary(this.strm,this.dictionary),this.err===e.Z_OK?this.err=s.inflate(this.strm,this.flush):this.err===e.Z_DATA_ERROR&&(this.err=e.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===e.GUNZIP&&this.err===e.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=s.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},l.prototype._checkError=function(){switch(this.err){case e.Z_OK:case e.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===e.Z_FINISH)return this._error("unexpected end of file"),!1;break;case e.Z_STREAM_END:break;case e.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},l.prototype._after=function(){if(this._checkError()){var t=this.strm.avail_out,e=this.strm.avail_in;this.write_in_progress=!1,this.callback(e,t),this.pending_close&&this.close()}},l.prototype._error=function(t){this.strm.msg&&(t=this.strm.msg),this.onerror(t,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},l.prototype.init=function(t,r,n,o,a){i(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),i(t>=8&&t<=15,"invalid windowBits"),i(r>=-1&&r<=9,"invalid compression level"),i(n>=1&&n<=9,"invalid memlevel"),i(o===e.Z_FILTERED||o===e.Z_HUFFMAN_ONLY||o===e.Z_RLE||o===e.Z_FIXED||o===e.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(r,t,n,o,a),this._setDictionary()},l.prototype.params=function(){throw new Error("deflateParams Not supported")},l.prototype.reset=function(){this._reset(),this._setDictionary()},l.prototype._init=function(t,r,n,i,u){switch(this.level=t,this.windowBits=r,this.memLevel=n,this.strategy=i,this.flush=e.Z_NO_FLUSH,this.err=e.Z_OK,this.mode!==e.GZIP&&this.mode!==e.GUNZIP||(this.windowBits+=16),this.mode===e.UNZIP&&(this.windowBits+=32),this.mode!==e.DEFLATERAW&&this.mode!==e.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new o,this.mode){case e.DEFLATE:case e.GZIP:case e.DEFLATERAW:this.err=a.deflateInit2(this.strm,this.level,e.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case e.INFLATE:case e.GUNZIP:case e.INFLATERAW:case e.UNZIP:this.err=s.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==e.Z_OK&&this._error("Init error"),this.dictionary=u,this.write_in_progress=!1,this.init_done=!0},l.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=e.Z_OK,this.mode){case e.DEFLATE:case e.DEFLATERAW:this.err=a.deflateSetDictionary(this.strm,this.dictionary)}this.err!==e.Z_OK&&this._error("Failed to set dictionary")}},l.prototype._reset=function(){switch(this.err=e.Z_OK,this.mode){case e.DEFLATE:case e.DEFLATERAW:case e.GZIP:this.err=a.deflateReset(this.strm);break;case e.INFLATE:case e.INFLATERAW:case e.GUNZIP:this.err=s.inflateReset(this.strm)}this.err!==e.Z_OK&&this._error("Failed to reset stream")},e.Zlib=l}).call(this,r(14).Buffer,r(20))},function(t,e,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(t,e,r){"use strict";var n,i=r(115),o=r(413),a=r(240),s=r(241),u=r(414);function c(t,e){return t.msg=u[e],e}function l(t){return(t<<1)-(t>4?9:0)}function f(t){for(var e=t.length;--e>=0;)t[e]=0}function d(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(i.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))}function h(t,e){o._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,d(t.strm)}function g(t,e){t.pending_buf[t.pending++]=e}function p(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function m(t,e){var r,n,i=t.max_chain_length,o=t.strstart,a=t.prev_length,s=t.nice_match,u=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,c=t.window,l=t.w_mask,f=t.prev,d=t.strstart+258,h=c[o+a-1],g=c[o+a];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(c[(r=e)+a]===g&&c[r+a-1]===h&&c[r]===c[o]&&c[++r]===c[o+1]){o+=2,r++;do{}while(c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&o<d);if(n=258-(d-o),o=d-258,n>a){if(t.match_start=e,a=n,n>=s)break;h=c[o+a-1],g=c[o+a]}}}while((e=f[e&l])>u&&0!=--i);return a<=t.lookahead?a:t.lookahead}function y(t){var e,r,n,o,u,c,l,f,d,h,g=t.w_size;do{if(o=t.window_size-t.lookahead-t.strstart,t.strstart>=g+(g-262)){i.arraySet(t.window,t.window,g,g,0),t.match_start-=g,t.strstart-=g,t.block_start-=g,e=r=t.hash_size;do{n=t.head[--e],t.head[e]=n>=g?n-g:0}while(--r);e=r=g;do{n=t.prev[--e],t.prev[e]=n>=g?n-g:0}while(--r);o+=g}if(0===t.strm.avail_in)break;if(c=t.strm,l=t.window,f=t.strstart+t.lookahead,d=o,h=void 0,(h=c.avail_in)>d&&(h=d),r=0===h?0:(c.avail_in-=h,i.arraySet(l,c.input,c.next_in,h,f),1===c.state.wrap?c.adler=a(c.adler,l,h,f):2===c.state.wrap&&(c.adler=s(c.adler,l,h,f)),c.next_in+=h,c.total_in+=h,h),t.lookahead+=r,t.lookahead+t.insert>=3)for(u=t.strstart-t.insert,t.ins_h=t.window[u],t.ins_h=(t.ins_h<<t.hash_shift^t.window[u+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[u+3-1])&t.hash_mask,t.prev[u&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=u,u++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<262&&0!==t.strm.avail_in)}function b(t,e){for(var r,n;;){if(t.lookahead<262){if(y(t),t.lookahead<262&&0===e)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-262&&(t.match_length=m(t,r)),t.match_length>=3)if(n=o._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(h(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,4===e?(h(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(h(t,!1),0===t.strm.avail_out)?1:2}function w(t,e){for(var r,n,i;;){if(t.lookahead<262){if(y(t),t.lookahead<262&&0===e)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-262&&(t.match_length=m(t,r),t.match_length<=5&&(1===t.strategy||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,n=o._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(h(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((n=o._tr_tally(t,0,t.window[t.strstart-1]))&&h(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=o._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,4===e?(h(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(h(t,!1),0===t.strm.avail_out)?1:2}function _(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}function v(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(1146),this.dyn_dtree=new i.Buf16(122),this.bl_tree=new i.Buf16(78),f(this.dyn_ltree),f(this.dyn_dtree),f(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(16),this.heap=new i.Buf16(573),f(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(573),f(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function E(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=2,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:113,t.adler=2===e.wrap?0:1,e.last_flush=0,o._tr_init(e),0):c(t,-2)}function S(t){var e,r=E(t);return 0===r&&((e=t.state).window_size=2*e.w_size,f(e.head),e.max_lazy_match=n[e.level].max_lazy,e.good_match=n[e.level].good_length,e.nice_match=n[e.level].nice_length,e.max_chain_length=n[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0),r}function O(t,e,r,n,o,a){if(!t)return-2;var s=1;if(-1===e&&(e=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),o<1||o>9||8!==r||n<8||n>15||e<0||e>9||a<0||a>4)return c(t,-2);8===n&&(n=9);var u=new v;return t.state=u,u.strm=t,u.wrap=s,u.gzhead=null,u.w_bits=n,u.w_size=1<<u.w_bits,u.w_mask=u.w_size-1,u.hash_bits=o+7,u.hash_size=1<<u.hash_bits,u.hash_mask=u.hash_size-1,u.hash_shift=~~((u.hash_bits+3-1)/3),u.window=new i.Buf8(2*u.w_size),u.head=new i.Buf16(u.hash_size),u.prev=new i.Buf16(u.w_size),u.lit_bufsize=1<<o+6,u.pending_buf_size=4*u.lit_bufsize,u.pending_buf=new i.Buf8(u.pending_buf_size),u.d_buf=1*u.lit_bufsize,u.l_buf=3*u.lit_bufsize,u.level=e,u.strategy=a,u.method=r,S(t)}n=[new _(0,0,0,0,(function(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(y(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+r;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,h(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-262&&(h(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(h(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(h(t,!1),t.strm.avail_out),1)})),new _(4,4,8,4,b),new _(4,5,16,8,b),new _(4,6,32,32,b),new _(4,4,16,16,w),new _(8,16,32,32,w),new _(8,16,128,128,w),new _(8,32,128,256,w),new _(32,128,258,1024,w),new _(32,258,258,4096,w)],e.deflateInit=function(t,e){return O(t,e,8,15,8,0)},e.deflateInit2=O,e.deflateReset=S,e.deflateResetKeep=E,e.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?-2:(t.state.gzhead=e,0):-2},e.deflate=function(t,e){var r,i,a,u;if(!t||!t.state||e>5||e<0)return t?c(t,-2):-2;if(i=t.state,!t.output||!t.input&&0!==t.avail_in||666===i.status&&4!==e)return c(t,0===t.avail_out?-5:-2);if(i.strm=t,r=i.last_flush,i.last_flush=e,42===i.status)if(2===i.wrap)t.adler=0,g(i,31),g(i,139),g(i,8),i.gzhead?(g(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),g(i,255&i.gzhead.time),g(i,i.gzhead.time>>8&255),g(i,i.gzhead.time>>16&255),g(i,i.gzhead.time>>24&255),g(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),g(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(g(i,255&i.gzhead.extra.length),g(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=s(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(g(i,0),g(i,0),g(i,0),g(i,0),g(i,0),g(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),g(i,3),i.status=113);else{var m=8+(i.w_bits-8<<4)<<8;m|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(m|=32),m+=31-m%31,i.status=113,p(i,m),0!==i.strstart&&(p(i,t.adler>>>16),p(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(a=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),d(t),a=i.pending,i.pending!==i.pending_buf_size));)g(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),d(t),a=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,g(i,u)}while(0!==u);i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),0===u&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),d(t),a=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,g(i,u)}while(0!==u);i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),0===u&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&d(t),i.pending+2<=i.pending_buf_size&&(g(i,255&t.adler),g(i,t.adler>>8&255),t.adler=0,i.status=113)):i.status=113),0!==i.pending){if(d(t),0===t.avail_out)return i.last_flush=-1,0}else if(0===t.avail_in&&l(e)<=l(r)&&4!==e)return c(t,-5);if(666===i.status&&0!==t.avail_in)return c(t,-5);if(0!==t.avail_in||0!==i.lookahead||0!==e&&666!==i.status){var b=2===i.strategy?function(t,e){for(var r;;){if(0===t.lookahead&&(y(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,r=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(h(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(h(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(h(t,!1),0===t.strm.avail_out)?1:2}(i,e):3===i.strategy?function(t,e){for(var r,n,i,a,s=t.window;;){if(t.lookahead<=258){if(y(t),t.lookahead<=258&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=s[i=t.strstart-1])===s[++i]&&n===s[++i]&&n===s[++i]){a=t.strstart+258;do{}while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&i<a);t.match_length=258-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=o._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(h(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(h(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(h(t,!1),0===t.strm.avail_out)?1:2}(i,e):n[i.level].func(i,e);if(3!==b&&4!==b||(i.status=666),1===b||3===b)return 0===t.avail_out&&(i.last_flush=-1),0;if(2===b&&(1===e?o._tr_align(i):5!==e&&(o._tr_stored_block(i,0,0,!1),3===e&&(f(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),d(t),0===t.avail_out))return i.last_flush=-1,0}return 4!==e?0:i.wrap<=0?1:(2===i.wrap?(g(i,255&t.adler),g(i,t.adler>>8&255),g(i,t.adler>>16&255),g(i,t.adler>>24&255),g(i,255&t.total_in),g(i,t.total_in>>8&255),g(i,t.total_in>>16&255),g(i,t.total_in>>24&255)):(p(i,t.adler>>>16),p(i,65535&t.adler)),d(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?0:1)},e.deflateEnd=function(t){var e;return t&&t.state?42!==(e=t.state.status)&&69!==e&&73!==e&&91!==e&&103!==e&&113!==e&&666!==e?c(t,-2):(t.state=null,113===e?c(t,-3):0):-2},e.deflateSetDictionary=function(t,e){var r,n,o,s,u,c,l,d,h=e.length;if(!t||!t.state)return-2;if(2===(s=(r=t.state).wrap)||1===s&&42!==r.status||r.lookahead)return-2;for(1===s&&(t.adler=a(t.adler,e,h,0)),r.wrap=0,h>=r.w_size&&(0===s&&(f(r.head),r.strstart=0,r.block_start=0,r.insert=0),d=new i.Buf8(r.w_size),i.arraySet(d,e,h-r.w_size,r.w_size,0),e=d,h=r.w_size),u=t.avail_in,c=t.next_in,l=t.input,t.avail_in=h,t.next_in=0,t.input=e,y(r);r.lookahead>=3;){n=r.strstart,o=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--o);r.strstart=n,r.lookahead=2,y(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,t.next_in=c,t.input=l,t.avail_in=u,r.wrap=s,0},e.deflateInfo="pako deflate (from Nodeca project)"},function(t,e,r){"use strict";var n=r(115);function i(t){for(var e=t.length;--e>=0;)t[e]=0}var o=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],a=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],u=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],c=new Array(576);i(c);var l=new Array(60);i(l);var f=new Array(512);i(f);var d=new Array(256);i(d);var h=new Array(29);i(h);var g,p,m,y=new Array(30);function b(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}function w(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function _(t){return t<256?f[t]:f[256+(t>>>7)]}function v(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function E(t,e,r){t.bi_valid>16-r?(t.bi_buf|=e<<t.bi_valid&65535,v(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=r-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)}function S(t,e,r){E(t,r[2*e],r[2*e+1])}function O(t,e){var r=0;do{r|=1&t,t>>>=1,r<<=1}while(--e>0);return r>>>1}function T(t,e,r){var n,i,o=new Array(16),a=0;for(n=1;n<=15;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=e;i++){var s=t[2*i+1];0!==s&&(t[2*i]=O(o[s]++,s))}}function A(t){var e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function M(t){t.bi_valid>8?v(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function j(t,e,r,n){var i=2*e,o=2*r;return t[i]<t[o]||t[i]===t[o]&&n[e]<=n[r]}function I(t,e,r){for(var n=t.heap[r],i=r<<1;i<=t.heap_len&&(i<t.heap_len&&j(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!j(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n}function R(t,e,r){var n,i,s,u,c=0;if(0!==t.last_lit)do{n=t.pending_buf[t.d_buf+2*c]<<8|t.pending_buf[t.d_buf+2*c+1],i=t.pending_buf[t.l_buf+c],c++,0===n?S(t,i,e):(S(t,(s=d[i])+256+1,e),0!==(u=o[s])&&E(t,i-=h[s],u),S(t,s=_(--n),r),0!==(u=a[s])&&E(t,n-=y[s],u))}while(c<t.last_lit);S(t,256,e)}function D(t,e){var r,n,i,o=e.dyn_tree,a=e.stat_desc.static_tree,s=e.stat_desc.has_stree,u=e.stat_desc.elems,c=-1;for(t.heap_len=0,t.heap_max=573,r=0;r<u;r++)0!==o[2*r]?(t.heap[++t.heap_len]=c=r,t.depth[r]=0):o[2*r+1]=0;for(;t.heap_len<2;)o[2*(i=t.heap[++t.heap_len]=c<2?++c:0)]=1,t.depth[i]=0,t.opt_len--,s&&(t.static_len-=a[2*i+1]);for(e.max_code=c,r=t.heap_len>>1;r>=1;r--)I(t,o,r);i=u;do{r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],I(t,o,1),n=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=n,o[2*i]=o[2*r]+o[2*n],t.depth[i]=(t.depth[r]>=t.depth[n]?t.depth[r]:t.depth[n])+1,o[2*r+1]=o[2*n+1]=i,t.heap[1]=i++,I(t,o,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var r,n,i,o,a,s,u=e.dyn_tree,c=e.max_code,l=e.stat_desc.static_tree,f=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,h=e.stat_desc.extra_base,g=e.stat_desc.max_length,p=0;for(o=0;o<=15;o++)t.bl_count[o]=0;for(u[2*t.heap[t.heap_max]+1]=0,r=t.heap_max+1;r<573;r++)(o=u[2*u[2*(n=t.heap[r])+1]+1]+1)>g&&(o=g,p++),u[2*n+1]=o,n>c||(t.bl_count[o]++,a=0,n>=h&&(a=d[n-h]),s=u[2*n],t.opt_len+=s*(o+a),f&&(t.static_len+=s*(l[2*n+1]+a)));if(0!==p){do{for(o=g-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[g]--,p-=2}while(p>0);for(o=g;0!==o;o--)for(n=t.bl_count[o];0!==n;)(i=t.heap[--r])>c||(u[2*i+1]!==o&&(t.opt_len+=(o-u[2*i+1])*u[2*i],u[2*i+1]=o),n--)}}(t,e),T(o,c,t.bl_count)}function k(t,e,r){var n,i,o=-1,a=e[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),e[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=e[2*(n+1)+1],++s<u&&i===a||(s<c?t.bl_tree[2*i]+=s:0!==i?(i!==o&&t.bl_tree[2*i]++,t.bl_tree[32]++):s<=10?t.bl_tree[34]++:t.bl_tree[36]++,s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4))}function N(t,e,r){var n,i,o=-1,a=e[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),n=0;n<=r;n++)if(i=a,a=e[2*(n+1)+1],!(++s<u&&i===a)){if(s<c)do{S(t,i,t.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(S(t,i,t.bl_tree),s--),S(t,16,t.bl_tree),E(t,s-3,2)):s<=10?(S(t,17,t.bl_tree),E(t,s-3,3)):(S(t,18,t.bl_tree),E(t,s-11,7));s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4)}}i(y);var C=!1;function x(t,e,r,i){E(t,0+(i?1:0),3),function(t,e,r,i){M(t),i&&(v(t,r),v(t,~r)),n.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}(t,e,r,!0)}e._tr_init=function(t){C||(!function(){var t,e,r,n,i,u=new Array(16);for(r=0,n=0;n<28;n++)for(h[n]=r,t=0;t<1<<o[n];t++)d[r++]=n;for(d[r-1]=n,i=0,n=0;n<16;n++)for(y[n]=i,t=0;t<1<<a[n];t++)f[i++]=n;for(i>>=7;n<30;n++)for(y[n]=i<<7,t=0;t<1<<a[n]-7;t++)f[256+i++]=n;for(e=0;e<=15;e++)u[e]=0;for(t=0;t<=143;)c[2*t+1]=8,t++,u[8]++;for(;t<=255;)c[2*t+1]=9,t++,u[9]++;for(;t<=279;)c[2*t+1]=7,t++,u[7]++;for(;t<=287;)c[2*t+1]=8,t++,u[8]++;for(T(c,287,u),t=0;t<30;t++)l[2*t+1]=5,l[2*t]=O(t,5);g=new b(c,o,257,286,15),p=new b(l,a,0,30,15),m=new b(new Array(0),s,0,19,7)}(),C=!0),t.l_desc=new w(t.dyn_ltree,g),t.d_desc=new w(t.dyn_dtree,p),t.bl_desc=new w(t.bl_tree,m),t.bi_buf=0,t.bi_valid=0,A(t)},e._tr_stored_block=x,e._tr_flush_block=function(t,e,r,n){var i,o,a=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),D(t,t.l_desc),D(t,t.d_desc),a=function(t){var e;for(k(t,t.dyn_ltree,t.l_desc.max_code),k(t,t.dyn_dtree,t.d_desc.max_code),D(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*u[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),i=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==e?x(t,e,r,n):4===t.strategy||o===i?(E(t,2+(n?1:0),3),R(t,c,l)):(E(t,4+(n?1:0),3),function(t,e,r,n){var i;for(E(t,e-257,5),E(t,r-1,5),E(t,n-4,4),i=0;i<n;i++)E(t,t.bl_tree[2*u[i]+1],3);N(t,t.dyn_ltree,e-1),N(t,t.dyn_dtree,r-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),R(t,t.dyn_ltree,t.dyn_dtree)),A(t),n&&M(t)},e._tr_tally=function(t,e,r){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(d[r]+256+1)]++,t.dyn_dtree[2*_(e)]++),t.last_lit===t.lit_bufsize-1},e._tr_align=function(t){E(t,2,3),S(t,256,c),function(t){16===t.bi_valid?(v(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},function(t,e,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(t,e,r){"use strict";var n=r(115),i=r(240),o=r(241),a=r(416),s=r(417);function u(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function c(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function l(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new n.Buf32(852),e.distcode=e.distdyn=new n.Buf32(592),e.sane=1,e.back=-1,0):-2}function f(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,l(t)):-2}function d(t,e){var r,n;return t&&t.state?(n=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?-2:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,f(t))):-2}function h(t,e){var r,n;return t?(n=new c,t.state=n,n.window=null,0!==(r=d(t,e))&&(t.state=null),r):-2}var g,p,m=!0;function y(t){if(m){var e;for(g=new n.Buf32(512),p=new n.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(s(1,t.lens,0,288,g,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;s(2,t.lens,0,32,p,0,t.work,{bits:5}),m=!1}t.lencode=g,t.lenbits=9,t.distcode=p,t.distbits=5}function b(t,e,r,i){var o,a=t.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new n.Buf8(a.wsize)),i>=a.wsize?(n.arraySet(a.window,e,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((o=a.wsize-a.wnext)>i&&(o=i),n.arraySet(a.window,e,r-i,o,a.wnext),(i-=o)?(n.arraySet(a.window,e,r-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=o,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=o))),0}e.inflateReset=f,e.inflateReset2=d,e.inflateResetKeep=l,e.inflateInit=function(t){return h(t,15)},e.inflateInit2=h,e.inflate=function(t,e){var r,c,l,f,d,h,g,p,m,w,_,v,E,S,O,T,A,M,j,I,R,D,k,N,C=0,x=new n.Buf8(4),L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return-2;12===(r=t.state).mode&&(r.mode=13),d=t.next_out,l=t.output,g=t.avail_out,f=t.next_in,c=t.input,h=t.avail_in,p=r.hold,m=r.bits,w=h,_=g,D=0;t:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;m<16;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(2&r.wrap&&35615===p){r.check=0,x[0]=255&p,x[1]=p>>>8&255,r.check=o(r.check,x,2,0),p=0,m=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&p)<<8)+(p>>8))%31){t.msg="incorrect header check",r.mode=30;break}if(8!=(15&p)){t.msg="unknown compression method",r.mode=30;break}if(m-=4,R=8+(15&(p>>>=4)),0===r.wbits)r.wbits=R;else if(R>r.wbits){t.msg="invalid window size",r.mode=30;break}r.dmax=1<<R,t.adler=r.check=1,r.mode=512&p?10:12,p=0,m=0;break;case 2:for(;m<16;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(r.flags=p,8!=(255&r.flags)){t.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=p>>8&1),512&r.flags&&(x[0]=255&p,x[1]=p>>>8&255,r.check=o(r.check,x,2,0)),p=0,m=0,r.mode=3;case 3:for(;m<32;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}r.head&&(r.head.time=p),512&r.flags&&(x[0]=255&p,x[1]=p>>>8&255,x[2]=p>>>16&255,x[3]=p>>>24&255,r.check=o(r.check,x,4,0)),p=0,m=0,r.mode=4;case 4:for(;m<16;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}r.head&&(r.head.xflags=255&p,r.head.os=p>>8),512&r.flags&&(x[0]=255&p,x[1]=p>>>8&255,r.check=o(r.check,x,2,0)),p=0,m=0,r.mode=5;case 5:if(1024&r.flags){for(;m<16;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}r.length=p,r.head&&(r.head.extra_len=p),512&r.flags&&(x[0]=255&p,x[1]=p>>>8&255,r.check=o(r.check,x,2,0)),p=0,m=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((v=r.length)>h&&(v=h),v&&(r.head&&(R=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),n.arraySet(r.head.extra,c,f,v,R)),512&r.flags&&(r.check=o(r.check,c,v,f)),h-=v,f+=v,r.length-=v),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===h)break t;v=0;do{R=c[f+v++],r.head&&R&&r.length<65536&&(r.head.name+=String.fromCharCode(R))}while(R&&v<h);if(512&r.flags&&(r.check=o(r.check,c,v,f)),h-=v,f+=v,R)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===h)break t;v=0;do{R=c[f+v++],r.head&&R&&r.length<65536&&(r.head.comment+=String.fromCharCode(R))}while(R&&v<h);if(512&r.flags&&(r.check=o(r.check,c,v,f)),h-=v,f+=v,R)break t}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;m<16;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(p!==(65535&r.check)){t.msg="header crc mismatch",r.mode=30;break}p=0,m=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=12;break;case 10:for(;m<32;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}t.adler=r.check=u(p),p=0,m=0,r.mode=11;case 11:if(0===r.havedict)return t.next_out=d,t.avail_out=g,t.next_in=f,t.avail_in=h,r.hold=p,r.bits=m,2;t.adler=r.check=1,r.mode=12;case 12:if(5===e||6===e)break t;case 13:if(r.last){p>>>=7&m,m-=7&m,r.mode=27;break}for(;m<3;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}switch(r.last=1&p,m-=1,3&(p>>>=1)){case 0:r.mode=14;break;case 1:if(y(r),r.mode=20,6===e){p>>>=2,m-=2;break t}break;case 2:r.mode=17;break;case 3:t.msg="invalid block type",r.mode=30}p>>>=2,m-=2;break;case 14:for(p>>>=7&m,m-=7&m;m<32;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if((65535&p)!=(p>>>16^65535)){t.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&p,p=0,m=0,r.mode=15,6===e)break t;case 15:r.mode=16;case 16:if(v=r.length){if(v>h&&(v=h),v>g&&(v=g),0===v)break t;n.arraySet(l,c,f,v,d),h-=v,f+=v,g-=v,d+=v,r.length-=v;break}r.mode=12;break;case 17:for(;m<14;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(r.nlen=257+(31&p),p>>>=5,m-=5,r.ndist=1+(31&p),p>>>=5,m-=5,r.ncode=4+(15&p),p>>>=4,m-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;m<3;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}r.lens[L[r.have++]]=7&p,p>>>=3,m-=3}for(;r.have<19;)r.lens[L[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,k={bits:r.lenbits},D=s(0,r.lens,0,19,r.lencode,0,r.work,k),r.lenbits=k.bits,D){t.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;T=(C=r.lencode[p&(1<<r.lenbits)-1])>>>16&255,A=65535&C,!((O=C>>>24)<=m);){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(A<16)p>>>=O,m-=O,r.lens[r.have++]=A;else{if(16===A){for(N=O+2;m<N;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(p>>>=O,m-=O,0===r.have){t.msg="invalid bit length repeat",r.mode=30;break}R=r.lens[r.have-1],v=3+(3&p),p>>>=2,m-=2}else if(17===A){for(N=O+3;m<N;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}m-=O,R=0,v=3+(7&(p>>>=O)),p>>>=3,m-=3}else{for(N=O+7;m<N;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}m-=O,R=0,v=11+(127&(p>>>=O)),p>>>=7,m-=7}if(r.have+v>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=30;break}for(;v--;)r.lens[r.have++]=R}}if(30===r.mode)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,k={bits:r.lenbits},D=s(1,r.lens,0,r.nlen,r.lencode,0,r.work,k),r.lenbits=k.bits,D){t.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,k={bits:r.distbits},D=s(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,k),r.distbits=k.bits,D){t.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===e)break t;case 20:r.mode=21;case 21:if(h>=6&&g>=258){t.next_out=d,t.avail_out=g,t.next_in=f,t.avail_in=h,r.hold=p,r.bits=m,a(t,_),d=t.next_out,l=t.output,g=t.avail_out,f=t.next_in,c=t.input,h=t.avail_in,p=r.hold,m=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;T=(C=r.lencode[p&(1<<r.lenbits)-1])>>>16&255,A=65535&C,!((O=C>>>24)<=m);){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(T&&0==(240&T)){for(M=O,j=T,I=A;T=(C=r.lencode[I+((p&(1<<M+j)-1)>>M)])>>>16&255,A=65535&C,!(M+(O=C>>>24)<=m);){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}p>>>=M,m-=M,r.back+=M}if(p>>>=O,m-=O,r.back+=O,r.length=A,0===T){r.mode=26;break}if(32&T){r.back=-1,r.mode=12;break}if(64&T){t.msg="invalid literal/length code",r.mode=30;break}r.extra=15&T,r.mode=22;case 22:if(r.extra){for(N=r.extra;m<N;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}r.length+=p&(1<<r.extra)-1,p>>>=r.extra,m-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;T=(C=r.distcode[p&(1<<r.distbits)-1])>>>16&255,A=65535&C,!((O=C>>>24)<=m);){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(0==(240&T)){for(M=O,j=T,I=A;T=(C=r.distcode[I+((p&(1<<M+j)-1)>>M)])>>>16&255,A=65535&C,!(M+(O=C>>>24)<=m);){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}p>>>=M,m-=M,r.back+=M}if(p>>>=O,m-=O,r.back+=O,64&T){t.msg="invalid distance code",r.mode=30;break}r.offset=A,r.extra=15&T,r.mode=24;case 24:if(r.extra){for(N=r.extra;m<N;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}r.offset+=p&(1<<r.extra)-1,p>>>=r.extra,m-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===g)break t;if(v=_-g,r.offset>v){if((v=r.offset-v)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=30;break}v>r.wnext?(v-=r.wnext,E=r.wsize-v):E=r.wnext-v,v>r.length&&(v=r.length),S=r.window}else S=l,E=d-r.offset,v=r.length;v>g&&(v=g),g-=v,r.length-=v;do{l[d++]=S[E++]}while(--v);0===r.length&&(r.mode=21);break;case 26:if(0===g)break t;l[d++]=r.length,g--,r.mode=21;break;case 27:if(r.wrap){for(;m<32;){if(0===h)break t;h--,p|=c[f++]<<m,m+=8}if(_-=g,t.total_out+=_,r.total+=_,_&&(t.adler=r.check=r.flags?o(r.check,l,_,d-_):i(r.check,l,_,d-_)),_=g,(r.flags?p:u(p))!==r.check){t.msg="incorrect data check",r.mode=30;break}p=0,m=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;m<32;){if(0===h)break t;h--,p+=c[f++]<<m,m+=8}if(p!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=30;break}p=0,m=0}r.mode=29;case 29:D=1;break t;case 30:D=-3;break t;case 31:return-4;case 32:default:return-2}return t.next_out=d,t.avail_out=g,t.next_in=f,t.avail_in=h,r.hold=p,r.bits=m,(r.wsize||_!==t.avail_out&&r.mode<30&&(r.mode<27||4!==e))&&b(t,t.output,t.next_out,_-t.avail_out)?(r.mode=31,-4):(w-=t.avail_in,_-=t.avail_out,t.total_in+=w,t.total_out+=_,r.total+=_,r.wrap&&_&&(t.adler=r.check=r.flags?o(r.check,l,_,t.next_out-_):i(r.check,l,_,t.next_out-_)),t.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0===w&&0===_||4===e)&&0===D&&(D=-5),D)},e.inflateEnd=function(t){if(!t||!t.state)return-2;var e=t.state;return e.window&&(e.window=null),t.state=null,0},e.inflateGetHeader=function(t,e){var r;return t&&t.state?0==(2&(r=t.state).wrap)?-2:(r.head=e,e.done=!1,0):-2},e.inflateSetDictionary=function(t,e){var r,n=e.length;return t&&t.state?0!==(r=t.state).wrap&&11!==r.mode?-2:11===r.mode&&i(1,e,n,0)!==r.check?-3:b(t,e,n,n)?(r.mode=31,-4):(r.havedict=1,0):-2},e.inflateInfo="pako inflate (from Nodeca project)"},function(t,e,r){"use strict";t.exports=function(t,e){var r,n,i,o,a,s,u,c,l,f,d,h,g,p,m,y,b,w,_,v,E,S,O,T,A;r=t.state,n=t.next_in,T=t.input,i=n+(t.avail_in-5),o=t.next_out,A=t.output,a=o-(e-t.avail_out),s=o+(t.avail_out-257),u=r.dmax,c=r.wsize,l=r.whave,f=r.wnext,d=r.window,h=r.hold,g=r.bits,p=r.lencode,m=r.distcode,y=(1<<r.lenbits)-1,b=(1<<r.distbits)-1;t:do{g<15&&(h+=T[n++]<<g,g+=8,h+=T[n++]<<g,g+=8),w=p[h&y];e:for(;;){if(h>>>=_=w>>>24,g-=_,0===(_=w>>>16&255))A[o++]=65535&w;else{if(!(16&_)){if(0==(64&_)){w=p[(65535&w)+(h&(1<<_)-1)];continue e}if(32&_){r.mode=12;break t}t.msg="invalid literal/length code",r.mode=30;break t}v=65535&w,(_&=15)&&(g<_&&(h+=T[n++]<<g,g+=8),v+=h&(1<<_)-1,h>>>=_,g-=_),g<15&&(h+=T[n++]<<g,g+=8,h+=T[n++]<<g,g+=8),w=m[h&b];r:for(;;){if(h>>>=_=w>>>24,g-=_,!(16&(_=w>>>16&255))){if(0==(64&_)){w=m[(65535&w)+(h&(1<<_)-1)];continue r}t.msg="invalid distance code",r.mode=30;break t}if(E=65535&w,g<(_&=15)&&(h+=T[n++]<<g,(g+=8)<_&&(h+=T[n++]<<g,g+=8)),(E+=h&(1<<_)-1)>u){t.msg="invalid distance too far back",r.mode=30;break t}if(h>>>=_,g-=_,E>(_=o-a)){if((_=E-_)>l&&r.sane){t.msg="invalid distance too far back",r.mode=30;break t}if(S=0,O=d,0===f){if(S+=c-_,_<v){v-=_;do{A[o++]=d[S++]}while(--_);S=o-E,O=A}}else if(f<_){if(S+=c+f-_,(_-=f)<v){v-=_;do{A[o++]=d[S++]}while(--_);if(S=0,f<v){v-=_=f;do{A[o++]=d[S++]}while(--_);S=o-E,O=A}}}else if(S+=f-_,_<v){v-=_;do{A[o++]=d[S++]}while(--_);S=o-E,O=A}for(;v>2;)A[o++]=O[S++],A[o++]=O[S++],A[o++]=O[S++],v-=3;v&&(A[o++]=O[S++],v>1&&(A[o++]=O[S++]))}else{S=o-E;do{A[o++]=A[S++],A[o++]=A[S++],A[o++]=A[S++],v-=3}while(v>2);v&&(A[o++]=A[S++],v>1&&(A[o++]=A[S++]))}break}}break}}while(n<i&&o<s);n-=v=g>>3,h&=(1<<(g-=v<<3))-1,t.next_in=n,t.next_out=o,t.avail_in=n<i?i-n+5:5-(n-i),t.avail_out=o<s?s-o+257:257-(o-s),r.hold=h,r.bits=g}},function(t,e,r){"use strict";var n=r(115),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],s=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(t,e,r,u,c,l,f,d){var h,g,p,m,y,b,w,_,v,E=d.bits,S=0,O=0,T=0,A=0,M=0,j=0,I=0,R=0,D=0,k=0,N=null,C=0,x=new n.Buf16(16),L=new n.Buf16(16),P=null,B=0;for(S=0;S<=15;S++)x[S]=0;for(O=0;O<u;O++)x[e[r+O]]++;for(M=E,A=15;A>=1&&0===x[A];A--);if(M>A&&(M=A),0===A)return c[l++]=20971520,c[l++]=20971520,d.bits=1,0;for(T=1;T<A&&0===x[T];T++);for(M<T&&(M=T),R=1,S=1;S<=15;S++)if(R<<=1,(R-=x[S])<0)return-1;if(R>0&&(0===t||1!==A))return-1;for(L[1]=0,S=1;S<15;S++)L[S+1]=L[S]+x[S];for(O=0;O<u;O++)0!==e[r+O]&&(f[L[e[r+O]]++]=O);if(0===t?(N=P=f,b=19):1===t?(N=i,C-=257,P=o,B-=257,b=256):(N=a,P=s,b=-1),k=0,O=0,S=T,y=l,j=M,I=0,p=-1,m=(D=1<<M)-1,1===t&&D>852||2===t&&D>592)return 1;for(;;){w=S-I,f[O]<b?(_=0,v=f[O]):f[O]>b?(_=P[B+f[O]],v=N[C+f[O]]):(_=96,v=0),h=1<<S-I,T=g=1<<j;do{c[y+(k>>I)+(g-=h)]=w<<24|_<<16|v|0}while(0!==g);for(h=1<<S-1;k&h;)h>>=1;if(0!==h?(k&=h-1,k+=h):k=0,O++,0==--x[S]){if(S===A)break;S=e[r+f[O]]}if(S>M&&(k&m)!==p){for(0===I&&(I=M),y+=T,R=1<<(j=S-I);j+I<A&&!((R-=x[j+I])<=0);)j++,R<<=1;if(D+=1<<j,1===t&&D>852||2===t&&D>592)return 1;c[p=k&m]=M<<24|j<<16|y-l|0}}return 0!==k&&(c[y+k]=S-I<<24|64<<16|0),d.bits=M,0}},function(t,e,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(t,e,r){(function(e){t.exports=function(t){var n=r(239);return{inflate:function(){return n.inflateRawSync(t)},inflateAsync:function(r){var i=n.createInflateRaw(),o=[],a=0;i.on("data",(function(t){o.push(t),a+=t.length})),i.on("end",(function(){var t=e.alloc(a),n=0;t.fill(0);for(var i=0;i<o.length;i++){var s=o[i];s.copy(t,n),n+=s.length}r&&r(t)})),i.end(t)}}}}).call(this,r(14).Buffer)},function(t,e,r){"use strict";(function(e){const n=r(184).randomFillSync,i=new Uint32Array(256).map((t,e)=>{for(let t=0;t<8;t++)0!=(1&e)?e=e>>>1^3988292384:e>>>=1;return e>>>0}),o=(t,e)=>Math.imul(t,e)>>>0,a=(t,e)=>i[255&(t^e)]^t>>>8,s=()=>"function"==typeof n?n(e.alloc(12)):s.node();s.node=()=>{const t=e.alloc(12),r=t.length;for(let e=0;e<r;e++)t[e]=256*Math.random()&255;return t};const u={genSalt:s};function c(t){const r=e.isBuffer(t)?t:e.from(t);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let t=0;t<r.length;t++)this.updateKeys(r[t])}c.prototype.updateKeys=function(t){const e=this.keys;return e[0]=a(e[0],t),e[1]+=255&e[0],e[1]=o(e[1],134775813)+1,e[2]=a(e[2],e[1]>>>24),t},c.prototype.next=function(){const t=(2|this.keys[2])>>>0;return o(t,1^t)>>8&255},t.exports={decrypt:function(t,r,n){if(!t||!e.isBuffer(t)||t.length<12)return e.alloc(0);const i=function(t){const r=new c(t);return function(t){const n=e.alloc(t.length);let i=0;for(let e of t)n[i++]=r.updateKeys(e^r.next());return n}}(n);if(i(t.slice(0,12))[11]!==r.crc>>>24)throw"ADM-ZIP: Wrong Password";return i(t.slice(12))},encrypt:function(t,r,n,i=!1){null==t&&(t=e.alloc(0)),e.isBuffer(t)||(t=e.from(t.toString()));const o=function(t){const r=new c(t);return function(t,n,i=0){n||(n=e.alloc(t.length));for(let e of t){const t=r.next();n[i++]=e^t,r.updateKeys(e)}return n}}(n),a=u.genSalt();a[11]=r.crc>>>24&255,i&&(a[10]=r.crc>>>16&255);const s=e.alloc(t.length+12);return o(a,s),o(t,s,12)},_salter:function(t){e.isBuffer(t)&&t.length>=12?u.genSalt=function(){return t.slice(0,12)}:u.genSalt="node"===t?s.node:s}}}).call(this,r(14).Buffer)},function(t,e,r){(function(e){const n=r(237),i=r(238),o=r(103);t.exports=function(t,r){var a=[],s={},u=e.alloc(0),c=new i.MainHeader,l=!1;const f=Object.assign(Object.create(null),r),d=f.noSort;function h(){l=!0,s={},a=new Array(c.diskEntries);for(var e=c.offset,r=0;r<a.length;r++){var i=e,u=new n(t);u.header=t.slice(i,i+=o.Constants.CENHDR),u.entryName=t.slice(i,i+=u.header.fileNameLength),u.header.extraLength&&(u.extra=t.slice(i,i+=u.header.extraLength)),u.header.commentLength&&(u.comment=t.slice(i,i+u.header.commentLength)),e+=u.header.entryHeaderSize,a[r]=u,s[u.entryName]=u}}function g(){a.length>1&&!d&&a.sort((t,e)=>t.entryName.toLowerCase().localeCompare(e.entryName.toLowerCase()))}return t?function(e){var r=t.length-o.Constants.ENDHDR,n=Math.max(0,r-65535),i=n,a=t.length,s=-1,l=0;for(;r>=i;r--)if(80===t[r])if(t.readUInt32LE(r)!==o.Constants.ENDSIG)if(t.readUInt32LE(r)!==o.Constants.END64SIG){if(t.readUInt32LE(r)===o.Constants.ZIP64SIG){s=r,a=r+o.readBigUInt64LE(t,r+o.Constants.ZIP64SIZE)+o.Constants.ZIP64LEAD;break}}else i=n;else s=r,l=r,a=r+o.Constants.ENDHDR,i=r-o.Constants.END64HDR;if(!~s)throw new Error(o.Errors.INVALID_FORMAT);c.loadFromBinary(t.slice(s,a)),c.commentLength&&(u=t.slice(l+o.Constants.ENDHDR));e&&h()}(f.readEntries):l=!0,{get entries(){return l||h(),a},get comment(){return u.toString()},set comment(t){u=o.toBuffer(t),c.commentLength=u.length},getEntryCount:function(){return l?a.length:c.diskEntries},forEach:function(e){l?a.forEach(e):function(e){const r=c.diskEntries;let i=c.offset;for(let a=0;a<r;a++){let r=i;const a=new n(t);a.header=t.slice(r,r+=o.Constants.CENHDR),a.entryName=t.slice(r,r+=a.header.fileNameLength),i+=a.header.entryHeaderSize,e(a)}}(e)},getEntry:function(t){return l||h(),s[t]||null},setEntry:function(t){l||h(),a.push(t),s[t.entryName]=t,c.totalEntries=a.length},deleteEntry:function(t){l||h();var e=s[t];if(e&&e.isDirectory){var r=this;this.getEntryChildren(e).forEach((function(e){e.entryName!==t&&r.deleteEntry(e.entryName)}))}a.splice(a.indexOf(e),1),delete s[t],c.totalEntries=a.length},getEntryChildren:function(t){if(l||h(),t&&t.isDirectory){const e=[],r=t.entryName,n=r.length;return a.forEach((function(t){t.entryName.substr(0,n)===r&&e.push(t)})),e}return[]},compressToBuffer:function(){l||h(),g();const t=[],r=[];let n=0,i=0;c.size=0,c.offset=0;for(const o of a){const a=o.getCompressedData();o.header.offset=i;const s=o.header.dataHeaderToBinary(),u=o.rawEntryName.length,l=e.alloc(u+o.extra.length);o.rawEntryName.copy(l,0),l.copy(o.extra,u);const f=s.length+l.length+a.length;i+=f,t.push(s),t.push(l),t.push(a);const d=o.packHeader();r.push(d),c.size+=d.length,n+=f+d.length}n+=c.mainHeaderSize,c.offset=i,i=0;const s=e.alloc(n);for(const e of t)e.copy(s,i),i+=e.length;for(const t of r)t.copy(s,i),i+=t.length;const f=c.toBinary();return u&&u.copy(f,o.Constants.ENDHDR),f.copy(s,i),s},toAsyncBuffer:function(t,r,n,i){try{l||h(),g();const r=[],s=[];let f=0,d=0;c.size=0,c.offset=0;const p=function(a){if(a.length){const t=a.pop(),o=t.entryName+t.extra.toString();n&&n(o),t.getCompressedDataAsync((function(n){i&&i(o),t.header.offset=d;const u=t.header.dataHeaderToBinary(),l=e.alloc(o.length,o),h=u.length+l.length+n.length;d+=h,r.push(u),r.push(l),r.push(n);const g=t.packHeader();s.push(g),c.size+=g.length,f+=h+g.length,p(a)}))}else{f+=c.mainHeaderSize,c.offset=d,d=0;const n=e.alloc(f);r.forEach((function(t){t.copy(n,d),d+=t.length})),s.forEach((function(t){t.copy(n,d),d+=t.length}));const i=c.toBinary();u&&u.copy(i,o.Constants.ENDHDR),i.copy(n,d),t(n)}};p(a)}catch(t){r(t)}}}}}).call(this,r(14).Buffer)},function(t,e){t.exports=new Set(["for","and","nor","but","or","yet","so","a","an","the","aboard","about","above","across","after","against","along","amid","among","anti","around","as","at","before","behind","below","beneath","beside","besides","between","beyond","but","by","concerning","considering","despite","down","during","except","excepting","excluding","following","for","from","in","inside","into","like","minus","near","of","off","on","onto","opposite","over","past","per","plus","regarding","round","save","since","than","through","to","toward","towards","under","underneath","unlike","until","up","upon","versus","via","with","within","without"])},function(t,e){t.exports=["CLI","API","HTTP","HTTPS","JSX","DNS","URL","CI","CDN","GitHub","CSS","JS","JavaScript","TypeScript","HTML","WordPress","JavaScript","Next.js","Node.js"]},function(t,e){t.exports=function(t,e,r){var n,i,o,a,s,u,c=t.length,l=e.length,f=[];r=(r||(l>c?l:c))+1;for(var d=0;d<r;d++)f[d]=[d],f[d].length=r;for(d=0;d<r;d++)f[0][d]=d;if(Math.abs(c-l)>(r||100))return h(r||100);if(0===c)return h(l);if(0===l)return h(c);for(d=1;d<=c;++d)for(i=t[d-1],n=1;n<=l;++n){if(d===n&&f[d][n]>4)return h(c);a=i===(o=e[n-1])?0:1,s=f[d-1][n]+1,(u=f[d][n-1]+1)<s&&(s=u),(u=f[d-1][n-1]+a)<s&&(s=u),f[d][n]=d>1&&n>1&&i===e[n-2]&&t[d-2]===o&&(u=f[d-2][n-2]+a)<s?u:s}return h(f[c][l]);function h(t){var e=Math.max(c,l),r=0===e?0:t/e;return{steps:t,relative:r,similarity:1-r}}}},function(t,e,r){(function(e,n){function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function u(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?s(Object(r),!0).forEach((function(e){c(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function c(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const l=r(97).Transform,f=e.from([239,187,191]);class d extends l{constructor(t={}){super(u(u({},{writableObjectMode:!0}),t));const e={};let r;for(let r in t)e[m(r)]=t[r];if(r=this.normalize(e))throw r;switch(e.record_delimiter){case"auto":e.record_delimiter=null;break;case"unix":e.record_delimiter="\n";break;case"mac":e.record_delimiter="\r";break;case"windows":e.record_delimiter="\r\n";break;case"ascii":e.record_delimiter="";break;case"unicode":e.record_delimiter="\u2028"}this.options=e,this.state={stop:!1},this.info={records:0}}normalize(t){if(void 0===t.bom||null===t.bom||!1===t.bom)t.bom=!1;else if(!0!==t.bom)return new g("CSV_OPTION_BOOLEAN_INVALID_TYPE",["option `bom` is optional and must be a boolean value,","got "+JSON.stringify(t.bom)]);if(void 0===t.delimiter||null===t.delimiter)t.delimiter=",";else if(e.isBuffer(t.delimiter))t.delimiter=t.delimiter.toString();else if("string"!=typeof t.delimiter)return new g("CSV_OPTION_DELIMITER_INVALID_TYPE",["option `delimiter` must be a buffer or a string,","got "+JSON.stringify(t.delimiter)]);if(void 0===t.quote||null===t.quote)t.quote='"';else if(!0===t.quote)t.quote='"';else if(!1===t.quote)t.quote="";else if(e.isBuffer(t.quote))t.quote=t.quote.toString();else if("string"!=typeof t.quote)return new g("CSV_OPTION_QUOTE_INVALID_TYPE",["option `quote` must be a boolean, a buffer or a string,","got "+JSON.stringify(t.quote)]);if(void 0!==t.quoted&&null!==t.quoted||(t.quoted=!1),void 0!==t.quoted_empty&&null!==t.quoted_empty||(t.quoted_empty=void 0),void 0===t.quoted_match||null===t.quoted_match||!1===t.quoted_match?t.quoted_match=null:Array.isArray(t.quoted_match)||(t.quoted_match=[t.quoted_match]),t.quoted_match)for(let e of t.quoted_match){const t=e instanceof RegExp;if(!("string"==typeof e)&&!t)return Error("Invalid Option: quoted_match must be a string or a regex, got "+JSON.stringify(e))}if(void 0!==t.quoted_string&&null!==t.quoted_string||(t.quoted_string=!1),void 0!==t.eof&&null!==t.eof||(t.eof=!0),void 0===t.escape||null===t.escape)t.escape='"';else if(e.isBuffer(t.escape))t.escape=t.escape.toString();else if("string"!=typeof t.escape)return Error("Invalid Option: escape must be a buffer or a string, got "+JSON.stringify(t.escape));if(t.escape.length>1)return Error(`Invalid Option: escape must be one character, got ${t.escape.length} characters`);if(void 0!==t.header&&null!==t.header||(t.header=!1),t.columns=this.normalize_columns(t.columns),void 0!==t.quoted&&null!==t.quoted||(t.quoted=!1),void 0!==t.cast&&null!==t.cast||(t.cast={}),void 0!==t.cast.bigint&&null!==t.cast.bigint||(t.cast.bigint=t=>""+t),void 0!==t.cast.boolean&&null!==t.cast.boolean||(t.cast.boolean=t=>t?"1":""),void 0!==t.cast.date&&null!==t.cast.date||(t.cast.date=t=>""+t.getTime()),void 0!==t.cast.number&&null!==t.cast.number||(t.cast.number=t=>""+t),void 0!==t.cast.object&&null!==t.cast.object||(t.cast.object=t=>JSON.stringify(t)),void 0!==t.cast.string&&null!==t.cast.string||(t.cast.string=function(t){return t}),void 0===t.record_delimiter||null===t.record_delimiter)t.record_delimiter="\n";else if(e.isBuffer(t.record_delimiter))t.record_delimiter=t.record_delimiter.toString();else if("string"!=typeof t.record_delimiter)return Error("Invalid Option: record_delimiter must be a buffer or a string, got "+JSON.stringify(t.record_delimiter))}_transform(t,e,r){if(!0===this.state.stop)return;if(!Array.isArray(t)&&"object"!=typeof t)return this.state.stop=!0,r(Error("Invalid Record: expect an array or an object, got "+JSON.stringify(t)));if(0===this.info.records)if(Array.isArray(t)){if(!0===this.options.header&&!this.options.columns)return this.state.stop=!0,r(Error("Undiscoverable Columns: header option requires column option or object records"))}else void 0!==this.options.columns&&null!==this.options.columns||(this.options.columns=this.normalize_columns(Object.keys(t)));0===this.info.records&&(this.bom(),this.headers());try{this.emit("record",t,this.info.records)}catch(t){return this.state.stop=!0,this.emit("error",t)}let n;if(this.options.eof){if(n=this.stringify(t),void 0===n)return;n+=this.options.record_delimiter}else{if(n=this.stringify(t),void 0===n)return;(this.options.header||this.info.records)&&(n=this.options.record_delimiter+n)}this.info.records++,this.push(n),r()}_flush(t){0===this.info.records&&(this.bom(),this.headers()),t()}stringify(t,e=!1){if("object"!=typeof t)return t;const r=this.options,n=r.columns,a=(r.header,[]);if(Array.isArray(t)){n&&t.splice(n.length);for(let r=0;r<t.length;r++){const n=t[r],i=o(this.__cast(n,{index:r,column:r,records:this.info.records,header:e}),2),s=i[0],u=i[1];if(s)return void this.emit("error",s);a[r]=[u,n]}}else if(n)for(let r=0;r<n.length;r++){const i=T(t,n[r].key),s=o(this.__cast(i,{index:r,column:n[r].key,records:this.info.records,header:e}),2),u=s[0],c=s[1];if(u)return void this.emit("error",u);a[r]=[c,i]}else for(let r of t){const s=t[r],u=o(this.__cast(s,{index:i,column:n[i].key,records:this.info.records,header:e}),2),c=u[0],l=u[1];if(c)return void this.emit("error",c);a.push([l,s])}let s="";for(let t=0;t<a.length;t++){let e,r,n=o(a[t],2),i=n[0],c=n[1];if("string"==typeof i)e=this.options;else if(p(i)){if(e=i,i=e.value,delete e.value,"string"!=typeof i&&null!=i)return void this.emit("error",Error("Invalid Casting Value: returned value must return a string, null or undefined, got "+JSON.stringify(i)));if(e=u(u({},this.options),e),r=this.normalize(e))return void this.emit("error",r)}else{if(null!=i)return void this.emit("error",Error("Invalid Casting Value: returned value must return a string, an object, null or undefined, got "+JSON.stringify(i)));e=this.options}const l=e,f=l.delimiter,d=l.escape,h=l.quote,g=l.quoted,m=l.quoted_empty,y=l.quoted_string,b=l.quoted_match,w=l.record_delimiter;if(i){if("string"!=typeof i)return this.emit("error",Error("Formatter must return a string, null or undefined, got "+JSON.stringify(i))),null;const t=f.length&&i.indexOf(f)>=0,e=""!==h&&i.indexOf(h)>=0,r=i.indexOf(d)>=0&&d!==h,n=i.indexOf(w)>=0,o=y&&"string"==typeof c;let a=b&&b.filter(t=>"string"==typeof t?-1!==i.indexOf(t):t.test(i));a=a&&a.length>0;const u=!0===e||t||n||g||o||a;if(!0===u&&!0===r){const t="\\"===d?new RegExp(d+d,"g"):new RegExp(d,"g");i=i.replace(t,d+d)}if(!0===e){const t=new RegExp(h,"g");i=i.replace(t,d+h)}!0===u&&(i=h+i+h),s+=i}else(!0===m||""===c&&!0===y&&!1!==m)&&(s+=h+h);t!==a.length-1&&(s+=f)}return s}bom(){!0===this.options.bom&&this.push(f)}headers(){if(!1===this.options.header)return;if(void 0===this.options.columns)return;let t=this.options.columns.map(t=>t.header);t=this.options.eof?this.stringify(t,!0)+this.options.record_delimiter:this.stringify(t),this.push(t)}__cast(t,e){const r=typeof t;try{return"string"===r?[void 0,this.options.cast.string(t,e)]:"bigint"===r?[void 0,this.options.cast.bigint(t,e)]:"number"===r?[void 0,this.options.cast.number(t,e)]:"boolean"===r?[void 0,this.options.cast.boolean(t,e)]:t instanceof Date?[void 0,this.options.cast.date(t,e)]:"object"===r&&null!==t?[void 0,this.options.cast.object(t,e)]:[void 0,t,t]}catch(t){return[t]}}normalize_columns(t){if(null!=t){if("object"!=typeof t)throw Error('Invalid option "columns": expect an array or an object');if(Array.isArray(t)){const e=[];for(let r of t)if("string"==typeof r)e.push({key:r,header:r});else{if("object"!=typeof r||void 0===r||Array.isArray(r))throw Error("Invalid column definition: expect a string or an object");if(!r.key)throw Error('Invalid column definition: property "key" is required');void 0===r.header&&(r.header=r.key),e.push(r)}t=e}else{const e=[];for(let r in t)e.push({key:r,header:t[r]});t=e}return t}}}const h=function(){let t,e,r;for(let n in arguments){const i=arguments[n],o=typeof i;if(void 0===t&&Array.isArray(i))t=i;else if(void 0===e&&p(i))e=i;else{if(void 0!==r||"function"!==o)throw new g("CSV_INVALID_ARGUMENT",["Invalid argument:",`got ${JSON.stringify(i)} at index ${n}`]);r=i}}const i=new d(e);if(r){const t=[];i.on("readable",(function(){let e;for(;null!==(e=this.read());)t.push(e)})),i.on("error",(function(t){r(t)})),i.on("end",(function(){r(void 0,t.join(""))}))}if(void 0!==t)if("function"==typeof n)n((function(){for(let e of t)i.write(e);i.end()}));else{for(let e of t)i.write(e);i.end()}return i};class g extends Error{constructor(t,r,...n){Array.isArray(r)&&(r=r.join(" ")),super(r),void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,g),this.code=t;for(const t of n)for(const r in t){const n=t[r];this[r]=e.isBuffer(n)?n.toString():null==n?n:JSON.parse(JSON.stringify(n))}}}h.Stringifier=d,h.CsvError=g,t.exports=h;const p=function(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)},m=function(t){return t.replace(/([A-Z])/g,(function(t,e){return"_"+e.toLowerCase()}))},y=".".charCodeAt(0),b=/\\(\\)?/g,w=RegExp("[^.[\\]]+|\\[(?:([^\"'][^[]*)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))","g"),_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,v=/^\w*$/,E=function(t){const e=typeof t;return"symbol"===e||"object"===e&&t&&"[object Symbol]"===function(t){return Object.prototype.toString.call(t)}(t)},S=function(t,e){return Array.isArray(t)?t:function(t,e){if(Array.isArray(t))return!1;const r=typeof t;return!("number"!==r&&"symbol"!==r&&"boolean"!==r&&t&&!E(t))||(v.test(t)||!_.test(t)||null!=e&&t in Object(e))}(t,e)?[t]:function(t){const e=[];return t.charCodeAt(0)===y&&e.push(""),t.replace(w,(function(t,r,n,i){let o=t;n?o=i.replace(b,"$1"):r&&(o=r.trim()),e.push(o)})),e}(t)},O=function(t){if("string"==typeof t||E(t))return t;const e=""+t;return"0"==e&&1/t==-INFINITY?"-0":e},T=function(t,e){let r=0;const n=(e=S(e,t)).length;for(;null!=t&&r<n;)t=t[O(e[r++])];return r&&r===n?t:void 0}}).call(this,r(14).Buffer,r(109).setImmediate)},function(t,e,r){(function(e,n){function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function s(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(Object(r),!0).forEach((function(e){u(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function u(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const c=r(97).Transform,l=r(427),f={utf8:e.from([239,187,191]),utf16le:e.from([255,254])};class d extends c{constructor(t={}){super(s(s(s({},{readableObjectMode:!0}),t),{},{encoding:null})),this.__originalOptions=t,this.__normalizeOptions(t)}__normalizeOptions(t){const r={};for(let e in t)r[p(e)]=t[e];if(void 0===r.encoding||!0===r.encoding)r.encoding="utf8";else if(null===r.encoding||!1===r.encoding)r.encoding=null;else if("string"!=typeof r.encoding&&null!==r.encoding)throw new g("CSV_INVALID_OPTION_ENCODING",["Invalid option encoding:","encoding must be a string or null to return a buffer,","got "+JSON.stringify(r.encoding)],r);if(void 0===r.bom||null===r.bom||!1===r.bom)r.bom=!1;else if(!0!==r.bom)throw new g("CSV_INVALID_OPTION_BOM",["Invalid option bom:","bom must be true,","got "+JSON.stringify(r.bom)],r);let n=null;if(void 0===r.cast||null===r.cast||!1===r.cast||""===r.cast)r.cast=void 0;else if("function"==typeof r.cast)n=r.cast,r.cast=!0;else if(!0!==r.cast)throw new g("CSV_INVALID_OPTION_CAST",["Invalid option cast:","cast must be true or a function,","got "+JSON.stringify(r.cast)],r);if(void 0===r.cast_date||null===r.cast_date||!1===r.cast_date||""===r.cast_date)r.cast_date=!1;else{if(!0!==r.cast_date)throw new g("CSV_INVALID_OPTION_CAST_DATE",["Invalid option cast_date:","cast_date must be true or a function,","got "+JSON.stringify(r.cast_date)],r);r.cast_date=function(t){const e=Date.parse(t);return isNaN(e)?t:new Date(e)}}let i=null;if(!0===r.columns)i=void 0;else if("function"==typeof r.columns)i=r.columns,r.columns=!0;else if(Array.isArray(r.columns))r.columns=b(r.columns);else{if(void 0!==r.columns&&null!==r.columns&&!1!==r.columns)throw new g("CSV_INVALID_OPTION_COLUMNS",["Invalid option columns:","expect an array, a function or true,","got "+JSON.stringify(r.columns)],r);r.columns=!1}if(void 0===r.columns_duplicates_to_array||null===r.columns_duplicates_to_array||!1===r.columns_duplicates_to_array)r.columns_duplicates_to_array=!1;else{if(!0!==r.columns_duplicates_to_array)throw new g("CSV_INVALID_OPTION_COLUMNS_DUPLICATES_TO_ARRAY",["Invalid option columns_duplicates_to_array:","expect an boolean,","got "+JSON.stringify(r.columns_duplicates_to_array)],r);if(!1===r.columns)throw new g("CSV_INVALID_OPTION_COLUMNS_DUPLICATES_TO_ARRAY",["Invalid option columns_duplicates_to_array:","the `columns` mode must be activated."],r)}if(void 0===r.comment||null===r.comment||!1===r.comment||""===r.comment)r.comment=null;else if("string"==typeof r.comment&&(r.comment=e.from(r.comment,r.encoding)),!e.isBuffer(r.comment))throw new g("CSV_INVALID_OPTION_COMMENT",["Invalid option comment:","comment must be a buffer or a string,","got "+JSON.stringify(r.comment)],r);const o=JSON.stringify(r.delimiter);if(Array.isArray(r.delimiter)||(r.delimiter=[r.delimiter]),0===r.delimiter.length)throw new g("CSV_INVALID_OPTION_DELIMITER",["Invalid option delimiter:","delimiter must be a non empty string or buffer or array of string|buffer,","got "+o],r);if(r.delimiter=r.delimiter.map((function(t){if(null==t||!1===t)return e.from(",",r.encoding);if("string"==typeof t&&(t=e.from(t,r.encoding)),!e.isBuffer(t)||0===t.length)throw new g("CSV_INVALID_OPTION_DELIMITER",["Invalid option delimiter:","delimiter must be a non empty string or buffer or array of string|buffer,","got "+o],r);return t})),void 0===r.escape||!0===r.escape?r.escape=e.from('"',r.encoding):"string"==typeof r.escape?r.escape=e.from(r.escape,r.encoding):null!==r.escape&&!1!==r.escape||(r.escape=null),null!==r.escape&&!e.isBuffer(r.escape))throw new Error("Invalid Option: escape must be a buffer, a string or a boolean, got "+JSON.stringify(r.escape));if(void 0===r.from||null===r.from)r.from=1;else{if("string"==typeof r.from&&/\d+/.test(r.from)&&(r.from=parseInt(r.from)),!Number.isInteger(r.from))throw new Error("Invalid Option: from must be an integer, got "+JSON.stringify(r.from));if(r.from<0)throw new Error("Invalid Option: from must be a positive integer, got "+JSON.stringify(t.from))}if(void 0===r.from_line||null===r.from_line)r.from_line=1;else{if("string"==typeof r.from_line&&/\d+/.test(r.from_line)&&(r.from_line=parseInt(r.from_line)),!Number.isInteger(r.from_line))throw new Error("Invalid Option: from_line must be an integer, got "+JSON.stringify(t.from_line));if(r.from_line<=0)throw new Error("Invalid Option: from_line must be a positive integer greater than 0, got "+JSON.stringify(t.from_line))}if(void 0===r.ignore_last_delimiters||null===r.ignore_last_delimiters)r.ignore_last_delimiters=!1;else if("number"==typeof r.ignore_last_delimiters)r.ignore_last_delimiters=Math.floor(r.ignore_last_delimiters),0===r.ignore_last_delimiters&&(r.ignore_last_delimiters=!1);else if("boolean"!=typeof r.ignore_last_delimiters)throw new g("CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS",["Invalid option `ignore_last_delimiters`:","the value must be a boolean value or an integer,","got "+JSON.stringify(r.ignore_last_delimiters)],r);if(!0===r.ignore_last_delimiters&&!1===r.columns)throw new g("CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS",["The option `ignore_last_delimiters`","requires the activation of the `columns` option"],r);if(void 0===r.info||null===r.info||!1===r.info)r.info=!1;else if(!0!==r.info)throw new Error("Invalid Option: info must be true, got "+JSON.stringify(r.info));if(void 0===r.max_record_size||null===r.max_record_size||!1===r.max_record_size)r.max_record_size=0;else if(Number.isInteger(r.max_record_size)&&r.max_record_size>=0);else{if("string"!=typeof r.max_record_size||!/\d+/.test(r.max_record_size))throw new Error("Invalid Option: max_record_size must be a positive integer, got "+JSON.stringify(r.max_record_size));r.max_record_size=parseInt(r.max_record_size)}if(void 0===r.objname||null===r.objname||!1===r.objname)r.objname=void 0;else if(e.isBuffer(r.objname)){if(0===r.objname.length)throw new Error("Invalid Option: objname must be a non empty buffer");null===r.encoding||(r.objname=r.objname.toString(r.encoding))}else{if("string"!=typeof r.objname)throw new Error("Invalid Option: objname must be a string or a buffer, got "+r.objname);if(0===r.objname.length)throw new Error("Invalid Option: objname must be a non empty string")}if(void 0===r.on_record||null===r.on_record)r.on_record=void 0;else if("function"!=typeof r.on_record)throw new g("CSV_INVALID_OPTION_ON_RECORD",["Invalid option `on_record`:","expect a function,","got "+JSON.stringify(r.on_record)],r);if(null===r.quote||!1===r.quote||""===r.quote)r.quote=null;else if(void 0===r.quote||!0===r.quote?r.quote=e.from('"',r.encoding):"string"==typeof r.quote&&(r.quote=e.from(r.quote,r.encoding)),!e.isBuffer(r.quote))throw new Error("Invalid Option: quote must be a buffer or a string, got "+JSON.stringify(r.quote));if(void 0===r.raw||null===r.raw||!1===r.raw)r.raw=!1;else if(!0!==r.raw)throw new Error("Invalid Option: raw must be true, got "+JSON.stringify(r.raw));if(r.record_delimiter?Array.isArray(r.record_delimiter)||(r.record_delimiter=[r.record_delimiter]):r.record_delimiter=[],r.record_delimiter=r.record_delimiter.map((function(t){return"string"==typeof t&&(t=e.from(t,r.encoding)),t})),"boolean"==typeof r.relax);else{if(void 0!==r.relax&&null!==r.relax)throw new Error("Invalid Option: relax must be a boolean, got "+JSON.stringify(r.relax));r.relax=!1}if("boolean"==typeof r.relax_column_count);else{if(void 0!==r.relax_column_count&&null!==r.relax_column_count)throw new Error("Invalid Option: relax_column_count must be a boolean, got "+JSON.stringify(r.relax_column_count));r.relax_column_count=!1}if("boolean"==typeof r.relax_column_count_less);else{if(void 0!==r.relax_column_count_less&&null!==r.relax_column_count_less)throw new Error("Invalid Option: relax_column_count_less must be a boolean, got "+JSON.stringify(r.relax_column_count_less));r.relax_column_count_less=!1}if("boolean"==typeof r.relax_column_count_more);else{if(void 0!==r.relax_column_count_more&&null!==r.relax_column_count_more)throw new Error("Invalid Option: relax_column_count_more must be a boolean, got "+JSON.stringify(r.relax_column_count_more));r.relax_column_count_more=!1}if("boolean"==typeof r.skip_empty_lines);else{if(void 0!==r.skip_empty_lines&&null!==r.skip_empty_lines)throw new Error("Invalid Option: skip_empty_lines must be a boolean, got "+JSON.stringify(r.skip_empty_lines));r.skip_empty_lines=!1}if("boolean"==typeof r.skip_lines_with_empty_values);else{if(void 0!==r.skip_lines_with_empty_values&&null!==r.skip_lines_with_empty_values)throw new Error("Invalid Option: skip_lines_with_empty_values must be a boolean, got "+JSON.stringify(r.skip_lines_with_empty_values));r.skip_lines_with_empty_values=!1}if("boolean"==typeof r.skip_lines_with_error);else{if(void 0!==r.skip_lines_with_error&&null!==r.skip_lines_with_error)throw new Error("Invalid Option: skip_lines_with_error must be a boolean, got "+JSON.stringify(r.skip_lines_with_error));r.skip_lines_with_error=!1}if(void 0===r.rtrim||null===r.rtrim||!1===r.rtrim)r.rtrim=!1;else if(!0!==r.rtrim)throw new Error("Invalid Option: rtrim must be a boolean, got "+JSON.stringify(r.rtrim));if(void 0===r.ltrim||null===r.ltrim||!1===r.ltrim)r.ltrim=!1;else if(!0!==r.ltrim)throw new Error("Invalid Option: ltrim must be a boolean, got "+JSON.stringify(r.ltrim));if(void 0===r.trim||null===r.trim||!1===r.trim)r.trim=!1;else if(!0!==r.trim)throw new Error("Invalid Option: trim must be a boolean, got "+JSON.stringify(r.trim));if(!0===r.trim&&!1!==t.ltrim?r.ltrim=!0:!0!==r.ltrim&&(r.ltrim=!1),!0===r.trim&&!1!==t.rtrim?r.rtrim=!0:!0!==r.rtrim&&(r.rtrim=!1),void 0===r.to||null===r.to)r.to=-1;else{if("string"==typeof r.to&&/\d+/.test(r.to)&&(r.to=parseInt(r.to)),!Number.isInteger(r.to))throw new Error("Invalid Option: to must be an integer, got "+JSON.stringify(t.to));if(r.to<=0)throw new Error("Invalid Option: to must be a positive integer greater than 0, got "+JSON.stringify(t.to))}if(void 0===r.to_line||null===r.to_line)r.to_line=-1;else{if("string"==typeof r.to_line&&/\d+/.test(r.to_line)&&(r.to_line=parseInt(r.to_line)),!Number.isInteger(r.to_line))throw new Error("Invalid Option: to_line must be an integer, got "+JSON.stringify(t.to_line));if(r.to_line<=0)throw new Error("Invalid Option: to_line must be a positive integer greater than 0, got "+JSON.stringify(t.to_line))}this.info={bytes:0,comment_lines:0,empty_lines:0,invalid_field_length:0,lines:1,records:0},this.options=r,this.state={bomSkipped:!1,bufBytesStart:0,castField:n,commenting:!1,error:void 0,enabled:1===r.from_line,escaping:!1,escapeIsQuote:e.isBuffer(r.escape)&&e.isBuffer(r.quote)&&0===e.compare(r.escape,r.quote),expectedRecordLength:Array.isArray(r.columns)?r.columns.length:void 0,field:new l(20),firstLineToHeaders:i,needMoreDataSize:Math.max(null!==r.comment?r.comment.length:0,...r.delimiter.map(t=>t.length),null!==r.quote?r.quote.length:0),previousBuf:void 0,quoting:!1,stop:!1,rawBuffer:new l(100),record:[],recordHasError:!1,record_length:0,recordDelimiterMaxLength:0===r.record_delimiter.length?2:Math.max(...r.record_delimiter.map(t=>t.length)),trimChars:[e.from(" ",r.encoding)[0],e.from("\t",r.encoding)[0]],wasQuoting:!1,wasRowDelimiter:!1}}_transform(t,e,r){if(!0===this.state.stop)return;const n=this.__parse(t,!1);void 0!==n&&(this.state.stop=!0),r(n)}_flush(t){if(!0===this.state.stop)return;t(this.__parse(void 0,!0))}__parse(t,r){const n=this.options,i=n.bom,o=n.comment,a=n.escape,u=n.from_line,c=n.ltrim,l=n.max_record_size,d=n.quote,h=n.raw,p=n.relax,m=n.rtrim,y=n.skip_empty_lines,b=n.to,w=n.to_line;let _=this.options.record_delimiter;const v=this.state,E=v.bomSkipped,S=v.previousBuf,O=v.rawBuffer,T=v.escapeIsQuote;let A;if(void 0===S){if(void 0===t)return void this.push(null);A=t}else A=void 0!==S&&void 0===t?S:e.concat([S,t]);if(!1===E)if(!1===i)this.state.bomSkipped=!0;else if(A.length<3){if(!1===r)return void(this.state.previousBuf=A)}else{for(let t in f)if(0===f[t].compare(A,0,f[t].length)){let e=f[t].length;this.state.bufBytesStart+=e,A=A.slice(e),this.__normalizeOptions(s(s({},this.__originalOptions),{},{encoding:t}));break}this.state.bomSkipped=!0}const M=A.length;let j;for(j=0;j<M&&!this.__needMoreData(j,M,r);j++){if(!0===this.state.wasRowDelimiter&&(this.info.lines++,this.state.wasRowDelimiter=!1),-1!==w&&this.info.lines>w)return this.state.stop=!0,void this.push(null);if(!1===this.state.quoting&&0===_.length){this.__autoDiscoverRecordDelimiter(A,j)&&(_=this.options.record_delimiter)}const t=A[j];if(!0===h&&O.append(t),13!==t&&10!==t||!1!==this.state.wasRowDelimiter||(this.state.wasRowDelimiter=!0),!0===this.state.escaping)this.state.escaping=!1;else{if(null!==a&&!0===this.state.quoting&&this.__isEscape(A,j,t)&&j+a.length<M){if(!T){this.state.escaping=!0,j+=a.length-1;continue}if(this.__isQuote(A,j+a.length)){this.state.escaping=!0,j+=a.length-1;continue}}if(!1===this.state.commenting&&this.__isQuote(A,j))if(!0===this.state.quoting){const e=A[j+d.length],r=m&&this.__isCharTrimable(e),n=null!==o&&this.__compareBytes(o,A,j+d.length,e),i=this.__isDelimiter(A,j+d.length,e),s=0===_.length?this.__autoDiscoverRecordDelimiter(A,j+d.length):this.__isRecordDelimiter(e,A,j+d.length);if(null!==a&&this.__isEscape(A,j,t)&&this.__isQuote(A,j+a.length))j+=a.length-1;else{if(!e||i||s||n||r){this.state.quoting=!1,this.state.wasQuoting=!0,j+=d.length-1;continue}if(!1===p){const t=this.__error(new g("CSV_INVALID_CLOSING_QUOTE",["Invalid Closing Quote:",`got "${String.fromCharCode(e)}"`,"at line "+this.info.lines,"instead of delimiter, record delimiter, trimable character","(if activated) or comment"],this.options,this.__infoField()));if(void 0!==t)return t}else this.state.quoting=!1,this.state.wasQuoting=!0,this.state.field.prepend(d),j+=d.length-1}}else{if(0===this.state.field.length){this.state.quoting=!0,j+=d.length-1;continue}if(!1===p){const t=this.__error(new g("INVALID_OPENING_QUOTE",["Invalid Opening Quote:","a quote is found inside a field at line "+this.info.lines],this.options,this.__infoField(),{field:this.state.field}));if(void 0!==t)return t}}if(!1===this.state.quoting){let e=this.__isRecordDelimiter(t,A,j);if(0!==e){if(this.state.commenting&&!1===this.state.wasQuoting&&0===this.state.record.length&&0===this.state.field.length)this.info.comment_lines++;else{if(!1===this.state.enabled&&this.info.lines+(!0===this.state.wasRowDelimiter?1:0)>=u){this.state.enabled=!0,this.__resetField(),this.__resetRecord(),j+=e-1;continue}if(!0===y&&!1===this.state.wasQuoting&&0===this.state.record.length&&0===this.state.field.length){this.info.empty_lines++,j+=e-1;continue}this.info.bytes=this.state.bufBytesStart+j;const t=this.__onField();if(void 0!==t)return t;this.info.bytes=this.state.bufBytesStart+j+e;const r=this.__onRecord();if(void 0!==r)return r;if(-1!==b&&this.info.records>=b)return this.state.stop=!0,void this.push(null)}this.state.commenting=!1,j+=e-1;continue}if(this.state.commenting)continue;if(0!==(null===o?0:this.__compareBytes(o,A,j,t))){this.state.commenting=!0;continue}let r=this.__isDelimiter(A,j,t);if(0!==r){this.info.bytes=this.state.bufBytesStart+j;const t=this.__onField();if(void 0!==t)return t;j+=r-1;continue}}}if(!1===this.state.commenting&&0!==l&&this.state.record_length+this.state.field.length>l){const t=this.__error(new g("CSV_MAX_RECORD_SIZE",["Max Record Size:","record exceed the maximum number of tolerated bytes","of "+l,"at line "+this.info.lines],this.options,this.__infoField()));if(void 0!==t)return t}const e=!1===c||!0===this.state.quoting||0!==this.state.field.length||!this.__isCharTrimable(t),r=!1===m||!1===this.state.wasQuoting;if(!0===e&&!0===r)this.state.field.append(t);else if(!0===m&&!this.__isCharTrimable(t)){const t=this.__error(new g("CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",["Invalid Closing Quote:","found non trimable byte after quote","at line "+this.info.lines],this.options,this.__infoField()));if(void 0!==t)return t}}if(!0===r)if(!0===this.state.quoting){const t=this.__error(new g("CSV_QUOTE_NOT_CLOSED",["Quote Not Closed:","the parsing is finished with an opening quote at line "+this.info.lines],this.options,this.__infoField()));if(void 0!==t)return t}else if(!0===this.state.wasQuoting||0!==this.state.record.length||0!==this.state.field.length){this.info.bytes=this.state.bufBytesStart+j;const t=this.__onField();if(void 0!==t)return t;const e=this.__onRecord();if(void 0!==e)return e}else!0===this.state.wasRowDelimiter?this.info.empty_lines++:!0===this.state.commenting&&this.info.comment_lines++;else this.state.bufBytesStart+=j,this.state.previousBuf=A.slice(j);!0===this.state.wasRowDelimiter&&(this.info.lines++,this.state.wasRowDelimiter=!1)}__onRecord(){const t=this.options,e=t.columns,r=t.columns_duplicates_to_array,n=t.encoding,i=t.info,o=t.from,a=t.relax_column_count,s=t.relax_column_count_less,u=t.relax_column_count_more,c=t.raw,l=t.skip_lines_with_empty_values,f=this.state,d=f.enabled,h=f.record;if(!1===d)return this.__resetRecord();const p=h.length;if(!0===e)return!0===l&&y(h)?void this.__resetRecord():this.__firstLineToColumns(h);if(!1===e&&0===this.info.records&&(this.state.expectedRecordLength=p),p!==this.state.expectedRecordLength){const t=!1===e?new g("CSV_INCONSISTENT_RECORD_LENGTH",["Invalid Record Length:",`expect ${this.state.expectedRecordLength},`,`got ${p} on line ${this.info.lines}`],this.options,this.__infoField(),{record:h}):new g("CSV_RECORD_DONT_MATCH_COLUMNS_LENGTH",["Invalid Record Length:",`columns length is ${e.length},`,`got ${p} on line ${this.info.lines}`],this.options,this.__infoField(),{record:h});if(!0===a||!0===s&&p<this.state.expectedRecordLength||!0===u&&p>this.state.expectedRecordLength)this.info.invalid_field_length++,this.state.error=t;else{const e=this.__error(t);if(e)return e}}if(!0===l&&y(h))this.__resetRecord();else{if(!0===this.state.recordHasError)return this.__resetRecord(),void(this.state.recordHasError=!1);if(this.info.records++,1===o||this.info.records>=o)if(!1!==e){const t={};for(let n=0,i=h.length;n<i;n++)void 0===e[n]||e[n].disabled||(!0===r&&void 0!==t[e[n].name]?Array.isArray(t[e[n].name])?t[e[n].name]=t[e[n].name].concat(h[n]):t[e[n].name]=[t[e[n].name],h[n]]:t[e[n].name]=h[n]);const o=this.options.objname;if(void 0===o)if(!0===c||!0===i){const e=this.__push(Object.assign({record:t},!0===c?{raw:this.state.rawBuffer.toString(n)}:{},!0===i?{info:this.__infoRecord()}:{}));if(e)return e}else{const e=this.__push(t);if(e)return e}else if(!0===c||!0===i){const e=this.__push(Object.assign({record:[t[o],t]},!0===c?{raw:this.state.rawBuffer.toString(n)}:{},!0===i?{info:this.__infoRecord()}:{}));if(e)return e}else{const e=this.__push([t[o],t]);if(e)return e}}else if(!0===c||!0===i){const t=this.__push(Object.assign({record:h},!0===c?{raw:this.state.rawBuffer.toString(n)}:{},!0===i?{info:this.__infoRecord()}:{}));if(t)return t}else{const t=this.__push(h);if(t)return t}this.__resetRecord()}}__firstLineToColumns(t){const e=this.state.firstLineToHeaders;try{const r=void 0===e?t:e.call(null,t);if(!Array.isArray(r))return this.__error(new g("CSV_INVALID_COLUMN_MAPPING",["Invalid Column Mapping:","expect an array from column function,","got "+JSON.stringify(r)],this.options,this.__infoField(),{headers:r}));const n=b(r);return this.state.expectedRecordLength=n.length,this.options.columns=n,void this.__resetRecord()}catch(t){return t}}__resetRecord(){!0===this.options.raw&&this.state.rawBuffer.reset(),this.state.error=void 0,this.state.record=[],this.state.record_length=0}__onField(){const t=this.options,e=t.cast,r=t.encoding,n=t.rtrim,o=t.max_record_size,a=this.state,s=a.enabled,u=a.wasQuoting;if(!1===s)return this.__resetField();let c=this.state.field.toString(r);if(!0===n&&!1===u&&(c=c.trimRight()),!0===e){const t=i(this.__cast(c),2),e=t[0],r=t[1];if(void 0!==e)return e;c=r}this.state.record.push(c),0!==o&&"string"==typeof c&&(this.state.record_length+=c.length),this.__resetField()}__resetField(){this.state.field.reset(),this.state.wasQuoting=!1}__push(t){const e=this.options.on_record;if(void 0!==e){const r=this.__infoRecord();try{t=e.call(null,t,r)}catch(t){return t}if(null==t)return}this.push(t)}__cast(t){const e=this.options,r=e.columns,n=e.relax_column_count;if(!0===Array.isArray(r)&&n&&this.options.columns.length<=this.state.record.length)return[void 0,void 0];if(null!==this.state.castField)try{const e=this.__infoField();return[void 0,this.state.castField.call(null,t,e)]}catch(t){return[t]}if(this.__isFloat(t))return[void 0,parseFloat(t)];if(!1!==this.options.cast_date){const e=this.__infoField();return[void 0,this.options.cast_date.call(null,t,e)]}return[void 0,t]}__isCharTrimable(t){return 32===t||9===t||13===t||10===t||12===t}__isFloat(t){return t-parseFloat(t)+1>=0}__compareBytes(t,e,r,n){if(t[0]!==n)return 0;const i=t.length;for(let n=1;n<i;n++)if(t[n]!==e[r+n])return 0;return i}__needMoreData(t,e,r){if(r)return!1;const n=this.options.quote,i=this.state,o=i.quoting,a=i.needMoreDataSize,s=i.recordDelimiterMaxLength;return e-t-1<Math.max(a,s,o?n.length+s:0)}__isDelimiter(t,e,r){const n=this.options,i=n.delimiter,o=n.ignore_last_delimiters;if(!0===o&&this.state.record.length===this.options.columns.length-1)return 0;if(!1!==o&&"number"==typeof o&&this.state.record.length===o-1)return 0;t:for(let n=0;n<i.length;n++){const o=i[n];if(o[0]===r){for(let r=1;r<o.length;r++)if(o[r]!==t[e+r])continue t;return o.length}}return 0}__isRecordDelimiter(t,e,r){const n=this.options.record_delimiter,i=n.length;t:for(let o=0;o<i;o++){const i=n[o],a=i.length;if(i[0]===t){for(let t=1;t<a;t++)if(i[t]!==e[r+t])continue t;return i.length}}return 0}__isEscape(t,e,r){const n=this.options.escape;if(null===n)return!1;const i=n.length;if(n[0]===r){for(let r=0;r<i;r++)if(n[r]!==t[e+r])return!1;return!0}return!1}__isQuote(t,e){const r=this.options.quote;if(null===r)return!1;const n=r.length;for(let i=0;i<n;i++)if(r[i]!==t[e+i])return!1;return!0}__autoDiscoverRecordDelimiter(t,r){const n=this.options.encoding,i=t[r];return 13===i?10===t[r+1]?(this.options.record_delimiter.push(e.from("\r\n",n)),this.state.recordDelimiterMaxLength=2,2):(this.options.record_delimiter.push(e.from("\r",n)),this.state.recordDelimiterMaxLength=1,1):10===i?(this.options.record_delimiter.push(e.from("\n",n)),this.state.recordDelimiterMaxLength=1,1):0}__error(t){const e=this.options.skip_lines_with_error,r="string"==typeof t?new Error(t):t;return e?(this.state.recordHasError=!0,void this.emit("skip",r)):r}__infoDataSet(){return s(s({},this.info),{},{columns:this.options.columns})}__infoRecord(){const t=this.options.columns;return s(s({},this.__infoDataSet()),{},{error:this.state.error,header:!0===t,index:this.state.record.length})}__infoField(){const t=this.options.columns,e=Array.isArray(t);return s(s({},this.__infoRecord()),{},{column:!0===e?t.length>this.state.record.length?t[this.state.record.length].name:null:this.state.record.length,quoting:this.state.wasQuoting})}}const h=function(){let t,r,i;for(let n in arguments){const o=arguments[n],a=typeof o;if(void 0!==t||"string"!=typeof o&&!e.isBuffer(o))if(void 0===r&&m(o))r=o;else{if(void 0!==i||"function"!==a)throw new g("CSV_INVALID_ARGUMENT",["Invalid argument:",`got ${JSON.stringify(o)} at index ${n}`],r||{});i=o}else t=o}const o=new d(r);if(i){const t=void 0===r||void 0===r.objname?[]:{};o.on("readable",(function(){let e;for(;null!==(e=this.read());)void 0===r||void 0===r.objname?t.push(e):t[e[0]]=e[1]})),o.on("error",(function(t){i(t,void 0,o.__infoDataSet())})),o.on("end",(function(){i(void 0,t,o.__infoDataSet())}))}return void 0!==t&&("function"==typeof n?n((function(){o.write(t),o.end()})):(o.write(t),o.end())),o};class g extends Error{constructor(t,r,n,...i){Array.isArray(r)&&(r=r.join(" ")),super(r),void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,g),this.code=t;for(const t of i)for(const r in t){const i=t[r];this[r]=e.isBuffer(i)?i.toString(n.encoding):null==i?i:JSON.parse(JSON.stringify(i))}}}h.Parser=d,h.CsvError=g,t.exports=h;const p=function(t){return t.replace(/([A-Z])/g,(function(t,e){return"_"+e.toLowerCase()}))},m=function(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)},y=function(t){return t.every(t=>null==t||t.toString&&""===t.toString().trim())},b=function(t){const e=[];for(let r=0,n=t.length;r<n;r++){const n=t[r];if(null==n||!1===n)e[r]={disabled:!0};else if("string"==typeof n)e[r]={name:n};else{if(!m(n))throw new g("CSV_INVALID_COLUMN_DEFINITION",["Invalid column definition:","expect a string or a literal object,",`got ${JSON.stringify(n)} at position ${r}`]);if("string"!=typeof n.name)throw new g("CSV_OPTION_COLUMNS_MISSING_NAME",["Option columns missing name:",'property "name" is required at position '+r,"when column is an object literal"]);e[r]=n}}return e}}).call(this,r(14).Buffer,r(109).setImmediate)},function(t,e,r){(function(e){t.exports=class{constructor(t=100){this.size=t,this.length=0,this.buf=e.alloc(t)}prepend(t){if(e.isBuffer(t)){const r=this.length+t.length;if(r>=this.size&&(this.resize(),r>=this.size))throw Error("INVALID_BUFFER_STATE");const n=this.buf;this.buf=e.alloc(this.size),t.copy(this.buf,0),n.copy(this.buf,t.length),this.length+=t.length}else{const e=this.length++;e===this.size&&this.resize();const r=this.clone();this.buf[0]=t,r.copy(this.buf,1,0,e)}}append(t){const e=this.length++;e===this.size&&this.resize(),this.buf[e]=t}clone(){return e.from(this.buf.slice(0,this.length))}resize(){const t=this.length;this.size=2*this.size;const r=e.alloc(this.size);this.buf.copy(r,0,0,t),this.buf=r}toString(t){return t?this.buf.slice(0,this.length).toString(t):Uint8Array.prototype.slice.call(this.buf.slice(0,this.length))}toJSON(){return this.toString("utf8")}reset(){this.length=0}}}).call(this,r(14).Buffer)},function(t,e,r){"use strict";var n;if(!Object.keys){var i=Object.prototype.hasOwnProperty,o=Object.prototype.toString,a=r(244),s=Object.prototype.propertyIsEnumerable,u=!s.call({toString:null},"toString"),c=s.call((function(){}),"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],f=function(t){var e=t.constructor;return e&&e.prototype===t},d={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!d["$"+t]&&i.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{f(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();n=function(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===o.call(t),n=a(t),s=e&&"[object String]"===o.call(t),d=[];if(!e&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var g=c&&r;if(s&&t.length>0&&!i.call(t,0))for(var p=0;p<t.length;++p)d.push(String(p));if(n&&t.length>0)for(var m=0;m<t.length;++m)d.push(String(m));else for(var y in t)g&&"prototype"===y||!i.call(t,y)||d.push(String(y));if(u)for(var b=function(t){if("undefined"==typeof window||!h)return f(t);try{return f(t)}catch(t){return!1}}(t),w=0;w<l.length;++w)b&&"constructor"===l[w]||!i.call(t,l[w])||d.push(l[w]);return d}}t.exports=n},function(t,e,r){"use strict";var n="Function.prototype.bind called on incompatible ",i=Array.prototype.slice,o=Object.prototype.toString;t.exports=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==o.call(e))throw new TypeError(n+e);for(var r,a=i.call(arguments,1),s=function(){if(this instanceof r){var n=e.apply(this,a.concat(i.call(arguments)));return Object(n)===n?n:this}return e.apply(t,a.concat(i.call(arguments)))},u=Math.max(0,e.length-a.length),c=[],l=0;l<u;l++)c.push("$"+l);if(r=Function("binder","return function ("+c.join(",")+"){ return binder.apply(this,arguments); }")(s),e.prototype){var f=function(){};f.prototype=e.prototype,r.prototype=new f,f.prototype=null}return r}},function(t,e,r){"use strict";var n=r(162);t.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},function(t,e,r){"use strict";var n=r(78),i=r(117),o=r(246),a=r(247),s=r(432),u=i(a(),Object);n(u,{getPolyfill:a,implementation:o,shim:s}),t.exports=u},function(t,e,r){"use strict";var n=r(247),i=r(78);t.exports=function(){var t=n();return i(Object,{is:t},{is:function(){return Object.is!==t}}),t}},function(t,e,r){"use strict";var n,i,o,a,s=r(52),u=r(69)();if(u){n=s("Object.prototype.hasOwnProperty"),i=s("RegExp.prototype.exec"),o={};var c=function(){throw o};a={toString:c,valueOf:c},"symbol"==typeof Symbol.toPrimitive&&(a[Symbol.toPrimitive]=c)}var l=s("Object.prototype.toString"),f=Object.getOwnPropertyDescriptor;t.exports=u?function(t){if(!t||"object"!=typeof t)return!1;var e=f(t,"lastIndex");if(!(e&&n(e,"value")))return!1;try{i(t,a)}catch(t){return t===o}}:function(t){return!(!t||"object"!=typeof t&&"function"!=typeof t)&&"[object RegExp]"===l(t)}},function(t,e,r){"use strict";var n=r(78),i=r(117),o=r(248),a=r(249),s=r(435),u=i(a());n(u,{getPolyfill:a,implementation:o,shim:s}),t.exports=u},function(t,e,r){"use strict";var n=r(78).supportsDescriptors,i=r(249),o=Object.getOwnPropertyDescriptor,a=Object.defineProperty,s=TypeError,u=Object.getPrototypeOf,c=/a/;t.exports=function(){if(!n||!u)throw new s("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=i(),e=u(c),r=o(e,"flags");return r&&r.get===t||a(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";var n=Date.prototype.getDay,i=Object.prototype.toString,o=r(69)();t.exports=function(t){return"object"==typeof t&&null!==t&&(o?function(t){try{return n.call(t),!0}catch(t){return!1}}(t):"[object Date]"===i.call(t))}},function(t,e,r){"use strict";var n=r(250),i=r(439),o=r(440),a=r(441),s=r(442);t.exports=function(t){return null==t||"object"!=typeof t&&"function"!=typeof t?null:n(t)?"String":i(t)?"Number":o(t)?"Boolean":a(t)?"Symbol":s(t)?"BigInt":void 0}},function(t,e,r){"use strict";var n=Number.prototype.toString,i=Object.prototype.toString,o=r(69)();t.exports=function(t){return"number"==typeof t||"object"==typeof t&&(o?function(t){try{return n.call(t),!0}catch(t){return!1}}(t):"[object Number]"===i.call(t))}},function(t,e,r){"use strict";var n=r(52),i=n("Boolean.prototype.toString"),o=n("Object.prototype.toString"),a=r(69)();t.exports=function(t){return"boolean"==typeof t||null!==t&&"object"==typeof t&&(a&&Symbol.toStringTag in t?function(t){try{return i(t),!0}catch(t){return!1}}(t):"[object Boolean]"===o(t))}},function(t,e,r){"use strict";var n=Object.prototype.toString;if(r(161)()){var i=Symbol.prototype.toString,o=/^Symbol\(.*\)$/;t.exports=function(t){if("symbol"==typeof t)return!0;if("[object Symbol]"!==n.call(t))return!1;try{return function(t){return"symbol"==typeof t.valueOf()&&o.test(i.call(t))}(t)}catch(t){return!1}}}else t.exports=function(t){return!1}},function(t,e,r){"use strict";if(r(443)()){var n=BigInt.prototype.valueOf;t.exports=function(t){return null!=t&&"boolean"!=typeof t&&"string"!=typeof t&&"number"!=typeof t&&"symbol"!=typeof t&&"function"!=typeof t&&("bigint"==typeof t||function(t){try{return n.call(t),!0}catch(t){}return!1}(t))}}else t.exports=function(t){return!1}},function(t,e,r){"use strict";(function(e){var r=e.BigInt;t.exports=function(){return"function"==typeof r&&"function"==typeof BigInt&&"bigint"==typeof r(42)&&"bigint"==typeof BigInt(42)}}).call(this,r(24))},function(t,e,r){"use strict";var n=r(251),i=r(252),o=r(445),a=r(446);t.exports=function(t){if(t&&"object"==typeof t){if(n(t))return"Map";if(i(t))return"Set";if(o(t))return"WeakMap";if(a(t))return"WeakSet"}return!1}},function(t,e,r){"use strict";var n,i="function"==typeof WeakMap&&WeakMap.prototype?WeakMap:null,o="function"==typeof WeakSet&&WeakSet.prototype?WeakSet:null;i||(n=function(t){return!1});var a=i?i.prototype.has:null,s=o?o.prototype.has:null;n||a||(n=function(t){return!1}),t.exports=n||function(t){if(!t||"object"!=typeof t)return!1;try{if(a.call(t,a),s)try{s.call(t,s)}catch(t){return!0}return t instanceof i}catch(t){}return!1}},function(t,e,r){"use strict";var n=r(77),i=r(52),o=n("%WeakSet%",!0),a=i("WeakSet.prototype.has",!0);if(a){var s=i("WeakMap.prototype.has",!0);t.exports=function(t){if(!t||"object"!=typeof t)return!1;try{if(a(t,a),s)try{s(t,s)}catch(t){return!0}return t instanceof o}catch(t){}return!1}}else t.exports=function(t){return!1}},function(t,e,r){"use strict";(function(e){var n=r(245);if(r(161)()||r(116)()){var i=Symbol.iterator;t.exports=function(t){return null!=t&&void 0!==t[i]?t[i]():n(t)?Array.prototype[i].call(t):void 0}}else{var o=r(448),a=r(250),s=r(77),u=s("%Map%",!0),c=s("%Set%",!0),l=r(52),f=l("Array.prototype.push"),d=l("String.prototype.charCodeAt"),h=l("String.prototype.slice"),g=function(t){var e=0;return{next:function(){var r,n=e>=t.length;return n||(r=t[e],e+=1),{done:n,value:r}}}},p=function(t,e){if(o(t)||n(t))return g(t);if(a(t)){var r=0;return{next:function(){var e=function(t,e){if(e+1>=t.length)return e+1;var r=d(t,e);if(r<55296||r>56319)return e+1;var n=d(t,e+1);return n<56320||n>57343?e+1:e+2}(t,r),n=h(t,r,e);return r=e,{done:e>t.length,value:n}}}}return e&&void 0!==t["_es6-shim iterator_"]?t["_es6-shim iterator_"]():void 0};if(u||c){var m=r(251),y=r(252),b=l("Map.prototype.forEach",!0),w=l("Set.prototype.forEach",!0);if(void 0===e||!e.versions||!e.versions.node)var _=l("Map.prototype.iterator",!0),v=l("Set.prototype.iterator",!0),E=function(t){var e=!1;return{next:function(){try{return{done:e,value:e?void 0:t.next()}}catch(t){return e=!0,{done:!0,value:void 0}}}}};var S=l("Map.prototype.@@iterator",!0)||l("Map.prototype._es6-shim iterator_",!0),O=l("Set.prototype.@@iterator",!0)||l("Set.prototype._es6-shim iterator_",!0);t.exports=function(t){return function(t){if(m(t)){if(_)return E(_(t));if(S)return S(t);if(b){var e=[];return b(t,(function(t,r){f(e,[r,t])})),g(e)}}if(y(t)){if(v)return E(v(t));if(O)return O(t);if(w){var r=[];return w(t,(function(t){f(r,t)})),g(r)}}}(t)||p(t)}}else t.exports=function(t){if(null!=t)return p(t,!0)}}}).call(this,r(20))},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";var n=r(77),i=r(52),o=r(450),a=n("%TypeError%"),s=n("%WeakMap%",!0),u=n("%Map%",!0),c=i("WeakMap.prototype.get",!0),l=i("WeakMap.prototype.set",!0),f=i("WeakMap.prototype.has",!0),d=i("Map.prototype.get",!0),h=i("Map.prototype.set",!0),g=i("Map.prototype.has",!0),p=function(t,e){for(var r,n=t;null!==(r=n.next);n=r)if(r.key===e)return n.next=r.next,r.next=t.next,t.next=r,r};t.exports=function(){var t,e,r,n={assert:function(t){if(!n.has(t))throw new a("Side channel does not contain "+o(t))},get:function(n){if(s&&n&&("object"==typeof n||"function"==typeof n)){if(t)return c(t,n)}else if(u){if(e)return d(e,n)}else if(r)return function(t,e){var r=p(t,e);return r&&r.value}(r,n)},has:function(n){if(s&&n&&("object"==typeof n||"function"==typeof n)){if(t)return f(t,n)}else if(u){if(e)return g(e,n)}else if(r)return function(t,e){return!!p(t,e)}(r,n);return!1},set:function(n,i){s&&n&&("object"==typeof n||"function"==typeof n)?(t||(t=new s),l(t,n,i)):u?(e||(e=new u),h(e,n,i)):(r||(r={key:{},next:null}),function(t,e,r){var n=p(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}}(r,n,i))}};return n}},function(t,e,r){var n="function"==typeof Map&&Map.prototype,i=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,o=n&&i&&"function"==typeof i.get?i.get:null,a=n&&Map.prototype.forEach,s="function"==typeof Set&&Set.prototype,u=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,c=s&&u&&"function"==typeof u.get?u.get:null,l=s&&Set.prototype.forEach,f="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,d="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,h="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,g=Boolean.prototype.valueOf,p=Object.prototype.toString,m=Function.prototype.toString,y=String.prototype.match,b=String.prototype.slice,w=String.prototype.replace,_=String.prototype.toUpperCase,v=String.prototype.toLowerCase,E=RegExp.prototype.test,S=Array.prototype.concat,O=Array.prototype.join,T=Array.prototype.slice,A=Math.floor,M="function"==typeof BigInt?BigInt.prototype.valueOf:null,j=Object.getOwnPropertySymbols,I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,R="function"==typeof Symbol&&"object"==typeof Symbol.iterator,D="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===R||"symbol")?Symbol.toStringTag:null,k=Object.prototype.propertyIsEnumerable,N=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function C(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||E.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var n=t<0?-A(-t):A(t);if(n!==t){var i=String(n),o=b.call(e,i.length+1);return w.call(i,r,"$&_")+"."+w.call(w.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return w.call(e,r,"$&_")}var x=r(451).custom,L=x&&F(x)?x:null;function P(t,e,r){var n="double"===(r.quoteStyle||e)?'"':"'";return n+t+n}function B(t){return w.call(String(t),/"/g,"&quot;")}function U(t){return!("[object Array]"!==q(t)||D&&"object"==typeof t&&D in t)}function F(t){if(R)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!I)return!1;try{return I.call(t),!0}catch(t){}return!1}t.exports=function t(e,r,n,i){var s=r||{};if(H(s,"quoteStyle")&&"single"!==s.quoteStyle&&"double"!==s.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(H(s,"maxStringLength")&&("number"==typeof s.maxStringLength?s.maxStringLength<0&&s.maxStringLength!==1/0:null!==s.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var u=!H(s,"customInspect")||s.customInspect;if("boolean"!=typeof u&&"symbol"!==u)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(H(s,"indent")&&null!==s.indent&&"\t"!==s.indent&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(H(s,"numericSeparator")&&"boolean"!=typeof s.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var p=s.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return function t(e,r){if(e.length>r.maxStringLength){var n=e.length-r.maxStringLength,i="... "+n+" more character"+(n>1?"s":"");return t(b.call(e,0,r.maxStringLength),r)+i}return P(w.call(w.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,V),"single",r)}(e,s);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var _=String(e);return p?C(e,_):_}if("bigint"==typeof e){var E=String(e)+"n";return p?C(e,E):E}var A=void 0===s.depth?5:s.depth;if(void 0===n&&(n=0),n>=A&&A>0&&"object"==typeof e)return U(e)?"[Array]":"[Object]";var j=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=O.call(Array(t.indent+1)," ")}return{base:r,prev:O.call(Array(e+1),r)}}(s,n);if(void 0===i)i=[];else if(z(i,e)>=0)return"[Circular]";function x(e,r,o){if(r&&(i=T.call(i)).push(r),o){var a={depth:s.depth};return H(s,"quoteStyle")&&(a.quoteStyle=s.quoteStyle),t(e,a,n+1,i)}return t(e,s,n+1,i)}if("function"==typeof e){var W=function(t){if(t.name)return t.name;var e=y.call(m.call(t),/^function\s*([\w$]+)/);if(e)return e[1];return null}(e),J=Z(e,x);return"[Function"+(W?": "+W:" (anonymous)")+"]"+(J.length>0?" { "+O.call(J,", ")+" }":"")}if(F(e)){var X=R?w.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):I.call(e);return"object"!=typeof e||R?X:Y(X)}if(function(t){if(!t||"object"!=typeof t)return!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return!0;return"string"==typeof t.nodeName&&"function"==typeof t.getAttribute}(e)){for(var Q="<"+v.call(String(e.nodeName)),tt=e.attributes||[],et=0;et<tt.length;et++)Q+=" "+tt[et].name+"="+P(B(tt[et].value),"double",s);return Q+=">",e.childNodes&&e.childNodes.length&&(Q+="..."),Q+="</"+v.call(String(e.nodeName))+">"}if(U(e)){if(0===e.length)return"[]";var rt=Z(e,x);return j&&!function(t){for(var e=0;e<t.length;e++)if(z(t[e],"\n")>=0)return!1;return!0}(rt)?"["+K(rt,j)+"]":"[ "+O.call(rt,", ")+" ]"}if(function(t){return!("[object Error]"!==q(t)||D&&"object"==typeof t&&D in t)}(e)){var nt=Z(e,x);return"cause"in e&&!k.call(e,"cause")?"{ ["+String(e)+"] "+O.call(S.call("[cause]: "+x(e.cause),nt),", ")+" }":0===nt.length?"["+String(e)+"]":"{ ["+String(e)+"] "+O.call(nt,", ")+" }"}if("object"==typeof e&&u){if(L&&"function"==typeof e[L])return e[L]();if("symbol"!==u&&"function"==typeof e.inspect)return e.inspect()}if(function(t){if(!o||!t||"object"!=typeof t)return!1;try{o.call(t);try{c.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(e)){var it=[];return a.call(e,(function(t,r){it.push(x(r,e,!0)+" => "+x(t,e))})),$("Map",o.call(e),it,j)}if(function(t){if(!c||!t||"object"!=typeof t)return!1;try{c.call(t);try{o.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(e)){var ot=[];return l.call(e,(function(t){ot.push(x(t,e))})),$("Set",c.call(e),ot,j)}if(function(t){if(!f||!t||"object"!=typeof t)return!1;try{f.call(t,f);try{d.call(t,d)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(e))return G("WeakMap");if(function(t){if(!d||!t||"object"!=typeof t)return!1;try{d.call(t,d);try{f.call(t,f)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(e))return G("WeakSet");if(function(t){if(!h||!t||"object"!=typeof t)return!1;try{return h.call(t),!0}catch(t){}return!1}(e))return G("WeakRef");if(function(t){return!("[object Number]"!==q(t)||D&&"object"==typeof t&&D in t)}(e))return Y(x(Number(e)));if(function(t){if(!t||"object"!=typeof t||!M)return!1;try{return M.call(t),!0}catch(t){}return!1}(e))return Y(x(M.call(e)));if(function(t){return!("[object Boolean]"!==q(t)||D&&"object"==typeof t&&D in t)}(e))return Y(g.call(e));if(function(t){return!("[object String]"!==q(t)||D&&"object"==typeof t&&D in t)}(e))return Y(x(String(e)));if(!function(t){return!("[object Date]"!==q(t)||D&&"object"==typeof t&&D in t)}(e)&&!function(t){return!("[object RegExp]"!==q(t)||D&&"object"==typeof t&&D in t)}(e)){var at=Z(e,x),st=N?N(e)===Object.prototype:e instanceof Object||e.constructor===Object,ut=e instanceof Object?"":"null prototype",ct=!st&&D&&Object(e)===e&&D in e?b.call(q(e),8,-1):ut?"Object":"",lt=(st||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(ct||ut?"["+O.call(S.call([],ct||[],ut||[]),": ")+"] ":"");return 0===at.length?lt+"{}":j?lt+"{"+K(at,j)+"}":lt+"{ "+O.call(at,", ")+" }"}return String(e)};var W=Object.prototype.hasOwnProperty||function(t){return t in this};function H(t,e){return W.call(t,e)}function q(t){return p.call(t)}function z(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function V(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+_.call(e.toString(16))}function Y(t){return"Object("+t+")"}function G(t){return t+" { ? }"}function $(t,e,r,n){return t+" ("+e+") {"+(n?K(r,n):O.call(r,", "))+"}"}function K(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+O.call(t,","+r)+"\n"+e.prev}function Z(t,e){var r=U(t),n=[];if(r){n.length=t.length;for(var i=0;i<t.length;i++)n[i]=H(t,i)?e(t[i],t):""}var o,a="function"==typeof j?j(t):[];if(R){o={};for(var s=0;s<a.length;s++)o["$"+a[s]]=a[s]}for(var u in t)H(t,u)&&(r&&String(Number(u))===u&&u<t.length||R&&o["$"+u]instanceof Symbol||(E.call(/[^\w$]/,u)?n.push(e(u,t)+": "+e(t[u],t)):n.push(u+": "+e(t[u],t))));if("function"==typeof j)for(var c=0;c<a.length;c++)k.call(t,a[c])&&n.push("["+e(a[c])+"]: "+e(t[a[c]],t));return n}},function(t,e){},function(t,e,r){"use strict";(function(e){var n=r(253),i=r(254),o=r(52),a=o("Object.prototype.toString"),s=r(69)(),u="undefined"==typeof globalThis?e:globalThis,c=i(),l=o("String.prototype.slice"),f={},d=r(255),h=Object.getPrototypeOf;s&&d&&h&&n(c,(function(t){if("function"==typeof u[t]){var e=new u[t];if(Symbol.toStringTag in e){var r=h(e),n=d(r,Symbol.toStringTag);if(!n){var i=h(r);n=d(i,Symbol.toStringTag)}f[t]=n.get}}}));var g=r(453);t.exports=function(t){return!!g(t)&&(s&&Symbol.toStringTag in t?function(t){var e=!1;return n(f,(function(r,n){if(!e)try{var i=r.call(t);i===n&&(e=i)}catch(t){}})),e}(t):l(a(t),8,-1))}}).call(this,r(24))},function(t,e,r){"use strict";(function(e){var n=r(253),i=r(254),o=r(52),a=o("Object.prototype.toString"),s=r(69)(),u="undefined"==typeof globalThis?e:globalThis,c=i(),l=o("Array.prototype.indexOf",!0)||function(t,e){for(var r=0;r<t.length;r+=1)if(t[r]===e)return r;return-1},f=o("String.prototype.slice"),d={},h=r(255),g=Object.getPrototypeOf;s&&h&&g&&n(c,(function(t){var e=new u[t];if(Symbol.toStringTag in e){var r=g(e),n=h(r,Symbol.toStringTag);if(!n){var i=g(r);n=h(i,Symbol.toStringTag)}d[t]=n.get}}));t.exports=function(t){if(!t||"object"!=typeof t)return!1;if(!s||!(Symbol.toStringTag in t)){var e=f(a(t),8,-1);return l(c,e)>-1}return!!h&&function(t){var e=!1;return n(d,(function(r,n){if(!e)try{e=r.call(t)===n}catch(t){}})),e}(t)}}).call(this,r(24))},function(t,e,r){"use strict";var n=r(78),i=r(117),o=r(256),a=r(257),s=r(455),u=i.apply(a()),c=function(t,e){return u(Object,arguments)};n(c,{getPolyfill:a,implementation:o,shim:s}),t.exports=c},function(t,e,r){"use strict";var n=r(78),i=r(257);t.exports=function(){var t=i();return n(Object,{assign:t},{assign:function(){return Object.assign!==t}}),t}},function(t,e){var r,n;r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(t,e){return t<<e|t>>>32-e},rotr:function(t,e){return t<<32-e|t>>>e},endian:function(t){if(t.constructor==Number)return 16711935&n.rotl(t,8)|4278255360&n.rotl(t,24);for(var e=0;e<t.length;e++)t[e]=n.endian(t[e]);return t},randomBytes:function(t){for(var e=[];t>0;t--)e.push(Math.floor(256*Math.random()));return e},bytesToWords:function(t){for(var e=[],r=0,n=0;r<t.length;r++,n+=8)e[n>>>5]|=t[r]<<24-n%32;return e},wordsToBytes:function(t){for(var e=[],r=0;r<32*t.length;r+=8)e.push(t[r>>>5]>>>24-r%32&255);return e},bytesToHex:function(t){for(var e=[],r=0;r<t.length;r++)e.push((t[r]>>>4).toString(16)),e.push((15&t[r]).toString(16));return e.join("")},hexToBytes:function(t){for(var e=[],r=0;r<t.length;r+=2)e.push(parseInt(t.substr(r,2),16));return e},bytesToBase64:function(t){for(var e=[],n=0;n<t.length;n+=3)for(var i=t[n]<<16|t[n+1]<<8|t[n+2],o=0;o<4;o++)8*n+6*o<=8*t.length?e.push(r.charAt(i>>>6*(3-o)&63)):e.push("=");return e.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/gi,"");for(var e=[],n=0,i=0;n<t.length;i=++n%4)0!=i&&e.push((r.indexOf(t.charAt(n-1))&Math.pow(2,-2*i+8)-1)<<2*i|r.indexOf(t.charAt(n))>>>6-2*i);return e}},t.exports=n},function(t,e){function r(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}
24
+ /*!
25
+ * Determine if an object is a Buffer
26
+ *
27
+ * @author Feross Aboukhadijeh <https://feross.org>
28
+ * @license MIT
29
+ */
30
+ t.exports=function(t){return null!=t&&(r(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&r(t.slice(0,0))}(t)||!!t._isBuffer)}},function(t,e,r){function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}const o=r(70),a=r(459),s=r(80),u=r(234),c=r(460),l=c.utils.amountToInteger;function f(t){switch(t){case"Cash":case"Checking":return"checking";case"CreditCard":return"credit";case"Savings":return"savings";case"InvestmentAccount":return"investment";case"Mortgage":return"mortgage";default:return"other"}}function d(t,e){return[...t].sort((t,r)=>t[e]<r[e]?-1:t[e]>r[e]?1:0)}function h(t){return o.format(function(t){if("string"==typeof t){let e=n(t.split("-"),3),r=e[0],i=e[1],o=e[2];return null!=o?new Date(parseInt(r),parseInt(i)-1,parseInt(o)):null!=i?new Date(parseInt(r),parseInt(i)-1,1):new Date(parseInt(r),0,1)}return t}(t),"yyyy-MM")}function g(t,e){const r=[...e];return t.masterCategories.forEach(t=>{t.subCategories&&t.subCategories.forEach(t=>{r.find(e=>e.categoryId===t.entityId)||r.push({budgeted:0,categoryId:t.entityId})})}),r}async function p(t,e){let r=d(t.monthlyBudgets,"month");h(r[0].month),o.format(new Date,"yyyy-MM");await c.batchBudgetUpdates(async()=>{const n={};for(let i of r){let r=g(t,i.monthlySubCategoryBudgets.filter(t=>!t.isTombstone));await Promise.all(r.map(async t=>{let r=l(t.budgeted),o=e.get(t.categoryId),a=h(i.month);o&&(await c.setBudgetAmount(a,o,r),"AffectsBuffer"===t.overspendingHandling?n[o]=!1:("Confined"===t.overspendingHandling||n[o])&&(n[o]=!0,await c.setBudgetCarryover(a,o,!0)))}))}})}async function m(t){const e=new Map;console.log("Importing Accounts..."),await async function(t,e){return Promise.all(t.accounts.map(async t=>{if(!t.isTombstone){const r=await c.createAccount({type:f(t.accountType),name:t.accountName,offbudget:!t.onBudget,closed:!!t.hidden});e.set(t.entityId,r)}}))}(t,e),console.log("Importing Categories..."),await async function(t,e){const r=d(t.masterCategories,"sortableIndex");await Promise.all(r.map(async t=>{if("OUTFLOW"===t.type&&!t.isTombstone&&t.subCategories&&t.subCategories.some(t=>!t.isTombstone)>0){const r=await c.createCategoryGroup({name:t.name,is_income:!1});if(e.set(t.entityId,r),t.subCategories){const r=d(t.subCategories,"sortableIndex");r.reverse();for(let t of r)if(!t.isTombstone){const r=await c.createCategory({name:t.name,group_id:e.get(t.masterCategoryId)});e.set(t.entityId,r)}}}}))}(t,e),console.log("Importing Payees..."),await async function(t,e){for(let r of t.payees)if(!r.isTombstone){let t=await c.createPayee({name:r.name,category:e.get(r.autoFillCategoryId)||null,transfer_acct:e.get(r.targetAccountId)||null});e.set(r.entityId,t)}}(t,e),console.log("Importing Transactions..."),await async function(t,e){const r=(await c.getCategories()).find(t=>"Income"===t.name).id,n=await c.getAccounts(),i=await c.getPayees();function o(t){return null==t||"Category/__Split__"===t?null:"Category/__ImmediateIncome__"===t||"Category/__DeferredIncome__"===t?r:e.get(t)}function a(t){let e=n.find(e=>e.id===t);if(!e)throw new Error("Could not find account for transaction when importing");return e.offbudget}for(let r of t.transactions)e.set(r.entityId,s.v4());let u=(f=t.transactions,d="accountId",f.reduce((function(t,e){var r=e[d];return t.hasOwnProperty(r)||(t[r]=[]),t[r].push(e),t}),{}));var f,d;await Promise.all(Object.keys(u).map(async t=>{let r=u[t].map(r=>{if(r.isTombstone)return;let n=e.get(r.entityId),s=e.get(r.transferTransactionId)||null,u=null;u=s?i.find(t=>t.transfer_acct===e.get(r.targetAccountId)).id:e.get(r.payeeId);let c={id:n,amount:l(r.amount),category:a(e.get(t))?null:o(r.categoryId),date:r.date,notes:r.memo||null,payee:u,transfer_id:s};return c.subtransactions=r.subTransactions&&r.subTransactions.map((t,e)=>({amount:l(t.amount),category:o(t.categoryId)})),c}).filter(t=>t);await c.addTransactions(e.get(t),r)}))}(t,e),console.log("Importing Budgets..."),await p(t,e),console.log("Setting up...")}function y(t,e){let r=t.filter(t=>t.entryName===e);if(0===r.length)throw new Error("Could not find file: "+e);if(r.length>=2)throw new Error("File name matches multiple files: "+e);return r[0]}function b(...t){return t.slice(1).reduce((t,e)=>t+"/"+e.replace(/^\//,""),t[0].replace(/\/$/,""))}t.exports={importBuffer:async function(t,e){let r=function(t){let e=a(t);if(!/\.zip/.test(e))return null;e=e.replace(/\.zip$/,"").replace(/.ynab4$/,"");let r=e.match(/([^/~]+)[^/]*$/);return r?r[1]:null}(t);if(!r)throw new Error("Not a YNAB4 file: "+t);let i=new u(e),o=i.getEntries(),s="",l=o[0].entryName.match(/([^/]*\.ynab4)/);l&&(s=l[1]+"/");let f=i.readFile(y(o,s+"Budget.ymeta")),h=b(s,JSON.parse(f.toString("utf8")).relativeDataFolderName),g=function(t,e){let r=e.map(e=>{const r=t.readFile(e).toString("utf8");let i;try{i=JSON.parse(r)}catch(t){return null}return i.hasFullKnowledge?{deviceGUID:i.deviceGUID,shortName:i.shortDeviceId,recentness:(o=i.knowledge,o.split(",").reduce((t,e)=>{const r=n(e.split("-"),2),i=(r[0],r[1]);return t+parseInt(i)},0))}:null;var o}).filter(t=>t);return r=d(r,"recentness"),r[r.length-1].deviceGUID}(i,o.filter(t=>t.entryName.startsWith(b(h,"devices"))));const p=b(h,g,"Budget.yfull");let w,_;try{w=i.readFile(y(o,p)).toString("utf8")}catch(t){throw console.log(t),new Error("Error reading Budget.yfull file")}try{_=JSON.parse(w)}catch(t){throw new Error("Error parsing Budget.yull file")}return c.runImport(r,()=>m(_))}}},function(t,e,r){"use strict";t.exports=t=>{const e=/^\\\\\?\\/.test(t),r=/[^\u0000-\u0080]+/.test(t);return e||r?t:t.replace(/\\/g,"/")}},function(t,e,r){const n=r(461),i=n.init,o=n.send,a=n.disconnect,s=n.runWithBudget,u=n.runImport,c=r(468),l=r(469);t.exports={init:i,disconnect:a,runWithBudget:s,runImport:u,utils:l,runQuery:function(t){return o("api/query",{query:t.serialize()})},q:c,loadBudget:async function(t){return o("api/load-budget",{id:t})},batchBudgetUpdates:async function(t){await o("api/batch-budget-start");try{await t()}finally{await o("api/batch-budget-end")}},getBudgetMonths:function(){return o("api/budget-months")},getBudgetMonth:function(t){return o("api/budget-month",{month:t})},setBudgetAmount:function(t,e,r){return o("api/budget-set-amount",{month:t,categoryId:e,amount:r})},setBudgetCarryover:function(t,e,r){return o("api/budget-set-carryover",{month:t,categoryId:e,flag:r})},addTransactions:function(t,e){return o("api/transactions-add",{accountId:t,transactions:e})},importTransactions:function(t,e){return o("api/transactions-import",{accountId:t,transactions:e})},filterTransactions:function(t,e){return o("api/transactions-filter",{accountId:t,text:e})},getTransactions:function(t,e,r){return o("api/transactions-get",{accountId:t,startDate:e,endDate:r})},updateTransaction:function(t,e){return o("api/transaction-update",{id:t,fields:e})},deleteTransaction:function(t){return o("api/transaction-delete",{id:t})},getAccounts:function(){return o("api/accounts-get")},createAccount:function(t,e){return o("api/account-create",{account:t,initialBalance:e})},updateAccount:function(t,e){return o("api/account-update",{id:t,fields:e})},closeAccount:function(t,e,r){return o("api/account-close",{id:t,transferAccountId:e,transferCategoryId:r})},reopenAccount:function(t){return o("api/account-reopen",{id:t})},deleteAccount:function(t){return o("api/account-delete",{id:t})},getCategoryGroups:function(){return o("api/categories-get",{grouped:!0})},createCategoryGroup:function(t){return o("api/category-group-create",{group:t})},updateCategoryGroup:function(t,e){return o("api/category-group-update",{id:t,fields:e})},deleteCategoryGroup:function(t,e){return o("api/category-group-delete",{id:t,transferCategoryId:e})},getCategories:function(){return o("api/categories-get",{grouped:!1})},createCategory:function(t){return o("api/category-create",{category:t})},updateCategory:function(t,e){return o("api/category-update",{id:t,fields:e})},deleteCategory:function(t,e){return o("api/category-delete",{id:t,transferCategoryId:e})},getPayees:function(){return o("api/payees-get")},createPayee:function(t){return o("api/payee-create",{payee:t})},updatePayee:function(t,e){return o("api/payee-update",{id:t,fields:e})},deletePayee:function(t){return o("api/payee-delete",{id:t})},getPayeeRules:function(t){return o("api/payee-rules-get",{payeeId:t})},createPayeeRule:function(t,e){return o("api/payee-rule-create",{payee_id:t,rule:e})},deletePayeeRule:function(t){return o("api/payee-rule-delete",{id:t})},updatePayeeRule:function(t,e){return o("api/payee-rule-update",{id:t,fields:e})}}},function(t,e,r){(function(e){let n=r(259),i=r(80),o=r(467);e.traceProcessWarnings=!0,n.config.silent=!0;let a=null,s=new Map,u=null;function c(t,e){return new Promise((r,n)=>{let o=i.v4();s.set(o,{resolve:r,reject:n}),a&&a.emit("message",JSON.stringify({id:o,name:t,args:e}))}).catch(t=>{if("string"==typeof t&&t.includes("API Error"))throw new Error(t);throw t})}async function l(t){if(u)return u;if(u=o(t),a=await u,!a)throw new Error("Couldn't connect to Actual. Please run the app first.");a.on("message",t=>{const e=JSON.parse(t);if("error"===e.type){const t=e.id;s.delete(t)}else if("reply"===e.type){const t=e.id,r=e.error,n=e.result,i=s.get(t);i&&(s.delete(t),r?i.reject("[API Error] "+r.message):i.resolve(n))}else if("push"!==e.type)throw new Error("Unknown message type: "+JSON.stringify(e))})}function f(){a&&(n.disconnect(a.id),a=null,u=!1)}async function d(t){let e;try{await l(),e=await t()}catch(t){throw c("api/cleanup",{hasError:!0}),f(),t}return c("api/cleanup"),f(),e}e.on("unhandledRejection",(function(t,e){console.log(t)})),t.exports={init:l,send:c,disconnect:f,runWithBudget:async function(t,e){return d(async()=>(await c("api/load-budget",{id:t}),e()))},runImport:async function(t,e){return d(async()=>{await c("api/start-import",{budgetName:t}),await e(),await c("api/finish-import")})}}}).call(this,r(20))},function(t,e,r){"use strict";const n=r(260),i=r(463),o=r(466),a=r(81);function s(...t){if(!this.config.silent){for(let e=0,r=t.length;e<r;e++)"object"==typeof t[e]&&(t[e]=a.inspect(t[e],{depth:this.config.logDepth,colors:this.config.logInColor}));this.config.logger(t.join(" "))}}function u(t){this.of[t]&&(this.of[t].explicitlyDisconnected=!0,this.of[t].off("*","*"),this.of[t].socket&&this.of[t].socket.destroy&&this.of[t].socket.destroy(),delete this.of[t])}function c(t,e){"function"==typeof t&&(e=t,t=!1),t||(this.log("Server path not specified, so defaulting to","ipc.config.socketRoot + ipc.config.appspace + ipc.config.id",this.config.socketRoot+this.config.appspace+this.config.id),t=this.config.socketRoot+this.config.appspace+this.config.id),e||(e=l),this.server=new o(t,this.config,s),this.server.on("start",e)}function l(){}function f(t,e,r,n){"number"==typeof t&&(n=r,r=e,e=t,t=!1),"function"==typeof t&&(n=t,r=!1,t=!1,e=!1),t||(this.log("Server host not specified, so defaulting to","ipc.config.networkHost",this.config.networkHost),t=this.config.networkHost),"udp4"!=t.toLowerCase()&&"udp6"!=t.toLowerCase()||(n=e,r=t.toLowerCase(),e=!1,t=this.config.networkHost),"string"==typeof e&&(n=r,r=e,e=!1),"function"==typeof e&&(n=e,r=!1,e=!1),e||(this.log("Server port not specified, so defaulting to","ipc.config.networkPort",this.config.networkPort),e=this.config.networkPort),"function"==typeof r&&(n=r,r=!1),n||(n=l),this.server=new o(t,this.config,s,e),r&&(this.server[r]=!0,"udp4"===r&&"::1"===t&&(this.server.path="127.0.0.1")),this.server.on("start",n)}function d(t,e,r){if("function"==typeof e&&(r=e,e=!1),r||(r=l),t){if(e||(this.log("Service path not specified, so defaulting to","ipc.config.socketRoot + ipc.config.appspace + id",(this.config.socketRoot+this.config.appspace+t).data),e=this.config.socketRoot+this.config.appspace+t),this.of[t]){if(!this.of[t].socket.destroyed)return this.log("Already Connected to",t,"- So executing success without connection"),void r();this.of[t].socket.destroy()}this.of[t]=new i(this.config,this.log),this.of[t].id=t,this.of[t].path=e,this.of[t].connect(),r(this)}else this.log("Service id required","Requested service connection without specifying service id. Aborting connection attempt")}function h(t,e,r,n){if(t){if("number"==typeof e&&(n=r,r=e,e=!1),"function"==typeof e&&(n=e,e=!1,r=!1),e||(this.log("Server host not specified, so defaulting to","ipc.config.networkHost",this.config.networkHost),e=this.config.networkHost),"function"==typeof r&&(n=r,r=!1),r||(this.log("Server port not specified, so defaulting to","ipc.config.networkPort",this.config.networkPort),r=this.config.networkPort),"string"==typeof n&&(UDPType=n,n=!1),n||(n=l),this.of[t]){if(!this.of[t].socket.destroyed)return this.log("Already Connected to",t,"- So executing success without connection"),void n();this.of[t].socket.destroy()}this.of[t]=new i(this.config,this.log),this.of[t].id=t,this.of[t].path=e,this.of[t].port=r,this.of[t].connect(),n(this)}else this.log("Service id required","Requested service connection without specifying service id. Aborting connection attempt")}t.exports=class{constructor(){Object.defineProperties(this,{config:{enumerable:!0,writable:!0,value:new n},connectTo:{enumerable:!0,writable:!1,value:d},connectToNet:{enumerable:!0,writable:!1,value:h},disconnect:{enumerable:!0,writable:!1,value:u},serve:{enumerable:!0,writable:!1,value:c},serveNet:{enumerable:!0,writable:!1,value:f},of:{enumerable:!0,writable:!0,value:{}},server:{enumerable:!0,writable:!0,configurable:!0,value:!1},log:{enumerable:!0,writable:!1,value:s}})}}},function(t,e,r){"use strict";(function(e,n){const i=r(44),o=r(44),a=r(261),s=r(262),u=r(66),c=r(464);let l=r(104);e.version[1]>4&&(l=r(119));let f=new a;class d extends l{constructor(t,e){super(),Object.assign(this,{Client:d,config:t,queue:new c,socket:!1,connect:p,emit:h,log:e,retriesRemaining:t.maxRetries||0,explicitlyDisconnected:!1}),f=new a(this.config)}}function h(t,e){this.log("dispatching event to ",this.id,this.path," : ",t,",",e);let r=new s;r.type=t,r.data=e,r=this.config.rawBuffer?new n(t,this.config.encoding):f.format(r),this.config.sync?this.queue.add(g.bind(this,r)):this.socket.write(r)}function g(t){this.log("dispatching event to ",this.id,this.path," : ",t),this.socket.write(t)}function p(){let t=this;if(t.log("requested connection to ",t.id,t.path),!this.path)return void t.log("\n\n######\nerror: ",t.id," client has not specified socket path it wishes to connect to.");const r={};if(t.port)if(r.host=t.path,r.port=t.port,t.config.interface.localAddress&&(r.localAddress=t.config.interface.localAddress),t.config.interface.localPort&&(r.localPort=t.config.interface.localPort),t.config.interface.family&&(r.family=t.config.interface.family),t.config.interface.hints&&(r.hints=t.config.interface.hints),t.config.interface.lookup&&(r.lookup=t.config.interface.lookup),t.config.tls){if(t.log("Connecting client via TLS to",t.path,t.port,t.config.tls),t.config.tls.private&&(t.config.tls.key=u.readFileSync(t.config.tls.private)),t.config.tls.public&&(t.config.tls.cert=u.readFileSync(t.config.tls.public)),t.config.tls.trustedConnections){"string"==typeof t.config.tls.trustedConnections&&(t.config.tls.trustedConnections=[t.config.tls.trustedConnections]),t.config.tls.ca=[];for(let e=0;e<t.config.tls.trustedConnections.length;e++)t.config.tls.ca.push(u.readFileSync(t.config.tls.trustedConnections[e]))}Object.assign(t.config.tls,r),t.socket=o.connect(t.config.tls)}else t.log("Connecting client via TCP to",r),t.socket=i.connect(r);else t.log("Connecting client on Unix Socket :",t.path),r.path=t.path,"win32"!==e.platform||t.path.startsWith("\\\\.\\pipe\\")||(r.path=r.path.replace(/^\//,""),r.path=r.path.replace(/\//g,"-"),r.path="\\\\.\\pipe\\"+r.path),t.socket=i.connect(r);t.socket.setEncoding(this.config.encoding),t.socket.on("error",(function(e){t.log("\n\n######\nerror: ",e),t.publish("error",e)})),t.socket.on("connect",(function(){t.publish("connect"),t.retriesRemaining=t.config.maxRetries,t.log("retrying reset")})),t.socket.on("close",(function(){if(t.log("connection closed",t.id,t.path,t.retriesRemaining,"tries remaining of",t.config.maxRetries),t.config.stopRetrying||t.retriesRemaining<1||t.explicitlyDisconnected)return t.publish("disconnect"),t.log(t.config.id,"exceeded connection rety amount of"," or stopRetrying flag set."),t.socket.destroy(),t.publish("destroy"),void(t=void 0);setTimeout(function(){t.retriesRemaining--,t.connect()}.bind(null,t),t.config.retry),t.publish("disconnect")})),t.socket.on("data",(function(e){if(t.log("## received events ##"),t.config.rawBuffer){if(t.publish("data",new n(e,t.config.encoding)),!t.config.sync)return;return void t.queue.next()}if(this.ipcBuffer||(this.ipcBuffer=""),(e=this.ipcBuffer+=e).slice(-1)!=f.delimiter||-1==e.indexOf(f.delimiter))return void t.log("Messages are large, You may want to consider smaller messages.");this.ipcBuffer="";const r=f.parse(e),i=r.length;for(let e=0;e<i;e++){let n=new s;n.load(r[e]),t.log("detected event",n.type,n.data),t.publish(n.type,n.data)}t.config.sync&&t.queue.next()}))}t.exports=d}).call(this,r(20),r(14).Buffer)},function(t,e){t.exports=function(t){Object.defineProperties(this,{add:{enumerable:!0,writable:!1,value:function(){for(var t in arguments)e.push(arguments[t]);r||this.stop||!this.autoRun||this.next()}},next:{enumerable:!0,writable:!1,value:function(){if(r=!0,e.length<1||this.stop)return void(r=!1);e.shift().bind(this)()}},clear:{enumerable:!0,writable:!1,value:function(){return e=[]}},contents:{enumerable:!1,get:function(){return e},set:function(t){return e=t}},autoRun:{enumerable:!0,writable:!0,value:!0},stop:{enumerable:!0,writable:!0,value:!1}});var e=[],r=!1}},function(t,e,r){"use strict";t.exports=class{constructor(t){this._events_={},this.publish=this.trigger=this.emit,this.subscribe=this.on,this.unSubscribe=this.off}on(t,e,r){if(!e)throw new ReferenceError("handler not defined.");return this._events_[t]||(this._events_[t]=[]),r&&(e._once_=r),this._events_[t].push(e),this}once(t,e){return this.on(t,e,!0)}off(t,e){if(!this._events_[t])return this;if(!e)throw new ReferenceError('handler not defined. if you wish to remove all handlers from the event please pass "*" as the handler');if("*"==e)return delete this._events_[t],this;const r=this._events_[t];for(;r.includes(e);)r.splice(r.indexOf(e),1);return r.length<1&&delete this._events_[t],this}emit(t,...e){if(!this._events_[t])return this.emit$(t,...e);const r=this._events_[t],n=[];for(let t of r)t.apply(this,e),t._once_&&n.push(t);for(let e of n)this.off(t,e);return this.emit$(t,...e)}emit$(t,...e){if(!this._events_["*"])return this;const r=this._events_["*"];for(let n of r)n.call(this,t,...e);return this}}},function(t,e,r){"use strict";(function(e,n,i){const o=r(44),a=r(44),s=r(66),u=r(44),c=r(261),l=r(262);let f=r(104);e.version[1]>4&&(f=r(119));let d=new c;function h(t,e,r){this.log("dispatching event to socket"," : ",e,r);let i=new l;if(i.type=e,i.data=r,this.config.rawBuffer?(this.log(this.config.encoding),i=new n(e,this.config.encoding)):i=d.format(i),this.udp4||this.udp6)return t.address&&t.port?void this.server.write(i,t):(this.log("Attempting to emit to a single UDP socket without supplying socket address or port. Redispatching event as broadcast to all connected sockets"),void this.broadcast(e,r));t.write(i)}function g(t,e){this.log("broadcasting event to all known sockets listening to ",this.path," : ",this.port?this.port:"",t,e);let r=new l;if(r.type=t,r.data=e,r=this.config.rawBuffer?new n(t,this.config.encoding):d.format(r),this.udp4||this.udp6)for(let t=1,e=this.sockets.length;t<e;t++)this.server.write(r,this.sockets[t]);else for(let t=0,e=this.sockets.length;t<e;t++)this.sockets[t].write(r)}function p(){for(let t=0,e=this.sockets.length;t<e;t++){let e=this.sockets[t],r=!1;if(!e||!e.readable)return e.id&&(r=e.id),this.log("socket disconnected",r.toString()),e&&e.destroy&&e.destroy(),this.sockets.splice(t,1),void this.publish("socket.disconnected",e,r)}}function m(t,e,r){let i=this.udp4||this.udp6?r:t;if(this.config.rawBuffer)return e=new n(e,this.config.encoding),void this.publish("data",e,i);if(this.ipcBuffer||(this.ipcBuffer=""),(e=this.ipcBuffer+=e).slice(-1)==d.delimiter&&-1!=e.indexOf(d.delimiter))for(this.ipcBuffer="",e=d.parse(e);e.length>0;){let t=new l;t.load(e.shift()),t.data&&t.data.id&&(i.id=t.data.id),this.log("received event of : ",t.type,t.data),this.publish(t.type,t.data,i)}else this.log("Messages are large, You may want to consider smaller messages.")}function y(t){this.publish("close",t)}function b(t){this.sockets.push(t),t.setEncoding&&t.setEncoding(this.config.encoding),this.log("## socket connection to server detected ##"),t.on("close",y.bind(this)),t.on("error",function(t){this.log("server socket error",t),this.publish("error",t)}.bind(this)),t.on("data",m.bind(this,t)),t.on("message",function(e,r){if(!r)return;let i;this.log("Received UDP message from ",r.address,r.port),i=this.config.rawSocket?new n(e,this.config.encoding):e.toString(),t.emit("data",i,r)}.bind(this)),this.publish("connect",t),this.config.rawBuffer}function w(){return this.log("starting server on ",this.path,this.port?":"+this.port:""),this.udp4||this.udp6?(this.server=u.createSocket(this.udp4?"udp4":"udp6"),this.server.write=v.bind(this),this.server.on("listening",function(){b.bind(this)(this.server)}.bind(this))):(this.log("starting TLS server",this.config.tls),this.config.tls?_.bind(this)():this.server=o.createServer(b.bind(this))),this.server.on("error",function(t){this.log("server error",t),this.publish("error",t)}.bind(this)),this.server.maxConnections=this.config.maxConnections,this.port?this.udp4||this.udp6?(this.log("starting server as",this.udp4?"udp4":"udp6"),this.server.bind(this.port,this.path),void this.onStart({address:this.path,port:this.port})):(this.log("starting server as",this.config.tls?"TLS":"TCP"),void this.server.listen(this.port,this.path,this.onStart.bind(this))):(this.log("starting server as","Unix || Windows Socket"),"win32"===e.platform&&(this.path=this.path.replace(/^\//,""),this.path=this.path.replace(/\//g,"-"),this.path="\\\\.\\pipe\\"+this.path),void this.server.listen(this.path,this.onStart.bind(this)))}function _(){if(this.log("starting TLS server",this.config.tls),this.config.tls.private?this.config.tls.key=s.readFileSync(this.config.tls.private):this.config.tls.key=s.readFileSync(i+"/../local-node-ipc-certs/private/server.key"),this.config.tls.public?this.config.tls.cert=s.readFileSync(this.config.tls.public):this.config.tls.cert=s.readFileSync(i+"/../local-node-ipc-certs/server.pub"),this.config.tls.dhparam&&(this.config.tls.dhparam=s.readFileSync(this.config.tls.dhparam)),this.config.tls.trustedConnections){"string"==typeof this.config.tls.trustedConnections&&(this.config.tls.trustedConnections=[this.config.tls.trustedConnections]),this.config.tls.ca=[];for(let t=0;t<this.config.tls.trustedConnections.length;t++)this.config.tls.ca.push(s.readFileSync(this.config.tls.trustedConnections[t]))}this.server=a.createServer(this.config.tls,b.bind(this))}function v(t,e){let r=new n(t,this.config.encoding);this.server.send(r,0,r.length,e.port,e.address,(function(t,e){t&&(this.log("error writing data to socket",t),this.publish("error",(function(t){this.publish("error",t)})))}))}t.exports=class extends f{constructor(t,e,r,n){super(),Object.assign(this,{config:e,path:t,port:n,udp4:!1,udp6:!1,log:r,server:!1,sockets:[],emit:h,broadcast:g}),d=new c(this.config),this.on("close",p.bind(this))}onStart(t){this.trigger("start",t)}stop(){this.server.close()}start(){this.path?this.config.unlink?s.unlink(this.path,w.bind(this)):w.bind(this)():this.log("Socket Server Path not specified, refusing to start")}}}).call(this,r(20),r(14).Buffer,"/")},function(t,e,r){r(44),r(118),r(50).join;const n=r(259);function i(t){return new Promise((e,r)=>{n.connectTo(t,()=>{n.of[t].on("error",()=>{n.disconnect(t),e(!1)}),n.of[t].on("connect",()=>{e(n.of[t])})})})}t.exports=async function(t){if(t)return i(t);let e=1,r=null;for(;!(r=await i("actual"+e));)if(e++,e>=10)return null;return r}},function(t,e){function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function n(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class o{constructor(t){this.state=n({filterExpressions:t.filterExpressions||[],selectExpressions:t.selectExpressions||[],groupExpressions:t.groupExpressions||[],orderExpressions:t.orderExpressions||[],calculation:!1,rawMode:!1,withDead:!1,limit:null,offset:null},t)}filter(t){return new o(n(n({},this.state),{},{filterExpressions:[...this.state.filterExpressions,t]}))}unfilter(t){let e=new Set(t);return new o(n(n({},this.state),{},{filterExpressions:this.state.filterExpressions.filter(t=>!e.has(Object.keys(t)[0]))}))}select(t=[]){Array.isArray(t)||(t=[t]);let e=new o(n(n({},this.state),{},{selectExpressions:t}));return e.state.calculation=!1,e}calculate(t){let e=this.select({result:t});return e.state.calculation=!0,e}groupBy(t){return Array.isArray(t)||(t=[t]),new o(n(n({},this.state),{},{groupExpressions:[...this.state.groupExpressions,...t]}))}orderBy(t){return Array.isArray(t)||(t=[t]),new o(n(n({},this.state),{},{orderExpressions:[...this.state.orderExpressions,...t]}))}limit(t){return new o(n(n({},this.state),{},{limit:t}))}offset(t){return new o(n(n({},this.state),{},{offset:t}))}raw(){return new o(n(n({},this.state),{},{rawMode:!0}))}withDead(){return new o(n(n({},this.state),{},{withDead:!0}))}options(t){return new o(n(n({},this.state),{},{tableOptions:t}))}serialize(){return this.state}}t.exports=function(t){return new o({table:t})}},function(t,e){t.exports={amountToInteger:function(t){return 0|Math.round(100*t)},integerToAmount:function(t){return parseFloat((t/100).toFixed(2))}}},function(t,e,r){r(70);const n=r(80),i=r(471);function o(t){return Math.round(t/10)}function a(t){let e=t.split("-");return e[0]+"-"+e[1]}function s(t){switch(t){case"cash":case"checking":return"checking";case"creditCard":case"lineOfCredit":return"credit";case"savings":return"savings";case"investmentAccount":return"investment";case"mortgage":return"mortgage";default:return"other"}}function u(t,e){return t.reduce((function(t,r){var n=r[e];return t.hasOwnProperty(n)||(t[n]=[]),t[n].push(r),t}),{})}async function c(t){const e=new Map;console.log("Importing Accounts..."),await function(t,e){return Promise.all(t.accounts.map(async t=>{if(!t.deleted){let r=await i.createAccount({type:s(t.type),name:t.name,offbudget:!t.on_budget,closed:t.closed});e.set(t.id,r)}}))}(t,e),console.log("Importing Categories..."),await async function(t,e){const r=(await i.getCategories()).find(t=>"Income"===t.name).id,n=["To be Budgeted","Inflow: Ready to Assign"];function o(e){return e.category_group_id===t.category_groups.find(t=>"Internal Master Category"===t.name).id?n.includes(e.name)?"income":"internal":e.category_group_id===t.category_groups.find(t=>"Credit Card Payments"===t.name).id?"creditCard":void 0}for(let n of t.category_groups)if(!n.deleted){if("Internal Master Category"!==n.name&&"Credit Card Payments"!==n.name){var a=await i.createCategoryGroup({name:n.name,is_income:!1});e.set(n.id,a)}let s=t.categories.filter(t=>t.category_group_id===n.id);for(let t of s.reverse())if(!t.deleted){let n={};switch(n.name=t.name,o(t)){case"income":{let n=r;e.set(t.id,n);break}case"creditCard":case"internal":break;default:{n.group_id=a;let r=await i.createCategory(n);e.set(t.id,r);break}}}}}(t,e),console.log("Importing Payees..."),await function(t,e){return Promise.all(t.payees.map(async t=>{if(!t.deleted){let r=await i.createPayee({name:t.name});e.set(t.id,r)}}))}(t,e),console.log("Importing Transactions..."),await async function(t,e){const r=await i.getPayees(),a=await i.getCategories(),s=a.find(t=>"Income"===t.name).id,c=a.find(t=>"Starting Balances"===t.name).id,l=t.payees.find(t=>"Starting Balance"===t.name).id;let f=u(t.transactions,"account_id"),d=u(t.subtransactions,"transaction_id");for(let r of t.transactions)e.set(r.id,n.v4());await Promise.all(Object.keys(f).map(async t=>{let n=f[t].map(t=>{if(t.deleted)return null;let n=d[t.id];n&&(n=n.map(t=>({amount:o(t.amount),category:e.get(t.category_id)||null,notes:t.memo})));let i={id:e.get(t.id),account:e.get(t.account_id),date:t.date,amount:o(t.amount),category:e.get(t.category_id)||null,cleared:["cleared","reconciled"].includes(t.cleared),notes:t.memo||null,imported_id:t.import_id||null,transfer_id:e.get(t.transfer_transaction_id)||null,subtransactions:n};return t.transfer_account_id?i.payee=r.find(r=>r.transfer_acct===e.get(t.transfer_account_id)).id:i.payee=e.get(t.payee_id),t.payee_id===l&&e.get(t.category_id)===s&&(i.category=c,i.payee=null),i}).filter(t=>t);await i.addTransactions(e.get(t),n)}))}(t,e),console.log("Importing Budgets..."),await async function(t,e){let r=(n=t.months,o="month",[...n].sort((t,e)=>t[o]<e[o]?-1:t[o]>e[o]?1:0));var n,o;const s=t.category_groups.find(t=>"Internal Master Category"===t.name).id,u=t.category_groups.find(t=>"Credit Card Payments"===t.name).id;await i.batchBudgetUpdates(async()=>{for(let t of r){let r=a(t.month);await Promise.all(t.categories.map(async t=>{let n=e.get(t.id),o=t.budgeted/10;n&&t.category_group_id!==s&&t.category_group_id!==u&&await i.setBudgetAmount(r,n,o)}))}})}(t,e),console.log("Setting up...")}t.exports={importYNAB5:async function(t){return t.data&&(t=t.data),i.runImport(t.budget.name,()=>c(t.budget))}}},function(t,e,r){const n=r(472),i=n.init,o=n.send,a=n.disconnect,s=n.runWithBudget,u=n.runImport,c=r(478),l=r(479);t.exports={init:i,disconnect:a,runWithBudget:s,runImport:u,utils:l,runQuery:function(t){return o("api/query",{query:t.serialize()})},q:c,loadBudget:async function(t){return o("api/load-budget",{id:t})},batchBudgetUpdates:async function(t){await o("api/batch-budget-start");try{await t()}finally{await o("api/batch-budget-end")}},getBudgetMonths:function(){return o("api/budget-months")},getBudgetMonth:function(t){return o("api/budget-month",{month:t})},setBudgetAmount:function(t,e,r){return o("api/budget-set-amount",{month:t,categoryId:e,amount:r})},setBudgetCarryover:function(t,e,r){return o("api/budget-set-carryover",{month:t,categoryId:e,flag:r})},addTransactions:function(t,e){return o("api/transactions-add",{accountId:t,transactions:e})},importTransactions:function(t,e){return o("api/transactions-import",{accountId:t,transactions:e})},filterTransactions:function(t,e){return o("api/transactions-filter",{accountId:t,text:e})},getTransactions:function(t,e,r){return o("api/transactions-get",{accountId:t,startDate:e,endDate:r})},updateTransaction:function(t,e){return o("api/transaction-update",{id:t,fields:e})},deleteTransaction:function(t){return o("api/transaction-delete",{id:t})},getAccounts:function(){return o("api/accounts-get")},createAccount:function(t,e){return o("api/account-create",{account:t,initialBalance:e})},updateAccount:function(t,e){return o("api/account-update",{id:t,fields:e})},closeAccount:function(t,e,r){return o("api/account-close",{id:t,transferAccountId:e,transferCategoryId:r})},reopenAccount:function(t){return o("api/account-reopen",{id:t})},deleteAccount:function(t){return o("api/account-delete",{id:t})},getCategoryGroups:function(){return o("api/categories-get",{grouped:!0})},createCategoryGroup:function(t){return o("api/category-group-create",{group:t})},updateCategoryGroup:function(t,e){return o("api/category-group-update",{id:t,fields:e})},deleteCategoryGroup:function(t,e){return o("api/category-group-delete",{id:t,transferCategoryId:e})},getCategories:function(){return o("api/categories-get",{grouped:!1})},createCategory:function(t){return o("api/category-create",{category:t})},updateCategory:function(t,e){return o("api/category-update",{id:t,fields:e})},deleteCategory:function(t,e){return o("api/category-delete",{id:t,transferCategoryId:e})},getPayees:function(){return o("api/payees-get")},createPayee:function(t){return o("api/payee-create",{payee:t})},updatePayee:function(t,e){return o("api/payee-update",{id:t,fields:e})},deletePayee:function(t){return o("api/payee-delete",{id:t})},getPayeeRules:function(t){return o("api/payee-rules-get",{payeeId:t})},createPayeeRule:function(t,e){return o("api/payee-rule-create",{payee_id:t,rule:e})},deletePayeeRule:function(t){return o("api/payee-rule-delete",{id:t})},updatePayeeRule:function(t,e){return o("api/payee-rule-update",{id:t,fields:e})}}},function(t,e,r){(function(e){let n=r(263),i=r(80),o=r(477);e.traceProcessWarnings=!0,n.config.silent=!0;let a=null,s=new Map,u=null;function c(t,e){return new Promise((r,n)=>{let o=i.v4();s.set(o,{resolve:r,reject:n}),a&&a.emit("message",JSON.stringify({id:o,name:t,args:e}))}).catch(t=>{if("string"==typeof t&&t.includes("API Error"))throw new Error(t);throw t})}async function l(t){if(u)return u;if(u=o(t),a=await u,!a)throw new Error("Couldn't connect to Actual. Please run the app first.");a.on("message",t=>{const e=JSON.parse(t);if("error"===e.type){const t=e.id;s.delete(t)}else if("reply"===e.type){const t=e.id,r=e.error,n=e.result,i=s.get(t);i&&(s.delete(t),r?i.reject("[API Error] "+r.message):i.resolve(n))}else if("push"!==e.type)throw new Error("Unknown message type: "+JSON.stringify(e))})}function f(){a&&(n.disconnect(a.id),a=null,u=!1)}async function d(t){let e;try{await l(),e=await t()}catch(t){throw c("api/cleanup",{hasError:!0}),f(),t}return c("api/cleanup"),f(),e}e.on("unhandledRejection",(function(t,e){console.log(t)})),t.exports={init:l,send:c,disconnect:f,runWithBudget:async function(t,e){return d(async()=>(await c("api/load-budget",{id:t}),e()))},runImport:async function(t,e){return d(async()=>{await c("api/start-import",{budgetName:t}),await e(),await c("api/finish-import")})}}}).call(this,r(20))},function(t,e,r){"use strict";const n=r(264),i=r(474),o=r(476),a=r(81);function s(...t){if(!this.config.silent){for(let e=0,r=t.length;e<r;e++)"object"==typeof t[e]&&(t[e]=a.inspect(t[e],{depth:this.config.logDepth,colors:this.config.logInColor}));this.config.logger(t.join(" "))}}function u(t){this.of[t]&&(this.of[t].explicitlyDisconnected=!0,this.of[t].off("*","*"),this.of[t].socket&&this.of[t].socket.destroy&&this.of[t].socket.destroy(),delete this.of[t])}function c(t,e){"function"==typeof t&&(e=t,t=!1),t||(this.log("Server path not specified, so defaulting to","ipc.config.socketRoot + ipc.config.appspace + ipc.config.id",this.config.socketRoot+this.config.appspace+this.config.id),t=this.config.socketRoot+this.config.appspace+this.config.id),e||(e=l),this.server=new o(t,this.config,s),this.server.on("start",e)}function l(){}function f(t,e,r,n){"number"==typeof t&&(n=r,r=e,e=t,t=!1),"function"==typeof t&&(n=t,r=!1,t=!1,e=!1),t||(this.log("Server host not specified, so defaulting to","ipc.config.networkHost",this.config.networkHost),t=this.config.networkHost),"udp4"!=t.toLowerCase()&&"udp6"!=t.toLowerCase()||(n=e,r=t.toLowerCase(),e=!1,t=this.config.networkHost),"string"==typeof e&&(n=r,r=e,e=!1),"function"==typeof e&&(n=e,r=!1,e=!1),e||(this.log("Server port not specified, so defaulting to","ipc.config.networkPort",this.config.networkPort),e=this.config.networkPort),"function"==typeof r&&(n=r,r=!1),n||(n=l),this.server=new o(t,this.config,s,e),r&&(this.server[r]=!0,"udp4"===r&&"::1"===t&&(this.server.path="127.0.0.1")),this.server.on("start",n)}function d(t,e,r){if("function"==typeof e&&(r=e,e=!1),r||(r=l),t){if(e||(this.log("Service path not specified, so defaulting to","ipc.config.socketRoot + ipc.config.appspace + id",(this.config.socketRoot+this.config.appspace+t).data),e=this.config.socketRoot+this.config.appspace+t),this.of[t]){if(!this.of[t].socket.destroyed)return this.log("Already Connected to",t,"- So executing success without connection"),void r();this.of[t].socket.destroy()}this.of[t]=new i(this.config,this.log),this.of[t].id=t,this.of[t].path=e,this.of[t].connect(),r(this)}else this.log("Service id required","Requested service connection without specifying service id. Aborting connection attempt")}function h(t,e,r,n){if(t){if("number"==typeof e&&(n=r,r=e,e=!1),"function"==typeof e&&(n=e,e=!1,r=!1),e||(this.log("Server host not specified, so defaulting to","ipc.config.networkHost",this.config.networkHost),e=this.config.networkHost),"function"==typeof r&&(n=r,r=!1),r||(this.log("Server port not specified, so defaulting to","ipc.config.networkPort",this.config.networkPort),r=this.config.networkPort),"string"==typeof n&&(UDPType=n,n=!1),n||(n=l),this.of[t]){if(!this.of[t].socket.destroyed)return this.log("Already Connected to",t,"- So executing success without connection"),void n();this.of[t].socket.destroy()}this.of[t]=new i(this.config,this.log),this.of[t].id=t,this.of[t].path=e,this.of[t].port=r,this.of[t].connect(),n(this)}else this.log("Service id required","Requested service connection without specifying service id. Aborting connection attempt")}t.exports=class{constructor(){Object.defineProperties(this,{config:{enumerable:!0,writable:!0,value:new n},connectTo:{enumerable:!0,writable:!1,value:d},connectToNet:{enumerable:!0,writable:!1,value:h},disconnect:{enumerable:!0,writable:!1,value:u},serve:{enumerable:!0,writable:!1,value:c},serveNet:{enumerable:!0,writable:!1,value:f},of:{enumerable:!0,writable:!0,value:{}},server:{enumerable:!0,writable:!0,configurable:!0,value:!1},log:{enumerable:!0,writable:!1,value:s}})}}},function(t,e,r){"use strict";(function(e,n){const i=r(44),o=r(44),a=r(265),s=r(266),u=r(66),c=r(475);let l=r(104);e.version[1]>4&&(l=r(119));let f=new a;class d extends l{constructor(t,e){super(),Object.assign(this,{Client:d,config:t,queue:new c,socket:!1,connect:p,emit:h,log:e,retriesRemaining:t.maxRetries||0,explicitlyDisconnected:!1}),f=new a(this.config)}}function h(t,e){this.log("dispatching event to ",this.id,this.path," : ",t,",",e);let r=new s;r.type=t,r.data=e,r=this.config.rawBuffer?new n(t,this.config.encoding):f.format(r),this.config.sync?this.queue.add(g.bind(this,r)):this.socket.write(r)}function g(t){this.log("dispatching event to ",this.id,this.path," : ",t),this.socket.write(t)}function p(){let t=this;if(t.log("requested connection to ",t.id,t.path),!this.path)return void t.log("\n\n######\nerror: ",t.id," client has not specified socket path it wishes to connect to.");const r={};if(t.port)if(r.host=t.path,r.port=t.port,t.config.interface.localAddress&&(r.localAddress=t.config.interface.localAddress),t.config.interface.localPort&&(r.localPort=t.config.interface.localPort),t.config.interface.family&&(r.family=t.config.interface.family),t.config.interface.hints&&(r.hints=t.config.interface.hints),t.config.interface.lookup&&(r.lookup=t.config.interface.lookup),t.config.tls){if(t.log("Connecting client via TLS to",t.path,t.port,t.config.tls),t.config.tls.private&&(t.config.tls.key=u.readFileSync(t.config.tls.private)),t.config.tls.public&&(t.config.tls.cert=u.readFileSync(t.config.tls.public)),t.config.tls.trustedConnections){"string"==typeof t.config.tls.trustedConnections&&(t.config.tls.trustedConnections=[t.config.tls.trustedConnections]),t.config.tls.ca=[];for(let e=0;e<t.config.tls.trustedConnections.length;e++)t.config.tls.ca.push(u.readFileSync(t.config.tls.trustedConnections[e]))}Object.assign(t.config.tls,r),t.socket=o.connect(t.config.tls)}else t.log("Connecting client via TCP to",r),t.socket=i.connect(r);else t.log("Connecting client on Unix Socket :",t.path),r.path=t.path,"win32"!==e.platform||t.path.startsWith("\\\\.\\pipe\\")||(r.path=r.path.replace(/^\//,""),r.path=r.path.replace(/\//g,"-"),r.path="\\\\.\\pipe\\"+r.path),t.socket=i.connect(r);t.socket.setEncoding(this.config.encoding),t.socket.on("error",(function(e){t.log("\n\n######\nerror: ",e),t.publish("error",e)})),t.socket.on("connect",(function(){t.publish("connect"),t.retriesRemaining=t.config.maxRetries,t.log("retrying reset")})),t.socket.on("close",(function(){if(t.log("connection closed",t.id,t.path,t.retriesRemaining,"tries remaining of",t.config.maxRetries),t.config.stopRetrying||t.retriesRemaining<1||t.explicitlyDisconnected)return t.publish("disconnect"),t.log(t.config.id,"exceeded connection rety amount of"," or stopRetrying flag set."),t.socket.destroy(),t.publish("destroy"),void(t=void 0);setTimeout(function(){t.retriesRemaining--,t.connect()}.bind(null,t),t.config.retry),t.publish("disconnect")})),t.socket.on("data",(function(e){if(t.log("## received events ##"),t.config.rawBuffer){if(t.publish("data",new n(e,t.config.encoding)),!t.config.sync)return;return void t.queue.next()}if(this.ipcBuffer||(this.ipcBuffer=""),(e=this.ipcBuffer+=e).slice(-1)!=f.delimiter||-1==e.indexOf(f.delimiter))return void t.log("Messages are large, You may want to consider smaller messages.");this.ipcBuffer="";const r=f.parse(e),i=r.length;for(let e=0;e<i;e++){let n=new s;n.load(r[e]),t.log("detected event",n.type,n.data),t.publish(n.type,n.data)}t.config.sync&&t.queue.next()}))}t.exports=d}).call(this,r(20),r(14).Buffer)},function(t,e){t.exports=function(t){Object.defineProperties(this,{add:{enumerable:!0,writable:!1,value:function(){for(var t in arguments)e.push(arguments[t]);r||this.stop||!this.autoRun||this.next()}},next:{enumerable:!0,writable:!1,value:function(){if(r=!0,e.length<1||this.stop)return void(r=!1);e.shift().bind(this)()}},clear:{enumerable:!0,writable:!1,value:function(){return e=[]}},contents:{enumerable:!1,get:function(){return e},set:function(t){return e=t}},autoRun:{enumerable:!0,writable:!0,value:!0},stop:{enumerable:!0,writable:!0,value:!1}});var e=[],r=!1}},function(t,e,r){"use strict";(function(e,n,i){const o=r(44),a=r(44),s=r(66),u=r(44),c=r(265),l=r(266);let f=r(104);e.version[1]>4&&(f=r(119));let d=new c;function h(t,e,r){this.log("dispatching event to socket"," : ",e,r);let i=new l;if(i.type=e,i.data=r,this.config.rawBuffer?(this.log(this.config.encoding),i=new n(e,this.config.encoding)):i=d.format(i),this.udp4||this.udp6)return t.address&&t.port?void this.server.write(i,t):(this.log("Attempting to emit to a single UDP socket without supplying socket address or port. Redispatching event as broadcast to all connected sockets"),void this.broadcast(e,r));t.write(i)}function g(t,e){this.log("broadcasting event to all known sockets listening to ",this.path," : ",this.port?this.port:"",t,e);let r=new l;if(r.type=t,r.data=e,r=this.config.rawBuffer?new n(t,this.config.encoding):d.format(r),this.udp4||this.udp6)for(let t=1,e=this.sockets.length;t<e;t++)this.server.write(r,this.sockets[t]);else for(let t=0,e=this.sockets.length;t<e;t++)this.sockets[t].write(r)}function p(){for(let t=0,e=this.sockets.length;t<e;t++){let e=this.sockets[t],r=!1;if(!e||!e.readable)return e.id&&(r=e.id),this.log("socket disconnected",r.toString()),e&&e.destroy&&e.destroy(),this.sockets.splice(t,1),void this.publish("socket.disconnected",e,r)}}function m(t,e,r){let i=this.udp4||this.udp6?r:t;if(this.config.rawBuffer)return e=new n(e,this.config.encoding),void this.publish("data",e,i);if(this.ipcBuffer||(this.ipcBuffer=""),(e=this.ipcBuffer+=e).slice(-1)==d.delimiter&&-1!=e.indexOf(d.delimiter))for(this.ipcBuffer="",e=d.parse(e);e.length>0;){let t=new l;t.load(e.shift()),t.data&&t.data.id&&(i.id=t.data.id),this.log("received event of : ",t.type,t.data),this.publish(t.type,t.data,i)}else this.log("Messages are large, You may want to consider smaller messages.")}function y(t){this.publish("close",t)}function b(t){this.sockets.push(t),t.setEncoding&&t.setEncoding(this.config.encoding),this.log("## socket connection to server detected ##"),t.on("close",y.bind(this)),t.on("error",function(t){this.log("server socket error",t),this.publish("error",t)}.bind(this)),t.on("data",m.bind(this,t)),t.on("message",function(e,r){if(!r)return;let i;this.log("Received UDP message from ",r.address,r.port),i=this.config.rawSocket?new n(e,this.config.encoding):e.toString(),t.emit("data",i,r)}.bind(this)),this.publish("connect",t),this.config.rawBuffer}function w(){return this.log("starting server on ",this.path,this.port?":"+this.port:""),this.udp4||this.udp6?(this.server=u.createSocket(this.udp4?"udp4":"udp6"),this.server.write=v.bind(this),this.server.on("listening",function(){b.bind(this)(this.server)}.bind(this))):(this.log("starting TLS server",this.config.tls),this.config.tls?_.bind(this)():this.server=o.createServer(b.bind(this))),this.server.on("error",function(t){this.log("server error",t),this.publish("error",t)}.bind(this)),this.server.maxConnections=this.config.maxConnections,this.port?this.udp4||this.udp6?(this.log("starting server as",this.udp4?"udp4":"udp6"),this.server.bind(this.port,this.path),void this.onStart({address:this.path,port:this.port})):(this.log("starting server as",this.config.tls?"TLS":"TCP"),void this.server.listen(this.port,this.path,this.onStart.bind(this))):(this.log("starting server as","Unix || Windows Socket"),"win32"===e.platform&&(this.path=this.path.replace(/^\//,""),this.path=this.path.replace(/\//g,"-"),this.path="\\\\.\\pipe\\"+this.path),void this.server.listen(this.path,this.onStart.bind(this)))}function _(){if(this.log("starting TLS server",this.config.tls),this.config.tls.private?this.config.tls.key=s.readFileSync(this.config.tls.private):this.config.tls.key=s.readFileSync(i+"/../local-node-ipc-certs/private/server.key"),this.config.tls.public?this.config.tls.cert=s.readFileSync(this.config.tls.public):this.config.tls.cert=s.readFileSync(i+"/../local-node-ipc-certs/server.pub"),this.config.tls.dhparam&&(this.config.tls.dhparam=s.readFileSync(this.config.tls.dhparam)),this.config.tls.trustedConnections){"string"==typeof this.config.tls.trustedConnections&&(this.config.tls.trustedConnections=[this.config.tls.trustedConnections]),this.config.tls.ca=[];for(let t=0;t<this.config.tls.trustedConnections.length;t++)this.config.tls.ca.push(s.readFileSync(this.config.tls.trustedConnections[t]))}this.server=a.createServer(this.config.tls,b.bind(this))}function v(t,e){let r=new n(t,this.config.encoding);this.server.send(r,0,r.length,e.port,e.address,(function(t,e){t&&(this.log("error writing data to socket",t),this.publish("error",(function(t){this.publish("error",t)})))}))}t.exports=class extends f{constructor(t,e,r,n){super(),Object.assign(this,{config:e,path:t,port:n,udp4:!1,udp6:!1,log:r,server:!1,sockets:[],emit:h,broadcast:g}),d=new c(this.config),this.on("close",p.bind(this))}onStart(t){this.trigger("start",t)}stop(){this.server.close()}start(){this.path?this.config.unlink?s.unlink(this.path,w.bind(this)):w.bind(this)():this.log("Socket Server Path not specified, refusing to start")}}}).call(this,r(20),r(14).Buffer,"/")},function(t,e,r){r(44),r(118),r(50).join;const n=r(263);function i(t){return new Promise((e,r)=>{n.connectTo(t,()=>{n.of[t].on("error",()=>{n.disconnect(t),e(!1)}),n.of[t].on("connect",()=>{e(n.of[t])})})})}t.exports=async function(t){if(t)return i(t);let e=1,r=null;for(;!(r=await i("actual"+e));)if(e++,e>=10)return null;return r}},function(t,e){function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function n(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class o{constructor(t){this.state=n({filterExpressions:t.filterExpressions||[],selectExpressions:t.selectExpressions||[],groupExpressions:t.groupExpressions||[],orderExpressions:t.orderExpressions||[],calculation:!1,rawMode:!1,withDead:!1,limit:null,offset:null},t)}filter(t){return new o(n(n({},this.state),{},{filterExpressions:[...this.state.filterExpressions,t]}))}unfilter(t){let e=new Set(t);return new o(n(n({},this.state),{},{filterExpressions:this.state.filterExpressions.filter(t=>!e.has(Object.keys(t)[0]))}))}select(t=[]){Array.isArray(t)||(t=[t]);let e=new o(n(n({},this.state),{},{selectExpressions:t}));return e.state.calculation=!1,e}calculate(t){let e=this.select({result:t});return e.state.calculation=!0,e}groupBy(t){return Array.isArray(t)||(t=[t]),new o(n(n({},this.state),{},{groupExpressions:[...this.state.groupExpressions,...t]}))}orderBy(t){return Array.isArray(t)||(t=[t]),new o(n(n({},this.state),{},{orderExpressions:[...this.state.orderExpressions,...t]}))}limit(t){return new o(n(n({},this.state),{},{limit:t}))}offset(t){return new o(n(n({},this.state),{},{offset:t}))}raw(){return new o(n(n({},this.state),{},{rawMode:!0}))}withDead(){return new o(n(n({},this.state),{},{withDead:!0}))}options(t){return new o(n(n({},this.state),{},{tableOptions:t}))}serialize(){return this.state}}t.exports=function(t){return new o({table:t})}},function(t,e){t.exports={amountToInteger:function(t){return 0|Math.round(100*t)},integerToAmount:function(t){return parseFloat((t/100).toFixed(2))}}}]);
31
+ //# sourceMappingURL=kcab.worker.f4a8ab06d7e2c88f7f6e.js.map