diff --git a/lum/lum/.obsidian/community-plugins.json b/lum/lum/.obsidian/community-plugins.json deleted file mode 100644 index 8a47943..0000000 --- a/lum/lum/.obsidian/community-plugins.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "obsidian-charts" -] \ No newline at end of file diff --git a/orion/.obsidian/community-plugins.json b/orion/.obsidian/community-plugins.json index 57c5bad..b3cdf22 100644 --- a/orion/.obsidian/community-plugins.json +++ b/orion/.obsidian/community-plugins.json @@ -1,3 +1,4 @@ [ - "obsidian-kanban" + "obsidian-kanban", + "obsidian-livesync" ] \ No newline at end of file diff --git a/orion/.obsidian/plugins/obsidian-livesync/data.json b/orion/.obsidian/plugins/obsidian-livesync/data.json new file mode 100644 index 0000000..98cf9c9 --- /dev/null +++ b/orion/.obsidian/plugins/obsidian-livesync/data.json @@ -0,0 +1,120 @@ +{ + "remoteType": "", + "useCustomRequestHandler": false, + "couchDB_URI": "", + "couchDB_USER": "", + "couchDB_PASSWORD": "", + "couchDB_DBNAME": "", + "liveSync": true, + "syncOnSave": false, + "syncOnStart": false, + "savingDelay": 200, + "lessInformationInLog": false, + "gcDelay": 0, + "versionUpFlash": "", + "minimumChunkSize": 20, + "longLineThreshold": 250, + "showVerboseLog": false, + "suspendFileWatching": false, + "trashInsteadDelete": true, + "periodicReplication": false, + "periodicReplicationInterval": 60, + "syncOnFileOpen": false, + "encrypt": true, + "passphrase": "", + "usePathObfuscation": true, + "doNotDeleteFolder": false, + "resolveConflictsByNewerFile": false, + "batchSave": false, + "batchSaveMinimumDelay": 5, + "batchSaveMaximumDelay": 60, + "deviceAndVaultName": "", + "usePluginSettings": false, + "showOwnPlugins": false, + "showStatusOnEditor": true, + "showStatusOnStatusbar": true, + "showOnlyIconsOnEditor": false, + "usePluginSync": true, + "autoSweepPlugins": false, + "autoSweepPluginsPeriodic": false, + "notifyPluginOrSettingUpdated": false, + "checkIntegrityOnSave": false, + "batch_size": 50, + "batches_limit": 50, + "useHistory": true, + "disableRequestURI": true, + "skipOlderFilesOnSync": true, + "checkConflictOnlyOnOpen": false, + "showMergeDialogOnlyOnActive": false, + "syncInternalFiles": false, + "syncInternalFilesBeforeReplication": false, + "syncInternalFilesIgnorePatterns": "\\/node_modules\\/, \\/\\.git\\/, \\/obsidian-livesync\\/", + "syncInternalFilesInterval": 60, + "additionalSuffixOfDatabaseName": "9938c7553ae7198e", + "ignoreVersionCheck": false, + "lastReadUpdates": 0, + "deleteMetadataOfDeletedFiles": false, + "syncIgnoreRegEx": "", + "syncOnlyRegEx": "", + "customChunkSize": 50, + "readChunksOnline": true, + "watchInternalFileChanges": true, + "automaticallyDeleteMetadataOfDeletedFiles": 0, + "disableMarkdownAutoMerge": false, + "writeDocumentsIfConflicted": false, + "useDynamicIterationCount": false, + "syncAfterMerge": false, + "configPassphraseStore": "", + "encryptedPassphrase": "%f41bb4b9fb5c8d9dae8b886206000000c5675cd8321e6238b48e0bce931b24e5qOHQD5xtxaV8wcV3PXHgASLawaRYmRKxgOUkcPmNI3T526Y=", + "encryptedCouchDBConnection": "%f41bb4b9fb5c8d9dae8b886205000000c5675cd8321e6238b48e0bce931b24e5nYSR+S6+JFZs/0/0LxuSZCy6I3AnyAxQMhD/cphpx4qT/Ln0VUYpXdKq3sp/da7mJ8yRT83JLdaShEsqzG2QeBMfvdSak2G0bmRnSBldBsNrtErFZPWOS84hC3641OB1capBBAkxK4GDM/7PRCC6Qu86qhL/BvkydoNgtnWxcwdoULmOUBdUw5Pcw5/UzNPx6BYdlcwCWLnGWsbPC5Wug+25p5Ar9OzxteV0xLUMrTRahcOBCwLoLuguMvEHKuK6CFKwKJ0mw1IhkrTkW0KQSilkmtYwYexh+V96akLMwpDlZrh0R4fnK2yHqVmb/hOZcPaRh3qe+MGXKYm7TdYTRGcXF/lccm/B/yGeNdVKlw8ssQ==", + "permitEmptyPassphrase": false, + "useIndexedDBAdapter": true, + "useTimeouts": false, + "writeLogToTheFile": false, + "doNotPaceReplication": false, + "hashCacheMaxCount": 300, + "hashCacheMaxAmount": 50, + "concurrencyOfReadChunksOnline": 100, + "minimumIntervalOfReadChunksOnline": 100, + "hashAlg": "xxhash64", + "suspendParseReplicationResult": false, + "doNotSuspendOnFetching": false, + "useIgnoreFiles": false, + "ignoreFiles": ".gitignore", + "syncOnEditorSave": false, + "pluginSyncExtendedSetting": {}, + "syncMaxSizeInMB": 50, + "settingSyncFile": "", + "writeCredentialsForSettingSync": false, + "notifyAllSettingSyncFile": false, + "isConfigured": true, + "settingVersion": 10, + "enableCompression": false, + "accessKey": "", + "bucket": "", + "endpoint": "", + "region": "", + "secretKey": "", + "useEden": false, + "maxChunksInEden": 10, + "maxTotalLengthInEden": 1024, + "maxAgeInEden": 10, + "disableCheckingConfigMismatch": false, + "displayLanguage": "", + "enableChunkSplitterV2": false, + "disableWorkerForGeneratingChunks": false, + "processSmallFilesInUIThread": false, + "notifyThresholdOfRemoteStorageSize": 800, + "usePluginSyncV2": false, + "usePluginEtc": false, + "handleFilenameCaseSensitive": false, + "doNotUseFixedRevisionForChunks": false, + "showLongerLogInsideEditor": false, + "sendChunksBulk": false, + "sendChunksBulkMaxSize": 1, + "useSegmenter": false, + "useAdvancedMode": true, + "usePowerUserMode": false, + "useEdgeCaseMode": false, + "enableDebugTools": false +} \ No newline at end of file diff --git a/orion/.obsidian/plugins/obsidian-livesync/main.js b/orion/.obsidian/plugins/obsidian-livesync/main.js new file mode 100644 index 0000000..7df80ee --- /dev/null +++ b/orion/.obsidian/plugins/obsidian-livesync/main.js @@ -0,0 +1,7 @@ +/* +THIS IS A GENERATED/BUNDLED FILE BY ESBUILD AND TERSER +if you want to view the source, please visit the github repository of this plugin +*/ + +"use strict";var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__typeError=msg=>{throw TypeError(msg)},__defNormalProp=(obj,key2,value)=>key2 in obj?__defProp(obj,key2,{enumerable:true,configurable:true,writable:true,value}):obj[key2]=value,__commonJS=(cb2,mod)=>function __require(){return mod||(0,cb2[__getOwnPropNames(cb2)[0]])((mod={exports:{}}).exports,mod),mod.exports},__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})},__copyProps=(to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key2 of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key2)&&key2!==except)__defProp(to,key2,{get:()=>from[key2],enumerable:!(desc=__getOwnPropDesc(from,key2))||desc.enumerable});return to},__toESM=(mod,isNodeMode,target)=>(target=null!=mod?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:true}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod),__publicField=(obj,key2,value)=>__defNormalProp(obj,"symbol"!=typeof key2?key2+"":key2,value),__accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg),__privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),__privateMethod=(obj,member,method)=>(__accessCheck(obj,member,"access private method"),method),require_diff_match_patch=__commonJS({"node_modules/diff-match-patch/index.js"(exports,module2){var diff_match_patch4=function(){this.Diff_Timeout=1;this.Diff_EditCost=4;this.Match_Threshold=.5;this.Match_Distance=1e3;this.Patch_DeleteThreshold=.5;this.Patch_Margin=4;this.Match_MaxBits=32};diff_match_patch4.Diff=function(op,text2){return[op,text2]};diff_match_patch4.prototype.diff_main=function(text1,text2,opt_checklines,opt_deadline){if("undefined"==typeof opt_deadline)if(this.Diff_Timeout<=0)opt_deadline=Number.MAX_VALUE;else opt_deadline=(new Date).getTime()+1e3*this.Diff_Timeout;var deadline=opt_deadline;if(null==text1||null==text2)throw new Error("Null input. (diff_main)");if(text1==text2)if(text1)return[new diff_match_patch4.Diff(0,text1)];else return[];if("undefined"==typeof opt_checklines)opt_checklines=true;var checklines=opt_checklines,commonlength=this.diff_commonPrefix(text1,text2),commonprefix=text1.substring(0,commonlength);text1=text1.substring(commonlength);text2=text2.substring(commonlength);commonlength=this.diff_commonSuffix(text1,text2);var commonsuffix=text1.substring(text1.length-commonlength);text1=text1.substring(0,text1.length-commonlength);text2=text2.substring(0,text2.length-commonlength);var diffs=this.diff_compute_(text1,text2,checklines,deadline);if(commonprefix)diffs.unshift(new diff_match_patch4.Diff(0,commonprefix));if(commonsuffix)diffs.push(new diff_match_patch4.Diff(0,commonsuffix));this.diff_cleanupMerge(diffs);return diffs};diff_match_patch4.prototype.diff_compute_=function(text1,text2,checklines,deadline){var diffs;if(!text1)return[new diff_match_patch4.Diff(1,text2)];if(!text2)return[new diff_match_patch4.Diff(-1,text1)];var longtext=text1.length>text2.length?text1:text2,shorttext=text1.length>text2.length?text2:text1,i2=longtext.indexOf(shorttext);if(-1!=i2){diffs=[new diff_match_patch4.Diff(1,longtext.substring(0,i2)),new diff_match_patch4.Diff(0,shorttext),new diff_match_patch4.Diff(1,longtext.substring(i2+shorttext.length))];if(text1.length>text2.length)diffs[0][0]=diffs[2][0]=-1;return diffs}if(1==shorttext.length)return[new diff_match_patch4.Diff(-1,text1),new diff_match_patch4.Diff(1,text2)];var hm=this.diff_halfMatch_(text1,text2);if(hm){var text1_a=hm[0],text1_b=hm[1],text2_a=hm[2],text2_b=hm[3],mid_common=hm[4],diffs_a=this.diff_main(text1_a,text2_a,checklines,deadline),diffs_b=this.diff_main(text1_b,text2_b,checklines,deadline);return diffs_a.concat([new diff_match_patch4.Diff(0,mid_common)],diffs_b)}if(checklines&&text1.length>100&&text2.length>100)return this.diff_lineMode_(text1,text2,deadline);else return this.diff_bisect_(text1,text2,deadline)};diff_match_patch4.prototype.diff_lineMode_=function(text1,text2,deadline){var a2=this.diff_linesToChars_(text1,text2);text1=a2.chars1;text2=a2.chars2;var linearray=a2.lineArray,diffs=this.diff_main(text1,text2,false,deadline);this.diff_charsToLines_(diffs,linearray);this.diff_cleanupSemantic(diffs);diffs.push(new diff_match_patch4.Diff(0,""));for(var pointer=0,count_delete=0,count_insert=0,text_delete="",text_insert="";pointer=1&&count_insert>=1){diffs.splice(pointer-count_delete-count_insert,count_delete+count_insert);pointer=pointer-count_delete-count_insert;for(var subDiff=this.diff_main(text_delete,text_insert,false,deadline),j2=subDiff.length-1;j2>=0;j2--)diffs.splice(pointer,0,subDiff[j2]);pointer+=subDiff.length}count_insert=0;count_delete=0;text_delete="";text_insert="";break}pointer++}diffs.pop();return diffs};diff_match_patch4.prototype.diff_bisect_=function(text1,text2,deadline){for(var text1_length=text1.length,text2_length=text2.length,max_d=Math.ceil((text1_length+text2_length)/2),v_offset=max_d,v_length=2*max_d,v1=new Array(v_length),v2=new Array(v_length),x2=0;x2deadline);d4++){for(var k1=-d4+k1start;k1<=d4-k1end;k1+=2){var k1_offset=v_offset+k1;if(k1==-d4||k1!=d4&&v1[k1_offset-1]text1_length)k1end+=2;else if(y1>text2_length)k1start+=2;else if(front)if((k2_offset=v_offset+delta-k1)>=0&&k2_offset=(x22=text1_length-v2[k2_offset]))return this.diff_bisectSplit_(text1,text2,x1,y1,deadline)}for(var k2=-d4+k2start;k2<=d4-k2end;k2+=2){var x22,k2_offset=v_offset+k2;if(k2==-d4||k2!=d4&&v2[k2_offset-1]text1_length)k2end+=2;else if(y2>text2_length)k2start+=2;else if(!front)if((k1_offset=v_offset+delta-k2)>=0&&k1_offset=(x22=text1_length-x22))return this.diff_bisectSplit_(text1,text2,x1,y1,deadline)}}}return[new diff_match_patch4.Diff(-1,text1),new diff_match_patch4.Diff(1,text2)]};diff_match_patch4.prototype.diff_bisectSplit_=function(text1,text2,x2,y2,deadline){var text1a=text1.substring(0,x2),text2a=text2.substring(0,y2),text1b=text1.substring(x2),text2b=text2.substring(y2),diffs=this.diff_main(text1a,text2a,false,deadline),diffsb=this.diff_main(text1b,text2b,false,deadline);return diffs.concat(diffsb)};diff_match_patch4.prototype.diff_linesToChars_=function(text1,text2){var lineArray=[],lineHash={};lineArray[0]="";function diff_linesToCharsMunge_(text3){for(var chars="",lineStart=0,lineEnd=-1,lineArrayLength=lineArray.length;lineEndtext2_length)text1=text1.substring(text1_length-text2_length);else if(text1_lengthtext2.length?text1:text2,shorttext=text1.length>text2.length?text2:text1;if(longtext.length<4||2*shorttext.length=longtext2.length)return[best_longtext_a,best_longtext_b,best_shorttext_a,best_shorttext_b,best_common];else return null}var hm,text1_a,text1_b,text2_a,text2_b,hm1=diff_halfMatchI_(longtext,shorttext,Math.ceil(longtext.length/4)),hm2=diff_halfMatchI_(longtext,shorttext,Math.ceil(longtext.length/2));if(!hm1&&!hm2)return null;else if(!hm2)hm=hm1;else if(!hm1)hm=hm2;else hm=hm1[4].length>hm2[4].length?hm1:hm2;if(text1.length>text2.length){text1_a=hm[0];text1_b=hm[1];text2_a=hm[2];text2_b=hm[3]}else{text2_a=hm[0];text2_b=hm[1];text1_a=hm[2];text1_b=hm[3]}return[text1_a,text1_b,text2_a,text2_b,hm[4]]};diff_match_patch4.prototype.diff_cleanupSemantic=function(diffs){for(var changes3=false,equalities=[],equalitiesLength=0,lastEquality=null,pointer=0,length_insertions1=0,length_deletions1=0,length_insertions2=0,length_deletions2=0;pointer0?equalities[equalitiesLength-1]:-1;length_insertions1=0;length_deletions1=0;length_insertions2=0;length_deletions2=0;lastEquality=null;changes3=true}}pointer++}if(changes3)this.diff_cleanupMerge(diffs);this.diff_cleanupSemanticLossless(diffs);pointer=1;for(;pointer=overlap_length2){if(overlap_length1>=deletion.length/2||overlap_length1>=insertion.length/2){diffs.splice(pointer,0,new diff_match_patch4.Diff(0,insertion.substring(0,overlap_length1)));diffs[pointer-1][1]=deletion.substring(0,deletion.length-overlap_length1);diffs[pointer+1][1]=insertion.substring(overlap_length1);pointer++}}else if(overlap_length2>=deletion.length/2||overlap_length2>=insertion.length/2){diffs.splice(pointer,0,new diff_match_patch4.Diff(0,deletion.substring(0,overlap_length2)));diffs[pointer-1][0]=1;diffs[pointer-1][1]=insertion.substring(0,insertion.length-overlap_length2);diffs[pointer+1][0]=-1;diffs[pointer+1][1]=deletion.substring(overlap_length2);pointer++}pointer++}pointer++}};diff_match_patch4.prototype.diff_cleanupSemanticLossless=function(diffs){function diff_cleanupSemanticScore_(one,two){if(!one||!two)return 6;var char1=one.charAt(one.length-1),char2=two.charAt(0),nonAlphaNumeric1=char1.match(diff_match_patch4.nonAlphaNumericRegex_),nonAlphaNumeric2=char2.match(diff_match_patch4.nonAlphaNumericRegex_),whitespace1=nonAlphaNumeric1&&char1.match(diff_match_patch4.whitespaceRegex_),whitespace2=nonAlphaNumeric2&&char2.match(diff_match_patch4.whitespaceRegex_),lineBreak1=whitespace1&&char1.match(diff_match_patch4.linebreakRegex_),lineBreak2=whitespace2&&char2.match(diff_match_patch4.linebreakRegex_),blankLine1=lineBreak1&&one.match(diff_match_patch4.blanklineEndRegex_),blankLine2=lineBreak2&&two.match(diff_match_patch4.blanklineStartRegex_);if(blankLine1||blankLine2)return 5;else if(lineBreak1||lineBreak2)return 4;else if(nonAlphaNumeric1&&!whitespace1&&whitespace2)return 3;else if(whitespace1||whitespace2)return 2;else if(nonAlphaNumeric1||nonAlphaNumeric2)return 1;return 0}for(var pointer=1;pointer=bestScore){bestScore=score;bestEquality1=equality1;bestEdit=edit;bestEquality2=equality2}}if(diffs[pointer-1][1]!=bestEquality1){if(bestEquality1)diffs[pointer-1][1]=bestEquality1;else{diffs.splice(pointer-1,1);pointer--}diffs[pointer][1]=bestEdit;if(bestEquality2)diffs[pointer+1][1]=bestEquality2;else{diffs.splice(pointer+1,1);pointer--}}}pointer++}};diff_match_patch4.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;diff_match_patch4.whitespaceRegex_=/\s/;diff_match_patch4.linebreakRegex_=/[\r\n]/;diff_match_patch4.blanklineEndRegex_=/\n\r?\n$/;diff_match_patch4.blanklineStartRegex_=/^\r?\n\r?\n/;diff_match_patch4.prototype.diff_cleanupEfficiency=function(diffs){for(var changes3=false,equalities=[],equalitiesLength=0,lastEquality=null,pointer=0,pre_ins=false,pre_del=false,post_ins=false,post_del=false;pointer0?equalities[equalitiesLength-1]:-1;post_ins=post_del=false}changes3=true}}pointer++}if(changes3)this.diff_cleanupMerge(diffs)};diff_match_patch4.prototype.diff_cleanupMerge=function(diffs){diffs.push(new diff_match_patch4.Diff(0,""));for(var commonlength,pointer=0,count_delete=0,count_insert=0,text_delete="",text_insert="";pointer1){if(0!==count_delete&&0!==count_insert){if(0!==(commonlength=this.diff_commonPrefix(text_insert,text_delete))){if(pointer-count_delete-count_insert>0&&0==diffs[pointer-count_delete-count_insert-1][0])diffs[pointer-count_delete-count_insert-1][1]+=text_insert.substring(0,commonlength);else{diffs.splice(0,0,new diff_match_patch4.Diff(0,text_insert.substring(0,commonlength)));pointer++}text_insert=text_insert.substring(commonlength);text_delete=text_delete.substring(commonlength)}if(0!==(commonlength=this.diff_commonSuffix(text_insert,text_delete))){diffs[pointer][1]=text_insert.substring(text_insert.length-commonlength)+diffs[pointer][1];text_insert=text_insert.substring(0,text_insert.length-commonlength);text_delete=text_delete.substring(0,text_delete.length-commonlength)}}pointer-=count_delete+count_insert;diffs.splice(pointer,count_delete+count_insert);if(text_delete.length){diffs.splice(pointer,0,new diff_match_patch4.Diff(-1,text_delete));pointer++}if(text_insert.length){diffs.splice(pointer,0,new diff_match_patch4.Diff(1,text_insert));pointer++}pointer++}else if(0!==pointer&&0==diffs[pointer-1][0]){diffs[pointer-1][1]+=diffs[pointer][1];diffs.splice(pointer,1)}else pointer++;count_insert=0;count_delete=0;text_delete="";text_insert="";break}if(""===diffs[diffs.length-1][1])diffs.pop();var changes3=false;pointer=1;for(;pointerloc)break;last_chars1=chars1;last_chars2=chars2}if(diffs.length!=x2&&-1===diffs[x2][0])return last_chars2;else return last_chars2+(loc-last_chars1)};diff_match_patch4.prototype.diff_prettyHtml=function(diffs){for(var html=[],pattern_amp=/&/g,pattern_lt=//g,pattern_para=/\n/g,x2=0;x2");switch(op){case 1:html[x2]=''+text2+"";break;case-1:html[x2]=''+text2+"";break;case 0:html[x2]=""+text2+"";break}}return html.join("")};diff_match_patch4.prototype.diff_text1=function(diffs){for(var text2=[],x2=0;x2this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var s2=this.match_alphabet_(pattern),dmp=this;function match_bitapScore_(e4,x2){var accuracy=e4/pattern.length,proximity=Math.abs(loc-x2);if(!dmp.Match_Distance)return proximity?1:accuracy;else return accuracy+proximity/dmp.Match_Distance}var score_threshold=this.Match_Threshold,best_loc=text2.indexOf(pattern,loc);if(-1!=best_loc){score_threshold=Math.min(match_bitapScore_(0,best_loc),score_threshold);if(-1!=(best_loc=text2.lastIndexOf(pattern,loc+pattern.length)))score_threshold=Math.min(match_bitapScore_(0,best_loc),score_threshold)}var bin_min,bin_mid,matchmask=1<=start;j2--){var charMatch=s2[text2.charAt(j2-1)];if(0===d4)rd[j2]=(rd[j2+1]<<1|1)&charMatch;else rd[j2]=(rd[j2+1]<<1|1)&charMatch|(last_rd[j2+1]|last_rd[j2])<<1|1|last_rd[j2+1];if(rd[j2]&matchmask){var score=match_bitapScore_(d4,j2-1);if(score<=score_threshold){score_threshold=score;if((best_loc=j2-1)>loc)start=Math.max(1,2*loc-best_loc);else break}}}if(match_bitapScore_(d4+1,loc)>score_threshold)break;last_rd=rd}return best_loc};diff_match_patch4.prototype.match_alphabet_=function(pattern){for(var s2={},i2=0;i22){this.diff_cleanupSemantic(diffs);this.diff_cleanupEfficiency(diffs)}}else if(a2&&"object"==typeof a2&&"undefined"==typeof opt_b&&"undefined"==typeof opt_c){diffs=a2;text1=this.diff_text1(diffs)}else if("string"==typeof a2&&opt_b&&"object"==typeof opt_b&&"undefined"==typeof opt_c){text1=a2;diffs=opt_b}else if("string"==typeof a2&&"string"==typeof opt_b&&opt_c&&"object"==typeof opt_c){text1=a2;diffs=opt_c}else throw new Error("Unknown call format to patch_make.");if(0===diffs.length)return[];for(var patches=[],patch=new diff_match_patch4.patch_obj,patchDiffLength=0,char_count1=0,char_count2=0,prepatch_text=text1,postpatch_text=text1,x2=0;x2=2*this.Patch_Margin)if(patchDiffLength){this.patch_addContext_(patch,prepatch_text);patches.push(patch);patch=new diff_match_patch4.patch_obj;patchDiffLength=0;prepatch_text=postpatch_text;char_count1=char_count2}break}if(1!==diff_type)char_count1+=diff_text.length;if(-1!==diff_type)char_count2+=diff_text.length}if(patchDiffLength){this.patch_addContext_(patch,prepatch_text);patches.push(patch)}return patches};diff_match_patch4.prototype.patch_deepCopy=function(patches){for(var patchesCopy=[],x2=0;x2this.Match_MaxBits){if(-1!=(start_loc=this.match_main(text2,text1.substring(0,this.Match_MaxBits),expected_loc)))if(-1==(end_loc=this.match_main(text2,text1.substring(text1.length-this.Match_MaxBits),expected_loc+text1.length-this.Match_MaxBits))||start_loc>=end_loc)start_loc=-1}else start_loc=this.match_main(text2,text1,expected_loc);if(-1==start_loc){results[x2]=false;delta-=patches[x2].length2-patches[x2].length1}else{results[x2]=true;delta=start_loc-expected_loc;var text22;if(-1==end_loc)text22=text2.substring(start_loc,start_loc+text1.length);else text22=text2.substring(start_loc,end_loc+this.Match_MaxBits);if(text1==text22)text2=text2.substring(0,start_loc)+this.diff_text2(patches[x2].diffs)+text2.substring(start_loc+text1.length);else{var diffs=this.diff_main(text1,text22,false);if(text1.length>this.Match_MaxBits&&this.diff_levenshtein(diffs)/text1.length>this.Patch_DeleteThreshold)results[x2]=false;else{this.diff_cleanupSemanticLossless(diffs);for(var index22,index1=0,y2=0;y2diffs[0][1].length){var extraLength=paddingLength-diffs[0][1].length;diffs[0][1]=nullPadding.substring(diffs[0][1].length)+diffs[0][1];patch.start1-=extraLength;patch.start2-=extraLength;patch.length1+=extraLength;patch.length2+=extraLength}if(0==(diffs=(patch=patches[patches.length-1]).diffs).length||0!=diffs[diffs.length-1][0]){diffs.push(new diff_match_patch4.Diff(0,nullPadding));patch.length1+=paddingLength;patch.length2+=paddingLength}else if(paddingLength>diffs[diffs.length-1][1].length){extraLength=paddingLength-diffs[diffs.length-1][1].length;diffs[diffs.length-1][1]+=nullPadding.substring(0,extraLength);patch.length1+=extraLength;patch.length2+=extraLength}return nullPadding};diff_match_patch4.prototype.patch_splitMax=function(patches){for(var patch_size=this.Match_MaxBits,x2=0;x22*patch_size){patch.length1+=diff_text.length;start1+=diff_text.length;empty2=false;patch.diffs.push(new diff_match_patch4.Diff(diff_type,diff_text));bigpatch.diffs.shift()}else{diff_text=diff_text.substring(0,patch_size-patch.length1-this.Patch_Margin);patch.length1+=diff_text.length;start1+=diff_text.length;if(0===diff_type){patch.length2+=diff_text.length;start2+=diff_text.length}else empty2=false;patch.diffs.push(new diff_match_patch4.Diff(diff_type,diff_text));if(diff_text==bigpatch.diffs[0][1])bigpatch.diffs.shift();else bigpatch.diffs[0][1]=bigpatch.diffs[0][1].substring(diff_text.length)}}precontext=(precontext=this.diff_text2(patch.diffs)).substring(precontext.length-this.Patch_Margin);var postcontext=this.diff_text1(bigpatch.diffs).substring(0,this.Patch_Margin);if(""!==postcontext){patch.length1+=postcontext.length;patch.length2+=postcontext.length;if(0!==patch.diffs.length&&0===patch.diffs[patch.diffs.length-1][0])patch.diffs[patch.diffs.length-1][1]+=postcontext;else patch.diffs.push(new diff_match_patch4.Diff(0,postcontext))}if(!empty2)patches.splice(++x2,0,patch)}}};diff_match_patch4.prototype.patch_toText=function(patches){for(var text2=[],x2=0;x2=0&&bi2>0){if(a2===b3)return[ai2,bi2];begs=[];left=str.length;for(;i2>=0&&!result;){if(i2==ai2){begs.push(i2);ai2=str.indexOf(a2,i2+1)}else if(1==begs.length)result=[begs.pop(),bi2];else{if((beg=begs.pop())=0?ai2:bi2}if(begs.length)result=[left,right]}return result}}}),require_brace_expansion=__commonJS({"node_modules/brace-expansion/index.js"(exports,module2){var balanced=require_balanced_match();module2.exports=function expandTop(str){if(!str)return[];if("{}"===str.substr(0,2))str="\\{\\}"+str.substr(2);return expand2(function escapeBraces(str){return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod)}(str),true).map(unescapeBraces)};var escSlash="\0SLASH"+Math.random()+"\0",escOpen="\0OPEN"+Math.random()+"\0",escClose="\0CLOSE"+Math.random()+"\0",escComma="\0COMMA"+Math.random()+"\0",escPeriod="\0PERIOD"+Math.random()+"\0";function numeric(str){return parseInt(str,10)==str?parseInt(str,10):str.charCodeAt(0)}function unescapeBraces(str){return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".")}function parseCommaParts(str){if(!str)return[""];var parts=[],m2=balanced("{","}",str);if(!m2)return str.split(",");var pre=m2.pre,body=m2.body,post=m2.post,p2=pre.split(",");p2[p2.length-1]+="{"+body+"}";var postParts=parseCommaParts(post);if(post.length){p2[p2.length-1]+=postParts.shift();p2.push.apply(p2,postParts)}parts.push.apply(parts,p2);return parts}function embrace(str){return"{"+str+"}"}function isPadded(el){return/^-?0\d/.test(el)}function lte(i2,y2){return i2<=y2}function gte(i2,y2){return i2>=y2}function expand2(str,isTop){var expansions=[],m2=balanced("{","}",str);if(!m2)return[str];var pre=m2.pre,post=m2.post.length?expand2(m2.post,false):[""];if(/\$$/.test(m2.pre))for(var k2=0;k2=0;if(!isSequence&&!isOptions)if(m2.post.match(/,.*\}/))return expand2(str=m2.pre+"{"+m2.body+escClose+m2.post);else return[str];if(isSequence)n3=m2.body.split(/\.\./);else if(1===(n3=parseCommaParts(m2.body)).length)if(1===(n3=expand2(n3[0],false).map(embrace)).length)return post.map((function(p2){return m2.pre+n3[0]+p2}));if(isSequence){var x2=numeric(n3[0]),y2=numeric(n3[1]),width=Math.max(n3[0].length,n3[1].length),incr=3==n3.length?Math.abs(numeric(n3[2])):1,test=lte;if(y20){var z2=new Array(need+1).join("0");if(i2<0)c2="-"+z2+c2.slice(1);else c2=z2+c2}}}N2.push(c2)}}else{N2=[];for(var j2=0;j2"!==xmlData[i2]&&" "!==xmlData[i2]&&"\t"!==xmlData[i2]&&"\n"!==xmlData[i2]&&"\r"!==xmlData[i2];i2++)tagName+=xmlData[i2];tagName=tagName.trim();if("/"===tagName[tagName.length-1]){tagName=tagName.substring(0,tagName.length-1);i2--}if(!(tagname=tagName,util.isName(tagname))){let msg;if(0===tagName.trim().length)msg="Invalid space after '<'.";else msg="Tag '"+tagName+"' is an invalid name.";return getErrorObject("InvalidTag",msg,getLineNumberForPosition(xmlData,i2))}const result=readAttributeStr(xmlData,i2);if(false===result)return getErrorObject("InvalidAttr","Attributes for '"+tagName+"' have open quote.",getLineNumberForPosition(xmlData,i2));let attrStr=result.value;i2=result.index;if("/"===attrStr[attrStr.length-1]){const attrStrStart=i2-attrStr.length;attrStr=attrStr.substring(0,attrStr.length-1);const isValid=validateAttributeString(attrStr,options);if(true===isValid)tagFound=true;else return getErrorObject(isValid.err.code,isValid.err.msg,getLineNumberForPosition(xmlData,attrStrStart+isValid.err.line))}else if(closingTag)if(!result.tagClosed)return getErrorObject("InvalidTag","Closing tag '"+tagName+"' doesn't have proper closing.",getLineNumberForPosition(xmlData,i2));else if(attrStr.trim().length>0)return getErrorObject("InvalidTag","Closing tag '"+tagName+"' can't have attributes or invalid starting.",getLineNumberForPosition(xmlData,tagStartPos));else if(0===tags.length)return getErrorObject("InvalidTag","Closing tag '"+tagName+"' has not been opened.",getLineNumberForPosition(xmlData,tagStartPos));else{const otg=tags.pop();if(tagName!==otg.tagName){let openPos=getLineNumberForPosition(xmlData,otg.tagStartPos);return getErrorObject("InvalidTag","Expected closing tag '"+otg.tagName+"' (opened in line "+openPos.line+", col "+openPos.col+") instead of closing tag '"+tagName+"'.",getLineNumberForPosition(xmlData,tagStartPos))}if(0==tags.length)reachedRoot=true}else{const isValid=validateAttributeString(attrStr,options);if(true!==isValid)return getErrorObject(isValid.err.code,isValid.err.msg,getLineNumberForPosition(xmlData,i2-attrStr.length+isValid.err.line));if(true===reachedRoot)return getErrorObject("InvalidXml","Multiple possible root nodes found.",getLineNumberForPosition(xmlData,i2));else if(-1!==options.unpairedTags.indexOf(tagName));else tags.push({tagName,tagStartPos});tagFound=true}for(i2++;i20)return getErrorObject("InvalidXml","Invalid '"+JSON.stringify(tags.map((t4=>t4.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1});return true};function isWhiteSpace(char){return" "===char||"\t"===char||"\n"===char||"\r"===char}function readPI(xmlData,i2){const start=i2;for(;i25&&"xml"===tagname)return getErrorObject("InvalidXml","XML declaration allowed only at the start of the document.",getLineNumberForPosition(xmlData,i2));else if("?"==xmlData[i2]&&">"==xmlData[i2+1]){i2++;break}else continue}return i2}function readCommentAndCDATA(xmlData,i2){if(xmlData.length>i2+5&&"-"===xmlData[i2+1]&&"-"===xmlData[i2+2]){for(i2+=3;i2"===xmlData[i2+2]){i2+=2;break}}else if(xmlData.length>i2+8&&"D"===xmlData[i2+1]&&"O"===xmlData[i2+2]&&"C"===xmlData[i2+3]&&"T"===xmlData[i2+4]&&"Y"===xmlData[i2+5]&&"P"===xmlData[i2+6]&&"E"===xmlData[i2+7]){let angleBracketsCount=1;for(i2+=8;i2"===xmlData[i2]){angleBracketsCount--;if(0===angleBracketsCount)break}}else if(xmlData.length>i2+9&&"["===xmlData[i2+1]&&"C"===xmlData[i2+2]&&"D"===xmlData[i2+3]&&"A"===xmlData[i2+4]&&"T"===xmlData[i2+5]&&"A"===xmlData[i2+6]&&"["===xmlData[i2+7])for(i2+=8;i2"===xmlData[i2+2]){i2+=2;break}return i2}function readAttributeStr(xmlData,i2){let attrStr="",startChar="",tagClosed=false;for(;i2"===xmlData[i2])if(""===startChar){tagClosed=true;break}attrStr+=xmlData[i2]}if(""!==startChar)return false;else return{value:attrStr,index:i2,tagClosed}}var validAttrStrRegxp=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function validateAttributeString(attrStr,options){const matches=util.getAllMatches(attrStr,validAttrStrRegxp),attrNames={};for(let i2=0;i2false,commentPropName:false,unpairedTags:[],processEntities:true,htmlEntities:false,ignoreDeclaration:false,ignorePiTags:false,transformTagName:false,transformAttributeName:false,updateTag:function(tagName,jPath,attrs){return tagName}};exports.buildOptions=function(options){return Object.assign({},defaultOptions,options)};exports.defaultOptions=defaultOptions}}),require_xmlNode=__commonJS({"node_modules/fast-xml-parser/src/xmlparser/xmlNode.js"(exports,module2){"use strict";module2.exports=class{constructor(tagname){this.tagname=tagname;this.child=[];this[":@"]={}}add(key2,val2){if("__proto__"===key2)key2="#__proto__";this.child.push({[key2]:val2})}addChild(node){if("__proto__"===node.tagname)node.tagname="#__proto__";if(node[":@"]&&Object.keys(node[":@"]).length>0)this.child.push({[node.tagname]:node.child,[":@"]:node[":@"]});else this.child.push({[node.tagname]:node.child})}}}}),require_DocTypeReader=__commonJS({"node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js"(exports,module2){var util=require_util();function readEntityExp(xmlData,i2){let entityName2="";for(;i2"===xmlData[i2]){if(comment2){if("-"===xmlData[i2-1]&&"-"===xmlData[i2-2]){comment2=false;angleBracketsCount--}}else angleBracketsCount--;if(0===angleBracketsCount)break}else if("["===xmlData[i2])hasBody=true;else exp+=xmlData[i2];if(0!==angleBracketsCount)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities,i:i2}}}}),require_strnum=__commonJS({"node_modules/strnum/strnum.js"(exports,module2){var hexRegex=/^[-+]?0x[a-fA-F0-9]+$/,numRegex=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;if(!Number.parseInt&&window.parseInt)Number.parseInt=window.parseInt;if(!Number.parseFloat&&window.parseFloat)Number.parseFloat=window.parseFloat;var consider={hex:true,leadingZeros:true,decimalPoint:".",eNotation:true};module2.exports=function toNumber(str,options={}){options=Object.assign({},consider,options);if(!str||"string"!=typeof str)return str;let trimmedStr=str.trim();if(void 0!==options.skipLike&&options.skipLike.test(trimmedStr))return str;else if(options.hex&&hexRegex.test(trimmedStr))return Number.parseInt(trimmedStr,16);else{const match3=numRegex.exec(trimmedStr);if(match3){const sign=match3[1],leadingZeros=match3[2];let numTrimmedByZeros=function trimZeros(numStr){if(numStr&&-1!==numStr.indexOf(".")){if("."===(numStr=numStr.replace(/0+$/,"")))numStr="0";else if("."===numStr[0])numStr="0"+numStr;else if("."===numStr[numStr.length-1])numStr=numStr.substr(0,numStr.length-1);return numStr}return numStr}(match3[3]);const eNotation=match3[4]||match3[6];if(!options.leadingZeros&&leadingZeros.length>0&&sign&&"."!==trimmedStr[2])return str;else if(!options.leadingZeros&&leadingZeros.length>0&&!sign&&"."!==trimmedStr[1])return str;else{const num=Number(trimmedStr),numStr=""+num;if(-1!==numStr.search(/[eE]/))if(options.eNotation)return num;else return str;else if(eNotation)if(options.eNotation)return num;else return str;else if(-1!==trimmedStr.indexOf("."))if("0"===numStr&&""===numTrimmedByZeros)return num;else if(numStr===numTrimmedByZeros)return num;else if(sign&&numStr==="-"+numTrimmedByZeros)return num;else return str;if(leadingZeros)if(numTrimmedByZeros===numStr)return num;else if(sign+numTrimmedByZeros===numStr)return num;else return str;if(trimmedStr===numStr)return num;else if(trimmedStr===sign+numStr)return num;return str}}else return str}}}}),require_OrderedObjParser=__commonJS({"node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js"(exports,module2){"use strict";var util=require_util(),xmlNode=require_xmlNode(),readDocType=require_DocTypeReader(),toNumber=require_strnum();function addExternalEntities(externalEntities){const entKeys=Object.keys(externalEntities);for(let i2=0;i20){if(!escapeEntities)val2=this.replaceEntitiesValue(val2);const newval=this.options.tagValueProcessor(tagName,val2,jPath,hasAttributes,isLeafNode);if(null==newval)return val2;else if(typeof newval!=typeof val2||newval!==val2)return newval;else if(this.options.trimValues)return parseValue(val2,this.options.parseTagValue,this.options.numberParseOptions);else if(val2.trim()===val2)return parseValue(val2,this.options.parseTagValue,this.options.numberParseOptions);else return val2}}}function resolveNameSpace(tagname){if(this.options.removeNSPrefix){const tags=tagname.split(":"),prefix="/"===tagname.charAt(0)?"/":"";if("xmlns"===tags[0])return"";if(2===tags.length)tagname=prefix+tags[1]}return tagname}var attrsRegx=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function buildAttributesMap(attrStr,jPath,tagName){if(!this.options.ignoreAttributes&&"string"==typeof attrStr){const matches=util.getAllMatches(attrStr,attrsRegx),len=matches.length,attrs={};for(let i2=0;i2",i2,"Closing Tag is not closed.");let tagName=xmlData.substring(i2+2,closeIndex).trim();if(this.options.removeNSPrefix){const colonIndex=tagName.indexOf(":");if(-1!==colonIndex)tagName=tagName.substr(colonIndex+1)}if(this.options.transformTagName)tagName=this.options.transformTagName(tagName);if(currentNode)textData=this.saveTextToParentTag(textData,currentNode,jPath);const lastTagName=jPath.substring(jPath.lastIndexOf(".")+1);if(tagName&&-1!==this.options.unpairedTags.indexOf(tagName))throw new Error(`Unpaired tag can not be used as closing tag: `);let propIndex=0;if(lastTagName&&-1!==this.options.unpairedTags.indexOf(lastTagName)){propIndex=jPath.lastIndexOf(".",jPath.lastIndexOf(".")-1);this.tagsNodeStack.pop()}else propIndex=jPath.lastIndexOf(".");jPath=jPath.substring(0,propIndex);currentNode=this.tagsNodeStack.pop();textData="";i2=closeIndex}else if("?"===xmlData[i2+1]){let tagData=readTagExp(xmlData,i2,false,"?>");if(!tagData)throw new Error("Pi Tag is not closed.");textData=this.saveTextToParentTag(textData,currentNode,jPath);if(this.options.ignoreDeclaration&&"?xml"===tagData.tagName||this.options.ignorePiTags);else{const childNode=new xmlNode(tagData.tagName);childNode.add(this.options.textNodeName,"");if(tagData.tagName!==tagData.tagExp&&tagData.attrExpPresent)childNode[":@"]=this.buildAttributesMap(tagData.tagExp,jPath,tagData.tagName);this.addChild(currentNode,childNode,jPath)}i2=tagData.closeIndex+1}else if("!--"===xmlData.substr(i2+1,3)){const endIndex=findClosingIndex(xmlData,"--\x3e",i2+4,"Comment is not closed.");if(this.options.commentPropName){const comment2=xmlData.substring(i2+4,endIndex-2);textData=this.saveTextToParentTag(textData,currentNode,jPath);currentNode.add(this.options.commentPropName,[{[this.options.textNodeName]:comment2}])}i2=endIndex}else if("!D"===xmlData.substr(i2+1,2)){const result=readDocType(xmlData,i2);this.docTypeEntities=result.entities;i2=result.i}else if("!["===xmlData.substr(i2+1,2)){const closeIndex=findClosingIndex(xmlData,"]]>",i2,"CDATA is not closed.")-2,tagExp=xmlData.substring(i2+9,closeIndex);textData=this.saveTextToParentTag(textData,currentNode,jPath);let val2=this.parseTextData(tagExp,currentNode.tagname,jPath,true,false,true,true);if(null==val2)val2="";if(this.options.cdataPropName)currentNode.add(this.options.cdataPropName,[{[this.options.textNodeName]:tagExp}]);else currentNode.add(this.options.textNodeName,val2);i2=closeIndex+2}else{let result=readTagExp(xmlData,i2,this.options.removeNSPrefix),tagName=result.tagName;const rawTagName=result.rawTagName;let tagExp=result.tagExp,attrExpPresent=result.attrExpPresent,closeIndex=result.closeIndex;if(this.options.transformTagName)tagName=this.options.transformTagName(tagName);if(currentNode&&textData)if("!xml"!==currentNode.tagname)textData=this.saveTextToParentTag(textData,currentNode,jPath,false);const lastTag=currentNode;if(lastTag&&-1!==this.options.unpairedTags.indexOf(lastTag.tagname)){currentNode=this.tagsNodeStack.pop();jPath=jPath.substring(0,jPath.lastIndexOf("."))}if(tagName!==xmlObj.tagname)jPath+=jPath?"."+tagName:tagName;if(this.isItStopNode(this.options.stopNodes,jPath,tagName)){let tagContent="";if(tagExp.length>0&&tagExp.lastIndexOf("/")===tagExp.length-1){if("/"===tagName[tagName.length-1]){tagName=tagName.substr(0,tagName.length-1);jPath=jPath.substr(0,jPath.length-1);tagExp=tagName}else tagExp=tagExp.substr(0,tagExp.length-1);i2=result.closeIndex}else if(-1!==this.options.unpairedTags.indexOf(tagName))i2=result.closeIndex;else{const result2=this.readStopNodeData(xmlData,rawTagName,closeIndex+1);if(!result2)throw new Error(`Unexpected end of ${rawTagName}`);i2=result2.i;tagContent=result2.tagContent}const childNode=new xmlNode(tagName);if(tagName!==tagExp&&attrExpPresent)childNode[":@"]=this.buildAttributesMap(tagExp,jPath,tagName);if(tagContent)tagContent=this.parseTextData(tagContent,tagName,jPath,true,attrExpPresent,true,true);jPath=jPath.substr(0,jPath.lastIndexOf("."));childNode.add(this.options.textNodeName,tagContent);this.addChild(currentNode,childNode,jPath)}else{if(tagExp.length>0&&tagExp.lastIndexOf("/")===tagExp.length-1){if("/"===tagName[tagName.length-1]){tagName=tagName.substr(0,tagName.length-1);jPath=jPath.substr(0,jPath.length-1);tagExp=tagName}else tagExp=tagExp.substr(0,tagExp.length-1);if(this.options.transformTagName)tagName=this.options.transformTagName(tagName);const childNode=new xmlNode(tagName);if(tagName!==tagExp&&attrExpPresent)childNode[":@"]=this.buildAttributesMap(tagExp,jPath,tagName);this.addChild(currentNode,childNode,jPath);jPath=jPath.substr(0,jPath.lastIndexOf("."))}else{const childNode=new xmlNode(tagName);this.tagsNodeStack.push(currentNode);if(tagName!==tagExp&&attrExpPresent)childNode[":@"]=this.buildAttributesMap(tagExp,jPath,tagName);this.addChild(currentNode,childNode,jPath);currentNode=childNode}textData="";i2=closeIndex}}else textData+=xmlData[i2];return xmlObj.child};function addChild(currentNode,childNode,jPath){const result=this.options.updateTag(childNode.tagname,jPath,childNode[":@"]);if(false===result);else if("string"==typeof result){childNode.tagname=result;currentNode.addChild(childNode)}else currentNode.addChild(childNode)}var replaceEntitiesValue=function(val2){if(this.options.processEntities){for(let entityName2 in this.docTypeEntities){const entity=this.docTypeEntities[entityName2];val2=val2.replace(entity.regx,entity.val)}for(let entityName2 in this.lastEntities){const entity=this.lastEntities[entityName2];val2=val2.replace(entity.regex,entity.val)}if(this.options.htmlEntities)for(let entityName2 in this.htmlEntities){const entity=this.htmlEntities[entityName2];val2=val2.replace(entity.regex,entity.val)}val2=val2.replace(this.ampEntity.regex,this.ampEntity.val)}return val2};function saveTextToParentTag(textData,currentNode,jPath,isLeafNode){if(textData){if(void 0===isLeafNode)isLeafNode=0===Object.keys(currentNode.child).length;if(void 0!==(textData=this.parseTextData(textData,currentNode.tagname,jPath,false,currentNode[":@"]?0!==Object.keys(currentNode[":@"]).length:false,isLeafNode))&&""!==textData)currentNode.add(this.options.textNodeName,textData);textData=""}return textData}function isItStopNode(stopNodes,jPath,currentTagName){const allNodesExp="*."+currentTagName;for(const stopNodePath in stopNodes){const stopNodeExp=stopNodes[stopNodePath];if(allNodesExp===stopNodeExp||jPath===stopNodeExp)return true}return false}function findClosingIndex(xmlData,str,i2,errMsg){const closingIndex=xmlData.indexOf(str,i2);if(-1===closingIndex)throw new Error(errMsg);else return closingIndex+str.length-1}function readTagExp(xmlData,i2,removeNSPrefix,closingChar=">"){const result=function tagExpWithClosingIndex(xmlData,i2,closingChar=">"){let attrBoundary,tagExp="";for(let index5=i2;index5",i2,`${tagName} is not closed`);if(xmlData.substring(i2+2,closeIndex).trim()===tagName){openTagCount--;if(0===openTagCount)return{tagContent:xmlData.substring(startIndex,i2),i:closeIndex}}i2=closeIndex}else if("?"===xmlData[i2+1])i2=findClosingIndex(xmlData,"?>",i2+1,"StopNode is not closed.");else if("!--"===xmlData.substr(i2+1,3))i2=findClosingIndex(xmlData,"--\x3e",i2+3,"StopNode is not closed.");else if("!["===xmlData.substr(i2+1,2))i2=findClosingIndex(xmlData,"]]>",i2,"StopNode is not closed.")-2;else{const tagData=readTagExp(xmlData,i2,">");if(tagData){if((tagData&&tagData.tagName)===tagName&&"/"!==tagData.tagExp[tagData.tagExp.length-1])openTagCount++;i2=tagData.closeIndex}}}function parseValue(val2,shouldParse,options){if(shouldParse&&"string"==typeof val2){const newval=val2.trim();if("true"===newval)return true;else if("false"===newval)return false;else return toNumber(val2,options)}else if(util.isExist(val2))return val2;else return""}module2.exports=class{constructor(options){this.options=options;this.currentNode=null;this.tagsNodeStack=[];this.docTypeEntities={};this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}};this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"};this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(_,str)=>String.fromCharCode(Number.parseInt(str,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(_,str)=>String.fromCharCode(Number.parseInt(str,16))}};this.addExternalEntities=addExternalEntities;this.parseXml=parseXml;this.parseTextData=parseTextData;this.resolveNameSpace=resolveNameSpace;this.buildAttributesMap=buildAttributesMap;this.isItStopNode=isItStopNode;this.replaceEntitiesValue=replaceEntitiesValue;this.readStopNodeData=readStopNodeData;this.saveTextToParentTag=saveTextToParentTag;this.addChild=addChild}}}}),require_node2json=__commonJS({"node_modules/fast-xml-parser/src/xmlparser/node2json.js"(exports){"use strict";function compress(arr,options,jPath){let text2;const compressedObj={};for(let i2=0;i20)compressedObj[options.textNodeName]=text2}else if(void 0!==text2)compressedObj[options.textNodeName]=text2;return compressedObj}function propName(obj){const keys2=Object.keys(obj);for(let i2=0;i2`;isPreviousElementTag=false;continue}else if(tagName===options.commentPropName){xmlStr+=indentation+`\x3c!--${tagObj[tagName][0][options.textNodeName]}--\x3e`;isPreviousElementTag=true;continue}else if("?"===tagName[0]){const attStr2=attr_to_str(tagObj[":@"],options),tempInd="?xml"===tagName?"":indentation;let piTextNodeName=tagObj[tagName][0][options.textNodeName];piTextNodeName=0!==piTextNodeName.length?" "+piTextNodeName:"";xmlStr+=tempInd+`<${tagName}${piTextNodeName}${attStr2}?>`;isPreviousElementTag=true;continue}let newIdentation=indentation;if(""!==newIdentation)newIdentation+=options.indentBy;const tagStart=indentation+`<${tagName}${attr_to_str(tagObj[":@"],options)}`,tagValue=arrToStr(tagObj[tagName],options,newJPath,newIdentation);if(-1!==options.unpairedTags.indexOf(tagName))if(options.suppressUnpairedNode)xmlStr+=tagStart+">";else xmlStr+=tagStart+"/>";else if((!tagValue||0===tagValue.length)&&options.suppressEmptyNode)xmlStr+=tagStart+"/>";else if(tagValue&&tagValue.endsWith(">"))xmlStr+=tagStart+`>${tagValue}${indentation}`;else{xmlStr+=tagStart+">";if(tagValue&&""!==indentation&&(tagValue.includes("/>")||tagValue.includes("`}isPreviousElementTag=true}return xmlStr}function propName(obj){const keys2=Object.keys(obj);for(let i2=0;i20&&options.processEntities)for(let i2=0;i20)indentation="\n";return arrToStr(jArray,options,"",indentation)}}}),require_json2xml=__commonJS({"node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js"(exports,module2){"use strict";var buildFromOrderedJs=require_orderedJs2Xml(),defaultOptions={attributeNamePrefix:"@_",attributesGroupName:false,textNodeName:"#text",ignoreAttributes:true,cdataPropName:false,format:false,indentBy:" ",suppressEmptyNode:false,suppressUnpairedNode:true,suppressBooleanAttributes:true,tagValueProcessor:function(key2,a2){return a2},attributeValueProcessor:function(attrName,a2){return a2},preserveOrder:false,commentPropName:false,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:true,stopNodes:[],oneListGroup:false};function Builder(options){this.options=Object.assign({},defaultOptions,options);if(this.options.ignoreAttributes||this.options.attributesGroupName)this.isAttribute=function(){return false};else{this.attrPrefixLen=this.options.attributeNamePrefix.length;this.isAttribute=isAttribute}this.processTextOrObjNode=processTextOrObjNode;if(this.options.format){this.indentate=indentate;this.tagEndChar=">\n";this.newLine="\n"}else{this.indentate=function(){return""};this.tagEndChar=">";this.newLine=""}}Builder.prototype.build=function(jObj){if(this.options.preserveOrder)return buildFromOrderedJs(jObj,this.options);else{if(Array.isArray(jObj)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1)jObj={[this.options.arrayNodeName]:jObj};return this.j2x(jObj,0).val}};Builder.prototype.j2x=function(jObj,level){let attrStr="",val2="";for(let key2 in jObj)if(Object.prototype.hasOwnProperty.call(jObj,key2))if("undefined"==typeof jObj[key2]){if(this.isAttribute(key2))val2+=""}else if(null===jObj[key2])if(this.isAttribute(key2))val2+="";else if("?"===key2[0])val2+=this.indentate(level)+"<"+key2+"?"+this.tagEndChar;else val2+=this.indentate(level)+"<"+key2+"/"+this.tagEndChar;else if(jObj[key2]instanceof Date)val2+=this.buildTextValNode(jObj[key2],key2,"",level);else if("object"!=typeof jObj[key2]){const attr2=this.isAttribute(key2);if(attr2)attrStr+=this.buildAttrPairStr(attr2,""+jObj[key2]);else if(key2===this.options.textNodeName){let newval=this.options.tagValueProcessor(key2,""+jObj[key2]);val2+=this.replaceEntitiesValue(newval)}else val2+=this.buildTextValNode(jObj[key2],key2,"",level)}else if(Array.isArray(jObj[key2])){const arrLen=jObj[key2].length;let listTagVal="",listTagAttr="";for(let j2=0;j2"+val2+tagEndExp;else if(false!==this.options.commentPropName&&key2===this.options.commentPropName&&0===piClosingChar.length)return this.indentate(level)+`\x3c!--${val2}--\x3e`+this.newLine;else return this.indentate(level)+"<"+key2+attrStr+piClosingChar+this.tagEndChar+val2+this.indentate(level)+tagEndExp}};Builder.prototype.closeTag=function(key2){let closeTag="";if(-1!==this.options.unpairedTags.indexOf(key2)){if(!this.options.suppressUnpairedNode)closeTag="/"}else if(this.options.suppressEmptyNode)closeTag="/";else closeTag=`>`+this.newLine;else if(false!==this.options.commentPropName&&key2===this.options.commentPropName)return this.indentate(level)+`\x3c!--${val2}--\x3e`+this.newLine;else if("?"===key2[0])return this.indentate(level)+"<"+key2+attrStr+"?"+this.tagEndChar;else{let textValue=this.options.tagValueProcessor(key2,val2);textValue=this.replaceEntitiesValue(textValue);if(""===textValue)return this.indentate(level)+"<"+key2+attrStr+this.closeTag(key2)+this.tagEndChar;else return this.indentate(level)+"<"+key2+attrStr+">"+textValue+"0&&this.options.processEntities)for(let i2=0;i20&&r3[1]||""},e5.getSecondMatch=function(e6,t5){var r3=t5.match(e6);return r3&&r3.length>1&&r3[2]||""},e5.matchAndReturnConst=function(e6,t5,r3){if(e6.test(t5))return r3},e5.getWindowsVersionName=function(e6){switch(e6){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e5.getMacOSVersionName=function(e6){var t5=e6.split(".").splice(0,2).map((function(e7){return parseInt(e7,10)||0}));if(t5.push(0),10===t5[0])switch(t5[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e5.getAndroidVersionName=function(e6){var t5=e6.split(".").splice(0,2).map((function(e7){return parseInt(e7,10)||0}));if(t5.push(0),!(1===t5[0]&&t5[1]<5))return 1===t5[0]&&t5[1]<6?"Cupcake":1===t5[0]&&t5[1]>=6?"Donut":2===t5[0]&&t5[1]<2?"Eclair":2===t5[0]&&2===t5[1]?"Froyo":2===t5[0]&&t5[1]>2?"Gingerbread":3===t5[0]?"Honeycomb":4===t5[0]&&t5[1]<1?"Ice Cream Sandwich":4===t5[0]&&t5[1]<4?"Jelly Bean":4===t5[0]&&t5[1]>=4?"KitKat":5===t5[0]?"Lollipop":6===t5[0]?"Marshmallow":7===t5[0]?"Nougat":8===t5[0]?"Oreo":9===t5[0]?"Pie":void 0},e5.getVersionPrecision=function(e6){return e6.split(".").length},e5.compareVersions=function(t5,r3,n4){void 0===n4&&(n4=false);var i3=e5.getVersionPrecision(t5),s2=e5.getVersionPrecision(r3),a2=Math.max(i3,s2),o2=0,u2=e5.map([t5,r3],(function(t6){var r4=a2-e5.getVersionPrecision(t6),n5=t6+new Array(r4+1).join(".0");return e5.map(n5.split("."),(function(e6){return new Array(20-e6.length).join("0")+e6})).reverse()}));for(n4&&(o2=a2-Math.min(i3,s2)),a2-=1;a2>=o2;){if(u2[0][a2]>u2[1][a2])return 1;if(u2[0][a2]===u2[1][a2]){if(a2===o2)return 0;a2-=1}else if(u2[0][a2]1?i3-1:0),a2=1;a20){var a3=Object.keys(r3),u3=o2.default.find(a3,(function(e7){return t6.isOS(e7)}));if(u3){var d5=this.satisfies(r3[u3]);if(void 0!==d5)return d5}var c2=o2.default.find(a3,(function(e7){return t6.isPlatform(e7)}));if(c2){var f4=this.satisfies(r3[c2]);if(void 0!==f4)return f4}}if(s3>0){var l2=Object.keys(i3),h3=o2.default.find(l2,(function(e7){return t6.isBrowser(e7,true)}));if(void 0!==h3)return this.compareVersion(i3[h3])}},t5.isBrowser=function(e6,t6){void 0===t6&&(t6=false);var r3=this.getBrowserName().toLowerCase(),n4=e6.toLowerCase(),i3=o2.default.getBrowserTypeByAlias(n4);return t6&&i3&&(n4=i3.toLowerCase()),n4===r3},t5.compareVersion=function(e6){var t6=[0],r3=e6,n4=false,i3=this.getBrowserVersion();if("string"==typeof i3)return">"===e6[0]||"<"===e6[0]?(r3=e6.substr(1),"="===e6[1]?(n4=true,r3=e6.substr(2)):t6=[],">"===e6[0]?t6.push(1):t6.push(-1)):"="===e6[0]?r3=e6.substr(1):"~"===e6[0]&&(n4=true,r3=e6.substr(1)),t6.indexOf(o2.default.compareVersions(i3,r3,n4))>-1},t5.isOS=function(e6){return this.getOSName(true)===String(e6).toLowerCase()},t5.isPlatform=function(e6){return this.getPlatformType(true)===String(e6).toLowerCase()},t5.isEngine=function(e6){return this.getEngineName(true)===String(e6).toLowerCase()},t5.is=function(e6,t6){return void 0===t6&&(t6=false),this.isBrowser(e6,t6)||this.isOS(e6)||this.isPlatform(e6)},t5.some=function(e6){var t6=this;return void 0===e6&&(e6=[]),e6.some((function(e7){return t6.is(e7)}))},e5}();t4.default=d4,e4.exports=t4.default},92:function(e4,t4,r2){"use strict";t4.__esModule=true,t4.default=void 0;var n3,i2=(n3=r2(17))&&n3.__esModule?n3:{default:n3},s2=/version\/(\d+(\.?_?\d+)+)/i,a2=[{test:[/googlebot/i],describe:function(e5){var t5={name:"Googlebot"},r3=i2.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e5)||i2.default.getFirstMatch(s2,e5);return r3&&(t5.version=r3),t5}},{test:[/opera/i],describe:function(e5){var t5={name:"Opera"},r3=i2.default.getFirstMatch(s2,e5)||i2.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/opr\/|opios/i],describe:function(e5){var t5={name:"Opera"},r3=i2.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e5)||i2.default.getFirstMatch(s2,e5);return r3&&(t5.version=r3),t5}},{test:[/SamsungBrowser/i],describe:function(e5){var t5={name:"Samsung Internet for Android"},r3=i2.default.getFirstMatch(s2,e5)||i2.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/Whale/i],describe:function(e5){var t5={name:"NAVER Whale Browser"},r3=i2.default.getFirstMatch(s2,e5)||i2.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/MZBrowser/i],describe:function(e5){var t5={name:"MZ Browser"},r3=i2.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e5)||i2.default.getFirstMatch(s2,e5);return r3&&(t5.version=r3),t5}},{test:[/focus/i],describe:function(e5){var t5={name:"Focus"},r3=i2.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e5)||i2.default.getFirstMatch(s2,e5);return r3&&(t5.version=r3),t5}},{test:[/swing/i],describe:function(e5){var t5={name:"Swing"},r3=i2.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e5)||i2.default.getFirstMatch(s2,e5);return r3&&(t5.version=r3),t5}},{test:[/coast/i],describe:function(e5){var t5={name:"Opera Coast"},r3=i2.default.getFirstMatch(s2,e5)||i2.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e5){var t5={name:"Opera Touch"},r3=i2.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e5)||i2.default.getFirstMatch(s2,e5);return r3&&(t5.version=r3),t5}},{test:[/yabrowser/i],describe:function(e5){var t5={name:"Yandex Browser"},r3=i2.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e5)||i2.default.getFirstMatch(s2,e5);return r3&&(t5.version=r3),t5}},{test:[/ucbrowser/i],describe:function(e5){var t5={name:"UC Browser"},r3=i2.default.getFirstMatch(s2,e5)||i2.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/Maxthon|mxios/i],describe:function(e5){var t5={name:"Maxthon"},r3=i2.default.getFirstMatch(s2,e5)||i2.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/epiphany/i],describe:function(e5){var t5={name:"Epiphany"},r3=i2.default.getFirstMatch(s2,e5)||i2.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/puffin/i],describe:function(e5){var t5={name:"Puffin"},r3=i2.default.getFirstMatch(s2,e5)||i2.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/sleipnir/i],describe:function(e5){var t5={name:"Sleipnir"},r3=i2.default.getFirstMatch(s2,e5)||i2.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/k-meleon/i],describe:function(e5){var t5={name:"K-Meleon"},r3=i2.default.getFirstMatch(s2,e5)||i2.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/micromessenger/i],describe:function(e5){var t5={name:"WeChat"},r3=i2.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e5)||i2.default.getFirstMatch(s2,e5);return r3&&(t5.version=r3),t5}},{test:[/qqbrowser/i],describe:function(e5){var t5={name:/qqbrowserlite/i.test(e5)?"QQ Browser Lite":"QQ Browser"},r3=i2.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e5)||i2.default.getFirstMatch(s2,e5);return r3&&(t5.version=r3),t5}},{test:[/msie|trident/i],describe:function(e5){var t5={name:"Internet Explorer"},r3=i2.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/\sedg\//i],describe:function(e5){var t5={name:"Microsoft Edge"},r3=i2.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/edg([ea]|ios)/i],describe:function(e5){var t5={name:"Microsoft Edge"},r3=i2.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/vivaldi/i],describe:function(e5){var t5={name:"Vivaldi"},r3=i2.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/seamonkey/i],describe:function(e5){var t5={name:"SeaMonkey"},r3=i2.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/sailfish/i],describe:function(e5){var t5={name:"Sailfish"},r3=i2.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/silk/i],describe:function(e5){var t5={name:"Amazon Silk"},r3=i2.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/phantom/i],describe:function(e5){var t5={name:"PhantomJS"},r3=i2.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/slimerjs/i],describe:function(e5){var t5={name:"SlimerJS"},r3=i2.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e5){var t5={name:"BlackBerry"},r3=i2.default.getFirstMatch(s2,e5)||i2.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/(web|hpw)[o0]s/i],describe:function(e5){var t5={name:"WebOS Browser"},r3=i2.default.getFirstMatch(s2,e5)||i2.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/bada/i],describe:function(e5){var t5={name:"Bada"},r3=i2.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/tizen/i],describe:function(e5){var t5={name:"Tizen"},r3=i2.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e5)||i2.default.getFirstMatch(s2,e5);return r3&&(t5.version=r3),t5}},{test:[/qupzilla/i],describe:function(e5){var t5={name:"QupZilla"},r3=i2.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e5)||i2.default.getFirstMatch(s2,e5);return r3&&(t5.version=r3),t5}},{test:[/firefox|iceweasel|fxios/i],describe:function(e5){var t5={name:"Firefox"},r3=i2.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/electron/i],describe:function(e5){var t5={name:"Electron"},r3=i2.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/MiuiBrowser/i],describe:function(e5){var t5={name:"Miui"},r3=i2.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/chromium/i],describe:function(e5){var t5={name:"Chromium"},r3=i2.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e5)||i2.default.getFirstMatch(s2,e5);return r3&&(t5.version=r3),t5}},{test:[/chrome|crios|crmo/i],describe:function(e5){var t5={name:"Chrome"},r3=i2.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/GSA/i],describe:function(e5){var t5={name:"Google Search"},r3=i2.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:function(e5){var t5=!e5.test(/like android/i),r3=e5.test(/android/i);return t5&&r3},describe:function(e5){var t5={name:"Android Browser"},r3=i2.default.getFirstMatch(s2,e5);return r3&&(t5.version=r3),t5}},{test:[/playstation 4/i],describe:function(e5){var t5={name:"PlayStation 4"},r3=i2.default.getFirstMatch(s2,e5);return r3&&(t5.version=r3),t5}},{test:[/safari|applewebkit/i],describe:function(e5){var t5={name:"Safari"},r3=i2.default.getFirstMatch(s2,e5);return r3&&(t5.version=r3),t5}},{test:[/.*/i],describe:function(e5){var t5=-1!==e5.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i2.default.getFirstMatch(t5,e5),version:i2.default.getSecondMatch(t5,e5)}}}];t4.default=a2,e4.exports=t4.default},93:function(e4,t4,r2){"use strict";t4.__esModule=true,t4.default=void 0;var n3,i2=(n3=r2(17))&&n3.__esModule?n3:{default:n3},s2=r2(18),a2=[{test:[/Roku\/DVP/],describe:function(e5){var t5=i2.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e5);return{name:s2.OS_MAP.Roku,version:t5}}},{test:[/windows phone/i],describe:function(e5){var t5=i2.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e5);return{name:s2.OS_MAP.WindowsPhone,version:t5}}},{test:[/windows /i],describe:function(e5){var t5=i2.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e5),r3=i2.default.getWindowsVersionName(t5);return{name:s2.OS_MAP.Windows,version:t5,versionName:r3}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e5){var t5={name:s2.OS_MAP.iOS},r3=i2.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e5);return r3&&(t5.version=r3),t5}},{test:[/macintosh/i],describe:function(e5){var t5=i2.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e5).replace(/[_\s]/g,"."),r3=i2.default.getMacOSVersionName(t5),n4={name:s2.OS_MAP.MacOS,version:t5};return r3&&(n4.versionName=r3),n4}},{test:[/(ipod|iphone|ipad)/i],describe:function(e5){var t5=i2.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e5).replace(/[_\s]/g,".");return{name:s2.OS_MAP.iOS,version:t5}}},{test:function(e5){var t5=!e5.test(/like android/i),r3=e5.test(/android/i);return t5&&r3},describe:function(e5){var t5=i2.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e5),r3=i2.default.getAndroidVersionName(t5),n4={name:s2.OS_MAP.Android,version:t5};return r3&&(n4.versionName=r3),n4}},{test:[/(web|hpw)[o0]s/i],describe:function(e5){var t5=i2.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e5),r3={name:s2.OS_MAP.WebOS};return t5&&t5.length&&(r3.version=t5),r3}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e5){var t5=i2.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e5)||i2.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e5)||i2.default.getFirstMatch(/\bbb(\d+)/i,e5);return{name:s2.OS_MAP.BlackBerry,version:t5}}},{test:[/bada/i],describe:function(e5){var t5=i2.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e5);return{name:s2.OS_MAP.Bada,version:t5}}},{test:[/tizen/i],describe:function(e5){var t5=i2.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e5);return{name:s2.OS_MAP.Tizen,version:t5}}},{test:[/linux/i],describe:function(){return{name:s2.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:s2.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e5){var t5=i2.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e5);return{name:s2.OS_MAP.PlayStation4,version:t5}}}];t4.default=a2,e4.exports=t4.default},94:function(e4,t4,r2){"use strict";t4.__esModule=true,t4.default=void 0;var n3,i2=(n3=r2(17))&&n3.__esModule?n3:{default:n3},s2=r2(18),a2=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e5){var t5=i2.default.getFirstMatch(/(can-l01)/i,e5)&&"Nova",r3={type:s2.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t5&&(r3.model=t5),r3}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:s2.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:s2.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:s2.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:s2.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:s2.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:s2.PLATFORMS_MAP.tablet}}},{test:function(e5){var t5=e5.test(/ipod|iphone/i),r3=e5.test(/like (ipod|iphone)/i);return t5&&!r3},describe:function(e5){var t5=i2.default.getFirstMatch(/(ipod|iphone)/i,e5);return{type:s2.PLATFORMS_MAP.mobile,vendor:"Apple",model:t5}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:s2.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:s2.PLATFORMS_MAP.mobile}}},{test:function(e5){return"blackberry"===e5.getBrowserName(true)},describe:function(){return{type:s2.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e5){return"bada"===e5.getBrowserName(true)},describe:function(){return{type:s2.PLATFORMS_MAP.mobile}}},{test:function(e5){return"windows phone"===e5.getBrowserName()},describe:function(){return{type:s2.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e5){var t5=Number(String(e5.getOSVersion()).split(".")[0]);return"android"===e5.getOSName(true)&&t5>=3},describe:function(){return{type:s2.PLATFORMS_MAP.tablet}}},{test:function(e5){return"android"===e5.getOSName(true)},describe:function(){return{type:s2.PLATFORMS_MAP.mobile}}},{test:function(e5){return"macos"===e5.getOSName(true)},describe:function(){return{type:s2.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e5){return"windows"===e5.getOSName(true)},describe:function(){return{type:s2.PLATFORMS_MAP.desktop}}},{test:function(e5){return"linux"===e5.getOSName(true)},describe:function(){return{type:s2.PLATFORMS_MAP.desktop}}},{test:function(e5){return"playstation 4"===e5.getOSName(true)},describe:function(){return{type:s2.PLATFORMS_MAP.tv}}},{test:function(e5){return"roku"===e5.getOSName(true)},describe:function(){return{type:s2.PLATFORMS_MAP.tv}}}];t4.default=a2,e4.exports=t4.default},95:function(e4,t4,r2){"use strict";t4.__esModule=true,t4.default=void 0;var n3,i2=(n3=r2(17))&&n3.__esModule?n3:{default:n3},s2=r2(18),a2=[{test:function(e5){return"microsoft edge"===e5.getBrowserName(true)},describe:function(e5){if(/\sedg\//i.test(e5))return{name:s2.ENGINE_MAP.Blink};var t5=i2.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e5);return{name:s2.ENGINE_MAP.EdgeHTML,version:t5}}},{test:[/trident/i],describe:function(e5){var t5={name:s2.ENGINE_MAP.Trident},r3=i2.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:function(e5){return e5.test(/presto/i)},describe:function(e5){var t5={name:s2.ENGINE_MAP.Presto},r3=i2.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:function(e5){var t5=e5.test(/gecko/i),r3=e5.test(/like gecko/i);return t5&&!r3},describe:function(e5){var t5={name:s2.ENGINE_MAP.Gecko},r3=i2.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:s2.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e5){var t5={name:s2.ENGINE_MAP.WebKit},r3=i2.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e5);return r3&&(t5.version=r3),t5}}];t4.default=a2,e4.exports=t4.default}})},"object"==typeof exports&&"object"==typeof module2?module2.exports=t4():"function"==typeof define&&define.amd?define([],t4):"object"==typeof exports?exports.bowser=t4():e4.bowser=t4();var e4,t4}}),require_events=__commonJS({"node_modules/events/events.js"(exports,module2){"use strict";var ReflectOwnKeys,R2="object"==typeof Reflect?Reflect:null,ReflectApply=R2&&"function"==typeof R2.apply?R2.apply:function ReflectApply2(target,receiver,args){return Function.prototype.apply.call(target,receiver,args)};if(R2&&"function"==typeof R2.ownKeys)ReflectOwnKeys=R2.ownKeys;else if(Object.getOwnPropertySymbols)ReflectOwnKeys=function ReflectOwnKeys2(target){return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target))};else ReflectOwnKeys=function ReflectOwnKeys2(target){return Object.getOwnPropertyNames(target)};var NumberIsNaN=Number.isNaN||function NumberIsNaN2(value){return value!=value};function EventEmitter2(){EventEmitter2.init.call(this)}module2.exports=EventEmitter2;module2.exports.once=function once3(emitter,name){return new Promise((function(resolve,reject){function errorListener(err2){emitter.removeListener(name,resolver);reject(err2)}function resolver(){if("function"==typeof emitter.removeListener)emitter.removeListener("error",errorListener);resolve([].slice.call(arguments))}eventTargetAgnosticAddListener(emitter,name,resolver,{once:true});if("error"!==name)(function addErrorHandlerIfEventEmitter(emitter,handler,flags){if("function"==typeof emitter.on)eventTargetAgnosticAddListener(emitter,"error",handler,flags)})(emitter,errorListener,{once:true})}))};EventEmitter2.EventEmitter=EventEmitter2;EventEmitter2.prototype._events=void 0;EventEmitter2.prototype._eventsCount=0;EventEmitter2.prototype._maxListeners=void 0;var defaultMaxListeners=10;function checkListener(listener){if("function"!=typeof listener)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof listener)}Object.defineProperty(EventEmitter2,"defaultMaxListeners",{enumerable:true,get:function(){return defaultMaxListeners},set:function(arg){if("number"!=typeof arg||arg<0||NumberIsNaN(arg))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+arg+".");defaultMaxListeners=arg}});EventEmitter2.init=function(){if(void 0===this._events||this._events===Object.getPrototypeOf(this)._events){this._events=Object.create(null);this._eventsCount=0}this._maxListeners=this._maxListeners||void 0};EventEmitter2.prototype.setMaxListeners=function setMaxListeners(n3){if("number"!=typeof n3||n3<0||NumberIsNaN(n3))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+n3+".");this._maxListeners=n3;return this};function _getMaxListeners(that){if(void 0===that._maxListeners)return EventEmitter2.defaultMaxListeners;else return that._maxListeners}EventEmitter2.prototype.getMaxListeners=function getMaxListeners(){return _getMaxListeners(this)};EventEmitter2.prototype.emit=function emit2(type){for(var args=[],i2=1;i20)er=args[0];if(er instanceof Error)throw er;var err2=new Error("Unhandled error."+(er?" ("+er.message+")":""));err2.context=er;throw err2}var handler=events[type];if(void 0===handler)return false;if("function"==typeof handler)ReflectApply(handler,this,args);else{var len=handler.length,listeners=arrayClone(handler,len);for(i2=0;i20&&existing.length>m2&&!existing.warned){existing.warned=true;var w2=new Error("Possible EventEmitter memory leak detected. "+existing.length+" "+String(type)+" listeners added. Use emitter.setMaxListeners() to increase limit");w2.name="MaxListenersExceededWarning";w2.emitter=target;w2.type=type;w2.count=existing.length;(function ProcessEmitWarning(warning){if(console&&console.warn)console.warn(warning)})(w2)}}return target}EventEmitter2.prototype.addListener=function addListener(type,listener){return _addListener(this,type,listener,false)};EventEmitter2.prototype.on=EventEmitter2.prototype.addListener;EventEmitter2.prototype.prependListener=function prependListener(type,listener){return _addListener(this,type,listener,true)};function onceWrapper(){if(!this.fired){this.target.removeListener(this.type,this.wrapFn);this.fired=true;if(0===arguments.length)return this.listener.call(this.target);else return this.listener.apply(this.target,arguments)}}function _onceWrap(target,type,listener){var state={fired:false,wrapFn:void 0,target,type,listener},wrapped=onceWrapper.bind(state);wrapped.listener=listener;state.wrapFn=wrapped;return wrapped}EventEmitter2.prototype.once=function once4(type,listener){checkListener(listener);this.on(type,_onceWrap(this,type,listener));return this};EventEmitter2.prototype.prependOnceListener=function prependOnceListener(type,listener){checkListener(listener);this.prependListener(type,_onceWrap(this,type,listener));return this};EventEmitter2.prototype.removeListener=function removeListener(type,listener){var list,events,position,i2,originalListener;checkListener(listener);if(void 0===(events=this._events))return this;if(void 0===(list=events[type]))return this;if(list===listener||list.listener===listener)if(0==--this._eventsCount)this._events=Object.create(null);else{delete events[type];if(events.removeListener)this.emit("removeListener",type,list.listener||listener)}else if("function"!=typeof list){position=-1;for(i2=list.length-1;i2>=0;i2--)if(list[i2]===listener||list[i2].listener===listener){originalListener=list[i2].listener;position=i2;break}if(position<0)return this;if(0===position)list.shift();else(function spliceOne(list,index5){for(;index5+1=0;i2--)this.removeListener(type,listeners[i2]);return this};function _listeners(target,type,unwrap2){var events=target._events;if(void 0===events)return[];var evlistener=events[type];if(void 0===evlistener)return[];if("function"==typeof evlistener)return unwrap2?[evlistener.listener||evlistener]:[evlistener];else return unwrap2?function unwrapListeners(arr){for(var ret=new Array(arr.length),i2=0;i20?ReflectOwnKeys(this._events):[]};function arrayClone(arr,n3){for(var copy=new Array(n3),i2=0;i2>>25)+b3|0)&b3|~a2&c2)+k2[1]-389564586|0)<<12|d4>>>20)+a2|0)&a2|~d4&b3)+k2[2]+606105819|0)<<17|c2>>>15)+d4|0)&d4|~c2&a2)+k2[3]-1044525330|0)<<22|b3>>>10)+c2|0;b3=((b3+=((c2=((c2+=((d4=((d4+=((a2=((a2+=(b3&c2|~b3&d4)+k2[4]-176418897|0)<<7|a2>>>25)+b3|0)&b3|~a2&c2)+k2[5]+1200080426|0)<<12|d4>>>20)+a2|0)&a2|~d4&b3)+k2[6]-1473231341|0)<<17|c2>>>15)+d4|0)&d4|~c2&a2)+k2[7]-45705983|0)<<22|b3>>>10)+c2|0;b3=((b3+=((c2=((c2+=((d4=((d4+=((a2=((a2+=(b3&c2|~b3&d4)+k2[8]+1770035416|0)<<7|a2>>>25)+b3|0)&b3|~a2&c2)+k2[9]-1958414417|0)<<12|d4>>>20)+a2|0)&a2|~d4&b3)+k2[10]-42063|0)<<17|c2>>>15)+d4|0)&d4|~c2&a2)+k2[11]-1990404162|0)<<22|b3>>>10)+c2|0;b3=((b3+=((c2=((c2+=((d4=((d4+=((a2=((a2+=(b3&c2|~b3&d4)+k2[12]+1804603682|0)<<7|a2>>>25)+b3|0)&b3|~a2&c2)+k2[13]-40341101|0)<<12|d4>>>20)+a2|0)&a2|~d4&b3)+k2[14]-1502002290|0)<<17|c2>>>15)+d4|0)&d4|~c2&a2)+k2[15]+1236535329|0)<<22|b3>>>10)+c2|0;b3=((b3+=((c2=((c2+=((d4=((d4+=((a2=((a2+=(b3&d4|c2&~d4)+k2[1]-165796510|0)<<5|a2>>>27)+b3|0)&c2|b3&~c2)+k2[6]-1069501632|0)<<9|d4>>>23)+a2|0)&b3|a2&~b3)+k2[11]+643717713|0)<<14|c2>>>18)+d4|0)&a2|d4&~a2)+k2[0]-373897302|0)<<20|b3>>>12)+c2|0;b3=((b3+=((c2=((c2+=((d4=((d4+=((a2=((a2+=(b3&d4|c2&~d4)+k2[5]-701558691|0)<<5|a2>>>27)+b3|0)&c2|b3&~c2)+k2[10]+38016083|0)<<9|d4>>>23)+a2|0)&b3|a2&~b3)+k2[15]-660478335|0)<<14|c2>>>18)+d4|0)&a2|d4&~a2)+k2[4]-405537848|0)<<20|b3>>>12)+c2|0;b3=((b3+=((c2=((c2+=((d4=((d4+=((a2=((a2+=(b3&d4|c2&~d4)+k2[9]+568446438|0)<<5|a2>>>27)+b3|0)&c2|b3&~c2)+k2[14]-1019803690|0)<<9|d4>>>23)+a2|0)&b3|a2&~b3)+k2[3]-187363961|0)<<14|c2>>>18)+d4|0)&a2|d4&~a2)+k2[8]+1163531501|0)<<20|b3>>>12)+c2|0;b3=((b3+=((c2=((c2+=((d4=((d4+=((a2=((a2+=(b3&d4|c2&~d4)+k2[13]-1444681467|0)<<5|a2>>>27)+b3|0)&c2|b3&~c2)+k2[2]-51403784|0)<<9|d4>>>23)+a2|0)&b3|a2&~b3)+k2[7]+1735328473|0)<<14|c2>>>18)+d4|0)&a2|d4&~a2)+k2[12]-1926607734|0)<<20|b3>>>12)+c2|0;b3=((b3+=((c2=((c2+=((d4=((d4+=((a2=((a2+=(b3^c2^d4)+k2[5]-378558|0)<<4|a2>>>28)+b3|0)^b3^c2)+k2[8]-2022574463|0)<<11|d4>>>21)+a2|0)^a2^b3)+k2[11]+1839030562|0)<<16|c2>>>16)+d4|0)^d4^a2)+k2[14]-35309556|0)<<23|b3>>>9)+c2|0;b3=((b3+=((c2=((c2+=((d4=((d4+=((a2=((a2+=(b3^c2^d4)+k2[1]-1530992060|0)<<4|a2>>>28)+b3|0)^b3^c2)+k2[4]+1272893353|0)<<11|d4>>>21)+a2|0)^a2^b3)+k2[7]-155497632|0)<<16|c2>>>16)+d4|0)^d4^a2)+k2[10]-1094730640|0)<<23|b3>>>9)+c2|0;b3=((b3+=((c2=((c2+=((d4=((d4+=((a2=((a2+=(b3^c2^d4)+k2[13]+681279174|0)<<4|a2>>>28)+b3|0)^b3^c2)+k2[0]-358537222|0)<<11|d4>>>21)+a2|0)^a2^b3)+k2[3]-722521979|0)<<16|c2>>>16)+d4|0)^d4^a2)+k2[6]+76029189|0)<<23|b3>>>9)+c2|0;b3=((b3+=((c2=((c2+=((d4=((d4+=((a2=((a2+=(b3^c2^d4)+k2[9]-640364487|0)<<4|a2>>>28)+b3|0)^b3^c2)+k2[12]-421815835|0)<<11|d4>>>21)+a2|0)^a2^b3)+k2[15]+530742520|0)<<16|c2>>>16)+d4|0)^d4^a2)+k2[2]-995338651|0)<<23|b3>>>9)+c2|0;b3=((b3+=((d4=((d4+=(b3^((a2=((a2+=(c2^(b3|~d4))+k2[0]-198630844|0)<<6|a2>>>26)+b3|0)|~c2))+k2[7]+1126891415|0)<<10|d4>>>22)+a2|0)^((c2=((c2+=(a2^(d4|~b3))+k2[14]-1416354905|0)<<15|c2>>>17)+d4|0)|~a2))+k2[5]-57434055|0)<<21|b3>>>11)+c2|0;b3=((b3+=((d4=((d4+=(b3^((a2=((a2+=(c2^(b3|~d4))+k2[12]+1700485571|0)<<6|a2>>>26)+b3|0)|~c2))+k2[3]-1894986606|0)<<10|d4>>>22)+a2|0)^((c2=((c2+=(a2^(d4|~b3))+k2[10]-1051523|0)<<15|c2>>>17)+d4|0)|~a2))+k2[1]-2054922799|0)<<21|b3>>>11)+c2|0;b3=((b3+=((d4=((d4+=(b3^((a2=((a2+=(c2^(b3|~d4))+k2[8]+1873313359|0)<<6|a2>>>26)+b3|0)|~c2))+k2[15]-30611744|0)<<10|d4>>>22)+a2|0)^((c2=((c2+=(a2^(d4|~b3))+k2[6]-1560198380|0)<<15|c2>>>17)+d4|0)|~a2))+k2[13]+1309151649|0)<<21|b3>>>11)+c2|0;b3=((b3+=((d4=((d4+=(b3^((a2=((a2+=(c2^(b3|~d4))+k2[4]-145523070|0)<<6|a2>>>26)+b3|0)|~c2))+k2[11]-1120210379|0)<<10|d4>>>22)+a2|0)^((c2=((c2+=(a2^(d4|~b3))+k2[2]+718787259|0)<<15|c2>>>17)+d4|0)|~a2))+k2[9]-343485551|0)<<21|b3>>>11)+c2|0;x2[0]=a2+x2[0]|0;x2[1]=b3+x2[1]|0;x2[2]=c2+x2[2]|0;x2[3]=d4+x2[3]|0}function md5blk(s2){var i2,md5blks=[];for(i2=0;i2<64;i2+=4)md5blks[i2>>2]=s2.charCodeAt(i2)+(s2.charCodeAt(i2+1)<<8)+(s2.charCodeAt(i2+2)<<16)+(s2.charCodeAt(i2+3)<<24);return md5blks}function md5blk_array(a2){var i2,md5blks=[];for(i2=0;i2<64;i2+=4)md5blks[i2>>2]=a2[i2]+(a2[i2+1]<<8)+(a2[i2+2]<<16)+(a2[i2+3]<<24);return md5blks}function md51(s2){var i2,length,tail,tmp,lo,hi,n3=s2.length,state=[1732584193,-271733879,-1732584194,271733878];for(i2=64;i2<=n3;i2+=64)md5cycle(state,md5blk(s2.substring(i2-64,i2)));length=(s2=s2.substring(i2-64)).length;tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i2=0;i2>2]|=s2.charCodeAt(i2)<<(i2%4<<3);tail[i2>>2]|=128<<(i2%4<<3);if(i2>55){md5cycle(state,tail);for(i2=0;i2<16;i2+=1)tail[i2]=0}tmp=(tmp=8*n3).toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}function rhex(n3){var j2,s2="";for(j2=0;j2<4;j2+=1)s2+=hex_chr[n3>>8*j2+4&15]+hex_chr[n3>>8*j2&15];return s2}function hex(x2){var i2;for(i2=0;i2end)return new ArrayBuffer(0);num=end-begin;target=new ArrayBuffer(num);targetArray=new Uint8Array(target);sourceArray=new Uint8Array(this,begin,num);targetArray.set(sourceArray);return target}})();function toUtf82(str){if(/[\u0080-\uFFFF]/.test(str))str=unescape(encodeURIComponent(str));return str}function hexToBinaryString(hex2){var x2,bytes=[],length=hex2.length;for(x2=0;x2>2]|=buff.charCodeAt(i2)<<(i2%4<<3);this._finish(tail,length);ret=hex(this._hash);if(raw)ret=hexToBinaryString(ret);this.reset();return ret};SparkMD5.prototype.reset=function(){this._buff="";this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}};SparkMD5.prototype.setState=function(state){this._buff=state.buff;this._length=state.length;this._hash=state.hash;return this};SparkMD5.prototype.destroy=function(){delete this._hash;delete this._buff;delete this._length};SparkMD5.prototype._finish=function(tail,length){var tmp,lo,hi,i2=length;tail[i2>>2]|=128<<(i2%4<<3);if(i2>55){md5cycle(this._hash,tail);for(i2=0;i2<16;i2+=1)tail[i2]=0}tmp=(tmp=8*this._length).toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(this._hash,tail)};SparkMD5.hash=function(str,raw){return SparkMD5.hashBinary(toUtf82(str),raw)};SparkMD5.hashBinary=function(content,raw){var ret=hex(md51(content));return raw?hexToBinaryString(ret):ret};SparkMD5.ArrayBuffer=function(){this.reset()};SparkMD5.ArrayBuffer.prototype.append=function(arr){var i2,buff=function concatenateArrayBuffers(first,second,returnUInt8Array){var result=new Uint8Array(first.byteLength+second.byteLength);result.set(new Uint8Array(first));result.set(new Uint8Array(second),first.byteLength);return returnUInt8Array?result:result.buffer}(this._buff.buffer,arr,true),length=buff.length;this._length+=arr.byteLength;for(i2=64;i2<=length;i2+=64)md5cycle(this._hash,md5blk_array(buff.subarray(i2-64,i2)));this._buff=i2-64>2]|=buff[i2]<<(i2%4<<3);this._finish(tail,length);ret=hex(this._hash);if(raw)ret=hexToBinaryString(ret);this.reset();return ret};SparkMD5.ArrayBuffer.prototype.reset=function(){this._buff=new Uint8Array(0);this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.ArrayBuffer.prototype.getState=function(){var state=SparkMD5.prototype.getState.call(this);state.buff=function arrayBuffer2Utf8Str(buff){return String.fromCharCode.apply(null,new Uint8Array(buff))}(state.buff);return state};SparkMD5.ArrayBuffer.prototype.setState=function(state){state.buff=function utf8Str2ArrayBuffer(str,returnUInt8Array){var i2,length=str.length,buff=new ArrayBuffer(length),arr=new Uint8Array(buff);for(i2=0;i2>2]|=a2[i2]<<(i2%4<<3);tail[i2>>2]|=128<<(i2%4<<3);if(i2>55){md5cycle(state,tail);for(i2=0;i2<16;i2+=1)tail[i2]=0}tmp=(tmp=8*n3).toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}(new Uint8Array(arr)),ret=hex(hash2);return raw?hexToBinaryString(ret):ret};return SparkMD5}))}}),require_vuvuzela=__commonJS({"node_modules/vuvuzela/index.js"(exports){"use strict";exports.stringify=function stringify4(input){var queue2=[];queue2.push({obj:input});for(var next,obj,val2,i2,arrayPrefix,keys2,k2,key2,value,objPrefix,res2="";next=queue2.pop();){obj=next.obj;res2+=next.prefix||"";if(val2=next.val||"")res2+=val2;else if("object"!=typeof obj)res2+="undefined"==typeof obj?null:JSON.stringify(obj);else if(null===obj)res2+="null";else if(Array.isArray(obj)){queue2.push({val:"]"});for(i2=obj.length-1;i2>=0;i2--){arrayPrefix=0===i2?"":",";queue2.push({obj:obj[i2],prefix:arrayPrefix})}queue2.push({val:"["})}else{keys2=[];for(k2 in obj)if(obj.hasOwnProperty(k2))keys2.push(k2);queue2.push({val:"}"});for(i2=keys2.length-1;i2>=0;i2--){value=obj[key2=keys2[i2]];objPrefix=i2>0?",":"";objPrefix+=JSON.stringify(key2)+":";queue2.push({obj:value,prefix:objPrefix})}queue2.push({val:"{"})}}return res2};function pop2(obj,stack,metaStack){var lastMetaElement=metaStack[metaStack.length-1];if(obj===lastMetaElement.element){metaStack.pop();lastMetaElement=metaStack[metaStack.length-1]}var element2=lastMetaElement.element,lastElementIndex=lastMetaElement.index;if(Array.isArray(element2))element2.push(obj);else if(lastElementIndex===stack.length-2)element2[stack.pop()]=obj;else stack.push(obj)}exports.parse=function(str){for(var collationIndex2,parsedNum,numChar,parsedString,lastCh,numConsecutiveSlashes,ch4,arrayElement,objElement,stack=[],metaStack=[],i2=0;;){if("}"===(collationIndex2=str[i2++])||"]"===collationIndex2||"undefined"==typeof collationIndex2)if(1===stack.length)return stack.pop();else{pop2(stack.pop(),stack,metaStack);continue}switch(collationIndex2){case" ":case"\t":case"\n":case":":case",":break;case"n":i2+=3;pop2(null,stack,metaStack);break;case"t":i2+=3;pop2(true,stack,metaStack);break;case"f":i2+=4;pop2(false,stack,metaStack);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":parsedNum="";i2--;for(;;){numChar=str[i2++];if(/[\d\.\-e\+]/.test(numChar))parsedNum+=numChar;else{i2--;break}}pop2(parseFloat(parsedNum),stack,metaStack);break;case'"':parsedString="";lastCh=void 0;numConsecutiveSlashes=0;for(;'"'!==(ch4=str[i2++])||"\\"===lastCh&&numConsecutiveSlashes%2==1;){parsedString+=ch4;if("\\"===(lastCh=ch4))numConsecutiveSlashes++;else numConsecutiveSlashes=0}pop2(JSON.parse('"'+parsedString+'"'),stack,metaStack);break;case"[":arrayElement={element:[],index:stack.length};stack.push(arrayElement.element);metaStack.push(arrayElement);break;case"{":objElement={element:{},index:stack.length};stack.push(objElement.element);metaStack.push(objElement);break;default:throw new Error("unexpectedly reached end of input: "+collationIndex2)}}}}}),require_pouchdb_wrappers=__commonJS({"node_modules/pouchdb-wrappers/index.js"(exports,module2){"use strict";function replacementMethod(base,method){return function(...args){function doMethod(){let callback=null;const minArgs="query"===method?1:0;if(args.length>minArgs&&"function"==typeof args[args.length-1])callback=args.pop();let prev=base._originals[method].bind(base);for(const handler of base._handlers[method])prev=handler.bind(base,prev);const result=prev(...args);if(result.then&&callback)(function nodify(promise2,callback){promise2.then(((...args)=>{callback(null,...args)})).catch((err2=>{callback(err2)}))})(result,callback);return result}if("changes"!==method&&base.taskqueue&&!base.taskqueue.isReady)return new Promise(((resolve,reject)=>{base.taskqueue.addTask((error=>{if(error)reject(error);else resolve()}))})).then(doMethod);else return doMethod()}}var toExport={install:function installWrappers(base,handlers={}){if(!base._originals||!base._handlers){base._originals={};base._handlers={}}for(const[method,handler]of Object.entries(handlers)){if(!(method in base))throw new Error(`Method '${method}' does not exist on given base, so it cannot be wrapped.`);if(!(method in base._originals))base._originals[method]=base[method];if(method in base._handlers)base._handlers[method].unshift(handler);else{base._handlers[method]=[handler];base[method]=replacementMethod(base,method)}}},uninstall:function uninstallWrappers(base,handlers){if(!base._originals||!base._handlers)throw new Error("No wrapper methods installed, so no methods can be uninstalled.");for(const[method,handler]of Object.entries(handlers)){const errorMessage=`Wrapper method for '${method}' not installed: ${handler.toString()}`;if(!(method in base._handlers))throw new Error(errorMessage);const i2=base._handlers[method].indexOf(handler);if(-1===i2)throw new Error(errorMessage);else base._handlers[method].splice(i2,1)}}};try{module2.exports=toExport}catch(e4){}try{window.PouchDBWrappers=toExport}catch(e4){}}}),require_transform_pouch=__commonJS({"node_modules/transform-pouch/index.js"(exports,module2){"use strict";var wrappers=require_pouchdb_wrappers();function isntInternalKey(key2){return"_"!==key2[0]}function isUntransformable(doc){if("string"==typeof doc._id&&/^_local/.test(doc._id))return true;if(doc._deleted)return 0===Object.keys(doc).filter(isntInternalKey).length;else return false}module2.exports={transform:transform2,filter:transform2};function transform2(config){const incoming=function(doc){if(!isUntransformable(doc)&&config.incoming)return config.incoming(doc);else return doc},outgoing=function(doc){if(!isUntransformable(doc)&&config.outgoing)return config.outgoing(doc);else return doc},handlers={async get(orig,...args){const response=await orig(...args);if(Array.isArray(response)){await Promise.all(response.map((async row=>{if(row.ok)row.ok=await outgoing(row.ok)})));return response}else return outgoing(response)},async bulkDocs(orig,docs,...args){if(docs.docs)docs.docs=await Promise.all(docs.docs.map(incoming));else docs=await Promise.all(docs.map(incoming));return orig(docs,...args)},async allDocs(orig,...args){const response=await orig(...args);await Promise.all(response.rows.map((async row=>{if(row.doc)row.doc=await outgoing(row.doc)})));return response},async bulkGet(orig,...args){const mapDoc=async doc=>{if(doc.ok)return{ok:await outgoing(doc.ok)};else return doc};let{results,...res2}=await orig(...args);results=await Promise.all(results.map((async result=>{const{id,docs}=result;if(id&&docs&&Array.isArray(docs))return{id,docs:await Promise.all(docs.map(mapDoc))};else return result})));return{results,...res2}},changes(orig,...args){async function modifyChange(change){if(change.doc){change.doc=await outgoing(change.doc);return change}return change}async function modifyChanges(res2){if(res2.results){res2.results=await Promise.all(res2.results.map(modifyChange));return res2}return res2}const changes3=orig(...args),{on:origOn,then:origThen}=changes3;return Object.assign(changes3,{on(event,listener){const origListener=listener;if("change"===event)listener=async change=>{origListener(await modifyChange(change))};else if("complete"===event)listener=async res2=>{origListener(await modifyChanges(res2))};return origOn.call(changes3,event,listener)},then:(resolve,reject)=>origThen.call(changes3,modifyChanges).then(resolve,reject)})}};if("http"===this.type()){handlers.put=async function(orig,doc,...args){return orig(doc=await incoming(doc),...args)};handlers.query=async function(orig,...args){const response=await orig(...args);await Promise.all(response.rows.map((async row=>{if(row.doc)row.doc=await outgoing(row.doc)})));return response}}wrappers.install(this,handlers)}if("undefined"!=typeof window&&window.PouchDB)window.PouchDB.plugin(exports)}}),main_exports={};__export(main_exports,{default:()=>ObsidianLiveSyncPlugin});module.exports=__toCommonJS(main_exports);var LOG_LEVEL_DEBUG=-1,LOG_LEVEL_VERBOSE=16,LOG_LEVEL_INFO=32,LOG_LEVEL_NOTICE=64,LOG_LEVEL_URGENT=128,LOG_KIND_INFO=0,LOG_KIND_DEBUG=1,LOG_KIND_VERBOSE=2,LOG_KIND_WARNING=4,LOG_KIND_ERROR=8,LEVEL_DEBUG=LOG_LEVEL_DEBUG,LEVEL_INFO=LOG_LEVEL_INFO,LEVEL_NOTICE=LOG_LEVEL_NOTICE,LEVEL_URGENT=LOG_LEVEL_URGENT,LEVEL_VERBOSE=LOG_LEVEL_VERBOSE,defaultLoggerEnv={minLogLevel:LOG_LEVEL_INFO},defaultLogger=function defaultLogger2(message,level=LEVEL_INFO,key2){if(levelthis.maxCache||this.cachedLength>this.maxCachedLength)for(const[key3,value2]of this.cache){this.cache.delete(key3);if(this.enableReversed)this.revCache.delete(value2);this.cachedLength-=`${value2}`.length;if(this.cache.size<=this.maxCache&&this.cachedLength<=this.maxCachedLength)break}}},MAX_PATTERN_LENGTH=65536,assertValidPattern=pattern=>{if("string"!=typeof pattern)throw new TypeError("invalid pattern");if(pattern.length>MAX_PATTERN_LENGTH)throw new TypeError("pattern is too long")},posixClasses={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",true],"[:alpha:]":["\\p{L}\\p{Nl}",true],"[:ascii:]":["\\x00-\\x7f",false],"[:blank:]":["\\p{Zs}\\t",true],"[:cntrl:]":["\\p{Cc}",true],"[:digit:]":["\\p{Nd}",true],"[:graph:]":["\\p{Z}\\p{C}",true,true],"[:lower:]":["\\p{Ll}",true],"[:print:]":["\\p{C}",true],"[:punct:]":["\\p{P}",true],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",true],"[:upper:]":["\\p{Lu}",true],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",true],"[:xdigit:]":["A-Fa-f0-9",false]},braceEscape=s2=>s2.replace(/[[\]\\-]/g,"\\$&"),regexpEscape=s2=>s2.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),rangesToString=ranges=>ranges.join(""),parseClass=(glob,position)=>{const pos=position;if("["!==glob.charAt(pos))throw new Error("not in a brace expression");const ranges=[],negs=[];let i2=pos+1,sawStart=false,uflag=false,escaping=false,negate3=false,endPos=pos,rangeStart="";WHILE:for(;i2rangeStart)ranges.push(braceEscape(rangeStart)+"-"+braceEscape(c2));else if(c2===rangeStart)ranges.push(braceEscape(c2));rangeStart="";i2++}}else{negate3=true;i2++}}if(endPoswindowsPathsNoEscape?s2.replace(/\[([^\/\\])\]/g,"$1"):s2.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),types=new Set(["!","?","+","*","@"]),isExtglobType=c2=>types.has(c2),startNoTraversal="(?!(?:^|/)\\.\\.?(?:$|/))",startNoDot="(?!\\.)",addPatternStart=new Set(["[","."]),justDots=new Set(["..","."]),reSpecials=new Set("().*{}+?[]^$\\!"),regExpEscape=s2=>s2.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),qmark="[^/]",star=qmark+"*?",starNoEmpty=qmark+"+?",_AST=class _AST{constructor(type,parent,options={}){__privateAdd(this,_AST_instances);__publicField(this,"type");__privateAdd(this,_root);__privateAdd(this,_hasMagic);__privateAdd(this,_uflag,false);__privateAdd(this,_parts,[]);__privateAdd(this,_parent);__privateAdd(this,_parentIndex);__privateAdd(this,_negs);__privateAdd(this,_filledNegs,false);__privateAdd(this,_options);__privateAdd(this,_toString);__privateAdd(this,_emptyExt,false);this.type=type;if(type)__privateSet(this,_hasMagic,true);__privateSet(this,_parent,parent);__privateSet(this,_root,__privateGet(this,_parent)?__privateGet(__privateGet(this,_parent),_root):this);__privateSet(this,_options,__privateGet(this,_root)===this?options:__privateGet(__privateGet(this,_root),_options));__privateSet(this,_negs,__privateGet(this,_root)===this?[]:__privateGet(__privateGet(this,_root),_negs));if("!"===type&&!__privateGet(__privateGet(this,_root),_filledNegs))__privateGet(this,_negs).push(this);__privateSet(this,_parentIndex,__privateGet(this,_parent)?__privateGet(__privateGet(this,_parent),_parts).length:0)}get hasMagic(){if(void 0!==__privateGet(this,_hasMagic))return __privateGet(this,_hasMagic);for(const p2 of __privateGet(this,_parts))if("string"!=typeof p2)if(p2.type||p2.hasMagic)return __privateSet(this,_hasMagic,true);return __privateGet(this,_hasMagic)}toString(){if(void 0!==__privateGet(this,_toString))return __privateGet(this,_toString);if(!this.type)return __privateSet(this,_toString,__privateGet(this,_parts).map((p2=>String(p2))).join(""));else return __privateSet(this,_toString,this.type+"("+__privateGet(this,_parts).map((p2=>String(p2))).join("|")+")")}push(...parts){for(const p2 of parts)if(""!==p2){if("string"!=typeof p2&&!(p2 instanceof _AST&&__privateGet(p2,_parent)===this))throw new Error("invalid part: "+p2);__privateGet(this,_parts).push(p2)}}toJSON(){var _a5;const ret=null===this.type?__privateGet(this,_parts).slice().map((p2=>"string"==typeof p2?p2:p2.toJSON())):[this.type,...__privateGet(this,_parts).map((p2=>p2.toJSON()))];if(this.isStart()&&!this.type)ret.unshift([]);if(this.isEnd()&&(this===__privateGet(this,_root)||__privateGet(__privateGet(this,_root),_filledNegs)&&"!"===(null==(_a5=__privateGet(this,_parent))?void 0:_a5.type)))ret.push({});return ret}isStart(){var _a5;if(__privateGet(this,_root)===this)return true;if(!(null==(_a5=__privateGet(this,_parent))?void 0:_a5.isStart()))return false;if(0===__privateGet(this,_parentIndex))return true;const p2=__privateGet(this,_parent);for(let i2=0;i2<__privateGet(this,_parentIndex);i2++){const pp=__privateGet(p2,_parts)[i2];if(!(pp instanceof _AST&&"!"===pp.type))return false}return true}isEnd(){var _a5,_b2,_c2;if(__privateGet(this,_root)===this)return true;if("!"===(null==(_a5=__privateGet(this,_parent))?void 0:_a5.type))return true;if(!(null==(_b2=__privateGet(this,_parent))?void 0:_b2.isEnd()))return false;if(!this.type)return null==(_c2=__privateGet(this,_parent))?void 0:_c2.isEnd();const pl=__privateGet(this,_parent)?__privateGet(__privateGet(this,_parent),_parts).length:0;return __privateGet(this,_parentIndex)===pl-1}copyIn(part){if("string"==typeof part)this.push(part);else this.push(part.clone(this))}clone(parent){const c2=new _AST(this.type,parent);for(const p2 of __privateGet(this,_parts))c2.copyIn(p2);return c2}static fromGlob(pattern,options={}){var _a5;const ast=new _AST(null,void 0,options);__privateMethod(_a5=_AST,_AST_static,parseAST_fn).call(_a5,pattern,ast,0,options);return ast}toMMPattern(){if(this!==__privateGet(this,_root))return __privateGet(this,_root).toMMPattern();const glob=this.toString(),[re,body,hasMagic,uflag]=this.toRegExpSource();if(!(hasMagic||__privateGet(this,_hasMagic)||__privateGet(this,_options).nocase&&!__privateGet(this,_options).nocaseMagicOnly&&glob.toUpperCase()!==glob.toLowerCase()))return body;const flags=(__privateGet(this,_options).nocase?"i":"")+(uflag?"u":"");return Object.assign(new RegExp(`^${re}$`,flags),{_src:re,_glob:glob})}get options(){return __privateGet(this,_options)}toRegExpSource(allowDot){var _a5;const dot=null!=allowDot?allowDot:!!__privateGet(this,_options).dot;if(__privateGet(this,_root)===this)__privateMethod(this,_AST_instances,fillNegs_fn).call(this);if(!this.type){const noEmpty=this.isStart()&&this.isEnd(),src=__privateGet(this,_parts).map((p2=>{var _a6;const[re,_,hasMagic,uflag]="string"==typeof p2?__privateMethod(_a6=_AST,_AST_static,parseGlob_fn).call(_a6,p2,__privateGet(this,_hasMagic),noEmpty):p2.toRegExpSource(allowDot);__privateSet(this,_hasMagic,__privateGet(this,_hasMagic)||hasMagic);__privateSet(this,_uflag,__privateGet(this,_uflag)||uflag);return re})).join("");let start2="";if(this.isStart())if("string"==typeof __privateGet(this,_parts)[0])if(!(1===__privateGet(this,_parts).length&&justDots.has(__privateGet(this,_parts)[0]))){const aps=addPatternStart,needNoTrav=dot&&aps.has(src.charAt(0))||src.startsWith("\\.")&&aps.has(src.charAt(2))||src.startsWith("\\.\\.")&&aps.has(src.charAt(4)),needNoDot=!dot&&!allowDot&&aps.has(src.charAt(0));start2=needNoTrav?startNoTraversal:needNoDot?startNoDot:""}let end="";if(this.isEnd()&&__privateGet(__privateGet(this,_root),_filledNegs)&&"!"===(null==(_a5=__privateGet(this,_parent))?void 0:_a5.type))end="(?:$|\\/)";return[start2+src+end,unescape2(src),__privateSet(this,_hasMagic,!!__privateGet(this,_hasMagic)),__privateGet(this,_uflag)]}const repeated="*"===this.type||"+"===this.type,start="!"===this.type?"(?:(?!(?:":"(?:";let body=__privateMethod(this,_AST_instances,partsToRegExp_fn).call(this,dot);if(this.isStart()&&this.isEnd()&&!body&&"!"!==this.type){const s2=this.toString();__privateSet(this,_parts,[s2]);this.type=null;__privateSet(this,_hasMagic,void 0);return[s2,unescape2(this.toString()),false,false]}let bodyDotAllowed=!repeated||allowDot||dot||!startNoDot?"":__privateMethod(this,_AST_instances,partsToRegExp_fn).call(this,true);if(bodyDotAllowed===body)bodyDotAllowed="";if(bodyDotAllowed)body=`(?:${body})(?:${bodyDotAllowed})*?`;let final="";if("!"===this.type&&__privateGet(this,_emptyExt))final=(this.isStart()&&!dot?startNoDot:"")+starNoEmpty;else final=start+body+("!"===this.type?"))"+(this.isStart()&&!dot&&!allowDot?startNoDot:"")+star+")":"@"===this.type?")":"?"===this.type?")?":"+"===this.type&&bodyDotAllowed?")":"*"===this.type&&bodyDotAllowed?")?":`)${this.type}`);return[final,unescape2(body),__privateSet(this,_hasMagic,!!__privateGet(this,_hasMagic)),__privateGet(this,_uflag)]}};_root=new WeakMap;_hasMagic=new WeakMap;_uflag=new WeakMap;_parts=new WeakMap;_parent=new WeakMap;_parentIndex=new WeakMap;_negs=new WeakMap;_filledNegs=new WeakMap;_options=new WeakMap;_toString=new WeakMap;_emptyExt=new WeakMap;_AST_instances=new WeakSet;fillNegs_fn=function(){if(this!==__privateGet(this,_root))throw new Error("should only call on root");if(__privateGet(this,_filledNegs))return this;this.toString();__privateSet(this,_filledNegs,true);let n3;for(;n3=__privateGet(this,_negs).pop();){if("!"!==n3.type)continue;let p2=n3,pp=__privateGet(p2,_parent);for(;pp;){for(let i2=__privateGet(p2,_parentIndex)+1;!pp.type&&i2<__privateGet(pp,_parts).length;i2++)for(const part of __privateGet(n3,_parts)){if("string"==typeof part)throw new Error("string part in extglob AST??");part.copyIn(__privateGet(pp,_parts)[i2])}p2=pp;pp=__privateGet(p2,_parent)}}return this};_AST_static=new WeakSet;parseAST_fn=function(str,ast,pos,opt){var _a5,_b2;let escaping=false,inBrace=false,braceStart=-1,braceNeg=false;if(null===ast.type){let i3=pos,acc2="";for(;i3{if("string"==typeof p2)throw new Error("string type in extglob ast??");const[re,_,_hasMagic2,uflag]=p2.toRegExpSource(dot);__privateSet(this,_uflag,__privateGet(this,_uflag)||uflag);return re})).filter((p2=>!(this.isStart()&&this.isEnd()&&!p2))).join("|")};parseGlob_fn=function(glob,hasMagic,noEmpty=false){let escaping=false,re="",uflag=false;for(let i2=0;i2windowsPathsNoEscape?s2.replace(/[?*()[\]]/g,"[$&]"):s2.replace(/[?*()[\]\\]/g,"\\$&"),import_brace_expansion=__toESM(require_brace_expansion(),1),minimatch=(p2,pattern,options={})=>{assertValidPattern(pattern);if(!options.nocomment&&"#"===pattern.charAt(0))return false;else return new Minimatch(pattern,options).match(p2)},starDotExtRE=/^\*+([^+@!?\*\[\(]*)$/,starDotExtTest=ext2=>f4=>!f4.startsWith(".")&&f4.endsWith(ext2),starDotExtTestDot=ext2=>f4=>f4.endsWith(ext2),starDotExtTestNocase=ext2=>{ext2=ext2.toLowerCase();return f4=>!f4.startsWith(".")&&f4.toLowerCase().endsWith(ext2)},starDotExtTestNocaseDot=ext2=>{ext2=ext2.toLowerCase();return f4=>f4.toLowerCase().endsWith(ext2)},starDotStarRE=/^\*+\.\*+$/,starDotStarTest=f4=>!f4.startsWith(".")&&f4.includes("."),starDotStarTestDot=f4=>"."!==f4&&".."!==f4&&f4.includes("."),dotStarRE=/^\.\*+$/,dotStarTest=f4=>"."!==f4&&".."!==f4&&f4.startsWith("."),starRE=/^\*+$/,starTest=f4=>0!==f4.length&&!f4.startsWith("."),starTestDot=f4=>0!==f4.length&&"."!==f4&&".."!==f4,qmarksRE=/^\?+([^+@!?\*\[\(]*)?$/,qmarksTestNocase=([$0,ext2=""])=>{const noext=qmarksTestNoExt([$0]);if(!ext2)return noext;ext2=ext2.toLowerCase();return f4=>noext(f4)&&f4.toLowerCase().endsWith(ext2)},qmarksTestNocaseDot=([$0,ext2=""])=>{const noext=qmarksTestNoExtDot([$0]);if(!ext2)return noext;ext2=ext2.toLowerCase();return f4=>noext(f4)&&f4.toLowerCase().endsWith(ext2)},qmarksTestDot=([$0,ext2=""])=>{const noext=qmarksTestNoExtDot([$0]);return!ext2?noext:f4=>noext(f4)&&f4.endsWith(ext2)},qmarksTest=([$0,ext2=""])=>{const noext=qmarksTestNoExt([$0]);return!ext2?noext:f4=>noext(f4)&&f4.endsWith(ext2)},qmarksTestNoExt=([$0])=>{const len=$0.length;return f4=>f4.length===len&&!f4.startsWith(".")},qmarksTestNoExtDot=([$0])=>{const len=$0.length;return f4=>f4.length===len&&"."!==f4&&".."!==f4},defaultPlatform="object"==typeof process&&process?"object"==typeof process.env&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",path={win32:{sep:"\\"},posix:{sep:"/"}},sep="win32"===defaultPlatform?path.win32.sep:path.posix.sep;minimatch.sep=sep;var GLOBSTAR=Symbol("globstar **");minimatch.GLOBSTAR=GLOBSTAR;var qmark2="[^/]",star2=qmark2+"*?",twoStarDot="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",twoStarNoDot="(?:(?!(?:\\/|^)\\.).)*?",filter=(pattern,options={})=>p2=>minimatch(p2,pattern,options);minimatch.filter=filter;var ext=(a2,b3={})=>Object.assign({},a2,b3),defaults=def=>{if(!def||"object"!=typeof def||!Object.keys(def).length)return minimatch;const orig=minimatch;return Object.assign(((p2,pattern,options={})=>orig(p2,pattern,ext(def,options))),{Minimatch:class Minimatch extends orig.Minimatch{constructor(pattern,options={}){super(pattern,ext(def,options))}static defaults(options){return orig.defaults(ext(def,options)).Minimatch}},AST:class AST extends orig.AST{constructor(type,parent,options={}){super(type,parent,ext(def,options))}static fromGlob(pattern,options={}){return orig.AST.fromGlob(pattern,ext(def,options))}},unescape:(s2,options={})=>orig.unescape(s2,ext(def,options)),escape:(s2,options={})=>orig.escape(s2,ext(def,options)),filter:(pattern,options={})=>orig.filter(pattern,ext(def,options)),defaults:options=>orig.defaults(ext(def,options)),makeRe:(pattern,options={})=>orig.makeRe(pattern,ext(def,options)),braceExpand:(pattern,options={})=>orig.braceExpand(pattern,ext(def,options)),match:(list,pattern,options={})=>orig.match(list,pattern,ext(def,options)),sep:orig.sep,GLOBSTAR})};minimatch.defaults=defaults;var braceExpand=(pattern,options={})=>{assertValidPattern(pattern);if(options.nobrace||!/\{(?:(?!\{).)*\}/.test(pattern))return[pattern];else return(0,import_brace_expansion.default)(pattern)};minimatch.braceExpand=braceExpand;var makeRe=(pattern,options={})=>new Minimatch(pattern,options).makeRe();minimatch.makeRe=makeRe;var match=(list,pattern,options={})=>{const mm=new Minimatch(pattern,options);list=list.filter((f4=>mm.match(f4)));if(mm.options.nonull&&!list.length)list.push(pattern);return list};minimatch.match=match;var globMagic=/[?*]|[+@!]\(.*?\)|\[|\]/,regExpEscape2=s2=>s2.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Minimatch=class{constructor(pattern,options={}){__publicField(this,"options");__publicField(this,"set");__publicField(this,"pattern");__publicField(this,"windowsPathsNoEscape");__publicField(this,"nonegate");__publicField(this,"negate");__publicField(this,"comment");__publicField(this,"empty");__publicField(this,"preserveMultipleSlashes");__publicField(this,"partial");__publicField(this,"globSet");__publicField(this,"globParts");__publicField(this,"nocase");__publicField(this,"isWindows");__publicField(this,"platform");__publicField(this,"windowsNoMagicRoot");__publicField(this,"regexp");assertValidPattern(pattern);options=options||{};this.options=options;this.pattern=pattern;this.platform=options.platform||defaultPlatform;this.isWindows="win32"===this.platform;this.windowsPathsNoEscape=!!options.windowsPathsNoEscape||false===options.allowWindowsEscape;if(this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!options.preserveMultipleSlashes;this.regexp=null;this.negate=false;this.nonegate=!!options.nonegate;this.comment=false;this.empty=false;this.partial=!!options.partial;this.nocase=!!this.options.nocase;this.windowsNoMagicRoot=void 0!==options.windowsNoMagicRoot?options.windowsNoMagicRoot:!!(this.isWindows&&this.nocase);this.globSet=[];this.globParts=[];this.set=[];this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return true;for(const pattern of this.set)for(const part of pattern)if("string"!=typeof part)return true;return false}debug(..._){}make(){const pattern=this.pattern,options=this.options;if(!options.nocomment&&"#"===pattern.charAt(0)){this.comment=true;return}if(!pattern){this.empty=true;return}this.parseNegate();this.globSet=[...new Set(this.braceExpand())];if(options.debug)this.debug=(...args)=>console.error(...args);this.debug(this.pattern,this.globSet);const rawGlobParts=this.globSet.map((s2=>this.slashSplit(s2)));this.globParts=this.preprocess(rawGlobParts);this.debug(this.pattern,this.globParts);let set=this.globParts.map(((s2,_,__)=>{if(this.isWindows&&this.windowsNoMagicRoot){const isUNC=!(""!==s2[0]||""!==s2[1]||"?"!==s2[2]&&globMagic.test(s2[2])||globMagic.test(s2[3])),isDrive=/^[a-z]:/i.test(s2[0]);if(isUNC)return[...s2.slice(0,4),...s2.slice(4).map((ss=>this.parse(ss)))];else if(isDrive)return[s2[0],...s2.slice(1).map((ss=>this.parse(ss)))]}return s2.map((ss=>this.parse(ss)))}));this.debug(this.pattern,set);this.set=set.filter((s2=>-1===s2.indexOf(false)));if(this.isWindows)for(let i2=0;i2=2){globParts=this.firstPhasePreProcess(globParts);globParts=this.secondPhasePreProcess(globParts)}else if(optimizationLevel>=1)globParts=this.levelOneOptimize(globParts);else globParts=this.adjascentGlobstarOptimize(globParts);return globParts}adjascentGlobstarOptimize(globParts){return globParts.map((parts=>{let gs=-1;for(;-1!==(gs=parts.indexOf("**",gs+1));){let i2=gs;for(;"**"===parts[i2+1];)i2++;if(i2!==gs)parts.splice(gs,i2-gs)}return parts}))}levelOneOptimize(globParts){return globParts.map((parts=>0===(parts=parts.reduce(((set,part)=>{const prev=set[set.length-1];if("**"===part&&"**"===prev)return set;if(".."===part)if(prev&&".."!==prev&&"."!==prev&&"**"!==prev){set.pop();return set}set.push(part);return set}),[])).length?[""]:parts))}levelTwoFileOptimize(parts){if(!Array.isArray(parts))parts=this.slashSplit(parts);let didSomething=false;do{didSomething=false;if(!this.preserveMultipleSlashes){for(let i2=1;i2gs)parts.splice(gs+1,gss-gs);let next=parts[gs+1];const p2=parts[gs+2],p22=parts[gs+3];if(".."!==next)continue;if(!p2||"."===p2||".."===p2||!p22||"."===p22||".."===p22)continue;didSomething=true;parts.splice(gs,1);const other=parts.slice(0);other[gs]="**";globParts.push(other);gs--}if(!this.preserveMultipleSlashes){for(let i2=1;i2gs.length))}partsMatch(a2,b3,emptyGSMatch=false){let ai2=0,bi2=0,result=[],which="";for(;ai2fdi)pattern=pattern.slice(pdi);else if(fdi>pdi)file=file.slice(fdi)}}}const{optimizationLevel=1}=this.options;if(optimizationLevel>=2)file=this.levelTwoFileOptimize(file);this.debug("matchOne",this,{file,pattern});this.debug("matchOne",file.length,pattern.length);for(var fi=0,pi=0,fl2=file.length,pl=pattern.length;fi>> no match, partial?",file,fr,pattern,pr);if(fr===fl2)return true}return false}let hit;if("string"==typeof p2){hit=f4===p2;this.debug("string match",p2,f4,hit)}else{hit=p2.test(f4);this.debug("pattern match",p2,f4,hit)}if(!hit)return false}if(fi===fl2&&pi===pl)return true;else if(fi===fl2)return partial;else if(pi===pl)return fi===fl2-1&&""===file[fi];else throw new Error("wtf?")}braceExpand(){return braceExpand(this.pattern,this.options)}parse(pattern){assertValidPattern(pattern);const options=this.options;if("**"===pattern)return GLOBSTAR;if(""===pattern)return"";let m2,fastTest=null;if(m2=pattern.match(starRE))fastTest=options.dot?starTestDot:starTest;else if(m2=pattern.match(starDotExtRE))fastTest=(options.nocase?options.dot?starDotExtTestNocaseDot:starDotExtTestNocase:options.dot?starDotExtTestDot:starDotExtTest)(m2[1]);else if(m2=pattern.match(qmarksRE))fastTest=(options.nocase?options.dot?qmarksTestNocaseDot:qmarksTestNocase:options.dot?qmarksTestDot:qmarksTest)(m2);else if(m2=pattern.match(starDotStarRE))fastTest=options.dot?starDotStarTestDot:starDotStarTest;else if(m2=pattern.match(dotStarRE))fastTest=dotStarTest;const re=AST.fromGlob(pattern,this.options).toMMPattern();if(fastTest&&"object"==typeof re)Reflect.defineProperty(re,"test",{value:fastTest});return re}makeRe(){if(this.regexp||false===this.regexp)return this.regexp;const set=this.set;if(!set.length){this.regexp=false;return this.regexp}const options=this.options,twoStar=options.noglobstar?star2:options.dot?twoStarDot:twoStarNoDot,flags=new Set(options.nocase?["i"]:[]);let re=set.map((pattern=>{const pp=pattern.map((p2=>{if(p2 instanceof RegExp)for(const f4 of p2.flags.split(""))flags.add(f4);return"string"==typeof p2?regExpEscape2(p2):p2===GLOBSTAR?GLOBSTAR:p2._src}));pp.forEach(((p2,i2)=>{const next=pp[i2+1],prev=pp[i2-1];if(p2===GLOBSTAR&&prev!==GLOBSTAR)if(void 0===prev)if(void 0!==next&&next!==GLOBSTAR)pp[i2+1]="(?:\\/|"+twoStar+"\\/)?"+next;else pp[i2]=twoStar;else if(void 0===next)pp[i2-1]=prev+"(?:\\/|"+twoStar+")?";else if(next!==GLOBSTAR){pp[i2-1]=prev+"(?:\\/|\\/"+twoStar+"\\/)"+next;pp[i2+1]=GLOBSTAR}}));return pp.filter((p2=>p2!==GLOBSTAR)).join("/")})).join("|");const[open,close]=set.length>1?["(?:",")"]:["",""];re="^"+open+re+close+"$";if(this.negate)re="^(?!"+re+").+$";try{this.regexp=new RegExp(re,[...flags].join(""))}catch(ex){this.regexp=false}return this.regexp}slashSplit(p2){if(this.preserveMultipleSlashes)return p2.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(p2))return["",...p2.split(/\/+/)];else return p2.split(/\/+/)}match(f4,partial=this.partial){this.debug("match",f4,this.pattern);if(this.comment)return false;if(this.empty)return""===f4;if("/"===f4&&partial)return true;const options=this.options;if(this.isWindows)f4=f4.split("\\").join("/");const ff2=this.slashSplit(f4);this.debug(this.pattern,"split",ff2);const set=this.set;this.debug(this.pattern,"set",set);let filename=ff2[ff2.length-1];if(!filename)for(let i2=ff2.length-2;!filename&&i2>=0;i2--)filename=ff2[i2];for(let i2=0;i2base64ToArrayBufferInternalBrowser(e4))),len=bufItems.reduce(((p2,c2)=>p2+c2.byteLength),0),joinedArray=new Uint8Array(len);let offset=0;bufItems.forEach((e4=>{joinedArray.set(new Uint8Array(e4),offset);offset+=e4.byteLength}));return joinedArray.buffer}function base64ToArrayBufferInternalBrowser(base64){try{const binary_string=globalThis.atob(base64),len=binary_string.length,bytes=new Uint8Array(len);for(let i2=0;i2{const blob=new Blob([buffer],{type:"application/octet-binary"}),reader=new FileReader;reader.onload=function(evt){var _a5,_b2;const dataURI=(null==(_b2=null==(_a5=evt.target)?void 0:_a5.result)?void 0:_b2.toString())||"";if(0!=buffer.byteLength&&(""==dataURI||"data:"==dataURI))return rej(new TypeError("Could not parse the encoded string"));const result=dataURI.substring(dataURI.indexOf(",")+1);res2(result)};reader.readAsDataURL(blob)}))}async function arrayBufferToBase64Single(buffer){const buf=buffer instanceof Uint8Array?buffer:new Uint8Array(buffer);if(buf.byteLength128)return te.encode(string);const buffer=new Uint8Array(4*string.length),length=string.length;let index5=0,chr=0,idx2=0;for(;idx2>>6;buffer[index5++]=128|63&chr}else if(chr<55296||chr>57343){buffer[index5++]=224|chr>>>12;buffer[index5++]=128|chr>>>6&63;buffer[index5++]=128|63&chr}else{chr=65536+(chr-55296<<10|string.charCodeAt(idx2++)-56320);buffer[index5++]=240|chr>>>18;buffer[index5++]=128|chr>>>12&63;buffer[index5++]=128|chr>>>6&63;buffer[index5++]=128|63&chr}}return buffer.slice(0,index5)}function readString(buffer){const length=buffer.length;if(length>128)return td.decode(buffer);let index5=0;const end=length;let string="";for(;index5>>10),56320+(1023&code))}}}string+=String.fromCharCode(...chunk)}return string}function base64ToString(base64){try{if("string"!=typeof base64)return base64.map((e4=>base64ToString(e4))).join("");const binary_string=atob(base64),len=binary_string.length,bytes=new Uint8Array(len);for(let i2=0;i2{table[i2]=e4;revTable[e4]=i2}));async function encodeBinaryEach(buffer){const len=buffer.byteLength,out=new Uint16Array(buffer);for(let i2=0;i2=38&&char<=126&&58!=char);else out[i2]=table[char]}return await decodeAsync(out)}async function _encodeBinary(buffer){const len=buffer.length;if(len{const blob=new Blob([buffer],{type:"application/octet-binary"}),reader=new FileReader;reader.onload=function(evt){var _a5;const result=null==(_a5=evt.target)?void 0:_a5.result;if(!result)return rej("UTF-16 Parse error");else return res2(result)};reader.readAsText(blob,"utf-16")}))}function decodeToArrayBuffer(src){if(1==src.length)return _decodeToArrayBuffer(src[0]);const bufItems=src.map((e4=>_decodeToArrayBuffer(e4))),len=bufItems.reduce(((p2,c2)=>p2+c2.byteLength),0),joinedArray=new Uint8Array(len);let offset=0;bufItems.forEach((e4=>{joinedArray.set(new Uint8Array(e4),offset);offset+=e4.byteLength}));return joinedArray.buffer}function _decodeToArrayBuffer(src){const out=new Uint8Array(src.length),len=src.length;for(let i2=0;i2=38&&char<=126&&58!=char)out[i2]=char;else out[i2]=revTable[char]}return out.buffer}var revMap={},numMap={};for(let i2=0;i2<256;i2++){revMap[`00${i2.toString(16)}`.slice(-2)]=i2;numMap[i2]=`00${i2.toString(16)}`.slice(-2)}function hexStringToUint8Array(src){const len=src.length/2,ret=new Uint8Array(len);for(let i2=0;i2numMap[e4])).join("")}function concatUInt8Array(arrays){const length=arrays.reduce(((acc,cur)=>acc+cur.length),0),result=new Uint8Array(length);let pos=0;for(const array of arrays){result.set(array,pos);pos+=array.length}return result}function decodeBinary(src){if(0==src.length)return(new Uint8Array).buffer;if("string"==typeof src){if("%"===src[0])return _decodeToArrayBuffer(src.substring(1))}else if("%"===src[0][0]){const[head,...last]=src;return decodeToArrayBuffer([head.substring(1),...last])}return base64ToArrayBuffer(src)}async function encodeBinary(src){return await arrayBufferToBase64(src)}function replaceAll(str,search,replace){if("replaceAll"in String.prototype)return str.replaceAll(search,replace);else return str.split(search).join(replace)}function replaceAllPairs(str,...fromTo){let r2=`${str}`;for(const[from,to]of fromTo)r2=replaceAll(r2,from,to);return r2}function escapeStringToHTML(str){if(!str)return"";else return str.replace(/[<>&"'`]/g,(match3=>({"<":"<",">":">","&":"&",'"':""","'":"'","`":"`"}[match3])))}function versionNumberString2Number(version2){return version2.split(".").reverse().map(((e4,i2)=>e4/1*1e3**i2)).reduce(((prev,current)=>prev+current),0)}function isValidFilenameInWidows(filename){if(/[\u0000-\u001f]|[\\":?<>|*#]/g.test(filename))return false;if(/(\\|\/)(COM\d|LPT\d|CON|PRN|AUX|NUL|CLOCK$)($|\.)/gi.test(filename))return false;else return true}function isValidFilenameInDarwin(filename){return!/[\u0000-\u001f]|[:]/g.test(filename)}function isValidFilenameInLinux(filename){return!/[\u0000-\u001f]|[:]/g.test(filename)}function isValidFilenameInAndroid(filename){return!/[\u0000-\u001f]|[\\":?<>|*#]/g.test(filename)}function isFilePath(path2){if(-1===path2.indexOf(":"))return true;else return false}function stripAllPrefixes(prefixedPath){if(isFilePath(prefixedPath))return prefixedPath;const[,body]=expandFilePathPrefix(prefixedPath);return stripAllPrefixes(body)}function addPrefix(path2,prefix){if(prefix&&path2.startsWith(prefix))return path2;else return`${null!=prefix?prefix:""}${path2}`}function expandFilePathPrefix(path2){let[prefix,body]=path2.split(":",2);if(!body){body=prefix;prefix=""}else prefix+=":";return[prefix,body]}function expandDocumentIDPrefix(id){let[prefix,body]=id.split(":",2);if(!body){body=prefix;prefix=""}else prefix+=":";return[prefix,body]}var _hashString=memorizeFuncWithLRUCache((async key2=>{const buff=writeString(key2);let digest=await webcrypto.subtle.digest("SHA-256",buff);const len=key2.length;for(let i2=0;i2e4.trim())).filter((e4=>e4.length>0&&!e4.startsWith("#")));let result;for(const pattern of patterns){if(pattern.endsWith("/"))if(minimatch(path2,`${pattern}**`,matchOpts))return false;const newResult=pattern.startsWith("!");if(minimatch(path2,pattern,matchOpts)||!pattern.endsWith("/")&&minimatch(path2,pattern+"/**",matchOpts))result=newResult}return result}async function isAcceptedAll(path2,ignoreFiles,getList){const intermediatePaths=unique(path2.substring(0,path2.lastIndexOf("/")).split("/").reduce(((p2,c2)=>[...p2,p2[p2.length-1]+"/"+c2]),[""]).map((e4=>e4.substring(1)))).reverse();for(const intermediatePath of intermediatePaths)for(const ignoreFile of ignoreFiles){const ignoreFilePath=intermediatePath+"/"+ignoreFile,list=await getList(ignoreFilePath);if(false===list)continue;const result=isAccepted(path2.substring(intermediatePath.length?intermediatePath.length+1:0),list);if(void 0!==result)return result}return true}function makeUniqueString(){const temp=[...Array(30)].map((()=>Math.floor(52*Math.random()))).map((e4=>"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[e4])).join("");return`${Date.now()}-${temp}`}function Semaphore(limit,onRelease){let _limit=limit,currentProcesses=0,queue2=[];function execProcess(){queue2=queue2.filter((e4=>"DONE"!=e4.state));for(const queueItem of queue2)if("NONE"==queueItem.state){if(queueItem.quantity+currentProcesses>_limit)break;queueItem.state="RUNNING";currentProcesses+=queueItem.quantity;if(null==queueItem?void 0:queueItem.timer)clearTimeout(queueItem.timer);queueItem.notify(true)}}function release(key2){const finishedTask=queue2.find((e4=>e4.key==key2));if(!finishedTask)throw new Error("Missing locked semaphore!");if("RUNNING"==finishedTask.state)currentProcesses-=finishedTask.quantity;finishedTask.state="DONE";if(onRelease)onRelease(queue2.filter((e4=>"DONE"!=e4.state)));execProcess()}return{setLimit(limit2){_limit=limit2},_acquire(quantity,memo,timeout){const key2=makeUniqueString();if(_limit{};const semaphoreStopper=new Promise((res2=>{notify=result=>{if(result)res2((()=>{release(key2)}));else res2(false)}})),notifier={key:key2,notify,semaphoreStopper,quantity,memo,state:"NONE"};if(timeout)notifier.timer=setTimeout((()=>{release(key2);notify(false)}),timeout);queue2.push(notifier);execProcess();return semaphoreStopper},acquire(quantity=1,memo){return this._acquire(quantity,null!=memo?memo:"",0)},tryAcquire(quantity=1,timeout=1,memo){return this._acquire(quantity,null!=memo?memo:"",timeout)},peekQueues:()=>queue2}}var encryptionKey,webcrypto2=globalThis.crypto,SALT_STR="fancySyncForYou!",SALT=(new TextEncoder).encode(SALT_STR),previousPassphrase="";function resetV3Buf(){_nonceV3[0]=0;const _wk=webcrypto2.getRandomValues(new Uint8Array(12));bufV3.set(_wk);bufV3.set(_nonceV3,8)}var _nonceV3=new Uint32Array(1),bufV3=new Uint8Array(12);function incIV(){_nonceV3[0]++;bufV3.set(_nonceV3,8);if(_nonceV3[0]>1500)resetV3Buf();return bufV3}async function generateKey(passphrase){const passphraseBin=(new TextEncoder).encode(passphrase),salt=(await webcrypto2.subtle.digest("SHA-256",new Uint8Array([...passphraseBin,...SALT]))).slice(0,16),baseKey=await webcrypto2.subtle.importKey("raw",passphraseBin,"PBKDF2",false,["deriveBits","deriveKey"]),pbkdf2Params={name:"PBKDF2",hash:"SHA-256",salt,iterations:1e5};return await webcrypto2.subtle.deriveKey(pbkdf2Params,baseKey,{name:"AES-GCM",length:256},false,["decrypt","encrypt"])}async function encryptV3(input,passphrase){if(previousPassphrase!==passphrase){resetV3Buf();const key2=await generateKey(passphrase);encryptionKey=key2;previousPassphrase=passphrase}const iv=incIV(),dataBuf=writeString(input),encryptedDataArrayBuffer=await webcrypto2.subtle.encrypt({name:"AES-GCM",iv},encryptionKey,dataBuf),encryptedData2=""+await arrayBufferToBase64Single(new Uint8Array(encryptedDataArrayBuffer));return`%~${uint8ArrayToHexString(iv)}${encryptedData2}`}var decryptionKey,previousDecryptionPassphrase="";async function decryptV3(encryptedResult,passphrase){if(previousDecryptionPassphrase!==passphrase){const key2=await generateKey(passphrase);decryptionKey=key2;previousDecryptionPassphrase=passphrase}const ivStr=encryptedResult.substring(2,26),encryptedData=encryptedResult.substring(26),iv=hexStringToUint8Array(ivStr),encryptedDataArrayBuffer=base64ToArrayBuffer(encryptedData),dataBuffer=await webcrypto2.subtle.decrypt({name:"AES-GCM",iv},decryptionKey,encryptedDataArrayBuffer);return readString(new Uint8Array(dataBuffer))}var semiStaticFieldBuffer,KeyBuffs=new Map,decKeyBuffs=new Map,KEY_RECYCLE_COUNT=100,nonceBuffer=new Uint32Array(1),webcrypto3=globalThis.crypto;async function getKeyForEncrypt(passphrase,autoCalculateIterations){const buffKey=`${passphrase}-${autoCalculateIterations}`,f4=KeyBuffs.get(buffKey);if(f4){f4.count--;if(f4.count>0)return[f4.key,f4.salt];f4.count--}const passphraseLen=15-passphrase.length,iteration=autoCalculateIterations?1e3*(passphraseLen>0?passphraseLen:0)+121-passphraseLen:1e5,passphraseBin=(new TextEncoder).encode(passphrase),digest=await webcrypto3.subtle.digest({name:"SHA-256"},passphraseBin),keyMaterial=await webcrypto3.subtle.importKey("raw",digest,{name:"PBKDF2"},false,["deriveKey"]),salt=webcrypto3.getRandomValues(new Uint8Array(16)),key2=await webcrypto3.subtle.deriveKey({name:"PBKDF2",salt,iterations:iteration,hash:"SHA-256"},keyMaterial,{name:"AES-GCM",length:256},false,["encrypt"]);KeyBuffs.set(buffKey,{key:key2,salt,count:KEY_RECYCLE_COUNT});return[key2,salt]}var keyGCCount=5*KEY_RECYCLE_COUNT,decKeyIdx=0,decKeyMin=0;async function getKeyForDecryption(passphrase,salt,autoCalculateIterations){if(--keyGCCount<0){keyGCCount=KEY_RECYCLE_COUNT;const threshold=(decKeyIdx-decKeyMin)/2;for(const[key3,buff]of decKeyBuffs){if(buff.count0?passphraseLen:0)+121-passphraseLen:1e5,passphraseBin=(new TextEncoder).encode(passphrase),digest=await webcrypto3.subtle.digest({name:"SHA-256"},passphraseBin),keyMaterial=await webcrypto3.subtle.importKey("raw",digest,{name:"PBKDF2"},false,["deriveKey"]),key2=await webcrypto3.subtle.deriveKey({name:"PBKDF2",salt,iterations:iteration,hash:"SHA-256"},keyMaterial,{name:"AES-GCM",length:256},false,["decrypt"]);decKeyBuffs.set(bufKey,{key:key2,salt,count:0});return[key2,salt]}function getSemiStaticField(reset){if(null!=semiStaticFieldBuffer&&!reset)return semiStaticFieldBuffer;else return semiStaticFieldBuffer=webcrypto3.getRandomValues(new Uint8Array(12))}function getNonce(){nonceBuffer[0]++;if(nonceBuffer[0]>1e4)getSemiStaticField(true);return nonceBuffer}async function encryptV1(input,passphrase,autoCalculateIterations){const[key2,salt]=await getKeyForEncrypt(passphrase,autoCalculateIterations),fixedPart=getSemiStaticField(),invocationPart=getNonce(),iv=new Uint8Array([...fixedPart,...new Uint8Array(invocationPart.buffer)]),plainStringBuffer=writeString(JSON.stringify(input)),encryptedDataArrayBuffer=await webcrypto3.subtle.encrypt({name:"AES-GCM",iv},key2,plainStringBuffer);return`["${await arrayBufferToBase64Single(encryptedDataArrayBuffer)}","${uint8ArrayToHexString(iv)}","${uint8ArrayToHexString(salt)}"]`}async function encrypt(input,passphrase,autoCalculateIterations){const[key2,salt]=await getKeyForEncrypt(passphrase,autoCalculateIterations),fixedPart=getSemiStaticField(),invocationPart=getNonce(),iv=new Uint8Array([...fixedPart,...new Uint8Array(invocationPart.buffer)]),dataBuf=writeString(input),encryptedDataArrayBuffer=await webcrypto3.subtle.encrypt({name:"AES-GCM",iv},key2,dataBuf),encryptedData2=""+await arrayBufferToBase64Single(new Uint8Array(encryptedDataArrayBuffer));return`%${uint8ArrayToHexString(iv)}${uint8ArrayToHexString(salt)}${encryptedData2}`}async function getKeyForObfuscatePath(passphrase,dataBuf,autoCalculateIterations){const passphraseLen=15-passphrase.length,iteration=autoCalculateIterations?1e3*(passphraseLen>0?passphraseLen:0)+121-passphraseLen:1e5,passphraseBin=(new TextEncoder).encode(passphrase),digest=await webcrypto3.subtle.digest({name:"SHA-256"},passphraseBin),buf2=new Uint8Array(await webcrypto3.subtle.digest({name:"SHA-256"},new Uint8Array([...dataBuf,...passphraseBin]))),salt=buf2.slice(0,16),iv=buf2.slice(16,32),keyMaterial=await webcrypto3.subtle.importKey("raw",digest,{name:"PBKDF2"},false,["deriveKey"]);return[await webcrypto3.subtle.deriveKey({name:"PBKDF2",salt,iterations:iteration,hash:"SHA-256"},keyMaterial,{name:"AES-GCM",length:256},false,["encrypt"]),salt,iv]}async function obfuscatePath(path2,passphrase,autoCalculateIterations){const dataBuf=writeString(path2),[key2,salt,iv]=await getKeyForObfuscatePath(passphrase,dataBuf,autoCalculateIterations),encryptedDataArrayBuffer=await webcrypto3.subtle.encrypt({name:"AES-GCM",iv},key2,dataBuf),encryptedData2=await arrayBufferToBase64Single(new Uint8Array(encryptedDataArrayBuffer));return`%${uint8ArrayToHexString(iv)}${uint8ArrayToHexString(salt)}${encryptedData2}`}function isPathProbablyObfuscated(path2){return path2.startsWith("%")&&path2.length>64}async function decryptV2(encryptedResult,passphrase,autoCalculateIterations){try{const ivStr=encryptedResult.substring(1,33),salt=encryptedResult.substring(33,65),encryptedData=encryptedResult.substring(65),[key2]=await getKeyForDecryption(passphrase,hexStringToUint8Array(salt),autoCalculateIterations),iv=hexStringToUint8Array(ivStr),encryptedDataArrayBuffer=decodeBinary(encryptedData),dataBuffer=await webcrypto3.subtle.decrypt({name:"AES-GCM",iv},key2,encryptedDataArrayBuffer);return readString(new Uint8Array(dataBuffer))}catch(ex){Logger("Couldn't decode! You should wrong the passphrases (V2)",LOG_LEVEL_VERBOSE);Logger(ex,LOG_LEVEL_VERBOSE);throw ex}}async function decrypt(encryptedResult,passphrase,autoCalculateIterations){try{if("%"==encryptedResult[0])if("~"===encryptedResult[1])return decryptV3(encryptedResult,passphrase);else return decryptV2(encryptedResult,passphrase,autoCalculateIterations);if(!encryptedResult.startsWith("[")||!encryptedResult.endsWith("]"))throw new Error("Encrypted data corrupted!");const w2=encryptedResult.substring(1,encryptedResult.length-1).split(",").map((e4=>'"'==e4[0]?e4.substring(1,e4.length-1):e4)),[encryptedData,ivString,salt]=w2,[key2]=await getKeyForDecryption(passphrase,hexStringToUint8Array(salt),autoCalculateIterations),iv=hexStringToUint8Array(ivString),encryptedDataBin=atob(encryptedData),len=encryptedDataBin.length,encryptedDataArrayBuffer=new Uint8Array(len);for(let i2=len;i2>=0;--i2)encryptedDataArrayBuffer[i2]=encryptedDataBin.charCodeAt(i2);const plainStringBuffer=await webcrypto3.subtle.decrypt({name:"AES-GCM",iv},key2,encryptedDataArrayBuffer),plainStringified=readString(new Uint8Array(plainStringBuffer));return JSON.parse(plainStringified)}catch(ex){Logger("Couldn't decode! You should wrong the passphrases",LOG_LEVEL_VERBOSE);Logger(ex,LOG_LEVEL_VERBOSE);throw ex}}async function tryDecrypt(encryptedResult,passphrase,autoCalculateIterations){if(!passphrase)return false;try{return await decrypt(encryptedResult,passphrase,autoCalculateIterations)}catch(ex){return false}}async function testCryptV3(){const src="✨supercalifragilisticexpialidocious✨⛰️",encoded=await encryptV3(src,"passwordTest");if(src!=await decrypt(encoded,"passwordTest",false)){Logger("WARNING! Your device would not support encryption V3.",LOG_LEVEL_VERBOSE);return false}else{Logger("CRYPT LOGIC (V3) OK",LOG_LEVEL_VERBOSE);return true}}async function testCrypt(){const src="✨supercalifragilisticexpialidocious✨⛰️",encoded=await encrypt(src,"passwordTest",false);if(src!=await decrypt(encoded,"passwordTest",false)){Logger("WARNING! Your device would not support encryption.",LOG_LEVEL_VERBOSE);return false}else{Logger("CRYPT LOGIC OK",LOG_LEVEL_VERBOSE);const w2=(new TextEncoder).encode(src),encodedBinary=await encryptBinary(w2,"passwordTest",false),decryptedBinary=await decryptBinary(encodedBinary,"passwordTest",false);if(w2.join("-")!==decryptedBinary.join("-")){Logger("WARNING! Your device would not support encryption (Binary).",LOG_LEVEL_VERBOSE);return false}else Logger("CRYPT LOGIC OK (Binary)",LOG_LEVEL_VERBOSE);return await testCryptV3()}}async function encryptBinary(input,passphrase,autoCalculateIterations){const[key2,salt]=await getKeyForEncrypt(passphrase,autoCalculateIterations),fixedPart=getSemiStaticField(),invocationPart=getNonce(),iv=new Uint8Array([...fixedPart,...new Uint8Array(invocationPart.buffer)]),dataBuf=input,encryptedDataArrayBuffer=new Uint8Array(await webcrypto3.subtle.encrypt({name:"AES-GCM",iv},key2,dataBuf)),ret=new Uint8Array(encryptedDataArrayBuffer.byteLength+iv.byteLength+salt.byteLength);ret.set(iv,0);ret.set(salt,iv.byteLength);ret.set(encryptedDataArrayBuffer,iv.byteLength+salt.byteLength);return ret}async function decryptBinary(encryptedResult,passphrase,autoCalculateIterations){try{const iv=encryptedResult.slice(0,16),salt=encryptedResult.slice(16,32),encryptedData=encryptedResult.slice(32),[key2]=await getKeyForDecryption(passphrase,salt,autoCalculateIterations),dataBuffer=await webcrypto3.subtle.decrypt({name:"AES-GCM",iv},key2,encryptedData);return new Uint8Array(dataBuffer)}catch(ex){Logger("Couldn't decode! You should wrong the passphrases (V2 Bin)",LOG_LEVEL_VERBOSE);Logger(ex,LOG_LEVEL_VERBOSE);throw ex}}var delay=(ms,result)=>new Promise((res2=>{setTimeout((()=>{res2(result)}),ms)}));function polyfillPromiseWithResolvers(){let resolve,reject;return{promise:new Promise(((res2,rej)=>{resolve=res2;reject=rej})),resolve,reject}}function nativePromiseWithResolvers(){const p2=Promise.withResolvers(),{promise:promise2,resolve,reject}=p2;return{promise:promise2,resolve,reject}}var currentYieldingAnimationFrame,currentYieldingMicrotask,promiseWithResolver="withResolvers"in Promise?nativePromiseWithResolvers:polyfillPromiseWithResolvers,noop=()=>{};function fireAndForget(p2){if("function"==typeof p2)return fireAndForget(p2());p2.then(noop).catch(noop)}function yieldMicrotask(){return new Promise((res2=>queueMicrotask(res2)))}function yieldRequestIdleCallback(options){if(!("requestIdleCallback"in globalThis))return yieldMicrotask();else return new Promise((res2=>requestIdleCallback((()=>res2()),options)))}function yieldAnimationFrame(){return new Promise((res2=>requestAnimationFrame(res2)))}function yieldNextAnimationFrame(){if(currentYieldingAnimationFrame)return currentYieldingAnimationFrame;else return currentYieldingAnimationFrame=(async()=>{const ret=await yieldAnimationFrame();currentYieldingAnimationFrame=void 0;return ret})()}function yieldNextMicrotask(){if(currentYieldingMicrotask)return currentYieldingMicrotask;else return currentYieldingMicrotask=(async()=>{await yieldMicrotask();currentYieldingMicrotask=void 0})()}var EventHub=class{constructor(){this._emitter=new EventTarget}emitEvent(event,data){this._emitter.dispatchEvent(new CustomEvent(`${event.toString()}`,{detail:null!=data?data:void 0}))}on(event,callback){const onEvent=e4=>{callback(e4,e4 instanceof CustomEvent?e4.detail:void 0)},key2=`${event.toString()}`;this._emitter.addEventListener(key2,onEvent);return()=>this._emitter.removeEventListener(key2,onEvent)}onEvent(event,callback){return this.on(event,((_,data)=>{callback(data)}))}once(event,callback){const off=this.on(event,((e4,data)=>{off();callback(e4,data)}))}onceEvent(event,callback){this.once(event,callback)}waitFor(event){return new Promise((resolve=>{const off=this.on(event,((e4,data)=>{off();resolve(data)}))}))}},eventHub=new EventHub;function inlineWorker(scriptText){let blob=new Blob([scriptText],{type:"text/javascript"}),url=URL.createObjectURL(blob),worker=new Worker(url);URL.revokeObjectURL(url);return worker}function Worker2(){return inlineWorker('var O=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),pt=t=>{throw TypeError(t)};var T=function(t,e){this[0]=t,this[1]=e},I=(t,e,r)=>{var n=(a,s,c,l)=>{try{var f=r[a](s),y=(s=f.value)instanceof T,g=f.done;Promise.resolve(y?s[0]:s).then(d=>y?n(a==="return"?a:"next",s[1]?{done:d.done,value:d.value}:d,c,l):c({value:d,done:g})).catch(d=>n("throw",d,c,l))}catch(d){l(d)}},o=a=>i[a]=s=>new Promise((c,l)=>n(a,s,c,l)),i={};return r=r.apply(t,e),i[O("asyncIterator")]=()=>i,o("next"),o("throw"),o("return"),i},p=t=>{var e=t[O("asyncIterator")],r=!1,n,o={};return e==null?(e=t[O("iterator")](),n=i=>o[i]=a=>e[i](a)):(e=e.call(t),n=i=>o[i]=a=>{if(r){if(r=!1,i==="throw")throw a;return a}return r=!0,{done:!1,value:new T(new Promise(s=>{var c=e[i](a);c instanceof Object||pt("Object expected"),s(c)}),1)}}),o[O("iterator")]=()=>o,n("next"),"throw"in e?n("throw"):o.throw=i=>{throw i},"return"in e&&n("return"),o},P=(t,e,r)=>(e=t[O("asyncIterator")])?e.call(t):(t=t[O("iterator")](),e={},r=(n,o)=>(o=t[n])&&(e[n]=i=>new Promise((a,s,c)=>(i=o.call(t,i),c=i.done,Promise.resolve(i.value).then(l=>a({value:l,done:c}),s)))),r("next"),r("return"),e);var ht={minLogLevel:32},wt=function(e,r=32,n){if(rF(i)),r=e.reduce((i,a)=>i+a.byteLength,0),n=new Uint8Array(r),o=0;return e.forEach(i=>{n.set(new Uint8Array(i),o),o+=i.byteLength}),n.buffer}function F(t){try{let e=globalThis.atob(t),r=e.length,n=new Uint8Array(r);for(let o=0;o{let n=new Blob([t],{type:"application/octet-binary"}),o=new FileReader;o.onload=function(i){var c,l;let a=((l=(c=i.target)==null?void 0:c.result)==null?void 0:l.toString())||"";if(t.byteLength!=0&&(a==""||a=="data:"))return r(new TypeError("Could not parse the encoded string"));let s=a.substring(a.indexOf(",")+1);e(s)},o.readAsDataURL(n)})}async function E(t){let e=t instanceof Uint8Array?t:new Uint8Array(t);return e.byteLength128)return xt.encode(t);let e=new Uint8Array(t.length*4),r=t.length,n=0,o=0,i=0;for(;i>>6,e[n++]=128|o&63):o<55296||o>57343?(e[n++]=224|o>>>12,e[n++]=128|o>>>6&63,e[n++]=128|o&63):(o=(o-55296<<10|t.charCodeAt(i++)-56320)+65536,e[n++]=240|o>>>18,e[n++]=128|o>>>12&63,e[n++]=128|o>>>6&63,e[n++]=128|o&63);return e.slice(0,n)}function G(t){let e=t.length;if(e>128)return mt.decode(t);let r=0,n=e,o="";for(;r>>10)+55296,(c&1023)+56320))}}o+=String.fromCharCode(...i)}return o}function*Q(t,e){for(let r=t;r<=e;r++)yield r}var Qt=1024*1024*30,Bt={},Z={};[...Q(192,447)].forEach((t,e)=>{Bt[e]=t,Z[t]=e});function W(t){if(t.length==1)return v(t[0]);let e=t.map(i=>v(i)),r=e.reduce((i,a)=>i+a.byteLength,0),n=new Uint8Array(r),o=0;return e.forEach(i=>{n.set(new Uint8Array(i),o),o+=i.byteLength}),n.buffer}function v(t){let e=new Uint8Array(t.length),r=t.length;for(let n=0;n=38&&o<=126&&o!=58?e[n]=o:e[n]=Z[o]}return e.buffer}var z={},tt={};for(let t=0;t<256;t++)z[`00${t.toString(16)}`.slice(-2)]=t,tt[t]=`00${t.toString(16)}`.slice(-2);function A(t){let e=t.length/2,r=new Uint8Array(e);for(let n=0;ntt[e]).join("")}function R(t){if(t.length==0)return new Uint8Array().buffer;if(typeof t=="string"){if(t[0]==="%")return v(t.substring(1))}else if(t[0][0]==="%"){let[e,...r]=t;return W([e.substring(1),...r])}return C(t)}function nt(t){return t.type==="text/plain"}function*St(t,e){let r="";t:do{let n=t.shift();if(typeof n=="undefined"){yield r;break t}if(n.startsWith("```")||n.startsWith(" ```")||n.startsWith(" ```")||n.startsWith(" ```")){yield r,r=n+(t.length!=0?`\n`:"");e:do{let s=t.shift();if(typeof s=="undefined")break e;r+=s+(t.length!=0?`\n`:"")}while(t.length>0&&!(t[0].startsWith("```")||t[0].startsWith(" ```")||t[0].startsWith(" ```")||t[0].startsWith(" ```")));let o=r.endsWith("="),i=r.length>2048,a=t.shift();if(typeof a!="undefined"&&(r+=a,r+=t.length!=0?`\n`:""),!o&&!i){let s=/(.*?[;,:<])/g,c=r.split(s).filter(l=>l!="");for(let l of c)yield l}else yield r;r=""}else r+=n+(t.length!=0?`\n`:""),(r.length>=e||t.length==0||t[0]=="#"||r[0]=="#")&&(yield r,r="")}while(t.length>0)}var rt=10,ot="Segmenter"in Intl?new Intl.Segmenter(navigator.language,{granularity:"sentence"}):void 0;function*M(t,e){let r=t;do{let n=e,o=r.substring(0,n);r=r.substring(n),yield o}while(r!="")}function*et(t,e,r){let n=ot.segment(t),o="",i="";for(let a of n){let s=a.segment;o==s||i.length0&&(yield*p(M(i,e))),i=s)}i.length>0&&(yield*p(M(i,e)))}function*Gt(t){for(let e of t){let r=-1,n=-1;do{if(n=e.indexOf(`\n`,r),n==-1){yield e.substring(r);break}for(;e[n]==`\n`;)n++;yield e.substring(r,n),r=n}while(n!=-1)}}function _t(t,e,r){let o=Gt(typeof t=="string"?[t]:t),i=0,a=!1,s=!1;return function*(){let c=[];for(let l of o)l.startsWith("````")?i==0?(i=4,s=!0):i==4&&(i=0,a=!0):l.startsWith("```")&&(i==0?(i=3,s=!0):i==3&&(i=0,a=!0)),s&&(c.length>0&&(yield*p(et(c.join(""),e,r)),c.length=0),s=!1),c.push(l),a&&(c.length>0&&(yield*p(M(c.join(""),e)),c.length=0),a=!1);c.length>0&&(i==0?yield*p(et(c.join(""),e,r)):yield*p(M(c.join(""),e)))}}function Ut(t,e,r){return function*(){yield*p(M(t,e))}}function Ot(t,e,r,n,o){return!o||!ot?Ct(t,e,r,n):r?_t(t,e,n):Ut(t,e,n)}function Ct(t,e,r,n){let o=typeof t=="string"?[t]:t;return function*(){for(let a of o)if(r){let s=a.split(`\n`),c=St(s,n);for(let l of c){let f=l;do{let y=e;f.charCodeAt(y-1)!=f.codePointAt(y-1)&&y++,yield f.substring(0,y),f=f.substring(y)}while(f!="")}}else{let s=a;do{let c=e,l=s.substring(0,c);s=s.substring(c),yield l}while(s!="")}}}function*Vt(t,e,r=25,n){let o="",i=!1,a=e.length;for(let s of t){let c=s.length;if(n&&c>n){yield o+s,i=!1,o="";continue}let l=-1,f=0;t:do{if(l=s.indexOf(e,f),l==-1)break t;o+=s.slice(f,l)+e,o.length>r?(yield o,o="",i=!1):i=!0,f=l+a}while(le){let n=0;do{let o=n+e;if(o>r){yield t.substring(n);break}for(;t.charCodeAt(o-1)!=t.codePointAt(o-1);)o++;yield t.substring(n,o),n=o}while(nvt;)u+=n;let x=Ft([d]),m=Vt(x,`\n`,u),w=Mt(m,e);return function*(){yield*p(w)}}let a=!1,s=0;o&&o.endsWith(".pdf")?s=47:o&&o.endsWith(".json")&&(a=!0,s=44);let f=Math.max(a?100:1e5,Math.min(1e8,t.size)),y=1,g=f;for(;g>10;)g/=12.5,y++;return n=Math.floor(10**(y-1)),function(){return I(this,null,function*(){let U=t.size,u=0,x=new Uint8Array(yield new T(t.arrayBuffer()));do{let m=u+n,w=u+e,b,L=x.indexOf(s,m);L==-1&&(L=x.indexOf(rt,m)),L==-1?b=w:b=L10;)g/=12.5,y++;return n=Math.floor(10**(y-1)),function(){return I(this,null,function*(){let U=t.size,u=0;do{let x=e,m=new Uint8Array(yield new T(t.slice(u,u+e).arrayBuffer())),w=m.indexOf(a,n);x=w==-1?e:Math.min(e,w),w==-1&&(w=m.indexOf(rt,n));let b=m.slice(0,x);u+=b.length,yield yield new T(E(b))}while(u0)return[n.key,n.salt];n.count--}let o=15-t.length,i=e?(o>0?o:0)*1e3+121-o:1e5,a=new TextEncoder().encode(t),s=await h.subtle.digest({name:"SHA-256"},a),c=await h.subtle.importKey("raw",s,{name:"PBKDF2"},!1,["deriveKey"]),l=h.getRandomValues(new Uint8Array(16)),f=await h.subtle.deriveKey({name:"PBKDF2",salt:l,iterations:i,hash:"SHA-256"},c,{name:"AES-GCM",length:256},!1,["encrypt"]);return ut.set(r,{key:f,salt:l,count:Y}),[f,l]}var j=Y*5,k=0,yt=0;async function dt(t,e,r){if(j--,j<0){j=Y;let y=(k-yt)/2;for(let[g,d]of K)d.count0?i:0)*1e3+121-i:1e5,s=new TextEncoder().encode(t),c=await h.subtle.digest({name:"SHA-256"},s),l=await h.subtle.importKey("raw",c,{name:"PBKDF2"},!1,["deriveKey"]),f=await h.subtle.deriveKey({name:"PBKDF2",salt:e,iterations:a,hash:"SHA-256"},l,{name:"AES-GCM",length:256},!1,["decrypt"]);return K.set(n,{key:f,salt:e,count:0}),[f,e]}function gt(t){return N!=null&&!t||(N=h.getRandomValues(new Uint8Array(12))),N}function It(){return H[0]++,H[0]>1e4&>(!0),H}async function J(t,e,r){let[n,o]=await kt(e,r),i=gt(),a=It(),s=new Uint8Array([...i,...new Uint8Array(a.buffer)]),c=V(t),l=await h.subtle.encrypt({name:"AES-GCM",iv:s},n,c),f=""+await E(new Uint8Array(l));return`%${_(s)}${_(o)}${f}`}async function Pt(t,e,r){try{let n=t.substring(1,33),o=t.substring(33,65),i=t.substring(65),[a]=await dt(e,A(o),r),s=A(n),c=R(i),l=await h.subtle.decrypt({name:"AES-GCM",iv:s},a,c);return G(new Uint8Array(l))}catch(n){throw B("Couldn\'t decode! You should wrong the passphrases (V2)",16),B(n,16),n}}async function q(t,e,r){try{if(t[0]=="%")return t[1]==="~"?$(t,e):Pt(t,e,r);if(!t.startsWith("[")||!t.endsWith("]"))throw new Error("Encrypted data corrupted!");let n=t.substring(1,t.length-1).split(",").map(u=>u[0]==\'"\'?u.substring(1,u.length-1):u),[o,i,a]=n,[s]=await dt(e,A(a),r),c=A(i),l=atob(o),f=l.length,y=new Uint8Array(f);for(let u=f;u>=0;--u)y[u]=l.charCodeAt(u);let g=await h.subtle.decrypt({name:"AES-GCM",iv:c},s,y),d=G(new Uint8Array(g));return JSON.parse(d)}catch(n){throw B("Couldn\'t decode! You should wrong the passphrases",16),B(n,16),n}}async function Wt(t){let e=t.key,r=t.dataSrc,n=t.pieceSize,o=t.plainSplit,i=t.minimumChunkSize,a=t.filename,s=t.useSegmenter,l=await(t.useV2?st:at)(r,n,o,i,a,s),f=!1;try{for(var y=P(l()),g,d,U;g=!(d=await y.next()).done;g=!1){let u=d.value;f=!0,self.postMessage({key:e,result:u})}}catch(d){U=[d]}finally{try{g&&(d=y.return)&&await d.call(y)}finally{if(U)throw U[0]}}f||self.postMessage({key:e,result:""}),self.postMessage({key:e,result:null})}async function Rt(t){let e=t.key,{type:r,input:n,passphrase:o,autoCalculateIterations:i}=t;try{if(r=="encrypt"){let a=await J(n,o,i);self.postMessage({key:e,result:a})}else if(r=="decrypt"){let a=await q(n,o,i);self.postMessage({key:e,result:a})}}catch(a){self.postMessage({key:e,error:a})}}self.onmessage=t=>{let e=t.data.data;if(e.type==="split")return Wt(e);if(e.type==="encrypt"||e.type==="decrypt")return Rt(e);self.postMessage({key:e.key,error:new Error("Invalid type")})};\n')}var EVENT_LAYOUT_READY="layout-ready",EVENT_PLUGIN_LOADED="plugin-loaded",EVENT_PLUGIN_UNLOADED="plugin-unloaded",EVENT_SETTING_SAVED="setting-saved",EVENT_FILE_RENAMED="file-renamed",EVENT_FILE_SAVED="file-saved",EVENT_LEAF_ACTIVE_CHANGED="leaf-active-changed",EVENT_LOG_ADDED="log-added",EVENT_REQUEST_OPEN_SETTINGS="request-open-settings",EVENT_REQUEST_OPEN_SETTING_WIZARD="request-open-setting-wizard",EVENT_REQUEST_OPEN_SETUP_URI="request-open-setup-uri",EVENT_REQUEST_COPY_SETUP_URI="request-copy-setup-uri",EVENT_REQUEST_RELOAD_SETTING_TAB="reload-setting-tab",EVENT_REQUEST_OPEN_PLUGIN_SYNC_DIALOG="request-open-plugin-sync-dialog",tasks=new Map,maxConcurrency=~~((navigator.hardwareConcurrency||8)/2),roundRobinIdx=0,workers=Array.from({length:maxConcurrency},(()=>({worker:Worker2(),processing:0})));function handleTaskSplit(process2,data){const key2=data.key,task=process2.task;if("result"in data)if(null===data.result){task.resolve(null);tasks.delete(key2)}else{task.resolve(data.result);process2.task=promiseWithResolver()}else{if(data.error)task.reject(data.error);else task.reject(new Error("Unknown error in background splitting"));tasks.delete(key2)}}function handleTaskEncrypt(process2,data){const key2=data.key,task=process2.task;if("result"in data)task.resolve(data.result);else if(data.error)task.reject(data.error);else task.reject(new Error("Unknown error in background encryption"));tasks.delete(key2)}for(const inst of workers){inst.worker.onmessage=({data})=>{const key2=data.key,process2=tasks.get(key2);if(process2)if("split"===process2.type)handleTaskSplit(process2,data);else if("encrypt"===process2.type||"decrypt"===process2.type)handleTaskEncrypt(process2,data);else info("Invalid response type"+process2);else info(`Invalid key ${key2} of background processing`,LOG_KIND_ERROR)};inst.worker.onerror=()=>{inst.worker.terminate();workers.remove(inst)}}function terminateWorker(){for(const inst of workers)inst.worker.terminate()}function splitPieces2Worker(dataSrc,pieceSize,plainSplit,minimumChunkSize,filename,useSegmenter){return _splitPieces2Worker(dataSrc,pieceSize,plainSplit,minimumChunkSize,filename,false,null!=useSegmenter?useSegmenter:false)}function splitPieces2WorkerV2(dataSrc,pieceSize,plainSplit,minimumChunkSize,filename,useSegmenter){return _splitPieces2Worker(dataSrc,pieceSize,plainSplit,minimumChunkSize,filename,true,null!=useSegmenter?useSegmenter:false)}function encryptWorker(input,passphrase,autoCalculateIterations){return encryptionOnWorker({type:"encrypt",input,passphrase,autoCalculateIterations})}function decryptWorker(input,passphrase,autoCalculateIterations){return encryptionOnWorker({type:"decrypt",input,passphrase,autoCalculateIterations})}function startWorker(data){const _key=key++,inst=nextWorker(),item={key:_key,task:promiseWithResolver(),type:data.type,finalize:()=>{inst.processing--}};tasks.set(_key,item);inst.processing++;inst.worker.postMessage({data:{...data,key:_key}});return item}function encryptionOnWorker(data){const process2=startWorker(data);return(async()=>{const ret=await process2.task.promise;process2.finalize();return ret})()}function nextWorker(){const inst=workers[roundRobinIdx];roundRobinIdx=(roundRobinIdx+1)%workers.length;return inst}var key=0;function _splitPieces2Worker(dataSrc,pieceSize,plainSplit,minimumChunkSize,filename,useV2,useSegmenter){const process2=startWorker({type:"split",dataSrc,pieceSize,plainSplit,minimumChunkSize,filename,useV2,useSegmenter}),_key=process2.key;return async function*(){for(;tasks.has(_key);){const{task}=tasks.get(_key),result=await task.promise;if(null===result){process2.finalize();return}yield result}}}eventHub.onEvent(EVENT_PLUGIN_UNLOADED,(()=>{terminateWorker()}));var queueTails=new Map;async function performTask(queue2){if(!queue2.isRunning)try{queue2.isRunning=true;const ret=await queue2.task();queue2.resolver(ret)}catch(ex){queue2.rejector(ex)}finally{const next=queue2.next;queue2.isFinished=true;if(next)fireAndForget((async()=>{await yieldNextMicrotask(),performTask(next)}));else queueTails.delete(queue2.key)}}function _enqueue(key2,task,{swapIfExist,shareResult}={}){const t4=promiseWithResolver(),newQueue={task,resolver:t4.resolve,rejector:t4.reject,key:key2},prev=queueTails.get(key2);if(void 0===prev)queueTails.set(key2,newQueue);else{const current=prev;queueTails.set(key2,newQueue);current.next=newQueue;if(swapIfExist)current.rejector(new Error("Cancelled"))}if(!prev||prev.isFinished)fireAndForget((()=>performTask(newQueue)));return t4.promise}function serialized(key2,proc){return _enqueue(key2,proc)}function shareRunningResult(key2,proc){const current=queueTails.get(key2);if(!current)return _enqueue(key2,proc);let oldResolver=current.resolver,oldRejector=current.rejector;const resultP=promiseWithResolver();current.resolver=result=>{null==oldResolver||oldResolver(result);resultP.resolve(result)};current.rejector=result=>{null==oldRejector||oldRejector(result);resultP.reject(result)};resultP.promise.finally((()=>{oldResolver=void 0;oldRejector=void 0}));return resultP.promise}function skipIfDuplicated(key2,proc){if(void 0!==queueTails.get(key2))return Promise.resolve(null);else return _enqueue(key2,proc)}var waitingProcess=new Map;async function scheduleOnceIfDuplicated(key2,proc){if(!isLockAcquired(key2)){await serialized(key2,proc);if(waitingProcess.has(key2)){const nextProc=waitingProcess.get(key2);waitingProcess.delete(key2);scheduleOnceIfDuplicated(key2,nextProc)}}else waitingProcess.set(key2,proc)}function isLockAcquired(key2){return void 0!==queueTails.get(key2)}var Notifier=class{constructor(){Object.defineProperty(this,"_p",{enumerable:true,configurable:true,writable:true,value:promiseWithResolver()});Object.defineProperty(this,"isUsed",{enumerable:true,configurable:true,writable:true,value:false})}notify(){if(this.isUsed){this.isUsed=false;this._p.promise.finally(noop);this._p.resolve();this._p=promiseWithResolver()}}get nextNotify(){this.isUsed=true;return this._p.promise}},processNo=0,allRunningProcessors=new Set([]),QueueProcessor=class{get nowProcessing(){return this.processingEntities}get totalNowProcessing(){var _a5;return this.nowProcessing+((null==(_a5=this._pipeTo)?void 0:_a5.totalNowProcessing)||0)}get remaining(){return this._queue.length+this.processingEntities+this.waitingEntries}get totalRemaining(){var _a5;return this.remaining+((null==(_a5=this._pipeTo)?void 0:_a5.totalRemaining)||0)}updateStatus(setFunc){setFunc();this._updateReactiveSource()}suspend(){this._isSuspended=true;this._notifier.notify();return this}resume(){this._isSuspended=false;this._notifier.notify();this.requestNextFlush();this._run();return this}resumePipeLine(){var _a5;null==(_a5=this._pipeTo)||_a5.resumePipeLine();this.resume();return this}startPipeline(){this.root.resumePipeLine();return this}get root(){if(void 0===this._root)return this;else return this._root}constructor(processor,params,items,enqueueProcessor){var _a5,_b2,_c2,_d2,_e2,_f,_g;Object.defineProperty(this,"_queue",{enumerable:true,configurable:true,writable:true,value:[]});Object.defineProperty(this,"_processor",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_enqueueProcessor",{enumerable:true,configurable:true,writable:true,value:(queue2,entity)=>(queue2.push(entity),queue2)});Object.defineProperty(this,"_isSuspended",{enumerable:true,configurable:true,writable:true,value:true});Object.defineProperty(this,"_nextProcessNeedsImmediate",{enumerable:true,configurable:true,writable:true,value:false});Object.defineProperty(this,"_pipeTo",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_waitId",{enumerable:true,configurable:true,writable:true,value:""});Object.defineProperty(this,"_root",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_instance",{enumerable:true,configurable:true,writable:true,value:processNo++});Object.defineProperty(this,"_remainingReactiveSource",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_totalRemainingReactiveSource",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_processingEntitiesReactiveSource",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_keepResultUntilDownstreamConnected",{enumerable:true,configurable:true,writable:true,value:false});Object.defineProperty(this,"_keptResult",{enumerable:true,configurable:true,writable:true,value:[]});Object.defineProperty(this,"_runOnUpdateBatch",{enumerable:true,configurable:true,writable:true,value:()=>{}});Object.defineProperty(this,"concurrentLimit",{enumerable:true,configurable:true,writable:true,value:1});Object.defineProperty(this,"batchSize",{enumerable:true,configurable:true,writable:true,value:1});Object.defineProperty(this,"yieldThreshold",{enumerable:true,configurable:true,writable:true,value:1});Object.defineProperty(this,"delay",{enumerable:true,configurable:true,writable:true,value:0});Object.defineProperty(this,"maintainDelay",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"interval",{enumerable:true,configurable:true,writable:true,value:0});Object.defineProperty(this,"processingEntities",{enumerable:true,configurable:true,writable:true,value:0});Object.defineProperty(this,"waitingEntries",{enumerable:true,configurable:true,writable:true,value:0});Object.defineProperty(this,"_notifier",{enumerable:true,configurable:true,writable:true,value:new Notifier});Object.defineProperty(this,"_processingBatches",{enumerable:true,configurable:true,writable:true,value:new Set});Object.defineProperty(this,"addProcessingBatch",{enumerable:true,configurable:true,writable:true,value:value=>{const r2=this._processingBatches.add(value);this._updateBatchProcessStatus();return r2}});Object.defineProperty(this,"deleteProcessingBatch",{enumerable:true,configurable:true,writable:true,value:value=>{const r2=this._processingBatches.delete(value);this._updateBatchProcessStatus();return r2}});Object.defineProperty(this,"_processing",{enumerable:true,configurable:true,writable:true,value:false});this._root=this;this._processor=processor;this.batchSize=null!=(_a5=null==params?void 0:params.batchSize)?_a5:1;this.yieldThreshold=null!=(_c2=null!=(_b2=null==params?void 0:params.yieldThreshold)?_b2:null==params?void 0:params.batchSize)?_c2:0;this.concurrentLimit=null!=(_d2=null==params?void 0:params.concurrentLimit)?_d2:1;this.delay=null!=(_e2=null==params?void 0:params.delay)?_e2:0;this.maintainDelay=null!=(_f=null==params?void 0:params.maintainDelay)?_f:false;this.interval=null!=(_g=null==params?void 0:params.interval)?_g:0;if(null==params?void 0:params.keepResultUntilDownstreamConnected)this._keepResultUntilDownstreamConnected=params.keepResultUntilDownstreamConnected;if(null==params?void 0:params.remainingReactiveSource)this._remainingReactiveSource=null==params?void 0:params.remainingReactiveSource;if(null==params?void 0:params.totalRemainingReactiveSource)this._totalRemainingReactiveSource=null==params?void 0:params.totalRemainingReactiveSource;if(null==params?void 0:params.processingEntitiesReactiveSource)this._processingEntitiesReactiveSource=null==params?void 0:params.processingEntitiesReactiveSource;if(void 0!==(null==params?void 0:params.suspended))this._isSuspended=null==params?void 0:params.suspended;if(enqueueProcessor)this.replaceEnqueueProcessor(enqueueProcessor);if(void 0!==(null==params?void 0:params.pipeTo))this.pipeTo(params.pipeTo);if(items)this.enqueueAll(items);allRunningProcessors.add(this);this._run()}replaceEnqueueProcessor(processor){this._enqueueProcessor=processor;return this}modifyQueue(processor){this._queue=processor(this._queue);this._notifier.notify()}clearQueue(){this._queue=[];this._notifier.notify()}onUpdateProgress(proc){this._runOnUpdateBatch=proc;return this}pipeTo(pipeTo){this._pipeTo=pipeTo;this._pipeTo._root=this.root;if(this._keptResult.length>0){const temp=[...this._keptResult];this._keptResult=[];this._pipeTo.enqueueAll(temp)}return pipeTo}isIdle(){return this._isIdle()&&(!this._pipeTo?true:this._pipeTo.isIdle())}_isIdle(){return 0==this.totalRemaining}async _idleDetector(){if(this._isSuspended)return Promise.resolve();if(this._isIdle())return Promise.resolve();do{await Promise.race([delay(3e3),this._notifier.nextNotify])}while(!this._isIdle());return Promise.resolve()}idleDetectors(){const thisPromise=this._idleDetector();if(this._pipeTo)return[thisPromise,...this._pipeTo.idleDetectors()];else return[thisPromise]}get isSuspended(){var _a5;return this._isSuspended||(null==(_a5=this._pipeTo)?void 0:_a5.isSuspended)||false}_updateReactiveSource(){this.root.updateReactiveSource()}updateReactiveSource(){if(this._pipeTo)this._pipeTo.updateReactiveSource();if(this._remainingReactiveSource)this._remainingReactiveSource.value=this.remaining;if(this._totalRemainingReactiveSource)this._totalRemainingReactiveSource.value=this.totalRemaining;if(this._processingEntitiesReactiveSource)this._processingEntitiesReactiveSource.value=this.nowProcessing}_updateBatchProcessStatus(){this._updateReactiveSource();this._runOnUpdateBatch()}_collectBatch(){return this._queue.splice(0,this.batchSize)}_canCollectBatch(){return 0!==this._queue.length}enqueue(entity){this._queue=this._enqueueProcessor(this._queue,entity);this._updateBatchProcessStatus();this._notifier.notify();return this}enqueueAll(entities){let queue2=this._queue;for(const v2 of entities)queue2=this._enqueueProcessor(queue2,v2);this._queue=queue2;this._updateBatchProcessStatus();this._notifier.notify();return this}requestNextFlush(){if(this._canCollectBatch()){this._nextProcessNeedsImmediate=true;this._notifier.notify()}}flush(){if(!this._isSuspended){this.requestNextFlush();return this.waitForAllDownstream()}}async waitForAllDownstream(timeout){const baseTasks=[];if(timeout)baseTasks.push(delay(timeout,RESULT_TIMED_OUT));do{const idleTasks=this.idleDetectors(),tasks4=[...baseTasks,Promise.all(idleTasks)];if(await Promise.race(tasks4)===RESULT_TIMED_OUT)return false}while(!this.isIdle());return true}waitForAllProcessed(timeout){this.root.startPipeline();return this.root.waitForAllDownstream(timeout)}async waitForAllDoneAndTerminate(timeout){this.root.startPipeline();const r2=await this.root.waitForAllDownstream(timeout);this.terminateAll();return r2}async _runProcessor(items){const ret=await this._processor(items);if(ret)if(this._pipeTo)this._pipeTo.enqueueAll(ret);else if(this._keepResultUntilDownstreamConnected)this._keptResult.push(...ret)}async*pump(){let items,queueRunOut=true;do{await yieldNextMicrotask();if(this._canCollectBatch()){if(queueRunOut)await this.delayUntilRequested(this.delay);items=this._collectBatch();if(0!=items.length){yield items;if(this._canCollectBatch())queueRunOut=false}}else{queueRunOut=true;await Promise.race([this._notifier.nextNotify,delay(3e3)])}}while(this._canCollectBatch()&&!this._isSuspended)}async delayUntilRequested(delayMs){if(this._nextProcessNeedsImmediate){this._nextProcessNeedsImmediate=false;return}const delayTimer=delay(delayMs,RESULT_TIMED_OUT);let ret;do{ret=await Promise.race([this._notifier.nextNotify,delayTimer])}while(ret!==RESULT_TIMED_OUT&&false===this._nextProcessNeedsImmediate&&this.yieldThreshold>=this._queue.length);this._nextProcessNeedsImmediate=false}async _process(){if(this._processing&&this._isSuspended)return;let lastProcessBegin=0;try{this._processing=true;do{const batchPump=this.pump();for await(const batch of batchPump){const batchLength=batch.length;this.updateStatus((()=>{this.waitingEntries+=batchLength}));for(;this._processingBatches.size>=this.concurrentLimit;)await this._notifier.nextNotify;const key2=Date.now()+Math.random(),batchTask=async()=>{this.updateStatus((()=>{this.processingEntities+=batchLength;this.waitingEntries-=batchLength}));this.addProcessingBatch(key2);try{if(this.interval&&lastProcessBegin){const diff=Date.now()-lastProcessBegin;if(diff{this.processingEntities-=batchLength}));this._notifier.notify()}};this._notifier.notify();fireAndForget((async()=>{await yieldNextMicrotask();await batchTask()}))}await this._notifier.nextNotify}while(!this._isSuspended)}finally{this._processing=false}}_run(){if(!this._isSuspended)if(!this._processing)fireAndForget((()=>this._process()))}terminateAll(){this.root.terminate()}terminate(){if(this._pipeTo){this._pipeTo.terminate();this._pipeTo=void 0}this._isSuspended=true;this._enqueueProcessor=()=>[];this._processor=()=>Promise.resolve([]);this.clearQueue();this._notifier.notify();this._notifier.notify();this._notifier.notify();this._queue.length=0;allRunningProcessors.delete(this)}};function stopAllRunningProcessors(){const processors=[...allRunningProcessors];for(const processor of processors)processor.terminate()}var ch2={},wk=function(c2,id,msg,transfer,cb2){var w2=new Worker(ch2[id]||(ch2[id]=URL.createObjectURL(new Blob([c2+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));w2.onmessage=function(e4){var d4=e4.data,ed=d4.$e$;if(ed){var err2=new Error(ed[0]);err2["code"]=ed[1];err2.stack=ed[2];cb2(err2,null)}else cb2(null,d4)};w2.postMessage(msg,transfer);return w2},u8=Uint8Array,u16=Uint16Array,i32=Int32Array,fleb=new u8([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,0,0,0]),fdeb=new u8([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,0,0]),clim=new u8([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(eb,start){for(var b3=new u16(31),i2=0;i2<31;++i2)b3[i2]=start+=1<>1|(21845&i2)<<1))>>2|(13107&x2)<<2))>>4|(3855&x2)<<4;rev[i2]=((65280&x2)>>8|(255&x2)<<8)>>1}var hMap=function(cd2,mb,r2){for(var s2=cd2.length,i2=0,l2=new u16(mb);i2>rvb]=sv}else{co2=new u16(s2);for(i2=0;i2>15-cd2[i2]}return co2},flt=new u8(288);for(i2=0;i2<144;++i2)flt[i2]=8;for(i2=144;i2<256;++i2)flt[i2]=9;for(i2=256;i2<280;++i2)flt[i2]=7;for(i2=280;i2<288;++i2)flt[i2]=8;var fdt=new u8(32);for(i2=0;i2<32;++i2)fdt[i2]=5;var flm=hMap(flt,9,0),flrm=hMap(flt,9,1),fdm=hMap(fdt,5,0),fdrm=hMap(fdt,5,1),max=function(a2){for(var m2=a2[0],i2=1;i2m2)m2=a2[i2];return m2},bits=function(d4,p2,m2){var o2=p2/8|0;return(d4[o2]|d4[o2+1]<<8)>>(7&p2)&m2},bits16=function(d4,p2){var o2=p2/8|0;return(d4[o2]|d4[o2+1]<<8|d4[o2+2]<<16)>>(7&p2)},shft=function(p2){return(p2+7)/8|0},slc=function(v2,s2,e4){if(null==s2||s2<0)s2=0;if(null==e4||e4>v2.length)e4=v2.length;return new u8(v2.subarray(s2,e4))},FlateErrorCode={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14},ec=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],err=function(ind,msg,nt){var e4=new Error(msg||ec[ind]);e4.code=ind;if(Error.captureStackTrace)Error.captureStackTrace(e4,err);if(!nt)throw e4;return e4},inflt=function(dat,st,buf,dict){var sl=dat.length,dl=dict?dict.length:0;if(!sl||st.f&&!st.l)return buf||new u8(0);var noBuf=!buf,resize=noBuf||2!=st.i,noSt=st.i;if(noBuf)buf=new u8(3*sl);var cbuf=function(l3){var bl2=buf.length;if(l3>bl2){var nbuf=new u8(Math.max(2*bl2,l3));nbuf.set(buf);buf=nbuf}},final=st.f||0,pos=st.p||0,bt2=st.b||0,lm=st.l,dm=st.d,lbt=st.m,dbt=st.n,tbts=8*sl;do{if(!lm){final=bits(dat,pos,1);var type=bits(dat,pos+1,3);pos+=3;if(!type){var l2=dat[(s2=shft(pos)+4)-4]|dat[s2-3]<<8,t4=s2+l2;if(t4>sl){if(noSt)err(0);break}if(resize)cbuf(bt2+l2);buf.set(dat.subarray(s2,t4),bt2);st.b=bt2+=l2,st.p=pos=8*t4,st.f=final;continue}else if(1==type)lm=flrm,dm=fdrm,lbt=9,dbt=5;else if(2==type){var hLit=bits(dat,pos,31)+257,hcLen=bits(dat,pos+10,15)+4,tl=hLit+bits(dat,pos+5,31)+1;pos+=14;for(var ldt=new u8(tl),clt=new u8(19),i2=0;i2>4)<16)ldt[i2++]=s2;else{var c2=0,n3=0;if(16==s2)n3=3+bits(dat,pos,3),pos+=2,c2=ldt[i2-1];else if(17==s2)n3=3+bits(dat,pos,7),pos+=3;else if(18==s2)n3=11+bits(dat,pos,127),pos+=7;for(;n3--;)ldt[i2++]=c2}}var lt=ldt.subarray(0,hLit),dt=ldt.subarray(hLit);lbt=max(lt);dbt=max(dt);lm=hMap(lt,lbt,1);dm=hMap(dt,dbt,1)}else err(1);if(pos>tbts){if(noSt)err(0);break}}if(resize)cbuf(bt2+131072);for(var lms=(1<>4;if((pos+=15&c2)>tbts){if(noSt)err(0);break}if(!c2)err(2);if(sym<256)buf[bt2++]=sym;else if(256==sym){lpos=pos,lm=null;break}else{var add=sym-254;if(sym>264){var b3=fleb[i2=sym-257];add=bits(dat,pos,(1<>4;if(!d4)err(3);pos+=15&d4;dt=fd[dsym];if(dsym>3){b3=fdeb[dsym];dt+=bits16(dat,pos)&(1<tbts){if(noSt)err(0);break}if(resize)cbuf(bt2+131072);var end=bt2+add;if(bt2>8},wbits16=function(d4,p2,v2){v2<<=7&p2;var o2=p2/8|0;d4[o2]|=v2;d4[o2+1]|=v2>>8;d4[o2+2]|=v2>>16},hTree=function(d4,mb){for(var t4=[],i2=0;i2maxSym)maxSym=t22[i2].s;var tr=new u16(maxSym+1),mbt=ln(t4[i1-1],tr,0);if(mbt>mb){i2=0;var dt=0,lft=mbt-mb,cst=1<mb){dt+=cst-(1<>=lft;for(;dt>0;){var i2_2=t22[i2].s;if(tr[i2_2]=0&&dt;--i2){var i2_3=t22[i2].s;if(tr[i2_3]==mb){--tr[i2_3];++dt}}mbt=mb}return{t:new u8(tr),l:mbt}},ln=function(n3,l2,d4){return-1==n3.s?Math.max(ln(n3.l,l2,d4+1),ln(n3.r,l2,d4+1)):l2[n3.s]=d4},lc=function(c2){for(var s2=c2.length;s2&&!c2[--s2];);for(var cl2=new u16(++s2),cli=0,cln=c2[0],cls=1,w2=function(v2){cl2[cli++]=v2},i2=1;i2<=s2;++i2)if(c2[i2]==cln&&i2!=s2)++cls;else{if(!cln&&cls>2){for(;cls>138;cls-=138)w2(32754);if(cls>2){w2(cls>10?cls-11<<5|28690:cls-3<<5|12305);cls=0}}else if(cls>3){w2(cln),--cls;for(;cls>6;cls-=6)w2(8304);if(cls>2)w2(cls-3<<5|8208),cls=0}for(;cls--;)w2(cln);cls=1;cln=c2[i2]}return{c:cl2.subarray(0,cli),n:s2}},clen=function(cf2,cl2){for(var l2=0,i2=0;i2>8;out[o2+2]=255^out[o2];out[o2+3]=255^out[o2+1];for(var i2=0;i24&&!lct[clim[nlcc-1]];--nlcc);var lm,ll,dm,dl,flen=bl2+5<<3,ftlen=clen(lf,flt)+clen(df,fdt)+eb,dtlen=clen(lf,dlt)+clen(df,ddt)+eb+14+3*nlcc+clen(lcfreq,lct)+2*lcfreq[16]+3*lcfreq[17]+7*lcfreq[18];if(bs2>=0&&flen<=ftlen&&flen<=dtlen)return wfblk(out,p2,dat.subarray(bs2,bs2+bl2));wbits(out,p2,1+(dtlen15)wbits(out,p2,clct[i2]>>5&127),p2+=clct[i2]>>12}}}else lm=flm,ll=flt,dm=fdm,dl=fdt;for(i2=0;i2255){wbits16(out,p2,lm[257+(len=sym>>18&31)]),p2+=ll[len+257];if(len>7)wbits(out,p2,sym>>23&31),p2+=fleb[len];var dst=31&sym;wbits16(out,p2,dm[dst]),p2+=dl[dst];if(dst>3)wbits16(out,p2,sym>>5&8191),p2+=fdeb[dst]}else wbits16(out,p2,lm[sym]),p2+=ll[sym]}wbits16(out,p2,lm[256]);return p2+ll[256]},deo=new i32([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),et=new u8(0),dflt=function(dat,lvl,plvl,pre,post,st){var s2=st.z||dat.length,o2=new u8(pre+s2+5*(1+Math.ceil(s2/7e3))+post),w2=o2.subarray(pre,o2.length-post),lst=st.l,pos=7&(st.r||0);if(lvl){if(pos)w2[0]=st.r>>3;for(var opt=deo[lvl-1],n3=opt>>13,c2=8191&opt,msk_1=(1<7e3||li>24576)&&(rem>423||!lst)){pos=wblk(dat,w2,0,syms,lf,df,eb,li,bs2,i2-bs2,pos);li=lc_1=eb=0,bs2=i2;for(var j2=0;j2<286;++j2)lf[j2]=0;for(j2=0;j2<30;++j2)df[j2]=0}var l2=2,d4=0,ch_1=c2,dif=imod-pimod&32767;if(rem>2&&hv==hsh(i2-dif))for(var maxn=Math.min(n3,rem)-1,maxd=Math.min(32767,i2),ml=Math.min(258,rem);dif<=maxd&&--ch_1&&imod!=pimod;){if(dat[i2+l2]==dat[i2+l2-dif]){for(var nl=0;nll2){l2=nl,d4=dif;if(nl>maxn)break;var mmd=Math.min(dif,nl-2),md=0;for(j2=0;j2md)md=cd2,pimod=ti}}}dif+=(imod=pimod)-(pimod=prev[imod])&32767}if(d4){syms[li++]=268435456|revfl[l2]<<18|revfd[d4];var lin=31&revfl[l2],din=31&revfd[d4];eb+=fleb[lin]+fdeb[din];++lf[257+lin];++df[din];wi=i2+l2;++lc_1}else{syms[li++]=dat[i2];++lf[dat[i2]]}}}for(i2=Math.max(i2,wi);i2=s2){w2[pos/8|0]=lst;e4=s2}pos=wfblk(w2,pos+1,dat.subarray(i2,e4))}st.i=s2}return slc(o2,0,pre+shft(pos)+post)},crct=function(){for(var t4=new Int32Array(256),i2=0;i2<256;++i2){for(var c2=i2,k2=9;--k2;)c2=(1&c2&&-306674912)^c2>>>1;t4[i2]=c2}return t4}(),crc=function(){var c2=-1;return{p:function(d4){for(var cr2=c2,i2=0;i2>>8;c2=cr2},d:function(){return~c2}}},adler=function(){var a2=1,b3=0;return{p:function(d4){for(var n3=a2,m2=b3,l2=0|d4.length,i2=0;i2!=l2;){for(var e4=Math.min(i2+2655,l2);i2>16),m2=(65535&m2)+15*(m2>>16)}a2=n3,b3=m2},d:function(){return(255&(a2%=65521))<<24|(65280&a2)<<8|(255&(b3%=65521))<<8|b3>>8}}},dopt=function(dat,opt,pre,post,st){if(!st){st={l:1};if(opt.dictionary){var dict=opt.dictionary.subarray(-32768),newDat=new u8(dict.length+dat.length);newDat.set(dict);newDat.set(dat,dict.length);dat=newDat;st.w=dict.length}}return dflt(dat,null==opt.level?6:opt.level,null==opt.mem?st.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(dat.length)))):20:12+opt.mem,pre,post,st)},mrg=function(a2,b3){var o2={};for(var k2 in a2)o2[k2]=a2[k2];for(var k2 in b3)o2[k2]=b3[k2];return o2},wcln=function(fn,fnStr,td3){for(var dt=fn(),st=fn.toString(),ks=st.slice(st.indexOf("[")+1,st.lastIndexOf("]")).replace(/\s+/g,"").split(","),i2=0;i2>>0},b8=function(d4,b3){return b4(d4,b3)+4294967296*b4(d4,b3+4)},wbytes=function(d4,b3,v2){for(;v2;++b3)d4[b3]=v2,v2>>>=8},gzh=function(c2,o2){var fn=o2.filename;c2[0]=31,c2[1]=139,c2[2]=8,c2[8]=o2.level<2?4:9==o2.level?2:0,c2[9]=3;if(0!=o2.mtime)wbytes(c2,4,Math.floor(new Date(o2.mtime||Date.now())/1e3));if(fn){c2[3]=8;for(var i2=0;i2<=fn.length;++i2)c2[i2+10]=fn.charCodeAt(i2)}},gzs=function(d4){if(31!=d4[0]||139!=d4[1]||8!=d4[2])err(6,"invalid gzip data");var flg=d4[3],st=10;if(4&flg)st+=2+(d4[10]|d4[11]<<8);for(var zs=(flg>>3&1)+(flg>>4&1);zs>0;zs-=!d4[st++]);return st+(2&flg)},gzl=function(d4){var l2=d4.length;return(d4[l2-4]|d4[l2-3]<<8|d4[l2-2]<<16|d4[l2-1]<<24)>>>0},gzhl=function(o2){return 10+(o2.filename?o2.filename.length+1:0)},zlh=function(c2,o2){var lv=o2.level,fl2=0==lv?0:lv<6?1:9==lv?3:2;c2[0]=120,c2[1]=fl2<<6|(o2.dictionary&&32);c2[1]|=31-(c2[0]<<8|c2[1])%31;if(o2.dictionary){var h3=adler();h3.p(o2.dictionary);wbytes(c2,2,h3.d())}},zls=function(d4,dict){if(8!=(15&d4[0])||d4[0]>>4>7||(d4[0]<<8|d4[1])%31)err(6,"invalid zlib data");if((d4[1]>>5&1)==+!dict)err(6,"invalid zlib data: "+(32&d4[1]?"need":"unexpected")+" dictionary");return 2+(d4[1]>>3&4)};function StrmOpt(opts,cb2){if("function"==typeof opts)cb2=opts,opts={};this.ondata=cb2;return opts}var Deflate=function(){function Deflate2(opts,cb2){if("function"==typeof opts)cb2=opts,opts={};this.ondata=cb2;this.o=opts||{};this.s={l:0,i:32768,w:32768,z:32768};this.b=new u8(98304);if(this.o.dictionary){var dict=this.o.dictionary.subarray(-32768);this.b.set(dict,32768-dict.length);this.s.i=32768-dict.length}}Deflate2.prototype.p=function(c2,f4){this.ondata(dopt(c2,this.o,0,0,this.s),f4)};Deflate2.prototype.push=function(chunk,final){if(!this.ondata)err(5);if(this.s.l)err(4);var endLen=chunk.length+this.s.z;if(endLen>this.b.length){if(endLen>2*this.b.length-32768){var newBuf=new u8(-32768&endLen);newBuf.set(this.b.subarray(0,this.s.z));this.b=newBuf}var split=this.b.length-this.s.z;this.b.set(chunk.subarray(0,split),this.s.z);this.s.z=this.b.length;this.p(this.b,false);this.b.set(this.b.subarray(-32768));this.b.set(chunk.subarray(split),32768);this.s.z=chunk.length-split+32768;this.s.i=32766,this.s.w=32768}else{this.b.set(chunk,this.s.z);this.s.z+=chunk.length}this.s.l=1&final;if(this.s.z>this.s.w+8191||final){this.p(this.b,final||false);this.s.w=this.s.i,this.s.i-=2}};Deflate2.prototype.flush=function(){if(!this.ondata)err(5);if(this.s.l)err(4);this.p(this.b,false);this.s.w=this.s.i,this.s.i-=2};return Deflate2}(),AsyncDeflate=function(){return function AsyncDeflate2(opts,cb2){astrmify([bDflt,function(){return[astrm,Deflate]}],this,StrmOpt.call(this,opts,cb2),(function(ev){var strm=new Deflate(ev.data);onmessage=astrm(strm)}),6,1)}}();function deflate(data,opts,cb2){if(!cb2)cb2=opts,opts={};if("function"!=typeof cb2)err(7);return cbify(data,opts,[bDflt],(function(ev){return pbf(deflateSync(ev.data[0],ev.data[1]))}),0,cb2)}function deflateSync(data,opts){return dopt(data,opts||{},0,0)}var Inflate=function(){function Inflate2(opts,cb2){if("function"==typeof opts)cb2=opts,opts={};this.ondata=cb2;var dict=opts&&opts.dictionary&&opts.dictionary.subarray(-32768);this.s={i:0,b:dict?dict.length:0};this.o=new u8(32768);this.p=new u8(0);if(dict)this.o.set(dict)}Inflate2.prototype.e=function(c2){if(!this.ondata)err(5);if(this.d)err(4);if(!this.p.length)this.p=c2;else if(c2.length){var n3=new u8(this.p.length+c2.length);n3.set(this.p),n3.set(c2,this.p.length),this.p=n3}};Inflate2.prototype.c=function(final){this.s.i=+(this.d=final||false);var bts=this.s.b,dt=inflt(this.p,this.s,this.o);this.ondata(slc(dt,bts,this.s.b),this.d);this.o=slc(dt,this.s.b-32768),this.s.b=this.o.length;this.p=slc(this.p,this.s.p/8|0),this.s.p&=7};Inflate2.prototype.push=function(chunk,final){this.e(chunk),this.c(final)};return Inflate2}(),AsyncInflate=function(){return function AsyncInflate2(opts,cb2){astrmify([bInflt,function(){return[astrm,Inflate]}],this,StrmOpt.call(this,opts,cb2),(function(ev){var strm=new Inflate(ev.data);onmessage=astrm(strm)}),7,0)}}();function inflate(data,opts,cb2){if(!cb2)cb2=opts,opts={};if("function"!=typeof cb2)err(7);return cbify(data,opts,[bInflt],(function(ev){return pbf(inflateSync(ev.data[0],gopt(ev.data[1])))}),1,cb2)}function inflateSync(data,opts){return inflt(data,{i:2},opts&&opts.out,opts&&opts.dictionary)}var Gzip=function(){function Gzip2(opts,cb2){this.c=crc();this.l=0;this.v=1;Deflate.call(this,opts,cb2)}Gzip2.prototype.push=function(chunk,final){this.c.p(chunk);this.l+=chunk.length;Deflate.prototype.push.call(this,chunk,final)};Gzip2.prototype.p=function(c2,f4){var raw=dopt(c2,this.o,this.v&&gzhl(this.o),f4&&8,this.s);if(this.v)gzh(raw,this.o),this.v=0;if(f4)wbytes(raw,raw.length-8,this.c.d()),wbytes(raw,raw.length-4,this.l);this.ondata(raw,f4)};Gzip2.prototype.flush=function(){Deflate.prototype.flush.call(this)};return Gzip2}(),AsyncGzip=function(){return function AsyncGzip2(opts,cb2){astrmify([bDflt,gze,function(){return[astrm,Deflate,Gzip]}],this,StrmOpt.call(this,opts,cb2),(function(ev){var strm=new Gzip(ev.data);onmessage=astrm(strm)}),8,1)}}();function gzip(data,opts,cb2){if(!cb2)cb2=opts,opts={};if("function"!=typeof cb2)err(7);return cbify(data,opts,[bDflt,gze,function(){return[gzipSync]}],(function(ev){return pbf(gzipSync(ev.data[0],ev.data[1]))}),2,cb2)}function gzipSync(data,opts){if(!opts)opts={};var c2=crc(),l2=data.length;c2.p(data);var d4=dopt(data,opts,gzhl(opts),8),s2=d4.length;return gzh(d4,opts),wbytes(d4,s2-8,c2.d()),wbytes(d4,s2-4,l2),d4}var Gunzip=function(){function Gunzip2(opts,cb2){this.v=1;this.r=0;Inflate.call(this,opts,cb2)}Gunzip2.prototype.push=function(chunk,final){Inflate.prototype.e.call(this,chunk);this.r+=chunk.length;if(this.v){var p2=this.p.subarray(this.v-1),s2=p2.length>3?gzs(p2):4;if(s2>p2.length){if(!final)return}else if(this.v>1&&this.onmember)this.onmember(this.r-p2.length);this.p=p2.subarray(s2),this.v=0}Inflate.prototype.c.call(this,final);if(this.s.f&&!this.s.l&&!final){this.v=shft(this.s.p)+9;this.s={i:0};this.o=new u8(0);this.push(new u8(0),final)}};return Gunzip2}(),AsyncGunzip=function(){return function AsyncGunzip2(opts,cb2){var _this=this;astrmify([bInflt,guze,function(){return[astrm,Inflate,Gunzip]}],this,StrmOpt.call(this,opts,cb2),(function(ev){var strm=new Gunzip(ev.data);strm.onmember=function(offset){return postMessage(offset)};onmessage=astrm(strm)}),9,0,(function(offset){return _this.onmember&&_this.onmember(offset)}))}}();function gunzip(data,opts,cb2){if(!cb2)cb2=opts,opts={};if("function"!=typeof cb2)err(7);return cbify(data,opts,[bInflt,guze,function(){return[gunzipSync]}],(function(ev){return pbf(gunzipSync(ev.data[0],ev.data[1]))}),3,cb2)}function gunzipSync(data,opts){var st=gzs(data);if(st+8>data.length)err(6,"invalid gzip data");return inflt(data.subarray(st,-8),{i:2},opts&&opts.out||new u8(gzl(data)),opts&&opts.dictionary)}var Zlib=function(){function Zlib2(opts,cb2){this.c=adler();this.v=1;Deflate.call(this,opts,cb2)}Zlib2.prototype.push=function(chunk,final){this.c.p(chunk);Deflate.prototype.push.call(this,chunk,final)};Zlib2.prototype.p=function(c2,f4){var raw=dopt(c2,this.o,this.v&&(this.o.dictionary?6:2),f4&&4,this.s);if(this.v)zlh(raw,this.o),this.v=0;if(f4)wbytes(raw,raw.length-4,this.c.d());this.ondata(raw,f4)};Zlib2.prototype.flush=function(){Deflate.prototype.flush.call(this)};return Zlib2}(),AsyncZlib=function(){return function AsyncZlib2(opts,cb2){astrmify([bDflt,zle,function(){return[astrm,Deflate,Zlib]}],this,StrmOpt.call(this,opts,cb2),(function(ev){var strm=new Zlib(ev.data);onmessage=astrm(strm)}),10,1)}}();function zlib(data,opts,cb2){if(!cb2)cb2=opts,opts={};if("function"!=typeof cb2)err(7);return cbify(data,opts,[bDflt,zle,function(){return[zlibSync]}],(function(ev){return pbf(zlibSync(ev.data[0],ev.data[1]))}),4,cb2)}function zlibSync(data,opts){if(!opts)opts={};var a2=adler();a2.p(data);var d4=dopt(data,opts,opts.dictionary?6:2,4);return zlh(d4,opts),wbytes(d4,d4.length-4,a2.d()),d4}var Unzlib=function(){function Unzlib2(opts,cb2){Inflate.call(this,opts,cb2);this.v=opts&&opts.dictionary?2:1}Unzlib2.prototype.push=function(chunk,final){Inflate.prototype.e.call(this,chunk);if(this.v){if(this.p.length<6&&!final)return;this.p=this.p.subarray(zls(this.p,this.v-1)),this.v=0}if(final){if(this.p.length<4)err(6,"invalid zlib data");this.p=this.p.subarray(0,-4)}Inflate.prototype.c.call(this,final)};return Unzlib2}(),AsyncUnzlib=function(){return function AsyncUnzlib2(opts,cb2){astrmify([bInflt,zule,function(){return[astrm,Inflate,Unzlib]}],this,StrmOpt.call(this,opts,cb2),(function(ev){var strm=new Unzlib(ev.data);onmessage=astrm(strm)}),11,0)}}();function unzlib(data,opts,cb2){if(!cb2)cb2=opts,opts={};if("function"!=typeof cb2)err(7);return cbify(data,opts,[bInflt,zule,function(){return[unzlibSync]}],(function(ev){return pbf(unzlibSync(ev.data[0],gopt(ev.data[1])))}),5,cb2)}function unzlibSync(data,opts){return inflt(data.subarray(zls(data,opts&&opts.dictionary),-4),{i:2},opts&&opts.out,opts&&opts.dictionary)}var Decompress=function(){function Decompress2(opts,cb2){this.o=StrmOpt.call(this,opts,cb2)||{};this.G=Gunzip;this.I=Inflate;this.Z=Unzlib}Decompress2.prototype.i=function(){var _this=this;this.s.ondata=function(dat,final){_this.ondata(dat,final)}};Decompress2.prototype.push=function(chunk,final){if(!this.ondata)err(5);if(!this.s){if(this.p&&this.p.length){var n3=new u8(this.p.length+chunk.length);n3.set(this.p),n3.set(chunk,this.p.length)}else this.p=chunk;if(this.p.length>2){this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(this.o):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o);this.i();this.s.push(this.p,final);this.p=null}}else this.s.push(chunk,final)};return Decompress2}(),AsyncDecompress=function(){function AsyncDecompress2(opts,cb2){Decompress.call(this,opts,cb2);this.queuedSize=0;this.G=AsyncGunzip;this.I=AsyncInflate;this.Z=AsyncUnzlib}AsyncDecompress2.prototype.i=function(){var _this=this;this.s.ondata=function(err2,dat,final){_this.ondata(err2,dat,final)};this.s.ondrain=function(size){_this.queuedSize-=size;if(_this.ondrain)_this.ondrain(size)}};AsyncDecompress2.prototype.push=function(chunk,final){this.queuedSize+=chunk.length;Decompress.prototype.push.call(this,chunk,final)};return AsyncDecompress2}();function decompress(data,opts,cb2){if(!cb2)cb2=opts,opts={};if("function"!=typeof cb2)err(7);return 31==data[0]&&139==data[1]&&8==data[2]?gunzip(data,opts,cb2):8!=(15&data[0])||data[0]>>4>7||(data[0]<<8|data[1])%31?inflate(data,opts,cb2):unzlib(data,opts,cb2)}function decompressSync(data,opts){return 31==data[0]&&139==data[1]&&8==data[2]?gunzipSync(data,opts):8!=(15&data[0])||data[0]>>4>7||(data[0]<<8|data[1])%31?inflateSync(data,opts):unzlibSync(data,opts)}var fltn=function(d4,p2,t4,o2){for(var k2 in d4){var val2=d4[k2],n3=p2+k2,op=o2;if(Array.isArray(val2))op=mrg(o2,val2[1]),val2=val2[0];if(val2 instanceof u8)t4[n3]=[val2,op];else{t4[n3+="/"]=[new u8(0),op];fltn(val2,n3,t4,o2)}}},te2="undefined"!=typeof TextEncoder&&new TextEncoder,td2="undefined"!=typeof TextDecoder&&new TextDecoder,tds=0;try{td2.decode(et,{stream:true});tds=1}catch(e4){}var dutf8=function(d4){for(var r2="",i2=0;;){var c2=d4[i2++],eb=(c2>127)+(c2>223)+(c2>239);if(i2+eb>d4.length)return{s:r2,r:slc(d4,i2-1)};if(!eb)r2+=String.fromCharCode(c2);else if(3==eb)c2=((15&c2)<<18|(63&d4[i2++])<<12|(63&d4[i2++])<<6|63&d4[i2++])-65536,r2+=String.fromCharCode(55296|c2>>10,56320|1023&c2);else if(1&eb)r2+=String.fromCharCode((31&c2)<<6|63&d4[i2++]);else r2+=String.fromCharCode((15&c2)<<12|(63&d4[i2++])<<6|63&d4[i2++])}},DecodeUTF8=function(){function DecodeUTF82(cb2){this.ondata=cb2;if(tds)this.t=new TextDecoder;else this.p=et}DecodeUTF82.prototype.push=function(chunk,final){if(!this.ondata)err(5);final=!!final;if(!this.t){if(!this.p)err(4);var dat=new u8(this.p.length+chunk.length);dat.set(this.p);dat.set(chunk,this.p.length);var _a5=dutf8(dat),s2=_a5.s,r2=_a5.r;if(final){if(r2.length)err(8);this.p=null}else this.p=r2;this.ondata(s2,final)}else{this.ondata(this.t.decode(chunk,{stream:true}),final);if(final){if(this.t.decode().length)err(8);this.t=null}}};return DecodeUTF82}(),EncodeUTF8=function(){function EncodeUTF82(cb2){this.ondata=cb2}EncodeUTF82.prototype.push=function(chunk,final){if(!this.ondata)err(5);if(this.d)err(4);this.ondata(strToU8(chunk),this.d=final||false)};return EncodeUTF82}();function strToU8(str,latin1){if(latin1){for(var ar_1=new u8(str.length),i2=0;i2>1)),ai2=0,w2=function(v2){ar2[ai2++]=v2};for(i2=0;i2ar2.length){var n3=new u8(ai2+8+(l2-i2<<1));n3.set(ar2);ar2=n3}var c2=str.charCodeAt(i2);if(c2<128||latin1)w2(c2);else if(c2<2048)w2(192|c2>>6),w2(128|63&c2);else if(c2>55295&&c2<57344)w2(240|(c2=65536+(1047552&c2)|1023&str.charCodeAt(++i2))>>18),w2(128|c2>>12&63),w2(128|c2>>6&63),w2(128|63&c2);else w2(224|c2>>12),w2(128|c2>>6&63),w2(128|63&c2)}return slc(ar2,0,ai2)}function strFromU8(dat,latin1){if(latin1){for(var r2="",i2=0;i265535)err(9);le+=l2+4}return le},wzh=function(d4,b3,f4,fn,u2,c2,ce2,co2){var fl2=fn.length,ex=f4.extra,col=co2&&co2.length,exl=exfl(ex);wbytes(d4,b3,null!=ce2?33639248:67324752),b3+=4;if(null!=ce2)d4[b3++]=20,d4[b3++]=f4.os;d4[b3]=20,b3+=2;d4[b3++]=f4.flag<<1|(c2<0&&8),d4[b3++]=u2&&8;d4[b3++]=255&f4.compression,d4[b3++]=f4.compression>>8;var dt=new Date(null==f4.mtime?Date.now():f4.mtime),y2=dt.getFullYear()-1980;if(y2<0||y2>119)err(10);wbytes(d4,b3,y2<<25|dt.getMonth()+1<<21|dt.getDate()<<16|dt.getHours()<<11|dt.getMinutes()<<5|dt.getSeconds()>>1),b3+=4;if(-1!=c2){wbytes(d4,b3,f4.crc);wbytes(d4,b3+4,c2<0?-c2-2:c2);wbytes(d4,b3+8,f4.size)}wbytes(d4,b3+12,fl2);wbytes(d4,b3+14,exl),b3+=16;if(null!=ce2){wbytes(d4,b3,col);wbytes(d4,b3+6,f4.attrs);wbytes(d4,b3+10,ce2),b3+=14}d4.set(fn,b3);b3+=fl2;if(exl)for(var k2 in ex){var exf=ex[k2],l2=exf.length;wbytes(d4,b3,+k2);wbytes(d4,b3+2,l2);d4.set(exf,b3+4),b3+=4+l2}if(col)d4.set(co2,b3),b3+=col;return b3},wzf=function(o2,b3,c2,d4,e4){wbytes(o2,b3,101010256);wbytes(o2,b3+8,c2);wbytes(o2,b3+10,c2);wbytes(o2,b3+12,d4);wbytes(o2,b3+16,e4)},ZipPassThrough=function(){function ZipPassThrough2(filename){this.filename=filename;this.c=crc();this.size=0;this.compression=0}ZipPassThrough2.prototype.process=function(chunk,final){this.ondata(null,chunk,final)};ZipPassThrough2.prototype.push=function(chunk,final){if(!this.ondata)err(5);this.c.p(chunk);this.size+=chunk.length;if(final)this.crc=this.c.d();this.process(chunk,final||false)};return ZipPassThrough2}(),ZipDeflate=function(){function ZipDeflate2(filename,opts){var _this=this;if(!opts)opts={};ZipPassThrough.call(this,filename);this.d=new Deflate(opts,(function(dat,final){_this.ondata(null,dat,final)}));this.compression=8;this.flag=dbf(opts.level)}ZipDeflate2.prototype.process=function(chunk,final){try{this.d.push(chunk,final)}catch(e4){this.ondata(e4,null,final)}};ZipDeflate2.prototype.push=function(chunk,final){ZipPassThrough.prototype.push.call(this,chunk,final)};return ZipDeflate2}(),AsyncZipDeflate=function(){function AsyncZipDeflate2(filename,opts){var _this=this;if(!opts)opts={};ZipPassThrough.call(this,filename);this.d=new AsyncDeflate(opts,(function(err2,dat,final){_this.ondata(err2,dat,final)}));this.compression=8;this.flag=dbf(opts.level);this.terminate=this.d.terminate}AsyncZipDeflate2.prototype.process=function(chunk,final){this.d.push(chunk,final)};AsyncZipDeflate2.prototype.push=function(chunk,final){ZipPassThrough.prototype.push.call(this,chunk,final)};return AsyncZipDeflate2}(),Zip=function(){function Zip2(cb2){this.ondata=cb2;this.u=[];this.d=1}Zip2.prototype.add=function(file){var _this=this;if(!this.ondata)err(5);if(2&this.d)this.ondata(err(4+8*(1&this.d),0,1),null,false);else{var f4=strToU8(file.filename),fl_1=f4.length,com=file.comment,o2=com&&strToU8(com),u2=fl_1!=file.filename.length||o2&&com.length!=o2.length,hl_1=fl_1+exfl(file.extra)+30;if(fl_1>65535)this.ondata(err(11,0,1),null,false);var header=new u8(hl_1);wzh(header,0,file,f4,u2,-1);var chks_1=[header],pAll_1=function(){for(var _i2=0,chks_2=chks_1;_i265535)cbl(err(11,0,1),null);if(!compression)cbl(null,file);else if(size<16e4)try{cbl(null,deflateSync(file,p2))}catch(e4){cbl(e4,null)}else term.push(deflate(file,p2,cbl))},i2=0;i265535)err(11);var d4=compression?deflateSync(file,p2):file,l2=d4.length,c2=crc();c2.p(file);files.push(mrg(p2,{size:file.length,crc:c2.d(),c:d4,f:f4,m:m2,u:s2!=fn.length||m2&&com.length!=ms,o:o2,compression}));o2+=30+s2+exl+l2;tot+=76+2*(s2+exl)+(ms||0)+l2}for(var out=new u8(tot+22),oe=o2,cdl=tot-o2,i2=0;i20){var len=Math.min(this.c,chunk.length),toAdd=chunk.subarray(0,len);this.c-=len;if(this.d)this.d.push(toAdd,!this.c);else this.k[0].push(toAdd);if((chunk=chunk.subarray(len)).length)return this.push(chunk,final)}else{var f4=0,i2=0,is=void 0,buf=void 0;if(!this.p.length)buf=chunk;else if(!chunk.length)buf=this.p;else(buf=new u8(this.p.length+chunk.length)).set(this.p),buf.set(chunk,this.p.length);for(var l2=buf.length,oc=this.c,add=oc&&this.d,_loop_2=function(){var _a5,sig=b4(buf,i2);if(67324752==sig){f4=1,is=i2;this_1.d=null;this_1.c=0;var bf2=b2(buf,i2+6),cmp_1=b2(buf,i2+8),u2=2048&bf2,dd=8&bf2,fnl=b2(buf,i2+26),es=b2(buf,i2+28);if(l2>i2+30+fnl+es){var chks_3=[];this_1.k.unshift(chks_3);f4=2;var d_1,sc_1=b4(buf,i2+18),su_1=b4(buf,i2+22),fn_1=strFromU8(buf.subarray(i2+30,i2+=30+fnl),!u2);if(4294967295==sc_1)_a5=dd?[-2]:z64e(buf,i2),sc_1=_a5[0],su_1=_a5[1];else if(dd)sc_1=-1;i2+=es;this_1.c=sc_1;var file_1={name:fn_1,compression:cmp_1,start:function(){if(!file_1.ondata)err(5);if(!sc_1)file_1.ondata(null,et,true);else{var ctr=_this.o[cmp_1];if(!ctr)file_1.ondata(err(14,"unknown compression type "+cmp_1,1),null,false);(d_1=sc_1<0?new ctr(fn_1):new ctr(fn_1,sc_1,su_1)).ondata=function(err2,dat3,final2){file_1.ondata(err2,dat3,final2)};for(var _i2=0,chks_4=chks_3;_i2=0)file_1.size=sc_1,file_1.originalSize=su_1;this_1.onfile(file_1)}return"break"}else if(oc)if(134695760==sig){is=i2+=12+(-2==oc&&8),f4=3,this_1.c=0;return"break"}else if(33639248==sig){is=i2-=4,f4=3,this_1.c=0;return"break"}},this_1=this;i265558){cbd(err(13,0,1),null);return tAll}var lft=b2(data,e4+8);if(lft){var c2=lft,o2=b4(data,e4+16),z2=4294967295==o2||65535==c2;if(z2){var ze=b4(data,e4-12);if(z2=101075792==b4(data,ze)){c2=lft=b4(data,ze+32);o2=b4(data,ze+48)}}for(var fltr=opts&&opts.filter,_loop_3=function(i3){var _a5=zh(data,o2,z2),c_1=_a5[0],sc=_a5[1],su=_a5[2],fn=_a5[3],no=_a5[4],off=_a5[5],b3=slzh(data,off);o2=no;var cbl=function(e5,d4){if(e5){tAll();cbd(e5,null)}else{if(d4)files[fn]=d4;if(! --lft)cbd(null,files)}};if(!fltr||fltr({name:fn,size:sc,originalSize:su,compression:c_1}))if(!c_1)cbl(null,slc(data,b3,b3+sc));else if(8==c_1){var infl=data.subarray(b3,b3+sc);if(su<524288||sc>.8*su)try{cbl(null,inflateSync(infl,{out:new u8(su)}))}catch(e5){cbl(e5,null)}else term.push(inflate(infl,{size:su},cbl))}else cbl(err(14,"unknown compression type "+c_1,1),null);else cbl(null,null)},i2=0;i265558)err(13);var c2=b2(data,e4+8);if(!c2)return{};var o2=b4(data,e4+16),z2=4294967295==o2||65535==c2;if(z2){var ze=b4(data,e4-12);if(z2=101075792==b4(data,ze)){c2=b4(data,ze+32);o2=b4(data,ze+48)}}for(var fltr=opts&&opts.filter,i2=0;i2{if(uri.startsWith("https://"))return true;if(uri.startsWith("http://"))return true;else return false};function isCloudantURI(uri){if(-1!==uri.indexOf(".cloudantnosqldb.")||-1!==uri.indexOf(".cloudant.com"))return true;else return false}var checkRemoteVersion=async(db,migrate,barrier=VER)=>{try{const versionInfo=await db.get(VERSIONING_DOCID);if("versioninfo"!=versionInfo.type)return false;const version2=versionInfo.version;if(version2{const vi={_id:VERSIONING_DOCID,version:barrier,type:"versioninfo"},versionInfo=await resolveWithIgnoreKnownError(db.get(VERSIONING_DOCID),vi);if("versioninfo"!=versionInfo.type)return false;vi._rev=versionInfo._rev;await db.put(vi);return true},checkSyncInfo=async db=>{try{const syncinfo=await db.get(SYNCINFO_ID);console.log(syncinfo);return true}catch(ex){if(isErrorOfMissingDoc(ex)){const randomStrSrc="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",temp=[...Array(30)].map((e4=>Math.floor(Math.random()*randomStrSrc.length))).map((e4=>randomStrSrc[e4])).join(""),newSyncInfo={_id:SYNCINFO_ID,type:"syncinfo",data:temp};if(await db.put(newSyncInfo))return true;else return false}else{console.dir(ex);return false}}},MARK_SHIFT="L",MARK_SHIFT_COMPRESSED=`${MARK_SHIFT}Z`;function wrapFflateFunc(func){return(data,opts)=>new Promise(((res2,rej)=>{func(data,opts,((err2,result)=>{if(err2)rej(err2);else res2(result)}))}))}var wrappedInflate=wrapFflateFunc(inflate),wrappedDeflate=wrapFflateFunc(deflate);async function _compressText(text2){const converted=tryConvertBase64ToArrayBuffer(text2),data=new Uint8Array(converted||await new Blob([text2],{type:"application/octet-stream"}).arrayBuffer());if(0==data.buffer.byteLength)return"";const df=await wrappedDeflate(new Uint8Array(data),{consume:true,level:8});return(converted?"~":"")+await arrayBufferToBase64Single(df)}async function _decompressText(compressed,useUTF16=false){if(0==compressed.length)return"";const converted="~"==compressed[0],src=compressed.substring(converted?1:0);if(0==src.length)return"";const ab2=new Uint8Array(base64ToArrayBuffer(src));if(0==ab2.length)return"";const ret=await wrappedInflate(new Uint8Array(ab2),{consume:true});if(converted)return await arrayBufferToBase64Single(ret);const response=new Blob([ret]);return await response.text()}async function compressDoc(doc){if(!("data"in doc))return doc;if("string"!=typeof doc.data)return doc;if(doc.data.startsWith(MARK_SHIFT_COMPRESSED))return doc;const oldData=doc.data,compressed=await _compressText(oldData),newData=MARK_SHIFT_COMPRESSED+compressed;if(doc.data.length>newData.length)doc.data=newData;return doc}async function decompressDoc(doc){if(!("data"in doc))return doc;if("string"!=typeof doc.data)return doc;if(doc.data.startsWith(MARK_SHIFT_COMPRESSED))doc.data=await _decompressText(doc.data.substring(MARK_SHIFT_COMPRESSED.length));return doc}var replicationFilter=(db,compress)=>{db.transform({async incoming(doc){if(!compress)return doc;else return await compressDoc(doc)},outgoing:async doc=>await decompressDoc(doc)})},EDEN_ENCRYPTED_KEY="h:++encrypted";function shouldEncryptEden(doc){if("eden"in doc&&!(EDEN_ENCRYPTED_KEY in doc.eden))return true;else return false}function shouldDecryptEden(doc){if("eden"in doc&&EDEN_ENCRYPTED_KEY in doc.eden)return true;else return false}var preprocessOutgoing=async doc=>Promise.resolve(doc);function disableEncryption(){preprocessOutgoing=async doc=>doc;preprocessIncoming=async doc=>doc}var preprocessIncoming=async doc=>doc,enableEncryption=(db,passphrase,useDynamicIterationCount,migrationDecrypt)=>{const decrypted=new Map,incoming=async doc=>{const saveDoc={...doc};if(isEncryptedChunkEntry(saveDoc)||isSyncInfoEntry(saveDoc))try{if(!("e_"in saveDoc)){saveDoc.data=await encrypt2(saveDoc.data,passphrase,useDynamicIterationCount);saveDoc.e_=true}}catch(ex){Logger("Encryption failed.",LOG_LEVEL_NOTICE);Logger(ex);throw ex}if(shouldEncryptEden(saveDoc))saveDoc.eden={[EDEN_ENCRYPTED_KEY]:{data:await encrypt2(JSON.stringify(saveDoc.eden),passphrase,useDynamicIterationCount),epoch:999999}};if(isObfuscatedEntry(saveDoc))try{const path2=getPath(saveDoc);if(!isPathProbablyObfuscated(path2))saveDoc.path=await obfuscatePath(path2,passphrase,useDynamicIterationCount)}catch(ex){Logger("Encryption failed.",LOG_LEVEL_NOTICE);Logger(ex);throw ex}return saveDoc},outgoing=async doc=>{var _a5,_b2;const loadDoc={...doc},_isChunkOrSyncInfo=isEncryptedChunkEntry(loadDoc)||isSyncInfoEntry(loadDoc),_isObfuscatedEntry=isObfuscatedEntry(loadDoc),_shouldDecryptEden=shouldDecryptEden(loadDoc);if(_isChunkOrSyncInfo||_isObfuscatedEntry||_shouldDecryptEden){if(migrationDecrypt&&decrypted.has(loadDoc._id))return loadDoc;try{if(_isChunkOrSyncInfo){loadDoc.data=await decrypt2(loadDoc.data,passphrase,useDynamicIterationCount);delete loadDoc.e_}else if("e_"in loadDoc){loadDoc.data=await decrypt2(loadDoc.data,passphrase,useDynamicIterationCount);delete loadDoc.e_}if(_isObfuscatedEntry){const path2=getPath(loadDoc);if(isPathProbablyObfuscated(path2))loadDoc.path=await decrypt2(path2,passphrase,useDynamicIterationCount)}if(_shouldDecryptEden)loadDoc.eden=JSON.parse(await decrypt2(loadDoc.eden[EDEN_ENCRYPTED_KEY].data,passphrase,useDynamicIterationCount));if(migrationDecrypt)decrypted.set(loadDoc._id,true)}catch(ex){if(useDynamicIterationCount)try{if(_isChunkOrSyncInfo)loadDoc.data=await decrypt2(loadDoc.data,passphrase,false);if(_isObfuscatedEntry){const path2=getPath(loadDoc);if(isPathProbablyObfuscated(path2))loadDoc.path=await decrypt2(path2,passphrase,false)}if(_shouldDecryptEden)loadDoc.eden=JSON.parse(await decrypt2(loadDoc.eden[EDEN_ENCRYPTED_KEY].data,passphrase,false));if(migrationDecrypt)decrypted.set(loadDoc._id,true)}catch(ex2){if(migrationDecrypt&&"SyntaxError"==ex2.name)return loadDoc;Logger("Decryption failed.",LOG_LEVEL_NOTICE);Logger(ex2,LOG_LEVEL_VERBOSE);Logger(`id:${loadDoc._id}-${null==(_a5=loadDoc._rev)?void 0:_a5.substring(0,10)}`,LOG_LEVEL_VERBOSE);throw ex2}else{Logger("Decryption failed.",LOG_LEVEL_NOTICE);Logger(ex,LOG_LEVEL_VERBOSE);Logger(`id:${loadDoc._id}-${null==(_b2=loadDoc._rev)?void 0:_b2.substring(0,10)}`,LOG_LEVEL_VERBOSE);throw ex}}}return loadDoc};preprocessOutgoing=incoming;preprocessIncoming=outgoing;db.transform({incoming,outgoing})};function isErrorOfMissingDoc(ex){return 404==(ex&&(null==ex?void 0:ex.status))}async function prepareChunkDesignDoc(db){var _a5;const chunkDesignDoc={_id:"_design/chunks",_rev:void 0,ver:2,views:{collectDangling:{map:(function(doc){if(doc._id.startsWith("h:"))emit([doc._id],0);else if("children"in doc)doc.children.forEach((e4=>emit([e4],1)))}).toString(),reduce:"_sum"}}};let updateDDoc=false;try{const old=await db.get(chunkDesignDoc._id);if(null!=(_a5=null==old?void 0:old.ver)?_a5:0"DANGLING"==type?0==e4.value:0!=e4.value))).flatMap((e4=>e4.key));return(await db.allDocs({keys:ids})).rows.filter((e4=>!("error"in e4))).map((e4=>({id:e4.id,rev:e4.value.rev})))}async function collectUnbalancedChunkIDs(local,remote){const chunksOnLocal=await collectChunks(local,"INUSE"),chunksOnRemote=await collectChunks(remote,"INUSE");return{onlyOnLocal:chunksOnLocal.filter((e4=>!chunksOnRemote.some((ee=>ee.id==e4.id)))),onlyOnRemote:chunksOnRemote.filter((e4=>!chunksOnLocal.some((ee=>ee.id==e4.id))))}}async function purgeChunksLocal(db,docs){await serialized("purge-local",(async()=>{try{Logger(`Purging unused ${docs.length} chunks `,LOG_LEVEL_NOTICE,"purge-local-backup");const batchDocsBackup=arrayToChunkedArray(docs,100);let total={ok:0,exist:0,error:0};for(const docsInBatch of batchDocsBackup){const backupDocs=(await db.allDocs({keys:docsInBatch.map((e4=>e4.id)),include_docs:true})).rows.filter((e4=>"doc"in e4)).map((e4=>{const chunk={...e4.doc};delete chunk._rev;chunk._id=`_local/${chunk._id}`;return chunk})),ret=await db.bulkDocs(backupDocs);total=ret.map((e4=>({ok:"ok"in e4?1:0,exist:"status"in e4&&409==e4.status?1:0,error:"status"in e4&&409!=e4.status?1:0}))).reduce(((p2,c2)=>({ok:p2.ok+c2.ok,exist:p2.exist+c2.exist,error:p2.error+c2.error})),total);Logger(`Local chunk backed up: new:${total.ok} ,exist:${total.exist}, error:${total.error}`,LOG_LEVEL_NOTICE,"purge-local-backup");const erroredItems=ret.filter((e4=>"error"in e4&&409!=e4.status));for(const item of erroredItems)Logger(`Failed to back up: ${item.id} / ${item.rev}`,LOG_LEVEL_VERBOSE)}}catch(ex){Logger("Could not back up chunks");Logger(ex,LOG_LEVEL_VERBOSE)}Logger(`Purging unused ${docs.length} chunks... `,LOG_LEVEL_NOTICE,"purge-local");const batchDocs=arrayToChunkedArray(docs,100);let totalRemoved=0;for(const docsInBatch of batchDocs){const removed=await db.purgeMulti(docsInBatch.map((e4=>[e4.id,e4.rev])));totalRemoved+=Object.values(removed).filter((e4=>"ok"in e4)).length;Logger(`Purging: ${totalRemoved} / ${docs.length}`,LOG_LEVEL_NOTICE,"purge-local")}Logger(`Purging unused chunks done!: ${totalRemoved} chunks has been deleted.`,LOG_LEVEL_NOTICE,"purge-local")}))}var _requestToCouchDBFetch=async(baseUri,username,password,path2,body,method)=>{const utf8str=String.fromCharCode.apply(null,[...writeString(`${username}:${password}`)]),encoded=window.btoa(utf8str),uri=`${baseUri}/${path2}`,requestParam={url:uri,method:method||(body?"PUT":"GET"),headers:new Headers({authorization:"Basic "+encoded,"content-type":"application/json"}),contentType:"application/json",body:JSON.stringify(body)};return await fetch(uri,requestParam)};async function purgeChunksRemote(setting,docs){await serialized("purge-remote",(async()=>{const buffer=function makeChunkedArrayFromArray(items){const chunked=[];for(let i2=0;i2[e4.id,[e4.rev]]))),"POST");Logger(JSON.stringify(await rets.json()),LOG_LEVEL_VERBOSE)}}))}function sizeToHumanReadable(size){if(!size)return"-";const i2=Math.floor(Math.log(size)/Math.log(1024));return Number.parseInt((size/Math.pow(1024,i2)).toFixed(2))+" "+["B","kB","MB","GB","TB"][i2]}async function purgeUnreferencedChunks(db,dryRun,connSetting,performCompact=false){const info3=await db.info();let resultCount=0;const getSize=function(info4,key2){var _a5,_b2;return Number.parseInt(null!=(_b2=null==(_a5=null==info4?void 0:info4.sizes)?void 0:_a5[key2])?_b2:0)},keySuffix=connSetting?"-remote":"-local";Logger(`${dryRun?"Counting":"Cleaning"} ${connSetting?"remote":"local"} database`,LOG_LEVEL_NOTICE);if(connSetting)Logger(`Database active-size: ${sizeToHumanReadable(getSize(info3,"active"))}, external-size:${sizeToHumanReadable(getSize(info3,"external"))}, file-size: ${sizeToHumanReadable(getSize(info3,"file"))}`,LOG_LEVEL_NOTICE);Logger(`Collecting unreferenced chunks on ${info3.db_name}`,LOG_LEVEL_NOTICE,"gc-count-chunk"+keySuffix);const chunks=await collectUnreferencedChunks(db);resultCount=chunks.length;if(0==chunks.length)Logger(`No unreferenced chunks! ${info3.db_name}`,LOG_LEVEL_NOTICE,"gc-count-chunk"+keySuffix);else{Logger(`Number of unreferenced chunks on ${info3.db_name}: ${chunks.length}`,LOG_LEVEL_NOTICE,"gc-count-chunk"+keySuffix);if(dryRun){Logger(`DryRun of cleaning ${connSetting?"remote":"local"} database up: Done`,LOG_LEVEL_NOTICE);return resultCount}if(connSetting){Logger("Cleaning unreferenced chunks on remote",LOG_LEVEL_NOTICE,"gc-purge"+keySuffix);await purgeChunksRemote(connSetting,chunks)}else{Logger("Cleaning unreferenced chunks on local",LOG_LEVEL_NOTICE,"gc-purge"+keySuffix);await purgeChunksLocal(db,chunks)}Logger("Cleaning unreferenced chunks done!",LOG_LEVEL_NOTICE,"gc-purge"+keySuffix)}if(performCompact){Logger("Compacting database...",LOG_LEVEL_NOTICE,"gc-compact"+keySuffix);await db.compact();Logger("Compacting database done",LOG_LEVEL_NOTICE,"gc-compact"+keySuffix)}if(connSetting){const endInfo=await db.info();Logger(`Processed database active-size: ${sizeToHumanReadable(getSize(endInfo,"active"))}, external-size:${sizeToHumanReadable(getSize(endInfo,"external"))}, file-size: ${sizeToHumanReadable(getSize(endInfo,"file"))}`,LOG_LEVEL_NOTICE);Logger(`Reduced sizes: active-size: ${sizeToHumanReadable(getSize(info3,"active")-getSize(endInfo,"active"))}, external-size:${sizeToHumanReadable(getSize(info3,"external")-getSize(endInfo,"external"))}, file-size: ${sizeToHumanReadable(getSize(info3,"file")-getSize(endInfo,"file"))}`,LOG_LEVEL_NOTICE)}Logger(`Cleaning ${connSetting?"remote":"local"} database up: Done`,LOG_LEVEL_NOTICE);return resultCount}function transferChunks(key2,label,dbFrom,dbTo,items){let totalProcessed=0;const total=items.length;return new QueueProcessor((async batched=>{const requestItems=batched.map((e4=>e4.id));return(await dbTo.allDocs({keys:requestItems})).rows.filter((e4=>"error"in e4&&"not_found"==e4.error)).map((e4=>e4.key))}),{batchSize:50,concurrentLimit:5,suspended:true,delay:100},items).pipeTo(new QueueProcessor((async chunkIds=>(await dbFrom.allDocs({keys:chunkIds,include_docs:true})).rows.filter((e4=>!("error"in e4))).map((e4=>e4.doc))),{batchSize:25,concurrentLimit:1,suspended:true,delay:100})).pipeTo(new QueueProcessor((async docs=>{try{await dbTo.bulkDocs(docs,{new_edits:false})}catch(ex){Logger(`${label}: Something went wrong on balancing`,LOG_LEVEL_NOTICE);Logger(ex,LOG_LEVEL_VERBOSE)}finally{totalProcessed+=docs.length;Logger(`${label}: ${totalProcessed} / ${total}`,LOG_LEVEL_NOTICE,"balance-"+key2)}}),{batchSize:100,delay:100,concurrentLimit:2,suspended:false})).startPipeline().waitForAllDoneAndTerminate()}async function balanceChunkPurgedDBs(local,remote){Logger("Complement missing chunks between databases",LOG_LEVEL_NOTICE);try{const{onlyOnLocal,onlyOnRemote}=await collectUnbalancedChunkIDs(local,remote),localToRemote=transferChunks("l2r","local -> remote",local,remote,onlyOnLocal),remoteToLocal=transferChunks("r2l","remote -> local",remote,local,onlyOnRemote);await Promise.all([localToRemote,remoteToLocal]);Logger("local -> remote: Done",LOG_LEVEL_NOTICE,"balance-l2r");Logger("remote -> local: Done",LOG_LEVEL_NOTICE,"balance-r2l")}catch(ex){Logger("Something went wrong on balancing!",LOG_LEVEL_NOTICE);Logger(ex,LOG_LEVEL_VERBOSE)}Logger("Complement completed!",LOG_LEVEL_NOTICE)}async function fetchAllUsedChunks(local,remote){try{const chunksOnRemote=await collectChunks(remote,"INUSE");await transferChunks("r2l","remote -> local",remote,local,chunksOnRemote);Logger("remote -> local: Done",LOG_LEVEL_NOTICE,"balance-r2l")}catch(ex){Logger("Something went wrong on balancing!",LOG_LEVEL_NOTICE);Logger(ex,LOG_LEVEL_VERBOSE)}}function extractObject(template,obj){const ret={...template};for(const key2 in ret)ret[key2]=obj[key2];return ret}function isObjectDifferent(a2,b3,ignoreUndefined=false){if(typeof a2!=typeof b3)return true;if("object"==typeof a2){if(null===a2||null===b3)return a2!==b3;const keys2=[...new Set([...Object.keys(a2),...Object.keys(b3)])];if(ignoreUndefined)return keys2.map((key2=>void 0!==(null==a2?void 0:a2[key2])&&void 0!==(null==b3?void 0:b3[key2])&&isObjectDifferent(null==a2?void 0:a2[key2],null==b3?void 0:b3[key2]))).some((e4=>true==e4));else return keys2.map((key2=>isObjectDifferent(null==a2?void 0:a2[key2],null==b3?void 0:b3[key2]))).some((e4=>true==e4))}else return a2!==b3}var traps={};async function waitForSignal(id,timeout){return await waitForValue(id,timeout)!==RESULT_TIMED_OUT}function waitForValue(id,timeout){let resolveTrap,trapJob;const timer=timeout?setTimeout((()=>{if(id in traps)traps[id]=traps[id].filter((e4=>e4!=trapJob));if(resolveTrap)resolveTrap(RESULT_TIMED_OUT);resolveTrap=void 0}),timeout):false;return new Promise((res2=>{if(!(id in traps))traps[id]=[];resolveTrap=res2;trapJob=result=>{if(timer)clearTimeout(timer);res2(result)};traps[id].push(trapJob)}))}function sendSignal(id){sendValue(id,true)}function sendValue(id,result){if(!(id in traps))return;const trap=traps[id];delete traps[id];for(const resolver of trap)resolver(result)}var _a2,throttle=(func,timeout)=>{let timer,lastTime=0;return(...args)=>{if(!lastTime){func(...args);lastTime=Date.now()}else{clearTimeout(timer);const delayTime=timeout-(Date.now()-lastTime);timer=setTimeout((()=>{func(...args);lastTime=Date.now()}),delayTime)}}};function sizeToHumanReadable2(size){const units=["B","KB","MB","GB","TB"];let i2=0;for(;size>=1024&&i2{p2.then(res2).catch((ex=>isErrorOfMissingDoc(ex)?res2(def):rej(ex)))}))}var Parallels=(ps=new Set)=>({add:p2=>ps.add(!!p2.then((()=>ps.delete(p2))).catch((()=>ps.delete(p2)))&&p2),wait:limit=>ps.size>=limit&&Promise.race(ps),all:()=>Promise.all(ps)});async function allSettledWithConcurrencyLimit(processes,limit){const ps=Parallels();for(const proc of processes){ps.add(proc);await ps.wait(limit)}(await ps.all()).forEach((()=>{}))}function getDocData(doc){return"string"==typeof doc?doc:doc.join("")}function getDocDataAsArray(doc){return"string"==typeof doc?[doc]:doc}function getDocDataAsArrayBuffer(doc){if(doc instanceof ArrayBuffer)return new Uint8Array(doc);else return concatUInt8Array(getDocDataAsArray(doc).map((e4=>writeString(e4))))}function isTextBlob(blob){return"text/plain"===blob.type}function createTextBlob(data){const d4=Array.isArray(data)?data:[data];return new Blob(d4,{endings:"transparent",type:"text/plain"})}function createBinaryBlob(data){return new Blob([data],{endings:"transparent",type:"application/octet-stream"})}function createBlob(data){if(data instanceof Blob)return data;if(data instanceof Uint8Array||data instanceof ArrayBuffer)return createBinaryBlob(data);else return createTextBlob(data)}function isTextDocument(doc){if("plain"==doc.type)return true;if("plain"==doc.datatype)return true;if(isPlainText(doc.path))return true;else return false}function readAsBlob(doc){if(isTextDocument(doc))return createTextBlob(doc.data);else return createBinaryBlob(decodeBinary(doc.data))}function readContent(doc){if(isTextDocument(doc))return getDocData(doc.data);else return decodeBinary(doc.data)}var isIndexDBCmpExist="undefined"!=typeof(null==(_a2=null==window?void 0:window.indexedDB)?void 0:_a2.cmp);async function isDocContentSame(docA,docB){const blob1=createBlob(docA),blob2=createBlob(docB);if(blob1.size!=blob2.size)return false;if(isIndexDBCmpExist)return 0===window.indexedDB.cmp(await blob1.arrayBuffer(),await blob2.arrayBuffer());const length=blob1.size;let i2=0;for(;i2{if(cache.has(key2))return cache.get(key2);const value=func(key2);cache.set(key2,value);return value}}function memorizeFuncWithLRUCacheMulti(func){const cache=new LRUCache(100,1e5,true);return keys2=>{const theKey=keys2.map((e4=>"string"==typeof e4||"number"==typeof e4||"boolean"==typeof e4?e4.toString():JSON.stringify(e4))).join("-");if(cache.has(theKey))return cache.get(theKey);const value=func(...keys2);cache.set(theKey,value);return value}}function onlyNot(exclusion){return function _onlyNot(item){if(item===exclusion)return false;else return true}}var lastProcessed={};function markInterval(key2,now2){var _a5;const next=null!=now2?now2:Date.now();if(null!=(_a5=null==lastProcessed?void 0:lastProcessed[key2])?_a5:0set.add(e4)));return set}function escapeNewLineFromString(str){if(str.indexOf("\n")<0)return str;else return"\\f"+replaceAll(replaceAll(str,"\\","\\\\"),"\n","\\n")}function unescapeNewLineFromString(str){if(!str.startsWith("\\f"))return str;else return replaceAll(replaceAll(str.substring(2),"\\\\","\\"),"\\n","\n")}function escapeMarkdownValue(value){if("string"==typeof value)return replaceAllPairs(value,["|","\\|"],["`","\\`"]);else return value}function timeDeltaToHumanReadable(delta){const sec=delta/1e3;if(sec<60)return`${sec.toFixed(2)}s`;const min=sec/60;if(min<60)return`${min.toFixed(2)}m`;const hour=min/60;if(hour<24)return`${hour.toFixed(2)}h`;const day=hour/24;if(day<365)return`${day.toFixed(2)}d`;else return`${(day/365).toFixed(2)}y`}async function wrapException(func){try{return await func()}catch(ex){if(ex instanceof Error)return ex;else return new Error(ex)}}function toRanges(sorted){if(0==(null==sorted?void 0:sorted.length))return"";const ranges=[];let start=sorted[0],end=sorted[0];for(let i2=1;i2({[e4.id]:e4}))).reduce(((p2,c2)=>({...p2,...c2})),{})}function objectToUnorderedArray(obj){const entries=Object.entries(obj);if(entries.some((e4=>{var _a5;return e4[0]!=(null==(_a5=e4[1])?void 0:_a5.id)})))throw new Error("Item looks like not unordered array");return entries.map((e4=>e4[1]))}function generatePatchUnorderedArray(from,to){if(from.every((e4=>"object"==typeof e4&&"id"in e4))&&to.every((e4=>"object"==typeof e4&&"id"in e4))){const diff=generatePatchObj(unorderedArrayToObject(from),unorderedArrayToObject(to));if(Object.keys(diff).length>0)return{[MARK_ISARRAY]:diff};else return{}}return{[MARK_SWAPPED]:to}}function generatePatchObj(from,to){const entries=Object.entries(from),tempMap=new Map(entries),ret={},newEntries=Object.entries(to);for(const[key2,value]of newEntries)if(!tempMap.has(key2)){ret[key2]=value;tempMap.delete(key2)}else{const v2=tempMap.get(key2);if(typeof v2!=typeof value||Array.isArray(v2)!==Array.isArray(value))ret[key2]={[MARK_SWAPPED]:value};else if(null===v2&&null===value);else if(null===v2&&null!==value)ret[key2]={[MARK_SWAPPED]:value};else if(null!==v2&&null===value)ret[key2]={[MARK_SWAPPED]:value};else if("object"==typeof v2&&"object"==typeof value&&!Array.isArray(v2)&&!Array.isArray(value)){const wk2=generatePatchObj(v2,value);if(Object.keys(wk2).length>0)ret[key2]=wk2}else if("object"==typeof v2&&"object"==typeof value&&Array.isArray(v2)&&Array.isArray(value)){const wk2=generatePatchUnorderedArray(v2,value);if(Object.keys(wk2).length>0)ret[key2]=wk2}else if("object"!=typeof v2&&"object"!=typeof value){if(JSON.stringify(tempMap.get(key2))!==JSON.stringify(value))ret[key2]=value}else if(JSON.stringify(tempMap.get(key2))!==JSON.stringify(value))ret[key2]={[MARK_SWAPPED]:value};tempMap.delete(key2)}for(const[key2]of tempMap)ret[key2]=MARK_DELETED;return ret}function applyPatch(from,patch){const ret=from,patches=Object.entries(patch);for(const[key2,value]of patches)if(value!=MARK_DELETED)if(null!==value)if("object"==typeof value){if(MARK_SWAPPED in value){ret[key2]=value[MARK_SWAPPED];continue}if(MARK_ISARRAY in value){if(!(key2 in ret))ret[key2]=[];if(!Array.isArray(ret[key2]))throw new Error("Patch target type is mismatched (array to something)");const appliedArray=objectToUnorderedArray(applyPatch(unorderedArrayToObject(ret[key2]),value[MARK_ISARRAY]));ret[key2]=[...appliedArray]}else{if(!(key2 in ret)){ret[key2]=value;continue}ret[key2]=applyPatch(ret[key2],value)}}else ret[key2]=value;else ret[key2]=null;else delete ret[key2];return ret}function mergeObject(objA,objB){const newEntries=Object.entries(objB),ret={...objA};if(typeof objA!=typeof objB||Array.isArray(objA)!==Array.isArray(objB))return objB;for(const[key2,v2]of newEntries)if(key2 in ret){const value=ret[key2];if(typeof v2!=typeof value||Array.isArray(v2)!==Array.isArray(value))ret[key2]=v2;else if("object"==typeof v2&&"object"==typeof value&&!Array.isArray(v2)&&!Array.isArray(value))ret[key2]=mergeObject(v2,value);else if("object"==typeof v2&&"object"==typeof value&&Array.isArray(v2)&&Array.isArray(value))ret[key2]=[...new Set([...v2,...value])];else ret[key2]=v2}else ret[key2]=v2;const retSorted=Object.fromEntries(Object.entries(ret).sort(((a2,b3)=>a2[0]b3[0]?1:0)));if(Array.isArray(objA)&&Array.isArray(objB))return Object.values(retSorted);else return retSorted}function flattenObject(obj,path2=[]){if("object"!=typeof obj)return[[path2.join("."),obj]];if(null===obj)return[[path2.join("."),null]];if(Array.isArray(obj))return[[path2.join("."),JSON.stringify(obj)]];const e4=Object.entries(obj),ret=[];for(const[key2,value]of e4){const p2=flattenObject(value,[...path2,key2]);ret.push(...p2)}return ret}var e,t=new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,2,127,127,0,96,3,127,127,127,1,127,3,3,2,1,0,5,3,1,0,1,7,23,3,3,109,101,109,2,0,5,120,120,104,51,50,0,0,5,120,120,104,54,52,0,1,10,152,9,2,242,2,1,4,127,32,0,32,1,106,33,3,32,1,32,1,65,16,79,4,127,32,3,65,16,107,33,6,32,2,65,168,136,141,161,2,106,33,1,32,2,65,137,235,208,208,7,107,33,4,32,2,65,207,140,162,142,6,106,33,5,3,64,32,1,32,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,1,32,4,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,4,32,2,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,2,32,5,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,5,32,6,32,0,65,4,106,34,0,79,13,0,11,32,2,65,12,119,32,5,65,18,119,106,32,4,65,7,119,106,32,1,65,1,119,106,5,32,2,65,177,207,217,178,1,106,11,106,33,2,3,64,32,3,32,0,65,4,106,79,4,64,32,2,32,0,40,2,0,65,189,220,202,149,124,108,106,65,17,119,65,175,214,211,190,2,108,33,2,32,0,65,4,106,33,0,12,1,11,11,3,64,32,0,32,3,73,4,64,32,2,32,0,45,0,0,65,177,207,217,178,1,108,106,65,11,119,65,177,243,221,241,121,108,33,2,32,0,65,1,106,33,0,12,1,11,11,32,2,32,2,65,15,118,115,65,247,148,175,175,120,108,34,0,65,13,118,32,0,115,65,189,220,202,149,124,108,34,0,65,16,118,32,0,115,11,161,6,2,4,126,3,127,32,0,65,4,106,53,2,0,32,0,53,2,0,66,32,134,132,33,2,32,1,32,0,65,8,106,34,6,106,33,7,32,1,65,32,79,4,126,32,7,65,32,107,33,8,32,2,66,214,235,130,238,234,253,137,245,224,0,124,33,3,32,2,66,177,169,172,193,173,184,212,166,61,125,33,4,32,2,66,249,234,208,208,231,201,161,228,225,0,124,33,5,3,64,32,3,32,6,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,3,32,4,32,6,65,8,106,34,6,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,4,32,2,32,6,65,8,106,34,6,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,2,32,5,32,6,65,8,106,34,6,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,5,32,8,32,6,65,8,106,34,6,79,13,0,11,32,2,66,12,137,32,5,66,18,137,124,32,4,66,7,137,124,32,3,66,1,137,124,32,3,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,4,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,2,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,5,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,5,32,2,66,197,207,217,178,241,229,186,234,39,124,11,32,1,173,124,33,2,3,64,32,7,32,6,65,8,106,79,4,64,32,2,32,6,41,3,0,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,27,137,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,33,2,32,6,65,8,106,33,6,12,1,11,11,32,6,65,4,106,32,7,77,4,64,32,2,32,6,53,2,0,66,135,149,175,175,152,182,222,155,158,127,126,133,66,23,137,66,207,214,211,190,210,199,171,217,66,126,66,249,243,221,241,153,246,153,171,22,124,33,2,32,6,65,4,106,33,6,11,3,64,32,6,32,7,73,4,64,32,2,32,6,49,0,0,66,197,207,217,178,241,229,186,234,39,126,133,66,11,137,66,135,149,175,175,152,182,222,155,158,127,126,33,2,32,6,65,1,106,33,6,12,1,11,11,32,0,32,2,32,2,66,33,136,133,66,207,214,211,190,210,199,171,217,66,126,34,2,66,29,136,32,2,133,66,249,243,221,241,153,246,153,171,22,126,34,2,66,32,136,32,2,133,34,2,66,32,136,62,2,0,32,0,65,4,106,32,2,62,2,0,11]);function n(t4,e4,n3){if(e4.buffer.byteLength1&&void 0!==arguments[1]?arguments[1]:0;return n(t4,i2,0),o2(0,t4.byteLength,e4)>>>0}function c2(t4){let e4=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o3=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;n(t4,i2,8);const h4=new DataView(i2.buffer);return h4.setUint32(0,e4,true),h4.setUint32(4,o3,true),r2(0,t4.byteLength),h4}return{h32:function(t4){let n3=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;e||(e=new TextEncoder);return h3(e.encode(t4),n3).toString(16)},h32Raw:h3,h64:function(t4){let n3=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i3=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;e||(e=new TextEncoder);const r3=c2(e.encode(t4),n3,i3);return r3.getUint32(0,true).toString(16)+r3.getUint32(4,true).toString(16)},h64Raw:function(t4){let e4=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n3=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return new Uint8Array(c2(t4,e4,n3).buffer,0,8)}}}var hashFunc,context,t2=new Uint8Array([0,97,115,109,1,0,0,0,1,48,8,96,3,127,127,127,0,96,3,127,127,127,1,127,96,2,127,127,0,96,2,127,126,0,96,1,127,1,127,96,1,127,1,126,96,3,127,127,126,1,126,96,3,126,127,127,1,126,3,11,10,1,1,2,0,4,6,7,3,0,5,5,3,1,0,1,7,85,9,3,109,101,109,2,0,5,120,120,104,51,50,0,0,6,105,110,105,116,51,50,0,2,8,117,112,100,97,116,101,51,50,0,3,8,100,105,103,101,115,116,51,50,0,4,5,120,120,104,54,52,0,5,6,105,110,105,116,54,52,0,7,8,117,112,100,97,116,101,54,52,0,8,8,100,105,103,101,115,116,54,52,0,9,10,211,23,10,242,1,1,4,127,32,0,32,1,106,33,3,32,1,65,16,79,4,127,32,3,65,16,107,33,6,32,2,65,168,136,141,161,2,106,33,3,32,2,65,247,148,175,175,120,106,33,4,32,2,65,177,243,221,241,121,107,33,5,3,64,32,0,40,2,0,65,247,148,175,175,120,108,32,3,106,65,13,119,65,177,243,221,241,121,108,33,3,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,32,4,106,65,13,119,65,177,243,221,241,121,108,33,4,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,32,2,106,65,13,119,65,177,243,221,241,121,108,33,2,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,32,5,106,65,13,119,65,177,243,221,241,121,108,33,5,32,0,65,4,106,34,0,32,6,77,13,0,11,32,2,65,12,119,32,5,65,18,119,106,32,4,65,7,119,106,32,3,65,1,119,106,5,32,2,65,177,207,217,178,1,106,11,32,1,106,32,0,32,1,65,15,113,16,1,11,146,1,0,32,1,32,2,106,33,2,3,64,32,1,65,4,106,32,2,75,69,4,64,32,1,40,2,0,65,189,220,202,149,124,108,32,0,106,65,17,119,65,175,214,211,190,2,108,33,0,32,1,65,4,106,33,1,12,1,11,11,3,64,32,1,32,2,79,69,4,64,32,1,45,0,0,65,177,207,217,178,1,108,32,0,106,65,11,119,65,177,243,221,241,121,108,33,0,32,1,65,1,106,33,1,12,1,11,11,32,0,65,15,118,32,0,115,65,247,148,175,175,120,108,34,0,32,0,65,13,118,115,65,189,220,202,149,124,108,34,0,32,0,65,16,118,115,11,63,0,32,0,65,8,106,32,1,65,168,136,141,161,2,106,54,2,0,32,0,65,12,106,32,1,65,247,148,175,175,120,106,54,2,0,32,0,65,16,106,32,1,54,2,0,32,0,65,20,106,32,1,65,177,243,221,241,121,107,54,2,0,11,211,4,1,6,127,32,1,32,2,106,33,6,32,0,65,24,106,33,5,32,0,65,40,106,40,2,0,33,3,32,0,32,0,40,2,0,32,2,106,54,2,0,32,0,65,4,106,34,4,32,4,40,2,0,32,2,65,16,79,32,0,40,2,0,65,16,79,114,114,54,2,0,32,2,32,3,106,65,16,73,4,64,32,3,32,5,106,32,1,32,2,252,10,0,0,32,0,65,40,106,32,2,32,3,106,54,2,0,15,11,32,3,4,64,32,3,32,5,106,32,1,65,16,32,3,107,34,2,252,10,0,0,32,0,65,8,106,34,3,40,2,0,32,5,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,4,32,3,32,4,54,2,0,32,0,65,12,106,34,3,40,2,0,32,5,65,4,106,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,4,32,3,32,4,54,2,0,32,0,65,16,106,34,3,40,2,0,32,5,65,8,106,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,4,32,3,32,4,54,2,0,32,0,65,20,106,34,3,40,2,0,32,5,65,12,106,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,4,32,3,32,4,54,2,0,32,0,65,40,106,65,0,54,2,0,32,1,32,2,106,33,1,11,32,1,32,6,65,16,107,77,4,64,32,6,65,16,107,33,8,32,0,65,8,106,40,2,0,33,2,32,0,65,12,106,40,2,0,33,3,32,0,65,16,106,40,2,0,33,4,32,0,65,20,106,40,2,0,33,7,3,64,32,1,40,2,0,65,247,148,175,175,120,108,32,2,106,65,13,119,65,177,243,221,241,121,108,33,2,32,1,65,4,106,34,1,40,2,0,65,247,148,175,175,120,108,32,3,106,65,13,119,65,177,243,221,241,121,108,33,3,32,1,65,4,106,34,1,40,2,0,65,247,148,175,175,120,108,32,4,106,65,13,119,65,177,243,221,241,121,108,33,4,32,1,65,4,106,34,1,40,2,0,65,247,148,175,175,120,108,32,7,106,65,13,119,65,177,243,221,241,121,108,33,7,32,1,65,4,106,34,1,32,8,77,13,0,11,32,0,65,8,106,32,2,54,2,0,32,0,65,12,106,32,3,54,2,0,32,0,65,16,106,32,4,54,2,0,32,0,65,20,106,32,7,54,2,0,11,32,1,32,6,73,4,64,32,5,32,1,32,6,32,1,107,34,1,252,10,0,0,32,0,65,40,106,32,1,54,2,0,11,11,97,1,1,127,32,0,65,16,106,40,2,0,33,1,32,0,65,4,106,40,2,0,4,127,32,1,65,12,119,32,0,65,20,106,40,2,0,65,18,119,106,32,0,65,12,106,40,2,0,65,7,119,106,32,0,65,8,106,40,2,0,65,1,119,106,5,32,1,65,177,207,217,178,1,106,11,32,0,40,2,0,106,32,0,65,24,106,32,0,65,40,106,40,2,0,16,1,11,157,4,2,1,127,3,126,32,0,32,1,106,33,3,32,1,65,32,79,4,126,32,3,65,32,107,33,3,32,2,66,135,149,175,175,152,182,222,155,158,127,124,66,207,214,211,190,210,199,171,217,66,124,33,4,32,2,66,207,214,211,190,210,199,171,217,66,124,33,5,32,2,66,0,124,33,6,32,2,66,135,149,175,175,152,182,222,155,158,127,125,33,2,3,64,32,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,32,4,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,4,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,32,5,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,5,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,32,6,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,6,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,32,2,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,2,32,0,65,8,106,34,0,32,3,77,13,0,11,32,6,66,12,137,32,2,66,18,137,124,32,5,66,7,137,124,32,4,66,1,137,124,32,4,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,32,5,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,32,6,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,32,2,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,5,32,2,66,197,207,217,178,241,229,186,234,39,124,11,32,1,173,124,32,0,32,1,65,31,113,16,6,11,137,2,0,32,1,32,2,106,33,2,3,64,32,1,65,8,106,32,2,77,4,64,32,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,32,0,133,66,27,137,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,33,0,32,1,65,8,106,33,1,12,1,11,11,32,1,65,4,106,32,2,77,4,64,32,1,53,2,0,66,135,149,175,175,152,182,222,155,158,127,126,32,0,133,66,23,137,66,207,214,211,190,210,199,171,217,66,126,66,249,243,221,241,153,246,153,171,22,124,33,0,32,1,65,4,106,33,1,11,3,64,32,1,32,2,73,4,64,32,1,49,0,0,66,197,207,217,178,241,229,186,234,39,126,32,0,133,66,11,137,66,135,149,175,175,152,182,222,155,158,127,126,33,0,32,1,65,1,106,33,1,12,1,11,11,32,0,66,33,136,32,0,133,66,207,214,211,190,210,199,171,217,66,126,34,0,32,0,66,29,136,133,66,249,243,221,241,153,246,153,171,22,126,34,0,32,0,66,32,136,133,11,88,0,32,0,65,8,106,32,1,66,135,149,175,175,152,182,222,155,158,127,124,66,207,214,211,190,210,199,171,217,66,124,55,3,0,32,0,65,16,106,32,1,66,207,214,211,190,210,199,171,217,66,124,55,3,0,32,0,65,24,106,32,1,55,3,0,32,0,65,32,106,32,1,66,135,149,175,175,152,182,222,155,158,127,125,55,3,0,11,132,5,2,3,127,4,126,32,1,32,2,106,33,5,32,0,65,40,106,33,4,32,0,65,200,0,106,40,2,0,33,3,32,0,32,0,41,3,0,32,2,173,124,55,3,0,32,2,32,3,106,65,32,73,4,64,32,3,32,4,106,32,1,32,2,252,10,0,0,32,0,65,200,0,106,32,2,32,3,106,54,2,0,15,11,32,3,4,64,32,3,32,4,106,32,1,65,32,32,3,107,34,2,252,10,0,0,32,0,65,8,106,34,3,41,3,0,32,4,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,6,32,3,32,6,55,3,0,32,0,65,16,106,34,3,41,3,0,32,4,65,8,106,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,6,32,3,32,6,55,3,0,32,0,65,24,106,34,3,41,3,0,32,4,65,16,106,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,6,32,3,32,6,55,3,0,32,0,65,32,106,34,3,41,3,0,32,4,65,24,106,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,6,32,3,32,6,55,3,0,32,0,65,200,0,106,65,0,54,2,0,32,1,32,2,106,33,1,11,32,1,65,32,106,32,5,77,4,64,32,5,65,32,107,33,2,32,0,65,8,106,41,3,0,33,6,32,0,65,16,106,41,3,0,33,7,32,0,65,24,106,41,3,0,33,8,32,0,65,32,106,41,3,0,33,9,3,64,32,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,32,6,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,6,32,1,65,8,106,34,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,32,7,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,7,32,1,65,8,106,34,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,32,8,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,8,32,1,65,8,106,34,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,32,9,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,9,32,1,65,8,106,34,1,32,2,77,13,0,11,32,0,65,8,106,32,6,55,3,0,32,0,65,16,106,32,7,55,3,0,32,0,65,24,106,32,8,55,3,0,32,0,65,32,106,32,9,55,3,0,11,32,1,32,5,73,4,64,32,4,32,1,32,5,32,1,107,34,1,252,10,0,0,32,0,65,200,0,106,32,1,54,2,0,11,11,200,2,1,5,126,32,0,65,24,106,41,3,0,33,1,32,0,41,3,0,34,2,66,32,90,4,126,32,0,65,8,106,41,3,0,34,3,66,1,137,32,0,65,16,106,41,3,0,34,4,66,7,137,124,32,1,66,12,137,32,0,65,32,106,41,3,0,34,5,66,18,137,124,124,32,3,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,32,4,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,32,1,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,32,5,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,5,32,1,66,197,207,217,178,241,229,186,234,39,124,11,32,2,124,32,0,65,40,106,32,2,66,31,131,167,16,6,11]);async function e2(){const{instance:{exports:{mem:e4,xxh32:n3,xxh64:r2,init32:i2,update32:o2,digest32:h3,init64:s2,update64:u2,digest64:g2}}}=await WebAssembly.instantiate(t2);let a2=new Uint8Array(e4.buffer);function c2(t4,n4){if(e4.buffer.byteLength(a2.set(h4),o3(i3(0)))}}function d4(t4){return t4>>>0}const f4=BigInt(2)**BigInt(64)-BigInt(1);function y2(t4){return t4&f4}const b3=new TextEncoder,w2=BigInt(0);function p2(t4){let e5=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return c2(3*t4.length,0),d4(n3(0,b3.encodeInto(t4,a2).written,e5))}function v2(t4){let e5=arguments.length>1&&void 0!==arguments[1]?arguments[1]:w2;return c2(3*t4.length,0),y2(r2(0,b3.encodeInto(t4,a2).written,e5))}return{h32:p2,h32ToString(t4){return p2(t4,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0).toString(16).padStart(8,"0")},h32Raw(t4){let e5=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return c2(t4.byteLength,0),a2.set(t4),d4(n3(0,t4.byteLength,e5))},create32(){return l2(48,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i2,o2,h3,d4)},h64:v2,h64ToString(t4){return v2(t4,arguments.length>1&&void 0!==arguments[1]?arguments[1]:w2).toString(16).padStart(16,"0")},h64Raw(t4){let e5=arguments.length>1&&void 0!==arguments[1]?arguments[1]:w2;return c2(t4.byteLength,0),a2.set(t4),y2(r2(0,t4.byteLength,e5))},create64(){return l2(88,arguments.length>0&&void 0!==arguments[0]?arguments[0]:w2,s2,u2,g2,y2)}}}async function initHashFunc(){try{const{h32ToString}=await e2();hashFunc=h32ToString;Logger("xxhash for plugin initialised",LOG_LEVEL_VERBOSE)}catch(ex){Logger("Could not initialise xxhash. fallback...",LOG_LEVEL_VERBOSE);Logger(ex);try{const{h32}=await xxhash_wasm_default();hashFunc=str=>h32(str)}catch(ex2){Logger("Could not initialise old xxhash for plugin: use sha1",LOG_LEVEL_VERBOSE);Logger(ex2);hashFunc=str=>str}}return hashFunc}initHashFunc();async function sha1(src){const bytes=writeString(src),digest=await globalThis.crypto.subtle.digest({name:"SHA-1"},bytes);return await arrayBufferToBase64Single(digest)}function digestHash(src){let hash2="";for(const v2 of src)hash2=hashFunc(hash2+v2);if(""==hash2)return hashFunc("**");else return hash2}function reactiveSource(initialValue){return _reactive({initialValue})}function reactive(expression,initialValue){return _reactive({expression,initialValue})}function _reactive({expression,initialValue}){let value,_isDirty=false;const changeHandlers=new Set,instance8={myContext:new Set,markDirty(){_isDirty=true;instance8.markDependedDirty()},rippleChanged(){changeHandlers.forEach((e4=>e4(instance8)));instance8.myContext.forEach((e4=>e4.rippleChanged()))},markClean(){_isDirty=false},markDependedDirty(){instance8.myContext.forEach((e4=>e4.markDirty()))},get isDirty(){return _isDirty},get value(){if(context)instance8.myContext.add(context);if(!expression)return value;if(_isDirty){const oldValue=value,newValue=expression();if(isObjectDifferent(oldValue,newValue)){value=newValue;instance8.markClean();instance8.markDependedDirty()}}return value},set value(newValue){if(isObjectDifferent(value,newValue)){value=newValue;instance8.markDirty();instance8.rippleChanged()}},onChanged(handler){changeHandlers.add(handler);instance8.markDirty()},offChanged(handler){changeHandlers.delete(handler)}};value=function initialize(){const previousContext=context;context=instance8;const r2=expression?expression(initialValue):initialValue;context=previousContext;return r2}();return instance8}function computed(expression){const v2=reactive(expression);return()=>v2.value}var lockStats=reactiveSource({pending:[],running:[],count:0}),collectingChunks=reactiveSource(0),pluginScanningCount=reactiveSource(0),hiddenFilesProcessingCount=reactiveSource(0),hiddenFilesEventCount=reactiveSource(0),logStore=new QueueProcessor((e4=>e4),{batchSize:1,suspended:false,keepResultUntilDownstreamConnected:true}),logMessages=reactiveSource([]);function isTextBlob2(blob){return"text/plain"===blob.type}function*pickPiece(leftData,minimumChunkSize){let buffer="";L1:do{const curLine=leftData.shift();if("undefined"==typeof curLine){yield buffer;break L1}if(curLine.startsWith("```")||curLine.startsWith(" ```")||curLine.startsWith(" ```")||curLine.startsWith(" ```")){yield buffer;buffer=curLine+(0!=leftData.length?"\n":"");L2:do{const curPx=leftData.shift();if("undefined"==typeof curPx)break L2;buffer+=curPx+(0!=leftData.length?"\n":"")}while(leftData.length>0&&!(leftData[0].startsWith("```")||leftData[0].startsWith(" ```")||leftData[0].startsWith(" ```")||leftData[0].startsWith(" ```")));const isLooksLikeBASE64=buffer.endsWith("="),maybeUneditable=buffer.length>2048,endOfCodeBlock=leftData.shift();if("undefined"!=typeof endOfCodeBlock){buffer+=endOfCodeBlock;buffer+=0!=leftData.length?"\n":""}if(!isLooksLikeBASE64&&!maybeUneditable){const splitExpr=/(.*?[;,:<])/g,sx=buffer.split(splitExpr).filter((e4=>""!=e4));for(const v2 of sx)yield v2}else yield buffer;buffer=""}else{buffer+=curLine+(0!=leftData.length?"\n":"");if(buffer.length>=minimumChunkSize||0==leftData.length||"#"==leftData[0]||"#"==buffer[0]){yield buffer;buffer=""}}}while(leftData.length>0)}var charNewLine="\n".charCodeAt(0),segmenter="Segmenter"in Intl?new Intl.Segmenter(navigator.language,{granularity:"sentence"}):void 0;function*splitStringWithinLength(text2,pieceSize){let leftData=text2;do{const splitSize=pieceSize,piece=leftData.substring(0,splitSize);leftData=leftData.substring(splitSize);yield piece}while(""!=leftData)}function*splitTextInSegment(text2,pieceSize,minimumChunkSize){const segments=segmenter.segment(text2);let prev="",buf="";for(const seg of segments){const buffer=seg.segment;if(prev==buffer||buf.length0)yield*splitStringWithinLength(buf,pieceSize);buf=buffer}}if(buf.length>0)yield*splitStringWithinLength(buf,pieceSize)}function*splitInNewLine(texts){for(const text2 of texts){let start=-1,end=-1;do{end=text2.indexOf("\n",start);if(-1==end){yield text2.substring(start);break}for(;"\n"==text2[end];)end++;yield text2.substring(start,end);start=end}while(-1!=end)}}function splitPiecesTextV2(dataSrc,pieceSize,minimumChunkSize){const dataListAll=splitInNewLine("string"==typeof dataSrc?[dataSrc]:dataSrc);let inCodeBlock=0,flush2=false,flushBefore=false;return function*(){const buf=[];for(const line of dataListAll){if(line.startsWith("````")){if(0==inCodeBlock){inCodeBlock=4;flushBefore=true}else if(4==inCodeBlock){inCodeBlock=0;flush2=true}}else if(line.startsWith("```"))if(0==inCodeBlock){inCodeBlock=3;flushBefore=true}else if(3==inCodeBlock){inCodeBlock=0;flush2=true}if(flushBefore){if(buf.length>0){yield*splitTextInSegment(buf.join(""),pieceSize,minimumChunkSize);buf.length=0}flushBefore=false}buf.push(line);if(flush2){if(buf.length>0){yield*splitStringWithinLength(buf.join(""),pieceSize);buf.length=0}flush2=false}}if(buf.length>0)if(0==inCodeBlock)yield*splitTextInSegment(buf.join(""),pieceSize,minimumChunkSize);else yield*splitStringWithinLength(buf.join(""),pieceSize)}}function binaryTextSplit(data,pieceSize,minimumChunkSize){return function*pieces(){yield*splitStringWithinLength(data,pieceSize)}}function splitPiecesText(dataSrc,pieceSize,plainSplit,minimumChunkSize,useSegmenter){if(!useSegmenter||!segmenter)return splitPiecesTextV1(dataSrc,pieceSize,plainSplit,minimumChunkSize);if(!plainSplit)return binaryTextSplit(dataSrc,pieceSize,minimumChunkSize);else return splitPiecesTextV2(dataSrc,pieceSize,minimumChunkSize)}function splitPiecesTextV1(dataSrc,pieceSize,plainSplit,minimumChunkSize){const dataList="string"==typeof dataSrc?[dataSrc]:dataSrc;return function*pieces(){for(const data of dataList)if(plainSplit){const f4=pickPiece(data.split("\n"),minimumChunkSize);for(const piece of f4){let buffer=piece;do{let ps=pieceSize;if(buffer.charCodeAt(ps-1)!=buffer.codePointAt(ps-1))ps++;yield buffer.substring(0,ps);buffer=buffer.substring(ps)}while(""!=buffer)}}else{let leftData=data;do{const splitSize=pieceSize,piece=leftData.substring(0,splitSize);leftData=leftData.substring(splitSize);yield piece}while(""!=leftData)}}}function*splitByDelimiterWithMinLength(sources,delimiter,minimumChunkLength=25,splitThreshold){let buf="",last=false;const dl=delimiter.length;for(const source of sources){const max3=source.length;if(splitThreshold&&max3>splitThreshold){yield buf+source;last=false;buf="";continue}let i2=-1,prev=0;L1:do{i2=source.indexOf(delimiter,prev);if(-1==i2)break L1;buf+=source.slice(prev,i2)+delimiter;if(buf.length>minimumChunkLength){yield buf;buf="";last=false}else last=true;prev=i2+dl}while(i2maxLength){let from=0;do{let end=from+maxLength;if(end>strLen){yield source.substring(from);break}for(;source.charCodeAt(end-1)!=source.codePointAt(end-1);)end++;yield source.substring(from,end);from=end}while(fromMAX_ITEMS;)xMinimumChunkSize+=minimumChunkSize;const gen=chunkStringGeneratorFromGenerator(splitByDelimiterWithMinLength(stringGenerator([text2]),"\n",xMinimumChunkSize),pieceSize);return function*pieces(){yield*gen}}let canBeSmall=false,delimiter=0;if(filename&&filename.endsWith(".pdf"))delimiter="/".charCodeAt(0);else if(filename&&filename.endsWith(".json")){canBeSmall=true;delimiter=",".charCodeAt(0)}const clampMin=canBeSmall?100:1e5;let step=1,w2=Math.max(clampMin,Math.min(1e8,dataSrc.size));for(;w2>10;){w2/=12.5;step++}minimumChunkSize=Math.floor(10**(step-1));return async function*piecesBlob(){const size=dataSrc.size;let i2=0;const buf=new Uint8Array(await dataSrc.arrayBuffer());do{const findStart=i2+minimumChunkSize,defaultSplitEnd=i2+pieceSize;let splitEnd,i1=buf.indexOf(delimiter,findStart);if(-1==i1)i1=buf.indexOf(charNewLine,findStart);if(-1==i1)splitEnd=defaultSplitEnd;else splitEnd=i110;){w2/=12.5;step++}minimumChunkSize=Math.floor(10**(step-1));return async function*piecesBlob(){const size=dataSrc.size;let i2=0;do{let splitSize=pieceSize;const currentData=new Uint8Array(await dataSrc.slice(i2,i2+pieceSize).arrayBuffer());let nextIdx=currentData.indexOf(delimiter,minimumChunkSize);splitSize=-1==nextIdx?pieceSize:Math.min(pieceSize,nextIdx);if(-1==nextIdx)nextIdx=currentData.indexOf(charNewLine,minimumChunkSize);const piece=currentData.slice(0,splitSize);i2+=piece.length;const b64=await arrayBufferToBase64Single(piece);yield b64}while(i2{try{const chunks=await this._collectChunks(requesting,false);if(chunks)chunks.forEach((chunk=>sendValue(`chunk-fetch-${chunk._id}`,chunk)));else throw new Error("Failed: CollectChunksInternal")}catch(ex){Logger("Exception raised while retrieving chunks",LOG_LEVEL_NOTICE);Logger(ex,LOG_LEVEL_VERBOSE);requesting.forEach((id=>sendValue(`chunk-fetch-${id}`,[])))}}),{batchSize:100,interval:100,concurrentLimit:1,maintainDelay:true,suspended:false,totalRemainingReactiveSource:collectingChunks});this.auth={username:"",password:""};this.dbname=dbname;this.env=env;this.refreshSettings()}async _prepareHashFunctions(){if(null==this.h32)if("sha1"!=this.settings.hashAlg)try{const{h32ToString,h32Raw,h32,h64}=await e2();this.xxhash64=h64;this.xxhash32=h32;this.h32=h32ToString;this.h32Raw=h32Raw;Logger("Newer xxhash has been initialised",LOG_LEVEL_VERBOSE)}catch(ex){Logger("Could not initialise xxhash: use v1",LOG_LEVEL_VERBOSE);Logger(ex);try{this.xxhash64=false;const{h32,h32Raw}=await xxhash_wasm_default();this.h32=h32;this.h32Raw=h32Raw;this.xxhash32=str=>h32Raw(writeString(str))}catch(ex2){Logger("Could not initialise xxhash: use sha1F",LOG_LEVEL_VERBOSE);Logger(ex2);this.settings.hashAlg="sha1"}}else Logger("Fallback(SHA1) is used for hashing",LOG_LEVEL_VERBOSE)}get isOnDemandChunkEnabled(){if(this.settings.remoteType!==REMOTE_COUCHDB)return false;else return this.settings.readChunksOnline}onunload(){var _a5,_b2;this.env.$allOnDBUnload(this);null==(_a5=this.changeHandler)||_a5.cancel();null==(_b2=this.changeHandler)||_b2.removeAllListeners();this.localDatabase.removeAllListeners()}refreshSettings(){const settings=this.env.getSettings();this.settings=settings;this.hashCaches=new LRUCache(settings.hashCacheMaxCount,settings.hashCacheMaxAmount)}id2path(id,entry,stripPrefix2){return this.env.$$id2path(id,entry,stripPrefix2)}async path2id(filename,prefix){return await this.env.$$path2id(filename,prefix)}async close(){var _a5,_b2;Logger("Database closed (by close)");this.isReady=false;null==(_a5=this.changeHandler)||_a5.cancel();null==(_b2=this.changeHandler)||_b2.removeAllListeners();if(null!=this.localDatabase)await this.localDatabase.close();this.env.$allOnDBClose(this)}async initializeDatabase(){var _a5,_b2;await this._prepareHashFunctions();if(null!=this.localDatabase)await this.localDatabase.close();null==(_a5=this.changeHandler)||_a5.cancel();await(null==(_b2=this.changeHandler)?void 0:_b2.removeAllListeners());this.localDatabase=null;this.localDatabase=this.env.$$createPouchDBInstance(this.dbname+"-livesync-v2",{auto_compaction:false,revs_limit:100,deterministic_revs:true});if(!await this.env.$everyOnInitializeDatabase(this))Logger("Initializing Database has been failed on some module",LOG_LEVEL_NOTICE);Logger("Opening Database...");Logger("Database info",LOG_LEVEL_VERBOSE);Logger(await this.localDatabase.info(),LOG_LEVEL_VERBOSE);this.localDatabase.on("close",(()=>{var _a6;Logger("Database closed.");this.isReady=false;this.localDatabase.removeAllListeners();null==(_a6=this.env.$$getReplicator())||_a6.closeReplication()}));const changes3=this.localDatabase.changes({since:"now",live:true,filter:doc=>"leaf"==doc.type}).on("change",(e4=>{if(!e4.deleted)sendValue(`leaf-${e4.id}`,e4.doc)}));this.changeHandler=changes3;this.isReady=true;Logger("Database is now ready.");return true}async readChunk(id,timeout){const leaf=this.hashCaches.get(id);if(leaf)return leaf;let w2;try{w2=await this.localDatabase.get(id)}catch(ex){if(!isErrorOfMissingDoc(ex))throw ex}if(void 0===w2&&0!=timeout){const ret=await waitForValue(`leaf-${id}`,timeout);if(ret===RESULT_TIMED_OUT)throw new Error(`Timed out: ${id}`);w2=ret}if(void 0===w2)throw new Error(`Missing chunks of: ${id}`);if("leaf"!=w2.type)throw new Error(`Corrupted chunk has been detected: ${id}`);this.hashCaches.set(id,w2.data);return w2.data}async getChunk(piece,doc){const cachedChunkId=this.hashCaches.revGet(piece);if(void 0!==cachedChunkId)return{isNew:false,id:cachedChunkId,piece};const chunkId=PREFIX_CHUNK+await this.generateHashedChunk(piece);if(chunkId in doc.eden)return{isNew:false,id:chunkId,piece};const cachedPiece=this.hashCaches.get(chunkId);if(cachedPiece&&cachedPiece!=piece){Logger(`Hash collided! If possible, please report the following string:${chunkId}=>\nA:--${cachedPiece}--\nB:--${piece}--`,LOG_LEVEL_NOTICE);return false}this.hashCaches.set(chunkId,piece);return{isNew:true,id:chunkId,piece}}async generateHashedChunk(piece){const userPassphrase=this.settings.passphrase;if("sha1"==this.settings.hashAlg)if(this.settings.encrypt)return"+"+await sha1(`${piece}-${userPassphrase}-${piece.length}`);else return await sha1(`${piece}-${piece.length}`);else if(""===this.settings.hashAlg)if(this.settings.encrypt){const userPasswordHash=this.h32Raw((new TextEncoder).encode(userPassphrase));return"+"+(this.h32Raw((new TextEncoder).encode(piece))^userPasswordHash^piece.length).toString(36)}else return(this.h32Raw((new TextEncoder).encode(piece))^piece.length).toString(36);else if("xxhash64"==this.settings.hashAlg&&this.xxhash64)if(this.settings.encrypt)return"+"+this.xxhash64(`${piece}-${userPassphrase}-${piece.length}`).toString(36);else return this.xxhash64(`${piece}-${piece.length}`).toString(36);else if(this.settings.encrypt)return"+"+this.xxhash32(`${piece}-${userPassphrase}-${piece.length}`).toString(36);else return this.xxhash32(`${piece}-${piece.length}`).toString(36)}async getDBLeafWithTimeout(id,timeout){try{return await this.readChunk(id,timeout)}catch(ex){Logger("Something went wrong while retrieving chunks");Logger(ex,LOG_LEVEL_VERBOSE);throw ex}}getDBLeaf(id,waitForReady){return this.getDBLeafWithTimeout(id,waitForReady?LEAF_WAIT_TIMEOUT:0)}async getDBEntryMeta(path2,opt,includeDeleted=false){var _a5,_b2;if(!this.isTargetFile(path2))return false;const id=await this.path2id(path2);try{let obj=null;if(opt)obj=await this.localDatabase.get(id,opt);else obj=await this.localDatabase.get(id);const deleted=null!=(_b2=null!=(_a5=null==obj?void 0:obj.deleted)?_a5:obj._deleted)?_b2:void 0;if(!includeDeleted&&deleted)return false;if(obj.type&&"leaf"==obj.type)return false;if(!obj.type||obj.type&&"notes"==obj.type||"newnote"==obj.type||"plain"==obj.type){const note=obj;let children2=[],type="plain";if("newnote"==obj.type||"plain"==obj.type){children2=obj.children;type=obj.type}return{data:"",_id:note._id,path:path2,ctime:note.ctime,mtime:note.mtime,size:note.size,_rev:obj._rev,_conflicts:obj._conflicts,children:children2,datatype:type,deleted,type,eden:"eden"in obj?obj.eden:{}}}}catch(ex){if(isErrorOfMissingDoc(ex))return false;throw ex}return false}async getDBEntry(path2,opt,dump=false,waitForReady=true,includeDeleted=false){const meta=await this.getDBEntryMeta(path2,opt,includeDeleted);if(meta)return await this.getDBEntryFromMeta(meta,opt,dump,waitForReady,includeDeleted);else return false}async getDBEntryFromMeta(meta,opt,dump=false,waitForReady=true,includeDeleted=false){var _a5,_b2,_c2;const filename=this.id2path(meta._id,meta);if(!this.isTargetFile(filename))return false;const dispFilename=stripAllPrefixes(filename),deleted=null!=(_b2=null!=(_a5=meta.deleted)?_a5:meta._deleted)?_b2:void 0;if(!meta.type||meta.type&&"notes"==meta.type){const note=meta,doc={data:note.data,path:note.path,_id:note._id,ctime:note.ctime,mtime:note.mtime,size:note.size,_rev:meta._rev,_conflicts:meta._conflicts,children:[],datatype:"newnote",deleted,type:"newnote",eden:"eden"in meta?meta.eden:{}};if(dump){Logger("--Old fashioned document--");Logger(doc)}return doc}if("newnote"==meta.type||"plain"==meta.type){if(dump){const conflicts=await this.localDatabase.get(meta._id,{conflicts:true,revs_info:true});Logger("-- Conflicts --");Logger(null!=(_c2=conflicts._conflicts)?_c2:"No conflicts");Logger("-- Revs info -- ");Logger(conflicts._revs_info)}try{if(dump){Logger("--Bare document--");Logger(meta)}const childrenKeys=[...meta.children],loadedChildrenMap=new Map;if(meta.eden)Object.entries(meta.eden).forEach((([key2,chunk])=>loadedChildrenMap.set(key2,chunk.data)));const missingChunks=unique(childrenKeys).filter((e4=>!loadedChildrenMap.has(e4)));if(0!=missingChunks.length)if(this.isOnDemandChunkEnabled){const items=await this.collectChunks(missingChunks,false,waitForReady);if(!items||items.some((leaf=>"leaf"!=leaf.type))){Logger(`Chunks of ${dispFilename} (${meta._id.substring(0,8)}) are not valid. (p1)`,LOG_LEVEL_NOTICE);if(items)Logger(`Missing chunks: ${items.map((e4=>e4._id)).join(",")}`,LOG_LEVEL_VERBOSE);return false}items.forEach((chunk=>loadedChildrenMap.set(chunk._id,chunk.data)))}else try{if(waitForReady)(await Promise.all(missingChunks.map((e4=>this.getDBLeaf(e4,waitForReady))))).forEach(((value,idx2)=>loadedChildrenMap.set(missingChunks[idx2],value)));else{const chunkDocs=await this.localDatabase.allDocs({keys:missingChunks,include_docs:true});if(chunkDocs.rows.some((e4=>"error"in e4))){const missingChunks2=chunkDocs.rows.filter((e4=>"error"in e4)).map((e4=>e4.key)).join(", ");Logger(`Chunks of ${dispFilename} (${meta._id.substring(0,8)}) are not valid. (p2)`,LOG_LEVEL_NOTICE);Logger(`Missing chunks: ${missingChunks2}`,LOG_LEVEL_VERBOSE);return false}if(chunkDocs.rows.some((e4=>e4.doc&&"leaf"!=e4.doc.type))){const missingChunks2=chunkDocs.rows.filter((e4=>e4.doc&&"leaf"!=e4.doc.type)).map((e4=>e4.id)).join(", ");Logger(`Chunks of ${dispFilename} (${meta._id.substring(0,8)}) are not valid. (p3)`,LOG_LEVEL_NOTICE);Logger(`Corrupted chunks: ${missingChunks2}`,LOG_LEVEL_VERBOSE);return false}chunkDocs.rows.forEach(((value,idx2)=>"doc"in value&&loadedChildrenMap.set(value.doc._id,value.doc.data)))}}catch(ex){Logger(`Something went wrong on reading chunks of ${dispFilename}(${meta._id.substring(0,8)}) from database, see verbose info for detail.`,LOG_LEVEL_NOTICE);Logger(ex,LOG_LEVEL_VERBOSE);return false}const l2=childrenKeys.map((e4=>loadedChildrenMap.get(e4)));if(l2.some((e4=>void 0===e4)))throw new Error("Load failed");const doc={data:l2,path:meta.path,_id:meta._id,ctime:meta.ctime,mtime:meta.mtime,size:meta.size,_rev:meta._rev,children:meta.children,datatype:meta.type,_conflicts:meta._conflicts,eden:meta.eden,deleted,type:meta.type};if(dump){Logger("--Loaded Document--");Logger(doc)}return doc}catch(ex){if(isErrorOfMissingDoc(ex)){Logger(`Missing document content!, could not read ${dispFilename}(${meta._id.substring(0,8)}) from database.`,LOG_LEVEL_NOTICE);return false}Logger(`Something went wrong on reading ${dispFilename}(${meta._id.substring(0,8)}) from database:`,LOG_LEVEL_NOTICE);Logger(ex)}}return false}async deleteDBEntry(path2,opt){var _a5;if(!this.isTargetFile(path2))return false;const id=await this.path2id(path2);try{return null!=(_a5=await serialized("file:"+path2,(async()=>{let obj=null;if(opt)obj=await this.localDatabase.get(id,opt);else obj=await this.localDatabase.get(id);const revDeletion=opt&&""!=("rev"in opt?opt.rev:"");if(obj.type&&"leaf"==obj.type)return false;if(!obj.type||obj.type&&"notes"==obj.type){obj._deleted=true;const r2=await this.localDatabase.put(obj,{force:!revDeletion});Logger(`Entry removed:${path2} (${obj._id.substring(0,8)}-${r2.rev})`);return true}if("newnote"==obj.type||"plain"==obj.type){if(revDeletion)obj._deleted=true;else{obj.deleted=true;obj.mtime=Date.now();if(this.settings.deleteMetadataOfDeletedFiles)obj._deleted=true}const r2=await this.localDatabase.put(obj,{force:!revDeletion});Logger(`Entry removed:${path2} (${obj._id.substring(0,8)}-${r2.rev})`);return true}else return false})))?_a5:false}catch(ex){if(isErrorOfMissingDoc(ex))return false;throw ex}}async deleteDBEntryPrefix(prefix){let c2=0,readCount=0;const delDocs=[];do{const result=await this.localDatabase.allDocs({include_docs:false,skip:c2,limit:100,conflicts:true});readCount=result.rows.length;if(readCount>0)for(const v2 of result.rows){const decodedPath=this.id2path(v2.id,v2.doc);if(decodedPath.startsWith(prefix)){if(this.isTargetFile(decodedPath))delDocs.push(v2.id)}else if(!v2.id.startsWith("h:"));}c2+=readCount}while(0!=readCount);let deleteCount=0,notfound=0;for(const v2 of delDocs)try{await serialized("file:"+v2,(async()=>{const item=await this.localDatabase.get(v2);if("newnote"==item.type||"plain"==item.type){item.deleted=true;if(this.settings.deleteMetadataOfDeletedFiles)item._deleted=true;item.mtime=Date.now()}else item._deleted=true;await this.localDatabase.put(item,{force:true})}));deleteCount++}catch(ex){if(isErrorOfMissingDoc(ex))notfound++;else throw ex}Logger(`deleteDBEntryPrefix:deleted ${deleteCount} items, skipped ${notfound}`);return true}async putDBEntry(note,onlyChunks){var _a5;const filename=this.id2path(note._id,note),dispFilename=stripAllPrefixes(filename);if(!note.eden)note.eden={};if(!this.isTargetFile(filename)){Logger(`File skipped:${dispFilename}`,LOG_LEVEL_VERBOSE);return false}let processed=0;const pieceSize=Math.floor(MAX_DOC_SIZE_BIN*(1*(this.settings.customChunkSize||0)+1));let plainSplit=false;const minimumChunkSize=this.settings.minimumChunkSize;if(false)plainSplit=false;else if(shouldSplitAsPlainText(filename))plainSplit=true;const data=note.data instanceof Blob?note.data:createTextBlob(note.data);note.type=isTextBlob(data)?"plain":"newnote";note.datatype=note.type;const splitFuncInMainThread=this.settings.enableChunkSplitterV2?splitPieces2V2:splitPieces2,splitFuncInWorker=this.settings.enableChunkSplitterV2?splitPieces2WorkerV2:splitPieces2Worker,splitFunc=this.settings.disableWorkerForGeneratingChunks?splitFuncInMainThread:this.settings.processSmallFilesInUIThread&¬e.data.size<1024?splitFuncInMainThread:splitFuncInWorker,pieces=await splitFunc(data,pieceSize,plainSplit,minimumChunkSize,filename,this.settings.useSegmenter),chunkTasks=[];for await(const piece of pieces()){processed++;chunkTasks.push(this.getChunk(piece,note))}const chunks=await Promise.all(chunkTasks);if(chunks.some((e4=>false===e4))){Logger(`This document could not be saved:${dispFilename}`,LOG_LEVEL_NOTICE);return false}let eden={},currentRevAsNo=0;if("eden"in note)eden=note.eden;let newChunks=[];if(this.settings.useEden&&!onlyChunks){try{const old=await this.localDatabase.get(note._id);currentRevAsNo=getNoFromRev(old._rev);eden={..."eden"in old?old.eden:{},...eden}}catch(ex){if(isErrorOfMissingDoc(ex));else throw ex}const chunkOnEdenInitial=Object.keys(eden).length;let removedChunkOnEden=0;const removeEdenChunks=Object.keys(eden).filter((e4=>chunks.every((c2=>c2.id!==e4))));for(const removeId of removeEdenChunks){removedChunkOnEden++;delete eden[removeId]}let newChunkOnEden=0,existChunkOnEden=0;for(const chunk of chunks)if(chunk.id in eden)existChunkOnEden++;else{newChunkOnEden++;eden[chunk.id]={epoch:currentRevAsNo+1,data:chunk.piece}}const allEdenChunks=Object.entries(eden).sort(((a2,b3)=>b3[1].epoch-a2[1].epoch));let totalLength=0,count=0;const allEdenChunksKey=Object.keys(eden);let alreadyIndependent=0,independent=0;const edenChunkOnDB=(await this.localDatabase.allDocs({keys:allEdenChunksKey})).rows.reduce(((p2,c2)=>({...p2,[c2.key]:c2})),{});for(const[key2,chunk]of allEdenChunks){count++;let makeChunkIndependent=false;if(!(key2 in edenChunkOnDB)||edenChunkOnDB[key2].error){if(chunk.data.length>1024)makeChunkIndependent=true;else if(chunk.epoch+this.settings.maxAgeInEdenthis.settings.maxTotalLengthInEden)makeChunkIndependent=true;if(count>this.settings.maxChunksInEden)makeChunkIndependent=true;if(makeChunkIndependent){count--;independent++;newChunks.push({_id:key2,data:chunk.data,type:"leaf"});delete eden[key2]}else totalLength+=chunk.data.length}else{count--;delete eden[key2];alreadyIndependent++}}Logger(`Progress on Eden: doc: ${dispFilename} : ${chunkOnEdenInitial}->${Object.keys(eden).length} (removed: ${removedChunkOnEden}, new: ${newChunkOnEden}, exist: ${existChunkOnEden}, alreadyIndependent:${alreadyIndependent}, independent:${independent})`,LOG_LEVEL_VERBOSE)}else newChunks=chunks.filter((e4=>e4.isNew)).map((e4=>({_id:e4.id,data:e4.piece,type:"leaf"})));const cached=processed-newChunks.length;if(newChunks.length){if(!this.settings.doNotUseFixedRevisionForChunks)newChunks=newChunks.map((e4=>({...e4,_rev:createChunkRev(e4)})));const existsMap=(await this.localDatabase.allDocs({keys:newChunks.map((e4=>e4._id)),include_docs:false})).rows.map((e4=>[e4.key,"error"in e4?e4.error:e4.value.rev])).reduce(((p2,c2)=>({...p2,[c2[0]]:c2[1]})),{}),result=await this.localDatabase.bulkDocs(newChunks,{new_edits:!!this.settings.doNotUseFixedRevisionForChunks});if(this.settings.doNotUseFixedRevisionForChunks){const mappedResults=result.reduce(((p2,item)=>{if("ok"in item){p2.ok.push(item);return p2}if("error"in item)if(409==item.status){p2.skip.push(item);return p2}p2.failed.push(item);return p2}),{ok:[],skip:[],failed:[]});if(mappedResults.failed.length){Logger(`Save failed.: ${dispFilename} :${mappedResults.failed.map((e4=>{var _a6;return null!=(_a6=null==e4?void 0:e4.id)?_a6:e4.toString()})).join(",")}`,LOG_LEVEL_VERBOSE);Logger(`This document could not be saved:${dispFilename}`,LOG_LEVEL_NOTICE);return false}Logger(`Chunks saved: doc: ${dispFilename} ,chunks: ${processed} (new:${mappedResults.ok.length}, recycled:${mappedResults.skip.length}, cached:${cached})`)}else{const erroredItems=newChunks.filter((e4=>e4._id in existsMap&&existsMap[e4._id].startsWith("1-")&&existsMap[e4._id]!=e4._rev)),actualNewChunks=newChunks.filter((e4=>!(e4._id in existsMap)||!existsMap[e4._id].startsWith("1-")));if(erroredItems.length){Logger(`Save failed.: ${dispFilename} :${erroredItems.length} items mismatched`,LOG_LEVEL_VERBOSE);Logger(`This document could not be saved:${dispFilename}`,LOG_LEVEL_NOTICE);Logger(`Mismatched items: ${erroredItems.map((e4=>e4._id)).join(",")}`,LOG_LEVEL_VERBOSE);Logger(`Revision mismatch: ${erroredItems.map((e4=>`${e4._rev}, ${existsMap[e4._id]}`)).join(",")}`,LOG_LEVEL_VERBOSE);return false}Logger(`Chunks saved (with fixed): doc: ${dispFilename} ,chunks: ${processed} (new:${actualNewChunks.length}, recycled:${newChunks.length-actualNewChunks.length}, cached:${cached})`)}}if(onlyChunks)return{id:note._id,ok:true,rev:"dummy"};const newDoc={children:chunks.map((e4=>e4.id)),_id:note._id,path:note.path,ctime:note.ctime,mtime:note.mtime,size:note.size,type:note.datatype,eden};return null!=(_a5=await serialized("file:"+filename,(async()=>{try{const old=await this.localDatabase.get(newDoc._id);newDoc._rev=old._rev}catch(ex){if(isErrorOfMissingDoc(ex));else throw ex}const r2=await this.localDatabase.put(newDoc,{force:true});if(r2.ok)return r2;else return false})))?_a5:false}async resetDatabase(){var _a5,_b2;null==(_a5=this.changeHandler)||_a5.cancel();await(null==(_b2=this.changeHandler)?void 0:_b2.removeAllListeners());this.env.$$getReplicator().closeReplication();if(!await this.env.$everyOnResetDatabase(this)){Logger("Database reset has been prevented or failed on some modules.",LOG_LEVEL_NOTICE);return false}Logger("Database closed for reset Database.");this.isReady=false;await this.localDatabase.destroy();this.localDatabase=null;await this.initializeDatabase();Logger("Local Database Reset",LOG_LEVEL_NOTICE)}isTargetFile(filenameSrc){const file=filenameSrc.startsWith("i:")?filenameSrc.substring(2):filenameSrc;if(file.startsWith("ix:"))return true;if(file.startsWith("ps:"))return true;if(file.includes(":"))return false;if(this.settings.syncOnlyRegEx){const syncOnly=new RegExp(this.settings.syncOnlyRegEx,this.settings.handleFilenameCaseSensitive?"":"i");if(!file.match(syncOnly))return false}if(this.settings.syncIgnoreRegEx){const syncIgnore=new RegExp(this.settings.syncIgnoreRegEx,this.settings.handleFilenameCaseSensitive?"":"i");if(file.match(syncIgnore))return false}return true}async collectChunks(ids,showResult=false,waitForReady){const localChunks=await this.collectChunksWithCache(ids);if(0==localChunks.filter((e4=>false===e4.chunk)).map((e4=>e4.id)).length)return localChunks.map((e4=>e4.chunk));this._chunkCollectProcessor.batchSize=this.settings.concurrencyOfReadChunksOnline;this._chunkCollectProcessor.interval=this.settings.minimumIntervalOfReadChunksOnline;this._chunkCollectProcessor.enqueueAll(ids);const fetchChunkTasks=ids.map((id=>waitForValue(`chunk-fetch-${id}`)));return(await Promise.all(fetchChunkTasks)).filter(onlyNot(RESULT_TIMED_OUT))}async _collectChunks(ids,showResult=false){const localChunks=await this.collectChunksWithCache(ids),missingChunks=localChunks.filter((e4=>false===e4.chunk)).map((e4=>e4.id));if(0==missingChunks.length)return localChunks.map((e4=>e4.chunk));const remoteDocs=await this.env.$$getReplicator().fetchRemoteChunks(missingChunks,showResult);if(false==remoteDocs){Logger("Could not fetch chunks from the server. ",showResult?LOG_LEVEL_NOTICE:LOG_LEVEL_VERBOSE,"fetch");return false}remoteDocs.forEach((e4=>this.hashCaches.set(e4._id,e4.data)));await this.localDatabase.bulkDocs(remoteDocs,{new_edits:false});const chunks=Object.fromEntries([...localChunks.map((e4=>e4.chunk)).filter((e4=>false!==e4)),...remoteDocs].map((e4=>[e4._id,e4]))),ret=ids.map((e4=>{var _a5;return null!=(_a5=null==chunks?void 0:chunks[e4])?_a5:void 0}));if(ret.some((e4=>void 0===e4)))return false;else return ret}async*findAllChunks(opt){const targets=[()=>this.findEntries("h:","h:􏿿",null!=opt?opt:{})];for(const targetFun of targets){const target=targetFun();for await(const f4 of target)yield f4}}async*findEntries(startKey,endKey,opt){let nextKey=startKey;if(""==endKey)endKey="􏿿";let req=this.allDocsRaw({limit:100,startkey:nextKey,endkey:endKey,include_docs:true,...opt});do{const docs=await req;if(0===docs.rows.length)break;nextKey=`${docs.rows[docs.rows.length-1].id}`;req=this.allDocsRaw({limit:100,skip:1,startkey:nextKey,endkey:endKey,include_docs:true,...opt});for(const row of docs.rows){const doc=row.doc;if("type"in doc)if("newnote"==doc.type||"plain"==doc.type)yield doc}}while(""!=nextKey)}async*findAllDocs(opt){const targets=[()=>this.findEntries("","_",null!=opt?opt:{}),()=>this.findEntries("_􏿿","h:",null!=opt?opt:{}),()=>this.findEntries("h:􏿿","",null!=opt?opt:{})];for(const targetFun of targets){const target=targetFun();for await(const f4 of target)yield f4}}async*findEntryNames(startKey,endKey,opt){let nextKey=startKey;if(""==endKey)endKey="􏿿";let req=this.allDocsRaw({limit:100,startkey:nextKey,endkey:endKey,...opt});do{const docs=await req;if(0==docs.rows.length){nextKey="";break}nextKey=`${docs.rows[docs.rows.length-1].key}`;req=this.allDocsRaw({limit:100,skip:1,startkey:nextKey,endkey:endKey,...opt});for(const row of docs.rows)yield row.id}while(""!=nextKey)}async*findAllDocNames(opt){const targets=[()=>this.findEntryNames("","_",null!=opt?opt:{}),()=>this.findEntryNames("_􏿿","h:",null!=opt?opt:{}),()=>this.findEntryNames("h:􏿿","i:",null!=opt?opt:{}),()=>this.findEntryNames("i:􏿿","ix:",null!=opt?opt:{}),()=>this.findEntryNames("ix:􏿿","ps:",null!=opt?opt:{}),()=>this.findEntryNames("ps:􏿿","",null!=opt?opt:{})];for(const targetFun of targets){const target=targetFun();for await(const f4 of target)if(!f4.startsWith("_"))if(f4!=VERSIONING_DOCID)yield f4}}async*findAllNormalDocs(opt){const targets=[()=>this.findEntries("","_",null!=opt?opt:{}),()=>this.findEntries("_􏿿","h:",null!=opt?opt:{}),()=>this.findEntries("h:􏿿","i:",null!=opt?opt:{}),()=>this.findEntries("i:􏿿","ix:",null!=opt?opt:{}),()=>this.findEntries("ix:􏿿","ps:",null!=opt?opt:{}),()=>this.findEntries("ps:􏿿","",null!=opt?opt:{})];for(const targetFun of targets){const target=targetFun();for await(const f4 of target)if(!f4._id.startsWith("_"))if("newnote"==f4.type||"plain"==f4.type)yield f4}}async removeRevision(docId,revision){try{const doc=await this.localDatabase.get(docId,{rev:revision});doc._deleted=true;await this.localDatabase.put(doc);return true}catch(ex){if(isErrorOfMissingDoc(ex))Logger(`Remove revision: Missing target revision, ${docId}-${revision}`,LOG_LEVEL_VERBOSE)}return false}getRaw(docId,options){return this.localDatabase.get(docId,options||{})}removeRaw(docId,revision,options){return this.localDatabase.remove(docId,revision,options||{})}putRaw(doc,options){return this.localDatabase.put(doc,options||{})}allDocsRaw(options){return this.localDatabase.allDocs(options)}bulkDocsRaw(docs,options){return this.localDatabase.bulkDocs(docs,options||{})}async collectChunksWithCache(keys2){const exists=keys2.map((e4=>this.hashCaches.has(e4)?{id:e4,chunk:this.hashCaches.get(e4)}:{id:e4,chunk:false})),notExists=exists.filter((e4=>false===e4.chunk));if(notExists.length>0){const chunks=await this.localDatabase.allDocs({keys:notExists.map((e4=>e4.id)),include_docs:true}),existChunks=chunks.rows.filter((e4=>!("error"in e4))).map((e4=>e4.doc)),nonExistsLocal=chunks.rows.filter((e4=>"error"in e4)).map((e4=>e4.key)),existChunksPurged=(await this.localDatabase.allDocs({keys:nonExistsLocal.map((e4=>`_local/${e4}`)),include_docs:true})).rows.filter((e4=>!("error"in e4))).map((e4=>({...e4.doc,_id:e4.id.substring(7)}))),temp=Object.fromEntries(existChunksPurged.map((e4=>[e4._id,e4.data])));for(const chunk of existChunks){temp[chunk._id]=chunk.data;this.hashCaches.set(chunk._id,chunk.data)}return exists.map((e4=>({id:e4.id,chunk:false!==e4.chunk?e4.chunk:e4.id in temp?temp[e4.id]:false}))).map((e4=>({id:e4.id,chunk:false!==e4.chunk?{_id:e4.id,data:e4.chunk,type:"leaf"}:false})))}else return exists.map((e4=>({id:e4.id,chunk:{_id:e4.id,data:e4.chunk,type:"leaf"}})))}async UXFileInfoToSavingEntry(file){const datatype=determineTypeFromBlob(file.body),fullPath=file.path;return{_id:await this.path2id(fullPath),path:fullPath,data:file.body,mtime:file.stat.mtime,ctime:file.stat.ctime,size:file.stat.size,children:[],datatype,type:datatype,eden:{}}}async getConflictedDoc(path2,rev3){try{const doc=await this.getDBEntry(path2,{rev:rev3},false,false,true);if(false===doc)return false;let data=getDocData(doc.data);if("newnote"==doc.datatype)data=readString(new Uint8Array(decodeBinary(doc.data)));else if("plain"==doc.datatype);return{deleted:doc.deleted||doc._deleted,ctime:doc.ctime,mtime:doc.mtime,rev:rev3,data}}catch(ex){if(isErrorOfMissingDoc(ex))return false}return false}async mergeSensibly(path2,baseRev,currentRev,conflictedRev){var _a5,_b2,_c2,_d2;const baseLeaf=await this.getConflictedDoc(path2,baseRev),leftLeaf=await this.getConflictedDoc(path2,currentRev),rightLeaf=await this.getConflictedDoc(path2,conflictedRev);let autoMerge=false;if(false==baseLeaf||false==leftLeaf||false==rightLeaf)return false;if(leftLeaf.deleted&&rightLeaf.deleted)return false;const dmp=new import_diff_match_patch2.diff_match_patch,mapLeft=dmp.diff_linesToChars_(baseLeaf.data,leftLeaf.data),diffLeftSrc=dmp.diff_main(mapLeft.chars1,mapLeft.chars2,false);dmp.diff_charsToLines_(diffLeftSrc,mapLeft.lineArray);const mapRight=dmp.diff_linesToChars_(baseLeaf.data,rightLeaf.data),diffRightSrc=dmp.diff_main(mapRight.chars1,mapRight.chars2,false);dmp.diff_charsToLines_(diffRightSrc,mapRight.lineArray);function splitDiffPiece(src){const ret=[];do{const d4=src.shift();if(void 0===d4)return ret;const pieces=d4[1].split(/([^\n]*\n)/).filter((f4=>""!=f4));if("undefined"==typeof d4)break;if(d4[0]!=import_diff_match_patch2.DIFF_DELETE)ret.push(...pieces.map((e4=>[d4[0],e4])));if(d4[0]==import_diff_match_patch2.DIFF_DELETE){const nd=src.shift();if("undefined"!=typeof nd){const piecesPair=nd[1].split(/([^\n]*\n)/).filter((f4=>""!=f4));if(nd[0]==import_diff_match_patch2.DIFF_INSERT){for(const pt of pieces){ret.push([d4[0],pt]);const pairP=piecesPair.shift();if("undefined"!=typeof pairP)ret.push([import_diff_match_patch2.DIFF_INSERT,pairP])}ret.push(...piecesPair.map((e4=>[nd[0],e4])))}else{ret.push(...pieces.map((e4=>[d4[0],e4])));ret.push(...piecesPair.map((e4=>[nd[0],e4])))}}else ret.push(...pieces.map((e4=>[0,e4])))}}while(src.length>0);return ret}const diffLeft=splitDiffPiece(diffLeftSrc),diffRight=splitDiffPiece(diffRightSrc);let rightIdx=0,leftIdx=0;const merged=[];autoMerge=true;LOOP_MERGE:do{if(leftIdx>=diffLeft.length&&rightIdx>=diffRight.length)break LOOP_MERGE;const leftItem=null!=(_a5=diffLeft[leftIdx])?_a5:[0,""],rightItem=null!=(_b2=diffRight[rightIdx])?_b2:[0,""];leftIdx++;rightIdx++;if(leftItem[0]!=import_diff_match_patch2.DIFF_EQUAL||rightItem[0]!=import_diff_match_patch2.DIFF_EQUAL||leftItem[1]!=rightItem[1]){if(leftItem[0]==import_diff_match_patch2.DIFF_DELETE&&rightItem[0]==import_diff_match_patch2.DIFF_DELETE&&leftItem[1]==rightItem[1]){const nextLeftIdx=leftIdx,nextRightIdx=rightIdx,[nextLeftItem,nextRightItem]=[null!=(_c2=diffLeft[nextLeftIdx])?_c2:[0,""],null!=(_d2=diffRight[nextRightIdx])?_d2:[0,""]];if(nextLeftItem[0]==import_diff_match_patch2.DIFF_INSERT&&nextRightItem[0]==import_diff_match_patch2.DIFF_INSERT&&nextLeftItem[1]!=nextRightItem[1]){autoMerge=false;break}else{merged.push(leftItem);continue}}if(leftItem[0]==import_diff_match_patch2.DIFF_INSERT&&rightItem[0]==import_diff_match_patch2.DIFF_INSERT)if(leftItem[1]==rightItem[1]){merged.push(leftItem);continue}else if(leftLeaf.mtime<=rightLeaf.mtime){merged.push(leftItem);merged.push(rightItem);continue}else{merged.push(rightItem);merged.push(leftItem);continue}if(leftItem[0]!=import_diff_match_patch2.DIFF_INSERT)if(rightItem[0]!=import_diff_match_patch2.DIFF_INSERT){if(rightItem[1]!=leftItem[1]){Logger(`MERGING PANIC:${leftItem[0]},${leftItem[1]} == ${rightItem[0]},${rightItem[1]}`,LOG_LEVEL_VERBOSE);autoMerge=false;break LOOP_MERGE}if(leftItem[0]==import_diff_match_patch2.DIFF_DELETE)if(rightItem[0]==import_diff_match_patch2.DIFF_EQUAL){merged.push(leftItem);continue}else{autoMerge=false;break LOOP_MERGE}if(rightItem[0]==import_diff_match_patch2.DIFF_DELETE)if(leftItem[0]==import_diff_match_patch2.DIFF_EQUAL){merged.push(rightItem);continue}else{autoMerge=false;break LOOP_MERGE}Logger(`Weird condition:${leftItem[0]},${leftItem[1]} == ${rightItem[0]},${rightItem[1]}`,LOG_LEVEL_VERBOSE);break LOOP_MERGE}else{leftIdx--;merged.push(rightItem)}else{rightIdx--;merged.push(leftItem)}}else merged.push(leftItem)}while(leftIdxa2.mtime-b3.mtime));let newObj={...baseObj};for(const patch of patches)newObj=applyPatch(newObj,patch.patch);return JSON.stringify(newObj.data)}catch(ex){Logger("Could not merge object");Logger(ex,LOG_LEVEL_VERBOSE);return false}}async tryAutoMerge(path2,enableMarkdownAutoMerge){var _a5,_b2;const test=await this.getDBEntry(path2,{conflicts:true,revs_info:true},false,false,true);if(false===test)return{ok:MISSING_OR_ERROR};if(null==test)return{ok:MISSING_OR_ERROR};if(!test._conflicts)return{ok:NOT_CONFLICTED};if(0==test._conflicts.length)return{ok:NOT_CONFLICTED};const conflicts=test._conflicts.sort(((a2,b3)=>Number(a2.split("-")[0])-Number(b3.split("-")[0])));if((isSensibleMargeApplicable(path2)||isObjectMargeApplicable(path2))&&enableMarkdownAutoMerge){const conflictedRev=conflicts[0],conflictedRevNo=Number(conflictedRev.split("-")[0]),commonBase=null!=(_b2=null==(_a5=((await this.getRaw(await this.path2id(path2),{revs_info:true}))._revs_info||[]).filter((e4=>"available"==e4.status&&Number(e4.rev.split("-")[0])e4[0]!=import_diff_match_patch2.DIFF_DELETE)).map((e4=>e4[1])).join("");Logger(`Sensible merge:${path2}`,LOG_LEVEL_INFO)}else Logger("Sensible merge is not applicable.",LOG_LEVEL_VERBOSE)}else if(isObjectMargeApplicable(path2)){const result=await this.mergeObject(path2,commonBase,test._rev,conflictedRev);if(result){Logger(`Object merge:${path2}`,LOG_LEVEL_INFO);p2=result}else Logger("Object merge is not applicable.",LOG_LEVEL_VERBOSE)}if(void 0!==p2)return{result:p2,conflictedRev}}}const leftLeaf=await this.getConflictedDoc(path2,test._rev),rightLeaf=await this.getConflictedDoc(path2,conflicts[0]);return{leftRev:test._rev,rightRev:conflicts[0],leftLeaf,rightLeaf}}},LiveSyncAbstractReplicator=class{constructor(env){this.syncStatus="NOT_CONNECTED";this.docArrived=0;this.docSent=0;this.lastSyncPullSeq=0;this.maxPullSeq=0;this.lastSyncPushSeq=0;this.maxPushSeq=0;this.nodeid="";this.remoteLocked=false;this.remoteCleaned=false;this.remoteLockedAndDeviceNotAccepted=false;this.tweakSettingsMismatched=false;this.updateInfo=()=>{this.env.replicationStat.value={sent:this.docSent,arrived:this.docArrived,maxPullSeq:this.maxPullSeq,maxPushSeq:this.maxPushSeq,lastSyncPullSeq:this.lastSyncPullSeq,lastSyncPushSeq:this.lastSyncPushSeq,syncStatus:this.syncStatus}};this.env=env}async initializeDatabaseForReplication(){const db=this.env.getDatabase();try{const nodeinfo=await resolveWithIgnoreKnownError(db.get(NODEINFO_DOCID),{_id:NODEINFO_DOCID,type:"nodeinfo",nodeid:"",v20220607:true});if(""==nodeinfo.nodeid){nodeinfo.nodeid=Math.random().toString(36).slice(-10);await db.put(nodeinfo)}this.nodeid=nodeinfo.nodeid;return true}catch(ex){Logger(ex)}return false}},instanceOfAny=(object,constructors)=>constructors.some((c2=>object instanceof c2));function getIdbProxyableTypes(){return idbProxyableTypes||(idbProxyableTypes=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function getCursorAdvanceMethods(){return cursorAdvanceMethods||(cursorAdvanceMethods=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var transactionDoneMap=new WeakMap,transformCache=new WeakMap,reverseTransformCache=new WeakMap;function promisifyRequest(request2){const promise2=new Promise(((resolve,reject)=>{const unlisten=()=>{request2.removeEventListener("success",success);request2.removeEventListener("error",error)},success=()=>{resolve(wrap(request2.result));unlisten()},error=()=>{reject(request2.error);unlisten()};request2.addEventListener("success",success);request2.addEventListener("error",error)}));reverseTransformCache.set(promise2,request2);return promise2}function cacheDonePromiseForTransaction(tx){if(transactionDoneMap.has(tx))return;const done=new Promise(((resolve,reject)=>{const unlisten=()=>{tx.removeEventListener("complete",complete);tx.removeEventListener("error",error);tx.removeEventListener("abort",error)},complete=()=>{resolve();unlisten()},error=()=>{reject(tx.error||new DOMException("AbortError","AbortError"));unlisten()};tx.addEventListener("complete",complete);tx.addEventListener("error",error);tx.addEventListener("abort",error)}));transactionDoneMap.set(tx,done)}var idbProxyTraps={get(target,prop,receiver){if(target instanceof IDBTransaction){if("done"===prop)return transactionDoneMap.get(target);if("store"===prop)return receiver.objectStoreNames[1]?void 0:receiver.objectStore(receiver.objectStoreNames[0])}return wrap(target[prop])},set(target,prop,value){target[prop]=value;return true},has(target,prop){if(target instanceof IDBTransaction&&("done"===prop||"store"===prop))return true;else return prop in target}};function replaceTraps(callback){idbProxyTraps=callback(idbProxyTraps)}function wrapFunction(func){if(getCursorAdvanceMethods().includes(func))return function(...args){func.apply(unwrap(this),args);return wrap(this.request)};else return function(...args){return wrap(func.apply(unwrap(this),args))}}function transformCachableValue(value){if("function"==typeof value)return wrapFunction(value);if(value instanceof IDBTransaction)cacheDonePromiseForTransaction(value);if(instanceOfAny(value,getIdbProxyableTypes()))return new Proxy(value,idbProxyTraps);else return value}function wrap(value){if(value instanceof IDBRequest)return promisifyRequest(value);if(transformCache.has(value))return transformCache.get(value);const newValue=transformCachableValue(value);if(newValue!==value){transformCache.set(value,newValue);reverseTransformCache.set(newValue,value)}return newValue}var unwrap=value=>reverseTransformCache.get(value);function openDB(name,version2,{blocked,upgrade,blocking,terminated}={}){const request2=indexedDB.open(name,version2),openPromise=wrap(request2);if(upgrade)request2.addEventListener("upgradeneeded",(event=>{upgrade(wrap(request2.result),event.oldVersion,event.newVersion,wrap(request2.transaction),event)}));if(blocked)request2.addEventListener("blocked",(event=>blocked(event.oldVersion,event.newVersion,event)));openPromise.then((db=>{if(terminated)db.addEventListener("close",(()=>terminated()));if(blocking)db.addEventListener("versionchange",(event=>blocking(event.oldVersion,event.newVersion,event)))})).catch((()=>{}));return openPromise}function deleteDB(name,{blocked}={}){const request2=indexedDB.deleteDatabase(name);if(blocked)request2.addEventListener("blocked",(event=>blocked(event.oldVersion,event)));return wrap(request2).then((()=>{}))}var readMethods=["get","getKey","getAll","getAllKeys","count"],writeMethods=["put","add","delete","clear"],cachedMethods=new Map;function getMethod(target,prop){if(!(target instanceof IDBDatabase&&!(prop in target)&&"string"==typeof prop))return;if(cachedMethods.get(prop))return cachedMethods.get(prop);const targetFuncName=prop.replace(/FromIndex$/,""),useIndex=prop!==targetFuncName,isWrite=writeMethods.includes(targetFuncName);if(!(targetFuncName in(useIndex?IDBIndex:IDBObjectStore).prototype)||!(isWrite||readMethods.includes(targetFuncName)))return;const method=async function(storeName,...args){const tx=this.transaction(storeName,isWrite?"readwrite":"readonly");let target2=tx.store;if(useIndex)target2=target2.index(args.shift());return(await Promise.all([target2[targetFuncName](...args),isWrite&&tx.done]))[0]};cachedMethods.set(prop,method);return method}replaceTraps((oldTraps=>({...oldTraps,get:(target,prop,receiver)=>getMethod(target,prop)||oldTraps.get(target,prop,receiver),has:(target,prop)=>!!getMethod(target,prop)||oldTraps.has(target,prop)})));var advanceMethodProps=["continue","continuePrimaryKey","advance"],methodMap={},advanceResults=new WeakMap,ittrProxiedCursorToOriginalProxy=new WeakMap,cursorIteratorTraps={get(target,prop){if(!advanceMethodProps.includes(prop))return target[prop];let cachedFunc=methodMap[prop];if(!cachedFunc)cachedFunc=methodMap[prop]=function(...args){advanceResults.set(this,ittrProxiedCursorToOriginalProxy.get(this)[prop](...args))};return cachedFunc}};async function*iterate(...args){let cursor=this;if(!(cursor instanceof IDBCursor))cursor=await cursor.openCursor(...args);if(!cursor)return;const proxiedCursor=new Proxy(cursor,cursorIteratorTraps);ittrProxiedCursorToOriginalProxy.set(proxiedCursor,cursor);reverseTransformCache.set(proxiedCursor,unwrap(cursor));for(;cursor;){yield proxiedCursor;cursor=await(advanceResults.get(proxiedCursor)||cursor.continue());advanceResults.delete(proxiedCursor)}}function isIteratorProp(target,prop){return prop===Symbol.asyncIterator&&instanceOfAny(target,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===prop&&instanceOfAny(target,[IDBIndex,IDBObjectStore])}replaceTraps((oldTraps=>({...oldTraps,get(target,prop,receiver){if(isIteratorProp(target,prop))return iterate;else return oldTraps.get(target,prop,receiver)},has:(target,prop)=>isIteratorProp(target,prop)||oldTraps.has(target,prop)})));var databaseCache={},OpenKeyValueDatabase=async dbKey=>{if(dbKey in databaseCache){databaseCache[dbKey].close();delete databaseCache[dbKey]}const storeKey=dbKey,dbPromise=openDB(dbKey,1,{upgrade(db2){db2.createObjectStore(storeKey)}}),db=await dbPromise;databaseCache[dbKey]=db;return{get:async key2=>await db.get(storeKey,key2),set:async(key2,value)=>await db.put(storeKey,value,key2),del:async key2=>await db.delete(storeKey,key2),clear:async()=>await db.clear(storeKey),keys:async(query3,count)=>await db.getAllKeys(storeKey,query3,count),close(){delete databaseCache[dbKey];return db.close()},async destroy(){delete databaseCache[dbKey];db.close();await deleteDB(dbKey)}}};function unwrapTaskResult(result){if("ok"in result)return result.ok;if("err"in result)return result.err;throw new Error("Argument Exception: Could not unwrap")}function isTaskWaiting(task){if(task instanceof Promise)return false;if(task instanceof Function)return true;throw new Error("Invalid state")}async function wrapEachProcess(key2,task){try{return{key:key2,ok:await task}}catch(ex){return{key:key2,err:ex instanceof Error?ex:new Error(`${ex}`)}}}async function*processAllGeneratorTasksWithConcurrencyLimit(limit,tasks4){const nowProcessing=new Map;let idx2=0,generatorDone=false;for(;nowProcessing.size>0||!generatorDone;){L2:for(;nowProcessing.sizecallback(e4);yield closure}}async function*pipeArrayToGenerator(array,callback){for(const e4 of array){const closure=()=>callback(e4);yield closure}}async function*processAllTasksWithConcurrencyLimit(limit,tasks4){const nowProcessing=new Map;let idx2=0;const pendingTasks=tasks4.reverse();for(;pendingTasks.length>0||nowProcessing.size>0;){L2:for(;nowProcessing.size0;){const task=pendingTasks.pop();if(void 0===task)break L2;idx2++;const wrappedPromise=wrapEachProcess(idx2,isTaskWaiting(task)?task():task);nowProcessing.set(idx2,wrappedPromise)}const done=await Promise.race(nowProcessing.values());nowProcessing.delete(done.key);yield done}}async function mapAllTasksWithConcurrencyLimit(limit,tasks4){const results=new Map;for await(const v2 of processAllTasksWithConcurrencyLimit(limit,tasks4))results.set(v2.key,v2);return[...results.entries()].sort(((a2,b3)=>a2[0]-b3[0])).map((e4=>e4[1]))}var tasks2={};function scheduleTask(key2,timeout,proc,skipIfTaskExist){if(!skipIfTaskExist||!(key2 in tasks2)){cancelTask(key2);tasks2[key2]=setTimeout((async()=>{delete tasks2[key2];await proc()}),timeout)}}function cancelTask(key2){if(key2 in tasks2){clearTimeout(tasks2[key2]);delete tasks2[key2]}}function cancelAllTasks(){for(const v2 in tasks2){clearTimeout(tasks2[v2]);delete tasks2[v2]}}var intervals={};function setPeriodicTask(key2,timeout,proc){cancelPeriodicTask(key2);intervals[key2]=setInterval((async()=>{delete intervals[key2];await proc()}),timeout)}function cancelPeriodicTask(key2){if(key2 in intervals){clearInterval(intervals[key2]);delete intervals[key2]}}function cancelAllPeriodicTask(){for(const v2 in intervals){clearInterval(intervals[v2]);delete intervals[v2]}}var waitingItems=new Map;function waitForTimeout(key2,timeout){if(waitingItems.has(key2))return waitingItems.get(key2).timeoutPromise.promise;const timeoutPromise=promiseWithResolver(),timer=setTimeout((()=>{finishWaitingForTimeout(key2,true)}),timeout);waitingItems.set(key2,{waitFrom:Date.now(),timeout,timeoutPromise,timer});return timeoutPromise.promise}function finishWaitingForTimeout(key2,hasTimeout=false){const x2=waitingItems.get(key2);if(x2){if(x2.timer)clearTimeout(x2.timer);x2.timeoutPromise.resolve(hasTimeout);waitingItems.delete(key2);return true}return false}function finishAllWaitingForTimeout(prefix,hasTimeout){for(const[key2,_]of waitingItems)if(key2.startsWith(prefix))finishWaitingForTimeout(key2,hasTimeout)}function isWaitingForTimeout(key2){return waitingItems.has(key2)}var sameChangePairs,YieldOperationNumbers=100,PersistentMap=class{flush(){this._save()}_save(){localStorage.setItem(this._key,JSON.stringify([...this._map.entries()]))}_load(suppliedEntries=[]){var _a5;try{const savedSource=null!=(_a5=localStorage.getItem(this._key))?_a5:"",sourceToParse=""===savedSource?"[]":savedSource,obj=JSON.parse(sourceToParse);this._map=new Map([...obj,...suppliedEntries])}catch(ex){console.log(`Map read error : ${this._key}`);console.dir(ex);this._map=new Map([...suppliedEntries])}return Promise.resolve()}_queueSave(){this._setCount--;if(this._setCount<0){this._setCount=YieldOperationNumbers;scheduleTask(`save-map-${this._key}`,0,(()=>this._save()))}scheduleTask(`save-map-${this._key}`,150,(()=>this._save()))}delete(key2){const ret=this._map.delete(key2);this._queueSave();return ret}has(key2){return this._map.has(key2)}set(key2,value){this._map.set(key2,value);this._queueSave();return this}clear(){this._map=new Map;this._save()}get(key2,defValue){const v2=this._map.get(key2);if(void 0===v2)return defValue;else return v2}constructor(key2,entries){Object.defineProperty(this,"_setCount",{enumerable:true,configurable:true,writable:true,value:YieldOperationNumbers});Object.defineProperty(this,"_map",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_key",{enumerable:true,configurable:true,writable:true,value:void 0});this._key=key2;this._map=new Map(null!=entries?entries:[]);this._load(entries)}};function initializeStores(vaultName){sameChangePairs=new PersistentMap(`ls-persist-same-changes-${vaultName}`)}async function path2id(filename,obfuscatePassphrase,caseInsensitive){const temp=filename.split(":"),path2=temp.pop(),normalizedPath=normalizePath(path2);temp.push(normalizedPath);const fixedPath=temp.join(":");return await path2id_base(fixedPath,obfuscatePassphrase,caseInsensitive)}function id2path(id,entry){const temp=id2path_base(id,entry).split(":"),path2=temp.pop(),normalizedPath=normalizePath(path2);temp.push(normalizedPath);return temp.join(":")}function getPath2(entry){return id2path(entry._id,entry)}function getPathWithoutPrefix2(entry){return stripAllPrefixes(getPath2(entry))}function getPathFromTFile(file){return file.path}function isInternalFile(file){if("string"==typeof file)return file.startsWith(ICHeader);if(file.isInternal)return true;else return false}function getPathFromUXFileInfo(file){if("string"==typeof file)return file;else return file.path}function getStoragePathFromUXFileInfo(file){if("string"==typeof file)return stripAllPrefixes(file);else return stripAllPrefixes(file.path)}function getDatabasePathFromUXFileInfo(file){const prefix=isInternalFile(file)?ICHeader:"";if("string"==typeof file)return prefix+stripAllPrefixes(file);else return prefix+stripAllPrefixes(file.path)}var memos={};function memoObject(key2,obj){memos[key2]=obj;return memos[key2]}async function memoIfNotExist(key2,func){if(!(key2 in memos)){const w2=func(),v2=w2 instanceof Promise?await w2:w2;memos[key2]=v2}return memos[key2]}function retrieveMemoObject(key2){if(key2 in memos)return memos[key2];else return false}function disposeMemoObject(key2){delete memos[key2]}function isValidPath(filename){if(import_obsidian.Platform.isDesktop){if("darwin"==process.platform)return isValidFilenameInDarwin(filename);if("linux"==process.platform)return isValidFilenameInLinux(filename);else return isValidFilenameInWidows(filename)}if(import_obsidian.Platform.isAndroidApp)return isValidFilenameInAndroid(filename);if(import_obsidian.Platform.isIosApp)return isValidFilenameInDarwin(filename);Logger("Could not determine platform for checking filename",LOG_LEVEL_VERBOSE);return isValidFilenameInWidows(filename)}function trimPrefix(target,prefix){return target.startsWith(prefix)?target.substring(prefix.length):target}function isInternalMetadata(id){return id.startsWith(ICHeader)}function stripInternalMetadataPrefix(id){return id.substring(ICHeaderLength)}function id2InternalMetadataId(id){return ICHeader+id}function isChunk(str){return str.startsWith(CHeader)}function isPluginMetadata(str){return str.startsWith(PSCHeader)}function isCustomisationSyncMetadata(str){return str.startsWith(ICXHeader)}var PeriodicProcessor=class{constructor(plugin3,process2){this._timer=void 0;this._plugin=plugin3;this._process=process2;eventHub.onceEvent(EVENT_PLUGIN_UNLOADED,(()=>{this.disable()}))}async process(){try{await this._process()}catch(ex){Logger(ex)}}enable(interval){this.disable();if(0!=interval){this._timer=window.setInterval((()=>fireAndForget((async()=>{await this.process();if(this._plugin.$$isUnloaded())this.disable()}))),interval);this._plugin.registerInterval(this._timer)}}disable(){if(void 0!==this._timer){window.clearInterval(this._timer);this._timer=void 0}}},_requestToCouchDBFetch2=async(baseUri,username,password,path2,body,method)=>{const utf8str=String.fromCharCode.apply(null,[...writeString(`${username}:${password}`)]),encoded=window.btoa(utf8str),uri=`${baseUri}/${path2}`,requestParam={url:uri,method:method||(body?"PUT":"GET"),headers:new Headers({authorization:"Basic "+encoded,"content-type":"application/json"}),contentType:"application/json",body:JSON.stringify(body)};return await fetch(uri,requestParam)},_requestToCouchDB=async(baseUri,username,password,origin2,path2,body,method)=>{const utf8str=String.fromCharCode.apply(null,[...writeString(`${username}:${password}`)]),requestParam={url:`${baseUri}/${path2}`,method:method||(body?"PUT":"GET"),headers:{authorization:"Basic "+window.btoa(utf8str),origin:origin2},contentType:"application/json",body:body?JSON.stringify(body):void 0};return await(0,import_obsidian.requestUrl)(requestParam)},requestToCouchDB=async(baseUri,username,password,origin2="",key2,body,method)=>{const uri="_node/_local/_config"+(key2?"/"+key2:"");return await _requestToCouchDB(baseUri,username,password,origin2,uri,body,method)},BASE_IS_NEW=Symbol("base"),TARGET_IS_NEW=Symbol("target"),EVEN=Symbol("even"),resolution=2e3;function compareMTime(baseMTime,targetMTime){const truncatedBaseMTime=~~(baseMTime/resolution)*resolution,truncatedTargetMTime=~~(targetMTime/resolution)*resolution;if(truncatedBaseMTime==truncatedTargetMTime)return EVEN;if(truncatedBaseMTime>truncatedTargetMTime)return BASE_IS_NEW;if(truncatedBaseMTimee4==mtime1||e4==mtime2)))sameChangePairs.set(key2,[...new Set([...pairs,mtime1,mtime2])]);else sameChangePairs.set(key2,[mtime1,mtime2])}function unmarkChanges(file){const key2=getKey(file);sameChangePairs.delete(key2)}function isMarkedAsSameChanges(file,mtimes){const key2=getKey(file),pairs=sameChangePairs.get(key2,[])||[];if(mtimes.every((e4=>-1!==pairs.indexOf(e4))))return EVEN}function compareFileFreshness(baseFile,checkTarget){var _a5,_b2,_c2,_d2,_e2,_f;if(void 0===baseFile&&null==checkTarget)return EVEN;if(null==baseFile)return TARGET_IS_NEW;if(null==checkTarget)return BASE_IS_NEW;const modifiedBase="stat"in baseFile?null!=(_b2=null==(_a5=null==baseFile?void 0:baseFile.stat)?void 0:_a5.mtime)?_b2:0:null!=(_c2=null==baseFile?void 0:baseFile.mtime)?_c2:0,modifiedTarget="stat"in checkTarget?null!=(_e2=null==(_d2=null==checkTarget?void 0:checkTarget.stat)?void 0:_d2.mtime)?_e2:0:null!=(_f=null==checkTarget?void 0:checkTarget.mtime)?_f:0;if(modifiedBase&&modifiedTarget&&isMarkedAsSameChanges(baseFile,[modifiedBase,modifiedTarget]))return EVEN;else return compareMTime(modifiedBase,modifiedTarget)}var _cached=new Map;function useMemo({key:key2,forceUpdate,validator},updateFunc){const cached=_cached.get(key2),context2=(null==cached?void 0:cached.context)||new Map;if(cached&&!forceUpdate&&(!validator||validator&&!validator(context2)))return cached.value;const value=updateFunc(context2,null==cached?void 0:cached.value);if(value!==(null==cached?void 0:cached.value))_cached.set(key2,{value,context:context2});return value}var _staticObj=new Map;function useStatic(key2,initial){const obj=_staticObj.get(key2);if(void 0!==obj)return obj;else{const obj2={_buf:initial,get value(){return this._buf},set value(value){this._buf=value}};_staticObj.set(key2,obj2);return obj2}}function disposeMemo(key2){_cached.delete(key2)}function disposeAllMemo(){_cached.clear()}function displayRev(rev3){const[number,hash2]=rev3.split("-");return`${number}-${hash2.substring(0,6)}`}function getDocProps(doc){const id=doc._id,shortenedId=id.substring(0,10),prefixedPath=getPath2(doc),path2=stripAllPrefixes(prefixedPath),rev3=doc._rev,revDisplay=rev3?displayRev(rev3):"0-NOREVS",shortenedPath=path2.substring(0,10);return{id,rev:rev3,revDisplay,prefixedPath,path:path2,isDeleted:doc._deleted||doc.deleted||false,shortenedId,shortenedPath}}function getLogLevel(showNotice){return showNotice?LOG_LEVEL_NOTICE:LOG_LEVEL_INFO}async function autosaveCache(db,mapKey){var _a5;const savedData=null!=(_a5=await db.get(mapKey))?_a5:new Map,_commit=()=>{try{scheduleTask("commit-map-save-"+mapKey,250,(async()=>{await db.set(mapKey,savedData)}))}catch(e4){}};return{set(key2,value){const modified=savedData.get(key2)!==value,result=savedData.set(key2,value);if(modified)_commit();return result},clear(){savedData.clear();_commit()},delete(key2){const result=savedData.delete(key2);if(result)_commit();return result},get:key2=>savedData.get(key2),has:key2=>savedData.has(key2),keys:()=>savedData.keys(),get size(){return savedData.size}}}function onlyInNTimes(n3,proc){let counter=0;return function(){if(counter++%n3==0)proc(counter)}}function isOverridableKey(key2){return key2.startsWith("$")}function isInjectableKey(key2){return key2.startsWith("$$")}function isAllExecuteKey(key2){return key2.startsWith("$all")}function isEveryExecuteKey(key2){return key2.startsWith("$every")}function isAnyExecuteKey(key2){return key2.startsWith("$any")}function injectModules(target,modules){const allKeys=unique([...Object.keys(Object.getOwnPropertyDescriptors(target)),...Object.keys(Object.getOwnPropertyDescriptors(Object.getPrototypeOf(target)))]).filter((e4=>e4.startsWith("$"))),moduleMap=new Map;for(const module2 of modules)for(const key2 of allKeys)if(isOverridableKey(key2))if(key2 in module2){const list=moduleMap.get(key2)||[];if("function"==typeof module2[key2])module2[key2]=module2[key2].bind(module2);list.push(module2);moduleMap.set(key2,list)}Logger(`Injecting modules for ${target.constructor.name}`,LOG_LEVEL_VERBOSE);for(const key2 of allKeys){const modules2=moduleMap.get(key2)||[];if(isInjectableKey(key2)){if(0==modules2.length)throw new Error(`No module injected for ${key2}. This is a fatal error.`);target[key2]=modules2[0][key2];Logger(`[${modules2[0].constructor.name}]: Injected ${key2} `,LOG_LEVEL_VERBOSE)}else if(isAllExecuteKey(key2)){const modules3=moduleMap.get(key2)||[];target[key2]=async(...args)=>{for(const module2 of modules3)try{await module2[key2](...args)}catch(ex){Logger(`[${module2.constructor.name}]: All handler for ${key2} failed`,LOG_LEVEL_VERBOSE);Logger(ex,LOG_LEVEL_VERBOSE)}return true};for(const module2 of modules3)Logger(`[${module2.constructor.name}]: Injected (All) ${key2} `,LOG_LEVEL_VERBOSE)}else if(isEveryExecuteKey(key2)){target[key2]=async(...args)=>{for(const module2 of modules2)try{const ret=await module2[key2](...args);if(void 0!==ret&&!ret)return ret}catch(ex){Logger(`[${module2.constructor.name}]: Every handler for ${key2} failed`);Logger(ex,LOG_LEVEL_VERBOSE)}return true};for(const module2 of modules2)Logger(`[${module2.constructor.name}]: Injected (Every) ${key2} `,LOG_LEVEL_VERBOSE)}else if(isAnyExecuteKey(key2)){target[key2]=async(...args)=>{for(const module2 of modules2)try{const ret=await module2[key2](...args);if(ret)return ret}catch(ex){Logger(`[${module2.constructor.name}]: Any handler for ${key2} failed`);Logger(ex,LOG_LEVEL_VERBOSE)}return false};for(const module2 of modules2)Logger(`[${module2.constructor.name}]: Injected (Any) ${key2} `,LOG_LEVEL_VERBOSE)}else Logger(`No injected handler for ${key2} `,LOG_LEVEL_VERBOSE)}Logger(`Injected modules for ${target.constructor.name}`,LOG_LEVEL_VERBOSE);return true}var AbstractModule=class{constructor(core){this.core=core;this._log=(msg,level=LOG_LEVEL_INFO,key2)=>{if("string"==typeof msg&&level!==LOG_LEVEL_NOTICE)msg=`[${this.constructor.name}]  ${msg}`;Logger(msg,level,key2)};this.saveSettings=this.core.saveSettings.bind(this.core);Logger(`[${this.constructor.name}] Loaded`,LOG_LEVEL_VERBOSE)}get localDatabase(){return this.core.localDatabase}get settings(){return this.core.settings}set settings(value){this.core.settings=value}addTestResult(key2,value,summary,message){this.core.$$addTestResult(`${this.constructor.name}`,key2,value,summary,message)}testDone(result=true){return Promise.resolve(result)}testFail(message){this._log(message,LOG_LEVEL_NOTICE);return this.testDone(false)}async _test(key2,process2){this._log(`Testing ${key2}`,LOG_LEVEL_VERBOSE);try{const ret=await process2();if(true!==ret){this.addTestResult(key2,false,ret.toString());return this.testFail(`${key2} failed: ${ret}`)}this.addTestResult(key2,true,"")}catch(ex){this.addTestResult(key2,false,"Failed by Exception",ex.toString());return this.testFail(`${key2} failed: ${ex}`)}return this.testDone()}},AbstractObsidianModule=class extends AbstractModule{constructor(plugin3,core){super(core);this.plugin=plugin3;this.core=core;this.addCommand=this.plugin.addCommand.bind(this.plugin);this.registerView=this.plugin.registerView.bind(this.plugin);this.addRibbonIcon=this.plugin.addRibbonIcon.bind(this.plugin);this.registerObsidianProtocolHandler=this.plugin.registerObsidianProtocolHandler.bind(this.plugin);this.saveSettings=this.plugin.saveSettings.bind(this.plugin)}get localDatabase(){return this.plugin.localDatabase}get settings(){return this.plugin.settings}set settings(value){this.plugin.settings=value}get app(){return this.plugin.app}_isMainReady(){return this.core.$$isReady()}_isMainSuspended(){return this.core.$$isSuspended()}_isDatabaseReady(){return this.core.$$isDatabaseReady()}_isThisModuleEnabled(){return true}};function noop2(){}var src_url_equal_anchor,identity=x2=>x2;function assign(tar,src){for(const k2 in src)tar[k2]=src[k2];return tar}function is_promise(value){return!!value&&("object"==typeof value||"function"==typeof value)&&"function"==typeof value.then}function add_location(element2,file,line,column,char){element2.__svelte_meta={loc:{file,line,column,char}}}function run(fn){return fn()}function blank_object(){return Object.create(null)}function run_all(fns){fns.forEach(run)}function is_function(thing){return"function"==typeof thing}function safe_not_equal(a2,b3){return a2!=a2?b3==b3:a2!==b3||a2&&"object"==typeof a2||"function"==typeof a2}function src_url_equal(element_src,url){if(element_src===url)return true;if(!src_url_equal_anchor)src_url_equal_anchor=document.createElement("a");src_url_equal_anchor.href=url;return element_src===src_url_equal_anchor.href}function split_srcset(srcset){return srcset.split(",").map((src=>src.trim().split(" ").filter(Boolean)))}function srcset_url_equal(element_srcset,srcset){const element_urls=split_srcset(element_srcset.srcset),urls=split_srcset(srcset||"");return urls.length===element_urls.length&&urls.every((([url,width],i2)=>width===element_urls[i2][1]&&(src_url_equal(element_urls[i2][0],url)||src_url_equal(url,element_urls[i2][0]))))}function not_equal(a2,b3){return a2!=a2?b3==b3:a2!==b3}function is_empty(obj){return 0===Object.keys(obj).length}function validate_store(store,name){if(null!=store&&"function"!=typeof store.subscribe)throw new Error(`'${name}' is not a store with a 'subscribe' method`)}function subscribe(store,...callbacks){if(null==store){for(const callback of callbacks)callback(void 0);return noop2}const unsub=store.subscribe(...callbacks);return unsub.unsubscribe?()=>unsub.unsubscribe():unsub}function get_store_value(store){let value;subscribe(store,(_=>value=_))();return value}function component_subscribe(component,store,callback){component.$$.on_destroy.push(subscribe(store,callback))}function create_slot(definition,ctx,$$scope,fn){if(definition){const slot_ctx=get_slot_context(definition,ctx,$$scope,fn);return definition[0](slot_ctx)}}function get_slot_context(definition,ctx,$$scope,fn){return definition[1]&&fn?assign($$scope.ctx.slice(),definition[1](fn(ctx))):$$scope.ctx}function get_slot_changes(definition,$$scope,dirty,fn){if(definition[2]&&fn){const lets=definition[2](fn(dirty));if(void 0===$$scope.dirty)return lets;if("object"==typeof lets){const merged=[],len=Math.max($$scope.dirty.length,lets.length);for(let i2=0;i232){const dirty=[],length=$$scope.ctx.length/32;for(let i2=0;i2Object.prototype.hasOwnProperty.call(obj,prop);function action_destroyer(action_result){return action_result&&is_function(action_result.destroy)?action_result.destroy:noop2}function split_css_unit(value){const split="string"==typeof value&&value.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return split?[parseFloat(split[1]),split[2]||"px"]:[value,"px"]}var contenteditable_truthy_values=["",true,1,"true","contenteditable"],is_client="undefined"!=typeof window,now=is_client?()=>window.performance.now():()=>Date.now(),raf=is_client?cb2=>requestAnimationFrame(cb2):noop2;function set_now(fn){now=fn}function set_raf(fn){raf=fn}var tasks3=new Set;function run_tasks(now2){tasks3.forEach((task=>{if(!task.c(now2)){tasks3.delete(task);task.f()}}));if(0!==tasks3.size)raf(run_tasks)}function clear_loops(){tasks3.clear()}function loop(callback){let task;if(0===tasks3.size)raf(run_tasks);return{promise:new Promise((fulfill=>{tasks3.add(task={c:callback,f:fulfill})})),abort(){tasks3.delete(task)}}}var globals="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:window,ResizeObserverSingleton=class _ResizeObserverSingleton{constructor(options){__publicField(this,"_listeners","WeakMap"in globals?new WeakMap:void 0);__publicField(this,"_observer");__publicField(this,"options");this.options=options}observe(element2,listener){this._listeners.set(element2,listener);this._getObserver().observe(element2,this.options);return()=>{this._listeners.delete(element2);this._observer.unobserve(element2)}}_getObserver(){var _a5;return null!=(_a5=this._observer)?_a5:this._observer=new ResizeObserver((entries=>{var _a6;for(const entry of entries){_ResizeObserverSingleton.entries.set(entry.target,entry);null==(_a6=this._listeners.get(entry.target))||_a6(entry)}}))}};ResizeObserverSingleton.entries="WeakMap"in globals?new WeakMap:void 0;var is_hydrating=false;function start_hydrating(){is_hydrating=true}function end_hydrating(){is_hydrating=false}function upper_bound(low,high,key2,value){for(;low>1);if(key2(mid)<=value)low=mid+1;else high=mid}return low}function init_hydrate(target){if(target.hydrate_init)return;target.hydrate_init=true;let children2=target.childNodes;if("HEAD"===target.nodeName){const my_children=[];for(let i2=0;i20&&children2[m2[longest]].claim_order<=current?longest+1:upper_bound(1,longest,(idx2=>children2[m2[idx2]].claim_order),current))-1;p2[i2]=m2[seq_len]+1;const new_len=seq_len+1;m2[new_len]=i2;longest=Math.max(new_len,longest)}const lis=[],to_move=[];let last=children2.length-1;for(let cur=m2[longest]+1;0!=cur;cur=p2[cur-1]){lis.push(children2[cur-1]);for(;last>=cur;last--)to_move.push(children2[last]);last--}for(;last>=0;last--)to_move.push(children2[last]);lis.reverse();to_move.sort(((a2,b3)=>a2.claim_order-b3.claim_order));for(let i2=0,j2=0;i2=lis[j2].claim_order;)j2++;const anchor=j2node.removeEventListener(event,handler,options)}function prevent_default(fn){return function(event){event.preventDefault();return fn.call(this,event)}}function stop_propagation(fn){return function(event){event.stopPropagation();return fn.call(this,event)}}function stop_immediate_propagation(fn){return function(event){event.stopImmediatePropagation();return fn.call(this,event)}}function self2(fn){return function(event){if(event.target===this)fn.call(this,event)}}function trusted(fn){return function(event){if(event.isTrusted)fn.call(this,event)}}function attr(node,attribute,value){if(null==value)node.removeAttribute(attribute);else if(node.getAttribute(attribute)!==value)node.setAttribute(attribute,value)}var crossorigin,always_set_through_set_attribute=["width","height"];function set_attributes(node,attributes){const descriptors=Object.getOwnPropertyDescriptors(node.__proto__);for(const key2 in attributes)if(null==attributes[key2])node.removeAttribute(key2);else if("style"===key2)node.style.cssText=attributes[key2];else if("__value"===key2)node.value=node[key2]=attributes[key2];else if(descriptors[key2]&&descriptors[key2].set&&-1===always_set_through_set_attribute.indexOf(key2))node[key2]=attributes[key2];else attr(node,key2,attributes[key2])}function set_svg_attributes(node,attributes){for(const key2 in attributes)attr(node,key2,attributes[key2])}function set_custom_element_data_map(node,data_map){Object.keys(data_map).forEach((key2=>{set_custom_element_data(node,key2,data_map[key2])}))}function set_custom_element_data(node,prop,value){const lower=prop.toLowerCase();if(lower in node)node[lower]="boolean"==typeof node[lower]&&""===value?true:value;else if(prop in node)node[prop]="boolean"==typeof node[prop]&&""===value?true:value;else attr(node,prop,value)}function set_dynamic_element_data(tag){return/-/.test(tag)?set_custom_element_data_map:set_attributes}function xlink_attr(node,attribute,value){node.setAttributeNS("http://www.w3.org/1999/xlink",attribute,value)}function get_svelte_dataset(node){return node.dataset.svelteH}function get_binding_group_value(group,__value,checked){const value=new Set;for(let i2=0;i2group.push(input)))},r(){_inputs.forEach((input=>group.splice(group.indexOf(input),1)))}}}function init_binding_group_dynamic(group,indexes2){let _inputs,_group=get_binding_group(group);function get_binding_group(group2){for(let i2=0;i2_group.push(input)))}function remove(){_inputs.forEach((input=>_group.splice(_group.indexOf(input),1)))}return{u(new_indexes){indexes2=new_indexes;const new_group=get_binding_group(group);if(new_group!==_group){remove();_group=new_group;push()}},p(...inputs){_inputs=inputs;push()},r:remove}}function to_number(value){return""===value?null:+value}function time_ranges_to_array(ranges){const array=[];for(let i2=0;i2{for(let i2=nodes.claim_info.last_index;i2=0;i2--){const node=nodes[i2];if(predicate(node)){const replacement=process_node(node);if(void 0===replacement)nodes.splice(i2,1);else nodes[i2]=replacement;if(!dont_update_last_index)nodes.claim_info.last_index=i2;else if(void 0===replacement)nodes.claim_info.last_index--;return node}}return create_node()})();result_node.claim_order=nodes.claim_info.total_claimed;nodes.claim_info.total_claimed+=1;return result_node}function claim_element_base(nodes,name,attributes,create_element){return claim_node(nodes,(node=>node.nodeName===name),(node=>{const remove=[];for(let j2=0;j2node.removeAttribute(v2)))}),(()=>create_element(name)))}function claim_element(nodes,name,attributes){return claim_element_base(nodes,name,attributes,element)}function claim_svg_element(nodes,name,attributes){return claim_element_base(nodes,name,attributes,svg_element)}function claim_text(nodes,data){return claim_node(nodes,(node=>3===node.nodeType),(node=>{const data_str=""+data;if(node.data.startsWith(data_str)){if(node.data.length!==data_str.length)return node.splitText(data_str.length)}else node.data=data_str}),(()=>text(data)),true)}function claim_space(nodes){return claim_text(nodes," ")}function claim_comment(nodes,data){return claim_node(nodes,(node=>8===node.nodeType),(node=>{node.data=""+data}),(()=>comment(data)),true)}function get_comment_idx(nodes,text2,start){for(let i2=start;i2option.__value))}function is_crossorigin(){if(void 0===crossorigin){crossorigin=false;try{if("undefined"!=typeof window&&window.parent)window.parent.document}catch(error){crossorigin=true}}return crossorigin}function add_iframe_resize_listener(node,fn){if("static"===getComputedStyle(node).position)node.style.position="relative";const iframe=element("iframe");iframe.setAttribute("style","display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;");iframe.setAttribute("aria-hidden","true");iframe.tabIndex=-1;const crossorigin2=is_crossorigin();let unsubscribe;if(crossorigin2){iframe.src="data:text/html,