Files
obsidian/.obsidian/plugins/obsidian-livesync/main.js

19 lines
2.1 MiB
JavaScript
Raw Normal View History

2025-08-14 13:26:22 +08:00
/*
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";function Logger(message,level,key2){_logger(message,level,key2)}function info(message,flagsOrKey,key2){(function __logger(message,baseLevel,flagsOrKey,key2){let level=baseLevel;"string"==typeof flagsOrKey?key2=flagsOrKey:void 0!==flagsOrKey&&(level|=flagsOrKey);_logger(message,level,key2)})(message,LEVEL_INFO,flagsOrKey,key2)}function isMetaEntry(entry){return"children"in entry}function statusDisplay(status){return status?"EXPERIMENTAL"==status?" (Experimental)":"ALPHA"==status?" (Alpha)":"BETA"==status?" (Beta)":` (${status})`:""}function confName(key2,alt=""){var _a8,_b4;return key2 in configurationNames?`${null==(_a8=configurationNames[key2])?void 0:_a8.name}${statusDisplay(null==(_b4=configurationNames[key2])?void 0:_b4.status)}`:`${alt||""}`}function numeric(str){return isNaN(str)?str.charCodeAt(0):parseInt(str,10)}function unescapeBraces(str){return str.replace(escSlashPattern,"\\").replace(escOpenPattern,"{").replace(escClosePattern,"}").replace(escCommaPattern,",").replace(escPeriodPattern,".")}function parseCommaParts(str){if(!str)return[""];const parts=[],m3=balanced("{","}",str);if(!m3)return str.split(",");const{pre,body,post}=m3,p4=pre.split(",");p4[p4.length-1]+="{"+body+"}";const postParts=parseCommaParts(post);if(post.length){p4[p4.length-1]+=postParts.shift();p4.push.apply(p4,postParts)}parts.push.apply(parts,p4);return parts}function expand(str){if(!str)return[];"{}"===str.slice(0,2)&&(str="\\{\\}"+str.slice(2));return expand_(function escapeBraces(str){return str.replace(slashPattern,escSlash).replace(openPattern,escOpen).replace(closePattern,escClose).replace(commaPattern,escComma).replace(periodPattern,escPeriod)}(str),!0).map(unescapeBraces)}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 expand_(str,isTop){const expansions=[],m3=balanced("{","}",str);if(!m3)return[str];const pre=m3.pre,post=m3.post.length?expand_(m3.post,!1):[""];if(/\$$/.test(m3.pre))for(let k2=0;k2<post.length;k2++){const expansion=pre+"{"+m3.body+"}"+post[k2];expansions.push(expansion)}else{const isNumericSequence=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m3.body),isAlphaSequence=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m3.body),isSequence=isNumericSequence||isAlphaSequence,isOptions=m3.body.indexOf(",")>=0;if(!isSequence&&!isOptions)return m3.post.match(/,(?!,).*\}/)?expand_(str=m3.pre+"{"+m3.body+escClose+m3.post):[str];let n3,N2;if(isSequence)n3=m3.body.split(/\.\./);else{n3=parseCommaParts(m3.body);if(1===n3.length&&void 0!==n3[0]){n3=expand_(n3[0],!1).map(embrace);if(1===n3.length)return post.map((p4=>m3.pre+n3[0]+p4))}}if(isSequence&&void 0!==n3[0]&&void 0!==n3[1]){const x2=numeric(n3[0]),y2=numeric(n3[1]),width=Math.max(n3[0].length,n3[1].length);let incr=3===n3.length&&void 0!==n3[2]?Math.abs(numeric(n3[2])):1,test=lte;if(y2<x2){incr*=-1;test=gte}const pad2=n3.some(isPadded);N2=[];for(let i2=x2;test(i2,y2);i2+=incr){let c3;if(isAlphaSequence){c3=String.fromCharCode(i2);"\\"===c3&&(c3="")}else{c3=String(i2);if(pad2){const need=width-c3.length;if(need>0){const z2=new Array(need+1).join("0");c3=i2<0?"-"+z2+c3.slice(1):z2+c3}}}N2.push(c3)}}else{N2=[];for(let j2=0;j2<n3.length;j2++)N2.push.apply(N2,expand_(n3[j2],!1))}for(let j2=0;j2<N2.length;j2++)for(let k2=0;k2<post.length;k2++){const expansion=pre+N2[j2]+post[k2];(!isTop||isSequence||expansion)&&expansions.push(expansion)}}return expansions}async function getWebCrypto(){if(webcrypto)return webcrypto;if(globalThis.crypto)return webcrypto=globalThis.crypto;{const module2=await import("crypto");return webcrypto=module2.webcrypto}}function base64ToArrayBuffer(base64){if("string"==typeof base64)return base64ToArrayBufferInternalBrowser(base64);const bufItems=base64.map((e3=>base64ToArrayBufferInternalBrowser(e3))),len=bufItems.reduce(((p4,c3)=>p4+c3.byteLength),0),joinedArray=new Uint8Array(len);let offset=0;bufItems.forEach((e3=>{joinedArray.set(new Uint8Array(e3),offset);offset+=e3.byteLength}));return joinedArray.buffer}function base64ToArrayBuffer
/*! Bundled license information:
@noble/secp256k1/lib/esm/index.js:
(*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) *)
octagonal-wheels/dist/encryption/hkdf.js:
(* istanbul ignore if -- @preserve *)
(* istanbul ignore next -- @preserve *)
octagonal-wheels/dist/encryption/asymmetric/common.js:
(* istanbul ignore next -- @preserve *)
*/__export(main_exports,{default:()=>ObsidianLiveSyncPlugin});module.exports=__toCommonJS(main_exports);LEVEL_INFO=LOG_LEVEL_INFO=32;LOG_LEVEL_NOTICE=64;LOG_LEVEL_VERBOSE=16;defaultLoggerEnv_minLogLevel=LOG_LEVEL_INFO;_logger=function defaultLogger2(message,level=LEVEL_INFO,key2){if(level<defaultLoggerEnv_minLogLevel)return;const newMessage=`${(new Date).toLocaleString()}\t${level}\t${"string"==typeof message?message:message instanceof Error?`${message.name}:${message.message}`:JSON.stringify(message,null,2)}`;1&level?console.debug(newMessage):4&level?console.warn(newMessage):8&level?console.error(newMessage):2&level?console.info(newMessage):console.log(newMessage);message instanceof Error&&console.dir(message.stack)};RESULT_TIMED_OUT=Symbol("timed out");Symbol("NotFound");CANCELLED=Symbol("cancelled");AUTO_MERGED=Symbol("auto_merged");NOT_CONFLICTED=Symbol("not_conflicted");MISSING_OR_ERROR=Symbol("missing_or_error");LEAVE_TO_SUBSEQUENT=Symbol("leave_to_subsequent_proc");Symbol("infinity");MILESTONE_DOCID="_local/obsydian_livesync_milestone";MODE_SELECTIVE=0;MODE_AUTOMATIC=1;MODE_PAUSED=2;MODE_SHINY=3;REMOTE_COUCHDB="";REMOTE_MINIO="MINIO";REMOTE_P2P="ONLY_P2P";AutoAccepting=(AutoAccepting2=>{AutoAccepting2[AutoAccepting2.NONE=0]="NONE";AutoAccepting2[AutoAccepting2.ALL=1]="ALL";return AutoAccepting2})(AutoAccepting||{});P2P_DEFAULT_SETTINGS={P2P_Enabled:!1,P2P_AutoAccepting:0,P2P_AppID:"self-hosted-livesync",P2P_roomID:"",P2P_passphrase:"",P2P_relays:"wss://exp-relay.vrtmrz.net/",P2P_AutoBroadcast:!1,P2P_AutoStart:!1,P2P_AutoSyncPeers:"",P2P_AutoWatchPeers:"",P2P_SyncOnReplication:"",P2P_RebuildFrom:"",P2P_AutoAcceptingPeers:"",P2P_AutoDenyingPeers:"",P2P_IsHeadless:!1};E2EEAlgorithmNames={"":"V1: Legacy",v2:"V2: AES-256-GCM With HKDF",forceV1:"Force-V1: Force Legacy (Not recommended)"};E2EEAlgorithms_V1="",E2EEAlgorithms_ForceV1="forceV1";ChunkAlgorithmNames={v1:"V1: Legacy",v2:"V2: Simple (Default)","v2-segmenter":"V2.5: Lexical chunks","v3-rabin-karp":"V3: Fine deduplication"};DEFAULT_SETTINGS={remoteType:REMOTE_COUCHDB,useCustomRequestHandler:!1,couchDB_URI:"",couchDB_USER:"",couchDB_PASSWORD:"",couchDB_DBNAME:"",liveSync:!1,syncOnSave:!1,syncOnStart:!1,savingDelay:200,lessInformationInLog:!1,gcDelay:300,versionUpFlash:"",minimumChunkSize:20,longLineThreshold:250,showVerboseLog:!1,suspendFileWatching:!1,trashInsteadDelete:!0,periodicReplication:!1,periodicReplicationInterval:60,syncOnFileOpen:!1,encrypt:!1,passphrase:"",usePathObfuscation:!1,doNotDeleteFolder:!1,resolveConflictsByNewerFile:!1,batchSave:!1,batchSaveMinimumDelay:5,batchSaveMaximumDelay:60,deviceAndVaultName:"",usePluginSettings:!1,showOwnPlugins:!1,showStatusOnEditor:!0,showStatusOnStatusbar:!0,showOnlyIconsOnEditor:!1,hideFileWarningNotice:!1,usePluginSync:!1,autoSweepPlugins:!1,autoSweepPluginsPeriodic:!1,notifyPluginOrSettingUpdated:!1,checkIntegrityOnSave:!1,batch_size:25,batches_limit:25,useHistory:!1,disableRequestURI:!1,skipOlderFilesOnSync:!0,checkConflictOnlyOnOpen:!1,showMergeDialogOnlyOnActive:!1,syncInternalFiles:!1,syncInternalFilesBeforeReplication:!1,syncInternalFilesIgnorePatterns:"\\/node_modules\\/, \\/\\.git\\/, \\/obsidian-livesync\\/",syncInternalFilesTargetPatterns:"",syncInternalFilesInterval:60,additionalSuffixOfDatabaseName:"",ignoreVersionCheck:!1,lastReadUpdates:0,deleteMetadataOfDeletedFiles:!1,syncIgnoreRegEx:"",syncOnlyRegEx:"",customChunkSize:0,readChunksOnline:!0,watchInternalFileChanges:!0,automaticallyDeleteMetadataOfDeletedFiles:0,disableMarkdownAutoMerge:!1,writeDocumentsIfConflicted:!1,useDynamicIterationCount:!1,syncAfterMerge:!1,configPassphraseStore:"",encryptedPassphrase:"",encryptedCouchDBConnection:"",permitEmptyPassphrase:!1,useIndexedDBAdapter:!0,useTimeouts:!1,writeLogToTheFile:!1,doNotPaceReplication:!1,hashCacheMaxCount:300,hashCacheMaxAmount:50,concurrencyOfReadChunksOnline:40,minimumIntervalOfReadChunksOnline:50,hashAlg:"xxhash64",suspendParseReplicationResult:!1,doNotSuspendOnFetching:!1,useIgnoreFiles:!1,ignoreFiles:".gitignore",syncOnEditorSave:!1,pluginSyncExtendedSetting:{},syncMaxSizeInMB:50,se
/* nosourcemap */