vault backup: 2026-09-29 23:28:16
This commit is contained in:
1 parent
c82807bc68
commit
ffa27be971
19 files changed
+4324
-1982
No files matched your search
Vendored
+2985
-1315
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "harper",
|
||||
"name": "Harper",
|
||||
"version": "0.70.0",
|
||||
"version": "2.11.0",
|
||||
"minAppVersion": "1.7.7",
|
||||
"description": "The Grammar Checker for Developers",
|
||||
"author": "Elijah Potter",
|
||||
|
||||
+459
-346
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "mermaid-tools",
|
||||
"name": "Mermaid Tools",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.1",
|
||||
"minAppVersion": "1.4.0",
|
||||
"description": "Improved Mermaid.js experience for Obsidian: visual toolbar with common elements & more",
|
||||
"author": "dartungar",
|
||||
|
||||
+118
-7
@@ -29,6 +29,21 @@
|
||||
background-color: var(--interactive-hover);
|
||||
}
|
||||
|
||||
.mermaid-toolbar-element-error,
|
||||
.mermaid-tools-render-error {
|
||||
color: var(--text-muted);
|
||||
border: 1px dashed var(--background-modifier-border);
|
||||
background-color: var(--background-secondary);
|
||||
}
|
||||
|
||||
.mermaid-toolbar-element-error-message,
|
||||
.mermaid-tools-render-error-message {
|
||||
margin-top: 4px;
|
||||
font-size: var(--font-ui-smaller);
|
||||
color: var(--text-error);
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.mermaid-tools-element-category-header::before {
|
||||
content: "▼ ";
|
||||
font-size: 70%;
|
||||
@@ -42,8 +57,11 @@
|
||||
}
|
||||
|
||||
.mermaid-tools-element-container {
|
||||
padding-top: 6px;
|
||||
margin-bottom: 10px;
|
||||
padding: 10px;
|
||||
border-bottom: var(--border-width) solid var(--color-base-35);
|
||||
border-radius: 5px;
|
||||
background-color: var(--background-secondary);
|
||||
}
|
||||
|
||||
.mermaid-tools-edit-element-modal > div {
|
||||
@@ -54,6 +72,99 @@
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
.mermaid-tools-element-preview {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.mermaid-tools-element-description-input {
|
||||
min-width: 50%;
|
||||
}
|
||||
|
||||
.mermaid-tools-element-content-input {
|
||||
height: 200px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.mermaid-tools-actions-row {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.mermaid-tools-category-section {
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid var(--background-modifier-border);
|
||||
border-radius: 8px;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.mermaid-tools-category-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.mermaid-tools-category-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.mermaid-tools-expand-icon {
|
||||
font-size: 12px;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.mermaid-tools-expand-icon.is-collapsed {
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
.mermaid-tools-category-name {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.mermaid-tools-category-info {
|
||||
color: var(--text-muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.mermaid-tools-category-controls {
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.mermaid-tools-icon-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 4px;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.mermaid-tools-icon-button:hover {
|
||||
background-color: var(--background-modifier-hover);
|
||||
}
|
||||
|
||||
.mermaid-tools-icon-button:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.45;
|
||||
}
|
||||
|
||||
.mermaid-tools-elements-container.is-collapsed {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.mermaid-tools-empty-message {
|
||||
color: var(--text-muted);
|
||||
font-style: italic;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/* Custom Category Management Styles */
|
||||
.mermaid-tools-category-management {
|
||||
margin-bottom: 2rem;
|
||||
@@ -115,7 +226,7 @@
|
||||
box-shadow: 0 0 0 2px var(--color-accent-2);
|
||||
}
|
||||
|
||||
.modal-button-container {
|
||||
.mermaid-tools-modal-button-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 10px;
|
||||
@@ -124,7 +235,7 @@
|
||||
border-top: 1px solid var(--color-base-25);
|
||||
}
|
||||
|
||||
.modal-button-container button {
|
||||
.mermaid-tools-modal-button-container button {
|
||||
padding: 6px 16px;
|
||||
border: 1px solid var(--color-base-30);
|
||||
border-radius: 4px;
|
||||
@@ -134,16 +245,16 @@
|
||||
font-size: var(--font-ui-small);
|
||||
}
|
||||
|
||||
.modal-button-container button:hover {
|
||||
.mermaid-tools-modal-button-container button:hover {
|
||||
background-color: var(--color-base-20);
|
||||
}
|
||||
|
||||
.modal-button-container button.mod-cta {
|
||||
.mermaid-tools-modal-button-container button.mod-cta {
|
||||
background-color: var(--color-accent);
|
||||
color: var(--text-on-accent);
|
||||
border-color: var(--color-accent);
|
||||
}
|
||||
|
||||
.modal-button-container button.mod-cta:hover {
|
||||
.mermaid-tools-modal-button-container button.mod-cta:hover {
|
||||
background-color: var(--color-accent-hover);
|
||||
}
|
||||
}
|
||||
+12
-15
@@ -3,23 +3,20 @@ THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||
if you want to view the source visit the plugins github repository (https://github.com/Vinzent03/obsidian-advanced-uri)
|
||||
*/
|
||||
|
||||
var Ue=Object.create;var Z=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var Ne=Object.getPrototypeOf,We=Object.prototype.hasOwnProperty;var Be=(s,n)=>()=>(n||s((n={exports:{}}).exports,n),n.exports),$e=(s,n)=>{for(var e in n)Z(s,e,{get:n[e],enumerable:!0})},ge=(s,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of He(n))!We.call(s,i)&&i!==e&&Z(s,i,{get:()=>n[i],enumerable:!(t=ze(n,i))||t.enumerable});return s};var Ke=(s,n,e)=>(e=s!=null?Ue(Ne(s)):{},ge(n||!s||!s.__esModule?Z(e,"default",{value:s,enumerable:!0}):e,s)),Ge=s=>ge(Z({},"__esModule",{value:!0}),s);var xe=Be((N,se)=>{(function(n,e){typeof N=="object"&&typeof se=="object"?se.exports=e():typeof define=="function"&&define.amd?define([],e):typeof N=="object"?N.feather=e():n.feather=e()})(typeof self!="undefined"?self:N,function(){return function(s){var n={};function e(t){if(n[t])return n[t].exports;var i=n[t]={i:t,l:!1,exports:{}};return s[t].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=s,e.c=n,e.d=function(t,i,o){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:o})},e.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},e.p="",e(e.s=0)}({"./dist/icons.json":function(s){s.exports={activity:'<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline>',airplay:'<path d="M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1"></path><polygon points="12 15 17 21 7 21 12 15"></polygon>',"alert-circle":'<circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line>',"alert-octagon":'<polygon points="7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"></polygon><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line>',"alert-triangle":'<path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line>',"align-center":'<line x1="18" y1="10" x2="6" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="18" y1="18" x2="6" y2="18"></line>',"align-justify":'<line x1="21" y1="10" x2="3" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="21" y1="18" x2="3" y2="18"></line>',"align-left":'<line x1="17" y1="10" x2="3" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="17" y1="18" x2="3" y2="18"></line>',"align-right":'<line x1="21" y1="10" x2="7" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="21" y1="18" x2="7" y2="18"></line>',anchor:'<circle cx="12" cy="5" r="3"></circle><line x1="12" y1="22" x2="12" y2="8"></line><path d="M5 12H2a10 10 0 0 0 20 0h-3"></path>',aperture:'<circle cx="12" cy="12" r="10"></circle><line x1="14.31" y1="8" x2="20.05" y2="17.94"></line><line x1="9.69" y1="8" x2="21.17" y2="8"></line><line x1="7.38" y1="12" x2="13.12" y2="2.06"></line><line x1="9.69" y1="16" x2="3.95" y2="6.06"></line><line x1="14.31" y1="16" x2="2.83" y2="16"></line><line x1="16.62" y1="12" x2="10.88" y2="21.94"></line>',archive:'<polyline points="21 8 21 21 3 21 3 8"></polyline><rect x="1" y="3" width="22" height="5"></rect><line x1="10" y1="12" x2="14" y2="12"></line>',"arrow-down-circle":'<circle cx="12" cy="12" r="10"></circle><polyline points="8 12 12 16 16 12"></polyline><line x1="12" y1="8" x2="12" y2="16"></line>',"arrow-down-left":'<line x1="17" y1="7" x2="7" y2="17"></line><polyline points="17 17 7 17 7 7"></polyline>',"arrow-down-right":'<line x1="7" y1="7" x2="17" y2="17"></line><polyline points="17 7 17 17 7 17"></polyline>',"arrow-down":'<line x1="12" y1="5" x2="12" y2="19"></line><polyline points="19 12 12 19 5 12"></polyline>',"arrow-left-circle":'<circle cx="12" cy="12" r="10"></circle><polyline points="12 8 8 12 12 16"></polyline><line x1="16" y1="12" x2="8" y2="12"></line>',"arrow-left":'<line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline>',"arrow-right-circle":'<circle cx="12" cy="12" r="10"></circle><polyline points="12 16 16 12 12 8"></polyline><line x1="8" y1="12" x2="16" y2="12"></line>',"arrow-right":'<line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline>',"arrow-up-circle":'<circle cx="12" cy="12" r="10"></circle><polyline points="16 12 12 8 8 12"></polyline><line x1="12" y1="16" x2="12" y2="8"></line>',"arrow-up-left":'<line x1="17" y1="17" x2="7" y2="7"></line><polyline points="7 17 7 7 17 7"></polyline>',"arrow-up-right":'<line x1="7" y1="17" x2="17" y2="7"></line><polylineLine truncated
|
||||
var De=Object.create;var q=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames;var He=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty;var We=(r,n)=>()=>(n||r((n={exports:{}}).exports,n),n.exports),$e=(r,n)=>{for(var e in n)q(r,e,{get:n[e],enumerable:!0})},ve=(r,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of Ne(n))!Be.call(r,i)&&i!==e&&q(r,i,{get:()=>n[i],enumerable:!(t=ze(n,i))||t.enumerable});return r};var Ke=(r,n,e)=>(e=r!=null?De(He(r)):{},ve(n||!r||!r.__esModule?q(e,"default",{value:r,enumerable:!0}):e,r)),Ge=r=>ve(q({},"__esModule",{value:!0}),r);var we=We((K,re)=>{(function(n,e){typeof K=="object"&&typeof re=="object"?re.exports=e():typeof define=="function"&&define.amd?define([],e):typeof K=="object"?K.feather=e():n.feather=e()})(typeof self!="undefined"?self:K,function(){return function(r){var n={};function e(t){if(n[t])return n[t].exports;var i=n[t]={i:t,l:!1,exports:{}};return r[t].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=r,e.c=n,e.d=function(t,i,o){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:o})},e.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},e.p="",e(e.s=0)}({"./dist/icons.json":function(r){r.exports={activity:'<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline>',airplay:'<path d="M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1"></path><polygon points="12 15 17 21 7 21 12 15"></polygon>',"alert-circle":'<circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line>',"alert-octagon":'<polygon points="7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"></polygon><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line>',"alert-triangle":'<path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line>',"align-center":'<line x1="18" y1="10" x2="6" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="18" y1="18" x2="6" y2="18"></line>',"align-justify":'<line x1="21" y1="10" x2="3" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="21" y1="18" x2="3" y2="18"></line>',"align-left":'<line x1="17" y1="10" x2="3" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="17" y1="18" x2="3" y2="18"></line>',"align-right":'<line x1="21" y1="10" x2="7" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="21" y1="18" x2="7" y2="18"></line>',anchor:'<circle cx="12" cy="5" r="3"></circle><line x1="12" y1="22" x2="12" y2="8"></line><path d="M5 12H2a10 10 0 0 0 20 0h-3"></path>',aperture:'<circle cx="12" cy="12" r="10"></circle><line x1="14.31" y1="8" x2="20.05" y2="17.94"></line><line x1="9.69" y1="8" x2="21.17" y2="8"></line><line x1="7.38" y1="12" x2="13.12" y2="2.06"></line><line x1="9.69" y1="16" x2="3.95" y2="6.06"></line><line x1="14.31" y1="16" x2="2.83" y2="16"></line><line x1="16.62" y1="12" x2="10.88" y2="21.94"></line>',archive:'<polyline points="21 8 21 21 3 21 3 8"></polyline><rect x="1" y="3" width="22" height="5"></rect><line x1="10" y1="12" x2="14" y2="12"></line>',"arrow-down-circle":'<circle cx="12" cy="12" r="10"></circle><polyline points="8 12 12 16 16 12"></polyline><line x1="12" y1="8" x2="12" y2="16"></line>',"arrow-down-left":'<line x1="17" y1="7" x2="7" y2="17"></line><polyline points="17 17 7 17 7 7"></polyline>',"arrow-down-right":'<line x1="7" y1="7" x2="17" y2="17"></line><polyline points="17 7 17 17 7 17"></polyline>',"arrow-down":'<line x1="12" y1="5" x2="12" y2="19"></line><polyline points="19 12 12 19 5 12"></polyline>',"arrow-left-circle":'<circle cx="12" cy="12" r="10"></circle><polyline points="12 8 8 12 12 16"></polyline><line x1="16" y1="12" x2="8" y2="12"></line>',"arrow-left":'<line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline>',"arrow-right-circle":'<circle cx="12" cy="12" r="10"></circle><polyline points="12 16 16 12 12 8"></polyline><line x1="8" y1="12" x2="16" y2="12"></line>',"arrow-right":'<line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline>',"arrow-up-circle":'<circle cx="12" cy="12" r="10"></circle><polyline points="16 12 12 8 8 12"></polyline><line x1="12" y1="16" x2="12" y2="8"></line>',"arrow-up-left":'<line x1="17" y1="17" x2="7" y2="7"></line><polyline points="7 17 7 7 17 7"></polyline>',"arrow-up-right":'<line x1="7" y1="17" x2="17" y2="7"></line><polylineLine truncated
|
||||
|
||||
`:" ";return n.replaceRange(`${l}^${a}`,o),a}static shouldInsertAfter(n){if(n.type)return["blockquote","code","table","heading","comment","footnoteDefinition"].includes(n.type)}static getBlockId(n){let e=n.workspace.getActiveViewOfType(me.MarkdownView);if(e){let t=e.editor,i=e.file,o=this.getBlock(n,t,i);if(o)return this.getIdOfBlock(t,o)}}};var ve={openFileOnWrite:!0,openDailyInNewPane:!1,openFileOnWriteInNewPane:!1,openFileWithoutWriteInNewPane:!1,idField:"id",useUID:!1,addFilepathWhenUsingUID:!1,allowEval:!1,includeVaultName:!0,vaultParam:"name",linkFormats:[{name:"Markdown",format:"[{{name}}]({{uri}})"}]};var we=require("obsidian");function je(s){let n=s.internalPlugins.plugins["daily-notes"];if(n&&n.enabled)return!0}function Ze(...s){let n=[];for(let t=0,i=s.length;t<i;t++)n=n.concat(s[t].split("/"));let e=[];for(let t=0,i=n.length;t<i;t++){let o=n[t];!o||o==="."||e.push(o)}return n[0]===""&&e.unshift(""),e.join("/")}async function be(s,n){let{format:e,folder:t}=n.internalPlugins.getEnabledPluginById("daily-notes").options,i=s.format(e);return i.endsWith(".md")||(i+=".md"),(0,we.normalizePath)(Ze(t,i))}var v=require("obsidian");var Me=require("obsidian"),D=class extends Me.SuggestModal{constructor(e,t,i){super(e.app);this.withFormat=t;this.file=i;this.modes=[null,"overwrite","append","prepend"];this.plugin=e,this.setPlaceholder("Type your data to be written to the file or leave it empty to just open it")}getSuggestions(e){e==""&&(e=null);let t=[];for(let i of this.modes)if(!(i==="overwrite"&&!e)){let o;e?i?o=`Write "${e}" in ${i} mode`:o=`Write "${e}"`:i?o=`Open in ${i} mode`:o="Open",t.push({data:e,display:o,mode:i,func:()=>{this.file?this.plugin.tools.copyURI({filepath:this.file,data:e,mode:i},this.withFormat,this.app.vault.getFileByPath(this.file)):this.plugin.tools.copyURI({daily:"true",data:e,mode:i},this.withFormat,void 0)}})}return t}renderSuggestion(e,t){t.innerText=e.display}onChooseSuggestion(e,t){e.func()}};var Ie=require("obsidian"),R=class extends Ie.FuzzySuggestModal{constructor(e,t,i=!0){super(e.app);this.placeHolder=t;this.allowNoFile=i;this.plugin=e,this.setPlaceholder(this.placeHolder)}getItems(){let e=[];this.allowNoFile&&e.push({display:"<Don't specify a file>",source:void 0});let t=this.app.workspace.getActiveFile();return t&&e.push({display:"<Current file>",source:t.path}),[...e,...this.app.vault.getFiles().map(i=>({display:i.path,source:i.path}))]}getItemText(e){return e.display}onChooseItem(e,t){}};var Ae=require("obsidian");function re(s){return s.viewmode?{state:{mode:s.viewmode,source:s.viewmode=="source"}}:void 0}function z(s){return navigator.clipboard.writeText(s)}function J(s,n){var o;let e=(o=n.parent)==null?void 0:o.path,t=e==="/"?"":e,i=n.name;for(let a=1;a<100;a++){let l=W(i),r=t+(t==""?"":"/")+l+` ${a}.md`;if(!(s.vault.getAbstractFileByPath(r)!==null))return r}}function Fe(s,n){let e=new URL(s.vault.getResourcePath(n));return e.host="localhosthostlocal",e.protocol="file",e.search="",e.pathname=decodeURIComponent(e.pathname),e.toString().replace("/localhosthostlocal/","/")}function ce(s,n,e){var a,l;let t=s.metadataCache.getFileCache(n),i=t.sections,o=(a=t.headings)==null?void 0:a.find(r=>r.heading===e);if(o){let r=i.findIndex(u=>u.type==="heading"&&u.position.start.line===o.position.start.line),c=i.slice(r+1),d=c==null?void 0:c.findIndex(u=>u.type==="heading");return{lastLine:((l=c[(d!==-1?d:c.length)-1])!=null?l:i[r]).position.end.line+1,firstLine:i[r].position.end.line+1}}else new Ae.Notice("Can't find heading")}var U=class extends Error{constructor(e,t,i){super(e);this.name="KeyPathError",this.errKey=t,i&&(this.cause=i)}};function Ce(s){let{originalObject:n,key:e,data:t}=s;if(e.startsWith("[")&&e.endsWith("]")){let i=e.substring(1,e.length-1).split(","),o=n;for(let a=0;a<i.length;a++){let l=i[a],r;if(o instanceof Array){if(r=parseInt(l),Number.isNaN(r)&&(r=o.find(p=>p==l)),r===void 0)throw new U(`Failed to resolve or convert "${l}" to a valid array index.`,l);r=Math.min(r,o.length),r=Math.max(r,-1)}if(a==i.length-1){o instanceof Array?r===-1?o.unshift(t):o[r]=t:o[l]=t;return}let d=!Number.isNaN(parseInt(i[a+1]))?[]:{};try{o instanceof Array?r>=o.length?(o.push(d),o=d):r===-1?(o.unshift(d),o=d):o=o[Math.max(r,0)]:o[l]===void 0?(o[l]=d,o=d):o=o[l]}catch(p){throw new U(`Failed to resolve "${l}" as a valid object key`,l,p)}}}else n[e]=t}function Pe(s){let{obj:n,key:e}=s;if(e.startsWith("[")&&e.endsWith("]")){let t=e.substring(1,e.length-1).split(","),i=n;for(let o of t)if(i instanceof Array){let a=parseInt(o);Number.isNaN(a)?i=i.find(l=>l==o):i=i[a]}else if(i&&typeof i=="object")i=i[o];else return;return i}else return n?n[e]:void 0}var $=class{constructor(n){this.plugin=n;this.app=this.plugin.app}get tools(){return this.plugin.tools}handlePluginManagement(n){if(n["enable-plugin"]){let e=n["enable-plugin"];e in this.app.plugins.manifests&&!this.app.plugins.getPlugin(e)?(this.app.plugins.enablePluginAndSave(e),new v.Notice(`Enabled ${e}`)):this.app.internalPlugins.plug
Line truncated
|
||||
${r.message}`):new v.Notice("Failed to update frontmatter, check console for more details")}});return}z(Pe({obj:i,key:e}))}handleWorkspace(n){let e=this.app.internalPlugins.getEnabledPluginById("workspaces");if(!e)new v.Notice("Workspaces plugin is not enabled"),this.plugin.failure(n);else{if(n.saveworkspace=="true"){let t=e.activeWorkspace;e.saveWorkspace(t),new v.Notice(`Saved current workspace to ${t}`)}n.clipboard&&n.clipboard!="false"?this.tools.copyURI({workspace:e.activeWorkspace}):n.workspace!=null&&e.loadWorkspace(n.workspace),this.plugin.success(n)}}async handleCommand(n){if(n.filepath)if(n.mode){if(n.mode=="new"){let t=this.app.metadataCache.getFirstLinkpathDest(n.filepath,"/");t instanceof v.TFile&&(n.filepath=J(this.app,t))}await this.plugin.open({file:n.filepath,mode:"source",parameters:n});let e=this.app.workspace.getActiveViewOfType(v.MarkdownView);if(e){let t=e.editor,i=t.getValue();if(n.mode==="append"){t.setValue(i+`
|
||||
`);let o=t.lineCount();t.setCursor({ch:0,line:o})}else n.mode==="prepend"?(t.setValue(`
|
||||
`+i),t.setCursor({ch:0,line:0})):n.mode==="overwrite"&&t.setValue("")}}else n.line!=null||n.column!=null||n.offset!=null?(await this.plugin.open({file:n.filepath,mode:"source",parameters:n}),await this.plugin.setCursorInLine(n)):await this.plugin.open({file:n.filepath,setting:this.plugin.settings.openFileWithoutWriteInNewPane,parameters:n});else(n.openmode||n.viewmode)&&await this.plugin.open({parameters:n});if(n.commandid)this.app.commands.executeCommandById(n.commandid);else if(n.commandname){let e=this.app.commands.commands;for(let t in e)if(e[t].name===n.commandname){e[t].callback?await e[t].callback():e[t].checkCallback(!1);break}}if(n.confirm&&n.confirm!="false"){await new Promise(t=>setTimeout(t,750));let e=document.querySelector(".mod-cta:not([style*='display: none'])");e.click instanceof Function&&e.click()}this.plugin.success(n)}async handleEval(n){if(n.filepath)if(n.mode){if(n.mode=="new"){let t=this.app.metadataCache.getFirstLinkpathDest(n.filepath,"/");t instanceof v.TFile&&(n.filepath=J(this.app,t))}await this.plugin.open({file:n.filepath,mode:"source",parameters:n});let e=this.app.workspace.getActiveViewOfType(v.MarkdownView);if(e){let t=e.editor,i=t.getValue();if(n.mode==="append"){t.setValue(i+`
|
||||
`);let o=t.lineCount();t.setCursor({ch:0,line:o})}else n.mode==="prepend"?(t.setValue(`
|
||||
`+i),t.setCursor({ch:0,line:0})):n.mode==="overwrite"&&t.setValue("")}}else n.line!=null||n.column!=null||n.offset!=null?(await this.plugin.open({file:n.filepath,mode:"source",parameters:n}),await this.plugin.setCursorInLine(n)):await this.plugin.open({file:n.filepath,setting:this.plugin.settings.openFileWithoutWriteInNewPane,parameters:n});this.plugin.settings.allowEval?((0,eval)(n.eval),this.plugin.success(n)):(new v.Notice("Eval is not allowed. Please enable it in the settings."),this.plugin.failure(n))}async handleDoesFileExist(n){let e=await this.app.vault.adapter.exists(n.filepath);z((e?1:0).toString()),this.plugin.success(n)}async handleSearchAndReplace(n){let e;if(n.filepath){let t=this.app.vault.getAbstractFileByPath(n.filepath);t instanceof v.TFile&&(e=t)}else e=this.app.workspace.getActiveFile();if(e){let t=await this.app.vault.read(e);if(n.searchregex)try{let[,,i,o]=n.searchregex.match(/(\/?)(.+)\1([a-z]*)/i),a=new RegExp(i,o);t=t.replace(a,n.replace),this.plugin.success(n)}catch(i){new v.Notice(`Can't parse ${n.searchregex} as RegEx`),this.plugin.failure(n)}else t=t.replaceAll(n.search,n.replace),this.plugin.success(n);await this.plugin.writeAndOpenFile(e.path,t,n)}else new v.Notice("Cannot find file"),this.plugin.failure(n)}async handleSearch(n){n.filepath&&await this.plugin.open({file:n.filepath,parameters:n});let e=this.app.workspace.getActiveViewOfType(v.FileView);e.currentMode.showSearch();let t=e.currentMode.search;t.searchInputEl.value=n.search,t.searchInputEl.dispatchEvent(new Event("input"))}async handleWrite(n,e=!1){var i;let t;if(n.filepath?t=this.app.vault.getAbstractFileByPath(n.filepath):t=this.app.workspace.getActiveFile(),n.filepath||t){let o,a=(i=n.filepath)!=null?i:t.path;n.mode==="overwrite"?(o=await this.plugin.writeAndOpenFile(a,n.data,n),this.plugin.success(n)):n.mode==="prepend"?(t instanceof v.TFile?o=await this.plugin.prepend(t,n):o=await this.plugin.prepend(a,n),this.plugin.success(n)):n.mode==="append"?(t instanceof v.TFile?o=await this.plugin.append(t,n):o=await this.plugin.append(a,n),this.plugin.success(n)):n.mode==="new"?t instanceof v.TFile?(o=await this.plugin.writeAndOpenFile(J(this.app,t),n.data,n),this.plugin.hookSuccess(n,o)):(o=await this.plugin.writeAndOpenFile(a,n.data,n),this.plugin.hookSuccess(n,o)):!e&&t instanceof v.TFile?(new v.Notice("File already exists"),this.plugin.openExistingFileAndSetCursor(t.path,n),this.plugin.failure(n)):(o=await this.plugin.writeAndOpenFile(a,n.data,n),this.plugin.success(n)),n.uid&&this.tools.writeUIDToFile(o,n.uid)}else new v.Notice("Cannot find file"),this.plugin.failure(n)}async handleOpen(n){if(n.heading!=null){await this.plugin.open({file:n.filepath+"#"+n.heading,setting:this.plugin.settings.openFileWithoutWriteInNewPane,parameters:n});let e=this.app.workspace.getActiveViewOfType(v.MarkdownView);if(!e)return;let i=this.app.metadataCache.getFileCache(e.file).headings.find(o=>o.heading===n.heading);e.editor.focus(),e.editor.setCursor({line:i.position.start.line+1,ch:0})}else if(n.block!=null){await this.plugin.open({file:n.filepath+"#^"+n.block,setting:this.plugin.settings.openFileWithoutWriteInNewPane,parameters:n});let e=this.app.workspace.getActiveViewOfType(v.MarkdownView);if(!e)return;let i=this.app.metadataCache.getFileCache(e.file).blocks[n.block.toLowerCase()];e.editor.focus(),i&&e.editor.setCursor({line:i.position.start.line,ch:0})}else await this.plugin.open({file:n.filepath,setting:this.plugin.settings.openFileWithoutWriteInNewPane,parameters:n}),(n.line!=null||n.column!=null||n.offset!=null)&&await this.plugin.setCursorInLine(n);if(n.mode!=null&&await this.plugin.setCursor(n),n.uid){let e=this.app.workspace.getActiveViewOfType(v.MarkdownView);this.tools.writeUIDToFile(e.file,n.uid)}this.plugin.success(n)}async handleOpenBlock(n){let e=this.tools.getFileFromBlockID(n.block);e&&await this.plugin.chooseHandler({...n,filepath:e.path},!1)}handleCopyFileURI(n,e,t){let i=this.app.workspace.getActiveViewOfType(v.FileView);if(!(!i&&!t)){if(t=t!=null?t:i.file,i instanceof v.MarkdownView){let o=i.editor.getCursor(),a=this.app.metadataCache.getFileCache(i.file);if(a.headings){for(let l of a.headings)if(l.position.start.line<=o.line&&l.position.end.line>=o.line){this.tools.copyURI({filepath:i.file.path,heading:l.heading},e,t);return}}if(a.blocks)for(let l of Object.keys(a.blocks)){let r=a.blocks[l];if(r.position.start.line<=o.line&&r.position.end.line>=o.line){this.tools.copyURI({filepath:i.file.path,block:r.id},e,t);return}}}if(n){let o=t!=null?t:this.app.workspace.getActiveFile();if(!o){new v.Notice("No file opened");return}this.tools.copyURI({filepath:o.path},e,t)}else{let o=new R(this.plugin,"Choose a file",!1);o.open(),o.onChooseItem=(a,l)=>{new D(this.plugin,e,a.source).open()}}}}handleOpenSettings(n){if(this.app.setting.containerEl.parentElement===null&&this.app.setting.open(),n.settingid=="plugin-browser"?(this.app.setting.openTabById("community-plugins"),this.app.setting.activeTab.containerEl.find(".mod-cta").
Line truncated
|
||||
`),l=`${this.plugin.settings.idField}:`;if(o)a.unshift("---"),a.unshift(`${l} ${e}`),a.unshift("---");else{let d=a.findIndex(p=>p.startsWith(l));d!=-1?a[d]=`${l} ${e}`:a.splice(1,0,`${l} ${e}`)}let r=a.join(`
|
||||
`);return await this.app.vault.modify(n,r),e}async getUIDFromFile(n){var i;let e=(i=this.app.metadataCache.getFileCache(n))!=null?i:await new Promise(o=>{let a=this.app.metadataCache.on("changed",l=>{if(l.path==n.path){let r=this.app.metadataCache.getFileCache(n);this.app.metadataCache.offref(a),o(r)}})}),t=(0,C.parseFrontMatterEntry)(e.frontmatter,this.plugin.settings.idField);if(t!=null)return t instanceof Array?t[0]:t}async generateURI(n){var a;let e="obsidian://adv-uri",t="",i=this.app.vault.getAbstractFileByPath(n.filepath);this.settings.includeVaultName&&(t+="?vault=",this.settings.vaultParam=="id"&&this.app.appId?t+=encodeURIComponent(this.app.appId):t+=encodeURIComponent(this.app.vault.getName())),this.settings.useUID&&i instanceof C.TFile&&i.extension=="md"&&(this.settings.addFilepathWhenUsingUID||(n.filepath=void 0),n.uid=(a=await this.getUIDFromFile(i))!=null?a:await this.writeUIDToFile(i,pe()));let o=Object.keys(n).filter(l=>n[l]).sort((l,r)=>{let c=["filepath","filename","uid","daily"],d=["data","eval"];return c.includes(l)?-1:c.includes(r)||d.includes(l)?1:d.includes(r)?-1:0});for(let l of o)n[l]!=null&&(t+=t?"&":"?",t+=`${l}=${encodeURIComponent(n[l])}`);return t.endsWith("%20")&&(t+="&"),e+t}async copyURI(n,e=!1,t=void 0){var o,a;let i=await this.generateURI(n);if(e){let l=this.settings.linkFormats;if(l.length==0){new C.Notice("No link formats defined in the settings");return}let r;if(l.length==1)r=l[0];else{let d=l.map(h=>h.name),p=await new ne(this.plugin,{options:d,onlySelection:!0,placeholder:"Select link format"}).openAndGetResult();if(!p){new C.Notice("No link format selected");return}r=l.find(h=>h.name==p)}let c=r.format.replace(/\{\{uri\}\}/g,i).replace(/\{\{path\}\}/g,t==null?void 0:t.path).replace(/\{\{folder\}\}/g,(o=t==null?void 0:t.parent)==null?void 0:o.path).replace(/\{\{name\}\}/g,t==null?void 0:t.basename).replace(/\{\{vaultName\}\}/g,this.app.vault.getName()).replace(/\{\{vaultId\}\}/g,this.app.appId);if(t&&c.match(/\{\{uid\}\}/g)){let d=(a=await this.getUIDFromFile(t))!=null?a:t.basename;c=c.replace(/\{\{uid\}\}/g,d)}if(t&&c.match(/\{\{alias\}\}/g)){let d=(0,C.parseFrontMatterAliases)(this.app.metadataCache.getFileCache(t).frontmatter),p=d?d[0]:t==null?void 0:t.basename;c=c.replace(/\{\{alias\}\}/g,p)}await z(c),new C.Notice(`Advanced URI in format "${r.name}" copied to your clipboard`);return}await z(i),new C.Notice("Advanced URI copied to your clipboard")}getFileFromUID(n){var i;let e=this.app.vault.getMarkdownFiles(),t=this.settings.idField;for(let o of e){let a=(0,C.parseFrontMatterEntry)((i=this.app.metadataCache.getFileCache(o))==null?void 0:i.frontmatter,t);if(a instanceof Array){if(a.contains(n))return o}else if(a==n)return o}}getFileFromBlockID(n){var t,i;let e=this.app.vault.getMarkdownFiles();n=n.toLowerCase();for(let o of e)if(((i=(t=this.app.metadataCache.getFileCache(o))==null?void 0:t.blocks)==null?void 0:i[n])!=null)return o}};var oe=require("obsidian"),ie=class extends oe.FuzzySuggestModal{constructor(e){super(e.app);this.plugin=e,this.setPlaceholder("Choose a workspace")}getItems(){let e=this.app.internalPlugins.getEnabledPluginById("workspaces");if(!e)new oe.Notice("Workspaces plugin is not enabled");else return Object.keys(e.workspaces)}getItemText(e){return e}onChooseItem(e,t){this.plugin.tools.copyURI({workspace:e})}};var ae=class extends w.Plugin{constructor(){super(...arguments);this.handlers=new $(this);this.tools=new K(this)}async onload(){await this.loadSettings(),this.addSettingTab(new _(this.app,this)),this.addCommand({id:"copy-uri-current-file",name:"Copy URI for file with options",callback:()=>this.handlers.handleCopyFileURI(!1,!1)}),this.addCommand({id:"copy-uri-current-file-simple",name:"Copy URI for current file",callback:()=>this.handlers.handleCopyFileURI(!0,!1)}),this.addCommand({id:"copy-uri-current-file-with-format",name:"Copy formatted URI for file with options ",callback:()=>this.handlers.handleCopyFileURI(!1,!0)}),this.addCommand({id:"copy-uri-current-file-simple-with-format",name:"Copy formatted URI for current file",callback:()=>this.handlers.handleCopyFileURI(!0,!0)}),this.addCommand({id:"copy-uri-daily",name:"Copy URI for daily note",callback:()=>new D(this,!1).open()}),this.addCommand({id:"copy-uri-search-and-replace",name:"Copy URI for search and replace",callback:()=>{let e=new R(this,"Used file for search and replace");e.open(),e.onChooseItem=t=>{let i=new q(this);i.open(),i.onChooseSuggestion=o=>{new X(this,o,t==null?void 0:t.source).open()}}}}),this.addCommand({id:"copy-uri-command",name:"Copy URI for command",callback:()=>{let e=new R(this,"Select a file to be opened before executing the command");e.open(),e.onChooseItem=t=>{new Q(this,t==null?void 0:t.source).open()}}}),this.addCommand({id:"copy-uri-block",name:"Copy URI for current block",checkCallback:e=>{let t=this.app.workspace.getActiveViewOfType(w.MarkdownView);if(e)return t!=null;let i=B.getBlockId(this.app);i&&this.tools.copyURI({filepath:t.file.path,block:i},!
Line truncated
|
||||
`),d;if(t.heading){let p=ce(this.app,e,t.heading);if(d=p==null?void 0:p.lastLine,d===void 0)return;p.firstLine==p.lastLine&&t.separator&&(t.separator=`
|
||||
`+t.separator)}else t.line?d=Number(t.line):d=c.length;d=Math.max(1,d),c[d-1]=((a=c[d-1])!=null?a:"")+((l=t.separator)!=null?l:`
|
||||
`:" ";return n.replaceRange(`${l}^${a}`,o),a}static shouldInsertAfter(n){let e=r.getBlockType(n);return e?["blockquote","code","table","heading","comment","footnoteDefinition"].includes(e):!1}static getBlockId(n){let e=n.workspace.getActiveViewOfType(je.MarkdownView);if(e){let t=e.editor,i=e.file,o=this.getBlock(n,t,i);if(o)return this.getIdOfBlock(t,o)}}};var be={openFileOnWrite:!0,openDailyInNewPane:!1,openFileOnWriteInNewPane:!1,openFileWithoutWriteInNewPane:!1,idField:"id",useUID:!1,addFilepathWhenUsingUID:!1,includeVaultName:!0,vaultParam:"name",linkFormats:[{name:"Markdown",format:"[{{name}}]({{uri}})"}]};var Me=require("obsidian");function Ie(r){let n=r.internalPlugins.plugins["daily-notes"];return!!(n&&n.enabled)}function Ze(...r){let n=[];for(let t=0,i=r.length;t<i;t++)r[t]&&(n=n.concat(r[t].split("/")));let e=[];for(let t=0,i=n.length;t<i;t++){let o=n[t];!o||o==="."||e.push(o)}return n[0]===""&&e.unshift(""),e.join("/")}async function Ae(r,n){let e=n.internalPlugins.getEnabledPluginById("daily-notes");if(!e)throw new Error("Daily notes plugin is not enabled");let{format:t,folder:i}=e.options,o=r.format(t);return o.endsWith(".md")||(o+=".md"),(0,Me.normalizePath)(Ze(i,o))}var se=require("obsidian"),Je=r=>{var e,t;let n=(t=(e=r.internalPlugins)==null?void 0:e.plugins)==null?void 0:t.sync;return n==null?void 0:n.instance},Ce=async r=>{var i;let n=Je(r);if(!n){console.warn("sync instance not found, not waiting");return}if(((i=n==null?void 0:n.plugin)==null?void 0:i.enabled)!==!0){console.warn("sync plugin is disabled, not waiting");return}if(!("syncing"in n)||!("ready"in n)){console.warn("sync instance does not have expected properties, not waiting");return}let e=null,t=0;for(;n.ready===!1;){if(t++,t>40){console.warn("sync instance not ready after 10 seconds, not waiting"),e==null||e.hide();return}t>6&&!e&&(e=new se.Notice("Adv. URI: Waiting for sync to complete...",0)),await new Promise(o=>window.setTimeout(o,250))}for(;n.syncing===!0&&n.syncStatus!=="Indexing...";){if(t++,t>240){console.warn("sync instance still syncing after 60 seconds, not waiting"),e==null||e.hide();return}t>6&&!e&&(e=new se.Notice("Adv. URI: Waiting for sync to complete...",0)),await new Promise(o=>window.setTimeout(o,250))}e==null||e.hide()};var x=require("obsidian");var S=require("obsidian"),B=class extends S.Modal{constructor(e,t,i){super(e.app);this.plugin=e;this.withFormat=t;this.file=i;this.modes=[{value:void 0,label:"Default",description:"Write normally, or only open the file when data is empty."},{value:"overwrite",label:"Overwrite",description:"Replace the existing file contents with the data."},{value:"append",label:"Append",description:"Add the data after the existing file contents."},{value:"prepend",label:"Prepend",description:"Add the data before the existing file contents."}];this.data=""}onOpen(){var i;this.setTitle("Configure URI");let e=this.contentEl.createDiv({cls:"advanced-uri-data-section"});new S.Setting(e).setName("Data").setDesc("Enter the text to write. Leave this empty to only open the file.").setHeading();let t=new S.TextAreaComponent(e);t.setPlaceholder("Text to write").onChange(o=>{this.data=o,this.updateCopyButton()}),t.inputEl.rows=4,t.inputEl.addClass("advanced-uri-data-input"),t.inputEl.focus(),new S.Setting(this.contentEl).setName("Mode").setDesc("Select how to write the data to the file.").setHeading();for(let o=0;o<this.modes.length;o++){let a=this.modes[o],l=new S.Setting(this.contentEl).setName(a.label).setDesc(a.description),s=l.controlEl.createEl("input",{type:"radio",attr:{name:"advanced-uri-write-mode",value:(i=a.value)!=null?i:"default","aria-label":a.label}});s.checked=o===0,s.addEventListener("change",()=>{s.checked&&(this.mode=a.value,this.updateCopyButton())}),l.settingEl.addEventListener("click",c=>{c.target!==s&&(s.focus(),s.click())}),l.settingEl.addClass("advanced-uri-mode-option")}new S.Setting(this.contentEl).addButton(o=>o.setButtonText("Cancel").onClick(()=>this.close())).addButton(o=>{this.copyButton=o.setButtonText(this.withFormat?"Copy formatted URI":"Copy URI").setCta().onClick(()=>this.copyURI()),this.updateCopyButton()})}onClose(){this.contentEl.empty()}updateCopyButton(){var e;(e=this.copyButton)==null||e.setDisabled(this.mode==="overwrite"&&this.data.length===0)}copyURI(){let e=this.data.length>0?this.data:void 0,t=this.file?{filepath:this.file,data:e,mode:this.mode}:{daily:"true",data:e,mode:this.mode};this.plugin.tools.copyURI(t,this.withFormat,this.file?this.app.vault.getFileByPath(this.file):void 0),this.close()}};var Fe=require("obsidian"),U=class extends Fe.FuzzySuggestModal{constructor(e,t,i=!0){super(e.app);this.placeHolder=t;this.allowNoFile=i;this.plugin=e,this.setPlaceholder(this.placeHolder)}getItems(){let e=[];this.allowNoFile&&e.push({display:"<Don't specify a file>",source:void 0});let t=this.app.workspace.getActiveFile();return t&&e.push({display:"<Current file>",source:t.path}),[...e,...this.app.vault.getFiles().map(i=>({display:i.path,source:i.pat
Line truncated
|
||||
${d.message}`):new x.Notice("Failed to update frontmatter, check console for more details")}})}if(o&&!n.data){let s=Oe({obj:o,key:e}),c=typeof s=="string"||typeof s=="number"||typeof s=="boolean"?String(s):JSON.stringify(s!=null?s:"");await W(c)}let a=await this.plugin.open({parameters:n,file:t,setting:this.plugin.settings.openFileWithoutWriteInNewPane});if(a&&n.mode&&a.view instanceof x.MarkdownView){let s=a.view.metadataEditor;if(!s)return;let c;switch(n.mode){case"append":c="end";break;case"prepend":c="start";break;case"overwrite":c="both";break}s.focusValue(e,c)}}async handleWorkspace(n){let e=this.app.internalPlugins.getEnabledPluginById("workspaces");if(!e)new x.Notice("Workspaces plugin is not enabled"),this.plugin.failure(n);else{if(n.saveworkspace=="true"){let t=e.activeWorkspace;e.saveWorkspace(t),new x.Notice(`Saved current workspace to ${t}`)}n.clipboard&&n.clipboard!="false"?await this.tools.copyURI({workspace:e.activeWorkspace}):n.workspace!=null&&e.loadWorkspace(n.workspace),this.plugin.success(n)}}async handleCommand(n){if(n.filepath)if(n.mode){if(n.mode=="new"){let t=this.app.metadataCache.getFirstLinkpathDest(n.filepath,"/");t instanceof x.TFile&&(n.filepath=he(this.app,t))}await this.plugin.open({file:n.filepath,mode:"source",parameters:n});let e=this.app.workspace.getActiveViewOfType(x.MarkdownView);if(e){let t=e.editor;n.mode==="append"?this.insertCommandLine(e,n,"append"):n.mode==="prepend"?this.insertCommandLine(e,n,"prepend"):n.mode==="overwrite"&&t.setValue("")}}else n.line!=null||n.column!=null||n.offset!=null?(await this.plugin.open({file:n.filepath,mode:"source",parameters:n}),await this.plugin.setCursorInLine(n)):await this.plugin.open({file:n.filepath,setting:this.plugin.settings.openFileWithoutWriteInNewPane,parameters:n});else(n.openmode||n.viewmode)&&await this.plugin.open({parameters:n});if(n.commandid)this.app.commands.executeCommandById(n.commandid);else if(n.commandname){let e=this.app.commands.commands;for(let t in e)if(e[t].name===n.commandname){e[t].callback?await e[t].callback():e[t].checkCallback(!1);break}}if(n.confirm&&n.confirm!="false"){await new Promise(i=>window.setTimeout(i,750));let t=document.querySelector(".mod-cta:not([style*='display: none'])");t.click instanceof Function&&t.click()}this.plugin.success(n),await new Promise(e=>window.setTimeout(e,4e3))}insertCommandLine(n,e,t){let i=n.editor,o=i.lineCount(),a=i.lastLine(),l,s=!1;if(e.heading){let c=D(this.app,n.file,e.heading);if(!c)return;let d=t==="append"?c.lastLine:c.firstLine;d>=o?l={line:a,ch:i.getLine(a).length}:(l={line:d,ch:0},s=!0)}else if(e.block){let c=z(this.app,n.file,e.block);if(!c)return;l=t==="append"?{line:c.lastLine,ch:i.getLine(c.lastLine).length}:{line:c.firstLine,ch:0},s=t==="prepend"}else t==="append"?l={line:a,ch:i.getLine(a).length}:(l={line:0,ch:0},s=!0);i.replaceRange(`
|
||||
`,l),i.setCursor(s?l:{line:l.line+1,ch:0}),i.scrollIntoView({from:i.getCursor(),to:i.getCursor()},!0)}async handleDoesFileExist(n){let e=await this.app.vault.adapter.exists(n.filepath);await W((e?1:0).toString()),this.plugin.success(n)}async handleReveal(n){let e=this.app.vault.getAbstractFileByPath(n.filepath);if(!e){new x.Notice("Cannot find file or folder"),this.plugin.failure(n);return}let t=this.app.workspace.getLeavesOfType("file-explorer")[0],i=t==null?void 0:t.view;if(!i||typeof i.revealInFolder!="function"){new x.Notice("File Explorer is not available"),this.plugin.failure(n);return}i.revealInFolder(e),this.plugin.success(n)}handleRemovedEval(n){new x.Notice("The eval URI parameter was removed due to security concerns and newer Obsidian plugin checks."),this.plugin.failure(n)}async handleSearchAndReplace(n){let e;if(n.filepath){let t=this.app.vault.getAbstractFileByPath(n.filepath);t instanceof x.TFile&&(e=t)}else e=this.app.workspace.getActiveFile();if(e){let t=await this.app.vault.read(e);if(n.searchregex)try{let[,,i,o]=n.searchregex.match(/(\/?)(.+)\1([a-z]*)/i),a=new RegExp(i,o);t=t.replace(a,n.replace),this.plugin.success(n)}catch(i){new x.Notice(`Can't parse ${n.searchregex} as RegEx`),this.plugin.failure(n)}else t=t.replaceAll(n.search,n.replace),this.plugin.success(n);await this.plugin.writeAndOpenFile(e.path,t,n)}else new x.Notice("Cannot find file"),this.plugin.failure(n)}async handleSearch(n){n.filepath&&await this.plugin.open({file:n.filepath,parameters:n});let e=this.app.workspace.getActiveViewOfType(x.FileView);e.currentMode.showSearch();let t=e.currentMode.search;t.searchInputEl.value=n.search,t.searchInputEl.dispatchEvent(new Event("input"))}async handleWrite(n,e=!1){var i;let t;if(n.filepath?t=this.app.vault.getAbstractFileByPath(n.filepath):t=this.app.workspace.getActiveFile(),n.filepath||t){let o,a=(i=n.filepath)!=null?i:t.path;n.mode==="overwrite"?(o=await this.plugin.writeAndOpenFile(a,n.data,n),this.plugin.success(n)):n.mode==="prepend"?(t instanceof x.TFile?o=await this.plugin.prepend(t,n):o=await this.plugin.prepend(a,n),this.plugin.success(n)):n.mode==="append"?(t instanceof x.TFile?o=await this.plugin.append(t,n):o=await this.plugin.append(a,n),this.plugin.success(n)):n.mode==="new"?t instanceof x.TFile?(o=await this.plugin.writeAndOpenFile(he(this.app,t),n.data,n),await this.plugin.hookSuccess(n,o)):(o=await this.plugin.writeAndOpenFile(a,n.data,n),await this.plugin.hookSuccess(n,o)):!e&&t instanceof x.TFile?(new x.Notice("File already exists"),await this.plugin.openExistingFileAndSetCursor(t.path,n),this.plugin.failure(n)):(o=await this.plugin.writeAndOpenFile(a,n.data,n),this.plugin.success(n)),n.uid&&await this.tools.writeUIDToFile(o,n.uid)}else new x.Notice("Cannot find file"),this.plugin.failure(n)}async handleOpen(n){if(n.heading!=null){let e="";n.mode||(e="#"+n.heading),await this.plugin.open({file:n.filepath+e,setting:this.plugin.settings.openFileWithoutWriteInNewPane,parameters:n})}else if(n.block!=null){await this.plugin.open({file:n.filepath+"#^"+n.block,setting:this.plugin.settings.openFileWithoutWriteInNewPane,parameters:n});let e=this.app.workspace.getActiveViewOfType(x.MarkdownView);if(!e)return;let i=this.app.metadataCache.getFileCache(e.file).blocks[n.block.toLowerCase()];e.editor.focus(),i&&e.editor.setCursor({line:i.position.start.line,ch:0})}else await this.plugin.open({file:n.filepath,setting:this.plugin.settings.openFileWithoutWriteInNewPane,parameters:n}),(n.line!=null||n.column!=null||n.offset!=null)&&await this.plugin.setCursorInLine(n);if((n.mode!=null||n.heading)&&await this.plugin.setCursor(n),n.uid){let e=this.app.workspace.getActiveViewOfType(x.MarkdownView);await this.tools.writeUIDToFile(e.file,n.uid)}this.plugin.success(n)}async handleOpenBlock(n){let e=this.tools.getFileFromBlockID(n.block);e&&await this.plugin.chooseHandler({...n,filepath:e.path},!1)}async handleCopyFileURI(n,e,t){let i=this.app.workspace.getActiveViewOfType(x.FileView);if(!(!i&&!t)){if(t=t!=null?t:i.file,i instanceof x.MarkdownView){let o=i.editor.getCursor(),a=this.app.metadataCache.getFileCache(i.file);if(a.headings){for(let l of a.headings)if(l.position.start.line<=o.line&&l.position.end.line>=o.line){await this.tools.copyURI({filepath:i.file.path,heading:l.heading},e,t);return}}if(a.blocks)for(let l of Object.keys(a.blocks)){let s=a.blocks[l];if(s.position.start.line<=o.line&&s.position.end.line>=o.line){await this.tools.copyURI({filepath:i.file.path,block:s.id},e,t);return}}}if(n){let o=t!=null?t:this.app.workspace.getActiveFile();if(!o){new x.Notice("No file opened");return}await this.tools.copyURI({filepath:o.path},e,t)}else{let o=new U(this.plugin,"Choose a file",!1);o.open(),o.onChooseItem=(a,l)=>{new B(this.plugin,e,a.source).open()}}}}handleOpenSettings(n){if(this.app.setting.containerEl.parentElement===null&&this.app.setting.open(),n.settingid=="plugin-browser"?(this.app.setting.openTabById("community-plugins"),this.app.setting.activeTab.containerEl.find(".
Line truncated
|
||||
`),l=`${this.plugin.settings.idField}:`;if(o)a.unshift("---"),a.unshift(`${l} ${e}`),a.unshift("---");else{let d=a.findIndex(p=>p.startsWith(l));d!=-1?a[d]=`${l} ${e}`:a.splice(1,0,`${l} ${e}`)}let s=a.join(`
|
||||
`);return await this.app.vault.modify(n,s),e}async getUIDFromFile(n){var i;let e=(i=this.app.metadataCache.getFileCache(n))!=null?i:await new Promise(o=>{let a=this.app.metadataCache.on("changed",l=>{if(l.path==n.path){let s=this.app.metadataCache.getFileCache(n);this.app.metadataCache.offref(a),o(s)}})}),[t]=r.getFrontmatterUIDs(e.frontmatter,this.plugin.settings.idField);if(t!=null)return String(t)}async generateURI(n){var a;let e="obsidian://adv-uri",t="",i=this.app.vault.getAbstractFileByPath(n.filepath);this.settings.includeVaultName&&(t+="?vault=",this.settings.vaultParam=="id"&&this.app.appId?t+=encodeURIComponent(this.app.appId):t+=encodeURIComponent(this.app.vault.getName())),this.settings.useUID&&i instanceof k.TFile&&i.extension=="md"&&(this.settings.addFilepathWhenUsingUID||(n.filepath=void 0),n.uid=(a=await this.getUIDFromFile(i))!=null?a:await this.writeUIDToFile(i,fe()));let o=Object.keys(n).filter(l=>n[l]!=null).sort((l,s)=>{let c=["filepath","filename","uid","daily"],d=["data","eval"];return c.includes(l)?-1:c.includes(s)||d.includes(l)?1:d.includes(s)?-1:0});for(let l of o)n[l]!=null&&(t+=t?"&":"?",t+=`${l}=${encodeURIComponent(n[l])}`);return t.endsWith("%20")&&(t+="&"),e+t}async copyURI(n,e=!1,t=void 0){var o,a,l;let i=await this.generateURI(n);if(e){let s=this.settings.linkFormats;if(s.length==0){new k.Notice("No link formats defined in the settings");return}let c;if(s.length==1)c=s[0];else{let p=s.map(h=>h.name),u=await new ne(this.plugin,{options:p,onlySelection:!0,placeholder:"Select link format"}).openAndGetResult();if(!u){new k.Notice("No link format selected");return}c=s.find(h=>h.name==u)}let d=c.format.replace(/\{\{uri\}\}/g,i).replace(/\{\{path\}\}/g,t==null?void 0:t.path).replace(/\{\{folder\}\}/g,(o=t==null?void 0:t.parent)==null?void 0:o.path).replace(/\{\{name\}\}/g,t==null?void 0:t.basename).replace(/\{\{vaultName\}\}/g,this.app.vault.getName()).replace(/\{\{vaultId\}\}/g,this.app.appId);if(t&&d.match(/\{\{uid\}\}/g)){let p=(a=await this.getUIDFromFile(t))!=null?a:t.basename;d=d.replace(/\{\{uid\}\}/g,p)}if(t&&d.match(/\{\{alias\}\}/g)){let p=(0,k.parseFrontMatterAliases)((l=this.app.metadataCache.getFileCache(t))==null?void 0:l.frontmatter),u=p?p[0]:t==null?void 0:t.basename;d=d.replace(/\{\{alias\}\}/g,u)}await W(d),new k.Notice(`Advanced URI in format "${c.name}" copied to your clipboard`);return}await W(i),new k.Notice("Advanced URI copied to your clipboard")}getFileFromUID(n){var i;let e=this.app.vault.getMarkdownFiles(),t=this.settings.idField;for(let o of e)if(r.getFrontmatterUIDs((i=this.app.metadataCache.getFileCache(o))==null?void 0:i.frontmatter,t).some(l=>l===n||typeof l=="number"&&Number(n)===l))return o}getFileFromBlockID(n){var t,i;let e=this.app.vault.getMarkdownFiles();n=n.toLowerCase();for(let o of e)if(((i=(t=this.app.metadataCache.getFileCache(o))==null?void 0:t.blocks)==null?void 0:i[n])!=null)return o}};var oe=require("obsidian"),ie=class extends oe.FuzzySuggestModal{constructor(e){super(e.app);this.plugin=e,this.setPlaceholder("Choose a workspace")}getItems(){let e=this.app.internalPlugins.getEnabledPluginById("workspaces");if(!e)new oe.Notice("Workspaces plugin is not enabled");else return Object.keys(e.workspaces)}getItemText(e){return e}onChooseItem(e,t){this.plugin.tools.copyURI({workspace:e})}};var ae=class extends w.Plugin{constructor(){super(...arguments);this.handlers=new Z(this);this.tools=new J(this)}getActiveView(){var e;return(e=this.app.workspace.activeLeaf)==null?void 0:e.view}decodeParameterValues(e){for(let t in e){let i=e[t];typeof i=="string"&&(e[t]=decodeURIComponent(i))}return e}async onload(){await this.loadSettings(),this.addSettingTab(new te(this.app,this)),this.addCommand({id:"copy-uri-current-file",name:"Copy URI for file with options",callback:()=>this.handlers.handleCopyFileURI(!1,!1)}),this.addCommand({id:"copy-uri-current-file-simple",name:"Copy URI for current file",callback:()=>this.handlers.handleCopyFileURI(!0,!1)}),this.addCommand({id:"copy-uri-current-file-with-format",name:"Copy formatted URI for file with options ",callback:()=>this.handlers.handleCopyFileURI(!1,!0)}),this.addCommand({id:"copy-uri-current-file-simple-with-format",name:"Copy formatted URI for current file",callback:()=>this.handlers.handleCopyFileURI(!0,!0)}),this.addCommand({id:"copy-uri-daily",name:"Copy URI for daily note",callback:()=>new B(this,!1).open()}),this.addCommand({id:"copy-uri-search-and-replace",name:"Copy URI for search and replace",callback:()=>{let e=new U(this,"Used file for search and replace");e.open(),e.onChooseItem=t=>{new ee(this,t==null?void 0:t.source).open()}}}),this.addCommand({id:"copy-uri-command",name:"Copy URI for command",callback:()=>{let e=new U(this,"Select a file to be opened before executing the command");e.open(),e.onChooseItem=t=>{new _(this,t==null?void 0:t.source).open()}}}),this.addCommand({id:"copy-uri-block",name:"Copy URI for current block",checkCallback:e=>{let t=this.app.workspace.getActiveViewOfTyp
Line truncated
|
||||
`),d;if(t.heading){let p=D(this.app,e,t.heading);if(d=p==null?void 0:p.lastLine,d===void 0)return;p.firstLine==p.lastLine&&t.separator&&(t.separator=`
|
||||
`+t.separator)}else if(t.block){let p=z(this.app,e,t.block);if(p===void 0)return;d=p.lastLine+1}else t.line?d=Number(t.line):d=c.length;d=Math.max(1,d),c[d-1]=((a=c[d-1])!=null?a:"")+((l=t.separator)!=null?l:`
|
||||
`)+t.data,o=c.join(`
|
||||
`)}else i=e,o=t.data;return this.writeAndOpenFile(i,o,t)}async prepend(e,t){var a,l,r;let i,o;if(e instanceof w.TFile){i=e.path;let c=await this.app.vault.read(e),d=this.app.metadataCache.getFileCache(e),p=c.split(`
|
||||
`),h;if(t.heading){if(h=(a=ce(this.app,e,t.heading))==null?void 0:a.firstLine,h===void 0)return;h+=1}else t.line?h=Number(t.line):d.frontmatterPosition?h=d.frontmatterPosition.end.line+2:h=1;h=Math.max(1,h),p[h-1]=`${t.data}${(l=t.separator)!=null?l:`
|
||||
`}${(r=p[h-1])!=null?r:""}`,o=p.join(`
|
||||
`)}else i=e,o=t.data;return this.writeAndOpenFile(i,o,t)}async writeAndOpenFile(e,t,i){let o=this.app.vault.getAbstractFileByPath(e);if(o instanceof w.TFile)await this.app.vault.modify(o,t);else{let a=e.split("/"),l=a.slice(0,a.length-1).join("/");a.length>1&&!(this.app.vault.getAbstractFileByPath(l)instanceof w.TFolder)&&await this.app.vault.createFolder(l),/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/.test(t)?await this.app.vault.createBinary(e,(0,w.base64ToArrayBuffer)(t)):await this.app.vault.create(e,t)}return this.openExistingFileAndSetCursor(e,i),this.app.vault.getAbstractFileByPath(e)}async openExistingFileAndSetCursor(e,t){t.openmode!="silent"&&this.settings.openFileOnWrite&&(await this.open({file:e,setting:this.settings.openFileOnWriteInNewPane,parameters:t}),t.line!=null||t.column!=null||t.offset!=null?await this.setCursorInLine(t):t.mode!=null&&await this.setCursor(t))}async open({file:e,setting:t,parameters:i,supportPopover:o,mode:a}){var r;let l;if(i.openmode=="popover"&&(o==null||o)){let c=this.app.plugins.plugins["obsidian-hover-editor"];c||(new w.Notice("Cannot find Hover Editor plugin. Please file an issue."),this.failure(i)),await new Promise(d=>{l=c.spawnPopover(void 0,()=>{this.app.workspace.setActiveLeaf(l,{focus:!0}),d()})})}else{let c=t;if(i.newpane!==void 0&&(c=i.newpane=="true"),i.openmode!==void 0&&(i.openmode=="true"||i.openmode=="false"?c=i.openmode=="true":i.openmode=="popover"?c=!1:w.Platform.isMobile&&i.openmode=="window"||(c=i.openmode)),c=="silent")return;if(w.Platform.isMobileApp&&c=="window"&&(c=!0),e!=null){let d=!1;isBoolean(c)&&this.app.workspace.iterateAllLeaves(p=>{var h;if(((h=p.view.file)==null?void 0:h.path)===i.filepath){if(d&&p.width==0)return;d=!0,this.app.workspace.setActiveLeaf(p,{focus:!0}),l=p}})}l||(l=this.app.workspace.getLeaf(c),this.app.workspace.setActiveLeaf(l,{focus:!0}))}if(e instanceof w.TFile?await l.openFile(e):e!=null&&await this.app.workspace.openLinkText(e,"/",!1,a!=null?{state:{mode:a}}:re(i)),l.view instanceof w.MarkdownView){let c=l.getViewState();a!=null?c.state.mode=a:c.state={...c.state,...(r=re(i))==null?void 0:r.state},await l.setViewState(c)}return l}async setCursor(e){let t=this.app.workspace.getActiveViewOfType(w.MarkdownView);if(!t)return;let i=e.mode,o=t.editor,a=t.leaf.getViewState();if(a.state.mode="source",i==="append"){let l=o.lastLine(),r=o.getLine(l).length;await t.leaf.setViewState(a,{focus:!0}),o.setCursor({ch:r,line:l}),t.editor.scrollIntoView({from:{line:l,ch:r},to:{line:l,ch:r}},!0)}else i==="prepend"&&(await t.leaf.setViewState(a,{focus:!0}),o.setCursor({ch:0,line:0}),t.editor.scrollIntoView({from:{line:0,ch:0},to:{line:0,ch:0}},!0));await new Promise(l=>setTimeout(l,10)),e.viewmode=="preview"&&(a.state.mode="preview",await t.leaf.setViewState(a))}async setCursorInLine(e){let t=this.app.workspace.getActiveViewOfType(w.MarkdownView);if(!t)return;let i=t.leaf.getViewState(),o=e.line!=null?Number(e.line):void 0,a=e.column?Number(e.column):void 0;i.state.mode="source",await t.leaf.setViewState(i);let l,r;if(e.offset!=null){let c=t.editor.offsetToPos(Number(e.offset));l=c.line,r=c.ch}else{l=o!=null?Math.min(o-1,t.editor.lineCount()-1):t.editor.getCursor().line;let c=t.editor.getLine(l).length-1;r=Math.min(a-1,c)}t.editor.focus(),t.editor.setCursor({line:l,ch:r}),t.editor.scrollIntoView({from:{line:l,ch:r},to:{line:l,ch:r}},!0),await new Promise(c=>setTimeout(c,10)),e.viewmode=="preview"&&(i.state.mode="preview",await t.leaf.setViewState(i))}async loadSettings(){this.settings=Object.assign(ve,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}};
|
||||
`)}else i=e,o=t.data;return this.writeAndOpenFile(i,o,t)}async prepend(e,t){var a,l,s;let i,o;if(e instanceof w.TFile){i=e.path;let c=await this.app.vault.read(e),d=this.app.metadataCache.getFileCache(e),p=c.split(`
|
||||
`),u;if(t.heading){if(u=(a=D(this.app,e,t.heading))==null?void 0:a.firstLine,u===void 0)return;u+=1}else if(t.block){let h=z(this.app,e,t.block);if(h===void 0)return;u=h.firstLine+1}else t.line?u=Number(t.line):d.frontmatterPosition?u=d.frontmatterPosition.end.line+2:u=1;u=Math.max(1,u),p[u-1]=`${t.data}${(l=t.separator)!=null?l:`
|
||||
`}${(s=p[u-1])!=null?s:""}`,o=p.join(`
|
||||
`)}else i=e,o=t.data;return this.writeAndOpenFile(i,o,t)}async writeAndOpenFile(e,t,i){let o=this.app.vault.getAbstractFileByPath(e);if(o instanceof w.TFile)await this.app.vault.modify(o,t);else{let a=e.split("/"),l=a.slice(0,a.length-1).join("/");a.length>1&&!(this.app.vault.getAbstractFileByPath(l)instanceof w.TFolder)&&await this.app.vault.createFolder(l),/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/.test(t)?await this.app.vault.createBinary(e,(0,w.base64ToArrayBuffer)(t)):await this.app.vault.create(e,t)}return await this.openExistingFileAndSetCursor(e,i),this.app.vault.getFileByPath(e)}async openExistingFileAndSetCursor(e,t){t.openmode!="silent"&&this.settings.openFileOnWrite&&(await this.open({file:e,setting:this.settings.openFileOnWriteInNewPane,parameters:t}),t.line!=null||t.column!=null||t.offset!=null?await this.setCursorInLine(t):t.mode!=null&&await this.setCursor(t))}async open({file:e,setting:t,parameters:i,supportPopover:o,mode:a}){var s;let l;if(i.openmode=="popover"&&(o==null||o)){let c=this.app.plugins.plugins["obsidian-hover-editor"];c||(new w.Notice("Cannot find hover editor plugin. Please file an issue."),this.failure(i)),await new Promise(d=>{l=c.spawnPopover(void 0,()=>{this.app.workspace.setActiveLeaf(l,{focus:!0}),d()})})}else{let c=t,d=isBoolean(c);if(i.newpane!==void 0&&(c=i.newpane=="true",d=!0),i.openmode!==void 0&&(i.openmode=="true"||i.openmode=="false"?(c=i.openmode=="true",d=!0):i.openmode=="popover"?(c=!1,d=!1):i.openmode=="split-or-focus"?(c="split",d=!0):w.Platform.isMobile&&(i.openmode=="window"||i.openmode=="window-or-focus")?(c=!1,d=i.openmode=="window-or-focus"):i.openmode=="window-or-focus"?(c="window",d=!0):(c=i.openmode,d=!1)),c=="silent")return;if(w.Platform.isMobileApp&&c=="window"&&(c=!0),e!=null){let p=!1;if(d){let u=e instanceof w.TFile?e.path:i.filepath;this.app.workspace.iterateAllLeaves(h=>{if(h.getViewState().state.file===u){if(p&&h.width==0)return;p=!0,this.app.workspace.setActiveLeaf(h,{focus:!0}),l=h}})}}l||(l=this.app.workspace.getLeaf(c),this.app.workspace.setActiveLeaf(l,{focus:!0}))}if(e instanceof w.TFile?await l.openFile(e):e!=null&&await this.app.workspace.openLinkText(e,"/",!1,a!=null?{state:{mode:a}}:pe(i)),l.view instanceof w.MarkdownView){let c=l.getViewState();a!=null?c.state.mode=a:c.state={...c.state,...(s=pe(i))==null?void 0:s.state},await l.setViewState(c)}return l}async setCursor(e){let t=this.app.workspace.getActiveViewOfType(w.MarkdownView);if(!t)return;let i=e.mode,o=t.editor,a=t.leaf.getViewState();if(a.state.mode="source",i==="append"){let l;if(e.heading){let d=D(this.app,t.file,e.heading);l=d==null?void 0:d.lastLine}else if(e.block){let d=z(this.app,t.file,e.block);l=d==null?void 0:d.lastLine}else l=o.lastLine();if(l===void 0)return;let s=e.heading&&l<o.lineCount()?Math.max(0,l-1):Math.min(l,o.lastLine()),c={line:s,ch:o.getLine(s).length};await t.leaf.setViewState(a,{focus:!0}),o.setCursor(c),t.editor.scrollIntoView({from:c,to:c},!0)}else if(i==="prepend"||!i&&e.heading){await t.leaf.setViewState(a,{focus:!0});let l;if(e.heading){let s=D(this.app,t.file,e.heading);l=s==null?void 0:s.firstLine}else if(e.block){let s=z(this.app,t.file,e.block);l=s==null?void 0:s.firstLine}else l=0;if(l===void 0)return;o.setCursor({line:l,ch:0}),t.editor.scrollIntoView({from:{line:l,ch:0},to:{line:l,ch:0}},!0)}await new Promise(l=>window.setTimeout(l,10)),e.viewmode=="preview"&&(a.state.mode="preview",await t.leaf.setViewState(a))}async setCursorInLine(e){let t=this.app.workspace.getActiveViewOfType(w.MarkdownView);if(!t)return;let i=t.leaf.getViewState(),o=e.line!=null?Number(e.line):void 0,a=e.column?Number(e.column):void 0;i.state.mode="source",await t.leaf.setViewState(i);let l,s;if(e.offset!=null){let c=t.editor.offsetToPos(Number(e.offset));l=c.line,s=c.ch}else{l=o!=null?Math.min(o-1,t.editor.lineCount()-1):t.editor.getCursor().line;let c=t.editor.getLine(l).length-1;s=Math.min(a-1,c)}t.editor.focus(),t.editor.setCursor({line:l,ch:s}),t.editor.scrollIntoView({from:{line:l,ch:s},to:{line:l,ch:s}},!0),await new Promise(c=>window.setTimeout(c,10)),e.viewmode=="preview"&&(i.state.mode="preview",await t.leaf.setViewState(i))}async loadSettings(){let e=await this.loadData();this.settings={...be,...e}}async saveSettings(){await this.saveData(this.settings)}};
|
||||
//! All of these methods are taken from https://www.npmjs.com/package/obsidian-daily-notes-interface.
|
||||
/*! Bundled license information:
|
||||
|
||||
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"id": "obsidian-advanced-uri",
|
||||
"name": "Advanced URI",
|
||||
"description": "Advanced modes for Obsidian URI",
|
||||
"description": "Control various aspects through URIs, including opening files, creating new files, and executing commands.",
|
||||
"isDesktopOnly": false,
|
||||
"js": "main.js",
|
||||
"fundingUrl": "https://ko-fi.com/vinzent",
|
||||
"version": "1.46.0",
|
||||
"version": "2.2.0",
|
||||
"author": "Vinzent",
|
||||
"authorUrl": "https://github.com/Vinzent03"
|
||||
"authorUrl": "https://github.com/Vinzent03",
|
||||
"minAppVersion": "1.5.7"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
.advanced-uri-data-section {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.advanced-uri-data-input {
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
margin-bottom: var(--size-4-4);
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.modal .advanced-uri-mode-option.setting-item:hover {
|
||||
background: var(--background-modifier-hover);
|
||||
}
|
||||
+44
-5
@@ -1,14 +1,23 @@
|
||||
{
|
||||
"showTabTitlebarButtons": true,
|
||||
"copyLinkToElemenetAnchorTo100": false,
|
||||
"copyFrameLinkByName": false,
|
||||
"disableDoubleClickTextEditing": false,
|
||||
"phoneFooterSafeAreaPadding": false,
|
||||
"tabletFooterSafeAreaPadding": false,
|
||||
"folder": "Excalidraw",
|
||||
"libraryFolderPath": "Excalidraw/Libraries",
|
||||
"libraryFileName": "local-library",
|
||||
"libraryStorageMode": "data-json",
|
||||
"libraryMigrationStatus": "pending",
|
||||
"libraryMigrationSnoozeUntil": 0,
|
||||
"cropFolder": "",
|
||||
"annotateFolder": "",
|
||||
"embedUseExcalidrawFolder": false,
|
||||
"templateFilePath": "Excalidraw/Template.excalidraw",
|
||||
"scriptFolderPath": "Excalidraw/Scripts",
|
||||
"allowJavaScriptFiles": false,
|
||||
"storeScriptFilesAsJavaScript": false,
|
||||
"fontAssetsPath": "Excalidraw/CJK Fonts",
|
||||
"loadChineseFonts": false,
|
||||
"loadJapaneseFonts": false,
|
||||
@@ -16,8 +25,6 @@
|
||||
"compress": true,
|
||||
"decompressForMDView": false,
|
||||
"onceOffCompressFlagReset": true,
|
||||
"onceOffGPTVersionReset": true,
|
||||
"autosave": true,
|
||||
"autosaveIntervalDesktop": 60000,
|
||||
"autosaveIntervalMobile": 30000,
|
||||
"drawingFilenamePrefix": "Drawing ",
|
||||
@@ -55,7 +62,6 @@
|
||||
"penModeDoubleTapEraser": true,
|
||||
"penModeSingleFingerPanning": true,
|
||||
"penModeCrosshairVisible": true,
|
||||
"panWithRightMouseButton": false,
|
||||
"renderImageInMarkdownReadingMode": false,
|
||||
"renderImageInHoverPreviewForMDNotes": false,
|
||||
"renderImageInMarkdownToPDF": false,
|
||||
@@ -85,7 +91,7 @@
|
||||
"pageTransclusionCharLimit": 200,
|
||||
"wordWrappingDefault": 0,
|
||||
"removeTransclusionQuoteSigns": true,
|
||||
"iframelyAllowed": true,
|
||||
"oEmbedAllowed": false,
|
||||
"pngExportScale": 1,
|
||||
"exportWithTheme": true,
|
||||
"exportWithBackground": false,
|
||||
@@ -99,6 +105,7 @@
|
||||
"embedType": "excalidraw",
|
||||
"embedMarkdownCommentLinks": true,
|
||||
"embedWikiLink": true,
|
||||
"embedPlaceholderImage": true,
|
||||
"syncExcalidraw": false,
|
||||
"experimentalFileType": false,
|
||||
"experimentalFileTag": "✏️",
|
||||
@@ -111,6 +118,7 @@
|
||||
"zoteroCompatibility": false,
|
||||
"fieldSuggester": true,
|
||||
"enableOnloadScripts": false,
|
||||
"enableCommandLinks": false,
|
||||
"compatibilityMode": false,
|
||||
"drawingOpenCount": 0,
|
||||
"library": "deprecated",
|
||||
@@ -6807,9 +6815,36 @@
|
||||
"mdFontColor": "Black",
|
||||
"mdBorderColor": "Black",
|
||||
"mdCSS": "",
|
||||
"markdownImageSettings": {
|
||||
"defaults": {
|
||||
"width": 500,
|
||||
"paddingBottom": 10,
|
||||
"fontFamily": "Virgil",
|
||||
"fontColor": "Black",
|
||||
"border": {
|
||||
"enabled": false,
|
||||
"color": "Black"
|
||||
},
|
||||
"css": "",
|
||||
"transclusion": {
|
||||
"enabled": false,
|
||||
"fontFamily": "Cascadia",
|
||||
"fontColor": "Black",
|
||||
"border": {
|
||||
"enabled": false,
|
||||
"color": "Black"
|
||||
},
|
||||
"css": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"markdownImageDeletionPreference": "ask",
|
||||
"scriptEngineSettings": {},
|
||||
"previousRelease": "2.23.3",
|
||||
"autostartScripts": {},
|
||||
"autostartScriptFailures": {},
|
||||
"previousRelease": "2.28.1",
|
||||
"showReleaseNotes": true,
|
||||
"useDeclarativeSettings": true,
|
||||
"excalidrawMasteryPromoCollapsed": false,
|
||||
"compareManifestToPluginVersion": true,
|
||||
"showNewVersionNotification": true,
|
||||
@@ -7340,6 +7375,7 @@
|
||||
}
|
||||
},
|
||||
"aiDefaultTextModel": "gpt-5-mini",
|
||||
"aiDefaultMultimodalModel": "gpt-5-mini",
|
||||
"aiDefaultImageGenerationModel": "gpt-image-1",
|
||||
"aiDefaultMaxOutgoingTokens": 0,
|
||||
"aiDefaultMaxResponseTokens": 4096,
|
||||
@@ -7664,5 +7700,8 @@
|
||||
"margin": "normal"
|
||||
},
|
||||
"disableContextMenu": false,
|
||||
"onceOffGPTVersionReset": true,
|
||||
"autosave": true,
|
||||
"panWithRightMouseButton": false,
|
||||
"isDebugMode": false
|
||||
}
|
||||
+34
-7
@@ -1,10 +1,37 @@
|
||||
"use strict";var obsidian_module=require("obsidian"),view=require("@codemirror/view"),commands=require("@codemirror/commands"),lr=require("@lezer/lr"),language=require("@codemirror/language"),state=require("@codemirror/state");;const INITIAL_TIMESTAMP=Date.now();var LZString=function(){var r=String.fromCharCode,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",e={};function t(r,o){if(!e[r]){e[r]={};for(var n=0;n<r.length;n++)e[r][r.charAt(n)]=n}return e[r][o]}var i={compressToBase64:function(r){if(null==r)return"";var n=i._compress(r,6,function(r){return o.charAt(r)});switch(n.length%4){default:case 0:return n;case 1:return n+"===";case 2:return n+"==";case 3:return n+"="}},decompressFromBase64:function(r){return null==r?"":""==r?null:i._decompress(r.length,32,function(n){return t(o,r.charAt(n))})},compressToUTF16:function(o){return null==o?"":i._compress(o,15,function(o){return r(o+32)})+" "},decompressFromUTF16:function(r){return null==r?"":""==r?null:i._decompress(r.length,16384,function(o){return r.charCodeAt(o)-32})},compressToUint8Array:function(r){for(var o=i.compress(r),n=new Uint8Array(2*o.length),e=0,t=o.length;e<t;e++){var s=o.charCodeAt(e);n[2*e]=s>>>8,n[2*e+1]=s%256}return n},decompressFromUint8Array:function(o){if(null==o)return i.decompress(o);for(var n=new Array(o.length/2),e=0,t=n.length;e<t;e++)n[e]=256*o[2*e]+o[2*e+1];var s=[];return n.forEach(function(o){s.push(r(o))}),i.decompress(s.join(""))},compressToEncodedURIComponent:function(r){return null==r?"":i._compress(r,6,function(r){return n.charAt(r)})},decompressFromEncodedURIComponent:function(r){return null==r?"":""==r?null:(r=r.replace(/ /g,"+"),i._decompress(r.length,32,function(o){return t(n,r.charAt(o))}))},compress:function(o){return i._compress(o,16,function(o){return r(o)})},_compress:function(r,o,n){if(null==r)return"";var e,t,i,s={},u={},a="",p="",c="",l=2,f=3,h=2,d=[],m=0,v=0;for(i=0;i<r.length;i+=1)if(a=r.charAt(i),Object.prototype.hasOwnProperty.call(s,a)||(s[a]=f++,u[a]=!0),p=c+a,Object.prototype.hasOwnProperty.call(s,p))c=p;else{if(Object.prototype.hasOwnProperty.call(u,c)){if(c.charCodeAt(0)<256){for(e=0;e<h;e++)m<<=1,v==o-1?(v=0,d.push(n(m)),m=0):v++;for(t=c.charCodeAt(0),e=0;e<8;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;e<h;e++)m=m<<1|t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=c.charCodeAt(0),e=0;e<16;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete u[c]}else for(t=s[c],e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++),s[p]=f++,c=String(a)}if(""!==c){if(Object.prototype.hasOwnProperty.call(u,c)){if(c.charCodeAt(0)<256){for(e=0;e<h;e++)m<<=1,v==o-1?(v=0,d.push(n(m)),m=0):v++;for(t=c.charCodeAt(0),e=0;e<8;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;e<h;e++)m=m<<1|t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=c.charCodeAt(0),e=0;e<16;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete u[c]}else for(t=s[c],e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++)}for(t=2,e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;for(;;){if(m<<=1,v==o-1){d.push(n(m));break}v++}return d.join("")},decompress:function(r){return null==r?"":""==r?null:i._decompress(r.length,32768,function(o){return r.charCodeAt(o)})},_decompress:function(o,n,e){var t,i,s,u,a,p,c,l=[],f=4,h=4,d=3,m="",v=[],g={val:e(0),position:n,index:1};for(t=0;t<3;t+=1)l[t]=t;for(s=0,a=Math.pow(2,2),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;switch(s){case 0:for(s=0,a=Math.pow(2,8),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;c=r(s);break;case 1:for(s=0,a=Math.pow(2,16),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;c=r(s);break;case 2:return""}for(l[3]=c,i=c,v.push(c);;){if(g.index>o)return"";for(s=0,a=Math.pow(2,d),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;switch(c=s){case 0:for(s=0,a=Math.pow(2,8),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;l[h++]=r(s),c=h-1,f--;break;case 1:for(s=0,a=Math.pow(2,16),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;l[h++]=r(s),c=h-1,f--;break;case 2:return v.join("")}if(0==f&&(f=Math.pow(2,d),d++),l[c])m=l[c];else{if(c!==h)return null;m=i+i.charAt(0)}v.push(m),l[h++]=i+m.charAt(0),i=m,0==--f&&(f=Math.pow(2,d),d++)}}};return i}();"function"==typeof define&&define.amd?define(function(){return LZString}):"undefined"!=typeof module&&null!=module?module.exports=LZString:"undefined"!=typeof angular&&null!=angular&&Line truncated
|
||||
let REACT_PACKAGES = `!function(){var e,t;e=this,t=function(e){function M(e){return null!==e&&"object"==typeof e&&"function"==typeof(e=te&&e[te]||e["@@iterator"])?e:null}function t(e,t,n){this.props=e,this.context=t,this.refs=oe,this.updater=n||ne}function n(){}function r(e,t,n){this.props=e,this.context=t,this.refs=oe,this.updater=n||ne}function o(e,t,n){var r,o={},u=null,a=null;if(null!=t)for(r in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(u=""+t.key),t)ae.call(t,r)&&!ie.hasOwnProperty(r)&&(o[r]=t[r]);var i=arguments.length-2;if(1===i)o.children=n;else if(1<i){for(var l=Array(i),c=0;c<i;c++)l[c]=arguments[c+2];o.children=l}if(e&&e.defaultProps)for(r in i=e.defaultProps)void 0===o[r]&&(o[r]=i[r]);return{$$typeof:g,type:e,key:u,ref:a,props:o,_owner:w.current}}function D(e,t){return{$$typeof:g,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function c(e){return"object"==typeof e&&null!==e&&e.$$typeof===g}function U(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}function f(e,t){return"object"==typeof e&&null!==e&&null!=e.key?U(""+e.key):t.toString(36)}function s(e,t,n,r,o){var u=!1;if(null===(e="undefined"!==(i=typeof e)&&"boolean"!==i?e:null))u=!0;else switch(i){case"string":case"number":u=!0;break;case"object":switch(e.$$typeof){case g:case H:u=!0}}if(u)return o=o(u=e),e=""===r?"."+f(u,0):r,ue(o)?(n="",s(o,t,n=null!=e?e.replace(le,"$&/")+"/":n,"",function(e){return e})):null!=o&&(c(o)&&(o=D(o,n+(!o.key||u&&u.key===o.key?"":(""+o.key).replace(le,"$&/")+"/")+e)),t.push(o)),1;if(u=0,r=""===r?".":r+":",ue(e))for(var a=0;a<e.length;a++){var i,l=r+f(i=e[a],a);u+=s(i,t,n,l,o)}else if("function"==typeof(l=M(e)))for(e=l.call(e),a=0;!(i=e.next()).done;)u+=s(i=i.value,t,n,l=r+f(i,a++),o);else if("object"===i)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return u}function u(e,t,n){var r;return null==e||(r=0,s(e,e=[],"","",function(e){return t.call(n,e,r++)})),e}function V(t){var e;if(-1===t._status&&((e=(e=t._result)()).then(function(e){0!==t._status&&-1!==t._status||(t._status=1,t._result=e)},function(e){0!==t._status&&-1!==t._status||(t._status=2,t._result=e)}),-1===t._status)&&(t._status=0,t._result=e),1===t._status)return t._result.default;throw t._result}function a(e,t){var n=e.length;for(e.push(t);0<n;){var r=n-1>>>1,o=e[r];if(!(0<p(o,t)))break;e[r]=t,e[n]=o,n=r}}function i(e){return 0===e.length?null:e[0]}function l(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;for(var r=0,o=e.length,u=o>>>1;r<u;){var a=2*(r+1)-1,i=e[a],l=a+1,c=e[l];if(p(i,n)<0)r=l<o&&p(c,i)<0?(e[r]=c,e[l]=n,l):(e[r]=i,e[a]=n,a);else{if(!(l<o&&p(c,n)<0))break;e[r]=c,e[l]=n,r=l}}}return t}function p(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}function y(e){for(var t=i(E);null!==t;){if(null===t.callback)l(E);else{if(!(t.startTime<=e))break;l(E),t.sortIndex=t.expirationTime,a(C,t)}t=i(E)}}function d(e){var t;j=!1,y(e),I||(null!==i(C)?(I=!0,m(b)):null!==(t=i(E))&&_(d,t.startTime-e))}function b(e,t){I=!1,j&&(j=!1,se(L),L=-1),$=!0;var n=P;try{for(y(t),R=i(C);null!==R&&(!(R.expirationTime>t)||e&&!q());){var r,o=R.callback;"function"==typeof o?(R.callback=null,P=R.priorityLevel,r=o(R.expirationTime<=t),t=v(),"function"==typeof r?R.callback=r:R===i(C)&&l(C),y(t)):l(C),R=i(C)}var u,a=null!==R||(null!==(u=i(E))&&_(d,u.startTime-t),!1);return a}finally{R=null,P=n,$=!1}}function q(){return!(v()-de<ye)}function m(e){O=e,T||(T=!0,be())}function _(e,t){L=fe(function(){e(v())},t)}function A(e){throw Error("act(...) is not supported in production builds of React.")}var N,h,B,v,z,g=Symbol.for("react.element"),H=Symbol.for("react.portal"),W=Symbol.for("react.fragment"),Y=Symbol.for("react.strict_mode"),G=Symbol.for("react.profiler"),J=Symbol.for("react.provider"),K=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),Z=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),te=Symbol.iterator,ne={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,n){},enqueueReplaceState:function(e,t,n,r){},enqueueSetState:function(e,t,n,r){}},re=Object.assign,oe={},k=(t.prototype.isReactComponent={},t.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},t.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},n.prototype=t.prototype,r.prototype=new n),ue=(k.constructor=r,re(k,t.prototype),k.isPureReactComponent=!0,Array.isArray),ae=Object.prototype.hasOwnProperty,w={current:null},ie={key:!0,ref:!0,__self:!0,__source:!0},le=/\\/+/g,S={current:null},x={transition:null},C=(v="object"==typeof performance&&"function"==typeof p
Line truncated
|
||||
const unpackExcalidraw = () => LZString.decompressFromBase64("BTCCBoFMEoF4D4DeAiA9gIwFaQMYBdlZY8BPAB0lQDMACSADzNQCc8BnAMg7S1wKNIVqNALaoAJgFcANpAD8YqbIB0DJqzaxIwZpACOkgJa7gyXQEN8yaOF0Hj2s5Et4AtONQjrt/UZNOXAHpMNnpXZkkAOzxDEUhraAAuZCoo/ENUSMJickpacUgqQ0jILgKikuVzEXE5cuLtAG0Aq3AWtw8vNot8YNDwqJi45ABdKCSebCsBXOE1FnY5eY1lAFF6HHNpQ3FmcwB3ABlDdC0dXwdTHoIbOz9Ha/dPbzvL9r6wiOjY+Ogk0DWGy2Oz2RxOZwBACVnPhwFCYXgACIAeQAsnDlNCXMoQvRIYMftAAL7QYBsSDSKjgYCQcB4cCGOBIXR4STMSI0SKwRAAJgAzAAWRLAcxw2xMxDMZTMMC3ZTiMDgRDlcwyPDCpnSaQkgDcADdzMwaABNWAygCMAFYBQKedAdbI8DQANKwRpjAASbpGOtSkXSmRoABVgIzEIYqKGADwAdgAbAAOaAstmRACE5t9LGAjrosAADHTYM7lLJIgBzPAACx1OugiFzoC0AGo8PB4JmI9HnY1QCNoHhYKAdRTyeHI2nQ/BYB7e/3k5BWey0/mR0Pm+aiV3IAIF0v05uiX6AxyAFKyyWL1M0c08mMCuM8qNDrigZ+3+8JmNEhuLmiD5BpBwcBBXAGNIjAsD0HAc0AE5wAQ8AeQQ5CUMLaDzWA6RwHLFD6RjJDwDjQjUIFcAAC8EMkWwkMwcAMJEcB4Pg8BUHAMimIQvkEMtGCCO4vloKpcB9hgujELIhN2K4yDRWQ+kYMYxDkMkhCWLk8A9BQwjzWw6SVJIkCjPAajkO4+idL0sjeMIjiAGtCMY4iEPNJTCOkqTIO4jTqJgiDEOAziYI48zdKM3jzLIgjkOg+SXKU1DUPM3jkOiizkLYSz3Ns8BPPUwiFJ5QtpMI8zcpQljUvAYCpJ5LTCPg6DiJ5ZDkOYRDEPNOjaXAGzkN46CYMLSrqI45zWsIsgcu43CyPEbTkOc4TMDo7i9FFbj6U2wjTJgzLUIIzyYqCuCjMEwiSC4jb9KC4juLjbiJsUxCCI65CpOIjSYOAqsYPasjMMgniXLI+DgOQ0SyKe7jzQc7SyphxjatsqTzPmyCxpk/rDGe3qoDhy0qXoJDxGuvliaQtjRKoWlmuJ5DIlgyGENFUTWuRmM4cihCpv6hCBTSrScfR29yqmjDrsBnKJvNUK9SIwyJsCzzzUG81hKMiaUs65ryqIhL+YQqhIns37cPN8BzF1ysELjUV2N43jzXMWlzL5gGyO4jiBWw5CqGJsjDVsxr2NEmCcapWGjPNeaoZ04mYcLGypPNerwZg3D4NFOOkIgx7lIV9jcKMqTfZgsuOqU2l+LxwnyrMxD/J5SrC+yxKiPEgzdcI9rWvm5GFsugvnKQracrxmMCJbuMFK+kqBULOODJEy3goVgy8vX6PRXRmLRVekeeVFRiqvcszaeM9zXqQwsG8Q2CIL9/NoKdiCCLwDjzX+pCWKoS0HJUnyeqRlrLlQ5iZaSNpo6GEol1aS5paSeR6oxGykdzSZVer9U+qFeIxnggRHAvEAaWgwSBc0kEeQLzxuWegnNKYgQcnGVAyBlBsDINsPApg2jQGUCIcwZAwAIFAHIMghpyQAEloiKj5HGJI5p7RUGzI2AsUACw6jfHgUskAKzVnUc2ZspJQAAFIeRyA9IkZ0PCyCSDYFWGkzZiBzmJDgTIbAnTIlgAmIqlpfRpBiIGAACoqWkg4VwMlgCuesKZ2TADwHITAiQADqhioAMmJMefxHJMCxIZOASI9YuyGDTMQLROiqwFK4AALVicoHAVZDQAGEJCQFAJwxk0AuDkRqXUxpzTWmhlcPIjpHBDCuFcA6P8O49A5MZFmGUhgHEADUaT2kMFGTRZZKw1nrMo6Z9JZnbiIMiAAPscpssATnHMiFwEMoA/gLNgMsu5qjhyjkgOOYAaZzx3OgOgCwdkdS/idE2QsO5Rk8jmcAHU+ZnylA4OePZ4x7TQFAPoqArhYAQq7MYnkRB8y/P+TqB5PIiSkqJNEjkhgjx+IyByRJNI6RpMQIomU0L1l1iBTQJs2SQmuGQgcyMGi9zXmHG4Vw5KrzshoPmal/pMk0GmRAGAnLBwAh6cwJpBR+kwCJROLpeBoCnMgBuIgAJNnVmFVKvAEynSGCHLU+pGq+mcONfInUFKaDVMZHIUZloHpFWbLE1wlpLTNzjFGKM5p8XNjjCGmRiQ8CypPJ6i8Hq/V8iKs+UAr4oyWhjIKAUSb5VdLuZefcNAQ1hqzTm9NRUi20poE8qJkqORvljZaGRchzSJBJTgaQ5g2BsFEA2Bo/TS3YqjPmU5oB4DVkMGwUpWyBxVmYKgfYnJIDrshOYCskBVjMFXTKAABpIg02xxA0CYGwQw8qAAkiBQBEhoMUGgHgcCSDiNEGgwhzVVhoEe1sVZ52Lote6lt/4gMLu2CUSRJQZQQAzDBcA+KiTQe0OOwVkbp2zsg6WBobBl2rvXSULdO7yx7oPdmE9kQz07BoGhzkH70CQCNPex9z6OT3rnVB/DRJXAMbfR+7ReAj32g9dxvDMHIhwcVGE8hKHdDsMsOh1JBrEC9igCMWAkRQCxMg2KHVuY7XujA+WiTBQXEiCvdoQsEAcZ2jpCBqsXBNEWc8NZ4AhYNnaK2bkvkNhzO4Hc6gckDKJO/tyfI8AAANZQVBV0iFDHSXDv7XA0lcHc1sTniT8IoJEBUpbxO4cU/2nA2hws+erMl4DEW7lEjYNsMrwTiApcq+U9TSqtM6b0/Ogz9pcyDhM0V4DbmrMhZUyE5DNhYvxc8DkyAGXiT6AvNigQkHLXplXNipzxSKtlOnZJyAbBdspfwxtjMNr/wteA2wTYkRxEFG+JsaQioot2r21s1wEnbs7oe8Jwwz3FSDJsFyEjXLdPcZsOYbTm7weykhco+kO5rUcq7JEZQJR6CcOeeYDHDBsc2BBXkw7AAhf5xTcdobJ84Oypz0ceBKBT+UmRIB0+UGeyQkAmcc5gBSi724HHo55054nDPWfHMgNORkfOZVbjwCxwR8iy3XjB6ACH+m6s3pY9u3dzWPsWuV1KsHLSeuZSVcSLXzBjglDYGFnZf5DC6uAJEGQ0giAwHe7hy3wB7RvMQC7rUAguCxOuzxm3G5+t/ibOFhoKy4sJaJaH5QludfkcVKicw1ZeHmHoIqQcSe0NsA3HIfXVYE3vjkPmBNp2ShBvkcoPAqA/gSvLWDvAunGREkbwAZTwMwYo5YfeG45N9xrkBe/94rJ54kjfTzd+RAAOSH8oob4GJNUH7XgeXkRZRwiJC4yIbiIj4GzPWereBM8A+/YKgpkZ8ymuy9WIjG7SO7v3Ye0woBX2oHfZ+p0IgbEnR6k9RIAaBM96NnA3Fv0Sh6MGhrBTNrxzRikzU2tp1Gh8wRg5AUCylnwM05Awc7E7lEgZsEtgAqxWF2Eb1FR3Q/hEgRBVArNSBSU+0B0h0/18dtFxAh0RBEAD8j9JAT8ZR6QmwQAJRlFBlIUDQjRQDhADVUUtAnMNwECpVH1SQ/hEA2BJAKAZQAtcN5csdiBqsoM2shwiRyMnRC8h9hsF19DvMykzC/w6lDBpBdhtErDwMA9tQ0NYMFccYIJRRmB6wWUcw/xBxVwdQ8B9F7dgUk9bDGg8AxgdxmBmxsCtkndnc5BzBEgYApcNsX9n1dN2paRRQ7l3UWxyFzB9FSVRsPMlVGUwxcwuQ3wCwuBJcC82sS9INEgCDgBb1TcG98c+twAM8s8RBigwtWsyloBXARjyC+Fc9bM/gndzQRloiuUSkmABEbAdwAB9Z3AYrHDEWw1hMfH3ZDYnX9VZSMSAJzXAu0TRaxWxZ3WHOxWkVI6sZsdHS433aQMcZRG439dsTMB4mxOxHom4hrAHGzOEP4PJF4mkE4qE2UZvIkN5f8ZQR4sE4kErZTYJOkW/T5WJDjNxHdMrYQcpPIzQ7Q6USAJTJrOog1HUDTSALrdXXrc3S7O1PYiTWw8Abkg4+kPonkwYxY7YkHdospLLVLdLUoj1QwW42APAnovwpIEgubcgthDhJLGgvJYkSEsrCfAfZ3S2CU3zZgWAZAAAHSyHrEaH8NZNNzyUtkjydFQAtOQAR1CJUTtVXDwGfHMC4DWWFKxycyJSiM5Wjz0Px0aEMESOIBSNDLbGuRGWD1QAcUCLySjDhXMFnVTIcQBH1O0FmOzwWLyS+yh3LIC3KJb2vFQCPE323wvGCKkLoGvwg2A1sJRQxNBJWXqzuz+yey2HcPLRlRJJiBwBoE1KoPNxVW9HCQkObMNE5DbLuRBKePyQZEF0UPIQzQECc2DxuMxOePXTsX2VhMGzGDtWB2UMiEGSjEMFaO7PXPhLPO2OYP7UHRoGizoCx04O4N4NcT7wEMb3g3GA0K0IV10OAycJcN0CaKMKcy0AQsLzUUXKNFdNoFXJryOwcQ2V428OkwV38Joib2ZSUQdzUTDIMQjKTxgtcMiBjLjLTPeN+kHGSLNXwwkK7BFBL2yOgGnHyQ9Q4qkxk2Ivaibx1DdNdVsHjMPBqPG2NICNYiCPIpiMLB9KJX9JzQkzorgtDNRWotzGR1w10u0TnCLAWQBLayd0iGfDwC4BzNgAaKj1gFQA4BADWW0y7USHxWOViWnHMDkB5B8qWMMAEpcy0o4DTGESlCPJgGyPlCCzG1C1vJxnMFcBxnak11ktJRxKa3EvAAIw+UaHEodO4xIpsDDyO3WWwoI2CMaJUWh1XFsp0qA1gu0VDMiHDIG1oravortMvNgEqLsLSK7GYACq4FQGfGcqdGRxpLpO0GYFcFFFQGWsKsJwL04rwvDwBPwyd12ptyjBnXgAFEfML3gGOtkRotaucPosRKazE3A1AAGqQrB2izz0mM+2Line truncated
|
||||
let {react, reactDOM } = new Function(`${REACT_PACKAGES}; return {react: React, reactDOM: ReactDOM};`)();
|
||||
"use strict";var obsidian_module=require("obsidian"),commands=require("@codemirror/commands"),lr=require("@lezer/lr"),highlight=require("@lezer/highlight"),language=require("@codemirror/language"),common=require("@lezer/common"),state=require("@codemirror/state"),view=require("@codemirror/view");;const INITIAL_TIMESTAMP=Date.now();
|
||||
const pako = (function() {
|
||||
const module = { exports: {} };
|
||||
const exports = module.exports;
|
||||
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).pako={})}(this,(function(e){"use strict";var t=(e,t,i,n)=>{let a=65535&e|0,r=e>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{a=a+t[n++]|0,r=r+a|0}while(--o);a%=65521,r%=65521}return a|r<<16|0};const i=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var n=(e,t,n,a)=>{const r=i,o=a+n;e^=-1;for(let i=a;i<o;i++)e=e>>>8^r[255&(e^t[i])];return-1^e};const a=16209;var r=function(e,t){let i,n,r,o,s,l,d,f,c,h,u,w,b,m,k,_,g,p,v,x,y,E,R,A;const Z=e.state;i=e.next_in,R=e.input,n=i+(e.avail_in-5),r=e.next_out,A=e.output,o=r-(t-e.avail_out),s=r+(e.avail_out-257),l=Z.dmax,d=Z.wsize,f=Z.whave,c=Z.wnext,h=Z.window,u=Z.hold,w=Z.bits,b=Z.lencode,m=Z.distcode,k=(1<<Z.lenbits)-1,_=(1<<Z.distbits)-1;e:do{w<15&&(u+=R[i++]<<w,w+=8,u+=R[i++]<<w,w+=8),g=b[u&k];t:for(;;){if(p=g>>>24,u>>>=p,w-=p,p=g>>>16&255,0===p)A[r++]=65535&g;else{if(!(16&p)){if(0==(64&p)){g=b[(65535&g)+(u&(1<<p)-1)];continue t}if(32&p){Z.mode=16191;break e}e.msg="invalid literal/length code",Z.mode=a;break e}v=65535&g,p&=15,p&&(w<p&&(u+=R[i++]<<w,w+=8),v+=u&(1<<p)-1,u>>>=p,w-=p),w<15&&(u+=R[i++]<<w,w+=8,u+=R[i++]<<w,w+=8),g=m[u&_];i:for(;;){if(p=g>>>24,u>>>=p,w-=p,p=g>>>16&255,!(16&p)){if(0==(64&p)){g=m[(65535&g)+(u&(1<<p)-1)];continue i}e.msg="invalid distance code",Z.mode=a;break e}if(x=65535&g,p&=15,w<p&&(u+=R[i++]<<w,w+=8,w<p&&(u+=R[i++]<<w,w+=8)),x+=u&(1<<p)-1,x>l){e.msg="invalid distance too far back",Z.mode=a;break e}if(u>>>=p,w-=p,p=r-o,x>p){if(p=x-p,p>f&&Z.sane){e.msg="invalid distance too far back",Z.mode=a;break e}if(y=0,E=h,0===c){if(y+=d-p,p<v){v-=p;do{A[r++]=h[y++]}while(--p);y=r-x,E=A}}else if(c<p){if(y+=d+c-p,p-=c,p<v){v-=p;do{A[r++]=h[y++]}while(--p);if(y=0,c<v){p=c,v-=p;do{A[r++]=h[y++]}while(--p);y=r-x,E=A}}}else if(y+=c-p,p<v){v-=p;do{A[r++]=h[y++]}while(--p);y=r-x,E=A}for(;v>2;)A[r++]=E[y++],A[r++]=E[y++],A[r++]=E[y++],v-=3;v&&(A[r++]=E[y++],v>1&&(A[r++]=E[y++]))}else{y=r-x;do{A[r++]=A[y++],A[r++]=A[y++],A[r++]=A[y++],v-=3}while(v>2);v&&(A[r++]=A[y++],v>1&&(A[r++]=A[y++]))}break}}break}}while(i<n&&r<s);v=w>>3,i-=v,w-=v<<3,u&=(1<<w)-1,e.next_in=i,e.next_out=r,e.avail_in=i<n?n-i+5:5-(i-n),e.avail_out=r<s?s-r+257:257-(r-s),Z.hold=u,Z.bits=w};const o=15,s=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),l=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),d=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),f=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var c=(e,t,i,n,a,r,c,h)=>{const u=h.bits;let w,b,m,k,_,g,p=0,v=0,x=0,y=0,E=0,R=0,A=0,Z=0,S=0,T=0,O=null;const U=new Uint16Array(16),D=new Uint16Array(16);let I,B,N,C=null;for(p=0;p<=o;p++)U[p]=0;for(v=0;v<n;v++)U[t[i+v]]++;for(E=u,y=o;y>=1&&0===U[y];y--);if(E>y&&(E=y),0===y)return a[r++]=20971520,a[r++]=20971520,h.bits=1,0;for(x=1;x<y&&0===U[x];x++);for(E<x&&(E=x),Z=1,p=1;p<=o;p++)if(Z<<=1,Z-=U[p],Z<0)return-1;if(Z>0&&(0===e||1!==y))return-1;for(D[1]=0,p=1;p<o;p++)D[p+1]=D[p]+U[p];for(v=0;v<n;v++)0!==t[i+v]&&(c[D[t[i+v]]++]=v);if(0===e?(O=C=c,g=20):1===e?(O=s,C=l,g=257):(O=d,C=f,g=0),T=0,v=0,p=x,_=r,R=E,A=0,m=-1,S=1<<E,k=S-1,1===e&&S>852||2===e&&S>592)return 1;for(;;){I=p-A,c[v]+1<g?(B=0,N=c[v]):c[v]>=g?(B=C[c[v]-g],N=O[c[v]-g]):(B=96,N=0),w=1<<p-A,b=1<<R,x=b;do{b-=w,a[_+(T>>A)+b]=I<<24|B<<16|N|0}while(0!==b);for(w=1<<p-1;T&w;)w>>=1;if(0!==w?(T&=w-1,T+=w):T=0,v++,0==--U[p]){if(p===y)break;p=t[i+c[v]]}if(p>E&&(T&k)!==m){for(0===A&&(A=E),_+=x,R=p-A,Z=1<<R;R+A<y&&(Z-=U[R+A],!(Z<=0));)R++,Z<<=1;if(S+=1<<R,1===e&&S>852||2===e&&S>592)return 1;m=T&k,a[m]=E<<24|R<<16|_-r|0}}return 0!==T&&(a[_+T]=p-A<<24|64<<16|0),h.bits=E,0},h={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{Z_FINISH:u,Z_BLOCK:w,Z_TREES:b,Z_OK:m,Z_STREAM_END:k,Z_NEED_DICT:_,Z_STREAM_ERROR:g,Z_DATA_ERROR:p,Z_MEM_ERROR:v,Z_BUF_ERROR:x,Z_DEFLATED:y}=h,E=16180,R=16190,A=16191,Z=16192,S=16194,T=16199,O=16200,U=16206,D=16209,I=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function B(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,thLine truncated
|
||||
|
||||
return module.exports;
|
||||
})();
|
||||
const unpackBase64Deflate = (b64) => {
|
||||
const binStr = atob(b64);
|
||||
const len = binStr.length;
|
||||
const bytes = new Uint8Array(len);
|
||||
for (let i = 0; i < len; i++) bytes[i] = binStr.charCodeAt(i);
|
||||
return new TextDecoder().decode(pako.inflate(bytes));
|
||||
};
|
||||
window.unpackBase64Deflate = unpackBase64Deflate;
|
||||
let REACT_PACKAGES = unpackBase64Deflate("eNrsvQtz27a2KPxXZH692sQxpEhynpRR7cSPJG0cp3bSNHV9PTQF2awpUAVBO46l/du/WQsPghSdpj173zl35s54LLwBAgvAwnpex7JzeF6k0zQWe5+TOEunMr454nGijkqh0jlnIWff381Kkag0Fx0VcqrI3SyX4XUsO4INxmJb9TMuLtTlWGxukrskF4XqSKZOxOk4nYVBoWQqLoINpm4XPJ91ZLe78VzK+LafFvgbSkKgRV0z66SiIwnUnPJZXGYq2GAs63Y3QszixPYRs8Pz33mi+hdcHd6IdzJfcKlud3mRyHShchlKmpFx3O2aclM+SwW35UJOMxpD5Ukc3XFRzrmMzzMebQzoBVdRSNj38iQ7XZHVSnJVStEx7cwk5194eF+rx7fz8zzrq/wYv/x9fEHvruOs5FFwkE/LjAcrQlZuTkXIyZ3pgHe7vH92xgtd0I18IXOVw/z1L+PC+9Z+EmdZyKmbKjLhfROO+ArW6DmVNGN3/PMil6qI7lYresDuVmPXfxySOyhY0IRyqqiACjSmOS3pjKZ0Shd0Ti/pBb2l5/SaXtGbsRnu8+UyfM6GtGDmm2EZAwnw01cyFkUKPcRZn2d8zoUKCE1aisLI4iwglLdkzmR8YeqqlmyArkSdzfMpDwgVba3LfJZmXAaEypZsgCVY+oDQrD1b8c/Qe9w2uFzexHJ6JvksIDRvG19ZLLgoYHBlS/acz/OA0FlLVhZ/uQ0ITVuy4kSl16mC7KnNThWXscolXbC7tDjIS6H4NLKrHFoQ2xiuKBd/lLzk+7lM+IfFNFbcL+fyj/giixN+rO4rcMzVeuaKzu2+jIsivRD0kt2t6J4Hw2mBR8xOPl/kggvVzC9Mu8y1i6cOHAk5tlwdJrzbDWypWqoos2yDcaIuZX7T2ZMSZk/FV7zoxKKjm+nks04BHXWuY5nC3i86Ku+UOCWdXHbijtslN5dpctnRc/j1JvoBGavLtOjrdmS/MVshZOJOC+yHBqQ+AbNqZbw5IHdtzXqraFsOvPrQ9OeqaeZ1Q8MbtuNlCX7T+UxwQyhZJiqXbIfOwxt/aITe9NPiXSl5Ywnh0GS1Y53esrtXEawDfa5/3uufY/xZ0XP2J6cbvWYPfnuw+eCCXrFqlZm7SDgcHLi0Ey8c+TPmwYyrd5OKaX7jA04jq4/t7F1zofTRqHBu1jLDgEM4oHfn5TksPVwdSSwSntmLZM6LIr7g0dogHIgyAGFzR1a5fVNxou+Q0CWQyKYQir1HfEXgnt0ww5umxSJWyaUeoSJEw+yKZwXvtE3HQuYJL4rW+TB5fT5PlWmoc52n01pGGJQiicuLS7X3OeELbIFyMgZAyjPex2GGnKzoDbubx4tol85yuRcnl5G/wakgd7shp95hovrxYpHdariO5UUJF0FBVlSQFU3giKsttl6qgb2dmo1tbq4IVSuqcoTPWtW2Kt61vCLL5cnpiuYiu23C19uQ20nu8HHtvME90t+5TLOp5KIPtTv884Inik/hpJE84ek178SdIhUXGe9ghY65LTsJVOwHBK7s/nNz5rOUHrgm2Q1E3Cbcowf9fXNfMk4P+u/M3ccERErJq7I79KB/jJfnQT7lTEHU3FUspwf9s7OdN6/33r4/e/32/d7R2+dvjs92D8/eHr4/+3C8d3Z4dPbx+dFbCB8dn71/tffpbOf5W8x99/Lo+e4eu9VtHB68e/1m7+js6MPb968P9tjd2Rlu97MzfRgkbctw23/VLwt+wOf5TpxccgAemIMEIqylwto11+EGdLATD3RcM8fphYgztl5TH04H/STLBd/TS8GagJrOsGXWvGHeX/KO7a0zLwvVOYflra0r7ZyXqnObl51FXBR82gk2+WYA1wYAsGTzEK5YOBUXBSAlvH/Fb8emxw2mEFmOARfGrTjYYExBkW43zFgQbGKEUEU2zjV+qGhMlsvgit8GjLF4uQzOzgqezbxYXsqE2zhgMxDsdnUHDDqQfLZchvIkPmXqJD7Vg42Zm1rzCOiNYKRDqE5kP7FwKsb2/Blux9UDItdXRhgDdjQYl9vxuNzcJPlJeVq1fFJujk7HXmO5xce/hLyPN1lGJcE1kzxWfEfjbC2AEoac3X33nT7dooyeJaWUXKifET3n9fgIEtSl5PF0B8+aAX0n8+t0yqWG3R2DOur7jPRtLuOkb/O87iQ9M9hkxFeUV+O9D8gQHAB5X9GYQR9NIJCtQBDXgMDBgCTdLsLABmOy27UwUMU0DOh4mJ1IWGhpFjr/ykLnJGtf6Lxa6NIsdA4I7WCcbufjdHOTlCepv9ApLLTXWLlKZyG+icyb5h3uCffpOWvkOHiF4duvyPErKpChMc08aDnis/VT4M4Agl5aKGxQ/VppB1fVIsdUcgEQwrFWWvwMr2q7wm/pAeL1X21iRs8W8W2Wx9Po7gyQy7KIekN6Jnmhn3X0LBWpivaxB3hBNBDlZoMlhUDEaZLPF7HkUbWtJ/B9kcKWChVL9d4929j61Xrbf08FPB5v+++ZGCt5q2GU8RAOqtv+8dggNVm3m4WCSkLX8A3pMB/ZinPIvrrkotvVv+EZvSKrBDAaGMcVXAWzVMRZdntnmlGuQYGnQdHthkqHbAqhMGL9maUoFKBnZ2XB8XY54jPJi8uWq8DcQ36pECGnLFqvIVMecR0s9BxLrD9mYHfX63glTQHTxE6cZedxctW6xtUIdSHMsxXvPQVdLV2iGu4uPy8v8OxjtfeeyZxxKfm0kd8ymlpJf0h7sxlP1Ffr6iLrlRCd/cq3eKWq73k9vX9RX0/dUr6eL+DtnF7zV7GYZn+2VM3i9fV6LQouofI3fGyjrP/Vb+LbvFTf0IZf0G/g4L5zwceu/AqHC5XO00KlyVerVcX8ykd8WiZc/snMmVL1CWs/Uasqs2o9mxupWdhsH1f8ViR7nxWXIs6OVS7/bGHXytcH2nY0NpuoymjouuaygArB8Fl/1H8aEHpQUd6OvS/wHoMtT8X1YzLkbNrt8pPp6XLJT4J//tPSf4JTMuH62nId7dnvRQICIpaMU4wYjIQpHZV8VrBL6hMamFguF1Vbn+FEcLGdf2PLZ7WWv9SwICaggXHzZivszXbFbyNFJZ9FDh2SE4Om4agisaraflcDbIdFKod1V0XfVmv09Tc879tRMcaKqoH31fV5F7AgCtggoEEEgVGwMl8UfBds8r7UBLfwwQmLTh9ctL1E1QkHgrRr/Y3/JV8foKGIAV44eR8G0CGgiJFylOpw67HX9GGoyF1xk8LNC3RWwEPIXRIXPJiV2SzNMj4NIjuuPlK4x5gt+e/4xA0i/TaCx0Nc5GJsKdOm1TWyh+1mouzdf0Yi1zkLFlxMoQI1+f4EuUx8regaiAjYytWgqRktg5PiL7Xhvozab4I2CKH/nglarUy8WoWj0NHkNRjFbnFpzjaGY/cSBVZNUArNjpgCHh93u8F5nmc8Fhg15wIhOdsYaDzdrERsxn2eXqRCBRFGzOroiCjn51wGEVY9lzy+0p9iQM4uabULdIudAqt3kmbFzszOzFEYAh6POC0Jed8iv8R99wqeAbmlsWQsA+JXzgJYJjkJ+sEmbIMBiSS9CDMyCQULAnoUZtAC03CfT3K3v65p8F33QUA2gwdBJGgQ3EPzIZGum3W74dswI/jAfhdmVGyaOc9gCy2XuP2v+C0zKZMgiGCHYYS09ks2cwSbRVlchhkhdGjeWQNael8Wyc0gCmCRgeJH7HNKv6G4ZbzBUyrfZEehZPwkPcWJi1m5+SaUNCXABHPUv/WLJGVwD+m2OUsNS0m/0zagxb4AJJGQ/jQXfGw7khqg631tbtZ7cwcSizUtdh3d57iViQOGQ+jbrrwhpylWET0NoUWTjotOLHlH5KpzDc+sTlw4Ygs+IjvhLC/FNOoEm2FwYkj2uuopbvKJGWLnJlWXnSt+W3Tugk1Dl4ZoyEn/9zwVYUA7sHKrIFJkMyD9zusZ0nDmPBZKE/Pg3deJO0meZVzv3nzWsY9Z2ikLDoyDGB7CnVQUisdI3TOfnlebfrd29409FIExDlQYNqBwMHB2cgrg2w7BSi+loJzKzU08pnjVx35oiNscoKs3xCPvzJ15IbJ+Vd+8Ogms/9qZq6kOrlJv6MeXy9CF2ZC6ptZO3W9vZVRvhdD6sAme1bbwoFaY1ku6KTIlLBnBApxN95CGvUWF7UlchCHN+oavyuKQkCq60hzqnIkQqmkaSkFLmtY5sUmNEzsznFhOc6Bo2XWHOYAZ5Azaojm7m0Z3M0B3fMabT4aMw0ejESEruhspuhMp+iZSdB4p+kuk6HGk6EGkVnQRDegsFdPdw4O3+dTgjK1MUMeghdPgv0kYpkn/7Gz38ODv0pVzmhjCzTscVeOxosUSRttNcpWlZcI96OhNo9OJH4ksjW1DLZcaCkU+5e9vF7zbfdaID+sFSH3+R8+eEUdzKvV2BlwUGRf9WVYWl/DaaKGxSKSx5P0FklfSWSiB1gJ18/6CjSh3vIawooRAGYUFBM370/4sBEp30l9InuRCrL8h1zlOsHfgPGxkQGI/kXlRHEpADsgkKAveSySfcqHSOCv0OaqiIDC4d2RGO+3j64AQM5IZV8nl7tvj2ke3DQSq7uIzDusBYtC2ylpOYdzWgmrhqQE/utsNJUtDwSBC6x9GM9ZSJxWKX8hU3U68sPlQGrfVwM98J9Pc1KrFbc2gULcZEtzFBD73GIQ41tuC9YOJTvjEj9hW7rzxR5JW48tovdd4RaJAi8Vgn3qOfwn5X2iCihy6bhklZkzMrxnbivjLp8VZ2haxdfnWmZQVjU+TLDeYXk77UbgXYzgpBUvDttWFDz5ofrDwPvivLv5fnY5I399Kz/0B4FxmhgDbbQfw1tn52uT8HbiH4QACLe4Hhv/o3Og3fEthCEz0jy1ah8m/u/ukJlDKd3mWJq3N1EtMmgm2oXQeX/BjmRxz1TpHV
Line truncated
|
||||
const unpackExcalidraw = () => unpackBase64Deflate("eNq8vXtX47iyPvz//hS0M8Oxk0qwc49Bw2tC6M40DTSXvjE5bCVRjJrEytgKl4Z893eVZDvOhZ6Zvc7+Tc8iUkkqlUqlu/T4noZbnccBHfNhSB+OeZ+YpkV+e76n4dYxDGEGU3La/84GsjQIGZUMHhL/kI14wM5CMWWhfIJJQveZPH0IEvohiwYhn0oRwuHmGCd0wiIYZQLPQiGFfJqy0xFcJPRpQizd0iiTHI6I6QEDaZHf2BYPtrz9B0V4ZsFswkLaHzP3jQ0DEYy4P0v9DyGXifuejmfMlXPL9a5Zj0joc2J6ZDQLBpKLwPSsZz4yMXMx2grZnzMesj1jZlghk7MwSEglOp2On0x5yyOgoT+bsEBG1q68DcXDVicMRWj+z+FTQCd8kCTZEqMt438KXuF/jC0ebQVCbkWz6VSEkg3/x5rDep77sduNg85C8fikAgL2oH2mB88+ky6qwSK/mT9h4lnXrIfltsAjkvzmxXXPiLz2ert8ZLKkkMxMioIZ6eIYH8RwNmZK7pGYBUOsgP4sGI6Zu2UUPGsOjCRiYAURb98zPWJbLgOZDTHZy4tnmow8s0csfuQ+z+dWKfYAs4AlHgs+JCmfRyI0UV6JGTMLa17qwrNr2YMlE5hbczghJgMJHCimxkrd3jaEsjCDkFhR8uXFSOo+Q7UwszGTWx7W2qEpLeuiNKDjscnAs15ePEIIf3l5QG9cARb5DfW4JIdJycSU4FnWywstLULm1m6i6Tl0vIVVm5IEs/H4DfH2p+bI9CzLfZ7DifmGbW9729te6eaGRboi9qX7YEowhmxEZ2NpwLM2bW9VE5g9nBOP/HZiPpjPczAWTNJUcURoZ2Q5Mj0woqdJX4yNN4lq2D4rGAZWqYX/vyVM9yLH5PnD6WHHNaahGM60PuFT97Jz452d3Rx47fedk8ObT+Wbt53Lm6vzY9e4lXIauTs73yMRlFjaMZUGYrJDp3znvryzmcPZ6cXfZzEVkczyOe4enHvnX5fTj3k/pCFn0QqTDeliORZpZ1FxwAIZ0rFTXKQuhkJMilMWRjySLBiw0mAsZsPE1KJSwOQi20w+Z8dXFzfHZwv+0/HsJ2Kp6N5ZJj6dTl+P7nXXCyCiqEj562k+X9xcdM4/dc6XdYbJBmI8pv3Xkx51zzsH3kXnpn16ctR96/7Ps0Gn/D17MlzD6/6gF0/e0KlNv44/DPjNY3fauhP1h7tOdPjD8zz7MLDPrwww6EzeHooJ5YHhGj9T8YiHrE8jhipQghhDKilSrs6PjYXof4cHFzGLaSiwy+gOf565AUYkRUh9djAb3DH5F6LS6TSaChnnMWFRRH0e+BcsGLJQ5VWvVZu2Xak6lUoZlTCdKrLjZgPcB9Z3q7TeKg9Zs1Lu12r9Ya0xYPbAMeb/s6iIzol3cNy5uTz32u+7J29dY0THEVu1o86Xs9Pzy5uzq4Pjbvvmfeer++8P3e5B97t3cuDf/Xl7x9+2HuwD72PnyPNO297Hpofhbf992/vY8aYf7e8fWh9/NC+HR8c/BjPv27cv/9r5fD97f3H6+yN/qHvnO98GnQo7+vj5w86kfzS8/eg/vW+yd2/v3n/ko/c/3jmPV9++tx+fvgweP9e/ndpl+a+7s9Ozx9sfheDxKuyKz+3DnU/Vk7eTK88ZPz68m52WnXcnjv/jfXhSeXzn1zpvvz+J2XnrnvcvW58O3x79y/+zXqh2Bzt3v38peIflDx8aX0NWLhxFp8OnKJzMPpePZhV6O2s7s4+dxvSUOd/tuwadnZzZT86ftcq/zsKD5mVUPr6asunntjNu/Oh+OZpUP/HDq+PZ0+cvl53p1eDdRdR517yfDh05uPv+NH1sP9zx6ehb9OXxX/ws+vFkC/vwscy98Gz0+cOX8ZHXbU3un47aT0ftSiG4uB89eVf9crs6++a3H7zZ09HtztPw7Kh62On86+xj99D76B38e1Fhh52Dq7dpvXa+XGIbu/S6J53zm4PTq5PD7snbm4PTL+tV3T49PvbOLjo3p58658fe1/UYMdfOxXH35DINPnv/9ubE+9Bxjf/vR3TPBz84DTJNSUf41Dm/6J6euIZdcpolp2obcHZ+eojjy9yCj0SayXD+1syM8+Sc0YGcW/CYjCcYPCSDMY2i54EIIhnOBlKEOD/DSVcpGoiQHcXdKfGgredixkAEkgXSgOueNY94cHcoHgJTWs9qNCcqbRwHZw2crHMzPWsXx/9de0/uJglNWXB++82xig6wZS567vTG5HsbWDHLsvoho3e7KzkTnBR581WqN+/P+v0xu5qaVGctlnIrjVngy1tYKQntgf+zksTFYMSkBWdvTxXDI6zggCQUOPHV9G9PLKlpmdVSfqxn7Xp7fHvblIQBJ5415yPTlMTbE9vbf5Xa61l7fN9zpUUIoZv0Q3trNUWJnK/G8ebTWXSb2kSio5gIWo7UBtbVWHSs+VRMTTXntwnZpOpkTozzst0NRmT3VgyipDgmEzx7bwNP1NsyDzQHpKS1b1sWePOQTcQ9Q/NFAd9sFnCDaZd4MGSPpyNTWpul8/6OWF4q1qpRbzJ1ae0vK9yz3OUyeZY1n0f8BzOt51g9G6SYh0wx7owZrqoWLX5jRSYFVbznFnzNdiAznPV6YUifSjxSv6ZnbW9XCSFeWmYjmE36LFzM/r1ru7eR7GwmlzeTK725tZtM+LbeYTl0oc13ZMOa40JNtLe3kxn3SkCJSxZSKcL97FI10WKc59zdEOhtb/8kO6+U6V0JISn9TeJeLMf3E9ncNEPL9Kx5Wsj3qnNXq0qZrnAIe3l5noPpEe/lxTAsHkSSBgNM/x47gVsebS3RTEl+T5vvjQi5zwM67gbTmSReTA2JLIWx2yey5MfuPpGlfuymRJZoEh9XrB75QOVtSblNx7bzcTxrx7HtOOJIhBMqCStpx8uLjF1JZiEdchbIy6cpI6yU9SZZ7TlJQ7oJsznGJCspmZ+J6K9H9NOI/UzE/nrEvmXBveCJV9wRWRJ3luXi4l1XyaKKULPxsv85dG3wXRv6rj0HSRzgavUJVP8I/eOTNw4E+EeSB8+UZLGIfmd6xIhkyAM/Y/n7Rx62fWxp5oVneqXQ2t5WDj9x9K19k5FLDAOv5ANSMCMbAmL8aqAdKq4qcSma9SMZmkXH2jemod83XAP/Wq7idZswjRLHvbVvcvJW04Bq1z32hFwlUHsCaXa30f3rrMZYiAUvoV1j5MUSXiLLa2xY4K3sW5kGNSxr3ytRVyYDw7O4c33QpuV6qbUFELqqgic8MMu1GmgPfTRZKQQcFPxXw30V3n81vK/CqSvnC3O4jJf7cWfxHLrlWi0/8UwPyrUa5hb7mfb3E79U/gwnz0tYeWSRnpFFWknSdLtogRwoScXTaUGQVPqY4uOcRVg7ZZyiUEKExUlI7F02jpgy5IDQooCQlGp7/n6wY5aLtCgsN9hR6XajBy4HtzibGtCIbXkuJyYrSmsnKJhsT+7XXdva1VMQFYFhBFn0MEI5GyAxwCsyDKjO+Q6pz2Ol3bocIjeEsetnFMJShcSFBbEYDvxlvW/JPRubeIE4Fjh7cnu7WJQg95yd+r5XqOdNVvSsvHTlXqm2z1y5V96p7HsFTTbLO5WitPJ115snfb6ugkrdTqvAse20CpQb5ztsnxNKBJGuyYlvMlLOy6IpicpH5k2nwCxXFlhR5pkFEryCs1PBJuWrvTUPKyx2FjHEgtiCeGw5NLYYkVGM/K9ZCoXEGLBwdN92gx2asZvYav4fmsT9kknwTMnr+b+sIl12Xc7RWKjVD3jEK6I+sHaKDPWgXB5WkKfd6LXQzwj/tb671LSvJQigQMED2btmvbiernEzNQ5SZF1t13FMDEJypiw0LgtwLM31yDMzA5NnlaSIu3CnblmwHMx+HixXgnvJXIJvb+PkrDS4paEnTdsiJOt3LAx3VsKdlfDySng5E76/zL6wzK2wnNj1St8FD0zDyIyvIlUL0P+6YjD4yjN5RkX0v60iDK+shFf+UxUWlnlt1KifMTRdyOu02PBfNbsNwgSenuIyortP22UvL46965H3Ovd30Xix+PNKUZEwNbv0ShE5jGcR75cmzeE/ZVn4S5aRl5n/Ky5DFlE5C6lkOPHNRO3+w9zHi9zHOvfxau7tv2J57vezLMNF327D0uTFK4XFTAUVVc55HBZwdVzyf5LQ/1nC/k8S9l9PuFzM8T/VXPEvNXcQs1xmoc7VSrcFZv1aqdsLhreE7dn7lbpdYC5b4fRRWcBrotxqhk7TVixX0g5iKfjI5NEJPTGZ9fLC9ohtrZ0JevHR55YUW1MxfqLDrcksklt9tkW3piLikt+zrXhtrPei1OJwuXycXKMf93gqdXuHgSDOrthju6JQsLjeznlvPt+6pizdFkSeaqkjV5YiGLuyNJ5baen4oiBDb7HYWcoQ13e3cQKVNcTsC41ywpsp3gx5p6Flp74huLfI8TYd4NWytw6SyJeXih2P5EtC6MJKEHHplXY41g0v3RZNmme431holHUl7RaLbNdKwguxDkSiHb7QgFjIM0ttFKVJ9Z+xi3ulDrWQIV4pAkq80j3KhDuKzg7bZcXiriUylSAhcjncu3SOqwmcnfvWr86GzKcL9YMkz3OVvT63t9aWSAwXWvIaD+V7hKVlkQt2D9lOzSNTGkbsaCyo1LMibarqcHbPfnlx9rx9x/UWySdeZnOC9PFo+gk57huObf9quN6ifSxmlgwyHcVSjrg43942Yzm6uE+Vxxmc2kuwdDLaj9TscM9hxTpK8yvbyTDJLssPs4VLs3ey2eMOVxr/Lht/IQI49Uykp0yk9WX69nbReUO8dAfNKBnW9rZDyLJqF+z6/4zdr9lxc5SV11lsv+0btlHwXMMoZKrq7XJNe3vE2cdu2CsYWFGLiFdrWtPdNk5dl2traWRfMDjOMlA63SnXaovwi0z
Line truncated
|
||||
const evaluateRuntimeInstructions = (win, instruction) => win.eval.call(win, instruction);
|
||||
const reactRuntimeInstructions = `(function() {${REACT_PACKAGES}; return {React, ReactDOM, ReactJSXRuntime, ReactJSXDevRuntime};})()`;
|
||||
let {React, ReactDOM, ReactJSXRuntime, ReactJSXDevRuntime} = evaluateRuntimeInstructions(window, reactRuntimeInstructions);
|
||||
REACT_PACKAGES = "";
|
||||
let react = React;
|
||||
let reactDOM = ReactDOM;
|
||||
let excalidrawLib = {};
|
||||
const loadMathjaxToSVG = () => new Function(`${LZString.decompressFromBase64("G4QwTgBAsiAuAWArEAPAKgewMoDUDiAvAGYCuAdgMawCWGZAFLAJQDeARCQM4CmEnsYalTYBuUJG4EOZACbci1MtxlsAhAVgBPAA7cMRCAHMANhgBGIY2njVOAfhPnL12wC5pchUpXqtu/RAA7ooyGIF2wbJh7uSeispqGjp6Bo4Wxg6m6TGy8vE+Sf4GPMZEdiVEriwAvgA0AIoENbVgTdUiAPJmiNxUAHRxSgAKYBi6YFr0YLVsAPqz3JxQGDIkxtxstSygxiTcrqoADNVMLX04AKIASlgAkh0AcgTAGNQyEIdnlzf3T2wAzH0AEzA0TiCBoNq1MhtTrdXqwAZ5YajcaTMgzeaLZardabbaWPYHY6nMh9Ea0QQ0ABeygAMrZYM9Xu9DmJwBAMMRyFRaAxWKRKDQ6BBYPRWAhbH1qLBuABbTgEADaAF1apLONLZQrlSrqmBuLASGAyKK+tpRrAMH5uEqsJo5WYMMYtdwwHAMGAVdyhXzxQTIEzPpINa6FSIDUaTSwlChYK5Bby6P7I8ayATdvtbbAANQ5tWhJSuWAAPm4fXWZEMCGqtbqiIt1utyT6IBkMh9SYY3AarBebw+BCH9QAZCP6I1EQARC4AMQAggBVOloIZXe7rtAATSY7MgrVDMvlmsr1fgIlCLDAAFpr9VAjZ1lMSwRDmP6gAeQ/azhKr3mwRPRlTRd1TE1RRsTUjwVPpOG0YwhG4KYcwARlqT4WGg1wewtSlgNceoTlqbh6wApsbT6A05QwYBJETYUGGYAMIBDSCwxPbgqwQC8MBYbhb3vR8kO4F83xHb9jyVbgVTDdQNF3ETXzHCSYLghCKGE2oUKYUiZwXZdV3XDpNy3AgAFZ1WqcURDJCkgJpelGQIDA9wgahahAAhuDHcssTjTiZE4AAfIL6GoTsGMYYjWDA01wq6Hp+h4WARnI5IOiIEKWHmRsrXmVxVWqRR+BASgUggecwHdTQx3ov1YGilhERyy0MHmLzqhCurkwa7gBU9ehwXqNzTT6hKETIq0KPgEBOA6QIyFStFND6ChLGMege3qJgx0YJV6m9W0Dp02pqCivq6m6xjGuoIh6DYK7EhtAJvJHMg1mMOS+oQUZAggJQ/rQZILiqga2AAYWMWbOBY/zZBhnY9ggNgcywARFEMTamBzNg3JhshrQgEAIAoOh+DAEgqE9TlIHe4xjDYXcrogep/VDUmyHJymrQPIrztOBtWptAg6eMIcvLscb+goA04GEphXAnSbm10LzlZtaFuD+7aiMVV7fNmRHFi6nlIqY8FJAe02+TYIdnoMe1HWdMdHadF0j3dHmGi85SpLVVo2VuicmFilnVvWxhdyD2AxzYd7HTdW3CnKxFTwQEPDTTGNuDjBNreTGLM/AmORzAF9U84s9dqZftWVODMiRL2A/zzAs6H2VRYDrEQfrCf6tYhYHQbATa7DYKXYDx/7CY9kAzHWPo2HcV3nVdT3qdsafJ8GZRF50uFEsRHelrdSY0ExBYlhWNYNi2I3iSItA+gACVKmR1jABl+GZAc2XBMWrqRxYMzJChcoymlFnJJurZtDwU0IwSCHkwCGBIHKTisBOBMBChqfURdTQgE2uqU45Zcoq3LAaQwjI3QRXqmAtMEEpRthkFFQWeEtAnRIULFs5AKFUNaIApioYqI0SQswOonC0q6D6DNWQ6xOBTgwBQVB6CaE9T7ByLaPcwCaGAQNcErROAINsKcSEYA+ixjFLuVQT9CzcBEKY8xOdLHqNpgQJ+RswwiCDmSGR79FgKKUWgsgYpmAZ3Af9Wsa1YAUHgEAyQfFh7FlrF4daOiBA6LQGOaxAx267UaGY2KO0Rz1HDvTKYOkUn0x0UHb68BfosT6G6UYYBay9z+gDCAINmn3XBqVAA5JPLw7xfEfwgEQamoRAnoMZuI9WLZJnKOCao66fUrx4IgLXQcQ5XqbRFh9AWbERn+MUYskJTBVqy1lPzcRVlbKASpNQWkMgv7MHsS/N+H8XkEGMK5CgsIJ5Ii8NwE+Ex4EUAvtia+eI76Eg7iSWoFBKKGm0fOIgspWiIqOVcZF1BFizk9D/VkCLpEfO4Ni9GeKCUCLoeBDpqU5S2CQiAicLQJTaJYKzZx1QokxKAYiSM2jlJIvSSNEqZUAj0sZXYflyKVoIE4vQQBNLRosrADpc5PLYnUrWeEkeYiFYypKhMIVBojWIlsL0+mFgKAAGs7AwAQAAKVQH0S1xhrU2r6Ki9Fir878h1fQpC9RWWkVNbAcAzBXB6p0icOoiKBWaG9dQ7VFsRYDy6WDB18BnUoAgAmxmPc6l93IbKjQxFLp+qAQC4+qJT7wIanMS+OIb74nvkcIiiI5RwCQKgQlHxXKSGmI0c+MIKA9z6F2hAyAUBNFomATgfJsLnGuHcR4tQjnztcB0kpr9ZFuhebUBZQT4yAK2sqs0k6e0oBJXu+dOSpnBMITrddpLyWCEpWALdN6/FvtxZwfF0wE1Js/WSIDaK3QeU4JoSgdIMBti3R9WswdXIkChNoKERBYSqBTRyRo+s+jzCNsFIKOGJBSEenbZIAQV7GBdg6N2a8PRDp9uJP2LRXxeLuttUOJS1plNedHWO8czCJ0o0UM0ad4BhKzhYvOvoC4BuLmOMuGgKyVwQNXPthx673ybi3fMh724HC7rWQt9SOlA10Bmke3Ax4TyngTSes957liXmwGjjGeYOcJjvGQe86itHw/MWWMgTbyZWS4lm5G/VJ3thAGjvsPOzx5iqTj9BVDcfWbAVy0wR0EF4xHZgtQuSqi0To8ZI8RCDRZFsryIV+LXggCWbTWSpgi0cXGcU5zbEiCYBgc0XBYlmKNjpTVQDIQJOaUk6olTjBpPZWALJZjbF5Pa4U98pSNpkAqYoVJmE7poCYG0iEjTh61lDhgOokIguzDgiFyq1UwtdnOr2fbE4QpAnFuAFBx6OJcSkxVwaHJcuvmhGrST9iPxkHsXmJgqhFsjjQCNFiIUpio9aA9kAK1SEUU4OpcsfGNo9k+Id04YAlRoEOhTlUoEsurToFEtHQVMfY64VIvHiFNtY33tW5EwLa2gqio2yFuJb4NzhR2isGAMA2pIOhxEPBtDgDlh0bQDFFQK+4OsKgqv1ezlGHKAA0twTQGvYJa4RLrvkZuuBuit2TVTngQBrFgPbzmqniqn1U6TbQmhVM2pN2brtAeWeqZzkr2Qc91iqYuCgCPMgo8hj6B0IYaBfhYFU1cC4UAOiXFU/OIYQwLgPCnB7ua8IqBadcjCGo9POYCG5p6EQzMMBANimwcwh9YtUYMCXSBdtq5165lTVoQ4yDYKHw3kf4tqA6XNeXw+zl1ResL8X0vbAlT5k2IiLPOe88b+vCqbfyfU/p6aIoHYbw3fuECOAMgmwxgMWs3J57Z63sPTgJYJOqmU9p8eFgaUMgS/GQN3I7ItdpdNYeLGEQDmTgZ0csW/E0e6LNHNVwZGHMC6docEcKJVGoZvP1ImNvdZAFaGagQwBgAFGWbgOWMKOZXQAWCpAgwxJiUOWASWCvREAPU3SOOvRnAFQwQ0eaRaAXLQGjZgpgBWQqZmDac2DRFoWoCbdodJXREecEGEVmcQ04VDMkCxayVQEgHJJQEQbQjrZxZidDAwo2WoTDfgwQhaEFLQKcRYGWagNXAaBqbQU4DsIgPoI2EQFnaUTgFnegGQJgOwHwo2AgCgegVUQ9WoVQbSVwVvUI3aCI2Fb5EIiQ6wxpeON0RPXaNAJUbQb0IgGNMbJieJJpT0abWbebHREgLJAwlbccVoUDPBIpMxQnegbbGbXbKpN7WpepcsKolpXBcJXnIFBwv9RgSfCmafIcagOwAhGoBWZoQ7GbAg6InsDEEASLEgWobQMQGrQ4L7XaTyI4XccETDQBbaN7EAMcTZE47ZfaFUHyWYxvMAOSWfdvKDJ2BmMTcqUcccRoEpK0NGQQKsLrZfX/dPPoR/PkazegPpW4IAywAceEkUNgPpXguAFlPpXGbojACAJ3F3DZWFc5PpU4baGYDmGgd6DYFDEWF4g4ryF4tLVQVvEgLBIKUWcWbQEKDvDgp6HvCAbQWOR6XwEUzwgI2wYIrkuwTaF43UBFRUg6WofYhIiQpI+geUo6b0DaLk7CJUkgEQLXHgZiTDQxLk/wqqLHQI4Izw3aFCcWHwyTVIpUQ4b0O2FfIvEvLqD0r0zPbPXPC4IpGUoI20+BEgJUIgAMmnD7F0tTf7WqWCT0SxPoRAV4BgTYRmcWREAvX0qcHGGYHMHfYMy4MccMuUpUfM1fEvGnSsyM+0yMnUmsvoXfEMmnMI1sssvfC4V48cdDPUggbQPoBQYwH1U9c9aM3szswAuQFADKLGD8EkLQtsgstfAc1U70NAegXc2IkeTw+I7SFoHsn0zc04TUrU6I7QdUjyGNMrFQoHSADsDQ7orI+AAgPzXQqxeAQwuxT878pxLrO6P8kbblOAXlJiVDSbaokzWopqdleALJP85o+gdDPzdbEcUcro0I3osgPbIOLk47AwkY87dZEiZmEgIBQHC2eQyEWImEFCGyD8b7U5P7M8GyWHQosga8FCb0Ni37JUMgVLcELkPA5Q2ijkcKVmQ7DyAgagUwvQkAf8kQTyRSn8yLRUFSvwxEGaOaewkQ+BTBXaDAJUTgb0ZuCysoyC2JCopoEYmovoubRCnRe4kcVQFStC1oRSrCzoiOWffCwiu6QY4tU7Zpci8JS7REWPePRPBS5fcPN+eKkAZfYPbgUPbVUOKsls5gaVAqWAPUZfLgxUTgZfH3P3YwZfT3CYKI5fEkict3RUbVKSsjWIxoZiz8QS9BDi7ieoWHI6PigS5Bditk0OcsCrC4EAXlKcxTU0aI3qY89VSyZfW3MAJq5ZGivRDRZUjqkQLqka37JMzi/qnMJgQa/iggbq4JX8A6Line truncated
|
||||
const PLUGIN_LANGUAGES = {"ru": "N4Igwg8gcgagogJQCoH0CqCAyKkRQMQElM4QAuEQQhBA+EEFEQQARBAGEEF4QQDhBAhEEBkQAAlcHYQaoEYQJoDYQQKwgbMbz7cMmboCYQboG4QaoC4QRss7NA0iCBOEG6AREEZ7lIADQg0UAFqEACijAYEcKKiIlyIQAQgjQIIggPwgjGrUCoxc3OxiaoDCIICSIKwGxqbccAAeAMYAhgA2AJYAJgBO2QDuFiB2js4Iru4ExKQUlCIRPNFxickmymlZeUWlFZb2aABCmIQAygASKNMwAOJOs3BgANLeEABGAM5F+dkAdtz2AK47BXsAFmTcgPgg1Kz+atyx/uyM9GIKgBIgrFo3EAsiBqILUejsVj0MIsXRAxZLXhnKBLAC0KVUCkqcAAsuM4AARQkAQUmcBQ9gQEHsiCQhDg028lAU1D0n3Cik+TFY4TEgB4QHRA4HKAUSdhhHH4omk8koVyYEn0+AoGwQCC47yAHBAAn8voJobDJIodMI4UKueweXzBcLRfzxWFuIAWEGo3AAjAAGT0AUm41HYzGo/g4Yi0QaiMQSYkAzCBu/m6/WMbi0ajKT6MSo0twoQi4klLCnTCAYMDNECAPBB2Gp6DpIoBxEDEkLEIn6OQKJXKlUIUGmSBJmGw0zACAcSG8gGIQDNBhSh7iveisQLsSpoeykpBFkdj7yAFBBg+xYoEI0IZ6LjWjuMxGCJ+XPncpAPIg72nYTUrEqYDWmx7K2Ho/sccKAeGEFCbDQr2Ta9lFYetWCkGc2UUJsQ1YbhL0AXBAbzvaIXSfbhAibMQPi+Gd31XKAyRIXAv3WDYFm3QDvBAsJwOTU8wnPVhn2YKRYmdTQAh4TDsNDcxuHrCVBB0AiiJIlgwg4ThV0AiANy3ACgKoGsl3Yf1BDPCR0O4LDb3vfDCJ+eSyI/SxsygFASWmFA4AADTAAdCEJBASQAdW8KsazrHgNDeRd/FiIM3gydshi7SxcCWJYSBQXE1PLB4iLUZRADkQRtjQdERnVibgfhEVgEzvNtBk7MpkVxbJigAa0KAB7Mpjk/aB4GQFAoAgTccDwNyPKmby/O8QAsEGoZgwMhQ1wkiPhGAdasSqUQwIQTXCGuatqOsUaqO2GbhCWGfJjgAcy62A6Rc9zPPG/zgJ+IQmAEcJjUxJ0ACoADoAFMBmO8pDsxGT/oAW0KT9XCVCkoDgZ6qGoPgBMiGd9AkptohEG6eo8JoUA2OA4EcNytP+oHYtq7gAF4AD5uCp4G4rKP7ofxu7PApVx7EVMt7spwHWdpxnmY5wpuAACn8MIHU+CqDx4fxuEwVrLr2AGAEcAEpKkJCBfKgTAIBJQkUCmcYfIQABNbxAFoQMFAghPSDUEGCAxiNCrUYYwfglJQNt6CXqZq4YCh2LNaQctyZnpVE+qRykSURgLq1rSIIviMQOViHLumx5tW0vQAkEBMitS4rQBMEEeQAEEAwwBUEEAbBBAAwQaOczjvtf0csBlQpexU/LQLM5V6M84LpIi9x4zy8AIhBG8midAEoQRva7rya59b0uMJr+um7byokB83swEwNBCXLUuM1nBscZbI+T+Hc/L9SiA+3ldY3C06+vgUCCXb+FFM6XicZ/RWjEAJNQUJQJwmoGA8KkUNBHwgElFKJB8BIFmKnS+Fs0qX2YllXKcFIiilZJ8CEM02AGDKhVFBaCiz8ycrMf8pMoDMXUIwPgOhFo8GWjfOIh1MZAkbMXRgtBKj4CmI4PMBZh4Z2CkYGaYQdD8lKi8SK6hqBqIUKaJgzAgxSH4G9G8EhuLcDDiDEYIBEa+VzA5WxKc04tFRujHgmMaEaKirPbglAKyUEbruJuWpuAVkmk3SojiexJzsf2cYzJXHtCvCozxEVvFlwrlXWuc866AEQQNugAyEEbpE5O0SSR90ICqQeziUZoySR49RaT1A+IXkvVeISN5bx3hWEJYSImWCiQ5ewNISyoF8j2Q2yMaB1Ixikxpmi3gZIrHPSaPhADUIKXOugA6EHaZQQA9CChPCcUgZpSHHJ2qRSPEBJCQJLqcaRCCCvEQQyX4gJQTG69KOcZNCCgBHJiUCEKEChdAGFdHEB0zAVwnLsdExxcSXLShuS4mZ7i5miJnhk3eWTuA5Pya3Ip3zLSMFvjwAF0DeQgpdOoWIEKoU2NOb3fuTjLmItuW45JujUkLJaYvFeHzuCdO3rvT5TdCW/L/kpQ6gKKVYzBTS8UJSYVDJGWgMZEyjYIuuWy+pczEHpO4OXZZqyNnbN2QcvpjcxU30lWSoFlK5W0voclCkptNiEJ+NlPKZipCdAoayMBIoxSQuTIVYqpUWwVRWmhH4UCYFGnMT5XyMtBBiBkCYwQAZ3y62RFSOAMAGRJuloEGE/h+QBnoPrSwl9qIUh5pOASMFIi6LNAY6gRiBBmnEMaVgMEjAh12i1dqpx+DcF2AcQoRxTgMBYD21g8RMyWEgPYW2LkSC4m/pbHsWwWihECAtJJABtA9/h/A6GUHEAAuhevCz5m36KDAG+04pGDSzCJW8ANIV1PR7lMKA27tLUD3bAyIABCI9J6z2COvES/+sQr03pBBKR5aTkGWB7NMO6v76K4FXXib+U1AP7uNOB0957GDwYfLevRcDH1Bq+IdQQsRDBNn0hCxgf1uAoHuhbRUBJsB9ywFxgA1GfQgmwEO7qI+YiD560IAHJLrFFaucAADnTOTHGuNuR42SOAQ5ZiEEwcJ0T4nKPcEk7Atgz4ZPvm4HJxqANsjqb+t2XsmGt1DVw+uhoSxqRrmZBZ2IehcIKaU6p9T3AwPHtIxoCj+E700bdIG2l/zuCMeY/QVjEh2OuYw71LDnm9N4YaCSOGAXCPAZ4PZ4ojmItRZs+R69ZmEuttoylhjTGWNCDYy5tDbn8seZw0V7zHgfLrvK0B2EkQ5MADNSiQwBnVkjkHGsIZaw+pLT7g0dYy1l68vWQDofc3+wra6N34DGxSUT9haRIoA5N3hdnMgFBUypgGhQ5vZAW0t6LK24tUZbRtkEW36NKHS11wQPXcvHew8NM7DR+oIHzJgCb+7IjLbI/9k0gP4Gbbo6l8HmXuvZYO0dgbJ2hvw9QIgakCBvCl1NBCcBzowzaFx8D/Hh1/CADEQCQYhofk9h15jdcNCT2xaDF5MgBkEGWZXOuyJXSfCPNBsHnWfh7YXYd/rqAsP0+tVnGLJVoOYgF6gSAuJ8xQDu7/YlkrQgJmYGGsdhwTiHQ0I2DkUgbO2S13l1AsjCx64lZEYxnbvW8F7Xq5pMVw6gxHeEP4sY3TTrYDBed3ZcTDN6oibwrd+Qu0hNwREGJeipdnCz7gepFypiUDHqxMsXbOhZ/QEQEFET+hjPo2C2XxKblckgIRAQJSPhzlIBQPx+Q8SkI35v5U+TsH8I+d9eYs+oERE4aAfekDebQMxV6ZoPozqkO3pQVfARoUvKreBXf8rcTvKb1K1u/l9tMMmSGjVB0HRHSn2d6e+t+8pEJHwCD1t0iHXHwBL1SG/y7zT012sEqUQGmAHEcmJEaC8AoBt3/mTGbi2VyQrBlxf2UE1zJzN1Kzu33EEFAJViDFeB90gFul6g8gQAthwzrWAiIgVihCzhoMEWDlMBxDqAgAQBwDtkciWBJB7A4TaGUCCwzHEhdmLSECC1wjEBzlKi4QO0Hj7Cu3SkmAgDdQwP1x4A9maVCAEgf0VD7xAIUE4Fwk2noH5FiBkLVmyCQABlchlmvGLQqibHEgAB0AidgLpWpIZgBjgABfYAJqcI+mbgAIvwz7TIMIkDSIpqEDaWY4NEJqXWFI3WA7b+RAS2eGVyenMCZ0OcYtW3cMNtE0UQcPTAVw9wyoUXT+EgJyBGAaRkPfagEhJJQBYBY0ZaVaWzN0XRQID4NQfnSwMkUZe6UaLyRNAKI6NmZo6wFAfQunCgDYgiNMIHdFFsRge4QAdBBxFFpIwwR6MR05sAZ3sTohNpATEu1zFVddtidoM0I2pMg/oVMlMVM9hmjEA1iNiOEFAJR6BKVlpxjXgdjlA9j742hR0RxjjTiIhziMxpBuBrjbjQZ7jQ86irMdsIc2NkRPjvjfj/jLAEAgSRxhd3AmQtiRwTQWdzx4QOdaUwhkTaAzjfVLiZAsTaZcSO18Tni0s1cNdH4SQV18EMoiEvVjRgheJe1/BWR2R2Ag4ogfg9A0RaF+RKgMNSsvwOEXg3geSoJkx9jxBYYaQU5A8KAKxhBU0II0IExaDLN4ImSwwJAgwDBuQZ1ucdArSZF8xbTKwHS+AnTuAXT3w3T21HizFHxKhU5+p+xBoA9yw65W041Pp3S8TTECTa9RZhgH9ykmVwCbSKQnJcxgyr5n9pVgUkJfS2B/SzggC3dGAPc1TYyw8rMASMN/dcQVgcMvRPRJxXwSV1C+AHRMt1t2dktn0HjuzzFoNhy/QAxeB/BUwQFcdey4B+yVgnJaQ+55QlRCAIBmRhBgxJU5YAwgxE9jQKEYRmBsd71ZyQdkxcyniEyEo8Qs9Ssv0ZgqIKzVV34SR4B05PUSEeBiUJQ5YU9w9XR5xgF84c4wFISJjkxncJ1XdpZrJiUYJwhgspBgQJQ9JggmBVp6BxIJQtBQhuBc5e1dFuA+BrwxBohxJJI3RmTGBWKxB31NxM8hC/yXJKI5QSRgKkCwKMCILJVoLgw6B9FvVmiHJfI9NzdywKCYQdjpCptSVljapJFCAEAP4qT2EKA/DjgHgiCYxWAny682YENMLJ1jJiK3Q4x3oEKM0tBE92KBRuAABqxQihAAbt4GYG5HlUhQQ3CnjUfA41ySsuoAEnoGfBjBkIzVCAMBsuiE70YG51YDQlVkctdxmnASCnn3nFYnoDvIjAaUb03PM0UH4FiE0DZ0cPeEqIUC4hyhUFgl0CqmYpnUfDvD+nMvMoAB4J0AA3bgPYAAFwAE9chFs/CQBZqgZZq0RBhLpjgyBMgAZjg1rigABud/YoS6C6NLine truncated
|
||||
const PLUGIN_VERSION="2.23.3";function _interopNamespaceDefault(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(i){if("default"!==i){var a=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,Object.freeze(t)}var obsidian_module__namespace=_interopNamespaceDefault(obsidian_module),React__namespace=_interopNamespaceDefault(React);let random$3=e=>crypto.getRandomValues(new Uint8Array(e)),customRandom=(e,t,i)=>{let a=(2<<Math.log(e.length-1)/Math.LN2)-1,n=-~(1.6*a*t/e.length);return(s=t)=>{let r="";for(;;){let t=i(n),o=n;for(;o--;)if(r+=e[t[o]&a]||"",r.length===s)return r}}},customAlphabet=(e,t=21)=>customRandom(e,t,random$3),nanoid$1=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((e,t)=>e+((t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_"),"");class ErrorHandler{static instance;errorLog=[];errorNoticeTimeout=1e4;maxLogEntries=100;constructor(){}static getInstance(){return ErrorHandler.instance||(ErrorHandler.instance=new ErrorHandler),ErrorHandler.instance}handleError(e,t,i=!0,a){const n="string"==typeof e?new Error(e):e;if(console.error(`[Excalidraw Error] in ${t}:`,n),this.errorLog.push({error:n,context:t,timestamp:Date.now()}),this.errorLog.length>this.maxLogEntries&&(this.errorLog=this.errorLog.slice(this.errorLog.length-this.maxLogEntries)),i){const e=this.formatErrorForUser(n,t);new obsidian_module.Notice(e,a||this.errorNoticeTimeout)}}safeEval(e,t,i,a){try{return i.eval.call(i,e)}catch(e){if(this.handleError(e,`SafeEval in ${t}`),void 0!==a)return a;throw e}}wrapWithTryCatch(e,t,i){try{return e()}catch(e){if(this.handleError(e,t),void 0!==i)return i;throw e}}formatErrorForUser(e,t){let i=e.message;return i.includes("Cannot read properties of undefined")?i="A required object was not available. This might be due to a plugin loading issue.":i.includes("is not a function")?i="A required function was not available. This might be due to a plugin version mismatch.":i.length>100&&(i=`${i.substring(0,100)}...`),`Excalidraw Error: ${i} (in ${t})`}getErrorLog(){return[...this.errorLog]}clearErrorLog(){this.errorLog=[]}}const errorHandler=ErrorHandler.getInstance(),UrlPurpose={AI_API:"AI API Endpoint (User Opt-in)",TASKBONE:"Taskbone OCR Endpoint",SUPPORT:"Support link, contact, or Ko-Fi button",DOCS:"Background information in Settings or Code Suggester",RELEASE_LOG:"Referencing issues, changes, or contributors in release log",VIDEO:"Supporting video tutorial or thumbnail",APP_LOGIC:"Internal application logic (embeddables, UI renders, asset fetching)",TRANSLATION:"One-time support message translation"};function buildSafeUrl(e,t=[]){return`https://${e.join(".")}${t.length>0?`/${t.join("/")}`:""}`}const defineUrl=(e,t)=>({url:e,purpose:t}),URL_REGISTRY={RAW_GITHUBUSERCONTENT_COM_ZSVICZIAN_OBSIDIAN_EXCALIDRAW_PLUGIN_MASTER_EA_SCRIPTS_DIRECTORY_INFO_JSON:defineUrl(buildSafeUrl(["raw","githubusercontent","com"],["zsviczian","obsidian-excalidraw-plugin","master","ea-scripts","directory-info.json"]),UrlPurpose.APP_LOGIC),API_GITHUB_COM_REPOS_ZSVICZIAN_OBSIDIAN_EXCALIDRAW_PLUGIN_RELEASES:defineUrl(buildSafeUrl(["api","github","com"],["repos","zsviczian","obsidian-excalidraw-plugin","releases?per_page=15&page=1"]),UrlPurpose.APP_LOGIC),GITHUB_COM_ZSVICZIAN_OBSIDIAN_EXCALIDRAW_PLUGIN_ISSUES:defineUrl(buildSafeUrl(["github","com"],["zsviczian","obsidian-excalidraw-plugin","issues"]),UrlPurpose.DOCS),API_OPENAI_COM_V1:defineUrl(buildSafeUrl(["api","openai","com"],["v1"]),UrlPurpose.AI_API),API_ANTHROPIC_COM_V1:defineUrl(buildSafeUrl(["api","anthropic","com"],["v1"]),UrlPurpose.AI_API),GENERATIVELANGUAGE_GOOGLEAPIS_COM_V1BETA:defineUrl(buildSafeUrl(["generativelanguage","googleapis","com"],["v1beta"]),UrlPurpose.AI_API),API_X_AI_V1:defineUrl(buildSafeUrl(["api","x","ai"],["v1"]),UrlPurpose.AI_API),API_OPENAI_COM_V1_CHAT_COMPLETIONS:defineUrl(buildSafeUrl(["api","openai","com"],["v1","chat","completions"]),UrlPurpose.AI_API),API_OPENAI_COM_V1_IMAGES_GENERATIONS:defineUrl(buildSafeUrl(["api","openai","com"],["v1","images","generations"]),UrlPurpose.AI_API),API_OPENAI_COM_V1_IMAGES_EDITS:defineUrl(buildSafeUrl(["api","openai","com"],["v1","images","edits"]),UrlPurpose.AI_API),API_OPENAI_COM_V1_IMAGES_VARIATIONS:defineUrl(buildSafeUrl(["api","openai","com"],["v1","images","variations"]),UrlPurpose.AI_API),NOTEBOOKLM_GOOGLE_COM_NOTEBOOK_42D76A2F_C11D_4002_9286_1683C43D0AB0:defineUrl(buildSafeUrl(["notebooklm","google","com"],["notebook","42d76a2f-c11d-4002-9286-1683c43d0ab0"]),UrlPurpose.DOCS),COMMUNITY_SKETCH_YOUR_MIND_COM_EM:defineUrl(buildSafeUrl(["community","sketch-your-mind","com"],["em"]),UrlPurpose.SUPPORT),KO_FI_COM_ZSOLT:defineUrl(buildSafeUrl(["ko-fi","com"],["zsolt"]),UrlPurpose.SUPPORT),CDN_KO_FI_COM_CDN_KOFI3_PNG:defineUrl(buildSafeUrl(["cdn","ko-fi","com"],["cdn","kofi3.png?v=3"]),UrlPurpose.SUPPORT),COMMUNITY_SKETCH_YOUR_MIND_COM_WIKI:defineUrl(buildSafeUrl(["community","sketchLine truncated
|
||||
const PLUGIN_LANGUAGES = {"ru": "eNrsvet2W9eVJvr3jIzzENtIZVCKQEhOVdKnWbIyIBAiUQIBFABKli8NURIss02RapKKnXY0hijakV1yJFvldLkd31NVqR7pdEMQIYE3aIw8wcYr9AucfoRT87LWmuuyN0BaqVRO149KyRL2uq+55uWb33zrhbcbxWazVJlptKbzzXyrVDmXL5empzLFty4vLC1eWV14M4oH8eO4H2/Fnbg3vB3FO/FgeGt4K+7FO8Pb8f7wbrwdDd+JO/F2vBtdWVhfyP3HtZXlXBR/Ej+J9+JevI//1x/ej+L9uDPcGN4e3ooH8D38RS+KHw43463h5vB2NNyIB8N3h7fiDn01vJuN4qfxIN6JO6YT8RUNqRsPhhvQMH43iLvxLnwdxf14N+5HcXd4lz96Gvdw6E/iTvx0uInf9Ie3415UvbS2eGVxYTmCD/C33eHd+CH9Hn8x3IgfwsiHG95EcpmsvZD1Yi1fqhenW2fq1bnWXHGuWr8wlYm/jAfx7nBzeIeGp0YwiLf1WPfj3vAOjqkT9+I9e3m9BTT7RAs1/AU2tzfchH3bh1W6C98NhrfjnXgX/m74Ubyfi+IPcfv6cRe3sGc3vR3vwFhwleL+cAPWFdZwgCvQgX2PB1G8Fe/CriYsP265ORD+EhWq54r14vRUJv57np84dvpDPQdeLblS8RZ2fXu4CTsL86UhDe/AjtEQchEs+3ADB7UV7w/vw5hhUk/xoHVx5jiN3vDWcCPhpCZNshNBG7TquDJ92N3hBqygnDNP90JrrtRolCozrWapWS6KuafsLe7fcAOuCI6gO9yEM5nW+nSxUZjKxJ/DveEzEdH60QZTO7DvPfzLD+j4jFwlvj1wK/TC7cQDPCb+suWi+IG3bnTf4t7wI7WV5mYNP8B/lFPfoXPYjQfxFi1rvOef1k68Bxs9vKXO7c7w1vAunvC+WoFH8QAlDB7j941UGi1JYBXTJh7c6EK1Xp+vNQ+20SDsutjX43gLrmpay7zJuuFD3pBsNGp+ES1B+kEKntFcFH/9LDZXz2nAu9Pl1oxsfAgTgN9Zz068LZ4QZ387uL8gAzss44OvmxBFfehha3hruAmnCU8UXBJYl+Ed7G4n7hz2IMqFEWfyMby9dEWhPZzbcFNPPO4ET1+92GhW68XW6Xzh7HxtKhO+iNCo2uV7Cc0U4aCdyc+Xm42pjNlN9bn3boSaOZ8vNVtnqvXWmRLehf9i5pR05WzNIpMtVCvnivVma75ebjWrqqGvhcLAA4IDwA9V/JgPQY+2br5ejuJuhA8hHKvd4QdeP/OVl0q1VmG+Xi9Wmqqbr2CS8VPYThwijR2v0M5wc/g+nDNzFM1GZrK1+dPlUmO21Tg30yrMFgtnpzJa1ajduLS0uPb6FL5QKGx3+G7FHTyD3eF7cX/4bjT8RbyD/cPhhCfmFo2Clmn4btQ4NwOKS60yM6nPxSDuZrLFudPF6en86XKxVatXa8V6s1SkbeyK2ws3gzexo+4D6B7UNewHnbrbXqP1YjnfLJ0rtl6qVuemMvFneBrew918aA20r3Uq3i4a+QE6Btk1iJ4/ceJ7pNDsq2MY92gn4VqZLenR9dyzRtSJhu+iEoaLnMlWa8VKqzSXnym2GtX5egE2+wtQlujWwibfQb0A2n1s7Sx+mm+0ii8WQGmu58973+Ih2wHZCkJiE8/3jtVIszozUy625qrTRdQPST3diXeH90hLpHXb4wdhM+K3oQ/zivfiviU1+tHcwuobV1beXDb3pVJtFuHCWMP8FDRB1njEebKkDM5kE+7L8B04eKzf9HQf8E+i9+nVhTcXl6+anq0ev8SBq3v5xDoW8shG38+1xYy6+h+Hd6Pv565dyWQL9WK+WWxViufp/sdPjDBBAUIXWmybGRJc59bZYrHWKr7YnMpYfb1wyuqb+pLf1Yu1cr5QTPr02pXoCEr1Lq4emhbxHj+/H0TDjai8cnWt/Z+OZrLT1fOVcjU/3SqXTtfzaBr8Tt5weMz68UN8nAZ0pOH1wGsC68E2Cd4Js0LW8JcWL2Wy3HxrrjRTzzdL1YpWRtRJ21cjDXQ53LQOVzcykhZ+Blcs1AVpJfLLPbQh4TFzZXWoT5gU/NeWudagc6gz0vOHgQ+7WvOBZYT+Dv+G2mIL1jUy6QhuKJHFffbiHuguJEmURjO8h6K+5wgnMI2MEYuH/G9Q9eorMxZ23xV+oNS4D9GevAt7f2kffmtzcT/YdHxMpi0YazswuNv4Tj22bWu81o9QdXlMgwLtXNu4pJX//rf4FD2Bn/x+N0tqIswHZiCFIioynhIDPYKMJqWOzmsudEYaFyqF1vl8vVKqzExl4o9JJ92ABcOtGWBrT+LO8OekOEkJEbwccVdLTT2Vr732HEnXHW6Q5kq7r3YBl7AfPx3e/f0uHkdPIR2+axwGjZ8uXw5OEuUM2rp/1ahW8HFg3VUd/645q6EGyvlmsc5uA9yS0I/oT+Pf6eB2zBcKxQboBR95S9tx7BPRhzKAQ5IhuCJn8qUyGvyfwxpvolNpl0wDp+nE4YNjabiBj/iWslMeBgYtlPZ9Vv+EWSBPJcv2/HSrWK9X60mjQ62XPTN0B4Tl4Z3HqejtWr45e9N0A+o4qBmV/Bxs1j+4CxZsxv/ctvngXgakIYu74b2DiLuscgHsoIL0AQnj0NriutMO9NHcQ+8JLLN097gjPwcmBB5TElSd0NCPsP4z4M3aIjMS+jgaWAxzucR+P0VR/wilL7ToatS9uCfaOlMtTxfralvM4NK3g7/i3RBfsU/MEuwkpYNSq+/JZdaLpcTLRWK//XYi1DN6tNu3SN1FSad22345clH8Gy3VQRaRoYmmEyrkfNjJKmej1lHSlPDLBuXulzz5J8O7rqxVgtVqbgwp695X3q5P4j14OLQpPO7CO63xNnJrt/Dt7pCDFDemhyoMmu0H7ioXkfXo7Am8k2CPgL07vK/OeLoz0RaoxValen58VQ7F9fbwDowl2JQ5zG576NZx1CD433BH4iZ2XWeXa9YHRICYJ0hQ5dEEFRndLLfJz0UqtZkSiXl3pOzVC79PbEjQVfZtCVao4MW0ftkqVCtnSvW5lC+ik5dOkfw/efzSqR+7DVSK54r11lypop5C9EVtxQP3hxfQVv8YDFX7H8yDLaTphhoNNGceIPvLtCfYtODMJ6kx3KBSQ3lJPgcBi02Qxr+vVMRwm/DcRDJigfsK5w1FYXgz1ckxQ0I7vPhiqQE+JzALW7V8JWDHbwR1edtSjCaj+EEUfx5/ET+Iv4j/K3hmPow/j38Z/yr+xO0qX0DPx7fu7Zv4l/Gn8a/j/xb/Enr8MP40/ib+JH6Aw3CH0KznK41CeR79BQ8chdI2es1PW3PVRhO8ccVK0/oMnyzL8a/cJgO8s5YgND4nJQyNX2MHzig7M8rFM83ZfGW6OJ3k12D1d5fOC/tPSUvfp1XSXg7daqNWzjdmG4V6sVhhndh7Y56QsKGpsSnJLgF4UsXqwOOSyZ4pl2rk/fE38B0cDrkT9hwXDlqktj0H4i3oexzej9rC4QPns1SRxzTZhWG7jeiwfB1/EX8d/zL+GI/EZ1H8Rfwp/NFquZk/feCGxZn/Jv4w/giOW/yPomH7uB+scXnEP3OPeGAStWqtOt9snS9VpqvnD9zbF/E38afxV/Fv4wfxh/H/oF7jr+P/GV4tmFELfZqyJ/VO77Mm5B/4ETsC/9xn/6a5bN1IXSgOvW6TKrAz3FTuBHcr/bGlObtGbKc3Km2Kjj8ucRLGGNu3OA/PYrDWUTrkcEcfqG81UiU3qxAdSHQCs4JFgAF9Im0veSfVVZwo0EFI1fPnoyMqiKZk2ENGDvSPYnihXjxXKsLPnnIMaI/eCXBpFstFUAxIE/g16xVqFcaSlPTXu8LdI1zNEL7RLhdfawRXbe1Cq1guzkHYplyqnMVdVsEt6fZ5+WUMON2Nd2EbXn3VABmcYYYW+Ag0dJS7A982aAKp3T1n9xexz0Q+VGYMMkLovK6lSgNc0dAX+vNpqlMX0Zn/1Iu1yF7jzgFniQf34XBz+A4cRjwPbJB3ctGfvb20cKm9VGjWy0eO3jxWKJcKZ3XrO/5g0LWnh9KPJq6urty4/sKEbqkxWzrTPFxTC6vthRcmchcTVqc1U69i9FNszXAz3kZLVY3D3qFnulZJu9bK14v5xBPDs/pjjOtMnQzrhIG9trpwrf1HHFmrUC7VaizBgyO8vLR4/Xr7yh9xoJVqfS5fHkv6/MsMSLk1ydk/wO+c+EpSX8ON4c/JFZDYOnhOIYD1tZlUFP8tPpmggXyI76JEoey700AXvJmI1VPIyPGEqQne85eF6txcHq1r92N2LXbItShQf10M1pK7hREtUtLoppW14DWc/qAlRYAZUgKH4z02vUKPW2muVq03AURAbiodKGycExF/Wlf26EUQ88Z+30WXnejzCAJittDvdyt+jFuGCIIBOCJZ0pLi0clGzeKLTenKiQfD+xjwwXj+LQzY39f4StmuRtaw+9bMAnwo0O5csTI/IjiMA+vK2fSjSYyn+aPtD++DoqM3a27as3bFYl2zlIvgsnMz+fpZCNkmbn6iy9AEyyfDBySTLU6XAj18FdLUsK+RDdpttRrFcrHgCgET8RvRHN5eAqWRjc7oPfirp4hrQgeZ0ydHmQ86VF7utDCMq2AftIt8rVbM1/MVBnooYMNu4gfnS9PN2alM/E+4DX0SUKHfKPep+CG5Vm4z+EzCJnR0uD/8Ofq5bVSK0/7parNZnWvV8tPT5An9PO6jew1cJYy7Q9k64ks1xI/xWRrEuxSIF+9ATwW6FCZnn6XhgO+2cgz1GelgYtnW9J5C0ADds7vD++BpccZ1poqOqH/Clt4BGyjwg1ahWsaD8I+IVLkNMoB/H1ykOrlxv0JrZyfxJ36zt/iLvvdFAXyshUYj9A+8moVGgwLxGDIzsGihyaceUkQoh9RTFHz7uNPmGj
Line truncated
|
||||
const getCaretRangeFromPoint = (doc, x, y) => doc.caretRangeFromPoint?.(x, y);
|
||||
const mainDocument = document;
|
||||
const deliberateFetch = async (payload, init) => await fetch(payload, init);
|
||||
const PLUGIN_VERSION="2.28.1";
|
||||
const STARTUP_SCRIPT_BASE64="LyoKI2V4Y2x1ZGUKYGBganMqLwovKioKICogU3RhcnR1cCBzY3JpcHRzIHJlY2VpdmUgdGhlIHBsdWdpbi1nbG9iYWwgRUEgZm9yIHRoZSBwbHVnaW4gbGlmZXRpbWUgYW5kCiAqIHV0aWxzLmV4ZWN1dGlvblNvdXJjZSA9PT0gInBsdWdpbi1zdGFydHVwIi4gUmVnaXN0ZXIgY2xlYW51cCBmb3IgcmVzb3VyY2VzCiAqIG91dHNpZGUgRUEgc28gcGx1Z2luIHJlbG9hZC91bmxvYWQgY2Fubm90IGFjY3VtdWxhdGUgdGhlbS4KICovCi8vIGNvbnN0IHJlZiA9IGFwcC53b3Jrc3BhY2Uub24oImZpbGUtb3BlbiIsIChmaWxlKSA9PiB7fSk7Ci8vIGVhLnJlZ2lzdGVyQ2xlYW51cCgoKSA9PiBhcHAud29ya3NwYWNlLm9mZnJlZihyZWYpKTsKLy8KLy8gY29uc3QgaW50ZXJ2YWwgPSB3aW5kb3cuc2V0SW50ZXJ2YWwoKCkgPT4ge30sIDEwMDApOwovLyBlYS5yZWdpc3RlckNsZWFudXAoKCkgPT4gd2luZG93LmNsZWFySW50ZXJ2YWwoaW50ZXJ2YWwpKTsKCi8qKgogKiBJZiBzZXQsIHRoaXMgY2FsbGJhY2sgaXMgdHJpZ2dlcmVkIHdoZW4gdGhlIHVzZXIgY2xvc2VzIGFuIEV4Y2FsaWRyYXcgdmlldy4KICogICBvblZpZXdVbmxvYWRIb29rOiAodmlldzogRXhjYWxpZHJhd1ZpZXcpID0+IHZvaWQgPSBudWxsOwogKi8KLy9lYS5vblZpZXdVbmxvYWRIb29rID0gKHZpZXcpID0+IHt9OwoKLyoqCiAqIElmIHNldCwgdGhpcyBjYWxsYmFjayBpcyB0cmlnZ2VyZWQsIHdoZW4gdGhlIHVzZXIgY2hhbmdlcyB0aGUgdmlldyBtb2RlLgogKiBZb3UgY2FuIHVzZSB0aGlzIGNhbGxiYWNrIGluIGNhc2UgeW91IHdhbnQgdG8gZG8gc29tZXRoaW5nIGFkZGl0aW9uYWwgd2hlbiB0aGUgdXNlciBzd2l0Y2hlcyB0byB2aWV3IG1vZGUgYW5kIGJhY2suCiAqICAgb25WaWV3TW9kZUNoYW5nZUhvb2s6IChpc1ZpZXdNb2RlRW5hYmxlZDpib29sZWFuLCB2aWV3OiBFeGNhbGlkcmF3VmlldywgZWE6IEV4Y2FsaWRyYXdBdXRvbWF0ZSkgPT4gdm9pZCA9IG51bGw7CiAqLwovL2VhLm9uVmlld01vZGVDaGFuZ2VIb29rID0gKGlzVmlld01vZGVFbmFibGVkLCB2aWV3LCBlYSkgPT4ge307CgovKioKICogSWYgc2V0LCB0aGlzIGNhbGxiYWNrIGlzIHRyaWdnZXJlZCwgd2hlbiB0aGUgdXNlciBob3ZlcnMgYSBsaW5rIGluIHRoZSBzY2VuZS4KICogWW91IGNhbiB1c2UgdGhpcyBjYWxsYmFjayBpbiBjYXNlIHlvdSB3YW50IHRvIGRvIHNvbWV0aGluZyBhZGRpdGlvbmFsIHdoZW4gdGhlIG9uTGlua0hvdmVyIGV2ZW50IG9jY3Vycy4KICogVGhpcyBjYWxsYmFjayBtdXN0IHJldHVybiBhIGJvb2xlYW4gdmFsdWUuCiAqIEluIGNhc2UgeW91IHdhbnQgdG8gcHJldmVudCB0aGUgZXhjYWxpZHJhdyBvbkxpbmtIb3ZlciBhY3Rpb24geW91IG11c3QgcmV0dXJuIGZhbHNlLCBpdCB3aWxsIHN0b3AgdGhlIG5hdGl2ZSBleGNhbGlkcmF3IG9uTGlua0hvdmVyIG1hbmFnZW1lbnQgZmxvdy4KICogICBvbkxpbmtIb3Zlckhvb2s6ICgKICogICAgIGVsZW1lbnQ6IE5vbkRlbGV0ZWRFeGNhbGlkcmF3RWxlbWVudCwKICogICAgIGxpbmtUZXh0OiBzdHJpbmcsCiAqICAgICB2aWV3OiBFeGNhbGlkcmF3VmlldywKICogICAgIGVhOiBFeGNhbGlkcmF3QXV0b21hdGUKICogICApID0+IGJvb2xlYW4gPSBudWxsOwogKi8KLy9lYS5vbkxpbmtIb3Zlckhvb2sgPSAoZWxlbWVudCwgbGlua1RleHQsIHZpZXcsIGVhKSA9PiB7fTsKICAgCi8qKgogKiBJZiBzZXQsIHRoaXMgY2FsbGJhY2sgaXMgdHJpZ2dlcmVkLCB3aGVuIHRoZSB1c2VyIGNsaWNrcyBhIGxpbmsgaW4gdGhlIHNjZW5lLgogKiBZb3UgY2FuIHVzZSB0aGlzIGNhbGxiYWNrIGluIGNhc2UgeW91IHdhbnQgdG8gZG8gc29tZXRoaW5nIGFkZGl0aW9uYWwgd2hlbiB0aGUgb25MaW5rQ2xpY2sgZXZlbnQgb2NjdXJzLgogKiBUaGlzIGNhbGxiYWNrIG11c3QgcmV0dXJuIGEgYm9vbGVhbiB2YWx1ZS4KICogSW4gY2FzZSB5b3Ugd2FudCB0byBwcmV2ZW50IHRoZSBleGNhbGlkcmF3IG9uTGlua0NsaWNrIGFjdGlvbiB5b3UgbXVzdCByZXR1cm4gZmFsc2UsIGl0IHdpbGwgc3RvcCB0aGUgbmF0aXZlIGV4Y2FsaWRyYXcgb25MaW5rQ2xpY2sgbWFuYWdlbWVudCBmbG93LgogKiAgIG9uTGlua0NsaWNrSG9vazooCiAqICAgICBlbGVtZW50OiBFeGNhbGlkcmF3RWxlbWVudCwKICogICAgIGxpbmtUZXh0OiBzdHJpbmcsCiAqICAgICBldmVudDogTW91c2VFdmVudCwKICogICAgIHZpZXc6IEV4Y2FsaWRyYXdWaWV3LAogKiAgICAgZWE6IEV4Y2FsaWRyYXdBdXRvbWF0ZQogKiAgICkgPT4gYm9vbGVhbiA9IG51bGw7CiAqLwovL2VhLm9uTGlua0NsaWNrSG9vayA9IChlbGVtZW50LGxpbmtUZXh0LGV2ZW50LCB2aWV3LCBlYSkgPT4ge307CiAgIAovKioKICogSWYgc2V0LCB0aGlzIGNhbGxiYWNrIGlzIHRyaWdnZXJlZCwgd2hlbiBFeGNhbGlkcmF3IHJlY2VpdmVzIGFuIG9uRHJvcCBldmVudC4gCiAqIFlvdSBjYW4gdXNlIHRoaXMgY2FsbGJhY2sgaW4gY2FzZSB5b3Ugd2FudCB0byBkbyBzb21ldGhpbmcgYWRkaXRpb25hbCB3aGVuIHRoZSBvbkRyb3AgZXZlbnQgb2NjdXJzLgogKiBUaGlzIGNhbGxiYWNrIG11c3QgcmV0dXJuIGEgYm9vbGVhbiB2YWx1ZS4KICogSW4gY2FzZSB5b3Ugd2FudCB0byBwcmV2ZW50IHRoZSBleGNhbGlkcmF3IG9uRHJvcCBhY3Rpb24geW91IG11c3QgcmV0dXJuIGZhbHNlLCBpdCB3aWxsIHN0b3AgdGhlIG5hdGl2ZSBleGNhbGlkcmF3IG9uRHJvcCBtYW5hZ2VtZW50IGZsb3cuCiAqICAgb25Ecm9wSG9vazogKGRhdGE6IHsKICogICAgIGVhOiBFeGNhbGlkcmF3QXV0b21hdGU7CiAqICAgICBldmVudDogUmVhY3QuRHJhZ0V2ZW50PEhUTUxEaXZFbGVtZW50PjsKICogICAgIGRyYWdnYWJsZTogYW55OyAvL09ic2lkaWFuIGRyYWdnYWJsZSBvYmplY3QKICogICAgIHR5cGU6ICJmaWxlIiB8ICJ0ZXh0IiB8ICJ1bmtub3duIjsKICogICAgIHBheWxvYWQ6IHsKICogICAgICAgZmlsZXM6IFRGaWxlW107IC8vVEZpbGVbXSBhcnJheSBvZiBkcm9wcGVkIGZpbGVzCiAqICAgICAgIHRleHQ6IHN0cmluZzsgLy9zdHJpbmcKICogICAgIH07CiAqICAgICBleGNhbGlkcmF3RmlsZTogVEZpbGU7IC8vdGhlIGZpbGUgcmVjZWl2aW5nIHRoZSBkcm9wIGV2ZW50CiAqICAgICB2aWV3OiBFeGNhbGlkcmF3VmlldzsgLy90aGUgZXhjYWxpZHJhdyB2aWV3IHJlY2VpdmluZyB0aGUgZHJvcAogKiAgICAgcG9pbnRlclBvc2l0aW9uOiB7IHg6IG51bWJlcjsgeTogbnVtYmVyIH07IC8vdGhlIHBvaW50ZXIgcG9zaXRpb24gb24gY2FudmFzIGF0IHRoZSB0aW1lIG9mIGRyb3AKICogICB9KSA9PiBib29sZWFuID0gbnVsbDsKICovCi8vZWEub25Ecm9wSG9vayA9IChkYXRhKSA9PiB7fTsKIAovKioKICogSWYgc2V0LCB0aGlzIGNhbGxiYWNrIGlzIHRyaWdnZXJlZCwgd2hlbiBFeGNhbGlkcmF3IHJlY2VpdmVzIGFuIG9uUGFzdGUgZXZlbnQuCiAqIFlvdSBjYW4gdXNlIHRoaXMgY2FsbGJhY2sgaW4gY2FzZSB5b3Ugd2FudCB0byBkbyBzb21ldGhpbmcgYWRkaXRpb25hbCB3aGVuIHRoZQogKiBvblBhc3RlIGV2ZW50IG9jY3Vycy4KICogVGhpcyBjYWxsYmFjayBtdXN0IHJldHVybiBhIGJvb2xlYW4gdmFsdWUuCiAqIEluIGNhc2UgeW91IHdhbnQgdG8gcHJldmVudCB0aGUgZXhjYWxpZHJhdyBvblBhc3RlIGFjdGlvbiB5b3UgbXVzdCByZXR1cm4gZmFsc2UsCiAqIGl0IHdpbGwgc3RvcCB0aGUgbmF0aXZlIGV4Y2FsaWRyYXcgb25QYXN0ZSBtYW5hZ2VtZW50IGLine truncated
|
||||
const consoleLog = console["log"].bind(console);
|
||||
const deliberateCreateElement = (doc, tagName) => doc.createElement(tagName);
|
||||
function _interopNamespaceDefault(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(i){if("default"!==i){var a=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,Object.freeze(t)}var obsidian_module__namespace=_interopNamespaceDefault(obsidian_module),React__namespace=_interopNamespaceDefault(React);let urlAlphabet="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",random$3=e=>crypto.getRandomValues(new Uint8Array(e)),customRandom=(e,t,i)=>{let a=256-256%e.length;if(256===a){let a=e.length-1;return(n=t)=>{if(!n)return"";let r="";for(;;){let t=i(n),s=n;for(;s--;)if(r+=e[t[s]&a],r.length>=n)return r}}}let n=Math.ceil(409.6*t/a);return(r=t)=>{if(!r)return"";let s="";for(;;){let t=i(n),o=n;for(;o--;)if(t[o]<a&&(s+=e[t[o]%e.length],s.length>=r))return s}}},customAlphabet=(e,t=21)=>customRandom(e,0|t,random$3),nanoid$1=(e=21)=>{let t="",i=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=urlAlphabet[63&i[e]];return t};class ErrorHandler{static instance;errorLog=[];errorNoticeTimeout=1e4;maxLogEntries=100;constructor(){}static getInstance(){return ErrorHandler.instance||(ErrorHandler.instance=new ErrorHandler),ErrorHandler.instance}handleError(e,t,i=!0,a){const n="string"==typeof e?new Error(e):e;if(console.error(`[Excalidraw Error] in ${t}:`,n),this.errorLog.push({error:n,context:t,timestamp:Date.now()}),this.errorLog.length>this.maxLogEntries&&(this.errorLog=this.errorLog.slice(this.errorLog.length-this.maxLogEntries)),i){const e=this.formatErrorForUser(n,t);new obsidian_module.Notice(e,a||this.errorNoticeTimeout)}}safeEval(e,t,i,a){try{return i.eval.call(i,e)}catch(e){if(this.handleError(e,`SafeEval in ${t}`),void 0!==a)return a;throw e}}wrapWithTryCatch(e,t,i){try{return e()}catch(e){if(this.handleError(e,t),void 0!==i)return i;throw e}}formatErrorForUser(e,t){let i=e.message;return i.includes("Cannot read properties of undefined")?i="A required object was not available. This might be due to a plugin loading issue.":i.includes("is not a function")?i="A required function was not available. This might be due to a plugin version mismatch.":i.length>100&&(i=`${i.substring(0,100)}...`),`Excalidraw Error: ${i} (in ${t})`}getErrorLog(){return[...this.errorLog]}clearErrorLog(){this.errorLog=[]}}const errorHandler=ErrorHandler.getInstance(),UrlPurpose={AI_API:"AI API Endpoint (User Opt-in)",TASKBONE:"Taskbone OCR Endpoint",SUPPORT:"Support link, contact, or Ko-Fi button",DOCS:"Background information in Settings or Code Suggester",RELEASE_LOG:"Referencing issues, changes, or contributors in release log",VIDEO:"Supporting video tutorial or thumbnail",APP_LOGIC:"Internal application logic (embeddables, UI renders, asset fetching)",TRANSLATION:"One-time support message translation"},PLUGIN_REPOSITORY_RAW_BASE_URL="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master",PLUGIN_REPOSITORY_BLOB_BASE_URL="https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master",encodeRepositoryPath=e=>e.split("/").filter(Boolean).map(e=>encodeURIComponent(e)).join("/"),getPluginRepositoryRawUrl=e=>`${PLUGIN_REPOSITORY_RAW_BASE_URL}/${encodeRepositoryPath(e)}`,getPluginRepositoryBlobUrl=e=>`${PLUGIN_REPOSITORY_BLOB_BASE_URL}/${encodeRepositoryPath(e)}`,defineUrl=(e,t)=>({url:e,purpose:t}),URL_REGISTRY={RAW_GITHUBUSERCONTENT_COM_ZSVICZIAN_OBSIDIAN_EXCALIDRAW_PLUGIN_MASTER_EA_SCRIPTS_DIRECTORY_INFO_JSON:defineUrl("https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/directory-info.json",UrlPurpose.APP_LOGIC),RAW_GITHUBUSERCONTENT_COM_ZSVICZIAN_OBSIDIAN_EXCALIDRAW_PLUGIN_MASTER_EA_SCRIPTS_SCRIPT_STORE_JSON:defineUrl("https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/script-store.json",UrlPurpose.APP_LOGIC),GITHUB_COM_ZSVICZIAN_OBSIDIAN_EXCALIDRAW_PLUGIN_BLOB_MASTER_DOCS_EA_SCRIPTING_MD:defineUrl("https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/docs/ea-scripting.md",UrlPurpose.DOCS),RAW_GITHUBUSERCONTENT_COM_ZSVICZIAN_OBSIDIAN_EXCALIDRAW_PLUGIN_MASTER_IMAGE_BANNER_AUTOMATE_ANYTHING_PNG:defineUrl("https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/banner-automate-anything.png",UrlPurpose.APP_LOGIC),API_GITHUB_COM_REPOS_ZSVICZIAN_OBSIDIAN_EXCALIDRAW_PLUGIN_RELEASES:defineUrl("https://api.github.com/repos/zsviczian/obsidian-excalidraw-plugin/releases?per_page=15&page=1",UrlPurpose.APP_LOGIC),GITHUB_COM_ZSVICZIAN_OBSIDIAN_EXCALIDRAW_PLUGIN_ISSUES:defineUrl("https://github.com/zsviczian/obsidian-excalidraw-plugin/issues",UrlPurpose.DOCS),GITHUB_COM_ZSVICZIAN_OBSIDIAN_EXCALIDRAW_EXTRAS_ISSUES:defineUrl("https://github.com/zsviczian/obsidian-excalidraw-extras/issues",UrlPurpose.RELEASE_LOG),API_OPENAI_COM_V1:defineUrl("https://api.openai.com/v1",UrlPurpose.AI_API),API_ANTHROPIC_COM_V1:defineUrl("https://api.anthropic.com/v1",UrlPurpose.AI_API),GENERATIVELANGUAGE_GOOGLEAPLine truncated
|
||||
|
||||
/* nosourcemap */
|
||||
+12
-12
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"id": "obsidian-excalidraw-plugin",
|
||||
"name": "Excalidraw",
|
||||
"version": "2.23.3",
|
||||
"minAppVersion": "1.5.7",
|
||||
"description": "Sketch Your Mind. Edit and view Excalidraw drawings. Enter the world of 4D Visual PKM.",
|
||||
"author": "Zsolt Viczian",
|
||||
"authorUrl": "https://excalidraw-obsidian.online",
|
||||
"fundingUrl": "https://ko-fi.com/zsolt",
|
||||
"helpUrl": "https://github.com/zsviczian/obsidian-excalidraw-plugin#readme",
|
||||
"isDesktopOnly": false
|
||||
}
|
||||
{
|
||||
"id": "obsidian-excalidraw-plugin",
|
||||
"name": "Excalidraw",
|
||||
"version": "2.28.1",
|
||||
"minAppVersion": "1.8.7",
|
||||
"description": "Sketch Your Mind. Edit and view Excalidraw drawings. Enter the world of 4D Visual PKM.",
|
||||
"author": "Zsolt Viczian",
|
||||
"authorUrl": "https://community.sketch-your-mind.com/em",
|
||||
"fundingUrl": "https://ko-fi.com/zsolt",
|
||||
"helpUrl": "https://github.com/zsviczian/obsidian-excalidraw-plugin#readme",
|
||||
"isDesktopOnly": false
|
||||
}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
@font-face{font-family:Assistant;font-weight:400;src:url(https://unpkg.com/@zsviczian/excalidraw@0.17.6-2/dist/excalidraw-assets/Assistant-Regular.woff2) format("woff2");style:normal;display:swap}@font-face{font-family:Assistant;font-weight:500;src:url(https://unpkg.com/@zsviczian/excalidraw@0.17.6-2/dist/excalidraw-assets/Assistant-Medium.woff2) format("woff2");style:normal;display:swap}@font-face{font-family:Assistant;font-weight:600;src:url(https://unpkg.com/@zsviczian/excalidraw@0.17.6-2/dist/excalidraw-assets/Assistant-SemiBold.woff2) format("woff2");style:normal;display:swap}@font-face{font-family:Assistant;font-weight:700;src:url(https://unpkg.com/@zsviczian/excalidraw@0.17.6-2/dist/excalidraw-assets/Assistant-Bold.woff2) format("woff2");style:normal;display:swap}.excalidraw .github-corner{display:none}.excalidraw .context-menu-option-separator{margin:4px!important}.excalidraw .context-menu-option{box-shadow:none}.excalidraw .popover{background-color:transparent!important;border:0!important;overflow-y:auto!important;padding:0!important;position:fixed!important}.excalidraw .disable-zen-mode--visible{color:var(--text-primary-color)}.excalidraw .Island .scrollbar{--scrollbar-thumb-bg:silver}.excalidraw .ToolIcon__icon img{height:1rem}.ToolIcon button,.excalidraw button{box-shadow:none;justify-content:normal}.excalidraw{--default-button-size:2rem!important;--default-icon-size:1rem!important;--lg-button-size:1.8rem!important;--lg-icon-size:1rem!important;--editor-container-padding:var(--size-4-2)}.excalidraw .tray-zoom{height:var(--default-button-size);padding-bottom:.05rem;padding-top:.05rem;pointer-events:auto}.excalidraw.excalidraw-container.theme--dark{background-color:#121212;color:#fff}.excalidraw .color-picker-content{max-height:10rem;overflow-y:auto}.excalidraw .ToolIcon__keybinding{font-size:.45rem!important}.excalidraw label.color-input-container>input{max-width:5rem}.excalidraw .App-mobile-menu .panelColumn,.excalidraw .App-toolbar-content .dropdown-menu,.excalidraw .selected-shape-actions .panelColumn{max-height:70vh;overflow-y:auto}.excalidraw .App-mobile-menu{width:12.5rem!important}.excalidraw .panelColumn .buttonList{max-width:13rem}.excalidraw input[type=color]{height:1.65rem;width:1.65rem}.excalidraw input[type=color]::-webkit-color-swatch{height:1.65rem}.excalidraw input[type=color]::-webkit-color-swatch-wrapper{padding:0}.excalidraw :where(.mobile-misc-tools-container,.tray-misc-tools-container) .sidebar-trigger{background-color:unset;border-radius:0;box-shadow:none;--lg-button-size:var(--button-height,var(--default-button-size))}.excalidraw :where(.mobile-misc-tools-container,.tray-misc-tools-container) .sidebar-trigger:hover{background-color:var(--button-hover-bg)}.excalidraw :where(.mobile-misc-tools-container,.tray-misc-tools-container) .sidebar-trigger:active{background-color:var(--button-hover-bg);border:1px solid var(--button-active-border);box-shadow:none}.excalidraw .welcome-screen-center__logo svg{width:5rem!important}.excalidraw .Modal{background-color:initial;border:initial;height:auto;max-height:none;max-width:none;width:auto}.excalidraw .ttd-dialog-content textarea,.excalidraw input,.excalidraw textarea.ttd-dialog-input{caret-color:var(--excalidraw-caret-color)!important}.excalidraw .color-picker-content input[type=color]{filter:var(--theme-filter)}.excalidraw .ExcTextField__input input::placeholder{color:var(--select-highlight-color)}.excalidraw textarea::placeholder{color:var(--color-gray-50)}.excalidraw .ToolIcon_type_button{color:var(--text-primary-color)}.excalidraw .picker-content{grid-gap:.2rem!important}.excalidraw .picker-content button.picker-option{height:1.85rem!important;width:1.85rem!important}.excalidraw .picker{padding:.2rem!important}.excalidraw .context-menu{height:-moz-fit-content;height:fit-content}.excalidraw .App-bottom-bar .App-toolbar{justify-content:start}.excalidraw-left-handed .excalidraw .App-bottom-bar{justify-content:flex-end!important;left:auto!important;right:0!important;transform:none!important}.excalidraw-left-handed .excalidraw .App-bottom-bar .App-toolbar{justify-content:end}.excalidraw .excalidraw-ui-top-right.library-and-pen,.excalidraw.excalidraw--mobile .excalidraw-ui-top-right{align-items:center;flex-direction:row;flex-wrap:wrap;gap:var(--size-4-1);justify-content:center}.excalidraw .excalidraw-ui-top-right.library-and-pen .ToolIcon__penMode{margin:auto}.excalidraw :is(.mobile-misc-tools-container,.tray-misc-tools-container){margin-right:unset}.excalidraw :is(.mobile-misc-tools-container,.tray-misc-tools-container).layer-ui__wrapper__top-right--compact{gap:0}.excalidraw .FixedSideContainer_side_top{padding-top:0!important}.excalidraw .ToolIcon.ToolIcon__penMode{height:-moz-fit-content;height:fit-content}.excalidraw svg.svg-icon{color:var(--icon-fill-color)}.excalidraw input[type=radio]:active,.excalidraw input[type=radio]:checked,.excalidraw input[type=radio]:focus,.excalidraw input[type=radio]:focus-visible{background-color:reverLine truncated
|
||||
.excalidraw .ToolIcon{align-items:center;border-radius:var(--border-radius-lg);cursor:pointer;display:inline-flex;position:relative;-webkit-tap-highlight-color:transparent;user-select:none}.excalidraw .ToolIcon__hidden{display:none!important}.excalidraw .ToolIcon.fillable.ToolIcon_type_toggle.ToolIcon--checked .ToolIcon__icon{--icon-fill-color:var(--color-on-primary-container)}.excalidraw .ToolIcon.fillable.ToolIcon_type_toggle.ToolIcon--checked .ToolIcon__icon svg{fill:var(--icon-fill-color)}.excalidraw .ToolIcon.ToolIcon_type_toggle.ToolIcon--checked .ToolIcon__icon{background:var(--color-surface-primary-container);--keybinding-color:var(--color-on-primary-container);--icon-fill-color:var(--color-on-primary-container)}.excalidraw .ToolIcon.ToolIcon_type_toggle.ToolIcon--checked .ToolIcon__icon svg{color:var(--color-on-primary-container)}.excalidraw .ToolIcon .ToolIcon__keybinding{bottom:2px;right:3px}.excalidraw .ToolIcon .ToolIcon__icon:hover{background:var(--button-hover-bg)}.excalidraw .ToolIcon .ToolIcon__icon:active{background:var(--button-hover-bg);border:1px solid var(--button-active-border)}.excalidraw .ToolIcon .ToolIcon__icon:active svg{color:var(--color-on-primary-container)}.excalidraw .ToolIcon .ToolIcon__icon[aria-disabled=true]{background:initial;border:none}.excalidraw .ToolIcon .ToolIcon__icon[aria-disabled=true] svg{color:var(--color-disabled)}.excalidraw .ToolIcon.ToolIcon_type_toggle:disabled{cursor:default;--keybinding-color:var(--color-disabled)}.excalidraw .ToolIcon.ToolIcon_type_toggle:disabled .ToolIcon__icon svg{color:var(--color-disabled)}.excalidraw .ToolIcon.ToolIcon_type_toggle:disabled .ToolIcon__icon:active,.excalidraw .ToolIcon.ToolIcon_type_toggle:disabled .ToolIcon__icon:hover{background:initial;border:none}.excalidraw .ToolIcon.ToolIcon_type_toggle:disabled .ToolIcon__icon:active svg,.excalidraw .ToolIcon.ToolIcon_type_toggle:disabled .ToolIcon__icon:hover svg{color:var(--color-disabled)}.excalidraw .ToolIcon--plain{background-color:transparent}.excalidraw .ToolIcon--plain .ToolIcon__icon{height:2rem;width:2rem}.excalidraw .ToolIcon_type_toggle{appearance:none;background-color:transparent;border:none;color:inherit;font:inherit;margin:0;padding:0;text-align:inherit}.excalidraw .ToolIcon_type_toggle:focus-visible{box-shadow:0 0 0 2px var(--focus-highlight-color)}.excalidraw .ToolIcon__icon{align-items:center;border-radius:var(--border-radius-lg);box-sizing:border-box;color:var(--icon-fill-color);display:flex;height:var(--default-button-size);justify-content:center;width:var(--default-button-size)}.excalidraw .ToolIcon__icon+.ToolIcon__label{margin-inline-start:0}.excalidraw .ToolIcon__icon svg{color:var(--icon-fill-color);height:var(--default-icon-size);position:relative;width:var(--default-icon-size)}.excalidraw .ToolIcon__label{align-items:center;color:var(--icon-fill-color);display:flex;font-family:var(--ui-font);margin:0 .8em;text-overflow:ellipsis}.excalidraw .ToolIcon__label .Spinner{margin-left:.6em}.excalidraw .ToolIcon_size_small .ToolIcon__icon{font-size:.8em;height:2rem;width:2rem}.excalidraw .Modal .ToolIcon_type_button,.excalidraw .ToolIcon_type_button{background-color:initial;border:none;font-size:inherit;margin:0;padding:0}.excalidraw .Modal .ToolIcon_type_button:focus-visible,.excalidraw .ToolIcon_type_button:focus-visible{box-shadow:0 0 0 2px var(--focus-highlight-color)}.excalidraw .Modal .ToolIcon_type_button:active,.excalidraw .ToolIcon_type_button:active{background-color:var(--button-gray-3)}.excalidraw .Modal .ToolIcon_type_button:disabled,.excalidraw .ToolIcon_type_button:disabled{cursor:default}.excalidraw .Modal .ToolIcon_type_button:disabled:active,.excalidraw .Modal .ToolIcon_type_button:disabled:focus-visible,.excalidraw .Modal .ToolIcon_type_button:disabled:hover,.excalidraw .ToolIcon_type_button:disabled:active,.excalidraw .ToolIcon_type_button:disabled:focus-visible,.excalidraw .ToolIcon_type_button:disabled:hover{background-color:initial;border:none;box-shadow:none}.excalidraw .Modal .ToolIcon_type_button:disabled svg,.excalidraw .ToolIcon_type_button:disabled svg{color:var(--color-disabled)}.excalidraw .Modal .ToolIcon_type_button--show,.excalidraw .ToolIcon_type_button--show{visibility:visible}.excalidraw .Modal .ToolIcon_type_button--hide,.excalidraw .ToolIcon_type_button--hide{display:none!important}.excalidraw .ToolIcon_type_floating,.excalidraw .ToolIcon_type_floating:active,.excalidraw .ToolIcon_type_floating:hover{background-color:transparent}.excalidraw .ToolIcon_type_floating .ToolIcon__icon{background-color:var(--button-gray-1)}.excalidraw .ToolIcon_type_floating .ToolIcon__icon:hover{background-color:var(--button-gray-2)}.excalidraw .ToolIcon_type_floating .ToolIcon__icon:active{background-color:var(--button-gray-3)}.excalidraw .ToolIcon_type_floating .ToolIcon__icon{height:2rem;width:2rem}.excalidraw .ToolIcon__keybinding{bottom:2px;color:var(--keybinding-color);font-family:var(--ui-font);font-size:.625rem;position:absolute;riLine truncated
|
||||
+166
-154
@@ -3,28 +3,33 @@ THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||
if you want to view the source visit the plugins github repository (https://github.com/denolehov/obsidian-git)
|
||||
*/
|
||||
|
||||
var hF=Object.create;var uc=Object.defineProperty;var pF=Object.getOwnPropertyDescriptor;var mF=Object.getOwnPropertyNames;var gF=Object.getPrototypeOf,vF=Object.prototype.hasOwnProperty;var a_=t=>{throw TypeError(t)};var wF=(t,e,r)=>e in t?uc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var _F=(t,e)=>()=>(t&&(e=t(t=0)),e);var H=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),bF=(t,e)=>{for(var r in e)uc(t,r,{get:e[r],enumerable:!0})},o_=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of mF(e))!vF.call(t,n)&&n!==r&&uc(t,n,{get:()=>e[n],enumerable:!(i=pF(e,n))||i.enumerable});return t};var Ht=(t,e,r)=>(r=t!=null?hF(gF(t)):{},o_(e||!t||!t.__esModule?uc(r,"default",{value:t,enumerable:!0}):r,t)),yF=t=>o_(uc({},"__esModule",{value:!0}),t);var Ve=(t,e,r)=>wF(t,typeof e!="symbol"?e+"":e,r),Bp=(t,e,r)=>e.has(t)||a_("Cannot "+r);var R=(t,e,r)=>(Bp(t,e,"read from private field"),r?r.call(t):e.get(t)),pe=(t,e,r)=>e.has(t)?a_("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),we=(t,e,r,i)=>(Bp(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),Me=(t,e,r)=>(Bp(t,e,"access private method"),r);var u_=H(vf=>{"use strict";m();vf.byteLength=EF;vf.toByteArray=kF;vf.fromByteArray=TF;var on=[],mi=[],xF=typeof Uint8Array!="undefined"?Uint8Array:Array,Hp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Js=0,l_=Hp.length;Js<l_;++Js)on[Js]=Hp[Js],mi[Hp.charCodeAt(Js)]=Js;var Js,l_;mi[45]=62;mi[95]=63;function c_(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function EF(t){var e=c_(t),r=e[0],i=e[1];return(r+i)*3/4-i}function SF(t,e,r){return(e+r)*3/4-r}function kF(t){var e,r=c_(t),i=r[0],n=r[1],s=new xF(SF(t,i,n)),a=0,o=n>0?i-4:i,l;for(l=0;l<o;l+=4)e=mi[t.charCodeAt(l)]<<18|mi[t.charCodeAt(l+1)]<<12|mi[t.charCodeAt(l+2)]<<6|mi[t.charCodeAt(l+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=e&255;return n===2&&(e=mi[t.charCodeAt(l)]<<2|mi[t.charCodeAt(l+1)]>>4,s[a++]=e&255),n===1&&(e=mi[t.charCodeAt(l)]<<10|mi[t.charCodeAt(l+1)]<<4|mi[t.charCodeAt(l+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function AF(t){return on[t>>18&63]+on[t>>12&63]+on[t>>6&63]+on[t&63]}function CF(t,e,r){for(var i,n=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),n.push(AF(i));return n.join("")}function TF(t){for(var e,r=t.length,i=r%3,n=[],s=16383,a=0,o=r-i;a<o;a+=s)n.push(CF(t,a,a+s>o?o:a+s));return i===1?(e=t[r-1],n.push(on[e>>2]+on[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(on[e>>10]+on[e>>4&63]+on[e<<2&63]+"=")),n.join("")}});var f_=H(Up=>{m();Up.read=function(t,e,r,i,n){var s,a,o=n*8-i-1,l=(1<<o)-1,c=l>>1,u=-7,f=r?n-1:0,d=r?-1:1,h=t[e+f];for(f+=d,s=h&(1<<-u)-1,h>>=-u,u+=o;u>0;s=s*256+t[e+f],f+=d,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=i;u>0;a=a*256+t[e+f],f+=d,u-=8);if(s===0)s=1-c;else{if(s===l)return a?NaN:(h?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-c}return(h?-1:1)*a*Math.pow(2,s-i)};Up.write=function(t,e,r,i,n,s){var a,o,l,c=s*8-n-1,u=(1<<c)-1,f=u>>1,d=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,p=i?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(a++,l/=2),a+f>=u?(o=0,a=u):a+f>=1?(o=(e*l-1)*Math.pow(2,n),a=a+f):(o=e*Math.pow(2,f-1)*Math.pow(2,n),a=0));n>=8;t[r+h]=o&255,h+=p,o/=256,n-=8);for(a=a<<n|o,c+=n;c>0;t[r+h]=a&255,h+=p,a/=256,c-=8);t[r+h-p]|=g*128}});var Zp=H(So=>{"use strict";m();var Gp=u_(),xo=f_(),d_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;So.Buffer=F;So.SlowBuffer=MF;So.INSPECT_MAX_BYTES=50;var wf=2147483647;So.kMaxLength=wf;F.TYPED_ARRAY_SUPPORT=PF();!F.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function PF(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(t){return!1}}Object.defineProperty(F.prototype,"parent",{enumerable:!0,get:function(){if(F.isBuffer(this))return this.buffer}});Object.defineProperty(F.prototype,"offset",{enumerable:!0,get:function(){if(F.isBuffer(this))return this.byteOffset}});function jn(t){if(t>wf)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,F.prototype),e}function F(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Wp(t)}return g_(t,e,r)}F.poolSize=8192;function g_(t,e,r){if(typeof t=="string")return $F(t,e);if(ArrayBuffer.isView(t))return FF(t);if(t==null)throw new TypeError("Line truncated
|
||||
"use strict";var j$=Object.create;var _c=Object.defineProperty;var V$=Object.getOwnPropertyDescriptor;var z$=Object.getOwnPropertyNames;var W$=Object.getPrototypeOf,q$=Object.prototype.hasOwnProperty;var Bb=t=>{throw TypeError(t)};var Y$=(t,e,r)=>e in t?_c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Z$=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(i){throw r=[i],i}};var H=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},K$=(t,e)=>{for(var r in e)_c(t,r,{get:e[r],enumerable:!0})},Hb=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of z$(e))!q$.call(t,n)&&n!==r&&_c(t,n,{get:()=>e[n],enumerable:!(i=V$(e,n))||i.enumerable});return t};var mt=(t,e,r)=>(r=t!=null?j$(W$(t)):{},Hb(e||!t||!t.__esModule?_c(r,"default",{value:t,enumerable:!0}):r,t)),X$=t=>Hb(_c({},"__esModule",{value:!0}),t);var Ue=(t,e,r)=>Y$(t,typeof e!="symbol"?e+"":e,r),dm=(t,e,r)=>e.has(t)||Bb("Cannot "+r);var $=(t,e,r)=>(dm(t,e,"read from private field"),r?r.call(t):e.get(t)),ge=(t,e,r)=>e.has(t)?Bb("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),de=(t,e,r,i)=>(dm(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),Se=(t,e,r)=>(dm(t,e,"access private method"),r);var jb=H(Lf=>{"use strict";m();Lf.byteLength=J$;Lf.toByteArray=tF;Lf.fromByteArray=nF;var dn=[],bi=[],Q$=typeof Uint8Array!="undefined"?Uint8Array:Array,hm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ca=0,Ub=hm.length;ca<Ub;++ca)dn[ca]=hm[ca],bi[hm.charCodeAt(ca)]=ca;var ca,Ub;bi[45]=62;bi[95]=63;function Gb(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function J$(t){var e=Gb(t),r=e[0],i=e[1];return(r+i)*3/4-i}function eF(t,e,r){return(e+r)*3/4-r}function tF(t){var e,r=Gb(t),i=r[0],n=r[1],s=new Q$(eF(t,i,n)),a=0,o=n>0?i-4:i,l;for(l=0;l<o;l+=4)e=bi[t.charCodeAt(l)]<<18|bi[t.charCodeAt(l+1)]<<12|bi[t.charCodeAt(l+2)]<<6|bi[t.charCodeAt(l+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=e&255;return n===2&&(e=bi[t.charCodeAt(l)]<<2|bi[t.charCodeAt(l+1)]>>4,s[a++]=e&255),n===1&&(e=bi[t.charCodeAt(l)]<<10|bi[t.charCodeAt(l+1)]<<4|bi[t.charCodeAt(l+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function rF(t){return dn[t>>18&63]+dn[t>>12&63]+dn[t>>6&63]+dn[t&63]}function iF(t,e,r){for(var i,n=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),n.push(rF(i));return n.join("")}function nF(t){for(var e,r=t.length,i=r%3,n=[],s=16383,a=0,o=r-i;a<o;a+=s)n.push(iF(t,a,a+s>o?o:a+s));return i===1?(e=t[r-1],n.push(dn[e>>2]+dn[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(dn[e>>10]+dn[e>>4&63]+dn[e<<2&63]+"=")),n.join("")}});var Vb=H(pm=>{m();pm.read=function(t,e,r,i,n){var s,a,o=n*8-i-1,l=(1<<o)-1,c=l>>1,u=-7,f=r?n-1:0,d=r?-1:1,h=t[e+f];for(f+=d,s=h&(1<<-u)-1,h>>=-u,u+=o;u>0;s=s*256+t[e+f],f+=d,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=i;u>0;a=a*256+t[e+f],f+=d,u-=8);if(s===0)s=1-c;else{if(s===l)return a?NaN:(h?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-c}return(h?-1:1)*a*Math.pow(2,s-i)};pm.write=function(t,e,r,i,n,s){var a,o,l,c=s*8-n-1,u=(1<<c)-1,f=u>>1,d=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,p=i?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(a++,l/=2),a+f>=u?(o=0,a=u):a+f>=1?(o=(e*l-1)*Math.pow(2,n),a=a+f):(o=e*Math.pow(2,f-1)*Math.pow(2,n),a=0));n>=8;t[r+h]=o&255,h+=p,o/=256,n-=8);for(a=a<<n|o,c+=n;c>0;t[r+h]=a&255,h+=p,a/=256,c-=8);t[r+h-p]|=g*128}});var Em=H(Ao=>{"use strict";m();var mm=jb(),ko=Vb(),zb=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ao.Buffer=D;Ao.SlowBuffer=uF;Ao.INSPECT_MAX_BYTES=50;var Nf=2147483647;Ao.kMaxLength=Nf;D.TYPED_ARRAY_SUPPORT=sF();!D.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function sF(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(t){return!1}}Object.defineProperty(D.prototype,"parent",{enumerable:!0,get:function(){if(D.isBuffer(this))return this.buffer}});Object.defineProperty(D.prototype,"offset",{enumerable:!0,get:function(){if(D.isBuffer(this))return this.byteOffset}});function Wn(t){if(t>Nf)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,D.prototype),e}function D(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return bm(t)}return Zb(t,e,r)}D.poolSize=8192;function Zb(t,e,r){if(typeoLine truncated
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u3(t,e){if(t){if(typeof t=="string")return sk(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return sk(t,e)}}function sk(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function f3(t,e){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(t)))){var r=[],i=!0,n=!1,s=void 0;try{for(var a=t[Symbol.iterator](),o;!(i=(o=a.next()).done)&&(r.push(o.value),!(e&&r.length===e));i=!0);}catch(l){n=!0,s=l}finally{try{!i&&a.return!=null&&a.return()}finally{if(n)throw s}}return r}}function d3(t){if(Array.isArray(t))return t}var ok=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?$/,lk=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])?$/,ck=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,uk=/^rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,fk=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,dk=/^rgba?\(\s*(\d+%)\s+(\d+%)\s+(\d+%)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,hk=/^hsla?\(\s*(\d+)(deg|rad|grad|turn)?\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/;function yu(t,e){return t.indexOf(e)>-1}function h3(t,e,r){var i=t/255,n=e/255,s=r/255,a=Math.max(i,n,s),o=Math.min(i,n,s),l=a-o,c=(a+o)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=(function(){switch(a){case i:return(n-s)/l%6;case n:return(s-i)/l+2;default:return(i-n)/l+4}})();return[f*60,u*100,c*100]}function p3(t,e,r){var i=t/60,n=e/100,s=r/100,a=(1-Math.abs(2*s-1))*n,o=a*(1-Math.abs(i%2-1)),l=s-a/2,c=(function(){return i<1?[a,o,0]:i<2?[o,a,0]:i<3?[0,a,o]:i<4?[0,o,a]:i<5?[o,0,a]:[a,0,o]})(),u=Er(c,3),f=u[0],d=u[1],h=u[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var m3=(function(){function t(e){var r=Er(e,4),i=r[0],n=r[1],s=r[2],a=r[3];o3(this,t),this.values=[Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(n,10),255),0),Math.max(Math.min(parseInt(s,10),255),0),a==null?1:Math.max(Math.min(parseFloat(a),255),0)]}return l3(t,[{key:"toRgbString",value:function(){var r=Er(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return a===1?"rgb(".concat(i,", ").concat(n,", ").concat(s,")"):"rgba(".concat(i,", ").concat(n,", ").concat(s,", ").concat(a,")")}},{key:"toHslString",value:function(){var r=this.toHslaArray(),i=Er(r,4),n=i[0],s=i[1],a=i[2],o=i[3];return o===1?"hsl(".concat(n,", ").concat(s,"%, ").concat(a,"%)"):"hsla(".concat(n,", ").concat(s,"%, ").concat(a,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var r=Er(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return i=Number(i).toString(16).padStart(2,"0"),n=Number(n).toString(16).padStart(2,"0"),s=Number(s).toString(16).padStart(2,"0"),a=a<1?parseInt(a*255,10).toString(16).padStart(2,"0"):"","#".concat(i).concat(n).concat(s).concat(a)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var r=Er(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3],o=h3(i,n,s),l=Er(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,a]}}]),t})();function cl(t){var e=Er(t,4),r=e[0],i=e[1],n=e[2],s=e[3];return new m3([r,i,n,s])}function vv(t){var e=Er(t,3),r=e[0],i=e[1],n=e[2];return cl([r,i,n,1])}function Vd(t){var e=Er(t,4),r=e[0],i=e[1],n=e[2],s=e[3],a=p3(r,i,n),o=Er(a,3),l=o[0],c=o[1],u=o[2];return cl([l,c,u,s])}function pk(t){var e=Er(t,3),r=e[0],i=e[1],n=e[2];return Vd([r,i,n,1])}function g3(t){var e=ok.exec(t)||lk.exec(t),r=Er(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=parseInt(i.length<2?i.repeat(2):i,16),n=parseInt(n.length<2?n.repeat(2):n,16),s=parseInt(s.length<2?s.repeat(2):s,16),a=a&&(parseInt(a.length<2?a.repeat(2):a,16)/255).toPrecision(1)||1,cl([i,n,s,a])}function v3(t){var e=ck.exec(t)||fk.exec(t)||uk.exec(t)||dk.exec(t),r=Er(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=yu(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),n=yu(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),s=yu(s,"%")>0?parseInt(s,10)*255/100:parseInt(s,10),a=a===void 0?1:parseFloat(a)/(yu(a,"%")?100:1),cl([i,n,s,a])}function w3(t){var e=hk.exec(t),r=Er(e,6),i=r[1],n=r[2],s=r[3],a=r[4],o=r[5];return n=n||"deg",i=(0,a3.default)(parseFloat(i),n,"deg"),s=parseFloat(s),a=parseFloat(a),o=o===void 0?1:parseFloat(o)/(yu(o,"%")?100:1),Vd([i,s,a,o])}function mk(t){return ik.default[t]?vv(ik.default[t]):ok.test(t)||lk.test(t)?g3(t):ck.test(t)||fk.test(t)||uk.test(t)||dk.test(t)?v3(t):hk.test(t)?w3(t):null}var b3={fromString:mk,fromRgb:vv,fromRgba:cl,fromHsl:pk,fromHsla:Vd};es.default=b3});var Tk=H((B9,Ak)=>{m();Ak.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,a=!1,o=n+1,l=[],c=[],u,f,d=function(){n>=s&&(u=r,f=n,r=i,i=u,n=s,s=f,a=!0,o=n+1)},h=function(g,v,b,_,C){return{startX:g,startY:v,endX:b,endY:_,r:C}},p=function(g,v,b){var _,C,x,E,A;for(v>b?_=l[g-1+o]:_=l[g+1+o],A=x=Math
Line truncated
|
||||
`});fe=!1,z=Q.length}function Ie(yt,Tt){var Ke="="+j,J=yt.indexOf(Ke,Tt),L=c(yt.substring(yt.indexOf("=",Tt)+1,J)).split(" ");return X=L[0],j=L[L.length-1],J+Ke.length-1}for(y&&(y=y.split(" "),X=y[0],j=y[1]),ce=0;ce<P;ce++)B==T?u(X,S,ce)?(--ce,Ze(),B=I):S.charAt(ce)==`
|
||||
`?cr(fe):K+=S.charAt(ce):B==I?(ce+=X.length-1,Ae=t.tags[S.charAt(ce+1)],re=Ae?S.charAt(ce+1):"_v",re=="="?(ce=Ie(S,ce),B=T):(Ae&&ce++,B=M),fe=ce):u(j,S,ce)?(Q.push({tag:re,n:c(K),otag:X,ctag:j,i:re=="/"?fe-X.length:ce+j.length}),K="",ce+=j.length-1,B=T,re=="{"&&(j=="}}"?ce++:l(Q[Q.length-1]))):K+=S.charAt(ce);return cr(fe,!0),Q};function l(w){w.n.substr(w.n.length-1)==="}"&&(w.n=w.n.substring(0,w.n.length-1))}function c(w){return w.trim?w.trim():w.replace(/^\s*|\s*$/g,"")}function u(w,S,y){if(S.charAt(y)!=w.charAt(0))return!1;for(var P=1,T=w.length;P<T;P++)if(S.charAt(y+P)!=w.charAt(P))return!1;return!0}var f={_t:!0,"\n":!0,$:!0,"/":!0};function d(w,S,y,P){var T=[],I=null,M=null,B=null;for(M=y[y.length-1];w.length>0;){if(B=w.shift(),M&&M.tag=="<"&&!(B.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[B.tag]<=t.tags.$||h(B,P))y.push(B),B.nodes=d(w,B.tag,y,P);else if(B.tag=="/"){if(y.length===0)throw new Error("Closing tag without opener: /"+B.n);if(I=y.pop(),B.n!=I.n&&!p(B.n,I.n,P))throw new Error("Nesting error: "+I.n+" vs. "+B.n);return I.end=B.i,T}else B.tag==`
|
||||
`&&(B.last=w.length==0||w[0].tag==`
|
||||
`);T.push(B)}if(y.length>0)throw new Error("missing closing tag: "+y.pop().n);return T}function h(w,S){for(var y=0,P=S.length;y<P;y++)if(S[y].o==w.n)return w.tag="#",!0}function p(w,S,y){for(var P=0,T=y.length;P<T;P++)if(y[P].c==w&&y[P].o==S)return!0}function g(w){var S=[];for(var y in w)S.push('"'+_(y)+'": function(c,p,t,i) {'+w[y]+"}");return"{ "+S.join(",")+" }"}function v(w){var S=[];for(var y in w.partials)S.push('"'+_(y)+'":{name:"'+_(w.partials[y].name)+'", '+v(w.partials[y])+"}");return"partials: {"+S.join(",")+"}, subs: "+g(w.subs)}t.stringify=function(w,S,y){return"{code: function (c,p,i) { "+t.wrapMain(w.code)+" },"+v(w)+"}"};var b=0;t.generate=function(w,S,y){b=0;var P={code:"",subs:{},partials:{}};return t.walk(w,P),y.asString?this.stringify(P,S,y):this.makeTemplate(P,S,y)},t.wrapMain=function(w){return'var t=this;t.b(i=i||"");'+w+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(w,S,y){var P=this.makePartials(w);return P.code=new Function("c","p","i",this.wrapMain(w.code)),new this.template(P,S,this,y)},t.makePartials=function(w){var S,y={subs:{},partials:w.partials,name:w.name};for(S in y.partials)y.partials[S]=this.makePartials(y.partials[S]);for(S in w.subs)y.subs[S]=new Function("c","p","t","i",w.subs[S]);return y};function _(w){return w.replace(s,"\\\\").replace(r,'\\"').replace(i,"\\n").replace(n,"\\r").replace(a,"\\u2028").replace(o,"\\u2029")}function C(w){return~w.indexOf(".")?"d":"f"}function x(w,S){var y="<"+(S.prefix||""),P=y+w.n+b++;return S.partials[P]={name:w.n,partials:{}},S.code+='t.b(t.rp("'+_(P)+'",c,p,"'+(w.indent||"")+'"));',P}t.codegen={"#":function(w,S){S.code+="if(t.s(t."+C(w.n)+'("'+_(w.n)+'",c,p,1),c,p,0,'+w.i+","+w.end+',"'+w.otag+" "+w.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(w.nodes,S),S.code+="});c.pop();}"},"^":function(w,S){S.code+="if(!t.s(t."+C(w.n)+'("'+_(w.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(w.nodes,S),S.code+="};"},">":x,"<":function(w,S){var y={partials:{},code:"",subs:{},inPartial:!0};t.walk(w.nodes,y);var P=S.partials[x(w,S)];P.subs=y.subs,P.partials=y.partials},$:function(w,S){var y={subs:{},code:"",partials:S.partials,prefix:w.n};t.walk(w.nodes,y),S.subs[w.n]=y.code,S.inPartial||(S.code+='t.sub("'+_(w.n)+'",c,p,i);')},"\n":function(w,S){S.code+=A('"\\n"'+(w.last?"":" + i"))},_v:function(w,S){S.code+="t.b(t.v(t."+C(w.n)+'("'+_(w.n)+'",c,p,0)));'},_t:function(w,S){S.code+=A('"'+_(w.text)+'"')},"{":E,"&":E};function E(w,S){S.code+="t.b(t.t(t."+C(w.n)+'("'+_(w.n)+'",c,p,0)));'}function A(w){return"t.b("+w+");"}t.walk=function(w,S){for(var y,P=0,T=w.length;P<T;P++)y=t.codegen[w[P].tag],y&&y(w[P],S);return S},t.parse=function(w,S,y){return y=y||{},d(w,"",[],y.sectionTags||[])},t.cache={},t.cacheKey=function(w,S){return[w,!!S.asString,!!S.disableLambda,S.delimiters,!!S.modelGet].join("||")},t.compile=function(w,S){S=S||{};var y=t.cacheKey(w,S),P=this.cache[y];if(P){var T=P.partials;for(var I in T)delete T[I].instance;return P}return P=this.generate(this.parse(this.scan(w,S.delimiters),w,S),w,S),this.cache[y]=P}})(typeof r0!="undefined"?r0:Hogan)});var fP=H(i0=>{m();var B4={};(function(t){t.Template=function(d,h,p,g){d=d||{},this.r=d.code||this.r,this.c=p,this.options=g||{},this.text=h||"",this.partials=d.partials||{},this.subs=d.subs||{},this.buf=""},t.Template.prototype={r:function(d,h,p){return""},v:u,t:c,render:function(h,p,g){return this.ri([h],p||{},g)},ri:function(d,h,p){return this.r(d,h,p)},ep:function(d,h){var p=this.partials[d],g=h[p.name];if(p.instance&&p.base==g)return p.instance;if(typeof g=="string"){if(!this.c)throw new Error("No compiler available.");g=this.c.compile(g,this.options)}if(!g)return null;if(this.partials[d].base=g,p.subs){h.stackText||(h.stackText={});for(key in p.subs)h.stackText[key]||(h.stackText[key]=this.activeSub!==void 0&&h.stackText[this.activeSub]?h.stackText[this.activeSub]:this.text);g=r(g,p.subs,p.partials,this.stackSubs,this.stackPartials,h.stackText)}return this.partials[d].instance=g,g},rp:function(d,h,p,g){var v=this.ep(d,p);return v?v.ri(h,p,g):""},rs:function(d,h,p){var g=d[d.length-1];if(!f(g)){p(d,h,this);return}for(var v=0;v<g.length;v++)d.push(g[v]),p(d,h,this),d.pop()},s:function(d,h,p,g,v,b,_){var C;return f(d)&&d.length===0?!1:(typeof d=="function"&&(d=this.ms(d,h,p,g,v,b,_)),C=!!d,!g&&C&&h&&h.push(typeof d=="object"?d:h[h.length-1]),C)},d:function(d,h,p,g){var v,b=d.split("."),_=this.f(b[0],h,p,g),C=this.options.modelGet,x=null;if(d==="."&&f(h[h.length-2]))_=h[h.length-1];else for(var E=1;E<b.length;E++)v=e(b[E],_,C),v!==void 0?(x=_,_=v):_="";return g&&!_?!1:(!g&&typeof _=="function"&&(h.push(x),_=this.mv(_,h,p),h.pop()),_)},f:function(d,h,p,g){for(var v=!1,b=null,_=!1,C=this.options.modelGet,x=h.length-1;x>=0;x--)if(b=h[x],v=e(d,b,C),v!==void 0){_=!0;break}return _?(!g&&typeof v=="function"&&(v=this.mv(v,h,p)),v):g?!1:""},ls:function(d,h,p,g,v,b){var _=this.options.delimiters;return this.options.delimiters=b,this.b(this.ct(c(d.call(h,v,p)),h,g)),this.options.delimiters=_,!1},ct:functio
Line truncated
|
||||
|
||||
If you're not a developer, report the bug to the developers of the application you're using. If this is a bug in isomorphic-git then you should create a proper bug yourselves. The bug should include a minimal reproduction and details about the version and environment.
|
||||
If you're using an application that depends on isomorphic-git, please report this error to that application's developers.
|
||||
|
||||
Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=t.code,this.data={message:e}}};ue.code="InternalError";var zo=class t extends Ce{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};zo.code="UnsafeFilepathError";var _i=class{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let r=this.buffer.slice(this._start,this._start+e);return this._start+=e,r}toString(e,r){let i=this.buffer.toString(e,this._start,this._start+r);return this._start+=r,i}write(e,r,i){let n=this.buffer.write(e,this._start,r,i);return this._start+=r,n}copy(e,r,i){let n=e.copy(this.buffer,this._start,r,i);return this._start+=n,n}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let r=this.buffer.writeUInt8(e,this._start);return this._start+=1,r}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let r=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,r}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let r=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,r}};function pd(t,e){return-(t<e)||+(t>e)}function kE(t,e){return pd(t.path,e.path)}function AE(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let r=t&511;return r&73?r=493:r=420,e!==8&&(r=0),(e<<12)+r}var gn=2**32;function tE(t,e,r,i){if(t!==void 0&&e!==void 0)return[t,e];r===void 0&&(r=i.valueOf());let n=Math.floor(r/1e3),s=(r-n*1e3)*1e6;return[n,s]}function Wo(t){let[e,r]=tE(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[i,n]=tE(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%gn,ctimeNanoseconds:r%gn,mtimeSeconds:i%gn,mtimeNanoseconds:n%gn,dev:t.dev%gn,ino:t.ino%gn,mode:AE(t.mode%gn),uid:t.uid%gn,gid:t.gid%gn,size:t.size>-1?t.size%gn:0}}function fL(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}var lg=null;async function wn(t){return lg===null&&(lg=await hL()),lg?CE(t):dL(t)}function dL(t){return new SE().update(t).digest("hex")}async function CE(t){let e=await crypto.subtle.digest("SHA-1",t);return fL(e)}async function hL(){try{return await CE(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch(t){}return!1}function pL(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function mL(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(Buffer.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var bg=class t{constructor(e,r){this._dirty=!1,this._unmergedPaths=r||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let r=this._entries.get(e.path);r||(this._entries.set(e.path,e),r=e),r.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(Buffer.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new ue("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new ue("Index file is empty (.git/index)");let r=new t,i=new _i(e),n=i.toString("utf8",4);if(n!=="DIRC")throw new ue(`Invalid dircache magic file number: ${n}`);let s=await wn(e.slice(0,-20)),a=e.slice(-20).toString("hex");if(a!==s)throw new ue(`Invalid checksum in GitIndex buffer: expected ${a} but saw ${s}`);let o=i.readUInt32BE();if(o!==2)throw new ue(`Unsupported dircache version: ${o}`);let l=i.readUInt32BE(),c=0;for(;!i.eof()&&c<l;){let u={};u.ctimeSeconds=i.readUInt32BE(),u.ctimeNanoseconds=i.readUInt32BE(),u.mtimeSeconds=i.readUInt32BE(),u.mtimeNanoseconds=i.readUInt32BE(),u.dev=i.readUInt32BE(),u.ino=i.readUInt32BE(),u.mode=i.readUInt32BE(),u.uid=i.readUInt32BE(),u.gid=i.readUInt32BE(),u.size=i.readUInt32BE(),u.oid=i.slice(20).toString("hex");let f=i.readUInt16BE();u.flags=pL(f);let d=e.indexOf(0,i.tell()+1)-i.tell();if(d<1)throw new ue(`Got a path length of: ${d}`);if(u.path=i.toString("utf8",d),u.path.includes("..\\")||u.path.includes("../"))throw new zo(u.path);let h=8-(i.tell()-12)%8;for(h===0&&(h=8);h--;){let p=i.readUInt8();if(p!==0)throw new ue(`Expected 1-8 null characters but got '${p}' after ${u.path}`);if(i.eof())throw new ue("Unexpected end of file")}u.stages=[],r._addEntry(u),c++}return r}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(kE)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(r=>r):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:r,oid:i,stage:n=0}){r||(r={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid
Line truncated
|
||||
`)}static async _entryToBuffer(e){let r=Buffer.from(e.path),i=Math.ceil((62+r.length+1)/8)*8,n=Buffer.alloc(i),s=new _i(n),a=Wo(e);return s.writeUInt32BE(a.ctimeSeconds),s.writeUInt32BE(a.ctimeNanoseconds),s.writeUInt32BE(a.mtimeSeconds),s.writeUInt32BE(a.mtimeNanoseconds),s.writeUInt32BE(a.dev),s.writeUInt32BE(a.ino),s.writeUInt32BE(a.mode),s.writeUInt32BE(a.uid),s.writeUInt32BE(a.gid),s.writeUInt32BE(a.size),s.write(e.oid,20,"hex"),s.writeUInt16BE(mL(e)),s.write(e.path,r.length,"utf8"),n}async toObject(){let e=Buffer.alloc(12),r=new _i(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let i=[];for(let o of this.entries)if(i.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&i.push(t._entryToBuffer(l));i=await Promise.all(i);let n=Buffer.concat(i),s=Buffer.concat([e,n]),a=await wn(s);return Buffer.concat([s,Buffer.from(a,"hex")])}};function nd(t,e,r=!0,i=!0){let n=Wo(t),s=Wo(e);return r&&n.mode!==s.mode||n.mtimeSeconds!==s.mtimeSeconds||n.ctimeSeconds!==s.ctimeSeconds||n.uid!==s.uid||n.gid!==s.gid||i&&n.ino!==s.ino||n.size!==s.size}var cg=null,ug=Symbol("IndexCache");function gL(){return{map:new Map,stats:new Map}}async function vL(t,e,r){let[i,n]=await Promise.all([t.lstat(e),t.read(e)]),s=await bg.from(n);r.map.set(e,s),r.stats.set(e,i)}async function wL(t,e,r){let i=r.stats.get(e);if(i===void 0)return!0;if(i===null)return!1;let n=await t.lstat(e);return n===null?!1:nd(i,n)}var ft=class{static async acquire({fs:e,gitdir:r,cache:i,allowUnmerged:n=!0},s){i[ug]||(i[ug]=gL());let a=`${r}/index`;cg===null&&(cg=new Mc({maxPending:1/0}));let o,l=[];return await cg.acquire(a,async()=>{let c=i[ug];await wL(e,a,c)&&await vL(e,a,c);let u=c.map.get(a);if(l=u.unmergedPaths,l.length&&!n)throw new Oc(l);if(o=await s(u),u._dirty){let f=await u.toObject();await e.write(a,f),c.stats.set(a,await e.lstat(a)),u._dirty=!1}}),o}};function sd(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function ha(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function TE(t){let e=new Map,r=function(n){if(!e.has(n)){let s={type:"tree",fullpath:n,basename:sd(n),metadata:{},children:[]};e.set(n,s),s.parent=r(ha(n)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(n)},i=function(n,s){if(!e.has(n)){let a={type:"blob",fullpath:n,basename:sd(n),metadata:s,parent:r(ha(n)),children:[]};a.parent&&a.parent.children.push(a),e.set(n,a)}return e.get(n)};r(".");for(let n of t)i(n.path,n);return e}function _L(t){switch(t){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new ue(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var yg=class{constructor({fs:e,gitdir:r,cache:i}){this.treePromise=ft.acquire({fs:e,gitdir:r,cache:i},async function(s){return TE(s.entries)});let n=this;this.ConstructEntry=class{constructor(a){this._fullpath=a,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return n.type(this)}async mode(){return n.mode(this)}async stat(){return n.stat(this)}async content(){return n.content(this)}async oid(){return n.oid(this)}}}async readdir(e){let r=e._fullpath,n=(await this.treePromise).get(r);if(!n||n.type==="blob")return null;if(n.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);let s=n.children.map(a=>a.fullpath);return s.sort(pd),s}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let i=(await this.treePromise).get(e._fullpath);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let n=i.type==="tree"?{}:Wo(i.metadata);e._type=i.type==="tree"?"tree":_L(n.mode),e._mode=n.mode,i.type==="tree"?e._stat=void 0:e._stat=n}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let i=(await this.treePromise).get(e._fullpath);e._oid=i.metadata.oid}return e._oid}},md=Symbol("GitWalkSymbol");function _a(){let t=Object.create(null);return Object.defineProperty(t,md,{value:function({fs:e,gitdir:r,cache:i}){return new yg({fs:e,gitdir:r,cache:i})}}),Object.freeze(t),t}var He=class t extends Ce{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};He.code="NotFoundError";var yr=class t extends Ce{constructor(e,r,i,n){super(`Object ${e} ${n?`at ${n}`:""}was anticipated to be a ${i} but it is a ${r}.`),this.code=this.name=t.code,this.data={oid:e,actual:r,expected:i,filepath:n}}};yr.code="ObjectTypeError";var As=class t extends Ce{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};As.code="InvalidOidError";var Lc=class t extends Ce{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following:
|
||||
If you're a developer and you believe this is a bug in isomorphic-git, please file an issue at https://github.com/isomorphic-git/isomorphic-git/issues with a minimal reproduction, version and environment details, and this error message: ${e}`),this.code=this.name=t.code,this.data={message:e}}};he.code="InternalError";var Ea=class t extends Pe{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};Ea.code="UnsafeFilepathError";var zi=class{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let r=this.buffer.slice(this._start,this._start+e);return this._start+=e,r}toString(e,r){let i=this.buffer.toString(e,this._start,this._start+r);return this._start+=r,i}write(e,r,i){let n=this.buffer.write(e,this._start,r,i);return this._start+=r,n}copy(e,r,i){let n=e.copy(this.buffer,this._start,r,i);return this._start+=n,n}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let r=this.buffer.writeUInt8(e,this._start);return this._start+=1,r}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let r=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,r}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let r=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,r}};function Dd(t,e){return-(t<e)||+(t>e)}function aS(t,e){return Dd(t.path,e.path)}function oS(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let r=t&511;return r&73?r=493:r=420,e!==8&&(r=0),(e<<12)+r}var yn=2**32;function ME(t,e,r,i){if(t!==void 0&&e!==void 0)return[t,e];r===void 0&&(r=i.valueOf());let n=Math.floor(r/1e3),s=(r-n*1e3)*1e6;return[n,s]}function Ko(t){let[e,r]=ME(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[i,n]=ME(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%yn,ctimeNanoseconds:r%yn,mtimeSeconds:i%yn,mtimeNanoseconds:n%yn,dev:t.dev%yn,ino:t.ino%yn,mode:oS(t.mode%yn),uid:t.uid%yn,gid:t.gid%yn,size:t.size>-1?t.size%yn:0}}function BO(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}var Dg=null;async function En(t){return Dg===null&&(Dg=await UO()),Dg?lS(t):HO(t)}function HO(t){return new sv.default().update(t).digest("hex")}async function lS(t){let e=await crypto.subtle.digest("SHA-1",t);return BO(e)}async function UO(){try{return await lS(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch(t){}return!1}function GO(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function jO(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(k.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var qg=class t{constructor(e,r){this._dirty=!1,this._unmergedPaths=r||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let r=this._entries.get(e.path);r||(this._entries.set(e.path,e),r=e),r.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(k.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new he("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new he("Index file is empty (.git/index)");let r=new t,i=new zi(e),n=i.toString("utf8",4);if(n!=="DIRC")throw new he(`Invalid dircache magic file number: ${n}`);let s=await En(e.slice(0,-20)),a=e.slice(-20).toString("hex");if(a!==s)throw new he(`Invalid checksum in GitIndex buffer: expected ${a} but saw ${s}`);let o=i.readUInt32BE();if(o!==2)throw new he(`Unsupported dircache version: ${o}`);let l=i.readUInt32BE(),c=0;for(;!i.eof()&&c<l;){let u={};u.ctimeSeconds=i.readUInt32BE(),u.ctimeNanoseconds=i.readUInt32BE(),u.mtimeSeconds=i.readUInt32BE(),u.mtimeNanoseconds=i.readUInt32BE(),u.dev=i.readUInt32BE(),u.ino=i.readUInt32BE(),u.mode=i.readUInt32BE(),u.uid=i.readUInt32BE(),u.gid=i.readUInt32BE(),u.size=i.readUInt32BE(),u.oid=i.slice(20).toString("hex");let f=i.readUInt16BE();u.flags=GO(f);let d=e.indexOf(0,i.tell()+1)-i.tell();if(d<1)throw new he(`Got a path length of: ${d}`);if(u.path=i.toString("utf8",d),u.path.includes("..\\")||u.path.includes("../"))throw new Ea(u.path);let h=8-(i.tell()-12)%8;for(h===0&&(h=8);h--;){let p=i.readUInt8();if(p!==0)throw new he(`Expected 1-8 null characters but got '${p}' after ${u.path}`);if(i.eof())throw new he("Unexpected end of file")}u.stages=[],r._addEntry(u),c++}return r}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(aS)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(r=>r):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath
Line truncated
|
||||
`)}static async _entryToBuffer(e){let r=k.from(e.path),i=Math.ceil((62+r.length+1)/8)*8,n=k.alloc(i),s=new zi(n),a=Ko(e);return s.writeUInt32BE(a.ctimeSeconds),s.writeUInt32BE(a.ctimeNanoseconds),s.writeUInt32BE(a.mtimeSeconds),s.writeUInt32BE(a.mtimeNanoseconds),s.writeUInt32BE(a.dev),s.writeUInt32BE(a.ino),s.writeUInt32BE(a.mode),s.writeUInt32BE(a.uid),s.writeUInt32BE(a.gid),s.writeUInt32BE(a.size),s.write(e.oid,20,"hex"),s.writeUInt16BE(jO(e)),s.write(e.path,r.length,"utf8"),n}async toObject(){let e=k.alloc(12),r=new zi(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let i=[];for(let o of this.entries)if(i.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&i.push(t._entryToBuffer(l));i=await Promise.all(i);let n=k.concat(i),s=k.concat([e,n]),a=await En(s);return k.concat([s,k.from(a,"hex")])}};function Ed(t,e,r=!0,i=!0){let n=Ko(t),s=Ko(e);return r&&n.mode!==s.mode||n.mtimeSeconds!==s.mtimeSeconds||n.ctimeSeconds!==s.ctimeSeconds||n.uid!==s.uid||n.gid!==s.gid||i&&n.ino!==s.ino||n.size!==s.size}var Og=null,Lg=Symbol("IndexCache");function VO(){return{map:new Map,stats:new Map}}async function zO(t,e,r){let[i,n]=await Promise.all([t.lstat(e),t.read(e)]),s=await qg.from(n);r.map.set(e,s),r.stats.set(e,i)}async function WO(t,e,r){let i=r.stats.get(e);if(i===void 0)return!0;if(i===null)return!1;let n=await t.lstat(e);return n===null?!1:Ed(i,n)}var gt=class{static async acquire({fs:e,gitdir:r,cache:i,allowUnmerged:n=!0},s){i[Lg]||(i[Lg]=VO());let a=`${r}/index`;Og===null&&(Og=new Yo.default({maxPending:1/0}));let o,l=[];return await Og.acquire(a,async()=>{let c=i[Lg];await WO(e,a,c)&&await zO(e,a,c);let u=c.map.get(a);if(l=u.unmergedPaths,l.length&&!n)throw new zc(l);if(o=await s(u),u._dirty){let f=await u.toObject();await e.write(a,f),c.stats.set(a,await e.lstat(a)),u._dirty=!1}}),o}};function Sd(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function Sa(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function cS(t){let e=new Map,r=function(n){if(!e.has(n)){let s={type:"tree",fullpath:n,basename:Sd(n),metadata:{},children:[]};e.set(n,s),s.parent=r(Sa(n)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(n)},i=function(n,s){if(!e.has(n)){let a={type:"blob",fullpath:n,basename:Sd(n),metadata:s,parent:r(Sa(n)),children:[]};a.parent&&a.parent.children.push(a),e.set(n,a)}return e.get(n)};r(".");for(let n of t)i(n.path,n);return e}function qO(t){switch(t){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new he(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var Yg=class{constructor({fs:e,gitdir:r,cache:i}){this.treePromise=gt.acquire({fs:e,gitdir:r,cache:i},async function(s){return cS(s.entries)});let n=this;this.ConstructEntry=class{constructor(a){this._fullpath=a,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return n.type(this)}async mode(){return n.mode(this)}async stat(){return n.stat(this)}async content(){return n.content(this)}async oid(){return n.oid(this)}}}async readdir(e){let r=e._fullpath,n=(await this.treePromise).get(r);if(!n||n.type==="blob")return null;if(n.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);let s=n.children.map(a=>a.fullpath);return s.sort(Dd),s}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let i=(await this.treePromise).get(e._fullpath);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let n=i.type==="tree"?{}:Ko(i.metadata);e._type=i.type==="tree"?"tree":qO(n.mode),e._mode=n.mode,i.type==="tree"?e._stat=void 0:e._stat=n}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let i=(await this.treePromise).get(e._fullpath);e._oid=i.metadata.oid}return e._oid}},Od=Symbol("GitWalkSymbol");function sl(){let t=Object.create(null);return Object.defineProperty(t,Od,{value:function({fs:e,gitdir:r,cache:i}){return new Yg({fs:e,gitdir:r,cache:i})}}),Object.freeze(t),t}var ze=class t extends Pe{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};ze.code="NotFoundError";var xr=class t extends Pe{constructor(e,r,i,n){super(`Object ${e} ${n?`at ${n}`:""}was anticipated to be a ${i} but it is a ${r}.`),this.code=this.name=t.code,this.data={oid:e,actual:r,expected:i,filepath:n}}};xr.code="ObjectTypeError";var Ms=class t extends Pe{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};Ms.code="InvalidOidError";var Wc=class t extends Pe{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following:
|
||||
[remote "${e}"]
|
||||
fetch = +refs/heads/*:refs/remotes/origin/*
|
||||
`),this.code=this.name=t.code,this.data={remote:e}}};Lc.code="NoRefspecError";var ad=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(`
|
||||
`),this.code=this.name=t.code,this.data={remote:e}}};Wc.code="NoRefspecError";var kd=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(`
|
||||
`).map(i=>{if(/^\s*#/.test(i))return{line:i,comment:!0};let n=i.indexOf(" ");if(i.startsWith("^")){let s=i.slice(1);return this.refs.set(r+"^{}",s),{line:i,ref:r,peeled:s}}else{let s=i.slice(0,n);return r=i.slice(n+1),this.refs.set(r,s),{line:i,ref:r,oid:s}}})}return this}static from(e){return new t(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(r=>r.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(`
|
||||
`)+`
|
||||
`}},od=class t{constructor({remotePath:e,localPath:r,force:i,matchPrefix:n}){Object.assign(this,{remotePath:e,localPath:r,force:i,matchPrefix:n})}static from(e){let[r,i,n,s,a]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=r==="+",l=n==="*";if(l!==(a==="*"))throw new ue("Invalid refspec");return new t({remotePath:i,localPath:s,force:o,matchPrefix:l})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,"")}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,"")}else if(e===this.localPath)return this.remotePath;return null}},xg=class t{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let i of e)r.push(od.from(i));return new t(r)}add(e){let r=od.from(e);this.rules.push(r)}translate(e){let r=[];for(let i of this.rules)for(let n of e){let s=i.translate(n);s&&r.push([n,s])}return r}translateOne(e){let r=null;for(let i of this.rules){let n=i.translate(e);n&&(r=n)}return r}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function bL(t,e){let r=t.replace(/\^\{\}$/,""),i=e.replace(/\^\{\}$/,""),n=-(r<i)||+(r>i);return n===0?t.endsWith("^{}")?1:-1:n}function yL(t,e){let r="",i=0,n=-1,s=0,a="\0";for(let o=0;o<=t.length;++o){if(o<t.length)a=t[o];else{if(a==="/")break;a="/"}if(a==="/"){if(!(n===o-1||s===1))if(s===2){if(r.length<2||i!==2||r.at(-1)!=="."||r.at(-2)!=="."){if(r.length>2){let l=r.lastIndexOf("/");l===-1?(r="",i=0):(r=r.slice(0,l),i=r.length-1-r.lastIndexOf("/")),n=o,s=0;continue}else if(r.length!==0){r="",i=0,n=o,s=0;continue}}e&&(r+=r.length>0?"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(n+1,o):r=t.slice(n+1,o),i=o-n-1;n=o,s=0}else a==="."&&s!==-1?++s:s=-1}return r}function xL(t){if(!t.length)return".";let e=t[0]==="/",r=t.at(-1)==="/";return t=yL(t,!e),t.length?(r&&(t+="/"),e?`/${t}`:t):e?"/":r?"./":"."}function O(...t){if(t.length===0)return".";let e;for(let r=0;r<t.length;++r){let i=t[r];i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":xL(e)}var EL=t=>{if(typeof t=="number")return t;t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1024*1024),t.endsWith("g")&&(e*=1024*1024*1024),e},Ic=t=>{if(typeof t=="boolean")return t;if(t=t.trim().toLowerCase(),t==="true"||t==="yes"||t==="on")return!0;if(t==="false"||t==="no"||t==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},rE={core:{filemode:Ic,bare:Ic,logallrefupdates:Ic,symlinks:Ic,ignorecase:Ic,bigFileThreshold:EL}},SL=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,kL=/^[A-Za-z0-9-.]+$/,AL=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,CL=/^[A-Za-z][A-Za-z-]*$/,TL=/^(.*?)( *[#;].*)$/,PL=t=>{let e=SL.exec(t);if(e!=null){let[r,i]=e.slice(1);return[r,i]}return null},RL=t=>{let e=AL.exec(t);if(e!=null){let[r,i="true"]=e.slice(1),n=$L(i),s=FL(n);return[r,s]}return null},$L=t=>{let e=TL.exec(t);if(e==null)return t;let[r,i]=e.slice(1);return iE(r)&&iE(i)?`${r}${i}`:r},iE=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,FL=t=>t.split("").reduce((e,r,i,n)=>{let s=r==='"'&&n[i-1]!=="\\",a=r==="\\"&&n[i+1]==='"';return s||a?e:e+r},""),nE=t=>t!=null?t.toLowerCase():null,Eg=(t,e,r)=>[nE(t),e,nE(r)].filter(i=>i!=null).join("."),sE=t=>{let e=t.split("."),r=e.shift(),i=e.pop(),n=e.length?e.join("."):void 0;return{section:r,subsection:n,name:i,path:Eg(r,n,i),sectionPath:Eg(r,n,null),isSection:!!r}},IL=(t,e)=>t.reduce((r,i,n)=>e(i)?n:r,-1),Sg=class t{constructor(e){let r=null,i=null;this.parsedConfig=e?e.split(`
|
||||
`).map(n=>{let s=null,a=null,o=n.trim(),l=PL(o),c=l!=null;if(c)[r,i]=l;else{let f=RL(o);f!=null&&([s,a]=f)}let u=Eg(r,i,s);return{line:n,isSection:c,section:r,subsection:i,name:s,value:a,path:u}}):[]}static from(e){return new t(e)}async get(e,r=!1){let i=sE(e).path,n=this.parsedConfig.filter(s=>s.path===i).map(({section:s,name:a,value:o})=>{let l=rE[s]&&rE[s][a];return l?l(o):o});return r?n:n.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(r=>r.isSection&&r.section===e).map(r=>r.subsection)}async deleteSection(e,r){this.parsedConfig=this.parsedConfig.filter(i=>!(i.section===e&&i.subsection===r))}async append(e,r){return this.set(e,r,!0)}async set(e,r,i=!1){let{section:n,subsection:s,name:a,path:o,sectionPath:l,isSection:c}=sE(e),u=IL(this.parsedConfig,f=>f.path===o);if(r==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let f=this.parsedConfig[u],d=Object.assign({},f,{name:a,value:r,modified:!0});i?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let f=this.parsedConfig.findIndex(h=>h.path===l),d={section:n,subsection:s,name:a,value:r,modified:!0,path:o};if(kL.test(n)&&CL.test(a))if(f>=0)this.parsedConfig.splice(f+1,0,d);else{let h={isSection:c,section:n,subsection:s,modified:!0,path:l};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,section:r,subsection:i,name:n,value:s,modified:a=!1})=>a?n!=null&&s!=null?typeof s=="string"&&/[#;]/.test(s)?` ${n} = "${s}"`:` ${n} = ${s}`:i!=null?`[${r} "${i}"]`:`[${r}]`:e).join(`
|
||||
`)}},dt=class{static async get({fs:e,gitdir:r}){let i=await e.read(`${r}/config`,{encoding:"utf8"});return Sg.from(i)}static async save({fs:e,gitdir:r,config:i}){await e.write(`${r}/config`,i.toString(),{encoding:"utf8"})}},rd=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],ML=["config","description","index","shallow","commondir"],fg;async function Ss(t,e){return fg===void 0&&(fg=new Mc),fg.acquire(t,e)}var W=class t{static async updateRemoteRefs({fs:e,gitdir:r,remote:i,refs:n,symrefs:s,tags:a,refspecs:o=void 0,prune:l=!1,pruneTags:c=!1}){for(let v of n.values())if(!v.match(/[0-9a-f]{40}/))throw new As(v);let u=await dt.get({fs:e,gitdir:r});if(!o){if(o=await u.getall(`remote.${i}.fetch`),o.length===0)throw new Lc(i);o.unshift(`+HEAD:refs/remotes/${i}/HEAD`)}let f=xg.from(o),d=new Map;if(c){let v=await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:r,refs:v.map(_=>`refs/tags/${_}`)})}if(a){for(let v of n.keys())if(v.startsWith("refs/tags")&&!v.endsWith("^{}")&&!await t.exists({fs:e,gitdir:r,ref:v})){let _=n.get(v);d.set(v,_)}}let h=f.translate([...n.keys()]);for(let[v,_]of h){let b=n.get(v);d.set(_,b)}let p=f.translate([...s.keys()]);for(let[v,_]of p){let b=s.get(v),S=f.translateOne(b);S&&d.set(_,`ref: ${S}`)}let g=[];if(l){for(let v of f.localNamespaces()){let _=(await t.listRefs({fs:e,gitdir:r,filepath:v})).map(b=>`${v}/${b}`);for(let b of _)d.has(b)||g.push(b)}g.length>0&&await t.deleteRefs({fs:e,gitdir:r,refs:g})}for(let[v,_]of d)await Ss(v,async()=>e.write(O(r,v),`${_.trim()}
|
||||
`,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:r,ref:i,value:n}){if(!n.match(/[0-9a-f]{40}/))throw new As(n);await Ss(i,async()=>e.write(O(r,i),`${n.trim()}
|
||||
`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:i,value:n}){await Ss(i,async()=>e.write(O(r,i),`ref: ${n.trim()}
|
||||
`,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:i}){return t.deleteRefs({fs:e,gitdir:r,refs:[i]})}static async deleteRefs({fs:e,gitdir:r,refs:i}){await Promise.all(i.map(o=>e.rm(O(r,o))));let n=await Ss("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),s=ad.from(n),a=s.refs.size;for(let o of i)s.refs.has(o)&&s.delete(o);s.refs.size<a&&(n=s.toString(),await Ss("packed-refs",async()=>e.write(`${r}/packed-refs`,n,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:r,ref:i,depth:n=void 0}){if(n!==void 0&&(n--,n===-1))return i;if(i.startsWith("ref: "))return i=i.slice(5),t.resolve({fs:e,gitdir:r,ref:i,depth:n});if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let s=await t.packedRefs({fs:e,gitdir:r}),a=rd(i).filter(o=>!ML.includes(o));for(let o of a){let l=await Ss(o,async()=>await e.read(`${r}/${o}`,{encoding:"utf8"})||s.get(o));if(l)return t.resolve({fs:e,gitdir:r,ref:l.trim(),depth:n})}throw new He(i)}static async exists({fs:e,gitdir:r,ref:i}){try{return await t.expand({fs:e,gitdir:r,ref:i}),!0}catch(n){return!1}}static async expand({fs:e,gitdir:r,ref:i}){if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let n=await t.packedRefs({fs:e,gitdir:r}),s=rd(i);for(let a of s)if(await Ss(a,async()=>e.exists(`${r}/${a}`))||n.has(a))return a;throw new He(i)}static async expandAgainstMap({ref:e,map:r}){let i=rd(e);for(let n of i)if(await r.has(n))return n;throw new He(e)}static resolveAgainstMap({ref:e,fullref:r=e,depth:i=void 0,map:n}){if(i!==void 0&&(i--,i===-1))return{fullref:r,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:r,depth:i,map:n});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:r,oid:e};let s=rd(e);for(let a of s){let o=n.get(a);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:a,depth:i,map:n})}throw new He(e)}static async packedRefs({fs:e,gitdir:r}){let i=await Ss("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return ad.from(i).refs}static async listRefs({fs:e,gitdir:r,filepath:i}){let n=t.packedRefs({fs:e,gitdir:r}),s=null;try{s=await e.readdirDeep(`${r}/${i}`),s=s.map(a=>a.replace(`${r}/${i}/`,""))}catch(a){s=[]}for(let a of(await n).keys())a.startsWith(i)&&(a=a.replace(i+"/",""),s.includes(a)||s.push(a));return s.sort(bL),s}static async listBranches({fs:e,gitdir:r,remote:i}){return i?t.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${i}`}):t.listRefs({fs:e,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:r}){return(await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"})).filter(n=>!n.endsWith("^{}"))}};function DL(t,e){return pd(aE(t),aE(e))}function aE(t){return t.mode==="040000"?t.path+"/":t.path}function PE(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new ue(`Unexpected GitTree entry mode: ${t}`)}function OL(t){let e=[],r=0;for(;r<t.length;){let i=t.indexOf(32,r);if(i===-1)throw new ue(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next space character.`);let n=t.indexOf(0,r);if(n===-1)throw new ue(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next null character.`);let s=t.slice(r,i).toString("utf8");s==="40000"&&(s="040000");let a=PE(s),o=t.slice(i+1,n).toString("utf8");if(o.includes("\\")||o.includes("/"))throw new zo(o);let l=t.slice(n+1,n+21).toString("hex");r=n+21,e.push({mode:s,path:o,oid:l,type:a})}return e}function LL(t){if(typeof t=="number"&&(t=t.toString(8)),t.match(/^0?4.*/))return"040000";if(t.match(/^1006.*/))return"100644";if(t.match(/^1007.*/))return"100755";if(t.match(/^120.*/))return"120000";if(t.match(/^160.*/))return"160000";throw new ue(`Could not understand file mode: ${t}`)}function NL(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=LL(t.mode),t.type||(t.type=PE(t.mode)),t}var Ir=class t{constructor(e){if(Buffer.isBuffer(e))this._entries=OL(e);else if(Array.isArray(e))this._entries=e.map(NL);else throw new ue("invalid type passed to GitTree constructor");this._entries.sort(kE)}static from(e){return new t(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
|
||||
`)}toObject(){let e=[...this._entries];return e.sort(DL),Buffer.concat(e.map(r=>{let i=Buffer.from(r.mode.replace(/^0/,"")),n=Buffer.from(" "),s=Buffer.from(r.path,"utf8"),a=Buffer.from([0]),o=Buffer.from(r.oid,"hex");return Buffer.concat([i,n,s,a,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},Cs=class{static wrap({type:e,object:r}){let i=`${e} ${r.length}\0`,n=i.length,s=n+r.length,a=new Uint8Array(s);for(let o=0;o<n;o++)a[o]=i.charCodeAt(o);return a.set(r,n),a}static unwrap(e){let r=e.indexOf(32),i=e.indexOf(0),n=e.slice(0,r).toString("utf8"),s=e.slice(r+1,i).toString("utf8"),a=e.length-(i+1);if(parseInt(s)!==a)throw new ue(`Length mismatch: expected ${s} bytes but got ${a} instead.`);return{type:n,object:Buffer.from(e.slice(i+1))}}};async function RE({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`,n=await t.read(`${e}/${i}`);return n?{object:n,format:"deflated",source:i}:null}function BL(t,e){let r=new _i(t),i=oE(r);if(i!==e.byteLength)throw new ue(`applyDelta expected source buffer to be ${i} bytes but the provided buffer was ${e.length} bytes`);let n=oE(r),s,a=cE(r,e);if(a.byteLength===n)s=a;else{s=Buffer.alloc(n);let o=new _i(s);for(o.copy(a);!r.eof();)o.copy(cE(r,e));let l=o.tell();if(n!==l)throw new ue(`applyDelta expected target buffer to be ${n} bytes but the resulting buffer was ${l} bytes`)}return s}function oE(t){let e=0,r=0,i=null;do i=t.readUInt8(),e|=(i&127)<<r,r+=7;while(i&128);return e}function lE(t,e,r){let i=0,n=0;for(;r--;)e&1&&(i|=t.readUInt8()<<n),e>>=1,n+=8;return i}function cE(t,e){let r=t.readUInt8(),i=128,n=15,s=112;if(r&i){let a=lE(t,r&n,4),o=lE(t,(r&s)>>4,3);return o===0&&(o=65536),e.slice(a,a+o)}else return t.slice(r)}function HL(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function $E(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:HL(t)}var ld=class{constructor(e){if(typeof Buffer=="undefined")throw new Error("Missing Buffer dependency");this.stream=$E(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:r}=await this.stream.next();return e&&(this._ended=!0,!r)?Buffer.alloc(0):(r&&(r=Buffer.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let r=[this.buffer];for(;this.cursor+e>UL(r);){let i=await this._next();if(this._ended)break;r.push(i)}this.buffer=Buffer.concat(r)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function UL(t){return t.reduce((e,r)=>e+r.length,0)}async function GL(t,e){let r=new ld(t),i=await r.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new ue(`Invalid PACK header '${i}'`);let n=await r.read(4);if(n=n.readUInt32BE(0),n!==2)throw new ue(`Invalid packfile version: ${n}`);let s=await r.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!r.eof()&&s--;){let a=r.tell(),{type:o,length:l,ofs:c,reference:u}=await jL(r),f=new Fg.Inflate;for(;!f.result;){let d=await r.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new ue(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new ue("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-f.strm.avail_in);let h=r.tell();await e({data:f.result,type:o,num:s,offset:a,end:h,reference:u,ofs:c})}}}}async function jL(t){let e=await t.byte(),r=e>>4&7,i=e&15;if(e&128){let a=4;do e=await t.byte(),i|=(e&127)<<a,a+=7;while(e&128)}let n,s;if(r===6){let a=0;n=0;let o=[];do e=await t.byte(),n|=(e&127)<<a,a+=7,o.push(e);while(e&128);s=Buffer.fro
Line truncated
|
||||
`,t}function cd(t){let[,e,r,i,n]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(i),timezoneOffset:JL(n)}}function JL(t){let[,e,r,i]=t.match(/(\+|-)(\d\d)(\d\d)/);return i=(e==="+"?1:-1)*(Number(r)*60+Number(i)),eN(i)}function eN(t){return t===0?t:-t}var Kr=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(Buffer.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new ue("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new t(e)}static render(e){return`object ${e.object}
|
||||
`}},Cd=class t{constructor({remotePath:e,localPath:r,force:i,matchPrefix:n}){Object.assign(this,{remotePath:e,localPath:r,force:i,matchPrefix:n})}static from(e){let[r,i,n,s,a]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=r==="+",l=n==="*";if(l!==(a==="*"))throw new he("Invalid refspec");return new t({remotePath:i,localPath:s,force:o,matchPrefix:l})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,"")}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,"")}else if(e===this.localPath)return this.remotePath;return null}},Zg=class t{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let i of e)r.push(Cd.from(i));return new t(r)}add(e){let r=Cd.from(e);this.rules.push(r)}translate(e){let r=[];for(let i of this.rules)for(let n of e){let s=i.translate(n);s&&r.push([n,s])}return r}translateOne(e){let r=null;for(let i of this.rules){let n=i.translate(e);n&&(r=n)}return r}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function YO(t,e){let r=t.replace(/\^\{\}$/,""),i=e.replace(/\^\{\}$/,""),n=-(r<i)||+(r>i);return n===0?t.endsWith("^{}")?1:-1:n}function ZO(t,e){let r="",i=0,n=-1,s=0,a="\0";for(let o=0;o<=t.length;++o){if(o<t.length)a=t[o];else{if(a==="/")break;a="/"}if(a==="/"){if(!(n===o-1||s===1))if(s===2){if(r.length<2||i!==2||r.at(-1)!=="."||r.at(-2)!=="."){if(r.length>2){let l=r.lastIndexOf("/");l===-1?(r="",i=0):(r=r.slice(0,l),i=r.length-1-r.lastIndexOf("/")),n=o,s=0;continue}else if(r.length!==0){r="",i=0,n=o,s=0;continue}}e&&(r+=r.length>0?"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(n+1,o):r=t.slice(n+1,o),i=o-n-1;n=o,s=0}else a==="."&&s!==-1?++s:s=-1}return r}function KO(t){return t.length>=2&&/^[a-zA-Z]:/.test(t)?t.slice(0,2):null}function XO(t){if(!t.length)return".";t=t.replace(/\\/g,"/");let e=KO(t),r=t[0]==="/"||e!==null&&t[2]==="/",i=t.at(-1)==="/",n=e?t.slice(2):t,s=ZO(n,!r);if(!s.length){let a=e?r?e+"/":e:r?"/":".";return i&&!r?a+"/":a}return i&&(s+="/"),e?r?`${e}/${s}`:`${e}${s}`:r?`/${s}`:s}function N(...t){if(t.length===0)return".";let e;for(let r=0;r<t.length;++r){let i=t[r].replace(/\\/g,"/");i.length!==0&&(/^[a-zA-Z]:\//.test(i)||e===void 0?e=i:e+="/"+i)}return e===void 0?".":XO(e)}var QO=t=>{if(typeof t=="number")return t;t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1024*1024),t.endsWith("g")&&(e*=1024*1024*1024),e},jc=t=>{if(typeof t=="boolean")return t;if(t=t.trim().toLowerCase(),t==="true"||t==="yes"||t==="on")return!0;if(t==="false"||t==="no"||t==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},DE={core:{filemode:jc,bare:jc,logallrefupdates:jc,symlinks:jc,ignorecase:jc,bigFileThreshold:QO}},JO=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,eL=/^[A-Za-z0-9-.]+$/,tL=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,rL=/^[A-Za-z][A-Za-z-]*$/,iL=/^(.*?)( *[#;].*)$/,nL=t=>{let e=JO.exec(t);if(e!=null){let[r,i]=e.slice(1);return[r,i]}return null},sL=t=>{let e=tL.exec(t);if(e!=null){let[r,i="true"]=e.slice(1),n=aL(i),s=oL(n);return[r,s]}return null},aL=t=>{let e=iL.exec(t);if(e==null)return t;let[r,i]=e.slice(1);return OE(r)&&OE(i)?`${r}${i}`:r},OE=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,oL=t=>t.split("").reduce((e,r,i,n)=>{let s=r==='"'&&n[i-1]!=="\\",a=r==="\\"&&n[i+1]==='"';return s||a?e:e+r},""),LE=t=>t!=null?t.toLowerCase():null,Kg=(t,e,r)=>[LE(t),e,LE(r)].filter(i=>i!=null).join("."),NE=t=>{let e=t.split("."),r=e.shift(),i=e.pop(),n=e.length?e.join("."):void 0;return{section:r,subsection:n,name:i,path:Kg(r,n,i),sectionPath:Kg(r,n,null),isSection:!!r}},lL=(t,e)=>t.reduce((r,i,n)=>e(i)?n:r,-1),Xg=class t{constructor(e){let r=null,i=null;this.parsedConfig=e?e.split(`
|
||||
`).map(n=>{let s=null,a=null,o=n.trim(),l=nL(o),c=l!=null;if(c)[r,i]=l;else{let f=sL(o);f!=null&&([s,a]=f)}let u=Kg(r,i,s);return{line:n,isSection:c,section:r,subsection:i,name:s,value:a,path:u}}):[]}static from(e){return new t(e)}async get(e,r=!1){let i=NE(e).path,n=this.parsedConfig.filter(s=>s.path===i).map(({section:s,name:a,value:o})=>{let l=DE[s]&&DE[s][a];return l?l(o):o});return r?n:n.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(r=>r.isSection&&r.section===e).map(r=>r.subsection)}async deleteSection(e,r){this.parsedConfig=this.parsedConfig.filter(i=>!(i.section===e&&i.subsection===r))}async append(e,r){return this.set(e,r,!0)}async set(e,r,i=!1){let{section:n,subsection:s,name:a,path:o,sectionPath:l,isSection:c}=NE(e),u=lL(this.parsedConfig,f=>f.path===o);if(r==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let f=this.parsedConfig[u],d=Object.assign({},f,{name:a,value:r,modified:!0});i?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let f=this.parsedConfig.findIndex(h=>h.path===l),d={section:n,subsection:s,name:a,value:r,modified:!0,path:o};if(eL.test(n)&&rL.test(a))if(f>=0)this.parsedConfig.splice(f+1,0,d);else{let h={isSection:c,section:n,subsection:s,modified:!0,path:l};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,section:r,subsection:i,name:n,value:s,modified:a=!1})=>a?n!=null&&s!=null?typeof s=="string"&&/[#;]/.test(s)?` ${n} = "${s}"`:` ${n} = ${s}`:i!=null?`[${r} "${i}"]`:`[${r}]`:e).join(`
|
||||
`)}},vt=class{static async get({fs:e,gitdir:r}){let i=await e.read(`${r}/config`,{encoding:"utf8"});return Xg.from(i)}static async save({fs:e,gitdir:r,config:i}){await e.write(`${r}/config`,i.toString(),{encoding:"utf8"})}},yd=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],cL=["config","description","index","shallow","commondir"],Ng;async function Fs(t,e){return Ng===void 0&&(Ng=new Yo.default),Ng.acquire(t,e)}var q=class t{static async updateRemoteRefs({fs:e,gitdir:r,remote:i,refs:n,symrefs:s,tags:a,refspecs:o=void 0,prune:l=!1,pruneTags:c=!1}){for(let v of n.values())if(!v.match(/[0-9a-f]{40}/))throw new Ms(v);let u=await vt.get({fs:e,gitdir:r});if(!o){if(o=await u.getall(`remote.${i}.fetch`),o.length===0)throw new Wc(i);o.unshift(`+HEAD:refs/remotes/${i}/HEAD`)}let f=Zg.from(o),d=new Map;if(c){let v=await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:r,refs:v.map(b=>`refs/tags/${b}`)})}if(a){for(let v of n.keys())if(v.startsWith("refs/tags")&&!v.endsWith("^{}")&&!await t.exists({fs:e,gitdir:r,ref:v})){let b=n.get(v);d.set(v,b)}}let h=f.translate([...n.keys()]);for(let[v,b]of h){let _=n.get(v);d.set(b,_)}let p=f.translate([...s.keys()]);for(let[v,b]of p){let _=s.get(v),C=f.translateOne(_);C&&d.set(b,`ref: ${C}`)}let g=[];if(l){for(let v of f.localNamespaces()){let b=(await t.listRefs({fs:e,gitdir:r,filepath:v})).map(_=>`${v}/${_}`);for(let _ of b)d.has(_)||g.push(_)}g.length>0&&await t.deleteRefs({fs:e,gitdir:r,refs:g})}for(let[v,b]of d)await Fs(v,async()=>e.write(N(r,v),`${b.trim()}
|
||||
`,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:r,ref:i,value:n}){if(!n.match(/[0-9a-f]{40}/))throw new Ms(n);await Fs(i,async()=>e.write(N(r,i),`${n.trim()}
|
||||
`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:i,value:n}){await Fs(i,async()=>e.write(N(r,i),`ref: ${n.trim()}
|
||||
`,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:i}){return t.deleteRefs({fs:e,gitdir:r,refs:[i]})}static async deleteRefs({fs:e,gitdir:r,refs:i}){await Promise.all(i.map(o=>e.rm(N(r,o))));let n=await Fs("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),s=kd.from(n),a=s.refs.size;for(let o of i)s.refs.has(o)&&s.delete(o);s.refs.size<a&&(n=s.toString(),await Fs("packed-refs",async()=>e.write(`${r}/packed-refs`,n,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:r,ref:i,depth:n=void 0,visited:s=new Set}){if(n!==void 0&&(n--,n===-1))return i;if(i.startsWith("ref: "))return i=i.slice(5),t.resolve({fs:e,gitdir:r,ref:i,depth:n,visited:s});if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let a=await t.packedRefs({fs:e,gitdir:r}),o=yd(i).filter(l=>!cL.includes(l));for(let l of o){let c=await Fs(l,async()=>await e.read(`${r}/${l}`,{encoding:"utf8"})||a.get(l));if(c){if(s.has(l))throw new he(`Circular reference detected while resolving ref "${l}"`);return s.add(l),t.resolve({fs:e,gitdir:r,ref:c.trim(),depth:n,visited:s})}}throw new ze(i)}static async exists({fs:e,gitdir:r,ref:i}){try{return await t.expand({fs:e,gitdir:r,ref:i}),!0}catch(n){return!1}}static async expand({fs:e,gitdir:r,ref:i}){if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let n=await t.packedRefs({fs:e,gitdir:r}),s=yd(i);for(let a of s)if(await Fs(a,async()=>e.exists(`${r}/${a}`))||n.has(a))return a;throw new ze(i)}static async expandAgainstMap({ref:e,map:r}){let i=yd(e);for(let n of i)if(await r.has(n))return n;throw new ze(e)}static resolveAgainstMap({ref:e,fullref:r=e,depth:i=void 0,map:n}){if(i!==void 0&&(i--,i===-1))return{fullref:r,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:r,depth:i,map:n});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:r,oid:e};let s=yd(e);for(let a of s){let o=n.get(a);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:a,depth:i,map:n})}throw new ze(e)}static async packedRefs({fs:e,gitdir:r}){let i=await Fs("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return kd.from(i).refs}static async listRefs({fs:e,gitdir:r,filepath:i}){let n=t.packedRefs({fs:e,gitdir:r}),s=null;try{s=await e.readdirDeep(`${r}/${i}`),s=s.map(a=>a.replace(`${r}/${i}/`,""))}catch(a){s=[]}for(let a of(await n).keys())a.startsWith(i)&&(a=a.replace(i+"/",""),s.includes(a)||s.push(a));return s.sort(YO),s}static async listBranches({fs:e,gitdir:r,remote:i}){return i?t.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${i}`}):t.listRefs({fs:e,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:r}){return(await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"})).filter(n=>!n.endsWith("^{}"))}};function uL(t,e){return Dd(BE(t),BE(e))}function BE(t){return t.mode==="040000"?t.path+"/":t.path}function uS(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new he(`Unexpected GitTree entry mode: ${t}`)}function fL(t){let e=[],r=0;for(;r<t.length;){let i=t.indexOf(32,r);if(i===-1)throw new he(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next space character.`);let n=t.indexOf(0,r);if(n===-1)throw new he(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next null character.`);let s=t.slice(r,i).toString("utf8");s==="40000"&&(s="040000");let a=uS(s),o=t.slice(i+1,n).toString("utf8"),l=o.replace(/[\u200C-\u200F\u202A-\u202E\u206A-\u206F\uFEFF]/g,""),u=l.split(":")[0].toLowerCase().replace(/[. ]+$/,"");if(o.includes("\\")||o.includes("/")||l==="."||l===".."||u===".git"||/^\.?git~[1-9]$/.test(u))throw new Ea(o);let f=t.slice(n+1,n+21).toString("hex");r=n+21,e.push({mode:s,path:o,oid:f,type:a})}return e}function dL(t){if(typeof t=="number"&&(t=t.toString(8)),t.match(/^0?4.*/))return"040000";if(t.match(/^1006.*/))return"100644";if(t.match(/^1007.*/))return"100755";if(t.match(/^120.*/))return"120000";if(t.match(/^160.*/))return"160000";throw new he(`Could not understand file mode: ${t}`)}function hL(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=dL(t.mode),t.type||(t.type=uS(t.mode)),t}var Lr=class t{constructor(e){if(k.isBuffer(e))this._entries=fL(e);else if(Array.isArray(e))this._entries=e.map(hL);else throw new he("invalid type passed to GitTree constructor");this._entries.sort(aS)}static from(e){return new t(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
|
||||
`)}toObject(){let e=[...this._entries];return e.sort(uL),k.concat(e.map(r=>{let i=k.from(r.mode.replace(/^0/,"")),n=k.from(" "),s=k.from(r.path,"utf8"),a=k.from([0]),o=k.from(r.oid,"hex");return k.concat([i,n,s,a,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},Ds=class{static wrap({type:e,object:r}){let i=`${e} ${r.length}\0`,n=i.length,s=n+r.length,a=new Uint8Array(s);for(let o=0;o<n;o++)a[o]=i.charCodeAt(o);return a.set(r,n),a}static unwrap(e){let r=e.indexOf(32),i=e.indexOf(0),n=e.slice(0,r).toString("utf8"),s=e.slice(r+1,i).toString("utf8"),a=e.length-(i+1);if(parseInt(s)!==a)throw new he(`Length mismatch: expected ${s} bytes but got ${a} instead.`);return{type:n,object:k.from(e.slice(i+1))}}};async function fS({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`,n=await t.read(`${e}/${i}`);return n?{object:n,format:"deflated",source:i}:null}function pL(t,e){let r=new zi(t),i=HE(r);if(i!==e.byteLength)throw new he(`applyDelta expected source buffer to be ${i} bytes but the provided buffer was ${e.length} bytes`);let n=HE(r),s,a=GE(r,e);if(a.byteLength===n)s=a;else{let o=[a],l=a.byteLength;for(;!r.eof();){let c=GE(r,e);o.push(c),l+=c.byteLength}if(n!==l)throw new he(`applyDelta expected target buffer to be ${n} bytes but the resulting buffer was ${l} bytes`);s=k.concat(o,n)}return s}function HE(t){let e=0,r=0,i=null;do i=t.readUInt8(),e|=(i&127)<<r,r+=7;while(i&128);return e}function UE(t,e,r){let i=0,n=0;for(;r--;)e&1&&(i|=t.readUInt8()<<n),e>>=1,n+=8;return i}function GE(t,e){let r=t.readUInt8(),i=128,n=15,s=112;if(r&i){let a=UE(t,r&n,4),o=UE(t,(r&s)>>4,3);return o===0&&(o=65536),e.slice(a,a+o)}else return t.slice(r)}function mL(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function dS(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:mL(t)}var Ad=class{constructor(e){if(typeof k=="undefined")throw new Error("Missing Buffer dependency");this.stream=dS(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:r}=await this.stream.next();return e&&(this._ended=!0,!r)?k.alloc(0):(r&&(r=k.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let r=[this.buffer];for(;this.cursor+e>gL(r);){let i=await this._next();if(this._ended)break;r.push(i)}this.buffer=k.concat(r)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function gL(t){return t.reduce((e,r)=>e+r.length,0)}async function vL(t,e){let r=new Ad(t),i=await r.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new he(`Invalid PACK header '${i}'`);let n=await r.read(4);if(n=n.readUInt32BE(0),n!==2)throw new he(`Invalid packfile version: ${n}`);let s=await r.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!r.eof()&&s--;){let a=r.tell(),{type:o,length:l,ofs:c,reference:u}=await wL(r),f=new Md.default.Inflate;for(;!f.result;){let d=await r.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new he(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new he("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-f.strm.avail_in);let h=r.tell();await e({data:f.result,type:o,num:s,offset:a,end:h,reference:u,ofs:c})}}}}async function wL(t){let e=await t.byte(),r=e>>4&7,i=e&15;if(e&128){let a=4;do e=await t.byte(),i|=(e&127)<<a,a+=7;while(e&128)}let n,s;if(r===6){let a=0;n=0;let o=[];do e=await t.byte(),n|=(e&127)<<a,a+=7,o.push(e);while(e&128);s=k.from(o)}return r===7&&(s=await t.read(20)),{type:r,l
Line truncated
|
||||
`,t}function Td(t){let[,e,r,i,n]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(i),timezoneOffset:PL(n)}}function PL(t){let[,e,r,i]=t.match(/(\+|-)(\d\d)(\d\d)/);return i=(e==="+"?1:-1)*(Number(r)*60+Number(i)),RL(i)}function RL(t){return t===0?t:-t}var ni=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(k.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new he("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new t(e)}static render(e){return`object ${e.object}
|
||||
type ${e.type}
|
||||
tag ${e.tag}
|
||||
tagger ${kg(e.tagger)}
|
||||
tagger ${Qg(e.tagger)}
|
||||
|
||||
${e.message}
|
||||
${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
|
||||
@@ -33,52 +38,52 @@ ${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexO
|
||||
|
||||
`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(`
|
||||
`),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=`
|
||||
`+n.slice(1):r.push(n);let i={};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.tagger&&(i.tagger=cd(i.tagger)),i.committer&&(i.committer=cd(i.committer)),i}withoutSignature(){let e=Xn(this._tag);return e.indexOf(`
|
||||
`+n.slice(1):r.push(n);let i={};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.tagger&&(i.tagger=Td(i.tagger)),i.committer&&(i.committer=Td(i.committer)),i}withoutSignature(){let e=Qn(this._tag);return e.indexOf(`
|
||||
-----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(`
|
||||
-----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(`
|
||||
-----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return Xn(e)}payload(){return this.withoutSignature()+`
|
||||
`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,r,i){let n=e.payload(),{signature:s}=await r({payload:n,secretKey:i});s=Xn(s);let a=n+s;return t.from(a)}};function hg(t){return t.trim().split(`
|
||||
-----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return Qn(e)}payload(){return this.withoutSignature()+`
|
||||
`}toObject(){return k.from(this._tag,"utf8")}static async sign(e,r,i){let n=e.payload(),{signature:s}=await r({payload:n,secretKey:i});s=Qn(s);let a=n+s;return t.from(a)}};function Hg(t){return t.trim().split(`
|
||||
`).map(e=>" "+e).join(`
|
||||
`)+`
|
||||
`}function tN(t){return t.split(`
|
||||
`}function $L(t){return t.split(`
|
||||
`).map(e=>e.replace(/^ /,"")).join(`
|
||||
`)}var Mr=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new ue("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let i=t.justHeaders(e),n=t.justMessage(e),s=Xn(i+`
|
||||
gpgsig`+hg(r)+`
|
||||
`+n);return new t(s)}static from(e){return new t(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return t.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return Xn(e.slice(e.indexOf(`
|
||||
`)}var Nr=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(k.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new he("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let i=t.justHeaders(e),n=t.justMessage(e),s=Qn(i+`
|
||||
gpgsig`+Hg(r)+`
|
||||
`+n);return new t(s)}static from(e){return new t(e)}toObject(){return k.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return t.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return Qn(e.slice(e.indexOf(`
|
||||
|
||||
`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(`
|
||||
|
||||
`))}parseHeaders(){let e=t.justHeaders(this._commit).split(`
|
||||
`),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=`
|
||||
`+n.slice(1):r.push(n);let i={parent:[]};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.author&&(i.author=cd(i.author)),i.committer&&(i.committer=cd(i.committer)),i}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.tree}
|
||||
`+n.slice(1):r.push(n);let i={parent:[]};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.author&&(i.author=Td(i.author)),i.committer&&(i.committer=Td(i.committer)),i}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.tree}
|
||||
`:r+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
||||
`,e.parent){if(e.parent.length===void 0)throw new ue("commit 'parent' property should be an array");for(let s of e.parent)r+=`parent ${s}
|
||||
`}let i=e.author;r+=`author ${kg(i)}
|
||||
`;let n=e.committer||e.author;return r+=`committer ${kg(n)}
|
||||
`,e.gpgsig&&(r+="gpgsig"+hg(e.gpgsig)),r}static render(e){return t.renderHeaders(e)+`
|
||||
`+Xn(e.message)}render(){return this._commit}withoutSignature(){let e=Xn(this._commit);if(e.indexOf(`
|
||||
`,e.parent){if(e.parent.length===void 0)throw new he("commit 'parent' property should be an array");for(let s of e.parent)r+=`parent ${s}
|
||||
`}let i=e.author;r+=`author ${Qg(i)}
|
||||
`;let n=e.committer||e.author;return r+=`committer ${Qg(n)}
|
||||
`,e.gpgsig&&(r+="gpgsig"+Hg(e.gpgsig)),r}static render(e){return t.renderHeaders(e)+`
|
||||
`+Qn(e.message)}render(){return this._commit}withoutSignature(){let e=Qn(this._commit);if(e.indexOf(`
|
||||
gpgsig`)===-1)return e;let r=e.slice(0,e.indexOf(`
|
||||
gpgsig`)),i=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
|
||||
`)+28);return Xn(r+`
|
||||
`+i)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return tN(e)}static async sign(e,r,i){let n=e.withoutSignature(),s=t.justMessage(e._commit),{signature:a}=await r({payload:n,secretKey:i});a=Xn(a);let l=t.justHeaders(e._commit)+`
|
||||
gpgsig`+hg(a)+`
|
||||
`+s;return t.from(l)}};async function Ko({fs:t,cache:e,gitdir:r,oid:i}){if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:Ir.from([]),oid:i};let{type:n,object:s}=await Je({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Kr.from(s).parse().object,Ko({fs:t,cache:e,gitdir:r,oid:i});if(n==="commit")return i=Mr.from(s).parse().tree,Ko({fs:t,cache:e,gitdir:r,oid:i});if(n!=="tree")throw new yr(i,n,"tree");return{tree:Ir.from(s),oid:i}}var Ag=class{constructor({fs:e,gitdir:r,ref:i,cache:n}){this.fs=e,this.cache=n,this.gitdir=r,this.mapPromise=(async()=>{let a=new Map,o;try{o=await W.resolve({fs:e,gitdir:r,ref:i})}catch(c){c instanceof He&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await Ko({fs:e,cache:this.cache,gitdir:r,oid:o});return l.type="tree",l.mode="40000",a.set(".",l),a})();let s=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:i,cache:n,gitdir:s}=this,a=await this.mapPromise,o=a.get(r);if(!o)throw new Error(`No obj for ${r}`);let l=o.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!=="tree")return null;let{type:c,object:u}=await Je({fs:i,cache:n,gitdir:s,oid:l});if(c!==o.type)throw new yr(l,c,o.type);let f=Ir.from(u);for(let d of f)a.set(O(r,d.path),d);return f.entries().map(d=>O(r,d.path))}async type(e){if(e._type===!1){let r=await this.mapPromise,{type:i}=r.get(e._fullpath);e._type=i}return e._type}async mode(e){if(e._mode===!1){let r=await this.mapPromise,{mode:i}=r.get(e._fullpath);e._mode=AE(parseInt(i,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let r=await this.mapPromise,{fs:i,cache:n,gitdir:s}=this,o=r.get(e._fullpath).oid,{type:l,object:c}=await Je({fs:i,cache:n,gitdir:s,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let i=(await this.mapPromise).get(e._fullpath);e._oid=i.oid}return e._oid}};function Zr({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,md,{value:function({fs:r,gitdir:i,cache:n}){return new Ag({fs:r,gitdir:i,ref:t,cache:n})}}),Object.freeze(e),e}var Cg=class{constructor({fs:e,dir:r,gitdir:i,cache:n}){this.fs=e,this.cache=n,this.dir=r,this.gitdir=i,this.config=null;let s=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:i,dir:n}=this,s=await i.readdir(O(n,r));return s===null?null:s.map(a=>O(r,a))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:r,dir:i}=this,n=await r.lstat(`${i}/${e._fullpath}`);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let s=n.isDirectory()?"tree":"blob";s==="blob"&&!n.isFile()&&!n.isSymbolicLink()&&(s="special"),e._type=s,n=Wo(n),e._mode=n.mode,n.size===-1&&e._actualSize&&(n.size=e._actualSize),e._stat=n}return e._stat}async content(e){if(e._content===!1){let{fs:r,dir:i,gitdir:n}=this;if(await e.type()==="tree")e._content=void 0;else{let s;if(await e.mode()>>12===10)s=await r.readlink(`${i}/${e._fullpath}`);else{let o=await(await this._getGitConfig(r,n)).get("core.autocrlf");s=await r.read(`${i}/${e._fullpath}`,{autocrlf:o})}e._actualSize=s.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(s)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:i,gitdir:n,cache:s}=this,a;await ft.acquire({fs:i,gitdir:n,cache:s},async function(o){let l=o.entriesMap.get(e._fullpath),c=await e.stat(),f=await(await r._getGitConfig(i,n)).get("core.filemode"),d=typeof process!="undefined"?process.platform!=="win32":!0;if(!l||nd(c,l,f,d)){let h=await e.content();h===void 0?a=void 0:(a=await wn(Cs.wrap({type:"blob",object:h})),l&&a===l.oid&&(!f||c.mode===l.mode)&&nd(c,l,f,d)&&o.insert({filepath:e._fullpath,stats:c,oid:a}))}else a=l.oid}),e._oid=a}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await dt.get({fs:e,gitdir:r}),this.config)}};function tl(){let t=Object.create(null);return Object.defineProperty(t,md,{value:function({fs:e,dir:r,gitdir:i,cache:n}){return new Cg({fs:e,dir:r,gitdir:i,cache:n})}}),Object.freeze(t),t}function rN(t,e){let r=e-t;return Array.from({length:r},(i,n)=>t+n)}var ME=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),Tg=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:e<this.value&&(this.value=e))}reset(){th
Line truncated
|
||||
`),i=new TextEncoder().encode(i)}catch(n){}return typeof i!="string"&&(i=Buffer.from(i)),i}catch(i){return null}}async write(e,r,i={}){try{await this._writeFile(e,r,i)}catch(n){await this.mkdir(ha(e)),await this._writeFile(e,r,i)}}async mkdir(e,r=!1){try{await this._mkdir(e)}catch(i){if(i===null||i.code==="EEXIST")return;if(r)throw i;if(i.code==="ENOENT"){let n=ha(e);if(n==="."||n==="/"||n===e)throw i;await this.mkdir(n),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(e,r){try{r&&r.recursive?await this._rm(e,r):await this._rmdir(e)}catch(i){if(i.code!=="ENOENT")throw i}}async readdir(e){try{let r=await this._readdir(e);return r.sort(pd),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async n=>{let s=e+"/"+n;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((n,s)=>n.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async readlink(e,r={encoding:"buffer"}){try{let i=await this._readlink(e,r);return Buffer.isBuffer(i)?i:Buffer.from(i)}catch(i){if(i.code==="ENOENT"||(i.code||"").includes("ENS"))return null;throw i}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};function T(t,e){if(e===void 0)throw new Fr(t)}function aN(t){return t.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(t)}async function ee({fsp:t,dotgit:e}){T("fsp",t),T("dotgit",e);let r=await t._stat(e).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return r.isDirectory()?e:r.isFile()?t._readFile(e,"utf8").then(i=>i.trimRight().substr(8)).then(i=>aN(i)?i:O(ha(e),i)):e}async function ud(t,e){return!t&&!e?!1:t&&!e||!t&&e?!0:!(await t.type()==="tree"&&await e.type()==="tree"||await t.type()===await e.type()&&await t.mode()===await e.mode()&&await t.oid()===await e.oid())}async function DE({fs:t,dir:e,gitdir:r=O(e,".git"),commit:i="HEAD",cache:n={}}){try{T("fs",t),T("dir",e),T("gitdir",r);let s=new Q(t),a=[Zr({ref:i}),tl(),_a()],o=[],l=await ee({fsp:s,dotgit:r});await ft.acquire({fs:s,gitdir:l,cache:n},async function(u){o=u.unmergedPaths});let c=await Ps({fs:s,cache:n,dir:e,gitdir:l,trees:a,map:async function(u,[f,d,h]){let p=!await ud(d,h),g=o.includes(u),v=!await ud(h,f);if(p||g)return f?{path:u,mode:await f.mode(),oid:await f.oid(),type:await f.type(),content:await f.content()}:void 0;if(v)return!1;throw new Qc(u)}});await ft.acquire({fs:s,gitdir:l,cache:n},async function(u){for(let f of c)if(f!==!1){if(!f){await s.rmdir(`${e}/${f.path}`,{recursive:!0}),u.delete({filepath:f.path});continue}if(f.type==="blob"){let d=new TextDecoder().decode(f.content);await s.write(`${e}/${f.path}`,d,{mode:f.mode}),u.insert({filepath:f.path,oid:f.oid,stage:0})}}})}catch(s){throw s.caller="git.abortMerge",s}}var Rs=class{static async isIgnored({fs:e,dir:r,gitdir:i=O(r,".git"),filepath:n}){if(sd(n)===".git")return!0;if(n===".")return!1;let s="",a=O(i,"info","exclude");await e.exists(a)&&(s=await e.read(a,"utf8"));let o=[{gitignore:O(r,".gitignore"),filepath:n}],l=n.split("/").filter(Boolean);for(let u=1;u<l.length;u++){let f=l.slice(0,u).join("/"),d=l.slice(u).join("/");o.push({gitignore:O(r,f,".gitignore"),filepath:d})}let c=!1;for(let u of o){let f;try{f=await e.read(u.gitignore,"utf8")}catch(p){if(p.code==="NOENT")continue}let d=cL().add(s);d.add(f);let h=ha(u.filepath);if(h!=="."&&d.ignores(h))return!0;c?c=!d.test(u.filepath).unignored:c=d.test(u.filepath).ignored}return c}};async function oN({fs:t,gitdir:e,object:r,format:i,oid:n}){if(i!=="deflated")throw new ue("GitObjectStoreLoose expects objects to write to be in deflated format");let s=`objects/${n.slice(0,2)}/${n.slice(2)}`,a=`${e}/${s}`;await t.exists(a)||await t.write(a,r)}var pg=null;async function OE(t){return pg===null&&(pg=cN()),pg?lN(t):Fg.deflate(t)}async function lN(t){let e=new CompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}function cN(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch(t){return!1}}async function Dr({fs:t,gitdir:e,type:r,object:i,format:n="content",oid:s=void 0,dryRun:a=!1}){return n!=="deflated"&&(n!=="wrapped"&&(i=Cs.wrap({type:r,object:i})),s=await wn(i),i=Buffer.from(await OE(i))),a||await oN({fs:t,gitdir:e,object:i,format:"deflated",oid:s}),s}function LE(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}async function NE({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,cache:n={},force:s=!1,parallel:a=!0}){try{T("fs",t),T("dir",e),T("gitdir",r),T("filepath",i);let o=new Q(t),l=await ee({fsp:o,dotgit:r});await ft.acquire({fs:o,gitdir:l,cache:n},async c=>{let f=await(await dt.get({fs:o,gitdir:l})).get("core.autocrlf");return Rg({dir:e,gitdir:l,fs:o,filepath:i,index:c,force:s,parallel:a,autocrlf:f})})}catch(o){throw o.caller="git.add",o}}async function Rg({dir:t,gitdir:e,fs:r,filepath:i,in
Line truncated
|
||||
`,author:l,committer:c,signingKey:u})}async function jE({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),ref:n="refs/notes/commits",oid:s,note:a,force:o,author:l,committer:c,signingKey:u,cache:f={}}){try{T("fs",t),T("gitdir",i),T("oid",s),T("note",a),u&&T("onSign",e);let d=new Q(t),h=await $s({fs:d,gitdir:i,author:l});if(!h)throw new Zt("author");let p=await ga({fs:d,gitdir:i,author:h,committer:c});if(!p)throw new Zt("committer");let g=await ee({fsp:d,dotgit:i});return await uN({fs:d,cache:f,onSign:e,gitdir:g,ref:n,oid:s,note:a,force:o,author:h,committer:p,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}var fN=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function tu(t,e){if(typeof t!="string")throw new TypeError("Reference name must be a string");return!fN.test(t)&&(!!e||t.includes("/"))}async function VE({fs:t,gitdir:e,remote:r,url:i,force:n}){if(!tu(r,!0))throw new Gi(r,Dc.clean(r));let s=await dt.get({fs:t,gitdir:e});if(!n&&(await s.getSubsections("remote")).includes(r)&&i!==await s.get(`remote.${r}.url`))throw new Ui("remote",r);await s.set(`remote.${r}.url`,i),await s.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await dt.save({fs:t,gitdir:e,config:s})}async function zE({fs:t,dir:e,gitdir:r=O(e,".git"),remote:i,url:n,force:s=!1}){try{T("fs",t),T("gitdir",r),T("remote",i),T("url",n);let a=new Q(t),o=await ee({fsp:a,dotgit:r});return await VE({fs:a,gitdir:o,remote:i,url:n,force:s})}catch(a){throw a.caller="git.addRemote",a}}async function dN({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1}){if(n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,!u&&await W.exists({fs:t,gitdir:i,ref:n}))throw new Ui("tag",n);let f=await W.resolve({fs:t,gitdir:i,ref:l||"HEAD"}),{type:d}=await Je({fs:t,cache:e,gitdir:i,oid:f}),h=Kr.from({object:f,type:d,tag:n.replace("refs/tags/",""),tagger:s,message:a,gpgsig:o});c&&(h=await Kr.sign(h,r,c));let p=await Dr({fs:t,gitdir:i,type:"tag",object:h.toObject()});await W.writeRef({fs:t,gitdir:i,ref:n,value:p})}async function WE({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1,cache:f={}}){try{T("fs",t),T("gitdir",i),T("ref",n),c&&T("onSign",e);let d=new Q(t),h=await ee({fsp:d,dotgit:i}),p=await $s({fs:d,gitdir:h,author:s});if(!p)throw new Zt("tagger");return await dN({fs:d,cache:f,onSign:e,gitdir:h,ref:n,tagger:p,message:a,gpgsig:o,object:l,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function hN({fs:t,gitdir:e,ref:r,object:i,checkout:n=!1,force:s=!1}){if(!tu(r,!0))throw new Gi(r,Dc.clean(r));let a=`refs/heads/${r}`;if(!s&&await W.exists({fs:t,gitdir:e,ref:a}))throw new Ui("branch",r,!1);let o;try{o=await W.resolve({fs:t,gitdir:e,ref:i||"HEAD"})}catch(l){}o&&await W.writeRef({fs:t,gitdir:e,ref:a,value:o}),n&&await W.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function qE({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,object:n,checkout:s=!1,force:a=!1}){try{T("fs",t),T("gitdir",r),T("ref",i);let o=new Q(t),l=await ee({fsp:o,dotgit:r});return await hN({fs:o,gitdir:l,ref:i,object:n,checkout:s,force:a})}catch(o){throw o.caller="git.branch",o}}var YE=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function Mg({fs:t,cache:e,onProgress:r,onPostCheckout:i,dir:n,gitdir:s,remote:a,ref:o,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:d,track:h=!0,nonBlocking:p=!1,batchSize:g=100}){let v;if(i)try{v=await W.resolve({fs:t,gitdir:s,ref:"HEAD"})}catch(b){v="0000000000000000000000000000000000000000"}let _;try{_=await W.resolve({fs:t,gitdir:s,ref:o})}catch(b){if(o==="HEAD")throw b;let S=`${a}/${o}`;if(_=await W.resolve({fs:t,gitdir:s,ref:S}),h){let k=await dt.get({fs:t,gitdir:s});await k.set(`branch.${o}.remote`,a),await k.set(`branch.${o}.merge`,`refs/heads/${o}`),await dt.save({fs:t,gitdir:s,config:k})}await W.writeRef({fs:t,gitdir:s,ref:`refs/heads/${o}`,value:_})}if(!c){let b;try{b=await pN({fs:t,cache:e,onProgress:r,dir:n,gitdir:s,ref:o,force:d,filepaths:l})}catch(w){throw w instanceof He&&w.data.what===_?new jc(o,_):w}let S=b.filter(([w])=>w==="conflict").map(([w,x])=>x);if(S.length>0)throw new Hc(S);let k=b.filter(([w])=>w==="error").map(([w,x])=>x);if(k.length>0)throw new ue(k.join(", "));if(f){i&&await i({previousHead:v,newHead:_,type:l!=null&&l.length>0?"file":"branch"});return}let E=0,A=b.length;if(await ft.acquire({fs:t,gitdir:s,cache:e},async function(w){await Promise.all(b.filter(([x])=>x==="delete"||x==="delete-index").map(async function([x,y]){let C=`${n}/${y}`;x==="delete"&&await t.rm(C),w.delete({filepath:y}),r&&await r({phase:"Updating workdir",loaded:++E,total:A})}))}),await ft.acquire({fs:t,gitdir:s,cache:e},async function(w){for(let[x,y]of b)if(x==="rmdir"||x==="rmdir-index"){let C=`${n}/${y}`;try{x==="rmdir"&&await t.rmdir(C),w.delete({filepath:y}),r&&await r({phase:"Updating workdir",loaded:++E,total:A})}catch(P){if(P.code==="ENOTEMP
Line truncated
|
||||
`)+28);return Qn(r+`
|
||||
`+i)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return $L(e)}static async sign(e,r,i){let n=e.withoutSignature(),s=t.justMessage(e._commit),{signature:a}=await r({payload:n,secretKey:i});a=Qn(a);let l=t.justHeaders(e._commit)+`
|
||||
gpgsig`+Hg(a)+`
|
||||
`+s;return t.from(l)}};async function tl({fs:t,cache:e,gitdir:r,oid:i}){if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:Lr.from([]),oid:i};let{type:n,object:s}=await st({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=ni.from(s).parse().object,tl({fs:t,cache:e,gitdir:r,oid:i});if(n==="commit")return i=Nr.from(s).parse().tree,tl({fs:t,cache:e,gitdir:r,oid:i});if(n!=="tree")throw new xr(i,n,"tree");return{tree:Lr.from(s),oid:i}}var Jg=class{constructor({fs:e,gitdir:r,ref:i,cache:n}){this.fs=e,this.cache=n,this.gitdir=r,this.mapPromise=(async()=>{let a=new Map,o;try{o=await q.resolve({fs:e,gitdir:r,ref:i})}catch(c){c instanceof ze&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await tl({fs:e,cache:this.cache,gitdir:r,oid:o});return l.type="tree",l.mode="40000",a.set(".",l),a})();let s=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:i,cache:n,gitdir:s}=this,a=await this.mapPromise,o=a.get(r);if(!o)throw new Error(`No obj for ${r}`);let l=o.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!=="tree")return null;let{type:c,object:u}=await st({fs:i,cache:n,gitdir:s,oid:l});if(c!==o.type)throw new xr(l,c,o.type);let f=Lr.from(u);for(let d of f)a.set(N(r,d.path),d);return f.entries().map(d=>N(r,d.path))}async type(e){if(e._type===!1){let r=await this.mapPromise,{type:i}=r.get(e._fullpath);e._type=i}return e._type}async mode(e){if(e._mode===!1){let r=await this.mapPromise,{mode:i}=r.get(e._fullpath);e._mode=oS(parseInt(i,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let r=await this.mapPromise,{fs:i,cache:n,gitdir:s}=this,o=r.get(e._fullpath).oid,{type:l,object:c}=await st({fs:i,cache:n,gitdir:s,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let i=(await this.mapPromise).get(e._fullpath);e._oid=i.oid}return e._oid}};function Dr({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,Od,{value:function({fs:r,gitdir:i,cache:n}){return new Jg({fs:r,gitdir:i,ref:t,cache:n})}}),Object.freeze(e),e}var ev=class{constructor({fs:e,dir:r,gitdir:i,cache:n,refresh:s=!0}){this.fs=e,this.cache=n,this.dir=r,this.gitdir=i,this.refresh=s,this.config=null;let a=this;this.ConstructEntry=class{constructor(l){this._fullpath=l,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(e){if(await e.type()!=="tree")return null;let r=e._fullpath,{fs:i,dir:n}=this,s=await i.readdir(N(n,r));return s===null?null:s.map(a=>N(r,a))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:r,dir:i}=this,n=await r.lstat(`${i}/${e._fullpath}`);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let s=n.isDirectory()?"tree":"blob";s==="blob"&&!n.isFile()&&!n.isSymbolicLink()&&(s="special"),e._type=s,n=Ko(n),e._mode=n.mode,n.size===-1&&e._actualSize&&(n.size=e._actualSize),e._stat=n}return e._stat}async content(e){if(e._content===!1){let{fs:r,dir:i,gitdir:n}=this;if(await e.type()==="tree")e._content=void 0;else{let s;if(await e.mode()>>12===10)s=await r.readlink(`${i}/${e._fullpath}`);else{let o=await(await this._getGitConfig(r,n)).get("core.autocrlf");s=await r.read(`${i}/${e._fullpath}`,{autocrlf:o})}e._actualSize=s.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(s)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:i,gitdir:n,cache:s}=this,a;await gt.acquire({fs:i,gitdir:n,cache:s},async function(o){let l=o.entriesMap.get(e._fullpath),c=await e.stat(),f=await(await r._getGitConfig(i,n)).get("core.filemode"),d=typeof process!="undefined"?process.platform!=="win32":!0;if(!l||Ed(c,l,f,d)){let h=await e.content();h===void 0?a=void 0:(a=await En(Ds.wrap({type:"blob",object:h})),r.refresh&&l&&a===l.oid&&(!f||c.mode===l.mode)&&Ed(c,l,f,d)&&o.insert({filepath:e._fullpath,stats:c,oid:a}))}else a=l.oid}),e._oid=a}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await vt.get({fs:e,gitdir:r}),this.config)}};function hu({refresh:t=!0}={}){let e=Object.create(null);return Object.defineProperty(e,Od,{value:function({fs:r,dir:i,gitdir:n,cache:s}){return new ev({fs:r,dir:i,gitdir:n,cache:s,refresh:t})}}),Object.freeze(e),e}function FL(t,e){let r=e-t;return Array.from({length:r},(i,n)=>t+n)}var pS=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),tv=class{constructor(){this
Line truncated
|
||||
`),i=new TextEncoder().encode(i)}catch(n){}return typeof i!="string"&&(i=k.from(i)),i}catch(i){return null}}async write(e,r,i={}){try{await this._writeFile(e,r,i)}catch(n){await this.mkdir(Sa(e)),await this._writeFile(e,r,i)}}async mkdir(e,r=!1){try{await this._mkdir(e)}catch(i){if(i===null||i.code==="EEXIST")return;if(r)throw i;if(i.code==="ENOENT"){let n=Sa(e);if(n==="."||n==="/"||n===e)throw i;await this.mkdir(n),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(e,r){try{r&&r.recursive?await this._rm(e,r):await this._rmdir(e)}catch(i){if(i.code!=="ENOENT")throw i}}async readdir(e){try{let r=await this._readdir(e);return r.sort(Dd),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async n=>{let s=e+"/"+n;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((n,s)=>n.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async readlink(e,r={encoding:"buffer"}){try{let i=await this._readlink(e,r);return k.isBuffer(i)?i:k.from(i)}catch(i){if(i.code==="ENOENT"||(i.code||"").includes("ENS"))return null;throw i}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};function R(t,e){if(e===void 0)throw new Or(t)}function OL(t){return t.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(t)}async function ie({fsp:t,dotgit:e}){R("fsp",t),R("dotgit",e);let r=await t._stat(e).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return r.isDirectory()?e:r.isFile()?t._readFile(e,"utf8").then(i=>i.trimRight().substr(8)).then(i=>OL(i)?i:N(Sa(e),i)):e}async function Pd(t,e){return!t&&!e?!1:t&&!e||!t&&e?!0:!(await t.type()==="tree"&&await e.type()==="tree"||await t.type()===await e.type()&&await t.mode()===await e.mode()&&await t.oid()===await e.oid())}async function LL({fs:t,dir:e,gitdir:r=N(e,".git"),commit:i="HEAD",cache:n={}}){try{R("fs",t),R("dir",e),R("gitdir",r);let s=new te(t),a=[Dr({ref:i}),hu(),sl()],o=[],l=await ie({fsp:s,dotgit:r});await gt.acquire({fs:s,gitdir:l,cache:n},async function(u){o=u.unmergedPaths});let c=await Jn({fs:s,cache:n,dir:e,gitdir:l,trees:a,map:async function(u,[f,d,h]){let p=!await Pd(d,h),g=o.includes(u),v=!await Pd(h,f);if(p||g)return f?{path:u,mode:await f.mode(),oid:await f.oid(),type:await f.type(),content:await f.content()}:void 0;if(v)return!1;throw new ou(u)}});await gt.acquire({fs:s,gitdir:l,cache:n},async function(u){for(let f of c)if(f!==!1){if(!f){await s.rmdir(`${e}/${f.path}`,{recursive:!0}),u.delete({filepath:f.path});continue}if(f.type==="blob"){let d=new TextDecoder().decode(f.content);await s.write(`${e}/${f.path}`,d,{mode:f.mode}),u.insert({filepath:f.path,oid:f.oid,stage:0})}}})}catch(s){throw s.caller="git.abortMerge",s}}var Ls=class{static async isIgnored({fs:e,dir:r,gitdir:i=N(r,".git"),filepath:n}){if(Sd(n)===".git")return!0;if(n===".")return!1;let s="",a=N(i,"info","exclude");await e.exists(a)&&(s=await e.read(a,"utf8"));let o=[{gitignore:N(r,".gitignore"),filepath:n}],l=n.split("/").filter(Boolean);for(let u=1;u<l.length;u++){let f=l.slice(0,u).join("/"),d=l.slice(u).join("/");o.push({gitignore:N(r,f,".gitignore"),filepath:d})}let c=!1;for(let u of o){let f;try{f=await e.read(u.gitignore,"utf8")}catch(p){if(p.code==="NOENT")continue}let d=(0,nS.default)().add(s);d.add(f);let h=Sa(u.filepath);if(h!=="."&&d.ignores(h))return!0;c?c=!d.test(u.filepath).unignored:c=d.test(u.filepath).ignored}return c}};async function NL({fs:t,gitdir:e,object:r,format:i,oid:n}){if(i!=="deflated")throw new he("GitObjectStoreLoose expects objects to write to be in deflated format");let s=`objects/${n.slice(0,2)}/${n.slice(2)}`,a=`${e}/${s}`;await t.exists(a)||await t.write(a,r)}var Ug=null;async function mS(t){return Ug===null&&(Ug=HL()),Ug?BL(t):Md.default.deflate(t)}async function BL(t){let e=new CompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}function HL(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch(t){return!1}}async function Br({fs:t,gitdir:e,type:r,object:i,format:n="content",oid:s=void 0,dryRun:a=!1}){return n!=="deflated"&&(n!=="wrapped"&&(i=Ds.wrap({type:r,object:i})),s=await En(i),i=k.from(await mS(i))),a||await NL({fs:t,gitdir:e,object:i,format:"deflated",oid:s}),s}function gS(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}async function UL({fs:t,dir:e,gitdir:r=N(e,".git"),filepath:i,cache:n={},force:s=!1,parallel:a=!0}){try{R("fs",t),R("dir",e),R("gitdir",r),R("filepath",i);let o=new te(t),l=await ie({fsp:o,dotgit:r});await gt.acquire({fs:o,gitdir:l,cache:n},async c=>{let f=await(await vt.get({fs:o,gitdir:l})).get("core.autocrlf");return iv({dir:e,gitdir:l,fs:o,filepath:i,index:c,force:s,parallel:a,autocrlf:f})})}catch(o){throw o.caller="git.add",o}}async function iv({dir:t,gitdir:e,fs:r,filepath:i,
Line truncated
|
||||
`,author:l,committer:c,signingKey:u})}async function VL({fs:t,onSign:e,dir:r,gitdir:i=N(r,".git"),ref:n="refs/notes/commits",oid:s,note:a,force:o,author:l,committer:c,signingKey:u,cache:f={}}){try{R("fs",t),R("gitdir",i),R("oid",s),R("note",a),u&&R("onSign",e);let d=new te(t),h=await Ns({fs:d,gitdir:i,author:l});if(!h)throw new Jt("author");let p=await Ta({fs:d,gitdir:i,author:h,committer:c});if(!p)throw new Jt("committer");let g=await ie({fsp:d,dotgit:i});return await jL({fs:d,cache:f,onSign:e,gitdir:g,ref:n,oid:s,note:a,force:o,author:h,committer:p,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}var zL=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function uu(t,e){if(typeof t!="string")throw new TypeError("Reference name must be a string");return!zL.test(t)&&(!!e||t.includes("/"))}async function yS({fs:t,gitdir:e,remote:r,url:i,force:n}){if(!uu(r,!0))throw new qi(r,Zo.default.clean(r));let s=await vt.get({fs:t,gitdir:e});if(!n&&(await s.getSubsections("remote")).includes(r)&&i!==await s.get(`remote.${r}.url`))throw new Wi("remote",r);await s.set(`remote.${r}.url`,i),await s.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await vt.save({fs:t,gitdir:e,config:s})}async function WL({fs:t,dir:e,gitdir:r=N(e,".git"),remote:i,url:n,force:s=!1}){try{R("fs",t),R("gitdir",r),R("remote",i),R("url",n);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await yS({fs:a,gitdir:o,remote:i,url:n,force:s})}catch(a){throw a.caller="git.addRemote",a}}async function qL({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1}){if(n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,!u&&await q.exists({fs:t,gitdir:i,ref:n}))throw new Wi("tag",n);let f=await q.resolve({fs:t,gitdir:i,ref:l||"HEAD"}),{type:d}=await st({fs:t,cache:e,gitdir:i,oid:f}),h=ni.from({object:f,type:d,tag:n.replace("refs/tags/",""),tagger:s,message:a,gpgsig:o});c&&(h=await ni.sign(h,r,c));let p=await Br({fs:t,gitdir:i,type:"tag",object:h.toObject()});await q.writeRef({fs:t,gitdir:i,ref:n,value:p})}async function YL({fs:t,onSign:e,dir:r,gitdir:i=N(r,".git"),ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1,cache:f={}}){try{R("fs",t),R("gitdir",i),R("ref",n),c&&R("onSign",e);let d=new te(t),h=await ie({fsp:d,dotgit:i}),p=await Ns({fs:d,gitdir:h,author:s});if(!p)throw new Jt("tagger");return await qL({fs:d,cache:f,onSign:e,gitdir:h,ref:n,tagger:p,message:a,gpgsig:o,object:l,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function ZL({fs:t,gitdir:e,ref:r,object:i,checkout:n=!1,force:s=!1}){if(!uu(r,!0))throw new qi(r,Zo.default.clean(r));let a=`refs/heads/${r}`;if(!s&&await q.exists({fs:t,gitdir:e,ref:a}))throw new Wi("branch",r,!1);let o;try{o=await q.resolve({fs:t,gitdir:e,ref:i||"HEAD"})}catch(l){}o&&await q.writeRef({fs:t,gitdir:e,ref:a,value:o}),n&&await q.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function KL({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i,object:n,checkout:s=!1,force:a=!1}){try{R("fs",t),R("gitdir",r),R("ref",i);let o=new te(t),l=await ie({fsp:o,dotgit:r});return await ZL({fs:o,gitdir:l,ref:i,object:n,checkout:s,force:a})}catch(o){throw o.caller="git.branch",o}}async function fu(t,e,r){let i=r.split("/");i.pop();let n=e;for(let s of i){if(s===""||s===".")continue;n=`${n}/${s}`;let a=await t.lstat(n);if(a&&a.isSymbolicLink())throw new Ea(r)}}var xS=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function ov({fs:t,cache:e,onProgress:r,onPostCheckout:i,dir:n,gitdir:s,remote:a,ref:o,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:d,track:h=!0,nonBlocking:p=!1,batchSize:g=100}){let v;if(i)try{v=await q.resolve({fs:t,gitdir:s,ref:"HEAD"})}catch(_){v="0000000000000000000000000000000000000000"}let b;try{b=await q.resolve({fs:t,gitdir:s,ref:o})}catch(_){if(o==="HEAD")throw _;let C=`${a}/${o}`;if(b=await q.resolve({fs:t,gitdir:s,ref:C}),h){let x=await vt.get({fs:t,gitdir:s});await x.set(`branch.${o}.remote`,a),await x.set(`branch.${o}.merge`,`refs/heads/${o}`),await vt.save({fs:t,gitdir:s,config:x})}await q.writeRef({fs:t,gitdir:s,ref:`refs/heads/${o}`,value:b})}if(!c){let _;try{_=await XL({fs:t,cache:e,onProgress:r,dir:n,gitdir:s,ref:o,force:d,filepaths:l})}catch(w){throw w instanceof ze&&w.data.what===b?new Qc(o,b):w}let C=_.filter(([w])=>w==="conflict").map(([w,S])=>S);if(C.length>0)throw new Zc(C);let x=_.filter(([w])=>w==="error").map(([w,S])=>S);if(x.length>0)throw new he(x.join(", "));if(f){i&&await i({previousHead:v,newHead:b,type:l!=null&&l.length>0?"file":"branch"});return}let E=0,A=_.length;if(await gt.acquire({fs:t,gitdir:s,cache:e},async function(w){await Promise.all(_.filter(([S])=>S==="delete"||S==="delete-index").map(async function([S,y]){let P=`${n}/${y}`;S==="delete"&&await t.rm(P),w.delete({filepath:y}),r&&await r({phase:"Updating workdir",loaded:++E,total:A})}))}),await gt.acquire({fs:t,gitdir:s,cache:e},async function(w){for(let[S,y
Line truncated
|
||||
`,d+=p.conflict.a.join(""),d+=`${"=".repeat(f)}
|
||||
`,d+=p.conflict.b.join(""),d+=`${">".repeat(f)} ${i}
|
||||
`);return{cleanMerge:h,mergedText:d}}async function XE({fs:t,cache:e,dir:r,gitdir:i=O(r,".git"),index:n,ourOid:s,baseOid:a,theirOid:o,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let p=Zr({ref:s}),g=Zr({ref:a}),v=Zr({ref:o}),_=[],b=[],S=[],k=[],E=await Ps({fs:t,cache:e,dir:r,gitdir:i,trees:[p,g,v],map:async function(A,[w,x,y]){let C=sd(A),P=await ud(w,x),L=await ud(y,x);switch(`${P}-${L}`){case"false-false":return{mode:await x.mode(),path:C,oid:await x.oid(),type:await x.type()};case"false-true":return!y&&await w.type()==="tree"?{mode:await w.mode(),path:C,oid:await w.oid(),type:await w.type()}:y?{mode:await y.mode(),path:C,oid:await y.oid(),type:await y.type()}:void 0;case"true-false":return!w&&await y.type()==="tree"?{mode:await y.mode(),path:C,oid:await y.oid(),type:await y.type()}:w?{mode:await w.mode(),path:C,oid:await w.oid(),type:await w.type()}:void 0;case"true-true":{if(w&&y&&await w.type()==="tree"&&await y.type()==="tree")return{mode:await w.mode(),path:C,oid:await w.oid(),type:"tree"};if(w&&y&&await w.type()==="blob"&&await y.type()==="blob")return wN({fs:t,gitdir:i,path:C,ours:w,base:x,theirs:y,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async N=>{if(N.cleanMerge)d||n.insert({filepath:A,oid:N.mergeResult.oid,stage:0});else if(_.push(A),b.push(A),!d){let B="";x&&await x.type()==="blob"&&(B=await x.oid());let ge=await w.oid(),Le=await y.oid();n.delete({filepath:A}),B&&n.insert({filepath:A,oid:B,stage:1}),n.insert({filepath:A,oid:ge,stage:2}),n.insert({filepath:A,oid:Le,stage:3})}return N.mergeResult});if(x&&!w&&y&&await x.type()==="blob"&&await y.type()==="blob"){if(_.push(A),S.push(A),!d){let N=await x.oid(),B=await y.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:N,stage:1}),n.insert({filepath:A,oid:B,stage:3})}return{mode:await y.mode(),oid:await y.oid(),type:"blob",path:C}}if(x&&w&&!y&&await x.type()==="blob"&&await w.type()==="blob"){if(_.push(A),k.push(A),!d){let N=await x.oid(),B=await w.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:N,stage:1}),n.insert({filepath:A,oid:B,stage:2})}return{mode:await w.mode(),oid:await w.oid(),type:"blob",path:C}}if(x&&!w&&!y&&(await x.type()==="blob"||await x.type()==="tree"))return;throw new Yo}}},reduce:_.length!==0&&(!r||d)?void 0:async(A,w)=>{let x=w.filter(Boolean);if(A&&!(A&&A.type==="tree"&&x.length===0&&A.path!==".")){if(x.length>0||A.path==="."&&x.length===0){let C=new Ir(x).toObject(),P=await Dr({fs:t,gitdir:i,type:"tree",object:C,dryRun:f});A.oid=P}return A}}});return _.length!==0?(r&&!d&&await Ps({fs:t,cache:e,dir:r,gitdir:i,trees:[Zr({ref:E.oid})],map:async function(A,[w]){let x=`${r}/${A}`;if(await w.type()==="blob"){let y=await w.mode(),C=new TextDecoder().decode(await w.content());await t.write(x,C,{mode:y})}return!0}}),new pa(_,b,S,k)):E.oid}async function wN({fs:t,gitdir:e,path:r,ours:i,base:n,theirs:s,ourName:a,theirName:o,baseName:l,dryRun:c,mergeDriver:u=vN}){let f="blob",d="100755",h="",p="";n&&await n.type()==="blob"&&(d=await n.mode(),h=await n.oid(),p=Buffer.from(await n.content()).toString("utf8"));let g=d===await i.mode()?await s.mode():await i.mode();if(await i.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};if(await i.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await s.oid(),type:f}};if(await s.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};let v=Buffer.from(await i.content()).toString("utf8"),_=Buffer.from(await s.content()).toString("utf8"),{mergedText:b,cleanMerge:S}=await u({branches:[l,a,o],contents:[p,v,_],path:r}),k=await Dr({fs:t,gitdir:e,type:"blob",object:Buffer.from(b,"utf8"),dryRun:c});return{cleanMerge:S,mergeResult:{mode:g,path:r,oid:k,type:f}}}var _N={stage:_a,workdir:tl},gg;async function Qo(t,e){return gg===void 0&&(gg=new Mc),gg.acquire(t,e)}async function bN(t,e,r,i,n=null){let s=O(r,i),a=await t.lstat(s);if(!a)throw new He(s);if(a.isDirectory())throw new ue(`${s}: file expected, but found directory`);let o=n?await RE({fs:t,gitdir:e,oid:n}):void 0,l=o?n:void 0;return o||await Qo({fs:t,gitdir:e,currentFilepath:s},async()=>{let c=a.isSymbolicLink()?await t.readlink(s).then(LE):await t.read(s);if(c===null)throw new He(s);l=await Dr({fs:t,gitdir:e,type:"blob",object:c})}),l}async function yN({fs:t,dir:e,gitdir:r,entries:i}){async function n(s){if(s.type==="tree"){if(!s.oid){let a=await Promise.all(s.children.map(n));s.oid=await nu({fs:t,gitdir:r,tree:a}),s.mode=16384}}else s.type==="blob"&&(s.oid=await bN(t,r,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return Promise.all(i.map(n))}async function mE({fs:t,dir:e,gitdir:r,treePair:i}){let n=i[1]==="stage",s=i.map(h=>typeof h=="string"?_N[h]():h),a=[],u=await Ps({fs:t,cache:{},dir:e,gitdir:r,trees:s,map:async(h,[p,g])=>{if(!(h==="."||await Rs.isIgnored({fs:t,dir:e,gitdir:r,filepath:h}))&&g)return(!p||await p.oid()!==await g.oid()&&await g.oid()!==void 0)&
Line truncated
|
||||
`).map(a=>n.add(a))}),n}static async write({fs:e,gitdir:r,oids:i}){fa===null&&(fa=new Mc);let n=O(r,"shallow");if(i.size>0){let s=[...i].join(`
|
||||
`);return{cleanMerge:h,mergedText:d}}async function SS({fs:t,cache:e,dir:r,gitdir:i=N(r,".git"),index:n,ourOid:s,baseOid:a,theirOid:o,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let p=Dr({ref:s}),g=Dr({ref:a}),v=Dr({ref:o}),b=[],_=[],C=[],x=[],E=await Jn({fs:t,cache:e,dir:r,gitdir:i,trees:[p,g,v],map:async function(A,[w,S,y]){let P=Sd(A),T=await Pd(w,S),I=await Pd(y,S);switch(`${T}-${I}`){case"false-false":return{mode:await S.mode(),path:P,oid:await S.oid(),type:await S.type()};case"false-true":return!y&&await w.type()==="tree"?{mode:await w.mode(),path:P,oid:await w.oid(),type:await w.type()}:y?{mode:await y.mode(),path:P,oid:await y.oid(),type:await y.type()}:void 0;case"true-false":return!w&&await y.type()==="tree"?{mode:await y.mode(),path:P,oid:await y.oid(),type:await y.type()}:w?{mode:await w.mode(),path:P,oid:await w.oid(),type:await w.type()}:void 0;case"true-true":{if(w&&y&&await w.type()==="tree"&&await y.type()==="tree")return{mode:await w.mode(),path:P,oid:await w.oid(),type:"tree"};if(w&&y&&await w.type()==="blob"&&await y.type()==="blob")return tN({fs:t,gitdir:i,path:P,ours:w,base:S,theirs:y,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async M=>{if(M.cleanMerge)d||n.insert({filepath:A,oid:M.mergeResult.oid,stage:0});else if(b.push(A),_.push(A),!d){let B="";S&&await S.type()==="blob"&&(B=await S.oid());let re=await w.oid(),Ae=await y.oid();n.delete({filepath:A}),B&&n.insert({filepath:A,oid:B,stage:1}),n.insert({filepath:A,oid:re,stage:2}),n.insert({filepath:A,oid:Ae,stage:3})}return M.mergeResult});if(S&&!w&&y&&await S.type()==="blob"&&await y.type()==="blob"){if(b.push(A),C.push(A),!d){let M=await S.oid(),B=await y.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:M,stage:1}),n.insert({filepath:A,oid:B,stage:3})}return{mode:await y.mode(),oid:await y.oid(),type:"blob",path:P}}if(S&&w&&!y&&await S.type()==="blob"&&await w.type()==="blob"){if(b.push(A),x.push(A),!d){let M=await S.oid(),B=await w.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:M,stage:1}),n.insert({filepath:A,oid:B,stage:2})}return{mode:await w.mode(),oid:await w.oid(),type:"blob",path:P}}if(S&&!w&&!y&&(await S.type()==="blob"||await S.type()==="tree"))return;throw new Qo}}},reduce:b.length!==0&&(!r||d)?void 0:async(A,w)=>{let S=w.filter(Boolean);if(A&&!(A&&A.type==="tree"&&S.length===0&&A.path!==".")){if(S.length>0||A.path==="."&&S.length===0){let P=new Lr(S).toObject(),T=await Br({fs:t,gitdir:i,type:"tree",object:P,dryRun:f});A.oid=T}return A}}});return b.length!==0?(r&&!d&&await Jn({fs:t,cache:e,dir:r,gitdir:i,trees:[Dr({ref:E.oid})],map:async function(A,[w]){let S=`${r}/${A}`;if(await w.type()==="blob"){let y=await w.mode(),P=await w.content();await t.write(S,P,{mode:y})}return!0}}),new ka(b,_,C,x)):E.oid}async function tN({fs:t,gitdir:e,path:r,ours:i,base:n,theirs:s,ourName:a,theirName:o,baseName:l,dryRun:c,mergeDriver:u=eN}){let f="blob",d="100755",h="",p="";n&&await n.type()==="blob"&&(d=await n.mode(),h=await n.oid(),p=k.from(await n.content()).toString("utf8"));let g=d===await i.mode()?await s.mode():await i.mode();if(await i.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};if(await i.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await s.oid(),type:f}};if(await s.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};let v=k.from(await i.content()).toString("utf8"),b=k.from(await s.content()).toString("utf8"),{mergedText:_,cleanMerge:C}=await u({branches:[l,a,o],contents:[p,v,b],path:r}),x=await Br({fs:t,gitdir:e,type:"blob",object:k.from(_,"utf8"),dryRun:c});return{cleanMerge:C,mergeResult:{mode:g,path:r,oid:x,type:f}}}var rN={stage:sl,workdir:hu},jg;async function rl(t,e){return jg===void 0&&(jg=new Yo.default),jg.acquire(t,e)}async function iN(t,e,r,i,n=null){let s=N(r,i),a=await t.lstat(s);if(!a)throw new ze(s);if(a.isDirectory())throw new he(`${s}: file expected, but found directory`);let o=n?await fS({fs:t,gitdir:e,oid:n}):void 0,l=o?n:void 0;return o||await rl({fs:t,gitdir:e,currentFilepath:s},async()=>{let c=a.isSymbolicLink()?await t.readlink(s).then(gS):await t.read(s);if(c===null)throw new ze(s);l=await Br({fs:t,gitdir:e,type:"blob",object:c})}),l}async function nN({fs:t,dir:e,gitdir:r,entries:i}){async function n(s){if(s.type==="tree"){if(!s.oid){let a=await Promise.all(s.children.map(n));s.oid=await gu({fs:t,gitdir:r,tree:a}),s.mode=16384}}else s.type==="blob"&&(s.oid=await iN(t,r,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return Promise.all(i.map(n))}async function YE({fs:t,dir:e,gitdir:r,treePair:i}){let n=i[1]==="stage",s=i.map(h=>typeof h=="string"?rN[h]():h),a=[],u=await Jn({fs:t,cache:{},dir:e,gitdir:r,trees:s,map:async(h,[p,g])=>{if(!(h==="."||await Ls.isIgnored({fs:t,dir:e,gitdir:r,filepath:h}))&&g)return(!p||await p.oid()!==await g.oid()&&await g.oid()!==void 0)&&a.push([p,g]),{mode:await g.mode(),pa
Line truncated
|
||||
`).map(a=>n.add(a))}),n}static async write({fs:e,gitdir:r,oids:i}){ya===null&&(ya=new Yo.default);let n=N(r,"shallow");if(i.size>0){let s=[...i].join(`
|
||||
`)+`
|
||||
`;await fa.acquire(n,async function(){await e.write(n,s,{encoding:"utf8"})})}else await fa.acquire(n,async function(){await e.rm(n)})}};async function kN({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${i}`)}async function AN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=await t.readdir(O(r,"objects/pack"));s=s.filter(a=>a.endsWith(".idx"));for(let a of s){let o=`${r}/objects/pack/${a}`,l=await Ig({fs:t,cache:e,filename:o,getExternalRefDelta:n});if(l.error)throw new ue(l.error);if(l.offsets.has(i))return!0}return!1}async function xE({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=o=>Je({fs:t,cache:e,gitdir:r,oid:o}),a=await kN({fs:t,gitdir:r,oid:i});return a||(a=await AN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s})),a}function CN(t){let n="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===n}function JE(t,e){let r=t.map(i=>i.split("=",1)[0]);return e.filter(i=>{let n=i.split("=",1)[0];return r.includes(n)})}var gd={name:"isomorphic-git",version:"1.37.4",agent:"git/isomorphic-git@1.37.4"},Vo=class{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let r=this._waiting;this._waiting=null,r({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}};function TN(t){let e=t.indexOf("\r"),r=t.indexOf(`
|
||||
`);return e===-1&&r===-1?-1:e===-1?r+1:r===-1?e+1:r===e+1?r+1:Math.min(e,r)+1}function eS(t){let e=new Vo,r="";return(async()=>(await su(t,i=>{for(i=i.toString("utf8"),r+=i;;){let n=TN(r);if(n===-1)break;e.write(r.slice(0,n)),r=r.slice(n)}}),r.length>0&&e.write(r),e.end()))(),e}var dd=class{static demux(e){let r=ot.streamReader(e),i=new Vo,n=new Vo,s=new Vo,a=async function(){let o=await r();if(o===null)return a();if(o===!0){i.end(),s.end(),e.error?n.destroy(e.error):n.end();return}switch(o[0]){case 1:{n.write(o.slice(1));break}case 2:{s.write(o.slice(1));break}case 3:{let l=o.slice(1);s.write(l),i.end(),s.end(),n.destroy(new Error(l.toString("utf8")));return}default:i.write(o)}a()};return a(),{packetlines:i,packfile:n,progress:s}}};async function PN(t){let{packetlines:e,packfile:r,progress:i}=dd.demux(t),n=[],s=[],a=[],o=!1,l=!1;return new Promise((c,u)=>{su(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new As(h)),n.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new As(h)),s.push(h)}else if(d.startsWith("ACK")){let[,h,p]=d.split(" ");a.push({oid:h,status:p}),p||(l=!0)}else d.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))})})}function RN({capabilities:t=[],wants:e=[],haves:r=[],shallows:i=[],depth:n=null,since:s=null,exclude:a=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let c of e)o.push(ot.encode(`want ${c}${l}
|
||||
`)),l="";for(let c of i)o.push(ot.encode(`shallow ${c}
|
||||
`));n!==null&&o.push(ot.encode(`deepen ${n}
|
||||
`)),s!==null&&o.push(ot.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)}
|
||||
`));for(let c of a)o.push(ot.encode(`deepen-not ${c}
|
||||
`));o.push(ot.flush());for(let c of r)o.push(ot.encode(`have ${c}
|
||||
`));return o.push(ot.encode(`done
|
||||
`)),o}async function Og({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:l,ref:c,remoteRef:u,remote:f,url:d,corsProxy:h,depth:p=null,since:g=null,exclude:v=[],relative:_=!1,tags:b=!1,singleBranch:S=!1,headers:k={},prune:E=!1,pruneTags:A=!1}){let w=c||await Is({fs:t,gitdir:l,test:!0}),x=await dt.get({fs:t,gitdir:l}),y=f||w&&await x.get(`branch.${w}.remote`)||"origin",C=d||await x.get(`remote.${y}.url`);if(typeof C=="undefined")throw new Fr("remote OR url");let P=u||w&&await x.get(`branch.${w}.merge`)||c||"HEAD";h===void 0&&(h=await x.get("http.corsProxy"));let L=el.getRemoteHelperFor({url:C}),N=await L.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:o,corsProxy:h,service:"git-upload-pack",url:C,headers:k,protocolVersion:1}),B=N.auth,ge=N.refs;if(ge.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!N.capabilities.has("shallow"))throw new ks("shallow","depth");if(g!==null&&!N.capabilities.has("deepen-since"))throw new ks("deepen-since","since");if(v.length>0&&!N.capabilities.has("deepen-not"))throw new ks("deepen-not","exclude");if(_===!0&&!N.capabilities.has("deepen-relative"))throw new ks("deepen-relative","relative");let{oid:Le,fullref:ke}=W.resolveAgainstMap({ref:P,map:ge});for(let D of ge.keys())D===ke||D==="HEAD"||D.startsWith("refs/heads/")||b&&D.startsWith("refs/tags/")||ge.delete(D);let ne=JE([...N.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${gd.agent}`]);_&&ne.push("deepen-relative");let Ee=S?[Le]:ge.values(),_e=S?[w]:await W.listRefs({fs:t,gitdir:l,filepath:"refs"}),z=[];for(let D of _e)try{D=await W.expand({fs:t,gitdir:l,ref:D});let M=await W.resolve({fs:t,gitdir:l,ref:D});await xE({fs:t,cache:e,gitdir:l,oid:M})&&z.push(M)}catch(M){}z=[...new Set(z)];let X=await va.read({fs:t,gitdir:l}),V=N.capabilities.has("shallow")?[...X]:[],Ne=RN({capabilities:ne,wants:Ee,haves:z,shallows:V,depth:p,since:g,exclude:v}),gr=Buffer.from(await fd(Ne)),Nt=await L.connect({http:r,onProgress:i,corsProxy:h,service:"git-upload-pack",url:C,auth:B,body:[gr],headers:k}),Fe=await PN(Nt.body);Nt.headers&&(Fe.headers=Nt.headers);for(let D of Fe.shallows)if(!X.has(D))try{let{object:M}=await Je({fs:t,cache:e,gitdir:l,oid:D}),ae=new Mr(M),Te=await Promise.all(ae.headers().parent.map(Tr=>xE({fs:t,cache:e,gitdir:l,oid:Tr})));Te.length===0||Te.every(Tr=>Tr)||X.add(D)}catch(M){X.add(D)}for(let D of Fe.unshallows)X.delete(D);if(await va.write({fs:t,gitdir:l,oids:X}),S){let D=new Map([[ke,Le]]),M=new Map,ae=10,Te=ke;for(;ae--;){let vo=N.symrefs.get(Te);if(vo===void 0)break;M.set(Te,vo),Te=vo}let Bt=ge.get(Te);Bt&&D.set(Te,Bt);let{pruned:Tr}=await W.updateRemoteRefs({fs:t,gitdir:l,remote:y,refs:D,symrefs:M,tags:b,prune:E});E&&(Fe.pruned=Tr)}else{let{pruned:D}=await W.updateRemoteRefs({fs:t,gitdir:l,remote:y,refs:ge,symrefs:N.symrefs,tags:b,prune:E,pruneTags:A});E&&(Fe.pruned=D)}if(Fe.HEAD=N.symrefs.get("HEAD"),Fe.HEAD===void 0){let{oid:D}=W.resolveAgainstMap({ref:"HEAD",map:ge});for(let[M,ae]of ge.entries())if(M!=="HEAD"&&ae===D){Fe.HEAD=M;break}}let Pt=ke.startsWith("refs/tags")?"tag":"branch";if(Fe.FETCH_HEAD={oid:Le,description:`${Pt} '${da(ke)}' of ${C}`},i||n){let D=eS(Fe.progress);su(D,async M=>{if(n&&await n(M),i){let ae=M.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);ae&&await i({phase:ae[1].trim(),loaded:parseInt(ae[2],10),total:parseInt(ae[3],10)})}})}let Rt=Buffer.from(await fd(Fe.packfile));if(Nt.body.error)throw Nt.body.error;let Ye=Rt.slice(-20).toString("hex"),J={defaultBranch:Fe.HEAD,fetchHead:Fe.FETCH_HEAD.oid,fetchHeadDescription:Fe.FETCH_HEAD.description};if(Fe.headers&&(J.headers=Fe.headers),E&&(J.pruned=Fe.pruned),Ye!==""&&!CN(Rt)){J.packfile=`objects/pack/pack-${Ye}.pack`;let D=O(l,J.packfile);await t.write(D,Rt);let M=Te=>Je({fs:t,cache:e,gitdir:l,oid:Te}),ae=await Nc.fromPack({pack:Rt,getExternalRefDelta:M,onProgress:i});await t.write(D.replace(/\.pack$/,".idx"),await ae.toBuffer())}return J}async function tS({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:O(r,".git"),defaultBranch:n="master"}){if(await t.exists(i+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(a=>i+"/"+a);for(let a of s)await t.mkdir(a);await t.write(i+"/config",`[core]
|
||||
`;await ya.acquire(n,async function(){await e.write(n,s,{encoding:"utf8"})})}else await ya.acquire(n,async function(){await e.rm(n)})}};async function cN({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${i}`)}async function uN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=await t.readdir(N(r,"objects/pack"));s=s.filter(a=>a.endsWith(".idx"));for(let a of s){let o=`${r}/objects/pack/${a}`,l=await av({fs:t,cache:e,filename:o,getExternalRefDelta:n});if(l.error)throw new he(l.error);if(l.offsets.has(i))return!0}return!1}async function tS({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=o=>st({fs:t,cache:e,gitdir:r,oid:o}),a=await cN({fs:t,gitdir:r,oid:i});return a||(a=await uN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s})),a}function $d({config:t,onAuth:e}){return e&&(async(r,i)=>{let n=i.username||await t.get(`credential.${r}.username`);return e(r,n?{...i,username:n}:i)})}function fN(t){let n="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===n}function AS(t,e){let r=t.map(i=>i.split("=",1)[0]);return e.filter(i=>{let n=i.split("=",1)[0];return r.includes(n)})}var Ld={name:"isomorphic-git",version:"1.40.0",agent:"git/isomorphic-git@1.40.0"},qo=class{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let r=this._waiting;this._waiting=null,r({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}};function dN(t){let e=t.indexOf("\r"),r=t.indexOf(`
|
||||
`);return e===-1&&r===-1?-1:e===-1?r+1:r===-1?e+1:r===e+1?r+1:Math.min(e,r)+1}function TS(t){let e=new qo,r="";return(async()=>(await vu(t,i=>{for(i=i.toString("utf8"),r+=i;;){let n=dN(r);if(n===-1)break;e.write(r.slice(0,n)),r=r.slice(n)}}),r.length>0&&e.write(r),e.end()))(),e}var Fd=class{static demux(e){let r=dt.streamReader(e),i=new qo,n=new qo,s=new qo,a=async function(){let o=await r();if(o===null)return a();if(o===!0){i.end(),s.end(),e.error?n.destroy(e.error):n.end();return}switch(o[0]){case 1:{n.write(o.slice(1));break}case 2:{s.write(o.slice(1));break}case 3:{let l=o.slice(1);s.write(l),i.end(),s.end(),n.destroy(new Error(l.toString("utf8")));return}default:i.write(o)}a()};return a(),{packetlines:i,packfile:n,progress:s}}};async function hN(t){let{packetlines:e,packfile:r,progress:i}=Fd.demux(t),n=[],s=[],a=[],o=!1,l=!1;return new Promise((c,u)=>{vu(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new Ms(h)),n.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new Ms(h)),s.push(h)}else if(d.startsWith("ACK")){let[,h,p]=d.split(" ");a.push({oid:h,status:p}),p||(l=!0)}else d.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))})})}function pN({capabilities:t=[],wants:e=[],haves:r=[],shallows:i=[],depth:n=null,since:s=null,exclude:a=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let c of e)o.push(dt.encode(`want ${c}${l}
|
||||
`)),l="";for(let c of i)o.push(dt.encode(`shallow ${c}
|
||||
`));n!==null&&o.push(dt.encode(`deepen ${n}
|
||||
`)),s!==null&&o.push(dt.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)}
|
||||
`));for(let c of a)o.push(dt.encode(`deepen-not ${c}
|
||||
`));o.push(dt.flush());for(let c of r)o.push(dt.encode(`have ${c}
|
||||
`));return o.push(dt.encode(`done
|
||||
`)),o}async function lv({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:l,ref:c,remoteRef:u,remote:f,url:d,corsProxy:h,depth:p=null,since:g=null,exclude:v=[],relative:b=!1,tags:_=!1,singleBranch:C=!1,headers:x={},prune:E=!1,pruneTags:A=!1}){let w=c||await Bs({fs:t,gitdir:l,test:!0}),S=await vt.get({fs:t,gitdir:l}),y=f||w&&await S.get(`branch.${w}.remote`)||"origin",P=d||await S.get(`remote.${y}.url`);if(typeof P=="undefined")throw new Or("remote OR url");let T=u||w&&await S.get(`branch.${w}.merge`)||c||"HEAD";h===void 0&&(h=await S.get("http.corsProxy"));let I=nl.getRemoteHelperFor({url:P}),M=await I.discover({http:r,onAuth:$d({config:S,onAuth:s}),onAuthSuccess:a,onAuthFailure:$d({config:S,onAuth:o}),corsProxy:h,service:"git-upload-pack",url:P,headers:x,protocolVersion:1}),B=M.auth,re=M.refs;if(re.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!M.capabilities.has("shallow"))throw new Is("shallow","depth");if(g!==null&&!M.capabilities.has("deepen-since"))throw new Is("deepen-since","since");if(v.length>0&&!M.capabilities.has("deepen-not"))throw new Is("deepen-not","exclude");if(b===!0&&!M.capabilities.has("deepen-relative"))throw new Is("deepen-relative","relative");let{oid:Ae,fullref:K}=q.resolveAgainstMap({ref:T,map:re});for(let L of re.keys())L===K||L==="HEAD"||L.startsWith("refs/heads/")||_&&L.startsWith("refs/tags/")||re.delete(L);let Q=AS([...M.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Ld.agent}`]);b&&Q.push("deepen-relative");let fe=C?[Ae]:re.values(),ce=C?[w]:await q.listRefs({fs:t,gitdir:l,filepath:"refs"}),z=[];for(let L of ce)try{L=await q.expand({fs:t,gitdir:l,ref:L});let W=await q.resolve({fs:t,gitdir:l,ref:L});await tS({fs:t,cache:e,gitdir:l,oid:W})&&z.push(W)}catch(W){}z=[...new Set(z)];let X=await Pa.read({fs:t,gitdir:l}),j=M.capabilities.has("shallow")?[...X]:[],Ze=pN({capabilities:Q,wants:fe,haves:z,shallows:j,depth:p,since:g,exclude:v}),$r=k.from(await Rd(Ze)),cr=await I.connect({http:r,onProgress:i,corsProxy:h,service:"git-upload-pack",url:P,auth:B,body:[$r],headers:x}),Ie=await hN(cr.body);cr.headers&&(Ie.headers=cr.headers);for(let L of Ie.shallows)if(!X.has(L))try{let{object:W}=await st({fs:t,cache:e,gitdir:l,oid:L}),xe=new Nr(W),Xe=await Promise.all(xe.headers().parent.map(ti=>tS({fs:t,cache:e,gitdir:l,oid:ti})));Xe.length===0||Xe.every(ti=>ti)||X.add(L)}catch(W){X.add(L)}for(let L of Ie.unshallows)X.delete(L);if(await Pa.write({fs:t,gitdir:l,oids:X}),C){let L=new Map([[K,Ae]]),W=new Map,xe=10,Xe=K;for(;xe--;){let aa=M.symrefs.get(Xe);if(aa===void 0)break;W.set(Xe,aa),Xe=aa}let Dt=re.get(Xe);Dt&&L.set(Xe,Dt);let{pruned:ti}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:y,refs:L,symrefs:W,tags:_,prune:E});E&&(Ie.pruned=ti)}else{let{pruned:L}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:y,refs:re,symrefs:M.symrefs,tags:_,prune:E,pruneTags:A});E&&(Ie.pruned=L)}if(Ie.HEAD=M.symrefs.get("HEAD"),Ie.HEAD===void 0){let{oid:L}=q.resolveAgainstMap({ref:"HEAD",map:re});for(let[W,xe]of re.entries())if(W!=="HEAD"&&xe===L){Ie.HEAD=W;break}}let yt=K.startsWith("refs/tags")?"tag":"branch";if(Ie.FETCH_HEAD={oid:Ae,description:`${yt} '${xa(K)}' of ${P}`},i||n){let L=TS(Ie.progress);vu(L,async W=>{if(n&&await n(W),i){let xe=W.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);xe&&await i({phase:xe[1].trim(),loaded:parseInt(xe[2],10),total:parseInt(xe[3],10)})}})}let Tt=k.from(await Rd(Ie.packfile));if(cr.body.error)throw cr.body.error;let Ke=Tt.slice(-20).toString("hex"),J={defaultBranch:Ie.HEAD,fetchHead:Ie.FETCH_HEAD.oid,fetchHeadDescription:Ie.FETCH_HEAD.description};if(Ie.headers&&(J.headers=Ie.headers),E&&(J.pruned=Ie.pruned),Ke!==""&&!fN(Tt)){J.packfile=`objects/pack/pack-${Ke}.pack`;let L=N(l,J.packfile);await t.write(L,Tt);let W=Xe=>st({fs:t,cache:e,gitdir:l,oid:Xe}),xe=await qc.fromPack({pack:Tt,getExternalRefDelta:W,onProgress:i});await t.write(L.replace(/\.pack$/,".idx"),await xe.toBuffer())}return J}async function PS({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:N(r,".git"),defaultBranch:n="master"}){if(await t.exists(i+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(a=>i+"/"+a);for(let a of s)await t.mkdir(a);await t.write(i+"/config",`[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = false
|
||||
bare = ${e}
|
||||
@@ -86,23 +91,18 @@ gpgsig`+hg(a)+`
|
||||
`)+` symlinks = false
|
||||
ignorecase = true
|
||||
`),await t.write(i+"/HEAD",`ref: refs/heads/${n}
|
||||
`)}async function $N({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:d,ref:h,remote:p,depth:g,since:v,exclude:_,relative:b,singleBranch:S,noCheckout:k,noTags:E,headers:A,nonBlocking:w,batchSize:x=100}){try{if(await tS({fs:t,gitdir:u}),await VE({fs:t,gitdir:u,remote:p,url:f,force:!1}),d){let P=await dt.get({fs:t,gitdir:u});await P.set("http.corsProxy",d),await dt.save({fs:t,gitdir:u,config:P})}let{defaultBranch:y,fetchHead:C}=await Og({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:u,ref:h,remote:p,corsProxy:d,depth:g,since:v,exclude:_,relative:b,singleBranch:S,headers:A,tags:!E});if(C===null)return;h=h||y,h=h.replace("refs/heads/",""),await Mg({fs:t,cache:e,onProgress:i,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:p,noCheckout:k,nonBlocking:w,batchSize:x})}catch(y){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),y}}async function rS({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:c=O(l,".git"),url:u,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:p=void 0,since:g=void 0,exclude:v=[],relative:_=!1,singleBranch:b=!1,noCheckout:S=!1,noTags:k=!1,headers:E={},cache:A={},nonBlocking:w=!1,batchSize:x=100}){try{T("fs",t),T("http",e),T("gitdir",c),S||T("dir",l),T("url",u);let y=new Q(t),C=await ee({fsp:y,dotgit:c});return await $N({fs:y,cache:A,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:C,url:u,corsProxy:f,ref:d,remote:h,depth:p,since:g,exclude:v,relative:_,singleBranch:b,noCheckout:S,noTags:k,headers:E,nonBlocking:w,batchSize:x})}catch(y){throw y.caller="git.clone",y}}async function iS({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),message:n,author:s,committer:a,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h,cache:p={}}){try{T("fs",t),l||T("message",n),o&&T("onSign",e);let g=new Q(t),v=await ee({fsp:g,dotgit:i});return await ru({fs:g,cache:p,onSign:e,gitdir:v,message:n,author:s,committer:a,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,ref:f,parent:d,tree:h})}catch(g){throw g.caller="git.commit",g}}async function nS({fs:t,dir:e,gitdir:r=O(e,".git"),fullname:i=!1,test:n=!1}){try{T("fs",t),T("gitdir",r);let s=new Q(t),a=await ee({fsp:s,dotgit:r});return await Is({fs:s,gitdir:a,fullname:i,test:n})}catch(s){throw s.caller="git.currentBranch",s}}async function FN({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await W.exists({fs:t,gitdir:e,ref:r}))throw new He(r);let n=await W.expand({fs:t,gitdir:e,ref:r}),s=await Is({fs:t,gitdir:e,fullname:!0});if(n===s){let l=await W.resolve({fs:t,gitdir:e,ref:n});await W.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await W.deleteRef({fs:t,gitdir:e,ref:n});let a=da(r),o=await dt.get({fs:t,gitdir:e});await o.deleteSection("branch",a),await dt.save({fs:t,gitdir:e,config:o})}async function sS({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i}){try{T("fs",t),T("ref",i);let n=new Q(t),s=await ee({fsp:n,dotgit:r});return await FN({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteBranch",n}}async function aS({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i}){try{T("fs",t),T("ref",i);let n=new Q(t),s=await ee({fsp:n,dotgit:r});await W.deleteRef({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteRef",n}}async function IN({fs:t,gitdir:e,remote:r}){let i=await dt.get({fs:t,gitdir:e});await i.deleteSection("remote",r),await dt.save({fs:t,gitdir:e,config:i})}async function oS({fs:t,dir:e,gitdir:r=O(e,".git"),remote:i}){try{T("fs",t),T("remote",i);let n=new Q(t),s=await ee({fsp:n,dotgit:r});return await IN({fs:n,gitdir:s,remote:i})}catch(n){throw n.caller="git.deleteRemote",n}}async function MN({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await W.deleteRef({fs:t,gitdir:e,ref:r})}async function lS({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i}){try{T("fs",t),T("ref",i);let n=new Q(t),s=await ee({fsp:n,dotgit:r});return await MN({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteTag",n}}async function DN({fs:t,gitdir:e,oid:r}){let i=r.slice(0,2);return(await t.readdir(`${e}/objects/${i}`)).map(s=>`${i}${s}`).filter(s=>s.startsWith(r))}async function ON({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=[],a=await t.readdir(O(r,"objects/pack"));a=a.filter(o=>o.endsWith(".idx"));for(let o of a){let l=`${r}/objects/pack/${o}`,c=await Ig({fs:t,cache:e,filename:l,getExternalRefDelta:n});if(c.error)throw new ue(c.error);for(let u of c.offsets.keys())u.startsWith(i)&&s.push(u)}return s}async function LN({fs:t,cache:e,gitdir:r,oid:i}){let n=o=>Je({fs:t,cache:e,gitdir:r,oid:o}),s=await DN({fs:t,gitdir:r,oid:i}),a=await ON({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n});for(let o of a)s.indexOf(o)===-1&&s.push(o);if(s.length===1)return s[0];throw s.length>1?new Bc("oids",i,s):new He(`an object matching "${i}"`)}async function cS({fs:t,dir:e,gitdir:
Line truncated
|
||||
`)),i.push(ot.encode(`agent=${gd.agent}
|
||||
`)),(r||e||t)&&i.push(ot.delim()),r&&i.push(ot.encode("peel")),e&&i.push(ot.encode("symrefs")),t&&i.push(ot.encode(`ref-prefix ${t}`)),i.push(ot.flush()),i}async function DS({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:o=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{T("http",t),T("url",s);let d=await Jo.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:l});if(d.protocolVersion===1)return yS(d,c,u,f);let h=await zN({prefix:c,symrefs:u,peelTags:f}),p=await Jo.connect({http:t,auth:d.auth,headers:a,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,body:h});return VN(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function OS({fs:t,dir:e,gitdir:r=O(e,".git")}){try{T("fs",t),T("gitdir",r);let i=new Q(t),n=await ee({fsp:i,dotgit:r});return W.listTags({fs:i,gitdir:n})}catch(i){throw i.caller="git.listTags",i}}function WN(t,e){return t.committer.timestamp-e.committer.timestamp}var qN="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function EE({fs:t,cache:e,gitdir:r,oid:i,fileId:n}){if(n===qN)return;let s=i,a,o=await Ko({fs:t,cache:e,gitdir:r,oid:i}),l=o.tree;return n===o.oid?a=o.path:(a=await LS({fs:t,cache:e,gitdir:r,tree:l,fileId:n,oid:s}),Array.isArray(a)&&(a.length===0?a=void 0:a.length===1&&(a=a[0]))),a}async function LS({fs:t,cache:e,gitdir:r,tree:i,fileId:n,oid:s,filepaths:a=[],parentPath:o=""}){let l=i.entries().map(function(c){let u;return c.oid===n?(u=O(o,c.path),a.push(u)):c.type==="tree"&&(u=Je({fs:t,cache:e,gitdir:r,oid:c.oid}).then(function({object:f}){return LS({fs:t,cache:e,gitdir:r,tree:Ir.from(f),fileId:n,oid:s,filepaths:a,parentPath:O(o,c.path)})})),u});return await Promise.all(l),a}async function YN({fs:t,cache:e,gitdir:r,filepath:i,ref:n,depth:s,since:a,force:o,follow:l}){let c=typeof a=="undefined"?void 0:Math.floor(a.valueOf()/1e3),u=[],f=await va.read({fs:t,gitdir:r}),d=await W.resolve({fs:t,gitdir:r,ref:n}),h=[await vn({fs:t,cache:e,gitdir:r,oid:d})],p,g,v;function _(b){v&&i&&u.push(b)}for(;h.length>0;){let b=h.pop();if(c!==void 0&&b.commit.committer.timestamp<=c)break;if(i){let S;try{S=await iu({fs:t,cache:e,gitdir:r,oid:b.commit.tree,filepath:i}),g&&p!==S&&u.push(g),p=S,g=b,v=!0}catch(k){if(k instanceof He){let E=l&&p;if(E&&(E=await EE({fs:t,cache:e,gitdir:r,oid:b.commit.tree,fileId:p}),E))if(Array.isArray(E)){if(g){let A=await EE({fs:t,cache:e,gitdir:r,oid:g.commit.tree,fileId:p});if(Array.isArray(A))if(E=E.filter(w=>A.indexOf(w)===-1),E.length===1)E=E[0],i=E,g&&u.push(g);else{E=!1,g&&u.push(g);break}}}else i=E,g&&u.push(g);if(!E){if(v&&p&&(u.push(g),!o))break;if(!o&&!l)throw k}g=b,v=!1}else throw k}}else u.push(b);if(s!==void 0&&u.length===s){_(b);break}if(!f.has(b.oid))for(let S of b.commit.parent){let k=await vn({fs:t,cache:e,gitdir:r,oid:S});h.map(E=>E.oid).includes(k.oid)||h.push(k)}h.length===0&&_(b),h.sort((S,k)=>WN(S.commit,k.commit))}return u}async function NS({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,ref:n="HEAD",depth:s,since:a,force:o,follow:l,cache:c={}}){try{T("fs",t),T("gitdir",r),T("ref",n);let u=new Q(t),f=await ee({fsp:u,dotgit:r});return await YN({fs:u,cache:c,gitdir:f,filepath:i,ref:n,depth:s,since:a,force:o,follow:l})}catch(u){throw u.caller="git.log",u}}async function BS({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,cache:g={},mergeDriver:v,allowUnrelatedHistories:_=!1}){try{T("fs",t),p&&T("onSign",e);let b=new Q(t),S=await ee({fsp:b,dotgit:i}),k=await $s({fs:b,gitdir:S,author:d});if(!k&&(!o||!a))throw new Zt("author");let E=await ga({fs:b,gitdir:S,author:k,committer:h});if(!E&&(!o||!a))throw new Zt("committer");return await fS({fs:b,cache:g,dir:r,gitdir:S,ours:n,theirs:s,fastForward:a,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:k,committer:E,signingKey:p,onSign:e,mergeDriver:v,allowUnrelatedHistories:_})}catch(b){throw b.caller="git.merge",b}}var XN={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function HS({fs:t,cache:e,dir:r,gitdir:i=O(r,".git"),oids:n}){let s=new SE,a=[];function o(u,f){let d=Buffer.from(u,f);a.push(d),s.update(d)}async function l({stype:u,object:f}){let d=XN[u],h=f.length,p=h>15?128:0,g=h&15;h=h>>>4;let v=(p|d|g).toString(16);for(o(v,"hex");p;)p=h>127?128:0,v=p|h&127,o($g(2,v),"hex"),h=h>>>7;o(Buffer.from(await OE(f)))}o("PACK"),o("00000002","hex"),o($g(8,n.length),"hex");for(let u of n){let{type:f,object:d}=await Je({fs:t,cache:e,gitdir:i,oid:u});await l({write:o,object:d,stype:f})}let c=s.digest();return a.push(c),a}async function ZN({fs:t,cache:e,gitdir:r,oids:i,write:n}){let s=await HS({fs:t,cache:e,gitdir:r,oids:i}),a=Buffer.from(await fd(s)),l=`pack-${a.slice(-20).toString("hex")}.pack`;return n?(await t.write(O(r,`objects/pack/${l}`),a),{filename:l}):{fil
Line truncated
|
||||
`)}async function mN({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:d,ref:h,remote:p,depth:g,since:v,exclude:b,relative:_,singleBranch:C,noCheckout:x,noTags:E,headers:A,nonBlocking:w,batchSize:S=100}){try{if(await PS({fs:t,gitdir:u}),await yS({fs:t,gitdir:u,remote:p,url:f,force:!1}),d){let T=await vt.get({fs:t,gitdir:u});await T.set("http.corsProxy",d),await vt.save({fs:t,gitdir:u,config:T})}let{defaultBranch:y,fetchHead:P}=await lv({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:u,ref:h,remote:p,corsProxy:d,depth:g,since:v,exclude:b,relative:_,singleBranch:C,headers:A,tags:!E});if(P===null)return;h=h||y,h=h.replace("refs/heads/",""),await ov({fs:t,cache:e,onProgress:i,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:p,noCheckout:x,nonBlocking:w,batchSize:S})}catch(y){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),y}}async function gN({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:c=N(l,".git"),url:u,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:p=void 0,since:g=void 0,exclude:v=[],relative:b=!1,singleBranch:_=!1,noCheckout:C=!1,noTags:x=!1,headers:E={},cache:A={},nonBlocking:w=!1,batchSize:S=100}){try{R("fs",t),R("http",e),R("gitdir",c),C||R("dir",l),R("url",u);let y=new te(t),P=await ie({fsp:y,dotgit:c});return await mN({fs:y,cache:A,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:P,url:u,corsProxy:f,ref:d,remote:h,depth:p,since:g,exclude:v,relative:b,singleBranch:_,noCheckout:C,noTags:x,headers:E,nonBlocking:w,batchSize:S})}catch(y){throw y.caller="git.clone",y}}async function vN({fs:t,onSign:e,dir:r,gitdir:i=N(r,".git"),message:n,author:s,committer:a,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,disallowEmpty:f=!1,ref:d,parent:h,tree:p,cache:g={}}){try{R("fs",t),l||R("message",n),o&&R("onSign",e);let v=new te(t),b=await ie({fsp:v,dotgit:i});return await pu({fs:v,cache:g,onSign:e,gitdir:b,message:n,author:s,committer:a,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,disallowEmpty:f,ref:d,parent:h,tree:p})}catch(v){throw v.caller="git.commit",v}}async function wN({fs:t,dir:e,gitdir:r=N(e,".git"),fullname:i=!1,test:n=!1}){try{R("fs",t),R("gitdir",r);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await Bs({fs:s,gitdir:a,fullname:i,test:n})}catch(s){throw s.caller="git.currentBranch",s}}async function bN({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await q.exists({fs:t,gitdir:e,ref:r}))throw new ze(r);let n=await q.expand({fs:t,gitdir:e,ref:r}),s=await Bs({fs:t,gitdir:e,fullname:!0});if(n===s){let l=await q.resolve({fs:t,gitdir:e,ref:n});await q.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await q.deleteRef({fs:t,gitdir:e,ref:n});let a=xa(r),o=await vt.get({fs:t,gitdir:e});await o.deleteSection("branch",a),await vt.save({fs:t,gitdir:e,config:o})}async function _N({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i}){try{R("fs",t),R("ref",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await bN({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteBranch",n}}async function yN({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i}){try{R("fs",t),R("ref",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});await q.deleteRef({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteRef",n}}async function xN({fs:t,gitdir:e,remote:r}){let i=await vt.get({fs:t,gitdir:e});await i.deleteSection("remote",r),await vt.save({fs:t,gitdir:e,config:i})}async function EN({fs:t,dir:e,gitdir:r=N(e,".git"),remote:i}){try{R("fs",t),R("remote",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await xN({fs:n,gitdir:s,remote:i})}catch(n){throw n.caller="git.deleteRemote",n}}async function SN({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await q.deleteRef({fs:t,gitdir:e,ref:r})}async function kN({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i}){try{R("fs",t),R("ref",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await SN({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteTag",n}}async function CN({fs:t,gitdir:e,oid:r}){let i=r.slice(0,2);return(await t.readdir(`${e}/objects/${i}`)).map(s=>`${i}${s}`).filter(s=>s.startsWith(r))}async function AN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=[],a=await t.readdir(N(r,"objects/pack"));a=a.filter(o=>o.endsWith(".idx"));for(let o of a){let l=`${r}/objects/pack/${o}`,c=await av({fs:t,cache:e,filename:l,getExternalRefDelta:n});if(c.error)throw new he(c.error);for(let u of c.offsets.keys())u.startsWith(i)&&s.push(u)}return s}async function TN({fs:t,cache:e,gitdir:r,oid:i}){let n=o=>st({fs:t,cache:e,gitdir:r,oid:o}),s=await CN({fs:t,gitdir:r,oid:i}),a=await AN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n});for(let o of a)s.indexOf(o)===-1&&s.push(o);if(s.length===1)return s[0];throw s.length>1?new Yc("oids",i,s):new ze(`an object matching "${iLine truncated
|
||||
`)),i.push(dt.encode(`agent=${Ld.agent}
|
||||
`)),(r||e||t)&&i.push(dt.delim()),r&&i.push(dt.encode("peel")),e&&i.push(dt.encode("symrefs")),t&&i.push(dt.encode(`ref-prefix ${t}`)),i.push(dt.flush()),i}async function iB({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:o=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{R("http",t),R("url",s);let d=await il.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:l});if(d.protocolVersion===1)return IS(d,c,u,f);let h=await rB({prefix:c,symrefs:u,peelTags:f}),p=await il.connect({http:t,auth:d.auth,headers:a,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,body:h});return tB(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function nB({fs:t,dir:e,gitdir:r=N(e,".git")}){try{R("fs",t),R("gitdir",r);let i=new te(t),n=await ie({fsp:i,dotgit:r});return q.listTags({fs:i,gitdir:n})}catch(i){throw i.caller="git.listTags",i}}function sB(t,e){return t.committer.timestamp-e.committer.timestamp}var aB="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function rS({fs:t,cache:e,gitdir:r,oid:i,fileId:n}){if(n===aB)return;let s=i,a,o=await tl({fs:t,cache:e,gitdir:r,oid:i}),l=o.tree;return n===o.oid?a=o.path:(a=await OS({fs:t,cache:e,gitdir:r,tree:l,fileId:n,oid:s}),Array.isArray(a)&&(a.length===0?a=void 0:a.length===1&&(a=a[0]))),a}async function OS({fs:t,cache:e,gitdir:r,tree:i,fileId:n,oid:s,filepaths:a=[],parentPath:o=""}){let l=i.entries().map(function(c){let u;return c.oid===n?(u=N(o,c.path),a.push(u)):c.type==="tree"&&(u=st({fs:t,cache:e,gitdir:r,oid:c.oid}).then(function({object:f}){return OS({fs:t,cache:e,gitdir:r,tree:Lr.from(f),fileId:n,oid:s,filepaths:a,parentPath:N(o,c.path)})})),u});return await Promise.all(l),a}async function oB({fs:t,cache:e,gitdir:r,filepath:i,ref:n,depth:s,since:a,force:o,follow:l,includeChanges:c}){let u=typeof a=="undefined"?void 0:Math.floor(a.valueOf()/1e3),f=[],d=await Pa.read({fs:t,gitdir:r}),h=await q.resolve({fs:t,gitdir:r,ref:n}),p=[await xn({fs:t,cache:e,gitdir:r,oid:h})],g,v,b;function _(C){b&&i&&f.push(C)}for(;p.length>0;){let C=p.pop();if(u!==void 0&&C.commit.committer.timestamp<=u)break;if(i){let x;try{x=await mu({fs:t,cache:e,gitdir:r,oid:C.commit.tree,filepath:i}),v&&g!==x&&f.push(v),g=x,v=C,b=!0}catch(E){if(E instanceof ze){let A=l&&g;if(A&&(A=await rS({fs:t,cache:e,gitdir:r,oid:C.commit.tree,fileId:g}),A))if(Array.isArray(A)){if(v){let w=await rS({fs:t,cache:e,gitdir:r,oid:v.commit.tree,fileId:g});if(Array.isArray(w))if(A=A.filter(S=>w.indexOf(S)===-1),A.length===1)A=A[0],i=A,v&&f.push(v);else{A=!1,v&&f.push(v);break}}}else i=A,v&&f.push(v);if(!A){if(b&&g&&(f.push(v),!o))break;if(!o&&!l)throw E}v=C,b=!1}else throw E}}else f.push(C);if(s!==void 0&&f.length===s){_(C);break}if(!d.has(C.oid))for(let x of C.commit.parent){let E=await xn({fs:t,cache:e,gitdir:r,oid:x});p.map(A=>A.oid).includes(E.oid)||p.push(E)}p.length===0&&_(C),p.sort((x,E)=>sB(x.commit,E.commit))}if(c)for(let C of f)C.commit.changes=await lB({fs:t,cache:e,gitdir:r,commit:C,shallow:d.has(C.oid)});return f}async function lB({fs:t,cache:e,gitdir:r,commit:i,shallow:n}){let s=n||!i.commit.parent[0]?"4b825dc642cb6eb9a060e54bf8d69288fbee4904":i.commit.parent[0];return Jn({fs:t,cache:e,gitdir:r,trees:[Dr({ref:i.oid}),Dr({ref:s})],map:async(a,[o,l])=>{let[c,u]=await Promise.all([o&&o.type(),l&&l.type()]);if(c==="tree")return u&&u!=="tree"?[null,await l.oid(),a]:void 0;if(u==="tree")return c?[await o.oid(),null,a]:void 0;let[f,d]=await Promise.all([o?o.oid():null,l?l.oid():null]);if(f!==d)return[f,d,a]}})}async function cB({fs:t,dir:e,gitdir:r=N(e,".git"),filepath:i,ref:n="HEAD",depth:s,since:a,force:o,follow:l,includeChanges:c=!1,cache:u={}}){try{R("fs",t),R("gitdir",r),R("ref",n);let f=new te(t),d=await ie({fsp:f,dotgit:r});return await oB({fs:f,cache:u,gitdir:d,filepath:i,ref:n,depth:s,since:a,force:o,follow:l,includeChanges:c})}catch(f){throw f.caller="git.log",f}}async function uB({fs:t,onSign:e,dir:r,gitdir:i=N(r,".git"),ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,cache:g={},mergeDriver:v,allowUnrelatedHistories:b=!1}){try{R("fs",t),p&&R("onSign",e);let _=new te(t),C=await ie({fsp:_,dotgit:i}),x=await Ns({fs:_,gitdir:C,author:d});if(!x&&(!o||!a))throw new Jt("author");let E=await Ta({fs:_,gitdir:C,author:x,committer:h});if(!E&&(!o||!a))throw new Jt("committer");return await RS({fs:_,cache:g,dir:r,gitdir:C,ours:n,theirs:s,fastForward:a,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:x,committer:E,signingKey:p,onSign:e,mergeDriver:v,allowUnrelatedHistories:b})}catch(_){throw _.caller="git.merge",_}}var fB={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function LS({fs:t,cache:e,dir:r,gitdir:i=N(r,".git"),oids:n}){let s=new sv.default,a=[];function o(u,f){let d=k.from(u,f);a.push(d),s.update(d)
Line truncated
|
||||
`),n=await i();let s=r.toString("utf8").split(`
|
||||
`);if(n=s.shift(),!n.startsWith("unpack "))throw new ma('unpack ok" or "unpack [error message]',n);e.ok=n==="unpack ok",e.ok||(e.error=n.slice(7)),e.refs={};for(let a of s){if(a.trim()==="")continue;let o=a.slice(0,2),l=a.slice(3),c=l.indexOf(" ");c===-1&&(c=l.length);let u=l.slice(0,c),f=l.slice(c+1);e.refs[u]={ok:o==="ok",error:f}}return e}async function JN({capabilities:t=[],triplets:e=[]}){let r=[],i=`\0 ${t.join(" ")}`;for(let n of e)r.push(ot.encode(`${n.oldoid} ${n.oid} ${n.fullRef}${i}
|
||||
`)),i="";return r.push(ot.flush()),r}async function eB({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p=!1,delete:g=!1,corsProxy:v,headers:_={}}){let b=u||await Is({fs:t,gitdir:c});if(typeof b=="undefined")throw new Fr("ref");let S=await dt.get({fs:t,gitdir:c});d=d||await S.get(`branch.${b}.pushRemote`)||await S.get("remote.pushDefault")||await S.get(`branch.${b}.remote`)||"origin";let k=h||await S.get(`remote.${d}.pushurl`)||await S.get(`remote.${d}.url`);if(typeof k=="undefined")throw new Fr("remote OR url");let E=f||await S.get(`branch.${b}.merge`);if(typeof k=="undefined")throw new Fr("remoteRef");v===void 0&&(v=await S.get("http.corsProxy"));let A=await W.expand({fs:t,gitdir:c,ref:b}),w=g?"0000000000000000000000000000000000000000":await W.resolve({fs:t,gitdir:c,ref:A}),x=el.getRemoteHelperFor({url:k}),y=await x.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:o,corsProxy:v,service:"git-receive-pack",url:k,headers:_,protocolVersion:1}),C=y.auth,P;if(!E)P=A;else try{P=await W.expandAgainstMap({ref:E,map:y.refs})}catch(X){if(X instanceof He)P=E.startsWith("refs/")?E:`refs/heads/${E}`;else throw X}let L=y.refs.get(P)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:k,localRef:{ref:g?"(delete)":A,oid:w},remoteRef:{ref:P,oid:L}}))throw new Zo;let N=!y.capabilities.has("no-thin"),B=new Set;if(!g){let X=[...y.refs.values()],V=new Set;if(L!=="0000000000000000000000000000000000000000"){let Ne=await Lg({fs:t,cache:e,gitdir:c,oids:[w,L]});for(let gr of Ne)X.push(gr);N&&(V=await _g({fs:t,cache:e,gitdir:c,oids:Ne}))}if(!X.includes(w)){let Ne=await KN({fs:t,cache:e,gitdir:c,start:[w],finish:X});B=await _g({fs:t,cache:e,gitdir:c,oids:Ne})}if(N){try{let Ne=await W.resolve({fs:t,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:gr}=await W.resolveAgainstMap({ref:Ne.replace(`refs/remotes/${d}/`,""),fullref:Ne,map:y.refs}),Nt=[gr];for(let Fe of await _g({fs:t,cache:e,gitdir:c,oids:Nt}))V.add(Fe)}catch(Ne){}for(let Ne of V)B.delete(Ne)}if(w===L&&(p=!0),!p){if(A.startsWith("refs/tags")&&L!=="0000000000000000000000000000000000000000")throw new Xo("tag-exists");if(w!=="0000000000000000000000000000000000000000"&&L!=="0000000000000000000000000000000000000000"&&!await AS({fs:t,cache:e,gitdir:c,oid:w,ancestor:L,depth:-1}))throw new Xo("not-fast-forward")}}let ge=JE([...y.capabilities],["report-status","side-band-64k",`agent=${gd.agent}`]),Le=await JN({capabilities:ge,triplets:[{oldoid:L,oid:w,fullRef:P}]}),ke=g?[]:await HS({fs:t,cache:e,gitdir:c,oids:[...B]}),ne=await x.connect({http:r,onProgress:i,corsProxy:v,service:"git-receive-pack",url:k,auth:C,headers:_,body:[...Le,...ke]}),{packfile:Ee,progress:_e}=await dd.demux(ne.body);if(n){let X=eS(_e);su(X,async V=>{await n(V)})}let z=await QN(Ee);if(ne.headers&&(z.headers=ne.headers),d&&z.ok&&z.refs[P].ok&&!A.startsWith("refs/tags")){let X=`refs/remotes/${d}/${P.replace("refs/heads","")}`;g?await W.deleteRef({fs:t,gitdir:c,ref:X}):await W.writeRef({fs:t,gitdir:c,ref:X,value:w})}if(z.ok&&Object.values(z.refs).every(X=>X.ok))return z;{let X=Object.entries(z.refs).filter(([V,Ne])=>!Ne.ok).map(([V,Ne])=>`
|
||||
- ${V}: ${Ne.error}`).join("");throw new Wc(X,z)}}async function jS({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,dir:l,gitdir:c=O(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:p=!1,delete:g=!1,corsProxy:v,headers:_={},cache:b={}}){try{T("fs",t),T("http",e),T("gitdir",c);let S=new Q(t),k=await ee({fsp:S,dotgit:c});return await eB({fs:S,cache:b,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,gitdir:k,ref:u,remoteRef:f,remote:d,url:h,force:p,delete:g,corsProxy:v,headers:_})}catch(S){throw S.caller="git.push",S}}async function VS({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await Je({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Kr.from(s).parse().object,VS({fs:t,cache:e,gitdir:r,oid:i});if(n!=="blob")throw new yr(i,n,"blob");return{oid:i,blob:new Uint8Array(s)}}async function zS({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){return n!==void 0&&(i=await iu({fs:t,cache:e,gitdir:r,oid:i,filepath:n})),await VS({fs:t,cache:e,gitdir:r,oid:i})}async function WS({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,filepath:n,cache:s={}}){try{T("fs",t),T("gitdir",r),T("oid",i);let a=new Q(t),o=await ee({fsp:a,dotgit:r});return await zS({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readBlob",a}}async function Ng({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,cache:n={}}){try{T("fs",t),T("gitdir",r),T("oid",i);let s=new Q(t),a=await ee({fsp:s,dotgit:r});return await vn({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readCommit",s}}async function tB({fs:t,cache:e,gitdir:r,ref:i="refs/notes/commits",oid:n}){let s=await W.resolve({gitdir:r,fs:t,ref:i}),{blob:a}=await zS({fs:t,cache:e,gitdir:r,oid:s,filepath:n});return a}async function qS({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i="refs/notes/commits",oid:n,cache:s={}}){try{T("fs",t),T("gitdir",r),T("ref",i),T("oid",n);let a=new Q(t),o=await ee({fsp:a,dotgit:r});return await tB({fs:a,cache:s,gitdir:o,ref:i,oid:n})}catch(a){throw a.caller="git.readNote",a}}async function YS({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,format:n="parsed",filepath:s=void 0,encoding:a=void 0,cache:o={}}){try{T("fs",t),T("gitdir",r),T("oid",i);let l=new Q(t),c=await ee({fsp:l,dotgit:r});s!==void 0&&(i=await iu({fs:l,cache:o,gitdir:c,oid:i,filepath:s}));let f=await Je({fs:l,cache:o,gitdir:c,oid:i,format:n==="parsed"?"content":n});if(f.oid=i,n==="parsed")switch(f.format="parsed",f.type){case"commit":f.object=Mr.from(f.object).parse();break;case"tree":f.object=Ir.from(f.object).entries();break;case"blob":a?f.object=f.object.toString(a):(f.object=new Uint8Array(f.object),f.format="content");break;case"tag":f.object=Kr.from(f.object).parse();break;default:throw new yr(f.oid,f.type,"blob|commit|tag|tree")}else(f.format==="deflated"||f.format==="wrapped")&&(f.type=f.format);return f}catch(l){throw l.caller="git.readObject",l}}async function rB({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await Je({fs:t,cache:e,gitdir:r,oid:i,format:"content"});if(n!=="tag")throw new yr(i,n,"tag");let a=Kr.from(s);return{oid:i,tag:a.parse(),payload:a.payload()}}async function XS({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,cache:n={}}){try{T("fs",t),T("gitdir",r),T("oid",i);let s=new Q(t),a=await ee({fsp:s,dotgit:r});return await rB({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readTag",s}}async function ZS({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,filepath:n=void 0,cache:s={}}){try{T("fs",t),T("gitdir",r),T("oid",i);let a=new Q(t),o=await ee({fsp:a,dotgit:r});return await rl({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readTree",a}}async function KS({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,cache:n={}}){try{T("fs",t),T("gitdir",r),T("filepath",i);let s=new Q(t),a=await ee({fsp:s,dotgit:r});await ft.acquire({fs:s,gitdir:a,cache:n},async function(o){o.delete({filepath:i})})}catch(s){throw s.caller="git.remove",s}}async function iB({fs:t,cache:e,onSign:r,gitdir:i,ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l}){let c;try{c=await W.resolve({gitdir:i,fs:t,ref:n})}catch(p){if(!(p instanceof He))throw p}let f=(await rl({fs:t,cache:e,gitdir:i,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==s);let d=await nu({fs:t,gitdir:i,tree:f});return await ru({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote'
|
||||
`,author:a,committer:o,signingKey:l})}async function QS({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l,cache:c={}}){try{T("fs",t),T("gitdir",i),T("oid",s);let u=new Q(t),f=await ee({fsp:u,dotgit:i}),d=await $s({fs:u,gitdir:f,author:a});if(!d)throw new Zt("author");let h=await ga({fs:u,gitdir:f,author:d,committer:o});if(!h)throw new Zt("committer");return await iB({fs:u,cache:c,onSign:e,gitdir:f,ref:n,oid:s,author:d,committer:h,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function nB({fs:t,gitdir:e,oldref:r,ref:i,checkout:n=!1}){if(!tu(i,!0))throw new Gi(i,Dc.clean(i));if(!tu(r,!0))throw new Gi(r,Dc.clean(r));let s=`refs/heads/${r}`,a=`refs/heads/${i}`;if(await W.exists({fs:t,gitdir:e,ref:a}))throw new Ui("branch",i,!1);let l=await W.resolve({fs:t,gitdir:e,ref:s,depth:1});await W.writeRef({fs:t,gitdir:e,ref:a,value:l}),await W.deleteRef({fs:t,gitdir:e,ref:s});let u=await Is({fs:t,gitdir:e,fullname:!0})===s;(n||u)&&await W.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function JS({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,oldref:n,checkout:s=!1}){try{T("fs",t),T("gitdir",r),T("ref",i),T("oldref",n);let a=new Q(t),o=await ee({fsp:a,dotgit:r});return await nB({fs:a,gitdir:o,ref:i,oldref:n,checkout:s})}catch(a){throw a.caller="git.renameBranch",a}}async function ek({gitdir:t,type:e,object:r}){return wn(Cs.wrap({type:e,object:r}))}async function tk({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,ref:n,cache:s={}}){try{T("fs",t),T("gitdir",r),T("filepath",i);let a=new Q(t),o=await ee({fsp:a,dotgit:r}),l,c;try{l=await W.resolve({fs:a,gitdir:o,ref:n||"HEAD"})}catch(d){if(n)throw d}if(l)try{l=await iu({fs:a,cache:s,gitdir:o,oid:l,filepath:i})}catch(d){l=null}let u={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},f=e&&await a.read(O(e,i));f&&(c=await ek({gitdir:o,type:"blob",object:f}),l===c&&(u=await a.lstat(O(e,i)))),await ft.acquire({fs:a,gitdir:o,cache:s},async function(d){d.delete({filepath:i}),l&&d.insert({filepath:i,stats:u,oid:l})})}catch(a){throw a.caller="git.reset",a}}async function rk({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,depth:n}){try{T("fs",t),T("gitdir",r),T("ref",i);let s=new Q(t),a=await ee({fsp:s,dotgit:r});return await W.resolve({fs:s,gitdir:a,ref:i,depth:n})}catch(s){throw s.caller="git.resolveRef",s}}async function ik({fs:t,dir:e,gitdir:r=O(e,".git"),path:i,value:n,append:s=!1}){try{T("fs",t),T("gitdir",r),T("path",i);let a=new Q(t),o=await ee({fsp:a,dotgit:r}),l=await dt.get({fs:a,gitdir:o});s?await l.append(i,n):await l.set(i,n),await dt.save({fs:a,gitdir:o,config:l})}catch(a){throw a.caller="git.setConfig",a}}async function nk({fs:t,gitdir:e,commit:r}){let i=Mr.from(r).toObject();return await Dr({fs:t,gitdir:e,type:"commit",object:i,format:"content"})}var hd=class t{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(e/60)),i=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${r.toString().padStart(2,"0")}${i}`}static createStashReflogEntry(e,r,i){let n=e.name.replace(/\s/g,""),s="0000000000000000000000000000000000000000",a=Math.floor(Date.now()/1e3),o=t.timezoneOffsetForRefLogEntry;return`${s} ${r} ${n} ${e.email} ${a} ${o} ${i}
|
||||
`);if(n=s.shift(),!n.startsWith("unpack "))throw new Aa('unpack ok" or "unpack [error message]',n);e.ok=n==="unpack ok",e.ok||(e.error=n.slice(7)),e.refs={};for(let a of s){if(a.trim()==="")continue;let o=a.slice(0,2),l=a.slice(3),c=l.indexOf(" ");c===-1&&(c=l.length);let u=l.slice(0,c),f=l.slice(c+1);e.refs[u]={ok:o==="ok",error:f}}return e}async function vB({capabilities:t=[],triplets:e=[]}){let r=[],i=`\0 ${t.join(" ")}`;for(let n of e)r.push(dt.encode(`${n.oldoid} ${n.oid} ${n.fullRef}${i}
|
||||
`)),i="";return r.push(dt.flush()),r}async function wB({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p=!1,delete:g=!1,corsProxy:v,headers:b={}}){let _=u||await Bs({fs:t,gitdir:c});if(typeof _=="undefined")throw new Or("ref");let C=await vt.get({fs:t,gitdir:c});d=d||await C.get(`branch.${_}.pushRemote`)||await C.get("remote.pushDefault")||await C.get(`branch.${_}.remote`)||"origin";let x=h||await C.get(`remote.${d}.pushurl`)||await C.get(`remote.${d}.url`);if(typeof x=="undefined")throw new Or("remote OR url");let E=f||await C.get(`branch.${_}.merge`);if(typeof x=="undefined")throw new Or("remoteRef");v===void 0&&(v=await C.get("http.corsProxy"));let A=await q.expand({fs:t,gitdir:c,ref:_}),w=g?"0000000000000000000000000000000000000000":await q.resolve({fs:t,gitdir:c,ref:A}),S=nl.getRemoteHelperFor({url:x}),y=await S.discover({http:r,onAuth:$d({config:C,onAuth:s}),onAuthSuccess:a,onAuthFailure:$d({config:C,onAuth:o}),corsProxy:v,service:"git-receive-pack",url:x,headers:b,protocolVersion:1}),P=y.auth,T;if(!E)T=A;else try{T=await q.expandAgainstMap({ref:E,map:y.refs})}catch(X){if(X instanceof ze)T=E.startsWith("refs/")?E:`refs/heads/${E}`;else throw X}let I=y.refs.get(T)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:x,localRef:{ref:g?"(delete)":A,oid:w},remoteRef:{ref:T,oid:I}}))throw new el;let M=!y.capabilities.has("no-thin"),B=new Set;if(!g){let X=[...y.refs.values()],j=new Set;if(I!=="0000000000000000000000000000000000000000"){let Ze=await cv({fs:t,cache:e,gitdir:c,oids:[w,I]});for(let $r of Ze)X.push($r);M&&(j=await Wg({fs:t,cache:e,gitdir:c,oids:Ze}))}if(!X.includes(w)){let Ze=await mB({fs:t,cache:e,gitdir:c,start:[w],finish:X});B=await Wg({fs:t,cache:e,gitdir:c,oids:Ze})}if(M){try{let Ze=await q.resolve({fs:t,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:$r}=await q.resolveAgainstMap({ref:Ze.replace(`refs/remotes/${d}/`,""),fullref:Ze,map:y.refs}),cr=[$r];for(let Ie of await Wg({fs:t,cache:e,gitdir:c,oids:cr}))j.add(Ie)}catch(Ze){}for(let Ze of j)B.delete(Ze)}if(w===I&&(p=!0),!p){if(A.startsWith("refs/tags")&&I!=="0000000000000000000000000000000000000000")throw new Jo("tag-exists");if(w!=="0000000000000000000000000000000000000000"&&I!=="0000000000000000000000000000000000000000"&&!await MS({fs:t,cache:e,gitdir:c,oid:w,ancestor:I,depth:-1}))throw new Jo("not-fast-forward")}}let re=AS([...y.capabilities],["report-status","side-band-64k",`agent=${Ld.agent}`]),Ae=await vB({capabilities:re,triplets:[{oldoid:I,oid:w,fullRef:T}]}),K=g?[]:await LS({fs:t,cache:e,gitdir:c,oids:[...B]}),Q=await S.connect({http:r,onProgress:i,corsProxy:v,service:"git-receive-pack",url:x,auth:P,headers:b,body:[...Ae,...K]}),{packfile:fe,progress:ce}=await Fd.demux(Q.body);if(n){let X=TS(ce);vu(X,async j=>{await n(j)})}let z=await gB(fe);if(Q.headers&&(z.headers=Q.headers),d&&z.ok&&z.refs[T].ok&&!A.startsWith("refs/tags")){let X=`refs/remotes/${d}/${T.replace("refs/heads","")}`;g?await q.deleteRef({fs:t,gitdir:c,ref:X}):await q.writeRef({fs:t,gitdir:c,ref:X,value:w})}if(z.ok&&Object.values(z.refs).every(X=>X.ok))return z;{let X=Object.entries(z.refs).filter(([j,Ze])=>!Ze.ok).map(([j,Ze])=>`
|
||||
- ${j}: ${Ze.error}`).join("");throw new ru(X,z)}}async function bB({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,dir:l,gitdir:c=N(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:p=!1,delete:g=!1,corsProxy:v,headers:b={},cache:_={}}){try{R("fs",t),R("http",e),R("gitdir",c);let C=new te(t),x=await ie({fsp:C,dotgit:c});return await wB({fs:C,cache:_,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,gitdir:x,ref:u,remoteRef:f,remote:d,url:h,force:p,delete:g,corsProxy:v,headers:b})}catch(C){throw C.caller="git.push",C}}async function NS({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await st({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=ni.from(s).parse().object,NS({fs:t,cache:e,gitdir:r,oid:i});if(n!=="blob")throw new xr(i,n,"blob");return{oid:i,blob:new Uint8Array(s)}}async function BS({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){return n!==void 0&&(i=await mu({fs:t,cache:e,gitdir:r,oid:i,filepath:n})),await NS({fs:t,cache:e,gitdir:r,oid:i})}async function wu({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,filepath:n,cache:s={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await BS({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readBlob",a}}async function HS({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await xn({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readCommit",s}}async function _B({fs:t,cache:e,gitdir:r,ref:i="refs/notes/commits",oid:n}){let s=await q.resolve({gitdir:r,fs:t,ref:i}),{blob:a}=await BS({fs:t,cache:e,gitdir:r,oid:s,filepath:n});return a}async function yB({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i="refs/notes/commits",oid:n,cache:s={}}){try{R("fs",t),R("gitdir",r),R("ref",i),R("oid",n);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await _B({fs:a,cache:s,gitdir:o,ref:i,oid:n})}catch(a){throw a.caller="git.readNote",a}}async function xB({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,format:n="parsed",filepath:s=void 0,encoding:a=void 0,cache:o={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let l=new te(t),c=await ie({fsp:l,dotgit:r});s!==void 0&&(i=await mu({fs:l,cache:o,gitdir:c,oid:i,filepath:s}));let f=await st({fs:l,cache:o,gitdir:c,oid:i,format:n==="parsed"?"content":n});if(f.oid=i,n==="parsed")switch(f.format="parsed",f.type){case"commit":f.object=Nr.from(f.object).parse();break;case"tree":f.object=Lr.from(f.object).entries();break;case"blob":a?f.object=f.object.toString(a):(f.object=new Uint8Array(f.object),f.format="content");break;case"tag":f.object=ni.from(f.object).parse();break;default:throw new xr(f.oid,f.type,"blob|commit|tag|tree")}else(f.format==="deflated"||f.format==="wrapped")&&(f.type=f.format);return f}catch(l){throw l.caller="git.readObject",l}}async function EB({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await st({fs:t,cache:e,gitdir:r,oid:i,format:"content"});if(n!=="tag")throw new xr(i,n,"tag");let a=ni.from(s);return{oid:i,tag:a.parse(),payload:a.payload()}}async function SB({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await EB({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readTag",s}}async function kB({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,filepath:n=void 0,cache:s={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await al({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readTree",a}}async function CB({fs:t,dir:e,gitdir:r=N(e,".git"),filepath:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("filepath",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});await gt.acquire({fs:s,gitdir:a,cache:n},async function(o){o.delete({filepath:i})})}catch(s){throw s.caller="git.remove",s}}async function AB({fs:t,cache:e,onSign:r,gitdir:i,ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l}){let c;try{c=await q.resolve({gitdir:i,fs:t,ref:n})}catch(p){if(!(p instanceof ze))throw p}let f=(await al({fs:t,cache:e,gitdir:i,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==s);let d=await gu({fs:t,gitdir:i,tree:f});return await pu({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote'
|
||||
`,author:a,committer:o,signingKey:l})}async function TB({fs:t,onSign:e,dir:r,gitdir:i=N(r,".git"),ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l,cache:c={}}){try{R("fs",t),R("gitdir",i),R("oid",s);let u=new te(t),f=await ie({fsp:u,dotgit:i}),d=await Ns({fs:u,gitdir:f,author:a});if(!d)throw new Jt("author");let h=await Ta({fs:u,gitdir:f,author:d,committer:o});if(!h)throw new Jt("committer");return await AB({fs:u,cache:c,onSign:e,gitdir:f,ref:n,oid:s,author:d,committer:h,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function PB({fs:t,gitdir:e,oldref:r,ref:i,checkout:n=!1}){if(!uu(i,!0))throw new qi(i,Zo.default.clean(i));if(!uu(r,!0))throw new qi(r,Zo.default.clean(r));let s=`refs/heads/${r}`,a=`refs/heads/${i}`;if(await q.exists({fs:t,gitdir:e,ref:a}))throw new Wi("branch",i,!1);let l=await q.resolve({fs:t,gitdir:e,ref:s,depth:1});await q.writeRef({fs:t,gitdir:e,ref:a,value:l}),await q.deleteRef({fs:t,gitdir:e,ref:s});let u=await Bs({fs:t,gitdir:e,fullname:!0})===s;(n||u)&&await q.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function RB({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i,oldref:n,checkout:s=!1}){try{R("fs",t),R("gitdir",r),R("ref",i),R("oldref",n);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await PB({fs:a,gitdir:o,ref:i,oldref:n,checkout:s})}catch(a){throw a.caller="git.renameBranch",a}}async function US({gitdir:t,type:e,object:r}){return En(Ds.wrap({type:e,object:r}))}async function $B({fs:t,dir:e,gitdir:r=N(e,".git"),filepath:i,ref:n,cache:s={}}){try{R("fs",t),R("gitdir",r),R("filepath",i);let a=new te(t),o=await ie({fsp:a,dotgit:r}),l,c;try{l=await q.resolve({fs:a,gitdir:o,ref:n||"HEAD"})}catch(d){if(n)throw d}if(l)try{l=await mu({fs:a,cache:s,gitdir:o,oid:l,filepath:i})}catch(d){l=null}let u={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},f=e&&await a.read(N(e,i));f&&(c=await US({gitdir:o,type:"blob",object:f}),l===c&&(u=await a.lstat(N(e,i)))),await gt.acquire({fs:a,gitdir:o,cache:s},async function(d){d.delete({filepath:i}),l&&d.insert({filepath:i,stats:u,oid:l})})}catch(a){throw a.caller="git.reset",a}}async function FB({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i,depth:n}){try{R("fs",t),R("gitdir",r),R("ref",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await q.resolve({fs:s,gitdir:a,ref:i,depth:n})}catch(s){throw s.caller="git.resolveRef",s}}async function IB({fs:t,dir:e,gitdir:r=N(e,".git"),path:i,value:n,append:s=!1}){try{R("fs",t),R("gitdir",r),R("path",i);let a=new te(t),o=await ie({fsp:a,dotgit:r}),l=await vt.get({fs:a,gitdir:o});s?await l.append(i,n):await l.set(i,n),await vt.save({fs:a,gitdir:o,config:l})}catch(a){throw a.caller="git.setConfig",a}}async function GS({fs:t,gitdir:e,commit:r}){let i=Nr.from(r).toObject();return await Br({fs:t,gitdir:e,type:"commit",object:i,format:"content"})}var Id=class t{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(e/60)),i=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${r.toString().padStart(2,"0")}${i}`}static createStashReflogEntry(e,r,i){let n=e.name.replace(/\s/g,""),s="0000000000000000000000000000000000000000",a=Math.floor(Date.now()/1e3),o=t.timezoneOffsetForRefLogEntry;return`${s} ${r} ${n} ${e.email} ${a} ${o} ${i}
|
||||
`}static getStashReflogEntry(e,r=!1){return e.split(`
|
||||
`).filter(s=>s).reverse().map((s,a)=>r?`stash@{${a}}: ${s.split(" ")[1]}`:s)}},wa=class t{constructor({fs:e,dir:r,gitdir:i=O(r,".git")}){Object.assign(this,{fs:e,dir:r,gitdir:i,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return O(this.gitdir,t.refStash)}get refLogsStashPath(){return O(this.gitdir,t.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await $s({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new Zt("author");return this._author}async getStashSHA(e,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:r,parent:i}){return nk({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:i,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let r=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>r.length-1))throw new Gi(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let i=await this.getStashSHA(e,r);return i?vn({fs:this.fs,cache:{},gitdir:this.gitdir,oid:i}):{}}async writeStashRef(e){return W.writeRef({fs:this.fs,gitdir:this.gitdir,ref:t.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let i=await this.getAuthor(),n=hd.createStashReflogEntry(i,e,r),s=this.refLogsStashPath;await Qo({filepath:s,entry:n},async()=>{let a=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,a+n,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let r=await this.fs.read(this.refLogsStashPath,"utf8");return hd.getStashReflogEntry(r,e)}};async function sk({fs:t,dir:e,gitdir:r,message:i=""}){let n=new wa({fs:t,dir:e,gitdir:r});await n.getAuthor();let s=await Is({fs:t,gitdir:r,fullname:!1}),a=await W.resolve({fs:t,gitdir:r,ref:"HEAD"}),l=(await Ng({fs:t,dir:e,gitdir:r,oid:a})).commit.message,c=[a],u=null,f=Zr({ref:"HEAD"}),d=await mE({fs:t,dir:e,gitdir:r,treePair:[Zr({ref:"HEAD"}),"stage"]});if(d){let v=await n.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(v),u=d,f=_a()}let h=await mE({fs:t,dir:e,gitdir:r,treePair:[f,"workdir"]});if(h){let v=await n.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:h,parent:[c[c.length-1]]});c.push(v),u=h}if(!u||!d&&!h)throw new He("changes, nothing to stash");let p=(i.trim()||`WIP on ${s}`)+`: ${a.substring(0,7)} ${l}`;return{stashCommit:await n.writeStashCommit({message:p,tree:u,parent:c}),stashMsg:p,branch:s,stashMgr:n}}async function sB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n,stashMsg:s,branch:a,stashMgr:o}=await sk({fs:t,dir:e,gitdir:r,message:i});return await o.writeStashRef(n),await o.writeStashReflogEntry({stashCommit:n,message:s}),await Dg({fs:t,dir:e,gitdir:r,ref:a,track:!1,force:!0}),n}async function aB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n}=await sk({fs:t,dir:e,gitdir:r,message:i});return n}async function ak({fs:t,dir:e,gitdir:r,refIdx:i=0}){let s=await new wa({fs:t,dir:e,gitdir:r}).readStashCommit(i),{parent:a=null}=s.commit?s.commit:{};if(!(!a||!Array.isArray(a)))for(let o=0;o<a.length-1;o++){let c=(await vn({fs:t,cache:{},gitdir:r,oid:a[o+1]})).commit.message.startsWith("stash-Index");await ZE({fs:t,dir:e,gitdir:r,stashCommit:a[o+1],parentCommit:a[o],wasStaged:c})}}async function ok({fs:t,dir:e,gitdir:r,refIdx:i=0}){let n=new wa({fs:t,dir:e,gitdir:r});if(!(await n.readStashCommit(i)).commit)return;let a=n.refStashPath;await Qo(a,async()=>{await t.exists(a)&&await t.rm(a)});let o=await n.readStashReflogs({parsed:!1});if(!o.length)return;o.splice(i,1);let l=n.refLogsStashPath;await Qo({reflogEntries:o,stashReflogPath:l,stashMgr:n},async()=>{if(o.length){await t.write(l,o.reverse().join(`
|
||||
`).filter(s=>s).reverse().map((s,a)=>r?`stash@{${a}}: ${s.split(" ")[1]}`:s)}},Ra=class t{constructor({fs:e,dir:r,gitdir:i=N(r,".git")}){Object.assign(this,{fs:e,dir:r,gitdir:i,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return N(this.gitdir,t.refStash)}get refLogsStashPath(){return N(this.gitdir,t.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await Ns({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new Jt("author");return this._author}async getStashSHA(e,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:r,parent:i}){return GS({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:i,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let r=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>r.length-1))throw new qi(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let i=await this.getStashSHA(e,r);return i?xn({fs:this.fs,cache:{},gitdir:this.gitdir,oid:i}):{}}async writeStashRef(e){return q.writeRef({fs:this.fs,gitdir:this.gitdir,ref:t.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let i=await this.getAuthor(),n=Id.createStashReflogEntry(i,e,r),s=this.refLogsStashPath;await rl({filepath:s,entry:n},async()=>{let a=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,a+n,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let r=await this.fs.read(this.refLogsStashPath,"utf8");return Id.getStashReflogEntry(r,e)}};async function jS({fs:t,dir:e,gitdir:r,message:i=""}){let n=new Ra({fs:t,dir:e,gitdir:r});await n.getAuthor();let s=await Bs({fs:t,gitdir:r,fullname:!1}),a=await q.resolve({fs:t,gitdir:r,ref:"HEAD"}),l=(await HS({fs:t,dir:e,gitdir:r,oid:a})).commit.message,c=[a],u=null,f=Dr({ref:"HEAD"}),d=await YE({fs:t,dir:e,gitdir:r,treePair:[Dr({ref:"HEAD"}),"stage"]});if(d){let v=await n.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(v),u=d,f=sl()}let h=await YE({fs:t,dir:e,gitdir:r,treePair:[f,"workdir"]});if(h){let v=await n.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:h,parent:[c[c.length-1]]});c.push(v),u=h}if(!u||!d&&!h)throw new ze("changes, nothing to stash");let p=(i.trim()||`WIP on ${s}`)+`: ${a.substring(0,7)} ${l}`;return{stashCommit:await n.writeStashCommit({message:p,tree:u,parent:c}),stashMsg:p,branch:s,stashMgr:n}}async function MB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n,stashMsg:s,branch:a,stashMgr:o}=await jS({fs:t,dir:e,gitdir:r,message:i});return await o.writeStashRef(n),await o.writeStashReflogEntry({stashCommit:n,message:s}),await ES({fs:t,dir:e,gitdir:r,ref:a,track:!1,force:!0}),n}async function DB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n}=await jS({fs:t,dir:e,gitdir:r,message:i});return n}async function VS({fs:t,dir:e,gitdir:r,refIdx:i=0}){let s=await new Ra({fs:t,dir:e,gitdir:r}).readStashCommit(i),{parent:a=null}=s.commit?s.commit:{};if(!(!a||!Array.isArray(a)))for(let o=0;o<a.length-1;o++){let c=(await xn({fs:t,cache:{},gitdir:r,oid:a[o+1]})).commit.message.startsWith("stash-Index");await kS({fs:t,dir:e,gitdir:r,stashCommit:a[o+1],parentCommit:a[o],wasStaged:c})}}async function zS({fs:t,dir:e,gitdir:r,refIdx:i=0}){let n=new Ra({fs:t,dir:e,gitdir:r});if(!(await n.readStashCommit(i)).commit)return;let a=n.refStashPath;await rl(a,async()=>{await t.exists(a)&&await t.rm(a)});let o=await n.readStashReflogs({parsed:!1});if(!o.length)return;o.splice(i,1);let l=n.refLogsStashPath;await rl({reflogEntries:o,stashReflogPath:l,stashMgr:n},async()=>{if(o.length){await t.write(l,o.reverse().join(`
|
||||
`)+`
|
||||
`,"utf8");let c=o[o.length-1].split(" ")[1];await n.writeStashRef(c)}else await t.rm(l)})}async function oB({fs:t,dir:e,gitdir:r}){return new wa({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}async function lB({fs:t,dir:e,gitdir:r}){let i=new wa({fs:t,dir:e,gitdir:r}),n=[i.refStashPath,i.refLogsStashPath];await Qo(n,async()=>{await Promise.all(n.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}async function cB({fs:t,dir:e,gitdir:r,refIdx:i=0}){await ak({fs:t,dir:e,gitdir:r,refIdx:i}),await ok({fs:t,dir:e,gitdir:r,refIdx:i})}async function lk({fs:t,dir:e,gitdir:r=O(e,".git"),op:i="push",message:n="",refIdx:s=0}){T("fs",t),T("dir",e),T("gitdir",r),T("op",i);let a={push:sB,apply:ak,drop:ok,list:oB,clear:lB,pop:cB,create:aB},o=["apply","drop","pop"];try{let l=new Q(t),c=await ee({fsp:l,dotgit:r});["refs","logs","logs/refs"].map(d=>O(c,d)).forEach(async d=>{await l.exists(d)||await l.mkdir(d)});let f=a[i];if(f){if(o.includes(i)&&s<0)throw new Gi(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await f({fs:l,dir:e,gitdir:c,message:n,refIdx:s})}throw new Error(`To be implemented: ${i}`)}catch(l){throw l.caller="git.stash",l}}async function ck({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,cache:n={}}){try{T("fs",t),T("gitdir",r),T("filepath",i);let s=new Q(t),a=await ee({fsp:s,dotgit:r});if(await Rs.isIgnored({fs:s,gitdir:a,dir:e,filepath:i}))return"ignored";let l=await uB({fs:s,cache:n,gitdir:a}),c=await uk({fs:s,cache:n,gitdir:a,tree:l,path:i}),u=await ft.acquire({fs:s,gitdir:a,cache:n},async function(v){for(let _ of v)if(_.path===i)return _;return null}),f=await s.lstat(O(e,i)),d=c!==null,h=u!==null,p=f!==null,g=async()=>{if(h&&!nd(u,f))return u.oid;{let v=await s.read(O(e,i)),_=await ek({gitdir:a,type:"blob",object:v});return h&&u.oid===_&&f.size!==-1&&ft.acquire({fs:s,gitdir:a,cache:n},async function(b){b.insert({filepath:i,stats:f,oid:_})}),_}};if(!d&&!p&&!h)return"absent";if(!d&&!p&&h)return"*absent";if(!d&&p&&!h)return"*added";if(!d&&p&&h)return await g()===u.oid?"added":"*added";if(d&&!p&&!h)return"deleted";if(d&&!p&&h)return c===u.oid,"*deleted";if(d&&p&&!h)return await g()===c?"*undeleted":"*undeletemodified";if(d&&p&&h){let v=await g();return v===c?v===u.oid?"unmodified":"*unmodified":v===u.oid?"modified":"*modified"}}catch(s){throw s.caller="git.status",s}}async function uk({fs:t,cache:e,gitdir:r,tree:i,path:n}){typeof n=="string"&&(n=n.split("/"));let s=n.shift();for(let a of i)if(a.path===s){if(n.length===0)return a.oid;let{type:o,object:l}=await Je({fs:t,cache:e,gitdir:r,oid:a.oid});if(o==="tree"){let c=Ir.from(l);return uk({fs:t,cache:e,gitdir:r,tree:c,path:n})}if(o==="blob")throw new yr(a.oid,o,"blob",n.join("/"))}return null}async function uB({fs:t,cache:e,gitdir:r}){let i;try{i=await W.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(s){if(s instanceof He)return[]}let{tree:n}=await rl({fs:t,cache:e,gitdir:r,oid:i});return n}async function fk({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i="HEAD",filepaths:n=["."],filter:s,cache:a={},ignored:o=!1}){try{T("fs",t),T("gitdir",r),T("ref",i);let l=new Q(t),c=await ee({fsp:l,dotgit:r});return await Ps({fs:l,cache:a,dir:e,gitdir:c,trees:[Zr({ref:i}),tl(),_a()],map:async function(u,[f,d,h]){if(!f&&!h&&d&&!o&&await Rs.isIgnored({fs:l,dir:e,filepath:u})||!n.some(w=>YE(u,w)))return null;if(s&&!s(u))return;let[p,g,v]=await Promise.all([f&&f.type(),d&&d.type(),h&&h.type()]),_=[p,g,v].includes("blob");if((p==="tree"||p==="special")&&!_)return;if(p==="commit")return null;if((g==="tree"||g==="special")&&!_)return;if(v==="commit")return null;if((v==="tree"||v==="special")&&!_)return;let b=p==="blob"?await f.oid():void 0,S=v==="blob"?await h.oid():void 0,k;p!=="blob"&&g==="blob"&&v!=="blob"?k="42":g==="blob"&&(k=await d.oid());let E=[void 0,b,k,S],A=E.map(w=>E.indexOf(w));return A.shift(),[u,...A]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function dk({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,object:n,force:s=!1}){try{T("fs",t),T("gitdir",r),T("ref",i);let a=new Q(t);if(i===void 0)throw new Fr("ref");i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`;let o=await ee({fsp:a,dotgit:r}),l=await W.resolve({fs:a,gitdir:o,ref:n||"HEAD"});if(!s&&await W.exists({fs:a,gitdir:o,ref:i}))throw new Ui("tag",i);await W.writeRef({fs:a,gitdir:o,ref:i,value:l})}catch(a){throw a.caller="git.tag",a}}async function hk({fs:t,dir:e,gitdir:r=O(e,".git"),cache:i={},filepath:n,oid:s,mode:a,add:o,remove:l,force:c}){try{T("fs",t),T("gitdir",r),T("filepath",n);let u=new Q(t),f=await ee({fsp:u,dotgit:r});if(l)return await ft.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!c){let p=await u.lstat(O(e,n));if(p){if(p.isDirectory())throw new Ts("directory");return}}h.has({filepath:n})&&h.delete({filepath:n})});let d;if(!s){if(d=await u.lstat(O(e,n)),!d)throw new He(`file at "${n}" on disk and "remove" not set`);if(d.isDirectory())throw new Ts("directory")}return await ft.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!o&&!h.has({filepath:n}))throw new He(`filLine truncated
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kB(t,e){if(t){if(typeof t=="string")return Nk(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Nk(t,e)}}function Nk(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function AB(t,e){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(t)))){var r=[],i=!0,n=!1,s=void 0;try{for(var a=t[Symbol.iterator](),o;!(i=(o=a.next()).done)&&(r.push(o.value),!(e&&r.length===e));i=!0);}catch(l){n=!0,s=l}finally{try{!i&&a.return!=null&&a.return()}finally{if(n)throw s}}return r}}function CB(t){if(Array.isArray(t))return t}var Hk=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?$/,Uk=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])?$/,Gk=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,jk=/^rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,Vk=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,zk=/^rgba?\(\s*(\d+%)\s+(\d+%)\s+(\d+%)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,Wk=/^hsla?\(\s*(\d+)(deg|rad|grad|turn)?\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/;function lu(t,e){return t.indexOf(e)>-1}function TB(t,e,r){var i=t/255,n=e/255,s=r/255,a=Math.max(i,n,s),o=Math.min(i,n,s),l=a-o,c=(a+o)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=function(){switch(a){case i:return(n-s)/l%6;case n:return(s-i)/l+2;default:return(i-n)/l+4}}();return[f*60,u*100,c*100]}function PB(t,e,r){var i=t/60,n=e/100,s=r/100,a=(1-Math.abs(2*s-1))*n,o=a*(1-Math.abs(i%2-1)),l=s-a/2,c=function(){return i<1?[a,o,0]:i<2?[o,a,0]:i<3?[0,a,o]:i<4?[0,o,a]:i<5?[o,0,a]:[a,0,o]}(),u=xr(c,3),f=u[0],d=u[1],h=u[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var RB=function(){function t(e){var r=xr(e,4),i=r[0],n=r[1],s=r[2],a=r[3];xB(this,t),this.values=[Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(n,10),255),0),Math.max(Math.min(parseInt(s,10),255),0),a==null?1:Math.max(Math.min(parseFloat(a),255),0)]}return EB(t,[{key:"toRgbString",value:function(){var r=xr(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return a===1?"rgb(".concat(i,", ").concat(n,", ").concat(s,")"):"rgba(".concat(i,", ").concat(n,", ").concat(s,", ").concat(a,")")}},{key:"toHslString",value:function(){var r=this.toHslaArray(),i=xr(r,4),n=i[0],s=i[1],a=i[2],o=i[3];return o===1?"hsl(".concat(n,", ").concat(s,"%, ").concat(a,"%)"):"hsla(".concat(n,", ").concat(s,"%, ").concat(a,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var r=xr(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return i=Number(i).toString(16).padStart(2,"0"),n=Number(n).toString(16).padStart(2,"0"),s=Number(s).toString(16).padStart(2,"0"),a=a<1?parseInt(a*255,10).toString(16).padStart(2,"0"):"","#".concat(i).concat(n).concat(s).concat(a)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var r=xr(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3],o=TB(i,n,s),l=xr(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,a]}}]),t}();function ol(t){var e=xr(t,4),r=e[0],i=e[1],n=e[2],s=e[3];return new RB([r,i,n,s])}function tv(t){var e=xr(t,3),r=e[0],i=e[1],n=e[2];return ol([r,i,n,1])}function Cd(t){var e=xr(t,4),r=e[0],i=e[1],n=e[2],s=e[3],a=PB(r,i,n),o=xr(a,3),l=o[0],c=o[1],u=o[2];return ol([l,c,u,s])}function qk(t){var e=xr(t,3),r=e[0],i=e[1],n=e[2];return Cd([r,i,n,1])}function $B(t){var e=Hk.exec(t)||Uk.exec(t),r=xr(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=parseInt(i.length<2?i.repeat(2):i,16),n=parseInt(n.length<2?n.repeat(2):n,16),s=parseInt(s.length<2?s.repeat(2):s,16),a=a&&(parseInt(a.length<2?a.repeat(2):a,16)/255).toPrecision(1)||1,ol([i,n,s,a])}function FB(t){var e=Gk.exec(t)||Vk.exec(t)||jk.exec(t)||zk.exec(t),r=xr(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=lu(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),n=lu(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),s=lu(s,"%")>0?parseInt(s,10)*255/100:parseInt(s,10),a=a===void 0?1:parseFloat(a)/(lu(a,"%")?100:1),ol([i,n,s,a])}function IB(t){var e=Wk.exec(t),r=xr(e,6),i=r[1],n=r[2],s=r[3],a=r[4],o=r[5];return n=n||"deg",i=(0,yB.default)(parseFloat(i),n,"deg"),s=parseFloat(s),a=parseFloat(a),o=o===void 0?1:parseFloat(o)/(lu(o,"%")?100:1),Cd([i,s,a,o])}function Yk(t){return Ok.default[t]?tv(Ok.default[t]):Hk.test(t)||Uk.test(t)?$B(t):Gk.test(t)||Vk.test(t)||jk.test(t)||zk.test(t)?FB(t):Wk.test(t)?IB(t):null}var MB={fromString:Yk,fromRgb:tv,fromRgba:ol,fromHsl:qk,fromHsla:Cd};Zn.default=MB});var oA=H((n9,aA)=>{m();aA.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,a=!1,o=n+1,l=[],c=[],u,f,d=function(){n>=s&&(u=r,f=n,r=i,i=u,n=s,s=f,a=!0,o=n+1)},h=function(g,v,_,b,S){return{startX:g,startY:v,endX:_,endY:b,r:S}},p=function(g,v,_){var b,S,k,E,A;for(v>_?b=l[g-1+o]:b=l[g+1+o],A=k=Math.max(v
Line truncated
|
||||
`});Ee=!1,z=ne.length}function Fe(Pt,Rt){var Ye="="+V,J=Pt.indexOf(Ye,Rt),D=c(Pt.substring(Pt.indexOf("=",Rt)+1,J)).split(" ");return X=D[0],V=D[D.length-1],J+Ye.length-1}for(y&&(y=y.split(" "),X=y[0],V=y[1]),_e=0;_e<C;_e++)B==P?u(X,x,_e)?(--_e,Ne(),B=L):x.charAt(_e)==`
|
||||
`?Nt(Ee):ke+=x.charAt(_e):B==L?(_e+=X.length-1,Le=t.tags[x.charAt(_e+1)],ge=Le?x.charAt(_e+1):"_v",ge=="="?(_e=Fe(x,_e),B=P):(Le&&_e++,B=N),Ee=_e):u(V,x,_e)?(ne.push({tag:ge,n:c(ke),otag:X,ctag:V,i:ge=="/"?Ee-X.length:_e+V.length}),ke="",_e+=V.length-1,B=P,ge=="{"&&(V=="}}"?_e++:l(ne[ne.length-1]))):ke+=x.charAt(_e);return Nt(Ee,!0),ne};function l(w){w.n.substr(w.n.length-1)==="}"&&(w.n=w.n.substring(0,w.n.length-1))}function c(w){return w.trim?w.trim():w.replace(/^\s*|\s*$/g,"")}function u(w,x,y){if(x.charAt(y)!=w.charAt(0))return!1;for(var C=1,P=w.length;C<P;C++)if(x.charAt(y+C)!=w.charAt(C))return!1;return!0}var f={_t:!0,"\n":!0,$:!0,"/":!0};function d(w,x,y,C){var P=[],L=null,N=null,B=null;for(N=y[y.length-1];w.length>0;){if(B=w.shift(),N&&N.tag=="<"&&!(B.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[B.tag]<=t.tags.$||h(B,C))y.push(B),B.nodes=d(w,B.tag,y,C);else if(B.tag=="/"){if(y.length===0)throw new Error("Closing tag without opener: /"+B.n);if(L=y.pop(),B.n!=L.n&&!p(B.n,L.n,C))throw new Error("Nesting error: "+L.n+" vs. "+B.n);return L.end=B.i,P}else B.tag==`
|
||||
`&&(B.last=w.length==0||w[0].tag==`
|
||||
`);P.push(B)}if(y.length>0)throw new Error("missing closing tag: "+y.pop().n);return P}function h(w,x){for(var y=0,C=x.length;y<C;y++)if(x[y].o==w.n)return w.tag="#",!0}function p(w,x,y){for(var C=0,P=y.length;C<P;C++)if(y[C].c==w&&y[C].o==x)return!0}function g(w){var x=[];for(var y in w)x.push('"'+b(y)+'": function(c,p,t,i) {'+w[y]+"}");return"{ "+x.join(",")+" }"}function v(w){var x=[];for(var y in w.partials)x.push('"'+b(y)+'":{name:"'+b(w.partials[y].name)+'", '+v(w.partials[y])+"}");return"partials: {"+x.join(",")+"}, subs: "+g(w.subs)}t.stringify=function(w,x,y){return"{code: function (c,p,i) { "+t.wrapMain(w.code)+" },"+v(w)+"}"};var _=0;t.generate=function(w,x,y){_=0;var C={code:"",subs:{},partials:{}};return t.walk(w,C),y.asString?this.stringify(C,x,y):this.makeTemplate(C,x,y)},t.wrapMain=function(w){return'var t=this;t.b(i=i||"");'+w+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(w,x,y){var C=this.makePartials(w);return C.code=new Function("c","p","i",this.wrapMain(w.code)),new this.template(C,x,this,y)},t.makePartials=function(w){var x,y={subs:{},partials:w.partials,name:w.name};for(x in y.partials)y.partials[x]=this.makePartials(y.partials[x]);for(x in w.subs)y.subs[x]=new Function("c","p","t","i",w.subs[x]);return y};function b(w){return w.replace(s,"\\\\").replace(r,'\\"').replace(i,"\\n").replace(n,"\\r").replace(a,"\\u2028").replace(o,"\\u2029")}function S(w){return~w.indexOf(".")?"d":"f"}function k(w,x){var y="<"+(x.prefix||""),C=y+w.n+_++;return x.partials[C]={name:w.n,partials:{}},x.code+='t.b(t.rp("'+b(C)+'",c,p,"'+(w.indent||"")+'"));',C}t.codegen={"#":function(w,x){x.code+="if(t.s(t."+S(w.n)+'("'+b(w.n)+'",c,p,1),c,p,0,'+w.i+","+w.end+',"'+w.otag+" "+w.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(w.nodes,x),x.code+="});c.pop();}"},"^":function(w,x){x.code+="if(!t.s(t."+S(w.n)+'("'+b(w.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(w.nodes,x),x.code+="};"},">":k,"<":function(w,x){var y={partials:{},code:"",subs:{},inPartial:!0};t.walk(w.nodes,y);var C=x.partials[k(w,x)];C.subs=y.subs,C.partials=y.partials},$:function(w,x){var y={subs:{},code:"",partials:x.partials,prefix:w.n};t.walk(w.nodes,y),x.subs[w.n]=y.code,x.inPartial||(x.code+='t.sub("'+b(w.n)+'",c,p,i);')},"\n":function(w,x){x.code+=A('"\\n"'+(w.last?"":" + i"))},_v:function(w,x){x.code+="t.b(t.v(t."+S(w.n)+'("'+b(w.n)+'",c,p,0)));'},_t:function(w,x){x.code+=A('"'+b(w.text)+'"')},"{":E,"&":E};function E(w,x){x.code+="t.b(t.t(t."+S(w.n)+'("'+b(w.n)+'",c,p,0)));'}function A(w){return"t.b("+w+");"}t.walk=function(w,x){for(var y,C=0,P=w.length;C<P;C++)y=t.codegen[w[C].tag],y&&y(w[C],x);return x},t.parse=function(w,x,y){return y=y||{},d(w,"",[],y.sectionTags||[])},t.cache={},t.cacheKey=function(w,x){return[w,!!x.asString,!!x.disableLambda,x.delimiters,!!x.modelGet].join("||")},t.compile=function(w,x){x=x||{};var y=t.cacheKey(w,x),C=this.cache[y];if(C){var P=C.partials;for(var L in P)delete P[L].instance;return C}return C=this.generate(this.parse(this.scan(w,x.delimiters),w,x),w,x),this.cache[y]=C}})(typeof Mw!="undefined"?Mw:Hogan)});var UP=H(Dw=>{m();var z5={};(function(t){t.Template=function(d,h,p,g){d=d||{},this.r=d.code||this.r,this.c=p,this.options=g||{},this.text=h||"",this.partials=d.partials||{},this.subs=d.subs||{},this.buf=""},t.Template.prototype={r:function(d,h,p){return""},v:u,t:c,render:function(h,p,g){return this.ri([h],p||{},g)},ri:function(d,h,p){return this.r(d,h,p)},ep:function(d,h){var p=this.partials[d],g=h[p.name];if(p.instance&&p.base==g)return p.instance;if(typeof g=="string"){if(!this.c)throw new Error("No compiler available.");g=this.c.compile(g,this.options)}if(!g)return null;if(this.partials[d].base=g,p.subs){h.stackText||(h.stackText={});for(key in p.subs)h.stackText[key]||(h.stackText[key]=this.activeSub!==void 0&&h.stackText[this.activeSub]?h.stackText[this.activeSub]:this.text);g=r(g,p.subs,p.partials,this.stackSubs,this.stackPartials,h.stackText)}return this.partials[d].instance=g,g},rp:function(d,h,p,g){var v=this.ep(d,p);return v?v.ri(h,p,g):""},rs:function(d,h,p){var g=d[d.length-1];if(!f(g)){p(d,h,this);return}for(var v=0;v<g.length;v++)d.push(g[v]),p(d,h,this),d.pop()},s:function(d,h,p,g,v,_,b){var S;return f(d)&&d.length===0?!1:(typeof d=="function"&&(d=this.ms(d,h,p,g,v,_,b)),S=!!d,!g&&S&&h&&h.push(typeof d=="object"?d:h[h.length-1]),S)},d:function(d,h,p,g){var v,_=d.split("."),b=this.f(_[0],h,p,g),S=this.options.modelGet,k=null;if(d==="."&&f(h[h.length-2]))b=h[h.length-1];else for(var E=1;E<_.length;E++)v=e(_[E],b,S),v!==void 0?(k=b,b=v):b="";return g&&!b?!1:(!g&&typeof b=="function"&&(h.push(k),b=this.mv(b,h,p),h.pop()),b)},f:function(d,h,p,g){for(var v=!1,_=null,b=!1,S=this.options.modelGet,k=h.length-1;k>=0;k--)if(_=h[k],v=e(d,_,S),v!==void 0){b=!0;break}return b?(!g&&typeof v=="function"&&(v=this.mv(v,h,p)),v):g?!1:""},ls:function(d,h,p,g,v,_){var b=this.options.delimiters;return this.options.delimiters=_,this.b(this.ct(c(d.call(h,v,p)),h,g)),this.options.delimiters=b,!1},ct:functio
Line truncated
|
||||
`,"utf8");let c=o[o.length-1].split(" ")[1];await n.writeStashRef(c)}else await t.rm(l)})}async function OB({fs:t,dir:e,gitdir:r}){return new Ra({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}async function LB({fs:t,dir:e,gitdir:r}){let i=new Ra({fs:t,dir:e,gitdir:r}),n=[i.refStashPath,i.refLogsStashPath];await rl(n,async()=>{await Promise.all(n.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}async function NB({fs:t,dir:e,gitdir:r,refIdx:i=0}){await VS({fs:t,dir:e,gitdir:r,refIdx:i}),await zS({fs:t,dir:e,gitdir:r,refIdx:i})}async function BB({fs:t,dir:e,gitdir:r=N(e,".git"),op:i="push",message:n="",refIdx:s=0}){R("fs",t),R("dir",e),R("gitdir",r),R("op",i);let a={push:MB,apply:VS,drop:zS,list:OB,clear:LB,pop:NB,create:DB},o=["apply","drop","pop"];try{let l=new te(t),c=await ie({fsp:l,dotgit:r});["refs","logs","logs/refs"].map(d=>N(c,d)).forEach(async d=>{await l.exists(d)||await l.mkdir(d)});let f=a[i];if(f){if(o.includes(i)&&s<0)throw new qi(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await f({fs:l,dir:e,gitdir:c,message:n,refIdx:s})}throw new Error(`To be implemented: ${i}`)}catch(l){throw l.caller="git.stash",l}}async function HB({fs:t,dir:e,gitdir:r=N(e,".git"),filepath:i,cache:n={},refresh:s=!0}){try{R("fs",t),R("gitdir",r),R("filepath",i);let a=new te(t),o=await ie({fsp:a,dotgit:r});if(await Ls.isIgnored({fs:a,gitdir:o,dir:e,filepath:i}))return"ignored";let c=await UB({fs:a,cache:n,gitdir:o}),u=await WS({fs:a,cache:n,gitdir:o,tree:c,path:i}),f=await gt.acquire({fs:a,gitdir:o,cache:n},async function(b){for(let _ of b)if(_.path===i)return _;return null}),d=await a.lstat(N(e,i)),h=u!==null,p=f!==null,g=d!==null,v=async()=>{if(p&&!Ed(f,d))return f.oid;{let b=await a.read(N(e,i)),_=await US({gitdir:o,type:"blob",object:b});return s&&p&&f.oid===_&&d.size!==-1&>.acquire({fs:a,gitdir:o,cache:n},async function(C){C.insert({filepath:i,stats:d,oid:_})}),_}};if(!h&&!g&&!p)return"absent";if(!h&&!g&&p)return"*absent";if(!h&&g&&!p)return"*added";if(!h&&g&&p)return await v()===f.oid?"added":"*added";if(h&&!g&&!p)return"deleted";if(h&&!g&&p)return u===f.oid,"*deleted";if(h&&g&&!p)return await v()===u?"*undeleted":"*undeletemodified";if(h&&g&&p){let b=await v();return b===u?b===f.oid?"unmodified":"*unmodified":b===f.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function WS({fs:t,cache:e,gitdir:r,tree:i,path:n}){typeof n=="string"&&(n=n.split("/"));let s=n.shift();for(let a of i)if(a.path===s){if(n.length===0)return a.oid;let{type:o,object:l}=await st({fs:t,cache:e,gitdir:r,oid:a.oid});if(o==="tree"){let c=Lr.from(l);return WS({fs:t,cache:e,gitdir:r,tree:c,path:n})}if(o==="blob")throw new xr(a.oid,o,"blob",n.join("/"))}return null}async function UB({fs:t,cache:e,gitdir:r}){let i;try{i=await q.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(s){if(s instanceof ze)return[]}let{tree:n}=await al({fs:t,cache:e,gitdir:r,oid:i});return n}async function GB({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i="HEAD",filepaths:n=["."],filter:s,cache:a={},ignored:o=!1,refresh:l=!0}){try{R("fs",t),R("gitdir",r),R("ref",i);let c=new te(t),u=await ie({fsp:c,dotgit:r});return await Jn({fs:c,cache:a,dir:e,gitdir:u,trees:[Dr({ref:i}),hu({refresh:l}),sl()],map:async function(f,[d,h,p]){if(!d&&!p&&h&&!o&&await Ls.isIgnored({fs:c,dir:e,filepath:f})||!n.some(S=>xS(f,S)))return null;if(s&&!s(f))return;let[g,v,b]=await Promise.all([d&&d.type(),h&&h.type(),p&&p.type()]),_=[g,v,b].includes("blob");if((g==="tree"||g==="special")&&!_)return;if(g==="commit")return null;if((v==="tree"||v==="special")&&!_)return;if(b==="commit")return null;if((b==="tree"||b==="special")&&!_)return;let C=g==="blob"?await d.oid():void 0,x=b==="blob"?await p.oid():void 0,E;g!=="blob"&&v==="blob"&&b!=="blob"?E="42":v==="blob"&&(E=await h.oid());let A=[void 0,C,E,x],w=A.map(S=>A.indexOf(S));return w.shift(),[f,...w]}})}catch(c){throw c.caller="git.statusMatrix",c}}async function jB({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i,object:n,force:s=!1}){try{R("fs",t),R("gitdir",r),R("ref",i);let a=new te(t);if(i===void 0)throw new Or("ref");i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`;let o=await ie({fsp:a,dotgit:r}),l=await q.resolve({fs:a,gitdir:o,ref:n||"HEAD"});if(!s&&await q.exists({fs:a,gitdir:o,ref:i}))throw new Wi("tag",i);await q.writeRef({fs:a,gitdir:o,ref:i,value:l})}catch(a){throw a.caller="git.tag",a}}async function VB({fs:t,dir:e,gitdir:r=N(e,".git"),cache:i={},filepath:n,oid:s,mode:a,add:o,remove:l,force:c}){try{R("fs",t),R("gitdir",r),R("filepath",n);let u=new te(t),f=await ie({fsp:u,dotgit:r});if(l)return await gt.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!c){let p=await u.lstat(N(e,n));if(p){if(p.isDirectory())throw new Os("directory");return}}h.has({filepath:n})&&h.delete({filepath:n})});let d;if(!s){if(d=await u.lstat(N(e,n)),!d)throw new ze(`file at "${n}" on disk and "remove" not set`);if(d.isDirectory())throw new Os("directory")}return await gt.acquire({fs:u,gitdir:f,cache:i},async function(h){
Line truncated
|
||||
|
||||
PROMPT="$1"
|
||||
TEMP_FILE="$OBSIDIAN_GIT_CREDENTIALS_INPUT"
|
||||
@@ -125,72 +125,72 @@ done
|
||||
RESPONSE=$(cat "$TEMP_FILE.response")
|
||||
|
||||
echo "$RESPONSE"
|
||||
`,Sk=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"];m();m();m();var _n=class{diff(e,r,i={}){let n;typeof i=="function"?(n=i,i={}):"callback"in i&&(n=i.callback);let s=this.castInput(e,i),a=this.castInput(r,i),o=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,l,i,n)}diffWithOptionsObj(e,r,i,n){var s;let a=b=>{if(b=this.postProcess(b,i),n){setTimeout(function(){n(b)},0);return}else return b},o=r.length,l=e.length,c=1,u=o+l;i.maxEditLength!=null&&(u=Math.min(u,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],r,e,0,i);if(h[0].oldPos+1>=l&&p+1>=o)return a(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,v=1/0,_=()=>{for(let b=Math.max(g,-c);b<=Math.min(v,c);b+=2){let S,k=h[b-1],E=h[b+1];k&&(h[b-1]=void 0);let A=!1;if(E){let x=E.oldPos-b;A=E&&0<=x&&x<o}let w=k&&k.oldPos+1<l;if(!A&&!w){h[b]=void 0;continue}if(!w||A&&k.oldPos<E.oldPos?S=this.addToPath(E,!0,!1,0,i):S=this.addToPath(k,!1,!0,1,i),p=this.extractCommon(S,r,e,b,i),S.oldPos+1>=l&&p+1>=o)return a(this.buildValues(S.lastComponent,r,e))||!0;h[b]=S,S.oldPos+1>=l&&(v=Math.min(v,b-1)),p+1>=o&&(g=Math.max(g,b+1))}c++};if(n)(function b(){setTimeout(function(){if(c>u||Date.now()>d)return n(void 0);_()||b()},0)})();else for(;c<=u&&Date.now()<=d;){let b=_();if(b)return b}}addToPath(e,r,i,n,s){let a=e.lastComponent;return a&&!s.oneChangePerToken&&a.added===r&&a.removed===i?{oldPos:e.oldPos+n,lastComponent:{count:a.count+1,added:r,removed:i,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+n,lastComponent:{count:1,added:r,removed:i,previousComponent:a}}}extractCommon(e,r,i,n,s){let a=r.length,o=i.length,l=e.oldPos,c=l-n,u=0;for(;c+1<a&&l+1<o&&this.equals(i[l+1],r[c+1],s);)c++,l++,u++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!s.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,r,i){return i.comparator?i.comparator(e,r):e===r||!!i.ignoreCase&&e.toLowerCase()===r.toLowerCase()}removeEmpty(e){let r=[];for(let i=0;i<e.length;i++)e[i]&&r.push(e[i]);return r}castInput(e,r){return e}tokenize(e,r){return Array.from(e)}join(e){return e.join("")}postProcess(e,r){return e}get useLongestToken(){return!1}buildValues(e,r,i){let n=[],s;for(;e;)n.push(e),s=e.previousComponent,delete e.previousComponent,e=s;n.reverse();let a=n.length,o=0,l=0,c=0;for(;o<a;o++){let u=n[o];if(u.removed)u.value=this.join(i.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=r.slice(l,l+u.count);f=f.map(function(d,h){let p=i[c+h];return p.length>d.length?p:d}),u.value=this.join(f)}else u.value=this.join(r.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return n}};m();var Gg=class extends _n{},kk=new Gg;function jg(t,e,r){return kk.diff(t,e,r)}m();m();function Vg(t,e){let r;for(r=0;r<t.length&&r<e.length;r++)if(t[r]!=e[r])return t.slice(0,r);return t.slice(0,r)}function zg(t,e){let r;if(!t||!e||t[t.length-1]!=e[e.length-1])return"";for(r=0;r<t.length&&r<e.length;r++)if(t[t.length-(r+1)]!=e[e.length-(r+1)])return t.slice(-r);return t.slice(-r)}function xd(t,e,r){if(t.slice(0,e.length)!=e)throw Error(`string ${JSON.stringify(t)} doesn't start with prefix ${JSON.stringify(e)}; this is
Line truncated
|
||||
`,ZS=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"];m();m();m();var bu=class{diff(e,r,i={}){let n;typeof i=="function"?(n=i,i={}):"callback"in i&&(n=i.callback);let s=this.castInput(e,i),a=this.castInput(r,i),o=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,l,i,n)}diffWithOptionsObj(e,r,i,n){var s;let a=_=>{if(_=this.postProcess(_,i),n){setTimeout(function(){n(_)},0);return}else return _},o=r.length,l=e.length,c=1,u=o+l;i.maxEditLength!=null&&(u=Math.min(u,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],r,e,0,i);if(h[0].oldPos+1>=l&&p+1>=o)return a(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,v=1/0,b=()=>{for(let _=Math.max(g,-c);_<=Math.min(v,c);_+=2){let C,x=h[_-1],E=h[_+1];x&&(h[_-1]=void 0);let A=!1;if(E){let S=E.oldPos-_;A=E&&0<=S&&S<o}let w=x&&x.oldPos+1<l;if(!A&&!w){h[_]=void 0;continue}if(!w||A&&x.oldPos<E.oldPos?C=this.addToPath(E,!0,!1,0,i):C=this.addToPath(x,!1,!0,1,i),p=this.extractCommon(C,r,e,_,i),C.oldPos+1>=l&&p+1>=o)return a(this.buildValues(C.lastComponent,r,e))||!0;h[_]=C,C.oldPos+1>=l&&(v=Math.min(v,_-1)),p+1>=o&&(g=Math.max(g,_+1))}c++};if(n)(function _(){setTimeout(function(){if(c>u||Date.now()>d)return n(void 0);b()||_()},0)})();else for(;c<=u&&Date.now()<=d;){let _=b();if(_)return _}}addToPath(e,r,i,n,s){let a=e.lastComponent;return a&&!s.oneChangePerToken&&a.added===r&&a.removed===i?{oldPos:e.oldPos+n,lastComponent:{count:a.count+1,added:r,removed:i,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+n,lastComponent:{count:1,added:r,removed:i,previousComponent:a}}}extractCommon(e,r,i,n,s){let a=r.length,o=i.length,l=e.oldPos,c=l-n,u=0;for(;c+1<a&&l+1<o&&this.equals(i[l+1],r[c+1],s);)c++,l++,u++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!s.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,r,i){return i.comparator?i.comparator(e,r):e===r||!!i.ignoreCase&&e.toLowerCase()===r.toLowerCase()}removeEmpty(e){let r=[];for(let i=0;i<e.length;i++)e[i]&&r.push(e[i]);return r}castInput(e,r){return e}tokenize(e,r){return Array.from(e)}join(e){return e.join("")}postProcess(e,r){return e}get useLongestToken(){return!1}buildValues(e,r,i){let n=[],s;for(;e;)n.push(e),s=e.previousComponent,delete e.previousComponent,e=s;n.reverse();let a=n.length,o=0,l=0,c=0;for(;o<a;o++){let u=n[o];if(u.removed)u.value=this.join(i.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=r.slice(l,l+u.count);f=f.map(function(d,h){let p=i[c+h];return p.length>d.length?p:d}),u.value=this.join(f)}else u.value=this.join(r.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return n}};m();var dv=class extends bu{constructor(){super(...arguments),this.tokenize=r3}equals(e,r,i){return i.ignoreWhitespace?((!i.newlineIsToken||!e.includes(`
|
||||
`))&&(e=e.trim()),(!i.newlineIsToken||!r.includes(`
|
||||
`))&&(r=r.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(e.endsWith(`
|
||||
`)&&(e=e.slice(0,-1)),r.endsWith(`
|
||||
`)&&(r=r.slice(0,-1))),super.equals(e,r,i)}},gB=new Kg;function Qg(t,e,r){return gB.diff(t,e,r)}function vB(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
|
||||
`));let r=[],i=t.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let n=0;n<i.length;n++){let s=i[n];n%2&&!e.newlineIsToken?r[r.length-1]+=s:r.push(s)}return r}m();var Tk={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Jg(t,e,r,i,n,s,a){let o;a?typeof a=="function"?o={callback:a}:o=a:o={},typeof o.context=="undefined"&&(o.context=4);let l=o.context;if(o.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(o.callback){let{callback:u}=o;Qg(r,i,Object.assign(Object.assign({},o),{callback:f=>{let d=c(f);u(d)}}))}else return c(Qg(r,i,o));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(b){return b.map(function(S){return" "+S})}let d=[],h=0,p=0,g=[],v=1,_=1;for(let b=0;b<u.length;b++){let S=u[b],k=S.lines||wB(S.value);if(S.lines=k,S.added||S.removed){if(!h){let E=u[b-1];h=v,p=_,E&&(g=l>0?f(E.lines.slice(-l)):[],h-=g.length,p-=g.length)}for(let E of k)g.push((S.added?"+":"-")+E);S.added?_+=k.length:v+=k.length}else{if(h)if(k.length<=l*2&&b<u.length-2)for(let E of f(k))g.push(E);else{let E=Math.min(k.length,l);for(let w of f(k.slice(0,E)))g.push(w);let A={oldStart:h,oldLines:v-h+E,newStart:p,newLines:_-p+E,lines:g};d.push(A),h=0,p=0,g=[]}v+=k.length,_+=k.length}}for(let b of d)for(let S=0;S<b.lines.length;S++)b.lines[S].endsWith(`
|
||||
`)?b.lines[S]=b.lines[S].slice(0,-1):(b.lines.splice(S+1,0,"\\ No newline at end of file"),S++);return{oldFileName:t,newFileName:e,oldHeader:n,newHeader:s,hunks:d}}}function Ad(t,e){if(e||(e=Tk),Array.isArray(t)){if(t.length>1&&!e.includeFileHeaders)throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return t.map(i=>Ad(i,e)).join(`
|
||||
`)}let r=[];e.includeIndex&&t.oldFileName==t.newFileName&&r.push("Index: "+t.oldFileName),e.includeUnderline&&r.push("==================================================================="),e.includeFileHeaders&&(r.push("--- "+t.oldFileName+(typeof t.oldHeader=="undefined"?"":" "+t.oldHeader)),r.push("+++ "+t.newFileName+(typeof t.newHeader=="undefined"?"":" "+t.newHeader)));for(let i=0;i<t.hunks.length;i++){let n=t.hunks[i];n.oldLines===0&&(n.oldStart-=1),n.newLines===0&&(n.newStart-=1),r.push("@@ -"+n.oldStart+","+n.oldLines+" +"+n.newStart+","+n.newLines+" @@");for(let s of n.lines)r.push(s)}return r.join(`
|
||||
`)&&(r=r.slice(0,-1))),super.equals(e,r,i)}},t3=new dv;function hv(t,e,r){return t3.diff(t,e,r)}function r3(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
|
||||
`));let r=[],i=t.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let n=0;n<i.length;n++){let s=i[n];n%2&&!e.newlineIsToken?r[r.length-1]+=s:r.push(s)}return r}m();function i3(t){for(let e=0;e<t.length;e++)if(t[e]<" "||t[e]>"~"||t[e]==='"'||t[e]==="\\")return!0;return!1}function Gs(t){if(!i3(t))return t;let e='"',r=new TextEncoder().encode(t),i=0;for(;i<r.length;){let n=r[i];n===7?e+="\\a":n===8?e+="\\b":n===9?e+="\\t":n===10?e+="\\n":n===11?e+="\\v":n===12?e+="\\f":n===13?e+="\\r":n===34?e+='\\"':n===92?e+="\\\\":n>=32&&n<=126?e+=String.fromCharCode(n):e+="\\"+n.toString(8).padStart(3,"0"),i++}return e+='"',e}var pv={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function mv(t,e,r,i,n,s,a){let o;a?typeof a=="function"?o={callback:a}:o=a:o={},typeof o.context=="undefined"&&(o.context=4);let l=o.context;if(o.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(o.callback){let{callback:u}=o;hv(r,i,Object.assign(Object.assign({},o),{callback:f=>{let d=c(f);u(d)}}))}else return c(hv(r,i,o));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(_){return _.map(function(C){return" "+C})}let d=[],h=0,p=0,g=[],v=1,b=1;for(let _=0;_<u.length;_++){let C=u[_],x=C.lines||n3(C.value);if(C.lines=x,C.added||C.removed){if(!h){let E=u[_-1];h=v,p=b,E&&(g=l>0?f(E.lines.slice(-l)):[],h-=g.length,p-=g.length)}for(let E of x)g.push((C.added?"+":"-")+E);C.added?b+=x.length:v+=x.length}else{if(h)if(x.length<=l*2&&_<u.length-2)for(let E of f(x))g.push(E);else{let E=Math.min(x.length,l);for(let w of f(x.slice(0,E)))g.push(w);let A={oldStart:h,oldLines:v-h+E,newStart:p,newLines:b-p+E,lines:g};d.push(A),h=0,p=0,g=[]}v+=x.length,b+=x.length}}for(let _ of d)for(let C=0;C<_.lines.length;C++)_.lines[C].endsWith(`
|
||||
`)?_.lines[C]=_.lines[C].slice(0,-1):(_.lines.splice(C+1,0,"\\ No newline at end of file"),C++);return{oldFileName:t,newFileName:e,oldHeader:n,newHeader:s,hunks:d}}}function jd(t,e){var r,i,n,s,a,o;if(e||(e=pv),Array.isArray(t)){if(t.length>1&&!e.includeFileHeaders&&!t.every(u=>u.isGit))throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return t.map(u=>jd(u,e)).join(`
|
||||
`)}let l=[];if(t.isGit){if(e=pv,!t.oldFileName)throw new Error("oldFileName must be specified for Git patches");if(!t.newFileName)throw new Error("newFileName must be specified for Git patches");let u=t.oldFileName,f=t.newFileName;t.isCreate&&u==="/dev/null"?u=f.replace(/^b\//,"a/"):t.isDelete&&f==="/dev/null"&&(f=u.replace(/^a\//,"b/")),l.push("diff --git "+Gs(u)+" "+Gs(f)),t.isDelete&&l.push("deleted file mode "+((r=t.oldMode)!==null&&r!==void 0?r:"100644")),t.isCreate&&l.push("new file mode "+((i=t.newMode)!==null&&i!==void 0?i:"100644")),t.oldMode&&t.newMode&&!t.isDelete&&!t.isCreate&&(l.push("old mode "+t.oldMode),l.push("new mode "+t.newMode)),t.isRename&&(l.push("rename from "+Gs(((n=t.oldFileName)!==null&&n!==void 0?n:"").replace(/^a\//,""))),l.push("rename to "+Gs(((s=t.newFileName)!==null&&s!==void 0?s:"").replace(/^b\//,"")))),t.isCopy&&(l.push("copy from "+Gs(((a=t.oldFileName)!==null&&a!==void 0?a:"").replace(/^a\//,""))),l.push("copy to "+Gs(((o=t.newFileName)!==null&&o!==void 0?o:"").replace(/^b\//,""))))}else e.includeIndex&&t.oldFileName==t.newFileName&&t.oldFileName!==void 0&&l.push("Index: "+t.oldFileName),e.includeUnderline&&l.push("===================================================================");let c=t.hunks.length>0;e.includeFileHeaders&&t.oldFileName!==void 0&&t.newFileName!==void 0&&(!t.isGit||c)&&(l.push("--- "+Gs(t.oldFileName)+(t.oldHeader?" "+t.oldHeader:"")),l.push("+++ "+Gs(t.newFileName)+(t.newHeader?" "+t.newHeader:"")));for(let u=0;u<t.hunks.length;u++){let f=t.hunks[u],d=f.oldLines===0?f.oldStart-1:f.oldStart,h=f.newLines===0?f.newStart-1:f.newStart;l.push("@@ -"+d+","+f.oldLines+" +"+h+","+f.newLines+" @@");for(let p of f.lines)l.push(p)}return l.join(`
|
||||
`)+`
|
||||
`}function Pk(t,e,r,i,n,s,a){if(typeof a=="function"&&(a={callback:a}),a!=null&&a.callback){let{callback:o}=a;Jg(t,e,r,i,n,s,Object.assign(Object.assign({},a),{callback:l=>{o(l?Ad(l,a.headerOptions):void 0)}}))}else{let o=Jg(t,e,r,i,n,s,a);return o?Ad(o,a==null?void 0:a.headerOptions):void 0}}function ou(t,e,r,i,n,s){return Pk(t,t,e,r,i,n,s)}function wB(t){let e=t.endsWith(`
|
||||
`}function KS(t,e,r,i,n,s,a){if(typeof a=="function"&&(a={callback:a}),a!=null&&a.callback){let{callback:o}=a;mv(t,e,r,i,n,s,Object.assign(Object.assign({},a),{callback:l=>{o(l?jd(l,a.headerOptions):void 0)}}))}else{let o=mv(t,e,r,i,n,s,a);return o?jd(o,a==null?void 0:a.headerOptions):void 0}}function _u(t,e,r,i,n,s){return KS(t,t,e,r,i,n,s)}function n3(t){let e=t.endsWith(`
|
||||
`),r=t.split(`
|
||||
`).map(i=>i+`
|
||||
`);return e?r.pop():r.push(r.pop().slice(0,-1)),r}var re=Ht(Bg(),1),xa=require("obsidian");m();function Rk(t,e){let r=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:r})}var al=class extends Error{constructor(r){super("No network connection available");this.originalError=r}};m();var $k=require("obsidian"),bB={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},et=class extends $k.SuggestModal{constructor(e,r){if(super(e.app),this.config={...bB,...r},this.setPlaceholder(this.config.placeholder),this.config.obscure){this.inputEl.type="password";let i=this.containerEl.querySelector(".prompt-input-container");i.addClass("git-obscure-prompt"),i.setAttr("git-is-obscured","true");let n=i==null?void 0:i.createDiv({cls:"search-input-clear-button"});n.style.marginRight="32px",n.id="git-show-password",n.addEventListener("click",()=>{i.getAttr("git-is-obscured")==="true"?(this.inputEl.type="text",i.setAttr("git-is-obscured","false")):(this.inputEl.type="password",i.setAttr("git-is-obscured","true"))})}}openAndGetResult(){return new Promise(e=>{this.resolve=e,this.open(),this.config.initialValue!=null&&(this.inputEl.value=this.config.initialValue,this.inputEl.dispatchEvent(new Event("input")))})}onClose(){new Promise(e=>window.setTimeout(e,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(e){return this.config.onlySelection?this.config.options:this.config.allowEmpty?[e.length>0?e:" ",...this.config.options]:[e.length>0?e:"...",...this.config.options]}renderSuggestion(e,r){this.config.obscure?r.hide():r.setText(e)}onChooseSuggestion(e,r){if(this.resolve){let i;this.config.allowEmpty&&e===" "?i="":e==="..."?i=void 0:i=e,this.resolve(i)}}};m();var Zk=Ht(Xk(),1),Kk=require("child_process"),Kn=require("obsidian");function Td(t){throw new Error(`Unexpected object: ${t}`)}function cu(t,e,r){return t===1?`${t} ${e}`:`${t} ${r!=null?r:e+"s"}`}var rv=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function ji(t,e){let r;if(e){if(e.button===0||e.button===1){let i=Kn.Keymap.isModEvent(e);r=t.workspace.getLeaf(i)}}else r=t.workspace.getLeaf(!1);return r}function bn(t,e,r,i,n){if(e.button==2){let s=t.vault.getAbstractFileByPath(r);if(s!=null){let a=new Kn.Menu;t.workspace.trigger("file-menu",a,s,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}else{let a=new Kn.Menu;t.workspace.trigger("obsidian-git:menu",a,r,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}}}function Os(t){throw new Error("Impossible branch: "+t)}function iv(t){return`rgb(${t.r},${t.g},${t.b})`}function Qk(t){var s;let e=(s=Zk.fromString(t))==null?void 0:s.toRgbaArray();if(e===void 0)return;let[r,i,n]=e;return{r,g:i,b:n}}function Jk(t){return t.diff(Kn.moment.unix(0),"seconds")}function eA(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function uu(t,e){return new Proxy(t,{get(r,i){return i==="length"?Math.min(e,r.length):r[i]}})}function tA(t,e,r){return t.length<=e?new Array(e-t.length).fill(r).join("")+t:t.substring(t.length-e)}function rA(t,e){if(e<=0)return t;let r=new Array(e).fill(" ").join(""),i=t.substring(e,t.length);return r+i}function nv(t,e,r){return t<=e&&e<=r}function Qn(t){let[e,...r]=t.split("/");return[e,r.length===0?void 0:r.join("/")]}function yn(t){return t.endsWith("/")?t:t.split("/").last().replace(/\.md$/,"")}function iA(t){return t===1?"1 minute":`${t} minutes`}function DB(t){let e=t.lastIndexOf(".");return t.substring(e+1)}function ll(t){if(t.endsWith(".md"))return!1;let e=DB(t);return Sk.includes(e)}function sv(t){return(t.startsWith("https://github.com/")||t.startsWith("https://gitlab.com/"))&&(t.endsWith(".git")||(t=t+".git")),t}function cl(t,e){let r=e.vault.getAbstractFileByPath(t);if(!(r instanceof Kn.TFile))return!1;try{return!!e.viewRegistry.getTypeByExtension(r.extension)}catch(i){return!0}}function nA({isFolder:t,gitRelativePath:e}){let r="/";return r+=e,t&&(r+="/"),r.replace(/([\\!#*?[\]])/g,String.raw`\$1`).replace(/\s(?=\s*$)/g,String.raw`\ `)}function ul(t,e,r,i){let n=e.target;t.workspace.trigger("hover-link",{event:e,source:r.getViewType(),hoverParent:r,targetEl:n,linktext:i})}function fu(t,e,r={}){return new Promise((i,n)=>{let s=(0,Kk.spawn)(t,e,r),a="",o="";s.stdout.on("data",l=>{a+=l.toString()}),s.stderr.on("data",l=>{o+=l.toString()}),s.on("error",l=>{i({error:new Error(l.message),stdout:a,stderr:a,code:1})}),s.on("close",l=>{i({stdout:a,stderr:o,code:l!=null?l:1,error:void 0})})})}m();var sA=require("os"),Pd=require("obsidian"),fl=class{constructor(e){this.plugin=e,this.app=e.app}getRelativeVaultPath(e){return this.plugin.settings.basePath?this.plugin.settings.basePath+"/"+e:e}getRelativeRepoPath(e,r=!0){return r&&this.plugin.settings.basePath.length>0?e.substring(this.plugin.settings.basePath.length+1):e}unload(){}_getTreeStructure(e,r=0){let i=[];for(e=[...e];e.length>0;){let n=e.first(),s=n.path.substring(r);if(s.contains("/")){let a=s.substring(0,s.indexOf("/"))
Line truncated
|
||||
`);return e?r.pop():r.push(r.pop().slice(0,-1)),r}var Cn=require("obsidian");m();function XS(t,e){let r=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:r})}var ll=class extends Error{constructor(r){super("No network connection available");this.originalError=r}};m();var QS=require("obsidian"),s3={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},at=class extends QS.SuggestModal{constructor(e,r){if(super(e.app),this.config={...s3,...r},this.setPlaceholder(this.config.placeholder),this.config.obscure){this.inputEl.type="password";let i=this.containerEl.querySelector(".prompt-input-container");i.addClass("git-obscure-prompt"),i.setAttr("git-is-obscured","true");let n=i==null?void 0:i.createDiv({cls:"search-input-clear-button"});n.style.marginRight="32px",n.id="git-show-password",n.addEventListener("click",()=>{i.getAttr("git-is-obscured")==="true"?(this.inputEl.type="text",i.setAttr("git-is-obscured","false")):(this.inputEl.type="password",i.setAttr("git-is-obscured","true"))})}}openAndGetResult(){return new Promise(e=>{this.resolve=e,this.open(),this.config.initialValue!=null&&(this.inputEl.value=this.config.initialValue,this.inputEl.dispatchEvent(new Event("input")))})}onClose(){new Promise(e=>window.setTimeout(e,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(e){return this.config.onlySelection?this.config.options:this.config.allowEmpty?[e.length>0?e:" ",...this.config.options]:[e.length>0?e:"...",...this.config.options]}renderSuggestion(e,r){this.config.obscure?r.hide():r.setText(e)}onChooseSuggestion(e,r){if(this.resolve){let i;this.config.allowEmpty&&e===" "?i="":e==="..."?i=void 0:i=e,this.resolve(i)}}};m();var vk=mt(gk(),1),wk=require("child_process"),ts=require("obsidian");function zd(t){throw new Error(`Unexpected object: ${String(t)}`)}function xu(t,e,r){return t===1?`${t} ${e}`:`${t} ${r!=null?r:e+"s"}`}var wv=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function Yi(t,e){let r;if(e){if(e.button===0||e.button===1){let i=ts.Keymap.isModEvent(e);r=t.workspace.getLeaf(i)}}else r=t.workspace.getLeaf(!1);return r}function Hr(t){return t.getRoot().side==="left"?"right":"left"}function Sn(t,e,r,i,n){if(e.button==2){let s=t.vault.getAbstractFileByPath(r);if(s!=null){let a=new ts.Menu;t.workspace.trigger("file-menu",a,s,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}else{let a=new ts.Menu;t.workspace.trigger("obsidian-git:menu",a,r,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}}}function js(t){throw new Error(`Impossible branch: ${String(t)}`)}function bv(t){return`rgb(${t.r},${t.g},${t.b})`}function bk(t){var s;let e=(s=vk.fromString(t))==null?void 0:s.toRgbaArray();if(e===void 0)return;let[r,i,n]=e;return{r,g:i,b:n}}function _k(t){return t.diff(ts.moment.unix(0),"seconds")}function yk(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function Eu(t,e){return new Proxy(t,{get(r,i){return i==="length"?Math.min(e,r.length):r[i]}})}function xk(t,e,r){return t.length<=e?new Array(e-t.length).fill(r).join("")+t:t.substring(t.length-e)}function Ek(t,e){if(e<=0)return t;let r=new Array(e).fill(" ").join(""),i=t.substring(e,t.length);return r+i}function _v(t,e,r){return t<=e&&e<=r}function Vs(t){let[e,...r]=t.split("/");return[e!=null?e:"",r.length===0?void 0:r.join("/")]}function kn(t){return t.endsWith("/")?t:t.split("/").last().replace(/\.md$/,"")}function Sk(t){return t===1?"1 minute":`${t} minutes`}function _3(t){let e=t.lastIndexOf(".");return t.substring(e+1)}function ul(t){if(t.endsWith(".md"))return!1;let e=_3(t);return ZS.includes(e)}function yv(t){return(t.startsWith("https://github.com/")||t.startsWith("https://gitlab.com/"))&&(t.endsWith(".git")||(t=t+".git")),t}function fl(t,e){let r=e.vault.getAbstractFileByPath(t);if(!(r instanceof ts.TFile))return!1;try{return!!e.viewRegistry.getTypeByExtension(r.extension)}catch(i){return!0}}function kk({isFolder:t,gitRelativePath:e}){let r="/";return r+=e,t&&(r+="/"),r.replace(/([\\!#*?[\]])/g,String.raw`\$1`).replace(/\s(?=\s*$)/g,String.raw`\ `)}function dl(t,e,r,i){let n=e.target;t.workspace.trigger("hover-link",{event:e,source:r.getViewType(),hoverParent:r,targetEl:n,linktext:i})}function Su(t,e,r={}){return new Promise((i,n)=>{let s=(0,wk.spawn)(t,e,r),a="",o="";s.stdout.on("data",l=>{a+=l.toString()}),s.stderr.on("data",l=>{o+=l.toString()}),s.on("error",l=>{i({error:new Error(l.message),stdout:a,stderr:o,code:1})}),s.on("close",l=>{i({stdout:a,stderr:o,code:l!=null?l:1,error:void 0})})})}m();var Ck=require("os"),qd=require("obsidian");var hl=class{constructor(e){this.plugin=e,this.app=e.app}async withGitOperation(e,r){var i;this.plugin.setPluginState({operation:e});try{return await r()}finally{(i=this.plugin.statusBar)==null||i.clearProgress(!1),this.plugin.setPluginState({operation:0})}}getRelativeVaultPath(e){return this.plugin.settings.basePath?e===""||e==="."?this.plugin.settings.basePath:thi
Line truncated
|
||||
`):n="Too many files to list",e=e+`
|
||||
|
||||
Affected files:
|
||||
`+n}return e}};m();var Ls=require("obsidian"),Rd=class{constructor(e,r){this.plugin=r;this.promises={};this.adapter=e.adapter,this.vault=e,this.lastBasePath=this.plugin.settings.basePath,this.promises.readFile=this.readFile.bind(this),this.promises.writeFile=this.writeFile.bind(this),this.promises.readdir=this.readdir.bind(this),this.promises.mkdir=this.mkdir.bind(this),this.promises.rmdir=this.rmdir.bind(this),this.promises.stat=this.stat.bind(this),this.promises.unlink=this.unlink.bind(this),this.promises.lstat=this.lstat.bind(this),this.promises.readlink=this.readlink.bind(this),this.promises.symlink=this.symlink.bind(this)}async readFile(e,r){var i;if(this.maybeLog("Read: "+e+JSON.stringify(r)),r=="utf8"||r.encoding=="utf8"){let n=this.vault.getAbstractFileByPath(e);return n instanceof Ls.TFile?(this.maybeLog("Reuse"),this.vault.read(n)):this.adapter.read(e)}else{if(e.endsWith(this.gitDir+"/index"))return this.plugin.settings.basePath!=this.lastBasePath?(this.clearIndex(),this.lastBasePath=this.plugin.settings.basePath,this.adapter.readBinary(e)):(i=this.index)!=null?i:this.adapter.readBinary(e);let n=this.vault.getAbstractFileByPath(e);return n instanceof Ls.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(n)):this.adapter.readBinary(e)}}async writeFile(e,r){if(this.maybeLog("Write: "+e),typeof r=="string"){let i=this.vault.getAbstractFileByPath(e);return i instanceof Ls.TFile?this.vault.modify(i,r):this.adapter.write(e,r)}else if(e.endsWith(this.gitDir+"/index"))this.index=r,this.indexmtime=Date.now();else{let i=this.vault.getAbstractFileByPath(e);return i instanceof Ls.TFile?this.vault.modifyBinary(i,r):this.adapter.writeBinary(e,r)}}async readdir(e){e==="."&&(e="/");let r=await this.adapter.list(e),i=[...r.files,...r.folders],n;return e!=="/"?n=i.map(s=>(0,Ls.normalizePath)(s.substring(e.length))):n=i,n}async mkdir(e){return this.adapter.mkdir(e)}async rmdir(e,r){var i,n;return this.adapter.rmdir(e,(n=(i=r==null?void 0:r.options)==null?void 0:i.recursive)!=null?n:!1)}async stat(e){if(e.endsWith(this.gitDir+"/index")){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.byteLength,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let i=await this.adapter.stat(e);if(i==null)throw{code:"ENOENT"};return this.indexctime=i.ctime,this.indexmtime=i.mtime,{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let r=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),r instanceof Ls.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:r.stat.ctime,mtimeMs:r.stat.mtime,size:r.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let i=await this.adapter.stat(e);if(i)return{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:i.type==="folder"?"directory":i.type,isFile:()=>i.type==="file",isDirectory:()=>i.type==="folder",isSymbolicLink:()=>!1};throw{code:"ENOENT"}}}async unlink(e){return this.adapter.remove(e)}async lstat(e){return this.stat(e)}async readlink(e){throw new Error(`readlink of (${e}) is not implemented.`)}async symlink(e){throw new Error(`symlink of (${e}) is not implemented.`)}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index"),this.index,{ctime:this.indexctime,mtime:this.indexmtime}),this.clearIndex()}clearIndex(){this.index=void 0,this.indexctime=void 0,this.indexmtime=void 0}get gitDir(){return this.plugin.settings.gitDir||".git"}maybeLog(e){}};var fA=Ht(uA(),1),Vi=class extends fl{constructor(r){super(r);this.FILE=0;this.HEAD=1;this.WORKDIR=2;this.STAGE=3;this.status_mapping={"000":" ","003":"AD","020":"??","022":"A ","023":"AM",100:"D ",101:" D",103:"MD",110:"DA",111:" ",113:"MM",120:"DA",121:" M",122:"M ",123:"MM"};this.noticeLength=999999;this.fs=new Rd(this.app.vault,this.plugin)}getRepo(){return{fs:this.fs,dir:this.plugin.settings.basePath,gitdir:this.plugin.settings.gitDir||void 0,onAuth:()=>{var r,i;return{username:(r=this.plugin.localStorage.getUsername())!=null?r:void 0,password:(i=this.plugin.localStorage.getPassword())!=null?i:void 0}},onAuthFailure:async()=>{new xa.Notice("Authentication failed. Please try with different credentials");let r=await new et(this.plugin,{placeholder:"Specify your username"}).openAndGetResult();if(r){let i=await new et(this.plugin,{placeholder:"Specify your password/personal access token",obscure:!0}).openAndGetResult();if(i)return this.plugin.localStorage.setUsername(r),this.plugin.localStorage.setPassword(i),{username:r,password:i}}return{cancel:!0}},http:{async request({url:r,method:i,headers:n,body:s}){let a;s&&(a=await BB(s));let o=await(0,xa.requestUrl)({url:r,method:i,headers:n,body:a,throw:!1});return{url:r,method:i,headers:o.headers,body:NB(o.arrayBuffer),statusCode:o.status,statusMessage:o.status.toString()}}}}}async wrapFS(r){try{let i=await
Line truncated
|
||||
`+n}return e}};m();var Wt=require("obsidian"),Yd=class extends Error{constructor(r){super(`File not found: ${r}`);this.code="ENOENT";this.name="FileNotFoundError"}},Zd=class{constructor(e,r){this.plugin=r;this.adapter=e.adapter,this.vault=e,this.lastBasePath=this.plugin.settings.basePath,this.promises={readFile:this.readFile.bind(this),writeFile:this.writeFile.bind(this),readdir:this.readdir.bind(this),mkdir:this.mkdir.bind(this),rmdir:this.rmdir.bind(this),stat:this.stat.bind(this),unlink:this.unlink.bind(this),lstat:this.lstat.bind(this),readlink:this.readlink.bind(this),symlink:this.symlink.bind(this)}}async readFile(e,r){var n;if(e===void 0)return;if(e=(0,Wt.normalizePath)(e),this.maybeLog("Read: "+e+JSON.stringify(r)),(typeof r=="string"?r:r==null?void 0:r.encoding)==="utf8"){let s=this.vault.getAbstractFileByPath(e);return s instanceof Wt.TFile?(this.maybeLog("Reuse"),this.vault.read(s)):this.adapter.read(e)}else{if(this.isIndexPath(e))return this.plugin.settings.basePath!=this.lastBasePath?(this.clearIndex(),this.lastBasePath=this.plugin.settings.basePath,this.adapter.readBinary(e)):(n=this.index)!=null?n:this.adapter.readBinary(e);let s=this.vault.getAbstractFileByPath(e);return s instanceof Wt.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(s)):this.adapter.readBinary(e)}}async writeFile(e,r){var i;if(this.maybeLog("Write: "+e),e=(0,Wt.normalizePath)(e),typeof r=="string"){let n=this.vault.getAbstractFileByPath(e);if(n instanceof Wt.TFile)return this.vault.modify(n,r);if(!this.isHiddenPath(e))await this.vault.create(e,r);else return this.adapter.write(e,r)}else{let n=y3(r);if(this.isIndexPath(e)){this.index=n;let s=Date.now();(i=this.indexctime)!=null||(this.indexctime=s),this.indexmtime=s}else{let s=this.vault.getAbstractFileByPath(e);if(s instanceof Wt.TFile)return this.vault.modifyBinary(s,n);if(!this.isHiddenPath(e))await this.vault.createBinary(e,n);else return this.adapter.writeBinary(e,n)}}}async readdir(e){e=(0,Wt.normalizePath)(e),this.maybeLog("ReadDir: "+e),e==="."&&(e="/");let r=await this.adapter.list(e),i=[...r.files,...r.folders],n;return e!=="/"?n=i.map(s=>(0,Wt.normalizePath)(s.substring(e.length))):n=i,n}async mkdir(e){if(e=(0,Wt.normalizePath)(e),!(e==="."||e==="/")){if(!this.isHiddenPath(e)){if(this.vault.getFolderByPath(e))return;await this.vault.createFolder(e);return}return this.adapter.mkdir(e)}}async rmdir(e,r){var i,n;if(e=(0,Wt.normalizePath)(e),this.maybeLog("Rmdir: "+e+JSON.stringify(r)),!this.isHiddenPath(e)){let s=this.vault.getAbstractFileByPath(e);if(s instanceof Wt.TFolder){await this.vault.delete(s,(r==null?void 0:r.recursive)===!0||((i=r==null?void 0:r.options)==null?void 0:i.recursive)===!0);return}}return this.adapter.rmdir(e,(r==null?void 0:r.recursive)===!0||((n=r==null?void 0:r.options)==null?void 0:n.recursive)===!0)}async stat(e){if(e=(0,Wt.normalizePath)(e),this.isIndexPath(e)){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.byteLength,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let i=await this.adapter.stat(e);if(i==null)throw new Yd(e);return this.indexctime=i.ctime,this.indexmtime=i.mtime,{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let r=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),r instanceof Wt.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:r.stat.ctime,mtimeMs:r.stat.mtime,size:r.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let i=await this.adapter.stat(e);if(i)return{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:i.type==="folder"?"directory":i.type,isFile:()=>i.type==="file",isDirectory:()=>i.type==="folder",isSymbolicLink:()=>!1};throw new Yd(e)}}async unlink(e){if(e=(0,Wt.normalizePath)(e),!this.isHiddenPath(e)){let r=this.vault.getAbstractFileByPath(e);if(r instanceof Wt.TFile)return this.vault.delete(r)}return this.adapter.remove(e)}async lstat(e){return this.stat(e)}readlink(e){return Promise.reject(new Error(`readlink of (${e}) is not implemented.`))}symlink(e){return Promise.reject(new Error(`symlink of (${e}) is not implemented.`))}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.getIndexPath(),this.index,{ctime:this.indexctime,mtime:this.indexmtime}),this.clearIndex()}clearIndex(){this.index=void 0,this.indexctime=void 0,this.indexmtime=void 0}get gitDir(){return this.plugin.settings.gitDir||".git"}getIndexPath(){return this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index")}isIndexPath(e){return e===this.getIndexPath()}isHiddenPath(e){return e.startsWith(this.gitDir)?!0:e.split("/").some(r=>r.startsWith(".")&&r!==".")}maybeLog(e){}};function y3(t){return t instanceof ArrayBuffer?t:t.buffer instanceof ArrayBuffer&&t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t.buffer,t.byteOffset,t.byteLength).slice().buf
Line truncated
|
||||
|
||||
`);return{message:l[0],author:{name:o.commit.author.name,email:o.commit.author.email},body:l.slice(1).join(`
|
||||
`);return{message:(c=l[0])!=null?c:"",author:{name:o.commit.author.name,email:o.commit.author.email},body:l.slice(1).join(`
|
||||
|
||||
`),date:new Date(o.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(o.commit.parent.first(),o.oid)).map(c=>({path:c.path,status:c.type,vaultPath:this.getRelativeVaultPath(c.path),hash:o.oid}))},hash:o.oid,refs:[]}}))}updateBasePath(r){return this.getRepo().dir=r,Promise.resolve()}async updateUpstreamBranch(r){let[i,n]=Qn(r),s=await this.branchInfo();await this.wrapFS(re.default.push({...this.getRepo(),remote:i,remoteRef:n})),await this.setConfig(`branch.${s.current}.merge`,`refs/heads/${n}`)}updateGitPath(r){return Promise.resolve()}async getFileChangesCount(r,i){return this.walkDifference({walkers:[re.default.TREE({ref:r}),re.default.TREE({ref:i})]})}async walkDifference({walkers:r,dir:i}){return await this.wrapFS(re.default.walk({...this.getRepo(),trees:r,map:async function(s,[a,o]){if(!rv(s,i))return null;if(await(a==null?void 0:a.type())==="tree"||await(o==null?void 0:o.type())==="tree")return;let l=await(a==null?void 0:a.oid()),c=await(o==null?void 0:o.oid()),u="equal";if(l!==c&&(u="M"),l===void 0&&(u="A"),c===void 0&&(u="D"),l===void 0&&c===void 0&&(console.log("Something weird happened:"),console.log(a),console.log(o)),u!=="equal")return{path:s,type:u}}}))}async getStagedFiles(r="."){return(await this.walkDifference({walkers:[re.default.TREE({ref:"HEAD"}),re.default.STAGE()],dir:r})).map(n=>({vaultPath:this.getRelativeVaultPath(n.path),path:n.path}))}async getUnstagedFiles(r="."){let i,n=window.setTimeout(()=>{i=new xa.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let s=this.getRepo(),a=await this.wrapFS(re.default.walk({...s,trees:[re.default.WORKDIR(),re.default.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await re.default.isIgnored({...s,filepath:o})||!rv(o,r))return null;let[u,f]=await Promise.all([l&&l.type(),c&&c.type()]),d=[u,f].includes("blob");if((u==="tree"||u==="special")&&!d)return;if(f==="commit")return null;if((f==="tree"||f==="special")&&!d)return;let h=f==="blob"?await c.oid():void 0,p;return u==="blob"&&f!=="blob"?p="42":u==="blob"&&(p=await l.oid()),p?h?p!==h?{path:o,type:"M"}:null:{path:o,type:"A"}:{path:o,type:"D"}}}));return window.clearTimeout(n),i==null||i.hide(),a}catch(s){throw window.clearTimeout(n),i==null||i.hide(),this.plugin.displayError(s),s}}async getDiffString(r,i=!1,n){let s=this.getRelativeVaultPath(r),a=async(c,[u])=>{if(r==c){let f=await u.oid();return(await re.default.readBlob({...this.getRepo(),oid:f})).blob}};if(n){let c=await(0,re.readBlob)({...this.getRepo(),filepath:r,oid:n}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof re.default.Errors.NotFoundError))throw h}),u=await re.default.readCommit({...this.getRepo(),oid:n}),f=await(0,re.readBlob)({...this.getRepo(),filepath:r,oid:u.commit.parent.first()}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof re.default.Errors.NotFoundError))throw h});return ou(s,f!=null?f:"",c!=null?c:"")}let o=(await re.default.walk({...this.getRepo(),trees:[re.default.STAGE()],map:a})).first(),l=new TextDecoder().decode(o);if(i){let c=await this.resolveRef("HEAD").then(f=>(0,re.readBlob)({...this.getRepo(),filepath:r,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof re.default.Errors.NotFoundError))throw f});return ou(s,c!=null?c:"",l)}else{let c;return await this.app.vault.adapter.exists(s)?c=await this.app.vault.adapter.read(s):c="",ou(s,l,c)}}async getLastCommitTime(){let r=this.getRepo(),i=await this.resolveRef("HEAD"),s=(await re.default.readCommit({...r,oid:i})).commit.committer.timestamp;return new Date(s*1e3)}getFileStatusResult(r){let i=this.status_mapping[`${r[this.HEAD]}${r[this.WORKDIR]}${r[this.STAGE]}`];return{index:i[0]=="?"?"U":i[0],workingDir:i[1]=="?"?"U":i[1],path:r[this.FILE],vaultPath:this.getRelativeVaultPath(r[this.FILE])}}async checkAuthorInfo(){let r=await this.getConfig("user.name"),i=await this.getConfig("user.email");if(!r||!i)throw Error("Git author name and email are not set. Please set both fields in the settings.")}showNotice(r,i=!0){if(!this.plugin.settings.disablePopups)return new xa.Notice(r,i?this.noticeLength:void 0)}};async function*NB(t){yield new Uint8Array(t)}async function BB(t){let e=new ReadableStream({async start(i){for await(let n of t)i.enqueue(n);i.close()}});return await new Response(e).arrayBuffer()}m();var o2=Ht(Id(),1),ei=Ht(require("fs/promises"),1),Jn=require("obsidian"),ze=Ht(require("path"),1),yu=require("path");m();var jd=Ht(vA(),1);m();var ov=new WeakMap;function gl(...t){let e=new String(t);return ov.set(e,t),e}function yi(t){return t instanceof String&&ov.has(t)}function vl(t){var e;return(e=ov.get(t))!=null?e:[]}var Ud=Ht(Id(),1),qC=require("child_process");var $T=Ht(cv(),1),GT=require("node:path");m();function*wA(t,e){let r=e==="global";for(let i of t)i.isGlobal===r&&(yield i)}var nH=new Set(["--add","--edit","--remove-section","--rename-section","--replace-all","--unset","--unset-all","-e"]),sH=new Set(["--get","--get-all"
Line truncated
|
||||
`){return t.split(r).reduce((i,n)=>{let s=e?n.trim():n;return s&&i.push(s),i},[])}function Fv(t,e){return vu(t,!0).map(r=>e(r))}function Iv(t){return(0,jd.exists)(t,jd.FOLDER)}function Si(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function cC(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function Vd(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function xn(t){return Array.isArray(t)?t:[t]}function uC(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function El(t){return xn(t).map(e=>e instanceof String?e:String(e))}function Xe(t,e=0){if(t==null)return e;let r=parseInt(t,10);return Number.isNaN(r)?e:r}function pu(t,e){let r=[];for(let i=0,n=t.length;i<n;i++)r.push(e,t[i]);return r}function mu(t){return(Array.isArray(t)?Buffer.concat(t):t).toString("utf-8")}function fC(t,e){let r={};return e.forEach(i=>{t[i]!==void 0&&(r[i]=t[i])}),r}function gv(t=0){return new Promise(e=>setTimeout(e,t))}function vv(t){if(t!==!1)return t}var bl,Ta,wu,zd=q({"src/lib/utils/util.ts"(){"use strict";Mv(),bl="\0",Ta=()=>{},wu=Object.prototype.toString.call.bind(Object.prototype.toString)}});function ar(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function wv(t,e){let r=yi(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function Wd(t){return!!t&&wu(t)==="[object Object]"}function dC(t){return typeof t=="function"}var _u,hC,pt,Bd,qd,Mv=q({"src/lib/utils/argument-filters.ts"(){"use strict";zd(),_u=t=>Array.isArray(t),hC=t=>typeof t=="number",pt=t=>typeof t=="string"||yi(t),Bd=t=>pt(t)||Array.isArray(t)&&t.every(pt),qd=t=>t==null||"number|boolean|function".includes(typeof t)?!1:typeof t.length=="number"}}),_v,NH=q({"src/lib/utils/exit-codes.ts"(){"use strict";_v=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(_v||{})}}),Hd,BH=q({"src/lib/utils/git-output-streams.ts"(){"use strict";Hd=class pC{constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new pC(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});function HH(){throw new Error("LineParser:useMatches not implemented")}var ve,Ns,UH=q({"src/lib/utils/line-parser.ts"(){"use strict";ve=class{constructor(t,e){this.matches=[],this.useMatches=HH,this.parse=(r,i)=>(this.resetMatches(),this._regExp.every((n,s)=>this.addMatch(n,s,r(s)))?this.useMatches(i,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let i=r&&t.exec(r);return i&&this.pushMatch(e,i),!!i}pushMatch(t,e){this.matches.push(...e.slice(1))}},Ns=class extends ve{addMatch(t,e,r){return/^remote:\s/.test(String(r))&&super.addMatch(t,e,r)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function mC(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...gC},...t.filter(i=>typeof i=="object"&&i));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var gC,GH=q({"src/lib/utils/simple-git-options.ts"(){"use strict";gC={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function Dv(t,e=[]){return Wd(t)?Object.keys(t).reduce((r,i)=>{let n=t[i];if(yi(n))r.push(n);else if(wv(n,["boolean"]))r.push(i+"="+n);else if(Array.isArray(n))for(let s of n)wv(s,["string","number"])||r.push(i+"="+s);else r.push(i);return r},e):e}function Er(t,e=0,r=!1){let i=[];for(let n=0,s=e<0?t.length:e;n<s;n++)"string|number".includes(typeof t[n])&&i.push(String(t[n]));return Dv(Ov(t),i),r||i.push(...jH(t)),i}function jH(t){let e=typeof Ca(t)=="function";return El(ar(Ca(t,e?1:0),_u,[]))}function Ov(t){let e=dC(Ca(t));return ar(Ca(t,e?1:0),Wd)}function it(t,e=!0){let r=nC(Ca(t));return e||sC(r)?r:void 0}var VH=q({"src/lib/utils/task-options.ts"(){"use strict";Mv(),zd()}});function bv(t,e){return t(e.stdOut,e.stdErr)}function Br(t,e,r,i=!0){return xn(r).forEach(n=>{for(let s=vu(n,i),a=0,o=s.length;a<o;a++){let l=(c=0)=>{if(!(a+c>=o))return s[a+c]};e.some(({parse:c})=>c(l,t))}}),t}var zH=q({"src/lib/utils/task-parser.ts"(){"use strict";zd()}}),vC={};xt(vC,{ExitCodes:()=>_v,GitOutputStreams:()=>Hd,LineParser:()=>ve,NOOP:()=>Ta,NULL:()=>bl,RemoteLineParser:()=>Ns,append:()=>Si,appendTaskOptions:()=>Dv,asArray:()=>xn,asCamelCase:()=>uC,asFunction:()=>nC,asNumber:()=>Xe,asStringArray:()=>El,bufferToString:()=>mu,callTaskParser:()=>bv,createInstanceConfig:()=>mC,delay:()=>gv,filterArray:()=>_u,filterFunction:()=>dC,filterHasLength:()=>qd,filterNumber:()=>hC,filterPlainObject:()=>Wd,filterPrimitives:()=>wv,filterString:()=>pt,filterStringOrStringArray:()=>Bd,filterType:()=>ar,first:()=>oC,folderExists:()=>Iv,forEachLineWithContent:()=>Fv,getTrailingOptions:()=>Er,including:()=>cC,isUserFunction:()=>sC,last:()=>Ca,objectToString:()=>wu,orVoid:()=>vv,parseStringResponse:()=>Br,pick:()=>fC,prefixedArray:()=>pu,remove:()=>Vd,splitOn:()=>aC,toLinesWithContent:()=>vu,trailingFunctionArgument:()=>it,trailingOptionsArg
Line truncated
|
||||
`)){let l=aC(a,`
|
||||
`);o=l[0],a=l[1]}yield{file:s,key:o,value:a}}}var MC,s3=q({"src/lib/responses/ConfigList.ts"(){"use strict";fe(),MC=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||(this._all=this.files.reduce((t,e)=>Object.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=Ca(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let i=this.addFile(t);Object.hasOwn(i,e)?Array.isArray(i[e])?i[e].push(r):i[e]=[i[e],r]:i[e]=r,this._all=void 0}}}});function uv(t,e){return typeof t=="string"&&Object.hasOwn(Ev,t)?t:e}function a3(t,e,r,i){let n=["config",`--${i}`];return r&&n.push("--add"),n.push(t,e),{commands:n,format:"utf-8",parser(s){return s}}}function o3(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(i){return i3(i,t)}}}function l3(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return r3(r)}}}function c3(){return{addConfig(t,e,...r){return this._runTask(a3(t,e,r[0]===!0,uv(r[1],"local")),it(arguments))},getConfig(t,e){return this._runTask(o3(t,uv(e,void 0)),it(arguments))},listConfig(...t){return this._runTask(l3(uv(t[0],void 0)),it(arguments))}}}var Ev,DC=q({"src/lib/tasks/config.ts"(){"use strict";s3(),fe(),Ev=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(Ev||{})}});function u3(t){return OC.has(t)}var fv,OC,LC=q({"src/lib/tasks/diff-name-status.ts"(){"use strict";fv=(t=>(t.ADDED="A",t.COPIED="C",t.DELETED="D",t.MODIFIED="M",t.RENAMED="R",t.CHANGED="T",t.UNMERGED="U",t.UNKNOWN="X",t.BROKEN="B",t))(fv||{}),OC=new Set(Object.values(fv))}});function f3(...t){return new BC().param(...t)}function d3(t){let e=new Set,r={};return Fv(t,i=>{let[n,s,a]=i.split(bl);e.add(n),(r[n]=r[n]||[]).push({line:Xe(s),path:n,preview:a})}),{paths:e,results:r}}function h3(){return{grep(t){let e=it(arguments),r=Er(arguments);for(let n of NC)if(r.includes(n))return this._runTask(Lr(`git.grep: use of "${n}" is not supported.`),e);typeof t=="string"&&(t=f3().param(t));let i=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:i,format:"utf-8",parser(n){return d3(n)}},e)}}}var NC,hu,kA,BC,HC=q({"src/lib/tasks/grep.ts"(){"use strict";fe(),_t(),NC=["-h"],hu=Symbol("grepQuery"),BC=class{constructor(){this[kA]=[]}*[(kA=hu,Symbol.iterator)](){for(let t of this[hu])yield t}and(...t){return t.length&&this[hu].push("--and","(",...pu(t,"-e"),")"),this}param(...t){return this[hu].push(...pu(t,"-e")),this}}}}),UC={};xt(UC,{ResetMode:()=>Od,getResetMode:()=>m3,resetTask:()=>p3});function p3(t,e){let r=["reset"];return GC(t)&&r.push(`--${t}`),r.push(...e),Sr(r)}function m3(t){if(GC(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function GC(t){return typeof t=="string"&&jC.includes(t)}var Od,jC,VC=q({"src/lib/tasks/reset.ts"(){"use strict";fe(),_t(),Od=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(Od||{}),jC=El(Object.values(Od))}});function g3(){return(0,Ud.default)("simple-git")}function AA(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(i,...n)=>{t(i,...n),r(i,...n)}:t:(i,...n)=>{t(`%s ${i}`,e,...n),r&&r(i,...n)}}function v3(t,e,{namespace:r}){if(typeof t=="string")return t;let i=e&&e.namespace||"";return i.startsWith(r)?i.substr(r.length+1):i||r}function Gv(t,e,r,i=g3()){let n=t&&`[${t}]`||"",s=[],a=typeof e=="string"?i.extend(e):e,o=v3(ar(e,pt),a,i);return c(r);function l(u,f){return Si(s,Gv(t,o.replace(/^[^:]+/,u),f,i))}function c(u){let f=u&&`[${u}]`||"",d=a&&AA(a,f)||Ta,h=AA(i,`${n} ${f}`,d);return Object.assign(a?d:h,{label:t,sibling:l,info:h,step:c})}}var zC=q({"src/lib/git-logger.ts"(){"use strict";fe(),Ud.default.formatters.L=t=>String(qd(t)?t.length:"-"),Ud.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):wu(t)}}),WC,w3=q({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";var t;Bs(),zC(),WC=(t=class{constructor(r="GitExecutor"){this.logLabel=r,this._queue=new Map}withProgress(r){return this._queue.get(r)}createProgress(r){let i=t.getName(r.commands[0]),n=Gv(this.logLabel,i);return{task:r,logger:n,name:i}}push(r){let i=this.createProgress(r);return i.logger("Adding task to the queue, commands = %o",r.commands),this._queue.set(r,i),i}fatal(r){for(let[i,{logger:n}]of Array.from(this._queue.entries()))i===r.task?(n.info("Failed %o",r),n("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):n.info("A fatal exception occurred in a previous task, the queue has been purged: %o",r.message),this.complete(i);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(r){this.withProgress(r)&&this._queue.delete(r)}attempt(r){let i=this.withProgress(r);if(!i)throw new Nr(void 0,"TasksPendingQueue: attempt called for an unknown task");return i.lo
Line truncated
|
||||
`).map(h6).filter(Boolean);e||r.sort(function(n,s){let a=n.split("."),o=s.split(".");if(a.length===1||o.length===1)return d6(Dd(a[0]),Dd(o[0]));for(let l=0,c=Math.max(a.length,o.length);l<c;l++){let u=e2(Dd(a[l]),Dd(o[l]));if(u)return u}return 0});let i=e?r[0]:[...r].reverse().find(n=>n.indexOf(".")>=0);return new KA(r,i)}}}),r2={};xt(r2,{addAnnotatedTagTask:()=>v6,addTagTask:()=>g6,tagListTask:()=>m6});function m6(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return t2(r,e)}}}function g6(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function v6(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var w6=q({"src/lib/tasks/tag.ts"(){"use strict";p6()}}),_6=OH({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(y3(),wt(YC)),{SimpleGitApi:i}=(y8(),wt(PT)),{Scheduler:n}=(x8(),wt(RT)),{adhocExecTask:s,configurationErrorTask:a}=(_t(),wt(xv)),{asArray:o,filterArray:l,filterPrimitives:c,filterString:u,filterStringOrStringArray:f,filterType:d,getTrailingOptions:h,trailingFunctionArgument:p,trailingOptionsArgument:g}=(fe(),wt(vC)),{applyPatchTask:v}=(S8(),wt(IT)),{branchTask:_,branchLocalTask:b,deleteBranchesTask:S,deleteBranchTask:k}=(D8(),wt(HT)),{checkIgnoreTask:E}=(B8(),wt(VT)),{checkIsRepoTask:A}=(yC(),wt(wC)),{cleanWithOptionsTask:w,isCleanOptionsArray:x}=(FC(),wt(RC)),{diffSummaryTask:y}=(Xv(),wt(oT)),{fetchTask:C}=(V8(),wt(WT)),{moveTask:P}=(Y8(),wt(YT)),{pullTask:L}=(Z8(),wt(XT)),{pushTagsTask:N}=(xT(),wt(yT)),{addRemoteTask:B,getRemotesTask:ge,listRemotesTask:Le,remoteTask:ke,removeRemoteTask:ne}=(s6(),wt(KT)),{getResetMode:Ee,resetTask:_e}=(VC(),wt(UC)),{stashListTask:z}=(o6(),wt(QT)),{addSubModuleTask:X,initSubModuleTask:V,subModuleTask:Ne,updateSubModuleTask:gr}=(f6(),wt(JT)),{addAnnotatedTagTask:Nt,addTagTask:Fe,tagListTask:Pt}=(w6(),wt(r2)),{straightThroughBufferTask:Rt,straightThroughStringTask:Ye}=(_t(),wt(xv));function J(D,M){this._plugins=M,this._executor=new r(D.baseDir,new n(D.maxConcurrentProcesses),M),this._trimmed=D.trimmed}(J.prototype=Object.create(i.prototype)).constructor=J,J.prototype.customBinary=function(D){return this._plugins.reconfigure("binary",D),this},J.prototype.env=function(D,M){return arguments.length===1&&typeof D=="object"?this._executor.env=D:(this._executor.env=this._executor.env||{})[D]=M,this},J.prototype.stashList=function(D){return this._runTask(z(g(arguments)||{},l(D)&&D||[]),p(arguments))},J.prototype.mv=function(D,M){return this._runTask(P(D,M),p(arguments))},J.prototype.checkoutLatestTag=function(D){var M=this;return this.pull(function(){M.tags(function(ae,Te){M.checkout(Te.latest,D)})})},J.prototype.pull=function(D,M,ae,Te){return this._runTask(L(d(D,u),d(M,u),h(arguments)),p(arguments))},J.prototype.fetch=function(D,M){return this._runTask(C(d(D,u),d(M,u),h(arguments)),p(arguments))},J.prototype.silent=function(D){return this._runTask(s(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},J.prototype.tags=function(D,M){return this._runTask(Pt(h(arguments)),p(arguments))},J.prototype.rebase=function(){return this._runTask(Ye(["rebase",...h(arguments)]),p(arguments))},J.prototype.reset=function(D){return this._runTask(_e(Ee(D),h(arguments)),p(arguments))},J.prototype.revert=function(D){let M=p(arguments);return typeof D!="string"?this._runTask(a("Commit must be a string"),M):this._runTask(Ye(["revert",...h(arguments,0,!0),D]),M)},J.prototype.addTag=function(D){let M=typeof D=="string"?Fe(D):a("Git.addTag requires a tag name");return this._runTask(M,p(arguments))},J.prototype.addAnnotatedTag=function(D,M){return this._runTask(Nt(D,M),p(arguments))},J.prototype.deleteLocalBranch=function(D,M,ae){return this._runTask(k(D,typeof M=="boolean"?M:!1),p(arguments))},J.prototype.deleteLocalBranches=function(D,M,ae){return this._runTask(S(D,typeof M=="boolean"?M:!1),p(arguments))},J.prototype.branch=function(D,M){return this._runTask(_(h(arguments)),p(arguments))},J.prototype.branchLocal=function(D){return this._runTask(b(),p(arguments))},J.prototype.raw=function(D){let M=!Array.isArray(D),ae=[].slice.call(M?arguments:D,0);for(let Bt=0;Bt<ae.length&&M;Bt++)if(!c(ae[Bt])){ae.splice(Bt,ae.length-Bt);break}ae.push(...h(arguments,0,!0));var Te=p(arguments);return ae.length?this._runTask(Ye(ae,this._trimmed),Te):this._runTask(a("Raw: must supply one or more command to execute"),Te)},J.prototype.submoduleAdd=function(D,M,ae){return this._runTask(X(D,M),p(arguments))},J.prototype.submoduleUpdate=function(D,M){return this._runTask(gr(h(arguments,!0)),p(arguments))},J.prototype.submoduleInit=function(D,M){return this._runTask(V(h(arguments,!0)),p(arguments))},J.prototype.subModule=function(D,M){return this._runTask(Ne(h(arguments)),p(arguments))},J.prototype.listRemote=function(){return this._runTask(Le(h(arguments)),p(arguments))},J.prototype.addRe
Line truncated
|
||||
`).some(l=>l.contains(n))||await ei.appendFile(r,n+`
|
||||
`)}catch(r){console.error("Error while adding askpass script to exclude file:",r)}}unload(){var r;(r=this.watchAbortController)==null||r.abort()}async status(r){let i=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let n=await this.git.status(i!=null?["--",i]:[]);this.plugin.setPluginState({gitAction:0});let s=n.files.map(a=>{let o=this.formatPath(a);return{path:o.path,from:o.from,index:a.index==="?"?"U":a.index,workingDir:a.working_dir==="?"?"U":a.working_dir,vaultPath:this.getRelativeVaultPath(o.path)}});return{all:s,changed:s.filter(a=>a.workingDir!==" "),staged:s.filter(a=>a.index!==" "&&a.index!="U"),conflicted:n.conflicted.map(a=>this.formatPath({path:a}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(r){let i=this.getRelativeRepoPath(r),s=["-C",ze.dirname(i),"rev-parse","HEAD"],a=this.git.raw(s);return a.catch(o=>console.warn("obsidian-git: rev-parse error:",o)),(await a).trim()}async getSubmodulePaths(){return new Promise(r=>{this.git.outputHandler((i,n,s,a)=>{if(!(a.contains("submodule")&&a.contains("foreach")))return;let o="",l=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");n.on("data",c=>{o+=c.toString("utf8")}),n.on("end",()=>{let u=o.split(`
|
||||
`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+yu.sep}).filter(f=>!!f);u.reverse(),r(u)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},i=>this.plugin.displayError(i))})}formatPath(r){function i(n){if(n!=null)return n.startsWith('"')&&n.endsWith('"')?n.substring(1,n.length-1):n}return r.from!=null?{from:i(r.from),path:i(r.path)}:{path:i(r.path)}}async blame(r,i,n){if(r=this.getRelativeRepoPath(r),!await this.isTracked(r))return"untracked";let s=await this.getSubmoduleOfFile(r),a=s?["-C",s.submodule]:[],o=s?s.relativeFilepath:r;a.push("blame","--porcelain"),n&&a.push("-w");let l=`-C${_d}`;switch(i){case"inactive":break;case"same-commit":a.push("-C",l);break;case"all-commits":a.push("-C","-C",l);break;default:Os(i)}a.push("--",o);let c=await this.git.raw(a);return B6(c)}async isTracked(r){let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("ls-files","--",s),this.git.raw(n).then(a=>a.trim()!=="")}async commitAll({message:r}){if(this.plugin.settings.updateSubmodules){this.plugin.setPluginState({gitAction:4});let n=await this.getSubmodulePaths();for(let s of n)await this.git.cwd({path:s,root:!1}).add("-A"),await this.git.cwd({path:s,root:!1}).commit(await this.formatCommitMessage(r))}this.plugin.setPluginState({gitAction:3}),await this.git.add("-A"),this.plugin.setPluginState({gitAction:4});let i=await this.git.commit(await this.formatCommitMessage(r));return this.app.workspace.trigger("obsidian-git:head-change"),i.summary.changes}async commit({message:r,amend:i}){this.plugin.setPluginState({gitAction:4});let n=(await this.git.commit(await this.formatCommitMessage(r),i?["--amend"]:[])).summary.changes;return this.app.workspace.trigger("obsidian-git:head-change"),this.plugin.setPluginState({gitAction:0}),n}async stage(r,i){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,i),await this.git.add(["--",r]),this.plugin.setPluginState({gitAction:0})}async stageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.add(r!=null?r:"-A"),this.plugin.setPluginState({gitAction:0})}async unstageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.reset(r!=null?["--",r]:[]),this.plugin.setPluginState({gitAction:0})}async unstage(r,i){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,i),await this.git.reset(["--",r]),this.plugin.setPluginState({gitAction:0})}async discard(r){this.plugin.setPluginState({gitAction:3}),await this.isTracked(r)&&await this.git.checkout(["--",r]),this.plugin.setPluginState({gitAction:0})}async applyPatch(r){let i=ze.join(this.relPluginConfigPath,"patch");await this.app.vault.adapter.write(i,r),await this.git.applyPatch(i,{"--cached":null,"--unidiff-zero":null,"--whitespace":"nowarn"}),await this.app.vault.adapter.remove(i)}async getUntrackedPaths(r){let i=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let n=[];i!=null&&n.push("--",i);let s=await this.git.clean(Aa.RECURSIVE+Aa.DRY_RUN,n);return this.plugin.setPluginState({gitAction:0}),s.paths}async hashObject(r){r=this.getRelativeRepoPath(r);let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("hash-object","--",s),this.git.raw(n)}async discardAll({dir:r}){return this.discard(r!=null?r:".")}async pull(){this.plugin.setPluginState({gitAction:2});try{this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"]);let r=await this.branchInfo(),i=await this.git.revparse([r.current]);if(!r.tracking&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring pull of main repo and updating submodules only.");return}await this.git.fetch();let n=await this.git.revparse([r.tracking]);if(i!==n){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{let o=[r.tracking];switch(this.plugin.settings.mergeStrategy!=="none"&&o.push(`--strategy-option=${this.plugin.settings.mergeStrategy}`),this.plugin.settings.syncMethod){case"merge":await this.git.merge(o);break;case"rebase":await this.git.rebase(o)}}catch(o){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${r.current}`,n]),await this.unstageAll({})}catch(o){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`)}this.app.workspace.trigger("obsidian-git:head-change");let s=await this.git.revparse([r.current]);return(await this.git.diff([`${i}..${s}`,"--name-only"])).split(/\r\n|\r|\n/).filter(o=>o.length>0).map(o=>({path:o,workingDir:"P",vaultPath:this.getRelativeVaultPath(o)}))}else return[]}catch(r){this.convertErrors(r)}}async push(){this.plugin.setPluginState({gitAction:5});try{if(this.plugin.settings.updateSubmodules){let a=aw
Line truncated
|
||||
`):[]}async removeRemote(r){await this.git.removeRemote(r)}async updateUpstreamBranch(r){try{await this.git.branch(["--set-upstream-to",r])}catch(i){try{await this.git.branch(["--set-upstream",r])}catch(n){let[s,a]=Qn(r),o=await this.branchInfo();await this.git.push(["--set-upstream",s,`${o.current}:${a}`])}}}updateGitPath(r){return this.setGitInstance()}updateBasePath(r){return this.setGitInstance(!0)}async getDiffString(r,i=!1,n){return i?await this.git.diff(["--cached","--",r]):n?await this.git.show([`${n}`,"--",r]):await this.git.diff(["--",r])}async diff(r,i,n){return await this.git.diff([`${i}..${n}`,"--",r])}async rawCommand(r){let i=r.split(" ");return await this.git.raw(i[0],...i.slice(1))}async getSubmoduleOfFile(r){if(!await this.app.vault.adapter.exists(ze.dirname(r)))return;let i=await this.git.raw(["-C",ze.dirname(r),"rev-parse","--show-toplevel"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message));if(i=i.trim(),(await this.git.raw(["-C",ze.dirname(r),"rev-parse","--show-superproject-working-tree"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message))).trim()==="")return;let a=this.app.vault.adapter.getFullPath(ze.normalize(r)),o=ze.relative(i,a);return{submodule:i,relativeFilepath:o}}async getLastCommitTime(){try{let r=await this.git.log({n:1});if(r!=null&&r.latest!=null)return new Date(r.latest.date)}catch(r){if(r instanceof Nr){if(r.message.contains("does not have any commits yet"))return}else throw r}}async isGitInstalled(){let r=this.plugin.localStorage.getGitPath(),i=await fu(r||"git",["--version"],{});if(i.error)if(Jn.Platform.isWin&&!r){this.plugin.log(`Git not found in PATH. Checking standard installation path(${bd}) of Git for Windows.`);let n=await fu(bd,["--version"]);if(n.error)return console.error(n.error),!1;this.useDefaultWindowsGitPath=!0}else return console.error(i.error),!1;else this.useDefaultWindowsGitPath=!1;return!0}convertErrors(r){if(r instanceof Nr){let i=String(r.message);if(i.contains("Could not resolve host")||i.contains("Unable to resolve host")||i.contains("Unable to open connection")||i.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||i.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||i.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new al(i)}throw r}async isFileTrackedByLFS(r){try{return(await this.git.raw(["check-attr","filter",r])).includes("filter: lfs")}catch(i){let n=i instanceof Error?i.message:String(i);return this.plugin.displayError(`Error checking LFS status: ${n}`),!1}}},l2={hash:"000000",isZeroCommit:!0,summary:""};function B6(t){let r=t.replace(`\r
|
||||
`),date:new Date(o.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(o.commit.parent.first(),o.oid)).map(u=>({path:u.path,status:u.type,vaultPath:this.getRelativeVaultPath(u.path),hash:o.oid}))},hash:o.oid,refs:[]}}))}updateBasePath(r){return this.getRepo().dir=r,Promise.resolve()}getGitDirPath(){return(0,Cn.normalizePath)(this.getRelativeVaultPath(this.plugin.settings.gitDir||".git"))}async updateUpstreamBranch(r){let[i,n]=Vs(r),s=await this.branchInfo();await this.wrapFS(pe.push({...this.getRepo(),remote:i,remoteRef:n})),await this.setConfig(`branch.${s.current}.merge`,`refs/heads/${n}`)}updateGitPath(r){return Promise.resolve()}async getFileChangesCount(r,i){return this.walkDifference({walkers:[pe.TREE({ref:r}),pe.TREE({ref:i})]})}async walkDifference({walkers:r,dir:i}){return this.wrapFS(xv({...this.getRepo(),trees:r,map:async function(n,[s,a]){if(!wv(n,i))return null;if(await(s==null?void 0:s.type())==="tree"||await(a==null?void 0:a.type())==="tree")return;let o=await(s==null?void 0:s.oid()),l=await(a==null?void 0:a.oid()),c="equal";if(o!==l&&(c="M"),o===void 0&&(c="A"),l===void 0&&(c="D"),o===void 0&&l===void 0&&(console.log("Something weird happened:"),console.log(s),console.log(a)),c!=="equal")return{path:n,type:c}}}))}async getStagedFiles(r="."){return(await this.walkDifference({walkers:[pe.TREE({ref:"HEAD"}),pe.STAGE()],dir:r})).map(n=>({vaultPath:this.getRelativeVaultPath(n.path),path:n.path}))}async getUnstagedFiles(r="."){let i,n=window.setTimeout(()=>{i=new Cn.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let s=this.getRepo(),a=await this.wrapFS(xv({...s,trees:[pe.WORKDIR(),pe.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await pe.isIgnored({...s,filepath:o})||!wv(o,r))return null;let[u,f]=await Promise.all([l&&l.type(),c&&c.type()]),d=[u,f].includes("blob");if((u==="tree"||u==="special")&&!d)return;if(f==="commit")return null;if((f==="tree"||f==="special")&&!d)return;let h=f==="blob"?await c.oid():void 0,p;return u==="blob"&&f!=="blob"?p="42":u==="blob"&&(p=await l.oid()),p?h?p!==h?{path:o,type:"M"}:null:{path:o,type:"A"}:{path:o,type:"D"}}}));return window.clearTimeout(n),i==null||i.hide(),a}catch(s){throw window.clearTimeout(n),i==null||i.hide(),this.plugin.displayError(s),s}}async getDiffString(r,i=!1,n){let s=this.getRelativeVaultPath(r),a=async(c,[u])=>{if(r==c){let f=await u.oid();return(await pe.readBlob({...this.getRepo(),oid:f})).blob}};if(n){let c=await wu({...this.getRepo(),filepath:r,oid:n}).then(p=>new TextDecoder().decode(p.blob)).catch(p=>{if(!(p instanceof pe.Errors.NotFoundError))throw p}),f=(await pe.readCommit({...this.getRepo(),oid:n})).commit.parent.first(),d;return f&&(d=await wu({...this.getRepo(),filepath:r,oid:f}).then(p=>new TextDecoder().decode(p.blob)).catch(p=>{if(!(p instanceof pe.Errors.NotFoundError))throw p})),_u(s,d!=null?d:"",c!=null?c:"")}let o=(await xv({...this.getRepo(),trees:[pe.STAGE()],map:a})).first(),l=new TextDecoder().decode(o);if(i){let c=await this.resolveRef("HEAD").then(f=>wu({...this.getRepo(),filepath:r,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof pe.Errors.NotFoundError))throw f});return _u(s,c!=null?c:"",l)}else{let c;return await this.app.vault.adapter.exists(s)?c=await this.app.vault.adapter.read(s):c="",_u(s,l,c)}}async getLastCommitTime(){let r=this.getRepo(),i=await this.resolveRef("HEAD"),s=(await pe.readCommit({...r,oid:i})).commit.committer.timestamp;return new Date(s*1e3)}getFileStatusResult(r){var s,a;let i=`${r[this.HEAD]}${r[this.WORKDIR]}${r[this.STAGE]}`,n=this.status_mapping[i];if(n===void 0)throw new Error(`Unsupported status matrix row: ${i}`);return{index:n[0]=="?"?"U":(s=n[0])!=null?s:" ",workingDir:n[1]=="?"?"U":(a=n[1])!=null?a:" ",path:r[this.FILE],vaultPath:this.getRelativeVaultPath(r[this.FILE])}}async checkAuthorInfo(){let r=await this.getConfig("user.name"),i=await this.getConfig("user.email");if(!r||!i)throw Error("Git author name and email are not set. Please set both fields in the settings.")}showNotice(r,i=!0){if(!this.plugin.settings.disablePopups)return new Cn.Notice(r,i?this.noticeLength:void 0)}};async function xv(t){let e=await pe.walk(t);if(!Array.isArray(e))throw new TypeError("isomorphic-git walk returned a non-array result");return e}function S3(t){let e=[new Uint8Array(t)].values();return{next:()=>Promise.resolve(e.next()),[Symbol.asyncIterator](){return this}}}async function k3(t){let e=new ReadableStream({async start(i){for await(let n of t)i.enqueue(n);i.close()}});return await new Response(e).arrayBuffer()}async function C3(t){let e=new Uint8Array(t);if(e.length<2||e[0]!==31||e[1]!==139)return t;try{let r=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip"));return await new Response(r).arrayBuffer()}catch(r){return t}}m();var PT=mt(Qd(),1),oi=mt(require("fs/promises"),1),rs=require("obsidian"),Be=mt(require("path"),1),Mu=require("path");m();var lh=mt(Nk(),1);m();var Ev=new W
Line truncated
|
||||
`){return t.split(r).reduce((i,n)=>{let s=e?n.trim():n;return s&&i.push(s),i},[])}function Yv(t,e){return Ru(t,!0).map(r=>e(r))}function Zv(t){return(0,lh.exists)(t,lh.FOLDER)}function Ai(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function RC(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function ch(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function An(t){return Array.isArray(t)?t:[t]}function $C(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function kl(t){return An(t).map(e=>e instanceof String?e:String(e))}function rt(t,e=0){if(t==null)return e;let r=parseInt(t,10);return Number.isNaN(r)?e:r}function Au(t,e){let r=[];for(let i=0,n=t.length;i<n;i++)r.push(e,t[i]);return r}function Tu(t){return(Array.isArray(t)?k.concat(t):t).toString("utf-8")}function FC(t,e){let r={};return e.forEach(i=>{t[i]!==void 0&&(r[i]=t[i])}),r}function Fv(t=0){return new Promise(e=>setTimeout(e,t))}function Iv(t){if(t!==!1)return t}var xl,La,$u,uh=Y({"src/lib/utils/util.ts"(){"use strict";Kv(),xl="\0",La=()=>{},$u=Object.prototype.toString.call.bind(Object.prototype.toString)}});function ur(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function Mv(t,e){let r=Si(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function fh(t){return!!t&&$u(t)==="[object Object]"}function IC(t){return typeof t=="function"}var Fu,MC,wt,nh,dh,Kv=Y({"src/lib/utils/argument-filters.ts"(){"use strict";uh(),Fu=t=>Array.isArray(t),MC=t=>typeof t=="number",wt=t=>typeof t=="string"||Si(t),nh=t=>wt(t)||Array.isArray(t)&&t.every(wt),dh=t=>t==null||"number|boolean|function".includes(typeof t)?!1:typeof t.length=="number"}}),Dv,k8=Y({"src/lib/utils/exit-codes.ts"(){"use strict";Dv=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(Dv||{})}}),sh,C8=Y({"src/lib/utils/git-output-streams.ts"(){"use strict";sh=class DC{constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new DC(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});function A8(){throw new Error("LineParser:useMatches not implemented")}var be,zs,T8=Y({"src/lib/utils/line-parser.ts"(){"use strict";be=class{constructor(t,e){this.matches=[],this.useMatches=A8,this.parse=(r,i)=>(this.resetMatches(),this._regExp.every((n,s)=>this.addMatch(n,s,r(s)))?this.useMatches(i,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let i=r&&t.exec(r);return i&&this.pushMatch(e,i),!!i}pushMatch(t,e){this.matches.push(...e.slice(1))}},zs=class extends be{addMatch(t,e,r){return/^remote:\s/.test(String(r))&&super.addMatch(t,e,r)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function OC(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...LC},...t.filter(i=>typeof i=="object"&&i));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var LC,P8=Y({"src/lib/utils/simple-git-options.ts"(){"use strict";LC={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function Xv(t,e=[]){return fh(t)?Object.keys(t).reduce((r,i)=>{let n=t[i];if(Si(n))r.push(n);else if(Mv(n,["boolean"]))r.push(i+"="+n);else if(Array.isArray(n))for(let s of n)Mv(s,["string","number"])||r.push(i+"="+s);else r.push(i);return r},e):e}function Sr(t,e=0,r=!1){let i=[];for(let n=0,s=e<0?t.length:e;n<s;n++)"string|number".includes(typeof t[n])&&i.push(String(t[n]));return Xv(Qv(t),i),r||i.push(...R8(t)),i}function R8(t){let e=typeof Oa(t)=="function";return kl(ur(Oa(t,e?1:0),Fu,[]))}function Qv(t){let e=IC(Oa(t));return ur(Oa(t,e?1:0),fh)}function ct(t,e=!0){let r=kC(Oa(t));return e||CC(r)?r:void 0}var $8=Y({"src/lib/utils/task-options.ts"(){"use strict";Kv(),uh()}});function Ov(t,e){return t(e.stdOut,e.stdErr)}function Vr(t,e,r,i=!0){return An(r).forEach(n=>{for(let s=Ru(n,i),a=0,o=s.length;a<o;a++){let l=(c=0)=>{if(!(a+c>=o))return s[a+c]};e.some(({parse:c})=>c(l,t))}}),t}var F8=Y({"src/lib/utils/task-parser.ts"(){"use strict";uh()}}),NC={};Pt(NC,{ExitCodes:()=>Dv,GitOutputStreams:()=>sh,LineParser:()=>be,NOOP:()=>La,NULL:()=>xl,RemoteLineParser:()=>zs,append:()=>Ai,appendTaskOptions:()=>Xv,asArray:()=>An,asCamelCase:()=>$C,asFunction:()=>kC,asNumber:()=>rt,asStringArray:()=>kl,bufferToString:()=>Tu,callTaskParser:()=>Ov,createInstanceConfig:()=>OC,delay:()=>Fv,filterArray:()=>Fu,filterFunction:()=>IC,filterHasLength:()=>dh,filterNumber:()=>MC,filterPlainObject:()=>fh,filterPrimitives:()=>Mv,filterString:()=>wt,filterStringOrStringArray:()=>nh,filterType:()=>ur,first:()=>TC,folderExists:()=>Zv,forEachLineWithContent:()=>Yv,getTrailingOptions:()=>Sr,including:()=>RC,isUserFunction:()=>CC,last:()=>Oa,objectToString:()=>$u,orVoid:()=>Iv,parseStringResponse:()=>Vr,pick:()=>FC,prefixedArray:()=>Au,remove:()=>ch,splitOn:()=>AC,toLinesWithContent:()=>Ru,trailingFunctionArgument:()=>ct,trailingOptionsArgument
Line truncated
|
||||
`)){let l=AC(a,`
|
||||
`);o=l[0],a=l[1]}yield{file:s,key:o,value:a}}}var tA,W8=Y({"src/lib/responses/ConfigList.ts"(){"use strict";ve(),tA=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||(this._all=this.files.reduce((t,e)=>Object.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=Oa(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let i=this.addFile(t);Object.hasOwn(i,e)?Array.isArray(i[e])?i[e].push(r):i[e]=[i[e],r]:i[e]=r,this._all=void 0}}}});function Cv(t,e){return typeof t=="string"&&Object.hasOwn(Bv,t)?t:e}function q8(t,e,r,i){let n=["config",`--${i}`];return r&&n.push("--add"),n.push(t,e),{commands:n,format:"utf-8",parser(s){return s}}}function Y8(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(i){return V8(i,t)}}}function Z8(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return j8(r)}}}function K8(){return{addConfig(t,e,...r){return this._runTask(q8(t,e,r[0]===!0,Cv(r[1],"local")),ct(arguments))},getConfig(t,e){return this._runTask(Y8(t,Cv(e,void 0)),ct(arguments))},listConfig(...t){return this._runTask(Z8(Cv(t[0],void 0)),ct(arguments))}}}var Bv,rA=Y({"src/lib/tasks/config.ts"(){"use strict";W8(),ve(),Bv=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(Bv||{})}});function X8(t){return iA.has(t)}var Av,iA,nA=Y({"src/lib/tasks/diff-name-status.ts"(){"use strict";Av=(t=>(t.ADDED="A",t.COPIED="C",t.DELETED="D",t.MODIFIED="M",t.RENAMED="R",t.CHANGED="T",t.UNMERGED="U",t.UNKNOWN="X",t.BROKEN="B",t))(Av||{}),iA=new Set(Object.values(Av))}});function Q8(...t){return new aA().param(...t)}function J8(t){let e=new Set,r={};return Yv(t,i=>{let[n,s,a]=i.split(xl);e.add(n),(r[n]=r[n]||[]).push({line:rt(s),path:n,preview:a})}),{paths:e,results:r}}function eH(){return{grep(t){let e=ct(arguments),r=Sr(arguments);for(let n of sA)if(r.includes(n))return this._runTask(Gr(`git.grep: use of "${n}" is not supported.`),e);typeof t=="string"&&(t=Q8().param(t));let i=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:i,format:"utf-8",parser(n){return J8(n)}},e)}}}var sA,Cu,Wk,aA,oA=Y({"src/lib/tasks/grep.ts"(){"use strict";ve(),kt(),sA=["-h"],Cu=Symbol("grepQuery"),aA=class{constructor(){this[Wk]=[]}*[(Wk=Cu,Symbol.iterator)](){for(let t of this[Cu])yield t}and(...t){return t.length&&this[Cu].push("--and","(",...Au(t,"-e"),")"),this}param(...t){return this[Cu].push(...Au(t,"-e")),this}}}}),lA={};Pt(lA,{ResetMode:()=>th,getResetMode:()=>rH,resetTask:()=>tH});function tH(t,e){let r=["reset"];return cA(t)&&r.push(`--${t}`),r.push(...e),kr(r)}function rH(t){if(cA(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function cA(t){return typeof t=="string"&&uA.includes(t)}var th,uA,fA=Y({"src/lib/tasks/reset.ts"(){"use strict";ve(),kt(),th=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(th||{}),uA=kl(Object.values(th))}});function iH(){return(0,ah.default)("simple-git")}function qk(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(i,...n)=>{t(i,...n),r(i,...n)}:t:(i,...n)=>{t(`%s ${i}`,e,...n),r&&r(i,...n)}}function nH(t,e,{namespace:r}){if(typeof t=="string")return t;let i=e&&e.namespace||"";return i.startsWith(r)?i.substr(r.length+1):i||r}function nw(t,e,r,i=iH()){let n=t&&`[${t}]`||"",s=[],a=typeof e=="string"?i.extend(e):e,o=nH(ur(e,wt),a,i);return c(r);function l(u,f){return Ai(s,nw(t,o.replace(/^[^:]+/,u),f,i))}function c(u){let f=u&&`[${u}]`||"",d=a&&qk(a,f)||La,h=qk(i,`${n} ${f}`,d);return Object.assign(a?d:h,{label:t,sibling:l,info:h,step:c})}}var dA=Y({"src/lib/git-logger.ts"(){"use strict";ve(),ah.default.formatters.L=t=>String(dh(t)?t.length:"-"),ah.default.formatters.B=t=>k.isBuffer(t)?t.toString("utf8"):$u(t)}}),hA,sH=Y({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";var t;Ws(),dA(),hA=(t=class{constructor(r="GitExecutor"){this.logLabel=r,this._queue=new Map}withProgress(r){return this._queue.get(r)}createProgress(r){let i=t.getName(r.commands[0]),n=nw(this.logLabel,i);return{task:r,logger:n,name:i}}push(r){let i=this.createProgress(r);return i.logger("Adding task to the queue, commands = %o",r.commands),this._queue.set(r,i),i}fatal(r){for(let[i,{logger:n}]of Array.from(this._queue.entries()))i===r.task?(n.info("Failed %o",r),n("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):n.info("A fatal exception occurred in a previous task, the queue has been purged: %o",r.message),this.complete(i);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(r){this.withProgress(r)&&this._queue.delete(r)}attempt(r){let i=this.withProgress(r);if(!i)throw new jr(void 0,"TasksPendingQueue: attempt called for an unknown task");return i.logger(
Line truncated
|
||||
`).map(e5).filter(Boolean);e||r.sort(function(n,s){let a=n.split("."),o=s.split(".");if(a.length===1||o.length===1)return J6(eh(a[0]),eh(o[0]));for(let l=0,c=Math.max(a.length,o.length);l<c;l++){let u=yT(eh(a[l]),eh(o[l]));if(u)return u}return 0});let i=e?r[0]:[...r].reverse().find(n=>n.indexOf(".")>=0);return new wC(r,i)}}}),ET={};Pt(ET,{addAnnotatedTagTask:()=>n5,addTagTask:()=>i5,tagListTask:()=>r5});function r5(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return xT(r,e)}}}function i5(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function n5(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var s5=Y({"src/lib/tasks/tag.ts"(){"use strict";t5()}}),a5=E8({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(lH(),St(mA)),{SimpleGitApi:i}=(l6(),St(KA)),{Scheduler:n}=(c6(),St(XA)),{adhocExecTask:s,configurationErrorTask:a}=(kt(),St(Nv)),{asArray:o,filterArray:l,filterPrimitives:c,filterString:u,filterStringOrStringArray:f,filterType:d,getTrailingOptions:h,trailingFunctionArgument:p,trailingOptionsArgument:g}=(ve(),St(NC)),{applyPatchTask:v}=(f6(),St(eT)),{branchTask:b,branchLocalTask:_,deleteBranchesTask:C,deleteBranchTask:x}=(x6(),St(oT)),{checkIgnoreTask:E}=(C6(),St(fT)),{checkIsRepoTask:A}=(GC(),St(BC)),{cleanWithOptionsTask:w,isCleanOptionsArray:S}=(JC(),St(XC)),{diffSummaryTask:y}=(fw(),St(TA)),{fetchTask:P}=($6(),St(hT)),{moveTask:T}=(D6(),St(mT)),{pullTask:I}=(L6(),St(gT)),{pushTagsTask:M}=(jA(),St(GA)),{addRemoteTask:B,getRemotesTask:re,listRemotesTask:Ae,remoteTask:K,removeRemoteTask:Q}=(W6(),St(wT)),{getResetMode:fe,resetTask:ce}=(fA(),St(lA)),{stashListTask:z}=(Y6(),St(bT)),{addSubModuleTask:X,initSubModuleTask:j,subModuleTask:Ze,updateSubModuleTask:$r}=(Q6(),St(_T)),{addAnnotatedTagTask:cr,addTagTask:Ie,tagListTask:yt}=(s5(),St(ET)),{straightThroughBufferTask:Tt,straightThroughStringTask:Ke}=(kt(),St(Nv));function J(L,W){this._plugins=W,this._executor=new r(L.baseDir,new n(L.maxConcurrentProcesses),W),this._trimmed=L.trimmed}(J.prototype=Object.create(i.prototype)).constructor=J,J.prototype.customBinary=function(L){return this._plugins.reconfigure("binary",L),this},J.prototype.env=function(L,W){return arguments.length===1&&typeof L=="object"?this._executor.env=L:(this._executor.env=this._executor.env||{})[L]=W,this},J.prototype.stashList=function(L){return this._runTask(z(g(arguments)||{},l(L)&&L||[]),p(arguments))},J.prototype.mv=function(L,W){return this._runTask(T(L,W),p(arguments))},J.prototype.checkoutLatestTag=function(L){var W=this;return this.pull(function(){W.tags(function(xe,Xe){W.checkout(Xe.latest,L)})})},J.prototype.pull=function(L,W,xe,Xe){return this._runTask(I(d(L,u),d(W,u),h(arguments)),p(arguments))},J.prototype.fetch=function(L,W){return this._runTask(P(d(L,u),d(W,u),h(arguments)),p(arguments))},J.prototype.silent=function(L){return this._runTask(s(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},J.prototype.tags=function(L,W){return this._runTask(yt(h(arguments)),p(arguments))},J.prototype.rebase=function(){return this._runTask(Ke(["rebase",...h(arguments)]),p(arguments))},J.prototype.reset=function(L){return this._runTask(ce(fe(L),h(arguments)),p(arguments))},J.prototype.revert=function(L){let W=p(arguments);return typeof L!="string"?this._runTask(a("Commit must be a string"),W):this._runTask(Ke(["revert",...h(arguments,0,!0),L]),W)},J.prototype.addTag=function(L){let W=typeof L=="string"?Ie(L):a("Git.addTag requires a tag name");return this._runTask(W,p(arguments))},J.prototype.addAnnotatedTag=function(L,W){return this._runTask(cr(L,W),p(arguments))},J.prototype.deleteLocalBranch=function(L,W,xe){return this._runTask(x(L,typeof W=="boolean"?W:!1),p(arguments))},J.prototype.deleteLocalBranches=function(L,W,xe){return this._runTask(C(L,typeof W=="boolean"?W:!1),p(arguments))},J.prototype.branch=function(L,W){return this._runTask(b(h(arguments)),p(arguments))},J.prototype.branchLocal=function(L){return this._runTask(_(),p(arguments))},J.prototype.raw=function(L){let W=!Array.isArray(L),xe=[].slice.call(W?arguments:L,0);for(let Dt=0;Dt<xe.length&&W;Dt++)if(!c(xe[Dt])){xe.splice(Dt,xe.length-Dt);break}xe.push(...h(arguments,0,!0));var Xe=p(arguments);return xe.length?this._runTask(Ke(xe,this._trimmed),Xe):this._runTask(a("Raw: must supply one or more command to execute"),Xe)},J.prototype.submoduleAdd=function(L,W,xe){return this._runTask(X(L,W),p(arguments))},J.prototype.submoduleUpdate=function(L,W){return this._runTask($r(h(arguments,!0)),p(arguments))},J.prototype.submoduleInit=function(L,W){return this._runTask(j(h(arguments,!0)),p(arguments))},J.prototype.subModule=function(L,W){return this._runTask(Ze(h(arguments)),p(arguments))},J.prototype.listRemote=function(){return this._runTask(Ae(h(arguments)),p(arguments))},J.prototype.addRemo
Line truncated
|
||||
`).some(l=>l.contains(n))||await oi.appendFile(r,n+`
|
||||
`)}catch(r){console.error("Error while adding askpass script to exclude file:",r)}}unload(){var r;(r=this.watchAbortController)==null||r.abort()}async status(r){let i=r==null?void 0:r.path,n=await this.git.status(i!=null?["--",i]:[]),s=n.files.map(a=>{let o=this.formatPath(a);return{path:o.path,from:o.from,index:a.index==="?"?"U":a.index,workingDir:a.working_dir==="?"?"U":a.working_dir,vaultPath:this.getRelativeVaultPath(o.path)}});return{all:s,changed:s.filter(a=>a.workingDir!==" "),staged:s.filter(a=>a.index!==" "&&a.index!="U"),conflicted:n.conflicted.map(a=>this.formatPath({path:a}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(r){let i=this.getRelativeRepoPath(r),s=["-C",Be.dirname(i),"rev-parse","HEAD"],a=this.git.raw(s);return a.catch(o=>console.warn("obsidian-git: rev-parse error:",o)),(await a).trim()}async getSubmodulePaths(){return new Promise(r=>{this.git.outputHandler((i,n,s,a)=>{if(!(a.contains("submodule")&&a.contains("foreach")))return;let o="",l=this.absoluteRepoPath;n.on("data",c=>{o+=c.toString("utf8")}),n.on("end",()=>{let u=o.split(`
|
||||
`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+Mu.sep}).filter(f=>!!f);u.reverse(),r(u)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},i=>this.plugin.displayError(i))})}formatPath(r){function i(n){if(n!=null)return n.startsWith('"')&&n.endsWith('"')?n.substring(1,n.length-1):n}return r.from!=null?{from:i(r.from),path:i(r.path)}:{path:i(r.path)}}async blame(r,i,n){if(r=this.getRelativeRepoPath(r),!await this.isTracked(r))return"untracked";let s=await this.getSubmoduleOfFile(r),a=s?["-C",s.submodule]:[],o=s?s.relativeFilepath:r;a.push("blame","--porcelain"),n&&a.push("-w");let l=`-C${Hd}`;switch(i){case"inactive":break;case"same-commit":a.push("-C",l);break;case"all-commits":a.push("-C","-C",l);break;default:js(i)}a.push("--",o);let c=await this.git.raw(a);return C5(c)}async isTracked(r){let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("ls-files","--",s),this.git.raw(n).then(a=>a.trim()!=="")}async commitAll({message:r}){return this.withGitOperation(2,async()=>{if(this.plugin.settings.updateSubmodules){let n=await this.getSubmodulePaths();for(let s of n)await this.git.cwd({path:s,root:!1}).add("-A"),await this.git.cwd({path:s,root:!1}).commit(await this.formatCommitMessage(r))}await this.git.add("-A");let i=await this.git.commit(await this.formatCommitMessage(r));return this.app.workspace.trigger("obsidian-git:head-change"),i.summary.changes})}async commit({message:r,amend:i}){return this.withGitOperation(2,async()=>{let n=(await this.git.commit(await this.formatCommitMessage(r),i?["--amend"]:[])).summary.changes;return this.app.workspace.trigger("obsidian-git:head-change"),n})}async stage(r,i){r=this.getRelativeRepoPath(r,i),await this.git.add(["--",r])}async stageAll({dir:r}){await this.git.add(r!=null?r:"-A")}async unstageAll({dir:r}){await this.git.reset(r!=null?["--",r]:[])}async unstage(r,i){r=this.getRelativeRepoPath(r,i),await this.git.reset(["--",r])}async discard(r){await this.isTracked(r)&&await this.git.checkout(["--progress","--",r])}async applyPatch(r){let i=Be.join(this.relPluginConfigPath,"patch");await this.app.vault.adapter.write(i,r),await this.git.applyPatch(i,{"--cached":null,"--unidiff-zero":null,"--whitespace":"nowarn"}),await this.app.vault.adapter.remove(i)}async getUntrackedPaths(r){let i=r==null?void 0:r.path,n=[];return i!=null&&n.push("--",i),(await this.git.clean(Da.RECURSIVE+Da.DRY_RUN,n)).paths}async hashObject(r){r=this.getRelativeRepoPath(r);let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("hash-object","--",s),this.git.raw(n)}async discardAll({dir:r}){return this.discard(r!=null?r:".")}async pull(){return this.withGitOperation(1,async()=>{try{this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"]);let r=await this.branchInfo();if(!r.current){this.plugin.displayError("No current branch found. Cannot pull.");return}let i=await this.git.revparse([r.current]);if(!r.tracking&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring pull of main repo and updating submodules only.");return}await this.git.fetch();let n=await this.git.revparse([r.tracking]);if(i!==n){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{let o=[r.tracking];switch(this.plugin.settings.mergeStrategy!=="none"&&o.push(`--strategy-option=${this.plugin.settings.mergeStrategy}`),this.plugin.settings.syncMethod){case"merge":await this.git.merge(o);break;case"rebase":await this.git.rebase(o)}}catch(o){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${TT(o)}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${r.current}`,n]),await this.git.reset([])}catch(o){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${TT(o)}`)}this.app.workspace.trigger("obsidian-git:head-change");let s=await this.git.revparse([r.current]);return(await this.git.diff([`${i}..${s}`,"--name-only"])).split(/\r\n|\r|\n/).filter(o=>o.length>0).map(o=>({path:o,workingDir:"P",vaultPath:this.getRelativeVaultPath(o)}))}else return[]}catch(r){this.convertErrors(r)}})}async push(){return this.withGitOperation(3,async()=>{try{if(this.plugin.settings.updateSubmodules){let a=await this.git.subModule(["foreach","--recursive",`tracking=$(git for-each-ref --format='%(upstream:short)' "$(git symbolic-ref -q HEAD)"); echo $tracking; if [ ! -z "$(git diff --shortstat $tracking)" ]; then git push; fi`]);console.log(a)}let i=(await this.git.status()).current;if(!i){this.plugin.displayError("No current branch found. Cannot push.");return}let n=await this.getPushTarget(i);if(!n&&this.plugin.settings.updateSubmodules){this.plugin.log("No push target found. Ignoring push of main repo and updating submodules only.");return}let s=null;return n!=null&&n.e
Line truncated
|
||||
`):[]}async removeRemote(r){await this.git.removeRemote(r)}async updateUpstreamBranch(r){try{await this.git.branch(["--set-upstream-to",r])}catch(i){try{await this.git.branch(["--set-upstream",r])}catch(n){let[s,a]=Vs(r),o=await this.branchInfo();await this.git.push(["--set-upstream",s,`${o.current}:${a}`])}}}updateGitPath(r){return this.setGitInstance()}updateBasePath(r){return this.setGitInstance(!0)}async getDiffString(r,i=!1,n){return i?await this.git.diff(["--cached","--",r]):n?await this.git.show([`${n}`,"--",r]):await this.git.diff(["--",r])}async diff(r,i,n){return await this.git.diff([`${i}..${n}`,"--",r])}async rawCommand(r){let i=r.split(" "),n=i[0];return n===void 0?"":await this.git.raw(n,...i.slice(1))}async getSubmoduleOfFile(r){if(!await this.app.vault.adapter.exists(Be.dirname(r)))return;let i=await this.git.raw(["-C",Be.dirname(r),"rev-parse","--show-toplevel"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message));if(i=i.trim(),(await this.git.raw(["-C",Be.dirname(r),"rev-parse","--show-superproject-working-tree"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message))).trim()==="")return;let a=this.app.vault.adapter.getFullPath(Be.normalize(r)),o=Be.relative(i,a);return{submodule:i,relativeFilepath:o}}async getLastCommitTime(){try{let r=await this.git.log({n:1});if(r!=null&&r.latest!=null)return new Date(r.latest.date)}catch(r){if(r instanceof jr){if(r.message.contains("does not have any commits yet"))return}else throw r}}async isGitInstalled(){let r=this.plugin.localStorage.getGitPath(),i=await Su(r||"git",["--version"],{});if(i.error)if(rs.Platform.isWin&&!r){this.plugin.log(`Git not found in PATH. Checking standard installation path(${Ud}) of Git for Windows.`);let n=await Su(Ud,["--version"]);if(n.error)return console.error(n.error),!1;this.useDefaultWindowsGitPath=!0}else return console.error(i.error),!1;else this.useDefaultWindowsGitPath=!1;return!0}convertErrors(r){if(r instanceof jr){let i=String(r.message);if(i.contains("Could not resolve host")||i.contains("Unable to resolve host")||i.contains("Unable to open connection")||i.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||i.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||i.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new ll(i)}throw r}async isFileTrackedByLFS(r){try{return(await this.git.raw(["check-attr","filter",r])).includes("filter: lfs")}catch(i){let n=i instanceof Error?i.message:String(i);return this.plugin.displayError(`Error checking LFS status: ${n}`),!1}}},RT={hash:"000000",isZeroCommit:!0,summary:""};function C5(t){let r=t.replace(`\r
|
||||
`,`
|
||||
`).split(`
|
||||
`),i={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},n=1;for(let s=0;s<r.length;){if(s2(r[s])){let a=r[s].split(" "),o=H6(a,n,i);for(s++;s2(r[s]);s++){let l=r[s].split(" ");U6(l,i,n)}G6(i.commits.get(o)),n+=1}else if(!(r[s]===""&&s===r.length-1))throw Error(`Expected non-whitespace line or EOF, but found: ${r[s]}`);s++}return i}function H6(t,e,r){let i=t[0];if(r.hashPerLine.push(i),r.originalFileLineNrPerLine.push(parseInt(t[1])),r.finalFileLineNrPerLine.push(parseInt(t[2])),t.length>=4&&r.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(t[2])!==e)throw Error(`git-blame output is out of order: ${e} vs ${t[2]}`);return i}function U6(t,e,r){let i=t[0],n=t.slice(1).join(" "),s=e.hashPerLine[r],a=e.commits.get(s)||{hash:s,author:{},committer:{},previous:{}};switch(i){case"summary":a.summary=n;break;case"author":a.author.name=n;break;case"author-mail":a.author.email=a2(n);break;case"author-time":a.author.epochSeconds=parseInt(n);break;case"author-tz":a.author.tz=n;break;case"committer":a.committer.name=n;break;case"committer-mail":a.committer.email=a2(n);break;case"committer-time":a.committer.epochSeconds=parseInt(n);break;case"committer-tz":a.committer.tz=n;break;case"previous":a.previous.commitHash=n;break;case"filename":a.previous.filename=n;break}e.commits.set(s,a)}function G6(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);Jv(t.author)&&(t.author=void 0),Jv(t.committer)&&(t.committer=void 0),Jv(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function Jv(t){return!t||Object.keys(t).length===0}function s2(t){return t.length>0&&t[0].trim()===t[0]}function a2(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}m();var M2=require("@codemirror/state");m();var ew=class{constructor(){this.eventsPerFilepath=new Map;this.startRemoveStalesSubscribersInterval()}ifFilepathDefinedTransformSubscribers(e,r){if(e)return this.ensureInitialized(e),r(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(r=>r.forEach(e))}ensureInitialized(e){this.eventsPerFilepath.get(e)||this.eventsPerFilepath.set(e,new Set)}startRemoveStalesSubscribersInterval(){this.removeStalesSubscribersTimer=window.setInterval(()=>this==null?void 0:this.forEachSubscriber(e=>e==null?void 0:e.removeIfStale()),6e4)}clear(){window.clearInterval(this.removeStalesSubscribersTimer),this.eventsPerFilepath.clear()}},es=new ew;m();var Jd=require("@codemirror/state"),c2=Ht(tw(),1);function u2(t,e,r){if(!(t===void 0||e===void 0||r===void 0))return`head${t}-obj${e}-path${r}`}var f2=Jd.StateEffect.define();function d2(t,e,r){return r.update({effects:f2.of({key:t,la:e,lineOffsetsFromUnsavedChanges:new Map})})}var Sl=Jd.StateField.define({create:t=>{},update:(t,e)=>{for(let r of e.effects)if(r.is(f2))return r.value;return j6(e,t)},compare:(t,e)=>(t==null?void 0:t.key)===(e==null?void 0:e.key)});function eh(t){var s;let e=c2.sha256.create();if(!t)return e;let{la:r,key:i,lineOffsetsFromUnsavedChanges:n}=t;e.update(r==="untracked"?"t":"f"),e.update(i);for(let[a,o]of(s=n.entries())!=null?s:[])e.update([a,o]);return e}var xu={get:void 0,save:void 0};function h2(t,e){xu.get=t,xu.save=e}function th(t){var e,r;return(r=(e=Eu(t.coloringMaxAge))==null?void 0:e.asDays())!=null?r:Eu(ht.lineAuthor.coloringMaxAge).asDays()}function j6(t,e){if(e)return t.changes.empty||t.changes.iterChanges((r,i,n,s)=>{var p;let a=t.startState.doc,{newDoc:o}=t,l=a.lineAt(r).number,c=a.lineAt(i).number,u=o.lineAt(n).number,f=o.lineAt(s).number,d=c-l+1,h=f-u+1;for(let g=u;g<=f;g++){let v=(p=e.lineOffsetsFromUnsavedChanges.get(g))!=null?p:0,_=f===g,b=h-d;_&&(v+=b),e.lineOffsetsFromUnsavedChanges.set(g,v)}}),e}m();function p2(){kl=void 0,rw=[],rh=0,nh.clear(),sh.clear(),Al.clear()}var kl,ih=()=>kl;function m2(t,e){var n;let r=e.length;if(r<((n=kl==null?void 0:kl.length)!=null?n:0))return;kl={gutter:t,length:r,text:e};let i=jt.plugin.localStorage.getGutterSpacingFallbackLength();r!==i&&jt.plugin.localStorage.setGutterSpacingFallbackLength(r)}var rw=[],V6=15,rh=0;function g2(t){rw[rh]=t,rh=(rh+1)%V6}function v2(){return eA(rw)}var nh=new Map,sh=new Map,Al=new Set;m();var $2=require("@codemirror/state"),F2=require("@codemirror/view");m();var aw=require("@codemirror/view"),A2=Ht(tw(),1),Cl=require("obsidian");m();m();var ah={x:-10,y:-10};function w2(){ah.x===-10&&window.addEventListener("mousedown",t=>{ah.x=t.clientX,ah.y=t.clientY})}function _2(){for(let t of Al)if(z6(t,ah))return t}function z6(t,e){let{x:r,y:i,width:n,height:s}=t.getBoundingClientRect();return r<=e.x&&e.x<=r+n&&i<=e.y&&e.y<=i+s}var b2="data-commit";function y2(t,e,r){if(e.hasFocus())return;let i=_2();if(!i)return;let n=q6(i);n&&(!n.isZeroCommit&&!n.isWaitingGutter&&W6(n,t),iw("showCommitHash",t),iw("authorDisplay",t),iw("dateTimeFormatOptions",t))}function W6(t,e){e.addItem(r=>r.setTitle("Copy commit hash").setIcon("
Line truncated
|
||||
If turned on, do auto ${n} every ${iA(i.settings.autoSaveInterval)} after stopping file edits.
|
||||
This also prevents auto ${n} while editing a file. If turned off, it's independent from the last file edit.`).addToggle(f=>f.setValue(i.settings.autoBackupAfterFileChange).onChange(async d=>{i.settings.autoBackupAfterFileChange=d,this.refreshDisplayWithDelay(),await i.saveSettings(),i.automaticsManager.reload("commit")})),this.mayDisableSetting(a,i.settings.setLastSaveToLastCommit),a=new U.Setting(r).setName(`Auto ${n} after latest commit`).setDesc(`If turned on, sets last auto ${n} timestamp to the latest commit timestamp. This reduces the frequency of auto ${n} when doing manual commits.`).addToggle(f=>f.setValue(i.settings.setLastSaveToLastCommit).onChange(async d=>{i.settings.setLastSaveToLastCommit=d,await i.saveSettings(),i.automaticsManager.reload("commit"),this.refreshDisplayWithDelay()})),this.mayDisableSetting(a,i.settings.autoBackupAfterFileChange),a=new U.Setting(r).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPushInterval"}),f.setPlaceholder(String(ht.autoPushInterval)),f.onChange(async d=>{d!==""?i.settings.autoPushInterval=Number(d):i.settings.autoPushInterval=ht.autoPushInterval,await i.saveSettings(),i.automaticsManager.reload("push")})}),this.mayDisableSetting(a,!i.settings.differentIntervalCommitAndPush),new U.Setting(r).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPullInterval"}),f.setPlaceholder(String(ht.autoPullInterval)),f.onChange(async d=>{d!==""?i.settings.autoPullInterval=Number(d):i.settings.autoPullInterval=ht.autoPullInterval,await i.saveSettings(),i.automaticsManager.reload("pull")})}),new U.Setting(r).setName(`Auto ${n} only staged files`).setDesc(`If turned on, only staged files are committed on ${n}. If turned off, all changed files are committed.`).addToggle(f=>f.setValue(i.settings.autoCommitOnlyStaged).onChange(async d=>{i.settings.autoCommitOnlyStaged=d,await i.saveSettings()})),new U.Setting(r).setName(`Specify custom commit message on auto ${n}`).setDesc("You will get a pop up to specify your message.").addToggle(f=>f.setValue(i.settings.customMessageOnAutoBackup).onChange(async d=>{i.settings.customMessageOnAutoBackup=d,await i.saveSettings(),this.refreshDisplayWithDelay()})),a=new U.Setting(r).setName(`Commit message on auto ${n}`).setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(f=>{f.setPlaceholder(ht.autoCommitMessage).onChange(async d=>{d===""?i.settings.autoCommitMessage=ht.autoCommitMessage:i.settings.autoCommitMessage=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"autoCommitMessage"})}),this.mayDisableSetting(a,i.settings.customMessageOnAutoBackup),new U.Setting(r).setName("Commit message").setHeading();let c=new U.Setting(r).setName("Commit message on manual commit").setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message). Leave empty to require manual input on each commit.");c.addTextArea(f=>{c.addButton(d=>{d.setIcon("reset").setTooltip(`Set to default: "${ht.commitMessage}"`).onClick(()=>{f.setValue(ht.commitMessage),f.onChanged()})}),f.setValue(i.settings.commitMessage),f.onChange(async d=>{i.settings.commitMessage=d,await i.saveSettings()})}),U.Platform.isDesktopApp&&new U.Setting(r).setName("Commit message script").setDesc("A script that is run using 'sh -c' to generate the commit message. May be used to generate commit messages using AI tools. Available placeholders: {{hostname}}, {{date}}.").addText(f=>{f.onChange(async d=>{d===""?i.settings.commitMessageScript=ht.commitMessageScript:i.settings.commitMessageScript=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"commitMessageScript"})});let u=new U.Setting(r).setName("{{date}} placeholder format").addMomentFormat(f=>f.setDefaultFormat(i.settings.commitDateFormat).setValue(i.settings.commitDateFormat).onChange(async d=>{i.settings.commitDateFormat=d,await i.saveSettings()}));u.descEl.createSpan({text:` Specify custom date format. E.g. "${Ug}. See `}),u.descEl.createEl("a",{text:"Moment.js documentation",href:O2,attr:{target:"_blank"}}),u.descEl.createSpan({text:" for more formats."}),new U.Setting(r).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device. Defaults to the OS hostname if not set on desktop.").addText(f=>{var d;return f.setValue((d=i.localStorage.getHostname())!=null?d:"").onChange(h=>{i.localStorage.setHostname(h)})}),new U.Setting(r).setName("Preview commit message").addButton(f=>f.se
Line truncated
|
||||
`),i={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},n=1;for(let s=0;s<r.length;){let a=r[s];if(CT(a)){let o=a.split(" "),l=A5(o,n,i);for(s++;CT(r[s]);s++){let c=r[s].split(" ");T5(c,i,n)}P5(i.commits.get(l)),n+=1}else if(!(a===""&&s===r.length-1))throw Error(`Expected non-whitespace line or EOF, but found: ${a}`);s++}return i}function A5(t,e,r){let i=t[0],n=t[1],s=t[2];if(i===void 0||n===void 0||s===void 0)throw Error(`Invalid git-blame line info: ${t.join(" ")}`);if(r.hashPerLine.push(i),r.originalFileLineNrPerLine.push(parseInt(n)),r.finalFileLineNrPerLine.push(parseInt(s)),t.length>=4&&r.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(s)!==e)throw Error(`git-blame output is out of order: ${e} vs ${s}`);return i}function T5(t,e,r){let i=t[0],n=t.slice(1).join(" "),s=e.hashPerLine[r];if(s===void 0)throw Error(`No commit hash found for git-blame line ${r}`);let a=e.commits.get(s)||{hash:s,author:{},committer:{},previous:{}};switch(i){case"summary":a.summary=n;break;case"author":a.author.name=n;break;case"author-mail":a.author.email=AT(n);break;case"author-time":a.author.epochSeconds=parseInt(n);break;case"author-tz":a.author.tz=n;break;case"committer":a.committer.name=n;break;case"committer-mail":a.committer.email=AT(n);break;case"committer-time":a.committer.epochSeconds=parseInt(n);break;case"committer-tz":a.committer.tz=n;break;case"previous":a.previous.commitHash=n;break;case"filename":a.previous.filename=n;break}e.commits.set(s,a)}function P5(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);mw(t.author)&&(t.author=void 0),mw(t.committer)&&(t.committer=void 0),mw(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function mw(t){return!t||Object.keys(t).length===0}function CT(t){return t===void 0?!1:t.length>0&&t[0].trim()===t[0]}function AT(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}function TT(t){return t instanceof Error?t.message:String(t)}m();var t2=require("@codemirror/state");m();var gw=class{constructor(){this.eventsPerFilepath=new Map;this.init()}ifFilepathDefinedTransformSubscribers(e,r){if(e)return this.ensureInitialized(e),r(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(r=>r.forEach(e))}ensureInitialized(e){this.eventsPerFilepath.get(e)||this.eventsPerFilepath.set(e,new Set)}init(){this.removeStalesSubscribersTimer===void 0&&this.startRemoveStalesSubscribersInterval()}startRemoveStalesSubscribersInterval(){this.removeStalesSubscribersTimer=window.setInterval(()=>this==null?void 0:this.forEachSubscriber(e=>e==null?void 0:e.removeIfStale()),6e4)}clear(){this.removeStalesSubscribersTimer!==void 0&&(window.clearInterval(this.removeStalesSubscribersTimer),this.removeStalesSubscribersTimer=void 0),this.eventsPerFilepath.clear()}},Ti=new gw;m();var wh=require("@codemirror/state");m();function R5(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var $T={exports:{}};(function(t){(function(){var e="input is invalid type",r=typeof window=="object",i=r?window:{};i.JS_SHA256_NO_WINDOW&&(r=!1);var n=!r&&typeof self=="object";n&&(i=self);var s=!i.JS_SHA256_NO_COMMON_JS&&!0&&t.exports,a=!i.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",o="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],c=[24,16,8,0],u=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],f=["hex","array","digest","arrayBuffer"],d=[];(i.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}),a&&(i.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(x){return typeof x=="object"&&x.buffer&&x.buffer.constructor===ArrayBuffer});var h=function(x,E){return function(A){return new b(E,!0).update(A)[x]()}},p=function(x){var E=h("hex",x);E.create=function(){return new b(x)},E.update=function(S){return E.create().update(S)};for(var A=0;A<f.length;++A){var w=f[A];E[w]=h(w,x)}return E},g=function(x,E){return function(A,w){return new _(A,E,!0).update(w)[x]()}},v=function(x){var E=g("hex",x);E.create=function(S){return new _(S,x)},E.update=function(S,y){return E.create(S).update(y)};for(var A=0;A<f.length;++A){var w=f[A];E[w]=g
Line truncated
|
||||
If turned on, do auto ${n} every ${Sk(i.settings.autoSaveInterval)} after stopping file edits.
|
||||
This also prevents auto ${n} while editing a file. If turned off, it's independent from the last file edit.`).addToggle(f=>f.setValue(i.settings.autoBackupAfterFileChange).onChange(async d=>{i.settings.autoBackupAfterFileChange=d,this.refreshDisplayWithDelay(),await i.saveSettings(),i.automaticsManager.reload("commit")})),this.mayDisableSetting(a,i.settings.setLastSaveToLastCommit),a=new U.Setting(r).setName(`Auto ${n} after latest commit`).setDesc(`If turned on, sets last auto ${n} timestamp to the latest commit timestamp. This reduces the frequency of auto ${n} when doing manual commits.`).addToggle(f=>f.setValue(i.settings.setLastSaveToLastCommit).onChange(async d=>{i.settings.setLastSaveToLastCommit=d,await i.saveSettings(),i.automaticsManager.reload("commit"),this.refreshDisplayWithDelay()})),this.mayDisableSetting(a,i.settings.autoBackupAfterFileChange),a=new U.Setting(r).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPushInterval"}),f.setPlaceholder(String(tt.autoPushInterval)),f.onChange(async d=>{d!==""?i.settings.autoPushInterval=Number(d):i.settings.autoPushInterval=tt.autoPushInterval,await i.saveSettings(),i.automaticsManager.reload("push")})}),this.mayDisableSetting(a,!i.settings.differentIntervalCommitAndPush),new U.Setting(r).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPullInterval"}),f.setPlaceholder(String(tt.autoPullInterval)),f.onChange(async d=>{d!==""?i.settings.autoPullInterval=Number(d):i.settings.autoPullInterval=tt.autoPullInterval,await i.saveSettings(),i.automaticsManager.reload("pull")})}),new U.Setting(r).setName(`Auto ${n} only staged files`).setDesc(`If turned on, only staged files are committed on ${n}. If turned off, all changed files are committed.`).addToggle(f=>f.setValue(i.settings.autoCommitOnlyStaged).onChange(async d=>{i.settings.autoCommitOnlyStaged=d,await i.saveSettings()})),new U.Setting(r).setName(`Specify custom commit message on auto ${n}`).setDesc("You will get a pop up to specify your message.").addToggle(f=>f.setValue(i.settings.customMessageOnAutoBackup).onChange(async d=>{i.settings.customMessageOnAutoBackup=d,await i.saveSettings(),this.refreshDisplayWithDelay()})),a=new U.Setting(r).setName(`Commit message on auto ${n}`).setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(f=>{f.setPlaceholder(tt.autoCommitMessage).onChange(async d=>{d===""?i.settings.autoCommitMessage=tt.autoCommitMessage:i.settings.autoCommitMessage=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"autoCommitMessage"})}),this.mayDisableSetting(a,i.settings.customMessageOnAutoBackup),new U.Setting(r).setName("Commit").setHeading(),new U.Setting(r).setName("Stage all changes when nothing is staged").setDesc("When using Commit with nothing staged, stage and commit all changes. When disabled, changes must be staged first. Commit all changes and Commit-and-sync are unaffected.").addToggle(f=>f.setValue(i.settings.autoStageOnEmptyIndex).onChange(async d=>{i.settings.autoStageOnEmptyIndex=d,await i.saveSettings()}));let c=new U.Setting(r).setName("Commit message on manual commit").setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message). Leave empty to require manual input on each commit.");c.addTextArea(f=>{c.addButton(d=>{d.setIcon("reset").setTooltip(`Set to default: "${tt.commitMessage}"`).onClick(()=>{f.setValue(tt.commitMessage),f.onChanged()})}),f.setValue(i.settings.commitMessage),f.onChange(async d=>{i.settings.commitMessage=d,await i.saveSettings()})}),U.Platform.isDesktopApp&&new U.Setting(r).setName("Commit message script").setDesc("A script that is run using 'sh -c' to generate the commit message. May be used to generate commit messages using AI tools. Available placeholders: {{hostname}}, {{date}}.").addText(f=>{f.onChange(async d=>{d===""?i.settings.commitMessageScript=tt.commitMessageScript:i.settings.commitMessageScript=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"commitMessageScript"})});let u=new U.Setting(r).setName("{{date}} placeholder format").addMomentFormat(f=>f.setDefaultFormat(i.settings.commitDateFormat).setValue(i.settings.commitDateFormat).onChange(async d=>{i.settings.commitDateFormat=d,await i.saveSettings()}));u.descEl.createSpan({text:` Specify custom date format. E.g. "${fv}. See `}),u.descEl.createEl("a",{text:"Moment.js documentation",href:i2,attr:{target:"_blank"}}),u.descEl.createSpan({text:" for mor
Line truncated
|
||||
`)),c.onChange(u=>{i.localStorage.setEnvVars(u.split(`
|
||||
`))})}),i.gitManager instanceof Se&&new U.Setting(r).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(c=>{c.setValue(i.localStorage.getPATHPaths().join(`
|
||||
`))})}),i.gitManager instanceof ke&&new U.Setting(r).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(c=>{c.setValue(i.localStorage.getPATHPaths().join(`
|
||||
`)),c.onChange(u=>{i.localStorage.setPATHPaths(u.split(`
|
||||
`))})}),i.gitManager instanceof Se&&new U.Setting(r).setName("Reload with new environment variables").setDesc("Removing previously added environment variables will not take effect until Obsidian is restarted.").addButton(c=>{c.setButtonText("Reload"),c.setCta(),c.onClick(async()=>{await i.gitManager.setGitInstance()})}),new U.Setting(r).setName("Custom base path (Git repository path)").setDesc(`
|
||||
`))})}),i.gitManager instanceof ke&&new U.Setting(r).setName("Reload with new environment variables").setDesc("Removing previously added environment variables will not take effect until Obsidian is restarted.").addButton(c=>{c.setButtonText("Reload"),c.setCta(),c.onClick(async()=>{await i.gitManager.setGitInstance()})}),new U.Setting(r).setName("Custom base path (Git repository path)").setDesc(`
|
||||
Sets the relative path to the vault from which the Git binary should be executed.
|
||||
Mostly used to set the path to the Git repository, which is only required if the Git repository is below the vault root directory. Use "\\" instead of "/" on Windows.
|
||||
`).addText(c=>{c.setValue(i.settings.basePath),c.setPlaceholder("directory/directory-with-git-repo"),c.onChange(async u=>{i.settings.basePath=u,await i.saveSettings(),i.gitManager.updateBasePath(u||"").catch(f=>i.displayError(f))})}),new U.Setting(r).setName("Custom Git directory path (Instead of '.git')").setDesc('Corresponds to the GIT_DIR environment variable. Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(c=>{c.setValue(i.settings.gitDir),c.setPlaceholder(".git"),c.onChange(async u=>{i.settings.gitDir=u,await i.saveSettings()})}),new U.Setting(r).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(c=>c.setValue(i.localStorage.getPluginDisabled()).onChange(u=>{i.localStorage.setPluginDisabled(u),u?i.unloadPlugin():i.init({fromReload:!0}).catch(f=>i.displayError(f)),new U.Notice("Obsidian must be restarted for the changes to take affect.")})),new U.Setting(r).setName("Support").setHeading(),new U.Setting(r).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(c=>{var f;let u=(f=c.buttonEl.parentElement)==null?void 0:f.createEl("a",{href:"https://ko-fi.com/F1F195IQ5",attr:{target:"_blank"}});u&&(u.createEl("img",{attr:{height:"36",style:"border:0px;height:36px;",src:"https://cdn.ko-fi.com/cdn/kofi3.png?v=3",border:"0",alt:"Buy Me a Coffee at ko-fi.com"}}),c.buttonEl.remove())});let o=r.createDiv();o.setAttr("align","center"),o.setAttr("style","margin: var(--size-4-2)");let l=o.createEl("button");if(l.setText("Copy Debug Information"),l.onclick=async()=>{await window.navigator.clipboard.writeText(JSON.stringify({settings:this.plugin.settings,pluginVersion:this.plugin.manifest.version},null,4)),new U.Notice("Debug information copied to clipboard. May contain sensitive information!")},U.Platform.isDesktopApp){let c=r.createDiv();c.setAttr("align","center"),c.setText(`Debugging and logging:
|
||||
You can always see the logs of this and every other plugin by opening the console with`);let u=r.createDiv();u.setAttr("align","center"),u.addClass("obsidian-git-shortcuts"),U.Platform.isMacOS===!0?u.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):u.createEl("kbd",{text:"CTRL + SHIFT + I"})}}mayDisableSetting(r,i){i&&(r.setDisabled(i),r.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(r){this.settings.lineAuthor.show=r,this.plugin.saveSettings(),r?this.plugin.editorIntegration.activateLineAuthoring():this.plugin.editorIntegration.deactiveLineAuthoring()}async lineAuthorSettingHandler(r,i){this.settings.lineAuthor[r]=i,await this.plugin.saveSettings(),this.plugin.editorIntegration.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let r=this.settings.lineAuthor;r.authorDisplay!=="hide"&&(r.lastShownAuthorDisplay=r.authorDisplay),r.dateTimeFormatOptions!=="hide"&&(r.lastShownDateTimeFormatOptions=r.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let r=new U.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform()||r.setDesc("Only available on desktop currently.").setDisabled(!0),r.descEl.createEl("a",{href:s5,text:"Feature guide and quick examples",attr:{target:"_blank"}}),r.descEl.createEl("br"),r.descEl.createSpan({text:" The commit hash, author name and authoring date can all be individually toggled."}),r.descEl.createEl("br"),r.descEl.createSpan({text:"Hide everything, to only show the age-colored sidebar."}),r.addToggle(i=>i.setValue(this.settings.lineAuthor.show).onChange(n=>{this.configureLineAuthorShowStatus(n),this.refreshDisplayWithDelay()})),this.settings.lineAuthor.show){let i=new U.Setting(this.containerEl).setName("Follow movement and copies across files and commits").addDropdown(l=>{l.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),l.setValue(this.settings.lineAuthor.followMovement),l.onChange(c=>this.lineAuthorSettingHandler("followMovement",c))});if(i.descEl.createSpan({text:"By default (deactivated), each line only shows the newest commit where it was changed."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"With "}),i.descEl.createEl("i",{text:"same commit"}),i.descEl.createSpan({text:", cut-copy-paste-ing of text is followed within the same commit and the original commit of authoring will be shown."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"With "}),i.descEl.createEl("i",{text:"all commits"}),i.descEl.createSpan({text:", cut-copy-paste-ing text inbetween multiple commits will be detected."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"It uses "}),i.descEl.createEl("a",{href:"https://git-scm.com/docs/git-blame",text:"git-blame",attr:{target:"_blank"}}),i.descEl.createSpan({text:` and for matches (at least ${_d} characters) within the same (or all) commit(s), `}),i.descEl.createEl("em",{text:"the originating"}),i.descEl.createSpan({text:" commit's information is shown."}),new U.Setting(this.containerEl).setName("Show commit hash").addToggle(l=>{l.setValue(this.settings.lineAuthor.showCommitHash),l.onChange(c=>this.lineAuthorSettingHandler("showCommitHash",c))}),new U.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(l=>{let c={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};l.addOptions(c),l.setValue(this.settings.lineAuthor.authorDisplay),l.onChange(async u=>this.lineAuthorSettingHandler("authorDisplay",u))}),new U.Setting(this.containerEl).setName("Authoring date display").setDesc("If and how the date and time of authoring the line is displayed").addDropdown(l=>{let c={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};l.addOptions(c),l.setValue(this.settings.lineAuthor.dateTimeFormatOptions),l.onChange(async u=>{await this.lineAuthorSettingHandler("dateTimeFormatOptions",u),this.refreshDisplayWithDelay()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let l=new U.Setting(this.containerEl);l.setName("Custom authoring date format").addText(c=>{c.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),c.setPlaceholder("YYYY-MM-DD HH:mm"),c.onChange(async u=>{await this.lineAuthorSettingHandler("dateTimeFormatCustomString",u),this.setCustomDateTimeDescription(l.descEl,u)})}),this.setCustomDateTimeDescription(l.descEl,this.settings.lineAuthor.dateTimeFormatCustomString)}let n=new U.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown(l=>{let c={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};l.addOptions(c),l.setValue(this.settings.lineAuthor.dateTimeTimezone),l.onChange(async u=>this.lineAuthorSettingHandler("dateTimeTimezone",u))});n.d
Line truncated
|
||||
`).addText(c=>{c.setValue(i.settings.basePath),c.setPlaceholder("directory/directory-with-git-repo"),c.onChange(async u=>{i.settings.basePath=u,await i.saveSettings(),i.gitManager.updateBasePath(u||"").catch(f=>i.displayError(f))})}),new U.Setting(r).setName("Custom Git directory path (Instead of '.git')").setDesc('Corresponds to the GIT_DIR environment variable. Relative paths are resolved from the custom base path, or the vault root when no base path is configured. Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(c=>{c.setValue(i.settings.gitDir),c.setPlaceholder(".git"),c.onChange(async u=>{i.settings.gitDir=u,await i.saveSettings()})}),new U.Setting(r).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(c=>c.setValue(i.localStorage.getPluginDisabled()).onChange(u=>{i.localStorage.setPluginDisabled(u),u?i.unloadPlugin():i.init({fromReload:!0}).catch(f=>i.displayError(f)),new U.Notice("Obsidian must be restarted for the changes to take affect.")})),new U.Setting(r).setName("Support").setHeading(),new U.Setting(r).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(c=>{var f;let u=(f=c.buttonEl.parentElement)==null?void 0:f.createEl("a",{href:"https://ko-fi.com/F1F195IQ5",attr:{target:"_blank"}});u&&(u.createEl("img",{attr:{height:"36",style:"border:0px;height:36px;",src:"https://cdn.ko-fi.com/cdn/kofi3.png?v=3",border:"0",alt:"Buy Me a Coffee at ko-fi.com"}}),c.buttonEl.remove())});let o=r.createDiv();o.setAttr("align","center"),o.setAttr("style","margin: var(--size-4-2)");let l=o.createEl("button");if(l.setText("Copy Debug Information"),l.onclick=async()=>{await window.navigator.clipboard.writeText(JSON.stringify({settings:this.plugin.settings,pluginVersion:this.plugin.manifest.version},null,4)),new U.Notice("Debug information copied to clipboard. May contain sensitive information!")},U.Platform.isDesktopApp){let c=r.createDiv();c.setAttr("align","center"),c.setText(`Debugging and logging:
|
||||
You can always see the logs of this and every other plugin by opening the console with`);let u=r.createDiv();u.setAttr("align","center"),u.addClass("obsidian-git-shortcuts"),U.Platform.isMacOS===!0?u.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):u.createEl("kbd",{text:"CTRL + SHIFT + I"})}}mayDisableSetting(r,i){i&&(r.setDisabled(i),r.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(r){this.settings.lineAuthor.show=r,this.plugin.saveSettings(),r?this.plugin.editorIntegration.activateLineAuthoring():this.plugin.editorIntegration.deactiveLineAuthoring()}async lineAuthorSettingHandler(r,i){this.settings.lineAuthor[r]=i,await this.plugin.saveSettings(),this.plugin.editorIntegration.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let r=this.settings.lineAuthor;r.authorDisplay!=="hide"&&(r.lastShownAuthorDisplay=r.authorDisplay),r.dateTimeFormatOptions!=="hide"&&(r.lastShownDateTimeFormatOptions=r.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let r=new U.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform()||r.setDesc("Only available on desktop currently.").setDisabled(!0),r.descEl.createEl("a",{href:Y5,text:"Feature guide and quick examples",attr:{target:"_blank"}}),r.descEl.createEl("br"),r.descEl.createSpan({text:" The commit hash, author name and authoring date can all be individually toggled."}),r.descEl.createEl("br"),r.descEl.createSpan({text:"Hide everything, to only show the age-colored sidebar."}),r.addToggle(i=>i.setValue(this.settings.lineAuthor.show).onChange(n=>{this.configureLineAuthorShowStatus(n),this.refreshDisplayWithDelay()})),this.settings.lineAuthor.show){let i=new U.Setting(this.containerEl).setName("Follow movement and copies across files and commits").addDropdown(l=>{l.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),l.setValue(this.settings.lineAuthor.followMovement),l.onChange(c=>this.lineAuthorSettingHandler("followMovement",c))});if(i.descEl.createSpan({text:"By default (deactivated), each line only shows the newest commit where it was changed."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"With "}),i.descEl.createEl("i",{text:"same commit"}),i.descEl.createSpan({text:", cut-copy-paste-ing of text is followed within the same commit and the original commit of authoring will be shown."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"With "}),i.descEl.createEl("i",{text:"all commits"}),i.descEl.createSpan({text:", cut-copy-paste-ing text inbetween multiple commits will be detected."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"It uses "}),i.descEl.createEl("a",{href:"https://git-scm.com/docs/git-blame",text:"git-blame",attr:{target:"_blank"}}),i.descEl.createSpan({text:` and for matches (at least ${Hd} characters) within the same (or all) commit(s), `}),i.descEl.createEl("em",{text:"the originating"}),i.descEl.createSpan({text:" commit's information is shown."}),new U.Setting(this.containerEl).setName("Show commit hash").addToggle(l=>{l.setValue(this.settings.lineAuthor.showCommitHash),l.onChange(c=>this.lineAuthorSettingHandler("showCommitHash",c))}),new U.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(l=>{let c={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};l.addOptions(c),l.setValue(this.settings.lineAuthor.authorDisplay),l.onChange(async u=>this.lineAuthorSettingHandler("authorDisplay",u))}),new U.Setting(this.containerEl).setName("Authoring date display").setDesc("If and how the date and time of authoring the line is displayed").addDropdown(l=>{let c={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};l.addOptions(c),l.setValue(this.settings.lineAuthor.dateTimeFormatOptions),l.onChange(async u=>{await this.lineAuthorSettingHandler("dateTimeFormatOptions",u),this.refreshDisplayWithDelay()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let l=new U.Setting(this.containerEl);l.setName("Custom authoring date format").addText(c=>{c.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),c.setPlaceholder("YYYY-MM-DD HH:mm"),c.onChange(async u=>{await this.lineAuthorSettingHandler("dateTimeFormatCustomString",u),this.setCustomDateTimeDescription(l.descEl,u)})}),this.setCustomDateTimeDescription(l.descEl,this.settings.lineAuthor.dateTimeFormatCustomString)}let n=new U.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown(l=>{let c={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};l.addOptions(c),l.setValue(this.settings.lineAuthor.dateTimeTimezone),l.onChange(async u=>this.lineAuthorSettingHandler("dateTimeTimezone",u))});n.d
Line truncated
|
||||
Either your local time-zone (default),
|
||||
the author's time-zone during commit creation or
|
||||
`}),n.descEl.createEl("a",{text:"UTC\xB100:00",href:"https://en.wikipedia.org/wiki/UTC%C2%B100:00"}),n.descEl.createSpan({text:"."});let s=new U.Setting(this.containerEl).setName("Oldest age in coloring");this.setOldestAgeDescription(s.descEl,this.settings.lineAuthor.coloringMaxAge),s.addText(l=>{l.setPlaceholder("1y"),l.setValue(this.settings.lineAuthor.coloringMaxAge),l.onChange(async c=>{let f=Eu(c)!==void 0;this.setOldestAgeDescription(s.descEl,c),f&&(await this.lineAuthorSettingHandler("coloringMaxAge",c),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest");let a=new U.Setting(this.containerEl).setName("Text color").addText(l=>{l.setValue(this.settings.lineAuthor.textColorCss),l.onChange(async c=>{await this.lineAuthorSettingHandler("textColorCss",c)})});a.descEl.empty(),a.descEl.createSpan({text:"The CSS color of the gutter text."}),a.descEl.createEl("br"),a.descEl.createEl("br"),a.descEl.createSpan({text:"It is highly recommended to use "}),a.descEl.createEl("a",{text:"CSS variables",href:"https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties"}),a.descEl.createSpan({text:" defined by themes (e.g. "}),a.descEl.createEl("pre",{text:"var(--text-muted)",attr:{style:"display:inline"}}),a.descEl.createSpan({text:" or "}),a.descEl.createEl("pre",{text:"var(--text-on-accent)",attr:{style:"display:inline"}}),a.descEl.createSpan({text:"), because they automatically adapt to theme changes."}),a.descEl.createEl("br"),a.descEl.createEl("br"),a.descEl.createSpan({text:"See: "}),a.descEl.createEl("a",{text:"List of available CSS variables in Obsidian",href:"https://github.com/obsidian-community/obsidian-theme-template/blob/main/obsidian.css"});let o=new U.Setting(this.containerEl).setName("Ignore whitespace and newlines in changes").addToggle(l=>{l.setValue(this.settings.lineAuthor.ignoreWhitespace),l.onChange(c=>this.lineAuthorSettingHandler("ignoreWhitespace",c))});o.descEl.empty(),o.descEl.createSpan({text:"Whitespace and newlines are interpreted as part of the document and in changes by default (hence not ignored). This makes the last line being shown as 'changed' when a new subsequent line is added, even if the previously last line's text is the same."}),o.descEl.createEl("br"),o.descEl.createSpan({text:"If you don't care about purely-whitespace changes (e.g. list nesting / quote indentation changes), then activating this will provide more meaningful change detection."})}}createColorSetting(r){let i=new U.Setting(this.containerEl).setName("").addText(n=>{let s=uw(r,this.settings.lineAuthor),a=uw(r,ht.lineAuthor);n.setPlaceholder(iv(a)),n.setValue(iv(s)),n.onChange(async o=>{let l=Qk(o);if(l!==void 0){let c=r==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(c,l)}this.refreshColorSettingsDesc(r,l)})});this.lineAuthorColorSettings.set(r,i),this.refreshColorSettingsName(r),this.refreshColorSettingsDesc(r,uw(r,this.settings.lineAuthor))}refreshColorSettingsName(r){let i=this.lineAuthorColorSettings.get(r);if(i){let n=r==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";i.nameEl.setText(`Color for ${n} commits`)}}refreshColorSettingsDesc(r,i){let n=this.lineAuthorColorSettings.get(r);n&&this.colorSettingPreviewDesc(n.descEl,r,this.settings.lineAuthor,i!==void 0)}colorSettingPreviewDesc(r,i,n,s){r.empty(),r.createSpan({text:"Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and named colors (e.g. 'black', 'purple'). Color preview: "});let a=s?lh(i,n):"rgba(127,127,127,0.3)",o=U.moment.unix(U.moment.now()/1e3).format("YYYY-MM-DD"),l=s?`abcdef Author Name ${o}`:"invalid color";r.createEl("div",{text:l,attr:{class:"line-author-settings-preview",style:`background-color: ${a}; width: 30ch;`}})}setCustomDateTimeDescription(r,i){r.empty(),r.createEl("a",{text:"Format string",href:O2}),r.createSpan({text:" to display the authoring date."}),r.createEl("br");let n=(0,U.moment)().format(i);r.createSpan({text:`Currently: ${n}`})}setOldestAgeDescription(r,i){let n=Eu(i),s=n!==void 0?`${n.asDays()} days`:"invalid!";r.empty(),r.createSpan({text:`The oldest age in the line author coloring. Everything older will have the same color.
|
||||
Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsProperty:r,text:i}){let n=this.plugin.settings[r];ht[r]!==n&&(typeof n=="string"||typeof n=="number"||typeof n=="boolean"?i.setValue(String(n)):i.setValue(JSON.stringify(n)))}refreshDisplayWithDelay(r=80){window.setTimeout(()=>this.display(),r)}};function uw(t,e){return t==="oldest"?e.colorOld:e.colorNew}function Eu(t){let e=U.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}m();var ti=require("obsidian");var fh=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.messages=[];this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),r.registerEvent(r.app.workspace.on("obsidian-git:refreshed",()=>{this.refreshCommitTimestamp().catch(console.error)}))}displayMessage(e,r){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:r}),this.display()}display(){this.messages.length>0&&!this.currentMessage?(this.currentMessage=this.messages.shift(),this.statusBarEl.addClass(this.base+"message"),this.statusBarEl.ariaLabel="",this.statusBarEl.setText(this.currentMessage.message),this.lastMessageTimestamp=Date.now()):this.currentMessage?Date.now()-this.lastMessageTimestamp>=this.currentMessage.timeout&&(this.currentMessage=null,this.lastMessageTimestamp=null):this.displayState()}displayState(){switch((this.statusBarEl.getText().length>3||!this.statusBarEl.hasChildNodes())&&(this.statusBarEl.empty(),this.conflictEl=this.statusBarEl.createDiv(),this.conflictEl.setAttribute("data-tooltip-position","top"),this.conflictEl.style.float="left",this.pausedEl=this.statusBarEl.createDiv(),this.pausedEl.setAttribute("data-tooltip-position","top"),this.pausedEl.style.float="left",this.iconEl=this.statusBarEl.createDiv(),this.iconEl.style.float="left",this.textEl=this.statusBarEl.createDiv(),this.textEl.style.float="right",this.textEl.style.marginLeft="5px"),this.plugin.localStorage.getConflict()?((0,ti.setIcon)(this.conflictEl,"alert-circle"),this.conflictEl.ariaLabel="You have merge conflicts. Resolve them and commit afterwards.",this.conflictEl.style.marginRight="5px",this.conflictEl.addClass(this.base+"conflict")):(this.conflictEl.empty(),this.conflictEl.style.marginRight=""),this.plugin.localStorage.getPausedAutomatics()?((0,ti.setIcon)(this.pausedEl,"pause-circle"),this.pausedEl.ariaLabel="Automatic routines are currently paused.",this.pausedEl.style.marginRight="5px",this.pausedEl.addClass(this.base+"paused")):(this.pausedEl.empty(),this.pausedEl.style.marginRight=""),this.plugin.state.gitAction){case 0:this.displayFromNow();break;case 1:this.statusBarEl.ariaLabel="Checking repository status...",(0,ti.setIcon)(this.iconEl,"refresh-cw"),this.statusBarEl.addClass(this.base+"status");break;case 3:this.statusBarEl.ariaLabel="Adding files...",(0,ti.setIcon)(this.iconEl,"archive"),this.statusBarEl.addClass(this.base+"add");break;case 4:this.statusBarEl.ariaLabel="Committing changes...",(0,ti.setIcon)(this.iconEl,"git-commit"),this.statusBarEl.addClass(this.base+"commit");break;case 5:this.statusBarEl.ariaLabel="Pushing changes...",(0,ti.setIcon)(this.iconEl,"upload"),this.statusBarEl.addClass(this.base+"push");break;case 2:this.statusBarEl.ariaLabel="Pulling changes...",(0,ti.setIcon)(this.iconEl,"download"),this.statusBarEl.addClass(this.base+"pull");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,ti.setIcon)(this.iconEl,"alert-triangle"),this.statusBarEl.addClass(this.base+"failed-init");break}}displayFromNow(){var i;let e=this.lastCommitTimestamp,r=this.plugin.state.offlineMode;if(e){let n=(0,ti.moment)(e).fromNow();this.statusBarEl.ariaLabel=`${r?"Offline: ":""}Last Commit: ${n}`,((i=this.unPushedCommits)!=null?i:0)>0&&(this.statusBarEl.ariaLabel+=`
|
||||
(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=r?"Git is offline":"Git is ready";r?(0,ti.setIcon)(this.iconEl,"globe"):(0,ti.setIcon)(this.iconEl,"check"),this.plugin.settings.changedFilesInStatusBar&&this.plugin.cachedStatus&&this.textEl.setText(this.plugin.cachedStatus.changed.length.toString()),this.statusBarEl.addClass(this.base+"idle")}async refreshCommitTimestamp(){this.lastCommitTimestamp=await this.plugin.gitManager.getLastCommitTime(),this.unPushedCommits=await this.plugin.gitManager.getUnpushedCommits()}remove(){this.statusBarEl.remove()}};m();var hh=require("obsidian"),dh=class extends hh.SuggestModal{constructor(r){super(r.app);this.plugin=r;this.resolve=null;this.setPlaceholder("Type your message and select optional the version with the added date.")}openAndGetResult(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>window.setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(r){let i=(0,hh.moment)().format(this.plugin.settings.commitDateFormat);return r==""&&(r="..."),[r,`${i}: ${r}`,`${r}: ${i}`]}renderSuggestion(r,i){i.innerText=r}onChooseSuggestion(r,i){this.resolve&&this.resolve(r)}};m();var L2=require("obsidian"),Su=class{constructor(e){this.plugin=e}saveLastAuto(e,r){r==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):r==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):r==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,r,i;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((r=this.plugin.localStorage.getLastAutoPull())!=null?r:""),push:new Date((i=this.plugin.localStorage.getLastAutoPush())!=null?i:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let r=this.diff(this.plugin.settings.autoPushInterval,e.push);this.startAutoPush(r)}if(this.plugin.settings.autoPullInterval>0){let r=this.diff(this.plugin.settings.autoPullInterval,e.pull);this.startAutoPull(r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){this.plugin.localStorage.getPausedAutomatics()||(e.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),e.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),e.contains("pull")&&(this.clearAutoPull(),this.plugin.settings.autoPullInterval>0&&this.startAutoPull(this.plugin.settings.autoPullInterval)))}async setUpAutoCommitAndSync(){if(this.plugin.settings.setLastSaveToLastCommit){this.clearAutoCommitAndSync();let e=await this.plugin.gitManager.getLastCommitTime();e&&this.saveLastAuto(e,"backup")}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let r=this.diff(this.plugin.settings.autoSaveInterval,e.backup);this.startAutoCommitAndSync(r)}}}startAutoCommitAndSync(e){let r=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,L2.debounce)(()=>this.doAutoCommitAndSync(),r,!0):(r>2147483647&&(r=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),r))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(async()=>{if(this.plugin.settings.setLastSaveToLastCommit){let r=await this.plugin.gitManager.getLastCommitTime();if(r){this.saveLastAuto(r,"backup");let i=this.diff(this.plugin.settings.autoSaveInterval,r);if(i>0)return this.startAutoCommitAndSync(i),!1}}let e=this.plugin.settings.autoCommitOnlyStaged;return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.commit({fromAuto:!0,onlyStaged:e}):await this.plugin.commitAndSync({fromAutoBackup:!0,onlyStaged:e}),!0},e=>{e!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(e){let r=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPull=window.setTimeout(()=>this.doAutoPull(),r)}doAutoPull(){this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote(),()=>{this.saveLastAuto(new Date,"pull"),this.startAutoPull()})}startAutoPush(e){let r=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPush=window.setTimeout(()=>this.doAutoPush(),r)}doAutoPush(){this.plugin.promiseQueue.addTask(()=>this.plugin.push(),()=>{this.saveLastAuto(new Date,"push"),this.startAutoPush()})}clearAutoCommitAndSync(){var r;let e=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,e=!0),this.plugin.autoCom
Line truncated
|
||||
`)}static newName(){let e=V2[j2]||1;return V2[j2]=e+1,fw+e.toString(36)}static mount(e,r,i){let n=e[dw],s=i&&i.nonce;n?s&&n.setNonce(s):n=new hw(e,s),n.mount(Array.isArray(r)?r:[r],e)}},z2=new Map,hw=class{constructor(e,r){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=z2.get(i);if(s)return e[dw]=s;this.sheet=new n.CSSStyleSheet,z2.set(i,this)}else this.styleTag=i.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],e[dw]=this}mount(e,r){let i=this.sheet,n=0,s=0;for(let a=0;a<e.length;a++){let o=e[a],l=this.modules.indexOf(o);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,o),i)for(let c=0;c<o.rules.length;c++)i.insertRule(o.rules[c],n++)}else{for(;s<l;)n+=this.modules[s++].rules.length;n+=o.rules.length,s++}}if(i)r.adoptedStyleSheets.indexOf(this.sheet)<0&&(r.adoptedStyleSheets=[this.sheet,...r.adoptedStyleSheets]);else{let a="";for(let l=0;l<this.modules.length;l++)a+=this.modules[l].getRules()+`
|
||||
`;this.styleTag.textContent=a;let o=r.head||r;this.styleTag.parentNode!=o&&o.insertBefore(this.styleTag,o.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var cP=require("@codemirror/language"),a5=require("@lezer/highlight"),Et=class t{constructor(e,r,i,n){this.fromA=e,this.toA=r,this.fromB=i,this.toB=n}offset(e,r=e){return new t(this.fromA+e,this.toA+e,this.fromB+r,this.toB+r)}};function $a(t,e,r,i,n,s){if(t==i)return[];let a=yw(t,e,r,i,n,s),o=xw(t,e+a,r,i,n+a,s);e+=a,r-=o,n+=a,s-=o;let l=r-e,c=s-n;if(!l||!c)return[new Et(e,r,n,s)];if(l>c){let f=t.slice(e,r).indexOf(i.slice(n,s));if(f>-1)return[new Et(e,e+f,n,n),new Et(e+f+c,r,s,s)]}else if(c>l){let f=i.slice(n,s).indexOf(t.slice(e,r));if(f>-1)return[new Et(e,e,n,n+f),new Et(r,r,n+f+l,s)]}if(l==1||c==1)return[new Et(e,r,n,s)];let u=fP(t,e,r,i,n,s);if(u){let[f,d,h]=u;return $a(t,e,f,i,n,d).concat($a(t,f+h,r,i,d+h,s))}return o5(t,e,r,i,n,s)}var Au=1e9,Cu=0,bw=!1;function o5(t,e,r,i,n,s){let a=r-e,o=s-n;if(Au<1e9&&Math.min(a,o)>Au*16||Cu>0&&Date.now()>Cu)return Math.min(a,o)>Au*64?[new Et(e,r,n,s)]:W2(t,e,r,i,n,s);let l=Math.ceil((a+o)/2);pw.reset(l),mw.reset(l);let c=(h,p)=>t.charCodeAt(e+h)==i.charCodeAt(n+p),u=(h,p)=>t.charCodeAt(r-h-1)==i.charCodeAt(s-p-1),f=(a-o)%2!=0?mw:null,d=f?null:pw;for(let h=0;h<l;h++){if(h>Au||Cu>0&&!(h&63)&&Date.now()>Cu)return W2(t,e,r,i,n,s);let p=pw.advance(h,a,o,l,f,!1,c)||mw.advance(h,a,o,l,d,!0,u);if(p)return l5(t,e,r,e+p[0],i,n,s,n+p[1])}return[new Et(e,r,n,s)]}var yh=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let r=0;r<this.len;r++)this.vec[r]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,r,i,n,s,a,o){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=n+l,u=l==-e||l!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,f=u-l;for(;u<r&&f<i&&o(u,f);)u++,f++;if(this.vec[c]=u,u>r)this.end+=2;else if(f>i)this.start+=2;else if(s){let d=n+(r-i)-l;if(d>=0&&d<this.len&&s.vec[d]!=-1)if(a){let h=s.vec[d];if(h>=r-u)return[h,n+h-d]}else{let h=r-s.vec[d];if(u>=h)return[u,f]}}}return null}},pw=new yh,mw=new yh;function l5(t,e,r,i,n,s,a,o){let l=!1;return!Rl(t,i)&&++i==r&&(l=!0),!Rl(n,o)&&++o==a&&(l=!0),l?[new Et(e,r,s,a)]:$a(t,e,i,n,s,o).concat($a(t,i,r,n,o,a))}function uP(t,e){let r=1,i=Math.min(t,e);for(;r<i;)r=r<<1;return r}function yw(t,e,r,i,n,s){if(e==r||e==s||t.charCodeAt(e)!=i.charCodeAt(n))return 0;let a=uP(r-e,s-n);for(let o=e,l=n;;){let c=o+a,u=l+a;if(c>r||u>s||t.slice(o,c)!=i.slice(l,u)){if(a==1)return o-e-(Rl(t,o)?0:1);a=a>>1}else{if(c==r||u==s)return c-e;o=c,l=u}}}function xw(t,e,r,i,n,s){if(e==r||n==s||t.charCodeAt(r-1)!=i.charCodeAt(s-1))return 0;let a=uP(r-e,s-n);for(let o=r,l=s;;){let c=o-a,u=l-a;if(c<e||u<n||t.slice(c,o)!=i.slice(u,l)){if(a==1)return r-o-(Rl(t,o)?0:1);a=a>>1}else{if(c==e||u==n)return r-c;o=c,l=u}}}function gw(t,e,r,i,n,s,a,o){let l=i.slice(n,s),c=null;for(;;){if(c||a<o)return c;for(let u=e+a;;){Rl(t,u)||u++;let f=u+a;if(Rl(t,f)||(f+=f==u+1?1:-1),f>=r)break;let d=t.slice(u,f),h=-1;for(;(h=l.indexOf(d,h+1))!=-1;){let p=yw(t,f,r,i,n+h+d.length,s),g=xw(t,e,u,i,n,n+h),v=d.length+p+g;(!c||c[2]<v)&&(c=[u-g,n+h-g,v])}u=f}if(o<0)return c;a=a>>1}}function fP(t,e,r,i,n,s){let a=r-e,o=s-n;if(a<o){let l=fP(i,n,s,t,e,r);return l&&[l[1],l[0],l[2]]}return a<4||o*2<a?null:gw(t,e,r,i,n,s,Math.floor(a/4),-1)}function W2(t,e,r,i,n,s){bw=!0;let a=r-e,o=s-n,l;if(a<o){let d=gw(i,n,s,t,e,r,Math.floor(a/6),50);l=d&&[d[1],d[0],d[2]]}else l=gw(t,e,r,i,n,s,Math.floor(o/6),50);if(!l)return[new Et(e,r,n,s)];let[c,u,f]=l;return $a(t,e,c,i,n,u).concat($a(t,c+f,r,i,u+f,s))}function dP(t,e){for(let r=1;r<t.length;r++){let i=t[r-1],n=t[r];i.toA>n.fromA-e&&i.toB>n.fromB-e&&(t[r-1]=new Et(i.fromA,n.toA,i.fromB,n.toB),t.splice(r--,1))}}function c5(t,e,r){for(;;){dP(r,1);let i=!1;for(let n=0;n<r.length;n++){let s=r[n],a,o;(a=yw(t,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=r[n]=new Et(s.fromA+a,s.toA,s.fromB+a,s.toB)),(o=xw(t,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=r[n]=new Et(s.fromA,s.toA-o,s.fromB,s.toB-o));let l=s.toA-s.fromA,c=s.toB-s.fromB;if(l&&c)continue;let u=s.fromA-(n?r[n-1].toA:0),f=(n<r.length-1?r[n+1].fromA:t.length)-s.toA;if(!u||!f)continue;let d=l?t.slice(s.fromA,s.toA):e.slice(s.fromB,s.toB);u<=d.length&&t.slice(s.fromA-u,s.fromA)==d.slice(d.length-u)?(r[n]=new Et(s.fromA-u,s.toA-u,s.fromB-u,s.toB-u),i=!0):f<=d.length&&t.slice(s.toA,s.toA+f)==d.slice(0,f)&&(r[n]=new Et(s.fromA+f,s.toA+f,s.fromB+f,s.toB+f),i=!0)}if(!i)break}return r}function u5(t,e,r){for(let i=0,n=0;n<t.length;n++){let s=t[n],a=s.toA-s.fromA,o=s.toB-s.fromB;if(a&&o||a>3||o>3){let l=n==t.length-1?e.length:t[n+1].fromA,c=s.fromA-i,u=l-s.toA,f=Y2(e,s.fromA,c),d=q2(e,s.toA,u),h=s.fromA-f,p=d-s.toA;if((!a||!o)&&h&&p){let g=Math.max(a,o),[v,_,b]=a?[e,s.fromA,s.toA]:[r,s.fromB,s.toB];g>h&&e.slice(f,s.fromA)==v.slice(b-h,b)?(s=t[n]=new Et(f,f+a,s.fromB-h,s.toB-h),f=s.fromA,d=q2(e,s.toA,l-s.toA)):g>p&&e.slice(s.toA,d)==v.slice(_,_+p)&&(s=t[n]=new Et(d-a,d,s.fromB+p,s.toB+p),d=s.
Line truncated
|
||||
`}),n.descEl.createEl("a",{text:"UTC\xB100:00",href:"https://en.wikipedia.org/wiki/UTC%C2%B100:00"}),n.descEl.createSpan({text:"."});let s=new U.Setting(this.containerEl).setName("Oldest age in coloring");this.setOldestAgeDescription(s.descEl,this.settings.lineAuthor.coloringMaxAge),s.addText(l=>{l.setPlaceholder("1y"),l.setValue(this.settings.lineAuthor.coloringMaxAge),l.onChange(async c=>{let f=Lu(c)!==void 0;this.setOldestAgeDescription(s.descEl,c),f&&(await this.lineAuthorSettingHandler("coloringMaxAge",c),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest");let a=new U.Setting(this.containerEl).setName("Text color").addText(l=>{l.setValue(this.settings.lineAuthor.textColorCss),l.onChange(async c=>{await this.lineAuthorSettingHandler("textColorCss",c)})});a.descEl.empty(),a.descEl.createSpan({text:"The CSS color of the gutter text."}),a.descEl.createEl("br"),a.descEl.createEl("br"),a.descEl.createSpan({text:"It is highly recommended to use "}),a.descEl.createEl("a",{text:"CSS variables",href:"https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties"}),a.descEl.createSpan({text:" defined by themes (e.g. "}),a.descEl.createEl("pre",{text:"var(--text-muted)",attr:{style:"display:inline"}}),a.descEl.createSpan({text:" or "}),a.descEl.createEl("pre",{text:"var(--text-on-accent)",attr:{style:"display:inline"}}),a.descEl.createSpan({text:"), because they automatically adapt to theme changes."}),a.descEl.createEl("br"),a.descEl.createEl("br"),a.descEl.createSpan({text:"See: "}),a.descEl.createEl("a",{text:"List of available CSS variables in Obsidian",href:"https://github.com/obsidian-community/obsidian-theme-template/blob/main/obsidian.css"});let o=new U.Setting(this.containerEl).setName("Ignore whitespace and newlines in changes").addToggle(l=>{l.setValue(this.settings.lineAuthor.ignoreWhitespace),l.onChange(c=>this.lineAuthorSettingHandler("ignoreWhitespace",c))});o.descEl.empty(),o.descEl.createSpan({text:"Whitespace and newlines are interpreted as part of the document and in changes by default (hence not ignored). This makes the last line being shown as 'changed' when a new subsequent line is added, even if the previously last line's text is the same."}),o.descEl.createEl("br"),o.descEl.createSpan({text:"If you don't care about purely-whitespace changes (e.g. list nesting / quote indentation changes), then activating this will provide more meaningful change detection."})}}createColorSetting(r){let i=new U.Setting(this.containerEl).setName("").addText(n=>{let s=kw(r,this.settings.lineAuthor),a=kw(r,tt.lineAuthor);n.setPlaceholder(bv(a)),n.setValue(bv(s)),n.onChange(async o=>{let l=bk(o);if(l!==void 0){let c=r==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(c,l)}this.refreshColorSettingsDesc(r,l)})});this.lineAuthorColorSettings.set(r,i),this.refreshColorSettingsName(r),this.refreshColorSettingsDesc(r,kw(r,this.settings.lineAuthor))}refreshColorSettingsName(r){let i=this.lineAuthorColorSettings.get(r);if(i){let n=r==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";i.nameEl.setText(`Color for ${n} commits`)}}refreshColorSettingsDesc(r,i){let n=this.lineAuthorColorSettings.get(r);n&&this.colorSettingPreviewDesc(n.descEl,r,this.settings.lineAuthor,i!==void 0)}colorSettingPreviewDesc(r,i,n,s){r.empty(),r.createSpan({text:"Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and named colors (e.g. 'black', 'purple'). Color preview: "});let a=s?Ah(i,n):"rgba(127,127,127,0.3)",o=U.moment.unix(U.moment.now()/1e3).format("YYYY-MM-DD"),l=s?`abcdef Author Name ${o}`:"invalid color";r.createEl("div",{text:l,attr:{class:"line-author-settings-preview",style:`background-color: ${a}; width: 30ch;`}})}setCustomDateTimeDescription(r,i){r.empty(),r.createEl("a",{text:"Format string",href:i2}),r.createSpan({text:" to display the authoring date."}),r.createEl("br");let n=(0,U.moment)().format(i);r.createSpan({text:`Currently: ${n}`})}setOldestAgeDescription(r,i){let n=Lu(i),s=n!==void 0?`${n.asDays()} days`:"invalid!";r.empty(),r.createSpan({text:`The oldest age in the line author coloring. Everything older will have the same color.
|
||||
Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsProperty:r,text:i}){let n=this.plugin.settings[r];tt[r]!==n&&(typeof n=="string"||typeof n=="number"||typeof n=="boolean"?i.setValue(String(n)):i.setValue(JSON.stringify(n)))}refreshDisplayWithDelay(r=80){window.setTimeout(()=>this.display(),r)}};function kw(t,e){return t==="oldest"?e.colorOld:e.colorNew}function Lu(t){let e=U.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}m();var zr=require("obsidian");var Rh=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.messages=[];this.currentMessage=null;this.lastMessageTimestamp=null;this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),r.registerEvent(r.app.workspace.on("obsidian-git:refreshed",()=>{this.refreshCommitTimestamp().catch(console.error)}))}displayMessage(e,r){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:r}),this.display()}displayProgress(e){this.progress=e,this.display()}clearProgress(e=!0){this.progress=void 0,e&&this.display()}display(){this.progress?this.displayState():this.messages.length>0&&!this.currentMessage?(this.currentMessage=this.messages.shift(),this.statusBarEl.addClass(this.base+"message"),this.statusBarEl.ariaLabel="",this.statusBarEl.setText(this.currentMessage.message),this.lastMessageTimestamp=Date.now()):this.currentMessage?Date.now()-this.lastMessageTimestamp>=this.currentMessage.timeout&&(this.currentMessage=null,this.lastMessageTimestamp=null):this.displayState()}displayState(){if((this.statusBarEl.getText().length>3||!this.statusBarEl.hasChildNodes())&&(this.statusBarEl.empty(),this.conflictEl=this.statusBarEl.createDiv(),this.conflictEl.setAttribute("data-tooltip-position","top"),this.conflictEl.style.float="left",this.pausedEl=this.statusBarEl.createDiv(),this.pausedEl.setAttribute("data-tooltip-position","top"),this.pausedEl.style.float="left",this.iconEl=this.statusBarEl.createDiv(),this.iconEl.style.float="left",this.textEl=this.statusBarEl.createDiv(),this.textEl.style.float="right",this.textEl.style.marginLeft="5px"),this.plugin.localStorage.getConflict()?((0,zr.setIcon)(this.conflictEl,"alert-circle"),this.conflictEl.ariaLabel="You have merge conflicts. Resolve them and commit afterwards.",this.conflictEl.style.marginRight="5px",this.conflictEl.addClass(this.base+"conflict")):(this.conflictEl.empty(),this.conflictEl.style.marginRight=""),this.plugin.localStorage.getPausedAutomatics()?((0,zr.setIcon)(this.pausedEl,"pause-circle"),this.pausedEl.ariaLabel="Automatic routines are currently paused.",this.pausedEl.style.marginRight="5px",this.pausedEl.addClass(this.base+"paused")):(this.pausedEl.empty(),this.pausedEl.style.marginRight=""),this.progress){this.statusBarEl.ariaLabel=this.getProgressTooltip("Git operation in progress..."),(0,zr.setIcon)(this.iconEl,this.getProgressIcon()),this.displayProgressText(),this.statusBarEl.addClass(this.base+"progress");return}switch(this.plugin.state.operation){case 0:this.displayFromNow();break;case 2:this.statusBarEl.ariaLabel="Committing changes...",(0,zr.setIcon)(this.iconEl,"git-commit"),this.textEl.empty(),this.statusBarEl.addClass(this.base+"commit");break;case 3:this.statusBarEl.ariaLabel=this.getProgressTooltip("Pushing changes..."),(0,zr.setIcon)(this.iconEl,"upload"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"push");break;case 1:this.statusBarEl.ariaLabel=this.getProgressTooltip("Pulling changes..."),(0,zr.setIcon)(this.iconEl,"download"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"pull");break;case 4:this.statusBarEl.ariaLabel=this.getProgressTooltip("Fetching from remote..."),(0,zr.setIcon)(this.iconEl,"download"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"fetch");break;case 5:this.statusBarEl.ariaLabel=this.getProgressTooltip("Checking out branch..."),(0,zr.setIcon)(this.iconEl,"git-branch"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"checkout");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,zr.setIcon)(this.iconEl,"alert-triangle"),this.textEl.empty(),this.statusBarEl.addClass(this.base+"failed-init");break}}displayProgressText(){this.progress?this.textEl.setText(this.getCompactProgressText()):this.textEl.empty()}getProgressTooltip(e){if(!this.progress)return e;let r=this.progress.stage?`${this.progress.stage}: `:"";if(this.progress.progress===void 0)return this.progress.stage?`${this.progress.action}: ${this.progress.stage}...`:`${this.progress.action}...`;let i=this.progress.processed!==void 0&&this.progress.total!==void 0?` (${this.progress.processed}/${this.progress.total})`:"";return`${this.progress.action}: ${r}${Math.round(this.progress.progress)}%${i}`}getCompactProgressText(){return this.progress?this.progress.progress===void 0?`${this.progress.action}...`:`${this.progress.action} ${Math.round(this.progress.progress)}%`:""}getProgressIcon(){var e;switch((e=this.progress)
Line truncated
|
||||
(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=r?"Git is offline":"Git is ready";r?(0,zr.setIcon)(this.iconEl,"globe"):(0,zr.setIcon)(this.iconEl,"check"),this.plugin.settings.changedFilesInStatusBar&&this.plugin.cachedStatus?this.textEl.setText(this.plugin.cachedStatus.changed.length.toString()):this.textEl.empty(),this.statusBarEl.addClass(this.base+"idle")}async refreshCommitTimestamp(){this.lastCommitTimestamp=await this.plugin.gitManager.getLastCommitTime(),this.unPushedCommits=await this.plugin.gitManager.getUnpushedCommits()}remove(){this.statusBarEl.remove()}};m();var Fh=require("obsidian"),$h=class extends Fh.SuggestModal{constructor(r){super(r.app);this.plugin=r;this.resolve=null;this.setPlaceholder("Type your message and select optional the version with the added date.")}openAndGetResult(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>window.setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(r){let i=(0,Fh.moment)().format(this.plugin.settings.commitDateFormat);return r==""&&(r="..."),[r,`${i}: ${r}`,`${r}: ${i}`]}renderSuggestion(r,i){i.innerText=r}onChooseSuggestion(r,i){this.resolve&&this.resolve(r)}};m();var n2=require("obsidian"),Nu=class{constructor(e){this.plugin=e}saveLastAuto(e,r){r==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):r==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):r==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,r,i;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((r=this.plugin.localStorage.getLastAutoPull())!=null?r:""),push:new Date((i=this.plugin.localStorage.getLastAutoPush())!=null?i:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let r=this.diff(this.plugin.settings.autoPushInterval,e.push);this.startAutoPush(r)}if(this.plugin.settings.autoPullInterval>0){let r=this.diff(this.plugin.settings.autoPullInterval,e.pull);this.startAutoPull(r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){this.plugin.localStorage.getPausedAutomatics()||(e.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),e.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),e.contains("pull")&&(this.clearAutoPull(),this.plugin.settings.autoPullInterval>0&&this.startAutoPull(this.plugin.settings.autoPullInterval)))}async setUpAutoCommitAndSync(){if(this.plugin.settings.setLastSaveToLastCommit){this.clearAutoCommitAndSync();let e=await this.plugin.gitManager.getLastCommitTime();e&&this.saveLastAuto(e,"backup")}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let r=this.diff(this.plugin.settings.autoSaveInterval,e.backup);this.startAutoCommitAndSync(r)}}}get isAutomaticsDisabled(){return!this.plugin.gitReady||this.plugin.localStorage.getPausedAutomatics()}startAutoCommitAndSync(e){if(this.isAutomaticsDisabled)return;let r=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,n2.debounce)(()=>this.doAutoCommitAndSync(),r,!0):(r>2147483647&&(r=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),r))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(async()=>{if(this.plugin.settings.setLastSaveToLastCommit){let r=await this.plugin.gitManager.getLastCommitTime();if(r){this.saveLastAuto(r,"backup");let i=this.diff(this.plugin.settings.autoSaveInterval,r);if(i>0)return this.startAutoCommitAndSync(i),!1}}let e=this.plugin.settings.autoCommitOnlyStaged?"staged":"all";return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.commit({fromAuto:!0,mode:e}):await this.plugin.commitAndSync({fromAutoBackup:!0,mode:e}),!0},e=>{e!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(e){if(this.isAutomaticsDisabled)return;let r=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPull=window.setTimeout(()=>this.doAutoPull(),r)}doAutoPull(){this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote(),()=>{this.saveLastAuto(new Date,"pull"),this.startAutoPull()})}startAutoPush(e){if(this.isAutomaticsDisabled)return;let r=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPush=window.setTimeout(()=>this.doAutoPush(),r)}doAutoPush(){this.plugin.promiseQueue.addTask(()=>this.plugin.push(),()=>{this.saveLa
Line truncated
|
||||
`)}static newName(){let e=f2[u2]||1;return f2[u2]=e+1,"\u037C"+e.toString(36)}static mount(e,r,i){let n=e[Cw],s=i&&i.nonce;n?s&&n.setNonce(s):n=new Aw(e,s),n.mount(Array.isArray(r)?r:[r],e)}},d2=new Map,Aw=class{constructor(e,r){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=d2.get(i);if(s)return e[Cw]=s;this.sheet=new n.CSSStyleSheet,d2.set(i,this)}else this.styleTag=i.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],e[Cw]=this}mount(e,r){let i=this.sheet,n=0,s=0;for(let a=0;a<e.length;a++){let o=e[a],l=this.modules.indexOf(o);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,o),i)for(let c=0;c<o.rules.length;c++)i.insertRule(o.rules[c],n++)}else{for(;s<l;)n+=this.modules[s++].rules.length;n+=o.rules.length,s++}}if(i)r.adoptedStyleSheets.indexOf(this.sheet)<0&&(r.adoptedStyleSheets=[this.sheet,...r.adoptedStyleSheets]);else{let a="";for(let l=0;l<this.modules.length;l++)a+=this.modules[l].getRules()+`
|
||||
`;this.styleTag.textContent=a;let o=r.head||r;this.styleTag.parentNode!=o&&o.insertBefore(this.styleTag,o.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var R2=require("@codemirror/language"),Z5=require("@lezer/highlight"),Rt=class t{constructor(e,r,i,n){this.fromA=e,this.toA=r,this.fromB=i,this.toB=n}offset(e,r=e){return new t(this.fromA+e,this.toA+e,this.fromB+r,this.toB+r)}};function Ha(t,e,r,i,n,s){if(t==i)return[];let a=Dw(t,e,r,i,n,s),o=Ow(t,e+a,r,i,n+a,s);e+=a,r-=o,n+=a,s-=o;let l=r-e,c=s-n;if(!l||!c)return[new Rt(e,r,n,s)];if(l>c){let f=t.slice(e,r).indexOf(i.slice(n,s));if(f>-1)return[new Rt(e,e+f,n,n),new Rt(e+f+c,r,s,s)]}else if(c>l){let f=i.slice(n,s).indexOf(t.slice(e,r));if(f>-1)return[new Rt(e,e,n,n+f),new Rt(r,r,n+f+l,s)]}if(l==1||c==1)return[new Rt(e,r,n,s)];let u=F2(t,e,r,i,n,s);if(u){let[f,d,h]=u;return Ha(t,e,f,i,n,d).concat(Ha(t,f+h,r,i,d+h,s))}return K5(t,e,r,i,n,s)}var Hu=1e9,Uu=0,Mw=!1;function K5(t,e,r,i,n,s){let a=r-e,o=s-n;if(Hu<1e9&&Math.min(a,o)>Hu*16||Uu>0&&Date.now()>Uu)return Math.min(a,o)>Hu*64?[new Rt(e,r,n,s)]:h2(t,e,r,i,n,s);let l=Math.ceil((a+o)/2);Tw.reset(l),Pw.reset(l);let c=(h,p)=>t.charCodeAt(e+h)==i.charCodeAt(n+p),u=(h,p)=>t.charCodeAt(r-h-1)==i.charCodeAt(s-p-1),f=(a-o)%2!=0?Pw:null,d=f?null:Tw;for(let h=0;h<l;h++){if(h>Hu||Uu>0&&!(h&63)&&Date.now()>Uu)return h2(t,e,r,i,n,s);let p=Tw.advance(h,a,o,l,f,!1,c)||Pw.advance(h,a,o,l,d,!0,u);if(p)return X5(t,e,r,e+p[0],i,n,s,n+p[1])}return[new Rt(e,r,n,s)]}var Hh=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let r=0;r<this.len;r++)this.vec[r]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,r,i,n,s,a,o){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=n+l,u=l==-e||l!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,f=u-l;for(;u<r&&f<i&&o(u,f);)u++,f++;if(this.vec[c]=u,u>r)this.end+=2;else if(f>i)this.start+=2;else if(s){let d=n+(r-i)-l;if(d>=0&&d<this.len&&s.vec[d]!=-1)if(a){let h=s.vec[d];if(h>=r-u)return[h,n+h-d]}else{let h=r-s.vec[d];if(u>=h)return[u,f]}}}return null}},Tw=new Hh,Pw=new Hh;function X5(t,e,r,i,n,s,a,o){let l=!1;return!Fl(t,i)&&++i==r&&(l=!0),!Fl(n,o)&&++o==a&&(l=!0),l?[new Rt(e,r,s,a)]:Ha(t,e,i,n,s,o).concat(Ha(t,i,r,n,o,a))}function $2(t,e){let r=1,i=Math.min(t,e);for(;r<i;)r=r<<1;return r}function Dw(t,e,r,i,n,s){if(e==r||e==s||t.charCodeAt(e)!=i.charCodeAt(n))return 0;let a=$2(r-e,s-n);for(let o=e,l=n;;){let c=o+a,u=l+a;if(c>r||u>s||t.slice(o,c)!=i.slice(l,u)){if(a==1)return o-e-(Fl(t,o)?0:1);a=a>>1}else{if(c==r||u==s)return c-e;o=c,l=u}}}function Ow(t,e,r,i,n,s){if(e==r||n==s||t.charCodeAt(r-1)!=i.charCodeAt(s-1))return 0;let a=$2(r-e,s-n);for(let o=r,l=s;;){let c=o-a,u=l-a;if(c<e||u<n||t.slice(c,o)!=i.slice(u,l)){if(a==1)return r-o-(Fl(t,o)?0:1);a=a>>1}else{if(c==e||u==n)return r-c;o=c,l=u}}}function Rw(t,e,r,i,n,s,a,o){let l=i.slice(n,s),c=null;for(;;){if(c||a<o)return c;for(let u=e+a;;){Fl(t,u)||u++;let f=u+a;if(Fl(t,f)||(f+=f==u+1?1:-1),f>=r)break;let d=t.slice(u,f),h=-1;for(;(h=l.indexOf(d,h+1))!=-1;){let p=Dw(t,f,r,i,n+h+d.length,s),g=Ow(t,e,u,i,n,n+h),v=d.length+p+g;(!c||c[2]<v)&&(c=[u-g,n+h-g,v])}u=f}if(o<0)return c;a=a>>1}}function F2(t,e,r,i,n,s){let a=r-e,o=s-n;if(a<o){let l=F2(i,n,s,t,e,r);return l&&[l[1],l[0],l[2]]}return a<4||o*2<a?null:Rw(t,e,r,i,n,s,Math.floor(a/4),-1)}function h2(t,e,r,i,n,s){Mw=!0;let a=r-e,o=s-n,l;if(a<o){let d=Rw(i,n,s,t,e,r,Math.floor(a/6),50);l=d&&[d[1],d[0],d[2]]}else l=Rw(t,e,r,i,n,s,Math.floor(o/6),50);if(!l)return[new Rt(e,r,n,s)];let[c,u,f]=l;return Ha(t,e,c,i,n,u).concat(Ha(t,c+f,r,i,u+f,s))}function I2(t,e){for(let r=1;r<t.length;r++){let i=t[r-1],n=t[r];i.toA>n.fromA-e&&i.toB>n.fromB-e&&(t[r-1]=new Rt(i.fromA,n.toA,i.fromB,n.toB),t.splice(r--,1))}}function Q5(t,e,r){for(;;){I2(r,1);let i=!1;for(let n=0;n<r.length;n++){let s=r[n],a,o;(a=Dw(t,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=r[n]=new Rt(s.fromA+a,s.toA,s.fromB+a,s.toB)),(o=Ow(t,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=r[n]=new Rt(s.fromA,s.toA-o,s.fromB,s.toB-o));let l=s.toA-s.fromA,c=s.toB-s.fromB;if(l&&c)continue;let u=s.fromA-(n?r[n-1].toA:0),f=(n<r.length-1?r[n+1].fromA:t.length)-s.toA;if(!u||!f)continue;let d=l?t.slice(s.fromA,s.toA):e.slice(s.fromB,s.toB);u<=d.length&&t.slice(s.fromA-u,s.fromA)==d.slice(d.length-u)?(r[n]=new Rt(s.fromA-u,s.toA-u,s.fromB-u,s.toB-u),i=!0):f<=d.length&&t.slice(s.toA,s.toA+f)==d.slice(0,f)&&(r[n]=new Rt(s.fromA+f,s.toA+f,s.fromB+f,s.toB+f),i=!0)}if(!i)break}return r}function J5(t,e,r){for(let i=0,n=0;n<t.length;n++){let s=t[n],a=s.toA-s.fromA,o=s.toB-s.fromB;if(a&&o||a>3||o>3){let l=n==t.length-1?e.length:t[n+1].fromA,c=s.fromA-i,u=l-s.toA,f=m2(e,s.fromA,c),d=p2(e,s.toA,u),h=s.fromA-f,p=d-s.toA;if((!a||!o)&&h&&p){let g=Math.max(a,o),[v,b,_]=a?[e,s.fromA,s.toA]:[r,s.fromB,s.toB];g>h&&e.slice(f,s.fromA)==v.slice(_-h,_)?(s=t[n]=new Rt(f,f+a,s.fromB-h,s.toB-h),f=s.fromA,d=p2(e,s.toA,l-s.toA)):g>p&&e.slice(s.toA,d)==v.slice(b,b+p)&&(s=t[n]=new Rt(d-a,d,s.fromB+p,s.toB+p),d=s.
Line truncated
|
||||
`),s=e.split(`
|
||||
`);for(let a of r){let{oldStart:o,oldLines:l,newStart:c,newLines:u}=a,f=Vt.createHunk(o,l,c,u);if(a.oldLines>0){for(let d=o;d<o+l;d++)f.removed.lines.push(n[d-1]);o+l>n.length&&n.last()!=""&&(f.removed.no_nl_at_eof=!0)}if(a.newLines>0){for(let d=c;d<c+u;d++)f.added.lines.push(s[d-1]);c+u>s.length&&s.last()!=""&&(f.added.no_nl_at_eof=!0)}i.push(f)}return i}function Aw(t,e,r){let i=e.lineAt(t.fromA).number,n=t.fromA==t.toA?0:Sh(e,t.endA)-i+1,s=r.lineAt(t.fromB).number,a=t.fromB==t.toB?0:Sh(r,t.endB)-s+1,o={oldStart:i,oldLines:n,newStart:s,newLines:a};return o.oldLines==0&&(o.oldStart-=1),o.newLines==0&&(o.newStart-=1),o}var EP={scanLimit:1e3,timeout:200};function A5(t,e,r,i){let n=Sw.Text.of(t.split(`
|
||||
`)),s=Sw.Text.of(e.split(`
|
||||
`)),a=r&&i?ts.updateB(r,n,s,i,EP):ts.build(n,s,EP),o=[];for(let l=0;l<a.length;l++){let c=a[l],u=Aw(c,n,s);o.push(u)}return{hunks:kw(t,e,o),chunks:a}}function SP(t,e,r,i){return A5(t,e,r,i)}var Fl=require("obsidian");function Sh(t,e){let r=t.lineAt(e);return!(r.text.length==0&&r.number==t.lines)?r.number:r.number-1}var Wi=class{static hasHunksData(e){let r=e.field(Hr,!1);return!!r&&!r.isDirty}static getHunks(e,r){let i=e.field(Hr);return i?r?i.stagedHunks:i.hunks:[]}static getHunkAtPos(e,r,i){if(!e.field(Hr))return;let s=e.doc.lineAt(r).number,a=this.getHunks(e,i);return Vt.findHunk(s,a)[0]}static getCursorHunk(e,r){if(!e.field(Hr))return;let n=e.selection.main.head;return this.getHunkAtPos(e,n,r)}static getHunk(e,r,i){if(i!=null)return this.getHunkAtPos(e,i,r);if(e.selection.main.empty)return this.getCursorHunk(e,r);let n=e.selection.main.from,s=e.selection.main.to,a=e.doc.lineAt(n).number,o=Sh(e.doc,s),l=this.getHunks(e,r),c=Vt.createPartialHunk(l,a,o);if(!c)return;let u=e.field(Hr);if(r){let f=a,d=o;for(let h of u.hunks)a>h.vend&&(f=f-(h.added.count-h.removed.count)),o>h.vend&&(d=d-(h.added.count-h.removed.count));c.added.lines=u.compareText.split(`
|
||||
`);for(let a of r){let{oldStart:o,oldLines:l,newStart:c,newLines:u}=a,f=qt.createHunk(o,l,c,u);if(a.oldLines>0){for(let d=o;d<o+l;d++)f.removed.lines.push(n[d-1]);o+l>n.length&&n.last()!=""&&(f.removed.no_nl_at_eof=!0)}if(a.newLines>0){for(let d=c;d<c+u;d++)f.added.lines.push(s[d-1]);c+u>s.length&&s.last()!=""&&(f.added.no_nl_at_eof=!0)}i.push(f)}return i}function Hw(t,e,r){let i=e.lineAt(t.fromA).number,n=t.fromA==t.toA?0:jh(e,t.endA)-i+1,s=r.lineAt(t.fromB).number,a=t.fromB==t.toB?0:jh(r,t.endB)-s+1,o={oldStart:i,oldLines:n,newStart:s,newLines:a};return o.oldLines==0&&(o.oldStart-=1),o.newLines==0&&(o.newStart-=1),o}var V2={scanLimit:1e3,timeout:200};function m4(t,e,r,i){let n=Nw.Text.of(t.split(`
|
||||
`)),s=Nw.Text.of(e.split(`
|
||||
`)),a=r&&i?is.updateB(r,n,s,i,V2):is.build(n,s,V2),o=[];for(let l=0;l<a.length;l++){let c=a[l],u=Hw(c,n,s);o.push(u)}return{hunks:Bw(t,e,o),chunks:a}}function z2(t,e,r,i){return m4(t,e,r,i)}var ns=require("obsidian"),Ki=class{static hasHunksData(e){let r=e.field(Wr,!1);return!!r&&!r.isDirty}static getHunks(e,r){let i=e.field(Wr);return i?r?i.stagedHunks:i.hunks:[]}static getHunkAtPos(e,r,i){if(!e.field(Wr))return;let s=e.doc.lineAt(r).number,a=this.getHunks(e,i);return qt.findHunk(s,a)[0]}static getCursorHunk(e,r){if(!e.field(Wr))return;let n=e.selection.main.head;return this.getHunkAtPos(e,n,r)}static getHunk(e,r,i){if(i!=null)return this.getHunkAtPos(e,i,r);if(e.selection.main.empty)return this.getCursorHunk(e,r);let n=e.selection.main.from,s=e.selection.main.to,a=e.doc.lineAt(n).number,o=jh(e.doc,s),l=this.getHunks(e,r),c=qt.createPartialHunk(l,a,o);if(!c)return;let u=e.field(Wr);if(r){let f=a,d=o;for(let h of u.hunks)a>h.vend&&(f=f-(h.added.count-h.removed.count)),o>h.vend&&(d=d-(h.added.count-h.removed.count));c.added.lines=u.compareText.split(`
|
||||
`).slice(f-1,d),u.compareTextHead?c.removed.lines=u.compareTextHead.split(`
|
||||
`).slice(c.removed.start-1,c.removed.start-1+c.removed.count):c.removed.lines=[]}else c.added.lines=e.doc.toString().split(`
|
||||
`).slice(a-1,o),o===e.doc.lines&&!e.doc.toString().endsWith(`
|
||||
`)&&(c.added.no_nl_at_eof=!0),c.removed.lines=u.compareText.split(`
|
||||
`).slice(c.removed.start-1,c.removed.start-1+c.removed.count),c.removed.start+c.removed.count-1===u.compareText.split(`
|
||||
`).length&&!u.compareText.endsWith(`
|
||||
`)&&(c.removed.no_nl_at_eof=!0);return c}},Hr=$l.StateField.define({create:t=>{},update:(t,e)=>{let r=t?{...t}:{maxDiffTimeMs:0,hunks:[],stagedHunks:[],chunks:void 0,isDirty:!1},i=!1;for(let n of e.effects)n.is(Il)&&(r.compareText=n.value.compareText,r.compareTextHead=n.value.compareTextHead,i=(t==null?void 0:t.compareText)!==n.value.compareText,i&&(r.chunks=void 0)),n.is(Pu)&&kP(r,n.value,e.state);if(r.compareText!==void 0){if(i||e.docChanged){r.isDirty=!0;let n=C5(e,r.compareText,r.chunks,r.maxDiffTimeMs);n&&kP(r,n,e.state)}}else r.compareText=void 0,r.compareTextHead=void 0,r.chunks=void 0,r.hunks=[],r.stagedHunks=[],r.isDirty=!1;return r}});function kP(t,e,r){var n,s;t.hunks=e.hunks,t.chunks=e.chunks,t.isDirty=!1,t.maxDiffTimeMs=Math.max(.95*t.maxDiffTimeMs,e.diffDuration);let i=r.field(Fl.editorInfoField).file;(s=(n=jt.plugin)==null?void 0:n.editorIntegration.signsFeature.changeStatusBar)==null||s.display(t.hunks,i)}var Cw=$l.StateField.define({create:()=>({debouncer:(0,Fl.debounce)(t=>{let{state:e,compareText:r,previousChunks:i,changeDesc:n}=t,s=AP(e,r,i,n);e.field(Fl.editorEditorField).dispatch({effects:Pu.of(s)})},1e3,!0),maxDiffTimeMs:0}),update:(t,e)=>{var r;for(let i of e.effects)if(i.is(Pu))return t.changeDesc=void 0,t;return!t.changeDesc&&e.changes?t.changeDesc=e.changes:t.changeDesc=(r=t.changeDesc)==null?void 0:r.composeDesc(e.changes),t}});function AP(t,e,r,i){let n=t.doc.toString(),s=performance.now(),{hunks:a,chunks:o}=SP(e,n,r,i),l=performance.now()-s;return{hunks:a,chunks:o,diffDuration:l}}function C5(t,e,r,i){let n=t.state,s=Math.abs(t.changes.length-t.changes.newLength),a=n.field(Cw);if(s>1e3||i>16)a.debouncer({state:n,compareText:e,previousChunks:r,changeDesc:a.changeDesc});else return a.changeDesc=void 0,AP(n,e,r,t.changes)}var Il=$l.StateEffect.define(),Pu=$l.StateEffect.define();function CP(t,e){return e.update({effects:Il.of(t)})}m();m();m();var nt;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(nt||(nt={}));var TP={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},PP={LINES:"lines",WORDS:"words",NONE:"none"},RP={WORD:"word",CHAR:"char"},Ia;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(Ia||(Ia={}));m();var T5=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],P5=RegExp("["+T5.join("\\")+"]","g");function $P(t){return t.replace(P5,"\\$&")}function Tw(t){return t&&t.replace(/\\/g,"/")}function FP(t){let e,r,i,n=0;for(e=0,i=t.length;e<i;e++)r=t.charCodeAt(e),n=(n<<5)-n+r,n|=0;return n}function kh(t){let e=t.length,r=-1/0;for(let i=0;i<e;i++)r=Math.max(r,t[i]);return r}function IP(t,e){let r=t.split(".");return r.length>1?r[r.length-1]:e}function MP(t,e){return e.reduce((r,i)=>r||t.startsWith(i),!1)}var DP=["a/","b/","i/","w/","c/","o/"];function Hs(t,e,r){let i=r!==void 0?[...DP,r]:DP,n=e?new RegExp(`^${$P(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,s=""]=n.exec(t)||[],a=i.find(l=>s.indexOf(l)===0);return(a?s.slice(a.length):s).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function R5(t,e){return Hs(t,"---",e)}function $5(t,e){return Hs(t,"+++",e)}function OP(t,e={}){let r=[],i=null,n=null,s=null,a=null,o=null,l=null,c=null,u="--- ",f="+++ ",d="@@",h=/^old mode (\d{6})/,p=/^new mode (\d{6})/,g=/^deleted file mode (\d{6})/,v=/^new file mode (\d{6})/,_=/^copy from "?(.+)"?/,b=/^copy to "?(.+)"?/,S=/^rename from "?(.+)"?/,k=/^rename to "?(.+)"?/,E=/^similarity index (\d+)%/,A=/^dissimilarity index (\d+)%/,w=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,x=/^Binary files (.*) and (.*) differ/,y=/^GIT binary patch/,C=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,P=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,L=/^new file mode (\d{6})/,N=/^deleted file mode (\d{6}),(\d{6})/,B=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,`
|
||||
`)&&(c.removed.no_nl_at_eof=!0);return c}},Wr=Il.StateField.define({create:t=>{},update:(t,e)=>{var n,s,a;let r=t?{...t}:{maxDiffTimeMs:0,hunks:[],stagedHunks:[],chunks:void 0,isDirty:!1},i=!1;for(let o of e.effects)if(o.is(Ml)&&(r.compareText=o.value.compareText,r.compareTextHead=o.value.compareTextHead,i=(t==null?void 0:t.compareText)!==o.value.compareText,i&&(r.chunks=void 0,r.changeDesc=void 0)),o.is(Vh)){let l=(n=e.startState.field(ju,!1))==null?void 0:n.revision;if(o.value.revision!==l)continue;W2(r,o.value.result,e.state),r.changeDesc=void 0}if(e.docChanged){let o=!r.changeDesc||r.changeDesc.newLength===e.changes.length;console.assert(o,"Git: Hunk changes belong to different document histories."),o||(r.chunks=void 0),r.changeDesc=g4(r.changeDesc,e.changes)}if(r.compareText!==void 0){if(i||e.docChanged){r.isDirty=!0;let o=v4(e,r.compareText,r.chunks,r.changeDesc,r.maxDiffTimeMs);o&&(W2(r,o,e.state),r.changeDesc=void 0)}}else{r.compareText=void 0,r.compareTextHead=void 0,r.chunks=void 0,r.hunks=[],r.stagedHunks=[],r.isDirty=!1;let o=e.state.field(ns.editorInfoField).file;(a=(s=Et.plugin)==null?void 0:s.editorIntegration.signsFeature.changeStatusBar)==null||a.display(r.hunks,o)}return r}});function W2(t,e,r){var n,s;t.hunks=e.hunks,t.chunks=e.chunks,t.isDirty=!1,t.maxDiffTimeMs=Math.max(.95*t.maxDiffTimeMs,e.diffDuration);let i=r.field(ns.editorInfoField).file;(s=(n=Et.plugin)==null?void 0:n.editorIntegration.signsFeature.changeStatusBar)==null||s.display(t.hunks,i)}var ju=Il.StateField.define({create:t=>{var e,r;return{debouncer:(0,ns.debounce)(i=>{let{state:n,compareText:s,previousChunks:a,changeDesc:o,revision:l}=i,c=n.field(ns.editorEditorField,!1);if(!c)return;let u=c.state.field(ju,!1);if((u==null?void 0:u.revision)!==l)return;let f=q2(n,s,a,o);c.dispatch({effects:Vh.of({result:f,revision:l})})},1e3,!0),revision:{},filePath:(r=(e=t.field(ns.editorInfoField,!1))==null?void 0:e.file)==null?void 0:r.path}},update:(t,e)=>{var i,n;let r=(n=(i=e.state.field(ns.editorInfoField,!1))==null?void 0:i.file)==null?void 0:n.path;return e.docChanged||r!==t.filePath?{...t,revision:{},filePath:r}:t}});function g4(t,e){return!t||t.newLength!==e.length?e:t.composeDesc(e)}function q2(t,e,r,i){let n=t.doc.toString(),s=performance.now(),{hunks:a,chunks:o}=z2(e,n,r,i),l=performance.now()-s;return{hunks:a,chunks:o,diffDuration:l}}function v4(t,e,r,i,n){let s=t.state,a=Math.abs(t.changes.length-t.changes.newLength),o=s.field(ju);if(a>1e3||n>16){o.debouncer({state:s,compareText:e,previousChunks:r,changeDesc:i,revision:o.revision});return}else return q2(s,e,r,i)}var Ml=Il.StateEffect.define(),Vh=Il.StateEffect.define();function Y2(t,e){return e.update({effects:Ml.of(t)})}m();m();m();var ut;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(ut||(ut={}));var Z2={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},K2={LINES:"lines",WORDS:"words",NONE:"none"},X2={WORD:"word",CHAR:"char"},Ua;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(Ua||(Ua={}));m();var w4=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],b4=RegExp("["+w4.join("\\")+"]","g");function Q2(t){return t.replace(b4,"\\$&")}function Uw(t){return t&&t.replace(/\\/g,"/")}function J2(t){let e,r,i,n=0;for(e=0,i=t.length;e<i;e++)r=t.charCodeAt(e),n=(n<<5)-n+r,n|=0;return n}function zh(t){let e=t.length,r=-1/0;for(let i=0;i<e;i++)r=Math.max(r,t[i]);return r}function eP(t,e){let r=t.split(".");return r.length>1?r[r.length-1]:e}function tP(t,e){return e.reduce((r,i)=>r||t.startsWith(i),!1)}var rP=["a/","b/","i/","w/","c/","o/"];function qs(t,e,r){let i=r!==void 0?[...rP,r]:rP,n=e?new RegExp(`^${Q2(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,s=""]=n.exec(t)||[],a=i.find(l=>s.indexOf(l)===0);return(a?s.slice(a.length):s).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function _4(t,e){return qs(t,"---",e)}function y4(t,e){return qs(t,"+++",e)}function iP(t,e={}){let r=[],i=null,n=null,s=null,a=null,o=null,l=null,c=null,u="--- ",f="+++ ",d="@@",h=/^old mode (\d{6})/,p=/^new mode (\d{6})/,g=/^deleted file mode (\d{6})/,v=/^new file mode (\d{6})/,b=/^copy from "?(.+)"?/,_=/^copy to "?(.+)"?/,C=/^rename from "?(.+)"?/,x=/^rename to "?(.+)"?/,E=/^similarity index (\d+)%/,A=/^dissimilarity index (\d+)%/,w=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,S=/^Binary files (.*) and (.*) differ/,y=/^GIT binary patch/,P=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,T=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,I=/^new file mode (\d{6})/,M=/^deleted file mode (\d{6}),(\d{6})/,B=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,`
|
||||
`).split(`
|
||||
`);function ge(){n!==null&&i!==null&&(i.blocks.push(n),n=null)}function Le(){i!==null&&(!i.oldName&&l!==null&&(i.oldName=l),!i.newName&&c!==null&&(i.newName=c),i.newName&&(r.push(i),i=null)),l=null,c=null}function ke(){ge(),Le(),i={blocks:[],deletedLines:0,addedLines:0}}function ne(z){ge();let X;i!==null&&((X=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(z))?(i.isCombined=!1,s=parseInt(X[1],10),o=parseInt(X[2],10)):(X=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(z))?(i.isCombined=!0,s=parseInt(X[1],10),a=parseInt(X[2],10),o=parseInt(X[3],10)):(z.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),s=0,o=0,i.isCombined=!1)),n={lines:[],oldStartLine:s,oldStartLine2:a,newStartLine:o,header:z}}function Ee(z){if(i===null||n===null||s===null||o===null)return;let X={content:z},V=i.isCombined?["+ "," +","++"]:["+"],Ne=i.isCombined?["- "," -","--"]:["-"];MP(z,V)?(i.addedLines++,X.type=nt.INSERT,X.oldNumber=void 0,X.newNumber=o++):MP(z,Ne)?(i.deletedLines++,X.type=nt.DELETE,X.oldNumber=s++,X.newNumber=void 0):(X.type=nt.CONTEXT,X.oldNumber=s++,X.newNumber=o++),n.lines.push(X)}function _e(z,X){let V=X;for(;V<B.length-3;){if(z.startsWith("diff"))return!1;if(B[V].startsWith(u)&&B[V+1].startsWith(f)&&B[V+2].startsWith(d))return!0;V++}return!1}return B.forEach((z,X)=>{if(!z||z.startsWith("*"))return;let V,Ne=B[X-1],gr=B[X+1],Nt=B[X+2];if(z.startsWith("diff --git")||z.startsWith("diff --combined")){if(ke(),(V=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(z))&&(l=Hs(V[1],void 0,e.dstPrefix),c=Hs(V[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isGitDiff=!0;return}if(z.startsWith("Binary files")&&!(i!=null&&i.isGitDiff)){if(ke(),(V=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(z))&&(l=Hs(V[1],void 0,e.dstPrefix),c=Hs(V[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isBinary=!0;return}if((!i||!i.isGitDiff&&i&&z.startsWith(u)&&gr.startsWith(f)&&Nt.startsWith(d))&&ke(),i!=null&&i.isTooBig)return;if(i&&(typeof e.diffMaxChanges=="number"&&i.addedLines+i.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&z.length>e.diffMaxLineLength)){i.isTooBig=!0,i.addedLines=0,i.deletedLines=0,i.blocks=[],n=null;let Pt=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(r.length):"Diff too big to be displayed";ne(Pt);return}if(z.startsWith(u)&&gr.startsWith(f)||z.startsWith(f)&&Ne.startsWith(u)){if(i&&!i.oldName&&z.startsWith("--- ")&&(V=R5(z,e.srcPrefix))){i.oldName=V,i.language=IP(i.oldName,i.language);return}if(i&&!i.newName&&z.startsWith("+++ ")&&(V=$5(z,e.dstPrefix))){i.newName=V,i.language=IP(i.newName,i.language);return}}if(i&&(z.startsWith(d)||i.isGitDiff&&i.oldName&&i.newName&&!n)){ne(z);return}if(n&&(z.startsWith("+")||z.startsWith("-")||z.startsWith(" "))){Ee(z);return}let Fe=!_e(z,X);if(i===null)throw new Error("Where is my file !!!");(V=h.exec(z))?i.oldMode=V[1]:(V=p.exec(z))?i.newMode=V[1]:(V=g.exec(z))?(i.deletedFileMode=V[1],i.isDeleted=!0):(V=v.exec(z))?(i.newFileMode=V[1],i.isNew=!0):(V=_.exec(z))?(Fe&&(i.oldName=V[1]),i.isCopy=!0):(V=b.exec(z))?(Fe&&(i.newName=V[1]),i.isCopy=!0):(V=S.exec(z))?(Fe&&(i.oldName=V[1]),i.isRename=!0):(V=k.exec(z))?(Fe&&(i.newName=V[1]),i.isRename=!0):(V=x.exec(z))?(i.isBinary=!0,i.oldName=Hs(V[1],void 0,e.srcPrefix),i.newName=Hs(V[2],void 0,e.dstPrefix),ne("Binary file")):y.test(z)?(i.isBinary=!0,ne(z)):(V=E.exec(z))?i.unchangedPercentage=parseInt(V[1],10):(V=A.exec(z))?i.changedPercentage=parseInt(V[1],10):(V=w.exec(z))?(i.checksumBefore=V[1],i.checksumAfter=V[2],V[3]&&(i.mode=V[3])):(V=C.exec(z))?(i.checksumBefore=[V[2],V[3]],i.checksumAfter=V[1]):(V=P.exec(z))?(i.oldMode=[V[2],V[3]],i.newMode=V[1]):(V=L.exec(z))?(i.newFileMode=V[1],i.isNew=!0):(V=N.exec(z))&&(i.deletedFileMode=V[1],i.isDeleted=!0)}),ge(),Le(),r}m();m();m();function I5(t,e){if(t.length===0)return e.length;if(e.length===0)return t.length;let r=[],i;for(i=0;i<=e.length;i++)r[i]=[i];let n;for(n=0;n<=t.length;n++)r[0][n]=n;for(i=1;i<=e.length;i++)for(n=1;n<=t.length;n++)e.charAt(i-1)===t.charAt(n-1)?r[i][n]=r[i-1][n-1]:r[i][n]=Math.min(r[i-1][n-1]+1,Math.min(r[i][n-1]+1,r[i-1][n]+1));return r[e.length][t.length]}function Ml(t){return(e,r)=>{let i=t(e).trim(),n=t(r).trim();return I5(i,n)/(i.length+n.length)}}function Dl(t){function e(i,n,s=new Map){let a=1/0,o;for(let l=0;l<i.length;++l)for(let c=0;c<n.length;++c){let u=JSON.stringify([i[l],n[c]]),f;s.has(u)&&(f=s.get(u))||(f=t(i[l],n[c]),s.set(u,f)),f<a&&(a=f,o={indexA:l,indexB:c,score:a})}return o}function r(i,n,s=0,a=new Map){let o=e(i,n,a);if(!o||i.length+n.length<3)return[[i,n]];let l=i.slice(0,o.indexA),c=n.slice(0,o.indexB),u=[i[o.indexA]],f=[n[o.indexB]],d=o.indexA+1,h=o.indexB+1,p=i.slice(d),g=n.slice(h),v=r(l,c,s+1,a),_=r(u,f,s+1,a),b=r(p,g,s+1,a),S=_;return(o.indexA>0||o.indexB>0)&&(S=v.concat(S)),(i.length>d||n.length>h)&&(S=S.concat(b)),S}return r}var Qt={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:
Line truncated
|
||||
`);return this.hoganUtils.render(NP,"wrapper",{colorScheme:Ll(this.config.colorScheme),filesNumber:e.length,files:r})}};m();var Fw=Object.assign(Object.assign({},Ma),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Ru="generic",BP="line-by-line",H5="icon",U5="tag",$u=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Fw),r)}render(e){let r=e.map(i=>{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(`
|
||||
`);return this.hoganUtils.render(Ru,"wrapper",{colorScheme:Ll(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(BP,"file-diff"),n=this.hoganUtils.template(Ru,"file-path"),s=this.hoganUtils.template(H5,"file"),a=this.hoganUtils.template(U5,Bl(e));return i.render({file:e,fileHtmlId:Nl(e),diffs:r,filePath:n.render({fileDiffName:Da(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return this.hoganUtils.render(Ru,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:Qt})}generateFileHtml(e){let r=Dl(Ml(i=>ki(i.content,e.isCombined).content));return e.blocks.map(i=>{let n=this.hoganUtils.render(Ru,"block-header",{CSSLineClass:Qt,blockHeader:e.isTooBig?i.header:Us(i.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);n+=u,n+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=ki(l.content,e.isCombined);n+=this.generateSingleLineHtml(e,{type:Qt.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e,e.isCombined,a,o);n+=l,n+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).join(`
|
||||
`)}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s<e.lines.length;s++){let a=e.lines[s];(a.type!==nt.INSERT&&n.length||a.type===nt.CONTEXT&&i.length>0)&&(r.push([[],i,n]),i=[],n=[]),a.type===nt.CONTEXT?r.push([[a],[],[]]):a.type===nt.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===nt.INSERT&&i.length>0?n.push(a):a.type===nt.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=kh(e.concat(r).map(o=>o.content.length));return n<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?i(e,r):[[e,r]]}processChangedLines(e,r,i,n){let s={right:"",left:""},a=Math.max(i.length,n.length);for(let o=0;o<a;o++){let l=i[o],c=n[o],u=l!==void 0&&c!==void 0?Ah(l.content,c.content,r,this.config):void 0,f=l!==void 0&&l.oldNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.oldLine.prefix,content:u.oldLine.content,type:Qt.DELETE_CHANGES}:Object.assign(Object.assign({},ki(l.content,r)),{type:Ol(l.type)})),{oldNumber:l.oldNumber,newNumber:l.newNumber}):void 0,d=c!==void 0&&c.newNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.newLine.prefix,content:u.newLine.content,type:Qt.INSERT_CHANGES}:Object.assign(Object.assign({},ki(c.content,r)),{type:Ol(c.type)})),{oldNumber:c.oldNumber,newNumber:c.newNumber}):void 0,{left:h,right:p}=this.generateLineHtml(e,f,d);s.left+=h,s.right+=p}return s}generateLineHtml(e,r,i){return{left:this.generateSingleLineHtml(e,r),right:this.generateSingleLineHtml(e,i)}}generateSingleLineHtml(e,r){if(r===void 0)return"";let i=this.hoganUtils.render(BP,"numbers",{oldNumber:r.oldNumber||"",newNumber:r.newNumber||""});return this.hoganUtils.render(Ru,"line",{type:r.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:r.prefix===" "?" ":r.prefix,content:r.content,lineNumber:i,line:r,file:e})}};m();var Iw=Object.assign(Object.assign({},Ma),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Fu="generic",G5="side-by-side",j5="icon",V5="tag",Iu=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Iw),r)}render(e){let r=e.map(i=>{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(`
|
||||
`);return this.hoganUtils.render(Fu,"wrapper",{colorScheme:Ll(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(G5,"file-diff"),n=this.hoganUtils.template(Fu,"file-path"),s=this.hoganUtils.template(j5,"file"),a=this.hoganUtils.template(V5,Bl(e));return i.render({file:e,fileHtmlId:Nl(e),diffs:r,filePath:n.render({fileDiffName:Da(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(Fu,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:Qt})}}generateFileHtml(e){let r=Dl(Ml(i=>ki(i.content,e.isCombined).content));return e.blocks.map(i=>{let n={left:this.makeHeaderHtml(i.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);n.left+=u,n.right+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=ki(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:Qt.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:Qt.CONTEXT,prefix:c,content:u,number:l.newNumber});n.left+=f,n.right+=d});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,a,o);n.left+=l,n.right+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).reduce((i,n)=>({left:i.left+n.left,right:i.right+n.right}),{left:"",right:""})}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s<e.lines.length;s++){let a=e.lines[s];(a.type!==nt.INSERT&&n.length||a.type===nt.CONTEXT&&i.length>0)&&(r.push([[],i,n]),i=[],n=[]),a.type===nt.CONTEXT?r.push([[a],[],[]]):a.type===nt.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===nt.INSERT&&i.length>0?n.push(a):a.type===nt.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=kh(e.concat(r).map(o=>o.content.length));return n<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?i(e,r):[[e,r]]}makeHeaderHtml(e,r){return this.hoganUtils.render(Fu,"block-header",{CSSLineClass:Qt,blockHeader:r!=null&&r.isTooBig?e:Us(e),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(e,r,i){let n={right:"",left:""},s=Math.max(r.length,i.length);for(let a=0;a<s;a++){let o=r[a],l=i[a],c=o!==void 0&&l!==void 0?Ah(o.content,l.content,e,this.config):void 0,u=o!==void 0&&o.oldNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.oldLine.prefix,content:c.oldLine.content,type:Qt.DELETE_CHANGES}:Object.assign(Object.assign({},ki(o.content,e)),{type:Ol(o.type)})),{number:o.oldNumber}):void 0,f=l!==void 0&&l.newNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.newLine.prefix,content:c.newLine.content,type:Qt.INSERT_CHANGES}:Object.assign(Object.assign({},ki(l.content,e)),{type:Ol(l.type)})),{number:l.newNumber}):void 0,{left:d,right:h}=this.generateLineHtml(u,f);n.left+=d,n.right+=h}return n}generateLineHtml(e,r){return{left:this.generateSingleHtml(e),right:this.generateSingleHtml(r)}}generateSingleHtml(e){let r="d2h-code-side-linenumber",i="d2h-code-side-line";return this.hoganUtils.render(Fu,"line",{type:(e==null?void 0:e.type)||`${Qt.CONTEXT} d2h-emptyplaceholder`,lineClass:e!==void 0?r:`${r} d2h-code-side-emptyplaceholder`,contentClass:e!==void 0?i:`${i} d2h-code-side-emptyplaceholder`,prefix:(e==null?void 0:e.prefix)===" "?" ":e==null?void 0:e.prefix,content:e==null?void 0:e.content,lineNumber:e==null?void 0:e.number})}};m();var Lw=Ht(Ow());m();var St=Ht(Ow()),bt={};bt["file-summary-line"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<li class="d2h-file-list-line">'),i.b(`
|
||||
`);function re(){n!==null&&i!==null&&(i.blocks.push(n),n=null)}function Ae(){i!==null&&(!i.oldName&&l!==null&&(i.oldName=l),!i.newName&&c!==null&&(i.newName=c),i.newName&&(r.push(i),i=null)),l=null,c=null}function K(){re(),Ae(),i={blocks:[],deletedLines:0,addedLines:0}}function Q(z){re();let X;i!==null&&((X=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(z))?(i.isCombined=!1,s=parseInt(X[1],10),o=parseInt(X[2],10)):(X=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(z))?(i.isCombined=!0,s=parseInt(X[1],10),a=parseInt(X[2],10),o=parseInt(X[3],10)):(z.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),s=0,o=0,i.isCombined=!1)),n={lines:[],oldStartLine:s,oldStartLine2:a,newStartLine:o,header:z}}function fe(z){if(i===null||n===null||s===null||o===null)return;let X={content:z},j=i.isCombined?["+ "," +","++"]:["+"],Ze=i.isCombined?["- "," -","--"]:["-"];tP(z,j)?(i.addedLines++,X.type=ut.INSERT,X.oldNumber=void 0,X.newNumber=o++):tP(z,Ze)?(i.deletedLines++,X.type=ut.DELETE,X.oldNumber=s++,X.newNumber=void 0):(X.type=ut.CONTEXT,X.oldNumber=s++,X.newNumber=o++),n.lines.push(X)}function ce(z,X){let j=X;for(;j<B.length-3;){if(z.startsWith("diff"))return!1;if(B[j].startsWith(u)&&B[j+1].startsWith(f)&&B[j+2].startsWith(d))return!0;j++}return!1}return B.forEach((z,X)=>{if(!z||z.startsWith("*"))return;let j,Ze=B[X-1],$r=B[X+1],cr=B[X+2];if(z.startsWith("diff --git")||z.startsWith("diff --combined")){if(K(),(j=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(z))&&(l=qs(j[1],void 0,e.dstPrefix),c=qs(j[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isGitDiff=!0;return}if(z.startsWith("Binary files")&&!(i!=null&&i.isGitDiff)){if(K(),(j=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(z))&&(l=qs(j[1],void 0,e.dstPrefix),c=qs(j[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isBinary=!0;return}if((!i||!i.isGitDiff&&i&&z.startsWith(u)&&$r.startsWith(f)&&cr.startsWith(d))&&K(),i!=null&&i.isTooBig)return;if(i&&(typeof e.diffMaxChanges=="number"&&i.addedLines+i.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&z.length>e.diffMaxLineLength)){i.isTooBig=!0,i.addedLines=0,i.deletedLines=0,i.blocks=[],n=null;let yt=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(r.length):"Diff too big to be displayed";Q(yt);return}if(z.startsWith(u)&&$r.startsWith(f)||z.startsWith(f)&&Ze.startsWith(u)){if(i&&!i.oldName&&z.startsWith("--- ")&&(j=_4(z,e.srcPrefix))){i.oldName=j,i.language=eP(i.oldName,i.language);return}if(i&&!i.newName&&z.startsWith("+++ ")&&(j=y4(z,e.dstPrefix))){i.newName=j,i.language=eP(i.newName,i.language);return}}if(i&&(z.startsWith(d)||i.isGitDiff&&i.oldName&&i.newName&&!n)){Q(z);return}if(n&&(z.startsWith("+")||z.startsWith("-")||z.startsWith(" "))){fe(z);return}let Ie=!ce(z,X);if(i===null)throw new Error("Where is my file !!!");(j=h.exec(z))?i.oldMode=j[1]:(j=p.exec(z))?i.newMode=j[1]:(j=g.exec(z))?(i.deletedFileMode=j[1],i.isDeleted=!0):(j=v.exec(z))?(i.newFileMode=j[1],i.isNew=!0):(j=b.exec(z))?(Ie&&(i.oldName=j[1]),i.isCopy=!0):(j=_.exec(z))?(Ie&&(i.newName=j[1]),i.isCopy=!0):(j=C.exec(z))?(Ie&&(i.oldName=j[1]),i.isRename=!0):(j=x.exec(z))?(Ie&&(i.newName=j[1]),i.isRename=!0):(j=S.exec(z))?(i.isBinary=!0,i.oldName=qs(j[1],void 0,e.srcPrefix),i.newName=qs(j[2],void 0,e.dstPrefix),Q("Binary file")):y.test(z)?(i.isBinary=!0,Q(z)):(j=E.exec(z))?i.unchangedPercentage=parseInt(j[1],10):(j=A.exec(z))?i.changedPercentage=parseInt(j[1],10):(j=w.exec(z))?(i.checksumBefore=j[1],i.checksumAfter=j[2],j[3]&&(i.mode=j[3])):(j=P.exec(z))?(i.checksumBefore=[j[2],j[3]],i.checksumAfter=j[1]):(j=T.exec(z))?(i.oldMode=[j[2],j[3]],i.newMode=j[1]):(j=I.exec(z))?(i.newFileMode=j[1],i.isNew=!0):(j=M.exec(z))&&(i.deletedFileMode=j[1],i.isDeleted=!0)}),re(),Ae(),r}m();m();m();m();var Ys=class{diff(e,r,i={}){let n;typeof i=="function"?(n=i,i={}):"callback"in i&&(n=i.callback);let s=this.castInput(e,i),a=this.castInput(r,i),o=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,l,i,n)}diffWithOptionsObj(e,r,i,n){var s;let a=_=>{if(_=this.postProcess(_,i),n){setTimeout(function(){n(_)},0);return}else return _},o=r.length,l=e.length,c=1,u=o+l;i.maxEditLength!=null&&(u=Math.min(u,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],r,e,0,i);if(h[0].oldPos+1>=l&&p+1>=o)return a(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,v=1/0,b=()=>{for(let _=Math.max(g,-c);_<=Math.min(v,c);_+=2){let C,x=h[_-1],E=h[_+1];x&&(h[_-1]=void 0);let A=!1;if(E){let S=E.oldPos-_;A=E&&0<=S&&S<o}let w=x&&x.oldPos+1<l;if(!A&&!w){h[_]=void 0;continue}if(!w||A&&x.oldPos<E.oldPos?C=this.addToPath(E,!0,!1,0,i):C=this.addToPath(x,!1,!0,1,i),p=this.extractCommon(C,r,e,_,i),C.oldPos+1>=l&&p+1>=o)return a(this.buildValues(C.lastComponent,r,e))||!0;h[_]=C,C.oldPos+1>=l&&(v=Math.min(v,_-1)),p+
Line truncated
|
||||
`);return this.hoganUtils.render(lP,"wrapper",{colorScheme:Hl(this.config.colorScheme),filesNumber:e.length,files:r})}};m();var e0=Object.assign(Object.assign({},ja),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),zu="generic",cP="line-by-line",M4="icon",D4="tag",Wu=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},e0),r)}render(e){let r=e.map(i=>{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(`
|
||||
`);return this.hoganUtils.render(zu,"wrapper",{colorScheme:Hl(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(cP,"file-diff"),n=this.hoganUtils.template(zu,"file-path"),s=this.hoganUtils.template(M4,"file"),a=this.hoganUtils.template(D4,Gl(e));return i.render({file:e,fileHtmlId:Ul(e),diffs:r,filePath:n.render({fileDiffName:Va(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return this.hoganUtils.render(zu,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:tr})}generateFileHtml(e){let r=Nl(Ll(i=>Ri(i.content,e.isCombined).content));return e.blocks.map(i=>{let n=this.hoganUtils.render(zu,"block-header",{CSSLineClass:tr,blockHeader:e.isTooBig?i.header:Zs(i.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);n+=u,n+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=Ri(l.content,e.isCombined);n+=this.generateSingleLineHtml(e,{type:tr.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e,e.isCombined,a,o);n+=l,n+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).join(`
|
||||
`)}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s<e.lines.length;s++){let a=e.lines[s];(a.type!==ut.INSERT&&n.length||a.type===ut.CONTEXT&&i.length>0)&&(r.push([[],i,n]),i=[],n=[]),a.type===ut.CONTEXT?r.push([[a],[],[]]):a.type===ut.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===ut.INSERT&&i.length>0?n.push(a):a.type===ut.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=zh(e.concat(r).map(o=>o.content.length));return n<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?i(e,r):[[e,r]]}processChangedLines(e,r,i,n){let s={right:"",left:""},a=Math.max(i.length,n.length);for(let o=0;o<a;o++){let l=i[o],c=n[o],u=l!==void 0&&c!==void 0?Kh(l.content,c.content,r,this.config):void 0,f=l!==void 0&&l.oldNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.oldLine.prefix,content:u.oldLine.content,type:tr.DELETE_CHANGES}:Object.assign(Object.assign({},Ri(l.content,r)),{type:Bl(l.type)})),{oldNumber:l.oldNumber,newNumber:l.newNumber}):void 0,d=c!==void 0&&c.newNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.newLine.prefix,content:u.newLine.content,type:tr.INSERT_CHANGES}:Object.assign(Object.assign({},Ri(c.content,r)),{type:Bl(c.type)})),{oldNumber:c.oldNumber,newNumber:c.newNumber}):void 0,{left:h,right:p}=this.generateLineHtml(e,f,d);s.left+=h,s.right+=p}return s}generateLineHtml(e,r,i){return{left:this.generateSingleLineHtml(e,r),right:this.generateSingleLineHtml(e,i)}}generateSingleLineHtml(e,r){if(r===void 0)return"";let i=this.hoganUtils.render(cP,"numbers",{oldNumber:r.oldNumber||"",newNumber:r.newNumber||""});return this.hoganUtils.render(zu,"line",{type:r.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:r.prefix===" "?" ":r.prefix,content:r.content,lineNumber:i,line:r,file:e})}};m();var t0=Object.assign(Object.assign({},ja),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),qu="generic",O4="side-by-side",L4="icon",N4="tag",Yu=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},t0),r)}render(e){let r=e.map(i=>{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(`
|
||||
`);return this.hoganUtils.render(qu,"wrapper",{colorScheme:Hl(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(O4,"file-diff"),n=this.hoganUtils.template(qu,"file-path"),s=this.hoganUtils.template(L4,"file"),a=this.hoganUtils.template(N4,Gl(e));return i.render({file:e,fileHtmlId:Ul(e),diffs:r,filePath:n.render({fileDiffName:Va(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(qu,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:tr})}}generateFileHtml(e){let r=Nl(Ll(i=>Ri(i.content,e.isCombined).content));return e.blocks.map(i=>{let n={left:this.makeHeaderHtml(i.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);n.left+=u,n.right+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=Ri(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:tr.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:tr.CONTEXT,prefix:c,content:u,number:l.newNumber});n.left+=f,n.right+=d});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,a,o);n.left+=l,n.right+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).reduce((i,n)=>({left:i.left+n.left,right:i.right+n.right}),{left:"",right:""})}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s<e.lines.length;s++){let a=e.lines[s];(a.type!==ut.INSERT&&n.length||a.type===ut.CONTEXT&&i.length>0)&&(r.push([[],i,n]),i=[],n=[]),a.type===ut.CONTEXT?r.push([[a],[],[]]):a.type===ut.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===ut.INSERT&&i.length>0?n.push(a):a.type===ut.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=zh(e.concat(r).map(o=>o.content.length));return n<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?i(e,r):[[e,r]]}makeHeaderHtml(e,r){return this.hoganUtils.render(qu,"block-header",{CSSLineClass:tr,blockHeader:r!=null&&r.isTooBig?e:Zs(e),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(e,r,i){let n={right:"",left:""},s=Math.max(r.length,i.length);for(let a=0;a<s;a++){let o=r[a],l=i[a],c=o!==void 0&&l!==void 0?Kh(o.content,l.content,e,this.config):void 0,u=o!==void 0&&o.oldNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.oldLine.prefix,content:c.oldLine.content,type:tr.DELETE_CHANGES}:Object.assign(Object.assign({},Ri(o.content,e)),{type:Bl(o.type)})),{number:o.oldNumber}):void 0,f=l!==void 0&&l.newNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.newLine.prefix,content:c.newLine.content,type:tr.INSERT_CHANGES}:Object.assign(Object.assign({},Ri(l.content,e)),{type:Bl(l.type)})),{number:l.newNumber}):void 0,{left:d,right:h}=this.generateLineHtml(u,f);n.left+=d,n.right+=h}return n}generateLineHtml(e,r){return{left:this.generateSingleHtml(e),right:this.generateSingleHtml(r)}}generateSingleHtml(e){let r="d2h-code-side-linenumber",i="d2h-code-side-line";return this.hoganUtils.render(qu,"line",{type:(e==null?void 0:e.type)||`${tr.CONTEXT} d2h-emptyplaceholder`,lineClass:e!==void 0?r:`${r} d2h-code-side-emptyplaceholder`,contentClass:e!==void 0?i:`${i} d2h-code-side-emptyplaceholder`,prefix:(e==null?void 0:e.prefix)===" "?" ":e==null?void 0:e.prefix,content:e==null?void 0:e.content,lineNumber:e==null?void 0:e.number})}};m();var s0=mt(n0());m();var $t=mt(n0()),Ct={};Ct["file-summary-line"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<li class="d2h-file-list-line">'),i.b(`
|
||||
`+r),i.b(' <span class="d2h-file-name-wrapper">'),i.b(`
|
||||
`+r),i.b(i.rp("<fileIcon0",t,e," ")),i.b(' <a href="#'),i.b(i.v(i.f("fileHtmlId",t,e,0))),i.b('" class="d2h-file-name">'),i.b(i.v(i.f("fileName",t,e,0))),i.b("</a>"),i.b(`
|
||||
`+r),i.b(' <span class="d2h-file-stats">'),i.b(`
|
||||
@@ -198,7 +198,7 @@ Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsPrope
|
||||
`+r),i.b(' <span class="d2h-lines-deleted">'),i.b(i.v(i.f("deletedLines",t,e,0))),i.b("</span>"),i.b(`
|
||||
`+r),i.b(" </span>"),i.b(`
|
||||
`+r),i.b(" </span>"),i.b(`
|
||||
`+r),i.b("</li>"),i.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});bt["file-summary-wrapper"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="d2h-file-list-wrapper '),i.b(i.v(i.f("colorScheme",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b("</li>"),i.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});Ct["file-summary-wrapper"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="d2h-file-list-wrapper '),i.b(i.v(i.f("colorScheme",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b(' <div class="d2h-file-list-header">'),i.b(`
|
||||
`+r),i.b(' <span class="d2h-file-list-title">Files changed ('),i.b(i.v(i.f("filesNumber",t,e,0))),i.b(")</span>"),i.b(`
|
||||
`+r),i.b(' <a class="d2h-file-switch d2h-hide">hide</a>'),i.b(`
|
||||
@@ -207,24 +207,24 @@ Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsPrope
|
||||
`+r),i.b(' <ol class="d2h-file-list">'),i.b(`
|
||||
`+r),i.b(" "),i.b(i.t(i.f("files",t,e,0))),i.b(`
|
||||
`+r),i.b(" </ol>"),i.b(`
|
||||
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});bt["generic-block-header"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
|
||||
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});Ct["generic-block-header"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
|
||||
`+r),i.b(' <td class="'),i.b(i.v(i.f("lineClass",t,e,0))),i.b(" "),i.b(i.v(i.d("CSSLineClass.INFO",t,e,0))),i.b('"></td>'),i.b(`
|
||||
`+r),i.b(' <td class="'),i.b(i.v(i.d("CSSLineClass.INFO",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b(' <div class="'),i.b(i.v(i.f("contentClass",t,e,0))),i.b('">'),i.s(i.f("blockHeader",t,e,1),t,e,0,156,173,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(a.t(a.f("blockHeader",n,s,0)))}),t.pop()),i.s(i.f("blockHeader",t,e,1),t,e,1,0,0,"")||i.b(" "),i.b("</div>"),i.b(`
|
||||
`+r),i.b(" </td>"),i.b(`
|
||||
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});bt["generic-empty-diff"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
|
||||
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});Ct["generic-empty-diff"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
|
||||
`+r),i.b(' <td class="'),i.b(i.v(i.d("CSSLineClass.INFO",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b(' <div class="'),i.b(i.v(i.f("contentClass",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b(" File without changes"),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
`+r),i.b(" </td>"),i.b(`
|
||||
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});bt["generic-file-path"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-file-name-wrapper">'),i.b(`
|
||||
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});Ct["generic-file-path"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-file-name-wrapper">'),i.b(`
|
||||
`+r),i.b(i.rp("<fileIcon0",t,e," ")),i.b(' <span class="d2h-file-name">'),i.b(i.v(i.f("fileDiffName",t,e,0))),i.b("</span>"),i.b(`
|
||||
`+r),i.b(i.rp("<fileTag1",t,e," ")),i.b("</span>"),i.b(`
|
||||
`+r),i.b('<label class="d2h-file-collapse">'),i.b(`
|
||||
`+r),i.b(' <input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">'),i.b(`
|
||||
`+r),i.b(" Viewed"),i.b(`
|
||||
`+r),i.b("</label>"),i.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});bt["generic-line"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
|
||||
`+r),i.b("</label>"),i.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});Ct["generic-line"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
|
||||
`+r),i.b(' <td class="'),i.b(i.v(i.f("lineClass",t,e,0))),i.b(" "),i.b(i.v(i.f("type",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b(" "),i.b(i.t(i.f("lineNumber",t,e,0))),i.b(`
|
||||
`+r),i.b(" </td>"),i.b(`
|
||||
@@ -236,23 +236,23 @@ Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsPrope
|
||||
`+r)}),t.pop()),i.s(i.f("content",t,e,1),t,e,1,0,0,"")||(i.b(' <span class="d2h-code-line-ctn"><br></span>'),i.b(`
|
||||
`+r)),i.b(" </div>"),i.b(`
|
||||
`+r),i.b(" </td>"),i.b(`
|
||||
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});bt["generic-wrapper"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="d2h-wrapper '),i.b(i.v(i.f("colorScheme",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});Ct["generic-wrapper"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="d2h-wrapper '),i.b(i.v(i.f("colorScheme",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b(" "),i.b(i.t(i.f("content",t,e,0))),i.b(`
|
||||
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});bt["icon-file-added"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),i.b(`
|
||||
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});Ct["icon-file-added"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),i.b(`
|
||||
`+r),i.b(' width="14">'),i.b(`
|
||||
`+r),i.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z"></path>'),i.b(`
|
||||
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});bt["icon-file-changed"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),i.b(`
|
||||
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});Ct["icon-file-changed"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),i.b(`
|
||||
`+r),i.b(' viewBox="0 0 14 16" width="14">'),i.b(`
|
||||
`+r),i.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>'),i.b(`
|
||||
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});bt["icon-file-deleted"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),i.b(`
|
||||
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});Ct["icon-file-deleted"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),i.b(`
|
||||
`+r),i.b(' viewBox="0 0 14 16" width="14">'),i.b(`
|
||||
`+r),i.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z"></path>'),i.b(`
|
||||
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});bt["icon-file-renamed"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),i.b(`
|
||||
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});Ct["icon-file-renamed"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),i.b(`
|
||||
`+r),i.b(' viewBox="0 0 14 16" width="14">'),i.b(`
|
||||
`+r),i.b(' <path d="M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z"></path>'),i.b(`
|
||||
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});bt["icon-file"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),i.b(`
|
||||
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});Ct["icon-file"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),i.b(`
|
||||
`+r),i.b(' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>'),i.b(`
|
||||
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});bt["line-by-line-file-diff"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div id="'),i.b(i.v(i.f("fileHtmlId",t,e,0))),i.b('" class="d2h-file-wrapper" data-lang="'),i.b(i.v(i.d("file.language",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});Ct["line-by-line-file-diff"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div id="'),i.b(i.v(i.f("fileHtmlId",t,e,0))),i.b('" class="d2h-file-wrapper" data-lang="'),i.b(i.v(i.d("file.language",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b(' <div class="d2h-file-header">'),i.b(`
|
||||
`+r),i.b(" "),i.b(i.t(i.f("filePath",t,e,0))),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
@@ -265,8 +265,8 @@ Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsPrope
|
||||
`+r),i.b(" </table>"),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});bt["line-by-line-numbers"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="line-num1">'),i.b(i.v(i.f("oldNumber",t,e,0))),i.b("</div>"),i.b(`
|
||||
`+r),i.b('<div class="line-num2">'),i.b(i.v(i.f("newNumber",t,e,0))),i.b("</div>"),i.fl()},partials:{},subs:{}});bt["side-by-side-file-diff"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div id="'),i.b(i.v(i.f("fileHtmlId",t,e,0))),i.b('" class="d2h-file-wrapper" data-lang="'),i.b(i.v(i.d("file.language",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});Ct["line-by-line-numbers"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="line-num1">'),i.b(i.v(i.f("oldNumber",t,e,0))),i.b("</div>"),i.b(`
|
||||
`+r),i.b('<div class="line-num2">'),i.b(i.v(i.f("newNumber",t,e,0))),i.b("</div>"),i.fl()},partials:{},subs:{}});Ct["side-by-side-file-diff"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div id="'),i.b(i.v(i.f("fileHtmlId",t,e,0))),i.b('" class="d2h-file-wrapper" data-lang="'),i.b(i.v(i.d("file.language",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b(' <div class="d2h-file-header">'),i.b(`
|
||||
`+r),i.b(" "),i.b(i.t(i.f("filePath",t,e,0))),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
@@ -290,80 +290,80 @@ Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsPrope
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});bt["tag-file-added"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),i.fl()},partials:{},subs:{}});bt["tag-file-changed"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),i.fl()},partials:{},subs:{}});bt["tag-file-deleted"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),i.fl()},partials:{},subs:{}});bt["tag-file-renamed"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),i.fl()},partials:{},subs:{}});var Mu=class{constructor({compiledTemplates:e={},rawTemplates:r={}}){let i=Object.entries(r).reduce((n,[s,a])=>{let o=Lw.compile(a,{asString:!1});return Object.assign(Object.assign({},n),{[s]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},bt),e),i)}static compile(e){return Lw.compile(e,{asString:!1})}render(e,r,i,n,s){let a=this.templateKey(e,r);try{return this.preCompiledTemplates[a].render(i,n,s)}catch(o){throw new Error(`Could not find template to render '${a}'`)}}template(e,r){return this.preCompiledTemplates[this.templateKey(e,r)]}templateKey(e,r){return`${e}-${r}`}};var W5=Object.assign(Object.assign(Object.assign({},Fw),Iw),{outputFormat:TP.LINE_BY_LINE,drawFileList:!0});function Ph(t,e={}){let r=Object.assign(Object.assign({},W5),e),i=typeof t=="string"?OP(t,r):t,n=new Mu(r),{colorScheme:s}=r,a={colorScheme:s},o=r.drawFileList?new Ch(n,a).render(i):"",l=r.outputFormat==="side-by-side"?new Iu(n,r).render(i):new $u(n,r).render(i);return o+l}var qP=Ht(zP(),1);var Oa=require("obsidian"),Nw=Du.StateEffect.define();function Gs(t,e){let r=t.state,i=r.field($h),n=r.field(Hr),s=r.doc.lineAt(e!=null?e:r.selection.main.head).number,a=Vt.findHunk(s,n==null?void 0:n.hunks)[0];if(!a)return;let o=r.doc.line(Math.max(1,a.added.start)).from,l=i.has(o);return r.field(Oa.editorEditorField).dispatch({effects:Nw.of({pos:o,add:!l})})}var $h=Du.StateField.define({create:()=>new Set,update(t,e){let r=new Set;for(let i of e.effects)i.is(Nw)&&(i.value.add?t.add(i.value.pos):t.delete(i.value.pos));for(let i of t)r.add(e.changes.mapPos(i));return r}}),YP=Du.StateField.define({create:t=>WP(t),update(t,e){return e.docChanged||e.effects.some(r=>r.is(Il)||r.is(Nw))?WP(e.state):t},provide:t=>Rh.showTooltip.computeN([t],e=>e.field(t))}),XP=Rh.EditorView.baseTheme({".cm-tooltip.git-diff-tooltip":{"z-index":"var(--layer-popover)",backgroundColor:"var(--background-primary-alt)",border:"var(--border-width) solid var(--background-primary-alt)",borderRadius:"var(--radius-s)"},".cm-tooltip.git-diff-tooltip .tooltip-toolbar":{display:"flex",padding:"var(--size-2-1)"}});function WP(t){let e=t.field(Hr);return e?[...t.field($h)].map(i=>{let n=t.doc.lineAt(i),s=Vt.findHunk(n.number,e.hunks)[0];if(s)return{pos:i,above:!1,arrow:!1,strictSide:!0,clip:!1,create:()=>q5(s,t,i)}}).filter(i=>i!==void 0):[]}function q5(t,e,r){var g,v;let i=Vt.createPatch("file",[t],"10064",!1).join(`
|
||||
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});Ct["tag-file-added"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),i.fl()},partials:{},subs:{}});Ct["tag-file-changed"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),i.fl()},partials:{},subs:{}});Ct["tag-file-deleted"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),i.fl()},partials:{},subs:{}});Ct["tag-file-renamed"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),i.fl()},partials:{},subs:{}});var Zu=class{constructor({compiledTemplates:e={},rawTemplates:r={}}){let i=Object.entries(r).reduce((n,[s,a])=>{let o=s0.compile(a,{asString:!1});return Object.assign(Object.assign({},n),{[s]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},Ct),e),i)}static compile(e){return s0.compile(e,{asString:!1})}render(e,r,i,n,s){let a=this.templateKey(e,r);try{return this.preCompiledTemplates[a].render(i,n,s)}catch(o){throw new Error(`Could not find template to render '${a}'`)}}template(e,r){return this.preCompiledTemplates[this.templateKey(e,r)]}templateKey(e,r){return`${e}-${r}`}};var H4=Object.assign(Object.assign(Object.assign({},e0),t0),{outputFormat:Z2.LINE_BY_LINE,drawFileList:!0});function Jh(t,e={}){let r=Object.assign(Object.assign({},H4),e),i=typeof t=="string"?iP(t,r):t,n=new Zu(r),{colorScheme:s}=r,a={colorScheme:s},o=r.drawFileList?new Xh(n,a).render(i):"",l=r.outputFormat==="side-by-side"?new Yu(n,r).render(i):new Wu(n,r).render(i);return o+l}var vP=mt(mP(),1);var za=require("obsidian"),a0=Ku.StateEffect.define();function Ks(t,e){let r=t.state,i=r.field(tp),n=r.field(Wr),s=r.doc.lineAt(e!=null?e:r.selection.main.head).number,a=qt.findHunk(s,n==null?void 0:n.hunks)[0];if(!a)return;let o=r.doc.line(Math.max(1,a.added.start)).from,l=i.has(o);return r.field(za.editorEditorField).dispatch({effects:a0.of({pos:o,add:!l})})}var tp=Ku.StateField.define({create:()=>new Set,update(t,e){let r=new Set;for(let i of e.effects)i.is(a0)&&(i.value.add?t.add(i.value.pos):t.delete(i.value.pos));for(let i of t)r.add(e.changes.mapPos(i));return r}}),wP=Ku.StateField.define({create:t=>gP(t),update(t,e){return e.docChanged||e.effects.some(r=>r.is(Ml)||r.is(a0))?gP(e.state):t},provide:t=>ep.showTooltip.computeN([t],e=>e.field(t))}),bP=ep.EditorView.baseTheme({".cm-tooltip.git-diff-tooltip":{"z-index":"var(--layer-popover)",backgroundColor:"var(--background-primary-alt)",border:"var(--border-width) solid var(--background-primary-alt)",borderRadius:"var(--radius-s)"},".cm-tooltip.git-diff-tooltip .tooltip-toolbar":{display:"flex",padding:"var(--size-2-1)"}});function gP(t){let e=t.field(Wr);return e?[...t.field(tp)].map(i=>{let n=t.doc.lineAt(i),s=qt.findHunk(n.number,e.hunks)[0];if(s)return{pos:i,above:!1,arrow:!1,strictSide:!0,clip:!1,create:()=>U4(s,t,i)}}).filter(i=>i!==void 0):[]}function U4(t,e,r){var g,v;let i=qt.createPatch("file",[t],"10064",!1).join(`
|
||||
`)+`
|
||||
`,n=Ph(i,{colorScheme:qP.ColorSchemeType.AUTO,diffStyle:"word",drawFileList:!1}),s=new DOMParser().parseFromString(n,"text/html").querySelector(".d2h-file-diff"),a=activeDocument.createDiv(),o=activeDocument.createDiv();o.addClass("tooltip-toolbar");let l=(_,b)=>{let S=activeDocument.createDiv();return(0,Oa.setIcon)(S,_),S.setAttr("aria-label",b),S.addClass("clickable-icon"),S},c=l("x","Close hunk"),u=l("plus","Stage hunk"),f=l("undo","Reset hunk");o.appendChild(c),o.appendChild(u),o.appendChild(f),a.appendChild(o),a.appendChild(s),a.addClass("git-diff-tooltip","git-diff");let d=e.field(Oa.editorEditorField);c.onclick=()=>{Gs(d,r)},u.onclick=()=>{let _=jt.plugin;_&&(_.promiseQueue.addTask(()=>_.hunkActions.stageHunk(r)),Gs(d,r))},f.onclick=()=>{let _=jt.plugin;_&&(_.hunkActions.resetHunk(r),Gs(d,r))};let h=(v=(g=jt.plugin)==null?void 0:g.app.workspace.getActiveViewOfType(Oa.MarkdownView))==null?void 0:v.scope,p=h==null?void 0:h.register(null,"Escape",(_,b)=>{Gs(d,r)});return{dom:a,destroy:()=>{p&&(h==null||h.unregister(p))},update:_=>{r=_.changes.mapPos(r)}}}function ZP(t){let e=t.app;t.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let r=t.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(r)||await e.vault.adapter.write(r,"");let i=await e.vault.adapter.read(r),s=await new mh(e,i).openAndGetReslt();s!==void 0&&(await e.vault.adapter.write(r,s),await t.refresh())}}),t.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(Kt.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:Kt.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(bi.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:bi.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;{let n=t.gitManager.getRelativeRepoPath(i.path,!0);t.tools.openDiff({aFile:n,aRef:""})}}}),t.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(r,{file:i})=>{if(i)return N2(r,i,t.gitManager)}}),t.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(r,{file:i})=>{if(i)return B2(i,t.gitManager)}}),t.addCommand({id:"pull",name:"Pull",callback:()=>t.promiseQueue.addTask(()=>t.pullChangesFromRemote())}),t.addCommand({id:"fetch",name:"Fetch",callback:()=>t.promiseQueue.addTask(()=>t.fetch())}),t.addCommand({id:"switch-to-remote-branch",name:"Switch to remote branch",callback:()=>t.promiseQueue.addTask(()=>t.switchRemoteBranch())}),t.addCommand({id:"add-to-gitignore",name:"Add file to .gitignore",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;t.addFileToGitignore(i.path,i instanceof qi.TFolder).catch(n=>t.displayError(n))}}),t.addCommand({id:"push",name:"Commit-and-sync",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1}))}),t.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>t.promiseQueue.addTask(async()=>{await t.commitAndSync({fromAutoBackup:!1}),window.close()})}),t.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit",name:"Commit all changes",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1}))}),t.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit-smart",name:"Commit",callback:()=>t.promiseQueue.addTask(async()=>{let i=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!1,onlyStaged:i})})}),t.addCommand({id:"commit-staged",name:"Commit staged",checkCallback:function(r){if(r)return!1;t.promiseQueue.addTask(async()=>t.commit({fromAuto:!1,requestCustomMessage:!1}))}}),qi.Platform.isDesktopApp&&t.addCommand({id:"commit-amend-staged-specified-message",name:"Amend staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0,amend:!0}))}),t.addCommand({id:"commit-smart-specified-message",name:"Commit with specific message",callback:()=>t.promiseQueue.addTask(async()=>{let i=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:i})})}),t.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",checkCallback:function(r){return r?!1:t.pr
Line truncated
|
||||
`,n=Jh(i,{colorScheme:vP.ColorSchemeType.AUTO,diffStyle:"word",drawFileList:!1}),s=new DOMParser().parseFromString(n,"text/html").querySelector(".d2h-file-diff"),a=createDiv();a.addClass("tooltip-toolbar");let o=(b,_)=>{let C=createDiv();return(0,za.setIcon)(C,b),C.setAttr("aria-label",_),C.addClass("clickable-icon"),C},l=o("x","Close hunk"),c=o("plus","Stage hunk"),u=o("undo","Reset hunk");a.appendChild(l),a.appendChild(c),a.appendChild(u);let f=createDiv();f.appendChild(a),f.appendChild(s),f.addClass("git-diff-tooltip","git-diff");let d=e.field(za.editorEditorField);l.onclick=()=>{Ks(d,r)},c.onclick=()=>{let b=Et.plugin;b&&(b.promiseQueue.addTask(()=>b.hunkActions.stageHunk(r)),Ks(d,r))},u.onclick=()=>{let b=Et.plugin;b&&(b.hunkActions.resetHunk(r),Ks(d,r))};let h=(v=(g=Et.plugin)==null?void 0:g.app.workspace.getActiveViewOfType(za.MarkdownView))==null?void 0:v.scope,p=h==null?void 0:h.register(null,"Escape",(b,_)=>{Ks(d,r)});return{dom:f,destroy:()=>{p&&(h==null||h.unregister(p))},update:b=>{r=b.changes.mapPos(r)}}}function _P(t){let e=t.app;t.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let r=t.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(r)||await e.vault.adapter.write(r,"");let i=await e.vault.adapter.read(r),s=await new Mh(e,i).openAndGetReslt();s!==void 0&&(await e.vault.adapter.write(r,s),await t.refresh())}}),t.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(er.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:er.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(Ei.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:Ei.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;{let n=t.gitManager.getRelativeRepoPath(i.path,!0);return t.tools.openDiff({aFile:n,aRef:""}),!0}}}),t.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(r,{file:i})=>{if(i)return s2(r,i,t.gitManager)}}),t.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(r,{file:i})=>{if(i)return a2(i,t.gitManager)}}),t.addCommand({id:"pull",name:"Pull",callback:()=>t.promiseQueue.addTask(()=>t.pullChangesFromRemote())}),t.addCommand({id:"fetch",name:"Fetch",callback:()=>t.promiseQueue.addTask(()=>t.fetch())}),t.addCommand({id:"switch-to-remote-branch",name:"Switch to remote branch",callback:()=>t.promiseQueue.addTask(()=>t.switchRemoteBranch())}),t.addCommand({id:"add-to-gitignore",name:"Add file to .gitignore",checkCallback:r=>{let i=e.workspace.getActiveFile();return r?i!==null:(t.addFileToGitignore(i.path,i instanceof Xi.TFolder).catch(n=>t.displayError(n)),!0)}}),t.addCommand({id:"push",name:"Commit-and-sync",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1}))}),t.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>t.promiseQueue.addTask(async()=>{await t.commitAndSync({fromAutoBackup:!1}),window.close()})}),t.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit",name:"Commit all changes",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,mode:"all"}))}),t.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,mode:"all"}))}),t.addCommand({id:"commit-smart",name:"Commit",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!1,mode:"smart"}))}),t.addCommand({id:"commit-staged",name:"Commit staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!1,mode:"staged"}))}),Xi.Platform.isDesktopApp&&t.addCommand({id:"commit-amend-staged-specified-message",name:"Amend staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,mode:"staged",amend:!0}))}),t.addCommand({id:"commit-smart-specified-message",name:"Commit with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,mode:"smart"}))}),t.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,mode:"staged"}))}),t.addCommand({id:"push2",name:"Push",callback:()=>t.promiseQueue.addTask(()=>t.push())}),t.addCom
Line truncated
|
||||
- ${s.map(o=>o.vaultPath).join(`
|
||||
- `)}
|
||||
Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(e){e!==void 0&&await this.plugin.app.vault.adapter.write(il,e);let r=!1;this.plugin.app.workspace.iterateAllLeaves(i=>{i.getDisplayText()!=""&&il.startsWith(i.getDisplayText())&&(r=!0)}),r||await this.plugin.app.workspace.openLinkText(il,"/",!0)}openDiff({aFile:e,bFile:r,aRef:i,bRef:n,event:s}){var l,c;let a=this.plugin.settings.diffStyle;Hl.Platform.isMobileApp&&(a="git_unified");let o={aFile:e,bFile:r!=null?r:e,aRef:i,bRef:n};a=="split"?(l=ji(this.plugin.app,s))==null||l.setViewState({type:Ms.type,active:!0,state:o}):a=="git_unified"&&((c=ji(this.plugin.app,s))==null||c.setViewState({type:Ds.type,active:!0,state:o}))}async runRawCommand(){let e=this.plugin.gitManager;if(!(e instanceof Se))return;let i=await new et(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();i!==void 0&&this.plugin.promiseQueue.addTask(async()=>{let n=new Hl.Notice(`Running '${i}'...`,999999);try{let s=await e.rawCommand(i);s?(n.setMessage(s),window.setTimeout(()=>n.hide(),5e3)):n.hide()}catch(s){throw n.hide(),s}})}};m();var Ih=require("obsidian");var La=class extends Ih.ItemView{constructor(r,i){super(r);this.plugin=i;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.contentEl.addClass("git-diff"),this.gitRefreshRef=this.app.workspace.on("obsidian-git:status-changed",()=>{this.refresh().catch(console.error)})}getViewType(){return Ds.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();return i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3)),`Diff: ${i}`}return Ds.name}getIcon(){return Ds.icon}async setState(r,i){this.state=r,Ih.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await this.refresh()}getState(){return this.state}onClose(){return this.app.workspace.offref(this.gitRefreshRef),this.app.workspace.offref(this.gitViewRefreshRef),super.onClose()}async onOpen(){return await this.refresh(),super.onOpen()}async refresh(){var r;if((r=this.state)!=null&&r.bFile&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let i=await this.plugin.gitManager.getDiffString(this.state.bFile,this.state.aRef=="HEAD",this.state.bRef);this.contentEl.empty();let n=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);if(!i){if(this.plugin.gitManager instanceof Se&&await this.plugin.gitManager.isTracked(this.state.bFile))i=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(`
|
||||
Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(e){e!==void 0&&await this.plugin.app.vault.adapter.write(ol,e);let r=!1;this.plugin.app.workspace.iterateAllLeaves(i=>{i.getDisplayText()!=""&&ol.startsWith(i.getDisplayText())&&(r=!0)}),r||await this.plugin.app.workspace.openLinkText(ol,"/",!0)}openDiff({aFile:e,bFile:r,aRef:i,bRef:n,event:s}){var l,c;let a=this.plugin.settings.diffStyle;jl.Platform.isMobileApp&&(a="git_unified");let o={aFile:e,bFile:r!=null?r:e,aRef:i,bRef:n};a=="split"?(l=Yi(this.plugin.app,s))==null||l.setViewState({type:Hs.type,active:!0,state:o}):a=="git_unified"&&((c=Yi(this.plugin.app,s))==null||c.setViewState({type:Us.type,active:!0,state:o}))}async runRawCommand(){let e=this.plugin.gitManager;if(!(e instanceof ke))return;let i=await new at(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();i!==void 0&&this.plugin.promiseQueue.addTask(async()=>{let n=new jl.Notice(`Running '${i}'...`,999999);try{let s=await e.rawCommand(i);s?(n.setMessage(s),window.setTimeout(()=>n.hide(),5e3)):n.hide()}catch(s){throw n.hide(),s}})}};m();var ip=require("obsidian");var Wa=class extends ip.ItemView{constructor(r,i){super(r);this.plugin=i;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.contentEl.addClass("git-diff"),this.gitRefreshRef=this.app.workspace.on("obsidian-git:status-changed",()=>{this.refresh().catch(console.error)})}getViewType(){return Us.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();return i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3)),`Diff: ${i}`}return Us.name}getIcon(){return Us.icon}async setState(r,i){this.state=r,ip.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await this.refresh()}getState(){return this.state}onClose(){return this.app.workspace.offref(this.gitRefreshRef),this.app.workspace.offref(this.gitViewRefreshRef),super.onClose()}async onOpen(){return await this.refresh(),super.onOpen()}async refresh(){var r;if((r=this.state)!=null&&r.bFile&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let i=await this.plugin.gitManager.getDiffString(this.state.bFile,this.state.aRef=="HEAD",this.state.bRef);this.contentEl.empty();let n=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);if(!i){if(this.plugin.gitManager instanceof ke&&await this.plugin.gitManager.isTracked(this.state.bFile))i=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(`
|
||||
`);else if(await this.app.vault.adapter.exists(n)){let s=await this.app.vault.adapter.read(n);i=[...`--- /dev/null
|
||||
+++ ${this.state.bFile}
|
||||
@@ -0,0 +1,${s.split(`
|
||||
`).length} @@`.split(`
|
||||
`),...s.split(`
|
||||
`).map(o=>`+${o}`)].join(`
|
||||
`)}}if(i){let s=this.parser.parseFromString(Ph(i),"text/html").querySelector(".d2h-file-diff");this.contentEl.append(s)}else{let s=this.contentEl.createDiv({cls:"obsidian-git-center"});s.createSpan({text:"\u26A0\uFE0F",attr:{style:"font-size: 2em"}}),s.createEl("br"),s.createSpan({text:"File not found: "+this.state.bFile})}}finally{this.gettingDiff=!1}}}};m();var rs=require("obsidian");var Gl=require("@codemirror/commands");var Mh=require("@codemirror/search"),Ul=require("@codemirror/state"),Ci=require("@codemirror/view");var Na=class extends rs.ItemView{constructor(r,i){super(r);this.plugin=i;this.refreshing=!1;this.ignoreNextModification=!1;this.navigation=!0,this.registerEvent(this.app.workspace.on("obsidian-git:status-changed",()=>{this.mergeView?this.updateRefEditors().catch(console.error):this.createMergeView().catch(console.error)})),this.intervalRef=window.setInterval(()=>{this.mergeView&&this.updateRefEditors().catch(console.error)},30*1e3),this.registerEvent(this.app.vault.on("modify",n=>{this.state.bRef==null&&n.path===this.state.bFile&&(this.ignoreNextModification?this.ignoreNextModification=!1:this.updateModifiableEditor().catch(console.error))})),this.registerEvent(this.app.vault.on("delete",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("create",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("rename",(n,s)=>{this.state.bRef==null&&(n.path===this.state.bFile||s===this.state.bFile)&&this.createMergeView().catch(console.error)})),this.fileSaveDebouncer=(0,rs.debounce)(n=>{let s=this.state.bFile;s&&(this.ignoreNextModification=!0,this.plugin.app.vault.adapter.write(this.plugin.gitManager.getRelativeVaultPath(s),n).catch(a=>this.plugin.displayError(a)))},1e3,!1)}getViewType(){return Ms.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3));let n;return this.state.bRef==null?n=" (Working Tree)":this.state.bRef==""?n=" (Index)":n="("+this.state.bRef.substring(0,7)+")",`Diff: ${i} ${n}`}return Ms.name}getIcon(){return Ms.icon}async setState(r,i){this.state=r,rs.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await super.setState(r,i),await this.createMergeView()}getState(){return this.state}onClose(){return window.clearInterval(this.intervalRef),super.onClose()}async onOpen(){return await this.createMergeView(),super.onOpen()}async gitShow(r,i){try{return await this.plugin.gitManager.show(r,i,!1)}catch(n){if(n instanceof Nr&&(n.message.includes("does not exist")||n.message.includes("unknown revision or path")||n.message.includes("exists on disk, but not in")||n.message.includes("fatal: bad object")))return n.message.includes("fatal: bad object")&&this.plugin.displayError(n.message),"";throw n}}async bShouldBeEditable(){if(this.state.bRef!=null)return!1;let r=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);return await this.app.vault.adapter.exists(r)}async updateModifiableEditor(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.b;this.refreshing=!0;let i=await this.app.vault.adapter.read(this.state.bFile);if(i!=r.state.doc.toString()){let n=r.state.update({changes:{from:0,to:r.state.doc.length,insert:i},annotations:[Ul.Transaction.remote.of(!0)]});r.dispatch(n)}this.refreshing=!1}async updateRefEditors(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.a,i=this.mergeView.b;this.refreshing=!0;let n=await this.gitShow(this.state.aRef,this.state.aFile),s;if(this.state.bRef!=null&&(s=await this.gitShow(this.state.bRef,this.state.bFile)),n!=r.state.doc.toString()){let a=r.state.update({changes:{from:0,to:r.state.doc.length,insert:n}});r.dispatch(a)}if(s!=null&&s!=i.state.doc.toString()){let a=i.state.update({changes:{from:0,to:i.state.doc.length,insert:s}});i.dispatch(a)}this.refreshing=!1}renderButtons(){let r=activeDocument.createDiv(),i=r.createDiv();if(i.addClass("clickable-icon"),i.setAttr("aria-label",this.state.bRef==null?"Stage hunk":"Unstage hunk"),(0,rs.setIcon)(i,this.state.bRef==null?"plus":"minus"),i.onmousedown=async n=>{var h;let s=this.mergeView.b,a=this.mergeView.a,o=Ew(s.state),l=(h=r.parentElement)==null?void 0:h.indexOf(r),c=o.chunks[l],u=Aw(c,a.state.doc,s.state.doc),f=kw(this.mergeView.a.state.doc.toString(),this.mergeView.b.state.doc.toString(),[u])[0],d=Vt.createPatch(this.state.bFile,[f],"100644",this.state.bRef!=null).join(`
|
||||
`)}}if(i){let s=this.parser.parseFromString(Jh(i),"text/html").querySelector(".d2h-file-diff");this.contentEl.append(s)}else{let s=this.contentEl.createDiv({cls:"obsidian-git-center"});s.createSpan({text:"\u26A0\uFE0F",attr:{style:"font-size: 2em"}}),s.createEl("br"),s.createSpan({text:"File not found: "+this.state.bFile})}}finally{this.gettingDiff=!1}}}};m();var ss=require("obsidian");var zl=require("@codemirror/commands");var sp=require("@codemirror/search"),Vl=require("@codemirror/state"),Qi=require("@codemirror/view");m();var np=require("obsidian"),o0=require("@codemirror/view");function G4(t){return t.selection.ranges.filter(e=>!e.empty).map(e=>t.sliceDoc(e.from,e.to)).join(t.lineBreak)}function j4(t){t.dispatch({...t.state.replaceSelection(""),userEvent:"delete.cut"})}function yP(t,e){t.dispatch({...t.state.replaceSelection(e),scrollIntoView:!0,userEvent:"input.paste"})}async function xP(t){if(!t&&navigator.clipboard.read){let e=await navigator.clipboard.read();for(let r of e)if(r.types.includes("text/html")){let i=await(await r.getType("text/html")).text();return(0,np.htmlToMarkdown)(i)}}return navigator.clipboard.readText()}var EP=o0.EditorView.domEventHandlers({contextmenu(t,e){t.preventDefault();let r=G4(e.state),i=!e.state.readOnly&&e.state.facet(o0.EditorView.editable),n=np.Menu.forEvent(t);return n.addItem(s=>s.setTitle("Cut").setIcon("scissors").setDisabled(!i||r.length===0).onClick(async()=>{await navigator.clipboard.writeText(r),j4(e)})),n.addItem(s=>s.setTitle("Copy").setIcon("copy").setDisabled(r.length===0).onClick(()=>navigator.clipboard.writeText(r))),n.addItem(s=>s.setTitle("Paste").setIcon("clipboard-paste").setDisabled(!i).onClick(async()=>yP(e,await xP(!1)))),n.addItem(s=>s.setTitle("Paste as plain text").setIcon("clipboard-type").setDisabled(!i).onClick(async()=>yP(e,await xP(!0)))),n.addItem(s=>s.setTitle("Select all").setIcon("scan").onClick(()=>e.dispatch({selection:{anchor:0,head:e.state.doc.length}}))),n.showAtMouseEvent(t),!0}});var SP=Qi.EditorView.theme({"& .cm-content":{caretColor:"transparent !important"},"&.cm-focused .cm-cursor, & .cm-dropCursor":{display:"none !important"}}),V4=10;function z4(t,e){let r=Number.isInteger(t)&&t>0?t:tt.diffTimeout;return e?r:r*V4}var qa=class extends ss.ItemView{constructor(r,i){super(r);this.plugin=i;this.refreshing=!1;this.ignoreNextModification=!1;this.navigation=!0,this.registerEvent(this.app.workspace.on("obsidian-git:status-changed",()=>{this.mergeView?this.updateRefEditors().catch(console.error):this.createMergeView().catch(console.error)})),this.intervalRef=window.setInterval(()=>{this.mergeView&&this.updateRefEditors().catch(console.error)},30*1e3),this.registerEvent(this.app.vault.on("modify",n=>{this.state.bRef==null&&n.path===this.state.bFile&&(this.ignoreNextModification?this.ignoreNextModification=!1:this.updateModifiableEditor().catch(console.error))})),this.registerEvent(this.app.vault.on("delete",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("create",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("rename",(n,s)=>{this.state.bRef==null&&(n.path===this.state.bFile||s===this.state.bFile)&&this.createMergeView().catch(console.error)})),this.fileSaveDebouncer=(0,ss.debounce)(n=>{let s=this.state.bFile;s&&(this.ignoreNextModification=!0,this.plugin.app.vault.adapter.write(this.plugin.gitManager.getRelativeVaultPath(s),n).catch(a=>this.plugin.displayError(a)))},1e3,!1)}getViewType(){return Hs.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3));let n;return this.state.bRef==null?n=" (Working Tree)":this.state.bRef==""?n=" (Index)":n="("+this.state.bRef.substring(0,7)+")",`Diff: ${i} ${n}`}return Hs.name}getIcon(){return Hs.icon}async setState(r,i){this.state=r,ss.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await super.setState(r,i),await this.createMergeView()}getState(){return this.state}onClose(){return window.clearInterval(this.intervalRef),super.onClose()}async onOpen(){return await this.createMergeView(),super.onOpen()}async gitShow(r,i){try{return await this.plugin.gitManager.show(r,i,!1)}catch(n){if(n instanceof jr&&(n.message.includes("does not exist")||n.message.includes("unknown revision or path")||n.message.includes("exists on disk, but not in")||n.message.includes("fatal: bad object")))return n.message.includes("fatal: bad object")&&this.plugin.displayError(n.message),"";throw n}}async bShouldBeEditable(){if(this.state.bRef!=null)return!1;let r=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);return await this.app.vault.adapter.exists(r)}async updateModifiableEditor(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.b;this.refreshing=!0;let i=await this.app.vault.adap
Line truncated
|
||||
`)+`
|
||||
`;await this.plugin.gitManager.applyPatch(d),this.plugin.app.workspace.trigger("obsidian-git:refresh")},this.state.bRef==null){let n=r.createDiv();n.addClass("clickable-icon"),n.setAttr("aria-label","Reset hunk"),(0,rs.setIcon)(n,"undo"),n.onmousedown=s=>{var f;let a=this.mergeView.a,o=this.mergeView.b,l=Ew(o.state),c=(f=r.parentElement)==null?void 0:f.indexOf(r),u=l.chunks[c];if(u){let d=u.fromA,h=u.toA,p=u.fromB,g=u.toB,v=a.state.sliceDoc(d,Math.max(d,h-1));d!=h&&g<=o.state.doc.length&&(v+=a.state.lineBreak),o.dispatch({changes:{from:p,to:Math.min(o.state.doc.length,g),insert:v},userEvent:"revert"})}}}return r.onmousedown=n=>{n.preventDefault(),n.stopPropagation()},r}async createMergeView(){var r,i,n;if((r=this.state)!=null&&r.aFile&&((i=this.state)!=null&&i.bFile)&&!this.refreshing&&this.plugin.gitManager){this.refreshing=!0,(n=this.mergeView)==null||n.destroy();let s=this.containerEl.children[1];s.empty(),this.contentEl.addClass("git-split-diff-view","git-diff"),this.bIsEditable=await this.bShouldBeEditable();let a=await this.gitShow(this.state.aRef,this.state.aFile),o;if(this.state.bRef!=null)o=await this.gitShow(this.state.bRef,this.state.bFile);else{let g=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);await this.app.vault.adapter.exists(g)?o=await this.app.vault.adapter.read(g):o=""}let l=[(0,Ci.lineNumbers)(),(0,Mh.highlightSelectionMatches)(),(0,Ci.drawSelection)(),Ci.keymap.of([...Gl.standardKeymap,Gl.indentWithTab]),(0,Gl.history)(),(0,Mh.search)(),Ci.EditorView.lineWrapping],c=this,u=Ci.ViewPlugin.define(g=>({update(v){if(v.docChanged&&!v.transactions.some(_=>_.annotation(Ul.Transaction.remote))){let _=g.state.doc.toString();c.fileSaveDebouncer(_)}}})),f={doc:a,extensions:[...l,Ci.EditorView.editable.of(!1),Ul.EditorState.readOnly.of(!0)]},d=[...l];this.bIsEditable?d.push(u):d.push(Ci.EditorView.editable.of(!1),Ul.EditorState.readOnly.of(!0));let h={doc:o,extensions:d};s.addClasses(["cm-s-obsidian","mod-cm6","markdown-source-view","cm-content"]);let p=this.plugin.gitManager instanceof Se&&(this.state.bRef===void 0||this.state.bRef==="");this.mergeView=new Eh({b:h,a:f,collapseUnchanged:{minSize:6,margin:4},renderRevertControl:p?()=>this.renderButtons():void 0,revertControls:p?"a-to-b":void 0,diffConfig:{scanLimit:this.bIsEditable?1e3:1e4},parent:s}),this.refreshing=!1}}};m();var U$=require("obsidian");m();m();m();var KP="5";var QP,JP,eR;typeof window!="undefined"&&((eR=(JP=(QP=window.__svelte)!=null?QP:window.__svelte={}).v)!=null?eR:JP.v=new Set).add(KP);m();m();m();var jl="[",Ba="[!",Bw="[?",Ha="]",is={};var Ze=Symbol(),Ti=Symbol("filename"),tR=Symbol("hmr"),Dh="http://www.w3.org/1999/xhtml";m();m();m();m();var Oh=!0;m();var I=!1;m();var ns=Array.isArray,rR=Array.prototype.indexOf,Yi=Array.prototype.includes,Vl=Array.from,Hw=Object.keys,or=Object.defineProperty,Ur=Object.getOwnPropertyDescriptor,Uw=Object.getOwnPropertyDescriptors,Gw=Object.prototype,iR=Array.prototype,zl=Object.getPrototypeOf,jw=Object.isExtensible;function Vw(t){return typeof t=="function"}var lr=()=>{};function Lh(t){for(var e=0;e<t.length;e++)t[e]()}function Nh(){var t,e,r=new Promise((i,n)=>{t=i,e=n});return{promise:r,resolve:t,reject:e}}m();m();var Jt=Symbol("$state"),Lu=Symbol("legacy props"),sR=Symbol(""),Bh=Symbol("proxy path"),zw=Symbol("hmr anchor"),ri=new class extends Error{constructor(){super(...arguments);Ve(this,"name","StaleReactionError");Ve(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},nR,Ww=!!((nR=globalThis.document)!=null&&nR.contentType)&&globalThis.document.contentType.includes("xml");var Wl=3,Pi=8;m();m();function aR(t){if(I){let e=new Error(`invariant_violation
|
||||
`;await this.plugin.gitManager.applyPatch(h),this.plugin.app.workspace.trigger("obsidian-git:refresh")},this.state.bRef==null){let s=i.createDiv();s.addClass("clickable-icon"),s.setAttr("aria-label","Reset hunk"),(0,ss.setIcon)(s,"undo"),s.onmousedown=a=>{var d;let o=this.mergeView.a,l=this.mergeView.b,c=Lw(l.state),u=(d=i.parentElement)==null?void 0:d.indexOf(i),f=c.chunks[u];if(f){let h=f.fromA,p=f.toA,g=f.fromB,v=f.toB,b=o.state.sliceDoc(h,Math.max(h,p-1));h!=p&&v<=l.state.doc.length&&(b+=o.state.lineBreak),l.dispatch({changes:{from:g,to:Math.min(l.state.doc.length,v),insert:b},userEvent:"revert"})}}}return i.onmousedown=s=>{s.preventDefault(),s.stopPropagation()},i}async createMergeView(){var r,i,n;if((r=this.state)!=null&&r.aFile&&((i=this.state)!=null&&i.bFile)&&!this.refreshing&&this.plugin.gitManager){this.refreshing=!0,(n=this.mergeView)==null||n.destroy();let s=this.containerEl.children[1];s.empty(),this.contentEl.addClass("git-split-diff-view","git-diff"),this.bIsEditable=await this.bShouldBeEditable();let a=await this.gitShow(this.state.aRef,this.state.aFile),o;if(this.state.bRef!=null)o=await this.gitShow(this.state.bRef,this.state.bFile);else{let p=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);await this.app.vault.adapter.exists(p)?o=await this.app.vault.adapter.read(p):o=""}let l=[(0,Qi.lineNumbers)(),(0,sp.highlightSelectionMatches)(),(0,Qi.drawSelection)(),Qi.keymap.of([...zl.standardKeymap,zl.indentWithTab]),(0,zl.history)(),(0,sp.search)(),Qi.EditorView.lineWrapping,EP],c=Qi.ViewPlugin.define(p=>({update:g=>{if(g.docChanged&&!g.transactions.some(v=>v.annotation(Vl.Transaction.remote))){let v=p.state.doc.toString();this.fileSaveDebouncer(v)}}})),u={doc:a,extensions:[...l,Vl.EditorState.readOnly.of(!0),SP]},f=[...l];this.bIsEditable?f.push(c):f.push(Vl.EditorState.readOnly.of(!0),SP);let d={doc:o,extensions:f};s.addClasses(["cm-s-obsidian","mod-cm6","markdown-source-view","cm-content"]);let h=this.plugin.gitManager instanceof ke&&(this.state.bRef===void 0||this.state.bRef==="");this.mergeView=new Gh({b:d,a:u,collapseUnchanged:{minSize:6,margin:4},renderRevertControl:h?()=>this.renderButtons(s):void 0,revertControls:h?"a-to-b":void 0,diffConfig:{timeout:z4(this.plugin.settings.diffTimeout,this.bIsEditable)},parent:s}),this.refreshing=!1}}};m();var p$=require("obsidian");m();m();m();var kP,CP,AP;typeof window!="undefined"&&((AP=(CP=(kP=window.__svelte)!=null?kP:window.__svelte={}).v)!=null?AP:CP.v=new Set).add("5");m();m();m();var as={};var Qe=Symbol("uninitialized"),Fi=Symbol("filename");var ap="http://www.w3.org/1999/xhtml";m();m();m();m();var op=!0;m();var O=!1;m();var os=Array.isArray,TP=Array.prototype.indexOf,Xs=Array.prototype.includes,Wl=Array.from,l0=Object.keys,fr=Object.defineProperty,qr=Object.getOwnPropertyDescriptor,c0=Object.getOwnPropertyDescriptors,u0=Object.prototype,PP=Array.prototype,ql=Object.getPrototypeOf,f0=Object.isExtensible;function d0(t){return typeof t=="function"}var dr=()=>{};function lp(t){for(var e=0;e<t.length;e++)t[e]()}function cp(){var t,e,r=new Promise((i,n)=>{t=i,e=n});return{promise:r,resolve:t,reject:e}}m();m();var rr=Symbol("$state"),Qu=Symbol("legacy props"),$P=Symbol(""),up=Symbol("proxy path"),fp=Symbol("attributes"),Ju=Symbol("class"),h0=Symbol("style"),ef=Symbol("text"),Ya=Symbol("form reset"),p0=Symbol("hmr anchor"),ls=new class extends Error{constructor(){super(...arguments);Ue(this,"name","StaleReactionError");Ue(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},RP,m0=!!((RP=globalThis.document)!=null&&RP.contentType)&&globalThis.document.contentType.includes("xml");var Yl=3,Ii=8;m();m();function FP(t){if(O){let e=new Error(`invariant_violation
|
||||
An invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app \u2014 please open an issue at https://github.com/sveltejs/svelte, citing the following message: "${t}"
|
||||
https://svelte.dev/e/invariant_violation`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/invariant_violation")}function Hh(t){if(I){let e=new Error(`lifecycle_outside_component
|
||||
https://svelte.dev/e/invariant_violation`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/invariant_violation")}function dp(t){if(O){let e=new Error(`lifecycle_outside_component
|
||||
\`${t}(...)\` can only be used during component initialisation
|
||||
https://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function lR(){if(I){let t=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/async_derived_orphan")}function qw(){if(I){let t=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function cR(){if(I){let t=new Error(`derived_references_self
|
||||
https://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function MP(){if(O){let t=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/async_derived_orphan")}function g0(){if(O){let t=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function DP(){if(O){let t=new Error(`derived_references_self
|
||||
A derived value cannot reference itself recursively
|
||||
https://svelte.dev/e/derived_references_self`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/derived_references_self")}function Yw(t,e,r){if(I){let i=new Error(`each_key_duplicate
|
||||
https://svelte.dev/e/derived_references_self`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/derived_references_self")}function v0(t,e,r){if(O){let i=new Error(`each_key_duplicate
|
||||
${r?`Keyed each block has duplicate key \`${r}\` at indexes ${t} and ${e}`:`Keyed each block has duplicate key at indexes ${t} and ${e}`}
|
||||
https://svelte.dev/e/each_key_duplicate`);throw i.name="Svelte error",i}else throw new Error("https://svelte.dev/e/each_key_duplicate")}function uR(t,e,r){if(I){let i=new Error(`each_key_volatile
|
||||
https://svelte.dev/e/each_key_duplicate`);throw i.name="Svelte error",i}else throw new Error("https://svelte.dev/e/each_key_duplicate")}function OP(t,e,r){if(O){let i=new Error(`each_key_volatile
|
||||
Keyed each block has key that is not idempotent \u2014 the key for item at index ${t} was \`${e}\` but is now \`${r}\`. Keys must be the same each time for a given item
|
||||
https://svelte.dev/e/each_key_volatile`);throw i.name="Svelte error",i}else throw new Error("https://svelte.dev/e/each_key_volatile")}function fR(t){if(I){let e=new Error(`effect_in_teardown
|
||||
https://svelte.dev/e/each_key_volatile`);throw i.name="Svelte error",i}else throw new Error("https://svelte.dev/e/each_key_volatile")}function LP(t){if(O){let e=new Error(`effect_in_teardown
|
||||
\`${t}\` cannot be used inside an effect cleanup function
|
||||
https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function dR(){if(I){let t=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function hR(t){if(I){let e=new Error(`effect_orphan
|
||||
https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function NP(){if(O){let t=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function BP(t){if(O){let e=new Error(`effect_orphan
|
||||
\`${t}\` can only be used inside an effect (e.g. during component initialisation)
|
||||
https://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_orphan")}function pR(){if(I){let t=new Error(`effect_update_depth_exceeded
|
||||
https://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_orphan")}function HP(){if(O){let t=new Error(`effect_update_depth_exceeded
|
||||
Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
|
||||
https://svelte.dev/e/effect_update_depth_exceeded`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function mR(){if(I){let t=new Error(`hydration_failed
|
||||
https://svelte.dev/e/effect_update_depth_exceeded`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function UP(){if(O){let t=new Error(`hydration_failed
|
||||
Failed to hydrate the application
|
||||
https://svelte.dev/e/hydration_failed`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/hydration_failed")}function gR(t){if(I){let e=new Error(`props_invalid_value
|
||||
https://svelte.dev/e/hydration_failed`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/hydration_failed")}function GP(t){if(O){let e=new Error(`props_invalid_value
|
||||
Cannot do \`bind:${t}={undefined}\` when \`${t}\` has a fallback value
|
||||
https://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_invalid_value")}function vR(t){if(I){let e=new Error(`rune_outside_svelte
|
||||
https://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_invalid_value")}function jP(t){if(O){let e=new Error(`rune_outside_svelte
|
||||
The \`${t}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
|
||||
https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function wR(){if(I){let t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function _R(){if(I){let t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function bR(){if(I){let t=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function yR(){if(I){let t=new Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}m();m();m();var Sn="font-weight: bold",kn="font-weight: normal";function xR(t){I?console.warn(`%c[svelte] await_reactivity_loss
|
||||
https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function VP(){if(O){let t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function zP(){if(O){let t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function WP(){if(O){let t=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function qP(){if(O){let t=new Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}m();m();m();var Rn="font-weight: bold",$n="font-weight: normal";function YP(t){O?console.warn(`%c[svelte] await_reactivity_loss
|
||||
%cDetected reactivity loss when reading \`${t}\`. This happens when state is read in an async function after an earlier \`await\`
|
||||
https://svelte.dev/e/await_reactivity_loss`,Sn,kn):console.warn("https://svelte.dev/e/await_reactivity_loss")}function ER(t,e){I?console.warn(`%c[svelte] await_waterfall
|
||||
https://svelte.dev/e/await_reactivity_loss`,Rn,$n):console.warn("https://svelte.dev/e/await_reactivity_loss")}function ZP(t,e){O?console.warn(`%c[svelte] await_waterfall
|
||||
%cAn async derived, \`${t}\` (${e}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app
|
||||
https://svelte.dev/e/await_waterfall`,Sn,kn):console.warn("https://svelte.dev/e/await_waterfall")}function SR(){I?console.warn(`%c[svelte] derived_inert
|
||||
https://svelte.dev/e/await_waterfall`,Rn,$n):console.warn("https://svelte.dev/e/await_waterfall")}function KP(){O?console.warn(`%c[svelte] derived_inert
|
||||
%cReading a derived belonging to a now-destroyed effect may result in stale values
|
||||
https://svelte.dev/e/derived_inert`,Sn,kn):console.warn("https://svelte.dev/e/derived_inert")}function kR(t,e,r){I?console.warn(`%c[svelte] hydration_attribute_changed
|
||||
https://svelte.dev/e/derived_inert`,Rn,$n):console.warn("https://svelte.dev/e/derived_inert")}function XP(t,e,r){O?console.warn(`%c[svelte] hydration_attribute_changed
|
||||
%cThe \`${t}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${r}\`, will be ignored in favour of the server value
|
||||
https://svelte.dev/e/hydration_attribute_changed`,Sn,kn):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function Ua(t){I?console.warn(`%c[svelte] hydration_mismatch
|
||||
https://svelte.dev/e/hydration_attribute_changed`,Rn,$n):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function Za(t){O?console.warn(`%c[svelte] hydration_mismatch
|
||||
%c${t?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${t}`:"Hydration failed because the initial UI does not match what was rendered on the server"}
|
||||
https://svelte.dev/e/hydration_mismatch`,Sn,kn):console.warn("https://svelte.dev/e/hydration_mismatch")}function AR(){I?console.warn(`%c[svelte] lifecycle_double_unmount
|
||||
https://svelte.dev/e/hydration_mismatch`,Rn,$n):console.warn("https://svelte.dev/e/hydration_mismatch")}function QP(){O?console.warn(`%c[svelte] lifecycle_double_unmount
|
||||
%cTried to unmount a component that was not mounted
|
||||
https://svelte.dev/e/lifecycle_double_unmount`,Sn,kn):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function Uh(t){I?console.warn(`%c[svelte] state_proxy_equality_mismatch
|
||||
https://svelte.dev/e/lifecycle_double_unmount`,Rn,$n):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function hp(t){O?console.warn(`%c[svelte] state_proxy_equality_mismatch
|
||||
%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${t}\` will produce unexpected results
|
||||
https://svelte.dev/e/state_proxy_equality_mismatch`,Sn,kn):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function CR(){I?console.warn(`%c[svelte] state_proxy_unmount
|
||||
https://svelte.dev/e/state_proxy_equality_mismatch`,Rn,$n):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function JP(){O?console.warn(`%c[svelte] state_proxy_unmount
|
||||
%cTried to unmount a state proxy, rather than a component
|
||||
https://svelte.dev/e/state_proxy_unmount`,Sn,kn):console.warn("https://svelte.dev/e/state_proxy_unmount")}function TR(){I?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",Sn,kn):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function PR(t){I?console.warn(`%c[svelte] transition_slide_display
|
||||
https://svelte.dev/e/state_proxy_unmount`,Rn,$n):console.warn("https://svelte.dev/e/state_proxy_unmount")}function eR(){O?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",Rn,$n):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function tR(t){O?console.warn(`%c[svelte] transition_slide_display
|
||||
%cThe \`slide\` transition does not work correctly for elements with \`display: ${t}\`
|
||||
https://svelte.dev/e/transition_slide_display`,Sn,kn):console.warn("https://svelte.dev/e/transition_slide_display")}var ie=!1;function Ft(t){ie=t}var me;function Ue(t){if(t===null)throw Ua(),is;return me=t}function cr(){return Ue(tr(me))}function G(t){if(ie){if(tr(me)!==null)throw Ua(),is;me=t}}function Ga(t=1){if(ie){for(var e=t,r=me;e--;)r=tr(r);me=r}}function An(t=!0){for(var e=0,r=me;;){if(r.nodeType===Pi){var i=r.data;if(i===Ha){if(e===0)return r;e-=1}else(i===jl||i===Ba||i[0]==="["&&!isNaN(Number(i.slice(1))))&&(e+=1)}var n=tr(r);t&&r.remove(),r=n}}function Nu(t){if(!t||t.nodeType!==Pi)throw Ua(),is;return t.data}m();m();m();m();function Gh(t){return t===this.v}function Xw(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function jh(t){return!Xw(t,this.v)}m();var kt=!1,ss=!1,Xi=!1;m();m();m();var Bu=null;function ur(t,e){return t.label=e,zh(t.v,e),t}function zh(t,e){var r;return(r=t==null?void 0:t[Bh])==null||r.call(t,e),t}m();function Ki(t){let e=new Error,r=Y5();return r.length===0?null:(r.unshift(`
|
||||
`),or(e,"stack",{value:r.join(`
|
||||
`)}),or(e,"name",{value:t}),e)}function Y5(){let t=Error.stackTraceLimit;Error.stackTraceLimit=1/0;let e=new Error().stack;if(Error.stackTraceLimit=t,!e)return[];let r=e.split(`
|
||||
`),i=[];for(let n=0;n<r.length;n++){let s=r[n],a=s.replaceAll("\\","/");if(s.trim()!=="Error"){if(s.includes("validate_each_keys"))return[];a.includes("svelte/src/internal")||a.includes("node_modules/.vite")||i.push(s)}}return i}function $R(t,e){if(!I)throw new Error("invariant(...) was not guarded by if (DEV)");t||aR(e)}m();var ye=null;function as(t){ye=t}var Cn=null;function ql(t){Cn=t}var Qi=null;function Wh(t){Qi=t}function lt(t,e=!1,r){ye={p:ye,i:!1,c:null,e:null,s:t,x:null,r:Z,l:ss&&!e?{s:null,u:null,$:[]}:null},I&&(ye.function=r,Qi=r)}function ct(t){var n;var e=ye,r=e.e;if(r!==null){e.e=null;for(var i of r)Zw(i)}return t!==void 0&&(e.x=t),e.i=!0,ye=e.p,I&&(Qi=(n=ye==null?void 0:ye.function)!=null?n:null),t!=null?t:{}}function Tn(){return!ss||ye!==null&&ye.l===null}m();m();var ja=[];function FR(){var t=ja;ja=[],Lh(t)}function It(t){if(ja.length===0&&!Va){var e=ja;queueMicrotask(()=>{e===ja&&FR()})}ja.push(t)}function IR(){for(;ja.length>0;)FR()}m();var Kw=new WeakMap;function qh(t){var e=Z;if(e===null)return oe.f|=8388608,t;if(I&&t instanceof Error&&!Kw.has(t)&&Kw.set(t,X5(t,e)),!(e.f&32768)&&!(e.f&4))throw I&&!e.parent&&t instanceof Error&&MR(t),t;Ri(t,e)}function Ri(t,e){for(;e!==null;){if(e.f&128){if(!(e.f&32768))throw t;try{e.b.error(t);return}catch(r){t=r}}e=e.parent}throw I&&t instanceof Error&&MR(t),t}function X5(t,e){var a,o,l;let r=Ur(t,"message");if(!(r&&!r.configurable)){for(var i=Uu?" ":" ",n=`
|
||||
https://svelte.dev/e/transition_slide_display`,Rn,$n):console.warn("https://svelte.dev/e/transition_slide_display")}var se=!1;function Lt(t){se=t}var we;function We(t){if(t===null)throw Za(),as;return we=t}function hr(){return We(nr(we))}function G(t){if(se){if(nr(we)!==null)throw Za(),as;we=t}}function Ka(t=1){if(se){for(var e=t,r=we;e--;)r=nr(r);we=r}}function Fn(t=!0){for(var e=0,r=we;;){if(r.nodeType===Ii){var i=r.data;if(i==="]"){if(e===0)return r;e-=1}else(i==="["||i==="[!"||i[0]==="["&&!isNaN(Number(i.slice(1))))&&(e+=1)}var n=nr(r);t&&r.remove(),r=n}}function rf(t){if(!t||t.nodeType!==Ii)throw Za(),as;return t.data}m();m();m();m();function pp(t){return t===this.v}function w0(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function mp(t){return!w0(t,this.v)}m();var Ft=!1,cs=!1,Ji=!1;m();m();m();var nf=null;function pr(t,e){return t.label=e,vp(t.v,e),t}function vp(t,e){var r;return(r=t==null?void 0:t[up])==null||r.call(t,e),t}m();function en(t){let e=new Error,r=q4();return r.length===0?null:(r.unshift(`
|
||||
`),fr(e,"stack",{value:r.join(`
|
||||
`)}),fr(e,"name",{value:t}),e)}function q4(){let t=Error.stackTraceLimit;Error.stackTraceLimit=1/0;let e=new Error().stack;if(Error.stackTraceLimit=t,!e)return[];let r=e.split(`
|
||||
`),i=[];for(let n=0;n<r.length;n++){let s=r[n],a=s.replaceAll("\\","/");if(s.trim()!=="Error"){if(s.includes("validate_each_keys"))return[];a.includes("svelte/src/internal")||a.includes("node_modules/.vite")||i.push(s)}}return i}function iR(t,e){if(!O)throw new Error("invariant(...) was not guarded by if (DEV)");t||FP(e)}m();var Ee=null;function us(t){Ee=t}var In=null;function Xl(t){In=t}var tn=null;function wp(t){tn=t}function ht(t,e=!1,r){Ee={p:Ee,i:!1,c:null,e:null,s:t,x:null,r:ee,l:cs&&!e?{s:null,u:null,$:[]}:null},O&&(Ee.function=r,tn=r)}function pt(t){var n;var e=Ee,r=e.e;if(r!==null){e.e=null;for(var i of r)b0(i)}return t!==void 0&&(e.x=t),e.i=!0,Ee=e.p,O&&(tn=(n=Ee==null?void 0:Ee.function)!=null?n:null),t!=null?t:{}}function Mn(){return!cs||Ee!==null&&Ee.l===null}m();m();var Xa=[];function nR(){var t=Xa;Xa=[],lp(t)}function At(t){if(Xa.length===0&&!Qa){var e=Xa;queueMicrotask(()=>{e===Xa&&nR()})}Xa.push(t)}function sR(){for(;Xa.length>0;)nR()}m();var _0=new WeakMap;function bp(t){var e=ee;if(e===null)return oe.f|=8388608,t;if(O&&t instanceof Error&&!_0.has(t)&&_0.set(t,Y4(t,e)),(e.f&32768)===0&&(e.f&4)===0)throw O&&!e.parent&&t instanceof Error&&aR(t),t;nn(t,e)}function nn(t,e){if(!(e!==null&&(e.f&16384)!==0)){for(;e!==null;){if((e.f&128)!==0){if((e.f&32768)===0)throw t;try{e.b.error(t);return}catch(r){t=r}}e=e.parent}throw O&&t instanceof Error&&aR(t),t}}function Y4(t,e){var a,o,l;let r=qr(t,"message");if(!(r&&!r.configurable)){for(var i=af?" ":" ",n=`
|
||||
${i}in ${((a=e.fn)==null?void 0:a.name)||"<unknown>"}`,s=e.ctx;s!==null;)n+=`
|
||||
${i}in ${(o=s.function)==null?void 0:o[Ti].split("/").pop()}`,s=s.p;return{message:t.message+`
|
||||
${i}in ${(o=s.function)==null?void 0:o[Fi].split("/").pop()}`,s=s.p;return{message:t.message+`
|
||||
${n}
|
||||
`,stack:(l=t.stack)==null?void 0:l.split(`
|
||||
`).filter(c=>!c.includes("svelte/src/internal")).join(`
|
||||
`)}}}function MR(t){let e=Kw.get(t);e&&(or(t,"message",{value:e.message}),or(t,"stack",{value:e.stack}))}m();m();var Z5=-7169;function Ge(t,e){t.f=t.f&Z5|e}function Yl(t){t.f&512||t.deps===null?Ge(t,1024):Ge(t,4096)}function DR(t){if(t!==null)for(let e of t)!(e.f&2)||!(e.f&65536)||(e.f^=65536,DR(e.deps))}function Yh(t,e,r){t.f&2048?e.add(t):t.f&4096&&r.add(t),DR(t.deps),Ge(t,1024)}m();m();m();var OR=!1,Xh=!1,UZ=Symbol();function Qw(t){var e=Xh;try{return Xh=!1,[t(),Xh]}finally{Xh=e}}m();var Pn=new Set,le=null,ju=null,Ct=null,e0=null,Va=!1,Jw=!1,qa=null,Gu=null,LR=0,J5=I?new Set:null,e4=1,Zl,Kl,Ya,ls,Rn,Vu,Gr,zu,Vs,cs,$n,Ql,Jl,zs,yt,Zh,BR,Kh,t0,Qh,HR,Jh=class Jh{constructor(){pe(this,yt);Ve(this,"id",e4++);Ve(this,"current",new Map);Ve(this,"previous",new Map);pe(this,Zl,new Set);pe(this,Kl,new Set);pe(this,Ya,new Set);pe(this,ls,new Map);pe(this,Rn,new Map);pe(this,Vu,null);pe(this,Gr,[]);pe(this,zu,[]);pe(this,Vs,new Set);pe(this,cs,new Set);pe(this,$n,new Map);pe(this,Ql,new Set);Ve(this,"is_fork",!1);pe(this,Jl,!1);pe(this,zs,new Set)}skip_effect(e){R(this,$n).has(e)||R(this,$n).set(e,{d:[],m:[]}),R(this,Ql).delete(e)}unskip_effect(e,r=i=>this.schedule(i)){var i=R(this,$n).get(e);if(i){R(this,$n).delete(e);for(var n of i.d)Ge(n,2048),r(n);for(n of i.m)Ge(n,4096),r(n)}R(this,Ql).add(e)}capture(e,r,i=!1){e.v!==Ze&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[r,i]),Ct==null||Ct.set(e,r)),this.is_fork||(e.v=r)}activate(){le=this}deactivate(){le=null,Ct=null}flush(){var e=I?new Set:null;try{Jw=!0,le=this,Me(this,yt,Kh).call(this)}finally{if(LR=0,e0=null,qa=null,Gu=null,Jw=!1,le=null,Ct=null,us.clear(),I)for(let r of e)r.updated=null}}discard(){for(let e of R(this,Kl))e(this);R(this,Kl).clear(),R(this,Ya).clear(),Pn.delete(this)}register_created_effect(e){R(this,zu).push(e)}increment(e,r){var n,s;let i=(n=R(this,ls).get(r))!=null?n:0;if(R(this,ls).set(r,i+1),e){let a=(s=R(this,Rn).get(r))!=null?s:0;R(this,Rn).set(r,a+1)}}decrement(e,r,i){var s,a;let n=(s=R(this,ls).get(r))!=null?s:0;if(n===1?R(this,ls).delete(r):R(this,ls).set(r,n-1),e){let o=(a=R(this,Rn).get(r))!=null?a:0;o===1?R(this,Rn).delete(r):R(this,Rn).set(r,o-1)}R(this,Jl)||i||(we(this,Jl,!0),It(()=>{we(this,Jl,!1),this.flush()}))}transfer_effects(e,r){for(let i of e)R(this,Vs).add(i);for(let i of r)R(this,cs).add(i);e.clear(),r.clear()}oncommit(e){R(this,Zl).add(e)}ondiscard(e){R(this,Kl).add(e)}on_fork_commit(e){R(this,Ya).add(e)}run_fork_commit_callbacks(){for(let e of R(this,Ya))e(this);R(this,Ya).clear()}settled(){var e;return((e=R(this,Vu))!=null?e:we(this,Vu,Nh())).promise}static ensure(){if(le===null){let e=le=new Jh;Jw||(Pn.add(le),Va||It(()=>{le===e&&e.flush()}))}return le}apply(){if(!kt||!this.is_fork&&Pn.size===1){Ct=null;return}Ct=new Map;for(let[i,[n]]of this.current)Ct.set(i,n);for(let i of Pn)if(!(i===this||i.is_fork)){var e=!1,r=!1;if(i.id<this.id)for(let[n,[,s]]of i.current)s||(e||(e=this.current.has(n)),r||(r=!this.current.has(n)));if(e&&r)R(this,zs).add(i);else for(let[n,s]of i.previous)Ct.has(n)||Ct.set(n,s)}}schedule(e){var n;if(e0=e,(n=e.b)!=null&&n.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var r=e;r.parent!==null;){r=r.parent;var i=r.f;if(qa!==null&&r===Z&&(kt||(oe===null||!(oe.f&2))&&!OR))return;if(i&96){if(!(i&1024))return;r.f^=1024}}R(this,Gr).push(r)}};Zl=new WeakMap,Kl=new WeakMap,Ya=new WeakMap,ls=new WeakMap,Rn=new WeakMap,Vu=new WeakMap,Gr=new WeakMap,zu=new WeakMap,Vs=new WeakMap,cs=new WeakMap,$n=new WeakMap,Ql=new WeakMap,Jl=new WeakMap,zs=new WeakMap,yt=new WeakSet,Zh=function(){return this.is_fork||R(this,Rn).size>0},BR=function(){for(let i of R(this,zs))for(let n of R(i,Rn).keys()){for(var e=!1,r=n;r.parent!==null;){if(R(this,$n).has(r)){e=!0;break}r=r.parent}if(!e)return!0}return!1},Kh=function(){var o,l;if(LR++>1e3&&(Pn.delete(this),t4()),!Me(this,yt,Zh).call(this)){for(let c of R(this,Vs))R(this,cs).delete(c),Ge(c,2048),this.schedule(c);for(let c of R(this,cs))Ge(c,4096),this.schedule(c)}let e=R(this,Gr);we(this,Gr,[]),this.apply();var r=qa=[],i=[],n=Gu=[];for(let c of e)try{Me(this,yt,t0).call(this,c,r,i)}catch(u){throw jR(c),u}if(le=null,n.length>0){var s=Jh.ensure();for(let c of n)s.schedule(c)}if(qa=null,Gu=null,Me(this,yt,Zh).call(this)||Me(this,yt,BR).call(this)){Me(this,yt,Qh).call(this,i),Me(this,yt,Qh).call(this,r);for(let[c,u]of R(this,$n))GR(c,u)}else{R(this,ls).size===0&&Pn.delete(this),R(this,Vs).clear(),R(this,cs).clear();for(let c of R(this,Zl))c(this);R(this,Zl).clear(),ju=this,NR(i),NR(r),ju=null,(o=R(this,Vu))==null||o.resolve()}var a=le;if(R(this,Gr).length>0){let c=a!=null?a:a=this;R(c,Gr).push(...R(this,Gr).filter(u=>!R(c,Gr).includes(u)))}if(a!==null){if(Pn.add(a),I)for(let c of this.current.keys())J5.add(c);Me(l=a,yt,Kh).call(l)}kt&&!Pn.has(this)&&Me(this,yt,HR).call(this)},t0=function(e,r,i){e.f^=1024;for(var n=e.first;n!==null;){var s=n.f,a=(s&96)!==0,o=a&&(s&1024)!==0,l=o||(s&8192)!==0||R(this,$n).has(n);if(!l&&n.fn!==
Line truncated
|
||||
`).some(l=>l.startsWith("https://svelte.dev/e/")))throw o;return o!==is&&console.warn("Failed to hydrate: ",o),e.recover===!1&&mR(),cp(),sc(r),Ft(!1),Xs(t,e)}finally{Ft(i),Ue(n)}}var vp=new Map;function S$(t,{target:e,anchor:r,props:i={},events:n,context:s,intro:a=!0,transformError:o}){cp();var l=void 0,c=c$(()=>{var u=r!=null?r:e.appendChild(Lt());l0(u,{pending:()=>{}},h=>{lt({});var p=ye;if(s&&(p.c=s),n&&(i.$$events=n),ie&&Nn(h,null),wp=a,l=t(h,i)||{},wp=!0,ie&&(Z.nodes.end=me,me===null||me.nodeType!==Pi||me.data!==Ha))throw Ua(),is;ct()},o);var f=new Set,d=h=>{for(var p=0;p<h.length;p++){var g=h[p];if(!f.has(g)){f.add(g);var v=E$(g);for(let S of[e,document]){var _=vp.get(S);_===void 0&&(_=new Map,vp.set(S,_));var b=_.get(g);b===void 0?(S.addEventListener(g,gp,{passive:v}),_.set(g,1)):_.set(g,b+1)}}}};return d(Vl(E0)),mp.add(d),()=>{var v;for(var h of f)for(let _ of[e,document]){var p=vp.get(_),g=p.get(h);--g==0?(_.removeEventListener(h,gp),p.delete(h),p.size===0&&vp.delete(_)):p.set(h,g)}mp.delete(d),u!==r&&((v=u.parentNode)==null||v.removeChild(u))}});return C0.set(l,c),l}var C0=new WeakMap;function ds(t,e){let r=C0.get(t);return r?(C0.delete(t),r(e)):(I&&(Jt in t?CR():AR()),Promise.resolve())}m();m();m();var rn,Bn,di,lo,tf,rf,_p,hs=class{constructor(e,r=!0){Ve(this,"anchor");pe(this,rn,new Map);pe(this,Bn,new Map);pe(this,di,new Map);pe(this,lo,new Set);pe(this,tf,!0);pe(this,rf,e=>{if(R(this,rn).has(e)){var r=R(this,rn).get(e),i=R(this,Bn).get(r);if(i)ef(i),R(this,lo).delete(r);else{var n=R(this,di).get(r);n&&(R(this,Bn).set(r,n.effect),R(this,di).delete(r),I&&(n.fragment.lastChild[zw]=this.anchor),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(let[s,a]of R(this,rn)){if(R(this,rn).delete(s),s===e)break;let o=R(this,di).get(a);o&&(mt(o.effect),R(this,di).delete(a))}for(let[s,a]of R(this,Bn)){if(s===r||R(this,lo).has(s))continue;let o=()=>{if(Array.from(R(this,rn).values()).includes(s)){var c=document.createDocumentFragment();rc(a,c),c.append(Lt()),R(this,di).set(s,{effect:a,fragment:c})}else mt(a);R(this,lo).delete(s),R(this,Bn).delete(s)};R(this,tf)||!i?(R(this,lo).add(s),Mn(a,o,!1)):o()}}});pe(this,_p,e=>{R(this,rn).delete(e);let r=Array.from(R(this,rn).values());for(let[i,n]of R(this,di))r.includes(i)||(mt(n.effect),R(this,di).delete(i))});this.anchor=e,we(this,tf,r)}ensure(e,r){var i=le,n=up();if(r&&!R(this,Bn).has(e)&&!R(this,di).has(e))if(n){var s=document.createDocumentFragment(),a=Lt();s.append(a),R(this,di).set(e,{effect:qt(()=>r(a)),fragment:s})}else R(this,Bn).set(e,qt(()=>r(this.anchor)));if(R(this,rn).set(i,e),n){for(let[o,l]of R(this,Bn))o===e?i.unskip_effect(l):i.skip_effect(l);for(let[o,l]of R(this,di))o===e?i.unskip_effect(l.effect):i.skip_effect(l.effect);i.oncommit(R(this,rf)),i.ondiscard(R(this,_p))}else ie&&(this.anchor=me),R(this,rf).call(this,i)}};rn=new WeakMap,Bn=new WeakMap,di=new WeakMap,lo=new WeakMap,tf=new WeakMap,rf=new WeakMap,_p=new WeakMap;if(I){let t=function(e){if(!(e in globalThis)){let r;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(r!==void 0)return r;vR(e)},set:i=>{r=i}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function co(t){ye===null&&Hh("onMount"),ss&&ye.l!==null?y4(ye).m.push(t):mr(()=>{let e=We(t);if(typeof e=="function")return e})}function y4(t){var r;var e=t.l;return(r=e.u)!=null?r:e.u={a:[],b:[],m:[]}}m();m();var C$=new Map;function T$(t,e){var r=C$.get(t);r||(r=new Set,C$.set(t,r)),r.add(e)}m();m();m();m();m();m();m();m();m();function Re(t,e,r=!1){var i;ie&&(i=me,cr());var n=new hs(t),s=r?65536:0;function a(o,l){if(ie){var c=Nu(i);if(o!==parseInt(c.substring(1))){var u=An();Ue(u),n.anchor=u,Ft(!1),n.ensure(o,l),Ft(!0);return}}n.ensure(o,l)}oi(()=>{var o=!1;e((l,c=0)=>{o=!0,a(c,l)}),o||a(-1,null)},s)}m();var $ie=Symbol("NaN");m();m();function hi(t,e){return e}function T4(t,e,r){var f;for(var i=[],n=e.length,s,a=e.length,o=0;o<n;o++){let d=e[o];Mn(d,()=>{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var h=t.outrogroups;P0(t,Vl(s.done)),h.delete(s),h.size===0&&(t.outrogroups=null)}}else a-=1},!1)}if(a===0){var l=i.length===0&&r!==null;if(l){var c=r,u=c.parentNode;sc(u),u.append(c),t.items.clear()}P0(t,e,!l)}else s={pending:new Set(e),done:new Set},((f=t.outrogroups)!=null?f:t.outrogroups=new Set).add(s)}function P0(t,e,r=!0){var i;if(t.pending.size>0){i=new Set;for(let a of t.pending.values())for(let o of a)i.add(t.items.get(o).e)}for(var n=0;n<e.length;n++){var s=e[n];if(i!=null&&i.has(s)){s.f|=33554432;let a=document.createDocumentFragment();rc(s,a)}else mt(e[n],r)}}var ac;function pi(t,e,r,i,n,s=null){var a=t,o=new Map,l=(e&4)!==0;if(l){var c=t;a=ie?Ue(sr(c)):c.appendChild(Lt())}ie&&cr();var u=null,f=to(()=>{var S=r();return ns(S)?S:S==null?[]:Vl(S)});I&&ur(f,"{#each ...}");var d,h=new Map,p=!0;function g(S){b.effect.f&16384||(b.pending.delete(S),b.fallback=u,P4(b,d,a,e,i),u!==null&&(d.length===0?u.f&33554432?(u.f^=33554432,sf(u,null,a)):ef(u):Mn(u
Line truncated
|
||||
\r\f\xA0\v\uFEFF`];function D$(t,e,r){var i=t==null?"":""+t;if(e&&(i=i?i+" "+e:e),r){for(var n of Object.keys(r))if(r[n])i=i?i+" "+n:n;else if(i.length)for(var s=n.length,a=0;(a=i.indexOf(n,a))>=0;){var o=a+s;(a===0||M$.includes(i[a-1]))&&(o===i.length||M$.includes(i[o]))?i=(a===0?"":i.substring(0,a))+i.substring(o+1):a=o}}return i===""?null:i}m();function gt(t,e,r,i,n,s){var a=t.__className;if(ie||a!==r||a===void 0){var o=D$(r,i,s);(!ie||o!==t.getAttribute("class"))&&(o==null?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o)),t.__className=r}else if(s&&n!==s)for(var l in s){var c=!!s[l];(n==null||c!==!!n[l])&&t.classList.toggle(l,c)}return s}m();m();var z4=Symbol("class"),W4=Symbol("style"),q4=Symbol("is custom element"),Y4=Symbol("is html"),X4=Ww?"link":"LINK";function xe(t,e,r,i){var n=Z4(t);if(ie&&(n[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName===X4)){i||Q4(t,e,r!=null?r:"");return}n[e]!==(n[e]=r)&&(e==="loading"&&(t[sR]=r),r==null?t.removeAttribute(e):typeof r!="string"&&K4(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function Z4(t){var e;return(e=t.__attributes)!=null?e:t.__attributes={[q4]:t.nodeName.includes("-"),[Y4]:t.namespaceURI===Dh}}var O$=new Map;function K4(t){var e=t.getAttribute("is")||t.nodeName,r=O$.get(e);if(r)return r;O$.set(e,r=[]);for(var i,n=t,s=Element.prototype;s!==n;){i=Uw(n);for(var a in i)i[a].set&&r.push(a);n=zl(n)}return r}function Q4(t,e,r){var i;I&&(e==="srcset"&&J4(t,r)||$0((i=t.getAttribute(e))!=null?i:"",r)||kR(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r)))}function $0(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function L$(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function J4(t,e){var r=L$(t.srcset),i=L$(e);return i.length===r.length&&i.every(([n,s],a)=>s===r[a][1]&&($0(r[a][0],n)||$0(n,r[a][0])))}m();m();m();function M0(t,e,r=e){var i=new WeakSet;_0(t,"input",async n=>{I&&t.type==="checkbox"&&qw();var s=n?t.defaultValue:t.value;if(s=F0(t)?I0(s):s,r(s),le!==null&&i.add(le),await pp(),s!==(s=e())){var a=t.selectionStart,o=t.selectionEnd,l=t.value.length;if(t.value=s!=null?s:"",o!==null){var c=t.value.length;a===o&&o===l&&c>l?(t.selectionStart=c,t.selectionEnd=c):(t.selectionStart=a,t.selectionEnd=Math.min(o,c))}}}),(ie&&t.defaultValue!==t.value||We(e)==null&&t.value)&&(r(F0(t)?I0(t.value):t.value),le!==null&&i.add(le)),nr(()=>{I&&t.type==="checkbox"&&qw();var n=e();if(t===document.activeElement){var s=kt?ju:le;if(i.has(s))return}F0(t)&&n===I0(t.value)||t.type==="date"&&!n&&!t.value||n!==t.value&&(t.value=n!=null?n:"")})}function F0(t){var e=t.type;return e==="number"||e==="range"}function I0(t){return t===""?null:+t}m();m();m();m();m();function B$(t,e){return t===e||(t==null?void 0:t[Jt])===e}function at(t={},e,r,i){var n=ye.r,s=Z;return qr(()=>{var a,o;return nr(()=>{a=o,o=(i==null?void 0:i())||[],We(()=>{t!==r(...o)&&(e(t,...o),a&&B$(r(...a),t)&&e(null,...a))})}),()=>{let l=s;for(;l!==n&&l.parent!==null&&l.parent.f&33554432;)l=l.parent;let c=()=>{o&&B$(r(...o),t)&&e(null,...o)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),t}m();m();m();m();m();m();function Di(t,e,r,i){var S,k;var n=!ss||(r&2)!==0,s=(r&8)!==0,a=(r&16)!==0,o=i,l=!0,c=()=>(l&&(l=!1,o=a?We(i):i),o);let u;if(s){var f=Jt in t||Lu in t;u=(k=(S=Ur(t,e))==null?void 0:S.set)!=null?k:f&&e in t?E=>t[e]=E:void 0}var d,h=!1;s?[d,h]=Qw(()=>t[e]):d=t[e],d===void 0&&i!==void 0&&(d=c(),u&&(n&&gR(e),u(d)));var p;if(n?p=()=>{var E=t[e];return E===void 0?c():(l=!0,E)}:p=()=>{var E=t[e];return E!==void 0&&(o=void 0),E===void 0?o:E},n&&!(r&4))return p;if(u){var g=t.$$legacy;return function(E,A){return arguments.length>0?((!n||!A||g||h)&&u(A?p():E),E):p()}}var v=!1,_=(r&1?eo:to)(()=>(v=!1,p()));I&&(_.label=e),s&&$(_);var b=Z;return function(E,A){if(arguments.length>0){let w=A?$(_):n&&s?Qe(E):E;return se(_,w),v=!0,o!==void 0&&(o=w),E}return li&&v||b.f&16384?_.v:$(_)}}m();m();m();function H$(t){return new O0(t)}var ps,Oi,O0=class{constructor(e){pe(this,ps);pe(this,Oi);var s,a;var r=new Map,i=(o,l)=>{var c=za(l,!1,!1);return r.set(o,c),c};let n=new Proxy({...e.props||{},$$events:{}},{get(o,l){var c;return $((c=r.get(l))!=null?c:i(l,Reflect.get(o,l)))},has(o,l){var c;return l===Lu?!0:($((c=r.get(l))!=null?c:i(l,Reflect.get(o,l))),Reflect.has(o,l))},set(o,l,c){var u;return se((u=r.get(l))!=null?u:i(l,c),c),Reflect.set(o,l,c)}});we(this,Oi,(e.hydrate?T0:Xs)(e.component,{target:e.target,anchor:e.anchor,props:n,context:e.context,intro:(s=e.intro)!=null?s:!1,recover:e.recover,transformError:e.transformError})),!kt&&(!((a=e==null?void 0:e.props)!=null&&a.$$host)||e.sync===!1)&&Za(),we(this,ps,n.$$events);for(let o of Object.keys(R(this,Oi)))o==="$set"||o==="$destroy"||o==="$on"||or(this,o,{get(){return R(this,Oi)[o]},set(l){R(this,Oi)[o]=l},enumerable:!0});R(this,Oi).$set=o=>{Object.assign(n,o)},R(this,Oi).$destroy=()=>{ds(R(this,Oi))}}$set(e){R(this,Oi).$set(e)}$on(e,r){R(this,ps)[e]=R(this,ps)[e]||[]
Line truncated
|
||||
`:""}${(x=e.log.author)==null?void 0:x.name}
|
||||
${(0,B0.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)}
|
||||
${e.log.message}`}]),de("click",u,()=>se(n,!$(n))),ce(t,o),ct()}Tt(["click"]);var PU=he('<div class="tree-item nav-folder mod-root"></div>'),RU=he('<main class="git-view"><div class="nav-header"><div class="nav-buttons-container"><div id="layoutChange" class="clickable-icon nav-action-button" aria-label="Change Layout"></div> <div id="refresh" data-icon="refresh-cw" aria-label="Refresh"></div></div></div> <div class="nav-files-container" style="position: relative;"><!> <div id="sentinel"></div> <div style="margin-bottom:40px"></div></div></main>'),$U={hash:"svelte-12n6twc",code:""};function G0(t,e){lt(e,!0),an(t,$U);let r=Di(e,"plugin",15),i=Oe(!1),n=Qe([]),s=Oe(void 0),a=Oe(Qe(r().settings.treeStructure)),o;mr(()=>{o&&o.empty()}),co(()=>{e.view.registerEvent(e.view.app.workspace.on("obsidian-git:head-change",()=>void c().catch(console.error)))}),mr(()=>{n.forEach(k=>(0,U0.setIcon)(k,k.getAttr("data-icon")))}),co(()=>{let k=new IntersectionObserver(A=>{A[0].isIntersecting&&!$(i)&&u().catch(console.error)}),E=activeDocument.querySelector("#sentinel");return E&&k.observe(E),()=>{k.disconnect()}}),c().catch(console.error);function l(){c().catch(console.error)}function c(){return uo(this,void 0,void 0,function*(){var k;if(!r().gitReady){se(s,void 0);return}se(i,!0);let E=r().gitManager instanceof Se,A;((k=$(s)===null||$(s)===void 0?void 0:$(s).length)!==null&&k!==void 0?k:0)==0?A=E?50:10:A=$(s).length,se(s,yield r().gitManager.log(void 0,!1,A),!0),se(i,!1)})}function u(){return uo(this,void 0,void 0,function*(){var k;if(!r().gitReady||$(s)===void 0)return;se(i,!0);let A=r().gitManager instanceof Se?50:10,w=yield r().gitManager.log(void 0,!1,A,(k=$(s).last())===null||k===void 0?void 0:k.hash);$(s).push(...w.slice(1)),se(i,!1)})}var f=RU(),d=j(f),h=j(d),p=j(h);at(p,k=>n[0]=k,()=>n==null?void 0:n[0]);var g=te(p,2);let v;at(g,k=>n[1]=k,()=>n==null?void 0:n[1]),G(h),G(d);var _=te(d,2),b=j(_);{var S=k=>{var E=PU();pi(E,21,()=>$(s),hi,(A,w)=>{H0(A,{get view(){return e.view},get showTree(){return $(a)},get log(){return $(w)},get plugin(){return r()}})}),G(E),ce(k,E)};Re(b,k=>{$(s)&&k(S)})}Ga(4),G(_),G(f),Be(()=>{xe(p,"data-icon",$(a)?"list":"folder"),v=gt(g,1,"clickable-icon nav-action-button",null,v,{loading:$(i)})}),de("click",p,()=>{se(a,!$(a)),(0,U0.setIcon)(n[0],$(a)?"list":"folder"),r(r().settings.treeStructure=$(a),!0),r().saveSettings()}),de("click",g,l),ce(t,f),ct()}Tt(["click"]);var lf=class extends U$.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return bi.type}getDisplayText(){return bi.name}getIcon(){return bi.icon}onClose(){return this._view&&ds(this._view),super.onClose()}reload(){this._view&&ds(this._view),this._view=Xs(G0,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};m();var G$=require("obsidian"),Ep=class extends G$.FuzzySuggestModal{constructor(r,i){super(r.app);this.branches=i;this.setPlaceholder("Select branch to checkout")}getItems(){return this.branches}getItemText(r){return r}onChooseItem(r,i){this.resolve(r)}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>window.setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}};m();var z$=require("obsidian");m();var po=require("obsidian");m();var cf=require("obsidian");m();var j$=require("obsidian");var oc=class extends j$.Modal{constructor({app:r,path:i,filesToDeleteCount:n,filesToDiscardCount:s}){super(r);this.resolve=null;this.path=i,this.deleteCount=n,this.discardCount=s}openAndGetResult(){return this.open(),new Promise(r=>{this.resolve=r})}onOpen(){let r=this.deleteCount+this.discardCount,{contentEl:i,titleEl:n}=this,s="";this.path!=""&&(r>1?s=`files in "${this.path}"`:s=`"${this.path}"`),n.setText(`${this.discardCount==0?"Delete":"Discard"} ${s}`),this.deleteCount>0&&i.createEl("p").setText(`Are you sure you want to DELETE the ${cu(this.deleteCount,"untracked file")}? They are deleted according to your Obsidian trash settting.`),this.discardCount>0&&i.createEl("p").setText(`Are you sure you want to discard ALL changes in ${cu(this.discardCount,"tracked file")}?`);let a=i.createDiv({cls:"modal-button-container"});if(this.deleteCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`${this.discardCount>0?"Discard":"Delete"} all ${cu(r,"file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("delete"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("delete"),this.close()})}if(this.discardCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`Discard all ${cu(this.discardCount,"tracked file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("discard"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("discard"),this.close()})}let o=a.createEl("button",{text:"Cancel"});o.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),o.addEventListener("keypress",()=>(this.resolve&&this.resol
Line truncated
|
||||
`)}}}function aR(t){let e=_0.get(t);e&&(fr(t,"message",{value:e.message}),fr(t,"stack",{value:e.stack}))}m();m();var Z4=-7169;function Ge(t,e){t.f=t.f&Z4|e}function Ql(t){(t.f&512)!==0||t.deps===null?Ge(t,1024):Ge(t,4096)}function oR(t){if(t!==null)for(let e of t)(e.f&2)===0||(e.f&65536)===0||(e.f^=65536,oR(e.deps))}function _p(t,e,r){(t.f&2048)!==0?e.add(t):(t.f&4096)!==0&&r.add(t),oR(t.deps),Ge(t,1024)}m();m();m();var lR=!1,yp=!1;function y0(t){var e=yp;try{return yp=!1,[t(),yp]}finally{yp=e}}m();m();m();m();function x0(t){se&&or(t)!==null&&ec(t)}var cR=!1;function E0(){cR||(cR=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(let r of t.target.elements)(e=r[Ya])==null||e.call(r)})},{capture:!0}))}function Zr(t){var e=oe,r=ee;Ht(null),Ut(null);try{return t()}finally{Ht(e),Ut(r)}}function S0(t,e,r,i=r){t.addEventListener(e,()=>Zr(r));let n=t[Ya];n?t[Ya]=()=>{n(),i(!0)}:t[Ya]=()=>i(!0),E0()}m();m();m();function uR(t){let e=0,r=gr(0),i;return O&&pr(r,"createSubscriber version"),()=>{Qs()&&(F(r),lr(()=>(e===0&&(i=Je(()=>t(()=>to(r)))),e+=1,()=>{At(()=>{e-=1,e===0&&(i==null||i(),i=void 0,to(r))})})))}}var X4=589824;function R0(t,e,r,i){new k0(t,e,r,i)}var li,of,Oi,ro,Kr,Li,Ar,ci,ds,io,Js,tc,lf,cf,Dn,Sp,qe,dR,hR,C0,pR,A0,xp,Ep,T0,P0,k0=class{constructor(e,r,i,n){ge(this,qe);Ue(this,"parent");Ue(this,"is_pending",!1);Ue(this,"transform_error");ge(this,li);ge(this,of,se?we:null);ge(this,Oi);ge(this,ro);ge(this,Kr);ge(this,Li,null);ge(this,Ar,null);ge(this,ci,null);ge(this,ds,null);ge(this,io,0);ge(this,Js,0);ge(this,tc,!1);ge(this,lf,new Set);ge(this,cf,new Set);ge(this,Dn,null);ge(this,Sp,uR(()=>(de(this,Dn,gr($(this,io))),O&&pr($(this,Dn),"$effect.pending()"),()=>{de(this,Dn,null)})));var s,a;de(this,li,e),de(this,Oi,r),de(this,ro,o=>{var l=ee;l.b=this,l.f|=128,i(o)}),this.parent=ee.b,this.transform_error=(a=n!=null?n:(s=this.parent)==null?void 0:s.transform_error)!=null?a:(o=>o),de(this,Kr,fi(()=>{if(se){let o=$(this,of);hr();let l=o.data==="[!";if(o.data.startsWith("[?")){let u=JSON.parse(o.data.slice("[?".length));Se(this,qe,hR).call(this,u)}else l?Se(this,qe,pR).call(this):Se(this,qe,dR).call(this)}else Se(this,qe,A0).call(this)},X4)),se&&de(this,li,we)}defer_effect(e){_p(e,$(this,lf),$(this,cf))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!$(this,Oi).pending}update_pending_count(e,r){Se(this,qe,T0).call(this,e,r),de(this,io,$(this,io)+e),!(!$(this,Dn)||$(this,tc))&&(de(this,tc,!0),At(()=>{de(this,tc,!1),$(this,Dn)&&sn($(this,Dn),$(this,io))}))}get_effect_pending(){return $(this,Sp).call(this),F($(this,Dn))}error(e){var r;if(!$(this,Oi).onerror&&!$(this,Oi).failed)throw e;(r=le)!=null&&r.is_fork?($(this,Li)&&le.skip_effect($(this,Li)),$(this,Ar)&&le.skip_effect($(this,Ar)),$(this,ci)&&le.skip_effect($(this,ci)),le.oncommit(()=>{Se(this,qe,P0).call(this,e)})):Se(this,qe,P0).call(this,e)}};li=new WeakMap,of=new WeakMap,Oi=new WeakMap,ro=new WeakMap,Kr=new WeakMap,Li=new WeakMap,Ar=new WeakMap,ci=new WeakMap,ds=new WeakMap,io=new WeakMap,Js=new WeakMap,tc=new WeakMap,lf=new WeakMap,cf=new WeakMap,Dn=new WeakMap,Sp=new WeakMap,qe=new WeakSet,dR=function(){try{de(this,Li,Gt(()=>$(this,ro).call(this,$(this,li))))}catch(e){this.error(e)}},hR=function(e){let r=$(this,Oi).failed,{reset:i,invoke_onerror:n}=Se(this,qe,C0).call(this,e);At(n),r&&de(this,ci,Gt(()=>{r($(this,li),()=>e,()=>i)}))},C0=function(e){var r=!1,i=!1;let n=()=>{if(r){eR();return}r=!0,i&&qP(),$(this,ci)!==null&&On($(this,ci),()=>{de(this,ci,null)}),Se(this,qe,Ep).call(this,()=>{Se(this,qe,A0).call(this)})};return{reset:n,invoke_onerror:()=>{var a,o;try{i=!0,(o=(a=$(this,Oi)).onerror)==null||o.call(a,e,n),i=!1}catch(l){nn(l,$(this,Kr)&&$(this,Kr).parent)}}}},pR=function(){let e=$(this,Oi).pending;e&&(this.is_pending=!0,de(this,Ar,Gt(()=>e($(this,li)))),At(()=>{var r=de(this,ds,document.createDocumentFragment()),i=jt();r.append(i),de(this,Li,Se(this,qe,Ep).call(this,()=>Gt(()=>$(this,ro).call(this,i)))),$(this,Js)===0&&($(this,li).before(r),de(this,ds,null),On($(this,Ar),()=>{de(this,Ar,null)}),Se(this,qe,xp).call(this,le))}))},A0=function(){try{if(this.is_pending=this.has_pending_snippet(),de(this,Js,0),de(this,io,0),de(this,Li,Gt(()=>{$(this,ro).call(this,$(this,li))})),$(this,Js)>0){var e=de(this,ds,document.createDocumentFragment());rc($(this,Li),e);let r=$(this,Oi).pending;de(this,Ar,Gt(()=>r($(this,li))))}else Se(this,qe,xp).call(this,le)}catch(r){this.error(r)}},xp=function(e){this.is_pending=!1,e.transfer_effects($(this,lf),$(this,cf))},Ep=function(e){var r=ee,i=oe,n=Ee;Ut($(this,Kr)),Ht($(this,Kr)),us($(this,Kr).ctx);try{return ui.ensure(),e()}catch(s){return bp(s),null}finally{Ut(r),Ht(i),us(n)}},T0=function(e,r){var i;if(!this.has_pending_snippet()){this.parent&&Se(i=this.parent,qe,T0).call(i,e,r);return}de(this,Js,$(this,Js)+e),$(this,Js)===0&&(Se(this,qe,xp).call(this,r),$(this,Ar)&&On($(this,Ar),()=>{de(this,Ar,null)}),$(
Line truncated
|
||||
`).some(l=>l.startsWith("https://svelte.dev/e/")))throw o;return o!==as&&console.warn("Failed to hydrate: ",o),e.recover===!1&&UP(),Ip(),ec(r),Lt(!1),na(t,e)}finally{Lt(i),We(n)}}var Hp=new Map;function QR(t,{target:e,anchor:r,props:i={},events:n,context:s,intro:a=!0,transformError:o}){Ip();var l=void 0,c=LR(()=>{var u=r!=null?r:e.appendChild(jt());R0(u,{pending:()=>{}},h=>{ht({});var p=Ee;if(s&&(p.c=s),n&&(i.$$events=n),se&&on(h,null),Up=a,l=t(h,i)||{},Up=!0,se&&(ee.nodes.end=we,we===null||we.nodeType!==Ii||we.data!=="]"))throw Za(),as;pt()},o);var f=new Set,d=h=>{for(var p=0;p<h.length;p++){var g=h[p];if(!f.has(g)){f.add(g);var v=XR(g);for(let C of[e,document]){var b=Hp.get(C);b===void 0&&(b=new Map,Hp.set(C,b));var _=b.get(g);_===void 0?(C.addEventListener(g,Bp,{passive:v}),b.set(g,1)):b.set(g,_+1)}}}};return d(Wl(K0)),Np.add(d),()=>{var v;for(var h of f)for(let b of[e,document]){var p=Hp.get(b),g=p.get(h);--g==0?(b.removeEventListener(h,Bp),p.delete(h),p.size===0&&Hp.delete(b)):p.set(h,g)}Np.delete(d),u!==r&&((v=u.parentNode)==null||v.removeChild(u))}});return eb.set(l,c),l}var eb=new WeakMap;function _s(t,e){let r=eb.get(t);return r?(eb.delete(t),r(e)):(O&&(rr in t?JP():QP()),Promise.resolve())}m();m();m();var ln,Un,gi,mo,bf,_f,Gp,ys=class{constructor(e,r=!0){Ue(this,"anchor");ge(this,ln,new Map);ge(this,Un,new Map);ge(this,gi,new Map);ge(this,mo,new Set);ge(this,bf,!0);ge(this,_f,e=>{if($(this,ln).has(e)){var r=$(this,ln).get(e),i=$(this,Un).get(r);if(i)mc(i),$(this,mo).delete(r);else{var n=$(this,gi).get(r);n&&(mc(n.effect),$(this,Un).set(r,n.effect),$(this,gi).delete(r),O&&(n.fragment.lastChild[p0]=this.anchor),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(let[s,a]of $(this,ln)){if($(this,ln).delete(s),s===e)break;let o=$(this,gi).get(a);o&&(_t(o.effect),$(this,gi).delete(a))}for(let[s,a]of $(this,Un)){if(s===r||$(this,mo).has(s))continue;let o=()=>{if(Array.from($(this,ln).values()).includes(s)){var c=document.createDocumentFragment();rc(a,c),c.append(jt()),$(this,gi).set(s,{effect:a,fragment:c})}else _t(a);$(this,mo).delete(s),$(this,Un).delete(s)};$(this,bf)||!i?($(this,mo).add(s),On(a,o,!1)):o()}}});ge(this,Gp,e=>{$(this,ln).delete(e);let r=Array.from($(this,ln).values());for(let[i,n]of $(this,gi))r.includes(i)||(_t(n.effect),$(this,gi).delete(i))});this.anchor=e,de(this,bf,r)}ensure(e,r){var i=le,n=Mp();if(r&&!$(this,Un).has(e)&&!$(this,gi).has(e))if(n){var s=document.createDocumentFragment(),a=jt();s.append(a),$(this,gi).set(e,{effect:Gt(()=>r(a)),fragment:s})}else $(this,Un).set(e,Gt(()=>r(this.anchor)));if($(this,ln).set(i,e),n){for(let[o,l]of $(this,Un))o===e?i.unskip_effect(l):i.skip_effect(l);for(let[o,l]of $(this,gi))o===e?i.unskip_effect(l.effect):i.skip_effect(l.effect);i.oncommit($(this,_f)),i.ondiscard($(this,Gp))}else se&&(this.anchor=we),$(this,_f).call(this,i)}};ln=new WeakMap,Un=new WeakMap,gi=new WeakMap,mo=new WeakMap,bf=new WeakMap,_f=new WeakMap,Gp=new WeakMap;if(O){let t=function(e){if(!(e in globalThis)){let r;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(r!==void 0)return r;jP(e)},set:i=>{r=i}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function go(t){Ee===null&&dp("onMount"),cs&&Ee.l!==null?bU(Ee).m.push(t):vr(()=>{let e=Je(t);if(typeof e=="function")return e})}function bU(t){var r;var e=t.l;return(r=e.u)!=null?r:e.u={a:[],b:[],m:[]}}m();m();var t$=new Map;function r$(t,e){var r=t$.get(t);r||(r=new Set,t$.set(t,r)),r.add(e)}m();m();m();m();m();m();m();m();m();function $e(t,e,r=!1){var i;se&&(i=we,hr());var n=new ys(t),s=r?65536:0;function a(o,l){if(se){var c=rf(i);if(o!==parseInt(c.substring(1))){var u=Fn();We(u),n.anchor=u,Lt(!1),n.ensure(o,l),Lt(!0);return}}n.ensure(o,l)}fi(()=>{var o=!1;e((l,c=0)=>{o=!0,a(c,l)}),o||a(-1,null)},s)}m();m();m();function vi(t,e){return e}function AU(t,e,r){var f;for(var i=[],n=e.length,s,a=e.length,o=0;o<n;o++){let d=e[o];On(d,()=>{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var h=t.outrogroups;rb(t,Wl(s.done)),h.delete(s),h.size===0&&(t.outrogroups=null)}}else a-=1},!1)}if(a===0){var l=i.length===0&&r!==null;if(l){var c=r,u=c.parentNode;ec(u),u.append(c),t.items.clear()}rb(t,e,!l)}else s={pending:new Set(e),done:new Set},((f=t.outrogroups)!=null?f:t.outrogroups=new Set).add(s)}function rb(t,e,r=!0){var i;if(t.pending.size>0){i=new Set;for(let a of t.pending.values())for(let o of a)i.add(t.items.get(o).e)}for(var n=0;n<e.length;n++){var s=e[n];if(i!=null&&i.has(s)){s.f|=33554432;let a=document.createDocumentFragment();rc(s,a)}else _t(e[n],r)}}var gc;function wi(t,e,r,i,n,s=null){var a=t,o=new Map,l=(e&4)!==0;if(l){var c=t;a=se?We(or(c)):c.appendChild(jt())}se&&hr();var u=null,f=no(()=>{var C=r();return os(C)?C:C==null?[]:Wl(C)});O&&pr(f,"{#each ...}");var d,h=new Map,p=!0;function g(C){(_.effect.f&16384)===0&&(_.pending.delete(C),_.fallback=u,TU(_,d,a,e,i),u!==null&&(d.length===0?(u.f&33554432)===0?mc(u):(u.f^=33554432,xf(u,null,a))
Line truncated
|
||||
\r\f\xA0\v\uFEFF`];function c$(t,e,r){var i=t==null?"":""+t;if(e&&(i=i?i+" "+e:e),r){for(var n of Object.keys(r))if(r[n])i=i?i+" "+n:n;else if(i.length)for(var s=n.length,a=0;(a=i.indexOf(n,a))>=0;){var o=a+s;(a===0||l$.includes(i[a-1]))&&(o===i.length||l$.includes(i[o]))?i=(a===0?"":i.substring(0,a))+i.substring(o+1):a=o}}return i===""?null:i}m();function ft(t,e,r,i,n,s){var a=t[Ju];if(se||a!==r||a===void 0){var o=c$(r,i,s);(!se||o!==t.getAttribute("class"))&&(o==null?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o)),t[Ju]=r}else if(s&&n!==s)for(var l in s){var c=!!s[l];(n==null||c!==!!n[l])&&t.classList.toggle(l,c)}return s}m();m();var VU=Symbol("is custom element"),zU=Symbol("is html"),WU=m0?"link":"LINK";function ye(t,e,r,i){var n=qU(t);if(se&&(n[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName===WU)){i||ZU(t,e,r!=null?r:"");return}n[e]!==(n[e]=r)&&(e==="loading"&&(t[$P]=r),r==null?t.removeAttribute(e):typeof r!="string"&&YU(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function qU(t){var e,r;return(r=t[e=fp])!=null?r:t[e]={[VU]:t.nodeName.includes("-"),[zU]:t.namespaceURI===ap}}var u$=new Map;function YU(t){var e=t.getAttribute("is")||t.nodeName,r=u$.get(e);if(r)return r;u$.set(e,r=[]);for(var i,n=t,s=Element.prototype;s!==n;){i=c0(n);for(var a in i)i[a].set&&a!=="innerHTML"&&a!=="textContent"&&a!=="innerText"&&r.push(a);n=ql(n)}return r}function ZU(t,e,r){var i;O&&(e==="srcset"&&KU(t,r)||nb((i=t.getAttribute(e))!=null?i:"",r)||XP(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r)))}function nb(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function f$(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function KU(t,e){var r=f$(t.srcset),i=f$(e);return i.length===r.length&&i.every(([n,s],a)=>s===r[a][1]&&(nb(r[a][0],n)||nb(n,r[a][0])))}m();m();m();function ob(t,e,r=e){var i=new WeakSet;S0(t,"input",async n=>{O&&t.type==="checkbox"&&g0();var s=n?t.defaultValue:t.value;if(s=sb(t)?ab(s):s,r(s),le!==null&&i.add(le),await Lp(),s!==(s=e())){var a=t.selectionStart,o=t.selectionEnd,l=t.value.length;if(t.value=s!=null?s:"",o!==null){var c=t.value.length;a===o&&o===l&&c>l?(t.selectionStart=c,t.selectionEnd=c):(t.selectionStart=a,t.selectionEnd=Math.min(o,c))}}}),(se&&t.defaultValue!==t.value||Je(e)==null&&t.value)&&(r(sb(t)?ab(t.value):t.value),le!==null&&i.add(le)),lr(()=>{O&&t.type==="checkbox"&&g0();var n=e();if(t===document.activeElement){var s=Ft?ps:le;if(i.has(s))return}sb(t)&&n===ab(t.value)||t.type==="date"&&!n&&!t.value||n!==t.value&&(t.value=n!=null?n:"")})}function sb(t){var e=t.type;return e==="number"||e==="range"}function ab(t){return t===""?null:+t}m();m();m();m();m();function lb(t,e){return t===e||(t==null?void 0:t[rr])===e}function ot(t={},e,r,i){var n=Ee.r,s=ee;return ei(()=>{var a,o;return lr(()=>{a=o,o=(i==null?void 0:i())||[],Je(()=>{lb(r(...o),t)||(e(t,...o),a&&lb(r(...a),t)&&e(null,...a))})}),()=>{let l=s;for(;l!==n&&l.parent!==null&&l.parent.f&33554432;)l=l.parent;let c=()=>{o&&lb(r(...o),t)&&e(null,...o)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),t}m();m();m();m();m();m();function Bi(t,e,r,i){var x,E;var n=!cs||(r&2)!==0,s=(r&8)!==0,a=(r&16)!==0,o=i,l=!0,c=void 0,u=()=>a&&n?(c!=null||(c=ea(i)),F(c)):(l&&(l=!1,o=a?Je(i):i),o);let f;if(s){var d=rr in t||Qu in t;f=(E=(x=qr(t,e))==null?void 0:x.set)!=null?E:d&&e in t?A=>t[e]=A:void 0}var h,p=!1;s?[h,p]=y0(()=>t[e]):h=t[e],h===void 0&&i!==void 0&&(h=u(),f&&(n&&GP(e),f(h)));var g;if(n?g=()=>{var A=t[e];return A===void 0?u():(l=!0,A)}:g=()=>{var A=t[e];return A!==void 0&&(o=void 0),A===void 0?o:A},n&&(r&4)===0)return g;if(f){var v=t.$$legacy;return(function(A,w){return arguments.length>0?((!n||!w||v||p)&&f(w?g():A),A):g()})}var b=!1,_=((r&1)!==0?ea:no)(()=>(b=!1,g()));O&&(_.label=e),s&&F(_);var C=ee;return(function(A,w){if(arguments.length>0){let S=w?F(_):n&&s?nt(A):A;return ae(_,S),b=!0,o!==void 0&&(o=S),A}return di&&b||(C.f&16384)!==0?_.v:F(_)})}m();m();m();function h$(t){return new ub(t)}var xs,Hi,ub=class{constructor(e){ge(this,xs);ge(this,Hi);var s,a;var r=new Map,i=(o,l)=>{var c=Ja(l,!1,!1);return r.set(o,c),c};let n=new Proxy({...e.props||{},$$events:{}},{get(o,l){var c;return F((c=r.get(l))!=null?c:i(l,Reflect.get(o,l)))},has(o,l){var c;return l===Qu?!0:(F((c=r.get(l))!=null?c:i(l,Reflect.get(o,l))),Reflect.has(o,l))},set(o,l,c){var u;return ae((u=r.get(l))!=null?u:i(l,c),c),Reflect.set(o,l,c)}});de(this,Hi,(e.hydrate?tb:na)(e.component,{target:e.target,anchor:e.anchor,props:n,context:e.context,intro:(s=e.intro)!=null?s:!1,recover:e.recover,transformError:e.transformError})),!Ft&&(!((a=e==null?void 0:e.props)!=null&&a.$$host)||e.sync===!1)&&co(),de(this,xs,n.$$events);for(let o of Object.keys($(this,Hi)))o==="$set"||o==="$destroy"||o==="$on"||fr(this,o,{get(){return $(this,Hi)[o]},set(l){$(this,Hi)[o]=l},enumerable:!0});$(this,Hi).$set=o=>{Object.assign(n,o)},$(this,Hi).$destroy=()=>{_s($(this,Hi))}}$set(e){$(this,Hi).$se
Line truncated
|
||||
`:""}${(S=e.log.author)==null?void 0:S.name}
|
||||
${(0,hb.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)}
|
||||
${e.log.message}`}]),me("click",u,()=>ae(n,!F(n))),ue(t,o),pt()}Mt(["click"]);var CG=_e('<div class="tree-item nav-folder mod-root"></div>'),AG=_e('<main class="git-view"><div class="nav-header"><div class="nav-buttons-container"><div id="layoutChange" class="clickable-icon nav-action-button" aria-label="Change Layout"></div> <div id="refresh" data-icon="refresh-cw" aria-label="Refresh"></div></div></div> <div class="nav-files-container" style="position: relative;"><!> <div id="sentinel"></div> <div style="margin-bottom:40px"></div></div></main>'),TG={hash:"svelte-12n6twc",code:""};function gb(t,e){ht(e,!0),fn(t,TG);let r=Bi(e,"plugin",15),i=Ne(!1),n=nt([]),s=Ne(void 0),a=Ne(nt(r().settings.treeStructure)),o;vr(()=>{o&&o.empty()}),go(()=>{e.view.registerEvent(e.view.app.workspace.on("obsidian-git:head-change",()=>{c().catch(console.error)}))}),vr(()=>{n.forEach(x=>(0,mb.setIcon)(x,x.getAttr("data-icon")))}),go(()=>{let x=new IntersectionObserver(A=>{var w;(w=A[0])!=null&&w.isIntersecting&&!F(i)&&u().catch(console.error)}),E=activeDocument.querySelector("#sentinel");return E&&x.observe(E),()=>{x.disconnect()}}),c().catch(console.error);function l(){c().catch(console.error)}async function c(){var A,w;if(!r().gitReady){ae(s,void 0);return}ae(i,!0);let x=r().gitManager instanceof ke,E;((w=(A=F(s))==null?void 0:A.length)!=null?w:0)==0?E=x?50:10:E=F(s).length,ae(s,await r().gitManager.log(void 0,!1,E),!0),ae(i,!1)}async function u(){var w;if(!r().gitReady||F(s)===void 0)return;ae(i,!0);let E=r().gitManager instanceof ke?50:10,A=await r().gitManager.log(void 0,!1,E,(w=F(s).last())==null?void 0:w.hash);F(s).push(...A.slice(1)),ae(i,!1)}var f=AG(),d=V(f),h=V(d),p=V(h);ot(p,x=>n[0]=x,()=>n==null?void 0:n[0]);var g=ne(p,2);let v;ot(g,x=>n[1]=x,()=>n==null?void 0:n[1]),G(h),G(d);var b=ne(d,2),_=V(b);{var C=x=>{var E=CG();wi(E,21,()=>F(s),vi,(A,w)=>{pb(A,{get view(){return e.view},get showTree(){return F(a)},get log(){return F(w)},get plugin(){return r()}})}),G(E),ue(x,E)};$e(_,x=>{F(s)&&x(C)})}Ka(4),G(b),G(f),Ve(()=>{ye(p,"data-icon",F(a)?"list":"folder"),v=ft(g,1,"clickable-icon nav-action-button",null,v,{loading:F(i)})}),me("click",p,()=>{ae(a,!F(a)),(0,mb.setIcon)(n[0],F(a)?"list":"folder"),r(r().settings.treeStructure=F(a),!0),r().saveSettings()}),me("click",g,l),ue(t,f),pt()}Mt(["click"]);var kf=class extends p$.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return Ei.type}getDisplayText(){return Ei.name}getIcon(){return Ei.icon}async onClose(){return this._view&&await _s(this._view),super.onClose()}async reload(){this._view&&await _s(this._view),this._view=na(gb,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}async onOpen(){return await this.reload(),super.onOpen()}};m();var m$=require("obsidian"),Wp=class extends m$.FuzzySuggestModal{constructor(r,i){super(r.app);this.branches=i;this.setPlaceholder("Select branch to checkout")}getItems(){return this.branches}getItemText(r){return r}onChooseItem(r,i){this.resolve(r)}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>window.setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}};m();var w$=require("obsidian");m();var zn=require("obsidian");m();var Cf=require("obsidian");m();var g$=require("obsidian");var vc=class extends g$.Modal{constructor({app:r,path:i,filesToDeleteCount:n,filesToDiscardCount:s}){super(r);this.resolve=null;this.path=i,this.deleteCount=n,this.discardCount=s}openAndGetResult(){return this.open(),new Promise(r=>{this.resolve=r})}onOpen(){let r=this.deleteCount+this.discardCount,{contentEl:i,titleEl:n}=this,s="";this.path!=""&&(r>1?s=`files in "${this.path}"`:s=`"${this.path}"`),n.setText(`${this.discardCount==0?"Delete":"Discard"} ${s}`),this.deleteCount>0&&i.createEl("p").setText(`Are you sure you want to DELETE the ${xu(this.deleteCount,"untracked file")}? They are deleted according to your Obsidian trash settting.`),this.discardCount>0&&i.createEl("p").setText(`Are you sure you want to discard ALL changes in ${xu(this.discardCount,"tracked file")}?`);let a=i.createDiv({cls:"modal-button-container"});if(this.deleteCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`${this.discardCount>0?"Discard":"Delete"} all ${xu(r,"file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("delete"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("delete"),this.close()})}if(this.discardCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`Discard all ${xu(this.discardCount,"tracked file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("discard"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("discard"),this.close()})}let o=a.createEl("button",{text:"Cancel"});o.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),o.addEventListener("keypress",()=>(this.resolve&&this.resolve(!1),this.close()))}onClose(){let{contentEl:r}=this;r.empty
Line truncated
|
||||
`);n.removed.lines.length>0&&!n.removed.no_nl_at_eof&&(c+=`
|
||||
`),i.replaceRange(c,i.offsetToPos(o),i.offsetToPos(l)),i.setSelection(i.offsetToPos(o))}}async stageHunk(e){if(!await this.plugin.isAllInitialized()||!this.editor)return;let{editor:r}=this.editor,i=Wi.getHunk(r.state,!1,e),n=!1;if(i||(i=Wi.getHunk(r.state,!0,e),n=!0),!i)return;let s=r.state.field(W$.editorInfoField).file.path,a=Vt.createPatch(s,[i],"100644",n).join(`
|
||||
`),i.replaceRange(c,i.offsetToPos(o),i.offsetToPos(l)),i.setSelection(i.offsetToPos(o))}}async stageHunk(e){if(!await this.plugin.isAllInitialized()||!this.editor)return;let{editor:r}=this.editor,i=Ki.getHunk(r.state,!1,e),n=!1;if(i||(i=Ki.getHunk(r.state,!0,e),n=!0),!i)return;let s=r.state.field(b$.editorInfoField).file.path,a=qt.createPatch(s,[i],"100644",n).join(`
|
||||
`)+`
|
||||
`;await this.gitManager.applyPatch(a),this.plugin.app.workspace.trigger("obsidian-git:refresh")}goToHunk(e){if(!this.editor)return;let{editor:r,obEditor:i}=this.editor,n=Wi.getHunks(r.state,!1),s=i.getCursor().line+1,a=Vt.findNearestHunk(s,n,e,!0);if(a==null)return;let o=n[a];if(o){let l=o.added.start-1;i.setCursor(l,0),i.scrollIntoView({from:{line:l,ch:0},to:{line:l+1,ch:0}},!0)}}};m();m();var mo=require("obsidian");var Cp=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.lineAuthorInfoProvider){console.warn("Git: undefined lineAuthorInfoProvider. Unexpected situation.");return}let r=e==null?void 0:e.view;!(r instanceof mo.MarkdownView)||r.file==null||(r==null?void 0:r.allowNoFile)===!0||this.lineAuthorInfoProvider.trackChanged(r.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions),h2(()=>this.plg.settings.lineAuthor,e=>{this.plg.settings.lineAuthor=e,this.plg.saveSettings()})}conditionallyActivateBySettings(){this.plg.settings.lineAuthor.show&&this.activateFeature()}activateFeature(){try{if(!this.isAvailableOnCurrentPlatform().available)return;E2(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new ch(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),console.log(this.plg.manifest.name+": Enabled line authoring.")}catch(e){console.warn("Git: Error while loading line authoring feature.",e),this.deactivateFeature()}}deactivateFeature(){var e;this.destroyEventHandlers(),this.deactivateCodeMirrorExtensions(),(e=this.lineAuthorInfoProvider)==null||e.destroy(),this.lineAuthorInfoProvider=void 0,console.log(this.plg.manifest.name+": Disabled line authoring.")}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&mo.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Se?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(D2),this.plg.app.workspace.updateOptions(),this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}deactivateCodeMirrorExtensions(){for(let e of this.codeMirrorExtensions)this.codeMirrorExtensions.remove(e);this.plg.app.workspace.updateOptions()}createEventHandlers(){this.gutterContextMenuEvent=this.createGutterContextMenuHandler(),this.fileOpenEvent=this.createFileOpenEvent(),this.workspaceLeafChangeEvent=this.createWorkspaceLeafChangeEvent(),this.fileModificationEvent=this.createVaultFileModificationHandler(),this.headChangeEvent=this.createHeadChangeEvent(),this.refreshOnCssChangeEvent=this.createCssRefreshHandler(),this.fileRenameEvent=this.createFileRenameEvent(),w2(),this.plg.registerEvent(this.gutterContextMenuEvent),this.plg.registerEvent(this.refreshOnCssChangeEvent),this.plg.registerEvent(this.fileOpenEvent),this.plg.registerEvent(this.workspaceLeafChangeEvent),this.plg.registerEvent(this.fileModificationEvent),this.plg.registerEvent(this.headChangeEvent),this.plg.registerEvent(this.fileRenameEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.gutterContextMenuEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.workspace.offref(this.fileOpenEvent),this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.vault.offref(this.fileModificationEvent),this.plg.app.workspace.offref(this.headChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent)}createFileOpenEvent(){return this.plg.app.workspace.on("file-open",e=>{var r;return void((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e).catch(console.error))})}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,r)=>{var i;return e instanceof mo.TFile&&((i=this.lineAuthorInfoProvider)==null?void 0:i.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var r;return e instanceof mo.TFile&&((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e))})}createHeadChangeEvent(){return this.plg.app.workspace.on("obsidian-git:head-change",()=>{this.refreshLineAuthorViews()})}createCssRefreshHandler(){return this.plg.app.workspace.on("css-change",()=>this.refreshLineAuthorViews())}createGutterContextMenuHandler(){return this.plg.app.workspace.on("editor-menu",y2)}};m();var lc=require("obsidian");m();m();var go=require("@codemirror/state"),Pp=require("@codemirror/view");var Tp=class extends Pp.GutterMarker{constructor(r,i){super();this.type=r;this.staged=i}toDOM(r){let i=activeDocument.createElement("div");return i.className=`git-gutter-marker git-${this.type} ${this.staged?"staged":"unstaged"}`,this.type=="changedelete"&&i.setText("~"),i}},V0=go.StateField.define({create:()=>go.RangeSet.empty,update:(t,e)=>{let r=e.state.field(Hr,!1);if(!r)ret
Line truncated
|
||||
`+s),this.app.workspace.trigger("obsidian-git:refresh")}handleFileMenu(r,i,n,s){if(!this.gitReady||!this.settings.showFileMenu||!i)return;let a;if(typeof i=="string"?a=i:a=i.path,n=="file-explorer-context-menu"&&(r.addItem(o=>{o.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof be.TFile?await this.stageFile(i):(await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof be.TFile?await this.unstageFile(i):(await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(l=>{this.addFileToGitignore(a,i instanceof be.TFolder).catch(c=>this.displayError(c))})})),n=="git-source-control"){r.addItem(l=>{l.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(c=>{this.addFileToGitignore(a,i instanceof be.TFolder).catch(u=>this.displayError(u))})});let o=this.app.vault.adapter;s==="obsidian-git:menu"&&o instanceof be.FileSystemAdapter&&(r.addItem(l=>{l.setTitle("Open in default app").setIcon("arrow-up-right").setSection("action").onClick(c=>{this.app.openWithDefaultApp(a)})}),r.addItem(l=>{l.setTitle("Show in system explorer").setIcon("arrow-up-right").setSection("action").onClick(c=>{window.electron.shell.showItemInFolder(J$.join(o.getBasePath(),a))})}))}}async migrateSettings(){this.settings.mergeOnPull!=null&&(this.settings.syncMethod=this.settings.mergeOnPull?"merge":"rebase",this.settings.mergeOnPull=void 0,await this.saveSettings()),this.settings.autoCommitMessage===void 0&&(this.settings.autoCommitMessage=this.settings.commitMessage,await this.saveSettings()),this.settings.gitPath!=null&&(this.localStorage.setGitPath(this.settings.gitPath),this.settings.gitPath=void 0,await this.saveSettings()),this.settings.username!=null&&(this.localStorage.setPassword(this.settings.username),this.settings.username=void 0,await this.saveSettings())}unloadPlugin(){var r,i;this.gitReady=!1,this.editorIntegration.onUnloadPlugin(),this.automaticsManager.unload(),(r=this.branchBar)==null||r.remove(),(i=this.statusBar)==null||i.remove(),this.statusBar=void 0,this.branchBar=void 0,this.gitManager.unload(),this.promiseQueue.clear();for(let n of this.intervalsToClear)window.clearInterval(n);this.intervalsToClear=[],this.debRefresh.cancel()}onunload(){this.unloadPlugin(),console.log("unloading "+this.manifest.name+" plugin")}async loadSettings(){let r=await this.loadData();r==null&&(r={showedMobileNotice:!0}),this.settings=Rk(ht,r)}async saveSettings(){var r;(r=this.settingsTab)==null||r.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return be.Platform.isDesktopApp}async init({fromReload:r=!1}){var i;if(this.settings.showStatusBar&&!this.statusBar){let n=this.addStatusBarItem();this.statusBar=new fh(n,this),this.intervalsToClear.push(window.setInterval(()=>{var s;return(s=this.statusBar)==null?void 0:s.display()},1e3))}try{this.useSimpleGit?(this.gitManager=new Se(this),await this.gitManager.setGitInstance()):this.gitManager=new Vi(this);let n=await this.gitManager.checkRequirements(),s=this.localStorage.getPausedAutomatics();switch(n){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new be.Notice("Can't find a valid git repository. Please create one via the given command or clone an existing repo.",1e4);break;case"valid":if(this.gitReady=!0,this.setPluginState({gitAction:0}),be.Platform.isDesktop&&this.settings.showBranchStatusBar&&!this.branchBar){let a=this.addStatusBarItem();this.branchBar=new kp(a,this),this.intervalsToClear.push(window.setInterval(()=>{var o;return void((o=this.branchBar)==null?void 0:o.display().catch(console.error))},6e4))}await((i=this.branchBar)==null?void 0:i.display()),this.editorIntegration.onReady(),this.app.workspace.trigger("obsidian-git:refresh"),this.app.workspace.trigger("obsidian-git:head-change"),!r&&this.settings.autoPullOnBoot&&!s&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),s||await this.automaticsManager.init(),s&&new be.Notice("Automatic routines are currently paused.");break;default:this.log("Something weird happened. The 'checkRequirements' result is "+n)}}catch(n){this.displayError(n),console.error(n)}}async createNewRepo(){try{await this.gitManager.init(),new be.Notice("Initialized new repo"),await this.init({fromReload:!0})}catch(r){this.displayError(r)}}async cloneNewRepo(){let i=await new et(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(i){let n="Vault Root",s=await new et(this,{options:this.gitManager instanceof Vi?[n]:[],placeholder
Line truncated
|
||||
`;await this.gitManager.applyPatch(a),this.plugin.app.workspace.trigger("obsidian-git:refresh")}goToHunk(e){if(!this.editor)return;let{editor:r,obEditor:i}=this.editor,n=Ki.getHunks(r.state,!1),s=i.getCursor().line+1,a=qt.findNearestHunk(s,n,e,!0);if(a==null)return;let o=n[a];if(o){let l=o.added.start-1;i.setCursor(l,0),i.scrollIntoView({from:{line:l,ch:0},to:{line:l+1,ch:0}},!0)}}};m();m();var bo=require("obsidian");var Kp=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.lineAuthorInfoProvider){console.warn("Git: undefined lineAuthorInfoProvider. Unexpected situation.");return}let r=e==null?void 0:e.view;!(r instanceof bo.MarkdownView)||r.file==null||(r==null?void 0:r.allowNoFile)===!0||this.lineAuthorInfoProvider.trackChanged(r.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions),DT(()=>this.plg.settings.lineAuthor,e=>{this.plg.settings.lineAuthor=e,this.plg.saveSettings()})}conditionallyActivateBySettings(){this.plg.settings.lineAuthor.show&&this.activateFeature()}activateFeature(){try{if(!this.isAvailableOnCurrentPlatform().available)return;zT(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new Th(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),console.log(this.plg.manifest.name+": Enabled line authoring.")}catch(e){console.warn("Git: Error while loading line authoring feature.",e),this.deactivateFeature()}}deactivateFeature(){var e;this.destroyEventHandlers(),this.deactivateCodeMirrorExtensions(),(e=this.lineAuthorInfoProvider)==null||e.destroy(),this.lineAuthorInfoProvider=void 0,console.log(this.plg.manifest.name+": Disabled line authoring.")}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&bo.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof ke?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(r2),this.plg.app.workspace.updateOptions(),this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}deactivateCodeMirrorExtensions(){for(let e of this.codeMirrorExtensions)this.codeMirrorExtensions.remove(e);this.plg.app.workspace.updateOptions()}createEventHandlers(){this.gutterContextMenuEvent=this.createGutterContextMenuHandler(),this.fileOpenEvent=this.createFileOpenEvent(),this.workspaceLeafChangeEvent=this.createWorkspaceLeafChangeEvent(),this.fileModificationEvent=this.createVaultFileModificationHandler(),this.headChangeEvent=this.createHeadChangeEvent(),this.refreshOnCssChangeEvent=this.createCssRefreshHandler(),this.fileRenameEvent=this.createFileRenameEvent(),HT(),this.plg.registerEvent(this.gutterContextMenuEvent),this.plg.registerEvent(this.refreshOnCssChangeEvent),this.plg.registerEvent(this.fileOpenEvent),this.plg.registerEvent(this.workspaceLeafChangeEvent),this.plg.registerEvent(this.fileModificationEvent),this.plg.registerEvent(this.headChangeEvent),this.plg.registerEvent(this.fileRenameEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.gutterContextMenuEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.workspace.offref(this.fileOpenEvent),this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.vault.offref(this.fileModificationEvent),this.plg.app.workspace.offref(this.headChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent)}createFileOpenEvent(){return this.plg.app.workspace.on("file-open",e=>{var r;e&&((r=this.lineAuthorInfoProvider)==null||r.trackChanged(e).catch(console.error))})}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,r)=>{var i;return e instanceof bo.TFile&&((i=this.lineAuthorInfoProvider)==null?void 0:i.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var r;return e instanceof bo.TFile&&((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e))})}createHeadChangeEvent(){return this.plg.app.workspace.on("obsidian-git:head-change",()=>{this.refreshLineAuthorViews()})}createCssRefreshHandler(){return this.plg.app.workspace.on("css-change",()=>this.refreshLineAuthorViews())}createGutterContextMenuHandler(){return this.plg.app.workspace.on("editor-menu",jT)}};m();var wc=require("obsidian");m();m();var _o=require("@codemirror/state"),Qp=require("@codemirror/view");var Xp=class extends Qp.GutterMarker{constructor(r,i){super();this.type=r;this.staged=i}toDOM(r){let i=createDiv();return i.className=`git-gutter-marker git-${this.type} ${this.staged?"staged":"unstaged"}`,this.type=="changedelete"&&i.setText("~"),i}},_b=_o.StateField.define({create:()=>_o.RangeSet.empty,update:(t,e)=>{let r=e.state.field(Wr,!1);if(!r)return _o.RangeSet.empty;let i=e.effects.some(s=>s.is(Vh)),n=e.effects.some(s=>s.is(Ml));if(i||n||(e.
Line truncated
|
||||
`+s),this.app.workspace.trigger("obsidian-git:refresh")}handleFileMenu(r,i,n,s){if(!this.gitReady||!this.settings.showFileMenu||!i)return;let a;if(typeof i=="string"?a=i:a=i.path,n=="file-explorer-context-menu"&&(r.addItem(o=>{o.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof Ce.TFile?await this.stageFile(i):(await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof Ce.TFile?await this.unstageFile(i):(await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(l=>{this.addFileToGitignore(a,i instanceof Ce.TFolder).catch(c=>this.displayError(c))})})),n=="git-source-control"){r.addItem(l=>{l.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(c=>{this.addFileToGitignore(a,i instanceof Ce.TFolder).catch(u=>this.displayError(u))})});let o=this.app.vault.adapter;s==="obsidian-git:menu"&&o instanceof Ce.FileSystemAdapter&&(r.addItem(l=>{l.setTitle("Open in default app").setIcon("arrow-up-right").setSection("action").onClick(c=>{this.app.openWithDefaultApp(a)})}),r.addItem(l=>{l.setTitle("Show in system explorer").setIcon("arrow-up-right").setSection("action").onClick(c=>{window.electron.shell.showItemInFolder(k$.join(o.getBasePath(),a))})}))}}async migrateSettings(){this.settings.mergeOnPull!=null&&(this.settings.syncMethod=this.settings.mergeOnPull?"merge":"rebase",this.settings.mergeOnPull=void 0,await this.saveSettings()),this.settings.autoCommitMessage===void 0&&(this.settings.autoCommitMessage=this.settings.commitMessage,await this.saveSettings()),this.settings.gitPath!=null&&(this.localStorage.setGitPath(this.settings.gitPath),this.settings.gitPath=void 0,await this.saveSettings()),this.settings.username!=null&&(this.localStorage.setPassword(this.settings.username),this.settings.username=void 0,await this.saveSettings())}unloadPlugin(){var r,i;this.gitReady=!1,this.editorIntegration.onUnloadPlugin(),this.automaticsManager.unload(),(r=this.branchBar)==null||r.remove(),(i=this.statusBar)==null||i.remove(),this.statusBar=void 0,this.branchBar=void 0,this.gitManager.unload(),this.promiseQueue.clear();for(let n of this.intervalsToClear)window.clearInterval(n);this.intervalsToClear=[],this.debRefresh.cancel()}onunload(){this.unloadPlugin(),console.log("unloading "+this.manifest.name+" plugin")}async loadSettings(){let r=await this.loadData();r==null&&(r={showedMobileNotice:!0}),this.settings=XS(tt,r)}async saveSettings(){var r;(r=this.settingsTab)==null||r.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return Ce.Platform.isDesktopApp}async init({fromReload:r=!1}){var i;if(!this.localStorage.getPluginDisabled()){if(this.settings.showStatusBar&&!this.statusBar){let n=this.addStatusBarItem();this.statusBar=new Rh(n,this),this.intervalsToClear.push(window.setInterval(()=>{var s;return(s=this.statusBar)==null?void 0:s.display()},1e3))}try{this.useSimpleGit?(this.gitManager=new ke(this),await this.gitManager.setGitInstance()):this.gitManager=new Zi(this);let n=await this.gitManager.checkRequirements(),s=this.localStorage.getPausedAutomatics();switch(n){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new Ce.Notice("Can't find a valid git repository. Please create one via the given command or clone an existing repo.",1e4);break;case"valid":if(this.gitReady=!0,Ce.Platform.isDesktop&&this.settings.showBranchStatusBar&&!this.branchBar){let a=this.addStatusBarItem();this.branchBar=new Yp(a,this),this.intervalsToClear.push(window.setInterval(()=>{var o;(o=this.branchBar)==null?void 0:o.display().catch(console.error)},6e4))}await((i=this.branchBar)==null?void 0:i.display()),this.editorIntegration.onReady(),this.app.workspace.trigger("obsidian-git:refresh"),this.app.workspace.trigger("obsidian-git:head-change"),!r&&this.settings.autoPullOnBoot&&!s&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),s||await this.automaticsManager.init(),s&&new Ce.Notice("Automatic routines are currently paused.");break;default:this.log("Something weird happened. The 'checkRequirements' result is "+String(n))}}catch(n){this.displayError(n),console.error(n)}}}async createNewRepo(){try{await this.gitManager.init(),new Ce.Notice("Initialized new repo"),await this.init({fromReload:!0})}catch(r){this.displayError(r)}}async cloneNewRepo(){let i=await new at(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(i){let n="Vault Root",s=await new at(this,{options:this.gitManager instanceof Zi?[n]:[],placeho
Line truncated
|
||||
# Additional Instructions
|
||||
I strongly recommend to use "Source mode" for viewing the conflicted files. For simple conflicts, in each file listed above replace every occurrence of the following text blocks with the desired text.
|
||||
|
||||
@@ -374,7 +374,7 @@ I strongly recommend to use "Source mode" for viewing the conflicted files. For
|
||||
File changes in remote repository
|
||||
>>>>>>> origin/main
|
||||
\`\`\``]),await this.tools.writeAndOpenFile(i==null?void 0:i.join(`
|
||||
`))}async editRemotes(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new et(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(n){let s=await this.gitManager.getRemoteUrl(n),o=await new et(this,{initialValue:s,placeholder:"Enter remote URL"}).openAndGetResult();if(o)return await this.gitManager.setRemote(n,sv(o)),n}}async selectRemoteBranch(){let r=await this.gitManager.getRemotes(),i;r.length===0&&(i=await this.editRemotes(),i==null&&(r=await this.gitManager.getRemotes()));let n=new et(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}),s=i!=null?i:await n.openAndGetResult();if(s){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(s);let a=await this.gitManager.getRemoteBranches(s),l=await new et(this,{options:a,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult();return l==null?void 0:l.startsWith(s+"/")?l:`${s}/${l}`}}async removeRemote(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new et(this,{options:r,placeholder:"Select a remote"}).openAndGetResult();n&&await this.gitManager.removeRemote(n)}onActiveLeafChange(r){var a,o;let i=r==null?void 0:r.view;if(!(i!=null&&i.getState().file)&&!(i instanceof La||i instanceof Na))return;let n=this.app.workspace.getLeavesOfType(Kt.type).first(),s=this.app.workspace.getLeavesOfType(bi.type).first();if((a=n==null?void 0:n.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||a.removeClass("is-active"),(o=s==null?void 0:s.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||o.removeClass("is-active"),(r==null?void 0:r.view)instanceof La||(r==null?void 0:r.view)instanceof Na){let c=r.view.state.bFile.replace(/["\\]/g,"\\$&");this.lastDiffViewState=r.view.getState();let u;n&&r.view.state.aRef=="HEAD"?u=n.view.containerEl.querySelector(`div.staged div.tree-item-self[data-path="${c}"]`):n&&r.view.state.aRef==""?u=n.view.containerEl.querySelector(`div.changes div.tree-item-self[data-path="${c}"]`):s&&(u=s.view.containerEl.querySelector(`div.tree-item-self[data-path='${c}']`)),u==null||u.addClass("is-active")}else this.lastDiffViewState=void 0}handleNoNetworkError(r){this.state.offlineMode?this.log("Encountered network error, but already in offline mode"):this.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.",2e3),this.setPluginState({gitAction:0,offlineMode:!0})}displayMessage(r,i=4*1e3){var n;(n=this.statusBar)==null||n.displayMessage(r.toLowerCase(),i),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!r.startsWith("No changes"))&&new be.Notice(r,5*1e3),this.log(r)}displayError(r,i=10*1e3){var s;if(r instanceof Q$.Errors.UserCanceledError){new be.Notice("Aborted");return}let n;r instanceof Error?n=r:n=new Error(String(r)),this.setPluginState({gitAction:0}),this.settings.showErrorNotices&&new be.Notice(n.message,i),console.error(`${this.manifest.id}:`,n.stack),(s=this.statusBar)==null||s.displayMessage(n.message.toLowerCase(),i)}log(...r){console.log(`${this.manifest.id}:`,...r)}};
|
||||
`))}async editRemotes(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new at(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(n){let s=await this.gitManager.getRemoteUrl(n),o=await new at(this,{initialValue:s,placeholder:"Enter remote URL"}).openAndGetResult();if(o)return await this.gitManager.setRemote(n,yv(o)),n}}async selectRemoteBranch(){let r=await this.gitManager.getRemotes(),i;r.length===0&&(i=await this.editRemotes(),i==null&&(r=await this.gitManager.getRemotes()));let n=new at(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}),s=i!=null?i:await n.openAndGetResult();if(s){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(s);let a=await this.gitManager.getRemoteBranches(s),l=await new at(this,{options:a,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult();return l==null?void 0:l.startsWith(s+"/")?l:`${s}/${l}`}}async removeRemote(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new at(this,{options:r,placeholder:"Select a remote"}).openAndGetResult();n&&await this.gitManager.removeRemote(n)}onActiveLeafChange(r){var a,o;let i=r==null?void 0:r.view;if(!(i!=null&&i.getState().file)&&!(i instanceof Wa||i instanceof qa))return;let n=this.app.workspace.getLeavesOfType(er.type).first(),s=this.app.workspace.getLeavesOfType(Ei.type).first();if((a=n==null?void 0:n.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||a.removeClass("is-active"),(o=s==null?void 0:s.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||o.removeClass("is-active"),(r==null?void 0:r.view)instanceof Wa||(r==null?void 0:r.view)instanceof qa){let c=r.view.state.bFile.replace(/["\\]/g,"\\$&");this.lastDiffViewState=r.view.getState();let u;n&&r.view.state.aRef=="HEAD"?u=n.view.containerEl.querySelector(`div.staged div.tree-item-self[data-path="${c}"]`):n&&r.view.state.aRef==""?u=n.view.containerEl.querySelector(`div.changes div.tree-item-self[data-path="${c}"]`):s&&(u=s.view.containerEl.querySelector(`div.tree-item-self[data-path='${c}']`)),u==null||u.addClass("is-active")}else this.lastDiffViewState=void 0}handleNoNetworkError(r){this.state.offlineMode?this.log("Encountered network error, but already in offline mode"):this.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.",2e3),this.setPluginState({offlineMode:!0})}displayMessage(r,i=4*1e3){var n;(n=this.statusBar)==null||n.displayMessage(r.toLowerCase(),i),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!r.startsWith("No changes"))&&new Ce.Notice(r,5*1e3),this.log(r)}displayError(r,i=10*1e3){var s;if(r instanceof du.UserCanceledError){new Ce.Notice("Aborted");return}let n;r instanceof Error?n=r:n=new Error(String(r)),this.settings.showErrorNotices&&new Ce.Notice(n.message,i),console.error(`${this.manifest.id}:`,n.stack),(s=this.statusBar)==null||s.displayMessage(n.message.toLowerCase(),i)}log(...r){console.log(`${this.manifest.id}:`,...r)}};
|
||||
/*! Bundled license information:
|
||||
|
||||
ieee754/index.js:
|
||||
@@ -394,20 +394,32 @@ safe-buffer/index.js:
|
||||
crc-32/crc32.js:
|
||||
(*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *)
|
||||
|
||||
isomorphic-git/index.cjs:
|
||||
isomorphic-git/index.js:
|
||||
(*!
|
||||
* This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements.
|
||||
* SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
* Copyright (c) James Prevett and other ZenFS contributors.
|
||||
*
|
||||
* Windows support added:
|
||||
* - Backslashes are normalised to forward slashes before processing.
|
||||
* - Drive-letter prefixes (e.g. "C:") are detected and preserved through
|
||||
* normalisation, so absolute Windows paths are handled correctly.
|
||||
* - An absolute argument passed to join() resets the accumulated path,
|
||||
* matching Node behaviour and handling worktree gitdir paths properly.
|
||||
*
|
||||
* Limitation: UNC paths (e.g. \\server\share) are not supported. The leading
|
||||
* backslashes are normalised to forward slashes and then collapsed by
|
||||
* normalizeString, losing the UNC root. Git on Windows works with
|
||||
* drive-letter paths, so this is not expected to be a practical issue.
|
||||
*)
|
||||
|
||||
js-sha256/src/sha256.js:
|
||||
js-sha256/build/sha256.mjs:
|
||||
(**
|
||||
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
||||
*
|
||||
* @version 0.9.0
|
||||
* @version 0.12.0
|
||||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||||
* @copyright Chen, Yi-Cyuan 2014-2017
|
||||
* @copyright Chen, Yi-Cyuan 2014-2026
|
||||
* @license MIT
|
||||
*)
|
||||
*/
|
||||
|
||||
+1
-1
@@ -6,5 +6,5 @@
|
||||
"description": "Integrate Git version control with automatic backup and other advanced features.",
|
||||
"isDesktopOnly": false,
|
||||
"fundingUrl": "https://ko-fi.com/vinzent",
|
||||
"version": "2.38.3"
|
||||
"version": "2.40.0"
|
||||
}
|
||||
+2
-2
@@ -3,7 +3,7 @@ THIS IS A GENERATED/BUNDLED FILE BY ESBUILD AND TERSER
|
||||
if you want to view the source, please visit the github repository of this plugin
|
||||
*/
|
||||
|
||||
"use strict";function Logger(message,level,key3){_logger(message,level,key3)}function __logger(message,baseLevel,flagsOrKey,key3){let level=baseLevel;"string"==typeof flagsOrKey?key3=flagsOrKey:void 0!==flagsOrKey&&(level|=flagsOrKey);_logger(message,level,key3)}function info(message,flagsOrKey,key3){__logger(message,LEVEL_INFO,flagsOrKey,key3)}function isMetaEntry(entry){return"children"in entry}function statusDisplay(status){return status?"EXPERIMENTAL"==status?" (Experimental)":"ALPHA"==status?" (Alpha)":"BETA"==status?" (Beta)":` (${status})`:""}function confName(key3,alt=""){var _a8,_b5;return key3 in configurationNames?`${null==(_a8=configurationNames[key3])?void 0:_a8.name}${statusDisplay(null==(_b5=configurationNames[key3])?void 0:_b5.status)}`:`${alt||""}`}function isValidLength(len){return len>=1&&len<=5}function encodeObjectAsArray(obj){if(Array.isArray(obj))return ARRAY_MARKER+encodeAnyArray(obj,!0);const objArray=[...Object.entries(obj)].flat();return OBJECT_MARKER+encodeAnyArray(objArray,!0)}function decodeObjectFromArray(str){if(str[0]==ARRAY_MARKER)return decodeAnyArray(str.substring(1));if(str[0]==OBJECT_MARKER){const arr=decodeAnyArray(str.substring(1)),entries2=[];for(let i2=0;i2<arr.length;i2+=2){const key3=arr[i2],value=arr[i2+1];entries2.push([key3,value])}return Object.fromEntries(entries2)}return JSON.parse(str)}function encodeAnyArray(obj,safer=!1){return obj.map(v2=>{if(void 0===v2)return"u";if(null===v2)return"n";if(!1===v2)return"f";if(!0===v2)return"t";if("number"==typeof v2){const isFloat=!Number.isInteger(v2),b36=v2.toString(36),strNum=v2.toString(),expression=isFloat||b36.length>strNum.length?"n":"N",encodedStr="N"==expression?b36:strNum,len=encodedStr.length.toString(36),lenLen2=len.length;if(!isValidLength(lenLen2))throw new Error("Number length exceeds maximum encodable length of 5 in base36.");return prefixMapNumber[expression][lenLen2]+len+encodedStr}let str,prefix;if("string"==typeof v2){str=v2;prefix="s"}else{prefix="o";const objectStr=JSON.stringify(v2),containUndefined=-1!==Object.values(v2).indexOf(void 0);if(!safer||containUndefined){const objectEncoded=encodeObjectAsArray(v2);str=containUndefined||objectEncoded.length<objectStr.length?objectEncoded:objectStr}else str=objectStr}const length=str.length.toString(36),lenLen=length.length;if(!isValidLength(lenLen))throw new Error("String/Object length exceeds maximum encodable length of 5 in base36.");return prefixMapObject[prefix][lenLen]+length+str}).join("")}function isDecodeMapConstantKey(key3){return key3 in decodeMapConstant}function isDecodePrefixMapNumberKey(key3){return key3 in decodePrefixMapNumber}function isDecodePrefixMapObjectKey(key3){return key3 in decodePrefixMapObject}function decodeAnyArray(str){const result=[];let i2=0;for(;i2<str.length;){const char=str[i2];i2++;if(isDecodeMapConstantKey(char))result.push(decodeMapConstant[char]);else if(isDecodePrefixMapNumberKey(char)){const{prefix,len}=decodePrefixMapNumber[char],lenStr=str.substring(i2,i2+len);i2+=len;const lenNum=parseInt(lenStr,36),value=str.substring(i2,i2+lenNum);i2+=lenNum;"N"==prefix?result.push(parseInt(value,36)):result.push(parseFloat(value))}else{if(!isDecodePrefixMapObjectKey(char))throw new Error(`Invalid encoding at position ${i2-1}: unexpected character '${char}'`);{const{prefix,len}=decodePrefixMapObject[char],lenStr=str.substring(i2,i2+len);i2+=len;const lenNum=parseInt(lenStr,36),value=str.substring(i2,i2+lenNum);i2+=lenNum;"s"==prefix?result.push(value):result.push(decodeObjectFromArray(value))}}}return result}function extractObject(template,obj){const ret={...template};for(const key3 in ret)ret[key3]=obj[key3];return ret}function isObjectDifferent(a2,b3,ignoreUndefined=!1){if(typeof a2!=typeof b3)return!0;if("object"==typeof a2){if(null===a2||null===b3)return a2!==b3;const keys3=[...new Set([...Object.keys(a2),...Object.keys(b3)])];return ignoreUndefined?keys3.map(key3=>void 0!==(null==a2?void 0:a2[key3])&&void 0!==(null==b3?void 0:b3[key3])&&isObjectDifferent(null==a2?void 0:a2[key3],null==b3?void 0:b3[key3])).some(e3=>1==e3):keys3.map(key3=>isObjectDifferent(key3 in a2?a2[key3]:SYMBOL_A,key3 in b3?b3[key3]:SYMBOL_B)).some(e3=>1==e3)}return a2!==b3}function reactiveSource(initialValue){return _reactive({initialValue})}function reactive(expression,initialValue){return _reactive({expression,initialValue})}function resetTopologicalSortCacheFor(ids){ids.forEach(id=>topologicalSortCache.delete(id));topologicalSortCache.forEach((value,key3)=>{ids.includes(key3)||topologicalSortCache.delete(key3)})}function topologicalSort(startNode){if(topologicalSortCache.has(startNode.id)){const ref=topologicalSortCache.get(startNode.id);if(ref){const result2=ref.map(e3=>e3.instance.deref()).filter(e3=>e3);if(result2.length===ref.length)return result2}}const visited=new Set,sorted=[],recursionStack=new Set;(function visit(node){if(!visited.has(node)){if(recursionStack.has(node))throw new Error("Circular dependency detected!");visited.add(node);Line truncated
|
||||
"use strict";function cloneQuery2(query3){return Object.keys(query3).reduce((carry,paramName)=>{const param=query3[paramName];return{...carry,[paramName]:Array.isArray(param)?[...param]:param}},{})}function parseQueryString(querystring){const query3={};querystring=querystring.replace(/^\?/,"");if(querystring)for(const pair of querystring.split("&")){let[key3,value=null]=pair.split("=");key3=decodeURIComponent(key3);value&&(value=decodeURIComponent(value));key3 in query3?Array.isArray(query3[key3])?query3[key3].push(value):query3[key3]=[query3[key3],value]:query3[key3]=value}return query3}function toBase64(_input){let input;input="string"==typeof _input?fromUtf8(_input):_input;const isArrayLike="object"==typeof input&&"number"==typeof input.length,isUint8Array="object"==typeof input&&"number"==typeof input.byteOffset&&"number"==typeof input.byteLength;if(!isArrayLike&&!isUint8Array)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let str="";for(let i3=0;i3<input.length;i3+=3){let bits2=0,bitLength=0;for(let j2=i3,limit=Math.min(i3+3,input.length);j2<limit;j2++){bits2|=input[j2]<<(limit-j2-1)*bitsPerByte;bitLength+=bitsPerByte}const bitClusterCount=Math.ceil(bitLength/bitsPerLetter);bits2<<=bitClusterCount*bitsPerLetter-bitLength;for(let k2=1;k2<=bitClusterCount;k2++){const offset=(bitClusterCount-k2)*bitsPerLetter;str+=alphabetByValue[(bits2&maxLetterValue<<offset)>>offset]}str+="==".slice(0,4-bitClusterCount)}return str}function bindUint8ArrayBlobAdapter(toUtf82,fromUtf85,toBase643,fromBase643){return class Uint8ArrayBlobAdapter2 extends Uint8Array{static fromString(source2,encoding="utf-8"){if("string"==typeof source2)return"base64"===encoding?Uint8ArrayBlobAdapter2.mutate(fromBase643(source2)):Uint8ArrayBlobAdapter2.mutate(fromUtf85(source2));throw new Error(`Unsupported conversion from ${typeof source2} to Uint8ArrayBlobAdapter.`)}static mutate(source2){Object.setPrototypeOf(source2,Uint8ArrayBlobAdapter2.prototype);return source2}transformToString(encoding="utf-8"){return"base64"===encoding?toBase643(this):toUtf82(this)}}}function bindV4(getRandomValues2){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?()=>crypto.randomUUID():()=>{const rnds=new Uint8Array(16);getRandomValues2(rnds);rnds[6]=15&rnds[6]|64;rnds[8]=63&rnds[8]|128;return decimalToHex[rnds[0]]+decimalToHex[rnds[1]]+decimalToHex[rnds[2]]+decimalToHex[rnds[3]]+"-"+decimalToHex[rnds[4]]+decimalToHex[rnds[5]]+"-"+decimalToHex[rnds[6]]+decimalToHex[rnds[7]]+"-"+decimalToHex[rnds[8]]+decimalToHex[rnds[9]]+"-"+decimalToHex[rnds[10]]+decimalToHex[rnds[11]]+decimalToHex[rnds[12]]+decimalToHex[rnds[13]]+decimalToHex[rnds[14]]+decimalToHex[rnds[15]]}}function dateToUtcString(date2){const year2=date2.getUTCFullYear(),month=date2.getUTCMonth(),dayOfWeek=date2.getUTCDay(),dayOfMonthInt=date2.getUTCDate(),hoursInt=date2.getUTCHours(),minutesInt=date2.getUTCMinutes(),secondsInt=date2.getUTCSeconds(),dayOfMonthString=dayOfMonthInt<10?`0${dayOfMonthInt}`:`${dayOfMonthInt}`,hoursString=hoursInt<10?`0${hoursInt}`:`${hoursInt}`,minutesString=minutesInt<10?`0${minutesInt}`:`${minutesInt}`,secondsString=secondsInt<10?`0${secondsInt}`:`${secondsInt}`;return`${DAYS[dayOfWeek]}, ${dayOfMonthString} ${MONTHS[month]} ${year2} ${hoursString}:${minutesString}:${secondsString} GMT`}function quoteHeader(part){(part.includes(",")||part.includes('"'))&&(part=`"${part.replace(/"/g,'\\"')}"`);return part}function range3(v2,min2,max3){const _v=Number(v2);if(_v<min2||_v>max3)throw new Error(`Value ${_v} out of range [${min2}, ${max3}]`)}function splitEvery(value,delimiter,numDelimiters){if(numDelimiters<=0||!Number.isInteger(numDelimiters))throw new Error("Invalid number of delimiters ("+numDelimiters+") for splitEvery.");const segments=value.split(delimiter);if(1===numDelimiters)return segments;const compoundSegments=[];let currentSegment="";for(let i3=0;i3<segments.length;i3++){""===currentSegment?currentSegment=segments[i3]:currentSegment+=delimiter+segments[i3];if((i3+1)%numDelimiters===0){compoundSegments.push(currentSegment);currentSegment=""}}""!==currentSegment&&compoundSegments.push(currentSegment);return compoundSegments}function fromHex(encoded){if(encoded.length%2!=0)throw new Error("Hex encoded strings must have an even number length");const out=new Uint8Array(encoded.length/2);for(let i3=0;i3<encoded.length;i3+=2){const encodedByte=encoded.slice(i3,i3+2).toLowerCase();if(!(encodedByte in HEX_TO_SHORT))throw new Error(`Cannot decode unrecognized sequence ${encodedByte} as hexadecimal`);out[i3/2]=HEX_TO_SHORT[encodedByte]}return out}function toHex2(bytes){let out="";for(let i3=0;i3<bytes.byteLength;i3++)out+=SHORT_TO_HEX[bytes[i3]];return out}function bindGetEndpointFromInstructions(getEndpointFromConfig3){return async(commandInput,instructionsSupplier,clientConfig,context2)=>{if(!clientConfig.isCustomEndpoint){let endpointFromConfig;endpointFromConfig=clientConfig.serviceConfiguredEndpoint?awLine truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
octagonal-wheels/dist/encoding/encodeobject.js:
|
||||
@@ -15,5 +15,5 @@ octagonal-wheels/dist/encoding/encodeobject.js:
|
||||
octagonal-wheels/dist/encryption/hkdf.js:
|
||||
(* istanbul ignore if -- @preserve *)
|
||||
(* istanbul ignore next -- @preserve *)
|
||||
*/__export(event_streams_exports,{EventStreamSerde:()=>EventStreamSerde});init_event_streams=__esm({"node_modules/@smithy/core/dist-es/submodules/event-streams/index.js"(){init_EventStreamSerde()}});require_events=__commonJS({"node_modules/events/events.js"(exports,module2){"use strict";function ProcessEmitWarning(warning){console&&console.warn&&console.warn(warning)}function EventEmitter2(){EventEmitter2.init.call(this)}function checkListener(listener){if("function"!=typeof listener)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof listener)}function _getMaxListeners(that){return void 0===that._maxListeners?EventEmitter2.defaultMaxListeners:that._maxListeners}function _addListener(target,type,listener,prepend){var m3,events,existing,w2;checkListener(listener);if(void 0===(events=target._events)){events=target._events=Object.create(null);target._eventsCount=0}else{if(void 0!==events.newListener){target.emit("newListener",type,listener.listener?listener.listener:listener);events=target._events}existing=events[type]}if(void 0===existing){existing=events[type]=listener;++target._eventsCount}else{"function"==typeof existing?existing=events[type]=prepend?[listener,existing]:[existing,listener]:prepend?existing.unshift(listener):existing.push(listener);if((m3=_getMaxListeners(target))>0&&existing.length>m3&&!existing.warned){existing.warned=!0;(w2=new Error("Possible EventEmitter memory leak detected. "+existing.length+" "+String(type)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning";w2.emitter=target;w2.type=type;w2.count=existing.length;ProcessEmitWarning(w2)}}return target}function onceWrapper(){if(!this.fired){this.target.removeListener(this.type,this.wrapFn);this.fired=!0;return 0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}}function _onceWrap(target,type,listener){var state2={fired:!1,wrapFn:void 0,target,type,listener},wrapped=onceWrapper.bind(state2);wrapped.listener=listener;state2.wrapFn=wrapped;return wrapped}function _listeners2(target,type,unwrap2){var evlistener,events=target._events;return void 0===events||void 0===(evlistener=events[type])?[]:"function"==typeof evlistener?unwrap2?[evlistener.listener||evlistener]:[evlistener]:unwrap2?unwrapListeners(evlistener):arrayClone(evlistener,evlistener.length)}function listenerCount2(type){var evlistener,events=this._events;if(void 0!==events){if("function"==typeof(evlistener=events[type]))return 1;if(void 0!==evlistener)return evlistener.length}return 0}function arrayClone(arr,n3){var i2,copy=new Array(n3);for(i2=0;i2<n3;++i2)copy[i2]=arr[i2];return copy}function spliceOne(list,index6){for(;index6+1<list.length;index6++)list[index6]=list[index6+1];list.pop()}function unwrapListeners(arr){var i2,ret=new Array(arr.length);for(i2=0;i2<ret.length;++i2)ret[i2]=arr[i2].listener||arr[i2];return ret}function addErrorHandlerIfEventEmitter(emitter,handler,flags2){"function"==typeof emitter.on&&eventTargetAgnosticAddListener(emitter,"error",handler,flags2)}function eventTargetAgnosticAddListener(emitter,name,listener,flags2){if("function"==typeof emitter.on)flags2.once?emitter.once(name,listener):emitter.on(name,listener);else{if("function"!=typeof emitter.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof emitter);emitter.addEventListener(name,function wrapListener(arg){flags2.once&&emitter.removeEventListener(name,wrapListener);listener(arg)})}}var ReflectOwnKeys,NumberIsNaN,defaultMaxListeners,R2="object"==typeof Reflect?Reflect:null,ReflectApply=R2&&"function"==typeof R2.apply?R2.apply:function ReflectApply2(target,receiver,args){return Function.prototype.apply.call(target,receiver,args)};ReflectOwnKeys=R2&&"function"==typeof R2.ownKeys?R2.ownKeys:Object.getOwnPropertySymbols?function ReflectOwnKeys2(target){return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target))}:function ReflectOwnKeys2(target){return Object.getOwnPropertyNames(target)};NumberIsNaN=Number.isNaN||function NumberIsNaN2(value){return value!=value};module2.exports=EventEmitter2;module2.exports.once=function once3(emitter,name){return new Promise(function(resolve,reject){function errorListener(err3){emitter.removeListener(name,resolver2);reject(err3)}function resolver2(){"function"==typeof emitter.removeListener&&emitter.removeListener("error",errorListener);resolve([].slice.call(arguments))}eventTargetAgnosticAddListener(emitter,name,resolver2,{once:!0});"error"!==name&&addErrorHandlerIfEventEmitter(emitter,errorListener,{once:!0})})};EventEmitter2.EventEmitter=EventEmitter2;EventEmitter2.prototype._events=void 0;EventEmitter2.prototype._eventsCount=0;EventEmitter2.prototype._maxListeners=void 0;defaultMaxListeners=10;Object.defineProperty(EventEmitter2,"defaultMaxListeners",{enumerable:!0,get:function(){return defaultMaxListeners},set:function(arg){if("numLine truncated
|
||||
*/__export(index_browser_exports,{EventStreamCodec:()=>EventStreamCodec,EventStreamMarshaller:()=>EventStreamMarshaller2,EventStreamSerde:()=>EventStreamSerde,HeaderMarshaller:()=>HeaderMarshaller,Int64:()=>Int64,MessageDecoderStream:()=>MessageDecoderStream,MessageEncoderStream:()=>MessageEncoderStream,SmithyMessageDecoderStream:()=>SmithyMessageDecoderStream,SmithyMessageEncoderStream:()=>SmithyMessageEncoderStream,UniversalEventStreamMarshaller:()=>EventStreamMarshaller,eventStreamSerdeProvider:()=>eventStreamSerdeProvider2,getChunkedStream:()=>getChunkedStream,getMessageUnmarshaller:()=>getMessageUnmarshaller,getUnmarshalledStream:()=>getUnmarshalledStream,iterableToReadableStream:()=>iterableToReadableStream,readableStreamToIterable:()=>readableStreamToIterable,resolveEventStreamSerdeConfig:()=>resolveEventStreamSerdeConfig,universalEventStreamSerdeProvider:()=>eventStreamSerdeProvider});init_index_browser3=__esm({"node_modules/@smithy/core/dist-es/submodules/event-streams/index.browser.js"(){init_EventStreamCodec();init_HeaderMarshaller();init_Int64();init_MessageDecoderStream();init_MessageEncoderStream();init_SmithyMessageDecoderStream();init_SmithyMessageEncoderStream();init_EventStreamMarshaller_browser();init_utils();init_EventStreamMarshaller();init_getChunkedStream();init_getUnmarshalledStream();init_EventStreamSerdeConfig();init_EventStreamSerde()}});require_spark_md5=__commonJS({"node_modules/spark-md5/spark-md5.js"(exports,module2){(function(factory){if("object"==typeof exports)module2.exports=factory();else if("function"==typeof define&&define.amd)define(factory);else{var glob;try{glob=window}catch(e3){glob=self}glob.SparkMD5=factory()}})(function(undefined2){"use strict";function md5cycle(x3,k2){var a2=x3[0],b3=x3[1],c3=x3[2],d4=x3[3];a2+=(b3&c3|~b3&d4)+k2[0]-680876936|0;a2=(a2<<7|a2>>>25)+b3|0;d4+=(a2&b3|~a2&c3)+k2[1]-389564586|0;d4=(d4<<12|d4>>>20)+a2|0;c3+=(d4&a2|~d4&b3)+k2[2]+606105819|0;c3=(c3<<17|c3>>>15)+d4|0;b3+=(c3&d4|~c3&a2)+k2[3]-1044525330|0;b3=(b3<<22|b3>>>10)+c3|0;a2+=(b3&c3|~b3&d4)+k2[4]-176418897|0;a2=(a2<<7|a2>>>25)+b3|0;d4+=(a2&b3|~a2&c3)+k2[5]+1200080426|0;d4=(d4<<12|d4>>>20)+a2|0;c3+=(d4&a2|~d4&b3)+k2[6]-1473231341|0;c3=(c3<<17|c3>>>15)+d4|0;b3+=(c3&d4|~c3&a2)+k2[7]-45705983|0;b3=(b3<<22|b3>>>10)+c3|0;a2+=(b3&c3|~b3&d4)+k2[8]+1770035416|0;a2=(a2<<7|a2>>>25)+b3|0;d4+=(a2&b3|~a2&c3)+k2[9]-1958414417|0;d4=(d4<<12|d4>>>20)+a2|0;c3+=(d4&a2|~d4&b3)+k2[10]-42063|0;c3=(c3<<17|c3>>>15)+d4|0;b3+=(c3&d4|~c3&a2)+k2[11]-1990404162|0;b3=(b3<<22|b3>>>10)+c3|0;a2+=(b3&c3|~b3&d4)+k2[12]+1804603682|0;a2=(a2<<7|a2>>>25)+b3|0;d4+=(a2&b3|~a2&c3)+k2[13]-40341101|0;d4=(d4<<12|d4>>>20)+a2|0;c3+=(d4&a2|~d4&b3)+k2[14]-1502002290|0;c3=(c3<<17|c3>>>15)+d4|0;b3+=(c3&d4|~c3&a2)+k2[15]+1236535329|0;b3=(b3<<22|b3>>>10)+c3|0;a2+=(b3&d4|c3&~d4)+k2[1]-165796510|0;a2=(a2<<5|a2>>>27)+b3|0;d4+=(a2&c3|b3&~c3)+k2[6]-1069501632|0;d4=(d4<<9|d4>>>23)+a2|0;c3+=(d4&b3|a2&~b3)+k2[11]+643717713|0;c3=(c3<<14|c3>>>18)+d4|0;b3+=(c3&a2|d4&~a2)+k2[0]-373897302|0;b3=(b3<<20|b3>>>12)+c3|0;a2+=(b3&d4|c3&~d4)+k2[5]-701558691|0;a2=(a2<<5|a2>>>27)+b3|0;d4+=(a2&c3|b3&~c3)+k2[10]+38016083|0;d4=(d4<<9|d4>>>23)+a2|0;c3+=(d4&b3|a2&~b3)+k2[15]-660478335|0;c3=(c3<<14|c3>>>18)+d4|0;b3+=(c3&a2|d4&~a2)+k2[4]-405537848|0;b3=(b3<<20|b3>>>12)+c3|0;a2+=(b3&d4|c3&~d4)+k2[9]+568446438|0;a2=(a2<<5|a2>>>27)+b3|0;d4+=(a2&c3|b3&~c3)+k2[14]-1019803690|0;d4=(d4<<9|d4>>>23)+a2|0;c3+=(d4&b3|a2&~b3)+k2[3]-187363961|0;c3=(c3<<14|c3>>>18)+d4|0;b3+=(c3&a2|d4&~a2)+k2[8]+1163531501|0;b3=(b3<<20|b3>>>12)+c3|0;a2+=(b3&d4|c3&~d4)+k2[13]-1444681467|0;a2=(a2<<5|a2>>>27)+b3|0;d4+=(a2&c3|b3&~c3)+k2[2]-51403784|0;d4=(d4<<9|d4>>>23)+a2|0;c3+=(d4&b3|a2&~b3)+k2[7]+1735328473|0;c3=(c3<<14|c3>>>18)+d4|0;b3+=(c3&a2|d4&~a2)+k2[12]-1926607734|0;b3=(b3<<20|b3>>>12)+c3|0;a2+=(b3^c3^d4)+k2[5]-378558|0;a2=(a2<<4|a2>>>28)+b3|0;d4+=(a2^b3^c3)+k2[8]-2022574463|0;d4=(d4<<11|d4>>>21)+a2|0;c3+=(d4^a2^b3)+k2[11]+1839030562|0;c3=(c3<<16|c3>>>16)+d4|0;b3+=(c3^d4^a2)+k2[14]-35309556|0;b3=(b3<<23|b3>>>9)+c3|0;a2+=(b3^c3^d4)+k2[1]-1530992060|0;a2=(a2<<4|a2>>>28)+b3|0;d4+=(a2^b3^c3)+k2[4]+1272893353|0;d4=(d4<<11|d4>>>21)+a2|0;c3+=(d4^a2^b3)+k2[7]-155497632|0;c3=(c3<<16|c3>>>16)+d4|0;b3+=(c3^d4^a2)+k2[10]-1094730640|0;b3=(b3<<23|b3>>>9)+c3|0;a2+=(b3^c3^d4)+k2[13]+681279174|0;a2=(a2<<4|a2>>>28)+b3|0;d4+=(a2^b3^c3)+k2[0]-358537222|0;d4=(d4<<11|d4>>>21)+a2|0;c3+=(d4^a2^b3)+k2[3]-722521979|0;c3=(c3<<16|c3>>>16)+d4|0;b3+=(c3^d4^a2)+k2[6]+76029189|0;b3=(b3<<23|b3>>>9)+c3|0;a2+=(b3^c3^d4)+k2[9]-640364487|0;a2=(a2<<4|a2>>>28)+b3|0;d4+=(a2^b3^c3)+k2[12]-421815835|0;d4=(d4<<11|d4>>>21)+a2|0;c3+=(d4^a2^b3)+k2[15]+530742520|0;c3=(c3<<16|c3>>>16)+d4|0;b3+=(c3^d4^a2)+k2[2]-995338651|0;b3=(b3<<23|b3>>>9)+c3|0;a2+=(c3^(b3|~d4))+k2[0]-198630844|0;a2=(a2<<6|a2>>>26)+b3|0;d4+=(b3^(a2|~c3))+k2[7]+1126891415|0;d4=(d4<<10|d4>>>22)+a2|0;c3+=(a2^(d4|~b3))+k2[14]-1416354905|0;c3=(c3<<15|c3>>>17)+d4|0;b3+=(d4^(c3|~a2))+k2[5]-57434055|0;b3=(b3<<21|b3>>>11)+c3|0;a2+=(c3^(b3|~d4))+k2[12]+1700485571|0;a2=(a2<<6|a2>>>2Line truncated
|
||||
/* nosourcemap */
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"id": "obsidian-livesync",
|
||||
"name": "Self-hosted LiveSync",
|
||||
"version": "0.25.57",
|
||||
"minAppVersion": "0.9.12",
|
||||
"version": "1.0.32",
|
||||
"minAppVersion": "1.7.2",
|
||||
"description": "Community implementation of self-hosted livesync. Reflect your vault changes to some other devices immediately. Please make sure to disable other synchronize solutions to avoid content corruption or duplication.",
|
||||
"author": "vorotamoroz",
|
||||
"authorUrl": "https://github.com/vrtmrz",
|
||||
|
||||
+392
-38
@@ -12,11 +12,28 @@
|
||||
background-color: var(--text-muted);
|
||||
}
|
||||
|
||||
.vpk-action-dialog__message {
|
||||
user-select: text;
|
||||
-webkit-user-select: text;
|
||||
}
|
||||
|
||||
.conflict-dev-name {
|
||||
display: inline-block;
|
||||
min-width: 5em;
|
||||
}
|
||||
|
||||
.conflict-action-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--size-4-2);
|
||||
margin-top: var(--size-4-2);
|
||||
}
|
||||
|
||||
.conflict-action-button {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.op-scrollable {
|
||||
overflow-y: scroll;
|
||||
/* min-height: 280px; */
|
||||
@@ -134,8 +151,8 @@ div.sls-setting-menu-btn {
|
||||
/* width: 100%; */
|
||||
}
|
||||
|
||||
.sls-setting-tab:hover~div.sls-setting-menu-btn,
|
||||
.sls-setting-label.selected .sls-setting-tab:checked~div.sls-setting-menu-btn {
|
||||
.sls-setting-tab:hover ~ div.sls-setting-menu-btn,
|
||||
.sls-setting-label.selected .sls-setting-tab:checked ~ div.sls-setting-menu-btn {
|
||||
background-color: var(--interactive-accent);
|
||||
color: var(--text-on-accent);
|
||||
}
|
||||
@@ -167,16 +184,23 @@ body {
|
||||
|
||||
.sls-setting-menu-buttons {
|
||||
border: 1px solid var(--sls-col-warn);
|
||||
padding: 2px;
|
||||
/* padding: 2px; */
|
||||
margin: 1px;
|
||||
border-radius: 4px;
|
||||
background-image: linear-gradient(-45deg,
|
||||
var(--sls-col-warn-stripe1) 25%, var(--sls-col-warn-stripe2) 25%, var(--sls-col-warn-stripe2) 50%,
|
||||
var(--sls-col-warn-stripe1) 50%, var(--sls-col-warn-stripe1) 75%, var(--sls-col-warn-stripe2) 75%, var(--sls-col-warn-stripe2));
|
||||
background-image: linear-gradient(
|
||||
-45deg,
|
||||
var(--sls-col-warn-stripe1) 25%,
|
||||
var(--sls-col-warn-stripe2) 25%,
|
||||
var(--sls-col-warn-stripe2) 50%,
|
||||
var(--sls-col-warn-stripe1) 50%,
|
||||
var(--sls-col-warn-stripe1) 75%,
|
||||
var(--sls-col-warn-stripe2) 75%,
|
||||
var(--sls-col-warn-stripe2)
|
||||
);
|
||||
background-size: 30px 30px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
/* justify-content: flex-end; */
|
||||
padding: 0.5em 0.25em;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
@@ -192,7 +216,6 @@ body {
|
||||
100% {
|
||||
background-position: 30px 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.sls-setting-menu-buttons label {
|
||||
@@ -276,14 +299,6 @@ body {
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.isWizard .wizardHidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sls-setting:not(.isWizard) .wizardOnly {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sls-item-dirty::before {
|
||||
content: "✏";
|
||||
}
|
||||
@@ -292,37 +307,106 @@ body {
|
||||
content: " ❓";
|
||||
}
|
||||
|
||||
.sls-item-invalid-value {
|
||||
background-color: rgba(var(--background-modifier-error-rgb), 0.3) !important;
|
||||
.sls-setting .setting-item-control input.sls-item-invalid-value,
|
||||
.sls-setting .setting-item-control textarea.sls-item-invalid-value {
|
||||
background-color: rgba(var(--background-modifier-error-rgb), 0.3);
|
||||
}
|
||||
|
||||
.sls-setting-disabled input[type=text],
|
||||
.sls-setting-disabled input[type=number],
|
||||
.sls-setting-disabled input[type=password] {
|
||||
.sls-setting-disabled input[type="text"],
|
||||
.sls-setting-disabled input[type="number"],
|
||||
.sls-setting-disabled input[type="password"] {
|
||||
filter: brightness(80%);
|
||||
color: var(--text-muted);
|
||||
|
||||
}
|
||||
|
||||
.sls-setting-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.sls-setting-obsolete {
|
||||
background-image: linear-gradient(-45deg,
|
||||
/* background-image: linear-gradient(-45deg,
|
||||
var(--sls-col-warn-stripe1) 25%, var(--sls-col-warn-stripe2) 25%, var(--sls-col-warn-stripe2) 50%,
|
||||
var(--sls-col-warn-stripe1) 50%, var(--sls-col-warn-stripe1) 75%, var(--sls-col-warn-stripe2) 75%, var(--sls-col-warn-stripe2));
|
||||
background-image: linear-gradient(-45deg,
|
||||
transparent 25%, rgba(var(--background-secondary), 0.1) 25%, rgba(var(--background-secondary), 0.1) 50%, transparent 50%, transparent 75%, rgba(var(--background-secondary), 0.1) 75%, rgba(var(--background-secondary), 0.1));
|
||||
var(--sls-col-warn-stripe1) 50%, var(--sls-col-warn-stripe1) 75%, var(--sls-col-warn-stripe2) 75%, var(--sls-col-warn-stripe2)); */
|
||||
background-image: linear-gradient(
|
||||
-45deg,
|
||||
transparent 25%,
|
||||
rgba(var(--background-secondary), 0.1) 25%,
|
||||
rgba(var(--background-secondary), 0.1) 50%,
|
||||
transparent 50%,
|
||||
transparent 75%,
|
||||
rgba(var(--background-secondary), 0.1) 75%,
|
||||
rgba(var(--background-secondary), 0.1)
|
||||
);
|
||||
background-size: 60px 60px;
|
||||
}
|
||||
|
||||
.password-input>.setting-item-control>input {
|
||||
.password-input > .setting-item-control > input {
|
||||
-webkit-text-security: disc;
|
||||
}
|
||||
|
||||
.sls-onboarding-invitation-action {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* Touch devices need a larger tap target; on desktop this would just pad the
|
||||
link with blank space and make it look like a misplaced button. */
|
||||
body.is-mobile .sls-onboarding-invitation-action {
|
||||
display: inline-flex;
|
||||
min-width: 44px;
|
||||
min-height: 44px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.sls-review-harness {
|
||||
box-sizing: border-box;
|
||||
max-width: 100%;
|
||||
overflow-x: clip;
|
||||
padding-bottom: max(1rem, env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.sls-review-harness .setting-item,
|
||||
.sls-review-harness .setting-item-control {
|
||||
flex-wrap: wrap;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.sls-review-harness .setting-item-info {
|
||||
min-width: min(16rem, 100%);
|
||||
}
|
||||
|
||||
.sls-review-harness .setting-item-control {
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.sls-review-harness button {
|
||||
min-height: 44px;
|
||||
max-width: 100%;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.sls-review-harness__result,
|
||||
.sls-review-harness__warning,
|
||||
.sls-review-harness__privacy,
|
||||
.sls-review-harness__error,
|
||||
.sls-review-harness__resumed {
|
||||
max-width: 100%;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.sls-review-harness__result {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
.sls-review-harness__warning,
|
||||
.sls-review-harness__error {
|
||||
color: var(--text-error);
|
||||
}
|
||||
|
||||
.sls-review-harness__resumed {
|
||||
color: var(--text-success);
|
||||
}
|
||||
|
||||
span.ls-mark-cr::after {
|
||||
user-select: none;
|
||||
content: "↲";
|
||||
@@ -373,7 +457,6 @@ span.ls-mark-cr::after {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.livesync-status {
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
@@ -396,18 +479,30 @@ span.ls-mark-cr::after {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
div.workspace-leaf-content[data-type=bases] .livesync-status {
|
||||
.is-mobile.is-ios .livesync-status {
|
||||
box-sizing: border-box;
|
||||
top: calc(var(--header-height) + var(--view-header-height, var(--header-height)) + var(--size-4-2));
|
||||
}
|
||||
|
||||
div.workspace-leaf-content[data-type="bases"] .livesync-status {
|
||||
top: calc(var(--bases-header-height) + var(--header-height));
|
||||
padding: 5px;
|
||||
padding-right: 18px;
|
||||
}
|
||||
|
||||
.is-mobile div.workspace-leaf-content[data-type=bases] .livesync-status {
|
||||
.is-mobile div.workspace-leaf-content[data-type="bases"] .livesync-status {
|
||||
top: calc(var(--bases-header-height) + var(--view-header-height));
|
||||
padding: 6px;
|
||||
padding-right: 18px;
|
||||
}
|
||||
|
||||
.is-mobile.is-ios div.workspace-leaf-content[data-type="bases"] .livesync-status {
|
||||
top: calc(
|
||||
var(--bases-header-height) + var(--header-height) + var(--view-header-height, var(--header-height)) +
|
||||
var(--size-4-2)
|
||||
);
|
||||
}
|
||||
|
||||
.livesync-status div {
|
||||
opacity: 0.6;
|
||||
-webkit-filter: grayscale(100%);
|
||||
@@ -417,7 +512,6 @@ div.workspace-leaf-content[data-type=bases] .livesync-status {
|
||||
.livesync-status .livesync-status-loghistory {
|
||||
text-align: left;
|
||||
opacity: 0.4;
|
||||
|
||||
}
|
||||
|
||||
.livesync-status div.livesync-status-messagearea:empty {
|
||||
@@ -435,7 +529,6 @@ div.workspace-leaf-content[data-type=bases] .livesync-status {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
|
||||
.menu-setting-poweruser-disabled .sls-setting-poweruser {
|
||||
display: none;
|
||||
}
|
||||
@@ -449,12 +542,29 @@ div.workspace-leaf-content[data-type=bases] .livesync-status {
|
||||
}
|
||||
|
||||
.sls-setting-panel-title {
|
||||
position: sticky;
|
||||
font-size: medium;
|
||||
top: 2.5em;
|
||||
background-color: var(--background-secondary-alt);
|
||||
border-radius: 10px;
|
||||
padding: 0.5em 1.0em;
|
||||
padding: 0.5em 1em;
|
||||
}
|
||||
|
||||
body.is-mobile .sls-setting button {
|
||||
max-width: 100%;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
body.is-mobile .sls-setting-with-additional-actions {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
body.is-mobile .sls-setting-with-additional-actions .setting-item-control {
|
||||
min-width: 0;
|
||||
flex: 1 1 100%;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
body.is-mobile .sls-setting .sls-setting-additional-action {
|
||||
flex: 1 1 12rem;
|
||||
}
|
||||
|
||||
.active-pane .sls-setting-panel-title {
|
||||
@@ -471,6 +581,34 @@ div.workspace-leaf-content[data-type=bases] .livesync-status {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
body.is-mobile .livesync-message-box-container {
|
||||
box-sizing: border-box;
|
||||
padding-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
|
||||
padding-right: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
|
||||
padding-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
|
||||
padding-left: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
|
||||
}
|
||||
|
||||
body.is-mobile .livesync-message-box-container .modal {
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
body.is-mobile .livesync-message-box-container button {
|
||||
height: auto;
|
||||
min-height: var(--input-height);
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
body.is-mobile .livesync-compatibility-review-notice {
|
||||
box-sizing: border-box;
|
||||
margin-right: calc(64px + var(--safe-area-inset-right, env(safe-area-inset-right, 0px)));
|
||||
min-width: 0;
|
||||
width: calc(
|
||||
100vw - 88px - var(--safe-area-inset-left, env(safe-area-inset-left, 0px)) -
|
||||
var(--safe-area-inset-right, env(safe-area-inset-right, 0px))
|
||||
);
|
||||
}
|
||||
|
||||
.sls-qr {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
@@ -483,5 +621,221 @@ div.workspace-leaf-content[data-type=bases] .livesync-status {
|
||||
overflow-x: auto;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
}
|
||||
.sls-repair-results {
|
||||
display: grid;
|
||||
gap: var(--size-4-3);
|
||||
}
|
||||
|
||||
.sls-repair-result {
|
||||
padding: var(--size-4-3);
|
||||
border: 1px solid var(--background-modifier-border);
|
||||
border-radius: var(--radius-m);
|
||||
background: var(--background-secondary);
|
||||
}
|
||||
|
||||
.sls-repair-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: var(--size-4-2);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.sls-repair-header > :first-child {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.sls-repair-header h6 {
|
||||
margin: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.sls-repair-status {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--size-4-2);
|
||||
margin-top: var(--size-4-1);
|
||||
font-size: var(--font-ui-smaller);
|
||||
}
|
||||
|
||||
.sls-repair-status-ok {
|
||||
color: var(--text-success);
|
||||
}
|
||||
|
||||
.sls-repair-status-warning {
|
||||
color: var(--text-warning);
|
||||
}
|
||||
|
||||
.sls-repair-metric {
|
||||
margin-top: var(--size-4-1);
|
||||
font-size: var(--font-ui-smaller);
|
||||
line-height: var(--line-height-tight);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.sls-repair-action-menu {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: var(--clickable-icon-size);
|
||||
width: var(--clickable-icon-size);
|
||||
height: var(--clickable-icon-size);
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.sls-repair-action-menu .svg-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.sls-repair-revision {
|
||||
margin-top: var(--size-4-2);
|
||||
padding: var(--size-4-2);
|
||||
border-left: 3px solid var(--background-modifier-border);
|
||||
background: var(--background-primary-alt);
|
||||
}
|
||||
|
||||
.sls-repair-revision-title {
|
||||
font-weight: var(--font-semibold);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.sls-repair-revision code {
|
||||
display: block;
|
||||
margin-top: var(--size-4-1);
|
||||
overflow-wrap: anywhere;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.sls-repair-ancestor-warning {
|
||||
margin-top: var(--size-4-2);
|
||||
color: var(--text-warning);
|
||||
}
|
||||
|
||||
/* Diff navigation */
|
||||
.diff-options-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.diff-nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.diff-nav-btn {
|
||||
padding: 2px 8px;
|
||||
font-size: 0.85em;
|
||||
cursor: pointer;
|
||||
border: 1px solid var(--background-modifier-border);
|
||||
border-radius: 4px;
|
||||
background-color: var(--background-secondary);
|
||||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
.diff-nav-btn:hover {
|
||||
background-color: var(--background-modifier-hover);
|
||||
}
|
||||
|
||||
.diff-nav-indicator {
|
||||
font-size: 0.85em;
|
||||
color: var(--text-muted);
|
||||
min-width: 3em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.diff-only-label {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.history-search-row {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.history-search-input {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.history-search-result-indicator {
|
||||
font-size: 0.8em;
|
||||
min-width: 80px;
|
||||
}
|
||||
|
||||
.history-search-progress-indicator {
|
||||
font-size: 0.8em;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.history-search-row button:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.history-rev-nav-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.history-rev-nav-row input[type="range"] {
|
||||
flex-grow: 1;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.history-rev-nav-btn {
|
||||
flex-shrink: 0;
|
||||
padding: 2px 10px;
|
||||
font-size: 0.9em;
|
||||
cursor: pointer;
|
||||
border: 1px solid var(--background-modifier-border);
|
||||
border-radius: 4px;
|
||||
background-color: var(--background-secondary);
|
||||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
.history-rev-nav-btn:hover:not(:disabled) {
|
||||
background-color: var(--background-modifier-hover);
|
||||
}
|
||||
|
||||
.history-rev-nav-btn:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.history-rev-indicator {
|
||||
flex-shrink: 0;
|
||||
font-size: 0.85em;
|
||||
color: var(--text-muted);
|
||||
min-width: 4.5em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.history-diff-options-row {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.history-highlight-diff-container,
|
||||
.history-highlight-diff-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.history-highlight-diff-label {
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.diff-focused {
|
||||
outline: 2px solid var(--interactive-accent);
|
||||
outline-offset: 1px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
+68
-68
@@ -1,4 +1,4 @@
|
||||
var Bt=Object.defineProperty;var rr=Object.getOwnPropertyDescriptor;var or=Object.getOwnPropertyNames;var ar=Object.prototype.hasOwnProperty;var lr=(s,e,t)=>e in s?Bt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var _n=(s,e)=>{for(var t in e)Bt(s,t,{get:e[t],enumerable:!0})},cr=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of or(e))!ar.call(s,i)&&i!==t&&Bt(s,i,{get:()=>e[i],enumerable:!(n=rr(e,i))||n.enumerable});return s};var ur=s=>cr(Bt({},"__esModule",{value:!0}),s);var Se=(s,e,t)=>(lr(s,typeof e!="symbol"?e+"":e,t),t);var Io={};_n(Io,{default:()=>Ps});module.exports=ur(Io);var I=require("obsidian");var B=typeof queueMicrotask=="function"?queueMicrotask:(s=>e=>s.then(e))(Promise.resolve());function Fe(s,e){return new $s(s,e)}var $s=class{constructor(e,t){this.reap=e,this.sched=t,this._flags=0,this.q=new Set,this._run=()=>{this._flags&=-3,this.flush()},this.flush=()=>{if(this._flags&1)return;let{q:n}=this;if(n.size){this._flags|=1;try{this.reap(n)}finally{this._flags&=-2,!n.size||this._flags&2||this._sched()}}}}isRunning(){return!!(this._flags&1)}isEmpty(){return!this.q.size}add(e){this.q.size||this._flags&3||this._sched(),this.q.add(e)}delete(e){this.q.delete(e)}has(e){return this.q.has(e)}_sched(){this._flags|=2,(this.sched||B)(this._run)}};var fr=Array.isArray;function tt(s,e,t){return s.set(e,t),t}function K(s){return typeof s=="function"}var Bs=(()=>{function s(e){return Object.setPrototypeOf(e,new.target.prototype)}return s.prototype=Function.prototype,s})(),Ie=Reflect.apply,Ds=(()=>{function s(){}return s.prototype=function*(){}.constructor.prototype.prototype,s})();function Bn(s){return s.bind(null,"next")}function Dn(s){return s.bind(null,"throw",void 0)}function st(){}function Fs(s,e,t){return{op:s,val:e,err:t}}var qt=Object.freeze(Fs("cancel"));function jn(s){return Fs("next",s)}function Rn(s){return Fs("throw",void 0,s)}function Ks(s){return s===qt}function Ut(s){return s?s.op==="next":!1}function Pe(s){return s?s.op==="throw":!1}function js(s){return Pe(s)&&s.val===void 0}function xe(s){return s.val=null,s.err}function qn(s){if(Ut(s))return s.val;s.op,nt(st,e=>{throw e},s)}function nt(s,e,t){Pe(t)?e(xe(t)):Ks(t)?e(new Ft("Job canceled")):s(t.val)}function Fn(s,e){s.result()||nt(s.return.bind(s),s.throw.bind(s),e)}var Ft=class extends Error{},U=he();function P(s){let e=U;return U=s,e}var Dt=[];function he(s,e){if(Dt&&Dt.length){let t=Dt.pop();return t.job=s,t.cell=e,t}return{job:s,cell:e}}function Rs(s){s.job=s.cell=null,Dt.push(s)}var Ke=new WeakMap,Kn=s=>{Promise.reject(s)},Vs=he(),xn=new WeakMap,Vn=Fe(s=>{for(let e of s)s.delete(e),e.doPull()},B);function Pn(){return Jt(0,void 0,void 0)}function hr(s){for(;s.v;)Vt(s,s.n);s.u=void 0,Vt(s,s)}function dr(s,e){++s.v,Jt(e,s.n,s)}function pr(s,e){++s.v,Jt(e,s,s.p)}function mr(s,e){return++s.v,wr(s,Jt(e,s,s.p))}function gr(s){return!s||s.v===0}function Un(s){return s?s.v:0}function yr(s){if(Un(s))return Vt(s,s.p)}var qs=class{constructor(){this.n=this,this.p=this,this.v=void 0,this.u=void 0}},Kt;function Jt(s,e,t){let n=Kt;return n?(Kt=n.n,n.n=e||n,n.p=t||n):(n=new qs,e&&(n.n=e),t&&(n.p=t)),n.v=s,n.n.p=n,n.p.n=n,n}function Vt(s,e){--s.v;var t=e.v,n=e.u;return e.n&&(e.n.p=e.p),e.p&&(e.p.n=e.n),e.u=e.v=e.p=void 0,e.n=Kt,Kt=e,n&&n(),t}function wr(s,e){let t=e.u||(e.u=()=>{t&&(t===e.u&&Vt(s,e),t=s=e=void 0)});return t}function Me(){var e;let s=U.job||((e=U.cell)==null?void 0:e.getJob());if(s)return s;throw new Error("No job is currently active")}function br(s){return e=>{U.job.must(s.release(e))}}function Mn(s,e){for(;Un(e);)try{yr(e)(s)}catch(t){it.asyncThrow(t)}e&&hr(e)}var ie=new Set,_e=class{constructor(){this.end=()=>{let e=this._done||(this._done=qt),t=this._cbs;if(!t&&!js(e))return;let n=ie.size,i=P(Vs);if(n||ie.add(null),t&&t.u&&(t.u=Mn(e,t.u)),ie.add(this),n){P(i);return}ie.delete(null);for(let r of ie)r._cbs&&(r._cbs=Mn(r._done,r._cbs)),ie.delete(r),js(r._done)&&r.throw(xe(r._done));P(i)},this._done=void 0,this._cbs=void 0}static create(e,t){let n=new _e;return(e||t)&&(n.must((e||(e=Me())).release(t||n.end)),xn.set(n,e)),n}do(e){return dr(this._chain(),e),this}onError(e){return this.do(t=>{Pe(t)&&e(xe(t))})}onValue(e){return this.do(t=>{Ut(t)&&e(t.val)})}onCancel(e){return this.do(t=>{Ks(t)&&e()})}result(){var e;return this._done||((e=U.cell)==null?void 0:e.recalcWhen(this,br))||void 0}get[Symbol.toStringTag](){return"Job"}restart(){if(!this._done&&ie.size){let e=ie;ie=new Set,this.end(),ie=e}else this._end(qt);return this._done=void 0,jt.delete(this),this}_end(e){if(this._done)throw new Error("Job already ended");return this!==fe&&(this._done=e),this.end(),this}throw(e){return this._done?((xn.get(this)||fe).asyncThrow(e),this):this._end(Rn(e))}return(e){return this._end(jn(e))}then(e,t){return Rt(this).then(e,t)}catch(e){return Rt(this).catch(e)}finally(e){return Rt(this).finally(e)}*[Symbol.iterator](){return this._done?qn(this._done):yield e=>{this.do(t=>nt(Bn(e),Dn(e),t))}}start(e,t){if(!e)returLine truncated
|
||||
var jt=Object.defineProperty;var or=Object.getOwnPropertyDescriptor;var ar=Object.getOwnPropertyNames;var lr=Object.prototype.hasOwnProperty;var cr=(s,e,t)=>e in s?jt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var Pn=(s,e)=>{for(var t in e)jt(s,t,{get:e[t],enumerable:!0})},ur=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ar(e))!lr.call(s,i)&&i!==t&&jt(s,i,{get:()=>e[i],enumerable:!(n=or(e,i))||n.enumerable});return s};var fr=s=>ur(jt({},"__esModule",{value:!0}),s);var Ee=(s,e,t)=>(cr(s,typeof e!="symbol"?e+"":e,t),t);var Io={};Pn(Io,{default:()=>$s});module.exports=fr(Io);var _=require("obsidian");var B=typeof queueMicrotask=="function"?queueMicrotask:(s=>e=>s.then(e))(Promise.resolve());function Ve(s,e){return new Ds(s,e)}var Ds=class{constructor(e,t){this.reap=e,this.sched=t,this._flags=0,this.q=new Set,this._run=()=>{this._flags&=-3,this.flush()},this.flush=()=>{if(this._flags&1)return;let{q:n}=this;if(n.size){this._flags|=1;try{this.reap(n)}finally{this._flags&=-2,!n.size||this._flags&2||this._sched()}}}}isRunning(){return!!(this._flags&1)}isEmpty(){return!this.q.size}add(e){this.q.size||this._flags&3||this._sched(),this.q.add(e)}delete(e){this.q.delete(e)}has(e){return this.q.has(e)}_sched(){this._flags|=2,(this.sched||B)(this._run)}};var hr=Array.isArray;function nt(s,e,t){return s.set(e,t),t}function V(s){return typeof s=="function"}var js=(()=>{function s(e){return Object.setPrototypeOf(e,new.target.prototype)}return s.prototype=Function.prototype,s})(),xe=Reflect.apply,Rs=(()=>{function s(){}return s.prototype=function*(){}.constructor.prototype.prototype,s})();function jn(s){return s.bind(null,"next")}function Rn(s){return s.bind(null,"throw",void 0)}function it(){}function Vs(s,e,t){return{op:s,val:e,err:t}}var Kt=Object.freeze(Vs("cancel"));function qn(s){return Vs("next",s)}function Fn(s){return Vs("throw",void 0,s)}function Us(s){return s===Kt}function Wt(s){return s?s.op==="next":!1}function $e(s){return s?s.op==="throw":!1}function qs(s){return $e(s)&&s.val===void 0}function Me(s){return s.val=null,s.err}function Kn(s){if(Wt(s))return s.val;s.op,rt(it,e=>{throw e},s)}function rt(s,e,t){$e(t)?e(Me(t)):Us(t)?e(new Vt("Job canceled")):s(t.val)}function Vn(s,e){s.result()||rt(s.return.bind(s),s.throw.bind(s),e)}var Vt=class extends Error{},J=de();function P(s){let e=J;return J=s,e}var Rt=[];function de(s,e){if(Rt&&Rt.length){let t=Rt.pop();return t.job=s,t.cell=e,t}return{job:s,cell:e}}function Fs(s){s.job=s.cell=null,Rt.push(s)}var Ue=new WeakMap,Un=s=>{Promise.reject(s)},Js=de(),Mn=new WeakMap,Jn=Ve(s=>{for(let e of s)s.delete(e),e.doPull()},B);function $n(){return Gt(0,void 0,void 0)}function dr(s){for(;s.v;)Jt(s,s.n);s.u=void 0,Jt(s,s)}function pr(s,e){++s.v,Gt(e,s.n,s)}function mr(s,e){++s.v,Gt(e,s,s.p)}function gr(s,e){return++s.v,br(s,Gt(e,s,s.p))}function yr(s){return!s||s.v===0}function Wn(s){return s?s.v:0}function wr(s){if(Wn(s))return Jt(s,s.p)}var Ks=class{constructor(){this.n=this,this.p=this,this.v=void 0,this.u=void 0}},Ut;function Gt(s,e,t){let n=Ut;return n?(Ut=n.n,n.n=e||n,n.p=t||n):(n=new Ks,e&&(n.n=e),t&&(n.p=t)),n.v=s,n.n.p=n,n.p.n=n,n}function Jt(s,e){--s.v;var t=e.v,n=e.u;return e.n&&(e.n.p=e.p),e.p&&(e.p.n=e.n),e.u=e.v=e.p=void 0,e.n=Ut,Ut=e,n&&n(),t}function br(s,e){let t=e.u||(e.u=()=>{t&&(t===e.u&&Jt(s,e),t=s=e=void 0)});return t}function Be(){var e;let s=J.job||((e=J.cell)==null?void 0:e.getJob());if(s)return s;throw new Error("No job is currently active")}function vr(s){return e=>{J.job.must(s.release(e))}}function Bn(s,e){for(;Wn(e);)try{wr(e)(s)}catch(t){ot.asyncThrow(t)}e&&dr(e)}var re=new Set,Pe=class{constructor(){this.end=()=>{let e=this._done||(this._done=Kt),t=this._cbs;if(!t&&!qs(e))return;let n=re.size,i=P(Js);if(n||re.add(null),t&&t.u&&(t.u=Bn(e,t.u)),re.add(this),n){P(i);return}re.delete(null);for(let r of re)r._cbs&&(r._cbs=Bn(r._done,r._cbs)),re.delete(r),qs(r._done)&&r.throw(Me(r._done));P(i)},this._done=void 0,this._cbs=void 0}static create(e,t){let n=new Pe;return(e||t)&&(n.must((e||(e=Be())).release(t||n.end)),Mn.set(n,e)),n}do(e){return pr(this._chain(),e),this}onError(e){return this.do(t=>{$e(t)&&e(Me(t))})}onValue(e){return this.do(t=>{Wt(t)&&e(t.val)})}onCancel(e){return this.do(t=>{Us(t)&&e()})}result(){var e;return this._done||((e=J.cell)==null?void 0:e.recalcWhen(this,vr))||void 0}get[Symbol.toStringTag](){return"Job"}restart(){if(!this._done&&re.size){let e=re;re=new Set,this.end(),re=e}else this._end(Kt);return this._done=void 0,qt.delete(this),this}_end(e){if(this._done)throw new Error("Job already ended");return this!==he&&(this._done=e),this.end(),this}throw(e){return this._done?((Mn.get(this)||he).asyncThrow(e),this):this._end(Fn(e))}return(e){return this._end(qn(e))}then(e,t){return Ft(this).then(e,t)}catch(e){return Ft(this).catch(e)}finally(e){return Ft(this).finally(e)}*[Symbol.iterator](){return this._done?Kn(this._done):yield e=>{this.do(t=>rt(jn(e),Rn(e),t))}}start(e,t){if(!e)returLine truncated
|
||||
details.ophidian-settings-group > div {
|
||||
margin-left: var(--font-ui-medium);
|
||||
}
|
||||
@@ -19,29 +19,29 @@ details.ophidian-settings-group > summary.ophidian-settings-group > div.setting-
|
||||
}
|
||||
details.ophidian-settings-group[open] > summary.ophidian-settings-group > div.setting-item-heading:first-child .setting-item-name::before {
|
||||
content: "\u25BE";
|
||||
}`;var Pa=$r(s=>s.createEl("style",{text:jr}));var Rr=`.ophidian-dialog .dialog-text {
|
||||
}`;var Ma=Br(s=>s.createEl("style",{text:Rr}));var qr=`.ophidian-dialog .dialog-text {
|
||||
margin-bottom: 0.75em;
|
||||
}
|
||||
|
||||
.ophidian-dialog.mod-confirmation input[type=text]:invalid, .ophidian-dialog.mod-confirmation input[type=text]:invalid:enabled:focus, .ophidian-dialog.mod-confirmation input[type=text][aria-invalid=true], .ophidian-dialog.mod-confirmation input[type=text][aria-invalid=true]:enabled:focus {
|
||||
border-color: var(--text-error);
|
||||
background-color: var(--background-modifier-error);
|
||||
}`,zt=class extends De.Modal{constructor(){super(ui),this.buttonContainerEl=this.modalEl.createDiv("modal-button-container"),this.styleEl=this.modalEl.createEl("style",{text:Rr}),this.textContentEl=this.contentEl.createDiv("dialog-text"),this.okButton=this.buttonContainerEl.createEl("button",{cls:"mod-cta",text:i18next.t("dialogue.button-continue")},s=>{s.addEventListener("click",async e=>{var t;await((t=this.onOK)==null?void 0:t.call(this,e))||this.close()})}),this.isOpened=!1,this.containerEl.addClass("mod-confirmation"),this.containerEl.addClass("ophidian-dialog")}onOK(s){return!1}open(){this.isOpened||super.open(),this.isOpened=!0}close(){this.isOpened&&super.close(),this.isOpened=!1}setOk(s){this.okButton.textContent=s}addButton(s,e,t,n){return this.buttonContainerEl.createEl("button",{cls:s,text:e},n).addEventListener("click",async i=>{await t(i)||this.close()}),this}addCancelButton(s){return this.addButton("",i18next.t("dialogue.button-cancel"),()=>(this.close(),s&&s()))}setContent(s){return String.isString(s)?this.textContentEl.setText(s):this.textContentEl.appendChild(s),this}setTitle(s){return this.titleEl.setText(s),this}setup(s){return s&&s(this),this}},Xt=class extends zt{constructor(){super(...arguments),this.value=!1}onOK(s){this.value=!0}confirm(){this.addCancelButton();let{resolve:s,promise:e}=ci();return this.onClose=()=>s(this.value),this.open(),e}},hi=class extends zt{constructor(){super(...arguments),this.value=!1,this.setting=this.contentEl.createDiv("is-mobile"),this.inputEl=this.setting.createEl("input",{type:"text"},s=>{s.addEventListener("keypress",async e=>{var t;e.key==="Enter"&&!e.isComposing&&(await((t=this.onOK)==null?void 0:t.call(this,e))||this.close())})})}onOK(s){let{value:e}=this.inputEl;if(!this.isValid(e))return this.handleInvalidEntry(e),!0;this.value=this.inputEl.value}isValid(s){return!0}handleInvalidEntry(s){}setPlaceholder(s){return s?this.inputEl.placeholder=s:this.inputEl.removeAttribute("placeholder"),this}setValue(s){return this.inputEl.value=s,this}setPattern(s){return this.inputEl.pattern=s,this.setValidator(e=>new RegExp(`^${s}$`).test(e))}setValidator(s){return this.isValid=s,this.inputEl.oninput=()=>this.inputEl.setAttribute("aria-invalid",""+!s(this.inputEl.value)),this}onInvalidEntry(s){return this.handleInvalidEntry=s,this}prompt(){this.addCancelButton();let{resolve:s,promise:e}=ci();return this.onClose=()=>s(this.value),this.open(),this.inputEl.select(),this.inputEl.focus(),e}};var en=class extends zt{constructor(t){super();Se(this,"progressEl",this.contentEl.createEl("progress",{value:0,attr:{style:"width: 100%",max:100}}));Se(this,"counterEl",this.contentEl.createDiv({text:"0%"}));this.okButton.detach(),this.addCancelButton(),this.onClose=t}setProgress(t){this.counterEl.textContent=`${t}%`,this.progressEl.value=t}},ct=class{constructor(e,t){Se(this,"aborted",!1);this.progress=new en(()=>this.aborted=!0).setTitle(e).setContent(t),this.progress.open()}async forEach(e,t){try{if(this.aborted)return;let n=0,i=e.length,r=0,o=0;for(let a of e){if(await t(a,n++,e,this),this.aborted)return;if(r+=100,r>i){let l=r%i,c=(r-l)/i;this.progress.setProgress(o+=c),r=l}}return o<100&&this.progress.setProgress(100),this}finally{this.progress.onClose=()=>null,this.progress.close()}}set title(e){this.progress.setTitle(e)}set message(e){this.progress.setContent(e)}};var Le=require("obsidian");var qr=/^#[^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s]+$/,A=class{constructor(e){let t=this.tag=A.toTag(e),n=this.canonical=t.toLowerCase(),i=this.canonical_prefix=n+"/";this.name=t.slice(1),this.matches=function(r){return r=r.toLowerCase(),r==n||r.startsWith(i)}}toString(){return this.tag}static isTag(e){return qr.test(e)}static toTag(e){for(;e.startsWith("##");)e=e.slice(1);return e.startsWith("#")?e:"#"+e}static toName(e){return this.toTag(e).slice(1)}static canonical(e){return A.toTag(e).toLowerCase()}},Zt=class{constructor(e,t){let n=Object.assign(Object.create(null),{[e.tag]:t.tag,[e.name]:t.name});this.inString=function(i,r=0){return i.slice(0,r)+t.tag+i.slice(r+e.tag.length)},this.inArray=(i,r,o)=>i.map((a,l)=>{if(r&&l&1||!a||typeof a!="string")return a;if(o){if(!a.startsWith("#")||!A.isTag(a))return a}else if(/[ ,\n]/.test(a))return this.inArray(a.split(/([, \n]+)/),!0).join("");if(n[a])return n[a];let c=a.toLowerCase();return n[c]?n[a]=n[c]:c.startsWith(e.canonical_prefix)?n[a]=n[c]=this.inString(a):("#"+c).startsWith(e.canonical_prefix)?n[a]=n[c]=this.inString("#"+a).slice(1):n[a]=n[c]=a}),this.willMergeTags=function(i){if(e.canonical===t.canonical)return;let r=new Set(i.map(o=>o.toLowerCase()));for(let o of i.filter(e.matches)){let a=this.inString(o);if(r.has(a.toLowerCase()))return[new A(o),new A(a)]}}}};var Ln=require("obsidian");var es=Symbol.for("yaml.alias"),ts=Symbol.for("yaml.document"),Q=Symbol.for("yaml.map"),tn=Symbol.for("yaml.pair"),J=Symbol.for("yaml.scalar"),pe=Symbol.for("yaml.seq"),R=Symbol.for("yaml.node.type"),H=s=>!!s&&typeof s=="objeLine truncated
|
||||
`)}};_.defaultYaml={explicit:!1,version:"1.2"};_.defaultTags={"!!":"tag:yaml.org,2002:"};function ss(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function sn(s){let e=new Set;return X(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function nn(s,e){for(let t=1;;++t){let n=`${s}${t}`;if(!e.has(n))return n}}function pi(s,e){let t=[],n=new Map,i=null;return{onAnchor(r){t.push(r),i||(i=sn(s));let o=nn(e,i);return i.add(o),o},setAnchors(){for(let r of t){let o=n.get(r);if(typeof o=="object"&&o.anchor&&(E(o.node)||T(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:n}}var me=class extends ke{constructor(e){super(es),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return X(e,{Node:(n,i)=>{if(i===this)return X.BREAK;i.anchor===this.source&&(t=i)}}),t}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:r}=t,o=this.resolve(i);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=n.get(o);if(!a||a.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=ns(i,o,n)),a.count*a.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,n){let i=`*${this.source}`;if(e){if(ss(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}};function ns(s,e,t){if(H(e)){let n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(T(e)){let n=0;for(let i of e.items){let r=ns(s,i,t);r>n&&(n=r)}return n}else if(O(e)){let n=ns(s,e.key,t),i=ns(s,e.value,t);return Math.max(n,i)}return 1}function j(s,e,t){if(Array.isArray(s))return s.map((n,i)=>j(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!di(s))return s.toJSON(e,t);let n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};let i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!(t&&t.keep)?Number(s):s}var is=s=>!s||typeof s!="function"&&typeof s!="object",v=class extends ke{constructor(e){super(J),this.value=e}toJSON(e,t){return t&&t.keep?this.value:j(this.value,e,t)}toString(){return String(this.value)}};v.BLOCK_FOLDED="BLOCK_FOLDED";v.BLOCK_LITERAL="BLOCK_LITERAL";v.PLAIN="PLAIN";v.QUOTE_DOUBLE="QUOTE_DOUBLE";v.QUOTE_SINGLE="QUOTE_SINGLE";var Ur="tag:yaml.org,2002:";function Jr(s,e,t){if(e){let n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)||n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify&&n.identify(s)&&!n.format)}function ge(s,e,t){var n,i;if(Je(s)&&(s=s.contents),C(s))return s;if(O(s)){let d=(i=(n=t.schema[Q]).createNode)===null||i===void 0?void 0:i.call(n,t.schema,null,t);return d.items.push(s),d}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt=="function"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:r,onAnchor:o,onTagObj:a,schema:l,sourceObjects:c}=t,u;if(r&&s&&typeof s=="object"){if(u=c.get(s),u)return u.anchor||(u.anchor=o(s)),new me(u.anchor);u={anchor:null,node:null},c.set(s,u)}e&&e.startsWith("!!")&&(e=Ur+e.slice(2));let f=Jr(s,e,l.tags);if(!f){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let d=new v(s);return u&&(u.node=d),d}f=s instanceof Map?l[Q]:Symbol.iterator in Object(s)?l[pe]:l[Q]}a&&(a(f),delete t.onTagObj);let h=f!=null&&f.createNode?f.createNode(t.schema,s,t):new v(s);return e&&(h.tag=e),u&&(u.node=h),h}function ft(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){let r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return ge(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var Ge=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,ye=class extends ke{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>C(n)||O(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Ge(e))this.add(t);else{let[n,...i]=e,r=this.get(n,!0);if(T(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,ft(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let i=this.get(t,!
Line truncated
|
||||
}`,Zt=class extends Re.Modal{constructor(){super(j),this.buttonContainerEl=this.modalEl.createDiv("modal-button-container"),this.styleEl=this.modalEl.createEl("style",{text:qr}),this.textContentEl=this.contentEl.createDiv("dialog-text"),this.okButton=this.buttonContainerEl.createEl("button",{cls:"mod-cta",text:i18next.t("dialogue.button-continue")},s=>{s.addEventListener("click",async e=>{var t;await((t=this.onOK)==null?void 0:t.call(this,e))||this.close()})}),this.isOpened=!1,this.containerEl.addClass("mod-confirmation"),this.containerEl.addClass("ophidian-dialog")}onOK(s){return!1}open(){this.isOpened||super.open(),this.isOpened=!0}close(){this.isOpened&&super.close(),this.isOpened=!1}setOk(s){this.okButton.textContent=s}addButton(s,e,t,n){return this.buttonContainerEl.createEl("button",{cls:s,text:e},n).addEventListener("click",async i=>{await t(i)||this.close()}),this}addCancelButton(s){return this.addButton("",i18next.t("dialogue.button-cancel"),()=>(this.close(),s&&s()))}setContent(s){return String.isString(s)?this.textContentEl.setText(s):this.textContentEl.appendChild(s),this}setTitle(s){return this.titleEl.setText(s),this}setup(s){return s&&s(this),this}},es=class extends Zt{constructor(){super(...arguments),this.value=!1}onOK(s){this.value=!0}confirm(){this.addCancelButton();let{resolve:s,promise:e}=fi();return this.onClose=()=>s(this.value),this.open(),e}},di=class extends Zt{constructor(){super(...arguments),this.value=!1,this.setting=this.contentEl.createDiv("is-mobile"),this.inputEl=this.setting.createEl("input",{type:"text"},s=>{s.addEventListener("keypress",async e=>{var t;e.key==="Enter"&&!e.isComposing&&(await((t=this.onOK)==null?void 0:t.call(this,e))||this.close())})})}onOK(s){let{value:e}=this.inputEl;if(!this.isValid(e))return this.handleInvalidEntry(e),!0;this.value=this.inputEl.value}isValid(s){return!0}handleInvalidEntry(s){}setPlaceholder(s){return s?this.inputEl.placeholder=s:this.inputEl.removeAttribute("placeholder"),this}setValue(s){return this.inputEl.value=s,this}setPattern(s){return this.inputEl.pattern=s,this.setValidator(e=>new RegExp(`^${s}$`).test(e))}setValidator(s){return this.isValid=s,this.inputEl.oninput=()=>this.inputEl.setAttribute("aria-invalid",""+!s(this.inputEl.value)),this}onInvalidEntry(s){return this.handleInvalidEntry=s,this}prompt(){this.addCancelButton();let{resolve:s,promise:e}=fi();return this.onClose=()=>s(this.value),this.open(),this.inputEl.select(),this.inputEl.focus(),e}};var sn=class extends Zt{constructor(t){super();Ee(this,"progressEl",this.contentEl.createEl("progress",{value:0,attr:{style:"width: 100%",max:100}}));Ee(this,"counterEl",this.contentEl.createDiv({text:"0%"}));this.okButton.detach(),this.addCancelButton(),this.onClose=t}setProgress(t){this.counterEl.textContent=`${t}%`,this.progressEl.value=t}},ft=class{constructor(e,t){Ee(this,"aborted",!1);this.progress=new sn(()=>this.aborted=!0).setTitle(e).setContent(t),this.progress.open()}async forEach(e,t){try{if(this.aborted)return;let n=0,i=e.length,r=0,o=0;for(let a of e){if(await t(a,n++,e,this),this.aborted)return;if(r+=100,r>i){let l=r%i,c=(r-l)/i;this.progress.setProgress(o+=c),r=l}}return o<100&&this.progress.setProgress(100),this}finally{this.progress.onClose=()=>null,this.progress.close()}}set title(e){this.progress.setTitle(e)}set message(e){this.progress.setContent(e)}};var Ie=require("obsidian");var Fr=/^#[^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~[\]\\\s]+$/,A=class{constructor(e){let t=this.tag=A.toTag(e),n=this.canonical=t.toLowerCase(),i=this.canonical_prefix=n+"/";this.name=t.slice(1),this.matches=function(r){return r=r.toLowerCase(),r==n||r.startsWith(i)}}toString(){return this.tag}static isTag(e){return Fr.test(e)}static toTag(e){for(;e.startsWith("##");)e=e.slice(1);return e.startsWith("#")?e:"#"+e}static toName(e){return this.toTag(e).slice(1)}static canonical(e){return A.toTag(e).toLowerCase()}},ts=class{constructor(e,t){let n=Object.assign(Object.create(null),{[e.tag]:t.tag,[e.name]:t.name});this.inString=function(i,r=0){return i.slice(0,r)+t.tag+i.slice(r+e.tag.length)},this.inArray=(i,r,o)=>i.map((a,l)=>{if(r&&l&1||!a||typeof a!="string")return a;if(o){if(!a.startsWith("#")||!A.isTag(a))return a}else if(/[ ,\n]/.test(a))return this.inArray(a.split(/([, \n]+)/),!0).join("");if(n[a])return n[a];let c=a.toLowerCase();return n[c]?n[a]=n[c]:c.startsWith(e.canonical_prefix)?n[a]=n[c]=this.inString(a):("#"+c).startsWith(e.canonical_prefix)?n[a]=n[c]=this.inString("#"+a).slice(1):n[a]=n[c]=a}),this.willMergeTags=function(i){if(e.canonical===t.canonical)return;let r=new Set(i.map(o=>o.toLowerCase()));for(let o of i.filter(e.matches)){let a=this.inString(o);if(r.has(a.toLowerCase()))return[new A(o),new A(a)]}}}};var In=require("obsidian");var ss=Symbol.for("yaml.alias"),ns=Symbol.for("yaml.document"),H=Symbol.for("yaml.map"),nn=Symbol.for("yaml.pair"),W=Symbol.for("yaml.scalar"),me=Symbol.for("yaml.seq"),q=Symbol.for("yaml.node.type"),z=s=>!!s&&typeof s=="objectLine truncated
|
||||
`)}};I.defaultYaml={explicit:!1,version:"1.2"};I.defaultTags={"!!":"tag:yaml.org,2002:"};function is(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function rn(s){let e=new Set;return Z(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function on(s,e){for(let t=1;;++t){let n=`${s}${t}`;if(!e.has(n))return n}}function mi(s,e){let t=[],n=new Map,i=null;return{onAnchor(r){t.push(r),i||(i=rn(s));let o=on(e,i);return i.add(o),o},setAnchors(){for(let r of t){let o=n.get(r);if(typeof o=="object"&&o.anchor&&(E(o.node)||T(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:n}}var ge=class extends Oe{constructor(e){super(ss),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return Z(e,{Node:(n,i)=>{if(i===this)return Z.BREAK;i.anchor===this.source&&(t=i)}}),t}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:r}=t,o=this.resolve(i);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=n.get(o);if(!a||a.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=rs(i,o,n)),a.count*a.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,n){let i=`*${this.source}`;if(e){if(is(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}};function rs(s,e,t){if(z(e)){let n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(T(e)){let n=0;for(let i of e.items){let r=rs(s,i,t);r>n&&(n=r)}return n}else if(O(e)){let n=rs(s,e.key,t),i=rs(s,e.value,t);return Math.max(n,i)}return 1}function R(s,e,t){if(Array.isArray(s))return s.map((n,i)=>R(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!pi(s))return s.toJSON(e,t);let n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};let i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!(t&&t.keep)?Number(s):s}var os=s=>!s||typeof s!="function"&&typeof s!="object",v=class extends Oe{constructor(e){super(W),this.value=e}toJSON(e,t){return t&&t.keep?this.value:R(this.value,e,t)}toString(){return String(this.value)}};v.BLOCK_FOLDED="BLOCK_FOLDED";v.BLOCK_LITERAL="BLOCK_LITERAL";v.PLAIN="PLAIN";v.QUOTE_DOUBLE="QUOTE_DOUBLE";v.QUOTE_SINGLE="QUOTE_SINGLE";var Jr="tag:yaml.org,2002:";function Wr(s,e,t){if(e){let n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)||n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify&&n.identify(s)&&!n.format)}function ye(s,e,t){var n,i;if(Ge(s)&&(s=s.contents),C(s))return s;if(O(s)){let d=(i=(n=t.schema[H]).createNode)===null||i===void 0?void 0:i.call(n,t.schema,null,t);return d.items.push(s),d}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt=="function"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:r,onAnchor:o,onTagObj:a,schema:l,sourceObjects:c}=t,u;if(r&&s&&typeof s=="object"){if(u=c.get(s),u)return u.anchor||(u.anchor=o(s)),new ge(u.anchor);u={anchor:null,node:null},c.set(s,u)}e&&e.startsWith("!!")&&(e=Jr+e.slice(2));let f=Wr(s,e,l.tags);if(!f){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let d=new v(s);return u&&(u.node=d),d}f=s instanceof Map?l[H]:Symbol.iterator in Object(s)?l[me]:l[H]}a&&(a(f),delete t.onTagObj);let h=f!=null&&f.createNode?f.createNode(t.schema,s,t):new v(s);return e&&(h.tag=e),u&&(u.node=h),h}function dt(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){let r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return ye(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var Qe=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,we=class extends Oe{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>C(n)||O(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Qe(e))this.add(t);else{let[n,...i]=e,r=this.get(n,!0);if(T(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,dt(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let i=this.get(t,!
Line truncated
|
||||
`)?`
|
||||
`+oe(t,e):(s.endsWith(" ")?"":" ")+t;var rn="flow",rs="block",ht="quoted";function dt(s,e,t="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return s;let l=Math.max(1+r,1+i-e.length);if(s.length<=l)return s;let c=[],u={},f=i-e.length;typeof n=="number"&&(n>i-Math.max(2,r)?c.push(0):f=i-n);let h,d,g=!1,p=-1,m=-1,y=-1;t===rs&&(p=gi(s,p),p!==-1&&(f=p+l));for(let k;k=s[p+=1];){if(t===ht&&k==="\\"){switch(m=p,s[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}y=p}if(k===`
|
||||
`)t===rs&&(p=gi(s,p)),f=p+l,h=void 0;else{if(k===" "&&d&&d!==" "&&d!==`
|
||||
`+ae(t,e):(s.endsWith(" ")?"":" ")+t;var an="flow",as="block",pt="quoted";function mt(s,e,t="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return s;let l=Math.max(1+r,1+i-e.length);if(s.length<=l)return s;let c=[],u={},f=i-e.length;typeof n=="number"&&(n>i-Math.max(2,r)?c.push(0):f=i-n);let h,d,g=!1,p=-1,m=-1,y=-1;t===as&&(p=yi(s,p),p!==-1&&(f=p+l));for(let k;k=s[p+=1];){if(t===pt&&k==="\\"){switch(m=p,s[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}y=p}if(k===`
|
||||
`)t===as&&(p=yi(s,p)),f=p+l,h=void 0;else{if(k===" "&&d&&d!==" "&&d!==`
|
||||
`&&d!==" "){let w=s[p+1];w&&w!==" "&&w!==`
|
||||
`&&w!==" "&&(h=p)}if(p>=f)if(h)c.push(h),f=h+l,h=void 0;else if(t===ht){for(;d===" "||d===" ";)d=k,k=s[p+=1],g=!0;let w=p>y+1?p-2:m-1;if(u[w])return s;c.push(w),u[w]=!0,f=w+l,h=void 0}else g=!0}d=k}if(g&&a&&a(),c.length===0)return s;o&&o();let b=s.slice(0,c[0]);for(let k=0;k<c.length;++k){let w=c[k],S=c[k+1]||s.length;w===0?b=`
|
||||
${e}${s.slice(0,S)}`:(t===ht&&u[w]&&(b+=`${s[w]}\\`),b+=`
|
||||
${e}${s.slice(w+1,S)}`)}return b}function gi(s,e){let t=s[e+1];for(;t===" "||t===" ";){do t=s[e+=1];while(t&&t!==`
|
||||
`);t=s[e+1]}return e}var as=s=>({indentAtStart:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),ls=s=>/^(%|---|\.\.\.)/m.test(s);function Wr(s,e,t){if(!e||e<0)return!1;let n=e-t,i=s.length;if(i<=n)return!1;for(let r=0,o=0;r<i;++r)if(s[r]===`
|
||||
`){if(r-o>n)return!0;if(o=r+1,i-o<=n)return!1}return!0}function pt(s,e){let t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(ls(s)?" ":""),o="",a=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(o+=t.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{o+=t.slice(a,l);let u=t.substr(l+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(n||t[l+2]==='"'||t.length<i)l+=1;else{for(o+=t.slice(a,l)+`
|
||||
`&&w!==" "&&(h=p)}if(p>=f)if(h)c.push(h),f=h+l,h=void 0;else if(t===pt){for(;d===" "||d===" ";)d=k,k=s[p+=1],g=!0;let w=p>y+1?p-2:m-1;if(u[w])return s;c.push(w),u[w]=!0,f=w+l,h=void 0}else g=!0}d=k}if(g&&a&&a(),c.length===0)return s;o&&o();let b=s.slice(0,c[0]);for(let k=0;k<c.length;++k){let w=c[k],S=c[k+1]||s.length;w===0?b=`
|
||||
${e}${s.slice(0,S)}`:(t===pt&&u[w]&&(b+=`${s[w]}\\`),b+=`
|
||||
${e}${s.slice(w+1,S)}`)}return b}function yi(s,e){let t=s[e+1];for(;t===" "||t===" ";){do t=s[e+=1];while(t&&t!==`
|
||||
`);t=s[e+1]}return e}var cs=s=>({indentAtStart:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),us=s=>/^(%|---|\.\.\.)/m.test(s);function Gr(s,e,t){if(!e||e<0)return!1;let n=e-t,i=s.length;if(i<=n)return!1;for(let r=0,o=0;r<i;++r)if(s[r]===`
|
||||
`){if(r-o>n)return!0;if(o=r+1,i-o<=n)return!1}return!0}function gt(s,e){let t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(us(s)?" ":""),o="",a=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(o+=t.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{o+=t.slice(a,l);let u=t.substr(l+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(n||t[l+2]==='"'||t.length<i)l+=1;else{for(o+=t.slice(a,l)+`
|
||||
|
||||
`;t[l+2]==="\\"&&t[l+3]==="n"&&t[l+4]!=='"';)o+=`
|
||||
`,l+=2;o+=r,t[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+t.slice(a):t,n?o:dt(o,r,ht,as(e))}function on(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`
|
||||
`)||/[ \t]\n|\n[ \t]/.test(s))return pt(s,e);let t=e.indent||(ls(s)?" ":""),n="'"+s.replace(/'/g,"''").replace(/\n+/g,`$&
|
||||
${t}`)+"'";return e.implicitKey?n:dt(n,t,rn,as(e))}function mt(s,e){let{singleQuote:t}=e.options,n;if(t===!1)n=pt;else{let i=s.includes('"'),r=s.includes("'");i&&!r?n=on:r&&!i?n=pt:n=t?on:pt}return n(s,e)}function os({comment:s,type:e,value:t},n,i,r){let{blockQuote:o,commentString:a,lineWidth:l}=n.options;if(!o||/\n[\t ]+$/.test(t)||/^\s*$/.test(t))return mt(t,n);let c=n.indent||(n.forceBlockIndent||ls(t)?" ":""),u=o==="literal"?!0:o==="folded"||e===v.BLOCK_FOLDED?!1:e===v.BLOCK_LITERAL?!0:!Wr(t,l,c.length);if(!t)return u?`|
|
||||
`,l+=2;o+=r,t[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+t.slice(a):t,n?o:mt(o,r,pt,cs(e))}function ln(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`
|
||||
`)||/[ \t]\n|\n[ \t]/.test(s))return gt(s,e);let t=e.indent||(us(s)?" ":""),n="'"+s.replace(/'/g,"''").replace(/\n+/g,`$&
|
||||
${t}`)+"'";return e.implicitKey?n:mt(n,t,an,cs(e))}function yt(s,e){let{singleQuote:t}=e.options,n;if(t===!1)n=gt;else{let i=s.includes('"'),r=s.includes("'");i&&!r?n=ln:r&&!i?n=gt:n=t?ln:gt}return n(s,e)}function ls({comment:s,type:e,value:t},n,i,r){let{blockQuote:o,commentString:a,lineWidth:l}=n.options;if(!o||/\n[\t ]+$/.test(t)||/^\s*$/.test(t))return yt(t,n);let c=n.indent||(n.forceBlockIndent||us(t)?" ":""),u=o==="literal"?!0:o==="folded"||e===v.BLOCK_FOLDED?!1:e===v.BLOCK_LITERAL?!0:!Gr(t,l,c.length);if(!t)return u?`|
|
||||
`:`>
|
||||
`;let f,h;for(h=t.length;h>0;--h){let N=t[h-1];if(N!==`
|
||||
`&&N!==" "&&N!==" ")break}let d=t.substring(h),g=d.indexOf(`
|
||||
@@ -49,43 +49,43 @@ ${t}`)+"'";return e.implicitKey?n:dt(n,t,rn,as(e))}function mt(s,e){let{singleQu
|
||||
`&&(d=d.slice(0,-1)),d=d.replace(/\n+(?!\n|$)/g,`$&${c}`));let p=!1,m,y=-1;for(m=0;m<t.length;++m){let N=t[m];if(N===" ")p=!0;else if(N===`
|
||||
`)y=m;else break}let b=t.substring(0,y<m?y+1:m);b&&(t=t.substring(b.length),b=b.replace(/\n+/g,`$&${c}`));let w=(u?"|":">")+(p?c?"2":"1":"")+f;if(s&&(w+=" "+a(s.replace(/ ?[\r\n]+/g," ")),i&&i()),u)return t=t.replace(/\n+/g,`$&${c}`),`${w}
|
||||
${c}${b}${t}${d}`;t=t.replace(/\n+/g,`
|
||||
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`);let S=dt(`${b}${t}${d}`,c,rs,as(n));return`${w}
|
||||
${c}${S}`}function Gr(s,e,t,n){let{type:i,value:r}=s,{actualString:o,implicitKey:a,indent:l,inFlow:c}=e;if(a&&/[\n[\]{},]/.test(r)||c&&/[[\]{},]/.test(r))return mt(r,e);if(!r||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||c||r.indexOf(`
|
||||
`)===-1?mt(r,e):os(s,e,t,n);if(!a&&!c&&i!==v.PLAIN&&r.indexOf(`
|
||||
`)!==-1)return os(s,e,t,n);if(l===""&&ls(r))return e.forceBlockIndent=!0,os(s,e,t,n);let u=r.replace(/\n+/g,`$&
|
||||
${l}`);if(o){let f=g=>{var p;return g.default&&g.tag!=="tag:yaml.org,2002:str"&&((p=g.test)===null||p===void 0?void 0:p.test(u))},{compat:h,tags:d}=e.doc.schema;if(d.some(f)||h!=null&&h.some(f))return mt(r,e)}return a?u:dt(u,l,rn,as(e))}function we(s,e,t,n){let{implicitKey:i,inFlow:r}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)}),{type:a}=s;a!==v.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=v.QUOTE_DOUBLE);let l=u=>{switch(u){case v.BLOCK_FOLDED:case v.BLOCK_LITERAL:return i||r?mt(o.value,e):os(o,e,t,n);case v.QUOTE_DOUBLE:return pt(o.value,e);case v.QUOTE_SINGLE:return on(o.value,e);case v.PLAIN:return Gr(o,e,t,n);default:return null}},c=l(a);if(c===null){let{defaultKeyType:u,defaultStringType:f}=e.options,h=i&&u||f;if(c=l(h),c===null)throw new Error(`Unsupported default string type ${h}`)}return c}function cs(s,e){let t=Object.assign({blockQuote:!0,commentString:mi,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,e),n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function Yr(s,e){if(e.tag){let i=s.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)||i[0]}let t,n;if(E(e)){n=e.value;let i=s.filter(r=>r.identify&&r.identify(n));t=i.find(r=>r.format===e.format)||i.find(r=>!r.format)}else n=e,t=s.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!t){let i=n&&n.constructor?n.constructor.name:typeof n;throw new Error(`Tag not resolved for ${i} value`)}return t}function Qr(s,e,{anchors:t,doc:n}){if(!n.directives)return"";let i=[],r=(E(s)||T(s))&&s.anchor;r&&ss(r)&&(t.add(r),i.push(`&${r}`));let o=s.tag||(e.default?null:e.tag);return o&&i.push(n.directives.tagString(o)),i.join(" ")}function ee(s,e,t,n){var i;if(O(s))return s.toString(e,t,n);if(H(s)){if(e.doc.directives)return s.toString(e);if(!((i=e.resolvedAliases)===null||i===void 0)&&i.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let r,o=C(s)?s:e.doc.createNode(s,{onTagObj:c=>r=c});r||(r=Yr(e.doc.schema.tags,o));let a=Qr(o,r,e);a.length>0&&(e.indentAtStart=(e.indentAtStart||0)+a.length+1);let l=typeof r.stringify=="function"?r.stringify(o,e,t,n):E(o)?we(o,e,t,n):o.toString(e,t,n);return a?E(o)||l[0]==="{"||l[0]==="["?`${a} ${l}`:`${a}
|
||||
${e.indent}${l}`:l}function yi({key:s,value:e},t,n,i){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:u,simpleKeys:f}}=t,h=C(s)&&s.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(T(s)){let N="With simple keys, collection cannot be used as a key value";throw new Error(N)}}let d=!f&&(!s||h&&e==null&&!t.inFlow||T(s)||(E(s)?s.type===v.BLOCK_FOLDED||s.type===v.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!d&&(f||!r),indent:a+l});let g=!1,p=!1,m=ee(s,t,()=>g=!0,()=>p=!0);if(!d&&!t.inFlow&&m.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");d=!0}if(t.inFlow){if(r||e==null)return g&&n&&n(),d?`? ${m}`:m}else if(r&&!f||e==null&&d)return m=`? ${m}`,h&&!g?m+=Z(m,t.indent,c(h)):p&&i&&i(),m;g&&(h=null),d?(h&&(m+=Z(m,t.indent,c(h))),m=`? ${m}
|
||||
${a}:`):(m=`${m}:`,h&&(m+=Z(m,t.indent,c(h))));let y="",b=null;if(C(e)){if(e.spaceBefore&&(y=`
|
||||
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`);let S=mt(`${b}${t}${d}`,c,as,cs(n));return`${w}
|
||||
${c}${S}`}function Yr(s,e,t,n){let{type:i,value:r}=s,{actualString:o,implicitKey:a,indent:l,inFlow:c}=e;if(a&&/[\n[\]{},]/.test(r)||c&&/[[\]{},]/.test(r))return yt(r,e);if(!r||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||c||r.indexOf(`
|
||||
`)===-1?yt(r,e):ls(s,e,t,n);if(!a&&!c&&i!==v.PLAIN&&r.indexOf(`
|
||||
`)!==-1)return ls(s,e,t,n);if(l===""&&us(r))return e.forceBlockIndent=!0,ls(s,e,t,n);let u=r.replace(/\n+/g,`$&
|
||||
${l}`);if(o){let f=g=>{var p;return g.default&&g.tag!=="tag:yaml.org,2002:str"&&((p=g.test)===null||p===void 0?void 0:p.test(u))},{compat:h,tags:d}=e.doc.schema;if(d.some(f)||h!=null&&h.some(f))return yt(r,e)}return a?u:mt(u,l,an,cs(e))}function be(s,e,t,n){let{implicitKey:i,inFlow:r}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)}),{type:a}=s;a!==v.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=v.QUOTE_DOUBLE);let l=u=>{switch(u){case v.BLOCK_FOLDED:case v.BLOCK_LITERAL:return i||r?yt(o.value,e):ls(o,e,t,n);case v.QUOTE_DOUBLE:return gt(o.value,e);case v.QUOTE_SINGLE:return ln(o.value,e);case v.PLAIN:return Yr(o,e,t,n);default:return null}},c=l(a);if(c===null){let{defaultKeyType:u,defaultStringType:f}=e.options,h=i&&u||f;if(c=l(h),c===null)throw new Error(`Unsupported default string type ${h}`)}return c}function fs(s,e){let t=Object.assign({blockQuote:!0,commentString:gi,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,e),n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function Qr(s,e){if(e.tag){let i=s.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)||i[0]}let t,n;if(E(e)){n=e.value;let i=s.filter(r=>r.identify&&r.identify(n));t=i.find(r=>r.format===e.format)||i.find(r=>!r.format)}else n=e,t=s.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!t){let i=n&&n.constructor?n.constructor.name:typeof n;throw new Error(`Tag not resolved for ${i} value`)}return t}function Hr(s,e,{anchors:t,doc:n}){if(!n.directives)return"";let i=[],r=(E(s)||T(s))&&s.anchor;r&&is(r)&&(t.add(r),i.push(`&${r}`));let o=s.tag||(e.default?null:e.tag);return o&&i.push(n.directives.tagString(o)),i.join(" ")}function te(s,e,t,n){var i;if(O(s))return s.toString(e,t,n);if(z(s)){if(e.doc.directives)return s.toString(e);if(!((i=e.resolvedAliases)===null||i===void 0)&&i.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let r,o=C(s)?s:e.doc.createNode(s,{onTagObj:c=>r=c});r||(r=Qr(e.doc.schema.tags,o));let a=Hr(o,r,e);a.length>0&&(e.indentAtStart=(e.indentAtStart||0)+a.length+1);let l=typeof r.stringify=="function"?r.stringify(o,e,t,n):E(o)?be(o,e,t,n):o.toString(e,t,n);return a?E(o)||l[0]==="{"||l[0]==="["?`${a} ${l}`:`${a}
|
||||
${e.indent}${l}`:l}function wi({key:s,value:e},t,n,i){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:u,simpleKeys:f}}=t,h=C(s)&&s.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(T(s)){let N="With simple keys, collection cannot be used as a key value";throw new Error(N)}}let d=!f&&(!s||h&&e==null&&!t.inFlow||T(s)||(E(s)?s.type===v.BLOCK_FOLDED||s.type===v.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!d&&(f||!r),indent:a+l});let g=!1,p=!1,m=te(s,t,()=>g=!0,()=>p=!0);if(!d&&!t.inFlow&&m.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");d=!0}if(t.inFlow){if(r||e==null)return g&&n&&n(),d?`? ${m}`:m}else if(r&&!f||e==null&&d)return m=`? ${m}`,h&&!g?m+=ee(m,t.indent,c(h)):p&&i&&i(),m;g&&(h=null),d?(h&&(m+=ee(m,t.indent,c(h))),m=`? ${m}
|
||||
${a}:`):(m=`${m}:`,h&&(m+=ee(m,t.indent,c(h))));let y="",b=null;if(C(e)){if(e.spaceBefore&&(y=`
|
||||
`),e.commentBefore){let N=c(e.commentBefore);y+=`
|
||||
${oe(N,t.indent)}`}b=e.comment}else e&&typeof e=="object"&&(e=o.createNode(e));t.implicitKey=!1,!d&&!h&&E(e)&&(t.indentAtStart=m.length+1),p=!1,!u&&l.length>=2&&!t.inFlow&&!d&&z(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substr(2));let k=!1,w=ee(e,t,()=>k=!0,()=>p=!0),S=" ";return y||h?S=w===""&&!t.inFlow?y:`${y}
|
||||
${ae(N,t.indent)}`}b=e.comment}else e&&typeof e=="object"&&(e=o.createNode(e));t.implicitKey=!1,!d&&!h&&E(e)&&(t.indentAtStart=m.length+1),p=!1,!u&&l.length>=2&&!t.inFlow&&!d&&X(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substr(2));let k=!1,w=te(e,t,()=>k=!0,()=>p=!0),S=" ";return y||h?S=w===""&&!t.inFlow?y:`${y}
|
||||
${t.indent}`:!d&&T(e)?(!(w[0]==="["||w[0]==="{")||w.includes(`
|
||||
`))&&(S=`
|
||||
${t.indent}`):(w===""||w[0]===`
|
||||
`)&&(S=""),m+=S+w,t.inFlow?k&&n&&n():b&&!k?m+=Z(m,t.indent,c(b)):p&&i&&i(),m}function an(s,e){(s==="debug"||s==="warn")&&(typeof process!="undefined"&&process.emitWarning?process.emitWarning(e):console.warn(e))}var wi="<<";function us(s,e,{key:t,value:n}){if(s&&s.doc.schema.merge&&Hr(t))if(n=H(n)?n.resolve(s.doc):n,z(n))for(let i of n.items)ln(s,e,i);else if(Array.isArray(n))for(let i of n)ln(s,e,i);else ln(s,e,n);else{let i=j(t,"",s);if(e instanceof Map)e.set(i,j(n,i,s));else if(e instanceof Set)e.add(i);else{let r=zr(t,i,s),o=j(n,r,s);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}var Hr=s=>s===wi||E(s)&&s.value===wi&&(!s.type||s.type===v.PLAIN);function ln(s,e,t){let n=s&&H(t)?t.resolve(s.doc):t;if(!V(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,s,Map);for(let[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function zr(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(C(s)&&t&&t.doc){let n=cs(t.doc,{});n.anchors=new Set;for(let r of t.anchors.keys())n.anchors.add(r.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=s.toString(n);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),an(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}function Ye(s,e,t){let n=ge(s,void 0,t),i=ge(e,void 0,t);return new L(n,i)}var L=class{constructor(e,t=null){Object.defineProperty(this,R,{value:tn}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return C(t)&&(t=t.clone(e)),C(n)&&(n=n.clone(e)),new L(t,n)}toJSON(e,t){let n=t&&t.mapAsMap?new Map:{};return us(t,n,this)}toString(e,t,n){return e&&e.doc?yi(this,e,t,n):JSON.stringify(this)}};var gt={intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,uniqueKeys:!0,version:"1.2"};function hs(s,e,t){var n;return(((n=e.inFlow)!==null&&n!==void 0?n:s.flow)?Zr:Xr)(s,e,t)}function Xr({comment:s,items:e},t,{blockItemPrefix:n,flowChars:i,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=t,u=Object.assign({},t,{indent:r,type:null}),f=!1,h=[];for(let g=0;g<e.length;++g){let p=e[g],m=null;if(C(p))!f&&p.spaceBefore&&h.push(""),fs(t,h,p.commentBefore,f),p.comment&&(m=p.comment);else if(O(p)){let b=C(p.key)?p.key:null;b&&(!f&&b.spaceBefore&&h.push(""),fs(t,h,b.commentBefore,f))}f=!1;let y=ee(p,u,()=>m=null,()=>f=!0);m&&(y+=Z(y,r,c(m))),f&&m&&(f=!1),h.push(n+y)}let d;if(h.length===0)d=i.start+i.end;else{d=h[0];for(let g=1;g<h.length;++g){let p=h[g];d+=p?`
|
||||
`)&&(S=""),m+=S+w,t.inFlow?k&&n&&n():b&&!k?m+=ee(m,t.indent,c(b)):p&&i&&i(),m}function cn(s,e){(s==="debug"||s==="warn")&&(typeof process!="undefined"&&process.emitWarning?process.emitWarning(e):console.warn(e))}var bi="<<";function hs(s,e,{key:t,value:n}){if(s&&s.doc.schema.merge&&zr(t))if(n=z(n)?n.resolve(s.doc):n,X(n))for(let i of n.items)un(s,e,i);else if(Array.isArray(n))for(let i of n)un(s,e,i);else un(s,e,n);else{let i=R(t,"",s);if(e instanceof Map)e.set(i,R(n,i,s));else if(e instanceof Set)e.add(i);else{let r=Xr(t,i,s),o=R(n,r,s);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}var zr=s=>s===bi||E(s)&&s.value===bi&&(!s.type||s.type===v.PLAIN);function un(s,e,t){let n=s&&z(t)?t.resolve(s.doc):t;if(!U(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,s,Map);for(let[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function Xr(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(C(s)&&t&&t.doc){let n=fs(t.doc,{});n.anchors=new Set;for(let r of t.anchors.keys())n.anchors.add(r.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=s.toString(n);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),cn(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}function He(s,e,t){let n=ye(s,void 0,t),i=ye(e,void 0,t);return new L(n,i)}var L=class{constructor(e,t=null){Object.defineProperty(this,q,{value:nn}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return C(t)&&(t=t.clone(e)),C(n)&&(n=n.clone(e)),new L(t,n)}toJSON(e,t){let n=t&&t.mapAsMap?new Map:{};return hs(t,n,this)}toString(e,t,n){return e&&e.doc?wi(this,e,t,n):JSON.stringify(this)}};var wt={intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,uniqueKeys:!0,version:"1.2"};function ps(s,e,t){var n;return(((n=e.inFlow)!==null&&n!==void 0?n:s.flow)?eo:Zr)(s,e,t)}function Zr({comment:s,items:e},t,{blockItemPrefix:n,flowChars:i,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=t,u=Object.assign({},t,{indent:r,type:null}),f=!1,h=[];for(let g=0;g<e.length;++g){let p=e[g],m=null;if(C(p))!f&&p.spaceBefore&&h.push(""),ds(t,h,p.commentBefore,f),p.comment&&(m=p.comment);else if(O(p)){let b=C(p.key)?p.key:null;b&&(!f&&b.spaceBefore&&h.push(""),ds(t,h,b.commentBefore,f))}f=!1;let y=te(p,u,()=>m=null,()=>f=!0);m&&(y+=ee(y,r,c(m))),f&&m&&(f=!1),h.push(n+y)}let d;if(h.length===0)d=i.start+i.end;else{d=h[0];for(let g=1;g<h.length;++g){let p=h[g];d+=p?`
|
||||
${l}${p}`:`
|
||||
`}}return s?(d+=`
|
||||
`+oe(c(s),l),a&&a()):f&&o&&o(),d}function Zr({comment:s,items:e},t,{flowChars:n,itemIndent:i,onComment:r}){let{indent:o,indentStep:a,options:{commentString:l}}=t;i+=a;let c=Object.assign({},t,{indent:i,inFlow:!0,type:null}),u=!1,f=0,h=[];for(let m=0;m<e.length;++m){let y=e[m],b=null;if(C(y))y.spaceBefore&&h.push(""),fs(t,h,y.commentBefore,!1),y.comment&&(b=y.comment);else if(O(y)){let w=C(y.key)?y.key:null;w&&(w.spaceBefore&&h.push(""),fs(t,h,w.commentBefore,!1),w.comment&&(u=!0));let S=C(y.value)?y.value:null;S?(S.comment&&(b=S.comment),S.commentBefore&&(u=!0)):y.value==null&&w&&w.comment&&(b=w.comment)}b&&(u=!0);let k=ee(y,c,()=>b=null);m<e.length-1&&(k+=","),b&&(k+=Z(k,i,l(b))),!u&&(h.length>f||k.includes(`
|
||||
`))&&(u=!0),h.push(k),f=h.length}let d,{start:g,end:p}=n;if(h.length===0)d=g+p;else if(u||(u=h.reduce((y,b)=>y+b.length+2,2)>ye.maxFlowStringSingleLineLength),u){d=g;for(let m of h)d+=m?`
|
||||
`+ae(c(s),l),a&&a()):f&&o&&o(),d}function eo({comment:s,items:e},t,{flowChars:n,itemIndent:i,onComment:r}){let{indent:o,indentStep:a,options:{commentString:l}}=t;i+=a;let c=Object.assign({},t,{indent:i,inFlow:!0,type:null}),u=!1,f=0,h=[];for(let m=0;m<e.length;++m){let y=e[m],b=null;if(C(y))y.spaceBefore&&h.push(""),ds(t,h,y.commentBefore,!1),y.comment&&(b=y.comment);else if(O(y)){let w=C(y.key)?y.key:null;w&&(w.spaceBefore&&h.push(""),ds(t,h,w.commentBefore,!1),w.comment&&(u=!0));let S=C(y.value)?y.value:null;S?(S.comment&&(b=S.comment),S.commentBefore&&(u=!0)):y.value==null&&w&&w.comment&&(b=w.comment)}b&&(u=!0);let k=te(y,c,()=>b=null);m<e.length-1&&(k+=","),b&&(k+=ee(k,i,l(b))),!u&&(h.length>f||k.includes(`
|
||||
`))&&(u=!0),h.push(k),f=h.length}let d,{start:g,end:p}=n;if(h.length===0)d=g+p;else if(u||(u=h.reduce((y,b)=>y+b.length+2,2)>we.maxFlowStringSingleLineLength),u){d=g;for(let m of h)d+=m?`
|
||||
${a}${o}${m}`:`
|
||||
`;d+=`
|
||||
${o}${p}`}else d=`${g} ${h.join(" ")} ${p}`;return s&&(d+=Z(d,l(s),o),r&&r()),d}function fs({indent:s,options:{commentString:e}},t,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let r=oe(e(n),s);t.push(r.trimStart())}}function Ee(s,e){let t=E(e)?e.value:e;for(let n of s)if(O(n)&&(n.key===e||n.key===t||E(n.key)&&n.key.value===t))return n}var x=class extends ye{constructor(e){super(Q,e),this.items=[]}static get tagName(){return"tag:yaml.org,2002:map"}add(e,t){let n;O(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new L(e,e.value):n=new L(e.key,e.value);let i=Ee(this.items,n.key),r=this.schema&&this.schema.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);E(i.value)&&is(n.value)?i.value.value=n.value:i.value=n.value}else if(r){let o=this.items.findIndex(a=>r(n,a)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let t=Ee(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Ee(this.items,e),i=n&&n.value;return!t&&E(i)?i.value:i}has(e){return!!Ee(this.items,e)}set(e,t){this.add(new L(e,t),!0)}toJSON(e,t,n){let i=n?new n:t&&t.mapAsMap?new Map:{};t&&t.onCreate&&t.onCreate(i);for(let r of this.items)us(t,i,r);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!O(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),hs(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}};function eo(s,e,t){let{keepUndefined:n,replacer:i}=t,r=new x(s),o=(a,l)=>{if(typeof i=="function")l=i.call(e,a,l);else if(Array.isArray(i)&&!i.includes(a))return;(l!==void 0||n)&&r.items.push(Ye(a,l,t))};if(e instanceof Map)for(let[a,l]of e)o(a,l);else if(e&&typeof e=="object")for(let a of Object.keys(e))o(a,e[a]);return typeof s.sortMapEntries=="function"&&r.items.sort(s.sortMapEntries),r}var te={collection:"map",createNode:eo,default:!0,nodeClass:x,tag:"tag:yaml.org,2002:map",resolve(s,e){return V(s)||e("Expected a mapping for this tag"),s}};var q=class extends ye{constructor(e){super(pe,e),this.items=[]}static get tagName(){return"tag:yaml.org,2002:seq"}add(e){this.items.push(e)}delete(e){let t=ds(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let n=ds(e);if(typeof n!="number")return;let i=this.items[n];return!t&&E(i)?i.value:i}has(e){let t=ds(e);return typeof t=="number"&&t<this.items.length}set(e,t){let n=ds(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[n];E(i)&&is(t)?i.value=t:this.items[n]=t}toJSON(e,t){let n=[];t&&t.onCreate&&t.onCreate(n);let i=0;for(let r of this.items)n.push(j(r,String(i++),t));return n}toString(e,t,n){return e?hs(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}};function ds(s){let e=E(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function to(s,e,t){let{replacer:n}=t,i=new q(s);if(e&&Symbol.iterator in Object(e)){let r=0;for(let o of e){if(typeof n=="function"){let a=e instanceof Set?o:String(r++);o=n.call(e,a,o)}i.items.push(ge(o,void 0,t))}}return i}var se={collection:"seq",createNode:to,default:!0,nodeClass:q,tag:"tag:yaml.org,2002:seq",resolve(s,e){return z(s)||e("Expected a sequence for this tag"),s}};var Oe={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),we(s,e,t,n)}};var Re={identify:s=>s==null,createNode:()=>new v(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new v(null),stringify:({source:s},e)=>s&&Re.test.test(s)?s:e.options.nullStr};var yt={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new v(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&yt.test.test(s)){let n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};function $({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=e-(r.length-o-1);for(;a-- >0;)r+="0"}return r}var ps={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:$},ms={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){let
Line truncated
|
||||
`:" ")}return we({comment:s,type:e,value:a},n,i,r)}};function un(s,e){if(z(s))for(let t=0;t<s.items.length;++t){let n=s.items[t];if(!O(n)){if(V(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new L(new v(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}
|
||||
${o}${p}`}else d=`${g} ${h.join(" ")} ${p}`;return s&&(d+=ee(d,l(s),o),r&&r()),d}function ds({indent:s,options:{commentString:e}},t,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let r=ae(e(n),s);t.push(r.trimStart())}}function Ne(s,e){let t=E(e)?e.value:e;for(let n of s)if(O(n)&&(n.key===e||n.key===t||E(n.key)&&n.key.value===t))return n}var x=class extends we{constructor(e){super(H,e),this.items=[]}static get tagName(){return"tag:yaml.org,2002:map"}add(e,t){let n;O(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new L(e,e.value):n=new L(e.key,e.value);let i=Ne(this.items,n.key),r=this.schema&&this.schema.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);E(i.value)&&os(n.value)?i.value.value=n.value:i.value=n.value}else if(r){let o=this.items.findIndex(a=>r(n,a)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let t=Ne(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Ne(this.items,e),i=n&&n.value;return!t&&E(i)?i.value:i}has(e){return!!Ne(this.items,e)}set(e,t){this.add(new L(e,t),!0)}toJSON(e,t,n){let i=n?new n:t&&t.mapAsMap?new Map:{};t&&t.onCreate&&t.onCreate(i);for(let r of this.items)hs(t,i,r);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!O(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),ps(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}};function to(s,e,t){let{keepUndefined:n,replacer:i}=t,r=new x(s),o=(a,l)=>{if(typeof i=="function")l=i.call(e,a,l);else if(Array.isArray(i)&&!i.includes(a))return;(l!==void 0||n)&&r.items.push(He(a,l,t))};if(e instanceof Map)for(let[a,l]of e)o(a,l);else if(e&&typeof e=="object")for(let a of Object.keys(e))o(a,e[a]);return typeof s.sortMapEntries=="function"&&r.items.sort(s.sortMapEntries),r}var se={collection:"map",createNode:to,default:!0,nodeClass:x,tag:"tag:yaml.org,2002:map",resolve(s,e){return U(s)||e("Expected a mapping for this tag"),s}};var F=class extends we{constructor(e){super(me,e),this.items=[]}static get tagName(){return"tag:yaml.org,2002:seq"}add(e){this.items.push(e)}delete(e){let t=ms(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let n=ms(e);if(typeof n!="number")return;let i=this.items[n];return!t&&E(i)?i.value:i}has(e){let t=ms(e);return typeof t=="number"&&t<this.items.length}set(e,t){let n=ms(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[n];E(i)&&os(t)?i.value=t:this.items[n]=t}toJSON(e,t){let n=[];t&&t.onCreate&&t.onCreate(n);let i=0;for(let r of this.items)n.push(R(r,String(i++),t));return n}toString(e,t,n){return e?ps(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}};function ms(s){let e=E(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function so(s,e,t){let{replacer:n}=t,i=new F(s);if(e&&Symbol.iterator in Object(e)){let r=0;for(let o of e){if(typeof n=="function"){let a=e instanceof Set?o:String(r++);o=n.call(e,a,o)}i.items.push(ye(o,void 0,t))}}return i}var ne={collection:"seq",createNode:so,default:!0,nodeClass:F,tag:"tag:yaml.org,2002:seq",resolve(s,e){return X(s)||e("Expected a sequence for this tag"),s}};var Ce={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),be(s,e,t,n)}};var Fe={identify:s=>s==null,createNode:()=>new v(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new v(null),stringify:({source:s},e)=>s&&Fe.test.test(s)?s:e.options.nullStr};var bt={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new v(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&bt.test.test(s)){let n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};function $({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=e-(r.length-o-1);for(;a-- >0;)r+="0"}return r}var gs={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:$},ys={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){le
Line truncated
|
||||
`:" ")}return be({comment:s,type:e,value:a},n,i,r)}};function hn(s,e){if(X(s))for(let t=0;t<s.items.length;++t){let n=s.items[t];if(!O(n)){if(U(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new L(new v(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}
|
||||
${i.key.commentBefore}`:n.commentBefore),n.comment){let r=i.value||i.key;r.comment=r.comment?`${n.comment}
|
||||
${r.comment}`:n.comment}n=i}s.items[t]=O(n)?n:new L(n)}}else e("Expected a sequence for this tag");return s}function fn(s,e,t){let{replacer:n}=t,i=new q(s);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected { key: value } tuple: ${o}`)}else a=o;i.items.push(Ye(a,l,t))}return i}var bt={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:un,createNode:fn};var Ne=class extends q{constructor(){super(),this.add=x.prototype.add.bind(this),this.delete=x.prototype.delete.bind(this),this.get=x.prototype.get.bind(this),this.has=x.prototype.has.bind(this),this.set=x.prototype.set.bind(this),this.tag=Ne.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t&&t.onCreate&&t.onCreate(n);for(let i of this.items){let r,o;if(O(i)?(r=j(i.key,"",t),o=j(i.value,r,t)):r=j(i,"",t),n.has(r))throw new Error("Ordered maps must not include duplicate keys");n.set(r,o)}return n}};Ne.tag="tag:yaml.org,2002:omap";var vt={collection:"seq",identify:s=>s instanceof Map,nodeClass:Ne,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){let t=un(s,e),n=[];for(let{key:i}of t.items)E(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new Ne,t)},createNode(s,e,t){let n=fn(s,e,t),i=new Ne;return i.items=n.items,i}};function Ei({value:s,source:e},t){return e&&(s?hn:dn).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}var hn={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new v(!0),stringify:Ei},dn={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,resolve:()=>new v(!1),stringify:Ei};var Oi={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:$},Ni={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():$(s)}},Ci={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){let e=new v(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){let n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:$};var St=s=>typeof s=="bigint"||Number.isInteger(s);function ks(s,e,t,{intAsBigInt:n}){let i=s[0];if((i==="-"||i==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}let o=BigInt(s);return i==="-"?BigInt(-1)*o:o}let r=parseInt(s,t);return i==="-"?-1*r:r}function pn(s,e,t){let{value:n}=s;if(St(n)){let i=n.toString(e);return n<0?"-"+t+i.substr(1):t+i}return $(s)}var Ti={identify:St,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>ks(s,2,2,t),stringify:s=>pn(s,2,"0b")},Ai={identify:St,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>ks(s,1,8,t),stringify:s=>pn(s,8,"0")},Li={identify:St,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>ks(s,0,10,t),stringify:$},Ii={identify:St,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>ks(s,2,16,t),stringify:s=>pn(s,16,"0x")};var Ce=class extends x{constructor(e){super(e),this.tag=Ce.tag}add(e){let t;O(e)?t=e:typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new L(e.key,null):t=new L(e,null),Ee(this.items,t.key)||this.items.push(t)}get(e,t){let n=Ee(this.items,e);return!t&&O(n)?E(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=Ee(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new L(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}};Ce.tag="tag:yaml.org,2002:set";var kt={collection:"map",identify:s=>s instanceof Set,nodeClass:Ce,default:!1,tag:"tag:yaml.org,2002:set",resolve(s,e){if(V(s)){if(s.hasAllNullValues(!0))return Object.assign(new Ce,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s},createNode(s,e,t){let{replacer:n}=t,
Line truncated
|
||||
${r.comment}`:n.comment}n=i}s.items[t]=O(n)?n:new L(n)}}else e("Expected a sequence for this tag");return s}function dn(s,e,t){let{replacer:n}=t,i=new F(s);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected { key: value } tuple: ${o}`)}else a=o;i.items.push(He(a,l,t))}return i}var St={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:hn,createNode:dn};var Te=class extends F{constructor(){super(),this.add=x.prototype.add.bind(this),this.delete=x.prototype.delete.bind(this),this.get=x.prototype.get.bind(this),this.has=x.prototype.has.bind(this),this.set=x.prototype.set.bind(this),this.tag=Te.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t&&t.onCreate&&t.onCreate(n);for(let i of this.items){let r,o;if(O(i)?(r=R(i.key,"",t),o=R(i.value,r,t)):r=R(i,"",t),n.has(r))throw new Error("Ordered maps must not include duplicate keys");n.set(r,o)}return n}};Te.tag="tag:yaml.org,2002:omap";var kt={collection:"seq",identify:s=>s instanceof Map,nodeClass:Te,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){let t=hn(s,e),n=[];for(let{key:i}of t.items)E(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new Te,t)},createNode(s,e,t){let n=dn(s,e,t),i=new Te;return i.items=n.items,i}};function Oi({value:s,source:e},t){return e&&(s?pn:mn).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}var pn={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new v(!0),stringify:Oi},mn={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,resolve:()=>new v(!1),stringify:Oi};var Ni={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:$},Ci={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():$(s)}},Ti={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){let e=new v(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){let n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:$};var Et=s=>typeof s=="bigint"||Number.isInteger(s);function Os(s,e,t,{intAsBigInt:n}){let i=s[0];if((i==="-"||i==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}let o=BigInt(s);return i==="-"?BigInt(-1)*o:o}let r=parseInt(s,t);return i==="-"?-1*r:r}function gn(s,e,t){let{value:n}=s;if(Et(n)){let i=n.toString(e);return n<0?"-"+t+i.substr(1):t+i}return $(s)}var Ai={identify:Et,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>Os(s,2,2,t),stringify:s=>gn(s,2,"0b")},Li={identify:Et,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>Os(s,1,8,t),stringify:s=>gn(s,8,"0")},_i={identify:Et,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>Os(s,0,10,t),stringify:$},Ii={identify:Et,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>Os(s,2,16,t),stringify:s=>gn(s,16,"0x")};var Ae=class extends x{constructor(e){super(e),this.tag=Ae.tag}add(e){let t;O(e)?t=e:typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new L(e.key,null):t=new L(e,null),Ne(this.items,t.key)||this.items.push(t)}get(e,t){let n=Ne(this.items,e);return!t&&O(n)?E(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=Ne(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new L(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}};Ae.tag="tag:yaml.org,2002:set";var Ot={collection:"map",identify:s=>s instanceof Set,nodeClass:Ae,default:!1,tag:"tag:yaml.org,2002:set",resolve(s,e){if(U(s)){if(s.hasAllNullValues(!0))return Object.assign(new Ae,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s},createNode(s,e,t){let{replacer:n}=t,
Line truncated
|
||||
`)+`
|
||||
`}function He(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){let o=n[i],a=He(s,n,String(i),o);a===void 0?delete n[i]:a!==o&&(n[i]=a)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let r=n.get(i),o=He(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(let i of Array.from(n)){let r=He(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(let[i,r]of Object.entries(n)){let o=He(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}var ae=class{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,R,{value:ts});let i=null;typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let r=Object.assign({},gt,n);this.options=r;let{version:o}=r;n!=null&&n.directives?(this.directives=n.directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new _({version:o}),this.setSchema(o,n),e===void 0?this.contents=null:this.contents=this.createNode(e,i,n)}clone(){let e=Object.create(ae.prototype,{[R]:{value:ts}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=C(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ze(this.contents)&&this.contents.add(e)}addIn(e,t){ze(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=sn(this);e.anchor=!t||n.has(t)?nn(t||"a",n):t}return new me(e.anchor)}createNode(e,t,n){let i;if(typeof t=="function")e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){let m=b=>typeof b=="number"||b instanceof String||b instanceof Number,y=t.filter(m).map(String);y.length>0&&(t=t.concat(y)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:u}=n||{},{onAnchor:f,setAnchors:h,sourceObjects:d}=pi(this,o||"a"),g={aliasDuplicateObjects:r!=null?r:!0,keepUndefined:l!=null?l:!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:d},p=ge(e,u,g);return a&&T(p)&&(p.flow=!0),h(),p}createPair(e,t,n={}){let i=this.createNode(e,null,n),r=this.createNode(t,null,n);return new L(i,r)}delete(e){return ze(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Ge(e)?this.contents==null?!1:(this.contents=null,!0):ze(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return T(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Ge(e)?!t&&E(this.contents)?this.contents.value:this.contents:T(this.contents)?this.contents.getIn(e,t):void 0}has(e){return T(this.contents)?this.contents.has(e):!1}hasIn(e){return Ge(e)?this.contents!==void 0:T(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=ft(this.schema,[e],t):ze(this.contents)&&this.contents.set(e,t)}setIn(e,t){Ge(e)?this.contents=t:this.contents==null?this.contents=ft(this.schema,Array.from(e),t):ze(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new _({version:"1.1"}),n={merge:!0,resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":this.directives?this.directives.yaml.version="1.2":this.directives=new _({version:"1.2"}),n={merge:!1,resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new qe(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100,stringify:ee},l=j(this.contents,t||"",a);if(typeof r=="function")for(let{count:c,res:u}of a.anchors.values())r(u,c);return typeof o=="function"?He(o,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return $i(this,e)}};function ze(s){if(T(s))return!0;throw new Error("Expected a YAML collection as document contents")}var Et=class extends Error{constructor(e,t,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=t}},W=class extends Et{constructor(e,t,n){super("YAMLParseError",e,t,n)}},Ot=class extends Et{constructor(e,t,n){super("YAMLWarning",e,t,n)}},yn=(s,e)
Line truncated
|
||||
`}function Xe(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){let o=n[i],a=Xe(s,n,String(i),o);a===void 0?delete n[i]:a!==o&&(n[i]=a)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let r=n.get(i),o=Xe(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(let i of Array.from(n)){let r=Xe(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(let[i,r]of Object.entries(n)){let o=Xe(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}var le=class{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,q,{value:ns});let i=null;typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let r=Object.assign({},wt,n);this.options=r;let{version:o}=r;n!=null&&n.directives?(this.directives=n.directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new I({version:o}),this.setSchema(o,n),e===void 0?this.contents=null:this.contents=this.createNode(e,i,n)}clone(){let e=Object.create(le.prototype,{[q]:{value:ns}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=C(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Ze(this.contents)&&this.contents.add(e)}addIn(e,t){Ze(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=rn(this);e.anchor=!t||n.has(t)?on(t||"a",n):t}return new ge(e.anchor)}createNode(e,t,n){let i;if(typeof t=="function")e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){let m=b=>typeof b=="number"||b instanceof String||b instanceof Number,y=t.filter(m).map(String);y.length>0&&(t=t.concat(y)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:u}=n||{},{onAnchor:f,setAnchors:h,sourceObjects:d}=mi(this,o||"a"),g={aliasDuplicateObjects:r!=null?r:!0,keepUndefined:l!=null?l:!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:d},p=ye(e,u,g);return a&&T(p)&&(p.flow=!0),h(),p}createPair(e,t,n={}){let i=this.createNode(e,null,n),r=this.createNode(t,null,n);return new L(i,r)}delete(e){return Ze(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Qe(e)?this.contents==null?!1:(this.contents=null,!0):Ze(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return T(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Qe(e)?!t&&E(this.contents)?this.contents.value:this.contents:T(this.contents)?this.contents.getIn(e,t):void 0}has(e){return T(this.contents)?this.contents.has(e):!1}hasIn(e){return Qe(e)?this.contents!==void 0:T(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=dt(this.schema,[e],t):Ze(this.contents)&&this.contents.set(e,t)}setIn(e,t){Qe(e)?this.contents=t:this.contents==null?this.contents=dt(this.schema,Array.from(e),t):Ze(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new I({version:"1.1"}),n={merge:!0,resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":this.directives?this.directives.yaml.version="1.2":this.directives=new I({version:"1.2"}),n={merge:!1,resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new Ke(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100,stringify:te},l=R(this.contents,t||"",a);if(typeof r=="function")for(let{count:c,res:u}of a.anchors.values())r(u,c);return typeof o=="function"?Xe(o,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return Bi(this,e)}};function Ze(s){if(T(s))return!0;throw new Error("Expected a YAML collection as document contents")}var Nt=class extends Error{constructor(e,t,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=t}},G=class extends Nt{constructor(e,t,n){super("YAMLParseError",e,t,n)}},Ct=class extends Nt{constructor(e,t,n){super("YAMLWarning",e,t,n)}},bn=(s,e)
Line truncated
|
||||
`),o=a+o}if(/[^ ]/.test(o)){let a=1,l=t.linePos[1];l&&l.line===n&&l.col>i&&(a=Math.min(l.col-i,80-r));let c=" ".repeat(r)+"^".repeat(a);t.message+=`:
|
||||
|
||||
${o}
|
||||
${c}
|
||||
`}};function le(s,{flow:e,indicator:t,next:n,offset:i,onError:r,startOnNewline:o}){let a=!1,l=o,c=o,u="",f="",h=!1,d=!1,g=null,p=null,m=null,y=null,b=null;for(let S of s)switch(d&&(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma"&&r(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),d=!1),S.type){case"space":!e&&l&&t!=="doc-start"&&S.source[0]===" "&&r(S,"TAB_AS_INDENT","Tabs are not allowed as indentation"),c=!0;break;case"comment":{c||r(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let N=S.source.substring(1)||" ";u?u+=f+N:u=N,f="",l=!1;break}case"newline":l?u?u+=S.source:a=!0:f+=S.source,l=!0,h=!0,c=!0;break;case"anchor":g&&r(S,"MULTIPLE_ANCHORS","A node can have at most one anchor"),g=S,b===null&&(b=S.offset),l=!1,c=!1,d=!0;break;case"tag":{p&&r(S,"MULTIPLE_TAGS","A node can have at most one tag"),p=S,b===null&&(b=S.offset),l=!1,c=!1,d=!0;break}case t:(g||p)&&r(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`),y&&r(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${e||"collection"}`),y=S,l=!1,c=!1;break;case"comma":if(e){m&&r(S,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),m=S,l=!1,c=!1;break}default:r(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),l=!1,c=!1}let k=s[s.length-1],w=k?k.offset+k.source.length:i;return d&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&r(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),{comma:m,found:y,spaceBefore:a,comment:u,hasNewline:h,anchor:g,tag:p,end:w,start:b!=null?b:w}}function Te(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(`
|
||||
`))return!0;if(s.end){for(let e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of s.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(Te(e.key)||Te(e.value))return!0}return!1;default:return!0}}function Nt(s,e,t){if((e==null?void 0:e.type)==="flow-collection"){let n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&Te(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Cs(s,e,t){let{uniqueKeys:n}=s.options;if(n===!1)return!1;let i=typeof n=="function"?n:(r,o)=>r===o||E(r)&&E(o)&&r.value===o.value&&!(r.value==="<<"&&s.schema.merge);return e.some(r=>i(r.key,t))}var Bi="All mapping items must start at the same column";function Di({composeNode:s,composeEmptyNode:e},t,n,i){var r;let o=new x(t.schema);t.atRoot&&(t.atRoot=!1);let a=n.offset;for(let l of n.items){let{start:c,key:u,sep:f,value:h}=l,d=le(c,{indicator:"explicit-key-ind",next:u||(f==null?void 0:f[0]),offset:a,onError:i,startOnNewline:!0}),g=!d.found;if(g){if(u&&(u.type==="block-seq"?i(a,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in u&&u.indent!==n.indent&&i(a,"BAD_INDENT",Bi)),!d.anchor&&!d.tag&&!f){d.comment&&(o.comment?o.comment+=`
|
||||
`+d.comment:o.comment=d.comment);continue}}else((r=d.found)===null||r===void 0?void 0:r.indent)!==n.indent&&i(a,"BAD_INDENT",Bi);g&&Te(u)&&i(u,"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line");let p=d.end,m=u?s(t,u,d,i):e(t,p,c,null,d,i);t.schema.compat&&Nt(n.indent,u,i),Cs(t,o.items,m)&&i(p,"DUPLICATE_KEY","Map keys must be unique");let y=le(f||[],{indicator:"map-value-ind",next:h,offset:m.range[2],onError:i,startOnNewline:!u||u.type==="block-scalar"});if(a=y.end,y.found){g&&((h==null?void 0:h.type)==="block-map"&&!y.hasNewline&&i(a,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&d.start<y.found.offset-1024&&i(m.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let b=h?s(t,h,y,i):e(t,a,f,null,y,i);t.schema.compat&&Nt(n.indent,h,i),a=b.range[2];let k=new L(m,b);t.options.keepSourceTokens&&(k.srcToken=l),o.items.push(k)}else{g&&i(m.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),y.comment&&(m.comment?m.comment+=`
|
||||
`+y.comment:m.comment=y.comment);let b=new L(m);t.options.keepSourceTokens&&(b.srcToken=l),o.items.push(b)}}return o.range=[n.offset,a,a],o}function ji({composeNode:s,composeEmptyNode:e},t,n,i){let r=new q(t.schema);t.atRoot&&(t.atRoot=!1);let o=n.offset;for(let{start:a,value:l}of n.items){let c=le(a,{indicator:"seq-item-ind",next:l,offset:o,onError:i,startOnNewline:!0});if(o=c.end,!c.found)if(c.anchor||c.tag||l)l&&l.type==="block-seq"?i(o,"BAD_INDENT","All sequence items must start at the same column"):i(o,"MISSING_CHAR","Sequence item without - indicator");else{c.comment&&(r.comment=c.comment);continue}let u=l?s(t,l,c,i):e(t,o,a,null,c,i);t.schema.compat&&Nt(n.indent,l,i),o=u.range[2],r.items.push(u)}return r.range=[n.offset,o,o],r}function ce(s,e,t,n){let i="";if(s){let r=!1,o="";for(let a of s){let{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{t&&!r&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=l.substring(1)||" ";i?i+=o+u:i=u,o="";break}case"newline":i&&(o+=l),r=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:i,offset:e}}var wn="Block collections are not allowed within flow collections",bn=s=>s&&(s.type==="block-map"||s.type==="block-seq");function Ri({composeNode:s,composeEmptyNode:e},t,n,i){let r=n.start.source==="{",o=r?"flow map":"flow sequence",a=r?new x(t.schema):new q(t.schema);a.flow=!0;let l=t.atRoot;l&&(t.atRoot=!1);let c=n.offset+n.start.source.length;for(let g=0;g<n.items.length;++g){let p=n.items[g],{start:m,key:y,sep:b,value:k}=p,w=le(m,{flow:o,indicator:"explicit-key-ind",next:y||(b==null?void 0:b[0]),offset:c,onError:i,startOnNewline:!1});if(!w.found){if(!w.anchor&&!w.tag&&!b&&!k){g===0&&w.comma?i(w.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`):g<n.items.length-1&&i(w.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${o}`),w.comment&&(a.comment?a.comment+=`
|
||||
`+w.comment:a.comment=w.comment),c=w.end;continue}!r&&t.options.strict&&Te(y)&&i(y,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)w.comma&&i(w.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`);else if(w.comma||i(w.start,"MISSING_CHAR",`Missing , between ${o} items`),w.comment){let S="";e:for(let N of m)switch(N.type){case"comma":case"space":break;case"comment":S=N.source.substring(1);break e;default:break e}if(S){let N=a.items[a.items.length-1];O(N)&&(N=N.value||N.key),N.comment?N.comment+=`
|
||||
`+S:N.comment=S,w.comment=w.comment.substring(S.length+1)}}if(!r&&!b&&!w.found){let S=k?s(t,k,w,i):e(t,w.end,b,null,w,i);a.items.push(S),c=S.range[2],bn(k)&&i(S.range,"BLOCK_IN_FLOW",wn)}else{let S=w.end,N=y?s(t,y,w,i):e(t,S,m,null,w,i);bn(y)&&i(N.range,"BLOCK_IN_FLOW",wn);let F=le(b||[],{flow:o,indicator:"map-value-ind",next:k,offset:N.range[2],onError:i,startOnNewline:!1});if(F.found){if(!r&&!w.found&&t.options.strict){if(b)for(let ne of b){if(ne===F.found)break;if(ne.type==="newline"){i(ne,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}w.start<F.found.offset-1024&&i(F.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else k&&("source"in k&&k.source&&k.source[0]===":"?i(k,"MISSING_CHAR",`Missing space after : in ${o}`):i(F.start,"MISSING_CHAR",`Missing , or : between ${o} items`));let et=k?s(t,k,F,i):F.found?e(t,F.end,b,null,F,i):null;et?bn(k)&&i(et.range,"BLOCK_IN_FLOW",wn):F.comment&&(N.comment?N.comment+=`
|
||||
`+F.comment:N.comment=F.comment);let Ms=new L(N,et);if(t.options.keepSourceTokens&&(Ms.srcToken=p),r){let ne=a;Cs(t,ne.items,N)&&i(S,"DUPLICATE_KEY","Map keys must be unique"),ne.items.push(Ms)}else{let ne=new x(t.schema);ne.flow=!0,ne.items.push(Ms),a.items.push(ne)}c=et?et.range[2]:F.end}}let u=r?"}":"]",[f,...h]=n.end,d=c;if(f&&f.source===u)d=f.offset+f.source.length;else{let g=o[0].toUpperCase()+o.substring(1),p=l?`${g} must end with a ${u}`:`${g} in block collection must be sufficiently indented and end with a ${u}`;i(c,l?"MISSING_CHAR":"BAD_INDENT",p),f&&f.source.length!==1&&h.unshift(f)}if(h.length>0){let g=ce(h,d,t.options.strict,i);g.comment&&(a.comment?a.comment+=`
|
||||
`+g.comment:a.comment=g.comment),a.range=[n.offset,d,g.offset]}else a.range=[n.offset,d,d];return a}function qi(s,e,t,n,i){let r;switch(t.type){case"block-map":{r=Di(s,e,t,i);break}case"block-seq":{r=ji(s,e,t,i);break}case"flow-collection":{r=Ri(s,e,t,i);break}}if(!n)return r;let o=e.directives.tagName(n.source,h=>i(n,"TAG_RESOLVE_FAILED",h));if(!o)return r;let a=r.constructor;if(o==="!"||o===a.tagName)return r.tag=a.tagName,r;let l=V(r)?"map":"seq",c=e.schema.tags.find(h=>h.collection===l&&h.tag===o);if(!c){let h=e.schema.knownTags[o];if(h&&h.collection===l)e.schema.tags.push(Object.assign({},h,{default:!1})),c=h;else return i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),r.tag=o,r}let u=c.resolve(r,h=>i(n,"TAG_RESOLVE_FAILED",h),e.options),f=C(u)?u:new v(u);return f.range=r.range,f.tag=o,c!=null&&c.format&&(f.format=c.format),f}function Ts(s,e,t){let n=s.offset,i=ro(s,e,t);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let r=i.mode===">"?v.BLOCK_FOLDED:v.BLOCK_LITERAL,o=s.source?oo(s.source):[],a=o.length;for(let p=o.length-1;p>=0;--p){let m=o[p][1];if(m===""||m==="\r")a=p;else break}if(!s.source||a===0){let p=i.chomp==="+"?`
|
||||
`}};function ce(s,{flow:e,indicator:t,next:n,offset:i,onError:r,startOnNewline:o}){let a=!1,l=o,c=o,u="",f="",h=!1,d=!1,g=null,p=null,m=null,y=null,b=null;for(let S of s)switch(d&&(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma"&&r(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),d=!1),S.type){case"space":!e&&l&&t!=="doc-start"&&S.source[0]===" "&&r(S,"TAB_AS_INDENT","Tabs are not allowed as indentation"),c=!0;break;case"comment":{c||r(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let N=S.source.substring(1)||" ";u?u+=f+N:u=N,f="",l=!1;break}case"newline":l?u?u+=S.source:a=!0:f+=S.source,l=!0,h=!0,c=!0;break;case"anchor":g&&r(S,"MULTIPLE_ANCHORS","A node can have at most one anchor"),g=S,b===null&&(b=S.offset),l=!1,c=!1,d=!0;break;case"tag":{p&&r(S,"MULTIPLE_TAGS","A node can have at most one tag"),p=S,b===null&&(b=S.offset),l=!1,c=!1,d=!0;break}case t:(g||p)&&r(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`),y&&r(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${e||"collection"}`),y=S,l=!1,c=!1;break;case"comma":if(e){m&&r(S,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),m=S,l=!1,c=!1;break}default:r(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),l=!1,c=!1}let k=s[s.length-1],w=k?k.offset+k.source.length:i;return d&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&r(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),{comma:m,found:y,spaceBefore:a,comment:u,hasNewline:h,anchor:g,tag:p,end:w,start:b!=null?b:w}}function Le(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(`
|
||||
`))return!0;if(s.end){for(let e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of s.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(Le(e.key)||Le(e.value))return!0}return!1;default:return!0}}function Tt(s,e,t){if((e==null?void 0:e.type)==="flow-collection"){let n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&Le(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function As(s,e,t){let{uniqueKeys:n}=s.options;if(n===!1)return!1;let i=typeof n=="function"?n:(r,o)=>r===o||E(r)&&E(o)&&r.value===o.value&&!(r.value==="<<"&&s.schema.merge);return e.some(r=>i(r.key,t))}var Di="All mapping items must start at the same column";function ji({composeNode:s,composeEmptyNode:e},t,n,i){var r;let o=new x(t.schema);t.atRoot&&(t.atRoot=!1);let a=n.offset;for(let l of n.items){let{start:c,key:u,sep:f,value:h}=l,d=ce(c,{indicator:"explicit-key-ind",next:u||(f==null?void 0:f[0]),offset:a,onError:i,startOnNewline:!0}),g=!d.found;if(g){if(u&&(u.type==="block-seq"?i(a,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in u&&u.indent!==n.indent&&i(a,"BAD_INDENT",Di)),!d.anchor&&!d.tag&&!f){d.comment&&(o.comment?o.comment+=`
|
||||
`+d.comment:o.comment=d.comment);continue}}else((r=d.found)===null||r===void 0?void 0:r.indent)!==n.indent&&i(a,"BAD_INDENT",Di);g&&Le(u)&&i(u,"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line");let p=d.end,m=u?s(t,u,d,i):e(t,p,c,null,d,i);t.schema.compat&&Tt(n.indent,u,i),As(t,o.items,m)&&i(p,"DUPLICATE_KEY","Map keys must be unique");let y=ce(f||[],{indicator:"map-value-ind",next:h,offset:m.range[2],onError:i,startOnNewline:!u||u.type==="block-scalar"});if(a=y.end,y.found){g&&((h==null?void 0:h.type)==="block-map"&&!y.hasNewline&&i(a,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&d.start<y.found.offset-1024&&i(m.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let b=h?s(t,h,y,i):e(t,a,f,null,y,i);t.schema.compat&&Tt(n.indent,h,i),a=b.range[2];let k=new L(m,b);t.options.keepSourceTokens&&(k.srcToken=l),o.items.push(k)}else{g&&i(m.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),y.comment&&(m.comment?m.comment+=`
|
||||
`+y.comment:m.comment=y.comment);let b=new L(m);t.options.keepSourceTokens&&(b.srcToken=l),o.items.push(b)}}return o.range=[n.offset,a,a],o}function Ri({composeNode:s,composeEmptyNode:e},t,n,i){let r=new F(t.schema);t.atRoot&&(t.atRoot=!1);let o=n.offset;for(let{start:a,value:l}of n.items){let c=ce(a,{indicator:"seq-item-ind",next:l,offset:o,onError:i,startOnNewline:!0});if(o=c.end,!c.found)if(c.anchor||c.tag||l)l&&l.type==="block-seq"?i(o,"BAD_INDENT","All sequence items must start at the same column"):i(o,"MISSING_CHAR","Sequence item without - indicator");else{c.comment&&(r.comment=c.comment);continue}let u=l?s(t,l,c,i):e(t,o,a,null,c,i);t.schema.compat&&Tt(n.indent,l,i),o=u.range[2],r.items.push(u)}return r.range=[n.offset,o,o],r}function ue(s,e,t,n){let i="";if(s){let r=!1,o="";for(let a of s){let{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{t&&!r&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=l.substring(1)||" ";i?i+=o+u:i=u,o="";break}case"newline":i&&(o+=l),r=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:i,offset:e}}var vn="Block collections are not allowed within flow collections",Sn=s=>s&&(s.type==="block-map"||s.type==="block-seq");function qi({composeNode:s,composeEmptyNode:e},t,n,i){let r=n.start.source==="{",o=r?"flow map":"flow sequence",a=r?new x(t.schema):new F(t.schema);a.flow=!0;let l=t.atRoot;l&&(t.atRoot=!1);let c=n.offset+n.start.source.length;for(let g=0;g<n.items.length;++g){let p=n.items[g],{start:m,key:y,sep:b,value:k}=p,w=ce(m,{flow:o,indicator:"explicit-key-ind",next:y||(b==null?void 0:b[0]),offset:c,onError:i,startOnNewline:!1});if(!w.found){if(!w.anchor&&!w.tag&&!b&&!k){g===0&&w.comma?i(w.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`):g<n.items.length-1&&i(w.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${o}`),w.comment&&(a.comment?a.comment+=`
|
||||
`+w.comment:a.comment=w.comment),c=w.end;continue}!r&&t.options.strict&&Le(y)&&i(y,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)w.comma&&i(w.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`);else if(w.comma||i(w.start,"MISSING_CHAR",`Missing , between ${o} items`),w.comment){let S="";e:for(let N of m)switch(N.type){case"comma":case"space":break;case"comment":S=N.source.substring(1);break e;default:break e}if(S){let N=a.items[a.items.length-1];O(N)&&(N=N.value||N.key),N.comment?N.comment+=`
|
||||
`+S:N.comment=S,w.comment=w.comment.substring(S.length+1)}}if(!r&&!b&&!w.found){let S=k?s(t,k,w,i):e(t,w.end,b,null,w,i);a.items.push(S),c=S.range[2],Sn(k)&&i(S.range,"BLOCK_IN_FLOW",vn)}else{let S=w.end,N=y?s(t,y,w,i):e(t,S,m,null,w,i);Sn(y)&&i(N.range,"BLOCK_IN_FLOW",vn);let K=ce(b||[],{flow:o,indicator:"map-value-ind",next:k,offset:N.range[2],onError:i,startOnNewline:!1});if(K.found){if(!r&&!w.found&&t.options.strict){if(b)for(let ie of b){if(ie===K.found)break;if(ie.type==="newline"){i(ie,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}w.start<K.found.offset-1024&&i(K.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else k&&("source"in k&&k.source&&k.source[0]===":"?i(k,"MISSING_CHAR",`Missing space after : in ${o}`):i(K.start,"MISSING_CHAR",`Missing , or : between ${o} items`));let st=k?s(t,k,K,i):K.found?e(t,K.end,b,null,K,i):null;st?Sn(k)&&i(st.range,"BLOCK_IN_FLOW",vn):K.comment&&(N.comment?N.comment+=`
|
||||
`+K.comment:N.comment=K.comment);let Bs=new L(N,st);if(t.options.keepSourceTokens&&(Bs.srcToken=p),r){let ie=a;As(t,ie.items,N)&&i(S,"DUPLICATE_KEY","Map keys must be unique"),ie.items.push(Bs)}else{let ie=new x(t.schema);ie.flow=!0,ie.items.push(Bs),a.items.push(ie)}c=st?st.range[2]:K.end}}let u=r?"}":"]",[f,...h]=n.end,d=c;if(f&&f.source===u)d=f.offset+f.source.length;else{let g=o[0].toUpperCase()+o.substring(1),p=l?`${g} must end with a ${u}`:`${g} in block collection must be sufficiently indented and end with a ${u}`;i(c,l?"MISSING_CHAR":"BAD_INDENT",p),f&&f.source.length!==1&&h.unshift(f)}if(h.length>0){let g=ue(h,d,t.options.strict,i);g.comment&&(a.comment?a.comment+=`
|
||||
`+g.comment:a.comment=g.comment),a.range=[n.offset,d,g.offset]}else a.range=[n.offset,d,d];return a}function Fi(s,e,t,n,i){let r;switch(t.type){case"block-map":{r=ji(s,e,t,i);break}case"block-seq":{r=Ri(s,e,t,i);break}case"flow-collection":{r=qi(s,e,t,i);break}}if(!n)return r;let o=e.directives.tagName(n.source,h=>i(n,"TAG_RESOLVE_FAILED",h));if(!o)return r;let a=r.constructor;if(o==="!"||o===a.tagName)return r.tag=a.tagName,r;let l=U(r)?"map":"seq",c=e.schema.tags.find(h=>h.collection===l&&h.tag===o);if(!c){let h=e.schema.knownTags[o];if(h&&h.collection===l)e.schema.tags.push(Object.assign({},h,{default:!1})),c=h;else return i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),r.tag=o,r}let u=c.resolve(r,h=>i(n,"TAG_RESOLVE_FAILED",h),e.options),f=C(u)?u:new v(u);return f.range=r.range,f.tag=o,c!=null&&c.format&&(f.format=c.format),f}function Ls(s,e,t){let n=s.offset,i=oo(s,e,t);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let r=i.mode===">"?v.BLOCK_FOLDED:v.BLOCK_LITERAL,o=s.source?ao(s.source):[],a=o.length;for(let p=o.length-1;p>=0;--p){let m=o[p][1];if(m===""||m==="\r")a=p;else break}if(!s.source||a===0){let p=i.chomp==="+"?`
|
||||
`.repeat(Math.max(0,o.length-1)):"",m=n+i.length;return s.source&&(m+=s.source.length),{value:p,type:r,comment:i.comment,range:[n,m,m]}}let l=s.indent+i.indent,c=s.offset+i.length,u=0;for(let p=0;p<a;++p){let[m,y]=o[p];if(y===""||y==="\r")i.indent===0&&m.length>l&&(l=m.length);else{if(m.length<l){let b="Block scalars with more-indented leading empty lines must use an explicit indentation indicator";t(c+m.length,"MISSING_CHAR",b)}i.indent===0&&(l=m.length),u=p;break}c+=m.length+y.length+1}let f="",h="",d=!1;for(let p=0;p<u;++p)f+=o[p][0].slice(l)+`
|
||||
`;for(let p=u;p<a;++p){let[m,y]=o[p];c+=m.length+y.length+1;let b=y[y.length-1]==="\r";if(b&&(y=y.slice(0,-1)),y&&m.length<l){let w=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;t(c-y.length-(b?2:1),"BAD_INDENT",w),m=""}r===v.BLOCK_LITERAL?(f+=h+m.slice(l)+y,h=`
|
||||
`):m.length>l||y[0]===" "?(h===" "?h=`
|
||||
@@ -100,66 +100,66 @@ ${c}
|
||||
`+o[p][0].slice(l);f[f.length-1]!==`
|
||||
`&&(f+=`
|
||||
`);break;default:f+=`
|
||||
`}let g=n+i.length+s.source.length;return{value:f,type:r,comment:i.comment,range:[n,g,g]}}function ro({offset:s,props:e},t,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],r=i[0],o=0,a="",l=-1;for(let h=1;h<i.length;++h){let d=i[h];if(!a&&(d==="-"||d==="+"))a=d;else{let g=Number(d);!o&&g?o=g:l===-1&&(l=s+h)}}l!==-1&&n(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,u="",f=i.length;for(let h=1;h<e.length;++h){let d=e[h];switch(d.type){case"space":c=!0;case"newline":f+=d.source.length;break;case"comment":t&&!c&&n(d,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=d.source.length,u=d.source.substring(1);break;case"error":n(d,"UNEXPECTED_TOKEN",d.message),f+=d.source.length;break;default:{let g=`Unexpected token in block scalar header: ${d.type}`;n(d,"UNEXPECTED_TOKEN",g);let p=d.source;p&&typeof p=="string"&&(f+=p.length)}}}return{mode:r,indent:o,chomp:a,comment:u,length:f}}function oo(s){let e=s.split(/\n( *)/),t=e[0],n=t.match(/^( *)/),r=[n&&n[1]?[n[1],t.slice(n[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}function As(s,e,t){let{offset:n,type:i,source:r,end:o}=s,a,l,c=(h,d,g)=>t(n+h,d,g);switch(i){case"scalar":a=v.PLAIN,l=ao(r,c);break;case"single-quoted-scalar":a=v.QUOTE_SINGLE,l=lo(r,c);break;case"double-quoted-scalar":a=v.QUOTE_DOUBLE,l=co(r,c);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+r.length,n+r.length]}}let u=n+r.length,f=ce(o,u,e,t);return{value:l,type:a,comment:f.comment,range:[n,u,f.offset]}}function ao(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),Fi(s)}function lo(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),Fi(s.slice(1,-1)).replace(/''/g,"'")}function Fi(s){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
||||
`}let g=n+i.length+s.source.length;return{value:f,type:r,comment:i.comment,range:[n,g,g]}}function oo({offset:s,props:e},t,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],r=i[0],o=0,a="",l=-1;for(let h=1;h<i.length;++h){let d=i[h];if(!a&&(d==="-"||d==="+"))a=d;else{let g=Number(d);!o&&g?o=g:l===-1&&(l=s+h)}}l!==-1&&n(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,u="",f=i.length;for(let h=1;h<e.length;++h){let d=e[h];switch(d.type){case"space":c=!0;case"newline":f+=d.source.length;break;case"comment":t&&!c&&n(d,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=d.source.length,u=d.source.substring(1);break;case"error":n(d,"UNEXPECTED_TOKEN",d.message),f+=d.source.length;break;default:{let g=`Unexpected token in block scalar header: ${d.type}`;n(d,"UNEXPECTED_TOKEN",g);let p=d.source;p&&typeof p=="string"&&(f+=p.length)}}}return{mode:r,indent:o,chomp:a,comment:u,length:f}}function ao(s){let e=s.split(/\n( *)/),t=e[0],n=t.match(/^( *)/),r=[n&&n[1]?[n[1],t.slice(n[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}function _s(s,e,t){let{offset:n,type:i,source:r,end:o}=s,a,l,c=(h,d,g)=>t(n+h,d,g);switch(i){case"scalar":a=v.PLAIN,l=lo(r,c);break;case"single-quoted-scalar":a=v.QUOTE_SINGLE,l=co(r,c);break;case"double-quoted-scalar":a=v.QUOTE_DOUBLE,l=uo(r,c);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+r.length,n+r.length]}}let u=n+r.length,f=ue(o,u,e,t);return{value:l,type:a,comment:f.comment,range:[n,u,f.offset]}}function lo(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),Ki(s)}function co(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),Ki(s.slice(1,-1)).replace(/''/g,"'")}function Ki(s){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
||||
`,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
||||
`,"sy")}catch(l){e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(s);if(!n)return s;let i=n[1],r=" ",o=e.lastIndex;for(t.lastIndex=o;n=t.exec(s);)n[1]===""?r===`
|
||||
`?i+=r:r=`
|
||||
`:(i+=r+n[1],r=" "),o=t.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,n=a.exec(s),i+r+(n&&n[1]||"")}function co(s,e){let t="";for(let n=1;n<s.length-1;++n){let i=s[n];if(!(i==="\r"&&s[n+1]===`
|
||||
`:(i+=r+n[1],r=" "),o=t.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,n=a.exec(s),i+r+(n&&n[1]||"")}function uo(s,e){let t="";for(let n=1;n<s.length-1;++n){let i=s[n];if(!(i==="\r"&&s[n+1]===`
|
||||
`))if(i===`
|
||||
`){let{fold:r,offset:o}=uo(s,n);t+=r,n=o}else if(i==="\\"){let r=s[++n],o=fo[r];if(o)t+=o;else if(r===`
|
||||
`){let{fold:r,offset:o}=fo(s,n);t+=r,n=o}else if(i==="\\"){let r=s[++n],o=ho[r];if(o)t+=o;else if(r===`
|
||||
`)for(r=s[n+1];r===" "||r===" ";)r=s[++n+1];else if(r==="\r"&&s[n+1]===`
|
||||
`)for(r=s[++n+1];r===" "||r===" ";)r=s[++n+1];else if(r==="x"||r==="u"||r==="U"){let a={x:2,u:4,U:8}[r];t+=ho(s,n+1,a,e),n+=a}else{let a=s.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(i===" "||i===" "){let r=n,o=s[n+1];for(;o===" "||o===" ";)o=s[++n+1];o!==`
|
||||
`)for(r=s[++n+1];r===" "||r===" ";)r=s[++n+1];else if(r==="x"||r==="u"||r==="U"){let a={x:2,u:4,U:8}[r];t+=po(s,n+1,a,e),n+=a}else{let a=s.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(i===" "||i===" "){let r=n,o=s[n+1];for(;o===" "||o===" ";)o=s[++n+1];o!==`
|
||||
`&&!(o==="\r"&&s[n+2]===`
|
||||
`)&&(t+=n>r?s.slice(r,n+1):i)}else t+=i}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),t}function uo(s,e){let t="",n=s[e+1];for(;(n===" "||n===" "||n===`
|
||||
`)&&(t+=n>r?s.slice(r,n+1):i)}else t+=i}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),t}function fo(s,e){let t="",n=s[e+1];for(;(n===" "||n===" "||n===`
|
||||
`||n==="\r")&&!(n==="\r"&&s[e+2]!==`
|
||||
`);)n===`
|
||||
`&&(t+=`
|
||||
`),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}var fo={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
||||
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function ho(s,e,t,n){let i=s.substr(e,t),o=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){let a=s.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}function vn(s,e,t,n){let{value:i,type:r,comment:o,range:a}=e.type==="block-scalar"?Ts(e,s.options.strict,n):As(e,s.options.strict,n),l=t?s.directives.tagName(t.source,f=>n(t,"TAG_RESOLVE_FAILED",f)):null,c=t&&l?po(s.schema,i,l,t,n):e.type==="scalar"?mo(s,i,e,n):s.schema[J],u;try{let f=c.resolve(i,h=>n(t||e,"TAG_RESOLVE_FAILED",h),s.options);u=E(f)?f:new v(f)}catch(f){let h=f instanceof Error?f.message:String(f);n(t||e,"TAG_RESOLVE_FAILED",h),u=new v(i)}return u.range=a,u.source=i,r&&(u.type=r),l&&(u.tag=l),c.format&&(u.format=c.format),o&&(u.comment=o),u}function po(s,e,t,n,i){var r;if(t==="!")return s[J];let o=[];for(let l of s.tags)if(!l.collection&&l.tag===t)if(l.default&&l.test)o.push(l);else return l;for(let l of o)if(!((r=l.test)===null||r===void 0)&&r.test(e))return l;let a=s.knownTags[t];return a&&!a.collection?(s.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[J])}function mo({directives:s,schema:e},t,n,i){let r=e.tags.find(o=>{var a;return o.default&&((a=o.test)===null||a===void 0?void 0:a.test(t))})||e[J];if(e.compat){let o=e.compat.find(a=>{var l;return a.default&&((l=a.test)===null||l===void 0?void 0:l.test(t))})||e[J];if(r.tag!==o.tag){let a=s.tagString(r.tag),l=s.tagString(o.tag),c=`Value may be parsed as either ${a} or ${l}`;i(n,"TAG_RESOLVE_FAILED",c,!0)}}return r}function Ki(s,e,t){if(e){t===null&&(t=e.length);for(let n=t-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":s-=i.source.length;continue}for(i=e[++n];(i==null?void 0:i.type)==="space";)s+=i.source.length,i=e[++n];break}}return s}var go={composeNode:Sn,composeEmptyNode:kn};function Sn(s,e,t,n){let{spaceBefore:i,comment:r,anchor:o,tag:a}=t,l;switch(e.type){case"alias":l=yo(s,e,n),(o||a)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=vn(s,e,a,n),o&&(l.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":l=qi(go,s,e,a,n),o&&(l.anchor=o.source.substring(1));break;default:throw console.log(e),new Error(`Unsupporten token type: ${e.type}`)}return o&&l.anchor===""&&n(o,"BAD_ALIAS","Anchor cannot be an empty string"),i&&(l.spaceBefore=!0),r&&(e.type==="scalar"&&e.source===""?l.comment=r:l.commentBefore=r),s.options.keepSourceTokens&&(l.srcToken=e),l}function kn(s,e,t,n,{spaceBefore:i,comment:r,anchor:o,tag:a},l){let c={type:"scalar",offset:Ki(e,t,n),indent:-1,source:""},u=vn(s,c,a,l);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(u.spaceBefore=!0),r&&(u.comment=r),u}function yo({options:s},{offset:e,source:t,end:n},i){let r=new me(t.substring(1));r.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string");let o=e+t.length,a=ce(n,o,s.strict,i);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}function Vi(s,e,{offset:t,start:n,value:i,end:r},o){let a=Object.assign({directives:e},s),l=new ae(void 0,a),c={atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},u=le(n,{indicator:"doc-start",next:i||(r==null?void 0:r[0]),offset:t,onError:o,startOnNewline:!0});u.found&&(l.directives.marker=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?Sn(c,i,u,o):kn(c,u.end,n,null,u,o);let f=l.contents.range[2],h=ce(r,f,!1,o);return h.comment&&(l.comment=h.comment),l.range=[t,f,h.offset],l}function Ct(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function Ui(s){var e;let t="",n=!1,i=!1;for(let r=0;r<s.length;++r){let o=s[r];switch(o[0]){case"#":t+=(t===""?"":i?`
|
||||
`),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}var ho={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
||||
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function po(s,e,t,n){let i=s.substr(e,t),o=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){let a=s.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}function kn(s,e,t,n){let{value:i,type:r,comment:o,range:a}=e.type==="block-scalar"?Ls(e,s.options.strict,n):_s(e,s.options.strict,n),l=t?s.directives.tagName(t.source,f=>n(t,"TAG_RESOLVE_FAILED",f)):null,c=t&&l?mo(s.schema,i,l,t,n):e.type==="scalar"?go(s,i,e,n):s.schema[W],u;try{let f=c.resolve(i,h=>n(t||e,"TAG_RESOLVE_FAILED",h),s.options);u=E(f)?f:new v(f)}catch(f){let h=f instanceof Error?f.message:String(f);n(t||e,"TAG_RESOLVE_FAILED",h),u=new v(i)}return u.range=a,u.source=i,r&&(u.type=r),l&&(u.tag=l),c.format&&(u.format=c.format),o&&(u.comment=o),u}function mo(s,e,t,n,i){var r;if(t==="!")return s[W];let o=[];for(let l of s.tags)if(!l.collection&&l.tag===t)if(l.default&&l.test)o.push(l);else return l;for(let l of o)if(!((r=l.test)===null||r===void 0)&&r.test(e))return l;let a=s.knownTags[t];return a&&!a.collection?(s.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[W])}function go({directives:s,schema:e},t,n,i){let r=e.tags.find(o=>{var a;return o.default&&((a=o.test)===null||a===void 0?void 0:a.test(t))})||e[W];if(e.compat){let o=e.compat.find(a=>{var l;return a.default&&((l=a.test)===null||l===void 0?void 0:l.test(t))})||e[W];if(r.tag!==o.tag){let a=s.tagString(r.tag),l=s.tagString(o.tag),c=`Value may be parsed as either ${a} or ${l}`;i(n,"TAG_RESOLVE_FAILED",c,!0)}}return r}function Vi(s,e,t){if(e){t===null&&(t=e.length);for(let n=t-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":s-=i.source.length;continue}for(i=e[++n];(i==null?void 0:i.type)==="space";)s+=i.source.length,i=e[++n];break}}return s}var yo={composeNode:En,composeEmptyNode:On};function En(s,e,t,n){let{spaceBefore:i,comment:r,anchor:o,tag:a}=t,l;switch(e.type){case"alias":l=wo(s,e,n),(o||a)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=kn(s,e,a,n),o&&(l.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":l=Fi(yo,s,e,a,n),o&&(l.anchor=o.source.substring(1));break;default:throw console.log(e),new Error(`Unsupporten token type: ${e.type}`)}return o&&l.anchor===""&&n(o,"BAD_ALIAS","Anchor cannot be an empty string"),i&&(l.spaceBefore=!0),r&&(e.type==="scalar"&&e.source===""?l.comment=r:l.commentBefore=r),s.options.keepSourceTokens&&(l.srcToken=e),l}function On(s,e,t,n,{spaceBefore:i,comment:r,anchor:o,tag:a},l){let c={type:"scalar",offset:Vi(e,t,n),indent:-1,source:""},u=kn(s,c,a,l);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(u.spaceBefore=!0),r&&(u.comment=r),u}function wo({options:s},{offset:e,source:t,end:n},i){let r=new ge(t.substring(1));r.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string");let o=e+t.length,a=ue(n,o,s.strict,i);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}function Ui(s,e,{offset:t,start:n,value:i,end:r},o){let a=Object.assign({directives:e},s),l=new le(void 0,a),c={atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},u=ce(n,{indicator:"doc-start",next:i||(r==null?void 0:r[0]),offset:t,onError:o,startOnNewline:!0});u.found&&(l.directives.marker=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?En(c,i,u,o):On(c,u.end,n,null,u,o);let f=l.contents.range[2],h=ue(r,f,!1,o);return h.comment&&(l.comment=h.comment),l.range=[t,f,h.offset],l}function At(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function Ji(s){var e;let t="",n=!1,i=!1;for(let r=0;r<s.length;++r){let o=s[r];switch(o[0]){case"#":t+=(t===""?"":i?`
|
||||
|
||||
`:`
|
||||
`)+(o.substring(1)||" "),n=!0,i=!1;break;case"%":((e=s[r+1])===null||e===void 0?void 0:e[0])!=="#"&&(r+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:t,afterEmptyLine:i}}var Tt=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,i,r)=>{let o=Ct(t);r?this.warnings.push(new Ot(o,n,i)):this.errors.push(new W(o,n,i))},this.directives=new _({version:e.version||gt.version}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:i}=Ui(this.prelude);if(n){let r=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
||||
`)+(o.substring(1)||" "),n=!0,i=!1;break;case"%":((e=s[r+1])===null||e===void 0?void 0:e[0])!=="#"&&(r+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:t,afterEmptyLine:i}}var Lt=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,i,r)=>{let o=At(t);r?this.warnings.push(new Ct(o,n,i)):this.errors.push(new G(o,n,i))},this.directives=new I({version:e.version||wt.version}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:i}=Ji(this.prelude);if(n){let r=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
||||
${n}`:n;else if(i||e.directives.marker||!r)e.commentBefore=n;else if(T(r)&&!r.flow&&r.items.length>0){let o=r.items[0];O(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${n}
|
||||
${a}`:n}else{let o=r.commentBefore;r.commentBefore=o?`${n}
|
||||
${o}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Ui(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let i of e)yield*this.next(i);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,n,i)=>{let r=Ct(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=Vi(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.marker&&this.onError(e,"MISSING_CHAR","Missing directives-end indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new W(Ct(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new W(Ct(e),"UNEXPECTED_TOKEN",n));break}let t=ce(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
|
||||
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new W(Ct(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({directives:this.directives},this.options),i=new ae(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,t,t],this.decorate(i,!1),yield i}}};var _t={};_n(_t,{BOM:()=>At,DOCUMENT:()=>Lt,FLOW_END:()=>It,SCALAR:()=>Xe,createScalarToken:()=>Wi,isCollection:()=>vo,isScalar:()=>So,prettyToken:()=>ko,resolveAsScalar:()=>Ji,setScalarValue:()=>Gi,stringify:()=>Qi,tokenType:()=>Nn,visit:()=>Ae});function Ji(s,e=!0,t){if(s){let n=(i,r,o)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(t)t(a,r,o);else throw new W([a,a+1],r,o)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return As(s,e,n);case"block-scalar":return Ts(s,e,n)}}return null}function Wi(s,e){var t;let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:o=-1,type:a="PLAIN"}=e,l=we({type:a,value:s},{implicitKey:n,indent:i>0?" ".repeat(i):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=(t=e.end)!==null&&t!==void 0?t:[{type:"newline",offset:-1,indent:i,source:`
|
||||
${o}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Ji(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let i of e)yield*this.next(i);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,n,i)=>{let r=At(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=Ui(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.marker&&this.onError(e,"MISSING_CHAR","Missing directives-end indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new G(At(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new G(At(e),"UNEXPECTED_TOKEN",n));break}let t=ue(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
|
||||
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new G(At(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({directives:this.directives},this.options),i=new le(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,t,t],this.decorate(i,!1),yield i}}};var Pt={};Pn(Pt,{BOM:()=>_t,DOCUMENT:()=>It,FLOW_END:()=>xt,SCALAR:()=>et,createScalarToken:()=>Gi,isCollection:()=>So,isScalar:()=>ko,prettyToken:()=>Eo,resolveAsScalar:()=>Wi,setScalarValue:()=>Yi,stringify:()=>Hi,tokenType:()=>Tn,visit:()=>_e});function Wi(s,e=!0,t){if(s){let n=(i,r,o)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(t)t(a,r,o);else throw new G([a,a+1],r,o)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return _s(s,e,n);case"block-scalar":return Ls(s,e,n)}}return null}function Gi(s,e){var t;let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:o=-1,type:a="PLAIN"}=e,l=be({type:a,value:s},{implicitKey:n,indent:i>0?" ".repeat(i):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=(t=e.end)!==null&&t!==void 0?t:[{type:"newline",offset:-1,indent:i,source:`
|
||||
`}];switch(l[0]){case"|":case">":{let u=l.indexOf(`
|
||||
`),f=l.substring(0,u),h=l.substring(u+1)+`
|
||||
`,d=[{type:"block-scalar-header",offset:o,indent:i,source:f}];return Yi(d,c)||d.push({type:"newline",offset:-1,indent:i,source:`
|
||||
`}),{type:"block-scalar",offset:o,indent:i,props:d,source:h}}case'"':return{type:"double-quoted-scalar",offset:o,indent:i,source:l,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:i,source:l,end:c};default:return{type:"scalar",offset:o,indent:i,source:l,end:c}}}function Gi(s,e,t={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:r=!1,type:o}=t,a="indent"in s?s.indent:null;if(n&&typeof a=="number"&&(a+=2),!o)switch(s.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=s.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=we({type:o,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":wo(s,l);break;case'"':En(s,l,"double-quoted-scalar");break;case"'":En(s,l,"single-quoted-scalar");break;default:En(s,l,"scalar")}}function wo(s,e){let t=e.indexOf(`
|
||||
`,d=[{type:"block-scalar-header",offset:o,indent:i,source:f}];return Qi(d,c)||d.push({type:"newline",offset:-1,indent:i,source:`
|
||||
`}),{type:"block-scalar",offset:o,indent:i,props:d,source:h}}case'"':return{type:"double-quoted-scalar",offset:o,indent:i,source:l,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:i,source:l,end:c};default:return{type:"scalar",offset:o,indent:i,source:l,end:c}}}function Yi(s,e,t={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:r=!1,type:o}=t,a="indent"in s?s.indent:null;if(n&&typeof a=="number"&&(a+=2),!o)switch(s.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=s.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=be({type:o,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":bo(s,l);break;case'"':Nn(s,l,"double-quoted-scalar");break;case"'":Nn(s,l,"single-quoted-scalar");break;default:Nn(s,l,"scalar")}}function bo(s,e){let t=e.indexOf(`
|
||||
`),n=e.substring(0,t),i=e.substring(t+1)+`
|
||||
`;if(s.type==="block-scalar"){let r=s.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=n,s.source=i}else{let{offset:r}=s,o="indent"in s?s.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:n}];Yi(a,"end"in s?s.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
||||
`});for(let l of Object.keys(s))l!=="type"&&l!=="offset"&&delete s[l];Object.assign(s,{type:"block-scalar",indent:o,props:a,source:i})}}function Yi(s,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":s.push(t);break;case"newline":return s.push(t),!0}return!1}function En(s,e,t){switch(s.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":s.type=t,s.source=e;break;case"block-scalar":{let n=s.props.slice(1),i=e.length;s.props[0].type==="block-scalar-header"&&(i-=s.props[0].source.length);for(let r of n)r.offset+=i;delete s.props,Object.assign(s,{type:t,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:s.offset+e.length,indent:s.indent,source:`
|
||||
`};delete s.items,Object.assign(s,{type:t,source:e,end:[i]});break}default:{let n="indent"in s?s.indent:-1,i="end"in s&&Array.isArray(s.end)?s.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(s))r!=="type"&&r!=="offset"&&delete s[r];Object.assign(s,{type:t,indent:n,source:e,end:i})}}}var Qi=s=>"type"in s?Is(s):Ls(s);function Is(s){switch(s.type){case"block-scalar":{let e="";for(let t of s.props)e+=Is(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(let t of s.items)e+=Ls(t);return e}case"flow-collection":{let e=s.start.source;for(let t of s.items)e+=Ls(t);for(let t of s.end)e+=t.source;return e}case"document":{let e=Ls(s);if(s.end)for(let t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(let t of s.end)e+=t.source;return e}}}function Ls({start:s,key:e,sep:t,value:n}){let i="";for(let r of s)i+=r.source;if(e&&(i+=Is(e)),t)for(let r of t)i+=r.source;return n&&(i+=Is(n)),i}var On=Symbol("break visit"),bo=Symbol("skip children"),Hi=Symbol("remove item");function Ae(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),zi(Object.freeze([]),s,e)}Ae.BREAK=On;Ae.SKIP=bo;Ae.REMOVE=Hi;Ae.itemAtPath=(s,e)=>{let t=s;for(let[n,i]of e){let r=t&&t[n];if(r&&"items"in r)t=r.items[i];else return}return t};Ae.parentCollection=(s,e)=>{let t=Ae.itemAtPath(s,e.slice(0,-1)),n=e[e.length-1][0],i=t&&t[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function zi(s,e,t){let n=t(e,s);if(typeof n=="symbol")return n;for(let i of["key","value"]){let r=e[i];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){let a=zi(Object.freeze(s.concat([[i,o]])),r.items[o],t);if(typeof a=="number")o=a-1;else{if(a===On)return On;a===Hi&&(r.items.splice(o,1),o-=1)}}typeof n=="function"&&i==="key"&&(n=n(e,s))}}return typeof n=="function"?n(e,s):n}var At="\uFEFF",Lt="",It="",Xe="",vo=s=>!!s&&"items"in s,So=s=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function ko(s){switch(s){case At:return"<BOM>";case Lt:return"<DOC>";case It:return"<FLOW_END>";case Xe:return"<SCALAR>";default:return JSON.stringify(s)}}function Nn(s){switch(s){case At:return"byte-order-mark";case Lt:return"doc-mode";case It:return"flow-error-end";case Xe:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
||||
`;if(s.type==="block-scalar"){let r=s.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=n,s.source=i}else{let{offset:r}=s,o="indent"in s?s.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:n}];Qi(a,"end"in s?s.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
||||
`});for(let l of Object.keys(s))l!=="type"&&l!=="offset"&&delete s[l];Object.assign(s,{type:"block-scalar",indent:o,props:a,source:i})}}function Qi(s,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":s.push(t);break;case"newline":return s.push(t),!0}return!1}function Nn(s,e,t){switch(s.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":s.type=t,s.source=e;break;case"block-scalar":{let n=s.props.slice(1),i=e.length;s.props[0].type==="block-scalar-header"&&(i-=s.props[0].source.length);for(let r of n)r.offset+=i;delete s.props,Object.assign(s,{type:t,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:s.offset+e.length,indent:s.indent,source:`
|
||||
`};delete s.items,Object.assign(s,{type:t,source:e,end:[i]});break}default:{let n="indent"in s?s.indent:-1,i="end"in s&&Array.isArray(s.end)?s.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(s))r!=="type"&&r!=="offset"&&delete s[r];Object.assign(s,{type:t,indent:n,source:e,end:i})}}}var Hi=s=>"type"in s?xs(s):Is(s);function xs(s){switch(s.type){case"block-scalar":{let e="";for(let t of s.props)e+=xs(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(let t of s.items)e+=Is(t);return e}case"flow-collection":{let e=s.start.source;for(let t of s.items)e+=Is(t);for(let t of s.end)e+=t.source;return e}case"document":{let e=Is(s);if(s.end)for(let t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(let t of s.end)e+=t.source;return e}}}function Is({start:s,key:e,sep:t,value:n}){let i="";for(let r of s)i+=r.source;if(e&&(i+=xs(e)),t)for(let r of t)i+=r.source;return n&&(i+=xs(n)),i}var Cn=Symbol("break visit"),vo=Symbol("skip children"),zi=Symbol("remove item");function _e(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),Xi(Object.freeze([]),s,e)}_e.BREAK=Cn;_e.SKIP=vo;_e.REMOVE=zi;_e.itemAtPath=(s,e)=>{let t=s;for(let[n,i]of e){let r=t&&t[n];if(r&&"items"in r)t=r.items[i];else return}return t};_e.parentCollection=(s,e)=>{let t=_e.itemAtPath(s,e.slice(0,-1)),n=e[e.length-1][0],i=t&&t[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Xi(s,e,t){let n=t(e,s);if(typeof n=="symbol")return n;for(let i of["key","value"]){let r=e[i];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){let a=Xi(Object.freeze(s.concat([[i,o]])),r.items[o],t);if(typeof a=="number")o=a-1;else{if(a===Cn)return Cn;a===zi&&(r.items.splice(o,1),o-=1)}}typeof n=="function"&&i==="key"&&(n=n(e,s))}}return typeof n=="function"?n(e,s):n}var _t="\uFEFF",It="",xt="",et="",So=s=>!!s&&"items"in s,ko=s=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function Eo(s){switch(s){case _t:return"<BOM>";case It:return"<DOC>";case xt:return"<FLOW_END>";case et:return"<SCALAR>";default:return JSON.stringify(s)}}function Tn(s){switch(s){case _t:return"byte-order-mark";case It:return"doc-mode";case xt:return"flow-error-end";case et:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
||||
`:case`\r
|
||||
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(s[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function G(s){switch(s){case void 0:case" ":case`
|
||||
`:case"\r":case" ":return!0;default:return!1}}var Xi="0123456789ABCDEFabcdef".split(""),Eo="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split(""),Zi=",[]{}".split(""),Oo=` ,[]{}
|
||||
\r `.split(""),Cn=s=>!s||Oo.includes(s),xt=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){e&&(this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null),this.atEnd=!t;let n=this.next||"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
|
||||
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(s[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function Y(s){switch(s){case void 0:case" ":case`
|
||||
`:case"\r":case" ":return!0;default:return!1}}var Zi="0123456789ABCDEFabcdef".split(""),Oo="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split(""),er=",[]{}".split(""),No=` ,[]{}
|
||||
\r `.split(""),An=s=>!s||No.includes(s),Mt=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){e&&(this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null),this.atEnd=!t;let n=this.next||"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
|
||||
`?!0:t==="\r"?this.buffer[e+1]===`
|
||||
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){let i=this.buffer[n+e+1];if(i===`
|
||||
`||!i&&!this.atEnd)return e+n+1}return t===`
|
||||
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&G(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
||||
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===At&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,n=e.indexOf("#");if(n!==-1){let r=e[n-1];(r===" "||r===" ")&&(t=n-1)}for(;;){let r=e[t-1];if(r===" "||r===" ")t-=1;else break}let i=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield Lt,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if(t==="---"&&G(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,"doc";if(t==="..."&&G(this.charAt(3)))return yield*this.pushCount(3),"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!G(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&G(t)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Cn),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),t=yield*this.pushSpaces(!0),e>0&&(this.indentValue=n=t);while(e+t>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&i[0]!=="#"||n===0&&(i.startsWith("---")||i.startsWith("..."))&&G(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield It,yield*this.parseLineStart();let r=0;for(;i[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),i[r]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-r),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Cn),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||G(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let r=0;for(;this.buffer[t-1-r]==="\\";)r+=1;if(r%2===0)break;t=this.buffer.indexOf('"',t+1)}let n=this.buffer.substring(0,t),i=n.indexOf(`
|
||||
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Y(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
||||
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===_t&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,n=e.indexOf("#");if(n!==-1){let r=e[n-1];(r===" "||r===" ")&&(t=n-1)}for(;;){let r=e[t-1];if(r===" "||r===" ")t-=1;else break}let i=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield It,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if(t==="---"&&Y(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,"doc";if(t==="..."&&Y(this.charAt(3)))return yield*this.pushCount(3),"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Y(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Y(t)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(An),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),t=yield*this.pushSpaces(!0),e>0&&(this.indentValue=n=t);while(e+t>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&i[0]!=="#"||n===0&&(i.startsWith("---")||i.startsWith("..."))&&Y(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield xt,yield*this.parseLineStart();let r=0;for(;i[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),i[r]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-r),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(An),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||Y(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let r=0;for(;this.buffer[t-1-r]==="\\";)r+=1;if(r%2===0)break;t=this.buffer.indexOf('"',t+1)}let n=this.buffer.substring(0,t),i=n.indexOf(`
|
||||
`,this.pos);if(i!==-1){for(;i!==-1;){let r=this.continueScalar(i+1);if(r===-1)break;i=n.indexOf(`
|
||||
`,r)}i!==-1&&(t=i-(n[i-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>G(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let i=this.pos;n=this.buffer[i];++i)switch(n){case" ":t+=1;break;case`
|
||||
`,r)}i!==-1&&(t=i-(n[i-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>Y(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let i=this.pos;n=this.buffer[i];++i)switch(n){case" ":t+=1;break;case`
|
||||
`:e=i,t=0;break;case"\r":{let r=this.buffer[i+1];if(!r&&!this.atEnd)return this.setNext("block-scalar");if(r===`
|
||||
`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext+=this.blockScalarIndent;do{let i=this.continueScalar(e+1);if(i===-1)break;e=this.buffer.indexOf(`
|
||||
`,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}if(!this.blockScalarKeep)do{let i=e-1,r=this.buffer[i];for(r==="\r"&&(r=this.buffer[--i]);r===" "||r===" ";)r=this.buffer[--i];if(r===`
|
||||
`&&i>=this.pos)e=i;else break}while(!0);return yield Xe,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let r=this.buffer[n+1];if(G(r)||e&&r===",")break;t=n}else if(G(i)){let r=this.buffer[n+1];if(i==="\r"&&(r===`
|
||||
`&&i>=this.pos)e=i;else break}while(!0);return yield et,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let r=this.buffer[n+1];if(Y(r)||e&&r===",")break;t=n}else if(Y(i)){let r=this.buffer[n+1];if(i==="\r"&&(r===`
|
||||
`?(n+=1,i=`
|
||||
`,r=this.buffer[n+1]):t=n),r==="#"||e&&Zi.includes(r))break;if(i===`
|
||||
`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&Zi.includes(i))break;t=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Xe,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Cn))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case":":case"?":case"-":if(G(this.charAt(1)))return this.flowLevel===0?this.indentNext=this.indentValue+1:this.flowKey&&(this.flowKey=!1),(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!G(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Eo.includes(t))t=this.buffer[++e];else if(t==="%"&&Xi.includes(this.buffer[e+1])&&Xi.includes(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
||||
`,r=this.buffer[n+1]):t=n),r==="#"||e&&er.includes(r))break;if(i===`
|
||||
`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&er.includes(i))break;t=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield et,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(An))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case":":case"?":case"-":if(Y(this.charAt(1)))return this.flowLevel===0?this.indentNext=this.indentValue+1:this.flowKey&&(this.flowKey=!1),(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!Y(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Oo.includes(t))t=this.buffer[++e];else if(t==="%"&&Zi.includes(this.buffer[e+1])&&Zi.includes(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
||||
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
||||
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");let i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};var Pt=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let i=this.lineStarts[t-1];return{line:t,col:e-i+1}}}};function ue(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function Tn(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return!0}return!1}function tr(s){switch(s==null?void 0:s.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function _s(s){switch(s.type){case"document":return s.start;case"block-map":{let e=s.items[s.items.length-1];return e.sep||e.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function Mt(s){var e;if(s.length===0)return[];let t=s.length;e:for(;--t>=0;)switch(s[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((e=s[++t])===null||e===void 0?void 0:e.type)==="space";);return s.splice(t,s.length)}function er(s){if(s.start.type==="flow-seq-start")for(let e of s.items)e.sep&&!e.value&&!ue(e.start,"explicit-key-ind")&&!ue(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,tr(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var $t=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new xt,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=Nn(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&(!e||e.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e||this.stack.pop();if(t)if(this.stack.length===0)yield t;else{let n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&er(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=t;else{Object.assign(i,{key:t,sep:[]}),this.onKeyLine=!ue(i.start,"explicit-key-ind");return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:t}):i.value=t;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:t,sep:[]}):i.sep?i.value=t:Object.assign(i,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&!Tn(i.start)&&(t.indent===0||i.start.every(r=>r.type!=="comment"||r.indent<t.indent))&&(n.type==="document"?n.end=i.start:n.items.push({start:i.start}),
Line truncated
|
||||
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");let i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};var $t=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let i=this.lineStarts[t-1];return{line:t,col:e-i+1}}}};function fe(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function Ln(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return!0}return!1}function sr(s){switch(s==null?void 0:s.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Ps(s){switch(s.type){case"document":return s.start;case"block-map":{let e=s.items[s.items.length-1];return e.sep||e.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function Bt(s){var e;if(s.length===0)return[];let t=s.length;e:for(;--t>=0;)switch(s[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((e=s[++t])===null||e===void 0?void 0:e.type)==="space";);return s.splice(t,s.length)}function tr(s){if(s.start.type==="flow-seq-start")for(let e of s.items)e.sep&&!e.value&&!fe(e.start,"explicit-key-ind")&&!fe(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,sr(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var Dt=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Mt,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=Tn(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&(!e||e.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e||this.stack.pop();if(t)if(this.stack.length===0)yield t;else{let n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&tr(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=t;else{Object.assign(i,{key:t,sep:[]}),this.onKeyLine=!fe(i.start,"explicit-key-ind");return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:t}):i.value=t;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:t,sep:[]}):i.sep?i.value=t:Object.assign(i,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&!Ln(i.start)&&(t.indent===0||i.start.every(r=>r.type!=="comment"||r.indent<t.indent))&&(n.type==="document"?n.end=i.start:n.items.push({start:i.start}),
Line truncated
|
||||
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
||||
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){var t;let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let i="end"in n.value?n.value.end:void 0,r=Array.isArray(i)?i[i.length-1]:void 0;(r==null?void 0:r.type)==="comment"?i==null||i.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2],r=(t=i==null?void 0:i.value)===null||t===void 0?void 0:t.end;if(Array.isArray(r)){Array.prototype.push.apply(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let i=!this.onKeyLine&&this.indent===e.indent&&(n.sep||Tn(n.start));switch(this.type){case"anchor":case"tag":i||n.value?(e.items.push({start:[this.sourceToken]}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!ue(n.start,"explicit-key-ind")?n.start.push(this.sourceToken):i||n.value?e.items.push({start:[this.sourceToken]}):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]}),this.onKeyLine=!0;return;case"map-value-ind":if(!n.sep)Object.assign(n,{key:null,sep:[this.sourceToken]});else if(n.value||i&&!ue(n.start,"explicit-key-ind"))e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ue(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else if(ue(n.start,"explicit-key-ind")&&tr(n.key)&&!ue(n.sep,"newline")){let r=Mt(n.start),o=n.key,a=n.sep;a.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:o,sep:a}]})}else n.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);i||n.value?(e.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(r):(Object.assign(n,{key:r,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){i&&r.type!=="block-seq"&&ue(n.start,"explicit-key-ind")&&e.items.push({start:[]}),this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){var t;let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let i="end"in n.value?n.value.end:void 0,r=Array.isArray(i)?i[i.length-1]:void 0;(r==null?void 0:r.type)==="comment"?i==null||i.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2],r=(t=i==null?void 0:i.value)===null||t===void 0?void 0:t.end;if(Array.isArray(r)){Array.prototype.push.apply(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||ue(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n&&n.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=_s(n),r=Mt(i);er(e);let o=e
Line truncated
|
||||
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){var t;let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let i="end"in n.value?n.value.end:void 0,r=Array.isArray(i)?i[i.length-1]:void 0;(r==null?void 0:r.type)==="comment"?i==null||i.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2],r=(t=i==null?void 0:i.value)===null||t===void 0?void 0:t.end;if(Array.isArray(r)){Array.prototype.push.apply(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let i=!this.onKeyLine&&this.indent===e.indent&&(n.sep||Ln(n.start));switch(this.type){case"anchor":case"tag":i||n.value?(e.items.push({start:[this.sourceToken]}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!fe(n.start,"explicit-key-ind")?n.start.push(this.sourceToken):i||n.value?e.items.push({start:[this.sourceToken]}):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]}),this.onKeyLine=!0;return;case"map-value-ind":if(!n.sep)Object.assign(n,{key:null,sep:[this.sourceToken]});else if(n.value||i&&!fe(n.start,"explicit-key-ind"))e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(fe(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else if(fe(n.start,"explicit-key-ind")&&sr(n.key)&&!fe(n.sep,"newline")){let r=Bt(n.start),o=n.key,a=n.sep;a.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:o,sep:a}]})}else n.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);i||n.value?(e.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(r):(Object.assign(n,{key:r,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){i&&r.type!=="block-seq"&&fe(n.start,"explicit-key-ind")&&e.items.push({start:[]}),this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){var t;let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let i="end"in n.value?n.value.end:void 0,r=Array.isArray(i)?i[i.length-1]:void 0;(r==null?void 0:r.type)==="comment"?i==null||i.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2],r=(t=i==null?void 0:i.value)===null||t===void 0?void 0:t.end;if(Array.isArray(r)){Array.prototype.push.apply(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||fe(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n&&n.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=Ps(n),r=Bt(i);tr(e);let o=e
Line truncated
|
||||
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
||||
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=_s(e),n=Mt(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n}]}}case"map-value-ind":{this.onKeyLine=!0;let t=_s(e),n=Mt(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function No(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new Pt||null,prettyErrors:e}}function An(s,e={}){let{lineCounter:t,prettyErrors:n}=No(e),i=new $t(t==null?void 0:t.addNewLine),r=new Tt(e),o=null;for(let a of r.compose(i.parse(s),!0,s.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new W(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(yn(s,t)),o.warnings.forEach(yn(s,t))),o}var xs=class{constructor(e,t,n,i){this.app=e,this.filename=t,this.basename=t.split("/").pop(),this.tagPositions=n,this.hasFrontMatter=!!i}async renamed(e){let t=this.app.vault.getAbstractFileByPath(this.filename),n=await this.app.vault.read(t),i=n;for(let{position:{start:r,end:o},tag:a}of this.tagPositions){if(i.slice(r.offset,o.offset)!==a){let l=`File ${this.filename} has changed; skipping`;new Ln.Notice(l),console.error(l),console.debug(i.slice(r.offset,o.offset),a);return}i=e.inString(i,r.offset)}if(this.hasFrontMatter&&(i=this.replaceInFrontMatter(i,e)),i!==n)return await this.app.vault.modify(t,i),!0}replaceInFrontMatter(e,t){let[n,i]=e.split(/^---\r?$\n?/m,2);if(n.trim()!==""||!i.trim()||!i.endsWith(`
|
||||
`))return e;let r=An(i,{keepSourceTokens:!0});if(r.errors.length){let u=`YAML issue with ${this.filename}: ${r.errors[0]}`;console.error(u),new Ln.Notice(u+"; skipping frontmatter");return}let o=!1,a=r.toJSON();function l(u,f,h=!1){_t.setScalarValue(u.srcToken,f,{afterKey:h}),o=!0,u.value=f}function c(u,f){let h=r.get(u,!0);if(!h)return;let d=a[u];if(!(!d||!d.length))if(typeof d=="string"){let g=d.split(f?/(^\s+|\s*,\s*|\s+$)/:/([\s,]+)/),p=t.inArray(g,!0,f).join("");d!=p&&l(h,p,!0)}else Array.isArray(d)&&t.inArray(d,!1,f).forEach((g,p)=>{d[p]!==g&&l(h.get(p,!0),g)})}for(let{key:{value:u}}of r.contents.items)/^tags?$/i.test(u)?c(u,!1):/^alias(es)?$/i.test(u)&&c(u,!0);return o?e.replace(i,_t.stringify(r.contents.srcToken)):e}};async function sr(s,e,t=e){let n=await Ao(e,t);if(n===!1)return;if(!n||n===e)return new Le.Notice("Unchanged or empty tag: No changes made.");let i=new A(e),r=new A(n),o=new Zt(i,r),a=o.willMergeTags(To(s).reverse());if(a&&await Lo(a,i,r))return;let c=await In(s,i);if(!c)return;let u=new ct(`Renaming to #${n}/*`,"Processing files..."),f=0;return await u.forEach(c,async h=>{u.message="Processing "+h.basename,await h.renamed(o)&&f++}),new Le.Notice(`Operation ${u.aborted?"cancelled":"complete"}: ${f} file(s) updated`)}function To(s){return Object.keys(s.metadataCache.getTags())}async function In(s,e){let t=[],n=new ct(`Searching for ${e}/*`,"Matching files...");if(await n.forEach(s.metadataCache.getCachedFiles(),i=>{let{frontmatter:r,tags:o}=s.metadataCache.getCache(i)||{};o=(o||[]).filter(c=>c.tag&&e.matches(c.tag)).reverse();let a=((0,Le.parseFrontMatterTags)(r)||[]).filter(e.matches),l=((0,Le.parseFrontMatterAliases)(r)||[]).filter(A.isTag).filter(e.matches);(o.length||a.length||l.length)&&t.push(new xs(s,i,o,a.length+l.length))}),!n.aborted)return t}async function Ao(s,e=s){return await new hi().setTitle(`Renaming #${s} (and any sub-tags)`).setContent(`Enter new name (must be a valid Obsidian tag name):
|
||||
`).setPattern("[^\u2000-\u206F\u2E00-\u2E7F'!\"#$%&\\(\\)*+,.:;<=>?@^`\\{\\|\\}~\\[\\]\\\\\\s]+").onInvalidEntry(t=>new Le.Notice(`"${t}" is not a valid Obsidian tag name`)).setValue(e).prompt()}async function Lo([s,e],t,n){return!await new Xt().setTitle("WARNING: No Undo!").setContent(activeWindow.createEl("p",void 0,i=>{i.innerHTML=`Renaming <code>${t}</code> to <code>${n}</code> will merge ${s.canonical===t.canonical?"these tags":`multiple tags
|
||||
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=Ps(e),n=Bt(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Ps(e),n=Bt(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function Co(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new $t||null,prettyErrors:e}}function _n(s,e={}){let{lineCounter:t,prettyErrors:n}=Co(e),i=new Dt(t==null?void 0:t.addNewLine),r=new Lt(e),o=null;for(let a of r.compose(i.parse(s),!0,s.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new G(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(bn(s,t)),o.warnings.forEach(bn(s,t))),o}var Ms=class{constructor(e,t,n,i){this.app=e,this.filename=t,this.basename=t.split("/").pop(),this.tagPositions=n,this.hasFrontMatter=!!i}async renamed(e){let t=this.app.vault.getAbstractFileByPath(this.filename),n=await this.app.vault.read(t),i=n;for(let{position:{start:r,end:o},tag:a}of this.tagPositions){if(i.slice(r.offset,o.offset)!==a){let l=`File ${this.filename} has changed; skipping`;new In.Notice(l),console.error(l),console.debug(i.slice(r.offset,o.offset),a);return}i=e.inString(i,r.offset)}if(this.hasFrontMatter&&(i=this.replaceInFrontMatter(i,e)),i!==n)return await this.app.vault.modify(t,i),!0}replaceInFrontMatter(e,t){let[n,i]=e.split(/^---\r?$\n?/m,2);if(n.trim()!==""||!i.trim()||!i.endsWith(`
|
||||
`))return e;let r=_n(i,{keepSourceTokens:!0});if(r.errors.length){let u=`YAML issue with ${this.filename}: ${r.errors[0]}`;console.error(u),new In.Notice(u+"; skipping frontmatter");return}let o=!1,a=r.toJSON();function l(u,f,h=!1){Pt.setScalarValue(u.srcToken,f,{afterKey:h}),o=!0,u.value=f}function c(u,f){let h=r.get(u,!0);if(!h)return;let d=a[u];if(!(!d||!d.length))if(typeof d=="string"){let g=d.split(f?/(^\s+|\s*,\s*|\s+$)/:/([\s,]+)/),p=t.inArray(g,!0,f).join("");d!=p&&l(h,p,!0)}else Array.isArray(d)&&t.inArray(d,!1,f).forEach((g,p)=>{d[p]!==g&&l(h.get(p,!0),g)})}for(let{key:{value:u}}of r.contents.items)/^tags?$/i.test(u)?c(u,!1):/^alias(es)?$/i.test(u)&&c(u,!0);return o?e.replace(i,Pt.stringify(r.contents.srcToken)):e}};async function nr(s,e,t=e){let n=await Lo(e,t);if(n===!1)return;if(!n||n===e)return new Ie.Notice("Unchanged or empty tag: No changes made.");let i=new A(e),r=new A(n),o=new ts(i,r),a=o.willMergeTags(Ao(s).reverse());if(a&&await _o(a,i,r))return;let c=await xn(s,i);if(!c)return;let u=new ft(`Renaming to #${n}/*`,"Processing files..."),f=0;return await u.forEach(c,async h=>{u.message="Processing "+h.basename,await h.renamed(o)&&f++}),new Ie.Notice(`Operation ${u.aborted?"cancelled":"complete"}: ${f} file(s) updated`)}function Ao(s){return Object.keys(s.metadataCache.getTags())}async function xn(s,e){let t=[],n=new ft(`Searching for ${e}/*`,"Matching files...");if(await n.forEach(s.metadataCache.getCachedFiles(),i=>{let{frontmatter:r,tags:o}=s.metadataCache.getCache(i)||{};o=(o||[]).filter(c=>c.tag&&e.matches(c.tag)).reverse();let a=((0,Ie.parseFrontMatterTags)(r)||[]).filter(e.matches),l=((0,Ie.parseFrontMatterAliases)(r)||[]).filter(A.isTag).filter(e.matches);(o.length||a.length||l.length)&&t.push(new Ms(s,i,o,a.length+l.length))}),!n.aborted)return t}async function Lo(s,e=s){return await new di().setTitle(`Renaming #${s} (and any sub-tags)`).setContent(`Enter new name (must be a valid Obsidian tag name):
|
||||
`).setPattern("[^\u2000-\u206F\u2E00-\u2E7F'!\"#$%&\\(\\)*+,.:;<=>?@^`\\{\\|\\}~\\[\\]\\\\\\s]+").onInvalidEntry(t=>new Ie.Notice(`"${t}" is not a valid Obsidian tag name`)).setValue(e).prompt()}async function _o([s,e],t,n){return!await new es().setTitle("WARNING: No Undo!").setContent(activeWindow.createEl("p",void 0,i=>{i.innerHTML=`Renaming <code>${t}</code> to <code>${n}</code> will merge ${s.canonical===t.canonical?"these tags":`multiple tags
|
||||
into existing tags (such as <code>${s}</code>
|
||||
merging with <code>${e}</code>)`}.<br><br>
|
||||
This <b>cannot</b> be undone. Do you wish to proceed?`})).setup(i=>i.okButton.addClass("mod-warning")).confirm()}var nr="tag-wrangler:tag-pane";function ve(s,e,t,n,i){return s.on(e,t,n,i),()=>s.off(e,t,n,i)}var Ps=class extends I.Plugin{constructor(){super(...arguments);Se(this,"use",fi.plugin(this));Se(this,"pageAliases",new Map);Se(this,"tagPages",new Map)}tagPage(t){return Array.from(this.tagPages.get(A.canonical(t))||"")[0]}openTagPage(t,n,i){let r={eState:n?{rename:"all"}:{focus:!0},...n?{state:{mode:"source"}}:{}};return this.app.workspace.getLeaf(i).openFile(t,r)}async createTagPage(t,n){var a;let r={tag:new A(t).canonical,file:void 0};app.workspace.trigger("tag-page:will-create",r);let o=r.file&&await r.file;if(!o){let l=new A(t).name.split("/").join(" "),c=this.app.fileManager.getNewFileParent(((a=this.app.workspace.getActiveFile())==null?void 0:a.path)||""),u=this.app.vault.getAvailablePath(c.getParentPrefix()+l,"md");o=await this.app.vault.create(u,["---",`Aliases: [ ${JSON.stringify(A.toTag(t))} ]`,"---",""].join(`
|
||||
`))}r.file=o,await this.openTagPage(o,!0,n),app.workspace.trigger("tag-page:did-create",r)}onload(){this.registerEvent(app.workspace.on("editor-menu",(r,o)=>{let a=o.getClickableTokenAt(o.getCursor());(a==null?void 0:a.type)==="tag"&&this.setupMenu(r,a.text)})),this.register(ve(document,"contextmenu",".tag-pane-tag",this.onMenu.bind(this),{capture:!0})),this.app.workspace.registerHoverLinkSource(nr,{display:"Tags View",defaultMod:!0}),this.addChild(new Ze(this,{hoverSource:nr,selector:".tag-pane-tag",container:".tag-container",toTag(r){var o;return(o=r.find(".tag-pane-tag-text, tag-pane-tag-text, .tag-pane-tag .tree-item-inner-text"))==null?void 0:o.textContent}})),this.addChild(new Ze(this,{hoverSource:"preview",selector:'a.tag[href^="#"]',container:".markdown-preview-view, .markdown-embed, .workspace-leaf-content",toTag(r){return r.getAttribute("href")}})),this.addChild(new Ze(this,{hoverSource:"preview",selector:'.metadata-property[data-property-key="tags"] .multi-select-pill',container:".metadata-properties",mergeMenu:!0,toTag(r){return r.textContent}})),this.addChild(new Ze(this,{hoverSource:"editor",selector:"span.cm-hashtag",container:".markdown-source-view",toTag(r){let o=r.textContent;if(!r.matches(".cm-formatting"))for(let a=r.previousElementSibling;a!=null&&a.matches("span.cm-hashtag:not(.cm-formatting)");a=a.previousElementSibling)o=a.textContent+o;for(let a=r.nextElementSibling;a!=null&&a.matches("span.cm-hashtag:not(.cm-formatting)");a=a.nextElementSibling)o+=a.textContent;return o}})),this.register(ve(document,"pointerdown",".tag-pane-tag",(r,o)=>{o.draggable="true"},{capture:!0})),this.register(ve(document,"dragstart",".tag-pane-tag",(r,o)=>{var c;let a=(c=o.find(".tag-pane-tag-text, tag-pane-tag-text, .tag-pane-tag .tree-item-inner-text"))==null?void 0:c.textContent;r.dataTransfer.setData("text/plain","#"+a),app.dragManager.onDragStart(r,{source:"tag-wrangler",type:"text",title:a,icon:"hashtag"}),window.addEventListener("dragend",l,!0),window.addEventListener("drop",l,!0);function l(){app.dragManager.draggable=null,window.removeEventListener("dragend",l,!0),window.removeEventListener("drop",l,!0)}},{capture:!1}));let t=(r,o,a=app.dragManager.draggable,l)=>{var f;if((a==null?void 0:a.source)!=="tag-wrangler"||r.defaultPrevented)return;let c=(f=o.find(".tag-pane-tag-text, tag-pane-tag-text, .tag-pane-tag .tree-item-inner-text"))==null?void 0:f.textContent,u=c+"/"+A.toName(a.title).split("/").pop();A.canonical(c)!==A.canonical(a.title)&&(r.dataTransfer.dropEffect="move",r.preventDefault(),l?this.rename(A.toName(a.title),u):(app.dragManager.updateHover(o,"is-being-dragged-over"),app.dragManager.setAction(`Rename to ${u}`)))};this.register(ve(document.body,"dragover",".tag-pane-tag.tree-item-self",t,{capture:!0})),this.register(ve(document.body,"dragenter",".tag-pane-tag.tree-item-self",t,{capture:!0})),this.registerDomEvent(window,"drop",r=>{var l;let o=(l=r.target)==null?void 0:l.matchParent(".tag-pane-tag.tree-item-self",r.currentTarget);if(!o)return;let a=app.dragManager.draggable;a&&!r.defaultPrevented&&t(r,o,a,!0)},{capture:!0});let n=this.app.metadataCache,i=this;this.register(lt(n,{getTags(r){return function(){let a=r.call(this),l=new Set(Object.keys(a).map(c=>c.toLowerCase()));for(let c of i.tagPages.keys())l.has(c)||(a[i.tagPages.get(c).tag]=0);return a}}})),this.app.workspace.onLayoutReady(()=>{n.getCachedFiles().forEach(r=>{var a,l;let o=(a=n.getCache(r))==null?void 0:a.frontmatter;o&&((l=(0,I.parseFrontMatterAliases)(o))!=null&&l.filter(A.isTag))&&this.updatePage(this.app.vault.getAbstractFileByPath(r),o)}),this.registerEvent(n.on("changed",(r,o,a)=>this.updatePage(r,a==null?void 0:a.frontmatter))),this.registerEvent(this.app.vault.on("delete",r=>this.updatePage(r))),app.workspace.getLeavesOfType("tag").forEach(r=>{var o,a;(a=(o=r==null?void 0:r.view)==null?void 0:o.requestUpdateTags)==null||a.call(o)})})}updatePage(t,n){var r;let i=((r=(0,I.parseFrontMatterAliases)(n))==null?void 0:r.filter(A.isTag))||[];if(this.pageAliases.has(t)){let o=new Set(i||[]);for(let a of this.pageAliases.get(t)){if(o.has(a))continue;let l=A.canonical(a),c=this.tagPages.get(l);c&&(c.delete(t),c.size||this.tagPages.delete(l))}i.length||this.pageAliases.delete(t)}if(i.length){this.pageAliases.set(t,i);for(let o of i){let a=A.canonical(o);if(this.tagPages.has(a))this.tagPages.get(a).add(t);else{let l=new Set([t]);l.tag=A.toTag(o),this.tagPages.set(a,l)}}}}onMenu(t,n){let i=ir(t),r=n.find(".tag-pane-tag-text, .tag-pane-tag .tree-item-inner-text").textContent,o=n.parentElement.parentElement.find(".collapse-icon");if(this.setupMenu(i,r,o),o){let u=function(f){var h;for(let d of(h=c.children)!=null?h:c.vChildren.children)d.setCollapsed(f)},a=r.split("/").slice(0,-1).join("/"),l=this.leafView(n.matchParent(".workspace-leaf")),c=a?l.tagDoms["#"+a.toLowerCase()]:l.root;i.addItem(be("tag-hierarchy","vertical-three-dots","Collapse tags at this level",()=>u(!0))).addItem(be("tag-hierarchy","expand-vertically","Expand
Line truncated
|
||||
This <b>cannot</b> be undone. Do you wish to proceed?`})).setup(i=>i.okButton.addClass("mod-warning")).confirm()}var ir="tag-wrangler:tag-pane",{document:Se}=globalThis;function ke(s,e,t,n,i){return s.on(e,t,n,i),()=>s.off(e,t,n,i)}var $s=class extends _.Plugin{constructor(){super(...arguments);Ee(this,"use",hi.plugin(this));Ee(this,"pageAliases",new Map);Ee(this,"tagPages",new Map)}tagPage(t){return Array.from(this.tagPages.get(A.canonical(t))||"")[0]}openTagPage(t,n,i){let r={eState:n?{rename:"all"}:{focus:!0},...n?{state:{mode:"source"}}:{}};return this.app.workspace.getLeaf(i).openFile(t,r)}async createTagPage(t,n){var a;let r={tag:new A(t).canonical,file:void 0};j.workspace.trigger("tag-page:will-create",r);let o=r.file&&await r.file;if(!o){let l=new A(t).name.split("/").join(" "),c=this.app.fileManager.getNewFileParent(((a=this.app.workspace.getActiveFile())==null?void 0:a.path)||""),u=this.app.vault.getAvailablePath(c.getParentPrefix()+l,"md");o=await this.app.vault.create(u,["---",`Aliases: [ ${JSON.stringify(A.toTag(t))} ]`,"---",""].join(`
|
||||
`))}r.file=o,await this.openTagPage(o,!0,n),j.workspace.trigger("tag-page:did-create",r)}onload(){this.registerEvent(j.workspace.on("editor-menu",(r,o)=>{let a=o.getClickableTokenAt(o.getCursor());(a==null?void 0:a.type)==="tag"&&this.setupMenu(r,a.text)})),this.register(ke(Se,"contextmenu",".tag-pane-tag",this.onMenu.bind(this),{capture:!0})),this.app.workspace.registerHoverLinkSource(ir,{display:"Tags View",defaultMod:!0}),this.addChild(new tt(this,{hoverSource:ir,selector:".tag-pane-tag",container:".tag-container",toTag(r){var o;return(o=r.find(".tag-pane-tag-text, tag-pane-tag-text, .tag-pane-tag .tree-item-inner-text"))==null?void 0:o.textContent}})),this.addChild(new tt(this,{hoverSource:"preview",selector:'a.tag[href^="#"]',container:".markdown-preview-view, .markdown-embed, .workspace-leaf-content",toTag(r){return r.getAttribute("href")}})),this.addChild(new tt(this,{hoverSource:"preview",selector:'.metadata-property[data-property-key="tags"] .multi-select-pill',container:".metadata-properties",mergeMenu:!0,toTag(r){return r.textContent}})),this.addChild(new tt(this,{hoverSource:"editor",selector:"span.cm-hashtag",container:".markdown-source-view",toTag(r){let o=r.textContent;if(!r.matches(".cm-formatting"))for(let a=r.previousElementSibling;a!=null&&a.matches("span.cm-hashtag:not(.cm-formatting)");a=a.previousElementSibling)o=a.textContent+o;for(let a=r.nextElementSibling;a!=null&&a.matches("span.cm-hashtag:not(.cm-formatting)");a=a.nextElementSibling)o+=a.textContent;return o}})),this.register(ke(Se,"pointerdown",".tag-pane-tag",(r,o)=>{o.draggable="true"},{capture:!0})),this.register(ke(Se,"dragstart",".tag-pane-tag",(r,o)=>{var c;let a=(c=o.find(".tag-pane-tag-text, tag-pane-tag-text, .tag-pane-tag .tree-item-inner-text"))==null?void 0:c.textContent;r.dataTransfer.setData("text/plain","#"+a),j.dragManager.onDragStart(r,{source:"tag-wrangler",type:"text",title:a,icon:"hashtag"}),window.addEventListener("dragend",l,!0),window.addEventListener("drop",l,!0);function l(){j.dragManager.draggable=null,window.removeEventListener("dragend",l,!0),window.removeEventListener("drop",l,!0)}},{capture:!1}));let t=(r,o,a=j.dragManager.draggable,l)=>{var f;if((a==null?void 0:a.source)!=="tag-wrangler"||r.defaultPrevented)return;let c=(f=o.find(".tag-pane-tag-text, tag-pane-tag-text, .tag-pane-tag .tree-item-inner-text"))==null?void 0:f.textContent,u=c+"/"+A.toName(a.title).split("/").pop();A.canonical(c)!==A.canonical(a.title)&&(r.dataTransfer.dropEffect="move",r.preventDefault(),l?this.rename(A.toName(a.title),u):(j.dragManager.updateHover(o,"is-being-dragged-over"),j.dragManager.setAction(`Rename to ${u}`)))};this.register(ke(Se.body,"dragover",".tag-pane-tag.tree-item-self",t,{capture:!0})),this.register(ke(Se.body,"dragenter",".tag-pane-tag.tree-item-self",t,{capture:!0})),this.registerDomEvent(window,"drop",r=>{var l;let o=(l=r.target)==null?void 0:l.matchParent(".tag-pane-tag.tree-item-self",r.currentTarget);if(!o)return;let a=j.dragManager.draggable;a&&!r.defaultPrevented&&t(r,o,a,!0)},{capture:!0});let n=this.app.metadataCache,i=(()=>this)();this.register(ut(n,{getTags(r){return function(){let a=r.call(this),l=new Set(Object.keys(a).map(c=>c.toLowerCase()));for(let c of i.tagPages.keys())l.has(c)||(a[i.tagPages.get(c).tag]=0);return a}}})),this.app.workspace.onLayoutReady(()=>{n.getCachedFiles().forEach(r=>{var a,l;let o=(a=n.getCache(r))==null?void 0:a.frontmatter;o&&((l=(0,_.parseFrontMatterAliases)(o))!=null&&l.filter(A.isTag))&&this.updatePage(this.app.vault.getAbstractFileByPath(r),o)}),this.registerEvent(n.on("changed",(r,o,a)=>this.updatePage(r,a==null?void 0:a.frontmatter))),this.registerEvent(this.app.vault.on("delete",r=>this.updatePage(r))),j.workspace.getLeavesOfType("tag").forEach(r=>{var o,a;(a=(o=r==null?void 0:r.view)==null?void 0:o.requestUpdateTags)==null||a.call(o)})})}updatePage(t,n){var r;let i=((r=(0,_.parseFrontMatterAliases)(n))==null?void 0:r.filter(A.isTag))||[];if(this.pageAliases.has(t)){let o=new Set(i||[]);for(let a of this.pageAliases.get(t)){if(o.has(a))continue;let l=A.canonical(a),c=this.tagPages.get(l);c&&(c.delete(t),c.size||this.tagPages.delete(l))}i.length||this.pageAliases.delete(t)}if(i.length){this.pageAliases.set(t,i);for(let o of i){let a=A.canonical(o);if(this.tagPages.has(a))this.tagPages.get(a).add(t);else{let l=new Set([t]);l.tag=A.toTag(o),this.tagPages.set(a,l)}}}}onMenu(t,n){var a;let i=rr(t),r=n.find(".tag-pane-tag-text, .tag-pane-tag .tree-item-inner-text").textContent,o=n.parentElement.parentElement.find(".collapse-icon");if(this.setupMenu(i,r,o),o){let f=function(h){var d;for(let g of(d=u.children)!=null?d:u.vChildren.children)g.setCollapsed(h)},l=r.split("/").slice(0,-1).join("/"),c=this.leafView(n.matchParent(".workspace-leaf")),u=l?c.tagDoms["#"+l.toLowerCase()]:(a=c.root)!=null?a:c.tree.root;i.addItem(ve("tag-hierarchy","vertical-three-dots","Collapse tags at this level",()=>f(!0))).addItem(ve("tag-hierarchy","expand-vertically","Expand tags at t
Line truncated
|
||||
|
||||
/* nosourcemap */
|
||||
+3
-3
@@ -3,9 +3,9 @@
|
||||
"name": "Tag Wrangler",
|
||||
"author": "PJ Eby",
|
||||
"authorUrl": "https://github.com/pjeby",
|
||||
"version": "0.6.4",
|
||||
"minAppVersion": "1.5.8",
|
||||
"description": "Rename, merge, toggle, and search tags from the tags view",
|
||||
"version": "0.6.5",
|
||||
"minAppVersion": "1.12.7",
|
||||
"description": "Rename, merge, toggle, and search tags from the tags view; create/open tag pages, and more.",
|
||||
"fundingUrl": "https://dirtsimple.org/tips/tag-wrangler",
|
||||
"isDesktopOnly": false
|
||||
}
|
||||
Reference in new issue
Block a user