31 lines
234 KiB
JavaScript
31 lines
234 KiB
JavaScript
/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
if you want to view the source, please visit the github repository of this plugin
|
|
*/
|
|
|
|
var oi=Object.create;var pe=Object.defineProperty;var ri=Object.getOwnPropertyDescriptor;var ai=Object.getOwnPropertyNames;var ci=Object.getPrototypeOf,li=Object.prototype.hasOwnProperty;var di=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},hi=(r,e)=>{for(var t in e)pe(r,t,{get:e[t],enumerable:!0})},Gt=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ai(e))!li.call(r,i)&&i!==t&&pe(r,i,{get:()=>e[i],enumerable:!(n=ri(e,i))||n.enumerable});return r};var ui=(r,e,t)=>(t=r!=null?oi(ci(r)):{},Gt(e||!r||!r.__esModule?pe(t,"default",{value:r,enumerable:!0}):t,r)),pi=r=>Gt(pe({},"__esModule",{value:!0}),r);var On=di((Ba,Oe)=>{function Dn(r){return Array.isArray(r)?r:[r]}var os=void 0,Ft="",Mn=" ",Tt="\\",rs=/^\s+$/,as=/(?:[^\\]|^)\\$/,cs=/^\\!/,ls=/^\\#/,ds=/\r?\n/g,hs=/^\.{0,2}\/|^\.{1,2}$/,us=/\/$/,ee="/",In="node-ignore";typeof Symbol!="undefined"&&(In=Symbol.for("node-ignore"));var Ln=In,te=(r,e,t)=>(Object.defineProperty(r,e,{value:t}),t),ps=/([0-z])-([0-z])/g,Bn=()=>!1,fs=r=>r.replace(ps,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:Ft),gs=r=>r.startsWith("!")||r.startsWith("\\^")?`^${r.slice(r[0]==="!"?1:2)}`:r,ms=r=>{let{length:e}=r;return r.slice(0,e-e%2)},ys=[[/^\uFEFF/,()=>Ft],[/((?:\\\\)*?)(\\?\s+)$/,(r,e,t)=>e+(t.indexOf("\\")===0?Mn:Ft)],[/(\\+?)\s/g,(r,e)=>{let{length:t}=e;return e.slice(0,t-t%2)+Mn}],[/[\\$.|*+(){^]/g,r=>`\\${r}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*(?:\\\*\\\*\\\/)+/,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(r,e,t)=>e+6<t.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(r,e,t)=>{let n=t.replace(/\\\*/g,"[^\\/]*");return e+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>Tt],[/\\\\/g,()=>Tt],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(r,e,t,n,i)=>e===Tt?`\\[${t}${ms(n)}${i}`:i==="]"&&n.length%2===0?`[${gs(fs(t))}${n}]`:"[]"],[/(?:[^*])$/,r=>/\/$/.test(r)?`${r}$`:`${r}(?=$|\\/$)`]],Ss=/(^|\\\/)?\\\*$/,le="regex",Ge="checkRegex",An="_",vs={[le](r,e){return`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`},[Ge](r,e){return`${e?`${e}[^/]*`:"[^/]*"}(?=$|\\/$)`}},Cs=r=>ys.reduce((e,[t,n])=>e.replace(t,n.bind(r)),r),Ne=r=>typeof r=="string",bs=r=>r&&Ne(r)&&!rs.test(r)&&!as.test(r)&&r.indexOf("#")!==0,ws=r=>r.split(ds).filter(Boolean),xt=class{constructor(e,t,n,i,s,o){this.pattern=e,this.mark=t,this.negative=s,te(this,"body",n),te(this,"ignoreCase",i),te(this,"regexPrefix",o)}get regex(){let e=An+le;return this[e]?this[e]:this._make(le,e)}get checkRegex(){let e=An+Ge;return this[e]?this[e]:this._make(Ge,e)}_make(e,t){let n=this.regexPrefix.replace(Ss,vs[e]),i=this.ignoreCase?new RegExp(n,"i"):new RegExp(n);return te(this,t,i)}},Ps=({pattern:r,mark:e},t)=>{let n=!1,i=r;i.indexOf("!")===0&&(n=!0,i=i.substr(1)),i=i.replace(cs,"!").replace(ls,"#");let s=Cs(i);return new xt(r,e,i,t,n,s)},Et=class{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[Ln]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(Ne(e)&&(e={pattern:e}),bs(e.pattern)){let t=Ps(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,Dn(Ne(e)?ws(e):e).forEach(this._add,this),this._added}test(e,t,n){let i=!1,s=!1,o;this._rules.forEach(c=>{let{negative:h}=c;s===h&&i!==s||h&&!i&&!s&&!t||!c[n].test(e)||(i=!h,s=h,o=h?os:c)});let a={ignored:i,unignored:s};return o&&(a.rule=o),a}},Rs=(r,e)=>{throw new e(r)},A=(r,e,t)=>Ne(r)?r?A.isNotRelative(r)?t(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:t("path must not be empty",TypeError):t(`path must be a string, but got \`${e}\``,TypeError),Gn=r=>hs.test(r);A.isNotRelative=Gn;A.convert=r=>r;var Mt=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){te(this,Ln,!0),this._rules=new Et(t),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,t,n,i){let s=e&&A.convert(e);return A(s,e,this._strictPathCheck?Rs:Bn),this._t(s,t,n,i)}checkIgnore(e){if(!us.test(e))return this.test(e);let t=e.split(ee).filter(Boolean);if(t.pop(),t.length){let n=this._t(t.join(ee)+ee,this._testCache,!0,t);if(n.ignored)return n}return this._rules.test(e,!1,Ge)}_t(e,t,n,i){if(e in t)return t[e];if(i||(i=e.split(ee).filter(Boolean)),i.pop(),!i.length)return t[e]=this._rules.test(e,n,le);let s=this._t(i.join(ee)+ee,t,n,i);return t[e]=s.ignored?s:this._rules.test(e,n,le)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return Dn(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},At=r=>new Mt(r),ks=r=>A(r&&A.convert(r),r,Bn),Nn=()=>{let r=t=>/^\\\\\?\\/.test(t)||/["<>|\u0000-\u001F]+/u.test(t)?t:t.replace(/\\/g,"/");A.convert=r;let e=/^[a-z]:\//i;A.isNotRelative=t=>e.test(t)||Gn(t)};typeof process!="undefined"&&process.platform==="win32"&&Nn();Oe.exports=At;At.default=At;Oe.exports.isPathValid=ks;te(Oe.exports,Symbol.for("setupWindows"),Nn)});var Qs={};hi(Qs,{default:()=>yt});module.exports=pi(Qs);var v=require("obsidian");var Nt={serviceType:"gitlab",gitlabToken:"",gitlabBaseUrl:"https://gitlab.com",projectId:"",githubToken:"",githubOwner:"",githubRepo:"",giteaToken:"",giteaBaseUrl:"",giteaOwner:"",giteaRepo:"",rootPath:"",branch:"main",syncMetadata:{},vaultFolder:"",symlinkHandling:"real",ignorePatterns:"",lastSeenVersion:"",bannerDismissedVersion:"",language:"system",autoRefreshOnStartup:!0};function F(r,e){return r!==void 0&&(r.lastKnownPath===void 0||r.lastKnownPath===e)}function x(r){return r.serviceType==="gitlab"?"GitLab":r.serviceType==="gitea"?"Gitea":"GitHub"}function k(r){return r.symlinkHandling==="real"&&r.serviceType!=="github"?"skip":r.symlinkHandling}var C=require("obsidian");var Ot=require("obsidian"),fe=class r extends Ot.AbstractInputSuggest{constructor(t,n){super(t,n);this.inputEl=n}getSuggestions(t){let n=t.toLowerCase();return this.app.vault.getAllFolders(!0).filter(i=>i.path.toLowerCase().contains(n)).sort((i,s)=>i.path.localeCompare(s.path))}renderSuggestion(t,n){n.setText(t.path==="/"?"/":t.path)}selectSuggestion(t){let n=t.path==="/"?"":t.path;this.setValue(n),this.inputEl.dispatchEvent(new Event("input")),this.close()}static attach(t,n){new r(t,n)}};var $t=require("obsidian"),ge=class r extends $t.AbstractInputSuggest{constructor(t,n,i){super(t,n);this.inputEl=n;this.plugin=i;this.cachedFolders=null}async loadFolders(){if(this.cachedFolders)return this.cachedFolders;let t=await this.plugin.gitService.listFiles(this.plugin.settings.branch,!1),n=new Set;for(let i of t){let s=i.split("/");s.pop();let o="";for(let a of s)o=o?`${o}/${a}`:a,n.add(o)}return this.cachedFolders=Array.from(n).sort((i,s)=>i.localeCompare(s)),this.cachedFolders}async getSuggestions(t){let n=t.toLowerCase(),i;try{i=await this.loadFolders()}catch(s){return[]}return i.filter(s=>s.toLowerCase().contains(n))}renderSuggestion(t,n){n.setText(t)}selectSuggestion(t){this.setValue(t),this.inputEl.dispatchEvent(new Event("input")),this.close()}static attach(t,n,i){new r(t,n,i)}};var E=require("obsidian");function se(r,e){let t=r.split("."),n=e.split("."),i=Math.max(t.length,n.length);for(let s=0;s<i;s++){let o=Number(t[s])||0,a=Number(n[s])||0;if(o!==a)return o-a}return 0}var fi={"settings.connectionStatus.checking":"Checking\u2026","settings.connectionStatus.connected":"Connected","settings.connectionStatus.disconnected":"Not connected","settings.connectionStatus.withDetail":"{label} \u2014 {detail}","settings.language.name":"Language","settings.language.desc":"UI language for this plugin","settings.language.option.system":"System default","settings.language.option.en":"English","settings.language.option.zhTw":"\u7E41\u9AD4\u4E2D\u6587 (Traditional Chinese)","settings.language.option.zhCn":"\u7B80\u4F53\u4E2D\u6587 (Simplified Chinese)","settings.gitService.name":"Git service","settings.gitService.desc":"Choose your Git hosting service","settings.branch.name":"Branch","settings.branch.desc":"Branch to push or pull from","settings.branch.placeholder":"Main","settings.rootPath.name":"Root path","settings.rootPath.desc":'Optional: subfolder in repository (e.g. "notes")',"settings.rootPath.placeholder":"Enter subfolder path","settings.vaultFolder.name":"Vault folder","settings.vaultFolder.desc":'Optional: only sync files in this vault folder (e.g. "sync" to only sync files in the sync folder)',"settings.vaultFolder.placeholder":"Leave empty to sync all files","settings.autoRefreshOnStartup.name":"Refresh status on startup","settings.autoRefreshOnStartup.desc":"Automatically refresh the Sync Status View when Obsidian finishes loading","settings.ignorePatterns.name":"Ignore patterns","settings.ignorePatterns.desc":"Optional: .gitignore-style patterns (one per line) to exclude local files from sync, in addition to the repository's own .gitignore.","settings.symlinks.name":"Symbolic links","settings.symlinks.desc.supported":'How to sync symlinks: "real" recreates the link on desktop and falls back to the target content on mobile, "follow" always syncs the target content, and "skip" ignores symlinks.',"settings.symlinks.desc.unsupported":'How to sync symlinks: "follow" syncs the target content as a normal file, "skip" ignores symlinks. Real symlinks require GitHub.',"settings.symlinks.option.real":"Real symlink (recommended)","settings.symlinks.option.follow":"Follow (sync target content)","settings.symlinks.option.skip":"Skip","settings.testConnection.name":"Test connection","settings.testConnection.desc":"Verify your {service} settings","settings.testConnection.button":"Test connection","settings.testConnection.failed":"Connection failed: {reason}","settings.testConnection.failed.unreachable":"could not reach the repository","settings.testConnection.branchNotFound.badge":'branch "{branch}" not found',"settings.testConnection.branchNotFound.notice":'Connected, but branch "{branch}" was not found. Check the Branch setting, or confirm the repository has a branch with this name.',"settings.testConnection.success":"{service} connection successful!","settings.token.placeholder":"Enter your token","settings.token.show":"Show token","settings.token.hide":"Hide token","settings.gitlab.token.name":"GitLab personal access token","settings.gitlab.token.desc":'Create a token in GitLab user settings > access tokens with "API" scope',"settings.gitlab.baseUrl.name":"GitLab base URL","settings.gitlab.baseUrl.desc":"Defaults to https://gitlab.com","settings.gitlab.projectId.name":"Project ID","settings.gitlab.projectId.desc":"Found in GitLab project overview","settings.gitlab.projectId.placeholder":"Enter numeric project ID","settings.gitea.token.name":"Gitea personal access token","settings.gitea.token.desc":"Create a token in user settings > applications > access tokens","settings.gitea.baseUrl.name":"Gitea base URL","settings.gitea.baseUrl.desc":"URL of your Gitea instance (e.g. https://gitea.example.com)","settings.github.token.name":"GitHub personal access token","settings.github.token.desc":'Create a token in GitHub settings > developer settings > personal access tokens with "repo" scope',"settings.repoOwner.name":"Repository owner","settings.repoOwner.desc.gitea":"Gitea username or organization name","settings.repoOwner.desc.github":"GitHub username or organization name","settings.repoOwner.placeholder":"Username","settings.repoName.name":"Repository name","settings.repoName.desc.gitea":"Name of the repository","settings.repoName.desc.github":"Name of the GitHub repository","settings.repoName.placeholder":"My notes","main.ribbon.openSyncStatus":"Open source control","main.ribbon.push":"Push","main.ribbon.pushTo":"Push to {service}","main.command.openSyncStatus":"Open source control","main.command.pushCurrentFile":"Push current file","main.command.pullCurrentFile":"Pull current file","main.command.pushAllFiles":"Push all files","main.command.pullAllFiles":"Pull all files","main.notice.noActiveNote":"No active note to push","main.contextMenu.pushTo":"Push to {service}","main.contextMenu.pullFrom":"Pull from {service}","main.notice.noFilesToRun":"No files to {op} in the configured vault folder","main.confirm.pushAll":"Push {count} file(s) to {service}?","main.confirm.pullAll":"Pull {count} file(s) from {service}? This will overwrite local changes.","main.progress.running":"{verb} 0/{total} files...","main.progress.step":"{verb} {current}/{total}: {fileName}","main.notice.runFailed":"{verb} failed: {message}","main.op.push":"push","main.op.pull":"pull","main.verb.pushing":"Pushing","main.verb.pulling":"Pulling","main.verb.push":"Push","main.verb.pull":"Pull","confirmModal.title":"Confirm","confirmModal.confirm":"Confirm","confirmModal.cancel":"Cancel","whatsNew.title":"What's new","whatsNew.viewOnGitHub":"View on GitHub","whatsNew.viewChangelog":"View full changelog","whatsNew.gotIt":"Got it","whatsNew.openSourceControl":"Open Source Control","whatsNew.close":"Close","whatsNew.stepLabel":"Step {number}","settings.whatsNewBanner.title":"What's new in v{version}","settings.whatsNewBanner.dismiss":"Dismiss","settings.whatsNewBanner.view":"See what's new","settings.releaseHistory.name":"Release history","settings.releaseHistory.desc":"Review what's new in current and previous versions","settings.releaseHistory.button":"View release history","diffView.title":"Diff","diffView.titleWithFile":"Diff: {path}","diffView.empty":"Select a changed file in the sync panel to see its diff.","diffPanel.remote":"Remote","diffPanel.local":"Local","syncConflictModal.title":"Conflict in {fileName}","syncConflictModal.description":"The remote file has different content. Review the differences and choose which version to keep.","syncConflictModal.differences":"Differences","syncConflictModal.keepLocal":"Keep local","syncConflictModal.keepLocal.tooltip":"Overwrite remote with your local content","syncConflictModal.keepRemote":"Keep remote","syncConflictModal.keepRemote.tooltip":"Overwrite local with remote content","syncConflictModal.cancel":"Cancel","syncConflictModal.binaryChanged":"Both the local and remote versions of this binary file have changed. A line-by-line diff isn't available.","syncPlanModal.title.push":"Review push plan","syncPlanModal.title.pull":"Review pull plan","syncPlanModal.title.delete":"Review deletion","syncPlanModal.title.sync":"Review sync plan","syncPlanModal.section.additions":"Additions","syncPlanModal.section.modifications":"Modifications","syncPlanModal.section.moves":"Moves","syncPlanModal.section.downloads":"Downloads","syncPlanModal.section.acceptedRemote":"Accept remote locally","syncPlanModal.section.skippedConflicts":"Skipped conflicts","syncPlanModal.section.deletions":"Deletions","syncPlanModal.deletionWarning":"This permanently deletes {count} file(s) on the remote. This cannot be undone.","syncPlanModal.movedFrom":"moved from {path}","syncPlanModal.confirm":"Apply","syncPlanModal.cancel":"Cancel","batchConflictModal.title":"Resolve {count|conflict|conflicts}","batchConflictModal.description":"other {safeCount|file|files}: ready to sync, pushed with this batch.","batchConflictModal.keepLocalAll":"Keep Local for All","batchConflictModal.keepRemoteAll":"Keep Remote for All","batchConflictModal.skipAll":"Skip All","batchConflictModal.row.binary":"Binary","batchConflictModal.row.viewDiff":"View Diff","batchConflictModal.row.keepLocal":"Keep Local","batchConflictModal.row.keepRemote":"Keep Remote","batchConflictModal.row.skip":"Skip","batchConflictModal.continue":"Continue","batchConflictModal.cancel":"Cancel","batchConflictModal.unresolvedWarning":"Choose a resolution for every conflict before continuing.","sourceControl.viewTitle":"Source control","sourceControl.filter.all":"All","sourceControl.filter.needsSync":"Needs Sync","sourceControl.filter.changes":"Changes","sourceControl.filter.local":"Local","sourceControl.filter.remote":"Incoming","sourceControl.filter.readyToPush":"Ready to Push","sourceControl.filter.remoteChanges":"Incoming","sourceControl.filter.conflicts":"Conflicts","sourceControl.filter.synced":"Synced","sourceControl.filter.showSynced":"Show synced","sourceControl.section.selectedForSync":"Sync Queue","sourceControl.section.queueSubtitle":"{count} files selected","sourceControl.section.repositoryChanges":"Repository Changes","sourceControl.section.clearSelection":"Clear","sourceControl.section.clearSelection.tooltip":"Deselect all changes","sourceControl.push":" Sync ({count})","sourceControl.push.tooltip":"Push {count} ready file(s)","sourceControl.refresh.tooltip":"Refresh","sourceControl.refresh.refreshing":"Refreshing\u2026","sourceControl.refresh.failed":"Refresh failed","sourceControl.op.syncing":"Syncing","sourceControl.op.synced":"Synced","sourceControl.op.failed":"Failed","sourceControl.status.added":"Added locally","sourceControl.status.modified":"Modified locally","sourceControl.status.deletedLocally":"Deleted locally","sourceControl.status.deletedLocally.tooltip":"Tracked file removed locally \u2014 Sync deletes it from the remote by default; use Download to restore it locally instead","sourceControl.status.renamed":"Renamed","sourceControl.status.remoteAvailable":"Remote available","sourceControl.status.remoteAvailable.tooltip":"Exists on remote but not locally \u2014 download to add it","sourceControl.status.modifiedRemotely":"Modified remotely","sourceControl.status.conflict":"Conflict","sourceControl.status.synced":"Synced","sourceControl.queue.upload":"Upload","sourceControl.queue.download":"Download","sourceControl.queue.delete":"Delete","sourceControl.action.download":"Download","sourceControl.action.download.tooltip":"Download from remote","sourceControl.queue.action.push":"Push local","sourceControl.queue.action.pull":"Use remote","sourceControl.queue.action.deleteRemote":"Delete remote","sourceControl.queue.menu.viewDiff":"View diff","sourceControl.queue.menu.removeFromQueue":"Remove from Sync Queue","sourceControl.row.menu.tooltip":"More actions","sourceControl.row.menu.pushLocal":"Push local","sourceControl.row.menu.useRemote":"Use remote","sourceControl.row.menu.useRemoteEllipsis":"Use remote\u2026","sourceControl.row.menu.pushLocalEllipsis":"Push local\u2026","sourceControl.row.menu.deleteRemote":"Delete remote","sourceControl.row.menu.deleteRemoteEllipsis":"Delete remote\u2026","sourceControl.row.menu.deleteLocalEllipsis":"Delete local\u2026","sourceControl.row.menu.restoreLocal":"Restore local","sourceControl.row.menu.viewDiff":"View diff","sourceControl.row.menu.addToQueue":"Add to Sync Queue","sourceControl.row.menu.openRemote":"Open remote","sourceControl.row.confirmDeleteRemote":'Delete "{path}" from the remote? This does not affect the local copy.',"sourceControl.empty":"No changes","sourceControl.detail.back":"Back","sourceControl.mobile.filesSelected":"{count} files selected","sourceControl.mobile.sync":"Sync","sourceControl.info.lastChecked":"Last checked: {time}","sourceControl.info.justChecked":"Last checked: just now","sourceControl.search.placeholder":"Filter by path\u2026","sourceControl.search.clear":"Clear filter","sourceControl.folder.selectAll":"Select all in folder","sourceControl.diff.switchToSplit":"Switch to side-by-side diff","sourceControl.diff.switchToUnified":"Switch to single-column diff","sourceControl.diff.split":"Split","sourceControl.diff.unified":"Unified","sourceControl.view.toggleLabel":"View","sourceControl.view.tree":"Tree","sourceControl.view.list":"List","sync.notice.pushSummary":"Pushed to {service}: {added} added, {updated} updated{commitNote}.","sync.notice.pushAddedOnly":"Pushed to {service}: {added} added{commitNote}.","sync.notice.pushUpdatedOnly":"Pushed to {service}: {updated} updated{commitNote}.","sync.notice.pushCommitNote":" in one commit","sync.notice.pullSummary":"Pulled from {service}: {added} added, {updated} updated.","sync.notice.pullAddedOnly":"Pulled from {service}: {added} added.","sync.notice.pullUpdatedOnly":"Pulled from {service}: {updated} updated.","sourceControl.notice.sync.success":"Sync complete \u2014 {details}","sourceControl.notice.sync.partial":"Sync completed with issues \u2014 {details}","sourceControl.notice.sync.failed":"Sync failed \u2014 {details}","sourceControl.notice.sync.added":"{count} added","sourceControl.notice.sync.updated":"{count} updated","sourceControl.notice.sync.moved":"{count} moved","sourceControl.notice.sync.deleted":"{count} deleted","sourceControl.notice.sync.downloaded":"{count} downloaded","sourceControl.notice.sync.acceptedRemote":"Accepted remote {count}","sourceControl.notice.sync.failedCount":"{count} failed","sourceControl.notice.sync.conflicts":"{count} conflicts","sourceControl.notice.sync.skippedConflicts":"{count} skipped conflicts"},me=fi;var gi={"settings.connectionStatus.checking":"\u6AA2\u67E5\u4E2D\u2026","settings.connectionStatus.connected":"\u5DF2\u9023\u7DDA","settings.connectionStatus.disconnected":"\u672A\u9023\u7DDA","settings.connectionStatus.withDetail":"{label} \u2014 {detail}","settings.language.name":"\u8A9E\u8A00","settings.language.desc":"\u6B64\u5916\u639B\u7684\u4ECB\u9762\u8A9E\u8A00","settings.language.option.system":"\u7CFB\u7D71\u9810\u8A2D","settings.language.option.en":"English","settings.language.option.zhTw":"\u7E41\u9AD4\u4E2D\u6587","settings.language.option.zhCn":"\u7B80\u4F53\u4E2D\u6587","settings.gitService.name":"Git \u670D\u52D9","settings.gitService.desc":"\u9078\u64C7\u60A8\u7684 Git \u4EE3\u7BA1\u670D\u52D9","settings.branch.name":"\u5206\u652F","settings.branch.desc":"\u8981\u63A8\u9001\u6216\u62C9\u53D6\u7684\u5206\u652F","settings.branch.placeholder":"Main","settings.rootPath.name":"\u6839\u8DEF\u5F91","settings.rootPath.desc":"\u9078\u586B\uFF1A\u5132\u5B58\u5EAB\u4E2D\u7684\u5B50\u8CC7\u6599\u593E\uFF08\u4F8B\u5982\u300Cnotes\u300D\uFF09","settings.rootPath.placeholder":"\u8F38\u5165\u5B50\u8CC7\u6599\u593E\u8DEF\u5F91","settings.vaultFolder.name":"\u4FDD\u5B58\u5EAB\u8CC7\u6599\u593E","settings.vaultFolder.desc":"\u9078\u586B\uFF1A\u50C5\u540C\u6B65\u6B64\u4FDD\u5B58\u5EAB\u8CC7\u6599\u593E\u5167\u7684\u6A94\u6848\uFF08\u4F8B\u5982\u300Csync\u300D\u5247\u53EA\u540C\u6B65 sync \u8CC7\u6599\u593E\u5167\u7684\u6A94\u6848\uFF09","settings.vaultFolder.placeholder":"\u7559\u7A7A\u4EE5\u540C\u6B65\u6240\u6709\u6A94\u6848","settings.autoRefreshOnStartup.name":"\u555F\u52D5\u6642\u91CD\u65B0\u6574\u7406\u72C0\u614B","settings.autoRefreshOnStartup.desc":"Obsidian \u8F09\u5165\u5B8C\u6210\u5F8C\uFF0C\u81EA\u52D5\u91CD\u65B0\u6574\u7406\u540C\u6B65\u72C0\u614B\u8996\u7A97","settings.ignorePatterns.name":"\u5FFD\u7565\u898F\u5247","settings.ignorePatterns.desc":"\u9078\u586B\uFF1A\u4EE5 .gitignore \u8A9E\u6CD5\uFF08\u6BCF\u884C\u4E00\u689D\uFF09\u6392\u9664\u672C\u6A5F\u6A94\u6848\uFF0C\u6703\u8207\u9060\u7AEF\u5132\u5B58\u5EAB\u7684 .gitignore \u898F\u5247\u4E00\u4F75\u5957\u7528\u3002","settings.symlinks.name":"\u7B26\u865F\u9023\u7D50","settings.symlinks.desc.supported":"\u7B26\u865F\u9023\u7D50\u7684\u540C\u6B65\u65B9\u5F0F\uFF1A\u300Creal\u300D\u6703\u5728\u684C\u9762\u7248\u91CD\u5EFA\u9023\u7D50\uFF0C\u884C\u52D5\u88DD\u7F6E\u5247\u6539\u70BA\u540C\u6B65\u76EE\u6A19\u5167\u5BB9\uFF1B\u300Cfollow\u300D\u6C38\u9060\u540C\u6B65\u76EE\u6A19\u5167\u5BB9\uFF1B\u300Cskip\u300D\u5247\u5FFD\u7565\u7B26\u865F\u9023\u7D50\u3002","settings.symlinks.desc.unsupported":"\u7B26\u865F\u9023\u7D50\u7684\u540C\u6B65\u65B9\u5F0F\uFF1A\u300Cfollow\u300D\u4EE5\u4E00\u822C\u6A94\u6848\u540C\u6B65\u76EE\u6A19\u5167\u5BB9\uFF0C\u300Cskip\u300D\u5247\u5FFD\u7565\u7B26\u865F\u9023\u7D50\u3002\u771F\u5BE6\u7B26\u865F\u9023\u7D50\u50C5\u652F\u63F4 GitHub\u3002","settings.symlinks.option.real":"\u771F\u5BE6\u7B26\u865F\u9023\u7D50\uFF08\u5EFA\u8B70\uFF09","settings.symlinks.option.follow":"Follow\uFF08\u540C\u6B65\u76EE\u6A19\u5167\u5BB9\uFF09","settings.symlinks.option.skip":"Skip\uFF08\u5FFD\u7565\uFF09","settings.testConnection.name":"\u6E2C\u8A66\u9023\u7DDA","settings.testConnection.desc":"\u9A57\u8B49\u60A8\u7684 {service} \u8A2D\u5B9A","settings.testConnection.button":"\u6E2C\u8A66\u9023\u7DDA","settings.testConnection.failed":"\u9023\u7DDA\u5931\u6557\uFF1A{reason}","settings.testConnection.failed.unreachable":"\u7121\u6CD5\u9023\u7DDA\u81F3\u5132\u5B58\u5EAB","settings.testConnection.branchNotFound.badge":"\u627E\u4E0D\u5230\u5206\u652F\u300C{branch}\u300D","settings.testConnection.branchNotFound.notice":"\u5DF2\u9023\u7DDA\uFF0C\u4F46\u627E\u4E0D\u5230\u5206\u652F\u300C{branch}\u300D\u3002\u8ACB\u6AA2\u67E5\u5206\u652F\u8A2D\u5B9A\uFF0C\u6216\u78BA\u8A8D\u5132\u5B58\u5EAB\u4E2D\u5B58\u5728\u6B64\u5206\u652F\u3002","settings.testConnection.success":"{service} \u9023\u7DDA\u6210\u529F\uFF01","settings.token.placeholder":"\u8F38\u5165\u60A8\u7684\u6B0A\u6756","settings.token.show":"\u986F\u793A\u6B0A\u6756","settings.token.hide":"\u96B1\u85CF\u6B0A\u6756","settings.gitlab.token.name":"GitLab \u500B\u4EBA\u5B58\u53D6\u6B0A\u6756","settings.gitlab.token.desc":"\u8ACB\u5728 GitLab \u4F7F\u7528\u8005\u8A2D\u5B9A > access tokens \u5EFA\u7ACB\u5177\u6709\u300CAPI\u300D\u7BC4\u570D\u7684\u6B0A\u6756","settings.gitlab.baseUrl.name":"GitLab \u57FA\u790E URL","settings.gitlab.baseUrl.desc":"\u9810\u8A2D\u70BA https://gitlab.com","settings.gitlab.projectId.name":"\u5C08\u6848 ID","settings.gitlab.projectId.desc":"\u53EF\u5728 GitLab \u5C08\u6848\u7E3D\u89BD\u4E2D\u627E\u5230","settings.gitlab.projectId.placeholder":"\u8F38\u5165\u6578\u5B57\u5C08\u6848 ID","settings.gitea.token.name":"Gitea \u500B\u4EBA\u5B58\u53D6\u6B0A\u6756","settings.gitea.token.desc":"\u8ACB\u5728\u4F7F\u7528\u8005\u8A2D\u5B9A > applications > access tokens \u5EFA\u7ACB\u6B0A\u6756","settings.gitea.baseUrl.name":"Gitea \u57FA\u790E URL","settings.gitea.baseUrl.desc":"\u60A8\u7684 Gitea \u57F7\u884C\u500B\u9AD4\u7DB2\u5740\uFF08\u4F8B\u5982 https://gitea.example.com\uFF09","settings.github.token.name":"GitHub \u500B\u4EBA\u5B58\u53D6\u6B0A\u6756","settings.github.token.desc":"\u8ACB\u5728 GitHub \u8A2D\u5B9A > developer settings > personal access tokens \u5EFA\u7ACB\u5177\u6709\u300Crepo\u300D\u7BC4\u570D\u7684\u6B0A\u6756","settings.repoOwner.name":"\u5132\u5B58\u5EAB\u64C1\u6709\u8005","settings.repoOwner.desc.gitea":"Gitea \u4F7F\u7528\u8005\u540D\u7A31\u6216\u7D44\u7E54\u540D\u7A31","settings.repoOwner.desc.github":"GitHub \u4F7F\u7528\u8005\u540D\u7A31\u6216\u7D44\u7E54\u540D\u7A31","settings.repoOwner.placeholder":"\u4F7F\u7528\u8005\u540D\u7A31","settings.repoName.name":"\u5132\u5B58\u5EAB\u540D\u7A31","settings.repoName.desc.gitea":"\u5132\u5B58\u5EAB\u7684\u540D\u7A31","settings.repoName.desc.github":"GitHub \u5132\u5B58\u5EAB\u7684\u540D\u7A31","settings.repoName.placeholder":"\u6211\u7684\u7B46\u8A18","main.ribbon.openSyncStatus":"\u958B\u555F\u539F\u59CB\u78BC\u63A7\u5236","main.ribbon.push":"\u63A8\u9001","main.ribbon.pushTo":"\u63A8\u9001\u81F3 {service}","main.command.openSyncStatus":"\u958B\u555F\u539F\u59CB\u78BC\u63A7\u5236","main.command.pushCurrentFile":"\u63A8\u9001\u76EE\u524D\u6A94\u6848","main.command.pullCurrentFile":"\u62C9\u53D6\u76EE\u524D\u6A94\u6848","main.command.pushAllFiles":"\u63A8\u9001\u6240\u6709\u6A94\u6848","main.command.pullAllFiles":"\u62C9\u53D6\u6240\u6709\u6A94\u6848","main.notice.noActiveNote":"\u6C92\u6709\u53EF\u63A8\u9001\u7684\u76EE\u524D\u7B46\u8A18","main.contextMenu.pushTo":"\u63A8\u9001\u81F3 {service}","main.contextMenu.pullFrom":"\u5F9E {service} \u62C9\u53D6","main.notice.noFilesToRun":"\u8A2D\u5B9A\u7684\u4FDD\u5B58\u5EAB\u8CC7\u6599\u593E\u4E2D\u6C92\u6709\u53EF{op}\u7684\u6A94\u6848","main.confirm.pushAll":"\u8981\u63A8\u9001 {count} \u500B\u6A94\u6848\u81F3 {service} \u55CE\uFF1F","main.confirm.pullAll":"\u8981\u5F9E {service} \u62C9\u53D6 {count} \u500B\u6A94\u6848\u55CE\uFF1F\u9019\u5C07\u8986\u84CB\u672C\u6A5F\u8B8A\u66F4\u3002","main.progress.running":"{verb} 0/{total} \u500B\u6A94\u6848...","main.progress.step":"{verb} {current}/{total}\uFF1A{fileName}","main.notice.runFailed":"{verb}\u5931\u6557\uFF1A{message}","main.op.push":"\u63A8\u9001","main.op.pull":"\u62C9\u53D6","main.verb.pushing":"\u63A8\u9001\u4E2D","main.verb.pulling":"\u62C9\u53D6\u4E2D","main.verb.push":"\u63A8\u9001","main.verb.pull":"\u62C9\u53D6","confirmModal.title":"\u78BA\u8A8D","confirmModal.confirm":"\u78BA\u8A8D","confirmModal.cancel":"\u53D6\u6D88","whatsNew.title":"\u6709\u4EC0\u9EBC\u65B0\u529F\u80FD","whatsNew.viewOnGitHub":"\u5728 GitHub \u4E0A\u67E5\u770B","whatsNew.viewChangelog":"\u67E5\u770B\u5B8C\u6574\u66F4\u65B0\u65E5\u8A8C","whatsNew.gotIt":"\u77E5\u9053\u4E86","whatsNew.openSourceControl":"\u958B\u555F\u539F\u59CB\u78BC\u63A7\u5236","whatsNew.close":"\u95DC\u9589","whatsNew.stepLabel":"\u6B65\u9A5F {number}","settings.whatsNewBanner.title":"v{version} \u66F4\u65B0\u91CD\u9EDE","settings.whatsNewBanner.dismiss":"\u95DC\u9589\u63D0\u793A","settings.whatsNewBanner.view":"\u67E5\u770B\u66F4\u65B0\u5167\u5BB9","settings.releaseHistory.name":"\u7248\u672C\u66F4\u65B0\u7D00\u9304","settings.releaseHistory.desc":"\u67E5\u770B\u76EE\u524D\u8207\u904E\u5F80\u7248\u672C\u7684\u66F4\u65B0\u5167\u5BB9","settings.releaseHistory.button":"\u67E5\u770B\u66F4\u65B0\u7D00\u9304","diffView.title":"\u5DEE\u7570","diffView.titleWithFile":"\u5DEE\u7570\uFF1A{path}","diffView.empty":"\u5728\u540C\u6B65\u9762\u677F\u9078\u4E00\u500B\u6709\u8B8A\u66F4\u7684\u6A94\u6848\u4EE5\u6AA2\u8996\u5DEE\u7570\u3002","diffPanel.remote":"\u9060\u7AEF","diffPanel.local":"\u672C\u6A5F","syncConflictModal.title":"{fileName} \u767C\u751F\u885D\u7A81","syncConflictModal.description":"\u9060\u7AEF\u6A94\u6848\u5167\u5BB9\u6709\u6240\u4E0D\u540C\u3002\u8ACB\u6AA2\u8996\u5DEE\u7570\u4E26\u9078\u64C7\u8981\u4FDD\u7559\u7684\u7248\u672C\u3002","syncConflictModal.differences":"\u5DEE\u7570","syncConflictModal.keepLocal":"\u4FDD\u7559\u672C\u6A5F","syncConflictModal.keepLocal.tooltip":"\u4EE5\u672C\u6A5F\u5167\u5BB9\u8986\u84CB\u9060\u7AEF","syncConflictModal.keepRemote":"\u4FDD\u7559\u9060\u7AEF","syncConflictModal.keepRemote.tooltip":"\u4EE5\u9060\u7AEF\u5167\u5BB9\u8986\u84CB\u672C\u6A5F","syncConflictModal.cancel":"\u53D6\u6D88","syncConflictModal.binaryChanged":"\u6B64\u4E8C\u9032\u4F4D\u6A94\u6848\u7684\u672C\u6A5F\u8207\u9060\u7AEF\u7248\u672C\u7686\u5DF2\u8B8A\u66F4\uFF0C\u7121\u6CD5\u986F\u793A\u9010\u884C\u5DEE\u7570\u3002","syncPlanModal.title.push":"\u6AA2\u8996\u63A8\u9001\u8A08\u756B","syncPlanModal.title.pull":"\u6AA2\u8996\u62C9\u53D6\u8A08\u756B","syncPlanModal.title.delete":"\u6AA2\u8996\u522A\u9664\u8A08\u756B","syncPlanModal.title.sync":"\u6AA2\u8996\u540C\u6B65\u8A08\u756B","syncPlanModal.section.additions":"\u65B0\u589E","syncPlanModal.section.modifications":"\u4FEE\u6539","syncPlanModal.section.moves":"\u79FB\u52D5","syncPlanModal.section.downloads":"\u4E0B\u8F09","syncPlanModal.section.acceptedRemote":"\u5728\u672C\u6A5F\u63A5\u53D7\u9060\u7AEF\u7248\u672C","syncPlanModal.section.skippedConflicts":"\u5DF2\u7565\u904E\u7684\u885D\u7A81","syncPlanModal.section.deletions":"\u522A\u9664","syncPlanModal.deletionWarning":"\u6B64\u64CD\u4F5C\u5C07\u6C38\u4E45\u522A\u9664\u9060\u7AEF\u4E0A\u7684 {count} \u500B\u6A94\u6848\uFF0C\u4E14\u7121\u6CD5\u5FA9\u539F\u3002","syncPlanModal.movedFrom":"\u5F9E {path} \u79FB\u52D5\u800C\u4F86","syncPlanModal.confirm":"\u5957\u7528","syncPlanModal.cancel":"\u53D6\u6D88","batchConflictModal.title":"\u5148\u89E3\u6C7A {count} \u500B\u885D\u7A81","batchConflictModal.description":"\u53E6\u6709 {safeCount} \u500B\u6A94\u6848\u5DF2\u5C31\u7DD2\uFF0C\u5C07\u96A8\u672C\u6B21\u4E00\u4F75\u63A8\u9001\u3002","batchConflictModal.keepLocalAll":"\u5168\u90E8\u4FDD\u7559\u672C\u6A5F","batchConflictModal.keepRemoteAll":"\u5168\u90E8\u4FDD\u7559\u9060\u7AEF","batchConflictModal.skipAll":"\u5168\u90E8\u7565\u904E","batchConflictModal.row.binary":"\u4E8C\u9032\u4F4D\u6A94\u6848","batchConflictModal.row.viewDiff":"\u6AA2\u8996\u5DEE\u7570","batchConflictModal.row.keepLocal":"\u4FDD\u7559\u672C\u6A5F","batchConflictModal.row.keepRemote":"\u4FDD\u7559\u9060\u7AEF","batchConflictModal.row.skip":"\u7565\u904E","batchConflictModal.continue":"\u7E7C\u7E8C","batchConflictModal.cancel":"\u53D6\u6D88","batchConflictModal.unresolvedWarning":"\u8ACB\u5148\u70BA\u6BCF\u500B\u885D\u7A81\u9078\u64C7\u89E3\u6C7A\u65B9\u5F0F\uFF0C\u624D\u80FD\u7E7C\u7E8C\u3002","sourceControl.viewTitle":"\u539F\u59CB\u78BC\u63A7\u5236","sourceControl.filter.all":"\u5168\u90E8","sourceControl.filter.needsSync":"\u5F85\u540C\u6B65","sourceControl.filter.changes":"\u8B8A\u66F4","sourceControl.filter.local":"\u672C\u5730","sourceControl.filter.remote":"\u50B3\u5165","sourceControl.filter.readyToPush":"\u5F85\u63A8\u9001","sourceControl.filter.remoteChanges":"\u50B3\u5165","sourceControl.filter.conflicts":"\u885D\u7A81","sourceControl.filter.synced":"\u5DF2\u540C\u6B65","sourceControl.filter.showSynced":"\u986F\u793A\u5DF2\u540C\u6B65","sourceControl.section.selectedForSync":"\u540C\u6B65\u4F47\u5217","sourceControl.section.queueSubtitle":"\u5DF2\u9078 {count} \u500B\u6A94\u6848","sourceControl.section.repositoryChanges":"\u5132\u5B58\u5EAB\u8B8A\u66F4","sourceControl.section.clearSelection":"\u6E05\u9664","sourceControl.section.clearSelection.tooltip":"\u53D6\u6D88\u5168\u90E8\u9078\u53D6","sourceControl.push":" \u540C\u6B65 ({count})","sourceControl.push.tooltip":"\u63A8\u9001 {count} \u500B\u5DF2\u5C31\u7DD2\u7684\u6A94\u6848","sourceControl.refresh.tooltip":"\u91CD\u65B0\u6574\u7406","sourceControl.refresh.refreshing":"\u91CD\u65B0\u6574\u7406\u4E2D\u2026","sourceControl.refresh.failed":"\u91CD\u65B0\u6574\u7406\u5931\u6557","sourceControl.op.syncing":"\u540C\u6B65\u4E2D","sourceControl.op.synced":"\u5DF2\u540C\u6B65","sourceControl.op.failed":"\u5931\u6557","sourceControl.status.added":"\u672C\u5730\u65B0\u589E","sourceControl.status.modified":"\u672C\u5730\u4FEE\u6539","sourceControl.status.deletedLocally":"\u672C\u5730\u5DF2\u522A\u9664","sourceControl.status.deletedLocally.tooltip":"\u5DF2\u8FFD\u8E64\u6A94\u6848\u5728\u672C\u5730\u88AB\u522A\u9664 \u2014 \u540C\u6B65\u9810\u8A2D\u6703\u522A\u9664\u9060\u7AEF\u526F\u672C\uFF1B\u5982\u9700\u9084\u539F\uFF0C\u8ACB\u6539\u7528\u300C\u4E0B\u8F09\u300D","sourceControl.status.renamed":"\u5DF2\u91CD\u65B0\u547D\u540D","sourceControl.status.remoteAvailable":"\u9060\u7AEF\u53EF\u7528","sourceControl.status.remoteAvailable.tooltip":"\u9060\u7AEF\u5B58\u5728\u4F46\u672C\u5730\u7F3A\u5931 \u2014 \u4E0B\u8F09\u4EE5\u65B0\u589E","sourceControl.status.modifiedRemotely":"\u9060\u7AEF\u5DF2\u4FEE\u6539","sourceControl.status.conflict":"\u885D\u7A81","sourceControl.status.synced":"\u5DF2\u540C\u6B65","sourceControl.queue.upload":"\u4E0A\u50B3","sourceControl.queue.download":"\u4E0B\u8F09","sourceControl.queue.delete":"\u522A\u9664","sourceControl.action.download":"\u4E0B\u8F09","sourceControl.action.download.tooltip":"\u5F9E\u9060\u7AEF\u4E0B\u8F09","sourceControl.queue.action.push":"\u63A8\u9001\u672C\u6A5F","sourceControl.queue.action.pull":"\u4F7F\u7528\u9060\u7AEF","sourceControl.queue.action.deleteRemote":"\u522A\u9664\u9060\u7AEF","sourceControl.queue.menu.viewDiff":"\u6AA2\u8996\u5DEE\u7570","sourceControl.queue.menu.removeFromQueue":"\u5F9E\u540C\u6B65\u4F47\u5217\u79FB\u9664","sourceControl.row.menu.tooltip":"\u66F4\u591A\u64CD\u4F5C","sourceControl.row.menu.pushLocal":"\u63A8\u9001\u672C\u6A5F","sourceControl.row.menu.useRemote":"\u4F7F\u7528\u9060\u7AEF","sourceControl.row.menu.useRemoteEllipsis":"\u4F7F\u7528\u9060\u7AEF\u2026","sourceControl.row.menu.pushLocalEllipsis":"\u63A8\u9001\u672C\u6A5F\u2026","sourceControl.row.menu.deleteRemote":"\u522A\u9664\u9060\u7AEF","sourceControl.row.menu.deleteRemoteEllipsis":"\u522A\u9664\u9060\u7AEF\u2026","sourceControl.row.menu.deleteLocalEllipsis":"\u522A\u9664\u672C\u6A5F\u2026","sourceControl.row.menu.restoreLocal":"\u9084\u539F\u672C\u6A5F","sourceControl.row.menu.viewDiff":"\u6AA2\u8996\u5DEE\u7570","sourceControl.row.menu.addToQueue":"\u52A0\u5165\u540C\u6B65\u4F47\u5217","sourceControl.row.menu.openRemote":"\u958B\u555F\u9060\u7AEF","sourceControl.row.confirmDeleteRemote":"\u8981\u5F9E\u9060\u7AEF\u522A\u9664\u300C{path}\u300D\u55CE?\u9019\u4E0D\u6703\u5F71\u97FF\u672C\u6A5F\u526F\u672C\u3002","sourceControl.empty":"\u6C92\u6709\u8B8A\u66F4","sourceControl.detail.back":"\u8FD4\u56DE","sourceControl.mobile.filesSelected":"\u5DF2\u9078 {count} \u500B\u6A94\u6848","sourceControl.mobile.sync":"\u540C\u6B65","sourceControl.info.lastChecked":"\u4E0A\u6B21\u6AA2\u67E5\uFF1A{time}","sourceControl.info.justChecked":"\u4E0A\u6B21\u6AA2\u67E5\uFF1A\u525B\u525B","sourceControl.search.placeholder":"\u4EE5\u8DEF\u5F91\u904E\u6FFE\u2026","sourceControl.search.clear":"\u6E05\u9664\u904E\u6FFE","sourceControl.folder.selectAll":"\u9078\u53D6\u8CC7\u6599\u593E\u5167\u5168\u90E8\u9805\u76EE","sourceControl.diff.switchToSplit":"\u5207\u63DB\u70BA\u5169\u6B04\u5F0F\u5DEE\u7570\u986F\u793A","sourceControl.diff.switchToUnified":"\u5207\u63DB\u70BA\u55AE\u6B04\u5F0F\u5DEE\u7570\u986F\u793A","sourceControl.diff.split":"\u5169\u6B04","sourceControl.diff.unified":"\u55AE\u6B04","sourceControl.view.toggleLabel":"\u6AA2\u8996","sourceControl.view.tree":"\u6A39\u72C0","sourceControl.view.list":"\u5217\u8868","sync.notice.pushSummary":"\u5DF2\u63A8\u9001\u81F3 {service}\uFF1A\u65B0\u589E {added} \u500B\u3001\u66F4\u65B0 {updated} \u500B{commitNote}\u3002","sync.notice.pushAddedOnly":"\u5DF2\u63A8\u9001\u81F3 {service}\uFF1A\u65B0\u589E {added} \u500B{commitNote}\u3002","sync.notice.pushUpdatedOnly":"\u5DF2\u63A8\u9001\u81F3 {service}\uFF1A\u66F4\u65B0 {updated} \u500B{commitNote}\u3002","sync.notice.pushCommitNote":"\uFF08\u5408\u4F75\u70BA\u4E00\u6B21\u63D0\u4EA4\uFF09","sync.notice.pullSummary":"\u5DF2\u5F9E {service} \u62C9\u53D6\uFF1A\u65B0\u589E {added} \u500B\u3001\u66F4\u65B0 {updated} \u500B\u3002","sync.notice.pullAddedOnly":"\u5DF2\u5F9E {service} \u62C9\u53D6\uFF1A\u65B0\u589E {added} \u500B\u3002","sync.notice.pullUpdatedOnly":"\u5DF2\u5F9E {service} \u62C9\u53D6\uFF1A\u66F4\u65B0 {updated} \u500B\u3002","sourceControl.notice.sync.success":"\u540C\u6B65\u5B8C\u6210 \u2014 {details}","sourceControl.notice.sync.partial":"\u540C\u6B65\u5B8C\u6210\u4F46\u6709\u554F\u984C \u2014 {details}","sourceControl.notice.sync.failed":"\u540C\u6B65\u5931\u6557 \u2014 {details}","sourceControl.notice.sync.added":"\u65B0\u589E {count} \u500B","sourceControl.notice.sync.updated":"\u66F4\u65B0 {count} \u500B","sourceControl.notice.sync.moved":"\u79FB\u52D5 {count} \u500B","sourceControl.notice.sync.deleted":"\u522A\u9664 {count} \u500B","sourceControl.notice.sync.downloaded":"\u4E0B\u8F09 {count} \u500B","sourceControl.notice.sync.acceptedRemote":"\u63A1\u7528\u9060\u7AEF\u7248\u672C {count}","sourceControl.notice.sync.failedCount":"\u5931\u6557 {count} \u500B","sourceControl.notice.sync.conflicts":"{count} \u500B\u885D\u7A81","sourceControl.notice.sync.skippedConflicts":"\u7565\u904E {count} \u500B\u885D\u7A81"},Ht=gi;var mi={"settings.connectionStatus.checking":"\u68C0\u67E5\u4E2D\u2026","settings.connectionStatus.connected":"\u5DF2\u8FDE\u63A5","settings.connectionStatus.disconnected":"\u672A\u8FDE\u63A5","settings.connectionStatus.withDetail":"{label} \u2014 {detail}","settings.language.name":"\u8BED\u8A00","settings.language.desc":"\u6B64\u63D2\u4EF6\u7684\u754C\u9762\u8BED\u8A00","settings.language.option.system":"\u7CFB\u7EDF\u9ED8\u8BA4","settings.language.option.en":"English","settings.language.option.zhTw":"\u7E41\u9AD4\u4E2D\u6587","settings.language.option.zhCn":"\u7B80\u4F53\u4E2D\u6587","settings.gitService.name":"Git \u670D\u52A1","settings.gitService.desc":"\u9009\u62E9\u60A8\u7684 Git \u6258\u7BA1\u670D\u52A1","settings.branch.name":"\u5206\u652F","settings.branch.desc":"\u8981\u63A8\u9001\u6216\u62C9\u53D6\u7684\u5206\u652F","settings.branch.placeholder":"Main","settings.rootPath.name":"\u6839\u8DEF\u5F84","settings.rootPath.desc":"\u9009\u586B\uFF1A\u4ED3\u5E93\u4E2D\u7684\u5B50\u6587\u4EF6\u5939\uFF08\u4F8B\u5982\u300Cnotes\u300D\uFF09","settings.rootPath.placeholder":"\u8F93\u5165\u5B50\u6587\u4EF6\u5939\u8DEF\u5F84","settings.vaultFolder.name":"\u5E93\u6587\u4EF6\u5939","settings.vaultFolder.desc":"\u9009\u586B\uFF1A\u4EC5\u540C\u6B65\u6B64\u5E93\u6587\u4EF6\u5939\u5185\u7684\u6587\u4EF6\uFF08\u4F8B\u5982\u300Csync\u300D\u5219\u53EA\u540C\u6B65 sync \u6587\u4EF6\u5939\u5185\u7684\u6587\u4EF6\uFF09","settings.vaultFolder.placeholder":"\u7559\u7A7A\u4EE5\u540C\u6B65\u6240\u6709\u6587\u4EF6","settings.autoRefreshOnStartup.name":"\u542F\u52A8\u65F6\u5237\u65B0\u72B6\u6001","settings.autoRefreshOnStartup.desc":"Obsidian \u52A0\u8F7D\u5B8C\u6210\u540E\uFF0C\u81EA\u52A8\u5237\u65B0\u540C\u6B65\u72B6\u6001\u7A97\u53E3","settings.ignorePatterns.name":"\u5FFD\u7565\u89C4\u5219","settings.ignorePatterns.desc":"\u9009\u586B\uFF1A\u4EE5 .gitignore \u8BED\u6CD5\uFF08\u6BCF\u884C\u4E00\u6761\uFF09\u6392\u9664\u672C\u673A\u6587\u4EF6\uFF0C\u4F1A\u4E0E\u8FDC\u7A0B\u4ED3\u5E93\u7684 .gitignore \u89C4\u5219\u4E00\u5E76\u5E94\u7528\u3002","settings.symlinks.name":"\u7B26\u53F7\u94FE\u63A5","settings.symlinks.desc.supported":"\u7B26\u53F7\u94FE\u63A5\u7684\u540C\u6B65\u65B9\u5F0F\uFF1A\u300Creal\u300D\u4F1A\u5728\u684C\u9762\u7AEF\u91CD\u5EFA\u94FE\u63A5\uFF0C\u79FB\u52A8\u7AEF\u5219\u6539\u4E3A\u540C\u6B65\u76EE\u6807\u5185\u5BB9\uFF1B\u300Cfollow\u300D\u59CB\u7EC8\u540C\u6B65\u76EE\u6807\u5185\u5BB9\uFF1B\u300Cskip\u300D\u5219\u5FFD\u7565\u7B26\u53F7\u94FE\u63A5\u3002","settings.symlinks.desc.unsupported":"\u7B26\u53F7\u94FE\u63A5\u7684\u540C\u6B65\u65B9\u5F0F\uFF1A\u300Cfollow\u300D\u4EE5\u666E\u901A\u6587\u4EF6\u540C\u6B65\u76EE\u6807\u5185\u5BB9\uFF0C\u300Cskip\u300D\u5219\u5FFD\u7565\u7B26\u53F7\u94FE\u63A5\u3002\u771F\u5B9E\u7B26\u53F7\u94FE\u63A5\u4EC5\u652F\u6301 GitHub\u3002","settings.symlinks.option.real":"\u771F\u5B9E\u7B26\u53F7\u94FE\u63A5\uFF08\u63A8\u8350\uFF09","settings.symlinks.option.follow":"Follow\uFF08\u540C\u6B65\u76EE\u6807\u5185\u5BB9\uFF09","settings.symlinks.option.skip":"Skip\uFF08\u5FFD\u7565\uFF09","settings.testConnection.name":"\u6D4B\u8BD5\u8FDE\u63A5","settings.testConnection.desc":"\u9A8C\u8BC1\u60A8\u7684 {service} \u8BBE\u7F6E","settings.testConnection.button":"\u6D4B\u8BD5\u8FDE\u63A5","settings.testConnection.failed":"\u8FDE\u63A5\u5931\u8D25\uFF1A{reason}","settings.testConnection.failed.unreachable":"\u65E0\u6CD5\u8FDE\u63A5\u5230\u4ED3\u5E93","settings.testConnection.branchNotFound.badge":"\u627E\u4E0D\u5230\u5206\u652F\u300C{branch}\u300D","settings.testConnection.branchNotFound.notice":"\u5DF2\u8FDE\u63A5\uFF0C\u4F46\u627E\u4E0D\u5230\u5206\u652F\u300C{branch}\u300D\u3002\u8BF7\u68C0\u67E5\u5206\u652F\u8BBE\u7F6E\uFF0C\u6216\u786E\u8BA4\u4ED3\u5E93\u4E2D\u5B58\u5728\u6B64\u5206\u652F\u3002","settings.testConnection.success":"{service} \u8FDE\u63A5\u6210\u529F\uFF01","settings.token.placeholder":"\u8F93\u5165\u60A8\u7684\u4EE4\u724C","settings.token.show":"\u663E\u793A\u4EE4\u724C","settings.token.hide":"\u9690\u85CF\u4EE4\u724C","settings.gitlab.token.name":"GitLab \u4E2A\u4EBA\u8BBF\u95EE\u4EE4\u724C","settings.gitlab.token.desc":"\u8BF7\u5728 GitLab \u7528\u6237\u8BBE\u7F6E > access tokens \u521B\u5EFA\u5177\u6709\u300CAPI\u300D\u8303\u56F4\u7684\u4EE4\u724C","settings.gitlab.baseUrl.name":"GitLab \u57FA\u7840 URL","settings.gitlab.baseUrl.desc":"\u9ED8\u8BA4\u4E3A https://gitlab.com","settings.gitlab.projectId.name":"\u9879\u76EE ID","settings.gitlab.projectId.desc":"\u53EF\u5728 GitLab \u9879\u76EE\u603B\u89C8\u4E2D\u627E\u5230","settings.gitlab.projectId.placeholder":"\u8F93\u5165\u6570\u5B57\u9879\u76EE ID","settings.gitea.token.name":"Gitea \u4E2A\u4EBA\u8BBF\u95EE\u4EE4\u724C","settings.gitea.token.desc":"\u8BF7\u5728\u7528\u6237\u8BBE\u7F6E > applications > access tokens \u521B\u5EFA\u4EE4\u724C","settings.gitea.baseUrl.name":"Gitea \u57FA\u7840 URL","settings.gitea.baseUrl.desc":"\u60A8\u7684 Gitea \u5B9E\u4F8B\u7F51\u5740\uFF08\u4F8B\u5982 https://gitea.example.com\uFF09","settings.github.token.name":"GitHub \u4E2A\u4EBA\u8BBF\u95EE\u4EE4\u724C","settings.github.token.desc":"\u8BF7\u5728 GitHub \u8BBE\u7F6E > developer settings > personal access tokens \u521B\u5EFA\u5177\u6709\u300Crepo\u300D\u8303\u56F4\u7684\u4EE4\u724C","settings.repoOwner.name":"\u4ED3\u5E93\u6240\u6709\u8005","settings.repoOwner.desc.gitea":"Gitea \u7528\u6237\u540D\u6216\u7EC4\u7EC7\u540D\u79F0","settings.repoOwner.desc.github":"GitHub \u7528\u6237\u540D\u6216\u7EC4\u7EC7\u540D\u79F0","settings.repoOwner.placeholder":"\u7528\u6237\u540D","settings.repoName.name":"\u4ED3\u5E93\u540D\u79F0","settings.repoName.desc.gitea":"\u4ED3\u5E93\u7684\u540D\u79F0","settings.repoName.desc.github":"GitHub \u4ED3\u5E93\u7684\u540D\u79F0","settings.repoName.placeholder":"\u6211\u7684\u7B14\u8BB0","main.ribbon.openSyncStatus":"\u6253\u5F00\u6E90\u4EE3\u7801\u7BA1\u7406","main.ribbon.push":"\u63A8\u9001","main.ribbon.pushTo":"\u63A8\u9001\u81F3 {service}","main.command.openSyncStatus":"\u6253\u5F00\u6E90\u4EE3\u7801\u7BA1\u7406","main.command.pushCurrentFile":"\u63A8\u9001\u5F53\u524D\u6587\u4EF6","main.command.pullCurrentFile":"\u62C9\u53D6\u5F53\u524D\u6587\u4EF6","main.command.pushAllFiles":"\u63A8\u9001\u6240\u6709\u6587\u4EF6","main.command.pullAllFiles":"\u62C9\u53D6\u6240\u6709\u6587\u4EF6","main.notice.noActiveNote":"\u6CA1\u6709\u53EF\u63A8\u9001\u7684\u5F53\u524D\u7B14\u8BB0","main.contextMenu.pushTo":"\u63A8\u9001\u81F3 {service}","main.contextMenu.pullFrom":"\u4ECE {service} \u62C9\u53D6","main.notice.noFilesToRun":"\u8BBE\u7F6E\u7684\u5E93\u6587\u4EF6\u5939\u4E2D\u6CA1\u6709\u53EF{op}\u7684\u6587\u4EF6","main.confirm.pushAll":"\u8981\u63A8\u9001 {count} \u4E2A\u6587\u4EF6\u81F3 {service} \u5417\uFF1F","main.confirm.pullAll":"\u8981\u4ECE {service} \u62C9\u53D6 {count} \u4E2A\u6587\u4EF6\u5417\uFF1F\u8FD9\u5C06\u8986\u76D6\u672C\u673A\u53D8\u66F4\u3002","main.progress.running":"{verb} 0/{total} \u4E2A\u6587\u4EF6...","main.progress.step":"{verb} {current}/{total}\uFF1A{fileName}","main.notice.runFailed":"{verb}\u5931\u8D25\uFF1A{message}","main.op.push":"\u63A8\u9001","main.op.pull":"\u62C9\u53D6","main.verb.pushing":"\u63A8\u9001\u4E2D","main.verb.pulling":"\u62C9\u53D6\u4E2D","main.verb.push":"\u63A8\u9001","main.verb.pull":"\u62C9\u53D6","confirmModal.title":"\u786E\u8BA4","confirmModal.confirm":"\u786E\u8BA4","confirmModal.cancel":"\u53D6\u6D88","whatsNew.title":"\u65B0\u529F\u80FD","whatsNew.viewOnGitHub":"\u5728 GitHub \u4E0A\u67E5\u770B","whatsNew.viewChangelog":"\u67E5\u770B\u5B8C\u6574\u66F4\u65B0\u65E5\u5FD7","whatsNew.gotIt":"\u77E5\u9053\u4E86","whatsNew.openSourceControl":"\u6253\u5F00\u6E90\u4EE3\u7801\u63A7\u5236","whatsNew.close":"\u5173\u95ED","whatsNew.stepLabel":"\u6B65\u9AA4 {number}","settings.whatsNewBanner.title":"v{version} \u66F4\u65B0\u91CD\u70B9","settings.whatsNewBanner.dismiss":"\u5173\u95ED\u63D0\u793A","settings.whatsNewBanner.view":"\u67E5\u770B\u66F4\u65B0\u5185\u5BB9","settings.releaseHistory.name":"\u7248\u672C\u66F4\u65B0\u8BB0\u5F55","settings.releaseHistory.desc":"\u67E5\u770B\u5F53\u524D\u4E0E\u8FC7\u5F80\u7248\u672C\u7684\u66F4\u65B0\u5185\u5BB9","settings.releaseHistory.button":"\u67E5\u770B\u66F4\u65B0\u8BB0\u5F55","diffView.title":"\u5DEE\u5F02","diffView.titleWithFile":"\u5DEE\u5F02\uFF1A{path}","diffView.empty":"\u5728\u540C\u6B65\u9762\u677F\u9009\u4E00\u4E2A\u6709\u53D8\u66F4\u7684\u6587\u4EF6\u4EE5\u67E5\u770B\u5DEE\u5F02\u3002","diffPanel.remote":"\u8FDC\u7A0B","diffPanel.local":"\u672C\u673A","syncConflictModal.title":"{fileName} \u53D1\u751F\u51B2\u7A81","syncConflictModal.description":"\u8FDC\u7A0B\u6587\u4EF6\u5185\u5BB9\u6709\u6240\u4E0D\u540C\u3002\u8BF7\u67E5\u770B\u5DEE\u5F02\u5E76\u9009\u62E9\u8981\u4FDD\u7559\u7684\u7248\u672C\u3002","syncConflictModal.differences":"\u5DEE\u5F02","syncConflictModal.keepLocal":"\u4FDD\u7559\u672C\u673A","syncConflictModal.keepLocal.tooltip":"\u4EE5\u672C\u673A\u5185\u5BB9\u8986\u76D6\u8FDC\u7A0B","syncConflictModal.keepRemote":"\u4FDD\u7559\u8FDC\u7A0B","syncConflictModal.keepRemote.tooltip":"\u4EE5\u8FDC\u7A0B\u5185\u5BB9\u8986\u76D6\u672C\u673A","syncConflictModal.cancel":"\u53D6\u6D88","syncConflictModal.binaryChanged":"\u6B64\u4E8C\u8FDB\u5236\u6587\u4EF6\u7684\u672C\u5730\u4E0E\u8FDC\u7A0B\u7248\u672C\u5747\u5DF2\u66F4\u6539\uFF0C\u65E0\u6CD5\u663E\u793A\u9010\u884C\u5DEE\u5F02\u3002","syncPlanModal.title.push":"\u67E5\u770B\u63A8\u9001\u8BA1\u5212","syncPlanModal.title.pull":"\u67E5\u770B\u62C9\u53D6\u8BA1\u5212","syncPlanModal.title.delete":"\u67E5\u770B\u5220\u9664\u8BA1\u5212","syncPlanModal.title.sync":"\u67E5\u770B\u540C\u6B65\u8BA1\u5212","syncPlanModal.section.additions":"\u65B0\u589E","syncPlanModal.section.modifications":"\u4FEE\u6539","syncPlanModal.section.moves":"\u79FB\u52A8","syncPlanModal.section.downloads":"\u4E0B\u8F7D","syncPlanModal.section.acceptedRemote":"\u5728\u672C\u5730\u63A5\u53D7\u8FDC\u7A0B\u7248\u672C","syncPlanModal.section.skippedConflicts":"\u5DF2\u8DF3\u8FC7\u7684\u51B2\u7A81","syncPlanModal.section.deletions":"\u5220\u9664","syncPlanModal.deletionWarning":"\u6B64\u64CD\u4F5C\u5C06\u6C38\u4E45\u5220\u9664\u8FDC\u7A0B\u4E0A\u7684 {count} \u4E2A\u6587\u4EF6\uFF0C\u4E14\u65E0\u6CD5\u64A4\u9500\u3002","syncPlanModal.movedFrom":"\u4ECE {path} \u79FB\u52A8\u800C\u6765","syncPlanModal.confirm":"\u5E94\u7528","syncPlanModal.cancel":"\u53D6\u6D88","batchConflictModal.title":"\u5148\u89E3\u51B3 {count} \u4E2A\u51B2\u7A81","batchConflictModal.description":"\u53E6\u6709 {safeCount} \u4E2A\u6587\u4EF6\u5DF2\u5C31\u7EEA\uFF0C\u5C06\u968F\u672C\u6B21\u4E00\u5E76\u63A8\u9001\u3002","batchConflictModal.keepLocalAll":"\u5168\u90E8\u4FDD\u7559\u672C\u5730","batchConflictModal.keepRemoteAll":"\u5168\u90E8\u4FDD\u7559\u8FDC\u7A0B","batchConflictModal.skipAll":"\u5168\u90E8\u8DF3\u8FC7","batchConflictModal.row.binary":"\u4E8C\u8FDB\u5236\u6587\u4EF6","batchConflictModal.row.viewDiff":"\u67E5\u770B\u5DEE\u5F02","batchConflictModal.row.keepLocal":"\u4FDD\u7559\u672C\u5730","batchConflictModal.row.keepRemote":"\u4FDD\u7559\u8FDC\u7A0B","batchConflictModal.row.skip":"\u8DF3\u8FC7","batchConflictModal.continue":"\u7EE7\u7EED","batchConflictModal.cancel":"\u53D6\u6D88","batchConflictModal.unresolvedWarning":"\u8BF7\u5148\u4E3A\u6BCF\u4E2A\u51B2\u7A81\u9009\u62E9\u89E3\u51B3\u65B9\u5F0F\uFF0C\u624D\u80FD\u7EE7\u7EED\u3002","sourceControl.viewTitle":"\u6E90\u4EE3\u7801\u7BA1\u7406","sourceControl.filter.all":"\u5168\u90E8","sourceControl.filter.needsSync":"\u5F85\u540C\u6B65","sourceControl.filter.changes":"\u66F4\u6539","sourceControl.filter.local":"\u672C\u5730","sourceControl.filter.remote":"\u4F20\u5165","sourceControl.filter.readyToPush":"\u5F85\u63A8\u9001","sourceControl.filter.remoteChanges":"\u4F20\u5165","sourceControl.filter.conflicts":"\u51B2\u7A81","sourceControl.filter.synced":"\u5DF2\u540C\u6B65","sourceControl.filter.showSynced":"\u663E\u793A\u5DF2\u540C\u6B65","sourceControl.section.selectedForSync":"\u540C\u6B65\u961F\u5217","sourceControl.section.queueSubtitle":"\u5DF2\u9009 {count} \u4E2A\u6587\u4EF6","sourceControl.section.repositoryChanges":"\u4ED3\u5E93\u66F4\u6539","sourceControl.section.clearSelection":"\u6E05\u9664","sourceControl.section.clearSelection.tooltip":"\u53D6\u6D88\u5168\u90E8\u9009\u62E9","sourceControl.push":" \u540C\u6B65 ({count})","sourceControl.push.tooltip":"\u63A8\u9001 {count} \u4E2A\u5DF2\u5C31\u7EEA\u7684\u6587\u4EF6","sourceControl.refresh.tooltip":"\u5237\u65B0","sourceControl.refresh.refreshing":"\u5237\u65B0\u4E2D\u2026","sourceControl.refresh.failed":"\u5237\u65B0\u5931\u8D25","sourceControl.op.syncing":"\u540C\u6B65\u4E2D","sourceControl.op.synced":"\u5DF2\u540C\u6B65","sourceControl.op.failed":"\u5931\u8D25","sourceControl.status.added":"\u672C\u5730\u65B0\u589E","sourceControl.status.modified":"\u672C\u5730\u4FEE\u6539","sourceControl.status.deletedLocally":"\u672C\u5730\u5DF2\u5220\u9664","sourceControl.status.deletedLocally.tooltip":"\u5DF2\u8DDF\u8E2A\u6587\u4EF6\u5728\u672C\u5730\u88AB\u5220\u9664 \u2014 \u540C\u6B65\u9ED8\u8BA4\u4F1A\u5220\u9664\u8FDC\u7A0B\u526F\u672C\uFF1B\u5982\u9700\u6062\u590D\uFF0C\u8BF7\u6539\u7528\u300C\u4E0B\u8F7D\u300D","sourceControl.status.renamed":"\u5DF2\u91CD\u547D\u540D","sourceControl.status.remoteAvailable":"\u8FDC\u7A0B\u53EF\u7528","sourceControl.status.remoteAvailable.tooltip":"\u8FDC\u7A0B\u5B58\u5728\u4F46\u672C\u5730\u7F3A\u5931 \u2014 \u4E0B\u8F7D\u4EE5\u6DFB\u52A0","sourceControl.status.modifiedRemotely":"\u8FDC\u7A0B\u5DF2\u4FEE\u6539","sourceControl.status.conflict":"\u51B2\u7A81","sourceControl.status.synced":"\u5DF2\u540C\u6B65","sourceControl.queue.upload":"\u4E0A\u4F20","sourceControl.queue.download":"\u4E0B\u8F7D","sourceControl.queue.delete":"\u5220\u9664","sourceControl.action.download":"\u4E0B\u8F7D","sourceControl.action.download.tooltip":"\u4ECE\u8FDC\u7A0B\u4E0B\u8F7D","sourceControl.queue.action.push":"\u63A8\u9001\u672C\u673A","sourceControl.queue.action.pull":"\u4F7F\u7528\u8FDC\u7A0B","sourceControl.queue.action.deleteRemote":"\u5220\u9664\u8FDC\u7A0B","sourceControl.queue.menu.viewDiff":"\u67E5\u770B\u5DEE\u5F02","sourceControl.queue.menu.removeFromQueue":"\u4ECE\u540C\u6B65\u961F\u5217\u79FB\u9664","sourceControl.row.menu.tooltip":"\u66F4\u591A\u64CD\u4F5C","sourceControl.row.menu.pushLocal":"\u63A8\u9001\u672C\u673A","sourceControl.row.menu.useRemote":"\u4F7F\u7528\u8FDC\u7A0B","sourceControl.row.menu.useRemoteEllipsis":"\u4F7F\u7528\u8FDC\u7A0B\u2026","sourceControl.row.menu.pushLocalEllipsis":"\u63A8\u9001\u672C\u673A\u2026","sourceControl.row.menu.deleteRemote":"\u5220\u9664\u8FDC\u7A0B","sourceControl.row.menu.deleteRemoteEllipsis":"\u5220\u9664\u8FDC\u7A0B\u2026","sourceControl.row.menu.deleteLocalEllipsis":"\u5220\u9664\u672C\u673A\u2026","sourceControl.row.menu.restoreLocal":"\u8FD8\u539F\u672C\u673A","sourceControl.row.menu.viewDiff":"\u67E5\u770B\u5DEE\u5F02","sourceControl.row.menu.addToQueue":"\u52A0\u5165\u540C\u6B65\u961F\u5217","sourceControl.row.menu.openRemote":"\u6253\u5F00\u8FDC\u7A0B","sourceControl.row.confirmDeleteRemote":"\u8981\u4ECE\u8FDC\u7A0B\u5220\u9664\u201C{path}\u201D\u5417?\u8FD9\u4E0D\u4F1A\u5F71\u54CD\u672C\u5730\u526F\u672C\u3002","sourceControl.empty":"\u6CA1\u6709\u66F4\u6539","sourceControl.detail.back":"\u8FD4\u56DE","sourceControl.mobile.filesSelected":"\u5DF2\u9009 {count} \u4E2A\u6587\u4EF6","sourceControl.mobile.sync":"\u540C\u6B65","sourceControl.info.lastChecked":"\u4E0A\u6B21\u68C0\u67E5\uFF1A{time}","sourceControl.info.justChecked":"\u4E0A\u6B21\u68C0\u67E5\uFF1A\u521A\u521A","sourceControl.search.placeholder":"\u6309\u8DEF\u5F84\u8FC7\u6EE4\u2026","sourceControl.search.clear":"\u6E05\u9664\u8FC7\u6EE4","sourceControl.folder.selectAll":"\u9009\u53D6\u6587\u4EF6\u5939\u5185\u5168\u90E8\u9879\u76EE","sourceControl.diff.switchToSplit":"\u5207\u6362\u4E3A\u4E24\u680F\u5F0F\u5DEE\u5F02\u663E\u793A","sourceControl.diff.switchToUnified":"\u5207\u6362\u4E3A\u5355\u680F\u5F0F\u5DEE\u5F02\u663E\u793A","sourceControl.diff.split":"\u4E24\u680F","sourceControl.diff.unified":"\u5355\u680F","sourceControl.view.toggleLabel":"\u89C6\u56FE","sourceControl.view.tree":"\u6811\u72B6","sourceControl.view.list":"\u5217\u8868","sync.notice.pushSummary":"\u5DF2\u63A8\u9001\u81F3 {service}\uFF1A\u65B0\u589E {added} \u4E2A\u3001\u66F4\u65B0 {updated} \u4E2A{commitNote}\u3002","sync.notice.pushAddedOnly":"\u5DF2\u63A8\u9001\u81F3 {service}\uFF1A\u65B0\u589E {added} \u4E2A{commitNote}\u3002","sync.notice.pushUpdatedOnly":"\u5DF2\u63A8\u9001\u81F3 {service}\uFF1A\u66F4\u65B0 {updated} \u4E2A{commitNote}\u3002","sync.notice.pushCommitNote":"\uFF08\u5408\u5E76\u4E3A\u4E00\u6B21\u63D0\u4EA4\uFF09","sync.notice.pullSummary":"\u5DF2\u4ECE {service} \u62C9\u53D6\uFF1A\u65B0\u589E {added} \u4E2A\u3001\u66F4\u65B0 {updated} \u4E2A\u3002","sync.notice.pullAddedOnly":"\u5DF2\u4ECE {service} \u62C9\u53D6\uFF1A\u65B0\u589E {added} \u4E2A\u3002","sync.notice.pullUpdatedOnly":"\u5DF2\u4ECE {service} \u62C9\u53D6\uFF1A\u66F4\u65B0 {updated} \u4E2A\u3002","sourceControl.notice.sync.success":"\u540C\u6B65\u5B8C\u6210 \u2014 {details}","sourceControl.notice.sync.partial":"\u540C\u6B65\u5B8C\u6210\u4F46\u6709\u95EE\u9898 \u2014 {details}","sourceControl.notice.sync.failed":"\u540C\u6B65\u5931\u8D25 \u2014 {details}","sourceControl.notice.sync.added":"\u65B0\u589E {count} \u4E2A","sourceControl.notice.sync.updated":"\u66F4\u65B0 {count} \u4E2A","sourceControl.notice.sync.moved":"\u79FB\u52A8 {count} \u4E2A","sourceControl.notice.sync.deleted":"\u5220\u9664 {count} \u4E2A","sourceControl.notice.sync.downloaded":"\u4E0B\u8F7D {count} \u4E2A","sourceControl.notice.sync.acceptedRemote":"\u91C7\u7528\u8FDC\u7A0B\u7248\u672C {count}","sourceControl.notice.sync.failedCount":"\u5931\u8D25 {count} \u4E2A","sourceControl.notice.sync.conflicts":"{count} \u4E2A\u51B2\u7A81","sourceControl.notice.sync.skippedConflicts":"\u8DF3\u8FC7 {count} \u4E2A\u51B2\u7A81"},_t=mi;var Vt={en:me,"zh-tw":Ht,"zh-cn":_t},St="system";function ye(r){St=r}function yi(){var e,t,n;let r=window;try{return(n=(t=(e=r.moment)==null?void 0:e.locale())==null?void 0:t.toLowerCase())!=null?n:""}catch(i){return""}}function Si(r){return r in Vt?r:r.startsWith("zh")?r.includes("cn")?"zh-cn":"zh-tw":"en"}function vt(){return St!=="system"?St:Si(yi())}function l(r,e){var i,s;let n=(s=((i=Vt[vt()])!=null?i:me)[r])!=null?s:me[r];return e?n.replace(/\{(\w+)(?:\|([^|]*)\|([^}]*))?\}/g,(o,a,c,h)=>{if(!(a in e))return o;let d=String(e[a]);return c!==void 0&&h!==void 0?e[a]===1?`${d} ${c}`:`${d} ${h}`:d}):n}var qt={version:"1.6.0",headline:{en:"A new Source Control workflow","zh-tw":"\u5168\u65B0\u7684\u539F\u59CB\u78BC\u63A7\u5236\u6D41\u7A0B","zh-cn":"\u5168\u65B0\u7684\u6E90\u4EE3\u7801\u63A7\u5236\u6D41\u7A0B"},summary:{en:"Review repository changes, choose what belongs in the Sync Queue, then sync everything from one place.","zh-tw":"\u5148\u6AA2\u8996\u5132\u5B58\u5EAB\u8B8A\u66F4\uFF0C\u9078\u64C7\u8981\u653E\u5165\u540C\u6B65\u4F47\u5217\u7684\u9805\u76EE\uFF0C\u6700\u5F8C\u5728\u540C\u4E00\u8655\u5B8C\u6210\u540C\u6B65\u3002","zh-cn":"\u5148\u67E5\u770B\u4ED3\u5E93\u53D8\u66F4\uFF0C\u9009\u62E9\u8981\u653E\u5165\u540C\u6B65\u961F\u5217\u7684\u9879\u76EE\uFF0C\u6700\u540E\u5728\u540C\u4E00\u5904\u5B8C\u6210\u540C\u6B65\u3002"},onboarding:{action:"open-source-control",steps:[{title:{en:"Review Repository Changes","zh-tw":"\u6AA2\u8996\u5132\u5B58\u5EAB\u8B8A\u66F4","zh-cn":"\u67E5\u770B\u4ED3\u5E93\u53D8\u66F4"},description:{en:"See local edits, remote updates, renames, deletions, and conflicts in one place.","zh-tw":"\u5728\u540C\u4E00\u8655\u67E5\u770B\u672C\u6A5F\u7DE8\u8F2F\u3001\u9060\u7AEF\u66F4\u65B0\u3001\u91CD\u65B0\u547D\u540D\u3001\u522A\u9664\u8207\u885D\u7A81\u3002","zh-cn":"\u5728\u540C\u4E00\u5904\u67E5\u770B\u672C\u5730\u7F16\u8F91\u3001\u8FDC\u7A0B\u66F4\u65B0\u3001\u91CD\u547D\u540D\u3001\u5220\u9664\u4E0E\u51B2\u7A81\u3002"}},{title:{en:"Build your Sync Queue","zh-tw":"\u5EFA\u7ACB\u540C\u6B65\u4F47\u5217","zh-cn":"\u5EFA\u7ACB\u540C\u6B65\u961F\u5217"},description:{en:"Select exactly which changes should be included in the next sync.","zh-tw":"\u7CBE\u78BA\u9078\u64C7\u4E0B\u4E00\u6B21\u540C\u6B65\u8981\u5305\u542B\u54EA\u4E9B\u8B8A\u66F4\u3002","zh-cn":"\u7CBE\u786E\u9009\u62E9\u4E0B\u4E00\u6B21\u540C\u6B65\u8981\u5305\u542B\u54EA\u4E9B\u53D8\u66F4\u3002"}},{title:{en:"Review and Sync","zh-tw":"\u6AA2\u8996\u4E26\u540C\u6B65","zh-cn":"\u67E5\u770B\u5E76\u540C\u6B65"},description:{en:"Uploads, downloads, moves, and remote deletions are combined into one reviewed operation.","zh-tw":"\u4E0A\u50B3\u3001\u4E0B\u8F09\u3001\u642C\u79FB\u8207\u9060\u7AEF\u522A\u9664\u6703\u5408\u4F75\u6210\u4E00\u6B21\u53EF\u6AA2\u8996\u7684\u64CD\u4F5C\u3002","zh-cn":"\u4E0A\u4F20\u3001\u4E0B\u8F7D\u3001\u79FB\u52A8\u4E0E\u8FDC\u7A0B\u5220\u9664\u4F1A\u5408\u5E76\u6210\u4E00\u6B21\u53EF\u67E5\u770B\u7684\u64CD\u4F5C\u3002"}}]},entries:[{notable:!0,text:{en:"\u{1F500} New Source Control workflow \u2014 Review, Queue, then Sync replaces the old select-and-push flow.","zh-tw":"\u{1F500} \u5168\u65B0\u7684\u539F\u59CB\u78BC\u63A7\u5236\u6D41\u7A0B \u2014 \u300C\u6AA2\u8996 \u2192 \u4F47\u5217 \u2192 \u540C\u6B65\u300D\u53D6\u4EE3\u4E86\u820A\u6709\u7684\u9078\u53D6\u5F8C\u76F4\u63A5\u63A8\u9001\u6D41\u7A0B\u3002","zh-cn":"\u{1F500} \u5168\u65B0\u7684\u6E90\u4EE3\u7801\u63A7\u5236\u6D41\u7A0B \u2014 \u201C\u67E5\u770B \u2192 \u961F\u5217 \u2192 \u540C\u6B65\u201D\u53D6\u4EE3\u4E86\u539F\u6709\u7684\u9009\u53D6\u540E\u76F4\u63A5\u63A8\u9001\u6D41\u7A0B\u3002"}},{notable:!0,text:{en:"\u{1F4CB} Unified Sync Queue \u2014 Uploads, downloads, and remote deletions are gathered into one queue and applied together.","zh-tw":"\u{1F4CB} \u7D71\u4E00\u7684\u540C\u6B65\u4F47\u5217 \u2014 \u4E0A\u50B3\u3001\u4E0B\u8F09\u8207\u9060\u7AEF\u522A\u9664\u6703\u96C6\u4E2D\u5230\u540C\u4E00\u500B\u4F47\u5217\uFF0C\u4E26\u4E00\u4F75\u5957\u7528\u3002","zh-cn":"\u{1F4CB} \u7EDF\u4E00\u7684\u540C\u6B65\u961F\u5217 \u2014 \u4E0A\u4F20\u3001\u4E0B\u8F7D\u4E0E\u8FDC\u7A0B\u5220\u9664\u4F1A\u96C6\u4E2D\u5230\u540C\u4E00\u4E2A\u961F\u5217\uFF0C\u5E76\u4E00\u5E76\u5E94\u7528\u3002"}},{notable:!0,text:{en:"\u{1F5D1}\uFE0F Local deletions now behave predictably \u2014 Sync a locally deleted tracked file to remove it remotely, or use Download to restore it.","zh-tw":"\u{1F5D1}\uFE0F \u672C\u6A5F\u522A\u9664\u884C\u70BA\u66F4\u53EF\u9810\u671F \u2014 \u540C\u6B65\u5DF2\u5728\u672C\u6A5F\u522A\u9664\u7684\u8FFD\u8E64\u6A94\u6848\u6703\u4E00\u4F75\u79FB\u9664\u9060\u7AEF\uFF1B\u4E5F\u53EF\u4F7F\u7528\u300C\u4E0B\u8F09\u300D\u9084\u539F\u8A72\u6A94\u6848\u3002","zh-cn":"\u{1F5D1}\uFE0F \u672C\u5730\u5220\u9664\u884C\u4E3A\u66F4\u53EF\u9884\u671F \u2014 \u540C\u6B65\u5DF2\u5728\u672C\u5730\u5220\u9664\u7684\u8DDF\u8E2A\u6587\u4EF6\u4F1A\u4E00\u5E76\u79FB\u9664\u8FDC\u7A0B\uFF1B\u4E5F\u53EF\u4F7F\u7528\u201C\u4E0B\u8F7D\u201D\u8FD8\u539F\u8BE5\u6587\u4EF6\u3002"}},{text:{en:"\u2728 Clear file status indicators and an improved desktop and mobile workflow.","zh-tw":"\u2728 \u66F4\u6E05\u695A\u7684\u6A94\u6848\u72C0\u614B\u6A19\u793A\uFF0C\u684C\u9762\u8207\u884C\u52D5\u88DD\u7F6E\u64CD\u4F5C\u9AD4\u9A57\u4E5F\u4E00\u4F75\u512A\u5316\u3002","zh-cn":"\u2728 \u66F4\u6E05\u6670\u7684\u6587\u4EF6\u72B6\u6001\u6807\u8BC6\uFF0C\u684C\u9762\u4E0E\u79FB\u52A8\u8BBE\u5907\u64CD\u4F5C\u4F53\u9A8C\u4E5F\u4E00\u5E76\u4F18\u5316\u3002"}}]};var Ut={version:"1.5.0",entries:[{notable:!0,text:{en:"\u{1F50E} Preview changes before syncing \u2014 Before pushing, pulling, or deleting remote files, review all planned additions, modifications, deletions, and moves before applying them.","zh-tw":"\u{1F50E} \u540C\u6B65\u524D\u5148\u9810\u89BD\u8B8A\u66F4 \u2014 \u63A8\u9001\u3001\u62C9\u53D6\u6216\u522A\u9664\u9060\u7AEF\u6A94\u6848\u524D\uFF0C\u73FE\u5728\u6703\u5148\u986F\u793A\u9810\u8A08\u65B0\u589E\u3001\u4FEE\u6539\u3001\u522A\u9664\u8207\u642C\u79FB\u7684\u5167\u5BB9\uFF0C\u78BA\u8A8D\u5F8C\u624D\u6703\u5957\u7528\u3002","zh-cn":"\u{1F50E} \u540C\u6B65\u524D\u5148\u9884\u89C8\u53D8\u66F4 \u2014 \u63A8\u9001\u3001\u62C9\u53D6\u6216\u5220\u9664\u8FDC\u7A0B\u6587\u4EF6\u524D\uFF0C\u73B0\u5728\u4F1A\u5148\u663E\u793A\u9884\u8BA1\u65B0\u589E\u3001\u4FEE\u6539\u3001\u5220\u9664\u4E0E\u79FB\u52A8\u7684\u5185\u5BB9\uFF0C\u786E\u8BA4\u540E\u624D\u4F1A\u5E94\u7528\u3002"}},{notable:!0,text:{en:"\u{1F4E6} Renames and moves now sync as real moves \u2014 Rename a file or move a folder without leaving duplicate files behind remotely. Folder moves are grouped together for easier review.","zh-tw":"\u{1F4E6} \u91CD\u65B0\u547D\u540D\u8207\u642C\u79FB\u6703\u771F\u6B63\u540C\u6B65\u70BA\u642C\u79FB \u2014 \u91CD\u65B0\u547D\u540D\u6A94\u6848\u6216\u642C\u79FB\u8CC7\u6599\u593E\u5F8C\uFF0C\u9060\u7AEF\u6703\u4E00\u4F75\u79FB\u9664\u820A\u8DEF\u5F91\uFF0C\u4E0D\u518D\u7559\u4E0B\u91CD\u8907\u6A94\u6848\u3002\u8CC7\u6599\u593E\u642C\u79FB\u4E5F\u6703\u5408\u4F75\u986F\u793A\uFF0C\u8B93\u6E05\u55AE\u66F4\u5BB9\u6613\u95B1\u8B80\u3002","zh-cn":"\u{1F4E6} \u91CD\u547D\u540D\u4E0E\u79FB\u52A8\u4F1A\u771F\u6B63\u540C\u6B65\u4E3A\u79FB\u52A8 \u2014 \u91CD\u547D\u540D\u6587\u4EF6\u6216\u79FB\u52A8\u6587\u4EF6\u5939\u540E\uFF0C\u8FDC\u7A0B\u4F1A\u4E00\u5E76\u79FB\u9664\u65E7\u8DEF\u5F84\uFF0C\u4E0D\u518D\u7559\u4E0B\u91CD\u590D\u6587\u4EF6\u3002\u6587\u4EF6\u5939\u79FB\u52A8\u4E5F\u4F1A\u5408\u5E76\u663E\u793A\uFF0C\u8BA9\u5217\u8868\u66F4\u6613\u4E8E\u9605\u8BFB\u3002"}},{notable:!0,text:{en:"\u{1F333} Browse sync status in a tree \u2014 Expand and collapse your sync list by folder, select whole folders at once, and choose whether synced files appear in All.","zh-tw":"\u{1F333} \u4EE5\u6A39\u72C0\u6AA2\u8996\u700F\u89BD\u540C\u6B65\u72C0\u614B \u2014 \u540C\u6B65\u6E05\u55AE\u73FE\u5728\u53EF\u4F9D\u8CC7\u6599\u593E\u968E\u5C64\u5C55\u958B\u8207\u6536\u5408\uFF0C\u4E26\u53EF\u76F4\u63A5\u52FE\u9078\u6574\u500B\u8CC7\u6599\u593E\u4E2D\u7684\u6A94\u6848\uFF1B\u4E5F\u80FD\u9078\u64C7\u662F\u5426\u5728\u300C\u5168\u90E8\u300D\u4E2D\u986F\u793A\u5DF2\u540C\u6B65\u9805\u76EE\u3002","zh-cn":"\u{1F333} \u4EE5\u6811\u72B6\u89C6\u56FE\u6D4F\u89C8\u540C\u6B65\u72B6\u6001 \u2014 \u540C\u6B65\u5217\u8868\u73B0\u5728\u53EF\u6309\u6587\u4EF6\u5939\u5C42\u7EA7\u5C55\u5F00\u4E0E\u6536\u8D77\uFF0C\u5E76\u53EF\u76F4\u63A5\u52FE\u9009\u6574\u4E2A\u6587\u4EF6\u5939\u4E2D\u7684\u6587\u4EF6\uFF1B\u4E5F\u80FD\u9009\u62E9\u662F\u5426\u5728\u201C\u5168\u90E8\u201D\u4E2D\u663E\u793A\u5DF2\u540C\u6B65\u9879\u76EE\u3002"}},{text:{en:"\u26A1 Live sync status updates \u2014 File status updates immediately when you edit, rename, or move a file in your vault.","zh-tw":"\u26A1 \u540C\u6B65\u72C0\u614B\u5373\u6642\u66F4\u65B0 \u2014 \u7DE8\u8F2F\u3001\u91CD\u65B0\u547D\u540D\u6216\u642C\u79FB Vault \u4E2D\u7684\u6A94\u6848\u6642\uFF0C\u540C\u6B65\u72C0\u614B\u6703\u7ACB\u5373\u66F4\u65B0\uFF0C\u4E0D\u5FC5\u624B\u52D5\u91CD\u65B0\u6574\u7406\u3002","zh-cn":"\u26A1 \u540C\u6B65\u72B6\u6001\u5373\u65F6\u66F4\u65B0 \u2014 \u7F16\u8F91\u3001\u91CD\u547D\u540D\u6216\u79FB\u52A8 Vault \u4E2D\u7684\u6587\u4EF6\u65F6\uFF0C\u540C\u6B65\u72B6\u6001\u4F1A\u7ACB\u5373\u66F4\u65B0\uFF0C\u4E0D\u5FC5\u624B\u52A8\u5237\u65B0\u3002"}},{text:{en:"\u{1F680} Refresh status automatically at startup \u2014 The sync status refreshes automatically after Obsidian opens. This is on by default and can be turned off in Settings.","zh-tw":"\u{1F680} \u555F\u52D5\u6642\u81EA\u52D5\u6AA2\u67E5\u540C\u6B65\u72C0\u614B \u2014 \u958B\u555F Obsidian \u5F8C\u6703\u81EA\u52D5\u66F4\u65B0\u540C\u6B65\u72C0\u614B\uFF1B\u6B64\u529F\u80FD\u9810\u8A2D\u958B\u555F\uFF0C\u4E5F\u53EF\u5728\u8A2D\u5B9A\u4E2D\u95DC\u9589\u3002","zh-cn":"\u{1F680} \u542F\u52A8\u65F6\u81EA\u52A8\u68C0\u67E5\u540C\u6B65\u72B6\u6001 \u2014 \u6253\u5F00 Obsidian \u540E\u4F1A\u81EA\u52A8\u66F4\u65B0\u540C\u6B65\u72B6\u6001\uFF1B\u6B64\u529F\u80FD\u9ED8\u8BA4\u5F00\u542F\uFF0C\u4E5F\u53EF\u5728\u8BBE\u7F6E\u4E2D\u5173\u95ED\u3002"}},{text:{en:"\u2728 Interface refinements \u2014 Mobile status filters now use a dropdown; synced items are listed last so changes needing attention are easier to find.","zh-tw":"\u2728 \u64CD\u4F5C\u4ECB\u9762\u512A\u5316 \u2014 \u884C\u52D5\u88DD\u7F6E\u4E0A\u7684\u72C0\u614B\u5206\u985E\u6539\u70BA\u4E0B\u62C9\u9078\u55AE\uFF0C\u5207\u63DB\u8207\u700F\u89BD\u66F4\u9806\u624B\uFF1B\u300C\u5DF2\u540C\u6B65\u300D\u9805\u76EE\u4E5F\u6703\u6392\u5728\u6E05\u55AE\u6700\u5F8C\uFF0C\u8B93\u9700\u8981\u8655\u7406\u7684\u8B8A\u66F4\u66F4\u5BB9\u6613\u88AB\u770B\u898B\u3002","zh-cn":"\u2728 \u64CD\u4F5C\u754C\u9762\u4F18\u5316 \u2014 \u79FB\u52A8\u8BBE\u5907\u4E0A\u7684\u72B6\u6001\u5206\u7C7B\u6539\u4E3A\u4E0B\u62C9\u83DC\u5355\uFF0C\u5207\u6362\u4E0E\u6D4F\u89C8\u66F4\u987A\u624B\uFF1B\u201C\u5DF2\u540C\u6B65\u201D\u9879\u76EE\u4E5F\u4F1A\u6392\u5728\u5217\u8868\u6700\u540E\uFF0C\u8BA9\u9700\u8981\u5904\u7406\u7684\u53D8\u66F4\u66F4\u5BB9\u6613\u88AB\u770B\u89C1\u3002"}}]};var zt={version:"1.4.0",entries:[{notable:!0,text:{en:"The sync panel now has a search box above the tabs \u2014 type part of a path to filter the list, and a folder prefix doubles as a folder filter.","zh-tw":"\u540C\u6B65\u9762\u677F\u73FE\u5728\u591A\u4E86\u641C\u5C0B\u6846\uFF0C\u4F4D\u7F6E\u5728\u5206\u9801\u4E0A\u65B9\u2014\u2014\u8F38\u5165\u8DEF\u5F91\u7684\u4E00\u90E8\u5206\u5373\u53EF\u7BE9\u9078\u6E05\u55AE\uFF0C\u8F38\u5165\u8CC7\u6599\u593E\u524D\u7DB4\u4E5F\u80FD\u7576\u4F5C\u8CC7\u6599\u593E\u7BE9\u9078\u3002","zh-cn":"\u540C\u6B65\u9762\u677F\u73B0\u5728\u591A\u4E86\u641C\u7D22\u6846\uFF0C\u4F4D\u7F6E\u5728\u5206\u9875\u4E0A\u65B9\u2014\u2014\u8F93\u5165\u8DEF\u5F84\u7684\u4E00\u90E8\u5206\u5373\u53EF\u7B5B\u9009\u5217\u8868\uFF0C\u8F93\u5165\u6587\u4EF6\u5939\u524D\u7F00\u4E5F\u80FD\u5F53\u4F5C\u6587\u4EF6\u5939\u7B5B\u9009\u3002"}},{notable:!0,text:{en:"File paths in the sync panel are now clickable \u2014 local files open in your vault, and remote-only files open the page on GitHub.","zh-tw":"\u540C\u6B65\u9762\u677F\u4E2D\u7684\u6A94\u6848\u8DEF\u5F91\u73FE\u5728\u53EF\u4EE5\u9EDE\u64CA\u2014\u2014\u672C\u6A5F\u6A94\u6848\u6703\u5728 Vault \u4E2D\u958B\u555F\uFF0C\u50C5\u5B58\u5728\u9060\u7AEF\u7684\u6A94\u6848\u5247\u6703\u958B\u555F\u5176 GitHub \u9801\u9762\u3002","zh-cn":"\u540C\u6B65\u9762\u677F\u4E2D\u7684\u6587\u4EF6\u8DEF\u5F84\u73B0\u5728\u53EF\u4EE5\u70B9\u51FB\u2014\u2014\u672C\u673A\u6587\u4EF6\u4F1A\u5728 Vault \u4E2D\u6253\u5F00\uFF0C\u4EC5\u5B58\u5728\u8FDC\u7AEF\u7684\u6587\u4EF6\u5219\u4F1A\u6253\u5F00\u5176 GitHub \u9875\u9762\u3002"}},{text:{en:"On desktop, the Diff button now opens the comparison in its own pane instead of expanding inline, so it stays open alongside the rest of your vault.","zh-tw":"\u5728\u684C\u9762\u7248\u4E2D\uFF0C\u300C\u5DEE\u7570\u300D\u6309\u9215\u73FE\u5728\u6703\u5728\u7368\u7ACB\u9762\u677F\u4E2D\u958B\u555F\u6BD4\u8F03\u7D50\u679C\uFF0C\u800C\u975E\u76F4\u63A5\u5167\u5D4C\u5C55\u958B\uFF0C\u8B93\u5B83\u53EF\u4EE5\u8207 Vault \u5176\u4ED6\u5167\u5BB9\u4E26\u6392\u986F\u793A\u3002","zh-cn":'\u5728\u684C\u9762\u7248\u4E2D\uFF0C"\u5DEE\u5F02"\u6309\u94AE\u73B0\u5728\u4F1A\u5728\u72EC\u7ACB\u9762\u677F\u4E2D\u6253\u5F00\u6BD4\u8F83\u7ED3\u679C\uFF0C\u800C\u975E\u76F4\u63A5\u5185\u5D4C\u5C55\u5F00\uFF0C\u8BA9\u5B83\u53EF\u4EE5\u4E0E Vault \u5176\u4ED6\u5185\u5BB9\u5E76\u6392\u663E\u793A\u3002'}},{text:{en:"Fixed a rare case where a push could reuse a stale cached file list right after a commit, because GitHub briefly served a cached response for the branch head.","zh-tw":"\u4FEE\u5FA9\u6975\u5C11\u6578\u60C5\u6CC1\u4E0B\uFF0C\u63A8\u9001\u5F8C\u53EF\u80FD\u56E0 GitHub \u66AB\u6642\u56DE\u50B3\u5FEB\u53D6\u7684\u5206\u652F HEAD \u56DE\u61C9\uFF0C\u800C\u6CBF\u7528\u904E\u671F\u7684\u6A94\u6848\u6E05\u55AE\u5FEB\u53D6\u3002","zh-cn":"\u4FEE\u590D\u6781\u5C11\u6570\u60C5\u51B5\u4E0B\uFF0C\u63A8\u9001\u540E\u53EF\u80FD\u56E0 GitHub \u6682\u65F6\u8FD4\u56DE\u7F13\u5B58\u7684\u5206\u652F HEAD \u54CD\u5E94\uFF0C\u800C\u6CBF\u7528\u8FC7\u671F\u7684\u6587\u4EF6\u5217\u8868\u7F13\u5B58\u3002"}}]};var Kt={version:"1.3.1",entries:[{notable:!0,text:{en:"Pushing to GitHub is now noticeably faster \u2014 pushes route through GitHub's GraphQL API instead of one REST call per file, and a redundant lookup before each push has been removed.","zh-tw":"\u63A8\u9001\u5230 GitHub \u7684\u901F\u5EA6\u660E\u986F\u63D0\u5347\u2014\u2014\u63A8\u9001\u6539\u8D70 GitHub \u7684 GraphQL API\uFF0C\u4E0D\u518D\u662F\u6BCF\u500B\u6A94\u6848\u5404\u4E00\u6B21 REST \u8ACB\u6C42\uFF0C\u4E26\u79FB\u9664\u4E86\u63A8\u9001\u524D\u7684\u591A\u9918\u67E5\u8A62\u3002","zh-cn":"\u63A8\u9001\u5230 GitHub \u7684\u901F\u5EA6\u660E\u663E\u63D0\u5347\u2014\u2014\u63A8\u9001\u6539\u8D70 GitHub \u7684 GraphQL API\uFF0C\u4E0D\u518D\u662F\u6BCF\u4E2A\u6587\u4EF6\u5404\u4E00\u6B21 REST \u8BF7\u6C42\uFF0C\u5E76\u79FB\u9664\u4E86\u63A8\u9001\u524D\u7684\u5197\u4F59\u67E5\u8BE2\u3002"}}]};var Wt={version:"1.3.0",entries:[{notable:!0,text:{en:"The plugin now speaks multiple languages \u2014 English, Traditional Chinese, and Simplified Chinese. It follows your Obsidian display language automatically, or you can pick one in Settings.","zh-tw":"\u5916\u639B\u73FE\u5728\u652F\u63F4\u591A\u570B\u8A9E\u8A00\u2014\u2014\u82F1\u6587\u3001\u7E41\u9AD4\u4E2D\u6587\u8207\u7C21\u9AD4\u4E2D\u6587\u3002\u6703\u81EA\u52D5\u8DDF\u96A8 Obsidian \u7684\u986F\u793A\u8A9E\u8A00\uFF0C\u4F60\u4E5F\u53EF\u4EE5\u5728\u8A2D\u5B9A\u4E2D\u624B\u52D5\u9078\u64C7\u3002","zh-cn":"\u63D2\u4EF6\u73B0\u5728\u652F\u6301\u591A\u79CD\u8BED\u8A00\u2014\u2014\u82F1\u6587\u3001\u7E41\u4F53\u4E2D\u6587\u4E0E\u7B80\u4F53\u4E2D\u6587\u3002\u4F1A\u81EA\u52A8\u8DDF\u968F Obsidian \u7684\u663E\u793A\u8BED\u8A00\uFF0C\u4F60\u4E5F\u53EF\u4EE5\u5728\u8BBE\u7F6E\u4E2D\u624B\u52A8\u9009\u62E9\u3002"}},{notable:!0,text:{en:"Checking sync status is now much faster, especially in vaults with lots of files.","zh-tw":"\u6AA2\u67E5\u540C\u6B65\u72C0\u614B\u7684\u901F\u5EA6\u5927\u5E45\u63D0\u5347\uFF0C\u5C24\u5176\u662F\u5728\u6A94\u6848\u8F03\u591A\u7684 Vault \u4E2D\u3002","zh-cn":"\u68C0\u67E5\u540C\u6B65\u72B6\u6001\u7684\u901F\u5EA6\u5927\u5E45\u63D0\u5347\uFF0C\u5C24\u5176\u662F\u5728\u6587\u4EF6\u8F83\u591A\u7684 Vault \u4E2D\u3002"}},{text:{en:"Fixed a bug where a linked (symlinked) folder could be pulled incorrectly instead of being treated as a link.","zh-tw":"\u4FEE\u5FA9\u9023\u7D50\uFF08\u7B26\u865F\u9023\u7D50\uFF09\u8CC7\u6599\u593E\u5728\u62C9\u53D6\u6642\u53EF\u80FD\u88AB\u932F\u8AA4\u8655\u7406\uFF0C\u800C\u975E\u8996\u70BA\u9023\u7D50\u7684\u554F\u984C\u3002","zh-cn":"\u4FEE\u590D\u94FE\u63A5\uFF08\u7B26\u53F7\u94FE\u63A5\uFF09\u6587\u4EF6\u5939\u5728\u62C9\u53D6\u65F6\u53EF\u80FD\u88AB\u9519\u8BEF\u5904\u7406\uFF0C\u800C\u975E\u89C6\u4E3A\u94FE\u63A5\u7684\u95EE\u9898\u3002"}},{text:{en:"Added a setting to keep specific files or folders out of sync, in addition to what your repo's .gitignore already excludes.","zh-tw":"\u65B0\u589E\u8A2D\u5B9A\uFF0C\u53EF\u5728\u5132\u5B58\u5EAB .gitignore \u4E4B\u5916\uFF0C\u984D\u5916\u6392\u9664\u7279\u5B9A\u6A94\u6848\u6216\u8CC7\u6599\u593E\u4E0D\u53C3\u8207\u540C\u6B65\u3002","zh-cn":"\u65B0\u589E\u8BBE\u7F6E\uFF0C\u53EF\u5728\u4ED3\u5E93 .gitignore \u4E4B\u5916\uFF0C\u989D\u5916\u6392\u9664\u7279\u5B9A\u6587\u4EF6\u6216\u6587\u4EF6\u5939\u4E0D\u53C2\u4E0E\u540C\u6B65\u3002"}},{text:{en:"Settings now show your connection status at a glance, so you can tell right away if something needs attention.","zh-tw":"\u8A2D\u5B9A\u9801\u9762\u73FE\u5728\u6703\u4E00\u773C\u986F\u793A\u9023\u7DDA\u72C0\u614B\uFF0C\u8B93\u4F60\u7ACB\u5373\u77E5\u9053\u662F\u5426\u9700\u8981\u8655\u7406\u3002","zh-cn":"\u8BBE\u7F6E\u9875\u9762\u73B0\u5728\u4F1A\u4E00\u76EE\u4E86\u7136\u5730\u663E\u793A\u8FDE\u63A5\u72B6\u6001\uFF0C\u8BA9\u4F60\u7ACB\u5373\u77E5\u9053\u662F\u5426\u9700\u8981\u5904\u7406\u3002"}},{text:{en:"The conflict resolution window can now be resized to see more content at once.","zh-tw":"\u885D\u7A81\u89E3\u6C7A\u8996\u7A97\u73FE\u5728\u53EF\u4EE5\u8ABF\u6574\u5927\u5C0F\uFF0C\u65B9\u4FBF\u4E00\u6B21\u770B\u5230\u66F4\u591A\u5167\u5BB9\u3002","zh-cn":"\u51B2\u7A81\u89E3\u51B3\u7A97\u53E3\u73B0\u5728\u53EF\u4EE5\u8C03\u6574\u5927\u5C0F\uFF0C\u65B9\u4FBF\u4E00\u6B21\u67E5\u770B\u66F4\u591A\u5185\u5BB9\u3002"}},{text:{en:"Picking your sync folders is easier now, with a folder browser instead of typing paths by hand.","zh-tw":"\u9078\u64C7\u540C\u6B65\u8CC7\u6599\u593E\u66F4\u65B9\u4FBF\u4E86\uFF0C\u6539\u7528\u8CC7\u6599\u593E\u700F\u89BD\u5668\u53D6\u4EE3\u624B\u52D5\u8F38\u5165\u8DEF\u5F91\u3002","zh-cn":"\u9009\u62E9\u540C\u6B65\u6587\u4EF6\u5939\u66F4\u65B9\u4FBF\u4E86\uFF0C\u6539\u7528\u6587\u4EF6\u5939\u6D4F\u89C8\u5668\u53D6\u4EE3\u624B\u52A8\u8F93\u5165\u8DEF\u5F84\u3002"}},{text:{en:"Connection errors now explain what went wrong in plain language instead of a raw technical error.","zh-tw":"\u9023\u7DDA\u932F\u8AA4\u73FE\u5728\u6703\u4EE5\u6613\u61C2\u7684\u8AAA\u660E\u5448\u73FE\uFF0C\u800C\u4E0D\u662F\u986F\u793A\u539F\u59CB\u7684\u6280\u8853\u932F\u8AA4\u8A0A\u606F\u3002","zh-cn":"\u8FDE\u63A5\u9519\u8BEF\u73B0\u5728\u4F1A\u4EE5\u6613\u61C2\u7684\u8BF4\u660E\u5448\u73B0\uFF0C\u800C\u4E0D\u662F\u663E\u793A\u539F\u59CB\u7684\u6280\u672F\u9519\u8BEF\u4FE1\u606F\u3002"}},{text:{en:`You'll now see a short "what's new" summary right after updating, so you don't miss new features.`,"zh-tw":"\u66F4\u65B0\u5F8C\u6703\u7ACB\u5373\u770B\u5230\u7C21\u77ED\u7684\u300C\u6700\u65B0\u6D88\u606F\u300D\u6458\u8981\uFF0C\u8B93\u4F60\u4E0D\u932F\u904E\u65B0\u529F\u80FD\u3002","zh-cn":'\u66F4\u65B0\u540E\u4F1A\u7ACB\u5373\u770B\u5230\u7B80\u77ED\u7684"\u6700\u65B0\u6D88\u606F"\u6458\u8981\uFF0C\u8BA9\u4F60\u4E0D\u9519\u8FC7\u65B0\u529F\u80FD\u3002'}}]};var Qt={version:"1.2.1",entries:[{notable:!0,text:{en:"Fixed compatibility with Obsidian versions back to 1.11.0","zh-tw":"\u4FEE\u5FA9\u8207 Obsidian 1.11.0 \u4EE5\u4E0A\u7248\u672C\u7684\u76F8\u5BB9\u6027\u554F\u984C","zh-cn":"\u4FEE\u590D\u4E0E Obsidian 1.11.0 \u53CA\u4EE5\u4E0A\u7248\u672C\u7684\u517C\u5BB9\u6027\u95EE\u9898"}}]};var U=[qt,Ut,zt,Kt,Wt,Qt];function z(r){var t;let e=vt();return(t=r[e])!=null?t:r.en}function oe(r){return z(r.text)}function jt(r,e){return r.filter(t=>se(t.version,e)>0).sort((t,n)=>se(n.version,t.version))}var Jt="https://github.com/firstsun-dev/git-files-sync/blob/main/CHANGELOG.md",vi="https://github.com/firstsun-dev/git-files-sync",O=class extends E.Modal{constructor(e,t,n){super(e),this.releases=t,this.onOpenSourceControl=n}onOpen(){var i;let{contentEl:e}=this;e.createEl("h3",{text:l("whatsNew.title")});for(let s of this.releases)s.headline&&s.onboarding?this.renderOnboardingRelease(e,s):this.renderLegacyRelease(e,s);let t=e.createDiv({cls:"ssv-confirm-buttons modal-button-container"}),n=this.releases[0];((i=n==null?void 0:n.onboarding)==null?void 0:i.action)==="open-source-control"?(new E.ButtonComponent(t).setButtonText(l("whatsNew.openSourceControl")).setCta().onClick(()=>{var s;this.close(),(s=this.onOpenSourceControl)==null||s.call(this)}),new E.ButtonComponent(t).setButtonText(l("whatsNew.viewChangelog")).onClick(()=>window.open(Jt,"_blank","noopener")),new E.ButtonComponent(t).setButtonText(l("whatsNew.close")).onClick(()=>this.close())):(new E.ButtonComponent(t).setButtonText(l("whatsNew.viewOnGitHub")).onClick(()=>window.open(vi,"_blank","noopener")),new E.ButtonComponent(t).setButtonText(l("whatsNew.viewChangelog")).onClick(()=>window.open(Jt,"_blank","noopener")),new E.ButtonComponent(t).setButtonText(l("whatsNew.gotIt")).setCta().onClick(()=>this.close()))}renderLegacyRelease(e,t){e.createEl("h4",{text:`v${t.version}`});let n=e.createEl("ul",{cls:"ssv-whats-new-list"});for(let i of t.entries)n.createEl("li",{cls:i.notable?"ssv-whats-new-notable":void 0}).setText(oe(i))}renderOnboardingRelease(e,t){e.createEl("h4",{text:z(t.headline)}),t.summary&&e.createEl("p",{text:z(t.summary),cls:"ssv-whats-new-summary"});let n=e.createEl("ol",{cls:"ssv-whats-new-steps"});t.onboarding.steps.forEach((s,o)=>{let a=n.createEl("li",{cls:"ssv-whats-new-step"});a.createSpan({cls:"ssv-whats-new-step-label",text:l("whatsNew.stepLabel",{number:o+1})}),a.createEl("strong",{text:z(s.title)}),s.description&&a.createEl("p",{text:z(s.description)})});let i=e.createEl("ul",{cls:"ssv-whats-new-list"});for(let s of t.entries)i.createEl("li",{cls:s.notable?"ssv-whats-new-notable":void 0}).setText(oe(s))}onClose(){let{contentEl:e}=this;e.empty()}};var Ci=800,Se=class extends C.PluginSettingTab{constructor(t,n,i){super(t,n);this.host=i;this.statusBadgeEl=null;this.connectionTestTimer=null;this.unsubscribeConnectionStatus=null}hide(){var t;(t=this.unsubscribeConnectionStatus)==null||t.call(this),this.unsubscribeConnectionStatus=null,this.connectionTestTimer&&(window.clearTimeout(this.connectionTestTimer),this.connectionTestTimer=null)}display(){this.renderSettings(this.containerEl)}getSettingDefinitions(){return[{name:"",render:(t,n)=>{this.renderSettings(n.listEl)}}]}refresh(){let t=this.update;typeof t=="function"?t.call(this):this.renderSettings(this.containerEl)}renderWhatsNewBanner(t){var f;let n=this.host.manifest.version;if(this.host.settings.bannerDismissedVersion===n)return;let i=U.find(p=>p.version===n),s=(f=i==null?void 0:i.entries.filter(p=>p.notable))!=null?f:[];if(s.length===0)return;let o=i!=null&&i.onboarding?s.slice(0,2):s,a=t.createDiv({cls:"gfs-whats-new-banner"}),c=a.createDiv({cls:"gfs-whats-new-banner-text"});c.createEl("strong",{text:l("settings.whatsNewBanner.title",{version:n})});let h=c.createEl("ul",{cls:"gfs-whats-new-banner-list"});for(let p of o)h.createEl("li",{text:oe(p)});new C.ButtonComponent(c).setButtonText(l("settings.whatsNewBanner.view")).onClick(()=>{new O(this.app,U,()=>{this.host.activateSourceControlView()}).open()}).buttonEl.addClass("gfs-whats-new-banner-view"),a.createEl("button",{cls:"gfs-whats-new-banner-dismiss",text:"\xD7",attr:{"aria-label":l("settings.whatsNewBanner.dismiss")}}).addEventListener("click",()=>{(async()=>(this.host.settings.bannerDismissedVersion=n,await this.host.saveSettings(),this.refresh()))()})}renderReleaseHistorySetting(t){new C.Setting(t).setName(l("settings.releaseHistory.name")).setDesc(l("settings.releaseHistory.desc")).addButton(n=>n.setButtonText(l("settings.releaseHistory.button")).onClick(()=>{new O(this.app,U,()=>{this.host.activateSourceControlView()}).open()}))}renderConnectionStatus(t){var n;this.statusBadgeEl=t.createDiv({cls:"gfs-connection-status"}),(n=this.unsubscribeConnectionStatus)==null||n.call(this),this.unsubscribeConnectionStatus=this.host.onConnectionStatusChange(i=>this.setStatusBadge(i))}setStatusBadge(t){let n=this.statusBadgeEl;if(!n)return;n.removeClass("is-checking","is-connected","is-disconnected"),n.addClass(`is-${t.state}`);let s={checking:l("settings.connectionStatus.checking"),connected:l("settings.connectionStatus.connected"),disconnected:l("settings.connectionStatus.disconnected")}[t.state];n.setText(t.detail?l("settings.connectionStatus.withDetail",{label:s,detail:t.detail}):s)}scheduleConnectionTest(){this.connectionTestTimer&&window.clearTimeout(this.connectionTestTimer),this.connectionTestTimer=window.setTimeout(()=>{this.connectionTestTimer=null,this.host.testConnection()},Ci)}renderSettings(t){t.empty(),this.renderWhatsNewBanner(t),this.renderReleaseHistorySetting(t),this.renderConnectionStatus(t),new C.Setting(t).setName(l("settings.language.name")).setDesc(l("settings.language.desc")).addDropdown(i=>i.addOption("system",l("settings.language.option.system")).addOption("en",l("settings.language.option.en")).addOption("zh-tw",l("settings.language.option.zhTw")).addOption("zh-cn",l("settings.language.option.zhCn")).setValue(this.host.settings.language).onChange(s=>{this.host.settings.language=s,this.host.saveSettings(),ye(this.host.settings.language),this.refresh()})),new C.Setting(t).setName(l("settings.gitService.name")).setDesc(l("settings.gitService.desc")).addDropdown(i=>i.addOption("gitlab","GitLab").addOption("github","GitHub").addOption("gitea","Gitea").setValue(this.host.settings.serviceType).onChange(s=>{this.host.settings.serviceType=s,this.host.saveSettings(),this.host.initializeGitService(),this.refresh()})),new C.Setting(t).setName("").setHeading(),this.host.settings.serviceType==="gitlab"?this.displayGitLabSettings(t):this.host.settings.serviceType==="gitea"?this.displayGiteaSettings(t):this.displayGitHubSettings(t),new C.Setting(t).setName(l("settings.branch.name")).setDesc(l("settings.branch.desc")).addText(i=>i.setPlaceholder(l("settings.branch.placeholder")).setValue(this.host.settings.branch).onChange(s=>{this.host.settings.branch=s||"main",this.host.saveSettings(),this.scheduleConnectionTest()})),new C.Setting(t).setName(l("settings.rootPath.name")).setDesc(l("settings.rootPath.desc")).addText(i=>{i.setPlaceholder(l("settings.rootPath.placeholder")).setValue(this.host.settings.rootPath).onChange(s=>{this.host.settings.rootPath=s.replace(/^\/|\/$/g,""),this.host.saveSettings(),this.host.initializeGitService()}),ge.attach(this.app,i.inputEl,this.host)}),new C.Setting(t).setName(l("settings.vaultFolder.name")).setDesc(l("settings.vaultFolder.desc")).addText(i=>{i.setPlaceholder(l("settings.vaultFolder.placeholder")).setValue(this.host.settings.vaultFolder).onChange(s=>{this.host.settings.vaultFolder=s.replace(/^\/|\/$/g,""),this.host.saveSettings()}),fe.attach(this.app,i.inputEl)}),new C.Setting(t).setName(l("settings.autoRefreshOnStartup.name")).setDesc(l("settings.autoRefreshOnStartup.desc")).addToggle(i=>i.setValue(this.host.settings.autoRefreshOnStartup).onChange(s=>{this.host.settings.autoRefreshOnStartup=s,this.host.saveSettings()})),new C.Setting(t).setName(l("settings.ignorePatterns.name")).setDesc(l("settings.ignorePatterns.desc")).addTextArea(i=>{i.setPlaceholder(`${this.app.vault.configDir}/
|
|
*.tmp`).setValue(this.host.settings.ignorePatterns).onChange(s=>{this.host.settings.ignorePatterns=s,this.host.saveSettings()}),i.inputEl.rows=4});let n=this.host.settings.serviceType==="github";new C.Setting(t).setName(l("settings.symlinks.name")).setDesc(n?l("settings.symlinks.desc.supported"):l("settings.symlinks.desc.unsupported")).addDropdown(i=>{n&&i.addOption("real",l("settings.symlinks.option.real")),i.addOption("follow",l("settings.symlinks.option.follow")).addOption("skip",l("settings.symlinks.option.skip")).setValue(k(this.host.settings)).onChange(s=>{this.host.settings.symlinkHandling=s,this.host.saveSettings()})}),new C.Setting(t).setName(l("settings.testConnection.name")).setDesc(l("settings.testConnection.desc",{service:x(this.host.settings)})).addButton(i=>i.setButtonText(l("settings.testConnection.button")).onClick(async()=>{var s;try{let o=await this.host.testConnection();o.repoOk?o.branchOk?new C.Notice(l("settings.testConnection.success",{service:x(this.host.settings)})):new C.Notice(l("settings.testConnection.branchNotFound.notice",{branch:this.host.settings.branch}),8e3):new C.Notice(l("settings.testConnection.failed",{reason:(s=o.error)!=null?s:l("settings.testConnection.failed.unreachable")}))}catch(o){let a=o instanceof Error?o.message:String(o);new C.Notice(l("settings.testConnection.failed",{reason:a}))}})),this.scheduleConnectionTest()}addTokenSetting(t,n,i,s,o){let a;new C.Setting(t).setName(n).setDesc(i).addText(c=>{a=c,c.inputEl.type="password",c.setPlaceholder(l("settings.token.placeholder")).setValue(s()).onChange(o)}).addExtraButton(c=>{c.setIcon("eye").setTooltip(l("settings.token.show")).onClick(()=>{let h=a.inputEl.type==="password";a.inputEl.type=h?"text":"password",c.setIcon(h?"eye-off":"eye"),c.setTooltip(h?l("settings.token.hide"):l("settings.token.show"))})})}displayGitLabSettings(t){this.addTokenSetting(t,l("settings.gitlab.token.name"),l("settings.gitlab.token.desc"),()=>this.host.settings.gitlabToken,n=>{this.host.settings.gitlabToken=n,this.host.saveSettings(),this.host.initializeGitService(),this.scheduleConnectionTest()}),new C.Setting(t).setName(l("settings.gitlab.baseUrl.name")).setDesc(l("settings.gitlab.baseUrl.desc")).addText(n=>n.setPlaceholder("https://gitlab.com").setValue(this.host.settings.gitlabBaseUrl).onChange(i=>{this.host.settings.gitlabBaseUrl=i||"https://gitlab.com",this.host.saveSettings(),this.host.initializeGitService(),this.scheduleConnectionTest()})),new C.Setting(t).setName(l("settings.gitlab.projectId.name")).setDesc(l("settings.gitlab.projectId.desc")).addText(n=>n.setPlaceholder(l("settings.gitlab.projectId.placeholder")).setValue(this.host.settings.projectId).onChange(i=>{this.host.settings.projectId=i,this.host.saveSettings(),this.host.initializeGitService(),this.scheduleConnectionTest()}))}displayGiteaSettings(t){this.addTokenSetting(t,l("settings.gitea.token.name"),l("settings.gitea.token.desc"),()=>this.host.settings.giteaToken,n=>{this.host.settings.giteaToken=n,this.host.saveSettings(),this.host.initializeGitService(),this.scheduleConnectionTest()}),new C.Setting(t).setName(l("settings.gitea.baseUrl.name")).setDesc(l("settings.gitea.baseUrl.desc")).addText(n=>n.setPlaceholder("https://gitea.example.com").setValue(this.host.settings.giteaBaseUrl).onChange(i=>{this.host.settings.giteaBaseUrl=i||"https://gitea.example.com",this.host.saveSettings(),this.host.initializeGitService(),this.scheduleConnectionTest()})),new C.Setting(t).setName(l("settings.repoOwner.name")).setDesc(l("settings.repoOwner.desc.gitea")).addText(n=>n.setPlaceholder(l("settings.repoOwner.placeholder")).setValue(this.host.settings.giteaOwner).onChange(i=>{this.host.settings.giteaOwner=i,this.host.saveSettings(),this.host.initializeGitService(),this.scheduleConnectionTest()})),new C.Setting(t).setName(l("settings.repoName.name")).setDesc(l("settings.repoName.desc.gitea")).addText(n=>n.setPlaceholder(l("settings.repoName.placeholder")).setValue(this.host.settings.giteaRepo).onChange(i=>{this.host.settings.giteaRepo=i,this.host.saveSettings(),this.host.initializeGitService(),this.scheduleConnectionTest()}))}displayGitHubSettings(t){this.addTokenSetting(t,l("settings.github.token.name"),l("settings.github.token.desc"),()=>this.host.settings.githubToken,n=>{this.host.settings.githubToken=n,this.host.saveSettings(),this.host.initializeGitService(),this.scheduleConnectionTest()}),new C.Setting(t).setName(l("settings.repoOwner.name")).setDesc(l("settings.repoOwner.desc.github")).addText(n=>n.setPlaceholder(l("settings.repoOwner.placeholder")).setValue(this.host.settings.githubOwner).onChange(i=>{this.host.settings.githubOwner=i,this.host.saveSettings(),this.host.initializeGitService(),this.scheduleConnectionTest()})),new C.Setting(t).setName(l("settings.repoName.name")).setDesc(l("settings.repoName.desc.github")).addText(n=>n.setPlaceholder(l("settings.repoName.placeholder")).setValue(this.host.settings.githubRepo).onChange(i=>{this.host.settings.githubRepo=i,this.host.saveSettings(),this.host.initializeGitService(),this.scheduleConnectionTest()}))}};var ve=class extends Se{getSettingDefinitions(){return[]}};var Yt=require("obsidian");var Ct="[git-file-sync]",S={error:(r,...e)=>console.error(`${Ct} ${r}`,...e),warn:(r,...e)=>console.warn(`${Ct} ${r}`,...e),debug:(r,...e)=>console.debug(`${Ct} ${r}`,...e)};var bi=new Set(["png","jpg","jpeg","gif","bmp","ico","webp","tif","tiff","heic","heif","avif","jxl","pdf","epub","doc","docx","xls","xlsx","ppt","pptx","odt","ods","odp","zip","gz","tar","bz2","xz","zst","7z","rar","mp3","wav","ogg","flac","aac","m4a","opus","aiff","mp4","webm","mov","avi","wmv","mkv","flv","m4v","ttf","otf","woff","woff2","eot","exe","dll","so","wasm","dmg","iso","apk","deb","rpm","sqlite","db","psd","sketch","fig"]);function b(r){var t;let e=(t=r.split(".").pop())==null?void 0:t.toLowerCase();return e?bi.has(e):!1}function K(r,e){if(typeof r=="string"&&typeof e=="string")return r===e;if(typeof r!=typeof e)return!1;let t=r,n=e;if(t.byteLength!==n.byteLength)return!1;let i=new Uint8Array(t),s=new Uint8Array(n);for(let o=0;o<i.length;o++)if(i[o]!==s[o])return!1;return!0}var $="120000",H=200,Xt=8,D=class{constructor(){this.token="";this.rootPath=""}async safeRequest(e,t,n,i,s=!1){let o;try{let a={...i,"Content-Type":"application/json"};this.addAuthHeader(a);let c={url:e,method:t,headers:a,body:n?JSON.stringify(n):void 0,throw:!1};o=await(0,Yt.requestUrl)(c)}catch(a){throw s||S.error("Git Service Request Failed:",a),this.looksLikeJsonParseOfHtmlError(a)?new Error("Expected a JSON response from the Git server but received an HTML page (likely a login, SSO redirect, or proxy/error page). Please check the server URL, your access token, and any network proxy or firewall."):a instanceof Error?a:new Error(`Network error or unexpected failure: ${String(a)}`)}if(o.status>=400){let a=this.parseErrorResponse(o);throw s||(o.status===404?S.debug(`Git Service 404 (not found): ${e}`):S.error(`Git Service Request Failed (${o.status}): ${e}`,a)),new Error(`Git Service Error (${o.status}): ${a}`)}return o}looksLikeJsonParseOfHtmlError(e){return e instanceof Error?/unexpected token/i.test(e.message)&&/json/i.test(e.message)&&e.message.includes("<"):!1}parseJson(e){var s,o,a,c,h;let t=((c=(a=(s=e.headers)==null?void 0:s["content-type"])!=null?a:(o=e.headers)==null?void 0:o["Content-Type"])!=null?c:"").toLowerCase(),i=((h=e.text)!=null?h:"").trimStart().startsWith("<")||t.includes("html");try{let d=e.json;if(d===void 0&&i)throw new Error("non-JSON response");return d}catch(d){throw i?new Error("Expected a JSON response from the Git server but received an HTML page (likely a login, SSO redirect, or proxy/error page). Please check the server URL, your access token, and any network proxy or firewall."):new Error(`Failed to parse the Git server response as JSON: ${d instanceof Error?d.message:String(d)}`)}}parseErrorResponse(e){var t,n,i,s,o;try{let a=e.json;return a.message||a.error||JSON.stringify(a)}catch(a){let c=((t=e.text)!=null?t:"").trim(),h=((o=(s=(n=e.headers)==null?void 0:n["content-type"])!=null?s:(i=e.headers)==null?void 0:i["Content-Type"])!=null?o:"").toLowerCase();return c.startsWith("<")||h.includes("html")?"Received an HTML page instead of a JSON error (likely a login, redirect, or proxy/error page). Check the server URL, access token, and network proxy.":c||"Unknown error"}}getFullPath(e){if(e.startsWith("/"))return e.slice(1);if(!this.rootPath)return e;let t=this.rootPath.endsWith("/")?this.rootPath:`${this.rootPath}/`;return e.startsWith(t)?e:t+e}encodeContent(e){if(typeof e=="string"){let t=new TextEncoder().encode(e),n="";for(let i=0;i<t.byteLength;i++){let s=t[i];s!==void 0&&(n+=String.fromCodePoint(s))}return btoa(n)}else{let t=new Uint8Array(e),n="";for(let i=0;i<t.byteLength;i++){let s=t[i];s!==void 0&&(n+=String.fromCodePoint(s))}return btoa(n)}}decodeContent(e,t){let n=atob(e.replace(/\s/g,"")),i=new Uint8Array(n.length);for(let s=0;s<n.length;s++){let o=n.codePointAt(s);i[s]=o!==void 0?o:0}return b(t)?i.buffer:new TextDecoder().decode(i)}async fetchGitHubStyleBlob(e,t){let n=await this.safeRequest(e,"GET"),i=this.parseJson(n);return{content:this.decodeContent(i.content,t),sha:i.sha}}handleFileNotFound(e){if(e instanceof Error&&e.message.includes("404"))return{content:"",sha:""};throw e}branchNotFoundError(e,t){return e instanceof Error&&e.message.includes("404")?new Error(`Branch "${t}" was not found in the repository. Check the Branch setting, or confirm the repository actually has a branch with this name (its default branch might be "master" instead of "main", or the repository may have no commits yet).`):e instanceof Error?e:new Error(String(e))}getGitDataApiBase(){throw new Error("getGitDataApiBase is not implemented for this provider")}async getLatestCommitSha(e){let t=this.getGitDataApiBase(),n=await this.safeRequest(`${t}/git/ref/heads/${e}`,"GET",void 0,{"Cache-Control":"no-cache"});return this.parseJson(n).object.sha}async resolveGitHubStyleBaseTree(e){let t=await this.getLatestCommitSha(e),n=this.getGitDataApiBase(),i=await this.safeRequest(`${n}/git/commits/${t}`,"GET"),s=this.parseJson(i).tree.sha;return{latestCommitSha:t,baseTreeSha:s}}async commitGitHubStyleTree(e,t,n,i,s,o){let a=await this.safeRequest(`${e}/git/trees`,"POST",{base_tree:n,tree:s}),c=this.parseJson(a).sha,h=await this.safeRequest(`${e}/git/commits`,"POST",{message:o,tree:c,parents:[i]}),d=this.parseJson(h).sha;return await this.safeRequest(`${e}/git/refs/heads/${t}`,"PATCH",{sha:d}),d}async mapWithConcurrency(e,t,n){let i=new Array(e.length),s=0,o=async()=>{for(;s<e.length;){let a=s++;i[a]=await n(e[a],a)}};return await Promise.all(Array.from({length:Math.min(t,e.length)},o)),i}async getRepoGitignores(e){try{return(await this.listFiles(e,!1)).filter(n=>n.endsWith(".gitignore"))}catch(t){return[]}}async listFiles(e,t=!0){return(await this.listFilesDetailed(e,t)).map(i=>i.path)}};var Ce=class extends D{constructor(){super(...arguments);this.baseUrl="https://gitlab.com";this.projectId=""}updateConfig(t,n,i,s=""){this.baseUrl=t.endsWith("/")?t.slice(0,-1):t,this.token=n,this.projectId=i,this.rootPath=s}addAuthHeader(t){t["PRIVATE-TOKEN"]=this.token}getApiUrl(t){let n=this.getFullPath(t),i=encodeURIComponent(n),s=encodeURIComponent(this.projectId);return`${this.baseUrl}/api/v4/projects/${s}/repository/files/${i}`}async getFile(t,n){try{let i=`${this.getApiUrl(t)}?ref=${n}`,s=await this.safeRequest(i,"GET"),o=this.parseJson(s);return{content:this.decodeContent(o.content,t),sha:o.blob_id,revision:o.last_commit_id}}catch(i){return this.handleFileNotFound(i)}}async pushFile(t,n,i,s,o,a){let c=this.getApiUrl(t),h={branch:i,content:this.encodeContent(n),encoding:"base64",commit_message:s};a&&(h.last_commit_id=a);let d=o?"PUT":"POST",u=await this.safeRequest(c,d,h);return{path:this.parseJson(u).file_path}}async pushBatch(t,n,i){if(t.length===0)return[];let s=encodeURIComponent(this.projectId),o=`${this.baseUrl}/api/v4/projects/${s}/repository/commits`,a=await Promise.all(t.map(async d=>({action:d.existedRemotely?"update":"create",file_path:this.getFullPath(d.path),content:this.encodeContent(d.content),encoding:"base64",...d.existedRemotely&&d.revision?{last_commit_id:d.revision}:{}})));await this.safeRequest(o,"POST",{branch:n,commit_message:i,actions:a});let c=await this.listFilesDetailed(n,!1),h=new Map(c.map(d=>[d.path,d.sha]));return t.map(d=>({path:d.path,sha:h.get(this.getFullPath(d.path))}))}async commitBatch(t,n,i){let{writes:s,moves:o,deletions:a}=t;if(s.length===0&&o.length===0&&a.length===0)return[];let c=encodeURIComponent(this.projectId),h=`${this.baseUrl}/api/v4/projects/${c}/repository/commits`,d=[...await Promise.all(s.map(async p=>({action:p.existedRemotely?"update":"create",file_path:this.getFullPath(p.path),content:this.encodeContent(p.content),encoding:"base64",...p.existedRemotely&&p.revision?{last_commit_id:p.revision}:{}}))),...await Promise.all(o.map(async p=>({action:"move",file_path:this.getFullPath(p.newPath),previous_path:this.getFullPath(p.oldPath),content:this.encodeContent(p.content),encoding:"base64",...p.oldRevision?{last_commit_id:p.oldRevision}:{}}))),...await Promise.all(a.map(async p=>({action:"delete",file_path:this.getFullPath(p),last_commit_id:(await this.getFile(p,n)).revision})))];await this.safeRequest(h,"POST",{branch:n,commit_message:i,actions:d});let u=await this.listFilesDetailed(n,!1),f=new Map(u.map(p=>[p.path,p.sha]));return[...s.map(p=>({path:p.path,sha:f.get(this.getFullPath(p.path))})),...o.map(p=>({path:p.newPath,sha:f.get(this.getFullPath(p.newPath))}))]}async listFilesDetailed(t,n=!0){let i=encodeURIComponent(this.projectId),s=[],o=1,a=100;for(;;){let c=`${this.baseUrl}/api/v4/projects/${i}/repository/tree?ref=${t}&recursive=true&per_page=${a}&page=${o}`,h;try{let u=await this.safeRequest(c,"GET");h=this.parseJson(u)}catch(u){throw this.branchNotFoundError(u,t)}if(!h||h.length===0)break;let d=h.filter(u=>u.type==="blob").map(u=>({path:u.path,symlink:u.mode===$,sha:u.id}));if(n){let u=d.filter(f=>{if(!this.rootPath)return!0;let p=this.rootPath.endsWith("/")?this.rootPath:`${this.rootPath}/`;return f.path===this.rootPath||f.path.startsWith(p)});s=s.concat(u)}else s=s.concat(d);if(h.length<a)break;o++}return s}async getBlob(t,n){let i=encodeURIComponent(this.projectId),s=`${this.baseUrl}/api/v4/projects/${i}/repository/blobs/${t}/raw`,o=await this.safeRequest(s,"GET");return{content:b(n)?o.arrayBuffer:o.text,sha:t}}async deleteFile(t,n,i){let s=this.getApiUrl(t),o={branch:n,commit_message:i};await this.safeRequest(s,"DELETE",o)}async deleteBatch(t,n,i){if(t.length===0)return;let s=encodeURIComponent(this.projectId),o=`${this.baseUrl}/api/v4/projects/${s}/repository/commits`,a=await Promise.all(t.map(async c=>({action:"delete",file_path:this.getFullPath(c),last_commit_id:(await this.getFile(c,n)).revision})));await this.safeRequest(o,"POST",{branch:n,commit_message:i,actions:a})}async testConnection(t){let n=encodeURIComponent(this.projectId);try{let i=`${this.baseUrl}/api/v4/projects/${n}`;await this.safeRequest(i,"GET")}catch(i){return{repoOk:!1,branchOk:!1,error:i instanceof Error?i.message:String(i)}}try{let i=encodeURIComponent(t),s=`${this.baseUrl}/api/v4/projects/${n}/repository/branches/${i}`;return await this.safeRequest(s,"GET",void 0,void 0,!0),{repoOk:!0,branchOk:!0}}catch(i){return{repoOk:!0,branchOk:!1}}}};var be=class{constructor(){this.startedAt=performance.now();this.requestUploadMs=0;this.responseParsingMs=0;this.requestCount=0}async measureRequest(e){let t=performance.now();try{return await e()}finally{this.requestUploadMs+=performance.now()-t,this.requestCount++}}measureParsing(e){let t=performance.now();try{return e()}finally{this.responseParsingMs+=performance.now()-t}}createRecord(e,t,n,i,s,o,a){return{strategy:e,fileCount:t,rawBytes:n,encodedBytes:i,changePreparationMs:s,encodingMs:o,requestUploadMs:this.requestUploadMs,responseParsingMs:this.responseParsingMs,providerProcessingMs:null,requestCount:this.requestCount,totalMs:performance.now()-this.startedAt,...a?{failure:a}:{}}}};var wi=`
|
|
mutation ($input: CreateCommitOnBranchInput!) {
|
|
createCommitOnBranch(input: $input) {
|
|
commit { oid }
|
|
}
|
|
}
|
|
`,Pi=`
|
|
query ($owner: String!, $name: String!, $qualifiedName: String!) {
|
|
repository(owner: $owner, name: $name) {
|
|
ref(qualifiedName: $qualifiedName) { target { oid } }
|
|
}
|
|
}
|
|
`,Ri=/expected branch to point to|pull and try again|does not exist in tree|does not exist as of commit|head sha was modified|does not match|expectedHeadOid|is at .+ but expected/i,we=class extends D{constructor(){super(...arguments);this.owner="";this.repo=""}setPushTimingHandler(t){this.pushTimingHandler=t}updateConfig(t,n,i,s=""){this.token=t,this.owner=n,this.repo=i,this.rootPath=s}addAuthHeader(t){t.Authorization=`token ${this.token}`}getApiUrl(t){let i=this.getFullPath(t).split("/").map(encodeURIComponent).join("/");return`https://api.github.com/repos/${this.owner}/${this.repo}/contents/${i}`}getGitDataApiBase(){return`https://api.github.com/repos/${this.owner}/${this.repo}`}async getBranchHead(t){return this.getBranchHeadOid(t)}async getFile(t,n){try{let i=`${this.getApiUrl(t)}?ref=${n}`,s=await this.safeRequest(i,"GET"),o=this.parseJson(s);return o.type==="symlink"?{content:"",sha:o.sha,isSymlink:!0,symlinkTarget:o.target}:{content:this.decodeContent(o.content,t),sha:o.sha}}catch(i){return this.handleFileNotFound(i)}}async pushFile(t,n,i,s,o,a){let c=(await this.listFilesDetailed(i,!1)).find(d=>d.path===this.getFullPath(t));if(c!=null&&c.symlink)throw new Error(`Cannot overwrite symlink "${t}" with a regular file.`);let[h]=await this.pushBatch([{path:t,content:n}],i,s);return h!=null?h:{path:t}}async pushSymlink(t,n,i,s){let o=this.getFullPath(t),a=this.getGitDataApiBase(),{latestCommitSha:c,baseTreeSha:h}=await this.resolveGitHubStyleBaseTree(i),d=await this.safeRequest(`${a}/git/blobs`,"POST",{content:n,encoding:"utf-8"}),u=this.parseJson(d).sha;return await this.commitGitHubStyleTree(a,i,h,c,[{path:o,mode:$,type:"blob",sha:u}],s),{path:o,sha:u}}async githubGraphQL(t,n,i){let s=()=>this.safeRequest("https://api.github.com/graphql","POST",{query:t,variables:n}),o=i?await i.measureRequest(s):await s(),a=()=>this.parseJson(o),c=i?i.measureParsing(a):a();if(c.errors&&c.errors.length>0)throw new Error(`GitHub GraphQL error: ${c.errors.map(h=>h.message).join("; ")}`);if(!c.data)throw new Error("GitHub GraphQL response returned no data");return c.data}async getBranchHeadOid(t){var i,s,o,a;return(a=(o=(s=(i=(await this.githubGraphQL(Pi,{owner:this.owner,name:this.repo,qualifiedName:`refs/heads/${t}`})).repository)==null?void 0:i.ref)==null?void 0:s.target)==null?void 0:o.oid)!=null?a:await this.getLatestCommitSha(t)}async commitOnBranch(t,n,i,s){for(let a=1;a<=3;a++){let c=()=>this.getBranchHeadOid(t),h=s?await s.measureRequest(c):await c();try{return(await this.githubGraphQL(wi,{input:{branch:{repositoryNameWithOwner:`${this.owner}/${this.repo}`,branchName:t},message:{headline:n},expectedHeadOid:h,fileChanges:i}},s)).createCommitOnBranch.commit.oid}catch(d){let u=d instanceof Error?d.message:String(d);if(!Ri.test(u))throw d;if(a===3)throw new Error(`${u} \u2014 the remote branch "${t}" kept moving during the push (3 attempts). Pull, then push again.`);await new Promise(f=>window.setTimeout(f,500*a))}}throw new Error("commitOnBranch: exhausted retries without a result")}async pushBatch(t,n,i){if(t.length===0)return[];let s=this.pushTimingHandler?new be:void 0,o=performance.now(),a=t.map(y=>({item:y,path:this.getFullPath(y.path)})),c=t.reduce((y,N)=>y+this.getByteLength(N.content),0),h=performance.now()-o,d=performance.now(),u=a.map(({item:y,path:N})=>({path:N,contents:this.encodeContent(y.content)})),f=u.reduce((y,N)=>y+this.getByteLength(N.contents),0),p=performance.now()-d,m;try{return await this.commitOnBranch(n,i,{additions:u},s),t.map(y=>({path:y.path}))}catch(y){throw m=y,y}finally{this.emitPushTiming(s,"github-graphql",t.length,c,f,h,p,m)}}async commitBatch(t,n,i){let{writes:s,moves:o,deletions:a}=t;if(s.length===0&&o.length===0&&a.length===0)return[];let c=[...s.map(d=>({path:this.getFullPath(d.path),contents:this.encodeContent(d.content)})),...o.map(d=>({path:this.getFullPath(d.newPath),contents:this.encodeContent(d.content)}))],h=[...o.map(d=>({path:this.getFullPath(d.oldPath)})),...a.map(d=>({path:this.getFullPath(d)}))];return await this.commitOnBranch(n,i,{additions:c,deletions:h}),[...s.map(d=>({path:d.path})),...o.map(d=>({path:d.newPath}))]}async pushBatchViaGitDataApiForBenchmark(t,n,i){if(t.length===0)return[];let s=this.getGitDataApiBase(),{latestCommitSha:o,baseTreeSha:a}=await this.resolveGitHubStyleBaseTree(n),c=t.map(d=>this.getFullPath(d.path)),h=await this.mapWithConcurrency(t,Xt,async d=>{let u=await this.safeRequest(`${s}/git/blobs`,"POST",{content:this.encodeContent(d.content),encoding:"base64"});return this.parseJson(u).sha});return await this.commitGitHubStyleTree(s,n,a,o,c.map((d,u)=>({path:d,mode:"100644",type:"blob",sha:h[u]})),i),t.map((d,u)=>({path:d.path,sha:h[u]}))}getByteLength(t){return typeof t=="string"?new TextEncoder().encode(t).byteLength:t.byteLength}getErrorMessage(t){if(t!==void 0)return t instanceof Error?t.message:"Non-Error push failure"}emitPushTiming(t,n,i,s,o,a,c,h){if(!t||!this.pushTimingHandler)return;let d=this.getErrorMessage(h);this.pushTimingHandler(t.createRecord(n,i,s,o,a,c,d))}async listFilesDetailed(t,n=!0){let i=`https://api.github.com/repos/${this.owner}/${this.repo}/git/trees/${t}?recursive=1`,s;try{let a=await this.safeRequest(i,"GET");s=this.parseJson(a)}catch(a){throw this.branchNotFoundError(a,t)}if(s.truncated)throw new Error(`GitHub tree for branch "${t}" is truncated; sync stopped to avoid treating an incomplete remote tree as a snapshot.`);let o=s.tree.filter(a=>a.type==="blob").map(a=>({path:a.path,symlink:a.mode===$,sha:a.sha}));return n?o.filter(a=>{if(!this.rootPath)return!0;let c=this.rootPath.endsWith("/")?this.rootPath:`${this.rootPath}/`;return a.path===this.rootPath||a.path.startsWith(c)}):o}async getBlob(t,n){return this.fetchGitHubStyleBlob(`https://api.github.com/repos/${this.owner}/${this.repo}/git/blobs/${t}`,n)}async deleteFile(t,n,i){let s=await this.getFile(t,n);if(!s.sha)throw new Error(`Cannot delete "${t}": file was not found on branch "${n}".`);let o=this.getApiUrl(t),a={message:i,sha:s.sha,branch:n};await this.safeRequest(o,"DELETE",a)}async deleteBatch(t,n,i){t.length!==0&&await this.commitOnBranch(n,i,{deletions:t.map(s=>({path:this.getFullPath(s)}))})}async testConnection(t){try{let n=`https://api.github.com/repos/${this.owner}/${this.repo}`;await this.safeRequest(n,"GET")}catch(n){return{repoOk:!1,branchOk:!1,error:n instanceof Error?n.message:String(n)}}try{let n=`https://api.github.com/repos/${this.owner}/${this.repo}/branches/${t}`;return await this.safeRequest(n,"GET",void 0,void 0,!0),{repoOk:!0,branchOk:!0}}catch(n){return{repoOk:!0,branchOk:!1}}}};var Pe=class extends D{constructor(){super(...arguments);this.baseUrl="";this.owner="";this.repo=""}updateConfig(t,n,i,s,o=""){this.baseUrl=t.endsWith("/")?t.slice(0,-1):t,this.token=n,this.owner=i,this.repo=s,this.rootPath=o}addAuthHeader(t){t.Authorization=`token ${this.token}`}getApiUrl(t){let i=this.getFullPath(t).split("/").map(encodeURIComponent).join("/");return`${this.baseUrl}/api/v1/repos/${this.owner}/${this.repo}/contents/${i}`}async changeFiles(t,n,i){let s=`${this.baseUrl}/api/v1/repos/${this.owner}/${this.repo}/contents`,o=await this.safeRequest(s,"POST",{branch:n,message:i,files:t});return this.parseJson(o)}async getFile(t,n){try{let i=`${this.getApiUrl(t)}?ref=${n}`,s=await this.safeRequest(i,"GET"),o=this.parseJson(s);return{content:this.decodeContent(o.content,t),sha:o.sha}}catch(i){return this.handleFileNotFound(i)}}async pushFile(t,n,i,s,o,a){let c=this.getApiUrl(t),h={message:s,content:this.encodeContent(n),branch:i};o&&(h.sha=o);let d=o?"PUT":"POST",u=await this.safeRequest(c,d,h),f=this.parseJson(u);return{path:f.content.path,sha:f.content.sha}}async pushBatch(t,n,i){if(t.length===0)return[];let s=t.map(a=>({operation:a.existedRemotely?"update":"create",path:this.getFullPath(a.path),content:this.encodeContent(a.content)})),o=await this.changeFiles(s,n,i);return t.map((a,c)=>{var h;return{path:a.path,sha:(h=o.files[c])==null?void 0:h.sha}})}async commitBatch(t,n,i){let{writes:s,moves:o,deletions:a}=t;if(s.length===0&&o.length===0&&a.length===0)return[];let c=[...s.map(d=>({operation:d.existedRemotely?"update":"create",path:this.getFullPath(d.path),content:this.encodeContent(d.content)})),...o.map(d=>({operation:"update",path:this.getFullPath(d.newPath),from_path:this.getFullPath(d.oldPath),content:this.encodeContent(d.content)})),...a.map(d=>({operation:"delete",path:this.getFullPath(d)}))],h=await this.changeFiles(c,n,i);return[...s.map((d,u)=>{var f;return{path:d.path,sha:(f=h.files[u])==null?void 0:f.sha}}),...o.map((d,u)=>{var f;return{path:d.newPath,sha:(f=h.files[s.length+u])==null?void 0:f.sha}})]}async listFilesDetailed(t,n=!0){let i=`${this.baseUrl}/api/v1/repos/${this.owner}/${this.repo}/branches/${t}`,s;try{let d=await this.safeRequest(i,"GET");s=this.parseJson(d).commit.id}catch(d){throw this.branchNotFoundError(d,t)}let o=`${this.baseUrl}/api/v1/repos/${this.owner}/${this.repo}/git/trees/${s}?recursive=1`,a=await this.safeRequest(o,"GET"),c=this.parseJson(a);if(c.truncated)throw new Error(`Gitea tree for branch "${t}" is truncated; sync stopped to avoid treating an incomplete remote tree as a snapshot.`);let h=c.tree.filter(d=>d.type==="blob").map(d=>({path:d.path,symlink:d.mode===$,sha:d.sha}));return n?h.filter(d=>{if(!this.rootPath)return!0;let u=this.rootPath.endsWith("/")?this.rootPath:`${this.rootPath}/`;return d.path===this.rootPath||d.path.startsWith(u)}):h}async getBlob(t,n){return this.fetchGitHubStyleBlob(`${this.baseUrl}/api/v1/repos/${this.owner}/${this.repo}/git/blobs/${t}`,n)}async deleteFile(t,n,i){let s=await this.getFile(t,n);if(!s.sha)throw new Error(`Cannot delete "${t}": file was not found on branch "${n}".`);let o=this.getApiUrl(t),a={message:i,sha:s.sha,branch:n};await this.safeRequest(o,"DELETE",a)}async deleteBatch(t,n,i){if(t.length===0)return;let s=t.map(o=>({operation:"delete",path:this.getFullPath(o)}));await this.changeFiles(s,n,i)}async testConnection(t){try{let n=`${this.baseUrl}/api/v1/repos/${this.owner}/${this.repo}`;await this.safeRequest(n,"GET")}catch(n){return{repoOk:!1,branchOk:!1,error:n instanceof Error?n.message:String(n)}}try{let n=`${this.baseUrl}/api/v1/repos/${this.owner}/${this.repo}/branches/${t}`;return await this.safeRequest(n,"GET",void 0,void 0,!0),{repoOk:!0,branchOk:!0}}catch(n){return{repoOk:!0,branchOk:!1}}}};var I=require("obsidian");var R=require("obsidian");var g={synced:"check",modified:"pencil",addition:"file-plus",push:"arrow-up",pull:"arrow-down",download:"download",checking:"refresh-cw",refresh:"refresh-cw",delete:"trash-2",diff:"file-diff",diffOpen:"chevron-up",moved:"move",revert:"undo-2",error:"alert-triangle",chevronRight:"chevron-right",chevronDown:"chevron-down",back:"arrow-left",search:"search",clear:"x",branch:"git-branch",folder:"folder",diffSplit:"columns-2",diffUnified:"rows-2",viewTree:"folder-tree",viewList:"list",rowMenu:"more-horizontal",addToQueue:"list-plus",openRemote:"external-link"};var Fe=require("obsidian");var Re=require("obsidian");function Zt(r,e,t){let n=r.createEl("button",{cls:"scv-diff-layout-toggle"}),i=e==="split"?"unified":"split";return(0,Re.setIcon)(n.createSpan({cls:"scv-diff-layout-toggle-icon"}),i==="split"?g.diffSplit:g.diffUnified),n.createSpan({cls:"scv-diff-layout-toggle-label",text:i==="split"?l("sourceControl.diff.split"):l("sourceControl.diff.unified")}),(0,Re.setTooltip)(n,i==="split"?l("sourceControl.diff.switchToSplit"):l("sourceControl.diff.switchToUnified")),n.addEventListener("click",()=>t(i)),n}function ke(r,e){let t=en(r).split(`
|
|
`),n=en(e).split(`
|
|
`),i=t.length,s=n.length;if(i*s>25e4||(i+1)*(s+1)>1e6)return Ii(t,n);let o=ki(t,n,i,s),a=Ti(t,n,o,i,s);return Ei(a,t,n)}function en(r){return r.replace(/\r\n/g,`
|
|
`).replace(/\r/g,`
|
|
`)}function ki(r,e,t,n){let i=n+1,s=new Uint32Array((t+1)*i);for(let o=1;o<=t;o++)for(let a=1;a<=n;a++)s[o*i+a]=r[o-1]===e[a-1]?s[(o-1)*i+(a-1)]+1:Math.max(s[(o-1)*i+a],s[o*i+(a-1)]);return s}function Ti(r,e,t,n,i){let s=i+1,o=[],a=n,c=i;for(;a>0||c>0;){let h=xi(r,e,t,s,a,c);o.push(h),[a,c]=Fi(h,a,c)}return o.reverse()}function Fi(r,e,t){return r.type==="unchanged"?[e-1,t-1]:r.type==="added"?[e,t-1]:[e-1,t]}function xi(r,e,t,n,i,s){return i>0&&s>0&&r[i-1]===e[s-1]?{type:"unchanged",li:i-1,ri:s-1}:s>0&&(i===0||t[i*n+(s-1)]>=t[(i-1)*n+s])?{type:"added",li:-1,ri:s-1}:{type:"removed",li:i-1,ri:-1}}function Ei(r,e,t){let n=[],i=0;for(;i<r.length;){let s=r[i];if(!s)break;if(s.type==="unchanged")n.push(Mi(s,e,t)),i++;else{let o=Ai(r,i);n.push(...Di(o,e,t)),i+=o.length}}return n}function Mi(r,e,t){var n,i;return{left:{lineNum:r.li+1,content:(n=e[r.li])!=null?n:null,type:"unchanged"},right:{lineNum:r.ri+1,content:(i=t[r.ri])!=null?i:null,type:"unchanged"}}}function Ai(r,e){let t=[],n=e;for(;n<r.length;){let i=r[n];if(!i||i.type==="unchanged")break;t.push(i),n++}return t}function Di(r,e,t){let n=r.filter(a=>a.type==="removed").map(a=>a.li),i=r.filter(a=>a.type==="added").map(a=>a.ri),s=Math.max(n.length,i.length),o=[];for(let a=0;a<s;a++)o.push({left:tn(n[a],e,"removed"),right:tn(i[a],t,"added")});return o}function tn(r,e,t){var n;return r===void 0?{lineNum:null,content:null,type:"empty"}:{lineNum:r+1,content:(n=e[r])!=null?n:null,type:t}}function Ii(r,e){let t=[],n=Math.max(r.length,e.length);for(let i=0;i<n;i++){let s=r[i],o=e[i];s===void 0?t.push({left:{lineNum:null,content:null,type:"empty"},right:{lineNum:i+1,content:o!=null?o:null,type:"added"}}):o===void 0?t.push({left:{lineNum:i+1,content:s,type:"removed"},right:{lineNum:null,content:null,type:"empty"}}):s===o?t.push({left:{lineNum:i+1,content:s,type:"unchanged"},right:{lineNum:i+1,content:o,type:"unchanged"}}):t.push({left:{lineNum:i+1,content:s,type:"removed"},right:{lineNum:i+1,content:o,type:"added"}})}return t}function bt(r,e,t){var o,a,c;let n=ke(e,t),i=r.createDiv({cls:"ssv-diff-split"}).createDiv({cls:"ssv-diff-grid"});i.createDiv({cls:"ssv-diff-hd",text:l("diffPanel.remote")}),i.createDiv({cls:"ssv-diff-hd",text:l("diffPanel.local")});for(let h of n)nn(i,h.left),nn(i,h.right);let s=r.createEl("pre",{cls:"ssv-diff-unified"});for(let{left:h,right:d}of n)h.type==="removed"&&(s.createSpan({cls:"ssv-u-line removed"}).textContent=`- ${(o=h.content)!=null?o:""}
|
|
`),d.type==="added"&&(s.createSpan({cls:"ssv-u-line added"}).textContent=`+ ${(a=d.content)!=null?a:""}
|
|
`),h.type==="unchanged"&&(s.createSpan({cls:"ssv-u-line unchanged"}).textContent=` ${(c=h.content)!=null?c:""}
|
|
`)}function nn(r,e){let t=r.createDiv({cls:`ssv-diff-cell ${e.type}`});t.createSpan({cls:"ssv-diff-ln"}).textContent=e.lineNum===null?"":String(e.lineNum),e.content!==null&&(t.createSpan({cls:"ssv-diff-code"}).textContent=e.content)}function Li(){return Fe.Platform.isMobile?"unified":"split"}var Te;function W(){return Te!=null?Te:Li()}function Q(r){Te=r}function j(r,e){let t=Fe.Platform.isPhone?"unified":e.layout,n=r.createDiv({cls:`scv-diff-tab-body scv-diff-layout-${t}`});e.remote!==void 0&&e.local!==void 0&&bt(n,e.remote,e.local);let i=e.toggleHost;if(i&&!Fe.Platform.isPhone){let s=o=>{i.empty(),Zt(i,o,a=>{var c;Bi(n,a),(c=e.onLayoutChange)==null||c.call(e,a),s(a)})};s(t)}return{setContent(s,o){n.empty(),bt(n,s,o)}}}function Bi(r,e){r.removeClass("scv-diff-layout-split"),r.removeClass("scv-diff-layout-unified"),r.addClass(`scv-diff-layout-${e}`)}var xe=class xe{constructor(e,t,n=()=>!1){this.loadDiffStat=e;this.settle=t;this.isPriority=n;this.cache=new Map;this.queued=new Map;this.active=new Map;this.physicalInFlight=0;this.nextRequestToken=0;this.disposed=!1;this.globalGeneration=0;this.generations=new Map;this.settleScheduled=!1}get(e){let t=this.cache.get(e);return(t==null?void 0:t.state)==="ready"?t.stat:void 0}dispose(){this.clear(),this.disposed=!0}clear(){this.globalGeneration++,this.cache.clear(),this.queued.clear(),this.active.clear(),this.generations.clear()}invalidate(e){var t;this.generations.set(e,((t=this.generations.get(e))!=null?t:0)+1),this.cache.delete(e),this.queued.delete(e),this.active.delete(e)}loadVisible(e){if(!(!this.loadDiffStat||this.disposed)){for(let t of e)this.cache.has(t.id)||this.active.has(t.id)||this.queued.has(t.id)||this.queued.set(t.id,t);this.pump()}}async lazyLoad(e){var n;if(!this.loadDiffStat||this.disposed||this.cache.has(e.id)||this.active.has(e.id))return;let t={token:++this.nextRequestToken,globalGeneration:this.globalGeneration,itemGeneration:(n=this.generations.get(e.id))!=null?n:0};this.active.set(e.id,t),this.physicalInFlight++;try{let i=await this.loadDiffStat(e);this.isStale(e.id,t.globalGeneration,t.itemGeneration)||this.commit(e.id,i)}catch(i){}finally{this.finish(e.id,t)}}pump(){var e;if(!this.disposed)for(;this.physicalInFlight<xe.MAX_CONCURRENT&&this.queued.size>0;){let t=this.takeNext();if(!t)break;let n={token:++this.nextRequestToken,globalGeneration:this.globalGeneration,itemGeneration:(e=this.generations.get(t.id))!=null?e:0};this.active.set(t.id,n),this.physicalInFlight++,this.run(t,n)}}takeNext(){for(let n of this.queued.values())if(this.isPriority(n))return this.queued.delete(n.id),n;let e=this.queued.values().next();if(e.done)return;let t=e.value;return this.queued.delete(t.id),t}async run(e,t){try{let n=await this.loadDiffStat(e);this.isStale(e.id,t.globalGeneration,t.itemGeneration)||this.commit(e.id,n)}catch(n){}finally{this.finish(e.id,t)}}finish(e,t){var n;((n=this.active.get(e))==null?void 0:n.token)===t.token&&this.active.delete(e),this.physicalInFlight--,this.pump()}isStale(e,t,n){var i;return t!==this.globalGeneration||n!==((i=this.generations.get(e))!=null?i:0)}commit(e,t){this.disposed||(t.status==="ready"?(this.cache.set(e,{state:"ready",stat:t.stat}),this.settleOnce()):t.status==="unavailable"&&this.cache.set(e,{state:"unavailable"}))}settleOnce(){this.settleScheduled||(this.settleScheduled=!0,queueMicrotask(()=>{this.settleScheduled=!1,this.settle()}))}};xe.MAX_CONCURRENT=4;var J=xe;var Ee=[{id:"all",filter:"all",showSynced:!0,labelKey:"sourceControl.filter.all",count:r=>r.all+r.synced},{id:"needsSync",filter:"all",showSynced:!1,labelKey:"sourceControl.filter.needsSync",count:r=>r.all},{id:"remote",filter:"remote-changes",showSynced:!1,labelKey:"sourceControl.filter.remote",count:r=>r["remote-changes"]},{id:"synced",filter:"synced",showSynced:!0,labelKey:"sourceControl.filter.synced",count:r=>r.synced}];function sn(r,e){return Ee.find(t=>t.filter===r&&t.showSynced===e)}function on(r,e,t,n,i={}){var a;let s=r.createDiv({cls:"scv-filter-menu"});if(i.isMobile){Gi(s,e,t,n);return}let o=(a=sn(e.filter,e.showSynced))==null?void 0:a.id;for(let c of Ee){let h=c.id===o,d=s.createEl("button",{cls:`scv-filter-option${h?" is-active":""}`});d.setAttr("data-filter",c.id),d.setAttr("aria-pressed",String(h)),d.createSpan({cls:"scv-filter-label",text:l(c.labelKey)}),d.createSpan({cls:"scv-filter-count",text:String(c.count(t))}),d.addEventListener("click",()=>n.onFilterChange(c.filter,c.showSynced))}}function Gi(r,e,t,n){var o;let i=(o=sn(e.filter,e.showSynced))==null?void 0:o.id,s=r.createEl("select",{cls:"scv-filter-dropdown"});for(let a of Ee){let c=s.createEl("option",{value:a.id});c.textContent=`${l(a.labelKey)} (${a.count(t)})`,a.id===i&&c.setAttr("selected","selected")}s.addEventListener("change",()=>{let a=Ee.find(c=>c.id===s.value);a&&n.onFilterChange(a.filter,a.showSynced)})}var M=require("obsidian");var Me=require("obsidian");function rn(r,e,t){let n=r.createEl("button",{cls:"scv-push-btn"});return(0,Me.setIcon)(n.createSpan(),g.push),n.createSpan({cls:"scv-push-btn-label",text:l("sourceControl.push",{count:e})}),n.disabled=e===0,(0,Me.setTooltip)(n,l("sourceControl.push.tooltip",{count:e})),n.addEventListener("click",t),n}function an(r,e,t,n={}){let i=r.createDiv({cls:"scv-header"}),s=i.createDiv({cls:"scv-header-title-row"});n.showPush!==!1&&rn(s,e.readyToPushCount,t.onPush),Ni(s,e.refreshStatus,t.onRefresh),Oi(i,e.workspaceInfo)}function Ni(r,e,t){let n=r.createEl("button",{cls:`scv-refresh-btn is-${e}`});n.setAttr("aria-label",l("sourceControl.refresh.tooltip")),(0,M.setIcon)(n.createSpan({cls:"scv-refresh-btn-icon"}),g.refresh);let i=n.createSpan({cls:"scv-refresh-btn-label"});e==="loading"?(i.textContent=l("sourceControl.refresh.refreshing"),n.disabled=!0):e==="failed"?(i.textContent=l("sourceControl.refresh.failed"),(0,M.setTooltip)(n,l("sourceControl.refresh.failed"))):(i.textContent="",(0,M.setTooltip)(n,l("sourceControl.refresh.tooltip"))),e==="idle"&&i.addClass("is-hidden"),n.addEventListener("click",()=>{e!=="loading"&&t()})}function Oi(r,e){let t=r.createDiv({cls:"scv-info"});if(t.createSpan({cls:"scv-info-item",text:e.serviceName}),!M.Platform.isMobile){t.createSpan({cls:"scv-info-sep",text:"\xB7"});let n=t.createSpan({cls:"scv-info-item"});(0,M.setIcon)(n.createSpan({cls:"scv-info-icon"}),g.branch),n.createSpan({text:` ${e.branch}`})}if(e.vaultFolder){t.createSpan({cls:"scv-info-sep",text:"\xB7"});let n=t.createSpan({cls:"scv-info-item"});(0,M.setIcon)(n.createSpan({cls:"scv-info-icon"}),g.folder),n.createSpan({text:` ${e.vaultFolder}`})}if(e.lastCheckedAt>0){t.createSpan({cls:"scv-info-sep",text:"\xB7"});let n=Date.now()-e.lastCheckedAt;t.createSpan({cls:"scv-info-time",text:n<6e4?l("sourceControl.info.justChecked"):l("sourceControl.info.lastChecked",{time:new Date(e.lastCheckedAt).toLocaleTimeString()})})}}var yn=require("obsidian");var P=require("obsidian");var cn=require("obsidian");var $i={running:"sourceControl.op.syncing",success:"sourceControl.op.synced",failed:"sourceControl.op.failed"};function ln(r,e){if(e==="idle")return;let t=r.createSpan({cls:`scv-op-indicator scv-op-${e}`});return(0,cn.setIcon)(t.createSpan({cls:"scv-op-icon"}),Hi(e)),t.createSpan({cls:"scv-op-label",text:l($i[e])}),t}function Hi(r){return r==="running"?g.checking:r==="success"?g.synced:g.error}var _i={"local-only":"sourceControl.status.added","local-modified":"sourceControl.status.modified","local-deleted":"sourceControl.status.deletedLocally","remote-only":"sourceControl.status.remoteAvailable","remote-modified":"sourceControl.status.modifiedRemotely",moved:"sourceControl.status.renamed",conflict:"sourceControl.status.conflict",synced:"sourceControl.status.synced"},Vi={"local-only":{letter:"A",cls:"local-only"},"local-modified":{letter:"M",cls:"local-modified"},"local-deleted":{letter:"D",cls:"local-deleted"},"remote-only":{letter:"\u2193",cls:"remote-only"},"remote-modified":{letter:"\u2195",cls:"remote-modified"},moved:{letter:"R",cls:"moved"},conflict:{letter:"!",cls:"conflict"},synced:{letter:"S",cls:"synced"}};function dn(r,e){var n;let t={badge:Vi[r.kind],subtitle:l(_i[r.kind]),displayName:e};return r.previousPath&&(t.renameFrom=(n=r.previousPath.split("/").pop())!=null?n:r.previousPath),r.kind==="remote-only"&&(t.tooltip=l("sourceControl.status.remoteAvailable.tooltip")),r.kind==="local-deleted"&&(t.tooltip=l("sourceControl.status.deletedLocally.tooltip")),t}var hn={"local-only":"push","local-modified":"push","local-deleted":"delete-remote","remote-only":"pull","remote-modified":"pull",moved:"push",conflict:"push",synced:"push"},un={"local-only":["push"],"local-modified":["push","pull"],"local-deleted":["delete-remote","pull"],"remote-only":["pull","delete-remote"],"remote-modified":["pull","push"],moved:["push"],conflict:["push"],synced:["push"]};function pn(r){return hn[r]}function fn(r){return un[r]}function Y(r,e){return e&&un[r].includes(e)?e:hn[r]}function gn(r){return r==="remote-only"||r==="remote-modified"||r==="local-deleted"}function _(r,e,t,n,i={}){var d;let s=dn(e,t),o=r.createDiv({cls:`scv-change-item scv-kind-${e.kind}${e.isSelectedForSync?" is-selected":""}${i.listMode?" scv-change-item-list":""}`});o.setAttr("data-change-id",e.id),s.tooltip&&o.setAttr("title",s.tooltip);let a=o.createEl("input",{type:"checkbox",cls:"scv-change-select"});a.checked=e.isSelectedForSync,a.addEventListener("change",()=>n.onToggleSelect(e.id,a.checked));let c=o.createSpan({cls:`scv-badge scv-badge-${s.badge.cls}`,text:s.badge.letter});(0,P.setTooltip)(c,s.subtitle);let h=o.createDiv({cls:"scv-change-name"});return s.renameFrom&&(h.createSpan({cls:"scv-change-rename-from",text:s.renameFrom}),(0,P.setIcon)(h.createSpan({cls:"scv-change-rename-arrow"}),g.moved)),h.createSpan({cls:"scv-change-name-text",text:s.displayName}),i.listMode&&i.folderPath&&o.createSpan({cls:"scv-change-path",text:i.folderPath}),Pt(o,(d=n.getDiffStat)==null?void 0:d.call(n,e.id)),i.showActionControl&&n.onChangeSyncAction?Ui(o,e,n):gn(e.kind)&&n.onDownload&&qi(o,e,n.onDownload),!i.showActionControl&&n.onRowAction&&Ki(o,e,n),ln(o,e.operationStatus),o.addEventListener("click",u=>{u.target!==a&&n.onOpenDiff(e)}),o}function qi(r,e,t){let n=r.createEl("button",{cls:"scv-change-download",attr:{type:"button"}});(0,P.setIcon)(n.createSpan({cls:"scv-change-download-icon"}),g.download),n.createSpan({cls:"scv-change-download-label",text:l("sourceControl.action.download")}),(0,P.setTooltip)(n,l("sourceControl.action.download.tooltip")),n.addEventListener("click",i=>{i.stopPropagation(),t(e)})}function mn(r){return r==="pull"?g.pull:r==="delete-remote"?g.delete:g.push}function wt(r){return r==="pull"?l("sourceControl.queue.action.pull"):r==="delete-remote"?l("sourceControl.queue.action.deleteRemote"):l("sourceControl.queue.action.push")}function Ui(r,e,t){let n=r.createEl("button",{cls:"scv-change-action",attr:{type:"button"}});(0,P.setIcon)(n.createSpan({cls:"scv-change-action-icon"}),mn(e.syncAction)),n.createSpan({cls:"scv-change-action-label",text:wt(e.syncAction)}),(0,P.setTooltip)(n,wt(e.syncAction)),n.addEventListener("click",i=>{i.stopPropagation();let s=new P.Menu;for(let o of fn(e.kind))s.addItem(a=>{a.setTitle(wt(o)).setIcon(mn(o)).setChecked(o===e.syncAction).onClick(()=>{var c;return(c=t.onChangeSyncAction)==null?void 0:c.call(t,e,o)})});s.addSeparator(),s.addItem(o=>{o.setTitle(l("sourceControl.queue.menu.viewDiff")).setIcon(g.diff).onClick(()=>t.onOpenDiff(e))}),s.addItem(o=>{o.setTitle(l("sourceControl.queue.menu.removeFromQueue")).setIcon(g.clear).onClick(()=>t.onToggleSelect(e.id,!1))}),s.showAtMouseEvent(i)})}function zi(r){switch(r){case"local-only":return[{kind:"action",action:"push",labelKey:"sourceControl.row.menu.pushLocal",icon:g.push},{kind:"add-to-queue"},{kind:"action",action:"delete-local",labelKey:"sourceControl.row.menu.deleteLocalEllipsis",icon:g.delete}];case"local-modified":return[{kind:"action",action:"push",labelKey:"sourceControl.row.menu.pushLocal",icon:g.push},{kind:"action",action:"pull",labelKey:"sourceControl.row.menu.useRemoteEllipsis",icon:g.pull},{kind:"view-diff"},{kind:"add-to-queue"},{kind:"action",action:"delete-local",labelKey:"sourceControl.row.menu.deleteLocalEllipsis",icon:g.delete}];case"remote-modified":return[{kind:"action",action:"pull",labelKey:"sourceControl.row.menu.useRemote",icon:g.pull},{kind:"action",action:"push",labelKey:"sourceControl.row.menu.pushLocalEllipsis",icon:g.push},{kind:"view-diff"},{kind:"add-to-queue"}];case"remote-only":return[{kind:"action",action:"pull",labelKey:"sourceControl.action.download",icon:g.download},{kind:"action",action:"delete-remote",labelKey:"sourceControl.row.menu.deleteRemoteEllipsis",icon:g.delete},{kind:"add-to-queue"},{kind:"open-remote"}];case"local-deleted":return[{kind:"action",action:"delete-remote",labelKey:"sourceControl.row.menu.deleteRemote",icon:g.delete},{kind:"action",action:"pull",labelKey:"sourceControl.row.menu.restoreLocal",icon:g.pull}];case"moved":return[{kind:"action",action:"push",labelKey:"sourceControl.row.menu.pushLocal",icon:g.push},{kind:"add-to-queue"}];case"conflict":case"synced":return[]}}function Ki(r,e,t){let n=zi(e.kind);if(n.length===0)return;let i=r.createEl("button",{cls:"scv-change-menu",attr:{type:"button"}});(0,P.setIcon)(i,g.rowMenu),(0,P.setTooltip)(i,l("sourceControl.row.menu.tooltip")),i.addEventListener("click",s=>{s.stopPropagation();let o=new P.Menu;for(let a of n)o.addItem(c=>{a.kind==="action"?c.setTitle(l(a.labelKey)).setIcon(a.icon).onClick(()=>{var h;return(h=t.onRowAction)==null?void 0:h.call(t,e,a.action)}):a.kind==="view-diff"?c.setTitle(l("sourceControl.row.menu.viewDiff")).setIcon(g.diff).onClick(()=>t.onOpenDiff(e)):a.kind==="add-to-queue"?c.setTitle(l("sourceControl.row.menu.addToQueue")).setIcon(g.addToQueue).onClick(()=>t.onToggleSelect(e.id,!0)):c.setTitle(l("sourceControl.row.menu.openRemote")).setIcon(g.openRemote).onClick(()=>{var h;return(h=t.onOpenRemote)==null?void 0:h.call(t,e)})});o.showAtMouseEvent(s)})}function Pt(r,e){if(!e)return;let t=e.additions>0,n=e.deletions>0;if(!t&&!n)return;let i=r.createSpan({cls:"scv-diff-stat"});t&&i.createSpan({cls:"scv-diff-stat-add",text:`+${e.additions}`}),t&&n&&i.createSpan({cls:"scv-diff-stat-sep",text:" "}),n&&i.createSpan({cls:"scv-diff-stat-del",text:`-${e.deletions}`})}function Sn(r,e,t,n){let{syncQueue:i}=e;if(i.length===0)return;let s=e.isMobile?e.mobileCollapsed:e.collapsed,o=r.createDiv({cls:"scv-selected-section"}),a=o.createDiv({cls:"scv-selected-section-header scv-collapsible-header"});a.setAttr("role","button"),a.setAttr("aria-expanded",String(!s)),a.createSpan({cls:"scv-section-toggle",text:s?"\u25B6":"\u25BC"}),a.createSpan({cls:"scv-selected-section-title",text:l("sourceControl.section.selectedForSync")});let c=a.createEl("button",{cls:"scv-selected-section-clear",attr:{type:"button"}});if(c.createSpan({cls:"scv-selected-section-clear-label",text:l("sourceControl.section.clearSelection")}),(0,yn.setTooltip)(c,l("sourceControl.section.clearSelection.tooltip")),c.addEventListener("click",y=>{y.stopPropagation(),n.onClearSelection(i)}),a.addEventListener("click",()=>n.onToggleCollapsed()),s)return;o.createDiv({cls:"scv-selected-section-subtitle",text:l("sourceControl.section.queueSubtitle",{count:i.length})});let h=o.createDiv({cls:"scv-selected-section-list"}),d=i.filter(y=>y.syncAction==="push"),u=i.filter(y=>y.syncAction==="pull"),f=i.filter(y=>y.syncAction==="delete-remote"),m=[d,u,f].filter(y=>y.length>0).length>1;m&&d.length>0&&h.createDiv({cls:"scv-queue-group-label",text:l("sourceControl.queue.upload")});for(let y of d)_(h,y,Rt(y.path),t,{showActionControl:!0});m&&u.length>0&&h.createDiv({cls:"scv-queue-group-label",text:l("sourceControl.queue.download")});for(let y of u)_(h,y,Rt(y.path),t,{showActionControl:!0});m&&f.length>0&&h.createDiv({cls:"scv-queue-group-label",text:l("sourceControl.queue.delete")});for(let y of f)_(h,y,Rt(y.path),t,{showActionControl:!0})}function Rt(r){let e=r.lastIndexOf("/");return e===-1?r:r.slice(e+1)}var Pn=require("obsidian");var Wi={maxDepth:Number.POSITIVE_INFINITY,collapseSingleChild:!1},Ae=class{build(e,t={}){let n={...Wi,...t},i={type:"folder",name:"",path:"",children:[]};for(let o of e)this.insert(i,o);return this.collapseAndLimit(i.children,n,0)}insert(e,t){let n=t.path.split("/").filter(Boolean),i=n.pop();if(!i)return;let s=e,o="";for(let a of n)o=o?`${o}/${a}`:a,s=this.getOrCreateFolder(s,a,o);s.children.push({type:"file",id:t.id,name:i,path:t.path,previousPath:t.previousPath,kind:t.kind})}getOrCreateFolder(e,t,n){let i=e.children.find(o=>o.type==="folder"&&o.name===t);if(i)return i;let s={type:"folder",name:t,path:n,children:[]};return e.children.push(s),s}collapseAndLimit(e,t,n){let i=[];for(let s of e){if(s.type==="file"){i.push(s);continue}let o=this.collapseSingleChildRun(s,t);if(n>=t.maxDepth){i.push(this.flattenFolder(o));continue}o.children=this.collapseAndLimit(o.children,t,n+1),i.push(o)}return i}collapseSingleChildRun(e,t){if(!t.collapseSingleChild)return e;let n=e,i=n.children[0];for(;n.children.length===1&&i&&i.type==="folder";)n=this.mergeFolders(n,i),i=n.children[0];return n}mergeFolders(e,t){return{type:"folder",name:`${e.name}/${t.name}`,path:t.path,children:t.children}}flattenFolder(e){let t=this.collectFiles(e);return{type:"folder",name:e.name,path:e.path,children:t}}collectFiles(e){let t=[];for(let n of e.children)n.type==="file"?t.push(n):t.push(...this.collectFiles(n));return t}};var Qi=new Ae;function vn(r,e,t,n,i={}){let s=new Map(e.map(a=>[a.id,a])),o=Qi.build(e,i);bn(r,o,s,t,n,i)}function Cn(r,e,t){let n=r.createDiv({cls:"scv-change-list"}),i=[...e].sort((s,o)=>s.path.localeCompare(o.path));for(let s of i){let o=s.path.lastIndexOf("/"),a=o===-1?s.path:s.path.slice(o+1),c=o===-1?"":s.path.slice(0,o);_(n,s,a,t,{folderPath:c,listMode:!0})}}function bn(r,e,t,n,i,s){for(let o of e)o.type==="folder"?ji(r,o,t,n,i,s):Ji(r,o,t,i)}function ji(r,e,t,n,i,s){let o=n.has(e.path),a=r.createDiv({cls:"scv-tree-folder"}),c=a.createDiv({cls:"scv-tree-folder-row"});c.setAttr("role","button"),c.setAttr("aria-expanded",String(!o));let h=wn(e),d=h.filter(p=>{var m;return(m=t.get(p))==null?void 0:m.isSelectedForSync}).length,u=c.createEl("input",{type:"checkbox",cls:"scv-tree-folder-select"});u.setAttr("title",l("sourceControl.folder.selectAll")),u.checked=h.length>0&&d===h.length,u.indeterminate=d>0&&d<h.length,u.addEventListener("click",p=>p.stopPropagation()),u.addEventListener("change",()=>i.onToggleFolderSelect(h,u.checked));let f=c.createEl("button",{cls:"scv-tree-folder-toggle"});if(f.setAttr("aria-hidden","true"),f.setText(o?"\u25B6":"\u25BC"),f.addEventListener("click",p=>{p.stopPropagation(),i.onToggleFolder(e.path)}),c.createSpan({cls:"scv-tree-folder-name",text:e.name}),c.addEventListener("click",p=>{p.target!==u&&i.onToggleFolder(e.path)}),!o){let p=a.createDiv({cls:"scv-tree-children"});bn(p,e.children,t,n,i,s)}}function Ji(r,e,t,n){let i=t.get(e.id);i&&_(r,i,e.name,n)}function wn(r){let e=[];for(let t of r.children)t.type==="file"?e.push(t.id):e.push(...wn(t));return e}var Yi={collapseSingleChild:!0},Xi={collapseSingleChild:!0,maxDepth:2};function Rn(r,e,t,n){if(Zi(r,e,n),e.collapsed)return;let i=r.createDiv({cls:"scv-changes-tree"});e.items.length===0?i.createDiv({cls:"scv-empty",text:l("sourceControl.empty")}):e.viewMode==="list"?Cn(i,e.items,t):vn(i,e.items,e.collapsedFolders,t,e.isMobile?Xi:Yi)}function Zi(r,e,t){let n=r.createDiv({cls:"scv-repository-header scv-collapsible-header"});n.setAttr("role","button"),n.setAttr("aria-expanded",String(!e.collapsed)),n.createSpan({cls:"scv-section-toggle",text:e.collapsed?"\u25B6":"\u25BC"}),n.createSpan({cls:"scv-repository-title",text:l("sourceControl.section.repositoryChanges")}),n.createSpan({cls:"scv-repository-count",text:String(e.items.length)}),n.addEventListener("click",()=>t.onToggleCollapsed()),es(n,e,t)}function es(r,e,t){let n=r.createDiv({cls:"scv-view-toggle"});n.setAttr("role","group"),n.setAttr("aria-label",l("sourceControl.view.toggleLabel"));for(let i of["tree","list"]){let s=e.viewMode===i,o=n.createEl("button",{cls:`scv-view-toggle-btn${s?" is-active":""}`});o.setAttr("data-view",i),o.setAttr("aria-pressed",String(s)),o.setAttr("title",i==="tree"?l("sourceControl.view.tree"):l("sourceControl.view.list")),(0,Pn.setIcon)(o.createSpan({cls:"scv-view-toggle-icon"}),i==="tree"?g.viewTree:g.viewList),o.createSpan({cls:"scv-view-toggle-label",text:i==="tree"?l("sourceControl.view.tree"):l("sourceControl.view.list")}),o.addEventListener("click",a=>{a.stopPropagation(),t.onSetViewMode(i)})}}var Ie=class Ie{constructor(e,t,n){this.viewModel=e;this.callbacks=t;this.getWorkspaceInfo=n;this.filter="all";this.showSynced=!1;this.searchQuery="";this.viewMode="tree";this.collapsedFolders=new Set;this.collapsedSections=new Set;this.mobileQueueCollapsed=!1;this.selectedChangeId=null;this.mainScrollState={repository:0,queue:0};this.restoreNavigationScrollOnNextRender=!1;this.navigationAnchorId=null;this.applySearchDebounced=(0,R.debounce)(e=>this.applySearch(e),150,!1);this.diffStat=new J(t.loadDiffStat,()=>this.rerender(),i=>i.kind==="local-only")}render(e){let t=this.captureScrollState(e);this.container=e,e.empty(),e.addClass("scv-root"),e.addClass("gfs-diff-surface");let n=R.Platform.isMobile;if(e.toggleClass("scv-mobile",n),e.toggleClass("scv-desktop",!n),n&&this.selectedChangeId!==null){this.renderDetail(e),this.restoreScrollState(e,t);return}let i=e.createDiv({cls:"scv-main"});this.renderMain(i),n&&this.restoreNavigationScrollOnNextRender?(this.restoreMainScrollState(e),this.restoreNavigationScrollOnNextRender=!1):this.restoreScrollState(e,t)}getFilter(){return this.filter}getSelectedChangeId(){return this.selectedChangeId}invalidateDiffStat(e){this.diffStat.invalidate(e)}rerender(){this.container&&this.render(this.container)}captureScrollState(e){let t=new Map;for(let n of Ie.SCROLL_REGIONS){let i=e.querySelector(`.${n}`);i&&t.set(n,i.scrollTop)}return t}restoreScrollState(e,t){for(let[n,i]of t){let s=e.querySelector(`.${n}`);s&&(s.scrollTop=i)}}captureMainScrollState(e){var t,n,i,s;this.mainScrollState={repository:(n=(t=e.querySelector(".scv-changes-tree"))==null?void 0:t.scrollTop)!=null?n:0,queue:(s=(i=e.querySelector(".scv-selected-section-list"))==null?void 0:i.scrollTop)!=null?s:0}}restoreMainScrollState(e){let t=e.querySelector(".scv-changes-tree");t&&(t.scrollTop=this.mainScrollState.repository);let n=e.querySelector(".scv-selected-section-list");if(n&&(n.scrollTop=this.mainScrollState.queue),this.navigationAnchorId===null)return;let i=e.querySelector(`[data-change-id="${ts(this.navigationAnchorId)}"]`);if(this.navigationAnchorId=null,!i||!t)return;let s=t.getBoundingClientRect().top,o=i.getBoundingClientRect().top,a=i.getBoundingClientRect().bottom;(o<s||a>s+t.clientHeight)&&i.scrollIntoView({block:"nearest"})}renderMain(e){let t=R.Platform.isMobile,n=this.viewModel.getState("all",!0).counts,i=this.viewModel.getState(this.filter,this.showSynced);an(e,{readyToPushCount:i.counts["ready-to-push"],workspaceInfo:this.getWorkspaceInfo(),refreshStatus:i.refreshStatus},{onPush:()=>{this.runSync(i.syncQueue)},onRefresh:()=>{this.diffStat.clear(),this.callbacks.onRefresh()}},{isMobile:t,showPush:!t}),this.renderSearchBox(e);let s={onToggleFolder:p=>this.toggleFolder(p),onToggleSelect:(p,m)=>this.toggleSelect(p,m),onToggleFolderSelect:(p,m)=>this.toggleFolderSelect(p,m),onOpenDiff:p=>this.openDiff(p),onDownload:p=>this.download(p),onChangeSyncAction:(p,m)=>this.changeSyncAction(p,m),onRowAction:(p,m)=>this.runRowAction(p,m),onOpenRemote:p=>{this.callbacks.onOpenRemoteFile&&this.callbacks.onOpenRemoteFile(p)},getDiffStat:p=>this.diffStat.get(p)};on(e,{filter:this.filter,showSynced:this.showSynced},n,{onFilterChange:(p,m)=>{this.filter=p,this.showSynced=m,this.rerender()}},{isMobile:t});let o=this.searchQuery.trim().toLowerCase(),a=i.items;this.filter==="all"&&this.showSynced&&(a=a.concat(this.viewModel.getState("synced",!0).items));let h=(o?a.filter(p=>p.path.toLowerCase().includes(o)):a).filter(p=>!p.isSelectedForSync),d=e.createDiv({cls:"scv-body"});Sn(d,{syncQueue:i.syncQueue,collapsed:this.collapsedSections.has("checkedChanges"),mobileCollapsed:this.mobileQueueCollapsed,isMobile:t},s,{onToggleCollapsed:()=>{t?(this.mobileQueueCollapsed=!this.mobileQueueCollapsed,this.rerender()):this.toggleSection("checkedChanges")},onClearSelection:p=>this.clearSelection(p)});let u=d.createDiv({cls:"scv-changes-region"});Rn(u,{items:h,collapsed:this.collapsedSections.has("changes"),viewMode:this.viewMode,collapsedFolders:this.collapsedFolders,isMobile:t},s,{onToggleCollapsed:()=>this.toggleSection("changes"),onSetViewMode:p=>this.setViewMode(p)}),this.collapsedSections.has("changes")||this.diffStat.loadVisible(h),(t?!this.mobileQueueCollapsed:!this.collapsedSections.has("checkedChanges"))&&this.diffStat.loadVisible(i.syncQueue),t&&this.renderMobileSyncBar(e,i.counts["ready-to-push"],i.syncQueue)}renderSearchBox(e){let t=e.createDiv({cls:"scv-search"});t.toggleClass("has-query",this.searchQuery.length>0),(0,R.setIcon)(t.createSpan({cls:"scv-search-icon"}),g.search);let n=t.createEl("input",{type:"text",cls:"scv-search-input",attr:{placeholder:l("sourceControl.search.placeholder"),spellcheck:"false"}});n.value=this.searchQuery;let i=t.createEl("button",{cls:"scv-search-clear"});(0,R.setIcon)(i,g.clear),(0,R.setTooltip)(i,l("sourceControl.search.clear")),n.addEventListener("input",()=>this.applySearchDebounced(n.value)),n.addEventListener("keydown",s=>{s.key!=="Escape"||n.value===""||(s.preventDefault(),n.value="",this.applySearchDebounced.cancel(),this.applySearch(""))}),i.addEventListener("click",()=>{n.value="",n.focus(),this.applySearchDebounced.cancel(),this.applySearch("")})}applySearch(e){var s,o,a,c,h;if(e===this.searchQuery)return;let t=document.activeElement===((s=this.container)==null?void 0:s.querySelector(".scv-search-input")),n=t&&(c=(a=(o=this.container)==null?void 0:o.querySelector(".scv-search-input"))==null?void 0:a.selectionStart)!=null?c:null;if(this.searchQuery=e,this.rerender(),!t)return;let i=(h=this.container)==null?void 0:h.querySelector(".scv-search-input");i&&(i.focus(),n!==null&&i.setSelectionRange(n,n))}setViewMode(e){this.viewMode!==e&&(this.viewMode=e,this.rerender())}toggleSection(e){this.collapsedSections.has(e)?this.collapsedSections.delete(e):this.collapsedSections.add(e),this.rerender()}clearSelection(e){this.callbacks.onDeselectMany(e.map(t=>t.id)),this.rerender()}async runSync(e){e.length!==0&&await this.callbacks.onSync(e.map(t=>({changeId:t.id,action:t.hasActionOverride?t.syncAction:void 0})))}download(e){this.callbacks.onPull&&this.callbacks.onPull([e.id])}runRowAction(e,t){t==="push"&&this.callbacks.onPush?this.callbacks.onPush([e.id]):t==="pull"&&this.callbacks.onPull?this.callbacks.onPull([e.id]):t==="delete-remote"&&this.callbacks.onDeleteRemote?this.callbacks.onDeleteRemote([e.id]):t==="delete-local"&&this.callbacks.onDeleteLocal&&this.callbacks.onDeleteLocal([e.id])}changeSyncAction(e,t){this.callbacks.onSetSyncAction(e.id,t),this.rerender()}renderDetail(e){let t=e.createDiv({cls:"scv-detail"}),n=t.createDiv({cls:"scv-detail-bar"}),i=n.createEl("button",{cls:"scv-detail-back"});(0,R.setIcon)(i.createSpan({cls:"scv-detail-back-icon"}),g.back),i.createSpan({cls:"scv-detail-back-label",text:l("sourceControl.detail.back")}),i.addEventListener("click",()=>{this.selectedChangeId=null,this.restoreNavigationScrollOnNextRender=!0,this.rerender()});let s=n.createDiv({cls:"scv-detail-bar-toggle"}),o=j(t,{layout:W(),toggleHost:s,onLayoutChange:c=>{Q(c),this.rerender()}}),a=t.querySelector(".scv-diff-tab-body");a==null||a.addClass("scv-detail-diff"),this.selectedChangeId&&this.loadAndRenderDiff(o,this.selectedChangeId)}async loadAndRenderDiff(e,t){if(!this.callbacks.loadDiffContent)return;let n=this.viewModel.getItem(t);if(!n)return;let i=await this.callbacks.loadDiffContent(n);!i||this.selectedChangeId!==t||e.setContent(i.remote,i.local)}toggleFolder(e){this.collapsedFolders.has(e)?this.collapsedFolders.delete(e):this.collapsedFolders.add(e),this.rerender()}toggleSelect(e,t){t?this.callbacks.onSelectForSync(e):this.callbacks.onDeselectFromSync(e),this.rerender()}toggleFolderSelect(e,t){t?this.callbacks.onSelectMany(e):this.callbacks.onDeselectMany(e),this.rerender()}openDiff(e){if(e.kind==="local-only"&&this.callbacks.onOpenLocalFile){this.callbacks.onOpenLocalFile(e);return}if(e.kind==="remote-only"&&this.callbacks.onOpenRemoteFile){this.callbacks.onOpenRemoteFile(e);return}R.Platform.isMobile&&(this.container&&this.captureMainScrollState(this.container),this.navigationAnchorId=e.id),this.selectedChangeId=e.id,this.callbacks.onOpenDiff&&this.callbacks.onOpenDiff(e),this.diffStat.lazyLoad(e),this.rerender()}renderMobileSyncBar(e,t,n){if(t===0)return;let i=e.createDiv({cls:"scv-mobile-sync-bar"});i.createSpan({cls:"scv-mobile-sync-label",text:l("sourceControl.mobile.filesSelected",{count:t})});let s=i.createEl("button",{cls:"scv-mobile-sync-btn"});s.createSpan({cls:"scv-mobile-sync-btn-label",text:l("sourceControl.mobile.sync")}),s.addEventListener("click",()=>{this.runSync(n)})}};Ie.SCROLL_REGIONS=["scv-changes-tree","scv-selected-section-list"];var De=Ie;function ts(r){return typeof CSS!="undefined"&&typeof CSS.escape=="function"?CSS.escape(r):r.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Le(r,e){let t=ke(r,e),n=0,i=0;for(let s of t)s.right.type==="added"&&n++,s.left.type==="removed"&&i++;return{additions:n,deletions:i}}function kn(r){return{additions:kt(r),deletions:0}}function Tn(r){return{additions:kt(r),deletions:0}}function Fn(r){return{additions:0,deletions:kt(r)}}function kt(r){if(r==="")return 0;let e=r.replace(/\r\n/g,`
|
|
`).replace(/\r/g,`
|
|
`).split(`
|
|
`);return e[e.length-1]===""?e.length-1:e.length}var re=require("obsidian");var X=class extends re.Modal{constructor(e,t,n,i){super(e),this.message=t,this.onConfirm=n,this.onCancel=i}onOpen(){let{contentEl:e}=this;e.createEl("h3",{text:l("confirmModal.title")}),e.createEl("p",{text:this.message});let t=e.createDiv({cls:"ssv-confirm-buttons modal-button-container"});new re.ButtonComponent(t).setButtonText(l("confirmModal.cancel")).onClick(()=>{this.close(),this.onCancel&&this.onCancel()}),new re.ButtonComponent(t).setButtonText(l("confirmModal.confirm")).setCta().onClick(()=>{this.close(),this.onConfirm()})}onClose(){let{contentEl:e}=this;e.empty()}};var ce="sync-status-view",Be=class Be extends I.ItemView{constructor(t,n){super(t);this.plugin=n;this.renderOnStatusChange=(0,I.debounce)(()=>this.renderView(),Be.RENDER_THROTTLE_MS,!1);this.diffTabRequestSeq=0;this.lastStatusSnapshots=new Map;let i={onSync:s=>this.runAction(this.plugin.sourceControlActions.sync(s)),onPull:s=>this.runAction(this.plugin.sourceControlActions.pull(s)),onDownload:s=>this.runAction(this.plugin.sourceControlActions.pull([s.id])),onRefresh:()=>this.runRefresh(),loadDiffContent:s=>this.plugin.sourceControlActions.loadDiffContent(s),loadDiffStat:s=>this.loadDiffStat(s),onOpenDiff:s=>{I.Platform.isMobile||this.openDesktopDiffTab(s)},onOpenLocalFile:s=>this.openLocalFile(s.path),onOpenRemoteFile:s=>this.openRemoteFile(s.path),onPush:s=>this.runAction(this.plugin.sourceControlActions.push(s)),onDeleteRemote:s=>this.runAction(this.confirmThenDeleteRemote(s)),onDeleteLocal:s=>this.runAction(this.plugin.sourceControlActions.deleteLocal(s)),onSelectForSync:s=>this.plugin.sourceControlActions.selectForSync(s),onDeselectFromSync:s=>this.plugin.sourceControlActions.deselectFromSync(s),onSelectMany:s=>this.plugin.sourceControlActions.selectMany(s),onDeselectMany:s=>this.plugin.sourceControlActions.deselectMany(s),onSetSyncAction:(s,o)=>this.plugin.sourceControlActions.setSyncAction(s,o)};this.view=new De(this.plugin.sourceControlViewModel,i,()=>this.getWorkspaceInfo())}onStatusesPublished(t){for(let[n,i]of t){let s=this.lastStatusSnapshots.get(n);this.lastStatusSnapshots.set(n,is(i)),s!==void 0&&ss(s,i)&&(this.view.invalidateDiffStat(n),this.refreshOpenDiffTab(n))}if(this.lastStatusSnapshots.size>t.size)for(let n of this.lastStatusSnapshots.keys())t.has(n)||(this.lastStatusSnapshots.delete(n),this.refreshOpenDiffTab(n))}refreshOpenDiffTab(t){var s,o;let n=(o=(s=this.plugin).diffTabPath)==null?void 0:o.call(s);if(!n||n!==t)return;let i=++this.diffTabRequestSeq;(async()=>{let a=this.plugin.sourceControlViewModel.getItem(t);if(!a){await this.plugin.openDiffTab(t,null);return}let c=await this.plugin.sourceControlActions.loadDiffContent(a);i===this.diffTabRequestSeq&&await this.plugin.openDiffTab(t,c)})()}async openDesktopDiffTab(t){let n=++this.diffTabRequestSeq,i=await this.plugin.sourceControlActions.loadDiffContent(t);n===this.diffTabRequestSeq&&await this.plugin.openDiffTab(t.path,i)}openLocalFile(t){let n=this.app.vault.getFileByPath(t);n instanceof I.TFile&&this.app.workspace.getLeaf(!1).openFile(n)}openRemoteFile(t){let n=this.plugin.syncWorkspace.getRemoteFileUrl(t);n&&window.open(n,"_blank")}confirmThenDeleteRemote(t){let n=t.map(s=>{var o;return(o=this.plugin.changeRepository.getById(s))==null?void 0:o.path}).filter(s=>s!==void 0);if(n.length===0)return Promise.resolve();let i=l("sourceControl.row.confirmDeleteRemote",{path:n.join(", ")});return new Promise(s=>{new X(this.app,i,()=>{this.plugin.sourceControlActions.deleteRemote(t).then(s)},()=>s()).open()})}async loadDiffStat(t){var i;if(t.kind==="local-only"){let s=(i=this.plugin.sync.status.get(t.path))==null?void 0:i.localContent;return s===void 0?{status:"pending"}:typeof s!="string"?{status:"unavailable"}:{status:"ready",stat:kn(s)}}let n=await this.plugin.sourceControlActions.loadDiffContent(t);return n?t.kind==="remote-only"&&typeof n.remote=="string"?{status:"ready",stat:Tn(n.remote)}:t.kind==="local-deleted"&&typeof n.remote=="string"?{status:"ready",stat:Fn(n.remote)}:{status:"ready",stat:Le(n.remote,n.local)}:{status:"unavailable"}}getWorkspaceInfo(){let t=this.plugin.syncWorkspace.getInfo(),n=this.plugin.refreshState.getLastCheckedAt();return{...t,lastCheckedAt:n}}getViewType(){return ce}getDisplayText(){return l("sourceControl.viewTitle")}getIcon(){return"git-compare"}onOpen(){return this.unsubscribeStatuses=this.plugin.sync.status.subscribe(t=>{this.onStatusesPublished(t),this.renderOnStatusChange()}),this.renderView(),Promise.resolve()}onClose(){var t;return(t=this.unsubscribeStatuses)==null||t.call(this),this.unsubscribeStatuses=void 0,Promise.resolve()}renderView(){let t=this.containerEl.children[1];t&&this.view.render(t)}runAction(t){return this.renderView(),t.finally(()=>this.renderView())}runRefresh(){let t=this.plugin.sourceControlViewModel.refresh();this.renderView(),t.then(()=>this.renderView(),()=>this.renderView())}};Be.RENDER_THROTTLE_MS=150;var ae=Be;function is(r){return{status:r.status,localContent:r.localContent,remoteContent:r.remoteContent,remoteSha:r.remoteSha,movedFrom:r.movedFrom,isSymlink:r.isSymlink}}function ss(r,e){return r.status!==e.status||xn(r.localContent,e.localContent)||xn(r.remoteContent,e.remoteContent)||r.remoteSha!==e.remoteSha||r.movedFrom!==e.movedFrom||r.isSymlink!==e.isSymlink}function xn(r,e){return r===e?!1:r===void 0||e===void 0?!0:r!==e}var En=require("obsidian");var V="source-control-diff-view",Z=class extends En.ItemView{constructor(t){super(t);this.path=null;this.content=null}getViewType(){return V}getIcon(){return"file-diff"}getDisplayText(){return this.path?l("diffView.titleWithFile",{path:this.path}):l("diffView.title")}getPath(){return this.path}setDiff(t,n){let i=this.path!==t;this.path=t,this.content=n,i&&this.leaf.setViewState({type:V,active:!0}).catch(()=>{}),this.render()}onOpen(){return this.render(),Promise.resolve()}render(){let t=this.containerEl.children[1];if(!t)return;if(t.empty(),t.addClass("scv-diff-tab"),t.addClass("gfs-diff-surface"),!this.path||!this.content){t.createDiv({cls:"scv-diff-empty",text:l("diffView.empty")});return}let n=t.createDiv({cls:"scv-diff-tab-header"});n.createDiv({cls:"scv-diff-tab-path",text:this.path});let i=n.createDiv({cls:"scv-diff-tab-header-toggle"});j(t,{remote:this.content.remote,local:this.content.local,layout:W(),toggleHost:i,onLayoutChange:Q})}};var Dt=ui(On(),1);var q=require("obsidian");function $n(r){return typeof q.Platform!="undefined"&&q.Platform.isDesktopApp&&typeof q.FileSystemAdapter=="function"&&r.vault.adapter instanceof q.FileSystemAdapter}function Hn(){let r=window.require;if(typeof r!="function")return null;try{return{fs:r("fs"),path:r("path")}}catch(e){return null}}function _n(r,e,t){let n=r.vault.adapter;return n instanceof q.FileSystemAdapter?t.join(n.getBasePath(),e):null}function T(r,e){if(!$n(r))return null;let t=Hn();if(!t)return null;try{let n=_n(r,e,t.path);return!n||!t.fs.lstatSync(n).isSymbolicLink()?null:t.fs.readlinkSync(n)}catch(n){return S.warn(`Failed to read local symlink ${e}`,n),null}}function Vn(r,e,t){if(!$n(r))return!1;let n=Hn();if(!n)return!1;try{let i=_n(r,e,n.path);return i?(n.fs.mkdirSync(n.path.dirname(i),{recursive:!0}),(n.fs.existsSync(i)||Ts(n.fs,i))&&n.fs.rmSync(i,{force:!0}),n.fs.symlinkSync(t,i,Fs(n,i,t)),!0):!1}catch(i){return S.warn(`Failed to create local symlink ${e} -> ${t}`,i),!1}}function Ts(r,e){try{return r.lstatSync(e).isSymbolicLink()}catch(t){return!1}}function Fs(r,e,t){try{let n=r.path.isAbsolute(t)?t:r.path.join(r.path.dirname(e),t);return r.fs.statSync(n).isDirectory()?"dir":"file"}catch(n){return"file"}}var $e=class{constructor(e,t,n,i,s="",o=""){this.ignoreMap=new Map;this.app=e,this.gitService=t,this.branch=n,this.rootPath=i.replace(/^\/|\/$/g,""),this.vaultFolder=s.replace(/^\/|\/$/g,""),this.localIgnore=o.trim()?(0,Dt.default)().add(o):null}getNormalizedPath(e){if(!this.vaultFolder)return e;let t=this.vaultFolder+"/";return e.startsWith(t)?e.substring(t.length):e===this.vaultFolder?"":e}async loadGitignores(e){this.ignoreMap.clear();let t=await this.collectGitignorePaths(e),n=e?new Set(e.map(i=>i.path)):void 0;for(let i of t){let s=i===".gitignore"?"":i.slice(0,-11),o=await this.getGitignoreContent(i,n);o&&this.ignoreMap.set(s,(0,Dt.default)().add(o))}}async collectGitignorePaths(e){let t=new Set;if(t.add(".gitignore"),this.rootPath){let n=this.rootPath.split("/"),i="";for(let s of n)i&&(i+="/"),i+=s,t.add(i+"/.gitignore")}return await this.scanLocalGitignores(t),await this.addRemoteGitignorePaths(t,e),t}async addRemoteGitignorePaths(e,t){if(t){for(let n of t)n.path.endsWith(".gitignore")&&e.add(n.path);return}try{let n=await this.gitService.getRepoGitignores(this.branch);for(let i of n)e.add(i)}catch(n){S.warn("Failed to fetch repo gitignores",n)}}async scanLocalGitignores(e){await this.scanDir(this.vaultFolder,e)}async scanDir(e,t){try{let n=await this.app.vault.adapter.list(e||"");for(let i of n.files)if(i===".gitignore"||i.endsWith("/.gitignore")){let s=this.getNormalizedPath(i),o=this.rootPath?`${this.rootPath}/${s}`:s;t.add(o)}for(let i of n.folders)T(this.app,i)===null&&await this.scanDir(i,t)}catch(n){}}getVaultPath(e){return this.vaultFolder?e?this.vaultFolder+"/"+e:this.vaultFolder:e}async getGitignoreContent(e,t){let n=this.localGitignorePath(e),i=n?await this.readLocalGitignore(n):void 0;if(i!==void 0)return i;if(!(t&&!t.has(e)))try{let s=await this.gitService.getFile("/"+e,this.branch);return s!=null&&s.content?s.content:void 0}catch(s){return}}localGitignorePath(e){return this.rootPath?e===this.rootPath+"/.gitignore"||e.startsWith(this.rootPath+"/")?this.getVaultPath(e.substring(this.rootPath.length+1)):null:this.getVaultPath(e)}async readLocalGitignore(e){try{if(await this.app.vault.adapter.exists(e))return await this.app.vault.adapter.read(e)}catch(t){S.warn(`Failed to read local ${e}`,t)}}isIgnored(e){var n;if((n=this.localIgnore)!=null&&n.ignores(e))return!0;let t=this.rootPath?`${this.rootPath}/${e}`:e;for(let[i,s]of this.ignoreMap.entries()){if(i===""){if(s.ignores(t))return!0;continue}let o=i+"/";if(t.startsWith(o)){let a=t.substring(o.length);if(s.ignores(a))return!0}}return!1}};function L(r){var e,t,n;return r.additions.length===0&&r.modifications.length===0&&r.deletions.length===0&&r.moves.length===0&&!((e=r.downloads)!=null&&e.length)&&!((t=r.acceptedRemote)!=null&&t.length)&&!((n=r.skippedConflicts)!=null&&n.length)}var He=class{constructor(){this.statuses=new Map;this.listeners=new Set}classify(e){return"movedFrom"in e?"moved":e.localExists&&!e.remoteExists?"unsynced":!e.localExists&&e.remoteExists?e.wasTracked?"local-deleted":"remote-only":e.contentsEqual?"synced":e.localChanged===!1&&e.remoteChanged===!0?"remote-modified":"modified"}get size(){return this.statuses.size}get(e){return this.statuses.get(e)}has(e){return this.statuses.has(e)}values(){return this.statuses.values()}[Symbol.iterator](){return this.statuses[Symbol.iterator]()}set(e,t){let n=typeof e=="string"?t:e;if(!n)throw new Error("A file status is required.");return this.statuses.set(n.path,n),this.publish(),this}delete(e){this.statuses.delete(e)&&this.publish()}clear(){this.statuses.size!==0&&(this.statuses.clear(),this.publish())}subscribe(e){return this.listeners.add(e),e(new Map(this.statuses)),()=>this.listeners.delete(e)}markSynced(e,t){let n=this.statuses.get(e);n&&this.set({...n,status:this.classify({localExists:!0,remoteExists:!0,contentsEqual:!0}),remoteSha:t!=null?t:n.remoteSha,movedFrom:void 0})}publish(){let e=new Map(this.statuses);for(let t of this.listeners)t(e)}};async function w(r){let e=typeof r=="string"?new TextEncoder().encode(r):new Uint8Array(r),t=new TextEncoder().encode(`blob ${e.byteLength}\0`),n=new Uint8Array(t.byteLength+e.byteLength);n.set(t,0),n.set(e,t.byteLength);let i=await crypto.subtle.digest("SHA-1",n);return Array.from(new Uint8Array(i)).map(s=>s.toString(16).padStart(2,"0")).join("")}var _e=class{constructor(e,t,n,i,s,o=()=>{},a=()=>{},c=()=>Promise.resolve()){this.getGitService=e;this.getBranch=t;this.toRepoPath=n;this.updateMetadata=i;this.getServiceName=s;this.notify=o;this.clearMovedSource=a;this.clearMetadata=c}async push(e,t,n,i,s=!1){var c;let a=(c=(await this.getGitService().pushFile(this.toRepoPath(e.path),t,this.getBranch(),`Update ${e.name} from Obsidian`,n,i)).sha)!=null?c:await w(t);return await this.persistMetadata(e.path,a,`Pushed ${e.name} to ${this.getServiceName()}`),s||this.notify(`Pushed ${e.name} to ${this.getServiceName()}`),a}async pushSymlink(e,t,n,i=!1){if(n==="skip")return i||this.notify(`Skipped symlink ${e.name}.`),{handled:!0,synced:!1};let s=this.getGitService();if(n!=="real"||!s.pushSymlink)return{handled:!1,synced:!1};let o=await s.pushSymlink(this.toRepoPath(e.path),t,this.getBranch(),`Update ${e.name} from Obsidian`);return o.sha&&await this.persistMetadata(e.path,o.sha,`Pushed symlink ${e.name} to ${this.getServiceName()}`),i||this.notify(`Pushed symlink ${e.name} to ${this.getServiceName()}`),{handled:!0,synced:!0,sha:o.sha}}async commitBatch(e,t,n,i){let s=this.getGitService();if(t.length===0&&n.length===0){if(!s.pushBatch)return this.pushSequentially(e,i);for(let a=0;a<e.length;a+=H)await this.commitPushChunk(e.slice(a,a+H),i);return}if(!s.commitBatch){await this.deleteSequentially(n,i),await this.moveSequentially(t,i),await this.pushSequentially(e,i);return}let o=[...e.map(a=>({kind:"push",entry:a})),...t.map(a=>({kind:"move",entry:a})),...n.map(a=>({kind:"delete",entry:a}))];for(let a=0;a<o.length;a+=H)await this.commitCombinedChunk(o.slice(a,a+H),i)}async pushSequentially(e,t){for(let n of e)try{let i=await this.push(n,n.content,n.existingSha,n.existingRevision,!0);this.recordSuccess(n.path,i,t,!!n.existingSha)}catch(i){this.recordFailure(n.path,i,t)}}async moveSequentially(e,t){var n;for(let i of e)try{let s=this.getGitService(),a=(n=(await s.pushFile(i.repoPath,i.content,this.getBranch(),`Move ${i.oldRepoPath} to ${i.repoPath}`)).sha)!=null?n:await w(i.content);await s.deleteFile(i.oldRepoPath,this.getBranch(),`Remove ${i.oldRepoPath} (moved to ${i.repoPath})`),await this.persistMetadata(i.path,a,`Moved ${i.oldRepoPath} to ${i.repoPath}`),this.clearMovedSource(i.oldPath),this.recordSuccess(i.path,a,t,!0)}catch(s){this.recordFailure(i.path,s,t)}}async deleteSequentially(e,t){let n=this.getGitService();for(let i of e)try{await n.deleteFile(i.repoPath,this.getBranch(),`Delete ${i.repoPath} from Obsidian`),await this.persistMetadataClear(i.path,`Deleted ${i.repoPath} from ${this.getServiceName()}`),t.success+=1,t.syncedPaths.push({path:i.path})}catch(s){this.recordFailure(i.path,s,t)}}async commitPushChunk(e,t){var n;try{let i=await this.getGitService().pushBatch(e.map(o=>({path:o.repoPath,content:o.content,existedRemotely:!!o.existingSha,revision:o.existingRevision})),this.getBranch(),`Push ${e.length} file(s) from Obsidian`),s=new Map(i.map(o=>[o.path,o.sha]));for(let o of e){let a=(n=s.get(o.repoPath))!=null?n:await w(o.content);await this.persistMetadata(o.path,a,`Pushed ${o.name} to ${this.getServiceName()}`),this.recordSuccess(o.path,a,t,!!o.existingSha)}}catch(i){for(let s of e)this.recordFailure(s.path,i,t)}}async commitCombinedChunk(e,t){let n=e.filter(o=>o.kind==="push").map(o=>o.entry),i=e.filter(o=>o.kind==="move").map(o=>o.entry),s=e.filter(o=>o.kind==="delete").map(o=>o.entry);try{let o=await this.getGitService().commitBatch({writes:n.map(c=>({path:c.repoPath,content:c.content,existedRemotely:!!c.existingSha,revision:c.existingRevision})),moves:i.map(c=>({oldPath:c.oldRepoPath,newPath:c.repoPath,content:c.content,oldRevision:c.oldRevision})),deletions:s.map(c=>c.repoPath)},this.getBranch(),this.combinedCommitMessage(n.length,i.length,s.length)),a=new Map(o.map(c=>[c.path,c.sha]));for(let c of n)await this.recordCommittedEntry(c,a,t,!!c.existingSha);for(let c of i)await this.recordCommittedEntry(c,a,t,!0),this.clearMovedSource(c.oldPath);for(let c of s)await this.recordCommittedDeletion(c,t)}catch(o){for(let a of e)this.recordFailure(a.entry.path,o,t)}}async recordCommittedDeletion(e,t){await this.persistMetadataClear(e.path,`Deleted ${e.repoPath} from ${this.getServiceName()}`),t.success+=1,t.syncedPaths.push({path:e.path})}async recordCommittedEntry(e,t,n,i){var o;let s=(o=t.get(e.repoPath))!=null?o:await w(e.content);await this.persistMetadata(e.path,s,`Pushed ${e.name} to ${this.getServiceName()}`),this.recordSuccess(e.path,s,n,i)}async persistMetadata(e,t,n){try{await this.updateMetadata(e,t)}catch(i){this.notify(`${n}, but failed to save local sync state: ${i instanceof Error?i.message:String(i)}`)}}async persistMetadataClear(e,t){try{await this.clearMetadata(e)}catch(n){this.notify(`${t}, but failed to clear local sync state: ${n instanceof Error?n.message:String(n)}`)}}combinedCommitMessage(e,t,n=0){let i=[];e>0&&i.push(`push ${e} file(s)`),t>0&&i.push(`move ${t} file(s)`),n>0&&i.push(`delete ${n} file(s)`);let o=(i.length<=1?i.join(""):`${i.slice(0,-1).join(", ")} and ${i[i.length-1]}`)||"sync";return`${o.charAt(0).toUpperCase()}${o.slice(1)} from Obsidian`}recordSuccess(e,t,n,i){n.success+=1,i?n.updated+=1:n.added+=1,n.syncedPaths.push({path:e,sha:t})}recordFailure(e,t,n){n.failed+=1,n.errors.push({file:e,error:t instanceof Error?t.message:String(t)})}};var qe=require("obsidian");async function Ve(r,e){let t=e.split("/"),n="";for(let i=0;i<t.length-1;i++){n+=(i>0?"/":"")+t[i];try{await r.mkdir(n)}catch(s){}}}var Ue=class{constructor(e,t,n,i,s=()=>{}){this.app=e;this.settings=t;this.updateMetadata=n;this.getServiceName=i;this.notify=s}async pull(e,t,n,i=!1,s){if(await Ve(this.app.vault.adapter,e.path),s!==void 0){if(k(this.settings)==="real"&&Vn(this.app,e.path,s)){await this.updateMetadata(e.path,n),i||this.notify(`Pulled symlink ${e.name} from ${this.getServiceName()}`);return}t=s}await this.write(e,t),await this.updateMetadata(e.path,n),i||this.notify(`Pulled ${e.name} from ${this.getServiceName()}`)}resolveExistingFile(e){var t;return e instanceof qe.TFile?e:(t=this.app.vault.getFileByPath(e.path))!=null?t:e}async write(e,t){let n=this.resolveExistingFile(e);if(typeof t!="string"){n instanceof qe.TFile?await this.app.vault.modifyBinary(n,t):await this.app.vault.adapter.writeBinary(n.path,t);return}n instanceof qe.TFile?await this.app.vault.modify(n,t):await this.app.vault.adapter.write(n.path,t)}};var ze=class{constructor(e,t,n){this.settings=e;this.save=t;this.status=n}async update(e,t){this.settings.syncMetadata[e]={lastSyncedSha:t,lastSyncedAt:Date.now(),lastKnownPath:e},await this.save(),this.status.markSynced(e,t)}async clear(e){e in this.settings.syncMetadata&&(delete this.settings.syncMetadata[e],await this.save())}async trackRename(e,t){var s;let n=this.settings.syncMetadata[t];if(!n)return;delete this.settings.syncMetadata[t];let i=(s=n.renamedFrom)!=null?s:t;this.settings.syncMetadata[e]={lastSyncedSha:n.lastSyncedSha,lastSyncedAt:n.lastSyncedAt,lastKnownPath:e,...e===i?{}:{renamedFrom:i}},await this.save()}};function It(r,e){if(!e)return!0;let t=`${e}/`;return r.startsWith(t)||r===e}function qn(r,e){return e?r.filter(t=>It(t.path,e)):r}function Ke(r,e){if(!e)return r;let t=`${e}/`;return r.startsWith(t)?r.substring(t.length):r===e?"":r}function Un(r,e){return e?r?`${e}/${r}`:e:r}var We=class{constructor(e,t){this.app=e;this.settings=t}fileInfo(e){let t=typeof e=="string",n=t?e:e.path,i=t?n.split("/").pop()||n:e.name;return{path:n,name:i,isString:t}}toRepoPath(e){return Ke(e,this.settings.vaultFolder)}toTreePath(e){if(e.startsWith("/"))return e.slice(1);let t=this.settings.rootPath;if(!t)return e;let n=t.endsWith("/")?t:`${t}/`;return e.startsWith(n)?e:n+e}pathExists(e){return this.app.vault.adapter.exists(e)}indexedFileExists(e){return this.app.vault.getFileByPath(e)!==null}async readContent(e){let t=typeof e=="string"?e:e.path,n=b(t);if(typeof e=="string")return n?this.app.vault.adapter.readBinary(t):this.app.vault.adapter.read(t);try{return n?await this.app.vault.readBinary(e):await this.app.vault.read(e)}catch(i){return S.warn(`vault.read failed for ${t}; falling back to adapter`,i),n?this.app.vault.adapter.readBinary(t):this.app.vault.adapter.read(t)}}};var Qe=class{constructor(e,t,n){this.getGitService=e;this.getBranch=t;this.pullExecutor=n}async findStale(e){let t=[];for(let n of e)(await this.getGitService().getFile(n.repoPath,this.getBranch())).sha!==n.remoteSha&&t.push(n);return t}async applyRemote(e,t){var n;for(let i of e)try{let s=await this.getGitService().getBlob(i.remoteSha,i.repoPath),o=s.isSymlink?(n=s.symlinkTarget)!=null?n:"":void 0;await this.pullExecutor.pull({path:i.path,name:i.name},s.content,s.sha,!0,o),t.resolvedConflicts+=1,t.syncedPaths.push({path:i.path,sha:s.sha})}catch(s){t.failed+=1,t.errors.push({file:i.path,error:s instanceof Error?s.message:String(s)})}}};var je=class{constructor(e,t,n){this.push=e;this.pull=t;this.conflicts=n}};var ne=class{classify(e){let{local:t,remote:n,base:i}=e;if(!t.exists&&!n.exists)return"synced";if(t.exists&&!n.exists)return"local-only";if(!t.exists&&n.exists)return"remote-only";if(t.blobSha===n.blobSha)return"synced";if(!i.blobSha)return"conflict";let s=t.blobSha!==i.blobSha,o=n.blobSha!==i.blobSha;return s&&o?"conflict":s?"local-modified":o?"remote-modified":"synced"}actionFor(e){switch(e){case"local-only":return"push-create";case"local-modified":return"push-update";case"remote-only":return"pull-create";case"remote-modified":return"pull-overwrite";case"conflict":return"resolve-conflict";case"synced":return"none"}}plan(e){let t=this.classify(e);return{path:e.local.path||e.remote.path,repoPath:e.remote.repoPath,kind:this.contentKind(e),classification:t,action:this.actionFor(t)}}planFor(e,t){let n=this.classifyForOperation(e,t);return{path:t.local.path||t.remote.path,repoPath:t.remote.repoPath,kind:this.contentKind(t),classification:n,action:this.actionForOperation(e,n)}}planMove(e){let t=e.destination.exists,n=e.local.blobSha===e.source.blobSha?"synced":"local-modified",i=t?"conflict":n;return{path:e.local.path,repoPath:e.destination.repoPath,kind:e.local.kind,classification:i,action:t?"resolve-conflict":"move"}}contentKind(e){return e.local.exists?e.local.kind:e.remote.kind}classifyForOperation(e,t){let n=this.classify(t);return n!=="conflict"||t.base.blobSha?n:e==="push"?"local-modified":"remote-modified"}actionForOperation(e,t){return t==="synced"?"none":t==="conflict"?"resolve-conflict":e==="push"?t==="local-only"?"push-create":t==="local-modified"?"push-update":"resolve-conflict":t==="remote-only"?"pull-create":t==="local-only"?"none":"pull-overwrite"}};var Je=class{constructor(e){this.dependencies=e;this.planner=new ne}async pullAllFiles(e,t,n){let i=await this.resolveTree(n),s=await this.planPullBatch(e,i);return!L(s)&&!await this.dependencies.confirmPlan(s)?{success:0,added:0,updated:0,failed:0,conflicts:0,errors:[]}:this.processBatch(e,t,i)}async applyPullBatch(e,t,n,i={}){let s=await this.resolveTree(n);return this.processBatch(e,t,s,i)}async planSingleFile(e,t){let{path:n,isString:i}=this.dependencies.scanner.fileInfo(e);return this.planFromRemote(e,n,i,t)}async planPullBatch(e,t){let n=t?new Map(t.map(s=>[s.path,s])):void 0,i={additions:[],modifications:[],deletions:[],moves:[]};for(let s of e){if(!s)continue;let{path:o,name:a,isString:c}=this.dependencies.scanner.fileInfo(s);try{this.addPlanEntry(i,await this.classifyForPlan(s,o,c,n),o,a)}catch(h){S.warn(`Skipping ${o} from pull plan preview`,h)}}return i}async resolveTree(e){if(e)return e;try{return await this.dependencies.gitService().listFilesDetailed(this.dependencies.settings.branch,!1)}catch(t){S.warn("Failed to fetch remote tree for pull; falling back to per-file fetches",t);return}}async processBatch(e,t,n,i={}){let s={success:0,added:0,updated:0,failed:0,conflicts:0,errors:[]},o=n?new Map(n.map(a=>[a.path,a])):void 0;for(let a=0;a<e.length;a+=1){let c=e[a];if(!c)continue;let{path:h,name:d,isString:u}=this.dependencies.scanner.fileInfo(c);t==null||t(a+1,e.length,d);try{let f=await this.processFile(c,h,d,u,o);f==="added"?(s.success+=1,s.added+=1):f==="updated"?(s.success+=1,s.updated+=1):f==="conflict"&&(s.conflicts+=1)}catch(f){S.error(`Failed to pull ${h}:`,f),s.failed+=1,s.errors.push({file:h,error:this.errorMessage(f)})}}return await this.dependencies.saveSettings(),i.notify!==!1&&this.notifyResult(s),s}async classifyForPlan(e,t,n,i){let s=this.dependencies.scanner.toRepoPath(t),o=i==null?void 0:i.get(this.dependencies.scanner.toTreePath(s));if(i&&!o)return"skip";if(!(o!=null&&o.sha)||o.symlink)return"modification";let a=await this.planFromTree(e,t,n,o);return this.planKindFor(a)}async processFile(e,t,n,i,s){let o=this.dependencies.scanner.toRepoPath(t);if(s){let d=s.get(this.dependencies.scanner.toTreePath(o));if(!d)throw new Error("File not found in remote");let u=await this.classifyFromTree(e,t,i,d);if(u)return u}let a=await this.dependencies.gitService().getFile(o,this.dependencies.settings.branch);if(!a.sha)throw new Error("File not found in remote");let c=await this.planFromRemote(e,t,i,a);if(c.action==="none")return await this.dependencies.updateMetadata(t,a.sha),"unchanged";if(c.action==="resolve-conflict")return"conflict";let h=typeof e=="string"?{path:t,name:n}:e;return await this.dependencies.executor.pull(h,a.content,a.sha,!0,this.symlinkTarget(a)),c.action==="pull-create"?"added":"updated"}async classifyFromTree(e,t,n,i){if(i.symlink||!i.sha)return null;let s=await this.planFromTree(e,t,n,i);return s.action==="none"?(await this.dependencies.updateMetadata(t,i.sha),"unchanged"):s.action==="resolve-conflict"?"conflict":null}async planFromTree(e,t,n,i){var h;let s=this.dependencies.scanner.toRepoPath(t);await this.dependencies.migrateBaseline(t,s,i);let o=await this.fileExists(e),a=b(t)?"binary":"text",c=o?await w(await this.dependencies.scanner.readContent(e)):void 0;return this.planner.planFor("pull",{local:{path:t,exists:o,blobSha:c,kind:a},remote:{path:t,repoPath:s,exists:!0,blobSha:i.sha,kind:a},base:{blobSha:(h=this.dependencies.settings.syncMetadata[t])==null?void 0:h.lastSyncedSha}})}async planFromRemote(e,t,n,i){var u;let s=await this.fileExists(e),o=b(t)?"binary":"text",a=s?await this.dependencies.scanner.readContent(e):void 0,c;a!==void 0&&(c=K(a,i.content)?i.sha:await w(a));let h=(u=this.dependencies.settings.syncMetadata[t])==null?void 0:u.lastSyncedSha,d=h===i.revision?i.sha:h;return this.planner.planFor("pull",{local:{path:t,exists:s,blobSha:c,kind:o},remote:{path:t,repoPath:this.dependencies.scanner.toRepoPath(t),exists:!0,blobSha:i.sha,kind:o},base:{blobSha:d}})}planKindFor(e){return e.action==="pull-create"?"addition":e.action==="pull-overwrite"?"modification":e.action==="resolve-conflict"?"conflict":e.action==="none"?"unchanged":"skip"}fileExists(e){return typeof e=="string"?this.dependencies.scanner.pathExists(e):this.dependencies.scanner.indexedFileExists(e.path)}addPlanEntry(e,t,n,i){let s={path:n,name:i};t==="addition"?e.additions.push(s):t==="modification"&&e.modifications.push(s)}symlinkTarget(e){var t;return e.isSymlink?(t=e.symlinkTarget)!=null?t:"":void 0}notifyResult(e){if(e.success>0){let t=this.dependencies.serviceName(),n=this.pullSummaryKey(e.added,e.updated);this.dependencies.notify(l(n,{service:t,added:e.added,updated:e.updated}))}e.conflicts>0&&this.dependencies.notify(`Skipped ${e.conflicts} file(s) with conflicting changes on both sides. Push or pull each one individually to resolve.`,8e3),e.failed>0&&this.dependencies.notify(`Failed to pull ${e.failed} file(s). Check console for details.`)}pullSummaryKey(e,t){return e>0&&t>0?"sync.notice.pullSummary":e>0?"sync.notice.pullAddedOnly":"sync.notice.pullUpdatedOnly"}errorMessage(e){return e instanceof Error?e.message:String(e)}};var zn=require("obsidian");var Ye=class{constructor(e){this.dependencies=e;this.planner=new ne}async pushFiles(e,t,n){let i=e.filter(p=>p&&!this.dependencies.isPathIgnored(this.fileInfo(p).path));if(i.length===0)return this.emptyResults();let s=n!=null?n:await this.dependencies.gitService().listFilesDetailed(this.dependencies.settings.branch,!1),{plan:o,immediate:a}=await this.buildPlan(i,t,s),c={...this.emptyResults(),success:a.success,updated:a.updated,failed:a.failed,conflicts:o.conflicts.length+o.autoSkipped.length,errors:a.errors,syncedPaths:a.syncedPaths},h=[],d=[],u=[];if(!await this.resolvePlanConflicts(o,c,h,d,u))return c;let f=this.buildReviewPlan(o,h,d);return!L(f)&&!await this.dependencies.confirmPlan(f)?(c.cancelled=!0,c.skippedConflicts=h.length+o.autoSkipped.length,c.conflictedPaths=this.conflictedPaths(o),await this.dependencies.saveSettings(),c):(await this.commitResolvedBatch(o.pushes,o.moves,[],d,u,c),c.skippedConflicts=h.length+o.autoSkipped.length,await this.dependencies.saveSettings(),this.notifyResult(c),c)}async planSyncBatch(e,t,n){let i=e.filter(m=>m&&!this.dependencies.isPathIgnored(this.fileInfo(m).path));if(i.length===0)return{reviewPlan:{additions:[],modifications:[],deletions:[],moves:[]},pushes:[],moves:[],keepRemote:[],keepLocal:[],skippedConflicts:0,conflictedPaths:[],cancelled:!1,immediate:{success:0,updated:0,failed:0,errors:[],syncedPaths:[]}};let s=n!=null?n:await this.dependencies.gitService().listFilesDetailed(this.dependencies.settings.branch,!1),{plan:o,immediate:a}=await this.buildPlan(i,t,s),c={...this.emptyResults(),success:a.success,updated:a.updated,failed:a.failed,conflicts:o.conflicts.length+o.autoSkipped.length,errors:a.errors,syncedPaths:a.syncedPaths},h=[],d=[],u=[],f=await this.resolvePlanConflicts(o,c,h,d,u);return{reviewPlan:this.buildReviewPlan(o,h,d),pushes:o.pushes,moves:o.moves,keepRemote:d,keepLocal:u,skippedConflicts:h.length+o.autoSkipped.length,conflictedPaths:this.conflictedPaths(o),cancelled:!f,immediate:a}}emptyResults(){return{success:0,added:0,updated:0,failed:0,conflicts:0,resolvedConflicts:0,skippedConflicts:0,errors:[],syncedPaths:[]}}async resolvePlanConflicts(e,t,n,i,s){if(e.conflicts.length===0)return!0;if(!await this.dependencies.resolveConflicts(e.conflicts,e.pushes.length+e.moves.length))return t.cancelled=!0,t.conflictedPaths=this.conflictedPaths(e),await this.dependencies.saveSettings(),!1;for(let a of e.conflicts)a.resolution==="keep-local"?(s.push(a),e.pushes.push({path:a.path,name:a.name,repoPath:a.repoPath,content:a.localContent,existingSha:a.remoteSha,existingRevision:a.remoteRevision})):a.resolution==="keep-remote"?i.push(a):n.push(a);return!0}buildReviewPlan(e,t,n){return{additions:e.pushes.filter(i=>!i.existingSha).map(i=>({path:i.path,name:i.name})),modifications:e.pushes.filter(i=>i.existingSha).map(i=>({path:i.path,name:i.name})),moves:e.moves.map(i=>({path:i.path,name:i.name,movedFrom:i.oldPath})),deletions:[],acceptedRemote:n.map(i=>({path:i.path,name:i.name})),skippedConflicts:[...t.map(i=>({path:i.path,name:i.name})),...e.autoSkipped]}}conflictedPaths(e){return[...e.conflicts.map(t=>t.path),...e.autoSkipped.map(t=>t.path)]}async commitResolvedBatch(e,t,n,i,s,o){let a=s.length>0?await this.dependencies.conflicts.findStale(s):[];if(a.length>0){this.recordStaleFailure(e,t,n,a,o);return}let c=e.length>0||t.length>0||n.length>0,h=o.failed;if(c&&await this.dependencies.executor.commitBatch(e,t,n,o),c&&o.failed!==h)return;let d=new Set(s.map(u=>u.path));o.resolvedConflicts+=o.syncedPaths.filter(u=>d.has(u.path)).length,await this.dependencies.conflicts.applyRemote(i,o)}recordStaleFailure(e,t,n,i,s){let o=`Remote content changed since you reviewed this conflict (${i.map(a=>a.path).join(", ")}). Nothing was pushed \u2014 resolve the conflict again.`;for(let a of[...e,...t,...n])s.failed+=1,s.errors.push({file:a.path,error:o})}async buildPlan(e,t,n){let i={pushes:[],moves:[],conflicts:[],autoSkipped:[]},s={success:0,updated:0,failed:0,errors:[],syncedPaths:[]},o=new Map(n.map(c=>[c.path,c])),a=this.hasOrphanedRenameMetadata();for(let c=0;c<e.length;c+=1){let h=e[c];if(!h)continue;let d=this.fileInfo(h);t==null||t(c+1,e.length,d.name);try{await this.classifyCandidate(h,d,o,i,a)==="done"&&(s.success+=1,s.updated+=1,s.syncedPaths.push({path:d.path}))}catch(u){S.error(`Failed to push ${d.path}:`,u),s.failed+=1,s.errors.push({file:d.path,error:this.errorMessage(u)})}}return{plan:i,immediate:s}}hasOrphanedRenameMetadata(){for(let e of Object.keys(this.dependencies.settings.syncMetadata)){let t=this.dependencies.settings.syncMetadata[e];if(F(t,e)&&!this.dependencies.app.vault.getFileByPath(e))return!0}return!1}async classifyCandidate(e,t,n,i,s){if(!await this.fileExists(e))throw new Error("File no longer exists");let o=T(this.dependencies.app,t.path);if(o!==null){let p=await this.dependencies.executor.pushSymlink({path:t.path,name:t.name},o,k(this.dependencies.settings),!0);if(p.handled)return p.synced?"done":"unchanged"}let a=await this.dependencies.scanner.readContent(e),c=await this.classifyMove(e,t,a,n,i.moves,s,i.autoSkipped);if(c)return c;let h=this.dependencies.scanner.toRepoPath(t.path),d=n.get(this.dependencies.scanner.toTreePath(h));await this.dependencies.migrateBaseline(t.path,h,d);let u=await this.refreshGitLabRevision(h,d);u&&(d={...d,sha:u.sha});let f=await this.classifyAgainstTree(t.path,a,d);return f==="conflict"?(i.conflicts.push({path:t.path,name:t.name,repoPath:h,localContent:a,remoteSha:d.sha,remoteRevision:u==null?void 0:u.revision}),f):(f==="queued"&&i.pushes.push({path:t.path,name:t.name,repoPath:h,content:a,existingSha:d==null?void 0:d.sha,existingRevision:u==null?void 0:u.revision}),f)}async classifyMove(e,t,n,i,s,o,a){var d,u;let c=(u=(d=this.dependencies.settings.syncMetadata[t.path])==null?void 0:d.renamedFrom)!=null?u:null;if(!c&&o){let f=!t.isString&&e instanceof zn.TFile?e:this.dependencies.app.vault.getFileByPath(t.path);f&&(c=await this.detectRename(f,n,i))}if(!c)return;let h=await this.queueMove(t.path,t.name,c,n,i,s);return h==="conflict"&&a.push({path:t.path,name:t.name}),h}async detectRename(e,t,n){let i=Object.keys(this.dependencies.settings.syncMetadata).filter(a=>{let c=this.dependencies.settings.syncMetadata[a];return a!==e.path&&F(c,a)&&!this.dependencies.app.vault.getFileByPath(a)});if(i.length===0)return null;let s=n;if(!s)try{let a=await this.dependencies.gitService().listFilesDetailed(this.dependencies.settings.branch,!1);s=new Map(a.map(c=>[c.path,c]))}catch(a){S.warn("Failed to fetch remote tree for rename detection; falling back to per-candidate lookups",a)}let o=s?await w(t):void 0;for(let a of i){let c=this.dependencies.scanner.toRepoPath(a),h=this.matchRename(o,c,s);if(h===!0)return a;if(h===!1)continue;let d=await this.dependencies.gitService().getFile(c,this.dependencies.settings.branch);if(d.sha&&K(t,d.content))return a}return null}matchRename(e,t,n){if(!n)return;let i=n.get(this.dependencies.scanner.toTreePath(t));return!i||i.symlink?!1:i.sha?i.sha===e:void 0}async queueMove(e,t,n,i,s,o){let a=this.dependencies.scanner.toRepoPath(e),c=this.dependencies.scanner.toRepoPath(n),h=s.get(this.dependencies.scanner.toTreePath(a)),d=s.get(this.dependencies.scanner.toTreePath(c)),u=await this.refreshGitLabRevision(c,d);u&&(d={...d,sha:u.sha});let f=b(e)?"binary":"text";return this.planner.planMove({local:{path:e,exists:!0,blobSha:await w(i),kind:f},source:{path:n,repoPath:c,exists:d!==void 0,blobSha:d==null?void 0:d.sha,kind:f},destination:{path:e,repoPath:a,exists:h!==void 0,blobSha:h==null?void 0:h.sha,kind:f}}).action==="resolve-conflict"?"conflict":(o.push({path:e,name:t,repoPath:a,oldPath:n,oldRepoPath:c,content:i,oldRevision:u==null?void 0:u.revision}),"queued")}async refreshGitLabRevision(e,t){if(this.dependencies.settings.serviceType!=="gitlab"||!(t!=null&&t.sha))return;let n=await this.dependencies.gitService().getFile(e,this.dependencies.settings.branch);return n.sha?{sha:n.sha,revision:n.revision}:void 0}async classifyAgainstTree(e,t,n){if(n!=null&&n.symlink)return"unchanged";let i=b(e)?"binary":"text",s=this.dependencies.settings.syncMetadata[e],o=this.planner.planFor("push",{local:{path:e,exists:!0,blobSha:await w(t),kind:i},remote:{path:e,repoPath:this.dependencies.scanner.toRepoPath(e),exists:n!==void 0,blobSha:n==null?void 0:n.sha,kind:i},base:{blobSha:s==null?void 0:s.lastSyncedSha}});return o.action==="none"&&(n!=null&&n.sha)?(await this.dependencies.updateMetadata(e,n.sha),"unchanged"):o.action==="resolve-conflict"?"conflict":"queued"}notifyResult(e){if(e.success>0){let t=e.resolvedConflicts>0?l("sync.notice.pushCommitNote"):"",n=this.dependencies.serviceName(),i=this.pushSummaryKey(e.added,e.updated);this.dependencies.notify(l(i,{service:n,added:e.added,updated:e.updated,commitNote:t}))}e.resolvedConflicts>0&&this.dependencies.notify(`Resolved ${e.resolvedConflicts} conflict(s).`),e.skippedConflicts>0&&this.dependencies.notify(`Skipped ${e.skippedConflicts} conflict(s).`,8e3),e.failed>0&&this.dependencies.notify(`Failed to push ${e.failed} file(s). Check console for details.`)}pushSummaryKey(e,t){return e>0&&t>0?"sync.notice.pushSummary":e>0?"sync.notice.pushAddedOnly":"sync.notice.pushUpdatedOnly"}fileInfo(e){return this.dependencies.scanner.fileInfo(e)}fileExists(e){return typeof e=="string"?this.dependencies.scanner.pathExists(e):this.dependencies.scanner.indexedFileExists(e.path)}errorMessage(e){return e instanceof Error?e.message:String(e)}};var Xe=class{confirmPlan(){return Promise.resolve(!0)}openConflict(){}resolveBatchConflicts(){return Promise.resolve(!1)}notify(){}};var de=class{constructor(e,t,n,i,s=()=>!1,o=new He,a=new Xe){this.app=e,this.gitService=t,this.settings=n,this.onSaveSettings=i,this.isPathIgnored=s,this.status=o,this.interaction=a,this.metadataStore=new ze(this.settings,()=>this.saveSettings(),this.status),this.scanner=new We(this.app,this.settings);let c=new _e(()=>this.gitService,()=>this.settings.branch,u=>this.getNormalizedPath(u),(u,f)=>this.updateMetadata(u,f),()=>this.serviceName,u=>this.interaction.notify(u),u=>{delete this.settings.syncMetadata[u]},u=>this.clearMetadata(u)),h=new Ue(this.app,this.settings,(u,f)=>this.updateMetadata(u,f),()=>this.serviceName,u=>this.interaction.notify(u)),d=new Qe(()=>this.gitService,()=>this.settings.branch,h);this.executor=new je(c,h,d),this.pullCoordinator=new Je({gitService:()=>this.gitService,settings:this.settings,scanner:this.scanner,executor:h,confirmPlan:u=>this.confirmPlan(u,"pull"),updateMetadata:(u,f)=>this.updateMetadata(u,f),migrateBaseline:(u,f,p)=>this.migrateGitLabLegacyBaseline(u,f,p),saveSettings:()=>this.saveSettings(),notify:(u,f)=>this.interaction.notify(u,f),serviceName:()=>this.serviceName}),this.pushCoordinator=new Ye({app:this.app,gitService:()=>this.gitService,settings:this.settings,scanner:this.scanner,executor:c,conflicts:d,isPathIgnored:u=>this.isPathIgnored(u),confirmPlan:u=>this.confirmPlan(u,"push"),resolveConflicts:(u,f)=>this.interaction.resolveBatchConflicts(u,f,this.conflictDiffLoader,this.diffStatLoader),updateMetadata:(u,f)=>this.updateMetadata(u,f),migrateBaseline:(u,f,p)=>this.migrateGitLabLegacyBaseline(u,f,p),saveSettings:()=>this.saveSettings(),notify:(u,f)=>this.interaction.notify(u,f),serviceName:()=>this.serviceName})}get serviceName(){return x(this.settings)}async updateMetadata(e,t){await this.metadataStore.update(e,t)}async clearMetadata(e){await this.metadataStore.clear(e)}async trackRename(e,t){await this.metadataStore.trackRename(e,t)}getNormalizedPath(e){return this.scanner.toRepoPath(e)}updateGitService(e){this.gitService=e}setConflictDiffStatLoader(e){this.diffStatLoader=e}setConflictDiffLoader(e){this.conflictDiffLoader=e}singleEntryPlan(e,t,n){let i={additions:[],modifications:[],deletions:[],moves:[]},s={path:t,name:n};return(e==="addition"?i.additions:i.modifications).push(s),i}confirmPlan(e,t){return L(e)?Promise.resolve(!0):this.interaction.confirmPlan(e,t)}async performPush(e,t,n,i,s=!1){return this.executor.push.push(e,t,n,i,s)}symlinkPullTarget(e){var t;return e.isSymlink?(t=e.symlinkTarget)!=null?t:"":void 0}async pullFile(e){let{path:t,name:n}=this.getFileInfo(e),i=this.getNormalizedPath(t);try{let s=await this.gitService.getFile(i,this.settings.branch);if(!s.sha){this.interaction.notify(`File ${n} not found on remote.`);return}let o=await this.fileExists(e),a=o?await this.getFileContent(e):null,c=await this.pullCoordinator.planSingleFile(e,s);if(c.action==="none"){await this.updateMetadata(t,s.sha),this.interaction.notify(`${n} is already up to date.`);return}if(c.action==="resolve-conflict"){this.interaction.openConflict(n,a!=null?a:"",s.content,u=>{(async()=>{try{let f=typeof e=="string"?{path:t,name:n}:e;u==="local"?await this.performPush(f,a||"",s.sha,s.revision):await this.performPull(f,s.content,s.sha,!1,this.symlinkPullTarget(s))}catch(f){this.handleError(`Failed to resolve conflict for ${n}`,f)}})()});return}if(!await this.confirmPlan(this.singleEntryPlan(o?"modification":"addition",t,n),"pull"))return;let d=typeof e=="string"?{path:t,name:n}:e;await this.performPull(d,s.content,s.sha)}catch(s){this.handleError(`Failed to pull ${n} from ${this.serviceName}`,s)}}async performPull(e,t,n,i=!1,s){await this.executor.pull.pull(e,t,n,i,s)}async acceptRemoteConflict(e){var c,h,d;let{path:t,name:n}=this.getFileInfo(e),i=this.getNormalizedPath(t),s=(c=this.status.get(t))==null?void 0:c.remoteSha;if(!s)throw new Error("Cannot accept remote version because the reviewed remote revision is unavailable.");let o=await this.gitService.getBlob(s,i),a=(h=this.app.vault.getFileByPath(t))!=null?h:{path:t,name:n};await this.performPull(a,o.content,o.sha,!0,o.isSymlink?(d=o.symlinkTarget)!=null?d:"":void 0)}async saveSettings(){this.onSaveSettings&&await this.onSaveSettings()}handleError(e,t){S.error(e,t);let n=t instanceof Error?t.message:String(t);this.interaction.notify(`${e}: ${n}`)}async pushFiles(e,t,n){return this.pushCoordinator.pushFiles(e,t,n)}async pullAllFiles(e,t,n){return this.pullCoordinator.pullAllFiles(e,t,n)}async planPullBatch(e,t){return this.pullCoordinator.planPullBatch(e,t)}async applyPullBatch(e,t,n,i){return this.pullCoordinator.applyPullBatch(e,t,n,i)}planSyncBatch(e,t,n){return this.pushCoordinator.planSyncBatch(e,t,n)}commitResolvedBatch(...e){return this.pushCoordinator.commitResolvedBatch(...e)}async migrateGitLabLegacyBaseline(e,t,n){let i=this.settings.syncMetadata[e];if(this.settings.serviceType!=="gitlab"||!(i!=null&&i.lastSyncedSha)||!(n!=null&&n.sha)||n.sha===i.lastSyncedSha)return;let s=await this.gitService.getFile(t,this.settings.branch);s.sha===n.sha&&s.revision===i.lastSyncedSha&&await this.updateMetadata(e,s.sha)}getFileInfo(e){return this.scanner.fileInfo(e)}async fileExists(e){return typeof e=="string"?this.scanner.pathExists(e):this.scanner.indexedFileExists(e.path)}async getFileContent(e){return this.scanner.readContent(e)}};var Kn=require("obsidian");var Ze=class{constructor(e,t){this.dependencies=e;this.statuses=t}async discoverFiles(){var p;let{app:e}=this.dependencies,t=this.dependencies.settings(),n=this.dependencies.gitService(),i=this.dependencies.gitignoreManager(),s=e.vault.getFiles(),o=this.dependencies.filterFilesByVaultFolder(s),a=await((p=n.getBranchHead)==null?void 0:p.call(n,t.branch)),c=await n.listFilesDetailed(a!=null?a:t.branch,!1);await i.loadGitignores(c);let h=new Map,d=k(t)==="skip";for(let m of c){if(m.symlink&&d)continue;let y=this.getNormalizedRemotePath(m.path);if(y===null)continue;let N=this.dependencies.getVaultPath(y);i.isIgnored(y)||h.set(N,m)}o=o.filter(m=>!i.isIgnored(this.dependencies.getNormalizedPath(m.path)));let u=await this.discoverHiddenLocalFiles(),f=new Set(u.filter(m=>this.dependencies.filterPathByVaultFolder(m)).filter(m=>!i.isIgnored(this.dependencies.getNormalizedPath(m))));return{local:o,remoteEntries:c,remoteHead:a,remoteMap:h,localMap:new Set([...o.map(m=>m.path),...f]),allMap:new Map(s.map(m=>[m.path,m])),hiddenLocalPaths:f}}getNormalizedRemotePath(e){let t=this.dependencies.settings().rootPath;if(!t)return e;let n=t.endsWith("/")?t:`${t}/`;return e.startsWith(n)?e.substring(n.length):e===t?"":null}async discoverHiddenLocalFiles(){let e=[];return await this.recursiveScan(this.dependencies.settings().vaultFolder||"",e),e}async recursiveScan(e,t){try{let n=await this.dependencies.app.vault.adapter.list(e);for(let i of n.files)this.isHidden(i)&&(T(this.dependencies.app,i)!==null||await this.isLocalFile(i))&&t.push(i);for(let i of n.folders)if(!(i===".git"||i.endsWith("/.git"))){if(T(this.dependencies.app,i)!==null){this.isHidden(i)&&t.push(i);continue}await this.recursiveScan(i,t)}}catch(n){}}async identifyExtraFiles(e,t,n,i=new Set){let s=[];for(let[o]of e){if(t.has(o)||i.has(o))continue;let a=n.get(o);if(!a){let c=this.dependencies.app.vault.getAbstractFileByPath(o);c instanceof Kn.TFile&&(a=c)}a?s.push(a):await this.isLocalFile(o)?s.push(o):this.statuses.set(o,{path:o,status:this.statuses.classify({localExists:!1,remoteExists:!0,wasTracked:this.wasTrackedBeforeDelete(o)})})}return s}initializeFileStatuses(e){for(let t of e)this.statuses.set(t.path,{file:t,path:t.path,status:"checking"})}getCheckableFiles(e,t,n){let i=new Set(t.map(a=>typeof a=="string"?a:a.path)),s=[...n].filter(a=>!i.has(a)),o=this.dependencies.gitignoreManager();return[...e,...t,...s].filter(a=>{let c=typeof a=="string"?a:a.path;return!o.isIgnored(this.dependencies.getNormalizedPath(c))})}wasTrackedBeforeDelete(e){let t=this.dependencies.settings().syncMetadata,n=t?t[e]:void 0;return F(n,e)&&!n.renamedFrom}isHidden(e){return e.split("/").some(t=>t.startsWith("."))}async isLocalFile(e){let t=await this.dependencies.app.vault.adapter.stat(e);return(t==null?void 0:t.type)==="file"}};var Wn=require("obsidian");var tt=class tt{constructor(e,t){this.dependencies=e;this.statuses=t}async performStatusCheck(e,t,n){let i=e.length,s=0,o=0;n==null||n({current:s,total:i});let a=async()=>{for(;o<i;){let h=e[o++];if(h){let d=typeof h=="string"?h:h.path;await this.refreshFileStatus(h,t.get(d),t)}s+=1,n==null||n({current:s,total:i})}},c=Math.min(tt.STATUS_CHECK_CONCURRENCY,i);await Promise.all(Array.from({length:c},()=>a()))}async refreshFileStatus(e,t,n){var i,s;try{let o=typeof e=="string"?e:e.path,a=(s=(i=this.dependencies.settings().syncMetadata)==null?void 0:i[o])==null?void 0:s.renamedFrom;a!==void 0?await this.refreshMovedFileStatus(e,a,n==null?void 0:n.get(a)):t===void 0?await this.refreshLocalOnlyStatus(e):t.sha!==void 0?await this.refreshFileStatusBySha(e,t):await this.refreshFileStatusByContent(e)}catch(o){let a=typeof e=="string"?e:e.path;S.warn(`Failed to determine sync status for ${a}`,o),this.statuses.set(a,{file:typeof e=="string"?void 0:e,path:a,status:this.statuses.classify({localExists:!0,remoteExists:!1})})}}async refreshFileStatusBySha(e,t){let n=typeof e=="string",i=n?e:e.path,s=n?void 0:e,o=b(i),a=k(this.dependencies.settings()),c=await this.readLocalContentForSha(e,n,o,t.symlink,a),h=await w(c),d=t.sha,u=this.statuses.classify({localExists:!0,remoteExists:!0,contentsEqual:h===d,...d!==void 0?this.diffDirection(i,h,d):{}});u==="synced"&&t.sha&&await this.dependencies.syncManager().updateMetadata(i,t.sha),this.statuses.set(i,{file:s,path:i,status:u,localContent:c,remoteSha:t.sha,isSymlink:t.symlink})}async refreshFileStatusByContent(e){let t=typeof e=="string",n=t?e:e.path,i=t?void 0:e,s=await this.readFileContent(e,b(n),t),o=await this.dependencies.gitService().getFile(this.dependencies.getNormalizedPath(n),this.dependencies.settings().branch),a;if(!o.sha)a=this.statuses.classify({localExists:!0,remoteExists:!1});else{let c=K(s,o.content);a=this.statuses.classify({localExists:!0,remoteExists:!0,contentsEqual:c,...c?{}:this.diffDirection(n,await w(s),o.sha)})}a==="synced"&&o.sha&&await this.dependencies.syncManager().updateMetadata(n,o.sha),this.statuses.set(n,{file:i,path:n,status:a,localContent:s,remoteContent:o.content,remoteSha:o.sha})}diffDirection(e,t,n){let i=this.baseShaFor(e);return i===void 0?{}:{localChanged:t!==i,remoteChanged:n!==i}}async readFileContent(e,t,n){if(n)return this.readStringPathContent(e,t);if(!(e instanceof Wn.TFile))throw new Error("Expected TFile when isStringPath is false");try{return t?await this.dependencies.app.vault.readBinary(e):await this.dependencies.app.vault.read(e)}catch(i){return S.warn(`vault.read failed for ${e.path}; falling back to adapter`,i),t?await this.dependencies.app.vault.adapter.readBinary(e.path):await this.dependencies.app.vault.adapter.read(e.path)}}baseShaFor(e){let t=this.dependencies.settings().syncMetadata,n=t?t[e]:void 0;return F(n,e)?n.lastSyncedSha:void 0}async refreshMovedFileStatus(e,t,n){let i=typeof e=="string",s=i?e:e.path,o=await this.readFileContent(e,b(s),i);this.statuses.set(s,{file:i?void 0:e,path:s,status:this.statuses.classify({movedFrom:t}),movedFrom:t,localContent:o,remoteSha:n==null?void 0:n.sha,isSymlink:n==null?void 0:n.symlink})}async refreshLocalOnlyStatus(e){let t=typeof e=="string",n=t?e:e.path,i=await this.readFileContent(e,b(n),t);this.statuses.set(n,{file:t?void 0:e,path:n,status:this.statuses.classify({localExists:!0,remoteExists:!1}),localContent:i})}async readLocalContentForSha(e,t,n,i,s){if(i&&s==="real"){let o=typeof e=="string"?e:e.path,a=T(this.dependencies.app,o);if(a!==null)return a}return this.readFileContent(e,n,t)}async readStringPathContent(e,t){try{return t?await this.dependencies.app.vault.adapter.readBinary(e):await this.dependencies.app.vault.adapter.read(e)}catch(n){let i=T(this.dependencies.app,e);if(i!==null)return i;throw n}}};tt.STATUS_CHECK_CONCURRENCY=8;var et=tt;var nt=class{constructor(e,t){this.dependencies=e;this.statuses=t}async reconcileOutOfBandMoves(e){let t=this.orphanedMoveSourcesBySha(e);if(t.size===0)return;let n=await this.unsyncedMoveDestinationsBySha(e,t);for(let[i,s]of t){if(s.length!==1)continue;let o=n.get(i);if(!o||o.length!==1)continue;let a=s[0],c=o[0];await this.dependencies.syncManager().trackRename(c,a),this.statuses.delete(a),await this.dependencies.refreshFileStatus(c,e.get(c))}}pendingMoveOldPaths(){var t;let e=new Set;for(let n of Object.values((t=this.dependencies.settings().syncMetadata)!=null?t:{}))n.renamedFrom&&e.add(n.renamedFrom);return e}orphanedMoveSourcesBySha(e){var i,s;let t=(i=this.dependencies.settings().syncMetadata)!=null?i:{},n=new Map;for(let[o,a]of this.statuses){if(a.status!=="remote-only"&&a.status!=="local-deleted")continue;let c=t[o];if(!F(c,o)||c.renamedFrom)continue;let h=e.get(o);if(!h||h.symlink||!h.sha)continue;let d=(s=n.get(h.sha))!=null?s:[];d.push(o),n.set(h.sha,d)}return n}async unsyncedMoveDestinationsBySha(e,t){var i;let n=new Map;for(let[s,o]of this.statuses){if(o.status!=="unsynced"||o.localContent===void 0||e.has(s))continue;let a=await w(o.localContent);if(!t.has(a))continue;let c=(i=n.get(a))!=null?i:[];c.push(s),n.set(a,c)}return n}};var he=class{constructor(e,t){this.dependencies=e;this.statuses=t;this.contentRevisions=new Map;this.discovery=new Ze(e,t),this.resolver=new et(e,t),this.renameReconciler=new nt({settings:e.settings,syncManager:e.syncManager,refreshFileStatus:(n,i)=>this.resolver.refreshFileStatus(n,i)},t)}async refresh(e){this.statuses.clear();let t=await this.discovery.discoverFiles();this.discovery.initializeFileStatuses(t.local);for(let s of t.hiddenLocalPaths)this.statuses.set(s,{path:s,status:"checking"});let n=await this.discovery.identifyExtraFiles(t.remoteMap,t.localMap,t.allMap,this.renameReconciler.pendingMoveOldPaths());this.addExtraToStatuses(n);let i=this.discovery.getCheckableFiles(t.local,n,t.hiddenLocalPaths);return await this.resolver.performStatusCheck(i,t.remoteMap,e),await this.renameReconciler.reconcileOutOfBandMoves(t.remoteMap),{localCount:t.local.length+t.hiddenLocalPaths.size,remoteCount:t.remoteMap.size,remoteHead:t.remoteHead,remoteEntries:t.remoteEntries}}async handleFileCreated(e){if(this.statuses.has(e.path)||!this.dependencies.filterPathByVaultFolder(e.path))return!1;let t=this.bumpContentRevision(e.path);return this.statuses.set(e.path,{file:e,path:e.path,status:this.statuses.classify({localExists:!0,remoteExists:!1})}),this.resolver.readFileContent(e,b(e.path),!1).then(n=>{let i=this.statuses.get(e.path);!i||i.file!==e||this.contentRevisions.get(e.path)!==t||this.statuses.set(e.path,{...i,localContent:n})}).catch(n=>{S.warn(`Failed to read created file ${e.path}; its row stays pending until the next refresh`,n)}),!0}async handleFileModified(e){let t=this.statuses.get(e.path);if(!t||!["synced","modified","unsynced","moved"].includes(t.status))return!1;let n=this.bumpContentRevision(e.path),i=await this.resolver.readFileContent(e,b(e.path),!1);if(this.contentRevisions.get(e.path)!==n)return!0;let s=this.statuses.get(e.path);if(!s||s.file!==e)return!0;let o=s.status;if(s.status!=="moved"){let a=s.remoteSha;if(a===void 0)o=this.statuses.classify({localExists:!0,remoteExists:!1});else{let c=await w(i);o=this.statuses.classify({localExists:!0,remoteExists:!0,contentsEqual:c===a,...this.resolver.diffDirection(e.path,c,a)})}}return this.statuses.set(e.path,{...s,status:o,localContent:i}),!0}handleFileRenamed(e,t){var s,o;let n=this.statuses.get(t);if(this.contentRevisions.delete(t),!n||n.status==="checking")return!1;if(this.statuses.delete(t),!this.dependencies.filterPathByVaultFolder(e.path))return!0;let i=(o=(s=this.dependencies.settings().syncMetadata)==null?void 0:s[e.path])==null?void 0:o.renamedFrom;return i!==void 0?this.statuses.set(e.path,{file:e,path:e.path,status:this.statuses.classify({movedFrom:i}),movedFrom:i,remoteSha:n.remoteSha,localContent:n.localContent,isSymlink:n.isSymlink}):this.statuses.set(e.path,{...n,file:e,path:e.path}),!0}handleFileDeleted(e){let t=this.statuses.get(e);return this.contentRevisions.delete(e),!t||t.status==="checking"||t.status==="remote-only"||t.status==="local-deleted"?!1:t.status==="moved"?(this.statuses.delete(e),!0):t.status==="unsynced"?(this.statuses.delete(e),!0):(this.statuses.set(e,{...t,status:"local-deleted",localContent:void 0}),!0)}bumpContentRevision(e){var n;let t=((n=this.contentRevisions.get(e))!=null?n:0)+1;return this.contentRevisions.set(e,t),t}addExtraToStatuses(e){for(let t of e){let n=typeof t=="string"?t:t.path;this.statuses.set(n,{file:typeof t=="string"?void 0:t,path:n,status:"checking"})}}};function xs(r,e){return`${r}:${e}`}var ue=class{constructor(e,t){this.statuses=e;this.readBlob=t;this.pendingRemoteContent=new Map}async getDiff(e){var a;let t=this.statuses.get(e);if(!t)throw new Error(`No sync status for ${e}`);let n=await this.resolveRemoteContent(t),i="text";t.isSymlink?i="symlink":b(t.path)&&(i="binary");let s=t.status!=="remote-only"&&t.status!=="local-deleted",o=t.status!=="unsynced";return{path:t.path,localContent:s&&(a=t.localContent)!=null?a:"",remoteContent:o&&n!=null?n:"",kind:i}}async getConflictDiff(e){if(b(e.path)||typeof e.localContent!="string")return;let t=await this.resolveRemoteContent({path:e.path,status:"conflict",remoteSha:e.remoteSha,movedFrom:e.repoPath});if(t!==void 0)return{localContent:e.localContent,remoteContent:t}}async getConflictStat(e){if(b(e.path)||typeof e.localContent!="string")return{status:"unavailable"};let t=await this.getConflictDiff(e);return!t||typeof t.remoteContent!="string"||typeof t.localContent!="string"?{status:"unavailable"}:{status:"ready",stat:Le(t.remoteContent,t.localContent)}}async resolveRemoteContent(e){var s,o;if(e.remoteContent!==void 0)return e.remoteContent;if(!e.remoteSha)return;let t=xs(e.remoteSha,(s=e.movedFrom)!=null?s:e.path),n=this.pendingRemoteContent.get(t);n||(n=this.readBlob(e.remoteSha,(o=e.movedFrom)!=null?o:e.path).then(a=>a.content),this.pendingRemoteContent.set(t,n),n.catch(()=>{}).then(()=>this.pendingRemoteContent.delete(t)));let i=await n;return e.remoteContent===void 0&&(e.remoteContent=i),i}};var Lt=require("obsidian");var it=class{constructor(e,t,n=H){this.gitService=e;this.branch=t;this.batchSize=n}async execute(e,t){return this.gitService.deleteBatch?this.executeInBatches(e,t):this.executeSequentially(e,t)}async executeInBatches(e,t){let n={deletedPaths:[],errors:[]};e.forEach((i,s)=>t==null?void 0:t(s+1,i));for(let i=0;i<e.length;i+=this.batchSize){let s=e.slice(i,i+this.batchSize);try{await this.gitService.deleteBatch(s.map(o=>o.repoPath),this.branch,`Delete ${s.length} file(s) from Obsidian`),n.deletedPaths.push(...s.map(o=>o.path))}catch(o){let a=o instanceof Error?o.message:String(o);n.errors.push(...s.map(c=>({path:c.path,message:a})))}}return n}async executeSequentially(e,t){let n={deletedPaths:[],errors:[]},i=0;for(let s of e){t==null||t(i+1,s);try{await this.gitService.deleteFile(s.repoPath,this.branch,`Delete ${s.repoPath}`),n.deletedPaths.push(s.path)}catch(o){n.errors.push({path:s.path,message:o instanceof Error?o.message:String(o)})}i+=1}return n}};function Es(r,e){if(e.startsWith("/"))return e.slice(1);if(!r)return e;let t=r.endsWith("/")?r:`${r}/`;return e.startsWith(t)?e:t+e}function Qn(r){return r.split("/").map(encodeURIComponent).join("/")}function jn(r){let e=r.length;for(;e>0&&r[e-1]==="/";)e--;return r.slice(0,e)}function Jn(r,e){let t=Qn(Es(r.rootPath,e)),n=encodeURIComponent(r.branch);if(!t)return null;switch(r.serviceType){case"github":{let{githubOwner:i,githubRepo:s}=r;return!i||!s?null:`https://github.com/${encodeURIComponent(i)}/${encodeURIComponent(s)}/blob/${n}/${t}`}case"gitea":{let{giteaBaseUrl:i,giteaOwner:s,giteaRepo:o}=r;return!i||!s||!o?null:`${jn(i)}/${encodeURIComponent(s)}/${encodeURIComponent(o)}/src/branch/${n}/${t}`}case"gitlab":{let{gitlabBaseUrl:i,projectId:s}=r;return!i||!s.includes("/")?null:`${jn(i)}/${Qn(s)}/-/blob/${n}/${t}`}default:return null}}var st=class{constructor(e){this.dependencies=e}getStatuses(){return[...this.dependencies.manager().status.values()]}getInfo(){let e=this.dependencies.settings();return{serviceName:x(e),branch:e.branch,vaultFolder:e.vaultFolder}}getRemoteFileUrl(e){return Jn(this.dependencies.settings(),this.dependencies.normalizePath(e))}async refresh(e){let t=await this.dependencies.refreshService.refresh(e),n=this.dependencies.settings();return this.remoteTreeSnapshot=t.remoteHead?{branch:n.branch,rootPath:n.rootPath,head:t.remoteHead,entries:t.remoteEntries}:void 0,t}async push(e,t){let n=await this.reusableRemoteTree();return!t&&!n?this.dependencies.manager().pushFiles([...e]):this.dependencies.manager().pushFiles([...e],t,n)}async pull(e,t){let n=await this.reusableRemoteTree();return!t&&!n?this.dependencies.manager().pullAllFiles([...e]):this.dependencies.manager().pullAllFiles([...e],t,n)}async pullOne(e){await this.dependencies.manager().pullFile(e)}acceptRemoteConflict(e){return this.dependencies.manager().acceptRemoteConflict(e)}async deleteRemote(e,t){let i=await new it(this.dependencies.gitService(),this.dependencies.settings().branch).execute(e.map(s=>({path:s,repoPath:this.dependencies.normalizePath(s)})),(s,o)=>t==null?void 0:t(s,o.path));for(let s of i.deletedPaths)await this.clearMetadata(s),this.dependencies.manager().status.delete(s);return i}async deleteLocal(e){let t=this.dependencies.app.vault.getFileByPath(e);t instanceof Lt.TFile?await this.dependencies.app.fileManager.trashFile(t):await this.dependencies.app.vault.adapter.remove(e),await this.clearMetadata(e)}async moveLocal(e,t){await Ve(this.dependencies.app.vault.adapter,t);let n=this.dependencies.app.vault.getFileByPath(e);n instanceof Lt.TFile?await this.dependencies.app.fileManager.renameFile(n,t):(await this.dependencies.app.vault.adapter.rename(e,t),await this.trackRename(t,e))}clearMetadata(e){return this.dependencies.manager().clearMetadata(e)}trackRename(e,t){return this.dependencies.manager().trackRename(e,t)}getDiff(e){return this.dependencies.diffService.getDiff(e)}toRepoPath(e){return this.dependencies.normalizePath(e)}async planPush(e){let t=await this.reusableRemoteTree();return this.dependencies.manager().planSyncBatch([...e],void 0,t)}async planPull(e){let t=await this.reusableRemoteTree();return this.dependencies.manager().planPullBatch([...e],t)}async applyPull(e,t){let n=await this.reusableRemoteTree();return this.dependencies.manager().applyPullBatch([...e],void 0,n,t)}commitResolvedBatch(e,t,n,i,s,o){return this.dependencies.manager().commitResolvedBatch(e,t,n,i,s,o)}confirmPlan(e,t){return this.dependencies.manager().confirmPlan(e,t)}async reusableRemoteTree(){let e=this.remoteTreeSnapshot,t=this.dependencies.settings(),n=this.dependencies.gitService();if(!(!e||!n.getBranchHead||e.branch!==t.branch||e.rootPath!==t.rootPath))try{return await n.getBranchHead(e.branch)===e.head?e.entries:void 0}catch(i){return}}};var ot=class{constructor(){this.changes=[];this.byId=new Map;this.byPath=new Map;this.listeners=new Set}replace(e){this.changes=[...e],this.byId.clear(),this.byPath.clear();for(let t of this.changes)this.byId.set(t.id,t),this.byPath.set(t.path,t);for(let t of this.listeners)t(this.changes)}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}getAll(){return[...this.changes]}getById(e){return this.byId.get(e)}getByPath(e){return this.byPath.get(e)}};var rt=class{constructor(){this.status=new Map}start(e){this.status.set(e,"running")}succeed(e){this.status.set(e,"success")}fail(e){this.status.set(e,"failed")}reset(e){this.status.delete(e)}get(e){var t;return(t=this.status.get(e))!=null?t:"idle"}clear(){this.status.clear()}};var at=class{constructor(){this.status="idle";this.lastCheckedAt=0}start(e="manual"){this.status="loading",this.reason=e}fail(){this.status="failed"}succeed(){this.status="idle",this.lastCheckedAt=Date.now()}clear(){this.status="idle"}get(){return this.status}getReason(){return this.reason}getLastCheckedAt(){return this.lastCheckedAt}};var ct=class{constructor(){this.selected=new Set;this.actionOverrides=new Map}selectForSync(e){this.selected.add(e)}deselectFromSync(e){this.selected.delete(e),this.actionOverrides.delete(e)}selectMany(e){for(let t of e)this.selected.add(t)}deselectMany(e){for(let t of e)this.selected.delete(t),this.actionOverrides.delete(t)}isIncluded(e){return this.selected.has(e)}getSelectedChangeIds(){return[...this.selected]}setActionOverride(e,t){this.actionOverrides.set(e,t)}clearActionOverride(e){this.actionOverrides.delete(e)}getActionOverride(e){return this.actionOverrides.get(e)}reconcile(e){let t=new Map(e.map(n=>[n.id,n]));this.refresh([...t.keys()]);for(let[n,i]of this.actionOverrides){let s=t.get(n);s&&Y(s.kind,i)!==i&&this.actionOverrides.delete(n)}}refresh(e){let t=new Set(e);for(let n of this.selected)t.has(n)||(this.selected.delete(n),this.actionOverrides.delete(n));for(let n of this.actionOverrides.keys())t.has(n)||this.actionOverrides.delete(n)}};var Ms=new Set(["local-only","local-modified","local-deleted","moved"]),As=new Set(["remote-only","remote-modified"]);function Ds(r){return Ms.has(r.kind)}function Is(r){return As.has(r.kind)}function Ls(r){return r.kind==="conflict"}function Bs(r){return r.kind==="synced"}function Gs(r){return r.kind!=="synced"}function Yn(r,e,t){let n=r.filter(Ds),i=r.filter(Is),s=r.filter(Ls),o=r.filter(Bs),a=r.filter(Gs),c=new Set(e.getSelectedChangeIds()),h=a.filter(u=>c.has(u.id)),d={all:a.length,changes:n.length,"ready-to-push":h.length,"remote-changes":i.length,conflicts:s.length,synced:t?o.length:0};return{all:a,localChanges:n,remoteChanges:i,readyToPush:h,conflicts:s,synced:o,counts:d}}var Ns=new Set(["local-only","local-modified","local-deleted","moved"]),Os=new Set(["remote-only","remote-modified"]);function Xn(r,e,t){switch(e){case"all":return r.kind!=="synced";case"changes":return Ns.has(r.kind);case"ready-to-push":return t.isIncluded(r.id)&&r.kind!=="synced";case"remote-changes":return Os.has(r.kind);case"conflicts":return r.kind==="conflict";case"synced":return r.kind==="synced"}}var lt=class{constructor(e,t,n,i,s){this.changes=e;this.selectionStore=t;this.operations=n;this.refreshSource=i;this.refreshState=s}getState(e="all",t=!1){let n=this.changes.getAll(),i=Yn(n,this.selectionStore,t),s=n.filter(a=>Xn(a,e,this.selectionStore)).filter(()=>this.isRenderable(e,t)).map(a=>this.toItem(a)),o=i.readyToPush.map(a=>this.toItem(a));return{filter:e,items:s,syncQueue:o,refreshStatus:this.refreshState.get(),counts:i.counts}}getItem(e){let t=this.changes.getById(e);return t?this.toItem(t):void 0}async refresh(e="manual"){this.refreshState.start(e);try{await this.refreshSource(),this.refreshState.succeed()}catch(t){throw this.refreshState.fail(),t}}isRenderable(e,t){return!(e==="synced"&&!t)}toItem(e){let t=this.selectionStore.getActionOverride(e.id),n=Y(e.kind,t),i=t!==void 0&&t===n;return{id:e.id,path:e.path,previousPath:e.previousPath,kind:e.kind,isSelectedForSync:this.selectionStore.isIncluded(e.id),operationStatus:this.operations.get(e.id),syncAction:n,hasActionOverride:i}}};var dt=class{constructor(e,t,n,i={notify:()=>{}}){this.changes=e;this.operations=t;this.workspace=n;this.notifier=i}async execute(e){let t=this.resolveIntents(e);if(t.length===0)return;let n=t.map(a=>a.change),i=this.bucket(t),s;try{s=await this.planAndConfirm(i)}catch(a){this.failAll(n),this.notifier.notify({...Zn(),failed:n.length});return}if(!s||!s.confirmed)return;this.startAll(n);let o=Zn();$s(s.plannedPush,i.deleteRemote)&&await this.commitRemoteBucket(s.plannedPush,i.push,i.deleteRemote,o),i.pull.length>0&&await this.applyPullBucket(i.pull,o),this.notifier.notify(o)}resolveIntents(e){let t=[];for(let n of e){let i=this.changes.getById(n.changeId);i&&t.push({change:i,action:Y(i.kind,n.action)})}return t}bucket(e){let t={push:[],pull:[],deleteRemote:[]};for(let{change:n,action:i}of e)i==="pull"?t.pull.push(n):i==="delete-remote"?t.deleteRemote.push(n):t.push.push(n);return t}async planAndConfirm(e){let t=e.push.length>0?await this.workspace.planPush(e.push.map(o=>o.path)):Hs();if(t.cancelled)return null;let n=e.pull.length>0?await this.workspace.planPull(e.pull.map(o=>o.path)):_s(),i=e.deleteRemote.map(o=>({path:o.path,name:ei(o.path)})),s={additions:t.reviewPlan.additions,modifications:t.reviewPlan.modifications,moves:t.reviewPlan.moves,deletions:i,downloads:[...n.additions,...n.modifications],acceptedRemote:t.reviewPlan.acceptedRemote,skippedConflicts:t.reviewPlan.skippedConflicts};return L(s)?null:{plannedPush:t,confirmed:await this.workspace.confirmPlan(s,"sync")}}async commitRemoteBucket(e,t,n,i){let s=[...t,...n];try{let o=n.map(h=>({path:h.path,name:ei(h.path),repoPath:this.workspace.toRepoPath(h.path)})),a={success:e.immediate.success,added:0,updated:e.immediate.updated,failed:e.immediate.failed,conflicts:0,resolvedConflicts:0,skippedConflicts:0,errors:[...e.immediate.errors],syncedPaths:[...e.immediate.syncedPaths]};await this.workspace.commitResolvedBatch(e.pushes,e.moves,o,e.keepRemote,e.keepLocal,a);let c=new Set(a.errors.map(h=>h.file));this.finishAll(s,h=>c.has(h)?"failed":"success"),Vs(i,e,o,a)}catch(o){this.failAll(s),i.failed+=s.length}}async applyPullBucket(e,t){try{let n=await this.workspace.applyPull(e.map(s=>s.path),{notify:!1}),i=new Set(n.errors.map(s=>s.file));this.finishAll(e,s=>i.has(s)?"failed":"success"),t.downloaded+=n.added+n.updated,t.failed+=n.failed,t.conflicts+=n.conflicts,t.errors.push(...n.errors)}catch(n){this.failAll(e),t.failed+=e.length}}startAll(e){for(let t of e)this.operations.start(t.id)}finishAll(e,t){for(let n of e)t(n.path)==="success"?this.operations.succeed(n.id):this.operations.fail(n.id)}failAll(e){for(let t of e)this.operations.fail(t.id)}};function $s(r,e){return r.pushes.length>0||r.moves.length>0||r.keepRemote.length>0||r.keepLocal.length>0||e.length>0}function Hs(){return{reviewPlan:{additions:[],modifications:[],deletions:[],moves:[]},pushes:[],moves:[],keepRemote:[],keepLocal:[],skippedConflicts:0,conflictedPaths:[],cancelled:!1,immediate:{success:0,updated:0,failed:0,errors:[],syncedPaths:[]}}}function _s(){return{additions:[],modifications:[],deletions:[],moves:[]}}function Zn(){return{added:0,updated:0,moved:0,deleted:0,downloaded:0,acceptedRemote:0,failed:0,conflicts:0,skippedConflicts:0,errors:[]}}function Vs(r,e,t,n){let i=new Set(n.errors.map(s=>s.file));r.added+=e.pushes.filter(s=>!s.existingSha&&!i.has(s.path)).length,r.updated+=e.pushes.filter(s=>s.existingSha&&!i.has(s.path)).length+e.immediate.updated,r.moved+=e.moves.filter(s=>!i.has(s.path)).length,r.deleted+=t.filter(s=>!i.has(s.path)).length,r.acceptedRemote+=e.keepRemote.filter(s=>!i.has(s.path)).length,r.failed+=n.failed,r.conflicts+=n.conflicts,r.skippedConflicts+=n.skippedConflicts,r.errors.push(...n.errors)}function ei(r){let e=r.lastIndexOf("/");return e===-1?r:r.slice(e+1)}var ht=class{constructor(e,t,n,i,s={notify:()=>{}}){this.changes=e;this.selection=t;this.operations=n;this.workspace=i;this.syncResultNotifier=s;this.syncIntentExecutor=new dt(e,n,i,s)}selectForSync(e){this.selection.selectForSync(e)}deselectFromSync(e){this.selection.deselectFromSync(e)}selectMany(e){this.selection.selectMany(e)}deselectMany(e){this.selection.deselectMany(e)}setSyncAction(e,t){let n=this.changes.getById(e);n&&(t===pn(n.kind)?this.selection.clearActionOverride(e):this.selection.setActionOverride(e,t))}clearSyncAction(e){this.selection.clearActionOverride(e)}async push(e){let t=this.resolve(e);if(t.length!==0){this.startAll(t);try{let n=await this.workspace.push(t.map(s=>s.path)),i=new Set(n.errors.map(s=>s.file));this.finishAll(t,s=>i.has(s)?"failed":"success")}catch(n){this.failAll(t)}}}async pull(e){let t=this.resolve(e);if(t.length!==0){this.startAll(t);try{let n=await this.workspace.pull(t.map(s=>s.path)),i=new Set(n.errors.map(s=>s.file));this.finishAll(t,s=>i.has(s)?"failed":"success")}catch(n){this.failAll(t)}}}async deleteRemote(e){let t=this.resolve(e);if(t.length!==0){this.startAll(t);try{let n=await this.workspace.deleteRemote(t.map(s=>s.path)),i=new Set(n.errors.map(s=>s.path));this.finishAll(t,s=>i.has(s)?"failed":"success")}catch(n){this.failAll(t)}}}async sync(e){await this.syncIntentExecutor.execute(e)}async deleteLocal(e){let t=this.resolve(e);for(let n of t){this.operations.start(n.id);try{await this.workspace.deleteLocal(n.path),this.operations.succeed(n.id)}catch(i){this.operations.fail(n.id)}}}async resolveConflict(e,t){let n=this.changes.getById(e);if(n){this.operations.start(e);try{if(t==="local"){let i=await this.workspace.push([n.path]);if(i.errors.length>0)throw new Error(i.errors.map(s=>s.error).join("; "));this.operations.succeed(e),this.syncResultNotifier.notify({...Bt(),updated:1})}else await this.workspace.acceptRemoteConflict(n.path),this.operations.succeed(e),this.syncResultNotifier.notify({...Bt(),acceptedRemote:1})}catch(i){this.operations.fail(e),this.syncResultNotifier.notify({...Bt(),failed:1})}}}async loadDiffContent(e){let t=await this.workspace.getDiff(e.path);return typeof t.remoteContent!="string"||typeof t.localContent!="string"?null:{remote:t.remoteContent,local:t.localContent}}resolve(e){let t=[];for(let n of e){let i=this.changes.getById(n);i&&t.push(i)}return t}startAll(e){for(let t of e)this.operations.start(t.id)}finishAll(e,t){for(let n of e)t(n.path)==="success"?this.operations.succeed(n.id):this.operations.fail(n.id)}failAll(e){for(let t of e)this.operations.fail(t.id)}};function Bt(){return{added:0,updated:0,moved:0,deleted:0,downloaded:0,acceptedRemote:0,failed:0,conflicts:0,skippedConflicts:0,errors:[]}}var qs={added:"sourceControl.notice.sync.added",updated:"sourceControl.notice.sync.updated",moved:"sourceControl.notice.sync.moved",deleted:"sourceControl.notice.sync.deleted",downloaded:"sourceControl.notice.sync.downloaded",acceptedRemote:"sourceControl.notice.sync.acceptedRemote",failed:"sourceControl.notice.sync.failedCount",conflicts:"sourceControl.notice.sync.conflicts",skippedConflicts:"sourceControl.notice.sync.skippedConflicts"},ut=class{constructor(e){this.showNotice=e}notify(e){let t=this.summary(e);t&&this.showNotice(l(this.messageKey(e),{details:t}))}messageKey(e){return e.failed>0||e.conflicts>0||e.skippedConflicts>0?this.hasSuccessfulWork(e)?"sourceControl.notice.sync.partial":"sourceControl.notice.sync.failed":"sourceControl.notice.sync.success"}hasSuccessfulWork(e){return e.added+e.updated+e.moved+e.deleted+e.downloaded+e.acceptedRemote>0}summary(e){return[this.count(e.added,"added"),this.count(e.updated,"updated"),this.count(e.moved,"moved"),this.count(e.deleted,"deleted"),this.count(e.downloaded,"downloaded"),this.count(e.acceptedRemote,"acceptedRemote"),this.count(e.failed,"failed"),this.count(e.conflicts,"conflicts"),this.count(e.skippedConflicts,"skippedConflicts")].filter(n=>n!==void 0).join(", ")}count(e,t){if(e!==0)return l(qs[t],{count:e})}};var Us={synced:"synced",modified:"local-modified","remote-modified":"remote-modified",unsynced:"local-only","remote-only":"remote-only","local-deleted":"local-deleted",moved:"moved"};function ti(r){let e=[];for(let t of r)t.status!=="checking"&&e.push({id:t.path,path:t.path,previousPath:t.movedFrom,kind:Us[t.status]});return e}var ii=require("obsidian");var B=require("obsidian");var pt=require("obsidian");function zs(r){let e=r.setDestructive;return typeof e=="function"&&e.call(r),r}var ie=class extends pt.Modal{constructor(e,t,n,i,s){super(e),this.fileName=t,this.localContent=n,this.remoteContent=i,this.onChoose=s,this.isBinary=b(t)||typeof n!="string"||typeof i!="string"}onOpen(){let{contentEl:e,modalEl:t}=this;t.addClass("gfs-conflict-modal"),t.addClass("gfs-conflict-modal--single"),t.addClass("gfs-diff-surface");let n=e.createDiv({cls:"conflict-header"});if(n.createEl("h2",{text:l("syncConflictModal.title",{fileName:this.fileName})}),n.createEl("p",{text:l("syncConflictModal.description"),cls:"conflict-description"}),this.isBinary){e.createDiv({cls:"conflict-content-area"}).createEl("p",{text:l("syncConflictModal.binaryChanged"),cls:"conflict-binary-notice"}),this.renderButtons(e);return}this.renderTextComparison(e),this.renderButtons(e)}renderButtons(e){let t=e.createDiv({cls:"conflict-buttons"});new pt.Setting(t).addButton(n=>n.setButtonText(l("syncConflictModal.keepLocal")).setTooltip(l("syncConflictModal.keepLocal.tooltip")).setCta().onClick(()=>{this.onChoose("local"),this.close()})).addButton(n=>zs(n).setButtonText(l("syncConflictModal.keepRemote")).setTooltip(l("syncConflictModal.keepRemote.tooltip")).onClick(()=>{this.onChoose("remote"),this.close()})).addButton(n=>n.setButtonText(l("syncConflictModal.cancel")).onClick(()=>{this.close()}))}renderTextComparison(e){let t=this.localContent,n=this.remoteContent,i=e.createDiv({cls:"conflict-diff-header"});i.createEl("h3",{text:l("syncConflictModal.differences")});let s=i.createDiv({cls:"conflict-diff-header-toggle"}),a=e.createDiv({cls:"conflict-content-area"}).createDiv({cls:"conflict-diff-section"});j(a,{remote:n,local:t,layout:W(),toggleHost:s,onLayoutChange:Q})}onClose(){let{contentEl:e}=this;e.empty()}};function ni(r){return{...r,id:r.path}}var ft=class extends B.Modal{constructor(t,n,i,s,o,a,c){super(t);this.loadConflictDiff=a;this.rowRadios=new Map;this.statSlots=new Map;this.diffLoaders=new Map;this.conflicts=n,this.safeCount=i,this.onResolve=s,this.onCancel=o,this.diffStat=c?new J(c,()=>this.settleStats()):void 0}onOpen(){var a;let{contentEl:t,modalEl:n}=this;n.addClass("gfs-conflict-modal"),n.addClass("gfs-conflict-modal--batch"),n.addClass("gfs-diff-surface"),t.createEl("h2",{text:l("batchConflictModal.title",{count:this.conflicts.length})}),this.safeCount>0&&t.createEl("p",{cls:"conflict-description",text:l("batchConflictModal.description",{safeCount:this.safeCount})});let i=t.createDiv({cls:"batch-conflict-bulk-actions"});new B.ButtonComponent(i).setButtonText(l("batchConflictModal.keepLocalAll")).onClick(()=>this.setAllResolutions("keep-local")),new B.ButtonComponent(i).setButtonText(l("batchConflictModal.keepRemoteAll")).onClick(()=>this.setAllResolutions("keep-remote")),new B.ButtonComponent(i).setButtonText(l("batchConflictModal.skipAll")).onClick(()=>this.setAllResolutions("skip"));let s=t.createDiv({cls:"batch-conflict-row-list"});for(let c of this.conflicts)this.renderRow(s,c);let o=t.createDiv({cls:"conflict-buttons batch-conflict-buttons"});new B.ButtonComponent(o).setButtonText(l("batchConflictModal.cancel")).onClick(()=>{this.close(),this.onCancel()}),this.continueBtn=new B.ButtonComponent(o).setButtonText(l("batchConflictModal.continue")).setCta().setTooltip(l("batchConflictModal.unresolvedWarning")).onClick(()=>{this.allResolved()&&(this.close(),this.onResolve())}),this.updateContinueState(),(a=this.diffStat)==null||a.loadVisible(this.conflicts.map(ni))}renderRow(t,n){let i=t.createDiv({cls:"batch-conflict-row"});i.setAttribute("title",n.path);let s=i.createDiv({cls:"batch-conflict-row-info"}),o=s.createDiv({cls:"batch-conflict-row-name-line"});o.createSpan({cls:"batch-conflict-row-name",text:n.name});let a=o.createSpan({cls:"batch-conflict-row-stat"});this.statSlots.set(n.path,a),this.paintStat(n),s.createDiv({cls:"batch-conflict-row-dir",text:Ks(n.path)}),b(n.path)&&s.createSpan({cls:"batch-conflict-row-binary-badge",text:l("batchConflictModal.row.binary")});let c=i.createDiv({cls:"batch-conflict-row-actions"});c.createEl("button",{cls:"batch-conflict-view-diff",text:l("batchConflictModal.row.viewDiff")}).addEventListener("click",()=>{this.openDiff(n)});let d=c.createDiv({cls:"batch-conflict-row-radios"}),u={},f=[{value:"keep-local",labelKey:"batchConflictModal.row.keepLocal"},{value:"keep-remote",labelKey:"batchConflictModal.row.keepRemote"},{value:"skip",labelKey:"batchConflictModal.row.skip"}];for(let p of f){let m=d.createEl("label",{cls:"batch-conflict-radio-label"}),y=m.createEl("input");y.type="radio",y.name=`batch-conflict-${n.path}`,y.checked=n.resolution===p.value,y.addEventListener("change",()=>{y.checked&&(n.resolution=p.value,this.updateContinueState())}),m.createSpan({text:l(p.labelKey)}),u[p.value]=y}this.rowRadios.set(n.path,u)}paintStat(t){var i;let n=this.statSlots.get(t.path);n&&(n.empty(),Pt(n,(i=this.diffStat)==null?void 0:i.get(t.path)))}settleStats(){for(let t of this.conflicts)this.paintStat(t)}setAllResolutions(t){for(let n of this.conflicts){n.resolution=t;let i=this.rowRadios.get(n.path);i&&Object.keys(i).forEach(s=>{i[s].checked=s===t})}this.updateContinueState()}allResolved(){return this.conflicts.every(t=>!!t.resolution)}updateContinueState(){this.continueBtn&&this.continueBtn.setDisabled(!this.allResolved())}async openDiff(t){let n=this.diffLoaders.get(t.path);if(n){await n.catch(()=>{});return}let i=(async()=>{var o;if(!this.loadConflictDiff)return;let s=await this.loadConflictDiff({path:t.path,localContent:t.localContent,remoteSha:t.remoteSha,repoPath:t.repoPath}).catch(()=>{});s&&((o=this.diffStat)==null||o.lazyLoad(ni(t)).catch(()=>{}),new ie(this.app,t.name,s.localContent,s.remoteContent,a=>{t.resolution=a==="local"?"keep-local":"keep-remote";let c=this.rowRadios.get(t.path);c&&Object.keys(c).forEach(h=>{c[h].checked=h===t.resolution}),this.updateContinueState()}).open())})();this.diffLoaders.set(t.path,i);try{await i}finally{this.diffLoaders.delete(t.path)}}onClose(){var n;let{contentEl:t}=this;(n=this.diffStat)==null||n.dispose(),t.empty(),this.rowRadios.clear(),this.statSlots.clear()}};function Ks(r){let e=r.lastIndexOf("/");return e===-1?"":r.slice(0,e)}var G=require("obsidian");var Ws=[{key:"additions",icon:g.addition,titleKey:"syncPlanModal.section.additions",destructive:!1},{key:"modifications",icon:g.modified,titleKey:"syncPlanModal.section.modifications",destructive:!1},{key:"moves",icon:g.moved,titleKey:"syncPlanModal.section.moves",destructive:!1},{key:"downloads",icon:g.pull,titleKey:"syncPlanModal.section.downloads",destructive:!1},{key:"acceptedRemote",icon:g.pull,titleKey:"syncPlanModal.section.acceptedRemote",destructive:!1},{key:"skippedConflicts",icon:g.clear,titleKey:"syncPlanModal.section.skippedConflicts",destructive:!1},{key:"deletions",icon:g.delete,titleKey:"syncPlanModal.section.deletions",destructive:!0}],gt=class extends G.Modal{constructor(e,t,n,i,s,o){super(e),this.plan=t,this.direction=n,this.onConfirm=i,this.onCancel=s,this.description=o}onOpen(){var s;let{contentEl:e}=this;e.addClass("sync-plan-modal"),e.createEl("h2",{text:l(`syncPlanModal.title.${this.direction}`)}),this.description&&e.createEl("p",{text:this.description,cls:"sync-plan-description"});let t=e.createDiv({cls:"sync-plan-sections"});for(let o of Ws){let a=(s=this.plan[o.key])!=null?s:[];a.length!==0&&this.renderSection(t,o.titleKey,o.icon,a,o.destructive)}let n=e.createDiv({cls:"sync-plan-buttons modal-button-container"});new G.ButtonComponent(n).setButtonText(l("syncPlanModal.cancel")).onClick(()=>{this.close(),this.onCancel&&this.onCancel()});let i=new G.ButtonComponent(n).setButtonText(l("syncPlanModal.confirm")).setCta().onClick(()=>{this.close(),this.onConfirm()});if(this.plan.deletions.length>0){let o=i.setWarning;typeof o=="function"&&o.call(i)}}renderSection(e,t,n,i,s){let o=e.createDiv({cls:`sync-plan-section${s?" is-destructive":""}`}),a=o.createDiv({cls:"sync-plan-section-heading"}),c=a.createSpan({cls:"sync-plan-section-icon"});(0,G.setIcon)(c,n),a.createSpan({text:`${l(t)} (${i.length})`}),s&&o.createDiv({cls:"sync-plan-warning",text:l("syncPlanModal.deletionWarning",{count:i.length})});let h=o.createEl("ul",{cls:"sync-plan-file-list"});for(let d of i){let u=h.createEl("li",{cls:"sync-plan-file-item"}),f=u.createDiv({cls:"sync-plan-file-row"});(0,G.setIcon)(f.createSpan({cls:"sync-plan-file-icon"}),n),f.createSpan({cls:"sync-plan-file-path",text:d.path}),d.movedFrom&&u.createSpan({cls:"sync-plan-file-moved-from",text:l("syncPlanModal.movedFrom",{path:d.movedFrom})})}}onClose(){let{contentEl:e}=this;e.empty()}};var mt=class{constructor(e){this.app=e}confirmPlan(e,t){return new Promise(n=>{new gt(this.app,e,t,()=>n(!0),()=>n(!1)).open()})}openConflict(e,t,n,i){new ie(this.app,e,t,n,i).open()}resolveBatchConflicts(e,t,n,i){return new Promise(s=>{new ft(this.app,e,t,()=>s(!0),()=>s(!1),n,i).open()})}notify(e,t){new ii.Notice(e,t)}};function si(r){let e=new de(r.app,r.gitService,r.settings,r.saveSettings,r.isIgnored,void 0,new mt(r.app)),t=new he({app:r.app,settings:r.getSettings,gitService:r.getGitService,gitignoreManager:r.getGitignoreManager,syncManager:()=>e,filterFilesByVaultFolder:p=>r.filterFilesByVaultFolder(p),filterPathByVaultFolder:p=>r.filterPathByVaultFolder(p),getNormalizedPath:p=>r.getNormalizedPath(p),getVaultPath:p=>r.getVaultPath(p)},e.status),n=new ue(e.status,(p,m)=>r.getGitService().getBlob(p,m));e.setConflictDiffStatLoader(p=>n.getConflictStat(p)),e.setConflictDiffLoader(p=>n.getConflictDiff(p));let i=new st({manager:()=>e,gitService:r.getGitService,settings:r.getSettings,refreshService:t,diffService:n,normalizePath:p=>r.getNormalizedPath(p),app:r.app}),s=new ot,o=new ct,a=new rt,c=new at,h=new lt(s,o,a,()=>i.refresh(),c),d=new ht(s,o,a,i,new ut(r.notify)),u=s.subscribe(p=>o.reconcile(p)),f=e.status.subscribe(p=>{let m=ti([...p.values()]);s.replace(m)});return{sync:e,syncStatusRefresh:t,syncDiffService:n,syncWorkspace:i,changeRepository:s,syncSelectionStore:o,operationState:a,refreshState:c,sourceControlViewModel:h,sourceControlActions:d,dispose:()=>{f(),u()}}}var yt=class extends v.Plugin{constructor(){super(...arguments);this.gitignoreConfigKey="";this.connectionStatus={state:"checking"};this.connectionStatusListeners=new Set;this.connectionTestSeq=0}async onload(){await this.loadSettings(),this.addSettingTab(new ve(this.app,this,this)),this.registerView(ce,n=>new ae(n,this)),this.registerView(V,n=>new Z(n)),this.addRibbonIcon("git-compare",l("main.ribbon.openSyncStatus"),async()=>{await this.activateSourceControlView()}),this.addCommand({id:"open-sync-status",name:l("main.command.openSyncStatus"),callback:async()=>{await this.activateSourceControlView()}}),this.initializeGitService(),this.updateGitignoreManager();let t=si({app:this.app,gitService:this.gitService,getGitService:()=>this.gitService,settings:this.settings,getSettings:()=>this.settings,saveSettings:this.saveSettings.bind(this),getGitignoreManager:()=>this.gitignoreManager,isIgnored:n=>this.gitignoreManager.isIgnored(this.getNormalizedPath(n)),filterFilesByVaultFolder:n=>this.filterFilesByVaultFolder(n),filterPathByVaultFolder:n=>this.filterPathByVaultFolder(n),getNormalizedPath:n=>this.getNormalizedPath(n),getVaultPath:n=>this.getVaultPath(n),notify:n=>new v.Notice(n)});this.sync=t.sync,this.syncStatusRefresh=t.syncStatusRefresh,this.syncDiffService=t.syncDiffService,this.syncWorkspace=t.syncWorkspace,this.changeRepository=t.changeRepository,this.syncSelectionStore=t.syncSelectionStore,this.operationState=t.operationState,this.refreshState=t.refreshState,this.sourceControlViewModel=t.sourceControlViewModel,this.sourceControlActions=t.sourceControlActions,this.disposeSyncRuntime=()=>t.dispose(),this.statusBarEl=this.addStatusBarItem(),this.statusBarEl.addClass("gfs-status-bar-connection"),(0,v.setTooltip)(this.statusBarEl,l("settings.connectionStatus.checking")),this.registerDomEvent(this.statusBarEl,"click",()=>{this.testConnection()}),this.onConnectionStatusChange(n=>this.renderStatusBarConnection(n)),this.testConnection(),this.pushRibbonEl=this.addRibbonIcon("upload-cloud",this.pushRibbonLabel(),async()=>{let n=this.app.workspace.getActiveViewOfType(v.MarkdownView);n&&n.file instanceof v.TFile?await this.sync.pushFiles([n.file]):new v.Notice(l("main.notice.noActiveNote"))}),this.addCommand({id:"push-current-file",name:l("main.command.pushCurrentFile"),callback:async()=>{let n=this.app.workspace.getActiveViewOfType(v.MarkdownView);n&&n.file instanceof v.TFile&&await this.sync.pushFiles([n.file])}}),this.addCommand({id:"pull-current-file",name:l("main.command.pullCurrentFile"),callback:async()=>{let n=this.app.workspace.getActiveViewOfType(v.MarkdownView);n&&n.file instanceof v.TFile&&await this.sync.pullFile(n.file)}}),this.addCommand({id:"push-all-files",name:l("main.command.pushAllFiles"),callback:async()=>{await this.pushAllFiles()}}),this.addCommand({id:"pull-all-files",name:l("main.command.pullAllFiles"),callback:async()=>{await this.pullAllFiles()}}),this.registerEvent(this.app.workspace.on("file-menu",(n,i)=>{i instanceof v.TFile&&(n.addItem(s=>{s.setTitle(l("main.contextMenu.pushTo",{service:this.serviceName})).setIcon("upload-cloud").onClick(async()=>{await this.sync.pushFiles([i])})}),n.addItem(s=>{s.setTitle(l("main.contextMenu.pullFrom",{service:this.serviceName})).setIcon("download-cloud").onClick(async()=>{await this.sync.pullFile(i)})}))})),this.registerEvent(this.app.vault.on("rename",(n,i)=>{n instanceof v.TFile?this.sync.trackRename(n.path,i).then(()=>{this.syncStatusRefresh.handleFileRenamed(n,i)}):n instanceof v.TFolder&&this.trackFolderRename(n,i)})),this.registerEvent(this.app.vault.on("modify",n=>{n instanceof v.TFile&&this.filterPathByVaultFolder(n.path)&&this.syncStatusRefresh.handleFileModified(n)})),this.registerEvent(this.app.vault.on("create",n=>{n instanceof v.TFile&&this.filterPathByVaultFolder(n.path)&&this.syncStatusRefresh.handleFileCreated(n)})),this.registerEvent(this.app.vault.on("delete",n=>{n instanceof v.TFile&&this.filterPathByVaultFolder(n.path)&&this.syncStatusRefresh.handleFileDeleted(n.path)})),this.app.workspace.onLayoutReady(()=>{this.normalizeSourceControlLeaves(),this.settings.autoRefreshOnStartup&&this.refreshSyncStatusOnStartup()}),await this.checkForUpdateNotice()}async refreshSyncStatusOnStartup(){await this.activateSourceControlView(),await this.sourceControlViewModel.refresh("startup")}async trackFolderRename(t,n){let i=t.path+"/",s=n+"/",o=this.app.vault.getFiles().filter(a=>a.path.startsWith(i));for(let a of o){let c=s+a.path.slice(i.length);await this.sync.trackRename(a.path,c),this.syncStatusRefresh.handleFileRenamed(a,c)}}async checkForUpdateNotice(){try{let t=this.manifest.version,n=this.settings.lastSeenVersion;if(n&&se(t,n)>0){let i=jt(U,n);i.length>0&&new O(this.app,i,()=>{this.activateSourceControlView()}).open()}n!==t&&(this.settings.lastSeenVersion=t,await this.saveSettings())}catch(t){S.warn("Failed to check for update notice",t)}}get serviceName(){return x(this.settings)}onConnectionStatusChange(t){return this.connectionStatusListeners.add(t),t(this.connectionStatus),()=>this.connectionStatusListeners.delete(t)}setConnectionStatus(t){this.connectionStatus=t;for(let n of this.connectionStatusListeners)n(t)}async testConnection(){var n;let t=++this.connectionTestSeq;this.setConnectionStatus({state:"checking"});try{let i=await this.gitService.testConnection(this.settings.branch);return t!==this.connectionTestSeq||(i.repoOk?i.branchOk?this.setConnectionStatus({state:"connected"}):this.setConnectionStatus({state:"disconnected",detail:l("settings.testConnection.branchNotFound.badge",{branch:this.settings.branch})}):this.setConnectionStatus({state:"disconnected",detail:(n=i.error)!=null?n:l("settings.testConnection.failed.unreachable")})),i}catch(i){if(t===this.connectionTestSeq){let s=i instanceof Error?i.message:String(i);this.setConnectionStatus({state:"disconnected",detail:s})}throw i}}renderStatusBarConnection(t){let n=this.statusBarEl;if(!n)return;n.empty(),n.removeClass("is-checking","is-connected","is-disconnected"),n.addClass(`is-${t.state}`);let i={checking:"loader",connected:"check-circle",disconnected:"alert-circle"};(0,v.setIcon)(n.createSpan({cls:"gfs-status-bar-icon"}),i[t.state]);let s={checking:l("settings.connectionStatus.checking"),connected:l("settings.connectionStatus.connected"),disconnected:l("settings.connectionStatus.disconnected")};n.createSpan({text:` ${this.serviceName}: ${s[t.state]}`}),(0,v.setTooltip)(n,t.detail?l("settings.connectionStatus.withDetail",{label:s[t.state],detail:t.detail}):s[t.state])}pushRibbonLabel(){return v.Platform.isMobile?l("main.ribbon.push"):l("main.ribbon.pushTo",{service:this.serviceName})}updateRibbonTooltip(){this.pushRibbonEl&&(0,v.setTooltip)(this.pushRibbonEl,this.pushRibbonLabel())}async activateSourceControlView(){if(this.sourceControlActivation)return this.sourceControlActivation;this.sourceControlActivation=this.doActivateSourceControlView();try{await this.sourceControlActivation}finally{this.sourceControlActivation=void 0}}async doActivateSourceControlView(){var i;let{workspace:t}=this.app,n=this.normalizeSourceControlLeaves();if(!n){let s=t.getRightLeaf(!1);s&&(await s.setViewState({type:ce,active:!0}),n=s,n=(i=this.normalizeSourceControlLeaves())!=null?i:n)}n&&await t.revealLeaf(n)}normalizeSourceControlLeaves(){let t=this.app.workspace.getLeavesOfType(ce);if(t.length===0)return null;let n=this.app.workspace.getActiveViewOfType(ae),i=t[0];n!=null&&n.leaf&&t.includes(n.leaf)&&(i=n.leaf);for(let s of t)s!==i&&s.detach();return i!=null?i:null}async openDiffTab(t,n){let{workspace:i}=this.app,s=i.getLeavesOfType(V)[0];s||(s=i.getLeaf("tab"),await s.setViewState({type:V,active:!0}));let o=s.view;o instanceof Z&&o.setDiff(t,n),await i.revealLeaf(s)}diffTabPath(){var t,n;return(n=(t=this.app.workspace.getLeavesOfType(V).map(i=>i.view).find(i=>i instanceof Z))==null?void 0:t.getPath())!=null?n:null}async pushAllFiles(){await this.runAllFiles("push")}async pullAllFiles(){await this.runAllFiles("pull")}async listAllFilesFromAdapter(t){let n=[];try{let{files:i,folders:s}=await this.app.vault.adapter.list(t||"");n.push(...i);for(let o of s){let a=await this.listAllFilesFromAdapter(o);n.push(...a)}}catch(i){}return n}async runAllFiles(t){let n=this.settings.vaultFolder||"",i=await this.listAllFilesFromAdapter(n),s;try{s=await this.gitService.listFilesDetailed(this.settings.branch,!1)}catch(u){S.warn("Failed to fetch remote tree; falling back to per-call fetches",u)}await this.gitignoreManager.loadGitignores(s);let o=i.filter(u=>!this.gitignoreManager.isIgnored(this.getNormalizedPath(u)));if(o.length===0){new v.Notice(l("main.notice.noFilesToRun",{op:t==="push"?l("main.op.push"):l("main.op.pull")}));return}let a=t==="push"?l("main.confirm.pushAll",{count:o.length,service:this.serviceName}):l("main.confirm.pullAll",{count:o.length,service:this.serviceName});if(!await this.showConfirmDialog(a))return;let h=t==="push"?l("main.verb.pushing"):l("main.verb.pulling"),d=new v.Notice(l("main.progress.running",{verb:h,total:o.length}),0);try{let u=t==="push"?await this.sync.pushFiles(o,(f,p,m)=>{d.setMessage(l("main.progress.step",{verb:l("main.verb.pushing"),current:f,total:p,fileName:m}))},s):await this.sync.pullAllFiles(o,(f,p,m)=>{d.setMessage(l("main.progress.step",{verb:l("main.verb.pulling"),current:f,total:p,fileName:m}))},s);d.hide(),u.errors.length>0&&S.error(`${t} errors:`,u.errors)}catch(u){d.hide(),S.error(String(u));let f=t==="push"?l("main.verb.push"):l("main.verb.pull");new v.Notice(l("main.notice.runFailed",{verb:f,message:u instanceof Error?u.message:String(u)}))}}filterFilesByVaultFolder(t){return qn(t,this.settings.vaultFolder)}filterPathByVaultFolder(t){return It(t,this.settings.vaultFolder)}getNormalizedPath(t){return Ke(t,this.settings.vaultFolder)}getVaultPath(t){return Un(t,this.settings.vaultFolder)}initializeGitService(){if(this.settings.serviceType==="gitlab"){let t=new Ce;t.updateConfig(this.settings.gitlabBaseUrl,this.settings.gitlabToken,this.settings.projectId,this.settings.rootPath),this.gitService=t}else if(this.settings.serviceType==="gitea"){let t=new Pe;t.updateConfig(this.settings.giteaBaseUrl,this.settings.giteaToken,this.settings.giteaOwner,this.settings.giteaRepo,this.settings.rootPath),this.gitService=t}else{let t=new we;t.updateConfig(this.settings.githubToken,this.settings.githubOwner,this.settings.githubRepo,this.settings.rootPath),this.gitService=t}this.sync&&this.sync.updateGitService(this.gitService)}updateGitignoreManager(){let t=JSON.stringify([this.settings.branch,this.settings.rootPath,this.settings.vaultFolder,this.settings.ignorePatterns]);this.gitignoreConfigKey!==t&&(this.gitignoreManager=new $e(this.app,this.gitService,this.settings.branch,this.settings.rootPath,this.settings.vaultFolder,this.settings.ignorePatterns),this.gitignoreConfigKey=t)}showConfirmDialog(t){return new Promise(n=>{new X(this.app,t,()=>n(!0),()=>n(!1)).open()})}onunload(){var t;(t=this.disposeSyncRuntime)==null||t.call(this),this.disposeSyncRuntime=void 0}async loadSettings(){this.settings=Object.assign({},Nt,await this.loadData()),ye(this.settings.language)}async saveSettings(){await this.saveData(this.settings),this.initializeGitService(),this.updateGitignoreManager(),this.updateRibbonTooltip()}};
|
|
|
|
/* nosourcemap */ |