@actual-app/web 23.10.0 → 23.11.0
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.
- package/build/asset-manifest.json +15 -15
- package/build/index.html +1 -1
- package/build/kcab/{kcab.worker.b835d2cdcf8004c363da.js → kcab.worker.8a181a0b032adc34600e.js} +54 -54
- package/build/kcab/{kcab.worker.b835d2cdcf8004c363da.js.map → kcab.worker.8a181a0b032adc34600e.js.map} +1 -1
- package/build/static/js/312.9f087b98.chunk.js +2 -0
- package/build/static/js/312.9f087b98.chunk.js.map +1 -0
- package/build/static/js/{713.1731d555.chunk.js → 444.301f7ece.chunk.js} +2 -2
- package/build/static/js/444.301f7ece.chunk.js.map +1 -0
- package/build/static/js/848.aa73d5a0.chunk.js +19 -0
- package/build/static/js/848.aa73d5a0.chunk.js.map +1 -0
- package/build/static/js/main.fd0bdfe2.js +188 -0
- package/build/static/js/main.fd0bdfe2.js.map +1 -0
- package/build/static/js/narrow-components.9ae206be.chunk.js +2 -0
- package/build/static/js/narrow-components.9ae206be.chunk.js.map +1 -0
- package/build/static/js/reports.778a42ee.chunk.js +2 -0
- package/build/static/js/reports.778a42ee.chunk.js.map +1 -0
- package/build/static/js/wide-components.481c39ec.chunk.js +2 -0
- package/build/static/js/wide-components.481c39ec.chunk.js.map +1 -0
- package/package.json +3 -2
- package/build/static/js/389.c8f94185.chunk.js +0 -2
- package/build/static/js/389.c8f94185.chunk.js.map +0 -1
- package/build/static/js/678.bf349f5d.chunk.js +0 -2
- package/build/static/js/678.bf349f5d.chunk.js.map +0 -1
- package/build/static/js/713.1731d555.chunk.js.map +0 -1
- package/build/static/js/main.7e6eedd0.js +0 -188
- package/build/static/js/main.7e6eedd0.js.map +0 -1
- package/build/static/js/narrow-components.11cf3591.chunk.js +0 -2
- package/build/static/js/narrow-components.11cf3591.chunk.js.map +0 -1
- package/build/static/js/reports.39b7254a.chunk.js +0 -2
- package/build/static/js/reports.39b7254a.chunk.js.map +0 -1
- package/build/static/js/wide-components.fd8595f4.chunk.js +0 -2
- package/build/static/js/wide-components.fd8595f4.chunk.js.map +0 -1
package/build/kcab/{kcab.worker.b835d2cdcf8004c363da.js → kcab.worker.8a181a0b032adc34600e.js}
RENAMED
|
@@ -13,22 +13,22 @@ var backend;(()=>{var __webpack_modules__={9298:($,ee,et)=>{var en="/";$=et.nmd(
|
|
|
13
13
|
*
|
|
14
14
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
15
15
|
* @license MIT
|
|
16
|
-
*/$.exports=function($){return $!=null&&(ee($)||et($)||!!$._isBuffer)};function ee($){return!!$.constructor&&typeof $.constructor.isBuffer==="function"&&$.constructor.isBuffer($)}function et($){return typeof $.readFloatLE==="function"&&typeof $.slice==="function"&&ee($.slice(0,0))}},832:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});var en=et(5561);var ei=et(9568);var eo=en.constants.S_IFMT,es=en.constants.S_IFDIR,eu=en.constants.S_IFREG,el=en.constants.S_IFBLK,ef=en.constants.S_IFCHR,ed=en.constants.S_IFLNK,ep=en.constants.S_IFIFO,eh=en.constants.S_IFSOCK;var ey=function(){function $(){this.name="";this.mode=0}$.build=function(ee,et){var en=new $;var eo=ee.getNode().mode;en.name=ei.strToEncoding(ee.getName(),et);en.mode=eo;return en};$.prototype._checkModeProperty=function($){return(this.mode&eo)===$};$.prototype.isDirectory=function(){return this._checkModeProperty(es)};$.prototype.isFile=function(){return this._checkModeProperty(eu)};$.prototype.isBlockDevice=function(){return this._checkModeProperty(el)};$.prototype.isCharacterDevice=function(){return this._checkModeProperty(ef)};$.prototype.isSymbolicLink=function(){return this._checkModeProperty(ed)};$.prototype.isFIFO=function(){return this._checkModeProperty(ep)};$.prototype.isSocket=function(){return this._checkModeProperty(eh)};return $}();ee.Dirent=ey;ee["default"]=ey},1507:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});var en=et(5561);var ei=et(3103);var eo=en.constants.S_IFMT,es=en.constants.S_IFDIR,eu=en.constants.S_IFREG,el=en.constants.S_IFBLK,ef=en.constants.S_IFCHR,ed=en.constants.S_IFLNK,ep=en.constants.S_IFIFO,eh=en.constants.S_IFSOCK;var ey=function(){function $(){}$.build=function(ee,et){if(et===void 0){et=false}var en=new $;var eo=ee.uid,es=ee.gid,eu=ee.atime,el=ee.mtime,ef=ee.ctime;var ed=!et?function($){return $}:ei.default;en.uid=ed(eo);en.gid=ed(es);en.rdev=ed(0);en.blksize=ed(4096);en.ino=ed(ee.ino);en.size=ed(ee.getSize());en.blocks=ed(1);en.atime=eu;en.mtime=el;en.ctime=ef;en.birthtime=ef;en.atimeMs=ed(eu.getTime());en.mtimeMs=ed(el.getTime());var ep=ed(ef.getTime());en.ctimeMs=ep;en.birthtimeMs=ep;en.dev=ed(0);en.mode=ed(ee.mode);en.nlink=ed(ee.nlink);return en};$.prototype._checkModeProperty=function($){return(Number(this.mode)&eo)===$};$.prototype.isDirectory=function(){return this._checkModeProperty(es)};$.prototype.isFile=function(){return this._checkModeProperty(eu)};$.prototype.isBlockDevice=function(){return this._checkModeProperty(el)};$.prototype.isCharacterDevice=function(){return this._checkModeProperty(ef)};$.prototype.isSymbolicLink=function(){return this._checkModeProperty(ed)};$.prototype.isFIFO=function(){return this._checkModeProperty(ep)};$.prototype.isSocket=function(){return this._checkModeProperty(eh)};return $}();ee.Stats=ey;ee["default"]=ey},5561:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee.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}},9568:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});var en=et(6426);var ei=et(6978);ee.ENCODING_UTF8="utf8";function eo($){if($&&!en.Buffer.isEncoding($))throw new ei.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",$)}ee.assertEncoding=eo;function es($,et){if(!et||et===ee.ENCODING_UTF8)return $;if(et==="buffer")return new en.Buffer($);return new en.Buffer($).toString(et)}ee.strToEncoding=es},3103:($,ee)=>{if(typeof BigInt==="function")ee["default"]=BigInt;else ee["default"]=function $(){throw new Error("BigInt is not supported in this environment.")}},6551:function($,ee,et){"use strict";var en=this&&this.__assign||function(){en=Object.assign||function($){for(var ee,et=1,en=arguments.length;et<en;et++){ee=arguments[et];for(var ei in ee)if(Object.prototype.hasOwnProperty.call(ee,ei))$[ei]=ee[ei]}return $};return en.apply(this,arguments)};Object.defineProperty(ee,"__esModule",{value:true});var ei=et(1507);var eo=et(832);var es=et(6898);var eu=et(4657),el=eu.fsSyncMethods,ef=eu.fsAsyncMethods;var ed=et(5561);var ep=ed.constants.F_OK,eh=ed.constants.R_OK,ey=ed.constants.W_OK,eg=ed.constants.X_OK;ee.Volume=es.Volume;ee.vol=new es.Volume;function em($){var ee={F_OK:ep,R_OK:eh,W_OK:ey,X_OK:eg,constants:ed.constants,Stats:ei.default,Dirent:eo.default};for(var et=0,en=el;et<en.length;et++){var eu=en[et];if(typeof $[eu]==="function")ee[eu]=$[eu].bind($)}for(var em=0,e_=ef;em<e_.length;em++){var eu=e_[em];if(typeof $[eu]==="function")ee[eu]=$[eu].bind($)}ee.StatWatcher=$.StatWatcher;ee.FSWatcher=$.FSWatcher;ee.WriteStream=$.WriteStream;ee.ReadStream=$.ReadStream;ee.promises=$.promises;ee._toUnixTimestamp=es.toUnixTimestamp;return ee}ee.createFsFromVolume=em;ee.fs=em(ee.vol);$.exports=en(en({},$.exports),ee.fs);$.exports.semantic=true},6426:function($,ee,et){"use strict";var en=this&&this.__spreadArrays||function(){for(var $=0,ee=0,et=arguments.length;ee<et;ee++)$+=arguments[ee].length;for(var en=Array($),ei=0,ee=0;ee<et;ee++)for(var eo=arguments[ee],es=0,eu=eo.length;es<eu;es++,ei++)en[ei]=eo[es];return en};Object.defineProperty(ee,"__esModule",{value:true});var ei=et(8764);ee.Buffer=ei.Buffer;function eo($){var ee=[];for(var et=1;et<arguments.length;et++){ee[et-1]=arguments[et]}return new(ei.Buffer.bind.apply(ei.Buffer,en([void 0,$],ee)))}var es=ei.Buffer.allocUnsafe||eo;ee.bufferAllocUnsafe=es;var eu=ei.Buffer.from||eo;ee.bufferFrom=eu},6978:function($,ee,et){"use strict";var en=this&&this.__extends||function(){var $=function(ee,et){$=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function($,ee){$.__proto__=ee}||function($,ee){for(var et in ee)if(ee.hasOwnProperty(et))$[et]=ee[et]};return $(ee,et)};return function(ee,et){$(ee,et);function en(){this.constructor=ee}ee.prototype=et===null?Object.create(et):(en.prototype=et.prototype,new en)}}();Object.defineProperty(ee,"__esModule",{value:true});var ei=et(9282);var eo=et(9539);var es=typeof Symbol==="undefined"?"_kCode":Symbol("code");var eu={};function el($){return function($){en(ee,$);function ee(ee){var et=[];for(var en=1;en<arguments.length;en++){et[en-1]=arguments[en]}var ei=$.call(this,ed(ee,et))||this;ei.code=ee;ei[es]=ee;ei.name=$.prototype.name+" ["+ei[es]+"]";return ei}return ee}($)}var ef=function($){en(et,$);function et(et){var en=this;if(typeof et!=="object"||et===null){throw new ee.TypeError("ERR_INVALID_ARG_TYPE","options","object")}if(et.message){en=$.call(this,et.message)||this}else{en=$.call(this,eo.inspect(et.actual).slice(0,128)+" "+(et.operator+" "+eo.inspect(et.expected).slice(0,128)))||this}en.generatedMessage=!et.message;en.name="AssertionError [ERR_ASSERTION]";en.code="ERR_ASSERTION";en.actual=et.actual;en.expected=et.expected;en.operator=et.operator;ee.Error.captureStackTrace(en,et.stackStartFunction);return en}return et}(et.g.Error);ee.AssertionError=ef;function ed($,ee){ei.strictEqual(typeof $,"string");var et=eu[$];ei(et,"An invalid error message key was used: "+$+".");var en;if(typeof et==="function"){en=et}else{en=eo.format;if(ee===undefined||ee.length===0)return et;ee.unshift(et)}return String(en.apply(null,ee))}ee.message=ed;function ep($,ee){eu[$]=typeof ee==="function"?ee:String(ee)}ee.E=ep;ee.Error=el(et.g.Error);ee.TypeError=el(et.g.TypeError);ee.RangeError=el(et.g.RangeError);ep("ERR_ARG_NOT_ITERABLE","%s must be iterable");ep("ERR_ASSERTION","%s");ep("ERR_BUFFER_OUT_OF_BOUNDS",em);ep("ERR_CHILD_CLOSED_BEFORE_REPLY","Child closed before reply received");ep("ERR_CONSOLE_WRITABLE_STREAM","Console expects a writable stream instance for %s");ep("ERR_CPU_USAGE","Unable to obtain cpu usage %s");ep("ERR_DNS_SET_SERVERS_FAILED",function($,ee){return'c-ares failed to set servers: "'+$+'" ['+ee+"]"});ep("ERR_FALSY_VALUE_REJECTION","Promise was rejected with falsy value");ep("ERR_ENCODING_NOT_SUPPORTED",function($){return'The "'+$+'" encoding is not supported'});ep("ERR_ENCODING_INVALID_ENCODED_DATA",function($){return"The encoded data was not valid for encoding "+$});ep("ERR_HTTP_HEADERS_SENT","Cannot render headers after they are sent to the client");ep("ERR_HTTP_INVALID_STATUS_CODE","Invalid status code: %s");ep("ERR_HTTP_TRAILER_INVALID","Trailers are invalid with this transfer encoding");ep("ERR_INDEX_OUT_OF_RANGE","Index out of range");ep("ERR_INVALID_ARG_TYPE",eh);ep("ERR_INVALID_ARRAY_LENGTH",function($,ee,et){ei.strictEqual(typeof et,"number");return'The array "'+$+'" (length '+et+") must be of length "+ee+"."});ep("ERR_INVALID_BUFFER_SIZE","Buffer size must be a multiple of %s");ep("ERR_INVALID_CALLBACK","Callback must be a function");ep("ERR_INVALID_CHAR","Invalid character in %s");ep("ERR_INVALID_CURSOR_POS","Cannot set cursor row without setting its column");ep("ERR_INVALID_FD",'"fd" must be a positive integer: %s');ep("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s');ep("ERR_INVALID_FILE_URL_PATH","File URL path %s");ep("ERR_INVALID_HANDLE_TYPE","This handle type cannot be sent");ep("ERR_INVALID_IP_ADDRESS","Invalid IP address: %s");ep("ERR_INVALID_OPT_VALUE",function($,ee){return'The value "'+String(ee)+'" is invalid for option "'+$+'"'});ep("ERR_INVALID_OPT_VALUE_ENCODING",function($){return'The value "'+String($)+'" is invalid for option "encoding"'});ep("ERR_INVALID_REPL_EVAL_CONFIG",'Cannot specify both "breakEvalOnSigint" and "eval" for REPL');ep("ERR_INVALID_SYNC_FORK_INPUT","Asynchronous forks do not support Buffer, Uint8Array or string input: %s");ep("ERR_INVALID_THIS",'Value of "this" must be of type %s');ep("ERR_INVALID_TUPLE","%s must be an iterable %s tuple");ep("ERR_INVALID_URL","Invalid URL: %s");ep("ERR_INVALID_URL_SCHEME",function($){return"The URL must be "+eg($,"scheme")});ep("ERR_IPC_CHANNEL_CLOSED","Channel closed");ep("ERR_IPC_DISCONNECTED","IPC channel is already disconnected");ep("ERR_IPC_ONE_PIPE","Child process can have only one IPC pipe");ep("ERR_IPC_SYNC_FORK","IPC cannot be used with synchronous forks");ep("ERR_MISSING_ARGS",ey);ep("ERR_MULTIPLE_CALLBACK","Callback called multiple times");ep("ERR_NAPI_CONS_FUNCTION","Constructor must be a function");ep("ERR_NAPI_CONS_PROTOTYPE_OBJECT","Constructor.prototype must be an object");ep("ERR_NO_CRYPTO","Node.js is not compiled with OpenSSL crypto support");ep("ERR_NO_LONGER_SUPPORTED","%s is no longer supported");ep("ERR_PARSE_HISTORY_DATA","Could not parse history data in %s");ep("ERR_SOCKET_ALREADY_BOUND","Socket is already bound");ep("ERR_SOCKET_BAD_PORT","Port should be > 0 and < 65536");ep("ERR_SOCKET_BAD_TYPE","Bad socket type specified. Valid types are: udp4, udp6");ep("ERR_SOCKET_CANNOT_SEND","Unable to send data");ep("ERR_SOCKET_CLOSED","Socket is closed");ep("ERR_SOCKET_DGRAM_NOT_RUNNING","Not running");ep("ERR_STDERR_CLOSE","process.stderr cannot be closed");ep("ERR_STDOUT_CLOSE","process.stdout cannot be closed");ep("ERR_STREAM_WRAP","Stream has StringDecoder set or is in objectMode");ep("ERR_TLS_CERT_ALTNAME_INVALID","Hostname/IP does not match certificate's altnames: %s");ep("ERR_TLS_DH_PARAM_SIZE",function($){return"DH parameter size "+$+" is less than 2048"});ep("ERR_TLS_HANDSHAKE_TIMEOUT","TLS handshake timeout");ep("ERR_TLS_RENEGOTIATION_FAILED","Failed to renegotiate");ep("ERR_TLS_REQUIRED_SERVER_NAME",'"servername" is required parameter for Server.addContext');ep("ERR_TLS_SESSION_ATTACK","TSL session renegotiation attack detected");ep("ERR_TRANSFORM_ALREADY_TRANSFORMING","Calling transform done when still transforming");ep("ERR_TRANSFORM_WITH_LENGTH_0","Calling transform done when writableState.length != 0");ep("ERR_UNKNOWN_ENCODING","Unknown encoding: %s");ep("ERR_UNKNOWN_SIGNAL","Unknown signal: %s");ep("ERR_UNKNOWN_STDIN_TYPE","Unknown stdin file type");ep("ERR_UNKNOWN_STREAM_TYPE","Unknown stream file type");ep("ERR_V8BREAKITERATOR","Full ICU data not installed. "+"See https://github.com/nodejs/node/wiki/Intl");function eh($,ee,et){ei($,"name is required");var en;if(ee.includes("not ")){en="must not be";ee=ee.split("not ")[1]}else{en="must be"}var eo;if(Array.isArray($)){var es=$.map(function($){return'"'+$+'"'}).join(", ");eo="The "+es+" arguments "+en+" "+eg(ee,"type")}else if($.includes(" argument")){eo="The "+$+" "+en+" "+eg(ee,"type")}else{var eu=$.includes(".")?"property":"argument";eo='The "'+$+'" '+eu+" "+en+" "+eg(ee,"type")}if(arguments.length>=3){eo+=". Received type "+(et!==null?typeof et:"null")}return eo}function ey(){var $=[];for(var ee=0;ee<arguments.length;ee++){$[ee]=arguments[ee]}ei($.length>0,"At least one arg needs to be specified");var et="The ";var en=$.length;$=$.map(function($){return'"'+$+'"'});switch(en){case 1:et+=$[0]+" argument";break;case 2:et+=$[0]+" and "+$[1]+" arguments";break;default:et+=$.slice(0,en-1).join(", ");et+=", and "+$[en-1]+" arguments";break}return et+" must be specified"}function eg($,ee){ei($,"expected is required");ei(typeof ee==="string","thing is required");if(Array.isArray($)){var et=$.length;ei(et>0,"At least one expected value needs to be specified");$=$.map(function($){return String($)});if(et>2){return"one of "+ee+" "+$.slice(0,et-1).join(", ")+", or "+$[et-1]}else if(et===2){return"one of "+ee+" "+$[0]+" or "+$[1]}else{return"of "+ee+" "+$[0]}}else{return"of "+ee+" "+String($)}}function em($,ee){if(ee){return"Attempt to write outside buffer bounds"}else{return'"'+$+'" is outside of buffer bounds'}}},1172:function($,ee,et){"use strict";var en=this&&this.__extends||function(){var $=function(ee,et){$=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function($,ee){$.__proto__=ee}||function($,ee){for(var et in ee)if(ee.hasOwnProperty(et))$[et]=ee[et]};return $(ee,et)};return function(ee,et){$(ee,et);function en(){this.constructor=ee}ee.prototype=et===null?Object.create(et):(en.prototype=et.prototype,new en)}}();Object.defineProperty(ee,"__esModule",{value:true});var ei=et(4880);var eo=et(6426);var es=et(5561);var eu=et(7187);var el=et(1507);var ef=es.constants.S_IFMT,ed=es.constants.S_IFDIR,ep=es.constants.S_IFREG,eh=es.constants.S_IFLNK,ey=es.constants.O_APPEND;ee.SEP="/";var eg=function($){en(ee,$);function ee(ee,et){if(et===void 0){et=438}var en=$.call(this)||this;en.uid=ei.default.getuid();en.gid=ei.default.getgid();en.atime=new Date;en.mtime=new Date;en.ctime=new Date;en.perm=438;en.mode=ep;en.nlink=1;en.perm=et;en.mode|=et;en.ino=ee;return en}ee.prototype.getString=function($){if($===void 0){$="utf8"}return this.getBuffer().toString($)};ee.prototype.setString=function($){this.buf=eo.bufferFrom($,"utf8");this.touch()};ee.prototype.getBuffer=function(){if(!this.buf)this.setBuffer(eo.bufferAllocUnsafe(0));return eo.bufferFrom(this.buf)};ee.prototype.setBuffer=function($){this.buf=eo.bufferFrom($);this.touch()};ee.prototype.getSize=function(){return this.buf?this.buf.length:0};ee.prototype.setModeProperty=function($){this.mode=this.mode&~ef|$};ee.prototype.setIsFile=function(){this.setModeProperty(ep)};ee.prototype.setIsDirectory=function(){this.setModeProperty(ed)};ee.prototype.setIsSymlink=function(){this.setModeProperty(eh)};ee.prototype.isFile=function(){return(this.mode&ef)===ep};ee.prototype.isDirectory=function(){return(this.mode&ef)===ed};ee.prototype.isSymlink=function(){return(this.mode&ef)===eh};ee.prototype.makeSymlink=function($){this.symlink=$;this.setIsSymlink()};ee.prototype.write=function($,ee,et,en){if(ee===void 0){ee=0}if(et===void 0){et=$.length}if(en===void 0){en=0}if(!this.buf)this.buf=eo.bufferAllocUnsafe(0);if(en+et>this.buf.length){var ei=eo.bufferAllocUnsafe(en+et);this.buf.copy(ei,0,0,this.buf.length);this.buf=ei}$.copy(this.buf,en,ee,ee+et);this.touch();return et};ee.prototype.read=function($,ee,et,en){if(ee===void 0){ee=0}if(et===void 0){et=$.byteLength}if(en===void 0){en=0}if(!this.buf)this.buf=eo.bufferAllocUnsafe(0);var ei=et;if(ei>$.byteLength){ei=$.byteLength}if(ei+en>this.buf.length){ei=this.buf.length-en}this.buf.copy($,ee,en,en+ei);return ei};ee.prototype.truncate=function($){if($===void 0){$=0}if(!$)this.buf=eo.bufferAllocUnsafe(0);else{if(!this.buf)this.buf=eo.bufferAllocUnsafe(0);if($<=this.buf.length){this.buf=this.buf.slice(0,$)}else{var ee=eo.bufferAllocUnsafe(0);this.buf.copy(ee);ee.fill(0,$)}}this.touch()};ee.prototype.chmod=function($){this.perm=$;this.mode=this.mode&~511|$;this.touch()};ee.prototype.chown=function($,ee){this.uid=$;this.gid=ee;this.touch()};ee.prototype.touch=function(){this.mtime=new Date;this.emit("change",this)};ee.prototype.canRead=function($,ee){if($===void 0){$=ei.default.getuid()}if(ee===void 0){ee=ei.default.getgid()}if(this.perm&4){return true}if(ee===this.gid){if(this.perm&32){return true}}if($===this.uid){if(this.perm&256){return true}}return false};ee.prototype.canWrite=function($,ee){if($===void 0){$=ei.default.getuid()}if(ee===void 0){ee=ei.default.getgid()}if(this.perm&2){return true}if(ee===this.gid){if(this.perm&16){return true}}if($===this.uid){if(this.perm&128){return true}}return false};ee.prototype.del=function(){this.emit("delete",this)};ee.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()}};return ee}(eu.EventEmitter);ee.Node=eg;var em=function($){en(et,$);function et(ee,et,en){var ei=$.call(this)||this;ei.children={};ei.steps=[];ei.ino=0;ei.length=0;ei.vol=ee;ei.parent=et;ei.steps=et?et.steps.concat([en]):[en];return ei}et.prototype.setNode=function($){this.node=$;this.ino=$.ino};et.prototype.getNode=function(){return this.node};et.prototype.createChild=function($,ee){if(ee===void 0){ee=this.vol.createNode()}var en=new et(this.vol,this,$);en.setNode(ee);if(ee.isDirectory()){}this.setChild($,en);return en};et.prototype.setChild=function($,ee){if(ee===void 0){ee=new et(this.vol,this,$)}this.children[$]=ee;ee.parent=this;this.length++;this.emit("child:add",ee,this);return ee};et.prototype.deleteChild=function($){delete this.children[$.getName()];this.length--;this.emit("child:delete",$,this)};et.prototype.getChild=function($){if(Object.hasOwnProperty.call(this.children,$)){return this.children[$]}};et.prototype.getPath=function(){return this.steps.join(ee.SEP)};et.prototype.getName=function(){return this.steps[this.steps.length-1]};et.prototype.walk=function($,ee,et){if(ee===void 0){ee=$.length}if(et===void 0){et=0}if(et>=$.length)return this;if(et>=ee)return this;var en=$[et];var ei=this.getChild(en);if(!ei)return null;return ei.walk($,ee,et+1)};et.prototype.toJSON=function(){return{steps:this.steps,ino:this.ino,children:Object.keys(this.children)}};return et}(eu.EventEmitter);ee.Link=em;var e_=function(){function $($,ee,et,en){this.position=0;this.link=$;this.node=ee;this.flags=et;this.fd=en}$.prototype.getString=function($){if($===void 0){$="utf8"}return this.node.getString()};$.prototype.setString=function($){this.node.setString($)};$.prototype.getBuffer=function(){return this.node.getBuffer()};$.prototype.setBuffer=function($){this.node.setBuffer($)};$.prototype.getSize=function(){return this.node.getSize()};$.prototype.truncate=function($){this.node.truncate($)};$.prototype.seekTo=function($){this.position=$};$.prototype.stats=function(){return el.default.build(this.node)};$.prototype.write=function($,ee,et,en){if(ee===void 0){ee=0}if(et===void 0){et=$.length}if(typeof en!=="number")en=this.position;if(this.flags&ey)en=this.getSize();var ei=this.node.write($,ee,et,en);this.position=en+ei;return ei};$.prototype.read=function($,ee,et,en){if(ee===void 0){ee=0}if(et===void 0){et=$.byteLength}if(typeof en!=="number")en=this.position;var ei=this.node.read($,ee,et,en);this.position=en+ei;return ei};$.prototype.chmod=function($){this.node.chmod($)};$.prototype.chown=function($,ee){this.node.chown($,ee)};return $}();ee.File=e_},4880:($,ee,et)=>{"use strict";var en=et(4155);Object.defineProperty(ee,"__esModule",{value:true});var ei=function(){if(typeof en!=="undefined"){return en}try{return et(4155)}catch($){return undefined}};function eo(){var $=ei()||{};if(!$.getuid)$.getuid=function(){return 0};if(!$.getgid)$.getgid=function(){return 0};if(!$.cwd)$.cwd=function(){return"/"};if(!$.nextTick)$.nextTick=et(6015)["default"];if(!$.emitWarning)$.emitWarning=function($,ee){console.warn(""+ee+(ee?": ":"")+$)};if(!$.env)$.env={};return $}ee.createProcess=eo;ee["default"]=eo()},6133:function($,ee){"use strict";var et=this&&this.__spreadArrays||function(){for(var $=0,ee=0,et=arguments.length;ee<et;ee++)$+=arguments[ee].length;for(var en=Array($),ei=0,ee=0;ee<et;ee++)for(var eo=arguments[ee],es=0,eu=eo.length;es<eu;es++,ei++)en[ei]=eo[es];return en};Object.defineProperty(ee,"__esModule",{value:true});function en($,ee,en){if(en===void 0){en=function($){return $}}return function(){var ei=[];for(var eo=0;eo<arguments.length;eo++){ei[eo]=arguments[eo]}return new Promise(function(eo,es){$[ee].bind($).apply(void 0,et(ei,[function($,ee){if($)return es($);return eo(en(ee))}]))})}}var ei=function(){function $($,ee){this.vol=$;this.fd=ee}$.prototype.appendFile=function($,ee){return en(this.vol,"appendFile")(this.fd,$,ee)};$.prototype.chmod=function($){return en(this.vol,"fchmod")(this.fd,$)};$.prototype.chown=function($,ee){return en(this.vol,"fchown")(this.fd,$,ee)};$.prototype.close=function(){return en(this.vol,"close")(this.fd)};$.prototype.datasync=function(){return en(this.vol,"fdatasync")(this.fd)};$.prototype.read=function($,ee,et,ei){return en(this.vol,"read",function(ee){return{bytesRead:ee,buffer:$}})(this.fd,$,ee,et,ei)};$.prototype.readFile=function($){return en(this.vol,"readFile")(this.fd,$)};$.prototype.stat=function($){return en(this.vol,"fstat")(this.fd,$)};$.prototype.sync=function(){return en(this.vol,"fsync")(this.fd)};$.prototype.truncate=function($){return en(this.vol,"ftruncate")(this.fd,$)};$.prototype.utimes=function($,ee){return en(this.vol,"futimes")(this.fd,$,ee)};$.prototype.write=function($,ee,et,ei){return en(this.vol,"write",function(ee){return{bytesWritten:ee,buffer:$}})(this.fd,$,ee,et,ei)};$.prototype.writeFile=function($,ee){return en(this.vol,"writeFile")(this.fd,$,ee)};return $}();ee.FileHandle=ei;function eo($){if(typeof Promise==="undefined")return null;return{FileHandle:ei,access:function(ee,et){return en($,"access")(ee,et)},appendFile:function(ee,et,eo){return en($,"appendFile")(ee instanceof ei?ee.fd:ee,et,eo)},chmod:function(ee,et){return en($,"chmod")(ee,et)},chown:function(ee,et,ei){return en($,"chown")(ee,et,ei)},copyFile:function(ee,et,ei){return en($,"copyFile")(ee,et,ei)},lchmod:function(ee,et){return en($,"lchmod")(ee,et)},lchown:function(ee,et,ei){return en($,"lchown")(ee,et,ei)},link:function(ee,et){return en($,"link")(ee,et)},lstat:function(ee,et){return en($,"lstat")(ee,et)},mkdir:function(ee,et){return en($,"mkdir")(ee,et)},mkdtemp:function(ee,et){return en($,"mkdtemp")(ee,et)},open:function(ee,et,eo){return en($,"open",function(ee){return new ei($,ee)})(ee,et,eo)},readdir:function(ee,et){return en($,"readdir")(ee,et)},readFile:function(ee,et){return en($,"readFile")(ee instanceof ei?ee.fd:ee,et)},readlink:function(ee,et){return en($,"readlink")(ee,et)},realpath:function(ee,et){return en($,"realpath")(ee,et)},rename:function(ee,et){return en($,"rename")(ee,et)},rmdir:function(ee){return en($,"rmdir")(ee)},stat:function(ee,et){return en($,"stat")(ee,et)},symlink:function(ee,et,ei){return en($,"symlink")(ee,et,ei)},truncate:function(ee,et){return en($,"truncate")(ee,et)},unlink:function(ee){return en($,"unlink")(ee)},utimes:function(ee,et,ei){return en($,"utimes")(ee,et,ei)},writeFile:function(ee,et,eo){return en($,"writeFile")(ee instanceof ei?ee.fd:ee,et,eo)}}}ee["default"]=eo},6015:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});var en;if(typeof setImmediate==="function")en=setImmediate.bind(et.g);else en=setTimeout.bind(et.g);ee["default"]=en},8369:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});function et($,ee,et){var en=setTimeout.apply(null,arguments);if(en&&typeof en==="object"&&typeof en.unref==="function")en.unref();return en}ee["default"]=et},6898:function($,ee,et){"use strict";var en=this&&this.__extends||function(){var $=function(ee,et){$=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function($,ee){$.__proto__=ee}||function($,ee){for(var et in ee)if(ee.hasOwnProperty(et))$[et]=ee[et]};return $(ee,et)};return function(ee,et){$(ee,et);function en(){this.constructor=ee}ee.prototype=et===null?Object.create(et):(en.prototype=et.prototype,new en)}}();var ei=this&&this.__spreadArrays||function(){for(var $=0,ee=0,et=arguments.length;ee<et;ee++)$+=arguments[ee].length;for(var en=Array($),ei=0,ee=0;ee<et;ee++)for(var eo=arguments[ee],es=0,eu=eo.length;es<eu;es++,ei++)en[ei]=eo[es];return en};Object.defineProperty(ee,"__esModule",{value:true});var eo=et(6470);var es=et(1172);var eu=et(1507);var el=et(832);var ef=et(6426);var ed=et(6015);var ep=et(4880);var eh=et(8369);var ey=et(2830);var eg=et(5561);var em=et(7187);var e_=et(9568);var ew=et(6978);var eE=et(9539);var eS=et(6133);var eT=eo.resolve;var eO=eg.constants.O_RDONLY,eA=eg.constants.O_WRONLY,eI=eg.constants.O_RDWR,eN=eg.constants.O_CREAT,eD=eg.constants.O_EXCL,eR=eg.constants.O_TRUNC,eC=eg.constants.O_APPEND,ek=eg.constants.O_SYNC,eM=eg.constants.O_DIRECTORY,eL=eg.constants.F_OK,eP=eg.constants.COPYFILE_EXCL,eF=eg.constants.COPYFILE_FICLONE_FORCE;var eB;var eU;if(eo.posix){var ej=eo.posix;eB=ej.sep;eU=ej.relative}else{eB=eo.sep;eU=eo.relative}var eW=ep.default.platform==="win32";var eH=128;var ez={PATH_STR:"path must be a string or Buffer",FD:"fd must be a file descriptor",MODE_INT:"mode must be an int",CB:"callback must be a function",UID:"uid must be an unsigned int",GID:"gid must be an unsigned int",LEN:"len must be an integer",ATIME:"atime must be an integer",MTIME:"mtime must be an integer",PREFIX:"filename prefix is required",BUFFER:"buffer must be an instance of Buffer or StaticBuffer",OFFSET:"offset must be an integer",LENGTH:"length must be an integer",POSITION:"position must be an integer"};var eV=function($){return"Expected options to be either an object or a string, but got "+$+" instead"};var e$="ENOENT";var eq="EBADF";var eG="EINVAL";var eY="EPERM";var eK="EPROTO";var eZ="EEXIST";var eJ="ENOTDIR";var eX="EMFILE";var eQ="EACCES";var e0="EISDIR";var e1="ENOTEMPTY";var e2="ENOSYS";function e6($,ee,et,en){if(ee===void 0){ee=""}if(et===void 0){et=""}if(en===void 0){en=""}var ei="";if(et)ei=" '"+et+"'";if(en)ei+=" -> '"+en+"'";switch($){case e$:return"ENOENT: no such file or directory, "+ee+ei;case eq:return"EBADF: bad file descriptor, "+ee+ei;case eG:return"EINVAL: invalid argument, "+ee+ei;case eY:return"EPERM: operation not permitted, "+ee+ei;case eK:return"EPROTO: protocol error, "+ee+ei;case eZ:return"EEXIST: file already exists, "+ee+ei;case eJ:return"ENOTDIR: not a directory, "+ee+ei;case e0:return"EISDIR: illegal operation on a directory, "+ee+ei;case eQ:return"EACCES: permission denied, "+ee+ei;case e1:return"ENOTEMPTY: directory not empty, "+ee+ei;case eX:return"EMFILE: too many open files, "+ee+ei;case e2:return"ENOSYS: function not implemented, "+ee+ei;default:return $+": error occurred, "+ee+ei}}function e4($,ee,et,en,ei){if(ee===void 0){ee=""}if(et===void 0){et=""}if(en===void 0){en=""}if(ei===void 0){ei=Error}var eo=new ei(e6($,ee,et,en));eo.code=$;return eo}var e3;(function($){$[$["r"]=eO]="r";$[$["r+"]=eI]="r+";$[$["rs"]=eO|ek]="rs";$[$["sr"]=$.rs]="sr";$[$["rs+"]=eI|ek]="rs+";$[$["sr+"]=$["rs+"]]="sr+";$[$["w"]=eA|eN|eR]="w";$[$["wx"]=eA|eN|eR|eD]="wx";$[$["xw"]=$.wx]="xw";$[$["w+"]=eI|eN|eR]="w+";$[$["wx+"]=eI|eN|eR|eD]="wx+";$[$["xw+"]=$["wx+"]]="xw+";$[$["a"]=eA|eC|eN]="a";$[$["ax"]=eA|eC|eN|eD]="ax";$[$["xa"]=$.ax]="xa";$[$["a+"]=eI|eC|eN]="a+";$[$["ax+"]=eI|eC|eN|eD]="ax+";$[$["xa+"]=$["ax+"]]="xa+"})(e3=ee.FLAGS||(ee.FLAGS={}));function e8($){if(typeof $==="number")return $;if(typeof $==="string"){var ee=e3[$];if(typeof ee!=="undefined")return ee}throw new ew.TypeError("ERR_INVALID_OPT_VALUE","flags",$)}ee.flagsToNumber=e8;function e5($,ee){var et;if(!ee)return $;else{var en=typeof ee;switch(en){case"string":et=Object.assign({},$,{encoding:ee});break;case"object":et=Object.assign({},$,ee);break;default:throw TypeError(eV(en))}}if(et.encoding!=="buffer")e_.assertEncoding(et.encoding);return et}function e9($){return function(ee){return e5($,ee)}}function e7($){if(typeof $!=="function")throw TypeError(ez.CB);return $}function te($){return function(ee,et){return typeof ee==="function"?[$(),ee]:[$(ee),e7(et)]}}var tt={encoding:"utf8"};var tr=e9(tt);var tn=te(tr);var ti={flag:"r"};var tu=e9(ti);var tc={encoding:"utf8",mode:438,flag:e3[e3.w]};var tf=e9(tc);var td={encoding:"utf8",mode:438,flag:e3[e3.a]};var tp=e9(td);var th=te(tp);var ty=tt;var tm=e9(ty);var t_=te(tm);var tv={mode:511,recursive:false};var tw=function($){if(typeof $==="number")return Object.assign({},tv,{mode:$});return Object.assign({},tv,$)};var tE={recursive:false};var tS=function($){return Object.assign({},tE,$)};var tT={encoding:"utf8",withFileTypes:false};var tO=e9(tT);var tA=te(tO);var tI={bigint:false};var tN=function($){if($===void 0){$={}}return Object.assign({},tI,$)};var tD=function($,ee){return typeof $==="function"?[tN(),$]:[tN($),e7(ee)]};function tR($){if($.hostname!==""){throw new ew.TypeError("ERR_INVALID_FILE_URL_HOST",ep.default.platform)}var ee=$.pathname;for(var et=0;et<ee.length;et++){if(ee[et]==="%"){var en=ee.codePointAt(et+2)|32;if(ee[et+1]==="2"&&en===102){throw new ew.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}}}return decodeURIComponent(ee)}function tC($){if(typeof $!=="string"&&!ef.Buffer.isBuffer($)){try{if(!($ instanceof et(8119).URL))throw new TypeError(ez.PATH_STR)}catch($){throw new TypeError(ez.PATH_STR)}$=tR($)}var ee=String($);tj(ee);return ee}ee.pathToFilename=tC;var tk=function($,ee){if(ee===void 0){ee=ep.default.cwd()}return eT(ee,$)};if(eW){var tM=tk;var tL=et(8012).Z4;tk=function($,ee){return tL(tM($,ee))}}function tx($,ee){var et=tk($,ee);var en=et.substr(1);if(!en)return[];return en.split(eB)}ee.filenameToSteps=tx;function tP($){return tx(tC($))}ee.pathToSteps=tP;function tF($,ee){if(ee===void 0){ee=e_.ENCODING_UTF8}if(ef.Buffer.isBuffer($))return $.toString(ee);else if($ instanceof Uint8Array)return ef.bufferFrom($).toString(ee);else return String($)}ee.dataToStr=tF;function tB($,ee){if(ee===void 0){ee=e_.ENCODING_UTF8}if(ef.Buffer.isBuffer($))return $;else if($ instanceof Uint8Array)return ef.bufferFrom($);else return ef.bufferFrom(String($),ee)}ee.dataToBuffer=tB;function tU($,ee){if(!ee||ee==="buffer")return $;else return $.toString(ee)}ee.bufferToEncoding=tU;function tj($,ee){if((""+$).indexOf("\x00")!==-1){var et=new Error("Path must be a string without null bytes");et.code=e$;if(typeof ee!=="function")throw et;ep.default.nextTick(ee,et);return false}return true}function tW($,ee){if(typeof $==="number")return $;if(typeof $==="string")return parseInt($,8);if(ee)return tH(ee);return undefined}function tH($,ee){var et=tW($,ee);if(typeof et!=="number"||isNaN(et))throw new TypeError(ez.MODE_INT);return et}function tz($){return $>>>0===$}function tV($){if(!tz($))throw TypeError(ez.FD)}function t$($){if(typeof $==="string"&&+$==$){return+$}if($ instanceof Date){return $.getTime()/1e3}if(isFinite($)){if($<0){return Date.now()/1e3}return $}throw new Error("Cannot parse time: "+$)}ee.toUnixTimestamp=t$;function tq($){if(typeof $!=="number")throw TypeError(ez.UID)}function tG($){if(typeof $!=="number")throw TypeError(ez.GID)}var tY=function(){function $($){if($===void 0){$={}}this.ino=0;this.inodes={};this.releasedInos=[];this.fds={};this.releasedFds=[];this.maxFiles=1e4;this.openFiles=0;this.promisesApi=eS.default(this);this.statWatchers={};this.props=Object.assign({Node:es.Node,Link:es.Link,File:es.File},$);var ee=this.createLink();ee.setNode(this.createNode(true));var et=this;this.StatWatcher=function($){en(ee,$);function ee(){return $.call(this,et)||this}return ee}(tZ);var eo=tQ;this.ReadStream=function($){en(ee,$);function ee(){var ee=[];for(var en=0;en<arguments.length;en++){ee[en]=arguments[en]}return $.apply(this,ei([et],ee))||this}return ee}(eo);var eu=t6;this.WriteStream=function($){en(ee,$);function ee(){var ee=[];for(var en=0;en<arguments.length;en++){ee[en]=arguments[en]}return $.apply(this,ei([et],ee))||this}return ee}(eu);this.FSWatcher=function($){en(ee,$);function ee(){return $.call(this,et)||this}return ee}(t4);this.root=ee}$.fromJSON=function(ee,et){var en=new $;en.fromJSON(ee,et);return en};Object.defineProperty($.prototype,"promises",{get:function(){if(this.promisesApi===null)throw new Error("Promise is not supported in this environment.");return this.promisesApi},enumerable:true,configurable:true});$.prototype.createLink=function($,ee,et,en){if(et===void 0){et=false}if(!$){return new this.props.Link(this,null,"")}if(!ee){throw new Error("createLink: name cannot be empty")}return $.createChild(ee,this.createNode(et,en))};$.prototype.deleteLink=function($){var ee=$.parent;if(ee){ee.deleteChild($);return true}return false};$.prototype.newInoNumber=function(){var $=this.releasedInos.pop();if($)return $;else{this.ino=(this.ino+1)%4294967295;return this.ino}};$.prototype.newFdNumber=function(){var ee=this.releasedFds.pop();return typeof ee==="number"?ee:$.fd--};$.prototype.createNode=function($,ee){if($===void 0){$=false}var et=new this.props.Node(this.newInoNumber(),ee);if($)et.setIsDirectory();this.inodes[et.ino]=et;return et};$.prototype.getNode=function($){return this.inodes[$]};$.prototype.deleteNode=function($){$.del();delete this.inodes[$.ino];this.releasedInos.push($.ino)};$.prototype.genRndStr=function(){var $=(Math.random()+1).toString(36).substr(2,6);if($.length===6)return $;else return this.genRndStr()};$.prototype.getLink=function($){return this.root.walk($)};$.prototype.getLinkOrThrow=function($,ee){var et=tx($);var en=this.getLink(et);if(!en)throw e4(e$,ee,$);return en};$.prototype.getResolvedLink=function($){var ee=typeof $==="string"?tx($):$;var et=this.root;var en=0;while(en<ee.length){var ei=ee[en];et=et.getChild(ei);if(!et)return null;var eo=et.getNode();if(eo.isSymlink()){ee=eo.symlink.concat(ee.slice(en+1));et=this.root;en=0;continue}en++}return et};$.prototype.getResolvedLinkOrThrow=function($,ee){var et=this.getResolvedLink($);if(!et)throw e4(e$,ee,$);return et};$.prototype.resolveSymlinks=function($){return this.getResolvedLink($.steps.slice(1))};$.prototype.getLinkAsDirOrThrow=function($,ee){var et=this.getLinkOrThrow($,ee);if(!et.getNode().isDirectory())throw e4(eJ,ee,$);return et};$.prototype.getLinkParent=function($){return this.root.walk($,$.length-1)};$.prototype.getLinkParentAsDirOrThrow=function($,ee){var et=$ instanceof Array?$:tx($);var en=this.getLinkParent(et);if(!en)throw e4(e$,ee,eB+et.join(eB));if(!en.getNode().isDirectory())throw e4(eJ,ee,eB+et.join(eB));return en};$.prototype.getFileByFd=function($){return this.fds[String($)]};$.prototype.getFileByFdOrThrow=function($,ee){if(!tz($))throw TypeError(ez.FD);var et=this.getFileByFd($);if(!et)throw e4(eq,ee);return et};$.prototype.getNodeByIdOrCreate=function($,ee,et){if(typeof $==="number"){var en=this.getFileByFd($);if(!en)throw Error("File nto found");return en.node}else{var ei=tP($);var eo=this.getLink(ei);if(eo)return eo.getNode();if(ee&eN){var es=this.getLinkParent(ei);if(es){var eu=ei[ei.length-1];eo=this.createLink(es,eu,false,et);return eo.getNode()}}throw e4(e$,"getNodeByIdOrCreate",tC($))}};$.prototype.wrapAsync=function($,ee,et){var en=this;e7(et);ed.default(function(){try{et(null,$.apply(en,ee))}catch($){et($)}})};$.prototype._toJSON=function($,ee,et){var en;if($===void 0){$=this.root}if(ee===void 0){ee={}}var ei=true;var eo=$.children;if($.getNode().isFile()){eo=(en={},en[$.getName()]=$.parent.getChild($.getName()),en);$=$.parent}for(var es in eo){ei=false;var eu=$.getChild(es);if(!eu){throw new Error("_toJSON: unexpected undefined")}var el=eu.getNode();if(el.isFile()){var ef=eu.getPath();if(et)ef=eU(et,ef);ee[ef]=el.getString()}else if(el.isDirectory()){this._toJSON(eu,ee,et)}}var ed=$.getPath();if(et)ed=eU(et,ed);if(ed&&ei){ee[ed]=null}return ee};$.prototype.toJSON=function($,ee,et){if(ee===void 0){ee={}}if(et===void 0){et=false}var en=[];if($){if(!($ instanceof Array))$=[$];for(var ei=0,eo=$;ei<eo.length;ei++){var es=eo[ei];var eu=tC(es);var el=this.getResolvedLink(eu);if(!el)continue;en.push(el)}}else{en.push(this.root)}if(!en.length)return ee;for(var ef=0,ed=en;ef<ed.length;ef++){var el=ed[ef];this._toJSON(el,ee,et?el.getPath():"")}return ee};$.prototype.fromJSON=function($,ee){if(ee===void 0){ee=ep.default.cwd()}for(var et in $){var en=$[et];if(typeof en==="string"){et=tk(et,ee);var ei=tx(et);if(ei.length>1){var eo=eB+ei.slice(0,ei.length-1).join(eB);this.mkdirpBase(eo,511)}this.writeFileSync(et,en)}else{this.mkdirpBase(et,511)}}};$.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(true))};$.prototype.mountSync=function($,ee){this.fromJSON(ee,$)};$.prototype.openLink=function($,ee,et){if(et===void 0){et=true}if(this.openFiles>=this.maxFiles){throw e4(eX,"open",$.getPath())}var en=$;if(et)en=this.resolveSymlinks($);if(!en)throw e4(e$,"open",$.getPath());var ei=en.getNode();if(ei.isDirectory()){if((ee&(eO|eI|eA))!==eO)throw e4(e0,"open",$.getPath())}else{if(ee&eM)throw e4(eJ,"open",$.getPath())}if(!(ee&eA)){if(!ei.canRead()){throw e4(eQ,"open",$.getPath())}}if(ee&eI){}var eo=new this.props.File($,ei,ee,this.newFdNumber());this.fds[eo.fd]=eo;this.openFiles++;if(ee&eR)eo.truncate();return eo};$.prototype.openFile=function($,ee,et,en){if(en===void 0){en=true}var ei=tx($);var eo=en?this.getResolvedLink(ei):this.getLink(ei);if(!eo&&ee&eN){var es=this.getResolvedLink(ei.slice(0,ei.length-1));if(!es)throw e4(e$,"open",eB+ei.join(eB));if(ee&eN&&typeof et==="number"){eo=this.createLink(es,ei[ei.length-1],false,et)}}if(eo)return this.openLink(eo,ee,en);throw e4(e$,"open",$)};$.prototype.openBase=function($,ee,et,en){if(en===void 0){en=true}var ei=this.openFile($,ee,et,en);if(!ei)throw e4(e$,"open",$);return ei.fd};$.prototype.openSync=function($,ee,et){if(et===void 0){et=438}var en=tH(et);var ei=tC($);var eo=e8(ee);return this.openBase(ei,eo,en)};$.prototype.open=function($,ee,et,en){var ei=et;var eo=en;if(typeof et==="function"){ei=438;eo=et}ei=ei||438;var es=tH(ei);var eu=tC($);var el=e8(ee);this.wrapAsync(this.openBase,[eu,el,es],eo)};$.prototype.closeFile=function($){if(!this.fds[$.fd])return;this.openFiles--;delete this.fds[$.fd];this.releasedFds.push($.fd)};$.prototype.closeSync=function($){tV($);var ee=this.getFileByFdOrThrow($,"close");this.closeFile(ee)};$.prototype.close=function($,ee){tV($);this.wrapAsync(this.closeSync,[$],ee)};$.prototype.openFileOrGetById=function($,ee,et){if(typeof $==="number"){var en=this.fds[$];if(!en)throw e4(e$);return en}else{return this.openFile(tC($),ee,et)}};$.prototype.readBase=function($,ee,et,en,ei){var eo=this.getFileByFdOrThrow($);return eo.read(ee,Number(et),Number(en),ei)};$.prototype.readSync=function($,ee,et,en,ei){tV($);return this.readBase($,ee,et,en,ei)};$.prototype.read=function($,ee,et,en,ei,eo){var es=this;e7(eo);if(en===0){return ep.default.nextTick(function(){if(eo)eo(null,0,ee)})}ed.default(function(){try{var eu=es.readBase($,ee,et,en,ei);eo(null,eu,ee)}catch($){eo($)}})};$.prototype.readFileBase=function($,ee,et){var en;var ei=typeof $==="number";var eo=ei&&tz($);var es;if(eo)es=$;else{var eu=tC($);var el=tx(eu);var ef=this.getResolvedLink(el);if(ef){var ed=ef.getNode();if(ed.isDirectory())throw e4(e0,"open",ef.getPath())}es=this.openSync($,ee)}try{en=tU(this.getFileByFdOrThrow(es).getBuffer(),et)}finally{if(!eo){this.closeSync(es)}}return en};$.prototype.readFileSync=function($,ee){var et=tu(ee);var en=e8(et.flag);return this.readFileBase($,en,et.encoding)};$.prototype.readFile=function($,ee,et){var en=te(tu)(ee,et),ei=en[0],eo=en[1];var es=e8(ei.flag);this.wrapAsync(this.readFileBase,[$,es,ei.encoding],eo)};$.prototype.writeBase=function($,ee,et,en,ei){var eo=this.getFileByFdOrThrow($,"write");return eo.write(ee,et,en,ei)};$.prototype.writeSync=function($,ee,et,en,ei){tV($);var eo;var es;var eu;var el;var ef=typeof ee!=="string";if(ef){es=(et||0)|0;eu=en;el=ei}else{el=et;eo=en}var ed=tB(ee,eo);if(ef){if(typeof eu==="undefined"){eu=ed.length}}else{es=0;eu=ed.length}return this.writeBase($,ed,es,eu,el)};$.prototype.write=function($,ee,et,en,ei,eo){var es=this;tV($);var eu;var el;var ef;var ep;var eh;var ey=typeof ee;var eg=typeof et;var em=typeof en;var e_=typeof ei;if(ey!=="string"){if(eg==="function"){eh=et}else if(em==="function"){eu=et|0;eh=en}else if(e_==="function"){eu=et|0;el=en;eh=ei}else{eu=et|0;el=en;ef=ei;eh=eo}}else{if(eg==="function"){eh=et}else if(em==="function"){ef=et;eh=en}else if(e_==="function"){ef=et;ep=en;eh=ei}}var ew=tB(ee,ep);if(ey!=="string"){if(typeof el==="undefined")el=ew.length}else{eu=0;el=ew.length}var eE=e7(eh);ed.default(function(){try{var et=es.writeBase($,ew,eu,el,ef);if(ey!=="string"){eE(null,et,ew)}else{eE(null,et,ee)}}catch($){eE($)}})};$.prototype.writeFileBase=function($,ee,et,en){var ei=typeof $==="number";var eo;if(ei)eo=$;else{eo=this.openBase(tC($),et,en)}var es=0;var eu=ee.length;var el=et&eC?undefined:0;try{while(eu>0){var ef=this.writeSync(eo,ee,es,eu,el);es+=ef;eu-=ef;if(el!==undefined)el+=ef}}finally{if(!ei)this.closeSync(eo)}};$.prototype.writeFileSync=function($,ee,et){var en=tf(et);var ei=e8(en.flag);var eo=tH(en.mode);var es=tB(ee,en.encoding);this.writeFileBase($,es,ei,eo)};$.prototype.writeFile=function($,ee,et,en){var ei=et;var eo=en;if(typeof et==="function"){ei=tc;eo=et}var es=e7(eo);var eu=tf(ei);var el=e8(eu.flag);var ef=tH(eu.mode);var ed=tB(ee,eu.encoding);this.wrapAsync(this.writeFileBase,[$,ed,el,ef],es)};$.prototype.linkBase=function($,ee){var et=tx($);var en=this.getLink(et);if(!en)throw e4(e$,"link",$,ee);var ei=tx(ee);var eo=this.getLinkParent(ei);if(!eo)throw e4(e$,"link",$,ee);var es=ei[ei.length-1];if(eo.getChild(es))throw e4(eZ,"link",$,ee);var eu=en.getNode();eu.nlink++;eo.createChild(es,eu)};$.prototype.copyFileBase=function($,ee,et){var en=this.readFileSync($);if(et&eP){if(this.existsSync(ee)){throw e4(eZ,"copyFile",$,ee)}}if(et&eF){throw e4(e2,"copyFile",$,ee)}this.writeFileBase(ee,en,e3.w,438)};$.prototype.copyFileSync=function($,ee,et){var en=tC($);var ei=tC(ee);return this.copyFileBase(en,ei,(et||0)|0)};$.prototype.copyFile=function($,ee,et,en){var ei=tC($);var eo=tC(ee);var es;var eu;if(typeof et==="function"){es=0;eu=et}else{es=et;eu=en}e7(eu);this.wrapAsync(this.copyFileBase,[ei,eo,es],eu)};$.prototype.linkSync=function($,ee){var et=tC($);var en=tC(ee);this.linkBase(et,en)};$.prototype.link=function($,ee,et){var en=tC($);var ei=tC(ee);this.wrapAsync(this.linkBase,[en,ei],et)};$.prototype.unlinkBase=function($){var ee=tx($);var et=this.getLink(ee);if(!et)throw e4(e$,"unlink",$);if(et.length)throw Error("Dir not empty...");this.deleteLink(et);var en=et.getNode();en.nlink--;if(en.nlink<=0){this.deleteNode(en)}};$.prototype.unlinkSync=function($){var ee=tC($);this.unlinkBase(ee)};$.prototype.unlink=function($,ee){var et=tC($);this.wrapAsync(this.unlinkBase,[et],ee)};$.prototype.symlinkBase=function($,ee){var et=tx(ee);var en=this.getLinkParent(et);if(!en)throw e4(e$,"symlink",$,ee);var ei=et[et.length-1];if(en.getChild(ei))throw e4(eZ,"symlink",$,ee);var eo=en.createChild(ei);eo.getNode().makeSymlink(tx($));return eo};$.prototype.symlinkSync=function($,ee,et){var en=tC($);var ei=tC(ee);this.symlinkBase(en,ei)};$.prototype.symlink=function($,ee,et,en){var ei=e7(typeof et==="function"?et:en);var eo=tC($);var es=tC(ee);this.wrapAsync(this.symlinkBase,[eo,es],ei)};$.prototype.realpathBase=function($,ee){var et=tx($);var en=this.getResolvedLink(et);if(!en)throw e4(e$,"realpath",$);return e_.strToEncoding(en.getPath(),ee)};$.prototype.realpathSync=function($,ee){return this.realpathBase(tC($),tm(ee).encoding)};$.prototype.realpath=function($,ee,et){var en=t_(ee,et),ei=en[0],eo=en[1];var es=tC($);this.wrapAsync(this.realpathBase,[es,ei.encoding],eo)};$.prototype.lstatBase=function($,ee){if(ee===void 0){ee=false}var et=this.getLink(tx($));if(!et)throw e4(e$,"lstat",$);return eu.default.build(et.getNode(),ee)};$.prototype.lstatSync=function($,ee){return this.lstatBase(tC($),tN(ee).bigint)};$.prototype.lstat=function($,ee,et){var en=tD(ee,et),ei=en[0],eo=en[1];this.wrapAsync(this.lstatBase,[tC($),ei.bigint],eo)};$.prototype.statBase=function($,ee){if(ee===void 0){ee=false}var et=this.getResolvedLink(tx($));if(!et)throw e4(e$,"stat",$);return eu.default.build(et.getNode(),ee)};$.prototype.statSync=function($,ee){return this.statBase(tC($),tN(ee).bigint)};$.prototype.stat=function($,ee,et){var en=tD(ee,et),ei=en[0],eo=en[1];this.wrapAsync(this.statBase,[tC($),ei.bigint],eo)};$.prototype.fstatBase=function($,ee){if(ee===void 0){ee=false}var et=this.getFileByFd($);if(!et)throw e4(eq,"fstat");return eu.default.build(et.node,ee)};$.prototype.fstatSync=function($,ee){return this.fstatBase($,tN(ee).bigint)};$.prototype.fstat=function($,ee,et){var en=tD(ee,et),ei=en[0],eo=en[1];this.wrapAsync(this.fstatBase,[$,ei.bigint],eo)};$.prototype.renameBase=function($,ee){var et=this.getLink(tx($));if(!et)throw e4(e$,"rename",$,ee);var en=tx(ee);var eo=this.getLinkParent(en);if(!eo)throw e4(e$,"rename",$,ee);var es=et.parent;if(es){es.deleteChild(et)}var eu=en[en.length-1];et.steps=ei(eo.steps,[eu]);eo.setChild(et.getName(),et)};$.prototype.renameSync=function($,ee){var et=tC($);var en=tC(ee);this.renameBase(et,en)};$.prototype.rename=function($,ee,et){var en=tC($);var ei=tC(ee);this.wrapAsync(this.renameBase,[en,ei],et)};$.prototype.existsBase=function($){return!!this.statBase($)};$.prototype.existsSync=function($){try{return this.existsBase(tC($))}catch($){return false}};$.prototype.exists=function($,ee){var et=this;var en=tC($);if(typeof ee!=="function")throw Error(ez.CB);ed.default(function(){try{ee(et.existsBase(en))}catch($){ee(false)}})};$.prototype.accessBase=function($,ee){var et=this.getLinkOrThrow($,"access")};$.prototype.accessSync=function($,ee){if(ee===void 0){ee=eL}var et=tC($);ee=ee|0;this.accessBase(et,ee)};$.prototype.access=function($,ee,et){var en=eL;var ei;if(typeof ee!=="function"){en=ee|0;ei=e7(et)}else{ei=ee}var eo=tC($);this.wrapAsync(this.accessBase,[eo,en],ei)};$.prototype.appendFileSync=function($,ee,et){if(et===void 0){et=td}var en=tp(et);if(!en.flag||tz($))en.flag="a";this.writeFileSync($,ee,en)};$.prototype.appendFile=function($,ee,et,en){var ei=th(et,en),eo=ei[0],es=ei[1];if(!eo.flag||tz($))eo.flag="a";this.writeFile($,ee,eo,es)};$.prototype.readdirBase=function($,ee){var et=tx($);var en=this.getResolvedLink(et);if(!en)throw e4(e$,"readdir",$);var ei=en.getNode();if(!ei.isDirectory())throw e4(eJ,"scandir",$);if(ee.withFileTypes){var eo=[];for(var es in en.children){var eu=en.getChild(es);if(!eu){continue}eo.push(el.default.build(eu,ee.encoding))}if(!eW&&ee.encoding!=="buffer")eo.sort(function($,ee){if($.name<ee.name)return-1;if($.name>ee.name)return 1;return 0});return eo}var ef=[];for(var ed in en.children){ef.push(e_.strToEncoding(ed,ee.encoding))}if(!eW&&ee.encoding!=="buffer")ef.sort();return ef};$.prototype.readdirSync=function($,ee){var et=tO(ee);var en=tC($);return this.readdirBase(en,et)};$.prototype.readdir=function($,ee,et){var en=tA(ee,et),ei=en[0],eo=en[1];var es=tC($);this.wrapAsync(this.readdirBase,[es,ei],eo)};$.prototype.readlinkBase=function($,ee){var et=this.getLinkOrThrow($,"readlink");var en=et.getNode();if(!en.isSymlink())throw e4(eG,"readlink",$);var ei=eB+en.symlink.join(eB);return e_.strToEncoding(ei,ee)};$.prototype.readlinkSync=function($,ee){var et=tr(ee);var en=tC($);return this.readlinkBase(en,et.encoding)};$.prototype.readlink=function($,ee,et){var en=tn(ee,et),ei=en[0],eo=en[1];var es=tC($);this.wrapAsync(this.readlinkBase,[es,ei.encoding],eo)};$.prototype.fsyncBase=function($){this.getFileByFdOrThrow($,"fsync")};$.prototype.fsyncSync=function($){this.fsyncBase($)};$.prototype.fsync=function($,ee){this.wrapAsync(this.fsyncBase,[$],ee)};$.prototype.fdatasyncBase=function($){this.getFileByFdOrThrow($,"fdatasync")};$.prototype.fdatasyncSync=function($){this.fdatasyncBase($)};$.prototype.fdatasync=function($,ee){this.wrapAsync(this.fdatasyncBase,[$],ee)};$.prototype.ftruncateBase=function($,ee){var et=this.getFileByFdOrThrow($,"ftruncate");et.truncate(ee)};$.prototype.ftruncateSync=function($,ee){this.ftruncateBase($,ee)};$.prototype.ftruncate=function($,ee,et){var en=typeof ee==="number"?ee:0;var ei=e7(typeof ee==="number"?et:ee);this.wrapAsync(this.ftruncateBase,[$,en],ei)};$.prototype.truncateBase=function($,ee){var et=this.openSync($,"r+");try{this.ftruncateSync(et,ee)}finally{this.closeSync(et)}};$.prototype.truncateSync=function($,ee){if(tz($))return this.ftruncateSync($,ee);this.truncateBase($,ee)};$.prototype.truncate=function($,ee,et){var en=typeof ee==="number"?ee:0;var ei=e7(typeof ee==="number"?et:ee);if(tz($))return this.ftruncate($,en,ei);this.wrapAsync(this.truncateBase,[$,en],ei)};$.prototype.futimesBase=function($,ee,et){var en=this.getFileByFdOrThrow($,"futimes");var ei=en.node;ei.atime=new Date(ee*1e3);ei.mtime=new Date(et*1e3)};$.prototype.futimesSync=function($,ee,et){this.futimesBase($,t$(ee),t$(et))};$.prototype.futimes=function($,ee,et,en){this.wrapAsync(this.futimesBase,[$,t$(ee),t$(et)],en)};$.prototype.utimesBase=function($,ee,et){var en=this.openSync($,"r+");try{this.futimesBase(en,ee,et)}finally{this.closeSync(en)}};$.prototype.utimesSync=function($,ee,et){this.utimesBase(tC($),t$(ee),t$(et))};$.prototype.utimes=function($,ee,et,en){this.wrapAsync(this.utimesBase,[tC($),t$(ee),t$(et)],en)};$.prototype.mkdirBase=function($,ee){var et=tx($);if(!et.length){throw e4(e0,"mkdir",$)}var en=this.getLinkParentAsDirOrThrow($,"mkdir");var ei=et[et.length-1];if(en.getChild(ei))throw e4(eZ,"mkdir",$);en.createChild(ei,this.createNode(true,ee))};$.prototype.mkdirpBase=function($,ee){var et=tx($);var en=this.root;for(var ei=0;ei<et.length;ei++){var eo=et[ei];if(!en.getNode().isDirectory())throw e4(eJ,"mkdir",en.getPath());var es=en.getChild(eo);if(es){if(es.getNode().isDirectory())en=es;else throw e4(eJ,"mkdir",es.getPath())}else{en=en.createChild(eo,this.createNode(true,ee))}}};$.prototype.mkdirSync=function($,ee){var et=tw(ee);var en=tH(et.mode,511);var ei=tC($);if(et.recursive)this.mkdirpBase(ei,en);else this.mkdirBase(ei,en)};$.prototype.mkdir=function($,ee,et){var en=tw(ee);var ei=e7(typeof ee==="function"?ee:et);var eo=tH(en.mode,511);var es=tC($);if(en.recursive)this.wrapAsync(this.mkdirpBase,[es,eo],ei);else this.wrapAsync(this.mkdirBase,[es,eo],ei)};$.prototype.mkdirpSync=function($,ee){this.mkdirSync($,{mode:ee,recursive:true})};$.prototype.mkdirp=function($,ee,et){var en=typeof ee==="function"?undefined:ee;var ei=e7(typeof ee==="function"?ee:et);this.mkdir($,{mode:en,recursive:true},ei)};$.prototype.mkdtempBase=function($,ee,et){if(et===void 0){et=5}var en=$+this.genRndStr();try{this.mkdirBase(en,511);return e_.strToEncoding(en,ee)}catch(en){if(en.code===eZ){if(et>1)return this.mkdtempBase($,ee,et-1);else throw Error("Could not create temp dir.")}else throw en}};$.prototype.mkdtempSync=function($,ee){var et=tr(ee).encoding;if(!$||typeof $!=="string")throw new TypeError("filename prefix is required");tj($);return this.mkdtempBase($,et)};$.prototype.mkdtemp=function($,ee,et){var en=tn(ee,et),ei=en[0].encoding,eo=en[1];if(!$||typeof $!=="string")throw new TypeError("filename prefix is required");if(!tj($))return;this.wrapAsync(this.mkdtempBase,[$,ei],eo)};$.prototype.rmdirBase=function($,ee){var et=tS(ee);var en=this.getLinkAsDirOrThrow($,"rmdir");if(en.length&&!et.recursive)throw e4(e1,"rmdir",$);this.deleteLink(en)};$.prototype.rmdirSync=function($,ee){this.rmdirBase(tC($),ee)};$.prototype.rmdir=function($,ee,et){var en=tS(ee);var ei=e7(typeof ee==="function"?ee:et);this.wrapAsync(this.rmdirBase,[tC($),en],ei)};$.prototype.fchmodBase=function($,ee){var et=this.getFileByFdOrThrow($,"fchmod");et.chmod(ee)};$.prototype.fchmodSync=function($,ee){this.fchmodBase($,tH(ee))};$.prototype.fchmod=function($,ee,et){this.wrapAsync(this.fchmodBase,[$,tH(ee)],et)};$.prototype.chmodBase=function($,ee){var et=this.openSync($,"r+");try{this.fchmodBase(et,ee)}finally{this.closeSync(et)}};$.prototype.chmodSync=function($,ee){var et=tH(ee);var en=tC($);this.chmodBase(en,et)};$.prototype.chmod=function($,ee,et){var en=tH(ee);var ei=tC($);this.wrapAsync(this.chmodBase,[ei,en],et)};$.prototype.lchmodBase=function($,ee){var et=this.openBase($,eI,0,false);try{this.fchmodBase(et,ee)}finally{this.closeSync(et)}};$.prototype.lchmodSync=function($,ee){var et=tH(ee);var en=tC($);this.lchmodBase(en,et)};$.prototype.lchmod=function($,ee,et){var en=tH(ee);var ei=tC($);this.wrapAsync(this.lchmodBase,[ei,en],et)};$.prototype.fchownBase=function($,ee,et){this.getFileByFdOrThrow($,"fchown").chown(ee,et)};$.prototype.fchownSync=function($,ee,et){tq(ee);tG(et);this.fchownBase($,ee,et)};$.prototype.fchown=function($,ee,et,en){tq(ee);tG(et);this.wrapAsync(this.fchownBase,[$,ee,et],en)};$.prototype.chownBase=function($,ee,et){var en=this.getResolvedLinkOrThrow($,"chown");var ei=en.getNode();ei.chown(ee,et)};$.prototype.chownSync=function($,ee,et){tq(ee);tG(et);this.chownBase(tC($),ee,et)};$.prototype.chown=function($,ee,et,en){tq(ee);tG(et);this.wrapAsync(this.chownBase,[tC($),ee,et],en)};$.prototype.lchownBase=function($,ee,et){this.getLinkOrThrow($,"lchown").getNode().chown(ee,et)};$.prototype.lchownSync=function($,ee,et){tq(ee);tG(et);this.lchownBase(tC($),ee,et)};$.prototype.lchown=function($,ee,et,en){tq(ee);tG(et);this.wrapAsync(this.lchownBase,[tC($),ee,et],en)};$.prototype.watchFile=function($,ee,et){var en=tC($);var ei=ee;var eo=et;if(typeof ei==="function"){eo=ee;ei=null}if(typeof eo!=="function"){throw Error('"watchFile()" requires a listener function')}var es=5007;var eu=true;if(ei&&typeof ei==="object"){if(typeof ei.interval==="number")es=ei.interval;if(typeof ei.persistent==="boolean")eu=ei.persistent}var el=this.statWatchers[en];if(!el){el=new this.StatWatcher;el.start(en,eu,es);this.statWatchers[en]=el}el.addListener("change",eo);return el};$.prototype.unwatchFile=function($,ee){var et=tC($);var en=this.statWatchers[et];if(!en)return;if(typeof ee==="function"){en.removeListener("change",ee)}else{en.removeAllListeners("change")}if(en.listenerCount("change")===0){en.stop();delete this.statWatchers[et]}};$.prototype.createReadStream=function($,ee){return new this.ReadStream($,ee)};$.prototype.createWriteStream=function($,ee){return new this.WriteStream($,ee)};$.prototype.watch=function($,ee,et){var en=tC($);var ei=ee;if(typeof ee==="function"){et=ee;ei=null}var eo=tr(ei),es=eo.persistent,eu=eo.recursive,el=eo.encoding;if(es===undefined)es=true;if(eu===undefined)eu=false;var ef=new this.FSWatcher;ef.start(en,es,eu,el);if(et){ef.addListener("change",et)}return ef};$.fd=2147483647;return $}();ee.Volume=tY;function tK($){$.emit("stop")}var tZ=function($){en(ee,$);function ee(ee){var et=$.call(this)||this;et.onInterval=function(){try{var $=et.vol.statSync(et.filename);if(et.hasChanged($)){et.emit("change",$,et.prev);et.prev=$}}finally{et.loop()}};et.vol=ee;return et}ee.prototype.loop=function(){this.timeoutRef=this.setTimeout(this.onInterval,this.interval)};ee.prototype.hasChanged=function($){if($.mtimeMs>this.prev.mtimeMs)return true;if($.nlink!==this.prev.nlink)return true;return false};ee.prototype.start=function($,ee,et){if(ee===void 0){ee=true}if(et===void 0){et=5007}this.filename=tC($);this.setTimeout=ee?setTimeout:eh.default;this.interval=et;this.prev=this.vol.statSync(this.filename);this.loop()};ee.prototype.stop=function(){clearTimeout(this.timeoutRef);ep.default.nextTick(tK,this)};return ee}(em.EventEmitter);ee.StatWatcher=tZ;var tJ;function tX($){tJ=ef.bufferAllocUnsafe($);tJ.used=0}eE.inherits(tQ,ey.Readable);ee.ReadStream=tQ;function tQ($,ee,et){if(!(this instanceof tQ))return new tQ($,ee,et);this._vol=$;et=Object.assign({},e5(et,{}));if(et.highWaterMark===undefined)et.highWaterMark=64*1024;ey.Readable.call(this,et);this.path=tC(ee);this.fd=et.fd===undefined?null:et.fd;this.flags=et.flags===undefined?"r":et.flags;this.mode=et.mode===undefined?438:et.mode;this.start=et.start;this.end=et.end;this.autoClose=et.autoClose===undefined?true:et.autoClose;this.pos=undefined;this.bytesRead=0;if(this.start!==undefined){if(typeof this.start!=="number"){throw new TypeError('"start" option must be a Number')}if(this.end===undefined){this.end=Infinity}else if(typeof this.end!=="number"){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}if(typeof this.fd!=="number")this.open();this.on("end",function(){if(this.autoClose){if(this.destroy)this.destroy()}})}tQ.prototype.open=function(){var $=this;this._vol.open(this.path,this.flags,this.mode,function(ee,et){if(ee){if($.autoClose){if($.destroy)$.destroy()}$.emit("error",ee);return}$.fd=et;$.emit("open",et);$.read()})};tQ.prototype._read=function($){if(typeof this.fd!=="number"){return this.once("open",function(){this._read($)})}if(this.destroyed)return;if(!tJ||tJ.length-tJ.used<eH){tX(this._readableState.highWaterMark)}var ee=tJ;var et=Math.min(tJ.length-tJ.used,$);var en=tJ.used;if(this.pos!==undefined)et=Math.min(this.end-this.pos+1,et);if(et<=0)return this.push(null);var ei=this;this._vol.read(this.fd,tJ,tJ.used,et,this.pos,eo);if(this.pos!==undefined)this.pos+=et;tJ.used+=et;function eo($,et){if($){if(ei.autoClose&&ei.destroy){ei.destroy()}ei.emit("error",$)}else{var eo=null;if(et>0){ei.bytesRead+=et;eo=ee.slice(en,en+et)}ei.push(eo)}}};tQ.prototype._destroy=function($,ee){this.close(function(et){ee($||et)})};tQ.prototype.close=function($){var ee=this;if($)this.once("close",$);if(this.closed||typeof this.fd!=="number"){if(typeof this.fd!=="number"){this.once("open",t0);return}return ep.default.nextTick(function(){return ee.emit("close")})}this.closed=true;this._vol.close(this.fd,function($){if($)ee.emit("error",$);else ee.emit("close")});this.fd=null};function t0($){this.close()}eE.inherits(t6,ey.Writable);ee.WriteStream=t6;function t6($,ee,et){if(!(this instanceof t6))return new t6($,ee,et);this._vol=$;et=Object.assign({},e5(et,{}));ey.Writable.call(this,et);this.path=tC(ee);this.fd=et.fd===undefined?null:et.fd;this.flags=et.flags===undefined?"w":et.flags;this.mode=et.mode===undefined?438:et.mode;this.start=et.start;this.autoClose=et.autoClose===undefined?true:!!et.autoClose;this.pos=undefined;this.bytesWritten=0;if(this.start!==undefined){if(typeof this.start!=="number"){throw new TypeError('"start" option must be a Number')}if(this.start<0){throw new Error('"start" must be >= zero')}this.pos=this.start}if(et.encoding)this.setDefaultEncoding(et.encoding);if(typeof this.fd!=="number")this.open();this.once("finish",function(){if(this.autoClose){this.close()}})}t6.prototype.open=function(){this._vol.open(this.path,this.flags,this.mode,(function($,ee){if($){if(this.autoClose&&this.destroy){this.destroy()}this.emit("error",$);return}this.fd=ee;this.emit("open",ee)}).bind(this))};t6.prototype._write=function($,ee,et){if(!($ instanceof ef.Buffer))return this.emit("error",new Error("Invalid data"));if(typeof this.fd!=="number"){return this.once("open",function(){this._write($,ee,et)})}var en=this;this._vol.write(this.fd,$,0,$.length,this.pos,function($,ee){if($){if(en.autoClose&&en.destroy){en.destroy()}return et($)}en.bytesWritten+=ee;et()});if(this.pos!==undefined)this.pos+=$.length};t6.prototype._writev=function($,ee){if(typeof this.fd!=="number"){return this.once("open",function(){this._writev($,ee)})}var et=this;var en=$.length;var ei=new Array(en);var eo=0;for(var es=0;es<en;es++){var eu=$[es].chunk;ei[es]=eu;eo+=eu.length}var el=ef.Buffer.concat(ei);this._vol.write(this.fd,el,0,el.length,this.pos,function($,en){if($){if(et.destroy)et.destroy();return ee($)}et.bytesWritten+=en;ee()});if(this.pos!==undefined)this.pos+=eo};t6.prototype._destroy=tQ.prototype._destroy;t6.prototype.close=tQ.prototype.close;t6.prototype.destroySoon=t6.prototype.end;var t4=function($){en(ee,$);function ee(ee){var et=$.call(this)||this;et._filename="";et._filenameEncoded="";et._recursive=false;et._encoding=e_.ENCODING_UTF8;et._onNodeChange=function(){et._emit("change")};et._onParentChild=function($){if($.getName()===et._getName()){et._emit("rename")}};et._emit=function($){et.emit("change",$,et._filenameEncoded)};et._persist=function(){et._timer=setTimeout(et._persist,1e6)};et._vol=ee;return et}ee.prototype._getName=function(){return this._steps[this._steps.length-1]};ee.prototype.start=function($,ee,et,en){if(ee===void 0){ee=true}if(et===void 0){et=false}if(en===void 0){en=e_.ENCODING_UTF8}this._filename=tC($);this._steps=tx(this._filename);this._filenameEncoded=e_.strToEncoding(this._filename);this._recursive=et;this._encoding=en;try{this._link=this._vol.getLinkOrThrow(this._filename,"FSWatcher")}catch($){var ei=new Error("watch "+this._filename+" "+$.code);ei.code=$.code;ei.errno=$.code;throw ei}this._link.getNode().on("change",this._onNodeChange);this._link.on("child:add",this._onNodeChange);this._link.on("child:delete",this._onNodeChange);var eo=this._link.parent;if(eo){eo.setMaxListeners(eo.getMaxListeners()+1);eo.on("child:delete",this._onParentChild)}if(ee)this._persist()};ee.prototype.close=function(){clearTimeout(this._timer);this._link.getNode().removeListener("change",this._onNodeChange);var $=this._link.parent;if($){$.removeListener("child:delete",this._onParentChild)}};return ee}(em.EventEmitter);ee.FSWatcher=t4},8012:($,ee,et)=>{"use strict";var en;var ei=et(4155);en={value:true};ee.Z4=ef;en=ed;var eo=ei.platform==="win32";function es($){var ee=$.length-1;if(ee<2){return $}while(eu($,ee)){ee--}return $.substr(0,ee+1)}function eu($,ee){var et=$[ee];return ee>0&&(et==="/"||eo&&et==="\\")}function el($,ee){if(typeof $!=="string"){throw new TypeError("expected a string")}$=$.replace(/[\\\/]+/g,"/");if(ee!==false){$=es($)}return $}function ef($){var ee=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;if(eo){$=el($,ee);return $.replace(/^([a-zA-Z]+:|\.\/)/,"")}return $}function ed($){return ef($.replace(/^\\\\\?\\.:\\/,"\\"))}},4657:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});var et=ee.fsProps=["constants","F_OK","R_OK","W_OK","X_OK","Stats"];var en=ee.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"];var ei=ee.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"]},8053:$=>{(function(){const ee=this;const et=$=>new TextEncoder().encode($);function en($,ee){if(typeof $==="string")$=et($);let en=$.length,ei=ee^en,eo=0,es;while(en>=4){es=$[eo]&255|($[++eo]&255)<<8|($[++eo]&255)<<16|($[++eo]&255)<<24;es=(es&65535)*1540483477+(((es>>>16)*1540483477&65535)<<16);es^=es>>>24;es=(es&65535)*1540483477+(((es>>>16)*1540483477&65535)<<16);ei=(ei&65535)*1540483477+(((ei>>>16)*1540483477&65535)<<16)^es;en-=4;++eo}switch(en){case 3:ei^=($[eo+2]&255)<<16;case 2:ei^=($[eo+1]&255)<<8;case 1:ei^=$[eo]&255;ei=(ei&65535)*1540483477+(((ei>>>16)*1540483477&65535)<<16)}ei^=ei>>>13;ei=(ei&65535)*1540483477+(((ei>>>16)*1540483477&65535)<<16);ei^=ei>>>15;return ei>>>0};function ei($,ee){if(typeof $==="string")$=et($);let en,ei,eo,es,eu,el,ef,ed,ep,eh;en=$.length&3;ei=$.length-en;eo=ee;eu=3432918353;ef=461845907;eh=0;while(eh<ei){ep=$[eh]&255|($[++eh]&255)<<8|($[++eh]&255)<<16|($[++eh]&255)<<24;++eh;ep=(ep&65535)*eu+(((ep>>>16)*eu&65535)<<16)&4294967295;ep=ep<<15|ep>>>17;ep=(ep&65535)*ef+(((ep>>>16)*ef&65535)<<16)&4294967295;eo^=ep;eo=eo<<13|eo>>>19;es=(eo&65535)*5+(((eo>>>16)*5&65535)<<16)&4294967295;eo=(es&65535)+27492+(((es>>>16)+58964&65535)<<16)}ep=0;switch(en){case 3:ep^=($[eh+2]&255)<<16;case 2:ep^=($[eh+1]&255)<<8;case 1:ep^=$[eh]&255;ep=(ep&65535)*eu+(((ep>>>16)*eu&65535)<<16)&4294967295;ep=ep<<15|ep>>>17;ep=(ep&65535)*ef+(((ep>>>16)*ef&65535)<<16)&4294967295;eo^=ep}eo^=$.length;eo^=eo>>>16;eo=(eo&65535)*2246822507+(((eo>>>16)*2246822507&65535)<<16)&4294967295;eo^=eo>>>13;eo=(eo&65535)*3266489909+(((eo>>>16)*3266489909&65535)<<16)&4294967295;eo^=eo>>>16;return eo>>>0}const eo=ei;eo.v2=en;eo.v3=ei;if(true){$.exports=eo}else{}})()},631:($,ee,et)=>{var en=typeof Map==="function"&&Map.prototype;var ei=Object.getOwnPropertyDescriptor&&en?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null;var eo=en&&ei&&typeof ei.get==="function"?ei.get:null;var es=en&&Map.prototype.forEach;var eu=typeof Set==="function"&&Set.prototype;var el=Object.getOwnPropertyDescriptor&&eu?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null;var ef=eu&&el&&typeof el.get==="function"?el.get:null;var ed=eu&&Set.prototype.forEach;var ep=typeof WeakMap==="function"&&WeakMap.prototype;var eh=ep?WeakMap.prototype.has:null;var ey=typeof WeakSet==="function"&&WeakSet.prototype;var eg=ey?WeakSet.prototype.has:null;var em=typeof WeakRef==="function"&&WeakRef.prototype;var e_=em?WeakRef.prototype.deref:null;var ew=Boolean.prototype.valueOf;var eE=Object.prototype.toString;var eS=Function.prototype.toString;var eT=String.prototype.match;var eO=String.prototype.slice;var eA=String.prototype.replace;var eI=String.prototype.toUpperCase;var eN=String.prototype.toLowerCase;var eD=RegExp.prototype.test;var eR=Array.prototype.concat;var eC=Array.prototype.join;var ek=Array.prototype.slice;var eM=Math.floor;var eL=typeof BigInt==="function"?BigInt.prototype.valueOf:null;var eP=Object.getOwnPropertySymbols;var eF=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?Symbol.prototype.toString:null;var eB=typeof Symbol==="function"&&typeof Symbol.iterator==="object";var eU=typeof Symbol==="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===eB?"object":"symbol")?Symbol.toStringTag:null;var ej=Object.prototype.propertyIsEnumerable;var eW=(typeof Reflect==="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function($){return $.__proto__}:null);function eH($,ee){if($===Infinity||$===-Infinity||$!==$||$&&$>-1e3&&$<1e3||eD.call(/e/,ee)){return ee}var et=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof $==="number"){var en=$<0?-eM(-$):eM($);if(en!==$){var ei=String(en);var eo=eO.call(ee,ei.length+1);return eA.call(ei,et,"$&_")+"."+eA.call(eA.call(eo,/([0-9]{3})/g,"$&_"),/_$/,"")}}return eA.call(ee,et,"$&_")}var ez=et(4654);var eV=ez.custom;var e$=e1(eV)?eV:null;$.exports=function $(ee,et,en,ei){var eu=et||{};if(e4(eu,"quoteStyle")&&eu.quoteStyle!=="single"&&eu.quoteStyle!=="double"){throw new TypeError('option "quoteStyle" must be "single" or "double"')}if(e4(eu,"maxStringLength")&&(typeof eu.maxStringLength==="number"?eu.maxStringLength<0&&eu.maxStringLength!==Infinity:eu.maxStringLength!==null)){throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`')}var el=e4(eu,"customInspect")?eu.customInspect:true;if(typeof el!=="boolean"&&el!=="symbol"){throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`")}if(e4(eu,"indent")&&eu.indent!==null&&eu.indent!==" "&&!(parseInt(eu.indent,10)===eu.indent&&eu.indent>0)){throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`')}if(e4(eu,"numericSeparator")&&typeof eu.numericSeparator!=="boolean"){throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`')}var ep=eu.numericSeparator;if(typeof ee==="undefined"){return"undefined"}if(ee===null){return"null"}if(typeof ee==="boolean"){return ee?"true":"false"}if(typeof ee==="string"){return ti(ee,eu)}if(typeof ee==="number"){if(ee===0){return Infinity/ee>0?"0":"-0"}var eh=String(ee);return ep?eH(ee,eh):eh}if(typeof ee==="bigint"){var ey=String(ee)+"n";return ep?eH(ee,ey):ey}var eg=typeof eu.depth==="undefined"?5:eu.depth;if(typeof en==="undefined"){en=0}if(en>=eg&&eg>0&&typeof ee==="object"){return eY(ee)?"[Array]":"[Object]"}var em=th(eu,en);if(typeof ei==="undefined"){ei=[]}else if(e5(ei,ee)>=0){return"[Circular]"}function e_(ee,et,eo){if(et){ei=ek.call(ei);ei.push(et)}if(eo){var es={depth:eu.depth};if(e4(eu,"quoteStyle")){es.quoteStyle=eu.quoteStyle}return $(ee,es,en+1,ei)}return $(ee,eu,en+1,ei)}if(typeof ee==="function"&&!eZ(ee)){var eE=e8(ee);var eS=tm(ee,e_);return"[Function"+(eE?": "+eE:" (anonymous)")+"]"+(eS.length>0?" { "+eC.call(eS,", ")+" }":"")}if(e1(ee)){var eT=eB?eA.call(String(ee),/^(Symbol\(.*\))_[^)]*$/,"$1"):eF.call(ee);return typeof ee==="object"&&!eB?tc(eT):eT}if(tn(ee)){var eI="<"+eN.call(String(ee.nodeName));var eD=ee.attributes||[];for(var eM=0;eM<eD.length;eM++){eI+=" "+eD[eM].name+"="+eq(eG(eD[eM].value),"double",eu)}eI+=">";if(ee.childNodes&&ee.childNodes.length){eI+="..."}eI+="</"+eN.call(String(ee.nodeName))+">";return eI}if(eY(ee)){if(ee.length===0){return"[]"}var eP=tm(ee,e_);if(em&&!tp(eP)){return"["+ty(eP,em)+"]"}return"[ "+eC.call(eP,", ")+" ]"}if(eJ(ee)){var eV=tm(ee,e_);if(!("cause"in Error.prototype)&&"cause"in ee&&!ej.call(ee,"cause")){return"{ ["+String(ee)+"] "+eC.call(eR.call("[cause]: "+e_(ee.cause),eV),", ")+" }"}if(eV.length===0){return"["+String(ee)+"]"}return"{ ["+String(ee)+"] "+eC.call(eV,", ")+" }"}if(typeof ee==="object"&&el){if(e$&&typeof ee[e$]==="function"&&ez){return ez(ee,{depth:eg-en})}else if(el!=="symbol"&&typeof ee.inspect==="function"){return ee.inspect()}}if(e9(ee)){var e6=[];if(es){es.call(ee,function($,et){e6.push(e_(et,ee,true)+" => "+e_($,ee))})}return td("Map",eo.call(ee),e6,em)}if(tt(ee)){var tu=[];if(ed){ed.call(ee,function($){tu.push(e_($,ee))})}return td("Set",ef.call(ee),tu,em)}if(e7(ee)){return tf("WeakMap")}if(tr(ee)){return tf("WeakSet")}if(te(ee)){return tf("WeakRef")}if(eQ(ee)){return tc(e_(Number(ee)))}if(e2(ee)){return tc(e_(eL.call(ee)))}if(e0(ee)){return tc(ew.call(ee))}if(eX(ee)){return tc(e_(String(ee)))}if(!eK(ee)&&!eZ(ee)){var t_=tm(ee,e_);var tv=eW?eW(ee)===Object.prototype:ee instanceof Object||ee.constructor===Object;var tw=ee instanceof Object?"":"null prototype";var tE=!tv&&eU&&Object(ee)===ee&&eU in ee?eO.call(e3(ee),8,-1):tw?"Object":"";var tS=tv||typeof ee.constructor!=="function"?"":ee.constructor.name?ee.constructor.name+" ":"";var tT=tS+(tE||tw?"["+eC.call(eR.call([],tE||[],tw||[]),": ")+"] ":"");if(t_.length===0){return tT+"{}"}if(em){return tT+"{"+ty(t_,em)+"}"}return tT+"{ "+eC.call(t_,", ")+" }"}return String(ee)};function eq($,ee,et){var en=(et.quoteStyle||ee)==="double"?'"':"'";return en+$+en}function eG($){return eA.call(String($),/"/g,""")}function eY($){return e3($)==="[object Array]"&&(!eU||!(typeof $==="object"&&eU in $))}function eK($){return e3($)==="[object Date]"&&(!eU||!(typeof $==="object"&&eU in $))}function eZ($){return e3($)==="[object RegExp]"&&(!eU||!(typeof $==="object"&&eU in $))}function eJ($){return e3($)==="[object Error]"&&(!eU||!(typeof $==="object"&&eU in $))}function eX($){return e3($)==="[object String]"&&(!eU||!(typeof $==="object"&&eU in $))}function eQ($){return e3($)==="[object Number]"&&(!eU||!(typeof $==="object"&&eU in $))}function e0($){return e3($)==="[object Boolean]"&&(!eU||!(typeof $==="object"&&eU in $))}function e1($){if(eB){return $&&typeof $==="object"&&$ instanceof Symbol}if(typeof $==="symbol"){return true}if(!$||typeof $!=="object"||!eF){return false}try{eF.call($);return true}catch($){}return false}function e2($){if(!$||typeof $!=="object"||!eL){return false}try{eL.call($);return true}catch($){}return false}var e6=Object.prototype.hasOwnProperty||function($){return $ in this};function e4($,ee){return e6.call($,ee)}function e3($){return eE.call($)}function e8($){if($.name){return $.name}var ee=eT.call(eS.call($),/^function\s*([\w$]+)/);if(ee){return ee[1]}return null}function e5($,ee){if($.indexOf){return $.indexOf(ee)}for(var et=0,en=$.length;et<en;et++){if($[et]===ee){return et}}return-1}function e9($){if(!eo||!$||typeof $!=="object"){return false}try{eo.call($);try{ef.call($)}catch($){return true}return $ instanceof Map}catch($){}return false}function e7($){if(!eh||!$||typeof $!=="object"){return false}try{eh.call($,eh);try{eg.call($,eg)}catch($){return true}return $ instanceof WeakMap}catch($){}return false}function te($){if(!e_||!$||typeof $!=="object"){return false}try{e_.call($);return true}catch($){}return false}function tt($){if(!ef||!$||typeof $!=="object"){return false}try{ef.call($);try{eo.call($)}catch($){return true}return $ instanceof Set}catch($){}return false}function tr($){if(!eg||!$||typeof $!=="object"){return false}try{eg.call($,eg);try{eh.call($,eh)}catch($){return true}return $ instanceof WeakSet}catch($){}return false}function tn($){if(!$||typeof $!=="object"){return false}if(typeof HTMLElement!=="undefined"&&$ instanceof HTMLElement){return true}return typeof $.nodeName==="string"&&typeof $.getAttribute==="function"}function ti($,ee){if($.length>ee.maxStringLength){var et=$.length-ee.maxStringLength;var en="... "+et+" more character"+(et>1?"s":"");return ti(eO.call($,0,ee.maxStringLength),ee)+en}var ei=eA.call(eA.call($,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,tu);return eq(ei,"single",ee)}function tu($){var ee=$.charCodeAt(0);var et={8:"b",9:"t",10:"n",12:"f",13:"r"}[ee];if(et){return"\\"+et}return"\\x"+(ee<16?"0":"")+eI.call(ee.toString(16))}function tc($){return"Object("+$+")"}function tf($){return $+" { ? }"}function td($,ee,et,en){var ei=en?ty(et,en):eC.call(et,", ");return $+" ("+ee+") {"+ei+"}"}function tp($){for(var ee=0;ee<$.length;ee++){if(e5($[ee],"\n")>=0){return false}}return true}function th($,ee){var et;if($.indent===" "){et=" "}else if(typeof $.indent==="number"&&$.indent>0){et=eC.call(Array($.indent+1)," ")}else{return null}return{base:et,prev:eC.call(Array(ee+1),et)}}function ty($,ee){if($.length===0){return""}var et="\n"+ee.prev+ee.base;return et+eC.call($,","+et)+"\n"+ee.prev}function tm($,ee){var et=eY($);var en=[];if(et){en.length=$.length;for(var ei=0;ei<$.length;ei++){en[ei]=e4($,ei)?ee($[ei],$):""}}var eo=typeof eP==="function"?eP($):[];var es;if(eB){es={};for(var eu=0;eu<eo.length;eu++){es["$"+eo[eu]]=eo[eu]}}for(var el in $){if(!e4($,el)){continue}if(et&&String(Number(el))===el&&el<$.length){continue}if(eB&&es["$"+el]instanceof Symbol){continue}else if(eD.call(/[^\w$]/,el)){en.push(ee(el,$)+": "+ee($[el],$))}else{en.push(el+": "+ee($[el],$))}}if(typeof eP==="function"){for(var ef=0;ef<eo.length;ef++){if(ej.call($,eo[ef])){en.push("["+ee(eo[ef])+"]: "+ee($[eo[ef]],$))}}}return en}},4244:$=>{"use strict";var ee=function($){return $!==$};$.exports=function $($,et){if($===0&&et===0){return 1/$===1/et}if($===et){return true}if(ee($)&&ee(et)){return true}return false}},609:($,ee,et)=>{"use strict";var en=et(4289);var ei=et(5559);var eo=et(4244);var es=et(5624);var eu=et(2281);var el=ei(es(),Object);en(el,{getPolyfill:es,implementation:eo,shim:eu});$.exports=el},5624:($,ee,et)=>{"use strict";var en=et(4244);$.exports=function $(){return typeof Object.is==="function"?Object.is:en}},2281:($,ee,et)=>{"use strict";var en=et(5624);var ei=et(4289);$.exports=function $(){var $=en();ei(Object,{is:$},{is:function ee(){return Object.is!==$}});return $}},8987:($,ee,et)=>{"use strict";var en;if(!Object.keys){var ei=Object.prototype.hasOwnProperty;var eo=Object.prototype.toString;var es=et(1414);var eu=Object.prototype.propertyIsEnumerable;var el=!eu.call({toString:null},"toString");var ef=eu.call(function(){},"prototype");var ed=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var ep=function($){var ee=$.constructor;return ee&&ee.prototype===$};var eh={$applicationCache:true,$console:true,$external:true,$frame:true,$frameElement:true,$frames:true,$innerHeight:true,$innerWidth:true,$onmozfullscreenchange:true,$onmozfullscreenerror:true,$outerHeight:true,$outerWidth:true,$pageXOffset:true,$pageYOffset:true,$parent:true,$scrollLeft:true,$scrollTop:true,$scrollX:true,$scrollY:true,$self:true,$webkitIndexedDB:true,$webkitStorageInfo:true,$window:true};var ey=function(){if(typeof window==="undefined"){return false}for(var $ in window){try{if(!eh["$"+$]&&ei.call(window,$)&&window[$]!==null&&typeof window[$]==="object"){try{ep(window[$])}catch($){return true}}}catch($){return true}}return false}();var eg=function($){if(typeof window==="undefined"||!ey){return ep($)}try{return ep($)}catch($){return false}};en=function $($){var ee=$!==null&&typeof $==="object";var et=eo.call($)==="[object Function]";var en=es($);var eu=ee&&eo.call($)==="[object String]";var ep=[];if(!ee&&!et&&!en){throw new TypeError("Object.keys called on a non-object")}var eh=ef&&et;if(eu&&$.length>0&&!ei.call($,0)){for(var ey=0;ey<$.length;++ey){ep.push(String(ey))}}if(en&&$.length>0){for(var em=0;em<$.length;++em){ep.push(String(em))}}else{for(var e_ in $){if(!(eh&&e_==="prototype")&&ei.call($,e_)){ep.push(String(e_))}}}if(el){var ew=eg($);for(var eE=0;eE<ed.length;++eE){if(!(ew&&ed[eE]==="constructor")&&ei.call($,ed[eE])){ep.push(ed[eE])}}}return ep}}$.exports=en},2215:($,ee,et)=>{"use strict";var en=Array.prototype.slice;var ei=et(1414);var eo=Object.keys;var es=eo?function $($){return eo($)}:et(8987);var eu=Object.keys;es.shim=function $(){if(Object.keys){var $=function(){var $=Object.keys(arguments);return $&&$.length===arguments.length}(1,2);if(!$){Object.keys=function $($){if(ei($)){return eu(en.call($))}return eu($)}}}else{Object.keys=es}return Object.keys||es};$.exports=es},1414:$=>{"use strict";var ee=Object.prototype.toString;$.exports=function $($){var et=ee.call($);var en=et==="[object Arguments]";if(!en){en=et!=="[object Array]"&&$!==null&&typeof $==="object"&&typeof $.length==="number"&&$.length>=0&&ee.call($.callee)==="[object Function]"}return en}},2837:($,ee,et)=>{"use strict";var en=et(2215);var ei=et(5419)();var eo=et(1924);var es=Object;var eu=eo("Array.prototype.push");var el=eo("Object.prototype.propertyIsEnumerable");var ef=ei?Object.getOwnPropertySymbols:null;$.exports=function $($,ee){if($==null){throw new TypeError("target must be an object")}var et=es($);if(arguments.length===1){return et}for(var eo=1;eo<arguments.length;++eo){var ed=es(arguments[eo]);var ep=en(ed);var eh=ei&&(Object.getOwnPropertySymbols||ef);if(eh){var ey=eh(ed);for(var eg=0;eg<ey.length;++eg){var em=ey[eg];if(el(ed,em)){eu(ep,em)}}}for(var e_=0;e_<ep.length;++e_){var ew=ep[e_];if(el(ed,ew)){var eE=ed[ew];et[ew]=eE}}}return et}},3533:($,ee,et)=>{"use strict";var en=et(4289);var ei=et(5559);var eo=et(2837);var es=et(8162);var eu=et(4489);var el=ei.apply(es());var ef=function $($,ee){return el(Object,arguments)};en(ef,{getPolyfill:es,implementation:eo,shim:eu});$.exports=ef},8162:($,ee,et)=>{"use strict";var en=et(2837);var ei=function(){if(!Object.assign){return false}var $="abcdefghijklmnopqrst";var ee=$.split("");var et={};for(var en=0;en<ee.length;++en){et[ee[en]]=ee[en]}var ei=Object.assign({},et);var eo="";for(var es in ei){eo+=es}return $!==eo};var eo=function(){if(!Object.assign||!Object.preventExtensions){return false}var $=Object.preventExtensions({1:2});try{Object.assign($,"xy")}catch(ee){return $[1]==="y"}return false};$.exports=function $(){if(!Object.assign){return en}if(ei()){return en}if(eo()){return en}return Object.assign}},4489:($,ee,et)=>{"use strict";var en=et(4289);var ei=et(8162);$.exports=function $(){var $=ei();en(Object,{assign:$},{assign:function(){return Object.assign!==$}});return $}},4236:($,ee)=>{"use strict";var et=typeof Uint8Array!=="undefined"&&typeof Uint16Array!=="undefined"&&typeof Int32Array!=="undefined";function en($,ee){return Object.prototype.hasOwnProperty.call($,ee)}ee.assign=function($){var ee=Array.prototype.slice.call(arguments,1);while(ee.length){var et=ee.shift();if(!et){continue}if(typeof et!=="object"){throw new TypeError(et+"must be non-object")}for(var ei in et){if(en(et,ei)){$[ei]=et[ei]}}}return $};ee.shrinkBuf=function($,ee){if($.length===ee){return $}if($.subarray){return $.subarray(0,ee)}$.length=ee;return $};var ei={arraySet:function($,ee,et,en,ei){if(ee.subarray&&$.subarray){$.set(ee.subarray(et,et+en),ei);return}for(var eo=0;eo<en;eo++){$[ei+eo]=ee[et+eo]}},flattenChunks:function($){var ee,et,en,ei,eo,es;en=0;for(ee=0,et=$.length;ee<et;ee++){en+=$[ee].length}es=new Uint8Array(en);ei=0;for(ee=0,et=$.length;ee<et;ee++){eo=$[ee];es.set(eo,ei);ei+=eo.length}return es}};var eo={arraySet:function($,ee,et,en,ei){for(var eo=0;eo<en;eo++){$[ei+eo]=ee[et+eo]}},flattenChunks:function($){return[].concat.apply([],$)}};ee.setTyped=function($){if($){ee.Buf8=Uint8Array;ee.Buf16=Uint16Array;ee.Buf32=Int32Array;ee.assign(ee,ei)}else{ee.Buf8=Array;ee.Buf16=Array;ee.Buf32=Array;ee.assign(ee,eo)}};ee.setTyped(et)},6069:$=>{"use strict";function ee($,ee,et,en){var ei=$&65535|0,eo=$>>>16&65535|0,es=0;while(et!==0){es=et>2e3?2e3:et;et-=es;do{ei=ei+ee[en++]|0;eo=eo+ei|0}while(--es)ei%=65521;eo%=65521}return ei|eo<<16|0}$.exports=ee},1619:$=>{"use strict";$.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}},2869:$=>{"use strict";function ee(){var $,ee=[];for(var et=0;et<256;et++){$=et;for(var en=0;en<8;en++){$=$&1?3988292384^$>>>1:$>>>1}ee[et]=$}return ee}var et=ee();function en($,ee,en,ei){var eo=et,es=ei+en;$^=-1;for(var eu=ei;eu<es;eu++){$=$>>>8^eo[($^ee[eu])&255]}return $^-1}$.exports=en},405:($,ee,et)=>{"use strict";var en=et(4236);var ei=et(342);var eo=et(6069);var es=et(2869);var eu=et(8898);var el=0;var ef=1;var ed=3;var ep=4;var eh=5;var ey=0;var eg=1;var em=-2;var e_=-3;var ew=-5;var eE=-1;var eS=1;var eT=2;var eO=3;var eA=4;var eI=0;var eN=2;var eD=8;var eR=9;var eC=15;var ek=8;var eM=29;var eL=256;var eP=eL+1+eM;var eF=30;var eB=19;var eU=2*eP+1;var ej=15;var eW=3;var eH=258;var ez=eH+eW+1;var eV=32;var e$=42;var eq=69;var eG=73;var eY=91;var eK=103;var eZ=113;var eJ=666;var eX=1;var eQ=2;var e0=3;var e1=4;var e2=3;function e6($,ee){$.msg=eu[ee];return ee}function e4($){return($<<1)-($>4?9:0)}function e3($){var ee=$.length;while(--ee>=0){$[ee]=0}}function e8($){var ee=$.state;var et=ee.pending;if(et>$.avail_out){et=$.avail_out}if(et===0){return}en.arraySet($.output,ee.pending_buf,ee.pending_out,et,$.next_out);$.next_out+=et;ee.pending_out+=et;$.total_out+=et;$.avail_out-=et;ee.pending-=et;if(ee.pending===0){ee.pending_out=0}}function e5($,ee){ei._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,ee);$.block_start=$.strstart;e8($.strm)}function e9($,ee){$.pending_buf[$.pending++]=ee}function e7($,ee){$.pending_buf[$.pending++]=ee>>>8&255;$.pending_buf[$.pending++]=ee&255}function te($,ee,et,ei){var eu=$.avail_in;if(eu>ei){eu=ei}if(eu===0){return 0}$.avail_in-=eu;en.arraySet(ee,$.input,$.next_in,eu,et);if($.state.wrap===1){$.adler=eo($.adler,ee,eu,et)}else if($.state.wrap===2){$.adler=es($.adler,ee,eu,et)}$.next_in+=eu;$.total_in+=eu;return eu}function tt($,ee){var et=$.max_chain_length;var en=$.strstart;var ei;var eo;var es=$.prev_length;var eu=$.nice_match;var el=$.strstart>$.w_size-ez?$.strstart-($.w_size-ez):0;var ef=$.window;var ed=$.w_mask;var ep=$.prev;var eh=$.strstart+eH;var ey=ef[en+es-1];var eg=ef[en+es];if($.prev_length>=$.good_match){et>>=2}if(eu>$.lookahead){eu=$.lookahead}do{ei=ee;if(ef[ei+es]!==eg||ef[ei+es-1]!==ey||ef[ei]!==ef[en]||ef[++ei]!==ef[en+1]){continue}en+=2;ei++;do{}while(ef[++en]===ef[++ei]&&ef[++en]===ef[++ei]&&ef[++en]===ef[++ei]&&ef[++en]===ef[++ei]&&ef[++en]===ef[++ei]&&ef[++en]===ef[++ei]&&ef[++en]===ef[++ei]&&ef[++en]===ef[++ei]&&en<eh)eo=eH-(eh-en);en=eh-eH;if(eo>es){$.match_start=ee;es=eo;if(eo>=eu){break}ey=ef[en+es-1];eg=ef[en+es]}}while((ee=ep[ee&ed])>el&&--et!==0)if(es<=$.lookahead){return es}return $.lookahead}function tr($){var ee=$.w_size;var et,ei,eo,es,eu;do{es=$.window_size-$.lookahead-$.strstart;if($.strstart>=ee+(ee-ez)){en.arraySet($.window,$.window,ee,ee,0);$.match_start-=ee;$.strstart-=ee;$.block_start-=ee;ei=$.hash_size;et=ei;do{eo=$.head[--et];$.head[et]=eo>=ee?eo-ee:0}while(--ei)ei=ee;et=ei;do{eo=$.prev[--et];$.prev[et]=eo>=ee?eo-ee:0}while(--ei)es+=ee}if($.strm.avail_in===0){break}ei=te($.strm,$.window,$.strstart+$.lookahead,es);$.lookahead+=ei;if($.lookahead+$.insert>=eW){eu=$.strstart-$.insert;$.ins_h=$.window[eu];$.ins_h=($.ins_h<<$.hash_shift^$.window[eu+1])&$.hash_mask;while($.insert){$.ins_h=($.ins_h<<$.hash_shift^$.window[eu+eW-1])&$.hash_mask;$.prev[eu&$.w_mask]=$.head[$.ins_h];$.head[$.ins_h]=eu;eu++;$.insert--;if($.lookahead+$.insert<eW){break}}}}while($.lookahead<ez&&$.strm.avail_in!==0)}function tn($,ee){var et=65535;if(et>$.pending_buf_size-5){et=$.pending_buf_size-5}for(;;){if($.lookahead<=1){tr($);if($.lookahead===0&&ee===el){return eX}if($.lookahead===0){break}}$.strstart+=$.lookahead;$.lookahead=0;var en=$.block_start+et;if($.strstart===0||$.strstart>=en){$.lookahead=$.strstart-en;$.strstart=en;e5($,false);if($.strm.avail_out===0){return eX}}if($.strstart-$.block_start>=$.w_size-ez){e5($,false);if($.strm.avail_out===0){return eX}}}$.insert=0;if(ee===ep){e5($,true);if($.strm.avail_out===0){return e0}return e1}if($.strstart>$.block_start){e5($,false);if($.strm.avail_out===0){return eX}}return eX}function ti($,ee){var et;var en;for(;;){if($.lookahead<ez){tr($);if($.lookahead<ez&&ee===el){return eX}if($.lookahead===0){break}}et=0;if($.lookahead>=eW){$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+eW-1])&$.hash_mask;et=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h];$.head[$.ins_h]=$.strstart}if(et!==0&&$.strstart-et<=$.w_size-ez){$.match_length=tt($,et)}if($.match_length>=eW){en=ei._tr_tally($,$.strstart-$.match_start,$.match_length-eW);$.lookahead-=$.match_length;if($.match_length<=$.max_lazy_match&&$.lookahead>=eW){$.match_length--;do{$.strstart++;$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+eW-1])&$.hash_mask;et=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h];$.head[$.ins_h]=$.strstart}while(--$.match_length!==0)$.strstart++}else{$.strstart+=$.match_length;$.match_length=0;$.ins_h=$.window[$.strstart];$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask}}else{en=ei._tr_tally($,0,$.window[$.strstart]);$.lookahead--;$.strstart++}if(en){e5($,false);if($.strm.avail_out===0){return eX}}}$.insert=$.strstart<eW-1?$.strstart:eW-1;if(ee===ep){e5($,true);if($.strm.avail_out===0){return e0}return e1}if($.last_lit){e5($,false);if($.strm.avail_out===0){return eX}}return eQ}function tu($,ee){var et;var en;var eo;for(;;){if($.lookahead<ez){tr($);if($.lookahead<ez&&ee===el){return eX}if($.lookahead===0){break}}et=0;if($.lookahead>=eW){$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+eW-1])&$.hash_mask;et=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h];$.head[$.ins_h]=$.strstart}$.prev_length=$.match_length;$.prev_match=$.match_start;$.match_length=eW-1;if(et!==0&&$.prev_length<$.max_lazy_match&&$.strstart-et<=$.w_size-ez){$.match_length=tt($,et);if($.match_length<=5&&($.strategy===eS||$.match_length===eW&&$.strstart-$.match_start>4096)){$.match_length=eW-1}}if($.prev_length>=eW&&$.match_length<=$.prev_length){eo=$.strstart+$.lookahead-eW;en=ei._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-eW);$.lookahead-=$.prev_length-1;$.prev_length-=2;do{if(++$.strstart<=eo){$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+eW-1])&$.hash_mask;et=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h];$.head[$.ins_h]=$.strstart}}while(--$.prev_length!==0)$.match_available=0;$.match_length=eW-1;$.strstart++;if(en){e5($,false);if($.strm.avail_out===0){return eX}}}else if($.match_available){en=ei._tr_tally($,0,$.window[$.strstart-1]);if(en){e5($,false)}$.strstart++;$.lookahead--;if($.strm.avail_out===0){return eX}}else{$.match_available=1;$.strstart++;$.lookahead--}}if($.match_available){en=ei._tr_tally($,0,$.window[$.strstart-1]);$.match_available=0}$.insert=$.strstart<eW-1?$.strstart:eW-1;if(ee===ep){e5($,true);if($.strm.avail_out===0){return e0}return e1}if($.last_lit){e5($,false);if($.strm.avail_out===0){return eX}}return eQ}function tc($,ee){var et;var en;var eo,es;var eu=$.window;for(;;){if($.lookahead<=eH){tr($);if($.lookahead<=eH&&ee===el){return eX}if($.lookahead===0){break}}$.match_length=0;if($.lookahead>=eW&&$.strstart>0){eo=$.strstart-1;en=eu[eo];if(en===eu[++eo]&&en===eu[++eo]&&en===eu[++eo]){es=$.strstart+eH;do{}while(en===eu[++eo]&&en===eu[++eo]&&en===eu[++eo]&&en===eu[++eo]&&en===eu[++eo]&&en===eu[++eo]&&en===eu[++eo]&&en===eu[++eo]&&eo<es)$.match_length=eH-(es-eo);if($.match_length>$.lookahead){$.match_length=$.lookahead}}}if($.match_length>=eW){et=ei._tr_tally($,1,$.match_length-eW);$.lookahead-=$.match_length;$.strstart+=$.match_length;$.match_length=0}else{et=ei._tr_tally($,0,$.window[$.strstart]);$.lookahead--;$.strstart++}if(et){e5($,false);if($.strm.avail_out===0){return eX}}}$.insert=0;if(ee===ep){e5($,true);if($.strm.avail_out===0){return e0}return e1}if($.last_lit){e5($,false);if($.strm.avail_out===0){return eX}}return eQ}function tf($,ee){var et;for(;;){if($.lookahead===0){tr($);if($.lookahead===0){if(ee===el){return eX}break}}$.match_length=0;et=ei._tr_tally($,0,$.window[$.strstart]);$.lookahead--;$.strstart++;if(et){e5($,false);if($.strm.avail_out===0){return eX}}}$.insert=0;if(ee===ep){e5($,true);if($.strm.avail_out===0){return e0}return e1}if($.last_lit){e5($,false);if($.strm.avail_out===0){return eX}}return eQ}function td($,ee,et,en,ei){this.good_length=$;this.max_lazy=ee;this.nice_length=et;this.max_chain=en;this.func=ei}var tp;tp=[new td(0,0,0,0,tn),new td(4,4,8,4,ti),new td(4,5,16,8,ti),new td(4,6,32,32,ti),new td(4,4,16,16,tu),new td(8,16,32,32,tu),new td(8,16,128,128,tu),new td(8,32,128,256,tu),new td(32,128,258,1024,tu),new td(32,258,258,4096,tu)];function th($){$.window_size=2*$.w_size;e3($.head);$.max_lazy_match=tp[$.level].max_lazy;$.good_match=tp[$.level].good_length;$.nice_match=tp[$.level].nice_length;$.max_chain_length=tp[$.level].max_chain;$.strstart=0;$.block_start=0;$.lookahead=0;$.insert=0;$.match_length=$.prev_length=eW-1;$.match_available=0;$.ins_h=0}function ty(){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=eD;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 en.Buf16(eU*2);this.dyn_dtree=new en.Buf16((2*eF+1)*2);this.bl_tree=new en.Buf16((2*eB+1)*2);e3(this.dyn_ltree);e3(this.dyn_dtree);e3(this.bl_tree);this.l_desc=null;this.d_desc=null;this.bl_desc=null;this.bl_count=new en.Buf16(ej+1);this.heap=new en.Buf16(2*eP+1);e3(this.heap);this.heap_len=0;this.heap_max=0;this.depth=new en.Buf16(2*eP+1);e3(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 tm($){var ee;if(!$||!$.state){return e6($,em)}$.total_in=$.total_out=0;$.data_type=eN;ee=$.state;ee.pending=0;ee.pending_out=0;if(ee.wrap<0){ee.wrap=-ee.wrap}ee.status=ee.wrap?e$:eZ;$.adler=ee.wrap===2?0:1;ee.last_flush=el;ei._tr_init(ee);return ey}function t_($){var ee=tm($);if(ee===ey){th($.state)}return ee}function tv($,ee){if(!$||!$.state){return em}if($.state.wrap!==2){return em}$.state.gzhead=ee;return ey}function tw($,ee,et,ei,eo,es){if(!$){return em}var eu=1;if(ee===eE){ee=6}if(ei<0){eu=0;ei=-ei}else if(ei>15){eu=2;ei-=16}if(eo<1||eo>eR||et!==eD||ei<8||ei>15||ee<0||ee>9||es<0||es>eA){return e6($,em)}if(ei===8){ei=9}var el=new ty;$.state=el;el.strm=$;el.wrap=eu;el.gzhead=null;el.w_bits=ei;el.w_size=1<<el.w_bits;el.w_mask=el.w_size-1;el.hash_bits=eo+7;el.hash_size=1<<el.hash_bits;el.hash_mask=el.hash_size-1;el.hash_shift=~~((el.hash_bits+eW-1)/eW);el.window=new en.Buf8(el.w_size*2);el.head=new en.Buf16(el.hash_size);el.prev=new en.Buf16(el.w_size);el.lit_bufsize=1<<eo+6;el.pending_buf_size=el.lit_bufsize*4;el.pending_buf=new en.Buf8(el.pending_buf_size);el.d_buf=1*el.lit_bufsize;el.l_buf=(1+2)*el.lit_bufsize;el.level=ee;el.strategy=es;el.method=et;return t_($)}function tE($,ee){return tw($,ee,eD,eC,ek,eI)}function tS($,ee){var et,en;var eo,eu;if(!$||!$.state||ee>eh||ee<0){return $?e6($,em):em}en=$.state;if(!$.output||!$.input&&$.avail_in!==0||en.status===eJ&&ee!==ep){return e6($,$.avail_out===0?ew:em)}en.strm=$;et=en.last_flush;en.last_flush=ee;if(en.status===e$){if(en.wrap===2){$.adler=0;e9(en,31);e9(en,139);e9(en,8);if(!en.gzhead){e9(en,0);e9(en,0);e9(en,0);e9(en,0);e9(en,0);e9(en,en.level===9?2:en.strategy>=eT||en.level<2?4:0);e9(en,e2);en.status=eZ}else{e9(en,(en.gzhead.text?1:0)+(en.gzhead.hcrc?2:0)+(!en.gzhead.extra?0:4)+(!en.gzhead.name?0:8)+(!en.gzhead.comment?0:16));e9(en,en.gzhead.time&255);e9(en,en.gzhead.time>>8&255);e9(en,en.gzhead.time>>16&255);e9(en,en.gzhead.time>>24&255);e9(en,en.level===9?2:en.strategy>=eT||en.level<2?4:0);e9(en,en.gzhead.os&255);if(en.gzhead.extra&&en.gzhead.extra.length){e9(en,en.gzhead.extra.length&255);e9(en,en.gzhead.extra.length>>8&255)}if(en.gzhead.hcrc){$.adler=es($.adler,en.pending_buf,en.pending,0)}en.gzindex=0;en.status=eq}}else{var e_=eD+(en.w_bits-8<<4)<<8;var eE=-1;if(en.strategy>=eT||en.level<2){eE=0}else if(en.level<6){eE=1}else if(en.level===6){eE=2}else{eE=3}e_|=eE<<6;if(en.strstart!==0){e_|=eV}e_+=31-e_%31;en.status=eZ;e7(en,e_);if(en.strstart!==0){e7(en,$.adler>>>16);e7(en,$.adler&65535)}$.adler=1}}if(en.status===eq){if(en.gzhead.extra){eo=en.pending;while(en.gzindex<(en.gzhead.extra.length&65535)){if(en.pending===en.pending_buf_size){if(en.gzhead.hcrc&&en.pending>eo){$.adler=es($.adler,en.pending_buf,en.pending-eo,eo)}e8($);eo=en.pending;if(en.pending===en.pending_buf_size){break}}e9(en,en.gzhead.extra[en.gzindex]&255);en.gzindex++}if(en.gzhead.hcrc&&en.pending>eo){$.adler=es($.adler,en.pending_buf,en.pending-eo,eo)}if(en.gzindex===en.gzhead.extra.length){en.gzindex=0;en.status=eG}}else{en.status=eG}}if(en.status===eG){if(en.gzhead.name){eo=en.pending;do{if(en.pending===en.pending_buf_size){if(en.gzhead.hcrc&&en.pending>eo){$.adler=es($.adler,en.pending_buf,en.pending-eo,eo)}e8($);eo=en.pending;if(en.pending===en.pending_buf_size){eu=1;break}}if(en.gzindex<en.gzhead.name.length){eu=en.gzhead.name.charCodeAt(en.gzindex++)&255}else{eu=0}e9(en,eu)}while(eu!==0)if(en.gzhead.hcrc&&en.pending>eo){$.adler=es($.adler,en.pending_buf,en.pending-eo,eo)}if(eu===0){en.gzindex=0;en.status=eY}}else{en.status=eY}}if(en.status===eY){if(en.gzhead.comment){eo=en.pending;do{if(en.pending===en.pending_buf_size){if(en.gzhead.hcrc&&en.pending>eo){$.adler=es($.adler,en.pending_buf,en.pending-eo,eo)}e8($);eo=en.pending;if(en.pending===en.pending_buf_size){eu=1;break}}if(en.gzindex<en.gzhead.comment.length){eu=en.gzhead.comment.charCodeAt(en.gzindex++)&255}else{eu=0}e9(en,eu)}while(eu!==0)if(en.gzhead.hcrc&&en.pending>eo){$.adler=es($.adler,en.pending_buf,en.pending-eo,eo)}if(eu===0){en.status=eK}}else{en.status=eK}}if(en.status===eK){if(en.gzhead.hcrc){if(en.pending+2>en.pending_buf_size){e8($)}if(en.pending+2<=en.pending_buf_size){e9(en,$.adler&255);e9(en,$.adler>>8&255);$.adler=0;en.status=eZ}}else{en.status=eZ}}if(en.pending!==0){e8($);if($.avail_out===0){en.last_flush=-1;return ey}}else if($.avail_in===0&&e4(ee)<=e4(et)&&ee!==ep){return e6($,ew)}if(en.status===eJ&&$.avail_in!==0){return e6($,ew)}if($.avail_in!==0||en.lookahead!==0||ee!==el&&en.status!==eJ){var eS=en.strategy===eT?tf(en,ee):en.strategy===eO?tc(en,ee):tp[en.level].func(en,ee);if(eS===e0||eS===e1){en.status=eJ}if(eS===eX||eS===e0){if($.avail_out===0){en.last_flush=-1}return ey}if(eS===eQ){if(ee===ef){ei._tr_align(en)}else if(ee!==eh){ei._tr_stored_block(en,0,0,false);if(ee===ed){e3(en.head);if(en.lookahead===0){en.strstart=0;en.block_start=0;en.insert=0}}}e8($);if($.avail_out===0){en.last_flush=-1;return ey}}}if(ee!==ep){return ey}if(en.wrap<=0){return eg}if(en.wrap===2){e9(en,$.adler&255);e9(en,$.adler>>8&255);e9(en,$.adler>>16&255);e9(en,$.adler>>24&255);e9(en,$.total_in&255);e9(en,$.total_in>>8&255);e9(en,$.total_in>>16&255);e9(en,$.total_in>>24&255)}else{e7(en,$.adler>>>16);e7(en,$.adler&65535)}e8($);if(en.wrap>0){en.wrap=-en.wrap}return en.pending!==0?ey:eg}function tT($){var ee;if(!$||!$.state){return em}ee=$.state.status;if(ee!==e$&&ee!==eq&&ee!==eG&&ee!==eY&&ee!==eK&&ee!==eZ&&ee!==eJ){return e6($,em)}$.state=null;return ee===eZ?e6($,e_):ey}function tO($,ee){var et=ee.length;var ei;var es,eu;var el;var ef;var ed;var ep;var eh;if(!$||!$.state){return em}ei=$.state;el=ei.wrap;if(el===2||el===1&&ei.status!==e$||ei.lookahead){return em}if(el===1){$.adler=eo($.adler,ee,et,0)}ei.wrap=0;if(et>=ei.w_size){if(el===0){e3(ei.head);ei.strstart=0;ei.block_start=0;ei.insert=0}eh=new en.Buf8(ei.w_size);en.arraySet(eh,ee,et-ei.w_size,ei.w_size,0);ee=eh;et=ei.w_size}ef=$.avail_in;ed=$.next_in;ep=$.input;$.avail_in=et;$.next_in=0;$.input=ee;tr(ei);while(ei.lookahead>=eW){es=ei.strstart;eu=ei.lookahead-(eW-1);do{ei.ins_h=(ei.ins_h<<ei.hash_shift^ei.window[es+eW-1])&ei.hash_mask;ei.prev[es&ei.w_mask]=ei.head[ei.ins_h];ei.head[ei.ins_h]=es;es++}while(--eu)ei.strstart=es;ei.lookahead=eW-1;tr(ei)}ei.strstart+=ei.lookahead;ei.block_start=ei.strstart;ei.insert=ei.lookahead;ei.lookahead=0;ei.match_length=ei.prev_length=eW-1;ei.match_available=0;$.next_in=ed;$.input=ep;$.avail_in=ef;ei.wrap=el;return ey}ee.deflateInit=tE;ee.deflateInit2=tw;ee.deflateReset=t_;ee.deflateResetKeep=tm;ee.deflateSetHeader=tv;ee.deflate=tS;ee.deflateEnd=tT;ee.deflateSetDictionary=tO;ee.deflateInfo="pako deflate (from Nodeca project)"},4264:$=>{"use strict";var ee=30;var et=12;$.exports=function $($,en){var ei;var eo;var es;var eu;var el;var ef;var ed;var ep;var eh;var ey;var eg;var em;var e_;var ew;var eE;var eS;var eT;var eO;var eA;var eI;var eN;var eD;var eR;var eC,ek;ei=$.state;eo=$.next_in;eC=$.input;es=eo+($.avail_in-5);eu=$.next_out;ek=$.output;el=eu-(en-$.avail_out);ef=eu+($.avail_out-257);ed=ei.dmax;ep=ei.wsize;eh=ei.whave;ey=ei.wnext;eg=ei.window;em=ei.hold;e_=ei.bits;ew=ei.lencode;eE=ei.distcode;eS=(1<<ei.lenbits)-1;eT=(1<<ei.distbits)-1;n:do{if(e_<15){em+=eC[eo++]<<e_;e_+=8;em+=eC[eo++]<<e_;e_+=8}eO=ew[em&eS];i:for(;;){eA=eO>>>24;em>>>=eA;e_-=eA;eA=eO>>>16&255;if(eA===0){ek[eu++]=eO&65535}else if(eA&16){eI=eO&65535;eA&=15;if(eA){if(e_<eA){em+=eC[eo++]<<e_;e_+=8}eI+=em&(1<<eA)-1;em>>>=eA;e_-=eA}if(e_<15){em+=eC[eo++]<<e_;e_+=8;em+=eC[eo++]<<e_;e_+=8}eO=eE[em&eT];a:for(;;){eA=eO>>>24;em>>>=eA;e_-=eA;eA=eO>>>16&255;if(eA&16){eN=eO&65535;eA&=15;if(e_<eA){em+=eC[eo++]<<e_;e_+=8;if(e_<eA){em+=eC[eo++]<<e_;e_+=8}}eN+=em&(1<<eA)-1;if(eN>ed){$.msg="invalid distance too far back";ei.mode=ee;break n}em>>>=eA;e_-=eA;eA=eu-el;if(eN>eA){eA=eN-eA;if(eA>eh){if(ei.sane){$.msg="invalid distance too far back";ei.mode=ee;break n}}eD=0;eR=eg;if(ey===0){eD+=ep-eA;if(eA<eI){eI-=eA;do{ek[eu++]=eg[eD++]}while(--eA)eD=eu-eN;eR=ek}}else if(ey<eA){eD+=ep+ey-eA;eA-=ey;if(eA<eI){eI-=eA;do{ek[eu++]=eg[eD++]}while(--eA)eD=0;if(ey<eI){eA=ey;eI-=eA;do{ek[eu++]=eg[eD++]}while(--eA)eD=eu-eN;eR=ek}}}else{eD+=ey-eA;if(eA<eI){eI-=eA;do{ek[eu++]=eg[eD++]}while(--eA)eD=eu-eN;eR=ek}}while(eI>2){ek[eu++]=eR[eD++];ek[eu++]=eR[eD++];ek[eu++]=eR[eD++];eI-=3}if(eI){ek[eu++]=eR[eD++];if(eI>1){ek[eu++]=eR[eD++]}}}else{eD=eu-eN;do{ek[eu++]=ek[eD++];ek[eu++]=ek[eD++];ek[eu++]=ek[eD++];eI-=3}while(eI>2)if(eI){ek[eu++]=ek[eD++];if(eI>1){ek[eu++]=ek[eD++]}}}}else if((eA&64)===0){eO=eE[(eO&65535)+(em&(1<<eA)-1)];continue a}else{$.msg="invalid distance code";ei.mode=ee;break n}break}}else if((eA&64)===0){eO=ew[(eO&65535)+(em&(1<<eA)-1)];continue i}else if(eA&32){ei.mode=et;break n}else{$.msg="invalid literal/length code";ei.mode=ee;break n}break}}while(eo<es&&eu<ef)eI=e_>>3;eo-=eI;e_-=eI<<3;em&=(1<<e_)-1;$.next_in=eo;$.next_out=eu;$.avail_in=eo<es?5+(es-eo):5-(eo-es);$.avail_out=eu<ef?257+(ef-eu):257-(eu-ef);ei.hold=em;ei.bits=e_;return}},7948:($,ee,et)=>{"use strict";var en=et(4236);var ei=et(6069);var eo=et(2869);var es=et(4264);var eu=et(9241);var el=0;var ef=1;var ed=2;var ep=4;var eh=5;var ey=6;var eg=0;var em=1;var e_=2;var ew=-2;var eE=-3;var eS=-4;var eT=-5;var eO=8;var eA=1;var eI=2;var eN=3;var eD=4;var eR=5;var eC=6;var ek=7;var eM=8;var eL=9;var eP=10;var eF=11;var eB=12;var eU=13;var ej=14;var eW=15;var eH=16;var ez=17;var eV=18;var e$=19;var eq=20;var eG=21;var eY=22;var eK=23;var eZ=24;var eJ=25;var eX=26;var eQ=27;var e0=28;var e1=29;var e2=30;var e6=31;var e4=32;var e3=852;var e8=592;var e5=15;var e9=e5;function e7($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function te(){this.mode=0;this.last=false;this.wrap=0;this.havedict=false;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 en.Buf16(320);this.work=new en.Buf16(288);this.lendyn=null;this.distdyn=null;this.sane=0;this.back=0;this.was=0}function tt($){var ee;if(!$||!$.state){return ew}ee=$.state;$.total_in=$.total_out=ee.total=0;$.msg="";if(ee.wrap){$.adler=ee.wrap&1}ee.mode=eA;ee.last=0;ee.havedict=0;ee.dmax=32768;ee.head=null;ee.hold=0;ee.bits=0;ee.lencode=ee.lendyn=new en.Buf32(e3);ee.distcode=ee.distdyn=new en.Buf32(e8);ee.sane=1;ee.back=-1;return eg}function tr($){var ee;if(!$||!$.state){return ew}ee=$.state;ee.wsize=0;ee.whave=0;ee.wnext=0;return tt($)}function tn($,ee){var et;var en;if(!$||!$.state){return ew}en=$.state;if(ee<0){et=0;ee=-ee}else{et=(ee>>4)+1;if(ee<48){ee&=15}}if(ee&&(ee<8||ee>15)){return ew}if(en.window!==null&&en.wbits!==ee){en.window=null}en.wrap=et;en.wbits=ee;return tr($)}function ti($,ee){var et;var en;if(!$){return ew}en=new te;$.state=en;en.window=null;et=tn($,ee);if(et!==eg){$.state=null}return et}function tu($){return ti($,e9)}var tc=true;var tf,td;function tp($){if(tc){var ee;tf=new en.Buf32(512);td=new en.Buf32(32);ee=0;while(ee<144){$.lens[ee++]=8}while(ee<256){$.lens[ee++]=9}while(ee<280){$.lens[ee++]=7}while(ee<288){$.lens[ee++]=8}eu(ef,$.lens,0,288,tf,0,$.work,{bits:9});ee=0;while(ee<32){$.lens[ee++]=5}eu(ed,$.lens,0,32,td,0,$.work,{bits:5});tc=false}$.lencode=tf;$.lenbits=9;$.distcode=td;$.distbits=5}function th($,ee,et,ei){var eo;var es=$.state;if(es.window===null){es.wsize=1<<es.wbits;es.wnext=0;es.whave=0;es.window=new en.Buf8(es.wsize)}if(ei>=es.wsize){en.arraySet(es.window,ee,et-es.wsize,es.wsize,0);es.wnext=0;es.whave=es.wsize}else{eo=es.wsize-es.wnext;if(eo>ei){eo=ei}en.arraySet(es.window,ee,et-ei,eo,es.wnext);ei-=eo;if(ei){en.arraySet(es.window,ee,et-ei,ei,0);es.wnext=ei;es.whave=es.wsize}else{es.wnext+=eo;if(es.wnext===es.wsize){es.wnext=0}if(es.whave<es.wsize){es.whave+=eo}}}return 0}function ty($,ee){var et;var e3,e8;var e5;var e9;var te,tt;var tr;var tn;var ti,tu;var tc;var tf;var td;var ty=0;var tm,t_,tv;var tw,tE,tS;var tT;var tO;var tA=new en.Buf8(4);var tI;var tN;var tD=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!$||!$.state||!$.output||!$.input&&$.avail_in!==0){return ew}et=$.state;if(et.mode===eB){et.mode=eU}e9=$.next_out;e8=$.output;tt=$.avail_out;e5=$.next_in;e3=$.input;te=$.avail_in;tr=et.hold;tn=et.bits;ti=te;tu=tt;tO=eg;o:for(;;){switch(et.mode){case eA:if(et.wrap===0){et.mode=eU;break}while(tn<16){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if(et.wrap&2&&tr===35615){et.check=0;tA[0]=tr&255;tA[1]=tr>>>8&255;et.check=eo(et.check,tA,2,0);tr=0;tn=0;et.mode=eI;break}et.flags=0;if(et.head){et.head.done=false}if(!(et.wrap&1)||(((tr&255)<<8)+(tr>>8))%31){$.msg="incorrect header check";et.mode=e2;break}if((tr&15)!==eO){$.msg="unknown compression method";et.mode=e2;break}tr>>>=4;tn-=4;tT=(tr&15)+8;if(et.wbits===0){et.wbits=tT}else if(tT>et.wbits){$.msg="invalid window size";et.mode=e2;break}et.dmax=1<<tT;$.adler=et.check=1;et.mode=tr&512?eP:eB;tr=0;tn=0;break;case eI:while(tn<16){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}et.flags=tr;if((et.flags&255)!==eO){$.msg="unknown compression method";et.mode=e2;break}if(et.flags&57344){$.msg="unknown header flags set";et.mode=e2;break}if(et.head){et.head.text=tr>>8&1}if(et.flags&512){tA[0]=tr&255;tA[1]=tr>>>8&255;et.check=eo(et.check,tA,2,0)}tr=0;tn=0;et.mode=eN;case eN:while(tn<32){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if(et.head){et.head.time=tr}if(et.flags&512){tA[0]=tr&255;tA[1]=tr>>>8&255;tA[2]=tr>>>16&255;tA[3]=tr>>>24&255;et.check=eo(et.check,tA,4,0)}tr=0;tn=0;et.mode=eD;case eD:while(tn<16){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if(et.head){et.head.xflags=tr&255;et.head.os=tr>>8}if(et.flags&512){tA[0]=tr&255;tA[1]=tr>>>8&255;et.check=eo(et.check,tA,2,0)}tr=0;tn=0;et.mode=eR;case eR:if(et.flags&1024){while(tn<16){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}et.length=tr;if(et.head){et.head.extra_len=tr}if(et.flags&512){tA[0]=tr&255;tA[1]=tr>>>8&255;et.check=eo(et.check,tA,2,0)}tr=0;tn=0}else if(et.head){et.head.extra=null}et.mode=eC;case eC:if(et.flags&1024){tc=et.length;if(tc>te){tc=te}if(tc){if(et.head){tT=et.head.extra_len-et.length;if(!et.head.extra){et.head.extra=new Array(et.head.extra_len)}en.arraySet(et.head.extra,e3,e5,tc,tT)}if(et.flags&512){et.check=eo(et.check,e3,tc,e5)}te-=tc;e5+=tc;et.length-=tc}if(et.length){break o}}et.length=0;et.mode=ek;case ek:if(et.flags&2048){if(te===0){break o}tc=0;do{tT=e3[e5+tc++];if(et.head&&tT&&et.length<65536){et.head.name+=String.fromCharCode(tT)}}while(tT&&tc<te)if(et.flags&512){et.check=eo(et.check,e3,tc,e5)}te-=tc;e5+=tc;if(tT){break o}}else if(et.head){et.head.name=null}et.length=0;et.mode=eM;case eM:if(et.flags&4096){if(te===0){break o}tc=0;do{tT=e3[e5+tc++];if(et.head&&tT&&et.length<65536){et.head.comment+=String.fromCharCode(tT)}}while(tT&&tc<te)if(et.flags&512){et.check=eo(et.check,e3,tc,e5)}te-=tc;e5+=tc;if(tT){break o}}else if(et.head){et.head.comment=null}et.mode=eL;case eL:if(et.flags&512){while(tn<16){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if(tr!==(et.check&65535)){$.msg="header crc mismatch";et.mode=e2;break}tr=0;tn=0}if(et.head){et.head.hcrc=et.flags>>9&1;et.head.done=true}$.adler=et.check=0;et.mode=eB;break;case eP:while(tn<32){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}$.adler=et.check=e7(tr);tr=0;tn=0;et.mode=eF;case eF:if(et.havedict===0){$.next_out=e9;$.avail_out=tt;$.next_in=e5;$.avail_in=te;et.hold=tr;et.bits=tn;return e_}$.adler=et.check=1;et.mode=eB;case eB:if(ee===eh||ee===ey){break o}case eU:if(et.last){tr>>>=tn&7;tn-=tn&7;et.mode=eQ;break}while(tn<3){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}et.last=tr&1;tr>>>=1;tn-=1;switch(tr&3){case 0:et.mode=ej;break;case 1:tp(et);et.mode=eq;if(ee===ey){tr>>>=2;tn-=2;break o}break;case 2:et.mode=ez;break;case 3:$.msg="invalid block type";et.mode=e2}tr>>>=2;tn-=2;break;case ej:tr>>>=tn&7;tn-=tn&7;while(tn<32){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if((tr&65535)!==(tr>>>16^65535)){$.msg="invalid stored block lengths";et.mode=e2;break}et.length=tr&65535;tr=0;tn=0;et.mode=eW;if(ee===ey){break o}case eW:et.mode=eH;case eH:tc=et.length;if(tc){if(tc>te){tc=te}if(tc>tt){tc=tt}if(tc===0){break o}en.arraySet(e8,e3,e5,tc,e9);te-=tc;e5+=tc;tt-=tc;e9+=tc;et.length-=tc;break}et.mode=eB;break;case ez:while(tn<14){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}et.nlen=(tr&31)+257;tr>>>=5;tn-=5;et.ndist=(tr&31)+1;tr>>>=5;tn-=5;et.ncode=(tr&15)+4;tr>>>=4;tn-=4;if(et.nlen>286||et.ndist>30){$.msg="too many length or distance symbols";et.mode=e2;break}et.have=0;et.mode=eV;case eV:while(et.have<et.ncode){while(tn<3){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}et.lens[tD[et.have++]]=tr&7;tr>>>=3;tn-=3}while(et.have<19){et.lens[tD[et.have++]]=0}et.lencode=et.lendyn;et.lenbits=7;tI={bits:et.lenbits};tO=eu(el,et.lens,0,19,et.lencode,0,et.work,tI);et.lenbits=tI.bits;if(tO){$.msg="invalid code lengths set";et.mode=e2;break}et.have=0;et.mode=e$;case e$:while(et.have<et.nlen+et.ndist){for(;;){ty=et.lencode[tr&(1<<et.lenbits)-1];tm=ty>>>24;t_=ty>>>16&255;tv=ty&65535;if(tm<=tn){break}if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if(tv<16){tr>>>=tm;tn-=tm;et.lens[et.have++]=tv}else{if(tv===16){tN=tm+2;while(tn<tN){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}tr>>>=tm;tn-=tm;if(et.have===0){$.msg="invalid bit length repeat";et.mode=e2;break}tT=et.lens[et.have-1];tc=3+(tr&3);tr>>>=2;tn-=2}else if(tv===17){tN=tm+3;while(tn<tN){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}tr>>>=tm;tn-=tm;tT=0;tc=3+(tr&7);tr>>>=3;tn-=3}else{tN=tm+7;while(tn<tN){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}tr>>>=tm;tn-=tm;tT=0;tc=11+(tr&127);tr>>>=7;tn-=7}if(et.have+tc>et.nlen+et.ndist){$.msg="invalid bit length repeat";et.mode=e2;break}while(tc--){et.lens[et.have++]=tT}}}if(et.mode===e2){break}if(et.lens[256]===0){$.msg="invalid code -- missing end-of-block";et.mode=e2;break}et.lenbits=9;tI={bits:et.lenbits};tO=eu(ef,et.lens,0,et.nlen,et.lencode,0,et.work,tI);et.lenbits=tI.bits;if(tO){$.msg="invalid literal/lengths set";et.mode=e2;break}et.distbits=6;et.distcode=et.distdyn;tI={bits:et.distbits};tO=eu(ed,et.lens,et.nlen,et.ndist,et.distcode,0,et.work,tI);et.distbits=tI.bits;if(tO){$.msg="invalid distances set";et.mode=e2;break}et.mode=eq;if(ee===ey){break o}case eq:et.mode=eG;case eG:if(te>=6&&tt>=258){$.next_out=e9;$.avail_out=tt;$.next_in=e5;$.avail_in=te;et.hold=tr;et.bits=tn;es($,tu);e9=$.next_out;e8=$.output;tt=$.avail_out;e5=$.next_in;e3=$.input;te=$.avail_in;tr=et.hold;tn=et.bits;if(et.mode===eB){et.back=-1}break}et.back=0;for(;;){ty=et.lencode[tr&(1<<et.lenbits)-1];tm=ty>>>24;t_=ty>>>16&255;tv=ty&65535;if(tm<=tn){break}if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if(t_&&(t_&240)===0){tw=tm;tE=t_;tS=tv;for(;;){ty=et.lencode[tS+((tr&(1<<tw+tE)-1)>>tw)];tm=ty>>>24;t_=ty>>>16&255;tv=ty&65535;if(tw+tm<=tn){break}if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}tr>>>=tw;tn-=tw;et.back+=tw}tr>>>=tm;tn-=tm;et.back+=tm;et.length=tv;if(t_===0){et.mode=eX;break}if(t_&32){et.back=-1;et.mode=eB;break}if(t_&64){$.msg="invalid literal/length code";et.mode=e2;break}et.extra=t_&15;et.mode=eY;case eY:if(et.extra){tN=et.extra;while(tn<tN){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}et.length+=tr&(1<<et.extra)-1;tr>>>=et.extra;tn-=et.extra;et.back+=et.extra}et.was=et.length;et.mode=eK;case eK:for(;;){ty=et.distcode[tr&(1<<et.distbits)-1];tm=ty>>>24;t_=ty>>>16&255;tv=ty&65535;if(tm<=tn){break}if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if((t_&240)===0){tw=tm;tE=t_;tS=tv;for(;;){ty=et.distcode[tS+((tr&(1<<tw+tE)-1)>>tw)];tm=ty>>>24;t_=ty>>>16&255;tv=ty&65535;if(tw+tm<=tn){break}if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}tr>>>=tw;tn-=tw;et.back+=tw}tr>>>=tm;tn-=tm;et.back+=tm;if(t_&64){$.msg="invalid distance code";et.mode=e2;break}et.offset=tv;et.extra=t_&15;et.mode=eZ;case eZ:if(et.extra){tN=et.extra;while(tn<tN){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}et.offset+=tr&(1<<et.extra)-1;tr>>>=et.extra;tn-=et.extra;et.back+=et.extra}if(et.offset>et.dmax){$.msg="invalid distance too far back";et.mode=e2;break}et.mode=eJ;case eJ:if(tt===0){break o}tc=tu-tt;if(et.offset>tc){tc=et.offset-tc;if(tc>et.whave){if(et.sane){$.msg="invalid distance too far back";et.mode=e2;break}}if(tc>et.wnext){tc-=et.wnext;tf=et.wsize-tc}else{tf=et.wnext-tc}if(tc>et.length){tc=et.length}td=et.window}else{td=e8;tf=e9-et.offset;tc=et.length}if(tc>tt){tc=tt}tt-=tc;et.length-=tc;do{e8[e9++]=td[tf++]}while(--tc)if(et.length===0){et.mode=eG}break;case eX:if(tt===0){break o}e8[e9++]=et.length;tt--;et.mode=eG;break;case eQ:if(et.wrap){while(tn<32){if(te===0){break o}te--;tr|=e3[e5++]<<tn;tn+=8}tu-=tt;$.total_out+=tu;et.total+=tu;if(tu){$.adler=et.check=et.flags?eo(et.check,e8,tu,e9-tu):ei(et.check,e8,tu,e9-tu)}tu=tt;if((et.flags?tr:e7(tr))!==et.check){$.msg="incorrect data check";et.mode=e2;break}tr=0;tn=0}et.mode=e0;case e0:if(et.wrap&&et.flags){while(tn<32){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if(tr!==(et.total&4294967295)){$.msg="incorrect length check";et.mode=e2;break}tr=0;tn=0}et.mode=e1;case e1:tO=em;break o;case e2:tO=eE;break o;case e6:return eS;case e4:default:return ew}}$.next_out=e9;$.avail_out=tt;$.next_in=e5;$.avail_in=te;et.hold=tr;et.bits=tn;if(et.wsize||tu!==$.avail_out&&et.mode<e2&&(et.mode<eQ||ee!==ep)){if(th($,$.output,$.next_out,tu-$.avail_out)){et.mode=e6;return eS}}ti-=$.avail_in;tu-=$.avail_out;$.total_in+=ti;$.total_out+=tu;et.total+=tu;if(et.wrap&&tu){$.adler=et.check=et.flags?eo(et.check,e8,tu,$.next_out-tu):ei(et.check,e8,tu,$.next_out-tu)}$.data_type=et.bits+(et.last?64:0)+(et.mode===eB?128:0)+(et.mode===eq||et.mode===eW?256:0);if((ti===0&&tu===0||ee===ep)&&tO===eg){tO=eT}return tO}function tm($){if(!$||!$.state){return ew}var ee=$.state;if(ee.window){ee.window=null}$.state=null;return eg}function t_($,ee){var et;if(!$||!$.state){return ew}et=$.state;if((et.wrap&2)===0){return ew}et.head=ee;ee.done=false;return eg}function tv($,ee){var et=ee.length;var en;var eo;var es;if(!$||!$.state){return ew}en=$.state;if(en.wrap!==0&&en.mode!==eF){return ew}if(en.mode===eF){eo=1;eo=ei(eo,ee,et,0);if(eo!==en.check){return eE}}es=th($,ee,et,et);if(es){en.mode=e6;return eS}en.havedict=1;return eg}ee.inflateReset=tr;ee.inflateReset2=tn;ee.inflateResetKeep=tt;ee.inflateInit=tu;ee.inflateInit2=ti;ee.inflate=ty;ee.inflateEnd=tm;ee.inflateGetHeader=t_;ee.inflateSetDictionary=tv;ee.inflateInfo="pako inflate (from Nodeca project)"},9241:($,ee,et)=>{"use strict";var en=et(4236);var ei=15;var eo=852;var es=592;var eu=0;var el=1;var ef=2;var ed=[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];var ep=[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];var eh=[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];var ey=[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];$.exports=function $($,ee,et,eg,em,e_,ew,eE){var eS=eE.bits;var eT=0;var eO=0;var eA=0,eI=0;var eN=0;var eD=0;var eR=0;var eC=0;var ek=0;var eM=0;var eL;var eP;var eF;var eB;var eU;var ej=null;var eW=0;var eH;var ez=new en.Buf16(ei+1);var eV=new en.Buf16(ei+1);var e$=null;var eq=0;var eG,eY,eK;for(eT=0;eT<=ei;eT++){ez[eT]=0}for(eO=0;eO<eg;eO++){ez[ee[et+eO]]++}eN=eS;for(eI=ei;eI>=1;eI--){if(ez[eI]!==0){break}}if(eN>eI){eN=eI}if(eI===0){em[e_++]=1<<24|64<<16|0;em[e_++]=1<<24|64<<16|0;eE.bits=1;return 0}for(eA=1;eA<eI;eA++){if(ez[eA]!==0){break}}if(eN<eA){eN=eA}eC=1;for(eT=1;eT<=ei;eT++){eC<<=1;eC-=ez[eT];if(eC<0){return-1}}if(eC>0&&($===eu||eI!==1)){return-1}eV[1]=0;for(eT=1;eT<ei;eT++){eV[eT+1]=eV[eT]+ez[eT]}for(eO=0;eO<eg;eO++){if(ee[et+eO]!==0){ew[eV[ee[et+eO]]++]=eO}}if($===eu){ej=e$=ew;eH=19}else if($===el){ej=ed;eW-=257;e$=ep;eq-=257;eH=256}else{ej=eh;e$=ey;eH=-1}eM=0;eO=0;eT=eA;eU=e_;eD=eN;eR=0;eF=-1;ek=1<<eN;eB=ek-1;if($===el&&ek>eo||$===ef&&ek>es){return 1}for(;;){eG=eT-eR;if(ew[eO]<eH){eY=0;eK=ew[eO]}else if(ew[eO]>eH){eY=e$[eq+ew[eO]];eK=ej[eW+ew[eO]]}else{eY=32+64;eK=0}eL=1<<eT-eR;eP=1<<eD;eA=eP;do{eP-=eL;em[eU+(eM>>eR)+eP]=eG<<24|eY<<16|eK|0}while(eP!==0)eL=1<<eT-1;while(eM&eL){eL>>=1}if(eL!==0){eM&=eL-1;eM+=eL}else{eM=0}eO++;if(--ez[eT]===0){if(eT===eI){break}eT=ee[et+ew[eO]]}if(eT>eN&&(eM&eB)!==eF){if(eR===0){eR=eN}eU+=eA;eD=eT-eR;eC=1<<eD;while(eD+eR<eI){eC-=ez[eD+eR];if(eC<=0){break}eD++;eC<<=1}ek+=1<<eD;if($===el&&ek>eo||$===ef&&ek>es){return 1}eF=eM&eB;em[eF]=eN<<24|eD<<16|eU-e_|0}}if(eM!==0){em[eU+eM]=eT-eR<<24|64<<16|0}eE.bits=eN;return 0}},8898:$=>{"use strict";$.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"}},342:($,ee,et)=>{"use strict";var en=et(4236);var ei=4;var eo=0;var es=1;var eu=2;function el($){var ee=$.length;while(--ee>=0){$[ee]=0}}var ef=0;var ed=1;var ep=2;var eh=3;var ey=258;var eg=29;var em=256;var e_=em+1+eg;var ew=30;var eE=19;var eS=2*e_+1;var eT=15;var eO=16;var eA=7;var eI=256;var eN=16;var eD=17;var eR=18;var eC=[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];var ek=[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];var eM=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];var eL=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];var eP=512;var eF=new Array((e_+2)*2);el(eF);var eB=new Array(ew*2);el(eB);var eU=new Array(eP);el(eU);var ej=new Array(ey-eh+1);el(ej);var eW=new Array(eg);el(eW);var eH=new Array(ew);el(eH);function ez($,ee,et,en,ei){this.static_tree=$;this.extra_bits=ee;this.extra_base=et;this.elems=en;this.max_length=ei;this.has_stree=$&&$.length}var eV;var e$;var eq;function eG($,ee){this.dyn_tree=$;this.max_code=0;this.stat_desc=ee}function eY($){return $<256?eU[$]:eU[256+($>>>7)]}function eK($,ee){$.pending_buf[$.pending++]=ee&255;$.pending_buf[$.pending++]=ee>>>8&255}function eZ($,ee,et){if($.bi_valid>eO-et){$.bi_buf|=ee<<$.bi_valid&65535;eK($,$.bi_buf);$.bi_buf=ee>>eO-$.bi_valid;$.bi_valid+=et-eO}else{$.bi_buf|=ee<<$.bi_valid&65535;$.bi_valid+=et}}function eJ($,ee,et){eZ($,et[ee*2],et[ee*2+1])}function eX($,ee){var et=0;do{et|=$&1;$>>>=1;et<<=1}while(--ee>0)return et>>>1}function eQ($){if($.bi_valid===16){eK($,$.bi_buf);$.bi_buf=0;$.bi_valid=0}else if($.bi_valid>=8){$.pending_buf[$.pending++]=$.bi_buf&255;$.bi_buf>>=8;$.bi_valid-=8}}function e0($,ee){var et=ee.dyn_tree;var en=ee.max_code;var ei=ee.stat_desc.static_tree;var eo=ee.stat_desc.has_stree;var es=ee.stat_desc.extra_bits;var eu=ee.stat_desc.extra_base;var el=ee.stat_desc.max_length;var ef;var ed,ep;var eh;var ey;var eg;var em=0;for(eh=0;eh<=eT;eh++){$.bl_count[eh]=0}et[$.heap[$.heap_max]*2+1]=0;for(ef=$.heap_max+1;ef<eS;ef++){ed=$.heap[ef];eh=et[et[ed*2+1]*2+1]+1;if(eh>el){eh=el;em++}et[ed*2+1]=eh;if(ed>en){continue}$.bl_count[eh]++;ey=0;if(ed>=eu){ey=es[ed-eu]}eg=et[ed*2];$.opt_len+=eg*(eh+ey);if(eo){$.static_len+=eg*(ei[ed*2+1]+ey)}}if(em===0){return}do{eh=el-1;while($.bl_count[eh]===0){eh--}$.bl_count[eh]--;$.bl_count[eh+1]+=2;$.bl_count[el]--;em-=2}while(em>0)for(eh=el;eh!==0;eh--){ed=$.bl_count[eh];while(ed!==0){ep=$.heap[--ef];if(ep>en){continue}if(et[ep*2+1]!==eh){$.opt_len+=(eh-et[ep*2+1])*et[ep*2];et[ep*2+1]=eh}ed--}}}function e1($,ee,et){var en=new Array(eT+1);var ei=0;var eo;var es;for(eo=1;eo<=eT;eo++){en[eo]=ei=ei+et[eo-1]<<1}for(es=0;es<=ee;es++){var eu=$[es*2+1];if(eu===0){continue}$[es*2]=eX(en[eu]++,eu)}}function e2(){var $;var ee;var et;var en;var ei;var eo=new Array(eT+1);et=0;for(en=0;en<eg-1;en++){eW[en]=et;for($=0;$<1<<eC[en];$++){ej[et++]=en}}ej[et-1]=en;ei=0;for(en=0;en<16;en++){eH[en]=ei;for($=0;$<1<<ek[en];$++){eU[ei++]=en}}ei>>=7;for(;en<ew;en++){eH[en]=ei<<7;for($=0;$<1<<ek[en]-7;$++){eU[256+ei++]=en}}for(ee=0;ee<=eT;ee++){eo[ee]=0}$=0;while($<=143){eF[$*2+1]=8;$++;eo[8]++}while($<=255){eF[$*2+1]=9;$++;eo[9]++}while($<=279){eF[$*2+1]=7;$++;eo[7]++}while($<=287){eF[$*2+1]=8;$++;eo[8]++}e1(eF,e_+1,eo);for($=0;$<ew;$++){eB[$*2+1]=5;eB[$*2]=eX($,5)}eV=new ez(eF,eC,em+1,e_,eT);e$=new ez(eB,ek,0,ew,eT);eq=new ez(new Array(0),eM,0,eE,eA)}function e6($){var ee;for(ee=0;ee<e_;ee++){$.dyn_ltree[ee*2]=0}for(ee=0;ee<ew;ee++){$.dyn_dtree[ee*2]=0}for(ee=0;ee<eE;ee++){$.bl_tree[ee*2]=0}$.dyn_ltree[eI*2]=1;$.opt_len=$.static_len=0;$.last_lit=$.matches=0}function e4($){if($.bi_valid>8){eK($,$.bi_buf)}else if($.bi_valid>0){$.pending_buf[$.pending++]=$.bi_buf}$.bi_buf=0;$.bi_valid=0}function e3($,ee,et,ei){e4($);if(ei){eK($,et);eK($,~et)}en.arraySet($.pending_buf,$.window,ee,et,$.pending);$.pending+=et}function e8($,ee,et,en){var ei=ee*2;var eo=et*2;return $[ei]<$[eo]||$[ei]===$[eo]&&en[ee]<=en[et]}function e5($,ee,et){var en=$.heap[et];var ei=et<<1;while(ei<=$.heap_len){if(ei<$.heap_len&&e8(ee,$.heap[ei+1],$.heap[ei],$.depth)){ei++}if(e8(ee,en,$.heap[ei],$.depth)){break}$.heap[et]=$.heap[ei];et=ei;ei<<=1}$.heap[et]=en}function e9($,ee,et){var en;var ei;var eo=0;var es;var eu;if($.last_lit!==0){do{en=$.pending_buf[$.d_buf+eo*2]<<8|$.pending_buf[$.d_buf+eo*2+1];ei=$.pending_buf[$.l_buf+eo];eo++;if(en===0){eJ($,ei,ee)}else{es=ej[ei];eJ($,es+em+1,ee);eu=eC[es];if(eu!==0){ei-=eW[es];eZ($,ei,eu)}en--;es=eY(en);eJ($,es,et);eu=ek[es];if(eu!==0){en-=eH[es];eZ($,en,eu)}}}while(eo<$.last_lit)}eJ($,eI,ee)}function e7($,ee){var et=ee.dyn_tree;var en=ee.stat_desc.static_tree;var ei=ee.stat_desc.has_stree;var eo=ee.stat_desc.elems;var es,eu;var el=-1;var ef;$.heap_len=0;$.heap_max=eS;for(es=0;es<eo;es++){if(et[es*2]!==0){$.heap[++$.heap_len]=el=es;$.depth[es]=0}else{et[es*2+1]=0}}while($.heap_len<2){ef=$.heap[++$.heap_len]=el<2?++el:0;et[ef*2]=1;$.depth[ef]=0;$.opt_len--;if(ei){$.static_len-=en[ef*2+1]}}ee.max_code=el;for(es=$.heap_len>>1;es>=1;es--){e5($,et,es)}ef=eo;do{es=$.heap[1];$.heap[1]=$.heap[$.heap_len--];e5($,et,1);eu=$.heap[1];$.heap[--$.heap_max]=es;$.heap[--$.heap_max]=eu;et[ef*2]=et[es*2]+et[eu*2];$.depth[ef]=($.depth[es]>=$.depth[eu]?$.depth[es]:$.depth[eu])+1;et[es*2+1]=et[eu*2+1]=ef;$.heap[1]=ef++;e5($,et,1)}while($.heap_len>=2)$.heap[--$.heap_max]=$.heap[1];e0($,ee);e1(et,el,$.bl_count)}function te($,ee,et){var en;var ei=-1;var eo;var es=ee[0*2+1];var eu=0;var el=7;var ef=4;if(es===0){el=138;ef=3}ee[(et+1)*2+1]=65535;for(en=0;en<=et;en++){eo=es;es=ee[(en+1)*2+1];if(++eu<el&&eo===es){continue}else if(eu<ef){$.bl_tree[eo*2]+=eu}else if(eo!==0){if(eo!==ei){$.bl_tree[eo*2]++}$.bl_tree[eN*2]++}else if(eu<=10){$.bl_tree[eD*2]++}else{$.bl_tree[eR*2]++}eu=0;ei=eo;if(es===0){el=138;ef=3}else if(eo===es){el=6;ef=3}else{el=7;ef=4}}}function tt($,ee,et){var en;var ei=-1;var eo;var es=ee[0*2+1];var eu=0;var el=7;var ef=4;if(es===0){el=138;ef=3}for(en=0;en<=et;en++){eo=es;es=ee[(en+1)*2+1];if(++eu<el&&eo===es){continue}else if(eu<ef){do{eJ($,eo,$.bl_tree)}while(--eu!==0)}else if(eo!==0){if(eo!==ei){eJ($,eo,$.bl_tree);eu--}eJ($,eN,$.bl_tree);eZ($,eu-3,2)}else if(eu<=10){eJ($,eD,$.bl_tree);eZ($,eu-3,3)}else{eJ($,eR,$.bl_tree);eZ($,eu-11,7)}eu=0;ei=eo;if(es===0){el=138;ef=3}else if(eo===es){el=6;ef=3}else{el=7;ef=4}}}function tr($){var ee;te($,$.dyn_ltree,$.l_desc.max_code);te($,$.dyn_dtree,$.d_desc.max_code);e7($,$.bl_desc);for(ee=eE-1;ee>=3;ee--){if($.bl_tree[eL[ee]*2+1]!==0){break}}$.opt_len+=3*(ee+1)+5+5+4;return ee}function tn($,ee,et,en){var ei;eZ($,ee-257,5);eZ($,et-1,5);eZ($,en-4,4);for(ei=0;ei<en;ei++){eZ($,$.bl_tree[eL[ei]*2+1],3)}tt($,$.dyn_ltree,ee-1);tt($,$.dyn_dtree,et-1)}function ti($){var ee=4093624447;var et;for(et=0;et<=31;et++,ee>>>=1){if(ee&1&&$.dyn_ltree[et*2]!==0){return eo}}if($.dyn_ltree[9*2]!==0||$.dyn_ltree[10*2]!==0||$.dyn_ltree[13*2]!==0){return es}for(et=32;et<em;et++){if($.dyn_ltree[et*2]!==0){return es}}return eo}var tu=false;function tc($){if(!tu){e2();tu=true}$.l_desc=new eG($.dyn_ltree,eV);$.d_desc=new eG($.dyn_dtree,e$);$.bl_desc=new eG($.bl_tree,eq);$.bi_buf=0;$.bi_valid=0;e6($)}function tf($,ee,et,en){eZ($,(ef<<1)+(en?1:0),3);e3($,ee,et,true)}function td($){eZ($,ed<<1,3);eJ($,eI,eF);eQ($)}function tp($,ee,et,en){var eo,es;var el=0;if($.level>0){if($.strm.data_type===eu){$.strm.data_type=ti($)}e7($,$.l_desc);e7($,$.d_desc);el=tr($);eo=$.opt_len+3+7>>>3;es=$.static_len+3+7>>>3;if(es<=eo){eo=es}}else{eo=es=et+5}if(et+4<=eo&&ee!==-1){tf($,ee,et,en)}else if($.strategy===ei||es===eo){eZ($,(ed<<1)+(en?1:0),3);e9($,eF,eB)}else{eZ($,(ep<<1)+(en?1:0),3);tn($,$.l_desc.max_code+1,$.d_desc.max_code+1,el+1);e9($,$.dyn_ltree,$.dyn_dtree)}e6($);if(en){e4($)}}function th($,ee,et){$.pending_buf[$.d_buf+$.last_lit*2]=ee>>>8&255;$.pending_buf[$.d_buf+$.last_lit*2+1]=ee&255;$.pending_buf[$.l_buf+$.last_lit]=et&255;$.last_lit++;if(ee===0){$.dyn_ltree[et*2]++}else{$.matches++;ee--;$.dyn_ltree[(ej[et]+em+1)*2]++;$.dyn_dtree[eY(ee)*2]++}return $.last_lit===$.lit_bufsize-1}ee._tr_init=tc;ee._tr_stored_block=tf;ee._tr_flush_block=tp;ee._tr_tally=th;ee._tr_align=td},2292:$=>{"use strict";function ee(){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}$.exports=ee},6470:($,ee,et)=>{"use strict";var en=et(4155);function ei($){if(typeof $!=="string"){throw new TypeError("Path must be a string. Received "+JSON.stringify($))}}function eo($,ee){var et="";var en=0;var ei=-1;var eo=0;var es;for(var eu=0;eu<=$.length;++eu){if(eu<$.length)es=$.charCodeAt(eu);else if(es===47)break;else es=47;if(es===47){if(ei===eu-1||eo===1){}else if(ei!==eu-1&&eo===2){if(et.length<2||en!==2||et.charCodeAt(et.length-1)!==46||et.charCodeAt(et.length-2)!==46){if(et.length>2){var el=et.lastIndexOf("/");if(el!==et.length-1){if(el===-1){et="";en=0}else{et=et.slice(0,el);en=et.length-1-et.lastIndexOf("/")}ei=eu;eo=0;continue}}else if(et.length===2||et.length===1){et="";en=0;ei=eu;eo=0;continue}}if(ee){if(et.length>0)et+="/..";else et="..";en=2}}else{if(et.length>0)et+="/"+$.slice(ei+1,eu);else et=$.slice(ei+1,eu);en=eu-ei-1}ei=eu;eo=0}else if(es===46&&eo!==-1){++eo}else{eo=-1}}return et}function es($,ee){var et=ee.dir||ee.root;var en=ee.base||(ee.name||"")+(ee.ext||"");if(!et){return en}if(et===ee.root){return et+en}return et+$+en}var eu={resolve:function $(){var $="";var ee=false;var et;for(var es=arguments.length-1;es>=-1&&!ee;es--){var eu;if(es>=0)eu=arguments[es];else{if(et===undefined)et=en.cwd();eu=et}ei(eu);if(eu.length===0){continue}$=eu+"/"+$;ee=eu.charCodeAt(0)===47}$=eo($,!ee);if(ee){if($.length>0)return"/"+$;else return"/"}else if($.length>0){return $}else{return"."}},normalize:function $($){ei($);if($.length===0)return".";var ee=$.charCodeAt(0)===47;var et=$.charCodeAt($.length-1)===47;$=eo($,!ee);if($.length===0&&!ee)$=".";if($.length>0&&et)$+="/";if(ee)return"/"+$;return $},isAbsolute:function $($){ei($);return $.length>0&&$.charCodeAt(0)===47},join:function $(){if(arguments.length===0)return".";var $;for(var ee=0;ee<arguments.length;++ee){var et=arguments[ee];ei(et);if(et.length>0){if($===undefined)$=et;else $+="/"+et}}if($===undefined)return".";return eu.normalize($)},relative:function $($,ee){ei($);ei(ee);if($===ee)return"";$=eu.resolve($);ee=eu.resolve(ee);if($===ee)return"";var et=1;for(;et<$.length;++et){if($.charCodeAt(et)!==47)break}var en=$.length;var eo=en-et;var es=1;for(;es<ee.length;++es){if(ee.charCodeAt(es)!==47)break}var el=ee.length;var ef=el-es;var ed=eo<ef?eo:ef;var ep=-1;var eh=0;for(;eh<=ed;++eh){if(eh===ed){if(ef>ed){if(ee.charCodeAt(es+eh)===47){return ee.slice(es+eh+1)}else if(eh===0){return ee.slice(es+eh)}}else if(eo>ed){if($.charCodeAt(et+eh)===47){ep=eh}else if(eh===0){ep=0}}break}var ey=$.charCodeAt(et+eh);var eg=ee.charCodeAt(es+eh);if(ey!==eg)break;else if(ey===47)ep=eh}var em="";for(eh=et+ep+1;eh<=en;++eh){if(eh===en||$.charCodeAt(eh)===47){if(em.length===0)em+="..";else em+="/.."}}if(em.length>0)return em+ee.slice(es+ep);else{es+=ep;if(ee.charCodeAt(es)===47)++es;return ee.slice(es)}},_makeLong:function $($){return $},dirname:function $($){ei($);if($.length===0)return".";var ee=$.charCodeAt(0);var et=ee===47;var en=-1;var eo=true;for(var es=$.length-1;es>=1;--es){ee=$.charCodeAt(es);if(ee===47){if(!eo){en=es;break}}else{eo=false}}if(en===-1)return et?"/":".";if(et&&en===1)return"//";return $.slice(0,en)},basename:function $($,ee){if(ee!==undefined&&typeof ee!=="string")throw new TypeError('"ext" argument must be a string');ei($);var et=0;var en=-1;var eo=true;var es;if(ee!==undefined&&ee.length>0&&ee.length<=$.length){if(ee.length===$.length&&ee===$)return"";var eu=ee.length-1;var el=-1;for(es=$.length-1;es>=0;--es){var ef=$.charCodeAt(es);if(ef===47){if(!eo){et=es+1;break}}else{if(el===-1){eo=false;el=es+1}if(eu>=0){if(ef===ee.charCodeAt(eu)){if(--eu===-1){en=es}}else{eu=-1;en=el}}}}if(et===en)en=el;else if(en===-1)en=$.length;return $.slice(et,en)}else{for(es=$.length-1;es>=0;--es){if($.charCodeAt(es)===47){if(!eo){et=es+1;break}}else if(en===-1){eo=false;en=es+1}}if(en===-1)return"";return $.slice(et,en)}},extname:function $($){ei($);var ee=-1;var et=0;var en=-1;var eo=true;var es=0;for(var eu=$.length-1;eu>=0;--eu){var el=$.charCodeAt(eu);if(el===47){if(!eo){et=eu+1;break}continue}if(en===-1){eo=false;en=eu+1}if(el===46){if(ee===-1)ee=eu;else if(es!==1)es=1}else if(ee!==-1){es=-1}}if(ee===-1||en===-1||es===0||es===1&&ee===en-1&&ee===et+1){return""}return $.slice(ee,en)},format:function $($){if($===null||typeof $!=="object"){throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof $)}return es("/",$)},parse:function $($){ei($);var ee={root:"",dir:"",base:"",ext:"",name:""};if($.length===0)return ee;var et=$.charCodeAt(0);var en=et===47;var eo;if(en){ee.root="/";eo=1}else{eo=0}var es=-1;var eu=0;var el=-1;var ef=true;var ed=$.length-1;var ep=0;for(;ed>=eo;--ed){et=$.charCodeAt(ed);if(et===47){if(!ef){eu=ed+1;break}continue}if(el===-1){ef=false;el=ed+1}if(et===46){if(es===-1)es=ed;else if(ep!==1)ep=1}else if(es!==-1){ep=-1}}if(es===-1||el===-1||ep===0||ep===1&&es===el-1&&es===eu+1){if(el!==-1){if(eu===0&&en)ee.base=ee.name=$.slice(1,el);else ee.base=ee.name=$.slice(eu,el)}}else{if(eu===0&&en){ee.name=$.slice(1,es);ee.base=$.slice(1,el)}else{ee.name=$.slice(eu,es);ee.base=$.slice(eu,el)}ee.ext=$.slice(es,el)}if(eu>0)ee.dir=$.slice(0,eu-1);else if(en)ee.dir="/";return ee},sep:"/",delimiter:":",win32:null,posix:null};eu.posix=eu;$.exports=eu},4155:$=>{var ee=$.exports={};var et;var en;function ei(){throw new Error("setTimeout has not been defined")}function eo(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){et=setTimeout}else{et=ei}}catch($){et=ei}try{if(typeof clearTimeout==="function"){en=clearTimeout}else{en=eo}}catch($){en=eo}})();function es($){if(et===setTimeout){return setTimeout($,0)}if((et===ei||!et)&&setTimeout){et=setTimeout;return setTimeout($,0)}try{return et($,0)}catch(ee){try{return et.call(null,$,0)}catch(ee){return et.call(this,$,0)}}}function eu($){if(en===clearTimeout){return clearTimeout($)}if((en===eo||!en)&&clearTimeout){en=clearTimeout;return clearTimeout($)}try{return en($)}catch(ee){try{return en.call(null,$)}catch(ee){return en.call(this,$)}}}var el=[];var ef=false;var ed;var ep=-1;function eh(){if(!ef||!ed){return}ef=false;if(ed.length){el=ed.concat(el)}else{ep=-1}if(el.length){ey()}}function ey(){if(ef){return}var $=es(eh);ef=true;var ee=el.length;while(ee){ed=el;el=[];while(++ep<ee){if(ed){ed[ep].run()}}ep=-1;ee=el.length}ed=null;ef=false;eu($)}ee.nextTick=function($){var ee=new Array(arguments.length-1);if(arguments.length>1){for(var et=1;et<arguments.length;et++){ee[et-1]=arguments[et]}}el.push(new eg($,ee));if(el.length===1&&!ef){es(ey)}};function eg($,ee){this.fun=$;this.array=ee}eg.prototype.run=function(){this.fun.apply(null,this.array)};ee.title="browser";ee.browser=true;ee.env={};ee.argv=[];ee.version="";ee.versions={};function em(){}ee.on=em;ee.addListener=em;ee.once=em;ee.off=em;ee.removeListener=em;ee.removeAllListeners=em;ee.emit=em;ee.prependListener=em;ee.prependOnceListener=em;ee.listeners=function($){return[]};ee.binding=function($){throw new Error("process.binding is not supported")};ee.cwd=function(){return"/"};ee.chdir=function($){throw new Error("process.chdir is not supported")};ee.umask=function(){return 0}},4281:$=>{"use strict";function ee($,ee){$.prototype=Object.create(ee.prototype);$.prototype.constructor=$;$.__proto__=ee}var et={};function en($,en,ei){if(!ei){ei=Error}function eo($,ee,et){if(typeof en==="string"){return en}else{return en($,ee,et)}}var es=function($){ee(et,$);function et(ee,et,en){return $.call(this,eo(ee,et,en))||this}return et}(ei);es.prototype.name=ei.name;es.prototype.code=$;et[$]=es}function ei($,ee){if(Array.isArray($)){var et=$.length;$=$.map(function($){return String($)});if(et>2){return"one of ".concat(ee," ").concat($.slice(0,et-1).join(", "),", or ")+$[et-1]}else if(et===2){return"one of ".concat(ee," ").concat($[0]," or ").concat($[1])}else{return"of ".concat(ee," ").concat($[0])}}else{return"of ".concat(ee," ").concat(String($))}}function eo($,ee,et){return $.substr(!et||et<0?0:+et,ee.length)===ee}function es($,ee,et){if(et===undefined||et>$.length){et=$.length}return $.substring(et-ee.length,et)===ee}function eu($,ee,et){if(typeof et!=="number"){et=0}if(et+ee.length>$.length){return false}else{return $.indexOf(ee,et)!==-1}}en("ERR_INVALID_OPT_VALUE",function($,ee){return'The value "'+ee+'" is invalid for option "'+$+'"'},TypeError);en("ERR_INVALID_ARG_TYPE",function($,ee,et){var en;if(typeof ee==="string"&&eo(ee,"not ")){en="must not be";ee=ee.replace(/^not /,"")}else{en="must be"}var el;if(es($," argument")){el="The ".concat($," ").concat(en," ").concat(ei(ee,"type"))}else{var ef=eu($,".")?"property":"argument";el='The "'.concat($,'" ').concat(ef," ").concat(en," ").concat(ei(ee,"type"))}el+=". Received type ".concat(typeof et);return el},TypeError);en("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");en("ERR_METHOD_NOT_IMPLEMENTED",function($){return"The "+$+" method is not implemented"});en("ERR_STREAM_PREMATURE_CLOSE","Premature close");en("ERR_STREAM_DESTROYED",function($){return"Cannot call "+$+" after a stream was destroyed"});en("ERR_MULTIPLE_CALLBACK","Callback called multiple times");en("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");en("ERR_STREAM_WRITE_AFTER_END","write after end");en("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);en("ERR_UNKNOWN_ENCODING",function($){return"Unknown encoding: "+$},TypeError);en("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");$.exports.q=et},6753:($,ee,et)=>{"use strict";var en=et(4155);var ei=Object.keys||function($){var ee=[];for(var et in $)ee.push(et);return ee};$.exports=ed;var eo=et(9481);var es=et(4229);et(5717)(ed,eo);{var eu=ei(es.prototype);for(var el=0;el<eu.length;el++){var ef=eu[el];if(!ed.prototype[ef])ed.prototype[ef]=es.prototype[ef]}}function ed($){if(!(this instanceof ed))return new ed($);eo.call(this,$);es.call(this,$);this.allowHalfOpen=true;if($){if($.readable===false)this.readable=false;if($.writable===false)this.writable=false;if($.allowHalfOpen===false){this.allowHalfOpen=false;this.once("end",ep)}}}Object.defineProperty(ed.prototype,"writableHighWaterMark",{enumerable:false,get:function $(){return this._writableState.highWaterMark}});Object.defineProperty(ed.prototype,"writableBuffer",{enumerable:false,get:function $(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(ed.prototype,"writableLength",{enumerable:false,get:function $(){return this._writableState.length}});function ep(){if(this._writableState.ended)return;en.nextTick(eh,this)}function eh($){$.end()}Object.defineProperty(ed.prototype,"destroyed",{enumerable:false,get:function $(){if(this._readableState===undefined||this._writableState===undefined){return false}return this._readableState.destroyed&&this._writableState.destroyed},set:function $($){if(this._readableState===undefined||this._writableState===undefined){return}this._readableState.destroyed=$;this._writableState.destroyed=$}})},2725:($,ee,et)=>{"use strict";$.exports=ei;var en=et(4605);et(5717)(ei,en);function ei($){if(!(this instanceof ei))return new ei($);en.call(this,$)}ei.prototype._transform=function($,ee,et){et(null,$)}},9481:($,ee,et)=>{"use strict";var en=et(4155);$.exports=eL;var ei;eL.ReadableState=eM;var eo=et(7187).EventEmitter;var es=function $($,ee){return $.listeners(ee).length};var eu=et(2503);var el=et(8764).Buffer;var ef=(typeof et.g!=="undefined"?et.g:typeof window!=="undefined"?window:typeof self!=="undefined"?self:{}).Uint8Array||function(){};function ed($){return el.from($)}function ep($){return el.isBuffer($)||$ instanceof ef}var eh=et(4616);var ey;if(eh&&eh.debuglog){ey=eh.debuglog("stream")}else{ey=function $(){}}var eg=et(7327);var em=et(1195);var e_=et(2457),ew=e_.getHighWaterMark;var eE=et(4281).q,eS=eE.ERR_INVALID_ARG_TYPE,eT=eE.ERR_STREAM_PUSH_AFTER_EOF,eO=eE.ERR_METHOD_NOT_IMPLEMENTED,eA=eE.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;var eI;var eN;var eD;et(5717)(eL,eu);var eR=em.errorOrDestroy;var eC=["error","close","destroy","pause","resume"];function ek($,ee,et){if(typeof $.prependListener==="function")return $.prependListener(ee,et);if(!$._events||!$._events[ee])$.on(ee,et);else if(Array.isArray($._events[ee]))$._events[ee].unshift(et);else $._events[ee]=[et,$._events[ee]]}function eM($,ee,en){ei=ei||et(6753);$=$||{};if(typeof en!=="boolean")en=ee instanceof ei;this.objectMode=!!$.objectMode;if(en)this.objectMode=this.objectMode||!!$.readableObjectMode;this.highWaterMark=ew(this,$,"readableHighWaterMark",en);this.buffer=new eg;this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=null;this.ended=false;this.endEmitted=false;this.reading=false;this.sync=true;this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.resumeScheduled=false;this.paused=true;this.emitClose=$.emitClose!==false;this.autoDestroy=!!$.autoDestroy;this.destroyed=false;this.defaultEncoding=$.defaultEncoding||"utf8";this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if($.encoding){if(!eI)eI=et(4626).s;this.decoder=new eI($.encoding);this.encoding=$.encoding}}function eL($){ei=ei||et(6753);if(!(this instanceof eL))return new eL($);var ee=this instanceof ei;this._readableState=new eM($,this,ee);this.readable=true;if($){if(typeof $.read==="function")this._read=$.read;if(typeof $.destroy==="function")this._destroy=$.destroy}eu.call(this)}Object.defineProperty(eL.prototype,"destroyed",{enumerable:false,get:function $(){if(this._readableState===undefined){return false}return this._readableState.destroyed},set:function $($){if(!this._readableState){return}this._readableState.destroyed=$}});eL.prototype.destroy=em.destroy;eL.prototype._undestroy=em.undestroy;eL.prototype._destroy=function($,ee){ee($)};eL.prototype.push=function($,ee){var et=this._readableState;var en;if(!et.objectMode){if(typeof $==="string"){ee=ee||et.defaultEncoding;if(ee!==et.encoding){$=el.from($,ee);ee=""}en=true}}else{en=true}return eP(this,$,ee,false,en)};eL.prototype.unshift=function($){return eP(this,$,null,true,false)};function eP($,ee,et,en,ei){ey("readableAddChunk",ee);var eo=$._readableState;if(ee===null){eo.reading=false;eH($,eo)}else{var es;if(!ei)es=eB(eo,ee);if(es){eR($,es)}else if(eo.objectMode||ee&&ee.length>0){if(typeof ee!=="string"&&!eo.objectMode&&Object.getPrototypeOf(ee)!==el.prototype){ee=ed(ee)}if(en){if(eo.endEmitted)eR($,new eA);else eF($,eo,ee,true)}else if(eo.ended){eR($,new eT)}else if(eo.destroyed){return false}else{eo.reading=false;if(eo.decoder&&!et){ee=eo.decoder.write(ee);if(eo.objectMode||ee.length!==0)eF($,eo,ee,false);else e$($,eo)}else{eF($,eo,ee,false)}}}else if(!en){eo.reading=false;e$($,eo)}}return!eo.ended&&(eo.length<eo.highWaterMark||eo.length===0)}function eF($,ee,et,en){if(ee.flowing&&ee.length===0&&!ee.sync){ee.awaitDrain=0;$.emit("data",et)}else{ee.length+=ee.objectMode?1:et.length;if(en)ee.buffer.unshift(et);else ee.buffer.push(et);if(ee.needReadable)ez($)}e$($,ee)}function eB($,ee){var et;if(!ep(ee)&&typeof ee!=="string"&&ee!==undefined&&!$.objectMode){et=new eS("chunk",["string","Buffer","Uint8Array"],ee)}return et}eL.prototype.isPaused=function(){return this._readableState.flowing===false};eL.prototype.setEncoding=function($){if(!eI)eI=et(4626).s;var ee=new eI($);this._readableState.decoder=ee;this._readableState.encoding=this._readableState.decoder.encoding;var en=this._readableState.buffer.head;var ei="";while(en!==null){ei+=ee.write(en.data);en=en.next}this._readableState.buffer.clear();if(ei!=="")this._readableState.buffer.push(ei);this._readableState.length=ei.length;return this};var eU=1073741824;function ej($){if($>=eU){$=eU}else{$--;$|=$>>>1;$|=$>>>2;$|=$>>>4;$|=$>>>8;$|=$>>>16;$++}return $}function eW($,ee){if($<=0||ee.length===0&&ee.ended)return 0;if(ee.objectMode)return 1;if($!==$){if(ee.flowing&&ee.length)return ee.buffer.head.data.length;else return ee.length}if($>ee.highWaterMark)ee.highWaterMark=ej($);if($<=ee.length)return $;if(!ee.ended){ee.needReadable=true;return 0}return ee.length}eL.prototype.read=function($){ey("read",$);$=parseInt($,10);var ee=this._readableState;var et=$;if($!==0)ee.emittedReadable=false;if($===0&&ee.needReadable&&((ee.highWaterMark!==0?ee.length>=ee.highWaterMark:ee.length>0)||ee.ended)){ey("read: emitReadable",ee.length,ee.ended);if(ee.length===0&&ee.ended)e0(this);else ez(this);return null}$=eW($,ee);if($===0&&ee.ended){if(ee.length===0)e0(this);return null}var en=ee.needReadable;ey("need readable",en);if(ee.length===0||ee.length-$<ee.highWaterMark){en=true;ey("length less than watermark",en)}if(ee.ended||ee.reading){en=false;ey("reading or ended",en)}else if(en){ey("do read");ee.reading=true;ee.sync=true;if(ee.length===0)ee.needReadable=true;this._read(ee.highWaterMark);ee.sync=false;if(!ee.reading)$=eW(et,ee)}var ei;if($>0)ei=eQ($,ee);else ei=null;if(ei===null){ee.needReadable=ee.length<=ee.highWaterMark;$=0}else{ee.length-=$;ee.awaitDrain=0}if(ee.length===0){if(!ee.ended)ee.needReadable=true;if(et!==$&&ee.ended)e0(this)}if(ei!==null)this.emit("data",ei);return ei};function eH($,ee){ey("onEofChunk");if(ee.ended)return;if(ee.decoder){var et=ee.decoder.end();if(et&&et.length){ee.buffer.push(et);ee.length+=ee.objectMode?1:et.length}}ee.ended=true;if(ee.sync){ez($)}else{ee.needReadable=false;if(!ee.emittedReadable){ee.emittedReadable=true;eV($)}}}function ez($){var ee=$._readableState;ey("emitReadable",ee.needReadable,ee.emittedReadable);ee.needReadable=false;if(!ee.emittedReadable){ey("emitReadable",ee.flowing);ee.emittedReadable=true;en.nextTick(eV,$)}}function eV($){var ee=$._readableState;ey("emitReadable_",ee.destroyed,ee.length,ee.ended);if(!ee.destroyed&&(ee.length||ee.ended)){$.emit("readable");ee.emittedReadable=false}ee.needReadable=!ee.flowing&&!ee.ended&&ee.length<=ee.highWaterMark;eX($)}function e$($,ee){if(!ee.readingMore){ee.readingMore=true;en.nextTick(eq,$,ee)}}function eq($,ee){while(!ee.reading&&!ee.ended&&(ee.length<ee.highWaterMark||ee.flowing&&ee.length===0)){var et=ee.length;ey("maybeReadMore read 0");$.read(0);if(et===ee.length)break}ee.readingMore=false}eL.prototype._read=function($){eR(this,new eO("_read()"))};eL.prototype.pipe=function($,ee){var et=this;var ei=this._readableState;switch(ei.pipesCount){case 0:ei.pipes=$;break;case 1:ei.pipes=[ei.pipes,$];break;default:ei.pipes.push($);break}ei.pipesCount+=1;ey("pipe count=%d opts=%j",ei.pipesCount,ee);var eo=(!ee||ee.end!==false)&&$!==en.stdout&&$!==en.stderr;var eu=eo?ef:eE;if(ei.endEmitted)en.nextTick(eu);else et.once("end",eu);$.on("unpipe",el);function el($,ee){ey("onunpipe");if($===et){if(ee&&ee.hasUnpiped===false){ee.hasUnpiped=true;eh()}}}function ef(){ey("onend");$.end()}var ed=eG(et);$.on("drain",ed);var ep=false;function eh(){ey("cleanup");$.removeListener("close",e_);$.removeListener("finish",ew);$.removeListener("drain",ed);$.removeListener("error",em);$.removeListener("unpipe",el);et.removeListener("end",ef);et.removeListener("end",eE);et.removeListener("data",eg);ep=true;if(ei.awaitDrain&&(!$._writableState||$._writableState.needDrain))ed()}et.on("data",eg);function eg(ee){ey("ondata");var en=$.write(ee);ey("dest.write",en);if(en===false){if((ei.pipesCount===1&&ei.pipes===$||ei.pipesCount>1&&e2(ei.pipes,$)!==-1)&&!ep){ey("false write response, pause",ei.awaitDrain);ei.awaitDrain++}et.pause()}}function em(ee){ey("onerror",ee);eE();$.removeListener("error",em);if(es($,"error")===0)eR($,ee)}ek($,"error",em);function e_(){$.removeListener("finish",ew);eE()}$.once("close",e_);function ew(){ey("onfinish");$.removeListener("close",e_);eE()}$.once("finish",ew);function eE(){ey("unpipe");et.unpipe($)}$.emit("pipe",et);if(!ei.flowing){ey("pipe resume");et.resume()}return $};function eG($){return function ee(){var ee=$._readableState;ey("pipeOnDrain",ee.awaitDrain);if(ee.awaitDrain)ee.awaitDrain--;if(ee.awaitDrain===0&&es($,"data")){ee.flowing=true;eX($)}}}eL.prototype.unpipe=function($){var ee=this._readableState;var et={hasUnpiped:false};if(ee.pipesCount===0)return this;if(ee.pipesCount===1){if($&&$!==ee.pipes)return this;if(!$)$=ee.pipes;ee.pipes=null;ee.pipesCount=0;ee.flowing=false;if($)$.emit("unpipe",this,et);return this}if(!$){var en=ee.pipes;var ei=ee.pipesCount;ee.pipes=null;ee.pipesCount=0;ee.flowing=false;for(var eo=0;eo<ei;eo++)en[eo].emit("unpipe",this,{hasUnpiped:false});return this}var es=e2(ee.pipes,$);if(es===-1)return this;ee.pipes.splice(es,1);ee.pipesCount-=1;if(ee.pipesCount===1)ee.pipes=ee.pipes[0];$.emit("unpipe",this,et);return this};eL.prototype.on=function($,ee){var et=eu.prototype.on.call(this,$,ee);var ei=this._readableState;if($==="data"){ei.readableListening=this.listenerCount("readable")>0;if(ei.flowing!==false)this.resume()}else if($==="readable"){if(!ei.endEmitted&&!ei.readableListening){ei.readableListening=ei.needReadable=true;ei.flowing=false;ei.emittedReadable=false;ey("on readable",ei.length,ei.reading);if(ei.length){ez(this)}else if(!ei.reading){en.nextTick(eK,this)}}}return et};eL.prototype.addListener=eL.prototype.on;eL.prototype.removeListener=function($,ee){var et=eu.prototype.removeListener.call(this,$,ee);if($==="readable"){en.nextTick(eY,this)}return et};eL.prototype.removeAllListeners=function($){var ee=eu.prototype.removeAllListeners.apply(this,arguments);if($==="readable"||$===undefined){en.nextTick(eY,this)}return ee};function eY($){var ee=$._readableState;ee.readableListening=$.listenerCount("readable")>0;if(ee.resumeScheduled&&!ee.paused){ee.flowing=true}else if($.listenerCount("data")>0){$.resume()}}function eK($){ey("readable nexttick read 0");$.read(0)}eL.prototype.resume=function(){var $=this._readableState;if(!$.flowing){ey("resume");$.flowing=!$.readableListening;eZ(this,$)}$.paused=false;return this};function eZ($,ee){if(!ee.resumeScheduled){ee.resumeScheduled=true;en.nextTick(eJ,$,ee)}}function eJ($,ee){ey("resume",ee.reading);if(!ee.reading){$.read(0)}ee.resumeScheduled=false;$.emit("resume");eX($);if(ee.flowing&&!ee.reading)$.read(0)}eL.prototype.pause=function(){ey("call pause flowing=%j",this._readableState.flowing);if(this._readableState.flowing!==false){ey("pause");this._readableState.flowing=false;this.emit("pause")}this._readableState.paused=true;return this};function eX($){var ee=$._readableState;ey("flow",ee.flowing);while(ee.flowing&&$.read()!==null);}eL.prototype.wrap=function($){var ee=this;var et=this._readableState;var en=false;$.on("end",function(){ey("wrapped end");if(et.decoder&&!et.ended){var $=et.decoder.end();if($&&$.length)ee.push($)}ee.push(null)});$.on("data",function(ei){ey("wrapped data");if(et.decoder)ei=et.decoder.write(ei);if(et.objectMode&&(ei===null||ei===undefined))return;else if(!et.objectMode&&(!ei||!ei.length))return;var eo=ee.push(ei);if(!eo){en=true;$.pause()}});for(var ei in $){if(this[ei]===undefined&&typeof $[ei]==="function"){this[ei]=function ee(ee){return function et(){return $[ee].apply($,arguments)}}(ei)}}for(var eo=0;eo<eC.length;eo++){$.on(eC[eo],this.emit.bind(this,eC[eo]))}this._read=function(ee){ey("wrapped _read",ee);if(en){en=false;$.resume()}};return this};if(typeof Symbol==="function"){eL.prototype[Symbol.asyncIterator]=function(){if(eN===undefined){eN=et(5850)}return eN(this)}}Object.defineProperty(eL.prototype,"readableHighWaterMark",{enumerable:false,get:function $(){return this._readableState.highWaterMark}});Object.defineProperty(eL.prototype,"readableBuffer",{enumerable:false,get:function $(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(eL.prototype,"readableFlowing",{enumerable:false,get:function $(){return this._readableState.flowing},set:function $($){if(this._readableState){this._readableState.flowing=$}}});eL._fromList=eQ;Object.defineProperty(eL.prototype,"readableLength",{enumerable:false,get:function $(){return this._readableState.length}});function eQ($,ee){if(ee.length===0)return null;var et;if(ee.objectMode)et=ee.buffer.shift();else if(!$||$>=ee.length){if(ee.decoder)et=ee.buffer.join("");else if(ee.buffer.length===1)et=ee.buffer.first();else et=ee.buffer.concat(ee.length);ee.buffer.clear()}else{et=ee.buffer.consume($,ee.decoder)}return et}function e0($){var ee=$._readableState;ey("endReadable",ee.endEmitted);if(!ee.endEmitted){ee.ended=true;en.nextTick(e1,ee,$)}}function e1($,ee){ey("endReadableNT",$.endEmitted,$.length);if(!$.endEmitted&&$.length===0){$.endEmitted=true;ee.readable=false;ee.emit("end");if($.autoDestroy){var et=ee._writableState;if(!et||et.autoDestroy&&et.finished){ee.destroy()}}}}if(typeof Symbol==="function"){eL.from=function($,ee){if(eD===undefined){eD=et(5167)}return eD(eL,$,ee)}}function e2($,ee){for(var et=0,en=$.length;et<en;et++){if($[et]===ee)return et}return-1}},4605:($,ee,et)=>{"use strict";$.exports=ed;var en=et(4281).q,ei=en.ERR_METHOD_NOT_IMPLEMENTED,eo=en.ERR_MULTIPLE_CALLBACK,es=en.ERR_TRANSFORM_ALREADY_TRANSFORMING,eu=en.ERR_TRANSFORM_WITH_LENGTH_0;var el=et(6753);et(5717)(ed,el);function ef($,ee){var et=this._transformState;et.transforming=false;var en=et.writecb;if(en===null){return this.emit("error",new eo)}et.writechunk=null;et.writecb=null;if(ee!=null)this.push(ee);en($);var ei=this._readableState;ei.reading=false;if(ei.needReadable||ei.length<ei.highWaterMark){this._read(ei.highWaterMark)}}function ed($){if(!(this instanceof ed))return new ed($);el.call(this,$);this._transformState={afterTransform:ef.bind(this),needTransform:false,transforming:false,writecb:null,writechunk:null,writeencoding:null};this._readableState.needReadable=true;this._readableState.sync=false;if($){if(typeof $.transform==="function")this._transform=$.transform;if(typeof $.flush==="function")this._flush=$.flush}this.on("prefinish",ep)}function ep(){var $=this;if(typeof this._flush==="function"&&!this._readableState.destroyed){this._flush(function(ee,et){eh($,ee,et)})}else{eh(this,null,null)}}ed.prototype.push=function($,ee){this._transformState.needTransform=false;return el.prototype.push.call(this,$,ee)};ed.prototype._transform=function($,ee,et){et(new ei("_transform()"))};ed.prototype._write=function($,ee,et){var en=this._transformState;en.writecb=et;en.writechunk=$;en.writeencoding=ee;if(!en.transforming){var ei=this._readableState;if(en.needTransform||ei.needReadable||ei.length<ei.highWaterMark)this._read(ei.highWaterMark)}};ed.prototype._read=function($){var ee=this._transformState;if(ee.writechunk!==null&&!ee.transforming){ee.transforming=true;this._transform(ee.writechunk,ee.writeencoding,ee.afterTransform)}else{ee.needTransform=true}};ed.prototype._destroy=function($,ee){el.prototype._destroy.call(this,$,function($){ee($)})};function eh($,ee,et){if(ee)return $.emit("error",ee);if(et!=null)$.push(et);if($._writableState.length)throw new eu;if($._transformState.transforming)throw new es;return $.push(null)}},4229:($,ee,et)=>{"use strict";var en=et(4155);$.exports=eM;function ei($,ee,et){this.chunk=$;this.encoding=ee;this.callback=et;this.next=null}function eo($){var ee=this;this.next=null;this.entry=null;this.finish=function(){eJ(ee,$)}}var es;eM.WritableState=eC;var eu={deprecate:et(4927)};var el=et(2503);var ef=et(8764).Buffer;var ed=(typeof et.g!=="undefined"?et.g:typeof window!=="undefined"?window:typeof self!=="undefined"?self:{}).Uint8Array||function(){};function ep($){return ef.from($)}function eh($){return ef.isBuffer($)||$ instanceof ed}var ey=et(1195);var eg=et(2457),em=eg.getHighWaterMark;var e_=et(4281).q,ew=e_.ERR_INVALID_ARG_TYPE,eE=e_.ERR_METHOD_NOT_IMPLEMENTED,eS=e_.ERR_MULTIPLE_CALLBACK,eT=e_.ERR_STREAM_CANNOT_PIPE,eO=e_.ERR_STREAM_DESTROYED,eA=e_.ERR_STREAM_NULL_VALUES,eI=e_.ERR_STREAM_WRITE_AFTER_END,eN=e_.ERR_UNKNOWN_ENCODING;var eD=ey.errorOrDestroy;et(5717)(eM,el);function eR(){}function eC($,ee,en){es=es||et(6753);$=$||{};if(typeof en!=="boolean")en=ee instanceof es;this.objectMode=!!$.objectMode;if(en)this.objectMode=this.objectMode||!!$.writableObjectMode;this.highWaterMark=em(this,$,"writableHighWaterMark",en);this.finalCalled=false;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;this.destroyed=false;var ei=$.decodeStrings===false;this.decodeStrings=!ei;this.defaultEncoding=$.defaultEncoding||"utf8";this.length=0;this.writing=false;this.corked=0;this.sync=true;this.bufferProcessing=false;this.onwrite=function($){eH(ee,$)};this.writecb=null;this.writelen=0;this.bufferedRequest=null;this.lastBufferedRequest=null;this.pendingcb=0;this.prefinished=false;this.errorEmitted=false;this.emitClose=$.emitClose!==false;this.autoDestroy=!!$.autoDestroy;this.bufferedRequestCount=0;this.corkedRequestsFree=new eo(this)}eC.prototype.getBuffer=function $(){var $=this.bufferedRequest;var ee=[];while($){ee.push($);$=$.next}return ee};(function(){try{Object.defineProperty(eC.prototype,"buffer",{get:eu.deprecate(function $(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer "+"instead.","DEP0003")})}catch($){}})();var ek;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function"){ek=Function.prototype[Symbol.hasInstance];Object.defineProperty(eM,Symbol.hasInstance,{value:function $($){if(ek.call(this,$))return true;if(this!==eM)return false;return $&&$._writableState instanceof eC}})}else{ek=function $($){return $ instanceof this}}function eM($){es=es||et(6753);var ee=this instanceof es;if(!ee&&!ek.call(eM,this))return new eM($);this._writableState=new eC($,this,ee);this.writable=true;if($){if(typeof $.write==="function")this._write=$.write;if(typeof $.writev==="function")this._writev=$.writev;if(typeof $.destroy==="function")this._destroy=$.destroy;if(typeof $.final==="function")this._final=$.final}el.call(this)}eM.prototype.pipe=function(){eD(this,new eT)};function eL($,ee){var et=new eI;eD($,et);en.nextTick(ee,et)}function eP($,ee,et,ei){var eo;if(et===null){eo=new eA}else if(typeof et!=="string"&&!ee.objectMode){eo=new ew("chunk",["string","Buffer"],et)}if(eo){eD($,eo);en.nextTick(ei,eo);return false}return true}eM.prototype.write=function($,ee,et){var en=this._writableState;var ei=false;var eo=!en.objectMode&&eh($);if(eo&&!ef.isBuffer($)){$=ep($)}if(typeof ee==="function"){et=ee;ee=null}if(eo)ee="buffer";else if(!ee)ee=en.defaultEncoding;if(typeof et!=="function")et=eR;if(en.ending)eL(this,et);else if(eo||eP(this,en,$,et)){en.pendingcb++;ei=eB(this,en,eo,$,ee,et)}return ei};eM.prototype.cork=function(){this._writableState.corked++};eM.prototype.uncork=function(){var $=this._writableState;if($.corked){$.corked--;if(!$.writing&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest)e$(this,$)}};eM.prototype.setDefaultEncoding=function $($){if(typeof $==="string")$=$.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf(($+"").toLowerCase())>-1))throw new eN($);this._writableState.defaultEncoding=$;return this};Object.defineProperty(eM.prototype,"writableBuffer",{enumerable:false,get:function $(){return this._writableState&&this._writableState.getBuffer()}});function eF($,ee,et){if(!$.objectMode&&$.decodeStrings!==false&&typeof ee==="string"){ee=ef.from(ee,et)}return ee}Object.defineProperty(eM.prototype,"writableHighWaterMark",{enumerable:false,get:function $(){return this._writableState.highWaterMark}});function eB($,ee,et,en,ei,eo){if(!et){var es=eF(ee,en,ei);if(en!==es){et=true;ei="buffer";en=es}}var eu=ee.objectMode?1:en.length;ee.length+=eu;var el=ee.length<ee.highWaterMark;if(!el)ee.needDrain=true;if(ee.writing||ee.corked){var ef=ee.lastBufferedRequest;ee.lastBufferedRequest={chunk:en,encoding:ei,isBuf:et,callback:eo,next:null};if(ef){ef.next=ee.lastBufferedRequest}else{ee.bufferedRequest=ee.lastBufferedRequest}ee.bufferedRequestCount+=1}else{eU($,ee,false,eu,en,ei,eo)}return el}function eU($,ee,et,en,ei,eo,es){ee.writelen=en;ee.writecb=es;ee.writing=true;ee.sync=true;if(ee.destroyed)ee.onwrite(new eO("write"));else if(et)$._writev(ei,ee.onwrite);else $._write(ei,eo,ee.onwrite);ee.sync=false}function ej($,ee,et,ei,eo){--ee.pendingcb;if(et){en.nextTick(eo,ei);en.nextTick(eK,$,ee);$._writableState.errorEmitted=true;eD($,ei)}else{eo(ei);$._writableState.errorEmitted=true;eD($,ei);eK($,ee)}}function eW($){$.writing=false;$.writecb=null;$.length-=$.writelen;$.writelen=0}function eH($,ee){var et=$._writableState;var ei=et.sync;var eo=et.writecb;if(typeof eo!=="function")throw new eS;eW(et);if(ee)ej($,et,ei,ee,eo);else{var es=eq(et)||$.destroyed;if(!es&&!et.corked&&!et.bufferProcessing&&et.bufferedRequest){e$($,et)}if(ei){en.nextTick(ez,$,et,es,eo)}else{ez($,et,es,eo)}}}function ez($,ee,et,en){if(!et)eV($,ee);ee.pendingcb--;en();eK($,ee)}function eV($,ee){if(ee.length===0&&ee.needDrain){ee.needDrain=false;$.emit("drain")}}function e$($,ee){ee.bufferProcessing=true;var et=ee.bufferedRequest;if($._writev&&et&&et.next){var en=ee.bufferedRequestCount;var ei=new Array(en);var es=ee.corkedRequestsFree;es.entry=et;var eu=0;var el=true;while(et){ei[eu]=et;if(!et.isBuf)el=false;et=et.next;eu+=1}ei.allBuffers=el;eU($,ee,true,ee.length,ei,"",es.finish);ee.pendingcb++;ee.lastBufferedRequest=null;if(es.next){ee.corkedRequestsFree=es.next;es.next=null}else{ee.corkedRequestsFree=new eo(ee)}ee.bufferedRequestCount=0}else{while(et){var ef=et.chunk;var ed=et.encoding;var ep=et.callback;var eh=ee.objectMode?1:ef.length;eU($,ee,false,eh,ef,ed,ep);et=et.next;ee.bufferedRequestCount--;if(ee.writing){break}}if(et===null)ee.lastBufferedRequest=null}ee.bufferedRequest=et;ee.bufferProcessing=false}eM.prototype._write=function($,ee,et){et(new eE("_write()"))};eM.prototype._writev=null;eM.prototype.end=function($,ee,et){var en=this._writableState;if(typeof $==="function"){et=$;$=null;ee=null}else if(typeof ee==="function"){et=ee;ee=null}if($!==null&&$!==undefined)this.write($,ee);if(en.corked){en.corked=1;this.uncork()}if(!en.ending)eZ(this,en,et);return this};Object.defineProperty(eM.prototype,"writableLength",{enumerable:false,get:function $(){return this._writableState.length}});function eq($){return $.ending&&$.length===0&&$.bufferedRequest===null&&!$.finished&&!$.writing}function eG($,ee){$._final(function(et){ee.pendingcb--;if(et){eD($,et)}ee.prefinished=true;$.emit("prefinish");eK($,ee)})}function eY($,ee){if(!ee.prefinished&&!ee.finalCalled){if(typeof $._final==="function"&&!ee.destroyed){ee.pendingcb++;ee.finalCalled=true;en.nextTick(eG,$,ee)}else{ee.prefinished=true;$.emit("prefinish")}}}function eK($,ee){var et=eq(ee);if(et){eY($,ee);if(ee.pendingcb===0){ee.finished=true;$.emit("finish");if(ee.autoDestroy){var en=$._readableState;if(!en||en.autoDestroy&&en.endEmitted){$.destroy()}}}}return et}function eZ($,ee,et){ee.ending=true;eK($,ee);if(et){if(ee.finished)en.nextTick(et);else $.once("finish",et)}ee.ended=true;$.writable=false}function eJ($,ee,et){var en=$.entry;$.entry=null;while(en){var ei=en.callback;ee.pendingcb--;ei(et);en=en.next}ee.corkedRequestsFree.next=$}Object.defineProperty(eM.prototype,"destroyed",{enumerable:false,get:function $(){if(this._writableState===undefined){return false}return this._writableState.destroyed},set:function $($){if(!this._writableState){return}this._writableState.destroyed=$}});eM.prototype.destroy=ey.destroy;eM.prototype._undestroy=ey.undestroy;eM.prototype._destroy=function($,ee){ee($)}},5850:($,ee,et)=>{"use strict";var en=et(4155);var ei;function eo($,ee,et){ee=es(ee);if(ee in $){Object.defineProperty($,ee,{value:et,enumerable:true,configurable:true,writable:true})}else{$[ee]=et}return $}function es($){var ee=eu($,"string");return typeof ee==="symbol"?ee:String(ee)}function eu($,ee){if(typeof $!=="object"||$===null)return $;var et=$[Symbol.toPrimitive];if(et!==undefined){var en=et.call($,ee||"default");if(typeof en!=="object")return en;throw new TypeError("@@toPrimitive must return a primitive value.")}return(ee==="string"?String:Number)($)}var el=et(8610);var ef=Symbol("lastResolve");var ed=Symbol("lastReject");var ep=Symbol("error");var eh=Symbol("ended");var ey=Symbol("lastPromise");var eg=Symbol("handlePromise");var em=Symbol("stream");function e_($,ee){return{value:$,done:ee}}function ew($){var ee=$[ef];if(ee!==null){var et=$[em].read();if(et!==null){$[ey]=null;$[ef]=null;$[ed]=null;ee(e_(et,false))}}}function eE($){en.nextTick(ew,$)}function eS($,ee){return function(et,en){$.then(function(){if(ee[eh]){et(e_(undefined,true));return}ee[eg](et,en)},en)}}var eT=Object.getPrototypeOf(function(){});var eO=Object.setPrototypeOf((ei={get stream(){return this[em]},next:function $(){var $=this;var ee=this[ep];if(ee!==null){return Promise.reject(ee)}if(this[eh]){return Promise.resolve(e_(undefined,true))}if(this[em].destroyed){return new Promise(function(ee,et){en.nextTick(function(){if($[ep]){et($[ep])}else{ee(e_(undefined,true))}})})}var et=this[ey];var ei;if(et){ei=new Promise(eS(et,this))}else{var eo=this[em].read();if(eo!==null){return Promise.resolve(e_(eo,false))}ei=new Promise(this[eg])}this[ey]=ei;return ei}},eo(ei,Symbol.asyncIterator,function(){return this}),eo(ei,"return",function $(){var $=this;return new Promise(function(ee,et){$[em].destroy(null,function($){if($){et($);return}ee(e_(undefined,true))})})}),ei),eT);var eA=function $($){var ee;var et=Object.create(eO,(ee={},eo(ee,em,{value:$,writable:true}),eo(ee,ef,{value:null,writable:true}),eo(ee,ed,{value:null,writable:true}),eo(ee,ep,{value:null,writable:true}),eo(ee,eh,{value:$._readableState.endEmitted,writable:true}),eo(ee,eg,{value:function $($,ee){var en=et[em].read();if(en){et[ey]=null;et[ef]=null;et[ed]=null;$(e_(en,false))}else{et[ef]=$;et[ed]=ee}},writable:true}),ee));et[ey]=null;el($,function($){if($&&$.code!=="ERR_STREAM_PREMATURE_CLOSE"){var ee=et[ed];if(ee!==null){et[ey]=null;et[ef]=null;et[ed]=null;ee($)}et[ep]=$;return}var en=et[ef];if(en!==null){et[ey]=null;et[ef]=null;et[ed]=null;en(e_(undefined,true))}et[eh]=true});$.on("readable",eE.bind(null,et));return et};$.exports=eA},7327:($,ee,et)=>{"use strict";function en($,ee){var et=Object.keys($);if(Object.getOwnPropertySymbols){var en=Object.getOwnPropertySymbols($);ee&&(en=en.filter(function(ee){return Object.getOwnPropertyDescriptor($,ee).enumerable})),et.push.apply(et,en)}return et}function ei($){for(var ee=1;ee<arguments.length;ee++){var et=null!=arguments[ee]?arguments[ee]:{};ee%2?en(Object(et),!0).forEach(function(ee){eo($,ee,et[ee])}):Object.getOwnPropertyDescriptors?Object.defineProperties($,Object.getOwnPropertyDescriptors(et)):en(Object(et)).forEach(function(ee){Object.defineProperty($,ee,Object.getOwnPropertyDescriptor(et,ee))})}return $}function eo($,ee,et){ee=ef(ee);if(ee in $){Object.defineProperty($,ee,{value:et,enumerable:true,configurable:true,writable:true})}else{$[ee]=et}return $}function es($,ee){if(!($ instanceof ee)){throw new TypeError("Cannot call a class as a function")}}function eu($,ee){for(var et=0;et<ee.length;et++){var en=ee[et];en.enumerable=en.enumerable||false;en.configurable=true;if("value"in en)en.writable=true;Object.defineProperty($,ef(en.key),en)}}function el($,ee,et){if(ee)eu($.prototype,ee);if(et)eu($,et);Object.defineProperty($,"prototype",{writable:false});return $}function ef($){var ee=ed($,"string");return typeof ee==="symbol"?ee:String(ee)}function ed($,ee){if(typeof $!=="object"||$===null)return $;var et=$[Symbol.toPrimitive];if(et!==undefined){var en=et.call($,ee||"default");if(typeof en!=="object")return en;throw new TypeError("@@toPrimitive must return a primitive value.")}return(ee==="string"?String:Number)($)}var ep=et(8764),eh=ep.Buffer;var ey=et(2361),eg=ey.inspect;var em=eg&&eg.custom||"inspect";function e_($,ee,et){eh.prototype.copy.call($,ee,et)}$.exports=function(){function $(){es(this,$);this.head=null;this.tail=null;this.length=0}el($,[{key:"push",value:function $($){var ee={data:$,next:null};if(this.length>0)this.tail.next=ee;else this.head=ee;this.tail=ee;++this.length}},{key:"unshift",value:function $($){var ee={data:$,next:this.head};if(this.length===0)this.tail=ee;this.head=ee;++this.length}},{key:"shift",value:function $(){if(this.length===0)return;var $=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return $}},{key:"clear",value:function $(){this.head=this.tail=null;this.length=0}},{key:"join",value:function $($){if(this.length===0)return"";var ee=this.head;var et=""+ee.data;while(ee=ee.next)et+=$+ee.data;return et}},{key:"concat",value:function $($){if(this.length===0)return eh.alloc(0);var ee=eh.allocUnsafe($>>>0);var et=this.head;var en=0;while(et){e_(et.data,ee,en);en+=et.data.length;et=et.next}return ee}},{key:"consume",value:function $($,ee){var et;if($<this.head.data.length){et=this.head.data.slice(0,$);this.head.data=this.head.data.slice($)}else if($===this.head.data.length){et=this.shift()}else{et=ee?this._getString($):this._getBuffer($)}return et}},{key:"first",value:function $(){return this.head.data}},{key:"_getString",value:function $($){var ee=this.head;var et=1;var en=ee.data;$-=en.length;while(ee=ee.next){var ei=ee.data;var eo=$>ei.length?ei.length:$;if(eo===ei.length)en+=ei;else en+=ei.slice(0,$);$-=eo;if($===0){if(eo===ei.length){++et;if(ee.next)this.head=ee.next;else this.head=this.tail=null}else{this.head=ee;ee.data=ei.slice(eo)}break}++et}this.length-=et;return en}},{key:"_getBuffer",value:function $($){var ee=eh.allocUnsafe($);var et=this.head;var en=1;et.data.copy(ee);$-=et.data.length;while(et=et.next){var ei=et.data;var eo=$>ei.length?ei.length:$;ei.copy(ee,ee.length-$,0,eo);$-=eo;if($===0){if(eo===ei.length){++en;if(et.next)this.head=et.next;else this.head=this.tail=null}else{this.head=et;et.data=ei.slice(eo)}break}++en}this.length-=en;return ee}},{key:em,value:function $($,ee){return eg(this,ei(ei({},ee),{},{depth:0,customInspect:false}))}}]);return $}()},1195:($,ee,et)=>{"use strict";var en=et(4155);function ei($,ee){var et=this;var ei=this._readableState&&this._readableState.destroyed;var eu=this._writableState&&this._writableState.destroyed;if(ei||eu){if(ee){ee($)}else if($){if(!this._writableState){en.nextTick(el,this,$)}else if(!this._writableState.errorEmitted){this._writableState.errorEmitted=true;en.nextTick(el,this,$)}}return this}if(this._readableState){this._readableState.destroyed=true}if(this._writableState){this._writableState.destroyed=true}this._destroy($||null,function($){if(!ee&&$){if(!et._writableState){en.nextTick(eo,et,$)}else if(!et._writableState.errorEmitted){et._writableState.errorEmitted=true;en.nextTick(eo,et,$)}else{en.nextTick(es,et)}}else if(ee){en.nextTick(es,et);ee($)}else{en.nextTick(es,et)}});return this}function eo($,ee){el($,ee);es($)}function es($){if($._writableState&&!$._writableState.emitClose)return;if($._readableState&&!$._readableState.emitClose)return;$.emit("close")}function eu(){if(this._readableState){this._readableState.destroyed=false;this._readableState.reading=false;this._readableState.ended=false;this._readableState.endEmitted=false}if(this._writableState){this._writableState.destroyed=false;this._writableState.ended=false;this._writableState.ending=false;this._writableState.finalCalled=false;this._writableState.prefinished=false;this._writableState.finished=false;this._writableState.errorEmitted=false}}function el($,ee){$.emit("error",ee)}function ef($,ee){var et=$._readableState;var en=$._writableState;if(et&&et.autoDestroy||en&&en.autoDestroy)$.destroy(ee);else $.emit("error",ee)}$.exports={destroy:ei,undestroy:eu,errorOrDestroy:ef}},8610:($,ee,et)=>{"use strict";var en=et(4281).q.ERR_STREAM_PREMATURE_CLOSE;function ei($){var ee=false;return function(){if(ee)return;ee=true;for(var et=arguments.length,en=new Array(et),ei=0;ei<et;ei++){en[ei]=arguments[ei]}$.apply(this,en)}}function eo(){}function es($){return $.setHeader&&typeof $.abort==="function"}function eu($,ee,et){if(typeof ee==="function")return eu($,null,ee);if(!ee)ee={};et=ei(et||eo);var el=ee.readable||ee.readable!==false&&$.readable;var ef=ee.writable||ee.writable!==false&&$.writable;var ed=function ee(){if(!$.writable)eh()};var ep=$._writableState&&$._writableState.finished;var eh=function ee(){ef=false;ep=true;if(!el)et.call($)};var ey=$._readableState&&$._readableState.endEmitted;var eg=function ee(){el=false;ey=true;if(!ef)et.call($)};var em=function ee(ee){et.call($,ee)};var e_=function ee(){var ee;if(el&&!ey){if(!$._readableState||!$._readableState.ended)ee=new en;return et.call($,ee)}if(ef&&!ep){if(!$._writableState||!$._writableState.ended)ee=new en;return et.call($,ee)}};var ew=function ee(){$.req.on("finish",eh)};if(es($)){$.on("complete",eh);$.on("abort",e_);if($.req)ew();else $.on("request",ew)}else if(ef&&!$._writableState){$.on("end",ed);$.on("close",ed)}$.on("end",eg);$.on("finish",eh);if(ee.error!==false)$.on("error",em);$.on("close",e_);return function(){$.removeListener("complete",eh);$.removeListener("abort",e_);$.removeListener("request",ew);if($.req)$.req.removeListener("finish",eh);$.removeListener("end",ed);$.removeListener("close",ed);$.removeListener("finish",eh);$.removeListener("end",eg);$.removeListener("error",em);$.removeListener("close",e_)}}$.exports=eu},5167:$=>{$.exports=function(){throw new Error("Readable.from is not available in the browser")}},9946:($,ee,et)=>{"use strict";var en;function ei($){var ee=false;return function(){if(ee)return;ee=true;$.apply(void 0,arguments)}}var eo=et(4281).q,es=eo.ERR_MISSING_ARGS,eu=eo.ERR_STREAM_DESTROYED;function el($){if($)throw $}function ef($){return $.setHeader&&typeof $.abort==="function"}function ed($,ee,eo,es){es=ei(es);var el=false;$.on("close",function(){el=true});if(en===undefined)en=et(8610);en($,{readable:ee,writable:eo},function($){if($)return es($);el=true;es()});var ed=false;return function(ee){if(el)return;if(ed)return;ed=true;if(ef($))return $.abort();if(typeof $.destroy==="function")return $.destroy();es(ee||new eu("pipe"))}}function ep($){$()}function eh($,ee){return $.pipe(ee)}function ey($){if(!$.length)return el;if(typeof $[$.length-1]!=="function")return el;return $.pop()}function eg(){for(var $=arguments.length,ee=new Array($),et=0;et<$;et++){ee[et]=arguments[et]}var en=ey(ee);if(Array.isArray(ee[0]))ee=ee[0];if(ee.length<2){throw new es("streams")}var ei;var eo=ee.map(function($,et){var es=et<ee.length-1;var eu=et>0;return ed($,es,eu,function($){if(!ei)ei=$;if($)eo.forEach(ep);if(es)return;eo.forEach(ep);en(ei)})});return ee.reduce(eh)}$.exports=eg},2457:($,ee,et)=>{"use strict";var en=et(4281).q.ERR_INVALID_OPT_VALUE;function ei($,ee,et){return $.highWaterMark!=null?$.highWaterMark:ee?$[et]:null}function eo($,ee,et,eo){var es=ei(ee,eo,et);if(es!=null){if(!(isFinite(es)&&Math.floor(es)===es)||es<0){var eu=eo?et:"highWaterMark";throw new en(eu,es)}return Math.floor(es)}return $.objectMode?16:16*1024}$.exports={getHighWaterMark:eo}},2503:($,ee,et)=>{$.exports=et(7187).EventEmitter},4626:($,ee,et)=>{"use strict";var en=et(9509).Buffer;var ei=en.isEncoding||function($){$=""+$;switch($&&$.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 true;default:return false}};function eo($){if(!$)return"utf8";var ee;while(true){switch($){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 $;default:if(ee)return;$=(""+$).toLowerCase();ee=true}}};function es($){var ee=eo($);if(typeof ee!=="string"&&(en.isEncoding===ei||!ei($)))throw new Error("Unknown encoding: "+$);return ee||$}ee.s=eu;function eu($){this.encoding=es($);var ee;switch(this.encoding){case"utf16le":this.text=eg;this.end=em;ee=4;break;case"utf8":this.fillLast=ep;ee=4;break;case"base64":this.text=e_;this.end=ew;ee=3;break;default:this.write=eE;this.end=eS;return}this.lastNeed=0;this.lastTotal=0;this.lastChar=en.allocUnsafe(ee)}eu.prototype.write=function($){if($.length===0)return"";var ee;var et;if(this.lastNeed){ee=this.fillLast($);if(ee===undefined)return"";et=this.lastNeed;this.lastNeed=0}else{et=0}if(et<$.length)return ee?ee+this.text($,et):this.text($,et);return ee||""};eu.prototype.end=ey;eu.prototype.text=eh;eu.prototype.fillLast=function($){if(this.lastNeed<=$.length){$.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}$.copy(this.lastChar,this.lastTotal-this.lastNeed,0,$.length);this.lastNeed-=$.length};function el($){if($<=127)return 0;else if($>>5===6)return 2;else if($>>4===14)return 3;else if($>>3===30)return 4;return $>>6===2?-1:-2}function ef($,ee,et){var en=ee.length-1;if(en<et)return 0;var ei=el(ee[en]);if(ei>=0){if(ei>0)$.lastNeed=ei-1;return ei}if(--en<et||ei===-2)return 0;ei=el(ee[en]);if(ei>=0){if(ei>0)$.lastNeed=ei-2;return ei}if(--en<et||ei===-2)return 0;ei=el(ee[en]);if(ei>=0){if(ei>0){if(ei===2)ei=0;else $.lastNeed=ei-3}return ei}return 0}function ed($,ee,et){if((ee[0]&192)!==128){$.lastNeed=0;return"�"}if($.lastNeed>1&&ee.length>1){if((ee[1]&192)!==128){$.lastNeed=1;return"�"}if($.lastNeed>2&&ee.length>2){if((ee[2]&192)!==128){$.lastNeed=2;return"�"}}}}function ep($){var ee=this.lastTotal-this.lastNeed;var et=ed(this,$,ee);if(et!==undefined)return et;if(this.lastNeed<=$.length){$.copy(this.lastChar,ee,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}$.copy(this.lastChar,ee,0,$.length);this.lastNeed-=$.length}function eh($,ee){var et=ef(this,$,ee);if(!this.lastNeed)return $.toString("utf8",ee);this.lastTotal=et;var en=$.length-(et-this.lastNeed);$.copy(this.lastChar,0,en);return $.toString("utf8",ee,en)}function ey($){var ee=$&&$.length?this.write($):"";if(this.lastNeed)return ee+"�";return ee}function eg($,ee){if(($.length-ee)%2===0){var et=$.toString("utf16le",ee);if(et){var en=et.charCodeAt(et.length-1);if(en>=55296&&en<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=$[$.length-2];this.lastChar[1]=$[$.length-1];return et.slice(0,-1)}}return et}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=$[$.length-1];return $.toString("utf16le",ee,$.length-1)}function em($){var ee=$&&$.length?this.write($):"";if(this.lastNeed){var et=this.lastTotal-this.lastNeed;return ee+this.lastChar.toString("utf16le",0,et)}return ee}function e_($,ee){var et=($.length-ee)%3;if(et===0)return $.toString("base64",ee);this.lastNeed=3-et;this.lastTotal=3;if(et===1){this.lastChar[0]=$[$.length-1]}else{this.lastChar[0]=$[$.length-2];this.lastChar[1]=$[$.length-1]}return $.toString("base64",ee,$.length-et)}function ew($){var ee=$&&$.length?this.write($):"";if(this.lastNeed)return ee+this.lastChar.toString("base64",0,3-this.lastNeed);return ee}function eE($){return $.toString(this.encoding)}function eS($){return $&&$.length?this.write($):""}},3697:($,ee,et)=>{"use strict";var en=et(5972).functionsHaveConfigurableNames();var ei=Object;var eo=TypeError;$.exports=function $(){if(this!=null&&this!==ei(this)){throw new eo("RegExp.prototype.flags getter called on non-object")}var $="";if(this.hasIndices){$+="d"}if(this.global){$+="g"}if(this.ignoreCase){$+="i"}if(this.multiline){$+="m"}if(this.dotAll){$+="s"}if(this.unicode){$+="u"}if(this.unicodeSets){$+="v"}if(this.sticky){$+="y"}return $};if(en&&Object.defineProperty){Object.defineProperty($.exports,"name",{value:"get flags"})}},2847:($,ee,et)=>{"use strict";var en=et(4289);var ei=et(5559);var eo=et(3697);var es=et(1721);var eu=et(2753);var el=ei(es());en(el,{getPolyfill:es,implementation:eo,shim:eu});$.exports=el},1721:($,ee,et)=>{"use strict";var en=et(3697);var ei=et(4289).supportsDescriptors;var eo=Object.getOwnPropertyDescriptor;$.exports=function $(){if(ei&&/a/mig.flags==="gim"){var $=eo(RegExp.prototype,"flags");if($&&typeof $.get==="function"&&typeof RegExp.prototype.dotAll==="boolean"&&typeof RegExp.prototype.hasIndices==="boolean"){var ee="";var et={};Object.defineProperty(et,"hasIndices",{get:function(){ee+="d"}});Object.defineProperty(et,"sticky",{get:function(){ee+="y"}});if(ee==="dy"){return $.get}}}return en}},2753:($,ee,et)=>{"use strict";var en=et(4289).supportsDescriptors;var ei=et(1721);var eo=Object.getOwnPropertyDescriptor;var es=Object.defineProperty;var eu=TypeError;var el=Object.getPrototypeOf;var ef=/a/;$.exports=function $(){if(!en||!el){throw new eu("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors")}var $=ei();var ee=el(ef);var et=eo(ee,"flags");if(!et||et.get!==$){es(ee,"flags",{configurable:true,enumerable:false,get:$})}return $}},9509:($,ee,et)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var en=et(8764);var ei=en.Buffer;function eo($,ee){for(var et in $){ee[et]=$[et]}}if(ei.from&&ei.alloc&&ei.allocUnsafe&&ei.allocUnsafeSlow){$.exports=en}else{eo(en,ee);ee.Buffer=es}function es($,ee,et){return ei($,ee,et)}es.prototype=Object.create(ei.prototype);eo(ei,es);es.from=function($,ee,et){if(typeof $==="number"){throw new TypeError("Argument must not be a number")}return ei($,ee,et)};es.alloc=function($,ee,et){if(typeof $!=="number"){throw new TypeError("Argument must be a number")}var en=ei($);if(ee!==undefined){if(typeof et==="string"){en.fill(ee,et)}else{en.fill(ee)}}else{en.fill(0)}return en};es.allocUnsafe=function($){if(typeof $!=="number"){throw new TypeError("Argument must be a number")}return ei($)};es.allocUnsafeSlow=function($){if(typeof $!=="number"){throw new TypeError("Argument must be a number")}return en.SlowBuffer($)}},6099:($,ee,et)=>{var en=et(8764)["Buffer"];(function($){$.parser=function($,ee){return new ei($,ee)};$.SAXParser=ei;$.SAXStream=ep;$.createStream=ed;$.MAX_BUFFER_LENGTH=64*1024;var ee=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];$.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function ei(ee,et){if(!(this instanceof ei)){return new ei(ee,et)}var en=this;es(en);en.q=en.c="";en.bufferCheckPosition=$.MAX_BUFFER_LENGTH;en.opt=et||{};en.opt.lowercase=en.opt.lowercase||en.opt.lowercasetags;en.looseCase=en.opt.lowercase?"toLowerCase":"toUpperCase";en.tags=[];en.closed=en.closedRoot=en.sawRoot=false;en.tag=en.error=null;en.strict=!!ee;en.noscript=!!(ee||en.opt.noscript);en.state=eR.BEGIN;en.strictEntities=en.opt.strictEntities;en.ENTITIES=en.strictEntities?Object.create($.XML_ENTITIES):Object.create($.ENTITIES);en.attribList=[];if(en.opt.xmlns){en.ns=Object.create(e_)}en.trackPosition=en.opt.position!==false;if(en.trackPosition){en.position=en.line=en.column=0}ek(en,"onready")}if(!Object.create){Object.create=function($){function ee(){}ee.prototype=$;var et=new ee;return et}}if(!Object.keys){Object.keys=function($){var ee=[];for(var et in $)if($.hasOwnProperty(et))ee.push(et);return ee}}function eo(et){var en=Math.max($.MAX_BUFFER_LENGTH,10);var ei=0;for(var eo=0,es=ee.length;eo<es;eo++){var eu=et[ee[eo]].length;if(eu>en){switch(ee[eo]){case"textNode":eL(et);break;case"cdata":eM(et,"oncdata",et.cdata);et.cdata="";break;case"script":eM(et,"onscript",et.script);et.script="";break;default:eF(et,"Max buffer length exceeded: "+ee[eo])}}ei=Math.max(ei,eu)}var el=$.MAX_BUFFER_LENGTH-ei;et.bufferCheckPosition=el+et.position}function es($){for(var et=0,en=ee.length;et<en;et++){$[ee[et]]=""}}function eu($){eL($);if($.cdata!==""){eM($,"oncdata",$.cdata);$.cdata=""}if($.script!==""){eM($,"onscript",$.script);$.script=""}}ei.prototype={end:function(){eB(this)},write:eY,resume:function(){this.error=null;return this},close:function(){return this.write(null)},flush:function(){eu(this)}};var el;try{el=et(2830).Stream}catch($){el=function(){}}var ef=$.EVENTS.filter(function($){return $!=="error"&&$!=="end"});function ed($,ee){return new ep($,ee)}function ep($,ee){if(!(this instanceof ep)){return new ep($,ee)}el.apply(this);this._parser=new ei($,ee);this.writable=true;this.readable=true;var et=this;this._parser.onend=function(){et.emit("end")};this._parser.onerror=function($){et.emit("error",$);et._parser.error=null};this._decoder=null;ef.forEach(function($){Object.defineProperty(et,"on"+$,{get:function(){return et._parser["on"+$]},set:function(ee){if(!ee){et.removeAllListeners($);et._parser["on"+$]=ee;return ee}et.on($,ee)},enumerable:true,configurable:false})})}ep.prototype=Object.create(el.prototype,{constructor:{value:ep}});ep.prototype.write=function($){if(typeof en==="function"&&typeof en.isBuffer==="function"&&en.isBuffer($)){if(!this._decoder){var ee=et(2553).StringDecoder;this._decoder=new ee("utf8")}$=this._decoder.write($)}this._parser.write($.toString());this.emit("data",$);return true};ep.prototype.end=function($){if($&&$.length){this.write($)}this._parser.end();return true};ep.prototype.on=function($,ee){var et=this;if(!et._parser["on"+$]&&ef.indexOf($)!==-1){et._parser["on"+$]=function(){var ee=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);ee.splice(0,0,$);et.emit.apply(et,ee)}}return el.prototype.on.call(et,$,ee)};var eh="[CDATA[";var ey="DOCTYPE";var eg="http://www.w3.org/XML/1998/namespace";var em="http://www.w3.org/2000/xmlns/";var e_={xml:eg,xmlns:em};var ew=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;var eE=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;var eS=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;var eT=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function eO($){return $===" "||$==="\n"||$==="\r"||$===" "}function eA($){return $==='"'||$==="'"}function eI($){return $===">"||eO($)}function eN($,ee){return $.test(ee)}function eD($,ee){return!eN($,ee)}var eR=0;$.STATE={BEGIN:eR++,BEGIN_WHITESPACE:eR++,TEXT:eR++,TEXT_ENTITY:eR++,OPEN_WAKA:eR++,SGML_DECL:eR++,SGML_DECL_QUOTED:eR++,DOCTYPE:eR++,DOCTYPE_QUOTED:eR++,DOCTYPE_DTD:eR++,DOCTYPE_DTD_QUOTED:eR++,COMMENT_STARTING:eR++,COMMENT:eR++,COMMENT_ENDING:eR++,COMMENT_ENDED:eR++,CDATA:eR++,CDATA_ENDING:eR++,CDATA_ENDING_2:eR++,PROC_INST:eR++,PROC_INST_BODY:eR++,PROC_INST_ENDING:eR++,OPEN_TAG:eR++,OPEN_TAG_SLASH:eR++,ATTRIB:eR++,ATTRIB_NAME:eR++,ATTRIB_NAME_SAW_WHITE:eR++,ATTRIB_VALUE:eR++,ATTRIB_VALUE_QUOTED:eR++,ATTRIB_VALUE_CLOSED:eR++,ATTRIB_VALUE_UNQUOTED:eR++,ATTRIB_VALUE_ENTITY_Q:eR++,ATTRIB_VALUE_ENTITY_U:eR++,CLOSE_TAG:eR++,CLOSE_TAG_SAW_WHITE:eR++,SCRIPT:eR++,SCRIPT_ENDING:eR++};$.XML_ENTITIES={"amp":"&","gt":">","lt":"<","quot":'"',"apos":"'"};$.ENTITIES={"amp":"&","gt":">","lt":"<","quot":'"',"apos":"'","AElig":198,"Aacute":193,"Acirc":194,"Agrave":192,"Aring":197,"Atilde":195,"Auml":196,"Ccedil":199,"ETH":208,"Eacute":201,"Ecirc":202,"Egrave":200,"Euml":203,"Iacute":205,"Icirc":206,"Igrave":204,"Iuml":207,"Ntilde":209,"Oacute":211,"Ocirc":212,"Ograve":210,"Oslash":216,"Otilde":213,"Ouml":214,"THORN":222,"Uacute":218,"Ucirc":219,"Ugrave":217,"Uuml":220,"Yacute":221,"aacute":225,"acirc":226,"aelig":230,"agrave":224,"aring":229,"atilde":227,"auml":228,"ccedil":231,"eacute":233,"ecirc":234,"egrave":232,"eth":240,"euml":235,"iacute":237,"icirc":238,"igrave":236,"iuml":239,"ntilde":241,"oacute":243,"ocirc":244,"ograve":242,"oslash":248,"otilde":245,"ouml":246,"szlig":223,"thorn":254,"uacute":250,"ucirc":251,"ugrave":249,"uuml":252,"yacute":253,"yuml":255,"copy":169,"reg":174,"nbsp":160,"iexcl":161,"cent":162,"pound":163,"curren":164,"yen":165,"brvbar":166,"sect":167,"uml":168,"ordf":170,"laquo":171,"not":172,"shy":173,"macr":175,"deg":176,"plusmn":177,"sup1":185,"sup2":178,"sup3":179,"acute":180,"micro":181,"para":182,"middot":183,"cedil":184,"ordm":186,"raquo":187,"frac14":188,"frac12":189,"frac34":190,"iquest":191,"times":215,"divide":247,"OElig":338,"oelig":339,"Scaron":352,"scaron":353,"Yuml":376,"fnof":402,"circ":710,"tilde":732,"Alpha":913,"Beta":914,"Gamma":915,"Delta":916,"Epsilon":917,"Zeta":918,"Eta":919,"Theta":920,"Iota":921,"Kappa":922,"Lambda":923,"Mu":924,"Nu":925,"Xi":926,"Omicron":927,"Pi":928,"Rho":929,"Sigma":931,"Tau":932,"Upsilon":933,"Phi":934,"Chi":935,"Psi":936,"Omega":937,"alpha":945,"beta":946,"gamma":947,"delta":948,"epsilon":949,"zeta":950,"eta":951,"theta":952,"iota":953,"kappa":954,"lambda":955,"mu":956,"nu":957,"xi":958,"omicron":959,"pi":960,"rho":961,"sigmaf":962,"sigma":963,"tau":964,"upsilon":965,"phi":966,"chi":967,"psi":968,"omega":969,"thetasym":977,"upsih":978,"piv":982,"ensp":8194,"emsp":8195,"thinsp":8201,"zwnj":8204,"zwj":8205,"lrm":8206,"rlm":8207,"ndash":8211,"mdash":8212,"lsquo":8216,"rsquo":8217,"sbquo":8218,"ldquo":8220,"rdquo":8221,"bdquo":8222,"dagger":8224,"Dagger":8225,"bull":8226,"hellip":8230,"permil":8240,"prime":8242,"Prime":8243,"lsaquo":8249,"rsaquo":8250,"oline":8254,"frasl":8260,"euro":8364,"image":8465,"weierp":8472,"real":8476,"trade":8482,"alefsym":8501,"larr":8592,"uarr":8593,"rarr":8594,"darr":8595,"harr":8596,"crarr":8629,"lArr":8656,"uArr":8657,"rArr":8658,"dArr":8659,"hArr":8660,"forall":8704,"part":8706,"exist":8707,"empty":8709,"nabla":8711,"isin":8712,"notin":8713,"ni":8715,"prod":8719,"sum":8721,"minus":8722,"lowast":8727,"radic":8730,"prop":8733,"infin":8734,"ang":8736,"and":8743,"or":8744,"cap":8745,"cup":8746,"int":8747,"there4":8756,"sim":8764,"cong":8773,"asymp":8776,"ne":8800,"equiv":8801,"le":8804,"ge":8805,"sub":8834,"sup":8835,"nsub":8836,"sube":8838,"supe":8839,"oplus":8853,"otimes":8855,"perp":8869,"sdot":8901,"lceil":8968,"rceil":8969,"lfloor":8970,"rfloor":8971,"lang":9001,"rang":9002,"loz":9674,"spades":9824,"clubs":9827,"hearts":9829,"diams":9830};Object.keys($.ENTITIES).forEach(function(ee){var et=$.ENTITIES[ee];var en=typeof et==="number"?String.fromCharCode(et):et;$.ENTITIES[ee]=en});for(var eC in $.STATE){$.STATE[$.STATE[eC]]=eC}eR=$.STATE;function ek($,ee,et){$[ee]&&$[ee](et)}function eM($,ee,et){if($.textNode)eL($);ek($,ee,et)}function eL($){$.textNode=eP($.opt,$.textNode);if($.textNode)ek($,"ontext",$.textNode);$.textNode=""}function eP($,ee){if($.trim)ee=ee.trim();if($.normalize)ee=ee.replace(/\s+/g," ");return ee}function eF($,ee){eL($);if($.trackPosition){ee+="\nLine: "+$.line+"\nColumn: "+$.column+"\nChar: "+$.c}ee=new Error(ee);$.error=ee;ek($,"onerror",ee);return $}function eB($){if($.sawRoot&&!$.closedRoot)eU($,"Unclosed root tag");if($.state!==eR.BEGIN&&$.state!==eR.BEGIN_WHITESPACE&&$.state!==eR.TEXT){eF($,"Unexpected end")}eL($);$.c="";$.closed=true;ek($,"onend");ei.call($,$.strict,$.opt);return $}function eU($,ee){if(typeof $!=="object"||!($ instanceof ei)){throw new Error("bad call to strictFail")}if($.strict){eF($,ee)}}function ej($){if(!$.strict)$.tagName=$.tagName[$.looseCase]();var ee=$.tags[$.tags.length-1]||$;var et=$.tag={name:$.tagName,attributes:{}};if($.opt.xmlns){et.ns=ee.ns}$.attribList.length=0;eM($,"onopentagstart",et)}function eW($,ee){var et=$.indexOf(":");var en=et<0?["",$]:$.split(":");var ei=en[0];var eo=en[1];if(ee&&$==="xmlns"){ei="xmlns";eo=""}return{prefix:ei,local:eo}}function eH($){if(!$.strict){$.attribName=$.attribName[$.looseCase]()}if($.attribList.indexOf($.attribName)!==-1||$.tag.attributes.hasOwnProperty($.attribName)){$.attribName=$.attribValue="";return}if($.opt.xmlns){var ee=eW($.attribName,true);var et=ee.prefix;var en=ee.local;if(et==="xmlns"){if(en==="xml"&&$.attribValue!==eg){eU($,"xml: prefix must be bound to "+eg+"\n"+"Actual: "+$.attribValue)}else if(en==="xmlns"&&$.attribValue!==em){eU($,"xmlns: prefix must be bound to "+em+"\n"+"Actual: "+$.attribValue)}else{var ei=$.tag;var eo=$.tags[$.tags.length-1]||$;if(ei.ns===eo.ns){ei.ns=Object.create(eo.ns)}ei.ns[en]=$.attribValue}}$.attribList.push([$.attribName,$.attribValue])}else{$.tag.attributes[$.attribName]=$.attribValue;eM($,"onattribute",{name:$.attribName,value:$.attribValue})}$.attribName=$.attribValue=""}function ez($,ee){if($.opt.xmlns){var et=$.tag;var en=eW($.tagName);et.prefix=en.prefix;et.local=en.local;et.uri=et.ns[en.prefix]||"";if(et.prefix&&!et.uri){eU($,"Unbound namespace prefix: "+JSON.stringify($.tagName));et.uri=en.prefix}var ei=$.tags[$.tags.length-1]||$;if(et.ns&&ei.ns!==et.ns){Object.keys(et.ns).forEach(function(ee){eM($,"onopennamespace",{prefix:ee,uri:et.ns[ee]})})}for(var eo=0,es=$.attribList.length;eo<es;eo++){var eu=$.attribList[eo];var el=eu[0];var ef=eu[1];var ed=eW(el,true);var ep=ed.prefix;var eh=ed.local;var ey=ep===""?"":et.ns[ep]||"";var eg={name:el,value:ef,prefix:ep,local:eh,uri:ey};if(ep&&ep!=="xmlns"&&!ey){eU($,"Unbound namespace prefix: "+JSON.stringify(ep));eg.uri=ep}$.tag.attributes[el]=eg;eM($,"onattribute",eg)}$.attribList.length=0}$.tag.isSelfClosing=!!ee;$.sawRoot=true;$.tags.push($.tag);eM($,"onopentag",$.tag);if(!ee){if(!$.noscript&&$.tagName.toLowerCase()==="script"){$.state=eR.SCRIPT}else{$.state=eR.TEXT}$.tag=null;$.tagName=""}$.attribName=$.attribValue="";$.attribList.length=0}function eV($){if(!$.tagName){eU($,"Weird empty close tag.");$.textNode+="</>";$.state=eR.TEXT;return}if($.script){if($.tagName!=="script"){$.script+="</"+$.tagName+">";$.tagName="";$.state=eR.SCRIPT;return}eM($,"onscript",$.script);$.script=""}var ee=$.tags.length;var et=$.tagName;if(!$.strict){et=et[$.looseCase]()}var en=et;while(ee--){var ei=$.tags[ee];if(ei.name!==en){eU($,"Unexpected close tag")}else{break}}if(ee<0){eU($,"Unmatched closing tag: "+$.tagName);$.textNode+="</"+$.tagName+">";$.state=eR.TEXT;return}$.tagName=et;var eo=$.tags.length;while(eo-- >ee){var es=$.tag=$.tags.pop();$.tagName=$.tag.name;eM($,"onclosetag",$.tagName);var eu={};for(var el in es.ns){eu[el]=es.ns[el]}var ef=$.tags[$.tags.length-1]||$;if($.opt.xmlns&&es.ns!==ef.ns){Object.keys(es.ns).forEach(function(ee){var et=es.ns[ee];eM($,"onclosenamespace",{prefix:ee,uri:et})})}}if(ee===0)$.closedRoot=true;$.tagName=$.attribValue=$.attribName="";$.attribList.length=0;$.state=eR.TEXT}function e$($){var ee=$.entity;var et=ee.toLowerCase();var en;var ei="";if($.ENTITIES[ee]){return $.ENTITIES[ee]}if($.ENTITIES[et]){return $.ENTITIES[et]}ee=et;if(ee.charAt(0)==="#"){if(ee.charAt(1)==="x"){ee=ee.slice(2);en=parseInt(ee,16);ei=en.toString(16)}else{ee=ee.slice(1);en=parseInt(ee,10);ei=en.toString(10)}}ee=ee.replace(/^0+/,"");if(isNaN(en)||ei.toLowerCase()!==ee){eU($,"Invalid character entity");return"&"+$.entity+";"}return String.fromCodePoint(en)}function eq($,ee){if(ee==="<"){$.state=eR.OPEN_WAKA;$.startTagPosition=$.position}else if(!eO(ee)){eU($,"Non-whitespace before first tag.");$.textNode=ee;$.state=eR.TEXT}}function eG($,ee){var et="";if(ee<$.length){et=$.charAt(ee)}return et}function eY($){var ee=this;if(this.error){throw this.error}if(ee.closed){return eF(ee,"Cannot write after close. Assign an onready handler.")}if($===null){return eB(ee)}if(typeof $==="object"){$=$.toString()}var et=0;var en="";while(true){en=eG($,et++);ee.c=en;if(!en){break}if(ee.trackPosition){ee.position++;if(en==="\n"){ee.line++;ee.column=0}else{ee.column++}}switch(ee.state){case eR.BEGIN:ee.state=eR.BEGIN_WHITESPACE;if(en==="\uFEFF"){continue}eq(ee,en);continue;case eR.BEGIN_WHITESPACE:eq(ee,en);continue;case eR.TEXT:if(ee.sawRoot&&!ee.closedRoot){var ei=et-1;while(en&&en!=="<"&&en!=="&"){en=eG($,et++);if(en&&ee.trackPosition){ee.position++;if(en==="\n"){ee.line++;ee.column=0}else{ee.column++}}}ee.textNode+=$.substring(ei,et-1)}if(en==="<"&&!(ee.sawRoot&&ee.closedRoot&&!ee.strict)){ee.state=eR.OPEN_WAKA;ee.startTagPosition=ee.position}else{if(!eO(en)&&(!ee.sawRoot||ee.closedRoot)){eU(ee,"Text data outside of root node.")}if(en==="&"){ee.state=eR.TEXT_ENTITY}else{ee.textNode+=en}}continue;case eR.SCRIPT:if(en==="<"){ee.state=eR.SCRIPT_ENDING}else{ee.script+=en}continue;case eR.SCRIPT_ENDING:if(en==="/"){ee.state=eR.CLOSE_TAG}else{ee.script+="<"+en;ee.state=eR.SCRIPT}continue;case eR.OPEN_WAKA:if(en==="!"){ee.state=eR.SGML_DECL;ee.sgmlDecl=""}else if(eO(en)){}else if(eN(ew,en)){ee.state=eR.OPEN_TAG;ee.tagName=en}else if(en==="/"){ee.state=eR.CLOSE_TAG;ee.tagName=""}else if(en==="?"){ee.state=eR.PROC_INST;ee.procInstName=ee.procInstBody=""}else{eU(ee,"Unencoded <");if(ee.startTagPosition+1<ee.position){var es=ee.position-ee.startTagPosition;en=new Array(es).join(" ")+en}ee.textNode+="<"+en;ee.state=eR.TEXT}continue;case eR.SGML_DECL:if((ee.sgmlDecl+en).toUpperCase()===eh){eM(ee,"onopencdata");ee.state=eR.CDATA;ee.sgmlDecl="";ee.cdata=""}else if(ee.sgmlDecl+en==="--"){ee.state=eR.COMMENT;ee.comment="";ee.sgmlDecl=""}else if((ee.sgmlDecl+en).toUpperCase()===ey){ee.state=eR.DOCTYPE;if(ee.doctype||ee.sawRoot){eU(ee,"Inappropriately located doctype declaration")}ee.doctype="";ee.sgmlDecl=""}else if(en===">"){eM(ee,"onsgmldeclaration",ee.sgmlDecl);ee.sgmlDecl="";ee.state=eR.TEXT}else if(eA(en)){ee.state=eR.SGML_DECL_QUOTED;ee.sgmlDecl+=en}else{ee.sgmlDecl+=en}continue;case eR.SGML_DECL_QUOTED:if(en===ee.q){ee.state=eR.SGML_DECL;ee.q=""}ee.sgmlDecl+=en;continue;case eR.DOCTYPE:if(en===">"){ee.state=eR.TEXT;eM(ee,"ondoctype",ee.doctype);ee.doctype=true}else{ee.doctype+=en;if(en==="["){ee.state=eR.DOCTYPE_DTD}else if(eA(en)){ee.state=eR.DOCTYPE_QUOTED;ee.q=en}}continue;case eR.DOCTYPE_QUOTED:ee.doctype+=en;if(en===ee.q){ee.q="";ee.state=eR.DOCTYPE}continue;case eR.DOCTYPE_DTD:ee.doctype+=en;if(en==="]"){ee.state=eR.DOCTYPE}else if(eA(en)){ee.state=eR.DOCTYPE_DTD_QUOTED;ee.q=en}continue;case eR.DOCTYPE_DTD_QUOTED:ee.doctype+=en;if(en===ee.q){ee.state=eR.DOCTYPE_DTD;ee.q=""}continue;case eR.COMMENT:if(en==="-"){ee.state=eR.COMMENT_ENDING}else{ee.comment+=en}continue;case eR.COMMENT_ENDING:if(en==="-"){ee.state=eR.COMMENT_ENDED;ee.comment=eP(ee.opt,ee.comment);if(ee.comment){eM(ee,"oncomment",ee.comment)}ee.comment=""}else{ee.comment+="-"+en;ee.state=eR.COMMENT}continue;case eR.COMMENT_ENDED:if(en!==">"){eU(ee,"Malformed comment");ee.comment+="--"+en;ee.state=eR.COMMENT}else{ee.state=eR.TEXT}continue;case eR.CDATA:if(en==="]"){ee.state=eR.CDATA_ENDING}else{ee.cdata+=en}continue;case eR.CDATA_ENDING:if(en==="]"){ee.state=eR.CDATA_ENDING_2}else{ee.cdata+="]"+en;ee.state=eR.CDATA}continue;case eR.CDATA_ENDING_2:if(en===">"){if(ee.cdata){eM(ee,"oncdata",ee.cdata)}eM(ee,"onclosecdata");ee.cdata="";ee.state=eR.TEXT}else if(en==="]"){ee.cdata+="]"}else{ee.cdata+="]]"+en;ee.state=eR.CDATA}continue;case eR.PROC_INST:if(en==="?"){ee.state=eR.PROC_INST_ENDING}else if(eO(en)){ee.state=eR.PROC_INST_BODY}else{ee.procInstName+=en}continue;case eR.PROC_INST_BODY:if(!ee.procInstBody&&eO(en)){continue}else if(en==="?"){ee.state=eR.PROC_INST_ENDING}else{ee.procInstBody+=en}continue;case eR.PROC_INST_ENDING:if(en===">"){eM(ee,"onprocessinginstruction",{name:ee.procInstName,body:ee.procInstBody});ee.procInstName=ee.procInstBody="";ee.state=eR.TEXT}else{ee.procInstBody+="?"+en;ee.state=eR.PROC_INST_BODY}continue;case eR.OPEN_TAG:if(eN(eE,en)){ee.tagName+=en}else{ej(ee);if(en===">"){ez(ee)}else if(en==="/"){ee.state=eR.OPEN_TAG_SLASH}else{if(!eO(en)){eU(ee,"Invalid character in tag name")}ee.state=eR.ATTRIB}}continue;case eR.OPEN_TAG_SLASH:if(en===">"){ez(ee,true);eV(ee)}else{eU(ee,"Forward-slash in opening tag not followed by >");ee.state=eR.ATTRIB}continue;case eR.ATTRIB:if(eO(en)){continue}else if(en===">"){ez(ee)}else if(en==="/"){ee.state=eR.OPEN_TAG_SLASH}else if(eN(ew,en)){ee.attribName=en;ee.attribValue="";ee.state=eR.ATTRIB_NAME}else{eU(ee,"Invalid attribute name")}continue;case eR.ATTRIB_NAME:if(en==="="){ee.state=eR.ATTRIB_VALUE}else if(en===">"){eU(ee,"Attribute without value");ee.attribValue=ee.attribName;eH(ee);ez(ee)}else if(eO(en)){ee.state=eR.ATTRIB_NAME_SAW_WHITE}else if(eN(eE,en)){ee.attribName+=en}else{eU(ee,"Invalid attribute name")}continue;case eR.ATTRIB_NAME_SAW_WHITE:if(en==="="){ee.state=eR.ATTRIB_VALUE}else if(eO(en)){continue}else{eU(ee,"Attribute without value");ee.tag.attributes[ee.attribName]="";ee.attribValue="";eM(ee,"onattribute",{name:ee.attribName,value:""});ee.attribName="";if(en===">"){ez(ee)}else if(eN(ew,en)){ee.attribName=en;ee.state=eR.ATTRIB_NAME}else{eU(ee,"Invalid attribute name");ee.state=eR.ATTRIB}}continue;case eR.ATTRIB_VALUE:if(eO(en)){continue}else if(eA(en)){ee.q=en;ee.state=eR.ATTRIB_VALUE_QUOTED}else{eU(ee,"Unquoted attribute value");ee.state=eR.ATTRIB_VALUE_UNQUOTED;ee.attribValue=en}continue;case eR.ATTRIB_VALUE_QUOTED:if(en!==ee.q){if(en==="&"){ee.state=eR.ATTRIB_VALUE_ENTITY_Q}else{ee.attribValue+=en}continue}eH(ee);ee.q="";ee.state=eR.ATTRIB_VALUE_CLOSED;continue;case eR.ATTRIB_VALUE_CLOSED:if(eO(en)){ee.state=eR.ATTRIB}else if(en===">"){ez(ee)}else if(en==="/"){ee.state=eR.OPEN_TAG_SLASH}else if(eN(ew,en)){eU(ee,"No whitespace between attributes");ee.attribName=en;ee.attribValue="";ee.state=eR.ATTRIB_NAME}else{eU(ee,"Invalid attribute name")}continue;case eR.ATTRIB_VALUE_UNQUOTED:if(!eI(en)){if(en==="&"){ee.state=eR.ATTRIB_VALUE_ENTITY_U}else{ee.attribValue+=en}continue}eH(ee);if(en===">"){ez(ee)}else{ee.state=eR.ATTRIB}continue;case eR.CLOSE_TAG:if(!ee.tagName){if(eO(en)){continue}else if(eD(ew,en)){if(ee.script){ee.script+="</"+en;ee.state=eR.SCRIPT}else{eU(ee,"Invalid tagname in closing tag.")}}else{ee.tagName=en}}else if(en===">"){eV(ee)}else if(eN(eE,en)){ee.tagName+=en}else if(ee.script){ee.script+="</"+ee.tagName;ee.tagName="";ee.state=eR.SCRIPT}else{if(!eO(en)){eU(ee,"Invalid tagname in closing tag")}ee.state=eR.CLOSE_TAG_SAW_WHITE}continue;case eR.CLOSE_TAG_SAW_WHITE:if(eO(en)){continue}if(en===">"){eV(ee)}else{eU(ee,"Invalid characters in closing tag")}continue;case eR.TEXT_ENTITY:case eR.ATTRIB_VALUE_ENTITY_Q:case eR.ATTRIB_VALUE_ENTITY_U:var eu;var el;switch(ee.state){case eR.TEXT_ENTITY:eu=eR.TEXT;el="textNode";break;case eR.ATTRIB_VALUE_ENTITY_Q:eu=eR.ATTRIB_VALUE_QUOTED;el="attribValue";break;case eR.ATTRIB_VALUE_ENTITY_U:eu=eR.ATTRIB_VALUE_UNQUOTED;el="attribValue";break}if(en===";"){ee[el]+=e$(ee);ee.entity="";ee.state=eu}else if(eN(ee.entity.length?eT:eS,en)){ee.entity+=en}else{eU(ee,"Invalid character in entity name");ee[el]+="&"+ee.entity+en;ee.entity="";ee.state=eu}continue;default:throw new Error(ee,"Unknown state: "+ee.state)}}if(ee.position>=ee.bufferCheckPosition){eo(ee)}return ee}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */if(!String.fromCodePoint){(function(){var $=String.fromCharCode;var ee=Math.floor;var et=function(){var et=16384;var en=[];var ei;var eo;var es=-1;var eu=arguments.length;if(!eu){return""}var el="";while(++es<eu){var ef=Number(arguments[es]);if(!isFinite(ef)||ef<0||ef>1114111||ee(ef)!==ef){throw RangeError("Invalid code point: "+ef)}if(ef<=65535){en.push(ef)}else{ef-=65536;ei=(ef>>10)+55296;eo=ef%1024+56320;en.push(ei,eo)}if(es+1===eu||en.length>et){el+=$.apply(null,en);en.length=0}}return el};if(Object.defineProperty){Object.defineProperty(String,"fromCodePoint",{value:et,configurable:true,writable:true})}else{String.fromCodePoint=et}})()}})(false?0:ee)},7478:($,ee,et)=>{"use strict";var en=et(210);var ei=et(1924);var eo=et(631);var es=en("%TypeError%");var eu=en("%WeakMap%",true);var el=en("%Map%",true);var ef=ei("WeakMap.prototype.get",true);var ed=ei("WeakMap.prototype.set",true);var ep=ei("WeakMap.prototype.has",true);var eh=ei("Map.prototype.get",true);var ey=ei("Map.prototype.set",true);var eg=ei("Map.prototype.has",true);var em=function($,ee){for(var et=$,en;(en=et.next)!==null;et=en){if(en.key===ee){et.next=en.next;en.next=$.next;$.next=en;return en}}};var e_=function($,ee){var et=em($,ee);return et&&et.value};var ew=function($,ee,et){var en=em($,ee);if(en){en.value=et}else{$.next={key:ee,next:$.next,value:et}}};var eE=function($,ee){return!!em($,ee)};$.exports=function $(){var $;var ee;var et;var en={assert:function($){if(!en.has($)){throw new es("Side channel does not contain "+eo($))}},get:function(en){if(eu&&en&&(typeof en==="object"||typeof en==="function")){if($){return ef($,en)}}else if(el){if(ee){return eh(ee,en)}}else{if(et){return e_(et,en)}}},has:function(en){if(eu&&en&&(typeof en==="object"||typeof en==="function")){if($){return ep($,en)}}else if(el){if(ee){return eg(ee,en)}}else{if(et){return eE(et,en)}}return false},set:function(en,ei){if(eu&&en&&(typeof en==="object"||typeof en==="function")){if(!$){$=new eu}ed($,en,ei)}else if(el){if(!ee){ee=new el}ey(ee,en,ei)}else{if(!et){et={key:{},next:null}}ew(et,en,ei)}}};return en}},3859:$=>{"use strict";$.exports=$=>{const ee=/^\\\\\?\\/.test($);const et=/[^\u0000-\u0080]+/.test($);if(ee||et){return $}return $.replace(/\\/g,"/")}},6373:($,ee,et)=>{"use strict";var en=et(9496);var ei=SyntaxError;var eo=typeof StopIteration==="object"?StopIteration:null;$.exports=function $($){if(!eo){throw new ei("this environment lacks StopIteration")}en.set($,"[[Done]]",false);var ee={next:function $(){var $=en.get(this,"[[Iterator]]");var ee=en.get($,"[[Done]]");try{return{done:ee,value:ee?void undefined:$.next()}}catch(ee){en.set($,"[[Done]]",true);if(ee!==eo){throw ee}return{done:true,value:void undefined}}}};en.set(ee,"[[Iterator]]",$);return ee}},2830:($,ee,et)=>{$.exports=eo;var en=et(7187).EventEmitter;var ei=et(5717);ei(eo,en);eo.Readable=et(9481);eo.Writable=et(4229);eo.Duplex=et(6753);eo.Transform=et(4605);eo.PassThrough=et(2725);eo.finished=et(8610);eo.pipeline=et(9946);eo.Stream=eo;function eo(){en.call(this)}eo.prototype.pipe=function($,ee){var et=this;function ei(ee){if($.writable){if(false===$.write(ee)&&et.pause){et.pause()}}}et.on("data",ei);function eo(){if(et.readable&&et.resume){et.resume()}}$.on("drain",eo);if(!$._isStdio&&(!ee||ee.end!==false)){et.on("end",eu);et.on("close",el)}var es=false;function eu(){if(es)return;es=true;$.end()}function el(){if(es)return;es=true;if(typeof $.destroy==="function")$.destroy()}function ef($){ed();if(en.listenerCount(this,"error")===0){throw $}}et.on("error",ef);$.on("error",ef);function ed(){et.removeListener("data",ei);$.removeListener("drain",eo);et.removeListener("end",eu);et.removeListener("close",el);et.removeListener("error",ef);$.removeListener("error",ef);et.removeListener("end",ed);et.removeListener("close",ed);$.removeListener("close",ed)}et.on("end",ed);et.on("close",ed);$.on("close",ed);$.emit("pipe",et);return $}},2553:($,ee,et)=>{"use strict";var en=et(396).Buffer;var ei=en.isEncoding||function($){$=""+$;switch($&&$.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 true;default:return false}};function eo($){if(!$)return"utf8";var ee;while(true){switch($){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 $;default:if(ee)return;$=(""+$).toLowerCase();ee=true}}};function es($){var ee=eo($);if(typeof ee!=="string"&&(en.isEncoding===ei||!ei($)))throw new Error("Unknown encoding: "+$);return ee||$}ee.StringDecoder=eu;function eu($){this.encoding=es($);var ee;switch(this.encoding){case"utf16le":this.text=eg;this.end=em;ee=4;break;case"utf8":this.fillLast=ep;ee=4;break;case"base64":this.text=e_;this.end=ew;ee=3;break;default:this.write=eE;this.end=eS;return}this.lastNeed=0;this.lastTotal=0;this.lastChar=en.allocUnsafe(ee)}eu.prototype.write=function($){if($.length===0)return"";var ee;var et;if(this.lastNeed){ee=this.fillLast($);if(ee===undefined)return"";et=this.lastNeed;this.lastNeed=0}else{et=0}if(et<$.length)return ee?ee+this.text($,et):this.text($,et);return ee||""};eu.prototype.end=ey;eu.prototype.text=eh;eu.prototype.fillLast=function($){if(this.lastNeed<=$.length){$.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}$.copy(this.lastChar,this.lastTotal-this.lastNeed,0,$.length);this.lastNeed-=$.length};function el($){if($<=127)return 0;else if($>>5===6)return 2;else if($>>4===14)return 3;else if($>>3===30)return 4;return $>>6===2?-1:-2}function ef($,ee,et){var en=ee.length-1;if(en<et)return 0;var ei=el(ee[en]);if(ei>=0){if(ei>0)$.lastNeed=ei-1;return ei}if(--en<et||ei===-2)return 0;ei=el(ee[en]);if(ei>=0){if(ei>0)$.lastNeed=ei-2;return ei}if(--en<et||ei===-2)return 0;ei=el(ee[en]);if(ei>=0){if(ei>0){if(ei===2)ei=0;else $.lastNeed=ei-3}return ei}return 0}function ed($,ee,et){if((ee[0]&192)!==128){$.lastNeed=0;return"�"}if($.lastNeed>1&&ee.length>1){if((ee[1]&192)!==128){$.lastNeed=1;return"�"}if($.lastNeed>2&&ee.length>2){if((ee[2]&192)!==128){$.lastNeed=2;return"�"}}}}function ep($){var ee=this.lastTotal-this.lastNeed;var et=ed(this,$,ee);if(et!==undefined)return et;if(this.lastNeed<=$.length){$.copy(this.lastChar,ee,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}$.copy(this.lastChar,ee,0,$.length);this.lastNeed-=$.length}function eh($,ee){var et=ef(this,$,ee);if(!this.lastNeed)return $.toString("utf8",ee);this.lastTotal=et;var en=$.length-(et-this.lastNeed);$.copy(this.lastChar,0,en);return $.toString("utf8",ee,en)}function ey($){var ee=$&&$.length?this.write($):"";if(this.lastNeed)return ee+"�";return ee}function eg($,ee){if(($.length-ee)%2===0){var et=$.toString("utf16le",ee);if(et){var en=et.charCodeAt(et.length-1);if(en>=55296&&en<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=$[$.length-2];this.lastChar[1]=$[$.length-1];return et.slice(0,-1)}}return et}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=$[$.length-1];return $.toString("utf16le",ee,$.length-1)}function em($){var ee=$&&$.length?this.write($):"";if(this.lastNeed){var et=this.lastTotal-this.lastNeed;return ee+this.lastChar.toString("utf16le",0,et)}return ee}function e_($,ee){var et=($.length-ee)%3;if(et===0)return $.toString("base64",ee);this.lastNeed=3-et;this.lastTotal=3;if(et===1){this.lastChar[0]=$[$.length-1]}else{this.lastChar[0]=$[$.length-2];this.lastChar[1]=$[$.length-1]}return $.toString("base64",ee,$.length-et)}function ew($){var ee=$&&$.length?this.write($):"";if(this.lastNeed)return ee+this.lastChar.toString("base64",0,3-this.lastNeed);return ee}function eE($){return $.toString(this.encoding)}function eS($){return $&&$.length?this.write($):""}},396:($,ee,et)=>{var en=et(8764);var ei=en.Buffer;function eo($,ee){for(var et in $){ee[et]=$[et]}}if(ei.from&&ei.alloc&&ei.allocUnsafe&&ei.allocUnsafeSlow){$.exports=en}else{eo(en,ee);ee.Buffer=es}function es($,ee,et){return ei($,ee,et)}eo(ei,es);es.from=function($,ee,et){if(typeof $==="number"){throw new TypeError("Argument must not be a number")}return ei($,ee,et)};es.alloc=function($,ee,et){if(typeof $!=="number"){throw new TypeError("Argument must be a number")}var en=ei($);if(ee!==undefined){if(typeof et==="string"){en.fill(ee,et)}else{en.fill(ee)}}else{en.fill(0)}return en};es.allocUnsafe=function($){if(typeof $!=="number"){throw new TypeError("Argument must be a number")}return ei($)};es.allocUnsafeSlow=function($){if(typeof $!=="number"){throw new TypeError("Argument must be a number")}return en.SlowBuffer($)}},8393:function($,ee,et){"use strict";var en=this&&this.__createBinding||(Object.create?function($,ee,et,en){if(en===undefined)en=et;var ei=Object.getOwnPropertyDescriptor(ee,et);if(!ei||("get"in ei?!ee.__esModule:ei.writable||ei.configurable)){ei={enumerable:true,get:function $(){return ee[et]}}}Object.defineProperty($,en,ei)}:function($,ee,et,en){if(en===undefined)en=et;$[en]=ee[et]});var ei=this&&this.__exportStar||function($,ee){for(var et in $)if(et!=="default"&&!Object.prototype.hasOwnProperty.call(ee,et))en(ee,$,et)};Object.defineProperty(ee,"__esModule",{value:true});ei(et(5416),ee)},4473:function($,ee,et){"use strict";var en=this&&this.__createBinding||(Object.create?function($,ee,et,en){if(en===undefined)en=et;var ei=Object.getOwnPropertyDescriptor(ee,et);if(!ei||("get"in ei?!ee.__esModule:ei.writable||ei.configurable)){ei={enumerable:true,get:function $(){return ee[et]}}}Object.defineProperty($,en,ei)}:function($,ee,et,en){if(en===undefined)en=et;$[en]=ee[et]});var ei=this&&this.__setModuleDefault||(Object.create?function($,ee){Object.defineProperty($,"default",{enumerable:true,value:ee})}:function($,ee){$["default"]=ee});var eo=this&&this.__importStar||function($){if($&&$.__esModule)return $;var ee={};if($!=null){for(var et in $)if(et!=="default"&&Object.prototype.hasOwnProperty.call($,et))en(ee,$,et)}ei(ee,$);return ee};Object.defineProperty(ee,"__esModule",{value:true});ee.Timestamp=ee.deserializeClock=ee.serializeClock=ee.makeClientId=ee.makeClock=ee.setClock=ee.getClock=ee.merkle=void 0;var es=eo(et(5470));ee.merkle=es;var eu=et(3136);Object.defineProperty(ee,"getClock",{enumerable:true,get:function $(){return eu.getClock}});Object.defineProperty(ee,"setClock",{enumerable:true,get:function $(){return eu.setClock}});Object.defineProperty(ee,"makeClock",{enumerable:true,get:function $(){return eu.makeClock}});Object.defineProperty(ee,"makeClientId",{enumerable:true,get:function $(){return eu.makeClientId}});Object.defineProperty(ee,"serializeClock",{enumerable:true,get:function $(){return eu.serializeClock}});Object.defineProperty(ee,"deserializeClock",{enumerable:true,get:function $(){return eu.deserializeClock}});Object.defineProperty(ee,"Timestamp",{enumerable:true,get:function $(){return eu.Timestamp}})},5470:($,ee)=>{"use strict";function et($,ee){if(ee==null||ee>$.length)ee=$.length;for(var et=0,en=new Array(ee);et<ee;et++)en[et]=$[et];return en}function en($){if(Array.isArray($))return et($)}function ei($,ee,et){if(ee in $){Object.defineProperty($,ee,{value:et,enumerable:true,configurable:true,writable:true})}else{$[ee]=et}return $}function eo($){if(typeof Symbol!=="undefined"&&$[Symbol.iterator]!=null||$["@@iterator"]!=null)return Array.from($)}function es(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function eu($){return en($)||eo($)||el($)||es()}function el($,ee){if(!$)return;if(typeof $==="string")return et($,ee);var en=Object.prototype.toString.call($).slice(8,-1);if(en==="Object"&&$.constructor)en=$.constructor.name;if(en==="Map"||en==="Set")return Array.from(en);if(en==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(en))return et($,ee)}Object.defineProperty(ee,"__esModule",{value:true});ee.debug=ee.prune=ee.diff=ee.build=ee.insert=ee.keyToTimestamp=ee.getKeys=ee.emptyTrie=void 0;function ef(){return{hash:0}}ee.emptyTrie=ef;function ed($){return["0","1","2"].includes($)}function ep($){return Object.keys($).filter(ed)}ee.getKeys=ep;function eh($){var ee=$+"0".repeat(16-$.length);return parseInt(ee,3)*1e3*60}ee.keyToTimestamp=eh;function ey($,ee){var et=ee.hash();var en=Number(Math.floor(ee.millis()/1e3/60)).toString(3);$=Object.assign({},$,{hash:($.hash||0)^et});return eg($,en,et)}ee.insert=ey;function eg($,ee,et){if(ee.length===0){return $}var en=ee[0];var eo=ed(en)?$[en]:undefined;var es=eo||{};return Object.assign({},$,ei({},en,Object.assign({},es,eg(es,ee.slice(1),et),{hash:(es.hash||0)^et})))}function em($){var ee=ef();var et=true,en=false,ei=undefined;try{for(var eo=$[Symbol.iterator](),es;!(et=(es=eo.next()).done);et=true){var eu=es.value;ey(ee,eu)}}catch($){en=true;ei=$}finally{try{if(!et&&eo.return!=null){eo.return()}}finally{if(en){throw ei}}}return ee}ee.build=em;function e_($,ee){if($.hash===ee.hash){return null}var et=$;var en=ee;var ei="";while(1){var eo=new Set(eu(ep(et)).concat(eu(ep(en))));var es=eu(eo.values());es.sort();var el=null;for(var ed=0;ed<es.length;ed++){var ey=es[ed];var eg=et[ey];var em=en[ey];if(!eg||!em){break}if(eg.hash!==em.hash){el=ey;break}}if(!el){return eh(ei)}ei+=el;et=et[el]||ef();en=en[el]||ef()}return null}ee.diff=e_;function ew($){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;if(!$.hash){return $}var et=ep($);et.sort();var en={hash:$.hash};var ei=true,eo=false,es=undefined;try{for(var eu=et.slice(-ee)[Symbol.iterator](),el;!(ei=(el=eu.next()).done);ei=true){var ef=el.value;var ed=$[ef];if(!ed){throw new Error("TrieNode for key ".concat(ef," could not be found"))}en[ef]=ew(ed,ee)}}catch($){eo=true;es=$}finally{try{if(!ei&&eu.return!=null){eu.return()}}finally{if(eo){throw es}}}return en}ee.prune=ew;function eE($){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",et=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;var en=" ".repeat(et)+(ee!==""?"k: ".concat(ee," "):"")+"hash: ".concat($.hash||"(empty)","\n");return en+ep($).map(function(ee){var en=$[ee];if(!en)return"";return eE(en,ee,et+2)}).join("")}ee.debug=eE},3136:function($,ee,et){"use strict";function en($){if($===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return $}function ei($,ee){if(!($ instanceof ee)){throw new TypeError("Cannot call a class as a function")}}function eo($,ee,et){if(e_()){eo=Reflect.construct}else{eo=function $($,ee,et){var en=[null];en.push.apply(en,ee);var ei=Function.bind.apply($,en);var eo=new ei;if(et)ey(eo,et.prototype);return eo}}return eo.apply(null,arguments)}function es($,ee){for(var et=0;et<ee.length;et++){var en=ee[et];en.enumerable=en.enumerable||false;en.configurable=true;if("value"in en)en.writable=true;Object.defineProperty($,en.key,en)}}function eu($,ee,et){if(ee)es($.prototype,ee);if(et)es($,et);return $}function el($){el=Object.setPrototypeOf?Object.getPrototypeOf:function $($){return $.__proto__||Object.getPrototypeOf($)};return el($)}function ef($,ee){if(typeof ee!=="function"&&ee!==null){throw new TypeError("Super expression must either be null or a function")}$.prototype=Object.create(ee&&ee.prototype,{constructor:{value:$,writable:true,configurable:true}});if(ee)ey($,ee)}function ed($,ee){if(ee!=null&&typeof Symbol!=="undefined"&&ee[Symbol.hasInstance]){return!!ee[Symbol.hasInstance]($)}else{return $ instanceof ee}}function ep($){return Function.toString.call($).indexOf("[native code]")!==-1}function eh($,ee){if(ee&&(eg(ee)==="object"||typeof ee==="function")){return ee}return en($)}function ey($,ee){ey=Object.setPrototypeOf||function $($,ee){$.__proto__=ee;return $};return ey($,ee)}function eg($){"@swc/helpers - typeof";return $&&typeof Symbol!=="undefined"&&$.constructor===Symbol?"symbol":typeof $}function em($){var ee=typeof Map==="function"?new Map:undefined;em=function $($){if($===null||!ep($))return $;if(typeof $!=="function"){throw new TypeError("Super expression must either be null or a function")}if(typeof ee!=="undefined"){if(ee.has($))return ee.get($);ee.set($,et)}function et(){return eo($,arguments,el(this).constructor)}et.prototype=Object.create($.prototype,{constructor:{value:et,enumerable:false,writable:true,configurable:true}});return ey(et,$)};return em($)}function e_(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch($){return false}}function ew($){var ee=e_();return function et(){var et=el($),en;if(ee){var ei=el(this).constructor;en=Reflect.construct(et,arguments,ei)}else{en=et.apply(this,arguments)}return eh(this,en)}}var eE=this&&this.__importDefault||function($){return $&&$.__esModule?$:{"default":$}};Object.defineProperty(ee,"__esModule",{value:true});ee.Timestamp=ee.makeClientId=ee.deserializeClock=ee.serializeClock=ee.makeClock=ee.getClock=ee.setClock=void 0;var eS=eE(et(8053));var eT=et(7429);var eO;function eA($){eO=$}ee.setClock=eA;function eI(){return eO}ee.getClock=eI;function eN($){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return{timestamp:eF.from($),merkle:ee}}ee.makeClock=eN;function eD($){return JSON.stringify({timestamp:$.timestamp.toString(),merkle:$.merkle})}ee.serializeClock=eD;function eR($){var ee;try{ee=JSON.parse($)}catch($){ee={timestamp:"1970-01-01T00:00:00.000Z-0000-"+eC(),merkle:{}}}var et=eP.parse(ee.timestamp);if(!et){throw new eP.InvalidError(ee.timestamp)}return{timestamp:eF.from(et),merkle:ee.merkle}}ee.deserializeClock=eR;function eC(){return(0,eT.v4)().replace(/-/g,"").slice(-16)}ee.makeClientId=eC;var ek={maxDrift:5*60*1e3};var eM=parseInt("0xFFFF");var eL=16;var eP=function(){function $(ee,et,en){ei(this,$);this._state={millis:ee,counter:et,node:en}}eu($,[{key:"valueOf",value:function $(){return this.toString()}},{key:"toString",value:function $(){return[new Date(this.millis()).toISOString(),("0000"+this.counter().toString(16).toUpperCase()).slice(-4),("0000000000000000"+this.node()).slice(-16)].join("-")}},{key:"millis",value:function $(){return this._state.millis}},{key:"counter",value:function $(){return this._state.counter}},{key:"node",value:function $(){return this._state.node}},{key:"hash",value:function $(){return eS.default.v3(this.toString())}}],[{key:"init",value:function ee(){var ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ee.maxDrift){ek.maxDrift=ee.maxDrift}eA(eN(new $(0,0,ee.node?("0000000000000000"+ee.node).toString().slice(-16):"")))}},{key:"parse",value:function ee(ee){if(ed(ee,$)){return ee}if(typeof ee==="string"){var et=ee.split("-");if(et&&et.length===5){var en=Date.parse(et.slice(0,3).join("-")).valueOf();var ei=parseInt(et[3],16);var eo=et[4];if(!isNaN(en)&&en>=0&&!isNaN(ei)&&ei<=eM&&typeof eo==="string"&&eo.length<=eL){return new $(en,ei,eo)}}}return null}},{key:"send",value:function ee(){if(!eO){return null}var ee=Date.now();var et=eO.timestamp.millis();var en=eO.timestamp.counter();var ei=Math.max(et,ee);var eo=et===ei?en+1:0;if(ei-ee>ek.maxDrift){throw new $.ClockDriftError(ei,ee,ek.maxDrift)}if(eo>eM){throw new $.OverflowError}eO.timestamp.setMillis(ei);eO.timestamp.setCounter(eo);return new $(eO.timestamp.millis(),eO.timestamp.counter(),eO.timestamp.node())}},{key:"recv",value:function ee(ee){if(!eO){return null}var et=Date.now();var en=ee.millis();var ei=ee.counter();if(en-et>ek.maxDrift){throw new $.ClockDriftError}var eo=eO.timestamp.millis();var es=eO.timestamp.counter();var eu=Math.max(Math.max(eo,et),en);var el=eu===eo&&eu===en?Math.max(es,ei)+1:eu===eo?es+1:eu===en?ei+1:0;if(eu-et>ek.maxDrift){throw new $.ClockDriftError}if(el>eM){throw new $.OverflowError}eO.timestamp.setMillis(eu);eO.timestamp.setCounter(el);return new $(eO.timestamp.millis(),eO.timestamp.counter(),eO.timestamp.node())}}]);return $}();eP.max=eP.parse("9999-12-31T23:59:59.999Z-FFFF-FFFFFFFFFFFFFFFF");eP.zero=eP.parse("1970-01-01T00:00:00.000Z-0000-0000000000000000");eP.since=function($){return $+"-0000-0000000000000000"};eP.DuplicateNodeError=function($){ef(et,$);var ee=ew(et);function et($){ei(this,et);var en;en=ee.call(this,"duplicate node identifier "+$);en.name="DuplicateNodeError";return en}return et}(em(Error));eP.ClockDriftError=function($){ef(et,$);var ee=ew(et);function et(){for(var $=arguments.length,en=new Array($),eo=0;eo<$;eo++){en[eo]=arguments[eo]}ei(this,et);var es;es=ee.call(this,["maximum clock drift exceeded"].concat(en).join(" "));es.name="ClockDriftError";return es}return et}(em(Error));eP.OverflowError=function($){ef(et,$);var ee=ew(et);function et(){ei(this,et);var $;$=ee.call(this,"timestamp counter overflow");$.name="OverflowError";return $}return et}(em(Error));eP.InvalidError=function($){ef(et,$);var ee=ew(et);function et(){for(var $=arguments.length,en=new Array($),eo=0;eo<$;eo++){en[eo]=arguments[eo]}ei(this,et);var es;es=ee.call(this,["timestamp is not valid"].concat(en.map(String)).join(" "));es.name="InvalidError";return es}return et}(em(Error));ee.Timestamp=eP;var eF=function($){ef(et,$);var ee=ew(et);function et(){ei(this,et);return ee.apply(this,arguments)}eu(et,[{key:"setMillis",value:function $($){this._state.millis=$}},{key:"setCounter",value:function $($){this._state.counter=$}},{key:"setNode",value:function $($){this._state.node=$}}],[{key:"from",value:function $($){return new et($.millis(),$.counter(),$.node())}}]);return et}(eP)},5416:function($,ee,et){"use strict";var en=this&&this.__createBinding||(Object.create?function($,ee,et,en){if(en===undefined)en=et;var ei=Object.getOwnPropertyDescriptor(ee,et);if(!ei||("get"in ei?!ee.__esModule:ei.writable||ei.configurable)){ei={enumerable:true,get:function $(){return ee[et]}}}Object.defineProperty($,en,ei)}:function($,ee,et,en){if(en===undefined)en=et;$[en]=ee[et]});var ei=this&&this.__setModuleDefault||(Object.create?function($,ee){Object.defineProperty($,"default",{enumerable:true,value:ee})}:function($,ee){$["default"]=ee});var eo=this&&this.__importStar||function($){if($&&$.__esModule)return $;var ee={};if($!=null){for(var et in $)if(et!=="default"&&Object.prototype.hasOwnProperty.call($,et))en(ee,$,et)}ei(ee,$);return ee};Object.defineProperty(ee,"__esModule",{value:true});ee.SyncProtoBuf=ee.Timestamp=ee.deserializeClock=ee.serializeClock=ee.makeClientId=ee.makeClock=ee.setClock=ee.getClock=ee.merkle=void 0;var es=eo(et(1323));var eu=et(4473);Object.defineProperty(ee,"merkle",{enumerable:true,get:function $(){return eu.merkle}});Object.defineProperty(ee,"getClock",{enumerable:true,get:function $(){return eu.getClock}});Object.defineProperty(ee,"setClock",{enumerable:true,get:function $(){return eu.setClock}});Object.defineProperty(ee,"makeClock",{enumerable:true,get:function $(){return eu.makeClock}});Object.defineProperty(ee,"makeClientId",{enumerable:true,get:function $(){return eu.makeClientId}});Object.defineProperty(ee,"serializeClock",{enumerable:true,get:function $(){return eu.serializeClock}});Object.defineProperty(ee,"deserializeClock",{enumerable:true,get:function $(){return eu.deserializeClock}});Object.defineProperty(ee,"Timestamp",{enumerable:true,get:function $(){return eu.Timestamp}});ee.SyncProtoBuf=es},1323:($,ee,et)=>{"use strict";var en=et(3019);var ei=en;var eo=globalThis;ei.exportSymbol("proto.EncryptedData",null,eo);ei.exportSymbol("proto.Message",null,eo);ei.exportSymbol("proto.MessageEnvelope",null,eo);ei.exportSymbol("proto.SyncRequest",null,eo);ei.exportSymbol("proto.SyncResponse",null,eo);proto.EncryptedData=function($){en.Message.initialize(this,$,0,-1,null,null)};ei.inherits(proto.EncryptedData,en.Message);if(ei.DEBUG&&!COMPILED){proto.EncryptedData.displayName="proto.EncryptedData"}proto.Message=function($){en.Message.initialize(this,$,0,-1,null,null)};ei.inherits(proto.Message,en.Message);if(ei.DEBUG&&!COMPILED){proto.Message.displayName="proto.Message"}proto.MessageEnvelope=function($){en.Message.initialize(this,$,0,-1,null,null)};ei.inherits(proto.MessageEnvelope,en.Message);if(ei.DEBUG&&!COMPILED){proto.MessageEnvelope.displayName="proto.MessageEnvelope"}proto.SyncRequest=function($){en.Message.initialize(this,$,0,-1,proto.SyncRequest.repeatedFields_,null)};ei.inherits(proto.SyncRequest,en.Message);if(ei.DEBUG&&!COMPILED){proto.SyncRequest.displayName="proto.SyncRequest"}proto.SyncResponse=function($){en.Message.initialize(this,$,0,-1,proto.SyncResponse.repeatedFields_,null)};ei.inherits(proto.SyncResponse,en.Message);if(ei.DEBUG&&!COMPILED){proto.SyncResponse.displayName="proto.SyncResponse"}if(en.Message.GENERATE_TO_OBJECT){proto.EncryptedData.prototype.toObject=function($){return proto.EncryptedData.toObject($,this)};proto.EncryptedData.toObject=function($,ee){var et,en={iv:ee.getIv_asB64(),authtag:ee.getAuthtag_asB64(),data:ee.getData_asB64()};if($){en.$jspbMessageInstance=ee}return en}}proto.EncryptedData.deserializeBinary=function($){var ee=new en.BinaryReader($);var et=new proto.EncryptedData;return proto.EncryptedData.deserializeBinaryFromReader(et,ee)};proto.EncryptedData.deserializeBinaryFromReader=function($,ee){while(ee.nextField()){if(ee.isEndGroup()){break}var et=ee.getFieldNumber();switch(et){case 1:var en=ee.readBytes();$.setIv(en);break;case 2:var en=ee.readBytes();$.setAuthtag(en);break;case 3:var en=ee.readBytes();$.setData(en);break;default:ee.skipField();break}}return $};proto.EncryptedData.prototype.serializeBinary=function(){var $=new en.BinaryWriter;proto.EncryptedData.serializeBinaryToWriter(this,$);return $.getResultBuffer()};proto.EncryptedData.serializeBinaryToWriter=function($,ee){var et=undefined;et=$.getIv_asU8();if(et.length>0){ee.writeBytes(1,et)}et=$.getAuthtag_asU8();if(et.length>0){ee.writeBytes(2,et)}et=$.getData_asU8();if(et.length>0){ee.writeBytes(3,et)}};proto.EncryptedData.prototype.getIv=function(){return en.Message.getFieldWithDefault(this,1,"")};proto.EncryptedData.prototype.getIv_asB64=function(){return en.Message.bytesAsB64(this.getIv())};proto.EncryptedData.prototype.getIv_asU8=function(){return en.Message.bytesAsU8(this.getIv())};proto.EncryptedData.prototype.setIv=function($){return en.Message.setProto3BytesField(this,1,$)};proto.EncryptedData.prototype.getAuthtag=function(){return en.Message.getFieldWithDefault(this,2,"")};proto.EncryptedData.prototype.getAuthtag_asB64=function(){return en.Message.bytesAsB64(this.getAuthtag())};proto.EncryptedData.prototype.getAuthtag_asU8=function(){return en.Message.bytesAsU8(this.getAuthtag())};proto.EncryptedData.prototype.setAuthtag=function($){return en.Message.setProto3BytesField(this,2,$)};proto.EncryptedData.prototype.getData=function(){return en.Message.getFieldWithDefault(this,3,"")};proto.EncryptedData.prototype.getData_asB64=function(){return en.Message.bytesAsB64(this.getData())};proto.EncryptedData.prototype.getData_asU8=function(){return en.Message.bytesAsU8(this.getData())};proto.EncryptedData.prototype.setData=function($){return en.Message.setProto3BytesField(this,3,$)};if(en.Message.GENERATE_TO_OBJECT){proto.Message.prototype.toObject=function($){return proto.Message.toObject($,this)};proto.Message.toObject=function($,ee){var et,ei={dataset:en.Message.getFieldWithDefault(ee,1,""),row:en.Message.getFieldWithDefault(ee,2,""),column:en.Message.getFieldWithDefault(ee,3,""),value:en.Message.getFieldWithDefault(ee,4,"")};if($){ei.$jspbMessageInstance=ee}return ei}}proto.Message.deserializeBinary=function($){var ee=new en.BinaryReader($);var et=new proto.Message;return proto.Message.deserializeBinaryFromReader(et,ee)};proto.Message.deserializeBinaryFromReader=function($,ee){while(ee.nextField()){if(ee.isEndGroup()){break}var et=ee.getFieldNumber();switch(et){case 1:var en=ee.readString();$.setDataset(en);break;case 2:var en=ee.readString();$.setRow(en);break;case 3:var en=ee.readString();$.setColumn(en);break;case 4:var en=ee.readString();$.setValue(en);break;default:ee.skipField();break}}return $};proto.Message.prototype.serializeBinary=function(){var $=new en.BinaryWriter;proto.Message.serializeBinaryToWriter(this,$);return $.getResultBuffer()};proto.Message.serializeBinaryToWriter=function($,ee){var et=undefined;et=$.getDataset();if(et.length>0){ee.writeString(1,et)}et=$.getRow();if(et.length>0){ee.writeString(2,et)}et=$.getColumn();if(et.length>0){ee.writeString(3,et)}et=$.getValue();if(et.length>0){ee.writeString(4,et)}};proto.Message.prototype.getDataset=function(){return en.Message.getFieldWithDefault(this,1,"")};proto.Message.prototype.setDataset=function($){return en.Message.setProto3StringField(this,1,$)};proto.Message.prototype.getRow=function(){return en.Message.getFieldWithDefault(this,2,"")};proto.Message.prototype.setRow=function($){return en.Message.setProto3StringField(this,2,$)};proto.Message.prototype.getColumn=function(){return en.Message.getFieldWithDefault(this,3,"")};proto.Message.prototype.setColumn=function($){return en.Message.setProto3StringField(this,3,$)};proto.Message.prototype.getValue=function(){return en.Message.getFieldWithDefault(this,4,"")};proto.Message.prototype.setValue=function($){return en.Message.setProto3StringField(this,4,$)};if(en.Message.GENERATE_TO_OBJECT){proto.MessageEnvelope.prototype.toObject=function($){return proto.MessageEnvelope.toObject($,this)};proto.MessageEnvelope.toObject=function($,ee){var et,ei={timestamp:en.Message.getFieldWithDefault(ee,1,""),isencrypted:en.Message.getBooleanFieldWithDefault(ee,2,false),content:ee.getContent_asB64()};if($){ei.$jspbMessageInstance=ee}return ei}}proto.MessageEnvelope.deserializeBinary=function($){var ee=new en.BinaryReader($);var et=new proto.MessageEnvelope;return proto.MessageEnvelope.deserializeBinaryFromReader(et,ee)};proto.MessageEnvelope.deserializeBinaryFromReader=function($,ee){while(ee.nextField()){if(ee.isEndGroup()){break}var et=ee.getFieldNumber();switch(et){case 1:var en=ee.readString();$.setTimestamp(en);break;case 2:var en=ee.readBool();$.setIsencrypted(en);break;case 3:var en=ee.readBytes();$.setContent(en);break;default:ee.skipField();break}}return $};proto.MessageEnvelope.prototype.serializeBinary=function(){var $=new en.BinaryWriter;proto.MessageEnvelope.serializeBinaryToWriter(this,$);return $.getResultBuffer()};proto.MessageEnvelope.serializeBinaryToWriter=function($,ee){var et=undefined;et=$.getTimestamp();if(et.length>0){ee.writeString(1,et)}et=$.getIsencrypted();if(et){ee.writeBool(2,et)}et=$.getContent_asU8();if(et.length>0){ee.writeBytes(3,et)}};proto.MessageEnvelope.prototype.getTimestamp=function(){return en.Message.getFieldWithDefault(this,1,"")};proto.MessageEnvelope.prototype.setTimestamp=function($){return en.Message.setProto3StringField(this,1,$)};proto.MessageEnvelope.prototype.getIsencrypted=function(){return en.Message.getBooleanFieldWithDefault(this,2,false)};proto.MessageEnvelope.prototype.setIsencrypted=function($){return en.Message.setProto3BooleanField(this,2,$)};proto.MessageEnvelope.prototype.getContent=function(){return en.Message.getFieldWithDefault(this,3,"")};proto.MessageEnvelope.prototype.getContent_asB64=function(){return en.Message.bytesAsB64(this.getContent())};proto.MessageEnvelope.prototype.getContent_asU8=function(){return en.Message.bytesAsU8(this.getContent())};proto.MessageEnvelope.prototype.setContent=function($){return en.Message.setProto3BytesField(this,3,$)};proto.SyncRequest.repeatedFields_=[1];if(en.Message.GENERATE_TO_OBJECT){proto.SyncRequest.prototype.toObject=function($){return proto.SyncRequest.toObject($,this)};proto.SyncRequest.toObject=function($,ee){var et,ei={messagesList:en.Message.toObjectList(ee.getMessagesList(),proto.MessageEnvelope.toObject,$),fileid:en.Message.getFieldWithDefault(ee,2,""),groupid:en.Message.getFieldWithDefault(ee,3,""),keyid:en.Message.getFieldWithDefault(ee,5,""),since:en.Message.getFieldWithDefault(ee,6,"")};if($){ei.$jspbMessageInstance=ee}return ei}}proto.SyncRequest.deserializeBinary=function($){var ee=new en.BinaryReader($);var et=new proto.SyncRequest;return proto.SyncRequest.deserializeBinaryFromReader(et,ee)};proto.SyncRequest.deserializeBinaryFromReader=function($,ee){while(ee.nextField()){if(ee.isEndGroup()){break}var et=ee.getFieldNumber();switch(et){case 1:var en=new proto.MessageEnvelope;ee.readMessage(en,proto.MessageEnvelope.deserializeBinaryFromReader);$.addMessages(en);break;case 2:var en=ee.readString();$.setFileid(en);break;case 3:var en=ee.readString();$.setGroupid(en);break;case 5:var en=ee.readString();$.setKeyid(en);break;case 6:var en=ee.readString();$.setSince(en);break;default:ee.skipField();break}}return $};proto.SyncRequest.prototype.serializeBinary=function(){var $=new en.BinaryWriter;proto.SyncRequest.serializeBinaryToWriter(this,$);return $.getResultBuffer()};proto.SyncRequest.serializeBinaryToWriter=function($,ee){var et=undefined;et=$.getMessagesList();if(et.length>0){ee.writeRepeatedMessage(1,et,proto.MessageEnvelope.serializeBinaryToWriter)}et=$.getFileid();if(et.length>0){ee.writeString(2,et)}et=$.getGroupid();if(et.length>0){ee.writeString(3,et)}et=$.getKeyid();if(et.length>0){ee.writeString(5,et)}et=$.getSince();if(et.length>0){ee.writeString(6,et)}};proto.SyncRequest.prototype.getMessagesList=function(){return en.Message.getRepeatedWrapperField(this,proto.MessageEnvelope,1)};proto.SyncRequest.prototype.setMessagesList=function($){return en.Message.setRepeatedWrapperField(this,1,$)};proto.SyncRequest.prototype.addMessages=function($,ee){return en.Message.addToRepeatedWrapperField(this,1,$,proto.MessageEnvelope,ee)};proto.SyncRequest.prototype.clearMessagesList=function(){return this.setMessagesList([])};proto.SyncRequest.prototype.getFileid=function(){return en.Message.getFieldWithDefault(this,2,"")};proto.SyncRequest.prototype.setFileid=function($){return en.Message.setProto3StringField(this,2,$)};proto.SyncRequest.prototype.getGroupid=function(){return en.Message.getFieldWithDefault(this,3,"")};proto.SyncRequest.prototype.setGroupid=function($){return en.Message.setProto3StringField(this,3,$)};proto.SyncRequest.prototype.getKeyid=function(){return en.Message.getFieldWithDefault(this,5,"")};proto.SyncRequest.prototype.setKeyid=function($){return en.Message.setProto3StringField(this,5,$)};proto.SyncRequest.prototype.getSince=function(){return en.Message.getFieldWithDefault(this,6,"")};proto.SyncRequest.prototype.setSince=function($){return en.Message.setProto3StringField(this,6,$)};proto.SyncResponse.repeatedFields_=[1];if(en.Message.GENERATE_TO_OBJECT){proto.SyncResponse.prototype.toObject=function($){return proto.SyncResponse.toObject($,this)};proto.SyncResponse.toObject=function($,ee){var et,ei={messagesList:en.Message.toObjectList(ee.getMessagesList(),proto.MessageEnvelope.toObject,$),merkle:en.Message.getFieldWithDefault(ee,2,"")};if($){ei.$jspbMessageInstance=ee}return ei}}proto.SyncResponse.deserializeBinary=function($){var ee=new en.BinaryReader($);var et=new proto.SyncResponse;return proto.SyncResponse.deserializeBinaryFromReader(et,ee)};proto.SyncResponse.deserializeBinaryFromReader=function($,ee){while(ee.nextField()){if(ee.isEndGroup()){break}var et=ee.getFieldNumber();switch(et){case 1:var en=new proto.MessageEnvelope;ee.readMessage(en,proto.MessageEnvelope.deserializeBinaryFromReader);$.addMessages(en);break;case 2:var en=ee.readString();$.setMerkle(en);break;default:ee.skipField();break}}return $};proto.SyncResponse.prototype.serializeBinary=function(){var $=new en.BinaryWriter;proto.SyncResponse.serializeBinaryToWriter(this,$);return $.getResultBuffer()};proto.SyncResponse.serializeBinaryToWriter=function($,ee){var et=undefined;et=$.getMessagesList();if(et.length>0){ee.writeRepeatedMessage(1,et,proto.MessageEnvelope.serializeBinaryToWriter)}et=$.getMerkle();if(et.length>0){ee.writeString(2,et)}};proto.SyncResponse.prototype.getMessagesList=function(){return en.Message.getRepeatedWrapperField(this,proto.MessageEnvelope,1)};proto.SyncResponse.prototype.setMessagesList=function($){return en.Message.setRepeatedWrapperField(this,1,$)};proto.SyncResponse.prototype.addMessages=function($,ee){return en.Message.addToRepeatedWrapperField(this,1,$,proto.MessageEnvelope,ee)};proto.SyncResponse.prototype.clearMessagesList=function(){return this.setMessagesList([])};proto.SyncResponse.prototype.getMerkle=function(){return en.Message.getFieldWithDefault(this,2,"")};proto.SyncResponse.prototype.setMerkle=function($){return en.Message.setProto3StringField(this,2,$)};ei.object.extend(ee,proto)},4927:($,ee,et)=>{$.exports=en;function en($,ee){if(ei("noDeprecation")){return $}var et=false;function en(){if(!et){if(ei("throwDeprecation")){throw new Error(ee)}else if(ei("traceDeprecation")){console.trace(ee)}else{console.warn(ee)}et=true}return $.apply(this,arguments)}return en}function ei($){try{if(!et.g.localStorage)return false}catch($){return false}var ee=et.g.localStorage[$];if(null==ee)return false;return String(ee).toLowerCase()==="true"}},384:$=>{$.exports=function $($){return $&&typeof $==="object"&&typeof $.copy==="function"&&typeof $.fill==="function"&&typeof $.readUInt8==="function"}},5955:($,ee,et)=>{"use strict";var en=et(2584);var ei=et(8662);var eo=et(6430);var es=et(5692);function eu($){return $.call.bind($)}var el=typeof BigInt!=="undefined";var ef=typeof Symbol!=="undefined";var ed=eu(Object.prototype.toString);var ep=eu(Number.prototype.valueOf);var eh=eu(String.prototype.valueOf);var ey=eu(Boolean.prototype.valueOf);if(el){var eg=eu(BigInt.prototype.valueOf)}if(ef){var em=eu(Symbol.prototype.valueOf)}function e_($,ee){if(typeof $!=="object"){return false}try{ee($);return true}catch($){return false}}ee.isArgumentsObject=en;ee.isGeneratorFunction=ei;ee.isTypedArray=es;function ew($){return typeof Promise!=="undefined"&&$ instanceof Promise||$!==null&&typeof $==="object"&&typeof $.then==="function"&&typeof $.catch==="function"}ee.isPromise=ew;function eE($){if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){return ArrayBuffer.isView($)}return es($)||eq($)}ee.isArrayBufferView=eE;function eS($){return eo($)==="Uint8Array"}ee.isUint8Array=eS;function eT($){return eo($)==="Uint8ClampedArray"}ee.isUint8ClampedArray=eT;function eO($){return eo($)==="Uint16Array"}ee.isUint16Array=eO;function eA($){return eo($)==="Uint32Array"}ee.isUint32Array=eA;function eI($){return eo($)==="Int8Array"}ee.isInt8Array=eI;function eN($){return eo($)==="Int16Array"}ee.isInt16Array=eN;function eD($){return eo($)==="Int32Array"}ee.isInt32Array=eD;function eR($){return eo($)==="Float32Array"}ee.isFloat32Array=eR;function eC($){return eo($)==="Float64Array"}ee.isFloat64Array=eC;function ek($){return eo($)==="BigInt64Array"}ee.isBigInt64Array=ek;function eM($){return eo($)==="BigUint64Array"}ee.isBigUint64Array=eM;function eL($){return ed($)==="[object Map]"}eL.working=typeof Map!=="undefined"&&eL(new Map);function eP($){if(typeof Map==="undefined"){return false}return eL.working?eL($):$ instanceof Map}ee.isMap=eP;function eF($){return ed($)==="[object Set]"}eF.working=typeof Set!=="undefined"&&eF(new Set);function eB($){if(typeof Set==="undefined"){return false}return eF.working?eF($):$ instanceof Set}ee.isSet=eB;function eU($){return ed($)==="[object WeakMap]"}eU.working=typeof WeakMap!=="undefined"&&eU(new WeakMap);function ej($){if(typeof WeakMap==="undefined"){return false}return eU.working?eU($):$ instanceof WeakMap}ee.isWeakMap=ej;function eW($){return ed($)==="[object WeakSet]"}eW.working=typeof WeakSet!=="undefined"&&eW(new WeakSet);function eH($){return eW($)}ee.isWeakSet=eH;function ez($){return ed($)==="[object ArrayBuffer]"}ez.working=typeof ArrayBuffer!=="undefined"&&ez(new ArrayBuffer);function eV($){if(typeof ArrayBuffer==="undefined"){return false}return ez.working?ez($):$ instanceof ArrayBuffer}ee.isArrayBuffer=eV;function e$($){return ed($)==="[object DataView]"}e$.working=typeof ArrayBuffer!=="undefined"&&typeof DataView!=="undefined"&&e$(new DataView(new ArrayBuffer(1),0,1));function eq($){if(typeof DataView==="undefined"){return false}return e$.working?e$($):$ instanceof DataView}ee.isDataView=eq;var eG=typeof SharedArrayBuffer!=="undefined"?SharedArrayBuffer:undefined;function eY($){return ed($)==="[object SharedArrayBuffer]"}function eK($){if(typeof eG==="undefined"){return false}if(typeof eY.working==="undefined"){eY.working=eY(new eG)}return eY.working?eY($):$ instanceof eG}ee.isSharedArrayBuffer=eK;function eZ($){return ed($)==="[object AsyncFunction]"}ee.isAsyncFunction=eZ;function eJ($){return ed($)==="[object Map Iterator]"}ee.isMapIterator=eJ;function eX($){return ed($)==="[object Set Iterator]"}ee.isSetIterator=eX;function eQ($){return ed($)==="[object Generator]"}ee.isGeneratorObject=eQ;function e0($){return ed($)==="[object WebAssembly.Module]"}ee.isWebAssemblyCompiledModule=e0;function e1($){return e_($,ep)}ee.isNumberObject=e1;function e2($){return e_($,eh)}ee.isStringObject=e2;function e6($){return e_($,ey)}ee.isBooleanObject=e6;function e4($){return el&&e_($,eg)}ee.isBigIntObject=e4;function e3($){return ef&&e_($,em)}ee.isSymbolObject=e3;function e8($){return e1($)||e2($)||e6($)||e4($)||e3($)}ee.isBoxedPrimitive=e8;function e5($){return typeof Uint8Array!=="undefined"&&(eV($)||eK($))}ee.isAnyArrayBuffer=e5;["isProxy","isExternal","isModuleNamespaceObject"].forEach(function($){Object.defineProperty(ee,$,{enumerable:false,value:function(){throw new Error($+" is not supported in userland")}})})},9539:($,ee,et)=>{var en=et(4155);var ei=Object.getOwnPropertyDescriptors||function $($){var ee=Object.keys($);var et={};for(var en=0;en<ee.length;en++){et[ee[en]]=Object.getOwnPropertyDescriptor($,ee[en])}return et};var eo=/%[sdj%]/g;ee.format=function($){if(!eN($)){var ee=[];for(var et=0;et<arguments.length;et++){ee.push(ef(arguments[et]))}return ee.join(" ")}var et=1;var en=arguments;var ei=en.length;var es=String($).replace(eo,function($){if($==="%%")return"%";if(et>=ei)return $;switch($){case"%s":return String(en[et++]);case"%d":return Number(en[et++]);case"%j":try{return JSON.stringify(en[et++])}catch($){return"[Circular]"}default:return $}});for(var eu=en[et];et<ei;eu=en[++et]){if(eO(eu)||!ek(eu)){es+=" "+eu}else{es+=" "+ef(eu)}}return es};ee.deprecate=function($,et){if(typeof en!=="undefined"&&en.noDeprecation===true){return $}if(typeof en==="undefined"){return function(){return ee.deprecate($,et).apply(this,arguments)}}var ei=false;function eo(){if(!ei){if(en.throwDeprecation){throw new Error(et)}else if(en.traceDeprecation){console.trace(et)}else{console.error(et)}ei=true}return $.apply(this,arguments)}return eo};var es={};var eu=/^$/;if(({}).NODE_DEBUG){var el={}.NODE_DEBUG;el=el.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase();eu=new RegExp("^"+el+"$","i")}ee.debuglog=function($){$=$.toUpperCase();if(!es[$]){if(eu.test($)){var et=en.pid;es[$]=function(){var en=ee.format.apply(ee,arguments);console.error("%s %d: %s",$,et,en)}}else{es[$]=function(){}}}return es[$]};function ef($,et){var en={seen:[],stylize:ep};if(arguments.length>=3)en.depth=arguments[2];if(arguments.length>=4)en.colors=arguments[3];if(eT(et)){en.showHidden=et}else if(et){ee._extend(en,et)}if(eR(en.showHidden))en.showHidden=false;if(eR(en.depth))en.depth=2;if(eR(en.colors))en.colors=false;if(eR(en.customInspect))en.customInspect=true;if(en.colors)en.stylize=ed;return ey(en,$,en.depth)}ee.inspect=ef;ef.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]};ef.styles={"special":"cyan","number":"yellow","boolean":"yellow","undefined":"grey","null":"bold","string":"green","date":"magenta","regexp":"red"};function ed($,ee){var et=ef.styles[ee];if(et){return"\x1b["+ef.colors[et][0]+"m"+$+"\x1b["+ef.colors[et][1]+"m"}else{return $}}function ep($,ee){return $}function eh($){var ee={};$.forEach(function($,et){ee[$]=true});return ee}function ey($,et,en){if($.customInspect&&et&&eP(et.inspect)&&et.inspect!==ee.inspect&&!(et.constructor&&et.constructor.prototype===et)){var ei=et.inspect(en,$);if(!eN(ei)){ei=ey($,ei,en)}return ei}var eo=eg($,et);if(eo){return eo}var es=Object.keys(et);var eu=eh(es);if($.showHidden){es=Object.getOwnPropertyNames(et)}if(eL(et)&&(es.indexOf("message")>=0||es.indexOf("description")>=0)){return em(et)}if(es.length===0){if(eP(et)){var el=et.name?": "+et.name:"";return $.stylize("[Function"+el+"]","special")}if(eC(et)){return $.stylize(RegExp.prototype.toString.call(et),"regexp")}if(eM(et)){return $.stylize(Date.prototype.toString.call(et),"date")}if(eL(et)){return em(et)}}var ef="",ed=false,ep=["{","}"];if(eS(et)){ed=true;ep=["[","]"]}if(eP(et)){var eT=et.name?": "+et.name:"";ef=" [Function"+eT+"]"}if(eC(et)){ef=" "+RegExp.prototype.toString.call(et)}if(eM(et)){ef=" "+Date.prototype.toUTCString.call(et)}if(eL(et)){ef=" "+em(et)}if(es.length===0&&(!ed||et.length==0)){return ep[0]+ef+ep[1]}if(en<0){if(eC(et)){return $.stylize(RegExp.prototype.toString.call(et),"regexp")}else{return $.stylize("[Object]","special")}}$.seen.push(et);var eO;if(ed){eO=e_($,et,en,eu,es)}else{eO=es.map(function(ee){return ew($,et,en,eu,ee,ed)})}$.seen.pop();return eE(eO,ef,ep)}function eg($,ee){if(eR(ee))return $.stylize("undefined","undefined");if(eN(ee)){var et="'"+JSON.stringify(ee).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return $.stylize(et,"string")}if(eI(ee))return $.stylize(""+ee,"number");if(eT(ee))return $.stylize(""+ee,"boolean");if(eO(ee))return $.stylize("null","null")}function em($){return"["+Error.prototype.toString.call($)+"]"}function e_($,ee,et,en,ei){var eo=[];for(var es=0,eu=ee.length;es<eu;++es){if(eH(ee,String(es))){eo.push(ew($,ee,et,en,String(es),true))}else{eo.push("")}}ei.forEach(function(ei){if(!ei.match(/^\d+$/)){eo.push(ew($,ee,et,en,ei,true))}});return eo}function ew($,ee,et,en,ei,eo){var es,eu,el;el=Object.getOwnPropertyDescriptor(ee,ei)||{value:ee[ei]};if(el.get){if(el.set){eu=$.stylize("[Getter/Setter]","special")}else{eu=$.stylize("[Getter]","special")}}else{if(el.set){eu=$.stylize("[Setter]","special")}}if(!eH(en,ei)){es="["+ei+"]"}if(!eu){if($.seen.indexOf(el.value)<0){if(eO(et)){eu=ey($,el.value,null)}else{eu=ey($,el.value,et-1)}if(eu.indexOf("\n")>-1){if(eo){eu=eu.split("\n").map(function($){return" "+$}).join("\n").slice(2)}else{eu="\n"+eu.split("\n").map(function($){return" "+$}).join("\n")}}}else{eu=$.stylize("[Circular]","special")}}if(eR(es)){if(eo&&ei.match(/^\d+$/)){return eu}es=JSON.stringify(""+ei);if(es.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){es=es.slice(1,-1);es=$.stylize(es,"name")}else{es=es.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");es=$.stylize(es,"string")}}return es+": "+eu}function eE($,ee,et){var en=0;var ei=$.reduce(function($,ee){en++;if(ee.indexOf("\n")>=0)en++;return $+ee.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(ei>60){return et[0]+(ee===""?"":ee+"\n ")+" "+$.join(",\n ")+" "+et[1]}return et[0]+ee+" "+$.join(", ")+" "+et[1]}ee.types=et(5955);function eS($){return Array.isArray($)}ee.isArray=eS;function eT($){return typeof $==="boolean"}ee.isBoolean=eT;function eO($){return $===null}ee.isNull=eO;function eA($){return $==null}ee.isNullOrUndefined=eA;function eI($){return typeof $==="number"}ee.isNumber=eI;function eN($){return typeof $==="string"}ee.isString=eN;function eD($){return typeof $==="symbol"}ee.isSymbol=eD;function eR($){return $===void 0}ee.isUndefined=eR;function eC($){return ek($)&&eB($)==="[object RegExp]"}ee.isRegExp=eC;ee.types.isRegExp=eC;function ek($){return typeof $==="object"&&$!==null}ee.isObject=ek;function eM($){return ek($)&&eB($)==="[object Date]"}ee.isDate=eM;ee.types.isDate=eM;function eL($){return ek($)&&(eB($)==="[object Error]"||$ instanceof Error)}ee.isError=eL;ee.types.isNativeError=eL;function eP($){return typeof $==="function"}ee.isFunction=eP;function eF($){return $===null||typeof $==="boolean"||typeof $==="number"||typeof $==="string"||typeof $==="symbol"||typeof $==="undefined"}ee.isPrimitive=eF;ee.isBuffer=et(384);function eB($){return Object.prototype.toString.call($)}function eU($){return $<10?"0"+$.toString(10):$.toString(10)}var ej=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function eW(){var $=new Date;var ee=[eU($.getHours()),eU($.getMinutes()),eU($.getSeconds())].join(":");return[$.getDate(),ej[$.getMonth()],ee].join(" ")}ee.log=function(){console.log("%s - %s",eW(),ee.format.apply(ee,arguments))};ee.inherits=et(5717);ee._extend=function($,ee){if(!ee||!ek(ee))return $;var et=Object.keys(ee);var en=et.length;while(en--){$[et[en]]=ee[et[en]]}return $};function eH($,ee){return Object.prototype.hasOwnProperty.call($,ee)}var ez=typeof Symbol!=="undefined"?Symbol("util.promisify.custom"):undefined;ee.promisify=function $($){if(typeof $!=="function")throw new TypeError('The "original" argument must be of type Function');if(ez&&$[ez]){var ee=$[ez];if(typeof ee!=="function"){throw new TypeError('The "util.promisify.custom" argument must be of type Function')}Object.defineProperty(ee,ez,{value:ee,enumerable:false,writable:false,configurable:true});return ee}function ee(){var ee,et;var en=new Promise(function($,en){ee=$;et=en});var ei=[];for(var eo=0;eo<arguments.length;eo++){ei.push(arguments[eo])}ei.push(function($,en){if($){et($)}else{ee(en)}});try{$.apply(this,ei)}catch($){et($)}return en}Object.setPrototypeOf(ee,Object.getPrototypeOf($));if(ez)Object.defineProperty(ee,ez,{value:ee,enumerable:false,writable:false,configurable:true});return Object.defineProperties(ee,ei($))};ee.promisify.custom=ez;function eV($,ee){if(!$){var et=new Error("Promise was rejected with a falsy value");et.reason=$;$=et}return ee($)}function e$($){if(typeof $!=="function"){throw new TypeError('The "original" argument must be of type Function')}function ee(){var ee=[];for(var et=0;et<arguments.length;et++){ee.push(arguments[et])}var ei=ee.pop();if(typeof ei!=="function"){throw new TypeError("The last argument must be of type Function")}var eo=this;var es=function(){return ei.apply(eo,arguments)};$.apply(this,ee).then(function($){en.nextTick(es.bind(null,null,$))},function($){en.nextTick(eV.bind(null,$,es))})}Object.setPrototypeOf(ee,Object.getPrototypeOf($));Object.defineProperties(ee,ei($));return ee}ee.callbackify=e$},7429:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});Object.defineProperty(ee,"NIL",{enumerable:true,get:function $(){return eu.default}});Object.defineProperty(ee,"parse",{enumerable:true,get:function $(){return ep.default}});Object.defineProperty(ee,"stringify",{enumerable:true,get:function $(){return ed.default}});Object.defineProperty(ee,"v1",{enumerable:true,get:function $(){return en.default}});Object.defineProperty(ee,"v3",{enumerable:true,get:function $(){return ei.default}});Object.defineProperty(ee,"v4",{enumerable:true,get:function $(){return eo.default}});Object.defineProperty(ee,"v5",{enumerable:true,get:function $(){return es.default}});Object.defineProperty(ee,"validate",{enumerable:true,get:function $(){return ef.default}});Object.defineProperty(ee,"version",{enumerable:true,get:function $(){return el.default}});var en=eh(et(3990));var ei=eh(et(8237));var eo=eh(et(5355));var es=eh(et(3764));var eu=eh(et(6314));var el=eh(et(8464));var ef=eh(et(6435));var ed=eh(et(4008));var ep=eh(et(8222));function eh($){return $&&$.__esModule?$:{default:$}}},4163:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;function et($){if(typeof $==="string"){const ee=unescape(encodeURIComponent($));$=new Uint8Array(ee.length);for(let et=0;et<ee.length;++et){$[et]=ee.charCodeAt(et)}}return en(eo(es($),$.length*8))}function en($){const ee=[];const et=$.length*32;const en="0123456789abcdef";for(let ei=0;ei<et;ei+=8){const et=$[ei>>5]>>>ei%32&255;const eo=parseInt(en.charAt(et>>>4&15)+en.charAt(et&15),16);ee.push(eo)}return ee}function ei($){return($+64>>>9<<4)+14+1}function eo($,ee){$[ee>>5]|=128<<ee%32;$[ei(ee)-1]=ee;let et=1732584193;let en=-271733879;let eo=-1732584194;let es=271733878;for(let ee=0;ee<$.length;ee+=16){const ei=et;const el=en;const ef=eo;const eg=es;et=ed(et,en,eo,es,$[ee],7,-680876936);es=ed(es,et,en,eo,$[ee+1],12,-389564586);eo=ed(eo,es,et,en,$[ee+2],17,606105819);en=ed(en,eo,es,et,$[ee+3],22,-1044525330);et=ed(et,en,eo,es,$[ee+4],7,-176418897);es=ed(es,et,en,eo,$[ee+5],12,1200080426);eo=ed(eo,es,et,en,$[ee+6],17,-1473231341);en=ed(en,eo,es,et,$[ee+7],22,-45705983);et=ed(et,en,eo,es,$[ee+8],7,1770035416);es=ed(es,et,en,eo,$[ee+9],12,-1958414417);eo=ed(eo,es,et,en,$[ee+10],17,-42063);en=ed(en,eo,es,et,$[ee+11],22,-1990404162);et=ed(et,en,eo,es,$[ee+12],7,1804603682);es=ed(es,et,en,eo,$[ee+13],12,-40341101);eo=ed(eo,es,et,en,$[ee+14],17,-1502002290);en=ed(en,eo,es,et,$[ee+15],22,1236535329);et=ep(et,en,eo,es,$[ee+1],5,-165796510);es=ep(es,et,en,eo,$[ee+6],9,-1069501632);eo=ep(eo,es,et,en,$[ee+11],14,643717713);en=ep(en,eo,es,et,$[ee],20,-373897302);et=ep(et,en,eo,es,$[ee+5],5,-701558691);es=ep(es,et,en,eo,$[ee+10],9,38016083);eo=ep(eo,es,et,en,$[ee+15],14,-660478335);en=ep(en,eo,es,et,$[ee+4],20,-405537848);et=ep(et,en,eo,es,$[ee+9],5,568446438);es=ep(es,et,en,eo,$[ee+14],9,-1019803690);eo=ep(eo,es,et,en,$[ee+3],14,-187363961);en=ep(en,eo,es,et,$[ee+8],20,1163531501);et=ep(et,en,eo,es,$[ee+13],5,-1444681467);es=ep(es,et,en,eo,$[ee+2],9,-51403784);eo=ep(eo,es,et,en,$[ee+7],14,1735328473);en=ep(en,eo,es,et,$[ee+12],20,-1926607734);et=eh(et,en,eo,es,$[ee+5],4,-378558);es=eh(es,et,en,eo,$[ee+8],11,-2022574463);eo=eh(eo,es,et,en,$[ee+11],16,1839030562);en=eh(en,eo,es,et,$[ee+14],23,-35309556);et=eh(et,en,eo,es,$[ee+1],4,-1530992060);es=eh(es,et,en,eo,$[ee+4],11,1272893353);eo=eh(eo,es,et,en,$[ee+7],16,-155497632);en=eh(en,eo,es,et,$[ee+10],23,-1094730640);et=eh(et,en,eo,es,$[ee+13],4,681279174);es=eh(es,et,en,eo,$[ee],11,-358537222);eo=eh(eo,es,et,en,$[ee+3],16,-722521979);en=eh(en,eo,es,et,$[ee+6],23,76029189);et=eh(et,en,eo,es,$[ee+9],4,-640364487);es=eh(es,et,en,eo,$[ee+12],11,-421815835);eo=eh(eo,es,et,en,$[ee+15],16,530742520);en=eh(en,eo,es,et,$[ee+2],23,-995338651);et=ey(et,en,eo,es,$[ee],6,-198630844);es=ey(es,et,en,eo,$[ee+7],10,1126891415);eo=ey(eo,es,et,en,$[ee+14],15,-1416354905);en=ey(en,eo,es,et,$[ee+5],21,-57434055);et=ey(et,en,eo,es,$[ee+12],6,1700485571);es=ey(es,et,en,eo,$[ee+3],10,-1894986606);eo=ey(eo,es,et,en,$[ee+10],15,-1051523);en=ey(en,eo,es,et,$[ee+1],21,-2054922799);et=ey(et,en,eo,es,$[ee+8],6,1873313359);es=ey(es,et,en,eo,$[ee+15],10,-30611744);eo=ey(eo,es,et,en,$[ee+6],15,-1560198380);en=ey(en,eo,es,et,$[ee+13],21,1309151649);et=ey(et,en,eo,es,$[ee+4],6,-145523070);es=ey(es,et,en,eo,$[ee+11],10,-1120210379);eo=ey(eo,es,et,en,$[ee+2],15,718787259);en=ey(en,eo,es,et,$[ee+9],21,-343485551);et=eu(et,ei);en=eu(en,el);eo=eu(eo,ef);es=eu(es,eg)}return[et,en,eo,es]}function es($){if($.length===0){return[]}const ee=$.length*8;const et=new Uint32Array(ei(ee));for(let en=0;en<ee;en+=8){et[en>>5]|=($[en/8]&255)<<en%32}return et}function eu($,ee){const et=($&65535)+(ee&65535);const en=($>>16)+(ee>>16)+(et>>16);return en<<16|et&65535}function el($,ee){return $<<ee|$>>>32-ee}function ef($,ee,et,en,ei,eo){return eu(el(eu(eu(ee,$),eu(en,eo)),ei),et)}function ed($,ee,et,en,ei,eo,es){return ef(ee&et|~ee&en,$,ee,ei,eo,es)}function ep($,ee,et,en,ei,eo,es){return ef(ee&en|et&~en,$,ee,ei,eo,es)}function eh($,ee,et,en,ei,eo,es){return ef(ee^et^en,$,ee,ei,eo,es)}function ey($,ee,et,en,ei,eo,es){return ef(et^(ee|~en),$,ee,ei,eo,es)}var eg=et;ee["default"]=eg},4790:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;const et=typeof crypto!=="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var en={randomUUID:et};ee["default"]=en},6314:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var et="00000000-0000-0000-0000-000000000000";ee["default"]=et},8222:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var en=ei(et(6435));function ei($){return $&&$.__esModule?$:{default:$}}function eo($){if(!(0,en.default)($)){throw TypeError("Invalid UUID")}let ee;const et=new Uint8Array(16);et[0]=(ee=parseInt($.slice(0,8),16))>>>24;et[1]=ee>>>16&255;et[2]=ee>>>8&255;et[3]=ee&255;et[4]=(ee=parseInt($.slice(9,13),16))>>>8;et[5]=ee&255;et[6]=(ee=parseInt($.slice(14,18),16))>>>8;et[7]=ee&255;et[8]=(ee=parseInt($.slice(19,23),16))>>>8;et[9]=ee&255;et[10]=(ee=parseInt($.slice(24,36),16))/1099511627776&255;et[11]=ee/4294967296&255;et[12]=ee>>>24&255;et[13]=ee>>>16&255;et[14]=ee>>>8&255;et[15]=ee&255;return et}var es=eo;ee["default"]=es},58:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var et=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;ee["default"]=et},3319:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=ei;let et;const en=new Uint8Array(16);function ei(){if(!et){et=typeof crypto!=="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto);if(!et){throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}}return et(en)}},3757:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;function et($,ee,et,en){switch($){case 0:return ee&et^~ee&en;case 1:return ee^et^en;case 2:return ee&et^ee&en^et&en;case 3:return ee^et^en}}function en($,ee){return $<<ee|$>>>32-ee}function ei($){const ee=[1518500249,1859775393,2400959708,3395469782];const ei=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof $==="string"){const ee=unescape(encodeURIComponent($));$=[];for(let et=0;et<ee.length;++et){$.push(ee.charCodeAt(et))}}else if(!Array.isArray($)){$=Array.prototype.slice.call($)}$.push(128);const eo=$.length/4+2;const es=Math.ceil(eo/16);const eu=new Array(es);for(let ee=0;ee<es;++ee){const et=new Uint32Array(16);for(let en=0;en<16;++en){et[en]=$[ee*64+en*4]<<24|$[ee*64+en*4+1]<<16|$[ee*64+en*4+2]<<8|$[ee*64+en*4+3]}eu[ee]=et}eu[es-1][14]=($.length-1)*8/Math.pow(2,32);eu[es-1][14]=Math.floor(eu[es-1][14]);eu[es-1][15]=($.length-1)*8&4294967295;for(let $=0;$<es;++$){const eo=new Uint32Array(80);for(let ee=0;ee<16;++ee){eo[ee]=eu[$][ee]}for(let $=16;$<80;++$){eo[$]=en(eo[$-3]^eo[$-8]^eo[$-14]^eo[$-16],1)}let es=ei[0];let el=ei[1];let ef=ei[2];let ed=ei[3];let ep=ei[4];for(let $=0;$<80;++$){const ei=Math.floor($/20);const eu=en(es,5)+et(ei,el,ef,ed)+ep+ee[ei]+eo[$]>>>0;ep=ed;ed=ef;ef=en(el,30)>>>0;el=es;es=eu}ei[0]=ei[0]+es>>>0;ei[1]=ei[1]+el>>>0;ei[2]=ei[2]+ef>>>0;ei[3]=ei[3]+ed>>>0;ei[4]=ei[4]+ep>>>0}return[ei[0]>>24&255,ei[0]>>16&255,ei[0]>>8&255,ei[0]&255,ei[1]>>24&255,ei[1]>>16&255,ei[1]>>8&255,ei[1]&255,ei[2]>>24&255,ei[2]>>16&255,ei[2]>>8&255,ei[2]&255,ei[3]>>24&255,ei[3]>>16&255,ei[3]>>8&255,ei[3]&255,ei[4]>>24&255,ei[4]>>16&255,ei[4]>>8&255,ei[4]&255]}var eo=ei;ee["default"]=eo},4008:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;ee.unsafeStringify=es;var en=ei(et(6435));function ei($){return $&&$.__esModule?$:{default:$}}const eo=[];for(let $=0;$<256;++$){eo.push(($+256).toString(16).slice(1))}function es($,ee=0){return(eo[$[ee+0]]+eo[$[ee+1]]+eo[$[ee+2]]+eo[$[ee+3]]+"-"+eo[$[ee+4]]+eo[$[ee+5]]+"-"+eo[$[ee+6]]+eo[$[ee+7]]+"-"+eo[$[ee+8]]+eo[$[ee+9]]+"-"+eo[$[ee+10]]+eo[$[ee+11]]+eo[$[ee+12]]+eo[$[ee+13]]+eo[$[ee+14]]+eo[$[ee+15]]).toLowerCase()}function eu($,ee=0){const et=es($,ee);if(!(0,en.default)(et)){throw TypeError("Stringified UUID is invalid")}return et}var el=eu;ee["default"]=el},3990:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var en=eo(et(3319));var ei=et(4008);function eo($){return $&&$.__esModule?$:{default:$}}let es;let eu;let el=0;let ef=0;function ed($,ee,et){let eo=ee&&et||0;const ed=ee||new Array(16);$=$||{};let ep=$.node||es;let eh=$.clockseq!==undefined?$.clockseq:eu;if(ep==null||eh==null){const ee=$.random||($.rng||en.default)();if(ep==null){ep=es=[ee[0]|1,ee[1],ee[2],ee[3],ee[4],ee[5]]}if(eh==null){eh=eu=(ee[6]<<8|ee[7])&16383}}let ey=$.msecs!==undefined?$.msecs:Date.now();let eg=$.nsecs!==undefined?$.nsecs:ef+1;const em=ey-el+(eg-ef)/1e4;if(em<0&&$.clockseq===undefined){eh=eh+1&16383}if((em<0||ey>el)&&$.nsecs===undefined){eg=0}if(eg>=1e4){throw new Error("uuid.v1(): Can't create more than 10M uuids/sec")}el=ey;ef=eg;eu=eh;ey+=122192928e5;const e_=((ey&268435455)*1e4+eg)%4294967296;ed[eo++]=e_>>>24&255;ed[eo++]=e_>>>16&255;ed[eo++]=e_>>>8&255;ed[eo++]=e_&255;const ew=ey/4294967296*1e4&268435455;ed[eo++]=ew>>>8&255;ed[eo++]=ew&255;ed[eo++]=ew>>>24&15|16;ed[eo++]=ew>>>16&255;ed[eo++]=eh>>>8|128;ed[eo++]=eh&255;for(let $=0;$<6;++$){ed[eo+$]=ep[$]}return ee||(0,ei.unsafeStringify)(ed)}var ep=ed;ee["default"]=ep},8237:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var en=eo(et(7925));var ei=eo(et(4163));function eo($){return $&&$.__esModule?$:{default:$}}const es=(0,en.default)("v3",48,ei.default);var eu=es;ee["default"]=eu},7925:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee.URL=ee.DNS=void 0;ee["default"]=ef;var en=et(4008);var ei=eo(et(8222));function eo($){return $&&$.__esModule?$:{default:$}}function es($){$=unescape(encodeURIComponent($));const ee=[];for(let et=0;et<$.length;++et){ee.push($.charCodeAt(et))}return ee}const eu="6ba7b810-9dad-11d1-80b4-00c04fd430c8";ee.DNS=eu;const el="6ba7b811-9dad-11d1-80b4-00c04fd430c8";ee.URL=el;function ef($,ee,et){function eo($,eo,eu,el){var ef;if(typeof $==="string"){$=es($)}if(typeof eo==="string"){eo=(0,ei.default)(eo)}if(((ef=eo)===null||ef===void 0?void 0:ef.length)!==16){throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)")}let ed=new Uint8Array(16+$.length);ed.set(eo);ed.set($,eo.length);ed=et(ed);ed[6]=ed[6]&15|ee;ed[8]=ed[8]&63|128;if(eu){el=el||0;for(let $=0;$<16;++$){eu[el+$]=ed[$]}return eu}return(0,en.unsafeStringify)(ed)}try{eo.name=$}catch($){}eo.DNS=eu;eo.URL=el;return eo}},5355:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var en=es(et(4790));var ei=es(et(3319));var eo=et(4008);function es($){return $&&$.__esModule?$:{default:$}}function eu($,ee,et){if(en.default.randomUUID&&!ee&&!$){return en.default.randomUUID()}$=$||{};const es=$.random||($.rng||ei.default)();es[6]=es[6]&15|64;es[8]=es[8]&63|128;if(ee){et=et||0;for(let $=0;$<16;++$){ee[et+$]=es[$]}return ee}return(0,eo.unsafeStringify)(es)}var el=eu;ee["default"]=el},3764:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var en=eo(et(7925));var ei=eo(et(3757));function eo($){return $&&$.__esModule?$:{default:$}}const es=(0,en.default)("v5",80,ei.default);var eu=es;ee["default"]=eu},6435:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var en=ei(et(58));function ei($){return $&&$.__esModule?$:{default:$}}function eo($){return typeof $==="string"&&en.default.test($)}var es=eo;ee["default"]=es},8464:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var en=ei(et(6435));function ei($){return $&&$.__esModule?$:{default:$}}function eo($){if(!(0,en.default)($)){throw TypeError("Invalid UUID")}return parseInt($.slice(14,15),16)}var es=eo;ee["default"]=es},3679:($,ee,et)=>{"use strict";var en=et(9981);var ei=et(4578);var eo=et(6814);var es=et(2636);var eu=et(3376);$.exports=function $($){if($==null||typeof $!=="object"&&typeof $!=="function"){return null}if(en($)){return"String"}if(ei($)){return"Number"}if(eo($)){return"Boolean"}if(es($)){return"Symbol"}if(eu($)){return"BigInt"}}},6430:($,ee,et)=>{"use strict";var en=et(4029);var ei=et(3083);var eo=et(5559);var es=et(1924);var eu=et(7296);var el=es("Object.prototype.toString");var ef=et(6410)();var ed=typeof globalThis==="undefined"?et.g:globalThis;var ep=ei();var eh=es("String.prototype.slice");var ey=Object.getPrototypeOf;var eg=es("Array.prototype.indexOf",true)||function $($,ee){for(var et=0;et<$.length;et+=1){if($[et]===ee){return et}}return-1};var em={__proto__:null};if(ef&&eu&&ey){en(ep,function($){var ee=new ed[$];if(Symbol.toStringTag in ee){var et=ey(ee);var en=eu(et,Symbol.toStringTag);if(!en){var ei=ey(et);en=eu(ei,Symbol.toStringTag)}em["$"+$]=eo(en.get)}})}else{en(ep,function($){var ee=new ed[$];em["$"+$]=eo(ee.slice)})}var e_=function $($){var ee=false;en(em,function(et,en){if(!ee){try{if("$"+et($)===en){ee=eh(en,1)}}catch($){}}});return ee};var ew=function $($){var ee=false;en(em,function(et,en){if(!ee){try{et($);ee=eh(en,1)}catch($){}}});return ee};$.exports=function $($){if(!$||typeof $!=="object"){return false}if(!ef){var ee=eh(el($),8,-1);if(eg(ep,ee)>-1){return ee}if(ee!=="Object"){return false}return ew($)}if(!eu){return null}return e_($)}},306:function($,ee){(function(){"use strict";ee.stripBOM=function($){if($[0]==="\uFEFF"){return $.substring(1)}else{return $}}}).call(this)},4096:function($,ee,et){(function(){"use strict";var $,en,ei,eo,es,eu={}.hasOwnProperty;$=et(9374);en=et(8381).defaults;eo=function($){return typeof $==="string"&&($.indexOf("&")>=0||$.indexOf(">")>=0||$.indexOf("<")>=0)};es=function($){return"<![CDATA["+ei($)+"]]>"};ei=function($){return $.replace("]]>","]]]]><![CDATA[>")};ee.Builder=function(){function ee($){var ee,et,ei;this.options={};et=en["0.2"];for(ee in et){if(!eu.call(et,ee))continue;ei=et[ee];this.options[ee]=ei}for(ee in $){if(!eu.call($,ee))continue;ei=$[ee];this.options[ee]=ei}}ee.prototype.buildObject=function(ee){var et,ei,el,ef,ed;et=this.options.attrkey;ei=this.options.charkey;if(Object.keys(ee).length===1&&this.options.rootName===en["0.2"].rootName){ed=Object.keys(ee)[0];ee=ee[ed]}else{ed=this.options.rootName}el=function($){return function(ee,en){var ef,ed,ep,eh,ey,eg;if(typeof en!=="object"){if($.options.cdata&&eo(en)){ee.raw(es(en))}else{ee.txt(en)}}else if(Array.isArray(en)){for(eh in en){if(!eu.call(en,eh))continue;ed=en[eh];for(ey in ed){ep=ed[ey];ee=el(ee.ele(ey),ep).up()}}}else{for(ey in en){if(!eu.call(en,ey))continue;ed=en[ey];if(ey===et){if(typeof ed==="object"){for(ef in ed){eg=ed[ef];ee=ee.att(ef,eg)}}}else if(ey===ei){if($.options.cdata&&eo(ed)){ee=ee.raw(es(ed))}else{ee=ee.txt(ed)}}else if(Array.isArray(ed)){for(eh in ed){if(!eu.call(ed,eh))continue;ep=ed[eh];if(typeof ep==="string"){if($.options.cdata&&eo(ep)){ee=ee.ele(ey).raw(es(ep)).up()}else{ee=ee.ele(ey,ep).up()}}else{ee=el(ee.ele(ey),ep).up()}}}else if(typeof ed==="object"){ee=el(ee.ele(ey),ed).up()}else{if(typeof ed==="string"&&$.options.cdata&&eo(ed)){ee=ee.ele(ey).raw(es(ed)).up()}else{if(ed==null){ed=""}ee=ee.ele(ey,ed.toString()).up()}}}}return ee}}(this);ef=$.create(ed,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars});return el(ef,ee).end(this.options.renderOpts)};return ee}()}).call(this)},8381:function($,ee){(function(){ee.defaults={"0.1":{explicitCharkey:false,trim:true,normalize:true,normalizeTags:false,attrkey:"@",charkey:"#",explicitArray:false,ignoreAttrs:false,mergeAttrs:false,explicitRoot:false,validator:null,xmlns:false,explicitChildren:false,childkey:"@@",charsAsChildren:false,includeWhiteChars:false,async:false,strict:true,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},"0.2":{explicitCharkey:false,trim:false,normalize:false,normalizeTags:false,attrkey:"$",charkey:"_",explicitArray:true,ignoreAttrs:false,mergeAttrs:false,explicitRoot:true,validator:null,xmlns:false,explicitChildren:false,preserveChildrenOrder:false,childkey:"$$",charsAsChildren:false,includeWhiteChars:false,async:false,strict:true,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{"version":"1.0","encoding":"UTF-8","standalone":true},doctype:null,renderOpts:{"pretty":true,"indent":" ","newline":"\n"},headless:false,chunkSize:1e4,emptyTag:"",cdata:false}}}).call(this)},9082:function($,ee,et){(function(){"use strict";var $,en,ei,eo,es,eu,el,ef,ed,ep=function($,ee){return function(){return $.apply(ee,arguments)}},eh=function($,ee){for(var et in ee){if(ey.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},ey={}.hasOwnProperty;ef=et(6099);eo=et(7187);$=et(306);el=et(7526);ed=et(8441).setImmediate;en=et(8381).defaults;es=function($){return typeof $==="object"&&$!=null&&Object.keys($).length===0};eu=function($,ee,et){var en,ei,eo;for(en=0,ei=$.length;en<ei;en++){eo=$[en];ee=eo(ee,et)}return ee};ei=function($,ee,et){var en;en=Object.create(null);en.value=et;en.writable=true;en.enumerable=true;en.configurable=true;return Object.defineProperty($,ee,en)};ee.Parser=function(et){eh(eo,et);function eo($){this.parseStringPromise=ep(this.parseStringPromise,this);this.parseString=ep(this.parseString,this);this.reset=ep(this.reset,this);this.assignOrPush=ep(this.assignOrPush,this);this.processAsync=ep(this.processAsync,this);var et,ei,eo;if(!(this instanceof ee.Parser)){return new ee.Parser($)}this.options={};ei=en["0.2"];for(et in ei){if(!ey.call(ei,et))continue;eo=ei[et];this.options[et]=eo}for(et in $){if(!ey.call($,et))continue;eo=$[et];this.options[et]=eo}if(this.options.xmlns){this.options.xmlnskey=this.options.attrkey+"ns"}if(this.options.normalizeTags){if(!this.options.tagNameProcessors){this.options.tagNameProcessors=[]}this.options.tagNameProcessors.unshift(el.normalize)}this.reset()}eo.prototype.processAsync=function(){var $,ee;try{if(this.remaining.length<=this.options.chunkSize){$=this.remaining;this.remaining="";this.saxParser=this.saxParser.write($);return this.saxParser.close()}else{$=this.remaining.substr(0,this.options.chunkSize);this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length);this.saxParser=this.saxParser.write($);return ed(this.processAsync)}}catch($){ee=$;if(!this.saxParser.errThrown){this.saxParser.errThrown=true;return this.emit(ee)}}};eo.prototype.assignOrPush=function($,ee,et){if(!(ee in $)){if(!this.options.explicitArray){return ei($,ee,et)}else{return ei($,ee,[et])}}else{if(!($[ee]instanceof Array)){ei($,ee,[$[ee]])}return $[ee].push(et)}};eo.prototype.reset=function(){var $,ee,et,en;this.removeAllListeners();this.saxParser=ef.parser(this.options.strict,{trim:false,normalize:false,xmlns:this.options.xmlns});this.saxParser.errThrown=false;this.saxParser.onerror=function($){return function(ee){$.saxParser.resume();if(!$.saxParser.errThrown){$.saxParser.errThrown=true;return $.emit("error",ee)}}}(this);this.saxParser.onend=function($){return function(){if(!$.saxParser.ended){$.saxParser.ended=true;return $.emit("end",$.resultObject)}}}(this);this.saxParser.ended=false;this.EXPLICIT_CHARKEY=this.options.explicitCharkey;this.resultObject=null;en=[];$=this.options.attrkey;ee=this.options.charkey;this.saxParser.onopentag=function(et){return function(eo){var es,el,ef,ed,ep;ef={};ef[ee]="";if(!et.options.ignoreAttrs){ep=eo.attributes;for(es in ep){if(!ey.call(ep,es))continue;if(!($ in ef)&&!et.options.mergeAttrs){ef[$]={}}el=et.options.attrValueProcessors?eu(et.options.attrValueProcessors,eo.attributes[es],es):eo.attributes[es];ed=et.options.attrNameProcessors?eu(et.options.attrNameProcessors,es):es;if(et.options.mergeAttrs){et.assignOrPush(ef,ed,el)}else{ei(ef[$],ed,el)}}}ef["#name"]=et.options.tagNameProcessors?eu(et.options.tagNameProcessors,eo.name):eo.name;if(et.options.xmlns){ef[et.options.xmlnskey]={uri:eo.uri,local:eo.local}}return en.push(ef)}}(this);this.saxParser.onclosetag=function($){return function(){var et,eo,el,ef,ed,ep,eh,eg,em,e_;ep=en.pop();ed=ep["#name"];if(!$.options.explicitChildren||!$.options.preserveChildrenOrder){delete ep["#name"]}if(ep.cdata===true){et=ep.cdata;delete ep.cdata}em=en[en.length-1];if(ep[ee].match(/^\s*$/)&&!et){eo=ep[ee];delete ep[ee]}else{if($.options.trim){ep[ee]=ep[ee].trim()}if($.options.normalize){ep[ee]=ep[ee].replace(/\s{2,}/g," ").trim()}ep[ee]=$.options.valueProcessors?eu($.options.valueProcessors,ep[ee],ed):ep[ee];if(Object.keys(ep).length===1&&ee in ep&&!$.EXPLICIT_CHARKEY){ep=ep[ee]}}if(es(ep)){if(typeof $.options.emptyTag==="function"){ep=$.options.emptyTag()}else{ep=$.options.emptyTag!==""?$.options.emptyTag:eo}}if($.options.validator!=null){e_="/"+(function(){var $,ee,et;et=[];for($=0,ee=en.length;$<ee;$++){ef=en[$];et.push(ef["#name"])}return et})().concat(ed).join("/");(function(){var ee;try{return ep=$.options.validator(e_,em&&em[ed],ep)}catch(et){ee=et;return $.emit("error",ee)}})()}if($.options.explicitChildren&&!$.options.mergeAttrs&&typeof ep==="object"){if(!$.options.preserveChildrenOrder){ef={};if($.options.attrkey in ep){ef[$.options.attrkey]=ep[$.options.attrkey];delete ep[$.options.attrkey]}if(!$.options.charsAsChildren&&$.options.charkey in ep){ef[$.options.charkey]=ep[$.options.charkey];delete ep[$.options.charkey]}if(Object.getOwnPropertyNames(ep).length>0){ef[$.options.childkey]=ep}ep=ef}else if(em){em[$.options.childkey]=em[$.options.childkey]||[];eh={};for(el in ep){if(!ey.call(ep,el))continue;ei(eh,el,ep[el])}em[$.options.childkey].push(eh);delete ep["#name"];if(Object.keys(ep).length===1&&ee in ep&&!$.EXPLICIT_CHARKEY){ep=ep[ee]}}}if(en.length>0){return $.assignOrPush(em,ed,ep)}else{if($.options.explicitRoot){eg=ep;ep={};ei(ep,ed,eg)}$.resultObject=ep;$.saxParser.ended=true;return $.emit("end",$.resultObject)}}}(this);et=function($){return function(et){var ei,eo;eo=en[en.length-1];if(eo){eo[ee]+=et;if($.options.explicitChildren&&$.options.preserveChildrenOrder&&$.options.charsAsChildren&&($.options.includeWhiteChars||et.replace(/\\n/g,"").trim()!=="")){eo[$.options.childkey]=eo[$.options.childkey]||[];ei={"#name":"__text__"};ei[ee]=et;if($.options.normalize){ei[ee]=ei[ee].replace(/\s{2,}/g," ").trim()}eo[$.options.childkey].push(ei)}return eo}}}(this);this.saxParser.ontext=et;return this.saxParser.oncdata=function($){return function($){var ee;ee=et($);if(ee){return ee.cdata=true}}}(this)};eo.prototype.parseString=function(ee,et){var en;if(et!=null&&typeof et==="function"){this.on("end",function($){this.reset();return et(null,$)});this.on("error",function($){this.reset();return et($)})}try{ee=ee.toString();if(ee.trim()===""){this.emit("end",null);return true}ee=$.stripBOM(ee);if(this.options.async){this.remaining=ee;ed(this.processAsync);return this.saxParser}return this.saxParser.write(ee).close()}catch($){en=$;if(!(this.saxParser.errThrown||this.saxParser.ended)){this.emit("error",en);return this.saxParser.errThrown=true}else if(this.saxParser.ended){throw en}}};eo.prototype.parseStringPromise=function($){return new Promise(function(ee){return function(et,en){return ee.parseString($,function($,ee){if($){return en($)}else{return et(ee)}})}}(this))};return eo}(eo);ee.parseString=function($,et,en){var ei,eo,es;if(en!=null){if(typeof en==="function"){ei=en}if(typeof et==="object"){eo=et}}else{if(typeof et==="function"){ei=et}eo={}}es=new ee.Parser(eo);return es.parseString($,ei)};ee.parseStringPromise=function($,et){var en,ei;if(typeof et==="object"){en=et}ei=new ee.Parser(en);return ei.parseStringPromise($)}}).call(this)},7526:function($,ee){(function(){"use strict";var $;$=new RegExp(/(?!xmlns)^.*:/);ee.normalize=function($){return $.toLowerCase()};ee.firstCharLowerCase=function($){return $.charAt(0).toLowerCase()+$.slice(1)};ee.stripPrefix=function(ee){return ee.replace($,"")};ee.parseNumbers=function($){if(!isNaN($)){$=$%1===0?parseInt($,10):parseFloat($)}return $};ee.parseBooleans=function($){if(/^(?:true|false)$/i.test($)){$=$.toLowerCase()==="true"}return $}}).call(this)},5055:function($,ee,et){(function(){"use strict";var $,en,ei,eo,es=function($,ee){for(var et in ee){if(eu.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},eu={}.hasOwnProperty;en=et(8381);$=et(4096);ei=et(9082);eo=et(7526);ee.defaults=en.defaults;ee.processors=eo;ee.ValidationError=function($){es(ee,$);function ee($){this.message=$}return ee}(Error);ee.Builder=$.Builder;ee.Parser=ei.Parser;ee.parseString=ei.parseString;ee.parseStringPromise=ei.parseStringPromise}).call(this)},8154:function($){(function(){$.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(this)},8745:function($){(function(){$.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}).call(this)},8676:function($){(function(){var ee,et,en,ei,eo,es,eu,el=[].slice,ef={}.hasOwnProperty;ee=function(){var $,ee,et,en,ei,es;es=arguments[0],ei=2<=arguments.length?el.call(arguments,1):[];if(eo(Object.assign)){Object.assign.apply(null,arguments)}else{for($=0,et=ei.length;$<et;$++){en=ei[$];if(en!=null){for(ee in en){if(!ef.call(en,ee))continue;es[ee]=en[ee]}}}}return es};eo=function($){return!!$&&Object.prototype.toString.call($)==="[object Function]"};es=function($){var ee;return!!$&&((ee=typeof $)==="function"||ee==="object")};en=function($){if(eo(Array.isArray)){return Array.isArray($)}else{return Object.prototype.toString.call($)==="[object Array]"}};ei=function($){var ee;if(en($)){return!$.length}else{for(ee in $){if(!ef.call($,ee))continue;return false}return true}};eu=function($){var ee,et;return es($)&&(et=Object.getPrototypeOf($))&&(ee=et.constructor)&&typeof ee==="function"&&ee instanceof ee&&Function.prototype.toString.call(ee)===Function.prototype.toString.call(Object)};et=function($){if(eo($.valueOf)){return $.valueOf()}else{return $}};$.exports.assign=ee;$.exports.isFunction=eo;$.exports.isObject=es;$.exports.isArray=en;$.exports.isEmpty=ei;$.exports.isPlainObject=eu;$.exports.getValue=et}).call(this)},6530:function($){(function(){$.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(this)},7490:function($,ee,et){(function(){var ee,en,ei;ee=et(8745);ei=et(630);$.exports=en=function(){function $($,et,en){this.parent=$;if(this.parent){this.options=this.parent.options;this.stringify=this.parent.stringify}if(et==null){throw new Error("Missing attribute name. "+this.debugInfo(et))}this.name=this.stringify.name(et);this.value=this.stringify.attValue(en);this.type=ee.Attribute;this.isId=false;this.schemaTypeInfo=null}Object.defineProperty($.prototype,"nodeType",{get:function(){return this.type}});Object.defineProperty($.prototype,"ownerElement",{get:function(){return this.parent}});Object.defineProperty($.prototype,"textContent",{get:function(){return this.value},set:function($){return this.value=$||""}});Object.defineProperty($.prototype,"namespaceURI",{get:function(){return""}});Object.defineProperty($.prototype,"prefix",{get:function(){return""}});Object.defineProperty($.prototype,"localName",{get:function(){return this.name}});Object.defineProperty($.prototype,"specified",{get:function(){return true}});$.prototype.clone=function(){return Object.create(this)};$.prototype.toString=function($){return this.options.writer.attribute(this,this.options.writer.filterOptions($))};$.prototype.debugInfo=function($){$=$||this.name;if($==null){return"parent: <"+this.parent.name+">"}else{return"attribute: {"+$+"}, parent: <"+this.parent.name+">"}};$.prototype.isEqualNode=function($){if($.namespaceURI!==this.namespaceURI){return false}if($.prefix!==this.prefix){return false}if($.localName!==this.localName){return false}if($.value!==this.value){return false}return true};return $}()}).call(this)},9877:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ee=et(8745);ei=et(4356);$.exports=en=function($){eo(et,$);function et($,en){et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing CDATA text. "+this.debugInfo())}this.name="#cdata-section";this.type=ee.CData;this.value=this.stringify.cdata(en)}et.prototype.clone=function(){return Object.create(this)};et.prototype.toString=function($){return this.options.writer.cdata(this,this.options.writer.filterOptions($))};return et}(ei)}).call(this)},4356:function($,ee,et){(function(){var ee,en,ei=function($,ee){for(var et in ee){if(eo.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},eo={}.hasOwnProperty;en=et(630);$.exports=ee=function($){ei(ee,$);function ee($){ee.__super__.constructor.call(this,$);this.value=""}Object.defineProperty(ee.prototype,"data",{get:function(){return this.value},set:function($){return this.value=$||""}});Object.defineProperty(ee.prototype,"length",{get:function(){return this.value.length}});Object.defineProperty(ee.prototype,"textContent",{get:function(){return this.value},set:function($){return this.value=$||""}});ee.prototype.clone=function(){return Object.create(this)};ee.prototype.substringData=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};ee.prototype.appendData=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};ee.prototype.insertData=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};ee.prototype.deleteData=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};ee.prototype.replaceData=function($,ee,et){throw new Error("This DOM method is not implemented."+this.debugInfo())};ee.prototype.isEqualNode=function($){if(!ee.__super__.isEqualNode.apply(this,arguments).isEqualNode($)){return false}if($.data!==this.data){return false}return true};return ee}(en)}).call(this)},2374:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ee=et(8745);en=et(4356);$.exports=ei=function($){eo(et,$);function et($,en){et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing comment text. "+this.debugInfo())}this.name="#comment";this.type=ee.Comment;this.value=this.stringify.comment(en)}et.prototype.clone=function(){return Object.create(this)};et.prototype.toString=function($){return this.options.writer.comment(this,this.options.writer.filterOptions($))};return et}(en)}).call(this)},1829:function($,ee,et){(function(){var ee,en,ei;en=et(7885);ei=et(4929);$.exports=ee=function(){function $(){var $;this.defaultParams={"canonical-form":false,"cdata-sections":false,"comments":false,"datatype-normalization":false,"element-content-whitespace":true,"entities":true,"error-handler":new en,"infoset":true,"validate-if-schema":false,"namespaces":true,"namespace-declarations":true,"normalize-characters":false,"schema-location":"","schema-type":"","split-cdata-sections":true,"validate":false,"well-formed":true};this.params=$=Object.create(this.defaultParams)}Object.defineProperty($.prototype,"parameterNames",{get:function(){return new ei(Object.keys(this.defaultParams))}});$.prototype.getParameter=function($){if(this.params.hasOwnProperty($)){return this.params[$]}else{return null}};$.prototype.canSetParameter=function($,ee){return true};$.prototype.setParameter=function($,ee){if(ee!=null){return this.params[$]=ee}else{return delete this.params[$]}};return $}()}).call(this)},7885:function($){(function(){var ee;$.exports=ee=function(){function $(){}$.prototype.handleError=function($){throw new Error($)};return $}()}).call(this)},4016:function($){(function(){var ee;$.exports=ee=function(){function $(){}$.prototype.hasFeature=function($,ee){return true};$.prototype.createDocumentType=function($,ee,et){throw new Error("This DOM method is not implemented.")};$.prototype.createDocument=function($,ee,et){throw new Error("This DOM method is not implemented.")};$.prototype.createHTMLDocument=function($){throw new Error("This DOM method is not implemented.")};$.prototype.getFeature=function($,ee){throw new Error("This DOM method is not implemented.")};return $}()}).call(this)},4929:function($){(function(){var ee;$.exports=ee=function(){function $($){this.arr=$||[]}Object.defineProperty($.prototype,"length",{get:function(){return this.arr.length}});$.prototype.item=function($){return this.arr[$]||null};$.prototype.contains=function($){return this.arr.indexOf($)!==-1};return $}()}).call(this)},4131:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ei=et(630);ee=et(8745);$.exports=en=function($){eo(et,$);function et($,en,ei,eo,es,eu){et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing DTD element name. "+this.debugInfo())}if(ei==null){throw new Error("Missing DTD attribute name. "+this.debugInfo(en))}if(!eo){throw new Error("Missing DTD attribute type. "+this.debugInfo(en))}if(!es){throw new Error("Missing DTD attribute default. "+this.debugInfo(en))}if(es.indexOf("#")!==0){es="#"+es}if(!es.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)){throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(en))}if(eu&&!es.match(/^(#FIXED|#DEFAULT)$/)){throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(en))}this.elementName=this.stringify.name(en);this.type=ee.AttributeDeclaration;this.attributeName=this.stringify.name(ei);this.attributeType=this.stringify.dtdAttType(eo);if(eu){this.defaultValue=this.stringify.dtdAttDefault(eu)}this.defaultValueType=es}et.prototype.toString=function($){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions($))};return et}(ei)}).call(this)},7338:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ei=et(630);ee=et(8745);$.exports=en=function($){eo(et,$);function et($,en,ei){et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing DTD element name. "+this.debugInfo())}if(!ei){ei="(#PCDATA)"}if(Array.isArray(ei)){ei="("+ei.join(",")+")"}this.name=this.stringify.name(en);this.type=ee.ElementDeclaration;this.value=this.stringify.dtdElementValue(ei)}et.prototype.toString=function($){return this.options.writer.dtdElement(this,this.options.writer.filterOptions($))};return et}(ei)}).call(this)},7834:function($,ee,et){(function(){var ee,en,ei,eo,es=function($,ee){for(var et in ee){if(eu.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},eu={}.hasOwnProperty;eo=et(8676).isObject;ei=et(630);ee=et(8745);$.exports=en=function($){es(et,$);function et($,en,ei,es){et.__super__.constructor.call(this,$);if(ei==null){throw new Error("Missing DTD entity name. "+this.debugInfo(ei))}if(es==null){throw new Error("Missing DTD entity value. "+this.debugInfo(ei))}this.pe=!!en;this.name=this.stringify.name(ei);this.type=ee.EntityDeclaration;if(!eo(es)){this.value=this.stringify.dtdEntityValue(es);this.internal=true}else{if(!es.pubID&&!es.sysID){throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(ei))}if(es.pubID&&!es.sysID){throw new Error("System identifier is required for a public external entity. "+this.debugInfo(ei))}this.internal=false;if(es.pubID!=null){this.pubID=this.stringify.dtdPubID(es.pubID)}if(es.sysID!=null){this.sysID=this.stringify.dtdSysID(es.sysID)}if(es.nData!=null){this.nData=this.stringify.dtdNData(es.nData)}if(this.pe&&this.nData){throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(ei))}}}Object.defineProperty(et.prototype,"publicId",{get:function(){return this.pubID}});Object.defineProperty(et.prototype,"systemId",{get:function(){return this.sysID}});Object.defineProperty(et.prototype,"notationName",{get:function(){return this.nData||null}});Object.defineProperty(et.prototype,"inputEncoding",{get:function(){return null}});Object.defineProperty(et.prototype,"xmlEncoding",{get:function(){return null}});Object.defineProperty(et.prototype,"xmlVersion",{get:function(){return null}});et.prototype.toString=function($){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions($))};return et}(ei)}).call(this)},8507:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ei=et(630);ee=et(8745);$.exports=en=function($){eo(et,$);function et($,en,ei){et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing DTD notation name. "+this.debugInfo(en))}if(!ei.pubID&&!ei.sysID){throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(en))}this.name=this.stringify.name(en);this.type=ee.NotationDeclaration;if(ei.pubID!=null){this.pubID=this.stringify.dtdPubID(ei.pubID)}if(ei.sysID!=null){this.sysID=this.stringify.dtdSysID(ei.sysID)}}Object.defineProperty(et.prototype,"publicId",{get:function(){return this.pubID}});Object.defineProperty(et.prototype,"systemId",{get:function(){return this.sysID}});et.prototype.toString=function($){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions($))};return et}(ei)}).call(this)},2308:function($,ee,et){(function(){var ee,en,ei,eo,es=function($,ee){for(var et in ee){if(eu.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},eu={}.hasOwnProperty;eo=et(8676).isObject;ei=et(630);ee=et(8745);$.exports=en=function($){es(et,$);function et($,en,ei,es){var eu;et.__super__.constructor.call(this,$);if(eo(en)){eu=en,en=eu.version,ei=eu.encoding,es=eu.standalone}if(!en){en="1.0"}this.type=ee.Declaration;this.version=this.stringify.xmlVersion(en);if(ei!=null){this.encoding=this.stringify.xmlEncoding(ei)}if(es!=null){this.standalone=this.stringify.xmlStandalone(es)}}et.prototype.toString=function($){return this.options.writer.declaration(this,this.options.writer.filterOptions($))};return et}(ei)}).call(this)},6808:function($,ee,et){(function(){var ee,en,ei,eo,es,eu,el,ef,ed,ep=function($,ee){for(var et in ee){if(eh.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},eh={}.hasOwnProperty;ed=et(8676).isObject;ef=et(630);ee=et(8745);en=et(4131);eo=et(7834);ei=et(7338);es=et(8507);el=et(9538);$.exports=eu=function($){ep(et,$);function et($,en,ei){var eo,es,eu,el,ef,ep;et.__super__.constructor.call(this,$);this.type=ee.DocType;if($.children){el=$.children;for(es=0,eu=el.length;es<eu;es++){eo=el[es];if(eo.type===ee.Element){this.name=eo.name;break}}}this.documentObject=$;if(ed(en)){ef=en,en=ef.pubID,ei=ef.sysID}if(ei==null){ep=[en,ei],ei=ep[0],en=ep[1]}if(en!=null){this.pubID=this.stringify.dtdPubID(en)}if(ei!=null){this.sysID=this.stringify.dtdSysID(ei)}}Object.defineProperty(et.prototype,"entities",{get:function(){var $,et,en,ei,eo;ei={};eo=this.children;for(et=0,en=eo.length;et<en;et++){$=eo[et];if($.type===ee.EntityDeclaration&&!$.pe){ei[$.name]=$}}return new el(ei)}});Object.defineProperty(et.prototype,"notations",{get:function(){var $,et,en,ei,eo;ei={};eo=this.children;for(et=0,en=eo.length;et<en;et++){$=eo[et];if($.type===ee.NotationDeclaration){ei[$.name]=$}}return new el(ei)}});Object.defineProperty(et.prototype,"publicId",{get:function(){return this.pubID}});Object.defineProperty(et.prototype,"systemId",{get:function(){return this.sysID}});Object.defineProperty(et.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}});et.prototype.element=function($,ee){var et;et=new ei(this,$,ee);this.children.push(et);return this};et.prototype.attList=function($,ee,et,ei,eo){var es;es=new en(this,$,ee,et,ei,eo);this.children.push(es);return this};et.prototype.entity=function($,ee){var et;et=new eo(this,false,$,ee);this.children.push(et);return this};et.prototype.pEntity=function($,ee){var et;et=new eo(this,true,$,ee);this.children.push(et);return this};et.prototype.notation=function($,ee){var et;et=new es(this,$,ee);this.children.push(et);return this};et.prototype.toString=function($){return this.options.writer.docType(this,this.options.writer.filterOptions($))};et.prototype.ele=function($,ee){return this.element($,ee)};et.prototype.att=function($,ee,et,en,ei){return this.attList($,ee,et,en,ei)};et.prototype.ent=function($,ee){return this.entity($,ee)};et.prototype.pent=function($,ee){return this.pEntity($,ee)};et.prototype.not=function($,ee){return this.notation($,ee)};et.prototype.up=function(){return this.root()||this.documentObject};et.prototype.isEqualNode=function($){if(!et.__super__.isEqualNode.apply(this,arguments).isEqualNode($)){return false}if($.name!==this.name){return false}if($.publicId!==this.publicId){return false}if($.systemId!==this.systemId){return false}return true};return et}(ef)}).call(this)},1888:function($,ee,et){(function(){var ee,en,ei,eo,es,eu,el,ef,ed=function($,ee){for(var et in ee){if(ep.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},ep={}.hasOwnProperty;ef=et(8676).isPlainObject;ei=et(4016);en=et(1829);es=et(630);ee=et(8745);el=et(8365);eu=et(1663);$.exports=eo=function($){ed(et,$);function et($){et.__super__.constructor.call(this,null);this.name="#document";this.type=ee.Document;this.documentURI=null;this.domConfig=new en;$||($={});if(!$.writer){$.writer=new eu}this.options=$;this.stringify=new el($)}Object.defineProperty(et.prototype,"implementation",{value:new ei});Object.defineProperty(et.prototype,"doctype",{get:function(){var $,et,en,ei;ei=this.children;for(et=0,en=ei.length;et<en;et++){$=ei[et];if($.type===ee.DocType){return $}}return null}});Object.defineProperty(et.prototype,"documentElement",{get:function(){return this.rootObject||null}});Object.defineProperty(et.prototype,"inputEncoding",{get:function(){return null}});Object.defineProperty(et.prototype,"strictErrorChecking",{get:function(){return false}});Object.defineProperty(et.prototype,"xmlEncoding",{get:function(){if(this.children.length!==0&&this.children[0].type===ee.Declaration){return this.children[0].encoding}else{return null}}});Object.defineProperty(et.prototype,"xmlStandalone",{get:function(){if(this.children.length!==0&&this.children[0].type===ee.Declaration){return this.children[0].standalone==="yes"}else{return false}}});Object.defineProperty(et.prototype,"xmlVersion",{get:function(){if(this.children.length!==0&&this.children[0].type===ee.Declaration){return this.children[0].version}else{return"1.0"}}});Object.defineProperty(et.prototype,"URL",{get:function(){return this.documentURI}});Object.defineProperty(et.prototype,"origin",{get:function(){return null}});Object.defineProperty(et.prototype,"compatMode",{get:function(){return null}});Object.defineProperty(et.prototype,"characterSet",{get:function(){return null}});Object.defineProperty(et.prototype,"contentType",{get:function(){return null}});et.prototype.end=function($){var ee;ee={};if(!$){$=this.options.writer}else if(ef($)){ee=$;$=this.options.writer}return $.document(this,$.filterOptions(ee))};et.prototype.toString=function($){return this.options.writer.document(this,this.options.writer.filterOptions($))};et.prototype.createElement=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createTextNode=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createComment=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createCDATASection=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createProcessingInstruction=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createAttribute=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createEntityReference=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementsByTagName=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.importNode=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createElementNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createAttributeNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementsByTagNameNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementById=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.adoptNode=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.renameNode=function($,ee,et){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementsByClassName=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createEvent=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createNodeIterator=function($,ee,et){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createTreeWalker=function($,ee,et){throw new Error("This DOM method is not implemented."+this.debugInfo())};return et}(es)}).call(this)},2621:function($,ee,et){(function(){var ee,en,ei,eo,es,eu,el,ef,ed,ep,eh,ey,eg,em,e_,ew,eE,eS,eT,eO,eA,eI,eN,eD,eR={}.hasOwnProperty;eD=et(8676),eI=eD.isObject,eA=eD.isFunction,eN=eD.isPlainObject,eO=eD.getValue;ee=et(8745);ey=et(1888);em=et(5725);eo=et(9877);es=et(2374);ew=et(7641);eT=et(4306);e_=et(3402);ep=et(2308);eh=et(6808);eu=et(4131);ef=et(7834);el=et(7338);ed=et(8507);ei=et(7490);eS=et(8365);eE=et(1663);en=et(6530);$.exports=eg=function(){function $($,et,en){var ei;this.name="?xml";this.type=ee.Document;$||($={});ei={};if(!$.writer){$.writer=new eE}else if(eN($.writer)){ei=$.writer;$.writer=new eE}this.options=$;this.writer=$.writer;this.writerOptions=this.writer.filterOptions(ei);this.stringify=new eS($);this.onDataCallback=et||function(){};this.onEndCallback=en||function(){};this.currentNode=null;this.currentLevel=-1;this.openTags={};this.documentStarted=false;this.documentCompleted=false;this.root=null}$.prototype.createChildNode=function($){var et,en,ei,eo,es,eu,el,ef;switch($.type){case ee.CData:this.cdata($.value);break;case ee.Comment:this.comment($.value);break;case ee.Element:ei={};el=$.attribs;for(en in el){if(!eR.call(el,en))continue;et=el[en];ei[en]=et.value}this.node($.name,ei);break;case ee.Dummy:this.dummy();break;case ee.Raw:this.raw($.value);break;case ee.Text:this.text($.value);break;case ee.ProcessingInstruction:this.instruction($.target,$.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+$.constructor.name)}ef=$.children;for(es=0,eu=ef.length;es<eu;es++){eo=ef[es];this.createChildNode(eo);if(eo.type===ee.Element){this.up()}}return this};$.prototype.dummy=function(){return this};$.prototype.node=function($,ee,et){var en;if($==null){throw new Error("Missing node name.")}if(this.root&&this.currentLevel===-1){throw new Error("Document can only have one root node. "+this.debugInfo($))}this.openCurrent();$=eO($);if(ee==null){ee={}}ee=eO(ee);if(!eI(ee)){en=[ee,et],et=en[0],ee=en[1]}this.currentNode=new em(this,$,ee);this.currentNode.children=false;this.currentLevel++;this.openTags[this.currentLevel]=this.currentNode;if(et!=null){this.text(et)}return this};$.prototype.element=function($,et,en){var ei,eo,es,eu,el,ef;if(this.currentNode&&this.currentNode.type===ee.DocType){this.dtdElement.apply(this,arguments)}else{if(Array.isArray($)||eI($)||eA($)){eu=this.options.noValidation;this.options.noValidation=true;ef=new ey(this.options).element("TEMP_ROOT");ef.element($);this.options.noValidation=eu;el=ef.children;for(eo=0,es=el.length;eo<es;eo++){ei=el[eo];this.createChildNode(ei);if(ei.type===ee.Element){this.up()}}}else{this.node($,et,en)}}return this};$.prototype.attribute=function($,ee){var et,en;if(!this.currentNode||this.currentNode.children){throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo($))}if($!=null){$=eO($)}if(eI($)){for(et in $){if(!eR.call($,et))continue;en=$[et];this.attribute(et,en)}}else{if(eA(ee)){ee=ee.apply()}if(this.options.keepNullAttributes&&ee==null){this.currentNode.attribs[$]=new ei(this,$,"")}else if(ee!=null){this.currentNode.attribs[$]=new ei(this,$,ee)}}return this};$.prototype.text=function($){var ee;this.openCurrent();ee=new eT(this,$);this.onData(this.writer.text(ee,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.cdata=function($){var ee;this.openCurrent();ee=new eo(this,$);this.onData(this.writer.cdata(ee,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.comment=function($){var ee;this.openCurrent();ee=new es(this,$);this.onData(this.writer.comment(ee,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.raw=function($){var ee;this.openCurrent();ee=new ew(this,$);this.onData(this.writer.raw(ee,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.instruction=function($,ee){var et,en,ei,eo,es;this.openCurrent();if($!=null){$=eO($)}if(ee!=null){ee=eO(ee)}if(Array.isArray($)){for(et=0,eo=$.length;et<eo;et++){en=$[et];this.instruction(en)}}else if(eI($)){for(en in $){if(!eR.call($,en))continue;ei=$[en];this.instruction(en,ei)}}else{if(eA(ee)){ee=ee.apply()}es=new e_(this,$,ee);this.onData(this.writer.processingInstruction(es,this.writerOptions,this.currentLevel+1),this.currentLevel+1)}return this};$.prototype.declaration=function($,ee,et){var en;this.openCurrent();if(this.documentStarted){throw new Error("declaration() must be the first node.")}en=new ep(this,$,ee,et);this.onData(this.writer.declaration(en,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.doctype=function($,ee,et){this.openCurrent();if($==null){throw new Error("Missing root node name.")}if(this.root){throw new Error("dtd() must come before the root node.")}this.currentNode=new eh(this,ee,et);this.currentNode.rootNodeName=$;this.currentNode.children=false;this.currentLevel++;this.openTags[this.currentLevel]=this.currentNode;return this};$.prototype.dtdElement=function($,ee){var et;this.openCurrent();et=new el(this,$,ee);this.onData(this.writer.dtdElement(et,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.attList=function($,ee,et,en,ei){var eo;this.openCurrent();eo=new eu(this,$,ee,et,en,ei);this.onData(this.writer.dtdAttList(eo,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.entity=function($,ee){var et;this.openCurrent();et=new ef(this,false,$,ee);this.onData(this.writer.dtdEntity(et,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.pEntity=function($,ee){var et;this.openCurrent();et=new ef(this,true,$,ee);this.onData(this.writer.dtdEntity(et,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.notation=function($,ee){var et;this.openCurrent();et=new ed(this,$,ee);this.onData(this.writer.dtdNotation(et,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.up=function(){if(this.currentLevel<0){throw new Error("The document node has no parent.")}if(this.currentNode){if(this.currentNode.children){this.closeNode(this.currentNode)}else{this.openNode(this.currentNode)}this.currentNode=null}else{this.closeNode(this.openTags[this.currentLevel])}delete this.openTags[this.currentLevel];this.currentLevel--;return this};$.prototype.end=function(){while(this.currentLevel>=0){this.up()}return this.onEnd()};$.prototype.openCurrent=function(){if(this.currentNode){this.currentNode.children=true;return this.openNode(this.currentNode)}};$.prototype.openNode=function($){var et,ei,eo,es;if(!$.isOpen){if(!this.root&&this.currentLevel===0&&$.type===ee.Element){this.root=$}ei="";if($.type===ee.Element){this.writerOptions.state=en.OpenTag;ei=this.writer.indent($,this.writerOptions,this.currentLevel)+"<"+$.name;es=$.attribs;for(eo in es){if(!eR.call(es,eo))continue;et=es[eo];ei+=this.writer.attribute(et,this.writerOptions,this.currentLevel)}ei+=($.children?">":"/>")+this.writer.endline($,this.writerOptions,this.currentLevel);this.writerOptions.state=en.InsideTag}else{this.writerOptions.state=en.OpenTag;ei=this.writer.indent($,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+$.rootNodeName;if($.pubID&&$.sysID){ei+=' PUBLIC "'+$.pubID+'" "'+$.sysID+'"'}else if($.sysID){ei+=' SYSTEM "'+$.sysID+'"'}if($.children){ei+=" [";this.writerOptions.state=en.InsideTag}else{this.writerOptions.state=en.CloseTag;ei+=">"}ei+=this.writer.endline($,this.writerOptions,this.currentLevel)}this.onData(ei,this.currentLevel);return $.isOpen=true}};$.prototype.closeNode=function($){var et;if(!$.isClosed){et="";this.writerOptions.state=en.CloseTag;if($.type===ee.Element){et=this.writer.indent($,this.writerOptions,this.currentLevel)+"</"+$.name+">"+this.writer.endline($,this.writerOptions,this.currentLevel)}else{et=this.writer.indent($,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline($,this.writerOptions,this.currentLevel)}this.writerOptions.state=en.None;this.onData(et,this.currentLevel);return $.isClosed=true}};$.prototype.onData=function($,ee){this.documentStarted=true;return this.onDataCallback($,ee+1)};$.prototype.onEnd=function(){this.documentCompleted=true;return this.onEndCallback()};$.prototype.debugInfo=function($){if($==null){return""}else{return"node: <"+$+">"}};$.prototype.ele=function(){return this.element.apply(this,arguments)};$.prototype.nod=function($,ee,et){return this.node($,ee,et)};$.prototype.txt=function($){return this.text($)};$.prototype.dat=function($){return this.cdata($)};$.prototype.com=function($){return this.comment($)};$.prototype.ins=function($,ee){return this.instruction($,ee)};$.prototype.dec=function($,ee,et){return this.declaration($,ee,et)};$.prototype.dtd=function($,ee,et){return this.doctype($,ee,et)};$.prototype.e=function($,ee,et){return this.element($,ee,et)};$.prototype.n=function($,ee,et){return this.node($,ee,et)};$.prototype.t=function($){return this.text($)};$.prototype.d=function($){return this.cdata($)};$.prototype.c=function($){return this.comment($)};$.prototype.r=function($){return this.raw($)};$.prototype.i=function($,ee){return this.instruction($,ee)};$.prototype.att=function(){if(this.currentNode&&this.currentNode.type===ee.DocType){return this.attList.apply(this,arguments)}else{return this.attribute.apply(this,arguments)}};$.prototype.a=function(){if(this.currentNode&&this.currentNode.type===ee.DocType){return this.attList.apply(this,arguments)}else{return this.attribute.apply(this,arguments)}};$.prototype.ent=function($,ee){return this.entity($,ee)};$.prototype.pent=function($,ee){return this.pEntity($,ee)};$.prototype.not=function($,ee){return this.notation($,ee)};return $}()}).call(this)},4402:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ei=et(630);ee=et(8745);$.exports=en=function($){eo(et,$);function et($){et.__super__.constructor.call(this,$);this.type=ee.Dummy}et.prototype.clone=function(){return Object.create(this)};et.prototype.toString=function($){return""};return et}(ei)}).call(this)},5725:function($,ee,et){(function(){var ee,en,ei,eo,es,eu,el,ef,ed,ep=function($,ee){for(var et in ee){if(eh.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},eh={}.hasOwnProperty;ed=et(8676),ef=ed.isObject,el=ed.isFunction,eu=ed.getValue;es=et(630);ee=et(8745);en=et(7490);eo=et(9538);$.exports=ei=function($){ep(et,$);function et($,en,ei){var eo,es,eu,el;et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing element name. "+this.debugInfo())}this.name=this.stringify.name(en);this.type=ee.Element;this.attribs={};this.schemaTypeInfo=null;if(ei!=null){this.attribute(ei)}if($.type===ee.Document){this.isRoot=true;this.documentObject=$;$.rootObject=this;if($.children){el=$.children;for(es=0,eu=el.length;es<eu;es++){eo=el[es];if(eo.type===ee.DocType){eo.name=this.name;break}}}}}Object.defineProperty(et.prototype,"tagName",{get:function(){return this.name}});Object.defineProperty(et.prototype,"namespaceURI",{get:function(){return""}});Object.defineProperty(et.prototype,"prefix",{get:function(){return""}});Object.defineProperty(et.prototype,"localName",{get:function(){return this.name}});Object.defineProperty(et.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}});Object.defineProperty(et.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}});Object.defineProperty(et.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}});Object.defineProperty(et.prototype,"attributes",{get:function(){if(!this.attributeMap||!this.attributeMap.nodes){this.attributeMap=new eo(this.attribs)}return this.attributeMap}});et.prototype.clone=function(){var $,ee,et,en;et=Object.create(this);if(et.isRoot){et.documentObject=null}et.attribs={};en=this.attribs;for(ee in en){if(!eh.call(en,ee))continue;$=en[ee];et.attribs[ee]=$.clone()}et.children=[];this.children.forEach(function($){var ee;ee=$.clone();ee.parent=et;return et.children.push(ee)});return et};et.prototype.attribute=function($,ee){var et,ei;if($!=null){$=eu($)}if(ef($)){for(et in $){if(!eh.call($,et))continue;ei=$[et];this.attribute(et,ei)}}else{if(el(ee)){ee=ee.apply()}if(this.options.keepNullAttributes&&ee==null){this.attribs[$]=new en(this,$,"")}else if(ee!=null){this.attribs[$]=new en(this,$,ee)}}return this};et.prototype.removeAttribute=function($){var ee,et,en;if($==null){throw new Error("Missing attribute name. "+this.debugInfo())}$=eu($);if(Array.isArray($)){for(et=0,en=$.length;et<en;et++){ee=$[et];delete this.attribs[ee]}}else{delete this.attribs[$]}return this};et.prototype.toString=function($){return this.options.writer.element(this,this.options.writer.filterOptions($))};et.prototype.att=function($,ee){return this.attribute($,ee)};et.prototype.a=function($,ee){return this.attribute($,ee)};et.prototype.getAttribute=function($){if(this.attribs.hasOwnProperty($)){return this.attribs[$].value}else{return null}};et.prototype.setAttribute=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getAttributeNode=function($){if(this.attribs.hasOwnProperty($)){return this.attribs[$]}else{return null}};et.prototype.setAttributeNode=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.removeAttributeNode=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementsByTagName=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getAttributeNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.setAttributeNS=function($,ee,et){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.removeAttributeNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getAttributeNodeNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.setAttributeNodeNS=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementsByTagNameNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.hasAttribute=function($){return this.attribs.hasOwnProperty($)};et.prototype.hasAttributeNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.setIdAttribute=function($,ee){if(this.attribs.hasOwnProperty($)){return this.attribs[$].isId}else{return ee}};et.prototype.setIdAttributeNS=function($,ee,et){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.setIdAttributeNode=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementsByTagName=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementsByTagNameNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementsByClassName=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.isEqualNode=function($){var ee,en,ei;if(!et.__super__.isEqualNode.apply(this,arguments).isEqualNode($)){return false}if($.namespaceURI!==this.namespaceURI){return false}if($.prefix!==this.prefix){return false}if($.localName!==this.localName){return false}if($.attribs.length!==this.attribs.length){return false}for(ee=en=0,ei=this.attribs.length-1;0<=ei?en<=ei:en>=ei;ee=0<=ei?++en:--en){if(!this.attribs[ee].isEqualNode($.attribs[ee])){return false}}return true};return et}(es)}).call(this)},9538:function($){(function(){var ee;$.exports=ee=function(){function $($){this.nodes=$}Object.defineProperty($.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}});$.prototype.clone=function(){return this.nodes=null};$.prototype.getNamedItem=function($){return this.nodes[$]};$.prototype.setNamedItem=function($){var ee;ee=this.nodes[$.nodeName];this.nodes[$.nodeName]=$;return ee||null};$.prototype.removeNamedItem=function($){var ee;ee=this.nodes[$];delete this.nodes[$];return ee||null};$.prototype.item=function($){return this.nodes[Object.keys(this.nodes)[$]]||null};$.prototype.getNamedItemNS=function($,ee){throw new Error("This DOM method is not implemented.")};$.prototype.setNamedItemNS=function($){throw new Error("This DOM method is not implemented.")};$.prototype.removeNamedItemNS=function($,ee){throw new Error("This DOM method is not implemented.")};return $}()}).call(this)},630:function($,ee,et){(function(){var ee,en,ei,eo,es,eu,el,ef,ed,ep,eh,ey,eg,em,e_,ew,eE,eS,eT,eO={}.hasOwnProperty;eT=et(8676),eS=eT.isObject,eE=eT.isFunction,ew=eT.isEmpty,e_=eT.getValue;ef=null;ei=null;eo=null;es=null;eu=null;eg=null;em=null;ey=null;el=null;en=null;eh=null;ed=null;ee=null;$.exports=ep=function(){function $($){this.parent=$;if(this.parent){this.options=this.parent.options;this.stringify=this.parent.stringify}this.value=null;this.children=[];this.baseURI=null;if(!ef){ef=et(5725);ei=et(9877);eo=et(2374);es=et(2308);eu=et(6808);eg=et(7641);em=et(4306);ey=et(3402);el=et(4402);en=et(8745);eh=et(3220);ed=et(9538);ee=et(8154)}}Object.defineProperty($.prototype,"nodeName",{get:function(){return this.name}});Object.defineProperty($.prototype,"nodeType",{get:function(){return this.type}});Object.defineProperty($.prototype,"nodeValue",{get:function(){return this.value}});Object.defineProperty($.prototype,"parentNode",{get:function(){return this.parent}});Object.defineProperty($.prototype,"childNodes",{get:function(){if(!this.childNodeList||!this.childNodeList.nodes){this.childNodeList=new eh(this.children)}return this.childNodeList}});Object.defineProperty($.prototype,"firstChild",{get:function(){return this.children[0]||null}});Object.defineProperty($.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}});Object.defineProperty($.prototype,"previousSibling",{get:function(){var $;$=this.parent.children.indexOf(this);return this.parent.children[$-1]||null}});Object.defineProperty($.prototype,"nextSibling",{get:function(){var $;$=this.parent.children.indexOf(this);return this.parent.children[$+1]||null}});Object.defineProperty($.prototype,"ownerDocument",{get:function(){return this.document()||null}});Object.defineProperty($.prototype,"textContent",{get:function(){var $,ee,et,ei,eo;if(this.nodeType===en.Element||this.nodeType===en.DocumentFragment){eo="";ei=this.children;for(ee=0,et=ei.length;ee<et;ee++){$=ei[ee];if($.textContent){eo+=$.textContent}}return eo}else{return null}},set:function($){throw new Error("This DOM method is not implemented."+this.debugInfo())}});$.prototype.setParent=function($){var ee,et,en,ei,eo;this.parent=$;if($){this.options=$.options;this.stringify=$.stringify}ei=this.children;eo=[];for(et=0,en=ei.length;et<en;et++){ee=ei[et];eo.push(ee.setParent(this))}return eo};$.prototype.element=function($,ee,et){var en,ei,eo,es,eu,el,ef,ed,ep,eh,ey;el=null;if(ee===null&&et==null){ep=[{},null],ee=ep[0],et=ep[1]}if(ee==null){ee={}}ee=e_(ee);if(!eS(ee)){eh=[ee,et],et=eh[0],ee=eh[1]}if($!=null){$=e_($)}if(Array.isArray($)){for(eo=0,ef=$.length;eo<ef;eo++){ei=$[eo];el=this.element(ei)}}else if(eE($)){el=this.element($.apply())}else if(eS($)){for(eu in $){if(!eO.call($,eu))continue;ey=$[eu];if(eE(ey)){ey=ey.apply()}if(!this.options.ignoreDecorators&&this.stringify.convertAttKey&&eu.indexOf(this.stringify.convertAttKey)===0){el=this.attribute(eu.substr(this.stringify.convertAttKey.length),ey)}else if(!this.options.separateArrayItems&&Array.isArray(ey)&&ew(ey)){el=this.dummy()}else if(eS(ey)&&ew(ey)){el=this.element(eu)}else if(!this.options.keepNullNodes&&ey==null){el=this.dummy()}else if(!this.options.separateArrayItems&&Array.isArray(ey)){for(es=0,ed=ey.length;es<ed;es++){ei=ey[es];en={};en[eu]=ei;el=this.element(en)}}else if(eS(ey)){if(!this.options.ignoreDecorators&&this.stringify.convertTextKey&&eu.indexOf(this.stringify.convertTextKey)===0){el=this.element(ey)}else{el=this.element(eu);el.element(ey)}}else{el=this.element(eu,ey)}}}else if(!this.options.keepNullNodes&&et===null){el=this.dummy()}else{if(!this.options.ignoreDecorators&&this.stringify.convertTextKey&&$.indexOf(this.stringify.convertTextKey)===0){el=this.text(et)}else if(!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&$.indexOf(this.stringify.convertCDataKey)===0){el=this.cdata(et)}else if(!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&$.indexOf(this.stringify.convertCommentKey)===0){el=this.comment(et)}else if(!this.options.ignoreDecorators&&this.stringify.convertRawKey&&$.indexOf(this.stringify.convertRawKey)===0){el=this.raw(et)}else if(!this.options.ignoreDecorators&&this.stringify.convertPIKey&&$.indexOf(this.stringify.convertPIKey)===0){el=this.instruction($.substr(this.stringify.convertPIKey.length),et)}else{el=this.node($,ee,et)}}if(el==null){throw new Error("Could not create any elements with: "+$+". "+this.debugInfo())}return el};$.prototype.insertBefore=function($,ee,et){var en,ei,eo,es,eu;if($!=null?$.type:void 0){eo=$;es=ee;eo.setParent(this);if(es){ei=children.indexOf(es);eu=children.splice(ei);children.push(eo);Array.prototype.push.apply(children,eu)}else{children.push(eo)}return eo}else{if(this.isRoot){throw new Error("Cannot insert elements at root level. "+this.debugInfo($))}ei=this.parent.children.indexOf(this);eu=this.parent.children.splice(ei);en=this.parent.element($,ee,et);Array.prototype.push.apply(this.parent.children,eu);return en}};$.prototype.insertAfter=function($,ee,et){var en,ei,eo;if(this.isRoot){throw new Error("Cannot insert elements at root level. "+this.debugInfo($))}ei=this.parent.children.indexOf(this);eo=this.parent.children.splice(ei+1);en=this.parent.element($,ee,et);Array.prototype.push.apply(this.parent.children,eo);return en};$.prototype.remove=function(){var $,ee;if(this.isRoot){throw new Error("Cannot remove the root element. "+this.debugInfo())}$=this.parent.children.indexOf(this);[].splice.apply(this.parent.children,[$,$-$+1].concat(ee=[])),ee;return this.parent};$.prototype.node=function($,ee,et){var en,ei;if($!=null){$=e_($)}ee||(ee={});ee=e_(ee);if(!eS(ee)){ei=[ee,et],et=ei[0],ee=ei[1]}en=new ef(this,$,ee);if(et!=null){en.text(et)}this.children.push(en);return en};$.prototype.text=function($){var ee;if(eS($)){this.element($)}ee=new em(this,$);this.children.push(ee);return this};$.prototype.cdata=function($){var ee;ee=new ei(this,$);this.children.push(ee);return this};$.prototype.comment=function($){var ee;ee=new eo(this,$);this.children.push(ee);return this};$.prototype.commentBefore=function($){var ee,et,en;et=this.parent.children.indexOf(this);en=this.parent.children.splice(et);ee=this.parent.comment($);Array.prototype.push.apply(this.parent.children,en);return this};$.prototype.commentAfter=function($){var ee,et,en;et=this.parent.children.indexOf(this);en=this.parent.children.splice(et+1);ee=this.parent.comment($);Array.prototype.push.apply(this.parent.children,en);return this};$.prototype.raw=function($){var ee;ee=new eg(this,$);this.children.push(ee);return this};$.prototype.dummy=function(){var $;$=new el(this);return $};$.prototype.instruction=function($,ee){var et,en,ei,eo,es;if($!=null){$=e_($)}if(ee!=null){ee=e_(ee)}if(Array.isArray($)){for(eo=0,es=$.length;eo<es;eo++){et=$[eo];this.instruction(et)}}else if(eS($)){for(et in $){if(!eO.call($,et))continue;en=$[et];this.instruction(et,en)}}else{if(eE(ee)){ee=ee.apply()}ei=new ey(this,$,ee);this.children.push(ei)}return this};$.prototype.instructionBefore=function($,ee){var et,en,ei;en=this.parent.children.indexOf(this);ei=this.parent.children.splice(en);et=this.parent.instruction($,ee);Array.prototype.push.apply(this.parent.children,ei);return this};$.prototype.instructionAfter=function($,ee){var et,en,ei;en=this.parent.children.indexOf(this);ei=this.parent.children.splice(en+1);et=this.parent.instruction($,ee);Array.prototype.push.apply(this.parent.children,ei);return this};$.prototype.declaration=function($,ee,et){var ei,eo;ei=this.document();eo=new es(ei,$,ee,et);if(ei.children.length===0){ei.children.unshift(eo)}else if(ei.children[0].type===en.Declaration){ei.children[0]=eo}else{ei.children.unshift(eo)}return ei.root()||ei};$.prototype.dtd=function($,ee){var et,ei,eo,es,el,ef,ed,ep,eh,ey;ei=this.document();eo=new eu(ei,$,ee);eh=ei.children;for(es=el=0,ed=eh.length;el<ed;es=++el){et=eh[es];if(et.type===en.DocType){ei.children[es]=eo;return eo}}ey=ei.children;for(es=ef=0,ep=ey.length;ef<ep;es=++ef){et=ey[es];if(et.isRoot){ei.children.splice(es,0,eo);return eo}}ei.children.push(eo);return eo};$.prototype.up=function(){if(this.isRoot){throw new Error("The root node has no parent. Use doc() if you need to get the document object.")}return this.parent};$.prototype.root=function(){var $;$=this;while($){if($.type===en.Document){return $.rootObject}else if($.isRoot){return $}else{$=$.parent}}};$.prototype.document=function(){var $;$=this;while($){if($.type===en.Document){return $}else{$=$.parent}}};$.prototype.end=function($){return this.document().end($)};$.prototype.prev=function(){var $;$=this.parent.children.indexOf(this);if($<1){throw new Error("Already at the first node. "+this.debugInfo())}return this.parent.children[$-1]};$.prototype.next=function(){var $;$=this.parent.children.indexOf(this);if($===-1||$===this.parent.children.length-1){throw new Error("Already at the last node. "+this.debugInfo())}return this.parent.children[$+1]};$.prototype.importDocument=function($){var ee;ee=$.root().clone();ee.parent=this;ee.isRoot=false;this.children.push(ee);return this};$.prototype.debugInfo=function($){var ee,et;$=$||this.name;if($==null&&!((ee=this.parent)!=null?ee.name:void 0)){return""}else if($==null){return"parent: <"+this.parent.name+">"}else if(!((et=this.parent)!=null?et.name:void 0)){return"node: <"+$+">"}else{return"node: <"+$+">, parent: <"+this.parent.name+">"}};$.prototype.ele=function($,ee,et){return this.element($,ee,et)};$.prototype.nod=function($,ee,et){return this.node($,ee,et)};$.prototype.txt=function($){return this.text($)};$.prototype.dat=function($){return this.cdata($)};$.prototype.com=function($){return this.comment($)};$.prototype.ins=function($,ee){return this.instruction($,ee)};$.prototype.doc=function(){return this.document()};$.prototype.dec=function($,ee,et){return this.declaration($,ee,et)};$.prototype.e=function($,ee,et){return this.element($,ee,et)};$.prototype.n=function($,ee,et){return this.node($,ee,et)};$.prototype.t=function($){return this.text($)};$.prototype.d=function($){return this.cdata($)};$.prototype.c=function($){return this.comment($)};$.prototype.r=function($){return this.raw($)};$.prototype.i=function($,ee){return this.instruction($,ee)};$.prototype.u=function(){return this.up()};$.prototype.importXMLBuilder=function($){return this.importDocument($)};$.prototype.replaceChild=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.removeChild=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.appendChild=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.hasChildNodes=function(){return this.children.length!==0};$.prototype.cloneNode=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.isSupported=function($,ee){return true};$.prototype.hasAttributes=function(){return this.attribs.length!==0};$.prototype.compareDocumentPosition=function($){var et,en;et=this;if(et===$){return 0}else if(this.document()!==$.document()){en=ee.Disconnected|ee.ImplementationSpecific;if(Math.random()<.5){en|=ee.Preceding}else{en|=ee.Following}return en}else if(et.isAncestor($)){return ee.Contains|ee.Preceding}else if(et.isDescendant($)){return ee.Contains|ee.Following}else if(et.isPreceding($)){return ee.Preceding}else{return ee.Following}};$.prototype.isSameNode=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.lookupPrefix=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.isDefaultNamespace=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.lookupNamespaceURI=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.isEqualNode=function($){var ee,et,en;if($.nodeType!==this.nodeType){return false}if($.children.length!==this.children.length){return false}for(ee=et=0,en=this.children.length-1;0<=en?et<=en:et>=en;ee=0<=en?++et:--et){if(!this.children[ee].isEqualNode($.children[ee])){return false}}return true};$.prototype.getFeature=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.setUserData=function($,ee,et){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.getUserData=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.contains=function($){if(!$){return false}return $===this||this.isDescendant($)};$.prototype.isDescendant=function($){var ee,et,en,ei,eo;eo=this.children;for(en=0,ei=eo.length;en<ei;en++){ee=eo[en];if($===ee){return true}et=ee.isDescendant($);if(et){return true}}return false};$.prototype.isAncestor=function($){return $.isDescendant(this)};$.prototype.isPreceding=function($){var ee,et;ee=this.treePosition($);et=this.treePosition(this);if(ee===-1||et===-1){return false}else{return ee<et}};$.prototype.isFollowing=function($){var ee,et;ee=this.treePosition($);et=this.treePosition(this);if(ee===-1||et===-1){return false}else{return ee>et}};$.prototype.treePosition=function($){var ee,et;et=0;ee=false;this.foreachTreeNode(this.document(),function(en){et++;if(!ee&&en===$){return ee=true}});if(ee){return et}else{return-1}};$.prototype.foreachTreeNode=function($,ee){var et,en,ei,eo,es;$||($=this.document());eo=$.children;for(en=0,ei=eo.length;en<ei;en++){et=eo[en];if(es=ee(et)){return es}else{es=this.foreachTreeNode(et,ee);if(es){return es}}}};return $}()}).call(this)},3220:function($){(function(){var ee;$.exports=ee=function(){function $($){this.nodes=$}Object.defineProperty($.prototype,"length",{get:function(){return this.nodes.length||0}});$.prototype.clone=function(){return this.nodes=null};$.prototype.item=function($){return this.nodes[$]||null};return $}()}).call(this)},3402:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ee=et(8745);en=et(4356);$.exports=ei=function($){eo(et,$);function et($,en,ei){et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing instruction target. "+this.debugInfo())}this.type=ee.ProcessingInstruction;this.target=this.stringify.insTarget(en);this.name=this.target;if(ei){this.value=this.stringify.insValue(ei)}}et.prototype.clone=function(){return Object.create(this)};et.prototype.toString=function($){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions($))};et.prototype.isEqualNode=function($){if(!et.__super__.isEqualNode.apply(this,arguments).isEqualNode($)){return false}if($.target!==this.target){return false}return true};return et}(en)}).call(this)},7641:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ee=et(8745);en=et(630);$.exports=ei=function($){eo(et,$);function et($,en){et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing raw text. "+this.debugInfo())}this.type=ee.Raw;this.value=this.stringify.raw(en)}et.prototype.clone=function(){return Object.create(this)};et.prototype.toString=function($){return this.options.writer.raw(this,this.options.writer.filterOptions($))};return et}(en)}).call(this)},1479:function($,ee,et){(function(){var ee,en,ei,eo,es=function($,ee){for(var et in ee){if(eu.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},eu={}.hasOwnProperty;ee=et(8745);eo=et(5859);en=et(6530);$.exports=ei=function($){es(et,$);function et($,ee){this.stream=$;et.__super__.constructor.call(this,ee)}et.prototype.endline=function($,ee,ei){if($.isLastRootNode&&ee.state===en.CloseTag){return""}else{return et.__super__.endline.call(this,$,ee,ei)}};et.prototype.document=function($,ee){var et,en,ei,eo,es,eu,el,ef,ed;el=$.children;for(en=ei=0,es=el.length;ei<es;en=++ei){et=el[en];et.isLastRootNode=en===$.children.length-1}ee=this.filterOptions(ee);ef=$.children;ed=[];for(eo=0,eu=ef.length;eo<eu;eo++){et=ef[eo];ed.push(this.writeChildNode(et,ee,0))}return ed};et.prototype.attribute=function($,ee,en){return this.stream.write(et.__super__.attribute.call(this,$,ee,en))};et.prototype.cdata=function($,ee,en){return this.stream.write(et.__super__.cdata.call(this,$,ee,en))};et.prototype.comment=function($,ee,en){return this.stream.write(et.__super__.comment.call(this,$,ee,en))};et.prototype.declaration=function($,ee,en){return this.stream.write(et.__super__.declaration.call(this,$,ee,en))};et.prototype.docType=function($,ee,et){var ei,eo,es,eu;et||(et=0);this.openNode($,ee,et);ee.state=en.OpenTag;this.stream.write(this.indent($,ee,et));this.stream.write("<!DOCTYPE "+$.root().name);if($.pubID&&$.sysID){this.stream.write(' PUBLIC "'+$.pubID+'" "'+$.sysID+'"')}else if($.sysID){this.stream.write(' SYSTEM "'+$.sysID+'"')}if($.children.length>0){this.stream.write(" [");this.stream.write(this.endline($,ee,et));ee.state=en.InsideTag;eu=$.children;for(eo=0,es=eu.length;eo<es;eo++){ei=eu[eo];this.writeChildNode(ei,ee,et+1)}ee.state=en.CloseTag;this.stream.write("]")}ee.state=en.CloseTag;this.stream.write(ee.spaceBeforeSlash+">");this.stream.write(this.endline($,ee,et));ee.state=en.None;return this.closeNode($,ee,et)};et.prototype.element=function($,et,ei){var eo,es,el,ef,ed,ep,eh,ey,eg,em;ei||(ei=0);this.openNode($,et,ei);et.state=en.OpenTag;this.stream.write(this.indent($,et,ei)+"<"+$.name);eg=$.attribs;for(eh in eg){if(!eu.call(eg,eh))continue;eo=eg[eh];this.attribute(eo,et,ei)}el=$.children.length;ef=el===0?null:$.children[0];if(el===0||$.children.every(function($){return($.type===ee.Text||$.type===ee.Raw)&&$.value===""})){if(et.allowEmpty){this.stream.write(">");et.state=en.CloseTag;this.stream.write("</"+$.name+">")}else{et.state=en.CloseTag;this.stream.write(et.spaceBeforeSlash+"/>")}}else if(et.pretty&&el===1&&(ef.type===ee.Text||ef.type===ee.Raw)&&ef.value!=null){this.stream.write(">");et.state=en.InsideTag;et.suppressPrettyCount++;ey=true;this.writeChildNode(ef,et,ei+1);et.suppressPrettyCount--;ey=false;et.state=en.CloseTag;this.stream.write("</"+$.name+">")}else{this.stream.write(">"+this.endline($,et,ei));et.state=en.InsideTag;em=$.children;for(ed=0,ep=em.length;ed<ep;ed++){es=em[ed];this.writeChildNode(es,et,ei+1)}et.state=en.CloseTag;this.stream.write(this.indent($,et,ei)+"</"+$.name+">")}this.stream.write(this.endline($,et,ei));et.state=en.None;return this.closeNode($,et,ei)};et.prototype.processingInstruction=function($,ee,en){return this.stream.write(et.__super__.processingInstruction.call(this,$,ee,en))};et.prototype.raw=function($,ee,en){return this.stream.write(et.__super__.raw.call(this,$,ee,en))};et.prototype.text=function($,ee,en){return this.stream.write(et.__super__.text.call(this,$,ee,en))};et.prototype.dtdAttList=function($,ee,en){return this.stream.write(et.__super__.dtdAttList.call(this,$,ee,en))};et.prototype.dtdElement=function($,ee,en){return this.stream.write(et.__super__.dtdElement.call(this,$,ee,en))};et.prototype.dtdEntity=function($,ee,en){return this.stream.write(et.__super__.dtdEntity.call(this,$,ee,en))};et.prototype.dtdNotation=function($,ee,en){return this.stream.write(et.__super__.dtdNotation.call(this,$,ee,en))};return et}(eo)}).call(this)},1663:function($,ee,et){(function(){var ee,en,ei=function($,ee){for(var et in ee){if(eo.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},eo={}.hasOwnProperty;en=et(5859);$.exports=ee=function($){ei(ee,$);function ee($){ee.__super__.constructor.call(this,$)}ee.prototype.document=function($,ee){var et,en,ei,eo,es;ee=this.filterOptions(ee);eo="";es=$.children;for(en=0,ei=es.length;en<ei;en++){et=es[en];eo+=this.writeChildNode(et,ee,0)}if(ee.pretty&&eo.slice(-ee.newline.length)===ee.newline){eo=eo.slice(0,-ee.newline.length)}return eo};return ee}(en)}).call(this)},8365:function($){(function(){var ee,et=function($,ee){return function(){return $.apply(ee,arguments)}},en={}.hasOwnProperty;$.exports=ee=function(){function $($){this.assertLegalName=et(this.assertLegalName,this);this.assertLegalChar=et(this.assertLegalChar,this);var ee,ei,eo;$||($={});this.options=$;if(!this.options.version){this.options.version="1.0"}ei=$.stringify||{};for(ee in ei){if(!en.call(ei,ee))continue;eo=ei[ee];this[ee]=eo}}$.prototype.name=function($){if(this.options.noValidation){return $}return this.assertLegalName(""+$||"")};$.prototype.text=function($){if(this.options.noValidation){return $}return this.assertLegalChar(this.textEscape(""+$||""))};$.prototype.cdata=function($){if(this.options.noValidation){return $}$=""+$||"";$=$.replace("]]>","]]]]><![CDATA[>");return this.assertLegalChar($)};$.prototype.comment=function($){if(this.options.noValidation){return $}$=""+$||"";if($.match(/--/)){throw new Error("Comment text cannot contain double-hypen: "+$)}return this.assertLegalChar($)};$.prototype.raw=function($){if(this.options.noValidation){return $}return""+$||""};$.prototype.attValue=function($){if(this.options.noValidation){return $}return this.assertLegalChar(this.attEscape($=""+$||""))};$.prototype.insTarget=function($){if(this.options.noValidation){return $}return this.assertLegalChar(""+$||"")};$.prototype.insValue=function($){if(this.options.noValidation){return $}$=""+$||"";if($.match(/\?>/)){throw new Error("Invalid processing instruction value: "+$)}return this.assertLegalChar($)};$.prototype.xmlVersion=function($){if(this.options.noValidation){return $}$=""+$||"";if(!$.match(/1\.[0-9]+/)){throw new Error("Invalid version number: "+$)}return $};$.prototype.xmlEncoding=function($){if(this.options.noValidation){return $}$=""+$||"";if(!$.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)){throw new Error("Invalid encoding: "+$)}return this.assertLegalChar($)};$.prototype.xmlStandalone=function($){if(this.options.noValidation){return $}if($){return"yes"}else{return"no"}};$.prototype.dtdPubID=function($){if(this.options.noValidation){return $}return this.assertLegalChar(""+$||"")};$.prototype.dtdSysID=function($){if(this.options.noValidation){return $}return this.assertLegalChar(""+$||"")};$.prototype.dtdElementValue=function($){if(this.options.noValidation){return $}return this.assertLegalChar(""+$||"")};$.prototype.dtdAttType=function($){if(this.options.noValidation){return $}return this.assertLegalChar(""+$||"")};$.prototype.dtdAttDefault=function($){if(this.options.noValidation){return $}return this.assertLegalChar(""+$||"")};$.prototype.dtdEntityValue=function($){if(this.options.noValidation){return $}return this.assertLegalChar(""+$||"")};$.prototype.dtdNData=function($){if(this.options.noValidation){return $}return this.assertLegalChar(""+$||"")};$.prototype.convertAttKey="@";$.prototype.convertPIKey="?";$.prototype.convertTextKey="#text";$.prototype.convertCDataKey="#cdata";$.prototype.convertCommentKey="#comment";$.prototype.convertRawKey="#raw";$.prototype.assertLegalChar=function($){var ee,et;if(this.options.noValidation){return $}ee="";if(this.options.version==="1.0"){ee=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;if(et=$.match(ee)){throw new Error("Invalid character in string: "+$+" at index "+et.index)}}else if(this.options.version==="1.1"){ee=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;if(et=$.match(ee)){throw new Error("Invalid character in string: "+$+" at index "+et.index)}}return $};$.prototype.assertLegalName=function($){var ee;if(this.options.noValidation){return $}this.assertLegalChar($);ee=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/;if(!$.match(ee)){throw new Error("Invalid character in name")}return $};$.prototype.textEscape=function($){var ee;if(this.options.noValidation){return $}ee=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g;return $.replace(ee,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
")};$.prototype.attEscape=function($){var ee;if(this.options.noValidation){return $}ee=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g;return $.replace(ee,"&").replace(/</g,"<").replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
")};return $}()}).call(this)},4306:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ee=et(8745);en=et(4356);$.exports=ei=function($){eo(et,$);function et($,en){et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing element text. "+this.debugInfo())}this.name="#text";this.type=ee.Text;this.value=this.stringify.text(en)}Object.defineProperty(et.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}});Object.defineProperty(et.prototype,"wholeText",{get:function(){var $,ee,et;et="";ee=this.previousSibling;while(ee){et=ee.data+et;ee=ee.previousSibling}et+=this.data;$=this.nextSibling;while($){et=et+$.data;$=$.nextSibling}return et}});et.prototype.clone=function(){return Object.create(this)};et.prototype.toString=function($){return this.options.writer.text(this,this.options.writer.filterOptions($))};et.prototype.splitText=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.replaceWholeText=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};return et}(en)}).call(this)},5859:function($,ee,et){(function(){var ee,en,ei,eo,es,eu,el,ef,ed,ep,eh,ey,eg,em,e_,ew,eE,eS={}.hasOwnProperty;eE=et(8676).assign;ee=et(8745);ed=et(2308);ep=et(6808);ei=et(9877);eo=et(2374);ey=et(5725);em=et(7641);e_=et(4306);eg=et(3402);eh=et(4402);es=et(4131);eu=et(7338);el=et(7834);ef=et(8507);en=et(6530);$.exports=ew=function(){function $($){var ee,et,en;$||($={});this.options=$;et=$.writer||{};for(ee in et){if(!eS.call(et,ee))continue;en=et[ee];this["_"+ee]=this[ee];this[ee]=en}}$.prototype.filterOptions=function($){var ee,et,ei,eo,es,eu,el,ef;$||($={});$=eE({},this.options,$);ee={writer:this};ee.pretty=$.pretty||false;ee.allowEmpty=$.allowEmpty||false;ee.indent=(et=$.indent)!=null?et:" ";ee.newline=(ei=$.newline)!=null?ei:"\n";ee.offset=(eo=$.offset)!=null?eo:0;ee.dontPrettyTextNodes=(es=(eu=$.dontPrettyTextNodes)!=null?eu:$.dontprettytextnodes)!=null?es:0;ee.spaceBeforeSlash=(el=(ef=$.spaceBeforeSlash)!=null?ef:$.spacebeforeslash)!=null?el:"";if(ee.spaceBeforeSlash===true){ee.spaceBeforeSlash=" "}ee.suppressPrettyCount=0;ee.user={};ee.state=en.None;return ee};$.prototype.indent=function($,ee,et){var en;if(!ee.pretty||ee.suppressPrettyCount){return""}else if(ee.pretty){en=(et||0)+ee.offset+1;if(en>0){return new Array(en).join(ee.indent)}}return""};$.prototype.endline=function($,ee,et){if(!ee.pretty||ee.suppressPrettyCount){return""}else{return ee.newline}};$.prototype.attribute=function($,ee,et){var en;this.openAttribute($,ee,et);en=" "+$.name+'="'+$.value+'"';this.closeAttribute($,ee,et);return en};$.prototype.cdata=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et)+"<![CDATA[";ee.state=en.InsideTag;ei+=$.value;ee.state=en.CloseTag;ei+="]]>"+this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.comment=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et)+"<!-- ";ee.state=en.InsideTag;ei+=$.value;ee.state=en.CloseTag;ei+=" -->"+this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.declaration=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et)+"<?xml";ee.state=en.InsideTag;ei+=' version="'+$.version+'"';if($.encoding!=null){ei+=' encoding="'+$.encoding+'"'}if($.standalone!=null){ei+=' standalone="'+$.standalone+'"'}ee.state=en.CloseTag;ei+=ee.spaceBeforeSlash+"?>";ei+=this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.docType=function($,ee,et){var ei,eo,es,eu,el;et||(et=0);this.openNode($,ee,et);ee.state=en.OpenTag;eu=this.indent($,ee,et);eu+="<!DOCTYPE "+$.root().name;if($.pubID&&$.sysID){eu+=' PUBLIC "'+$.pubID+'" "'+$.sysID+'"'}else if($.sysID){eu+=' SYSTEM "'+$.sysID+'"'}if($.children.length>0){eu+=" [";eu+=this.endline($,ee,et);ee.state=en.InsideTag;el=$.children;for(eo=0,es=el.length;eo<es;eo++){ei=el[eo];eu+=this.writeChildNode(ei,ee,et+1)}ee.state=en.CloseTag;eu+="]"}ee.state=en.CloseTag;eu+=ee.spaceBeforeSlash+">";eu+=this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return eu};$.prototype.element=function($,et,ei){var eo,es,eu,el,ef,ed,ep,eh,ey,eg,em,e_,ew,eE;ei||(ei=0);eg=false;em="";this.openNode($,et,ei);et.state=en.OpenTag;em+=this.indent($,et,ei)+"<"+$.name;e_=$.attribs;for(ey in e_){if(!eS.call(e_,ey))continue;eo=e_[ey];em+=this.attribute(eo,et,ei)}eu=$.children.length;el=eu===0?null:$.children[0];if(eu===0||$.children.every(function($){return($.type===ee.Text||$.type===ee.Raw)&&$.value===""})){if(et.allowEmpty){em+=">";et.state=en.CloseTag;em+="</"+$.name+">"+this.endline($,et,ei)}else{et.state=en.CloseTag;em+=et.spaceBeforeSlash+"/>"+this.endline($,et,ei)}}else if(et.pretty&&eu===1&&(el.type===ee.Text||el.type===ee.Raw)&&el.value!=null){em+=">";et.state=en.InsideTag;et.suppressPrettyCount++;eg=true;em+=this.writeChildNode(el,et,ei+1);et.suppressPrettyCount--;eg=false;et.state=en.CloseTag;em+="</"+$.name+">"+this.endline($,et,ei)}else{if(et.dontPrettyTextNodes){ew=$.children;for(ef=0,ep=ew.length;ef<ep;ef++){es=ew[ef];if((es.type===ee.Text||es.type===ee.Raw)&&es.value!=null){et.suppressPrettyCount++;eg=true;break}}}em+=">"+this.endline($,et,ei);et.state=en.InsideTag;eE=$.children;for(ed=0,eh=eE.length;ed<eh;ed++){es=eE[ed];em+=this.writeChildNode(es,et,ei+1)}et.state=en.CloseTag;em+=this.indent($,et,ei)+"</"+$.name+">";if(eg){et.suppressPrettyCount--}em+=this.endline($,et,ei);et.state=en.None}this.closeNode($,et,ei);return em};$.prototype.writeChildNode=function($,et,en){switch($.type){case ee.CData:return this.cdata($,et,en);case ee.Comment:return this.comment($,et,en);case ee.Element:return this.element($,et,en);case ee.Raw:return this.raw($,et,en);case ee.Text:return this.text($,et,en);case ee.ProcessingInstruction:return this.processingInstruction($,et,en);case ee.Dummy:return"";case ee.Declaration:return this.declaration($,et,en);case ee.DocType:return this.docType($,et,en);case ee.AttributeDeclaration:return this.dtdAttList($,et,en);case ee.ElementDeclaration:return this.dtdElement($,et,en);case ee.EntityDeclaration:return this.dtdEntity($,et,en);case ee.NotationDeclaration:return this.dtdNotation($,et,en);default:throw new Error("Unknown XML node type: "+$.constructor.name)}};$.prototype.processingInstruction=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et)+"<?";ee.state=en.InsideTag;ei+=$.target;if($.value){ei+=" "+$.value}ee.state=en.CloseTag;ei+=ee.spaceBeforeSlash+"?>";ei+=this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.raw=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et);ee.state=en.InsideTag;ei+=$.value;ee.state=en.CloseTag;ei+=this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.text=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et);ee.state=en.InsideTag;ei+=$.value;ee.state=en.CloseTag;ei+=this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.dtdAttList=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et)+"<!ATTLIST";ee.state=en.InsideTag;ei+=" "+$.elementName+" "+$.attributeName+" "+$.attributeType;if($.defaultValueType!=="#DEFAULT"){ei+=" "+$.defaultValueType}if($.defaultValue){ei+=' "'+$.defaultValue+'"'}ee.state=en.CloseTag;ei+=ee.spaceBeforeSlash+">"+this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.dtdElement=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et)+"<!ELEMENT";ee.state=en.InsideTag;ei+=" "+$.name+" "+$.value;ee.state=en.CloseTag;ei+=ee.spaceBeforeSlash+">"+this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.dtdEntity=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et)+"<!ENTITY";ee.state=en.InsideTag;if($.pe){ei+=" %"}ei+=" "+$.name;if($.value){ei+=' "'+$.value+'"'}else{if($.pubID&&$.sysID){ei+=' PUBLIC "'+$.pubID+'" "'+$.sysID+'"'}else if($.sysID){ei+=' SYSTEM "'+$.sysID+'"'}if($.nData){ei+=" NDATA "+$.nData}}ee.state=en.CloseTag;ei+=ee.spaceBeforeSlash+">"+this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.dtdNotation=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et)+"<!NOTATION";ee.state=en.InsideTag;ei+=" "+$.name;if($.pubID&&$.sysID){ei+=' PUBLIC "'+$.pubID+'" "'+$.sysID+'"'}else if($.pubID){ei+=' PUBLIC "'+$.pubID+'"'}else if($.sysID){ei+=' SYSTEM "'+$.sysID+'"'}ee.state=en.CloseTag;ei+=ee.spaceBeforeSlash+">"+this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.openNode=function($,ee,et){};$.prototype.closeNode=function($,ee,et){};$.prototype.openAttribute=function($,ee,et){};$.prototype.closeAttribute=function($,ee,et){};return $}()}).call(this)},9374:function($,ee,et){(function(){var ee,en,ei,eo,es,eu,el,ef,ed,ep;ep=et(8676),ef=ep.assign,ed=ep.isFunction;ei=et(4016);eo=et(1888);es=et(2621);el=et(1663);eu=et(1479);ee=et(8745);en=et(6530);$.exports.create=function($,ee,et,en){var ei,es;if($==null){throw new Error("Root element needs a name.")}en=ef({},ee,et,en);ei=new eo(en);es=ei.element($);if(!en.headless){ei.declaration(en);if(en.pubID!=null||en.sysID!=null){ei.dtd(en)}}return es};$.exports.begin=function($,ee,et){var en;if(ed($)){en=[$,ee],ee=en[0],et=en[1];$={}}if(ee){return new es($,ee,et)}else{return new eo($)}};$.exports.stringWriter=function($){return new el($)};$.exports.streamWriter=function($,ee){return new eu($,ee)};$.exports.implementation=new ei;$.exports.nodeType=ee;$.exports.writerState=en}).call(this)},5070:function($,ee){var et,en,ei;(function(eo,es){if(true){!(en=[],et=es,ei=typeof et==="function"?et.apply(ee,en):et,ei!==undefined&&($.exports=ei))}else{}})(this,function(){"use strict";function $($,ee){function et(){this.constructor=$}et.prototype=ee.prototype;$.prototype=new et}function ee($,et,en,ei){var eo=Error.call(this,$);if(Object.setPrototypeOf){Object.setPrototypeOf(eo,ee.prototype)}eo.expected=et;eo.found=en;eo.location=ei;eo.name="SyntaxError";return eo}$(ee,Error);function et($,ee,et){et=et||" ";if($.length>ee){return $}ee-=$.length;et+=et.repeat(ee);return $+et.slice(0,ee)}ee.prototype.format=function($){var ee="Error: "+this.message;if(this.location){var en=null;var ei;for(ei=0;ei<$.length;ei++){if($[ei].source===this.location.source){en=$[ei].text.split(/\r\n|\n|\r/g);break}}var eo=this.location.start;var es=this.location.source&&typeof this.location.source.offset==="function"?this.location.source.offset(eo):eo;var eu=this.location.source+":"+es.line+":"+es.column;if(en){var el=this.location.end;var ef=et("",es.line.toString().length," ");var ed=en[eo.line-1];var ep=eo.line===el.line?el.column:ed.length+1;var eh=ep-eo.column||1;ee+="\n --> "+eu+"\n"+ef+" |\n"+es.line+" | "+ed+"\n"+ef+" | "+et("",eo.column-1," ")+et("",eh,"^")}else{ee+="\n at "+eu}}return ee};ee.buildMessage=function($,ee){var et={literal:function($){return'"'+ei($.text)+'"'},class:function($){var ee=$.parts.map(function($){return Array.isArray($)?eo($[0])+"-"+eo($[1]):eo($)});return"["+($.inverted?"^":"")+ee.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function($){return $.description}};function en($){return $.charCodeAt(0).toString(16).toUpperCase()}function ei($){return $.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function($){return"\\x0"+en($)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function($){return"\\x"+en($)})}function eo($){return $.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function($){return"\\x0"+en($)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function($){return"\\x"+en($)})}function es($){return et[$.type]($)}function eu($){var ee=$.map(es);var et,en;ee.sort();if(ee.length>0){for(et=1,en=1;et<ee.length;et++){if(ee[et-1]!==ee[et]){ee[en]=ee[et];en++}}ee.length=en}switch(ee.length){case 1:return ee[0];case 2:return ee[0]+" or "+ee[1];default:return ee.slice(0,-1).join(", ")+", or "+ee[ee.length-1]}}function el($){return $?'"'+ei($)+'"':"end of input"}return"Expected "+eu($)+" but "+el(ee)+" found."};function en($,et){et=et!==undefined?et:{};var en={};var ei=et.grammarSource;var eo={expr:eK};var es=eK;var eu="source";var el="sink";var ef=" ";var ed=/^[0-9]/;var ep=eU("source",false);var eh=eU("sink",false);var ey=ez("space");var eg=eU(" ",false);var em=ez("digit");var e_=ej([["0","9"]],false,false);var ew=ez("weight");var eE=function(){return{type:"source"}};var eS=function($){return{type:"sink",weight:+$||1}};var eT=function($){return+$};var eO=0;var eA=0;var eI=[{line:1,column:1}];var eN=0;var eD=[];var eR=0;var eC;if("startRule"in et){if(!(et.startRule in eo)){throw new Error("Can't start parsing from rule \""+et.startRule+'".')}es=eo[et.startRule]}function ek(){return $.substring(eA,eO)}function eM(){return eA}function eL(){return{source:ei,start:eA,end:eO}}function eP(){return e$(eA,eO)}function eF(ee,et){et=et!==undefined?et:e$(eA,eO);throw eY([ez(ee)],$.substring(eA,eO),et)}function eB($,ee){ee=ee!==undefined?ee:e$(eA,eO);throw eG($,ee)}function eU($,ee){return{type:"literal",text:$,ignoreCase:ee}}function ej($,ee,et){return{type:"class",parts:$,inverted:ee,ignoreCase:et}}function eW(){return{type:"any"}}function eH(){return{type:"end"}}function ez($){return{type:"other",description:$}}function eV(ee){var et=eI[ee];var en;if(et){return et}else{en=ee-1;while(!eI[en]){en--}et=eI[en];et={line:et.line,column:et.column};while(en<ee){if($.charCodeAt(en)===10){et.line++;et.column=1}else{et.column++}en++}eI[ee]=et;return et}}function e$($,ee,et){var en=eV($);var eo=eV(ee);var es={source:ei,start:{offset:$,line:en.line,column:en.column},end:{offset:ee,line:eo.line,column:eo.column}};if(et&&ei&&typeof ei.offset==="function"){es.start=ei.offset(es.start);es.end=ei.offset(es.end)}return es}function eq($){if(eO<eN){return}if(eO>eN){eN=eO;eD=[]}eD.push($)}function eG($,et){return new ee($,null,null,et)}function eY($,et,en){return new ee(ee.buildMessage($,et),$,et,en)}function eK(){var $,ee,et,ei;$=eO;ee=eZ();if(ee!==en){eA=$;ee=eE()}$=ee;if($===en){$=eO;ee=eJ();if(ee!==en){et=eX();if(et===en){et=null}ei=e0();if(ei===en){ei=null}eA=$;$=eS(ei)}else{eO=$;$=en}}return $}function eZ(){var ee;if($.substr(eO,6)===eu){ee=eu;eO+=6}else{ee=en;if(eR===0){eq(ep)}}return ee}function eJ(){var ee;if($.substr(eO,4)===el){ee=el;eO+=4}else{ee=en;if(eR===0){eq(eh)}}return ee}function eX(){var ee,et;eR++;ee=[];if($.charCodeAt(eO)===32){et=ef;eO++}else{et=en;if(eR===0){eq(eg)}}if(et!==en){while(et!==en){ee.push(et);if($.charCodeAt(eO)===32){et=ef;eO++}else{et=en;if(eR===0){eq(eg)}}}}else{ee=en}eR--;if(ee===en){et=en;if(eR===0){eq(ey)}}return ee}function eQ(){var ee,et;eR++;if(ed.test($.charAt(eO))){ee=$.charAt(eO);eO++}else{ee=en;if(eR===0){eq(e_)}}eR--;if(ee===en){et=en;if(eR===0){eq(em)}}return ee}function e0(){var ee,et,ei,eo;eR++;ee=eO;et=eO;ei=[];eo=eQ();if(eo!==en){while(eo!==en){ei.push(eo);eo=eQ()}}else{ei=en}if(ei!==en){et=$.substring(et,eO)}else{et=ei}if(et!==en){eA=ee;et=eT(et)}ee=et;eR--;if(ee===en){et=en;if(eR===0){eq(ew)}}return ee}eC=es();if(eC!==en&&eO===$.length){return eC}else{if(eC!==en&&eO<$.length){eq(eH())}throw eY(eD,eN<$.length?$.charAt(eN):null,eN<$.length?e$(eN,eN+1):e$(eN,eN))}}return{SyntaxError:ee,parse:en}})},4939:function($,ee){var et,en,ei;(function(eo,es){if(true){!(en=[],et=es,ei=typeof et==="function"?et.apply(ee,en):et,ei!==undefined&&($.exports=ei))}else{}})(this,function(){"use strict";function $($,ee){function et(){this.constructor=$}et.prototype=ee.prototype;$.prototype=new et}function ee($,et,en,ei){var eo=Error.call(this,$);if(Object.setPrototypeOf){Object.setPrototypeOf(eo,ee.prototype)}eo.expected=et;eo.found=en;eo.location=ei;eo.name="SyntaxError";return eo}$(ee,Error);function et($,ee,et){et=et||" ";if($.length>ee){return $}ee-=$.length;et+=et.repeat(ee);return $+et.slice(0,ee)}ee.prototype.format=function($){var ee="Error: "+this.message;if(this.location){var en=null;var ei;for(ei=0;ei<$.length;ei++){if($[ei].source===this.location.source){en=$[ei].text.split(/\r\n|\n|\r/g);break}}var eo=this.location.start;var es=this.location.source&&typeof this.location.source.offset==="function"?this.location.source.offset(eo):eo;var eu=this.location.source+":"+es.line+":"+es.column;if(en){var el=this.location.end;var ef=et("",es.line.toString().length," ");var ed=en[eo.line-1];var ep=eo.line===el.line?el.column:ed.length+1;var eh=ep-eo.column||1;ee+="\n --> "+eu+"\n"+ef+" |\n"+es.line+" | "+ed+"\n"+ef+" | "+et("",eo.column-1," ")+et("",eh,"^")}else{ee+="\n at "+eu}}return ee};ee.buildMessage=function($,ee){var et={literal:function($){return'"'+ei($.text)+'"'},class:function($){var ee=$.parts.map(function($){return Array.isArray($)?eo($[0])+"-"+eo($[1]):eo($)});return"["+($.inverted?"^":"")+ee.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function($){return $.description}};function en($){return $.charCodeAt(0).toString(16).toUpperCase()}function ei($){return $.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function($){return"\\x0"+en($)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function($){return"\\x"+en($)})}function eo($){return $.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function($){return"\\x0"+en($)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function($){return"\\x"+en($)})}function es($){return et[$.type]($)}function eu($){var ee=$.map(es);var et,en;ee.sort();if(ee.length>0){for(et=1,en=1;et<ee.length;et++){if(ee[et-1]!==ee[et]){ee[en]=ee[et];en++}}ee.length=en}switch(ee.length){case 1:return ee[0];case 2:return ee[0]+" or "+ee[1];default:return ee.slice(0,-1).join(", ")+", or "+ee[ee.length-1]}}function el($){return $?'"'+ei($)+'"':"end of input"}return"Expected "+eu($)+" but "+el(ee)+" found."};function en($,et){et=et!==undefined?et:{};var en={};var ei=et.grammarSource;var eo={expr:rc};var es=rc;var eu="month";var el="months";var ef="year";var ed="years";var ep="hold";var eh="previous";var ey="spend";var eg="from";var em="week";var e_="weeks";var ew="by";var eE="of";var eS="repeat";var eT="every";var eO="starting";var eA="up";var eI="to";var eN="schedule";var eD="full";var eR="-";var eC="remainder";var ek=" ";var eM=".";var eL="%";var eP=/^[0-9]/;var eF=/^[1-9]/;var eB=/^[^\r\n\t]/;var eU=rr("repeat interval");var ej=t8("month",true);var eW=t8("months",true);var eH=t8("year",true);var ez=t8("years",true);var eV=t8("hold",true);var e$=t8("previous",true);var eq=t8("spend",true);var eG=t8("from",true);var eY=t8("week",true);var eK=t8("weeks",true);var eZ=t8("by",true);var eJ=t8("of",true);var eX=t8("repeat",true);var eQ=t8("every",true);var e0=t8("starting",true);var e1=t8("up",true);var e2=t8("to",true);var e6=t8("schedule",true);var e4=t8("full",true);var e3=t8("-",true);var e8=t8("remainder",true);var e5=rr("space");var e9=t8(" ",false);var e7=rr("digit");var te=t5([["0","9"]],false,false);var tt=rr("number");var tr=t5([["1","9"]],false,false);var tn=rr("amount");var ti=t8(".",false);var tu=rr("percentage");var tc=t8("%",false);var tf=rr("year");var td=rr("month");var tp=t8("-",false);var th=rr("day");var ty=rr("currency symbol");var tm=t9();var t_=rr("Name");var tv=t5(["\r","\n"," "],true,false);var tw=function($,ee,et){return{type:"percentage",percent:+ee.percent,previous:ee.prev,category:et,priority:+$}};var tE=function($,ee,et,en,ei){return{type:"week",amount:ee,weeks:et,starting:en,limit:ei,priority:+$}};var tS=function($,ee,et,en,ei){return{type:en?"spend":"by",amount:ee,month:et,...ei?ei[3]:{},from:en,priority:+$}};var tT=function($,ee,et){return{type:"simple",monthly:ee,limit:et,priority:+$}};var tO=function($,ee){return{type:"simple",limit:ee,priority:+$}};var tA=function($,ee,et){return{type:"schedule",name:et,priority:+$,full:ee}};var tI=function($,ee){return{type:"remainder",priority:null,weight:ee}};var tN=function(){return{annual:false}};var tD=function($){return{annual:false,repeat:+$}};var tR=function(){return{annual:true}};var tC=function($){return{annual:true,repeat:+$}};var tk=function($){return{amount:$,hold:true}};var tM=function($){return{amount:$,hold:false}};var tL=function($){return{percent:$,prev:true}};var tx=function($){return{percent:$,prev:false}};var tP=function(){return null};var tF=function($){return+$};var tB=function($){return $};var tU=function(){return true};var tj=function($){return $};var tW=function($){return+$||1};var tH=function($){return+$};var tz=function($){return+$};var tV=function($){return/\p{Sc}/u.test($)};var t$=0;var tq=0;var tG=[{line:1,column:1}];var tY=0;var tK=[];var tZ=0;var tJ;if("startRule"in et){if(!(et.startRule in eo)){throw new Error("Can't start parsing from rule \""+et.startRule+'".')}es=eo[et.startRule]}function tX(){return $.substring(tq,t$)}function tQ(){return tq}function t0(){return{source:ei,start:tq,end:t$}}function t6(){return ri(tq,t$)}function t4(ee,et){et=et!==undefined?et:ri(tq,t$);throw rl([rr(ee)],$.substring(tq,t$),et)}function t3($,ee){ee=ee!==undefined?ee:ri(tq,t$);throw ru($,ee)}function t8($,ee){return{type:"literal",text:$,ignoreCase:ee}}function t5($,ee,et){return{type:"class",parts:$,inverted:ee,ignoreCase:et}}function t9(){return{type:"any"}}function t7(){return{type:"end"}}function rr($){return{type:"other",description:$}}function rn(ee){var et=tG[ee];var en;if(et){return et}else{en=ee-1;while(!tG[en]){en--}et=tG[en];et={line:et.line,column:et.column};while(en<ee){if($.charCodeAt(en)===10){et.line++;et.column=1}else{et.column++}en++}tG[ee]=et;return et}}function ri($,ee,et){var en=rn($);var eo=rn(ee);var es={source:ei,start:{offset:$,line:en.line,column:en.column},end:{offset:ee,line:eo.line,column:eo.column}};if(et&&ei&&typeof ei.offset==="function"){es.start=ei.offset(es.start);es.end=ei.offset(es.end)}return es}function ro($){if(t$<tY){return}if(t$>tY){tY=t$;tK=[]}tK.push($)}function ru($,et){return new ee($,null,null,et)}function rl($,et,en){return new ee(ee.buildMessage($,et),$,et,en)}function rc(){var $,ee,et,ei,eo,es,eu,el,ef,ed,ep,eh,ey,eg;$=t$;ee=rI();if(ee===en){ee=null}et=rD();if(et===en){et=null}ei=rh();if(ei!==en){eo=rW();if(eo!==en){tq=$;$=tw(ee,ei,eo)}else{t$=$;$=en}}else{t$=$;$=en}if($===en){$=t$;ee=rI();if(ee===en){ee=null}et=rD();if(et===en){et=null}ei=rM();if(ei!==en){eo=rD();if(eo!==en){es=rE();if(es!==en){eu=rD();if(eu!==en){el=ry();if(el!==en){ef=rD();if(ef!==en){ed=rS();if(ed!==en){ep=rD();if(ep!==en){eh=rU();if(eh!==en){ey=rp();if(ey===en){ey=null}tq=$;$=tE(ee,ei,el,eh,ey)}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}if($===en){$=t$;ee=rI();if(ee===en){ee=null}et=rD();if(et===en){et=null}ei=rM();if(ei!==en){eo=rD();if(eo!==en){es=rv();if(es!==en){eu=rD();if(eu!==en){el=rF();if(el!==en){ef=rg();if(ef===en){ef=null}ed=t$;ep=rD();if(ep!==en){eh=rE();if(eh!==en){ey=rD();if(ey!==en){eg=rf();if(eg!==en){ep=[ep,eh,ey,eg];ed=ep}else{t$=ed;ed=en}}else{t$=ed;ed=en}}else{t$=ed;ed=en}}else{t$=ed;ed=en}if(ed===en){ed=null}tq=$;$=tS(ee,ei,el,ef,ed)}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}if($===en){$=t$;ee=rI();if(ee===en){ee=null}et=rD();if(et===en){et=null}ei=rM();if(ei!==en){eo=rp();if(eo===en){eo=null}tq=$;$=tT(ee,ei,eo)}else{t$=$;$=en}if($===en){$=t$;ee=rI();if(ee===en){ee=null}et=rD();if(et===en){et=null}ei=rp();if(ei!==en){tq=$;$=tO(ee,ei)}else{t$=$;$=en}if($===en){$=t$;ee=rI();if(ee===en){ee=null}et=rD();if(et===en){et=null}ei=rO();if(ei!==en){eo=rD();if(eo!==en){es=rA();if(es===en){es=null}eu=rW();if(eu!==en){tq=$;$=tA(ee,es,eu)}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}if($===en){$=t$;ee=rI();if(ee===en){ee=null}et=rD();if(et===en){et=null}ei=rN();if(ei!==en){tq=$;$=tI(ee,ei)}else{t$=$;$=en}}}}}}}return $}function rf(){var ee,et,ei,eo;tZ++;ee=t$;if($.substr(t$,5).toLowerCase()===eu){et=$.substr(t$,5);t$+=5}else{et=en;if(tZ===0){ro(ej)}}if(et!==en){tq=ee;et=tN()}ee=et;if(ee===en){ee=t$;et=rk();if(et!==en){ei=rD();if(ei!==en){if($.substr(t$,6).toLowerCase()===el){eo=$.substr(t$,6);t$+=6}else{eo=en;if(tZ===0){ro(eW)}}if(eo!==en){tq=ee;ee=tD(et)}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}if(ee===en){ee=t$;if($.substr(t$,4).toLowerCase()===ef){et=$.substr(t$,4);t$+=4}else{et=en;if(tZ===0){ro(eH)}}if(et!==en){tq=ee;et=tR()}ee=et;if(ee===en){ee=t$;et=rk();if(et!==en){ei=rD();if(ei!==en){if($.substr(t$,5).toLowerCase()===ed){eo=$.substr(t$,5);t$+=5}else{eo=en;if(tZ===0){ro(ez)}}if(eo!==en){tq=ee;ee=tC(et)}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}}}tZ--;if(ee===en){et=en;if(tZ===0){ro(eU)}}return ee}function rp(){var ee,et,ei,eo,es,eu,el;ee=t$;et=rD();if(et===en){et=null}ei=rT();if(ei!==en){eo=rD();if(eo!==en){es=rM();if(es!==en){eu=rD();if(eu!==en){if($.substr(t$,4).toLowerCase()===ep){el=$.substr(t$,4);t$+=4}else{el=en;if(tZ===0){ro(eV)}}if(el!==en){tq=ee;ee=tk(es)}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}if(ee===en){ee=t$;et=rD();if(et===en){et=null}ei=rT();if(ei!==en){eo=rD();if(eo!==en){es=rM();if(es!==en){tq=ee;ee=tM(es)}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}return ee}function rh(){var ee,et,ei,eo,es,eu,el;ee=t$;et=rL();if(et!==en){ei=rD();if(ei!==en){eo=rw();if(eo!==en){es=rD();if(es!==en){if($.substr(t$,8).toLowerCase()===eh){eu=$.substr(t$,8);t$+=8}else{eu=en;if(tZ===0){ro(e$)}}if(eu!==en){el=rD();if(el!==en){tq=ee;ee=tL(et)}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}if(ee===en){ee=t$;et=rL();if(et!==en){ei=rD();if(ei!==en){eo=rw();if(eo!==en){es=rD();if(es!==en){tq=ee;ee=tx(et)}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}return ee}function ry(){var $,ee,et,ei;$=t$;ee=rm();if(ee!==en){tq=$;ee=tP()}$=ee;if($===en){$=t$;ee=rC();if(ee!==en){et=rD();if(et!==en){ei=r_();if(ei!==en){tq=$;$=tF(ee)}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}return $}function rg(){var ee,et,ei,eo,es,eu,el;ee=t$;et=rD();if(et!==en){if($.substr(t$,5).toLowerCase()===ey){ei=$.substr(t$,5);t$+=5}else{ei=en;if(tZ===0){ro(eq)}}if(ei!==en){eo=rD();if(eo!==en){if($.substr(t$,4).toLowerCase()===eg){es=$.substr(t$,4);t$+=4}else{es=en;if(tZ===0){ro(eG)}}if(es!==en){eu=rD();if(eu!==en){el=rF();if(el!==en){tq=ee;ee=tB(el)}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}return ee}function rm(){var ee;if($.substr(t$,4).toLowerCase()===em){ee=$.substr(t$,4);t$+=4}else{ee=en;if(tZ===0){ro(eY)}}return ee}function r_(){var ee;if($.substr(t$,5).toLowerCase()===e_){ee=$.substr(t$,5);t$+=5}else{ee=en;if(tZ===0){ro(eK)}}return ee}function rv(){var ee;if($.substr(t$,2).toLowerCase()===ew){ee=$.substr(t$,2);t$+=2}else{ee=en;if(tZ===0){ro(eZ)}}return ee}function rw(){var ee;if($.substr(t$,2).toLowerCase()===eE){ee=$.substr(t$,2);t$+=2}else{ee=en;if(tZ===0){ro(eJ)}}return ee}function rE(){var ee,et,ei,eo;ee=t$;if($.substr(t$,6).toLowerCase()===eS){et=$.substr(t$,6);t$+=6}else{et=en;if(tZ===0){ro(eX)}}if(et!==en){ei=rD();if(ei!==en){if($.substr(t$,5).toLowerCase()===eT){eo=$.substr(t$,5);t$+=5}else{eo=en;if(tZ===0){ro(eQ)}}if(eo!==en){et=[et,ei,eo];ee=et}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}return ee}function rS(){var ee;if($.substr(t$,8).toLowerCase()===eO){ee=$.substr(t$,8);t$+=8}else{ee=en;if(tZ===0){ro(e0)}}return ee}function rT(){var ee,et,ei,eo;ee=t$;if($.substr(t$,2).toLowerCase()===eA){et=$.substr(t$,2);t$+=2}else{et=en;if(tZ===0){ro(e1)}}if(et!==en){ei=rD();if(ei!==en){if($.substr(t$,2).toLowerCase()===eI){eo=$.substr(t$,2);t$+=2}else{eo=en;if(tZ===0){ro(e2)}}if(eo!==en){et=[et,ei,eo];ee=et}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}return ee}function rO(){var ee;if($.substr(t$,8).toLowerCase()===eN){ee=$.substr(t$,8);t$+=8}else{ee=en;if(tZ===0){ro(e6)}}return ee}function rA(){var ee,et,ei;ee=t$;if($.substr(t$,4).toLowerCase()===eD){et=$.substr(t$,4);t$+=4}else{et=en;if(tZ===0){ro(e4)}}if(et!==en){ei=rD();if(ei!==en){tq=ee;ee=tU()}else{t$=ee;ee=en}}else{t$=ee;ee=en}return ee}function rI(){var ee,et,ei,eo;ee=t$;if($.substr(t$,1).toLowerCase()===eR){et=$.charAt(t$);t$++}else{et=en;if(tZ===0){ro(e3)}}if(et!==en){ei=rC();if(ei!==en){eo=rD();if(eo!==en){tq=ee;ee=tj(ei)}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}return ee}function rN(){var ee,et,ei,eo;ee=t$;if($.substr(t$,9).toLowerCase()===eC){et=$.substr(t$,9);t$+=9}else{et=en;if(tZ===0){ro(e8)}}if(et!==en){ei=rD();if(ei===en){ei=null}eo=rk();if(eo===en){eo=null}tq=ee;ee=tW(eo)}else{t$=ee;ee=en}return ee}function rD(){var ee,et;tZ++;ee=[];if($.charCodeAt(t$)===32){et=ek;t$++}else{et=en;if(tZ===0){ro(e9)}}if(et!==en){while(et!==en){ee.push(et);if($.charCodeAt(t$)===32){et=ek;t$++}else{et=en;if(tZ===0){ro(e9)}}}}else{ee=en}tZ--;if(ee===en){et=en;if(tZ===0){ro(e5)}}return ee}function rR(){var ee,et;tZ++;if(eP.test($.charAt(t$))){ee=$.charAt(t$);t$++}else{ee=en;if(tZ===0){ro(te)}}tZ--;if(ee===en){et=en;if(tZ===0){ro(e7)}}return ee}function rC(){var ee,et,ei;tZ++;ee=t$;et=[];ei=rR();if(ei!==en){while(ei!==en){et.push(ei);ei=rR()}}else{et=en}if(et!==en){ee=$.substring(ee,t$)}else{ee=et}tZ--;if(ee===en){et=en;if(tZ===0){ro(tt)}}return ee}function rk(){var ee,et,ei,eo,es;ee=t$;et=t$;if(eF.test($.charAt(t$))){ei=$.charAt(t$);t$++}else{ei=en;if(tZ===0){ro(tr)}}if(ei!==en){eo=[];if(eP.test($.charAt(t$))){es=$.charAt(t$);t$++}else{es=en;if(tZ===0){ro(te)}}while(es!==en){eo.push(es);if(eP.test($.charAt(t$))){es=$.charAt(t$);t$++}else{es=en;if(tZ===0){ro(te)}}}ei=[ei,eo];et=ei}else{t$=et;et=en}if(et!==en){ee=$.substring(ee,t$)}else{ee=et}return ee}function rM(){var ee,et,ei,eo,es,eu,el,ef,ed,ep,eh;tZ++;ee=t$;et=rj();if(et===en){et=null}ei=rD();if(ei===en){ei=null}eo=t$;es=t$;eu=[];el=rR();if(el!==en){while(el!==en){eu.push(el);el=rR()}}else{eu=en}if(eu!==en){el=t$;if($.charCodeAt(t$)===46){ef=eM;t$++}else{ef=en;if(tZ===0){ro(ti)}}if(ef!==en){ed=t$;ep=rR();if(ep!==en){eh=rR();if(eh===en){eh=null}ep=[ep,eh];ed=ep}else{t$=ed;ed=en}if(ed===en){ed=null}ef=[ef,ed];el=ef}else{t$=el;el=en}if(el===en){el=null}eu=[eu,el];es=eu}else{t$=es;es=en}if(es!==en){eo=$.substring(eo,t$)}else{eo=es}if(eo!==en){tq=ee;ee=tH(eo)}else{t$=ee;ee=en}tZ--;if(ee===en){et=en;if(tZ===0){ro(tn)}}return ee}function rL(){var ee,et,ei,eo;tZ++;ee=t$;et=t$;ei=[];eo=rR();if(eo!==en){while(eo!==en){ei.push(eo);eo=rR()}}else{ei=en}if(ei!==en){et=$.substring(et,t$)}else{et=ei}if(et!==en){ei=rD();if(ei===en){ei=null}if($.charCodeAt(t$)===37){eo=eL;t$++}else{eo=en;if(tZ===0){ro(tc)}}if(eo!==en){tq=ee;ee=tz(et)}else{t$=ee;ee=en}}else{t$=ee;ee=en}tZ--;if(ee===en){et=en;if(tZ===0){ro(tu)}}return ee}function rP(){var ee,et,ei,eo,es,eu;tZ++;ee=t$;et=t$;ei=rR();if(ei!==en){eo=rR();if(eo!==en){es=rR();if(es!==en){eu=rR();if(eu!==en){ei=[ei,eo,es,eu];et=ei}else{t$=et;et=en}}else{t$=et;et=en}}else{t$=et;et=en}}else{t$=et;et=en}if(et!==en){ee=$.substring(ee,t$)}else{ee=et}tZ--;if(ee===en){et=en;if(tZ===0){ro(tf)}}return ee}function rF(){var ee,et,ei,eo,es,eu;tZ++;ee=t$;et=t$;ei=rP();if(ei!==en){if($.charCodeAt(t$)===45){eo=eR;t$++}else{eo=en;if(tZ===0){ro(tp)}}if(eo!==en){es=rR();if(es!==en){eu=rR();if(eu!==en){ei=[ei,eo,es,eu];et=ei}else{t$=et;et=en}}else{t$=et;et=en}}else{t$=et;et=en}}else{t$=et;et=en}if(et!==en){ee=$.substring(ee,t$)}else{ee=et}tZ--;if(ee===en){et=en;if(tZ===0){ro(td)}}return ee}function rB(){var ee,et,ei,eo;tZ++;ee=t$;et=t$;ei=rR();if(ei!==en){eo=rR();if(eo!==en){ei=[ei,eo];et=ei}else{t$=et;et=en}}else{t$=et;et=en}if(et!==en){ee=$.substring(ee,t$)}else{ee=et}tZ--;if(ee===en){et=en;if(tZ===0){ro(th)}}return ee}function rU(){var ee,et,ei,eo,es;ee=t$;et=t$;ei=rF();if(ei!==en){if($.charCodeAt(t$)===45){eo=eR;t$++}else{eo=en;if(tZ===0){ro(tp)}}if(eo!==en){es=rB();if(es!==en){ei=[ei,eo,es];et=ei}else{t$=et;et=en}}else{t$=et;et=en}}else{t$=et;et=en}if(et!==en){ee=$.substring(ee,t$)}else{ee=et}return ee}function rj(){var ee,et,ei;tZ++;ee=t$;if($.length>t$){et=$.charAt(t$);t$++}else{et=en;if(tZ===0){ro(tm)}}if(et!==en){tq=t$;ei=tV(et);if(ei){ei=undefined}else{ei=en}if(ei!==en){et=[et,ei];ee=et}else{t$=ee;ee=en}}else{t$=ee;ee=en}tZ--;if(ee===en){et=en;if(tZ===0){ro(ty)}}return ee}function rW(){var ee,et,ei;tZ++;ee=t$;et=[];if(eB.test($.charAt(t$))){ei=$.charAt(t$);t$++}else{ei=en;if(tZ===0){ro(tv)}}if(ei!==en){while(ei!==en){et.push(ei);if(eB.test($.charAt(t$))){ei=$.charAt(t$);t$++}else{ei=en;if(tZ===0){ro(tv)}}}}else{et=en}if(et!==en){ee=$.substring(ee,t$)}else{ee=et}tZ--;if(ee===en){et=en;if(tZ===0){ro(t_)}}return ee}tJ=es();if(tJ!==en&&t$===$.length){return tJ}else{if(tJ!==en&&t$<$.length){ro(t7())}throw rl(tK,tY<$.length?$.charAt(tY):null,tY<$.length?ri(tY,tY+1):ri(tY,tY))}}return{SyntaxError:ee,parse:en}})},2074:()=>{},1214:()=>{},8119:()=>{},4654:()=>{},2361:()=>{},4616:()=>{},8441:()=>{},3083:($,ee,et)=>{"use strict";var en=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"];var ei=typeof globalThis==="undefined"?et.g:globalThis;$.exports=function $(){var $=[];for(var ee=0;ee<en.length;ee++){if(typeof ei[en[ee]]==="function"){$[$.length]=en[ee]}}return $}},3216:($,ee,et)=>{"use strict";var en=et(4155);var ei=et(2584);var eo=et(6373);if(et(1405)()||et(5419)()){var es=Symbol.iterator;$.exports=function $($){if($!=null&&typeof $[es]!=="undefined"){return $[es]()}if(ei($)){return Array.prototype[es].call($)}}}else{var eu=et(5826);var el=et(9981);var ef=et(210);var ed=ef("%Map%",true);var ep=ef("%Set%",true);var eh=et(1924);var ey=eh("Array.prototype.push");var eg=eh("String.prototype.charCodeAt");var em=eh("String.prototype.slice");var e_=function $($,ee){var et=$.length;if(ee+1>=et){return ee+1}var en=eg($,ee);if(en<55296||en>56319){return ee+1}var ei=eg($,ee+1);if(ei<56320||ei>57343){return ee+1}return ee+2};var ew=function $($){var ee=0;return{next:function et(){var et=ee>=$.length;var en;if(!et){en=$[ee];ee+=1}return{done:et,value:en}}}};var eE=function $($,ee){if(eu($)||ei($)){return ew($)}if(el($)){var et=0;return{next:function ee(){var ee=e_($,et);var en=em($,et,ee);et=ee;return{done:ee>$.length,value:en}}}}if(ee&&typeof $["_es6-shim iterator_"]!=="undefined"){return $["_es6-shim iterator_"]()}};if(!ed&&!ep){$.exports=function $($){if($!=null){return eE($,true)}}}else{var eS=et(8379);var eT=et(9572);var eO=eh("Map.prototype.forEach",true);var eA=eh("Set.prototype.forEach",true);if(typeof en==="undefined"||!en.versions||!en.versions.node){var eI=eh("Map.prototype.iterator",true);var eN=eh("Set.prototype.iterator",true)}var eD=eh("Map.prototype.@@iterator",true)||eh("Map.prototype._es6-shim iterator_",true);var eR=eh("Set.prototype.@@iterator",true)||eh("Set.prototype._es6-shim iterator_",true);var eC=function $($){if(eS($)){if(eI){return eo(eI($))}if(eD){return eD($)}if(eO){var ee=[];eO($,function($,et){ey(ee,[et,$])});return ew(ee)}}if(eT($)){if(eN){return eo(eN($))}if(eR){return eR($)}if(eA){var et=[];eA($,function($){ey(et,$)});return ew(et)}}};$.exports=function $($){return eC($)||eE($)}}}},3483:($,ee,et)=>{"use strict";var en=et(8379);var ei=et(9572);var eo=et(1718);var es=et(5899);$.exports=function $($){if($&&typeof $==="object"){if(en($)){return"Map"}if(ei($)){return"Set"}if(eo($)){return"WeakMap"}if(es($)){return"WeakSet"}}return false}}};var __webpack_module_cache__={};function __webpack_require__($){var ee=__webpack_module_cache__[$];if(ee!==undefined){return ee.exports}var et=__webpack_module_cache__[$]={id:$,loaded:false,exports:{}};__webpack_modules__[$].call(et.exports,et,et.exports,__webpack_require__);et.loaded=true;return et.exports}__webpack_require__.m=__webpack_modules__;(()=>{__webpack_require__.n=$=>{var ee=$&&$.__esModule?()=>$["default"]:()=>$;__webpack_require__.d(ee,{a:ee});return ee}})();(()=>{__webpack_require__.d=($,ee)=>{for(var et in ee){if(__webpack_require__.o(ee,et)&&!__webpack_require__.o($,et)){Object.defineProperty($,et,{enumerable:true,get:ee[et]})}}}})();(()=>{__webpack_require__.f={};__webpack_require__.e=$=>{return Promise.all(Object.keys(__webpack_require__.f).reduce((ee,et)=>{__webpack_require__.f[et]($,ee);return ee},[]))}})();(()=>{__webpack_require__.u=$=>{return""+$+"."+$+".kcab.worker."+"2ee5d7175d50b7896f28"+".js"}})();(()=>{__webpack_require__.g=function(){if(typeof globalThis==="object")return globalThis;try{return this||new Function("return this")()}catch($){if(typeof window==="object")return window}}()})();(()=>{__webpack_require__.o=($,ee)=>Object.prototype.hasOwnProperty.call($,ee)})();(()=>{__webpack_require__.r=$=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty($,Symbol.toStringTag,{value:"Module"})}Object.defineProperty($,"__esModule",{value:true})}})();(()=>{__webpack_require__.nmd=$=>{$.paths=[];if(!$.children)$.children=[];return $}})();(()=>{__webpack_require__.p="/kcab/"})();(()=>{var $={"main":1};var ee=ee=>{var[et,ei,eo]=ee;for(var es in ei){if(__webpack_require__.o(ei,es)){__webpack_require__.m[es]=ei[es]}}if(eo)eo(__webpack_require__);while(et.length)$[et.pop()]=1;en(ee)};__webpack_require__.f.i=(ee,et)=>{if(!$[ee]){if(true){importScripts(__webpack_require__.p+__webpack_require__.u(ee))}}};var et=self["webpackChunkbackend"]=self["webpackChunkbackend"]||[];var en=et.push.bind(et);et.push=ee})();var __webpack_exports__={};(()=>{"use strict";__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{handlers:()=>Er,init:()=>El,initApp:()=>Eu,lib:()=>Ec});var $={};__webpack_require__.r($);__webpack_require__.d($,{all:()=>f2,asyncTransaction:()=>f1,cache:()=>fX,closeDatabase:()=>f$,deleteAccount:()=>dL,deleteCategory:()=>dv,deleteCategoryGroup:()=>dy,deletePayee:()=>dS,deleteTransaction:()=>dW,deleteTransferPayee:()=>dT,delete_:()=>de,execQuery:()=>fZ,first:()=>f6,firstSync:()=>f4,fromDateRepr:()=>oY,getAccounts:()=>dC,getCategories:()=>du,getCategoriesGrouped:()=>dl,getDatabase:()=>fG,getDatabasePath:()=>fH,getOrphanedPayees:()=>dD,getPayee:()=>dw,getPayeeByName:()=>dR,getPayees:()=>dI,getTransaction:()=>dP,getTransactions:()=>dB,getTransactionsByDate:()=>dF,insert:()=>f7,insertAccount:()=>dk,insertCategory:()=>dg,insertCategoryGroup:()=>df,insertPayee:()=>dE,insertTransaction:()=>dU,insertWithSchema:()=>di,insertWithUUID:()=>f9,loadClock:()=>fY,mergePayees:()=>dA,moveAccount:()=>dx,moveCategory:()=>d_,moveCategoryGroup:()=>dh,openDatabase:()=>fz,reopenDatabase:()=>fV,run:()=>f3,runQuery:()=>fK,select:()=>f8,selectFirstWithSchema:()=>dn,selectWithSchema:()=>dr,setDatabase:()=>fq,syncGetOrphanedPayees:()=>dN,toDateRepr:()=>oG,transaction:()=>f0,update:()=>f5,updateAccount:()=>dM,updateCategory:()=>dm,updateCategoryGroup:()=>dp,updatePayee:()=>dO,updateTransaction:()=>dj,updateWithSchema:()=>ds});var ee={};__webpack_require__.r(ee);__webpack_require__.d(ee,{doImport:()=>wc,getBudgetName:()=>wf,parseFile:()=>wh});var et={};__webpack_require__.r(et);__webpack_require__.d(et,{doImport:()=>wE,getBudgetName:()=>wT,parseFile:()=>wS});var en;function ei($){en=$}var eo=__webpack_require__(8393);const es=typeof crypto!=="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const eu={randomUUID:es};let el;const ef=new Uint8Array(16);function ed(){if(!el){el=typeof crypto!=="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto);if(!el){throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}}return el(ef)};const ep=[];for(let $=0;$<256;++$){ep.push(($+256).toString(16).slice(1))}function eh($,ee=0){return(ep[$[ee+0]]+ep[$[ee+1]]+ep[$[ee+2]]+ep[$[ee+3]]+"-"+ep[$[ee+4]]+ep[$[ee+5]]+"-"+ep[$[ee+6]]+ep[$[ee+7]]+"-"+ep[$[ee+8]]+ep[$[ee+9]]+"-"+ep[$[ee+10]]+ep[$[ee+11]]+ep[$[ee+12]]+ep[$[ee+13]]+ep[$[ee+14]]+ep[$[ee+15]]).toLowerCase()}function ey($,ee=0){const et=eh($,ee);if(!validate(et)){throw TypeError("Stringified UUID is invalid")}return et}const eg=null&&ey;function em($,ee,et){if(eu.randomUUID&&!ee&&!$){return eu.randomUUID()}$=$||{};const en=$.random||($.rng||ed)();en[6]=en[6]&15|64;en[8]=en[8]&63|128;if(ee){et=et||0;for(let $=0;$<16;++$){ee[et+$]=en[$]}return ee}return eh(en)}const e_=em;function ew($){"@babel/helpers - typeof";return ew="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function($){return typeof $}:function($){return $&&"function"==typeof Symbol&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},ew($)};function eE($,ee){if(ee.length<$){throw new TypeError($+" argument"+($>1?"s":"")+" required, but only "+ee.length+" present")}};function eS($){eE(1,arguments);var ee=Object.prototype.toString.call($);if($ instanceof Date||ew($)==="object"&&ee==="[object Date]"){return new Date($.getTime())}else if(typeof $==="number"||ee==="[object Number]"){return new Date($)}else{if((typeof $==="string"||ee==="[object String]")&&typeof console!=="undefined"){console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");console.warn(new Error().stack)}return new Date(NaN)}};function eT($){eE(1,arguments);var ee;if($&&typeof $.forEach==="function"){ee=$}else if(ew($)==="object"&&$!==null){ee=Array.prototype.slice.call($)}else{return new Date(NaN)}var et;ee.forEach(function($){var ee=eS($);if(et===undefined||et<ee||isNaN(Number(ee))){et=ee}});return et||new Date(NaN)};function eO($){eE(1,arguments);return $ instanceof Date||ew($)==="object"&&Object.prototype.toString.call($)==="[object Date]"};function eA($){eE(1,arguments);if(!eO($)&&typeof $!=="number"){return false}var ee=eS($);return!isNaN(Number(ee))};function eI($){if($===null||$===true||$===false){return NaN}var ee=Number($);if(isNaN(ee)){return ee}return ee<0?Math.ceil(ee):Math.floor(ee)};function eN($,ee){eE(2,arguments);var et=eS($).getTime();var en=eI(ee);return new Date(et+en)};function eD($,ee){eE(2,arguments);var et=eI(ee);return eN($,-et)};var eR=864e5;function eC($){eE(1,arguments);var ee=eS($);var et=ee.getTime();ee.setUTCMonth(0,1);ee.setUTCHours(0,0,0,0);var en=ee.getTime();var ei=et-en;return Math.floor(ei/eR)+1};function ek($){eE(1,arguments);var ee=1;var et=eS($);var en=et.getUTCDay();var ei=(en<ee?7:0)+en-ee;et.setUTCDate(et.getUTCDate()-ei);et.setUTCHours(0,0,0,0);return et};function eM($){eE(1,arguments);var ee=eS($);var et=ee.getUTCFullYear();var en=new Date(0);en.setUTCFullYear(et+1,0,4);en.setUTCHours(0,0,0,0);var ei=ek(en);var eo=new Date(0);eo.setUTCFullYear(et,0,4);eo.setUTCHours(0,0,0,0);var es=ek(eo);if(ee.getTime()>=ei.getTime()){return et+1}else if(ee.getTime()>=es.getTime()){return et}else{return et-1}};function eL($){eE(1,arguments);var ee=eM($);var et=new Date(0);et.setUTCFullYear(ee,0,4);et.setUTCHours(0,0,0,0);var en=ek(et);return en};var eP=6048e5;function eF($){eE(1,arguments);var ee=eS($);var et=ek(ee).getTime()-eL(ee).getTime();return Math.round(et/eP)+1};var eB={};function eU(){return eB}function ej($){eB=$};function eW($,ee){var et,en,ei,eo,es,eu,el,ef;eE(1,arguments);var ed=eU();var ep=eI((et=(en=(ei=(eo=ee===null||ee===void 0?void 0:ee.weekStartsOn)!==null&&eo!==void 0?eo:ee===null||ee===void 0?void 0:(es=ee.locale)===null||es===void 0?void 0:(eu=es.options)===null||eu===void 0?void 0:eu.weekStartsOn)!==null&&ei!==void 0?ei:ed.weekStartsOn)!==null&&en!==void 0?en:(el=ed.locale)===null||el===void 0?void 0:(ef=el.options)===null||ef===void 0?void 0:ef.weekStartsOn)!==null&&et!==void 0?et:0);if(!(ep>=0&&ep<=6)){throw new RangeError("weekStartsOn must be between 0 and 6 inclusively")}var eh=eS($);var ey=eh.getUTCDay();var eg=(ey<ep?7:0)+ey-ep;eh.setUTCDate(eh.getUTCDate()-eg);eh.setUTCHours(0,0,0,0);return eh};function eH($,ee){var et,en,ei,eo,es,eu,el,ef;eE(1,arguments);var ed=eS($);var ep=ed.getUTCFullYear();var eh=eU();var ey=eI((et=(en=(ei=(eo=ee===null||ee===void 0?void 0:ee.firstWeekContainsDate)!==null&&eo!==void 0?eo:ee===null||ee===void 0?void 0:(es=ee.locale)===null||es===void 0?void 0:(eu=es.options)===null||eu===void 0?void 0:eu.firstWeekContainsDate)!==null&&ei!==void 0?ei:eh.firstWeekContainsDate)!==null&&en!==void 0?en:(el=eh.locale)===null||el===void 0?void 0:(ef=el.options)===null||ef===void 0?void 0:ef.firstWeekContainsDate)!==null&&et!==void 0?et:1);if(!(ey>=1&&ey<=7)){throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively")}var eg=new Date(0);eg.setUTCFullYear(ep+1,0,ey);eg.setUTCHours(0,0,0,0);var em=eW(eg,ee);var e_=new Date(0);e_.setUTCFullYear(ep,0,ey);e_.setUTCHours(0,0,0,0);var ew=eW(e_,ee);if(ed.getTime()>=em.getTime()){return ep+1}else if(ed.getTime()>=ew.getTime()){return ep}else{return ep-1}};function ez($,ee){var et,en,ei,eo,es,eu,el,ef;eE(1,arguments);var ed=eU();var ep=eI((et=(en=(ei=(eo=ee===null||ee===void 0?void 0:ee.firstWeekContainsDate)!==null&&eo!==void 0?eo:ee===null||ee===void 0?void 0:(es=ee.locale)===null||es===void 0?void 0:(eu=es.options)===null||eu===void 0?void 0:eu.firstWeekContainsDate)!==null&&ei!==void 0?ei:ed.firstWeekContainsDate)!==null&&en!==void 0?en:(el=ed.locale)===null||el===void 0?void 0:(ef=el.options)===null||ef===void 0?void 0:ef.firstWeekContainsDate)!==null&&et!==void 0?et:1);var eh=eH($,ee);var ey=new Date(0);ey.setUTCFullYear(eh,0,ep);ey.setUTCHours(0,0,0,0);var eg=eW(ey,ee);return eg};var eV=6048e5;function e$($,ee){eE(1,arguments);var et=eS($);var en=eW(et,ee).getTime()-ez(et,ee).getTime();return Math.round(en/eV)+1};function eq($,ee){var et=$<0?"-":"";var en=Math.abs($).toString();while(en.length<ee){en="0"+en}return et+en};var eG={y:function $($,ee){var et=$.getUTCFullYear();var en=et>0?et:1-et;return eq(ee==="yy"?en%100:en,ee.length)},M:function $($,ee){var et=$.getUTCMonth();return ee==="M"?String(et+1):eq(et+1,2)},d:function $($,ee){return eq($.getUTCDate(),ee.length)},a:function $($,ee){var et=$.getUTCHours()/12>=1?"pm":"am";switch(ee){case"a":case"aa":return et.toUpperCase();case"aaa":return et;case"aaaaa":return et[0];case"aaaa":default:return et==="am"?"a.m.":"p.m."}},h:function $($,ee){return eq($.getUTCHours()%12||12,ee.length)},H:function $($,ee){return eq($.getUTCHours(),ee.length)},m:function $($,ee){return eq($.getUTCMinutes(),ee.length)},s:function $($,ee){return eq($.getUTCSeconds(),ee.length)},S:function $($,ee){var et=ee.length;var en=$.getUTCMilliseconds();var ei=Math.floor(en*Math.pow(10,et-3));return eq(ei,ee.length)}};const eY=eG;var eK={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"};var eZ={G:function $($,ee,et){var en=$.getUTCFullYear()>0?1:0;switch(ee){case"G":case"GG":case"GGG":return et.era(en,{width:"abbreviated"});case"GGGGG":return et.era(en,{width:"narrow"});case"GGGG":default:return et.era(en,{width:"wide"})}},y:function $($,ee,et){if(ee==="yo"){var en=$.getUTCFullYear();var ei=en>0?en:1-en;return et.ordinalNumber(ei,{unit:"year"})}return eY.y($,ee)},Y:function $($,ee,et,en){var ei=eH($,en);var eo=ei>0?ei:1-ei;if(ee==="YY"){var es=eo%100;return eq(es,2)}if(ee==="Yo"){return et.ordinalNumber(eo,{unit:"year"})}return eq(eo,ee.length)},R:function $($,ee){var et=eM($);return eq(et,ee.length)},u:function $($,ee){var et=$.getUTCFullYear();return eq(et,ee.length)},Q:function $($,ee,et){var en=Math.ceil(($.getUTCMonth()+1)/3);switch(ee){case"Q":return String(en);case"QQ":return eq(en,2);case"Qo":return et.ordinalNumber(en,{unit:"quarter"});case"QQQ":return et.quarter(en,{width:"abbreviated",context:"formatting"});case"QQQQQ":return et.quarter(en,{width:"narrow",context:"formatting"});case"QQQQ":default:return et.quarter(en,{width:"wide",context:"formatting"})}},q:function $($,ee,et){var en=Math.ceil(($.getUTCMonth()+1)/3);switch(ee){case"q":return String(en);case"qq":return eq(en,2);case"qo":return et.ordinalNumber(en,{unit:"quarter"});case"qqq":return et.quarter(en,{width:"abbreviated",context:"standalone"});case"qqqqq":return et.quarter(en,{width:"narrow",context:"standalone"});case"qqqq":default:return et.quarter(en,{width:"wide",context:"standalone"})}},M:function $($,ee,et){var en=$.getUTCMonth();switch(ee){case"M":case"MM":return eY.M($,ee);case"Mo":return et.ordinalNumber(en+1,{unit:"month"});case"MMM":return et.month(en,{width:"abbreviated",context:"formatting"});case"MMMMM":return et.month(en,{width:"narrow",context:"formatting"});case"MMMM":default:return et.month(en,{width:"wide",context:"formatting"})}},L:function $($,ee,et){var en=$.getUTCMonth();switch(ee){case"L":return String(en+1);case"LL":return eq(en+1,2);case"Lo":return et.ordinalNumber(en+1,{unit:"month"});case"LLL":return et.month(en,{width:"abbreviated",context:"standalone"});case"LLLLL":return et.month(en,{width:"narrow",context:"standalone"});case"LLLL":default:return et.month(en,{width:"wide",context:"standalone"})}},w:function $($,ee,et,en){var ei=e$($,en);if(ee==="wo"){return et.ordinalNumber(ei,{unit:"week"})}return eq(ei,ee.length)},I:function $($,ee,et){var en=eF($);if(ee==="Io"){return et.ordinalNumber(en,{unit:"week"})}return eq(en,ee.length)},d:function $($,ee,et){if(ee==="do"){return et.ordinalNumber($.getUTCDate(),{unit:"date"})}return eY.d($,ee)},D:function $($,ee,et){var en=eC($);if(ee==="Do"){return et.ordinalNumber(en,{unit:"dayOfYear"})}return eq(en,ee.length)},E:function $($,ee,et){var en=$.getUTCDay();switch(ee){case"E":case"EE":case"EEE":return et.day(en,{width:"abbreviated",context:"formatting"});case"EEEEE":return et.day(en,{width:"narrow",context:"formatting"});case"EEEEEE":return et.day(en,{width:"short",context:"formatting"});case"EEEE":default:return et.day(en,{width:"wide",context:"formatting"})}},e:function $($,ee,et,en){var ei=$.getUTCDay();var eo=(ei-en.weekStartsOn+8)%7||7;switch(ee){case"e":return String(eo);case"ee":return eq(eo,2);case"eo":return et.ordinalNumber(eo,{unit:"day"});case"eee":return et.day(ei,{width:"abbreviated",context:"formatting"});case"eeeee":return et.day(ei,{width:"narrow",context:"formatting"});case"eeeeee":return et.day(ei,{width:"short",context:"formatting"});case"eeee":default:return et.day(ei,{width:"wide",context:"formatting"})}},c:function $($,ee,et,en){var ei=$.getUTCDay();var eo=(ei-en.weekStartsOn+8)%7||7;switch(ee){case"c":return String(eo);case"cc":return eq(eo,ee.length);case"co":return et.ordinalNumber(eo,{unit:"day"});case"ccc":return et.day(ei,{width:"abbreviated",context:"standalone"});case"ccccc":return et.day(ei,{width:"narrow",context:"standalone"});case"cccccc":return et.day(ei,{width:"short",context:"standalone"});case"cccc":default:return et.day(ei,{width:"wide",context:"standalone"})}},i:function $($,ee,et){var en=$.getUTCDay();var ei=en===0?7:en;switch(ee){case"i":return String(ei);case"ii":return eq(ei,ee.length);case"io":return et.ordinalNumber(ei,{unit:"day"});case"iii":return et.day(en,{width:"abbreviated",context:"formatting"});case"iiiii":return et.day(en,{width:"narrow",context:"formatting"});case"iiiiii":return et.day(en,{width:"short",context:"formatting"});case"iiii":default:return et.day(en,{width:"wide",context:"formatting"})}},a:function $($,ee,et){var en=$.getUTCHours();var ei=en/12>=1?"pm":"am";switch(ee){case"a":case"aa":return et.dayPeriod(ei,{width:"abbreviated",context:"formatting"});case"aaa":return et.dayPeriod(ei,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return et.dayPeriod(ei,{width:"narrow",context:"formatting"});case"aaaa":default:return et.dayPeriod(ei,{width:"wide",context:"formatting"})}},b:function $($,ee,et){var en=$.getUTCHours();var ei;if(en===12){ei=eK.noon}else if(en===0){ei=eK.midnight}else{ei=en/12>=1?"pm":"am"}switch(ee){case"b":case"bb":return et.dayPeriod(ei,{width:"abbreviated",context:"formatting"});case"bbb":return et.dayPeriod(ei,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return et.dayPeriod(ei,{width:"narrow",context:"formatting"});case"bbbb":default:return et.dayPeriod(ei,{width:"wide",context:"formatting"})}},B:function $($,ee,et){var en=$.getUTCHours();var ei;if(en>=17){ei=eK.evening}else if(en>=12){ei=eK.afternoon}else if(en>=4){ei=eK.morning}else{ei=eK.night}switch(ee){case"B":case"BB":case"BBB":return et.dayPeriod(ei,{width:"abbreviated",context:"formatting"});case"BBBBB":return et.dayPeriod(ei,{width:"narrow",context:"formatting"});case"BBBB":default:return et.dayPeriod(ei,{width:"wide",context:"formatting"})}},h:function $($,ee,et){if(ee==="ho"){var en=$.getUTCHours()%12;if(en===0)en=12;return et.ordinalNumber(en,{unit:"hour"})}return eY.h($,ee)},H:function $($,ee,et){if(ee==="Ho"){return et.ordinalNumber($.getUTCHours(),{unit:"hour"})}return eY.H($,ee)},K:function $($,ee,et){var en=$.getUTCHours()%12;if(ee==="Ko"){return et.ordinalNumber(en,{unit:"hour"})}return eq(en,ee.length)},k:function $($,ee,et){var en=$.getUTCHours();if(en===0)en=24;if(ee==="ko"){return et.ordinalNumber(en,{unit:"hour"})}return eq(en,ee.length)},m:function $($,ee,et){if(ee==="mo"){return et.ordinalNumber($.getUTCMinutes(),{unit:"minute"})}return eY.m($,ee)},s:function $($,ee,et){if(ee==="so"){return et.ordinalNumber($.getUTCSeconds(),{unit:"second"})}return eY.s($,ee)},S:function $($,ee){return eY.S($,ee)},X:function $($,ee,et,en){var ei=en._originalDate||$;var eo=ei.getTimezoneOffset();if(eo===0){return"Z"}switch(ee){case"X":return eX(eo);case"XXXX":case"XX":return eQ(eo);case"XXXXX":case"XXX":default:return eQ(eo,":")}},x:function $($,ee,et,en){var ei=en._originalDate||$;var eo=ei.getTimezoneOffset();switch(ee){case"x":return eX(eo);case"xxxx":case"xx":return eQ(eo);case"xxxxx":case"xxx":default:return eQ(eo,":")}},O:function $($,ee,et,en){var ei=en._originalDate||$;var eo=ei.getTimezoneOffset();switch(ee){case"O":case"OO":case"OOO":return"GMT"+eJ(eo,":");case"OOOO":default:return"GMT"+eQ(eo,":")}},z:function $($,ee,et,en){var ei=en._originalDate||$;var eo=ei.getTimezoneOffset();switch(ee){case"z":case"zz":case"zzz":return"GMT"+eJ(eo,":");case"zzzz":default:return"GMT"+eQ(eo,":")}},t:function $($,ee,et,en){var ei=en._originalDate||$;var eo=Math.floor(ei.getTime()/1e3);return eq(eo,ee.length)},T:function $($,ee,et,en){var ei=en._originalDate||$;var eo=ei.getTime();return eq(eo,ee.length)}};function eJ($,ee){var et=$>0?"-":"+";var en=Math.abs($);var ei=Math.floor(en/60);var eo=en%60;if(eo===0){return et+String(ei)}var es=ee||"";return et+String(ei)+es+eq(eo,2)}function eX($,ee){if($%60===0){var et=$>0?"-":"+";return et+eq(Math.abs($)/60,2)}return eQ($,ee)}function eQ($,ee){var et=ee||"";var en=$>0?"-":"+";var ei=Math.abs($);var eo=eq(Math.floor(ei/60),2);var es=eq(ei%60,2);return en+eo+et+es}const e0=eZ;var e1=function $($,ee){switch($){case"P":return ee.date({width:"short"});case"PP":return ee.date({width:"medium"});case"PPP":return ee.date({width:"long"});case"PPPP":default:return ee.date({width:"full"})}};var e2=function $($,ee){switch($){case"p":return ee.time({width:"short"});case"pp":return ee.time({width:"medium"});case"ppp":return ee.time({width:"long"});case"pppp":default:return ee.time({width:"full"})}};var e6=function $($,ee){var et=$.match(/(P+)(p+)?/)||[];var en=et[1];var ei=et[2];if(!ei){return e1($,ee)}var eo;switch(en){case"P":eo=ee.dateTime({width:"short"});break;case"PP":eo=ee.dateTime({width:"medium"});break;case"PPP":eo=ee.dateTime({width:"long"});break;case"PPPP":default:eo=ee.dateTime({width:"full"});break}return eo.replace("{{date}}",e1(en,ee)).replace("{{time}}",e2(ei,ee))};var e4={p:e2,P:e6};const e3=e4;function e8($){var ee=new Date(Date.UTC($.getFullYear(),$.getMonth(),$.getDate(),$.getHours(),$.getMinutes(),$.getSeconds(),$.getMilliseconds()));ee.setUTCFullYear($.getFullYear());return $.getTime()-ee.getTime()};var e5=["D","DD"];var e9=["YY","YYYY"];function e7($){return e5.indexOf($)!==-1}function te($){return e9.indexOf($)!==-1}function tt($,ee,et){if($==="YYYY"){throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(ee,"`) for formatting years to the input `").concat(et,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}else if($==="YY"){throw new RangeError("Use `yy` instead of `YY` (in `".concat(ee,"`) for formatting years to the input `").concat(et,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}else if($==="D"){throw new RangeError("Use `d` instead of `D` (in `".concat(ee,"`) for formatting days of the month to the input `").concat(et,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}else if($==="DD"){throw new RangeError("Use `dd` instead of `DD` (in `".concat(ee,"`) for formatting days of the month to the input `").concat(et,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}};var tr={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"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},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"}};var tn=function $($,ee,et){var en;var ei=tr[$];if(typeof ei==="string"){en=ei}else if(ee===1){en=ei.one}else{en=ei.other.replace("{{count}}",ee.toString())}if(et!==null&&et!==void 0&&et.addSuffix){if(et.comparison&&et.comparison>0){return"in "+en}else{return en+" ago"}}return en};const ti=tn;function tu($){return function(){var ee=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var et=ee.width?String(ee.width):$.defaultWidth;var en=$.formats[et]||$.formats[$.defaultWidth];return en}};var tc={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"};var tf={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"};var td={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"};var tp={date:tu({formats:tc,defaultWidth:"full"}),time:tu({formats:tf,defaultWidth:"full"}),dateTime:tu({formats:td,defaultWidth:"full"})};const th=tp;var ty={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};var tm=function $($,ee,et,en){return ty[$]};const t_=tm;function tv($){return function(ee,et){var en=et!==null&&et!==void 0&&et.context?String(et.context):"standalone";var ei;if(en==="formatting"&&$.formattingValues){var eo=$.defaultFormattingWidth||$.defaultWidth;var es=et!==null&&et!==void 0&&et.width?String(et.width):eo;ei=$.formattingValues[es]||$.formattingValues[eo]}else{var eu=$.defaultWidth;var el=et!==null&&et!==void 0&&et.width?String(et.width):$.defaultWidth;ei=$.values[el]||$.values[eu]}var ef=$.argumentCallback?$.argumentCallback(ee):ee;return ei[ef]}};var tw={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]};var tE={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]};var tS={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"]};var tT={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"]};var tO={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"}};var tA={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"}};var tI=function $($,ee){var et=Number($);var en=et%100;if(en>20||en<10){switch(en%10){case 1:return et+"st";case 2:return et+"nd";case 3:return et+"rd"}}return et+"th"};var tN={ordinalNumber:tI,era:tv({values:tw,defaultWidth:"wide"}),quarter:tv({values:tE,defaultWidth:"wide",argumentCallback:function $($){return $-1}}),month:tv({values:tS,defaultWidth:"wide"}),day:tv({values:tT,defaultWidth:"wide"}),dayPeriod:tv({values:tO,defaultWidth:"wide",formattingValues:tA,defaultFormattingWidth:"wide"})};const tD=tN;function tR($){return function(ee){var et=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var en=et.width;var ei=en&&$.matchPatterns[en]||$.matchPatterns[$.defaultMatchWidth];var eo=ee.match(ei);if(!eo){return null}var es=eo[0];var eu=en&&$.parsePatterns[en]||$.parsePatterns[$.defaultParseWidth];var el=Array.isArray(eu)?tk(eu,function($){return $.test(es)}):tC(eu,function($){return $.test(es)});var ef;ef=$.valueCallback?$.valueCallback(el):el;ef=et.valueCallback?et.valueCallback(ef):ef;var ed=ee.slice(es.length);return{value:ef,rest:ed}}}function tC($,ee){for(var et in $){if($.hasOwnProperty(et)&&ee($[et])){return et}}return undefined}function tk($,ee){for(var et=0;et<$.length;et++){if(ee($[et])){return et}}return undefined};function tM($){return function(ee){var et=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var en=ee.match($.matchPattern);if(!en)return null;var ei=en[0];var eo=ee.match($.parsePattern);if(!eo)return null;var es=$.valueCallback?$.valueCallback(eo[0]):eo[0];es=et.valueCallback?et.valueCallback(es):es;var eu=ee.slice(ei.length);return{value:es,rest:eu}}};var tL=/^(\d+)(th|st|nd|rd)?/i;var tx=/\d+/i;var tP={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};var tF={any:[/^b/i,/^(a|c)/i]};var tB={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i};var tU={any:[/1/i,/2/i,/3/i,/4/i]};var tj={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};var tW={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]};var tH={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};var tz={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]};var tV={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};var t$={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}};var tq={ordinalNumber:tM({matchPattern:tL,parsePattern:tx,valueCallback:function $($){return parseInt($,10)}}),era:tR({matchPatterns:tP,defaultMatchWidth:"wide",parsePatterns:tF,defaultParseWidth:"any"}),quarter:tR({matchPatterns:tB,defaultMatchWidth:"wide",parsePatterns:tU,defaultParseWidth:"any",valueCallback:function $($){return $+1}}),month:tR({matchPatterns:tj,defaultMatchWidth:"wide",parsePatterns:tW,defaultParseWidth:"any"}),day:tR({matchPatterns:tH,defaultMatchWidth:"wide",parsePatterns:tz,defaultParseWidth:"any"}),dayPeriod:tR({matchPatterns:tV,defaultMatchWidth:"any",parsePatterns:t$,defaultParseWidth:"any"})};const tG=tq;var tY={code:"en-US",formatDistance:ti,formatLong:th,formatRelative:t_,localize:tD,match:tG,options:{weekStartsOn:0,firstWeekContainsDate:1}};const tK=tY;const tZ=tK;var tJ=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;var tX=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;var tQ=/^'([^]*?)'?$/;var t0=/''/g;var t6=/[a-zA-Z]/;function t4($,ee,et){var en,ei,eo,es,eu,el,ef,ed,ep,eh,ey,eg,em,e_,ew,eT,eO,eN;eE(2,arguments);var eR=String(ee);var eC=eU();var ek=(en=(ei=et===null||et===void 0?void 0:et.locale)!==null&&ei!==void 0?ei:eC.locale)!==null&&en!==void 0?en:tZ;var eM=eI((eo=(es=(eu=(el=et===null||et===void 0?void 0:et.firstWeekContainsDate)!==null&&el!==void 0?el:et===null||et===void 0?void 0:(ef=et.locale)===null||ef===void 0?void 0:(ed=ef.options)===null||ed===void 0?void 0:ed.firstWeekContainsDate)!==null&&eu!==void 0?eu:eC.firstWeekContainsDate)!==null&&es!==void 0?es:(ep=eC.locale)===null||ep===void 0?void 0:(eh=ep.options)===null||eh===void 0?void 0:eh.firstWeekContainsDate)!==null&&eo!==void 0?eo:1);if(!(eM>=1&&eM<=7)){throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively")}var eL=eI((ey=(eg=(em=(e_=et===null||et===void 0?void 0:et.weekStartsOn)!==null&&e_!==void 0?e_:et===null||et===void 0?void 0:(ew=et.locale)===null||ew===void 0?void 0:(eT=ew.options)===null||eT===void 0?void 0:eT.weekStartsOn)!==null&&em!==void 0?em:eC.weekStartsOn)!==null&&eg!==void 0?eg:(eO=eC.locale)===null||eO===void 0?void 0:(eN=eO.options)===null||eN===void 0?void 0:eN.weekStartsOn)!==null&&ey!==void 0?ey:0);if(!(eL>=0&&eL<=6)){throw new RangeError("weekStartsOn must be between 0 and 6 inclusively")}if(!ek.localize){throw new RangeError("locale must contain localize property")}if(!ek.formatLong){throw new RangeError("locale must contain formatLong property")}var eP=eS($);if(!eA(eP)){throw new RangeError("Invalid time value")}var eF=e8(eP);var eB=eD(eP,eF);var ej={firstWeekContainsDate:eM,weekStartsOn:eL,locale:ek,_originalDate:eP};var eW=eR.match(tX).map(function($){var ee=$[0];if(ee==="p"||ee==="P"){var et=e3[ee];return et($,ek.formatLong)}return $}).join("").match(tJ).map(function(en){if(en==="''"){return"'"}var ei=en[0];if(ei==="'"){return t3(en)}var eo=e0[ei];if(eo){if(!(et!==null&&et!==void 0&&et.useAdditionalWeekYearTokens)&&te(en)){tt(en,ee,String($))}if(!(et!==null&&et!==void 0&&et.useAdditionalDayOfYearTokens)&&e7(en)){tt(en,ee,String($))}return eo(eB,en,ek.localize,ej)}if(ei.match(t6)){throw new RangeError("Format string contains an unescaped latin alphabet character `"+ei+"`")}return en}).join("");return eW}function t3($){var ee=$.match(tQ);if(!ee){return $}return ee[1].replace(t0,"'")};var t8=7;var t5=365.2425;var t9=Math.pow(10,8)*24*60*60*1e3;var t7=6e4;var rr=36e5;var rn=1e3;var ri=-t9;var ro=60;var ru=3;var rl=12;var rc=4;var rf=3600;var rp=60;var rh=rf*24;var ry=rh*7;var rg=rh*t5;var rm=rg/12;var r_=rm*3;function rv($,ee){var et;eE(1,arguments);var en=eI((et=ee===null||ee===void 0?void 0:ee.additionalDigits)!==null&&et!==void 0?et:2);if(en!==2&&en!==1&&en!==0){throw new RangeError("additionalDigits must be 0, 1 or 2")}if(!(typeof $==="string"||Object.prototype.toString.call($)==="[object String]")){return new Date(NaN)}var ei=rO($);var eo;if(ei.date){var es=rA(ei.date,en);eo=rI(es.restDateString,es.year)}if(!eo||isNaN(eo.getTime())){return new Date(NaN)}var eu=eo.getTime();var el=0;var ef;if(ei.time){el=rD(ei.time);if(isNaN(el)){return new Date(NaN)}}if(ei.timezone){ef=rC(ei.timezone);if(isNaN(ef)){return new Date(NaN)}}else{var ed=new Date(eu+el);var ep=new Date(0);ep.setFullYear(ed.getUTCFullYear(),ed.getUTCMonth(),ed.getUTCDate());ep.setHours(ed.getUTCHours(),ed.getUTCMinutes(),ed.getUTCSeconds(),ed.getUTCMilliseconds());return ep}return new Date(eu+el+ef)}var rw={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/};var rE=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;var rS=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;var rT=/^([+-])(\d{2})(?::?(\d{2}))?$/;function rO($){var ee={};var et=$.split(rw.dateTimeDelimiter);var en;if(et.length>2){return ee}if(/:/.test(et[0])){en=et[0]}else{ee.date=et[0];en=et[1];if(rw.timeZoneDelimiter.test(ee.date)){ee.date=$.split(rw.timeZoneDelimiter)[0];en=$.substr(ee.date.length,$.length)}}if(en){var ei=rw.timezone.exec(en);if(ei){ee.time=en.replace(ei[1],"");ee.timezone=ei[1]}else{ee.time=en}}return ee}function rA($,ee){var et=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+ee)+"})|(\\d{2}|[+-]\\d{"+(2+ee)+"})$)");var en=$.match(et);if(!en)return{year:NaN,restDateString:""};var ei=en[1]?parseInt(en[1]):null;var eo=en[2]?parseInt(en[2]):null;return{year:eo===null?ei:eo*100,restDateString:$.slice((en[1]||en[2]).length)}}function rI($,ee){if(ee===null)return new Date(NaN);var et=$.match(rE);if(!et)return new Date(NaN);var en=!!et[4];var ei=rN(et[1]);var eo=rN(et[2])-1;var es=rN(et[3]);var eu=rN(et[4]);var el=rN(et[5])-1;if(en){if(!rB(ee,eu,el)){return new Date(NaN)}return rk(ee,eu,el)}else{var ef=new Date(0);if(!rP(ee,eo,es)||!rF(ee,ei)){return new Date(NaN)}ef.setUTCFullYear(ee,eo,Math.max(ei,es));return ef}}function rN($){return $?parseInt($):1}function rD($){var ee=$.match(rS);if(!ee)return NaN;var et=rR(ee[1]);var en=rR(ee[2]);var ei=rR(ee[3]);if(!rU(et,en,ei)){return NaN}return et*rr+en*t7+ei*1e3}function rR($){return $&&parseFloat($.replace(",","."))||0}function rC($){if($==="Z")return 0;var ee=$.match(rT);if(!ee)return 0;var et=ee[1]==="+"?-1:1;var en=parseInt(ee[2]);var ei=ee[3]&&parseInt(ee[3])||0;if(!rj(en,ei)){return NaN}return et*(en*rr+ei*t7)}function rk($,ee,et){var en=new Date(0);en.setUTCFullYear($,0,4);var ei=en.getUTCDay()||7;var eo=(ee-1)*7+et+1-ei;en.setUTCDate(en.getUTCDate()+eo);return en}var rM=[31,null,31,30,31,30,31,31,30,31,30,31];function rL($){return $%400===0||$%4===0&&$%100!==0}function rP($,ee,et){return ee>=0&&ee<=11&&et>=1&&et<=(rM[ee]||(rL($)?29:28))}function rF($,ee){return ee>=1&&ee<=(rL($)?366:365)}function rB($,ee,et){return ee>=1&&ee<=53&&et>=0&&et<=6}function rU($,ee,et){if($===24){return ee===0&&et===0}return et>=0&&et<60&&ee>=0&&ee<60&&$>=0&&$<25}function rj($,ee){return ee>=0&&ee<=59};let rW=rH();function rH(){return new Promise(($,ee)=>{let et=9;let en=indexedDB.open("actual",et);en.onupgradeneeded=function($){let ee=$.target.result;if(ee.objectStoreNames.contains("filesystem")){ee.deleteObjectStore("filesystem",{keyPath:"filepath"})}if(ee.objectStoreNames.contains("messages")){ee.deleteObjectStore("messages",{keyPath:"filepath"})}if(!ee.objectStoreNames.contains("asyncStorage")){ee.createObjectStore("asyncStorage")}if(!ee.objectStoreNames.contains("files")){ee.createObjectStore("files",{keyPath:"filepath"})}};en.onblocked=$=>console.log("blocked",$);en.onerror=$=>{console.log("openRequest error");ee(new Error("indexeddb-failure: Could not open IndexedDB"))};en.onsuccess=function(ee){let et=ee.target.result;et.onversionchange=()=>{et.close()};et.onerror=function($){console.log("Database error: "+($.target&&$.target.error));if($.target&&$.target.error){let ee=$.target.error;if(ee.name==="QuotaExceededError"){throw new Error("indexeddb-quota-error")}}};$(et)}})}const rz=function($,ee){let et=$.transaction([ee],"readwrite");return{trans:et,store:et.objectStore(ee)}};const rV=async function($,ee,et=$=>$){return new Promise((en,ei)=>{let eo=$.get(ee);eo.onsuccess=$=>{en(et(eo.result))};eo.onerror=$=>ei($)})};const r$=async function($,ee){return new Promise((et,en)=>{let ei=$.put(ee);ei.onsuccess=$=>et(undefined);ei.onerror=$=>en($)})};const rq=async function($,ee){return new Promise((et,en)=>{let ei=$.delete(ee);ei.onsuccess=$=>et(undefined);ei.onerror=$=>en($)})};const rG=function(){return rW};const rY=function(){if(rW==null){rW=rH()}return rW};const rK=function(){if(rW){rW.then($=>{$.close()});rW=null}};const rZ=function(){};function rJ($){if($.commit){$.commit()}}const rX=async function($){let ee=await rG();let et=ee.transaction(["asyncStorage"],"readonly");let en=et.objectStore("asyncStorage");return new Promise((ee,ei)=>{let eo=en.get($);eo.onerror=$=>ei($);eo.onsuccess=$=>ee($.target.result);rJ(et)})};const rQ=async function($,ee){let et=await rG();let en=et.transaction(["asyncStorage"],"readwrite");let ei=en.objectStore("asyncStorage");new Promise((et,eo)=>{let es=ei.put(ee,$);es.onerror=$=>eo($);es.onsuccess=$=>et(undefined);rJ(en)})};const r0=async function($){let ee=await rG();let et=ee.transaction(["asyncStorage"],"readwrite");let en=et.objectStore("asyncStorage");return new Promise((ee,ei)=>{let eo=en.delete($);eo.onerror=$=>ei($);eo.onsuccess=$=>ee(undefined);rJ(et)})};const r6=async function($){let ee=await rG();let et=ee.transaction(["asyncStorage"],"readonly");let en=et.objectStore("asyncStorage");let ei=Promise.all($.map($=>{return new Promise((ee,et)=>{let ei=en.get($);ei.onerror=$=>et($);ei.onsuccess=et=>ee([$,et.target.result])})}));rJ(et);return ei};const r4=async function($){let ee=await getDatabase();let et=ee.transaction(["asyncStorage"],"readwrite");let en=et.objectStore("asyncStorage");let ei=Promise.all($.map(([$,ee])=>{return new Promise((et,ei)=>{let eo=en.put(ee,$);eo.onerror=$=>ei($);eo.onsuccess=$=>et(undefined)})}));rJ(et);return ei};const r3=async function($){let ee=await rG();let et=ee.transaction(["asyncStorage"],"readwrite");let en=et.objectStore("asyncStorage");let ei=Promise.all($.map($=>{return new Promise((ee,et)=>{let ei=en.delete($);ei.onerror=$=>et($);ei.onsuccess=$=>ee(undefined)})}));rJ(et);return ei};function r8($,ee){eE(2,arguments);var et=eS($);var en=eI(ee);if(isNaN(en)){return new Date(NaN)}if(!en){return et}var ei=et.getDate();var eo=new Date(et.getTime());eo.setMonth(et.getMonth()+en+1,0);var es=eo.getDate();if(ei>=es){return eo}else{et.setFullYear(eo.getFullYear(),eo.getMonth(),ei);return et}};function r5($,ee){eE(2,arguments);var et=eI(ee);return r8($,-et)};function r9($,ee){eE(2,arguments);var et=eS($);var en=eI(ee);if(isNaN(en)){return new Date(NaN)}if(!en){return et}et.setDate(et.getDate()+en);return et};function r7($,ee){eE(2,arguments);var et=eI(ee);var en=et*7;return r9($,en)};function ne($,ee){eE(2,arguments);var et=eS($);var en=eS(ee);var ei=et.getFullYear()-en.getFullYear();var eo=et.getMonth()-en.getMonth();return ei*12+eo};function nt($,ee){eE(2,arguments);var et=eI(ee);return r9($,-et)};function nn($,ee){eE(2,arguments);var et=eS($);var en=eS(ee);return et.getTime()<en.getTime()};function ni($,ee){eE(2,arguments);var et=eS($);var en=eS(ee);return et.getTime()>en.getTime()};function no($){eE(1,arguments);var ee=eS($);ee.setDate(1);ee.setHours(0,0,0,0);return ee};function ns($){eE(1,arguments);var ee=eS($);var et=ee.getMonth();ee.setFullYear(ee.getFullYear(),et+1,0);ee.setHours(23,59,59,999);return ee};var nu=Number.isNaN||function $($){return typeof $==="number"&&$!==$};function nc($,ee){if($===ee){return true}if(nu($)&&nu(ee)){return true}return false}function nf($,ee){if($.length!==ee.length){return false}for(var et=0;et<$.length;et++){if(!nc($[et],ee[et])){return false}}return true}function nh($,ee){if(ee===void 0){ee=nf}var et=null;function en(){var en=[];for(var ei=0;ei<arguments.length;ei++){en[ei]=arguments[ei]}if(et&&et.lastThis===this&&ee(en,et.lastArgs)){return et.lastResult}var eo=$.apply(this,en);et={lastResult:eo,lastArgs:en,lastThis:this};return eo}en.clear=function $(){et=null};return en};const ny=navigator.platform&&navigator.platform.toLowerCase()==="win32";const ng=navigator.platform&&navigator.platform.toUpperCase().indexOf("MAC")>=0;const nm=navigator.userAgent==="playwright";const n_=null&&(ny?"windows":ng?"mac":"linux");const nw="web";const nE=true;function nS($){if(typeof $==="string"){let[ee,et,en]=$.split("-");if(en!=null){return new Date(parseInt(ee),parseInt(et)-1,parseInt(en),12)}else if(et!=null){return new Date(parseInt(ee),parseInt(et)-1,1,12)}else{return new Date(parseInt(ee),0,1,12)}}if(typeof $==="number"){return new Date($)}return $}const nT=nS;function nO($){return t4(nS($),"yyyy")}function nA($){return t4(nS($),"yyyy-MM")}function nI($){return t4(nS($),"yyyy-MM-dd")}function nN(){if(__webpack_require__.g.IS_TESTING||nm){return __webpack_require__.g.currentMonth||"2017-01"}else{return t4(new Date,"yyyy-MM")}}function nD(){if(__webpack_require__.g.IS_TESTING||Platform.isPlaywright){return d.parse(nR(),"yyyy-MM-dd",new Date)}return new Date}function nR(){if(__webpack_require__.g.IS_TESTING||nm){return"2017-01-01"}else{return t4(new Date,"yyyy-MM-dd")}}function nC($){return d.format(d.addMonths(nS($),1),"yyyy-MM")}function nk($){return t4(r5(nS($),1),"yyyy-MM")}function nM($,ee){return t4(r8(nS($),ee),"yyyy-MM")}function nL($,ee){return t4(r7(nS($),ee),"yyyy-MM-dd")}function nx($,ee){return ne(nS($),nS(ee))}function nP($,ee){return t4(r5(nS($),ee),"yyyy-MM")}function nF($,ee){return t4(r9(nS($),ee),"yyyy-MM-dd")}function nB($,ee){return t4(nt(nS($),ee),"yyyy-MM-dd")}function nU($,ee){return nn(nS($),nS(ee))}function nj($,ee){return ni(nS($),nS(ee))}function nW($){return{start:parseInt(t4(no(nS($)),"yyyyMMdd")),end:parseInt(t4(ns(nS($)),"yyyyMMdd"))}}function nH($,ee,et=false){const en=[];let ei=nA($);while(nn(nS(ei),nS(ee))){en.push(ei);ei=nM(ei,1)}if(et){en.push(ei)}return en}function nz($,ee){return nH($,ee)}function nV($,ee){return nH($,ee,true)}function n$($,ee,et=false){const en=[];let ei=$;while(d.isBefore(nS(ei),nS(ee))){en.push(ei);ei=nF(ei,1)}if(et){en.push(ei)}return en}function nq($,ee){return n$($,ee)}function nG($,ee){return n$($,ee,true)}function nY($){return parseInt($.slice(5,7))-1}function nK($){return $.slice(0,4)}function nZ($){return $.slice(0,7)}function nJ($){return nK($)+"-01"}function nX($){return nK($)+"-12"}function nQ($){return"budget"+$.replace("-","")}function n0($){return d.format(nS($),"MMMM 'yy")}function n1($,ee){return t4(nS($),ee)}const n2=nh($=>{return new RegExp($.replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{4}"))});const n6=nh($=>{return $.replace(/y+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"")});const n4=nh($=>{let ee=$.replace(/y+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}");return new RegExp("^"+ee+"$")});const n3=nh($=>{return $.replace(/d+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/\/\//,"/").replace(/\.\./,".").replace(/--/,"-")});const n8=nh($=>{let ee=$.replace(/d+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/\/\//,"/").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{2,4}");return new RegExp("^"+ee+"$")});const n5=nh($=>{return $.replace(/y+/g,"yy")});const n9=nh($=>{let ee=$.replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{2}");return new RegExp("^"+ee+"$")});function n7($){return $[$.length-1]}function ie($,ee){const et=$.id?{id:$.id}:{};const en=Object.keys(ee);let ei=false;for(let eo=0;eo<en.length;eo++){let es=en[eo];if($[es]!==ee[es]){et[es]=ee[es];ei=true}}return ei?et:null}function it($,ee,et){let en=false;for(let ei=0;ei<et.length;ei++){let eo=et[ei];if($[eo]!==ee[eo]){en=true;break}}return en}function ir($,ee){ee=[...ee];if($.added){$.added.forEach($=>{ee.push($)})}if($.updated){$.updated.forEach(({id:$,...et})=>{const en=ee.findIndex(ee=>ee.id===$);ee[en]={...ee[en],...et}})}if($.deleted){$.deleted.forEach($=>{const et=ee.findIndex(ee=>$.id===ee.id);if(et!==-1){ee.splice(et,1)}})}return ee}function ii($,ee){let et=new Map;for(let en=0;en<$.length;en++){let ei=$[en];let eo=ei[ee];let es=et.get(eo)||[];es.push(ei);et.set(eo,es)}return et}function io($,ee){let et=new Map;for(let en=0;en<$.length;en++){let ei=$[en];let eo=ei[ee];let es=et.get(eo)||[];et.set(eo,es.concat([ei]))}return et}function iu($){let ee=new Map;for(let et=0;et<$.length;et++){let en=$[et];ee.set(en.id,en)}return ee}function ip($,ee){let et=iu($);let en=iu(ee);let ei=[];let eo=[];let es=$.filter($=>!en.has($.id)).map($=>({id:$.id}));ee.forEach($=>{let ee=et.get($.id);if(!ee){ei.push($)}else{const et=ie(ee,$);if(et){eo.push(et)}}});return{added:ei,updated:eo,deleted:es}}function ih($){let ee={};for(let et=0;et<$.length;et++){let en=$[et];ee[en.id]=en}return ee}function iy($,ee,et){for(let en=0;en<ee.length;en++){const ei=ee[en];if(en===ee.length-1){$.set(ei,et)}else{if(!$.has(ei)){$.set(ei,new Map)}$=$.get(ei)}}}function ig($,ee){let et=$;for(let $=0;$<ee.length;$++){et=et.get(ee[$]);if(et==null){return et}}return et}function im($,ee){let et=new Set($);let en=ee.values();let ei=en.next();while(!ei.done){et.add(ei.value);ei=en.next()}return et}function i_($){return $[0].toUpperCase()+$.slice(1)}const iw=[{value:"comma-dot",label:"1,000.33",labelNoFraction:"1,000"},{value:"dot-comma",label:"1.000,33",labelNoFraction:"1.000"},{value:"space-comma",label:"1 000,33",labelNoFraction:"1 000"},{value:"space-dot",label:"1 000.33",labelNoFraction:"1 000"},{value:"comma-dot-in",label:"1,00,000.33",labelNoFraction:"1,00,000"}];let iE={format:"comma-dot",hideFraction:false};function iS($){iE=$}function iT({format:$,hideFraction:ee}=iE){let et,en,ei;switch($){case"space-comma":et="en-ZA";en=/[^-0-9,]/g;ei=",";break;case"dot-comma":et="de-DE";en=/[^-0-9,]/g;ei=",";break;case"space-dot":et="dje";en=/[^-0-9.]/g;ei=".";break;case"comma-dot-in":et="en-IN";en=/[^-0-9.]/g;ei=".";break;case"comma-dot":default:et="en-US";en=/[^-0-9.]/g;ei="."}return{value:$,separator:ei,formatter:new Intl.NumberFormat(et,{minimumFractionDigits:ee?0:2,maximumFractionDigits:ee?0:2}),regex:en}}const iO=2**51-1;const iI=-iO;function iN($){if(!Number.isInteger($)){throw new Error("safeNumber: number is not an integer: "+JSON.stringify($))}if($>iO||$<iI){throw new Error("safeNumber: can’t safely perform arithmetic with number: "+$)}return $}function iD($){return iP(iM($)||0)}function iR($,ee=iT().formatter){return ee.format(iN($)/100)}function iC($){return iT().formatter.format($)}function ik($){let ee=parseFloat($.replace(iT().regex,"").replace(iT().separator,"."));return isNaN(ee)?null:ee}function iM($){let ee=ik($);return ee==null?null:ix(ee)}function iL($){let ee=parseInt($.replace(/[^-0-9.,]/g,""));if(!isNaN(ee)){return ee}return null}function ix($){return Math.round($*100)}function iP($){return parseFloat((iN($)/100).toFixed(2))}function iF($){function ee($){return isNaN($)?null:$}function et($){return $.replace(/[^0-9-]/g,"")}if($.startsWith("(")&&$.endsWith(")")){$=$.replace("(","-").replace(")","")}let en=$.match(/[.,][^.,]*$/);if(!en||en.index===0){return ee(parseFloat(et($)))}let ei=et($.slice(0,en.index));let eo=et($.slice(en.index+1));return ee(parseFloat(ei+"."+eo))}function iU($,ee){return[...$].sort(($,et)=>{if($[ee]<et[ee]){return-1}else if($[ee]>et[ee]){return 1}return 0})};function ij($){return $.indexOf("preview/")!==-1}function iW($){return typeof $==="number"?$:0}function iH($,ee){let et=iW(ee.amount)-$;return{type:"SplitTransactionError",version:1,difference:et}}function iz($,ee){let et=$.id==="temp"?"temp":"";return{amount:0,...ee,payee:ee.payee||$.payee,id:ee.id?ee.id:et+e_(),account:$.account,date:$.date,cleared:$.cleared!=null?$.cleared:null,starting_balance_flag:$.starting_balance_flag!=null?$.starting_balance_flag:null,is_child:true,parent_id:$.id,error:null}}function iV($){const ee=$.subtransactions.reduce(($,ee)=>$+iW(ee.amount),0);return{...$,error:ee===iW($.amount)?null:iH(ee,$)}}function i$($,ee){while(ee>=0){let et=$[ee];if(et.is_parent){return ee}ee--}return null}function iq($,ee){let et=[$[ee]];let en=ee+1;while(en<$.length&&$[en].is_child){et.push($[en]);en++}return et}function iG($){let ee=$.reduce(($,ee)=>{let{subtransactions:et,...en}=ee;et=et||[];$.push(en);for(let ee=0;ee<et.length;ee++){$.push(et[ee])}return $},[]);return ee}function iY($){return{...$[0],subtransactions:$.slice(1)}}function iK($){if($==null){return null}return iG([$])}function iZ($,ee){return iY(applyChanges(ee,iK($)))}function iJ($,ee,et){let en=$.findIndex($=>$.id===ee);let ei=$[en];let eo=[...$];if(en===-1){throw new Error("Tried to edit unknown transaction id: "+ee)}if(ei.is_parent||ei.is_child){let ee=i$($,en);if(ee==null){console.log("Cannot find parent index");return{diff:{deleted:[],updated:[]}}}let ei=iq($,ee);let es=et(iY(ei));let eu=iK(es);let el;if(eu==null){el={deleted:[{id:ei[0].id}],updated:[]};es={id:ei[0].id,_deleted:true};eo.splice(ee,ei.length)}else{el=ip(ei,eu);eo.splice(ee,ei.length,...eu)}return{data:eo,newTransaction:es,diff:el}}else{let $=et(ei);let ee=iK($)||[];if($){$.subtransactions=$.subtransactions||[]}eo.splice(en,1,...ee);return{data:eo,newTransaction:$||{id:ei.id,_deleted:true},diff:ip([ei],ee)}}}function iX($,ee){return iJ($,ee,$=>{if(!$.is_parent){return $}let ee=last($.subtransactions);$.subtransactions.push(iz($,{amount:0,sort_order:iW(ee&&ee.sort_order)-1}));return $})}function iQ($,ee){return iJ($,ee.id,$=>{if($.is_parent){let et=$.id===ee.id?ee:$;let en=$.subtransactions.map(en=>{let ei=en;if($.id===ee.id){ei={...en,payee:en.payee===$.payee?ee.payee:en.payee}}else if(en.id===ee.id){ei=ee}return iz(et,ei)});return iV({...et,subtransactions:en})}else{return ee}})}function i0($,ee){return iJ($,ee,$=>{if($.is_parent){if($.id===ee){return null}else if($.subtransactions.length===1){return{...$,subtransactions:null,is_parent:false,error:null}}else{let et=$.subtransactions.filter($=>$.id!==ee);return iV({...$,subtransactions:et})}}else{return null}})}function i1($,ee){return iJ($,ee,$=>{if($.is_parent||$.is_child){return $}return{...$,is_parent:true,error:iW($.amount)===0?null:iH(0,$),subtransactions:[iz($,{amount:0,sort_order:-1})]}})}function i2($){let ee=$.find($=>!$.is_child);ee={...ee,id:uuidv4()};let et=$.filter($=>$.is_child);return[ee,...et.map($=>({...$,id:uuidv4(),parent_id:ee.id}))]}var i6=__webpack_require__(9593);var i4=__webpack_require__.n(i6);const i3={EPERM:63,ENOENT:44};class i8{constructor($,ee){this.FS=$;this.backend=ee;this.node_ops={getattr:ee=>{let et=$.isFile(ee.mode)?ee.contents.getattr():null;let en={};en.dev=1;en.ino=ee.id;en.mode=et?et.mode:ee.mode;en.nlink=1;en.uid=0;en.gid=0;en.rdev=ee.rdev;en.size=et?et.size:$.isDir(ee.mode)?4096:0;en.atime=new Date(0);en.mtime=new Date(0);en.ctime=new Date(0);en.blksize=et?et.blockSize:4096;en.blocks=Math.ceil(en.size/en.blksize);return en},setattr:($,ee)=>{if(this.FS.isFile($.mode)){$.contents.setattr(ee)}else{if(ee.mode!=null){$.mode=ee.mode}if(ee.size!=null){$.size=ee.size}}},lookup:($,ee)=>{throw new this.FS.ErrnoError(i3.ENOENT)},mknod:($,ee,et,en)=>{if(ee.endsWith(".lock")){throw new Error("Locking via lockfiles is not supported")}return this.createNode($,ee,et,en)},rename:($,ee,et)=>{throw new Error("rename not implemented")},unlink:($,ee)=>{let et=this.FS.lookupNode($,ee);et.contents.delete(ee)},readdir:$=>{throw new Error("readdir not implemented")},symlink:($,ee,et)=>{throw new Error("symlink not implemented")},readlink:$=>{throw new Error("symlink not implemented")}};this.stream_ops={open:$=>{if(this.FS.isFile($.node.mode)){$.node.contents.open()}},close:$=>{if(this.FS.isFile($.node.mode)){$.node.contents.close()}},read:($,ee,et,en,ei)=>{return $.node.contents.read(ee,et,en,ei)},write:($,ee,et,en,ei)=>{return $.node.contents.write(ee,et,en,ei)},llseek:(ee,et,en)=>{var ei=et;if(en===1){ei+=ee.position}else if(en===2){if($.isFile(ee.node.mode)){ei+=ee.node.contents.getattr().size}}if(ei<0){throw new this.FS.ErrnoError(28)}return ei},allocate:($,ee,et)=>{$.node.contents.setattr({size:ee+et})},mmap:($,ee,et,en,ei,eo)=>{throw new Error("mmap not implemented")},msync:($,ee,et,en,ei)=>{throw new Error("msync not implemented")},fsync:($,ee,et,en,ei)=>{$.node.contents.fsync()}}}mount(){return this.createNode(null,"/",16384|511,0)}lock($,ee){let{node:et}=this.FS.lookupPath($);if(et&&et.contents){return et.contents.lock(ee)}return true}unlock($,ee){let{node:et}=this.FS.lookupPath($);if(et&&et.contents){return et.contents.unlock(ee)}return true}createNode($,ee,et,en){if(!(this.FS.isDir(et)||this.FS.isFile(et))){throw new this.FS.ErrnoError(i3.EPERM)}var ei=this.FS.createNode($,ee,et,en);if(this.FS.isDir(ei.mode)){ei.node_ops={mknod:this.node_ops.mknod,lookup:this.node_ops.lookup,unlink:this.node_ops.unlink,setattr:this.node_ops.setattr};ei.stream_ops={};ei.contents={}}else if(this.FS.isFile(ei.mode)){ei.node_ops=this.node_ops;ei.stream_ops=this.stream_ops;ei.contents=this.backend.createFile(ee)}if($){$.contents[ee]=ei;$.timestamp=ei.timestamp}return ei}}const i5=i8;let i9={NONE:0,SHARED:1,RESERVED:2,PENDING:3,EXCLUSIVE:4};function i7($){let ee=$[16];let et=$[17];return(ee<<8)+et}function ae($,ee){if($!=null&&ee!=null){let et=new Uint8Array($);let en=new Uint8Array(ee);for(let $=24;$<40;$++){if(et[$]!==en[$]){return false}}return true}return $==null&&ee==null}function at($,ee,et){let en=[];for(let ei=$;ei<=ee;ei+=et){en.push(ei)}return en}function an($,ee,et){let en=ee-ee%$;let ei=et-1-(et-1)%$;return at(en,ei,$)}function ao($,ee,et){let en=new ArrayBuffer(et-ee);let ei=new Uint8Array(en);for(let en=0;en<$.length;en++){let eo=$[en];if(eo.data.constructor.name!=="ArrayBuffer"){throw new Error("Chunk data is not an ArrayBuffer")}let es=0;let eu=eo.data.byteLength;if(ee>eo.pos){es=ee-eo.pos}if(et<eo.pos+eo.data.byteLength){eu=et-eo.pos}if(es>eo.data.byteLength||eu<0){continue}let el=eu-es;ei.set(new Uint8Array(eo.data,es,el),eo.pos-ee+es)}return en}function au($,ee,et,en){let ei=an(ee,et,en);let eo=0;return ei.map(ei=>{let es=0;let eu=ee;if(et>ei&&et<ei+ee){es=et-ei}if(en>ei&&en<ei+ee){eu=en-ei}let el=eu-es;let ef=new ArrayBuffer(ee);if(et>ei+ee||en<=ei){return null}let ed=$.byteOffset+eo;let ep=$.buffer.byteLength-ed;if(ep<=0){return null}let eh=Math.min(el,ep);new Uint8Array(ef).set(new Uint8Array($.buffer,ed,eh),es);eo+=eh;return{pos:ei,data:ef,offset:es,length:eh}}).filter(Boolean)}class al{constructor($,ee,et=null){this.filename=$;this.buffer=new Map;this.ops=ee;this.meta=et;this._metaDirty=false;this.writeLock=false;this.openHandles=0}bufferChunks($){for(let ee=0;ee<$.length;ee++){let et=$[ee];this.buffer.set(et.pos,et)}}open(){this.openHandles++;if(this.openHandles===1){this.ops.open();let $=this.ops.readMeta();if(this.meta==null){if($==null){$={size:0}}this.meta=$}}return this.meta}close(){this.fsync();this.openHandles=Math.max(this.openHandles-1,0);if(this.openHandles===0){this.ops.close()}}delete(){this.ops.delete()}load($){let ee=$.reduce(($,ee)=>{let et=this.buffer.get(ee);if(et){$.chunks.push(et)}else{$.missing.push(ee)}return $},{chunks:[],missing:[]});let et=[];if(ee.missing.length>0){et=this.ops.readBlocks(ee.missing,this.meta.blockSize)}return ee.chunks.concat(et)}read($,ee,et,en){let ei=$.buffer;if(et<=0){return 0}if(en<0){return 0}if(en>=this.meta.size){let $=new Uint8Array(ei,ee);for(let ee=0;ee<et;ee++){$[ee]=0}return et}en=Math.max(en,0);let eo=Math.min(et,this.meta.size-en);let es=en;let eu=en+eo;let el=an(this.meta.blockSize,es,eu);let ef=this.load(el);let ed=ao(ef,es,eu);if(ei.byteLength-ee<ed.byteLength){throw new Error("Buffer given to `read` is too small")}let ep=new Uint8Array(ei);ep.set(new Uint8Array(ed),ee);for(let $=eo;$<et;$++){ep[ee+$]=0}return et}write($,ee,et,en){if(this.meta.blockSize==null){let et=i7(new Uint8Array($.buffer,$.byteOffset+ee));if(![512,1024,2048,4096,8192,16384,32768,65536].includes(et)){throw new Error("File has invalid page size. (the first block of a new file must be written first)")}this.setattr({blockSize:et})}let ei=$.buffer;if(et<=0){return 0}if(en<0){return 0}if(ei.byteLength===0){return 0}et=Math.min(et,ei.byteLength-ee);let eo=au(new Uint8Array(ei,ee,et),this.meta.blockSize,en,en+et);let{partialWrites:es,fullWrites:eu}=eo.reduce(($,ee)=>{if(ee.length!==this.meta.blockSize){$.partialWrites.push(ee)}else{$.fullWrites.push({pos:ee.pos,data:ee.data})}return $},{fullWrites:[],partialWrites:[]});let el=[];if(es.length>0){el=this.load(es.map($=>$.pos))}let ef=eu.concat(el.map($=>{let ee=es.find(ee=>ee.pos===$.pos);new Uint8Array($.data).set(new Uint8Array(ee.data,ee.offset,ee.length),ee.offset,ee.length);return $}));this.bufferChunks(ef);if(en+et>this.meta.size){this.setattr({size:en+et})}return et}async readIfFallback(){if(this.ops.readIfFallback){let $=await this.ops.readIfFallback();this.meta=$||{size:0}}}lock($){if(!this._recordingLock){this._recordingLock=true}if(this.ops.lock($)){if($>=i9.RESERVED){this.writeLock=true}return true}return false}unlock($){if($===0){this._recordingLock=false}if(this.writeLock){this.fsync();this.writeLock=false}return this.ops.unlock($)}fsync(){if(this.buffer.size>0){let $=this.buffer.get(0);if($){let ee=i7(new Uint8Array($.data));if(ee!==this.meta.blockSize){let $=this.buffer;this.buffer=new Map;let et=[...$.values()];let en=et.length*this.meta.blockSize;let ei=new ArrayBuffer(en);let eo=new Uint8Array(ei);for(let $ of et){eo.set(new Uint8Array($.data),$.pos)}this.bufferChunks(au(eo,ee,0,en));this.setattr({blockSize:ee})}}this.ops.writeBlocks([...this.buffer.values()],this.meta.blockSize)}if(this._metaDirty){this.ops.writeMeta({size:this.meta.size});this._metaDirty=false}this.buffer=new Map}setattr($){if(this.meta==null){this.meta={}}if($.mode!==undefined){this.meta.mode=$.mode}if($.blockSize!==undefined){this.meta.blockSize=$.blockSize}if($.size!==undefined){this.meta.size=$.size;this._metaDirty=true}}getattr(){return this.meta}}let af=3735928559;let ad=0;let ap=1;class ah{constructor($,{initialOffset:ee=4,useAtomics:et=true,stream:en=true,debug:ei,name:eo}={}){this.buffer=$;this.atomicView=new Int32Array($);this.offset=ee;this.useAtomics=et;this.stream=en;this.debug=ei;this.name=eo}log(...$){if(this.debug){console.log(`[reader: ${this.name}]`,...$)}}waitWrite($,ee=null){if(this.useAtomics){this.log(`waiting for ${$}`);while(Atomics.load(this.atomicView,0)===ad){if(ee!=null){if(Atomics.wait(this.atomicView,0,ad,ee)==="timed-out"){throw new Error("timeout")}}Atomics.wait(this.atomicView,0,ad,500)}this.log(`resumed for ${$}`)}else{if(this.atomicView[0]!==ap){throw new Error("`waitWrite` expected array to be readable")}}}flip(){this.log("flip");if(this.useAtomics){let $=Atomics.compareExchange(this.atomicView,0,ap,ad);if($!==ap){throw new Error("Read data out of sync! This is disastrous")}Atomics.notify(this.atomicView,0)}else{this.atomicView[0]=ad}this.offset=4}done(){this.waitWrite("done");let $=new DataView(this.buffer,this.offset);let ee=$.getUint32(0)===af;if(ee){this.log("done");this.flip()}return ee}peek($){this.peekOffset=this.offset;let ee=$();this.offset=this.peekOffset;this.peekOffset=null;return ee}string($){this.waitWrite("string",$);let ee=this._int32();let et=ee/2;let en=new DataView(this.buffer,this.offset,ee);let ei=[];for(let $=0;$<et;$++){ei.push(en.getUint16($*2))}let eo=String.fromCharCode.apply(null,ei);this.log("string",eo);this.offset+=ee;if(this.peekOffset==null){this.flip()}return eo}_int32(){let $=4;let ee=new DataView(this.buffer,this.offset);let et=ee.getInt32();this.log("_int32",et);this.offset+=$;return et}int32(){this.waitWrite("int32");let $=this._int32();this.log("int32",$);if(this.peekOffset==null){this.flip()}return $}bytes(){this.waitWrite("bytes");let $=this._int32();let ee=new ArrayBuffer($);new Uint8Array(ee).set(new Uint8Array(this.buffer,this.offset,$));this.log("bytes",ee);this.offset+=$;if(this.peekOffset==null){this.flip()}return ee}}class ay{constructor($,{initialOffset:ee=4,useAtomics:et=true,stream:en=true,debug:ei,name:eo}={}){this.buffer=$;this.atomicView=new Int32Array($);this.offset=ee;this.useAtomics=et;this.stream=en;this.debug=ei;this.name=eo;if(this.useAtomics){Atomics.store(this.atomicView,0,ad)}else{this.atomicView[0]=ad}}log(...$){if(this.debug){console.log(`[writer: ${this.name}]`,...$)}}waitRead($){if(this.useAtomics){this.log(`waiting for ${$}`);let ee=Atomics.compareExchange(this.atomicView,0,ad,ap);if(ee!==ad){throw new Error("Wrote something into unwritable buffer! This is disastrous")}Atomics.notify(this.atomicView,0);while(Atomics.load(this.atomicView,0)===ap){Atomics.wait(this.atomicView,0,ap,500)}this.log(`resumed for ${$}`)}else{this.atomicView[0]=ap}this.offset=4}finalize(){this.log("finalizing");let $=new DataView(this.buffer,this.offset);$.setUint32(0,af);this.waitRead("finalize")}string($){this.log("string",$);let ee=$.length*2;this._int32(ee);let et=new DataView(this.buffer,this.offset,ee);for(let ee=0;ee<$.length;ee++){et.setUint16(ee*2,$.charCodeAt(ee))}this.offset+=ee;this.waitRead("string")}_int32($){let ee=4;let et=new DataView(this.buffer,this.offset);et.setInt32(0,$);this.offset+=ee}int32($){this.log("int32",$);this._int32($);this.waitRead("int32")}bytes($){this.log("bytes",$);let ee=$.byteLength;this._int32(ee);new Uint8Array(this.buffer,this.offset).set(new Uint8Array($));this.offset+=ee;this.waitRead("bytes")}}function ag($,ee){return Math.round($/ee)}function am($,ee){self.postMessage({type:"__absurd:spawn-idb-worker",argBuffer:ee.buffer,resultBuffer:$.buffer});self.addEventListener("message",et=>{switch(et.data.type){case"__perf-deets:start-profile":ee.string("profile-start");ee.finalize();$.int32();$.done();break;case"__perf-deets:stop-profile":ee.string("profile-stop");ee.finalize();$.int32();$.done();break}})}class a_{constructor($){this.filename=$}getStoreName(){return this.filename.replace(/\//g,"-")}invokeWorker($,ee){if(this.reader==null||this.writer==null){throw new Error(`Attempted ${$} on ${this.filename} but file not open`)}let et=this.reader;let en=this.writer;switch($){case"readBlocks":{let{name:$,positions:ei,blockSize:eo}=ee;let es=[];for(let ee of ei){en.string("readBlock");en.string($);en.int32(ag(ee,eo));en.finalize();let ei=et.bytes();et.done();es.push({pos:ee,data:ei.byteLength===0?new ArrayBuffer(eo):ei})}return es}case"writeBlocks":{let{name:$,writes:ei,blockSize:eo}=ee;en.string("writeBlocks");en.string($);for(let $ of ei){en.int32(ag($.pos,eo));en.bytes($.data)}en.finalize();let es=et.int32();et.done();return es}case"readMeta":{en.string("readMeta");en.string(ee.name);en.finalize();let $=et.int32();let ei=et.int32();et.done();return $===-1?null:{size:$,blockSize:ei}}case"writeMeta":{let{name:$,meta:ei}=ee;en.string("writeMeta");en.string($);en.int32(ei.size);en.finalize();let eo=et.int32();et.done();return eo}case"closeFile":{en.string("closeFile");en.string(ee.name);en.finalize();let $=et.int32();et.done();return $}case"lockFile":{en.string("lockFile");en.string(ee.name);en.int32(ee.lockType);en.finalize();let $=et.int32();et.done();return $===0}case"unlockFile":{en.string("unlockFile");en.string(ee.name);en.int32(ee.lockType);en.finalize();let $=et.int32();et.done();return $===0}}}lock($){return this.invokeWorker("lockFile",{name:this.getStoreName(),lockType:$})}unlock($){return this.invokeWorker("unlockFile",{name:this.getStoreName(),lockType:$})}delete(){if(this.reader||this.writer){this.close()}let $=globalThis.indexedDB.deleteDatabase(this.getStoreName());$.onerror=()=>{console.warn(`Deleting ${this.filename} database failed`)};$.onsuccess=()=>{}}open(){let $=new SharedArrayBuffer(4096*9);this.writer=new ay($,{name:"args (backend)",debug:false});let ee=new SharedArrayBuffer(4096*9);this.reader=new ah(ee,{name:"results",debug:false});am(this.reader,this.writer)}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($){return this.invokeWorker("writeMeta",{name:this.getStoreName(),meta:$})}readBlocks($,ee){if(this.stats){this.stats.read+=$.length}return this.invokeWorker("readBlocks",{name:this.getStoreName(),positions:$,blockSize:ee})}writeBlocks($,ee){if(this.stats){this.stats.writes+=$.length}return this.invokeWorker("writeBlocks",{name:this.getStoreName(),writes:$,blockSize:ee})}}function av(){const $=!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent);if(!$||!indexedDB.databases)return Promise.resolve();let ee;return new Promise($=>{const et=()=>indexedDB.databases().finally($);ee=setInterval(et,100);et()}).finally(()=>clearInterval(ee))}function aw($,ee){return Math.round($/ee)}async function aE($){await av();return new Promise((ee,et)=>{let en=globalThis.indexedDB.open($,2);en.onsuccess=$=>{let et=$.target.result;et.onversionchange=()=>{console.log("closing because version changed");et.close()};et.onclose=()=>{};ee(et)};en.onupgradeneeded=$=>{let ee=$.target.result;if(!ee.objectStoreNames.contains("data")){ee.createObjectStore("data")}};en.onblocked=$=>console.log("blocked",$);en.onerror=en.onabort=$=>et($.target.error)})}class aS{constructor($,ee){this.dbName=$;this._openDb=null;this.hasAlertedFailure=false;this.onFallbackFailure=ee}async getDb(){if(this._openDb){return this._openDb}this._openDb=await aE(this.dbName);return this._openDb}closeDb(){if(this._openDb){this._openDb.close();this._openDb=null}}async readAll(){let $=await this.getDb(this.dbName);let ee=new Map;let et=$.transaction(["data"],"readonly");let en=et.objectStore("data");return new Promise(($,et)=>{let ei=en.openCursor(IDBKeyRange.lowerBound(-1));ei.onerror=et;ei.onsuccess=et=>{let en=et.target.result;if(en){ee.set(en.key,en.value);en.continue()}else{$(ee)}}})}async write($,ee,et){let en=await this.getDb(this.dbName);let ei=en.transaction(["data"],"readwrite");let eo=ei.objectStore("data");await new Promise((en,es)=>{let eu=eo.get(0);eu.onsuccess=el=>{if(et){if(!ae(eu.result,ee)){if(this.onFallbackFailure&&!this.hasAlertedFailure){this.hasAlertedFailure=true;this.onFallbackFailure()}es(new Error("Fallback mode unable to write file changes"));return}}for(let ee of $){eo.put(ee.value,ee.key)}ei.onsuccess=()=>en();ei.onerror=()=>es()};eu.onerror=es})}}class aT{constructor($,ee){this.filename=$;this.dbName=this.filename.replace(/\//g,"-");this.cachedFirstBlock=null;this.writeQueue=null;this.blocks=new Map;this.lockType=0;this.transferBlockOwnership=false;this.persistance=new aS(this.dbName,ee)}async readIfFallback(){this.transferBlockOwnership=true;this.blocks=await this.persistance.readAll();return this.readMeta()}lock($){this.cachedFirstBlock=this.blocks.get(0);this.lockType=$;return true}unlock($){if(this.lockType>i9.SHARED&&$===i9.SHARED){this.flush()}this.lockType=$;return true}delete(){let $=globalThis.indexedDB.deleteDatabase(this.dbName);$.onerror=()=>{console.warn(`Deleting ${this.filename} database failed`)};$.onsuccess=()=>{}}open(){this.writeQueue=[];this.lockType=0}close(){this.flush();if(this.transferBlockOwnership){this.transferBlockOwnership=false}else{this.blocks=new Map}this.persistance.closeDb()}readMeta(){let $=this.blocks.get(-1);if($){let ee=this.blocks.get(0);return{size:$.size,blockSize:i7(new Uint8Array(ee))}}return null}writeMeta($){this.blocks.set(-1,$);this.queueWrite(-1,$)}readBlocks($,ee){let et=[];for(let en of $){et.push({pos:en,data:this.blocks.get(aw(en,ee))})}return et}writeBlocks($,ee){for(let et of $){let $=aw(et.pos,ee);this.blocks.set($,et.data);this.queueWrite($,et.data)}if(this.lockType<=i9.SHARED){this.flush()}}queueWrite($,ee){this.writeQueue.push({key:$,value:ee})}flush(){if(this.writeQueue.length>0){this.persistance.write(this.writeQueue,this.cachedFirstBlock,this.lockType>i9.SHARED);this.writeQueue=[]}this.cachedFirstBlock=null}}class aO{constructor($){this.onFallbackFailure=$}createFile($){let ee;if(typeof SharedArrayBuffer!=="undefined"){ee=new a_($)}else{ee=new aT($,this.onFallbackFailure)}let et=new al($,ee);if(false||({}).PERF_BUILD){if(this._files==null){this._files=new Set}this._files.add(et)}return et}startProfile(){for(let $ of this._files){if($.ops.writer){let ee=$.ops.writer;let et=$.ops.reader;ee.string("profile-start");ee.finalize();et.int32();et.done()}}}stopProfile(){for(let $ of this._files){if($.ops.writer){let ee=$.ops.writer;let et=$.ops.reader;ee.string("profile-stop");ee.finalize();et.int32();et.done()}}}}const aA=aO;const aI=function($){console.log("[Exception]",$)};const aN=function($){};function aD($){let ee={running:null,queue:[]};function et(){if(ee.queue.length>0){const $=ee.queue.shift();en($.args,$.resolve,$.reject)}else{ee.running=null}}function en(en,ei,eo){ee.running=$(...en);ee.running.then($=>{et();ei($)},$=>{et();eo($)})}return(...$)=>{if(!ee.running){return new Promise((ee,et)=>{return en($,ee,et)})}else{return new Promise((et,en)=>{ee.queue.push({resolve:et,reject:en,args:$})})}}}function aR($){let ee=null;let et=(...et)=>{if(!ee){ee=$(...et).finally(()=>{ee=null});return ee}return ee};return et};let aC=new Set;let ak=null;let aM=new WeakMap;let aL=false;let ax=[];function aP($){aM.set($,true);return $}function aF($){return aM.has($)}async function aB(){await aU(200);while(aC.size>0){await Promise.all([...aC.values()]);await aU(100)}}function aU($){return new Promise(ee=>setTimeout(ee,$))}async function aj($,ee,{undoTag:et,name:en}={}){ax.push(en);if(ax.length>5){ax=ax.slice(-5)}if(aM.has($)){return aV(()=>$(ee),{undoTag:et})}if(en==="close-budget"){await aB()}let ei=$(ee);aC.add(ei);ei.then(()=>{aC.delete(ei)});return ei}function aW(){if(false){}}function aH(){if(false){}}function az($,ee={}){ak=ee;return $().finally(()=>{ak=null})}const aV=aD(az);function a$($,ee){if(ak==null&&!aL){aN("Recent methods: "+ax.join(", "));aI(new Error("withMutatorContext: mutator not running"));return ee()}let et=ak;ak={...ak,...$};return ee().finally(()=>{ak=et})}function aq(){if(ak==null){aN({category:"server",message:"Recent methods: "+ax.join(", ")});return{}}if(ak==null&&aL){return{}}return ak};function aG(){let $=typeof window!=="undefined"?window:typeof self!=="undefined"?self:null;if(!$){throw new Error("Cannot get global object")}return $}aG().__globalServerChannel=null;function aY($){if($.type&&$.type==="APIError"){return $}return{type:"InternalError",message:$.message}}const aK=function($,ee){const et=$;aG().__globalServerChannel=et;et.addEventListener("message",$=>{let en=$.data;let ei=typeof en==="string"?JSON.parse(en):en;if(ei.type&&(ei.type==="init"||ei.type.startsWith("__"))){return}let{id:eo,name:es,args:eu,undoTag:el,catchErrors:ef}=ei;if(ee[es]){aj(ee[es],eu,{undoTag:el,name:es}).then($=>{if(ef){$={data:$,error:null}}et.postMessage({type:"reply",id:eo,result:$,mutated:aF(ee[es]),undoTag:el})},$=>{let ee=aY($);if(es.startsWith("api/")){et.postMessage({type:"reply",id:eo,error:ee})}else if(ef){et.postMessage({type:"reply",id:eo,result:{error:ee,data:null}})}else{et.postMessage({type:"error",id:eo})}if(ee.type==="InternalError"){aI($)}if(!ef){aZ("server-error")}})}else{console.warn("Unknown method: "+es);et.postMessage({type:"reply",id:eo,result:null,error:{type:"APIError",message:"Unknown method: "+es}})}},false);et.postMessage({type:"connect"})};const aZ=function($,ee){const{__globalServerChannel:et}=aG();if(et){et.postMessage({type:"push",name:$,args:ee})}};const aJ=function(){return 1};var aX=__webpack_require__(9298);var aQ=__webpack_require__.n(aX);let a0=null;async function a1(){return new Promise(($,ee)=>{aQ()({locateFile:$=>"/"+$}).then(ee=>{a0=ee;$(undefined)},$=>{ee($)})})}function a2(){if(a0==null){throw new Error("_getModule: sql.js must be initialized first")}return a0}function a6($,ee){ee.forEach(ee=>{if(typeof ee!=="string"&&typeof ee!=="number"&&ee!==null){throw new Error("Invalid field type "+ee+" for sql "+$)}})}function a4($,ee){return $.prepare(ee)}function a3($,ee,et=[],en=false){if(et){a6(ee,et)}let ei=typeof ee==="string"?$.prepare(ee):ee;if(en){try{ei.bind(et);let $=[];while(ei.step()){$.push(ei.getAsObject())}if(typeof ee==="string"){ei.free()}else{ei.reset()}return $}catch($){console.log(ee);throw $}}else{try{ei.run(et);return{changes:$.getRowsModified()}}catch($){throw $}}}function a8($,ee){$.exec(ee)}let a5=0;function a9($,ee){let et,en,ei;if(a5>0){et="SAVEPOINT __actual_sp";en="RELEASE __actual_sp";ei="ROLLBACK TO __actual_sp"}else{et="BEGIN";en="COMMIT";ei="ROLLBACK"}a8($,et);a5++;try{const et=ee();a8($,en);return et}catch(ee){a8($,ei);if(ei!=="ROLLBACK"){a8($,en)}throw ee}finally{a5--}}async function a7($,ee){if(a5===0){$.exec("BEGIN TRANSACTION")}a5++;try{await ee()}finally{a5--;if(a5===0){$.exec("COMMIT")}}}async function oe($){let ee=null;if($){if(typeof $!=="string"){ee=new a0.Database($)}else{let et=$;if(et!==":memory:"){if(typeof SharedArrayBuffer==="undefined"){let $=a0.FS.open(a0.FS.readlink(et),"a+");await $.node.contents.readIfFallback();a0.FS.close($)}ee=new a0.Database(et.includes("/blocked")?et:a0.FS.readlink(et),{filename:true});ee.exec(`
|
|
16
|
+
*/$.exports=function($){return $!=null&&(ee($)||et($)||!!$._isBuffer)};function ee($){return!!$.constructor&&typeof $.constructor.isBuffer==="function"&&$.constructor.isBuffer($)}function et($){return typeof $.readFloatLE==="function"&&typeof $.slice==="function"&&ee($.slice(0,0))}},832:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});var en=et(5561);var ei=et(9568);var eo=en.constants.S_IFMT,es=en.constants.S_IFDIR,eu=en.constants.S_IFREG,el=en.constants.S_IFBLK,ef=en.constants.S_IFCHR,ed=en.constants.S_IFLNK,ep=en.constants.S_IFIFO,eh=en.constants.S_IFSOCK;var ey=function(){function $(){this.name="";this.mode=0}$.build=function(ee,et){var en=new $;var eo=ee.getNode().mode;en.name=ei.strToEncoding(ee.getName(),et);en.mode=eo;return en};$.prototype._checkModeProperty=function($){return(this.mode&eo)===$};$.prototype.isDirectory=function(){return this._checkModeProperty(es)};$.prototype.isFile=function(){return this._checkModeProperty(eu)};$.prototype.isBlockDevice=function(){return this._checkModeProperty(el)};$.prototype.isCharacterDevice=function(){return this._checkModeProperty(ef)};$.prototype.isSymbolicLink=function(){return this._checkModeProperty(ed)};$.prototype.isFIFO=function(){return this._checkModeProperty(ep)};$.prototype.isSocket=function(){return this._checkModeProperty(eh)};return $}();ee.Dirent=ey;ee["default"]=ey},1507:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});var en=et(5561);var ei=et(3103);var eo=en.constants.S_IFMT,es=en.constants.S_IFDIR,eu=en.constants.S_IFREG,el=en.constants.S_IFBLK,ef=en.constants.S_IFCHR,ed=en.constants.S_IFLNK,ep=en.constants.S_IFIFO,eh=en.constants.S_IFSOCK;var ey=function(){function $(){}$.build=function(ee,et){if(et===void 0){et=false}var en=new $;var eo=ee.uid,es=ee.gid,eu=ee.atime,el=ee.mtime,ef=ee.ctime;var ed=!et?function($){return $}:ei.default;en.uid=ed(eo);en.gid=ed(es);en.rdev=ed(0);en.blksize=ed(4096);en.ino=ed(ee.ino);en.size=ed(ee.getSize());en.blocks=ed(1);en.atime=eu;en.mtime=el;en.ctime=ef;en.birthtime=ef;en.atimeMs=ed(eu.getTime());en.mtimeMs=ed(el.getTime());var ep=ed(ef.getTime());en.ctimeMs=ep;en.birthtimeMs=ep;en.dev=ed(0);en.mode=ed(ee.mode);en.nlink=ed(ee.nlink);return en};$.prototype._checkModeProperty=function($){return(Number(this.mode)&eo)===$};$.prototype.isDirectory=function(){return this._checkModeProperty(es)};$.prototype.isFile=function(){return this._checkModeProperty(eu)};$.prototype.isBlockDevice=function(){return this._checkModeProperty(el)};$.prototype.isCharacterDevice=function(){return this._checkModeProperty(ef)};$.prototype.isSymbolicLink=function(){return this._checkModeProperty(ed)};$.prototype.isFIFO=function(){return this._checkModeProperty(ep)};$.prototype.isSocket=function(){return this._checkModeProperty(eh)};return $}();ee.Stats=ey;ee["default"]=ey},5561:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee.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}},9568:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});var en=et(6426);var ei=et(6978);ee.ENCODING_UTF8="utf8";function eo($){if($&&!en.Buffer.isEncoding($))throw new ei.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",$)}ee.assertEncoding=eo;function es($,et){if(!et||et===ee.ENCODING_UTF8)return $;if(et==="buffer")return new en.Buffer($);return new en.Buffer($).toString(et)}ee.strToEncoding=es},3103:($,ee)=>{if(typeof BigInt==="function")ee["default"]=BigInt;else ee["default"]=function $(){throw new Error("BigInt is not supported in this environment.")}},6551:function($,ee,et){"use strict";var en=this&&this.__assign||function(){en=Object.assign||function($){for(var ee,et=1,en=arguments.length;et<en;et++){ee=arguments[et];for(var ei in ee)if(Object.prototype.hasOwnProperty.call(ee,ei))$[ei]=ee[ei]}return $};return en.apply(this,arguments)};Object.defineProperty(ee,"__esModule",{value:true});var ei=et(1507);var eo=et(832);var es=et(6898);var eu=et(4657),el=eu.fsSyncMethods,ef=eu.fsAsyncMethods;var ed=et(5561);var ep=ed.constants.F_OK,eh=ed.constants.R_OK,ey=ed.constants.W_OK,eg=ed.constants.X_OK;ee.Volume=es.Volume;ee.vol=new es.Volume;function em($){var ee={F_OK:ep,R_OK:eh,W_OK:ey,X_OK:eg,constants:ed.constants,Stats:ei.default,Dirent:eo.default};for(var et=0,en=el;et<en.length;et++){var eu=en[et];if(typeof $[eu]==="function")ee[eu]=$[eu].bind($)}for(var em=0,e_=ef;em<e_.length;em++){var eu=e_[em];if(typeof $[eu]==="function")ee[eu]=$[eu].bind($)}ee.StatWatcher=$.StatWatcher;ee.FSWatcher=$.FSWatcher;ee.WriteStream=$.WriteStream;ee.ReadStream=$.ReadStream;ee.promises=$.promises;ee._toUnixTimestamp=es.toUnixTimestamp;return ee}ee.createFsFromVolume=em;ee.fs=em(ee.vol);$.exports=en(en({},$.exports),ee.fs);$.exports.semantic=true},6426:function($,ee,et){"use strict";var en=this&&this.__spreadArrays||function(){for(var $=0,ee=0,et=arguments.length;ee<et;ee++)$+=arguments[ee].length;for(var en=Array($),ei=0,ee=0;ee<et;ee++)for(var eo=arguments[ee],es=0,eu=eo.length;es<eu;es++,ei++)en[ei]=eo[es];return en};Object.defineProperty(ee,"__esModule",{value:true});var ei=et(8764);ee.Buffer=ei.Buffer;function eo($){var ee=[];for(var et=1;et<arguments.length;et++){ee[et-1]=arguments[et]}return new(ei.Buffer.bind.apply(ei.Buffer,en([void 0,$],ee)))}var es=ei.Buffer.allocUnsafe||eo;ee.bufferAllocUnsafe=es;var eu=ei.Buffer.from||eo;ee.bufferFrom=eu},6978:function($,ee,et){"use strict";var en=this&&this.__extends||function(){var $=function(ee,et){$=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function($,ee){$.__proto__=ee}||function($,ee){for(var et in ee)if(ee.hasOwnProperty(et))$[et]=ee[et]};return $(ee,et)};return function(ee,et){$(ee,et);function en(){this.constructor=ee}ee.prototype=et===null?Object.create(et):(en.prototype=et.prototype,new en)}}();Object.defineProperty(ee,"__esModule",{value:true});var ei=et(9282);var eo=et(9539);var es=typeof Symbol==="undefined"?"_kCode":Symbol("code");var eu={};function el($){return function($){en(ee,$);function ee(ee){var et=[];for(var en=1;en<arguments.length;en++){et[en-1]=arguments[en]}var ei=$.call(this,ed(ee,et))||this;ei.code=ee;ei[es]=ee;ei.name=$.prototype.name+" ["+ei[es]+"]";return ei}return ee}($)}var ef=function($){en(et,$);function et(et){var en=this;if(typeof et!=="object"||et===null){throw new ee.TypeError("ERR_INVALID_ARG_TYPE","options","object")}if(et.message){en=$.call(this,et.message)||this}else{en=$.call(this,eo.inspect(et.actual).slice(0,128)+" "+(et.operator+" "+eo.inspect(et.expected).slice(0,128)))||this}en.generatedMessage=!et.message;en.name="AssertionError [ERR_ASSERTION]";en.code="ERR_ASSERTION";en.actual=et.actual;en.expected=et.expected;en.operator=et.operator;ee.Error.captureStackTrace(en,et.stackStartFunction);return en}return et}(et.g.Error);ee.AssertionError=ef;function ed($,ee){ei.strictEqual(typeof $,"string");var et=eu[$];ei(et,"An invalid error message key was used: "+$+".");var en;if(typeof et==="function"){en=et}else{en=eo.format;if(ee===undefined||ee.length===0)return et;ee.unshift(et)}return String(en.apply(null,ee))}ee.message=ed;function ep($,ee){eu[$]=typeof ee==="function"?ee:String(ee)}ee.E=ep;ee.Error=el(et.g.Error);ee.TypeError=el(et.g.TypeError);ee.RangeError=el(et.g.RangeError);ep("ERR_ARG_NOT_ITERABLE","%s must be iterable");ep("ERR_ASSERTION","%s");ep("ERR_BUFFER_OUT_OF_BOUNDS",em);ep("ERR_CHILD_CLOSED_BEFORE_REPLY","Child closed before reply received");ep("ERR_CONSOLE_WRITABLE_STREAM","Console expects a writable stream instance for %s");ep("ERR_CPU_USAGE","Unable to obtain cpu usage %s");ep("ERR_DNS_SET_SERVERS_FAILED",function($,ee){return'c-ares failed to set servers: "'+$+'" ['+ee+"]"});ep("ERR_FALSY_VALUE_REJECTION","Promise was rejected with falsy value");ep("ERR_ENCODING_NOT_SUPPORTED",function($){return'The "'+$+'" encoding is not supported'});ep("ERR_ENCODING_INVALID_ENCODED_DATA",function($){return"The encoded data was not valid for encoding "+$});ep("ERR_HTTP_HEADERS_SENT","Cannot render headers after they are sent to the client");ep("ERR_HTTP_INVALID_STATUS_CODE","Invalid status code: %s");ep("ERR_HTTP_TRAILER_INVALID","Trailers are invalid with this transfer encoding");ep("ERR_INDEX_OUT_OF_RANGE","Index out of range");ep("ERR_INVALID_ARG_TYPE",eh);ep("ERR_INVALID_ARRAY_LENGTH",function($,ee,et){ei.strictEqual(typeof et,"number");return'The array "'+$+'" (length '+et+") must be of length "+ee+"."});ep("ERR_INVALID_BUFFER_SIZE","Buffer size must be a multiple of %s");ep("ERR_INVALID_CALLBACK","Callback must be a function");ep("ERR_INVALID_CHAR","Invalid character in %s");ep("ERR_INVALID_CURSOR_POS","Cannot set cursor row without setting its column");ep("ERR_INVALID_FD",'"fd" must be a positive integer: %s');ep("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s');ep("ERR_INVALID_FILE_URL_PATH","File URL path %s");ep("ERR_INVALID_HANDLE_TYPE","This handle type cannot be sent");ep("ERR_INVALID_IP_ADDRESS","Invalid IP address: %s");ep("ERR_INVALID_OPT_VALUE",function($,ee){return'The value "'+String(ee)+'" is invalid for option "'+$+'"'});ep("ERR_INVALID_OPT_VALUE_ENCODING",function($){return'The value "'+String($)+'" is invalid for option "encoding"'});ep("ERR_INVALID_REPL_EVAL_CONFIG",'Cannot specify both "breakEvalOnSigint" and "eval" for REPL');ep("ERR_INVALID_SYNC_FORK_INPUT","Asynchronous forks do not support Buffer, Uint8Array or string input: %s");ep("ERR_INVALID_THIS",'Value of "this" must be of type %s');ep("ERR_INVALID_TUPLE","%s must be an iterable %s tuple");ep("ERR_INVALID_URL","Invalid URL: %s");ep("ERR_INVALID_URL_SCHEME",function($){return"The URL must be "+eg($,"scheme")});ep("ERR_IPC_CHANNEL_CLOSED","Channel closed");ep("ERR_IPC_DISCONNECTED","IPC channel is already disconnected");ep("ERR_IPC_ONE_PIPE","Child process can have only one IPC pipe");ep("ERR_IPC_SYNC_FORK","IPC cannot be used with synchronous forks");ep("ERR_MISSING_ARGS",ey);ep("ERR_MULTIPLE_CALLBACK","Callback called multiple times");ep("ERR_NAPI_CONS_FUNCTION","Constructor must be a function");ep("ERR_NAPI_CONS_PROTOTYPE_OBJECT","Constructor.prototype must be an object");ep("ERR_NO_CRYPTO","Node.js is not compiled with OpenSSL crypto support");ep("ERR_NO_LONGER_SUPPORTED","%s is no longer supported");ep("ERR_PARSE_HISTORY_DATA","Could not parse history data in %s");ep("ERR_SOCKET_ALREADY_BOUND","Socket is already bound");ep("ERR_SOCKET_BAD_PORT","Port should be > 0 and < 65536");ep("ERR_SOCKET_BAD_TYPE","Bad socket type specified. Valid types are: udp4, udp6");ep("ERR_SOCKET_CANNOT_SEND","Unable to send data");ep("ERR_SOCKET_CLOSED","Socket is closed");ep("ERR_SOCKET_DGRAM_NOT_RUNNING","Not running");ep("ERR_STDERR_CLOSE","process.stderr cannot be closed");ep("ERR_STDOUT_CLOSE","process.stdout cannot be closed");ep("ERR_STREAM_WRAP","Stream has StringDecoder set or is in objectMode");ep("ERR_TLS_CERT_ALTNAME_INVALID","Hostname/IP does not match certificate's altnames: %s");ep("ERR_TLS_DH_PARAM_SIZE",function($){return"DH parameter size "+$+" is less than 2048"});ep("ERR_TLS_HANDSHAKE_TIMEOUT","TLS handshake timeout");ep("ERR_TLS_RENEGOTIATION_FAILED","Failed to renegotiate");ep("ERR_TLS_REQUIRED_SERVER_NAME",'"servername" is required parameter for Server.addContext');ep("ERR_TLS_SESSION_ATTACK","TSL session renegotiation attack detected");ep("ERR_TRANSFORM_ALREADY_TRANSFORMING","Calling transform done when still transforming");ep("ERR_TRANSFORM_WITH_LENGTH_0","Calling transform done when writableState.length != 0");ep("ERR_UNKNOWN_ENCODING","Unknown encoding: %s");ep("ERR_UNKNOWN_SIGNAL","Unknown signal: %s");ep("ERR_UNKNOWN_STDIN_TYPE","Unknown stdin file type");ep("ERR_UNKNOWN_STREAM_TYPE","Unknown stream file type");ep("ERR_V8BREAKITERATOR","Full ICU data not installed. "+"See https://github.com/nodejs/node/wiki/Intl");function eh($,ee,et){ei($,"name is required");var en;if(ee.includes("not ")){en="must not be";ee=ee.split("not ")[1]}else{en="must be"}var eo;if(Array.isArray($)){var es=$.map(function($){return'"'+$+'"'}).join(", ");eo="The "+es+" arguments "+en+" "+eg(ee,"type")}else if($.includes(" argument")){eo="The "+$+" "+en+" "+eg(ee,"type")}else{var eu=$.includes(".")?"property":"argument";eo='The "'+$+'" '+eu+" "+en+" "+eg(ee,"type")}if(arguments.length>=3){eo+=". Received type "+(et!==null?typeof et:"null")}return eo}function ey(){var $=[];for(var ee=0;ee<arguments.length;ee++){$[ee]=arguments[ee]}ei($.length>0,"At least one arg needs to be specified");var et="The ";var en=$.length;$=$.map(function($){return'"'+$+'"'});switch(en){case 1:et+=$[0]+" argument";break;case 2:et+=$[0]+" and "+$[1]+" arguments";break;default:et+=$.slice(0,en-1).join(", ");et+=", and "+$[en-1]+" arguments";break}return et+" must be specified"}function eg($,ee){ei($,"expected is required");ei(typeof ee==="string","thing is required");if(Array.isArray($)){var et=$.length;ei(et>0,"At least one expected value needs to be specified");$=$.map(function($){return String($)});if(et>2){return"one of "+ee+" "+$.slice(0,et-1).join(", ")+", or "+$[et-1]}else if(et===2){return"one of "+ee+" "+$[0]+" or "+$[1]}else{return"of "+ee+" "+$[0]}}else{return"of "+ee+" "+String($)}}function em($,ee){if(ee){return"Attempt to write outside buffer bounds"}else{return'"'+$+'" is outside of buffer bounds'}}},1172:function($,ee,et){"use strict";var en=this&&this.__extends||function(){var $=function(ee,et){$=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function($,ee){$.__proto__=ee}||function($,ee){for(var et in ee)if(ee.hasOwnProperty(et))$[et]=ee[et]};return $(ee,et)};return function(ee,et){$(ee,et);function en(){this.constructor=ee}ee.prototype=et===null?Object.create(et):(en.prototype=et.prototype,new en)}}();Object.defineProperty(ee,"__esModule",{value:true});var ei=et(4880);var eo=et(6426);var es=et(5561);var eu=et(7187);var el=et(1507);var ef=es.constants.S_IFMT,ed=es.constants.S_IFDIR,ep=es.constants.S_IFREG,eh=es.constants.S_IFLNK,ey=es.constants.O_APPEND;ee.SEP="/";var eg=function($){en(ee,$);function ee(ee,et){if(et===void 0){et=438}var en=$.call(this)||this;en.uid=ei.default.getuid();en.gid=ei.default.getgid();en.atime=new Date;en.mtime=new Date;en.ctime=new Date;en.perm=438;en.mode=ep;en.nlink=1;en.perm=et;en.mode|=et;en.ino=ee;return en}ee.prototype.getString=function($){if($===void 0){$="utf8"}return this.getBuffer().toString($)};ee.prototype.setString=function($){this.buf=eo.bufferFrom($,"utf8");this.touch()};ee.prototype.getBuffer=function(){if(!this.buf)this.setBuffer(eo.bufferAllocUnsafe(0));return eo.bufferFrom(this.buf)};ee.prototype.setBuffer=function($){this.buf=eo.bufferFrom($);this.touch()};ee.prototype.getSize=function(){return this.buf?this.buf.length:0};ee.prototype.setModeProperty=function($){this.mode=this.mode&~ef|$};ee.prototype.setIsFile=function(){this.setModeProperty(ep)};ee.prototype.setIsDirectory=function(){this.setModeProperty(ed)};ee.prototype.setIsSymlink=function(){this.setModeProperty(eh)};ee.prototype.isFile=function(){return(this.mode&ef)===ep};ee.prototype.isDirectory=function(){return(this.mode&ef)===ed};ee.prototype.isSymlink=function(){return(this.mode&ef)===eh};ee.prototype.makeSymlink=function($){this.symlink=$;this.setIsSymlink()};ee.prototype.write=function($,ee,et,en){if(ee===void 0){ee=0}if(et===void 0){et=$.length}if(en===void 0){en=0}if(!this.buf)this.buf=eo.bufferAllocUnsafe(0);if(en+et>this.buf.length){var ei=eo.bufferAllocUnsafe(en+et);this.buf.copy(ei,0,0,this.buf.length);this.buf=ei}$.copy(this.buf,en,ee,ee+et);this.touch();return et};ee.prototype.read=function($,ee,et,en){if(ee===void 0){ee=0}if(et===void 0){et=$.byteLength}if(en===void 0){en=0}if(!this.buf)this.buf=eo.bufferAllocUnsafe(0);var ei=et;if(ei>$.byteLength){ei=$.byteLength}if(ei+en>this.buf.length){ei=this.buf.length-en}this.buf.copy($,ee,en,en+ei);return ei};ee.prototype.truncate=function($){if($===void 0){$=0}if(!$)this.buf=eo.bufferAllocUnsafe(0);else{if(!this.buf)this.buf=eo.bufferAllocUnsafe(0);if($<=this.buf.length){this.buf=this.buf.slice(0,$)}else{var ee=eo.bufferAllocUnsafe(0);this.buf.copy(ee);ee.fill(0,$)}}this.touch()};ee.prototype.chmod=function($){this.perm=$;this.mode=this.mode&~511|$;this.touch()};ee.prototype.chown=function($,ee){this.uid=$;this.gid=ee;this.touch()};ee.prototype.touch=function(){this.mtime=new Date;this.emit("change",this)};ee.prototype.canRead=function($,ee){if($===void 0){$=ei.default.getuid()}if(ee===void 0){ee=ei.default.getgid()}if(this.perm&4){return true}if(ee===this.gid){if(this.perm&32){return true}}if($===this.uid){if(this.perm&256){return true}}return false};ee.prototype.canWrite=function($,ee){if($===void 0){$=ei.default.getuid()}if(ee===void 0){ee=ei.default.getgid()}if(this.perm&2){return true}if(ee===this.gid){if(this.perm&16){return true}}if($===this.uid){if(this.perm&128){return true}}return false};ee.prototype.del=function(){this.emit("delete",this)};ee.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()}};return ee}(eu.EventEmitter);ee.Node=eg;var em=function($){en(et,$);function et(ee,et,en){var ei=$.call(this)||this;ei.children={};ei.steps=[];ei.ino=0;ei.length=0;ei.vol=ee;ei.parent=et;ei.steps=et?et.steps.concat([en]):[en];return ei}et.prototype.setNode=function($){this.node=$;this.ino=$.ino};et.prototype.getNode=function(){return this.node};et.prototype.createChild=function($,ee){if(ee===void 0){ee=this.vol.createNode()}var en=new et(this.vol,this,$);en.setNode(ee);if(ee.isDirectory()){}this.setChild($,en);return en};et.prototype.setChild=function($,ee){if(ee===void 0){ee=new et(this.vol,this,$)}this.children[$]=ee;ee.parent=this;this.length++;this.emit("child:add",ee,this);return ee};et.prototype.deleteChild=function($){delete this.children[$.getName()];this.length--;this.emit("child:delete",$,this)};et.prototype.getChild=function($){if(Object.hasOwnProperty.call(this.children,$)){return this.children[$]}};et.prototype.getPath=function(){return this.steps.join(ee.SEP)};et.prototype.getName=function(){return this.steps[this.steps.length-1]};et.prototype.walk=function($,ee,et){if(ee===void 0){ee=$.length}if(et===void 0){et=0}if(et>=$.length)return this;if(et>=ee)return this;var en=$[et];var ei=this.getChild(en);if(!ei)return null;return ei.walk($,ee,et+1)};et.prototype.toJSON=function(){return{steps:this.steps,ino:this.ino,children:Object.keys(this.children)}};return et}(eu.EventEmitter);ee.Link=em;var e_=function(){function $($,ee,et,en){this.position=0;this.link=$;this.node=ee;this.flags=et;this.fd=en}$.prototype.getString=function($){if($===void 0){$="utf8"}return this.node.getString()};$.prototype.setString=function($){this.node.setString($)};$.prototype.getBuffer=function(){return this.node.getBuffer()};$.prototype.setBuffer=function($){this.node.setBuffer($)};$.prototype.getSize=function(){return this.node.getSize()};$.prototype.truncate=function($){this.node.truncate($)};$.prototype.seekTo=function($){this.position=$};$.prototype.stats=function(){return el.default.build(this.node)};$.prototype.write=function($,ee,et,en){if(ee===void 0){ee=0}if(et===void 0){et=$.length}if(typeof en!=="number")en=this.position;if(this.flags&ey)en=this.getSize();var ei=this.node.write($,ee,et,en);this.position=en+ei;return ei};$.prototype.read=function($,ee,et,en){if(ee===void 0){ee=0}if(et===void 0){et=$.byteLength}if(typeof en!=="number")en=this.position;var ei=this.node.read($,ee,et,en);this.position=en+ei;return ei};$.prototype.chmod=function($){this.node.chmod($)};$.prototype.chown=function($,ee){this.node.chown($,ee)};return $}();ee.File=e_},4880:($,ee,et)=>{"use strict";var en=et(4155);Object.defineProperty(ee,"__esModule",{value:true});var ei=function(){if(typeof en!=="undefined"){return en}try{return et(4155)}catch($){return undefined}};function eo(){var $=ei()||{};if(!$.getuid)$.getuid=function(){return 0};if(!$.getgid)$.getgid=function(){return 0};if(!$.cwd)$.cwd=function(){return"/"};if(!$.nextTick)$.nextTick=et(6015)["default"];if(!$.emitWarning)$.emitWarning=function($,ee){console.warn(""+ee+(ee?": ":"")+$)};if(!$.env)$.env={};return $}ee.createProcess=eo;ee["default"]=eo()},6133:function($,ee){"use strict";var et=this&&this.__spreadArrays||function(){for(var $=0,ee=0,et=arguments.length;ee<et;ee++)$+=arguments[ee].length;for(var en=Array($),ei=0,ee=0;ee<et;ee++)for(var eo=arguments[ee],es=0,eu=eo.length;es<eu;es++,ei++)en[ei]=eo[es];return en};Object.defineProperty(ee,"__esModule",{value:true});function en($,ee,en){if(en===void 0){en=function($){return $}}return function(){var ei=[];for(var eo=0;eo<arguments.length;eo++){ei[eo]=arguments[eo]}return new Promise(function(eo,es){$[ee].bind($).apply(void 0,et(ei,[function($,ee){if($)return es($);return eo(en(ee))}]))})}}var ei=function(){function $($,ee){this.vol=$;this.fd=ee}$.prototype.appendFile=function($,ee){return en(this.vol,"appendFile")(this.fd,$,ee)};$.prototype.chmod=function($){return en(this.vol,"fchmod")(this.fd,$)};$.prototype.chown=function($,ee){return en(this.vol,"fchown")(this.fd,$,ee)};$.prototype.close=function(){return en(this.vol,"close")(this.fd)};$.prototype.datasync=function(){return en(this.vol,"fdatasync")(this.fd)};$.prototype.read=function($,ee,et,ei){return en(this.vol,"read",function(ee){return{bytesRead:ee,buffer:$}})(this.fd,$,ee,et,ei)};$.prototype.readFile=function($){return en(this.vol,"readFile")(this.fd,$)};$.prototype.stat=function($){return en(this.vol,"fstat")(this.fd,$)};$.prototype.sync=function(){return en(this.vol,"fsync")(this.fd)};$.prototype.truncate=function($){return en(this.vol,"ftruncate")(this.fd,$)};$.prototype.utimes=function($,ee){return en(this.vol,"futimes")(this.fd,$,ee)};$.prototype.write=function($,ee,et,ei){return en(this.vol,"write",function(ee){return{bytesWritten:ee,buffer:$}})(this.fd,$,ee,et,ei)};$.prototype.writeFile=function($,ee){return en(this.vol,"writeFile")(this.fd,$,ee)};return $}();ee.FileHandle=ei;function eo($){if(typeof Promise==="undefined")return null;return{FileHandle:ei,access:function(ee,et){return en($,"access")(ee,et)},appendFile:function(ee,et,eo){return en($,"appendFile")(ee instanceof ei?ee.fd:ee,et,eo)},chmod:function(ee,et){return en($,"chmod")(ee,et)},chown:function(ee,et,ei){return en($,"chown")(ee,et,ei)},copyFile:function(ee,et,ei){return en($,"copyFile")(ee,et,ei)},lchmod:function(ee,et){return en($,"lchmod")(ee,et)},lchown:function(ee,et,ei){return en($,"lchown")(ee,et,ei)},link:function(ee,et){return en($,"link")(ee,et)},lstat:function(ee,et){return en($,"lstat")(ee,et)},mkdir:function(ee,et){return en($,"mkdir")(ee,et)},mkdtemp:function(ee,et){return en($,"mkdtemp")(ee,et)},open:function(ee,et,eo){return en($,"open",function(ee){return new ei($,ee)})(ee,et,eo)},readdir:function(ee,et){return en($,"readdir")(ee,et)},readFile:function(ee,et){return en($,"readFile")(ee instanceof ei?ee.fd:ee,et)},readlink:function(ee,et){return en($,"readlink")(ee,et)},realpath:function(ee,et){return en($,"realpath")(ee,et)},rename:function(ee,et){return en($,"rename")(ee,et)},rmdir:function(ee){return en($,"rmdir")(ee)},stat:function(ee,et){return en($,"stat")(ee,et)},symlink:function(ee,et,ei){return en($,"symlink")(ee,et,ei)},truncate:function(ee,et){return en($,"truncate")(ee,et)},unlink:function(ee){return en($,"unlink")(ee)},utimes:function(ee,et,ei){return en($,"utimes")(ee,et,ei)},writeFile:function(ee,et,eo){return en($,"writeFile")(ee instanceof ei?ee.fd:ee,et,eo)}}}ee["default"]=eo},6015:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});var en;if(typeof setImmediate==="function")en=setImmediate.bind(et.g);else en=setTimeout.bind(et.g);ee["default"]=en},8369:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});function et($,ee,et){var en=setTimeout.apply(null,arguments);if(en&&typeof en==="object"&&typeof en.unref==="function")en.unref();return en}ee["default"]=et},6898:function($,ee,et){"use strict";var en=this&&this.__extends||function(){var $=function(ee,et){$=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function($,ee){$.__proto__=ee}||function($,ee){for(var et in ee)if(ee.hasOwnProperty(et))$[et]=ee[et]};return $(ee,et)};return function(ee,et){$(ee,et);function en(){this.constructor=ee}ee.prototype=et===null?Object.create(et):(en.prototype=et.prototype,new en)}}();var ei=this&&this.__spreadArrays||function(){for(var $=0,ee=0,et=arguments.length;ee<et;ee++)$+=arguments[ee].length;for(var en=Array($),ei=0,ee=0;ee<et;ee++)for(var eo=arguments[ee],es=0,eu=eo.length;es<eu;es++,ei++)en[ei]=eo[es];return en};Object.defineProperty(ee,"__esModule",{value:true});var eo=et(6470);var es=et(1172);var eu=et(1507);var el=et(832);var ef=et(6426);var ed=et(6015);var ep=et(4880);var eh=et(8369);var ey=et(2830);var eg=et(5561);var em=et(7187);var e_=et(9568);var ew=et(6978);var eE=et(9539);var eS=et(6133);var eT=eo.resolve;var eO=eg.constants.O_RDONLY,eA=eg.constants.O_WRONLY,eI=eg.constants.O_RDWR,eN=eg.constants.O_CREAT,eD=eg.constants.O_EXCL,eR=eg.constants.O_TRUNC,eC=eg.constants.O_APPEND,ek=eg.constants.O_SYNC,eM=eg.constants.O_DIRECTORY,eL=eg.constants.F_OK,eP=eg.constants.COPYFILE_EXCL,eF=eg.constants.COPYFILE_FICLONE_FORCE;var eB;var eU;if(eo.posix){var ej=eo.posix;eB=ej.sep;eU=ej.relative}else{eB=eo.sep;eU=eo.relative}var eW=ep.default.platform==="win32";var eH=128;var ez={PATH_STR:"path must be a string or Buffer",FD:"fd must be a file descriptor",MODE_INT:"mode must be an int",CB:"callback must be a function",UID:"uid must be an unsigned int",GID:"gid must be an unsigned int",LEN:"len must be an integer",ATIME:"atime must be an integer",MTIME:"mtime must be an integer",PREFIX:"filename prefix is required",BUFFER:"buffer must be an instance of Buffer or StaticBuffer",OFFSET:"offset must be an integer",LENGTH:"length must be an integer",POSITION:"position must be an integer"};var eV=function($){return"Expected options to be either an object or a string, but got "+$+" instead"};var e$="ENOENT";var eq="EBADF";var eG="EINVAL";var eY="EPERM";var eK="EPROTO";var eZ="EEXIST";var eJ="ENOTDIR";var eX="EMFILE";var eQ="EACCES";var e0="EISDIR";var e1="ENOTEMPTY";var e2="ENOSYS";function e6($,ee,et,en){if(ee===void 0){ee=""}if(et===void 0){et=""}if(en===void 0){en=""}var ei="";if(et)ei=" '"+et+"'";if(en)ei+=" -> '"+en+"'";switch($){case e$:return"ENOENT: no such file or directory, "+ee+ei;case eq:return"EBADF: bad file descriptor, "+ee+ei;case eG:return"EINVAL: invalid argument, "+ee+ei;case eY:return"EPERM: operation not permitted, "+ee+ei;case eK:return"EPROTO: protocol error, "+ee+ei;case eZ:return"EEXIST: file already exists, "+ee+ei;case eJ:return"ENOTDIR: not a directory, "+ee+ei;case e0:return"EISDIR: illegal operation on a directory, "+ee+ei;case eQ:return"EACCES: permission denied, "+ee+ei;case e1:return"ENOTEMPTY: directory not empty, "+ee+ei;case eX:return"EMFILE: too many open files, "+ee+ei;case e2:return"ENOSYS: function not implemented, "+ee+ei;default:return $+": error occurred, "+ee+ei}}function e4($,ee,et,en,ei){if(ee===void 0){ee=""}if(et===void 0){et=""}if(en===void 0){en=""}if(ei===void 0){ei=Error}var eo=new ei(e6($,ee,et,en));eo.code=$;return eo}var e3;(function($){$[$["r"]=eO]="r";$[$["r+"]=eI]="r+";$[$["rs"]=eO|ek]="rs";$[$["sr"]=$.rs]="sr";$[$["rs+"]=eI|ek]="rs+";$[$["sr+"]=$["rs+"]]="sr+";$[$["w"]=eA|eN|eR]="w";$[$["wx"]=eA|eN|eR|eD]="wx";$[$["xw"]=$.wx]="xw";$[$["w+"]=eI|eN|eR]="w+";$[$["wx+"]=eI|eN|eR|eD]="wx+";$[$["xw+"]=$["wx+"]]="xw+";$[$["a"]=eA|eC|eN]="a";$[$["ax"]=eA|eC|eN|eD]="ax";$[$["xa"]=$.ax]="xa";$[$["a+"]=eI|eC|eN]="a+";$[$["ax+"]=eI|eC|eN|eD]="ax+";$[$["xa+"]=$["ax+"]]="xa+"})(e3=ee.FLAGS||(ee.FLAGS={}));function e8($){if(typeof $==="number")return $;if(typeof $==="string"){var ee=e3[$];if(typeof ee!=="undefined")return ee}throw new ew.TypeError("ERR_INVALID_OPT_VALUE","flags",$)}ee.flagsToNumber=e8;function e5($,ee){var et;if(!ee)return $;else{var en=typeof ee;switch(en){case"string":et=Object.assign({},$,{encoding:ee});break;case"object":et=Object.assign({},$,ee);break;default:throw TypeError(eV(en))}}if(et.encoding!=="buffer")e_.assertEncoding(et.encoding);return et}function e9($){return function(ee){return e5($,ee)}}function e7($){if(typeof $!=="function")throw TypeError(ez.CB);return $}function te($){return function(ee,et){return typeof ee==="function"?[$(),ee]:[$(ee),e7(et)]}}var tt={encoding:"utf8"};var tr=e9(tt);var tn=te(tr);var ti={flag:"r"};var tu=e9(ti);var tc={encoding:"utf8",mode:438,flag:e3[e3.w]};var tf=e9(tc);var td={encoding:"utf8",mode:438,flag:e3[e3.a]};var tp=e9(td);var th=te(tp);var ty=tt;var tm=e9(ty);var t_=te(tm);var tv={mode:511,recursive:false};var tw=function($){if(typeof $==="number")return Object.assign({},tv,{mode:$});return Object.assign({},tv,$)};var tE={recursive:false};var tS=function($){return Object.assign({},tE,$)};var tT={encoding:"utf8",withFileTypes:false};var tO=e9(tT);var tA=te(tO);var tI={bigint:false};var tN=function($){if($===void 0){$={}}return Object.assign({},tI,$)};var tD=function($,ee){return typeof $==="function"?[tN(),$]:[tN($),e7(ee)]};function tR($){if($.hostname!==""){throw new ew.TypeError("ERR_INVALID_FILE_URL_HOST",ep.default.platform)}var ee=$.pathname;for(var et=0;et<ee.length;et++){if(ee[et]==="%"){var en=ee.codePointAt(et+2)|32;if(ee[et+1]==="2"&&en===102){throw new ew.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}}}return decodeURIComponent(ee)}function tC($){if(typeof $!=="string"&&!ef.Buffer.isBuffer($)){try{if(!($ instanceof et(8119).URL))throw new TypeError(ez.PATH_STR)}catch($){throw new TypeError(ez.PATH_STR)}$=tR($)}var ee=String($);tj(ee);return ee}ee.pathToFilename=tC;var tk=function($,ee){if(ee===void 0){ee=ep.default.cwd()}return eT(ee,$)};if(eW){var tM=tk;var tL=et(8012).Z4;tk=function($,ee){return tL(tM($,ee))}}function tx($,ee){var et=tk($,ee);var en=et.substr(1);if(!en)return[];return en.split(eB)}ee.filenameToSteps=tx;function tP($){return tx(tC($))}ee.pathToSteps=tP;function tF($,ee){if(ee===void 0){ee=e_.ENCODING_UTF8}if(ef.Buffer.isBuffer($))return $.toString(ee);else if($ instanceof Uint8Array)return ef.bufferFrom($).toString(ee);else return String($)}ee.dataToStr=tF;function tB($,ee){if(ee===void 0){ee=e_.ENCODING_UTF8}if(ef.Buffer.isBuffer($))return $;else if($ instanceof Uint8Array)return ef.bufferFrom($);else return ef.bufferFrom(String($),ee)}ee.dataToBuffer=tB;function tU($,ee){if(!ee||ee==="buffer")return $;else return $.toString(ee)}ee.bufferToEncoding=tU;function tj($,ee){if((""+$).indexOf("\x00")!==-1){var et=new Error("Path must be a string without null bytes");et.code=e$;if(typeof ee!=="function")throw et;ep.default.nextTick(ee,et);return false}return true}function tW($,ee){if(typeof $==="number")return $;if(typeof $==="string")return parseInt($,8);if(ee)return tH(ee);return undefined}function tH($,ee){var et=tW($,ee);if(typeof et!=="number"||isNaN(et))throw new TypeError(ez.MODE_INT);return et}function tz($){return $>>>0===$}function tV($){if(!tz($))throw TypeError(ez.FD)}function t$($){if(typeof $==="string"&&+$==$){return+$}if($ instanceof Date){return $.getTime()/1e3}if(isFinite($)){if($<0){return Date.now()/1e3}return $}throw new Error("Cannot parse time: "+$)}ee.toUnixTimestamp=t$;function tq($){if(typeof $!=="number")throw TypeError(ez.UID)}function tG($){if(typeof $!=="number")throw TypeError(ez.GID)}var tY=function(){function $($){if($===void 0){$={}}this.ino=0;this.inodes={};this.releasedInos=[];this.fds={};this.releasedFds=[];this.maxFiles=1e4;this.openFiles=0;this.promisesApi=eS.default(this);this.statWatchers={};this.props=Object.assign({Node:es.Node,Link:es.Link,File:es.File},$);var ee=this.createLink();ee.setNode(this.createNode(true));var et=this;this.StatWatcher=function($){en(ee,$);function ee(){return $.call(this,et)||this}return ee}(tZ);var eo=tQ;this.ReadStream=function($){en(ee,$);function ee(){var ee=[];for(var en=0;en<arguments.length;en++){ee[en]=arguments[en]}return $.apply(this,ei([et],ee))||this}return ee}(eo);var eu=t6;this.WriteStream=function($){en(ee,$);function ee(){var ee=[];for(var en=0;en<arguments.length;en++){ee[en]=arguments[en]}return $.apply(this,ei([et],ee))||this}return ee}(eu);this.FSWatcher=function($){en(ee,$);function ee(){return $.call(this,et)||this}return ee}(t4);this.root=ee}$.fromJSON=function(ee,et){var en=new $;en.fromJSON(ee,et);return en};Object.defineProperty($.prototype,"promises",{get:function(){if(this.promisesApi===null)throw new Error("Promise is not supported in this environment.");return this.promisesApi},enumerable:true,configurable:true});$.prototype.createLink=function($,ee,et,en){if(et===void 0){et=false}if(!$){return new this.props.Link(this,null,"")}if(!ee){throw new Error("createLink: name cannot be empty")}return $.createChild(ee,this.createNode(et,en))};$.prototype.deleteLink=function($){var ee=$.parent;if(ee){ee.deleteChild($);return true}return false};$.prototype.newInoNumber=function(){var $=this.releasedInos.pop();if($)return $;else{this.ino=(this.ino+1)%4294967295;return this.ino}};$.prototype.newFdNumber=function(){var ee=this.releasedFds.pop();return typeof ee==="number"?ee:$.fd--};$.prototype.createNode=function($,ee){if($===void 0){$=false}var et=new this.props.Node(this.newInoNumber(),ee);if($)et.setIsDirectory();this.inodes[et.ino]=et;return et};$.prototype.getNode=function($){return this.inodes[$]};$.prototype.deleteNode=function($){$.del();delete this.inodes[$.ino];this.releasedInos.push($.ino)};$.prototype.genRndStr=function(){var $=(Math.random()+1).toString(36).substr(2,6);if($.length===6)return $;else return this.genRndStr()};$.prototype.getLink=function($){return this.root.walk($)};$.prototype.getLinkOrThrow=function($,ee){var et=tx($);var en=this.getLink(et);if(!en)throw e4(e$,ee,$);return en};$.prototype.getResolvedLink=function($){var ee=typeof $==="string"?tx($):$;var et=this.root;var en=0;while(en<ee.length){var ei=ee[en];et=et.getChild(ei);if(!et)return null;var eo=et.getNode();if(eo.isSymlink()){ee=eo.symlink.concat(ee.slice(en+1));et=this.root;en=0;continue}en++}return et};$.prototype.getResolvedLinkOrThrow=function($,ee){var et=this.getResolvedLink($);if(!et)throw e4(e$,ee,$);return et};$.prototype.resolveSymlinks=function($){return this.getResolvedLink($.steps.slice(1))};$.prototype.getLinkAsDirOrThrow=function($,ee){var et=this.getLinkOrThrow($,ee);if(!et.getNode().isDirectory())throw e4(eJ,ee,$);return et};$.prototype.getLinkParent=function($){return this.root.walk($,$.length-1)};$.prototype.getLinkParentAsDirOrThrow=function($,ee){var et=$ instanceof Array?$:tx($);var en=this.getLinkParent(et);if(!en)throw e4(e$,ee,eB+et.join(eB));if(!en.getNode().isDirectory())throw e4(eJ,ee,eB+et.join(eB));return en};$.prototype.getFileByFd=function($){return this.fds[String($)]};$.prototype.getFileByFdOrThrow=function($,ee){if(!tz($))throw TypeError(ez.FD);var et=this.getFileByFd($);if(!et)throw e4(eq,ee);return et};$.prototype.getNodeByIdOrCreate=function($,ee,et){if(typeof $==="number"){var en=this.getFileByFd($);if(!en)throw Error("File nto found");return en.node}else{var ei=tP($);var eo=this.getLink(ei);if(eo)return eo.getNode();if(ee&eN){var es=this.getLinkParent(ei);if(es){var eu=ei[ei.length-1];eo=this.createLink(es,eu,false,et);return eo.getNode()}}throw e4(e$,"getNodeByIdOrCreate",tC($))}};$.prototype.wrapAsync=function($,ee,et){var en=this;e7(et);ed.default(function(){try{et(null,$.apply(en,ee))}catch($){et($)}})};$.prototype._toJSON=function($,ee,et){var en;if($===void 0){$=this.root}if(ee===void 0){ee={}}var ei=true;var eo=$.children;if($.getNode().isFile()){eo=(en={},en[$.getName()]=$.parent.getChild($.getName()),en);$=$.parent}for(var es in eo){ei=false;var eu=$.getChild(es);if(!eu){throw new Error("_toJSON: unexpected undefined")}var el=eu.getNode();if(el.isFile()){var ef=eu.getPath();if(et)ef=eU(et,ef);ee[ef]=el.getString()}else if(el.isDirectory()){this._toJSON(eu,ee,et)}}var ed=$.getPath();if(et)ed=eU(et,ed);if(ed&&ei){ee[ed]=null}return ee};$.prototype.toJSON=function($,ee,et){if(ee===void 0){ee={}}if(et===void 0){et=false}var en=[];if($){if(!($ instanceof Array))$=[$];for(var ei=0,eo=$;ei<eo.length;ei++){var es=eo[ei];var eu=tC(es);var el=this.getResolvedLink(eu);if(!el)continue;en.push(el)}}else{en.push(this.root)}if(!en.length)return ee;for(var ef=0,ed=en;ef<ed.length;ef++){var el=ed[ef];this._toJSON(el,ee,et?el.getPath():"")}return ee};$.prototype.fromJSON=function($,ee){if(ee===void 0){ee=ep.default.cwd()}for(var et in $){var en=$[et];if(typeof en==="string"){et=tk(et,ee);var ei=tx(et);if(ei.length>1){var eo=eB+ei.slice(0,ei.length-1).join(eB);this.mkdirpBase(eo,511)}this.writeFileSync(et,en)}else{this.mkdirpBase(et,511)}}};$.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(true))};$.prototype.mountSync=function($,ee){this.fromJSON(ee,$)};$.prototype.openLink=function($,ee,et){if(et===void 0){et=true}if(this.openFiles>=this.maxFiles){throw e4(eX,"open",$.getPath())}var en=$;if(et)en=this.resolveSymlinks($);if(!en)throw e4(e$,"open",$.getPath());var ei=en.getNode();if(ei.isDirectory()){if((ee&(eO|eI|eA))!==eO)throw e4(e0,"open",$.getPath())}else{if(ee&eM)throw e4(eJ,"open",$.getPath())}if(!(ee&eA)){if(!ei.canRead()){throw e4(eQ,"open",$.getPath())}}if(ee&eI){}var eo=new this.props.File($,ei,ee,this.newFdNumber());this.fds[eo.fd]=eo;this.openFiles++;if(ee&eR)eo.truncate();return eo};$.prototype.openFile=function($,ee,et,en){if(en===void 0){en=true}var ei=tx($);var eo=en?this.getResolvedLink(ei):this.getLink(ei);if(!eo&&ee&eN){var es=this.getResolvedLink(ei.slice(0,ei.length-1));if(!es)throw e4(e$,"open",eB+ei.join(eB));if(ee&eN&&typeof et==="number"){eo=this.createLink(es,ei[ei.length-1],false,et)}}if(eo)return this.openLink(eo,ee,en);throw e4(e$,"open",$)};$.prototype.openBase=function($,ee,et,en){if(en===void 0){en=true}var ei=this.openFile($,ee,et,en);if(!ei)throw e4(e$,"open",$);return ei.fd};$.prototype.openSync=function($,ee,et){if(et===void 0){et=438}var en=tH(et);var ei=tC($);var eo=e8(ee);return this.openBase(ei,eo,en)};$.prototype.open=function($,ee,et,en){var ei=et;var eo=en;if(typeof et==="function"){ei=438;eo=et}ei=ei||438;var es=tH(ei);var eu=tC($);var el=e8(ee);this.wrapAsync(this.openBase,[eu,el,es],eo)};$.prototype.closeFile=function($){if(!this.fds[$.fd])return;this.openFiles--;delete this.fds[$.fd];this.releasedFds.push($.fd)};$.prototype.closeSync=function($){tV($);var ee=this.getFileByFdOrThrow($,"close");this.closeFile(ee)};$.prototype.close=function($,ee){tV($);this.wrapAsync(this.closeSync,[$],ee)};$.prototype.openFileOrGetById=function($,ee,et){if(typeof $==="number"){var en=this.fds[$];if(!en)throw e4(e$);return en}else{return this.openFile(tC($),ee,et)}};$.prototype.readBase=function($,ee,et,en,ei){var eo=this.getFileByFdOrThrow($);return eo.read(ee,Number(et),Number(en),ei)};$.prototype.readSync=function($,ee,et,en,ei){tV($);return this.readBase($,ee,et,en,ei)};$.prototype.read=function($,ee,et,en,ei,eo){var es=this;e7(eo);if(en===0){return ep.default.nextTick(function(){if(eo)eo(null,0,ee)})}ed.default(function(){try{var eu=es.readBase($,ee,et,en,ei);eo(null,eu,ee)}catch($){eo($)}})};$.prototype.readFileBase=function($,ee,et){var en;var ei=typeof $==="number";var eo=ei&&tz($);var es;if(eo)es=$;else{var eu=tC($);var el=tx(eu);var ef=this.getResolvedLink(el);if(ef){var ed=ef.getNode();if(ed.isDirectory())throw e4(e0,"open",ef.getPath())}es=this.openSync($,ee)}try{en=tU(this.getFileByFdOrThrow(es).getBuffer(),et)}finally{if(!eo){this.closeSync(es)}}return en};$.prototype.readFileSync=function($,ee){var et=tu(ee);var en=e8(et.flag);return this.readFileBase($,en,et.encoding)};$.prototype.readFile=function($,ee,et){var en=te(tu)(ee,et),ei=en[0],eo=en[1];var es=e8(ei.flag);this.wrapAsync(this.readFileBase,[$,es,ei.encoding],eo)};$.prototype.writeBase=function($,ee,et,en,ei){var eo=this.getFileByFdOrThrow($,"write");return eo.write(ee,et,en,ei)};$.prototype.writeSync=function($,ee,et,en,ei){tV($);var eo;var es;var eu;var el;var ef=typeof ee!=="string";if(ef){es=(et||0)|0;eu=en;el=ei}else{el=et;eo=en}var ed=tB(ee,eo);if(ef){if(typeof eu==="undefined"){eu=ed.length}}else{es=0;eu=ed.length}return this.writeBase($,ed,es,eu,el)};$.prototype.write=function($,ee,et,en,ei,eo){var es=this;tV($);var eu;var el;var ef;var ep;var eh;var ey=typeof ee;var eg=typeof et;var em=typeof en;var e_=typeof ei;if(ey!=="string"){if(eg==="function"){eh=et}else if(em==="function"){eu=et|0;eh=en}else if(e_==="function"){eu=et|0;el=en;eh=ei}else{eu=et|0;el=en;ef=ei;eh=eo}}else{if(eg==="function"){eh=et}else if(em==="function"){ef=et;eh=en}else if(e_==="function"){ef=et;ep=en;eh=ei}}var ew=tB(ee,ep);if(ey!=="string"){if(typeof el==="undefined")el=ew.length}else{eu=0;el=ew.length}var eE=e7(eh);ed.default(function(){try{var et=es.writeBase($,ew,eu,el,ef);if(ey!=="string"){eE(null,et,ew)}else{eE(null,et,ee)}}catch($){eE($)}})};$.prototype.writeFileBase=function($,ee,et,en){var ei=typeof $==="number";var eo;if(ei)eo=$;else{eo=this.openBase(tC($),et,en)}var es=0;var eu=ee.length;var el=et&eC?undefined:0;try{while(eu>0){var ef=this.writeSync(eo,ee,es,eu,el);es+=ef;eu-=ef;if(el!==undefined)el+=ef}}finally{if(!ei)this.closeSync(eo)}};$.prototype.writeFileSync=function($,ee,et){var en=tf(et);var ei=e8(en.flag);var eo=tH(en.mode);var es=tB(ee,en.encoding);this.writeFileBase($,es,ei,eo)};$.prototype.writeFile=function($,ee,et,en){var ei=et;var eo=en;if(typeof et==="function"){ei=tc;eo=et}var es=e7(eo);var eu=tf(ei);var el=e8(eu.flag);var ef=tH(eu.mode);var ed=tB(ee,eu.encoding);this.wrapAsync(this.writeFileBase,[$,ed,el,ef],es)};$.prototype.linkBase=function($,ee){var et=tx($);var en=this.getLink(et);if(!en)throw e4(e$,"link",$,ee);var ei=tx(ee);var eo=this.getLinkParent(ei);if(!eo)throw e4(e$,"link",$,ee);var es=ei[ei.length-1];if(eo.getChild(es))throw e4(eZ,"link",$,ee);var eu=en.getNode();eu.nlink++;eo.createChild(es,eu)};$.prototype.copyFileBase=function($,ee,et){var en=this.readFileSync($);if(et&eP){if(this.existsSync(ee)){throw e4(eZ,"copyFile",$,ee)}}if(et&eF){throw e4(e2,"copyFile",$,ee)}this.writeFileBase(ee,en,e3.w,438)};$.prototype.copyFileSync=function($,ee,et){var en=tC($);var ei=tC(ee);return this.copyFileBase(en,ei,(et||0)|0)};$.prototype.copyFile=function($,ee,et,en){var ei=tC($);var eo=tC(ee);var es;var eu;if(typeof et==="function"){es=0;eu=et}else{es=et;eu=en}e7(eu);this.wrapAsync(this.copyFileBase,[ei,eo,es],eu)};$.prototype.linkSync=function($,ee){var et=tC($);var en=tC(ee);this.linkBase(et,en)};$.prototype.link=function($,ee,et){var en=tC($);var ei=tC(ee);this.wrapAsync(this.linkBase,[en,ei],et)};$.prototype.unlinkBase=function($){var ee=tx($);var et=this.getLink(ee);if(!et)throw e4(e$,"unlink",$);if(et.length)throw Error("Dir not empty...");this.deleteLink(et);var en=et.getNode();en.nlink--;if(en.nlink<=0){this.deleteNode(en)}};$.prototype.unlinkSync=function($){var ee=tC($);this.unlinkBase(ee)};$.prototype.unlink=function($,ee){var et=tC($);this.wrapAsync(this.unlinkBase,[et],ee)};$.prototype.symlinkBase=function($,ee){var et=tx(ee);var en=this.getLinkParent(et);if(!en)throw e4(e$,"symlink",$,ee);var ei=et[et.length-1];if(en.getChild(ei))throw e4(eZ,"symlink",$,ee);var eo=en.createChild(ei);eo.getNode().makeSymlink(tx($));return eo};$.prototype.symlinkSync=function($,ee,et){var en=tC($);var ei=tC(ee);this.symlinkBase(en,ei)};$.prototype.symlink=function($,ee,et,en){var ei=e7(typeof et==="function"?et:en);var eo=tC($);var es=tC(ee);this.wrapAsync(this.symlinkBase,[eo,es],ei)};$.prototype.realpathBase=function($,ee){var et=tx($);var en=this.getResolvedLink(et);if(!en)throw e4(e$,"realpath",$);return e_.strToEncoding(en.getPath(),ee)};$.prototype.realpathSync=function($,ee){return this.realpathBase(tC($),tm(ee).encoding)};$.prototype.realpath=function($,ee,et){var en=t_(ee,et),ei=en[0],eo=en[1];var es=tC($);this.wrapAsync(this.realpathBase,[es,ei.encoding],eo)};$.prototype.lstatBase=function($,ee){if(ee===void 0){ee=false}var et=this.getLink(tx($));if(!et)throw e4(e$,"lstat",$);return eu.default.build(et.getNode(),ee)};$.prototype.lstatSync=function($,ee){return this.lstatBase(tC($),tN(ee).bigint)};$.prototype.lstat=function($,ee,et){var en=tD(ee,et),ei=en[0],eo=en[1];this.wrapAsync(this.lstatBase,[tC($),ei.bigint],eo)};$.prototype.statBase=function($,ee){if(ee===void 0){ee=false}var et=this.getResolvedLink(tx($));if(!et)throw e4(e$,"stat",$);return eu.default.build(et.getNode(),ee)};$.prototype.statSync=function($,ee){return this.statBase(tC($),tN(ee).bigint)};$.prototype.stat=function($,ee,et){var en=tD(ee,et),ei=en[0],eo=en[1];this.wrapAsync(this.statBase,[tC($),ei.bigint],eo)};$.prototype.fstatBase=function($,ee){if(ee===void 0){ee=false}var et=this.getFileByFd($);if(!et)throw e4(eq,"fstat");return eu.default.build(et.node,ee)};$.prototype.fstatSync=function($,ee){return this.fstatBase($,tN(ee).bigint)};$.prototype.fstat=function($,ee,et){var en=tD(ee,et),ei=en[0],eo=en[1];this.wrapAsync(this.fstatBase,[$,ei.bigint],eo)};$.prototype.renameBase=function($,ee){var et=this.getLink(tx($));if(!et)throw e4(e$,"rename",$,ee);var en=tx(ee);var eo=this.getLinkParent(en);if(!eo)throw e4(e$,"rename",$,ee);var es=et.parent;if(es){es.deleteChild(et)}var eu=en[en.length-1];et.steps=ei(eo.steps,[eu]);eo.setChild(et.getName(),et)};$.prototype.renameSync=function($,ee){var et=tC($);var en=tC(ee);this.renameBase(et,en)};$.prototype.rename=function($,ee,et){var en=tC($);var ei=tC(ee);this.wrapAsync(this.renameBase,[en,ei],et)};$.prototype.existsBase=function($){return!!this.statBase($)};$.prototype.existsSync=function($){try{return this.existsBase(tC($))}catch($){return false}};$.prototype.exists=function($,ee){var et=this;var en=tC($);if(typeof ee!=="function")throw Error(ez.CB);ed.default(function(){try{ee(et.existsBase(en))}catch($){ee(false)}})};$.prototype.accessBase=function($,ee){var et=this.getLinkOrThrow($,"access")};$.prototype.accessSync=function($,ee){if(ee===void 0){ee=eL}var et=tC($);ee=ee|0;this.accessBase(et,ee)};$.prototype.access=function($,ee,et){var en=eL;var ei;if(typeof ee!=="function"){en=ee|0;ei=e7(et)}else{ei=ee}var eo=tC($);this.wrapAsync(this.accessBase,[eo,en],ei)};$.prototype.appendFileSync=function($,ee,et){if(et===void 0){et=td}var en=tp(et);if(!en.flag||tz($))en.flag="a";this.writeFileSync($,ee,en)};$.prototype.appendFile=function($,ee,et,en){var ei=th(et,en),eo=ei[0],es=ei[1];if(!eo.flag||tz($))eo.flag="a";this.writeFile($,ee,eo,es)};$.prototype.readdirBase=function($,ee){var et=tx($);var en=this.getResolvedLink(et);if(!en)throw e4(e$,"readdir",$);var ei=en.getNode();if(!ei.isDirectory())throw e4(eJ,"scandir",$);if(ee.withFileTypes){var eo=[];for(var es in en.children){var eu=en.getChild(es);if(!eu){continue}eo.push(el.default.build(eu,ee.encoding))}if(!eW&&ee.encoding!=="buffer")eo.sort(function($,ee){if($.name<ee.name)return-1;if($.name>ee.name)return 1;return 0});return eo}var ef=[];for(var ed in en.children){ef.push(e_.strToEncoding(ed,ee.encoding))}if(!eW&&ee.encoding!=="buffer")ef.sort();return ef};$.prototype.readdirSync=function($,ee){var et=tO(ee);var en=tC($);return this.readdirBase(en,et)};$.prototype.readdir=function($,ee,et){var en=tA(ee,et),ei=en[0],eo=en[1];var es=tC($);this.wrapAsync(this.readdirBase,[es,ei],eo)};$.prototype.readlinkBase=function($,ee){var et=this.getLinkOrThrow($,"readlink");var en=et.getNode();if(!en.isSymlink())throw e4(eG,"readlink",$);var ei=eB+en.symlink.join(eB);return e_.strToEncoding(ei,ee)};$.prototype.readlinkSync=function($,ee){var et=tr(ee);var en=tC($);return this.readlinkBase(en,et.encoding)};$.prototype.readlink=function($,ee,et){var en=tn(ee,et),ei=en[0],eo=en[1];var es=tC($);this.wrapAsync(this.readlinkBase,[es,ei.encoding],eo)};$.prototype.fsyncBase=function($){this.getFileByFdOrThrow($,"fsync")};$.prototype.fsyncSync=function($){this.fsyncBase($)};$.prototype.fsync=function($,ee){this.wrapAsync(this.fsyncBase,[$],ee)};$.prototype.fdatasyncBase=function($){this.getFileByFdOrThrow($,"fdatasync")};$.prototype.fdatasyncSync=function($){this.fdatasyncBase($)};$.prototype.fdatasync=function($,ee){this.wrapAsync(this.fdatasyncBase,[$],ee)};$.prototype.ftruncateBase=function($,ee){var et=this.getFileByFdOrThrow($,"ftruncate");et.truncate(ee)};$.prototype.ftruncateSync=function($,ee){this.ftruncateBase($,ee)};$.prototype.ftruncate=function($,ee,et){var en=typeof ee==="number"?ee:0;var ei=e7(typeof ee==="number"?et:ee);this.wrapAsync(this.ftruncateBase,[$,en],ei)};$.prototype.truncateBase=function($,ee){var et=this.openSync($,"r+");try{this.ftruncateSync(et,ee)}finally{this.closeSync(et)}};$.prototype.truncateSync=function($,ee){if(tz($))return this.ftruncateSync($,ee);this.truncateBase($,ee)};$.prototype.truncate=function($,ee,et){var en=typeof ee==="number"?ee:0;var ei=e7(typeof ee==="number"?et:ee);if(tz($))return this.ftruncate($,en,ei);this.wrapAsync(this.truncateBase,[$,en],ei)};$.prototype.futimesBase=function($,ee,et){var en=this.getFileByFdOrThrow($,"futimes");var ei=en.node;ei.atime=new Date(ee*1e3);ei.mtime=new Date(et*1e3)};$.prototype.futimesSync=function($,ee,et){this.futimesBase($,t$(ee),t$(et))};$.prototype.futimes=function($,ee,et,en){this.wrapAsync(this.futimesBase,[$,t$(ee),t$(et)],en)};$.prototype.utimesBase=function($,ee,et){var en=this.openSync($,"r+");try{this.futimesBase(en,ee,et)}finally{this.closeSync(en)}};$.prototype.utimesSync=function($,ee,et){this.utimesBase(tC($),t$(ee),t$(et))};$.prototype.utimes=function($,ee,et,en){this.wrapAsync(this.utimesBase,[tC($),t$(ee),t$(et)],en)};$.prototype.mkdirBase=function($,ee){var et=tx($);if(!et.length){throw e4(e0,"mkdir",$)}var en=this.getLinkParentAsDirOrThrow($,"mkdir");var ei=et[et.length-1];if(en.getChild(ei))throw e4(eZ,"mkdir",$);en.createChild(ei,this.createNode(true,ee))};$.prototype.mkdirpBase=function($,ee){var et=tx($);var en=this.root;for(var ei=0;ei<et.length;ei++){var eo=et[ei];if(!en.getNode().isDirectory())throw e4(eJ,"mkdir",en.getPath());var es=en.getChild(eo);if(es){if(es.getNode().isDirectory())en=es;else throw e4(eJ,"mkdir",es.getPath())}else{en=en.createChild(eo,this.createNode(true,ee))}}};$.prototype.mkdirSync=function($,ee){var et=tw(ee);var en=tH(et.mode,511);var ei=tC($);if(et.recursive)this.mkdirpBase(ei,en);else this.mkdirBase(ei,en)};$.prototype.mkdir=function($,ee,et){var en=tw(ee);var ei=e7(typeof ee==="function"?ee:et);var eo=tH(en.mode,511);var es=tC($);if(en.recursive)this.wrapAsync(this.mkdirpBase,[es,eo],ei);else this.wrapAsync(this.mkdirBase,[es,eo],ei)};$.prototype.mkdirpSync=function($,ee){this.mkdirSync($,{mode:ee,recursive:true})};$.prototype.mkdirp=function($,ee,et){var en=typeof ee==="function"?undefined:ee;var ei=e7(typeof ee==="function"?ee:et);this.mkdir($,{mode:en,recursive:true},ei)};$.prototype.mkdtempBase=function($,ee,et){if(et===void 0){et=5}var en=$+this.genRndStr();try{this.mkdirBase(en,511);return e_.strToEncoding(en,ee)}catch(en){if(en.code===eZ){if(et>1)return this.mkdtempBase($,ee,et-1);else throw Error("Could not create temp dir.")}else throw en}};$.prototype.mkdtempSync=function($,ee){var et=tr(ee).encoding;if(!$||typeof $!=="string")throw new TypeError("filename prefix is required");tj($);return this.mkdtempBase($,et)};$.prototype.mkdtemp=function($,ee,et){var en=tn(ee,et),ei=en[0].encoding,eo=en[1];if(!$||typeof $!=="string")throw new TypeError("filename prefix is required");if(!tj($))return;this.wrapAsync(this.mkdtempBase,[$,ei],eo)};$.prototype.rmdirBase=function($,ee){var et=tS(ee);var en=this.getLinkAsDirOrThrow($,"rmdir");if(en.length&&!et.recursive)throw e4(e1,"rmdir",$);this.deleteLink(en)};$.prototype.rmdirSync=function($,ee){this.rmdirBase(tC($),ee)};$.prototype.rmdir=function($,ee,et){var en=tS(ee);var ei=e7(typeof ee==="function"?ee:et);this.wrapAsync(this.rmdirBase,[tC($),en],ei)};$.prototype.fchmodBase=function($,ee){var et=this.getFileByFdOrThrow($,"fchmod");et.chmod(ee)};$.prototype.fchmodSync=function($,ee){this.fchmodBase($,tH(ee))};$.prototype.fchmod=function($,ee,et){this.wrapAsync(this.fchmodBase,[$,tH(ee)],et)};$.prototype.chmodBase=function($,ee){var et=this.openSync($,"r+");try{this.fchmodBase(et,ee)}finally{this.closeSync(et)}};$.prototype.chmodSync=function($,ee){var et=tH(ee);var en=tC($);this.chmodBase(en,et)};$.prototype.chmod=function($,ee,et){var en=tH(ee);var ei=tC($);this.wrapAsync(this.chmodBase,[ei,en],et)};$.prototype.lchmodBase=function($,ee){var et=this.openBase($,eI,0,false);try{this.fchmodBase(et,ee)}finally{this.closeSync(et)}};$.prototype.lchmodSync=function($,ee){var et=tH(ee);var en=tC($);this.lchmodBase(en,et)};$.prototype.lchmod=function($,ee,et){var en=tH(ee);var ei=tC($);this.wrapAsync(this.lchmodBase,[ei,en],et)};$.prototype.fchownBase=function($,ee,et){this.getFileByFdOrThrow($,"fchown").chown(ee,et)};$.prototype.fchownSync=function($,ee,et){tq(ee);tG(et);this.fchownBase($,ee,et)};$.prototype.fchown=function($,ee,et,en){tq(ee);tG(et);this.wrapAsync(this.fchownBase,[$,ee,et],en)};$.prototype.chownBase=function($,ee,et){var en=this.getResolvedLinkOrThrow($,"chown");var ei=en.getNode();ei.chown(ee,et)};$.prototype.chownSync=function($,ee,et){tq(ee);tG(et);this.chownBase(tC($),ee,et)};$.prototype.chown=function($,ee,et,en){tq(ee);tG(et);this.wrapAsync(this.chownBase,[tC($),ee,et],en)};$.prototype.lchownBase=function($,ee,et){this.getLinkOrThrow($,"lchown").getNode().chown(ee,et)};$.prototype.lchownSync=function($,ee,et){tq(ee);tG(et);this.lchownBase(tC($),ee,et)};$.prototype.lchown=function($,ee,et,en){tq(ee);tG(et);this.wrapAsync(this.lchownBase,[tC($),ee,et],en)};$.prototype.watchFile=function($,ee,et){var en=tC($);var ei=ee;var eo=et;if(typeof ei==="function"){eo=ee;ei=null}if(typeof eo!=="function"){throw Error('"watchFile()" requires a listener function')}var es=5007;var eu=true;if(ei&&typeof ei==="object"){if(typeof ei.interval==="number")es=ei.interval;if(typeof ei.persistent==="boolean")eu=ei.persistent}var el=this.statWatchers[en];if(!el){el=new this.StatWatcher;el.start(en,eu,es);this.statWatchers[en]=el}el.addListener("change",eo);return el};$.prototype.unwatchFile=function($,ee){var et=tC($);var en=this.statWatchers[et];if(!en)return;if(typeof ee==="function"){en.removeListener("change",ee)}else{en.removeAllListeners("change")}if(en.listenerCount("change")===0){en.stop();delete this.statWatchers[et]}};$.prototype.createReadStream=function($,ee){return new this.ReadStream($,ee)};$.prototype.createWriteStream=function($,ee){return new this.WriteStream($,ee)};$.prototype.watch=function($,ee,et){var en=tC($);var ei=ee;if(typeof ee==="function"){et=ee;ei=null}var eo=tr(ei),es=eo.persistent,eu=eo.recursive,el=eo.encoding;if(es===undefined)es=true;if(eu===undefined)eu=false;var ef=new this.FSWatcher;ef.start(en,es,eu,el);if(et){ef.addListener("change",et)}return ef};$.fd=2147483647;return $}();ee.Volume=tY;function tK($){$.emit("stop")}var tZ=function($){en(ee,$);function ee(ee){var et=$.call(this)||this;et.onInterval=function(){try{var $=et.vol.statSync(et.filename);if(et.hasChanged($)){et.emit("change",$,et.prev);et.prev=$}}finally{et.loop()}};et.vol=ee;return et}ee.prototype.loop=function(){this.timeoutRef=this.setTimeout(this.onInterval,this.interval)};ee.prototype.hasChanged=function($){if($.mtimeMs>this.prev.mtimeMs)return true;if($.nlink!==this.prev.nlink)return true;return false};ee.prototype.start=function($,ee,et){if(ee===void 0){ee=true}if(et===void 0){et=5007}this.filename=tC($);this.setTimeout=ee?setTimeout:eh.default;this.interval=et;this.prev=this.vol.statSync(this.filename);this.loop()};ee.prototype.stop=function(){clearTimeout(this.timeoutRef);ep.default.nextTick(tK,this)};return ee}(em.EventEmitter);ee.StatWatcher=tZ;var tJ;function tX($){tJ=ef.bufferAllocUnsafe($);tJ.used=0}eE.inherits(tQ,ey.Readable);ee.ReadStream=tQ;function tQ($,ee,et){if(!(this instanceof tQ))return new tQ($,ee,et);this._vol=$;et=Object.assign({},e5(et,{}));if(et.highWaterMark===undefined)et.highWaterMark=64*1024;ey.Readable.call(this,et);this.path=tC(ee);this.fd=et.fd===undefined?null:et.fd;this.flags=et.flags===undefined?"r":et.flags;this.mode=et.mode===undefined?438:et.mode;this.start=et.start;this.end=et.end;this.autoClose=et.autoClose===undefined?true:et.autoClose;this.pos=undefined;this.bytesRead=0;if(this.start!==undefined){if(typeof this.start!=="number"){throw new TypeError('"start" option must be a Number')}if(this.end===undefined){this.end=Infinity}else if(typeof this.end!=="number"){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}if(typeof this.fd!=="number")this.open();this.on("end",function(){if(this.autoClose){if(this.destroy)this.destroy()}})}tQ.prototype.open=function(){var $=this;this._vol.open(this.path,this.flags,this.mode,function(ee,et){if(ee){if($.autoClose){if($.destroy)$.destroy()}$.emit("error",ee);return}$.fd=et;$.emit("open",et);$.read()})};tQ.prototype._read=function($){if(typeof this.fd!=="number"){return this.once("open",function(){this._read($)})}if(this.destroyed)return;if(!tJ||tJ.length-tJ.used<eH){tX(this._readableState.highWaterMark)}var ee=tJ;var et=Math.min(tJ.length-tJ.used,$);var en=tJ.used;if(this.pos!==undefined)et=Math.min(this.end-this.pos+1,et);if(et<=0)return this.push(null);var ei=this;this._vol.read(this.fd,tJ,tJ.used,et,this.pos,eo);if(this.pos!==undefined)this.pos+=et;tJ.used+=et;function eo($,et){if($){if(ei.autoClose&&ei.destroy){ei.destroy()}ei.emit("error",$)}else{var eo=null;if(et>0){ei.bytesRead+=et;eo=ee.slice(en,en+et)}ei.push(eo)}}};tQ.prototype._destroy=function($,ee){this.close(function(et){ee($||et)})};tQ.prototype.close=function($){var ee=this;if($)this.once("close",$);if(this.closed||typeof this.fd!=="number"){if(typeof this.fd!=="number"){this.once("open",t0);return}return ep.default.nextTick(function(){return ee.emit("close")})}this.closed=true;this._vol.close(this.fd,function($){if($)ee.emit("error",$);else ee.emit("close")});this.fd=null};function t0($){this.close()}eE.inherits(t6,ey.Writable);ee.WriteStream=t6;function t6($,ee,et){if(!(this instanceof t6))return new t6($,ee,et);this._vol=$;et=Object.assign({},e5(et,{}));ey.Writable.call(this,et);this.path=tC(ee);this.fd=et.fd===undefined?null:et.fd;this.flags=et.flags===undefined?"w":et.flags;this.mode=et.mode===undefined?438:et.mode;this.start=et.start;this.autoClose=et.autoClose===undefined?true:!!et.autoClose;this.pos=undefined;this.bytesWritten=0;if(this.start!==undefined){if(typeof this.start!=="number"){throw new TypeError('"start" option must be a Number')}if(this.start<0){throw new Error('"start" must be >= zero')}this.pos=this.start}if(et.encoding)this.setDefaultEncoding(et.encoding);if(typeof this.fd!=="number")this.open();this.once("finish",function(){if(this.autoClose){this.close()}})}t6.prototype.open=function(){this._vol.open(this.path,this.flags,this.mode,(function($,ee){if($){if(this.autoClose&&this.destroy){this.destroy()}this.emit("error",$);return}this.fd=ee;this.emit("open",ee)}).bind(this))};t6.prototype._write=function($,ee,et){if(!($ instanceof ef.Buffer))return this.emit("error",new Error("Invalid data"));if(typeof this.fd!=="number"){return this.once("open",function(){this._write($,ee,et)})}var en=this;this._vol.write(this.fd,$,0,$.length,this.pos,function($,ee){if($){if(en.autoClose&&en.destroy){en.destroy()}return et($)}en.bytesWritten+=ee;et()});if(this.pos!==undefined)this.pos+=$.length};t6.prototype._writev=function($,ee){if(typeof this.fd!=="number"){return this.once("open",function(){this._writev($,ee)})}var et=this;var en=$.length;var ei=new Array(en);var eo=0;for(var es=0;es<en;es++){var eu=$[es].chunk;ei[es]=eu;eo+=eu.length}var el=ef.Buffer.concat(ei);this._vol.write(this.fd,el,0,el.length,this.pos,function($,en){if($){if(et.destroy)et.destroy();return ee($)}et.bytesWritten+=en;ee()});if(this.pos!==undefined)this.pos+=eo};t6.prototype._destroy=tQ.prototype._destroy;t6.prototype.close=tQ.prototype.close;t6.prototype.destroySoon=t6.prototype.end;var t4=function($){en(ee,$);function ee(ee){var et=$.call(this)||this;et._filename="";et._filenameEncoded="";et._recursive=false;et._encoding=e_.ENCODING_UTF8;et._onNodeChange=function(){et._emit("change")};et._onParentChild=function($){if($.getName()===et._getName()){et._emit("rename")}};et._emit=function($){et.emit("change",$,et._filenameEncoded)};et._persist=function(){et._timer=setTimeout(et._persist,1e6)};et._vol=ee;return et}ee.prototype._getName=function(){return this._steps[this._steps.length-1]};ee.prototype.start=function($,ee,et,en){if(ee===void 0){ee=true}if(et===void 0){et=false}if(en===void 0){en=e_.ENCODING_UTF8}this._filename=tC($);this._steps=tx(this._filename);this._filenameEncoded=e_.strToEncoding(this._filename);this._recursive=et;this._encoding=en;try{this._link=this._vol.getLinkOrThrow(this._filename,"FSWatcher")}catch($){var ei=new Error("watch "+this._filename+" "+$.code);ei.code=$.code;ei.errno=$.code;throw ei}this._link.getNode().on("change",this._onNodeChange);this._link.on("child:add",this._onNodeChange);this._link.on("child:delete",this._onNodeChange);var eo=this._link.parent;if(eo){eo.setMaxListeners(eo.getMaxListeners()+1);eo.on("child:delete",this._onParentChild)}if(ee)this._persist()};ee.prototype.close=function(){clearTimeout(this._timer);this._link.getNode().removeListener("change",this._onNodeChange);var $=this._link.parent;if($){$.removeListener("child:delete",this._onParentChild)}};return ee}(em.EventEmitter);ee.FSWatcher=t4},8012:($,ee,et)=>{"use strict";var en;var ei=et(4155);en={value:true};ee.Z4=ef;en=ed;var eo=ei.platform==="win32";function es($){var ee=$.length-1;if(ee<2){return $}while(eu($,ee)){ee--}return $.substr(0,ee+1)}function eu($,ee){var et=$[ee];return ee>0&&(et==="/"||eo&&et==="\\")}function el($,ee){if(typeof $!=="string"){throw new TypeError("expected a string")}$=$.replace(/[\\\/]+/g,"/");if(ee!==false){$=es($)}return $}function ef($){var ee=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;if(eo){$=el($,ee);return $.replace(/^([a-zA-Z]+:|\.\/)/,"")}return $}function ed($){return ef($.replace(/^\\\\\?\\.:\\/,"\\"))}},4657:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});var et=ee.fsProps=["constants","F_OK","R_OK","W_OK","X_OK","Stats"];var en=ee.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"];var ei=ee.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"]},8053:$=>{(function(){const ee=this;const et=$=>new TextEncoder().encode($);function en($,ee){if(typeof $==="string")$=et($);let en=$.length,ei=ee^en,eo=0,es;while(en>=4){es=$[eo]&255|($[++eo]&255)<<8|($[++eo]&255)<<16|($[++eo]&255)<<24;es=(es&65535)*1540483477+(((es>>>16)*1540483477&65535)<<16);es^=es>>>24;es=(es&65535)*1540483477+(((es>>>16)*1540483477&65535)<<16);ei=(ei&65535)*1540483477+(((ei>>>16)*1540483477&65535)<<16)^es;en-=4;++eo}switch(en){case 3:ei^=($[eo+2]&255)<<16;case 2:ei^=($[eo+1]&255)<<8;case 1:ei^=$[eo]&255;ei=(ei&65535)*1540483477+(((ei>>>16)*1540483477&65535)<<16)}ei^=ei>>>13;ei=(ei&65535)*1540483477+(((ei>>>16)*1540483477&65535)<<16);ei^=ei>>>15;return ei>>>0};function ei($,ee){if(typeof $==="string")$=et($);let en,ei,eo,es,eu,el,ef,ed,ep,eh;en=$.length&3;ei=$.length-en;eo=ee;eu=3432918353;ef=461845907;eh=0;while(eh<ei){ep=$[eh]&255|($[++eh]&255)<<8|($[++eh]&255)<<16|($[++eh]&255)<<24;++eh;ep=(ep&65535)*eu+(((ep>>>16)*eu&65535)<<16)&4294967295;ep=ep<<15|ep>>>17;ep=(ep&65535)*ef+(((ep>>>16)*ef&65535)<<16)&4294967295;eo^=ep;eo=eo<<13|eo>>>19;es=(eo&65535)*5+(((eo>>>16)*5&65535)<<16)&4294967295;eo=(es&65535)+27492+(((es>>>16)+58964&65535)<<16)}ep=0;switch(en){case 3:ep^=($[eh+2]&255)<<16;case 2:ep^=($[eh+1]&255)<<8;case 1:ep^=$[eh]&255;ep=(ep&65535)*eu+(((ep>>>16)*eu&65535)<<16)&4294967295;ep=ep<<15|ep>>>17;ep=(ep&65535)*ef+(((ep>>>16)*ef&65535)<<16)&4294967295;eo^=ep}eo^=$.length;eo^=eo>>>16;eo=(eo&65535)*2246822507+(((eo>>>16)*2246822507&65535)<<16)&4294967295;eo^=eo>>>13;eo=(eo&65535)*3266489909+(((eo>>>16)*3266489909&65535)<<16)&4294967295;eo^=eo>>>16;return eo>>>0}const eo=ei;eo.v2=en;eo.v3=ei;if(true){$.exports=eo}else{}})()},631:($,ee,et)=>{var en=typeof Map==="function"&&Map.prototype;var ei=Object.getOwnPropertyDescriptor&&en?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null;var eo=en&&ei&&typeof ei.get==="function"?ei.get:null;var es=en&&Map.prototype.forEach;var eu=typeof Set==="function"&&Set.prototype;var el=Object.getOwnPropertyDescriptor&&eu?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null;var ef=eu&&el&&typeof el.get==="function"?el.get:null;var ed=eu&&Set.prototype.forEach;var ep=typeof WeakMap==="function"&&WeakMap.prototype;var eh=ep?WeakMap.prototype.has:null;var ey=typeof WeakSet==="function"&&WeakSet.prototype;var eg=ey?WeakSet.prototype.has:null;var em=typeof WeakRef==="function"&&WeakRef.prototype;var e_=em?WeakRef.prototype.deref:null;var ew=Boolean.prototype.valueOf;var eE=Object.prototype.toString;var eS=Function.prototype.toString;var eT=String.prototype.match;var eO=String.prototype.slice;var eA=String.prototype.replace;var eI=String.prototype.toUpperCase;var eN=String.prototype.toLowerCase;var eD=RegExp.prototype.test;var eR=Array.prototype.concat;var eC=Array.prototype.join;var ek=Array.prototype.slice;var eM=Math.floor;var eL=typeof BigInt==="function"?BigInt.prototype.valueOf:null;var eP=Object.getOwnPropertySymbols;var eF=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?Symbol.prototype.toString:null;var eB=typeof Symbol==="function"&&typeof Symbol.iterator==="object";var eU=typeof Symbol==="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===eB?"object":"symbol")?Symbol.toStringTag:null;var ej=Object.prototype.propertyIsEnumerable;var eW=(typeof Reflect==="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function($){return $.__proto__}:null);function eH($,ee){if($===Infinity||$===-Infinity||$!==$||$&&$>-1e3&&$<1e3||eD.call(/e/,ee)){return ee}var et=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof $==="number"){var en=$<0?-eM(-$):eM($);if(en!==$){var ei=String(en);var eo=eO.call(ee,ei.length+1);return eA.call(ei,et,"$&_")+"."+eA.call(eA.call(eo,/([0-9]{3})/g,"$&_"),/_$/,"")}}return eA.call(ee,et,"$&_")}var ez=et(4654);var eV=ez.custom;var e$=e1(eV)?eV:null;$.exports=function $(ee,et,en,ei){var eu=et||{};if(e4(eu,"quoteStyle")&&eu.quoteStyle!=="single"&&eu.quoteStyle!=="double"){throw new TypeError('option "quoteStyle" must be "single" or "double"')}if(e4(eu,"maxStringLength")&&(typeof eu.maxStringLength==="number"?eu.maxStringLength<0&&eu.maxStringLength!==Infinity:eu.maxStringLength!==null)){throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`')}var el=e4(eu,"customInspect")?eu.customInspect:true;if(typeof el!=="boolean"&&el!=="symbol"){throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`")}if(e4(eu,"indent")&&eu.indent!==null&&eu.indent!==" "&&!(parseInt(eu.indent,10)===eu.indent&&eu.indent>0)){throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`')}if(e4(eu,"numericSeparator")&&typeof eu.numericSeparator!=="boolean"){throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`')}var ep=eu.numericSeparator;if(typeof ee==="undefined"){return"undefined"}if(ee===null){return"null"}if(typeof ee==="boolean"){return ee?"true":"false"}if(typeof ee==="string"){return ti(ee,eu)}if(typeof ee==="number"){if(ee===0){return Infinity/ee>0?"0":"-0"}var eh=String(ee);return ep?eH(ee,eh):eh}if(typeof ee==="bigint"){var ey=String(ee)+"n";return ep?eH(ee,ey):ey}var eg=typeof eu.depth==="undefined"?5:eu.depth;if(typeof en==="undefined"){en=0}if(en>=eg&&eg>0&&typeof ee==="object"){return eY(ee)?"[Array]":"[Object]"}var em=th(eu,en);if(typeof ei==="undefined"){ei=[]}else if(e5(ei,ee)>=0){return"[Circular]"}function e_(ee,et,eo){if(et){ei=ek.call(ei);ei.push(et)}if(eo){var es={depth:eu.depth};if(e4(eu,"quoteStyle")){es.quoteStyle=eu.quoteStyle}return $(ee,es,en+1,ei)}return $(ee,eu,en+1,ei)}if(typeof ee==="function"&&!eZ(ee)){var eE=e8(ee);var eS=tm(ee,e_);return"[Function"+(eE?": "+eE:" (anonymous)")+"]"+(eS.length>0?" { "+eC.call(eS,", ")+" }":"")}if(e1(ee)){var eT=eB?eA.call(String(ee),/^(Symbol\(.*\))_[^)]*$/,"$1"):eF.call(ee);return typeof ee==="object"&&!eB?tc(eT):eT}if(tn(ee)){var eI="<"+eN.call(String(ee.nodeName));var eD=ee.attributes||[];for(var eM=0;eM<eD.length;eM++){eI+=" "+eD[eM].name+"="+eq(eG(eD[eM].value),"double",eu)}eI+=">";if(ee.childNodes&&ee.childNodes.length){eI+="..."}eI+="</"+eN.call(String(ee.nodeName))+">";return eI}if(eY(ee)){if(ee.length===0){return"[]"}var eP=tm(ee,e_);if(em&&!tp(eP)){return"["+ty(eP,em)+"]"}return"[ "+eC.call(eP,", ")+" ]"}if(eJ(ee)){var eV=tm(ee,e_);if(!("cause"in Error.prototype)&&"cause"in ee&&!ej.call(ee,"cause")){return"{ ["+String(ee)+"] "+eC.call(eR.call("[cause]: "+e_(ee.cause),eV),", ")+" }"}if(eV.length===0){return"["+String(ee)+"]"}return"{ ["+String(ee)+"] "+eC.call(eV,", ")+" }"}if(typeof ee==="object"&&el){if(e$&&typeof ee[e$]==="function"&&ez){return ez(ee,{depth:eg-en})}else if(el!=="symbol"&&typeof ee.inspect==="function"){return ee.inspect()}}if(e9(ee)){var e6=[];if(es){es.call(ee,function($,et){e6.push(e_(et,ee,true)+" => "+e_($,ee))})}return td("Map",eo.call(ee),e6,em)}if(tt(ee)){var tu=[];if(ed){ed.call(ee,function($){tu.push(e_($,ee))})}return td("Set",ef.call(ee),tu,em)}if(e7(ee)){return tf("WeakMap")}if(tr(ee)){return tf("WeakSet")}if(te(ee)){return tf("WeakRef")}if(eQ(ee)){return tc(e_(Number(ee)))}if(e2(ee)){return tc(e_(eL.call(ee)))}if(e0(ee)){return tc(ew.call(ee))}if(eX(ee)){return tc(e_(String(ee)))}if(!eK(ee)&&!eZ(ee)){var t_=tm(ee,e_);var tv=eW?eW(ee)===Object.prototype:ee instanceof Object||ee.constructor===Object;var tw=ee instanceof Object?"":"null prototype";var tE=!tv&&eU&&Object(ee)===ee&&eU in ee?eO.call(e3(ee),8,-1):tw?"Object":"";var tS=tv||typeof ee.constructor!=="function"?"":ee.constructor.name?ee.constructor.name+" ":"";var tT=tS+(tE||tw?"["+eC.call(eR.call([],tE||[],tw||[]),": ")+"] ":"");if(t_.length===0){return tT+"{}"}if(em){return tT+"{"+ty(t_,em)+"}"}return tT+"{ "+eC.call(t_,", ")+" }"}return String(ee)};function eq($,ee,et){var en=(et.quoteStyle||ee)==="double"?'"':"'";return en+$+en}function eG($){return eA.call(String($),/"/g,""")}function eY($){return e3($)==="[object Array]"&&(!eU||!(typeof $==="object"&&eU in $))}function eK($){return e3($)==="[object Date]"&&(!eU||!(typeof $==="object"&&eU in $))}function eZ($){return e3($)==="[object RegExp]"&&(!eU||!(typeof $==="object"&&eU in $))}function eJ($){return e3($)==="[object Error]"&&(!eU||!(typeof $==="object"&&eU in $))}function eX($){return e3($)==="[object String]"&&(!eU||!(typeof $==="object"&&eU in $))}function eQ($){return e3($)==="[object Number]"&&(!eU||!(typeof $==="object"&&eU in $))}function e0($){return e3($)==="[object Boolean]"&&(!eU||!(typeof $==="object"&&eU in $))}function e1($){if(eB){return $&&typeof $==="object"&&$ instanceof Symbol}if(typeof $==="symbol"){return true}if(!$||typeof $!=="object"||!eF){return false}try{eF.call($);return true}catch($){}return false}function e2($){if(!$||typeof $!=="object"||!eL){return false}try{eL.call($);return true}catch($){}return false}var e6=Object.prototype.hasOwnProperty||function($){return $ in this};function e4($,ee){return e6.call($,ee)}function e3($){return eE.call($)}function e8($){if($.name){return $.name}var ee=eT.call(eS.call($),/^function\s*([\w$]+)/);if(ee){return ee[1]}return null}function e5($,ee){if($.indexOf){return $.indexOf(ee)}for(var et=0,en=$.length;et<en;et++){if($[et]===ee){return et}}return-1}function e9($){if(!eo||!$||typeof $!=="object"){return false}try{eo.call($);try{ef.call($)}catch($){return true}return $ instanceof Map}catch($){}return false}function e7($){if(!eh||!$||typeof $!=="object"){return false}try{eh.call($,eh);try{eg.call($,eg)}catch($){return true}return $ instanceof WeakMap}catch($){}return false}function te($){if(!e_||!$||typeof $!=="object"){return false}try{e_.call($);return true}catch($){}return false}function tt($){if(!ef||!$||typeof $!=="object"){return false}try{ef.call($);try{eo.call($)}catch($){return true}return $ instanceof Set}catch($){}return false}function tr($){if(!eg||!$||typeof $!=="object"){return false}try{eg.call($,eg);try{eh.call($,eh)}catch($){return true}return $ instanceof WeakSet}catch($){}return false}function tn($){if(!$||typeof $!=="object"){return false}if(typeof HTMLElement!=="undefined"&&$ instanceof HTMLElement){return true}return typeof $.nodeName==="string"&&typeof $.getAttribute==="function"}function ti($,ee){if($.length>ee.maxStringLength){var et=$.length-ee.maxStringLength;var en="... "+et+" more character"+(et>1?"s":"");return ti(eO.call($,0,ee.maxStringLength),ee)+en}var ei=eA.call(eA.call($,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,tu);return eq(ei,"single",ee)}function tu($){var ee=$.charCodeAt(0);var et={8:"b",9:"t",10:"n",12:"f",13:"r"}[ee];if(et){return"\\"+et}return"\\x"+(ee<16?"0":"")+eI.call(ee.toString(16))}function tc($){return"Object("+$+")"}function tf($){return $+" { ? }"}function td($,ee,et,en){var ei=en?ty(et,en):eC.call(et,", ");return $+" ("+ee+") {"+ei+"}"}function tp($){for(var ee=0;ee<$.length;ee++){if(e5($[ee],"\n")>=0){return false}}return true}function th($,ee){var et;if($.indent===" "){et=" "}else if(typeof $.indent==="number"&&$.indent>0){et=eC.call(Array($.indent+1)," ")}else{return null}return{base:et,prev:eC.call(Array(ee+1),et)}}function ty($,ee){if($.length===0){return""}var et="\n"+ee.prev+ee.base;return et+eC.call($,","+et)+"\n"+ee.prev}function tm($,ee){var et=eY($);var en=[];if(et){en.length=$.length;for(var ei=0;ei<$.length;ei++){en[ei]=e4($,ei)?ee($[ei],$):""}}var eo=typeof eP==="function"?eP($):[];var es;if(eB){es={};for(var eu=0;eu<eo.length;eu++){es["$"+eo[eu]]=eo[eu]}}for(var el in $){if(!e4($,el)){continue}if(et&&String(Number(el))===el&&el<$.length){continue}if(eB&&es["$"+el]instanceof Symbol){continue}else if(eD.call(/[^\w$]/,el)){en.push(ee(el,$)+": "+ee($[el],$))}else{en.push(el+": "+ee($[el],$))}}if(typeof eP==="function"){for(var ef=0;ef<eo.length;ef++){if(ej.call($,eo[ef])){en.push("["+ee(eo[ef])+"]: "+ee($[eo[ef]],$))}}}return en}},4244:$=>{"use strict";var ee=function($){return $!==$};$.exports=function $($,et){if($===0&&et===0){return 1/$===1/et}if($===et){return true}if(ee($)&&ee(et)){return true}return false}},609:($,ee,et)=>{"use strict";var en=et(4289);var ei=et(5559);var eo=et(4244);var es=et(5624);var eu=et(2281);var el=ei(es(),Object);en(el,{getPolyfill:es,implementation:eo,shim:eu});$.exports=el},5624:($,ee,et)=>{"use strict";var en=et(4244);$.exports=function $(){return typeof Object.is==="function"?Object.is:en}},2281:($,ee,et)=>{"use strict";var en=et(5624);var ei=et(4289);$.exports=function $(){var $=en();ei(Object,{is:$},{is:function ee(){return Object.is!==$}});return $}},8987:($,ee,et)=>{"use strict";var en;if(!Object.keys){var ei=Object.prototype.hasOwnProperty;var eo=Object.prototype.toString;var es=et(1414);var eu=Object.prototype.propertyIsEnumerable;var el=!eu.call({toString:null},"toString");var ef=eu.call(function(){},"prototype");var ed=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var ep=function($){var ee=$.constructor;return ee&&ee.prototype===$};var eh={$applicationCache:true,$console:true,$external:true,$frame:true,$frameElement:true,$frames:true,$innerHeight:true,$innerWidth:true,$onmozfullscreenchange:true,$onmozfullscreenerror:true,$outerHeight:true,$outerWidth:true,$pageXOffset:true,$pageYOffset:true,$parent:true,$scrollLeft:true,$scrollTop:true,$scrollX:true,$scrollY:true,$self:true,$webkitIndexedDB:true,$webkitStorageInfo:true,$window:true};var ey=function(){if(typeof window==="undefined"){return false}for(var $ in window){try{if(!eh["$"+$]&&ei.call(window,$)&&window[$]!==null&&typeof window[$]==="object"){try{ep(window[$])}catch($){return true}}}catch($){return true}}return false}();var eg=function($){if(typeof window==="undefined"||!ey){return ep($)}try{return ep($)}catch($){return false}};en=function $($){var ee=$!==null&&typeof $==="object";var et=eo.call($)==="[object Function]";var en=es($);var eu=ee&&eo.call($)==="[object String]";var ep=[];if(!ee&&!et&&!en){throw new TypeError("Object.keys called on a non-object")}var eh=ef&&et;if(eu&&$.length>0&&!ei.call($,0)){for(var ey=0;ey<$.length;++ey){ep.push(String(ey))}}if(en&&$.length>0){for(var em=0;em<$.length;++em){ep.push(String(em))}}else{for(var e_ in $){if(!(eh&&e_==="prototype")&&ei.call($,e_)){ep.push(String(e_))}}}if(el){var ew=eg($);for(var eE=0;eE<ed.length;++eE){if(!(ew&&ed[eE]==="constructor")&&ei.call($,ed[eE])){ep.push(ed[eE])}}}return ep}}$.exports=en},2215:($,ee,et)=>{"use strict";var en=Array.prototype.slice;var ei=et(1414);var eo=Object.keys;var es=eo?function $($){return eo($)}:et(8987);var eu=Object.keys;es.shim=function $(){if(Object.keys){var $=function(){var $=Object.keys(arguments);return $&&$.length===arguments.length}(1,2);if(!$){Object.keys=function $($){if(ei($)){return eu(en.call($))}return eu($)}}}else{Object.keys=es}return Object.keys||es};$.exports=es},1414:$=>{"use strict";var ee=Object.prototype.toString;$.exports=function $($){var et=ee.call($);var en=et==="[object Arguments]";if(!en){en=et!=="[object Array]"&&$!==null&&typeof $==="object"&&typeof $.length==="number"&&$.length>=0&&ee.call($.callee)==="[object Function]"}return en}},2837:($,ee,et)=>{"use strict";var en=et(2215);var ei=et(5419)();var eo=et(1924);var es=Object;var eu=eo("Array.prototype.push");var el=eo("Object.prototype.propertyIsEnumerable");var ef=ei?Object.getOwnPropertySymbols:null;$.exports=function $($,ee){if($==null){throw new TypeError("target must be an object")}var et=es($);if(arguments.length===1){return et}for(var eo=1;eo<arguments.length;++eo){var ed=es(arguments[eo]);var ep=en(ed);var eh=ei&&(Object.getOwnPropertySymbols||ef);if(eh){var ey=eh(ed);for(var eg=0;eg<ey.length;++eg){var em=ey[eg];if(el(ed,em)){eu(ep,em)}}}for(var e_=0;e_<ep.length;++e_){var ew=ep[e_];if(el(ed,ew)){var eE=ed[ew];et[ew]=eE}}}return et}},3533:($,ee,et)=>{"use strict";var en=et(4289);var ei=et(5559);var eo=et(2837);var es=et(8162);var eu=et(4489);var el=ei.apply(es());var ef=function $($,ee){return el(Object,arguments)};en(ef,{getPolyfill:es,implementation:eo,shim:eu});$.exports=ef},8162:($,ee,et)=>{"use strict";var en=et(2837);var ei=function(){if(!Object.assign){return false}var $="abcdefghijklmnopqrst";var ee=$.split("");var et={};for(var en=0;en<ee.length;++en){et[ee[en]]=ee[en]}var ei=Object.assign({},et);var eo="";for(var es in ei){eo+=es}return $!==eo};var eo=function(){if(!Object.assign||!Object.preventExtensions){return false}var $=Object.preventExtensions({1:2});try{Object.assign($,"xy")}catch(ee){return $[1]==="y"}return false};$.exports=function $(){if(!Object.assign){return en}if(ei()){return en}if(eo()){return en}return Object.assign}},4489:($,ee,et)=>{"use strict";var en=et(4289);var ei=et(8162);$.exports=function $(){var $=ei();en(Object,{assign:$},{assign:function(){return Object.assign!==$}});return $}},4236:($,ee)=>{"use strict";var et=typeof Uint8Array!=="undefined"&&typeof Uint16Array!=="undefined"&&typeof Int32Array!=="undefined";function en($,ee){return Object.prototype.hasOwnProperty.call($,ee)}ee.assign=function($){var ee=Array.prototype.slice.call(arguments,1);while(ee.length){var et=ee.shift();if(!et){continue}if(typeof et!=="object"){throw new TypeError(et+"must be non-object")}for(var ei in et){if(en(et,ei)){$[ei]=et[ei]}}}return $};ee.shrinkBuf=function($,ee){if($.length===ee){return $}if($.subarray){return $.subarray(0,ee)}$.length=ee;return $};var ei={arraySet:function($,ee,et,en,ei){if(ee.subarray&&$.subarray){$.set(ee.subarray(et,et+en),ei);return}for(var eo=0;eo<en;eo++){$[ei+eo]=ee[et+eo]}},flattenChunks:function($){var ee,et,en,ei,eo,es;en=0;for(ee=0,et=$.length;ee<et;ee++){en+=$[ee].length}es=new Uint8Array(en);ei=0;for(ee=0,et=$.length;ee<et;ee++){eo=$[ee];es.set(eo,ei);ei+=eo.length}return es}};var eo={arraySet:function($,ee,et,en,ei){for(var eo=0;eo<en;eo++){$[ei+eo]=ee[et+eo]}},flattenChunks:function($){return[].concat.apply([],$)}};ee.setTyped=function($){if($){ee.Buf8=Uint8Array;ee.Buf16=Uint16Array;ee.Buf32=Int32Array;ee.assign(ee,ei)}else{ee.Buf8=Array;ee.Buf16=Array;ee.Buf32=Array;ee.assign(ee,eo)}};ee.setTyped(et)},6069:$=>{"use strict";function ee($,ee,et,en){var ei=$&65535|0,eo=$>>>16&65535|0,es=0;while(et!==0){es=et>2e3?2e3:et;et-=es;do{ei=ei+ee[en++]|0;eo=eo+ei|0}while(--es)ei%=65521;eo%=65521}return ei|eo<<16|0}$.exports=ee},1619:$=>{"use strict";$.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}},2869:$=>{"use strict";function ee(){var $,ee=[];for(var et=0;et<256;et++){$=et;for(var en=0;en<8;en++){$=$&1?3988292384^$>>>1:$>>>1}ee[et]=$}return ee}var et=ee();function en($,ee,en,ei){var eo=et,es=ei+en;$^=-1;for(var eu=ei;eu<es;eu++){$=$>>>8^eo[($^ee[eu])&255]}return $^-1}$.exports=en},405:($,ee,et)=>{"use strict";var en=et(4236);var ei=et(342);var eo=et(6069);var es=et(2869);var eu=et(8898);var el=0;var ef=1;var ed=3;var ep=4;var eh=5;var ey=0;var eg=1;var em=-2;var e_=-3;var ew=-5;var eE=-1;var eS=1;var eT=2;var eO=3;var eA=4;var eI=0;var eN=2;var eD=8;var eR=9;var eC=15;var ek=8;var eM=29;var eL=256;var eP=eL+1+eM;var eF=30;var eB=19;var eU=2*eP+1;var ej=15;var eW=3;var eH=258;var ez=eH+eW+1;var eV=32;var e$=42;var eq=69;var eG=73;var eY=91;var eK=103;var eZ=113;var eJ=666;var eX=1;var eQ=2;var e0=3;var e1=4;var e2=3;function e6($,ee){$.msg=eu[ee];return ee}function e4($){return($<<1)-($>4?9:0)}function e3($){var ee=$.length;while(--ee>=0){$[ee]=0}}function e8($){var ee=$.state;var et=ee.pending;if(et>$.avail_out){et=$.avail_out}if(et===0){return}en.arraySet($.output,ee.pending_buf,ee.pending_out,et,$.next_out);$.next_out+=et;ee.pending_out+=et;$.total_out+=et;$.avail_out-=et;ee.pending-=et;if(ee.pending===0){ee.pending_out=0}}function e5($,ee){ei._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,ee);$.block_start=$.strstart;e8($.strm)}function e9($,ee){$.pending_buf[$.pending++]=ee}function e7($,ee){$.pending_buf[$.pending++]=ee>>>8&255;$.pending_buf[$.pending++]=ee&255}function te($,ee,et,ei){var eu=$.avail_in;if(eu>ei){eu=ei}if(eu===0){return 0}$.avail_in-=eu;en.arraySet(ee,$.input,$.next_in,eu,et);if($.state.wrap===1){$.adler=eo($.adler,ee,eu,et)}else if($.state.wrap===2){$.adler=es($.adler,ee,eu,et)}$.next_in+=eu;$.total_in+=eu;return eu}function tt($,ee){var et=$.max_chain_length;var en=$.strstart;var ei;var eo;var es=$.prev_length;var eu=$.nice_match;var el=$.strstart>$.w_size-ez?$.strstart-($.w_size-ez):0;var ef=$.window;var ed=$.w_mask;var ep=$.prev;var eh=$.strstart+eH;var ey=ef[en+es-1];var eg=ef[en+es];if($.prev_length>=$.good_match){et>>=2}if(eu>$.lookahead){eu=$.lookahead}do{ei=ee;if(ef[ei+es]!==eg||ef[ei+es-1]!==ey||ef[ei]!==ef[en]||ef[++ei]!==ef[en+1]){continue}en+=2;ei++;do{}while(ef[++en]===ef[++ei]&&ef[++en]===ef[++ei]&&ef[++en]===ef[++ei]&&ef[++en]===ef[++ei]&&ef[++en]===ef[++ei]&&ef[++en]===ef[++ei]&&ef[++en]===ef[++ei]&&ef[++en]===ef[++ei]&&en<eh)eo=eH-(eh-en);en=eh-eH;if(eo>es){$.match_start=ee;es=eo;if(eo>=eu){break}ey=ef[en+es-1];eg=ef[en+es]}}while((ee=ep[ee&ed])>el&&--et!==0)if(es<=$.lookahead){return es}return $.lookahead}function tr($){var ee=$.w_size;var et,ei,eo,es,eu;do{es=$.window_size-$.lookahead-$.strstart;if($.strstart>=ee+(ee-ez)){en.arraySet($.window,$.window,ee,ee,0);$.match_start-=ee;$.strstart-=ee;$.block_start-=ee;ei=$.hash_size;et=ei;do{eo=$.head[--et];$.head[et]=eo>=ee?eo-ee:0}while(--ei)ei=ee;et=ei;do{eo=$.prev[--et];$.prev[et]=eo>=ee?eo-ee:0}while(--ei)es+=ee}if($.strm.avail_in===0){break}ei=te($.strm,$.window,$.strstart+$.lookahead,es);$.lookahead+=ei;if($.lookahead+$.insert>=eW){eu=$.strstart-$.insert;$.ins_h=$.window[eu];$.ins_h=($.ins_h<<$.hash_shift^$.window[eu+1])&$.hash_mask;while($.insert){$.ins_h=($.ins_h<<$.hash_shift^$.window[eu+eW-1])&$.hash_mask;$.prev[eu&$.w_mask]=$.head[$.ins_h];$.head[$.ins_h]=eu;eu++;$.insert--;if($.lookahead+$.insert<eW){break}}}}while($.lookahead<ez&&$.strm.avail_in!==0)}function tn($,ee){var et=65535;if(et>$.pending_buf_size-5){et=$.pending_buf_size-5}for(;;){if($.lookahead<=1){tr($);if($.lookahead===0&&ee===el){return eX}if($.lookahead===0){break}}$.strstart+=$.lookahead;$.lookahead=0;var en=$.block_start+et;if($.strstart===0||$.strstart>=en){$.lookahead=$.strstart-en;$.strstart=en;e5($,false);if($.strm.avail_out===0){return eX}}if($.strstart-$.block_start>=$.w_size-ez){e5($,false);if($.strm.avail_out===0){return eX}}}$.insert=0;if(ee===ep){e5($,true);if($.strm.avail_out===0){return e0}return e1}if($.strstart>$.block_start){e5($,false);if($.strm.avail_out===0){return eX}}return eX}function ti($,ee){var et;var en;for(;;){if($.lookahead<ez){tr($);if($.lookahead<ez&&ee===el){return eX}if($.lookahead===0){break}}et=0;if($.lookahead>=eW){$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+eW-1])&$.hash_mask;et=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h];$.head[$.ins_h]=$.strstart}if(et!==0&&$.strstart-et<=$.w_size-ez){$.match_length=tt($,et)}if($.match_length>=eW){en=ei._tr_tally($,$.strstart-$.match_start,$.match_length-eW);$.lookahead-=$.match_length;if($.match_length<=$.max_lazy_match&&$.lookahead>=eW){$.match_length--;do{$.strstart++;$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+eW-1])&$.hash_mask;et=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h];$.head[$.ins_h]=$.strstart}while(--$.match_length!==0)$.strstart++}else{$.strstart+=$.match_length;$.match_length=0;$.ins_h=$.window[$.strstart];$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask}}else{en=ei._tr_tally($,0,$.window[$.strstart]);$.lookahead--;$.strstart++}if(en){e5($,false);if($.strm.avail_out===0){return eX}}}$.insert=$.strstart<eW-1?$.strstart:eW-1;if(ee===ep){e5($,true);if($.strm.avail_out===0){return e0}return e1}if($.last_lit){e5($,false);if($.strm.avail_out===0){return eX}}return eQ}function tu($,ee){var et;var en;var eo;for(;;){if($.lookahead<ez){tr($);if($.lookahead<ez&&ee===el){return eX}if($.lookahead===0){break}}et=0;if($.lookahead>=eW){$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+eW-1])&$.hash_mask;et=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h];$.head[$.ins_h]=$.strstart}$.prev_length=$.match_length;$.prev_match=$.match_start;$.match_length=eW-1;if(et!==0&&$.prev_length<$.max_lazy_match&&$.strstart-et<=$.w_size-ez){$.match_length=tt($,et);if($.match_length<=5&&($.strategy===eS||$.match_length===eW&&$.strstart-$.match_start>4096)){$.match_length=eW-1}}if($.prev_length>=eW&&$.match_length<=$.prev_length){eo=$.strstart+$.lookahead-eW;en=ei._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-eW);$.lookahead-=$.prev_length-1;$.prev_length-=2;do{if(++$.strstart<=eo){$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+eW-1])&$.hash_mask;et=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h];$.head[$.ins_h]=$.strstart}}while(--$.prev_length!==0)$.match_available=0;$.match_length=eW-1;$.strstart++;if(en){e5($,false);if($.strm.avail_out===0){return eX}}}else if($.match_available){en=ei._tr_tally($,0,$.window[$.strstart-1]);if(en){e5($,false)}$.strstart++;$.lookahead--;if($.strm.avail_out===0){return eX}}else{$.match_available=1;$.strstart++;$.lookahead--}}if($.match_available){en=ei._tr_tally($,0,$.window[$.strstart-1]);$.match_available=0}$.insert=$.strstart<eW-1?$.strstart:eW-1;if(ee===ep){e5($,true);if($.strm.avail_out===0){return e0}return e1}if($.last_lit){e5($,false);if($.strm.avail_out===0){return eX}}return eQ}function tc($,ee){var et;var en;var eo,es;var eu=$.window;for(;;){if($.lookahead<=eH){tr($);if($.lookahead<=eH&&ee===el){return eX}if($.lookahead===0){break}}$.match_length=0;if($.lookahead>=eW&&$.strstart>0){eo=$.strstart-1;en=eu[eo];if(en===eu[++eo]&&en===eu[++eo]&&en===eu[++eo]){es=$.strstart+eH;do{}while(en===eu[++eo]&&en===eu[++eo]&&en===eu[++eo]&&en===eu[++eo]&&en===eu[++eo]&&en===eu[++eo]&&en===eu[++eo]&&en===eu[++eo]&&eo<es)$.match_length=eH-(es-eo);if($.match_length>$.lookahead){$.match_length=$.lookahead}}}if($.match_length>=eW){et=ei._tr_tally($,1,$.match_length-eW);$.lookahead-=$.match_length;$.strstart+=$.match_length;$.match_length=0}else{et=ei._tr_tally($,0,$.window[$.strstart]);$.lookahead--;$.strstart++}if(et){e5($,false);if($.strm.avail_out===0){return eX}}}$.insert=0;if(ee===ep){e5($,true);if($.strm.avail_out===0){return e0}return e1}if($.last_lit){e5($,false);if($.strm.avail_out===0){return eX}}return eQ}function tf($,ee){var et;for(;;){if($.lookahead===0){tr($);if($.lookahead===0){if(ee===el){return eX}break}}$.match_length=0;et=ei._tr_tally($,0,$.window[$.strstart]);$.lookahead--;$.strstart++;if(et){e5($,false);if($.strm.avail_out===0){return eX}}}$.insert=0;if(ee===ep){e5($,true);if($.strm.avail_out===0){return e0}return e1}if($.last_lit){e5($,false);if($.strm.avail_out===0){return eX}}return eQ}function td($,ee,et,en,ei){this.good_length=$;this.max_lazy=ee;this.nice_length=et;this.max_chain=en;this.func=ei}var tp;tp=[new td(0,0,0,0,tn),new td(4,4,8,4,ti),new td(4,5,16,8,ti),new td(4,6,32,32,ti),new td(4,4,16,16,tu),new td(8,16,32,32,tu),new td(8,16,128,128,tu),new td(8,32,128,256,tu),new td(32,128,258,1024,tu),new td(32,258,258,4096,tu)];function th($){$.window_size=2*$.w_size;e3($.head);$.max_lazy_match=tp[$.level].max_lazy;$.good_match=tp[$.level].good_length;$.nice_match=tp[$.level].nice_length;$.max_chain_length=tp[$.level].max_chain;$.strstart=0;$.block_start=0;$.lookahead=0;$.insert=0;$.match_length=$.prev_length=eW-1;$.match_available=0;$.ins_h=0}function ty(){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=eD;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 en.Buf16(eU*2);this.dyn_dtree=new en.Buf16((2*eF+1)*2);this.bl_tree=new en.Buf16((2*eB+1)*2);e3(this.dyn_ltree);e3(this.dyn_dtree);e3(this.bl_tree);this.l_desc=null;this.d_desc=null;this.bl_desc=null;this.bl_count=new en.Buf16(ej+1);this.heap=new en.Buf16(2*eP+1);e3(this.heap);this.heap_len=0;this.heap_max=0;this.depth=new en.Buf16(2*eP+1);e3(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 tm($){var ee;if(!$||!$.state){return e6($,em)}$.total_in=$.total_out=0;$.data_type=eN;ee=$.state;ee.pending=0;ee.pending_out=0;if(ee.wrap<0){ee.wrap=-ee.wrap}ee.status=ee.wrap?e$:eZ;$.adler=ee.wrap===2?0:1;ee.last_flush=el;ei._tr_init(ee);return ey}function t_($){var ee=tm($);if(ee===ey){th($.state)}return ee}function tv($,ee){if(!$||!$.state){return em}if($.state.wrap!==2){return em}$.state.gzhead=ee;return ey}function tw($,ee,et,ei,eo,es){if(!$){return em}var eu=1;if(ee===eE){ee=6}if(ei<0){eu=0;ei=-ei}else if(ei>15){eu=2;ei-=16}if(eo<1||eo>eR||et!==eD||ei<8||ei>15||ee<0||ee>9||es<0||es>eA){return e6($,em)}if(ei===8){ei=9}var el=new ty;$.state=el;el.strm=$;el.wrap=eu;el.gzhead=null;el.w_bits=ei;el.w_size=1<<el.w_bits;el.w_mask=el.w_size-1;el.hash_bits=eo+7;el.hash_size=1<<el.hash_bits;el.hash_mask=el.hash_size-1;el.hash_shift=~~((el.hash_bits+eW-1)/eW);el.window=new en.Buf8(el.w_size*2);el.head=new en.Buf16(el.hash_size);el.prev=new en.Buf16(el.w_size);el.lit_bufsize=1<<eo+6;el.pending_buf_size=el.lit_bufsize*4;el.pending_buf=new en.Buf8(el.pending_buf_size);el.d_buf=1*el.lit_bufsize;el.l_buf=(1+2)*el.lit_bufsize;el.level=ee;el.strategy=es;el.method=et;return t_($)}function tE($,ee){return tw($,ee,eD,eC,ek,eI)}function tS($,ee){var et,en;var eo,eu;if(!$||!$.state||ee>eh||ee<0){return $?e6($,em):em}en=$.state;if(!$.output||!$.input&&$.avail_in!==0||en.status===eJ&&ee!==ep){return e6($,$.avail_out===0?ew:em)}en.strm=$;et=en.last_flush;en.last_flush=ee;if(en.status===e$){if(en.wrap===2){$.adler=0;e9(en,31);e9(en,139);e9(en,8);if(!en.gzhead){e9(en,0);e9(en,0);e9(en,0);e9(en,0);e9(en,0);e9(en,en.level===9?2:en.strategy>=eT||en.level<2?4:0);e9(en,e2);en.status=eZ}else{e9(en,(en.gzhead.text?1:0)+(en.gzhead.hcrc?2:0)+(!en.gzhead.extra?0:4)+(!en.gzhead.name?0:8)+(!en.gzhead.comment?0:16));e9(en,en.gzhead.time&255);e9(en,en.gzhead.time>>8&255);e9(en,en.gzhead.time>>16&255);e9(en,en.gzhead.time>>24&255);e9(en,en.level===9?2:en.strategy>=eT||en.level<2?4:0);e9(en,en.gzhead.os&255);if(en.gzhead.extra&&en.gzhead.extra.length){e9(en,en.gzhead.extra.length&255);e9(en,en.gzhead.extra.length>>8&255)}if(en.gzhead.hcrc){$.adler=es($.adler,en.pending_buf,en.pending,0)}en.gzindex=0;en.status=eq}}else{var e_=eD+(en.w_bits-8<<4)<<8;var eE=-1;if(en.strategy>=eT||en.level<2){eE=0}else if(en.level<6){eE=1}else if(en.level===6){eE=2}else{eE=3}e_|=eE<<6;if(en.strstart!==0){e_|=eV}e_+=31-e_%31;en.status=eZ;e7(en,e_);if(en.strstart!==0){e7(en,$.adler>>>16);e7(en,$.adler&65535)}$.adler=1}}if(en.status===eq){if(en.gzhead.extra){eo=en.pending;while(en.gzindex<(en.gzhead.extra.length&65535)){if(en.pending===en.pending_buf_size){if(en.gzhead.hcrc&&en.pending>eo){$.adler=es($.adler,en.pending_buf,en.pending-eo,eo)}e8($);eo=en.pending;if(en.pending===en.pending_buf_size){break}}e9(en,en.gzhead.extra[en.gzindex]&255);en.gzindex++}if(en.gzhead.hcrc&&en.pending>eo){$.adler=es($.adler,en.pending_buf,en.pending-eo,eo)}if(en.gzindex===en.gzhead.extra.length){en.gzindex=0;en.status=eG}}else{en.status=eG}}if(en.status===eG){if(en.gzhead.name){eo=en.pending;do{if(en.pending===en.pending_buf_size){if(en.gzhead.hcrc&&en.pending>eo){$.adler=es($.adler,en.pending_buf,en.pending-eo,eo)}e8($);eo=en.pending;if(en.pending===en.pending_buf_size){eu=1;break}}if(en.gzindex<en.gzhead.name.length){eu=en.gzhead.name.charCodeAt(en.gzindex++)&255}else{eu=0}e9(en,eu)}while(eu!==0)if(en.gzhead.hcrc&&en.pending>eo){$.adler=es($.adler,en.pending_buf,en.pending-eo,eo)}if(eu===0){en.gzindex=0;en.status=eY}}else{en.status=eY}}if(en.status===eY){if(en.gzhead.comment){eo=en.pending;do{if(en.pending===en.pending_buf_size){if(en.gzhead.hcrc&&en.pending>eo){$.adler=es($.adler,en.pending_buf,en.pending-eo,eo)}e8($);eo=en.pending;if(en.pending===en.pending_buf_size){eu=1;break}}if(en.gzindex<en.gzhead.comment.length){eu=en.gzhead.comment.charCodeAt(en.gzindex++)&255}else{eu=0}e9(en,eu)}while(eu!==0)if(en.gzhead.hcrc&&en.pending>eo){$.adler=es($.adler,en.pending_buf,en.pending-eo,eo)}if(eu===0){en.status=eK}}else{en.status=eK}}if(en.status===eK){if(en.gzhead.hcrc){if(en.pending+2>en.pending_buf_size){e8($)}if(en.pending+2<=en.pending_buf_size){e9(en,$.adler&255);e9(en,$.adler>>8&255);$.adler=0;en.status=eZ}}else{en.status=eZ}}if(en.pending!==0){e8($);if($.avail_out===0){en.last_flush=-1;return ey}}else if($.avail_in===0&&e4(ee)<=e4(et)&&ee!==ep){return e6($,ew)}if(en.status===eJ&&$.avail_in!==0){return e6($,ew)}if($.avail_in!==0||en.lookahead!==0||ee!==el&&en.status!==eJ){var eS=en.strategy===eT?tf(en,ee):en.strategy===eO?tc(en,ee):tp[en.level].func(en,ee);if(eS===e0||eS===e1){en.status=eJ}if(eS===eX||eS===e0){if($.avail_out===0){en.last_flush=-1}return ey}if(eS===eQ){if(ee===ef){ei._tr_align(en)}else if(ee!==eh){ei._tr_stored_block(en,0,0,false);if(ee===ed){e3(en.head);if(en.lookahead===0){en.strstart=0;en.block_start=0;en.insert=0}}}e8($);if($.avail_out===0){en.last_flush=-1;return ey}}}if(ee!==ep){return ey}if(en.wrap<=0){return eg}if(en.wrap===2){e9(en,$.adler&255);e9(en,$.adler>>8&255);e9(en,$.adler>>16&255);e9(en,$.adler>>24&255);e9(en,$.total_in&255);e9(en,$.total_in>>8&255);e9(en,$.total_in>>16&255);e9(en,$.total_in>>24&255)}else{e7(en,$.adler>>>16);e7(en,$.adler&65535)}e8($);if(en.wrap>0){en.wrap=-en.wrap}return en.pending!==0?ey:eg}function tT($){var ee;if(!$||!$.state){return em}ee=$.state.status;if(ee!==e$&&ee!==eq&&ee!==eG&&ee!==eY&&ee!==eK&&ee!==eZ&&ee!==eJ){return e6($,em)}$.state=null;return ee===eZ?e6($,e_):ey}function tO($,ee){var et=ee.length;var ei;var es,eu;var el;var ef;var ed;var ep;var eh;if(!$||!$.state){return em}ei=$.state;el=ei.wrap;if(el===2||el===1&&ei.status!==e$||ei.lookahead){return em}if(el===1){$.adler=eo($.adler,ee,et,0)}ei.wrap=0;if(et>=ei.w_size){if(el===0){e3(ei.head);ei.strstart=0;ei.block_start=0;ei.insert=0}eh=new en.Buf8(ei.w_size);en.arraySet(eh,ee,et-ei.w_size,ei.w_size,0);ee=eh;et=ei.w_size}ef=$.avail_in;ed=$.next_in;ep=$.input;$.avail_in=et;$.next_in=0;$.input=ee;tr(ei);while(ei.lookahead>=eW){es=ei.strstart;eu=ei.lookahead-(eW-1);do{ei.ins_h=(ei.ins_h<<ei.hash_shift^ei.window[es+eW-1])&ei.hash_mask;ei.prev[es&ei.w_mask]=ei.head[ei.ins_h];ei.head[ei.ins_h]=es;es++}while(--eu)ei.strstart=es;ei.lookahead=eW-1;tr(ei)}ei.strstart+=ei.lookahead;ei.block_start=ei.strstart;ei.insert=ei.lookahead;ei.lookahead=0;ei.match_length=ei.prev_length=eW-1;ei.match_available=0;$.next_in=ed;$.input=ep;$.avail_in=ef;ei.wrap=el;return ey}ee.deflateInit=tE;ee.deflateInit2=tw;ee.deflateReset=t_;ee.deflateResetKeep=tm;ee.deflateSetHeader=tv;ee.deflate=tS;ee.deflateEnd=tT;ee.deflateSetDictionary=tO;ee.deflateInfo="pako deflate (from Nodeca project)"},4264:$=>{"use strict";var ee=30;var et=12;$.exports=function $($,en){var ei;var eo;var es;var eu;var el;var ef;var ed;var ep;var eh;var ey;var eg;var em;var e_;var ew;var eE;var eS;var eT;var eO;var eA;var eI;var eN;var eD;var eR;var eC,ek;ei=$.state;eo=$.next_in;eC=$.input;es=eo+($.avail_in-5);eu=$.next_out;ek=$.output;el=eu-(en-$.avail_out);ef=eu+($.avail_out-257);ed=ei.dmax;ep=ei.wsize;eh=ei.whave;ey=ei.wnext;eg=ei.window;em=ei.hold;e_=ei.bits;ew=ei.lencode;eE=ei.distcode;eS=(1<<ei.lenbits)-1;eT=(1<<ei.distbits)-1;n:do{if(e_<15){em+=eC[eo++]<<e_;e_+=8;em+=eC[eo++]<<e_;e_+=8}eO=ew[em&eS];i:for(;;){eA=eO>>>24;em>>>=eA;e_-=eA;eA=eO>>>16&255;if(eA===0){ek[eu++]=eO&65535}else if(eA&16){eI=eO&65535;eA&=15;if(eA){if(e_<eA){em+=eC[eo++]<<e_;e_+=8}eI+=em&(1<<eA)-1;em>>>=eA;e_-=eA}if(e_<15){em+=eC[eo++]<<e_;e_+=8;em+=eC[eo++]<<e_;e_+=8}eO=eE[em&eT];a:for(;;){eA=eO>>>24;em>>>=eA;e_-=eA;eA=eO>>>16&255;if(eA&16){eN=eO&65535;eA&=15;if(e_<eA){em+=eC[eo++]<<e_;e_+=8;if(e_<eA){em+=eC[eo++]<<e_;e_+=8}}eN+=em&(1<<eA)-1;if(eN>ed){$.msg="invalid distance too far back";ei.mode=ee;break n}em>>>=eA;e_-=eA;eA=eu-el;if(eN>eA){eA=eN-eA;if(eA>eh){if(ei.sane){$.msg="invalid distance too far back";ei.mode=ee;break n}}eD=0;eR=eg;if(ey===0){eD+=ep-eA;if(eA<eI){eI-=eA;do{ek[eu++]=eg[eD++]}while(--eA)eD=eu-eN;eR=ek}}else if(ey<eA){eD+=ep+ey-eA;eA-=ey;if(eA<eI){eI-=eA;do{ek[eu++]=eg[eD++]}while(--eA)eD=0;if(ey<eI){eA=ey;eI-=eA;do{ek[eu++]=eg[eD++]}while(--eA)eD=eu-eN;eR=ek}}}else{eD+=ey-eA;if(eA<eI){eI-=eA;do{ek[eu++]=eg[eD++]}while(--eA)eD=eu-eN;eR=ek}}while(eI>2){ek[eu++]=eR[eD++];ek[eu++]=eR[eD++];ek[eu++]=eR[eD++];eI-=3}if(eI){ek[eu++]=eR[eD++];if(eI>1){ek[eu++]=eR[eD++]}}}else{eD=eu-eN;do{ek[eu++]=ek[eD++];ek[eu++]=ek[eD++];ek[eu++]=ek[eD++];eI-=3}while(eI>2)if(eI){ek[eu++]=ek[eD++];if(eI>1){ek[eu++]=ek[eD++]}}}}else if((eA&64)===0){eO=eE[(eO&65535)+(em&(1<<eA)-1)];continue a}else{$.msg="invalid distance code";ei.mode=ee;break n}break}}else if((eA&64)===0){eO=ew[(eO&65535)+(em&(1<<eA)-1)];continue i}else if(eA&32){ei.mode=et;break n}else{$.msg="invalid literal/length code";ei.mode=ee;break n}break}}while(eo<es&&eu<ef)eI=e_>>3;eo-=eI;e_-=eI<<3;em&=(1<<e_)-1;$.next_in=eo;$.next_out=eu;$.avail_in=eo<es?5+(es-eo):5-(eo-es);$.avail_out=eu<ef?257+(ef-eu):257-(eu-ef);ei.hold=em;ei.bits=e_;return}},7948:($,ee,et)=>{"use strict";var en=et(4236);var ei=et(6069);var eo=et(2869);var es=et(4264);var eu=et(9241);var el=0;var ef=1;var ed=2;var ep=4;var eh=5;var ey=6;var eg=0;var em=1;var e_=2;var ew=-2;var eE=-3;var eS=-4;var eT=-5;var eO=8;var eA=1;var eI=2;var eN=3;var eD=4;var eR=5;var eC=6;var ek=7;var eM=8;var eL=9;var eP=10;var eF=11;var eB=12;var eU=13;var ej=14;var eW=15;var eH=16;var ez=17;var eV=18;var e$=19;var eq=20;var eG=21;var eY=22;var eK=23;var eZ=24;var eJ=25;var eX=26;var eQ=27;var e0=28;var e1=29;var e2=30;var e6=31;var e4=32;var e3=852;var e8=592;var e5=15;var e9=e5;function e7($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function te(){this.mode=0;this.last=false;this.wrap=0;this.havedict=false;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 en.Buf16(320);this.work=new en.Buf16(288);this.lendyn=null;this.distdyn=null;this.sane=0;this.back=0;this.was=0}function tt($){var ee;if(!$||!$.state){return ew}ee=$.state;$.total_in=$.total_out=ee.total=0;$.msg="";if(ee.wrap){$.adler=ee.wrap&1}ee.mode=eA;ee.last=0;ee.havedict=0;ee.dmax=32768;ee.head=null;ee.hold=0;ee.bits=0;ee.lencode=ee.lendyn=new en.Buf32(e3);ee.distcode=ee.distdyn=new en.Buf32(e8);ee.sane=1;ee.back=-1;return eg}function tr($){var ee;if(!$||!$.state){return ew}ee=$.state;ee.wsize=0;ee.whave=0;ee.wnext=0;return tt($)}function tn($,ee){var et;var en;if(!$||!$.state){return ew}en=$.state;if(ee<0){et=0;ee=-ee}else{et=(ee>>4)+1;if(ee<48){ee&=15}}if(ee&&(ee<8||ee>15)){return ew}if(en.window!==null&&en.wbits!==ee){en.window=null}en.wrap=et;en.wbits=ee;return tr($)}function ti($,ee){var et;var en;if(!$){return ew}en=new te;$.state=en;en.window=null;et=tn($,ee);if(et!==eg){$.state=null}return et}function tu($){return ti($,e9)}var tc=true;var tf,td;function tp($){if(tc){var ee;tf=new en.Buf32(512);td=new en.Buf32(32);ee=0;while(ee<144){$.lens[ee++]=8}while(ee<256){$.lens[ee++]=9}while(ee<280){$.lens[ee++]=7}while(ee<288){$.lens[ee++]=8}eu(ef,$.lens,0,288,tf,0,$.work,{bits:9});ee=0;while(ee<32){$.lens[ee++]=5}eu(ed,$.lens,0,32,td,0,$.work,{bits:5});tc=false}$.lencode=tf;$.lenbits=9;$.distcode=td;$.distbits=5}function th($,ee,et,ei){var eo;var es=$.state;if(es.window===null){es.wsize=1<<es.wbits;es.wnext=0;es.whave=0;es.window=new en.Buf8(es.wsize)}if(ei>=es.wsize){en.arraySet(es.window,ee,et-es.wsize,es.wsize,0);es.wnext=0;es.whave=es.wsize}else{eo=es.wsize-es.wnext;if(eo>ei){eo=ei}en.arraySet(es.window,ee,et-ei,eo,es.wnext);ei-=eo;if(ei){en.arraySet(es.window,ee,et-ei,ei,0);es.wnext=ei;es.whave=es.wsize}else{es.wnext+=eo;if(es.wnext===es.wsize){es.wnext=0}if(es.whave<es.wsize){es.whave+=eo}}}return 0}function ty($,ee){var et;var e3,e8;var e5;var e9;var te,tt;var tr;var tn;var ti,tu;var tc;var tf;var td;var ty=0;var tm,t_,tv;var tw,tE,tS;var tT;var tO;var tA=new en.Buf8(4);var tI;var tN;var tD=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!$||!$.state||!$.output||!$.input&&$.avail_in!==0){return ew}et=$.state;if(et.mode===eB){et.mode=eU}e9=$.next_out;e8=$.output;tt=$.avail_out;e5=$.next_in;e3=$.input;te=$.avail_in;tr=et.hold;tn=et.bits;ti=te;tu=tt;tO=eg;o:for(;;){switch(et.mode){case eA:if(et.wrap===0){et.mode=eU;break}while(tn<16){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if(et.wrap&2&&tr===35615){et.check=0;tA[0]=tr&255;tA[1]=tr>>>8&255;et.check=eo(et.check,tA,2,0);tr=0;tn=0;et.mode=eI;break}et.flags=0;if(et.head){et.head.done=false}if(!(et.wrap&1)||(((tr&255)<<8)+(tr>>8))%31){$.msg="incorrect header check";et.mode=e2;break}if((tr&15)!==eO){$.msg="unknown compression method";et.mode=e2;break}tr>>>=4;tn-=4;tT=(tr&15)+8;if(et.wbits===0){et.wbits=tT}else if(tT>et.wbits){$.msg="invalid window size";et.mode=e2;break}et.dmax=1<<tT;$.adler=et.check=1;et.mode=tr&512?eP:eB;tr=0;tn=0;break;case eI:while(tn<16){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}et.flags=tr;if((et.flags&255)!==eO){$.msg="unknown compression method";et.mode=e2;break}if(et.flags&57344){$.msg="unknown header flags set";et.mode=e2;break}if(et.head){et.head.text=tr>>8&1}if(et.flags&512){tA[0]=tr&255;tA[1]=tr>>>8&255;et.check=eo(et.check,tA,2,0)}tr=0;tn=0;et.mode=eN;case eN:while(tn<32){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if(et.head){et.head.time=tr}if(et.flags&512){tA[0]=tr&255;tA[1]=tr>>>8&255;tA[2]=tr>>>16&255;tA[3]=tr>>>24&255;et.check=eo(et.check,tA,4,0)}tr=0;tn=0;et.mode=eD;case eD:while(tn<16){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if(et.head){et.head.xflags=tr&255;et.head.os=tr>>8}if(et.flags&512){tA[0]=tr&255;tA[1]=tr>>>8&255;et.check=eo(et.check,tA,2,0)}tr=0;tn=0;et.mode=eR;case eR:if(et.flags&1024){while(tn<16){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}et.length=tr;if(et.head){et.head.extra_len=tr}if(et.flags&512){tA[0]=tr&255;tA[1]=tr>>>8&255;et.check=eo(et.check,tA,2,0)}tr=0;tn=0}else if(et.head){et.head.extra=null}et.mode=eC;case eC:if(et.flags&1024){tc=et.length;if(tc>te){tc=te}if(tc){if(et.head){tT=et.head.extra_len-et.length;if(!et.head.extra){et.head.extra=new Array(et.head.extra_len)}en.arraySet(et.head.extra,e3,e5,tc,tT)}if(et.flags&512){et.check=eo(et.check,e3,tc,e5)}te-=tc;e5+=tc;et.length-=tc}if(et.length){break o}}et.length=0;et.mode=ek;case ek:if(et.flags&2048){if(te===0){break o}tc=0;do{tT=e3[e5+tc++];if(et.head&&tT&&et.length<65536){et.head.name+=String.fromCharCode(tT)}}while(tT&&tc<te)if(et.flags&512){et.check=eo(et.check,e3,tc,e5)}te-=tc;e5+=tc;if(tT){break o}}else if(et.head){et.head.name=null}et.length=0;et.mode=eM;case eM:if(et.flags&4096){if(te===0){break o}tc=0;do{tT=e3[e5+tc++];if(et.head&&tT&&et.length<65536){et.head.comment+=String.fromCharCode(tT)}}while(tT&&tc<te)if(et.flags&512){et.check=eo(et.check,e3,tc,e5)}te-=tc;e5+=tc;if(tT){break o}}else if(et.head){et.head.comment=null}et.mode=eL;case eL:if(et.flags&512){while(tn<16){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if(tr!==(et.check&65535)){$.msg="header crc mismatch";et.mode=e2;break}tr=0;tn=0}if(et.head){et.head.hcrc=et.flags>>9&1;et.head.done=true}$.adler=et.check=0;et.mode=eB;break;case eP:while(tn<32){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}$.adler=et.check=e7(tr);tr=0;tn=0;et.mode=eF;case eF:if(et.havedict===0){$.next_out=e9;$.avail_out=tt;$.next_in=e5;$.avail_in=te;et.hold=tr;et.bits=tn;return e_}$.adler=et.check=1;et.mode=eB;case eB:if(ee===eh||ee===ey){break o}case eU:if(et.last){tr>>>=tn&7;tn-=tn&7;et.mode=eQ;break}while(tn<3){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}et.last=tr&1;tr>>>=1;tn-=1;switch(tr&3){case 0:et.mode=ej;break;case 1:tp(et);et.mode=eq;if(ee===ey){tr>>>=2;tn-=2;break o}break;case 2:et.mode=ez;break;case 3:$.msg="invalid block type";et.mode=e2}tr>>>=2;tn-=2;break;case ej:tr>>>=tn&7;tn-=tn&7;while(tn<32){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if((tr&65535)!==(tr>>>16^65535)){$.msg="invalid stored block lengths";et.mode=e2;break}et.length=tr&65535;tr=0;tn=0;et.mode=eW;if(ee===ey){break o}case eW:et.mode=eH;case eH:tc=et.length;if(tc){if(tc>te){tc=te}if(tc>tt){tc=tt}if(tc===0){break o}en.arraySet(e8,e3,e5,tc,e9);te-=tc;e5+=tc;tt-=tc;e9+=tc;et.length-=tc;break}et.mode=eB;break;case ez:while(tn<14){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}et.nlen=(tr&31)+257;tr>>>=5;tn-=5;et.ndist=(tr&31)+1;tr>>>=5;tn-=5;et.ncode=(tr&15)+4;tr>>>=4;tn-=4;if(et.nlen>286||et.ndist>30){$.msg="too many length or distance symbols";et.mode=e2;break}et.have=0;et.mode=eV;case eV:while(et.have<et.ncode){while(tn<3){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}et.lens[tD[et.have++]]=tr&7;tr>>>=3;tn-=3}while(et.have<19){et.lens[tD[et.have++]]=0}et.lencode=et.lendyn;et.lenbits=7;tI={bits:et.lenbits};tO=eu(el,et.lens,0,19,et.lencode,0,et.work,tI);et.lenbits=tI.bits;if(tO){$.msg="invalid code lengths set";et.mode=e2;break}et.have=0;et.mode=e$;case e$:while(et.have<et.nlen+et.ndist){for(;;){ty=et.lencode[tr&(1<<et.lenbits)-1];tm=ty>>>24;t_=ty>>>16&255;tv=ty&65535;if(tm<=tn){break}if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if(tv<16){tr>>>=tm;tn-=tm;et.lens[et.have++]=tv}else{if(tv===16){tN=tm+2;while(tn<tN){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}tr>>>=tm;tn-=tm;if(et.have===0){$.msg="invalid bit length repeat";et.mode=e2;break}tT=et.lens[et.have-1];tc=3+(tr&3);tr>>>=2;tn-=2}else if(tv===17){tN=tm+3;while(tn<tN){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}tr>>>=tm;tn-=tm;tT=0;tc=3+(tr&7);tr>>>=3;tn-=3}else{tN=tm+7;while(tn<tN){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}tr>>>=tm;tn-=tm;tT=0;tc=11+(tr&127);tr>>>=7;tn-=7}if(et.have+tc>et.nlen+et.ndist){$.msg="invalid bit length repeat";et.mode=e2;break}while(tc--){et.lens[et.have++]=tT}}}if(et.mode===e2){break}if(et.lens[256]===0){$.msg="invalid code -- missing end-of-block";et.mode=e2;break}et.lenbits=9;tI={bits:et.lenbits};tO=eu(ef,et.lens,0,et.nlen,et.lencode,0,et.work,tI);et.lenbits=tI.bits;if(tO){$.msg="invalid literal/lengths set";et.mode=e2;break}et.distbits=6;et.distcode=et.distdyn;tI={bits:et.distbits};tO=eu(ed,et.lens,et.nlen,et.ndist,et.distcode,0,et.work,tI);et.distbits=tI.bits;if(tO){$.msg="invalid distances set";et.mode=e2;break}et.mode=eq;if(ee===ey){break o}case eq:et.mode=eG;case eG:if(te>=6&&tt>=258){$.next_out=e9;$.avail_out=tt;$.next_in=e5;$.avail_in=te;et.hold=tr;et.bits=tn;es($,tu);e9=$.next_out;e8=$.output;tt=$.avail_out;e5=$.next_in;e3=$.input;te=$.avail_in;tr=et.hold;tn=et.bits;if(et.mode===eB){et.back=-1}break}et.back=0;for(;;){ty=et.lencode[tr&(1<<et.lenbits)-1];tm=ty>>>24;t_=ty>>>16&255;tv=ty&65535;if(tm<=tn){break}if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if(t_&&(t_&240)===0){tw=tm;tE=t_;tS=tv;for(;;){ty=et.lencode[tS+((tr&(1<<tw+tE)-1)>>tw)];tm=ty>>>24;t_=ty>>>16&255;tv=ty&65535;if(tw+tm<=tn){break}if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}tr>>>=tw;tn-=tw;et.back+=tw}tr>>>=tm;tn-=tm;et.back+=tm;et.length=tv;if(t_===0){et.mode=eX;break}if(t_&32){et.back=-1;et.mode=eB;break}if(t_&64){$.msg="invalid literal/length code";et.mode=e2;break}et.extra=t_&15;et.mode=eY;case eY:if(et.extra){tN=et.extra;while(tn<tN){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}et.length+=tr&(1<<et.extra)-1;tr>>>=et.extra;tn-=et.extra;et.back+=et.extra}et.was=et.length;et.mode=eK;case eK:for(;;){ty=et.distcode[tr&(1<<et.distbits)-1];tm=ty>>>24;t_=ty>>>16&255;tv=ty&65535;if(tm<=tn){break}if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if((t_&240)===0){tw=tm;tE=t_;tS=tv;for(;;){ty=et.distcode[tS+((tr&(1<<tw+tE)-1)>>tw)];tm=ty>>>24;t_=ty>>>16&255;tv=ty&65535;if(tw+tm<=tn){break}if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}tr>>>=tw;tn-=tw;et.back+=tw}tr>>>=tm;tn-=tm;et.back+=tm;if(t_&64){$.msg="invalid distance code";et.mode=e2;break}et.offset=tv;et.extra=t_&15;et.mode=eZ;case eZ:if(et.extra){tN=et.extra;while(tn<tN){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}et.offset+=tr&(1<<et.extra)-1;tr>>>=et.extra;tn-=et.extra;et.back+=et.extra}if(et.offset>et.dmax){$.msg="invalid distance too far back";et.mode=e2;break}et.mode=eJ;case eJ:if(tt===0){break o}tc=tu-tt;if(et.offset>tc){tc=et.offset-tc;if(tc>et.whave){if(et.sane){$.msg="invalid distance too far back";et.mode=e2;break}}if(tc>et.wnext){tc-=et.wnext;tf=et.wsize-tc}else{tf=et.wnext-tc}if(tc>et.length){tc=et.length}td=et.window}else{td=e8;tf=e9-et.offset;tc=et.length}if(tc>tt){tc=tt}tt-=tc;et.length-=tc;do{e8[e9++]=td[tf++]}while(--tc)if(et.length===0){et.mode=eG}break;case eX:if(tt===0){break o}e8[e9++]=et.length;tt--;et.mode=eG;break;case eQ:if(et.wrap){while(tn<32){if(te===0){break o}te--;tr|=e3[e5++]<<tn;tn+=8}tu-=tt;$.total_out+=tu;et.total+=tu;if(tu){$.adler=et.check=et.flags?eo(et.check,e8,tu,e9-tu):ei(et.check,e8,tu,e9-tu)}tu=tt;if((et.flags?tr:e7(tr))!==et.check){$.msg="incorrect data check";et.mode=e2;break}tr=0;tn=0}et.mode=e0;case e0:if(et.wrap&&et.flags){while(tn<32){if(te===0){break o}te--;tr+=e3[e5++]<<tn;tn+=8}if(tr!==(et.total&4294967295)){$.msg="incorrect length check";et.mode=e2;break}tr=0;tn=0}et.mode=e1;case e1:tO=em;break o;case e2:tO=eE;break o;case e6:return eS;case e4:default:return ew}}$.next_out=e9;$.avail_out=tt;$.next_in=e5;$.avail_in=te;et.hold=tr;et.bits=tn;if(et.wsize||tu!==$.avail_out&&et.mode<e2&&(et.mode<eQ||ee!==ep)){if(th($,$.output,$.next_out,tu-$.avail_out)){et.mode=e6;return eS}}ti-=$.avail_in;tu-=$.avail_out;$.total_in+=ti;$.total_out+=tu;et.total+=tu;if(et.wrap&&tu){$.adler=et.check=et.flags?eo(et.check,e8,tu,$.next_out-tu):ei(et.check,e8,tu,$.next_out-tu)}$.data_type=et.bits+(et.last?64:0)+(et.mode===eB?128:0)+(et.mode===eq||et.mode===eW?256:0);if((ti===0&&tu===0||ee===ep)&&tO===eg){tO=eT}return tO}function tm($){if(!$||!$.state){return ew}var ee=$.state;if(ee.window){ee.window=null}$.state=null;return eg}function t_($,ee){var et;if(!$||!$.state){return ew}et=$.state;if((et.wrap&2)===0){return ew}et.head=ee;ee.done=false;return eg}function tv($,ee){var et=ee.length;var en;var eo;var es;if(!$||!$.state){return ew}en=$.state;if(en.wrap!==0&&en.mode!==eF){return ew}if(en.mode===eF){eo=1;eo=ei(eo,ee,et,0);if(eo!==en.check){return eE}}es=th($,ee,et,et);if(es){en.mode=e6;return eS}en.havedict=1;return eg}ee.inflateReset=tr;ee.inflateReset2=tn;ee.inflateResetKeep=tt;ee.inflateInit=tu;ee.inflateInit2=ti;ee.inflate=ty;ee.inflateEnd=tm;ee.inflateGetHeader=t_;ee.inflateSetDictionary=tv;ee.inflateInfo="pako inflate (from Nodeca project)"},9241:($,ee,et)=>{"use strict";var en=et(4236);var ei=15;var eo=852;var es=592;var eu=0;var el=1;var ef=2;var ed=[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];var ep=[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];var eh=[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];var ey=[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];$.exports=function $($,ee,et,eg,em,e_,ew,eE){var eS=eE.bits;var eT=0;var eO=0;var eA=0,eI=0;var eN=0;var eD=0;var eR=0;var eC=0;var ek=0;var eM=0;var eL;var eP;var eF;var eB;var eU;var ej=null;var eW=0;var eH;var ez=new en.Buf16(ei+1);var eV=new en.Buf16(ei+1);var e$=null;var eq=0;var eG,eY,eK;for(eT=0;eT<=ei;eT++){ez[eT]=0}for(eO=0;eO<eg;eO++){ez[ee[et+eO]]++}eN=eS;for(eI=ei;eI>=1;eI--){if(ez[eI]!==0){break}}if(eN>eI){eN=eI}if(eI===0){em[e_++]=1<<24|64<<16|0;em[e_++]=1<<24|64<<16|0;eE.bits=1;return 0}for(eA=1;eA<eI;eA++){if(ez[eA]!==0){break}}if(eN<eA){eN=eA}eC=1;for(eT=1;eT<=ei;eT++){eC<<=1;eC-=ez[eT];if(eC<0){return-1}}if(eC>0&&($===eu||eI!==1)){return-1}eV[1]=0;for(eT=1;eT<ei;eT++){eV[eT+1]=eV[eT]+ez[eT]}for(eO=0;eO<eg;eO++){if(ee[et+eO]!==0){ew[eV[ee[et+eO]]++]=eO}}if($===eu){ej=e$=ew;eH=19}else if($===el){ej=ed;eW-=257;e$=ep;eq-=257;eH=256}else{ej=eh;e$=ey;eH=-1}eM=0;eO=0;eT=eA;eU=e_;eD=eN;eR=0;eF=-1;ek=1<<eN;eB=ek-1;if($===el&&ek>eo||$===ef&&ek>es){return 1}for(;;){eG=eT-eR;if(ew[eO]<eH){eY=0;eK=ew[eO]}else if(ew[eO]>eH){eY=e$[eq+ew[eO]];eK=ej[eW+ew[eO]]}else{eY=32+64;eK=0}eL=1<<eT-eR;eP=1<<eD;eA=eP;do{eP-=eL;em[eU+(eM>>eR)+eP]=eG<<24|eY<<16|eK|0}while(eP!==0)eL=1<<eT-1;while(eM&eL){eL>>=1}if(eL!==0){eM&=eL-1;eM+=eL}else{eM=0}eO++;if(--ez[eT]===0){if(eT===eI){break}eT=ee[et+ew[eO]]}if(eT>eN&&(eM&eB)!==eF){if(eR===0){eR=eN}eU+=eA;eD=eT-eR;eC=1<<eD;while(eD+eR<eI){eC-=ez[eD+eR];if(eC<=0){break}eD++;eC<<=1}ek+=1<<eD;if($===el&&ek>eo||$===ef&&ek>es){return 1}eF=eM&eB;em[eF]=eN<<24|eD<<16|eU-e_|0}}if(eM!==0){em[eU+eM]=eT-eR<<24|64<<16|0}eE.bits=eN;return 0}},8898:$=>{"use strict";$.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"}},342:($,ee,et)=>{"use strict";var en=et(4236);var ei=4;var eo=0;var es=1;var eu=2;function el($){var ee=$.length;while(--ee>=0){$[ee]=0}}var ef=0;var ed=1;var ep=2;var eh=3;var ey=258;var eg=29;var em=256;var e_=em+1+eg;var ew=30;var eE=19;var eS=2*e_+1;var eT=15;var eO=16;var eA=7;var eI=256;var eN=16;var eD=17;var eR=18;var eC=[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];var ek=[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];var eM=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];var eL=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];var eP=512;var eF=new Array((e_+2)*2);el(eF);var eB=new Array(ew*2);el(eB);var eU=new Array(eP);el(eU);var ej=new Array(ey-eh+1);el(ej);var eW=new Array(eg);el(eW);var eH=new Array(ew);el(eH);function ez($,ee,et,en,ei){this.static_tree=$;this.extra_bits=ee;this.extra_base=et;this.elems=en;this.max_length=ei;this.has_stree=$&&$.length}var eV;var e$;var eq;function eG($,ee){this.dyn_tree=$;this.max_code=0;this.stat_desc=ee}function eY($){return $<256?eU[$]:eU[256+($>>>7)]}function eK($,ee){$.pending_buf[$.pending++]=ee&255;$.pending_buf[$.pending++]=ee>>>8&255}function eZ($,ee,et){if($.bi_valid>eO-et){$.bi_buf|=ee<<$.bi_valid&65535;eK($,$.bi_buf);$.bi_buf=ee>>eO-$.bi_valid;$.bi_valid+=et-eO}else{$.bi_buf|=ee<<$.bi_valid&65535;$.bi_valid+=et}}function eJ($,ee,et){eZ($,et[ee*2],et[ee*2+1])}function eX($,ee){var et=0;do{et|=$&1;$>>>=1;et<<=1}while(--ee>0)return et>>>1}function eQ($){if($.bi_valid===16){eK($,$.bi_buf);$.bi_buf=0;$.bi_valid=0}else if($.bi_valid>=8){$.pending_buf[$.pending++]=$.bi_buf&255;$.bi_buf>>=8;$.bi_valid-=8}}function e0($,ee){var et=ee.dyn_tree;var en=ee.max_code;var ei=ee.stat_desc.static_tree;var eo=ee.stat_desc.has_stree;var es=ee.stat_desc.extra_bits;var eu=ee.stat_desc.extra_base;var el=ee.stat_desc.max_length;var ef;var ed,ep;var eh;var ey;var eg;var em=0;for(eh=0;eh<=eT;eh++){$.bl_count[eh]=0}et[$.heap[$.heap_max]*2+1]=0;for(ef=$.heap_max+1;ef<eS;ef++){ed=$.heap[ef];eh=et[et[ed*2+1]*2+1]+1;if(eh>el){eh=el;em++}et[ed*2+1]=eh;if(ed>en){continue}$.bl_count[eh]++;ey=0;if(ed>=eu){ey=es[ed-eu]}eg=et[ed*2];$.opt_len+=eg*(eh+ey);if(eo){$.static_len+=eg*(ei[ed*2+1]+ey)}}if(em===0){return}do{eh=el-1;while($.bl_count[eh]===0){eh--}$.bl_count[eh]--;$.bl_count[eh+1]+=2;$.bl_count[el]--;em-=2}while(em>0)for(eh=el;eh!==0;eh--){ed=$.bl_count[eh];while(ed!==0){ep=$.heap[--ef];if(ep>en){continue}if(et[ep*2+1]!==eh){$.opt_len+=(eh-et[ep*2+1])*et[ep*2];et[ep*2+1]=eh}ed--}}}function e1($,ee,et){var en=new Array(eT+1);var ei=0;var eo;var es;for(eo=1;eo<=eT;eo++){en[eo]=ei=ei+et[eo-1]<<1}for(es=0;es<=ee;es++){var eu=$[es*2+1];if(eu===0){continue}$[es*2]=eX(en[eu]++,eu)}}function e2(){var $;var ee;var et;var en;var ei;var eo=new Array(eT+1);et=0;for(en=0;en<eg-1;en++){eW[en]=et;for($=0;$<1<<eC[en];$++){ej[et++]=en}}ej[et-1]=en;ei=0;for(en=0;en<16;en++){eH[en]=ei;for($=0;$<1<<ek[en];$++){eU[ei++]=en}}ei>>=7;for(;en<ew;en++){eH[en]=ei<<7;for($=0;$<1<<ek[en]-7;$++){eU[256+ei++]=en}}for(ee=0;ee<=eT;ee++){eo[ee]=0}$=0;while($<=143){eF[$*2+1]=8;$++;eo[8]++}while($<=255){eF[$*2+1]=9;$++;eo[9]++}while($<=279){eF[$*2+1]=7;$++;eo[7]++}while($<=287){eF[$*2+1]=8;$++;eo[8]++}e1(eF,e_+1,eo);for($=0;$<ew;$++){eB[$*2+1]=5;eB[$*2]=eX($,5)}eV=new ez(eF,eC,em+1,e_,eT);e$=new ez(eB,ek,0,ew,eT);eq=new ez(new Array(0),eM,0,eE,eA)}function e6($){var ee;for(ee=0;ee<e_;ee++){$.dyn_ltree[ee*2]=0}for(ee=0;ee<ew;ee++){$.dyn_dtree[ee*2]=0}for(ee=0;ee<eE;ee++){$.bl_tree[ee*2]=0}$.dyn_ltree[eI*2]=1;$.opt_len=$.static_len=0;$.last_lit=$.matches=0}function e4($){if($.bi_valid>8){eK($,$.bi_buf)}else if($.bi_valid>0){$.pending_buf[$.pending++]=$.bi_buf}$.bi_buf=0;$.bi_valid=0}function e3($,ee,et,ei){e4($);if(ei){eK($,et);eK($,~et)}en.arraySet($.pending_buf,$.window,ee,et,$.pending);$.pending+=et}function e8($,ee,et,en){var ei=ee*2;var eo=et*2;return $[ei]<$[eo]||$[ei]===$[eo]&&en[ee]<=en[et]}function e5($,ee,et){var en=$.heap[et];var ei=et<<1;while(ei<=$.heap_len){if(ei<$.heap_len&&e8(ee,$.heap[ei+1],$.heap[ei],$.depth)){ei++}if(e8(ee,en,$.heap[ei],$.depth)){break}$.heap[et]=$.heap[ei];et=ei;ei<<=1}$.heap[et]=en}function e9($,ee,et){var en;var ei;var eo=0;var es;var eu;if($.last_lit!==0){do{en=$.pending_buf[$.d_buf+eo*2]<<8|$.pending_buf[$.d_buf+eo*2+1];ei=$.pending_buf[$.l_buf+eo];eo++;if(en===0){eJ($,ei,ee)}else{es=ej[ei];eJ($,es+em+1,ee);eu=eC[es];if(eu!==0){ei-=eW[es];eZ($,ei,eu)}en--;es=eY(en);eJ($,es,et);eu=ek[es];if(eu!==0){en-=eH[es];eZ($,en,eu)}}}while(eo<$.last_lit)}eJ($,eI,ee)}function e7($,ee){var et=ee.dyn_tree;var en=ee.stat_desc.static_tree;var ei=ee.stat_desc.has_stree;var eo=ee.stat_desc.elems;var es,eu;var el=-1;var ef;$.heap_len=0;$.heap_max=eS;for(es=0;es<eo;es++){if(et[es*2]!==0){$.heap[++$.heap_len]=el=es;$.depth[es]=0}else{et[es*2+1]=0}}while($.heap_len<2){ef=$.heap[++$.heap_len]=el<2?++el:0;et[ef*2]=1;$.depth[ef]=0;$.opt_len--;if(ei){$.static_len-=en[ef*2+1]}}ee.max_code=el;for(es=$.heap_len>>1;es>=1;es--){e5($,et,es)}ef=eo;do{es=$.heap[1];$.heap[1]=$.heap[$.heap_len--];e5($,et,1);eu=$.heap[1];$.heap[--$.heap_max]=es;$.heap[--$.heap_max]=eu;et[ef*2]=et[es*2]+et[eu*2];$.depth[ef]=($.depth[es]>=$.depth[eu]?$.depth[es]:$.depth[eu])+1;et[es*2+1]=et[eu*2+1]=ef;$.heap[1]=ef++;e5($,et,1)}while($.heap_len>=2)$.heap[--$.heap_max]=$.heap[1];e0($,ee);e1(et,el,$.bl_count)}function te($,ee,et){var en;var ei=-1;var eo;var es=ee[0*2+1];var eu=0;var el=7;var ef=4;if(es===0){el=138;ef=3}ee[(et+1)*2+1]=65535;for(en=0;en<=et;en++){eo=es;es=ee[(en+1)*2+1];if(++eu<el&&eo===es){continue}else if(eu<ef){$.bl_tree[eo*2]+=eu}else if(eo!==0){if(eo!==ei){$.bl_tree[eo*2]++}$.bl_tree[eN*2]++}else if(eu<=10){$.bl_tree[eD*2]++}else{$.bl_tree[eR*2]++}eu=0;ei=eo;if(es===0){el=138;ef=3}else if(eo===es){el=6;ef=3}else{el=7;ef=4}}}function tt($,ee,et){var en;var ei=-1;var eo;var es=ee[0*2+1];var eu=0;var el=7;var ef=4;if(es===0){el=138;ef=3}for(en=0;en<=et;en++){eo=es;es=ee[(en+1)*2+1];if(++eu<el&&eo===es){continue}else if(eu<ef){do{eJ($,eo,$.bl_tree)}while(--eu!==0)}else if(eo!==0){if(eo!==ei){eJ($,eo,$.bl_tree);eu--}eJ($,eN,$.bl_tree);eZ($,eu-3,2)}else if(eu<=10){eJ($,eD,$.bl_tree);eZ($,eu-3,3)}else{eJ($,eR,$.bl_tree);eZ($,eu-11,7)}eu=0;ei=eo;if(es===0){el=138;ef=3}else if(eo===es){el=6;ef=3}else{el=7;ef=4}}}function tr($){var ee;te($,$.dyn_ltree,$.l_desc.max_code);te($,$.dyn_dtree,$.d_desc.max_code);e7($,$.bl_desc);for(ee=eE-1;ee>=3;ee--){if($.bl_tree[eL[ee]*2+1]!==0){break}}$.opt_len+=3*(ee+1)+5+5+4;return ee}function tn($,ee,et,en){var ei;eZ($,ee-257,5);eZ($,et-1,5);eZ($,en-4,4);for(ei=0;ei<en;ei++){eZ($,$.bl_tree[eL[ei]*2+1],3)}tt($,$.dyn_ltree,ee-1);tt($,$.dyn_dtree,et-1)}function ti($){var ee=4093624447;var et;for(et=0;et<=31;et++,ee>>>=1){if(ee&1&&$.dyn_ltree[et*2]!==0){return eo}}if($.dyn_ltree[9*2]!==0||$.dyn_ltree[10*2]!==0||$.dyn_ltree[13*2]!==0){return es}for(et=32;et<em;et++){if($.dyn_ltree[et*2]!==0){return es}}return eo}var tu=false;function tc($){if(!tu){e2();tu=true}$.l_desc=new eG($.dyn_ltree,eV);$.d_desc=new eG($.dyn_dtree,e$);$.bl_desc=new eG($.bl_tree,eq);$.bi_buf=0;$.bi_valid=0;e6($)}function tf($,ee,et,en){eZ($,(ef<<1)+(en?1:0),3);e3($,ee,et,true)}function td($){eZ($,ed<<1,3);eJ($,eI,eF);eQ($)}function tp($,ee,et,en){var eo,es;var el=0;if($.level>0){if($.strm.data_type===eu){$.strm.data_type=ti($)}e7($,$.l_desc);e7($,$.d_desc);el=tr($);eo=$.opt_len+3+7>>>3;es=$.static_len+3+7>>>3;if(es<=eo){eo=es}}else{eo=es=et+5}if(et+4<=eo&&ee!==-1){tf($,ee,et,en)}else if($.strategy===ei||es===eo){eZ($,(ed<<1)+(en?1:0),3);e9($,eF,eB)}else{eZ($,(ep<<1)+(en?1:0),3);tn($,$.l_desc.max_code+1,$.d_desc.max_code+1,el+1);e9($,$.dyn_ltree,$.dyn_dtree)}e6($);if(en){e4($)}}function th($,ee,et){$.pending_buf[$.d_buf+$.last_lit*2]=ee>>>8&255;$.pending_buf[$.d_buf+$.last_lit*2+1]=ee&255;$.pending_buf[$.l_buf+$.last_lit]=et&255;$.last_lit++;if(ee===0){$.dyn_ltree[et*2]++}else{$.matches++;ee--;$.dyn_ltree[(ej[et]+em+1)*2]++;$.dyn_dtree[eY(ee)*2]++}return $.last_lit===$.lit_bufsize-1}ee._tr_init=tc;ee._tr_stored_block=tf;ee._tr_flush_block=tp;ee._tr_tally=th;ee._tr_align=td},2292:$=>{"use strict";function ee(){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}$.exports=ee},6470:($,ee,et)=>{"use strict";var en=et(4155);function ei($){if(typeof $!=="string"){throw new TypeError("Path must be a string. Received "+JSON.stringify($))}}function eo($,ee){var et="";var en=0;var ei=-1;var eo=0;var es;for(var eu=0;eu<=$.length;++eu){if(eu<$.length)es=$.charCodeAt(eu);else if(es===47)break;else es=47;if(es===47){if(ei===eu-1||eo===1){}else if(ei!==eu-1&&eo===2){if(et.length<2||en!==2||et.charCodeAt(et.length-1)!==46||et.charCodeAt(et.length-2)!==46){if(et.length>2){var el=et.lastIndexOf("/");if(el!==et.length-1){if(el===-1){et="";en=0}else{et=et.slice(0,el);en=et.length-1-et.lastIndexOf("/")}ei=eu;eo=0;continue}}else if(et.length===2||et.length===1){et="";en=0;ei=eu;eo=0;continue}}if(ee){if(et.length>0)et+="/..";else et="..";en=2}}else{if(et.length>0)et+="/"+$.slice(ei+1,eu);else et=$.slice(ei+1,eu);en=eu-ei-1}ei=eu;eo=0}else if(es===46&&eo!==-1){++eo}else{eo=-1}}return et}function es($,ee){var et=ee.dir||ee.root;var en=ee.base||(ee.name||"")+(ee.ext||"");if(!et){return en}if(et===ee.root){return et+en}return et+$+en}var eu={resolve:function $(){var $="";var ee=false;var et;for(var es=arguments.length-1;es>=-1&&!ee;es--){var eu;if(es>=0)eu=arguments[es];else{if(et===undefined)et=en.cwd();eu=et}ei(eu);if(eu.length===0){continue}$=eu+"/"+$;ee=eu.charCodeAt(0)===47}$=eo($,!ee);if(ee){if($.length>0)return"/"+$;else return"/"}else if($.length>0){return $}else{return"."}},normalize:function $($){ei($);if($.length===0)return".";var ee=$.charCodeAt(0)===47;var et=$.charCodeAt($.length-1)===47;$=eo($,!ee);if($.length===0&&!ee)$=".";if($.length>0&&et)$+="/";if(ee)return"/"+$;return $},isAbsolute:function $($){ei($);return $.length>0&&$.charCodeAt(0)===47},join:function $(){if(arguments.length===0)return".";var $;for(var ee=0;ee<arguments.length;++ee){var et=arguments[ee];ei(et);if(et.length>0){if($===undefined)$=et;else $+="/"+et}}if($===undefined)return".";return eu.normalize($)},relative:function $($,ee){ei($);ei(ee);if($===ee)return"";$=eu.resolve($);ee=eu.resolve(ee);if($===ee)return"";var et=1;for(;et<$.length;++et){if($.charCodeAt(et)!==47)break}var en=$.length;var eo=en-et;var es=1;for(;es<ee.length;++es){if(ee.charCodeAt(es)!==47)break}var el=ee.length;var ef=el-es;var ed=eo<ef?eo:ef;var ep=-1;var eh=0;for(;eh<=ed;++eh){if(eh===ed){if(ef>ed){if(ee.charCodeAt(es+eh)===47){return ee.slice(es+eh+1)}else if(eh===0){return ee.slice(es+eh)}}else if(eo>ed){if($.charCodeAt(et+eh)===47){ep=eh}else if(eh===0){ep=0}}break}var ey=$.charCodeAt(et+eh);var eg=ee.charCodeAt(es+eh);if(ey!==eg)break;else if(ey===47)ep=eh}var em="";for(eh=et+ep+1;eh<=en;++eh){if(eh===en||$.charCodeAt(eh)===47){if(em.length===0)em+="..";else em+="/.."}}if(em.length>0)return em+ee.slice(es+ep);else{es+=ep;if(ee.charCodeAt(es)===47)++es;return ee.slice(es)}},_makeLong:function $($){return $},dirname:function $($){ei($);if($.length===0)return".";var ee=$.charCodeAt(0);var et=ee===47;var en=-1;var eo=true;for(var es=$.length-1;es>=1;--es){ee=$.charCodeAt(es);if(ee===47){if(!eo){en=es;break}}else{eo=false}}if(en===-1)return et?"/":".";if(et&&en===1)return"//";return $.slice(0,en)},basename:function $($,ee){if(ee!==undefined&&typeof ee!=="string")throw new TypeError('"ext" argument must be a string');ei($);var et=0;var en=-1;var eo=true;var es;if(ee!==undefined&&ee.length>0&&ee.length<=$.length){if(ee.length===$.length&&ee===$)return"";var eu=ee.length-1;var el=-1;for(es=$.length-1;es>=0;--es){var ef=$.charCodeAt(es);if(ef===47){if(!eo){et=es+1;break}}else{if(el===-1){eo=false;el=es+1}if(eu>=0){if(ef===ee.charCodeAt(eu)){if(--eu===-1){en=es}}else{eu=-1;en=el}}}}if(et===en)en=el;else if(en===-1)en=$.length;return $.slice(et,en)}else{for(es=$.length-1;es>=0;--es){if($.charCodeAt(es)===47){if(!eo){et=es+1;break}}else if(en===-1){eo=false;en=es+1}}if(en===-1)return"";return $.slice(et,en)}},extname:function $($){ei($);var ee=-1;var et=0;var en=-1;var eo=true;var es=0;for(var eu=$.length-1;eu>=0;--eu){var el=$.charCodeAt(eu);if(el===47){if(!eo){et=eu+1;break}continue}if(en===-1){eo=false;en=eu+1}if(el===46){if(ee===-1)ee=eu;else if(es!==1)es=1}else if(ee!==-1){es=-1}}if(ee===-1||en===-1||es===0||es===1&&ee===en-1&&ee===et+1){return""}return $.slice(ee,en)},format:function $($){if($===null||typeof $!=="object"){throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof $)}return es("/",$)},parse:function $($){ei($);var ee={root:"",dir:"",base:"",ext:"",name:""};if($.length===0)return ee;var et=$.charCodeAt(0);var en=et===47;var eo;if(en){ee.root="/";eo=1}else{eo=0}var es=-1;var eu=0;var el=-1;var ef=true;var ed=$.length-1;var ep=0;for(;ed>=eo;--ed){et=$.charCodeAt(ed);if(et===47){if(!ef){eu=ed+1;break}continue}if(el===-1){ef=false;el=ed+1}if(et===46){if(es===-1)es=ed;else if(ep!==1)ep=1}else if(es!==-1){ep=-1}}if(es===-1||el===-1||ep===0||ep===1&&es===el-1&&es===eu+1){if(el!==-1){if(eu===0&&en)ee.base=ee.name=$.slice(1,el);else ee.base=ee.name=$.slice(eu,el)}}else{if(eu===0&&en){ee.name=$.slice(1,es);ee.base=$.slice(1,el)}else{ee.name=$.slice(eu,es);ee.base=$.slice(eu,el)}ee.ext=$.slice(es,el)}if(eu>0)ee.dir=$.slice(0,eu-1);else if(en)ee.dir="/";return ee},sep:"/",delimiter:":",win32:null,posix:null};eu.posix=eu;$.exports=eu},4155:$=>{var ee=$.exports={};var et;var en;function ei(){throw new Error("setTimeout has not been defined")}function eo(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){et=setTimeout}else{et=ei}}catch($){et=ei}try{if(typeof clearTimeout==="function"){en=clearTimeout}else{en=eo}}catch($){en=eo}})();function es($){if(et===setTimeout){return setTimeout($,0)}if((et===ei||!et)&&setTimeout){et=setTimeout;return setTimeout($,0)}try{return et($,0)}catch(ee){try{return et.call(null,$,0)}catch(ee){return et.call(this,$,0)}}}function eu($){if(en===clearTimeout){return clearTimeout($)}if((en===eo||!en)&&clearTimeout){en=clearTimeout;return clearTimeout($)}try{return en($)}catch(ee){try{return en.call(null,$)}catch(ee){return en.call(this,$)}}}var el=[];var ef=false;var ed;var ep=-1;function eh(){if(!ef||!ed){return}ef=false;if(ed.length){el=ed.concat(el)}else{ep=-1}if(el.length){ey()}}function ey(){if(ef){return}var $=es(eh);ef=true;var ee=el.length;while(ee){ed=el;el=[];while(++ep<ee){if(ed){ed[ep].run()}}ep=-1;ee=el.length}ed=null;ef=false;eu($)}ee.nextTick=function($){var ee=new Array(arguments.length-1);if(arguments.length>1){for(var et=1;et<arguments.length;et++){ee[et-1]=arguments[et]}}el.push(new eg($,ee));if(el.length===1&&!ef){es(ey)}};function eg($,ee){this.fun=$;this.array=ee}eg.prototype.run=function(){this.fun.apply(null,this.array)};ee.title="browser";ee.browser=true;ee.env={};ee.argv=[];ee.version="";ee.versions={};function em(){}ee.on=em;ee.addListener=em;ee.once=em;ee.off=em;ee.removeListener=em;ee.removeAllListeners=em;ee.emit=em;ee.prependListener=em;ee.prependOnceListener=em;ee.listeners=function($){return[]};ee.binding=function($){throw new Error("process.binding is not supported")};ee.cwd=function(){return"/"};ee.chdir=function($){throw new Error("process.chdir is not supported")};ee.umask=function(){return 0}},4281:$=>{"use strict";function ee($,ee){$.prototype=Object.create(ee.prototype);$.prototype.constructor=$;$.__proto__=ee}var et={};function en($,en,ei){if(!ei){ei=Error}function eo($,ee,et){if(typeof en==="string"){return en}else{return en($,ee,et)}}var es=function($){ee(et,$);function et(ee,et,en){return $.call(this,eo(ee,et,en))||this}return et}(ei);es.prototype.name=ei.name;es.prototype.code=$;et[$]=es}function ei($,ee){if(Array.isArray($)){var et=$.length;$=$.map(function($){return String($)});if(et>2){return"one of ".concat(ee," ").concat($.slice(0,et-1).join(", "),", or ")+$[et-1]}else if(et===2){return"one of ".concat(ee," ").concat($[0]," or ").concat($[1])}else{return"of ".concat(ee," ").concat($[0])}}else{return"of ".concat(ee," ").concat(String($))}}function eo($,ee,et){return $.substr(!et||et<0?0:+et,ee.length)===ee}function es($,ee,et){if(et===undefined||et>$.length){et=$.length}return $.substring(et-ee.length,et)===ee}function eu($,ee,et){if(typeof et!=="number"){et=0}if(et+ee.length>$.length){return false}else{return $.indexOf(ee,et)!==-1}}en("ERR_INVALID_OPT_VALUE",function($,ee){return'The value "'+ee+'" is invalid for option "'+$+'"'},TypeError);en("ERR_INVALID_ARG_TYPE",function($,ee,et){var en;if(typeof ee==="string"&&eo(ee,"not ")){en="must not be";ee=ee.replace(/^not /,"")}else{en="must be"}var el;if(es($," argument")){el="The ".concat($," ").concat(en," ").concat(ei(ee,"type"))}else{var ef=eu($,".")?"property":"argument";el='The "'.concat($,'" ').concat(ef," ").concat(en," ").concat(ei(ee,"type"))}el+=". Received type ".concat(typeof et);return el},TypeError);en("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");en("ERR_METHOD_NOT_IMPLEMENTED",function($){return"The "+$+" method is not implemented"});en("ERR_STREAM_PREMATURE_CLOSE","Premature close");en("ERR_STREAM_DESTROYED",function($){return"Cannot call "+$+" after a stream was destroyed"});en("ERR_MULTIPLE_CALLBACK","Callback called multiple times");en("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");en("ERR_STREAM_WRITE_AFTER_END","write after end");en("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);en("ERR_UNKNOWN_ENCODING",function($){return"Unknown encoding: "+$},TypeError);en("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");$.exports.q=et},6753:($,ee,et)=>{"use strict";var en=et(4155);var ei=Object.keys||function($){var ee=[];for(var et in $)ee.push(et);return ee};$.exports=ed;var eo=et(9481);var es=et(4229);et(5717)(ed,eo);{var eu=ei(es.prototype);for(var el=0;el<eu.length;el++){var ef=eu[el];if(!ed.prototype[ef])ed.prototype[ef]=es.prototype[ef]}}function ed($){if(!(this instanceof ed))return new ed($);eo.call(this,$);es.call(this,$);this.allowHalfOpen=true;if($){if($.readable===false)this.readable=false;if($.writable===false)this.writable=false;if($.allowHalfOpen===false){this.allowHalfOpen=false;this.once("end",ep)}}}Object.defineProperty(ed.prototype,"writableHighWaterMark",{enumerable:false,get:function $(){return this._writableState.highWaterMark}});Object.defineProperty(ed.prototype,"writableBuffer",{enumerable:false,get:function $(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(ed.prototype,"writableLength",{enumerable:false,get:function $(){return this._writableState.length}});function ep(){if(this._writableState.ended)return;en.nextTick(eh,this)}function eh($){$.end()}Object.defineProperty(ed.prototype,"destroyed",{enumerable:false,get:function $(){if(this._readableState===undefined||this._writableState===undefined){return false}return this._readableState.destroyed&&this._writableState.destroyed},set:function $($){if(this._readableState===undefined||this._writableState===undefined){return}this._readableState.destroyed=$;this._writableState.destroyed=$}})},2725:($,ee,et)=>{"use strict";$.exports=ei;var en=et(4605);et(5717)(ei,en);function ei($){if(!(this instanceof ei))return new ei($);en.call(this,$)}ei.prototype._transform=function($,ee,et){et(null,$)}},9481:($,ee,et)=>{"use strict";var en=et(4155);$.exports=eL;var ei;eL.ReadableState=eM;var eo=et(7187).EventEmitter;var es=function $($,ee){return $.listeners(ee).length};var eu=et(2503);var el=et(8764).Buffer;var ef=(typeof et.g!=="undefined"?et.g:typeof window!=="undefined"?window:typeof self!=="undefined"?self:{}).Uint8Array||function(){};function ed($){return el.from($)}function ep($){return el.isBuffer($)||$ instanceof ef}var eh=et(4616);var ey;if(eh&&eh.debuglog){ey=eh.debuglog("stream")}else{ey=function $(){}}var eg=et(7327);var em=et(1195);var e_=et(2457),ew=e_.getHighWaterMark;var eE=et(4281).q,eS=eE.ERR_INVALID_ARG_TYPE,eT=eE.ERR_STREAM_PUSH_AFTER_EOF,eO=eE.ERR_METHOD_NOT_IMPLEMENTED,eA=eE.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;var eI;var eN;var eD;et(5717)(eL,eu);var eR=em.errorOrDestroy;var eC=["error","close","destroy","pause","resume"];function ek($,ee,et){if(typeof $.prependListener==="function")return $.prependListener(ee,et);if(!$._events||!$._events[ee])$.on(ee,et);else if(Array.isArray($._events[ee]))$._events[ee].unshift(et);else $._events[ee]=[et,$._events[ee]]}function eM($,ee,en){ei=ei||et(6753);$=$||{};if(typeof en!=="boolean")en=ee instanceof ei;this.objectMode=!!$.objectMode;if(en)this.objectMode=this.objectMode||!!$.readableObjectMode;this.highWaterMark=ew(this,$,"readableHighWaterMark",en);this.buffer=new eg;this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=null;this.ended=false;this.endEmitted=false;this.reading=false;this.sync=true;this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.resumeScheduled=false;this.paused=true;this.emitClose=$.emitClose!==false;this.autoDestroy=!!$.autoDestroy;this.destroyed=false;this.defaultEncoding=$.defaultEncoding||"utf8";this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if($.encoding){if(!eI)eI=et(4626).s;this.decoder=new eI($.encoding);this.encoding=$.encoding}}function eL($){ei=ei||et(6753);if(!(this instanceof eL))return new eL($);var ee=this instanceof ei;this._readableState=new eM($,this,ee);this.readable=true;if($){if(typeof $.read==="function")this._read=$.read;if(typeof $.destroy==="function")this._destroy=$.destroy}eu.call(this)}Object.defineProperty(eL.prototype,"destroyed",{enumerable:false,get:function $(){if(this._readableState===undefined){return false}return this._readableState.destroyed},set:function $($){if(!this._readableState){return}this._readableState.destroyed=$}});eL.prototype.destroy=em.destroy;eL.prototype._undestroy=em.undestroy;eL.prototype._destroy=function($,ee){ee($)};eL.prototype.push=function($,ee){var et=this._readableState;var en;if(!et.objectMode){if(typeof $==="string"){ee=ee||et.defaultEncoding;if(ee!==et.encoding){$=el.from($,ee);ee=""}en=true}}else{en=true}return eP(this,$,ee,false,en)};eL.prototype.unshift=function($){return eP(this,$,null,true,false)};function eP($,ee,et,en,ei){ey("readableAddChunk",ee);var eo=$._readableState;if(ee===null){eo.reading=false;eH($,eo)}else{var es;if(!ei)es=eB(eo,ee);if(es){eR($,es)}else if(eo.objectMode||ee&&ee.length>0){if(typeof ee!=="string"&&!eo.objectMode&&Object.getPrototypeOf(ee)!==el.prototype){ee=ed(ee)}if(en){if(eo.endEmitted)eR($,new eA);else eF($,eo,ee,true)}else if(eo.ended){eR($,new eT)}else if(eo.destroyed){return false}else{eo.reading=false;if(eo.decoder&&!et){ee=eo.decoder.write(ee);if(eo.objectMode||ee.length!==0)eF($,eo,ee,false);else e$($,eo)}else{eF($,eo,ee,false)}}}else if(!en){eo.reading=false;e$($,eo)}}return!eo.ended&&(eo.length<eo.highWaterMark||eo.length===0)}function eF($,ee,et,en){if(ee.flowing&&ee.length===0&&!ee.sync){ee.awaitDrain=0;$.emit("data",et)}else{ee.length+=ee.objectMode?1:et.length;if(en)ee.buffer.unshift(et);else ee.buffer.push(et);if(ee.needReadable)ez($)}e$($,ee)}function eB($,ee){var et;if(!ep(ee)&&typeof ee!=="string"&&ee!==undefined&&!$.objectMode){et=new eS("chunk",["string","Buffer","Uint8Array"],ee)}return et}eL.prototype.isPaused=function(){return this._readableState.flowing===false};eL.prototype.setEncoding=function($){if(!eI)eI=et(4626).s;var ee=new eI($);this._readableState.decoder=ee;this._readableState.encoding=this._readableState.decoder.encoding;var en=this._readableState.buffer.head;var ei="";while(en!==null){ei+=ee.write(en.data);en=en.next}this._readableState.buffer.clear();if(ei!=="")this._readableState.buffer.push(ei);this._readableState.length=ei.length;return this};var eU=1073741824;function ej($){if($>=eU){$=eU}else{$--;$|=$>>>1;$|=$>>>2;$|=$>>>4;$|=$>>>8;$|=$>>>16;$++}return $}function eW($,ee){if($<=0||ee.length===0&&ee.ended)return 0;if(ee.objectMode)return 1;if($!==$){if(ee.flowing&&ee.length)return ee.buffer.head.data.length;else return ee.length}if($>ee.highWaterMark)ee.highWaterMark=ej($);if($<=ee.length)return $;if(!ee.ended){ee.needReadable=true;return 0}return ee.length}eL.prototype.read=function($){ey("read",$);$=parseInt($,10);var ee=this._readableState;var et=$;if($!==0)ee.emittedReadable=false;if($===0&&ee.needReadable&&((ee.highWaterMark!==0?ee.length>=ee.highWaterMark:ee.length>0)||ee.ended)){ey("read: emitReadable",ee.length,ee.ended);if(ee.length===0&&ee.ended)e0(this);else ez(this);return null}$=eW($,ee);if($===0&&ee.ended){if(ee.length===0)e0(this);return null}var en=ee.needReadable;ey("need readable",en);if(ee.length===0||ee.length-$<ee.highWaterMark){en=true;ey("length less than watermark",en)}if(ee.ended||ee.reading){en=false;ey("reading or ended",en)}else if(en){ey("do read");ee.reading=true;ee.sync=true;if(ee.length===0)ee.needReadable=true;this._read(ee.highWaterMark);ee.sync=false;if(!ee.reading)$=eW(et,ee)}var ei;if($>0)ei=eQ($,ee);else ei=null;if(ei===null){ee.needReadable=ee.length<=ee.highWaterMark;$=0}else{ee.length-=$;ee.awaitDrain=0}if(ee.length===0){if(!ee.ended)ee.needReadable=true;if(et!==$&&ee.ended)e0(this)}if(ei!==null)this.emit("data",ei);return ei};function eH($,ee){ey("onEofChunk");if(ee.ended)return;if(ee.decoder){var et=ee.decoder.end();if(et&&et.length){ee.buffer.push(et);ee.length+=ee.objectMode?1:et.length}}ee.ended=true;if(ee.sync){ez($)}else{ee.needReadable=false;if(!ee.emittedReadable){ee.emittedReadable=true;eV($)}}}function ez($){var ee=$._readableState;ey("emitReadable",ee.needReadable,ee.emittedReadable);ee.needReadable=false;if(!ee.emittedReadable){ey("emitReadable",ee.flowing);ee.emittedReadable=true;en.nextTick(eV,$)}}function eV($){var ee=$._readableState;ey("emitReadable_",ee.destroyed,ee.length,ee.ended);if(!ee.destroyed&&(ee.length||ee.ended)){$.emit("readable");ee.emittedReadable=false}ee.needReadable=!ee.flowing&&!ee.ended&&ee.length<=ee.highWaterMark;eX($)}function e$($,ee){if(!ee.readingMore){ee.readingMore=true;en.nextTick(eq,$,ee)}}function eq($,ee){while(!ee.reading&&!ee.ended&&(ee.length<ee.highWaterMark||ee.flowing&&ee.length===0)){var et=ee.length;ey("maybeReadMore read 0");$.read(0);if(et===ee.length)break}ee.readingMore=false}eL.prototype._read=function($){eR(this,new eO("_read()"))};eL.prototype.pipe=function($,ee){var et=this;var ei=this._readableState;switch(ei.pipesCount){case 0:ei.pipes=$;break;case 1:ei.pipes=[ei.pipes,$];break;default:ei.pipes.push($);break}ei.pipesCount+=1;ey("pipe count=%d opts=%j",ei.pipesCount,ee);var eo=(!ee||ee.end!==false)&&$!==en.stdout&&$!==en.stderr;var eu=eo?ef:eE;if(ei.endEmitted)en.nextTick(eu);else et.once("end",eu);$.on("unpipe",el);function el($,ee){ey("onunpipe");if($===et){if(ee&&ee.hasUnpiped===false){ee.hasUnpiped=true;eh()}}}function ef(){ey("onend");$.end()}var ed=eG(et);$.on("drain",ed);var ep=false;function eh(){ey("cleanup");$.removeListener("close",e_);$.removeListener("finish",ew);$.removeListener("drain",ed);$.removeListener("error",em);$.removeListener("unpipe",el);et.removeListener("end",ef);et.removeListener("end",eE);et.removeListener("data",eg);ep=true;if(ei.awaitDrain&&(!$._writableState||$._writableState.needDrain))ed()}et.on("data",eg);function eg(ee){ey("ondata");var en=$.write(ee);ey("dest.write",en);if(en===false){if((ei.pipesCount===1&&ei.pipes===$||ei.pipesCount>1&&e2(ei.pipes,$)!==-1)&&!ep){ey("false write response, pause",ei.awaitDrain);ei.awaitDrain++}et.pause()}}function em(ee){ey("onerror",ee);eE();$.removeListener("error",em);if(es($,"error")===0)eR($,ee)}ek($,"error",em);function e_(){$.removeListener("finish",ew);eE()}$.once("close",e_);function ew(){ey("onfinish");$.removeListener("close",e_);eE()}$.once("finish",ew);function eE(){ey("unpipe");et.unpipe($)}$.emit("pipe",et);if(!ei.flowing){ey("pipe resume");et.resume()}return $};function eG($){return function ee(){var ee=$._readableState;ey("pipeOnDrain",ee.awaitDrain);if(ee.awaitDrain)ee.awaitDrain--;if(ee.awaitDrain===0&&es($,"data")){ee.flowing=true;eX($)}}}eL.prototype.unpipe=function($){var ee=this._readableState;var et={hasUnpiped:false};if(ee.pipesCount===0)return this;if(ee.pipesCount===1){if($&&$!==ee.pipes)return this;if(!$)$=ee.pipes;ee.pipes=null;ee.pipesCount=0;ee.flowing=false;if($)$.emit("unpipe",this,et);return this}if(!$){var en=ee.pipes;var ei=ee.pipesCount;ee.pipes=null;ee.pipesCount=0;ee.flowing=false;for(var eo=0;eo<ei;eo++)en[eo].emit("unpipe",this,{hasUnpiped:false});return this}var es=e2(ee.pipes,$);if(es===-1)return this;ee.pipes.splice(es,1);ee.pipesCount-=1;if(ee.pipesCount===1)ee.pipes=ee.pipes[0];$.emit("unpipe",this,et);return this};eL.prototype.on=function($,ee){var et=eu.prototype.on.call(this,$,ee);var ei=this._readableState;if($==="data"){ei.readableListening=this.listenerCount("readable")>0;if(ei.flowing!==false)this.resume()}else if($==="readable"){if(!ei.endEmitted&&!ei.readableListening){ei.readableListening=ei.needReadable=true;ei.flowing=false;ei.emittedReadable=false;ey("on readable",ei.length,ei.reading);if(ei.length){ez(this)}else if(!ei.reading){en.nextTick(eK,this)}}}return et};eL.prototype.addListener=eL.prototype.on;eL.prototype.removeListener=function($,ee){var et=eu.prototype.removeListener.call(this,$,ee);if($==="readable"){en.nextTick(eY,this)}return et};eL.prototype.removeAllListeners=function($){var ee=eu.prototype.removeAllListeners.apply(this,arguments);if($==="readable"||$===undefined){en.nextTick(eY,this)}return ee};function eY($){var ee=$._readableState;ee.readableListening=$.listenerCount("readable")>0;if(ee.resumeScheduled&&!ee.paused){ee.flowing=true}else if($.listenerCount("data")>0){$.resume()}}function eK($){ey("readable nexttick read 0");$.read(0)}eL.prototype.resume=function(){var $=this._readableState;if(!$.flowing){ey("resume");$.flowing=!$.readableListening;eZ(this,$)}$.paused=false;return this};function eZ($,ee){if(!ee.resumeScheduled){ee.resumeScheduled=true;en.nextTick(eJ,$,ee)}}function eJ($,ee){ey("resume",ee.reading);if(!ee.reading){$.read(0)}ee.resumeScheduled=false;$.emit("resume");eX($);if(ee.flowing&&!ee.reading)$.read(0)}eL.prototype.pause=function(){ey("call pause flowing=%j",this._readableState.flowing);if(this._readableState.flowing!==false){ey("pause");this._readableState.flowing=false;this.emit("pause")}this._readableState.paused=true;return this};function eX($){var ee=$._readableState;ey("flow",ee.flowing);while(ee.flowing&&$.read()!==null);}eL.prototype.wrap=function($){var ee=this;var et=this._readableState;var en=false;$.on("end",function(){ey("wrapped end");if(et.decoder&&!et.ended){var $=et.decoder.end();if($&&$.length)ee.push($)}ee.push(null)});$.on("data",function(ei){ey("wrapped data");if(et.decoder)ei=et.decoder.write(ei);if(et.objectMode&&(ei===null||ei===undefined))return;else if(!et.objectMode&&(!ei||!ei.length))return;var eo=ee.push(ei);if(!eo){en=true;$.pause()}});for(var ei in $){if(this[ei]===undefined&&typeof $[ei]==="function"){this[ei]=function ee(ee){return function et(){return $[ee].apply($,arguments)}}(ei)}}for(var eo=0;eo<eC.length;eo++){$.on(eC[eo],this.emit.bind(this,eC[eo]))}this._read=function(ee){ey("wrapped _read",ee);if(en){en=false;$.resume()}};return this};if(typeof Symbol==="function"){eL.prototype[Symbol.asyncIterator]=function(){if(eN===undefined){eN=et(5850)}return eN(this)}}Object.defineProperty(eL.prototype,"readableHighWaterMark",{enumerable:false,get:function $(){return this._readableState.highWaterMark}});Object.defineProperty(eL.prototype,"readableBuffer",{enumerable:false,get:function $(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(eL.prototype,"readableFlowing",{enumerable:false,get:function $(){return this._readableState.flowing},set:function $($){if(this._readableState){this._readableState.flowing=$}}});eL._fromList=eQ;Object.defineProperty(eL.prototype,"readableLength",{enumerable:false,get:function $(){return this._readableState.length}});function eQ($,ee){if(ee.length===0)return null;var et;if(ee.objectMode)et=ee.buffer.shift();else if(!$||$>=ee.length){if(ee.decoder)et=ee.buffer.join("");else if(ee.buffer.length===1)et=ee.buffer.first();else et=ee.buffer.concat(ee.length);ee.buffer.clear()}else{et=ee.buffer.consume($,ee.decoder)}return et}function e0($){var ee=$._readableState;ey("endReadable",ee.endEmitted);if(!ee.endEmitted){ee.ended=true;en.nextTick(e1,ee,$)}}function e1($,ee){ey("endReadableNT",$.endEmitted,$.length);if(!$.endEmitted&&$.length===0){$.endEmitted=true;ee.readable=false;ee.emit("end");if($.autoDestroy){var et=ee._writableState;if(!et||et.autoDestroy&&et.finished){ee.destroy()}}}}if(typeof Symbol==="function"){eL.from=function($,ee){if(eD===undefined){eD=et(5167)}return eD(eL,$,ee)}}function e2($,ee){for(var et=0,en=$.length;et<en;et++){if($[et]===ee)return et}return-1}},4605:($,ee,et)=>{"use strict";$.exports=ed;var en=et(4281).q,ei=en.ERR_METHOD_NOT_IMPLEMENTED,eo=en.ERR_MULTIPLE_CALLBACK,es=en.ERR_TRANSFORM_ALREADY_TRANSFORMING,eu=en.ERR_TRANSFORM_WITH_LENGTH_0;var el=et(6753);et(5717)(ed,el);function ef($,ee){var et=this._transformState;et.transforming=false;var en=et.writecb;if(en===null){return this.emit("error",new eo)}et.writechunk=null;et.writecb=null;if(ee!=null)this.push(ee);en($);var ei=this._readableState;ei.reading=false;if(ei.needReadable||ei.length<ei.highWaterMark){this._read(ei.highWaterMark)}}function ed($){if(!(this instanceof ed))return new ed($);el.call(this,$);this._transformState={afterTransform:ef.bind(this),needTransform:false,transforming:false,writecb:null,writechunk:null,writeencoding:null};this._readableState.needReadable=true;this._readableState.sync=false;if($){if(typeof $.transform==="function")this._transform=$.transform;if(typeof $.flush==="function")this._flush=$.flush}this.on("prefinish",ep)}function ep(){var $=this;if(typeof this._flush==="function"&&!this._readableState.destroyed){this._flush(function(ee,et){eh($,ee,et)})}else{eh(this,null,null)}}ed.prototype.push=function($,ee){this._transformState.needTransform=false;return el.prototype.push.call(this,$,ee)};ed.prototype._transform=function($,ee,et){et(new ei("_transform()"))};ed.prototype._write=function($,ee,et){var en=this._transformState;en.writecb=et;en.writechunk=$;en.writeencoding=ee;if(!en.transforming){var ei=this._readableState;if(en.needTransform||ei.needReadable||ei.length<ei.highWaterMark)this._read(ei.highWaterMark)}};ed.prototype._read=function($){var ee=this._transformState;if(ee.writechunk!==null&&!ee.transforming){ee.transforming=true;this._transform(ee.writechunk,ee.writeencoding,ee.afterTransform)}else{ee.needTransform=true}};ed.prototype._destroy=function($,ee){el.prototype._destroy.call(this,$,function($){ee($)})};function eh($,ee,et){if(ee)return $.emit("error",ee);if(et!=null)$.push(et);if($._writableState.length)throw new eu;if($._transformState.transforming)throw new es;return $.push(null)}},4229:($,ee,et)=>{"use strict";var en=et(4155);$.exports=eM;function ei($,ee,et){this.chunk=$;this.encoding=ee;this.callback=et;this.next=null}function eo($){var ee=this;this.next=null;this.entry=null;this.finish=function(){eJ(ee,$)}}var es;eM.WritableState=eC;var eu={deprecate:et(4927)};var el=et(2503);var ef=et(8764).Buffer;var ed=(typeof et.g!=="undefined"?et.g:typeof window!=="undefined"?window:typeof self!=="undefined"?self:{}).Uint8Array||function(){};function ep($){return ef.from($)}function eh($){return ef.isBuffer($)||$ instanceof ed}var ey=et(1195);var eg=et(2457),em=eg.getHighWaterMark;var e_=et(4281).q,ew=e_.ERR_INVALID_ARG_TYPE,eE=e_.ERR_METHOD_NOT_IMPLEMENTED,eS=e_.ERR_MULTIPLE_CALLBACK,eT=e_.ERR_STREAM_CANNOT_PIPE,eO=e_.ERR_STREAM_DESTROYED,eA=e_.ERR_STREAM_NULL_VALUES,eI=e_.ERR_STREAM_WRITE_AFTER_END,eN=e_.ERR_UNKNOWN_ENCODING;var eD=ey.errorOrDestroy;et(5717)(eM,el);function eR(){}function eC($,ee,en){es=es||et(6753);$=$||{};if(typeof en!=="boolean")en=ee instanceof es;this.objectMode=!!$.objectMode;if(en)this.objectMode=this.objectMode||!!$.writableObjectMode;this.highWaterMark=em(this,$,"writableHighWaterMark",en);this.finalCalled=false;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;this.destroyed=false;var ei=$.decodeStrings===false;this.decodeStrings=!ei;this.defaultEncoding=$.defaultEncoding||"utf8";this.length=0;this.writing=false;this.corked=0;this.sync=true;this.bufferProcessing=false;this.onwrite=function($){eH(ee,$)};this.writecb=null;this.writelen=0;this.bufferedRequest=null;this.lastBufferedRequest=null;this.pendingcb=0;this.prefinished=false;this.errorEmitted=false;this.emitClose=$.emitClose!==false;this.autoDestroy=!!$.autoDestroy;this.bufferedRequestCount=0;this.corkedRequestsFree=new eo(this)}eC.prototype.getBuffer=function $(){var $=this.bufferedRequest;var ee=[];while($){ee.push($);$=$.next}return ee};(function(){try{Object.defineProperty(eC.prototype,"buffer",{get:eu.deprecate(function $(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer "+"instead.","DEP0003")})}catch($){}})();var ek;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function"){ek=Function.prototype[Symbol.hasInstance];Object.defineProperty(eM,Symbol.hasInstance,{value:function $($){if(ek.call(this,$))return true;if(this!==eM)return false;return $&&$._writableState instanceof eC}})}else{ek=function $($){return $ instanceof this}}function eM($){es=es||et(6753);var ee=this instanceof es;if(!ee&&!ek.call(eM,this))return new eM($);this._writableState=new eC($,this,ee);this.writable=true;if($){if(typeof $.write==="function")this._write=$.write;if(typeof $.writev==="function")this._writev=$.writev;if(typeof $.destroy==="function")this._destroy=$.destroy;if(typeof $.final==="function")this._final=$.final}el.call(this)}eM.prototype.pipe=function(){eD(this,new eT)};function eL($,ee){var et=new eI;eD($,et);en.nextTick(ee,et)}function eP($,ee,et,ei){var eo;if(et===null){eo=new eA}else if(typeof et!=="string"&&!ee.objectMode){eo=new ew("chunk",["string","Buffer"],et)}if(eo){eD($,eo);en.nextTick(ei,eo);return false}return true}eM.prototype.write=function($,ee,et){var en=this._writableState;var ei=false;var eo=!en.objectMode&&eh($);if(eo&&!ef.isBuffer($)){$=ep($)}if(typeof ee==="function"){et=ee;ee=null}if(eo)ee="buffer";else if(!ee)ee=en.defaultEncoding;if(typeof et!=="function")et=eR;if(en.ending)eL(this,et);else if(eo||eP(this,en,$,et)){en.pendingcb++;ei=eB(this,en,eo,$,ee,et)}return ei};eM.prototype.cork=function(){this._writableState.corked++};eM.prototype.uncork=function(){var $=this._writableState;if($.corked){$.corked--;if(!$.writing&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest)e$(this,$)}};eM.prototype.setDefaultEncoding=function $($){if(typeof $==="string")$=$.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf(($+"").toLowerCase())>-1))throw new eN($);this._writableState.defaultEncoding=$;return this};Object.defineProperty(eM.prototype,"writableBuffer",{enumerable:false,get:function $(){return this._writableState&&this._writableState.getBuffer()}});function eF($,ee,et){if(!$.objectMode&&$.decodeStrings!==false&&typeof ee==="string"){ee=ef.from(ee,et)}return ee}Object.defineProperty(eM.prototype,"writableHighWaterMark",{enumerable:false,get:function $(){return this._writableState.highWaterMark}});function eB($,ee,et,en,ei,eo){if(!et){var es=eF(ee,en,ei);if(en!==es){et=true;ei="buffer";en=es}}var eu=ee.objectMode?1:en.length;ee.length+=eu;var el=ee.length<ee.highWaterMark;if(!el)ee.needDrain=true;if(ee.writing||ee.corked){var ef=ee.lastBufferedRequest;ee.lastBufferedRequest={chunk:en,encoding:ei,isBuf:et,callback:eo,next:null};if(ef){ef.next=ee.lastBufferedRequest}else{ee.bufferedRequest=ee.lastBufferedRequest}ee.bufferedRequestCount+=1}else{eU($,ee,false,eu,en,ei,eo)}return el}function eU($,ee,et,en,ei,eo,es){ee.writelen=en;ee.writecb=es;ee.writing=true;ee.sync=true;if(ee.destroyed)ee.onwrite(new eO("write"));else if(et)$._writev(ei,ee.onwrite);else $._write(ei,eo,ee.onwrite);ee.sync=false}function ej($,ee,et,ei,eo){--ee.pendingcb;if(et){en.nextTick(eo,ei);en.nextTick(eK,$,ee);$._writableState.errorEmitted=true;eD($,ei)}else{eo(ei);$._writableState.errorEmitted=true;eD($,ei);eK($,ee)}}function eW($){$.writing=false;$.writecb=null;$.length-=$.writelen;$.writelen=0}function eH($,ee){var et=$._writableState;var ei=et.sync;var eo=et.writecb;if(typeof eo!=="function")throw new eS;eW(et);if(ee)ej($,et,ei,ee,eo);else{var es=eq(et)||$.destroyed;if(!es&&!et.corked&&!et.bufferProcessing&&et.bufferedRequest){e$($,et)}if(ei){en.nextTick(ez,$,et,es,eo)}else{ez($,et,es,eo)}}}function ez($,ee,et,en){if(!et)eV($,ee);ee.pendingcb--;en();eK($,ee)}function eV($,ee){if(ee.length===0&&ee.needDrain){ee.needDrain=false;$.emit("drain")}}function e$($,ee){ee.bufferProcessing=true;var et=ee.bufferedRequest;if($._writev&&et&&et.next){var en=ee.bufferedRequestCount;var ei=new Array(en);var es=ee.corkedRequestsFree;es.entry=et;var eu=0;var el=true;while(et){ei[eu]=et;if(!et.isBuf)el=false;et=et.next;eu+=1}ei.allBuffers=el;eU($,ee,true,ee.length,ei,"",es.finish);ee.pendingcb++;ee.lastBufferedRequest=null;if(es.next){ee.corkedRequestsFree=es.next;es.next=null}else{ee.corkedRequestsFree=new eo(ee)}ee.bufferedRequestCount=0}else{while(et){var ef=et.chunk;var ed=et.encoding;var ep=et.callback;var eh=ee.objectMode?1:ef.length;eU($,ee,false,eh,ef,ed,ep);et=et.next;ee.bufferedRequestCount--;if(ee.writing){break}}if(et===null)ee.lastBufferedRequest=null}ee.bufferedRequest=et;ee.bufferProcessing=false}eM.prototype._write=function($,ee,et){et(new eE("_write()"))};eM.prototype._writev=null;eM.prototype.end=function($,ee,et){var en=this._writableState;if(typeof $==="function"){et=$;$=null;ee=null}else if(typeof ee==="function"){et=ee;ee=null}if($!==null&&$!==undefined)this.write($,ee);if(en.corked){en.corked=1;this.uncork()}if(!en.ending)eZ(this,en,et);return this};Object.defineProperty(eM.prototype,"writableLength",{enumerable:false,get:function $(){return this._writableState.length}});function eq($){return $.ending&&$.length===0&&$.bufferedRequest===null&&!$.finished&&!$.writing}function eG($,ee){$._final(function(et){ee.pendingcb--;if(et){eD($,et)}ee.prefinished=true;$.emit("prefinish");eK($,ee)})}function eY($,ee){if(!ee.prefinished&&!ee.finalCalled){if(typeof $._final==="function"&&!ee.destroyed){ee.pendingcb++;ee.finalCalled=true;en.nextTick(eG,$,ee)}else{ee.prefinished=true;$.emit("prefinish")}}}function eK($,ee){var et=eq(ee);if(et){eY($,ee);if(ee.pendingcb===0){ee.finished=true;$.emit("finish");if(ee.autoDestroy){var en=$._readableState;if(!en||en.autoDestroy&&en.endEmitted){$.destroy()}}}}return et}function eZ($,ee,et){ee.ending=true;eK($,ee);if(et){if(ee.finished)en.nextTick(et);else $.once("finish",et)}ee.ended=true;$.writable=false}function eJ($,ee,et){var en=$.entry;$.entry=null;while(en){var ei=en.callback;ee.pendingcb--;ei(et);en=en.next}ee.corkedRequestsFree.next=$}Object.defineProperty(eM.prototype,"destroyed",{enumerable:false,get:function $(){if(this._writableState===undefined){return false}return this._writableState.destroyed},set:function $($){if(!this._writableState){return}this._writableState.destroyed=$}});eM.prototype.destroy=ey.destroy;eM.prototype._undestroy=ey.undestroy;eM.prototype._destroy=function($,ee){ee($)}},5850:($,ee,et)=>{"use strict";var en=et(4155);var ei;function eo($,ee,et){ee=es(ee);if(ee in $){Object.defineProperty($,ee,{value:et,enumerable:true,configurable:true,writable:true})}else{$[ee]=et}return $}function es($){var ee=eu($,"string");return typeof ee==="symbol"?ee:String(ee)}function eu($,ee){if(typeof $!=="object"||$===null)return $;var et=$[Symbol.toPrimitive];if(et!==undefined){var en=et.call($,ee||"default");if(typeof en!=="object")return en;throw new TypeError("@@toPrimitive must return a primitive value.")}return(ee==="string"?String:Number)($)}var el=et(8610);var ef=Symbol("lastResolve");var ed=Symbol("lastReject");var ep=Symbol("error");var eh=Symbol("ended");var ey=Symbol("lastPromise");var eg=Symbol("handlePromise");var em=Symbol("stream");function e_($,ee){return{value:$,done:ee}}function ew($){var ee=$[ef];if(ee!==null){var et=$[em].read();if(et!==null){$[ey]=null;$[ef]=null;$[ed]=null;ee(e_(et,false))}}}function eE($){en.nextTick(ew,$)}function eS($,ee){return function(et,en){$.then(function(){if(ee[eh]){et(e_(undefined,true));return}ee[eg](et,en)},en)}}var eT=Object.getPrototypeOf(function(){});var eO=Object.setPrototypeOf((ei={get stream(){return this[em]},next:function $(){var $=this;var ee=this[ep];if(ee!==null){return Promise.reject(ee)}if(this[eh]){return Promise.resolve(e_(undefined,true))}if(this[em].destroyed){return new Promise(function(ee,et){en.nextTick(function(){if($[ep]){et($[ep])}else{ee(e_(undefined,true))}})})}var et=this[ey];var ei;if(et){ei=new Promise(eS(et,this))}else{var eo=this[em].read();if(eo!==null){return Promise.resolve(e_(eo,false))}ei=new Promise(this[eg])}this[ey]=ei;return ei}},eo(ei,Symbol.asyncIterator,function(){return this}),eo(ei,"return",function $(){var $=this;return new Promise(function(ee,et){$[em].destroy(null,function($){if($){et($);return}ee(e_(undefined,true))})})}),ei),eT);var eA=function $($){var ee;var et=Object.create(eO,(ee={},eo(ee,em,{value:$,writable:true}),eo(ee,ef,{value:null,writable:true}),eo(ee,ed,{value:null,writable:true}),eo(ee,ep,{value:null,writable:true}),eo(ee,eh,{value:$._readableState.endEmitted,writable:true}),eo(ee,eg,{value:function $($,ee){var en=et[em].read();if(en){et[ey]=null;et[ef]=null;et[ed]=null;$(e_(en,false))}else{et[ef]=$;et[ed]=ee}},writable:true}),ee));et[ey]=null;el($,function($){if($&&$.code!=="ERR_STREAM_PREMATURE_CLOSE"){var ee=et[ed];if(ee!==null){et[ey]=null;et[ef]=null;et[ed]=null;ee($)}et[ep]=$;return}var en=et[ef];if(en!==null){et[ey]=null;et[ef]=null;et[ed]=null;en(e_(undefined,true))}et[eh]=true});$.on("readable",eE.bind(null,et));return et};$.exports=eA},7327:($,ee,et)=>{"use strict";function en($,ee){var et=Object.keys($);if(Object.getOwnPropertySymbols){var en=Object.getOwnPropertySymbols($);ee&&(en=en.filter(function(ee){return Object.getOwnPropertyDescriptor($,ee).enumerable})),et.push.apply(et,en)}return et}function ei($){for(var ee=1;ee<arguments.length;ee++){var et=null!=arguments[ee]?arguments[ee]:{};ee%2?en(Object(et),!0).forEach(function(ee){eo($,ee,et[ee])}):Object.getOwnPropertyDescriptors?Object.defineProperties($,Object.getOwnPropertyDescriptors(et)):en(Object(et)).forEach(function(ee){Object.defineProperty($,ee,Object.getOwnPropertyDescriptor(et,ee))})}return $}function eo($,ee,et){ee=ef(ee);if(ee in $){Object.defineProperty($,ee,{value:et,enumerable:true,configurable:true,writable:true})}else{$[ee]=et}return $}function es($,ee){if(!($ instanceof ee)){throw new TypeError("Cannot call a class as a function")}}function eu($,ee){for(var et=0;et<ee.length;et++){var en=ee[et];en.enumerable=en.enumerable||false;en.configurable=true;if("value"in en)en.writable=true;Object.defineProperty($,ef(en.key),en)}}function el($,ee,et){if(ee)eu($.prototype,ee);if(et)eu($,et);Object.defineProperty($,"prototype",{writable:false});return $}function ef($){var ee=ed($,"string");return typeof ee==="symbol"?ee:String(ee)}function ed($,ee){if(typeof $!=="object"||$===null)return $;var et=$[Symbol.toPrimitive];if(et!==undefined){var en=et.call($,ee||"default");if(typeof en!=="object")return en;throw new TypeError("@@toPrimitive must return a primitive value.")}return(ee==="string"?String:Number)($)}var ep=et(8764),eh=ep.Buffer;var ey=et(2361),eg=ey.inspect;var em=eg&&eg.custom||"inspect";function e_($,ee,et){eh.prototype.copy.call($,ee,et)}$.exports=function(){function $(){es(this,$);this.head=null;this.tail=null;this.length=0}el($,[{key:"push",value:function $($){var ee={data:$,next:null};if(this.length>0)this.tail.next=ee;else this.head=ee;this.tail=ee;++this.length}},{key:"unshift",value:function $($){var ee={data:$,next:this.head};if(this.length===0)this.tail=ee;this.head=ee;++this.length}},{key:"shift",value:function $(){if(this.length===0)return;var $=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return $}},{key:"clear",value:function $(){this.head=this.tail=null;this.length=0}},{key:"join",value:function $($){if(this.length===0)return"";var ee=this.head;var et=""+ee.data;while(ee=ee.next)et+=$+ee.data;return et}},{key:"concat",value:function $($){if(this.length===0)return eh.alloc(0);var ee=eh.allocUnsafe($>>>0);var et=this.head;var en=0;while(et){e_(et.data,ee,en);en+=et.data.length;et=et.next}return ee}},{key:"consume",value:function $($,ee){var et;if($<this.head.data.length){et=this.head.data.slice(0,$);this.head.data=this.head.data.slice($)}else if($===this.head.data.length){et=this.shift()}else{et=ee?this._getString($):this._getBuffer($)}return et}},{key:"first",value:function $(){return this.head.data}},{key:"_getString",value:function $($){var ee=this.head;var et=1;var en=ee.data;$-=en.length;while(ee=ee.next){var ei=ee.data;var eo=$>ei.length?ei.length:$;if(eo===ei.length)en+=ei;else en+=ei.slice(0,$);$-=eo;if($===0){if(eo===ei.length){++et;if(ee.next)this.head=ee.next;else this.head=this.tail=null}else{this.head=ee;ee.data=ei.slice(eo)}break}++et}this.length-=et;return en}},{key:"_getBuffer",value:function $($){var ee=eh.allocUnsafe($);var et=this.head;var en=1;et.data.copy(ee);$-=et.data.length;while(et=et.next){var ei=et.data;var eo=$>ei.length?ei.length:$;ei.copy(ee,ee.length-$,0,eo);$-=eo;if($===0){if(eo===ei.length){++en;if(et.next)this.head=et.next;else this.head=this.tail=null}else{this.head=et;et.data=ei.slice(eo)}break}++en}this.length-=en;return ee}},{key:em,value:function $($,ee){return eg(this,ei(ei({},ee),{},{depth:0,customInspect:false}))}}]);return $}()},1195:($,ee,et)=>{"use strict";var en=et(4155);function ei($,ee){var et=this;var ei=this._readableState&&this._readableState.destroyed;var eu=this._writableState&&this._writableState.destroyed;if(ei||eu){if(ee){ee($)}else if($){if(!this._writableState){en.nextTick(el,this,$)}else if(!this._writableState.errorEmitted){this._writableState.errorEmitted=true;en.nextTick(el,this,$)}}return this}if(this._readableState){this._readableState.destroyed=true}if(this._writableState){this._writableState.destroyed=true}this._destroy($||null,function($){if(!ee&&$){if(!et._writableState){en.nextTick(eo,et,$)}else if(!et._writableState.errorEmitted){et._writableState.errorEmitted=true;en.nextTick(eo,et,$)}else{en.nextTick(es,et)}}else if(ee){en.nextTick(es,et);ee($)}else{en.nextTick(es,et)}});return this}function eo($,ee){el($,ee);es($)}function es($){if($._writableState&&!$._writableState.emitClose)return;if($._readableState&&!$._readableState.emitClose)return;$.emit("close")}function eu(){if(this._readableState){this._readableState.destroyed=false;this._readableState.reading=false;this._readableState.ended=false;this._readableState.endEmitted=false}if(this._writableState){this._writableState.destroyed=false;this._writableState.ended=false;this._writableState.ending=false;this._writableState.finalCalled=false;this._writableState.prefinished=false;this._writableState.finished=false;this._writableState.errorEmitted=false}}function el($,ee){$.emit("error",ee)}function ef($,ee){var et=$._readableState;var en=$._writableState;if(et&&et.autoDestroy||en&&en.autoDestroy)$.destroy(ee);else $.emit("error",ee)}$.exports={destroy:ei,undestroy:eu,errorOrDestroy:ef}},8610:($,ee,et)=>{"use strict";var en=et(4281).q.ERR_STREAM_PREMATURE_CLOSE;function ei($){var ee=false;return function(){if(ee)return;ee=true;for(var et=arguments.length,en=new Array(et),ei=0;ei<et;ei++){en[ei]=arguments[ei]}$.apply(this,en)}}function eo(){}function es($){return $.setHeader&&typeof $.abort==="function"}function eu($,ee,et){if(typeof ee==="function")return eu($,null,ee);if(!ee)ee={};et=ei(et||eo);var el=ee.readable||ee.readable!==false&&$.readable;var ef=ee.writable||ee.writable!==false&&$.writable;var ed=function ee(){if(!$.writable)eh()};var ep=$._writableState&&$._writableState.finished;var eh=function ee(){ef=false;ep=true;if(!el)et.call($)};var ey=$._readableState&&$._readableState.endEmitted;var eg=function ee(){el=false;ey=true;if(!ef)et.call($)};var em=function ee(ee){et.call($,ee)};var e_=function ee(){var ee;if(el&&!ey){if(!$._readableState||!$._readableState.ended)ee=new en;return et.call($,ee)}if(ef&&!ep){if(!$._writableState||!$._writableState.ended)ee=new en;return et.call($,ee)}};var ew=function ee(){$.req.on("finish",eh)};if(es($)){$.on("complete",eh);$.on("abort",e_);if($.req)ew();else $.on("request",ew)}else if(ef&&!$._writableState){$.on("end",ed);$.on("close",ed)}$.on("end",eg);$.on("finish",eh);if(ee.error!==false)$.on("error",em);$.on("close",e_);return function(){$.removeListener("complete",eh);$.removeListener("abort",e_);$.removeListener("request",ew);if($.req)$.req.removeListener("finish",eh);$.removeListener("end",ed);$.removeListener("close",ed);$.removeListener("finish",eh);$.removeListener("end",eg);$.removeListener("error",em);$.removeListener("close",e_)}}$.exports=eu},5167:$=>{$.exports=function(){throw new Error("Readable.from is not available in the browser")}},9946:($,ee,et)=>{"use strict";var en;function ei($){var ee=false;return function(){if(ee)return;ee=true;$.apply(void 0,arguments)}}var eo=et(4281).q,es=eo.ERR_MISSING_ARGS,eu=eo.ERR_STREAM_DESTROYED;function el($){if($)throw $}function ef($){return $.setHeader&&typeof $.abort==="function"}function ed($,ee,eo,es){es=ei(es);var el=false;$.on("close",function(){el=true});if(en===undefined)en=et(8610);en($,{readable:ee,writable:eo},function($){if($)return es($);el=true;es()});var ed=false;return function(ee){if(el)return;if(ed)return;ed=true;if(ef($))return $.abort();if(typeof $.destroy==="function")return $.destroy();es(ee||new eu("pipe"))}}function ep($){$()}function eh($,ee){return $.pipe(ee)}function ey($){if(!$.length)return el;if(typeof $[$.length-1]!=="function")return el;return $.pop()}function eg(){for(var $=arguments.length,ee=new Array($),et=0;et<$;et++){ee[et]=arguments[et]}var en=ey(ee);if(Array.isArray(ee[0]))ee=ee[0];if(ee.length<2){throw new es("streams")}var ei;var eo=ee.map(function($,et){var es=et<ee.length-1;var eu=et>0;return ed($,es,eu,function($){if(!ei)ei=$;if($)eo.forEach(ep);if(es)return;eo.forEach(ep);en(ei)})});return ee.reduce(eh)}$.exports=eg},2457:($,ee,et)=>{"use strict";var en=et(4281).q.ERR_INVALID_OPT_VALUE;function ei($,ee,et){return $.highWaterMark!=null?$.highWaterMark:ee?$[et]:null}function eo($,ee,et,eo){var es=ei(ee,eo,et);if(es!=null){if(!(isFinite(es)&&Math.floor(es)===es)||es<0){var eu=eo?et:"highWaterMark";throw new en(eu,es)}return Math.floor(es)}return $.objectMode?16:16*1024}$.exports={getHighWaterMark:eo}},2503:($,ee,et)=>{$.exports=et(7187).EventEmitter},4626:($,ee,et)=>{"use strict";var en=et(9509).Buffer;var ei=en.isEncoding||function($){$=""+$;switch($&&$.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 true;default:return false}};function eo($){if(!$)return"utf8";var ee;while(true){switch($){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 $;default:if(ee)return;$=(""+$).toLowerCase();ee=true}}};function es($){var ee=eo($);if(typeof ee!=="string"&&(en.isEncoding===ei||!ei($)))throw new Error("Unknown encoding: "+$);return ee||$}ee.s=eu;function eu($){this.encoding=es($);var ee;switch(this.encoding){case"utf16le":this.text=eg;this.end=em;ee=4;break;case"utf8":this.fillLast=ep;ee=4;break;case"base64":this.text=e_;this.end=ew;ee=3;break;default:this.write=eE;this.end=eS;return}this.lastNeed=0;this.lastTotal=0;this.lastChar=en.allocUnsafe(ee)}eu.prototype.write=function($){if($.length===0)return"";var ee;var et;if(this.lastNeed){ee=this.fillLast($);if(ee===undefined)return"";et=this.lastNeed;this.lastNeed=0}else{et=0}if(et<$.length)return ee?ee+this.text($,et):this.text($,et);return ee||""};eu.prototype.end=ey;eu.prototype.text=eh;eu.prototype.fillLast=function($){if(this.lastNeed<=$.length){$.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}$.copy(this.lastChar,this.lastTotal-this.lastNeed,0,$.length);this.lastNeed-=$.length};function el($){if($<=127)return 0;else if($>>5===6)return 2;else if($>>4===14)return 3;else if($>>3===30)return 4;return $>>6===2?-1:-2}function ef($,ee,et){var en=ee.length-1;if(en<et)return 0;var ei=el(ee[en]);if(ei>=0){if(ei>0)$.lastNeed=ei-1;return ei}if(--en<et||ei===-2)return 0;ei=el(ee[en]);if(ei>=0){if(ei>0)$.lastNeed=ei-2;return ei}if(--en<et||ei===-2)return 0;ei=el(ee[en]);if(ei>=0){if(ei>0){if(ei===2)ei=0;else $.lastNeed=ei-3}return ei}return 0}function ed($,ee,et){if((ee[0]&192)!==128){$.lastNeed=0;return"�"}if($.lastNeed>1&&ee.length>1){if((ee[1]&192)!==128){$.lastNeed=1;return"�"}if($.lastNeed>2&&ee.length>2){if((ee[2]&192)!==128){$.lastNeed=2;return"�"}}}}function ep($){var ee=this.lastTotal-this.lastNeed;var et=ed(this,$,ee);if(et!==undefined)return et;if(this.lastNeed<=$.length){$.copy(this.lastChar,ee,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}$.copy(this.lastChar,ee,0,$.length);this.lastNeed-=$.length}function eh($,ee){var et=ef(this,$,ee);if(!this.lastNeed)return $.toString("utf8",ee);this.lastTotal=et;var en=$.length-(et-this.lastNeed);$.copy(this.lastChar,0,en);return $.toString("utf8",ee,en)}function ey($){var ee=$&&$.length?this.write($):"";if(this.lastNeed)return ee+"�";return ee}function eg($,ee){if(($.length-ee)%2===0){var et=$.toString("utf16le",ee);if(et){var en=et.charCodeAt(et.length-1);if(en>=55296&&en<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=$[$.length-2];this.lastChar[1]=$[$.length-1];return et.slice(0,-1)}}return et}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=$[$.length-1];return $.toString("utf16le",ee,$.length-1)}function em($){var ee=$&&$.length?this.write($):"";if(this.lastNeed){var et=this.lastTotal-this.lastNeed;return ee+this.lastChar.toString("utf16le",0,et)}return ee}function e_($,ee){var et=($.length-ee)%3;if(et===0)return $.toString("base64",ee);this.lastNeed=3-et;this.lastTotal=3;if(et===1){this.lastChar[0]=$[$.length-1]}else{this.lastChar[0]=$[$.length-2];this.lastChar[1]=$[$.length-1]}return $.toString("base64",ee,$.length-et)}function ew($){var ee=$&&$.length?this.write($):"";if(this.lastNeed)return ee+this.lastChar.toString("base64",0,3-this.lastNeed);return ee}function eE($){return $.toString(this.encoding)}function eS($){return $&&$.length?this.write($):""}},3697:($,ee,et)=>{"use strict";var en=et(5972).functionsHaveConfigurableNames();var ei=Object;var eo=TypeError;$.exports=function $(){if(this!=null&&this!==ei(this)){throw new eo("RegExp.prototype.flags getter called on non-object")}var $="";if(this.hasIndices){$+="d"}if(this.global){$+="g"}if(this.ignoreCase){$+="i"}if(this.multiline){$+="m"}if(this.dotAll){$+="s"}if(this.unicode){$+="u"}if(this.unicodeSets){$+="v"}if(this.sticky){$+="y"}return $};if(en&&Object.defineProperty){Object.defineProperty($.exports,"name",{value:"get flags"})}},2847:($,ee,et)=>{"use strict";var en=et(4289);var ei=et(5559);var eo=et(3697);var es=et(1721);var eu=et(2753);var el=ei(es());en(el,{getPolyfill:es,implementation:eo,shim:eu});$.exports=el},1721:($,ee,et)=>{"use strict";var en=et(3697);var ei=et(4289).supportsDescriptors;var eo=Object.getOwnPropertyDescriptor;$.exports=function $(){if(ei&&/a/mig.flags==="gim"){var $=eo(RegExp.prototype,"flags");if($&&typeof $.get==="function"&&typeof RegExp.prototype.dotAll==="boolean"&&typeof RegExp.prototype.hasIndices==="boolean"){var ee="";var et={};Object.defineProperty(et,"hasIndices",{get:function(){ee+="d"}});Object.defineProperty(et,"sticky",{get:function(){ee+="y"}});if(ee==="dy"){return $.get}}}return en}},2753:($,ee,et)=>{"use strict";var en=et(4289).supportsDescriptors;var ei=et(1721);var eo=Object.getOwnPropertyDescriptor;var es=Object.defineProperty;var eu=TypeError;var el=Object.getPrototypeOf;var ef=/a/;$.exports=function $(){if(!en||!el){throw new eu("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors")}var $=ei();var ee=el(ef);var et=eo(ee,"flags");if(!et||et.get!==$){es(ee,"flags",{configurable:true,enumerable:false,get:$})}return $}},9509:($,ee,et)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var en=et(8764);var ei=en.Buffer;function eo($,ee){for(var et in $){ee[et]=$[et]}}if(ei.from&&ei.alloc&&ei.allocUnsafe&&ei.allocUnsafeSlow){$.exports=en}else{eo(en,ee);ee.Buffer=es}function es($,ee,et){return ei($,ee,et)}es.prototype=Object.create(ei.prototype);eo(ei,es);es.from=function($,ee,et){if(typeof $==="number"){throw new TypeError("Argument must not be a number")}return ei($,ee,et)};es.alloc=function($,ee,et){if(typeof $!=="number"){throw new TypeError("Argument must be a number")}var en=ei($);if(ee!==undefined){if(typeof et==="string"){en.fill(ee,et)}else{en.fill(ee)}}else{en.fill(0)}return en};es.allocUnsafe=function($){if(typeof $!=="number"){throw new TypeError("Argument must be a number")}return ei($)};es.allocUnsafeSlow=function($){if(typeof $!=="number"){throw new TypeError("Argument must be a number")}return en.SlowBuffer($)}},6099:($,ee,et)=>{var en=et(8764)["Buffer"];(function($){$.parser=function($,ee){return new ei($,ee)};$.SAXParser=ei;$.SAXStream=ep;$.createStream=ed;$.MAX_BUFFER_LENGTH=64*1024;var ee=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];$.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function ei(ee,et){if(!(this instanceof ei)){return new ei(ee,et)}var en=this;es(en);en.q=en.c="";en.bufferCheckPosition=$.MAX_BUFFER_LENGTH;en.opt=et||{};en.opt.lowercase=en.opt.lowercase||en.opt.lowercasetags;en.looseCase=en.opt.lowercase?"toLowerCase":"toUpperCase";en.tags=[];en.closed=en.closedRoot=en.sawRoot=false;en.tag=en.error=null;en.strict=!!ee;en.noscript=!!(ee||en.opt.noscript);en.state=eR.BEGIN;en.strictEntities=en.opt.strictEntities;en.ENTITIES=en.strictEntities?Object.create($.XML_ENTITIES):Object.create($.ENTITIES);en.attribList=[];if(en.opt.xmlns){en.ns=Object.create(e_)}en.trackPosition=en.opt.position!==false;if(en.trackPosition){en.position=en.line=en.column=0}ek(en,"onready")}if(!Object.create){Object.create=function($){function ee(){}ee.prototype=$;var et=new ee;return et}}if(!Object.keys){Object.keys=function($){var ee=[];for(var et in $)if($.hasOwnProperty(et))ee.push(et);return ee}}function eo(et){var en=Math.max($.MAX_BUFFER_LENGTH,10);var ei=0;for(var eo=0,es=ee.length;eo<es;eo++){var eu=et[ee[eo]].length;if(eu>en){switch(ee[eo]){case"textNode":eL(et);break;case"cdata":eM(et,"oncdata",et.cdata);et.cdata="";break;case"script":eM(et,"onscript",et.script);et.script="";break;default:eF(et,"Max buffer length exceeded: "+ee[eo])}}ei=Math.max(ei,eu)}var el=$.MAX_BUFFER_LENGTH-ei;et.bufferCheckPosition=el+et.position}function es($){for(var et=0,en=ee.length;et<en;et++){$[ee[et]]=""}}function eu($){eL($);if($.cdata!==""){eM($,"oncdata",$.cdata);$.cdata=""}if($.script!==""){eM($,"onscript",$.script);$.script=""}}ei.prototype={end:function(){eB(this)},write:eY,resume:function(){this.error=null;return this},close:function(){return this.write(null)},flush:function(){eu(this)}};var el;try{el=et(2830).Stream}catch($){el=function(){}}var ef=$.EVENTS.filter(function($){return $!=="error"&&$!=="end"});function ed($,ee){return new ep($,ee)}function ep($,ee){if(!(this instanceof ep)){return new ep($,ee)}el.apply(this);this._parser=new ei($,ee);this.writable=true;this.readable=true;var et=this;this._parser.onend=function(){et.emit("end")};this._parser.onerror=function($){et.emit("error",$);et._parser.error=null};this._decoder=null;ef.forEach(function($){Object.defineProperty(et,"on"+$,{get:function(){return et._parser["on"+$]},set:function(ee){if(!ee){et.removeAllListeners($);et._parser["on"+$]=ee;return ee}et.on($,ee)},enumerable:true,configurable:false})})}ep.prototype=Object.create(el.prototype,{constructor:{value:ep}});ep.prototype.write=function($){if(typeof en==="function"&&typeof en.isBuffer==="function"&&en.isBuffer($)){if(!this._decoder){var ee=et(2553).StringDecoder;this._decoder=new ee("utf8")}$=this._decoder.write($)}this._parser.write($.toString());this.emit("data",$);return true};ep.prototype.end=function($){if($&&$.length){this.write($)}this._parser.end();return true};ep.prototype.on=function($,ee){var et=this;if(!et._parser["on"+$]&&ef.indexOf($)!==-1){et._parser["on"+$]=function(){var ee=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);ee.splice(0,0,$);et.emit.apply(et,ee)}}return el.prototype.on.call(et,$,ee)};var eh="[CDATA[";var ey="DOCTYPE";var eg="http://www.w3.org/XML/1998/namespace";var em="http://www.w3.org/2000/xmlns/";var e_={xml:eg,xmlns:em};var ew=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;var eE=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;var eS=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;var eT=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function eO($){return $===" "||$==="\n"||$==="\r"||$===" "}function eA($){return $==='"'||$==="'"}function eI($){return $===">"||eO($)}function eN($,ee){return $.test(ee)}function eD($,ee){return!eN($,ee)}var eR=0;$.STATE={BEGIN:eR++,BEGIN_WHITESPACE:eR++,TEXT:eR++,TEXT_ENTITY:eR++,OPEN_WAKA:eR++,SGML_DECL:eR++,SGML_DECL_QUOTED:eR++,DOCTYPE:eR++,DOCTYPE_QUOTED:eR++,DOCTYPE_DTD:eR++,DOCTYPE_DTD_QUOTED:eR++,COMMENT_STARTING:eR++,COMMENT:eR++,COMMENT_ENDING:eR++,COMMENT_ENDED:eR++,CDATA:eR++,CDATA_ENDING:eR++,CDATA_ENDING_2:eR++,PROC_INST:eR++,PROC_INST_BODY:eR++,PROC_INST_ENDING:eR++,OPEN_TAG:eR++,OPEN_TAG_SLASH:eR++,ATTRIB:eR++,ATTRIB_NAME:eR++,ATTRIB_NAME_SAW_WHITE:eR++,ATTRIB_VALUE:eR++,ATTRIB_VALUE_QUOTED:eR++,ATTRIB_VALUE_CLOSED:eR++,ATTRIB_VALUE_UNQUOTED:eR++,ATTRIB_VALUE_ENTITY_Q:eR++,ATTRIB_VALUE_ENTITY_U:eR++,CLOSE_TAG:eR++,CLOSE_TAG_SAW_WHITE:eR++,SCRIPT:eR++,SCRIPT_ENDING:eR++};$.XML_ENTITIES={"amp":"&","gt":">","lt":"<","quot":'"',"apos":"'"};$.ENTITIES={"amp":"&","gt":">","lt":"<","quot":'"',"apos":"'","AElig":198,"Aacute":193,"Acirc":194,"Agrave":192,"Aring":197,"Atilde":195,"Auml":196,"Ccedil":199,"ETH":208,"Eacute":201,"Ecirc":202,"Egrave":200,"Euml":203,"Iacute":205,"Icirc":206,"Igrave":204,"Iuml":207,"Ntilde":209,"Oacute":211,"Ocirc":212,"Ograve":210,"Oslash":216,"Otilde":213,"Ouml":214,"THORN":222,"Uacute":218,"Ucirc":219,"Ugrave":217,"Uuml":220,"Yacute":221,"aacute":225,"acirc":226,"aelig":230,"agrave":224,"aring":229,"atilde":227,"auml":228,"ccedil":231,"eacute":233,"ecirc":234,"egrave":232,"eth":240,"euml":235,"iacute":237,"icirc":238,"igrave":236,"iuml":239,"ntilde":241,"oacute":243,"ocirc":244,"ograve":242,"oslash":248,"otilde":245,"ouml":246,"szlig":223,"thorn":254,"uacute":250,"ucirc":251,"ugrave":249,"uuml":252,"yacute":253,"yuml":255,"copy":169,"reg":174,"nbsp":160,"iexcl":161,"cent":162,"pound":163,"curren":164,"yen":165,"brvbar":166,"sect":167,"uml":168,"ordf":170,"laquo":171,"not":172,"shy":173,"macr":175,"deg":176,"plusmn":177,"sup1":185,"sup2":178,"sup3":179,"acute":180,"micro":181,"para":182,"middot":183,"cedil":184,"ordm":186,"raquo":187,"frac14":188,"frac12":189,"frac34":190,"iquest":191,"times":215,"divide":247,"OElig":338,"oelig":339,"Scaron":352,"scaron":353,"Yuml":376,"fnof":402,"circ":710,"tilde":732,"Alpha":913,"Beta":914,"Gamma":915,"Delta":916,"Epsilon":917,"Zeta":918,"Eta":919,"Theta":920,"Iota":921,"Kappa":922,"Lambda":923,"Mu":924,"Nu":925,"Xi":926,"Omicron":927,"Pi":928,"Rho":929,"Sigma":931,"Tau":932,"Upsilon":933,"Phi":934,"Chi":935,"Psi":936,"Omega":937,"alpha":945,"beta":946,"gamma":947,"delta":948,"epsilon":949,"zeta":950,"eta":951,"theta":952,"iota":953,"kappa":954,"lambda":955,"mu":956,"nu":957,"xi":958,"omicron":959,"pi":960,"rho":961,"sigmaf":962,"sigma":963,"tau":964,"upsilon":965,"phi":966,"chi":967,"psi":968,"omega":969,"thetasym":977,"upsih":978,"piv":982,"ensp":8194,"emsp":8195,"thinsp":8201,"zwnj":8204,"zwj":8205,"lrm":8206,"rlm":8207,"ndash":8211,"mdash":8212,"lsquo":8216,"rsquo":8217,"sbquo":8218,"ldquo":8220,"rdquo":8221,"bdquo":8222,"dagger":8224,"Dagger":8225,"bull":8226,"hellip":8230,"permil":8240,"prime":8242,"Prime":8243,"lsaquo":8249,"rsaquo":8250,"oline":8254,"frasl":8260,"euro":8364,"image":8465,"weierp":8472,"real":8476,"trade":8482,"alefsym":8501,"larr":8592,"uarr":8593,"rarr":8594,"darr":8595,"harr":8596,"crarr":8629,"lArr":8656,"uArr":8657,"rArr":8658,"dArr":8659,"hArr":8660,"forall":8704,"part":8706,"exist":8707,"empty":8709,"nabla":8711,"isin":8712,"notin":8713,"ni":8715,"prod":8719,"sum":8721,"minus":8722,"lowast":8727,"radic":8730,"prop":8733,"infin":8734,"ang":8736,"and":8743,"or":8744,"cap":8745,"cup":8746,"int":8747,"there4":8756,"sim":8764,"cong":8773,"asymp":8776,"ne":8800,"equiv":8801,"le":8804,"ge":8805,"sub":8834,"sup":8835,"nsub":8836,"sube":8838,"supe":8839,"oplus":8853,"otimes":8855,"perp":8869,"sdot":8901,"lceil":8968,"rceil":8969,"lfloor":8970,"rfloor":8971,"lang":9001,"rang":9002,"loz":9674,"spades":9824,"clubs":9827,"hearts":9829,"diams":9830};Object.keys($.ENTITIES).forEach(function(ee){var et=$.ENTITIES[ee];var en=typeof et==="number"?String.fromCharCode(et):et;$.ENTITIES[ee]=en});for(var eC in $.STATE){$.STATE[$.STATE[eC]]=eC}eR=$.STATE;function ek($,ee,et){$[ee]&&$[ee](et)}function eM($,ee,et){if($.textNode)eL($);ek($,ee,et)}function eL($){$.textNode=eP($.opt,$.textNode);if($.textNode)ek($,"ontext",$.textNode);$.textNode=""}function eP($,ee){if($.trim)ee=ee.trim();if($.normalize)ee=ee.replace(/\s+/g," ");return ee}function eF($,ee){eL($);if($.trackPosition){ee+="\nLine: "+$.line+"\nColumn: "+$.column+"\nChar: "+$.c}ee=new Error(ee);$.error=ee;ek($,"onerror",ee);return $}function eB($){if($.sawRoot&&!$.closedRoot)eU($,"Unclosed root tag");if($.state!==eR.BEGIN&&$.state!==eR.BEGIN_WHITESPACE&&$.state!==eR.TEXT){eF($,"Unexpected end")}eL($);$.c="";$.closed=true;ek($,"onend");ei.call($,$.strict,$.opt);return $}function eU($,ee){if(typeof $!=="object"||!($ instanceof ei)){throw new Error("bad call to strictFail")}if($.strict){eF($,ee)}}function ej($){if(!$.strict)$.tagName=$.tagName[$.looseCase]();var ee=$.tags[$.tags.length-1]||$;var et=$.tag={name:$.tagName,attributes:{}};if($.opt.xmlns){et.ns=ee.ns}$.attribList.length=0;eM($,"onopentagstart",et)}function eW($,ee){var et=$.indexOf(":");var en=et<0?["",$]:$.split(":");var ei=en[0];var eo=en[1];if(ee&&$==="xmlns"){ei="xmlns";eo=""}return{prefix:ei,local:eo}}function eH($){if(!$.strict){$.attribName=$.attribName[$.looseCase]()}if($.attribList.indexOf($.attribName)!==-1||$.tag.attributes.hasOwnProperty($.attribName)){$.attribName=$.attribValue="";return}if($.opt.xmlns){var ee=eW($.attribName,true);var et=ee.prefix;var en=ee.local;if(et==="xmlns"){if(en==="xml"&&$.attribValue!==eg){eU($,"xml: prefix must be bound to "+eg+"\n"+"Actual: "+$.attribValue)}else if(en==="xmlns"&&$.attribValue!==em){eU($,"xmlns: prefix must be bound to "+em+"\n"+"Actual: "+$.attribValue)}else{var ei=$.tag;var eo=$.tags[$.tags.length-1]||$;if(ei.ns===eo.ns){ei.ns=Object.create(eo.ns)}ei.ns[en]=$.attribValue}}$.attribList.push([$.attribName,$.attribValue])}else{$.tag.attributes[$.attribName]=$.attribValue;eM($,"onattribute",{name:$.attribName,value:$.attribValue})}$.attribName=$.attribValue=""}function ez($,ee){if($.opt.xmlns){var et=$.tag;var en=eW($.tagName);et.prefix=en.prefix;et.local=en.local;et.uri=et.ns[en.prefix]||"";if(et.prefix&&!et.uri){eU($,"Unbound namespace prefix: "+JSON.stringify($.tagName));et.uri=en.prefix}var ei=$.tags[$.tags.length-1]||$;if(et.ns&&ei.ns!==et.ns){Object.keys(et.ns).forEach(function(ee){eM($,"onopennamespace",{prefix:ee,uri:et.ns[ee]})})}for(var eo=0,es=$.attribList.length;eo<es;eo++){var eu=$.attribList[eo];var el=eu[0];var ef=eu[1];var ed=eW(el,true);var ep=ed.prefix;var eh=ed.local;var ey=ep===""?"":et.ns[ep]||"";var eg={name:el,value:ef,prefix:ep,local:eh,uri:ey};if(ep&&ep!=="xmlns"&&!ey){eU($,"Unbound namespace prefix: "+JSON.stringify(ep));eg.uri=ep}$.tag.attributes[el]=eg;eM($,"onattribute",eg)}$.attribList.length=0}$.tag.isSelfClosing=!!ee;$.sawRoot=true;$.tags.push($.tag);eM($,"onopentag",$.tag);if(!ee){if(!$.noscript&&$.tagName.toLowerCase()==="script"){$.state=eR.SCRIPT}else{$.state=eR.TEXT}$.tag=null;$.tagName=""}$.attribName=$.attribValue="";$.attribList.length=0}function eV($){if(!$.tagName){eU($,"Weird empty close tag.");$.textNode+="</>";$.state=eR.TEXT;return}if($.script){if($.tagName!=="script"){$.script+="</"+$.tagName+">";$.tagName="";$.state=eR.SCRIPT;return}eM($,"onscript",$.script);$.script=""}var ee=$.tags.length;var et=$.tagName;if(!$.strict){et=et[$.looseCase]()}var en=et;while(ee--){var ei=$.tags[ee];if(ei.name!==en){eU($,"Unexpected close tag")}else{break}}if(ee<0){eU($,"Unmatched closing tag: "+$.tagName);$.textNode+="</"+$.tagName+">";$.state=eR.TEXT;return}$.tagName=et;var eo=$.tags.length;while(eo-- >ee){var es=$.tag=$.tags.pop();$.tagName=$.tag.name;eM($,"onclosetag",$.tagName);var eu={};for(var el in es.ns){eu[el]=es.ns[el]}var ef=$.tags[$.tags.length-1]||$;if($.opt.xmlns&&es.ns!==ef.ns){Object.keys(es.ns).forEach(function(ee){var et=es.ns[ee];eM($,"onclosenamespace",{prefix:ee,uri:et})})}}if(ee===0)$.closedRoot=true;$.tagName=$.attribValue=$.attribName="";$.attribList.length=0;$.state=eR.TEXT}function e$($){var ee=$.entity;var et=ee.toLowerCase();var en;var ei="";if($.ENTITIES[ee]){return $.ENTITIES[ee]}if($.ENTITIES[et]){return $.ENTITIES[et]}ee=et;if(ee.charAt(0)==="#"){if(ee.charAt(1)==="x"){ee=ee.slice(2);en=parseInt(ee,16);ei=en.toString(16)}else{ee=ee.slice(1);en=parseInt(ee,10);ei=en.toString(10)}}ee=ee.replace(/^0+/,"");if(isNaN(en)||ei.toLowerCase()!==ee){eU($,"Invalid character entity");return"&"+$.entity+";"}return String.fromCodePoint(en)}function eq($,ee){if(ee==="<"){$.state=eR.OPEN_WAKA;$.startTagPosition=$.position}else if(!eO(ee)){eU($,"Non-whitespace before first tag.");$.textNode=ee;$.state=eR.TEXT}}function eG($,ee){var et="";if(ee<$.length){et=$.charAt(ee)}return et}function eY($){var ee=this;if(this.error){throw this.error}if(ee.closed){return eF(ee,"Cannot write after close. Assign an onready handler.")}if($===null){return eB(ee)}if(typeof $==="object"){$=$.toString()}var et=0;var en="";while(true){en=eG($,et++);ee.c=en;if(!en){break}if(ee.trackPosition){ee.position++;if(en==="\n"){ee.line++;ee.column=0}else{ee.column++}}switch(ee.state){case eR.BEGIN:ee.state=eR.BEGIN_WHITESPACE;if(en==="\uFEFF"){continue}eq(ee,en);continue;case eR.BEGIN_WHITESPACE:eq(ee,en);continue;case eR.TEXT:if(ee.sawRoot&&!ee.closedRoot){var ei=et-1;while(en&&en!=="<"&&en!=="&"){en=eG($,et++);if(en&&ee.trackPosition){ee.position++;if(en==="\n"){ee.line++;ee.column=0}else{ee.column++}}}ee.textNode+=$.substring(ei,et-1)}if(en==="<"&&!(ee.sawRoot&&ee.closedRoot&&!ee.strict)){ee.state=eR.OPEN_WAKA;ee.startTagPosition=ee.position}else{if(!eO(en)&&(!ee.sawRoot||ee.closedRoot)){eU(ee,"Text data outside of root node.")}if(en==="&"){ee.state=eR.TEXT_ENTITY}else{ee.textNode+=en}}continue;case eR.SCRIPT:if(en==="<"){ee.state=eR.SCRIPT_ENDING}else{ee.script+=en}continue;case eR.SCRIPT_ENDING:if(en==="/"){ee.state=eR.CLOSE_TAG}else{ee.script+="<"+en;ee.state=eR.SCRIPT}continue;case eR.OPEN_WAKA:if(en==="!"){ee.state=eR.SGML_DECL;ee.sgmlDecl=""}else if(eO(en)){}else if(eN(ew,en)){ee.state=eR.OPEN_TAG;ee.tagName=en}else if(en==="/"){ee.state=eR.CLOSE_TAG;ee.tagName=""}else if(en==="?"){ee.state=eR.PROC_INST;ee.procInstName=ee.procInstBody=""}else{eU(ee,"Unencoded <");if(ee.startTagPosition+1<ee.position){var es=ee.position-ee.startTagPosition;en=new Array(es).join(" ")+en}ee.textNode+="<"+en;ee.state=eR.TEXT}continue;case eR.SGML_DECL:if((ee.sgmlDecl+en).toUpperCase()===eh){eM(ee,"onopencdata");ee.state=eR.CDATA;ee.sgmlDecl="";ee.cdata=""}else if(ee.sgmlDecl+en==="--"){ee.state=eR.COMMENT;ee.comment="";ee.sgmlDecl=""}else if((ee.sgmlDecl+en).toUpperCase()===ey){ee.state=eR.DOCTYPE;if(ee.doctype||ee.sawRoot){eU(ee,"Inappropriately located doctype declaration")}ee.doctype="";ee.sgmlDecl=""}else if(en===">"){eM(ee,"onsgmldeclaration",ee.sgmlDecl);ee.sgmlDecl="";ee.state=eR.TEXT}else if(eA(en)){ee.state=eR.SGML_DECL_QUOTED;ee.sgmlDecl+=en}else{ee.sgmlDecl+=en}continue;case eR.SGML_DECL_QUOTED:if(en===ee.q){ee.state=eR.SGML_DECL;ee.q=""}ee.sgmlDecl+=en;continue;case eR.DOCTYPE:if(en===">"){ee.state=eR.TEXT;eM(ee,"ondoctype",ee.doctype);ee.doctype=true}else{ee.doctype+=en;if(en==="["){ee.state=eR.DOCTYPE_DTD}else if(eA(en)){ee.state=eR.DOCTYPE_QUOTED;ee.q=en}}continue;case eR.DOCTYPE_QUOTED:ee.doctype+=en;if(en===ee.q){ee.q="";ee.state=eR.DOCTYPE}continue;case eR.DOCTYPE_DTD:ee.doctype+=en;if(en==="]"){ee.state=eR.DOCTYPE}else if(eA(en)){ee.state=eR.DOCTYPE_DTD_QUOTED;ee.q=en}continue;case eR.DOCTYPE_DTD_QUOTED:ee.doctype+=en;if(en===ee.q){ee.state=eR.DOCTYPE_DTD;ee.q=""}continue;case eR.COMMENT:if(en==="-"){ee.state=eR.COMMENT_ENDING}else{ee.comment+=en}continue;case eR.COMMENT_ENDING:if(en==="-"){ee.state=eR.COMMENT_ENDED;ee.comment=eP(ee.opt,ee.comment);if(ee.comment){eM(ee,"oncomment",ee.comment)}ee.comment=""}else{ee.comment+="-"+en;ee.state=eR.COMMENT}continue;case eR.COMMENT_ENDED:if(en!==">"){eU(ee,"Malformed comment");ee.comment+="--"+en;ee.state=eR.COMMENT}else{ee.state=eR.TEXT}continue;case eR.CDATA:if(en==="]"){ee.state=eR.CDATA_ENDING}else{ee.cdata+=en}continue;case eR.CDATA_ENDING:if(en==="]"){ee.state=eR.CDATA_ENDING_2}else{ee.cdata+="]"+en;ee.state=eR.CDATA}continue;case eR.CDATA_ENDING_2:if(en===">"){if(ee.cdata){eM(ee,"oncdata",ee.cdata)}eM(ee,"onclosecdata");ee.cdata="";ee.state=eR.TEXT}else if(en==="]"){ee.cdata+="]"}else{ee.cdata+="]]"+en;ee.state=eR.CDATA}continue;case eR.PROC_INST:if(en==="?"){ee.state=eR.PROC_INST_ENDING}else if(eO(en)){ee.state=eR.PROC_INST_BODY}else{ee.procInstName+=en}continue;case eR.PROC_INST_BODY:if(!ee.procInstBody&&eO(en)){continue}else if(en==="?"){ee.state=eR.PROC_INST_ENDING}else{ee.procInstBody+=en}continue;case eR.PROC_INST_ENDING:if(en===">"){eM(ee,"onprocessinginstruction",{name:ee.procInstName,body:ee.procInstBody});ee.procInstName=ee.procInstBody="";ee.state=eR.TEXT}else{ee.procInstBody+="?"+en;ee.state=eR.PROC_INST_BODY}continue;case eR.OPEN_TAG:if(eN(eE,en)){ee.tagName+=en}else{ej(ee);if(en===">"){ez(ee)}else if(en==="/"){ee.state=eR.OPEN_TAG_SLASH}else{if(!eO(en)){eU(ee,"Invalid character in tag name")}ee.state=eR.ATTRIB}}continue;case eR.OPEN_TAG_SLASH:if(en===">"){ez(ee,true);eV(ee)}else{eU(ee,"Forward-slash in opening tag not followed by >");ee.state=eR.ATTRIB}continue;case eR.ATTRIB:if(eO(en)){continue}else if(en===">"){ez(ee)}else if(en==="/"){ee.state=eR.OPEN_TAG_SLASH}else if(eN(ew,en)){ee.attribName=en;ee.attribValue="";ee.state=eR.ATTRIB_NAME}else{eU(ee,"Invalid attribute name")}continue;case eR.ATTRIB_NAME:if(en==="="){ee.state=eR.ATTRIB_VALUE}else if(en===">"){eU(ee,"Attribute without value");ee.attribValue=ee.attribName;eH(ee);ez(ee)}else if(eO(en)){ee.state=eR.ATTRIB_NAME_SAW_WHITE}else if(eN(eE,en)){ee.attribName+=en}else{eU(ee,"Invalid attribute name")}continue;case eR.ATTRIB_NAME_SAW_WHITE:if(en==="="){ee.state=eR.ATTRIB_VALUE}else if(eO(en)){continue}else{eU(ee,"Attribute without value");ee.tag.attributes[ee.attribName]="";ee.attribValue="";eM(ee,"onattribute",{name:ee.attribName,value:""});ee.attribName="";if(en===">"){ez(ee)}else if(eN(ew,en)){ee.attribName=en;ee.state=eR.ATTRIB_NAME}else{eU(ee,"Invalid attribute name");ee.state=eR.ATTRIB}}continue;case eR.ATTRIB_VALUE:if(eO(en)){continue}else if(eA(en)){ee.q=en;ee.state=eR.ATTRIB_VALUE_QUOTED}else{eU(ee,"Unquoted attribute value");ee.state=eR.ATTRIB_VALUE_UNQUOTED;ee.attribValue=en}continue;case eR.ATTRIB_VALUE_QUOTED:if(en!==ee.q){if(en==="&"){ee.state=eR.ATTRIB_VALUE_ENTITY_Q}else{ee.attribValue+=en}continue}eH(ee);ee.q="";ee.state=eR.ATTRIB_VALUE_CLOSED;continue;case eR.ATTRIB_VALUE_CLOSED:if(eO(en)){ee.state=eR.ATTRIB}else if(en===">"){ez(ee)}else if(en==="/"){ee.state=eR.OPEN_TAG_SLASH}else if(eN(ew,en)){eU(ee,"No whitespace between attributes");ee.attribName=en;ee.attribValue="";ee.state=eR.ATTRIB_NAME}else{eU(ee,"Invalid attribute name")}continue;case eR.ATTRIB_VALUE_UNQUOTED:if(!eI(en)){if(en==="&"){ee.state=eR.ATTRIB_VALUE_ENTITY_U}else{ee.attribValue+=en}continue}eH(ee);if(en===">"){ez(ee)}else{ee.state=eR.ATTRIB}continue;case eR.CLOSE_TAG:if(!ee.tagName){if(eO(en)){continue}else if(eD(ew,en)){if(ee.script){ee.script+="</"+en;ee.state=eR.SCRIPT}else{eU(ee,"Invalid tagname in closing tag.")}}else{ee.tagName=en}}else if(en===">"){eV(ee)}else if(eN(eE,en)){ee.tagName+=en}else if(ee.script){ee.script+="</"+ee.tagName;ee.tagName="";ee.state=eR.SCRIPT}else{if(!eO(en)){eU(ee,"Invalid tagname in closing tag")}ee.state=eR.CLOSE_TAG_SAW_WHITE}continue;case eR.CLOSE_TAG_SAW_WHITE:if(eO(en)){continue}if(en===">"){eV(ee)}else{eU(ee,"Invalid characters in closing tag")}continue;case eR.TEXT_ENTITY:case eR.ATTRIB_VALUE_ENTITY_Q:case eR.ATTRIB_VALUE_ENTITY_U:var eu;var el;switch(ee.state){case eR.TEXT_ENTITY:eu=eR.TEXT;el="textNode";break;case eR.ATTRIB_VALUE_ENTITY_Q:eu=eR.ATTRIB_VALUE_QUOTED;el="attribValue";break;case eR.ATTRIB_VALUE_ENTITY_U:eu=eR.ATTRIB_VALUE_UNQUOTED;el="attribValue";break}if(en===";"){ee[el]+=e$(ee);ee.entity="";ee.state=eu}else if(eN(ee.entity.length?eT:eS,en)){ee.entity+=en}else{eU(ee,"Invalid character in entity name");ee[el]+="&"+ee.entity+en;ee.entity="";ee.state=eu}continue;default:throw new Error(ee,"Unknown state: "+ee.state)}}if(ee.position>=ee.bufferCheckPosition){eo(ee)}return ee}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */if(!String.fromCodePoint){(function(){var $=String.fromCharCode;var ee=Math.floor;var et=function(){var et=16384;var en=[];var ei;var eo;var es=-1;var eu=arguments.length;if(!eu){return""}var el="";while(++es<eu){var ef=Number(arguments[es]);if(!isFinite(ef)||ef<0||ef>1114111||ee(ef)!==ef){throw RangeError("Invalid code point: "+ef)}if(ef<=65535){en.push(ef)}else{ef-=65536;ei=(ef>>10)+55296;eo=ef%1024+56320;en.push(ei,eo)}if(es+1===eu||en.length>et){el+=$.apply(null,en);en.length=0}}return el};if(Object.defineProperty){Object.defineProperty(String,"fromCodePoint",{value:et,configurable:true,writable:true})}else{String.fromCodePoint=et}})()}})(false?0:ee)},7478:($,ee,et)=>{"use strict";var en=et(210);var ei=et(1924);var eo=et(631);var es=en("%TypeError%");var eu=en("%WeakMap%",true);var el=en("%Map%",true);var ef=ei("WeakMap.prototype.get",true);var ed=ei("WeakMap.prototype.set",true);var ep=ei("WeakMap.prototype.has",true);var eh=ei("Map.prototype.get",true);var ey=ei("Map.prototype.set",true);var eg=ei("Map.prototype.has",true);var em=function($,ee){for(var et=$,en;(en=et.next)!==null;et=en){if(en.key===ee){et.next=en.next;en.next=$.next;$.next=en;return en}}};var e_=function($,ee){var et=em($,ee);return et&&et.value};var ew=function($,ee,et){var en=em($,ee);if(en){en.value=et}else{$.next={key:ee,next:$.next,value:et}}};var eE=function($,ee){return!!em($,ee)};$.exports=function $(){var $;var ee;var et;var en={assert:function($){if(!en.has($)){throw new es("Side channel does not contain "+eo($))}},get:function(en){if(eu&&en&&(typeof en==="object"||typeof en==="function")){if($){return ef($,en)}}else if(el){if(ee){return eh(ee,en)}}else{if(et){return e_(et,en)}}},has:function(en){if(eu&&en&&(typeof en==="object"||typeof en==="function")){if($){return ep($,en)}}else if(el){if(ee){return eg(ee,en)}}else{if(et){return eE(et,en)}}return false},set:function(en,ei){if(eu&&en&&(typeof en==="object"||typeof en==="function")){if(!$){$=new eu}ed($,en,ei)}else if(el){if(!ee){ee=new el}ey(ee,en,ei)}else{if(!et){et={key:{},next:null}}ew(et,en,ei)}}};return en}},3859:$=>{"use strict";$.exports=$=>{const ee=/^\\\\\?\\/.test($);const et=/[^\u0000-\u0080]+/.test($);if(ee||et){return $}return $.replace(/\\/g,"/")}},6373:($,ee,et)=>{"use strict";var en=et(9496);var ei=SyntaxError;var eo=typeof StopIteration==="object"?StopIteration:null;$.exports=function $($){if(!eo){throw new ei("this environment lacks StopIteration")}en.set($,"[[Done]]",false);var ee={next:function $(){var $=en.get(this,"[[Iterator]]");var ee=en.get($,"[[Done]]");try{return{done:ee,value:ee?void undefined:$.next()}}catch(ee){en.set($,"[[Done]]",true);if(ee!==eo){throw ee}return{done:true,value:void undefined}}}};en.set(ee,"[[Iterator]]",$);return ee}},2830:($,ee,et)=>{$.exports=eo;var en=et(7187).EventEmitter;var ei=et(5717);ei(eo,en);eo.Readable=et(9481);eo.Writable=et(4229);eo.Duplex=et(6753);eo.Transform=et(4605);eo.PassThrough=et(2725);eo.finished=et(8610);eo.pipeline=et(9946);eo.Stream=eo;function eo(){en.call(this)}eo.prototype.pipe=function($,ee){var et=this;function ei(ee){if($.writable){if(false===$.write(ee)&&et.pause){et.pause()}}}et.on("data",ei);function eo(){if(et.readable&&et.resume){et.resume()}}$.on("drain",eo);if(!$._isStdio&&(!ee||ee.end!==false)){et.on("end",eu);et.on("close",el)}var es=false;function eu(){if(es)return;es=true;$.end()}function el(){if(es)return;es=true;if(typeof $.destroy==="function")$.destroy()}function ef($){ed();if(en.listenerCount(this,"error")===0){throw $}}et.on("error",ef);$.on("error",ef);function ed(){et.removeListener("data",ei);$.removeListener("drain",eo);et.removeListener("end",eu);et.removeListener("close",el);et.removeListener("error",ef);$.removeListener("error",ef);et.removeListener("end",ed);et.removeListener("close",ed);$.removeListener("close",ed)}et.on("end",ed);et.on("close",ed);$.on("close",ed);$.emit("pipe",et);return $}},2553:($,ee,et)=>{"use strict";var en=et(396).Buffer;var ei=en.isEncoding||function($){$=""+$;switch($&&$.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 true;default:return false}};function eo($){if(!$)return"utf8";var ee;while(true){switch($){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 $;default:if(ee)return;$=(""+$).toLowerCase();ee=true}}};function es($){var ee=eo($);if(typeof ee!=="string"&&(en.isEncoding===ei||!ei($)))throw new Error("Unknown encoding: "+$);return ee||$}ee.StringDecoder=eu;function eu($){this.encoding=es($);var ee;switch(this.encoding){case"utf16le":this.text=eg;this.end=em;ee=4;break;case"utf8":this.fillLast=ep;ee=4;break;case"base64":this.text=e_;this.end=ew;ee=3;break;default:this.write=eE;this.end=eS;return}this.lastNeed=0;this.lastTotal=0;this.lastChar=en.allocUnsafe(ee)}eu.prototype.write=function($){if($.length===0)return"";var ee;var et;if(this.lastNeed){ee=this.fillLast($);if(ee===undefined)return"";et=this.lastNeed;this.lastNeed=0}else{et=0}if(et<$.length)return ee?ee+this.text($,et):this.text($,et);return ee||""};eu.prototype.end=ey;eu.prototype.text=eh;eu.prototype.fillLast=function($){if(this.lastNeed<=$.length){$.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}$.copy(this.lastChar,this.lastTotal-this.lastNeed,0,$.length);this.lastNeed-=$.length};function el($){if($<=127)return 0;else if($>>5===6)return 2;else if($>>4===14)return 3;else if($>>3===30)return 4;return $>>6===2?-1:-2}function ef($,ee,et){var en=ee.length-1;if(en<et)return 0;var ei=el(ee[en]);if(ei>=0){if(ei>0)$.lastNeed=ei-1;return ei}if(--en<et||ei===-2)return 0;ei=el(ee[en]);if(ei>=0){if(ei>0)$.lastNeed=ei-2;return ei}if(--en<et||ei===-2)return 0;ei=el(ee[en]);if(ei>=0){if(ei>0){if(ei===2)ei=0;else $.lastNeed=ei-3}return ei}return 0}function ed($,ee,et){if((ee[0]&192)!==128){$.lastNeed=0;return"�"}if($.lastNeed>1&&ee.length>1){if((ee[1]&192)!==128){$.lastNeed=1;return"�"}if($.lastNeed>2&&ee.length>2){if((ee[2]&192)!==128){$.lastNeed=2;return"�"}}}}function ep($){var ee=this.lastTotal-this.lastNeed;var et=ed(this,$,ee);if(et!==undefined)return et;if(this.lastNeed<=$.length){$.copy(this.lastChar,ee,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}$.copy(this.lastChar,ee,0,$.length);this.lastNeed-=$.length}function eh($,ee){var et=ef(this,$,ee);if(!this.lastNeed)return $.toString("utf8",ee);this.lastTotal=et;var en=$.length-(et-this.lastNeed);$.copy(this.lastChar,0,en);return $.toString("utf8",ee,en)}function ey($){var ee=$&&$.length?this.write($):"";if(this.lastNeed)return ee+"�";return ee}function eg($,ee){if(($.length-ee)%2===0){var et=$.toString("utf16le",ee);if(et){var en=et.charCodeAt(et.length-1);if(en>=55296&&en<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=$[$.length-2];this.lastChar[1]=$[$.length-1];return et.slice(0,-1)}}return et}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=$[$.length-1];return $.toString("utf16le",ee,$.length-1)}function em($){var ee=$&&$.length?this.write($):"";if(this.lastNeed){var et=this.lastTotal-this.lastNeed;return ee+this.lastChar.toString("utf16le",0,et)}return ee}function e_($,ee){var et=($.length-ee)%3;if(et===0)return $.toString("base64",ee);this.lastNeed=3-et;this.lastTotal=3;if(et===1){this.lastChar[0]=$[$.length-1]}else{this.lastChar[0]=$[$.length-2];this.lastChar[1]=$[$.length-1]}return $.toString("base64",ee,$.length-et)}function ew($){var ee=$&&$.length?this.write($):"";if(this.lastNeed)return ee+this.lastChar.toString("base64",0,3-this.lastNeed);return ee}function eE($){return $.toString(this.encoding)}function eS($){return $&&$.length?this.write($):""}},396:($,ee,et)=>{var en=et(8764);var ei=en.Buffer;function eo($,ee){for(var et in $){ee[et]=$[et]}}if(ei.from&&ei.alloc&&ei.allocUnsafe&&ei.allocUnsafeSlow){$.exports=en}else{eo(en,ee);ee.Buffer=es}function es($,ee,et){return ei($,ee,et)}eo(ei,es);es.from=function($,ee,et){if(typeof $==="number"){throw new TypeError("Argument must not be a number")}return ei($,ee,et)};es.alloc=function($,ee,et){if(typeof $!=="number"){throw new TypeError("Argument must be a number")}var en=ei($);if(ee!==undefined){if(typeof et==="string"){en.fill(ee,et)}else{en.fill(ee)}}else{en.fill(0)}return en};es.allocUnsafe=function($){if(typeof $!=="number"){throw new TypeError("Argument must be a number")}return ei($)};es.allocUnsafeSlow=function($){if(typeof $!=="number"){throw new TypeError("Argument must be a number")}return en.SlowBuffer($)}},8393:function($,ee,et){"use strict";var en=this&&this.__createBinding||(Object.create?function($,ee,et,en){if(en===undefined)en=et;var ei=Object.getOwnPropertyDescriptor(ee,et);if(!ei||("get"in ei?!ee.__esModule:ei.writable||ei.configurable)){ei={enumerable:true,get:function $(){return ee[et]}}}Object.defineProperty($,en,ei)}:function($,ee,et,en){if(en===undefined)en=et;$[en]=ee[et]});var ei=this&&this.__exportStar||function($,ee){for(var et in $)if(et!=="default"&&!Object.prototype.hasOwnProperty.call(ee,et))en(ee,$,et)};Object.defineProperty(ee,"__esModule",{value:true});ei(et(5416),ee)},4473:function($,ee,et){"use strict";var en=this&&this.__createBinding||(Object.create?function($,ee,et,en){if(en===undefined)en=et;var ei=Object.getOwnPropertyDescriptor(ee,et);if(!ei||("get"in ei?!ee.__esModule:ei.writable||ei.configurable)){ei={enumerable:true,get:function $(){return ee[et]}}}Object.defineProperty($,en,ei)}:function($,ee,et,en){if(en===undefined)en=et;$[en]=ee[et]});var ei=this&&this.__setModuleDefault||(Object.create?function($,ee){Object.defineProperty($,"default",{enumerable:true,value:ee})}:function($,ee){$["default"]=ee});var eo=this&&this.__importStar||function($){if($&&$.__esModule)return $;var ee={};if($!=null){for(var et in $)if(et!=="default"&&Object.prototype.hasOwnProperty.call($,et))en(ee,$,et)}ei(ee,$);return ee};Object.defineProperty(ee,"__esModule",{value:true});ee.Timestamp=ee.deserializeClock=ee.serializeClock=ee.makeClientId=ee.makeClock=ee.setClock=ee.getClock=ee.merkle=void 0;var es=eo(et(5470));ee.merkle=es;var eu=et(3136);Object.defineProperty(ee,"getClock",{enumerable:true,get:function $(){return eu.getClock}});Object.defineProperty(ee,"setClock",{enumerable:true,get:function $(){return eu.setClock}});Object.defineProperty(ee,"makeClock",{enumerable:true,get:function $(){return eu.makeClock}});Object.defineProperty(ee,"makeClientId",{enumerable:true,get:function $(){return eu.makeClientId}});Object.defineProperty(ee,"serializeClock",{enumerable:true,get:function $(){return eu.serializeClock}});Object.defineProperty(ee,"deserializeClock",{enumerable:true,get:function $(){return eu.deserializeClock}});Object.defineProperty(ee,"Timestamp",{enumerable:true,get:function $(){return eu.Timestamp}})},5470:($,ee)=>{"use strict";function et($,ee){if(ee==null||ee>$.length)ee=$.length;for(var et=0,en=new Array(ee);et<ee;et++)en[et]=$[et];return en}function en($){if(Array.isArray($))return et($)}function ei($,ee,et){if(ee in $){Object.defineProperty($,ee,{value:et,enumerable:true,configurable:true,writable:true})}else{$[ee]=et}return $}function eo($){if(typeof Symbol!=="undefined"&&$[Symbol.iterator]!=null||$["@@iterator"]!=null)return Array.from($)}function es(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function eu($){return en($)||eo($)||el($)||es()}function el($,ee){if(!$)return;if(typeof $==="string")return et($,ee);var en=Object.prototype.toString.call($).slice(8,-1);if(en==="Object"&&$.constructor)en=$.constructor.name;if(en==="Map"||en==="Set")return Array.from(en);if(en==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(en))return et($,ee)}Object.defineProperty(ee,"__esModule",{value:true});ee.debug=ee.prune=ee.diff=ee.build=ee.insert=ee.keyToTimestamp=ee.getKeys=ee.emptyTrie=void 0;function ef(){return{hash:0}}ee.emptyTrie=ef;function ed($){return["0","1","2"].includes($)}function ep($){return Object.keys($).filter(ed)}ee.getKeys=ep;function eh($){var ee=$+"0".repeat(16-$.length);return parseInt(ee,3)*1e3*60}ee.keyToTimestamp=eh;function ey($,ee){var et=ee.hash();var en=Number(Math.floor(ee.millis()/1e3/60)).toString(3);$=Object.assign({},$,{hash:($.hash||0)^et});return eg($,en,et)}ee.insert=ey;function eg($,ee,et){if(ee.length===0){return $}var en=ee[0];var eo=ed(en)?$[en]:undefined;var es=eo||{};return Object.assign({},$,ei({},en,Object.assign({},es,eg(es,ee.slice(1),et),{hash:(es.hash||0)^et})))}function em($){var ee=ef();var et=true,en=false,ei=undefined;try{for(var eo=$[Symbol.iterator](),es;!(et=(es=eo.next()).done);et=true){var eu=es.value;ey(ee,eu)}}catch($){en=true;ei=$}finally{try{if(!et&&eo.return!=null){eo.return()}}finally{if(en){throw ei}}}return ee}ee.build=em;function e_($,ee){if($.hash===ee.hash){return null}var et=$;var en=ee;var ei="";while(1){var eo=new Set(eu(ep(et)).concat(eu(ep(en))));var es=eu(eo.values());es.sort();var el=null;for(var ed=0;ed<es.length;ed++){var ey=es[ed];var eg=et[ey];var em=en[ey];if(!eg||!em){break}if(eg.hash!==em.hash){el=ey;break}}if(!el){return eh(ei)}ei+=el;et=et[el]||ef();en=en[el]||ef()}return null}ee.diff=e_;function ew($){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;if(!$.hash){return $}var et=ep($);et.sort();var en={hash:$.hash};var ei=true,eo=false,es=undefined;try{for(var eu=et.slice(-ee)[Symbol.iterator](),el;!(ei=(el=eu.next()).done);ei=true){var ef=el.value;var ed=$[ef];if(!ed){throw new Error("TrieNode for key ".concat(ef," could not be found"))}en[ef]=ew(ed,ee)}}catch($){eo=true;es=$}finally{try{if(!ei&&eu.return!=null){eu.return()}}finally{if(eo){throw es}}}return en}ee.prune=ew;function eE($){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",et=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;var en=" ".repeat(et)+(ee!==""?"k: ".concat(ee," "):"")+"hash: ".concat($.hash||"(empty)","\n");return en+ep($).map(function(ee){var en=$[ee];if(!en)return"";return eE(en,ee,et+2)}).join("")}ee.debug=eE},3136:function($,ee,et){"use strict";function en($){if($===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return $}function ei($,ee){if(!($ instanceof ee)){throw new TypeError("Cannot call a class as a function")}}function eo($,ee,et){if(e_()){eo=Reflect.construct}else{eo=function $($,ee,et){var en=[null];en.push.apply(en,ee);var ei=Function.bind.apply($,en);var eo=new ei;if(et)ey(eo,et.prototype);return eo}}return eo.apply(null,arguments)}function es($,ee){for(var et=0;et<ee.length;et++){var en=ee[et];en.enumerable=en.enumerable||false;en.configurable=true;if("value"in en)en.writable=true;Object.defineProperty($,en.key,en)}}function eu($,ee,et){if(ee)es($.prototype,ee);if(et)es($,et);return $}function el($){el=Object.setPrototypeOf?Object.getPrototypeOf:function $($){return $.__proto__||Object.getPrototypeOf($)};return el($)}function ef($,ee){if(typeof ee!=="function"&&ee!==null){throw new TypeError("Super expression must either be null or a function")}$.prototype=Object.create(ee&&ee.prototype,{constructor:{value:$,writable:true,configurable:true}});if(ee)ey($,ee)}function ed($,ee){if(ee!=null&&typeof Symbol!=="undefined"&&ee[Symbol.hasInstance]){return!!ee[Symbol.hasInstance]($)}else{return $ instanceof ee}}function ep($){return Function.toString.call($).indexOf("[native code]")!==-1}function eh($,ee){if(ee&&(eg(ee)==="object"||typeof ee==="function")){return ee}return en($)}function ey($,ee){ey=Object.setPrototypeOf||function $($,ee){$.__proto__=ee;return $};return ey($,ee)}function eg($){"@swc/helpers - typeof";return $&&typeof Symbol!=="undefined"&&$.constructor===Symbol?"symbol":typeof $}function em($){var ee=typeof Map==="function"?new Map:undefined;em=function $($){if($===null||!ep($))return $;if(typeof $!=="function"){throw new TypeError("Super expression must either be null or a function")}if(typeof ee!=="undefined"){if(ee.has($))return ee.get($);ee.set($,et)}function et(){return eo($,arguments,el(this).constructor)}et.prototype=Object.create($.prototype,{constructor:{value:et,enumerable:false,writable:true,configurable:true}});return ey(et,$)};return em($)}function e_(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch($){return false}}function ew($){var ee=e_();return function et(){var et=el($),en;if(ee){var ei=el(this).constructor;en=Reflect.construct(et,arguments,ei)}else{en=et.apply(this,arguments)}return eh(this,en)}}var eE=this&&this.__importDefault||function($){return $&&$.__esModule?$:{"default":$}};Object.defineProperty(ee,"__esModule",{value:true});ee.Timestamp=ee.makeClientId=ee.deserializeClock=ee.serializeClock=ee.makeClock=ee.getClock=ee.setClock=void 0;var eS=eE(et(8053));var eT=et(7429);var eO;function eA($){eO=$}ee.setClock=eA;function eI(){return eO}ee.getClock=eI;function eN($){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return{timestamp:eF.from($),merkle:ee}}ee.makeClock=eN;function eD($){return JSON.stringify({timestamp:$.timestamp.toString(),merkle:$.merkle})}ee.serializeClock=eD;function eR($){var ee;try{ee=JSON.parse($)}catch($){ee={timestamp:"1970-01-01T00:00:00.000Z-0000-"+eC(),merkle:{}}}var et=eP.parse(ee.timestamp);if(!et){throw new eP.InvalidError(ee.timestamp)}return{timestamp:eF.from(et),merkle:ee.merkle}}ee.deserializeClock=eR;function eC(){return(0,eT.v4)().replace(/-/g,"").slice(-16)}ee.makeClientId=eC;var ek={maxDrift:5*60*1e3};var eM=parseInt("0xFFFF");var eL=16;var eP=function(){function $(ee,et,en){ei(this,$);this._state={millis:ee,counter:et,node:en}}eu($,[{key:"valueOf",value:function $(){return this.toString()}},{key:"toString",value:function $(){return[new Date(this.millis()).toISOString(),("0000"+this.counter().toString(16).toUpperCase()).slice(-4),("0000000000000000"+this.node()).slice(-16)].join("-")}},{key:"millis",value:function $(){return this._state.millis}},{key:"counter",value:function $(){return this._state.counter}},{key:"node",value:function $(){return this._state.node}},{key:"hash",value:function $(){return eS.default.v3(this.toString())}}],[{key:"init",value:function ee(){var ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ee.maxDrift){ek.maxDrift=ee.maxDrift}eA(eN(new $(0,0,ee.node?("0000000000000000"+ee.node).toString().slice(-16):"")))}},{key:"parse",value:function ee(ee){if(ed(ee,$)){return ee}if(typeof ee==="string"){var et=ee.split("-");if(et&&et.length===5){var en=Date.parse(et.slice(0,3).join("-")).valueOf();var ei=parseInt(et[3],16);var eo=et[4];if(!isNaN(en)&&en>=0&&!isNaN(ei)&&ei<=eM&&typeof eo==="string"&&eo.length<=eL){return new $(en,ei,eo)}}}return null}},{key:"send",value:function ee(){if(!eO){return null}var ee=Date.now();var et=eO.timestamp.millis();var en=eO.timestamp.counter();var ei=Math.max(et,ee);var eo=et===ei?en+1:0;if(ei-ee>ek.maxDrift){throw new $.ClockDriftError(ei,ee,ek.maxDrift)}if(eo>eM){throw new $.OverflowError}eO.timestamp.setMillis(ei);eO.timestamp.setCounter(eo);return new $(eO.timestamp.millis(),eO.timestamp.counter(),eO.timestamp.node())}},{key:"recv",value:function ee(ee){if(!eO){return null}var et=Date.now();var en=ee.millis();var ei=ee.counter();if(en-et>ek.maxDrift){throw new $.ClockDriftError}var eo=eO.timestamp.millis();var es=eO.timestamp.counter();var eu=Math.max(Math.max(eo,et),en);var el=eu===eo&&eu===en?Math.max(es,ei)+1:eu===eo?es+1:eu===en?ei+1:0;if(eu-et>ek.maxDrift){throw new $.ClockDriftError}if(el>eM){throw new $.OverflowError}eO.timestamp.setMillis(eu);eO.timestamp.setCounter(el);return new $(eO.timestamp.millis(),eO.timestamp.counter(),eO.timestamp.node())}}]);return $}();eP.max=eP.parse("9999-12-31T23:59:59.999Z-FFFF-FFFFFFFFFFFFFFFF");eP.zero=eP.parse("1970-01-01T00:00:00.000Z-0000-0000000000000000");eP.since=function($){return $+"-0000-0000000000000000"};eP.DuplicateNodeError=function($){ef(et,$);var ee=ew(et);function et($){ei(this,et);var en;en=ee.call(this,"duplicate node identifier "+$);en.name="DuplicateNodeError";return en}return et}(em(Error));eP.ClockDriftError=function($){ef(et,$);var ee=ew(et);function et(){for(var $=arguments.length,en=new Array($),eo=0;eo<$;eo++){en[eo]=arguments[eo]}ei(this,et);var es;es=ee.call(this,["maximum clock drift exceeded"].concat(en).join(" "));es.name="ClockDriftError";return es}return et}(em(Error));eP.OverflowError=function($){ef(et,$);var ee=ew(et);function et(){ei(this,et);var $;$=ee.call(this,"timestamp counter overflow");$.name="OverflowError";return $}return et}(em(Error));eP.InvalidError=function($){ef(et,$);var ee=ew(et);function et(){for(var $=arguments.length,en=new Array($),eo=0;eo<$;eo++){en[eo]=arguments[eo]}ei(this,et);var es;es=ee.call(this,["timestamp is not valid"].concat(en.map(String)).join(" "));es.name="InvalidError";return es}return et}(em(Error));ee.Timestamp=eP;var eF=function($){ef(et,$);var ee=ew(et);function et(){ei(this,et);return ee.apply(this,arguments)}eu(et,[{key:"setMillis",value:function $($){this._state.millis=$}},{key:"setCounter",value:function $($){this._state.counter=$}},{key:"setNode",value:function $($){this._state.node=$}}],[{key:"from",value:function $($){return new et($.millis(),$.counter(),$.node())}}]);return et}(eP)},5416:function($,ee,et){"use strict";var en=this&&this.__createBinding||(Object.create?function($,ee,et,en){if(en===undefined)en=et;var ei=Object.getOwnPropertyDescriptor(ee,et);if(!ei||("get"in ei?!ee.__esModule:ei.writable||ei.configurable)){ei={enumerable:true,get:function $(){return ee[et]}}}Object.defineProperty($,en,ei)}:function($,ee,et,en){if(en===undefined)en=et;$[en]=ee[et]});var ei=this&&this.__setModuleDefault||(Object.create?function($,ee){Object.defineProperty($,"default",{enumerable:true,value:ee})}:function($,ee){$["default"]=ee});var eo=this&&this.__importStar||function($){if($&&$.__esModule)return $;var ee={};if($!=null){for(var et in $)if(et!=="default"&&Object.prototype.hasOwnProperty.call($,et))en(ee,$,et)}ei(ee,$);return ee};Object.defineProperty(ee,"__esModule",{value:true});ee.SyncProtoBuf=ee.Timestamp=ee.deserializeClock=ee.serializeClock=ee.makeClientId=ee.makeClock=ee.setClock=ee.getClock=ee.merkle=void 0;var es=eo(et(1323));var eu=et(4473);Object.defineProperty(ee,"merkle",{enumerable:true,get:function $(){return eu.merkle}});Object.defineProperty(ee,"getClock",{enumerable:true,get:function $(){return eu.getClock}});Object.defineProperty(ee,"setClock",{enumerable:true,get:function $(){return eu.setClock}});Object.defineProperty(ee,"makeClock",{enumerable:true,get:function $(){return eu.makeClock}});Object.defineProperty(ee,"makeClientId",{enumerable:true,get:function $(){return eu.makeClientId}});Object.defineProperty(ee,"serializeClock",{enumerable:true,get:function $(){return eu.serializeClock}});Object.defineProperty(ee,"deserializeClock",{enumerable:true,get:function $(){return eu.deserializeClock}});Object.defineProperty(ee,"Timestamp",{enumerable:true,get:function $(){return eu.Timestamp}});ee.SyncProtoBuf=es},1323:($,ee,et)=>{"use strict";var en=et(3019);var ei=en;var eo=globalThis;ei.exportSymbol("proto.EncryptedData",null,eo);ei.exportSymbol("proto.Message",null,eo);ei.exportSymbol("proto.MessageEnvelope",null,eo);ei.exportSymbol("proto.SyncRequest",null,eo);ei.exportSymbol("proto.SyncResponse",null,eo);proto.EncryptedData=function($){en.Message.initialize(this,$,0,-1,null,null)};ei.inherits(proto.EncryptedData,en.Message);if(ei.DEBUG&&!COMPILED){proto.EncryptedData.displayName="proto.EncryptedData"}proto.Message=function($){en.Message.initialize(this,$,0,-1,null,null)};ei.inherits(proto.Message,en.Message);if(ei.DEBUG&&!COMPILED){proto.Message.displayName="proto.Message"}proto.MessageEnvelope=function($){en.Message.initialize(this,$,0,-1,null,null)};ei.inherits(proto.MessageEnvelope,en.Message);if(ei.DEBUG&&!COMPILED){proto.MessageEnvelope.displayName="proto.MessageEnvelope"}proto.SyncRequest=function($){en.Message.initialize(this,$,0,-1,proto.SyncRequest.repeatedFields_,null)};ei.inherits(proto.SyncRequest,en.Message);if(ei.DEBUG&&!COMPILED){proto.SyncRequest.displayName="proto.SyncRequest"}proto.SyncResponse=function($){en.Message.initialize(this,$,0,-1,proto.SyncResponse.repeatedFields_,null)};ei.inherits(proto.SyncResponse,en.Message);if(ei.DEBUG&&!COMPILED){proto.SyncResponse.displayName="proto.SyncResponse"}if(en.Message.GENERATE_TO_OBJECT){proto.EncryptedData.prototype.toObject=function($){return proto.EncryptedData.toObject($,this)};proto.EncryptedData.toObject=function($,ee){var et,en={iv:ee.getIv_asB64(),authtag:ee.getAuthtag_asB64(),data:ee.getData_asB64()};if($){en.$jspbMessageInstance=ee}return en}}proto.EncryptedData.deserializeBinary=function($){var ee=new en.BinaryReader($);var et=new proto.EncryptedData;return proto.EncryptedData.deserializeBinaryFromReader(et,ee)};proto.EncryptedData.deserializeBinaryFromReader=function($,ee){while(ee.nextField()){if(ee.isEndGroup()){break}var et=ee.getFieldNumber();switch(et){case 1:var en=ee.readBytes();$.setIv(en);break;case 2:var en=ee.readBytes();$.setAuthtag(en);break;case 3:var en=ee.readBytes();$.setData(en);break;default:ee.skipField();break}}return $};proto.EncryptedData.prototype.serializeBinary=function(){var $=new en.BinaryWriter;proto.EncryptedData.serializeBinaryToWriter(this,$);return $.getResultBuffer()};proto.EncryptedData.serializeBinaryToWriter=function($,ee){var et=undefined;et=$.getIv_asU8();if(et.length>0){ee.writeBytes(1,et)}et=$.getAuthtag_asU8();if(et.length>0){ee.writeBytes(2,et)}et=$.getData_asU8();if(et.length>0){ee.writeBytes(3,et)}};proto.EncryptedData.prototype.getIv=function(){return en.Message.getFieldWithDefault(this,1,"")};proto.EncryptedData.prototype.getIv_asB64=function(){return en.Message.bytesAsB64(this.getIv())};proto.EncryptedData.prototype.getIv_asU8=function(){return en.Message.bytesAsU8(this.getIv())};proto.EncryptedData.prototype.setIv=function($){return en.Message.setProto3BytesField(this,1,$)};proto.EncryptedData.prototype.getAuthtag=function(){return en.Message.getFieldWithDefault(this,2,"")};proto.EncryptedData.prototype.getAuthtag_asB64=function(){return en.Message.bytesAsB64(this.getAuthtag())};proto.EncryptedData.prototype.getAuthtag_asU8=function(){return en.Message.bytesAsU8(this.getAuthtag())};proto.EncryptedData.prototype.setAuthtag=function($){return en.Message.setProto3BytesField(this,2,$)};proto.EncryptedData.prototype.getData=function(){return en.Message.getFieldWithDefault(this,3,"")};proto.EncryptedData.prototype.getData_asB64=function(){return en.Message.bytesAsB64(this.getData())};proto.EncryptedData.prototype.getData_asU8=function(){return en.Message.bytesAsU8(this.getData())};proto.EncryptedData.prototype.setData=function($){return en.Message.setProto3BytesField(this,3,$)};if(en.Message.GENERATE_TO_OBJECT){proto.Message.prototype.toObject=function($){return proto.Message.toObject($,this)};proto.Message.toObject=function($,ee){var et,ei={dataset:en.Message.getFieldWithDefault(ee,1,""),row:en.Message.getFieldWithDefault(ee,2,""),column:en.Message.getFieldWithDefault(ee,3,""),value:en.Message.getFieldWithDefault(ee,4,"")};if($){ei.$jspbMessageInstance=ee}return ei}}proto.Message.deserializeBinary=function($){var ee=new en.BinaryReader($);var et=new proto.Message;return proto.Message.deserializeBinaryFromReader(et,ee)};proto.Message.deserializeBinaryFromReader=function($,ee){while(ee.nextField()){if(ee.isEndGroup()){break}var et=ee.getFieldNumber();switch(et){case 1:var en=ee.readString();$.setDataset(en);break;case 2:var en=ee.readString();$.setRow(en);break;case 3:var en=ee.readString();$.setColumn(en);break;case 4:var en=ee.readString();$.setValue(en);break;default:ee.skipField();break}}return $};proto.Message.prototype.serializeBinary=function(){var $=new en.BinaryWriter;proto.Message.serializeBinaryToWriter(this,$);return $.getResultBuffer()};proto.Message.serializeBinaryToWriter=function($,ee){var et=undefined;et=$.getDataset();if(et.length>0){ee.writeString(1,et)}et=$.getRow();if(et.length>0){ee.writeString(2,et)}et=$.getColumn();if(et.length>0){ee.writeString(3,et)}et=$.getValue();if(et.length>0){ee.writeString(4,et)}};proto.Message.prototype.getDataset=function(){return en.Message.getFieldWithDefault(this,1,"")};proto.Message.prototype.setDataset=function($){return en.Message.setProto3StringField(this,1,$)};proto.Message.prototype.getRow=function(){return en.Message.getFieldWithDefault(this,2,"")};proto.Message.prototype.setRow=function($){return en.Message.setProto3StringField(this,2,$)};proto.Message.prototype.getColumn=function(){return en.Message.getFieldWithDefault(this,3,"")};proto.Message.prototype.setColumn=function($){return en.Message.setProto3StringField(this,3,$)};proto.Message.prototype.getValue=function(){return en.Message.getFieldWithDefault(this,4,"")};proto.Message.prototype.setValue=function($){return en.Message.setProto3StringField(this,4,$)};if(en.Message.GENERATE_TO_OBJECT){proto.MessageEnvelope.prototype.toObject=function($){return proto.MessageEnvelope.toObject($,this)};proto.MessageEnvelope.toObject=function($,ee){var et,ei={timestamp:en.Message.getFieldWithDefault(ee,1,""),isencrypted:en.Message.getBooleanFieldWithDefault(ee,2,false),content:ee.getContent_asB64()};if($){ei.$jspbMessageInstance=ee}return ei}}proto.MessageEnvelope.deserializeBinary=function($){var ee=new en.BinaryReader($);var et=new proto.MessageEnvelope;return proto.MessageEnvelope.deserializeBinaryFromReader(et,ee)};proto.MessageEnvelope.deserializeBinaryFromReader=function($,ee){while(ee.nextField()){if(ee.isEndGroup()){break}var et=ee.getFieldNumber();switch(et){case 1:var en=ee.readString();$.setTimestamp(en);break;case 2:var en=ee.readBool();$.setIsencrypted(en);break;case 3:var en=ee.readBytes();$.setContent(en);break;default:ee.skipField();break}}return $};proto.MessageEnvelope.prototype.serializeBinary=function(){var $=new en.BinaryWriter;proto.MessageEnvelope.serializeBinaryToWriter(this,$);return $.getResultBuffer()};proto.MessageEnvelope.serializeBinaryToWriter=function($,ee){var et=undefined;et=$.getTimestamp();if(et.length>0){ee.writeString(1,et)}et=$.getIsencrypted();if(et){ee.writeBool(2,et)}et=$.getContent_asU8();if(et.length>0){ee.writeBytes(3,et)}};proto.MessageEnvelope.prototype.getTimestamp=function(){return en.Message.getFieldWithDefault(this,1,"")};proto.MessageEnvelope.prototype.setTimestamp=function($){return en.Message.setProto3StringField(this,1,$)};proto.MessageEnvelope.prototype.getIsencrypted=function(){return en.Message.getBooleanFieldWithDefault(this,2,false)};proto.MessageEnvelope.prototype.setIsencrypted=function($){return en.Message.setProto3BooleanField(this,2,$)};proto.MessageEnvelope.prototype.getContent=function(){return en.Message.getFieldWithDefault(this,3,"")};proto.MessageEnvelope.prototype.getContent_asB64=function(){return en.Message.bytesAsB64(this.getContent())};proto.MessageEnvelope.prototype.getContent_asU8=function(){return en.Message.bytesAsU8(this.getContent())};proto.MessageEnvelope.prototype.setContent=function($){return en.Message.setProto3BytesField(this,3,$)};proto.SyncRequest.repeatedFields_=[1];if(en.Message.GENERATE_TO_OBJECT){proto.SyncRequest.prototype.toObject=function($){return proto.SyncRequest.toObject($,this)};proto.SyncRequest.toObject=function($,ee){var et,ei={messagesList:en.Message.toObjectList(ee.getMessagesList(),proto.MessageEnvelope.toObject,$),fileid:en.Message.getFieldWithDefault(ee,2,""),groupid:en.Message.getFieldWithDefault(ee,3,""),keyid:en.Message.getFieldWithDefault(ee,5,""),since:en.Message.getFieldWithDefault(ee,6,"")};if($){ei.$jspbMessageInstance=ee}return ei}}proto.SyncRequest.deserializeBinary=function($){var ee=new en.BinaryReader($);var et=new proto.SyncRequest;return proto.SyncRequest.deserializeBinaryFromReader(et,ee)};proto.SyncRequest.deserializeBinaryFromReader=function($,ee){while(ee.nextField()){if(ee.isEndGroup()){break}var et=ee.getFieldNumber();switch(et){case 1:var en=new proto.MessageEnvelope;ee.readMessage(en,proto.MessageEnvelope.deserializeBinaryFromReader);$.addMessages(en);break;case 2:var en=ee.readString();$.setFileid(en);break;case 3:var en=ee.readString();$.setGroupid(en);break;case 5:var en=ee.readString();$.setKeyid(en);break;case 6:var en=ee.readString();$.setSince(en);break;default:ee.skipField();break}}return $};proto.SyncRequest.prototype.serializeBinary=function(){var $=new en.BinaryWriter;proto.SyncRequest.serializeBinaryToWriter(this,$);return $.getResultBuffer()};proto.SyncRequest.serializeBinaryToWriter=function($,ee){var et=undefined;et=$.getMessagesList();if(et.length>0){ee.writeRepeatedMessage(1,et,proto.MessageEnvelope.serializeBinaryToWriter)}et=$.getFileid();if(et.length>0){ee.writeString(2,et)}et=$.getGroupid();if(et.length>0){ee.writeString(3,et)}et=$.getKeyid();if(et.length>0){ee.writeString(5,et)}et=$.getSince();if(et.length>0){ee.writeString(6,et)}};proto.SyncRequest.prototype.getMessagesList=function(){return en.Message.getRepeatedWrapperField(this,proto.MessageEnvelope,1)};proto.SyncRequest.prototype.setMessagesList=function($){return en.Message.setRepeatedWrapperField(this,1,$)};proto.SyncRequest.prototype.addMessages=function($,ee){return en.Message.addToRepeatedWrapperField(this,1,$,proto.MessageEnvelope,ee)};proto.SyncRequest.prototype.clearMessagesList=function(){return this.setMessagesList([])};proto.SyncRequest.prototype.getFileid=function(){return en.Message.getFieldWithDefault(this,2,"")};proto.SyncRequest.prototype.setFileid=function($){return en.Message.setProto3StringField(this,2,$)};proto.SyncRequest.prototype.getGroupid=function(){return en.Message.getFieldWithDefault(this,3,"")};proto.SyncRequest.prototype.setGroupid=function($){return en.Message.setProto3StringField(this,3,$)};proto.SyncRequest.prototype.getKeyid=function(){return en.Message.getFieldWithDefault(this,5,"")};proto.SyncRequest.prototype.setKeyid=function($){return en.Message.setProto3StringField(this,5,$)};proto.SyncRequest.prototype.getSince=function(){return en.Message.getFieldWithDefault(this,6,"")};proto.SyncRequest.prototype.setSince=function($){return en.Message.setProto3StringField(this,6,$)};proto.SyncResponse.repeatedFields_=[1];if(en.Message.GENERATE_TO_OBJECT){proto.SyncResponse.prototype.toObject=function($){return proto.SyncResponse.toObject($,this)};proto.SyncResponse.toObject=function($,ee){var et,ei={messagesList:en.Message.toObjectList(ee.getMessagesList(),proto.MessageEnvelope.toObject,$),merkle:en.Message.getFieldWithDefault(ee,2,"")};if($){ei.$jspbMessageInstance=ee}return ei}}proto.SyncResponse.deserializeBinary=function($){var ee=new en.BinaryReader($);var et=new proto.SyncResponse;return proto.SyncResponse.deserializeBinaryFromReader(et,ee)};proto.SyncResponse.deserializeBinaryFromReader=function($,ee){while(ee.nextField()){if(ee.isEndGroup()){break}var et=ee.getFieldNumber();switch(et){case 1:var en=new proto.MessageEnvelope;ee.readMessage(en,proto.MessageEnvelope.deserializeBinaryFromReader);$.addMessages(en);break;case 2:var en=ee.readString();$.setMerkle(en);break;default:ee.skipField();break}}return $};proto.SyncResponse.prototype.serializeBinary=function(){var $=new en.BinaryWriter;proto.SyncResponse.serializeBinaryToWriter(this,$);return $.getResultBuffer()};proto.SyncResponse.serializeBinaryToWriter=function($,ee){var et=undefined;et=$.getMessagesList();if(et.length>0){ee.writeRepeatedMessage(1,et,proto.MessageEnvelope.serializeBinaryToWriter)}et=$.getMerkle();if(et.length>0){ee.writeString(2,et)}};proto.SyncResponse.prototype.getMessagesList=function(){return en.Message.getRepeatedWrapperField(this,proto.MessageEnvelope,1)};proto.SyncResponse.prototype.setMessagesList=function($){return en.Message.setRepeatedWrapperField(this,1,$)};proto.SyncResponse.prototype.addMessages=function($,ee){return en.Message.addToRepeatedWrapperField(this,1,$,proto.MessageEnvelope,ee)};proto.SyncResponse.prototype.clearMessagesList=function(){return this.setMessagesList([])};proto.SyncResponse.prototype.getMerkle=function(){return en.Message.getFieldWithDefault(this,2,"")};proto.SyncResponse.prototype.setMerkle=function($){return en.Message.setProto3StringField(this,2,$)};ei.object.extend(ee,proto)},4927:($,ee,et)=>{$.exports=en;function en($,ee){if(ei("noDeprecation")){return $}var et=false;function en(){if(!et){if(ei("throwDeprecation")){throw new Error(ee)}else if(ei("traceDeprecation")){console.trace(ee)}else{console.warn(ee)}et=true}return $.apply(this,arguments)}return en}function ei($){try{if(!et.g.localStorage)return false}catch($){return false}var ee=et.g.localStorage[$];if(null==ee)return false;return String(ee).toLowerCase()==="true"}},384:$=>{$.exports=function $($){return $&&typeof $==="object"&&typeof $.copy==="function"&&typeof $.fill==="function"&&typeof $.readUInt8==="function"}},5955:($,ee,et)=>{"use strict";var en=et(2584);var ei=et(8662);var eo=et(6430);var es=et(5692);function eu($){return $.call.bind($)}var el=typeof BigInt!=="undefined";var ef=typeof Symbol!=="undefined";var ed=eu(Object.prototype.toString);var ep=eu(Number.prototype.valueOf);var eh=eu(String.prototype.valueOf);var ey=eu(Boolean.prototype.valueOf);if(el){var eg=eu(BigInt.prototype.valueOf)}if(ef){var em=eu(Symbol.prototype.valueOf)}function e_($,ee){if(typeof $!=="object"){return false}try{ee($);return true}catch($){return false}}ee.isArgumentsObject=en;ee.isGeneratorFunction=ei;ee.isTypedArray=es;function ew($){return typeof Promise!=="undefined"&&$ instanceof Promise||$!==null&&typeof $==="object"&&typeof $.then==="function"&&typeof $.catch==="function"}ee.isPromise=ew;function eE($){if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){return ArrayBuffer.isView($)}return es($)||eq($)}ee.isArrayBufferView=eE;function eS($){return eo($)==="Uint8Array"}ee.isUint8Array=eS;function eT($){return eo($)==="Uint8ClampedArray"}ee.isUint8ClampedArray=eT;function eO($){return eo($)==="Uint16Array"}ee.isUint16Array=eO;function eA($){return eo($)==="Uint32Array"}ee.isUint32Array=eA;function eI($){return eo($)==="Int8Array"}ee.isInt8Array=eI;function eN($){return eo($)==="Int16Array"}ee.isInt16Array=eN;function eD($){return eo($)==="Int32Array"}ee.isInt32Array=eD;function eR($){return eo($)==="Float32Array"}ee.isFloat32Array=eR;function eC($){return eo($)==="Float64Array"}ee.isFloat64Array=eC;function ek($){return eo($)==="BigInt64Array"}ee.isBigInt64Array=ek;function eM($){return eo($)==="BigUint64Array"}ee.isBigUint64Array=eM;function eL($){return ed($)==="[object Map]"}eL.working=typeof Map!=="undefined"&&eL(new Map);function eP($){if(typeof Map==="undefined"){return false}return eL.working?eL($):$ instanceof Map}ee.isMap=eP;function eF($){return ed($)==="[object Set]"}eF.working=typeof Set!=="undefined"&&eF(new Set);function eB($){if(typeof Set==="undefined"){return false}return eF.working?eF($):$ instanceof Set}ee.isSet=eB;function eU($){return ed($)==="[object WeakMap]"}eU.working=typeof WeakMap!=="undefined"&&eU(new WeakMap);function ej($){if(typeof WeakMap==="undefined"){return false}return eU.working?eU($):$ instanceof WeakMap}ee.isWeakMap=ej;function eW($){return ed($)==="[object WeakSet]"}eW.working=typeof WeakSet!=="undefined"&&eW(new WeakSet);function eH($){return eW($)}ee.isWeakSet=eH;function ez($){return ed($)==="[object ArrayBuffer]"}ez.working=typeof ArrayBuffer!=="undefined"&&ez(new ArrayBuffer);function eV($){if(typeof ArrayBuffer==="undefined"){return false}return ez.working?ez($):$ instanceof ArrayBuffer}ee.isArrayBuffer=eV;function e$($){return ed($)==="[object DataView]"}e$.working=typeof ArrayBuffer!=="undefined"&&typeof DataView!=="undefined"&&e$(new DataView(new ArrayBuffer(1),0,1));function eq($){if(typeof DataView==="undefined"){return false}return e$.working?e$($):$ instanceof DataView}ee.isDataView=eq;var eG=typeof SharedArrayBuffer!=="undefined"?SharedArrayBuffer:undefined;function eY($){return ed($)==="[object SharedArrayBuffer]"}function eK($){if(typeof eG==="undefined"){return false}if(typeof eY.working==="undefined"){eY.working=eY(new eG)}return eY.working?eY($):$ instanceof eG}ee.isSharedArrayBuffer=eK;function eZ($){return ed($)==="[object AsyncFunction]"}ee.isAsyncFunction=eZ;function eJ($){return ed($)==="[object Map Iterator]"}ee.isMapIterator=eJ;function eX($){return ed($)==="[object Set Iterator]"}ee.isSetIterator=eX;function eQ($){return ed($)==="[object Generator]"}ee.isGeneratorObject=eQ;function e0($){return ed($)==="[object WebAssembly.Module]"}ee.isWebAssemblyCompiledModule=e0;function e1($){return e_($,ep)}ee.isNumberObject=e1;function e2($){return e_($,eh)}ee.isStringObject=e2;function e6($){return e_($,ey)}ee.isBooleanObject=e6;function e4($){return el&&e_($,eg)}ee.isBigIntObject=e4;function e3($){return ef&&e_($,em)}ee.isSymbolObject=e3;function e8($){return e1($)||e2($)||e6($)||e4($)||e3($)}ee.isBoxedPrimitive=e8;function e5($){return typeof Uint8Array!=="undefined"&&(eV($)||eK($))}ee.isAnyArrayBuffer=e5;["isProxy","isExternal","isModuleNamespaceObject"].forEach(function($){Object.defineProperty(ee,$,{enumerable:false,value:function(){throw new Error($+" is not supported in userland")}})})},9539:($,ee,et)=>{var en=et(4155);var ei=Object.getOwnPropertyDescriptors||function $($){var ee=Object.keys($);var et={};for(var en=0;en<ee.length;en++){et[ee[en]]=Object.getOwnPropertyDescriptor($,ee[en])}return et};var eo=/%[sdj%]/g;ee.format=function($){if(!eN($)){var ee=[];for(var et=0;et<arguments.length;et++){ee.push(ef(arguments[et]))}return ee.join(" ")}var et=1;var en=arguments;var ei=en.length;var es=String($).replace(eo,function($){if($==="%%")return"%";if(et>=ei)return $;switch($){case"%s":return String(en[et++]);case"%d":return Number(en[et++]);case"%j":try{return JSON.stringify(en[et++])}catch($){return"[Circular]"}default:return $}});for(var eu=en[et];et<ei;eu=en[++et]){if(eO(eu)||!ek(eu)){es+=" "+eu}else{es+=" "+ef(eu)}}return es};ee.deprecate=function($,et){if(typeof en!=="undefined"&&en.noDeprecation===true){return $}if(typeof en==="undefined"){return function(){return ee.deprecate($,et).apply(this,arguments)}}var ei=false;function eo(){if(!ei){if(en.throwDeprecation){throw new Error(et)}else if(en.traceDeprecation){console.trace(et)}else{console.error(et)}ei=true}return $.apply(this,arguments)}return eo};var es={};var eu=/^$/;if(({}).NODE_DEBUG){var el={}.NODE_DEBUG;el=el.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase();eu=new RegExp("^"+el+"$","i")}ee.debuglog=function($){$=$.toUpperCase();if(!es[$]){if(eu.test($)){var et=en.pid;es[$]=function(){var en=ee.format.apply(ee,arguments);console.error("%s %d: %s",$,et,en)}}else{es[$]=function(){}}}return es[$]};function ef($,et){var en={seen:[],stylize:ep};if(arguments.length>=3)en.depth=arguments[2];if(arguments.length>=4)en.colors=arguments[3];if(eT(et)){en.showHidden=et}else if(et){ee._extend(en,et)}if(eR(en.showHidden))en.showHidden=false;if(eR(en.depth))en.depth=2;if(eR(en.colors))en.colors=false;if(eR(en.customInspect))en.customInspect=true;if(en.colors)en.stylize=ed;return ey(en,$,en.depth)}ee.inspect=ef;ef.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]};ef.styles={"special":"cyan","number":"yellow","boolean":"yellow","undefined":"grey","null":"bold","string":"green","date":"magenta","regexp":"red"};function ed($,ee){var et=ef.styles[ee];if(et){return"\x1b["+ef.colors[et][0]+"m"+$+"\x1b["+ef.colors[et][1]+"m"}else{return $}}function ep($,ee){return $}function eh($){var ee={};$.forEach(function($,et){ee[$]=true});return ee}function ey($,et,en){if($.customInspect&&et&&eP(et.inspect)&&et.inspect!==ee.inspect&&!(et.constructor&&et.constructor.prototype===et)){var ei=et.inspect(en,$);if(!eN(ei)){ei=ey($,ei,en)}return ei}var eo=eg($,et);if(eo){return eo}var es=Object.keys(et);var eu=eh(es);if($.showHidden){es=Object.getOwnPropertyNames(et)}if(eL(et)&&(es.indexOf("message")>=0||es.indexOf("description")>=0)){return em(et)}if(es.length===0){if(eP(et)){var el=et.name?": "+et.name:"";return $.stylize("[Function"+el+"]","special")}if(eC(et)){return $.stylize(RegExp.prototype.toString.call(et),"regexp")}if(eM(et)){return $.stylize(Date.prototype.toString.call(et),"date")}if(eL(et)){return em(et)}}var ef="",ed=false,ep=["{","}"];if(eS(et)){ed=true;ep=["[","]"]}if(eP(et)){var eT=et.name?": "+et.name:"";ef=" [Function"+eT+"]"}if(eC(et)){ef=" "+RegExp.prototype.toString.call(et)}if(eM(et)){ef=" "+Date.prototype.toUTCString.call(et)}if(eL(et)){ef=" "+em(et)}if(es.length===0&&(!ed||et.length==0)){return ep[0]+ef+ep[1]}if(en<0){if(eC(et)){return $.stylize(RegExp.prototype.toString.call(et),"regexp")}else{return $.stylize("[Object]","special")}}$.seen.push(et);var eO;if(ed){eO=e_($,et,en,eu,es)}else{eO=es.map(function(ee){return ew($,et,en,eu,ee,ed)})}$.seen.pop();return eE(eO,ef,ep)}function eg($,ee){if(eR(ee))return $.stylize("undefined","undefined");if(eN(ee)){var et="'"+JSON.stringify(ee).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return $.stylize(et,"string")}if(eI(ee))return $.stylize(""+ee,"number");if(eT(ee))return $.stylize(""+ee,"boolean");if(eO(ee))return $.stylize("null","null")}function em($){return"["+Error.prototype.toString.call($)+"]"}function e_($,ee,et,en,ei){var eo=[];for(var es=0,eu=ee.length;es<eu;++es){if(eH(ee,String(es))){eo.push(ew($,ee,et,en,String(es),true))}else{eo.push("")}}ei.forEach(function(ei){if(!ei.match(/^\d+$/)){eo.push(ew($,ee,et,en,ei,true))}});return eo}function ew($,ee,et,en,ei,eo){var es,eu,el;el=Object.getOwnPropertyDescriptor(ee,ei)||{value:ee[ei]};if(el.get){if(el.set){eu=$.stylize("[Getter/Setter]","special")}else{eu=$.stylize("[Getter]","special")}}else{if(el.set){eu=$.stylize("[Setter]","special")}}if(!eH(en,ei)){es="["+ei+"]"}if(!eu){if($.seen.indexOf(el.value)<0){if(eO(et)){eu=ey($,el.value,null)}else{eu=ey($,el.value,et-1)}if(eu.indexOf("\n")>-1){if(eo){eu=eu.split("\n").map(function($){return" "+$}).join("\n").slice(2)}else{eu="\n"+eu.split("\n").map(function($){return" "+$}).join("\n")}}}else{eu=$.stylize("[Circular]","special")}}if(eR(es)){if(eo&&ei.match(/^\d+$/)){return eu}es=JSON.stringify(""+ei);if(es.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){es=es.slice(1,-1);es=$.stylize(es,"name")}else{es=es.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");es=$.stylize(es,"string")}}return es+": "+eu}function eE($,ee,et){var en=0;var ei=$.reduce(function($,ee){en++;if(ee.indexOf("\n")>=0)en++;return $+ee.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(ei>60){return et[0]+(ee===""?"":ee+"\n ")+" "+$.join(",\n ")+" "+et[1]}return et[0]+ee+" "+$.join(", ")+" "+et[1]}ee.types=et(5955);function eS($){return Array.isArray($)}ee.isArray=eS;function eT($){return typeof $==="boolean"}ee.isBoolean=eT;function eO($){return $===null}ee.isNull=eO;function eA($){return $==null}ee.isNullOrUndefined=eA;function eI($){return typeof $==="number"}ee.isNumber=eI;function eN($){return typeof $==="string"}ee.isString=eN;function eD($){return typeof $==="symbol"}ee.isSymbol=eD;function eR($){return $===void 0}ee.isUndefined=eR;function eC($){return ek($)&&eB($)==="[object RegExp]"}ee.isRegExp=eC;ee.types.isRegExp=eC;function ek($){return typeof $==="object"&&$!==null}ee.isObject=ek;function eM($){return ek($)&&eB($)==="[object Date]"}ee.isDate=eM;ee.types.isDate=eM;function eL($){return ek($)&&(eB($)==="[object Error]"||$ instanceof Error)}ee.isError=eL;ee.types.isNativeError=eL;function eP($){return typeof $==="function"}ee.isFunction=eP;function eF($){return $===null||typeof $==="boolean"||typeof $==="number"||typeof $==="string"||typeof $==="symbol"||typeof $==="undefined"}ee.isPrimitive=eF;ee.isBuffer=et(384);function eB($){return Object.prototype.toString.call($)}function eU($){return $<10?"0"+$.toString(10):$.toString(10)}var ej=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function eW(){var $=new Date;var ee=[eU($.getHours()),eU($.getMinutes()),eU($.getSeconds())].join(":");return[$.getDate(),ej[$.getMonth()],ee].join(" ")}ee.log=function(){console.log("%s - %s",eW(),ee.format.apply(ee,arguments))};ee.inherits=et(5717);ee._extend=function($,ee){if(!ee||!ek(ee))return $;var et=Object.keys(ee);var en=et.length;while(en--){$[et[en]]=ee[et[en]]}return $};function eH($,ee){return Object.prototype.hasOwnProperty.call($,ee)}var ez=typeof Symbol!=="undefined"?Symbol("util.promisify.custom"):undefined;ee.promisify=function $($){if(typeof $!=="function")throw new TypeError('The "original" argument must be of type Function');if(ez&&$[ez]){var ee=$[ez];if(typeof ee!=="function"){throw new TypeError('The "util.promisify.custom" argument must be of type Function')}Object.defineProperty(ee,ez,{value:ee,enumerable:false,writable:false,configurable:true});return ee}function ee(){var ee,et;var en=new Promise(function($,en){ee=$;et=en});var ei=[];for(var eo=0;eo<arguments.length;eo++){ei.push(arguments[eo])}ei.push(function($,en){if($){et($)}else{ee(en)}});try{$.apply(this,ei)}catch($){et($)}return en}Object.setPrototypeOf(ee,Object.getPrototypeOf($));if(ez)Object.defineProperty(ee,ez,{value:ee,enumerable:false,writable:false,configurable:true});return Object.defineProperties(ee,ei($))};ee.promisify.custom=ez;function eV($,ee){if(!$){var et=new Error("Promise was rejected with a falsy value");et.reason=$;$=et}return ee($)}function e$($){if(typeof $!=="function"){throw new TypeError('The "original" argument must be of type Function')}function ee(){var ee=[];for(var et=0;et<arguments.length;et++){ee.push(arguments[et])}var ei=ee.pop();if(typeof ei!=="function"){throw new TypeError("The last argument must be of type Function")}var eo=this;var es=function(){return ei.apply(eo,arguments)};$.apply(this,ee).then(function($){en.nextTick(es.bind(null,null,$))},function($){en.nextTick(eV.bind(null,$,es))})}Object.setPrototypeOf(ee,Object.getPrototypeOf($));Object.defineProperties(ee,ei($));return ee}ee.callbackify=e$},7429:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});Object.defineProperty(ee,"NIL",{enumerable:true,get:function $(){return eu.default}});Object.defineProperty(ee,"parse",{enumerable:true,get:function $(){return ep.default}});Object.defineProperty(ee,"stringify",{enumerable:true,get:function $(){return ed.default}});Object.defineProperty(ee,"v1",{enumerable:true,get:function $(){return en.default}});Object.defineProperty(ee,"v3",{enumerable:true,get:function $(){return ei.default}});Object.defineProperty(ee,"v4",{enumerable:true,get:function $(){return eo.default}});Object.defineProperty(ee,"v5",{enumerable:true,get:function $(){return es.default}});Object.defineProperty(ee,"validate",{enumerable:true,get:function $(){return ef.default}});Object.defineProperty(ee,"version",{enumerable:true,get:function $(){return el.default}});var en=eh(et(3990));var ei=eh(et(8237));var eo=eh(et(5355));var es=eh(et(3764));var eu=eh(et(6314));var el=eh(et(8464));var ef=eh(et(6435));var ed=eh(et(4008));var ep=eh(et(8222));function eh($){return $&&$.__esModule?$:{default:$}}},4163:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;function et($){if(typeof $==="string"){const ee=unescape(encodeURIComponent($));$=new Uint8Array(ee.length);for(let et=0;et<ee.length;++et){$[et]=ee.charCodeAt(et)}}return en(eo(es($),$.length*8))}function en($){const ee=[];const et=$.length*32;const en="0123456789abcdef";for(let ei=0;ei<et;ei+=8){const et=$[ei>>5]>>>ei%32&255;const eo=parseInt(en.charAt(et>>>4&15)+en.charAt(et&15),16);ee.push(eo)}return ee}function ei($){return($+64>>>9<<4)+14+1}function eo($,ee){$[ee>>5]|=128<<ee%32;$[ei(ee)-1]=ee;let et=1732584193;let en=-271733879;let eo=-1732584194;let es=271733878;for(let ee=0;ee<$.length;ee+=16){const ei=et;const el=en;const ef=eo;const eg=es;et=ed(et,en,eo,es,$[ee],7,-680876936);es=ed(es,et,en,eo,$[ee+1],12,-389564586);eo=ed(eo,es,et,en,$[ee+2],17,606105819);en=ed(en,eo,es,et,$[ee+3],22,-1044525330);et=ed(et,en,eo,es,$[ee+4],7,-176418897);es=ed(es,et,en,eo,$[ee+5],12,1200080426);eo=ed(eo,es,et,en,$[ee+6],17,-1473231341);en=ed(en,eo,es,et,$[ee+7],22,-45705983);et=ed(et,en,eo,es,$[ee+8],7,1770035416);es=ed(es,et,en,eo,$[ee+9],12,-1958414417);eo=ed(eo,es,et,en,$[ee+10],17,-42063);en=ed(en,eo,es,et,$[ee+11],22,-1990404162);et=ed(et,en,eo,es,$[ee+12],7,1804603682);es=ed(es,et,en,eo,$[ee+13],12,-40341101);eo=ed(eo,es,et,en,$[ee+14],17,-1502002290);en=ed(en,eo,es,et,$[ee+15],22,1236535329);et=ep(et,en,eo,es,$[ee+1],5,-165796510);es=ep(es,et,en,eo,$[ee+6],9,-1069501632);eo=ep(eo,es,et,en,$[ee+11],14,643717713);en=ep(en,eo,es,et,$[ee],20,-373897302);et=ep(et,en,eo,es,$[ee+5],5,-701558691);es=ep(es,et,en,eo,$[ee+10],9,38016083);eo=ep(eo,es,et,en,$[ee+15],14,-660478335);en=ep(en,eo,es,et,$[ee+4],20,-405537848);et=ep(et,en,eo,es,$[ee+9],5,568446438);es=ep(es,et,en,eo,$[ee+14],9,-1019803690);eo=ep(eo,es,et,en,$[ee+3],14,-187363961);en=ep(en,eo,es,et,$[ee+8],20,1163531501);et=ep(et,en,eo,es,$[ee+13],5,-1444681467);es=ep(es,et,en,eo,$[ee+2],9,-51403784);eo=ep(eo,es,et,en,$[ee+7],14,1735328473);en=ep(en,eo,es,et,$[ee+12],20,-1926607734);et=eh(et,en,eo,es,$[ee+5],4,-378558);es=eh(es,et,en,eo,$[ee+8],11,-2022574463);eo=eh(eo,es,et,en,$[ee+11],16,1839030562);en=eh(en,eo,es,et,$[ee+14],23,-35309556);et=eh(et,en,eo,es,$[ee+1],4,-1530992060);es=eh(es,et,en,eo,$[ee+4],11,1272893353);eo=eh(eo,es,et,en,$[ee+7],16,-155497632);en=eh(en,eo,es,et,$[ee+10],23,-1094730640);et=eh(et,en,eo,es,$[ee+13],4,681279174);es=eh(es,et,en,eo,$[ee],11,-358537222);eo=eh(eo,es,et,en,$[ee+3],16,-722521979);en=eh(en,eo,es,et,$[ee+6],23,76029189);et=eh(et,en,eo,es,$[ee+9],4,-640364487);es=eh(es,et,en,eo,$[ee+12],11,-421815835);eo=eh(eo,es,et,en,$[ee+15],16,530742520);en=eh(en,eo,es,et,$[ee+2],23,-995338651);et=ey(et,en,eo,es,$[ee],6,-198630844);es=ey(es,et,en,eo,$[ee+7],10,1126891415);eo=ey(eo,es,et,en,$[ee+14],15,-1416354905);en=ey(en,eo,es,et,$[ee+5],21,-57434055);et=ey(et,en,eo,es,$[ee+12],6,1700485571);es=ey(es,et,en,eo,$[ee+3],10,-1894986606);eo=ey(eo,es,et,en,$[ee+10],15,-1051523);en=ey(en,eo,es,et,$[ee+1],21,-2054922799);et=ey(et,en,eo,es,$[ee+8],6,1873313359);es=ey(es,et,en,eo,$[ee+15],10,-30611744);eo=ey(eo,es,et,en,$[ee+6],15,-1560198380);en=ey(en,eo,es,et,$[ee+13],21,1309151649);et=ey(et,en,eo,es,$[ee+4],6,-145523070);es=ey(es,et,en,eo,$[ee+11],10,-1120210379);eo=ey(eo,es,et,en,$[ee+2],15,718787259);en=ey(en,eo,es,et,$[ee+9],21,-343485551);et=eu(et,ei);en=eu(en,el);eo=eu(eo,ef);es=eu(es,eg)}return[et,en,eo,es]}function es($){if($.length===0){return[]}const ee=$.length*8;const et=new Uint32Array(ei(ee));for(let en=0;en<ee;en+=8){et[en>>5]|=($[en/8]&255)<<en%32}return et}function eu($,ee){const et=($&65535)+(ee&65535);const en=($>>16)+(ee>>16)+(et>>16);return en<<16|et&65535}function el($,ee){return $<<ee|$>>>32-ee}function ef($,ee,et,en,ei,eo){return eu(el(eu(eu(ee,$),eu(en,eo)),ei),et)}function ed($,ee,et,en,ei,eo,es){return ef(ee&et|~ee&en,$,ee,ei,eo,es)}function ep($,ee,et,en,ei,eo,es){return ef(ee&en|et&~en,$,ee,ei,eo,es)}function eh($,ee,et,en,ei,eo,es){return ef(ee^et^en,$,ee,ei,eo,es)}function ey($,ee,et,en,ei,eo,es){return ef(et^(ee|~en),$,ee,ei,eo,es)}var eg=et;ee["default"]=eg},4790:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;const et=typeof crypto!=="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var en={randomUUID:et};ee["default"]=en},6314:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var et="00000000-0000-0000-0000-000000000000";ee["default"]=et},8222:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var en=ei(et(6435));function ei($){return $&&$.__esModule?$:{default:$}}function eo($){if(!(0,en.default)($)){throw TypeError("Invalid UUID")}let ee;const et=new Uint8Array(16);et[0]=(ee=parseInt($.slice(0,8),16))>>>24;et[1]=ee>>>16&255;et[2]=ee>>>8&255;et[3]=ee&255;et[4]=(ee=parseInt($.slice(9,13),16))>>>8;et[5]=ee&255;et[6]=(ee=parseInt($.slice(14,18),16))>>>8;et[7]=ee&255;et[8]=(ee=parseInt($.slice(19,23),16))>>>8;et[9]=ee&255;et[10]=(ee=parseInt($.slice(24,36),16))/1099511627776&255;et[11]=ee/4294967296&255;et[12]=ee>>>24&255;et[13]=ee>>>16&255;et[14]=ee>>>8&255;et[15]=ee&255;return et}var es=eo;ee["default"]=es},58:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var et=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;ee["default"]=et},3319:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=ei;let et;const en=new Uint8Array(16);function ei(){if(!et){et=typeof crypto!=="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto);if(!et){throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}}return et(en)}},3757:($,ee)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;function et($,ee,et,en){switch($){case 0:return ee&et^~ee&en;case 1:return ee^et^en;case 2:return ee&et^ee&en^et&en;case 3:return ee^et^en}}function en($,ee){return $<<ee|$>>>32-ee}function ei($){const ee=[1518500249,1859775393,2400959708,3395469782];const ei=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof $==="string"){const ee=unescape(encodeURIComponent($));$=[];for(let et=0;et<ee.length;++et){$.push(ee.charCodeAt(et))}}else if(!Array.isArray($)){$=Array.prototype.slice.call($)}$.push(128);const eo=$.length/4+2;const es=Math.ceil(eo/16);const eu=new Array(es);for(let ee=0;ee<es;++ee){const et=new Uint32Array(16);for(let en=0;en<16;++en){et[en]=$[ee*64+en*4]<<24|$[ee*64+en*4+1]<<16|$[ee*64+en*4+2]<<8|$[ee*64+en*4+3]}eu[ee]=et}eu[es-1][14]=($.length-1)*8/Math.pow(2,32);eu[es-1][14]=Math.floor(eu[es-1][14]);eu[es-1][15]=($.length-1)*8&4294967295;for(let $=0;$<es;++$){const eo=new Uint32Array(80);for(let ee=0;ee<16;++ee){eo[ee]=eu[$][ee]}for(let $=16;$<80;++$){eo[$]=en(eo[$-3]^eo[$-8]^eo[$-14]^eo[$-16],1)}let es=ei[0];let el=ei[1];let ef=ei[2];let ed=ei[3];let ep=ei[4];for(let $=0;$<80;++$){const ei=Math.floor($/20);const eu=en(es,5)+et(ei,el,ef,ed)+ep+ee[ei]+eo[$]>>>0;ep=ed;ed=ef;ef=en(el,30)>>>0;el=es;es=eu}ei[0]=ei[0]+es>>>0;ei[1]=ei[1]+el>>>0;ei[2]=ei[2]+ef>>>0;ei[3]=ei[3]+ed>>>0;ei[4]=ei[4]+ep>>>0}return[ei[0]>>24&255,ei[0]>>16&255,ei[0]>>8&255,ei[0]&255,ei[1]>>24&255,ei[1]>>16&255,ei[1]>>8&255,ei[1]&255,ei[2]>>24&255,ei[2]>>16&255,ei[2]>>8&255,ei[2]&255,ei[3]>>24&255,ei[3]>>16&255,ei[3]>>8&255,ei[3]&255,ei[4]>>24&255,ei[4]>>16&255,ei[4]>>8&255,ei[4]&255]}var eo=ei;ee["default"]=eo},4008:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;ee.unsafeStringify=es;var en=ei(et(6435));function ei($){return $&&$.__esModule?$:{default:$}}const eo=[];for(let $=0;$<256;++$){eo.push(($+256).toString(16).slice(1))}function es($,ee=0){return(eo[$[ee+0]]+eo[$[ee+1]]+eo[$[ee+2]]+eo[$[ee+3]]+"-"+eo[$[ee+4]]+eo[$[ee+5]]+"-"+eo[$[ee+6]]+eo[$[ee+7]]+"-"+eo[$[ee+8]]+eo[$[ee+9]]+"-"+eo[$[ee+10]]+eo[$[ee+11]]+eo[$[ee+12]]+eo[$[ee+13]]+eo[$[ee+14]]+eo[$[ee+15]]).toLowerCase()}function eu($,ee=0){const et=es($,ee);if(!(0,en.default)(et)){throw TypeError("Stringified UUID is invalid")}return et}var el=eu;ee["default"]=el},3990:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var en=eo(et(3319));var ei=et(4008);function eo($){return $&&$.__esModule?$:{default:$}}let es;let eu;let el=0;let ef=0;function ed($,ee,et){let eo=ee&&et||0;const ed=ee||new Array(16);$=$||{};let ep=$.node||es;let eh=$.clockseq!==undefined?$.clockseq:eu;if(ep==null||eh==null){const ee=$.random||($.rng||en.default)();if(ep==null){ep=es=[ee[0]|1,ee[1],ee[2],ee[3],ee[4],ee[5]]}if(eh==null){eh=eu=(ee[6]<<8|ee[7])&16383}}let ey=$.msecs!==undefined?$.msecs:Date.now();let eg=$.nsecs!==undefined?$.nsecs:ef+1;const em=ey-el+(eg-ef)/1e4;if(em<0&&$.clockseq===undefined){eh=eh+1&16383}if((em<0||ey>el)&&$.nsecs===undefined){eg=0}if(eg>=1e4){throw new Error("uuid.v1(): Can't create more than 10M uuids/sec")}el=ey;ef=eg;eu=eh;ey+=122192928e5;const e_=((ey&268435455)*1e4+eg)%4294967296;ed[eo++]=e_>>>24&255;ed[eo++]=e_>>>16&255;ed[eo++]=e_>>>8&255;ed[eo++]=e_&255;const ew=ey/4294967296*1e4&268435455;ed[eo++]=ew>>>8&255;ed[eo++]=ew&255;ed[eo++]=ew>>>24&15|16;ed[eo++]=ew>>>16&255;ed[eo++]=eh>>>8|128;ed[eo++]=eh&255;for(let $=0;$<6;++$){ed[eo+$]=ep[$]}return ee||(0,ei.unsafeStringify)(ed)}var ep=ed;ee["default"]=ep},8237:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var en=eo(et(7925));var ei=eo(et(4163));function eo($){return $&&$.__esModule?$:{default:$}}const es=(0,en.default)("v3",48,ei.default);var eu=es;ee["default"]=eu},7925:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee.URL=ee.DNS=void 0;ee["default"]=ef;var en=et(4008);var ei=eo(et(8222));function eo($){return $&&$.__esModule?$:{default:$}}function es($){$=unescape(encodeURIComponent($));const ee=[];for(let et=0;et<$.length;++et){ee.push($.charCodeAt(et))}return ee}const eu="6ba7b810-9dad-11d1-80b4-00c04fd430c8";ee.DNS=eu;const el="6ba7b811-9dad-11d1-80b4-00c04fd430c8";ee.URL=el;function ef($,ee,et){function eo($,eo,eu,el){var ef;if(typeof $==="string"){$=es($)}if(typeof eo==="string"){eo=(0,ei.default)(eo)}if(((ef=eo)===null||ef===void 0?void 0:ef.length)!==16){throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)")}let ed=new Uint8Array(16+$.length);ed.set(eo);ed.set($,eo.length);ed=et(ed);ed[6]=ed[6]&15|ee;ed[8]=ed[8]&63|128;if(eu){el=el||0;for(let $=0;$<16;++$){eu[el+$]=ed[$]}return eu}return(0,en.unsafeStringify)(ed)}try{eo.name=$}catch($){}eo.DNS=eu;eo.URL=el;return eo}},5355:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var en=es(et(4790));var ei=es(et(3319));var eo=et(4008);function es($){return $&&$.__esModule?$:{default:$}}function eu($,ee,et){if(en.default.randomUUID&&!ee&&!$){return en.default.randomUUID()}$=$||{};const es=$.random||($.rng||ei.default)();es[6]=es[6]&15|64;es[8]=es[8]&63|128;if(ee){et=et||0;for(let $=0;$<16;++$){ee[et+$]=es[$]}return ee}return(0,eo.unsafeStringify)(es)}var el=eu;ee["default"]=el},3764:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var en=eo(et(7925));var ei=eo(et(3757));function eo($){return $&&$.__esModule?$:{default:$}}const es=(0,en.default)("v5",80,ei.default);var eu=es;ee["default"]=eu},6435:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var en=ei(et(58));function ei($){return $&&$.__esModule?$:{default:$}}function eo($){return typeof $==="string"&&en.default.test($)}var es=eo;ee["default"]=es},8464:($,ee,et)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:true});ee["default"]=void 0;var en=ei(et(6435));function ei($){return $&&$.__esModule?$:{default:$}}function eo($){if(!(0,en.default)($)){throw TypeError("Invalid UUID")}return parseInt($.slice(14,15),16)}var es=eo;ee["default"]=es},3679:($,ee,et)=>{"use strict";var en=et(9981);var ei=et(4578);var eo=et(6814);var es=et(2636);var eu=et(3376);$.exports=function $($){if($==null||typeof $!=="object"&&typeof $!=="function"){return null}if(en($)){return"String"}if(ei($)){return"Number"}if(eo($)){return"Boolean"}if(es($)){return"Symbol"}if(eu($)){return"BigInt"}}},6430:($,ee,et)=>{"use strict";var en=et(4029);var ei=et(3083);var eo=et(5559);var es=et(1924);var eu=et(7296);var el=es("Object.prototype.toString");var ef=et(6410)();var ed=typeof globalThis==="undefined"?et.g:globalThis;var ep=ei();var eh=es("String.prototype.slice");var ey=Object.getPrototypeOf;var eg=es("Array.prototype.indexOf",true)||function $($,ee){for(var et=0;et<$.length;et+=1){if($[et]===ee){return et}}return-1};var em={__proto__:null};if(ef&&eu&&ey){en(ep,function($){var ee=new ed[$];if(Symbol.toStringTag in ee){var et=ey(ee);var en=eu(et,Symbol.toStringTag);if(!en){var ei=ey(et);en=eu(ei,Symbol.toStringTag)}em["$"+$]=eo(en.get)}})}else{en(ep,function($){var ee=new ed[$];em["$"+$]=eo(ee.slice)})}var e_=function $($){var ee=false;en(em,function(et,en){if(!ee){try{if("$"+et($)===en){ee=eh(en,1)}}catch($){}}});return ee};var ew=function $($){var ee=false;en(em,function(et,en){if(!ee){try{et($);ee=eh(en,1)}catch($){}}});return ee};$.exports=function $($){if(!$||typeof $!=="object"){return false}if(!ef){var ee=eh(el($),8,-1);if(eg(ep,ee)>-1){return ee}if(ee!=="Object"){return false}return ew($)}if(!eu){return null}return e_($)}},306:function($,ee){(function(){"use strict";ee.stripBOM=function($){if($[0]==="\uFEFF"){return $.substring(1)}else{return $}}}).call(this)},4096:function($,ee,et){(function(){"use strict";var $,en,ei,eo,es,eu={}.hasOwnProperty;$=et(9374);en=et(8381).defaults;eo=function($){return typeof $==="string"&&($.indexOf("&")>=0||$.indexOf(">")>=0||$.indexOf("<")>=0)};es=function($){return"<![CDATA["+ei($)+"]]>"};ei=function($){return $.replace("]]>","]]]]><![CDATA[>")};ee.Builder=function(){function ee($){var ee,et,ei;this.options={};et=en["0.2"];for(ee in et){if(!eu.call(et,ee))continue;ei=et[ee];this.options[ee]=ei}for(ee in $){if(!eu.call($,ee))continue;ei=$[ee];this.options[ee]=ei}}ee.prototype.buildObject=function(ee){var et,ei,el,ef,ed;et=this.options.attrkey;ei=this.options.charkey;if(Object.keys(ee).length===1&&this.options.rootName===en["0.2"].rootName){ed=Object.keys(ee)[0];ee=ee[ed]}else{ed=this.options.rootName}el=function($){return function(ee,en){var ef,ed,ep,eh,ey,eg;if(typeof en!=="object"){if($.options.cdata&&eo(en)){ee.raw(es(en))}else{ee.txt(en)}}else if(Array.isArray(en)){for(eh in en){if(!eu.call(en,eh))continue;ed=en[eh];for(ey in ed){ep=ed[ey];ee=el(ee.ele(ey),ep).up()}}}else{for(ey in en){if(!eu.call(en,ey))continue;ed=en[ey];if(ey===et){if(typeof ed==="object"){for(ef in ed){eg=ed[ef];ee=ee.att(ef,eg)}}}else if(ey===ei){if($.options.cdata&&eo(ed)){ee=ee.raw(es(ed))}else{ee=ee.txt(ed)}}else if(Array.isArray(ed)){for(eh in ed){if(!eu.call(ed,eh))continue;ep=ed[eh];if(typeof ep==="string"){if($.options.cdata&&eo(ep)){ee=ee.ele(ey).raw(es(ep)).up()}else{ee=ee.ele(ey,ep).up()}}else{ee=el(ee.ele(ey),ep).up()}}}else if(typeof ed==="object"){ee=el(ee.ele(ey),ed).up()}else{if(typeof ed==="string"&&$.options.cdata&&eo(ed)){ee=ee.ele(ey).raw(es(ed)).up()}else{if(ed==null){ed=""}ee=ee.ele(ey,ed.toString()).up()}}}}return ee}}(this);ef=$.create(ed,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars});return el(ef,ee).end(this.options.renderOpts)};return ee}()}).call(this)},8381:function($,ee){(function(){ee.defaults={"0.1":{explicitCharkey:false,trim:true,normalize:true,normalizeTags:false,attrkey:"@",charkey:"#",explicitArray:false,ignoreAttrs:false,mergeAttrs:false,explicitRoot:false,validator:null,xmlns:false,explicitChildren:false,childkey:"@@",charsAsChildren:false,includeWhiteChars:false,async:false,strict:true,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},"0.2":{explicitCharkey:false,trim:false,normalize:false,normalizeTags:false,attrkey:"$",charkey:"_",explicitArray:true,ignoreAttrs:false,mergeAttrs:false,explicitRoot:true,validator:null,xmlns:false,explicitChildren:false,preserveChildrenOrder:false,childkey:"$$",charsAsChildren:false,includeWhiteChars:false,async:false,strict:true,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{"version":"1.0","encoding":"UTF-8","standalone":true},doctype:null,renderOpts:{"pretty":true,"indent":" ","newline":"\n"},headless:false,chunkSize:1e4,emptyTag:"",cdata:false}}}).call(this)},9082:function($,ee,et){(function(){"use strict";var $,en,ei,eo,es,eu,el,ef,ed,ep=function($,ee){return function(){return $.apply(ee,arguments)}},eh=function($,ee){for(var et in ee){if(ey.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},ey={}.hasOwnProperty;ef=et(6099);eo=et(7187);$=et(306);el=et(7526);ed=et(8441).setImmediate;en=et(8381).defaults;es=function($){return typeof $==="object"&&$!=null&&Object.keys($).length===0};eu=function($,ee,et){var en,ei,eo;for(en=0,ei=$.length;en<ei;en++){eo=$[en];ee=eo(ee,et)}return ee};ei=function($,ee,et){var en;en=Object.create(null);en.value=et;en.writable=true;en.enumerable=true;en.configurable=true;return Object.defineProperty($,ee,en)};ee.Parser=function(et){eh(eo,et);function eo($){this.parseStringPromise=ep(this.parseStringPromise,this);this.parseString=ep(this.parseString,this);this.reset=ep(this.reset,this);this.assignOrPush=ep(this.assignOrPush,this);this.processAsync=ep(this.processAsync,this);var et,ei,eo;if(!(this instanceof ee.Parser)){return new ee.Parser($)}this.options={};ei=en["0.2"];for(et in ei){if(!ey.call(ei,et))continue;eo=ei[et];this.options[et]=eo}for(et in $){if(!ey.call($,et))continue;eo=$[et];this.options[et]=eo}if(this.options.xmlns){this.options.xmlnskey=this.options.attrkey+"ns"}if(this.options.normalizeTags){if(!this.options.tagNameProcessors){this.options.tagNameProcessors=[]}this.options.tagNameProcessors.unshift(el.normalize)}this.reset()}eo.prototype.processAsync=function(){var $,ee;try{if(this.remaining.length<=this.options.chunkSize){$=this.remaining;this.remaining="";this.saxParser=this.saxParser.write($);return this.saxParser.close()}else{$=this.remaining.substr(0,this.options.chunkSize);this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length);this.saxParser=this.saxParser.write($);return ed(this.processAsync)}}catch($){ee=$;if(!this.saxParser.errThrown){this.saxParser.errThrown=true;return this.emit(ee)}}};eo.prototype.assignOrPush=function($,ee,et){if(!(ee in $)){if(!this.options.explicitArray){return ei($,ee,et)}else{return ei($,ee,[et])}}else{if(!($[ee]instanceof Array)){ei($,ee,[$[ee]])}return $[ee].push(et)}};eo.prototype.reset=function(){var $,ee,et,en;this.removeAllListeners();this.saxParser=ef.parser(this.options.strict,{trim:false,normalize:false,xmlns:this.options.xmlns});this.saxParser.errThrown=false;this.saxParser.onerror=function($){return function(ee){$.saxParser.resume();if(!$.saxParser.errThrown){$.saxParser.errThrown=true;return $.emit("error",ee)}}}(this);this.saxParser.onend=function($){return function(){if(!$.saxParser.ended){$.saxParser.ended=true;return $.emit("end",$.resultObject)}}}(this);this.saxParser.ended=false;this.EXPLICIT_CHARKEY=this.options.explicitCharkey;this.resultObject=null;en=[];$=this.options.attrkey;ee=this.options.charkey;this.saxParser.onopentag=function(et){return function(eo){var es,el,ef,ed,ep;ef={};ef[ee]="";if(!et.options.ignoreAttrs){ep=eo.attributes;for(es in ep){if(!ey.call(ep,es))continue;if(!($ in ef)&&!et.options.mergeAttrs){ef[$]={}}el=et.options.attrValueProcessors?eu(et.options.attrValueProcessors,eo.attributes[es],es):eo.attributes[es];ed=et.options.attrNameProcessors?eu(et.options.attrNameProcessors,es):es;if(et.options.mergeAttrs){et.assignOrPush(ef,ed,el)}else{ei(ef[$],ed,el)}}}ef["#name"]=et.options.tagNameProcessors?eu(et.options.tagNameProcessors,eo.name):eo.name;if(et.options.xmlns){ef[et.options.xmlnskey]={uri:eo.uri,local:eo.local}}return en.push(ef)}}(this);this.saxParser.onclosetag=function($){return function(){var et,eo,el,ef,ed,ep,eh,eg,em,e_;ep=en.pop();ed=ep["#name"];if(!$.options.explicitChildren||!$.options.preserveChildrenOrder){delete ep["#name"]}if(ep.cdata===true){et=ep.cdata;delete ep.cdata}em=en[en.length-1];if(ep[ee].match(/^\s*$/)&&!et){eo=ep[ee];delete ep[ee]}else{if($.options.trim){ep[ee]=ep[ee].trim()}if($.options.normalize){ep[ee]=ep[ee].replace(/\s{2,}/g," ").trim()}ep[ee]=$.options.valueProcessors?eu($.options.valueProcessors,ep[ee],ed):ep[ee];if(Object.keys(ep).length===1&&ee in ep&&!$.EXPLICIT_CHARKEY){ep=ep[ee]}}if(es(ep)){if(typeof $.options.emptyTag==="function"){ep=$.options.emptyTag()}else{ep=$.options.emptyTag!==""?$.options.emptyTag:eo}}if($.options.validator!=null){e_="/"+(function(){var $,ee,et;et=[];for($=0,ee=en.length;$<ee;$++){ef=en[$];et.push(ef["#name"])}return et})().concat(ed).join("/");(function(){var ee;try{return ep=$.options.validator(e_,em&&em[ed],ep)}catch(et){ee=et;return $.emit("error",ee)}})()}if($.options.explicitChildren&&!$.options.mergeAttrs&&typeof ep==="object"){if(!$.options.preserveChildrenOrder){ef={};if($.options.attrkey in ep){ef[$.options.attrkey]=ep[$.options.attrkey];delete ep[$.options.attrkey]}if(!$.options.charsAsChildren&&$.options.charkey in ep){ef[$.options.charkey]=ep[$.options.charkey];delete ep[$.options.charkey]}if(Object.getOwnPropertyNames(ep).length>0){ef[$.options.childkey]=ep}ep=ef}else if(em){em[$.options.childkey]=em[$.options.childkey]||[];eh={};for(el in ep){if(!ey.call(ep,el))continue;ei(eh,el,ep[el])}em[$.options.childkey].push(eh);delete ep["#name"];if(Object.keys(ep).length===1&&ee in ep&&!$.EXPLICIT_CHARKEY){ep=ep[ee]}}}if(en.length>0){return $.assignOrPush(em,ed,ep)}else{if($.options.explicitRoot){eg=ep;ep={};ei(ep,ed,eg)}$.resultObject=ep;$.saxParser.ended=true;return $.emit("end",$.resultObject)}}}(this);et=function($){return function(et){var ei,eo;eo=en[en.length-1];if(eo){eo[ee]+=et;if($.options.explicitChildren&&$.options.preserveChildrenOrder&&$.options.charsAsChildren&&($.options.includeWhiteChars||et.replace(/\\n/g,"").trim()!=="")){eo[$.options.childkey]=eo[$.options.childkey]||[];ei={"#name":"__text__"};ei[ee]=et;if($.options.normalize){ei[ee]=ei[ee].replace(/\s{2,}/g," ").trim()}eo[$.options.childkey].push(ei)}return eo}}}(this);this.saxParser.ontext=et;return this.saxParser.oncdata=function($){return function($){var ee;ee=et($);if(ee){return ee.cdata=true}}}(this)};eo.prototype.parseString=function(ee,et){var en;if(et!=null&&typeof et==="function"){this.on("end",function($){this.reset();return et(null,$)});this.on("error",function($){this.reset();return et($)})}try{ee=ee.toString();if(ee.trim()===""){this.emit("end",null);return true}ee=$.stripBOM(ee);if(this.options.async){this.remaining=ee;ed(this.processAsync);return this.saxParser}return this.saxParser.write(ee).close()}catch($){en=$;if(!(this.saxParser.errThrown||this.saxParser.ended)){this.emit("error",en);return this.saxParser.errThrown=true}else if(this.saxParser.ended){throw en}}};eo.prototype.parseStringPromise=function($){return new Promise(function(ee){return function(et,en){return ee.parseString($,function($,ee){if($){return en($)}else{return et(ee)}})}}(this))};return eo}(eo);ee.parseString=function($,et,en){var ei,eo,es;if(en!=null){if(typeof en==="function"){ei=en}if(typeof et==="object"){eo=et}}else{if(typeof et==="function"){ei=et}eo={}}es=new ee.Parser(eo);return es.parseString($,ei)};ee.parseStringPromise=function($,et){var en,ei;if(typeof et==="object"){en=et}ei=new ee.Parser(en);return ei.parseStringPromise($)}}).call(this)},7526:function($,ee){(function(){"use strict";var $;$=new RegExp(/(?!xmlns)^.*:/);ee.normalize=function($){return $.toLowerCase()};ee.firstCharLowerCase=function($){return $.charAt(0).toLowerCase()+$.slice(1)};ee.stripPrefix=function(ee){return ee.replace($,"")};ee.parseNumbers=function($){if(!isNaN($)){$=$%1===0?parseInt($,10):parseFloat($)}return $};ee.parseBooleans=function($){if(/^(?:true|false)$/i.test($)){$=$.toLowerCase()==="true"}return $}}).call(this)},5055:function($,ee,et){(function(){"use strict";var $,en,ei,eo,es=function($,ee){for(var et in ee){if(eu.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},eu={}.hasOwnProperty;en=et(8381);$=et(4096);ei=et(9082);eo=et(7526);ee.defaults=en.defaults;ee.processors=eo;ee.ValidationError=function($){es(ee,$);function ee($){this.message=$}return ee}(Error);ee.Builder=$.Builder;ee.Parser=ei.Parser;ee.parseString=ei.parseString;ee.parseStringPromise=ei.parseStringPromise}).call(this)},8154:function($){(function(){$.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(this)},8745:function($){(function(){$.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}).call(this)},8676:function($){(function(){var ee,et,en,ei,eo,es,eu,el=[].slice,ef={}.hasOwnProperty;ee=function(){var $,ee,et,en,ei,es;es=arguments[0],ei=2<=arguments.length?el.call(arguments,1):[];if(eo(Object.assign)){Object.assign.apply(null,arguments)}else{for($=0,et=ei.length;$<et;$++){en=ei[$];if(en!=null){for(ee in en){if(!ef.call(en,ee))continue;es[ee]=en[ee]}}}}return es};eo=function($){return!!$&&Object.prototype.toString.call($)==="[object Function]"};es=function($){var ee;return!!$&&((ee=typeof $)==="function"||ee==="object")};en=function($){if(eo(Array.isArray)){return Array.isArray($)}else{return Object.prototype.toString.call($)==="[object Array]"}};ei=function($){var ee;if(en($)){return!$.length}else{for(ee in $){if(!ef.call($,ee))continue;return false}return true}};eu=function($){var ee,et;return es($)&&(et=Object.getPrototypeOf($))&&(ee=et.constructor)&&typeof ee==="function"&&ee instanceof ee&&Function.prototype.toString.call(ee)===Function.prototype.toString.call(Object)};et=function($){if(eo($.valueOf)){return $.valueOf()}else{return $}};$.exports.assign=ee;$.exports.isFunction=eo;$.exports.isObject=es;$.exports.isArray=en;$.exports.isEmpty=ei;$.exports.isPlainObject=eu;$.exports.getValue=et}).call(this)},6530:function($){(function(){$.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(this)},7490:function($,ee,et){(function(){var ee,en,ei;ee=et(8745);ei=et(630);$.exports=en=function(){function $($,et,en){this.parent=$;if(this.parent){this.options=this.parent.options;this.stringify=this.parent.stringify}if(et==null){throw new Error("Missing attribute name. "+this.debugInfo(et))}this.name=this.stringify.name(et);this.value=this.stringify.attValue(en);this.type=ee.Attribute;this.isId=false;this.schemaTypeInfo=null}Object.defineProperty($.prototype,"nodeType",{get:function(){return this.type}});Object.defineProperty($.prototype,"ownerElement",{get:function(){return this.parent}});Object.defineProperty($.prototype,"textContent",{get:function(){return this.value},set:function($){return this.value=$||""}});Object.defineProperty($.prototype,"namespaceURI",{get:function(){return""}});Object.defineProperty($.prototype,"prefix",{get:function(){return""}});Object.defineProperty($.prototype,"localName",{get:function(){return this.name}});Object.defineProperty($.prototype,"specified",{get:function(){return true}});$.prototype.clone=function(){return Object.create(this)};$.prototype.toString=function($){return this.options.writer.attribute(this,this.options.writer.filterOptions($))};$.prototype.debugInfo=function($){$=$||this.name;if($==null){return"parent: <"+this.parent.name+">"}else{return"attribute: {"+$+"}, parent: <"+this.parent.name+">"}};$.prototype.isEqualNode=function($){if($.namespaceURI!==this.namespaceURI){return false}if($.prefix!==this.prefix){return false}if($.localName!==this.localName){return false}if($.value!==this.value){return false}return true};return $}()}).call(this)},9877:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ee=et(8745);ei=et(4356);$.exports=en=function($){eo(et,$);function et($,en){et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing CDATA text. "+this.debugInfo())}this.name="#cdata-section";this.type=ee.CData;this.value=this.stringify.cdata(en)}et.prototype.clone=function(){return Object.create(this)};et.prototype.toString=function($){return this.options.writer.cdata(this,this.options.writer.filterOptions($))};return et}(ei)}).call(this)},4356:function($,ee,et){(function(){var ee,en,ei=function($,ee){for(var et in ee){if(eo.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},eo={}.hasOwnProperty;en=et(630);$.exports=ee=function($){ei(ee,$);function ee($){ee.__super__.constructor.call(this,$);this.value=""}Object.defineProperty(ee.prototype,"data",{get:function(){return this.value},set:function($){return this.value=$||""}});Object.defineProperty(ee.prototype,"length",{get:function(){return this.value.length}});Object.defineProperty(ee.prototype,"textContent",{get:function(){return this.value},set:function($){return this.value=$||""}});ee.prototype.clone=function(){return Object.create(this)};ee.prototype.substringData=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};ee.prototype.appendData=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};ee.prototype.insertData=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};ee.prototype.deleteData=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};ee.prototype.replaceData=function($,ee,et){throw new Error("This DOM method is not implemented."+this.debugInfo())};ee.prototype.isEqualNode=function($){if(!ee.__super__.isEqualNode.apply(this,arguments).isEqualNode($)){return false}if($.data!==this.data){return false}return true};return ee}(en)}).call(this)},2374:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ee=et(8745);en=et(4356);$.exports=ei=function($){eo(et,$);function et($,en){et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing comment text. "+this.debugInfo())}this.name="#comment";this.type=ee.Comment;this.value=this.stringify.comment(en)}et.prototype.clone=function(){return Object.create(this)};et.prototype.toString=function($){return this.options.writer.comment(this,this.options.writer.filterOptions($))};return et}(en)}).call(this)},1829:function($,ee,et){(function(){var ee,en,ei;en=et(7885);ei=et(4929);$.exports=ee=function(){function $(){var $;this.defaultParams={"canonical-form":false,"cdata-sections":false,"comments":false,"datatype-normalization":false,"element-content-whitespace":true,"entities":true,"error-handler":new en,"infoset":true,"validate-if-schema":false,"namespaces":true,"namespace-declarations":true,"normalize-characters":false,"schema-location":"","schema-type":"","split-cdata-sections":true,"validate":false,"well-formed":true};this.params=$=Object.create(this.defaultParams)}Object.defineProperty($.prototype,"parameterNames",{get:function(){return new ei(Object.keys(this.defaultParams))}});$.prototype.getParameter=function($){if(this.params.hasOwnProperty($)){return this.params[$]}else{return null}};$.prototype.canSetParameter=function($,ee){return true};$.prototype.setParameter=function($,ee){if(ee!=null){return this.params[$]=ee}else{return delete this.params[$]}};return $}()}).call(this)},7885:function($){(function(){var ee;$.exports=ee=function(){function $(){}$.prototype.handleError=function($){throw new Error($)};return $}()}).call(this)},4016:function($){(function(){var ee;$.exports=ee=function(){function $(){}$.prototype.hasFeature=function($,ee){return true};$.prototype.createDocumentType=function($,ee,et){throw new Error("This DOM method is not implemented.")};$.prototype.createDocument=function($,ee,et){throw new Error("This DOM method is not implemented.")};$.prototype.createHTMLDocument=function($){throw new Error("This DOM method is not implemented.")};$.prototype.getFeature=function($,ee){throw new Error("This DOM method is not implemented.")};return $}()}).call(this)},4929:function($){(function(){var ee;$.exports=ee=function(){function $($){this.arr=$||[]}Object.defineProperty($.prototype,"length",{get:function(){return this.arr.length}});$.prototype.item=function($){return this.arr[$]||null};$.prototype.contains=function($){return this.arr.indexOf($)!==-1};return $}()}).call(this)},4131:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ei=et(630);ee=et(8745);$.exports=en=function($){eo(et,$);function et($,en,ei,eo,es,eu){et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing DTD element name. "+this.debugInfo())}if(ei==null){throw new Error("Missing DTD attribute name. "+this.debugInfo(en))}if(!eo){throw new Error("Missing DTD attribute type. "+this.debugInfo(en))}if(!es){throw new Error("Missing DTD attribute default. "+this.debugInfo(en))}if(es.indexOf("#")!==0){es="#"+es}if(!es.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)){throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(en))}if(eu&&!es.match(/^(#FIXED|#DEFAULT)$/)){throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(en))}this.elementName=this.stringify.name(en);this.type=ee.AttributeDeclaration;this.attributeName=this.stringify.name(ei);this.attributeType=this.stringify.dtdAttType(eo);if(eu){this.defaultValue=this.stringify.dtdAttDefault(eu)}this.defaultValueType=es}et.prototype.toString=function($){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions($))};return et}(ei)}).call(this)},7338:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ei=et(630);ee=et(8745);$.exports=en=function($){eo(et,$);function et($,en,ei){et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing DTD element name. "+this.debugInfo())}if(!ei){ei="(#PCDATA)"}if(Array.isArray(ei)){ei="("+ei.join(",")+")"}this.name=this.stringify.name(en);this.type=ee.ElementDeclaration;this.value=this.stringify.dtdElementValue(ei)}et.prototype.toString=function($){return this.options.writer.dtdElement(this,this.options.writer.filterOptions($))};return et}(ei)}).call(this)},7834:function($,ee,et){(function(){var ee,en,ei,eo,es=function($,ee){for(var et in ee){if(eu.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},eu={}.hasOwnProperty;eo=et(8676).isObject;ei=et(630);ee=et(8745);$.exports=en=function($){es(et,$);function et($,en,ei,es){et.__super__.constructor.call(this,$);if(ei==null){throw new Error("Missing DTD entity name. "+this.debugInfo(ei))}if(es==null){throw new Error("Missing DTD entity value. "+this.debugInfo(ei))}this.pe=!!en;this.name=this.stringify.name(ei);this.type=ee.EntityDeclaration;if(!eo(es)){this.value=this.stringify.dtdEntityValue(es);this.internal=true}else{if(!es.pubID&&!es.sysID){throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(ei))}if(es.pubID&&!es.sysID){throw new Error("System identifier is required for a public external entity. "+this.debugInfo(ei))}this.internal=false;if(es.pubID!=null){this.pubID=this.stringify.dtdPubID(es.pubID)}if(es.sysID!=null){this.sysID=this.stringify.dtdSysID(es.sysID)}if(es.nData!=null){this.nData=this.stringify.dtdNData(es.nData)}if(this.pe&&this.nData){throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(ei))}}}Object.defineProperty(et.prototype,"publicId",{get:function(){return this.pubID}});Object.defineProperty(et.prototype,"systemId",{get:function(){return this.sysID}});Object.defineProperty(et.prototype,"notationName",{get:function(){return this.nData||null}});Object.defineProperty(et.prototype,"inputEncoding",{get:function(){return null}});Object.defineProperty(et.prototype,"xmlEncoding",{get:function(){return null}});Object.defineProperty(et.prototype,"xmlVersion",{get:function(){return null}});et.prototype.toString=function($){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions($))};return et}(ei)}).call(this)},8507:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ei=et(630);ee=et(8745);$.exports=en=function($){eo(et,$);function et($,en,ei){et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing DTD notation name. "+this.debugInfo(en))}if(!ei.pubID&&!ei.sysID){throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(en))}this.name=this.stringify.name(en);this.type=ee.NotationDeclaration;if(ei.pubID!=null){this.pubID=this.stringify.dtdPubID(ei.pubID)}if(ei.sysID!=null){this.sysID=this.stringify.dtdSysID(ei.sysID)}}Object.defineProperty(et.prototype,"publicId",{get:function(){return this.pubID}});Object.defineProperty(et.prototype,"systemId",{get:function(){return this.sysID}});et.prototype.toString=function($){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions($))};return et}(ei)}).call(this)},2308:function($,ee,et){(function(){var ee,en,ei,eo,es=function($,ee){for(var et in ee){if(eu.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},eu={}.hasOwnProperty;eo=et(8676).isObject;ei=et(630);ee=et(8745);$.exports=en=function($){es(et,$);function et($,en,ei,es){var eu;et.__super__.constructor.call(this,$);if(eo(en)){eu=en,en=eu.version,ei=eu.encoding,es=eu.standalone}if(!en){en="1.0"}this.type=ee.Declaration;this.version=this.stringify.xmlVersion(en);if(ei!=null){this.encoding=this.stringify.xmlEncoding(ei)}if(es!=null){this.standalone=this.stringify.xmlStandalone(es)}}et.prototype.toString=function($){return this.options.writer.declaration(this,this.options.writer.filterOptions($))};return et}(ei)}).call(this)},6808:function($,ee,et){(function(){var ee,en,ei,eo,es,eu,el,ef,ed,ep=function($,ee){for(var et in ee){if(eh.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},eh={}.hasOwnProperty;ed=et(8676).isObject;ef=et(630);ee=et(8745);en=et(4131);eo=et(7834);ei=et(7338);es=et(8507);el=et(9538);$.exports=eu=function($){ep(et,$);function et($,en,ei){var eo,es,eu,el,ef,ep;et.__super__.constructor.call(this,$);this.type=ee.DocType;if($.children){el=$.children;for(es=0,eu=el.length;es<eu;es++){eo=el[es];if(eo.type===ee.Element){this.name=eo.name;break}}}this.documentObject=$;if(ed(en)){ef=en,en=ef.pubID,ei=ef.sysID}if(ei==null){ep=[en,ei],ei=ep[0],en=ep[1]}if(en!=null){this.pubID=this.stringify.dtdPubID(en)}if(ei!=null){this.sysID=this.stringify.dtdSysID(ei)}}Object.defineProperty(et.prototype,"entities",{get:function(){var $,et,en,ei,eo;ei={};eo=this.children;for(et=0,en=eo.length;et<en;et++){$=eo[et];if($.type===ee.EntityDeclaration&&!$.pe){ei[$.name]=$}}return new el(ei)}});Object.defineProperty(et.prototype,"notations",{get:function(){var $,et,en,ei,eo;ei={};eo=this.children;for(et=0,en=eo.length;et<en;et++){$=eo[et];if($.type===ee.NotationDeclaration){ei[$.name]=$}}return new el(ei)}});Object.defineProperty(et.prototype,"publicId",{get:function(){return this.pubID}});Object.defineProperty(et.prototype,"systemId",{get:function(){return this.sysID}});Object.defineProperty(et.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}});et.prototype.element=function($,ee){var et;et=new ei(this,$,ee);this.children.push(et);return this};et.prototype.attList=function($,ee,et,ei,eo){var es;es=new en(this,$,ee,et,ei,eo);this.children.push(es);return this};et.prototype.entity=function($,ee){var et;et=new eo(this,false,$,ee);this.children.push(et);return this};et.prototype.pEntity=function($,ee){var et;et=new eo(this,true,$,ee);this.children.push(et);return this};et.prototype.notation=function($,ee){var et;et=new es(this,$,ee);this.children.push(et);return this};et.prototype.toString=function($){return this.options.writer.docType(this,this.options.writer.filterOptions($))};et.prototype.ele=function($,ee){return this.element($,ee)};et.prototype.att=function($,ee,et,en,ei){return this.attList($,ee,et,en,ei)};et.prototype.ent=function($,ee){return this.entity($,ee)};et.prototype.pent=function($,ee){return this.pEntity($,ee)};et.prototype.not=function($,ee){return this.notation($,ee)};et.prototype.up=function(){return this.root()||this.documentObject};et.prototype.isEqualNode=function($){if(!et.__super__.isEqualNode.apply(this,arguments).isEqualNode($)){return false}if($.name!==this.name){return false}if($.publicId!==this.publicId){return false}if($.systemId!==this.systemId){return false}return true};return et}(ef)}).call(this)},1888:function($,ee,et){(function(){var ee,en,ei,eo,es,eu,el,ef,ed=function($,ee){for(var et in ee){if(ep.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},ep={}.hasOwnProperty;ef=et(8676).isPlainObject;ei=et(4016);en=et(1829);es=et(630);ee=et(8745);el=et(8365);eu=et(1663);$.exports=eo=function($){ed(et,$);function et($){et.__super__.constructor.call(this,null);this.name="#document";this.type=ee.Document;this.documentURI=null;this.domConfig=new en;$||($={});if(!$.writer){$.writer=new eu}this.options=$;this.stringify=new el($)}Object.defineProperty(et.prototype,"implementation",{value:new ei});Object.defineProperty(et.prototype,"doctype",{get:function(){var $,et,en,ei;ei=this.children;for(et=0,en=ei.length;et<en;et++){$=ei[et];if($.type===ee.DocType){return $}}return null}});Object.defineProperty(et.prototype,"documentElement",{get:function(){return this.rootObject||null}});Object.defineProperty(et.prototype,"inputEncoding",{get:function(){return null}});Object.defineProperty(et.prototype,"strictErrorChecking",{get:function(){return false}});Object.defineProperty(et.prototype,"xmlEncoding",{get:function(){if(this.children.length!==0&&this.children[0].type===ee.Declaration){return this.children[0].encoding}else{return null}}});Object.defineProperty(et.prototype,"xmlStandalone",{get:function(){if(this.children.length!==0&&this.children[0].type===ee.Declaration){return this.children[0].standalone==="yes"}else{return false}}});Object.defineProperty(et.prototype,"xmlVersion",{get:function(){if(this.children.length!==0&&this.children[0].type===ee.Declaration){return this.children[0].version}else{return"1.0"}}});Object.defineProperty(et.prototype,"URL",{get:function(){return this.documentURI}});Object.defineProperty(et.prototype,"origin",{get:function(){return null}});Object.defineProperty(et.prototype,"compatMode",{get:function(){return null}});Object.defineProperty(et.prototype,"characterSet",{get:function(){return null}});Object.defineProperty(et.prototype,"contentType",{get:function(){return null}});et.prototype.end=function($){var ee;ee={};if(!$){$=this.options.writer}else if(ef($)){ee=$;$=this.options.writer}return $.document(this,$.filterOptions(ee))};et.prototype.toString=function($){return this.options.writer.document(this,this.options.writer.filterOptions($))};et.prototype.createElement=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createTextNode=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createComment=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createCDATASection=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createProcessingInstruction=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createAttribute=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createEntityReference=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementsByTagName=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.importNode=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createElementNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createAttributeNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementsByTagNameNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementById=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.adoptNode=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.renameNode=function($,ee,et){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementsByClassName=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createEvent=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createNodeIterator=function($,ee,et){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.createTreeWalker=function($,ee,et){throw new Error("This DOM method is not implemented."+this.debugInfo())};return et}(es)}).call(this)},2621:function($,ee,et){(function(){var ee,en,ei,eo,es,eu,el,ef,ed,ep,eh,ey,eg,em,e_,ew,eE,eS,eT,eO,eA,eI,eN,eD,eR={}.hasOwnProperty;eD=et(8676),eI=eD.isObject,eA=eD.isFunction,eN=eD.isPlainObject,eO=eD.getValue;ee=et(8745);ey=et(1888);em=et(5725);eo=et(9877);es=et(2374);ew=et(7641);eT=et(4306);e_=et(3402);ep=et(2308);eh=et(6808);eu=et(4131);ef=et(7834);el=et(7338);ed=et(8507);ei=et(7490);eS=et(8365);eE=et(1663);en=et(6530);$.exports=eg=function(){function $($,et,en){var ei;this.name="?xml";this.type=ee.Document;$||($={});ei={};if(!$.writer){$.writer=new eE}else if(eN($.writer)){ei=$.writer;$.writer=new eE}this.options=$;this.writer=$.writer;this.writerOptions=this.writer.filterOptions(ei);this.stringify=new eS($);this.onDataCallback=et||function(){};this.onEndCallback=en||function(){};this.currentNode=null;this.currentLevel=-1;this.openTags={};this.documentStarted=false;this.documentCompleted=false;this.root=null}$.prototype.createChildNode=function($){var et,en,ei,eo,es,eu,el,ef;switch($.type){case ee.CData:this.cdata($.value);break;case ee.Comment:this.comment($.value);break;case ee.Element:ei={};el=$.attribs;for(en in el){if(!eR.call(el,en))continue;et=el[en];ei[en]=et.value}this.node($.name,ei);break;case ee.Dummy:this.dummy();break;case ee.Raw:this.raw($.value);break;case ee.Text:this.text($.value);break;case ee.ProcessingInstruction:this.instruction($.target,$.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+$.constructor.name)}ef=$.children;for(es=0,eu=ef.length;es<eu;es++){eo=ef[es];this.createChildNode(eo);if(eo.type===ee.Element){this.up()}}return this};$.prototype.dummy=function(){return this};$.prototype.node=function($,ee,et){var en;if($==null){throw new Error("Missing node name.")}if(this.root&&this.currentLevel===-1){throw new Error("Document can only have one root node. "+this.debugInfo($))}this.openCurrent();$=eO($);if(ee==null){ee={}}ee=eO(ee);if(!eI(ee)){en=[ee,et],et=en[0],ee=en[1]}this.currentNode=new em(this,$,ee);this.currentNode.children=false;this.currentLevel++;this.openTags[this.currentLevel]=this.currentNode;if(et!=null){this.text(et)}return this};$.prototype.element=function($,et,en){var ei,eo,es,eu,el,ef;if(this.currentNode&&this.currentNode.type===ee.DocType){this.dtdElement.apply(this,arguments)}else{if(Array.isArray($)||eI($)||eA($)){eu=this.options.noValidation;this.options.noValidation=true;ef=new ey(this.options).element("TEMP_ROOT");ef.element($);this.options.noValidation=eu;el=ef.children;for(eo=0,es=el.length;eo<es;eo++){ei=el[eo];this.createChildNode(ei);if(ei.type===ee.Element){this.up()}}}else{this.node($,et,en)}}return this};$.prototype.attribute=function($,ee){var et,en;if(!this.currentNode||this.currentNode.children){throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo($))}if($!=null){$=eO($)}if(eI($)){for(et in $){if(!eR.call($,et))continue;en=$[et];this.attribute(et,en)}}else{if(eA(ee)){ee=ee.apply()}if(this.options.keepNullAttributes&&ee==null){this.currentNode.attribs[$]=new ei(this,$,"")}else if(ee!=null){this.currentNode.attribs[$]=new ei(this,$,ee)}}return this};$.prototype.text=function($){var ee;this.openCurrent();ee=new eT(this,$);this.onData(this.writer.text(ee,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.cdata=function($){var ee;this.openCurrent();ee=new eo(this,$);this.onData(this.writer.cdata(ee,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.comment=function($){var ee;this.openCurrent();ee=new es(this,$);this.onData(this.writer.comment(ee,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.raw=function($){var ee;this.openCurrent();ee=new ew(this,$);this.onData(this.writer.raw(ee,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.instruction=function($,ee){var et,en,ei,eo,es;this.openCurrent();if($!=null){$=eO($)}if(ee!=null){ee=eO(ee)}if(Array.isArray($)){for(et=0,eo=$.length;et<eo;et++){en=$[et];this.instruction(en)}}else if(eI($)){for(en in $){if(!eR.call($,en))continue;ei=$[en];this.instruction(en,ei)}}else{if(eA(ee)){ee=ee.apply()}es=new e_(this,$,ee);this.onData(this.writer.processingInstruction(es,this.writerOptions,this.currentLevel+1),this.currentLevel+1)}return this};$.prototype.declaration=function($,ee,et){var en;this.openCurrent();if(this.documentStarted){throw new Error("declaration() must be the first node.")}en=new ep(this,$,ee,et);this.onData(this.writer.declaration(en,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.doctype=function($,ee,et){this.openCurrent();if($==null){throw new Error("Missing root node name.")}if(this.root){throw new Error("dtd() must come before the root node.")}this.currentNode=new eh(this,ee,et);this.currentNode.rootNodeName=$;this.currentNode.children=false;this.currentLevel++;this.openTags[this.currentLevel]=this.currentNode;return this};$.prototype.dtdElement=function($,ee){var et;this.openCurrent();et=new el(this,$,ee);this.onData(this.writer.dtdElement(et,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.attList=function($,ee,et,en,ei){var eo;this.openCurrent();eo=new eu(this,$,ee,et,en,ei);this.onData(this.writer.dtdAttList(eo,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.entity=function($,ee){var et;this.openCurrent();et=new ef(this,false,$,ee);this.onData(this.writer.dtdEntity(et,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.pEntity=function($,ee){var et;this.openCurrent();et=new ef(this,true,$,ee);this.onData(this.writer.dtdEntity(et,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.notation=function($,ee){var et;this.openCurrent();et=new ed(this,$,ee);this.onData(this.writer.dtdNotation(et,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this};$.prototype.up=function(){if(this.currentLevel<0){throw new Error("The document node has no parent.")}if(this.currentNode){if(this.currentNode.children){this.closeNode(this.currentNode)}else{this.openNode(this.currentNode)}this.currentNode=null}else{this.closeNode(this.openTags[this.currentLevel])}delete this.openTags[this.currentLevel];this.currentLevel--;return this};$.prototype.end=function(){while(this.currentLevel>=0){this.up()}return this.onEnd()};$.prototype.openCurrent=function(){if(this.currentNode){this.currentNode.children=true;return this.openNode(this.currentNode)}};$.prototype.openNode=function($){var et,ei,eo,es;if(!$.isOpen){if(!this.root&&this.currentLevel===0&&$.type===ee.Element){this.root=$}ei="";if($.type===ee.Element){this.writerOptions.state=en.OpenTag;ei=this.writer.indent($,this.writerOptions,this.currentLevel)+"<"+$.name;es=$.attribs;for(eo in es){if(!eR.call(es,eo))continue;et=es[eo];ei+=this.writer.attribute(et,this.writerOptions,this.currentLevel)}ei+=($.children?">":"/>")+this.writer.endline($,this.writerOptions,this.currentLevel);this.writerOptions.state=en.InsideTag}else{this.writerOptions.state=en.OpenTag;ei=this.writer.indent($,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+$.rootNodeName;if($.pubID&&$.sysID){ei+=' PUBLIC "'+$.pubID+'" "'+$.sysID+'"'}else if($.sysID){ei+=' SYSTEM "'+$.sysID+'"'}if($.children){ei+=" [";this.writerOptions.state=en.InsideTag}else{this.writerOptions.state=en.CloseTag;ei+=">"}ei+=this.writer.endline($,this.writerOptions,this.currentLevel)}this.onData(ei,this.currentLevel);return $.isOpen=true}};$.prototype.closeNode=function($){var et;if(!$.isClosed){et="";this.writerOptions.state=en.CloseTag;if($.type===ee.Element){et=this.writer.indent($,this.writerOptions,this.currentLevel)+"</"+$.name+">"+this.writer.endline($,this.writerOptions,this.currentLevel)}else{et=this.writer.indent($,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline($,this.writerOptions,this.currentLevel)}this.writerOptions.state=en.None;this.onData(et,this.currentLevel);return $.isClosed=true}};$.prototype.onData=function($,ee){this.documentStarted=true;return this.onDataCallback($,ee+1)};$.prototype.onEnd=function(){this.documentCompleted=true;return this.onEndCallback()};$.prototype.debugInfo=function($){if($==null){return""}else{return"node: <"+$+">"}};$.prototype.ele=function(){return this.element.apply(this,arguments)};$.prototype.nod=function($,ee,et){return this.node($,ee,et)};$.prototype.txt=function($){return this.text($)};$.prototype.dat=function($){return this.cdata($)};$.prototype.com=function($){return this.comment($)};$.prototype.ins=function($,ee){return this.instruction($,ee)};$.prototype.dec=function($,ee,et){return this.declaration($,ee,et)};$.prototype.dtd=function($,ee,et){return this.doctype($,ee,et)};$.prototype.e=function($,ee,et){return this.element($,ee,et)};$.prototype.n=function($,ee,et){return this.node($,ee,et)};$.prototype.t=function($){return this.text($)};$.prototype.d=function($){return this.cdata($)};$.prototype.c=function($){return this.comment($)};$.prototype.r=function($){return this.raw($)};$.prototype.i=function($,ee){return this.instruction($,ee)};$.prototype.att=function(){if(this.currentNode&&this.currentNode.type===ee.DocType){return this.attList.apply(this,arguments)}else{return this.attribute.apply(this,arguments)}};$.prototype.a=function(){if(this.currentNode&&this.currentNode.type===ee.DocType){return this.attList.apply(this,arguments)}else{return this.attribute.apply(this,arguments)}};$.prototype.ent=function($,ee){return this.entity($,ee)};$.prototype.pent=function($,ee){return this.pEntity($,ee)};$.prototype.not=function($,ee){return this.notation($,ee)};return $}()}).call(this)},4402:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ei=et(630);ee=et(8745);$.exports=en=function($){eo(et,$);function et($){et.__super__.constructor.call(this,$);this.type=ee.Dummy}et.prototype.clone=function(){return Object.create(this)};et.prototype.toString=function($){return""};return et}(ei)}).call(this)},5725:function($,ee,et){(function(){var ee,en,ei,eo,es,eu,el,ef,ed,ep=function($,ee){for(var et in ee){if(eh.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},eh={}.hasOwnProperty;ed=et(8676),ef=ed.isObject,el=ed.isFunction,eu=ed.getValue;es=et(630);ee=et(8745);en=et(7490);eo=et(9538);$.exports=ei=function($){ep(et,$);function et($,en,ei){var eo,es,eu,el;et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing element name. "+this.debugInfo())}this.name=this.stringify.name(en);this.type=ee.Element;this.attribs={};this.schemaTypeInfo=null;if(ei!=null){this.attribute(ei)}if($.type===ee.Document){this.isRoot=true;this.documentObject=$;$.rootObject=this;if($.children){el=$.children;for(es=0,eu=el.length;es<eu;es++){eo=el[es];if(eo.type===ee.DocType){eo.name=this.name;break}}}}}Object.defineProperty(et.prototype,"tagName",{get:function(){return this.name}});Object.defineProperty(et.prototype,"namespaceURI",{get:function(){return""}});Object.defineProperty(et.prototype,"prefix",{get:function(){return""}});Object.defineProperty(et.prototype,"localName",{get:function(){return this.name}});Object.defineProperty(et.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}});Object.defineProperty(et.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}});Object.defineProperty(et.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}});Object.defineProperty(et.prototype,"attributes",{get:function(){if(!this.attributeMap||!this.attributeMap.nodes){this.attributeMap=new eo(this.attribs)}return this.attributeMap}});et.prototype.clone=function(){var $,ee,et,en;et=Object.create(this);if(et.isRoot){et.documentObject=null}et.attribs={};en=this.attribs;for(ee in en){if(!eh.call(en,ee))continue;$=en[ee];et.attribs[ee]=$.clone()}et.children=[];this.children.forEach(function($){var ee;ee=$.clone();ee.parent=et;return et.children.push(ee)});return et};et.prototype.attribute=function($,ee){var et,ei;if($!=null){$=eu($)}if(ef($)){for(et in $){if(!eh.call($,et))continue;ei=$[et];this.attribute(et,ei)}}else{if(el(ee)){ee=ee.apply()}if(this.options.keepNullAttributes&&ee==null){this.attribs[$]=new en(this,$,"")}else if(ee!=null){this.attribs[$]=new en(this,$,ee)}}return this};et.prototype.removeAttribute=function($){var ee,et,en;if($==null){throw new Error("Missing attribute name. "+this.debugInfo())}$=eu($);if(Array.isArray($)){for(et=0,en=$.length;et<en;et++){ee=$[et];delete this.attribs[ee]}}else{delete this.attribs[$]}return this};et.prototype.toString=function($){return this.options.writer.element(this,this.options.writer.filterOptions($))};et.prototype.att=function($,ee){return this.attribute($,ee)};et.prototype.a=function($,ee){return this.attribute($,ee)};et.prototype.getAttribute=function($){if(this.attribs.hasOwnProperty($)){return this.attribs[$].value}else{return null}};et.prototype.setAttribute=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getAttributeNode=function($){if(this.attribs.hasOwnProperty($)){return this.attribs[$]}else{return null}};et.prototype.setAttributeNode=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.removeAttributeNode=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementsByTagName=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getAttributeNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.setAttributeNS=function($,ee,et){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.removeAttributeNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getAttributeNodeNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.setAttributeNodeNS=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementsByTagNameNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.hasAttribute=function($){return this.attribs.hasOwnProperty($)};et.prototype.hasAttributeNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.setIdAttribute=function($,ee){if(this.attribs.hasOwnProperty($)){return this.attribs[$].isId}else{return ee}};et.prototype.setIdAttributeNS=function($,ee,et){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.setIdAttributeNode=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementsByTagName=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementsByTagNameNS=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.getElementsByClassName=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.isEqualNode=function($){var ee,en,ei;if(!et.__super__.isEqualNode.apply(this,arguments).isEqualNode($)){return false}if($.namespaceURI!==this.namespaceURI){return false}if($.prefix!==this.prefix){return false}if($.localName!==this.localName){return false}if($.attribs.length!==this.attribs.length){return false}for(ee=en=0,ei=this.attribs.length-1;0<=ei?en<=ei:en>=ei;ee=0<=ei?++en:--en){if(!this.attribs[ee].isEqualNode($.attribs[ee])){return false}}return true};return et}(es)}).call(this)},9538:function($){(function(){var ee;$.exports=ee=function(){function $($){this.nodes=$}Object.defineProperty($.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}});$.prototype.clone=function(){return this.nodes=null};$.prototype.getNamedItem=function($){return this.nodes[$]};$.prototype.setNamedItem=function($){var ee;ee=this.nodes[$.nodeName];this.nodes[$.nodeName]=$;return ee||null};$.prototype.removeNamedItem=function($){var ee;ee=this.nodes[$];delete this.nodes[$];return ee||null};$.prototype.item=function($){return this.nodes[Object.keys(this.nodes)[$]]||null};$.prototype.getNamedItemNS=function($,ee){throw new Error("This DOM method is not implemented.")};$.prototype.setNamedItemNS=function($){throw new Error("This DOM method is not implemented.")};$.prototype.removeNamedItemNS=function($,ee){throw new Error("This DOM method is not implemented.")};return $}()}).call(this)},630:function($,ee,et){(function(){var ee,en,ei,eo,es,eu,el,ef,ed,ep,eh,ey,eg,em,e_,ew,eE,eS,eT,eO={}.hasOwnProperty;eT=et(8676),eS=eT.isObject,eE=eT.isFunction,ew=eT.isEmpty,e_=eT.getValue;ef=null;ei=null;eo=null;es=null;eu=null;eg=null;em=null;ey=null;el=null;en=null;eh=null;ed=null;ee=null;$.exports=ep=function(){function $($){this.parent=$;if(this.parent){this.options=this.parent.options;this.stringify=this.parent.stringify}this.value=null;this.children=[];this.baseURI=null;if(!ef){ef=et(5725);ei=et(9877);eo=et(2374);es=et(2308);eu=et(6808);eg=et(7641);em=et(4306);ey=et(3402);el=et(4402);en=et(8745);eh=et(3220);ed=et(9538);ee=et(8154)}}Object.defineProperty($.prototype,"nodeName",{get:function(){return this.name}});Object.defineProperty($.prototype,"nodeType",{get:function(){return this.type}});Object.defineProperty($.prototype,"nodeValue",{get:function(){return this.value}});Object.defineProperty($.prototype,"parentNode",{get:function(){return this.parent}});Object.defineProperty($.prototype,"childNodes",{get:function(){if(!this.childNodeList||!this.childNodeList.nodes){this.childNodeList=new eh(this.children)}return this.childNodeList}});Object.defineProperty($.prototype,"firstChild",{get:function(){return this.children[0]||null}});Object.defineProperty($.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}});Object.defineProperty($.prototype,"previousSibling",{get:function(){var $;$=this.parent.children.indexOf(this);return this.parent.children[$-1]||null}});Object.defineProperty($.prototype,"nextSibling",{get:function(){var $;$=this.parent.children.indexOf(this);return this.parent.children[$+1]||null}});Object.defineProperty($.prototype,"ownerDocument",{get:function(){return this.document()||null}});Object.defineProperty($.prototype,"textContent",{get:function(){var $,ee,et,ei,eo;if(this.nodeType===en.Element||this.nodeType===en.DocumentFragment){eo="";ei=this.children;for(ee=0,et=ei.length;ee<et;ee++){$=ei[ee];if($.textContent){eo+=$.textContent}}return eo}else{return null}},set:function($){throw new Error("This DOM method is not implemented."+this.debugInfo())}});$.prototype.setParent=function($){var ee,et,en,ei,eo;this.parent=$;if($){this.options=$.options;this.stringify=$.stringify}ei=this.children;eo=[];for(et=0,en=ei.length;et<en;et++){ee=ei[et];eo.push(ee.setParent(this))}return eo};$.prototype.element=function($,ee,et){var en,ei,eo,es,eu,el,ef,ed,ep,eh,ey;el=null;if(ee===null&&et==null){ep=[{},null],ee=ep[0],et=ep[1]}if(ee==null){ee={}}ee=e_(ee);if(!eS(ee)){eh=[ee,et],et=eh[0],ee=eh[1]}if($!=null){$=e_($)}if(Array.isArray($)){for(eo=0,ef=$.length;eo<ef;eo++){ei=$[eo];el=this.element(ei)}}else if(eE($)){el=this.element($.apply())}else if(eS($)){for(eu in $){if(!eO.call($,eu))continue;ey=$[eu];if(eE(ey)){ey=ey.apply()}if(!this.options.ignoreDecorators&&this.stringify.convertAttKey&&eu.indexOf(this.stringify.convertAttKey)===0){el=this.attribute(eu.substr(this.stringify.convertAttKey.length),ey)}else if(!this.options.separateArrayItems&&Array.isArray(ey)&&ew(ey)){el=this.dummy()}else if(eS(ey)&&ew(ey)){el=this.element(eu)}else if(!this.options.keepNullNodes&&ey==null){el=this.dummy()}else if(!this.options.separateArrayItems&&Array.isArray(ey)){for(es=0,ed=ey.length;es<ed;es++){ei=ey[es];en={};en[eu]=ei;el=this.element(en)}}else if(eS(ey)){if(!this.options.ignoreDecorators&&this.stringify.convertTextKey&&eu.indexOf(this.stringify.convertTextKey)===0){el=this.element(ey)}else{el=this.element(eu);el.element(ey)}}else{el=this.element(eu,ey)}}}else if(!this.options.keepNullNodes&&et===null){el=this.dummy()}else{if(!this.options.ignoreDecorators&&this.stringify.convertTextKey&&$.indexOf(this.stringify.convertTextKey)===0){el=this.text(et)}else if(!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&$.indexOf(this.stringify.convertCDataKey)===0){el=this.cdata(et)}else if(!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&$.indexOf(this.stringify.convertCommentKey)===0){el=this.comment(et)}else if(!this.options.ignoreDecorators&&this.stringify.convertRawKey&&$.indexOf(this.stringify.convertRawKey)===0){el=this.raw(et)}else if(!this.options.ignoreDecorators&&this.stringify.convertPIKey&&$.indexOf(this.stringify.convertPIKey)===0){el=this.instruction($.substr(this.stringify.convertPIKey.length),et)}else{el=this.node($,ee,et)}}if(el==null){throw new Error("Could not create any elements with: "+$+". "+this.debugInfo())}return el};$.prototype.insertBefore=function($,ee,et){var en,ei,eo,es,eu;if($!=null?$.type:void 0){eo=$;es=ee;eo.setParent(this);if(es){ei=children.indexOf(es);eu=children.splice(ei);children.push(eo);Array.prototype.push.apply(children,eu)}else{children.push(eo)}return eo}else{if(this.isRoot){throw new Error("Cannot insert elements at root level. "+this.debugInfo($))}ei=this.parent.children.indexOf(this);eu=this.parent.children.splice(ei);en=this.parent.element($,ee,et);Array.prototype.push.apply(this.parent.children,eu);return en}};$.prototype.insertAfter=function($,ee,et){var en,ei,eo;if(this.isRoot){throw new Error("Cannot insert elements at root level. "+this.debugInfo($))}ei=this.parent.children.indexOf(this);eo=this.parent.children.splice(ei+1);en=this.parent.element($,ee,et);Array.prototype.push.apply(this.parent.children,eo);return en};$.prototype.remove=function(){var $,ee;if(this.isRoot){throw new Error("Cannot remove the root element. "+this.debugInfo())}$=this.parent.children.indexOf(this);[].splice.apply(this.parent.children,[$,$-$+1].concat(ee=[])),ee;return this.parent};$.prototype.node=function($,ee,et){var en,ei;if($!=null){$=e_($)}ee||(ee={});ee=e_(ee);if(!eS(ee)){ei=[ee,et],et=ei[0],ee=ei[1]}en=new ef(this,$,ee);if(et!=null){en.text(et)}this.children.push(en);return en};$.prototype.text=function($){var ee;if(eS($)){this.element($)}ee=new em(this,$);this.children.push(ee);return this};$.prototype.cdata=function($){var ee;ee=new ei(this,$);this.children.push(ee);return this};$.prototype.comment=function($){var ee;ee=new eo(this,$);this.children.push(ee);return this};$.prototype.commentBefore=function($){var ee,et,en;et=this.parent.children.indexOf(this);en=this.parent.children.splice(et);ee=this.parent.comment($);Array.prototype.push.apply(this.parent.children,en);return this};$.prototype.commentAfter=function($){var ee,et,en;et=this.parent.children.indexOf(this);en=this.parent.children.splice(et+1);ee=this.parent.comment($);Array.prototype.push.apply(this.parent.children,en);return this};$.prototype.raw=function($){var ee;ee=new eg(this,$);this.children.push(ee);return this};$.prototype.dummy=function(){var $;$=new el(this);return $};$.prototype.instruction=function($,ee){var et,en,ei,eo,es;if($!=null){$=e_($)}if(ee!=null){ee=e_(ee)}if(Array.isArray($)){for(eo=0,es=$.length;eo<es;eo++){et=$[eo];this.instruction(et)}}else if(eS($)){for(et in $){if(!eO.call($,et))continue;en=$[et];this.instruction(et,en)}}else{if(eE(ee)){ee=ee.apply()}ei=new ey(this,$,ee);this.children.push(ei)}return this};$.prototype.instructionBefore=function($,ee){var et,en,ei;en=this.parent.children.indexOf(this);ei=this.parent.children.splice(en);et=this.parent.instruction($,ee);Array.prototype.push.apply(this.parent.children,ei);return this};$.prototype.instructionAfter=function($,ee){var et,en,ei;en=this.parent.children.indexOf(this);ei=this.parent.children.splice(en+1);et=this.parent.instruction($,ee);Array.prototype.push.apply(this.parent.children,ei);return this};$.prototype.declaration=function($,ee,et){var ei,eo;ei=this.document();eo=new es(ei,$,ee,et);if(ei.children.length===0){ei.children.unshift(eo)}else if(ei.children[0].type===en.Declaration){ei.children[0]=eo}else{ei.children.unshift(eo)}return ei.root()||ei};$.prototype.dtd=function($,ee){var et,ei,eo,es,el,ef,ed,ep,eh,ey;ei=this.document();eo=new eu(ei,$,ee);eh=ei.children;for(es=el=0,ed=eh.length;el<ed;es=++el){et=eh[es];if(et.type===en.DocType){ei.children[es]=eo;return eo}}ey=ei.children;for(es=ef=0,ep=ey.length;ef<ep;es=++ef){et=ey[es];if(et.isRoot){ei.children.splice(es,0,eo);return eo}}ei.children.push(eo);return eo};$.prototype.up=function(){if(this.isRoot){throw new Error("The root node has no parent. Use doc() if you need to get the document object.")}return this.parent};$.prototype.root=function(){var $;$=this;while($){if($.type===en.Document){return $.rootObject}else if($.isRoot){return $}else{$=$.parent}}};$.prototype.document=function(){var $;$=this;while($){if($.type===en.Document){return $}else{$=$.parent}}};$.prototype.end=function($){return this.document().end($)};$.prototype.prev=function(){var $;$=this.parent.children.indexOf(this);if($<1){throw new Error("Already at the first node. "+this.debugInfo())}return this.parent.children[$-1]};$.prototype.next=function(){var $;$=this.parent.children.indexOf(this);if($===-1||$===this.parent.children.length-1){throw new Error("Already at the last node. "+this.debugInfo())}return this.parent.children[$+1]};$.prototype.importDocument=function($){var ee;ee=$.root().clone();ee.parent=this;ee.isRoot=false;this.children.push(ee);return this};$.prototype.debugInfo=function($){var ee,et;$=$||this.name;if($==null&&!((ee=this.parent)!=null?ee.name:void 0)){return""}else if($==null){return"parent: <"+this.parent.name+">"}else if(!((et=this.parent)!=null?et.name:void 0)){return"node: <"+$+">"}else{return"node: <"+$+">, parent: <"+this.parent.name+">"}};$.prototype.ele=function($,ee,et){return this.element($,ee,et)};$.prototype.nod=function($,ee,et){return this.node($,ee,et)};$.prototype.txt=function($){return this.text($)};$.prototype.dat=function($){return this.cdata($)};$.prototype.com=function($){return this.comment($)};$.prototype.ins=function($,ee){return this.instruction($,ee)};$.prototype.doc=function(){return this.document()};$.prototype.dec=function($,ee,et){return this.declaration($,ee,et)};$.prototype.e=function($,ee,et){return this.element($,ee,et)};$.prototype.n=function($,ee,et){return this.node($,ee,et)};$.prototype.t=function($){return this.text($)};$.prototype.d=function($){return this.cdata($)};$.prototype.c=function($){return this.comment($)};$.prototype.r=function($){return this.raw($)};$.prototype.i=function($,ee){return this.instruction($,ee)};$.prototype.u=function(){return this.up()};$.prototype.importXMLBuilder=function($){return this.importDocument($)};$.prototype.replaceChild=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.removeChild=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.appendChild=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.hasChildNodes=function(){return this.children.length!==0};$.prototype.cloneNode=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.isSupported=function($,ee){return true};$.prototype.hasAttributes=function(){return this.attribs.length!==0};$.prototype.compareDocumentPosition=function($){var et,en;et=this;if(et===$){return 0}else if(this.document()!==$.document()){en=ee.Disconnected|ee.ImplementationSpecific;if(Math.random()<.5){en|=ee.Preceding}else{en|=ee.Following}return en}else if(et.isAncestor($)){return ee.Contains|ee.Preceding}else if(et.isDescendant($)){return ee.Contains|ee.Following}else if(et.isPreceding($)){return ee.Preceding}else{return ee.Following}};$.prototype.isSameNode=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.lookupPrefix=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.isDefaultNamespace=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.lookupNamespaceURI=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.isEqualNode=function($){var ee,et,en;if($.nodeType!==this.nodeType){return false}if($.children.length!==this.children.length){return false}for(ee=et=0,en=this.children.length-1;0<=en?et<=en:et>=en;ee=0<=en?++et:--et){if(!this.children[ee].isEqualNode($.children[ee])){return false}}return true};$.prototype.getFeature=function($,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.setUserData=function($,ee,et){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.getUserData=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};$.prototype.contains=function($){if(!$){return false}return $===this||this.isDescendant($)};$.prototype.isDescendant=function($){var ee,et,en,ei,eo;eo=this.children;for(en=0,ei=eo.length;en<ei;en++){ee=eo[en];if($===ee){return true}et=ee.isDescendant($);if(et){return true}}return false};$.prototype.isAncestor=function($){return $.isDescendant(this)};$.prototype.isPreceding=function($){var ee,et;ee=this.treePosition($);et=this.treePosition(this);if(ee===-1||et===-1){return false}else{return ee<et}};$.prototype.isFollowing=function($){var ee,et;ee=this.treePosition($);et=this.treePosition(this);if(ee===-1||et===-1){return false}else{return ee>et}};$.prototype.treePosition=function($){var ee,et;et=0;ee=false;this.foreachTreeNode(this.document(),function(en){et++;if(!ee&&en===$){return ee=true}});if(ee){return et}else{return-1}};$.prototype.foreachTreeNode=function($,ee){var et,en,ei,eo,es;$||($=this.document());eo=$.children;for(en=0,ei=eo.length;en<ei;en++){et=eo[en];if(es=ee(et)){return es}else{es=this.foreachTreeNode(et,ee);if(es){return es}}}};return $}()}).call(this)},3220:function($){(function(){var ee;$.exports=ee=function(){function $($){this.nodes=$}Object.defineProperty($.prototype,"length",{get:function(){return this.nodes.length||0}});$.prototype.clone=function(){return this.nodes=null};$.prototype.item=function($){return this.nodes[$]||null};return $}()}).call(this)},3402:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ee=et(8745);en=et(4356);$.exports=ei=function($){eo(et,$);function et($,en,ei){et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing instruction target. "+this.debugInfo())}this.type=ee.ProcessingInstruction;this.target=this.stringify.insTarget(en);this.name=this.target;if(ei){this.value=this.stringify.insValue(ei)}}et.prototype.clone=function(){return Object.create(this)};et.prototype.toString=function($){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions($))};et.prototype.isEqualNode=function($){if(!et.__super__.isEqualNode.apply(this,arguments).isEqualNode($)){return false}if($.target!==this.target){return false}return true};return et}(en)}).call(this)},7641:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ee=et(8745);en=et(630);$.exports=ei=function($){eo(et,$);function et($,en){et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing raw text. "+this.debugInfo())}this.type=ee.Raw;this.value=this.stringify.raw(en)}et.prototype.clone=function(){return Object.create(this)};et.prototype.toString=function($){return this.options.writer.raw(this,this.options.writer.filterOptions($))};return et}(en)}).call(this)},1479:function($,ee,et){(function(){var ee,en,ei,eo,es=function($,ee){for(var et in ee){if(eu.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},eu={}.hasOwnProperty;ee=et(8745);eo=et(5859);en=et(6530);$.exports=ei=function($){es(et,$);function et($,ee){this.stream=$;et.__super__.constructor.call(this,ee)}et.prototype.endline=function($,ee,ei){if($.isLastRootNode&&ee.state===en.CloseTag){return""}else{return et.__super__.endline.call(this,$,ee,ei)}};et.prototype.document=function($,ee){var et,en,ei,eo,es,eu,el,ef,ed;el=$.children;for(en=ei=0,es=el.length;ei<es;en=++ei){et=el[en];et.isLastRootNode=en===$.children.length-1}ee=this.filterOptions(ee);ef=$.children;ed=[];for(eo=0,eu=ef.length;eo<eu;eo++){et=ef[eo];ed.push(this.writeChildNode(et,ee,0))}return ed};et.prototype.attribute=function($,ee,en){return this.stream.write(et.__super__.attribute.call(this,$,ee,en))};et.prototype.cdata=function($,ee,en){return this.stream.write(et.__super__.cdata.call(this,$,ee,en))};et.prototype.comment=function($,ee,en){return this.stream.write(et.__super__.comment.call(this,$,ee,en))};et.prototype.declaration=function($,ee,en){return this.stream.write(et.__super__.declaration.call(this,$,ee,en))};et.prototype.docType=function($,ee,et){var ei,eo,es,eu;et||(et=0);this.openNode($,ee,et);ee.state=en.OpenTag;this.stream.write(this.indent($,ee,et));this.stream.write("<!DOCTYPE "+$.root().name);if($.pubID&&$.sysID){this.stream.write(' PUBLIC "'+$.pubID+'" "'+$.sysID+'"')}else if($.sysID){this.stream.write(' SYSTEM "'+$.sysID+'"')}if($.children.length>0){this.stream.write(" [");this.stream.write(this.endline($,ee,et));ee.state=en.InsideTag;eu=$.children;for(eo=0,es=eu.length;eo<es;eo++){ei=eu[eo];this.writeChildNode(ei,ee,et+1)}ee.state=en.CloseTag;this.stream.write("]")}ee.state=en.CloseTag;this.stream.write(ee.spaceBeforeSlash+">");this.stream.write(this.endline($,ee,et));ee.state=en.None;return this.closeNode($,ee,et)};et.prototype.element=function($,et,ei){var eo,es,el,ef,ed,ep,eh,ey,eg,em;ei||(ei=0);this.openNode($,et,ei);et.state=en.OpenTag;this.stream.write(this.indent($,et,ei)+"<"+$.name);eg=$.attribs;for(eh in eg){if(!eu.call(eg,eh))continue;eo=eg[eh];this.attribute(eo,et,ei)}el=$.children.length;ef=el===0?null:$.children[0];if(el===0||$.children.every(function($){return($.type===ee.Text||$.type===ee.Raw)&&$.value===""})){if(et.allowEmpty){this.stream.write(">");et.state=en.CloseTag;this.stream.write("</"+$.name+">")}else{et.state=en.CloseTag;this.stream.write(et.spaceBeforeSlash+"/>")}}else if(et.pretty&&el===1&&(ef.type===ee.Text||ef.type===ee.Raw)&&ef.value!=null){this.stream.write(">");et.state=en.InsideTag;et.suppressPrettyCount++;ey=true;this.writeChildNode(ef,et,ei+1);et.suppressPrettyCount--;ey=false;et.state=en.CloseTag;this.stream.write("</"+$.name+">")}else{this.stream.write(">"+this.endline($,et,ei));et.state=en.InsideTag;em=$.children;for(ed=0,ep=em.length;ed<ep;ed++){es=em[ed];this.writeChildNode(es,et,ei+1)}et.state=en.CloseTag;this.stream.write(this.indent($,et,ei)+"</"+$.name+">")}this.stream.write(this.endline($,et,ei));et.state=en.None;return this.closeNode($,et,ei)};et.prototype.processingInstruction=function($,ee,en){return this.stream.write(et.__super__.processingInstruction.call(this,$,ee,en))};et.prototype.raw=function($,ee,en){return this.stream.write(et.__super__.raw.call(this,$,ee,en))};et.prototype.text=function($,ee,en){return this.stream.write(et.__super__.text.call(this,$,ee,en))};et.prototype.dtdAttList=function($,ee,en){return this.stream.write(et.__super__.dtdAttList.call(this,$,ee,en))};et.prototype.dtdElement=function($,ee,en){return this.stream.write(et.__super__.dtdElement.call(this,$,ee,en))};et.prototype.dtdEntity=function($,ee,en){return this.stream.write(et.__super__.dtdEntity.call(this,$,ee,en))};et.prototype.dtdNotation=function($,ee,en){return this.stream.write(et.__super__.dtdNotation.call(this,$,ee,en))};return et}(eo)}).call(this)},1663:function($,ee,et){(function(){var ee,en,ei=function($,ee){for(var et in ee){if(eo.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},eo={}.hasOwnProperty;en=et(5859);$.exports=ee=function($){ei(ee,$);function ee($){ee.__super__.constructor.call(this,$)}ee.prototype.document=function($,ee){var et,en,ei,eo,es;ee=this.filterOptions(ee);eo="";es=$.children;for(en=0,ei=es.length;en<ei;en++){et=es[en];eo+=this.writeChildNode(et,ee,0)}if(ee.pretty&&eo.slice(-ee.newline.length)===ee.newline){eo=eo.slice(0,-ee.newline.length)}return eo};return ee}(en)}).call(this)},8365:function($){(function(){var ee,et=function($,ee){return function(){return $.apply(ee,arguments)}},en={}.hasOwnProperty;$.exports=ee=function(){function $($){this.assertLegalName=et(this.assertLegalName,this);this.assertLegalChar=et(this.assertLegalChar,this);var ee,ei,eo;$||($={});this.options=$;if(!this.options.version){this.options.version="1.0"}ei=$.stringify||{};for(ee in ei){if(!en.call(ei,ee))continue;eo=ei[ee];this[ee]=eo}}$.prototype.name=function($){if(this.options.noValidation){return $}return this.assertLegalName(""+$||"")};$.prototype.text=function($){if(this.options.noValidation){return $}return this.assertLegalChar(this.textEscape(""+$||""))};$.prototype.cdata=function($){if(this.options.noValidation){return $}$=""+$||"";$=$.replace("]]>","]]]]><![CDATA[>");return this.assertLegalChar($)};$.prototype.comment=function($){if(this.options.noValidation){return $}$=""+$||"";if($.match(/--/)){throw new Error("Comment text cannot contain double-hypen: "+$)}return this.assertLegalChar($)};$.prototype.raw=function($){if(this.options.noValidation){return $}return""+$||""};$.prototype.attValue=function($){if(this.options.noValidation){return $}return this.assertLegalChar(this.attEscape($=""+$||""))};$.prototype.insTarget=function($){if(this.options.noValidation){return $}return this.assertLegalChar(""+$||"")};$.prototype.insValue=function($){if(this.options.noValidation){return $}$=""+$||"";if($.match(/\?>/)){throw new Error("Invalid processing instruction value: "+$)}return this.assertLegalChar($)};$.prototype.xmlVersion=function($){if(this.options.noValidation){return $}$=""+$||"";if(!$.match(/1\.[0-9]+/)){throw new Error("Invalid version number: "+$)}return $};$.prototype.xmlEncoding=function($){if(this.options.noValidation){return $}$=""+$||"";if(!$.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)){throw new Error("Invalid encoding: "+$)}return this.assertLegalChar($)};$.prototype.xmlStandalone=function($){if(this.options.noValidation){return $}if($){return"yes"}else{return"no"}};$.prototype.dtdPubID=function($){if(this.options.noValidation){return $}return this.assertLegalChar(""+$||"")};$.prototype.dtdSysID=function($){if(this.options.noValidation){return $}return this.assertLegalChar(""+$||"")};$.prototype.dtdElementValue=function($){if(this.options.noValidation){return $}return this.assertLegalChar(""+$||"")};$.prototype.dtdAttType=function($){if(this.options.noValidation){return $}return this.assertLegalChar(""+$||"")};$.prototype.dtdAttDefault=function($){if(this.options.noValidation){return $}return this.assertLegalChar(""+$||"")};$.prototype.dtdEntityValue=function($){if(this.options.noValidation){return $}return this.assertLegalChar(""+$||"")};$.prototype.dtdNData=function($){if(this.options.noValidation){return $}return this.assertLegalChar(""+$||"")};$.prototype.convertAttKey="@";$.prototype.convertPIKey="?";$.prototype.convertTextKey="#text";$.prototype.convertCDataKey="#cdata";$.prototype.convertCommentKey="#comment";$.prototype.convertRawKey="#raw";$.prototype.assertLegalChar=function($){var ee,et;if(this.options.noValidation){return $}ee="";if(this.options.version==="1.0"){ee=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;if(et=$.match(ee)){throw new Error("Invalid character in string: "+$+" at index "+et.index)}}else if(this.options.version==="1.1"){ee=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;if(et=$.match(ee)){throw new Error("Invalid character in string: "+$+" at index "+et.index)}}return $};$.prototype.assertLegalName=function($){var ee;if(this.options.noValidation){return $}this.assertLegalChar($);ee=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/;if(!$.match(ee)){throw new Error("Invalid character in name")}return $};$.prototype.textEscape=function($){var ee;if(this.options.noValidation){return $}ee=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g;return $.replace(ee,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
")};$.prototype.attEscape=function($){var ee;if(this.options.noValidation){return $}ee=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g;return $.replace(ee,"&").replace(/</g,"<").replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
")};return $}()}).call(this)},4306:function($,ee,et){(function(){var ee,en,ei,eo=function($,ee){for(var et in ee){if(es.call(ee,et))$[et]=ee[et]}function en(){this.constructor=$}en.prototype=ee.prototype;$.prototype=new en;$.__super__=ee.prototype;return $},es={}.hasOwnProperty;ee=et(8745);en=et(4356);$.exports=ei=function($){eo(et,$);function et($,en){et.__super__.constructor.call(this,$);if(en==null){throw new Error("Missing element text. "+this.debugInfo())}this.name="#text";this.type=ee.Text;this.value=this.stringify.text(en)}Object.defineProperty(et.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}});Object.defineProperty(et.prototype,"wholeText",{get:function(){var $,ee,et;et="";ee=this.previousSibling;while(ee){et=ee.data+et;ee=ee.previousSibling}et+=this.data;$=this.nextSibling;while($){et=et+$.data;$=$.nextSibling}return et}});et.prototype.clone=function(){return Object.create(this)};et.prototype.toString=function($){return this.options.writer.text(this,this.options.writer.filterOptions($))};et.prototype.splitText=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};et.prototype.replaceWholeText=function($){throw new Error("This DOM method is not implemented."+this.debugInfo())};return et}(en)}).call(this)},5859:function($,ee,et){(function(){var ee,en,ei,eo,es,eu,el,ef,ed,ep,eh,ey,eg,em,e_,ew,eE,eS={}.hasOwnProperty;eE=et(8676).assign;ee=et(8745);ed=et(2308);ep=et(6808);ei=et(9877);eo=et(2374);ey=et(5725);em=et(7641);e_=et(4306);eg=et(3402);eh=et(4402);es=et(4131);eu=et(7338);el=et(7834);ef=et(8507);en=et(6530);$.exports=ew=function(){function $($){var ee,et,en;$||($={});this.options=$;et=$.writer||{};for(ee in et){if(!eS.call(et,ee))continue;en=et[ee];this["_"+ee]=this[ee];this[ee]=en}}$.prototype.filterOptions=function($){var ee,et,ei,eo,es,eu,el,ef;$||($={});$=eE({},this.options,$);ee={writer:this};ee.pretty=$.pretty||false;ee.allowEmpty=$.allowEmpty||false;ee.indent=(et=$.indent)!=null?et:" ";ee.newline=(ei=$.newline)!=null?ei:"\n";ee.offset=(eo=$.offset)!=null?eo:0;ee.dontPrettyTextNodes=(es=(eu=$.dontPrettyTextNodes)!=null?eu:$.dontprettytextnodes)!=null?es:0;ee.spaceBeforeSlash=(el=(ef=$.spaceBeforeSlash)!=null?ef:$.spacebeforeslash)!=null?el:"";if(ee.spaceBeforeSlash===true){ee.spaceBeforeSlash=" "}ee.suppressPrettyCount=0;ee.user={};ee.state=en.None;return ee};$.prototype.indent=function($,ee,et){var en;if(!ee.pretty||ee.suppressPrettyCount){return""}else if(ee.pretty){en=(et||0)+ee.offset+1;if(en>0){return new Array(en).join(ee.indent)}}return""};$.prototype.endline=function($,ee,et){if(!ee.pretty||ee.suppressPrettyCount){return""}else{return ee.newline}};$.prototype.attribute=function($,ee,et){var en;this.openAttribute($,ee,et);en=" "+$.name+'="'+$.value+'"';this.closeAttribute($,ee,et);return en};$.prototype.cdata=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et)+"<![CDATA[";ee.state=en.InsideTag;ei+=$.value;ee.state=en.CloseTag;ei+="]]>"+this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.comment=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et)+"<!-- ";ee.state=en.InsideTag;ei+=$.value;ee.state=en.CloseTag;ei+=" -->"+this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.declaration=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et)+"<?xml";ee.state=en.InsideTag;ei+=' version="'+$.version+'"';if($.encoding!=null){ei+=' encoding="'+$.encoding+'"'}if($.standalone!=null){ei+=' standalone="'+$.standalone+'"'}ee.state=en.CloseTag;ei+=ee.spaceBeforeSlash+"?>";ei+=this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.docType=function($,ee,et){var ei,eo,es,eu,el;et||(et=0);this.openNode($,ee,et);ee.state=en.OpenTag;eu=this.indent($,ee,et);eu+="<!DOCTYPE "+$.root().name;if($.pubID&&$.sysID){eu+=' PUBLIC "'+$.pubID+'" "'+$.sysID+'"'}else if($.sysID){eu+=' SYSTEM "'+$.sysID+'"'}if($.children.length>0){eu+=" [";eu+=this.endline($,ee,et);ee.state=en.InsideTag;el=$.children;for(eo=0,es=el.length;eo<es;eo++){ei=el[eo];eu+=this.writeChildNode(ei,ee,et+1)}ee.state=en.CloseTag;eu+="]"}ee.state=en.CloseTag;eu+=ee.spaceBeforeSlash+">";eu+=this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return eu};$.prototype.element=function($,et,ei){var eo,es,eu,el,ef,ed,ep,eh,ey,eg,em,e_,ew,eE;ei||(ei=0);eg=false;em="";this.openNode($,et,ei);et.state=en.OpenTag;em+=this.indent($,et,ei)+"<"+$.name;e_=$.attribs;for(ey in e_){if(!eS.call(e_,ey))continue;eo=e_[ey];em+=this.attribute(eo,et,ei)}eu=$.children.length;el=eu===0?null:$.children[0];if(eu===0||$.children.every(function($){return($.type===ee.Text||$.type===ee.Raw)&&$.value===""})){if(et.allowEmpty){em+=">";et.state=en.CloseTag;em+="</"+$.name+">"+this.endline($,et,ei)}else{et.state=en.CloseTag;em+=et.spaceBeforeSlash+"/>"+this.endline($,et,ei)}}else if(et.pretty&&eu===1&&(el.type===ee.Text||el.type===ee.Raw)&&el.value!=null){em+=">";et.state=en.InsideTag;et.suppressPrettyCount++;eg=true;em+=this.writeChildNode(el,et,ei+1);et.suppressPrettyCount--;eg=false;et.state=en.CloseTag;em+="</"+$.name+">"+this.endline($,et,ei)}else{if(et.dontPrettyTextNodes){ew=$.children;for(ef=0,ep=ew.length;ef<ep;ef++){es=ew[ef];if((es.type===ee.Text||es.type===ee.Raw)&&es.value!=null){et.suppressPrettyCount++;eg=true;break}}}em+=">"+this.endline($,et,ei);et.state=en.InsideTag;eE=$.children;for(ed=0,eh=eE.length;ed<eh;ed++){es=eE[ed];em+=this.writeChildNode(es,et,ei+1)}et.state=en.CloseTag;em+=this.indent($,et,ei)+"</"+$.name+">";if(eg){et.suppressPrettyCount--}em+=this.endline($,et,ei);et.state=en.None}this.closeNode($,et,ei);return em};$.prototype.writeChildNode=function($,et,en){switch($.type){case ee.CData:return this.cdata($,et,en);case ee.Comment:return this.comment($,et,en);case ee.Element:return this.element($,et,en);case ee.Raw:return this.raw($,et,en);case ee.Text:return this.text($,et,en);case ee.ProcessingInstruction:return this.processingInstruction($,et,en);case ee.Dummy:return"";case ee.Declaration:return this.declaration($,et,en);case ee.DocType:return this.docType($,et,en);case ee.AttributeDeclaration:return this.dtdAttList($,et,en);case ee.ElementDeclaration:return this.dtdElement($,et,en);case ee.EntityDeclaration:return this.dtdEntity($,et,en);case ee.NotationDeclaration:return this.dtdNotation($,et,en);default:throw new Error("Unknown XML node type: "+$.constructor.name)}};$.prototype.processingInstruction=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et)+"<?";ee.state=en.InsideTag;ei+=$.target;if($.value){ei+=" "+$.value}ee.state=en.CloseTag;ei+=ee.spaceBeforeSlash+"?>";ei+=this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.raw=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et);ee.state=en.InsideTag;ei+=$.value;ee.state=en.CloseTag;ei+=this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.text=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et);ee.state=en.InsideTag;ei+=$.value;ee.state=en.CloseTag;ei+=this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.dtdAttList=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et)+"<!ATTLIST";ee.state=en.InsideTag;ei+=" "+$.elementName+" "+$.attributeName+" "+$.attributeType;if($.defaultValueType!=="#DEFAULT"){ei+=" "+$.defaultValueType}if($.defaultValue){ei+=' "'+$.defaultValue+'"'}ee.state=en.CloseTag;ei+=ee.spaceBeforeSlash+">"+this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.dtdElement=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et)+"<!ELEMENT";ee.state=en.InsideTag;ei+=" "+$.name+" "+$.value;ee.state=en.CloseTag;ei+=ee.spaceBeforeSlash+">"+this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.dtdEntity=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et)+"<!ENTITY";ee.state=en.InsideTag;if($.pe){ei+=" %"}ei+=" "+$.name;if($.value){ei+=' "'+$.value+'"'}else{if($.pubID&&$.sysID){ei+=' PUBLIC "'+$.pubID+'" "'+$.sysID+'"'}else if($.sysID){ei+=' SYSTEM "'+$.sysID+'"'}if($.nData){ei+=" NDATA "+$.nData}}ee.state=en.CloseTag;ei+=ee.spaceBeforeSlash+">"+this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.dtdNotation=function($,ee,et){var ei;this.openNode($,ee,et);ee.state=en.OpenTag;ei=this.indent($,ee,et)+"<!NOTATION";ee.state=en.InsideTag;ei+=" "+$.name;if($.pubID&&$.sysID){ei+=' PUBLIC "'+$.pubID+'" "'+$.sysID+'"'}else if($.pubID){ei+=' PUBLIC "'+$.pubID+'"'}else if($.sysID){ei+=' SYSTEM "'+$.sysID+'"'}ee.state=en.CloseTag;ei+=ee.spaceBeforeSlash+">"+this.endline($,ee,et);ee.state=en.None;this.closeNode($,ee,et);return ei};$.prototype.openNode=function($,ee,et){};$.prototype.closeNode=function($,ee,et){};$.prototype.openAttribute=function($,ee,et){};$.prototype.closeAttribute=function($,ee,et){};return $}()}).call(this)},9374:function($,ee,et){(function(){var ee,en,ei,eo,es,eu,el,ef,ed,ep;ep=et(8676),ef=ep.assign,ed=ep.isFunction;ei=et(4016);eo=et(1888);es=et(2621);el=et(1663);eu=et(1479);ee=et(8745);en=et(6530);$.exports.create=function($,ee,et,en){var ei,es;if($==null){throw new Error("Root element needs a name.")}en=ef({},ee,et,en);ei=new eo(en);es=ei.element($);if(!en.headless){ei.declaration(en);if(en.pubID!=null||en.sysID!=null){ei.dtd(en)}}return es};$.exports.begin=function($,ee,et){var en;if(ed($)){en=[$,ee],ee=en[0],et=en[1];$={}}if(ee){return new es($,ee,et)}else{return new eo($)}};$.exports.stringWriter=function($){return new el($)};$.exports.streamWriter=function($,ee){return new eu($,ee)};$.exports.implementation=new ei;$.exports.nodeType=ee;$.exports.writerState=en}).call(this)},5070:function($,ee){var et,en,ei;(function(eo,es){if(true){!(en=[],et=es,ei=typeof et==="function"?et.apply(ee,en):et,ei!==undefined&&($.exports=ei))}else{}})(this,function(){"use strict";function $($,ee){function et(){this.constructor=$}et.prototype=ee.prototype;$.prototype=new et}function ee($,et,en,ei){var eo=Error.call(this,$);if(Object.setPrototypeOf){Object.setPrototypeOf(eo,ee.prototype)}eo.expected=et;eo.found=en;eo.location=ei;eo.name="SyntaxError";return eo}$(ee,Error);function et($,ee,et){et=et||" ";if($.length>ee){return $}ee-=$.length;et+=et.repeat(ee);return $+et.slice(0,ee)}ee.prototype.format=function($){var ee="Error: "+this.message;if(this.location){var en=null;var ei;for(ei=0;ei<$.length;ei++){if($[ei].source===this.location.source){en=$[ei].text.split(/\r\n|\n|\r/g);break}}var eo=this.location.start;var es=this.location.source&&typeof this.location.source.offset==="function"?this.location.source.offset(eo):eo;var eu=this.location.source+":"+es.line+":"+es.column;if(en){var el=this.location.end;var ef=et("",es.line.toString().length," ");var ed=en[eo.line-1];var ep=eo.line===el.line?el.column:ed.length+1;var eh=ep-eo.column||1;ee+="\n --> "+eu+"\n"+ef+" |\n"+es.line+" | "+ed+"\n"+ef+" | "+et("",eo.column-1," ")+et("",eh,"^")}else{ee+="\n at "+eu}}return ee};ee.buildMessage=function($,ee){var et={literal:function($){return'"'+ei($.text)+'"'},class:function($){var ee=$.parts.map(function($){return Array.isArray($)?eo($[0])+"-"+eo($[1]):eo($)});return"["+($.inverted?"^":"")+ee.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function($){return $.description}};function en($){return $.charCodeAt(0).toString(16).toUpperCase()}function ei($){return $.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function($){return"\\x0"+en($)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function($){return"\\x"+en($)})}function eo($){return $.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function($){return"\\x0"+en($)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function($){return"\\x"+en($)})}function es($){return et[$.type]($)}function eu($){var ee=$.map(es);var et,en;ee.sort();if(ee.length>0){for(et=1,en=1;et<ee.length;et++){if(ee[et-1]!==ee[et]){ee[en]=ee[et];en++}}ee.length=en}switch(ee.length){case 1:return ee[0];case 2:return ee[0]+" or "+ee[1];default:return ee.slice(0,-1).join(", ")+", or "+ee[ee.length-1]}}function el($){return $?'"'+ei($)+'"':"end of input"}return"Expected "+eu($)+" but "+el(ee)+" found."};function en($,et){et=et!==undefined?et:{};var en={};var ei=et.grammarSource;var eo={expr:eK};var es=eK;var eu="source";var el="sink";var ef=" ";var ed=/^[0-9]/;var ep=eU("source",false);var eh=eU("sink",false);var ey=ez("space");var eg=eU(" ",false);var em=ez("digit");var e_=ej([["0","9"]],false,false);var ew=ez("weight");var eE=function(){return{type:"source"}};var eS=function($){return{type:"sink",weight:+$||1}};var eT=function($){return+$};var eO=0;var eA=0;var eI=[{line:1,column:1}];var eN=0;var eD=[];var eR=0;var eC;if("startRule"in et){if(!(et.startRule in eo)){throw new Error("Can't start parsing from rule \""+et.startRule+'".')}es=eo[et.startRule]}function ek(){return $.substring(eA,eO)}function eM(){return eA}function eL(){return{source:ei,start:eA,end:eO}}function eP(){return e$(eA,eO)}function eF(ee,et){et=et!==undefined?et:e$(eA,eO);throw eY([ez(ee)],$.substring(eA,eO),et)}function eB($,ee){ee=ee!==undefined?ee:e$(eA,eO);throw eG($,ee)}function eU($,ee){return{type:"literal",text:$,ignoreCase:ee}}function ej($,ee,et){return{type:"class",parts:$,inverted:ee,ignoreCase:et}}function eW(){return{type:"any"}}function eH(){return{type:"end"}}function ez($){return{type:"other",description:$}}function eV(ee){var et=eI[ee];var en;if(et){return et}else{en=ee-1;while(!eI[en]){en--}et=eI[en];et={line:et.line,column:et.column};while(en<ee){if($.charCodeAt(en)===10){et.line++;et.column=1}else{et.column++}en++}eI[ee]=et;return et}}function e$($,ee,et){var en=eV($);var eo=eV(ee);var es={source:ei,start:{offset:$,line:en.line,column:en.column},end:{offset:ee,line:eo.line,column:eo.column}};if(et&&ei&&typeof ei.offset==="function"){es.start=ei.offset(es.start);es.end=ei.offset(es.end)}return es}function eq($){if(eO<eN){return}if(eO>eN){eN=eO;eD=[]}eD.push($)}function eG($,et){return new ee($,null,null,et)}function eY($,et,en){return new ee(ee.buildMessage($,et),$,et,en)}function eK(){var $,ee,et,ei;$=eO;ee=eZ();if(ee!==en){eA=$;ee=eE()}$=ee;if($===en){$=eO;ee=eJ();if(ee!==en){et=eX();if(et===en){et=null}ei=e0();if(ei===en){ei=null}eA=$;$=eS(ei)}else{eO=$;$=en}}return $}function eZ(){var ee;if($.substr(eO,6)===eu){ee=eu;eO+=6}else{ee=en;if(eR===0){eq(ep)}}return ee}function eJ(){var ee;if($.substr(eO,4)===el){ee=el;eO+=4}else{ee=en;if(eR===0){eq(eh)}}return ee}function eX(){var ee,et;eR++;ee=[];if($.charCodeAt(eO)===32){et=ef;eO++}else{et=en;if(eR===0){eq(eg)}}if(et!==en){while(et!==en){ee.push(et);if($.charCodeAt(eO)===32){et=ef;eO++}else{et=en;if(eR===0){eq(eg)}}}}else{ee=en}eR--;if(ee===en){et=en;if(eR===0){eq(ey)}}return ee}function eQ(){var ee,et;eR++;if(ed.test($.charAt(eO))){ee=$.charAt(eO);eO++}else{ee=en;if(eR===0){eq(e_)}}eR--;if(ee===en){et=en;if(eR===0){eq(em)}}return ee}function e0(){var ee,et,ei,eo;eR++;ee=eO;et=eO;ei=[];eo=eQ();if(eo!==en){while(eo!==en){ei.push(eo);eo=eQ()}}else{ei=en}if(ei!==en){et=$.substring(et,eO)}else{et=ei}if(et!==en){eA=ee;et=eT(et)}ee=et;eR--;if(ee===en){et=en;if(eR===0){eq(ew)}}return ee}eC=es();if(eC!==en&&eO===$.length){return eC}else{if(eC!==en&&eO<$.length){eq(eH())}throw eY(eD,eN<$.length?$.charAt(eN):null,eN<$.length?e$(eN,eN+1):e$(eN,eN))}}return{SyntaxError:ee,parse:en}})},4939:function($,ee){var et,en,ei;(function(eo,es){if(true){!(en=[],et=es,ei=typeof et==="function"?et.apply(ee,en):et,ei!==undefined&&($.exports=ei))}else{}})(this,function(){"use strict";function $($,ee){function et(){this.constructor=$}et.prototype=ee.prototype;$.prototype=new et}function ee($,et,en,ei){var eo=Error.call(this,$);if(Object.setPrototypeOf){Object.setPrototypeOf(eo,ee.prototype)}eo.expected=et;eo.found=en;eo.location=ei;eo.name="SyntaxError";return eo}$(ee,Error);function et($,ee,et){et=et||" ";if($.length>ee){return $}ee-=$.length;et+=et.repeat(ee);return $+et.slice(0,ee)}ee.prototype.format=function($){var ee="Error: "+this.message;if(this.location){var en=null;var ei;for(ei=0;ei<$.length;ei++){if($[ei].source===this.location.source){en=$[ei].text.split(/\r\n|\n|\r/g);break}}var eo=this.location.start;var es=this.location.source&&typeof this.location.source.offset==="function"?this.location.source.offset(eo):eo;var eu=this.location.source+":"+es.line+":"+es.column;if(en){var el=this.location.end;var ef=et("",es.line.toString().length," ");var ed=en[eo.line-1];var ep=eo.line===el.line?el.column:ed.length+1;var eh=ep-eo.column||1;ee+="\n --> "+eu+"\n"+ef+" |\n"+es.line+" | "+ed+"\n"+ef+" | "+et("",eo.column-1," ")+et("",eh,"^")}else{ee+="\n at "+eu}}return ee};ee.buildMessage=function($,ee){var et={literal:function($){return'"'+ei($.text)+'"'},class:function($){var ee=$.parts.map(function($){return Array.isArray($)?eo($[0])+"-"+eo($[1]):eo($)});return"["+($.inverted?"^":"")+ee.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function($){return $.description}};function en($){return $.charCodeAt(0).toString(16).toUpperCase()}function ei($){return $.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function($){return"\\x0"+en($)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function($){return"\\x"+en($)})}function eo($){return $.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function($){return"\\x0"+en($)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function($){return"\\x"+en($)})}function es($){return et[$.type]($)}function eu($){var ee=$.map(es);var et,en;ee.sort();if(ee.length>0){for(et=1,en=1;et<ee.length;et++){if(ee[et-1]!==ee[et]){ee[en]=ee[et];en++}}ee.length=en}switch(ee.length){case 1:return ee[0];case 2:return ee[0]+" or "+ee[1];default:return ee.slice(0,-1).join(", ")+", or "+ee[ee.length-1]}}function el($){return $?'"'+ei($)+'"':"end of input"}return"Expected "+eu($)+" but "+el(ee)+" found."};function en($,et){et=et!==undefined?et:{};var en={};var ei=et.grammarSource;var eo={expr:rc};var es=rc;var eu="month";var el="months";var ef="year";var ed="years";var ep="hold";var eh="previous";var ey="spend";var eg="from";var em="week";var e_="weeks";var ew="by";var eE="of";var eS="repeat";var eT="every";var eO="starting";var eA="up";var eI="to";var eN="schedule";var eD="full";var eR="-";var eC="remainder";var ek=" ";var eM=".";var eL="%";var eP=/^[0-9]/;var eF=/^[1-9]/;var eB=/^[^\r\n\t]/;var eU=rr("repeat interval");var ej=t8("month",true);var eW=t8("months",true);var eH=t8("year",true);var ez=t8("years",true);var eV=t8("hold",true);var e$=t8("previous",true);var eq=t8("spend",true);var eG=t8("from",true);var eY=t8("week",true);var eK=t8("weeks",true);var eZ=t8("by",true);var eJ=t8("of",true);var eX=t8("repeat",true);var eQ=t8("every",true);var e0=t8("starting",true);var e1=t8("up",true);var e2=t8("to",true);var e6=t8("schedule",true);var e4=t8("full",true);var e3=t8("-",true);var e8=t8("remainder",true);var e5=rr("space");var e9=t8(" ",false);var e7=rr("digit");var te=t5([["0","9"]],false,false);var tt=rr("number");var tr=t5([["1","9"]],false,false);var tn=rr("amount");var ti=t8(".",false);var tu=rr("percentage");var tc=t8("%",false);var tf=rr("year");var td=rr("month");var tp=t8("-",false);var th=rr("day");var ty=rr("currency symbol");var tm=t9();var t_=rr("Name");var tv=t5(["\r","\n"," "],true,false);var tw=function($,ee,et){return{type:"percentage",percent:+ee.percent,previous:ee.prev,category:et,priority:+$}};var tE=function($,ee,et,en,ei){return{type:"week",amount:ee,weeks:et,starting:en,limit:ei,priority:+$}};var tS=function($,ee,et,en,ei){return{type:en?"spend":"by",amount:ee,month:et,...ei?ei[3]:{},from:en,priority:+$}};var tT=function($,ee,et){return{type:"simple",monthly:ee,limit:et,priority:+$}};var tO=function($,ee){return{type:"simple",limit:ee,priority:+$}};var tA=function($,ee,et){return{type:"schedule",name:et,priority:+$,full:ee}};var tI=function($,ee){return{type:"remainder",priority:null,weight:ee}};var tN=function(){return{annual:false}};var tD=function($){return{annual:false,repeat:+$}};var tR=function(){return{annual:true}};var tC=function($){return{annual:true,repeat:+$}};var tk=function($){return{amount:$,hold:true}};var tM=function($){return{amount:$,hold:false}};var tL=function($){return{percent:$,prev:true}};var tx=function($){return{percent:$,prev:false}};var tP=function(){return null};var tF=function($){return+$};var tB=function($){return $};var tU=function(){return true};var tj=function($){return $};var tW=function($){return+$||1};var tH=function($){return+$};var tz=function($){return+$};var tV=function($){return/\p{Sc}/u.test($)};var t$=0;var tq=0;var tG=[{line:1,column:1}];var tY=0;var tK=[];var tZ=0;var tJ;if("startRule"in et){if(!(et.startRule in eo)){throw new Error("Can't start parsing from rule \""+et.startRule+'".')}es=eo[et.startRule]}function tX(){return $.substring(tq,t$)}function tQ(){return tq}function t0(){return{source:ei,start:tq,end:t$}}function t6(){return ri(tq,t$)}function t4(ee,et){et=et!==undefined?et:ri(tq,t$);throw rl([rr(ee)],$.substring(tq,t$),et)}function t3($,ee){ee=ee!==undefined?ee:ri(tq,t$);throw ru($,ee)}function t8($,ee){return{type:"literal",text:$,ignoreCase:ee}}function t5($,ee,et){return{type:"class",parts:$,inverted:ee,ignoreCase:et}}function t9(){return{type:"any"}}function t7(){return{type:"end"}}function rr($){return{type:"other",description:$}}function rn(ee){var et=tG[ee];var en;if(et){return et}else{en=ee-1;while(!tG[en]){en--}et=tG[en];et={line:et.line,column:et.column};while(en<ee){if($.charCodeAt(en)===10){et.line++;et.column=1}else{et.column++}en++}tG[ee]=et;return et}}function ri($,ee,et){var en=rn($);var eo=rn(ee);var es={source:ei,start:{offset:$,line:en.line,column:en.column},end:{offset:ee,line:eo.line,column:eo.column}};if(et&&ei&&typeof ei.offset==="function"){es.start=ei.offset(es.start);es.end=ei.offset(es.end)}return es}function ro($){if(t$<tY){return}if(t$>tY){tY=t$;tK=[]}tK.push($)}function ru($,et){return new ee($,null,null,et)}function rl($,et,en){return new ee(ee.buildMessage($,et),$,et,en)}function rc(){var $,ee,et,ei,eo,es,eu,el,ef,ed,ep,eh,ey,eg;$=t$;ee=rI();if(ee===en){ee=null}et=rD();if(et===en){et=null}ei=rh();if(ei!==en){eo=rW();if(eo!==en){tq=$;$=tw(ee,ei,eo)}else{t$=$;$=en}}else{t$=$;$=en}if($===en){$=t$;ee=rI();if(ee===en){ee=null}et=rD();if(et===en){et=null}ei=rM();if(ei!==en){eo=rD();if(eo!==en){es=rE();if(es!==en){eu=rD();if(eu!==en){el=ry();if(el!==en){ef=rD();if(ef!==en){ed=rS();if(ed!==en){ep=rD();if(ep!==en){eh=rU();if(eh!==en){ey=rp();if(ey===en){ey=null}tq=$;$=tE(ee,ei,el,eh,ey)}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}if($===en){$=t$;ee=rI();if(ee===en){ee=null}et=rD();if(et===en){et=null}ei=rM();if(ei!==en){eo=rD();if(eo!==en){es=rv();if(es!==en){eu=rD();if(eu!==en){el=rF();if(el!==en){ef=rg();if(ef===en){ef=null}ed=t$;ep=rD();if(ep!==en){eh=rE();if(eh!==en){ey=rD();if(ey!==en){eg=rf();if(eg!==en){ep=[ep,eh,ey,eg];ed=ep}else{t$=ed;ed=en}}else{t$=ed;ed=en}}else{t$=ed;ed=en}}else{t$=ed;ed=en}if(ed===en){ed=null}tq=$;$=tS(ee,ei,el,ef,ed)}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}if($===en){$=t$;ee=rI();if(ee===en){ee=null}et=rD();if(et===en){et=null}ei=rM();if(ei!==en){eo=rp();if(eo===en){eo=null}tq=$;$=tT(ee,ei,eo)}else{t$=$;$=en}if($===en){$=t$;ee=rI();if(ee===en){ee=null}et=rD();if(et===en){et=null}ei=rp();if(ei!==en){tq=$;$=tO(ee,ei)}else{t$=$;$=en}if($===en){$=t$;ee=rI();if(ee===en){ee=null}et=rD();if(et===en){et=null}ei=rO();if(ei!==en){eo=rD();if(eo!==en){es=rA();if(es===en){es=null}eu=rW();if(eu!==en){tq=$;$=tA(ee,es,eu)}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}if($===en){$=t$;ee=rI();if(ee===en){ee=null}et=rD();if(et===en){et=null}ei=rN();if(ei!==en){tq=$;$=tI(ee,ei)}else{t$=$;$=en}}}}}}}return $}function rf(){var ee,et,ei,eo;tZ++;ee=t$;if($.substr(t$,5).toLowerCase()===eu){et=$.substr(t$,5);t$+=5}else{et=en;if(tZ===0){ro(ej)}}if(et!==en){tq=ee;et=tN()}ee=et;if(ee===en){ee=t$;et=rk();if(et!==en){ei=rD();if(ei!==en){if($.substr(t$,6).toLowerCase()===el){eo=$.substr(t$,6);t$+=6}else{eo=en;if(tZ===0){ro(eW)}}if(eo!==en){tq=ee;ee=tD(et)}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}if(ee===en){ee=t$;if($.substr(t$,4).toLowerCase()===ef){et=$.substr(t$,4);t$+=4}else{et=en;if(tZ===0){ro(eH)}}if(et!==en){tq=ee;et=tR()}ee=et;if(ee===en){ee=t$;et=rk();if(et!==en){ei=rD();if(ei!==en){if($.substr(t$,5).toLowerCase()===ed){eo=$.substr(t$,5);t$+=5}else{eo=en;if(tZ===0){ro(ez)}}if(eo!==en){tq=ee;ee=tC(et)}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}}}tZ--;if(ee===en){et=en;if(tZ===0){ro(eU)}}return ee}function rp(){var ee,et,ei,eo,es,eu,el;ee=t$;et=rD();if(et===en){et=null}ei=rT();if(ei!==en){eo=rD();if(eo!==en){es=rM();if(es!==en){eu=rD();if(eu!==en){if($.substr(t$,4).toLowerCase()===ep){el=$.substr(t$,4);t$+=4}else{el=en;if(tZ===0){ro(eV)}}if(el!==en){tq=ee;ee=tk(es)}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}if(ee===en){ee=t$;et=rD();if(et===en){et=null}ei=rT();if(ei!==en){eo=rD();if(eo!==en){es=rM();if(es!==en){tq=ee;ee=tM(es)}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}return ee}function rh(){var ee,et,ei,eo,es,eu,el;ee=t$;et=rL();if(et!==en){ei=rD();if(ei!==en){eo=rw();if(eo!==en){es=rD();if(es!==en){if($.substr(t$,8).toLowerCase()===eh){eu=$.substr(t$,8);t$+=8}else{eu=en;if(tZ===0){ro(e$)}}if(eu!==en){el=rD();if(el!==en){tq=ee;ee=tL(et)}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}if(ee===en){ee=t$;et=rL();if(et!==en){ei=rD();if(ei!==en){eo=rw();if(eo!==en){es=rD();if(es!==en){tq=ee;ee=tx(et)}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}return ee}function ry(){var $,ee,et,ei;$=t$;ee=rm();if(ee!==en){tq=$;ee=tP()}$=ee;if($===en){$=t$;ee=rC();if(ee!==en){et=rD();if(et!==en){ei=r_();if(ei!==en){tq=$;$=tF(ee)}else{t$=$;$=en}}else{t$=$;$=en}}else{t$=$;$=en}}return $}function rg(){var ee,et,ei,eo,es,eu,el;ee=t$;et=rD();if(et!==en){if($.substr(t$,5).toLowerCase()===ey){ei=$.substr(t$,5);t$+=5}else{ei=en;if(tZ===0){ro(eq)}}if(ei!==en){eo=rD();if(eo!==en){if($.substr(t$,4).toLowerCase()===eg){es=$.substr(t$,4);t$+=4}else{es=en;if(tZ===0){ro(eG)}}if(es!==en){eu=rD();if(eu!==en){el=rF();if(el!==en){tq=ee;ee=tB(el)}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}return ee}function rm(){var ee;if($.substr(t$,4).toLowerCase()===em){ee=$.substr(t$,4);t$+=4}else{ee=en;if(tZ===0){ro(eY)}}return ee}function r_(){var ee;if($.substr(t$,5).toLowerCase()===e_){ee=$.substr(t$,5);t$+=5}else{ee=en;if(tZ===0){ro(eK)}}return ee}function rv(){var ee;if($.substr(t$,2).toLowerCase()===ew){ee=$.substr(t$,2);t$+=2}else{ee=en;if(tZ===0){ro(eZ)}}return ee}function rw(){var ee;if($.substr(t$,2).toLowerCase()===eE){ee=$.substr(t$,2);t$+=2}else{ee=en;if(tZ===0){ro(eJ)}}return ee}function rE(){var ee,et,ei,eo;ee=t$;if($.substr(t$,6).toLowerCase()===eS){et=$.substr(t$,6);t$+=6}else{et=en;if(tZ===0){ro(eX)}}if(et!==en){ei=rD();if(ei!==en){if($.substr(t$,5).toLowerCase()===eT){eo=$.substr(t$,5);t$+=5}else{eo=en;if(tZ===0){ro(eQ)}}if(eo!==en){et=[et,ei,eo];ee=et}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}return ee}function rS(){var ee;if($.substr(t$,8).toLowerCase()===eO){ee=$.substr(t$,8);t$+=8}else{ee=en;if(tZ===0){ro(e0)}}return ee}function rT(){var ee,et,ei,eo;ee=t$;if($.substr(t$,2).toLowerCase()===eA){et=$.substr(t$,2);t$+=2}else{et=en;if(tZ===0){ro(e1)}}if(et!==en){ei=rD();if(ei!==en){if($.substr(t$,2).toLowerCase()===eI){eo=$.substr(t$,2);t$+=2}else{eo=en;if(tZ===0){ro(e2)}}if(eo!==en){et=[et,ei,eo];ee=et}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}return ee}function rO(){var ee;if($.substr(t$,8).toLowerCase()===eN){ee=$.substr(t$,8);t$+=8}else{ee=en;if(tZ===0){ro(e6)}}return ee}function rA(){var ee,et,ei;ee=t$;if($.substr(t$,4).toLowerCase()===eD){et=$.substr(t$,4);t$+=4}else{et=en;if(tZ===0){ro(e4)}}if(et!==en){ei=rD();if(ei!==en){tq=ee;ee=tU()}else{t$=ee;ee=en}}else{t$=ee;ee=en}return ee}function rI(){var ee,et,ei,eo;ee=t$;if($.substr(t$,1).toLowerCase()===eR){et=$.charAt(t$);t$++}else{et=en;if(tZ===0){ro(e3)}}if(et!==en){ei=rC();if(ei!==en){eo=rD();if(eo!==en){tq=ee;ee=tj(ei)}else{t$=ee;ee=en}}else{t$=ee;ee=en}}else{t$=ee;ee=en}return ee}function rN(){var ee,et,ei,eo;ee=t$;if($.substr(t$,9).toLowerCase()===eC){et=$.substr(t$,9);t$+=9}else{et=en;if(tZ===0){ro(e8)}}if(et!==en){ei=rD();if(ei===en){ei=null}eo=rk();if(eo===en){eo=null}tq=ee;ee=tW(eo)}else{t$=ee;ee=en}return ee}function rD(){var ee,et;tZ++;ee=[];if($.charCodeAt(t$)===32){et=ek;t$++}else{et=en;if(tZ===0){ro(e9)}}if(et!==en){while(et!==en){ee.push(et);if($.charCodeAt(t$)===32){et=ek;t$++}else{et=en;if(tZ===0){ro(e9)}}}}else{ee=en}tZ--;if(ee===en){et=en;if(tZ===0){ro(e5)}}return ee}function rR(){var ee,et;tZ++;if(eP.test($.charAt(t$))){ee=$.charAt(t$);t$++}else{ee=en;if(tZ===0){ro(te)}}tZ--;if(ee===en){et=en;if(tZ===0){ro(e7)}}return ee}function rC(){var ee,et,ei;tZ++;ee=t$;et=[];ei=rR();if(ei!==en){while(ei!==en){et.push(ei);ei=rR()}}else{et=en}if(et!==en){ee=$.substring(ee,t$)}else{ee=et}tZ--;if(ee===en){et=en;if(tZ===0){ro(tt)}}return ee}function rk(){var ee,et,ei,eo,es;ee=t$;et=t$;if(eF.test($.charAt(t$))){ei=$.charAt(t$);t$++}else{ei=en;if(tZ===0){ro(tr)}}if(ei!==en){eo=[];if(eP.test($.charAt(t$))){es=$.charAt(t$);t$++}else{es=en;if(tZ===0){ro(te)}}while(es!==en){eo.push(es);if(eP.test($.charAt(t$))){es=$.charAt(t$);t$++}else{es=en;if(tZ===0){ro(te)}}}ei=[ei,eo];et=ei}else{t$=et;et=en}if(et!==en){ee=$.substring(ee,t$)}else{ee=et}return ee}function rM(){var ee,et,ei,eo,es,eu,el,ef,ed,ep,eh;tZ++;ee=t$;et=rj();if(et===en){et=null}ei=rD();if(ei===en){ei=null}eo=t$;es=t$;eu=[];el=rR();if(el!==en){while(el!==en){eu.push(el);el=rR()}}else{eu=en}if(eu!==en){el=t$;if($.charCodeAt(t$)===46){ef=eM;t$++}else{ef=en;if(tZ===0){ro(ti)}}if(ef!==en){ed=t$;ep=rR();if(ep!==en){eh=rR();if(eh===en){eh=null}ep=[ep,eh];ed=ep}else{t$=ed;ed=en}if(ed===en){ed=null}ef=[ef,ed];el=ef}else{t$=el;el=en}if(el===en){el=null}eu=[eu,el];es=eu}else{t$=es;es=en}if(es!==en){eo=$.substring(eo,t$)}else{eo=es}if(eo!==en){tq=ee;ee=tH(eo)}else{t$=ee;ee=en}tZ--;if(ee===en){et=en;if(tZ===0){ro(tn)}}return ee}function rL(){var ee,et,ei,eo;tZ++;ee=t$;et=t$;ei=[];eo=rR();if(eo!==en){while(eo!==en){ei.push(eo);eo=rR()}}else{ei=en}if(ei!==en){et=$.substring(et,t$)}else{et=ei}if(et!==en){ei=rD();if(ei===en){ei=null}if($.charCodeAt(t$)===37){eo=eL;t$++}else{eo=en;if(tZ===0){ro(tc)}}if(eo!==en){tq=ee;ee=tz(et)}else{t$=ee;ee=en}}else{t$=ee;ee=en}tZ--;if(ee===en){et=en;if(tZ===0){ro(tu)}}return ee}function rP(){var ee,et,ei,eo,es,eu;tZ++;ee=t$;et=t$;ei=rR();if(ei!==en){eo=rR();if(eo!==en){es=rR();if(es!==en){eu=rR();if(eu!==en){ei=[ei,eo,es,eu];et=ei}else{t$=et;et=en}}else{t$=et;et=en}}else{t$=et;et=en}}else{t$=et;et=en}if(et!==en){ee=$.substring(ee,t$)}else{ee=et}tZ--;if(ee===en){et=en;if(tZ===0){ro(tf)}}return ee}function rF(){var ee,et,ei,eo,es,eu;tZ++;ee=t$;et=t$;ei=rP();if(ei!==en){if($.charCodeAt(t$)===45){eo=eR;t$++}else{eo=en;if(tZ===0){ro(tp)}}if(eo!==en){es=rR();if(es!==en){eu=rR();if(eu!==en){ei=[ei,eo,es,eu];et=ei}else{t$=et;et=en}}else{t$=et;et=en}}else{t$=et;et=en}}else{t$=et;et=en}if(et!==en){ee=$.substring(ee,t$)}else{ee=et}tZ--;if(ee===en){et=en;if(tZ===0){ro(td)}}return ee}function rB(){var ee,et,ei,eo;tZ++;ee=t$;et=t$;ei=rR();if(ei!==en){eo=rR();if(eo!==en){ei=[ei,eo];et=ei}else{t$=et;et=en}}else{t$=et;et=en}if(et!==en){ee=$.substring(ee,t$)}else{ee=et}tZ--;if(ee===en){et=en;if(tZ===0){ro(th)}}return ee}function rU(){var ee,et,ei,eo,es;ee=t$;et=t$;ei=rF();if(ei!==en){if($.charCodeAt(t$)===45){eo=eR;t$++}else{eo=en;if(tZ===0){ro(tp)}}if(eo!==en){es=rB();if(es!==en){ei=[ei,eo,es];et=ei}else{t$=et;et=en}}else{t$=et;et=en}}else{t$=et;et=en}if(et!==en){ee=$.substring(ee,t$)}else{ee=et}return ee}function rj(){var ee,et,ei;tZ++;ee=t$;if($.length>t$){et=$.charAt(t$);t$++}else{et=en;if(tZ===0){ro(tm)}}if(et!==en){tq=t$;ei=tV(et);if(ei){ei=undefined}else{ei=en}if(ei!==en){et=[et,ei];ee=et}else{t$=ee;ee=en}}else{t$=ee;ee=en}tZ--;if(ee===en){et=en;if(tZ===0){ro(ty)}}return ee}function rW(){var ee,et,ei;tZ++;ee=t$;et=[];if(eB.test($.charAt(t$))){ei=$.charAt(t$);t$++}else{ei=en;if(tZ===0){ro(tv)}}if(ei!==en){while(ei!==en){et.push(ei);if(eB.test($.charAt(t$))){ei=$.charAt(t$);t$++}else{ei=en;if(tZ===0){ro(tv)}}}}else{et=en}if(et!==en){ee=$.substring(ee,t$)}else{ee=et}tZ--;if(ee===en){et=en;if(tZ===0){ro(t_)}}return ee}tJ=es();if(tJ!==en&&t$===$.length){return tJ}else{if(tJ!==en&&t$<$.length){ro(t7())}throw rl(tK,tY<$.length?$.charAt(tY):null,tY<$.length?ri(tY,tY+1):ri(tY,tY))}}return{SyntaxError:ee,parse:en}})},2074:()=>{},1214:()=>{},8119:()=>{},4654:()=>{},2361:()=>{},4616:()=>{},8441:()=>{},3083:($,ee,et)=>{"use strict";var en=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"];var ei=typeof globalThis==="undefined"?et.g:globalThis;$.exports=function $(){var $=[];for(var ee=0;ee<en.length;ee++){if(typeof ei[en[ee]]==="function"){$[$.length]=en[ee]}}return $}},3216:($,ee,et)=>{"use strict";var en=et(4155);var ei=et(2584);var eo=et(6373);if(et(1405)()||et(5419)()){var es=Symbol.iterator;$.exports=function $($){if($!=null&&typeof $[es]!=="undefined"){return $[es]()}if(ei($)){return Array.prototype[es].call($)}}}else{var eu=et(5826);var el=et(9981);var ef=et(210);var ed=ef("%Map%",true);var ep=ef("%Set%",true);var eh=et(1924);var ey=eh("Array.prototype.push");var eg=eh("String.prototype.charCodeAt");var em=eh("String.prototype.slice");var e_=function $($,ee){var et=$.length;if(ee+1>=et){return ee+1}var en=eg($,ee);if(en<55296||en>56319){return ee+1}var ei=eg($,ee+1);if(ei<56320||ei>57343){return ee+1}return ee+2};var ew=function $($){var ee=0;return{next:function et(){var et=ee>=$.length;var en;if(!et){en=$[ee];ee+=1}return{done:et,value:en}}}};var eE=function $($,ee){if(eu($)||ei($)){return ew($)}if(el($)){var et=0;return{next:function ee(){var ee=e_($,et);var en=em($,et,ee);et=ee;return{done:ee>$.length,value:en}}}}if(ee&&typeof $["_es6-shim iterator_"]!=="undefined"){return $["_es6-shim iterator_"]()}};if(!ed&&!ep){$.exports=function $($){if($!=null){return eE($,true)}}}else{var eS=et(8379);var eT=et(9572);var eO=eh("Map.prototype.forEach",true);var eA=eh("Set.prototype.forEach",true);if(typeof en==="undefined"||!en.versions||!en.versions.node){var eI=eh("Map.prototype.iterator",true);var eN=eh("Set.prototype.iterator",true)}var eD=eh("Map.prototype.@@iterator",true)||eh("Map.prototype._es6-shim iterator_",true);var eR=eh("Set.prototype.@@iterator",true)||eh("Set.prototype._es6-shim iterator_",true);var eC=function $($){if(eS($)){if(eI){return eo(eI($))}if(eD){return eD($)}if(eO){var ee=[];eO($,function($,et){ey(ee,[et,$])});return ew(ee)}}if(eT($)){if(eN){return eo(eN($))}if(eR){return eR($)}if(eA){var et=[];eA($,function($){ey(et,$)});return ew(et)}}};$.exports=function $($){return eC($)||eE($)}}}},3483:($,ee,et)=>{"use strict";var en=et(8379);var ei=et(9572);var eo=et(1718);var es=et(5899);$.exports=function $($){if($&&typeof $==="object"){if(en($)){return"Map"}if(ei($)){return"Set"}if(eo($)){return"WeakMap"}if(es($)){return"WeakSet"}}return false}}};var __webpack_module_cache__={};function __webpack_require__($){var ee=__webpack_module_cache__[$];if(ee!==undefined){return ee.exports}var et=__webpack_module_cache__[$]={id:$,loaded:false,exports:{}};__webpack_modules__[$].call(et.exports,et,et.exports,__webpack_require__);et.loaded=true;return et.exports}__webpack_require__.m=__webpack_modules__;(()=>{__webpack_require__.n=$=>{var ee=$&&$.__esModule?()=>$["default"]:()=>$;__webpack_require__.d(ee,{a:ee});return ee}})();(()=>{__webpack_require__.d=($,ee)=>{for(var et in ee){if(__webpack_require__.o(ee,et)&&!__webpack_require__.o($,et)){Object.defineProperty($,et,{enumerable:true,get:ee[et]})}}}})();(()=>{__webpack_require__.f={};__webpack_require__.e=$=>{return Promise.all(Object.keys(__webpack_require__.f).reduce((ee,et)=>{__webpack_require__.f[et]($,ee);return ee},[]))}})();(()=>{__webpack_require__.u=$=>{return""+$+"."+$+".kcab.worker."+"2ee5d7175d50b7896f28"+".js"}})();(()=>{__webpack_require__.g=function(){if(typeof globalThis==="object")return globalThis;try{return this||new Function("return this")()}catch($){if(typeof window==="object")return window}}()})();(()=>{__webpack_require__.o=($,ee)=>Object.prototype.hasOwnProperty.call($,ee)})();(()=>{__webpack_require__.r=$=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty($,Symbol.toStringTag,{value:"Module"})}Object.defineProperty($,"__esModule",{value:true})}})();(()=>{__webpack_require__.nmd=$=>{$.paths=[];if(!$.children)$.children=[];return $}})();(()=>{__webpack_require__.p="/kcab/"})();(()=>{var $={"main":1};var ee=ee=>{var[et,ei,eo]=ee;for(var es in ei){if(__webpack_require__.o(ei,es)){__webpack_require__.m[es]=ei[es]}}if(eo)eo(__webpack_require__);while(et.length)$[et.pop()]=1;en(ee)};__webpack_require__.f.i=(ee,et)=>{if(!$[ee]){if(true){importScripts(__webpack_require__.p+__webpack_require__.u(ee))}}};var et=self["webpackChunkbackend"]=self["webpackChunkbackend"]||[];var en=et.push.bind(et);et.push=ee})();var __webpack_exports__={};(()=>{"use strict";__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{handlers:()=>Ei,init:()=>Ef,initApp:()=>Ec,lib:()=>Ed});var $={};__webpack_require__.r($);__webpack_require__.d($,{all:()=>f4,asyncTransaction:()=>f6,cache:()=>f0,closeDatabase:()=>fG,deleteAccount:()=>dP,deleteCategory:()=>dE,deleteCategoryGroup:()=>dm,deletePayee:()=>dO,deleteTransaction:()=>dz,deleteTransferPayee:()=>dA,delete_:()=>dn,execQuery:()=>fX,first:()=>f3,firstSync:()=>f8,fromDateRepr:()=>oZ,getAccounts:()=>dM,getCategories:()=>df,getCategoriesGrouped:()=>dp,getDatabase:()=>fK,getDatabasePath:()=>fV,getOrphanedPayees:()=>dC,getPayee:()=>dS,getPayeeByName:()=>dk,getPayees:()=>dD,getTransaction:()=>dB,getTransactions:()=>dj,getTransactionsByDate:()=>dU,insert:()=>dr,insertAccount:()=>dL,insertCategory:()=>d_,insertCategoryGroup:()=>dh,insertPayee:()=>dT,insertTransaction:()=>dW,insertWithSchema:()=>du,insertWithUUID:()=>de,loadClock:()=>fZ,mergePayees:()=>dN,moveAccount:()=>dF,moveCategory:()=>dw,moveCategoryGroup:()=>dg,openDatabase:()=>f$,reopenDatabase:()=>fq,run:()=>f5,runQuery:()=>fJ,select:()=>f9,selectFirstWithSchema:()=>ds,selectWithSchema:()=>di,setDatabase:()=>fY,syncGetOrphanedPayees:()=>dR,toDateRepr:()=>oK,transaction:()=>f2,update:()=>f7,updateAccount:()=>dx,updateCategory:()=>dv,updateCategoryGroup:()=>dy,updatePayee:()=>dI,updateTransaction:()=>dH,updateWithSchema:()=>dl});var ee={};__webpack_require__.r(ee);__webpack_require__.d(ee,{doImport:()=>wd,getBudgetName:()=>wp,parseFile:()=>wg});var et={};__webpack_require__.r(et);__webpack_require__.d(et,{doImport:()=>wT,getBudgetName:()=>wA,parseFile:()=>wO});var en;function ei($){en=$}var eo=__webpack_require__(8393);const es=typeof crypto!=="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const eu={randomUUID:es};let el;const ef=new Uint8Array(16);function ed(){if(!el){el=typeof crypto!=="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto);if(!el){throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}}return el(ef)};const ep=[];for(let $=0;$<256;++$){ep.push(($+256).toString(16).slice(1))}function eh($,ee=0){return(ep[$[ee+0]]+ep[$[ee+1]]+ep[$[ee+2]]+ep[$[ee+3]]+"-"+ep[$[ee+4]]+ep[$[ee+5]]+"-"+ep[$[ee+6]]+ep[$[ee+7]]+"-"+ep[$[ee+8]]+ep[$[ee+9]]+"-"+ep[$[ee+10]]+ep[$[ee+11]]+ep[$[ee+12]]+ep[$[ee+13]]+ep[$[ee+14]]+ep[$[ee+15]]).toLowerCase()}function ey($,ee=0){const et=eh($,ee);if(!validate(et)){throw TypeError("Stringified UUID is invalid")}return et}const eg=null&&ey;function em($,ee,et){if(eu.randomUUID&&!ee&&!$){return eu.randomUUID()}$=$||{};const en=$.random||($.rng||ed)();en[6]=en[6]&15|64;en[8]=en[8]&63|128;if(ee){et=et||0;for(let $=0;$<16;++$){ee[et+$]=en[$]}return ee}return eh(en)}const e_=em;function ew($){"@babel/helpers - typeof";return ew="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function($){return typeof $}:function($){return $&&"function"==typeof Symbol&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},ew($)};function eE($,ee){if(ee.length<$){throw new TypeError($+" argument"+($>1?"s":"")+" required, but only "+ee.length+" present")}};function eS($){eE(1,arguments);var ee=Object.prototype.toString.call($);if($ instanceof Date||ew($)==="object"&&ee==="[object Date]"){return new Date($.getTime())}else if(typeof $==="number"||ee==="[object Number]"){return new Date($)}else{if((typeof $==="string"||ee==="[object String]")&&typeof console!=="undefined"){console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");console.warn(new Error().stack)}return new Date(NaN)}};function eT($){eE(1,arguments);var ee;if($&&typeof $.forEach==="function"){ee=$}else if(ew($)==="object"&&$!==null){ee=Array.prototype.slice.call($)}else{return new Date(NaN)}var et;ee.forEach(function($){var ee=eS($);if(et===undefined||et<ee||isNaN(Number(ee))){et=ee}});return et||new Date(NaN)};function eO($){eE(1,arguments);return $ instanceof Date||ew($)==="object"&&Object.prototype.toString.call($)==="[object Date]"};function eA($){eE(1,arguments);if(!eO($)&&typeof $!=="number"){return false}var ee=eS($);return!isNaN(Number(ee))};function eI($){if($===null||$===true||$===false){return NaN}var ee=Number($);if(isNaN(ee)){return ee}return ee<0?Math.ceil(ee):Math.floor(ee)};function eN($,ee){eE(2,arguments);var et=eS($).getTime();var en=eI(ee);return new Date(et+en)};function eD($,ee){eE(2,arguments);var et=eI(ee);return eN($,-et)};var eR=864e5;function eC($){eE(1,arguments);var ee=eS($);var et=ee.getTime();ee.setUTCMonth(0,1);ee.setUTCHours(0,0,0,0);var en=ee.getTime();var ei=et-en;return Math.floor(ei/eR)+1};function ek($){eE(1,arguments);var ee=1;var et=eS($);var en=et.getUTCDay();var ei=(en<ee?7:0)+en-ee;et.setUTCDate(et.getUTCDate()-ei);et.setUTCHours(0,0,0,0);return et};function eM($){eE(1,arguments);var ee=eS($);var et=ee.getUTCFullYear();var en=new Date(0);en.setUTCFullYear(et+1,0,4);en.setUTCHours(0,0,0,0);var ei=ek(en);var eo=new Date(0);eo.setUTCFullYear(et,0,4);eo.setUTCHours(0,0,0,0);var es=ek(eo);if(ee.getTime()>=ei.getTime()){return et+1}else if(ee.getTime()>=es.getTime()){return et}else{return et-1}};function eL($){eE(1,arguments);var ee=eM($);var et=new Date(0);et.setUTCFullYear(ee,0,4);et.setUTCHours(0,0,0,0);var en=ek(et);return en};var eP=6048e5;function eF($){eE(1,arguments);var ee=eS($);var et=ek(ee).getTime()-eL(ee).getTime();return Math.round(et/eP)+1};var eB={};function eU(){return eB}function ej($){eB=$};function eW($,ee){var et,en,ei,eo,es,eu,el,ef;eE(1,arguments);var ed=eU();var ep=eI((et=(en=(ei=(eo=ee===null||ee===void 0?void 0:ee.weekStartsOn)!==null&&eo!==void 0?eo:ee===null||ee===void 0?void 0:(es=ee.locale)===null||es===void 0?void 0:(eu=es.options)===null||eu===void 0?void 0:eu.weekStartsOn)!==null&&ei!==void 0?ei:ed.weekStartsOn)!==null&&en!==void 0?en:(el=ed.locale)===null||el===void 0?void 0:(ef=el.options)===null||ef===void 0?void 0:ef.weekStartsOn)!==null&&et!==void 0?et:0);if(!(ep>=0&&ep<=6)){throw new RangeError("weekStartsOn must be between 0 and 6 inclusively")}var eh=eS($);var ey=eh.getUTCDay();var eg=(ey<ep?7:0)+ey-ep;eh.setUTCDate(eh.getUTCDate()-eg);eh.setUTCHours(0,0,0,0);return eh};function eH($,ee){var et,en,ei,eo,es,eu,el,ef;eE(1,arguments);var ed=eS($);var ep=ed.getUTCFullYear();var eh=eU();var ey=eI((et=(en=(ei=(eo=ee===null||ee===void 0?void 0:ee.firstWeekContainsDate)!==null&&eo!==void 0?eo:ee===null||ee===void 0?void 0:(es=ee.locale)===null||es===void 0?void 0:(eu=es.options)===null||eu===void 0?void 0:eu.firstWeekContainsDate)!==null&&ei!==void 0?ei:eh.firstWeekContainsDate)!==null&&en!==void 0?en:(el=eh.locale)===null||el===void 0?void 0:(ef=el.options)===null||ef===void 0?void 0:ef.firstWeekContainsDate)!==null&&et!==void 0?et:1);if(!(ey>=1&&ey<=7)){throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively")}var eg=new Date(0);eg.setUTCFullYear(ep+1,0,ey);eg.setUTCHours(0,0,0,0);var em=eW(eg,ee);var e_=new Date(0);e_.setUTCFullYear(ep,0,ey);e_.setUTCHours(0,0,0,0);var ew=eW(e_,ee);if(ed.getTime()>=em.getTime()){return ep+1}else if(ed.getTime()>=ew.getTime()){return ep}else{return ep-1}};function ez($,ee){var et,en,ei,eo,es,eu,el,ef;eE(1,arguments);var ed=eU();var ep=eI((et=(en=(ei=(eo=ee===null||ee===void 0?void 0:ee.firstWeekContainsDate)!==null&&eo!==void 0?eo:ee===null||ee===void 0?void 0:(es=ee.locale)===null||es===void 0?void 0:(eu=es.options)===null||eu===void 0?void 0:eu.firstWeekContainsDate)!==null&&ei!==void 0?ei:ed.firstWeekContainsDate)!==null&&en!==void 0?en:(el=ed.locale)===null||el===void 0?void 0:(ef=el.options)===null||ef===void 0?void 0:ef.firstWeekContainsDate)!==null&&et!==void 0?et:1);var eh=eH($,ee);var ey=new Date(0);ey.setUTCFullYear(eh,0,ep);ey.setUTCHours(0,0,0,0);var eg=eW(ey,ee);return eg};var eV=6048e5;function e$($,ee){eE(1,arguments);var et=eS($);var en=eW(et,ee).getTime()-ez(et,ee).getTime();return Math.round(en/eV)+1};function eq($,ee){var et=$<0?"-":"";var en=Math.abs($).toString();while(en.length<ee){en="0"+en}return et+en};var eG={y:function $($,ee){var et=$.getUTCFullYear();var en=et>0?et:1-et;return eq(ee==="yy"?en%100:en,ee.length)},M:function $($,ee){var et=$.getUTCMonth();return ee==="M"?String(et+1):eq(et+1,2)},d:function $($,ee){return eq($.getUTCDate(),ee.length)},a:function $($,ee){var et=$.getUTCHours()/12>=1?"pm":"am";switch(ee){case"a":case"aa":return et.toUpperCase();case"aaa":return et;case"aaaaa":return et[0];case"aaaa":default:return et==="am"?"a.m.":"p.m."}},h:function $($,ee){return eq($.getUTCHours()%12||12,ee.length)},H:function $($,ee){return eq($.getUTCHours(),ee.length)},m:function $($,ee){return eq($.getUTCMinutes(),ee.length)},s:function $($,ee){return eq($.getUTCSeconds(),ee.length)},S:function $($,ee){var et=ee.length;var en=$.getUTCMilliseconds();var ei=Math.floor(en*Math.pow(10,et-3));return eq(ei,ee.length)}};const eY=eG;var eK={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"};var eZ={G:function $($,ee,et){var en=$.getUTCFullYear()>0?1:0;switch(ee){case"G":case"GG":case"GGG":return et.era(en,{width:"abbreviated"});case"GGGGG":return et.era(en,{width:"narrow"});case"GGGG":default:return et.era(en,{width:"wide"})}},y:function $($,ee,et){if(ee==="yo"){var en=$.getUTCFullYear();var ei=en>0?en:1-en;return et.ordinalNumber(ei,{unit:"year"})}return eY.y($,ee)},Y:function $($,ee,et,en){var ei=eH($,en);var eo=ei>0?ei:1-ei;if(ee==="YY"){var es=eo%100;return eq(es,2)}if(ee==="Yo"){return et.ordinalNumber(eo,{unit:"year"})}return eq(eo,ee.length)},R:function $($,ee){var et=eM($);return eq(et,ee.length)},u:function $($,ee){var et=$.getUTCFullYear();return eq(et,ee.length)},Q:function $($,ee,et){var en=Math.ceil(($.getUTCMonth()+1)/3);switch(ee){case"Q":return String(en);case"QQ":return eq(en,2);case"Qo":return et.ordinalNumber(en,{unit:"quarter"});case"QQQ":return et.quarter(en,{width:"abbreviated",context:"formatting"});case"QQQQQ":return et.quarter(en,{width:"narrow",context:"formatting"});case"QQQQ":default:return et.quarter(en,{width:"wide",context:"formatting"})}},q:function $($,ee,et){var en=Math.ceil(($.getUTCMonth()+1)/3);switch(ee){case"q":return String(en);case"qq":return eq(en,2);case"qo":return et.ordinalNumber(en,{unit:"quarter"});case"qqq":return et.quarter(en,{width:"abbreviated",context:"standalone"});case"qqqqq":return et.quarter(en,{width:"narrow",context:"standalone"});case"qqqq":default:return et.quarter(en,{width:"wide",context:"standalone"})}},M:function $($,ee,et){var en=$.getUTCMonth();switch(ee){case"M":case"MM":return eY.M($,ee);case"Mo":return et.ordinalNumber(en+1,{unit:"month"});case"MMM":return et.month(en,{width:"abbreviated",context:"formatting"});case"MMMMM":return et.month(en,{width:"narrow",context:"formatting"});case"MMMM":default:return et.month(en,{width:"wide",context:"formatting"})}},L:function $($,ee,et){var en=$.getUTCMonth();switch(ee){case"L":return String(en+1);case"LL":return eq(en+1,2);case"Lo":return et.ordinalNumber(en+1,{unit:"month"});case"LLL":return et.month(en,{width:"abbreviated",context:"standalone"});case"LLLLL":return et.month(en,{width:"narrow",context:"standalone"});case"LLLL":default:return et.month(en,{width:"wide",context:"standalone"})}},w:function $($,ee,et,en){var ei=e$($,en);if(ee==="wo"){return et.ordinalNumber(ei,{unit:"week"})}return eq(ei,ee.length)},I:function $($,ee,et){var en=eF($);if(ee==="Io"){return et.ordinalNumber(en,{unit:"week"})}return eq(en,ee.length)},d:function $($,ee,et){if(ee==="do"){return et.ordinalNumber($.getUTCDate(),{unit:"date"})}return eY.d($,ee)},D:function $($,ee,et){var en=eC($);if(ee==="Do"){return et.ordinalNumber(en,{unit:"dayOfYear"})}return eq(en,ee.length)},E:function $($,ee,et){var en=$.getUTCDay();switch(ee){case"E":case"EE":case"EEE":return et.day(en,{width:"abbreviated",context:"formatting"});case"EEEEE":return et.day(en,{width:"narrow",context:"formatting"});case"EEEEEE":return et.day(en,{width:"short",context:"formatting"});case"EEEE":default:return et.day(en,{width:"wide",context:"formatting"})}},e:function $($,ee,et,en){var ei=$.getUTCDay();var eo=(ei-en.weekStartsOn+8)%7||7;switch(ee){case"e":return String(eo);case"ee":return eq(eo,2);case"eo":return et.ordinalNumber(eo,{unit:"day"});case"eee":return et.day(ei,{width:"abbreviated",context:"formatting"});case"eeeee":return et.day(ei,{width:"narrow",context:"formatting"});case"eeeeee":return et.day(ei,{width:"short",context:"formatting"});case"eeee":default:return et.day(ei,{width:"wide",context:"formatting"})}},c:function $($,ee,et,en){var ei=$.getUTCDay();var eo=(ei-en.weekStartsOn+8)%7||7;switch(ee){case"c":return String(eo);case"cc":return eq(eo,ee.length);case"co":return et.ordinalNumber(eo,{unit:"day"});case"ccc":return et.day(ei,{width:"abbreviated",context:"standalone"});case"ccccc":return et.day(ei,{width:"narrow",context:"standalone"});case"cccccc":return et.day(ei,{width:"short",context:"standalone"});case"cccc":default:return et.day(ei,{width:"wide",context:"standalone"})}},i:function $($,ee,et){var en=$.getUTCDay();var ei=en===0?7:en;switch(ee){case"i":return String(ei);case"ii":return eq(ei,ee.length);case"io":return et.ordinalNumber(ei,{unit:"day"});case"iii":return et.day(en,{width:"abbreviated",context:"formatting"});case"iiiii":return et.day(en,{width:"narrow",context:"formatting"});case"iiiiii":return et.day(en,{width:"short",context:"formatting"});case"iiii":default:return et.day(en,{width:"wide",context:"formatting"})}},a:function $($,ee,et){var en=$.getUTCHours();var ei=en/12>=1?"pm":"am";switch(ee){case"a":case"aa":return et.dayPeriod(ei,{width:"abbreviated",context:"formatting"});case"aaa":return et.dayPeriod(ei,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return et.dayPeriod(ei,{width:"narrow",context:"formatting"});case"aaaa":default:return et.dayPeriod(ei,{width:"wide",context:"formatting"})}},b:function $($,ee,et){var en=$.getUTCHours();var ei;if(en===12){ei=eK.noon}else if(en===0){ei=eK.midnight}else{ei=en/12>=1?"pm":"am"}switch(ee){case"b":case"bb":return et.dayPeriod(ei,{width:"abbreviated",context:"formatting"});case"bbb":return et.dayPeriod(ei,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return et.dayPeriod(ei,{width:"narrow",context:"formatting"});case"bbbb":default:return et.dayPeriod(ei,{width:"wide",context:"formatting"})}},B:function $($,ee,et){var en=$.getUTCHours();var ei;if(en>=17){ei=eK.evening}else if(en>=12){ei=eK.afternoon}else if(en>=4){ei=eK.morning}else{ei=eK.night}switch(ee){case"B":case"BB":case"BBB":return et.dayPeriod(ei,{width:"abbreviated",context:"formatting"});case"BBBBB":return et.dayPeriod(ei,{width:"narrow",context:"formatting"});case"BBBB":default:return et.dayPeriod(ei,{width:"wide",context:"formatting"})}},h:function $($,ee,et){if(ee==="ho"){var en=$.getUTCHours()%12;if(en===0)en=12;return et.ordinalNumber(en,{unit:"hour"})}return eY.h($,ee)},H:function $($,ee,et){if(ee==="Ho"){return et.ordinalNumber($.getUTCHours(),{unit:"hour"})}return eY.H($,ee)},K:function $($,ee,et){var en=$.getUTCHours()%12;if(ee==="Ko"){return et.ordinalNumber(en,{unit:"hour"})}return eq(en,ee.length)},k:function $($,ee,et){var en=$.getUTCHours();if(en===0)en=24;if(ee==="ko"){return et.ordinalNumber(en,{unit:"hour"})}return eq(en,ee.length)},m:function $($,ee,et){if(ee==="mo"){return et.ordinalNumber($.getUTCMinutes(),{unit:"minute"})}return eY.m($,ee)},s:function $($,ee,et){if(ee==="so"){return et.ordinalNumber($.getUTCSeconds(),{unit:"second"})}return eY.s($,ee)},S:function $($,ee){return eY.S($,ee)},X:function $($,ee,et,en){var ei=en._originalDate||$;var eo=ei.getTimezoneOffset();if(eo===0){return"Z"}switch(ee){case"X":return eX(eo);case"XXXX":case"XX":return eQ(eo);case"XXXXX":case"XXX":default:return eQ(eo,":")}},x:function $($,ee,et,en){var ei=en._originalDate||$;var eo=ei.getTimezoneOffset();switch(ee){case"x":return eX(eo);case"xxxx":case"xx":return eQ(eo);case"xxxxx":case"xxx":default:return eQ(eo,":")}},O:function $($,ee,et,en){var ei=en._originalDate||$;var eo=ei.getTimezoneOffset();switch(ee){case"O":case"OO":case"OOO":return"GMT"+eJ(eo,":");case"OOOO":default:return"GMT"+eQ(eo,":")}},z:function $($,ee,et,en){var ei=en._originalDate||$;var eo=ei.getTimezoneOffset();switch(ee){case"z":case"zz":case"zzz":return"GMT"+eJ(eo,":");case"zzzz":default:return"GMT"+eQ(eo,":")}},t:function $($,ee,et,en){var ei=en._originalDate||$;var eo=Math.floor(ei.getTime()/1e3);return eq(eo,ee.length)},T:function $($,ee,et,en){var ei=en._originalDate||$;var eo=ei.getTime();return eq(eo,ee.length)}};function eJ($,ee){var et=$>0?"-":"+";var en=Math.abs($);var ei=Math.floor(en/60);var eo=en%60;if(eo===0){return et+String(ei)}var es=ee||"";return et+String(ei)+es+eq(eo,2)}function eX($,ee){if($%60===0){var et=$>0?"-":"+";return et+eq(Math.abs($)/60,2)}return eQ($,ee)}function eQ($,ee){var et=ee||"";var en=$>0?"-":"+";var ei=Math.abs($);var eo=eq(Math.floor(ei/60),2);var es=eq(ei%60,2);return en+eo+et+es}const e0=eZ;var e1=function $($,ee){switch($){case"P":return ee.date({width:"short"});case"PP":return ee.date({width:"medium"});case"PPP":return ee.date({width:"long"});case"PPPP":default:return ee.date({width:"full"})}};var e2=function $($,ee){switch($){case"p":return ee.time({width:"short"});case"pp":return ee.time({width:"medium"});case"ppp":return ee.time({width:"long"});case"pppp":default:return ee.time({width:"full"})}};var e6=function $($,ee){var et=$.match(/(P+)(p+)?/)||[];var en=et[1];var ei=et[2];if(!ei){return e1($,ee)}var eo;switch(en){case"P":eo=ee.dateTime({width:"short"});break;case"PP":eo=ee.dateTime({width:"medium"});break;case"PPP":eo=ee.dateTime({width:"long"});break;case"PPPP":default:eo=ee.dateTime({width:"full"});break}return eo.replace("{{date}}",e1(en,ee)).replace("{{time}}",e2(ei,ee))};var e4={p:e2,P:e6};const e3=e4;function e8($){var ee=new Date(Date.UTC($.getFullYear(),$.getMonth(),$.getDate(),$.getHours(),$.getMinutes(),$.getSeconds(),$.getMilliseconds()));ee.setUTCFullYear($.getFullYear());return $.getTime()-ee.getTime()};var e5=["D","DD"];var e9=["YY","YYYY"];function e7($){return e5.indexOf($)!==-1}function te($){return e9.indexOf($)!==-1}function tt($,ee,et){if($==="YYYY"){throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(ee,"`) for formatting years to the input `").concat(et,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}else if($==="YY"){throw new RangeError("Use `yy` instead of `YY` (in `".concat(ee,"`) for formatting years to the input `").concat(et,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}else if($==="D"){throw new RangeError("Use `d` instead of `D` (in `".concat(ee,"`) for formatting days of the month to the input `").concat(et,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}else if($==="DD"){throw new RangeError("Use `dd` instead of `DD` (in `".concat(ee,"`) for formatting days of the month to the input `").concat(et,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}};var tr={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"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},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"}};var tn=function $($,ee,et){var en;var ei=tr[$];if(typeof ei==="string"){en=ei}else if(ee===1){en=ei.one}else{en=ei.other.replace("{{count}}",ee.toString())}if(et!==null&&et!==void 0&&et.addSuffix){if(et.comparison&&et.comparison>0){return"in "+en}else{return en+" ago"}}return en};const ti=tn;function tu($){return function(){var ee=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var et=ee.width?String(ee.width):$.defaultWidth;var en=$.formats[et]||$.formats[$.defaultWidth];return en}};var tc={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"};var tf={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"};var td={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"};var tp={date:tu({formats:tc,defaultWidth:"full"}),time:tu({formats:tf,defaultWidth:"full"}),dateTime:tu({formats:td,defaultWidth:"full"})};const th=tp;var ty={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};var tm=function $($,ee,et,en){return ty[$]};const t_=tm;function tv($){return function(ee,et){var en=et!==null&&et!==void 0&&et.context?String(et.context):"standalone";var ei;if(en==="formatting"&&$.formattingValues){var eo=$.defaultFormattingWidth||$.defaultWidth;var es=et!==null&&et!==void 0&&et.width?String(et.width):eo;ei=$.formattingValues[es]||$.formattingValues[eo]}else{var eu=$.defaultWidth;var el=et!==null&&et!==void 0&&et.width?String(et.width):$.defaultWidth;ei=$.values[el]||$.values[eu]}var ef=$.argumentCallback?$.argumentCallback(ee):ee;return ei[ef]}};var tw={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]};var tE={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]};var tS={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"]};var tT={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"]};var tO={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"}};var tA={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"}};var tI=function $($,ee){var et=Number($);var en=et%100;if(en>20||en<10){switch(en%10){case 1:return et+"st";case 2:return et+"nd";case 3:return et+"rd"}}return et+"th"};var tN={ordinalNumber:tI,era:tv({values:tw,defaultWidth:"wide"}),quarter:tv({values:tE,defaultWidth:"wide",argumentCallback:function $($){return $-1}}),month:tv({values:tS,defaultWidth:"wide"}),day:tv({values:tT,defaultWidth:"wide"}),dayPeriod:tv({values:tO,defaultWidth:"wide",formattingValues:tA,defaultFormattingWidth:"wide"})};const tD=tN;function tR($){return function(ee){var et=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var en=et.width;var ei=en&&$.matchPatterns[en]||$.matchPatterns[$.defaultMatchWidth];var eo=ee.match(ei);if(!eo){return null}var es=eo[0];var eu=en&&$.parsePatterns[en]||$.parsePatterns[$.defaultParseWidth];var el=Array.isArray(eu)?tk(eu,function($){return $.test(es)}):tC(eu,function($){return $.test(es)});var ef;ef=$.valueCallback?$.valueCallback(el):el;ef=et.valueCallback?et.valueCallback(ef):ef;var ed=ee.slice(es.length);return{value:ef,rest:ed}}}function tC($,ee){for(var et in $){if($.hasOwnProperty(et)&&ee($[et])){return et}}return undefined}function tk($,ee){for(var et=0;et<$.length;et++){if(ee($[et])){return et}}return undefined};function tM($){return function(ee){var et=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var en=ee.match($.matchPattern);if(!en)return null;var ei=en[0];var eo=ee.match($.parsePattern);if(!eo)return null;var es=$.valueCallback?$.valueCallback(eo[0]):eo[0];es=et.valueCallback?et.valueCallback(es):es;var eu=ee.slice(ei.length);return{value:es,rest:eu}}};var tL=/^(\d+)(th|st|nd|rd)?/i;var tx=/\d+/i;var tP={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};var tF={any:[/^b/i,/^(a|c)/i]};var tB={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i};var tU={any:[/1/i,/2/i,/3/i,/4/i]};var tj={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};var tW={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]};var tH={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};var tz={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]};var tV={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};var t$={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}};var tq={ordinalNumber:tM({matchPattern:tL,parsePattern:tx,valueCallback:function $($){return parseInt($,10)}}),era:tR({matchPatterns:tP,defaultMatchWidth:"wide",parsePatterns:tF,defaultParseWidth:"any"}),quarter:tR({matchPatterns:tB,defaultMatchWidth:"wide",parsePatterns:tU,defaultParseWidth:"any",valueCallback:function $($){return $+1}}),month:tR({matchPatterns:tj,defaultMatchWidth:"wide",parsePatterns:tW,defaultParseWidth:"any"}),day:tR({matchPatterns:tH,defaultMatchWidth:"wide",parsePatterns:tz,defaultParseWidth:"any"}),dayPeriod:tR({matchPatterns:tV,defaultMatchWidth:"any",parsePatterns:t$,defaultParseWidth:"any"})};const tG=tq;var tY={code:"en-US",formatDistance:ti,formatLong:th,formatRelative:t_,localize:tD,match:tG,options:{weekStartsOn:0,firstWeekContainsDate:1}};const tK=tY;const tZ=tK;var tJ=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;var tX=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;var tQ=/^'([^]*?)'?$/;var t0=/''/g;var t6=/[a-zA-Z]/;function t4($,ee,et){var en,ei,eo,es,eu,el,ef,ed,ep,eh,ey,eg,em,e_,ew,eT,eO,eN;eE(2,arguments);var eR=String(ee);var eC=eU();var ek=(en=(ei=et===null||et===void 0?void 0:et.locale)!==null&&ei!==void 0?ei:eC.locale)!==null&&en!==void 0?en:tZ;var eM=eI((eo=(es=(eu=(el=et===null||et===void 0?void 0:et.firstWeekContainsDate)!==null&&el!==void 0?el:et===null||et===void 0?void 0:(ef=et.locale)===null||ef===void 0?void 0:(ed=ef.options)===null||ed===void 0?void 0:ed.firstWeekContainsDate)!==null&&eu!==void 0?eu:eC.firstWeekContainsDate)!==null&&es!==void 0?es:(ep=eC.locale)===null||ep===void 0?void 0:(eh=ep.options)===null||eh===void 0?void 0:eh.firstWeekContainsDate)!==null&&eo!==void 0?eo:1);if(!(eM>=1&&eM<=7)){throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively")}var eL=eI((ey=(eg=(em=(e_=et===null||et===void 0?void 0:et.weekStartsOn)!==null&&e_!==void 0?e_:et===null||et===void 0?void 0:(ew=et.locale)===null||ew===void 0?void 0:(eT=ew.options)===null||eT===void 0?void 0:eT.weekStartsOn)!==null&&em!==void 0?em:eC.weekStartsOn)!==null&&eg!==void 0?eg:(eO=eC.locale)===null||eO===void 0?void 0:(eN=eO.options)===null||eN===void 0?void 0:eN.weekStartsOn)!==null&&ey!==void 0?ey:0);if(!(eL>=0&&eL<=6)){throw new RangeError("weekStartsOn must be between 0 and 6 inclusively")}if(!ek.localize){throw new RangeError("locale must contain localize property")}if(!ek.formatLong){throw new RangeError("locale must contain formatLong property")}var eP=eS($);if(!eA(eP)){throw new RangeError("Invalid time value")}var eF=e8(eP);var eB=eD(eP,eF);var ej={firstWeekContainsDate:eM,weekStartsOn:eL,locale:ek,_originalDate:eP};var eW=eR.match(tX).map(function($){var ee=$[0];if(ee==="p"||ee==="P"){var et=e3[ee];return et($,ek.formatLong)}return $}).join("").match(tJ).map(function(en){if(en==="''"){return"'"}var ei=en[0];if(ei==="'"){return t3(en)}var eo=e0[ei];if(eo){if(!(et!==null&&et!==void 0&&et.useAdditionalWeekYearTokens)&&te(en)){tt(en,ee,String($))}if(!(et!==null&&et!==void 0&&et.useAdditionalDayOfYearTokens)&&e7(en)){tt(en,ee,String($))}return eo(eB,en,ek.localize,ej)}if(ei.match(t6)){throw new RangeError("Format string contains an unescaped latin alphabet character `"+ei+"`")}return en}).join("");return eW}function t3($){var ee=$.match(tQ);if(!ee){return $}return ee[1].replace(t0,"'")};var t8=7;var t5=365.2425;var t9=Math.pow(10,8)*24*60*60*1e3;var t7=6e4;var rr=36e5;var rn=1e3;var ri=-t9;var ro=60;var ru=3;var rl=12;var rc=4;var rf=3600;var rp=60;var rh=rf*24;var ry=rh*7;var rg=rh*t5;var rm=rg/12;var r_=rm*3;function rv($,ee){var et;eE(1,arguments);var en=eI((et=ee===null||ee===void 0?void 0:ee.additionalDigits)!==null&&et!==void 0?et:2);if(en!==2&&en!==1&&en!==0){throw new RangeError("additionalDigits must be 0, 1 or 2")}if(!(typeof $==="string"||Object.prototype.toString.call($)==="[object String]")){return new Date(NaN)}var ei=rO($);var eo;if(ei.date){var es=rA(ei.date,en);eo=rI(es.restDateString,es.year)}if(!eo||isNaN(eo.getTime())){return new Date(NaN)}var eu=eo.getTime();var el=0;var ef;if(ei.time){el=rD(ei.time);if(isNaN(el)){return new Date(NaN)}}if(ei.timezone){ef=rC(ei.timezone);if(isNaN(ef)){return new Date(NaN)}}else{var ed=new Date(eu+el);var ep=new Date(0);ep.setFullYear(ed.getUTCFullYear(),ed.getUTCMonth(),ed.getUTCDate());ep.setHours(ed.getUTCHours(),ed.getUTCMinutes(),ed.getUTCSeconds(),ed.getUTCMilliseconds());return ep}return new Date(eu+el+ef)}var rw={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/};var rE=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;var rS=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;var rT=/^([+-])(\d{2})(?::?(\d{2}))?$/;function rO($){var ee={};var et=$.split(rw.dateTimeDelimiter);var en;if(et.length>2){return ee}if(/:/.test(et[0])){en=et[0]}else{ee.date=et[0];en=et[1];if(rw.timeZoneDelimiter.test(ee.date)){ee.date=$.split(rw.timeZoneDelimiter)[0];en=$.substr(ee.date.length,$.length)}}if(en){var ei=rw.timezone.exec(en);if(ei){ee.time=en.replace(ei[1],"");ee.timezone=ei[1]}else{ee.time=en}}return ee}function rA($,ee){var et=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+ee)+"})|(\\d{2}|[+-]\\d{"+(2+ee)+"})$)");var en=$.match(et);if(!en)return{year:NaN,restDateString:""};var ei=en[1]?parseInt(en[1]):null;var eo=en[2]?parseInt(en[2]):null;return{year:eo===null?ei:eo*100,restDateString:$.slice((en[1]||en[2]).length)}}function rI($,ee){if(ee===null)return new Date(NaN);var et=$.match(rE);if(!et)return new Date(NaN);var en=!!et[4];var ei=rN(et[1]);var eo=rN(et[2])-1;var es=rN(et[3]);var eu=rN(et[4]);var el=rN(et[5])-1;if(en){if(!rB(ee,eu,el)){return new Date(NaN)}return rk(ee,eu,el)}else{var ef=new Date(0);if(!rP(ee,eo,es)||!rF(ee,ei)){return new Date(NaN)}ef.setUTCFullYear(ee,eo,Math.max(ei,es));return ef}}function rN($){return $?parseInt($):1}function rD($){var ee=$.match(rS);if(!ee)return NaN;var et=rR(ee[1]);var en=rR(ee[2]);var ei=rR(ee[3]);if(!rU(et,en,ei)){return NaN}return et*rr+en*t7+ei*1e3}function rR($){return $&&parseFloat($.replace(",","."))||0}function rC($){if($==="Z")return 0;var ee=$.match(rT);if(!ee)return 0;var et=ee[1]==="+"?-1:1;var en=parseInt(ee[2]);var ei=ee[3]&&parseInt(ee[3])||0;if(!rj(en,ei)){return NaN}return et*(en*rr+ei*t7)}function rk($,ee,et){var en=new Date(0);en.setUTCFullYear($,0,4);var ei=en.getUTCDay()||7;var eo=(ee-1)*7+et+1-ei;en.setUTCDate(en.getUTCDate()+eo);return en}var rM=[31,null,31,30,31,30,31,31,30,31,30,31];function rL($){return $%400===0||$%4===0&&$%100!==0}function rP($,ee,et){return ee>=0&&ee<=11&&et>=1&&et<=(rM[ee]||(rL($)?29:28))}function rF($,ee){return ee>=1&&ee<=(rL($)?366:365)}function rB($,ee,et){return ee>=1&&ee<=53&&et>=0&&et<=6}function rU($,ee,et){if($===24){return ee===0&&et===0}return et>=0&&et<60&&ee>=0&&ee<60&&$>=0&&$<25}function rj($,ee){return ee>=0&&ee<=59};let rW=rH();function rH(){return new Promise(($,ee)=>{let et=9;let en=indexedDB.open("actual",et);en.onupgradeneeded=function($){let ee=$.target.result;if(ee.objectStoreNames.contains("filesystem")){ee.deleteObjectStore("filesystem",{keyPath:"filepath"})}if(ee.objectStoreNames.contains("messages")){ee.deleteObjectStore("messages",{keyPath:"filepath"})}if(!ee.objectStoreNames.contains("asyncStorage")){ee.createObjectStore("asyncStorage")}if(!ee.objectStoreNames.contains("files")){ee.createObjectStore("files",{keyPath:"filepath"})}};en.onblocked=$=>console.log("blocked",$);en.onerror=$=>{console.log("openRequest error");ee(new Error("indexeddb-failure: Could not open IndexedDB"))};en.onsuccess=function(ee){let et=ee.target.result;et.onversionchange=()=>{et.close()};et.onerror=function($){console.log("Database error: "+($.target&&$.target.error));if($.target&&$.target.error){let ee=$.target.error;if(ee.name==="QuotaExceededError"){throw new Error("indexeddb-quota-error")}}};$(et)}})}const rz=function($,ee){let et=$.transaction([ee],"readwrite");return{trans:et,store:et.objectStore(ee)}};const rV=async function($,ee,et=$=>$){return new Promise((en,ei)=>{let eo=$.get(ee);eo.onsuccess=$=>{en(et(eo.result))};eo.onerror=$=>ei($)})};const r$=async function($,ee){return new Promise((et,en)=>{let ei=$.put(ee);ei.onsuccess=$=>et(undefined);ei.onerror=$=>en($)})};const rq=async function($,ee){return new Promise((et,en)=>{let ei=$.delete(ee);ei.onsuccess=$=>et(undefined);ei.onerror=$=>en($)})};const rG=function(){return rW};const rY=function(){if(rW==null){rW=rH()}return rW};const rK=function(){if(rW){rW.then($=>{$.close()});rW=null}};const rZ=function(){};function rJ($){if($.commit){$.commit()}}const rX=async function($){let ee=await rG();let et=ee.transaction(["asyncStorage"],"readonly");let en=et.objectStore("asyncStorage");return new Promise((ee,ei)=>{let eo=en.get($);eo.onerror=$=>ei($);eo.onsuccess=$=>ee($.target.result);rJ(et)})};const rQ=async function($,ee){let et=await rG();let en=et.transaction(["asyncStorage"],"readwrite");let ei=en.objectStore("asyncStorage");new Promise((et,eo)=>{let es=ei.put(ee,$);es.onerror=$=>eo($);es.onsuccess=$=>et(undefined);rJ(en)})};const r0=async function($){let ee=await rG();let et=ee.transaction(["asyncStorage"],"readwrite");let en=et.objectStore("asyncStorage");return new Promise((ee,ei)=>{let eo=en.delete($);eo.onerror=$=>ei($);eo.onsuccess=$=>ee(undefined);rJ(et)})};const r6=async function($){let ee=await rG();let et=ee.transaction(["asyncStorage"],"readonly");let en=et.objectStore("asyncStorage");let ei=Promise.all($.map($=>{return new Promise((ee,et)=>{let ei=en.get($);ei.onerror=$=>et($);ei.onsuccess=et=>ee([$,et.target.result])})}));rJ(et);return ei};const r4=async function($){let ee=await getDatabase();let et=ee.transaction(["asyncStorage"],"readwrite");let en=et.objectStore("asyncStorage");let ei=Promise.all($.map(([$,ee])=>{return new Promise((et,ei)=>{let eo=en.put(ee,$);eo.onerror=$=>ei($);eo.onsuccess=$=>et(undefined)})}));rJ(et);return ei};const r3=async function($){let ee=await rG();let et=ee.transaction(["asyncStorage"],"readwrite");let en=et.objectStore("asyncStorage");let ei=Promise.all($.map($=>{return new Promise((ee,et)=>{let ei=en.delete($);ei.onerror=$=>et($);ei.onsuccess=$=>ee(undefined)})}));rJ(et);return ei};function r8($,ee){eE(2,arguments);var et=eS($);var en=eI(ee);if(isNaN(en)){return new Date(NaN)}if(!en){return et}var ei=et.getDate();var eo=new Date(et.getTime());eo.setMonth(et.getMonth()+en+1,0);var es=eo.getDate();if(ei>=es){return eo}else{et.setFullYear(eo.getFullYear(),eo.getMonth(),ei);return et}};function r5($,ee){eE(2,arguments);var et=eI(ee);return r8($,-et)};function r9($,ee){eE(2,arguments);var et=eS($);var en=eI(ee);if(isNaN(en)){return new Date(NaN)}if(!en){return et}et.setDate(et.getDate()+en);return et};function r7($,ee){eE(2,arguments);var et=eI(ee);var en=et*7;return r9($,en)};function ne($,ee){eE(2,arguments);var et=eS($);var en=eS(ee);var ei=et.getFullYear()-en.getFullYear();var eo=et.getMonth()-en.getMonth();return ei*12+eo};function nt($,ee){eE(2,arguments);var et=eI(ee);return r9($,-et)};function nn($,ee){eE(2,arguments);var et=eS($);var en=eS(ee);return et.getTime()<en.getTime()};function ni($,ee){eE(2,arguments);var et=eS($);var en=eS(ee);return et.getTime()>en.getTime()};function no($){eE(1,arguments);var ee=eS($);ee.setDate(1);ee.setHours(0,0,0,0);return ee};function ns($){eE(1,arguments);var ee=eS($);var et=ee.getMonth();ee.setFullYear(ee.getFullYear(),et+1,0);ee.setHours(23,59,59,999);return ee};var nu=Number.isNaN||function $($){return typeof $==="number"&&$!==$};function nc($,ee){if($===ee){return true}if(nu($)&&nu(ee)){return true}return false}function nf($,ee){if($.length!==ee.length){return false}for(var et=0;et<$.length;et++){if(!nc($[et],ee[et])){return false}}return true}function nh($,ee){if(ee===void 0){ee=nf}var et=null;function en(){var en=[];for(var ei=0;ei<arguments.length;ei++){en[ei]=arguments[ei]}if(et&&et.lastThis===this&&ee(en,et.lastArgs)){return et.lastResult}var eo=$.apply(this,en);et={lastResult:eo,lastArgs:en,lastThis:this};return eo}en.clear=function $(){et=null};return en};const ny=navigator.platform&&navigator.platform.toLowerCase()==="win32";const ng=navigator.platform&&navigator.platform.toUpperCase().indexOf("MAC")>=0;const nm=navigator.userAgent==="playwright";const n_=null&&(ny?"windows":ng?"mac":"linux");const nw="web";const nE=true;function nS($){if(typeof $==="string"){let[ee,et,en]=$.split("-");if(en!=null){return new Date(parseInt(ee),parseInt(et)-1,parseInt(en),12)}else if(et!=null){return new Date(parseInt(ee),parseInt(et)-1,1,12)}else{return new Date(parseInt(ee),0,1,12)}}if(typeof $==="number"){return new Date($)}return $}const nT=nS;function nO($){return t4(nS($),"yyyy")}function nA($){return t4(nS($),"yyyy-MM")}function nI($){return t4(nS($),"yyyy-MM-dd")}function nN(){if(__webpack_require__.g.IS_TESTING||nm){return __webpack_require__.g.currentMonth||"2017-01"}else{return t4(new Date,"yyyy-MM")}}function nD(){if(__webpack_require__.g.IS_TESTING||Platform.isPlaywright){return d.parse(nR(),"yyyy-MM-dd",new Date)}return new Date}function nR(){if(__webpack_require__.g.IS_TESTING||nm){return"2017-01-01"}else{return t4(new Date,"yyyy-MM-dd")}}function nC($){return d.format(d.addMonths(nS($),1),"yyyy-MM")}function nk($){return t4(r5(nS($),1),"yyyy-MM")}function nM($,ee){return t4(r8(nS($),ee),"yyyy-MM")}function nL($,ee){return t4(r7(nS($),ee),"yyyy-MM-dd")}function nx($,ee){return ne(nS($),nS(ee))}function nP($,ee){return t4(r5(nS($),ee),"yyyy-MM")}function nF($,ee){return t4(r9(nS($),ee),"yyyy-MM-dd")}function nB($,ee){return t4(nt(nS($),ee),"yyyy-MM-dd")}function nU($,ee){return nn(nS($),nS(ee))}function nj($,ee){return ni(nS($),nS(ee))}function nW($){return{start:parseInt(t4(no(nS($)),"yyyyMMdd")),end:parseInt(t4(ns(nS($)),"yyyyMMdd"))}}function nH($,ee,et=false){const en=[];let ei=nA($);while(nn(nS(ei),nS(ee))){en.push(ei);ei=nM(ei,1)}if(et){en.push(ei)}return en}function nz($,ee){return nH($,ee)}function nV($,ee){return nH($,ee,true)}function n$($,ee,et=false){const en=[];let ei=$;while(d.isBefore(nS(ei),nS(ee))){en.push(ei);ei=nF(ei,1)}if(et){en.push(ei)}return en}function nq($,ee){return n$($,ee)}function nG($,ee){return n$($,ee,true)}function nY($,ee){const et=`${ee+1}`.padStart(2,"0");return`${$}-${et}`}function nK($){return parseInt($.slice(5,7))-1}function nZ($){return $.slice(0,4)}function nJ($){return $.slice(0,7)}function nX($){return nZ($)+"-01"}function nQ($){return nZ($)+"-12"}function n0($){return"budget"+$.replace("-","")}function n1($){return d.format(nS($),"MMMM 'yy")}function n2($,ee){return t4(nS($),ee)}const n6=nh($=>{return new RegExp($.replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{4}"))});const n4=nh($=>{return $.replace(/y+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"")});const n3=nh($=>{let ee=$.replace(/y+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}");return new RegExp("^"+ee+"$")});const n8=nh($=>{return $.replace(/d+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/\/\//,"/").replace(/\.\./,".").replace(/--/,"-")});const n5=nh($=>{let ee=$.replace(/d+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/\/\//,"/").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{2,4}");return new RegExp("^"+ee+"$")});const n9=nh($=>{return $.replace(/y+/g,"yy")});const n7=nh($=>{let ee=$.replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{2}");return new RegExp("^"+ee+"$")});function ie($){return $[$.length-1]}function it($,ee){const et=$.id?{id:$.id}:{};const en=Object.keys(ee);let ei=false;for(let eo=0;eo<en.length;eo++){let es=en[eo];if($[es]!==ee[es]){et[es]=ee[es];ei=true}}return ei?et:null}function ir($,ee,et){let en=false;for(let ei=0;ei<et.length;ei++){let eo=et[ei];if($[eo]!==ee[eo]){en=true;break}}return en}function io($,ee){ee=[...ee];if($.added){$.added.forEach($=>{ee.push($)})}if($.updated){$.updated.forEach(({id:$,...et})=>{const en=ee.findIndex(ee=>ee.id===$);ee[en]={...ee[en],...et}})}if($.deleted){$.deleted.forEach($=>{const et=ee.findIndex(ee=>$.id===ee.id);if(et!==-1){ee.splice(et,1)}})}return ee}function iu($,ee){let et=new Map;for(let en=0;en<$.length;en++){let ei=$[en];let eo=ei[ee];let es=et.get(eo)||[];es.push(ei);et.set(eo,es)}return et}function ip($,ee){let et=new Map;for(let en=0;en<$.length;en++){let ei=$[en];let eo=ei[ee];let es=et.get(eo)||[];et.set(eo,es.concat([ei]))}return et}function ih($){let ee=new Map;for(let et=0;et<$.length;et++){let en=$[et];ee.set(en.id,en)}return ee}function iy($,ee){let et=ih($);let en=ih(ee);let ei=[];let eo=[];let es=$.filter($=>!en.has($.id)).map($=>({id:$.id}));ee.forEach($=>{let ee=et.get($.id);if(!ee){ei.push($)}else{const et=it(ee,$);if(et){eo.push(et)}}});return{added:ei,updated:eo,deleted:es}}function ig($){let ee={};for(let et=0;et<$.length;et++){let en=$[et];ee[en.id]=en}return ee}function im($,ee,et){for(let en=0;en<ee.length;en++){const ei=ee[en];if(en===ee.length-1){$.set(ei,et)}else{if(!$.has(ei)){$.set(ei,new Map)}$=$.get(ei)}}}function i_($,ee){let et=$;for(let $=0;$<ee.length;$++){et=et.get(ee[$]);if(et==null){return et}}return et}function iw($,ee){let et=new Set($);let en=ee.values();let ei=en.next();while(!ei.done){et.add(ei.value);ei=en.next()}return et}function iE($){return $[0].toUpperCase()+$.slice(1)}const iS=[{value:"comma-dot",label:"1,000.33",labelNoFraction:"1,000"},{value:"dot-comma",label:"1.000,33",labelNoFraction:"1.000"},{value:"space-comma",label:"1 000,33",labelNoFraction:"1 000"},{value:"space-dot",label:"1 000.33",labelNoFraction:"1 000"},{value:"comma-dot-in",label:"1,00,000.33",labelNoFraction:"1,00,000"}];let iT={format:"comma-dot",hideFraction:false};function iO($){iT=$}function iI({format:$,hideFraction:ee}=iT){let et,en,ei;switch($){case"space-comma":et="en-ZA";en=/[^-0-9,]/g;ei=",";break;case"dot-comma":et="de-DE";en=/[^-0-9,]/g;ei=",";break;case"space-dot":et="dje";en=/[^-0-9.]/g;ei=".";break;case"comma-dot-in":et="en-IN";en=/[^-0-9.]/g;ei=".";break;case"comma-dot":default:et="en-US";en=/[^-0-9.]/g;ei="."}return{value:$,separator:ei,formatter:new Intl.NumberFormat(et,{minimumFractionDigits:ee?0:2,maximumFractionDigits:ee?0:2}),regex:en}}const iN=2**51-1;const iD=-iN;function iR($){if(!Number.isInteger($)){throw new Error("safeNumber: number is not an integer: "+JSON.stringify($))}if($>iN||$<iD){throw new Error("safeNumber: can’t safely perform arithmetic with number: "+$)}return $}function iC($){return iU(ix($)||0)}function ik($,ee=iI().formatter){return ee.format(iR($)/100)}function iM($){return iI().formatter.format($)}function iL($){let ee=parseFloat($.replace(iI().regex,"").replace(iI().separator,"."));return isNaN(ee)?null:ee}function ix($){let ee=iL($);return ee==null?null:iF(ee)}function iP($){let ee=parseInt($.replace(/[^-0-9.,]/g,""));if(!isNaN(ee)){return ee}return null}function iF($){return Math.round($*100)}function iU($){return parseFloat((iR($)/100).toFixed(2))}function ij($){function ee($){return isNaN($)?null:$}function et($){return $.replace(/[^0-9-]/g,"")}if($.startsWith("(")&&$.endsWith(")")){$=$.replace("(","-").replace(")","")}let en=$.match(/[.,][^.,]*$/);if(!en||en.index===0){return ee(parseFloat(et($)))}let ei=et($.slice(0,en.index));let eo=et($.slice(en.index+1));return ee(parseFloat(ei+"."+eo))}function iW($,ee){return[...$].sort(($,et)=>{if($[ee]<et[ee]){return-1}else if($[ee]>et[ee]){return 1}return 0})};function iH($){return $.indexOf("preview/")!==-1}function iz($){return typeof $==="number"?$:0}function iV($,ee){let et=iz(ee.amount)-$;return{type:"SplitTransactionError",version:1,difference:et}}function i$($,ee){let et=$.id==="temp"?"temp":"";return{amount:0,...ee,payee:ee.payee||$.payee,id:ee.id?ee.id:et+e_(),account:$.account,date:$.date,cleared:$.cleared!=null?$.cleared:null,starting_balance_flag:$.starting_balance_flag!=null?$.starting_balance_flag:null,is_child:true,parent_id:$.id,error:null}}function iq($){const ee=$.subtransactions.reduce(($,ee)=>$+iz(ee.amount),0);return{...$,error:ee===iz($.amount)?null:iV(ee,$)}}function iG($,ee){while(ee>=0){let et=$[ee];if(et.is_parent){return ee}ee--}return null}function iY($,ee){let et=[$[ee]];let en=ee+1;while(en<$.length&&$[en].is_child){et.push($[en]);en++}return et}function iK($){let ee=$.reduce(($,ee)=>{let{subtransactions:et,...en}=ee;et=et||[];$.push(en);for(let ee=0;ee<et.length;ee++){$.push(et[ee])}return $},[]);return ee}function iZ($){return{...$[0],subtransactions:$.slice(1)}}function iJ($){if($==null){return null}return iK([$])}function iX($,ee){return iZ(applyChanges(ee,iJ($)))}function iQ($,ee,et){let en=$.findIndex($=>$.id===ee);let ei=$[en];let eo=[...$];if(en===-1){throw new Error("Tried to edit unknown transaction id: "+ee)}if(ei.is_parent||ei.is_child){let ee=iG($,en);if(ee==null){console.log("Cannot find parent index");return{diff:{deleted:[],updated:[]}}}let ei=iY($,ee);let es=et(iZ(ei));let eu=iJ(es);let el;if(eu==null){el={deleted:[{id:ei[0].id}],updated:[]};es={id:ei[0].id,_deleted:true};eo.splice(ee,ei.length)}else{el=iy(ei,eu);eo.splice(ee,ei.length,...eu)}return{data:eo,newTransaction:es,diff:el}}else{let $=et(ei);let ee=iJ($)||[];if($){$.subtransactions=$.subtransactions||[]}eo.splice(en,1,...ee);return{data:eo,newTransaction:$||{id:ei.id,_deleted:true},diff:iy([ei],ee)}}}function i0($,ee){return iQ($,ee,$=>{if(!$.is_parent){return $}let ee=last($.subtransactions);$.subtransactions.push(i$($,{amount:0,sort_order:iz(ee&&ee.sort_order)-1}));return $})}function i1($,ee){return iQ($,ee.id,$=>{if($.is_parent){let et=$.id===ee.id?ee:$;let en=$.subtransactions.map(en=>{let ei=en;if($.id===ee.id){ei={...en,payee:en.payee===$.payee?ee.payee:en.payee}}else if(en.id===ee.id){ei=ee}return i$(et,ei)});return iq({...et,subtransactions:en})}else{return ee}})}function i2($,ee){return iQ($,ee,$=>{if($.is_parent){if($.id===ee){return null}else if($.subtransactions.length===1){return{...$,subtransactions:null,is_parent:false,error:null}}else{let et=$.subtransactions.filter($=>$.id!==ee);return iq({...$,subtransactions:et})}}else{return null}})}function i6($,ee){return iQ($,ee,$=>{if($.is_parent||$.is_child){return $}return{...$,is_parent:true,error:iz($.amount)===0?null:iV(0,$),subtransactions:[i$($,{amount:0,sort_order:-1})]}})}function i4($){let ee=$.find($=>!$.is_child);ee={...ee,id:uuidv4()};let et=$.filter($=>$.is_child);return[ee,...et.map($=>({...$,id:uuidv4(),parent_id:ee.id}))]}var i3=__webpack_require__(9593);var i8=__webpack_require__.n(i3);const i5={EPERM:63,ENOENT:44};class i9{constructor($,ee){this.FS=$;this.backend=ee;this.node_ops={getattr:ee=>{let et=$.isFile(ee.mode)?ee.contents.getattr():null;let en={};en.dev=1;en.ino=ee.id;en.mode=et?et.mode:ee.mode;en.nlink=1;en.uid=0;en.gid=0;en.rdev=ee.rdev;en.size=et?et.size:$.isDir(ee.mode)?4096:0;en.atime=new Date(0);en.mtime=new Date(0);en.ctime=new Date(0);en.blksize=et?et.blockSize:4096;en.blocks=Math.ceil(en.size/en.blksize);return en},setattr:($,ee)=>{if(this.FS.isFile($.mode)){$.contents.setattr(ee)}else{if(ee.mode!=null){$.mode=ee.mode}if(ee.size!=null){$.size=ee.size}}},lookup:($,ee)=>{throw new this.FS.ErrnoError(i5.ENOENT)},mknod:($,ee,et,en)=>{if(ee.endsWith(".lock")){throw new Error("Locking via lockfiles is not supported")}return this.createNode($,ee,et,en)},rename:($,ee,et)=>{throw new Error("rename not implemented")},unlink:($,ee)=>{let et=this.FS.lookupNode($,ee);et.contents.delete(ee)},readdir:$=>{throw new Error("readdir not implemented")},symlink:($,ee,et)=>{throw new Error("symlink not implemented")},readlink:$=>{throw new Error("symlink not implemented")}};this.stream_ops={open:$=>{if(this.FS.isFile($.node.mode)){$.node.contents.open()}},close:$=>{if(this.FS.isFile($.node.mode)){$.node.contents.close()}},read:($,ee,et,en,ei)=>{return $.node.contents.read(ee,et,en,ei)},write:($,ee,et,en,ei)=>{return $.node.contents.write(ee,et,en,ei)},llseek:(ee,et,en)=>{var ei=et;if(en===1){ei+=ee.position}else if(en===2){if($.isFile(ee.node.mode)){ei+=ee.node.contents.getattr().size}}if(ei<0){throw new this.FS.ErrnoError(28)}return ei},allocate:($,ee,et)=>{$.node.contents.setattr({size:ee+et})},mmap:($,ee,et,en,ei,eo)=>{throw new Error("mmap not implemented")},msync:($,ee,et,en,ei)=>{throw new Error("msync not implemented")},fsync:($,ee,et,en,ei)=>{$.node.contents.fsync()}}}mount(){return this.createNode(null,"/",16384|511,0)}lock($,ee){let{node:et}=this.FS.lookupPath($);if(et&&et.contents){return et.contents.lock(ee)}return true}unlock($,ee){let{node:et}=this.FS.lookupPath($);if(et&&et.contents){return et.contents.unlock(ee)}return true}createNode($,ee,et,en){if(!(this.FS.isDir(et)||this.FS.isFile(et))){throw new this.FS.ErrnoError(i5.EPERM)}var ei=this.FS.createNode($,ee,et,en);if(this.FS.isDir(ei.mode)){ei.node_ops={mknod:this.node_ops.mknod,lookup:this.node_ops.lookup,unlink:this.node_ops.unlink,setattr:this.node_ops.setattr};ei.stream_ops={};ei.contents={}}else if(this.FS.isFile(ei.mode)){ei.node_ops=this.node_ops;ei.stream_ops=this.stream_ops;ei.contents=this.backend.createFile(ee)}if($){$.contents[ee]=ei;$.timestamp=ei.timestamp}return ei}}const i7=i9;let ae={NONE:0,SHARED:1,RESERVED:2,PENDING:3,EXCLUSIVE:4};function at($){let ee=$[16];let et=$[17];return(ee<<8)+et}function an($,ee){if($!=null&&ee!=null){let et=new Uint8Array($);let en=new Uint8Array(ee);for(let $=24;$<40;$++){if(et[$]!==en[$]){return false}}return true}return $==null&&ee==null}function ao($,ee,et){let en=[];for(let ei=$;ei<=ee;ei+=et){en.push(ei)}return en}function au($,ee,et){let en=ee-ee%$;let ei=et-1-(et-1)%$;return ao(en,ei,$)}function al($,ee,et){let en=new ArrayBuffer(et-ee);let ei=new Uint8Array(en);for(let en=0;en<$.length;en++){let eo=$[en];if(eo.data.constructor.name!=="ArrayBuffer"){throw new Error("Chunk data is not an ArrayBuffer")}let es=0;let eu=eo.data.byteLength;if(ee>eo.pos){es=ee-eo.pos}if(et<eo.pos+eo.data.byteLength){eu=et-eo.pos}if(es>eo.data.byteLength||eu<0){continue}let el=eu-es;ei.set(new Uint8Array(eo.data,es,el),eo.pos-ee+es)}return en}function af($,ee,et,en){let ei=au(ee,et,en);let eo=0;return ei.map(ei=>{let es=0;let eu=ee;if(et>ei&&et<ei+ee){es=et-ei}if(en>ei&&en<ei+ee){eu=en-ei}let el=eu-es;let ef=new ArrayBuffer(ee);if(et>ei+ee||en<=ei){return null}let ed=$.byteOffset+eo;let ep=$.buffer.byteLength-ed;if(ep<=0){return null}let eh=Math.min(el,ep);new Uint8Array(ef).set(new Uint8Array($.buffer,ed,eh),es);eo+=eh;return{pos:ei,data:ef,offset:es,length:eh}}).filter(Boolean)}class ad{constructor($,ee,et=null){this.filename=$;this.buffer=new Map;this.ops=ee;this.meta=et;this._metaDirty=false;this.writeLock=false;this.openHandles=0}bufferChunks($){for(let ee=0;ee<$.length;ee++){let et=$[ee];this.buffer.set(et.pos,et)}}open(){this.openHandles++;if(this.openHandles===1){this.ops.open();let $=this.ops.readMeta();if(this.meta==null){if($==null){$={size:0}}this.meta=$}}return this.meta}close(){this.fsync();this.openHandles=Math.max(this.openHandles-1,0);if(this.openHandles===0){this.ops.close()}}delete(){this.ops.delete()}load($){let ee=$.reduce(($,ee)=>{let et=this.buffer.get(ee);if(et){$.chunks.push(et)}else{$.missing.push(ee)}return $},{chunks:[],missing:[]});let et=[];if(ee.missing.length>0){et=this.ops.readBlocks(ee.missing,this.meta.blockSize)}return ee.chunks.concat(et)}read($,ee,et,en){let ei=$.buffer;if(et<=0){return 0}if(en<0){return 0}if(en>=this.meta.size){let $=new Uint8Array(ei,ee);for(let ee=0;ee<et;ee++){$[ee]=0}return et}en=Math.max(en,0);let eo=Math.min(et,this.meta.size-en);let es=en;let eu=en+eo;let el=au(this.meta.blockSize,es,eu);let ef=this.load(el);let ed=al(ef,es,eu);if(ei.byteLength-ee<ed.byteLength){throw new Error("Buffer given to `read` is too small")}let ep=new Uint8Array(ei);ep.set(new Uint8Array(ed),ee);for(let $=eo;$<et;$++){ep[ee+$]=0}return et}write($,ee,et,en){if(this.meta.blockSize==null){let et=at(new Uint8Array($.buffer,$.byteOffset+ee));if(![512,1024,2048,4096,8192,16384,32768,65536].includes(et)){throw new Error("File has invalid page size. (the first block of a new file must be written first)")}this.setattr({blockSize:et})}let ei=$.buffer;if(et<=0){return 0}if(en<0){return 0}if(ei.byteLength===0){return 0}et=Math.min(et,ei.byteLength-ee);let eo=af(new Uint8Array(ei,ee,et),this.meta.blockSize,en,en+et);let{partialWrites:es,fullWrites:eu}=eo.reduce(($,ee)=>{if(ee.length!==this.meta.blockSize){$.partialWrites.push(ee)}else{$.fullWrites.push({pos:ee.pos,data:ee.data})}return $},{fullWrites:[],partialWrites:[]});let el=[];if(es.length>0){el=this.load(es.map($=>$.pos))}let ef=eu.concat(el.map($=>{let ee=es.find(ee=>ee.pos===$.pos);new Uint8Array($.data).set(new Uint8Array(ee.data,ee.offset,ee.length),ee.offset,ee.length);return $}));this.bufferChunks(ef);if(en+et>this.meta.size){this.setattr({size:en+et})}return et}async readIfFallback(){if(this.ops.readIfFallback){let $=await this.ops.readIfFallback();this.meta=$||{size:0}}}lock($){if(!this._recordingLock){this._recordingLock=true}if(this.ops.lock($)){if($>=ae.RESERVED){this.writeLock=true}return true}return false}unlock($){if($===0){this._recordingLock=false}if(this.writeLock){this.fsync();this.writeLock=false}return this.ops.unlock($)}fsync(){if(this.buffer.size>0){let $=this.buffer.get(0);if($){let ee=at(new Uint8Array($.data));if(ee!==this.meta.blockSize){let $=this.buffer;this.buffer=new Map;let et=[...$.values()];let en=et.length*this.meta.blockSize;let ei=new ArrayBuffer(en);let eo=new Uint8Array(ei);for(let $ of et){eo.set(new Uint8Array($.data),$.pos)}this.bufferChunks(af(eo,ee,0,en));this.setattr({blockSize:ee})}}this.ops.writeBlocks([...this.buffer.values()],this.meta.blockSize)}if(this._metaDirty){this.ops.writeMeta({size:this.meta.size});this._metaDirty=false}this.buffer=new Map}setattr($){if(this.meta==null){this.meta={}}if($.mode!==undefined){this.meta.mode=$.mode}if($.blockSize!==undefined){this.meta.blockSize=$.blockSize}if($.size!==undefined){this.meta.size=$.size;this._metaDirty=true}}getattr(){return this.meta}}let ap=3735928559;let ah=0;let ay=1;class ag{constructor($,{initialOffset:ee=4,useAtomics:et=true,stream:en=true,debug:ei,name:eo}={}){this.buffer=$;this.atomicView=new Int32Array($);this.offset=ee;this.useAtomics=et;this.stream=en;this.debug=ei;this.name=eo}log(...$){if(this.debug){console.log(`[reader: ${this.name}]`,...$)}}waitWrite($,ee=null){if(this.useAtomics){this.log(`waiting for ${$}`);while(Atomics.load(this.atomicView,0)===ah){if(ee!=null){if(Atomics.wait(this.atomicView,0,ah,ee)==="timed-out"){throw new Error("timeout")}}Atomics.wait(this.atomicView,0,ah,500)}this.log(`resumed for ${$}`)}else{if(this.atomicView[0]!==ay){throw new Error("`waitWrite` expected array to be readable")}}}flip(){this.log("flip");if(this.useAtomics){let $=Atomics.compareExchange(this.atomicView,0,ay,ah);if($!==ay){throw new Error("Read data out of sync! This is disastrous")}Atomics.notify(this.atomicView,0)}else{this.atomicView[0]=ah}this.offset=4}done(){this.waitWrite("done");let $=new DataView(this.buffer,this.offset);let ee=$.getUint32(0)===ap;if(ee){this.log("done");this.flip()}return ee}peek($){this.peekOffset=this.offset;let ee=$();this.offset=this.peekOffset;this.peekOffset=null;return ee}string($){this.waitWrite("string",$);let ee=this._int32();let et=ee/2;let en=new DataView(this.buffer,this.offset,ee);let ei=[];for(let $=0;$<et;$++){ei.push(en.getUint16($*2))}let eo=String.fromCharCode.apply(null,ei);this.log("string",eo);this.offset+=ee;if(this.peekOffset==null){this.flip()}return eo}_int32(){let $=4;let ee=new DataView(this.buffer,this.offset);let et=ee.getInt32();this.log("_int32",et);this.offset+=$;return et}int32(){this.waitWrite("int32");let $=this._int32();this.log("int32",$);if(this.peekOffset==null){this.flip()}return $}bytes(){this.waitWrite("bytes");let $=this._int32();let ee=new ArrayBuffer($);new Uint8Array(ee).set(new Uint8Array(this.buffer,this.offset,$));this.log("bytes",ee);this.offset+=$;if(this.peekOffset==null){this.flip()}return ee}}class am{constructor($,{initialOffset:ee=4,useAtomics:et=true,stream:en=true,debug:ei,name:eo}={}){this.buffer=$;this.atomicView=new Int32Array($);this.offset=ee;this.useAtomics=et;this.stream=en;this.debug=ei;this.name=eo;if(this.useAtomics){Atomics.store(this.atomicView,0,ah)}else{this.atomicView[0]=ah}}log(...$){if(this.debug){console.log(`[writer: ${this.name}]`,...$)}}waitRead($){if(this.useAtomics){this.log(`waiting for ${$}`);let ee=Atomics.compareExchange(this.atomicView,0,ah,ay);if(ee!==ah){throw new Error("Wrote something into unwritable buffer! This is disastrous")}Atomics.notify(this.atomicView,0);while(Atomics.load(this.atomicView,0)===ay){Atomics.wait(this.atomicView,0,ay,500)}this.log(`resumed for ${$}`)}else{this.atomicView[0]=ay}this.offset=4}finalize(){this.log("finalizing");let $=new DataView(this.buffer,this.offset);$.setUint32(0,ap);this.waitRead("finalize")}string($){this.log("string",$);let ee=$.length*2;this._int32(ee);let et=new DataView(this.buffer,this.offset,ee);for(let ee=0;ee<$.length;ee++){et.setUint16(ee*2,$.charCodeAt(ee))}this.offset+=ee;this.waitRead("string")}_int32($){let ee=4;let et=new DataView(this.buffer,this.offset);et.setInt32(0,$);this.offset+=ee}int32($){this.log("int32",$);this._int32($);this.waitRead("int32")}bytes($){this.log("bytes",$);let ee=$.byteLength;this._int32(ee);new Uint8Array(this.buffer,this.offset).set(new Uint8Array($));this.offset+=ee;this.waitRead("bytes")}}function a_($,ee){return Math.round($/ee)}function av($,ee){self.postMessage({type:"__absurd:spawn-idb-worker",argBuffer:ee.buffer,resultBuffer:$.buffer});self.addEventListener("message",et=>{switch(et.data.type){case"__perf-deets:start-profile":ee.string("profile-start");ee.finalize();$.int32();$.done();break;case"__perf-deets:stop-profile":ee.string("profile-stop");ee.finalize();$.int32();$.done();break}})}class aw{constructor($){this.filename=$}getStoreName(){return this.filename.replace(/\//g,"-")}invokeWorker($,ee){if(this.reader==null||this.writer==null){throw new Error(`Attempted ${$} on ${this.filename} but file not open`)}let et=this.reader;let en=this.writer;switch($){case"readBlocks":{let{name:$,positions:ei,blockSize:eo}=ee;let es=[];for(let ee of ei){en.string("readBlock");en.string($);en.int32(a_(ee,eo));en.finalize();let ei=et.bytes();et.done();es.push({pos:ee,data:ei.byteLength===0?new ArrayBuffer(eo):ei})}return es}case"writeBlocks":{let{name:$,writes:ei,blockSize:eo}=ee;en.string("writeBlocks");en.string($);for(let $ of ei){en.int32(a_($.pos,eo));en.bytes($.data)}en.finalize();let es=et.int32();et.done();return es}case"readMeta":{en.string("readMeta");en.string(ee.name);en.finalize();let $=et.int32();let ei=et.int32();et.done();return $===-1?null:{size:$,blockSize:ei}}case"writeMeta":{let{name:$,meta:ei}=ee;en.string("writeMeta");en.string($);en.int32(ei.size);en.finalize();let eo=et.int32();et.done();return eo}case"closeFile":{en.string("closeFile");en.string(ee.name);en.finalize();let $=et.int32();et.done();return $}case"lockFile":{en.string("lockFile");en.string(ee.name);en.int32(ee.lockType);en.finalize();let $=et.int32();et.done();return $===0}case"unlockFile":{en.string("unlockFile");en.string(ee.name);en.int32(ee.lockType);en.finalize();let $=et.int32();et.done();return $===0}}}lock($){return this.invokeWorker("lockFile",{name:this.getStoreName(),lockType:$})}unlock($){return this.invokeWorker("unlockFile",{name:this.getStoreName(),lockType:$})}delete(){if(this.reader||this.writer){this.close()}let $=globalThis.indexedDB.deleteDatabase(this.getStoreName());$.onerror=()=>{console.warn(`Deleting ${this.filename} database failed`)};$.onsuccess=()=>{}}open(){let $=new SharedArrayBuffer(4096*9);this.writer=new am($,{name:"args (backend)",debug:false});let ee=new SharedArrayBuffer(4096*9);this.reader=new ag(ee,{name:"results",debug:false});av(this.reader,this.writer)}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($){return this.invokeWorker("writeMeta",{name:this.getStoreName(),meta:$})}readBlocks($,ee){if(this.stats){this.stats.read+=$.length}return this.invokeWorker("readBlocks",{name:this.getStoreName(),positions:$,blockSize:ee})}writeBlocks($,ee){if(this.stats){this.stats.writes+=$.length}return this.invokeWorker("writeBlocks",{name:this.getStoreName(),writes:$,blockSize:ee})}}function aE(){const $=!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent);if(!$||!indexedDB.databases)return Promise.resolve();let ee;return new Promise($=>{const et=()=>indexedDB.databases().finally($);ee=setInterval(et,100);et()}).finally(()=>clearInterval(ee))}function aS($,ee){return Math.round($/ee)}async function aT($){await aE();return new Promise((ee,et)=>{let en=globalThis.indexedDB.open($,2);en.onsuccess=$=>{let et=$.target.result;et.onversionchange=()=>{console.log("closing because version changed");et.close()};et.onclose=()=>{};ee(et)};en.onupgradeneeded=$=>{let ee=$.target.result;if(!ee.objectStoreNames.contains("data")){ee.createObjectStore("data")}};en.onblocked=$=>console.log("blocked",$);en.onerror=en.onabort=$=>et($.target.error)})}class aO{constructor($,ee){this.dbName=$;this._openDb=null;this.hasAlertedFailure=false;this.onFallbackFailure=ee}async getDb(){if(this._openDb){return this._openDb}this._openDb=await aT(this.dbName);return this._openDb}closeDb(){if(this._openDb){this._openDb.close();this._openDb=null}}async readAll(){let $=await this.getDb(this.dbName);let ee=new Map;let et=$.transaction(["data"],"readonly");let en=et.objectStore("data");return new Promise(($,et)=>{let ei=en.openCursor(IDBKeyRange.lowerBound(-1));ei.onerror=et;ei.onsuccess=et=>{let en=et.target.result;if(en){ee.set(en.key,en.value);en.continue()}else{$(ee)}}})}async write($,ee,et){let en=await this.getDb(this.dbName);let ei=en.transaction(["data"],"readwrite");let eo=ei.objectStore("data");await new Promise((en,es)=>{let eu=eo.get(0);eu.onsuccess=el=>{if(et){if(!an(eu.result,ee)){if(this.onFallbackFailure&&!this.hasAlertedFailure){this.hasAlertedFailure=true;this.onFallbackFailure()}es(new Error("Fallback mode unable to write file changes"));return}}for(let ee of $){eo.put(ee.value,ee.key)}ei.onsuccess=()=>en();ei.onerror=()=>es()};eu.onerror=es})}}class aA{constructor($,ee){this.filename=$;this.dbName=this.filename.replace(/\//g,"-");this.cachedFirstBlock=null;this.writeQueue=null;this.blocks=new Map;this.lockType=0;this.transferBlockOwnership=false;this.persistance=new aO(this.dbName,ee)}async readIfFallback(){this.transferBlockOwnership=true;this.blocks=await this.persistance.readAll();return this.readMeta()}lock($){this.cachedFirstBlock=this.blocks.get(0);this.lockType=$;return true}unlock($){if(this.lockType>ae.SHARED&&$===ae.SHARED){this.flush()}this.lockType=$;return true}delete(){let $=globalThis.indexedDB.deleteDatabase(this.dbName);$.onerror=()=>{console.warn(`Deleting ${this.filename} database failed`)};$.onsuccess=()=>{}}open(){this.writeQueue=[];this.lockType=0}close(){this.flush();if(this.transferBlockOwnership){this.transferBlockOwnership=false}else{this.blocks=new Map}this.persistance.closeDb()}readMeta(){let $=this.blocks.get(-1);if($){let ee=this.blocks.get(0);return{size:$.size,blockSize:at(new Uint8Array(ee))}}return null}writeMeta($){this.blocks.set(-1,$);this.queueWrite(-1,$)}readBlocks($,ee){let et=[];for(let en of $){et.push({pos:en,data:this.blocks.get(aS(en,ee))})}return et}writeBlocks($,ee){for(let et of $){let $=aS(et.pos,ee);this.blocks.set($,et.data);this.queueWrite($,et.data)}if(this.lockType<=ae.SHARED){this.flush()}}queueWrite($,ee){this.writeQueue.push({key:$,value:ee})}flush(){if(this.writeQueue.length>0){this.persistance.write(this.writeQueue,this.cachedFirstBlock,this.lockType>ae.SHARED);this.writeQueue=[]}this.cachedFirstBlock=null}}class aI{constructor($){this.onFallbackFailure=$}createFile($){let ee;if(typeof SharedArrayBuffer!=="undefined"){ee=new aw($)}else{ee=new aA($,this.onFallbackFailure)}let et=new ad($,ee);if(false||({}).PERF_BUILD){if(this._files==null){this._files=new Set}this._files.add(et)}return et}startProfile(){for(let $ of this._files){if($.ops.writer){let ee=$.ops.writer;let et=$.ops.reader;ee.string("profile-start");ee.finalize();et.int32();et.done()}}}stopProfile(){for(let $ of this._files){if($.ops.writer){let ee=$.ops.writer;let et=$.ops.reader;ee.string("profile-stop");ee.finalize();et.int32();et.done()}}}}const aN=aI;const aD=function($){console.log("[Exception]",$)};const aR=function($){};function aC($){let ee={running:null,queue:[]};function et(){if(ee.queue.length>0){const $=ee.queue.shift();en($.args,$.resolve,$.reject)}else{ee.running=null}}function en(en,ei,eo){ee.running=$(...en);ee.running.then($=>{et();ei($)},$=>{et();eo($)})}return(...$)=>{if(!ee.running){return new Promise((ee,et)=>{return en($,ee,et)})}else{return new Promise((et,en)=>{ee.queue.push({resolve:et,reject:en,args:$})})}}}function ak($){let ee=null;let et=(...et)=>{if(!ee){ee=$(...et).finally(()=>{ee=null});return ee}return ee};return et};let aM=new Set;let aL=null;let ax=new WeakMap;let aP=false;let aF=[];function aB($){ax.set($,true);return $}function aU($){return ax.has($)}async function aj(){await aW(200);while(aM.size>0){await Promise.all([...aM.values()]);await aW(100)}}function aW($){return new Promise(ee=>setTimeout(ee,$))}async function aH($,ee,{undoTag:et,name:en}={}){aF.push(en);if(aF.length>5){aF=aF.slice(-5)}if(ax.has($)){return aq(()=>$(ee),{undoTag:et})}if(en==="close-budget"){await aj()}let ei=$(ee);aM.add(ei);ei.then(()=>{aM.delete(ei)});return ei}function az(){if(false){}}function aV(){if(false){}}function a$($,ee={}){aL=ee;return $().finally(()=>{aL=null})}const aq=aC(a$);function aG($,ee){if(aL==null&&!aP){aR("Recent methods: "+aF.join(", "));aD(new Error("withMutatorContext: mutator not running"));return ee()}let et=aL;aL={...aL,...$};return ee().finally(()=>{aL=et})}function aY(){if(aL==null){aR({category:"server",message:"Recent methods: "+aF.join(", ")});return{}}if(aL==null&&aP){return{}}return aL};function aK(){let $=typeof window!=="undefined"?window:typeof self!=="undefined"?self:null;if(!$){throw new Error("Cannot get global object")}return $}aK().__globalServerChannel=null;function aZ($){if($.type&&$.type==="APIError"){return $}return{type:"InternalError",message:$.message}}const aJ=function($,ee){const et=$;aK().__globalServerChannel=et;et.addEventListener("message",$=>{let en=$.data;let ei=typeof en==="string"?JSON.parse(en):en;if(ei.type&&(ei.type==="init"||ei.type.startsWith("__"))){return}let{id:eo,name:es,args:eu,undoTag:el,catchErrors:ef}=ei;if(ee[es]){aH(ee[es],eu,{undoTag:el,name:es}).then($=>{if(ef){$={data:$,error:null}}et.postMessage({type:"reply",id:eo,result:$,mutated:aU(ee[es]),undoTag:el})},$=>{let ee=aZ($);if(es.startsWith("api/")){et.postMessage({type:"reply",id:eo,error:ee})}else if(ef){et.postMessage({type:"reply",id:eo,result:{error:ee,data:null}})}else{et.postMessage({type:"error",id:eo})}if(ee.type==="InternalError"){aD($)}if(!ef){aX("server-error")}})}else{console.warn("Unknown method: "+es);et.postMessage({type:"reply",id:eo,result:null,error:{type:"APIError",message:"Unknown method: "+es}})}},false);et.postMessage({type:"connect"})};const aX=function($,ee){const{__globalServerChannel:et}=aK();if(et){et.postMessage({type:"push",name:$,args:ee})}};const aQ=function(){return 1};var a0=__webpack_require__(9298);var a1=__webpack_require__.n(a0);let a2=null;async function a6(){return new Promise(($,ee)=>{a1()({locateFile:$=>"/"+$}).then(ee=>{a2=ee;$(undefined)},$=>{ee($)})})}function a4(){if(a2==null){throw new Error("_getModule: sql.js must be initialized first")}return a2}function a3($,ee){ee.forEach(ee=>{if(typeof ee!=="string"&&typeof ee!=="number"&&ee!==null){throw new Error("Invalid field type "+ee+" for sql "+$)}})}function a8($,ee){return $.prepare(ee)}function a5($,ee,et=[],en=false){if(et){a3(ee,et)}let ei=typeof ee==="string"?$.prepare(ee):ee;if(en){try{ei.bind(et);let $=[];while(ei.step()){$.push(ei.getAsObject())}if(typeof ee==="string"){ei.free()}else{ei.reset()}return $}catch($){console.log(ee);throw $}}else{try{ei.run(et);return{changes:$.getRowsModified()}}catch($){throw $}}}function a9($,ee){$.exec(ee)}let a7=0;function oe($,ee){let et,en,ei;if(a7>0){et="SAVEPOINT __actual_sp";en="RELEASE __actual_sp";ei="ROLLBACK TO __actual_sp"}else{et="BEGIN";en="COMMIT";ei="ROLLBACK"}a9($,et);a7++;try{const et=ee();a9($,en);return et}catch(ee){a9($,ei);if(ei!=="ROLLBACK"){a9($,en)}throw ee}finally{a7--}}async function ot($,ee){if(a7===0){$.exec("BEGIN TRANSACTION")}a7++;try{await ee()}finally{a7--;if(a7===0){$.exec("COMMIT")}}}async function or($){let ee=null;if($){if(typeof $!=="string"){ee=new a2.Database($)}else{let et=$;if(et!==":memory:"){if(typeof SharedArrayBuffer==="undefined"){let $=a2.FS.open(a2.FS.readlink(et),"a+");await $.node.contents.readIfFallback();a2.FS.close($)}ee=new a2.Database(et.includes("/blocked")?et:a2.FS.readlink(et),{filename:true});ee.exec(`
|
|
17
17
|
PRAGMA journal_mode=MEMORY;
|
|
18
18
|
PRAGMA cache_size=-10000;
|
|
19
|
-
`)}}}if(ee===null){ee=new a0.Database}ee.create_function("UNICODE_LOWER",$=>$?.toLowerCase());ee.create_function("UNICODE_UPPER",$=>$?.toUpperCase());return ee}function ot($){$.close()}async function or($){return $.export()};function oi($,ee){let et="";let en=0;let ei=-1;let eo=0;let es;for(let eu=0;eu<=$.length;++eu){if(eu<$.length)es=$.charCodeAt(eu);else if(es===47)break;else es=47;if(es===47){if(ei===eu-1||eo===1){}else if(ei!==eu-1&&eo===2){if(et.length<2||en!==2||et.charCodeAt(et.length-1)!==46||et.charCodeAt(et.length-2)!==46){if(et.length>2){let $=et.lastIndexOf("/");if($!==et.length-1){if($===-1){et="";en=0}else{et=et.slice(0,$);en=et.length-1-et.lastIndexOf("/")}ei=eu;eo=0;continue}}else if(et.length===2||et.length===1){et="";en=0;ei=eu;eo=0;continue}}if(ee){if(et.length>0)et+="/..";else et="..";en=2}}else{if(et.length>0)et+="/"+$.slice(ei+1,eu);else et=$.slice(ei+1,eu);en=eu-ei-1}ei=eu;eo=0}else if(es===46&&eo!==-1){++eo}else{eo=-1}}return et}function oo($){if($.length===0)return".";let ee=$.charCodeAt(0)===47;let et=$.charCodeAt($.length-1)===47;$=oi($,!ee);if($.length===0&&!ee)$=".";if($.length>0&&et)$+="/";if(ee)return"/"+$;return $}const os=(...$)=>{if($.length===0)return".";let ee;for(let et=0;et<$.length;++et){let en=$[et];if(en.length>0){if(ee===undefined)ee=en;else ee+="/"+en}}if(ee===undefined)return".";return oo(ee)};const ou=os;let ol;const oc=$=>ol=$;const of=()=>{if(!ol){throw new Error("Document directory is not set")}return ol};const od=$=>{if(!$){throw new Error("getDocumentDir: id is falsy: "+$)}if($.match(/[^A-Za-z0-9\-_]/)){throw new Error(`Invalid budget id “${$}”. Check the id of your budget in the Advanced section of the settings page.`)}return ou(of(),$)};let oh=null;let oy=null;let og=false;const om="/default-db.sqlite";const o_="/migrations";const ov="/demo-budget";const ow=()=>"/";const oE=function($){return $.replace(/^\//,"").replace(/\//g,"-")};function oS($){try{oh.readlink($);return true}catch($){}try{oh.stat($);return true}catch($){}return false}function oT($){let ee=$.split("/").filter($=>$!=="");let et="";for(let $ of ee){et+="/"+$;if(!oS(et)){oh.mkdir(et)}}}function oO($){if(!og&&$.startsWith("/documents")){if($.endsWith(".sqlite")){if(!oS($)){oh.symlink("/blocked/"+oE($),$)}}else{oh.writeFile($,"!$@) this should never read !$@)")}}return $}async function oA($,ee){if(!og&&$.startsWith("/documents")&&!$.endsWith(".sqlite")){if(!oS($)){throw new Error("File does not exist: "+$)}let{store:et}=rz(await rG(),"files");let en=await rV(et,$);if(en==null){throw new Error("File does not exist: "+$)}if(ee.encoding==="utf8"&&ArrayBuffer.isView(en.contents)){return String.fromCharCode.apply(null,new Uint16Array(en.contents.buffer))}return en.contents}else{return oh.readFile(oI($),ee)}}function oI($){try{let{node:ee}=oh.lookupPath($,{follow:false});return ee.link?oh.readlink($):$}catch(ee){return $}}async function oN($,ee){if(ee instanceof ArrayBuffer){ee=new Uint8Array(ee)}else if(ArrayBuffer.isView(ee)){ee=new Uint8Array(ee.buffer)}oO($);if(!og&&$.startsWith("/documents")){let et=$.endsWith(".sqlite");let{store:en}=rz(await rG(),"files");if(et){await r$(en,{filepath:$,contents:""});await Promise.resolve();oh.writeFile(oI($),ee)}else{await r$(en,{filepath:$,contents:ee})}}else{oh.writeFile(oI($),ee)}}async function oD($){if(!og&&$.startsWith("/documents")){let ee=$.endsWith(".sqlite");let{store:et}=rz(await rG(),"files");await rq(et,$);if(ee){let ee=oI($);if(oS(ee)){oh.unlink(ee)}}}oh.unlink($)}async function oR(){let $=await (await fetch("/"+"data-file-index.txt")).text();let ee=$.split("\n").map($=>$.trim()).filter($=>$!=="");let et=$=>fetch($).then($=>$.arrayBuffer());await oF("/migrations");await oF("/demo-budget");await Promise.all(ee.map(async $=>{let ee=await et("/"+"data/"+$);oN("/"+$,ee)}))}const oC=async function(){let{store:$}=rz(await rG(),"files");let ee=$.getAllKeys();let et=await new Promise(($,et)=>{ee.onsuccess=ee=>$(ee.target.result);ee.onerror=$=>et($)});for(let $ of et){oT(oL($));oO($)}};const oM=async function(){let $=a2();oh=$.FS;oh.mkdir("/uploads");oh.mkdir("/documents");oh.mkdir("/blocked");if(true){let ee=new aA(()=>{aZ("fallback-write-error")});oy=new i5(oh,ee);$.register_for_idb(oy);oh.mount(oy,{},"/blocked");await oR()}await oC()};const oL=function($){let ee=$.split("/");return ee.slice(0,-1).join("/")};const ox=async function($){let ee=oh.readdir($);return ee.filter($=>$!=="."&&$!=="..")};const oP=async function($){return oS($)};const oF=async function($){oh.mkdir($)};const oB=async function($){let ee=oh.stat(oI($));return ee.size};const oU=async function($,ee){let et=await oA($);return oN(ee,et)};const oj=async function($,ee="utf8"){return oA($,{encoding:ee})};const oW=async function($,ee){return oN($,ee)};const oH=async function($){return oD($)};const oz=async function($){oh.rmdir($)};const oV=async function($){if(await oP($)){for(let ee of(await ox($))){let et=ou($,ee);let en=oh.stat(et,true);if(oh.isDir(en.mode)){await oV(et)}else{await oH(et)}}await oz($)}};const o$=async function($){throw new Error("getModifiedTime not supported on the web (only used for backups)")};function oq($,ee,et,en){et.forEach(et=>{if(en){if(ee.hasOwnProperty(et)&&ee[et]==null){throw new Error(`${$} is missing field ${et}`)}}else{if(!ee.hasOwnProperty(et)||ee[et]==null){throw new Error(`${$} is missing field ${et}`)}}})}function oG($){if(typeof $!=="string"){throw new Error("toDateRepr not passed a string: "+$)}return parseInt($.replace(/-/g,""))}function oY($){if(typeof $!=="number"){throw new Error("fromDateRepr not passed a number: "+$)}const ee=$.toString();return ee.slice(0,4)+"-"+ee.slice(4,6)+"-"+ee.slice(6)}const oK={validate($,{update:ee}={}){oq("account",$,ee?["name","offbudget","closed"]:["name"],ee);return $}};const oZ={validate($,{update:ee}={}){oq("category",$,ee?["name","is_income","cat_group"]:["name","cat_group"],ee);let{sort_order:et,...en}=$;return en}};const oJ={validate($,{update:ee}={}){oq("categoryGroup",$,ee?["name","is_income"]:["name"],ee);let{sort_order:et,...en}=$;return en}};const oX={validate($,{update:ee}={}){oq("payee",$,["name"],ee);return $}};const oQ={validate($,{update:ee}={}){oq("transaction",$,["date","acct"],ee);if("date"in $){if($.date.match(/^\d{4}-\d{2}-\d{2}$/)==null||$.date<"2000-01-01"){throw new Error("Invalid transaction date: "+$.date)}}return $},toJS($){if(!("location"in $)){throw new Error("A full transaction is required to be passed to `toJS`. Instead got: "+JSON.stringify($))}let ee={...$};ee.error=$.error?JSON.parse($.error):null;ee.isParent=$.isParent===1?true:false;ee.isChild=$.isChild===1?true:false;ee.starting_balance_flag=$.starting_balance_flag===1?true:false;ee.cleared=$.cleared===1?true:false;ee.pending=$.pending===1?true:false;ee.date=ee.date&&oY(ee.date);return ee},fromJS($){let ee={...$};if("error"in ee){ee.error=$.error?JSON.stringify($.error):null}if("isParent"in ee){ee.isParent=$.isParent?1:0}if("isChild"in ee){ee.isChild=$.isChild?1:0}if("cleared"in ee){ee.cleared=$.cleared?1:0}if("pending"in ee){ee.pending=$.pending?1:0}if("starting_balance_flag"in ee){ee.starting_balance_flag=$.starting_balance_flag?1:0}if("date"in ee){ee.date=oG($.date)}return ee}};function o0($,ee){return ee.required||$==="id"}function o1($,ee){if($===undefined){throw new Error("Query value cannot be undefined")}else if($===null){if(ee==="boolean"){return 0}return null}switch(ee){case"date":if($ instanceof Date){return oG(nI($))}else if($.match(/^\d{4}-\d{2}-\d{2}$/)==null||$.date<"2000-01-01"){throw new Error("Invalid date: "+$)}return oG($);case"date-month":return oG($.slice(0,7));case"date-year":return oG($.slice(0,4));case"boolean":return $?1:0;case"id":if(typeof $!=="string"&&$!==null){throw new Error("Invalid id, must be string: "+$)}return $;case"integer":if(typeof $==="number"&&Number.isInteger($)){return $}else{throw new Error("Can’t convert to integer: "+JSON.stringify($))}case"json":return JSON.stringify($);default:}return $}function o2($,ee){if($===null){if(ee==="boolean"){return false}return null}switch(ee){case"date":return oY($);case"date-month":return oY($).slice(0,7);case"date-year":return oY($).slice(0,4);case"boolean":return $===1;case"json":case"json/fallback":try{return JSON.parse($)}catch(et){return ee==="json/fallback"?$:null}default:}return $}function o6($,ee,et,en,{skipNull:ei=false}={}){let eo=$[et];if(eo==null){throw new Error(`Table “${et}” does not exist`)}let es=ee.views||{};let eu=$=>{if(es[et]&&es[et].fields){return es[et].fields[$]||$}return $};return Object.fromEntries(Object.keys(en).map($=>{if($[0]==="_"){return null}let ee=eo[$];if(ee==null){throw new Error(`Field “${$}” does not exist on table ${et}: ${JSON.stringify(en)}`)}if(o0($,ee)&&en[$]==null){throw new Error(`“${$}” is required for table “${et}”: ${JSON.stringify(en)}`)}if(ei&&en[$]==null){return null}return[eu($),o1(en[$],ee.type)]}).filter(Boolean))}function o4($,ee,et,en){let ei={...en};let eo=$[et];if(eo==null){throw new Error(`Error inserting: table “${et}” does not exist`)}Object.keys(eo).forEach($=>{let ee=eo[$];if(ei[$]==null){if(ee.default!==undefined){ei[$]=typeof ee.default==="function"?ee.default():ee.default}else if(o0($,ee)){throw new Error(`“${$}” is required for table “${et}”: ${JSON.stringify(ei)}`)}}});return o6($,ee,et,ei,{skipNull:true})}function o3($,ee,et,en){let ei={...en};let eo=$[et];if(eo==null){throw new Error(`Error updating: table “${et}” does not exist`)}return o6($,ee,et,ei)}function o8($,ee,et,en){let ei=$[et];if(ei==null){throw new Error(`Table “${et}” does not exist`)}let eo=Object.keys(ei);let es={};for(let $=0;$<eo.length;$++){let ee=eo[$];let et=ei[ee];es[ee]=o2(en[ee],et.type)}return es};let o5=0;function o9(){o5=0}function o7($){o5++;return $+o5}class se extends Error{}function st($){let ee=$=>($<10?"0":"")+$;return $.getFullYear()+ee($.getMonth()+1)+ee($.getDate())}function sr($){return parseInt($.replace(/-/g,""))}function sn($,ee,et,en){let ei=$[ee].tombstone!=null;return ei?`${en} AND ${et}.tombstone = 0`:en}function si($){let ee=$.split(".");return{path:ee.slice(0,-1).join("."),field:ee[ee.length-1]}}function so($){return $==="group"}function ss($){return $.indexOf(".")===-1&&!so($)?$:`"${$}"`}function su($,ee,{literal:et=false}={}){return{value:$,type:ee,literal:et}}function sl($,ee,et){if($[ee]==null){throw new se(`Table “${ee}” does not exist in the schema`)}let en=$[ee][et];if(en==null){throw new se(`Field “${et}” does not exist in table “${ee}”`)}return en}function sc($,ee){let{schema:et,paths:en}=$;let ei=ee.split(".");if(ei.length<2){throw new se("Invalid path: "+ee)}let eo=ei[0];let es=ei.slice(1).reduce(($,ee)=>{let en=et[$];if(en==null){throw new se(`Path error: ${$} table does not exist`)}if(!en[ee]||en[ee].ref==null){throw new se(`Field not joinable on table ${$}: “${ee}”`)}return en[ee].ref},eo);let eu;let el=ei.slice(0,-1);if(el.length===1){eu=el[0]}else{let $=el.join(".");let ee=en.get($);if(!ee){throw new se("Path does not exist: "+$)}eu=ee.tableId}return{tableName:es,tableId:o7(es),joinField:ei[ei.length-1],joinTable:eu}}function sf($,ee){let et=ee.split(".");et=et.reduce(($,ee)=>{let et=$.context+"."+ee;return{context:et,path:[...$.path,et]}},{context:$.implicitTableName,path:[]}).path;et.forEach(ee=>{if(!$.paths.get(ee)){$.paths.set(ee,sc($,ee))}});let en=$.paths.get(et[et.length-1]);return en}function sd($,ee){if(typeof ee!=="string"){throw new se("Invalid field name, must be a string")}let{path:et,field:en}=si(ee);let ei;if(et===""){ei={tableName:$.implicitTableName,tableId:$.implicitTableId}}else{ei=sf($,et)}let eo=sl($.schema,ei.tableName,en);if($.validateRefs&&eo.ref&&eo.type==="id"&&en!=="id"){let et=$.implicitTableName+"."+ee;let eo=$.paths.get(et);if(!eo){eo=sc($,et);eo.noMapping=true;$.paths.set(et,eo)}en="id";ei=eo}let es=ei.tableId+"."+en;return su(es,eo.type)}function sp($){let ee=$.match(/^(\d{4}-\d{2}-\d{2})$/);if(ee){return su(sr(ee[1]),"date",{literal:true})}return null}function sh($){let ee=$.match(/^(\d{4}-\d{2})$/);if(ee){return su(sr(ee[1]),"date",{literal:true})}return null}function sy($){let ee=$.match(/^(\d{4})$/);if(ee){return su(sr(ee[1]),"date",{literal:true})}return null}function sg($,ee){throw new se(`Bad ${ee} format: ${$}`)}function sm($,ee){let et=$.paramType;if(et){let en={date:["string"],"date-month":["date"],"date-year":["date","date-month"],id:["string"],float:["integer"]};if(et!==ee&&(!en[ee]||!en[ee].includes(et))){throw new Error(`Parameter “${$.paramName}” can’t convert to ${ee} (already inferred as ${et})`)}}else{$.paramType=ee}}function s_($,ee,et){if(ee.type===et){return ee}else if(ee.type==="param"){sm(ee,et);return su(ee.value,et)}else if(ee.type==="null"){if(!ee.literal){throw new se("A non-literal null doesn’t make sense")}if(et==="boolean"){return su(0,"boolean",{literal:true})}return ee}if(et==="date"){if(ee.type==="string"){if(ee.literal){return sp(ee.value)||sg(ee.value,"date")}else{throw new se("Casting string fields to dates is not supported")}}throw new se(`Can’t cast ${ee.type} to date`)}else if(et==="date-month"){let $;if(ee.type==="date"){$=ee}else if(ee.type==="string"||ee.type==="any"){$=sh(ee.value)||sp(ee.value)||sg(ee.value,"date-month")}else{throw new se(`Can’t cast ${ee.type} to date-month`)}if($.literal){return su(sr($.value.toString().slice(0,6)),"date-month",{literal:true})}else{return su(`CAST(SUBSTR(${$.value}, 1, 6) AS integer)`,"date-month")}}else if(et==="date-year"){let $;if(ee.type==="date"||ee.type==="date-month"){$=ee}else if(ee.type==="string"){$=sy(ee.value)||sh(ee.value)||sp(ee.value)||sg(ee.value,"date-year")}else{throw new se(`Can’t cast ${ee.type} to date-year`)}if($.literal){return su(sr($.value.toString().slice(0,4)),"date-year",{literal:true})}else{return su(`CAST(SUBSTR(${$.value}, 1, 4) AS integer)`,"date-year")}}else if(et==="id"){if(ee.type==="string"){return su(ee.value,"id",{literal:ee.literal})}}else if(et==="float"){if(ee.type==="integer"){return su(ee.value,"float",{literal:ee.literal})}}if(ee.type==="any"){return su(ee.value,et,{literal:ee.literal})}throw new se(`Can’t convert ${ee.type} to ${et}`)}function sv($,ee,et){let en=ee;if(et){en=s_($,ee,et)}if(en.literal){if(en.type==="id"){return`'${en.value}'`}else if(en.type==="string"){let $=en.value.replace(/'/g,"''");return`'${$}'`}}return en.value}function sw($,ee,et){return ee.map((ee,en)=>sv($,ee,et?et[en]:null))}function sE($,ee,et){if(et==null){et=ee}if(ee!=null&&$.length<ee){throw new se("Too few arguments")}if(et!=null&&$.length>et){throw new se("Too many arguments")}}function sS($,ee){return(et,...en)=>{if(et==null||et.compileStack==null){throw new se("This function cannot track error data. "+"It needs to accept the compiler state as the first argument.")}et.compileStack.push({type:$,args:en});let ei=ee(et,...en);et.compileStack.pop();return ei}}function sT($){if(typeof $==="string"){return $}else if($===undefined){return"undefined"}let ee=JSON.stringify($);if(ee.length>70){let ee=JSON.stringify($,null,2);return ee.split("\n").join("\n ")}return ee}function sO($,ee){if(ee.length===0){return $}let et=ee.slice(1).reverse().map($=>{switch($.type){case"expr":case"function":return sT($.args[0]);case"op":{let[ee,et]=$.args;return sT({[ee]:et})}case"value":return sT($.value);default:return""}}).map($=>"\n "+$).join("");const en=ee[0].type;const ei=ee[0].args[0];et+=`
|
|
20
|
-
${en}(${
|
|
19
|
+
`)}}}if(ee===null){ee=new a2.Database}ee.create_function("UNICODE_LOWER",$=>$?.toLowerCase());ee.create_function("UNICODE_UPPER",$=>$?.toUpperCase());return ee}function oi($){$.close()}async function oo($){return $.export()};function os($,ee){let et="";let en=0;let ei=-1;let eo=0;let es;for(let eu=0;eu<=$.length;++eu){if(eu<$.length)es=$.charCodeAt(eu);else if(es===47)break;else es=47;if(es===47){if(ei===eu-1||eo===1){}else if(ei!==eu-1&&eo===2){if(et.length<2||en!==2||et.charCodeAt(et.length-1)!==46||et.charCodeAt(et.length-2)!==46){if(et.length>2){let $=et.lastIndexOf("/");if($!==et.length-1){if($===-1){et="";en=0}else{et=et.slice(0,$);en=et.length-1-et.lastIndexOf("/")}ei=eu;eo=0;continue}}else if(et.length===2||et.length===1){et="";en=0;ei=eu;eo=0;continue}}if(ee){if(et.length>0)et+="/..";else et="..";en=2}}else{if(et.length>0)et+="/"+$.slice(ei+1,eu);else et=$.slice(ei+1,eu);en=eu-ei-1}ei=eu;eo=0}else if(es===46&&eo!==-1){++eo}else{eo=-1}}return et}function ou($){if($.length===0)return".";let ee=$.charCodeAt(0)===47;let et=$.charCodeAt($.length-1)===47;$=os($,!ee);if($.length===0&&!ee)$=".";if($.length>0&&et)$+="/";if(ee)return"/"+$;return $}const ol=(...$)=>{if($.length===0)return".";let ee;for(let et=0;et<$.length;++et){let en=$[et];if(en.length>0){if(ee===undefined)ee=en;else ee+="/"+en}}if(ee===undefined)return".";return ou(ee)};const oc=ol;let of;const od=$=>of=$;const oh=()=>{if(!of){throw new Error("Document directory is not set")}return of};const oy=$=>{if(!$){throw new Error("getDocumentDir: id is falsy: "+$)}if($.match(/[^A-Za-z0-9\-_]/)){throw new Error(`Invalid budget id “${$}”. Check the id of your budget in the Advanced section of the settings page.`)}return oc(oh(),$)};let og=null;let om=null;let o_=false;const ov="/default-db.sqlite";const ow="/migrations";const oE="/demo-budget";const oS=()=>"/";const oT=function($){return $.replace(/^\//,"").replace(/\//g,"-")};function oO($){try{og.readlink($);return true}catch($){}try{og.stat($);return true}catch($){}return false}function oA($){let ee=$.split("/").filter($=>$!=="");let et="";for(let $ of ee){et+="/"+$;if(!oO(et)){og.mkdir(et)}}}function oI($){if(!o_&&$.startsWith("/documents")){if($.endsWith(".sqlite")){if(!oO($)){og.symlink("/blocked/"+oT($),$)}}else{og.writeFile($,"!$@) this should never read !$@)")}}return $}async function oN($,ee){if(!o_&&$.startsWith("/documents")&&!$.endsWith(".sqlite")){if(!oO($)){throw new Error("File does not exist: "+$)}let{store:et}=rz(await rG(),"files");let en=await rV(et,$);if(en==null){throw new Error("File does not exist: "+$)}if(ee.encoding==="utf8"&&ArrayBuffer.isView(en.contents)){return String.fromCharCode.apply(null,new Uint16Array(en.contents.buffer))}return en.contents}else{return og.readFile(oD($),ee)}}function oD($){try{let{node:ee}=og.lookupPath($,{follow:false});return ee.link?og.readlink($):$}catch(ee){return $}}async function oR($,ee){if(ee instanceof ArrayBuffer){ee=new Uint8Array(ee)}else if(ArrayBuffer.isView(ee)){ee=new Uint8Array(ee.buffer)}oI($);if(!o_&&$.startsWith("/documents")){let et=$.endsWith(".sqlite");let{store:en}=rz(await rG(),"files");if(et){await r$(en,{filepath:$,contents:""});await Promise.resolve();og.writeFile(oD($),ee)}else{await r$(en,{filepath:$,contents:ee})}}else{og.writeFile(oD($),ee)}}async function oC($){if(!o_&&$.startsWith("/documents")){let ee=$.endsWith(".sqlite");let{store:et}=rz(await rG(),"files");await rq(et,$);if(ee){let ee=oD($);if(oO(ee)){og.unlink(ee)}}}og.unlink($)}async function oM(){let $=await (await fetch("/"+"data-file-index.txt")).text();let ee=$.split("\n").map($=>$.trim()).filter($=>$!=="");let et=$=>fetch($).then($=>$.arrayBuffer());await oU("/migrations");await oU("/demo-budget");await Promise.all(ee.map(async $=>{let ee=await et("/"+"data/"+$);oR("/"+$,ee)}))}const oL=async function(){let{store:$}=rz(await rG(),"files");let ee=$.getAllKeys();let et=await new Promise(($,et)=>{ee.onsuccess=ee=>$(ee.target.result);ee.onerror=$=>et($)});for(let $ of et){oA(oP($));oI($)}};const ox=async function(){let $=a4();og=$.FS;og.mkdir("/uploads");og.mkdir("/documents");og.mkdir("/blocked");if(true){let ee=new aN(()=>{aX("fallback-write-error")});om=new i7(og,ee);$.register_for_idb(om);og.mount(om,{},"/blocked");await oM()}await oL()};const oP=function($){let ee=$.split("/");return ee.slice(0,-1).join("/")};const oF=async function($){let ee=og.readdir($);return ee.filter($=>$!=="."&&$!=="..")};const oB=async function($){return oO($)};const oU=async function($){og.mkdir($)};const oj=async function($){let ee=og.stat(oD($));return ee.size};const oW=async function($,ee){let et=await oN($);return oR(ee,et)};const oH=async function($,ee="utf8"){return oN($,{encoding:ee})};const oz=async function($,ee){return oR($,ee)};const oV=async function($){return oC($)};const o$=async function($){og.rmdir($)};const oq=async function($){if(await oB($)){for(let ee of(await oF($))){let et=oc($,ee);let en=og.stat(et,true);if(og.isDir(en.mode)){await oq(et)}else{await oV(et)}}await o$($)}};const oG=async function($){throw new Error("getModifiedTime not supported on the web (only used for backups)")};function oY($,ee,et,en){et.forEach(et=>{if(en){if(ee.hasOwnProperty(et)&&ee[et]==null){throw new Error(`${$} is missing field ${et}`)}}else{if(!ee.hasOwnProperty(et)||ee[et]==null){throw new Error(`${$} is missing field ${et}`)}}})}function oK($){if(typeof $!=="string"){throw new Error("toDateRepr not passed a string: "+$)}return parseInt($.replace(/-/g,""))}function oZ($){if(typeof $!=="number"){throw new Error("fromDateRepr not passed a number: "+$)}const ee=$.toString();return ee.slice(0,4)+"-"+ee.slice(4,6)+"-"+ee.slice(6)}const oJ={validate($,{update:ee}={}){oY("account",$,ee?["name","offbudget","closed"]:["name"],ee);return $}};const oX={validate($,{update:ee}={}){oY("category",$,ee?["name","is_income","cat_group"]:["name","cat_group"],ee);let{sort_order:et,...en}=$;return{...en,hidden:en.hidden?1:0}}};const oQ={validate($,{update:ee}={}){oY("categoryGroup",$,ee?["name","is_income"]:["name"],ee);let{sort_order:et,...en}=$;return{...en,hidden:en.hidden?1:0}}};const o0={validate($,{update:ee}={}){oY("payee",$,["name"],ee);return $}};const o1={validate($,{update:ee}={}){oY("transaction",$,["date","acct"],ee);if("date"in $){if($.date.match(/^\d{4}-\d{2}-\d{2}$/)==null||$.date<"2000-01-01"){throw new Error("Invalid transaction date: "+$.date)}}return $},toJS($){if(!("location"in $)){throw new Error("A full transaction is required to be passed to `toJS`. Instead got: "+JSON.stringify($))}let ee={...$};ee.error=$.error?JSON.parse($.error):null;ee.isParent=$.isParent===1?true:false;ee.isChild=$.isChild===1?true:false;ee.starting_balance_flag=$.starting_balance_flag===1?true:false;ee.cleared=$.cleared===1?true:false;ee.pending=$.pending===1?true:false;ee.date=ee.date&&oZ(ee.date);return ee},fromJS($){let ee={...$};if("error"in ee){ee.error=$.error?JSON.stringify($.error):null}if("isParent"in ee){ee.isParent=$.isParent?1:0}if("isChild"in ee){ee.isChild=$.isChild?1:0}if("cleared"in ee){ee.cleared=$.cleared?1:0}if("pending"in ee){ee.pending=$.pending?1:0}if("starting_balance_flag"in ee){ee.starting_balance_flag=$.starting_balance_flag?1:0}if("date"in ee){ee.date=oK($.date)}return ee}};function o2($,ee){return ee.required||$==="id"}function o6($,ee){if($===undefined){throw new Error("Query value cannot be undefined")}else if($===null){if(ee==="boolean"){return 0}return null}switch(ee){case"date":if($ instanceof Date){return oK(nI($))}else if($.match(/^\d{4}-\d{2}-\d{2}$/)==null||$.date<"2000-01-01"){throw new Error("Invalid date: "+$)}return oK($);case"date-month":return oK($.slice(0,7));case"date-year":return oK($.slice(0,4));case"boolean":return $?1:0;case"id":if(typeof $!=="string"&&$!==null){throw new Error("Invalid id, must be string: "+$)}return $;case"integer":if(typeof $==="number"&&Number.isInteger($)){return $}else{throw new Error("Can’t convert to integer: "+JSON.stringify($))}case"json":return JSON.stringify($);default:}return $}function o4($,ee){if($===null){if(ee==="boolean"){return false}return null}switch(ee){case"date":return oZ($);case"date-month":return oZ($).slice(0,7);case"date-year":return oZ($).slice(0,4);case"boolean":return $===1;case"json":case"json/fallback":try{return JSON.parse($)}catch(et){return ee==="json/fallback"?$:null}default:}return $}function o3($,ee,et,en,{skipNull:ei=false}={}){let eo=$[et];if(eo==null){throw new Error(`Table “${et}” does not exist`)}let es=ee.views||{};let eu=$=>{if(es[et]&&es[et].fields){return es[et].fields[$]||$}return $};return Object.fromEntries(Object.keys(en).map($=>{if($[0]==="_"){return null}let ee=eo[$];if(ee==null){throw new Error(`Field “${$}” does not exist on table ${et}: ${JSON.stringify(en)}`)}if(o2($,ee)&&en[$]==null){throw new Error(`“${$}” is required for table “${et}”: ${JSON.stringify(en)}`)}if(ei&&en[$]==null){return null}return[eu($),o6(en[$],ee.type)]}).filter(Boolean))}function o8($,ee,et,en){let ei={...en};let eo=$[et];if(eo==null){throw new Error(`Error inserting: table “${et}” does not exist`)}Object.keys(eo).forEach($=>{let ee=eo[$];if(ei[$]==null){if(ee.default!==undefined){ei[$]=typeof ee.default==="function"?ee.default():ee.default}else if(o2($,ee)){throw new Error(`“${$}” is required for table “${et}”: ${JSON.stringify(ei)}`)}}});return o3($,ee,et,ei,{skipNull:true})}function o5($,ee,et,en){let ei={...en};let eo=$[et];if(eo==null){throw new Error(`Error updating: table “${et}” does not exist`)}return o3($,ee,et,ei)}function o9($,ee,et,en){let ei=$[et];if(ei==null){throw new Error(`Table “${et}” does not exist`)}let eo=Object.keys(ei);let es={};for(let $=0;$<eo.length;$++){let ee=eo[$];let et=ei[ee];es[ee]=o4(en[ee],et.type)}return es};let o7=0;function se(){o7=0}function st($){o7++;return $+o7}class sr extends Error{}function sn($){let ee=$=>($<10?"0":"")+$;return $.getFullYear()+ee($.getMonth()+1)+ee($.getDate())}function si($){return parseInt($.replace(/-/g,""))}function so($,ee,et,en){let ei=$[ee].tombstone!=null;return ei?`${en} AND ${et}.tombstone = 0`:en}function ss($){let ee=$.split(".");return{path:ee.slice(0,-1).join("."),field:ee[ee.length-1]}}function su($){return $==="group"}function sl($){return $.indexOf(".")===-1&&!su($)?$:`"${$}"`}function sc($,ee,{literal:et=false}={}){return{value:$,type:ee,literal:et}}function sf($,ee,et){if($[ee]==null){throw new sr(`Table “${ee}” does not exist in the schema`)}let en=$[ee][et];if(en==null){throw new sr(`Field “${et}” does not exist in table “${ee}”`)}return en}function sd($,ee){let{schema:et,paths:en}=$;let ei=ee.split(".");if(ei.length<2){throw new sr("Invalid path: "+ee)}let eo=ei[0];let es=ei.slice(1).reduce(($,ee)=>{let en=et[$];if(en==null){throw new sr(`Path error: ${$} table does not exist`)}if(!en[ee]||en[ee].ref==null){throw new sr(`Field not joinable on table ${$}: “${ee}”`)}return en[ee].ref},eo);let eu;let el=ei.slice(0,-1);if(el.length===1){eu=el[0]}else{let $=el.join(".");let ee=en.get($);if(!ee){throw new sr("Path does not exist: "+$)}eu=ee.tableId}return{tableName:es,tableId:st(es),joinField:ei[ei.length-1],joinTable:eu}}function sp($,ee){let et=ee.split(".");et=et.reduce(($,ee)=>{let et=$.context+"."+ee;return{context:et,path:[...$.path,et]}},{context:$.implicitTableName,path:[]}).path;et.forEach(ee=>{if(!$.paths.get(ee)){$.paths.set(ee,sd($,ee))}});let en=$.paths.get(et[et.length-1]);return en}function sh($,ee){if(typeof ee!=="string"){throw new sr("Invalid field name, must be a string")}let{path:et,field:en}=ss(ee);let ei;if(et===""){ei={tableName:$.implicitTableName,tableId:$.implicitTableId}}else{ei=sp($,et)}let eo=sf($.schema,ei.tableName,en);if($.validateRefs&&eo.ref&&eo.type==="id"&&en!=="id"){let et=$.implicitTableName+"."+ee;let eo=$.paths.get(et);if(!eo){eo=sd($,et);eo.noMapping=true;$.paths.set(et,eo)}en="id";ei=eo}let es=ei.tableId+"."+en;return sc(es,eo.type)}function sy($){let ee=$.match(/^(\d{4}-\d{2}-\d{2})$/);if(ee){return sc(si(ee[1]),"date",{literal:true})}return null}function sg($){let ee=$.match(/^(\d{4}-\d{2})$/);if(ee){return sc(si(ee[1]),"date",{literal:true})}return null}function sm($){let ee=$.match(/^(\d{4})$/);if(ee){return sc(si(ee[1]),"date",{literal:true})}return null}function s_($,ee){throw new sr(`Bad ${ee} format: ${$}`)}function sv($,ee){let et=$.paramType;if(et){let en={date:["string"],"date-month":["date"],"date-year":["date","date-month"],id:["string"],float:["integer"]};if(et!==ee&&(!en[ee]||!en[ee].includes(et))){throw new Error(`Parameter “${$.paramName}” can’t convert to ${ee} (already inferred as ${et})`)}}else{$.paramType=ee}}function sw($,ee,et){if(ee.type===et){return ee}else if(ee.type==="param"){sv(ee,et);return sc(ee.value,et)}else if(ee.type==="null"){if(!ee.literal){throw new sr("A non-literal null doesn’t make sense")}if(et==="boolean"){return sc(0,"boolean",{literal:true})}return ee}if(et==="date"){if(ee.type==="string"){if(ee.literal){return sy(ee.value)||s_(ee.value,"date")}else{throw new sr("Casting string fields to dates is not supported")}}throw new sr(`Can’t cast ${ee.type} to date`)}else if(et==="date-month"){let $;if(ee.type==="date"){$=ee}else if(ee.type==="string"||ee.type==="any"){$=sg(ee.value)||sy(ee.value)||s_(ee.value,"date-month")}else{throw new sr(`Can’t cast ${ee.type} to date-month`)}if($.literal){return sc(si($.value.toString().slice(0,6)),"date-month",{literal:true})}else{return sc(`CAST(SUBSTR(${$.value}, 1, 6) AS integer)`,"date-month")}}else if(et==="date-year"){let $;if(ee.type==="date"||ee.type==="date-month"){$=ee}else if(ee.type==="string"){$=sm(ee.value)||sg(ee.value)||sy(ee.value)||s_(ee.value,"date-year")}else{throw new sr(`Can’t cast ${ee.type} to date-year`)}if($.literal){return sc(si($.value.toString().slice(0,4)),"date-year",{literal:true})}else{return sc(`CAST(SUBSTR(${$.value}, 1, 4) AS integer)`,"date-year")}}else if(et==="id"){if(ee.type==="string"){return sc(ee.value,"id",{literal:ee.literal})}}else if(et==="float"){if(ee.type==="integer"){return sc(ee.value,"float",{literal:ee.literal})}}if(ee.type==="any"){return sc(ee.value,et,{literal:ee.literal})}throw new sr(`Can’t convert ${ee.type} to ${et}`)}function sE($,ee,et){let en=ee;if(et){en=sw($,ee,et)}if(en.literal){if(en.type==="id"){return`'${en.value}'`}else if(en.type==="string"){let $=en.value.replace(/'/g,"''");return`'${$}'`}}return en.value}function sS($,ee,et){return ee.map((ee,en)=>sE($,ee,et?et[en]:null))}function sT($,ee,et){if(et==null){et=ee}if(ee!=null&&$.length<ee){throw new sr("Too few arguments")}if(et!=null&&$.length>et){throw new sr("Too many arguments")}}function sO($,ee){return(et,...en)=>{if(et==null||et.compileStack==null){throw new sr("This function cannot track error data. "+"It needs to accept the compiler state as the first argument.")}et.compileStack.push({type:$,args:en});let ei=ee(et,...en);et.compileStack.pop();return ei}}function sA($){if(typeof $==="string"){return $}else if($===undefined){return"undefined"}let ee=JSON.stringify($);if(ee.length>70){let ee=JSON.stringify($,null,2);return ee.split("\n").join("\n ")}return ee}function sI($,ee){if(ee.length===0){return $}let et=ee.slice(1).reverse().map($=>{switch($.type){case"expr":case"function":return sA($.args[0]);case"op":{let[ee,et]=$.args;return sA({[ee]:et})}case"value":return sA($.value);default:return""}}).map($=>"\n "+$).join("");const en=ee[0].type;const ei=ee[0].args[0];et+=`
|
|
20
|
+
${en}(${sA(ei.length===1?ei[0]:ei)})`;if(true){const ee=new sr;ee.message=`${$.message}
|
|
21
21
|
|
|
22
22
|
Expression stack:`+et;ee.stack=null;return ee}$.message=`${$.message}
|
|
23
23
|
|
|
24
|
-
Expression stack:`+et;return $}function
|
|
24
|
+
Expression stack:`+et;return $}function sN($){if($===undefined){throw new sr("`undefined` is not a valid query value")}else if($===null){return sc("NULL","null",{literal:true})}else if($ instanceof Date){return sc(sn($),"date",{literal:true})}else if(typeof $==="string"){$=$.replace(/\\\$/g,"$");return sc($,"string",{literal:true})}else if(typeof $==="boolean"){return sc($?1:0,"boolean",{literal:true})}else if(typeof $==="number"){return sc($,Number.isInteger($)?"integer":"float",{literal:true})}else if(Array.isArray($)){return sc($,"array",{literal:true})}else{throw new sr("Unsupported type of expression: "+JSON.stringify($))}}const sD=sO("expr",($,ee)=>{if(typeof ee==="string"){if(ee[0]==="$"){let et=ee==="$"?$.implicitField:ee.slice(1);if(et==null||et===""){throw new sr("Invalid field reference: "+ee)}return sh($,et)}if(ee[0]===":"){let et={value:"?",type:"param",paramName:ee.slice(1)};$.namedParameters.push(et);return et}}if(ee!==null){if(Array.isArray(ee)){return sN(ee)}else if(typeof ee==="object"&&Object.keys(ee).find($=>$[0]==="$")){return sR($,ee)}}return sN(ee)});const sR=sO("function",($,ee)=>{let[et]=Object.keys(ee);let en=ee[et];if(!Array.isArray(en)){en=[en]}if(et[0]!=="$"){throw new sr(`Unknown property “${et}.” Did you mean to call a function? Try prefixing it with $`)}let ei=en;if(et!=="$condition"){ei=en.map(ee=>sD($,ee))}switch(et){case"$sum":{sT(ei,1);let[ee]=sS($,ei,["float"]);return sc(`SUM(${ee})`,ei[0].type)}case"$sumOver":{let[ee]=sS($,ei,["float"]);let et=$.orders?"ORDER BY "+sj($,$.orders):"";return sc(`(SUM(${ee}) OVER (${et} ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING))`,ei[0].type)}case"$count":{sT(ei,1);let[ee]=sS($,ei);return sc(`COUNT(${ee})`,"integer")}case"$substr":{sT(ei,2,3);let[ee,et,en]=sS($,ei,["string","integer","integer"]);return sc(`SUBSTR(${ee}, ${et}, ${en})`,"string")}case"$lower":{sT(ei,1);let[ee]=sS($,ei,["string"]);return sc(`UNICODE_LOWER(${ee})`,"string")}case"$neg":{sT(ei,1);sS($,ei,["float"]);return sc(`(-${sE($,ei[0])})`,ei[0].type)}case"$abs":{sT(ei,1);sS($,ei,["float"]);return sc(`ABS(${sE($,ei[0])})`,ei[0].type)}case"$idiv":{sT(ei,2);sS($,ei,["integer","integer"]);return sc(`(${sE($,ei[0])} / ${sE($,ei[1])})`,ei[0].type)}case"$month":{sT(ei,1);return sw($,ei[0],"date-month")}case"$year":{sT(ei,1);return sw($,ei[0],"date-year")}case"$condition":sT(ei,1);let eo=sk($,ei[0]);return sc(eo.join(" AND "),"boolean");case"$nocase":sT(ei,1);let[es]=sS($,ei,["string"]);return sc(`${es} COLLATE NOCASE`,ei[0].type);case"$literal":{sT(ei,1);if(!ei[0].literal){throw new sr("Literal not passed to $literal")}return ei[0]}default:throw new sr(`Unknown function: ${et}`)}});const sC=sO("op",($,ee,et)=>{let{$transform:en,...ei}=et;let[eo]=Object.keys(ei);let es=sD($,et[eo]);let eu;if(en){eu=sR({...$,implicitField:ee},typeof en==="string"?{[en]:"$"}:en)}else{eu=sD($,"$"+ee)}switch(eo){case"$gte":{let[ee,et]=sS($,[eu,es],[null,eu.type]);return`${ee} >= ${et}`}case"$lte":{let[ee,et]=sS($,[eu,es],[null,eu.type]);return`${ee} <= ${et}`}case"$gt":{let[ee,et]=sS($,[eu,es],[null,eu.type]);return`${ee} > ${et}`}case"$lt":{let[ee,et]=sS($,[eu,es],[null,eu.type]);return`${ee} < ${et}`}case"$eq":{if(sw($,es,eu.type).type==="null"){return`${sE($,eu)} IS NULL`}let[ee,et]=sS($,[eu,es],[null,eu.type]);if(es.type==="param"){let en=$.namedParameters.map($=>{return $===es||$===eu?[$,{...$}]:$});$.namedParameters=[].concat.apply([],en);return`CASE
|
|
25
25
|
WHEN ${ee} IS NULL THEN ${et} IS NULL
|
|
26
26
|
ELSE ${ee} = ${et}
|
|
27
|
-
END`}return`${ee} = ${et}`}case"$ne":{if(
|
|
27
|
+
END`}return`${ee} = ${et}`}case"$ne":{if(sw($,es,eu.type).type==="null"){return`${sE($,eu)} IS NULL`}let[ee,et]=sS($,[eu,es],[null,eu.type]);if(es.type==="param"){let en=$.namedParameters.map($=>{return $===es||$===eu?[$,{...$}]:$});$.namedParameters=[].concat.apply([],en);return`CASE
|
|
28
28
|
WHEN ${ee} IS NULL THEN ${et} IS NULL
|
|
29
29
|
ELSE ${ee} != ${et}
|
|
30
|
-
END`}return`${ee} != ${et}`}case"$oneof":{let[ee,et]=
|
|
31
|
-
OR ${ee} IS NULL)`}default:throw new
|
|
30
|
+
END`}return`${ee} != ${et}`}case"$oneof":{let[ee,et]=sS($,[eu,es],[null,"array"]);let en=[...new Set(et)];return`${ee} IN (`+en.map($=>`'${$}'`).join(",")+")"}case"$like":{let[ee,et]=sS($,[eu,es],["string","string"]);return`${ee} LIKE ${et}`}case"$notlike":{let[ee,et]=sS($,[eu,es],["string","string"]);return`(${ee} NOT LIKE ${et}
|
|
31
|
+
OR ${ee} IS NULL)`}default:throw new sr(`Unknown operator: ${eo}`)}});function sk($,ee){if(!Array.isArray(ee)){ee=Object.entries(ee).map($=>{return{[$[0]]:$[1]}})}return ee.filter(Boolean).reduce((ee,et)=>{let en=Object.entries(et).map(([ee,et])=>{if(ee==="$and"){if(!et){return null}return sL($,et)}else if(ee==="$or"){if(!et){return null}return sM($,et)}if(typeof et==="string"||typeof et==="number"||typeof et==="boolean"||et instanceof Date||et==null){return sC($,ee,{$eq:et})}if(Array.isArray(et)){return et.map(et=>sC($,ee,et)).join(" AND ")}return sC($,ee,et)}).filter(Boolean);return[...ee,...en]},[])}function sM($,ee){if(!ee){return"0"}let et=sk($,ee);if(et.length===0){return"0"}return"("+et.join("\n OR ")+")"}function sL($,ee){if(!ee){return"1"}let et=sk($,ee);if(et.length===0){return"1"}return"("+et.join("\n AND ")+")"}const sx=sO("filter",($,ee)=>{return sL($,ee)});function sP($,ee,et){let en=[];$.paths.forEach((ei,eo)=>{let{tableName:es,tableId:eu,joinField:el,joinTable:ef,noMapping:ed}=$.paths.get(eo);let ep=`${eu}.id = ${ee(ef)}.${sl(el)}`;let eh=et(es);if(eh.length>0){ep+=" AND "+sL({...$,implicitTableName:es,implicitTableId:eu},eh)}en.push(`LEFT JOIN ${ed?es:ee(es,true)} ${eu} ON ${so($.schema,es,eu,ep)}`);if($.dependencies.indexOf(es)===-1){$.dependencies.push(es)}});return en.join("\n")}function sF($,ee){let et;let en;if(ee==="*"){en={tableName:$.implicitTableName,tableId:$.implicitTableId}}else if(ee.match(/\.\*$/)){let ei=ss(ee);et=ei.path;en=sp($,ei.path)}let ei=$.schema[en.tableName];if(ei==null){throw new Error(`Table “${en.tableName}” does not exist`)}return Object.keys(ei).map($=>et?`${et}.${$}`:$)}const sB=sO("select",($,ee,et,en)=>{if(!et&&!ee.includes("id")&&!ee.includes("*")){ee=ee.concat(["id"])}let ei=ee.map(ee=>{if(typeof ee==="string"){if(ee.indexOf("*")!==-1){let et=sF($,ee);return et.map(ee=>{let et=sD($,"$"+ee);$.outputTypes.set(ee,et.type);return et.value+" AS "+sl(ee)}).join(", ")}let et=sD($,"$"+ee);$.outputTypes.set(ee,et.type);return et.value+" AS "+sl(ee)}let[et,ei]=Object.entries(ee)[0];if(et[0]==="$"){$.compileStack.push({type:"value",value:ee});throw new sr(`Invalid field “${et}”, are you trying to select a function? You need to name the expression`)}if(typeof ei==="string"){let ee=sD($,"$"+ei);$.outputTypes.set(et,ee.type);return`${ee.value} AS ${sl(et)}`}let eo=sR({...$,orders:en},ei);$.outputTypes.set(et,eo.type);return eo.value+` AS ${sl(et)}`});return ei.join(", ")});const sU=sO("groupBy",($,ee)=>{let et=ee.map(ee=>{if(typeof ee==="string"){return sD($,"$"+ee).value}return sR($,ee).value});return et.join(", ")});const sj=sO("orderBy",($,ee)=>{let et=ee.map(ee=>{let et;let en=null;if(typeof ee==="string"){et=sD($,"$"+ee).value}else{let ei=Object.entries(ee);let eo=ei[0];if(ei.length===1&&eo[0][0]!=="$"){en=eo[1];et=sD($,"$"+eo[0]).value}else{let{$dir:ei,...eo}=ee;en=ei;et=sR($,eo).value}}if(en!=null){if(en!=="desc"&&en!=="asc"){throw new sr("Invalid order direction: "+en)}return`${et} ${en}`}return et});return et.join(", ")});let sW=["$sum","$count"];function sH($){if(typeof $!=="object"||Array.isArray($)){return false}let[ee,et]=Object.entries($)[0];if(!Array.isArray(et)){et=[et]}if(sW.indexOf(ee)!==-1){return true}return!!et.find($=>sH($))}function sz($){if($.groupExpressions.length>0){return true}return!!$.selectExpressions.find($=>{if(typeof $!=="string"){let[ee,et]=Object.entries($)[0];return sH(et)}return false})}function sV($,ee,et={}){let{withDead:en,validateRefs:ei=true,tableOptions:eo,rawMode:es}=$;let{tableViews:eu={},tableFilters:el=$=>[],customizeQuery:ef=$=>$}=et;let ed=$=>{let ee=el($);for(let $ of ee){if(Array.isArray($)){throw new sr("Invalid internal table filter: only object filters are supported")}if(Object.keys($)[0].indexOf(".")!==-1){throw new sr("Invalid internal table filter: field names cannot contain paths")}}return ee};let ep=($,ee)=>{let et=typeof eu==="function"?eu($,{withDead:en,isJoin:ee,tableOptions:eo}):eu[$];return et||$};let eh=$.table;let{filterExpressions:ey,selectExpressions:eg,groupExpressions:em,orderExpressions:e_,limit:ew,offset:eE}=ef($);let eS="";let eT="";let eO="";let eA="";let eI="";let eN={schema:ee,implicitTableName:eh,implicitTableId:ep(eh),paths:new Map,dependencies:[eh],compileStack:[],outputTypes:new Map,validateRefs:ei,namedParameters:[]};se();try{eS=sB(eN,eg,sz($),e_);if(ey.length>0){let $=sx(eN,ey);eT="WHERE "+$}else{eT="WHERE 1"}if(!es){let $=ed(eh);if($.length>0){eT+=" AND "+sL(eN,$)}}if(em.length>0){let $=sU(eN,em);eA="GROUP BY "+$}if(e_.length>0){let $=sj(eN,e_);eI="ORDER BY "+$}if(eN.paths.size>0){eO=sP(eN,ep,ed)}}catch($){if($ instanceof sr){throw sI($,eN.compileStack)}throw $}let eD={select:eS,from:ep(eh),joins:eO,where:eT,groupBy:eA,orderBy:eI,limit:ew,offset:eE};return{sqlPieces:eD,state:eN}}function s$($,ee,et){let en=et;let ei=$.withDead?en.where:so(ee.schema,ee.implicitTableName,ee.implicitTableId,en.where);return`
|
|
32
32
|
SELECT ${en.select} FROM ${en.from}
|
|
33
33
|
${en.joins}
|
|
34
34
|
${ei}
|
|
@@ -36,10 +36,10 @@ Expression stack:`+et;return $}function sA($){if($===undefined){throw new se("`u
|
|
|
36
36
|
${en.orderBy}
|
|
37
37
|
${en.limit!=null?`LIMIT ${en.limit}`:""}
|
|
38
38
|
${en.offset!=null?`OFFSET ${en.offset}`:""}
|
|
39
|
-
`}function
|
|
39
|
+
`}function sq($,ee,et){let{sqlPieces:en,state:ei}=sV($,ee,et);return{sql:s$($,ei,en),state:ei}};function sG($){return Object.keys($).map(ee=>{let et=$[ee];let en=et!==ee;if(!et.match(/[ .]/)){et=`_.${et}`}return en?`${et} AS ${sl(ee)}`:`${et}`}).join(", ")}function sY($,ee){let et=ee.views;let en=[];Object.keys(et).forEach(ee=>{let{fields:ei={},...eo}=et[ee];let es=Object.fromEntries(Object.keys($[ee]).map($=>[$,$]));let eu={...es,...ei};Object.keys(eo).forEach($=>{let ee=$=>{let ee={...es,...$};return sG(ee)};let et=$=>{let ee={...eu,...$};return sG(ee)};let ei;if(typeof eo[$]==="function"){ei=eo[$](et,ee)}else{ei=eo[$]}ei=ei.trim().replace(/;$/,"");en.push(`
|
|
40
40
|
DROP VIEW IF EXISTS ${$};
|
|
41
41
|
CREATE VIEW ${$} AS ${ei};
|
|
42
|
-
`)})});return en.join("\n")};function
|
|
42
|
+
`)})});return en.join("\n")};function sK($,ee){return{type:$,...ee}}const sZ={transactions:{id:sK("id"),is_parent:sK("boolean"),is_child:sK("boolean"),parent_id:sK("id"),account:sK("id",{ref:"accounts",required:true}),category:sK("id",{ref:"categories"}),amount:sK("integer",{default:0,required:true}),payee:sK("id",{ref:"payees"}),notes:sK("string"),date:sK("date",{required:true}),imported_id:sK("string"),error:sK("json"),imported_payee:sK("string"),starting_balance_flag:sK("boolean"),transfer_id:sK("id"),sort_order:sK("float",{default:()=>Date.now()}),cleared:sK("boolean",{default:true}),tombstone:sK("boolean"),schedule:sK("id",{ref:"schedules"})},payees:{id:sK("id"),name:sK("string",{required:true}),transfer_acct:sK("id",{ref:"accounts"}),tombstone:sK("boolean")},accounts:{id:sK("id"),name:sK("string",{required:true}),offbudget:sK("boolean"),closed:sK("boolean"),sort_order:sK("float"),tombstone:sK("boolean")},categories:{id:sK("id"),name:sK("string"),is_income:sK("boolean"),hidden:sK("boolean"),group:sK("id",{ref:"category_groups"}),sort_order:sK("float"),tombstone:sK("boolean")},category_groups:{id:sK("id"),name:sK("string"),is_income:sK("boolean"),hidden:sK("boolean"),sort_order:sK("float"),tombstone:sK("boolean")},schedules:{id:sK("id"),name:sK("string"),rule:sK("id",{ref:"rules",required:true}),next_date:sK("date"),completed:sK("boolean"),posts_transaction:sK("boolean"),tombstone:sK("boolean"),_payee:sK("id",{ref:"payees"}),_account:sK("id",{ref:"accounts"}),_amount:sK("json/fallback"),_amountOp:sK("string"),_date:sK("json/fallback"),_conditions:sK("json"),_actions:sK("json")},rules:{id:sK("id"),stage:sK("string"),conditions_op:sK("string"),conditions:sK("json"),actions:sK("json"),tombstone:sK("boolean")},notes:{id:sK("id"),note:sK("string")},transaction_filters:{id:sK("id"),name:sK("string"),conditions_op:sK("string"),conditions:sK("json"),tombstone:sK("boolean")}};const sJ={tableViews($,{isJoin:ee,withDead:et,tableOptions:en={splits:undefined}}){switch($){case"transactions":{if(ee){return"v_transactions_internal_alive"}let $=en.splits||"inline";if(!et&&($==="inline"||$==="none")){return"v_transactions_internal_alive"}return"v_transactions_internal"}case"schedules":return"v_schedules";case"categories":return"v_categories";case"payees":return"v_payees";default:}return $},customizeQuery($){let{table:ee}=$;function et($){if($.length>0){return $.concat(["id"])}switch(ee){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:true}},"next_date"];default:}return[]}return{...$,orderExpressions:et($.orderExpressions)}},views:{payees:{v_payees:$=>{let ee=$({name:"COALESCE(__accounts.name, _.name)"});return`
|
|
43
43
|
SELECT ${ee} FROM payees _
|
|
44
44
|
LEFT JOIN accounts __accounts ON (_.transfer_acct = __accounts.id AND __accounts.tombstone = 0)
|
|
45
45
|
-- We never want to show transfer payees that are pointing to deleted accounts.
|
|
@@ -74,7 +74,7 @@ Expression stack:`+et;return $}function sA($){if($===undefined){throw new se("`u
|
|
|
74
74
|
LEFT JOIN categories c ON (c.id = _.category AND c.tombstone = 0)
|
|
75
75
|
LEFT JOIN accounts a ON (a.id = _.account AND a.tombstone = 0)
|
|
76
76
|
ORDER BY _.date desc, _.starting_balance_flag, _.sort_order desc, _.id;
|
|
77
|
-
`}}}};class
|
|
77
|
+
`}}}};class sX{state;constructor($){this.state={filterExpressions:$.filterExpressions||[],selectExpressions:$.selectExpressions||[],groupExpressions:$.groupExpressions||[],orderExpressions:$.orderExpressions||[],calculation:false,rawMode:false,withDead:false,validateRefs:true,limit:null,offset:null,...$}}filter($){return new sX({...this.state,filterExpressions:[...this.state.filterExpressions,$]})}unfilter($){let ee=new Set($);return new sX({...this.state,filterExpressions:this.state.filterExpressions.filter($=>!ee.has(Object.keys($)[0]))})}select($=[]){if(!Array.isArray($)){$=[$]}let ee=new sX({...this.state,selectExpressions:$});ee.state.calculation=false;return ee}calculate($){let ee=this.select({result:$});ee.state.calculation=true;return ee}groupBy($){if(!Array.isArray($)){$=[$]}return new sX({...this.state,groupExpressions:[...this.state.groupExpressions,...$]})}orderBy($){if(!Array.isArray($)){$=[$]}return new sX({...this.state,orderExpressions:[...this.state.orderExpressions,...$]})}limit($){return new sX({...this.state,limit:$})}offset($){return new sX({...this.state,offset:$})}raw(){return new sX({...this.state,rawMode:true})}withDead(){return new sX({...this.state,withDead:true})}withoutValidatedRefs(){return new sX({...this.state,validateRefs:false})}options($){return new sX({...this.state,tableOptions:$})}serialize(){return this.state}}function sQ($,ee){let et=$.serialize().orderExpressions;if(et.length===0){if(ee){return{order:"asc",...ee}}return null}let en=et[0];if(typeof en==="string"){return{field:en,order:"asc"}}let[ei]=Object.keys(en);return{field:ei,order:en[ei]}}function ue($){return new sX({table:$})};function ut($,ee){for(let et=0;et<$.length;et++){let en=$[et];Object.keys(en).forEach($=>{en[$]=o4(en[$],ee.get($))})}}async function ur($,ee,et,en,ei){let eo=s$($,ee,et);let es=await f4(eo,en);ut(es,ei);return es}async function un($,ee,et,{params:en={},executors:ei={}}={}){let eo=et.namedParameters.map($=>{let ee=$.paramName;if(en[ee]===undefined){throw new Error(`Parameter ${ee} not provided to query`)}return o6(en[ee],$.paramType)});let es;if(ei[et.implicitTableName]){es=await ei[et.implicitTableName](et,$,ee,eo,et.outputTypes)}else{es=await ur($,et,ee,eo,et.outputTypes)}if($.calculation){if(es.length>0){let $=es[0];let ee=Object.keys($)[0];es=$[ee]||0}else{es=null}}return es}async function ui($,ee,et,en){let{sqlPieces:ei,state:eo}=sV(et,$,ee);let es=await un(et,ei,eo,en);return{data:es,dependencies:eo.dependencies}};async function uo($,ee,et,en,ei=[]){let eo=500;let es=[];let eu=new Set;for(let el=0;el<ee.length;el+=eo){let ef=ee.slice(el,el+eo).filter($=>!eu.has($));if(ef.length>0){let ee=ef.map($=>et($)).join(" OR ");let eo=en("("+ee+")");let el=await $(eo,ei,true);eu=new Set([...eu,...ef]);es=es.concat(el)}}return es}function us($,ee){let et=[...new Set($)];let en=`${ee} IN (`+et.map($=>`'${$}'`).join(",")+")";return en};function uu($,ee,et=$=>$){return $.reduce(($,en)=>{let ei=ee.get(en.id)||[];$.push({...et(en),subtransactions:ei.map(et)});return $},[])}function ul($,ee,et,en,ei){let eo=ee.tableOptions||{};let es=eo.splits||"inline";if(["all","inline","none","grouped"].indexOf(es)===-1){throw new Error(`Invalid “splits” option for transactions: “${es}”`)}if(es==="all"||es==="inline"||es==="none"){return up($,ee,et,en,es,ei)}else if(es==="grouped"){return ud($,ee,et,en,es,ei)}}function uc($){for(let ee of Object.keys($)){if(ee==="$or"||ee==="$and"){if($[ee]&&uc($[ee])){return true}}else if(!(ee.indexOf("account")===0||ee==="date")){return true}}return false}function uf($){return $.filterExpressions.find(uc)==null}async function ud($,ee,et,en,ei,eo){let{withDead:es}=ee;let eu=es?"":`AND ${et.from}.tombstone = 0`;if(sz(ee)){let ei={...et};ei.where=`${ei.where} AND ${ei.from}.is_parent = 0`;if(!es){ei.from="v_transactions_internal_alive v_transactions_internal"}return ur(ee,$,ei,en,eo)}let el;let ef=null;if(uf(ee)){let $=`
|
|
78
78
|
SELECT ${et.from}.id as group_id
|
|
79
79
|
FROM ${et.from}
|
|
80
80
|
${et.joins}
|
|
@@ -82,7 +82,7 @@ Expression stack:`+et;return $}function sA($){if($===undefined){throw new se("`u
|
|
|
82
82
|
${et.orderBy}
|
|
83
83
|
${et.limit!=null?`LIMIT ${et.limit}`:""}
|
|
84
84
|
${et.offset!=null?`OFFSET ${et.offset}`:""}
|
|
85
|
-
`;el=await
|
|
85
|
+
`;el=await f4($,en)}else{let $=`
|
|
86
86
|
SELECT group_id, matched FROM (
|
|
87
87
|
SELECT
|
|
88
88
|
group_id,
|
|
@@ -101,36 +101,36 @@ Expression stack:`+et;return $}function sA($){if($===undefined){throw new se("`u
|
|
|
101
101
|
${et.orderBy}
|
|
102
102
|
${et.limit!=null?`LIMIT ${et.limit}`:""}
|
|
103
103
|
${et.offset!=null?`OFFSET ${et.offset}`:""}
|
|
104
|
-
`;el=await
|
|
104
|
+
`;el=await f4($,en);ef=new Set([].concat.apply([],el.map($=>$.matched.split(","))))}let ed=us(el.map($=>$.group_id),`IFNULL(${et.from}.parent_id, ${et.from}.id)`);let ep=`
|
|
105
105
|
SELECT ${et.select}, parent_id AS _parent_id FROM ${et.from}
|
|
106
106
|
${et.joins}
|
|
107
107
|
WHERE ${ed} ${eu}
|
|
108
108
|
${et.orderBy}
|
|
109
|
-
`;let eh=await
|
|
109
|
+
`;let eh=await f4(ep);let{parents:ey,children:eg}=eh.reduce(($,ee)=>{let et=ee._parent_id;delete ee._parent_id;if(et==null){$.parents.push(ee)}else{let en=$.children.get(et)||[];en.push(ee);$.children.set(et,en)}return $},{parents:[],children:new Map});let em=$=>{Object.keys($).forEach(ee=>{$[ee]=o4($[ee],eo.get(ee))});if(ef&&!ef.has($.id)){$._unmatched=true}return $};return uu(ey,eg,em)}async function up($,ee,et,en,ei,eo){let es={...et};if(ei!=="all"){if(ei==="none"){es.where=`${es.where} AND ${es.from}.parent_id IS NULL`}else{es.where=`${es.where} AND ${es.from}.is_parent = 0`}}return ur(ee,$,es,en,eo)}const uh={transactions:ul};function uy($,ee,et,en){return un($,ee,et,{params:en,executors:uh})}function ug($,ee){if($ instanceof sX){$=$.serialize()}return ui(sZ,sJ,$,{params:ee,executors:uh})};;const um={info:(...$)=>{console.log(...$)},warn:(...$)=>{console.warn(...$)}};const u_=um;const uv=false;const uw=true;const uE=false;const uS=["report","rollover"];let uT=null;async function uO($){if(false){}const ee=oc(oy($),"metadata.json");try{uT=JSON.parse(await oH(ee))}catch(ee){uT={id:$,budgetName:$}}let et=["syncAccount"];for(const $ of et){delete uT[`flags.${$}`]}for(const $ of Object.keys(uT)){if($.startsWith("notifications.")){delete uT[$]}}uT.id=$;return uT}async function uA($,{avoidSync:ee=false}={}){Object.assign(uT,$);if(!ee){const ee=Object.keys($).map(ee=>{if(ee==="budgetType"||ee==="budgetName"){return{dataset:"prefs",row:ee,column:"value",value:$[ee],timestamp:eo.Timestamp.send()}}return null}).filter($=>$);if(ee.length>0){await fR(ee)}}if(true){let $=oc(oy(uT.id),"metadata.json");await oz($,JSON.stringify(uT))}}function uI(){uT=null}function uN(){return uT}function uD($,ee){return{id:$,budgetName:ee}};function uR($){return{all:$=$||new Map,on:function(ee,et){var en=$.get(ee);en?en.push(et):$.set(ee,[et])},off:function(ee,et){var en=$.get(ee);en&&(et?en.splice(en.indexOf(et)>>>0,1):$.set(ee,[]))},emit:function(ee,et){var en=$.get(ee);en&&en.slice().map(function($){$(et)}),(en=$.get("*"))&&en.slice().map(function($){$(ee,et)})}}};function uC(){let $={addNode:ei,removeNode:es,adjacent:eu,adjacentIncoming:el,addEdge:ef,removeEdge:ed,removeIncomingEdges:eo,topologicalSort:eh,generateDOT:ey,getEdges:en};let ee=new Map;let et=new Map;function en(){return{edges:ee,incomingEdges:et}}function ei(en){ee.set(en,eu(en));et.set(en,el(en));return $}function eo($){const ee=el($);et.set($,new Set);let en=ee.values();let ei=en.next();while(!ei.done){ed(ei.value,$);ei=en.next()}}function es(en){eo(en);ee.delete(en);et.delete(en);return $}function eu($){return ee.get($)||new Set}function el($){return et.get($)||new Set}function ef(ee,et){ei(ee);ei(et);eu(ee).add(et);el(et).add(ee);return $}function ed(en,ei){if(ee.has(en)){eu(en).delete(ei)}if(et.has(ei)){el(ei).delete(en)}return $}function ep($,ee,et){ee.add($);let en=eu($).values();let ei=en.next();while(!ei.done){if(!ee.has(ei.value)){ep(ei.value,ee,et)}ei=en.next()}et.unshift($)}function eh($){const ee=new Set;const et=[];$.forEach($=>{if(!ee.has($)){ep($,ee,et)}});return et}function ey(){let $=[];ee.forEach(function(ee,et){if(ee.length!==0){$.push(`${et} -> {${ee.join(",")}}`)}});return`
|
|
110
110
|
digraph G {
|
|
111
111
|
${$.join("\n").replace(/!/g,"_")}
|
|
112
112
|
}
|
|
113
|
-
`}return $}const
|
|
113
|
+
`}return $}const uk=uC;function uM($){let ee=$.indexOf("!");if(ee!==-1){return{sheet:$.slice(0,ee),name:$.slice(ee+1)}}return{sheet:null,name:$}}function uL($,ee){return $+"!"+ee};class ux{_meta;cacheBarrier;computeQueue;dirtyCells;events;graph;nodes;running;saveCache;setCacheStatus;transactionDepth;constructor($,ee){this.graph=new uk;this.nodes=new Map;this.transactionDepth=0;this.saveCache=$;this.setCacheStatus=ee;this.dirtyCells=[];this.computeQueue=[];this.events=uR();this._meta={createdMonths:new Set}}meta(){return this._meta}setMeta($){this._meta=$}_getNode($){const{sheet:ee}=uM($);if(!this.nodes.has($)){this.nodes.set($,{name:$,expr:null,value:null,sheet:ee})}return this.nodes.get($)}getNode($){return this._getNode($)}hasCell($){return this.nodes.has($)}add($,ee,et){this.set($,ee)}getNodes(){return this.nodes}serialize(){return{graph:this.graph.getEdges(),nodes:[...this.nodes.entries()]}}transaction($){this.startTransaction();try{$()}catch($){console.log($)}return this.endTransaction()}startTransaction(){this.transactionDepth++}endTransaction(){this.transactionDepth--;if(this.transactionDepth===0){const $=this.dirtyCells;this.dirtyCells=[];this.queueComputation(this.graph.topologicalSort($))}return[]}queueComputation($){this.computeQueue=this.computeQueue.concat($);Promise.resolve().then(()=>{if(!this.running){this.runComputations()}})}runComputations($=0){this.running=true;while($<this.computeQueue.length){let ee=this.computeQueue[$];let et;let en;try{et=this.getNode(ee);if(et._run){let $=et._dependencies.map($=>{return this.getNode($).value});en=et._run(...$);if(en instanceof Promise){console.warn(`dynamic cell ${ee} returned a promise! this is discouraged because errors are not handled properly`)}}else if(et.sql){en=uy(et.query,et.sql.sqlPieces,et.sql.state)}else{$++;continue}}catch($){console.log("Error while evaluating "+ee+":",$);this.running=false;this.computeQueue=[];return}if(en instanceof Promise){en.then(ee=>{et.value=ee;this.runComputations($+1)},ee=>{console.warn(`Failed running ${et.name}!`,ee);this.runComputations($+1)});return}else{et.value=en}$++}if($===this.computeQueue.length){this.events.emit("change",{names:this.computeQueue});if(typeof this.saveCache==="function"){this.saveCache(this.computeQueue)}this.markCacheSafe();this.running=false;this.computeQueue=[]}}markCacheSafe(){if(!this.cacheBarrier){if(this.setCacheStatus){this.setCacheStatus({clean:true})}}}markCacheDirty(){if(this.setCacheStatus){this.setCacheStatus({clean:false})}}startCacheBarrier(){this.cacheBarrier=true;this.markCacheDirty()}endCacheBarrier(){this.cacheBarrier=false;let $=this.running||this.computeQueue.length>0;if(!$){this.markCacheSafe()}}addEventListener($,ee){this.events.on($,ee);return()=>this.events.off($,ee)}onFinish($){if(this.transactionDepth!==0){throw new Error("onFinish called while inside a spreadsheet transaction. This is not allowed as it will lead to race conditions")}if(!this.running&&this.computeQueue.length===0){$([]);return()=>{}}let ee=this.addEventListener("change",(...et)=>{ee();return $(...et)});return ee}unload(){this.events.all.clear()}getValue($){return this.getNode($).value}getExpr($){return this.getNode($).expr}getCellValue($,ee){return this.getNode(uL($,ee)).value}getCellExpr($,ee){return this.getNode(uL($,ee)).expr}getCellValueLoose($,ee){let et=uL($,ee);if(this.nodes.has(et)){return this.getNode(et).value}return null}bootup($){this.onFinish(()=>{$()})}load($,ee){const et=this._getNode($);et.expr=ee;et.value=ee}create($,ee){return this.transaction(()=>{const et=this._getNode($);et.expr=ee;et.value=ee;this._markDirty($)})}set($,ee){this.create($,ee)}recompute($){this.transaction(()=>{this.dirtyCells.push($)})}recomputeAll(){this.transaction(()=>{this.dirtyCells=[...this.nodes.keys()]})}createQuery($,ee,et){let en=uL($,ee);let ei=this._getNode(en);if(ei.query!==et){ei.query=et;let{sqlPieces:$,state:ee}=sV(ei.query,sZ,sJ);ei.sql={sqlPieces:$,state:ee};this.transaction(()=>{this._markDirty(en)})}}createStatic($,ee,et){let en=uL($,ee);let ei=this.nodes.has(en);if(!ei){this.create(en,et)}}createDynamic($,ee,{dependencies:et=[],run:en,initialValue:ei,refresh:eo=false}){let es=uL($,ee);let eu=this._getNode(es);if(eu.dynamic){return}eu.dynamic=true;eu._run=en;et=et.map(ee=>{let et;if(!uM(ee).sheet){et=uL($,ee)}else{et=ee}return et});eu._dependencies=et;this.graph.removeIncomingEdges(es);et.forEach($=>{this.graph.addEdge($,es)});if(eu.value==null||eo){this.transaction(()=>{eu.value=ei;this._markDirty(es)})}}clearSheet($){for(let[ee,et]of this.nodes.entries()){if(et.sheet===$){this.nodes.delete(ee)}}}voidCell($,ee,et=null){let en=this.getNode(uL($,ee));en._run=null;en.dynamic=false;en.value=et}deleteCell($,ee){this.voidCell($,ee);this.nodes.delete(uL($,ee))}addDependencies($,ee,et){let en=uL($,ee);et=et.map(ee=>{if(!uM(ee).sheet){return uL($,ee)}return ee});let ei=this.getNode(en);let eo=et.filter($=>(ei._dependencies||[]).indexOf($)===-1);if(eo.length>0){ei._dependencies=(ei._dependencies||[]).concat(eo);eo.forEach($=>{this.graph.addEdge($,en)});this.recompute(en)}}removeDependencies($,ee,et){let en=uL($,ee);et=et.map(ee=>{if(!uM(ee).sheet){return uL($,ee)}return ee});let ei=this.getNode(en);ei._dependencies=(ei._dependencies||[]).filter($=>et.indexOf($)===-1);et.forEach($=>{this.graph.removeEdge($,en)});this.recompute(en)}_markDirty($){this.dirtyCells.push($)}triggerDatabaseChanges($,ee){let et=new Set([...$.keys(),...ee.keys()]);this.startTransaction();this.nodes.forEach($=>{if($.sql&&$.sql.state.dependencies.some($=>et.has($))){this._markDirty($.name)}});this.endTransaction()}};let uP;let uF;let uB;function uU(){return uP}async function uj($,ee){await oe($,()=>{ee.forEach(ee=>{const et=uP._getNode(ee);if(et.sql==null){a5($,"INSERT OR REPLACE INTO kvcache (key, value) VALUES (?, ?)",[ee,JSON.stringify(et.value)])}})})}function uW($,ee,{clean:et}){if(et){let et=Math.random()*1e7;a5(ee,"INSERT OR REPLACE INTO kvcache_key (id, key) VALUES (1, ?)",[et]);if($){a5($,"INSERT OR REPLACE INTO kvcache_key (id, key) VALUES (1, ?)",[et])}}else{a5(ee,"DELETE FROM kvcache_key")}}function uH($,ee){let et=a5(ee,"SELECT key FROM kvcache_key WHERE id = 1",[],true);let en=et.length===0?null:et[0].key;if(en==null){return true}if($){let ee=a5($,"SELECT key FROM kvcache_key WHERE id = 1",[],true);if(ee.length===0||ee[0].key!==en){return true}}et=a5(ee,"SELECT * FROM kvcache LIMIT 1",[],true);return et.length===0}async function uz($,ee){let et="production"!=="test";let en=$.getDatabase();let ei;if(uE&&et){let ee=$.getDatabasePath().replace(/db\.sqlite$/,"cache.sqlite");uB=ei=or(ee);a9(ei,`
|
|
114
114
|
CREATE TABLE IF NOT EXISTS kvcache (key TEXT PRIMARY KEY, value TEXT);
|
|
115
115
|
CREATE TABLE IF NOT EXISTS kvcache_key (id INTEGER PRIMARY KEY, key REAL)
|
|
116
|
-
`)}else{ei=en}let eo;if(et){eo=new
|
|
116
|
+
`)}else{ei=en}let eo;if(et){eo=new ux(uj.bind(null,ei),uW.bind(null,en,ei))}else{eo=new ux}aR({message:"loading spreaadsheet",category:"server"});uP=eo;uF=ee;if(ee){eo.addEventListener("change",ee)}if(et&&!uH(en,ei)){let $=await a5(ei,"SELECT * FROM kvcache",[],true);console.log(`Loaded spreadsheet from cache (${$.length} items)`);for(let ee of $){let $=JSON.parse(ee.value);eo.load(ee.key,$)}}else{console.log("Loading fresh spreadsheet");await uq($)}aR({message:"loaded spreaadsheet",category:"server"});return eo}function uV(){if(uP){uP.unload();uP=null}if(uB){oi(uB);uB=null}}async function u$($){if(uP){uV();return uz($,uF)}}async function uq($){let ee=uP;let{budgetType:et}=uN()||{};let en=et==="report"?"reflect_budgets":"zero_budgets";let ei=await $.all(`
|
|
117
117
|
SELECT * FROM ${en} b
|
|
118
118
|
LEFT JOIN categories c ON c.id = b.category
|
|
119
119
|
WHERE c.tombstone = 0
|
|
120
|
-
`);ee.startTransaction();for(let $ of ei){if($.month&&$.category){let et=`budget${$.month}`;ee.set(`${et}!budget-${$.category}`,$.amount);ee.set(`${et}!carryover-${$.category}`,$.carryover===1?true:false)}}if(et!=="report"){let et=await $.all("SELECT * FROM zero_budget_months");for(let $ of et){let et=
|
|
120
|
+
`);ee.startTransaction();for(let $ of ei){if($.month&&$.category){let et=`budget${$.month}`;ee.set(`${et}!budget-${$.category}`,$.amount);ee.set(`${et}!carryover-${$.category}`,$.carryover===1?true:false)}}if(et!=="report"){let et=await $.all("SELECT * FROM zero_budget_months");for(let $ of et){let et=n0($.id);ee.set(`${et}!buffered`,$.buffered)}}ee.endTransaction()}function uG($,ee){return uP._getNode(uL($,ee))}function uY($,ee){return uP.getValue(uL($,ee))}function uK(){if(uP){uP.startTransaction()}}function uZ(){if(uP){uP.endTransaction()}}function uJ(){return new Promise($=>{if(uP){uP.onFinish($)}else{$(undefined)}})};async function uX($,ee){const et=await uG($,ee);return iR(typeof et.value==="number"?et.value:0)}function uQ($,ee,et){et=Math.min(Math.max(et,-ee),Math.max($,0));return ee+et}function u0(){let{budgetType:$}=uN()||{};return $==="report"?"reflect_budgets":"zero_budgets"}function u1(){let{budgetType:$}=uN();return $==="report"}function u2($){return parseInt($.replace("-",""))}function u6($,ee){return f4(`
|
|
121
121
|
SELECT b.*, c.is_income FROM v_categories c
|
|
122
122
|
LEFT JOIN ${$} b ON b.category = c.id
|
|
123
123
|
WHERE c.tombstone = 0 AND b.month = ?
|
|
124
|
-
`,[ee])}function
|
|
124
|
+
`,[ee])}function u4($){let{createdMonths:ee}=uU().meta();let et=null;for(let $ of ee){if(et==null||$>et){et=$}}return nV($,et)}function u3({category:$,month:ee}){let et=u0();let en=f8(`SELECT * FROM ${et} WHERE month = ? AND category = ?`,[u2(ee),$]);return en?en.amount||0:0}function u8({category:$,month:ee,amount:et}){et=iR(typeof et==="number"?et:0);const en=u0();let ei=f8(`SELECT id FROM ${en} WHERE month = ? AND category = ?`,[u2(ee),$]);if(ei){return f7(en,{id:ei.id,amount:et})}return dr(en,{id:`${u2(ee)}-${$}`,month:u2(ee),category:$,amount:et})}function u5($,ee){let et=f8(`SELECT id FROM zero_budget_months WHERE id = ?`,[$]);if(et){return f7("zero_budget_months",{id:et.id,buffered:ee})}return dr("zero_budget_months",{id:$,buffered:ee})}function u9($,ee,et,en){let ei=f8(`SELECT id FROM ${$} WHERE month = ? AND category = ?`,[et,ee]);if(ei){return f7($,{id:ei.id,carryover:en?1:0})}return dr($,{id:`${et}-${ee}`,month:et,category:ee,carryover:en?1:0})}async function u7({month:$}){let ee=u2(nk($));let et=u0();let en=await u6(et,ee.toString());await fD(async()=>{en.forEach(ee=>{if(ee.is_income===1&&!u1()){return}u8({category:ee.category,month:$,amount:ee.amount})})})}async function le({month:$,category:ee}){let et=nk($);let en=await uX(n0(et),"budget-"+ee);await fD(async()=>{u8({category:ee,month:$,amount:en})})}async function lt({month:$}){let ee=await f4("SELECT * FROM v_categories WHERE tombstone = 0");await fD(async()=>{ee.forEach(ee=>{if(ee.is_income===1&&!u1()){return}u8({category:ee.id,month:$,amount:0})})})}async function lr({month:$}){let ee=await f4("SELECT * FROM v_categories WHERE tombstone = 0");let et=nk($);let en=nk(et);let ei=nk(en);await fD(async()=>{for(let eo of ee){if(eo.is_income===1&&!u1()){continue}let ee=await uX(n0(et),"sum-amount-"+eo.id);let es=await uX(n0(en),"sum-amount-"+eo.id);let eu=await uX(n0(ei),"sum-amount-"+eo.id);const el=Math.round((ee+es+eu)/3);u8({category:eo.id,month:$,amount:-el})}})}async function ln({month:$,N:ee,category:et}){let en=nk($);let ei=0;for(let $=0;$<ee;$++){ei+=await uX(n0(en),"sum-amount-"+et);en=nk(en)}await fD(async()=>{const en=Math.round(ei/ee);u8({category:et,month:$,amount:-en})})}async function li({month:$,amount:ee}){let et=await f3("SELECT buffered FROM zero_budget_months WHERE id = ?",[$]);let en=n0($);let ei=await uX(en,"to-budget");if(ei>0){let en=uQ(ei,et&&et.buffered||0,ee);await u5($,en);return true}return false}async function ls({month:$}){await u5($,0)}async function lu({month:$,to:ee,from:et}){let en=n0($);let ei=await uX(en,"budget-"+ee);let eo=await uX(en,"leftover-"+ee);let es=await uX(en,et==="to-be-budgeted"?"to-budget":"leftover-"+et);if(eo>=0||es<=0){return}let eu=Math.min(-eo,es);if(et!=="to-be-budgeted"){const ee=await uX(en,"budget-"+et);await u8({category:et,month:$,amount:ee-eu})}await u8({category:ee,month:$,amount:ei+eu})}async function lf({month:$,amount:ee,category:et}){let en=n0($);let ei=await uX(en,"to-budget");ee=Math.max(Math.min(ee,ei),0);let eo=await uX(en,"budget-"+et);await u8({category:et,month:$,amount:eo+ee})}async function ld({month:$,amount:ee,from:et,to:en}){const ei=n0($);const eo=await uX(ei,"budget-"+et);await u8({category:et,month:$,amount:eo-ee});if(en!=="to-be-budgeted"){const et=await uX(ei,"budget-"+en);await u8({category:en,month:$,amount:et+ee})}}async function lp({startMonth:$,category:ee,flag:et}){let en=u0();let ei=u4($);await fD(async()=>{for(let $ of ei){u9(en,ee,u2($).toString(),et)}})};function lh($){if(typeof $==="number"){return $}else if(typeof $==="string"){const ee=parseFloat($);if(isNaN(ee)){return 0}return ee}return 0};function ly(...$){return iR($.reduce(($,ee)=>{return $+lh(ee)},0))}function lg($){return Array.prototype.concat.apply([],$)}function lm($){let ee=[];for(let et=0;et<$.length;et+=2){ee.push([$[et],$[et+1]])}return ee};async function l_($,ee,et){uU().createStatic(ee,`budget-${$.id}`,0);if(uU().getCellValue(ee,`budget-${$.id}`)==null){uU().set(uL(ee,`budget-${$.id}`),0)}uU().createDynamic(ee,`leftover-${$.id}`,{initialValue:0,dependencies:[`budget-${$.id}`,`sum-amount-${$.id}`,`${et}!carryover-${$.id}`,`${et}!leftover-${$.id}`],run:(ee,et,en,ei)=>{if($.is_income){return iR(lh(ee)-lh(et)+(en?lh(ei):0))}return iR(lh(ee)+lh(et)+(en?lh(ei):0))}});uU().createDynamic(ee,`spent-with-carryover-${$.id}`,{initialValue:0,dependencies:[`budget-${$.id}`,`sum-amount-${$.id}`,`carryover-${$.id}`],refresh:true,run:($,ee,et)=>{return et?Math.max(0,iR(lh($)+lh(ee))):ee}});uU().createStatic(ee,`carryover-${$.id}`,false)}function lv($,ee,et){let en=$.filter($=>$.is_income)[0];let ei=ee.filter($=>!$.is_income);uU().createDynamic(et,"total-budgeted",{initialValue:0,dependencies:$.filter($=>!$.is_income).map($=>`group-budget-${$.id}`),run:ly});uU().createDynamic(et,"total-spent",{initialValue:0,refresh:true,dependencies:ei.map($=>`${et}!spent-with-carryover-${$.id}`),run:ly});uU().createDynamic(et,"total-income",{initialValue:0,dependencies:[`group-sum-amount-${en.id}`],run:$=>$});uU().createDynamic(et,"total-leftover",{initialValue:0,dependencies:["total-budgeted","total-spent"],run:ly});uU().createDynamic(et,"total-budget-income",{initialValue:0,dependencies:[`group-budget-${en.id}`],run:$=>$});uU().createDynamic(et,"total-saved",{initialValue:0,dependencies:["total-budget-income","total-budgeted"],run:($,ee)=>{return $-ee}});uU().createDynamic(et,"real-saved",{initialValue:0,dependencies:["total-income","total-spent"],run:($,ee)=>{return iR($- -ee)}})};function lw($){let ee=nk($[0]);return n0(ee)}function lE($,ee){if(ee.length>0){let et=lw(ee);uU().createStatic(et,`carryover-${$.id}`,false);uU().createStatic(et,`leftover-${$.id}`,0);uU().createStatic(et,`leftover-pos-${$.id}`,0)}}function lS($,ee,et){uU().createStatic(ee,"is-blank",true);uU().createStatic(ee,"to-budget",0);uU().createStatic(ee,"buffered",0);$.forEach($=>lE($,et))}function lT($,ee,et){if(!$.is_income){uU().createStatic(ee,`budget-${$.id}`,0);if(uU().getCellValue(ee,`budget-${$.id}`)==null){uU().set(uL(ee,`budget-${$.id}`),0)}uU().createStatic(ee,`carryover-${$.id}`,false);uU().createDynamic(ee,`leftover-${$.id}`,{initialValue:0,dependencies:[`budget-${$.id}`,`sum-amount-${$.id}`,`${et}!carryover-${$.id}`,`${et}!leftover-${$.id}`,`${et}!leftover-pos-${$.id}`],run:($,ee,et,en,ei)=>{return iR(lh($)+lh(ee)+(et?lh(en):lh(ei)))}});uU().createDynamic(ee,"leftover-pos-"+$.id,{initialValue:0,dependencies:[`leftover-${$.id}`],run:$=>{return $<0?0:$}})}}function lO($,ee,et,en){let ei=$.filter($=>$.is_income)[0];let eo=ee.filter($=>!$.is_income);uU().createStatic(en,"buffered",0);uU().createDynamic(en,"from-last-month",{initialValue:0,dependencies:[`${et}!to-budget`,`${et}!buffered`],run:($,ee)=>iR(lh($)+lh(ee))});uU().createDynamic(en,"total-income",{initialValue:0,dependencies:[`group-sum-amount-${ei.id}`],run:$=>$});uU().createDynamic(en,"available-funds",{initialValue:0,dependencies:["total-income","from-last-month"],run:($,ee)=>iR(lh($)+lh(ee))});uU().createDynamic(en,"last-month-overspent",{initialValue:0,dependencies:lg(eo.map($=>[`${et}!leftover-${$.id}`,`${et}!carryover-${$.id}`])),run:(...$)=>{$=lm($);return iR($.reduce(($,[ee,et])=>{if(et){return $}return $+Math.min(0,lh(ee))},0))}});uU().createDynamic(en,"total-budgeted",{initialValue:0,dependencies:$.filter($=>!$.is_income).map($=>`group-budget-${$.id}`),run:(...$)=>{return-ly(...$)}});uU().createDynamic(en,"buffered",{initialValue:0});uU().createDynamic(en,"to-budget",{initialValue:0,dependencies:["available-funds","last-month-overspent","total-budgeted","buffered"],run:($,ee,et,en)=>{return iR(lh($)+lh(ee)+lh(et)-lh(en))}});uU().createDynamic(en,"total-spent",{initialValue:0,dependencies:$.filter($=>!$.is_income).map($=>`group-sum-amount-${$.id}`),run:ly});uU().createDynamic(en,"total-leftover",{initialValue:0,dependencies:$.filter($=>!$.is_income).map($=>`group-leftover-${$.id}`),run:ly})}function lA($,ee,et){let en=lw(et);if($.blankSheet!==en){uU().clearSheet($.blankSheet);lS(ee,en,et);$.blankSheet=en}};function lI(){let $=uU().meta();return $.budgetType||"rollover"}function lN($,ee){$=nJ($);ee=nJ(ee);if($>ee){$=ee}$=nP($,3);ee=nM(ee,12);return{start:$,end:ee,range:nV($,ee)}}function lD($,ee,et,en,ei){uU().createDynamic(ee,"sum-amount-"+$.id,{initialValue:0,run:()=>{let ee=fJ(`SELECT SUM(amount) as amount FROM v_transactions_internal_alive t
|
|
125
125
|
LEFT JOIN accounts a ON a.id = t.account
|
|
126
126
|
WHERE t.date >= ${en} AND t.date <= ${ei}
|
|
127
|
-
AND category = '${$.id}' AND a.offbudget = 0`,[],true);let et=ee[0];let eo=et?et.amount:0;return eo||0}});if(
|
|
127
|
+
AND category = '${$.id}' AND a.offbudget = 0`,[],true);let et=ee[0];let eo=et?et.amount:0;return eo||0}});if(lI()==="rollover"){lT($,ee,et)}else{l_($,ee,et)}}function lR($,ee){uU().createDynamic(ee,"group-sum-amount-"+$.id,{initialValue:0,dependencies:$.categories.map($=>`sum-amount-${$.id}`),run:ly});if(!$.is_income||lI()!=="rollover"){uU().createDynamic(ee,"group-budget-"+$.id,{initialValue:0,dependencies:$.categories.map($=>`budget-${$.id}`),run:ly});uU().createDynamic(ee,"group-leftover-"+$.id,{initialValue:0,dependencies:$.categories.map($=>`leftover-${$.id}`),run:ly})}}function lk($,ee,et){if(!ee||ee.offbudget!==et.offbudget){let ee=fJ(`
|
|
128
128
|
SELECT DISTINCT(category) as category FROM transactions
|
|
129
129
|
WHERE acct = ?
|
|
130
|
-
`,[et.id],true);$.forEach($=>{let et=nQ($);ee.forEach($=>{uF().recompute(uk(et,"sum-amount-"+$.category))})})}}function lR($,ee){if((ee.has("date")||ee.has("acct")||ee.has("amount")||ee.has("category")||ee.has("tombstone")||ee.has("isParent"))&&$.date&&$.category){let ee=nA(oY($.date));let et=nQ(ee);uF().recompute(uk(et,"sum-amount-"+$.category))}}function lk($,ee,et){$.forEach($=>{let en=nQ($);if(ee){uF().recompute(uk(en,"sum-amount-"+ee.transferId))}uF().recompute(uk(en,"sum-amount-"+et.transferId))})}function lM($,ee,et){function en($,ee,et){uF().addDependencies($,`group-sum-amount-${ee}`,[`sum-amount-${et}`]);uF().addDependencies($,`group-budget-${ee}`,[`budget-${et}`]);uF().addDependencies($,`group-leftover-${ee}`,[`leftover-${et}`])}function ei($,ee,et){uF().removeDependencies($,`group-sum-amount-${ee}`,[`sum-amount-${et}`]);uF().removeDependencies($,`group-budget-${ee}`,[`budget-${et}`]);uF().removeDependencies($,`group-leftover-${ee}`,[`leftover-${et}`])}let eo=lO();if(ee&&ee.tombstone===0&&et.tombstone===1){let ee=et.id;let en=et.cat_group;$.forEach($=>{let et=nQ($);ei(et,en,ee)})}else if(et.tombstone===0&&(!ee||ee.tombstone===1)){if(eo==="rollover"){lv(et,$)}$.forEach($=>{let ee=nk($);let ei=nQ(ee);let eo=nQ($);let{start:es,end:eu}=nW($);lI(et,eo,ei,es,eu);let el=et.id;let ef=et.cat_group;if(lO()==="rollover"){uF().addDependencies(eo,"last-month-overspent",[`${ei}!leftover-${el}`,`${ei}!carryover-${el}`])}en(eo,ef,el)})}else if(ee&&ee.cat_group!==et.cat_group){let eo=et.id;$.forEach($=>{let es=nQ($);ei(es,ee.cat_group,eo);en(es,et.cat_group,eo)})}}function lL($,ee,et){let en=lO();function ei($,ee){uF().addDependencies($,"total-budgeted",[`group-budget-${ee}`]);uF().addDependencies($,"total-spent",[`group-sum-amount-${ee}`]);uF().addDependencies($,"total-leftover",[`group-leftover-${ee}`])}function eo($,ee){uF().removeDependencies($,"total-budgeted",[`group-budget-${ee}`]);uF().removeDependencies($,"total-spent",[`group-sum-amount-${ee}`]);uF().removeDependencies($,"total-leftover",[`group-leftover-${ee}`])}if(et.tombstone===1&&ee&&ee.tombstone===0){let ee=et.id;$.forEach($=>{let et=nQ($);eo(et,ee)})}else if(et.tombstone===0&&(!ee||ee.tombstone===1)){let ee=et;if(!ee.is_income||en!=="rollover"){$.forEach($=>{let et=nQ($);let en=fK("SELECT * FROM categories WHERE tombstone = 0 AND cat_group = ?",[ee.id],true);lN({...ee,categories:en},et);ei(et,ee.id)})}}}function lP($){let ee=nQ($.id);uF().set(`${ee}!buffered`,$.buffered)}function lF($){if($.category){let ee=nQ($.month.toString());uF().set(`${ee}!budget-${$.category}`,$.amount||0);uF().set(`${ee}!carryover-${$.category}`,$.carryover===1?true:false)}}function lB($,ee){let{createdMonths:et=new Set}=uF().meta();uG();try{ee.forEach((ee,en)=>{let ei=$.get(en);ee.forEach($=>{let ee=ei&&ei.get($.id);if(en==="zero_budget_months"){lP($)}else if(en==="zero_budgets"||en==="reflect_budgets"){lF($)}else if(en==="transactions"){let et=new Set(Object.keys(ie(ee||{},$)||{}));if(ee){lR(ee,et)}lR($,et)}else if(en==="category_mapping"){lk(et,ee,$)}else if(en==="categories"){lM(et,ee,$)}else if(en==="category_groups"){lL(et,ee,$)}else if(en==="accounts"){lD(et,ee,$)}})})}finally{uY()}}async function lU($,ee){let{createdMonths:et}=uF().meta();[...et].forEach(et=>{let en=$.map($=>{return u6({month:et,category:$})}).reduce(($,ee)=>$+ee,0);let ei=u6({month:et,category:ee});u4({month:et,category:ee,amount:en+ei})})}async function lj($){const ee=await du();const et=await dl();uG();let en=uF().meta();en.createdMonths=en.createdMonths||new Set;let ei=lO();if(ei==="rollover"){lT(en,ee,$)}$.forEach($=>{if(!en.createdMonths.has($)){let eo=nk($);let{start:es,end:eu}=nW($);let el=nQ($);let ef=nQ(eo);ee.forEach($=>{lI($,el,ef,es,eu)});et.forEach($=>{lN($,el)});if(ei==="rollover"){lS(et,ee,ef,el)}else{lm(et,ee,el)}en.createdMonths.add($)}});uF().setMeta(en);uY();await uK()}async function lW(){let $=await f6("SELECT * FROM transactions WHERE isChild=0 AND date IS NOT NULL ORDER BY date ASC LIMIT 1");let ee=$&&oY($.date);let et=nN();let{start:en,end:ei,range:eo}=lA(ee||et,et);let es=uF().meta();let eu=es.createdMonths||new Set;let el=eo.filter($=>!eu.has($));if(el.length>0){await lj(eo)}return{start:en,end:ei}}async function lH(ee){let et=uF().meta();if(ee===et.budgetType){return}et.budgetType=ee;et.createdMonths=new Set;let en=uF().getNodes();f0(()=>{for(let $ of en.keys()){let[ee,et]=$.split("!");if(ee.match(/^budget\d+/)){uF().deleteCell(ee,et)}}});uF().startCacheBarrier();uV($);let ei=await lW();uF().endCacheBarrier();return ei};class lz extends Error{meta;reason;type;constructor($,ee){super("PostError: "+$);this.type="PostError";this.reason=$;this.meta=ee}}class lV extends Error{statusCode;responseBody;constructor($,ee){super(`HTTPError: unsuccessful status code (${$}): ${ee}`);this.statusCode=$;this.responseBody=ee}}class l$ extends Error{meta;reason;constructor($,ee){super("SyncError: "+$);this.reason=$;this.meta=ee}}class lq extends Error{}class lG extends Error{type;constructor($,ee){super("RuleError: "+ee);this.type=$}}function lY($,ee){return{type:"APIError",message:$,meta:ee}}function lK($,ee){return{type:"FileDownloadError",reason:$,meta:ee}}function lZ($,ee){return{type:"FileUploadError",reason:$,meta:ee}};class lJ{events;handlers;services;unlistenServices;constructor(){this.handlers={};this.services=[];this.events=uN();this.unlistenServices=[]}method($,ee){if(this.handlers[$]!=null){throw new Error("Conflicting method name, names must be globally unique: "+$)}this.handlers[$]=ee}service($){this.services.push($)}combine(...$){for(let ee of $){Object.keys(ee.handlers).forEach($=>{this.method($,ee.handlers[$])});ee.services.forEach($=>{this.service($)});for(let[$,et]of ee.events.all.entries()){for(let ee of et){this.events.on($,ee)}}}}startServices(){if(this.unlistenServices.length>0){aI(new Error("App: startServices called while services are already running"))}this.unlistenServices=this.services.map($=>$())}stopServices(){this.unlistenServices.forEach($=>{if($){$()}});this.unlistenServices=[]}}function lX(){return new lJ};const lQ=lX();lQ.events.on("sync",$=>{aZ("sync-event",$)});const l0=lQ;const l1=globalThis.fetch;var l2=__webpack_require__(8764)["Buffer"];function l6($,ee){if($.status!==200){if($.status===500){throw new lz($.status===500?"internal":ee)}let et=$.headers.get("Content-Type");if(et.toLowerCase().indexOf("application/json")!==-1){let $=JSON.parse(ee);throw new lz($.reason)}throw new lz(ee)}}async function l4($,ee,et={}){let en;let ei;try{ei=await l1($,{method:"POST",body:JSON.stringify(ee),headers:{...et,"Content-Type":"application/json"}});en=await ei.text()}catch($){throw new lz("network-failure")}l6(ei,en);try{ei=JSON.parse(en)}catch($){throw new lz("parse-json",{meta:en})}if(ei.status!=="ok"){console.log("API call failed: "+$+"\nData: "+JSON.stringify(ee,null,2)+"\nResponse: "+JSON.stringify(ei,null,2));throw new lz(ei.description||ei.reason||"unknown")}return ei.data}async function l3($,ee,et){let en;try{en=await l1($,{method:"POST",body:u_?ee:l2.from(ee),headers:{"Content-Length":ee.length,"Content-Type":"application/actual-sync",...et}})}catch($){throw new lz("network-failure")}let ei;if(en.arrayBuffer){ei=l2.from(await en.arrayBuffer())}else{ei=await en.buffer()}l6(en,ei.toString());return ei}function l8($,ee){return l1($,ee).then($=>$.text())};let l5=null;function l9($,...ee){let et=new URL($);et.pathname=ou(...ee);return et.toString()}function l7($){if($==null){l5=null}else{l5=ce($)}}function ce($){if($){return{BASE_SERVER:$,SYNC_SERVER:l9($,"/sync"),SIGNUP_SERVER:l9($,"/account"),PLAID_SERVER:l9($,"/plaid"),GOCARDLESS_SERVER:l9($,"/gocardless")}}return l5};let ct=[{type:"marker"}];let cn=0;let co=20;function cs(){ct=ct.slice(0,cn+1);let $=ct.filter($=>$.type==="marker");if($.length>co){let ee=$.slice(-co);let et=ct.indexOf(ee[0]);ct=ct.slice(et);cn=ct.length-1}}function cu($,ee){let et=aq();if(et.undoListening&&$.length>0){cs();let{undoTag:en}=et;ct.push({type:"messages",messages:$,oldData:ee,undoTag:en});cn++}}function cl(){ct=[{type:"marker"}];cn=0}function cf($,ee){let et=aq();if(et.undoDisabled||et.undoListening){return $()}ct=ct.slice(0,cn+1);let en={type:"marker",meta:ee};if(ct[ct.length-1].type==="marker"){ct[ct.length-1]=en}else{ct.push(en);cn++}return a$({undoListening:true,undoTag:et.undoTag},$)}function cd($){return(...ee)=>{return cf(()=>{return $(...ee)})}}async function cp($,ee,et){await a$({undoListening:false},()=>{return fN($.map($=>({...$,timestamp:eo.Timestamp.send()})))});const en=$.reduce(($,ee)=>{if(!$.includes(ee.dataset)){$.push(ee.dataset)}return $},[]);aZ("undo-event",{messages:$,tables:en,meta:ee,undoTag:et})}async function cy(){let $=cn;cn=Math.max(cn-1,0);while(cn>0&&ct[cn].type!=="marker"){cn--}let ee=ct[cn].meta;let et=Math.max(cn,0);let en=ct.slice(et,$+1).filter($=>$.type==="messages");if(en.length>0){let $=en.reduce(($,ee)=>{return $.concat(ee.messages.map($=>cg($,ee.oldData)).filter($=>$))},[]).reverse();await cp($,ee,en[0].undoTag)}}function cg($,ee){let et=ig(ee,[$.dataset,$.row]);if(et){let ee=$.column;if($.dataset==="spreadsheet_cells"){ee="cachedValue"}return{...$,value:et[ee]}}else{if($.dataset==="spreadsheet_cells"){if($.column==="expr"){return{...$,value:null}}return $}else if($.dataset!=="category_mapping"&&$.dataset!=="payee_mapping"){if($.dataset==="zero_budget_months"||$.dataset==="zero_budgets"||$.dataset==="reflect_budgets"){if(["buffered","amount","carryover"].includes($.column)){return{...$,value:0}}return null}else if($.dataset==="notes"){return{...$,value:null}}return{...$,column:"tombstone",value:1}}}return null}async function cm(){let $=ct[cn].type==="marker"?ct[cn].meta:null;let ee=cn;cn=Math.min(cn+1,ct.length-1);while(cn<ct.length-1&&ct[cn].type!=="marker"){cn++}let et=cn;let en=ct.slice(ee+1,et+1).filter($=>$.type==="messages");if(en.length>0){let ee=en.reduce(($,ee)=>{return $.concat(ee.messages).concat(c_(ee.messages,ee.oldData))},[]);await cp(ee,$,en[en.length-1].undoTag)}}function c_($,ee){let et=new Set;$.forEach($=>{let en=ig(ee,[$.dataset,$.row]);if(!en&&!["zero_budget_months","zero_budgets","reflect_budgets","notes","category_mapping","payee_mapping"].includes($.dataset)){et.add($.dataset+"."+$.row)}});return[...et].map($=>{let[ee,et]=$.split(".");return{dataset:ee,row:et,column:"tombstone",value:0,timestamp:eo.Timestamp.send()}})};var cv=__webpack_require__(8764)["Buffer"];let cw="aes-256-gcm";function cE($){switch($){case"aes-256-gcm":return"AES-GCM";default:throw new Error("unsupported crypto algorithm: "+$)}}async function cS($){let ee=new TextEncoder("utf-8").encode($).buffer;let et=await crypto.subtle.digest("sha-256",ee);let en=Array.from(new Uint8Array(et)).map($=>String.fromCharCode($)).join("");return btoa(en)}function cT($){return cv.from(crypto.getRandomValues(new Uint8Array($)))}async function cO($,ee){let et=crypto.getRandomValues(new Uint8Array(12));let en=await crypto.subtle.encrypt({name:cE(cw),iv:et,tagLength:128},$.getValue().raw,ee);en=cv.from(en);let ei=en.slice(-16);en=en.slice(0,-16);return{value:en,meta:{keyId:$.getId(),algorithm:cw,iv:cv.from(et).toString("base64"),authTag:ei.toString("base64")}}}async function cA($,ee,et){let{algorithm:en,iv:ei,authTag:eo}=et;let es=await crypto.subtle.decrypt({name:cE(en),iv:cv.from(ei,"base64"),tagLength:128},$.getValue().raw,cv.concat([ee,cv.from(eo,"base64")]));return cv.from(es)}async function cI({secret:$,salt:ee}){let et=cv.from($);let en=cv.from(ee);let ei=await crypto.subtle.importKey("raw",et,{name:"PBKDF2"},false,["deriveBits","deriveKey"]);let eo=await crypto.subtle.deriveKey({name:"PBKDF2",hash:"SHA-512",salt:en,iterations:1e4},ei,{name:"AES-GCM",length:256},true,["encrypt","decrypt"]);let es=await crypto.subtle.exportKey("raw",eo);return{raw:eo,base64:cv.from(es).toString("base64")}}async function cN($){let ee=await crypto.subtle.importKey("raw",cv.from($,"base64"),{name:"AES-GCM"},false,["encrypt","decrypt"]);return{raw:ee,base64:$}};let cD={};class cR{id;value;constructor({id:$}){this.id=$||e_()}async createFromPassword({password:$,salt:ee}){this.value=await cI({secret:$,salt:ee})}async createFromBase64($){this.value=await cN($)}getId(){return this.id}getValue(){return this.value}serialize(){return{id:this.id,base64:this.value.base64}}}function cC($){if($==null||cD[$]==null){throw new Error("missing-key")}return cD[$]}function cM($){return $ in cD}function cL($,ee){return cO(cC(ee),$)}function cx($,ee){return cA(cC(ee.keyId),$,ee)}function cP($){return cT($)}async function cF($){let ee;if(!($ instanceof cR)){ee=new cR({id:$.id});await ee.createFromBase64($.base64)}else{ee=$}cD[ee.getId()]=ee}function cB($){delete cD[$.getId()]}function cU(){cD={}}async function cj({id:$,password:ee,salt:et}){let en=new cR({id:$});await en.createFromPassword({password:ee,salt:et});return en};var cW=__webpack_require__(8764)["Buffer"];function cH($){if(!cW.isBuffer($)){return cW.from($)}return $}async function cz($,ee,et,en){let{encryptKeyId:ei}=uA();let es=new eo.SyncProtoBuf.SyncRequest;for(let $=0;$<en.length;$++){let ee=en[$];let et=new eo.SyncProtoBuf.MessageEnvelope;et.setTimestamp(ee.timestamp.toString());let eu=new eo.SyncProtoBuf.Message;eu.setDataset(ee.dataset);eu.setRow(ee.row);eu.setColumn(ee.column);eu.setValue(ee.value);let el=eu.serializeBinary();if(ei){let $=new eo.SyncProtoBuf.EncryptedData;let ee;try{ee=await cL(el,ei)}catch($){throw new l$("encrypt-failure",{isMissingKey:$.message==="missing-key"})}$.setData(ee.value);$.setIv(cW.from(ee.meta.iv,"base64"));$.setAuthtag(cW.from(ee.meta.authTag,"base64"));et.setContent($.serializeBinary());et.setIsencrypted(true)}else{et.setContent(el)}es.addMessages(et)}es.setGroupid($);es.setFileid(ee);es.setKeyid(ei);es.setSince(et.toString());return es.serializeBinary()}async function cV($){let{encryptKeyId:ee}=uA();let et=eo.SyncProtoBuf.SyncResponse.deserializeBinary($);let en=JSON.parse(et.getMerkle());let ei=et.getMessagesList();let es=[];for(let $=0;$<ei.length;$++){let et=ei[$];let en=eo.Timestamp.parse(et.getTimestamp());let eu=et.getIsencrypted();let el;if(eu){let $=eo.SyncProtoBuf.EncryptedData.deserializeBinary(et.getContent());let en;try{en=await cx(cH($.getData()),{keyId:ee,algorithm:"aes-256-gcm",iv:cH($.getIv()),authTag:cH($.getAuthtag())})}catch($){console.log($);throw new l$("decrypt-failure",{isMissingKey:$.message==="missing-key"})}el=eo.SyncProtoBuf.Message.deserializeBinary(en)}else{el=eo.SyncProtoBuf.Message.deserializeBinary(et.getContent())}es.push({timestamp:en,dataset:el.getDataset(),row:el.getRow(),column:el.getColumn(),value:el.getValue()})}return{messages:es,merkle:en}};function c$(){let $=fK("SELECT timestamp FROM messages_crdt",[],true);let ee=eo.merkle.emptyTrie();for(let et=0;et<$.length;et++){ee=eo.merkle.insert(ee,eo.Timestamp.parse($[et].timestamp))}return{numMessages:$.length,trie:ee}}async function cq(){let $=c$();let ee=(0,eo.getClock)();ee.merkle=$.trie;fK(fX("INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)"),[(0,eo.serializeClock)(ee)])};function cG($){return $.error!==undefined};async function cY(){return(await cP(12)).toString()}async function cK($){let ee=new eo.SyncProtoBuf.Message;ee.setDataset(await cY());ee.setRow(await cY());ee.setColumn(await cY());ee.setValue(await cY());let et=ee.serializeBinary();return await cL(et,$)}var cZ=__webpack_require__(5285);var cJ=__webpack_require__.n(cZ);var cX=__webpack_require__(8764)["Buffer"];let cQ=7;async function c0($){if($.status!==200){return $.text().then(ee=>{throw new lV($.status,ee)})}else{return $}}async function c6(...$){let ee=await l1(...$);ee=await c0(ee);return ee.json()}async function c4(){let $=await rX("user-token");let{cloudFileId:ee,encryptKeyId:et}=uA();let en;try{en=await l4(ce().SYNC_SERVER+"/user-get-key",{token:$,fileId:ee})}catch($){console.log($);return{valid:false,error:{reason:"network"}}}return{valid:en.id==et&&(et==null||cM(et))}}async function c3($){let ee=await rX("user-token");let{cloudFileId:et}=uA();try{await l4(ce().SYNC_SERVER+"/reset-user-file",{token:ee,fileId:et})}catch($){if($ instanceof lz){return{error:{reason:$.reason==="unauthorized"?"unauthorized":"network"}}}return{error:{reason:"internal"}}}if($){try{await l4(ce().SYNC_SERVER+"/user-create-key",{token:ee,fileId:et,keyId:$.key.getId(),keySalt:$.salt,testContent:$.testContent})}catch($){if($ instanceof lz){return{error:{reason:"network"}}}return{error:{reason:"internal"}}}}return{}}async function c8(){let{id:$,budgetName:ee}=uA();if(!ee){return null}let et=od($);let en=new(cJ());await aV(async()=>{let $=await oj(ou(et,"db.sqlite"),"binary");let ee=await oe($);a8(ee,`
|
|
130
|
+
`,[et.id],true);$.forEach($=>{let et=n0($);ee.forEach($=>{uU().recompute(uL(et,"sum-amount-"+$.category))})})}}function lM($,ee){if((ee.has("date")||ee.has("acct")||ee.has("amount")||ee.has("category")||ee.has("tombstone")||ee.has("isParent"))&&$.date&&$.category){let ee=nA(oZ($.date));let et=n0(ee);uU().recompute(uL(et,"sum-amount-"+$.category))}}function lL($,ee,et){$.forEach($=>{let en=n0($);if(ee){uU().recompute(uL(en,"sum-amount-"+ee.transferId))}uU().recompute(uL(en,"sum-amount-"+et.transferId))})}function lP($,ee,et){function en($,ee,et){uU().addDependencies($,`group-sum-amount-${ee}`,[`sum-amount-${et}`]);uU().addDependencies($,`group-budget-${ee}`,[`budget-${et}`]);uU().addDependencies($,`group-leftover-${ee}`,[`leftover-${et}`])}function ei($,ee,et){uU().removeDependencies($,`group-sum-amount-${ee}`,[`sum-amount-${et}`]);uU().removeDependencies($,`group-budget-${ee}`,[`budget-${et}`]);uU().removeDependencies($,`group-leftover-${ee}`,[`leftover-${et}`])}let eo=lI();if(ee&&ee.tombstone===0&&et.tombstone===1){let ee=et.id;let en=et.cat_group;$.forEach($=>{let et=n0($);ei(et,en,ee)})}else if(et.tombstone===0&&(!ee||ee.tombstone===1)){if(eo==="rollover"){lE(et,$)}$.forEach($=>{let ee=nk($);let ei=n0(ee);let eo=n0($);let{start:es,end:eu}=nW($);lD(et,eo,ei,es,eu);let el=et.id;let ef=et.cat_group;if(lI()==="rollover"){uU().addDependencies(eo,"last-month-overspent",[`${ei}!leftover-${el}`,`${ei}!carryover-${el}`])}en(eo,ef,el)})}else if(ee&&ee.cat_group!==et.cat_group){let eo=et.id;$.forEach($=>{let es=n0($);ei(es,ee.cat_group,eo);en(es,et.cat_group,eo)})}}function lF($,ee,et){let en=lI();function ei($,ee){uU().addDependencies($,"total-budgeted",[`group-budget-${ee}`]);uU().addDependencies($,"total-spent",[`group-sum-amount-${ee}`]);uU().addDependencies($,"total-leftover",[`group-leftover-${ee}`])}function eo($,ee){uU().removeDependencies($,"total-budgeted",[`group-budget-${ee}`]);uU().removeDependencies($,"total-spent",[`group-sum-amount-${ee}`]);uU().removeDependencies($,"total-leftover",[`group-leftover-${ee}`])}if(et.tombstone===1&&ee&&ee.tombstone===0){let ee=et.id;$.forEach($=>{let et=n0($);eo(et,ee)})}else if(et.tombstone===0&&(!ee||ee.tombstone===1)){let ee=et;if(!ee.is_income||en!=="rollover"){$.forEach($=>{let et=n0($);let en=fJ("SELECT * FROM categories WHERE tombstone = 0 AND cat_group = ?",[ee.id],true);lR({...ee,categories:en},et);ei(et,ee.id)})}}}function lB($){let ee=n0($.id);uU().set(`${ee}!buffered`,$.buffered)}function lU($){if($.category){let ee=n0($.month.toString());uU().set(`${ee}!budget-${$.category}`,$.amount||0);uU().set(`${ee}!carryover-${$.category}`,$.carryover===1?true:false)}}function lj($,ee){let{createdMonths:et=new Set}=uU().meta();uK();try{ee.forEach((ee,en)=>{let ei=$.get(en);ee.forEach($=>{let ee=ei&&ei.get($.id);if(en==="zero_budget_months"){lB($)}else if(en==="zero_budgets"||en==="reflect_budgets"){lU($)}else if(en==="transactions"){let et=new Set(Object.keys(it(ee||{},$)||{}));if(ee){lM(ee,et)}lM($,et)}else if(en==="category_mapping"){lL(et,ee,$)}else if(en==="categories"){lP(et,ee,$)}else if(en==="category_groups"){lF(et,ee,$)}else if(en==="accounts"){lk(et,ee,$)}})})}finally{uZ()}}async function lW($,ee){let{createdMonths:et}=uU().meta();[...et].forEach(et=>{let en=$.map($=>{return u3({month:et,category:$})}).reduce(($,ee)=>$+ee,0);let ei=u3({month:et,category:ee});u8({month:et,category:ee,amount:en+ei})})}async function lH($){const ee=await df();const et=await dp();uK();let en=uU().meta();en.createdMonths=en.createdMonths||new Set;let ei=lI();if(ei==="rollover"){lA(en,ee,$)}$.forEach($=>{if(!en.createdMonths.has($)){let eo=nk($);let{start:es,end:eu}=nW($);let el=n0($);let ef=n0(eo);ee.forEach($=>{lD($,el,ef,es,eu)});et.forEach($=>{lR($,el)});if(ei==="rollover"){lO(et,ee,ef,el)}else{lv(et,ee,el)}en.createdMonths.add($)}});uU().setMeta(en);uZ();await uJ()}async function lz(){let $=await f3("SELECT * FROM transactions WHERE isChild=0 AND date IS NOT NULL ORDER BY date ASC LIMIT 1");let ee=$&&oZ($.date);let et=nN();let{start:en,end:ei,range:eo}=lN(ee||et,et);let es=uU().meta();let eu=es.createdMonths||new Set;let el=eo.filter($=>!eu.has($));if(el.length>0){await lH(eo)}return{start:en,end:ei}}async function lV(ee){let et=uU().meta();if(ee===et.budgetType){return}et.budgetType=ee;et.createdMonths=new Set;let en=uU().getNodes();f2(()=>{for(let $ of en.keys()){let[ee,et]=$.split("!");if(ee.match(/^budget\d+/)){uU().deleteCell(ee,et)}}});uU().startCacheBarrier();uq($);let ei=await lz();uU().endCacheBarrier();return ei};class l$ extends Error{meta;reason;type;constructor($,ee){super("PostError: "+$);this.type="PostError";this.reason=$;this.meta=ee}}class lq extends Error{statusCode;responseBody;constructor($,ee){super(`HTTPError: unsuccessful status code (${$}): ${ee}`);this.statusCode=$;this.responseBody=ee}}class lG extends Error{meta;reason;constructor($,ee){super("SyncError: "+$);this.reason=$;this.meta=ee}}class lY extends Error{}class lK extends Error{type;constructor($,ee){super("RuleError: "+ee);this.type=$}}function lZ($,ee){return{type:"APIError",message:$,meta:ee}}function lJ($,ee){return{type:"FileDownloadError",reason:$,meta:ee}}function lX($,ee){return{type:"FileUploadError",reason:$,meta:ee}};class lQ{events;handlers;services;unlistenServices;constructor(){this.handlers={};this.services=[];this.events=uR();this.unlistenServices=[]}method($,ee){if(this.handlers[$]!=null){throw new Error("Conflicting method name, names must be globally unique: "+$)}this.handlers[$]=ee}service($){this.services.push($)}combine(...$){for(let ee of $){Object.keys(ee.handlers).forEach($=>{this.method($,ee.handlers[$])});ee.services.forEach($=>{this.service($)});for(let[$,et]of ee.events.all.entries()){for(let ee of et){this.events.on($,ee)}}}}startServices(){if(this.unlistenServices.length>0){aD(new Error("App: startServices called while services are already running"))}this.unlistenServices=this.services.map($=>$())}stopServices(){this.unlistenServices.forEach($=>{if($){$()}});this.unlistenServices=[]}}function l0(){return new lQ};const l1=l0();l1.events.on("sync",$=>{aX("sync-event",$)});const l2=l1;const l6=globalThis.fetch;var l4=__webpack_require__(8764)["Buffer"];function l3($,ee){if($.status!==200){if($.status===500){throw new l$($.status===500?"internal":ee)}let et=$.headers.get("Content-Type");if(et.toLowerCase().indexOf("application/json")!==-1){let $=JSON.parse(ee);throw new l$($.reason)}throw new l$(ee)}}async function l8($,ee,et={}){let en;let ei;try{ei=await l6($,{method:"POST",body:JSON.stringify(ee),headers:{...et,"Content-Type":"application/json"}});en=await ei.text()}catch($){throw new l$("network-failure")}l3(ei,en);try{ei=JSON.parse(en)}catch($){throw new l$("parse-json",{meta:en})}if(ei.status!=="ok"){console.log("API call failed: "+$+"\nData: "+JSON.stringify(ee,null,2)+"\nResponse: "+JSON.stringify(ei,null,2));throw new l$(ei.description||ei.reason||"unknown")}return ei.data}async function l5($,ee,et){let en;try{en=await l6($,{method:"POST",body:uw?ee:l4.from(ee),headers:{"Content-Length":ee.length,"Content-Type":"application/actual-sync",...et}})}catch($){throw new l$("network-failure")}let ei;if(en.arrayBuffer){ei=l4.from(await en.arrayBuffer())}else{ei=await en.buffer()}l3(en,ei.toString());return ei}function l9($,ee){return l6($,ee).then($=>$.text())};let l7=null;function ce($,...ee){let et=new URL($);et.pathname=oc(...ee);return et.toString()}function ct($){if($==null){l7=null}else{l7=cn($)}}function cn($){if($){return{BASE_SERVER:$,SYNC_SERVER:ce($,"/sync"),SIGNUP_SERVER:ce($,"/account"),PLAID_SERVER:ce($,"/plaid"),GOCARDLESS_SERVER:ce($,"/gocardless")}}return l7};let co=[{type:"marker"}];let cs=0;let cu=20;function cl(){co=co.slice(0,cs+1);let $=co.filter($=>$.type==="marker");if($.length>cu){let ee=$.slice(-cu);let et=co.indexOf(ee[0]);co=co.slice(et);cs=co.length-1}}function cf($,ee){let et=aY();if(et.undoListening&&$.length>0){cl();let{undoTag:en}=et;co.push({type:"messages",messages:$,oldData:ee,undoTag:en});cs++}}function cd(){co=[{type:"marker"}];cs=0}function cp($,ee){let et=aY();if(et.undoDisabled||et.undoListening){return $()}co=co.slice(0,cs+1);let en={type:"marker",meta:ee};if(co[co.length-1].type==="marker"){co[co.length-1]=en}else{co.push(en);cs++}return aG({undoListening:true,undoTag:et.undoTag},$)}function cy($){return(...ee)=>{return cp(()=>{return $(...ee)})}}async function cg($,ee,et){await aG({undoListening:false},()=>{return fR($.map($=>({...$,timestamp:eo.Timestamp.send()})))});const en=$.reduce(($,ee)=>{if(!$.includes(ee.dataset)){$.push(ee.dataset)}return $},[]);aX("undo-event",{messages:$,tables:en,meta:ee,undoTag:et})}async function cm(){let $=cs;cs=Math.max(cs-1,0);while(cs>0&&co[cs].type!=="marker"){cs--}let ee=co[cs].meta;let et=Math.max(cs,0);let en=co.slice(et,$+1).filter($=>$.type==="messages");if(en.length>0){let $=en.reduce(($,ee)=>{return $.concat(ee.messages.map($=>c_($,ee.oldData)).filter($=>$))},[]).reverse();await cg($,ee,en[0].undoTag)}}function c_($,ee){let et=i_(ee,[$.dataset,$.row]);if(et){let ee=$.column;if($.dataset==="spreadsheet_cells"){ee="cachedValue"}return{...$,value:et[ee]}}else{if($.dataset==="spreadsheet_cells"){if($.column==="expr"){return{...$,value:null}}return $}else if($.dataset!=="category_mapping"&&$.dataset!=="payee_mapping"){if($.dataset==="zero_budget_months"||$.dataset==="zero_budgets"||$.dataset==="reflect_budgets"){if(["buffered","amount","carryover"].includes($.column)){return{...$,value:0}}return null}else if($.dataset==="notes"){return{...$,value:null}}return{...$,column:"tombstone",value:1}}}return null}async function cv(){let $=co[cs].type==="marker"?co[cs].meta:null;let ee=cs;cs=Math.min(cs+1,co.length-1);while(cs<co.length-1&&co[cs].type!=="marker"){cs++}let et=cs;let en=co.slice(ee+1,et+1).filter($=>$.type==="messages");if(en.length>0){let ee=en.reduce(($,ee)=>{return $.concat(ee.messages).concat(cw(ee.messages,ee.oldData))},[]);await cg(ee,$,en[en.length-1].undoTag)}}function cw($,ee){let et=new Set;$.forEach($=>{let en=i_(ee,[$.dataset,$.row]);if(!en&&!["zero_budget_months","zero_budgets","reflect_budgets","notes","category_mapping","payee_mapping"].includes($.dataset)){et.add($.dataset+"."+$.row)}});return[...et].map($=>{let[ee,et]=$.split(".");return{dataset:ee,row:et,column:"tombstone",value:0,timestamp:eo.Timestamp.send()}})};var cE=__webpack_require__(8764)["Buffer"];let cS="aes-256-gcm";function cT($){switch($){case"aes-256-gcm":return"AES-GCM";default:throw new Error("unsupported crypto algorithm: "+$)}}async function cO($){let ee=new TextEncoder("utf-8").encode($).buffer;let et=await crypto.subtle.digest("sha-256",ee);let en=Array.from(new Uint8Array(et)).map($=>String.fromCharCode($)).join("");return btoa(en)}function cA($){return cE.from(crypto.getRandomValues(new Uint8Array($)))}async function cI($,ee){let et=crypto.getRandomValues(new Uint8Array(12));let en=await crypto.subtle.encrypt({name:cT(cS),iv:et,tagLength:128},$.getValue().raw,ee);en=cE.from(en);let ei=en.slice(-16);en=en.slice(0,-16);return{value:en,meta:{keyId:$.getId(),algorithm:cS,iv:cE.from(et).toString("base64"),authTag:ei.toString("base64")}}}async function cN($,ee,et){let{algorithm:en,iv:ei,authTag:eo}=et;let es=await crypto.subtle.decrypt({name:cT(en),iv:cE.from(ei,"base64"),tagLength:128},$.getValue().raw,cE.concat([ee,cE.from(eo,"base64")]));return cE.from(es)}async function cD({secret:$,salt:ee}){let et=cE.from($);let en=cE.from(ee);let ei=await crypto.subtle.importKey("raw",et,{name:"PBKDF2"},false,["deriveBits","deriveKey"]);let eo=await crypto.subtle.deriveKey({name:"PBKDF2",hash:"SHA-512",salt:en,iterations:1e4},ei,{name:"AES-GCM",length:256},true,["encrypt","decrypt"]);let es=await crypto.subtle.exportKey("raw",eo);return{raw:eo,base64:cE.from(es).toString("base64")}}async function cR($){let ee=await crypto.subtle.importKey("raw",cE.from($,"base64"),{name:"AES-GCM"},false,["encrypt","decrypt"]);return{raw:ee,base64:$}};let cC={};class cM{id;value;constructor({id:$}){this.id=$||e_()}async createFromPassword({password:$,salt:ee}){this.value=await cD({secret:$,salt:ee})}async createFromBase64($){this.value=await cR($)}getId(){return this.id}getValue(){return this.value}serialize(){return{id:this.id,base64:this.value.base64}}}function cL($){if($==null||cC[$]==null){throw new Error("missing-key")}return cC[$]}function cx($){return $ in cC}function cP($,ee){return cI(cL(ee),$)}function cF($,ee){return cN(cL(ee.keyId),$,ee)}function cB($){return cA($)}async function cU($){let ee;if(!($ instanceof cM)){ee=new cM({id:$.id});await ee.createFromBase64($.base64)}else{ee=$}cC[ee.getId()]=ee}function cj($){delete cC[$.getId()]}function cW(){cC={}}async function cH({id:$,password:ee,salt:et}){let en=new cM({id:$});await en.createFromPassword({password:ee,salt:et});return en};var cz=__webpack_require__(8764)["Buffer"];function cV($){if(!cz.isBuffer($)){return cz.from($)}return $}async function c$($,ee,et,en){let{encryptKeyId:ei}=uN();let es=new eo.SyncProtoBuf.SyncRequest;for(let $=0;$<en.length;$++){let ee=en[$];let et=new eo.SyncProtoBuf.MessageEnvelope;et.setTimestamp(ee.timestamp.toString());let eu=new eo.SyncProtoBuf.Message;eu.setDataset(ee.dataset);eu.setRow(ee.row);eu.setColumn(ee.column);eu.setValue(ee.value);let el=eu.serializeBinary();if(ei){let $=new eo.SyncProtoBuf.EncryptedData;let ee;try{ee=await cP(el,ei)}catch($){throw new lG("encrypt-failure",{isMissingKey:$.message==="missing-key"})}$.setData(ee.value);$.setIv(cz.from(ee.meta.iv,"base64"));$.setAuthtag(cz.from(ee.meta.authTag,"base64"));et.setContent($.serializeBinary());et.setIsencrypted(true)}else{et.setContent(el)}es.addMessages(et)}es.setGroupid($);es.setFileid(ee);es.setKeyid(ei);es.setSince(et.toString());return es.serializeBinary()}async function cq($){let{encryptKeyId:ee}=uN();let et=eo.SyncProtoBuf.SyncResponse.deserializeBinary($);let en=JSON.parse(et.getMerkle());let ei=et.getMessagesList();let es=[];for(let $=0;$<ei.length;$++){let et=ei[$];let en=eo.Timestamp.parse(et.getTimestamp());let eu=et.getIsencrypted();let el;if(eu){let $=eo.SyncProtoBuf.EncryptedData.deserializeBinary(et.getContent());let en;try{en=await cF(cV($.getData()),{keyId:ee,algorithm:"aes-256-gcm",iv:cV($.getIv()),authTag:cV($.getAuthtag())})}catch($){console.log($);throw new lG("decrypt-failure",{isMissingKey:$.message==="missing-key"})}el=eo.SyncProtoBuf.Message.deserializeBinary(en)}else{el=eo.SyncProtoBuf.Message.deserializeBinary(et.getContent())}es.push({timestamp:en,dataset:el.getDataset(),row:el.getRow(),column:el.getColumn(),value:el.getValue()})}return{messages:es,merkle:en}};function cG(){let $=fJ("SELECT timestamp FROM messages_crdt",[],true);let ee=eo.merkle.emptyTrie();for(let et=0;et<$.length;et++){ee=eo.merkle.insert(ee,eo.Timestamp.parse($[et].timestamp))}return{numMessages:$.length,trie:ee}}async function cY(){let $=cG();let ee=(0,eo.getClock)();ee.merkle=$.trie;fJ(f0("INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)"),[(0,eo.serializeClock)(ee)])};function cK($){return $.error!==undefined};async function cZ(){return(await cB(12)).toString()}async function cJ($){let ee=new eo.SyncProtoBuf.Message;ee.setDataset(await cZ());ee.setRow(await cZ());ee.setColumn(await cZ());ee.setValue(await cZ());let et=ee.serializeBinary();return await cP(et,$)}var cX=__webpack_require__(5285);var cQ=__webpack_require__.n(cX);var c0=__webpack_require__(8764)["Buffer"];let c6=7;async function c4($){if($.status!==200){return $.text().then(ee=>{throw new lq($.status,ee)})}else{return $}}async function c3(...$){let ee=await l6(...$);ee=await c4(ee);return ee.json()}async function c8(){let $=await rX("user-token");let{cloudFileId:ee,encryptKeyId:et}=uN();let en;try{en=await l8(cn().SYNC_SERVER+"/user-get-key",{token:$,fileId:ee})}catch($){console.log($);return{valid:false,error:{reason:"network"}}}return{valid:en.id==et&&(et==null||cx(et))}}async function c5($){let ee=await rX("user-token");let{cloudFileId:et}=uN();try{await l8(cn().SYNC_SERVER+"/reset-user-file",{token:ee,fileId:et})}catch($){if($ instanceof l$){return{error:{reason:$.reason==="unauthorized"?"unauthorized":"network"}}}return{error:{reason:"internal"}}}if($){try{await l8(cn().SYNC_SERVER+"/user-create-key",{token:ee,fileId:et,keyId:$.key.getId(),keySalt:$.salt,testContent:$.testContent})}catch($){if($ instanceof l$){return{error:{reason:"network"}}}return{error:{reason:"internal"}}}}return{}}async function c9(){let{id:$,budgetName:ee}=uN();if(!ee){return null}let et=oy($);let en=new(cQ());await aq(async()=>{let $=await oH(oc(et,"db.sqlite"),"binary");let ee=await or($);a9(ee,`
|
|
131
131
|
DELETE FROM kvcache;
|
|
132
132
|
DELETE FROM kvcache_key;
|
|
133
|
-
`);let ei=await
|
|
133
|
+
`);let ei=await oo(ee);oi(ee);let eo=JSON.parse(await oH(oc(et,"metadata.json")));eo.resetClock=true;let es=c0.from(JSON.stringify(eo),"utf8");en.addFile("db.sqlite",c0.from(ei));en.addFile("metadata.json",es)});return c0.from(en.toBuffer())}async function c7($,ee){let et,en;try{et=new(cQ())(ee);en=et.getEntries()}catch($){throw lJ("not-zip-file")}let ei=en.find($=>$.entryName.includes("db.sqlite"));let eo=en.find($=>$.entryName.includes("metadata.json"));if(!ei||!eo){throw lJ("invalid-zip-file")}let es=et.readFile(ei);let eu=et.readFile(eo);let el;try{el=JSON.parse(eu.toString("utf8"))}catch($){throw lJ("invalid-meta-file")}el={...el,cloudFileId:$.fileId,groupId:$.groupId,lastUploaded:nR(),encryptKeyId:$.encryptMeta?$.encryptMeta.keyId:null};let ef=oy(el.id);if(await oB(ef)){let $=oc(ef,"db.sqlite");let ee=oc(ef,"metadata.json");if(await oB($)){await oV($)}if(await oB(ee)){await oV(ee)}}else{await oU(ef)}await oz(oc(ef,"db.sqlite"),es);await oz(oc(ef,"metadata.json"),JSON.stringify(el));return{id:el.id}}async function fe(){let $=await rX("user-token");if(!$){throw lX("unauthorized")}let ee=await c9();if(ee==null){return}let{id:et,groupId:en,budgetName:ei,cloudFileId:eo,encryptKeyId:es}=uN();let eu=ee;let el=null;if(es){let $;try{$=await cP(ee,es)}catch($){throw lX("encrypt-failure",{isMissingKey:$.message==="missing-key"})}eu=$.value;el=$.meta}if(!eo){eo=e_()}let ef;try{ef=await c3(cn().SYNC_SERVER+"/upload-user-file",{method:"POST",headers:{"Content-Length":eu.length,"Content-Type":"application/encrypted-file","X-ACTUAL-TOKEN":$,"X-ACTUAL-FILE-ID":eo,"X-ACTUAL-NAME":encodeURIComponent(ei),"X-ACTUAL-FORMAT":2,...el?{"X-ACTUAL-ENCRYPT-META":JSON.stringify(el)}:null,...en?{"X-ACTUAL-GROUP-ID":en}:null},body:eu})}catch($){console.log("Upload failure",$);if($ instanceof l$){throw lX($.reason==="unauthorized"?"unauthorized":$.reason||"network")}throw lX("internal")}if(ef.status==="ok"){if(uN()&&uN().id===et){await uA({lastUploaded:nR(),cloudFileId:eo,groupId:ef.groupId})}}else{throw lX("internal")}}async function ft(){let{cloudFileId:$,groupId:ee,lastUploaded:et}=uN();let en=et&&nF(et,c6);let ei=nR();if(et&&ei<en){return}if(!$||!ee){return}fe().catch($=>{})}async function fr($){let ee=await rX("user-token");await l8(cn().SYNC_SERVER+"/delete-user-file",{token:ee,fileId:$})}async function fi(){let $=await rX("user-token");if(!$){return null}let ee;try{ee=await c3(cn().SYNC_SERVER+"/list-user-files",{headers:{"X-ACTUAL-TOKEN":$}})}catch($){console.log("Unexpected error fetching file list from server",$);return null}if(ee.status==="error"){console.log("Error fetching file list from server",ee);return null}return ee.data.map($=>({...$,hasKey:cx($.encryptKeyId)}))}async function fo($){let ee=await rX("user-token");let et;try{et=await l6(cn().SYNC_SERVER+"/download-user-file",{headers:{"X-ACTUAL-TOKEN":ee,"X-ACTUAL-FILE-ID":$}}).then(c4).then($=>{if($.arrayBuffer){return $.arrayBuffer().then($=>c0.from($))}return $.buffer()})}catch($){console.log("Download failure",$);throw lJ("download-failure")}let en;try{en=await c3(cn().SYNC_SERVER+"/get-user-file-info",{headers:{"X-ACTUAL-TOKEN":ee,"X-ACTUAL-FILE-ID":$}})}catch(ee){console.log("Error fetching file info",ee);throw lJ("internal",{fileId:$})}if(en.status!=="ok"){console.log("Could not download file from the server. Are you sure you have the right file ID?",en);throw lJ("internal",{fileId:$})}let ei=en.data;if(ei.encryptMeta){try{et=await cF(et,ei.encryptMeta)}catch($){throw lJ("decrypt-failure",{isMissingKey:$.message==="missing-key"})}}return c7(ei,et)};async function fu($){if(!$){let{valid:$,error:ee}=await c8();if(ee){return{error:ee}}else if(!$){return{error:{reason:"file-has-new-key"}}}}let{error:ee}=await c5($);if(ee){return{error:ee}}await aq(async()=>{await fX(`
|
|
134
134
|
DELETE FROM messages_crdt;
|
|
135
135
|
DELETE FROM messages_clock;
|
|
136
136
|
DELETE FROM transactions WHERE tombstone = 1;
|
|
@@ -142,76 +142,76 @@ Expression stack:`+et;return $}function sA($){if($===undefined){throw new se("`u
|
|
|
142
142
|
DELETE FROM rules WHERE tombstone = 1;
|
|
143
143
|
ANALYZE;
|
|
144
144
|
VACUUM;
|
|
145
|
-
`);await
|
|
145
|
+
`);await fZ()});await uA({groupId:null,lastSyncedTimestamp:null,lastUploaded:null});if($){let{key:ee}=$;let{cloudFileId:et}=uN();let en=JSON.parse(await rX(`encrypt-keys`)||"{}");en[et]=ee.serialize();await rQ("encrypt-keys",JSON.stringify(en));await uA({encryptKeyId:ee.getId()})}try{await fe()}catch($){if($.reason){return{error:$}}aD($);return{error:{reason:"upload-failure"}}}finally{aX("prefs-updated")}return{}};let fl=1e3;let ff="enabled";function fp($){let ee=ff;switch($){case"enabled":ff="enabled";break;case"offline":ff="offline";break;case"disabled":ff="disabled";break;case"import":ff="import";break;default:throw new Error("setSyncingMode: invalid mode: "+$)}return ee}function fh($){switch($){case"enabled":return ff==="enabled"||ff==="offline";case"disabled":return ff==="disabled"||ff==="import";case"offline":return ff==="offline";case"import":return ff==="import";default:throw new Error("checkSyncingMode: invalid mode: "+$)}}function fy($,ee){let{dataset:et,row:en,column:ei,value:eo}=$;if(et==="prefs"){}else{let $;try{if(ee){$={sql:`UPDATE ${et} SET ${ei} = ? WHERE id = ?`,params:[eo,en]}}else{$={sql:`INSERT INTO ${et} (id, ${ei}) VALUES (?, ?)`,params:[en,eo]}}fJ(f0($.sql),$.params)}catch(ee){throw new lG("invalid-schema",{error:{message:ee.message,stack:ee.stack},query:$})}}}async function fg($,ee){let et=[];let en=100;for(let ei=0;ei<ee.length;ei+=en){let eo=ee.slice(ei,ei+en);let es;let eu=`${$}.id`;if($==="transactions"){es=`
|
|
146
146
|
SELECT t.*, c.transferId AS category
|
|
147
147
|
FROM transactions t
|
|
148
148
|
LEFT JOIN category_mapping c ON c.id = t.category
|
|
149
|
-
`;eu="t.id"}else{es=`SELECT * FROM ${$}`}es+=` WHERE `;es+=eo.map($=>`${eu} = ?`).join(" OR ");try{let $=await
|
|
150
|
-
VALUES (?, ?, ?, ?, ?)`),[ef.toString(),$,es,el,
|
|
151
|
-
SELECT c.* FROM categories c
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
`)
|
|
156
|
-
SELECT
|
|
157
|
-
ORDER BY sort_order, id
|
|
158
|
-
`);return $.map($=>{return{...$,categories:ee.filter(ee=>ee.cat_group===$.id)}})}async function
|
|
149
|
+
`;eu="t.id"}else{es=`SELECT * FROM ${$}`}es+=` WHERE `;es+=eo.map($=>`${eu} = ?`).join(" OR ");try{let $=await fJ(es,eo,true);et=et.concat($)}catch($){throw new lG("invalid-schema",{error:{message:$.message,stack:$.stack},sql:es,params:eo})}}return et}function fm($){if($===null){return"0:"}else if(typeof $==="number"){return"N:"+$}else if(typeof $==="string"){return"S:"+$}throw new Error("Unserializable value type: "+JSON.stringify($))}function f_($){const ee=$[0];switch(ee){case"0":return null;case"N":return parseFloat($.slice(2));case"S":return $.slice(2);default:}throw new Error("Invalid type key for value: "+$)}let fv=[];function fw($){fv.push($);return()=>{fv=fv.filter(ee=>ee!==$)}}async function fE($){let ee=[];for(let et=0;et<$.length;et++){let en=$[et];let{dataset:ei,row:eo,column:es,timestamp:eu}=en;let el=eu.toString();let ef=fJ(f0("SELECT timestamp FROM messages_crdt WHERE dataset = ? AND row = ? AND column = ? AND timestamp >= ?"),[ei,eo,es,el],true);if(ef.length===0){ee.push(en)}else if(ef[0].timestamp!==el){ee.push({...en,old:true})}}return ee}function fS($){f2(()=>{for(let ee=0;ee<$.length;ee++){let et=$[ee];let{dataset:en}=et;if(!et.old){try{fy(et)}catch($){fy(et,true)}if(en==="prefs"){throw new Error("Cannot set prefs while importing")}}}})}const fT=aC(async $=>{if(fh("import")){fS($);return undefined}else if(fh("enabled")){$=await fE($)}$=[...$].sort(($,ee)=>{let et=$.timestamp?$.timestamp.toString():"";let en=ee.timestamp?ee.timestamp.toString():"";if(et<en){return-1}else if(et>en){return 1}return 0});let ee={};$.forEach($=>{if($.dataset==="prefs"){return}if(ee[$.dataset]==null){ee[$.dataset]=[]}ee[$.dataset].push($.row)});async function et(){let $=new Map;for(let et of Object.keys(ee)){const en=await fg(et,ee[et]);for(let ee=0;ee<en.length;ee++){let ei=en[ee];im($,[et,ei.id],ei)}}return $}let en={};let ei=await et();cf($,ei);let es;let eu;if(fh("enabled")){es=(0,eo.getClock)();eu=es.merkle}if(uU()){uU().startCacheBarrier()}f2(()=>{let ee=new Set;for(const et of $){const{dataset:$,row:es,column:el,timestamp:ef,value:ed}=et;if(!et.old){fy(et,i_(ei,[$,es])||ee.has($+es));if($==="prefs"){en[es]=ed}else{ee.add($+es)}}if(fh("enabled")){fJ(f0(`INSERT INTO messages_crdt (timestamp, dataset, row, column, value)
|
|
150
|
+
VALUES (?, ?, ?, ?, ?)`),[ef.toString(),$,es,el,fm(ed)]);eu=eo.merkle.insert(eu,ef)}}if(fh("enabled")){eu=eo.merkle.prune(eu);fJ(f0("INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)"),[(0,eo.serializeClock)({...es,merkle:eu})])}});if(fh("enabled")){es.merkle=eu}if(Object.keys(en).length>0){uA(en,{avoidSync:true});if(en.budgetType){lV(en.budgetType)}aX("prefs-updated")}let el=await et();if(uU()){uK();lj(ei,el);uU().triggerDatabaseChanges(ei,el);uZ();uU().endCacheBarrier()}fv.forEach($=>$(ei,el));let ef=fx($.filter($=>!$.old));l2.events.emit("sync",{type:"applied",tables:ef,data:el,prevData:ei});return $});function fO($){$.forEach($=>{eo.Timestamp.recv($.timestamp)});return aq(()=>fT($))}async function fA($){try{await fT($)}catch($){if($ instanceof lG){if($.reason==="invalid-schema"){l2.events.emit("sync",{type:"error",subtype:"apply-failure",meta:$.meta})}else{l2.events.emit("sync",{type:"error",meta:$.meta})}}throw $}await fL()}let fI=false;let fN=[];async function fD($){if(fI){await $();return}fI=true;let ee=[];try{await $()}finally{fI=false;ee=fN;fN=[]}if(ee.length>0){await fA(ee)}}async function fR($){if(fI){fN=fN.concat($)}else{return fA($)}}function fC($){return fJ("SELECT timestamp, dataset, row, column, value FROM messages_crdt WHERE timestamp > ?",[$],true)}function fk(){if(fM){clearTimeout(fM);fM=null}}let fM=null;function fL(){fk();if(fh("enabled")&&!fh("offline")){if(false){}else{fM=setTimeout(fF,fl)}}}function fx($){return $.reduce(($,ee)=>{let et=ee.dataset==="schedules_next_date"?"schedules":ee.dataset;if(!$.includes(et)){$.push(et)}return $},[])}async function fP(){let $=await fF();if(cK($)){await uJ();return $}return{}}const fF=ak(async function(){l2.events.emit("sync",{type:"start"});let $;try{$=await fB(null,0,null)}catch($){console.log($);if($ instanceof lG){if($.reason==="out-of-sync"){aD($);l2.events.emit("sync",{type:"error",subtype:"out-of-sync",meta:$.meta})}else if($.reason==="invalid-schema"){l2.events.emit("sync",{type:"error",subtype:"invalid-schema",meta:$.meta})}else if($.reason==="decrypt-failure"||$.reason==="encrypt-failure"){l2.events.emit("sync",{type:"error",subtype:$.reason,meta:$.meta})}else{l2.events.emit("sync",{type:"error",meta:$.meta})}}else if($ instanceof l$){console.log($);if($.reason==="unauthorized"){l2.events.emit("sync",{type:"unauthorized"});rQ("readOnly","true")}else if($.reason==="network-failure"){l2.events.emit("sync",{type:"error",subtype:"network"})}else{l2.events.emit("sync",{type:"error",subtype:$.reason})}}else{aD($);l2.events.emit("sync",{type:"error"})}return{error:{message:$.message,reason:$.reason,meta:$.meta}}}let ee=fx($);l2.events.emit("sync",{type:"success",tables:ee,syncDisabled:fh("disabled")});return{messages:$}});async function fB($,ee,et){let{cloudFileId:en,groupId:ei,lastSyncedTimestamp:es}=uN()||{};fk();if(fh("disabled")||fh("offline")){return[]}let eu=(0,eo.getClock)().timestamp.toString();let el=$||es||new eo.Timestamp(Date.now()-5*60*1e3,0,"0").toString();let ef=fC(el);let ed=await rX("user-token");u_.info("Syncing since",el,ef.length,"(attempt: "+ee+")");let ep=await c$(ei,en,el,ef);let eh=await l5(cn().SYNC_SERVER+"/sync",ep,{"X-ACTUAL-TOKEN":ed});if(!uN()||uN().groupId!==ei){return[]}let ey=await cq(eh);u_.info("Got messages from server",ey.messages.length);let eg=(0,eo.getClock)().timestamp.toString()!==eu;let em=[];if(ey.messages.length>0){em=await fO(ey.messages.map($=>({...$,value:f_($.value)})))}let e_=eo.merkle.diff(ey.merkle,(0,eo.getClock)().merkle);if(e_!==null){if(ee>=10&&e_===et||ee>=100){u_.info("SENT -------");u_.info(JSON.stringify(ef));u_.info("RECEIVED -------");u_.info(JSON.stringify(ey.messages));let $=cG();console.log(ee,"messages:",ef.length,ef.length>0?ef[0]:null,"res.messages:",ey.messages.length,ey.messages.length>0?ey.messages[0]:null,"clientId",(0,eo.getClock)().timestamp.node(),"groupId",ei,"diffTime:",e_,e_===et,"local clock:",(0,eo.getClock)().timestamp.toString(),(0,eo.getClock)().merkle.hash,"rebuilt hash:",$.numMessages,$.trie.hash,"server hash:",ey.merkle.hash,"localTimeChanged:",eg);if($.trie.hash===ey.merkle.hash){let $=await f4("SELECT * FROM messages_clock");if($.length!==1){console.log("Bad number of clocks:",$.length)}let ee=(0,eo.deserializeClock)($[0]).merkle.hash;console.log("Merkle hash in db:",ee)}throw new lG("out-of-sync")}em=em.concat(await fB(new eo.Timestamp(e_,0,"0").toString(),eg?0:ee+1,e_))}else{await uA({lastSyncedTimestamp:(0,eo.getClock)().timestamp.toString()})}return em};const fU=16384;function fj($,ee){const et=$[ee-1];const en=$[ee];if(!et){return en.sort_order/2}else if(!en){return et.sort_order+fU}else{return(et.sort_order+en.sort_order)/2}}function fW($,ee){const et=$.findIndex($=>$.id===ee);const en=$[et];const ei=$[et-1];let eo=[];if(!ee||et===-1){let ee;if($.length>0){ee=$[$.length-1].sort_order+fU}else{ee=fU}return{updates:eo,sort_order:ee}}else{if(en.sort_order-(ei?ei.sort_order:0)<=2){let ee=et;let en=Math.floor($[ee].sort_order)+fU;while(ee<$.length){if(en<=$[ee].sort_order){break}eo.push({id:$[ee].id,sort_order:en});ee++;en+=fU}}return{updates:eo,sort_order:fj($,et)}}};let fH;let fz;function fV(){return fH}async function f$($){if(fz){await oi(fz)}fH=oc(oy($),"db.sqlite");fY(await or(fH))}async function fq(){await oi(fz);fY(await or(fH))}async function fG(){if(fz){await oi(fz);fY(null)}}function fY($){fz=$;f1()}function fK(){return fz}async function fZ(){let $=await f3("SELECT * FROM messages_clock");if($){let ee=(0,eo.deserializeClock)($.clock);(0,eo.setClock)(ee)}else{let $=new eo.Timestamp(0,0,(0,eo.makeClientId)());let ee=(0,eo.makeClock)($);(0,eo.setClock)(ee);await fJ("INSERT INTO messages_clock (id, clock) VALUES (?, ?)",[1,(0,eo.serializeClock)(ee)])}}function fJ($,ee,et){const en=a5(fz,$,ee,et);return en}function fX($){a9(fz,$)}let fQ=new(i8())({max:100});function f0($){let ee=fQ.get($);if(ee){return ee}let et=a8(fz,$);fQ.set($,et);return et}function f1(){fQ=new(i8())({max:100})}function f2($){return oe(fz,$)}function f6($){return ot(fz,$)}async function f4($,ee){return fJ($,ee,true)}async function f3($,ee){const et=await fJ($,ee,true);return et.length===0?null:et[0]}function f8($,ee){const et=fJ($,ee,true);return et.length===0?null:et[0]}async function f5($,ee){return fJ($,ee)}async function f9($,ee){const et=await fJ("SELECT * FROM "+$+" WHERE id = ?",[ee],true);return et[0]}async function f7($,ee){let et=Object.keys(ee).filter($=>$!=="id");if(ee.id==null){throw new Error("update: id is required")}await fR(et.map(et=>{return{dataset:$,row:ee.id,column:et,value:ee[et],timestamp:eo.Timestamp.send()}}))}async function de($,ee){if(!ee.id){ee={...ee,id:e_()}}await dr($,ee);return ee.id}async function dr($,ee){let et=Object.keys(ee).filter($=>$!=="id");if(ee.id==null){throw new Error("insert: id is required")}await fR(et.map(et=>{return{dataset:$,row:ee.id,column:et,value:ee[et],timestamp:eo.Timestamp.send()}}))}async function dn($,ee){await fR([{dataset:$,row:ee,column:"tombstone",value:1,timestamp:eo.Timestamp.send()}])}async function di($,ee,et){let en=await fJ(ee,et,true);return en.map(ee=>o9(sZ,sJ,$,ee)).filter(Boolean)}async function ds($,ee,et){let en=await di($,ee,et);return en.length>0?en[0]:null}function du($,ee){if(!ee.id){ee={...ee,id:e_()}}return de($,o8(sZ,sJ,$,ee))}function dl($,ee){return f7($,o5(sZ,sJ,$,ee))}async function df(){return await f4(`
|
|
151
|
+
SELECT c.* FROM categories c WHERE c.tombstone = 0
|
|
152
|
+
ORDER BY c.sort_order, c.id
|
|
153
|
+
`)}async function dp(){const $=await f4(`
|
|
154
|
+
SELECT cg.* FROM category_groups cg WHERE cg.tombstone = 0 ORDER BY cg.is_income, cg.sort_order, cg.id
|
|
155
|
+
`);const ee=await f4(`
|
|
156
|
+
SELECT c.* FROM categories c WHERE c.tombstone = 0
|
|
157
|
+
ORDER BY c.sort_order, c.id
|
|
158
|
+
`);return $.map($=>{return{...$,categories:ee.filter(ee=>ee.cat_group===$.id)}})}async function dh($){const ee=await f3(`
|
|
159
159
|
SELECT sort_order FROM category_groups WHERE tombstone = 0 ORDER BY sort_order DESC, id DESC LIMIT 1
|
|
160
|
-
`);const et=(ee?ee.sort_order:0)+
|
|
160
|
+
`);const et=(ee?ee.sort_order:0)+fU;$={...oQ.validate($),sort_order:et};return de("category_groups",$)}function dy($){$=oQ.validate($,{update:true});return f7("category_groups",$)}async function dg($,ee){const et=await f4(`SELECT id, sort_order FROM category_groups WHERE tombstone = 0 ORDER BY sort_order, id`);const{updates:en,sort_order:ei}=fW(et,ee);for(let $ of en){await f7("category_groups",$)}await f7("category_groups",{id:$,sort_order:ei})}async function dm($,ee){const et=await f4("SELECT * FROM categories WHERE cat_group = ?",[$.id]);await Promise.all(et.map($=>dE($,ee)));await dn("category_groups",$.id)}async function d_($,{atEnd:ee}={atEnd:undefined}){let et;let en;await fD(async()=>{if(ee){const $=await f3(`
|
|
161
161
|
SELECT sort_order FROM categories WHERE tombstone = 0 ORDER BY sort_order DESC, id DESC LIMIT 1
|
|
162
|
-
`);et=($?$.sort_order:0)+
|
|
162
|
+
`);et=($?$.sort_order:0)+fU}else{const ee=await f4(`SELECT id, sort_order FROM categories WHERE cat_group = ? AND tombstone = 0 ORDER BY sort_order, id`,[$.cat_group]);const{updates:en,sort_order:ei}=fW(ee,ee.length>0?ee[0].id:null);for(let $ of en){await f7("categories",$)}et=ei}$={...oX.validate($),sort_order:et};const ei=await de("categories",$);await dr("category_mapping",{id:ei,transferId:ei});en=ei});return en}function dv($){$=oX.validate($,{update:true});return f7("categories",$)}async function dw($,ee,et){if(!ee){throw new Error("moveCategory: groupId is required")}const en=await f4(`SELECT id, sort_order FROM categories WHERE cat_group = ? AND tombstone = 0 ORDER BY sort_order, id`,[ee]);const{updates:ei,sort_order:eo}=fW(en,et);for(let $ of ei){await f7("categories",$)}await f7("categories",{id:$,sort_order:eo,cat_group:ee})}async function dE($,ee){if(ee){const et=await f4("SELECT * FROM category_mapping WHERE transferId = ?",[$.id]);for(let $ of et){await f7("category_mapping",{id:$.id,transferId:ee})}await f7("category_mapping",{id:$.id,transferId:ee})}return dn("categories",$.id)}async function dS($){return f3(`SELECT * FROM payees WHERE id = ?`,[$])}async function dT($){$=o0.validate($);let ee;await fD(async()=>{ee=await de("payees",$);await dr("payee_mapping",{id:ee,targetId:ee})});return ee}async function dO($){let{transfer_acct:ee}=await f3("SELECT * FROM payees WHERE id = ?",[$.id]);if(ee){return}return dn("payees",$.id)}async function dA($){return dn("payees",$.id)}function dI($){$=o0.validate($,{update:true});return f7("payees",$)}async function dN($,ee){let et=ig(await f4("SELECT * FROM payees"));if(et[$].transfer_acct!=null){return}ee=ee.filter($=>et[$].transfer_acct==null);await fD(async()=>{await Promise.all(ee.map(async ee=>{let et=await f4("SELECT id FROM payee_mapping WHERE targetId = ?",[ee]);await Promise.all(et.map(ee=>f7("payee_mapping",{id:ee.id,targetId:$})))}));await Promise.all(ee.map(ee=>Promise.all([f7("payee_mapping",{id:ee,targetId:$}),dn("payees",ee)])))})}function dD(){return f4(`
|
|
163
163
|
SELECT p.*, COALESCE(a.name, p.name) AS name FROM payees p
|
|
164
164
|
LEFT JOIN accounts a ON (p.transfer_acct = a.id AND a.tombstone = 0)
|
|
165
165
|
WHERE p.tombstone = 0 AND (p.transfer_acct IS NULL OR a.id IS NOT NULL)
|
|
166
166
|
ORDER BY p.transfer_acct IS NULL DESC, p.name COLLATE NOCASE
|
|
167
|
-
`)}function
|
|
167
|
+
`)}function dR(){return f4(`
|
|
168
168
|
SELECT p.id FROM payees p
|
|
169
169
|
LEFT JOIN payee_mapping pm ON pm.id = p.id
|
|
170
170
|
LEFT JOIN v_transactions_internal_alive t ON t.payee = pm.targetId
|
|
171
171
|
WHERE p.tombstone = 0 AND p.transfer_acct IS NULL AND t.id IS NULL
|
|
172
|
-
`)}async function
|
|
172
|
+
`)}async function dC(){let $=await f4(`
|
|
173
173
|
SELECT p.id FROM payees p
|
|
174
174
|
LEFT JOIN payee_mapping pm ON pm.id = p.id
|
|
175
175
|
LEFT JOIN v_transactions_internal_alive t ON t.payee = pm.targetId
|
|
176
176
|
WHERE p.tombstone = 0 AND p.transfer_acct IS NULL AND t.id IS NULL
|
|
177
|
-
`);return $.map($=>$.id)}async function
|
|
177
|
+
`);return $.map($=>$.id)}async function dk($){return f3(`SELECT * FROM payees WHERE UNICODE_LOWER(name) = ? AND tombstone = 0`,[$.toLowerCase()])}function dM(){return f4(`SELECT a.*, b.name as bankName, b.id as bankId FROM accounts a
|
|
178
178
|
LEFT JOIN banks b ON a.bank = b.id
|
|
179
179
|
WHERE a.tombstone = 0
|
|
180
|
-
ORDER BY sort_order, name`)}async function
|
|
180
|
+
ORDER BY sort_order, name`)}async function dL($){const ee=await f4("SELECT * FROM accounts WHERE offbudget = ? ORDER BY sort_order, name",[$.offbudget!=null?$.offbudget:0]);let{sort_order:et}=fW(ee);$=oJ.validate({...$,sort_order:et});return de("accounts",$)}function dx($){$=oJ.validate($,{update:true});return f7("accounts",$)}function dP($){return dn("accounts",$.id)}async function dF($,ee){let et=await f3("SELECT * FROM accounts WHERE id = ?",[$]);let en;if(et.closed){en=await f4(`SELECT id, sort_order FROM accounts WHERE closed = 1 ORDER BY sort_order, name`)}else{en=await f4(`SELECT id, sort_order FROM accounts WHERE tombstone = 0 AND offbudget = ? ORDER BY sort_order, name`,[et.offbudget])}const{updates:ei,sort_order:eo}=fW(en,ee);await fD(async()=>{for(let $ of ei){f7("accounts",$)}f7("accounts",{id:$,sort_order:eo})})}async function dB($){let ee=await di("transactions","SELECT * FROM v_transactions WHERE id = ?",[$]);return ee[0]}async function dU($,ee,et,en={}){throw new Error("`getTransactionsByDate` is deprecated")}async function dj($){if(arguments.length>1){throw new Error("`getTransactions` was given a second argument, it now only takes a single argument `accountId`")}return di("transactions","SELECT * FROM v_transactions WHERE account = ?",[$])}function dW($){return du("transactions",$)}function dH($){return dl("transactions",$)}async function dz($){return dn("transactions",$.id)};async function dV($){let ee=await f3(`SELECT id FROM payees WHERE UNICODE_LOWER(name) = ? AND tombstone = 0`,[$.toLowerCase()]);if(ee){return ee.id}else{return dT({name:$})}}async function d$(){let $=await f3(`
|
|
181
181
|
SELECT * FROM categories
|
|
182
182
|
WHERE is_income = 1 AND
|
|
183
183
|
LOWER(name) = 'starting balances' AND
|
|
184
184
|
tombstone = 0
|
|
185
|
-
`);if($===null){$=await f6("SELECT * FROM categories WHERE is_income = 1 AND tombstone = 0")}let ee=await dH("Starting Balance");return{id:ee,category:$?$.id:null}};const dV=["for","and","nor","but","or","yet","so"];const d$=["a","an","the"];const dq=["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"];const dG=new Set([...dV,...d$,...dq]);const dY=dG;const dK=["CLI","API","HTTP","HTTPS","JSX","DNS","URL","CI","CDN","GitHub","CSS","JS","JavaScript","TypeScript","HTML","WordPress","JavaScript","Next.js","Node.js"];const dZ=dK;let dJ="[0-9A-Za-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶ-ͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԣԱ-Ֆՙա-ևא-תװ-ײء-يٮ-ٯٱ-ۓەۥ-ۦۮ-ۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴ-ߵߺऄ-हऽॐक़-ॡॱ-ॲॻ-ॿঅ-ঌএ-ঐও-নপ-রলশ-হঽৎড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલ-ળવ-હઽૐૠ-ૡଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହଽଡ଼-ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘ-ౙౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹഽൠ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะา-ำเ-ๆກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ະາ-ຳຽເ-ໄໆໜ-ໝༀཀ-ཇཉ-ཬྈ-ྋက-ဪဿၐ-ၕၚ-ၝၡၥ-ၦၮ-ၰၵ-ႁႎႠ-Ⴥა-ჺჼᄀ-ᅙᅟ-ᆢᆨ-ᇹሀ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙶᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦩᧁ-ᧇᨀ-ᨖᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮ-ᮯᰀ-ᰣᱍ-ᱏᱚ-ᱽᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₔℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-Ɐⱱ-ⱽⲀ-ⳤⴀ-ⴥⴰ-ⵥⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆷㇰ-ㇿ㐀䶵一鿃ꀀ-ꒌꔀ-ꘌꘐ-ꘟꘪ-ꘫꙀ-ꙟꙢ-ꙮꙿ-ꚗꜗ-ꜟꜢ-ꞈꞋ-ꞌꟻ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꤊ-ꤥꤰ-ꥆꨀ-ꨨꩀ-ꩂꩄ-ꩋ가힣豈-鶴侮-頻並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]";let dX=new RegExp(`(?:(?:(\\s?(?:^|[.\\(\\)!?;:"-])\\s*)(${dJ}))|(${dJ}))(${dJ}*[’']*${dJ}*)`,"g");let dQ=$=>$.map($=>[new RegExp(`\\b${$}\\b`,"gi"),$]);function d0($){const ee=$[0];if(/\s/.test(ee)){return $.substr(1)}if(/[()]/.test(ee)){return null}return $}function d1($,ee={special:undefined}){$=$.toLowerCase().replace(dX,($,ee="",et,en,ei)=>{const eo=d0($);if(!eo){return $}if(!et){const $=en+ei;if(dY.has($)){return eo}}return ee+(en||et).toUpperCase()+ei});const et=ee.special||[];const en=[...dZ,...et];const ei=dQ(en);ei.forEach(([ee,et])=>{$=$.replace(ee,et)});return $};const d2={date:{ops:["is","isapprox","gt","gte","lt","lte"],nullable:false},id:{ops:["is","contains","oneOf","isNot","doesNotContain","notOneOf"],nullable:true},saved:{ops:[],nullable:false},string:{ops:["is","contains","oneOf","isNot","doesNotContain","notOneOf"],nullable:true},number:{ops:["is","isapprox","isbetween","gt","gte","lt","lte"],nullable:false},boolean:{ops:["is"],nullable:false}};const d6=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",saved:"saved"}));function d4($,ee){ee=ee||{};switch($){case"imported_payee":return"imported payee";case"amount":if(ee.inflow){return"amount (inflow)"}else if(ee.outflow){return"amount (outflow)"}return"amount";case"amount-inflow":return"amount (inflow)";case"amount-outflow":return"amount (outflow)";default:return $}}function d3($,ee){switch($){case"oneOf":return"one of";case"notOneOf":return"not one of";case"is":return"is";case"isNot":return"is not";case"isapprox":return"is approx";case"isbetween":return"is between";case"contains":return"contains";case"doesNotContain":return"does not contain";case"gt":if(ee==="date"){return"is after"}return"is greater than";case"gte":if(ee==="date"){return"is after or equals"}return"is greater than or equals";case"lt":if(ee==="date"){return"is before"}return"is less than";case"lte":if(ee==="date"){return"is before or equals"}return"is less than or equals";case"true":return"is true";case"false":return"is false";case"set":return"set";case"link-schedule":return"link schedule";case"and":return"and";case"or":return"or";default:return""}}function d8($){if($==="amount-inflow"){return{field:"amount",options:{inflow:true}}}else if($==="amount-outflow"){return{field:"amount",options:{outflow:true}}}else{return{field:$}}}function d5($){switch($){case"date-format":return"Invalid date format";case"no-null":case"no-empty-array":case"no-empty-string":return"Value cannot be empty";case"not-number":return"Value must be a number";case"invalid-field":return"Please choose a valid field for this type of rule";default:return"Internal error, sorry! Please get in touch https://actualbudget.org/contact/ for support"}}function d9($,ee){if($<ee){return[$,ee]}return[ee,$]}function d7($){switch($.type){case"number":{let ee=$.value;if($.field==="amount"&&$.op!=="isbetween"&&ee!=null){ee=integerToAmount(ee)}return{...$,value:ee}}case"string":{let ee=$.value==null?"":$.value;return{...$,value:ee}}case"boolean":{let ee=$.value;return{...$,value:ee}}default:}return{...$,error:null}}function pt({error:$,inputKey:ee,...et}){switch(et.type){case"number":{let $=et.value;if(et.field==="amount"&&et.op!=="isbetween"){$=amountToInteger($)}return{...et,value:$}}case"string":{let $=et.value==null?"":et.value;return{...et,value:$}}case"boolean":{let $=et.value==null?false:et.value;return{...et,value:$}}default:}return et}function pr($,ee){switch(ee.type){case"number":{if(ee.op!=="isbetween"){return{...ee,error:null,value:$?currencyToAmount(String($))||0:0}}break}default:}return{...ee,error:null,value:$}}function pn($){return Math.round(Math.abs($)*.075)};let pi;let po;async function ps(){let $=(await f2("SELECT * FROM category_mapping")).map($=>[$.id,$.transferId]);let ee=(await f2("SELECT * FROM payee_mapping")).map($=>[$.id,$.targetId]);pi=new Map($.concat(ee));if(po){po()}po=f_(pu)}function pu($,ee){ee.forEach(($,ee)=>{if(ee.indexOf("mapping")!==-1){let et=ee==="category_mapping"?"transferId":"targetId";$.forEach($=>{pi.set($.id,$[et])})}})}function pl(){return pi}function pc($){return pi.get($)||null};function pf($,ee,et){let en=nR();if(ee){return"completed"}else if(et){return"paid"}else if($===en){return"due"}else if($>en&&$<=nF(en,7)){return"upcoming"}else if($<en){return"missed"}else{return"scheduled"}}function pd($){let ee=$.map($=>{let ee=$._conditions.find($=>$.field==="date");return{$and:{schedule:$.id,date:{$gte:ee&&ee.op==="is"?$.next_date:nB($.next_date,2)}}}});return sX("transactions").filter({$or:ee}).orderBy({date:"desc"}).groupBy("schedule").select(["schedule","date"])}function pp($){return monthUtils.format(new Date(2020,0,$,12),"do")}function ph($){let ee={SU:"Sunday",MO:"Monday",TU:"Tuesday",WE:"Wednesday",TH:"Thursday",FR:"Friday",SA:"Saturday"};return ee[$]}function py($){let ee=$.interval||1;switch($.frequency){case"daily":{let $="Every ";$+=ee!==1?`${ee} days`:"day";return $}case"weekly":{let et="Every ";et+=ee!==1?`${ee} weeks`:"week";et+=" on "+monthUtils.format($.start,"EEEE");return et}case"monthly":{let et="Every ";et+=ee!==1?`${ee} months`:"month";if($.patterns&&$.patterns.length>0){let ee=[...$.patterns].sort(($,ee)=>{let et=($.type==="day"?1:0)-(ee.type==="day"?1:0);let en=$.value-ee.value;if(et===0){return en}return et}).filter($=>$.value!==-1);ee=ee.concat($.patterns.filter($=>$.value===-1));et+=" on the ";let en=[];let ei=new Set(ee.map($=>$.type));let eo=ei.size===1&&!ei.has("day");for(let $ of ee){if($.type==="day"){if($.value===-1){en.push("last day")}else{en.push(pp($.value))}}else{let ee=eo?"":" "+ph($.type);if($.value===-1){en.push("last"+ee)}else{en.push(pp($.value)+ee)}}}if(en.length>2){et+=en.slice(0,en.length-1).join(", ");et+=", and ";et+=en[en.length-1]}else{et+=en.join(" and ")}if(eo){et+=" "+ph(ee[0].type)}}else{et+=" on the "+monthUtils.format($.start,"do")}return et}case"yearly":{let et="Every ";et+=ee!==1?`${ee} years`:"year";et+=" on "+monthUtils.format($.start,"LLL do");return et}default:return"Recurring error"}}function pg($){let ee={start:nT($.start),frequency:$.frequency.toUpperCase(),byHourOfDay:[12]};if($.interval){ee.interval=$.interval}let et=$=>$.slice(0,2).toUpperCase();switch($.frequency){case"daily":return[ee];case"weekly":return[ee];case"monthly":if($.patterns&&$.patterns.length>0){let en=$.patterns.filter($=>$.type==="day");let ei=$.patterns.filter($=>$.type!=="day");return[en.length>0&&{...ee,byDayOfMonth:en.map($=>$.value)},ei.length>0&&{...ee,byDayOfWeek:ei.map($=>[et($.type),$.value])}].filter(Boolean)}else{return[ee]}case"yearly":return[ee];default:throw new Error("Invalid recurring date config")}}function pm($){return{payee:$.find($=>$.op==="is"&&$.field==="payee")||$.find($=>$.op==="is"&&$.field==="description")||null,account:$.find($=>$.op==="is"&&$.field==="account")||$.find($=>$.op==="is"&&$.field==="acct")||null,amount:$.find($=>($.op==="is"||$.op==="isapprox"||$.op==="isbetween")&&$.field==="amount")||null,date:$.find($=>($.op==="is"||$.op==="isapprox")&&$.field==="date")||null}}function p_($){if($&&typeof $!=="number"){return Math.round(($.num1+$.num2)/2)}return $}function pv($,ee){if(ee){return`${ee.name} (${$.next_date})`}else{return`Next: ${$.next_date}`}};class pE extends Error{}let pS;class pT{constructor($,ee){this.metadata={};this.duration=ee&&ee.duration||0;this.generators=ee&&ee.generators&&ee.generators.slice()||[];if(!Number.isInteger(this.duration)||this.duration<0){throw new pE("duration must be a non-negative integer")}}static set adapter($){if(pS){throw new Error(`"${pS.name}" has already been configured.`)}pS=$}static get adapter(){if(!pS){throw new Error("No date adapter has been configured. See rSchedule docs.")}return pS}static isDate($){throw pO("isDate()")}static fromDate($,ee){throw pO("fromDate()")}static fromJSON($){throw pO("fromJSON()")}static fromDateTime($){throw pO("fromDateTime()")}toISOString(){return this.set("timezone","UTC").toDateTime().toISOString()}toDateTime(){const $=pN.fromJSON(Object.assign(Object.assign({},this.toJSON()),{generators:this.generators,metadata:this.metadata}));return $}}pT.hasTimezoneSupport=false;function pO($){return new Error(`You must implement the "${$}" method for this DateAdapter class`)}var pA;(function($){$.WEEKDAYS=["SU","MO","TU","WE","TH","FR","SA"];$.MILLISECONDS_IN_SECOND=1e3;$.MILLISECONDS_IN_MINUTE=$.MILLISECONDS_IN_SECOND*60;$.MILLISECONDS_IN_HOUR=$.MILLISECONDS_IN_MINUTE*60;$.MILLISECONDS_IN_DAY=$.MILLISECONDS_IN_HOUR*24;$.MILLISECONDS_IN_WEEK=$.MILLISECONDS_IN_DAY*7})(pA||(pA={}));class pI extends Error{}class pN{constructor($,ee,et,en,ei={}){this.metadata={};this.date=new Date($);this.timezone=ee||null;this.duration=et||0;this.generators=en&&en.slice()||[];if(!Number.isInteger(this.duration)||this.duration<0){throw new pI("duration must be a non-negative integer")}if(ei.metadata){Object.assign(this.metadata,ei.metadata)}this.assertIsValid()}static fromJSON($){const ee=new Date(Date.UTC($.year,$.month-1,$.day,$.hour,$.minute,$.second,$.millisecond));return new pN(ee,$.timezone,$.duration,$.generators,{metadata:$.metadata})}static fromDateAdapter($){return pN.fromJSON(Object.assign(Object.assign({},$.toJSON()),{generators:$.generators,metadata:$.metadata}))}get end(){if(!this.duration)return;if(this._end)return this._end;this._end=this.add(this.duration,"millisecond");return this._end}isEqual($){if(!$){return false}pD(this,$);return this.valueOf()===$.valueOf()}isBefore($){pD(this,$);return this.valueOf()<$.valueOf()}isBeforeOrEqual($){pD(this,$);return this.valueOf()<=$.valueOf()}isAfter($){pD(this,$);return this.valueOf()>$.valueOf()}isAfterOrEqual($){pD(this,$);return this.valueOf()>=$.valueOf()}isOccurring($){if(!this.duration){throw new Error("DateTime#isOccurring() is only applicable to DateTimes with durations")}pD(this,$);return $.isAfterOrEqual(this)&&$.isBeforeOrEqual(this.add(this.duration,"millisecond"))}add($,ee){switch(ee){case"generator":{const ee=this.generators.slice();ee.unshift($);return new pN(this.date,this.timezone,this.duration,ee)}case"year":return this.forkDateTime(pV(this.date,$));case"month":return this.forkDateTime(p$(this.date,$));case"week":return this.forkDateTime(pq(this.date,$));case"day":return this.forkDateTime(pG(this.date,$));case"hour":return this.forkDateTime(pY(this.date,$));case"minute":return this.forkDateTime(pK(this.date,$));case"second":return this.forkDateTime(pZ(this.date,$));case"millisecond":return this.forkDateTime(pJ(this.date,$));default:throw new Error("Invalid unit provided to `DateTime#add`")}}subtract($,ee){switch(ee){case"year":return this.forkDateTime(pX(this.date,$));case"month":return this.forkDateTime(pQ(this.date,$));case"week":return this.forkDateTime(p0(this.date,$));case"day":return this.forkDateTime(p6(this.date,$));case"hour":return this.forkDateTime(p4(this.date,$));case"minute":return this.forkDateTime(p3(this.date,$));case"second":return this.forkDateTime(p8(this.date,$));case"millisecond":return this.forkDateTime(p5(this.date,$));default:throw new Error("Invalid unit provided to `DateTime#subtract`")}}get($){switch($){case"year":return this.date.getUTCFullYear();case"month":return this.date.getUTCMonth()+1;case"yearday":return pW(this.date);case"weekday":return pA.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($,ee){if($==="duration"){return new pN(this.date,this.timezone,ee,this.generators)}if($==="generators"){return new pN(this.date,this.timezone,this.duration,ee)}let et=new Date(this.date);switch($){case"year":et.setUTCFullYear(ee);break;case"month":{const $=pF(ee,et.getUTCFullYear());const en=et.getUTCDate();if(en>$){et.setUTCDate(1);et.setUTCMonth(ee);et=p6(et,1)}else{et.setUTCMonth(ee-1)}break}case"day":et.setUTCDate(ee);break;case"hour":et.setUTCHours(ee);break;case"minute":et.setUTCMinutes(ee);break;case"second":et.setUTCSeconds(ee);break;case"millisecond":et.setUTCMilliseconds(ee);break;default:throw new Error("Invalid unit provided to `DateTime#set`")}return this.forkDateTime(et)}granularity($,ee={}){let et=this.forkDateTime(this.date);switch($){case"year":et=et.set("month",1);case"month":et=et.set("day",1);break;case"week":et=pR(et,ee.weekStart)}switch($){case"year":case"month":case"week":case"day":et=et.set("hour",0);case"hour":et=et.set("minute",0);case"minute":et=et.set("second",0);case"second":et=et.set("millisecond",0);case"millisecond":return et;default:throw new Error("Invalid granularity provided to `DateTime#granularity`: "+$)}}endGranularity($,ee={}){let et=this.forkDateTime(this.date);switch($){case"year":et=et.set("month",12);case"month":et=et.set("day",pF(et.get("month"),et.get("year")));break;case"week":et=pC(et,ee.weekStart)}switch($){case"year":case"month":case"week":case"day":et=et.set("hour",23);case"hour":et=et.set("minute",59);case"minute":et=et.set("second",59);case"second":et=et.set("millisecond",999);case"millisecond":return et;default:throw new Error("Invalid granularity provided to `DateTime#granularity`: "+$)}}toISOString(){return this.date.toISOString()}toDateTime(){return this}toJSON(){const $={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")};if(this.duration){$.duration=this.duration}return $}valueOf(){return this.date.valueOf()}assertIsValid(){if(isNaN(this.valueOf())){throw new pI("DateTime has invalid date.")}return true}forkDateTime($){return new pN($,this.timezone,this.duration,this.generators)}}function pD($,ee){if($.timezone!==ee.timezone){throw new pI("Attempted to compare a datetime to another date in a different timezone: "+JSON.stringify($)+" and "+JSON.stringify(ee))}return true}function pR($,ee){const et=pL(ee).indexOf($.get("weekday"));return $.subtract(et,"day")}function pC($,ee){const et=pL(ee).indexOf($.get("weekday"));return $.add(6-et,"day")}function pk($,ee){if($.isAfter(ee))return 1;if($.isBefore(ee))return-1;if($.duration&&ee.duration){if($.duration>ee.duration)return 1;if($.duration<ee.duration)return-1}return 0}function pM($){return Array.from(new Map($.map($=>[$.toISOString(),$])).values())}function pL($="SU"){const ee=pA.WEEKDAYS.slice();let et=ee.indexOf($);while(et!==0){px(ee);et--}return ee}function px($,ee="first"){if($.length===0){return $}else if(ee==="first"){$.push($.shift())}else{$.unshift($.pop())}return $}function pP($,ee){if($===ee)return 0;const et=pA.WEEKDAYS.indexOf($)-pA.WEEKDAYS.indexOf(ee);return et>0?7-et:Math.abs(et)}function pF($,ee){const et={1:31,2:pB(ee),3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31};return et[$]}function pB($){return pU($)?29:28}function pU($){return $%400===0||$%4===0&&$%100!==0}function pj($){return pU($)?366:365}function pW($){const ee=new Date(Date.UTC($.getUTCFullYear(),0,1));const et=$.valueOf()-ee.valueOf();return 1+Math.floor(et/pA.MILLISECONDS_IN_DAY)}function pH($){if($===null||$===true||$===false){return NaN}const ee=Number($);if(isNaN(ee)){return ee}return ee<0?Math.ceil(ee):Math.floor(ee)}function pz($,ee){if(arguments.length<2){throw new TypeError("2 arguments required, but only "+arguments.length+" present")}const et=$.valueOf();const en=pH(ee);return new Date(et+en)}function pV($,ee){const et=pH(ee);return p$($,et*12)}function p$($,ee){const et=pH(ee);$=new Date($);const en=$.getUTCMonth()+et;const ei=new Date(0);ei.setUTCFullYear($.getUTCFullYear(),en,1);ei.setUTCHours(0,0,0,0);const eo=pF(ei.getUTCMonth()+1,ei.getUTCFullYear());$.setUTCMonth(en,Math.min(eo,$.getUTCDate()));return $}function pq($,ee){const et=pH(ee);const en=et*7;return pG($,en)}function pG($,ee){return pJ($,pH(ee)*pA.MILLISECONDS_IN_DAY)}function pY($,ee){const et=pH(ee);return pz($,et*pA.MILLISECONDS_IN_HOUR)}function pK($,ee){const et=pH(ee);return pz($,et*pA.MILLISECONDS_IN_MINUTE)}function pZ($,ee){const et=pH(ee);return pz($,et*pA.MILLISECONDS_IN_SECOND)}function pJ($,ee){const et=pH(ee);const en=$.getTime();return new Date(en+et)}function pX($,ee){return pV($,-ee)}function pQ($,ee){return p$($,-ee)}function p0($,ee){return pq($,-ee)}function p6($,ee){return pG($,-ee)}function p4($,ee){return pY($,-ee)}function p3($,ee){return pK($,-ee)}function p8($,ee){return pZ($,-ee)}function p5($,ee){return pJ($,-ee)}class p9 extends Error{}class p7 extends Error{}function he($,ee){if($>ee){return 1}else if(ee>$){return-1}else{return 0}}function ht($){switch($){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()")}}function hr($){return JSON.parse(JSON.stringify($))}function hn($){return $ instanceof pN?pT.adapter.fromDateTime($):$ instanceof pT?$:pT.adapter.fromDate($)}function ho($,ee){if($ instanceof pN){if($.timezone!==ee){return pT.adapter.fromDateTime($).set("timezone",ee).toDateTime()}return $}return $ instanceof pT?$.set("timezone",ee).toDateTime():pT.adapter.fromDate($).set("timezone",ee).toDateTime()}function hs($,ee){if($.timezone!==ee){return pT.adapter.fromDateTime($).set("timezone",ee).toDateTime()}return $}class hu extends Error{}function hl($){let ee;if($.start instanceof pN){ee=$.start}else if($.start instanceof pT){ee=$.start.toDateTime()}else if(pT.adapter.isDate($.start)){ee=pT.adapter.fromDate($.start).toDateTime()}else{throw new hu('"start" must be either a `DateAdapter` instance or an instance of the '+"date a DateAdapter is wrapping (e.g. `StandardDateAdapter` wraps a `Date`)")}let et;if($.end){if($.end instanceof pN){et=$.end}else if($.end instanceof pT){et=$.end.toDateTime()}else if(pT.adapter.isDate($.end)){et=pT.adapter.fromDate($.end).toDateTime()}else{throw new hu('"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`)")}}if($.duration!==undefined){if(!Number.isInteger($.duration)){throw new hu('"duration" expects a whole number')}if($.duration<=0){throw new hu('"duration" must be greater than 0')}}if($.count!==undefined){if(!Number.isInteger($.count)){throw new hu('"count" must be a whole number')}if($.count<0){throw new hu('"count" must be greater than 0')}}if($.end!==undefined&&$.count!==undefined){throw new hu('"end" and "count" cannot both be present')}return{start:ee,end:et,count:$.count,duration:$.duration}}function hf($,ee){const et=hl(ee);const en=hr(ee);$.forEach($=>{$.normalizeOptions(en,et)});Object.keys(et).forEach($=>{if(et[$]===undefined){delete et[$]}});return et}function hd($){const ee=hr($);ee.start=$.start;if($.end)ee.end=$.end;return ee}class hp extends Error{}class hh{constructor($){this.date=$}}class hy{constructor($){this.date=$}}function hg($){return ee=>$.reduce(($,et)=>{const en=et.get(ee);if(en)$.push(en);return $},[])}class hm{constructor($,ee,et){this.options=ee;this.args=et;this.rules=[];this.iterator=this.options.count===undefined?this.iterate():this.args.reverse?this.iterateWithReverseCount():this.iterateWithCount();this.options=Object.assign(Object.assign({},hr(ee)),{start:ee.start,end:ee.end});this.reverse=this.options.count===undefined&&et.reverse||false;const{start:en,end:ei}=this.normalizeDateTimeArgs(et);if(ee.count!==undefined){this.start=ee.start}else if(en&&ee.start){this.start=en.isAfterOrEqual(ee.start)?en:ee.start}else{this.start=en||ee.start}if(ei&&ee.end){this.end=ei.isBeforeOrEqual(ee.end)?ei:ee.end}else{this.end=ei||ee.end}if(this.args.reverse&&!(ee.count!==undefined||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&&this.options.count===undefined;this.hasDuration=!!this.options.duration;this.rules=Array.isArray($)?$:$(this)}[Symbol.iterator](){return this.iterator}next($){return this.iterator.next($)}*iterateWithReverseCount(){const $=Array.from(this.iterateWithCount()).reverse();let ee;const et=$.slice();let en=et.shift();while(en){if(ee&&ee.skipToDate&&en.isAfter(ee.skipToDate)){en=et.shift();continue}ee=yield en;if(ee&&ee.skipToDate&&ee.skipToDate.isAfterOrEqual(en)){throw new Error("A provided `skipToDate` option must be greater than the last yielded date "+"(or smaller, in the case of reverse iteration)")}en=et.shift()}return undefined}*iterateWithCount(){if(this.options.count===0)return;const $=this.iterate();const ee=this.args.start||this.start;let et=$.next().value;let en=1;let ei;while(et&&en<=this.options.count){en++;if(et.isBefore(ee)){et=$.next().value;continue}if(ei&&ei.skipToDate&&et.isBefore(ei.skipToDate)){et=$.next().value;continue}ei=yield et;if(ei&&ei.skipToDate&&ei.skipToDate.isBeforeOrEqual(et)){throw new Error("A provided `skipToDate` option must be greater than the last yielded date "+"(or smaller, in the case of reverse iteration)")}et=$.next().value}return undefined}*iterate(){let $=this.start;if(this.reverse)$=this.end;let ee=this.nextDate($);while(ee){const $=yield this.normalizeRunOutput(ee);if($&&$.skipToDate){if(this.reverse?$.skipToDate.isAfterOrEqual(ee):$.skipToDate.isBeforeOrEqual(ee)){throw new Error("A provided `skipToDate` option must be greater than the last yielded date "+"(or smaller, in the case of reverse iteration)")}ee=this.nextDate($.skipToDate)}else{ee=this.nextDate(this.reverse?ee.subtract(1,"millisecond"):ee.add(1,"millisecond"))}}return undefined}nextDate($){let ee=this.runRules($.set("generators",[]));if(this.isDatePastEnd(ee.date))return null;let et=0;while(ee instanceof hy&&et<50){ee=this.runRules(ee.date);if(this.isDatePastEnd(ee.date))return null;et++}if(ee instanceof hy){throw new hp(`Failed to find a matching occurrence in ${et} iterations. `+`Last iterated date: "${ee.date.toISOString()}"`)}if(this.reverse?$.isBefore(ee.date):$.isAfter(ee.date)){throw new hp("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 ee.date}runRules($){let ee=new hh($);for(const $ of this.rules){if(ee instanceof hy){return ee}ee=$.run(ee.date)}return ee}isDatePastEnd($){return this.reverse?$.isBefore(this.start):this.end&&$.isAfter(this.end)}normalizeRunOutput($){return this.hasDuration?$.set("duration",this.options.duration):$}normalizeDateTimeArgs($){return{start:$.start&&hs($.start,this.options.start.timezone),end:$.end&&hs($.end,this.options.start.timezone)}}};class h_{constructor($={}){this.timezone=$.timezone!==undefined?$.timezone:null;this.maxDuration=$.maxDuration||0}get firstDate(){if(this._firstDate!==undefined)return this._firstDate;const $=this._run().next().value;this._firstDate=$?this.dateAdapter.fromDateTime($):null;return this._firstDate}get lastDate(){if(this._lastDate!==undefined)return this._lastDate;if(this.isInfinite){this._lastDate=null;return null}const $=this._run({reverse:true}).next().value;this._lastDate=$?this.dateAdapter.fromDateTime($):null;return this._lastDate}pipe(...$){return $.reduce(($,ee)=>ee({base:$,timezone:this.timezone}),this)}occurrences($={}){return new hv(this,this.normalizeOccurrencesArgs($))}collections($={}){return new hE(this,this.normalizeCollectionsArgs($))}occursBetween($,ee,et={}){const en=this.normalizeDateInput($);const ei=this.normalizeDateInput(ee);if(this.hasDuration&&!et.excludeEnds){const $=this.getMaxDuration("occursBetween",et);const ee=this._run({start:en.subtract($,"millisecond"),end:ei,reverse:true});for(const $ of ee){if($.end.isBefore(en))continue;return true}return false}for(const $ of this._run({start:en,end:ei})){if(et.excludeEnds){if($.isEqual(en)){continue}if($.isEqual(ei)){break}}return true}return false}occursOn($){const ee=this.normalizeOccursOnArgs($);if(ee.weekday){if(this.isInfinite&&!ee.before){throw new p9("When calling `occursOn()` with a `weekday` argument "+"and an occurrence object that has infinite occurrences, "+"you must include a `before` argument as well.")}const $=ee.after&&(ee.excludeEnds?ee.after.add(1,"day"):ee.after);const et=ee.before&&(ee.excludeEnds?ee.before.subtract(1,"day"):ee.before);const en=this._run({start:$,end:et});let ei=en.next().value;if(!ei)return false;while(ei){if(ei.get("weekday")===ee.weekday){return true}ei=en.next({skipToDate:ei.add(pP(ei.get("weekday"),ee.weekday),"day").granularity("day")}).value}return false}if(!ee.date){throw new p9(`"occursOn()" must be called with either a "date" or "weekday" argument`)}if(this.hasDuration){const $=this.getMaxDuration("occursOn",ee);const et=this._run({start:ee.date.subtract($,"millisecond"),end:ee.date});for(const $ of et){if($.end.isBefore(ee.date))continue;if($.isAfter(ee.date))return false;return true}return false}for(const $ of this._run({start:ee.date,end:ee.date})){return!!$}return false}occursAfter($,ee={}){const et=this.normalizeDateInput($);if(this.hasDuration&&!ee.excludeStart){const $=this.getMaxDuration("occursAfter",ee);const en=this._run({start:et.subtract($,"millisecond")});for(const $ of en){if($.end.isBefore(et))continue;return true}return false}for(const $ of this._run({start:et})){if(ee.excludeStart&&$.isEqual(et)){continue}return true}return false}occursBefore($,ee={}){const et=this.normalizeDateInput($);if(this.hasDuration&&ee.excludeStart){for(const $ of this._run({end:et,reverse:true})){if($.end.isAfterOrEqual(et))continue;return true}return false}for(const $ of this._run({end:et,reverse:true})){if(ee.excludeStart&&$.isEqual(et)){continue}return true}return false}get dateAdapter(){return pT.adapter}normalizeOccurrencesArgs($){return Object.assign(Object.assign({},$),{start:this.normalizeDateInput($.start),end:this.normalizeDateInput($.end)})}normalizeCollectionsArgs($){if($.reverse!==undefined){throw new p9("`collections()` does not support the `reverse` option at this time.")}return Object.assign(Object.assign({},$),{start:this.normalizeDateInput($.start),end:this.normalizeDateInput($.end)})}normalizeOccursOnArgs($={}){return Object.assign(Object.assign({},$),{date:this.normalizeDateInput($.date),after:this.normalizeDateInput($.after),before:this.normalizeDateInput($.before),excludeDates:$.excludeDates&&$.excludeDates.map($=>this.normalizeDateInput($))})}normalizeRunArgs($){return Object.assign(Object.assign({},$),{start:this.normalizeDateInput($.start),end:this.normalizeDateInput($.end)})}normalizeDateInput($){return $?ho($,this.timezone):undefined}normalizeDateInputToAdapter($){if(!$)return;return hn($)}normalizeRunOutput($){return hs($,this.timezone)}getMaxDuration($,ee){const et=ee.maxDuration||this.maxDuration;if(!Number.isInteger(et)){throw new p9(`When an occurrence generator `+`has a duration, a 'maxDuration' argument must be supplied `+`to ${$}().`)}return et}}class hv{constructor($,ee){this.iterable=$;this.args=ee;this[Symbol.iterator]=()=>this.occurrenceIterator();this.iterator=$._run(ee);this.isInfinite=$.isInfinite}next($){return this.occurrenceIterator($).next()}toArray(){if(this.args.end||this.args.take||!this.isInfinite){return Array.from(this.occurrenceIterator())}throw new p7("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($){let ee=this.normalizeRunArgs($);let et=this.iterator.next(ee).value;while(et){const $=yield this.normalizeDateOutput(et);ee=this.normalizeRunArgs($);et=this.iterator.next(ee).value}return undefined}normalizeRunArgs($){return{skipToDate:this.normalizeDateInput($&&$.skipToDate)}}normalizeDateInput($){return $?ho($,this.iterable.timezone):undefined}normalizeDateOutput($){if(!$)return;return $?pT.adapter.fromDateTime($):undefined}}class hw{constructor($=[],ee,et,en){this.dates=$;this.granularity=ee;this.periodStart=et;this.periodEnd=en}}class hE{constructor($,ee){this.iterable=$;this.args=ee;this.granularity="year";this[Symbol.iterator]=()=>this.iterator;if(ee.granularity){this.granularity=ee.granularity;if(this.granularity==="week"&&!ee.weekStart){throw new Error('"week" granularity requires `weekStart` arg')}}if(ee.weekStart){this.weekStart=ee.weekStart}if(ee.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({},ee),{start:ee.start||$._run().next().value,end:ee.end&&this.getPeriod(ee.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 $=[];for(const ee of this.collectionIterator()){$.push(ee)}return $}throw new p7("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($){if(!$)return;return pT.adapter.fromDateTime($)}*collectionIterator(){if(!this.startDate)return;let $=this.occurrenceIterator();let ee=$.next().value;if(!ee)return;let et=this.getPeriod(this.args.start);let en=[];let ei=0;while(ee&&(this.args.take===undefined||this.args.take>ei)){while(ee&&ee.isBeforeOrEqual(et.end)){en.push(ee);ee=$.next().value}yield new hw(en.map($=>this.normalizeDateOutput($)),this.granularity,this.normalizeDateOutput(et.start),this.normalizeDateOutput(et.end));if(!ee)return;en=[];et=!this.args.skipEmptyPeriods?this.getPeriod(this.incrementPeriod(et.period)):this.getPeriod(ee);if(this.granularity==="month"&&this.weekStart){$=this.iterable._run({start:et.start,end:this.args.end});ee=$.next().value}ei++}}getPeriod($){let ee;let et;let en;if(this.granularity==="month"&&this.weekStart){ee=$.granularity("month").granularity("week",{weekStart:this.weekStart});et=$.endGranularity("month").endGranularity("week",{weekStart:this.weekStart});en=$.granularity("month")}else{ee=$.granularity(this.granularity,{weekStart:this.weekStart});et=$.endGranularity(this.granularity,{weekStart:this.weekStart});en=ee}return{start:ee,end:et,period:en}}incrementPeriod($){return $.add(1,this.granularity)}occurrenceIterator(){let $=this.args.start||this.iterable._run().next().value;if(!$)return this.iterable._run(this.args);$=this.getPeriod($).start;return this.iterable._run({start:$,end:this.args.end})}}class hS extends h_{constructor($,ee){super(ee);this.streams=$;this.config=ee;this.timezone=ee.timezone;this.streams=$.map($=>$ instanceof hS?$:$.set("timezone",this.timezone));this.isInfinite=this.calculateIsInfinite();this.hasDuration=this.calculateHasDuration()}normalizeDateInput($){if(!$)return;return ho($,this.timezone)}normalizeRunOutput($){return hs($,this.timezone)}}class hT{constructor($,ee){this.runArgs=ee;this.stream=$._run(this.runArgs);this.next()}next($){const{done:ee,value:et}=this.stream.next($);this.done=typeof ee==="boolean"?ee:true;this.value=et;return{done:ee,value:et}}}function hO($,ee={},et={}){if(!et.skipToDate||$.length===0)return;if(ee.reverse?$.every($=>$.value.isBeforeOrEqual(et.skipToDate)):$.every($=>$.value.isAfterOrEqual(et.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 en of $){if(en.done)continue;if(ee.reverse?en.value.isBeforeOrEqual(et.skipToDate):en.value.isAfterOrEqual(et.skipToDate)){continue}en.next(et)}}function hA($,ee){if($.done&&ee.done)return 0;if($.done)return 1;if(ee.done)return-1;if($.value.isAfter(ee.value))return 1;return-1}function hI($,ee){if($.done&&ee.done)return 0;if($.done)return-1;if(ee.done)return 1;if($.value.isAfter(ee.value))return-1;return 1}function hN($,ee={},et={}){hO($,ee,et);return $.sort(ee.reverse?hI:hA).filter($=>!$.done).shift()}function hD($,ee={},et={}){hO($,ee,et);return $.sort(ee.reverse?hI:hA).filter($=>!$.done).pop()}function hR(...$){return ee=>new hC($,ee)}class hC extends hS{set($,ee){return new hC(this.streams.map($=>$.set("timezone",ee)),Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",ee),timezone:ee}))}*_run($={}){const ee=this.streams.map(ee=>new hT(ee,$));if(this.config.base){ee.push(new hT(this.config.base,$))}if(ee.length===0)return;let et=hN(ee,$);while(et&&!et.done){const en=yield this.normalizeRunOutput(et.value);if(!(en&&en.skipToDate)){et.next()}et=hN(ee,$,en)}}calculateIsInfinite(){return this.config.base&&this.config.base.isInfinite||this.streams.some($=>$.isInfinite)}calculateHasDuration(){const $=this.streams.every($=>$.hasDuration);if(!this.config.base)return $;return this.config.base.hasDuration&&$}}class hk extends(null&&h_){constructor($={}){super($);this.schedules=[];this.data=$.data;if($.schedules){this.schedules=Array.isArray($.schedules)?$.schedules:[$.schedules];this.schedules=this.schedules.map($=>$.set("timezone",this.timezone))}this.isInfinite=this.schedules.some($=>$.isInfinite);this.hasDuration=this.schedules.every($=>$.hasDuration)}occurrences($={}){return new hv(this,this.normalizeOccurrencesArgs($))}collections($={}){return new hE(this,this.normalizeCollectionsArgs($))}set($,ee,et){if($==="timezone"){return new hk({schedules:this.schedules.map(en=>en.set($,ee,et)),data:this.data,timezone:ee,maxDuration:this.maxDuration})}else if($==="schedules"){return new hk({schedules:Array.isArray(ee)?ee:[ee],data:this.data,timezone:this.timezone,maxDuration:this.maxDuration})}throw new ArgumentError("Unknown value for `prop`: "+`"${$}"`)}*_run($={}){if(this.schedules.length===0)return;const ee=$.take;delete $.take;let et;if(this.schedules.length===1){et=this.schedules[0]._run($)}else{et=new hC(this.schedules,{timezone:this.timezone})._run($)}let en=et.next().value;let ei=0;while(en&&(ee===undefined||ee>ei)){en=en.add(this,"generator");const $=yield this.normalizeRunOutput(en);en=et.next($).value;ei++}return undefined}}class hM extends h_{constructor($={}){super($);this.adapters=[];this.isInfinite=false;this.maxDuration=0;this.datetimes=[];this.data=$.data;if($.dates){this.adapters=$.dates.map(ee=>{let et=this.normalizeDateInputToAdapter(ee);if($.duration&&!et.duration){et=et.set("duration",$.duration)}return et.set("timezone",this.timezone)});this.datetimes=this.adapters.map($=>$.toDateTime())}this.hasDuration=this.datetimes.every($=>!!$.duration);if(this.hasDuration){this.maxDuration=this.adapters.reduce(($,ee)=>ee.duration>$?ee.duration:$,0)}}get length(){return this.adapters.length}get firstDate(){return this.adapters[0]||null}get lastDate(){return this.adapters[this.length-1]||null}occurrences($={}){return new hv(this,this.normalizeOccurrencesArgs($))}collections($={}){return new hE(this,this.normalizeCollectionsArgs($))}add($){return new hM({dates:[...this.adapters,$],timezone:this.timezone,data:this.data})}remove($){const ee=this.adapters.slice();const et=this.normalizeDateInputToAdapter($);const en=ee.findIndex($=>$.valueOf()===et.valueOf());if(en>=0){ee.splice(en,1)}return new hM({dates:ee,timezone:this.timezone,data:this.data})}set($,ee,et={}){let en=this.timezone;let ei=this.adapters.slice();if($==="timezone"){if(ee===this.timezone)return this;else if(et.keepLocalTime){ei=this.adapters.map($=>{const et=$.toJSON();et.timezone=ee;return this.dateAdapter.fromJSON(et)})}en=ee}else if($==="dates"){ei=ee}else if($==="duration"){ei=ei.map($=>$.set("duration",ee||0))}else{throw new p9(`Unexpected prop argument "${$}". Accepted values are "timezone" or "dates"`)}return new hM({dates:ei,data:this.data,timezone:en})}filter($){return new hM({dates:this.adapters.filter($),data:this.data,timezone:this.timezone})}*_run($={}){let ee=this.datetimes.sort(pk);if($.start){ee=ee.filter(ee=>ee.isAfterOrEqual($.start))}if($.end){ee=ee.filter(ee=>ee.isBeforeOrEqual($.end))}if($.reverse){ee=ee.slice().reverse()}if($.take){ee=ee.slice(0,$.take)}const et=ee.slice();let en=et.shift();let ei;while(en){if(ei&&ei.skipToDate&&($.reverse?ei.skipToDate.isBefore(en):ei.skipToDate.isAfter(en))){en=et.shift();continue}en=en.add(this,"generator");ei=yield this.normalizeRunOutput(en);if(ei&&ei.skipToDate&&($.reverse?ei.skipToDate.isAfterOrEqual(en):ei.skipToDate.isBeforeOrEqual(en))){throw new Error("A provided `skipToDate` option must be greater than the last yielded date "+"(or smaller, in the case of reverse iteration)")}en=et.shift()}return undefined}}class hL extends Error{}let hx;class hP{constructor($,ee){this.metadata={};this.duration=ee&&ee.duration||0;this.generators=ee&&ee.generators&&ee.generators.slice()||[];if(!Number.isInteger(this.duration)||this.duration<0){throw new hL("duration must be a non-negative integer")}}static set adapter($){if(hx){throw new Error(`"${hx.name}" has already been configured.`)}hx=$}static get adapter(){if(!hx){throw new Error("No date adapter has been configured. See rSchedule docs.")}return hx}static isDate($){throw hF("isDate()")}static fromDate($,ee){throw hF("fromDate()")}static fromJSON($){throw hF("fromJSON()")}static fromDateTime($){throw hF("fromDateTime()")}toISOString(){return this.set("timezone","UTC").toDateTime().toISOString()}toDateTime(){const $=hj.fromJSON(Object.assign(Object.assign({},this.toJSON()),{generators:this.generators,metadata:this.metadata}));return $}}hP.hasTimezoneSupport=false;function hF($){return new Error(`You must implement the "${$}" method for this DateAdapter class`)}var hB;(function($){$.WEEKDAYS=["SU","MO","TU","WE","TH","FR","SA"];$.MILLISECONDS_IN_SECOND=1e3;$.MILLISECONDS_IN_MINUTE=$.MILLISECONDS_IN_SECOND*60;$.MILLISECONDS_IN_HOUR=$.MILLISECONDS_IN_MINUTE*60;$.MILLISECONDS_IN_DAY=$.MILLISECONDS_IN_HOUR*24;$.MILLISECONDS_IN_WEEK=$.MILLISECONDS_IN_DAY*7})(hB||(hB={}));class hU extends Error{}class hj{constructor($,ee,et,en,ei={}){this.metadata={};this.date=new Date($);this.timezone=ee||null;this.duration=et||0;this.generators=en&&en.slice()||[];if(!Number.isInteger(this.duration)||this.duration<0){throw new hU("duration must be a non-negative integer")}if(ei.metadata){Object.assign(this.metadata,ei.metadata)}this.assertIsValid()}static fromJSON($){const ee=new Date(Date.UTC($.year,$.month-1,$.day,$.hour,$.minute,$.second,$.millisecond));return new hj(ee,$.timezone,$.duration,$.generators,{metadata:$.metadata})}static fromDateAdapter($){return hj.fromJSON(Object.assign(Object.assign({},$.toJSON()),{generators:$.generators,metadata:$.metadata}))}get end(){if(!this.duration)return;if(this._end)return this._end;this._end=this.add(this.duration,"millisecond");return this._end}isEqual($){if(!$){return false}hW(this,$);return this.valueOf()===$.valueOf()}isBefore($){hW(this,$);return this.valueOf()<$.valueOf()}isBeforeOrEqual($){hW(this,$);return this.valueOf()<=$.valueOf()}isAfter($){hW(this,$);return this.valueOf()>$.valueOf()}isAfterOrEqual($){hW(this,$);return this.valueOf()>=$.valueOf()}isOccurring($){if(!this.duration){throw new Error("DateTime#isOccurring() is only applicable to DateTimes with durations")}hW(this,$);return $.isAfterOrEqual(this)&&$.isBeforeOrEqual(this.add(this.duration,"millisecond"))}add($,ee){switch(ee){case"generator":{const ee=this.generators.slice();ee.unshift($);return new hj(this.date,this.timezone,this.duration,ee)}case"year":return this.forkDateTime(hX(this.date,$));case"month":return this.forkDateTime(hQ(this.date,$));case"week":return this.forkDateTime(h0(this.date,$));case"day":return this.forkDateTime(h2(this.date,$));case"hour":return this.forkDateTime(h6(this.date,$));case"minute":return this.forkDateTime(h4(this.date,$));case"second":return this.forkDateTime(h3(this.date,$));case"millisecond":return this.forkDateTime(h8(this.date,$));default:throw new Error("Invalid unit provided to `DateTime#add`")}}subtract($,ee){switch(ee){case"year":return this.forkDateTime(h5(this.date,$));case"month":return this.forkDateTime(h9(this.date,$));case"week":return this.forkDateTime(h7(this.date,$));case"day":return this.forkDateTime(ye(this.date,$));case"hour":return this.forkDateTime(yt(this.date,$));case"minute":return this.forkDateTime(yr(this.date,$));case"second":return this.forkDateTime(yn(this.date,$));case"millisecond":return this.forkDateTime(yi(this.date,$));default:throw new Error("Invalid unit provided to `DateTime#subtract`")}}get($){switch($){case"year":return this.date.getUTCFullYear();case"month":return this.date.getUTCMonth()+1;case"yearday":return hK(this.date);case"weekday":return hB.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($,ee){if($==="duration"){return new hj(this.date,this.timezone,ee,this.generators)}if($==="generators"){return new hj(this.date,this.timezone,this.duration,ee)}let et=new Date(this.date);switch($){case"year":et.setUTCFullYear(ee);break;case"month":{const $=hq(ee,et.getUTCFullYear());const en=et.getUTCDate();if(en>$){et.setUTCDate(1);et.setUTCMonth(ee);et=ye(et,1)}else{et.setUTCMonth(ee-1)}break}case"day":et.setUTCDate(ee);break;case"hour":et.setUTCHours(ee);break;case"minute":et.setUTCMinutes(ee);break;case"second":et.setUTCSeconds(ee);break;case"millisecond":et.setUTCMilliseconds(ee);break;default:throw new Error("Invalid unit provided to `DateTime#set`")}return this.forkDateTime(et)}granularity($,ee={}){let et=this.forkDateTime(this.date);switch($){case"year":et=et.set("month",1);case"month":et=et.set("day",1);break;case"week":et=hH(et,ee.weekStart)}switch($){case"year":case"month":case"week":case"day":et=et.set("hour",0);case"hour":et=et.set("minute",0);case"minute":et=et.set("second",0);case"second":et=et.set("millisecond",0);case"millisecond":return et;default:throw new Error("Invalid granularity provided to `DateTime#granularity`: "+$)}}endGranularity($,ee={}){let et=this.forkDateTime(this.date);switch($){case"year":et=et.set("month",12);case"month":et=et.set("day",hq(et.get("month"),et.get("year")));break;case"week":et=hz(et,ee.weekStart)}switch($){case"year":case"month":case"week":case"day":et=et.set("hour",23);case"hour":et=et.set("minute",59);case"minute":et=et.set("second",59);case"second":et=et.set("millisecond",999);case"millisecond":return et;default:throw new Error("Invalid granularity provided to `DateTime#granularity`: "+$)}}toISOString(){return this.date.toISOString()}toDateTime(){return this}toJSON(){const $={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")};if(this.duration){$.duration=this.duration}return $}valueOf(){return this.date.valueOf()}assertIsValid(){if(isNaN(this.valueOf())){throw new hU("DateTime has invalid date.")}return true}forkDateTime($){return new hj($,this.timezone,this.duration,this.generators)}}function hW($,ee){if($.timezone!==ee.timezone){throw new hU("Attempted to compare a datetime to another date in a different timezone: "+JSON.stringify($)+" and "+JSON.stringify(ee))}return true}function hH($,ee){const et=hV(ee).indexOf($.get("weekday"));return $.subtract(et,"day")}function hz($,ee){const et=hV(ee).indexOf($.get("weekday"));return $.add(6-et,"day")}function hV($="SU"){const ee=hB.WEEKDAYS.slice();let et=ee.indexOf($);while(et!==0){h$(ee);et--}return ee}function h$($,ee="first"){if($.length===0){return $}else if(ee==="first"){$.push($.shift())}else{$.unshift($.pop())}return $}function hq($,ee){const et={1:31,2:hG(ee),3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31};return et[$]}function hG($){return hY($)?29:28}function hY($){return $%400===0||$%4===0&&$%100!==0}function hK($){const ee=new Date(Date.UTC($.getUTCFullYear(),0,1));const et=$.valueOf()-ee.valueOf();return 1+Math.floor(et/hB.MILLISECONDS_IN_DAY)}function hZ($){if($===null||$===true||$===false){return NaN}const ee=Number($);if(isNaN(ee)){return ee}return ee<0?Math.ceil(ee):Math.floor(ee)}function hJ($,ee){if(arguments.length<2){throw new TypeError("2 arguments required, but only "+arguments.length+" present")}const et=$.valueOf();const en=hZ(ee);return new Date(et+en)}function hX($,ee){const et=hZ(ee);return hQ($,et*12)}function hQ($,ee){const et=hZ(ee);$=new Date($);const en=$.getUTCMonth()+et;const ei=new Date(0);ei.setUTCFullYear($.getUTCFullYear(),en,1);ei.setUTCHours(0,0,0,0);const eo=hq(ei.getUTCMonth()+1,ei.getUTCFullYear());$.setUTCMonth(en,Math.min(eo,$.getUTCDate()));return $}function h0($,ee){const et=hZ(ee);const en=et*7;return h2($,en)}function h2($,ee){return h8($,hZ(ee)*hB.MILLISECONDS_IN_DAY)}function h6($,ee){const et=hZ(ee);return hJ($,et*hB.MILLISECONDS_IN_HOUR)}function h4($,ee){const et=hZ(ee);return hJ($,et*hB.MILLISECONDS_IN_MINUTE)}function h3($,ee){const et=hZ(ee);return hJ($,et*hB.MILLISECONDS_IN_SECOND)}function h8($,ee){const et=hZ(ee);const en=$.getTime();return new Date(en+et)}function h5($,ee){return hX($,-ee)}function h9($,ee){return hQ($,-ee)}function h7($,ee){return h0($,-ee)}function ye($,ee){return h2($,-ee)}function yt($,ee){return h6($,-ee)}function yr($,ee){return h4($,-ee)}function yn($,ee){return h3($,-ee)}function yi($,ee){return h8($,-ee)}function yo($,ee){if($.timezone!==ee){return hP.adapter.fromDateTime($).set("timezone",ee).toDateTime()}return $}class yu extends h_{constructor($,ee,et={}){super(et);this.recurrenceRules=$;this.options=hd(ee);this.normOptions=hf(this.recurrenceRules,this.options);this.timezone=et.timezone!==undefined?et.timezone:this.normOptions.start.timezone;this.data=et.data;this.hasDuration=!!ee.duration;if(this.hasDuration)this.duration=ee.duration;this.isInfinite=this.normOptions.end===undefined&&this.normOptions.count===undefined}occurrences($={}){return new hv(this,this.normalizeOccurrencesArgs($))}collections($={}){return new hE(this,this.normalizeCollectionsArgs($))}*_run($={}){const ee=this.normalizeRunArgs($);const et=new hm(hg(this.recurrenceRules),this.normOptions,ee);let en=et.next().value;let ei=0;while(en&&(ee.take===undefined||ei<ee.take)){ei++;en=en.add(this,"generator");const $=yield this.normalizeRunOutput(en);if($===null||$===void 0?void 0:$.skipToDate){en=et.next(Object.assign(Object.assign({},$),{skipToDate:yo($.skipToDate,et.start.timezone)})).value}else{en=et.next($).value}}return undefined}}class yl extends yu{constructor($,ee={}){super(yl.recurrenceRules,$,ee)}set($,ee,et={}){let en=hd(this.options);let ei=this.timezone;if($==="timezone"){if(ee===this.timezone&&!et.keepLocalTime)return this;else if(et.keepLocalTime){const $=this.normalizeDateInput(en.start).toJSON();$.timezone=ee;const et=this.dateAdapter.fromJSON($);en.start=en.start instanceof this.dateAdapter?et:en.start instanceof pN?et.toDateTime():et.date}ei=ee}else if($==="options"){en=ee}else{en[$]=ee}return new yl(en,{data:this.data,maxDuration:this.maxDuration,timezone:ei})}}yl.recurrenceRules=[];class yc extends h_{constructor($){super($);this.data=$.data}occurrences($={}){return new hv(this,this.normalizeOccurrencesArgs($))}collections($={}){return new hE(this,this.normalizeCollectionsArgs($))}*_run($={}){const ee=$.take;delete $.take;const et=this.occurrenceStream._run($);let en=et.next().value;let ei=0;while(en&&(ee===undefined||ee>ei)){en=en.add(this,"generator");const $=yield this.normalizeRunOutput(en);en=et.next($).value;ei++}return undefined}}function yf(...$){return ee=>new yd($,ee)}class yd extends hS{set($,ee){return new yd(this.streams.map($=>$.set("timezone",ee)),Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",ee),timezone:ee}))}*_run($={}){if(!this.config.base)return;const ee=new hT(this.config.base,$);const et=new hT(new hC(this.streams,{timezone:this.config.timezone}),$);yp(ee,et,$);while(!ee.done){const en=yield this.normalizeRunOutput(ee.value);if(!(en&&en.skipToDate)){ee.next()}yp(ee,et,$,en)}}calculateIsInfinite(){return!!(this.config.base&&this.config.base.isInfinite)}calculateHasDuration(){return!!(this.config.base&&this.config.base.hasDuration)}}function yp($,ee,et={},en={}){hO([$,ee],et,en);yh($,ee,et);while(!$.done&&!ee.done&&$.value.isEqual(ee.value)){$.next();yh($,ee,et)}}function yh($,ee,et={}){if(et.reverse){while(!ee.done&&!$.done&&ee.value.isAfter($.value)){ee.next()}return}while(!ee.done&&!$.done&&ee.value.isBefore($.value)){ee.next()}}function yy(){return $=>new yg([],$)}class yg extends hS{set($,ee){return new yg([],Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",ee),timezone:ee}))}*_run($={}){if(!this.config.base)return;const ee=new hT(this.config.base,$);while(!ee.done){const $=yield this.normalizeRunOutput(ee.value);const et=ee.value;ee.next($);while(!($&&$.skipToDate)&&!ee.done&&ee.value.isEqual(et)){ee.next()}}}calculateIsInfinite(){return!!(this.config.base&&this.config.base.isInfinite)}calculateHasDuration(){return!!(this.config.base&&this.config.base.hasDuration)}}class ym extends yc{constructor($={}){super($);this.rrules=[];this.exrules=[];for(const ee of["rrules","exrules"]){const et=$[ee];if(et){this[ee]=et.map($=>{if($ instanceof yl){return $.set("timezone",this.timezone)}else{return new yl($,{timezone:this.timezone})}})}}for(const ee of["rdates","exdates"]){const et=$[ee];if(et){this[ee]=et instanceof hM?et.set("timezone",this.timezone):new hM({dates:et,timezone:this.timezone})}else{this[ee]=new hM({timezone:this.timezone})}}this.hasDuration=this.rrules.every($=>$.hasDuration)&&this.exrules.every($=>$.hasDuration)&&this.rdates.hasDuration&&this.exdates.hasDuration;this.isInfinite=this.rrules.some($=>$.isInfinite);this.occurrenceStream=[hR(...this.rrules),yf(...this.exrules),hR(this.rdates),yf(this.exdates),yy()].reduce(($,ee)=>ee({base:$,timezone:this.timezone}),undefined)}add($,ee){const et=this.rrules.slice();const en=this.exrules.slice();let ei=this.rdates;let eo=this.exdates;switch($){case"rrule":et.push(ee);break;case"exrule":en.push(ee);break;case"rdate":ei=this.rdates.add(ee);break;case"exdate":eo=this.exdates.add(ee);break}return new ym({timezone:this.timezone,data:this.data,rrules:et,exrules:en,rdates:ei,exdates:eo})}remove($,ee){let et=this.rrules;let en=this.exrules;let ei=this.rdates;let eo=this.exdates;switch($){case"rrule":et=et.filter($=>$!==ee);break;case"exrule":en=en.filter($=>$!==ee);break;case"rdate":ei=this.rdates.remove(ee);break;case"exdate":eo=this.exdates.remove(ee);break}return new ym({timezone:this.timezone,data:this.data,rrules:et,exrules:en,rdates:ei,exdates:eo})}set($,ee,et={}){let en=this.timezone;let ei=this.rrules;let eo=this.exrules;let es=this.rdates;let eu=this.exdates;switch($){case"timezone":if(ee===this.timezone&&!et.keepLocalTime)return this;else if(et.keepLocalTime){ei=ei.map($=>$.set("timezone",ee,et));eo=eo.map($=>$.set("timezone",ee,et));es=es.set("timezone",ee,et);eu=eu.set("timezone",ee,et)}en=ee;break;case"rrules":ei=ee;break;case"exrules":eo=ee;break;case"rdates":es=ee;break;case"exdates":eu=ee;break}return new ym({timezone:en,data:this.data,rrules:ei,exrules:eo,rdates:es,exdates:eu})}}function y_($){return ee=>new yv($,ee)}class yv extends(null&&hS){constructor($,ee){super($.streams,ee);if(this.isInfinite){this.maxFailedIterations=$.maxFailedIterations||yv.defaultMaxFailedIterations;if(!this.maxFailedIterations){throw new ArgumentError("The IntersectionOperator must be provided "+"a `maxFailedIterations` argument when it is built from schedules of infinite length. "+"This argument is used to ensure that the IntersectionOperator does not enter "+"an infinite loop because the underlying schedules never intersect. "+"If the `maxFailedIterations` count is reached it will be assumed that "+"all valid occurrences have been found and iteration will end without error."+'Without additional information, "50" is probably a good '+"`maxFailedIterations` value. "+"If the schedules are not of infinite length, `maxFailedIterations` is ignored. "+"Note also that you can provide a `defaultMaxFailedIterations` number via "+"IntersectionOperator.defaultMaxFailedIterations.")}}}set($,ee){return new yv({maxFailedIterations:this.maxFailedIterations,streams:this.streams.map($=>$.set("timezone",ee))},Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",ee),timezone:ee}))}*_run($={}){const ee=this.streams.map(ee=>new hT(ee,$));if(this.config.base){ee.push(new hT(this.config.base,$))}if(ee.length===0)return;const et=!!(!this.isInfinite||$.reverse||$.end);if(!yw(ee,undefined,Object.assign(Object.assign({},$),{hasEndDate:et,iteration:0,maxIterations:this.maxFailedIterations}))){return}let en=hN(ee,$);while(en){const ei=yield this.normalizeRunOutput(en.value);const eo=en.value;if(!(ei===null||ei===void 0?void 0:ei.skipToDate)){en.next()}if(!yw(ee,eo,Object.assign(Object.assign({},$),{hasEndDate:et,iteration:0,maxIterations:this.maxFailedIterations}),ei)){return}en=hN(ee,$)}}calculateIsInfinite(){if(!this.config.base){if(this.streams.length===0)return false;return this.streams.every($=>$.isInfinite)}else if(this.streams.length===0)return this.config.base.isInfinite;return this.config.base.isInfinite&&this.streams.every($=>$.isInfinite)}calculateHasDuration(){const $=this.streams.every($=>$.hasDuration);if(!this.config.base)return $;return this.config.base.hasDuration&&$}}function yw($,ee,et,en){const ei=hN($,et,en);if(!ei)return false;if(ee&&ei.value.isEqual(ee))return true;if($.some($=>$.done))return false;if($.every($=>$.value.isEqual(ei.value)))return true;et.iteration++;if(et.maxIterations&&!et.hasEndDate&&et.iteration>et.maxIterations){return false}const eo=hD($,et);$.forEach($=>{if(eo.value.isEqual($.value))return;$.next({skipToDate:eo.value})});return yw($,ee,et)}class yE extends(null&&hT){constructor($,ee){super($,ee);this.workingValue=this.value;this.next()}}class yS extends(null&&Error){}function yT($){return ee=>new yO($,ee)}class yO extends(null&&hS){constructor($,ee){super([],ee);this.maxDuration=$.maxDuration;if(ee.base&&!ee.base.hasDuration){throw new ArgumentError("Base stream provided to MergeDurationOperator does not have an associated duration. "+"The MergeDurationOperator can only be used with streams which have a duration. ")}}set($,ee){return new yO({maxDuration:this.maxDuration},Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",ee),timezone:ee}))}_run($={}){return $.reverse?this.reverseRun($):this.forwardRun($)}calculateIsInfinite(){return!!(this.config.base&&this.config.base.isInfinite)}calculateHasDuration(){return true}*forwardRun($={}){if(!this.config.base)return;let ee=$.start;if($.start){ee=$.start.subtract(this.maxDuration,"millisecond")}let et=$.end;if($.end){et=$.end.add(this.maxDuration,"millisecond")}const en=new yE(this.config.base,Object.assign(Object.assign({},$),{start:ee,end:et}));let ei;while(en.workingValue){while(!en.done&&en.workingValue.end.isAfterOrEqual(en.value)){if(en.workingValue.duration>this.maxDuration){throw new yS(`MergeDurationOperatorError: Occurrence duration exceeded maxDuration of `+this.maxDuration)}if(en.value.end.isAfter(en.workingValue.end)){const $=en.value.end.valueOf()-en.workingValue.end.valueOf();en.workingValue=en.workingValue.set("duration",en.workingValue.duration+$)}en.next()}if($.start&&en.workingValue.end.isBefore($.start)){en.workingValue=en.value;en.next();continue}if((ei===null||ei===void 0?void 0:ei.skipToDate)&&en.workingValue.end.isBefore(ei.skipToDate)){en.workingValue=en.value;en.next();continue}if($.end&&en.workingValue&&en.workingValue.isAfter($.end)){break}if(en.workingValue.duration>this.maxDuration){throw new yS(`MergeDurationOperatorError: Occurrence duration exceeded maxDuration of `+this.maxDuration)}ei=yield this.normalizeRunOutput(en.workingValue);if((ei===null||ei===void 0?void 0:ei.skipToDate)&&en.workingValue.isAfterOrEqual(ei.skipToDate)){throw new Error("A provided `skipToDate` option must be greater than the last yielded date "+"(or smaller, in the case of reverse iteration)")}en.workingValue=en.value;en.next()}}*reverseRun($={}){if(!this.config.base)return;let ee=$.start;if($.start){ee=$.start.subtract(this.maxDuration,"millisecond")}let et=$.end;if($.end){et=$.end.add(this.maxDuration,"millisecond")}const en=new yE(this.config.base,Object.assign(Object.assign({},$),{start:ee,end:et}));let ei;while(en.workingValue){while(!en.done&&en.workingValue.isBeforeOrEqual(en.value.end)){if(en.workingValue.duration>this.maxDuration){throw new yS(`MergeDurationOperatorError: Occurrence duration exceeded maxDuration of `+this.maxDuration)}if(en.value.isBefore(en.workingValue)||en.value.end.isAfter(en.workingValue.end)){if(en.value.end.isAfter(en.workingValue.end)){en.workingValue=en.value}else{const $=en.workingValue.valueOf()-en.value.valueOf();en.workingValue=en.value.set("duration",en.workingValue.duration+$)}}en.next()}if($.start&&en.workingValue.end.isBefore($.start)){break}if(ei&&ei.skipToDate&&en.workingValue.end.isBefore(ei.skipToDate)){en.workingValue=en.value;en.next();continue}if($.end&&en.workingValue&&en.workingValue.isAfter($.end)){en.workingValue=en.value;en.next();continue}if(en.workingValue.duration>this.maxDuration){throw new yS(`MergeDurationOperatorError: Occurrence duration exceeded maxDuration of `+this.maxDuration)}ei=yield this.normalizeRunOutput(en.workingValue);if(ei&&ei.skipToDate&&en.workingValue.end.isBeforeOrEqual(ei.skipToDate)){throw new Error("A provided `skipToDate` option must be greater than the last yielded date "+"(or smaller, in the case of reverse iteration)")}en.workingValue=en.value;en.next()}}}class yA extends(null&&Error){}function yI($){return ee=>new yN($,ee)}class yN extends(null&&hS){constructor($,ee){super([],ee);this.splitFn=$.splitFn;this.maxDuration=$.maxDuration;if(ee.base&&!ee.base.hasDuration){throw new ArgumentError("Base stream provided to SplitDurationOperator does not have an associated duration. "+"The SplitDurationOperator can only be used with streams which have a duration.")}}set($,ee){return new yN({maxDuration:this.maxDuration,splitFn:this.splitFn},Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",ee),timezone:ee}))}*_run($={}){if(!this.config.base)return;const ee=$.reverse||false;let et=$.start;if($.start){et=$.start.subtract(this.maxDuration,"millisecond")}let en=$.end;if($.end){en=$.end.add(this.maxDuration,"millisecond")}const ei=new hT(this.config.base,Object.assign(Object.assign({},$),{start:et,end:en}));let eo;const es=[];while(!ei.done||es[0]&&es[0][0]){if(!(es[0]&&es[0][0])){es.push(this.splitDate(ei.value,ee));ei.next()}while(!ei.done&&(ee?es[0].some($=>$.isBeforeOrEqual(ei.value.end)):es[0].some($=>$.isAfterOrEqual(ei.value)))){es.push(this.splitDate(ei.value,ee));ei.next()}let et=es[0]&&es[0][0];let en=-1;let eu=0;let el=-1;let ef=0;for(const $ of es){en++;el=-1;for(const ei of $){el++;let $;if(ee){$=ei.isAfter(et)||ei.isEqual(et)&&ei.duration>et.duration}else{$=ei.isBefore(et)||ei.isEqual(et)&&ei.duration<et.duration}if($){et=ei;eu=en;ef=el;break}}}es[eu].splice(ef,1);if(es[eu].length===0){es.splice(eu,1)}if(eo&&eo.skipToDate&&et&&!yD(et,$)&&!yR(et,eo.skipToDate,$)){continue}if($.start&&et.end.isBefore($.start)){if(ee)break;continue}if($.end&&et.isAfter($.end)){if(ee)continue;break}if(et.duration>this.maxDuration){throw new yA(`SplitDurationOperatorError: Occurrence duration exceeded maxDuration of `+this.maxDuration)}eo=yield this.normalizeRunOutput(et);if(eo&&eo.skipToDate&&($.reverse?et.isBeforeOrEqual(eo.skipToDate):et.isAfterOrEqual(eo.skipToDate))){throw new Error("A provided `skipToDate` option must be greater than the last yielded date "+"(or smaller, in the case of reverse iteration)")}}}calculateIsInfinite(){return!!(this.config.base&&this.config.base.isInfinite)}calculateHasDuration(){return true}splitDate($,ee){const et=this.splitFn($);let en;if(et.length===0){en=false}else if(et.length===1){en=$.duration===et[0].duration}else{en=$.duration===et.reduce(($,ee)=>$+ee.duration,0)}if(!en){throw new Error("The provided SplitDurationOperator split function "+"must return an array of DateTimes with length > 0 "+"where the total duration of the new dates equals the duration of "+"the original date.")}et.sort(dateTimeSortComparer);if(ee){et.reverse()}return et}}function yD($,ee){return!!(ee.reverse?ee.start&&$.isBefore(ee.start):ee.end&&$.isAfter(ee.end))}function yR($,ee,et){return!!(et.reverse?ee.isAfterOrEqual($):ee.isBeforeOrEqual($))};class yC{constructor($){this.processor=$;this.start=$.start;this.end=$.end;this.options=$.options}}class yk extends yC{constructor($,ee){super($);this.initDate=ee;this.intervalUnit=ht(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($){return this.validateDate(new hh($))}validateDate($){const{date:ee}=$;if($ instanceof hh&&this.dateIsWithinInterval(ee)){return $}this.skipToInterval(ee);return new hy(this.dateIsWithinInterval(ee)?ee:this.setToCurrentInterval())}setToCurrentInterval(){return this.intervalStartDate}normalizedStartDate($){if(this.options.frequency==="WEEKLY"){return $.granularity("week",{weekStart:this.options.weekStart})}return $.granularity(this.intervalUnit)}normalizedEndDate($){switch(this.options.frequency){case"YEARLY":return $.add(1,"year");case"MONTHLY":return $.add(1,"month");case"WEEKLY":return $.add(1,"week");case"DAILY":return $.add(1,"day");case"HOURLY":return $.add(1,"hour");case"MINUTELY":return $.add(1,"minute");case"SECONDLY":return $.add(1,"second");case"MILLISECONDLY":return $.add(1,"millisecond");default:throw new Error(`Unknown frequency ${this.options.frequency}`)}}skipToInterval($){const ee=this.intervalDifference($);this.intervalStartDate=this.firstIntervalStartDate.add(ee,this.intervalUnit);this.intervalEndDate=this.normalizedEndDate(this.intervalStartDate)}dateIsWithinInterval($){return this.intervalStartDate.isBeforeOrEqual($)&&this.intervalEndDate.isAfter($)}intervalDifference($){return yM({first:this.firstIntervalStartDate,second:$,unit:this.intervalUnit,interval:this.options.interval,weekStart:this.options.weekStart,direction:"after"})}}function yM({first:$,second:ee,unit:et,interval:en,weekStart:ei,direction:eo}){let es=(()=>{let en;let eo;switch(et){case"year":eo=(ee.get("year")-$.get("year"))*12;eo=eo+ee.get("month")-$.get("month");return Math.floor(eo/12);case"month":eo=(ee.get("year")-$.get("year"))*12;eo=eo+ee.get("month")-$.get("month");return eo;case"week":$=$.granularity("week",{weekStart:ei});en=pA.MILLISECONDS_IN_WEEK;break;case"day":en=pA.MILLISECONDS_IN_DAY;break;case"hour":en=pA.MILLISECONDS_IN_HOUR;break;case"minute":en=pA.MILLISECONDS_IN_MINUTE;break;case"second":en=pA.MILLISECONDS_IN_SECOND;break;case"millisecond":en=1;break;default:throw new Error("Unexpected `unit` value")}const es=ee.valueOf()-$.valueOf();return Math.floor(es/en)})();const eu=eo==="after"?Math.ceil:Math.floor;es=eu(es/en)*en;return es}class yL extends yk{setToCurrentInterval(){return this.intervalEndDate.subtract(1,"millisecond")}intervalDifference($){return yM({first:this.firstIntervalStartDate,second:$,unit:this.intervalUnit,interval:this.options.interval,weekStart:this.options.weekStart,direction:"before"})}}const yx=["MILLISECONDLY","SECONDLY","MINUTELY","HOURLY","DAILY","WEEKLY","MONTHLY","YEARLY"];const yP={name:"FrequencyRule",get:$=>{if($.options.byMillisecondOfSecond!==undefined||$.options.frequency!=="MILLISECONDLY"){return null}if($.reverse)return new yL($,$.end);return new yk($,$.start)},normalizeOptions:($,ee)=>{if(!yx.includes($.frequency)){throw new hu(`"frequency" must be one of ${JSON.stringify(yx)}`)}if($.interval!==undefined){if(!Number.isInteger($.interval)){throw new hu('"interval" expects a whole number')}if($.interval<1){throw new hu('"interval" cannot be less than 1')}}if($.weekStart!==undefined){if(!pA.WEEKDAYS.includes($.weekStart)){throw new hu(`"weekStart" must be one of ${JSON.stringify(pA.WEEKDAYS)}`)}}ee.frequency=$.frequency;ee.interval=$.interval||1;ee.weekStart=$.weekStart||"MO"},deps:()=>[yP]};function yF($){return Array.isArray($)&&$.length>0}const yB=new WeakMap;class yU extends yC{constructor($){super($);if(!yB.has(this.processor)){yB.set(this.processor,new yk($,$.start))}this.frequency=yB.get(this.processor)}validateDate($){return this.frequency.validateDate($)}}class yj extends yC{constructor($){super($);if(!yB.has(this.processor)){yB.set(this.processor,new yL($,$.end))}this.frequency=yB.get(this.processor)}validateDate($){return this.frequency.validateDate($)}}class yW extends yj{run($){const ee=$.get(this.granularity);for(const et of this.option){if(ee<et)continue;if(ee===et){return this.validateDate(new hh($))}return this.validateDate(new hy($.endGranularity(this.baseGranularity).set(this.granularity,et)))}return this.validateDate(new hy($.endGranularity(this.baseGranularity).subtract(1,this.baseGranularity).set(this.granularity,this.option[0])))}}class yH extends yW{constructor(){super(...arguments);this.baseGranularity="second";this.granularity="millisecond";this.option=this.options.byMillisecondOfSecond.slice().reverse()}}class yz extends yU{run($){const ee=$.get(this.granularity);for(const et of this.option){if(ee>et)continue;if(ee===et){return this.validateDate(new hh($))}return this.validateDate(new hy($.granularity(this.baseGranularity).set(this.granularity,et)))}return this.validateDate(new hy($.granularity(this.baseGranularity).add(1,this.baseGranularity).set(this.granularity,this.option[0])))}}class yV extends yz{constructor(){super(...arguments);this.baseGranularity="second";this.granularity="millisecond";this.option=this.options.byMillisecondOfSecond}}const y$={name:"ByMillisecondOfSecond",get:$=>{if($.options.byMillisecondOfSecond===undefined)return null;if($.reverse)return new yH($);return new yV($)},normalizeOptions:($,ee)=>{if($.byMillisecondOfSecond!==undefined){if(!yF($.byMillisecondOfSecond)){throw new hu('"byMillisecondOfSecond" expects a non-empty array')}if($.byMillisecondOfSecond.some($=>$<0||$>999)){throw new hu('"byMillisecondOfSecond" values must be >= 0 && <= 999')}ee.byMillisecondOfSecond=$.byMillisecondOfSecond;ee.byMillisecondOfSecond.sort(he)}else if($.frequency!=="MILLISECONDLY"){ee.byMillisecondOfSecond=[ee.start.get("millisecond")]}},deps:()=>[yP,y$]};class yq extends yW{constructor(){super(...arguments);this.baseGranularity="minute";this.granularity="second";this.option=this.options.bySecondOfMinute.slice().reverse()}}class yG extends yz{constructor(){super(...arguments);this.baseGranularity="minute";this.granularity="second";this.option=this.options.bySecondOfMinute}}const yY={name:"BySecondOfMinute",get:$=>{if($.options.bySecondOfMinute===undefined)return null;if($.reverse)return new yq($);return new yG($)},normalizeOptions:($,ee)=>{if($.bySecondOfMinute!==undefined){if(!yF($.bySecondOfMinute)){throw new hu('"bySecondOfMinute" expects a non-empty array')}if($.bySecondOfMinute.some($=>$<0||$>60)){throw new hu('"bySecondOfMinute" values must be >= 0 && <= 60')}ee.bySecondOfMinute=$.bySecondOfMinute;ee.bySecondOfMinute.sort(he)}else if(!["SECONDLY","MILLISECONDLY"].includes($.frequency)){ee.bySecondOfMinute=[ee.start.get("second")]}},deps:()=>[yP,yY,y$]};class yK extends yW{constructor(){super(...arguments);this.baseGranularity="hour";this.granularity="minute";this.option=this.options.byMinuteOfHour.slice().reverse()}}class yZ extends yz{constructor(){super(...arguments);this.baseGranularity="hour";this.granularity="minute";this.option=this.options.byMinuteOfHour}}const yJ={name:"ByMinuteOfHour",get:$=>{if($.options.byMinuteOfHour===undefined)return null;if($.reverse)return new yK($);return new yZ($)},normalizeOptions:($,ee)=>{if($.byMinuteOfHour!==undefined){if(!yF($.byMinuteOfHour)){throw new hu('"byMinuteOfHour" expects a non-empty array')}if($.byMinuteOfHour.some($=>$<0||$>59)){throw new hu('"byMinuteOfHour" values must be >= 0 && <= 59')}ee.byMinuteOfHour=$.byMinuteOfHour;ee.byMinuteOfHour.sort(he)}else if(!["MINUTELY","SECONDLY","MILLISECONDLY"].includes($.frequency)){ee.byMinuteOfHour=[ee.start.get("minute")]}},deps:()=>[yP,yJ,yY,y$]};class yX extends yW{constructor(){super(...arguments);this.baseGranularity="day";this.granularity="hour";this.option=this.options.byHourOfDay.slice().reverse()}}class yQ extends yz{constructor(){super(...arguments);this.baseGranularity="day";this.granularity="hour";this.option=this.options.byHourOfDay}}const y0={name:"ByHourOfDay",get:$=>{if($.options.byHourOfDay===undefined)return null;if($.reverse)return new yX($);return new yQ($)},normalizeOptions:($,ee)=>{if($.byHourOfDay!==undefined){if(!yF($.byHourOfDay)){throw new hu('"byHourOfDay" expects a non-empty array')}if($.byHourOfDay.some($=>$<0||$>23)){throw new hu('"byHourOfDay" values must be >= 0 && <= 23')}ee.byHourOfDay=$.byHourOfDay;ee.byHourOfDay.sort(he)}else if(["YEARLY","MONTHLY","WEEKLY","DAILY"].includes($.frequency)){ee.byHourOfDay=[ee.start.get("hour")]}},deps:()=>[yP,y0,yJ,yY,y$]};function y1($,ee){return $.add(pP($.get("weekday"),ee),"day")}function y2($,ee,et){let en=$.set("day",1);if(et<0){en=en.add(1,"month")}en=y1(en,ee);return et<0?en.add(et,"week"):en.add(et-1,"week")}class y6 extends yU{run($){const ee=y4($,this.options.byDayOfMonth,this.options.byDayOfWeek);const et=$.get("day");for(const en of ee){if(et>en)continue;if(et===en){return this.validateDate(new hh($))}return this.validateDate(new hy($.granularity("month").set("day",en)))}let en;let ei=$;let eo=0;while(!en&&eo<30){ei=ei.granularity("month").add(1,"month");en=y4(ei,this.options.byDayOfMonth,this.options.byDayOfWeek)[0];eo++}if(eo>=13){throw new hp("byDayOfMonth Infinite while loop")}return this.validateDate(new hy(ei.set("day",en)))}}function y4($,ee,et){const en=$.endGranularity("month").get("day");let ei=ee.filter($=>en>=Math.abs($)).map($=>$>0?$:en+$+1);if(et){const ee=$.granularity("month");const en=[];et.forEach(et=>{if(typeof et==="string"){en.push(...ei.filter($=>ee.set("day",$).get("weekday")===et));return}const eo=y2($,...et).get("day");if(ei.includes(eo)){en.push(eo)}});ei=Array.from(new Set(en))}return ei.sort(($,ee)=>{if($>ee)return 1;if($<ee)return-1;else return 0})}class y3 extends yj{run($){const ee=y4($,this.options.byDayOfMonth,this.options.byDayOfWeek).reverse();const et=$.get("day");for(const en of ee){if(et<en)continue;if(et===en){return this.validateDate(new hh($))}return this.validateDate(new hy($.endGranularity("month").set("day",en)))}let en;let ei=$;let eo=0;while(!en&&eo<30){ei=ei.endGranularity("month").subtract(1,"month");en=y4(ei,this.options.byDayOfMonth,this.options.byDayOfWeek).pop();eo++}if(eo>=13){throw new hp("byDayOfMonth Infinite while loop")}return this.validateDate(new hy(ei.set("day",en)))}}const y8={name:"ByDayOfMonth",get:$=>{if($.options.byDayOfMonth===undefined)return null;if($.reverse)return new y3($);return new y6($)},normalizeOptions:($,ee)=>{if($.byDayOfMonth!==undefined){if($.frequency==="WEEKLY"){throw new hu('when "frequency" is "WEEKLY", "byDayOfMonth" cannot be present')}if(!yF($.byDayOfMonth)){throw new hu('"byDayOfMonth" expects a non-empty array')}if($.byDayOfMonth.some($=>$===0||$<-31||$>31)){throw new hu('"byDayOfMonth" values must be `num !== 0 && num <= 31 && num >= -31`')}ee.byDayOfMonth=$.byDayOfMonth.slice()}else if(!(yF($.byDayOfWeek)||yF($.byDayOfYear))&&["YEARLY","MONTHLY"].includes($.frequency)){ee.byDayOfMonth=[ee.start.get("day")]}},deps:()=>[yP,y8,y0,yJ,yY,y$]};function y5($,ee,et){let en=$.set("month",1).set("day",1);if(et<0){en=en.add(1,"year")}en=y1(en,ee);return et<0?en.add(et,"week"):en.add(et-1,"week")}function y9($,ee){const et=pP($.get("weekday"),ee);return $.subtract(et===0?0:7-et,"day")}class y7 extends yj{run($){if(this.options.frequency==="YEARLY"){return this.options.byMonthOfYear===undefined?this.expandYearly($):this.expandMonthly($)}else if(this.options.frequency==="MONTHLY"){return this.expandMonthly($)}return this.expand($)}expandYearly($){let ee=ge($,this.options.byDayOfWeek)[0];let et=0;let en=$;while(!ee&&et<28){et++;en=en.granularity("year").subtract(1,"millisecond");ee=ge(en,this.options.byDayOfWeek)[0]}if(!ee){throw new hp("The byDayOfWeek rule appears to contain an impossible combination")}return this.result($,ee)}expandMonthly($){let ee=gt($,this.options.byDayOfWeek)[0];let et=0;let en=$;while(!ee&&et<50){et++;en=en.granularity("month").subtract(1,"millisecond");ee=gt(en,this.options.byDayOfWeek)[0]}if(!ee){throw new hp("The byDayOfWeek rule appears to contain an impossible combination")}return this.result($,ee)}expand($){const ee=this.options.byDayOfWeek.map(ee=>y9($,ee)).sort(pk).pop();return this.result($,ee)}result($,ee){if(ee.isEqual($)){return this.validateDate(new hh($))}return this.validateDate(new hy(ee.endGranularity("day")))}}function ge($,ee){const et=ee.filter($=>Array.isArray($)).map(ee=>y5($,...ee));const en=ee.filter($=>typeof $==="string").map(ee=>y9($,ee)).filter(ee=>ee.get("year")===$.get("year"));return pM([...et,...en]).filter(ee=>ee.isBeforeOrEqual($)).sort(pk).reverse()}function gt($,ee){const et=ee.filter($=>Array.isArray($)).map(ee=>y2($,...ee));const en=ee.filter($=>typeof $==="string").map(ee=>y9($,ee)).filter(ee=>ee.get("year")===$.get("year")&&ee.get("month")===$.get("month"));return pM([...et,...en]).filter(ee=>ee.isBeforeOrEqual($)).sort(pk).reverse()}class gr extends yU{run($){if(this.options.frequency==="YEARLY"){return this.options.byMonthOfYear===undefined?this.expandYearly($):this.expandMonthly($)}else if(this.options.frequency==="MONTHLY"){return this.expandMonthly($)}return this.expand($)}expandYearly($){let ee=gn($,this.options.byDayOfWeek)[0];let et=0;let en=$;while(!ee&&et<28){et++;en=en.granularity("year").add(1,"year");ee=gn(en,this.options.byDayOfWeek)[0]}if(!ee){throw new hp("The byDayOfWeek rule appears to contain an impossible combination")}return this.result($,ee)}expandMonthly($){let ee=gi($,this.options.byDayOfWeek)[0];let et=0;let en=$;while(!ee&&et<50){et++;en=en.granularity("month").add(1,"month");ee=gi(en,this.options.byDayOfWeek)[0]}if(!ee){throw new hp("The byDayOfWeek rule appears to contain an impossible combination")}return this.result($,ee)}expand($){const ee=this.options.byDayOfWeek.map(ee=>y1($,ee)).sort(pk)[0];return this.result($,ee)}result($,ee){if(ee.isEqual($)){return this.validateDate(new hh($))}return this.validateDate(new hy(ee.granularity("day")))}}function gn($,ee){const et=ee.filter($=>Array.isArray($)).map(ee=>y5($,...ee));const en=ee.filter($=>typeof $==="string").map(ee=>y1($,ee)).filter(ee=>ee.get("year")===$.get("year"));return pM([...et,...en]).filter(ee=>ee.isAfterOrEqual($)).sort(pk)}function gi($,ee){const et=ee.filter($=>Array.isArray($)).map(ee=>y2($,...ee));const en=ee.filter($=>typeof $==="string").map(ee=>y1($,ee)).filter(ee=>ee.get("year")===$.get("year")&&ee.get("month")===$.get("month"));return pM([...et,...en]).filter(ee=>ee.isAfterOrEqual($)).sort(pk)}const ga={name:"ByDayOfWeek",get:$=>{if($.options.byDayOfWeek===undefined)return null;if($.reverse)return new y7($);return new gr($)},normalizeOptions:($,ee)=>{if($.byDayOfWeek!==undefined){if(!yF($.byDayOfWeek)){throw new hu('"byDayOfWeek" expects a non-empty array')}const et=$.byDayOfWeek.find($=>Array.isArray($)?!pA.WEEKDAYS.includes($[0]):!pA.WEEKDAYS.includes($));if(et){throw new hu(`"byDayOfWeek" expects weedays in the form `+`${JSON.stringify(pA.WEEKDAYS)} but "${et}" was provided`)}if(!["YEARLY","MONTHLY"].includes($.frequency)&&$.byDayOfWeek.some($=>Array.isArray($))){throw new hu('"byDayOfWeek" can only include a numeric value (i.e. `[string, number]`) when the "frequency" is '+'either "MONTHLY" or "YEARLY"')}if($.frequency==="MONTHLY"&&$.byDayOfWeek.some($=>Array.isArray($)&&($[1]<-31||$[1]===0||$[1]>31))){throw new hu('when "frequency" is "MONTHLY", each "byDayOfWeek" can optionally only'+" have a numeric value >= -31 and <= 31 and !== 0")}if($.frequency==="YEARLY"&&$.byDayOfWeek.some($=>Array.isArray($)&&($[1]<-366||$[1]===0||$[1]>366))){throw new hu('when "frequency" is "YEARLY", each "byDayOfWeek" can optionally only'+" have a numeric value >= -366 and <= 366 and !== 0")}ee.byDayOfWeek=$.byDayOfWeek}else if(!yF($.byDayOfMonth)&&$.frequency==="WEEKLY"){ee.byDayOfWeek=[ee.start.get("weekday")]}},deps:()=>[yP,ga,y0,yJ,yY,y$]};class go extends yj{constructor(){super(...arguments);this.option=this.processor.options.byMonthOfYear.slice().reverse()}run($){const ee=$.get("month");for(const et of this.option){if(ee<et)continue;if(ee===et){return this.validateDate(new hh($))}return this.validateDate(new hy($.endGranularity("year").set("month",et)))}return this.validateDate(new hy($.endGranularity("year").subtract(1,"year").set("month",this.option[0])))}}class gs extends yU{run($){const ee=$.get("month");for(const et of this.options.byMonthOfYear){if(ee>et)continue;if(ee===et){return this.validateDate(new hh($))}return this.validateDate(new hy($.granularity("year").set("month",et)))}return this.validateDate(new hy($.granularity("year").add(1,"year").set("month",this.options.byMonthOfYear[0])))}}const gu={name:"ByMonthOfYear",get:$=>{if($.options.byMonthOfYear===undefined)return null;if($.reverse){return new go($)}return new gs($)},normalizeOptions:($,ee)=>{if($.byMonthOfYear!==undefined){if(!yF($.byMonthOfYear)){throw new hu('"byMonthOfYear" expects a non-empty array')}if($.byMonthOfYear.some($=>$<1||$>12)){throw new hu('"byMonthOfYear" values must be `num >= 1 && num >= 12`')}ee.byMonthOfYear=$.byMonthOfYear.slice();ee.byMonthOfYear.sort(he)}else if(!(yF($.byDayOfMonth)||yF($.byDayOfWeek)||yF($.byDayOfYear))&&$.frequency==="YEARLY"){ee.byMonthOfYear=[ee.start.get("month")]}},deps:()=>[yP,gu,y8,y0,yJ,yY,y$]};const gl=[yP,gu,y8,ga,y0,yJ,yY,y$];class gf extends pT{constructor($,ee={}){super(undefined,ee);if(!["UTC",null,undefined].includes(ee.timezone)){throw new pE(`StandardDateAdapter only supports "UTC" and `+`local time zones but "${ee.timezone}" was provided.`)}this._date=new Date($);this.timezone=ee.timezone!==undefined?ee.timezone:null;if(ee.metadata){Object.assign(this.metadata,ee.metadata)}this.assertIsValid()}static isDate($){return Object.prototype.toString.call($)==="[object Date]"}static fromDate($,ee){return new gf($,ee)}static fromJSON($){const ee=[$.year,$.month-1,$.day,$.hour,$.minute,$.second,$.millisecond];let et;switch($.timezone){case"UTC":{et=new gf(new Date(Date.UTC(...ee)),{timezone:"UTC",duration:$.duration});break}case null:{et=new gf(new Date(...ee),{timezone:null,duration:$.duration});break}default:throw new pE("The `StandardDateAdapter` only supports datetimes in "+`UTC or LOCAL (null) time. You provided a JSON object `+`with timezone "${$.timezone}".`)}if($.metadata){Object.assign(et.metadata,$.metadata)}return et}static fromDateTime($){const ee=gf.fromJSON($.toJSON());ee.generators.push(...$.generators);if($.metadata){Object.assign(ee.metadata,$.metadata)}return ee}get date(){return new Date(this._date)}get end(){if(!this.duration)return;if(this._end)return this._end;this._end=gf.fromDateTime(this.toDateTime().add(this.duration,"millisecond")).date;return this._end}set($,ee){if($==="timezone"){if(this.timezone===ee)return this;else{return new gf(this._date,{timezone:ee,duration:this.duration,generators:this.generators})}}else if($==="duration"){if(this.duration===ee)return this;else{return new gf(this._date,{timezone:this.timezone,duration:ee,generators:this.generators})}}throw new p9(`Unknown prop "${$}" for StandardDateAdapter#set()`)}valueOf(){return this._date.valueOf()}toJSON(){let $;if(this.timezone==="UTC"){$={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()}}else{$={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()}}if(this.duration){$.duration=this.duration}return $}assertIsValid(){if(!gf.isDate(this._date)||isNaN(this._date.valueOf())){throw new pE("StandardDateAdapter has invalid date.")}else if(![null,"UTC"].includes(this.timezone)){throw new pE("StandardDateAdapter only supports local (null) and UTC timezones but "+`"${this.timezone}" was specified.`)}else if(this.duration&&this.duration<=0){throw new pE("If provided, duration must be greater than 0.")}return true}}gf.hasTimezoneSupport=false;pT.adapter=gf;yl.recurrenceRules=gl;class gd extends Error{}class gp extends Error{}h_.JSON_FN_MAP=new Map;h_.prototype.toJSON=function $($){throw new gp(`To support smaller bundles, ${this.constructor.name}#toJSON() `+`must be manually added. See "@rschedule/json-tools" in the rSchedule docs.`)};h_.fromJSON=function $($,ee){if(typeof $!=="object"||$===null){throw new gd(`Invalid json "${$}"`)}const et=h_.JSON_FN_MAP.get($.type);if(!et){throw new gd(`Unknown rSchedule object type "${$.type}". Have you added a json serializer `+`for "${$.type}"? `+`See "@rschedule/json-tools" in the rSchedule docs.`)}return et($,ee)};function gh($,ee,et){if(!et.data)return;if(et.data===true){ee.data=$.data}else{ee.data=et.data($)}if(ee.data===undefined)delete ee.data}function gy($,ee){h_.JSON_FN_MAP.set($,ee)};hM.prototype.toJSON=function $($={}){const ee={type:"Dates",dates:this.adapters.map($=>$.toJSON())};if(!$.nested)ee.timezone=this.timezone;gh(this,ee,$);return ee};hM.fromJSON=function $($,ee={}){if($.type!=="Dates"){throw new gd("Invalid Dates JSON")}return new hM({dates:$.dates.map($=>pT.adapter.fromJSON($)),data:typeof ee.data==="function"?ee.data($):$.data,timezone:ee.timezone||$.timezone})};gy("Dates",hM.fromJSON);yl.prototype.toJSON=function $($={}){const ee={type:"Rule",config:Object.assign(Object.assign({},hr(this.options)),{start:this.normalizeDateInput(this.options.start).toJSON()})};if(this.options.end){ee.config.end=this.normalizeDateInput(this.options.end).toJSON()}if(!$.nested)ee.timezone=this.timezone;gh(this,ee,$);return ee};yl.fromJSON=function $($,ee={}){const et=Object.assign(Object.assign({},$.config),{start:pT.adapter.fromJSON($.config.start),end:$.config.end&&pT.adapter.fromJSON($.config.end)});return new yl(et,{data:typeof ee.data==="function"?ee.data($):$.data,timezone:ee.timezone||$.timezone})};gy("Rule",yl.fromJSON);ym.prototype.toJSON=function $($={}){const ee={type:"Schedule",rrules:this.rrules.map(ee=>ee.toJSON(Object.assign(Object.assign({},$),{nested:true}))),exrules:this.exrules.map(ee=>ee.toJSON(Object.assign(Object.assign({},$),{nested:true}))),rdates:this.rdates.toJSON(Object.assign(Object.assign({},$),{nested:true})),exdates:this.exdates.toJSON(Object.assign(Object.assign({},$),{nested:true}))};if(!$.nested)ee.timezone=this.timezone;gh(this,ee,$);return ee};ym.fromJSON=function $($,ee={}){if($.type!=="Schedule"){throw new gd("Invalid Schedule JSON")}return new ym({rrules:$.rrules.map(et=>yl.fromJSON(et,Object.assign({timezone:$.timezone},ee))),exrules:$.exrules.map(et=>yl.fromJSON(et,Object.assign({timezone:$.timezone},ee))),rdates:hM.fromJSON($.rdates,Object.assign({timezone:$.timezone},ee)),exdates:hM.fromJSON($.exdates,Object.assign({timezone:$.timezone},ee)),data:typeof ee.data==="function"?ee.data($):$.data,timezone:ee.timezone||$.timezone})};gy("Schedule",ym.fromJSON);;function gg($,ee,et){if(!$){throw new lG(ee,et)}}function gm($){try{let ee=pg($);return{type:"recur",schedule:new ym({rrules:ee,data:{skipWeekend:$.skipWeekend,weekendSolve:$.weekendSolveMode}})}}catch($){throw new lG("parse-recur-date",$.message)}}function g_($){if(typeof $!=="string"){return null}else if($.length===10){if(!eA(rv($))){return null}return{type:"date",date:$}}else if($.length===7){if(!eA(rv($+"-01"))){return null}return{type:"month",date:$}}else if($.length===4){if(!eA(rv($+"-01-01"))){return null}return{type:"year",date:$}}return null}function gv($){let{num1:ee,num2:et}=$;if(typeof ee!=="number"||typeof et!=="number"){return null}return{type:"between",num1:ee,num2:et}}let gw={date:{ops:["is","isapprox","gt","gte","lt","lte"],nullable:false,parse($,ee,et){let en=typeof ee==="string"?g_(ee):ee.frequency!=null?gm(ee):null;gg(en,"date-format",`Invalid date format (field: ${et})`);if($==="isapprox"){gg(en.type==="date"||en.type==="recur","date-format",`Invalid date value for “isapprox” (field: ${et})`)}else if($==="gt"||$==="gte"||$==="lt"||$==="lte"){gg(en.type==="date","date-format",`Invalid date value for “${$}” (field: ${et})`)}return en}},id:{ops:["is","contains","oneOf","isNot","doesNotContain","notOneOf"],nullable:true,parse($,ee,et){if($==="oneOf"||$==="notOneOf"){gg(Array.isArray(ee),"no-empty-array",`oneOf must have an array value (field: ${et})`);return ee}return ee}},string:{ops:["is","contains","oneOf","isNot","doesNotContain","notOneOf"],nullable:true,parse($,ee,et){if($==="oneOf"||$==="notOneOf"){gg(Array.isArray(ee),"no-empty-array",`oneOf must have an array value (field: ${et}): ${JSON.stringify(ee)}`);return ee.filter(Boolean).map($=>$.toLowerCase())}if($==="contains"||$==="doesNotContain"){gg(typeof ee==="string"&&ee.length>0,"no-empty-string",`contains must have non-empty string (field: ${et})`)}return ee.toLowerCase()}},number:{ops:["is","isapprox","isbetween","gt","gte","lt","lte"],nullable:false,parse($,ee,et){let en=typeof ee==="number"?{type:"literal",value:ee}:gv(ee);gg(en!=null,"not-number",`Value must be a number or between amount: ${JSON.stringify(ee)} (field: ${et})`);if($==="isbetween"){gg(en.type==="between","number-format",`Invalid between value for “${$}” (field: ${et})`)}else{gg(en.type==="literal","number-format",`Invalid number value for “${$}” (field: ${et})`)}return en}},boolean:{ops:["is"],nullable:false,parse($,ee,et){gg(typeof ee==="boolean","not-boolean",`Value must be a boolean: ${ee} (field: ${et})`);return ee}}};class gE{field;op;options;rawValue;type;unparsedValue;value;constructor($,ee,et,en,ei){let eo=ei.get(ee);gg(eo,"internal","Invalid condition field: "+ee);let es=gw[eo];gg(es,"internal",`Invalid condition type: ${eo} (field: ${ee})`);gg(es.ops.includes($),"internal",`Invalid condition operator: ${$} (type: ${eo}, field: ${ee})`);if(es.nullable!==true){gg(et!=null,"no-null",`Field cannot be empty: ${ee}`)}if(eo==="string"&&es.nullable!==true){gg(et!=="","no-null",`Field cannot be empty: ${ee}`)}this.rawValue=et;this.unparsedValue=et;this.op=$;this.field=ee;this.value=es.parse?es.parse($,et,ee):et;this.options=en;this.type=eo}eval($){let ee=$[this.field];if(ee===undefined){return false}if(typeof ee==="string"){ee=ee.toLowerCase()}let et=this.type;if(et==="number"&&this.options){if(this.options.outflow){if(ee>0){return false}ee=-ee}else if(this.options.inflow){if(ee<0){return false}}}let en=$=>et==="number"?$.value:$;switch(this.op){case"isapprox":case"is":if(et==="date"){if(ee==null){return false}if(this.value.type==="recur"){let{schedule:$}=this.value;if(this.op==="isapprox"){let et=nT(ee);return $.occursBetween(nt(et,2),r9(et,2))}else{return $.occursOn({date:nT(ee)})}}else{let{date:$}=this.value;if(this.op==="isapprox"){let et=nT($);let en=nF(et,2);let ei=nB(et,2);return ee>=ei&&ee<=en}else{switch(this.value.type){case"date":return ee===$;case"month":return nA(ee)===$;case"year":return nO(ee)===$;default:}}}}else if(et==="number"){let $=this.value.value;if(this.op==="isapprox"){let et=pn($);return ee>=$-et&&ee<=$+et}return ee===$}return ee===this.value;case"isNot":return ee!==this.value;case"isbetween":{let[$,et]=d9(this.value.num1,this.value.num2);return ee>=$&&ee<=et}case"contains":if(ee===null){return false}return ee.indexOf(this.value)!==-1;case"doesNotContain":if(ee===null){return false}return ee.indexOf(this.value)===-1;case"oneOf":if(ee===null){return false}return this.value.indexOf(ee)!==-1;case"notOneOf":if(ee===null){return false}return this.value.indexOf(ee)===-1;case"gt":if(ee===null){return false}else if(et==="date"){return nj(ee,this.value.date)}return ee>en(this.value);case"gte":if(ee===null){return false}else if(et==="date"){return ee===this.value.date||nj(ee,this.value.date)}return ee>=en(this.value);case"lt":if(ee===null){return false}else if(et==="date"){return nU(ee,this.value.date)}return ee<en(this.value);case"lte":if(ee===null){return false}else if(et==="date"){return ee===this.value.date||nU(ee,this.value.date)}return ee<=en(this.value);default:}return false}getValue(){return this.value}serialize(){return{op:this.op,field:this.field,value:this.unparsedValue,type:this.type,...this.options?{options:this.options}:null}}}let gS=["set","link-schedule"];class gT{field;op;options;rawValue;type;value;constructor($,ee,et,en,ei){gg(gS.includes($),"internal",`Invalid action operation: ${$}`);if($==="set"){let $=ei.get(ee);gg($,"internal",`Invalid field for action: ${ee}`);this.field=ee;this.type=$}else if($==="link-schedule"){this.field=null;this.type="id"}this.op=$;this.rawValue=et;this.value=et;this.options=en}exec($){switch(this.op){case"set":$[this.field]=this.value;break;case"link-schedule":$.schedule=this.value;break;default:}}serialize(){return{op:this.op,field:this.field,value:this.value,type:this.type,...this.options?{options:this.options}:null}}}class gO{actions;conditions;conditionsOp;id;stage;constructor({id:$,stage:ee,conditionsOp:et,conditions:en,actions:ei,fieldTypes:eo}){this.id=$;this.stage=ee;this.conditionsOp=et;this.conditions=en.map($=>new gE($.op,$.field,$.value,$.options,eo));this.actions=ei.map($=>new gT($.op,$.field,$.value,$.options,eo))}evalConditions($){if(this.conditions.length===0){return false}const ee=this.conditionsOp==="or"?"some":"every";return this.conditions[ee](ee=>{return ee.eval($)})}execActions($){let ee={};this.actions.forEach($=>$.exec(ee));return ee}exec($){if(this.evalConditions($)){return this.execActions($)}return null}apply($){let ee=this.exec($);return Object.assign({},$,ee)}getId(){return this.id}serialize(){return{id:this.id,stage:this.stage,conditionsOp:this.conditionsOp,conditions:this.conditions.map($=>$.serialize()),actions:this.actions.map($=>$.serialize())}}}class gA{field;method;rules;constructor({field:$,method:ee}){this.field=$;this.method=ee;this.rules=new Map}getIndex($){if(!this.rules.has($)){this.rules.set($,new Set)}return this.rules.get($)}getIndexForValue($){return this.getIndex(this.getKey($)||"*")}getKey($){if(typeof $==="string"&&$!==""){if(this.method==="firstchar"){return $[0].toLowerCase()}return $.toLowerCase()}return null}getIndexes($){let ee=$.conditions.find($=>$.field===this.field);let et=[];if(ee&&(ee.op==="oneOf"||ee.op==="is"||ee.op==="isNot"||ee.op==="notOneOf")){if(ee.op==="oneOf"||ee.op==="notOneOf"){ee.value.forEach($=>et.push(this.getIndexForValue($)))}else{et.push(this.getIndexForValue(ee.value))}}else{et.push(this.getIndex("*"))}return et}index($){let ee=this.getIndexes($);ee.forEach(ee=>{ee.add($)})}remove($){let ee=this.getIndexes($);ee.forEach(ee=>{ee.delete($)})}getApplicableRules($){let ee;if(this.field in $){let et=this.getKey($[this.field]);if(et){ee=this.rules.get(et)}}return im(ee||new Set,this.rules.get("*")||new Set)}}const gI={is:10,oneOf:9,isapprox:5,isbetween:5,gt:1,gte:1,lt:1,lte:1,contains:0};function gN($){let ee=$.conditions.reduce(($,ee)=>{if(gI[ee.op]==null){console.log(`Found invalid operation while ranking: ${ee.op}`);return 0}return $+gI[ee.op]},0);if($.conditions.every($=>$.op==="is"||$.op==="isNot"||$.op==="isapprox"||$.op==="oneOf"||$.op==="notOneOf")){return ee*2}return ee}function gD($){let ee=new Map;$.forEach($=>{ee.set($,gN($))});return[...$].sort(($,et)=>{let en=ee.get($);let ei=ee.get(et);if(en<ei){return-1}else if(en>ei){return 1}else{let ee=$.getId();let en=et.getId();return ee<en?-1:ee>en?1:0}})}function gR($){let ee=[];let et=[];let en=[];for(let ei of $){switch(ei.stage){case"pre":ee.push(ei);break;case"post":en.push(ei);break;default:et.push(ei)}}ee=gD(ee);et=gD(et);en=gD(en);return ee.concat(et).concat(en)}function gC($,ee){for(let et=0;et<$.conditions.length;et++){let en=$.conditions[et];if(en.type==="id"){switch(en.op){case"is":en.value=ee.get(en.rawValue)||en.rawValue;en.unparsedValue=en.value;break;case"isNot":en.value=ee.get(en.rawValue)||en.rawValue;en.unparsedValue=en.value;break;case"oneOf":en.value=en.rawValue.map($=>ee.get($)||$);en.unparsedValue=[...en.value];break;case"notOneOf":en.value=en.rawValue.map($=>ee.get($)||$);en.unparsedValue=[...en.value];break;default:}}}for(let et=0;et<$.actions.length;et++){let en=$.actions[et];if(en.type==="id"){if(en.op==="set"){en.value=ee.get(en.rawValue)||en.rawValue}}}}function gk($,ee,et){let en;s:for(en=0;en<$.length;en++){let ei=$[en];for(let $=0;$<ei.conditions.length;$++){let en=ei.conditions[$];if(en.type==="id"&&en.field===ee){switch(en.op){case"is":if(et(ei,en.value)){continue s}break;case"isNot":if(et(ei,en.value)){continue s}break;case"oneOf":for(let $=0;$<en.value.length;$++){if(et(ei,en.value[$])){continue s}}break;case"notOneOf":for(let $=0;$<en.value.length;$++){if(et(ei,en.value[$])){continue s}}break;default:}}}for(let $=0;$<ei.actions.length;$++){let en=ei.actions[$];if(en.type==="id"&&en.field===ee){if(en.op==="set"){if(et(ei,en.value)){break}}}}}};async function gM($){return f6("SELECT * FROM payees WHERE transfer_acct = ?",[$])}async function gL($){if($.payee){let{transfer_acct:ee}=await f6("SELECT id, transfer_acct FROM v_payees WHERE id = ?",[$.payee]);return ee}return null}async function gx($,ee){const{offbudget:et}=await f6("SELECT offbudget FROM accounts WHERE id = ?",[$.account]);const{offbudget:en}=await f6("SELECT offbudget FROM accounts WHERE id = ?",[ee]);if(et===en){await dj({id:$.id,category:null});return true}return false}async function gP($,ee){if($.is_parent){return null}let{id:et}=await f6("SELECT id FROM payees WHERE transfer_acct = ?",[$.account]);if($.parent_id){let ee=await f6(`
|
|
185
|
+
`);if($===null){$=await f3("SELECT * FROM categories WHERE is_income = 1 AND tombstone = 0")}let ee=await dV("Starting Balance");return{id:ee,category:$?$.id:null}};const dq=["for","and","nor","but","or","yet","so"];const dG=["a","an","the"];const dY=["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"];const dK=new Set([...dq,...dG,...dY]);const dZ=dK;const dJ=["CLI","API","HTTP","HTTPS","JSX","DNS","URL","CI","CDN","GitHub","CSS","JS","JavaScript","TypeScript","HTML","WordPress","JavaScript","Next.js","Node.js"];const dX=dJ;let dQ="[0-9A-Za-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶ-ͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԣԱ-Ֆՙա-ևא-תװ-ײء-يٮ-ٯٱ-ۓەۥ-ۦۮ-ۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴ-ߵߺऄ-हऽॐक़-ॡॱ-ॲॻ-ॿঅ-ঌএ-ঐও-নপ-রলশ-হঽৎড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલ-ળવ-હઽૐૠ-ૡଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହଽଡ଼-ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘ-ౙౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹഽൠ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะา-ำเ-ๆກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ະາ-ຳຽເ-ໄໆໜ-ໝༀཀ-ཇཉ-ཬྈ-ྋက-ဪဿၐ-ၕၚ-ၝၡၥ-ၦၮ-ၰၵ-ႁႎႠ-Ⴥა-ჺჼᄀ-ᅙᅟ-ᆢᆨ-ᇹሀ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙶᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦩᧁ-ᧇᨀ-ᨖᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮ-ᮯᰀ-ᰣᱍ-ᱏᱚ-ᱽᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₔℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-Ɐⱱ-ⱽⲀ-ⳤⴀ-ⴥⴰ-ⵥⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆷㇰ-ㇿ㐀䶵一鿃ꀀ-ꒌꔀ-ꘌꘐ-ꘟꘪ-ꘫꙀ-ꙟꙢ-ꙮꙿ-ꚗꜗ-ꜟꜢ-ꞈꞋ-ꞌꟻ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꤊ-ꤥꤰ-ꥆꨀ-ꨨꩀ-ꩂꩄ-ꩋ가힣豈-鶴侮-頻並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]";let d0=new RegExp(`(?:(?:(\\s?(?:^|[.\\(\\)!?;:"-])\\s*)(${dQ}))|(${dQ}))(${dQ}*[’']*${dQ}*)`,"g");let d1=$=>$.map($=>[new RegExp(`\\b${$}\\b`,"gi"),$]);function d2($){const ee=$[0];if(/\s/.test(ee)){return $.substr(1)}if(/[()]/.test(ee)){return null}return $}function d6($,ee={special:undefined}){$=$.toLowerCase().replace(d0,($,ee="",et,en,ei)=>{const eo=d2($);if(!eo){return $}if(!et){const $=en+ei;if(dZ.has($)){return eo}}return ee+(en||et).toUpperCase()+ei});const et=ee.special||[];const en=[...dX,...et];const ei=d1(en);ei.forEach(([ee,et])=>{$=$.replace(ee,et)});return $};const d4={date:{ops:["is","isapprox","gt","gte","lt","lte"],nullable:false},id:{ops:["is","contains","oneOf","isNot","doesNotContain","notOneOf"],nullable:true},saved:{ops:[],nullable:false},string:{ops:["is","contains","oneOf","isNot","doesNotContain","notOneOf"],nullable:true},number:{ops:["is","isapprox","isbetween","gt","gte","lt","lte"],nullable:false},boolean:{ops:["is"],nullable:false}};const d3=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",saved:"saved"}));function d8($,ee){ee=ee||{};switch($){case"imported_payee":return"imported payee";case"amount":if(ee.inflow){return"amount (inflow)"}else if(ee.outflow){return"amount (outflow)"}return"amount";case"amount-inflow":return"amount (inflow)";case"amount-outflow":return"amount (outflow)";default:return $}}function d5($,ee){switch($){case"oneOf":return"one of";case"notOneOf":return"not one of";case"is":return"is";case"isNot":return"is not";case"isapprox":return"is approx";case"isbetween":return"is between";case"contains":return"contains";case"doesNotContain":return"does not contain";case"gt":if(ee==="date"){return"is after"}return"is greater than";case"gte":if(ee==="date"){return"is after or equals"}return"is greater than or equals";case"lt":if(ee==="date"){return"is before"}return"is less than";case"lte":if(ee==="date"){return"is before or equals"}return"is less than or equals";case"true":return"is true";case"false":return"is false";case"set":return"set";case"link-schedule":return"link schedule";case"and":return"and";case"or":return"or";default:return""}}function d9($){if($==="amount-inflow"){return{field:"amount",options:{inflow:true}}}else if($==="amount-outflow"){return{field:"amount",options:{outflow:true}}}else{return{field:$}}}function d7($){switch($){case"date-format":return"Invalid date format";case"no-null":case"no-empty-array":case"no-empty-string":return"Value cannot be empty";case"not-number":return"Value must be a number";case"invalid-field":return"Please choose a valid field for this type of rule";default:return"Internal error, sorry! Please get in touch https://actualbudget.org/contact/ for support"}}function pt($,ee){if($<ee){return[$,ee]}return[ee,$]}function pr($){switch($.type){case"number":{let ee=$.value;if($.field==="amount"&&$.op!=="isbetween"&&ee!=null){ee=integerToAmount(ee)}return{...$,value:ee}}case"string":{let ee=$.value==null?"":$.value;return{...$,value:ee}}case"boolean":{let ee=$.value;return{...$,value:ee}}default:}return{...$,error:null}}function pn({error:$,inputKey:ee,...et}){switch(et.type){case"number":{let $=et.value;if(et.field==="amount"&&et.op!=="isbetween"){$=amountToInteger($)}return{...et,value:$}}case"string":{let $=et.value==null?"":et.value;return{...et,value:$}}case"boolean":{let $=et.value==null?false:et.value;return{...et,value:$}}default:}return et}function pi($,ee){switch(ee.type){case"number":{if(ee.op!=="isbetween"){return{...ee,error:null,value:$?currencyToAmount(String($))||0:0}}break}default:}return{...ee,error:null,value:$}}function po($){return Math.round(Math.abs($)*.075)};let ps;let pu;async function pl(){let $=(await f4("SELECT * FROM category_mapping")).map($=>[$.id,$.transferId]);let ee=(await f4("SELECT * FROM payee_mapping")).map($=>[$.id,$.targetId]);ps=new Map($.concat(ee));if(pu){pu()}pu=fw(pc)}function pc($,ee){ee.forEach(($,ee)=>{if(ee.indexOf("mapping")!==-1){let et=ee==="category_mapping"?"transferId":"targetId";$.forEach($=>{ps.set($.id,$[et])})}})}function pf(){return ps}function pd($){return ps.get($)||null};function pp($,ee,et){let en=nR();if(ee){return"completed"}else if(et){return"paid"}else if($===en){return"due"}else if($>en&&$<=nF(en,7)){return"upcoming"}else if($<en){return"missed"}else{return"scheduled"}}function ph($){let ee=$.map($=>{let ee=$._conditions.find($=>$.field==="date");return{$and:{schedule:$.id,date:{$gte:ee&&ee.op==="is"?$.next_date:nB($.next_date,2)}}}});return ue("transactions").filter({$or:ee}).orderBy({date:"desc"}).groupBy("schedule").select(["schedule","date"])}function py($){return monthUtils.format(new Date(2020,0,$,12),"do")}function pg($){let ee={SU:"Sunday",MO:"Monday",TU:"Tuesday",WE:"Wednesday",TH:"Thursday",FR:"Friday",SA:"Saturday"};return ee[$]}function pm($){let ee=$.interval||1;switch($.frequency){case"daily":{let $="Every ";$+=ee!==1?`${ee} days`:"day";return $}case"weekly":{let et="Every ";et+=ee!==1?`${ee} weeks`:"week";et+=" on "+monthUtils.format($.start,"EEEE");return et}case"monthly":{let et="Every ";et+=ee!==1?`${ee} months`:"month";if($.patterns&&$.patterns.length>0){let ee=[...$.patterns].sort(($,ee)=>{let et=($.type==="day"?1:0)-(ee.type==="day"?1:0);let en=$.value-ee.value;if(et===0){return en}return et}).filter($=>$.value!==-1);ee=ee.concat($.patterns.filter($=>$.value===-1));et+=" on the ";let en=[];let ei=new Set(ee.map($=>$.type));let eo=ei.size===1&&!ei.has("day");for(let $ of ee){if($.type==="day"){if($.value===-1){en.push("last day")}else{en.push(py($.value))}}else{let ee=eo?"":" "+pg($.type);if($.value===-1){en.push("last"+ee)}else{en.push(py($.value)+ee)}}}if(en.length>2){et+=en.slice(0,en.length-1).join(", ");et+=", and ";et+=en[en.length-1]}else{et+=en.join(" and ")}if(eo){et+=" "+pg(ee[0].type)}}else{et+=" on the "+monthUtils.format($.start,"do")}return et}case"yearly":{let et="Every ";et+=ee!==1?`${ee} years`:"year";et+=" on "+monthUtils.format($.start,"LLL do");return et}default:return"Recurring error"}}function p_($){let ee={start:nT($.start),frequency:$.frequency.toUpperCase(),byHourOfDay:[12]};if($.interval){ee.interval=$.interval}let et=$=>$.slice(0,2).toUpperCase();switch($.frequency){case"daily":return[ee];case"weekly":return[ee];case"monthly":if($.patterns&&$.patterns.length>0){let en=$.patterns.filter($=>$.type==="day");let ei=$.patterns.filter($=>$.type!=="day");return[en.length>0&&{...ee,byDayOfMonth:en.map($=>$.value)},ei.length>0&&{...ee,byDayOfWeek:ei.map($=>[et($.type),$.value])}].filter(Boolean)}else{return[ee]}case"yearly":return[ee];default:throw new Error("Invalid recurring date config")}}function pv($){return{payee:$.find($=>$.op==="is"&&$.field==="payee")||$.find($=>$.op==="is"&&$.field==="description")||null,account:$.find($=>$.op==="is"&&$.field==="account")||$.find($=>$.op==="is"&&$.field==="acct")||null,amount:$.find($=>($.op==="is"||$.op==="isapprox"||$.op==="isbetween")&&$.field==="amount")||null,date:$.find($=>($.op==="is"||$.op==="isapprox")&&$.field==="date")||null}}function pE($){if($&&typeof $!=="number"){return Math.round(($.num1+$.num2)/2)}return $}function pS($,ee){if(ee){return`${ee.name} (${$.next_date})`}else{return`Next: ${$.next_date}`}};class pT extends Error{}let pO;class pA{constructor($,ee){this.metadata={};this.duration=ee&&ee.duration||0;this.generators=ee&&ee.generators&&ee.generators.slice()||[];if(!Number.isInteger(this.duration)||this.duration<0){throw new pT("duration must be a non-negative integer")}}static set adapter($){if(pO){throw new Error(`"${pO.name}" has already been configured.`)}pO=$}static get adapter(){if(!pO){throw new Error("No date adapter has been configured. See rSchedule docs.")}return pO}static isDate($){throw pI("isDate()")}static fromDate($,ee){throw pI("fromDate()")}static fromJSON($){throw pI("fromJSON()")}static fromDateTime($){throw pI("fromDateTime()")}toISOString(){return this.set("timezone","UTC").toDateTime().toISOString()}toDateTime(){const $=pR.fromJSON(Object.assign(Object.assign({},this.toJSON()),{generators:this.generators,metadata:this.metadata}));return $}}pA.hasTimezoneSupport=false;function pI($){return new Error(`You must implement the "${$}" method for this DateAdapter class`)}var pN;(function($){$.WEEKDAYS=["SU","MO","TU","WE","TH","FR","SA"];$.MILLISECONDS_IN_SECOND=1e3;$.MILLISECONDS_IN_MINUTE=$.MILLISECONDS_IN_SECOND*60;$.MILLISECONDS_IN_HOUR=$.MILLISECONDS_IN_MINUTE*60;$.MILLISECONDS_IN_DAY=$.MILLISECONDS_IN_HOUR*24;$.MILLISECONDS_IN_WEEK=$.MILLISECONDS_IN_DAY*7})(pN||(pN={}));class pD extends Error{}class pR{constructor($,ee,et,en,ei={}){this.metadata={};this.date=new Date($);this.timezone=ee||null;this.duration=et||0;this.generators=en&&en.slice()||[];if(!Number.isInteger(this.duration)||this.duration<0){throw new pD("duration must be a non-negative integer")}if(ei.metadata){Object.assign(this.metadata,ei.metadata)}this.assertIsValid()}static fromJSON($){const ee=new Date(Date.UTC($.year,$.month-1,$.day,$.hour,$.minute,$.second,$.millisecond));return new pR(ee,$.timezone,$.duration,$.generators,{metadata:$.metadata})}static fromDateAdapter($){return pR.fromJSON(Object.assign(Object.assign({},$.toJSON()),{generators:$.generators,metadata:$.metadata}))}get end(){if(!this.duration)return;if(this._end)return this._end;this._end=this.add(this.duration,"millisecond");return this._end}isEqual($){if(!$){return false}pC(this,$);return this.valueOf()===$.valueOf()}isBefore($){pC(this,$);return this.valueOf()<$.valueOf()}isBeforeOrEqual($){pC(this,$);return this.valueOf()<=$.valueOf()}isAfter($){pC(this,$);return this.valueOf()>$.valueOf()}isAfterOrEqual($){pC(this,$);return this.valueOf()>=$.valueOf()}isOccurring($){if(!this.duration){throw new Error("DateTime#isOccurring() is only applicable to DateTimes with durations")}pC(this,$);return $.isAfterOrEqual(this)&&$.isBeforeOrEqual(this.add(this.duration,"millisecond"))}add($,ee){switch(ee){case"generator":{const ee=this.generators.slice();ee.unshift($);return new pR(this.date,this.timezone,this.duration,ee)}case"year":return this.forkDateTime(pq(this.date,$));case"month":return this.forkDateTime(pG(this.date,$));case"week":return this.forkDateTime(pY(this.date,$));case"day":return this.forkDateTime(pK(this.date,$));case"hour":return this.forkDateTime(pZ(this.date,$));case"minute":return this.forkDateTime(pJ(this.date,$));case"second":return this.forkDateTime(pX(this.date,$));case"millisecond":return this.forkDateTime(pQ(this.date,$));default:throw new Error("Invalid unit provided to `DateTime#add`")}}subtract($,ee){switch(ee){case"year":return this.forkDateTime(p0(this.date,$));case"month":return this.forkDateTime(p6(this.date,$));case"week":return this.forkDateTime(p4(this.date,$));case"day":return this.forkDateTime(p3(this.date,$));case"hour":return this.forkDateTime(p8(this.date,$));case"minute":return this.forkDateTime(p5(this.date,$));case"second":return this.forkDateTime(p9(this.date,$));case"millisecond":return this.forkDateTime(p7(this.date,$));default:throw new Error("Invalid unit provided to `DateTime#subtract`")}}get($){switch($){case"year":return this.date.getUTCFullYear();case"month":return this.date.getUTCMonth()+1;case"yearday":return pz(this.date);case"weekday":return pN.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($,ee){if($==="duration"){return new pR(this.date,this.timezone,ee,this.generators)}if($==="generators"){return new pR(this.date,this.timezone,this.duration,ee)}let et=new Date(this.date);switch($){case"year":et.setUTCFullYear(ee);break;case"month":{const $=pU(ee,et.getUTCFullYear());const en=et.getUTCDate();if(en>$){et.setUTCDate(1);et.setUTCMonth(ee);et=p3(et,1)}else{et.setUTCMonth(ee-1)}break}case"day":et.setUTCDate(ee);break;case"hour":et.setUTCHours(ee);break;case"minute":et.setUTCMinutes(ee);break;case"second":et.setUTCSeconds(ee);break;case"millisecond":et.setUTCMilliseconds(ee);break;default:throw new Error("Invalid unit provided to `DateTime#set`")}return this.forkDateTime(et)}granularity($,ee={}){let et=this.forkDateTime(this.date);switch($){case"year":et=et.set("month",1);case"month":et=et.set("day",1);break;case"week":et=pk(et,ee.weekStart)}switch($){case"year":case"month":case"week":case"day":et=et.set("hour",0);case"hour":et=et.set("minute",0);case"minute":et=et.set("second",0);case"second":et=et.set("millisecond",0);case"millisecond":return et;default:throw new Error("Invalid granularity provided to `DateTime#granularity`: "+$)}}endGranularity($,ee={}){let et=this.forkDateTime(this.date);switch($){case"year":et=et.set("month",12);case"month":et=et.set("day",pU(et.get("month"),et.get("year")));break;case"week":et=pM(et,ee.weekStart)}switch($){case"year":case"month":case"week":case"day":et=et.set("hour",23);case"hour":et=et.set("minute",59);case"minute":et=et.set("second",59);case"second":et=et.set("millisecond",999);case"millisecond":return et;default:throw new Error("Invalid granularity provided to `DateTime#granularity`: "+$)}}toISOString(){return this.date.toISOString()}toDateTime(){return this}toJSON(){const $={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")};if(this.duration){$.duration=this.duration}return $}valueOf(){return this.date.valueOf()}assertIsValid(){if(isNaN(this.valueOf())){throw new pD("DateTime has invalid date.")}return true}forkDateTime($){return new pR($,this.timezone,this.duration,this.generators)}}function pC($,ee){if($.timezone!==ee.timezone){throw new pD("Attempted to compare a datetime to another date in a different timezone: "+JSON.stringify($)+" and "+JSON.stringify(ee))}return true}function pk($,ee){const et=pP(ee).indexOf($.get("weekday"));return $.subtract(et,"day")}function pM($,ee){const et=pP(ee).indexOf($.get("weekday"));return $.add(6-et,"day")}function pL($,ee){if($.isAfter(ee))return 1;if($.isBefore(ee))return-1;if($.duration&&ee.duration){if($.duration>ee.duration)return 1;if($.duration<ee.duration)return-1}return 0}function px($){return Array.from(new Map($.map($=>[$.toISOString(),$])).values())}function pP($="SU"){const ee=pN.WEEKDAYS.slice();let et=ee.indexOf($);while(et!==0){pF(ee);et--}return ee}function pF($,ee="first"){if($.length===0){return $}else if(ee==="first"){$.push($.shift())}else{$.unshift($.pop())}return $}function pB($,ee){if($===ee)return 0;const et=pN.WEEKDAYS.indexOf($)-pN.WEEKDAYS.indexOf(ee);return et>0?7-et:Math.abs(et)}function pU($,ee){const et={1:31,2:pj(ee),3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31};return et[$]}function pj($){return pW($)?29:28}function pW($){return $%400===0||$%4===0&&$%100!==0}function pH($){return pW($)?366:365}function pz($){const ee=new Date(Date.UTC($.getUTCFullYear(),0,1));const et=$.valueOf()-ee.valueOf();return 1+Math.floor(et/pN.MILLISECONDS_IN_DAY)}function pV($){if($===null||$===true||$===false){return NaN}const ee=Number($);if(isNaN(ee)){return ee}return ee<0?Math.ceil(ee):Math.floor(ee)}function p$($,ee){if(arguments.length<2){throw new TypeError("2 arguments required, but only "+arguments.length+" present")}const et=$.valueOf();const en=pV(ee);return new Date(et+en)}function pq($,ee){const et=pV(ee);return pG($,et*12)}function pG($,ee){const et=pV(ee);$=new Date($);const en=$.getUTCMonth()+et;const ei=new Date(0);ei.setUTCFullYear($.getUTCFullYear(),en,1);ei.setUTCHours(0,0,0,0);const eo=pU(ei.getUTCMonth()+1,ei.getUTCFullYear());$.setUTCMonth(en,Math.min(eo,$.getUTCDate()));return $}function pY($,ee){const et=pV(ee);const en=et*7;return pK($,en)}function pK($,ee){return pQ($,pV(ee)*pN.MILLISECONDS_IN_DAY)}function pZ($,ee){const et=pV(ee);return p$($,et*pN.MILLISECONDS_IN_HOUR)}function pJ($,ee){const et=pV(ee);return p$($,et*pN.MILLISECONDS_IN_MINUTE)}function pX($,ee){const et=pV(ee);return p$($,et*pN.MILLISECONDS_IN_SECOND)}function pQ($,ee){const et=pV(ee);const en=$.getTime();return new Date(en+et)}function p0($,ee){return pq($,-ee)}function p6($,ee){return pG($,-ee)}function p4($,ee){return pY($,-ee)}function p3($,ee){return pK($,-ee)}function p8($,ee){return pZ($,-ee)}function p5($,ee){return pJ($,-ee)}function p9($,ee){return pX($,-ee)}function p7($,ee){return pQ($,-ee)}class he extends Error{}class ht extends Error{}function hr($,ee){if($>ee){return 1}else if(ee>$){return-1}else{return 0}}function hn($){switch($){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()")}}function ho($){return JSON.parse(JSON.stringify($))}function hs($){return $ instanceof pR?pA.adapter.fromDateTime($):$ instanceof pA?$:pA.adapter.fromDate($)}function hu($,ee){if($ instanceof pR){if($.timezone!==ee){return pA.adapter.fromDateTime($).set("timezone",ee).toDateTime()}return $}return $ instanceof pA?$.set("timezone",ee).toDateTime():pA.adapter.fromDate($).set("timezone",ee).toDateTime()}function hl($,ee){if($.timezone!==ee){return pA.adapter.fromDateTime($).set("timezone",ee).toDateTime()}return $}class hf extends Error{}function hd($){let ee;if($.start instanceof pR){ee=$.start}else if($.start instanceof pA){ee=$.start.toDateTime()}else if(pA.adapter.isDate($.start)){ee=pA.adapter.fromDate($.start).toDateTime()}else{throw new hf('"start" must be either a `DateAdapter` instance or an instance of the '+"date a DateAdapter is wrapping (e.g. `StandardDateAdapter` wraps a `Date`)")}let et;if($.end){if($.end instanceof pR){et=$.end}else if($.end instanceof pA){et=$.end.toDateTime()}else if(pA.adapter.isDate($.end)){et=pA.adapter.fromDate($.end).toDateTime()}else{throw new hf('"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`)")}}if($.duration!==undefined){if(!Number.isInteger($.duration)){throw new hf('"duration" expects a whole number')}if($.duration<=0){throw new hf('"duration" must be greater than 0')}}if($.count!==undefined){if(!Number.isInteger($.count)){throw new hf('"count" must be a whole number')}if($.count<0){throw new hf('"count" must be greater than 0')}}if($.end!==undefined&&$.count!==undefined){throw new hf('"end" and "count" cannot both be present')}return{start:ee,end:et,count:$.count,duration:$.duration}}function hp($,ee){const et=hd(ee);const en=ho(ee);$.forEach($=>{$.normalizeOptions(en,et)});Object.keys(et).forEach($=>{if(et[$]===undefined){delete et[$]}});return et}function hh($){const ee=ho($);ee.start=$.start;if($.end)ee.end=$.end;return ee}class hy extends Error{}class hg{constructor($){this.date=$}}class hm{constructor($){this.date=$}}function h_($){return ee=>$.reduce(($,et)=>{const en=et.get(ee);if(en)$.push(en);return $},[])}class hv{constructor($,ee,et){this.options=ee;this.args=et;this.rules=[];this.iterator=this.options.count===undefined?this.iterate():this.args.reverse?this.iterateWithReverseCount():this.iterateWithCount();this.options=Object.assign(Object.assign({},ho(ee)),{start:ee.start,end:ee.end});this.reverse=this.options.count===undefined&&et.reverse||false;const{start:en,end:ei}=this.normalizeDateTimeArgs(et);if(ee.count!==undefined){this.start=ee.start}else if(en&&ee.start){this.start=en.isAfterOrEqual(ee.start)?en:ee.start}else{this.start=en||ee.start}if(ei&&ee.end){this.end=ei.isBeforeOrEqual(ee.end)?ei:ee.end}else{this.end=ei||ee.end}if(this.args.reverse&&!(ee.count!==undefined||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&&this.options.count===undefined;this.hasDuration=!!this.options.duration;this.rules=Array.isArray($)?$:$(this)}[Symbol.iterator](){return this.iterator}next($){return this.iterator.next($)}*iterateWithReverseCount(){const $=Array.from(this.iterateWithCount()).reverse();let ee;const et=$.slice();let en=et.shift();while(en){if(ee&&ee.skipToDate&&en.isAfter(ee.skipToDate)){en=et.shift();continue}ee=yield en;if(ee&&ee.skipToDate&&ee.skipToDate.isAfterOrEqual(en)){throw new Error("A provided `skipToDate` option must be greater than the last yielded date "+"(or smaller, in the case of reverse iteration)")}en=et.shift()}return undefined}*iterateWithCount(){if(this.options.count===0)return;const $=this.iterate();const ee=this.args.start||this.start;let et=$.next().value;let en=1;let ei;while(et&&en<=this.options.count){en++;if(et.isBefore(ee)){et=$.next().value;continue}if(ei&&ei.skipToDate&&et.isBefore(ei.skipToDate)){et=$.next().value;continue}ei=yield et;if(ei&&ei.skipToDate&&ei.skipToDate.isBeforeOrEqual(et)){throw new Error("A provided `skipToDate` option must be greater than the last yielded date "+"(or smaller, in the case of reverse iteration)")}et=$.next().value}return undefined}*iterate(){let $=this.start;if(this.reverse)$=this.end;let ee=this.nextDate($);while(ee){const $=yield this.normalizeRunOutput(ee);if($&&$.skipToDate){if(this.reverse?$.skipToDate.isAfterOrEqual(ee):$.skipToDate.isBeforeOrEqual(ee)){throw new Error("A provided `skipToDate` option must be greater than the last yielded date "+"(or smaller, in the case of reverse iteration)")}ee=this.nextDate($.skipToDate)}else{ee=this.nextDate(this.reverse?ee.subtract(1,"millisecond"):ee.add(1,"millisecond"))}}return undefined}nextDate($){let ee=this.runRules($.set("generators",[]));if(this.isDatePastEnd(ee.date))return null;let et=0;while(ee instanceof hm&&et<50){ee=this.runRules(ee.date);if(this.isDatePastEnd(ee.date))return null;et++}if(ee instanceof hm){throw new hy(`Failed to find a matching occurrence in ${et} iterations. `+`Last iterated date: "${ee.date.toISOString()}"`)}if(this.reverse?$.isBefore(ee.date):$.isAfter(ee.date)){throw new hy("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 ee.date}runRules($){let ee=new hg($);for(const $ of this.rules){if(ee instanceof hm){return ee}ee=$.run(ee.date)}return ee}isDatePastEnd($){return this.reverse?$.isBefore(this.start):this.end&&$.isAfter(this.end)}normalizeRunOutput($){return this.hasDuration?$.set("duration",this.options.duration):$}normalizeDateTimeArgs($){return{start:$.start&&hl($.start,this.options.start.timezone),end:$.end&&hl($.end,this.options.start.timezone)}}};class hw{constructor($={}){this.timezone=$.timezone!==undefined?$.timezone:null;this.maxDuration=$.maxDuration||0}get firstDate(){if(this._firstDate!==undefined)return this._firstDate;const $=this._run().next().value;this._firstDate=$?this.dateAdapter.fromDateTime($):null;return this._firstDate}get lastDate(){if(this._lastDate!==undefined)return this._lastDate;if(this.isInfinite){this._lastDate=null;return null}const $=this._run({reverse:true}).next().value;this._lastDate=$?this.dateAdapter.fromDateTime($):null;return this._lastDate}pipe(...$){return $.reduce(($,ee)=>ee({base:$,timezone:this.timezone}),this)}occurrences($={}){return new hE(this,this.normalizeOccurrencesArgs($))}collections($={}){return new hT(this,this.normalizeCollectionsArgs($))}occursBetween($,ee,et={}){const en=this.normalizeDateInput($);const ei=this.normalizeDateInput(ee);if(this.hasDuration&&!et.excludeEnds){const $=this.getMaxDuration("occursBetween",et);const ee=this._run({start:en.subtract($,"millisecond"),end:ei,reverse:true});for(const $ of ee){if($.end.isBefore(en))continue;return true}return false}for(const $ of this._run({start:en,end:ei})){if(et.excludeEnds){if($.isEqual(en)){continue}if($.isEqual(ei)){break}}return true}return false}occursOn($){const ee=this.normalizeOccursOnArgs($);if(ee.weekday){if(this.isInfinite&&!ee.before){throw new he("When calling `occursOn()` with a `weekday` argument "+"and an occurrence object that has infinite occurrences, "+"you must include a `before` argument as well.")}const $=ee.after&&(ee.excludeEnds?ee.after.add(1,"day"):ee.after);const et=ee.before&&(ee.excludeEnds?ee.before.subtract(1,"day"):ee.before);const en=this._run({start:$,end:et});let ei=en.next().value;if(!ei)return false;while(ei){if(ei.get("weekday")===ee.weekday){return true}ei=en.next({skipToDate:ei.add(pB(ei.get("weekday"),ee.weekday),"day").granularity("day")}).value}return false}if(!ee.date){throw new he(`"occursOn()" must be called with either a "date" or "weekday" argument`)}if(this.hasDuration){const $=this.getMaxDuration("occursOn",ee);const et=this._run({start:ee.date.subtract($,"millisecond"),end:ee.date});for(const $ of et){if($.end.isBefore(ee.date))continue;if($.isAfter(ee.date))return false;return true}return false}for(const $ of this._run({start:ee.date,end:ee.date})){return!!$}return false}occursAfter($,ee={}){const et=this.normalizeDateInput($);if(this.hasDuration&&!ee.excludeStart){const $=this.getMaxDuration("occursAfter",ee);const en=this._run({start:et.subtract($,"millisecond")});for(const $ of en){if($.end.isBefore(et))continue;return true}return false}for(const $ of this._run({start:et})){if(ee.excludeStart&&$.isEqual(et)){continue}return true}return false}occursBefore($,ee={}){const et=this.normalizeDateInput($);if(this.hasDuration&&ee.excludeStart){for(const $ of this._run({end:et,reverse:true})){if($.end.isAfterOrEqual(et))continue;return true}return false}for(const $ of this._run({end:et,reverse:true})){if(ee.excludeStart&&$.isEqual(et)){continue}return true}return false}get dateAdapter(){return pA.adapter}normalizeOccurrencesArgs($){return Object.assign(Object.assign({},$),{start:this.normalizeDateInput($.start),end:this.normalizeDateInput($.end)})}normalizeCollectionsArgs($){if($.reverse!==undefined){throw new he("`collections()` does not support the `reverse` option at this time.")}return Object.assign(Object.assign({},$),{start:this.normalizeDateInput($.start),end:this.normalizeDateInput($.end)})}normalizeOccursOnArgs($={}){return Object.assign(Object.assign({},$),{date:this.normalizeDateInput($.date),after:this.normalizeDateInput($.after),before:this.normalizeDateInput($.before),excludeDates:$.excludeDates&&$.excludeDates.map($=>this.normalizeDateInput($))})}normalizeRunArgs($){return Object.assign(Object.assign({},$),{start:this.normalizeDateInput($.start),end:this.normalizeDateInput($.end)})}normalizeDateInput($){return $?hu($,this.timezone):undefined}normalizeDateInputToAdapter($){if(!$)return;return hs($)}normalizeRunOutput($){return hl($,this.timezone)}getMaxDuration($,ee){const et=ee.maxDuration||this.maxDuration;if(!Number.isInteger(et)){throw new he(`When an occurrence generator `+`has a duration, a 'maxDuration' argument must be supplied `+`to ${$}().`)}return et}}class hE{constructor($,ee){this.iterable=$;this.args=ee;this[Symbol.iterator]=()=>this.occurrenceIterator();this.iterator=$._run(ee);this.isInfinite=$.isInfinite}next($){return this.occurrenceIterator($).next()}toArray(){if(this.args.end||this.args.take||!this.isInfinite){return Array.from(this.occurrenceIterator())}throw new ht("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($){let ee=this.normalizeRunArgs($);let et=this.iterator.next(ee).value;while(et){const $=yield this.normalizeDateOutput(et);ee=this.normalizeRunArgs($);et=this.iterator.next(ee).value}return undefined}normalizeRunArgs($){return{skipToDate:this.normalizeDateInput($&&$.skipToDate)}}normalizeDateInput($){return $?hu($,this.iterable.timezone):undefined}normalizeDateOutput($){if(!$)return;return $?pA.adapter.fromDateTime($):undefined}}class hS{constructor($=[],ee,et,en){this.dates=$;this.granularity=ee;this.periodStart=et;this.periodEnd=en}}class hT{constructor($,ee){this.iterable=$;this.args=ee;this.granularity="year";this[Symbol.iterator]=()=>this.iterator;if(ee.granularity){this.granularity=ee.granularity;if(this.granularity==="week"&&!ee.weekStart){throw new Error('"week" granularity requires `weekStart` arg')}}if(ee.weekStart){this.weekStart=ee.weekStart}if(ee.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({},ee),{start:ee.start||$._run().next().value,end:ee.end&&this.getPeriod(ee.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 $=[];for(const ee of this.collectionIterator()){$.push(ee)}return $}throw new ht("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($){if(!$)return;return pA.adapter.fromDateTime($)}*collectionIterator(){if(!this.startDate)return;let $=this.occurrenceIterator();let ee=$.next().value;if(!ee)return;let et=this.getPeriod(this.args.start);let en=[];let ei=0;while(ee&&(this.args.take===undefined||this.args.take>ei)){while(ee&&ee.isBeforeOrEqual(et.end)){en.push(ee);ee=$.next().value}yield new hS(en.map($=>this.normalizeDateOutput($)),this.granularity,this.normalizeDateOutput(et.start),this.normalizeDateOutput(et.end));if(!ee)return;en=[];et=!this.args.skipEmptyPeriods?this.getPeriod(this.incrementPeriod(et.period)):this.getPeriod(ee);if(this.granularity==="month"&&this.weekStart){$=this.iterable._run({start:et.start,end:this.args.end});ee=$.next().value}ei++}}getPeriod($){let ee;let et;let en;if(this.granularity==="month"&&this.weekStart){ee=$.granularity("month").granularity("week",{weekStart:this.weekStart});et=$.endGranularity("month").endGranularity("week",{weekStart:this.weekStart});en=$.granularity("month")}else{ee=$.granularity(this.granularity,{weekStart:this.weekStart});et=$.endGranularity(this.granularity,{weekStart:this.weekStart});en=ee}return{start:ee,end:et,period:en}}incrementPeriod($){return $.add(1,this.granularity)}occurrenceIterator(){let $=this.args.start||this.iterable._run().next().value;if(!$)return this.iterable._run(this.args);$=this.getPeriod($).start;return this.iterable._run({start:$,end:this.args.end})}}class hO extends hw{constructor($,ee){super(ee);this.streams=$;this.config=ee;this.timezone=ee.timezone;this.streams=$.map($=>$ instanceof hO?$:$.set("timezone",this.timezone));this.isInfinite=this.calculateIsInfinite();this.hasDuration=this.calculateHasDuration()}normalizeDateInput($){if(!$)return;return hu($,this.timezone)}normalizeRunOutput($){return hl($,this.timezone)}}class hA{constructor($,ee){this.runArgs=ee;this.stream=$._run(this.runArgs);this.next()}next($){const{done:ee,value:et}=this.stream.next($);this.done=typeof ee==="boolean"?ee:true;this.value=et;return{done:ee,value:et}}}function hI($,ee={},et={}){if(!et.skipToDate||$.length===0)return;if(ee.reverse?$.every($=>$.value.isBeforeOrEqual(et.skipToDate)):$.every($=>$.value.isAfterOrEqual(et.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 en of $){if(en.done)continue;if(ee.reverse?en.value.isBeforeOrEqual(et.skipToDate):en.value.isAfterOrEqual(et.skipToDate)){continue}en.next(et)}}function hN($,ee){if($.done&&ee.done)return 0;if($.done)return 1;if(ee.done)return-1;if($.value.isAfter(ee.value))return 1;return-1}function hD($,ee){if($.done&&ee.done)return 0;if($.done)return-1;if(ee.done)return 1;if($.value.isAfter(ee.value))return-1;return 1}function hR($,ee={},et={}){hI($,ee,et);return $.sort(ee.reverse?hD:hN).filter($=>!$.done).shift()}function hC($,ee={},et={}){hI($,ee,et);return $.sort(ee.reverse?hD:hN).filter($=>!$.done).pop()}function hk(...$){return ee=>new hM($,ee)}class hM extends hO{set($,ee){return new hM(this.streams.map($=>$.set("timezone",ee)),Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",ee),timezone:ee}))}*_run($={}){const ee=this.streams.map(ee=>new hA(ee,$));if(this.config.base){ee.push(new hA(this.config.base,$))}if(ee.length===0)return;let et=hR(ee,$);while(et&&!et.done){const en=yield this.normalizeRunOutput(et.value);if(!(en&&en.skipToDate)){et.next()}et=hR(ee,$,en)}}calculateIsInfinite(){return this.config.base&&this.config.base.isInfinite||this.streams.some($=>$.isInfinite)}calculateHasDuration(){const $=this.streams.every($=>$.hasDuration);if(!this.config.base)return $;return this.config.base.hasDuration&&$}}class hL extends(null&&hw){constructor($={}){super($);this.schedules=[];this.data=$.data;if($.schedules){this.schedules=Array.isArray($.schedules)?$.schedules:[$.schedules];this.schedules=this.schedules.map($=>$.set("timezone",this.timezone))}this.isInfinite=this.schedules.some($=>$.isInfinite);this.hasDuration=this.schedules.every($=>$.hasDuration)}occurrences($={}){return new hE(this,this.normalizeOccurrencesArgs($))}collections($={}){return new hT(this,this.normalizeCollectionsArgs($))}set($,ee,et){if($==="timezone"){return new hL({schedules:this.schedules.map(en=>en.set($,ee,et)),data:this.data,timezone:ee,maxDuration:this.maxDuration})}else if($==="schedules"){return new hL({schedules:Array.isArray(ee)?ee:[ee],data:this.data,timezone:this.timezone,maxDuration:this.maxDuration})}throw new ArgumentError("Unknown value for `prop`: "+`"${$}"`)}*_run($={}){if(this.schedules.length===0)return;const ee=$.take;delete $.take;let et;if(this.schedules.length===1){et=this.schedules[0]._run($)}else{et=new hM(this.schedules,{timezone:this.timezone})._run($)}let en=et.next().value;let ei=0;while(en&&(ee===undefined||ee>ei)){en=en.add(this,"generator");const $=yield this.normalizeRunOutput(en);en=et.next($).value;ei++}return undefined}}class hx extends hw{constructor($={}){super($);this.adapters=[];this.isInfinite=false;this.maxDuration=0;this.datetimes=[];this.data=$.data;if($.dates){this.adapters=$.dates.map(ee=>{let et=this.normalizeDateInputToAdapter(ee);if($.duration&&!et.duration){et=et.set("duration",$.duration)}return et.set("timezone",this.timezone)});this.datetimes=this.adapters.map($=>$.toDateTime())}this.hasDuration=this.datetimes.every($=>!!$.duration);if(this.hasDuration){this.maxDuration=this.adapters.reduce(($,ee)=>ee.duration>$?ee.duration:$,0)}}get length(){return this.adapters.length}get firstDate(){return this.adapters[0]||null}get lastDate(){return this.adapters[this.length-1]||null}occurrences($={}){return new hE(this,this.normalizeOccurrencesArgs($))}collections($={}){return new hT(this,this.normalizeCollectionsArgs($))}add($){return new hx({dates:[...this.adapters,$],timezone:this.timezone,data:this.data})}remove($){const ee=this.adapters.slice();const et=this.normalizeDateInputToAdapter($);const en=ee.findIndex($=>$.valueOf()===et.valueOf());if(en>=0){ee.splice(en,1)}return new hx({dates:ee,timezone:this.timezone,data:this.data})}set($,ee,et={}){let en=this.timezone;let ei=this.adapters.slice();if($==="timezone"){if(ee===this.timezone)return this;else if(et.keepLocalTime){ei=this.adapters.map($=>{const et=$.toJSON();et.timezone=ee;return this.dateAdapter.fromJSON(et)})}en=ee}else if($==="dates"){ei=ee}else if($==="duration"){ei=ei.map($=>$.set("duration",ee||0))}else{throw new he(`Unexpected prop argument "${$}". Accepted values are "timezone" or "dates"`)}return new hx({dates:ei,data:this.data,timezone:en})}filter($){return new hx({dates:this.adapters.filter($),data:this.data,timezone:this.timezone})}*_run($={}){let ee=this.datetimes.sort(pL);if($.start){ee=ee.filter(ee=>ee.isAfterOrEqual($.start))}if($.end){ee=ee.filter(ee=>ee.isBeforeOrEqual($.end))}if($.reverse){ee=ee.slice().reverse()}if($.take){ee=ee.slice(0,$.take)}const et=ee.slice();let en=et.shift();let ei;while(en){if(ei&&ei.skipToDate&&($.reverse?ei.skipToDate.isBefore(en):ei.skipToDate.isAfter(en))){en=et.shift();continue}en=en.add(this,"generator");ei=yield this.normalizeRunOutput(en);if(ei&&ei.skipToDate&&($.reverse?ei.skipToDate.isAfterOrEqual(en):ei.skipToDate.isBeforeOrEqual(en))){throw new Error("A provided `skipToDate` option must be greater than the last yielded date "+"(or smaller, in the case of reverse iteration)")}en=et.shift()}return undefined}}class hP extends Error{}let hF;class hB{constructor($,ee){this.metadata={};this.duration=ee&&ee.duration||0;this.generators=ee&&ee.generators&&ee.generators.slice()||[];if(!Number.isInteger(this.duration)||this.duration<0){throw new hP("duration must be a non-negative integer")}}static set adapter($){if(hF){throw new Error(`"${hF.name}" has already been configured.`)}hF=$}static get adapter(){if(!hF){throw new Error("No date adapter has been configured. See rSchedule docs.")}return hF}static isDate($){throw hU("isDate()")}static fromDate($,ee){throw hU("fromDate()")}static fromJSON($){throw hU("fromJSON()")}static fromDateTime($){throw hU("fromDateTime()")}toISOString(){return this.set("timezone","UTC").toDateTime().toISOString()}toDateTime(){const $=hH.fromJSON(Object.assign(Object.assign({},this.toJSON()),{generators:this.generators,metadata:this.metadata}));return $}}hB.hasTimezoneSupport=false;function hU($){return new Error(`You must implement the "${$}" method for this DateAdapter class`)}var hj;(function($){$.WEEKDAYS=["SU","MO","TU","WE","TH","FR","SA"];$.MILLISECONDS_IN_SECOND=1e3;$.MILLISECONDS_IN_MINUTE=$.MILLISECONDS_IN_SECOND*60;$.MILLISECONDS_IN_HOUR=$.MILLISECONDS_IN_MINUTE*60;$.MILLISECONDS_IN_DAY=$.MILLISECONDS_IN_HOUR*24;$.MILLISECONDS_IN_WEEK=$.MILLISECONDS_IN_DAY*7})(hj||(hj={}));class hW extends Error{}class hH{constructor($,ee,et,en,ei={}){this.metadata={};this.date=new Date($);this.timezone=ee||null;this.duration=et||0;this.generators=en&&en.slice()||[];if(!Number.isInteger(this.duration)||this.duration<0){throw new hW("duration must be a non-negative integer")}if(ei.metadata){Object.assign(this.metadata,ei.metadata)}this.assertIsValid()}static fromJSON($){const ee=new Date(Date.UTC($.year,$.month-1,$.day,$.hour,$.minute,$.second,$.millisecond));return new hH(ee,$.timezone,$.duration,$.generators,{metadata:$.metadata})}static fromDateAdapter($){return hH.fromJSON(Object.assign(Object.assign({},$.toJSON()),{generators:$.generators,metadata:$.metadata}))}get end(){if(!this.duration)return;if(this._end)return this._end;this._end=this.add(this.duration,"millisecond");return this._end}isEqual($){if(!$){return false}hz(this,$);return this.valueOf()===$.valueOf()}isBefore($){hz(this,$);return this.valueOf()<$.valueOf()}isBeforeOrEqual($){hz(this,$);return this.valueOf()<=$.valueOf()}isAfter($){hz(this,$);return this.valueOf()>$.valueOf()}isAfterOrEqual($){hz(this,$);return this.valueOf()>=$.valueOf()}isOccurring($){if(!this.duration){throw new Error("DateTime#isOccurring() is only applicable to DateTimes with durations")}hz(this,$);return $.isAfterOrEqual(this)&&$.isBeforeOrEqual(this.add(this.duration,"millisecond"))}add($,ee){switch(ee){case"generator":{const ee=this.generators.slice();ee.unshift($);return new hH(this.date,this.timezone,this.duration,ee)}case"year":return this.forkDateTime(h0(this.date,$));case"month":return this.forkDateTime(h2(this.date,$));case"week":return this.forkDateTime(h6(this.date,$));case"day":return this.forkDateTime(h4(this.date,$));case"hour":return this.forkDateTime(h3(this.date,$));case"minute":return this.forkDateTime(h8(this.date,$));case"second":return this.forkDateTime(h5(this.date,$));case"millisecond":return this.forkDateTime(h9(this.date,$));default:throw new Error("Invalid unit provided to `DateTime#add`")}}subtract($,ee){switch(ee){case"year":return this.forkDateTime(h7(this.date,$));case"month":return this.forkDateTime(ye(this.date,$));case"week":return this.forkDateTime(yt(this.date,$));case"day":return this.forkDateTime(yr(this.date,$));case"hour":return this.forkDateTime(yn(this.date,$));case"minute":return this.forkDateTime(yi(this.date,$));case"second":return this.forkDateTime(yo(this.date,$));case"millisecond":return this.forkDateTime(yu(this.date,$));default:throw new Error("Invalid unit provided to `DateTime#subtract`")}}get($){switch($){case"year":return this.date.getUTCFullYear();case"month":return this.date.getUTCMonth()+1;case"yearday":return hJ(this.date);case"weekday":return hj.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($,ee){if($==="duration"){return new hH(this.date,this.timezone,ee,this.generators)}if($==="generators"){return new hH(this.date,this.timezone,this.duration,ee)}let et=new Date(this.date);switch($){case"year":et.setUTCFullYear(ee);break;case"month":{const $=hY(ee,et.getUTCFullYear());const en=et.getUTCDate();if(en>$){et.setUTCDate(1);et.setUTCMonth(ee);et=yr(et,1)}else{et.setUTCMonth(ee-1)}break}case"day":et.setUTCDate(ee);break;case"hour":et.setUTCHours(ee);break;case"minute":et.setUTCMinutes(ee);break;case"second":et.setUTCSeconds(ee);break;case"millisecond":et.setUTCMilliseconds(ee);break;default:throw new Error("Invalid unit provided to `DateTime#set`")}return this.forkDateTime(et)}granularity($,ee={}){let et=this.forkDateTime(this.date);switch($){case"year":et=et.set("month",1);case"month":et=et.set("day",1);break;case"week":et=hV(et,ee.weekStart)}switch($){case"year":case"month":case"week":case"day":et=et.set("hour",0);case"hour":et=et.set("minute",0);case"minute":et=et.set("second",0);case"second":et=et.set("millisecond",0);case"millisecond":return et;default:throw new Error("Invalid granularity provided to `DateTime#granularity`: "+$)}}endGranularity($,ee={}){let et=this.forkDateTime(this.date);switch($){case"year":et=et.set("month",12);case"month":et=et.set("day",hY(et.get("month"),et.get("year")));break;case"week":et=h$(et,ee.weekStart)}switch($){case"year":case"month":case"week":case"day":et=et.set("hour",23);case"hour":et=et.set("minute",59);case"minute":et=et.set("second",59);case"second":et=et.set("millisecond",999);case"millisecond":return et;default:throw new Error("Invalid granularity provided to `DateTime#granularity`: "+$)}}toISOString(){return this.date.toISOString()}toDateTime(){return this}toJSON(){const $={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")};if(this.duration){$.duration=this.duration}return $}valueOf(){return this.date.valueOf()}assertIsValid(){if(isNaN(this.valueOf())){throw new hW("DateTime has invalid date.")}return true}forkDateTime($){return new hH($,this.timezone,this.duration,this.generators)}}function hz($,ee){if($.timezone!==ee.timezone){throw new hW("Attempted to compare a datetime to another date in a different timezone: "+JSON.stringify($)+" and "+JSON.stringify(ee))}return true}function hV($,ee){const et=hq(ee).indexOf($.get("weekday"));return $.subtract(et,"day")}function h$($,ee){const et=hq(ee).indexOf($.get("weekday"));return $.add(6-et,"day")}function hq($="SU"){const ee=hj.WEEKDAYS.slice();let et=ee.indexOf($);while(et!==0){hG(ee);et--}return ee}function hG($,ee="first"){if($.length===0){return $}else if(ee==="first"){$.push($.shift())}else{$.unshift($.pop())}return $}function hY($,ee){const et={1:31,2:hK(ee),3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31};return et[$]}function hK($){return hZ($)?29:28}function hZ($){return $%400===0||$%4===0&&$%100!==0}function hJ($){const ee=new Date(Date.UTC($.getUTCFullYear(),0,1));const et=$.valueOf()-ee.valueOf();return 1+Math.floor(et/hj.MILLISECONDS_IN_DAY)}function hX($){if($===null||$===true||$===false){return NaN}const ee=Number($);if(isNaN(ee)){return ee}return ee<0?Math.ceil(ee):Math.floor(ee)}function hQ($,ee){if(arguments.length<2){throw new TypeError("2 arguments required, but only "+arguments.length+" present")}const et=$.valueOf();const en=hX(ee);return new Date(et+en)}function h0($,ee){const et=hX(ee);return h2($,et*12)}function h2($,ee){const et=hX(ee);$=new Date($);const en=$.getUTCMonth()+et;const ei=new Date(0);ei.setUTCFullYear($.getUTCFullYear(),en,1);ei.setUTCHours(0,0,0,0);const eo=hY(ei.getUTCMonth()+1,ei.getUTCFullYear());$.setUTCMonth(en,Math.min(eo,$.getUTCDate()));return $}function h6($,ee){const et=hX(ee);const en=et*7;return h4($,en)}function h4($,ee){return h9($,hX(ee)*hj.MILLISECONDS_IN_DAY)}function h3($,ee){const et=hX(ee);return hQ($,et*hj.MILLISECONDS_IN_HOUR)}function h8($,ee){const et=hX(ee);return hQ($,et*hj.MILLISECONDS_IN_MINUTE)}function h5($,ee){const et=hX(ee);return hQ($,et*hj.MILLISECONDS_IN_SECOND)}function h9($,ee){const et=hX(ee);const en=$.getTime();return new Date(en+et)}function h7($,ee){return h0($,-ee)}function ye($,ee){return h2($,-ee)}function yt($,ee){return h6($,-ee)}function yr($,ee){return h4($,-ee)}function yn($,ee){return h3($,-ee)}function yi($,ee){return h8($,-ee)}function yo($,ee){return h5($,-ee)}function yu($,ee){return h9($,-ee)}function yl($,ee){if($.timezone!==ee){return hB.adapter.fromDateTime($).set("timezone",ee).toDateTime()}return $}class yc extends hw{constructor($,ee,et={}){super(et);this.recurrenceRules=$;this.options=hh(ee);this.normOptions=hp(this.recurrenceRules,this.options);this.timezone=et.timezone!==undefined?et.timezone:this.normOptions.start.timezone;this.data=et.data;this.hasDuration=!!ee.duration;if(this.hasDuration)this.duration=ee.duration;this.isInfinite=this.normOptions.end===undefined&&this.normOptions.count===undefined}occurrences($={}){return new hE(this,this.normalizeOccurrencesArgs($))}collections($={}){return new hT(this,this.normalizeCollectionsArgs($))}*_run($={}){const ee=this.normalizeRunArgs($);const et=new hv(h_(this.recurrenceRules),this.normOptions,ee);let en=et.next().value;let ei=0;while(en&&(ee.take===undefined||ei<ee.take)){ei++;en=en.add(this,"generator");const $=yield this.normalizeRunOutput(en);if($===null||$===void 0?void 0:$.skipToDate){en=et.next(Object.assign(Object.assign({},$),{skipToDate:yl($.skipToDate,et.start.timezone)})).value}else{en=et.next($).value}}return undefined}}class yf extends yc{constructor($,ee={}){super(yf.recurrenceRules,$,ee)}set($,ee,et={}){let en=hh(this.options);let ei=this.timezone;if($==="timezone"){if(ee===this.timezone&&!et.keepLocalTime)return this;else if(et.keepLocalTime){const $=this.normalizeDateInput(en.start).toJSON();$.timezone=ee;const et=this.dateAdapter.fromJSON($);en.start=en.start instanceof this.dateAdapter?et:en.start instanceof pR?et.toDateTime():et.date}ei=ee}else if($==="options"){en=ee}else{en[$]=ee}return new yf(en,{data:this.data,maxDuration:this.maxDuration,timezone:ei})}}yf.recurrenceRules=[];class yd extends hw{constructor($){super($);this.data=$.data}occurrences($={}){return new hE(this,this.normalizeOccurrencesArgs($))}collections($={}){return new hT(this,this.normalizeCollectionsArgs($))}*_run($={}){const ee=$.take;delete $.take;const et=this.occurrenceStream._run($);let en=et.next().value;let ei=0;while(en&&(ee===undefined||ee>ei)){en=en.add(this,"generator");const $=yield this.normalizeRunOutput(en);en=et.next($).value;ei++}return undefined}}function yp(...$){return ee=>new yh($,ee)}class yh extends hO{set($,ee){return new yh(this.streams.map($=>$.set("timezone",ee)),Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",ee),timezone:ee}))}*_run($={}){if(!this.config.base)return;const ee=new hA(this.config.base,$);const et=new hA(new hM(this.streams,{timezone:this.config.timezone}),$);yy(ee,et,$);while(!ee.done){const en=yield this.normalizeRunOutput(ee.value);if(!(en&&en.skipToDate)){ee.next()}yy(ee,et,$,en)}}calculateIsInfinite(){return!!(this.config.base&&this.config.base.isInfinite)}calculateHasDuration(){return!!(this.config.base&&this.config.base.hasDuration)}}function yy($,ee,et={},en={}){hI([$,ee],et,en);yg($,ee,et);while(!$.done&&!ee.done&&$.value.isEqual(ee.value)){$.next();yg($,ee,et)}}function yg($,ee,et={}){if(et.reverse){while(!ee.done&&!$.done&&ee.value.isAfter($.value)){ee.next()}return}while(!ee.done&&!$.done&&ee.value.isBefore($.value)){ee.next()}}function ym(){return $=>new y_([],$)}class y_ extends hO{set($,ee){return new y_([],Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",ee),timezone:ee}))}*_run($={}){if(!this.config.base)return;const ee=new hA(this.config.base,$);while(!ee.done){const $=yield this.normalizeRunOutput(ee.value);const et=ee.value;ee.next($);while(!($&&$.skipToDate)&&!ee.done&&ee.value.isEqual(et)){ee.next()}}}calculateIsInfinite(){return!!(this.config.base&&this.config.base.isInfinite)}calculateHasDuration(){return!!(this.config.base&&this.config.base.hasDuration)}}class yv extends yd{constructor($={}){super($);this.rrules=[];this.exrules=[];for(const ee of["rrules","exrules"]){const et=$[ee];if(et){this[ee]=et.map($=>{if($ instanceof yf){return $.set("timezone",this.timezone)}else{return new yf($,{timezone:this.timezone})}})}}for(const ee of["rdates","exdates"]){const et=$[ee];if(et){this[ee]=et instanceof hx?et.set("timezone",this.timezone):new hx({dates:et,timezone:this.timezone})}else{this[ee]=new hx({timezone:this.timezone})}}this.hasDuration=this.rrules.every($=>$.hasDuration)&&this.exrules.every($=>$.hasDuration)&&this.rdates.hasDuration&&this.exdates.hasDuration;this.isInfinite=this.rrules.some($=>$.isInfinite);this.occurrenceStream=[hk(...this.rrules),yp(...this.exrules),hk(this.rdates),yp(this.exdates),ym()].reduce(($,ee)=>ee({base:$,timezone:this.timezone}),undefined)}add($,ee){const et=this.rrules.slice();const en=this.exrules.slice();let ei=this.rdates;let eo=this.exdates;switch($){case"rrule":et.push(ee);break;case"exrule":en.push(ee);break;case"rdate":ei=this.rdates.add(ee);break;case"exdate":eo=this.exdates.add(ee);break}return new yv({timezone:this.timezone,data:this.data,rrules:et,exrules:en,rdates:ei,exdates:eo})}remove($,ee){let et=this.rrules;let en=this.exrules;let ei=this.rdates;let eo=this.exdates;switch($){case"rrule":et=et.filter($=>$!==ee);break;case"exrule":en=en.filter($=>$!==ee);break;case"rdate":ei=this.rdates.remove(ee);break;case"exdate":eo=this.exdates.remove(ee);break}return new yv({timezone:this.timezone,data:this.data,rrules:et,exrules:en,rdates:ei,exdates:eo})}set($,ee,et={}){let en=this.timezone;let ei=this.rrules;let eo=this.exrules;let es=this.rdates;let eu=this.exdates;switch($){case"timezone":if(ee===this.timezone&&!et.keepLocalTime)return this;else if(et.keepLocalTime){ei=ei.map($=>$.set("timezone",ee,et));eo=eo.map($=>$.set("timezone",ee,et));es=es.set("timezone",ee,et);eu=eu.set("timezone",ee,et)}en=ee;break;case"rrules":ei=ee;break;case"exrules":eo=ee;break;case"rdates":es=ee;break;case"exdates":eu=ee;break}return new yv({timezone:en,data:this.data,rrules:ei,exrules:eo,rdates:es,exdates:eu})}}function yw($){return ee=>new yE($,ee)}class yE extends(null&&hO){constructor($,ee){super($.streams,ee);if(this.isInfinite){this.maxFailedIterations=$.maxFailedIterations||yE.defaultMaxFailedIterations;if(!this.maxFailedIterations){throw new ArgumentError("The IntersectionOperator must be provided "+"a `maxFailedIterations` argument when it is built from schedules of infinite length. "+"This argument is used to ensure that the IntersectionOperator does not enter "+"an infinite loop because the underlying schedules never intersect. "+"If the `maxFailedIterations` count is reached it will be assumed that "+"all valid occurrences have been found and iteration will end without error."+'Without additional information, "50" is probably a good '+"`maxFailedIterations` value. "+"If the schedules are not of infinite length, `maxFailedIterations` is ignored. "+"Note also that you can provide a `defaultMaxFailedIterations` number via "+"IntersectionOperator.defaultMaxFailedIterations.")}}}set($,ee){return new yE({maxFailedIterations:this.maxFailedIterations,streams:this.streams.map($=>$.set("timezone",ee))},Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",ee),timezone:ee}))}*_run($={}){const ee=this.streams.map(ee=>new hA(ee,$));if(this.config.base){ee.push(new hA(this.config.base,$))}if(ee.length===0)return;const et=!!(!this.isInfinite||$.reverse||$.end);if(!yS(ee,undefined,Object.assign(Object.assign({},$),{hasEndDate:et,iteration:0,maxIterations:this.maxFailedIterations}))){return}let en=hR(ee,$);while(en){const ei=yield this.normalizeRunOutput(en.value);const eo=en.value;if(!(ei===null||ei===void 0?void 0:ei.skipToDate)){en.next()}if(!yS(ee,eo,Object.assign(Object.assign({},$),{hasEndDate:et,iteration:0,maxIterations:this.maxFailedIterations}),ei)){return}en=hR(ee,$)}}calculateIsInfinite(){if(!this.config.base){if(this.streams.length===0)return false;return this.streams.every($=>$.isInfinite)}else if(this.streams.length===0)return this.config.base.isInfinite;return this.config.base.isInfinite&&this.streams.every($=>$.isInfinite)}calculateHasDuration(){const $=this.streams.every($=>$.hasDuration);if(!this.config.base)return $;return this.config.base.hasDuration&&$}}function yS($,ee,et,en){const ei=hR($,et,en);if(!ei)return false;if(ee&&ei.value.isEqual(ee))return true;if($.some($=>$.done))return false;if($.every($=>$.value.isEqual(ei.value)))return true;et.iteration++;if(et.maxIterations&&!et.hasEndDate&&et.iteration>et.maxIterations){return false}const eo=hC($,et);$.forEach($=>{if(eo.value.isEqual($.value))return;$.next({skipToDate:eo.value})});return yS($,ee,et)}class yT extends(null&&hA){constructor($,ee){super($,ee);this.workingValue=this.value;this.next()}}class yO extends(null&&Error){}function yA($){return ee=>new yI($,ee)}class yI extends(null&&hO){constructor($,ee){super([],ee);this.maxDuration=$.maxDuration;if(ee.base&&!ee.base.hasDuration){throw new ArgumentError("Base stream provided to MergeDurationOperator does not have an associated duration. "+"The MergeDurationOperator can only be used with streams which have a duration. ")}}set($,ee){return new yI({maxDuration:this.maxDuration},Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",ee),timezone:ee}))}_run($={}){return $.reverse?this.reverseRun($):this.forwardRun($)}calculateIsInfinite(){return!!(this.config.base&&this.config.base.isInfinite)}calculateHasDuration(){return true}*forwardRun($={}){if(!this.config.base)return;let ee=$.start;if($.start){ee=$.start.subtract(this.maxDuration,"millisecond")}let et=$.end;if($.end){et=$.end.add(this.maxDuration,"millisecond")}const en=new yT(this.config.base,Object.assign(Object.assign({},$),{start:ee,end:et}));let ei;while(en.workingValue){while(!en.done&&en.workingValue.end.isAfterOrEqual(en.value)){if(en.workingValue.duration>this.maxDuration){throw new yO(`MergeDurationOperatorError: Occurrence duration exceeded maxDuration of `+this.maxDuration)}if(en.value.end.isAfter(en.workingValue.end)){const $=en.value.end.valueOf()-en.workingValue.end.valueOf();en.workingValue=en.workingValue.set("duration",en.workingValue.duration+$)}en.next()}if($.start&&en.workingValue.end.isBefore($.start)){en.workingValue=en.value;en.next();continue}if((ei===null||ei===void 0?void 0:ei.skipToDate)&&en.workingValue.end.isBefore(ei.skipToDate)){en.workingValue=en.value;en.next();continue}if($.end&&en.workingValue&&en.workingValue.isAfter($.end)){break}if(en.workingValue.duration>this.maxDuration){throw new yO(`MergeDurationOperatorError: Occurrence duration exceeded maxDuration of `+this.maxDuration)}ei=yield this.normalizeRunOutput(en.workingValue);if((ei===null||ei===void 0?void 0:ei.skipToDate)&&en.workingValue.isAfterOrEqual(ei.skipToDate)){throw new Error("A provided `skipToDate` option must be greater than the last yielded date "+"(or smaller, in the case of reverse iteration)")}en.workingValue=en.value;en.next()}}*reverseRun($={}){if(!this.config.base)return;let ee=$.start;if($.start){ee=$.start.subtract(this.maxDuration,"millisecond")}let et=$.end;if($.end){et=$.end.add(this.maxDuration,"millisecond")}const en=new yT(this.config.base,Object.assign(Object.assign({},$),{start:ee,end:et}));let ei;while(en.workingValue){while(!en.done&&en.workingValue.isBeforeOrEqual(en.value.end)){if(en.workingValue.duration>this.maxDuration){throw new yO(`MergeDurationOperatorError: Occurrence duration exceeded maxDuration of `+this.maxDuration)}if(en.value.isBefore(en.workingValue)||en.value.end.isAfter(en.workingValue.end)){if(en.value.end.isAfter(en.workingValue.end)){en.workingValue=en.value}else{const $=en.workingValue.valueOf()-en.value.valueOf();en.workingValue=en.value.set("duration",en.workingValue.duration+$)}}en.next()}if($.start&&en.workingValue.end.isBefore($.start)){break}if(ei&&ei.skipToDate&&en.workingValue.end.isBefore(ei.skipToDate)){en.workingValue=en.value;en.next();continue}if($.end&&en.workingValue&&en.workingValue.isAfter($.end)){en.workingValue=en.value;en.next();continue}if(en.workingValue.duration>this.maxDuration){throw new yO(`MergeDurationOperatorError: Occurrence duration exceeded maxDuration of `+this.maxDuration)}ei=yield this.normalizeRunOutput(en.workingValue);if(ei&&ei.skipToDate&&en.workingValue.end.isBeforeOrEqual(ei.skipToDate)){throw new Error("A provided `skipToDate` option must be greater than the last yielded date "+"(or smaller, in the case of reverse iteration)")}en.workingValue=en.value;en.next()}}}class yN extends(null&&Error){}function yD($){return ee=>new yR($,ee)}class yR extends(null&&hO){constructor($,ee){super([],ee);this.splitFn=$.splitFn;this.maxDuration=$.maxDuration;if(ee.base&&!ee.base.hasDuration){throw new ArgumentError("Base stream provided to SplitDurationOperator does not have an associated duration. "+"The SplitDurationOperator can only be used with streams which have a duration.")}}set($,ee){return new yR({maxDuration:this.maxDuration,splitFn:this.splitFn},Object.assign(Object.assign({},this.config),{base:this.config.base&&this.config.base.set("timezone",ee),timezone:ee}))}*_run($={}){if(!this.config.base)return;const ee=$.reverse||false;let et=$.start;if($.start){et=$.start.subtract(this.maxDuration,"millisecond")}let en=$.end;if($.end){en=$.end.add(this.maxDuration,"millisecond")}const ei=new hA(this.config.base,Object.assign(Object.assign({},$),{start:et,end:en}));let eo;const es=[];while(!ei.done||es[0]&&es[0][0]){if(!(es[0]&&es[0][0])){es.push(this.splitDate(ei.value,ee));ei.next()}while(!ei.done&&(ee?es[0].some($=>$.isBeforeOrEqual(ei.value.end)):es[0].some($=>$.isAfterOrEqual(ei.value)))){es.push(this.splitDate(ei.value,ee));ei.next()}let et=es[0]&&es[0][0];let en=-1;let eu=0;let el=-1;let ef=0;for(const $ of es){en++;el=-1;for(const ei of $){el++;let $;if(ee){$=ei.isAfter(et)||ei.isEqual(et)&&ei.duration>et.duration}else{$=ei.isBefore(et)||ei.isEqual(et)&&ei.duration<et.duration}if($){et=ei;eu=en;ef=el;break}}}es[eu].splice(ef,1);if(es[eu].length===0){es.splice(eu,1)}if(eo&&eo.skipToDate&&et&&!yC(et,$)&&!yk(et,eo.skipToDate,$)){continue}if($.start&&et.end.isBefore($.start)){if(ee)break;continue}if($.end&&et.isAfter($.end)){if(ee)continue;break}if(et.duration>this.maxDuration){throw new yN(`SplitDurationOperatorError: Occurrence duration exceeded maxDuration of `+this.maxDuration)}eo=yield this.normalizeRunOutput(et);if(eo&&eo.skipToDate&&($.reverse?et.isBeforeOrEqual(eo.skipToDate):et.isAfterOrEqual(eo.skipToDate))){throw new Error("A provided `skipToDate` option must be greater than the last yielded date "+"(or smaller, in the case of reverse iteration)")}}}calculateIsInfinite(){return!!(this.config.base&&this.config.base.isInfinite)}calculateHasDuration(){return true}splitDate($,ee){const et=this.splitFn($);let en;if(et.length===0){en=false}else if(et.length===1){en=$.duration===et[0].duration}else{en=$.duration===et.reduce(($,ee)=>$+ee.duration,0)}if(!en){throw new Error("The provided SplitDurationOperator split function "+"must return an array of DateTimes with length > 0 "+"where the total duration of the new dates equals the duration of "+"the original date.")}et.sort(dateTimeSortComparer);if(ee){et.reverse()}return et}}function yC($,ee){return!!(ee.reverse?ee.start&&$.isBefore(ee.start):ee.end&&$.isAfter(ee.end))}function yk($,ee,et){return!!(et.reverse?ee.isAfterOrEqual($):ee.isBeforeOrEqual($))};class yM{constructor($){this.processor=$;this.start=$.start;this.end=$.end;this.options=$.options}}class yL extends yM{constructor($,ee){super($);this.initDate=ee;this.intervalUnit=hn(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($){return this.validateDate(new hg($))}validateDate($){const{date:ee}=$;if($ instanceof hg&&this.dateIsWithinInterval(ee)){return $}this.skipToInterval(ee);return new hm(this.dateIsWithinInterval(ee)?ee:this.setToCurrentInterval())}setToCurrentInterval(){return this.intervalStartDate}normalizedStartDate($){if(this.options.frequency==="WEEKLY"){return $.granularity("week",{weekStart:this.options.weekStart})}return $.granularity(this.intervalUnit)}normalizedEndDate($){switch(this.options.frequency){case"YEARLY":return $.add(1,"year");case"MONTHLY":return $.add(1,"month");case"WEEKLY":return $.add(1,"week");case"DAILY":return $.add(1,"day");case"HOURLY":return $.add(1,"hour");case"MINUTELY":return $.add(1,"minute");case"SECONDLY":return $.add(1,"second");case"MILLISECONDLY":return $.add(1,"millisecond");default:throw new Error(`Unknown frequency ${this.options.frequency}`)}}skipToInterval($){const ee=this.intervalDifference($);this.intervalStartDate=this.firstIntervalStartDate.add(ee,this.intervalUnit);this.intervalEndDate=this.normalizedEndDate(this.intervalStartDate)}dateIsWithinInterval($){return this.intervalStartDate.isBeforeOrEqual($)&&this.intervalEndDate.isAfter($)}intervalDifference($){return yx({first:this.firstIntervalStartDate,second:$,unit:this.intervalUnit,interval:this.options.interval,weekStart:this.options.weekStart,direction:"after"})}}function yx({first:$,second:ee,unit:et,interval:en,weekStart:ei,direction:eo}){let es=(()=>{let en;let eo;switch(et){case"year":eo=(ee.get("year")-$.get("year"))*12;eo=eo+ee.get("month")-$.get("month");return Math.floor(eo/12);case"month":eo=(ee.get("year")-$.get("year"))*12;eo=eo+ee.get("month")-$.get("month");return eo;case"week":$=$.granularity("week",{weekStart:ei});en=pN.MILLISECONDS_IN_WEEK;break;case"day":en=pN.MILLISECONDS_IN_DAY;break;case"hour":en=pN.MILLISECONDS_IN_HOUR;break;case"minute":en=pN.MILLISECONDS_IN_MINUTE;break;case"second":en=pN.MILLISECONDS_IN_SECOND;break;case"millisecond":en=1;break;default:throw new Error("Unexpected `unit` value")}const es=ee.valueOf()-$.valueOf();return Math.floor(es/en)})();const eu=eo==="after"?Math.ceil:Math.floor;es=eu(es/en)*en;return es}class yP extends yL{setToCurrentInterval(){return this.intervalEndDate.subtract(1,"millisecond")}intervalDifference($){return yx({first:this.firstIntervalStartDate,second:$,unit:this.intervalUnit,interval:this.options.interval,weekStart:this.options.weekStart,direction:"before"})}}const yF=["MILLISECONDLY","SECONDLY","MINUTELY","HOURLY","DAILY","WEEKLY","MONTHLY","YEARLY"];const yB={name:"FrequencyRule",get:$=>{if($.options.byMillisecondOfSecond!==undefined||$.options.frequency!=="MILLISECONDLY"){return null}if($.reverse)return new yP($,$.end);return new yL($,$.start)},normalizeOptions:($,ee)=>{if(!yF.includes($.frequency)){throw new hf(`"frequency" must be one of ${JSON.stringify(yF)}`)}if($.interval!==undefined){if(!Number.isInteger($.interval)){throw new hf('"interval" expects a whole number')}if($.interval<1){throw new hf('"interval" cannot be less than 1')}}if($.weekStart!==undefined){if(!pN.WEEKDAYS.includes($.weekStart)){throw new hf(`"weekStart" must be one of ${JSON.stringify(pN.WEEKDAYS)}`)}}ee.frequency=$.frequency;ee.interval=$.interval||1;ee.weekStart=$.weekStart||"MO"},deps:()=>[yB]};function yU($){return Array.isArray($)&&$.length>0}const yj=new WeakMap;class yW extends yM{constructor($){super($);if(!yj.has(this.processor)){yj.set(this.processor,new yL($,$.start))}this.frequency=yj.get(this.processor)}validateDate($){return this.frequency.validateDate($)}}class yH extends yM{constructor($){super($);if(!yj.has(this.processor)){yj.set(this.processor,new yP($,$.end))}this.frequency=yj.get(this.processor)}validateDate($){return this.frequency.validateDate($)}}class yz extends yH{run($){const ee=$.get(this.granularity);for(const et of this.option){if(ee<et)continue;if(ee===et){return this.validateDate(new hg($))}return this.validateDate(new hm($.endGranularity(this.baseGranularity).set(this.granularity,et)))}return this.validateDate(new hm($.endGranularity(this.baseGranularity).subtract(1,this.baseGranularity).set(this.granularity,this.option[0])))}}class yV extends yz{constructor(){super(...arguments);this.baseGranularity="second";this.granularity="millisecond";this.option=this.options.byMillisecondOfSecond.slice().reverse()}}class y$ extends yW{run($){const ee=$.get(this.granularity);for(const et of this.option){if(ee>et)continue;if(ee===et){return this.validateDate(new hg($))}return this.validateDate(new hm($.granularity(this.baseGranularity).set(this.granularity,et)))}return this.validateDate(new hm($.granularity(this.baseGranularity).add(1,this.baseGranularity).set(this.granularity,this.option[0])))}}class yq extends y${constructor(){super(...arguments);this.baseGranularity="second";this.granularity="millisecond";this.option=this.options.byMillisecondOfSecond}}const yG={name:"ByMillisecondOfSecond",get:$=>{if($.options.byMillisecondOfSecond===undefined)return null;if($.reverse)return new yV($);return new yq($)},normalizeOptions:($,ee)=>{if($.byMillisecondOfSecond!==undefined){if(!yU($.byMillisecondOfSecond)){throw new hf('"byMillisecondOfSecond" expects a non-empty array')}if($.byMillisecondOfSecond.some($=>$<0||$>999)){throw new hf('"byMillisecondOfSecond" values must be >= 0 && <= 999')}ee.byMillisecondOfSecond=$.byMillisecondOfSecond;ee.byMillisecondOfSecond.sort(hr)}else if($.frequency!=="MILLISECONDLY"){ee.byMillisecondOfSecond=[ee.start.get("millisecond")]}},deps:()=>[yB,yG]};class yY extends yz{constructor(){super(...arguments);this.baseGranularity="minute";this.granularity="second";this.option=this.options.bySecondOfMinute.slice().reverse()}}class yK extends y${constructor(){super(...arguments);this.baseGranularity="minute";this.granularity="second";this.option=this.options.bySecondOfMinute}}const yZ={name:"BySecondOfMinute",get:$=>{if($.options.bySecondOfMinute===undefined)return null;if($.reverse)return new yY($);return new yK($)},normalizeOptions:($,ee)=>{if($.bySecondOfMinute!==undefined){if(!yU($.bySecondOfMinute)){throw new hf('"bySecondOfMinute" expects a non-empty array')}if($.bySecondOfMinute.some($=>$<0||$>60)){throw new hf('"bySecondOfMinute" values must be >= 0 && <= 60')}ee.bySecondOfMinute=$.bySecondOfMinute;ee.bySecondOfMinute.sort(hr)}else if(!["SECONDLY","MILLISECONDLY"].includes($.frequency)){ee.bySecondOfMinute=[ee.start.get("second")]}},deps:()=>[yB,yZ,yG]};class yJ extends yz{constructor(){super(...arguments);this.baseGranularity="hour";this.granularity="minute";this.option=this.options.byMinuteOfHour.slice().reverse()}}class yX extends y${constructor(){super(...arguments);this.baseGranularity="hour";this.granularity="minute";this.option=this.options.byMinuteOfHour}}const yQ={name:"ByMinuteOfHour",get:$=>{if($.options.byMinuteOfHour===undefined)return null;if($.reverse)return new yJ($);return new yX($)},normalizeOptions:($,ee)=>{if($.byMinuteOfHour!==undefined){if(!yU($.byMinuteOfHour)){throw new hf('"byMinuteOfHour" expects a non-empty array')}if($.byMinuteOfHour.some($=>$<0||$>59)){throw new hf('"byMinuteOfHour" values must be >= 0 && <= 59')}ee.byMinuteOfHour=$.byMinuteOfHour;ee.byMinuteOfHour.sort(hr)}else if(!["MINUTELY","SECONDLY","MILLISECONDLY"].includes($.frequency)){ee.byMinuteOfHour=[ee.start.get("minute")]}},deps:()=>[yB,yQ,yZ,yG]};class y0 extends yz{constructor(){super(...arguments);this.baseGranularity="day";this.granularity="hour";this.option=this.options.byHourOfDay.slice().reverse()}}class y1 extends y${constructor(){super(...arguments);this.baseGranularity="day";this.granularity="hour";this.option=this.options.byHourOfDay}}const y2={name:"ByHourOfDay",get:$=>{if($.options.byHourOfDay===undefined)return null;if($.reverse)return new y0($);return new y1($)},normalizeOptions:($,ee)=>{if($.byHourOfDay!==undefined){if(!yU($.byHourOfDay)){throw new hf('"byHourOfDay" expects a non-empty array')}if($.byHourOfDay.some($=>$<0||$>23)){throw new hf('"byHourOfDay" values must be >= 0 && <= 23')}ee.byHourOfDay=$.byHourOfDay;ee.byHourOfDay.sort(hr)}else if(["YEARLY","MONTHLY","WEEKLY","DAILY"].includes($.frequency)){ee.byHourOfDay=[ee.start.get("hour")]}},deps:()=>[yB,y2,yQ,yZ,yG]};function y6($,ee){return $.add(pB($.get("weekday"),ee),"day")}function y4($,ee,et){let en=$.set("day",1);if(et<0){en=en.add(1,"month")}en=y6(en,ee);return et<0?en.add(et,"week"):en.add(et-1,"week")}class y3 extends yW{run($){const ee=y8($,this.options.byDayOfMonth,this.options.byDayOfWeek);const et=$.get("day");for(const en of ee){if(et>en)continue;if(et===en){return this.validateDate(new hg($))}return this.validateDate(new hm($.granularity("month").set("day",en)))}let en;let ei=$;let eo=0;while(!en&&eo<30){ei=ei.granularity("month").add(1,"month");en=y8(ei,this.options.byDayOfMonth,this.options.byDayOfWeek)[0];eo++}if(eo>=13){throw new hy("byDayOfMonth Infinite while loop")}return this.validateDate(new hm(ei.set("day",en)))}}function y8($,ee,et){const en=$.endGranularity("month").get("day");let ei=ee.filter($=>en>=Math.abs($)).map($=>$>0?$:en+$+1);if(et){const ee=$.granularity("month");const en=[];et.forEach(et=>{if(typeof et==="string"){en.push(...ei.filter($=>ee.set("day",$).get("weekday")===et));return}const eo=y4($,...et).get("day");if(ei.includes(eo)){en.push(eo)}});ei=Array.from(new Set(en))}return ei.sort(($,ee)=>{if($>ee)return 1;if($<ee)return-1;else return 0})}class y5 extends yH{run($){const ee=y8($,this.options.byDayOfMonth,this.options.byDayOfWeek).reverse();const et=$.get("day");for(const en of ee){if(et<en)continue;if(et===en){return this.validateDate(new hg($))}return this.validateDate(new hm($.endGranularity("month").set("day",en)))}let en;let ei=$;let eo=0;while(!en&&eo<30){ei=ei.endGranularity("month").subtract(1,"month");en=y8(ei,this.options.byDayOfMonth,this.options.byDayOfWeek).pop();eo++}if(eo>=13){throw new hy("byDayOfMonth Infinite while loop")}return this.validateDate(new hm(ei.set("day",en)))}}const y9={name:"ByDayOfMonth",get:$=>{if($.options.byDayOfMonth===undefined)return null;if($.reverse)return new y5($);return new y3($)},normalizeOptions:($,ee)=>{if($.byDayOfMonth!==undefined){if($.frequency==="WEEKLY"){throw new hf('when "frequency" is "WEEKLY", "byDayOfMonth" cannot be present')}if(!yU($.byDayOfMonth)){throw new hf('"byDayOfMonth" expects a non-empty array')}if($.byDayOfMonth.some($=>$===0||$<-31||$>31)){throw new hf('"byDayOfMonth" values must be `num !== 0 && num <= 31 && num >= -31`')}ee.byDayOfMonth=$.byDayOfMonth.slice()}else if(!(yU($.byDayOfWeek)||yU($.byDayOfYear))&&["YEARLY","MONTHLY"].includes($.frequency)){ee.byDayOfMonth=[ee.start.get("day")]}},deps:()=>[yB,y9,y2,yQ,yZ,yG]};function y7($,ee,et){let en=$.set("month",1).set("day",1);if(et<0){en=en.add(1,"year")}en=y6(en,ee);return et<0?en.add(et,"week"):en.add(et-1,"week")}function ge($,ee){const et=pB($.get("weekday"),ee);return $.subtract(et===0?0:7-et,"day")}class gt extends yH{run($){if(this.options.frequency==="YEARLY"){return this.options.byMonthOfYear===undefined?this.expandYearly($):this.expandMonthly($)}else if(this.options.frequency==="MONTHLY"){return this.expandMonthly($)}return this.expand($)}expandYearly($){let ee=gr($,this.options.byDayOfWeek)[0];let et=0;let en=$;while(!ee&&et<28){et++;en=en.granularity("year").subtract(1,"millisecond");ee=gr(en,this.options.byDayOfWeek)[0]}if(!ee){throw new hy("The byDayOfWeek rule appears to contain an impossible combination")}return this.result($,ee)}expandMonthly($){let ee=gn($,this.options.byDayOfWeek)[0];let et=0;let en=$;while(!ee&&et<50){et++;en=en.granularity("month").subtract(1,"millisecond");ee=gn(en,this.options.byDayOfWeek)[0]}if(!ee){throw new hy("The byDayOfWeek rule appears to contain an impossible combination")}return this.result($,ee)}expand($){const ee=this.options.byDayOfWeek.map(ee=>ge($,ee)).sort(pL).pop();return this.result($,ee)}result($,ee){if(ee.isEqual($)){return this.validateDate(new hg($))}return this.validateDate(new hm(ee.endGranularity("day")))}}function gr($,ee){const et=ee.filter($=>Array.isArray($)).map(ee=>y7($,...ee));const en=ee.filter($=>typeof $==="string").map(ee=>ge($,ee)).filter(ee=>ee.get("year")===$.get("year"));return px([...et,...en]).filter(ee=>ee.isBeforeOrEqual($)).sort(pL).reverse()}function gn($,ee){const et=ee.filter($=>Array.isArray($)).map(ee=>y4($,...ee));const en=ee.filter($=>typeof $==="string").map(ee=>ge($,ee)).filter(ee=>ee.get("year")===$.get("year")&&ee.get("month")===$.get("month"));return px([...et,...en]).filter(ee=>ee.isBeforeOrEqual($)).sort(pL).reverse()}class gi extends yW{run($){if(this.options.frequency==="YEARLY"){return this.options.byMonthOfYear===undefined?this.expandYearly($):this.expandMonthly($)}else if(this.options.frequency==="MONTHLY"){return this.expandMonthly($)}return this.expand($)}expandYearly($){let ee=ga($,this.options.byDayOfWeek)[0];let et=0;let en=$;while(!ee&&et<28){et++;en=en.granularity("year").add(1,"year");ee=ga(en,this.options.byDayOfWeek)[0]}if(!ee){throw new hy("The byDayOfWeek rule appears to contain an impossible combination")}return this.result($,ee)}expandMonthly($){let ee=go($,this.options.byDayOfWeek)[0];let et=0;let en=$;while(!ee&&et<50){et++;en=en.granularity("month").add(1,"month");ee=go(en,this.options.byDayOfWeek)[0]}if(!ee){throw new hy("The byDayOfWeek rule appears to contain an impossible combination")}return this.result($,ee)}expand($){const ee=this.options.byDayOfWeek.map(ee=>y6($,ee)).sort(pL)[0];return this.result($,ee)}result($,ee){if(ee.isEqual($)){return this.validateDate(new hg($))}return this.validateDate(new hm(ee.granularity("day")))}}function ga($,ee){const et=ee.filter($=>Array.isArray($)).map(ee=>y7($,...ee));const en=ee.filter($=>typeof $==="string").map(ee=>y6($,ee)).filter(ee=>ee.get("year")===$.get("year"));return px([...et,...en]).filter(ee=>ee.isAfterOrEqual($)).sort(pL)}function go($,ee){const et=ee.filter($=>Array.isArray($)).map(ee=>y4($,...ee));const en=ee.filter($=>typeof $==="string").map(ee=>y6($,ee)).filter(ee=>ee.get("year")===$.get("year")&&ee.get("month")===$.get("month"));return px([...et,...en]).filter(ee=>ee.isAfterOrEqual($)).sort(pL)}const gs={name:"ByDayOfWeek",get:$=>{if($.options.byDayOfWeek===undefined)return null;if($.reverse)return new gt($);return new gi($)},normalizeOptions:($,ee)=>{if($.byDayOfWeek!==undefined){if(!yU($.byDayOfWeek)){throw new hf('"byDayOfWeek" expects a non-empty array')}const et=$.byDayOfWeek.find($=>Array.isArray($)?!pN.WEEKDAYS.includes($[0]):!pN.WEEKDAYS.includes($));if(et){throw new hf(`"byDayOfWeek" expects weedays in the form `+`${JSON.stringify(pN.WEEKDAYS)} but "${et}" was provided`)}if(!["YEARLY","MONTHLY"].includes($.frequency)&&$.byDayOfWeek.some($=>Array.isArray($))){throw new hf('"byDayOfWeek" can only include a numeric value (i.e. `[string, number]`) when the "frequency" is '+'either "MONTHLY" or "YEARLY"')}if($.frequency==="MONTHLY"&&$.byDayOfWeek.some($=>Array.isArray($)&&($[1]<-31||$[1]===0||$[1]>31))){throw new hf('when "frequency" is "MONTHLY", each "byDayOfWeek" can optionally only'+" have a numeric value >= -31 and <= 31 and !== 0")}if($.frequency==="YEARLY"&&$.byDayOfWeek.some($=>Array.isArray($)&&($[1]<-366||$[1]===0||$[1]>366))){throw new hf('when "frequency" is "YEARLY", each "byDayOfWeek" can optionally only'+" have a numeric value >= -366 and <= 366 and !== 0")}ee.byDayOfWeek=$.byDayOfWeek}else if(!yU($.byDayOfMonth)&&$.frequency==="WEEKLY"){ee.byDayOfWeek=[ee.start.get("weekday")]}},deps:()=>[yB,gs,y2,yQ,yZ,yG]};class gu extends yH{constructor(){super(...arguments);this.option=this.processor.options.byMonthOfYear.slice().reverse()}run($){const ee=$.get("month");for(const et of this.option){if(ee<et)continue;if(ee===et){return this.validateDate(new hg($))}return this.validateDate(new hm($.endGranularity("year").set("month",et)))}return this.validateDate(new hm($.endGranularity("year").subtract(1,"year").set("month",this.option[0])))}}class gl extends yW{run($){const ee=$.get("month");for(const et of this.options.byMonthOfYear){if(ee>et)continue;if(ee===et){return this.validateDate(new hg($))}return this.validateDate(new hm($.granularity("year").set("month",et)))}return this.validateDate(new hm($.granularity("year").add(1,"year").set("month",this.options.byMonthOfYear[0])))}}const gf={name:"ByMonthOfYear",get:$=>{if($.options.byMonthOfYear===undefined)return null;if($.reverse){return new gu($)}return new gl($)},normalizeOptions:($,ee)=>{if($.byMonthOfYear!==undefined){if(!yU($.byMonthOfYear)){throw new hf('"byMonthOfYear" expects a non-empty array')}if($.byMonthOfYear.some($=>$<1||$>12)){throw new hf('"byMonthOfYear" values must be `num >= 1 && num >= 12`')}ee.byMonthOfYear=$.byMonthOfYear.slice();ee.byMonthOfYear.sort(hr)}else if(!(yU($.byDayOfMonth)||yU($.byDayOfWeek)||yU($.byDayOfYear))&&$.frequency==="YEARLY"){ee.byMonthOfYear=[ee.start.get("month")]}},deps:()=>[yB,gf,y9,y2,yQ,yZ,yG]};const gd=[yB,gf,y9,gs,y2,yQ,yZ,yG];class gp extends pA{constructor($,ee={}){super(undefined,ee);if(!["UTC",null,undefined].includes(ee.timezone)){throw new pT(`StandardDateAdapter only supports "UTC" and `+`local time zones but "${ee.timezone}" was provided.`)}this._date=new Date($);this.timezone=ee.timezone!==undefined?ee.timezone:null;if(ee.metadata){Object.assign(this.metadata,ee.metadata)}this.assertIsValid()}static isDate($){return Object.prototype.toString.call($)==="[object Date]"}static fromDate($,ee){return new gp($,ee)}static fromJSON($){const ee=[$.year,$.month-1,$.day,$.hour,$.minute,$.second,$.millisecond];let et;switch($.timezone){case"UTC":{et=new gp(new Date(Date.UTC(...ee)),{timezone:"UTC",duration:$.duration});break}case null:{et=new gp(new Date(...ee),{timezone:null,duration:$.duration});break}default:throw new pT("The `StandardDateAdapter` only supports datetimes in "+`UTC or LOCAL (null) time. You provided a JSON object `+`with timezone "${$.timezone}".`)}if($.metadata){Object.assign(et.metadata,$.metadata)}return et}static fromDateTime($){const ee=gp.fromJSON($.toJSON());ee.generators.push(...$.generators);if($.metadata){Object.assign(ee.metadata,$.metadata)}return ee}get date(){return new Date(this._date)}get end(){if(!this.duration)return;if(this._end)return this._end;this._end=gp.fromDateTime(this.toDateTime().add(this.duration,"millisecond")).date;return this._end}set($,ee){if($==="timezone"){if(this.timezone===ee)return this;else{return new gp(this._date,{timezone:ee,duration:this.duration,generators:this.generators})}}else if($==="duration"){if(this.duration===ee)return this;else{return new gp(this._date,{timezone:this.timezone,duration:ee,generators:this.generators})}}throw new he(`Unknown prop "${$}" for StandardDateAdapter#set()`)}valueOf(){return this._date.valueOf()}toJSON(){let $;if(this.timezone==="UTC"){$={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()}}else{$={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()}}if(this.duration){$.duration=this.duration}return $}assertIsValid(){if(!gp.isDate(this._date)||isNaN(this._date.valueOf())){throw new pT("StandardDateAdapter has invalid date.")}else if(![null,"UTC"].includes(this.timezone)){throw new pT("StandardDateAdapter only supports local (null) and UTC timezones but "+`"${this.timezone}" was specified.`)}else if(this.duration&&this.duration<=0){throw new pT("If provided, duration must be greater than 0.")}return true}}gp.hasTimezoneSupport=false;pA.adapter=gp;yf.recurrenceRules=gd;class gh extends Error{}class gy extends Error{}hw.JSON_FN_MAP=new Map;hw.prototype.toJSON=function $($){throw new gy(`To support smaller bundles, ${this.constructor.name}#toJSON() `+`must be manually added. See "@rschedule/json-tools" in the rSchedule docs.`)};hw.fromJSON=function $($,ee){if(typeof $!=="object"||$===null){throw new gh(`Invalid json "${$}"`)}const et=hw.JSON_FN_MAP.get($.type);if(!et){throw new gh(`Unknown rSchedule object type "${$.type}". Have you added a json serializer `+`for "${$.type}"? `+`See "@rschedule/json-tools" in the rSchedule docs.`)}return et($,ee)};function gg($,ee,et){if(!et.data)return;if(et.data===true){ee.data=$.data}else{ee.data=et.data($)}if(ee.data===undefined)delete ee.data}function gm($,ee){hw.JSON_FN_MAP.set($,ee)};hx.prototype.toJSON=function $($={}){const ee={type:"Dates",dates:this.adapters.map($=>$.toJSON())};if(!$.nested)ee.timezone=this.timezone;gg(this,ee,$);return ee};hx.fromJSON=function $($,ee={}){if($.type!=="Dates"){throw new gh("Invalid Dates JSON")}return new hx({dates:$.dates.map($=>pA.adapter.fromJSON($)),data:typeof ee.data==="function"?ee.data($):$.data,timezone:ee.timezone||$.timezone})};gm("Dates",hx.fromJSON);yf.prototype.toJSON=function $($={}){const ee={type:"Rule",config:Object.assign(Object.assign({},ho(this.options)),{start:this.normalizeDateInput(this.options.start).toJSON()})};if(this.options.end){ee.config.end=this.normalizeDateInput(this.options.end).toJSON()}if(!$.nested)ee.timezone=this.timezone;gg(this,ee,$);return ee};yf.fromJSON=function $($,ee={}){const et=Object.assign(Object.assign({},$.config),{start:pA.adapter.fromJSON($.config.start),end:$.config.end&&pA.adapter.fromJSON($.config.end)});return new yf(et,{data:typeof ee.data==="function"?ee.data($):$.data,timezone:ee.timezone||$.timezone})};gm("Rule",yf.fromJSON);yv.prototype.toJSON=function $($={}){const ee={type:"Schedule",rrules:this.rrules.map(ee=>ee.toJSON(Object.assign(Object.assign({},$),{nested:true}))),exrules:this.exrules.map(ee=>ee.toJSON(Object.assign(Object.assign({},$),{nested:true}))),rdates:this.rdates.toJSON(Object.assign(Object.assign({},$),{nested:true})),exdates:this.exdates.toJSON(Object.assign(Object.assign({},$),{nested:true}))};if(!$.nested)ee.timezone=this.timezone;gg(this,ee,$);return ee};yv.fromJSON=function $($,ee={}){if($.type!=="Schedule"){throw new gh("Invalid Schedule JSON")}return new yv({rrules:$.rrules.map(et=>yf.fromJSON(et,Object.assign({timezone:$.timezone},ee))),exrules:$.exrules.map(et=>yf.fromJSON(et,Object.assign({timezone:$.timezone},ee))),rdates:hx.fromJSON($.rdates,Object.assign({timezone:$.timezone},ee)),exdates:hx.fromJSON($.exdates,Object.assign({timezone:$.timezone},ee)),data:typeof ee.data==="function"?ee.data($):$.data,timezone:ee.timezone||$.timezone})};gm("Schedule",yv.fromJSON);;function g_($,ee,et){if(!$){throw new lK(ee,et)}}function gv($){try{let ee=p_($);return{type:"recur",schedule:new yv({rrules:ee,data:{skipWeekend:$.skipWeekend,weekendSolve:$.weekendSolveMode}})}}catch($){throw new lK("parse-recur-date",$.message)}}function gw($){if(typeof $!=="string"){return null}else if($.length===10){if(!eA(rv($))){return null}return{type:"date",date:$}}else if($.length===7){if(!eA(rv($+"-01"))){return null}return{type:"month",date:$}}else if($.length===4){if(!eA(rv($+"-01-01"))){return null}return{type:"year",date:$}}return null}function gE($){let{num1:ee,num2:et}=$;if(typeof ee!=="number"||typeof et!=="number"){return null}return{type:"between",num1:ee,num2:et}}let gS={date:{ops:["is","isapprox","gt","gte","lt","lte"],nullable:false,parse($,ee,et){let en=typeof ee==="string"?gw(ee):ee.frequency!=null?gv(ee):null;g_(en,"date-format",`Invalid date format (field: ${et})`);if($==="isapprox"){g_(en.type==="date"||en.type==="recur","date-format",`Invalid date value for “isapprox” (field: ${et})`)}else if($==="gt"||$==="gte"||$==="lt"||$==="lte"){g_(en.type==="date","date-format",`Invalid date value for “${$}” (field: ${et})`)}return en}},id:{ops:["is","contains","oneOf","isNot","doesNotContain","notOneOf"],nullable:true,parse($,ee,et){if($==="oneOf"||$==="notOneOf"){g_(Array.isArray(ee),"no-empty-array",`oneOf must have an array value (field: ${et})`);return ee}return ee}},string:{ops:["is","contains","oneOf","isNot","doesNotContain","notOneOf"],nullable:true,parse($,ee,et){if($==="oneOf"||$==="notOneOf"){g_(Array.isArray(ee),"no-empty-array",`oneOf must have an array value (field: ${et}): ${JSON.stringify(ee)}`);return ee.filter(Boolean).map($=>$.toLowerCase())}if($==="contains"||$==="doesNotContain"){g_(typeof ee==="string"&&ee.length>0,"no-empty-string",`contains must have non-empty string (field: ${et})`)}return ee.toLowerCase()}},number:{ops:["is","isapprox","isbetween","gt","gte","lt","lte"],nullable:false,parse($,ee,et){let en=typeof ee==="number"?{type:"literal",value:ee}:gE(ee);g_(en!=null,"not-number",`Value must be a number or between amount: ${JSON.stringify(ee)} (field: ${et})`);if($==="isbetween"){g_(en.type==="between","number-format",`Invalid between value for “${$}” (field: ${et})`)}else{g_(en.type==="literal","number-format",`Invalid number value for “${$}” (field: ${et})`)}return en}},boolean:{ops:["is"],nullable:false,parse($,ee,et){g_(typeof ee==="boolean","not-boolean",`Value must be a boolean: ${ee} (field: ${et})`);return ee}}};class gT{field;op;options;rawValue;type;unparsedValue;value;constructor($,ee,et,en,ei){let eo=ei.get(ee);g_(eo,"internal","Invalid condition field: "+ee);let es=gS[eo];g_(es,"internal",`Invalid condition type: ${eo} (field: ${ee})`);g_(es.ops.includes($),"internal",`Invalid condition operator: ${$} (type: ${eo}, field: ${ee})`);if(es.nullable!==true){g_(et!=null,"no-null",`Field cannot be empty: ${ee}`)}if(eo==="string"&&es.nullable!==true){g_(et!=="","no-null",`Field cannot be empty: ${ee}`)}this.rawValue=et;this.unparsedValue=et;this.op=$;this.field=ee;this.value=es.parse?es.parse($,et,ee):et;this.options=en;this.type=eo}eval($){let ee=$[this.field];if(ee===undefined){return false}if(typeof ee==="string"){ee=ee.toLowerCase()}let et=this.type;if(et==="number"&&this.options){if(this.options.outflow){if(ee>0){return false}ee=-ee}else if(this.options.inflow){if(ee<0){return false}}}let en=$=>et==="number"?$.value:$;switch(this.op){case"isapprox":case"is":if(et==="date"){if(ee==null){return false}if(this.value.type==="recur"){let{schedule:$}=this.value;if(this.op==="isapprox"){let et=nT(ee);return $.occursBetween(nt(et,2),r9(et,2))}else{return $.occursOn({date:nT(ee)})}}else{let{date:$}=this.value;if(this.op==="isapprox"){let et=nT($);let en=nF(et,2);let ei=nB(et,2);return ee>=ei&&ee<=en}else{switch(this.value.type){case"date":return ee===$;case"month":return nA(ee)===$;case"year":return nO(ee)===$;default:}}}}else if(et==="number"){let $=this.value.value;if(this.op==="isapprox"){let et=po($);return ee>=$-et&&ee<=$+et}return ee===$}return ee===this.value;case"isNot":return ee!==this.value;case"isbetween":{let[$,et]=pt(this.value.num1,this.value.num2);return ee>=$&&ee<=et}case"contains":if(ee===null){return false}return ee.indexOf(this.value)!==-1;case"doesNotContain":if(ee===null){return false}return ee.indexOf(this.value)===-1;case"oneOf":if(ee===null){return false}return this.value.indexOf(ee)!==-1;case"notOneOf":if(ee===null){return false}return this.value.indexOf(ee)===-1;case"gt":if(ee===null){return false}else if(et==="date"){return nj(ee,this.value.date)}return ee>en(this.value);case"gte":if(ee===null){return false}else if(et==="date"){return ee===this.value.date||nj(ee,this.value.date)}return ee>=en(this.value);case"lt":if(ee===null){return false}else if(et==="date"){return nU(ee,this.value.date)}return ee<en(this.value);case"lte":if(ee===null){return false}else if(et==="date"){return ee===this.value.date||nU(ee,this.value.date)}return ee<=en(this.value);default:}return false}getValue(){return this.value}serialize(){return{op:this.op,field:this.field,value:this.unparsedValue,type:this.type,...this.options?{options:this.options}:null}}}let gO=["set","link-schedule"];class gA{field;op;options;rawValue;type;value;constructor($,ee,et,en,ei){g_(gO.includes($),"internal",`Invalid action operation: ${$}`);if($==="set"){let $=ei.get(ee);g_($,"internal",`Invalid field for action: ${ee}`);this.field=ee;this.type=$}else if($==="link-schedule"){this.field=null;this.type="id"}this.op=$;this.rawValue=et;this.value=et;this.options=en}exec($){switch(this.op){case"set":$[this.field]=this.value;break;case"link-schedule":$.schedule=this.value;break;default:}}serialize(){return{op:this.op,field:this.field,value:this.value,type:this.type,...this.options?{options:this.options}:null}}}class gI{actions;conditions;conditionsOp;id;stage;constructor({id:$,stage:ee,conditionsOp:et,conditions:en,actions:ei,fieldTypes:eo}){this.id=$;this.stage=ee;this.conditionsOp=et;this.conditions=en.map($=>new gT($.op,$.field,$.value,$.options,eo));this.actions=ei.map($=>new gA($.op,$.field,$.value,$.options,eo))}evalConditions($){if(this.conditions.length===0){return false}const ee=this.conditionsOp==="or"?"some":"every";return this.conditions[ee](ee=>{return ee.eval($)})}execActions($){let ee={};this.actions.forEach($=>$.exec(ee));return ee}exec($){if(this.evalConditions($)){return this.execActions($)}return null}apply($){let ee=this.exec($);return Object.assign({},$,ee)}getId(){return this.id}serialize(){return{id:this.id,stage:this.stage,conditionsOp:this.conditionsOp,conditions:this.conditions.map($=>$.serialize()),actions:this.actions.map($=>$.serialize())}}}class gN{field;method;rules;constructor({field:$,method:ee}){this.field=$;this.method=ee;this.rules=new Map}getIndex($){if(!this.rules.has($)){this.rules.set($,new Set)}return this.rules.get($)}getIndexForValue($){return this.getIndex(this.getKey($)||"*")}getKey($){if(typeof $==="string"&&$!==""){if(this.method==="firstchar"){return $[0].toLowerCase()}return $.toLowerCase()}return null}getIndexes($){let ee=$.conditions.find($=>$.field===this.field);let et=[];if(ee&&(ee.op==="oneOf"||ee.op==="is"||ee.op==="isNot"||ee.op==="notOneOf")){if(ee.op==="oneOf"||ee.op==="notOneOf"){ee.value.forEach($=>et.push(this.getIndexForValue($)))}else{et.push(this.getIndexForValue(ee.value))}}else{et.push(this.getIndex("*"))}return et}index($){let ee=this.getIndexes($);ee.forEach(ee=>{ee.add($)})}remove($){let ee=this.getIndexes($);ee.forEach(ee=>{ee.delete($)})}getApplicableRules($){let ee;if(this.field in $){let et=this.getKey($[this.field]);if(et){ee=this.rules.get(et)}}return iw(ee||new Set,this.rules.get("*")||new Set)}}const gD={is:10,oneOf:9,isapprox:5,isbetween:5,gt:1,gte:1,lt:1,lte:1,contains:0};function gR($){let ee=$.conditions.reduce(($,ee)=>{if(gD[ee.op]==null){console.log(`Found invalid operation while ranking: ${ee.op}`);return 0}return $+gD[ee.op]},0);if($.conditions.every($=>$.op==="is"||$.op==="isNot"||$.op==="isapprox"||$.op==="oneOf"||$.op==="notOneOf")){return ee*2}return ee}function gC($){let ee=new Map;$.forEach($=>{ee.set($,gR($))});return[...$].sort(($,et)=>{let en=ee.get($);let ei=ee.get(et);if(en<ei){return-1}else if(en>ei){return 1}else{let ee=$.getId();let en=et.getId();return ee<en?-1:ee>en?1:0}})}function gk($){let ee=[];let et=[];let en=[];for(let ei of $){switch(ei.stage){case"pre":ee.push(ei);break;case"post":en.push(ei);break;default:et.push(ei)}}ee=gC(ee);et=gC(et);en=gC(en);return ee.concat(et).concat(en)}function gM($,ee){for(let et=0;et<$.conditions.length;et++){let en=$.conditions[et];if(en.type==="id"){switch(en.op){case"is":en.value=ee.get(en.rawValue)||en.rawValue;en.unparsedValue=en.value;break;case"isNot":en.value=ee.get(en.rawValue)||en.rawValue;en.unparsedValue=en.value;break;case"oneOf":en.value=en.rawValue.map($=>ee.get($)||$);en.unparsedValue=[...en.value];break;case"notOneOf":en.value=en.rawValue.map($=>ee.get($)||$);en.unparsedValue=[...en.value];break;default:}}}for(let et=0;et<$.actions.length;et++){let en=$.actions[et];if(en.type==="id"){if(en.op==="set"){en.value=ee.get(en.rawValue)||en.rawValue}}}}function gL($,ee,et){let en;s:for(en=0;en<$.length;en++){let ei=$[en];for(let $=0;$<ei.conditions.length;$++){let en=ei.conditions[$];if(en.type==="id"&&en.field===ee){switch(en.op){case"is":if(et(ei,en.value)){continue s}break;case"isNot":if(et(ei,en.value)){continue s}break;case"oneOf":for(let $=0;$<en.value.length;$++){if(et(ei,en.value[$])){continue s}}break;case"notOneOf":for(let $=0;$<en.value.length;$++){if(et(ei,en.value[$])){continue s}}break;default:}}}for(let $=0;$<ei.actions.length;$++){let en=ei.actions[$];if(en.type==="id"&&en.field===ee){if(en.op==="set"){if(et(ei,en.value)){break}}}}}};async function gx($){return f3("SELECT * FROM payees WHERE transfer_acct = ?",[$])}async function gP($){if($.payee){let{transfer_acct:ee}=await f3("SELECT id, transfer_acct FROM v_payees WHERE id = ?",[$.payee]);return ee}return null}async function gF($,ee){const{offbudget:et}=await f3("SELECT offbudget FROM accounts WHERE id = ?",[$.account]);const{offbudget:en}=await f3("SELECT offbudget FROM accounts WHERE id = ?",[ee]);if(et===en){await dH({id:$.id,category:null});return true}return false}async function gB($,ee){if($.is_parent){return null}let{id:et}=await f3("SELECT id FROM payees WHERE transfer_acct = ?",[$.account]);if($.parent_id){let ee=await f3(`
|
|
186
186
|
SELECT p.id, p.transfer_acct FROM v_transactions t
|
|
187
187
|
LEFT JOIN payees p ON p.id = t.payee
|
|
188
188
|
WHERE t.id = ?
|
|
189
|
-
`,[$.parent_id]);if(ee.transfer_acct){if(ee.id!==$.payee){await
|
|
189
|
+
`,[$.parent_id]);if(ee.transfer_acct){if(ee.id!==$.payee){await dH({id:$.id,payee:null});return{id:$.id,payee:null}}}}const en=await dW({account:ee,amount:-$.amount,payee:et,date:$.date,transfer_id:$.id,notes:$.notes||null,cleared:false});await dH({id:$.id,transfer_id:en});const ei=await gF($,ee);return{id:$.id,transfer_id:en,...ei?{category:null}:{}}}async function gU($){let ee=await dB($.transfer_id);if(ee){if(ee.is_child){await dH({id:$.transfer_id,transfer_id:null,payee:null})}else{await dz({id:$.transfer_id})}}await dH({id:$.id,transfer_id:null});return{id:$.id,transfer_id:null}}async function gj($,ee){let et=await gx($.account);await dH({id:$.transfer_id,account:ee,payee:et.id,date:$.date,notes:$.notes,amount:-$.amount});const en=await gF($,ee);if(en){return{id:$.id,category:null}}}async function gW($){let ee=await gP($);if(ee){return gB($,ee)}}async function gH($){if($.transfer_id){await gU($)}}async function gz($){const ee=await gP($);if($.is_parent){return gU($)}if(ee&&!$.transfer_id){return gB($,ee)}if(!ee&&$.transfer_id){return gU($)}if(ee&&$.transfer_id){return gj($,ee)}};async function gV($){let ee=us($,"parent_id");let et=await f4(`SELECT id FROM v_transactions_internal WHERE ${ee}`);let en=new Set($);for(let $ of et){en.add($.id)}return[...en]}async function g$($){return uo(($,ee)=>di("transactions",$,ee),$,$=>`id = '${$}'`,$=>`SELECT * FROM v_transactions_internal WHERE ${$}`)}async function gq({added:$,deleted:ee,updated:et,learnCategories:en=false,detectOrphanPayees:ei=true}){let eo=[];let es=et?et.map($=>$.id):[];let eu=ee?await gV(ee.map($=>$.id)):[];let el=new Set;let ef=await f4("SELECT * FROM accounts WHERE tombstone = 0");if(et){let $=et.filter($=>$.payee).map($=>$.id);let ee=await g$($);for(let $=0;$<ee.length;$++){el.add(ee[$].payee)}}await fD(async()=>{if($){eo=await Promise.all($.map(async $=>dW($)))}if(ee){await Promise.all(eu.map(async $=>{await dz({id:$})}))}if(et){await Promise.all(et.map(async $=>{if($.account){let ee=ef.find(ee=>ee.id===$.account);if(ee.offbudget===1){$.category=null}}await dH($)}))}});let ed=await g$(eo);let ep=await g$(es);let eh=await g$(eu);let ey=ed;let eg;await fD(async()=>{await Promise.all(ed.map($=>gW($)));eg=(await Promise.all(ep.map($=>gz($)))).filter(Boolean);await Promise.all(eh.map($=>gH($)))});if(en){let ee=new Set([...$?$.filter($=>$.category).map($=>$.id):[],...et?et.filter($=>$.category).map($=>$.id):[]]);await mg(ed.concat(ep).filter($=>ee.has($.id)))}if(ei){if(et){let $=et.map($=>$.payee).filter(Boolean);if($.length>0){let ee=new Set(await dC());let et=[...el].filter($=>ee.has($));if(et.length>0){aX("orphaned-payees",{orphanedIds:et,updatedPayeeIds:$})}}}}return{added:ey,updated:eg}};let gG;let gY;let gK;let gZ;function gJ(){gG=new Map;gK=new gN({field:"imported_payee",method:"firstchar"});gZ=new gN({field:"payee"})}function gX($){return Object.fromEntries(Object.entries($).map($=>{return[$[1],$[0]]}))}let gQ=sJ.views.transactions.fields;let g0=gX(sJ.views.transactions.fields);function g1($){return{...$,field:g0[$.field]||$.field}}function g2($){return{...$,field:gQ[$.field]||$.field}}function g6($){let ee;try{ee=typeof $==="string"?JSON.parse($):$}catch($){throw new lK("internal","Cannot parse rule json")}if(!Array.isArray(ee)){throw new lK("internal","Rule json must be an array")}return ee}function g4($){return $?g6($).map($=>g1($)):[]}function g3($){return JSON.stringify($.map($=>g2($)))}const g8={validate($,{update:ee}={}){oY("rules",$,["conditions","actions"],ee);if(!ee||"stage"in $){if($.stage!=="pre"&&$.stage!=="post"&&$.stage!==null){throw new Error("Invalid rule stage: "+$.stage)}}if(!ee||"conditionsOp"in $){if(!["and","or"].includes($.conditionsOp)){throw new Error("Invalid rule conditionsOp: "+$.conditionsOp)}}return $},toJS($){let{conditions:ee,conditions_op:et,actions:en,...ei}=$;return{...ei,conditionsOp:et,conditions:g4(ee),actions:g4(en)}},fromJS($){let{conditions:ee,conditionsOp:et,actions:en,...ei}=$;if(et){ei.conditions_op=et}if(Array.isArray(ee)){ei.conditions=g3(ee)}if(Array.isArray(en)){ei.actions=g3(en)}return ei}};function g5($){let ee;try{ee=new gI({...g8.toJS($),fieldTypes:d3})}catch($){console.warn("Invalid rule",$);if($ instanceof lK){return null}throw $}gM(ee,pf());return ee}async function g9(){gJ();let $=await f4(`
|
|
190
190
|
SELECT * FROM rules
|
|
191
191
|
WHERE conditions IS NOT NULL AND actions IS NOT NULL AND tombstone = 0
|
|
192
|
-
`);for(let ee=0;ee<$.length;ee++){let et=$[ee];if(et.stage==="cleanup"||et.stage==="modify"){et.stage="pre"}let en=
|
|
192
|
+
`);for(let ee=0;ee<$.length;ee++){let et=$[ee];if(et.stage==="cleanup"||et.stage==="modify"){et.stage="pre"}let en=g5(et);if(en){gG.set(en.id,en);gK.index(en);gZ.index(en)}}if(gY){gY()}gY=fw(mi)}function g7(){return[...gG.values()]}async function mt($){$=g8.validate($);return de("rules",g8.fromJS($))}async function mr($){$=g8.validate($,{update:true});return f7("rules",g8.fromJS($))}async function mn($){let ee=await f3("SELECT id FROM schedules WHERE rule = ?",[$.id]);if(ee){return false}return dn("rules",$.id)}function mi($,ee){ee.forEach(($,ee)=>{if(ee==="rules"){$.forEach($=>{let ee=gG.get($.id);if($.tombstone===1){let ee=gG.get($.id);if(ee){gG.delete(ee.getId());gK.remove(ee);gZ.remove(ee)}}else{let et=g5($);if(et){if(ee){gK.remove(ee);gZ.remove(ee)}gG.set($.id,et);gK.index(et);gZ.index(et)}}})}});let et=[...ee.keys()];if(et.find($=>$.indexOf("mapping")!==-1)){g7().forEach($=>{gM($,pf())})}}function mo($){let ee={...$};let et=gk(iw(gK.getApplicableRules($),gZ.getApplicableRules($)));for(let $=0;$<et.length;$++){ee=et[$].apply(ee)}return ee}function ms($,{recurDateBounds:ee=100}={}){let et=[];$=$.map($=>{if($ instanceof gT){return $}try{return new gT($.op,$.field,$.value,$.options,d3)}catch($){et.push($.type||"internal");console.log("conditionsToAQL: invalid condition: "+$.message);return null}}).filter(Boolean);let en=$.map($=>{let{type:et,field:en,op:ei,value:eo,options:es}=$;let eu=$=>{if(et==="number"){return $.value}return $};let el=($,ee,en)=>{if(et==="number"){if(es){if(es.outflow){return{$and:[{amount:{$lt:0}},{[$]:{$transform:"$neg",[ee]:en}}]}}else if(es.inflow){return{$and:[{amount:{$gt:0}},{[$]:{[ee]:en}}]}}}return{amount:{[ee]:en}}}else if(et==="string"){return{[$]:{$transform:"$lower",[ee]:en}}}else if(et==="date"){return{[$]:{[ee]:en.date}}}return{[$]:{[ee]:en}}};switch(ei){case"isapprox":case"is":if(et==="date"){if(eo.type==="recur"){let $=eo.schedule.occurrences({take:ee}).toArray().map($=>nI($.date));return{$or:$.map($=>{if(ei==="isapprox"){return{$and:[{date:{$gte:nB($,2)}},{date:{$lte:nF($,2)}}]}}return{date:$}})}}else{if(ei==="isapprox"){let $=nT(eo.date);let ee=nF($,2);let et=nB($,2);return{$and:[{date:{$gte:et}},{date:{$lte:ee}}]}}else{switch(eo.type){case"date":return{date:eo.date};case"month":{let $=eo.date+"-00";let ee=eo.date+"-99";return{$and:[{date:{$gte:$}},{date:{$lte:ee}}]}}case"year":{let $=eo.date+"-00-00";let ee=eo.date+"-99-99";return{$and:[{date:{$gte:$}},{date:{$lte:ee}}]}}default:}}}}else if(et==="number"){let $=eo.value;if(ei==="isapprox"){let ee=po($);return{$and:[el(en,"$gte",$-ee),el(en,"$lte",$+ee)]}}return el(en,"$eq",$)}else if(et==="string"){if(eo===""){return{$or:[el(en,"$eq",null),el(en,"$eq","")]}}}return el(en,"$eq",eo);case"isNot":return el(en,"$ne",eo);case"isbetween":let[ef,ed]=pt(eo.num1,eo.num2);return{[en]:[{$gte:ef},{$lte:ed}]};case"contains":return el(et==="id"?en+".name":en,"$like","%"+eo+"%");case"doesNotContain":return el(et==="id"?en+".name":en,"$notlike","%"+eo+"%");case"oneOf":let ep=eo;if(ep.length===0){return{id:null}}return{$or:ep.map($=>el(en,"$eq",$))};case"notOneOf":let eh=eo;if(eh.length===0){return{id:null}}return{$and:eh.map($=>el(en,"$ne",$))};case"gt":return el(en,"$gt",eu(eo));case"gte":return el(en,"$gte",eu(eo));case"lt":return el(en,"$lt",eu(eo));case"lte":return el(en,"$lte",eu(eo));case"true":return el(en,"$eq",true);case"false":return el(en,"$eq",false);default:throw new Error("Unhandled operator: "+ei)}});return{filters:en,errors:et}}function mu($,ee){let et=ee.map($=>{if($ instanceof gA){return $}try{if($.op==="link-schedule"){return new gA($.op,null,$.value,null,d3)}return new gA($.op,$.field,$.value,$.options,d3)}catch($){console.log("Action error",$);return null}}).filter(Boolean);if(et.length!==ee.length){return null}let en=$.map($=>{let ee={id:$};for(let $ of et){$.exec(ee)}return ee});return gq({updated:en})}function ml($){let ee=new Set;gL(g7(),"payee",(et,en)=>{if(en===$){ee.add(et)}});return gk([...ee])}function*mf($,ee,et,{condValue:en,actionValue:ei}){let eo=g7();for(let es=0;es<eo.length;es++){let eu=eo[es];if(eu.stage===$&&eu.actions.length===1&&eu.actions[0].op==="set"&&eu.actions[0].field===et&&(ei===undefined||eu.actions[0].value===ei)&&eu.conditions.length===1&&(eu.conditions[0].op==="is"||eu.conditions[0].op==="isNot")&&eu.conditions[0].field===ee&&(en===undefined||eu.conditions[0].value===en)){yield eu.serialize()}}return null}function*md($,ee,et,{condValue:en,actionValue:ei}){let eo=g7();for(let es=0;es<eo.length;es++){let eu=eo[es];if(eu.stage===$&&eu.actions.length===1&&eu.actions[0].op==="set"&&eu.actions[0].field===et&&(ei==null||eu.actions[0].value===ei)&&eu.conditions.length===1&&(eu.conditions[0].op==="oneOf"||eu.conditions[0].op==="oneOf")&&eu.conditions[0].field===ee&&(en==null||eu.conditions[0].value.indexOf(en)!==-1)){yield eu.serialize()}}return null}async function mp($,ee){let et=md("pre","imported_payee","payee",{actionValue:ee}).next().value;if(et){let ee=et.conditions[0];let en=[...iw(new Set(ee.value),new Set($.filter($=>$!=="")))];let ei={...et,conditions:[{...ee,value:en}]};await mr(ei);return et.id}else{let et=new gI({stage:"pre",conditionsOp:"and",conditions:[{op:"oneOf",field:"imported_payee",value:$}],actions:[{op:"set",field:"payee",value:ee}],fieldTypes:d3});return mt(et.serialize())}}function my($){let ee=new Map;$.forEach($=>{if($.category){ee.set($.category,(ee.get($.category)||0)+1)}});let et=$.reduce(($,et)=>{let en=ee.get(et.category);if(!$||en>$.score){return{score:en,category:et.category}}return $},null);return et.score>=3?et.category:null}async function mg($){if($.length===0){return}let ee=new Set($.map($=>$.payee));let et=new Set($.map($=>$.id));let en=null;for(let ee=0;ee<$.length;ee++){if(en===null||$[ee].date<en){en=$[ee].date}}en=nB(en,180);let ei=await f4(`SELECT t.* FROM v_transactions t
|
|
193
193
|
LEFT JOIN accounts a ON a.id = t.account
|
|
194
194
|
WHERE date >= ? AND date <= ? AND is_parent = 0 AND a.closed = 0
|
|
195
|
-
ORDER BY date DESC`,[
|
|
196
|
-
WHERE date >= ? AND date <= ? AND amount = ? AND account = ? AND is_child = 0`,[
|
|
197
|
-
WHERE date >= ? AND date <= ? AND amount = ? AND account = ? AND is_child = 0`,[
|
|
198
|
-
WHERE a.offbudget = 0 AND t.is_child = 0 ORDER BY date ASC LIMIT 1`)).date;let eo=(await
|
|
199
|
-
WHERE a.id = ? AND a.offbudget = 0 AND t.is_child = 0 ORDER BY date ASC LIMIT 1`,[en.id])).date;let es=nA(oY(ei));let eu=nN();let el=nV(es,eu);function ef($){for(let ee of et){let et=ee.categories.find(ee=>ee.name===$);if(et){return et}}}function ed($,ee,et){return u4({month:$,category:ee.id,amount:et})}function ep($,ee){let et=uq(nQ($),`sum-amount-${ee.id}`);if(et<0){ed($,ee,-et)}}await aV(()=>fI(async()=>{for(let $ of el){if($>=nA(oY(eo))){ed($,ef("Food"),4e4);ed($,ef("Restaurants"),3e4);ed($,ef("Entertainment"),1e4);ed($,ef("Clothing"),3e3);ed($,ef("General"),5e4);ed($,ef("Gift"),7500);ed($,ef("Medical"),1e4);ed($,ef("Cell"),7500);ed($,ef("Internet"),6e3);ed($,ef("Mortgage"),12e4);ed($,ef("Water"),9e3);ed($,ef("Power"),1e4)}else{ep($,ef("Food"));ep($,ef("Restaurants"));ep($,ef("Entertainment"));ep($,ef("Clothing"));ep($,ef("General"));ep($,ef("Gift"));ep($,ef("Medical"));ep($,ef("Cell"));ep($,ef("Internet"));ep($,ef("Mortgage"));ep($,ef("Water"));ep($,ef("Power"))}}}));await uK();await aV(()=>fI(async()=>{let $=0;for(let ee of el){if(ee>=nA(oY(eo))&&ee<=nN()){let et=nQ(ee);let en=uq(et,"to-budget");let ei=en-$;if(ei-403e3>0){ed(ee,ef("Savings"),ei-403e3);u3(ee,403e3);$+=ei-403e3}else if(ei>0){u3(ee,ei)}}}}));await uK();let eh=nQ(nN());let ey=uq(eh,"to-budget");if(ey<0){await mk(en.id,[{amount:-ey,category:ef("Income").id,date:nN()+"-01"}])}await uK()}async function mQ(ee){fl("import");await fZ("PRAGMA journal_mode = OFF");await fK("DELETE FROM categories;");await fK("DELETE FROM category_groups");let et=[{name:"Bank of America"},{name:"Ally Savings"},{name:"Capital One Checking"},{name:"HSBC"},{name:"Vanguard 401k",offBudget:1},{name:"Mortgage",offBudget:1},{name:"House Asset",offBudget:1},{name:"Roth IRA",offBudget:1}];await aV(()=>fI(async()=>{for(let $ of et){$.id=await ee["account-create"]($)}}));let en=[{name:"Starting Balance"},{name:"Kroger"},{name:"Publix"},{name:"Home Depot"},{name:"Movies"},{name:"Online store"},{name:"Deposit"},{name:"Dominion Power",bill:true},{name:"Extra Watery",bill:true},{name:"Housy House",bill:true},{name:"Fast Internet",bill:true},{name:"T-mobile",bill:true}];await aV(()=>fI(async()=>{for(let $ of en){$.id=await ee["payee-create"]({name:$.name})}}));let ei=[{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:true,categories:[{name:"Income",is_income:true},{name:"Misc",is_income:true},{name:"Starting Balances",is_income:true}]}];await aV(async()=>{for(let $ of ei){$.id=await ee["category-group-create"]({name:$.name,isIncome:$.is_income?1:0});for(let et of $.categories){et.id=await ee["category-create"]({...et,isIncome:et.is_income?1:0,groupId:$.id})}}});let eo=(await aj(ee["get-categories"])).grouped;fl("import");await aV(()=>fI(async()=>{for(let $ of et){if($.name==="Bank of America"){await mq(ee,$,en,eo)}else if($.name==="Capital One Checking"||$.name==="HSBC"){await mG(ee,$,en,eo)}else if($.name==="Ally Savings"){await mK(ee,$,en,eo)}else if($.name==="Vanguard 401k"||$.name==="Roth IRA"){await mY(ee,$,en,eo)}else if($.name==="Mortgage"){await mZ(ee,$,en,eo)}else if($.name==="House Asset"){await mJ(ee,$,en,eo)}else{console.error("Unknown account name for test budget: ",$.name);await mG(ee,$,en,eo)}}}));fl("import");let es=et.find($=>$.name="Bank of America");let{data:eu}=await uh(sX("transactions").filter({account:es.id}).calculate({$sum:"$amount"}).serialize());if(eu<0){let{data:$}=await uh(sX("transactions").filter({account:es.id,amount:{$gt:0}}).limit(1).select(["id","amount"]).serialize());let et=$[0];await aj(ee["transaction-update"],{...et,amount:et.amount+-eu+mH(1e4,2e4)})}fl("disabled");await uT({isCached:false});await uz($);await lW();await uK();await aV(()=>fI(async()=>{const $=et.find($=>$.name==="Bank of America");await aj(ee["schedule/create"],{schedule:{name:"Phone bills",posts_transaction:false},conditions:[{op:"is",field:"payee",value:en.find($=>$.name==="Dominion Power").id},{op:"is",field:"account",value:$.id},{op:"is",field:"date",value:{start:nR(),frequency:"monthly",patterns:[],skipWeekend:false,weekendSolveMode:"after"}},{op:"isapprox",field:"amount",value:-12e3}]});await aj(ee["schedule/create"],{schedule:{name:"Internet bill",posts_transaction:false},conditions:[{op:"is",field:"payee",value:en.find($=>$.name==="Fast Internet").id},{op:"is",field:"account",value:$.id},{op:"is",field:"date",value:nB(nR(),1)},{op:"isapprox",field:"amount",value:-14e3}]});await aj(ee["schedule/create"],{schedule:{name:"Wedding",posts_transaction:false},conditions:[{op:"is",field:"date",value:{start:nB(nR(),3),frequency:"monthly",patterns:[],skipWeekend:false,weekendSolveMode:"after"}},{op:"is",field:"amount",value:-27e5}]});await aj(ee["schedule/create"],{schedule:{name:"Utilities",posts_transaction:false},conditions:[{op:"is",field:"account",value:$.id},{op:"is",field:"date",value:{start:nF(nR(),1),frequency:"monthly",patterns:[],skipWeekend:false,weekendSolveMode:"after"}},{op:"is",field:"amount",value:-19e4}]})}));await mX(et,en,eo)};function m0(){return String({}.REACT_APP_NETLIFY)==="true"}function m6(){return"production"==="development"}function m4(){return m0()||m6()}function m3(){if(navigator.userAgent.indexOf("Electron")>=0){return true}return false}var m8=__webpack_require__(7565);var m5=__webpack_require__.n(m8);async function m9($,ee,et,en){const ei=ee.reduce(($,{id:ee,name:et})=>{$[ee]=et;return $},{});const eo=et.reduce(($,{name:ee,categories:et})=>{et.forEach(et=>$[et.id]=`${ee}: ${et.name}`);return $},{});const es=en.reduce(($,{id:ee,name:et})=>{$[ee]=et;return $},{});const eu=$.map(({account:$,date:ee,payee:et,notes:en,category:eu,amount:el})=>({Account:ei[$],Date:ee,Payee:es[et],Notes:en,Category:eo[eu],Amount:el==null?0:iP(el)}));return m5()(eu,{header:true})}async function m7($){let{data:ee}=await uh($.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"}));let et=new Map;for(let $ of ee){if($.IsParent){et.set($.Id,$.Payee)}}let en=ee.filter($=>!$.IsParent);let ei=en.map($=>{return{Account:$.Account,Date:$.Date,Payee:$.ParentId?et.get($.ParentId):$.Payee,Notes:$.Notes,Category:$.Category,Amount:$.Amount==null?0:iP($.Amount)}});return m5()(ei,{header:true})};async function _t($,ee){let[[,et],[,en]]=await r6(["user-id","user-key"]);if($==null||!$.institution_id||!$.name){throw new Error("Invalid institution object")}let ei=e_();await l4(ce().PLAID_SERVER+"/handoff_public_token",{userId:et,key:en,item_id:ei,public_token:ee});await aV(()=>f9("banks",{id:ei,bank_id:$.institution_id,name:$.name}));return ei}async function _r($,ee){let et=await f6("SELECT id, bank_id, name FROM banks WHERE bank_id = ?",[ee]);if(et){return et}const en={id:e_(),bank_id:ee,name:$.name};await f9("banks",en);return en}async function _o($,ee,et=[]){let[[,en],[,ei]]=await r6(["user-id","user-key"]);let eo=await mv(en,ei,$);eo=eo.filter($=>ee.includes($.account_id));return Promise.all(eo.map(async ee=>{let eo=await aV(async()=>{let en=await dk({account_id:ee.account_id,name:ee.name,official_name:ee.official_name,balance_current:ix(ee.balances.current),mask:ee.mask,bank:$,offbudget:et.includes(ee.account_id)?1:0});await dE({name:"",transfer_acct:en});return en});await mx(en,ei,eo,ee.account_id,$);return eo}))}async function _u($,ee,et=[]){let[[,en],[,ei]]=await r6(["user-id","user-key"]);let eo=await mw(en,ei,$);eo=eo.filter($=>ee.includes($.account_id));return Promise.all(eo.map(async ee=>{let eo=await aV(async()=>{let en=await dk({account_id:ee.account_id,name:ee.name,official_name:ee.official_name,balance_current:ix(ee.balances.current),mask:ee.mask,bank:$,offbudget:et.includes(ee.account_id)?1:0});await dE({name:"",transfer_acct:en});return en});await mM(en,ei,eo,ee.account_id,$);return eo}))}var _l=__webpack_require__(6241);var _c=__webpack_require__.n(_l);var _f=__webpack_require__(5055);function _p($){return $.replace(/&/g,"&").replace(/&/g,"&").replace(/>\s+</g,"><").replace(/\s+</g,"<").replace(/>\s+/g,">").replace(/\.(?=[^<>]*>)/g,"").replace(/<(\w+?)>([^<]+)/g,"<$1>$2</<added>$1>").replace(/<\/<added>(\w+?)>(<\/\1>)?/g,"</$1>")}async function _h($){return await (0,_f.parseStringPromise)($,{explicitArray:false})}function _y($){const ee=$?.["OFX"];const et=ee?.["CREDITCARDMSGSRSV1"]!=null;const en=et?ee?.["CREDITCARDMSGSRSV1"]:ee?.["BANKMSGSRSV1"];const ei=en?.[`${et?"CC":""}STMTTRNRS`];const eo=ei?.[`${et?"CC":""}STMTRS`];const es=eo?.["BANKTRANLIST"];const eu=es?.["STMTTRN"];if(!Array.isArray(eu)){return[eu]}return eu}function _g($){const ee=$["DTPOSTED"];const et=ee?new Date(Number(ee.substring(0,4)),Number(ee.substring(4,6))-1,Number(ee.substring(6,8))):null;return{amount:$["TRNAMT"],type:$["TRNTYPE"],fitId:$["FITID"],date:nI(et),name:$["NAME"],memo:$["MEMO"]}}async function _m($){const ee=$.split("<OFX>",2);const et=ee[0].split(/\r?\n/);const en={};et.forEach($=>{if($){const ee=$.split(/:/,2);en[ee[0]]=ee[1]}});const ei=`<OFX>${ee[1]}`;let eo=null;try{eo=await _h(ei)}catch(ee){const $=_p(ei);eo=await _h($)}return{headers:en,transactions:_y(eo).map(_g)}};function _b($,ee={}){let et=$.split("\n");let en=et.shift();let ei=/!Type:([^$]*)$/.exec(en.trim());let eo={dateFormat:ee.dateFormat,transactions:[]};let es=eo.transactions;let eu={};if(!ei||!ei.length){throw new Error("File does not appear to be a valid qif file: "+en)}eo.type=ei[1];let el={};while(en=et.shift()){en=en.trim();if(en==="^"){es.push(eu);eu={};continue}switch(en[0]){case"D":eu.date=en.substring(1);break;case"T":eu.amount=en.substring(1);break;case"N":eu.number=en.substring(1);break;case"M":eu.memo=en.substring(1);break;case"A":eu.address=(eu.address||[]).concat(en.substring(1));break;case"P":eu.payee=en.substring(1).replace(/&/g,"&");break;case"L":let $=en.substring(1).split(":");eu.category=$[0];if($[1]!==undefined){eu.subcategory=$[1]}break;case"C":eu.clearedStatus=en.substring(1);break;case"S":let ee=en.substring(1).split(":");el.category=ee[0];if(ee[1]!==undefined){el.subcategory=ee[1]}break;case"E":el.description=en.substring(1);break;case"$":el.amount=parseFloat(en.substring(1));if(!(eu.division instanceof Array)){eu.division=[]}eu.division.push(el);el={};break;default:throw new Error("Unknown Detail Code: "+en[0])}}if(Object.keys(eu).length){es.push(eu)}return eo};async function _w($,ee){let et=Array();let en=$.match(/\.[^.]*$/);if(en){let et=en[0];switch(et.toLowerCase()){case".qif":return _S($);case".csv":case".tsv":return _E($,ee);case".ofx":case".qfx":return _T($,ee);default:}}et.push({message:"Invalid file type",internal:""});return{errors:et,transactions:[]}}async function _E($,ee){let et=Array();let en=await oj($);let ei;try{ei=_c()(en,{columns:ee?.hasHeaderRow,bom:true,delimiter:ee?.delimiter||",",quote:'"',trim:true,relax_column_count:true,skip_empty_lines:true})}catch($){et.push({message:"Failed parsing: "+$.message,internal:$.message});return{errors:et,transactions:[]}}return{errors:et,transactions:ei}}async function _S($){let ee=Array();let et=await oj($);let en;try{en=_b(et)}catch($){ee.push({message:"Failed parsing: doesn’t look like a valid QIF file.",internal:$.stack});return{errors:ee,transactions:[]}}return{errors:[],transactions:en.transactions.map($=>({amount:$.amount!=null?iF($.amount):null,date:$.date,payee_name:$.payee,imported_payee:$.payee,notes:$.memo||null}))}}async function _T($,ee){if(!ee?.enableExperimentalOfxParser){return _O($,ee)}const et=Array();const en=await oj($);let ei;try{ei=await _m(en)}catch($){et.push({message:"Failed importing file",internal:$.stack});return{errors:et}}let eo=ee.fallbackMissingPayeeToMemo;return{errors:et,transactions:ei.transactions.map($=>{return{amount:$.amount,imported_id:$.fitId,date:$.date,payee_name:$.name||(eo?$.memo:null),imported_payee:$.name||(eo?$.memo:null),notes:!!$.name||!eo?$.memo||null:null}})}}async function _O($,ee){let{getOFXTransactions:et,initModule:en}=await __webpack_require__.e("xfo").then(__webpack_require__.bind(__webpack_require__,4343));await en();let ei=Array();let eo=await oj($,"binary");let es;try{es=et(eo)}catch($){ei.push({message:"Failed importing file",internal:$.stack});return{errors:ei}}let eu=ee.fallbackMissingPayeeToMemo;return{errors:ei,transactions:es.map($=>({amount:$.amount,imported_id:$.fi_id,date:$.date?nI(new Date($.date*1e3)):null,payee_name:$.name||(eu?$.memo:null),imported_payee:$.name||(eu?$.memo:null),notes:!!$.name||!eu?$.memo||null:null}))}};function _A({reason:$,meta:ee}){switch($){case"unauthorized":return"You are not logged in.";case"encrypt-failure":if(ee.isMissingKey){return"Encrypting your file failed because you are missing your encryption key. Create your key in the next step."}return"Encrypting the file failed. You have the correct key so this is an internal bug. To fix this, generate a new key in the next step.";case"file-has-reset":return"Something went wrong while resetting your file. Please try again.";case"file-has-new-key":return"Unable to encrypt your data because you are missing the key. Create the latest key in the next step.";case"network":return"Uploading the file failed. Check your network connection.";default:return`An internal error occurred, sorry! Visit https://actualbudget.org/contact/ for support. (ref: ${$})`}}function _I({reason:$,meta:ee,fileName:et}){switch($){case"network":case"download-failure":return"Downloading the file failed. Check your network connection.";case"not-zip-file":case"invalid-zip-file":case"invalid-meta-file":return"Downloaded file is invalid, sorry! Visit https://actualbudget.org/contact/ for support.";case"decrypt-failure":return"Unable to decrypt file "+(et||"(unknown)")+". To change your key, first "+"download this file with the proper password.";case"out-of-sync-migrations":return"This budget cannot be loaded with this version of the app. "+"Make sure the app is up-to-date.";default:let en=ee&&ee.fileId?`, fileId: ${ee.fileId}`:"";return"Something went wrong trying to download that file, sorry! "+"Visit https://actualbudget.org/contact/ for support. "+`(reason: ${$}${en})`}}function _N($){return _A($)}function _D({reason:$}){switch($){case"network":return"Unable to connect to the server. We need to access the server to get some information about your keys.";case"old-key-style":return"This file is encrypted with an old unsupported key style. Recreate the key "+"on a device where the file is available, or use an older version of Actual to download "+"it.";case"decrypt-failure":return"Unable to decrypt file with this password. Please try again.";default:return"Something went wrong trying to create a key, sorry! Visit https://actualbudget.org/contact/ for support."}}function _R($,ee){if($==="out-of-sync-migrations"||$==="out-of-sync-data"){return"This budget cannot be loaded with this version of the app."}else if($==="budget-not-found"){return`Budget “${ee}” not found. Check the id of your budget in the Advanced section of the settings page.`}else{return`We had an unknown problem opening “${ee}”.`}};const _C={...oK,toExternal($){return{id:$.id,name:$.name,offbudget:$.offbudget?true:false,closed:$.closed?true:false}},fromExternal($){let ee={...$};if("offbudget"in $){ee.offbudget=$.offbudget?1:0}if("closed"in $){ee.closed=$.closed?1:0}return ee}};const _k={...oZ,toExternal($){return{id:$.id,name:$.name,is_income:$.is_income?true:false,group_id:$.cat_group}},fromExternal($){let{group_id:ee,...et}=$;if("is_income"in $){et.is_income=$.is_income?1:0}if("group_id"in $){et.cat_group=$.group_id}return et}};const _M={...oJ,toExternal($){return{id:$.id,name:$.name,is_income:$.is_income?true:false,categories:$.categories.map(_k.toExternal)}},fromExternal($){let ee={...$};if("is_income"in $){ee.is_income=$.is_income?1:0}if("categories"in $){ee.categories=$.categories.map(_k.fromExternal)}return ee}};const _L={...oX,toExternal($){return{id:$.id,name:$.name,category:$.category,transfer_acct:$.transfer_acct}},fromExternal($){return $}};let _x=false;function _P($,ee){return{type:"APIError",message:$,meta:ee}}function _F($){return ee=>{return aV(async()=>{let et=(0,eo.getClock)().timestamp.toString();let en=await $(ee);let ei=await f2("SELECT DISTINCT dataset FROM messages_crdt WHERE timestamp > ?",[et]);if(aJ()>1){aZ("sync-event",{type:"success",tables:ei.map($=>$.dataset)})}return en},{undoDisabled:true})}}let _B={};async function _U($){if(!$.match(/^\d{4}-\d{2}$/)){throw _P("Invalid month format, use YYYY-MM: "+$)}if(!_x){let{start:ee,end:et}=await _B["get-budget-bounds"]();let en=nz(ee,et);if(!en.includes($)){throw _P("No budget exists for month: "+$)}}}async function _j($,ee){if(ee==null){throw _P(`${$}: category id is required`)}let et=await f6("SELECT is_income FROM categories WHERE id = ?",[ee]);if(!et){throw _P(`${$}: category “${ee}” does not exist`)}if(et.is_income!==0){throw _P(`${$}: category “${ee}” is not an expense category`)}}function _W(){if(!(uA()||{}).id){throw _P("No budget file is open")}}let _H=null;_B["api/batch-budget-start"]=async function(){if(_H){throw _P("Cannot start a batch process: batch already started")}if(_x){f1(()=>{return new Promise(($,ee)=>{_H={resolve:$,reject:ee}})})}else{fI(()=>{return new Promise(($,ee)=>{_H={resolve:$,reject:ee}})})}};_B["api/batch-budget-end"]=async function(){if(!_H){throw _P("Cannot end a batch process: no batch started")}_H.resolve();_H=null};_B["api/load-budget"]=async function({id:$}){let{id:ee}=uA()||{};if(ee!==$){aZ("start-load");let{error:ee}=await _B["load-budget"]({id:$});if(!ee){aZ("finish-load")}else{aZ("show-budgets");throw new Error(_R(ee,$))}}};_B["api/download-budget"]=async function({syncId:$,password:ee}){let{id:et}=uA()||{};if(et){await _B["close-budget"]()}let en=(await _B["get-budgets"]()).find(ee=>ee.groupId===$);if(en){await _B["load-budget"]({id:en.id});let $=await _B["sync-budget"]();if($.error){throw new Error(_R($.error,en.id))}}else{let et=await _B["get-remote-files"]();if(!et){throw new Error("Could not get remote files")}let en=et.find(ee=>ee.groupId===$);if(!en){throw new Error(`Budget “${$}” not found. Check the sync id of your budget in the Advanced section of the settings page.`)}if(en.encryptKeyId&&!ee){throw new Error(`File ${en.name} is encrypted. Please provide a password.`)}if(ee){let $=await _B["key-test"]({fileId:en.fileId,password:ee});if($.error){throw new Error(_D($.error))}}let ei=await _B["download-budget"]({fileId:en.fileId});if(ei.error){console.log("Full error details",ei.error);throw new Error(_I(ei.error))}await _B["load-budget"]({id:ei.id})}};_B["api/sync"]=async function(){let{id:$}=uA();let ee=await _B["sync-budget"]();if(ee.error){throw new Error(_R(ee.error,$))}};_B["api/start-import"]=async function({budgetName:$}){await _B["close-budget"]();await _B["create-budget"]({budgetName:$,avoidUpload:true});await fK("DELETE FROM categories WHERE is_income = 0");await fK("DELETE FROM category_groups WHERE is_income = 0");fl("import");aZ("start-import");_x=true};_B["api/finish-import"]=async function(){_W();uF().markCacheDirty();let{id:$}=uA();await _B["close-budget"]();await _B["load-budget"]({id:$});await _B["get-budget-bounds"]();await uK();await c9().catch($=>{});aZ("finish-import");_x=false};_B["api/abort-import"]=async function(){if(_x){_W();let{id:$}=uA();await _B["close-budget"]();await _B["delete-budget"]({id:$});aZ("show-budgets")}_x=false};_B["api/query"]=async function({query:$}){_W();return uh($)};_B["api/budget-months"]=async function(){_W();let{start:$,end:ee}=await _B["get-budget-bounds"]();return nz($,ee)};_B["api/budget-month"]=async function({month:$}){_W();await _U($);let ee=await dl();let et=nQ($);function en($){let ee=uF().getCellValue(et,$);return ee===""?0:ee}return{month:$,incomeAvailable:en("available-funds"),lastMonthOverspent:en("last-month-overspent"),forNextMonth:en("buffered"),totalBudgeted:en("total-budgeted"),toBudget:en("to-budget"),fromLastMonth:en("from-last-month"),totalIncome:en("total-income"),totalSpent:en("total-spent"),totalBalance:en("total-leftover"),categoryGroups:ee.map($=>{if($.is_income){return{..._M.toExternal($),received:en("total-income"),categories:$.categories.map($=>({..._k.toExternal($),received:en(`sum-amount-${$.id}`)}))}}return{..._M.toExternal($),budgeted:en(`group-budget-${$.id}`),spent:en(`group-sum-amount-${$.id}`),balance:en(`group-leftover-${$.id}`),categories:$.categories.map($=>({..._k.toExternal($),budgeted:en(`budget-${$.id}`),spent:en(`sum-amount-${$.id}`),balance:en(`leftover-${$.id}`),carryover:en(`carryover-${$.id}`)}))}})}};_B["api/budget-set-amount"]=_F(async function({month:$,categoryId:ee,amount:et}){_W();return _B["budget/budget-amount"]({month:$,category:ee,amount:et})});_B["api/budget-set-carryover"]=_F(async function({month:$,categoryId:ee,flag:et}){_W();await _U($);await _j("budget-set-carryover",ee);return _B["budget/set-carryover"]({startMonth:$,category:ee,flag:et})});_B["api/transactions-export"]=async function({transactions:$,categoryGroups:ee,payees:et}){_W();return _B["transactions-export"]({transactions:$,categoryGroups:ee,payees:et})};_B["api/transactions-import"]=_F(async function({accountId:$,transactions:ee}){_W();return _B["transactions-import"]({accountId:$,transactions:ee})});_B["api/transactions-add"]=_F(async function({accountId:$,transactions:ee}){_W();await mk($,ee,{runTransfers:false});return"ok"});_B["api/transactions-get"]=async function({accountId:$,startDate:ee,endDate:et}){_W();let{data:en}=await uh(sX("transactions").filter({$and:[$&&{account:$},ee&&{date:{$gte:ee}},et&&{date:{$lte:et}}].filter(Boolean)}).select("*").options({splits:"grouped"}));return en};_B["api/transactions-filter"]=async function({text:$,accountId:ee}){throw new Error("`filterTransactions` is deprecated, use `runQuery` instead")};_B["api/transaction-update"]=_F(async function({id:$,fields:ee}){_W();let{data:et}=await uh(sX("transactions").filter({id:$}).select("*").options({splits:"grouped"}));let en=iG(et);if(en.length===0){return[]}let{diff:ei}=iQ(en,ee);return _B["transactions-batch-update"](ei)});_B["api/transaction-delete"]=_F(async function({id:$}){_W();let{data:ee}=await uh(sX("transactions").filter({id:$}).select("*").options({splits:"grouped"}));let et=iG(ee);if(et.length===0){return[]}let{diff:en}=i0(et,$);return _B["transactions-batch-update"](en)});_B["api/accounts-get"]=async function(){_W();let $=await dC();return $.map($=>_C.toExternal($))};_B["api/account-create"]=_F(async function({account:$,initialBalance:ee=null}){_W();return _B["account-create"]({name:$.name,offBudget:$.offbudget,closed:$.closed,balance:ee!=null?iP(ee):null})});_B["api/account-update"]=_F(async function({id:$,fields:ee}){_W();return dM({id:$,..._C.fromExternal(ee)})});_B["api/account-close"]=_F(async function({id:$,transferAccountId:ee,transferCategoryId:et}){_W();return _B["account-close"]({id:$,transferAccountId:ee,categoryId:et})});_B["api/account-reopen"]=_F(async function({id:$}){_W();return _B["account-reopen"]({id:$})});_B["api/account-delete"]=_F(async function({id:$}){_W();return _B["account-close"]({id:$,forced:true})});_B["api/categories-get"]=async function({grouped:$}={}){_W();let ee=await _B["get-categories"]();return $?ee.grouped.map(_M.toExternal):ee.list.map(_k.toExternal)};_B["api/category-group-create"]=_F(async function({group:$}){_W();return _B["category-group-create"]({name:$.name})});_B["api/category-group-update"]=_F(async function({id:$,fields:ee}){_W();return _B["category-group-update"]({id:$,..._M.fromExternal(ee)})});_B["api/category-group-delete"]=_F(async function({id:$,transferCategoryId:ee}){_W();return _B["category-group-delete"]({id:$,transferId:ee})});_B["api/category-create"]=_F(async function({category:$}){_W();return _B["category-create"]({name:$.name,groupId:$.group_id,isIncome:$.is_income})});_B["api/category-update"]=_F(async function({id:$,fields:ee}){_W();return _B["category-update"]({id:$,..._k.fromExternal(ee)})});_B["api/category-delete"]=_F(async function({id:$,transferCategoryId:ee}){_W();return _B["category-delete"]({id:$,transferId:ee})});_B["api/payees-get"]=async function(){_W();let $=await _B["payees-get"]();return $.map(_L.toExternal)};_B["api/payee-create"]=_F(async function({payee:$}){_W();return _B["payee-create"]({name:$.name})});_B["api/payee-update"]=_F(async function({id:$,fields:ee}){_W();return _B["payees-batch-change"]({updated:[{id:$,..._L.fromExternal(ee)}]})});_B["api/payee-delete"]=_F(async function({id:$}){_W();return _B["payees-batch-change"]({deleted:[{id:$}]})});function _z($){let ee=Object.assign({},$,_B);_B=ee;return ee};const _V="db.latest.sqlite";let _$=null;async function _q($){const ee=od($);const et=ou(ee,"backups");let en=[];if(await oP(et)){en=await ox(et);en=en.filter($=>$.match(/\.sqlite$/))}const ei=await Promise.all(en.map(async $=>{const ee=await o$(ou(et,$));return{id:$,date:new Date(ee)}}));ei.sort(($,ee)=>{if($.date<ee.date){return 1}else if($.date>ee.date){return-1}return 0});return ei}async function _G($){const ee=od($);if(await oP(ou(ee,_V))){return{id:_V,date:null,isLatest:true}}return null}async function _Y($){let ee=await _q($);let et=await _G($);if(et){ee.unshift(et)}return ee.map($=>({...$,date:$.date?t4($.date,"yyyy-MM-dd h:mm"):null}))}async function _K($){const ee=$.reduce(($,ee)=>{const et=t4(ee.date,"yyyy-MM-dd");$[et]=$[et]||[];$[et].push(ee);return $},{});const et=[];for(let $ of Object.keys(ee)){const en=ee[$];const ei=$===nR();for(let $ of en.slice(ei?3:1)){et.push($.id)}}const en=$.filter($=>!et.includes($.id));return et.concat(en.slice(10).map($=>$.id))}async function _Z($){const ee=od($);if(await oP(ou(ee,_V))){await oH(ou(od($),_V))}let et=`${e_()}.sqlite`;let en=ou(ee,"backups",et);if(!await oP(ou(ee,"backups"))){await oF(ou(ee,"backups"))}await oU(ou(ee,"db.sqlite"),en);const ei=oe(en);await a3(ei,"DELETE FROM messages_crdt");await a3(ei,"DELETE FROM messages_clock");ot(ei);const eo=await _K(await _q($));for(let $ of eo){await oH(ou(ee,"backups",$))}aZ("backups-updated",await _Y($))}async function _J($,ee){const et=od($);if(!await oP(ou(et,_V))){await oU(ou(et,"db.sqlite"),ou(et,_V));await oU(ou(et,"metadata.json"),ou(et,"metadata.latest.json"));_Q();_X($);await uS($)}if(ee===_V){console.log("Reverting backup");await oU(ou(et,_V),ou(et,"db.sqlite"));await oU(ou(et,"metadata.latest.json"),ou(et,"metadata.json"));await oH(ou(et,_V));await oH(ou(et,"metadata.latest.json"));try{await c9()}catch($){}uO()}else{console.log("Loading backup",ee);await uS($);await uT({groupId:null,lastSyncedTimestamp:null,lastUploaded:null});try{await c9()}catch($){}uO();await oU(ou(et,"backups",ee),ou(et,"db.sqlite"))}}function _X($){if(_$){clearInterval(_$)}_$=setInterval(async()=>{console.log("Making backup");await _Z($)},1e3*60*15)}function _Q(){clearInterval(_$);_$=null}var _0=__webpack_require__(5070);function _1({month:$}){return _2($)}async function _2($){let ee=0;let et=0;let en=0;let ei=[];let eo=[];let es=await _4();let eu=await f2("SELECT * FROM v_categories WHERE tombstone = 0");let el=nQ($);for(let ei=0;ei<eu.length;ei++){let ef=eu[ei];let ed=es[ef.id];if(ed){if(ed.filter($=>$.type==="source").length>0){let et=await uZ(el,`leftover-${ef.id}`);let en=await uZ(el,`budget-${ef.id}`);await u4({category:ef.id,month:$,amount:en-et});ee+=1}if(ed.filter($=>$.type==="sink").length>0){eo.push({cat:ef,temp:ed});et+=1;en+=ed.filter($=>$.type==="sink")[0].weight}}}let ef=parseInt($.replace("-",""));for(let ee=0;ee<eu.length;ee++){let et=eu[ee];let en=await uZ(el,`to-budget`);let ei=await uZ(el,`leftover-${et.id}`);let eo=await uZ(el,`budget-${et.id}`);let es=eo+Math.abs(ei);let ed=et.id;let ep=await f6(`SELECT carryover FROM zero_budgets WHERE month = ? and category = ?`,[ef,ed]);if(ei<0&&Math.abs(ei)<=en&&!et.is_income&&ep.carryover===0){await u4({category:et.id,month:$,amount:es})}}let ed=await uZ(el,`to-budget`);if(ed<=0){ei.push("No funds are available to reallocate.")}for(let ee=0;ee<eo.length;ee++){let et=await uZ(el,`budget-${eo[ee].cat.id}`);let ei=eo[ee].cat.id;let es=eo[ee].temp.filter($=>$.type==="sink")[0].weight;let eu=et+Math.round(es/en*ed);if(ee===eo.length-1){let $=await uZ(el,`to-budget`);if(eu>$){eu=et+$}}await u4({category:ei,month:$,amount:eu})}if(ee===0){if(ei.length){return{type:"error",sticky:true,message:`There were errors interpreting some templates:`,pre:ei.join("\n\n")}}else{return{type:"message",message:"All categories were up to date."}}}else{let $=`Successfully returned funds from ${ee} ${ee===1?"source":"sources"} and funded ${et} sinking ${et===1?"fund":"funds"}.`;if(ei.length){return{sticky:true,message:`${$} There were errors interpreting some templates:`,pre:ei.join("\n\n")}}else{return{type:"message",message:$}}}}const _6="#cleanup ";async function _4(){let $={};let ee=await f2(`SELECT * FROM notes WHERE lower(note) like '%${_6}%'`);for(let et=0;et<ee.length;et++){let en=ee[et].note.split("\n");let ei=[];for(let $=0;$<en.length;$++){let ee=en[$].trim();if(!ee.toLowerCase().startsWith(_6))continue;let et=ee.slice(_6.length);try{let $=(0,_0.parse)(et);ei.push($)}catch($){ei.push({type:"error",line:ee,error:$})}}if(ei.length){$[ee[et].id]=ei}}return $};function _3($){eE(1,arguments);var ee=eS($);ee.setHours(0,0,0,0);return ee};function _8($){eE(1,arguments);var ee=eS($);var et=ee.getDay();return et===0||et===6};function _5($){eE(1,arguments);var ee=eS($);var et=ee.getDay();return et};function _9($,ee){eE(2,arguments);var et=ee-_5($);if(et<=0)et+=7;return r9($,et)};function _7($){eE(1,arguments);return _9($,1)};function ve($,ee){eE(2,arguments);var et=_5($)-ee;if(et<=0)et+=7;return nt($,et)};function vt($){eE(1,arguments);return ve($,5)}var vr=__webpack_require__(251);var vn=__webpack_require__.n(vr);var vo=864e5;function vs($,ee){eE(2,arguments);var et=_3($);var en=_3(ee);var ei=et.getTime()-e8(et);var eo=en.getTime()-e8(en);return Math.round((ei-eo)/vo)};function vu($,ee){var et=$.getFullYear()-ee.getFullYear()||$.getMonth()-ee.getMonth()||$.getDate()-ee.getDate()||$.getHours()-ee.getHours()||$.getMinutes()-ee.getMinutes()||$.getSeconds()-ee.getSeconds()||$.getMilliseconds()-ee.getMilliseconds();if(et<0){return-1}else if(et>0){return 1}else{return et}}function vl($,ee){eE(2,arguments);var et=eS($);var en=eS(ee);var ei=vu(et,en);var eo=Math.abs(vs(et,en));et.setDate(et.getDate()-ei*eo);var es=Number(vu(et,en)===-ei);var eu=ei*(eo-es);return eu===0?0:eu};function vc($,ee){eE(2,arguments);var et=eI(ee);return r7($,-et)};function vf($){eE(1,arguments);var ee=eS($);var et=ee.getDate();return et};function vd($,ee){eE(2,arguments);var et=eI(ee);return r8($,et*12)};function vp($,ee){eE(2,arguments);var et=eI(ee);return vd($,-et)};function vh($){let ee=new ym({rrules:pg($)});return ee.occurrences({take:3}).toArray().map($=>$.date)}async function vy($,ee){let{data:et}=await uh(sX("transactions").filter({account:ee,schedule:null,"payee.transfer_acct":null,$and:[{date:{$gte:nt($,2)}},{date:{$lte:r9($,2)}}]}).select("*").options({splits:"none"}));return et}function vg($,ee){let et=Math.abs(vl(nT($),nT(ee)));return 1/(et+1)}function vm($,ee,et=.5){$=[...$].reverse();let en=$[0];let ei=$.slice(1);let eo=[];for(let et of en.transactions){let es=pn(et.amount);let eu=et.payee;let el=ei.map($=>{let ee=$.transactions.find($=>$.amount>=et.amount-es&&$.amount<=et.amount+es);ee=ee&&ee.payee===eu?ee:null;if(ee){return{trans:ee,rank:vg($.date,ee.date)}}return null});if(el.indexOf(null)!==-1){continue}let ef=el.reduce(($,ee)=>$+ee.rank,vg(en.date,et.date));let ed=el.reduce(($,ee)=>$&&ee.trans.amount===et.amount,true);eo.push({rank:ef,amount:et.amount,account:et.account,payee:et.payee,date:ee,exactDate:ef===$.length,exactAmount:ed})}return eo}async function v_($,ee,et,en,ei){let eo=[];for(let es=0;es<ee;es++){let ee=r9($,es);let eu;if(typeof et==="function"){eu=et(ee);if(eu===false){continue}}else{eu={...et,start:ee}}eu.start=nI(eu.start);let el=[];let ef=vh(eu);for(let $ of ef){el.push({date:nI($),transactions:await vy($,en)})}eo=eo.concat(vm(el,eu,ei))}return eo}async function vv($,ee){return v_(vc(nT($),4),7*2,{frequency:"weekly"},ee)}async function vw($,ee){return v_(vc(nT($),7),7*2,{frequency:"weekly",interval:2},ee)}async function vE($,ee){return v_(r5(nT($),4),31*2,$=>{if(vf($)>28){return false}return{start:$,frequency:"monthly"}},ee)}async function vS($,ee){let et=await v_(r5(nT($),3),1,{frequency:"monthly",patterns:[{type:"day",value:-1}]},ee,.75);let en=await v_(r5(nT($),4),1,{frequency:"monthly",patterns:[{type:"day",value:-1}]},ee,.75);return et.concat(en)}async function vT($,ee){return v_(vc(nT($),8),14,$=>{let ee=t4(new Date,"iiii");let et=ee.slice(0,2).toUpperCase();return{start:$,frequency:"monthly",patterns:[{type:et,value:1},{type:et,value:3}]}},ee)}async function vO($,ee){return v_(r5(nT($),8),14,$=>{let ee=t4(new Date,"iiii");let et=ee.slice(0,2).toUpperCase();return{start:$,frequency:"monthly",patterns:[{type:et,value:2},{type:et,value:4}]}},ee)}async function vA($){let ee=$._conditions;let et=ee.find($=>$.field==="date");let en=et.value;while(1){let $=en;en={...$};switch(en.frequency){case"weekly":en.start=nI(vc(nT(en.start),en.interval||1));break;case"monthly":en.start=nI(r5(nT(en.start),en.interval||1));break;case"yearly":en.start=nI(vp(nT(en.start),en.interval||1));break;default:throw new Error("findStartDate: invalid frequency")}let et=ee.map($=>$.field==="date"?{...$,value:en}:$);let{filters:ei,errors:eo}=mi(et,{recurDateBounds:1});if(eo.length>0){en=null;break}let{data:es}=await uh(sX("transactions").filter({$and:ei}).select("*"));if(es.length===0){en=$;break}}if(en){return{...$,date:en,_conditions:ee.map($=>$.field==="date"?{...$,value:en}:$)}}return $}async function vI(){let{data:$}=await uh(sX("accounts").filter({closed:false}).select("*"));let ee=[];for(let et of $){let $=await f6("SELECT * FROM v_transactions WHERE account = ? AND parent_id IS NULL ORDER BY date DESC LIMIT 1",[et.id]);if($){let en=oY($.date);ee=ee.concat(await vv(en,et.id),await vw(en,et.id),await vE(en,et.id),await vS(en,et.id),await vT(en,et.id),await vO(en,et.id))}}let et=[...io(ee,"payee").entries()].map(([$,ee])=>{ee.sort(($,ee)=>ee.rank-$.rank);let et=ee[0];return{id:e_(),account:et.account,payee:et.payee,date:et.date,amount:et.amount,_conditions:[{op:"is",field:"account",value:et.account},{op:"is",field:"payee",value:et.payee},{op:et.exactDate?"is":"isapprox",field:"date",value:et.date},{op:et.exactAmount?"is":"isapprox",field:"amount",value:et.amount}]}});let en=[];for(let $ of et){en.push(await vA($))}return en};function vN($,ee){let et=[];for(let en=0;en<$.length;en++){et.push([$[en],ee[en]])}return et}function vD($,ee){let et=pm($);let en=pm(ee);let ei=vN(Object.values(et),Object.values(en));let eo=$.map($=>{let ee=ei.find(ee=>$===ee[0]);return ee&&ee[1]?ee[1]:$});let es=ei.filter($=>$[0]==null&&$[1]!=null).map($=>$[1]);return eo.concat(es)}function vR($,ee=new Date(nR())){ee=_3(ee);let et=new gE($.op,"date",$.value,null,new Map(Object.entries({date:"date"})));let en=et.getValue();if(en.type==="date"){return en.date}else if(en.type==="recur"){let $=en.schedule.occurrences({start:ee,take:1}).toArray();if($.length>0){let ee=$[0].date;if(en.schedule.data.skipWeekend){ee=vG(ee,en.schedule.data.weekendSolve)}return nI(ee)}}return null}async function vC($){if($==null){throw new Error("Schedule not attached to a rule")}let{data:ee}=await uh(sX("schedules").filter({id:$}).calculate("rule"));return g5().find($=>$.id===ee)}async function vk($){let{data:ee}=await uh(sX("schedules").filter({id:$}).calculate("rule"));if(ee){await de("rules",ee)}let et=await g9({stage:null,conditionsOp:"and",conditions:[{op:"isapprox",field:"date",value:nR()},{op:"isapprox",field:"amount",value:0}],actions:[{op:"link-schedule",value:$}]});await ds("schedules",{id:$,rule:et});return g5().find($=>$.id===et)}async function vM({id:$,start:ee,conditions:et,reset:en}){if(et==null){let ee=await vC($);if(ee==null){throw new Error("No rule found for schedule")}et=ee.serialize().conditions}let{date:ei}=pm(et);let{data:eo}=await uh(sX("schedules").filter({id:$}).calculate("next_date"));if(ei){let et=vR(ei,ee?ee(eo):new Date);if(et!==eo){let ee=await f6("SELECT id, base_next_date_ts FROM schedules_next_date WHERE schedule_id = ?",[$]);await f5("schedules_next_date",en?{id:ee.id,base_next_date:oG(et),base_next_date_ts:Date.now()}:{id:ee.id,local_next_date:oG(et),local_next_date_ts:ee.base_next_date_ts})}}}async function vL($,ee){let et=await f6("SELECT id from schedules WHERE tombstone = 0 AND name = ?",[$]);if(et==null){return false}if(ee){return et["id"]!==ee}return true}async function vx({schedule:$=null,conditions:ee=[]}={}){let et=$?.id||e_();let{date:en}=pm(ee);if(en==null){throw new Error("A date condition is required to create a schedule")}if(en.value==null){throw new Error("Date is required")}let ei=vR(en);let eo=ei?oG(ei):null;if($){if($.name){if(await vL($.name,et)){throw new Error("Cannot create schedules with the same name")}}else{$.name=null}}let es=await g9({stage:null,conditionsOp:"and",conditions:ee,actions:[{op:"link-schedule",value:et}]});let eu=Date.now();await f9("schedules_next_date",{schedule_id:et,local_next_date:eo,local_next_date_ts:eu,base_next_date:eo,base_next_date_ts:eu});await di("schedules",{...$,id:et,rule:es});return et}async function vP({schedule:$,conditions:ee,resetNextDate:et}){if($.rule){throw new Error("You cannot change the rule of a schedule")}let en;if(ee){let{date:et}=pm(ee);if(et&&et.value==null){throw new Error("Date is required")}en=await vC($.id);if(en==null){en=await vk($.id)}}await fI(async()=>{if(ee){let ei=en.serialize().conditions;let eo=vD(ei,ee);await g7({id:en.id,conditions:eo});let es=({type:$,...ee})=>ee;if(et||!vn()(ei.find($=>$.field==="account"),ei.find($=>$.field==="account"))||!vn()(es(ei.find($=>$.field==="date")||{}),es(eo.find($=>$.field==="date")||{}))){await vM({id:$.id,conditions:eo,reset:true})}}else if(et){await vM({id:$.id,reset:true})}await ds("schedules",$)})}async function vF({id:$}){let{data:ee}=await uh(sX("schedules").filter({id:$}).calculate("rule"));await fI(async()=>{await de("rules",ee);await de("schedules",$)})}async function vB({id:$}){return vM({id:$,start:$=>{return r9(nT($),1)}})}function vU(){return vI()}async function vj({config:$,count:ee}){let et=pg($);try{let en=new ym({rrules:et});return en.occurrences({start:_3(new Date),take:ee}).toArray().map(ee=>$.skipWeekend?vG(ee.date,$.weekendSolveMode):ee.date).map($=>nI($))}catch(ee){aN($);throw ee}}function vW($){let{actions:ee,conditions:et}=$ instanceof gO?$.serialize():g4.toJS($);if(ee&&ee.find($=>$.op==="link-schedule")){let $=ee.find($=>$.op==="link-schedule").value;if($){let ee=pm(et);let en=et.findIndex($=>$===ee.payee);let ei=et.findIndex($=>$===ee.account);let eo=et.findIndex($=>$===ee.amount);let es=et.findIndex($=>$===ee.date);fK("INSERT OR REPLACE INTO schedules_json_paths (schedule_id, payee, account, amount, date) VALUES (?, ?, ?, ?, ?)",[$,en===-1?null:`$[${en}]`,ei===-1?null:`$[${ei}]`,eo===-1?null:`$[${eo}]`,es===-1?null:`$[${es}]`])}}}function vH(){f0(()=>{g5().forEach($=>{vW($)})});return f_(vz)}function vz($,ee){ee.forEach(($,ee)=>{if(ee==="rules"){$.forEach($=>{vW($)})}})}async function vV({id:$}){let{data:ee}=await uh(sX("schedules").filter({id:$}).select("*"));let et=ee[0];if(et==null||et._account==null){return}let en={payee:et._payee,account:et._account,amount:p_(et._amount),date:et.next_date,schedule:et.id,cleared:false};if(en.account){await mk(en.account,[en])}}async function v$($){let{data:ee}=await uh(sX("schedules").filter({completed:false,"_account.closed":false}).select("*"));let{data:et}=await uh(pd(ee));let en=new Set(et.filter(Boolean).map($=>$.schedule));let ei=[];let eo=false;for(let et of ee){let ee=pf(et.next_date,et.completed,en.has(et.id));if(ee==="paid"){if(et._date){if(et._date.frequency){try{await vM({id:et.id})}catch($){}}else{if(et._date<nR()){await vP({schedule:{id:et.id,completed:true}})}}}}else if((ee==="due"||ee==="missed")&&et.posts_transaction&&et._account){if($){await vV({id:et.id});eo=true}else{ei.push(et._payee)}}}if(ei.length>0){aZ("schedules-offline",{payees:ei})}else if(eo){aZ("sync-event",{type:"success",tables:["transactions"],syncDisabled:"false"})}}let vq=lX();vq.method("schedule/create",aP(cd(vx)));vq.method("schedule/update",aP(cd(vP)));vq.method("schedule/delete",aP(cd(vF)));vq.method("schedule/skip-next-date",aP(cd(vB)));vq.method("schedule/post-transaction",aP(cd(vV)));vq.method("schedule/force-run-service",aP(()=>v$(true)));vq.method("schedule/discover",vU);vq.method("schedule/get-upcoming-dates",vj);vq.service(vH);vq.events.on("sync",({type:$,subtype:ee})=>{let et=$==="success"||$==="error"||$==="unauthorized";if(et&&uA()){let{lastScheduleRun:ee}=uA();if(ee!==nR()){aV(()=>v$($==="success"));uT({lastScheduleRun:nR()})}}});function vG($,ee){if(_8($)){if(ee==="after"){return _7($)}else if(ee==="before"){return vt($)}else{throw new Error("Unknown weekend solve mode, this should not happen!")}}return $}const vY=vq;var vK=__webpack_require__(4939);async function vZ({month:$}){let ee=await v9(null);return v6($,false,ee)}async function vJ({month:$}){let ee=await v9(null);return v6($,true,ee)}async function vX({month:$,category:ee}){let et=await f2(`SELECT * FROM v_categories WHERE id = ?`,[ee]);let en=await v9(et[0]);await u4({category:ee,month:$,amount:0});return v6($,false,en)}function vQ(){return be()}function v0($){let ee=$[0].priority;let et=false;for(let en=1;en<$.length;en++){if($[en].priority!==ee){ee=Math.min(ee,$[en].priority);et=true}}return{lowPriority:ee,errorNotice:et}}async function v2({month:$,templateBudget:ee}){await fI(async()=>{ee.forEach(ee=>{u4({category:ee.category,month:$,amount:ee.amount})})})}async function v6($,ee,et){let en=0;let ei=[];let eo=0;let es=[];let eu=[];let el=await f2("SELECT * FROM v_categories WHERE tombstone = 0 AND hidden = 0");for(let ee=0;ee<el.length;ee++){let en=el[ee];let ei=await uZ(nQ($),`budget-${en.id}`);let ef=et[en.id];if(ef){for(let $=0;$<ef.length;$++){eo=ef[$].priority>eo?ef[$].priority:eo}}if(ei){es.push({category:en.id,amount:ei,isIncome:en.is_income,isTemplate:ef?true:false});eu.push({category:en.id,amount:0,isIncome:en.is_income,isTemplate:ef?true:false})}}await v2({month:$,templateBudget:eu.filter($=>$.isTemplate===true)});let ef;let ed=eo+1;let ep=0;for(let $=0;$<el.length;$++){let ee=el[$];let en=et[ee.id];if(en){for(let $=0;$<en.length;$++){if(en[$].type==="remainder"){en[$].priority=ed;ep+=en[$].weight;ef=true}}}}if(ef)eo=ed;let eh=nQ($);let ey=await uZ(eh,`to-budget`);let eg=uQ()?await uZ(eh,`total-saved`):await uZ(eh,`to-budget`);for(let es=0;es<=eo;es++){let eu=[];let ef=1;if(es===eo){let $=await uZ(eh,`to-budget`);ef=$/ep}for(let eo=0;eo<el.length;eo++){let ed=el[eo];let ep=et[ed.id];if(ep){let et=false;let eo=false;let el=0;if(ep.filter($=>($.type==="schedule"||$.type==="by")&&$.priority===es).length>0){ep=ep.filter($=>$.priority===es&&($.type!=="schedule"||$.type!=="by")||$.type==="schedule"||$.type==="by");let{lowPriority:$,errorNotice:ee}=await v0(ep);el=$;et=el!==es?true:false;eo=true;if(!et&&ee){ei.push(ed.name+": Schedules and By templates should all have the same priority. Using priority "+el)}}if(!et){if(!eo){ep=ep.filter($=>$.priority===es)}if(ep.length>0){ei=ei.concat(ep.filter($=>$.type==="error").map(({line:$,error:ee})=>[ed.name+": "+ee.message,$," ".repeat(v8.length+ee.location.start.offset)+"^"].join("\n")));let et=await uZ(eh,`budget-${ed.id}`);let{amount:eo,errors:el}=await v7(ed,ep,$,es,ef,ey,eg,et,ee);if(eo!=null){en++;if(eo>eg&&es>0){eo=eg}eu.push({category:ed.id,amount:eo+et});eg-=eo}if(el!=null){ei=ei.concat(el.map($=>`${ed.name}: ${$}`))}}}}}await v2({month:$,templateBudget:eu})}if(!ee){es=es.filter($=>$.isIncome===0&&$.isTemplate);for(let ee=0;ee<es.length;ee++){await u4({category:es[ee].category,month:$,amount:es[ee].amount});let et=ei.length;for(let $=0;$<et;$++){if(ei[$].includes(el.filter($=>$.id===es[ee].category)[0].name)){ei.splice($,1);et--}}}}if(en===0){if(ei.length){return{type:"error",sticky:true,message:`There were errors interpreting some templates:`,pre:ei.join("\n\n")}}else{return{type:"message",message:"All categories were up to date."}}}else{let $=`Successfully applied ${en} templates.`;if(ei.length){return{sticky:true,message:`${$} There were errors interpreting some templates:`,pre:ei.join("\n\n")}}else{return{type:"message",message:$}}}}const v8="#template";async function v9($){let ee={};let et=await f2(`SELECT * FROM notes WHERE lower(note) like '%${v8}%'`);if($)et=et.filter(ee=>ee.id===$.id);for(let $=0;$<et.length;$++){let en=et[$].note.split("\n");let ei=[];for(let $=0;$<en.length;$++){let ee=en[$].trim();if(!ee.toLowerCase().startsWith(v8))continue;let et=ee.slice(v8.length);try{let $=(0,vK.parse)(et);ei.push($)}catch($){ei.push({type:"error",line:ee,error:$})}}if(ei.length){ee[et[$].id]=ei}}return ee}async function v7($,ee,et,en,ei,eo,es,eu,el){let ef=`${et}-01`;let ed=[];let ep=await f2("SELECT name from schedules WHERE name NOT NULL AND tombstone = 0");ep=ep.map($=>$.name);let eh=false;ee=ee.filter($=>{switch($.type){case"by":case"spend":let ee=`${$.month}-01`;let et=nx(ee,ef);let en=$.annual?($.repeat||1)*12:$.repeat;let ei;if($.type==="spend"){ei=`${$.from}-01`}while(et<0&&en){ee=nM(ee,en);if(ei){ei=nM(ei,en)}et=nx(ee,ef)}if(et<0){ed.push(`${$.month} is in the past.`);return false}$.month=n1(ee,"yyyy-MM");if(ei){$.from=n1(ei,"yyyy-MM")}break;case"schedule":if(!ep.includes($.name)){ed.push(`Schedule ${$.name} does not exist`);return null}break;default:}return true});if(ee.length>1){ee=ee.sort(($,ee)=>{if($.type==="by"&&!$.annual){return nx(`${$.month}-01`,`${ee.month}-01`)}else if($.type==="schedule"||ee.type==="schedule"){return $.priority-ee.priority}else{return $.type.localeCompare(ee.type)}})}let ey=nQ(et);let eg=await uZ(ey,`sum-amount-${$.id}`);let em=await uZ(ey,`leftover-${$.id}`);let e_=0;let ew;let eE;let eS=em-eg-eu;let eT=0;for(let eu=0;eu<ee.length;eu++){let el=ee[eu];switch(el.type){case"simple":{if(el.limit!=null){if(ew!=null){ed.push(`More than one “up to” limit found.`);return{errors:ed}}else{ew=ix(el.limit.amount);eE=el.limit.hold}}let $=0;if(el.monthly!=null){let ee=ix(el.monthly);$=ee}else{$=ew}if(e_+$<es||!en){e_+=$}else{if(es>0)e_+=es;ed.push(`Insufficient funds.`)}break}case"by":{if(!uQ()){let $=0;let et=`${ee[eu].month}-01`;let ei=nx(et,ef);let eo=el.type==="by"?el.repeat:(el.repeat||1)*12;while(ei<0&&eo){et=nM(et,eo);ei=nx(ee[eu].month,ef)}if(eu===0)eT=eS;eT=ix(ee[eu].amount)-eT;if(eT>=0){$=eT;eT=0}else{$=0;eT=Math.abs(eT)}let ep=ei>=0?Math.round($/(ei+1)):0;if(ep>=0){if(e_+ep<es||!en){e_+=ep}else{if(es>0)e_+=es;ed.push(`Insufficient funds.`)}}}else{ed.push(`by templates are not supported in Report budgets`)}break}case"week":{let $=ix(el.amount);let ee=el.weeks!=null?Math.round(el.weeks):1;if(el.limit!=null){if(ew!=null){ed.push(`More than one “up to” limit found.`);return{errors:ed}}else{ew=ix(el.limit.amount);eE=el.limit.hold}}let et=el.starting;let ei=nM(ef,1);while(et<ei){if(et>=ef){if(e_+$<es||!en){e_+=$}else{if(es>0)e_+=es;ed.push(`Insufficient funds.`)}}et=nL(et,ee)}break}case"spend":{let ee=`${el.from}-01`;let et=`${el.month}-01`;let ei=eS;let eo=true;for(let et=ee;nx(ef,et)>0;et=nM(et,1)){let ee=nQ(n1(et,"yyyy-MM"));if(eo){let et=await uZ(ee,`sum-amount-${$.id}`);let en=await uZ(ee,`leftover-${$.id}`);ei=en-et;eo=false}else{let et=await uZ(ee,`budget-${$.id}`);ei+=et}}let eu=nx(et,nS(ef));let ep=ix(el.amount);let eh=0;if(eu<0){ed.push(`${el.month} is in the past.`);return{errors:ed}}else if(eu===0){eh=ep-ei}else{eh=Math.round((ep-ei)/(eu+1))}if(eh<es||!en){e_=eh}else{if(es>0)e_=es;ed.push(`Insufficient funds.`)}break}case"percentage":{let $=el.percent;let ee=0;if(el.category.toLowerCase()==="all income"){if(el.previous){let $=nQ(nM(et,-1));ee=await uZ($,"total-income")}else{ee=await uZ(ey,`total-income`)}}else if(el.category.toLowerCase()==="available funds"){ee=eo}else{let $=(await du()).find($=>$.is_income&&$.name.toLowerCase()===el.category.toLowerCase());if(!$){ed.push(`Could not find category “${el.category}”`);return{errors:ed}}if(el.previous){let en=nQ(nM(et,-1));ee=await uZ(en,`sum-amount-${$.id}`)}else{ee=await uZ(ey,`sum-amount-${$.id}`)}}let ei=Math.max(0,Math.round(ee*($/100)));if(ei+e_<=es||!en){e_+=ei}else{if(es>0)e_=es;ed.push(`Insufficient funds.`)}break}case"schedule":{if(!eh){eh=true;let $=ee.filter($=>$.type==="schedule");let et=[];let ei=0;for(let ee=0;ee<$.length;ee++){let{id:en,completed:eo}=await f6("SELECT * FROM schedules WHERE name = ?",[$[ee].name]);console.log(eo);let es=await vC(en);let eu=es.serialize().conditions;let{date:el,amount:ep}=pm(eu);let eh=-ep.value;let ey=vR(el,nS(ef));let eg=el.value.interval?el.value.interval:1;let em=el.value.frequency;let e_=Object(el.value)===el.value&&"frequency"in el.value;let ew=nx(ey,ef);et.push({template:$[ee],target:eh,next_date_string:ey,target_interval:eg,target_frequency:em,num_months:ew,completed:eo});if(!eo){if(e_){let $=0;let en=nM(ef,et[ee].num_months+1);let eo=vR(el,nS(ef));while(eo<en){$+=ep.value;eo=nF(eo,1);eo=vR(el,nS(eo))}et[ee].target=-$;ei+=eh}}else{ed.push(`Schedule ${et[ee].template.name} is a completed schedule.`)}}et=et.filter($=>$.completed===0);et=et.sort(($,ee)=>ee.target-$.target);let eo=0;if(em>=ei){for(let $=0;$<et.length;$++){if(et[$].num_months<0){ed.push(`Non-repeating schedule ${et[$].template.name} was due on ${et[$].next_date_string}, which is in the past.`);break}if(et[$].template.full&&et[$].num_months===0||et[$].target_frequency==="weekly"||et[$].target_frequency==="daily"){eo+=et[$].target}else if(et[$].template.full&&et[$].num_months>0){eo+=0}else{eo+=et[$].target/et[$].target_interval}}}else if(em<ei){for(let $=0;$<et.length;$++){if(uQ()){if(!et[$].template.full){ed.push(`Report budgets require the full option for Schedules.`);break}if(et[$].template.full&&et[$].num_months===0){e_+=et[$].target}}if(!uQ()){if(et[$].num_months<0){ed.push(`Non-repeating schedule ${et[$].template.name} was due on ${et[$].next_date_string}, which is in the past.`);break}if(et[$].template.full&&et[$].num_months>0){eT=0}else if($===0&&!et[$].template.full){eT=et[$].target-eS}else{eT=et[$].target-eT}let ee=0;if(eT>=0){ee=eT;eT=0}else{ee=0;eT=Math.abs(eT)}if(et[$].template.full||et[$].num_months===0||et[$].target_frequency==="weekly"||et[$].target_frequency==="daily"){eo+=ee}else if(et[$].template.full&&et[$].num_months>0){eo+=0}else{eo+=ee/(et[$].num_months+1)}}}}eo=Math.round(eo);if(eo>0&&e_+eo<=es||!en){e_+=eo}else if(e_+eo>es&&es>=0){e_=es;ed.push(`Insufficient funds.`)}}break}case"remainder":{if(ei>=0){e_+=ei===0?Math.round(el.weight):Math.round(ei*el.weight);if(e_>=es){e_=es}else if(es-e_===1){e_=e_+1}}break}case"error":return{errors:ed};default:}}if(ew!=null){if(eE&&em>ew){e_=0}else if(e_+em>ew){e_=ew-em}}if(($.budgeted!=null&&$.budgeted!==0||e_===0)&&!el){return{errors:ed}}else if($.budgeted===e_){return null}else{let et=$.name+": "+iP(eS);et+=" + "+iP(e_)+" = "+iP(eS+e_);et+=" "+ee.map($=>$.line).join("\n");console.log(et);return{amount:e_,errors:ed}}}async function be(){let $=await v9(null);let ee=[];let et=await f2("SELECT * FROM v_categories WHERE tombstone = 0");for(let en=0;en<et.length;en++){let ei=et[en];let eo=$[ei.id];if(eo){for(let $=0;$<eo.length;$++){if(eo[$].type==="error"){ee.push(ei.name+": "+eo[$].line)}}}}if(ee.length){return{sticky:true,message:`There were errors interpreting some templates:`,pre:ee.join("\n\n")}}else{return{type:"message",message:"All templates passed! 🎉"}}};let bt=lX();bt.method("budget/budget-amount",aP(cd(u4)));bt.method("budget/copy-previous-month",aP(cd(u5)));bt.method("budget/copy-single-month",aP(cd(u9)));bt.method("budget/set-zero",aP(cd(u7)));bt.method("budget/set-3month-avg",aP(cd(le)));bt.method("budget/set-n-month-avg",aP(cd(lt)));bt.method("budget/check-templates",aP(cd(vQ)));bt.method("budget/apply-goal-template",aP(cd(vZ)));bt.method("budget/overwrite-goal-template",aP(cd(vJ)));bt.method("budget/apply-single-template",aP(cd(vX)));bt.method("budget/cleanup-goal-template",aP(cd(_1)));bt.method("budget/hold-for-next-month",aP(cd(lr)));bt.method("budget/reset-hold",aP(cd(ln)));bt.method("budget/cover-overspending",aP(cd(li)));bt.method("budget/transfer-available",aP(cd(ls)));bt.method("budget/transfer-category",aP(cd(lu)));bt.method("budget/set-carryover",aP(cd(lf)));const br=bt;const bn={validate($,{update:ee}={}){oq("transaction_filters",$,["conditions"],ee);if(!ee||"conditionsOp"in $){if(!["and","or"].includes($.conditionsOp)){throw new Error("Invalid filter conditionsOp: "+$.conditionsOp)}}return $},toJS($){let{conditions:ee,conditions_op:et,...en}=$;return{...en,conditionsOp:et,conditions:g2(ee)}},fromJS($){let{conditionsOp:ee,...et}=$;if(ee){et.conditions_op=ee}return et}};async function bi($,ee,et){let en=await f6("SELECT id from transaction_filters WHERE tombstone = 0 AND name = ?",[$]);if(en===null){return false}if(!et){return en.id!==ee}return true}function bo($,ee,et){let{conditions:en,conditionsOp:ei}=$;let eo=[];let es=false;let eu;ee.map($=>{if(!es&&(en.length===1?true:$.conditionsOp===ei)&&!$.tombstone&&$.conditions.length===en.length){es=false;en.map((ee,et)=>{eo[et]=$.conditions.filter($=>{return ee.value===$.value&&ee.op===$.op&&ee.field===$.field}).length>0;es=(et===0?true:es)&&eo[et];return true});eu=es&&eo[en.length-1]&&$}return true});eo=[];if(!et){return eu?eu.id!==$.id?eu.name:false:false}return eu?eu.name:false}async function bs($){let ee=e_();let et={id:ee,conditions:$.state.conditions,conditionsOp:$.state.conditionsOp,name:$.state.name};if(et.name){if(await bi(et.name,et.id,true)){throw new Error("There is already a filter named "+et.name)}}else{throw new Error("Filter name is required")}if(et.conditions.length>0){let ee=bo(et,$.filters,true);if(ee){throw new Error("Duplicate filter warning: conditions already exist. Filter name: "+ee)}}else{throw new Error("Conditions are required")}await di("transaction_filters",bn.fromJS(et));return ee}async function bu($){let ee={id:$.state.id,conditions:$.state.conditions,conditionsOp:$.state.conditionsOp,name:$.state.name};if(ee.name){if(await bi(ee.name,ee.id,false)){throw new Error("There is already a filter named "+ee.name)}}else{throw new Error("Filter name is required")}if(ee.conditions.length>0){let et=bo(ee,$.filters,false);if(et){throw new Error("Duplicate filter warning: conditions already exist. Filter name: "+et)}}else{throw new Error("Conditions are required")}await ds("transaction_filters",bn.fromJS(ee))}async function bl($){await de("transaction_filters",$)}let bf=lX();bf.method("filter-create",aP(bs));bf.method("filter-update",aP(bu));bf.method("filter-delete",aP(cd(bl)));const bd=bf;async function bp($,ee){await Er["close-budget"]();let et;try{({id:et}=await c5({cloudFileId:null,groupId:null},ee))}catch($){if($.type==="FileDownloadError"){return{error:$.reason}}throw $}let en=await oe(ou(od(et),"db.sqlite"));a8(en,`
|
|
195
|
+
ORDER BY date DESC`,[oK(en),oK(nF(nR(),180))]);let eo=iu(ei,"payee");let es=new Map;for(let $ of ee){if($){let ee=(eo.get($)||[]).slice(0,5);if(ee.find($=>et.has($.id))){let et=my(ee);if(et){es.set($,et)}}}}await fD(async()=>{for(let[$,ee]of es.entries()){let et=[...mf(null,"payee","category",{condValue:$})];if(et.length>0){for(let $ of et){let et=$.actions[0];if(et.value!==ee){await mr({...$,actions:[{...et,value:ee}]})}}}else{let et=new gI({stage:null,conditionsOp:"and",conditions:[{op:"is",field:"payee",value:$}],actions:[{op:"set",field:"category",value:ee}],fieldTypes:d3});await mt(et.serialize())}}})};function mm($,ee){return{type:"BankSyncError",category:$,code:ee}}function m_($,ee){let{subtransactions:et,...en}=iq({...$,is_parent:true,subtransactions:ee.map((ee,et)=>i$($,{...ee,sort_order:0-et}))});return[en,...et]}function mv($){switch($.type){case"credit":case"loan":return-$.balances.current;default:return $.balances.current}}async function mw($,ee){await fJ("UPDATE accounts SET balance_current = ? WHERE id = ?",[iF(ee),$])}async function mE($,ee,et){let en=await l8(cn().PLAID_SERVER+"/accounts",{userId:$,key:ee,item_id:et});let{accounts:ei}=en;ei.forEach($=>{$.balances.current=mv($)});return ei}async function mS($,ee,et){const en=await rX("user-token");if(!en)return;let ei=await l8(cn().GOCARDLESS_SERVER+"/accounts",{userId:$,key:ee,item_id:et},{"X-ACTUAL-TOKEN":en});let{accounts:eo}=ei;eo.forEach($=>{$.balances.current=mv($)});return eo}function mT($){return{imported_id:$.transaction_id,payee_name:$.name,imported_payee:$.name,amount:-iF($.amount),date:$.date}}async function mO($,ee,et,en,ei,eo){let es=[];let eu=null;let el=100;let ef=0;let ed=0;while(1){const ep=nR();const eh=await l8(cn().PLAID_SERVER+"/transactions",{userId:$,key:ee,item_id:""+en,account_id:et,start_date:ei,end_date:ep,count:el,offset:ef});if(eh.error_code){throw mm(eh.error_type,eh.error_code)}if(eh.transactions.length===0){break}ed+=eh.transactions.length;es=es.concat(eh.transactions.filter($=>!$.pending));eu=mv(eh.accounts[0]);if(ed===eh.total_transactions||eo!=null&&es.length>=eo){break}ef+=el}es=eo!=null?es.slice(0,eo):es;return{transactions:es.map(mT),accountBalance:eu}}async function mI($,ee,et,en,ei){let eo=await rX("user-token");if(!eo)return;const es=await l8(cn().GOCARDLESS_SERVER+"/transactions",{userId:$,key:ee,requisitionId:en,accountId:et,startDate:ei},{"X-ACTUAL-TOKEN":eo});if(es.error_code){throw mm(es.error_type,es.error_code)}const{transactions:{all:eu},balances:el,startingBalance:ef}=es;return{transactions:eu,accountBalance:el,startingBalance:ef}}async function mN($,ee,et){if($.payee==null&&ee){let $=et.get(ee.toLowerCase());$=$||await dk(ee);if($!=null){return $.id}else{let $={id:e_(),name:ee};et.set(ee.toLowerCase(),$);return $.id}}return $.payee}async function mD($,ee,{rawPayeeName:et=false}={}){let en=new Map;let ei=[];for(let eo of $){if(eo.date==null){throw new Error("`date` is required when adding a transaction")}let{payee_name:$,subtransactions:es,...eu}=eo;eo=eu;if($){let ee=$.trim();if(ee===""){$=null}else{$=et?ee:d6(ee)}}eo.imported_payee=eo.imported_payee||$;if(eo.imported_payee){eo.imported_payee=eo.imported_payee.trim()}eo.account=ee;eo.payee=await mN(eo,$,en);ei.push({payee_name:$,subtransactions:es?es.map($=>({...$,account:ee})):null,trans:eo})}return{normalized:ei,payeesToCreate:en}}async function mR($,ee){let et=new Map;let en=[];for(let ei of $){if(!ei.amount){ei.amount=ei.transactionAmount.amount}if(ei.date==null){throw new Error("`date` is required when adding a transaction")}let $;if(ei.amount>0||Object.is(Number(ei.amount),0)){const ee=[];ee.push(d6(ei.debtorName||ei.remittanceInformationUnstructured||(ei.remittanceInformationUnstructuredArray||[]).join(", ")));if(ei.debtorAccount&&ei.debtorAccount.iban){ee.push("("+ei.debtorAccount.iban.slice(0,4)+" XXX "+ei.debtorAccount.iban.slice(-4)+")")}$=ee.join(" ")}else{const ee=[];ee.push(d6(ei.creditorName||ei.remittanceInformationUnstructured||(ei.remittanceInformationUnstructuredArray||[]).join(", ")));if(ei.creditorAccount&&ei.creditorAccount.iban){ee.push("("+ei.creditorAccount.iban.slice(0,4)+" XXX "+ei.creditorAccount.iban.slice(-4)+")")}$=ee.join(" ")}ei.imported_payee=ei.imported_payee||$;if(ei.imported_payee){ei.imported_payee=ei.imported_payee.trim()}ei.account=ee;ei.payee=await mN(ei,$,et);ei.cleared=Boolean(ei.booked);en.push({payee_name:$,trans:{amount:iF(ei.amount),payee:ei.payee,account:ei.account,date:ei.date,notes:ei.remittanceInformationUnstructured||(ei.remittanceInformationUnstructuredArray||[]).join(", "),imported_id:ei.transactionId,imported_payee:ei.imported_payee,cleared:ei.cleared}})}return{normalized:en,payeesToCreate:et}}async function mC($,ee){let et=new Set(ee.map($=>$.payee));await fD(async()=>{for(let ee of $.values()){if(et.has(ee.id)){await dT(ee)}}})}async function mk($,ee){const et=new Set;const en=[];const ei=[];let{normalized:eo,payeesToCreate:es}=await mR(ee,$);let eu=[];for(let{payee_name:ee,trans:en,subtransactions:ei}of eo){en=mo(en);let eo=null;let es=null;if(en.imported_id){eo=await f3("SELECT * FROM v_transactions WHERE imported_id = ? AND account = ?",[en.imported_id,$]);if(eo){et.add(eo.id)}}if(!eo){es=await f4(`SELECT id, is_parent, date, imported_id, payee, category, notes FROM v_transactions
|
|
196
|
+
WHERE date >= ? AND date <= ? AND amount = ? AND account = ? AND is_child = 0`,[oK(nB(en.date,4)),oK(nF(en.date,1)),en.amount||0,$])}eu.push({payee_name:ee,trans:en,subtransactions:ei,match:eo,fuzzyDataset:es})}let el=eu.map($=>{if(!$.match&&$.fuzzyDataset){let ee=$.fuzzyDataset.find(ee=>!et.has(ee.id)&&$.trans.payee===ee.payee);if(ee){et.add(ee.id);return{...$,match:ee}}}return $});let ef=el.map($=>{if(!$.match&&$.fuzzyDataset){let ee=$.fuzzyDataset.find($=>!et.has($.id));if(ee){et.add(ee.id);return{...$,match:ee}}}return $});for(let{trans:$,subtransactions:ee,match:et}of ef){if(et){let ee={...et,cleared:et.cleared===1,date:oZ(et.date)};const ei={imported_id:$.imported_id||null,payee:ee.payee||$.payee||null,category:ee.category||$.category||null,imported_payee:$.imported_payee||null,notes:ee.notes||$.notes||null,cleared:$.cleared!=null?$.cleared:true};if(ir(ee,ei,Object.keys(ei))){en.push({id:ee.id,...ei})}if(ee.is_parent&&ee.cleared!==ei.cleared){const $=await f4("SELECT id FROM v_transactions WHERE parent_id = ?",[ee.id]);for(const ee of $){en.push({id:ee.id,cleared:ei.cleared})}}}else{let et={...$,id:e_(),category:$.category||null,cleared:$.cleared!=null?$.cleared:true};if(ee&&ee.length>0){ei.push(...m_(et,ee))}else{ei.push(et)}}}await mC(es,[...ei,...en]);await gq({added:ei,updated:en});return{added:ei.map($=>$.id),updated:en.map($=>$.id)}}async function mM($,ee){const et=new Set;const en=[];const ei=[];let{normalized:eo,payeesToCreate:es}=await mD(ee,$);let eu=[];for(let{payee_name:ee,trans:en,subtransactions:ei}of eo){en=mo(en);let eo=null;let es=null;if(en.imported_id){eo=await f3("SELECT * FROM v_transactions WHERE imported_id = ? AND account = ?",[en.imported_id,$]);if(eo){et.add(eo.id)}}if(!eo){es=await f4(`SELECT id, is_parent, date, imported_id, payee, category, notes FROM v_transactions
|
|
197
|
+
WHERE date >= ? AND date <= ? AND amount = ? AND account = ? AND is_child = 0`,[oK(nB(en.date,4)),oK(nF(en.date,1)),en.amount||0,$])}eu.push({payee_name:ee,trans:en,subtransactions:ei,match:eo,fuzzyDataset:es})}let el=eu.map($=>{if(!$.match&&$.fuzzyDataset){let ee=$.fuzzyDataset.find(ee=>!et.has(ee.id)&&$.trans.payee===ee.payee);if(ee){et.add(ee.id);return{...$,match:ee}}}return $});let ef=el.map($=>{if(!$.match&&$.fuzzyDataset){let ee=$.fuzzyDataset.find($=>!et.has($.id));if(ee){et.add(ee.id);return{...$,match:ee}}}return $});for(let{trans:$,subtransactions:ee,match:et}of ef){if(et){let ee={...et,cleared:et.cleared===1,date:oZ(et.date)};const ei={date:$.date,imported_id:$.imported_id||null,payee:ee.payee||$.payee||null,category:ee.category||$.category||null,imported_payee:$.imported_payee||null,notes:ee.notes||$.notes||null,cleared:$.cleared!=null?$.cleared:true};if(ir(ee,ei,Object.keys(ei))){en.push({id:ee.id,...ei})}if(ee.is_parent&&ee.cleared!==ei.cleared){const $=await f4("SELECT id FROM v_transactions WHERE parent_id = ?",[ee.id]);for(const ee of $){en.push({id:ee.id,cleared:ei.cleared})}}}else{let et={...$,id:e_(),category:$.category||null,cleared:$.cleared!=null?$.cleared:true};if(ee&&ee.length>0){ei.push(...m_(et,ee))}else{ei.push(et)}}}await mC(es,[...ei,...en]);await gq({added:ei,updated:en});return{added:ei.map($=>$.id),updated:en.map($=>$.id)}}async function mx($,ee,{runTransfers:et=true}={}){const en=[];let{normalized:ei,payeesToCreate:eo}=await mD(ee,$,{rawPayeeName:true});for(let{trans:ee,subtransactions:et}of ei){ee=mo(ee);let ei={id:e_(),...ee,account:$,cleared:ee.cleared!=null?ee.cleared:true};if(et&&et.length>0){en.push(...m_(ei,et))}else{en.push(ei)}}await mC(eo,en);let es;if(et){let $=await gq({added:en});es=$.added.map($=>$.id)}else{await fD(async()=>{es=await Promise.all(en.map(async $=>dW($)))})}return es}async function mP($,ee,et,en,ei){const eo=await f3("SELECT * FROM v_transactions WHERE account = ? ORDER BY date DESC LIMIT 1",[et]);const es=await f9("accounts",et);if(eo){const eo=await f3("SELECT date FROM v_transactions WHERE account = ? ORDER BY date ASC LIMIT 1",[et]);const es=nT(oZ(eo.date));const eu=nI(eT([nT(nB(nR(),90)),es]));let{transactions:el,accountBalance:ef}=await mI($,ee,en,ei,eu);if(el.length===0){return{added:[],updated:[]}}el=el.map($=>({...$,account:et}));return aq(async()=>{const $=await mk(et,el);await mw(et,ef);return $})}else{const eo=nB(nR(),90);const{transactions:eu,startingBalance:el}=await mI($,ee,en,ei,eo);const ef=eu[eu.length-1];const ed=eu.length>0?ef.date:nR();const ep=await d$();return aq(async()=>{let $=await dW({account:et,amount:el,category:es.offbudget===0?ep.category:null,payee:ep.id,date:ed,cleared:true,starting_balance_flag:true});let ee=await mk(et,eu);return{...ee,added:[$,...ee.added]}})}}async function mF($,ee,et,en,ei){const eo=await f3("SELECT * FROM v_transactions WHERE account = ? ORDER BY date DESC LIMIT 1",[et]);if(eo){const es=await f3("SELECT date FROM v_transactions WHERE account = ? ORDER BY date ASC LIMIT 1",[et]);const eu=oZ(es.date);let el=nB(oZ(eo.date),31);if(el<eu){el=eu}let{transactions:ef,accountBalance:ed}=await mO($,ee,en,ei,el);if(ef.length===0){return{added:[],updated:[]}}ef=ef.map($=>({...$,account:et}));return aq(async()=>{const $=await mM(et,ef);await mw(et,ed);return $})}else{const eo=await f9("accounts",et);const es=nB(nR(),eo.offbudget===0?1:30);const{transactions:eu}=await mO($,ee,en,ei,t4(rv(es),"yyyy-MM-dd"));let el=eo.balance_current;const ef=eu.reduce(($,ee)=>{return $-ee.amount},el);const ed=eu.length>0?eu[eu.length-1].date:nR();let ep=await d$();return aq(async()=>{let $=await dW({account:et,amount:ef,category:eo.offbudget===0?ep.category:null,payee:ep.id,date:ed,cleared:true,starting_balance_flag:true});let ee=await mM(et,eu);return{...ee,added:[$,...ee.added]}})}};let mB=0;function mU(){mB+=.45;if(mB>1){mB=0}return mB}const mj=nm?mU:Math.random;const mW=mj;function mH($){return $[Math.floor(mW()*$.length)%$.length]}function mz($,ee){return $+(ee-$)*mW()}function mV($,ee){return Math.round(mz($,ee))}function m$($,ee){let et=$[0];for(let en=0;en<$.length;en++){if($[en][ee]<et[ee]){et=$[en]}}return et}function mq($){return $.find($=>$.name==="Starting Balances").id}function mG($,ee){let et=$.find($=>$.name==="Deposit");let en=$.filter($=>$.name!=="Deposit"&&$.name!=="Starting Balance");let ei=ee.find($=>$.is_income===0);let eo=ee.find($=>$.is_income===1);let es=ei.categories.filter($=>["Food","Restaurants","Entertainment","Clothing","General","Gift","Medical"].indexOf($.name)!==-1);return{incomePayee:et,expensePayees:en.filter($=>!$.bill),incomeGroup:eo,expenseCategories:es,billCategories:ee.find($=>$.name==="Bills").categories,billPayees:en.filter($=>$.bill)}}async function mY($,ee,et,en){let{incomePayee:ei,expensePayees:eo,incomeGroup:es,expenseCategories:eu,billCategories:el,billPayees:ef}=mG(et,en);let ed=mV(100,200);let ep=[];for(let $=0;$<ed;$++){let et;if(mW()<.09){et=ei}else{et=mH(eo)}let en;if(et.name==="Deposit"){en=es.categories.find($=>$.name==="Income")}else{en=mH(eu)}let el;if(et.name==="Deposit"){el=mV(5e4,7e4)}else{el=mV(0,mW()<.05?-8e3:-700)}let ef={amount:el,payee:et.id,account:ee.id,date:nB(nR(),Math.floor($/3)),category:en.id};ep.push(ef);if(mW()<.2){let $=Math.round(ef.amount/3);let ee=()=>et===ei?es.categories.find($=>$.name==="Income").id:mH(eu).id;ef.subtransactions=[{amount:$,category:ee()},{amount:$,category:ee()},{amount:ef.amount-$*2,category:ee()}]}}let eh=nA(ep[ep.length-1].date);let ey=nV(eh,nN());let eg=nR();for(let $ of ey){let et=nF($,12);if(nU(et,eg)){ep.push({amount:-1e4,payee:ef.find($=>$.name.toLowerCase().includes("power")).id,account:ee.id,date:et,category:el.find($=>$.name==="Power").id})}et=nF($,18);if(nU(et,eg)){ep.push({amount:-9e3,payee:ef.find($=>$.name.toLowerCase().includes("water")).id,account:ee.id,date:et,category:el.find($=>$.name==="Water").id})}et=nF($,2);if(nU(et,eg)){ep.push({amount:-12e4,payee:ef.find($=>$.name.toLowerCase().includes("housy")).id,account:ee.id,date:et,category:el.find($=>$.name==="Mortgage").id})}et=nF($,20);if(nU(et,eg)){ep.push({amount:-6e3,payee:ef.find($=>$.name.toLowerCase().includes("internet")).id,account:ee.id,date:et,category:el.find($=>$.name==="Internet").id})}et=nF($,23);if(nU(et,eg)){ep.push({amount:-7500,payee:ef.find($=>$.name.toLowerCase().includes("t-mobile")).id,account:ee.id,date:et,category:el.find($=>$.name==="Cell").id})}}let em=null;ep.forEach($=>{if(em==null||$.date<em){em=$.date}});ep.unshift({amount:1e5,payee:et.find($=>$.name==="Starting Balance").id,account:ee.id,date:em,category:mq(es.categories),starting_balance_flag:true});return mx(ee.id,ep)}async function mK($,ee,et,en){let{incomePayee:ei,expensePayees:eo,incomeGroup:es,expenseCategories:eu}=mG(et,en);let el=mV(20,40);let ef=[];for(let $=0;$<el;$++){let et;if(mW()<.04){et=ei}else{et=mH(eo)}let en;if(et.name==="Deposit"){en=es.categories.find($=>$.name==="Income")}else{en=mH(eu)}let el=et.name==="Deposit"?mV(5e4,7e4):mV(0,-1e4);ef.push({amount:el,payee:et.id,account:ee.id,date:nB(nR(),$*2),category:en.id})}ef.unshift({amount:mV(9e4,12e4),payee:et.find($=>$.name==="Starting Balance").id,account:ee.id,date:ef[ef.length-1].date,category:mq(es.categories),starting_balance_flag:true});await $["transactions-batch-update"]({added:ef,fastMode:true})}async function mZ($,ee,et,en){let{incomePayee:ei,incomeGroup:eo}=mG(et,en);let es=mV(10,30);let eu=[];for(let $=0;$<es;$++){let $=ei;let et=eo.categories.find($=>$.name==="Income");let en=mV(1e4,2e4);eu.push({amount:en,payee:$.id,account:ee.id,date:nB(nR(),mV(10,360)),category:et.id})}eu.unshift({amount:mV(1e4,2e4),payee:et.find($=>$.name==="Starting Balance").id,account:ee.id,date:m$(eu,"date").date,category:mq(eo.categories),starting_balance_flag:true});await $["transactions-batch-update"]({added:eu,fastMode:true})}async function mJ($,ee,et,en){let{incomePayee:ei,expensePayees:eo,incomeGroup:es,expenseCategories:eu}=mG(et,en);let el=mV(15,40);let ef=[];for(let $=0;$<el;$++){let et;if(mW()<.3){et=ei}else{et=mH(eo)}let en=et===ei?es.categories.find($=>$.name==="Income"):mH(eu);let el=et===ei?mV(1e4,8e4):mV(-1e4,-2e3);ef.push({amount:el,payee:et.id,account:ee.id,date:nB(nR(),$*5),category:en.id})}ef.unshift({amount:3e4,payee:et.find($=>$.name==="Starting Balance").id,account:ee.id,date:ef[ef.length-1].date,category:mq(es.categories),starting_balance_flag:true});await $["transactions-batch-update"]({added:ef,fastMode:true})}async function mX($,ee,et,en){let{incomePayee:ei,incomeGroup:eo}=mG(et,en);let es=mV(7,10);let eu=mV(1e5,2e5);let el=eo.categories.find($=>$.name==="Income");let ef=[{amount:mV(-3e3,-3500)*100*100,payee:et.find($=>$.name==="Starting Balance").id,account:ee.id,date:nP(nR(),es)+"-02",category:mq(eo.categories),starting_balance_flag:true}];for(let $=0;$<es;$++){let et=ei;ef.push({amount:eu,payee:et.id,account:ee.id,date:nP(nR(),$)+"-02",category:el.id,starting_balance_flag:true})}await $["transactions-batch-update"]({added:ef,fastMode:true})}async function mQ($,ee,et,en){let{incomePayee:ei,incomeGroup:eo}=mG(et,en);let es=mV(3,6);let eu=eo.categories.find($=>$.name==="Income");let el=[{amount:mV(3250,3700)*100*100,payee:et.find($=>$.name==="Starting Balance").id,account:ee.id,date:nP(nR(),es)+"-02",category:mq(eo.categories),starting_balance_flag:true}];for(let $=0;$<es;$++){let et=ei;let en=mV(4,9)*100*100;el.push({amount:en,payee:et.id,account:ee.id,date:nP(nR(),$)+"-02",category:eu.id})}await $["transactions-batch-update"]({added:el,fastMode:true})}async function m0($,ee,et){let en=$.find($=>$.name="Bank of America");let ei=(await f3(`SELECT * FROM v_transactions t LEFT JOIN accounts a ON t.account = a.id
|
|
198
|
+
WHERE a.offbudget = 0 AND t.is_child = 0 ORDER BY date ASC LIMIT 1`)).date;let eo=(await f3(`SELECT * FROM v_transactions t LEFT JOIN accounts a ON t.account = a.id
|
|
199
|
+
WHERE a.id = ? AND a.offbudget = 0 AND t.is_child = 0 ORDER BY date ASC LIMIT 1`,[en.id])).date;let es=nA(oZ(ei));let eu=nN();let el=nV(es,eu);function ef($){for(let ee of et){let et=ee.categories.find(ee=>ee.name===$);if(et){return et}}}function ed($,ee,et){return u8({month:$,category:ee.id,amount:et})}function ep($,ee){let et=uY(n0($),`sum-amount-${ee.id}`);if(et<0){ed($,ee,-et)}}await aq(()=>fD(async()=>{for(let $ of el){if($>=nA(oZ(eo))){ed($,ef("Food"),4e4);ed($,ef("Restaurants"),3e4);ed($,ef("Entertainment"),1e4);ed($,ef("Clothing"),3e3);ed($,ef("General"),5e4);ed($,ef("Gift"),7500);ed($,ef("Medical"),1e4);ed($,ef("Cell"),7500);ed($,ef("Internet"),6e3);ed($,ef("Mortgage"),12e4);ed($,ef("Water"),9e3);ed($,ef("Power"),1e4)}else{ep($,ef("Food"));ep($,ef("Restaurants"));ep($,ef("Entertainment"));ep($,ef("Clothing"));ep($,ef("General"));ep($,ef("Gift"));ep($,ef("Medical"));ep($,ef("Cell"));ep($,ef("Internet"));ep($,ef("Mortgage"));ep($,ef("Water"));ep($,ef("Power"))}}}));await uJ();await aq(()=>fD(async()=>{let $=0;for(let ee of el){if(ee>=nA(oZ(eo))&&ee<=nN()){let et=n0(ee);let en=uY(et,"to-budget");let ei=en-$;if(ei-403e3>0){ed(ee,ef("Savings"),ei-403e3);u5(ee,403e3);$+=ei-403e3}else if(ei>0){u5(ee,ei)}}}}));await uJ();let eh=n0(nN());let ey=uY(eh,"to-budget");if(ey<0){await mx(en.id,[{amount:-ey,category:ef("Income").id,date:nN()+"-01"}])}await uJ()}async function m6(ee){fp("import");await fX("PRAGMA journal_mode = OFF");await fJ("DELETE FROM categories;");await fJ("DELETE FROM category_groups");let et=[{name:"Bank of America"},{name:"Ally Savings"},{name:"Capital One Checking"},{name:"HSBC"},{name:"Vanguard 401k",offBudget:1},{name:"Mortgage",offBudget:1},{name:"House Asset",offBudget:1},{name:"Roth IRA",offBudget:1}];await aq(()=>fD(async()=>{for(let $ of et){$.id=await ee["account-create"]($)}}));let en=[{name:"Starting Balance"},{name:"Kroger"},{name:"Publix"},{name:"Home Depot"},{name:"Movies"},{name:"Online store"},{name:"Deposit"},{name:"Dominion Power",bill:true},{name:"Extra Watery",bill:true},{name:"Housy House",bill:true},{name:"Fast Internet",bill:true},{name:"T-mobile",bill:true}];await aq(()=>fD(async()=>{for(let $ of en){$.id=await ee["payee-create"]({name:$.name})}}));let ei=[{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:true,categories:[{name:"Income",is_income:true},{name:"Misc",is_income:true},{name:"Starting Balances",is_income:true}]}];await aq(async()=>{for(let $ of ei){$.id=await ee["category-group-create"]({name:$.name,isIncome:$.is_income?1:0});for(let et of $.categories){et.id=await ee["category-create"]({...et,isIncome:et.is_income?1:0,groupId:$.id})}}});let eo=(await aH(ee["get-categories"])).grouped;fp("import");await aq(()=>fD(async()=>{for(let $ of et){if($.name==="Bank of America"){await mY(ee,$,en,eo)}else if($.name==="Capital One Checking"||$.name==="HSBC"){await mK(ee,$,en,eo)}else if($.name==="Ally Savings"){await mJ(ee,$,en,eo)}else if($.name==="Vanguard 401k"||$.name==="Roth IRA"){await mZ(ee,$,en,eo)}else if($.name==="Mortgage"){await mX(ee,$,en,eo)}else if($.name==="House Asset"){await mQ(ee,$,en,eo)}else{console.error("Unknown account name for test budget: ",$.name);await mK(ee,$,en,eo)}}}));fp("import");let es=et.find($=>$.name="Bank of America");let{data:eu}=await ug(ue("transactions").filter({account:es.id}).calculate({$sum:"$amount"}).serialize());if(eu<0){let{data:$}=await ug(ue("transactions").filter({account:es.id,amount:{$gt:0}}).limit(1).select(["id","amount"]).serialize());let et=$[0];await aH(ee["transaction-update"],{...et,amount:et.amount+-eu+mV(1e4,2e4)})}fp("disabled");await uA({isCached:false});await u$($);await lz();await uJ();await aq(()=>fD(async()=>{const $=et.find($=>$.name==="Bank of America");await aH(ee["schedule/create"],{schedule:{name:"Phone bills",posts_transaction:false},conditions:[{op:"is",field:"payee",value:en.find($=>$.name==="Dominion Power").id},{op:"is",field:"account",value:$.id},{op:"is",field:"date",value:{start:nR(),frequency:"monthly",patterns:[],skipWeekend:false,weekendSolveMode:"after"}},{op:"isapprox",field:"amount",value:-12e3}]});await aH(ee["schedule/create"],{schedule:{name:"Internet bill",posts_transaction:false},conditions:[{op:"is",field:"payee",value:en.find($=>$.name==="Fast Internet").id},{op:"is",field:"account",value:$.id},{op:"is",field:"date",value:nB(nR(),1)},{op:"isapprox",field:"amount",value:-14e3}]});await aH(ee["schedule/create"],{schedule:{name:"Wedding",posts_transaction:false},conditions:[{op:"is",field:"date",value:{start:nB(nR(),3),frequency:"monthly",patterns:[],skipWeekend:false,weekendSolveMode:"after"}},{op:"is",field:"amount",value:-27e5}]});await aH(ee["schedule/create"],{schedule:{name:"Utilities",posts_transaction:false},conditions:[{op:"is",field:"account",value:$.id},{op:"is",field:"date",value:{start:nF(nR(),1),frequency:"monthly",patterns:[],skipWeekend:false,weekendSolveMode:"after"}},{op:"is",field:"amount",value:-19e4}]})}));await m0(et,en,eo)};function m4(){return String({}.REACT_APP_NETLIFY)==="true"}function m3(){return"production"==="development"}function m8(){return m4()||m3()}function m5(){if(navigator.userAgent.indexOf("Electron")>=0){return true}return false}var m9=__webpack_require__(7565);var m7=__webpack_require__.n(m9);async function _t($,ee,et,en){const ei=ee.reduce(($,{id:ee,name:et})=>{$[ee]=et;return $},{});const eo=et.reduce(($,{name:ee,categories:et})=>{et.forEach(et=>$[et.id]=`${ee}: ${et.name}`);return $},{});const es=en.reduce(($,{id:ee,name:et})=>{$[ee]=et;return $},{});const eu=$.map(({account:$,date:ee,payee:et,notes:en,category:eu,amount:el})=>({Account:ei[$],Date:ee,Payee:es[et],Notes:en,Category:eo[eu],Amount:el==null?0:iU(el)}));return m7()(eu,{header:true})}async function _r($){let{data:ee}=await ug($.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"}));let et=new Map;for(let $ of ee){if($.IsParent){et.set($.Id,$.Payee)}}let en=ee.filter($=>!$.IsParent);let ei=en.map($=>{return{Account:$.Account,Date:$.Date,Payee:$.ParentId?et.get($.ParentId):$.Payee,Notes:$.Notes,Category:$.Category,Amount:$.Amount==null?0:iU($.Amount)}});return m7()(ei,{header:true})};async function _o($,ee){let[[,et],[,en]]=await r6(["user-id","user-key"]);if($==null||!$.institution_id||!$.name){throw new Error("Invalid institution object")}let ei=e_();await l8(cn().PLAID_SERVER+"/handoff_public_token",{userId:et,key:en,item_id:ei,public_token:ee});await aq(()=>de("banks",{id:ei,bank_id:$.institution_id,name:$.name}));return ei}async function _u($,ee){let et=await f3("SELECT id, bank_id, name FROM banks WHERE bank_id = ?",[ee]);if(et){return et}const en={id:e_(),bank_id:ee,name:$.name};await de("banks",en);return en}async function _l($,ee,et=[]){let[[,en],[,ei]]=await r6(["user-id","user-key"]);let eo=await mE(en,ei,$);eo=eo.filter($=>ee.includes($.account_id));return Promise.all(eo.map(async ee=>{let eo=await aq(async()=>{let en=await dL({account_id:ee.account_id,name:ee.name,official_name:ee.official_name,balance_current:iF(ee.balances.current),mask:ee.mask,bank:$,offbudget:et.includes(ee.account_id)?1:0});await dT({name:"",transfer_acct:en});return en});await mF(en,ei,eo,ee.account_id,$);return eo}))}async function _c($,ee,et=[]){let[[,en],[,ei]]=await r6(["user-id","user-key"]);let eo=await mS(en,ei,$);eo=eo.filter($=>ee.includes($.account_id));return Promise.all(eo.map(async ee=>{let eo=await aq(async()=>{let en=await dL({account_id:ee.account_id,name:ee.name,official_name:ee.official_name,balance_current:iF(ee.balances.current),mask:ee.mask,bank:$,offbudget:et.includes(ee.account_id)?1:0});await dT({name:"",transfer_acct:en});return en});await mP(en,ei,eo,ee.account_id,$);return eo}))}var _f=__webpack_require__(6241);var _p=__webpack_require__.n(_f);var _h=__webpack_require__(5055);function _y($){return $.replace(/&/g,"&").replace(/&/g,"&").replace(/>\s+</g,"><").replace(/\s+</g,"<").replace(/>\s+/g,">").replace(/\.(?=[^<>]*>)/g,"").replace(/<(\w+?)>([^<]+)/g,"<$1>$2</<added>$1>").replace(/<\/<added>(\w+?)>(<\/\1>)?/g,"</$1>")}async function _g($){return await (0,_h.parseStringPromise)($,{explicitArray:false})}function _m($){const ee=$?.["OFX"];const et=ee?.["CREDITCARDMSGSRSV1"]!=null;const en=et?ee?.["CREDITCARDMSGSRSV1"]:ee?.["BANKMSGSRSV1"];const ei=en?.[`${et?"CC":""}STMTTRNRS`];const eo=ei?.[`${et?"CC":""}STMTRS`];const es=eo?.["BANKTRANLIST"];const eu=es?.["STMTTRN"];if(!Array.isArray(eu)){return[eu]}return eu}function _b($){const ee=$["DTPOSTED"];const et=ee?new Date(Number(ee.substring(0,4)),Number(ee.substring(4,6))-1,Number(ee.substring(6,8))):null;return{amount:$["TRNAMT"],type:$["TRNTYPE"],fitId:$["FITID"],date:nI(et),name:$["NAME"],memo:$["MEMO"]}}async function _w($){const ee=$.split("<OFX>",2);const et=ee[0].split(/\r?\n/);const en={};et.forEach($=>{if($){const ee=$.split(/:/,2);en[ee[0]]=ee[1]}});const ei=`<OFX>${ee[1]}`;let eo=null;try{eo=await _g(ei)}catch(ee){const $=_y(ei);eo=await _g($)}return{headers:en,transactions:_m(eo).map(_b)}};function _E($,ee={}){let et=$.split("\n");let en=et.shift();let ei=/!Type:([^$]*)$/.exec(en.trim());let eo={dateFormat:ee.dateFormat,transactions:[]};let es=eo.transactions;let eu={};if(!ei||!ei.length){throw new Error("File does not appear to be a valid qif file: "+en)}eo.type=ei[1];let el={};while(en=et.shift()){en=en.trim();if(en==="^"){es.push(eu);eu={};continue}switch(en[0]){case"D":eu.date=en.substring(1);break;case"T":eu.amount=en.substring(1);break;case"N":eu.number=en.substring(1);break;case"M":eu.memo=en.substring(1);break;case"A":eu.address=(eu.address||[]).concat(en.substring(1));break;case"P":eu.payee=en.substring(1).replace(/&/g,"&");break;case"L":let $=en.substring(1).split(":");eu.category=$[0];if($[1]!==undefined){eu.subcategory=$[1]}break;case"C":eu.clearedStatus=en.substring(1);break;case"S":let ee=en.substring(1).split(":");el.category=ee[0];if(ee[1]!==undefined){el.subcategory=ee[1]}break;case"E":el.description=en.substring(1);break;case"$":el.amount=parseFloat(en.substring(1));if(!(eu.division instanceof Array)){eu.division=[]}eu.division.push(el);el={};break;default:throw new Error("Unknown Detail Code: "+en[0])}}if(Object.keys(eu).length){es.push(eu)}return eo};async function _S($,ee){let et=Array();let en=$.match(/\.[^.]*$/);if(en){let et=en[0];switch(et.toLowerCase()){case".qif":return _O($);case".csv":case".tsv":return _T($,ee);case".ofx":case".qfx":return _A($,ee);default:}}et.push({message:"Invalid file type",internal:""});return{errors:et,transactions:[]}}async function _T($,ee){let et=Array();let en=await oH($);let ei;try{ei=_p()(en,{columns:ee?.hasHeaderRow,bom:true,delimiter:ee?.delimiter||",",quote:'"',trim:true,relax_column_count:true,skip_empty_lines:true})}catch($){et.push({message:"Failed parsing: "+$.message,internal:$.message});return{errors:et,transactions:[]}}return{errors:et,transactions:ei}}async function _O($){let ee=Array();let et=await oH($);let en;try{en=_E(et)}catch($){ee.push({message:"Failed parsing: doesn’t look like a valid QIF file.",internal:$.stack});return{errors:ee,transactions:[]}}return{errors:[],transactions:en.transactions.map($=>({amount:$.amount!=null?ij($.amount):null,date:$.date,payee_name:$.payee,imported_payee:$.payee,notes:$.memo||null}))}}async function _A($,ee){if(!ee?.enableExperimentalOfxParser){return _I($,ee)}const et=Array();const en=await oH($);let ei;try{ei=await _w(en)}catch($){et.push({message:"Failed importing file",internal:$.stack});return{errors:et}}let eo=ee.fallbackMissingPayeeToMemo;return{errors:et,transactions:ei.transactions.map($=>{return{amount:$.amount,imported_id:$.fitId,date:$.date,payee_name:$.name||(eo?$.memo:null),imported_payee:$.name||(eo?$.memo:null),notes:!!$.name||!eo?$.memo||null:null}})}}async function _I($,ee){let{getOFXTransactions:et,initModule:en}=await __webpack_require__.e("xfo").then(__webpack_require__.bind(__webpack_require__,4343));await en();let ei=Array();let eo=await oH($,"binary");let es;try{es=et(eo)}catch($){ei.push({message:"Failed importing file",internal:$.stack});return{errors:ei}}let eu=ee.fallbackMissingPayeeToMemo;return{errors:ei,transactions:es.map($=>({amount:$.amount,imported_id:$.fi_id,date:$.date?nI(new Date($.date*1e3)):null,payee_name:$.name||(eu?$.memo:null),imported_payee:$.name||(eu?$.memo:null),notes:!!$.name||!eu?$.memo||null:null}))}};function _N({reason:$,meta:ee}){switch($){case"unauthorized":return"You are not logged in.";case"encrypt-failure":if(ee.isMissingKey){return"Encrypting your file failed because you are missing your encryption key. Create your key in the next step."}return"Encrypting the file failed. You have the correct key so this is an internal bug. To fix this, generate a new key in the next step.";case"file-has-reset":return"Something went wrong while resetting your file. Please try again.";case"file-has-new-key":return"Unable to encrypt your data because you are missing the key. Create the latest key in the next step.";case"network":return"Uploading the file failed. Check your network connection.";default:return`An internal error occurred, sorry! Visit https://actualbudget.org/contact/ for support. (ref: ${$})`}}function _D({reason:$,meta:ee,fileName:et}){switch($){case"network":case"download-failure":return"Downloading the file failed. Check your network connection.";case"not-zip-file":case"invalid-zip-file":case"invalid-meta-file":return"Downloaded file is invalid, sorry! Visit https://actualbudget.org/contact/ for support.";case"decrypt-failure":return"Unable to decrypt file "+(et||"(unknown)")+". To change your key, first "+"download this file with the proper password.";case"out-of-sync-migrations":return"This budget cannot be loaded with this version of the app. "+"Make sure the app is up-to-date.";default:let en=ee&&ee.fileId?`, fileId: ${ee.fileId}`:"";return"Something went wrong trying to download that file, sorry! "+"Visit https://actualbudget.org/contact/ for support. "+`(reason: ${$}${en})`}}function _R($){return _N($)}function _C({reason:$}){switch($){case"network":return"Unable to connect to the server. We need to access the server to get some information about your keys.";case"old-key-style":return"This file is encrypted with an old unsupported key style. Recreate the key "+"on a device where the file is available, or use an older version of Actual to download "+"it.";case"decrypt-failure":return"Unable to decrypt file with this password. Please try again.";default:return"Something went wrong trying to create a key, sorry! Visit https://actualbudget.org/contact/ for support."}}function _k($,ee){if($==="out-of-sync-migrations"||$==="out-of-sync-data"){return"This budget cannot be loaded with this version of the app."}else if($==="budget-not-found"){return`Budget “${ee}” not found. Check the id of your budget in the Advanced section of the settings page.`}else{return`We had an unknown problem opening “${ee}”.`}};const _M={...oJ,toExternal($){return{id:$.id,name:$.name,offbudget:$.offbudget?true:false,closed:$.closed?true:false}},fromExternal($){let ee={...$};if("offbudget"in $){ee.offbudget=$.offbudget?1:0}if("closed"in $){ee.closed=$.closed?1:0}return ee}};const _L={...oX,toExternal($){return{id:$.id,name:$.name,is_income:$.is_income?true:false,group_id:$.cat_group}},fromExternal($){let{group_id:ee,...et}=$;if("is_income"in $){et.is_income=$.is_income?1:0}if("group_id"in $){et.cat_group=$.group_id}return et}};const _x={...oQ,toExternal($){return{id:$.id,name:$.name,is_income:$.is_income?true:false,categories:$.categories.map(_L.toExternal)}},fromExternal($){let ee={...$};if("is_income"in $){ee.is_income=$.is_income?1:0}if("categories"in $){ee.categories=$.categories.map(_L.fromExternal)}return ee}};const _P={...o0,toExternal($){return{id:$.id,name:$.name,category:$.category,transfer_acct:$.transfer_acct}},fromExternal($){return $}};let _F=false;function _B($,ee){return{type:"APIError",message:$,meta:ee}}function _U($){return ee=>{return aq(async()=>{let et=(0,eo.getClock)().timestamp.toString();let en=await $(ee);let ei=await f4("SELECT DISTINCT dataset FROM messages_crdt WHERE timestamp > ?",[et]);if(aQ()>1){aX("sync-event",{type:"success",tables:ei.map($=>$.dataset)})}return en},{undoDisabled:true})}}let _j={};async function _W($){if(!$.match(/^\d{4}-\d{2}$/)){throw _B("Invalid month format, use YYYY-MM: "+$)}if(!_F){let{start:ee,end:et}=await _j["get-budget-bounds"]();let en=nz(ee,et);if(!en.includes($)){throw _B("No budget exists for month: "+$)}}}async function _H($,ee){if(ee==null){throw _B(`${$}: category id is required`)}let et=await f3("SELECT is_income FROM categories WHERE id = ?",[ee]);if(!et){throw _B(`${$}: category “${ee}” does not exist`)}if(et.is_income!==0){throw _B(`${$}: category “${ee}” is not an expense category`)}}function _z(){if(!(uN()||{}).id){throw _B("No budget file is open")}}let _V=null;_j["api/batch-budget-start"]=async function(){if(_V){throw _B("Cannot start a batch process: batch already started")}if(_F){f6(()=>{return new Promise(($,ee)=>{_V={resolve:$,reject:ee}})})}else{fD(()=>{return new Promise(($,ee)=>{_V={resolve:$,reject:ee}})})}};_j["api/batch-budget-end"]=async function(){if(!_V){throw _B("Cannot end a batch process: no batch started")}_V.resolve();_V=null};_j["api/load-budget"]=async function({id:$}){let{id:ee}=uN()||{};if(ee!==$){aX("start-load");let{error:ee}=await _j["load-budget"]({id:$});if(!ee){aX("finish-load")}else{aX("show-budgets");throw new Error(_k(ee,$))}}};_j["api/download-budget"]=async function({syncId:$,password:ee}){let{id:et}=uN()||{};if(et){await _j["close-budget"]()}let en=(await _j["get-budgets"]()).find(ee=>ee.groupId===$);if(en){await _j["load-budget"]({id:en.id});let $=await _j["sync-budget"]();if($.error){throw new Error(_k($.error,en.id))}}else{let et=await _j["get-remote-files"]();if(!et){throw new Error("Could not get remote files")}let en=et.find(ee=>ee.groupId===$);if(!en){throw new Error(`Budget “${$}” not found. Check the sync id of your budget in the Advanced section of the settings page.`)}if(en.encryptKeyId&&!ee){throw new Error(`File ${en.name} is encrypted. Please provide a password.`)}if(ee){let $=await _j["key-test"]({fileId:en.fileId,password:ee});if($.error){throw new Error(_C($.error))}}let ei=await _j["download-budget"]({fileId:en.fileId});if(ei.error){console.log("Full error details",ei.error);throw new Error(_D(ei.error))}await _j["load-budget"]({id:ei.id})}};_j["api/sync"]=async function(){let{id:$}=uN();let ee=await _j["sync-budget"]();if(ee.error){throw new Error(_k(ee.error,$))}};_j["api/start-import"]=async function({budgetName:$}){await _j["close-budget"]();await _j["create-budget"]({budgetName:$,avoidUpload:true});await fJ("DELETE FROM categories WHERE is_income = 0");await fJ("DELETE FROM category_groups WHERE is_income = 0");fp("import");aX("start-import");_F=true};_j["api/finish-import"]=async function(){_z();uU().markCacheDirty();let{id:$}=uN();await _j["close-budget"]();await _j["load-budget"]({id:$});await _j["get-budget-bounds"]();await uJ();await fe().catch($=>{});aX("finish-import");_F=false};_j["api/abort-import"]=async function(){if(_F){_z();let{id:$}=uN();await _j["close-budget"]();await _j["delete-budget"]({id:$});aX("show-budgets")}_F=false};_j["api/query"]=async function({query:$}){_z();return ug($)};_j["api/budget-months"]=async function(){_z();let{start:$,end:ee}=await _j["get-budget-bounds"]();return nz($,ee)};_j["api/budget-month"]=async function({month:$}){_z();await _W($);let ee=await dp();let et=n0($);function en($){let ee=uU().getCellValue(et,$);return ee===""?0:ee}return{month:$,incomeAvailable:en("available-funds"),lastMonthOverspent:en("last-month-overspent"),forNextMonth:en("buffered"),totalBudgeted:en("total-budgeted"),toBudget:en("to-budget"),fromLastMonth:en("from-last-month"),totalIncome:en("total-income"),totalSpent:en("total-spent"),totalBalance:en("total-leftover"),categoryGroups:ee.map($=>{if($.is_income){return{..._x.toExternal($),received:en("total-income"),categories:$.categories.map($=>({..._L.toExternal($),received:en(`sum-amount-${$.id}`)}))}}return{..._x.toExternal($),budgeted:en(`group-budget-${$.id}`),spent:en(`group-sum-amount-${$.id}`),balance:en(`group-leftover-${$.id}`),categories:$.categories.map($=>({..._L.toExternal($),budgeted:en(`budget-${$.id}`),spent:en(`sum-amount-${$.id}`),balance:en(`leftover-${$.id}`),carryover:en(`carryover-${$.id}`)}))}})}};_j["api/budget-set-amount"]=_U(async function({month:$,categoryId:ee,amount:et}){_z();return _j["budget/budget-amount"]({month:$,category:ee,amount:et})});_j["api/budget-set-carryover"]=_U(async function({month:$,categoryId:ee,flag:et}){_z();await _W($);await _H("budget-set-carryover",ee);return _j["budget/set-carryover"]({startMonth:$,category:ee,flag:et})});_j["api/transactions-export"]=async function({transactions:$,categoryGroups:ee,payees:et}){_z();return _j["transactions-export"]({transactions:$,categoryGroups:ee,payees:et})};_j["api/transactions-import"]=_U(async function({accountId:$,transactions:ee}){_z();return _j["transactions-import"]({accountId:$,transactions:ee})});_j["api/transactions-add"]=_U(async function({accountId:$,transactions:ee}){_z();await mx($,ee,{runTransfers:false});return"ok"});_j["api/transactions-get"]=async function({accountId:$,startDate:ee,endDate:et}){_z();let{data:en}=await ug(ue("transactions").filter({$and:[$&&{account:$},ee&&{date:{$gte:ee}},et&&{date:{$lte:et}}].filter(Boolean)}).select("*").options({splits:"grouped"}));return en};_j["api/transactions-filter"]=async function({text:$,accountId:ee}){throw new Error("`filterTransactions` is deprecated, use `runQuery` instead")};_j["api/transaction-update"]=_U(async function({id:$,fields:ee}){_z();let{data:et}=await ug(ue("transactions").filter({id:$}).select("*").options({splits:"grouped"}));let en=iK(et);if(en.length===0){return[]}let{diff:ei}=i1(en,ee);return _j["transactions-batch-update"](ei)});_j["api/transaction-delete"]=_U(async function({id:$}){_z();let{data:ee}=await ug(ue("transactions").filter({id:$}).select("*").options({splits:"grouped"}));let et=iK(ee);if(et.length===0){return[]}let{diff:en}=i2(et,$);return _j["transactions-batch-update"](en)});_j["api/accounts-get"]=async function(){_z();let $=await dM();return $.map($=>_M.toExternal($))};_j["api/account-create"]=_U(async function({account:$,initialBalance:ee=null}){_z();return _j["account-create"]({name:$.name,offBudget:$.offbudget,closed:$.closed,balance:ee!=null?iU(ee):null})});_j["api/account-update"]=_U(async function({id:$,fields:ee}){_z();return dx({id:$,..._M.fromExternal(ee)})});_j["api/account-close"]=_U(async function({id:$,transferAccountId:ee,transferCategoryId:et}){_z();return _j["account-close"]({id:$,transferAccountId:ee,categoryId:et})});_j["api/account-reopen"]=_U(async function({id:$}){_z();return _j["account-reopen"]({id:$})});_j["api/account-delete"]=_U(async function({id:$}){_z();return _j["account-close"]({id:$,forced:true})});_j["api/categories-get"]=async function({grouped:$}={}){_z();let ee=await _j["get-categories"]();return $?ee.grouped.map(_x.toExternal):ee.list.map(_L.toExternal)};_j["api/category-group-create"]=_U(async function({group:$}){_z();return _j["category-group-create"]({name:$.name})});_j["api/category-group-update"]=_U(async function({id:$,fields:ee}){_z();return _j["category-group-update"]({id:$,..._x.fromExternal(ee)})});_j["api/category-group-delete"]=_U(async function({id:$,transferCategoryId:ee}){_z();return _j["category-group-delete"]({id:$,transferId:ee})});_j["api/category-create"]=_U(async function({category:$}){_z();return _j["category-create"]({name:$.name,groupId:$.group_id,isIncome:$.is_income})});_j["api/category-update"]=_U(async function({id:$,fields:ee}){_z();return _j["category-update"]({id:$,..._L.fromExternal(ee)})});_j["api/category-delete"]=_U(async function({id:$,transferCategoryId:ee}){_z();return _j["category-delete"]({id:$,transferId:ee})});_j["api/payees-get"]=async function(){_z();let $=await _j["payees-get"]();return $.map(_P.toExternal)};_j["api/payee-create"]=_U(async function({payee:$}){_z();return _j["payee-create"]({name:$.name})});_j["api/payee-update"]=_U(async function({id:$,fields:ee}){_z();return _j["payees-batch-change"]({updated:[{id:$,..._P.fromExternal(ee)}]})});_j["api/payee-delete"]=_U(async function({id:$}){_z();return _j["payees-batch-change"]({deleted:[{id:$}]})});function _$($){let ee=Object.assign({},$,_j);_j=ee;return ee};const _q="db.latest.sqlite";let _G=null;async function _Y($){const ee=oy($);const et=oc(ee,"backups");let en=[];if(await oB(et)){en=await oF(et);en=en.filter($=>$.match(/\.sqlite$/))}const ei=await Promise.all(en.map(async $=>{const ee=await oG(oc(et,$));return{id:$,date:new Date(ee)}}));ei.sort(($,ee)=>{if($.date<ee.date){return 1}else if($.date>ee.date){return-1}return 0});return ei}async function _K($){const ee=oy($);if(await oB(oc(ee,_q))){return{id:_q,date:null,isLatest:true}}return null}async function _Z($){let ee=await _Y($);let et=await _K($);if(et){ee.unshift(et)}return ee.map($=>({...$,date:$.date?t4($.date,"yyyy-MM-dd h:mm"):null}))}async function _J($){const ee=$.reduce(($,ee)=>{const et=t4(ee.date,"yyyy-MM-dd");$[et]=$[et]||[];$[et].push(ee);return $},{});const et=[];for(let $ of Object.keys(ee)){const en=ee[$];const ei=$===nR();for(let $ of en.slice(ei?3:1)){et.push($.id)}}const en=$.filter($=>!et.includes($.id));return et.concat(en.slice(10).map($=>$.id))}async function _X($){const ee=oy($);if(await oB(oc(ee,_q))){await oV(oc(oy($),_q))}let et=`${e_()}.sqlite`;let en=oc(ee,"backups",et);if(!await oB(oc(ee,"backups"))){await oU(oc(ee,"backups"))}await oW(oc(ee,"db.sqlite"),en);const ei=or(en);await a5(ei,"DELETE FROM messages_crdt");await a5(ei,"DELETE FROM messages_clock");oi(ei);const eo=await _J(await _Y($));for(let $ of eo){await oV(oc(ee,"backups",$))}aX("backups-updated",await _Z($))}async function _Q($,ee){const et=oy($);if(!await oB(oc(et,_q))){await oW(oc(et,"db.sqlite"),oc(et,_q));await oW(oc(et,"metadata.json"),oc(et,"metadata.latest.json"));_1();_0($);await uO($)}if(ee===_q){console.log("Reverting backup");await oW(oc(et,_q),oc(et,"db.sqlite"));await oW(oc(et,"metadata.latest.json"),oc(et,"metadata.json"));await oV(oc(et,_q));await oV(oc(et,"metadata.latest.json"));try{await fe()}catch($){}uI()}else{console.log("Loading backup",ee);await uO($);await uA({groupId:null,lastSyncedTimestamp:null,lastUploaded:null});try{await fe()}catch($){}uI();await oW(oc(et,"backups",ee),oc(et,"db.sqlite"))}}function _0($){if(_G){clearInterval(_G)}_G=setInterval(async()=>{console.log("Making backup");await _X($)},1e3*60*15)}function _1(){clearInterval(_G);_G=null}var _2=__webpack_require__(5070);function _6({month:$}){return _4($)}async function _4($){let ee=0;let et=0;let en=0;let ei=[];let eo=[];let es=await _8();let eu=await f4("SELECT * FROM v_categories WHERE tombstone = 0");let el=n0($);for(let ei=0;ei<eu.length;ei++){let ef=eu[ei];let ed=es[ef.id];if(ed){if(ed.filter($=>$.type==="source").length>0){let et=await uX(el,`leftover-${ef.id}`);let en=await uX(el,`budget-${ef.id}`);await u8({category:ef.id,month:$,amount:en-et});ee+=1}if(ed.filter($=>$.type==="sink").length>0){eo.push({cat:ef,temp:ed});et+=1;en+=ed.filter($=>$.type==="sink")[0].weight}}}let ef=parseInt($.replace("-",""));for(let ee=0;ee<eu.length;ee++){let et=eu[ee];let en=await uX(el,`to-budget`);let ei=await uX(el,`leftover-${et.id}`);let eo=await uX(el,`budget-${et.id}`);let es=eo+Math.abs(ei);let ed=et.id;let ep=await f3(`SELECT carryover FROM zero_budgets WHERE month = ? and category = ?`,[ef,ed]);if(ep===null){ep={carryover:0}}if(ei<0&&Math.abs(ei)<=en&&!et.is_income&&ep.carryover===0){await u8({category:et.id,month:$,amount:es})}}let ed=await uX(el,`to-budget`);if(ed<=0){ei.push("No funds are available to reallocate.")}for(let ee=0;ee<eo.length;ee++){let et=await uX(el,`budget-${eo[ee].cat.id}`);let ei=eo[ee].cat.id;let es=eo[ee].temp.filter($=>$.type==="sink")[0].weight;let eu=et+Math.round(es/en*ed);if(ee===eo.length-1){let $=await uX(el,`to-budget`);if(eu>$){eu=et+$}}await u8({category:ei,month:$,amount:eu})}if(ee===0){if(ei.length){return{type:"error",sticky:true,message:`There were errors interpreting some templates:`,pre:ei.join("\n\n")}}else{return{type:"message",message:"All categories were up to date."}}}else{let $=`Successfully returned funds from ${ee} ${ee===1?"source":"sources"} and funded ${et} sinking ${et===1?"fund":"funds"}.`;if(ei.length){return{sticky:true,message:`${$} There were errors interpreting some templates:`,pre:ei.join("\n\n")}}else{return{type:"message",message:$}}}}const _3="#cleanup ";async function _8(){let $={};let ee=await f4(`SELECT * FROM notes WHERE lower(note) like '%${_3}%'`);for(let et=0;et<ee.length;et++){let en=ee[et].note.split("\n");let ei=[];for(let $=0;$<en.length;$++){let ee=en[$].trim();if(!ee.toLowerCase().startsWith(_3))continue;let et=ee.slice(_3.length);try{let $=(0,_2.parse)(et);ei.push($)}catch($){ei.push({type:"error",line:ee,error:$})}}if(ei.length){$[ee[et].id]=ei}}return $};function _5($){eE(1,arguments);var ee=eS($);ee.setHours(0,0,0,0);return ee};function _9($){eE(1,arguments);var ee=eS($);var et=ee.getDay();return et===0||et===6};function _7($){eE(1,arguments);var ee=eS($);var et=ee.getDay();return et};function ve($,ee){eE(2,arguments);var et=ee-_7($);if(et<=0)et+=7;return r9($,et)};function vt($){eE(1,arguments);return ve($,1)};function vr($,ee){eE(2,arguments);var et=_7($)-ee;if(et<=0)et+=7;return nt($,et)};function vn($){eE(1,arguments);return vr($,5)}var vo=__webpack_require__(251);var vs=__webpack_require__.n(vo);var vu=864e5;function vl($,ee){eE(2,arguments);var et=_5($);var en=_5(ee);var ei=et.getTime()-e8(et);var eo=en.getTime()-e8(en);return Math.round((ei-eo)/vu)};function vc($,ee){var et=$.getFullYear()-ee.getFullYear()||$.getMonth()-ee.getMonth()||$.getDate()-ee.getDate()||$.getHours()-ee.getHours()||$.getMinutes()-ee.getMinutes()||$.getSeconds()-ee.getSeconds()||$.getMilliseconds()-ee.getMilliseconds();if(et<0){return-1}else if(et>0){return 1}else{return et}}function vf($,ee){eE(2,arguments);var et=eS($);var en=eS(ee);var ei=vc(et,en);var eo=Math.abs(vl(et,en));et.setDate(et.getDate()-ei*eo);var es=Number(vc(et,en)===-ei);var eu=ei*(eo-es);return eu===0?0:eu};function vd($,ee){eE(2,arguments);var et=eI(ee);return r7($,-et)};function vp($){eE(1,arguments);var ee=eS($);var et=ee.getDate();return et};function vh($,ee){eE(2,arguments);var et=eI(ee);return r8($,et*12)};function vy($,ee){eE(2,arguments);var et=eI(ee);return vh($,-et)};function vg($){let ee=new yv({rrules:p_($)});return ee.occurrences({take:3}).toArray().map($=>$.date)}async function vm($,ee){let{data:et}=await ug(ue("transactions").filter({account:ee,schedule:null,"payee.transfer_acct":null,$and:[{date:{$gte:nt($,2)}},{date:{$lte:r9($,2)}}]}).select("*").options({splits:"none"}));return et}function v_($,ee){let et=Math.abs(vf(nT($),nT(ee)));return 1/(et+1)}function vv($,ee,et=.5){$=[...$].reverse();let en=$[0];let ei=$.slice(1);let eo=[];for(let et of en.transactions){let es=po(et.amount);let eu=et.payee;let el=ei.map($=>{let ee=$.transactions.find($=>$.amount>=et.amount-es&&$.amount<=et.amount+es);ee=ee&&ee.payee===eu?ee:null;if(ee){return{trans:ee,rank:v_($.date,ee.date)}}return null});if(el.indexOf(null)!==-1){continue}let ef=el.reduce(($,ee)=>$+ee.rank,v_(en.date,et.date));let ed=el.reduce(($,ee)=>$&&ee.trans.amount===et.amount,true);eo.push({rank:ef,amount:et.amount,account:et.account,payee:et.payee,date:ee,exactDate:ef===$.length,exactAmount:ed})}return eo}async function vw($,ee,et,en,ei){let eo=[];for(let es=0;es<ee;es++){let ee=r9($,es);let eu;if(typeof et==="function"){eu=et(ee);if(eu===false){continue}}else{eu={...et,start:ee}}eu.start=nI(eu.start);let el=[];let ef=vg(eu);for(let $ of ef){el.push({date:nI($),transactions:await vm($,en)})}eo=eo.concat(vv(el,eu,ei))}return eo}async function vE($,ee){return vw(vd(nT($),4),7*2,{frequency:"weekly"},ee)}async function vS($,ee){return vw(vd(nT($),7),7*2,{frequency:"weekly",interval:2},ee)}async function vT($,ee){return vw(r5(nT($),4),31*2,$=>{if(vp($)>28){return false}return{start:$,frequency:"monthly"}},ee)}async function vO($,ee){let et=await vw(r5(nT($),3),1,{frequency:"monthly",patterns:[{type:"day",value:-1}]},ee,.75);let en=await vw(r5(nT($),4),1,{frequency:"monthly",patterns:[{type:"day",value:-1}]},ee,.75);return et.concat(en)}async function vA($,ee){return vw(vd(nT($),8),14,$=>{let ee=t4(new Date,"iiii");let et=ee.slice(0,2).toUpperCase();return{start:$,frequency:"monthly",patterns:[{type:et,value:1},{type:et,value:3}]}},ee)}async function vI($,ee){return vw(r5(nT($),8),14,$=>{let ee=t4(new Date,"iiii");let et=ee.slice(0,2).toUpperCase();return{start:$,frequency:"monthly",patterns:[{type:et,value:2},{type:et,value:4}]}},ee)}async function vN($){let ee=$._conditions;let et=ee.find($=>$.field==="date");let en=et.value;while(1){let $=en;en={...$};switch(en.frequency){case"weekly":en.start=nI(vd(nT(en.start),en.interval||1));break;case"monthly":en.start=nI(r5(nT(en.start),en.interval||1));break;case"yearly":en.start=nI(vy(nT(en.start),en.interval||1));break;default:throw new Error("findStartDate: invalid frequency")}let et=ee.map($=>$.field==="date"?{...$,value:en}:$);let{filters:ei,errors:eo}=ms(et,{recurDateBounds:1});if(eo.length>0){en=null;break}let{data:es}=await ug(ue("transactions").filter({$and:ei}).select("*"));if(es.length===0){en=$;break}}if(en){return{...$,date:en,_conditions:ee.map($=>$.field==="date"?{...$,value:en}:$)}}return $}async function vD(){let{data:$}=await ug(ue("accounts").filter({closed:false}).select("*"));let ee=[];for(let et of $){let $=await f3("SELECT * FROM v_transactions WHERE account = ? AND parent_id IS NULL ORDER BY date DESC LIMIT 1",[et.id]);if($){let en=oZ($.date);ee=ee.concat(await vE(en,et.id),await vS(en,et.id),await vT(en,et.id),await vO(en,et.id),await vA(en,et.id),await vI(en,et.id))}}let et=[...ip(ee,"payee").entries()].map(([$,ee])=>{ee.sort(($,ee)=>ee.rank-$.rank);let et=ee[0];return{id:e_(),account:et.account,payee:et.payee,date:et.date,amount:et.amount,_conditions:[{op:"is",field:"account",value:et.account},{op:"is",field:"payee",value:et.payee},{op:et.exactDate?"is":"isapprox",field:"date",value:et.date},{op:et.exactAmount?"is":"isapprox",field:"amount",value:et.amount}]}});let en=[];for(let $ of et){en.push(await vN($))}return en};function vR($,ee){let et=[];for(let en=0;en<$.length;en++){et.push([$[en],ee[en]])}return et}function vC($,ee){let et=pv($);let en=pv(ee);let ei=vR(Object.values(et),Object.values(en));let eo=$.map($=>{let ee=ei.find(ee=>$===ee[0]);return ee&&ee[1]?ee[1]:$});let es=ei.filter($=>$[0]==null&&$[1]!=null).map($=>$[1]);return eo.concat(es)}function vk($,ee=new Date(nR())){ee=_5(ee);let et=new gT($.op,"date",$.value,null,new Map(Object.entries({date:"date"})));let en=et.getValue();if(en.type==="date"){return en.date}else if(en.type==="recur"){let $=en.schedule.occurrences({start:ee,take:1}).toArray();if($.length>0){let ee=$[0].date;if(en.schedule.data.skipWeekend){ee=vK(ee,en.schedule.data.weekendSolve)}return nI(ee)}}return null}async function vM($){if($==null){throw new Error("Schedule not attached to a rule")}let{data:ee}=await ug(ue("schedules").filter({id:$}).calculate("rule"));return g7().find($=>$.id===ee)}async function vL($){let{data:ee}=await ug(ue("schedules").filter({id:$}).calculate("rule"));if(ee){await dn("rules",ee)}let et=await mt({stage:null,conditionsOp:"and",conditions:[{op:"isapprox",field:"date",value:nR()},{op:"isapprox",field:"amount",value:0}],actions:[{op:"link-schedule",value:$}]});await dl("schedules",{id:$,rule:et});return g7().find($=>$.id===et)}async function vx({id:$,start:ee,conditions:et,reset:en}){if(et==null){let ee=await vM($);if(ee==null){throw new Error("No rule found for schedule")}et=ee.serialize().conditions}let{date:ei}=pv(et);let{data:eo}=await ug(ue("schedules").filter({id:$}).calculate("next_date"));if(ei){let et=vk(ei,ee?ee(eo):new Date);if(et!==eo){let ee=await f3("SELECT id, base_next_date_ts FROM schedules_next_date WHERE schedule_id = ?",[$]);await f7("schedules_next_date",en?{id:ee.id,base_next_date:oK(et),base_next_date_ts:Date.now()}:{id:ee.id,local_next_date:oK(et),local_next_date_ts:ee.base_next_date_ts})}}}async function vP($,ee){let et=await f3("SELECT id from schedules WHERE tombstone = 0 AND name = ?",[$]);if(et==null){return false}if(ee){return et["id"]!==ee}return true}async function vF({schedule:$=null,conditions:ee=[]}={}){let et=$?.id||e_();let{date:en}=pv(ee);if(en==null){throw new Error("A date condition is required to create a schedule")}if(en.value==null){throw new Error("Date is required")}let ei=vk(en);let eo=ei?oK(ei):null;if($){if($.name){if(await vP($.name,et)){throw new Error("Cannot create schedules with the same name")}}else{$.name=null}}let es=await mt({stage:null,conditionsOp:"and",conditions:ee,actions:[{op:"link-schedule",value:et}]});let eu=Date.now();await de("schedules_next_date",{schedule_id:et,local_next_date:eo,local_next_date_ts:eu,base_next_date:eo,base_next_date_ts:eu});await du("schedules",{...$,id:et,rule:es});return et}async function vB({schedule:$,conditions:ee,resetNextDate:et}){if($.rule){throw new Error("You cannot change the rule of a schedule")}let en;if(ee){let{date:et}=pv(ee);if(et&&et.value==null){throw new Error("Date is required")}en=await vM($.id);if(en==null){en=await vL($.id)}}await fD(async()=>{if(ee){let ei=en.serialize().conditions;let eo=vC(ei,ee);await mr({id:en.id,conditions:eo});let es=({type:$,...ee})=>ee;if(et||!vs()(ei.find($=>$.field==="account"),ei.find($=>$.field==="account"))||!vs()(es(ei.find($=>$.field==="date")||{}),es(eo.find($=>$.field==="date")||{}))){await vx({id:$.id,conditions:eo,reset:true})}}else if(et){await vx({id:$.id,reset:true})}await dl("schedules",$)})}async function vU({id:$}){let{data:ee}=await ug(ue("schedules").filter({id:$}).calculate("rule"));await fD(async()=>{await dn("rules",ee);await dn("schedules",$)})}async function vj({id:$}){return vx({id:$,start:$=>{return r9(nT($),1)}})}function vW(){return vD()}async function vH({config:$,count:ee}){let et=p_($);try{let en=new yv({rrules:et});return en.occurrences({start:_5(new Date),take:ee}).toArray().map(ee=>$.skipWeekend?vK(ee.date,$.weekendSolveMode):ee.date).map($=>nI($))}catch(ee){aR($);throw ee}}function vz($){let{actions:ee,conditions:et}=$ instanceof gI?$.serialize():g8.toJS($);if(ee&&ee.find($=>$.op==="link-schedule")){let $=ee.find($=>$.op==="link-schedule").value;if($){let ee=pv(et);let en=et.findIndex($=>$===ee.payee);let ei=et.findIndex($=>$===ee.account);let eo=et.findIndex($=>$===ee.amount);let es=et.findIndex($=>$===ee.date);fJ("INSERT OR REPLACE INTO schedules_json_paths (schedule_id, payee, account, amount, date) VALUES (?, ?, ?, ?, ?)",[$,en===-1?null:`$[${en}]`,ei===-1?null:`$[${ei}]`,eo===-1?null:`$[${eo}]`,es===-1?null:`$[${es}]`])}}}function vV(){f2(()=>{g7().forEach($=>{vz($)})});return fw(v$)}function v$($,ee){ee.forEach(($,ee)=>{if(ee==="rules"){$.forEach($=>{vz($)})}})}async function vq({id:$}){let{data:ee}=await ug(ue("schedules").filter({id:$}).select("*"));let et=ee[0];if(et==null||et._account==null){return}let en={payee:et._payee,account:et._account,amount:pE(et._amount),date:et.next_date,schedule:et.id,cleared:false};if(en.account){await mx(en.account,[en])}}async function vG($){let{data:ee}=await ug(ue("schedules").filter({completed:false,"_account.closed":false}).select("*"));let{data:et}=await ug(ph(ee));let en=new Set(et.filter(Boolean).map($=>$.schedule));let ei=[];let eo=false;for(let et of ee){let ee=pp(et.next_date,et.completed,en.has(et.id));if(ee==="paid"){if(et._date){if(et._date.frequency){try{await vx({id:et.id})}catch($){}}else{if(et._date<nR()){await vB({schedule:{id:et.id,completed:true}})}}}}else if((ee==="due"||ee==="missed")&&et.posts_transaction&&et._account){if($){await vq({id:et.id});eo=true}else{ei.push(et._payee)}}}if(ei.length>0){aX("schedules-offline",{payees:ei})}else if(eo){aX("sync-event",{type:"success",tables:["transactions"],syncDisabled:"false"})}}let vY=l0();vY.method("schedule/create",aB(cy(vF)));vY.method("schedule/update",aB(cy(vB)));vY.method("schedule/delete",aB(cy(vU)));vY.method("schedule/skip-next-date",aB(cy(vj)));vY.method("schedule/post-transaction",aB(cy(vq)));vY.method("schedule/force-run-service",aB(()=>vG(true)));vY.method("schedule/discover",vW);vY.method("schedule/get-upcoming-dates",vH);vY.service(vV);vY.events.on("sync",({type:$,subtype:ee})=>{let et=$==="success"||$==="error"||$==="unauthorized";if(et&&uN()){let{lastScheduleRun:ee}=uN();if(ee!==nR()){aq(()=>vG($==="success"));uA({lastScheduleRun:nR()})}}});function vK($,ee){if(_9($)){if(ee==="after"){return vt($)}else if(ee==="before"){return vn($)}else{throw new Error("Unknown weekend solve mode, this should not happen!")}}return $}const vZ=vY;var vJ=__webpack_require__(4939);async function vX({month:$}){let ee=await be(null);return v9($,false,ee)}async function vQ({month:$}){let ee=await be(null);return v9($,true,ee)}async function v0({month:$,category:ee}){let et=await f4(`SELECT * FROM v_categories WHERE id = ?`,[ee]);let en=await be(et[0]);await u8({category:ee,month:$,amount:0});return v9($,false,en)}function v2(){return br()}function v6($){let ee=$[0].priority;let et=false;for(let en=1;en<$.length;en++){if($[en].priority!==ee){ee=Math.min(ee,$[en].priority);et=true}}return{lowPriority:ee,errorNotice:et}}async function v8({month:$,templateBudget:ee}){await fD(async()=>{ee.forEach(ee=>{u8({category:ee.category,month:$,amount:ee.amount})})})}async function v9($,ee,et){let en=0;let ei=[];let eo=[];let es=[];let eu=[];let el=await f4("SELECT * FROM v_categories WHERE tombstone = 0 AND hidden = 0");for(let ee=0;ee<el.length;ee++){let en=el[ee];let ei=await uX(n0($),`budget-${en.id}`);let ef=et[en.id];if(ef){for(let $=0;$<ef.length;$++){if(ef[$].priority==null){continue}eu.push(ef[$].priority)}}if(ei){eo.push({category:en.id,amount:ei,isIncome:en.is_income,isTemplate:ef?true:false});es.push({category:en.id,amount:0,isIncome:en.is_income,isTemplate:ef?true:false})}}await v8({month:$,templateBudget:es.filter($=>$.isTemplate===true)});eu=eu.sort().filter(($,ee,et)=>et.indexOf($)===ee);let ef;let ed=0;let ep=eu[eu.length-1]+1;for(let $=0;$<el.length;$++){let ee=el[$];let en=et[ee.id];if(en){for(let $=0;$<en.length;$++){if(en[$].type==="remainder"){en[$].priority=ep;ed+=en[$].weight;ef=true}}}}if(ef)eu.push(ep);let eh=n0($);let ey=await uX(eh,`to-budget`);let eg=u1()?await uX(eh,`total-saved`):await uX(eh,`to-budget`);for(let eo=0;eo<eu.length;eo++){let es=eu[eo];let em=[];let e_=1;if(es===ep&&ef){let $=await uX(eh,`to-budget`);e_=$/ed}for(let eo=0;eo<el.length;eo++){let eu=el[eo];let ef=et[eu.id];if(ef){let et=false;let eo=false;let el=0;if(ef.filter($=>($.type==="schedule"||$.type==="by")&&$.priority===es).length>0){ef=ef.filter($=>$.priority===es&&($.type!=="schedule"||$.type!=="by")||$.type==="schedule"||$.type==="by");let{lowPriority:$,errorNotice:ee}=await v6(ef);el=$;et=el!==es?true:false;eo=true;if(!et&&ee){ei.push(eu.name+": Schedules and By templates should all have the same priority. Using priority "+el)}}if(!et){if(!eo){ef=ef.filter($=>$.priority===es)}if(ef.length>0){ei=ei.concat(ef.filter($=>$.type==="error").map(({line:$,error:ee})=>[eu.name+": "+ee.message,$," ".repeat(v7.length+ee.location.start.offset)+"^"].join("\n")));let et=await uX(eh,`budget-${eu.id}`);let{amount:eo,errors:el}=await bt(eu,ef,$,es,e_,ey,eg,et,ee);if(eo!=null){en++;if(eo>eg&&es>0){eo=eg}em.push({category:eu.id,amount:eo+et});eg-=eo}if(el!=null){ei=ei.concat(el.map($=>`${eu.name}: ${$}`))}}}}}await v8({month:$,templateBudget:em})}if(!ee){eo=eo.filter($=>$.isIncome===0&&$.isTemplate);for(let ee=0;ee<eo.length;ee++){await u8({category:eo[ee].category,month:$,amount:eo[ee].amount});let et=ei.length;for(let $=0;$<et;$++){if(ei[$].includes(el.filter($=>$.id===eo[ee].category)[0].name)){ei.splice($,1);et--}}}}if(en===0){if(ei.length){return{type:"error",sticky:true,message:`There were errors interpreting some templates:`,pre:ei.join("\n\n")}}else{return{type:"message",message:"All categories were up to date."}}}else{let $=`Successfully applied ${en} templates.`;if(ei.length){return{sticky:true,message:`${$} There were errors interpreting some templates:`,pre:ei.join("\n\n")}}else{return{type:"message",message:$}}}}const v7="#template";async function be($){let ee={};let et=await f4(`SELECT * FROM notes WHERE lower(note) like '%${v7}%'`);if($)et=et.filter(ee=>ee.id===$.id);for(let $=0;$<et.length;$++){let en=et[$].note.split("\n");let ei=[];for(let $=0;$<en.length;$++){let ee=en[$].trim();if(!ee.toLowerCase().startsWith(v7))continue;let et=ee.slice(v7.length);try{let $=(0,vJ.parse)(et);ei.push($)}catch($){ei.push({type:"error",line:ee,error:$})}}if(ei.length){ee[et[$].id]=ei}}return ee}async function bt($,ee,et,en,ei,eo,es,eu,el){let ef=`${et}-01`;let ed=[];let ep=await f4("SELECT name from schedules WHERE name NOT NULL AND tombstone = 0");ep=ep.map($=>$.name);let eh=false;ee=ee.filter($=>{switch($.type){case"by":case"spend":let ee=`${$.month}-01`;let et=nx(ee,ef);let en=$.annual?($.repeat||1)*12:$.repeat;let ei;if($.type==="spend"){ei=`${$.from}-01`}while(et<0&&en){ee=nM(ee,en);if(ei){ei=nM(ei,en)}et=nx(ee,ef)}if(et<0){ed.push(`${$.month} is in the past.`);return false}$.month=n2(ee,"yyyy-MM");if(ei){$.from=n2(ei,"yyyy-MM")}break;case"schedule":if(!ep.includes($.name)){ed.push(`Schedule ${$.name} does not exist`);return null}break;default:}return true});if(ee.length>1){ee=ee.sort(($,ee)=>{if($.type==="by"&&!$.annual){return nx(`${$.month}-01`,`${ee.month}-01`)}else if($.type==="schedule"||ee.type==="schedule"){return $.priority-ee.priority}else{return $.type.localeCompare(ee.type)}})}let ey=n0(et);let eg=await uX(ey,`sum-amount-${$.id}`);let em=await uX(ey,`leftover-${$.id}`);let e_=0;let ew;let eE;let eS=em-eg-eu;let eT=0;for(let eu=0;eu<ee.length;eu++){let el=ee[eu];switch(el.type){case"simple":{if(el.limit!=null){if(ew!=null){ed.push(`More than one “up to” limit found.`);return{errors:ed}}else{ew=iF(el.limit.amount);eE=el.limit.hold}}let $=0;if(el.monthly!=null){let ee=iF(el.monthly);$=ee}else{$=ew}if(e_+$<es||!en){e_+=$}else{if(es>0)e_+=es;ed.push(`Insufficient funds.`)}break}case"by":{if(!u1()){let $=0;let et=`${ee[eu].month}-01`;let ei=nx(et,ef);let eo=el.type==="by"?el.repeat:(el.repeat||1)*12;while(ei<0&&eo){et=nM(et,eo);ei=nx(ee[eu].month,ef)}if(eu===0)eT=eS;eT=iF(ee[eu].amount)-eT;if(eT>=0){$=eT;eT=0}else{$=0;eT=Math.abs(eT)}let ep=ei>=0?Math.round($/(ei+1)):0;if(ep>=0){if(e_+ep<es||!en){e_+=ep}else{if(es>0)e_+=es;ed.push(`Insufficient funds.`)}}}else{ed.push(`by templates are not supported in Report budgets`)}break}case"week":{let $=iF(el.amount);let ee=el.weeks!=null?Math.round(el.weeks):1;if(el.limit!=null){if(ew!=null){ed.push(`More than one “up to” limit found.`);return{errors:ed}}else{ew=iF(el.limit.amount);eE=el.limit.hold}}let et=el.starting;let ei=nM(ef,1);while(et<ei){if(et>=ef){if(e_+$<es||!en){e_+=$}else{if(es>0)e_+=es;ed.push(`Insufficient funds.`)}}et=nL(et,ee)}break}case"spend":{let ee=`${el.from}-01`;let et=`${el.month}-01`;let ei=eS;let eo=true;for(let et=ee;nx(ef,et)>0;et=nM(et,1)){let ee=n0(n2(et,"yyyy-MM"));if(eo){let et=await uX(ee,`sum-amount-${$.id}`);let en=await uX(ee,`leftover-${$.id}`);ei=en-et;eo=false}else{let et=await uX(ee,`budget-${$.id}`);ei+=et}}let eu=nx(et,nS(ef));let ep=iF(el.amount);let eh=0;if(eu<0){ed.push(`${el.month} is in the past.`);return{errors:ed}}else if(eu===0){eh=ep-ei}else{eh=Math.round((ep-ei)/(eu+1))}if(eh<es||!en){e_=eh}else{if(es>0)e_=es;ed.push(`Insufficient funds.`)}break}case"percentage":{let $=el.percent;let ee=0;if(el.category.toLowerCase()==="all income"){if(el.previous){let $=n0(nM(et,-1));ee=await uX($,"total-income")}else{ee=await uX(ey,`total-income`)}}else if(el.category.toLowerCase()==="available funds"){ee=eo}else{let $=(await df()).find($=>$.is_income&&$.name.toLowerCase()===el.category.toLowerCase());if(!$){ed.push(`Could not find category “${el.category}”`);return{errors:ed}}if(el.previous){let en=n0(nM(et,-1));ee=await uX(en,`sum-amount-${$.id}`)}else{ee=await uX(ey,`sum-amount-${$.id}`)}}let ei=Math.max(0,Math.round(ee*($/100)));if(ei+e_<=es||!en){e_+=ei}else{if(es>0)e_=es;ed.push(`Insufficient funds.`)}break}case"schedule":{if(!eh){eh=true;let $=ee.filter($=>$.type==="schedule");let et=[];let ei=0;for(let ee=0;ee<$.length;ee++){let{id:en,completed:eo}=await f3("SELECT * FROM schedules WHERE name = ?",[$[ee].name]);console.log(eo);let es=await vM(en);let eu=es.serialize().conditions;let{date:el,amount:ep}=pv(eu);let eh=ep.op==="isbetween"?-Math.round(ep.value.num1+ep.value.num2)/2:-ep.value;let ey=vk(el,nS(ef));let eg=el.value.interval?el.value.interval:1;let em=el.value.frequency;let e_=Object(el.value)===el.value&&"frequency"in el.value;let ew=nx(ey,ef);et.push({template:$[ee],target:eh,next_date_string:ey,target_interval:eg,target_frequency:em,num_months:ew,completed:eo});if(!eo){if(e_){let $=0;let en=nM(ef,et[ee].num_months+1);let eo=vk(el,nS(ef));while(eo<en){$+=-eh;eo=nF(eo,1);eo=vk(el,nS(eo))}et[ee].target=-$;ei+=eh}}else{ed.push(`Schedule ${et[ee].template.name} is a completed schedule.`)}}et=et.filter($=>$.completed===0);et=et.sort(($,ee)=>ee.target-$.target);let eo=0;if(em>=ei){for(let $=0;$<et.length;$++){if(et[$].num_months<0){ed.push(`Non-repeating schedule ${et[$].template.name} was due on ${et[$].next_date_string}, which is in the past.`);break}if(et[$].template.full&&et[$].num_months===0||et[$].target_frequency==="weekly"||et[$].target_frequency==="daily"){eo+=et[$].target}else if(et[$].template.full&&et[$].num_months>0){eo+=0}else{eo+=et[$].target/et[$].target_interval}}}else if(em<ei){for(let $=0;$<et.length;$++){if(u1()){if(!et[$].template.full){ed.push(`Report budgets require the full option for Schedules.`);break}if(et[$].template.full&&et[$].num_months===0){e_+=et[$].target}}if(!u1()){if(et[$].num_months<0){ed.push(`Non-repeating schedule ${et[$].template.name} was due on ${et[$].next_date_string}, which is in the past.`);break}if(et[$].template.full&&et[$].num_months>0){eT=0}else if($===0&&!et[$].template.full){eT=et[$].target-eS}else{eT=et[$].target-eT}let ee=0;if(eT>=0){ee=eT;eT=0}else{ee=0;eT=Math.abs(eT)}if(et[$].template.full||et[$].num_months===0||et[$].target_frequency==="weekly"||et[$].target_frequency==="daily"){eo+=ee}else if(et[$].template.full&&et[$].num_months>0){eo+=0}else{eo+=ee/(et[$].num_months+1)}}}}eo=Math.round(eo);if(eo>0&&e_+eo<=es||!en){e_+=eo}else if(e_+eo>es&&es>=0){e_=es;ed.push(`Insufficient funds.`)}}break}case"remainder":{if(ei>=0){e_+=ei===0?Math.round(el.weight):Math.round(ei*el.weight);if(e_>=es){e_=es}else if(es-e_===1){e_=e_+1}}break}case"error":return{errors:ed};default:}}if(ew!=null){if(eE&&em>ew){e_=0}else if(e_+em>ew){e_=ew-em}}if(($.budgeted!=null&&$.budgeted!==0||e_===0)&&!el){return{errors:ed}}else if($.budgeted===e_){return null}else{let et=$.name+": "+iU(eS);et+=" + "+iU(e_)+" = "+iU(eS+e_);et+=" "+ee.map($=>$.line).join("\n");console.log(et);return{amount:e_,errors:ed}}}async function br(){let $=await be(null);let ee=[];let et=await f4("SELECT * FROM v_categories WHERE tombstone = 0");for(let en=0;en<et.length;en++){let ei=et[en];let eo=$[ei.id];if(eo){for(let $=0;$<eo.length;$++){if(eo[$].type==="error"){ee.push(ei.name+": "+eo[$].line)}}}}if(ee.length){return{sticky:true,message:`There were errors interpreting some templates:`,pre:ee.join("\n\n")}}else{return{type:"message",message:"All templates passed! 🎉"}}};let bn=l0();bn.method("budget/budget-amount",aB(cy(u8)));bn.method("budget/copy-previous-month",aB(cy(u7)));bn.method("budget/copy-single-month",aB(cy(le)));bn.method("budget/set-zero",aB(cy(lt)));bn.method("budget/set-3month-avg",aB(cy(lr)));bn.method("budget/set-n-month-avg",aB(cy(ln)));bn.method("budget/check-templates",aB(cy(v2)));bn.method("budget/apply-goal-template",aB(cy(vX)));bn.method("budget/overwrite-goal-template",aB(cy(vQ)));bn.method("budget/apply-single-template",aB(cy(v0)));bn.method("budget/cleanup-goal-template",aB(cy(_6)));bn.method("budget/hold-for-next-month",aB(cy(li)));bn.method("budget/reset-hold",aB(cy(ls)));bn.method("budget/cover-overspending",aB(cy(lu)));bn.method("budget/transfer-available",aB(cy(lf)));bn.method("budget/transfer-category",aB(cy(ld)));bn.method("budget/set-carryover",aB(cy(lp)));const bi=bn;const bo={validate($,{update:ee}={}){oY("transaction_filters",$,["conditions"],ee);if(!ee||"conditionsOp"in $){if(!["and","or"].includes($.conditionsOp)){throw new Error("Invalid filter conditionsOp: "+$.conditionsOp)}}return $},toJS($){let{conditions:ee,conditions_op:et,...en}=$;return{...en,conditionsOp:et,conditions:g4(ee)}},fromJS($){let{conditionsOp:ee,...et}=$;if(ee){et.conditions_op=ee}return et}};async function bs($,ee,et){let en=await f3("SELECT id from transaction_filters WHERE tombstone = 0 AND name = ?",[$]);if(en===null){return false}if(!et){return en.id!==ee}return true}function bu($,ee,et){let{conditions:en,conditionsOp:ei}=$;let eo=[];let es=false;let eu;ee.map($=>{if(!es&&(en.length===1?true:$.conditionsOp===ei)&&!$.tombstone&&$.conditions.length===en.length){es=false;en.map((ee,et)=>{eo[et]=$.conditions.filter($=>{return ee.value===$.value&&ee.op===$.op&&ee.field===$.field}).length>0;es=(et===0?true:es)&&eo[et];return true});eu=es&&eo[en.length-1]&&$}return true});eo=[];if(!et){return eu?eu.id!==$.id?eu.name:false:false}return eu?eu.name:false}async function bl($){let ee=e_();let et={id:ee,conditions:$.state.conditions,conditionsOp:$.state.conditionsOp,name:$.state.name};if(et.name){if(await bs(et.name,et.id,true)){throw new Error("There is already a filter named "+et.name)}}else{throw new Error("Filter name is required")}if(et.conditions.length>0){let ee=bu(et,$.filters,true);if(ee){throw new Error("Duplicate filter warning: conditions already exist. Filter name: "+ee)}}else{throw new Error("Conditions are required")}await du("transaction_filters",bo.fromJS(et));return ee}async function bf($){let ee={id:$.state.id,conditions:$.state.conditions,conditionsOp:$.state.conditionsOp,name:$.state.name};if(ee.name){if(await bs(ee.name,ee.id,false)){throw new Error("There is already a filter named "+ee.name)}}else{throw new Error("Filter name is required")}if(ee.conditions.length>0){let et=bu(ee,$.filters,false);if(et){throw new Error("Duplicate filter warning: conditions already exist. Filter name: "+et)}}else{throw new Error("Conditions are required")}await dl("transaction_filters",bo.fromJS(ee))}async function bd($){await dn("transaction_filters",$)}let bp=l0();bp.method("filter-create",aB(bl));bp.method("filter-update",aB(bf));bp.method("filter-delete",aB(cy(bd)));const bh=bp;async function by($,ee){await Ei["close-budget"]();let et;try{({id:et}=await c7({cloudFileId:null,groupId:null},ee))}catch($){if($.type==="FileDownloadError"){return{error:$.reason}}throw $}let en=await or(oc(oy(et),"db.sqlite"));a9(en,`
|
|
200
200
|
DELETE FROM kvcache;
|
|
201
201
|
DELETE FROM kvcache_key;
|
|
202
|
-
`);ot(en);await Er["load-budget"]({id:et});await Er["get-budget-bounds"]();await uK();await c9().catch($=>{})};function bh($,ee,et,en,ei,eo,es){try{var eu=$[eo](es);var el=eu.value}catch($){et($);return}if(eu.done){ee(el)}else{Promise.resolve(el).then(en,ei)}}function by($){return function(){var ee=this,et=arguments;return new Promise(function(en,ei){var eo=$.apply(ee,et);function es($){bh(eo,en,ei,es,eu,"next",$)}function eu($){bh(eo,en,ei,es,eu,"throw",$)}es(undefined)})}}function bg($,ee){var et,en,ei,eo,es={label:0,sent:function(){if(ei[0]&1)throw ei[1];return ei[1]},trys:[],ops:[]};return eo={next:eu(0),"throw":eu(1),"return":eu(2)},typeof Symbol==="function"&&(eo[Symbol.iterator]=function(){return this}),eo;function eu($){return function(ee){return el([$,ee])}}function el(eo){if(et)throw new TypeError("Generator is already executing.");while(es)try{if(et=1,en&&(ei=eo[0]&2?en["return"]:eo[0]?en["throw"]||((ei=en["return"])&&ei.call(en),0):en.next)&&!(ei=ei.call(en,eo[1])).done)return ei;if(en=0,ei)eo=[eo[0]&2,ei.value];switch(eo[0]){case 0:case 1:ei=eo;break;case 4:es.label++;return{value:eo[1],done:false};case 5:es.label++;en=eo[1];eo=[0];continue;case 7:eo=es.ops.pop();es.trys.pop();continue;default:if(!(ei=es.trys,ei=ei.length>0&&ei[ei.length-1])&&(eo[0]===6||eo[0]===2)){es=0;continue}if(eo[0]===3&&(!ei||eo[1]>ei[0]&&eo[1]<ei[3])){es.label=eo[1];break}if(eo[0]===6&&es.label<ei[1]){es.label=ei[1];ei=eo;break}if(ei&&es.label<ei[2]){es.label=ei[2];es.ops.push(eo);break}if(ei[2])es.ops.pop();es.trys.pop();continue}eo=ee.call($,es)}catch($){eo=[6,$];en=0}finally{et=ei=0}if(eo[0]&5)throw eo[1];return{value:eo[0]?eo[1]:void 0,done:true}}}function bm($,ee){return en($,ee)}function b_($,ee){return bv.apply(this,arguments)}function bv(){bv=by(function($,ee){var et;return bg(this,function(en){switch(en.label){case 0:return[4,bm("api/start-import",{budgetName:$})];case 1:en.sent();en.label=2;case 2:en.trys.push([2,4,,6]);return[4,ee()];case 3:en.sent();return[3,6];case 4:et=en.sent();return[4,bm("api/abort-import")];case 5:en.sent();throw et;case 6:return[4,bm("api/finish-import")];case 7:en.sent();return[2]}})});return bv.apply(this,arguments)}function bw($){return bE.apply(this,arguments)}function bE(){bE=by(function($){return bg(this,function(ee){return[2,bm("api/load-budget",{id:$})]})});return bE.apply(this,arguments)}function bS($){return bT.apply(this,arguments)}function bT(){bT=by(function($){var ee;var et=arguments;return bg(this,function(en){ee=(et.length>1&&et[1]!==void 0?et[1]:{}).password;return[2,bm("api/download-budget",{syncId:$,password:ee})]})});return bT.apply(this,arguments)}function bO(){return bA.apply(this,arguments)}function bA(){bA=by(function(){return bg(this,function($){return[2,bm("api/sync")]})});return bA.apply(this,arguments)}function bI($){return bN.apply(this,arguments)}function bN(){bN=by(function($){return bg(this,function(ee){switch(ee.label){case 0:return[4,bm("api/batch-budget-start")];case 1:ee.sent();ee.label=2;case 2:ee.trys.push([2,,4,6]);return[4,$()];case 3:ee.sent();return[3,6];case 4:return[4,bm("api/batch-budget-end")];case 5:ee.sent();return[7];case 6:return[2]}})});return bN.apply(this,arguments)}function bD($){return bm("api/query",{query:$.serialize()})}function bR(){return bm("api/budget-months")}function bC($){return bm("api/budget-month",{month:$})}function bM($,ee,et){return bm("api/budget-set-amount",{month:$,categoryId:ee,amount:et})}function bL($,ee,et){return bm("api/budget-set-carryover",{month:$,categoryId:ee,flag:et})}function bx($,ee){return bm("api/transactions-add",{accountId:$,transactions:ee})}function bP($,ee){return bm("api/transactions-import",{accountId:$,transactions:ee})}function bF($,ee,et){return bm("api/transactions-get",{accountId:$,startDate:ee,endDate:et})}function bB($,ee){return bm("api/transactions-filter",{accountId:$,text:ee})}function bU($,ee){return bm("api/transaction-update",{id:$,fields:ee})}function bj($){return bm("api/transaction-delete",{id:$})}function bW(){return bm("api/accounts-get")}function bH($,ee){return bm("api/account-create",{account:$,initialBalance:ee})}function bz($,ee){return bm("api/account-update",{id:$,fields:ee})}function bV($,ee,et){return bm("api/account-close",{id:$,transferAccountId:ee,transferCategoryId:et})}function b$($){return bm("api/account-reopen",{id:$})}function bq($){return bm("api/account-delete",{id:$})}function bG($){return bm("api/category-group-create",{group:$})}function bY($,ee){return bm("api/category-group-update",{id:$,fields:ee})}function bK($,ee){return bm("api/category-group-delete",{id:$,transferCategoryId:ee})}function bZ(){return bm("api/categories-get",{grouped:false})}function bJ($){return bm("api/category-create",{category:$})}function bX($,ee){return bm("api/category-update",{id:$,fields:ee})}function bQ($,ee){return bm("api/category-delete",{id:$,transferCategoryId:ee})}function b0(){return bm("api/payees-get")}function b6($){return bm("api/payee-create",{payee:$})}function b4($,ee){return bm("api/payee-update",{id:$,fields:ee})}function b3($){return bm("api/payee-delete",{id:$})};function b8($){return Math.round($*100)}function b5($){return parseFloat(($/100).toFixed(2))}var b9=__webpack_require__(3859);var b7=__webpack_require__.n(b9);async function we($,ee){const et=iU($.accounts,"sortableIndex");return Promise.all(et.map(async $=>{if(!$.isTombstone){const et=await bH({name:$.accountName,offbudget:$.onBudget?false:true,closed:$.hidden?true:false});ee.set($.entityId,et)}}))}async function wt($,ee){const et=iU($.masterCategories,"sortableIndex");await Promise.all(et.map(async $=>{if($.type==="OUTFLOW"&&!$.isTombstone&&$.subCategories&&$.subCategories.some($=>!$.isTombstone)){const et=await bG({name:$.name,is_income:false});ee.set($.entityId,et);if($.note){en("notes-save",{id:et,note:$.note})}if($.subCategories){const et=iU($.subCategories,"sortableIndex");et.reverse();for(let $ of et){if(!$.isTombstone){const et=await bJ({name:$.name,group_id:ee.get($.masterCategoryId)});ee.set($.entityId,et);if($.note){en("notes-save",{id:et,note:$.note})}}}}}}))}async function wr($,ee){for(let et of $.payees){if(!et.isTombstone){let $=await b6({name:et.name,category:ee.get(et.autoFillCategoryId)||null,transfer_acct:ee.get(et.targetAccountId)||null});ee.set(et.entityId,$)}}}async function wn($,ee){const et=await bZ();const en=et.find($=>$.name==="Income").id;const ei=await bW();const eo=await b0();function es($){if($==null||$==="Category/__Split__"){return null}else if($==="Category/__ImmediateIncome__"||$==="Category/__DeferredIncome__"){return en}return ee.get($)}function eu($){let ee=ei.find(ee=>ee.id===$);if(!ee){throw new Error("Could not find account for transaction when importing")}return ee.offbudget}for(let et of $.transactions){ee.set(et.entityId,e_());if(et.subTransactions){for(let $ of et.subTransactions){ee.set($.entityId,e_())}}}let el=io($.transactions,"accountId");await Promise.all([...el.keys()].map(async et=>{let en=el.get(et);let ei=en.map(en=>{if(en.isTombstone){return null}let ei=ee.get(en.entityId);function el(et){let en=ee.get(et.transferTransactionId)||null;let ei=null;let es=null;if(en){ei=eo.find($=>$.transfer_acct===ee.get(et.targetAccountId)).id}else{ei=ee.get(et.payeeId);es=$.payees.find($=>$.entityId===et.payeeId)?.name}return{transfer_id:en,payee:ei,imported_payee:es}}let ef={id:ei,amount:b8(en.amount),category:eu(ee.get(et))?null:es(en.categoryId),date:en.date,notes:en.memo||null,cleared:en.cleared==="Cleared",...el(en),subtransactions:en.subTransactions&&en.subTransactions.map(($,et)=>{return{id:ee.get($.entityId),amount:b8($.amount),category:es($.categoryId),notes:$.memo||null,...el($)}})};return ef}).filter($=>$);await bx(ee.get(et),ei)}))}function wi($,ee){const et=[...ee];$.masterCategories.forEach($=>{if($.subCategories){$.subCategories.forEach($=>{if(!et.find(ee=>ee.categoryId===$.entityId)){et.push({budgeted:0,categoryId:$.entityId})}})}});return et}async function wo($,ee){let et=iU($.monthlyBudgets,"month");await bI(async()=>{for(let en of et){let et=wi($,en.monthlySubCategoryBudgets.filter($=>!$.isTombstone));await Promise.all(et.map(async $=>{let et=b8($.budgeted);let ei=ee.get($.categoryId);let eo=nA(en.month);if(!ei){return}await bM(eo,ei,et);if($.overspendingHandling==="AffectsBuffer"){await bL(eo,ei,false)}else if($.overspendingHandling==="Confined"){await bL(eo,ei,true)}}))}})}function wu($){return $.split(",").reduce(($,ee)=>{const[et,en]=ee.split("-");return $+parseInt(en)},0)}function wl($,ee){let et=ee.map(ee=>{const et=$.readFile(ee).toString("utf8");let en;try{en=JSON.parse(et)}catch($){return null}if(en.hasFullKnowledge){return{deviceGUID:en.deviceGUID,shortName:en.shortDeviceId,recentness:wu(en.knowledge)}}return null}).filter($=>$);et=iU(et,"recentness");return et[et.length-1].deviceGUID}async function wc($){const ee=new Map;console.log("Importing Accounts...");await we($,ee);console.log("Importing Categories...");await wt($,ee);console.log("Importing Payees...");await wr($,ee);console.log("Importing Transactions...");await wn($,ee);console.log("Importing Budgets...");await wo($,ee);console.log("Setting up...")}function wf($,ee){let et=b7()($);if(!/\.zip/.test(et)){return null}et=et.replace(/\.zip$/,"").replace(/.ynab4$/,"");let en=et.match(/([^/~]+)[^/]*$/);if(!en){return null}return en[1]}function wd($,ee){let et=$.filter($=>$.entryName===ee);if(et.length===0){throw new Error("Could not find file: "+ee)}if(et.length>=2){throw new Error("File name matches multiple files: "+ee)}return et[0]}function wp(...$){return $.slice(1).reduce(($,ee)=>{return $+"/"+ee.replace(/^\//,"")},$[0].replace(/\/$/,""))}function wh($){let ee=new(cJ())($);let et=ee.getEntries();let en="";let ei=et[0].entryName.match(/([^/]*\.ynab4)/);if(ei){en=ei[1]+"/"}let eo=ee.readFile(wd(et,en+"Budget.ymeta"));let es=JSON.parse(eo.toString("utf8"));let eu=wp(en,es.relativeDataFolderName);let el=et.filter($=>$.entryName.startsWith(wp(eu,"devices")));let ef=wl(ee,el);const ed=wp(eu,ef,"Budget.yfull");let ep;try{ep=ee.readFile(wd(et,ed)).toString("utf8")}catch($){console.log($);throw new Error("Error reading Budget.yfull file")}try{return JSON.parse(ep)}catch($){throw new Error("Error parsing Budget.yfull file")}};function wy($){return Math.round($/10)}function wg($,ee){return Promise.all($.accounts.map(async $=>{if(!$.deleted){let et=await bH({name:$.name,offbudget:$.on_budget?false:true,closed:$.closed});ee.set($.id,et)}}))}async function wm($,ee){const et=await bZ();const en=et.find($=>$.name==="Income").id;const ei=["To be Budgeted","Inflow: Ready to Assign"];function eo(ee){if(ee.category_group_id===$.category_groups.find($=>$.name==="Internal Master Category").id){if(ei.includes(ee.name)){return"income"}else{return"internal"}}else if(ee.category_group_id===$.category_groups.find($=>$.name==="Credit Card Payments").id){return"creditCard"}}for(let et of $.category_groups){if(!et.deleted){let ei;if(et.name!=="Internal Master Category"&&et.name!=="Credit Card Payments"){ei=await bG({name:et.name,is_income:false});ee.set(et.id,ei)}let es=$.categories.filter($=>$.category_group_id===et.id);for(let $ of es.reverse()){if(!$.deleted){switch(eo($)){case"income":{let et=en;ee.set($.id,et);break}case"creditCard":case"internal":break;default:{let et=await bJ({name:$.name,group_id:ei});ee.set($.id,et);break}}}}}}}function w_($,ee){return Promise.all($.payees.map(async $=>{if(!$.deleted){let et=await b6({name:$.name});ee.set($.id,et)}}))}async function wv($,ee){const et=await b0();const en=await bZ();const ei=en.find($=>$.name==="Income").id;const eo=en.find($=>$.name==="Starting Balances").id;const es=$.payees.find($=>$.name==="Starting Balance").id;let eu=io($.transactions,"account_id");let el=io($.subtransactions,"transaction_id");for(let et of $.transactions){ee.set(et.id,e_())}for(let et of $.subtransactions){ee.set(et.id,e_())}await Promise.all([...eu.keys()].map(async en=>{let ef=eu.get(en);let ed=ef.map(en=>{if(en.deleted){return null}let eu=el.get(en.id);let ef={id:ee.get(en.id),account:ee.get(en.account_id),date:en.date,amount:wy(en.amount),category:ee.get(en.category_id)||null,cleared:["cleared","reconciled"].includes(en.cleared),notes:en.memo||null,imported_id:en.import_id||null,transfer_id:ee.get(en.transfer_transaction_id)||null,subtransactions:eu?eu.map($=>{return{id:ee.get($.id),amount:wy($.amount),category:ee.get($.category_id)||null,notes:$.memo}}):null,payee:null,imported_payee:null};if(en.transfer_account_id){ef.payee=et.find($=>$.transfer_acct===ee.get(en.transfer_account_id)).id}else{ef.payee=ee.get(en.payee_id);ef.imported_payee=$.payees.find($=>!$.deleted&&$.id===en.payee_id)?.name}if(en.payee_id===es&&ee.get(en.category_id)===ei){ef.category=eo;ef.payee=null}return ef}).filter($=>$);await bx(ee.get(en),ed)}))}async function ww($,ee){let et=iU($.months,"month");const en=$.category_groups.find($=>$.name==="Internal Master Category").id;const ei=$.category_groups.find($=>$.name==="Credit Card Payments").id;await bI(async()=>{for(let $ of et){let et=nA($.month);await Promise.all($.categories.map(async $=>{let eo=ee.get($.id);let es=Math.round($.budgeted/10);if(!eo||$.category_group_id===en||$.category_group_id===ei){return}await bM(et,eo,es)}))}})}async function wE($){const ee=new Map;console.log("Importing Accounts...");await wg($,ee);console.log("Importing Categories...");await wm($,ee);console.log("Importing Payees...");await w_($,ee);console.log("Importing Transactions...");await wv($,ee);console.log("Importing Budgets...");await ww($,ee);console.log("Setting up...")}function wS($){let ee=JSON.parse($.toString());if(ee.data){ee=ee.data}if(ee.budget){ee=ee.budget}return ee}function wT($,ee){return ee.budget_name||ee.name};let wO={ynab4:ee,ynab5:et};async function wA($,ee,et){if($==="actual"){return bp(ee,et)}let en=wO[$];try{let ei;let eo;try{ei=en.parseFile(et);eo=en.getBudgetName(ee,ei)}catch($){console.error("failed to parse file",$)}if(!eo){return{error:"not-"+$}}try{await Er["api/start-import"]({budgetName:eo})}catch($){console.error("failed to start import",$);return{error:"unknown"}}await en.doImport(ei)}catch($){await Er["api/abort-import"]();console.error("failed to run import",$);return{error:"unknown"}}await Er["api/finish-import"]()};let wI=lX();wI.method("notes-save",async({id:$,note:ee})=>{await f5("notes",{id:$,note:ee})});const wN=wI;function wD($){function ee($,ee){const et=$.map($=>{try{ee($)}catch($){if($ instanceof lG){console.warn("Invalid rule",$);return $.type}throw $}return null}).filter($=>typeof $==="string");return et.length?et:null}let et=ee($.conditions,$=>new gE($.op,$.field,$.value,$.options,d6));let en=ee($.actions,$=>$.op==="link-schedule"?new gT($.op,null,$.value,null,d6):new gT($.op,$.field,$.value,$.options,d6));if(et||en){return{conditionErrors:et,actionErrors:en}}return null}let wR=lX();wR.method("rule-validate",async function($){let ee=wD($);return{error:ee}});wR.method("rule-add",aP(async function($){let ee=wD($);if(ee){return{error:ee}}let et=await g9($);return{id:et}}));wR.method("rule-update",aP(async function($){let ee=wD($);if(ee){return{error:ee}}await g7($);return{}}));wR.method("rule-delete",aP(async function($){return mt($)}));wR.method("rule-delete-all",aP(async function($){let ee=false;await fI(async()=>{for(let et of $){let $=await mt({id:et});if($===false){ee=true}}});return{someDeletionsFailed:ee}}));wR.method("rule-apply-actions",aP(cd(async function({transactionIds:$,actions:ee}){return mo($,ee)})));wR.method("rule-add-payee-rename",aP(async function({fromNames:$,to:ee}){return mf($,ee)}));wR.method("rules-get",async function(){return gR(g5()).map($=>$.serialize())});wR.method("rule-get",async function({id:$}){let ee=g5().find(ee=>ee.id===$);return ee?ee.serialize():null});wR.method("rules-run",async function({transaction:$}){return mn($)});const wC=wR;function wk($,ee){ee.forEach(($,ee)=>{if(ee==="transactions"){let ee=[];$.forEach($=>{if($.isChild===1&&$.parent_id==null&&$.id.includes("/")){let et=$.id.split("/")[0];ee.push({dataset:"transactions",row:$.id,column:"parent_id",value:et,timestamp:eo.Timestamp.send()})}});if(ee.length>0){fE(ee)}}})}let wM=null;function wL(){wx();wM=f_(wk)}function wx(){if(wM){wM();wM=null}};let wP=lX();wP.method("tools/fix-split-transactions",async()=>{let $=await f2(`
|
|
202
|
+
`);oi(en);await Ei["load-budget"]({id:et});await Ei["get-budget-bounds"]();await uJ();await fe().catch($=>{})};function bg($,ee,et,en,ei,eo,es){try{var eu=$[eo](es);var el=eu.value}catch($){et($);return}if(eu.done){ee(el)}else{Promise.resolve(el).then(en,ei)}}function bm($){return function(){var ee=this,et=arguments;return new Promise(function(en,ei){var eo=$.apply(ee,et);function es($){bg(eo,en,ei,es,eu,"next",$)}function eu($){bg(eo,en,ei,es,eu,"throw",$)}es(undefined)})}}function b_($,ee){var et,en,ei,eo,es={label:0,sent:function(){if(ei[0]&1)throw ei[1];return ei[1]},trys:[],ops:[]};return eo={next:eu(0),"throw":eu(1),"return":eu(2)},typeof Symbol==="function"&&(eo[Symbol.iterator]=function(){return this}),eo;function eu($){return function(ee){return el([$,ee])}}function el(eo){if(et)throw new TypeError("Generator is already executing.");while(es)try{if(et=1,en&&(ei=eo[0]&2?en["return"]:eo[0]?en["throw"]||((ei=en["return"])&&ei.call(en),0):en.next)&&!(ei=ei.call(en,eo[1])).done)return ei;if(en=0,ei)eo=[eo[0]&2,ei.value];switch(eo[0]){case 0:case 1:ei=eo;break;case 4:es.label++;return{value:eo[1],done:false};case 5:es.label++;en=eo[1];eo=[0];continue;case 7:eo=es.ops.pop();es.trys.pop();continue;default:if(!(ei=es.trys,ei=ei.length>0&&ei[ei.length-1])&&(eo[0]===6||eo[0]===2)){es=0;continue}if(eo[0]===3&&(!ei||eo[1]>ei[0]&&eo[1]<ei[3])){es.label=eo[1];break}if(eo[0]===6&&es.label<ei[1]){es.label=ei[1];ei=eo;break}if(ei&&es.label<ei[2]){es.label=ei[2];es.ops.push(eo);break}if(ei[2])es.ops.pop();es.trys.pop();continue}eo=ee.call($,es)}catch($){eo=[6,$];en=0}finally{et=ei=0}if(eo[0]&5)throw eo[1];return{value:eo[0]?eo[1]:void 0,done:true}}}function bv($,ee){return en($,ee)}function bw($,ee){return bE.apply(this,arguments)}function bE(){bE=bm(function($,ee){var et;return b_(this,function(en){switch(en.label){case 0:return[4,bv("api/start-import",{budgetName:$})];case 1:en.sent();en.label=2;case 2:en.trys.push([2,4,,6]);return[4,ee()];case 3:en.sent();return[3,6];case 4:et=en.sent();return[4,bv("api/abort-import")];case 5:en.sent();throw et;case 6:return[4,bv("api/finish-import")];case 7:en.sent();return[2]}})});return bE.apply(this,arguments)}function bS($){return bT.apply(this,arguments)}function bT(){bT=bm(function($){return b_(this,function(ee){return[2,bv("api/load-budget",{id:$})]})});return bT.apply(this,arguments)}function bO($){return bA.apply(this,arguments)}function bA(){bA=bm(function($){var ee;var et=arguments;return b_(this,function(en){ee=(et.length>1&&et[1]!==void 0?et[1]:{}).password;return[2,bv("api/download-budget",{syncId:$,password:ee})]})});return bA.apply(this,arguments)}function bI(){return bN.apply(this,arguments)}function bN(){bN=bm(function(){return b_(this,function($){return[2,bv("api/sync")]})});return bN.apply(this,arguments)}function bD($){return bR.apply(this,arguments)}function bR(){bR=bm(function($){return b_(this,function(ee){switch(ee.label){case 0:return[4,bv("api/batch-budget-start")];case 1:ee.sent();ee.label=2;case 2:ee.trys.push([2,,4,6]);return[4,$()];case 3:ee.sent();return[3,6];case 4:return[4,bv("api/batch-budget-end")];case 5:ee.sent();return[7];case 6:return[2]}})});return bR.apply(this,arguments)}function bC($){return bv("api/query",{query:$.serialize()})}function bM(){return bv("api/budget-months")}function bL($){return bv("api/budget-month",{month:$})}function bx($,ee,et){return bv("api/budget-set-amount",{month:$,categoryId:ee,amount:et})}function bP($,ee,et){return bv("api/budget-set-carryover",{month:$,categoryId:ee,flag:et})}function bF($,ee){return bv("api/transactions-add",{accountId:$,transactions:ee})}function bB($,ee){return bv("api/transactions-import",{accountId:$,transactions:ee})}function bU($,ee,et){return bv("api/transactions-get",{accountId:$,startDate:ee,endDate:et})}function bj($,ee){return bv("api/transactions-filter",{accountId:$,text:ee})}function bW($,ee){return bv("api/transaction-update",{id:$,fields:ee})}function bH($){return bv("api/transaction-delete",{id:$})}function bz(){return bv("api/accounts-get")}function bV($,ee){return bv("api/account-create",{account:$,initialBalance:ee})}function b$($,ee){return bv("api/account-update",{id:$,fields:ee})}function bq($,ee,et){return bv("api/account-close",{id:$,transferAccountId:ee,transferCategoryId:et})}function bG($){return bv("api/account-reopen",{id:$})}function bY($){return bv("api/account-delete",{id:$})}function bK($){return bv("api/category-group-create",{group:$})}function bZ($,ee){return bv("api/category-group-update",{id:$,fields:ee})}function bJ($,ee){return bv("api/category-group-delete",{id:$,transferCategoryId:ee})}function bX(){return bv("api/categories-get",{grouped:false})}function bQ($){return bv("api/category-create",{category:$})}function b0($,ee){return bv("api/category-update",{id:$,fields:ee})}function b6($,ee){return bv("api/category-delete",{id:$,transferCategoryId:ee})}function b4(){return bv("api/payees-get")}function b3($){return bv("api/payee-create",{payee:$})}function b8($,ee){return bv("api/payee-update",{id:$,fields:ee})}function b5($){return bv("api/payee-delete",{id:$})};function b9($){return Math.round($*100)}function b7($){return parseFloat(($/100).toFixed(2))}var we=__webpack_require__(3859);var wt=__webpack_require__.n(we);async function wr($,ee){const et=iW($.accounts,"sortableIndex");return Promise.all(et.map(async $=>{if(!$.isTombstone){const et=await bV({name:$.accountName,offbudget:$.onBudget?false:true,closed:$.hidden?true:false});ee.set($.entityId,et)}}))}async function wn($,ee){const et=iW($.masterCategories,"sortableIndex");await Promise.all(et.map(async $=>{if($.type==="OUTFLOW"&&!$.isTombstone&&$.subCategories&&$.subCategories.some($=>!$.isTombstone)){const et=await bK({name:$.name,is_income:false});ee.set($.entityId,et);if($.note){en("notes-save",{id:et,note:$.note})}if($.subCategories){const et=iW($.subCategories,"sortableIndex");et.reverse();for(let $ of et){if(!$.isTombstone){const et=await bQ({name:$.name,group_id:ee.get($.masterCategoryId)});ee.set($.entityId,et);if($.note){en("notes-save",{id:et,note:$.note})}}}}}}))}async function wi($,ee){for(let et of $.payees){if(!et.isTombstone){let $=await b3({name:et.name,category:ee.get(et.autoFillCategoryId)||null,transfer_acct:ee.get(et.targetAccountId)||null});ee.set(et.entityId,$)}}}async function wo($,ee){const et=await bX();const en=et.find($=>$.name==="Income").id;const ei=await bz();const eo=await b4();function es($){if($==null||$==="Category/__Split__"){return null}else if($==="Category/__ImmediateIncome__"||$==="Category/__DeferredIncome__"){return en}return ee.get($)}function eu($){let ee=ei.find(ee=>ee.id===$);if(!ee){throw new Error("Could not find account for transaction when importing")}return ee.offbudget}for(let et of $.transactions){ee.set(et.entityId,e_());if(et.subTransactions){for(let $ of et.subTransactions){ee.set($.entityId,e_())}}}let el=ip($.transactions,"accountId");await Promise.all([...el.keys()].map(async et=>{let en=el.get(et);let ei=en.map(en=>{if(en.isTombstone){return null}let ei=ee.get(en.entityId);function el(et){let en=ee.get(et.transferTransactionId)||null;let ei=null;let es=null;if(en){ei=eo.find($=>$.transfer_acct===ee.get(et.targetAccountId)).id}else{ei=ee.get(et.payeeId);es=$.payees.find($=>$.entityId===et.payeeId)?.name}return{transfer_id:en,payee:ei,imported_payee:es}}let ef={id:ei,amount:b9(en.amount),category:eu(ee.get(et))?null:es(en.categoryId),date:en.date,notes:en.memo||null,cleared:en.cleared==="Cleared",...el(en),subtransactions:en.subTransactions&&en.subTransactions.map(($,et)=>{return{id:ee.get($.entityId),amount:b9($.amount),category:es($.categoryId),notes:$.memo||null,...el($)}})};return ef}).filter($=>$);await bF(ee.get(et),ei)}))}function wu($,ee){const et=[...ee];$.masterCategories.forEach($=>{if($.subCategories){$.subCategories.forEach($=>{if(!et.find(ee=>ee.categoryId===$.entityId)){et.push({budgeted:0,categoryId:$.entityId})}})}});return et}async function wl($,ee){let et=iW($.monthlyBudgets,"month");await bD(async()=>{for(let en of et){let et=wu($,en.monthlySubCategoryBudgets.filter($=>!$.isTombstone));await Promise.all(et.map(async $=>{let et=b9($.budgeted);let ei=ee.get($.categoryId);let eo=nA(en.month);if(!ei){return}await bx(eo,ei,et);if($.overspendingHandling==="AffectsBuffer"){await bP(eo,ei,false)}else if($.overspendingHandling==="Confined"){await bP(eo,ei,true)}}))}})}function wc($){return $.split(",").reduce(($,ee)=>{const[et,en]=ee.split("-");return $+parseInt(en)},0)}function wf($,ee){let et=ee.map(ee=>{const et=$.readFile(ee).toString("utf8");let en;try{en=JSON.parse(et)}catch($){return null}if(en.hasFullKnowledge){return{deviceGUID:en.deviceGUID,shortName:en.shortDeviceId,recentness:wc(en.knowledge)}}return null}).filter($=>$);et=iW(et,"recentness");return et[et.length-1].deviceGUID}async function wd($){const ee=new Map;console.log("Importing Accounts...");await wr($,ee);console.log("Importing Categories...");await wn($,ee);console.log("Importing Payees...");await wi($,ee);console.log("Importing Transactions...");await wo($,ee);console.log("Importing Budgets...");await wl($,ee);console.log("Setting up...")}function wp($,ee){let et=wt()($);if(!/\.zip/.test(et)){return null}et=et.replace(/\.zip$/,"").replace(/.ynab4$/,"");let en=et.match(/([^/~]+)[^/]*$/);if(!en){return null}return en[1]}function wh($,ee){let et=$.filter($=>$.entryName===ee);if(et.length===0){throw new Error("Could not find file: "+ee)}if(et.length>=2){throw new Error("File name matches multiple files: "+ee)}return et[0]}function wy(...$){return $.slice(1).reduce(($,ee)=>{return $+"/"+ee.replace(/^\//,"")},$[0].replace(/\/$/,""))}function wg($){let ee=new(cQ())($);let et=ee.getEntries();let en="";let ei=et[0].entryName.match(/([^/]*\.ynab4)/);if(ei){en=ei[1]+"/"}let eo=ee.readFile(wh(et,en+"Budget.ymeta"));let es=JSON.parse(eo.toString("utf8"));let eu=wy(en,es.relativeDataFolderName);let el=et.filter($=>$.entryName.startsWith(wy(eu,"devices")));let ef=wf(ee,el);const ed=wy(eu,ef,"Budget.yfull");let ep;try{ep=ee.readFile(wh(et,ed)).toString("utf8")}catch($){console.log($);throw new Error("Error reading Budget.yfull file")}try{return JSON.parse(ep)}catch($){throw new Error("Error parsing Budget.yfull file")}};function wm($){return Math.round($/10)}function w_($,ee){return Promise.all($.accounts.map(async $=>{if(!$.deleted){let et=await bV({name:$.name,offbudget:$.on_budget?false:true,closed:$.closed});ee.set($.id,et)}}))}async function wv($,ee){const et=await bX();const en=et.find($=>$.name==="Income").id;const ei=["To be Budgeted","Inflow: Ready to Assign"];function eo(ee){if(ee.category_group_id===$.category_groups.find($=>$.name==="Internal Master Category").id){if(ei.includes(ee.name)){return"income"}else{return"internal"}}else if(ee.category_group_id===$.category_groups.find($=>$.name==="Credit Card Payments").id){return"creditCard"}}for(let et of $.category_groups){if(!et.deleted){let ei;if(et.name!=="Internal Master Category"&&et.name!=="Credit Card Payments"){ei=await bK({name:et.name,is_income:false});ee.set(et.id,ei)}let es=$.categories.filter($=>$.category_group_id===et.id);for(let $ of es.reverse()){if(!$.deleted){switch(eo($)){case"income":{let et=en;ee.set($.id,et);break}case"creditCard":case"internal":break;default:{let et=await bQ({name:$.name,group_id:ei});ee.set($.id,et);break}}}}}}}function ww($,ee){return Promise.all($.payees.map(async $=>{if(!$.deleted){let et=await b3({name:$.name});ee.set($.id,et)}}))}async function wE($,ee){const et=await b4();const en=await bX();const ei=en.find($=>$.name==="Income").id;const eo=en.find($=>$.name==="Starting Balances").id;const es=$.payees.find($=>$.name==="Starting Balance").id;let eu=ip($.transactions,"account_id");let el=ip($.subtransactions,"transaction_id");for(let et of $.transactions){ee.set(et.id,e_())}for(let et of $.subtransactions){ee.set(et.id,e_())}await Promise.all([...eu.keys()].map(async en=>{let ef=eu.get(en);let ed=ef.map(en=>{if(en.deleted){return null}let eu=el.get(en.id);let ef={id:ee.get(en.id),account:ee.get(en.account_id),date:en.date,amount:wm(en.amount),category:ee.get(en.category_id)||null,cleared:["cleared","reconciled"].includes(en.cleared),notes:en.memo||null,imported_id:en.import_id||null,transfer_id:ee.get(en.transfer_transaction_id)||null,subtransactions:eu?eu.map($=>{return{id:ee.get($.id),amount:wm($.amount),category:ee.get($.category_id)||null,notes:$.memo}}):null,payee:null,imported_payee:null};if(en.transfer_account_id){ef.payee=et.find($=>$.transfer_acct===ee.get(en.transfer_account_id)).id}else{ef.payee=ee.get(en.payee_id);ef.imported_payee=$.payees.find($=>!$.deleted&&$.id===en.payee_id)?.name}if(en.payee_id===es&&ee.get(en.category_id)===ei){ef.category=eo;ef.payee=null}return ef}).filter($=>$);await bF(ee.get(en),ed)}))}async function wS($,ee){let et=iW($.months,"month");const en=$.category_groups.find($=>$.name==="Internal Master Category").id;const ei=$.category_groups.find($=>$.name==="Credit Card Payments").id;await bD(async()=>{for(let $ of et){let et=nA($.month);await Promise.all($.categories.map(async $=>{let eo=ee.get($.id);let es=Math.round($.budgeted/10);if(!eo||$.category_group_id===en||$.category_group_id===ei){return}await bx(et,eo,es)}))}})}async function wT($){const ee=new Map;console.log("Importing Accounts...");await w_($,ee);console.log("Importing Categories...");await wv($,ee);console.log("Importing Payees...");await ww($,ee);console.log("Importing Transactions...");await wE($,ee);console.log("Importing Budgets...");await wS($,ee);console.log("Setting up...")}function wO($){let ee=JSON.parse($.toString());if(ee.data){ee=ee.data}if(ee.budget){ee=ee.budget}return ee}function wA($,ee){return ee.budget_name||ee.name};let wI={ynab4:ee,ynab5:et};async function wN($,ee,et){if($==="actual"){return by(ee,et)}let en=wI[$];try{let ei;let eo;try{ei=en.parseFile(et);eo=en.getBudgetName(ee,ei)}catch($){console.error("failed to parse file",$)}if(!eo){return{error:"not-"+$}}try{await Ei["api/start-import"]({budgetName:eo})}catch($){console.error("failed to start import",$);return{error:"unknown"}}await en.doImport(ei)}catch($){await Ei["api/abort-import"]();console.error("failed to run import",$);return{error:"unknown"}}await Ei["api/finish-import"]()};let wD=l0();wD.method("notes-save",async({id:$,note:ee})=>{await f7("notes",{id:$,note:ee})});const wR=wD;function wC($){function ee($,ee){const et=$.map($=>{try{ee($)}catch($){if($ instanceof lK){console.warn("Invalid rule",$);return $.type}throw $}return null}).filter($=>typeof $==="string");return et.length?et:null}let et=ee($.conditions,$=>new gT($.op,$.field,$.value,$.options,d3));let en=ee($.actions,$=>$.op==="link-schedule"?new gA($.op,null,$.value,null,d3):new gA($.op,$.field,$.value,$.options,d3));if(et||en){return{conditionErrors:et,actionErrors:en}}return null}let wk=l0();wk.method("rule-validate",async function($){let ee=wC($);return{error:ee}});wk.method("rule-add",aB(async function($){let ee=wC($);if(ee){return{error:ee}}let et=await mt($);return{id:et}}));wk.method("rule-update",aB(async function($){let ee=wC($);if(ee){return{error:ee}}await mr($);return{}}));wk.method("rule-delete",aB(async function($){return mn($)}));wk.method("rule-delete-all",aB(async function($){let ee=false;await fD(async()=>{for(let et of $){let $=await mn({id:et});if($===false){ee=true}}});return{someDeletionsFailed:ee}}));wk.method("rule-apply-actions",aB(cy(async function({transactionIds:$,actions:ee}){return mu($,ee)})));wk.method("rule-add-payee-rename",aB(async function({fromNames:$,to:ee}){return mp($,ee)}));wk.method("rules-get",async function(){return gk(g7()).map($=>$.serialize())});wk.method("rule-get",async function({id:$}){let ee=g7().find(ee=>ee.id===$);return ee?ee.serialize():null});wk.method("rules-run",async function({transaction:$}){return mo($)});const wM=wk;function wL($,ee){ee.forEach(($,ee)=>{if(ee==="transactions"){let ee=[];$.forEach($=>{if($.isChild===1&&$.parent_id==null&&$.id.includes("/")){let et=$.id.split("/")[0];ee.push({dataset:"transactions",row:$.id,column:"parent_id",value:et,timestamp:eo.Timestamp.send()})}});if(ee.length>0){fT(ee)}}})}let wx=null;function wP(){wF();wx=fw(wL)}function wF(){if(wx){wx();wx=null}};let wB=l0();wB.method("tools/fix-split-transactions",async()=>{let $=await f4(`
|
|
203
203
|
SELECT t.*, p.payee AS parentPayee FROM v_transactions_internal t
|
|
204
204
|
LEFT JOIN v_transactions_internal p ON t.parent_id = p.id
|
|
205
205
|
WHERE t.is_child = 1 AND t.payee IS NULL AND p.payee IS NOT NULL
|
|
206
|
-
`);await
|
|
206
|
+
`);await aq(async()=>{let ee=$.map($=>({id:$.id,payee:$.parentPayee}));await gq({updated:ee})});let ee=await f4(`
|
|
207
207
|
SELECT t.id, p.cleared FROM v_transactions_internal t
|
|
208
208
|
LEFT JOIN v_transactions_internal p ON t.parent_id = p.id
|
|
209
209
|
WHERE t.is_child = 1 AND t.cleared != p.cleared
|
|
210
|
-
`);await
|
|
210
|
+
`);await aq(async()=>{let $=ee.map($=>({id:$.id,cleared:$.cleared===1}));await gq({updated:$})});let et=await f4(`
|
|
211
211
|
SELECT t.* FROM v_transactions_internal t
|
|
212
212
|
LEFT JOIN v_transactions_internal p ON t.parent_id = p.id
|
|
213
213
|
WHERE t.is_child = 1 AND t.tombstone = 0 AND (p.tombstone = 1 OR p.id IS NULL)
|
|
214
|
-
`);await
|
|
214
|
+
`);await aq(async()=>{let $=et.map($=>({id:$.id,tombstone:1}));await gq({updated:$})});return{numBlankPayees:$.length,numCleared:ee.length,numDeleted:et.length}});const wU=wB;var wj=__webpack_require__(2568);var wW=__webpack_require__.n(wj);async function wH($,ee){function et($){return $.expr!=null?$.expr:$.cachedValue}$.execQuery(`
|
|
215
215
|
CREATE TABLE zero_budget_months
|
|
216
216
|
(id TEXT PRIMARY KEY,
|
|
217
217
|
buffered INTEGER DEFAULT 0);
|
|
@@ -240,11 +240,11 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
240
240
|
DROP TABLE spreadsheet_cells;
|
|
241
241
|
ANALYZE;
|
|
242
242
|
VACUUM;
|
|
243
|
-
`)};let
|
|
243
|
+
`)};let wz=ow;let wV={1632571489012:wH};async function w$($,ee){let et=wz;wz=$;await ee();wz=et}function wq(){return wz}function wG($){return parseInt($.match(/^(\d)+/)[0])}function wY($,ee){for(let et of ee){if(wG(et)===$){return et}}}async function wK($){let ee=1685375406832;let et=1688749527273;let en=await wZ($);if(en.includes(ee)){await a5($,"DELETE FROM __migrations__ WHERE id = ?",[ee]);await a5($,"INSERT INTO __migrations__ (id) VALUES (?)",[et])}}async function wZ($){const ee=await a5($,"SELECT * FROM __migrations__ ORDER BY id ASC",[],true);return ee.map($=>$.id)}async function wJ($){const ee=await oF($);return ee.filter($=>$.match(/(\.sql|\.js)$/)).sort(($,ee)=>{const et=wG($);const en=wG(ee);if(et<en){return-1}else if(et>en){return 1}return 0})}function wX($,ee){return ee.filter(ee=>{const et=wG(ee);return $.indexOf(et)===-1})}async function wQ($,ee){const et={runQuery:(ee,et,en)=>a5($,ee,et,en),execQuery:ee=>a9($,ee),transaction:ee=>oe($,ee)};if(wV[ee]==null){throw new Error("Could not find JS migration code to run for "+ee)}let en=wV[ee];return en(et,()=>e_())}async function w0($,ee){try{await a9($,ee)}catch($){console.log("Error applying sql:",ee);throw $}}async function w1($,ee,et){const en=await oH(oc(et,ee));if(ee.match(/\.js$/)){await wQ($,wG(ee))}else{await w0($,en)}await a5($,"INSERT INTO __migrations__ (id) VALUES (?)",[wG(ee)])}function w2($,ee){for(let et=0;et<$.length;et++){if(et>=ee.length||$[et]!==wG(ee[et])){console.error("Database is out of sync with migrations:",{appliedIds:$,available:ee});throw new Error("out-of-sync-migrations")}}}async function w6($){await wK($);let ee=await wZ($);let et=await wJ(wz);w2(ee,et);const en=wX(ee,et);for(let ee of en){await w1($,ee,wz)}return en};async function w4(){await w6(fK())}async function w3(){let $="view-hash";let ee=await f3("SELECT value FROM __meta__ WHERE key = ?",[$]);let{value:et}=ee||{};let en=sY(sZ,sJ);let ei=wW()(en);if(et!==ei){await fX(en);await fJ("INSERT OR REPLACE INTO __meta__ (key, value) VALUES (?, ?)",[$,ei])}}async function w8(){await w4();await w3()};async function w5($){let ee="My Finances";let et=1;let en=ee;while($.find($=>$.name===en)){en=`${ee} ${et}`;et++}return en}async function w9($){let ee=$.replace(/( |[^A-Za-z0-9])/g,"-")+"-"+e_().slice(0,7);let et=0;let en=oy(ee);while(await oB(en)){et++;en=oy(ee+et.toString())}if(et>0){ee=ee+et.toString()}return ee};var w7=__webpack_require__(4155);var Ee=__webpack_require__(8764)["Buffer"];let Et="_demo-budget";let Er="_test-budget";function En({names:$}){const ee=$.map($=>{let ee=uU()._getNode($);return{name:ee.name,value:ee.value}});aX("cells-changed",ee)}let Ei={};Ei["undo"]=aB(async function(){return cm()});Ei["redo"]=aB(function(){return cv()});Ei["transactions-batch-update"]=aB(async function({added:$,deleted:ee,updated:et,learnCategories:en}){return cp(async()=>{let ei=await gq({added:$,updated:et,deleted:ee,learnCategories:en});return ei.updated})});Ei["transaction-add"]=aB(async function($){await Ei["transactions-batch-update"]({added:[$]});return{}});Ei["transaction-update"]=aB(async function($){await Ei["transactions-batch-update"]({updated:[$]});return{}});Ei["transaction-delete"]=aB(async function($){await Ei["transactions-batch-update"]({deleted:[$]});return{}});Ei["transactions-parse-file"]=async function({filepath:$,options:ee}){return _S($,ee)};Ei["transactions-export"]=async function({transactions:$,accounts:ee,categoryGroups:et,payees:en}){return _t($,ee,et,en)};Ei["transactions-export-query"]=async function({query:$}){return _r(new sX($))};Ei["get-categories"]=async function(){return{grouped:await dp(),list:await df()}};Ei["get-earliest-transaction"]=async function(){let{data:$}=await ug(ue("transactions").options({splits:"none"}).orderBy({date:"asc"}).select("*").limit(1));return $[0]||null};Ei["get-budget-bounds"]=async function(){return lz()};Ei["rollover-budget-month"]=async function({month:$}){let ee=await dp();let et=n0($);function en($){let ee=uY(et,$);return{value:ee===""?0:ee,name:uL(et,$)}}let ei=[en("available-funds"),en("last-month-overspent"),en("buffered"),en("total-budgeted"),en("to-budget"),en("from-last-month"),en("total-income"),en("total-spent"),en("total-leftover")];for(let $ of ee){if($.is_income){ei.push(en("total-income"));for(let ee of $.categories){ei.push(en(`sum-amount-${ee.id}`))}}else{ei=ei.concat([en(`group-budget-${$.id}`),en(`group-sum-amount-${$.id}`),en(`group-leftover-${$.id}`)]);for(let ee of $.categories){ei=ei.concat([en(`budget-${ee.id}`),en(`sum-amount-${ee.id}`),en(`leftover-${ee.id}`),en(`carryover-${ee.id}`)])}}}return ei};Ei["report-budget-month"]=async function({month:$}){let ee=await dp();let et=n0($);function en($){let ee=uY(et,$);return{value:ee===""?0:ee,name:uL(et,$)}}let ei=[en("total-budgeted"),en("total-budget-income"),en("total-saved"),en("total-income"),en("total-spent"),en("real-saved"),en("total-leftover")];for(let $ of ee){ei=ei.concat([en(`group-budget-${$.id}`),en(`group-sum-amount-${$.id}`),en(`group-leftover-${$.id}`)]);for(let ee of $.categories){ei=ei.concat([en(`budget-${ee.id}`),en(`sum-amount-${ee.id}`),en(`leftover-${ee.id}`)]);if(!$.is_income){ei.push(en(`carryover-${ee.id}`))}}}return ei};Ei["budget-set-type"]=async function({type:$}){if(!uS.includes($)){throw new Error("Invalid budget type: "+$)}if($===uN().budgetType){return}return uA({budgetType:$})};Ei["category-create"]=aB(async function({name:$,groupId:ee,isIncome:et}){return cp(async()=>{if(!ee){throw lZ("Creating a category: groupId is required")}return d_({name:$,cat_group:ee,is_income:et?1:0})})});Ei["category-update"]=aB(async function($){return cp(async()=>{try{await dv($)}catch($){if($.message.toLowerCase().includes("unique constraint")){return{error:{type:"category-exists"}}}throw $}return{}})});Ei["category-move"]=aB(async function({id:$,groupId:ee,targetId:et}){return cp(async()=>{await fD(async()=>{await dw($,ee,et)});return"ok"})});Ei["category-delete"]=aB(async function({id:$,transferId:ee}){return cp(async()=>{let et={};await fD(async()=>{let en=await f3("SELECT is_income FROM categories WHERE id = ?",[$]);if(!en){et={error:"no-categories"};return}let ei=ee&&await f3("SELECT is_income FROM categories WHERE id = ?",[ee]);if(!en||ee&&!ei){et={error:"no-categories"};return}else if(ee&&en.is_income!==ei.is_income){et={error:"category-type"};return}if(en.is_income===0){if(ee){await lW([$],ee)}}await dE({id:$},ee)});return et})});Ei["category-group-create"]=aB(async function({name:$,isIncome:ee}){return cp(async()=>{return dh({name:$,is_income:ee?1:0})})});Ei["category-group-update"]=aB(async function($){return cp(async()=>{return dy($)})});Ei["category-group-move"]=aB(async function({id:$,targetId:ee}){return cp(async()=>{await fD(async()=>{await dg($,ee)});return"ok"})});Ei["category-group-delete"]=aB(async function({id:$,transferId:ee}){return cp(async()=>{const et=await f4("SELECT id FROM categories WHERE cat_group = ? AND tombstone = 0",[$]);return fD(async()=>{if(ee){await lW(et.map($=>$.id),ee)}await dm({id:$},ee)})})});Ei["must-category-transfer"]=async function({id:$}){const ee=await fJ(`SELECT count(t.id) as count FROM transactions t
|
|
244
244
|
LEFT JOIN category_mapping cm ON cm.id = t.category
|
|
245
|
-
WHERE cm.transferId = ? AND t.tombstone = 0`,[$],true);if(ee[0].count!==0){return true}return[...
|
|
245
|
+
WHERE cm.transferId = ? AND t.tombstone = 0`,[$],true);if(ee[0].count!==0){return true}return[...uU().meta().createdMonths].some(ee=>{const et=n0(ee);const en=uU().getCellValue(et,"budget-"+$);return en!=null&&en!==0})};Ei["payee-create"]=aB(async function({name:$}){return cp(async()=>{return dT({name:$})})});Ei["payees-get"]=async function(){return dD()};Ei["payees-get-orphaned"]=async function(){return dR()};Ei["payees-get-rule-counts"]=async function(){let $={};gL(g7(),"payee",(ee,et)=>{if($[et]==null){$[et]=0}$[et]++});return $};Ei["payees-merge"]=aB(async function({targetId:$,mergeIds:ee}){return cp(async()=>{return dN($,ee)},{targetId:$,mergeIds:ee})});Ei["payees-batch-change"]=aB(async function({added:$,deleted:ee,updated:et}){return cp(async()=>{return fD(async()=>{if(ee){await Promise.all(ee.map($=>dO($)))}if($){await Promise.all($.map($=>dT($)))}if(et){await Promise.all(et.map($=>dI($)))}})})});Ei["payees-check-orphaned"]=async function({ids:$}){let ee=new Set(await dC());return $.filter($=>ee.has($))};Ei["payees-get-rules"]=async function({id:$}){return ml($).map($=>$.serialize())};Ei["make-filters-from-conditions"]=async function({conditions:$}){return ms($)};Ei["getCell"]=async function({sheetName:$,name:ee}){let et=["name","value"];let en=uU()._getNode(uL($,ee));if(et){let $={};et.forEach(ee=>{if(ee==="run"){$[ee]=en._run?en._run.toString():null}else{$[ee]=en[ee]}});return $}else{return en}};Ei["getCells"]=async function({names:$}){return $.map($=>({value:uU()._getNode($).value}))};Ei["getCellNamesInSheet"]=async function({sheetName:$}){let ee=[];for(let et of uU().getNodes().keys()){let{sheet:en,name:ei}=uM(et);if(en===$){ee.push(ei)}}return ee};Ei["debugCell"]=async function({sheetName:$,name:ee}){let et=uU().getNode(uL($,ee));return{...et,_run:et._run&&et._run.toString()}};Ei["create-query"]=async function({sheetName:$,name:ee,query:et}){uU().createQuery($,ee,et);return"ok"};Ei["query"]=async function($){if($.table==null){throw new Error("query has no table, did you forgot to call `.serialize`?")}return ug($)};Ei["bank-delete"]=async function({id:$}){const ee=await fJ("SELECT * FROM accounts WHERE bank = ?",[$],true);await dn("banks",$);await Promise.all(ee.map(async $=>{await fJ("DELETE FROM transactions WHERE acct = ?",[$.id]);await dn("accounts",$.id)}));return"ok"};Ei["account-update"]=aB(async function({id:$,name:ee}){return cp(async()=>{await f7("accounts",{id:$,name:ee});return{}})});Ei["accounts-get"]=async function(){return dM()};Ei["account-properties"]=async function({id:$}){const{balance:ee}=await f3("SELECT sum(amount) as balance FROM transactions WHERE acct = ? AND isParent = 0 AND tombstone = 0",[$]);const{count:et}=await f3("SELECT count(id) as count FROM transactions WHERE acct = ? AND tombstone = 0",[$]);return{balance:ee||0,numTransactions:et}};Ei["accounts-link"]=async function({institution:$,publicToken:ee,accountId:et,upgradingId:en}){let ei=await _o($,ee);let[[,eo],[,es]]=await r6(["user-id","user-key"]);let eu=await mS(eo,es,ei);let el=eu.find($=>$.account_id===et);await f7("accounts",{id:en,account_id:el.account_id,official_name:el.official_name,balance_current:iF(el.balances.current),balance_available:iF(el.balances.available),balance_limit:iF(el.balances.limit),mask:el.mask,bank:ei});await mF(eo,es,en,el.account_id,ei);aX("sync-event",{type:"success",tables:["transactions"]});return"ok"};Ei["gocardless-accounts-link"]=async function({requisitionId:$,account:ee,upgradingId:et}){let en;let ei=await _u(ee.institution,$);if(et){const $=await f3("SELECT * FROM accounts WHERE id = ?",[et]);en=$.id;await f7("accounts",{id:en,account_id:ee.account_id,bank:ei.id})}else{en=e_();await de("accounts",{id:en,account_id:ee.account_id,mask:ee.mask,name:ee.name,official_name:ee.official_name,bank:ei.id});await dT({name:"",transfer_acct:en})}await mP(undefined,undefined,en,ee.account_id,ei.bank_id);aX("sync-event",{type:"success",tables:["transactions"]});return"ok"};Ei["accounts-connect"]=async function({institution:$,publicToken:ee,accountIds:et,offbudgetIds:en}){let ei=await _o($,ee);let eo=await _l(ei,et,en);return eo};Ei["gocardless-accounts-connect"]=async function({institution:$,publicToken:ee,accountIds:et,offbudgetIds:en}){let ei=await _o($,ee);let eo=await _c(ei,et,en);return eo};Ei["account-create"]=aB(async function({name:$,balance:ee,offBudget:et,closed:en}){return cp(async()=>{const ei=await dL({name:$,offbudget:et?1:0,closed:en?1:0});await dT({name:"",transfer_acct:ei});if(ee!=null&&ee!==0){let $=await d$();await dW({account:ei,amount:iF(ee),category:et?null:$.category,payee:$.id,date:nR(),cleared:true,starting_balance_flag:true})}return ei})});Ei["account-close"]=aB(async function({id:$,transferAccountId:ee,categoryId:et,forced:en}){await Ei["account-unlink"]({id:$});return cp(async()=>{let ei=await f3("SELECT * FROM accounts WHERE id = ? AND tombstone = 0",[$]);if(!ei||ei.closed===1){return}const{balance:eo,numTransactions:es}=await Ei["account-properties"]({id:$});if(es===0){await dP({id:$})}else if(en){let ee=await fJ("SELECT id, transfer_id FROM v_transactions WHERE account = ?",[$],true);let{id:et}=await f3("SELECT id FROM payees WHERE transfer_acct = ?",[$]);await fD(async()=>{ee.forEach($=>{if($.transfer_id){dH({id:$.transfer_id,payee:null,transfer_id:null})}dz({id:$.id})});dP({id:$});dA({id:et})})}else{if(eo!==0&&ee==null){throw lZ("balance is non-zero: transferAccountId is required")}await f7("accounts",{id:$,closed:1});if(eo!==0){let{id:en}=await f3("SELECT id FROM payees WHERE transfer_acct = ?",[ee]);await Ei["transaction-add"]({id:e_(),payee:en,amount:-eo,account:$,date:nR(),notes:"Closing account",category:et||null})}}})});Ei["account-reopen"]=aB(async function({id:$}){return cp(async()=>{await f7("accounts",{id:$,closed:0})})});Ei["account-move"]=aB(async function({id:$,targetId:ee}){return cp(async()=>{await dF($,ee)})});let Eo=false;Ei["poll-web-token"]=async function({token:$}){let[[,ee],[,et]]=await r6(["user-id","user-key"]);let en=Date.now();Eo=false;async function ei(eo){if(Eo){return}if(Date.now()-en>=1e3*60*10){eo("timeout");return}let es=await l8(cn().PLAID_SERVER+"/get-web-token-contents",{userId:ee,key:et,token:$});if(es){if(es.error){eo("unknown")}else{eo(null,es)}}else{setTimeout(()=>ei(eo),3e3)}}return new Promise($=>{ei((ee,et)=>{if(ee){$({error:ee})}else{$({data:et})}})})};Ei["poll-web-token-stop"]=async function(){Eo=true;return"ok"};Ei["accounts-sync"]=async function({id:$}){let[[,ee],[,et]]=await r6(["user-id","user-key"]);let en=await fJ(`SELECT a.*, b.id as bankId FROM accounts a
|
|
246
246
|
LEFT JOIN banks b ON a.bank = b.id
|
|
247
|
-
WHERE a.tombstone = 0 AND a.closed = 0`,[],true);if($){en=en.filter(ee=>ee.id===$)}let ei=[];let eo=[];let es=[];let eu=[];for(let $=0;$<en.length;$++){const el=en[$];if(el.bankId){try{const $=await
|
|
247
|
+
WHERE a.tombstone = 0 AND a.closed = 0`,[],true);if($){en=en.filter(ee=>ee.id===$)}let ei=[];let eo=[];let es=[];let eu=[];for(let $=0;$<en.length;$++){const el=en[$];if(el.bankId){try{const $=await mF(ee,et,el.id,el.account_id,el.bankId);let{added:en,updated:ei}=$;eo=eo.concat(en);es=es.concat(ei);if(en.length>0||ei.length>0){eu=eu.concat(el.id)}}catch($){if($.type==="BankSyncError"){ei.push({type:"SyncError",accountId:el.id,message:"Failed syncing account “"+el.name+".”",category:$.category,code:$.code})}else if($ instanceof l$&&$.reason!=="internal"){ei.push({accountId:el.id,message:`Account “${el.name}” is not linked properly. Please link it again`})}else{ei.push({accountId:el.id,message:"There was an internal error. Please get in touch https://actualbudget.org/contact for support.",internal:$.stack});$.message="Failed syncing account: "+$.message;aD($)}}}}if(eu.length>0){aX("sync-event",{type:"success",tables:["transactions"]})}return{errors:ei,newTransactions:eo,matchedTransactions:es,updatedAccounts:eu}};Ei["secret-set"]=async function({name:$,value:ee}){let et=await rX("user-token");if(!et){return{error:"unauthorized"}}try{return await l8(cn().BASE_SERVER+"/secret",{name:$,value:ee},{"X-ACTUAL-TOKEN":et})}catch($){console.error($);return{error:"failed"}}};Ei["secret-check"]=async function($){let ee=await rX("user-token");if(!ee){return{error:"unauthorized"}}try{return await l9(cn().BASE_SERVER+"/secret/"+$,{"X-ACTUAL-TOKEN":ee})}catch($){console.error($);return{error:"failed"}}};Ei["gocardless-poll-web-token"]=async function({upgradingAccountId:$,requisitionId:ee}){let et=await rX("user-token");if(!et)return null;let en=Date.now();Eo=false;async function ei(eo){if(Eo){return}if(Date.now()-en>=1e3*60*10){eo("timeout");return}let es=await l8(cn().GOCARDLESS_SERVER+"/get-accounts",{upgradingAccountId:$,requisitionId:ee},{"X-ACTUAL-TOKEN":et});if(es){if(es.error){eo("unknown")}else{eo(null,es)}}else{setTimeout(()=>ei(eo),3e3)}}return new Promise($=>{ei((ee,et)=>{if(ee){$({error:ee})}else{$({data:et})}})})};Ei["gocardless-status"]=async function(){const $=await rX("user-token");if(!$){return{error:"unauthorized"}}return l8(cn().GOCARDLESS_SERVER+"/status",{},{"X-ACTUAL-TOKEN":$})};Ei["gocardless-get-banks"]=async function($){const ee=await rX("user-token");if(!ee){return{error:"unauthorized"}}return l8(cn().GOCARDLESS_SERVER+"/get-banks",{country:$,showDemo:m8()},{"X-ACTUAL-TOKEN":ee})};Ei["gocardless-poll-web-token-stop"]=async function(){Eo=true;return"ok"};Ei["gocardless-create-web-token"]=async function({upgradingAccountId:$,institutionId:ee,accessValidForDays:et}){let en=await rX("user-token");if(!en){return{error:"unauthorized"}}try{return await l8(cn().GOCARDLESS_SERVER+"/create-web-token",{upgradingAccountId:$,institutionId:ee,accessValidForDays:et},{"X-ACTUAL-TOKEN":en})}catch($){console.error($);return{error:"failed"}}};Ei["gocardless-accounts-sync"]=async function({id:$}){let[[,ee],[,et]]=await r6(["user-id","user-key"]);let en=await fJ(`SELECT a.*, b.bank_id as bankId FROM accounts a
|
|
248
248
|
LEFT JOIN banks b ON a.bank = b.id
|
|
249
|
-
WHERE a.tombstone = 0 AND a.closed = 0`,[],true);if($){en=en.filter(ee=>ee.id===$)}let ei=[];let eo=[];let es=[];let eu=[];for(let $=0;$<en.length;$++){const el=en[$];if(el.bankId){try{const $=await mM(ee,et,el.id,el.account_id,el.bankId);let{added:en,updated:ei}=$;eo=eo.concat(en);es=es.concat(ei);if(en.length>0||ei.length>0){eu=eu.concat(el.id)}}catch($){if($.type==="BankSyncError"){ei.push({type:"SyncError",accountId:el.id,message:"Failed syncing account “"+el.name+".”",category:$.category,code:$.code})}else if($ instanceof lz&&$.reason!=="internal"){ei.push({accountId:el.id,message:`Account “${el.name}” is not linked properly. Please link it again`})}else{ei.push({accountId:el.id,message:"There was an internal error. Please get in touch https://actualbudget.org/contact for support.",internal:$.stack});$.message="Failed syncing account: "+$.message;aI($)}}}}if(eu.length>0){aZ("sync-event",{type:"success",tables:["transactions"]})}return{errors:ei,newTransactions:eo,matchedTransactions:es,updatedAccounts:eu}};Er["transactions-import"]=aP(function({accountId:$,transactions:ee}){return cf(async()=>{if(typeof $!=="string"){throw lY("transactions-import: accountId must be an id")}try{return await mC($,ee)}catch($){if($ instanceof lq){return{errors:[{message:$.message}],added:[],updated:[]}}throw $}})});Er["account-unlink"]=aP(async function({id:$}){let{bank:ee}=await f6("SELECT bank FROM accounts WHERE id = ?",[$]);if(!ee){return"ok"}await dM({id:$,account_id:null,bank:null,balance_current:null,balance_available:null,balance_limit:null});let{count:et}=await f6("SELECT COUNT(*) as count FROM accounts WHERE bank = ?",[ee]);let en=await rX("user-token");if(!en){return"ok"}if(et===0){let{bank_id:$}=await f6("SELECT bank_id FROM banks WHERE id = ?",[ee]);try{await l4(ce().GOCARDLESS_SERVER+"/remove-account",{requisitionId:$},{"X-ACTUAL-TOKEN":en})}catch($){console.log({error:$})}}return"ok"});Er["make-plaid-public-token"]=async function({bankId:$}){let[[,ee],[,et]]=await r6(["user-id","user-key"]);let en=await l4(ce().PLAID_SERVER+"/make-public-token",{userId:ee,key:et,item_id:""+$});if(en.error_code){return{error:"",code:en.error_code,type:en.error_type}}return{linkToken:en.link_token}};Er["save-global-prefs"]=async function($){if("maxMonths"in $){await rQ("max-months",""+$.maxMonths)}if("autoUpdate"in $){await rQ("auto-update",""+$.autoUpdate);w5.send({type:"shouldAutoUpdate",flag:$.autoUpdate})}if("documentDir"in $){if(await oP($.documentDir)){await rQ("document-dir",$.documentDir)}}if("floatingSidebar"in $){await rQ("floating-sidebar",""+$.floatingSidebar)}if("theme"in $){await rQ("theme",$.theme)}return"ok"};Er["load-global-prefs"]=async function(){let[[,$],[,ee],[,et],[,en],[,ei],[,eo]]=await r6(["floating-sidebar","max-months","auto-update","document-dir","encrypt-key","theme"]);return{floatingSidebar:$==="true"?true:false,maxMonths:iL(ee||""),autoUpdate:et==null||et==="true"?true:false,documentDir:en||Eo(),keyId:ei&&JSON.parse(ei).id,theme:eo==="light"||eo==="dark"?eo:"light"}};Er["save-prefs"]=async function($){let{cloudFileId:ee}=uA();if($.budgetName&&ee){let et=await rX("user-token");await l4(ce().SYNC_SERVER+"/update-user-filename",{token:et,fileId:ee,name:$.budgetName})}await uT($);return"ok"};Er["load-prefs"]=async function(){return uA()};Er["sync-reset"]=async function(){return await fi()};Er["sync-repair"]=async function(){await cq()};Er["key-make"]=async function({password:$}){if(!uA()){throw new Error("user-set-key must be called with file loaded")}let ee=cP(32).toString("base64");let et=e_();let en=await cj({id:et,password:$,salt:ee});await cF(en);let ei=await cK(en.getId());return await fi({key:en,salt:ee,testContent:JSON.stringify({...ei,value:ei.value.toString("base64")})})};Er["key-test"]=async function({fileId:$,password:ee}){let et=await rX("user-token");if($==null){$=uA().cloudFileId}let en;try{en=await l4(ce().SYNC_SERVER+"/user-get-key",{token:et,fileId:$})}catch($){console.log($);return{error:{reason:"network"}}}let{id:ei,salt:eo,test:es}=en;if(es==null){return{error:{reason:"old-key-style"}}}es=JSON.parse(es);let eu=await cj({id:ei,password:ee,salt:eo});cF(eu);try{await cx(w9.from(es.value,"base64"),es.meta)}catch($){console.log($);cB(eu);return{error:{reason:"decrypt-failure"}}}let el=JSON.parse(await rX(`encrypt-keys`)||"{}");el[$]=eu.serialize();await rQ("encrypt-keys",JSON.stringify(el));if(uA()){await uT({encryptKeyId:eu.getId()})}return{}};Er["get-did-bootstrap"]=async function(){return Boolean(await rX("did-bootstrap"))};Er["subscribe-needs-bootstrap"]=async function({url:$}={}){try{if(!ce($)){return{bootstrapped:true,hasServer:false}}}catch($){return{error:"get-server-failure"}}let ee;try{ee=await l8(ce($).SIGNUP_SERVER+"/needs-bootstrap")}catch($){return{error:"network-failure"}}try{ee=JSON.parse(ee)}catch($){return{error:"parse-failure"}}if(ee.status==="error"){return{error:ee.reason}}return{bootstrapped:ee.data.bootstrapped,hasServer:true}};Er["subscribe-bootstrap"]=async function({password:$}){let ee;try{ee=await l4(ce().SIGNUP_SERVER+"/bootstrap",{password:$})}catch($){return{error:$.reason||"network-failure"}}if(ee.token){await rQ("user-token",ee.token);return{}}return{error:"internal"}};Er["subscribe-get-user"]=async function(){if(!ce()){if(!await rX("did-bootstrap")){return null}return{offline:false}}let $=await rX("user-token");if(!$){return null}try{const ee=await l8(ce().SIGNUP_SERVER+"/validate",{headers:{"X-ACTUAL-TOKEN":$}});const{status:et,reason:en}=JSON.parse(ee);if(et==="error"){if(en==="unauthorized"){return null}return{offline:true}}return{offline:false}}catch($){console.log($);return{offline:true}}};Er["subscribe-change-password"]=async function({password:$}){let ee=await rX("user-token");if(!ee){return{error:"not-logged-in"}}try{await l4(ce().SIGNUP_SERVER+"/change-password",{token:ee,password:$})}catch($){return{error:$.reason||"network-failure"}}return{}};Er["subscribe-sign-in"]=async function({password:$}){let ee=await l4(ce().SIGNUP_SERVER+"/login",{password:$});if(ee.token){await rQ("user-token",ee.token);return{}}return{error:"invalid-password"}};Er["subscribe-sign-out"]=async function(){cU();await r3(["user-token","encrypt-keys","lastBudget","readOnly"]);return"ok"};Er["get-server-version"]=async function(){if(!ce()){return{error:"no-server"}}let $;try{const ee=await l8(ce().BASE_SERVER+"/info");const et=JSON.parse(ee);$=et.build.version}catch($){return{error:"network-failure"}}return{version:$}};Er["get-server-url"]=async function(){return ce()&&ce().BASE_SERVER};Er["set-server-url"]=async function({url:$,validate:ee=true}){if($==null){await r0("user-token")}else{$=$.replace(/\/+$/,"");if(ee){let{error:ee}=await aj(Er["subscribe-needs-bootstrap"],{url:$});if(ee){return{error:ee}}}}await rQ("server-url",$);await rQ("did-bootstrap",true);l7($);return{}};Er["sync"]=async function(){return fx()};Er["get-budgets"]=async function(){const $=await ox(of());const ee=(await Promise.all($.map(async $=>{const ee=ou(of(),$,"metadata.json");if(await oP(ee)){let et;try{et=JSON.parse(await oj(ee))}catch($){console.log("Error parsing metadata:",$.stack);return}if($!==w7){return{id:$,cloudFileId:et.cloudFileId,groupId:et.groupId,name:et.budgetName||"(no name)"}}}return null}))).filter($=>$);return ee};Er["get-remote-files"]=async function(){return ft()};Er["reset-budget-cache"]=aP(async function(){await uV($);uF().recomputeAll();await uK()});Er["upload-budget"]=async function({id:$}={}){if($){if(uA()){throw new Error("upload-budget: id given but prefs already loaded")}await uS($)}try{await c9()}catch($){console.log($);if($.type==="FileUploadError"){return{error:$}}aI($);return{error:{reason:"internal"}}}finally{if($){uO()}}return{}};Er["download-budget"]=async function({fileId:$}){let ee;try{ee=await fr($)}catch($){if($.type==="FileDownloadError"){if($.reason==="file-exists"&&$.meta.id){await uS($.meta.id);let ee=uA().budgetName;uO();$.meta={...$.meta,name:ee}}return{error:$}}else{aI($);return{error:{reason:"internal"}}}}let et=ee.id;await Er["load-budget"]({id:et});ee=await Er["sync-budget"]();await Er["close-budget"]();if(ee.error){return ee}return{id:et}};Er["sync-budget"]=async function(){fl("enabled");let $=await fL();return $};Er["load-budget"]=async function({id:$}){let ee=uA();if(ee){if(ee.id===$){return{}}else{await Er["close-budget"]()}}let et=await Ei($);return et};Er["create-demo-budget"]=async function(){await rQ("readOnly","");return Er["create-budget"]({budgetName:"Demo Budget",testMode:true,testBudgetId:w7})};Er["close-budget"]=async function(){aN({message:"Closing budget"});await uK();uH();fR();await l0.stopServices();await f$();try{await rQ("lastBudget","")}catch($){}uO();_Q();return"ok"};Er["delete-budget"]=async function({id:$,cloudFileId:ee}){if(ee){await fe(ee).catch($=>{})}if($){let ee=od($);await oV(ee)}return"ok"};Er["create-budget"]=async function({budgetName:$,avoidUpload:ee,testMode:et,testBudgetId:en}={}){let ei;if(et){$=$||"Test Budget";ei=en||Ee;if(await oP(od(ei))){await oV(od(ei))}}else{if(!$){let ee=await Er["get-budgets"]();$=await w3(ee)}ei=await w8($)}let eo=od(ei);await oF(eo);await oU(om,ou(eo,"db.sqlite"));await oW(ou(eo,"metadata.json"),JSON.stringify(uI(ei,$)));let{error:es}=await Ei(ei);if(es){console.log("Error creating budget: "+es);return{error:es}}if(!ee&&!et){try{await c9()}catch($){}}if(et){await mQ(Er)}return{}};Er["import-budget"]=async function({filepath:$,type:ee}){try{if(!await oP($)){throw new Error(`File not found at the provided path: ${$}`)}let et=w9.from(await oj($,"binary"));let en=await wA(ee,$,et);return en||{}}catch($){$.message="Error importing budget: "+$.message;aI($);return{error:"internal-error"}}};Er["export-budget"]=async function(){try{return{data:await c8()}}catch($){$.message="Error exporting budget: "+$.message;aI($);return{error:"internal-error"}}};async function Ei(ee){let et;try{et=od(ee)}catch($){aI(new Error("`getBudgetDir` failed in `loadBudget`: "+$.message));return{error:"budget-not-found"}}aN({message:"Loading budget "+et});if(!await oP(et)){aI(new Error("budget directory does not exist"));return{error:"budget-not-found"}}try{await uS(ee);await fz(ee)}catch($){aN({message:"Error loading budget "+ee});aI($);await Er["close-budget"]();return{error:"opening-budget"}}if(!uA().userId){let $=await rX("user-token");uT({userId:$})}try{await w4()}catch(et){console.warn("Error updating",et);let $;if(et.message.includes("out-of-sync-migrations")){$={error:"out-of-sync-migrations"}}else if(et.message.includes("out-of-sync-data")){$={error:"out-of-sync-data"}}else{aI(et);ug.info("Error updating budget "+ee,et);console.log("Error updating budget",et);$={error:"loading-budget"}}await Er["close-budget"]();return $}await fY();if(uA().resetClock){eo.getClock().timestamp.setNode(eo.makeClientId());await fK("INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)",[eo.serializeClock(eo.getClock())]);await uT({resetClock:false})}if(!u_&&!um&&"production"!=="test"){_X(ee)}try{await uW($,Et)}catch($){aI($);await Er["close-budget"]();return{error:"opening-budget"}}uF().meta().budgetType=uA().budgetType;await lW();await ps();await g8();await wL();await l0.startServices();cl();if(true){if(ee===w7){fl("disabled")}else{if(ce()){fl("enabled")}else{fl("disabled")}await rQ("lastBudget",ee);if(!um){await c7()}}}l0.events.emit("load-budget",{id:ee});return{}}Er["upload-file-web"]=async function({filename:$,contents:ee}){if(!u_){return null}await oW("/uploads/"+$,ee);return{}};Er["backups-get"]=async function({id:$}){return _Y($)};Er["backup-load"]=async function({id:$,backupId:ee}){await _J($,ee)};Er["backup-make"]=async function({id:$}){await _Z($)};Er["get-last-opened-backup"]=async function(){const $=await rX("lastBudget");if($&&$!==""){const ee=od($);if(await oP(ee)){return $}}return null};Er["app-focused"]=async function(){if(uA()&&uA().id){fx()}};Er=_z(Er);ei(($,ee)=>aj(l0.handlers[$],ee));l0.handlers=Er;l0.combine(vY,br,wN,wF,bd,wC);function Eo(){if(um){return"/documents"}return ou("/documents","Actual")}async function Es(){async function $($){if(!await oP($)){await oF($)}}let ee=await rX("document-dir");if(ee){try{await $(ee)}catch($){ee=null}}if(!ee){ee=Eo()}await $(ee);oc(ee)}async function Eu(ee,et){await a1();await Promise.all([rZ(),oM()]);await Es();let en=await rX("encrypt-keys");if(en){try{let $=JSON.parse(en);await Promise.all(Object.keys($).map(ee=>{return cF($[ee])}))}catch($){console.log("Error loading key",$);throw new Error("load-key-error")}}let ei=await rX("server-url");if(ei==="https://not-configured/"){ei=null;await rQ("server-url",null);await rQ("did-bootstrap",true)}if(!ei){await r0("user-token")}l7(ei);aK(et,l0.handlers);if(!ee&&!um&&!u_){let $=await rX("auto-update");w5.send({type:"shouldAutoUpdate",flag:$==null||$==="true"})}if(ee){__webpack_require__.g.$send=($,ee)=>aj(l0.handlers[$],ee);__webpack_require__.g.$query=uh;__webpack_require__.g.$q=sX;__webpack_require__.g.$db=$;__webpack_require__.g.$setSyncingMode=fl}}async function El($){let ee,et;if($){ee=$.dataDir;et=$.serverURL}else{ee="/";et=({}).ACTUAL_SERVER_URL}await a1();await Promise.all([rZ({persist:false}),oM()]);oc(ee||w5.cwd());if(et){l7(et);if($.password){await aj(Er["subscribe-sign-in"],{password:$.password})}}else{l7(null);l0.events.on("load-budget",()=>{fl("offline")})}return Ec}const Ec={getDataDir:ow,sendMessage:($,ee)=>aZ($,ee),send:async($,ee)=>{let et=await aj(l0.handlers[$],ee);return et},on:($,ee)=>l0.events.on($,ee),q:sX,db:$}})();backend=__webpack_exports__})();
|
|
250
|
-
//# sourceMappingURL=kcab.worker.
|
|
249
|
+
WHERE a.tombstone = 0 AND a.closed = 0`,[],true);if($){en=en.filter(ee=>ee.id===$)}let ei=[];let eo=[];let es=[];let eu=[];for(let $=0;$<en.length;$++){const el=en[$];if(el.bankId){try{const $=await mP(ee,et,el.id,el.account_id,el.bankId);let{added:en,updated:ei}=$;eo=eo.concat(en);es=es.concat(ei);if(en.length>0||ei.length>0){eu=eu.concat(el.id)}}catch($){if($.type==="BankSyncError"){ei.push({type:"SyncError",accountId:el.id,message:"Failed syncing account “"+el.name+".”",category:$.category,code:$.code})}else if($ instanceof l$&&$.reason!=="internal"){ei.push({accountId:el.id,message:`Account “${el.name}” is not linked properly. Please link it again`})}else{ei.push({accountId:el.id,message:"There was an internal error. Please get in touch https://actualbudget.org/contact for support.",internal:$.stack});$.message="Failed syncing account: "+$.message;aD($)}}}}if(eu.length>0){aX("sync-event",{type:"success",tables:["transactions"]})}return{errors:ei,newTransactions:eo,matchedTransactions:es,updatedAccounts:eu}};Ei["transactions-import"]=aB(function({accountId:$,transactions:ee}){return cp(async()=>{if(typeof $!=="string"){throw lZ("transactions-import: accountId must be an id")}try{return await mM($,ee)}catch($){if($ instanceof lY){return{errors:[{message:$.message}],added:[],updated:[]}}throw $}})});Ei["account-unlink"]=aB(async function({id:$}){let{bank:ee}=await f3("SELECT bank FROM accounts WHERE id = ?",[$]);if(!ee){return"ok"}await dx({id:$,account_id:null,bank:null,balance_current:null,balance_available:null,balance_limit:null});let{count:et}=await f3("SELECT COUNT(*) as count FROM accounts WHERE bank = ?",[ee]);let en=await rX("user-token");if(!en){return"ok"}if(et===0){let{bank_id:$}=await f3("SELECT bank_id FROM banks WHERE id = ?",[ee]);try{await l8(cn().GOCARDLESS_SERVER+"/remove-account",{requisitionId:$},{"X-ACTUAL-TOKEN":en})}catch($){console.log({error:$})}}return"ok"});Ei["make-plaid-public-token"]=async function({bankId:$}){let[[,ee],[,et]]=await r6(["user-id","user-key"]);let en=await l8(cn().PLAID_SERVER+"/make-public-token",{userId:ee,key:et,item_id:""+$});if(en.error_code){return{error:"",code:en.error_code,type:en.error_type}}return{linkToken:en.link_token}};Ei["save-global-prefs"]=async function($){if("maxMonths"in $){await rQ("max-months",""+$.maxMonths)}if("autoUpdate"in $){await rQ("auto-update",""+$.autoUpdate);w7.send({type:"shouldAutoUpdate",flag:$.autoUpdate})}if("documentDir"in $){if(await oB($.documentDir)){await rQ("document-dir",$.documentDir)}}if("floatingSidebar"in $){await rQ("floating-sidebar",""+$.floatingSidebar)}if("theme"in $){await rQ("theme",$.theme)}return"ok"};Ei["load-global-prefs"]=async function(){let[[,$],[,ee],[,et],[,en],[,ei],[,eo]]=await r6(["floating-sidebar","max-months","auto-update","document-dir","encrypt-key","theme"]);return{floatingSidebar:$==="true"?true:false,maxMonths:iP(ee||""),autoUpdate:et==null||et==="true"?true:false,documentDir:en||Eu(),keyId:ei&&JSON.parse(ei).id,theme:eo==="light"||eo==="dark"?eo:"light"}};Ei["save-prefs"]=async function($){let{cloudFileId:ee}=uN();if($.budgetName&&ee){let et=await rX("user-token");await l8(cn().SYNC_SERVER+"/update-user-filename",{token:et,fileId:ee,name:$.budgetName})}await uA($);return"ok"};Ei["load-prefs"]=async function(){return uN()};Ei["sync-reset"]=async function(){return await fu()};Ei["sync-repair"]=async function(){await cY()};Ei["key-make"]=async function({password:$}){if(!uN()){throw new Error("user-set-key must be called with file loaded")}let ee=cB(32).toString("base64");let et=e_();let en=await cH({id:et,password:$,salt:ee});await cU(en);let ei=await cJ(en.getId());return await fu({key:en,salt:ee,testContent:JSON.stringify({...ei,value:ei.value.toString("base64")})})};Ei["key-test"]=async function({fileId:$,password:ee}){let et=await rX("user-token");if($==null){$=uN().cloudFileId}let en;try{en=await l8(cn().SYNC_SERVER+"/user-get-key",{token:et,fileId:$})}catch($){console.log($);return{error:{reason:"network"}}}let{id:ei,salt:eo,test:es}=en;if(es==null){return{error:{reason:"old-key-style"}}}es=JSON.parse(es);let eu=await cH({id:ei,password:ee,salt:eo});cU(eu);try{await cF(Ee.from(es.value,"base64"),es.meta)}catch($){console.log($);cj(eu);return{error:{reason:"decrypt-failure"}}}let el=JSON.parse(await rX(`encrypt-keys`)||"{}");el[$]=eu.serialize();await rQ("encrypt-keys",JSON.stringify(el));if(uN()){await uA({encryptKeyId:eu.getId()})}return{}};Ei["get-did-bootstrap"]=async function(){return Boolean(await rX("did-bootstrap"))};Ei["subscribe-needs-bootstrap"]=async function({url:$}={}){try{if(!cn($)){return{bootstrapped:true,hasServer:false}}}catch($){return{error:"get-server-failure"}}let ee;try{ee=await l9(cn($).SIGNUP_SERVER+"/needs-bootstrap")}catch($){return{error:"network-failure"}}try{ee=JSON.parse(ee)}catch($){return{error:"parse-failure"}}if(ee.status==="error"){return{error:ee.reason}}return{bootstrapped:ee.data.bootstrapped,hasServer:true}};Ei["subscribe-bootstrap"]=async function({password:$}){let ee;try{ee=await l8(cn().SIGNUP_SERVER+"/bootstrap",{password:$})}catch($){return{error:$.reason||"network-failure"}}if(ee.token){await rQ("user-token",ee.token);return{}}return{error:"internal"}};Ei["subscribe-get-user"]=async function(){if(!cn()){if(!await rX("did-bootstrap")){return null}return{offline:false}}let $=await rX("user-token");if(!$){return null}try{const ee=await l9(cn().SIGNUP_SERVER+"/validate",{headers:{"X-ACTUAL-TOKEN":$}});const{status:et,reason:en}=JSON.parse(ee);if(et==="error"){if(en==="unauthorized"){return null}return{offline:true}}return{offline:false}}catch($){console.log($);return{offline:true}}};Ei["subscribe-change-password"]=async function({password:$}){let ee=await rX("user-token");if(!ee){return{error:"not-logged-in"}}try{await l8(cn().SIGNUP_SERVER+"/change-password",{token:ee,password:$})}catch($){return{error:$.reason||"network-failure"}}return{}};Ei["subscribe-sign-in"]=async function({password:$}){let ee=await l8(cn().SIGNUP_SERVER+"/login",{password:$});if(ee.token){await rQ("user-token",ee.token);return{}}return{error:"invalid-password"}};Ei["subscribe-sign-out"]=async function(){cW();await r3(["user-token","encrypt-keys","lastBudget","readOnly"]);return"ok"};Ei["get-server-version"]=async function(){if(!cn()){return{error:"no-server"}}let $;try{const ee=await l9(cn().BASE_SERVER+"/info");const et=JSON.parse(ee);$=et.build.version}catch($){return{error:"network-failure"}}return{version:$}};Ei["get-server-url"]=async function(){return cn()&&cn().BASE_SERVER};Ei["set-server-url"]=async function({url:$,validate:ee=true}){if($==null){await r0("user-token")}else{$=$.replace(/\/+$/,"");if(ee){let{error:ee}=await aH(Ei["subscribe-needs-bootstrap"],{url:$});if(ee){return{error:ee}}}}await rQ("server-url",$);await rQ("did-bootstrap",true);ct($);return{}};Ei["sync"]=async function(){return fF()};Ei["get-budgets"]=async function(){const $=await oF(oh());const ee=(await Promise.all($.map(async $=>{const ee=oc(oh(),$,"metadata.json");if(await oB(ee)){let et;try{et=JSON.parse(await oH(ee))}catch($){console.log("Error parsing metadata:",$.stack);return}if($!==Et){return{id:$,cloudFileId:et.cloudFileId,groupId:et.groupId,name:et.budgetName||"(no name)"}}}return null}))).filter($=>$);return ee};Ei["get-remote-files"]=async function(){return fi()};Ei["reset-budget-cache"]=aB(async function(){await uq($);uU().recomputeAll();await uJ()});Ei["upload-budget"]=async function({id:$}={}){if($){if(uN()){throw new Error("upload-budget: id given but prefs already loaded")}await uO($)}try{await fe()}catch($){console.log($);if($.type==="FileUploadError"){return{error:$}}aD($);return{error:{reason:"internal"}}}finally{if($){uI()}}return{}};Ei["download-budget"]=async function({fileId:$}){let ee;try{ee=await fo($)}catch($){if($.type==="FileDownloadError"){if($.reason==="file-exists"&&$.meta.id){await uO($.meta.id);let ee=uN().budgetName;uI();$.meta={...$.meta,name:ee}}return{error:$}}else{aD($);return{error:{reason:"internal"}}}}let et=ee.id;await Ei["load-budget"]({id:et});ee=await Ei["sync-budget"]();await Ei["close-budget"]();if(ee.error){return ee}return{id:et}};Ei["sync-budget"]=async function(){fp("enabled");let $=await fP();return $};Ei["load-budget"]=async function({id:$}){let ee=uN();if(ee){if(ee.id===$){return{}}else{await Ei["close-budget"]()}}let et=await Es($);return et};Ei["create-demo-budget"]=async function(){await rQ("readOnly","");return Ei["create-budget"]({budgetName:"Demo Budget",testMode:true,testBudgetId:Et})};Ei["close-budget"]=async function(){aR({message:"Closing budget"});await uJ();uV();fk();await l2.stopServices();await fG();try{await rQ("lastBudget","")}catch($){}uI();_1();return"ok"};Ei["delete-budget"]=async function({id:$,cloudFileId:ee}){if(ee){await fr(ee).catch($=>{})}if($){let ee=oy($);await oq(ee)}return"ok"};Ei["create-budget"]=async function({budgetName:$,avoidUpload:ee,testMode:et,testBudgetId:en}={}){let ei;if(et){$=$||"Test Budget";ei=en||Er;if(await oB(oy(ei))){await oq(oy(ei))}}else{if(!$){let ee=await Ei["get-budgets"]();$=await w5(ee)}ei=await w9($)}let eo=oy(ei);await oU(eo);await oW(ov,oc(eo,"db.sqlite"));await oz(oc(eo,"metadata.json"),JSON.stringify(uD(ei,$)));let{error:es}=await Es(ei);if(es){console.log("Error creating budget: "+es);return{error:es}}if(!ee&&!et){try{await fe()}catch($){}}if(et){await m6(Ei)}return{}};Ei["import-budget"]=async function({filepath:$,type:ee}){try{if(!await oB($)){throw new Error(`File not found at the provided path: ${$}`)}let et=Ee.from(await oH($,"binary"));let en=await wN(ee,$,et);return en||{}}catch($){$.message="Error importing budget: "+$.message;aD($);return{error:"internal-error"}}};Ei["export-budget"]=async function(){try{return{data:await c9()}}catch($){$.message="Error exporting budget: "+$.message;aD($);return{error:"internal-error"}}};async function Es(ee){let et;try{et=oy(ee)}catch($){aD(new Error("`getBudgetDir` failed in `loadBudget`: "+$.message));return{error:"budget-not-found"}}aR({message:"Loading budget "+et});if(!await oB(et)){aD(new Error("budget directory does not exist"));return{error:"budget-not-found"}}try{await uO(ee);await f$(ee)}catch($){aR({message:"Error loading budget "+ee});aD($);await Ei["close-budget"]();return{error:"opening-budget"}}if(!uN().userId){let $=await rX("user-token");uA({userId:$})}try{await w8()}catch(et){console.warn("Error updating",et);let $;if(et.message.includes("out-of-sync-migrations")){$={error:"out-of-sync-migrations"}}else if(et.message.includes("out-of-sync-data")){$={error:"out-of-sync-data"}}else{aD(et);u_.info("Error updating budget "+ee,et);console.log("Error updating budget",et);$={error:"loading-budget"}}await Ei["close-budget"]();return $}await fZ();if(uN().resetClock){eo.getClock().timestamp.setNode(eo.makeClientId());await fJ("INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)",[eo.serializeClock(eo.getClock())]);await uA({resetClock:false})}if(!uw&&!uv&&"production"!=="test"){_0(ee)}try{await uz($,En)}catch($){aD($);await Ei["close-budget"]();return{error:"opening-budget"}}uU().meta().budgetType=uN().budgetType;await lz();await pl();await g9();await wP();await l2.startServices();cd();if(true){if(ee===Et){fp("disabled")}else{if(cn()){fp("enabled")}else{fp("disabled")}await rQ("lastBudget",ee);if(!uv){await ft()}}}l2.events.emit("load-budget",{id:ee});return{}}Ei["upload-file-web"]=async function({filename:$,contents:ee}){if(!uw){return null}await oz("/uploads/"+$,ee);return{}};Ei["backups-get"]=async function({id:$}){return _Z($)};Ei["backup-load"]=async function({id:$,backupId:ee}){await _Q($,ee)};Ei["backup-make"]=async function({id:$}){await _X($)};Ei["get-last-opened-backup"]=async function(){const $=await rX("lastBudget");if($&&$!==""){const ee=oy($);if(await oB(ee)){return $}}return null};Ei["app-focused"]=async function(){if(uN()&&uN().id){fF()}};Ei=_$(Ei);ei(($,ee)=>aH(l2.handlers[$],ee));l2.handlers=Ei;l2.combine(vZ,bi,wR,wU,bh,wM);function Eu(){if(uv){return"/documents"}return oc("/documents","Actual")}async function El(){async function $($){if(!await oB($)){await oU($)}}let ee=await rX("document-dir");if(ee){try{await $(ee)}catch($){ee=null}}if(!ee){ee=Eu()}await $(ee);od(ee)}async function Ec(ee,et){await a6();await Promise.all([rZ(),ox()]);await El();let en=await rX("encrypt-keys");if(en){try{let $=JSON.parse(en);await Promise.all(Object.keys($).map(ee=>{return cU($[ee])}))}catch($){console.log("Error loading key",$);throw new Error("load-key-error")}}let ei=await rX("server-url");if(ei==="https://not-configured/"){ei=null;await rQ("server-url",null);await rQ("did-bootstrap",true)}if(!ei){await r0("user-token")}ct(ei);aJ(et,l2.handlers);if(!ee&&!uv&&!uw){let $=await rX("auto-update");w7.send({type:"shouldAutoUpdate",flag:$==null||$==="true"})}if(ee){__webpack_require__.g.$send=($,ee)=>aH(l2.handlers[$],ee);__webpack_require__.g.$query=ug;__webpack_require__.g.$q=ue;__webpack_require__.g.$db=$;__webpack_require__.g.$setSyncingMode=fp}}async function Ef($){let ee,et;if($){ee=$.dataDir;et=$.serverURL}else{ee="/";et=({}).ACTUAL_SERVER_URL}await a6();await Promise.all([rZ({persist:false}),ox()]);od(ee||w7.cwd());if(et){ct(et);if($.password){await aH(Ei["subscribe-sign-in"],{password:$.password})}}else{ct(null);l2.events.on("load-budget",()=>{fp("offline")})}return Ed}const Ed={getDataDir:oS,sendMessage:($,ee)=>aX($,ee),send:async($,ee)=>{let et=await aH(l2.handlers[$],ee);return et},on:($,ee)=>l2.events.on($,ee),q:ue,db:$}})();backend=__webpack_exports__})();
|
|
250
|
+
//# sourceMappingURL=kcab.worker.8a181a0b032adc34600e.js.map
|